Showing the changes to apps/server/src (2 of 4 files). Show all
Unified · Split
| @@ -0,0 +1,33 @@ | ||
| 1 | +import { | |
| 2 | + EventId, | |
| 3 | + ProviderDriverKind, | |
| 4 | + RuntimeRequestId, | |
| 5 | + ThreadId, | |
| 6 | + type ProviderRuntimeEvent, | |
| 7 | +} from "@t3tools/contracts"; | |
| 8 | +import { describe, expect, it } from "vite-plus/test"; | |
| 9 | + | |
| 10 | +import { runtimeEventToActivities } from "./ProviderRuntimeIngestion.ts"; | |
| 11 | + | |
| 12 | +describe("runtimeEventToActivities approval details", () => { | |
| 13 | + it("preserves complete multiline command details", () => { | |
| 14 | + const detail = `bun run release -- ${"long-argument ".repeat(20)}\nsecond line`; | |
| 15 | + const event = { | |
| 16 | + type: "request.opened", | |
| 17 | + eventId: EventId.make("evt-request-opened"), | |
| 18 | + provider: ProviderDriverKind.make("codex"), | |
| 19 | + createdAt: "2026-07-18T00:00:00.000Z", | |
| 20 | + threadId: ThreadId.make("thread-1"), | |
| 21 | + requestId: RuntimeRequestId.make("approval-1"), | |
| 22 | + payload: { | |
| 23 | + requestType: "command_execution_approval", | |
| 24 | + detail, | |
| 25 | + }, | |
| 26 | + } satisfies ProviderRuntimeEvent; | |
| 27 | + | |
| 28 | + const [activity] = runtimeEventToActivities(event); | |
| 29 | + | |
| 30 | + expect(activity?.kind).toBe("approval.requested"); | |
| 31 | + expect((activity?.payload as Record<string, unknown> | undefined)?.detail).toBe(detail); | |
| 32 | + }); | |
| 33 | +}); | |
| @@ -306,7 +306,7 @@ function requestKindFromCanonicalRequestType( · 305 unmodified lines | ||
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | −function runtimeEventToActivities( | |
| 309 | +export function runtimeEventToActivities( | |
| 310 | 310 | event: ProviderRuntimeEvent, |
| 311 | 311 | taskTitle?: string, |
| 312 | 312 | ): ReadonlyArray<OrchestrationThreadActivity> { |
| @@ -340,7 +340,7 @@ function runtimeEventToActivities( · 27 unmodified lines | ||
| 340 | 340 | requestId: toApprovalRequestId(event.requestId), |
| 341 | 341 | ...(requestKind ? { requestKind } : {}), |
| 342 | 342 | requestType: event.payload.requestType, |
| 343 | − ...(event.payload.detail ? { detail: truncateDetail(event.payload.detail) } : {}), | |
| 343 | + ...(event.payload.detail ? { detail: event.payload.detail } : {}), | |
| 344 | 344 | }, |
| 345 | 345 | turnId: toTurnId(event.turnId) ?? null, |
| 346 | 346 | ...maybeSequence, |