effect-durable-agent 0.1.0-alpha.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/assert-never-CoyUpoRB.js +18 -0
- package/dist/assert-never-CoyUpoRB.js.map +1 -0
- package/dist/{commands-Ce1ec6kH.d.ts → commands-BUquEZVP.d.ts} +31 -12
- package/dist/{compaction-BgDr5VJy.js → compaction-63iEDHHl.js} +63 -13
- package/dist/compaction-63iEDHHl.js.map +1 -0
- package/dist/{context-projection-n6Rdup0N.d.ts → context-projection-Bezx3drD.d.ts} +16 -40
- package/dist/{core-CYT6DBaS.d.ts → core-BcimKMIv.d.ts} +5 -3
- package/dist/delivery-2ZILvoRD.js +507 -0
- package/dist/delivery-2ZILvoRD.js.map +1 -0
- package/dist/delivery-D3MxW4wg.d.ts +3026 -0
- package/dist/domain/command-queues.d.ts +81 -2
- package/dist/domain/command-queues.js +1 -1
- package/dist/domain/command-queues.js.map +1 -1
- package/dist/domain/context-projection.d.ts +1 -1
- package/dist/domain/context-projection.js +1 -1
- package/dist/domain/context-projection.js.map +1 -1
- package/dist/domain/message-transcript.d.ts +36 -2
- package/dist/domain/message-transcript.js +10 -2
- package/dist/domain/message-transcript.js.map +1 -1
- package/dist/domain/model-usage.d.ts +1 -1
- package/dist/domain/model-usage.js +1 -1
- package/dist/domain/reduced-state-schema.d.ts +3 -992
- package/dist/domain/reduced-state-schema.js +126 -7
- package/dist/domain/reduced-state-schema.js.map +1 -1
- package/dist/domain/reduced-state.d.ts +2 -2
- package/dist/domain/reduced-state.js +936 -2
- package/dist/domain/reduced-state.js.map +1 -0
- package/dist/domain/run-scheduling.d.ts +2 -0
- package/dist/domain/run-scheduling.js +127 -0
- package/dist/domain/run-scheduling.js.map +1 -0
- package/dist/{durable-br2C1bWK.d.ts → durable-168Womqp.d.ts} +8535 -2859
- package/dist/{durable-BGFvX7Mh.js → durable-D13w1Qr3.js} +229 -15
- package/dist/durable-D13w1Qr3.js.map +1 -0
- package/dist/{envelope-DxQzo5rN.js → envelope-BCzKUq_z.js} +12 -3
- package/dist/envelope-BCzKUq_z.js.map +1 -0
- package/dist/{envelope-DkZyMIgp.d.ts → envelope-Che6KatU.d.ts} +70 -7
- package/dist/{event-factory-DTFdy0Cb.js → event-factory-_vF1bIJ7.js} +7 -3
- package/dist/event-factory-_vF1bIJ7.js.map +1 -0
- package/dist/{events-LZFNoESe.d.ts → events-DwTARLMv.d.ts} +139 -137
- package/dist/{id-generator-Ckl8_XWW.d.ts → id-generator-BKGoKjt-.d.ts} +3 -3
- package/dist/in-memory-CeODnZhE.js +150 -0
- package/dist/in-memory-CeODnZhE.js.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +6 -6
- package/dist/interpreter-DKGJ1sSx.js +1452 -0
- package/dist/interpreter-DKGJ1sSx.js.map +1 -0
- package/dist/{keep-alive-Chl5SJxy.d.ts → keep-alive-_zFCUvt3.d.ts} +1 -2
- package/dist/{model-resolver-BPPJAsuh.d.ts → model-resolver-DeBDK8XO.d.ts} +11 -5
- package/dist/{model-usage-CdBEkTwU.d.ts → model-usage-0GeHwaaU.d.ts} +2 -3
- package/dist/records--54mZEBx.js +675 -0
- package/dist/records--54mZEBx.js.map +1 -0
- package/dist/reduced-state-B1cvy8N_.d.ts +51110 -0
- package/dist/reduced-state-schema-B98exWxQ.d.ts +2338 -0
- package/dist/{reducer-registry-aFjz_ZLT.d.ts → reducer-registry-DhGVzHBV.d.ts} +12 -6
- package/dist/run-scheduling-wakeup-Mjic4tb_.d.ts +24 -0
- package/dist/services/compaction.d.ts +2 -2
- package/dist/services/compaction.js +2 -2
- package/dist/services/id-generator.d.ts +1 -1
- package/dist/services/id-generator.js +6 -12
- package/dist/services/id-generator.js.map +1 -1
- package/dist/services/keep-alive.d.ts +1 -1
- package/dist/services/keep-alive.js.map +1 -1
- package/dist/services/model-call.d.ts +15 -0
- package/dist/services/model-call.js +15 -0
- package/dist/services/model-call.js.map +1 -0
- package/dist/services/model-resolver.d.ts +1 -1
- package/dist/services/model-resolver.js +1 -1
- package/dist/services/model-resolver.js.map +1 -1
- package/dist/services/prompt-projector.d.ts +2 -2
- package/dist/services/prompt-projector.js +49 -5
- package/dist/services/prompt-projector.js.map +1 -1
- package/dist/services/reducer-registry.d.ts +1 -1
- package/dist/services/reducer-registry.js +19 -6
- package/dist/services/reducer-registry.js.map +1 -1
- package/dist/services/run-scheduler.d.ts +2 -2
- package/dist/services/run-scheduler.js +25 -2
- package/dist/services/run-scheduler.js.map +1 -0
- package/dist/services/run-scheduling-wakeup.d.ts +2 -0
- package/dist/services/run-scheduling-wakeup.js +13 -0
- package/dist/services/run-scheduling-wakeup.js.map +1 -0
- package/dist/services/runtime-layer.d.ts +17 -33
- package/dist/services/runtime-layer.js +19 -14
- package/dist/services/runtime-layer.js.map +1 -1
- package/dist/services/runtime.d.ts +1 -1
- package/dist/services/runtime.js +31 -20
- package/dist/services/runtime.js.map +1 -1
- package/dist/services/session-event-observer.d.ts +1 -1
- package/dist/services/session-event-observer.js.map +1 -1
- package/dist/services/session-query.d.ts +1 -1
- package/dist/services/session-query.js +57 -10
- package/dist/services/session-query.js.map +1 -1
- package/dist/services/session-state.d.ts +1 -1
- package/dist/services/session-state.js +1 -1
- package/dist/services/session-store.d.ts +2 -2
- package/dist/services/session-store.js +127 -37
- package/dist/services/session-store.js.map +1 -1
- package/dist/services/sink-checkpoint-store.d.ts +1 -1
- package/dist/services/sink-checkpoint-store.js +2 -1
- package/dist/services/sink-checkpoint-store.js.map +1 -1
- package/dist/services/sink-registry.d.ts +2 -2
- package/dist/services/sink-registry.js +1 -1
- package/dist/services/span-names.d.ts +1 -1
- package/dist/services/span-names.js +6 -1
- package/dist/services/span-names.js.map +1 -1
- package/dist/services/tool-registry.d.ts +2 -2
- package/dist/services/tool-registry.js +12 -3
- package/dist/services/tool-registry.js.map +1 -1
- package/dist/services/tracing.d.ts +3 -3
- package/dist/services/tracing.js +2 -2
- package/dist/services/tracing.js.map +1 -1
- package/dist/{session-event-observer-DaFMKKNc.d.ts → session-event-observer-DlP9ITB2.d.ts} +3 -3
- package/dist/{session-state-Bkc6u-Wr.js → session-state-BehvUVyq.js} +659 -164
- package/dist/session-state-BehvUVyq.js.map +1 -0
- package/dist/session-store-BL6sfrnn.d.ts +3326 -0
- package/dist/{sink-checkpoint-store-M7qIxoSH.d.ts → sink-checkpoint-store-DvuHwvx_.d.ts} +3 -4
- package/dist/sink-registry-DskRcyOS.js +345 -0
- package/dist/sink-registry-DskRcyOS.js.map +1 -0
- package/dist/subscription-DZNWFDTV.d.ts +966 -0
- package/dist/subscription-DmO3BcdT.js +505 -0
- package/dist/subscription-DmO3BcdT.js.map +1 -0
- package/dist/testkit/layers.d.ts +30 -23
- package/dist/testkit/layers.js +23 -15
- package/dist/testkit/layers.js.map +1 -1
- package/dist/testkit/transcript.d.ts +226 -0
- package/dist/testkit/transcript.js +1475 -0
- package/dist/testkit/transcript.js.map +1 -0
- package/dist/{tool-registry-BJaVNtw4.d.ts → tool-registry-CHHUU9BN.d.ts} +44 -8
- package/dist/{tracing-BXHAkxkx.d.ts → tracing-BwjbF285.d.ts} +1 -2
- package/dist/transcript.d.ts +101 -0
- package/dist/transcript.js +107 -0
- package/dist/transcript.js.map +1 -0
- package/dist/types/commands.d.ts +2 -2
- package/dist/types/commands.js +8 -3
- package/dist/types/commands.js.map +1 -1
- package/dist/types/core.d.ts +2 -2
- package/dist/types/core.js +3 -1
- package/dist/types/core.js.map +1 -1
- package/dist/types/events/durable.d.ts +2 -2
- package/dist/types/events/durable.js +2 -2
- package/dist/types/events.d.ts +5 -5
- package/dist/types/events.js +3 -3
- package/dist/types/tracing.d.ts +1 -1
- package/dist/types/tracing.js.map +1 -1
- package/dist/websocket/events.d.ts +2 -0
- package/dist/websocket/events.js +2 -0
- package/dist/websocket.d.ts +2123 -2552
- package/dist/websocket.js +628 -442
- package/dist/websocket.js.map +1 -1
- package/dist/window-read-Brov9VdQ.d.ts +113 -0
- package/dist/window-read-DPFAA1hM.js +264 -0
- package/dist/window-read-DPFAA1hM.js.map +1 -0
- package/package.json +37 -13
- package/dist/command-queues-DdDB_aYM.d.ts +0 -462
- package/dist/compaction-BgDr5VJy.js.map +0 -1
- package/dist/compaction-ch8z6G9x.d.ts +0 -165
- package/dist/durable-BGFvX7Mh.js.map +0 -1
- package/dist/envelope-DxQzo5rN.js.map +0 -1
- package/dist/event-factory-DTFdy0Cb.js.map +0 -1
- package/dist/event-factory-Di1jwQvm.d.ts +0 -87
- package/dist/index-BVVgDSdq.d.ts +0 -1
- package/dist/message-transcript-DQNlzxle.d.ts +0 -32
- package/dist/prompt-projector-f4ElyXCE.d.ts +0 -39
- package/dist/reduced-state-DF0-6mbR.js +0 -921
- package/dist/reduced-state-DF0-6mbR.js.map +0 -1
- package/dist/run-scheduler-CAt7dF6C.js +0 -21
- package/dist/run-scheduler-CAt7dF6C.js.map +0 -1
- package/dist/run-scheduler-xkhZyto5.d.ts +0 -44
- package/dist/runtime-DDSYP9jS.d.ts +0 -63
- package/dist/session-query-B72HY_0L.d.ts +0 -45
- package/dist/session-state-Bkc6u-Wr.js.map +0 -1
- package/dist/session-state-C9YLSAso.d.ts +0 -862
- package/dist/session-store-Cpi_NwTR.d.ts +0 -206
- package/dist/sink-registry-Bl-vQES6.d.ts +0 -133
- package/dist/sink-registry-NDgeyzO0.js +0 -272
- package/dist/sink-registry-NDgeyzO0.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.js","names":[],"sources":["../../src/transcript/transcript-testkit.ts","../../src/transcript/transcript-scenarios.ts"],"sourcesContent":["import * as Prompt from \"effect/ai/Prompt\";\nimport * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport { durableMessageTranscript } from \"../domain/message-transcript\";\nimport { reduceCommittedEvents } from \"../domain/reduced-state\";\nimport type { CommittedDurableEvent } from \"../services/session-store\";\nimport { SequenceNumber, SessionId, durablePosition } from \"../types/core\";\nimport { effectDurableAgentNamespace, type DurableEventEnvelope } from \"../types/events/envelope\";\nimport { decodeDurableEventSync } from \"../types/events/durable\";\nimport { makeEDATraceContext } from \"../types/tracing\";\nimport { canonicalJson } from \"./version\";\nimport {\n advanceTranscriptVersion,\n emptyTranscriptVersion,\n type InMemoryTranscriptVersion,\n} from \"./in-memory\";\nimport {\n emptyTranscriptMappings,\n makeTranscriptDefinition,\n type TranscriptDefinition,\n type TranscriptMappings,\n} from \"./mapping\";\nimport {\n TranscriptRecordFromEnvelope,\n isTopLevelTranscriptRecord,\n type TranscriptRecord,\n} from \"./records\";\n\n/**\n * Test-only builders for transcript interpretation: deterministic ids, a log writer that goes\n * through the real durable decoders, and helpers that project and normalize logs.\n */\n\nconst traceContext = makeEDATraceContext({\n traceId: \"0123456789abcdef0123456789abcdef\",\n spanId: \"0123456789abcdef\",\n});\n/** The encoded trace every test event carries. */\nexport const testEventTrace = { span: traceContext, links: [] };\nconst runTrace = { root: traceContext, links: [] };\n\n/** Deterministic UUIDv7-shaped id; `space` keeps identities of different kinds apart. */\nexport const testId = (space: number, slot: number): string =>\n `018f6bd5-2f2a-7${space.toString(16).padStart(3, \"0\")}-8${(slot >> 48).toString(16).padStart(3, \"0\")}-${(\n slot %\n 2 ** 48\n )\n .toString(16)\n .padStart(12, \"0\")}`;\n\nexport const ids = {\n command: (slot: number) => testId(0x101, slot),\n message: (slot: number) => testId(0x102, slot),\n run: (slot: number) => testId(0x103, slot),\n turn: (slot: number) => testId(0x104, slot),\n inference: (slot: number) => testId(0x105, slot),\n tool: (slot: number) => testId(0x106, slot),\n compaction: (slot: number) => testId(0x107, slot),\n summary: (slot: number) => testId(0x108, slot),\n event: (slot: number) => testId(0x109, slot),\n} as const;\n\nexport const testSessionId = SessionId.make(testId(0x100, 1));\nexport const testModel = { provider: \"test\", modelId: \"model-a\" } as const;\n\nconst summaryPromptMessage = (text: string) =>\n Schema.encodeSync(Prompt.UserMessage)(\n Prompt.makeMessage(\"user\", { content: [Prompt.textPart({ text })] }),\n );\n\n/**\n * Append-only test log. Every event is built as a raw envelope and decoded through the store's\n * durable decoder, so tests exercise the same shapes the interpreter receives in production.\n */\nexport class TestLog {\n readonly events: Array<CommittedDurableEvent> = [];\n private readonly envelopes: Array<DurableEventEnvelope> = [];\n private nextEvent = 1;\n\n /** The raw envelopes, for seeding an in-memory store. */\n get durableEnvelopes(): ReadonlyArray<DurableEventEnvelope> {\n return this.envelopes;\n }\n\n append(type: string, payload: Record<string, unknown>, namespace = effectDurableAgentNamespace) {\n const slot = this.nextEvent++;\n const raw = {\n namespace,\n type,\n schemaVersion: 1,\n durability: \"durable\",\n eventId: ids.event(slot),\n sessionId: testSessionId,\n createdAtMs: 1_760_000_000_000 + slot * 1_000,\n trace: testEventTrace,\n payload,\n };\n const event = decodeDurableEventSync(raw);\n const envelope = event.namespace === \"__foreign\" ? event.envelope : event;\n this.envelopes.push(envelope);\n this.events.push({\n position: durablePosition(SequenceNumber.make(this.events.length + 1)),\n event,\n });\n return this;\n }\n\n appendForeign(namespace: string, type: string, payload: Record<string, unknown>) {\n return this.append(type, payload, namespace);\n }\n\n configure() {\n return this.append(\"SessionConfigured\", { modelSelection: testModel });\n }\n\n /** Command admission plus the submitted message, as session ingress writes them. */\n submit(input: {\n readonly command: number;\n readonly message: number;\n readonly text: string;\n readonly disposition?: \"queue\" | \"steer\";\n readonly idempotencyKey?: string;\n }) {\n const disposition = input.disposition ?? \"queue\";\n this.append(\"CommandAdmitted\", {\n command: {\n _tag: \"SubmitMessage\",\n commandId: ids.command(input.command),\n disposition,\n content: input.text,\n ...(input.idempotencyKey === undefined ? {} : { idempotencyKey: input.idempotencyKey }),\n },\n });\n return this.append(\"UserMessageSubmitted\", {\n commandId: ids.command(input.command),\n messageId: ids.message(input.message),\n disposition,\n content: input.text,\n });\n }\n\n /** A legacy or interrupt-path admission: the message is committed when the command starts. */\n admitOnly(input: {\n readonly command: number;\n readonly text: string;\n readonly idempotencyKey?: string;\n }) {\n return this.append(\"CommandAdmitted\", {\n command: {\n _tag: \"SubmitMessage\",\n commandId: ids.command(input.command),\n disposition: \"interrupt\",\n content: input.text,\n ...(input.idempotencyKey === undefined ? {} : { idempotencyKey: input.idempotencyKey }),\n },\n });\n }\n\n commitUser(input: { readonly command: number; readonly message: number; readonly text: string }) {\n return this.append(\"UserMessageCommitted\", {\n commandId: ids.command(input.command),\n messageId: ids.message(input.message),\n content: input.text,\n });\n }\n\n startRun(input: { readonly run: number; readonly commands: ReadonlyArray<number> }) {\n for (const command of input.commands) {\n this.append(\"CommandStarted\", { commandId: ids.command(command) });\n }\n return this.runStarted(input);\n }\n\n runStarted(input: { readonly run: number; readonly commands: ReadonlyArray<number> }) {\n return this.append(\"RunStarted\", {\n runId: ids.run(input.run),\n commandIds: input.commands.map(ids.command),\n modelSelection: testModel,\n trace: runTrace,\n });\n }\n\n turn(input: {\n readonly run: number;\n readonly turn: number;\n readonly inputs?: ReadonlyArray<number>;\n }) {\n return this.append(\"TurnStarted\", {\n runId: ids.run(input.run),\n turnId: ids.turn(input.turn),\n ...(input.inputs === undefined ? {} : { inputMessageIds: input.inputs.map(ids.message) }),\n });\n }\n\n inferenceStarted(input: {\n readonly run: number;\n readonly turn: number;\n readonly inference: number;\n }) {\n return this.append(\"InferenceStarted\", {\n runId: ids.run(input.run),\n turnId: ids.turn(input.turn),\n inferenceId: ids.inference(input.inference),\n });\n }\n\n assistant(input: {\n readonly run: number;\n readonly turn: number;\n readonly inference: number;\n readonly message: number;\n readonly text?: string;\n readonly reasoning?: string;\n readonly toolCalls?: ReadonlyArray<{ readonly providerId: string; readonly name: string }>;\n readonly partial?: string;\n }) {\n const promptParts = [\n ...(input.reasoning === undefined ? [] : [{ type: \"reasoning\", text: input.reasoning }]),\n ...(input.text === undefined ? [] : [{ type: \"text\", text: input.text }]),\n ...(input.toolCalls ?? []).map((call) => ({\n type: \"tool-call\",\n id: call.providerId,\n name: call.name,\n params: { q: call.name },\n providerExecuted: false,\n })),\n ];\n return this.append(\n input.partial === undefined ? \"AssistantMessageCommitted\" : \"AssistantPartialCommitted\",\n {\n messageId: ids.message(input.message),\n runId: ids.run(input.run),\n turnId: ids.turn(input.turn),\n inferenceId: ids.inference(input.inference),\n promptParts,\n ...(input.partial === undefined ? {} : { reason: input.partial }),\n },\n );\n }\n\n importAssistant(input: {\n readonly run: number;\n readonly turn: number;\n readonly inference: number;\n readonly message: number;\n readonly text: string;\n }) {\n return this.append(\"AssistantMessageImported\", {\n messageId: ids.message(input.message),\n runId: ids.run(input.run),\n turnId: ids.turn(input.turn),\n inferenceId: ids.inference(input.inference),\n promptParts: [{ type: \"text\", text: input.text }],\n });\n }\n\n inferenceCompleted(input: {\n readonly run: number;\n readonly turn: number;\n readonly inference: number;\n readonly outputTokens?: number;\n }) {\n return this.append(\"InferenceCompleted\", {\n runId: ids.run(input.run),\n turnId: ids.turn(input.turn),\n inferenceId: ids.inference(input.inference),\n finishReason: \"stop\",\n usage: { inputTokens: 10, outputTokens: input.outputTokens ?? 5 },\n });\n }\n\n inferenceFailed(input: {\n readonly run: number;\n readonly turn: number;\n readonly inference: number;\n readonly code?: string;\n }) {\n return this.append(\"InferenceFailed\", {\n runId: ids.run(input.run),\n turnId: ids.turn(input.turn),\n inferenceId: ids.inference(input.inference),\n error: {\n message: \"inference failed\",\n ...(input.code === undefined ? {} : { code: input.code }),\n },\n });\n }\n\n toolCreated(input: {\n readonly run: number;\n readonly turn: number;\n readonly inference: number;\n readonly tool: number;\n readonly providerId: string;\n readonly name: string;\n }) {\n return this.append(\"ToolCallCreated\", {\n runId: ids.run(input.run),\n turnId: ids.turn(input.turn),\n inferenceId: ids.inference(input.inference),\n toolCallId: ids.tool(input.tool),\n promptPart: {\n type: \"tool-call\",\n id: input.providerId,\n name: input.name,\n params: { q: input.name },\n providerExecuted: false,\n },\n });\n }\n\n toolRejected(input: {\n readonly run: number;\n readonly turn: number;\n readonly inference: number;\n readonly tool: number;\n readonly providerId: string;\n readonly name: string;\n }) {\n return this.append(\"ToolCallRejected\", {\n runId: ids.run(input.run),\n turnId: ids.turn(input.turn),\n inferenceId: ids.inference(input.inference),\n toolCallId: ids.tool(input.tool),\n promptPart: {\n type: \"tool-result\",\n id: input.providerId,\n name: input.name,\n isFailure: true,\n result: { message: \"unknown tool\", reason: \"unknown-tool\", modelFeedback: \"no such tool\" },\n },\n });\n }\n\n toolStarted(tool: number) {\n return this.append(\"ToolCallStarted\", { toolCallId: ids.tool(tool) });\n }\n\n toolCompleted(input: {\n readonly tool: number;\n readonly providerId: string;\n readonly name: string;\n readonly result?: unknown;\n }) {\n return this.append(\"ToolCallCompleted\", {\n toolCallId: ids.tool(input.tool),\n promptPart: {\n type: \"tool-result\",\n id: input.providerId,\n name: input.name,\n isFailure: false,\n result: input.result ?? { ok: true },\n },\n });\n }\n\n toolFailed(input: { readonly tool: number; readonly providerId: string; readonly name: string }) {\n return this.append(\"ToolCallFailed\", {\n toolCallId: ids.tool(input.tool),\n error: { message: \"tool cancelled\", code: \"tool.cancelled\" },\n promptPart: {\n type: \"tool-result\",\n id: input.providerId,\n name: input.name,\n isFailure: true,\n result: { message: \"tool cancelled\" },\n },\n });\n }\n\n turnCompleted(input: { readonly run: number; readonly turn: number }) {\n return this.append(\"TurnCompleted\", {\n runId: ids.run(input.run),\n turnId: ids.turn(input.turn),\n });\n }\n\n runCompleted(run: number, commands: ReadonlyArray<number> = []) {\n this.append(\"RunCompleted\", { runId: ids.run(run) });\n for (const command of commands)\n this.append(\"CommandCompleted\", { commandId: ids.command(command) });\n return this;\n }\n\n runInterrupted(run: number) {\n return this.append(\"RunFailed\", {\n runId: ids.run(run),\n error: { message: \"run interrupted: restart\", code: \"run.interrupted\" },\n });\n }\n\n steer(input: {\n readonly command: number;\n readonly message: number;\n readonly run: number;\n readonly text: string;\n }) {\n return this.append(\"SteeringMessageQueued\", {\n commandId: ids.command(input.command),\n messageId: ids.message(input.message),\n runId: ids.run(input.run),\n content: input.text,\n });\n }\n\n compaction(input: {\n readonly compaction: number;\n readonly summary: number;\n readonly retainedFromContextSeq: number;\n readonly contextVersion: number;\n }) {\n const seq = this.events.length;\n this.append(\"CompactionRequested\", {\n compactionId: ids.compaction(input.compaction),\n sourceFromSeq: 1,\n sourceToSeq: seq,\n });\n this.append(\"CompactionStarted\", { compactionId: ids.compaction(input.compaction) });\n this.append(\"SummaryCreated\", {\n compactionId: ids.compaction(input.compaction),\n summaryId: ids.summary(input.summary),\n sourceFromSeq: 1,\n sourceToSeq: seq,\n summary: {\n compactionId: ids.compaction(input.compaction),\n summaryId: ids.summary(input.summary),\n sourceFromSeq: 1,\n sourceToSeq: seq,\n retainedFromContextSeq: input.retainedFromContextSeq,\n text: \"summary\",\n promptMessage: summaryPromptMessage(\"summary\"),\n policyId: \"test\",\n },\n });\n this.append(\"ContextRebased\", {\n compactionId: ids.compaction(input.compaction),\n summaryId: ids.summary(input.summary),\n contextVersion: input.contextVersion,\n retainedFromContextSeq: input.retainedFromContextSeq,\n });\n return this.append(\"CompactionCompleted\", {\n compactionId: ids.compaction(input.compaction),\n modelSelection: testModel,\n usage: { inputTokens: 100, outputTokens: 20 },\n });\n }\n\n /** One complete assistant turn: start, content, optional tools run to completion, finish. */\n assistantTurn(input: {\n readonly run: number;\n readonly turn: number;\n readonly inference: number;\n readonly message: number;\n readonly text: string;\n readonly inputs?: ReadonlyArray<number>;\n readonly tools?: ReadonlyArray<number>;\n }) {\n this.turn({\n run: input.run,\n turn: input.turn,\n ...(input.inputs === undefined ? {} : { inputs: input.inputs }),\n });\n this.inferenceStarted(input);\n const toolCalls = (input.tools ?? []).map((tool) => ({\n tool,\n providerId: `call_${tool}`,\n name: `tool_${tool}`,\n }));\n this.assistant({ ...input, toolCalls });\n for (const call of toolCalls) this.toolCreated({ ...input, ...call });\n this.inferenceCompleted(input);\n for (const call of toolCalls) {\n this.toolStarted(call.tool);\n this.toolCompleted(call);\n }\n return this.turnCompleted(input);\n }\n}\n\n/** A definition, built synchronously for tests. */\nexport const testDefinition = (\n mappings: TranscriptMappings = emptyTranscriptMappings,\n): TranscriptDefinition => Effect.runSync(makeTranscriptDefinition(mappings));\n\n/** Project a log split into the given batches, starting from an empty version. */\nexport const projectBatches = (\n definition: TranscriptDefinition,\n batches: ReadonlyArray<ReadonlyArray<CommittedDurableEvent>>,\n): InMemoryTranscriptVersion =>\n batches.reduce(\n (version, batch) => advanceTranscriptVersion(version, definition, batch),\n emptyTranscriptVersion(definition.version, \"active\"),\n );\n\n/**\n * A semantic view of a projected version for equality: every record encoded through its stored\n * envelope with `updatedSeq` normalized, every alias, and the cursor and status.\n */\nexport const normalizedProjection = (version: InMemoryTranscriptVersion) => ({\n meta: version.meta,\n records: Array.from(version.records.values())\n .map((record) => ({\n ...Schema.encodeSync(TranscriptRecordFromEnvelope)(record),\n updatedSeq: 0,\n }))\n .sort((left, right) => (left.id < right.id ? -1 : left.id > right.id ? 1 : 0)),\n aliases: Array.from(version.aliases.entries()).sort(([left], [right]) =>\n left < right ? -1 : left > right ? 1 : 0,\n ),\n});\n\n/** Canonical JSON of every record, for fingerprints. */\nexport const projectionJson = (records: Iterable<TranscriptRecord>): string =>\n canonicalJson(\n Array.from(records)\n .map((record) => Schema.encodeSync(TranscriptRecordFromEnvelope)(record))\n .sort((left, right) => (left.id < right.id ? -1 : left.id > right.id ? 1 : 0)),\n );\n\n/** History the transcript renders: consumed users and committed assistants, in order. */\nexport const renderedTranscriptHistory = (\n version: InMemoryTranscriptVersion,\n): ReadonlyArray<string> =>\n Array.from(version.records.values())\n .filter(isTopLevelTranscriptRecord)\n .sort(\n (left, right) =>\n left.position.anchorSeq - right.position.anchorSeq ||\n left.position.ordinal - right.position.ordinal,\n )\n .flatMap((record) => {\n switch (record.kind) {\n case \"user\":\n return [`user:${record.commandId}`];\n case \"assistant\":\n return record.messageId === undefined ? [] : [`assistant:${record.inferenceId}`];\n case \"compaction\":\n return [];\n }\n });\n\n/** The same history as the model sees it today, from the (possibly pruned) reduced state. */\nexport const reducedStateHistory = (\n events: ReadonlyArray<CommittedDurableEvent>,\n): ReadonlyArray<string> =>\n durableMessageTranscript(reduceCommittedEvents(events))\n .filter(\n (message) =>\n message._tag !== \"User\" ||\n message.requestedDisposition === undefined ||\n message.consumedSeq !== undefined,\n )\n .map((message) =>\n message._tag === \"User\" || message._tag === \"Steering\"\n ? `user:${message.commandId}`\n : `assistant:${message.inferenceId}`,\n );\n\n/**\n * Plausible logs from a small session simulator: each step picks an action that is valid in the\n * simulated state, so every generated log follows the runtime's event protocol.\n */\nexport const generatedTestLog = (\n steps: ReadonlyArray<number>,\n): { log: TestLog; compacted: boolean } => {\n const log = new TestLog().configure();\n let next = 1;\n let compacted = false;\n const pending: Array<number> = [];\n const steering: Array<number> = [];\n let active: { run: number; commands: Array<number>; turns: number; first?: number } | undefined;\n for (const step of steps) {\n const slot = next++;\n switch (step % 11) {\n case 0: {\n const key = slot % 2 === 0 ? `k:${slot}` : undefined;\n if (key !== undefined) {\n log.appendForeign(\"gia-agent\", \"GiaUserMessageAuthorCommitted\", {\n relatedCommandIdempotencyKey: key,\n userEmail: `u${slot}@example.com`,\n });\n }\n log.submit({\n command: slot,\n message: slot,\n text: `q${slot}`,\n ...(key === undefined ? {} : { idempotencyKey: key }),\n });\n pending.push(slot);\n break;\n }\n case 1:\n if (active !== undefined) {\n log.steer({ command: slot, message: slot, run: active.run, text: `s${slot}` });\n steering.push(slot);\n }\n break;\n case 2: {\n const first = pending.shift();\n if (active === undefined && first !== undefined) {\n log.startRun({ run: slot, commands: [first] });\n active = { run: slot, commands: [first], turns: 0, first };\n } else if (first !== undefined) {\n pending.unshift(first);\n }\n break;\n }\n case 3:\n case 4: {\n if (active === undefined) break;\n const inputs = [\n ...(active.first === undefined ? [] : [active.first]),\n ...steering.splice(0),\n ];\n active.first = undefined;\n active.turns += 1;\n const tools = step % 3 === 0 ? [slot] : [];\n log.assistantTurn({\n run: active.run,\n turn: slot,\n inference: slot,\n message: 10_000 + slot,\n text: `a${slot}`,\n inputs,\n tools,\n });\n break;\n }\n case 5:\n if (active !== undefined && active.first === undefined) {\n log.turn({ run: active.run, turn: slot, inputs: steering.splice(0) });\n log.inferenceStarted({ run: active.run, turn: slot, inference: slot });\n log.assistant({\n run: active.run,\n turn: slot,\n inference: slot,\n message: 10_000 + slot,\n text: \"cut\",\n partial: \"stopped\",\n });\n log.inferenceFailed({\n run: active.run,\n turn: slot,\n inference: slot,\n code: \"inference.interrupted\",\n });\n }\n break;\n case 6:\n if (active !== undefined && active.first === undefined) {\n log.runCompleted(active.run, active.commands);\n active = undefined;\n }\n break;\n case 7:\n if (active !== undefined && active.first === undefined) {\n log.runInterrupted(active.run);\n log.runStarted({ run: slot, commands: active.commands });\n log.append(\"RecoveryCompleted\", {\n trigger: \"runtime-restart\",\n continuation: {\n commandId: ids.command(active.commands[0] ?? 0),\n interruptedRunId: ids.run(active.run),\n replacementRunId: ids.run(slot),\n },\n });\n active = { ...active, run: slot };\n }\n break;\n case 8:\n if (log.events.length > 4) {\n log.compaction({\n compaction: slot,\n summary: slot,\n retainedFromContextSeq: log.events.length,\n contextVersion: slot,\n });\n compacted = true;\n }\n break;\n case 9: {\n const cancelled = pending.pop();\n if (cancelled !== undefined) {\n log.append(\"UserMessageCancelled\", {\n commandId: ids.command(slot),\n messageId: ids.message(cancelled),\n reason: \"user-cancel\",\n });\n }\n break;\n }\n case 10: {\n const promoted = pending.shift();\n if (promoted !== undefined && active !== undefined) {\n log.append(\"UserMessagePromoted\", {\n commandId: ids.command(slot),\n messageId: ids.message(promoted),\n from: \"queue\",\n to: \"steer\",\n });\n steering.push(promoted);\n } else if (promoted !== undefined) {\n pending.unshift(promoted);\n }\n break;\n }\n }\n }\n return { log, compacted };\n};\n","import type { CommittedDurableEvent } from \"../services/session-store\";\nimport type { TranscriptMappings } from \"./mapping\";\nimport { TestLog, ids } from \"./transcript-testkit\";\n\n/**\n * The fixed scenario corpus: one named log per interpretation rule the transcript must get\n * right. The oracle, the fingerprint and the prompt-parity check all run over it. Add a scenario\n * for every new rule; never edit an existing one without bumping the semantic revision.\n */\nexport interface TranscriptScenario {\n readonly name: string;\n readonly events: ReadonlyArray<CommittedDurableEvent>;\n /** Whether the log contains a context rebase (the reduced state is pruned). */\n readonly compacted: boolean;\n}\n\n/** Gia-shaped decorations used by the decoration scenarios. */\nexport const giaLikeTestMappings: TranscriptMappings = {\n mappings: [\n {\n name: \"author\",\n event: { namespace: \"gia-agent\", type: \"GiaUserMessageAuthorCommitted\", schemaVersion: 1 },\n target: { _tag: \"UserByIdempotencyKey\", path: [\"relatedCommandIdempotencyKey\"] },\n operations: [{ _tag: \"FirstWins\", from: [\"userEmail\"], to: \"author\" }],\n },\n {\n name: \"lastAuthor\",\n event: { namespace: \"gia-agent\", type: \"GiaUserMessageAuthorCommitted\", schemaVersion: 1 },\n target: { _tag: \"Session\" },\n operations: [{ _tag: \"Copy\", from: [\"userEmail\"], to: \"lastAuthor\" }],\n },\n {\n name: \"owner\",\n event: { namespace: \"gia-agent\", type: \"GiaSessionMetadataCommitted\", schemaVersion: 1 },\n target: { _tag: \"Session\" },\n operations: [{ _tag: \"FirstWins\", from: [\"ownerUserEmail\"], to: \"owner\" }],\n },\n {\n name: \"attachments\",\n event: { namespace: \"gia-agent\", type: \"GiaFileAttachmentCreated\", schemaVersion: 1 },\n target: { _tag: \"UserByIdempotencyKey\", path: [\"relatedCommandIdempotencyKey\"] },\n operations: [\n {\n _tag: \"ReplaceListEntry\",\n from: [],\n to: \"attachments\",\n key: { _tag: \"Id\", path: [\"attachmentId\"] },\n },\n ],\n },\n {\n name: \"references\",\n event: { namespace: \"gia-agent\", type: \"GiaReferenceCreated\", schemaVersion: 1 },\n target: { _tag: \"UserByIdempotencyKey\", path: [\"relatedCommandIdempotencyKey\"] },\n operations: [\n {\n _tag: \"ReplaceListEntry\",\n from: [\"target\"],\n to: \"references\",\n key: { _tag: \"Ordinal\", path: [\"ordinal\"] },\n },\n ],\n },\n {\n name: \"subagentNotice\",\n event: { namespace: \"gia-agent\", type: \"GiaSubagentNotificationCommitted\", schemaVersion: 1 },\n target: { _tag: \"UserByCommandId\", path: [\"notificationId\"] },\n operations: [\n { _tag: \"Classify\", classification: \"subagentNotice\" },\n { _tag: \"FirstWins\", from: [\"children\"], to: \"subagentChildren\" },\n ],\n },\n ],\n userFallbacks: [\n { to: \"author\", fromSession: \"lastAuthor\" },\n { to: \"author\", fromSession: \"owner\" },\n ],\n};\n\nconst author = (key: string, email: string) => ({\n relatedCommandIdempotencyKey: key,\n userEmail: email,\n});\n\nconst queueRunTools = () => {\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"hi\", idempotencyKey: \"web:1\" });\n log.startRun({ run: 1, commands: [1] });\n log.assistantTurn({\n run: 1,\n turn: 1,\n inference: 1,\n message: 101,\n text: \"calling\",\n inputs: [1],\n tools: [1, 2],\n });\n log.assistantTurn({ run: 1, turn: 2, inference: 2, message: 102, text: \"done\" });\n return log.runCompleted(1, [1]);\n};\n\nconst legacyCommitted = () => {\n const log = new TestLog().configure();\n log.admitOnly({ command: 1, text: \"interrupting\" });\n log.append(\"CommandStarted\", { commandId: ids.command(1) });\n log.commitUser({ command: 1, message: 1, text: \"interrupting\" });\n log.runStarted({ run: 1, commands: [1] });\n log.assistantTurn({ run: 1, turn: 1, inference: 1, message: 101, text: \"ok\", inputs: [1] });\n // A committed user without any admission, as very old logs have.\n log.commitUser({ command: 2, message: 2, text: \"old\" });\n return log.runCompleted(1, [1]);\n};\n\nconst steering = () => {\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"start\" });\n log.startRun({ run: 1, commands: [1] });\n log.turn({ run: 1, turn: 1, inputs: [1] });\n log.inferenceStarted({ run: 1, turn: 1, inference: 1 });\n log.submit({ command: 2, message: 2, text: \"steer me\", disposition: \"steer\" });\n log.steer({ command: 3, message: 3, run: 1, text: \"also this\" });\n log.steer({ command: 4, message: 4, run: 1, text: \"never mind\" });\n log.append(\"SteeringMessageCancelled\", {\n messageId: ids.message(4),\n runId: ids.run(1),\n reason: \"run ended\",\n });\n log.assistant({ run: 1, turn: 1, inference: 1, message: 101, text: \"first\" });\n log.inferenceCompleted({ run: 1, turn: 1, inference: 1 });\n log.turnCompleted({ run: 1, turn: 1 });\n log.assistantTurn({\n run: 1,\n turn: 2,\n inference: 2,\n message: 102,\n text: \"steered\",\n inputs: [2, 3],\n });\n return log.runCompleted(1, [1]);\n};\n\nconst promotePauseCancel = () => {\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"first\" });\n log.startRun({ run: 1, commands: [1] });\n log.turn({ run: 1, turn: 1, inputs: [1] });\n log.submit({ command: 2, message: 2, text: \"queued a\" });\n log.submit({ command: 3, message: 3, text: \"queued b\" });\n log.submit({ command: 4, message: 4, text: \"queued c\" });\n log.submit({ command: 5, message: 5, text: \"queued d\" });\n log.append(\"UserMessagePromoted\", {\n commandId: ids.command(6),\n messageId: ids.message(2),\n from: \"queue\",\n to: \"steer\",\n });\n log.append(\"PendingMessagesPaused\", {\n interruptionCommandId: ids.command(7),\n runId: ids.run(1),\n messageIds: [ids.message(3), ids.message(4)],\n reason: \"user-interrupted\",\n });\n log.append(\"UserMessageCancelled\", {\n commandId: ids.command(8),\n messageId: ids.message(4),\n reason: \"user-cancel\",\n });\n log.append(\"UserMessageCancelled\", {\n commandId: ids.command(9),\n messageId: ids.message(5),\n reason: \"edit\",\n });\n log.append(\"CommandCancelled\", { commandId: ids.command(5), reason: \"edited\" });\n log.admitOnly({ command: 10, text: \"admitted then cancelled\" });\n log.append(\"CommandCancelled\", { commandId: ids.command(10), reason: \"stopped\" });\n log.inferenceStarted({ run: 1, turn: 1, inference: 1 });\n log.assistant({ run: 1, turn: 1, inference: 1, message: 101, text: \"answer\" });\n log.inferenceCompleted({ run: 1, turn: 1, inference: 1 });\n log.turnCompleted({ run: 1, turn: 1 });\n log.assistantTurn({ run: 1, turn: 2, inference: 2, message: 102, text: \"promoted\", inputs: [2] });\n return log.runCompleted(1, [1]);\n};\n\nconst partialEmptyImport = () => {\n const log = new TestLog().configure();\n log.importAssistant({ run: 9, turn: 9, inference: 9, message: 99, text: \"imported context\" });\n log.submit({ command: 1, message: 1, text: \"go\" });\n log.startRun({ run: 1, commands: [1] });\n log.turn({ run: 1, turn: 1, inputs: [1] });\n log.inferenceStarted({ run: 1, turn: 1, inference: 1 });\n log.assistant({\n run: 1,\n turn: 1,\n inference: 1,\n message: 101,\n text: \"half\",\n reasoning: \"hmm\",\n partial: \"inference failed before completion\",\n });\n log.inferenceFailed({ run: 1, turn: 1, inference: 1 });\n log.inferenceStarted({ run: 1, turn: 1, inference: 2 });\n log.inferenceCompleted({ run: 1, turn: 1, inference: 2, outputTokens: 0 });\n log.turnCompleted({ run: 1, turn: 1 });\n return log.runCompleted(1, [1]);\n};\n\nconst rejectedAndRepeatedTerminals = () => {\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"tools\" });\n log.startRun({ run: 1, commands: [1] });\n log.turn({ run: 1, turn: 1, inputs: [1] });\n log.inferenceStarted({ run: 1, turn: 1, inference: 1 });\n // The tool is sealed before the assistant content, the reverse of the usual order.\n log.toolCreated({ run: 1, turn: 1, inference: 1, tool: 1, providerId: \"call_1\", name: \"search\" });\n log.toolRejected({ run: 1, turn: 1, inference: 1, tool: 2, providerId: \"call_2\", name: \"nope\" });\n log.assistant({\n run: 1,\n turn: 1,\n inference: 1,\n message: 101,\n text: \"using tools\",\n toolCalls: [\n { providerId: \"call_1\", name: \"search\" },\n { providerId: \"call_2\", name: \"nope\" },\n ],\n });\n log.inferenceCompleted({ run: 1, turn: 1, inference: 1 });\n log.toolStarted(1);\n log.toolCompleted({ tool: 1, providerId: \"call_1\", name: \"search\", result: { hits: 3 } });\n log.toolFailed({ tool: 1, providerId: \"call_1\", name: \"search\" });\n log.turnCompleted({ run: 1, turn: 1 });\n return log.runCompleted(1, [1]);\n};\n\nconst recovery = () => {\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"long task\" });\n log.startRun({ run: 1, commands: [1] });\n log.turn({ run: 1, turn: 1, inputs: [1] });\n log.inferenceStarted({ run: 1, turn: 1, inference: 1 });\n log.assistant({\n run: 1,\n turn: 1,\n inference: 1,\n message: 101,\n text: \"working\",\n toolCalls: [{ providerId: \"call_1\", name: \"bash\" }],\n });\n log.toolCreated({ run: 1, turn: 1, inference: 1, tool: 1, providerId: \"call_1\", name: \"bash\" });\n log.inferenceCompleted({ run: 1, turn: 1, inference: 1 });\n log.toolStarted(1);\n // Startup recovery: one batch that fails everything open and continues the run.\n log.toolFailed({ tool: 1, providerId: \"call_1\", name: \"bash\" });\n log.append(\"TurnFailed\", {\n runId: ids.run(1),\n turnId: ids.turn(1),\n error: { message: \"turn interrupted\", code: \"turn.interrupted\" },\n });\n log.runInterrupted(1);\n log.runStarted({ run: 2, commands: [1] });\n log.append(\"RecoveryCompleted\", {\n trigger: \"runtime-restart\",\n continuation: {\n commandId: ids.command(1),\n interruptedRunId: ids.run(1),\n replacementRunId: ids.run(2),\n },\n });\n log.assistantTurn({ run: 2, turn: 2, inference: 2, message: 102, text: \"resumed\" });\n return log.runCompleted(2, [1]);\n};\n\nconst midRunCompaction = () => {\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"first\" });\n log.startRun({ run: 1, commands: [1] });\n log.assistantTurn({\n run: 1,\n turn: 1,\n inference: 1,\n message: 101,\n text: \"one\",\n inputs: [1],\n tools: [1],\n });\n log.runCompleted(1, [1]);\n log.submit({ command: 2, message: 2, text: \"second\" });\n log.startRun({ run: 2, commands: [2] });\n log.assistantTurn({ run: 2, turn: 2, inference: 2, message: 102, text: \"two\", inputs: [2] });\n log.compaction({\n compaction: 1,\n summary: 1,\n retainedFromContextSeq: log.events.length,\n contextVersion: 1,\n });\n log.assistantTurn({ run: 2, turn: 3, inference: 3, message: 103, text: \"three\" });\n return log.runCompleted(2, [2]);\n};\n\nconst replacementMessageId = () => {\n // A pending submission pruned by a rebase is re-committed under a new message id when its\n // command starts (session 01a13b26 in the design): one record, two aliases.\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"before\" });\n log.startRun({ run: 1, commands: [1] });\n log.assistantTurn({ run: 1, turn: 1, inference: 1, message: 101, text: \"busy\", inputs: [1] });\n log.submit({ command: 2, message: 2, text: \"queued during run\" });\n log.compaction({\n compaction: 1,\n summary: 1,\n retainedFromContextSeq: log.events.length + 1,\n contextVersion: 1,\n });\n log.runCompleted(1, [1]);\n log.append(\"CommandStarted\", { commandId: ids.command(2) });\n log.commitUser({ command: 2, message: 22, text: \"queued during run\" });\n log.runStarted({ run: 2, commands: [2] });\n log.assistantTurn({\n run: 2,\n turn: 2,\n inference: 2,\n message: 102,\n text: \"answered\",\n inputs: [22],\n });\n return log.runCompleted(2, [2]);\n};\n\nconst decorations = () => {\n const log = new TestLog().configure();\n log.appendForeign(\"gia-agent\", \"GiaSessionMetadataCommitted\", {\n ownerUserEmail: \"owner@example.com\",\n });\n // Web follow-up: author, attachments and a reference precede the command in one batch.\n log.appendForeign(\"gia-agent\", \"GiaUserMessageAuthorCommitted\", author(\"web:1\", \"a@example.com\"));\n log.appendForeign(\"gia-agent\", \"GiaFileAttachmentCreated\", {\n attachmentId: \"att-1\",\n relatedCommandIdempotencyKey: \"web:1\",\n ordinal: 0,\n fileName: \"a.txt\",\n });\n log.appendForeign(\"gia-agent\", \"GiaReferenceCreated\", {\n ordinal: 1,\n referenceId: \"ref-2\",\n relatedCommandIdempotencyKey: \"web:1\",\n target: { kind: \"doc\", id: \"d2\" },\n });\n log.appendForeign(\"gia-agent\", \"GiaReferenceCreated\", {\n ordinal: 0,\n referenceId: \"ref-1\",\n relatedCommandIdempotencyKey: \"web:1\",\n target: { kind: \"doc\", id: \"d1\" },\n });\n log.submit({ command: 1, message: 1, text: \"with files\", idempotencyKey: \"web:1\" });\n // A decoration after its command, a replaced attachment, and a second author (first wins).\n log.appendForeign(\"gia-agent\", \"GiaFileAttachmentCreated\", {\n attachmentId: \"att-1\",\n relatedCommandIdempotencyKey: \"web:1\",\n ordinal: 0,\n fileName: \"a-renamed.txt\",\n });\n log.appendForeign(\"gia-agent\", \"GiaUserMessageAuthorCommitted\", author(\"web:1\", \"b@example.com\"));\n // Subagent wakeup: the notice precedes a command whose id is the notification id.\n log.appendForeign(\"gia-agent\", \"GiaSubagentNotificationCommitted\", {\n notificationId: ids.command(2),\n children: [{ name: \"child\", sessionId: \"s\", state: \"completed\" }],\n });\n log.submit({\n command: 2,\n message: 2,\n text: \"children done\",\n idempotencyKey: `subagent:notify:${ids.command(2)}`,\n });\n // No author event for this key: the latest author is the fallback.\n log.submit({ command: 3, message: 3, text: \"no author\", idempotencyKey: \"slack:3\" });\n // Invalid decorations degrade only themselves; unmapped namespaces are ignored.\n log.appendForeign(\"gia-agent\", \"GiaUserMessageAuthorCommitted\", {\n relatedCommandIdempotencyKey: \"slack:3\",\n });\n log.appendForeign(\"gia-agent\", \"GiaFileAttachmentCreated\", {\n relatedCommandIdempotencyKey: \"slack:3\",\n fileName: \"no id\",\n });\n log.appendForeign(\"gia-agent\", \"GiaUserMessageAuthorCommitted\", {\n relatedCommandIdempotencyKey: 7,\n userEmail: \"x\",\n });\n log.appendForeign(\"other-app\", \"Whatever\", { relatedCommandIdempotencyKey: \"web:1\" });\n // An orphan decoration whose command never arrives.\n log.appendForeign(\"gia-agent\", \"GiaUserMessageAuthorCommitted\", author(\"never\", \"c@example.com\"));\n log.startRun({ run: 1, commands: [1, 2, 3] });\n log.assistantTurn({ run: 1, turn: 1, inference: 1, message: 101, text: \"ok\", inputs: [1, 2, 3] });\n return log.runCompleted(1, [1, 2, 3]);\n};\n\nconst ignoredEvents = () => {\n const log = new TestLog().configure();\n log.append(\"SystemMessageCommitted\", { messageId: ids.message(90), content: \"system prompt\" });\n log.append(\"RunSchedulingRequested\", {\n requestId: ids.event(900),\n work: { _tag: \"Command\", commandId: ids.command(1) },\n });\n log.append(\"RunSchedulingDelivered\", { requestId: ids.event(900) });\n log.append(\"RunSchedulingGranted\", { requestId: ids.event(900), runId: ids.run(1) });\n log.append(\"RunSchedulingInvalidated\", { requestId: ids.event(901), reason: \"stopped\" });\n log.submit({ command: 1, message: 1, text: \"hello\" });\n log.startRun({ run: 1, commands: [1] });\n log.turn({ run: 1, turn: 1, inputs: [1] });\n log.append(\"StopTurnRequested\", {\n commandId: ids.command(2),\n runId: ids.run(1),\n turnId: ids.turn(1),\n });\n log.append(\"StopTurnApplied\", {\n commandId: ids.command(2),\n runId: ids.run(1),\n turnId: ids.turn(1),\n });\n log.append(\"TurnStopped\", { runId: ids.run(1), turnId: ids.turn(1), reason: \"stop\" });\n log.append(\"ContextProjected\", { contextVersion: 0, throughSeq: log.events.length });\n log.append(\"BaseStateRequested\", { baseStateId: ids.event(902), requestedThroughSeq: 1 });\n log.append(\"BaseStateCreated\", { baseStateId: ids.event(902), coversThroughSeq: 1 });\n log.append(\"BaseStateFailed\", { baseStateId: ids.event(903), error: { message: \"x\" } });\n log.append(\"CompactionRequested\", {\n compactionId: ids.compaction(9),\n sourceFromSeq: 1,\n sourceToSeq: 2,\n });\n log.append(\"CompactionStarted\", { compactionId: ids.compaction(9) });\n log.append(\"CompactionFailed\", { compactionId: ids.compaction(9), error: { message: \"no\" } });\n log.append(\"RunInterrupted\", { runId: ids.run(1), reason: \"legacy stop\" });\n log.append(\"CommandFailed\", { commandId: ids.command(1), error: { message: \"x\" } });\n return log;\n};\n\nconst legacyAttempts = () => {\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"legacy\" });\n log.startRun({ run: 1, commands: [1] });\n log.turn({ run: 1, turn: 1, inputs: [1] });\n log.append(\"TurnAttemptStarted\", {\n runId: ids.run(1),\n turnId: ids.turn(1),\n attemptId: ids.inference(1),\n });\n log.append(\"AssistantMessageCommitted\", {\n messageId: ids.message(101),\n runId: ids.run(1),\n turnId: ids.turn(1),\n attemptId: ids.inference(1),\n promptParts: [\n { type: \"text\", text: \"legacy answer\" },\n { type: \"tool-call\", id: \"call_1\", name: \"search\", params: {}, providerExecuted: false },\n ],\n });\n log.append(\"ToolCallCreated\", {\n runId: ids.run(1),\n turnId: ids.turn(1),\n attemptId: ids.inference(1),\n toolCallId: ids.tool(1),\n promptPart: {\n type: \"tool-call\",\n id: \"call_1\",\n name: \"search\",\n params: {},\n providerExecuted: false,\n },\n });\n log.append(\"TurnAttemptCompleted\", {\n runId: ids.run(1),\n turnId: ids.turn(1),\n attemptId: ids.inference(1),\n usage: { inputTokens: 3, outputTokens: 4 },\n });\n log.toolStarted(1);\n log.toolCompleted({ tool: 1, providerId: \"call_1\", name: \"search\" });\n log.turnCompleted({ run: 1, turn: 1 });\n return log.runCompleted(1, [1]);\n};\n\nconst failuresAndRepeatedCompletion = () => {\n const log = new TestLog().configure();\n // An interrupt submission whose start fails never becomes a message: it is withdrawn.\n log.admitOnly({ command: 1, text: \"stop and do this\" });\n log.append(\"CommandStarted\", { commandId: ids.command(1) });\n log.append(\"CommandFailed\", { commandId: ids.command(1), error: { message: \"start failed\" } });\n log.submit({ command: 2, message: 2, text: \"next\" });\n log.startRun({ run: 1, commands: [2] });\n log.assistantTurn({ run: 1, turn: 1, inference: 1, message: 101, text: \"ok\", inputs: [2] });\n log.compaction({\n compaction: 1,\n summary: 1,\n retainedFromContextSeq: log.events.length,\n contextVersion: 1,\n });\n // A repeated completion adds no usage, as in the reduced state.\n log.append(\"CompactionCompleted\", {\n compactionId: ids.compaction(1),\n modelSelection: { provider: \"test\", modelId: \"model-a\" },\n usage: { inputTokens: 100, outputTokens: 20 },\n });\n return log.runCompleted(1, [2]);\n};\n\nconst oneTurnConsumesSeveral = () => {\n // A queued message is promoted after steering arrives; the turn lists the steering first, but the\n // prompt (and so the transcript) orders the submissions as they were submitted.\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"first\" });\n log.submit({ command: 2, message: 2, text: \"queued\" });\n log.startRun({ run: 1, commands: [1] });\n log.steer({ command: 3, message: 3, run: 1, text: \"steering\" });\n log.append(\"UserMessagePromoted\", {\n commandId: ids.command(9),\n messageId: ids.message(2),\n from: \"queue\",\n to: \"steer\",\n });\n log.assistantTurn({\n run: 1,\n turn: 1,\n inference: 1,\n message: 101,\n text: \"all three\",\n inputs: [1, 3, 2],\n });\n return log.runCompleted(1, [1]);\n};\n\nconst oneTurnConsumesSeveralSubmitted = () => {\n // The same tie with today's runtime shapes: steering arrives as a steer-disposition submission.\n const log = new TestLog().configure();\n log.submit({ command: 1, message: 1, text: \"first\" });\n log.submit({ command: 2, message: 2, text: \"queued\" });\n log.startRun({ run: 1, commands: [1] });\n log.submit({ command: 3, message: 3, text: \"steering\", disposition: \"steer\" });\n log.append(\"UserMessagePromoted\", {\n commandId: ids.command(9),\n messageId: ids.message(2),\n from: \"queue\",\n to: \"steer\",\n });\n log.assistantTurn({\n run: 1,\n turn: 1,\n inference: 1,\n message: 101,\n text: \"all three\",\n inputs: [1, 3, 2],\n });\n return log.runCompleted(1, [1]);\n};\n\nconst scenario = (name: string, compacted: boolean, build: () => TestLog): TranscriptScenario => ({\n name,\n compacted,\n events: build().events,\n});\n\n/** Build the corpus. Logs are deterministic: ids, timestamps and traces are fixed. */\nexport const transcriptScenarios = (): ReadonlyArray<TranscriptScenario> => [\n scenario(\"queue-run-tools\", false, queueRunTools),\n scenario(\"legacy-committed-user\", false, legacyCommitted),\n scenario(\"steering\", false, steering),\n scenario(\"promote-pause-cancel\", false, promotePauseCancel),\n scenario(\"partial-failure-empty-success-import\", false, partialEmptyImport),\n scenario(\"rejected-tool-repeated-terminals\", false, rejectedAndRepeatedTerminals),\n scenario(\"recovery-continuation\", false, recovery),\n scenario(\"mid-run-compaction\", true, midRunCompaction),\n scenario(\"replacement-message-id\", true, replacementMessageId),\n scenario(\"host-decorations\", false, decorations),\n scenario(\"events-without-transcript-meaning\", false, ignoredEvents),\n scenario(\"legacy-attempts\", false, legacyAttempts),\n scenario(\"failed-interrupt-repeated-compaction-completion\", true, failuresAndRepeatedCompletion),\n scenario(\"one-turn-consumes-several\", false, oneTurnConsumesS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"}
|
|
@@ -1,14 +1,31 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { b as TurnId, c as EventId, g as SessionId, h as SequenceNumber, p as RunId, y as ToolCallId } from "./core-BcimKMIv.js";
|
|
2
|
+
import { g as ToolName, t as DurableEventEnvelope } from "./envelope-Che6KatU.js";
|
|
3
|
+
import "./events-DwTARLMv.js";
|
|
4
|
+
import { s as EDASessionStoreError, t as CommittedDurableEvent } from "./session-store-BL6sfrnn.js";
|
|
4
5
|
import * as Context from "effect/Context";
|
|
5
6
|
import * as Effect from "effect/Effect";
|
|
6
7
|
import * as Layer from "effect/Layer";
|
|
7
8
|
import * as Schema from "effect/Schema";
|
|
8
|
-
import * as Tool from "effect/
|
|
9
|
-
import * as Toolkit from "effect/
|
|
10
|
-
|
|
9
|
+
import * as Tool from "effect/ai/Tool";
|
|
10
|
+
import * as Toolkit from "effect/ai/Toolkit";
|
|
11
11
|
//#region src/services/tool-registry.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* What startup recovery does with a call to this tool that had started when the runtime died.
|
|
14
|
+
*
|
|
15
|
+
* - `fail` (default): record the call as failed; the model sees the interruption and decides.
|
|
16
|
+
* - `reinvoke`: run the handler again with the same tool-call id and params, passing
|
|
17
|
+
* {@link EDAToolExecutionContext.recovery}. Declare it only when a second invocation of the
|
|
18
|
+
* same call is safe: it must attach to, or return the outcome of, the original execution
|
|
19
|
+
* rather than repeat its side effects (for example an idempotency key derived from the
|
|
20
|
+
* tool-call id). Recovery re-invokes at most {@link maxToolCallAttempts} times in total.
|
|
21
|
+
*/
|
|
22
|
+
type ToolRecoveryPolicy = "fail" | "reinvoke";
|
|
23
|
+
/** Effect AI tool annotation declaring a tool's {@link ToolRecoveryPolicy}. */
|
|
24
|
+
declare const ToolRecovery: Context.Reference<ToolRecoveryPolicy>;
|
|
25
|
+
/** Total execution attempts, including the first, that recovery allows one tool call. */
|
|
26
|
+
declare const maxToolCallAttempts = 3;
|
|
27
|
+
/** The recovery policy a toolkit declares for `toolName`; `fail` for unknown tools. */
|
|
28
|
+
declare const toolRecoveryPolicy: (toolkit: EDAModelToolkit | undefined, toolName: string) => ToolRecoveryPolicy;
|
|
12
29
|
/** Runtime parameter schema associated with a provider-visible tool name. */
|
|
13
30
|
type ToolParamsSchema = Schema.Top;
|
|
14
31
|
/** Provider-visible Effect AI toolkit with handlers available for local execution. */
|
|
@@ -17,12 +34,31 @@ type EDAModelToolkit = Toolkit.WithHandler<Record<string, Tool.Any>>;
|
|
|
17
34
|
interface EDAToolExecutionContext {
|
|
18
35
|
/** Framework-owned tool-call identity for this execution. */
|
|
19
36
|
readonly toolCallId: ToolCallId;
|
|
37
|
+
/** Run and turn that durably created this tool call. */
|
|
38
|
+
readonly runId: RunId;
|
|
39
|
+
readonly turnId: TurnId;
|
|
40
|
+
/** Read typed facts from this session journal, optionally only those after `afterSeq`. */
|
|
41
|
+
readonly queryEvents: <E extends DurableEventEnvelope>(schema: Schema.Codec<E, unknown, never, never>, options?: {
|
|
42
|
+
readonly limit?: number;
|
|
43
|
+
readonly afterSeq?: SequenceNumber;
|
|
44
|
+
}) => Effect.Effect<ReadonlyArray<CommittedDurableEvent<E>>, EDASessionStoreError>;
|
|
20
45
|
/** Session identity fixed for this runtime instance. */
|
|
21
46
|
readonly sessionId: SessionId;
|
|
22
47
|
/** Mint an app durable event id for tool-emitted facts. */
|
|
23
48
|
readonly makeEventId: () => Effect.Effect<EventId>;
|
|
24
49
|
/** Emit an app durable event through `SessionState`, never directly through the store. */
|
|
25
50
|
readonly emitDurable: (event: DurableEventEnvelope) => Effect.Effect<CommittedDurableEvent, EDASessionStoreError>;
|
|
51
|
+
/**
|
|
52
|
+
* Present when startup recovery re-invokes a call that had started before the runtime died
|
|
53
|
+
* (its tool declares `ToolRecovery: "reinvoke"`). Facts the first attempt committed are in the
|
|
54
|
+
* journal after `firstStartedSeq`.
|
|
55
|
+
*/
|
|
56
|
+
readonly recovery?: {
|
|
57
|
+
/** This attempt, 2 or more. */
|
|
58
|
+
readonly attempt: number;
|
|
59
|
+
readonly firstStartedAtMs: number;
|
|
60
|
+
readonly firstStartedSeq: SequenceNumber;
|
|
61
|
+
};
|
|
26
62
|
}
|
|
27
63
|
/** Registry contract used by model streaming and post-finish tool execution. */
|
|
28
64
|
interface EDAToolRegistryShape {
|
|
@@ -47,5 +83,5 @@ declare class EDAToolRegistry extends EDAToolRegistry_base {
|
|
|
47
83
|
static readonly FromSchemas: (schemas: ReadonlyMap<string, ToolParamsSchema>) => Layer.Layer<EDAToolRegistry, never, never>;
|
|
48
84
|
}
|
|
49
85
|
//#endregion
|
|
50
|
-
export { ToolParamsSchema as a, EDAToolRegistryShape as i, EDAToolExecutionContext as n,
|
|
51
|
-
//# sourceMappingURL=tool-registry-
|
|
86
|
+
export { ToolParamsSchema as a, makeEDAToolkit as c, EDAToolRegistryShape as i, maxToolCallAttempts as l, EDAToolExecutionContext as n, ToolRecovery as o, EDAToolRegistry as r, ToolRecoveryPolicy as s, EDAModelToolkit as t, toolRecoveryPolicy as u };
|
|
87
|
+
//# sourceMappingURL=tool-registry-CHHUU9BN.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
|
-
|
|
3
2
|
//#region src/types/tracing.d.ts
|
|
4
3
|
/** 16-byte trace id encoded as 32 lowercase hex chars, excluding the all-zero sentinel. */
|
|
5
4
|
declare const EDATraceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
@@ -108,4 +107,4 @@ declare const parseEDATraceparent: (traceparent: string | null | undefined, trac
|
|
|
108
107
|
declare const buildEDATraceparent: (context: EDATraceContext) => string;
|
|
109
108
|
//#endregion
|
|
110
109
|
export { parseEDATraceparent as _, EDATraceAttributes as a, EDATraceLink as c, makeEDAEventTrace as d, makeEDARunTrace as f, makeRootEDATraceMetadata as g, makeRootEDAEventTrace as h, EDATraceAttributeValue as i, EDATraceMetadata as l, makeEDATraceMetadataFromParent as m, EDARunTrace as n, EDATraceContext as o, makeEDATraceContext as p, EDASpanId as r, EDATraceId as s, EDAEventTrace as t, buildEDATraceparent as u };
|
|
111
|
-
//# sourceMappingURL=tracing-
|
|
110
|
+
//# sourceMappingURL=tracing-BwjbF285.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { b as TurnId, h as SequenceNumber, l as InferenceId } from "./core-BcimKMIv.js";
|
|
2
|
+
import { f as PositionedEvent } from "./envelope-Che6KatU.js";
|
|
3
|
+
import "./events-DwTARLMv.js";
|
|
4
|
+
import { $ as TranscriptAssistantPart, A as TranscriptDefinition, At as TranscriptToolRecord, B as makeTranscriptDefinition, Bt as transcriptDecorationBufferLimit, C as TranscriptVersionMeta, Ct as TranscriptRecordView, D as TranscriptWindowSelector, Dt as TranscriptRunOutcome, E as TranscriptWindowLimits, Et as TranscriptRunMember, F as TranscriptMappingOperation, Ft as TranscriptVersion, G as DecorationBufferRecordId, H as AssistantRecordId, Ht as transcriptRecordId, I as TranscriptMappingTarget, It as UserRecordId, J as PendingTranscriptUserRecord, K as ImportAssistantRecordId, L as TranscriptMappings, Lt as isPendingTranscriptUserRecord, M as TranscriptListEntryKey, Mt as TranscriptUnknownRecord, N as TranscriptMappedEvent, Nt as TranscriptUserRecord, O as defaultTranscriptWindowLimits, Ot as TranscriptSessionContextRecord, P as TranscriptMapping, Pt as TranscriptUserState, Q as TranscriptAssistantLifecycle, R as TranscriptUserFallback, Rt as isTopLevelTranscriptRecord, S as TranscriptReadiness, St as TranscriptRecordKind, T as TranscriptWindow, Tt as TranscriptRunGroupRecord, U as CompactionRecordId, Ut as transcriptStoredInlineBodyLimit, V as transcriptMappingBounds, Vt as transcriptRecordEnvelopeFormat, W as ConsumedTranscriptUserRecord, X as SessionContextRecordId, Y as RunGroupRecordId, Z as ToolRecordId, _ as EDATranscriptStoreShape, _t as TranscriptPosition, at as TranscriptCompactionRecord, b as TranscriptActiveContent, bt as TranscriptRecordFromEnvelope, ct as TranscriptDecorationBufferRecord, dt as TranscriptDecorationKey, et as TranscriptAssistantRecord, ft as TranscriptDecorations, g as EDATranscriptStore, gt as TranscriptOrderKey, ht as TranscriptOrder, it as TranscriptClassification, j as TranscriptDefinitionError, jt as TranscriptTopLevelRecord, k as transcriptCursorOf, kt as TranscriptToolLifecycle, lt as TranscriptDecorationEntryId, mt as TranscriptLogIncarnation, nt as TranscriptBodySource, ot as TranscriptCursor, pt as TranscriptFieldPath, q as InferenceAssistantRecordId, rt as TranscriptBufferedDecoration, st as TranscriptDecoration, tt as TranscriptBody, ut as TranscriptDecorationEntryKey, v as TranscriptCursorMismatch, vt as TranscriptRecord, w as TranscriptVersionStatus, wt as TranscriptRecordViewFromEnvelope, x as TranscriptActivePart, xt as TranscriptRecordId, y as TranscriptMaintenanceConfig, yt as TranscriptRecordEnvelope, z as emptyTranscriptMappings, zt as runGroupStatus } from "./session-store-BL6sfrnn.js";
|
|
5
|
+
import { a as transcriptReadiness, c as TranscriptAliasNamespace, d as TranscriptProjectionError, i as readTranscriptWindowFrom, l as TranscriptChangePlan, n as buildingTranscriptWindow, o as PlanTranscriptBatch, r as inactiveTranscriptWindow, s as TranscriptAlias, t as TranscriptWindowSource, u as TranscriptLookup } from "./window-read-Brov9VdQ.js";
|
|
6
|
+
import { a as TranscriptSubscriptionRead, c as defaultTranscriptSubscriptionPolicy, d as transcriptCoverageOf, f as transcriptSubscriptionBaseOf, i as TranscriptSubscriptionPolicy, l as planTranscriptUpdate, n as TranscriptRequestId, o as TranscriptSubscriptionRequest, r as TranscriptSubscriptionBase, s as TranscriptUpdate, t as TranscriptCoverage, u as readTranscriptSubscription } from "./subscription-DZNWFDTV.js";
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
//#region src/transcript/interpreter.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Interpret one committed batch into a transcript change plan.
|
|
11
|
+
*
|
|
12
|
+
* Mirrors the `ReducedState` message, tool and inference fold without pruning: a
|
|
13
|
+
* `ContextRebased` only adds a compaction marker. Events at or below the lookup cursor are
|
|
14
|
+
* skipped, so an idempotent re-append is harmless. Foreign events are ignored unless a mapping
|
|
15
|
+
* of `definition` names their namespace, type and schema version.
|
|
16
|
+
*/
|
|
17
|
+
declare const planTranscriptBatch: PlanTranscriptBatch;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/transcript/version.d.ts
|
|
20
|
+
/**
|
|
21
|
+
* EDA's transcript semantic revision.
|
|
22
|
+
*
|
|
23
|
+
* Bump it deliberately whenever the interpreter, the legacy-attempt normalizer, the record
|
|
24
|
+
* decoders or the mapping executor would interpret any existing log differently. A bump changes
|
|
25
|
+
* every transcript version, so every session rebuilds and every host must run its backfill.
|
|
26
|
+
* A new durable event type needs a bump only if this release gives it transcript meaning;
|
|
27
|
+
* events the interpreter ignores leave the revision and every version unchanged.
|
|
28
|
+
*
|
|
29
|
+
* A CI fingerprint over a fixed scenario corpus (added with the interpreter) fails when
|
|
30
|
+
* interpretation output changes and this constant does not; re-record it together with the bump.
|
|
31
|
+
*
|
|
32
|
+
* History: 1 — the initial interpreter (0.1.0-alpha.22). 2 — submissions consumed by one turn are
|
|
33
|
+
* ordered by submission, as the prompt orders them, not by the turn's input list.
|
|
34
|
+
*/
|
|
35
|
+
declare const transcriptSemanticRevision = 2;
|
|
36
|
+
/**
|
|
37
|
+
* Deterministic JSON: object keys sorted by code unit, no whitespace. Only JSON values are
|
|
38
|
+
* accepted, so equal data always produces equal bytes.
|
|
39
|
+
*/
|
|
40
|
+
declare const canonicalJson: (value: unknown) => string;
|
|
41
|
+
/** Transcript version for a semantic revision and already-encoded canonical mapping data. */
|
|
42
|
+
declare const computeTranscriptVersion: (semanticRevision: number, encodedMappings: unknown) => TranscriptVersion;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/transcript/active-content.d.ts
|
|
45
|
+
/**
|
|
46
|
+
* The accumulated value of the inference streaming now, folded from the published live stream.
|
|
47
|
+
*
|
|
48
|
+
* Text and reasoning deltas carry only a `providerPartId`; they belong to the session's one
|
|
49
|
+
* active inference, which is the latest `InferenceStarted` without a terminal. That association
|
|
50
|
+
* is sound because `SessionState` publishes every durable and ephemeral event under one append
|
|
51
|
+
* gate, in commit order: an inference's start is published before its first delta and its
|
|
52
|
+
* terminal after its last. A session runs at most one inference at a time.
|
|
53
|
+
*
|
|
54
|
+
* The value is retired on every inference terminal (commit, partial plus failure, empty success
|
|
55
|
+
* and recovery failure all end in `InferenceCompleted` or `InferenceFailed`), and on its turn's
|
|
56
|
+
* terminal as a backstop. It is volatile: an isolate loss loses it, and recovery records the
|
|
57
|
+
* inference as failed (design decision 6).
|
|
58
|
+
*/
|
|
59
|
+
interface TranscriptActiveContentState {
|
|
60
|
+
/** Highest durable seq this accumulator has folded; the publication side of the capture fence. */
|
|
61
|
+
readonly publishedThroughSeq: SequenceNumber;
|
|
62
|
+
/** Increases whenever the served active content changes; lets subscribers skip unchanged sends. */
|
|
63
|
+
readonly revision: number;
|
|
64
|
+
readonly inference: ActiveInference | undefined;
|
|
65
|
+
}
|
|
66
|
+
interface ActiveInference {
|
|
67
|
+
readonly inferenceId: InferenceId;
|
|
68
|
+
readonly turnId: TurnId;
|
|
69
|
+
readonly parts: ReadonlyArray<TranscriptActivePart>;
|
|
70
|
+
}
|
|
71
|
+
/** The accumulator before anything is published in this isolate. */
|
|
72
|
+
declare const emptyTranscriptActiveContentState: TranscriptActiveContentState;
|
|
73
|
+
/** Fold one published event, in publication order, into the active-content accumulator. */
|
|
74
|
+
declare const foldTranscriptActiveContent: (state: TranscriptActiveContentState, positioned: PositionedEvent) => TranscriptActiveContentState;
|
|
75
|
+
/** The active content to serve, in the window's shape; empty when nothing is streaming. */
|
|
76
|
+
declare const transcriptActiveContentOf: (state: TranscriptActiveContentState) => ReadonlyArray<TranscriptActiveContent>;
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/transcript/body.d.ts
|
|
79
|
+
/** The committed-event fields that decide where its bodies are. */
|
|
80
|
+
interface TranscriptBodyEvent {
|
|
81
|
+
readonly namespace: string;
|
|
82
|
+
readonly type: string;
|
|
83
|
+
readonly payload: unknown;
|
|
84
|
+
}
|
|
85
|
+
/** A resolved body: the JSON the interpreter inlined there, or why there is none. */
|
|
86
|
+
type ResolvedTranscriptBody = {
|
|
87
|
+
readonly _tag: "Found";
|
|
88
|
+
readonly value: Schema.Json;
|
|
89
|
+
} | {
|
|
90
|
+
readonly _tag: "Missing";
|
|
91
|
+
readonly message: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Resolve a body reference against the committed event it names: the read side of the
|
|
95
|
+
* interpreter's body rule. Resolving through the log keeps a `Ref` valid after projection rows are
|
|
96
|
+
* rebuilt or deleted; any path that is not a body site resolves to nothing.
|
|
97
|
+
*/
|
|
98
|
+
declare const resolveTranscriptBody: (event: TranscriptBodyEvent, path: TranscriptFieldPath) => ResolvedTranscriptBody;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { AssistantRecordId, CompactionRecordId, ConsumedTranscriptUserRecord, DecorationBufferRecordId, EDATranscriptStore, EDATranscriptStoreShape, ImportAssistantRecordId, InferenceAssistantRecordId, PendingTranscriptUserRecord, PlanTranscriptBatch, type ResolvedTranscriptBody, RunGroupRecordId, SessionContextRecordId, ToolRecordId, TranscriptActiveContent, TranscriptActiveContentState, TranscriptActivePart, TranscriptAlias, TranscriptAliasNamespace, TranscriptAssistantLifecycle, TranscriptAssistantPart, TranscriptAssistantRecord, TranscriptBody, TranscriptBodySource, TranscriptBufferedDecoration, TranscriptChangePlan, TranscriptClassification, TranscriptCompactionRecord, TranscriptCoverage, TranscriptCursor, TranscriptCursorMismatch, TranscriptDecoration, TranscriptDecorationBufferRecord, TranscriptDecorationEntryId, TranscriptDecorationEntryKey, TranscriptDecorationKey, TranscriptDecorations, TranscriptDefinition, TranscriptDefinitionError, TranscriptFieldPath, TranscriptListEntryKey, TranscriptLogIncarnation, TranscriptLookup, TranscriptMaintenanceConfig, TranscriptMappedEvent, TranscriptMapping, TranscriptMappingOperation, TranscriptMappingTarget, TranscriptMappings, TranscriptOrder, TranscriptOrderKey, TranscriptPosition, TranscriptProjectionError, TranscriptReadiness, TranscriptRecord, TranscriptRecordEnvelope, TranscriptRecordFromEnvelope, TranscriptRecordId, TranscriptRecordKind, TranscriptRecordView, TranscriptRecordViewFromEnvelope, TranscriptRequestId, TranscriptRunGroupRecord, TranscriptRunMember, TranscriptRunOutcome, TranscriptSessionContextRecord, TranscriptSubscriptionBase, TranscriptSubscriptionPolicy, TranscriptSubscriptionRead, TranscriptSubscriptionRequest, TranscriptToolLifecycle, TranscriptToolRecord, TranscriptTopLevelRecord, TranscriptUnknownRecord, TranscriptUpdate, TranscriptUserFallback, TranscriptUserRecord, TranscriptUserState, TranscriptVersion, TranscriptVersionMeta, TranscriptVersionStatus, TranscriptWindow, TranscriptWindowLimits, TranscriptWindowSelector, type TranscriptWindowSource, UserRecordId, buildingTranscriptWindow, canonicalJson, computeTranscriptVersion, defaultTranscriptSubscriptionPolicy, defaultTranscriptWindowLimits, emptyTranscriptActiveContentState, emptyTranscriptMappings, foldTranscriptActiveContent, inactiveTranscriptWindow, isPendingTranscriptUserRecord, isTopLevelTranscriptRecord, makeTranscriptDefinition, planTranscriptBatch, planTranscriptUpdate, readTranscriptSubscription, readTranscriptWindowFrom, resolveTranscriptBody, runGroupStatus, transcriptActiveContentOf, transcriptCoverageOf, transcriptCursorOf, transcriptDecorationBufferLimit, transcriptMappingBounds, transcriptReadiness, transcriptRecordEnvelopeFormat, transcriptRecordId, transcriptSemanticRevision, transcriptStoredInlineBodyLimit, transcriptSubscriptionBaseOf };
|
|
101
|
+
//# sourceMappingURL=transcript.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { SequenceNumber } from "./types/core.js";
|
|
2
|
+
import { G as InferenceCompletedEvent, J as InferenceFailedEvent, X as InferenceStartedEvent, cn as TurnCompletedEvent, dn as TurnFailedEvent, hn as TurnStoppedEvent } from "./durable-D13w1Qr3.js";
|
|
3
|
+
import { ReasoningDeltaEvent, TextDeltaEvent, ToolParamsDeltaEvent, ToolParamsStartEvent } from "./types/events.js";
|
|
4
|
+
import { _ as computeTranscriptVersion, a as TranscriptDefinitionError, c as TranscriptMapping, d as TranscriptMappings, f as TranscriptUserFallback, g as canonicalJson, h as transcriptMappingBounds, i as TranscriptDefinition, l as TranscriptMappingOperation, m as makeTranscriptDefinition, n as TranscriptAliasNamespace, o as TranscriptListEntryKey, p as emptyTranscriptMappings, r as TranscriptProjectionError, s as TranscriptMappedEvent, t as planTranscriptBatch, u as TranscriptMappingTarget, v as transcriptSemanticRevision, y as resolveTranscriptBody } from "./interpreter-DKGJ1sSx.js";
|
|
5
|
+
import { A as TranscriptRecordFromEnvelope, B as TranscriptUserRecord, C as TranscriptDecorations, D as TranscriptPosition, E as TranscriptOrder, F as TranscriptRunOutcome, G as isTopLevelTranscriptRecord, H as TranscriptVersion, I as TranscriptSessionContextRecord, J as transcriptRecordEnvelopeFormat, K as runGroupStatus, L as TranscriptToolLifecycle, M as TranscriptRecordViewFromEnvelope, N as TranscriptRunGroupRecord, O as TranscriptRecord, P as TranscriptRunMember, R as TranscriptToolRecord, S as TranscriptDecorationKey, T as TranscriptLogIncarnation, U as UserRecordId, V as TranscriptUserState, W as isPendingTranscriptUserRecord, X as transcriptStoredInlineBodyLimit, Y as transcriptRecordId, _ as TranscriptCursor, a as InferenceAssistantRecordId, b as TranscriptDecorationEntryId, c as ToolRecordId, d as TranscriptAssistantRecord, f as TranscriptBody, g as TranscriptCompactionRecord, h as TranscriptClassification, i as ImportAssistantRecordId, j as TranscriptRecordId, k as TranscriptRecordEnvelope, l as TranscriptAssistantLifecycle, m as TranscriptBufferedDecoration, n as CompactionRecordId, o as RunGroupRecordId, p as TranscriptBodySource, q as transcriptDecorationBufferLimit, r as DecorationBufferRecordId, s as SessionContextRecordId, t as AssistantRecordId, u as TranscriptAssistantPart, v as TranscriptDecoration, w as TranscriptFieldPath, x as TranscriptDecorationEntryKey, y as TranscriptDecorationBufferRecord, z as TranscriptUnknownRecord } from "./records--54mZEBx.js";
|
|
6
|
+
import { a as EDATranscriptStore, i as transcriptReadiness, n as inactiveTranscriptWindow, o as TranscriptCursorMismatch, r as readTranscriptWindowFrom, t as buildingTranscriptWindow } from "./window-read-DPFAA1hM.js";
|
|
7
|
+
import { _ as TranscriptWindowSelector, a as defaultTranscriptSubscriptionPolicy, c as transcriptCoverageOf, d as TranscriptActivePart, f as TranscriptReadiness, g as TranscriptWindowLimits, h as TranscriptWindow, i as TranscriptUpdate, l as transcriptSubscriptionBaseOf, m as TranscriptVersionStatus, n as TranscriptRequestId, o as planTranscriptUpdate, p as TranscriptVersionMeta, r as TranscriptSubscriptionBase, s as readTranscriptSubscription, t as TranscriptCoverage, u as TranscriptActiveContent, v as defaultTranscriptWindowLimits, y as transcriptCursorOf } from "./subscription-DmO3BcdT.js";
|
|
8
|
+
import * as Schema from "effect/Schema";
|
|
9
|
+
//#region src/transcript/active-content.ts
|
|
10
|
+
/** The accumulator before anything is published in this isolate. */
|
|
11
|
+
const emptyTranscriptActiveContentState = {
|
|
12
|
+
publishedThroughSeq: SequenceNumber.make(0),
|
|
13
|
+
revision: 0,
|
|
14
|
+
inference: void 0
|
|
15
|
+
};
|
|
16
|
+
const isInferenceStarted = Schema.is(InferenceStartedEvent);
|
|
17
|
+
const isInferenceCompleted = Schema.is(InferenceCompletedEvent);
|
|
18
|
+
const isInferenceFailed = Schema.is(InferenceFailedEvent);
|
|
19
|
+
const isTurnCompleted = Schema.is(TurnCompletedEvent);
|
|
20
|
+
const isTurnFailed = Schema.is(TurnFailedEvent);
|
|
21
|
+
const isTurnStopped = Schema.is(TurnStoppedEvent);
|
|
22
|
+
const isTextDelta = Schema.is(TextDeltaEvent);
|
|
23
|
+
const isReasoningDelta = Schema.is(ReasoningDeltaEvent);
|
|
24
|
+
const isToolParamsStart = Schema.is(ToolParamsStartEvent);
|
|
25
|
+
const isToolParamsDelta = Schema.is(ToolParamsDeltaEvent);
|
|
26
|
+
/** Fold one published event, in publication order, into the active-content accumulator. */
|
|
27
|
+
const foldTranscriptActiveContent = (state, positioned) => {
|
|
28
|
+
const event = positioned.event;
|
|
29
|
+
if (event.durability === "durable") {
|
|
30
|
+
const published = {
|
|
31
|
+
...state,
|
|
32
|
+
publishedThroughSeq: SequenceNumber.make(Math.max(state.publishedThroughSeq, positioned.position.seq))
|
|
33
|
+
};
|
|
34
|
+
if (isInferenceStarted(event)) return withInference(published, {
|
|
35
|
+
inferenceId: event.payload.inferenceId,
|
|
36
|
+
turnId: event.payload.turnId,
|
|
37
|
+
parts: []
|
|
38
|
+
});
|
|
39
|
+
const active = published.inference;
|
|
40
|
+
if (active === void 0) return published;
|
|
41
|
+
return (isInferenceCompleted(event) || isInferenceFailed(event)) && event.payload.inferenceId === active.inferenceId || (isTurnCompleted(event) || isTurnFailed(event) || isTurnStopped(event)) && event.payload.turnId === active.turnId ? withInference(published, void 0) : published;
|
|
42
|
+
}
|
|
43
|
+
const active = state.inference;
|
|
44
|
+
if (active === void 0) return state;
|
|
45
|
+
if (isTextDelta(event)) return appendText(state, active, "Text", `text:${event.payload.providerPartId}`, event.payload.delta);
|
|
46
|
+
if (isReasoningDelta(event)) return appendText(state, active, "Reasoning", `reasoning:${event.payload.providerPartId}`, event.payload.delta);
|
|
47
|
+
if (isToolParamsStart(event)) {
|
|
48
|
+
const id = `tool:${event.payload.toolCallId}`;
|
|
49
|
+
if (active.parts.some((part) => part.id === id)) return state;
|
|
50
|
+
return withInference(state, {
|
|
51
|
+
...active,
|
|
52
|
+
parts: [...active.parts, {
|
|
53
|
+
id,
|
|
54
|
+
part: {
|
|
55
|
+
_tag: "ToolCall",
|
|
56
|
+
providerPartId: event.payload.providerPartId,
|
|
57
|
+
toolName: event.payload.toolName,
|
|
58
|
+
providerExecuted: event.payload.providerExecuted
|
|
59
|
+
},
|
|
60
|
+
paramsText: ""
|
|
61
|
+
}]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (isToolParamsDelta(event)) {
|
|
65
|
+
const id = `tool:${event.payload.toolCallId}`;
|
|
66
|
+
const delta = event.payload.delta;
|
|
67
|
+
if (delta.length === 0 || !active.parts.some((part) => part.id === id)) return state;
|
|
68
|
+
return withInference(state, {
|
|
69
|
+
...active,
|
|
70
|
+
parts: active.parts.map((part) => part.id === id ? {
|
|
71
|
+
...part,
|
|
72
|
+
paramsText: (part.paramsText ?? "") + delta
|
|
73
|
+
} : part)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return state;
|
|
77
|
+
};
|
|
78
|
+
const appendText = (state, active, tag, id, delta) => {
|
|
79
|
+
if (delta.length === 0) return state;
|
|
80
|
+
const index = active.parts.findIndex((part) => part.id === id);
|
|
81
|
+
const existing = index === -1 ? void 0 : active.parts[index];
|
|
82
|
+
const part = {
|
|
83
|
+
id,
|
|
84
|
+
part: {
|
|
85
|
+
_tag: tag,
|
|
86
|
+
text: existing !== void 0 && existing.part._tag === tag ? existing.part.text + delta : delta
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return withInference(state, {
|
|
90
|
+
...active,
|
|
91
|
+
parts: index === -1 ? [...active.parts, part] : active.parts.map((candidate, candidateIndex) => candidateIndex === index ? part : candidate)
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
const withInference = (state, inference) => state.inference === void 0 && inference === void 0 ? state : {
|
|
95
|
+
...state,
|
|
96
|
+
revision: state.revision + 1,
|
|
97
|
+
inference
|
|
98
|
+
};
|
|
99
|
+
/** The active content to serve, in the window's shape; empty when nothing is streaming. */
|
|
100
|
+
const transcriptActiveContentOf = (state) => state.inference === void 0 ? [] : [{
|
|
101
|
+
assistantId: transcriptRecordId.assistant(state.inference.inferenceId),
|
|
102
|
+
parts: state.inference.parts
|
|
103
|
+
}];
|
|
104
|
+
//#endregion
|
|
105
|
+
export { AssistantRecordId, CompactionRecordId, DecorationBufferRecordId, EDATranscriptStore, ImportAssistantRecordId, InferenceAssistantRecordId, RunGroupRecordId, SessionContextRecordId, ToolRecordId, TranscriptActiveContent, TranscriptActivePart, TranscriptAliasNamespace, TranscriptAssistantLifecycle, TranscriptAssistantPart, TranscriptAssistantRecord, TranscriptBody, TranscriptBodySource, TranscriptBufferedDecoration, TranscriptClassification, TranscriptCompactionRecord, TranscriptCoverage, TranscriptCursor, TranscriptCursorMismatch, TranscriptDecoration, TranscriptDecorationBufferRecord, TranscriptDecorationEntryId, TranscriptDecorationEntryKey, TranscriptDecorationKey, TranscriptDecorations, TranscriptDefinition, TranscriptDefinitionError, TranscriptFieldPath, TranscriptListEntryKey, TranscriptLogIncarnation, TranscriptMappedEvent, TranscriptMapping, TranscriptMappingOperation, TranscriptMappingTarget, TranscriptMappings, TranscriptOrder, TranscriptPosition, TranscriptProjectionError, TranscriptReadiness, TranscriptRecord, TranscriptRecordEnvelope, TranscriptRecordFromEnvelope, TranscriptRecordId, TranscriptRecordViewFromEnvelope, TranscriptRequestId, TranscriptRunGroupRecord, TranscriptRunMember, TranscriptRunOutcome, TranscriptSessionContextRecord, TranscriptSubscriptionBase, TranscriptToolLifecycle, TranscriptToolRecord, TranscriptUnknownRecord, TranscriptUpdate, TranscriptUserFallback, TranscriptUserRecord, TranscriptUserState, TranscriptVersion, TranscriptVersionMeta, TranscriptVersionStatus, TranscriptWindow, TranscriptWindowLimits, TranscriptWindowSelector, UserRecordId, buildingTranscriptWindow, canonicalJson, computeTranscriptVersion, defaultTranscriptSubscriptionPolicy, defaultTranscriptWindowLimits, emptyTranscriptActiveContentState, emptyTranscriptMappings, foldTranscriptActiveContent, inactiveTranscriptWindow, isPendingTranscriptUserRecord, isTopLevelTranscriptRecord, makeTranscriptDefinition, planTranscriptBatch, planTranscriptUpdate, readTranscriptSubscription, readTranscriptWindowFrom, resolveTranscriptBody, runGroupStatus, transcriptActiveContentOf, transcriptCoverageOf, transcriptCursorOf, transcriptDecorationBufferLimit, transcriptMappingBounds, transcriptReadiness, transcriptRecordEnvelopeFormat, transcriptRecordId, transcriptSemanticRevision, transcriptStoredInlineBodyLimit, transcriptSubscriptionBaseOf };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=transcript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.js","names":[],"sources":["../src/transcript/active-content.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nimport { SequenceNumber, type InferenceId, type TurnId } from \"../types/core\";\nimport type { PositionedEvent } from \"../types/events\";\nimport {\n InferenceCompletedEvent,\n InferenceFailedEvent,\n InferenceStartedEvent,\n TurnCompletedEvent,\n TurnFailedEvent,\n TurnStoppedEvent,\n} from \"../types/events/durable\";\nimport {\n ReasoningDeltaEvent,\n TextDeltaEvent,\n ToolParamsDeltaEvent,\n ToolParamsStartEvent,\n} from \"../types/events/ephemeral\";\nimport { transcriptRecordId } from \"./records\";\nimport type { TranscriptActiveContent, TranscriptActivePart } from \"./window\";\n\n/**\n * The accumulated value of the inference streaming now, folded from the published live stream.\n *\n * Text and reasoning deltas carry only a `providerPartId`; they belong to the session's one\n * active inference, which is the latest `InferenceStarted` without a terminal. That association\n * is sound because `SessionState` publishes every durable and ephemeral event under one append\n * gate, in commit order: an inference's start is published before its first delta and its\n * terminal after its last. A session runs at most one inference at a time.\n *\n * The value is retired on every inference terminal (commit, partial plus failure, empty success\n * and recovery failure all end in `InferenceCompleted` or `InferenceFailed`), and on its turn's\n * terminal as a backstop. It is volatile: an isolate loss loses it, and recovery records the\n * inference as failed (design decision 6).\n */\nexport interface TranscriptActiveContentState {\n /** Highest durable seq this accumulator has folded; the publication side of the capture fence. */\n readonly publishedThroughSeq: SequenceNumber;\n /** Increases whenever the served active content changes; lets subscribers skip unchanged sends. */\n readonly revision: number;\n readonly inference: ActiveInference | undefined;\n}\n\ninterface ActiveInference {\n readonly inferenceId: InferenceId;\n readonly turnId: TurnId;\n readonly parts: ReadonlyArray<TranscriptActivePart>;\n}\n\n/** The accumulator before anything is published in this isolate. */\nexport const emptyTranscriptActiveContentState: TranscriptActiveContentState = {\n publishedThroughSeq: SequenceNumber.make(0),\n revision: 0,\n inference: undefined,\n};\n\nconst isInferenceStarted = Schema.is(InferenceStartedEvent);\nconst isInferenceCompleted = Schema.is(InferenceCompletedEvent);\nconst isInferenceFailed = Schema.is(InferenceFailedEvent);\nconst isTurnCompleted = Schema.is(TurnCompletedEvent);\nconst isTurnFailed = Schema.is(TurnFailedEvent);\nconst isTurnStopped = Schema.is(TurnStoppedEvent);\nconst isTextDelta = Schema.is(TextDeltaEvent);\nconst isReasoningDelta = Schema.is(ReasoningDeltaEvent);\nconst isToolParamsStart = Schema.is(ToolParamsStartEvent);\nconst isToolParamsDelta = Schema.is(ToolParamsDeltaEvent);\n\n/** Fold one published event, in publication order, into the active-content accumulator. */\nexport const foldTranscriptActiveContent = (\n state: TranscriptActiveContentState,\n positioned: PositionedEvent,\n): TranscriptActiveContentState => {\n const event = positioned.event;\n if (event.durability === \"durable\") {\n const published: TranscriptActiveContentState = {\n ...state,\n publishedThroughSeq: SequenceNumber.make(\n Math.max(state.publishedThroughSeq, positioned.position.seq),\n ),\n };\n if (isInferenceStarted(event)) {\n return withInference(published, {\n inferenceId: event.payload.inferenceId,\n turnId: event.payload.turnId,\n parts: [],\n });\n }\n const active = published.inference;\n if (active === undefined) return published;\n const retires =\n ((isInferenceCompleted(event) || isInferenceFailed(event)) &&\n event.payload.inferenceId === active.inferenceId) ||\n ((isTurnCompleted(event) || isTurnFailed(event) || isTurnStopped(event)) &&\n event.payload.turnId === active.turnId);\n return retires ? withInference(published, undefined) : published;\n }\n\n const active = state.inference;\n if (active === undefined) return state;\n if (isTextDelta(event)) {\n return appendText(\n state,\n active,\n \"Text\",\n `text:${event.payload.providerPartId}`,\n event.payload.delta,\n );\n }\n if (isReasoningDelta(event)) {\n return appendText(\n state,\n active,\n \"Reasoning\",\n `reasoning:${event.payload.providerPartId}`,\n event.payload.delta,\n );\n }\n if (isToolParamsStart(event)) {\n const id = `tool:${event.payload.toolCallId}`;\n if (active.parts.some((part) => part.id === id)) return state;\n return withInference(state, {\n ...active,\n parts: [\n ...active.parts,\n {\n id,\n part: {\n _tag: \"ToolCall\",\n providerPartId: event.payload.providerPartId,\n toolName: event.payload.toolName,\n providerExecuted: event.payload.providerExecuted,\n },\n paramsText: \"\",\n },\n ],\n });\n }\n if (isToolParamsDelta(event)) {\n const id = `tool:${event.payload.toolCallId}`;\n const delta = event.payload.delta;\n if (delta.length === 0 || !active.parts.some((part) => part.id === id)) return state;\n return withInference(state, {\n ...active,\n parts: active.parts.map((part) =>\n part.id === id ? { ...part, paramsText: (part.paramsText ?? \"\") + delta } : part,\n ),\n });\n }\n return state;\n};\n\nconst appendText = (\n state: TranscriptActiveContentState,\n active: ActiveInference,\n tag: \"Text\" | \"Reasoning\",\n id: string,\n delta: string,\n): TranscriptActiveContentState => {\n if (delta.length === 0) return state;\n const index = active.parts.findIndex((part) => part.id === id);\n const existing = index === -1 ? undefined : active.parts[index];\n const text =\n existing !== undefined && existing.part._tag === tag ? existing.part.text + delta : delta;\n const part: TranscriptActivePart = { id, part: { _tag: tag, text } };\n return withInference(state, {\n ...active,\n parts:\n index === -1\n ? [...active.parts, part]\n : active.parts.map((candidate, candidateIndex) =>\n candidateIndex === index ? part : candidate,\n ),\n });\n};\n\nconst withInference = (\n state: TranscriptActiveContentState,\n inference: ActiveInference | undefined,\n): TranscriptActiveContentState =>\n state.inference === undefined && inference === undefined\n ? state\n : { ...state, revision: state.revision + 1, inference };\n\n/** The active content to serve, in the window's shape; empty when nothing is streaming. */\nexport const transcriptActiveContentOf = (\n state: TranscriptActiveContentState,\n): ReadonlyArray<TranscriptActiveContent> =>\n state.inference === undefined\n ? []\n : [\n {\n assistantId: transcriptRecordId.assistant(state.inference.inferenceId),\n parts: state.inference.parts,\n },\n ];\n"],"mappings":";;;;;;;;;;AAkDA,MAAa,oCAAkE;CAC7E,qBAAqB,eAAe,KAAK,CAAC;CAC1C,UAAU;CACV,WAAW,KAAA;AACb;AA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K,WAAW,mBAC3B,mBAAmB,QAAQ,OAAO,SACpC;CACR,CAAC;AACH;AAEA,MAAM,iBACJ,OACA,cAEA,MAAM,cAAc,KAAA,KAAa,cAAc,KAAA,IAC3C,QACA;CAAE,GAAG;CAAO,UAAU,MAAM,WAAW;CAAG;AAAU;;AAG1D,MAAa,6BACX,UAEA,MAAM,cAAc,KAAA,IAChB,CAAC,IACD,CACE;CACE,aAAa,mBAAmB,UAAU,MAAM,UAAU,WAAW;CACrE,OAAO,MAAM,UAAU;AACzB,CACF"}
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { CancelPendingMessageCommand, CommandIdempotencyKey, EDACommand, PendingMessageCancellationReason, PromotePendingMessageCommand, ResumePendingMessagesCommand, StopTurnCommand, SubmitMessageCommand, SubmitMessageDisposition, UserMessageContent, UserMessagePart };
|
|
1
|
+
import { a as PendingMessageCancellationReason, c as StopTurnCommand, d as UserMessageContent, f as UserMessagePart, i as GrantRunCommand, l as SubmitMessageCommand, n as CommandIdempotencyKey, o as PromotePendingMessageCommand, r as EDACommand, s as ResumePendingMessagesCommand, t as CancelPendingMessageCommand, u as SubmitMessageDisposition } from "../commands-BUquEZVP.js";
|
|
2
|
+
export { CancelPendingMessageCommand, CommandIdempotencyKey, EDACommand, GrantRunCommand, PendingMessageCancellationReason, PromotePendingMessageCommand, ResumePendingMessagesCommand, StopTurnCommand, SubmitMessageCommand, SubmitMessageDisposition, UserMessageContent, UserMessagePart };
|
package/dist/types/commands.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CommandId, MessageId } from "./core.js";
|
|
1
|
+
import { CommandId, MessageId, RunRequestId } from "./core.js";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
|
-
import * as Prompt from "effect/
|
|
3
|
+
import * as Prompt from "effect/ai/Prompt";
|
|
4
4
|
//#region src/types/commands.ts
|
|
5
5
|
/** Caller-owned stable retry/correlation key for a submitted command. */
|
|
6
6
|
const CommandIdempotencyKey = Schema.NonEmptyString.pipe(Schema.brand("CommandIdempotencyKey"));
|
|
@@ -54,7 +54,12 @@ const EDACommand = Schema.Union([
|
|
|
54
54
|
PromotePendingMessageCommand,
|
|
55
55
|
ResumePendingMessagesCommand
|
|
56
56
|
]);
|
|
57
|
+
/**
|
|
58
|
+
* Trusted scheduler permission, accepted only through the separate grantRun API.
|
|
59
|
+
* Excluded from EDACommand so ordinary session ingress cannot authorize itself.
|
|
60
|
+
*/
|
|
61
|
+
var GrantRunCommand = class extends Schema.TaggedClass()("GrantRun", { requestId: RunRequestId }) {};
|
|
57
62
|
//#endregion
|
|
58
|
-
export { CancelPendingMessageCommand, CommandIdempotencyKey, EDACommand, PendingMessageCancellationReason, PromotePendingMessageCommand, ResumePendingMessagesCommand, StopTurnCommand, SubmitMessageCommand, SubmitMessageDisposition, UserMessageContent, UserMessagePart };
|
|
63
|
+
export { CancelPendingMessageCommand, CommandIdempotencyKey, EDACommand, GrantRunCommand, PendingMessageCancellationReason, PromotePendingMessageCommand, ResumePendingMessagesCommand, StopTurnCommand, SubmitMessageCommand, SubmitMessageDisposition, UserMessageContent, UserMessagePart };
|
|
59
64
|
|
|
60
65
|
//# sourceMappingURL=commands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","names":[],"sources":["../../src/types/commands.ts"],"sourcesContent":["import * as Prompt from \"effect/
|
|
1
|
+
{"version":3,"file":"commands.js","names":[],"sources":["../../src/types/commands.ts"],"sourcesContent":["import * as Prompt from \"effect/ai/Prompt\";\nimport * as Schema from \"effect/Schema\";\n\nimport { CommandId, MessageId, RunRequestId } from \"./core\";\n\n/** Caller-owned stable retry/correlation key for a submitted command. */\nexport const CommandIdempotencyKey = Schema.NonEmptyString.pipe(\n Schema.brand(\"CommandIdempotencyKey\"),\n);\nexport type CommandIdempotencyKey = typeof CommandIdempotencyKey.Type;\n\nconst CommandSubmissionFields = {\n /**\n * Optional low-level lifecycle id. Normal app code should omit this and let EDA mint it.\n */\n commandId: Schema.optionalKey(CommandId),\n /** Caller-owned stable retry/correlation key. Not required to be a UUID. */\n idempotencyKey: Schema.optionalKey(CommandIdempotencyKey),\n};\n\n/** How a submitted user message interacts with an active run. */\nexport const SubmitMessageDisposition = Schema.Literals([\"queue\", \"steer\", \"interrupt\"]);\nexport type SubmitMessageDisposition = typeof SubmitMessageDisposition.Type;\n\n/** User-authored content parts accepted into the durable command stream. */\nexport const UserMessagePart = Schema.Union([Prompt.TextPart, Prompt.FilePart]);\nexport type UserMessagePart = typeof UserMessagePart.Type;\n\n/** Non-empty user-authored content, aligned to Effect AI `Prompt.UserMessage` content. */\nexport const UserMessageContent = Schema.Union([\n Prompt.ContentFromString,\n Schema.NonEmptyArray(UserMessagePart),\n]);\nexport type UserMessageContent = typeof UserMessageContent.Type;\n\n/** Submit a user message to the session command stream. */\nexport class SubmitMessageCommand extends Schema.TaggedClass<SubmitMessageCommand>()(\n \"SubmitMessage\",\n {\n ...CommandSubmissionFields,\n disposition: SubmitMessageDisposition,\n content: UserMessageContent,\n expectedPausedMessageIdsToCancel: Schema.optionalKey(Schema.Array(MessageId)),\n },\n) {}\n\nexport const PendingMessageCancellationReason = Schema.Literals([\"edit\", \"user-cancel\"]);\nexport type PendingMessageCancellationReason = typeof PendingMessageCancellationReason.Type;\n\nexport class CancelPendingMessageCommand extends Schema.TaggedClass<CancelPendingMessageCommand>()(\n \"CancelPendingMessage\",\n {\n ...CommandSubmissionFields,\n messageId: MessageId,\n reason: PendingMessageCancellationReason,\n },\n) {}\n\nexport class PromotePendingMessageCommand extends Schema.TaggedClass<PromotePendingMessageCommand>()(\n \"PromotePendingMessage\",\n {\n ...CommandSubmissionFields,\n messageId: MessageId,\n },\n) {}\n\n/** Framework-internal owner for restarting unconsumed messages after unexpected failure. */\nexport class ResumePendingMessagesCommand extends Schema.TaggedClass<ResumePendingMessagesCommand>()(\n \"ResumePendingMessages\",\n {\n ...CommandSubmissionFields,\n messageIds: Schema.NonEmptyArray(MessageId),\n },\n) {}\n\n/** Request interruption/finalization of the active turn. */\nexport class StopTurnCommand extends Schema.TaggedClass<StopTurnCommand>()(\"StopTurn\", {\n ...CommandSubmissionFields,\n}) {}\n\n/** Mutating input accepted by effect-durable-agent before runtime processing. */\nexport const EDACommand = Schema.Union([\n SubmitMessageCommand,\n StopTurnCommand,\n CancelPendingMessageCommand,\n PromotePendingMessageCommand,\n ResumePendingMessagesCommand,\n]);\nexport type EDACommand = typeof EDACommand.Type;\n\n/**\n * Trusted scheduler permission, accepted only through the separate grantRun API.\n * Excluded from EDACommand so ordinary session ingress cannot authorize itself.\n */\nexport class GrantRunCommand extends Schema.TaggedClass<GrantRunCommand>()(\"GrantRun\", {\n requestId: RunRequestId,\n}) {}\n"],"mappings":";;;;;AAMA,MAAa,wBAAwB,OAAO,eAAe,KACzD,OAAO,MAAM,uBAAuB,CACtC;AAGA,MAAM,0BAA0B;;;;CAI9B,WAAW,OAAO,YAAY,SAAS;;CAEvC,gBAAgB,OAAO,YAAY,qBAAqB;AAC1D;;AAGA,MAAa,2BAA2B,OAAO,SAAS;CAAC;CAAS;CAAS;AAAW,CAAC;;AAIvF,MAAa,kBAAkB,OAAO,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,CAAC;;AAI9E,MAAa,qBAAqB,OAAO,MAAM,CAC7C,OAAO,mBACP,OAAO,cAAc,eAAe,CACtC,CAAC;;AAID,IAAa,uBAAb,cAA0C,OAAO,YAAkC,CAAC,CAClF,iBACA;CACE,GAAG;CACH,aAAa;CACb,SAAS;CACT,kCAAkC,OAAO,YAAY,OAAO,MAAM,SAAS,CAAC;AAC9E,CACF,CAAC,CAAC,CAAC;AAEH,MAAa,mCAAmC,OAAO,SAAS,CAAC,QAAQ,aAAa,CAAC;AAGvF,IAAa,8BAAb,cAAiD,OAAO,YAAyC,CAAC,CAChG,wBACA;CACE,GAAG;CACH,WAAW;CACX,QAAQ;AACV,CACF,CAAC,CAAC,CAAC;AAEH,IAAa,+BAAb,cAAkD,OAAO,YAA0C,CAAC,CAClG,yBACA;CACE,GAAG;CACH,WAAW;AACb,CACF,CAAC,CAAC,CAAC;;AAGH,IAAa,+BAAb,cAAkD,OAAO,YAA0C,CAAC,CAClG,yBACA;CACE,GAAG;CACH,YAAY,OAAO,cAAc,SAAS;AAC5C,CACF,CAAC,CAAC,CAAC;;AAGH,IAAa,kBAAb,cAAqC,OAAO,YAA6B,CAAC,CAAC,YAAY,EACrF,GAAG,wBACL,CAAC,CAAC,CAAC,CAAC;;AAGJ,MAAa,aAAa,OAAO,MAAM;CACrC;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAOD,IAAa,kBAAb,cAAqC,OAAO,YAA6B,CAAC,CAAC,YAAY,EACrF,WAAW,aACb,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/types/core.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { BaseStateId, CommandId, CompactionId, ContextVersion, CorrelationId, DurablePosition, DurableSubSequenceNumber, EventId, InferenceId, MessageId, Position, PositionOrder, RunId, SequenceNumber, SessionId, SubSequenceNumber, SummaryId, ToolCallId, TurnId, comparePosition, durablePosition };
|
|
1
|
+
import { S as durablePosition, _ as SubSequenceNumber, a as CorrelationId, b as TurnId, c as EventId, d as Position, f as PositionOrder, g as SessionId, h as SequenceNumber, i as ContextVersion, l as InferenceId, m as RunRequestId, n as CommandId, o as DurablePosition, p as RunId, r as CompactionId, s as DurableSubSequenceNumber, t as BaseStateId, u as MessageId, v as SummaryId, x as comparePosition, y as ToolCallId } from "../core-BcimKMIv.js";
|
|
2
|
+
export { BaseStateId, CommandId, CompactionId, ContextVersion, CorrelationId, DurablePosition, DurableSubSequenceNumber, EventId, InferenceId, MessageId, Position, PositionOrder, RunId, RunRequestId, SequenceNumber, SessionId, SubSequenceNumber, SummaryId, ToolCallId, TurnId, comparePosition, durablePosition };
|
package/dist/types/core.js
CHANGED
|
@@ -16,6 +16,8 @@ const EventId = UuidV7String.pipe(Schema.brand("EventId"));
|
|
|
16
16
|
const CommandId = UuidV7String.pipe(Schema.brand("CommandId"));
|
|
17
17
|
/** Processing lifecycle identity triggered by one or more commands. */
|
|
18
18
|
const RunId = UuidV7String.pipe(Schema.brand("RunId"));
|
|
19
|
+
/** Stable deduplication identity for one durable request to authorize a new run. */
|
|
20
|
+
const RunRequestId = UuidV7String.pipe(Schema.brand("RunRequestId"));
|
|
19
21
|
/** One LLM invocation within a run. */
|
|
20
22
|
const TurnId = UuidV7String.pipe(Schema.brand("TurnId"));
|
|
21
23
|
/** One concrete model inference for a turn. */
|
|
@@ -63,6 +65,6 @@ const PositionOrder = Order.Struct({
|
|
|
63
65
|
/** Compare live positions lexicographically. */
|
|
64
66
|
const comparePosition = PositionOrder;
|
|
65
67
|
//#endregion
|
|
66
|
-
export { BaseStateId, CommandId, CompactionId, ContextVersion, CorrelationId, DurablePosition, DurableSubSequenceNumber, EventId, InferenceId, MessageId, Position, PositionOrder, RunId, SequenceNumber, SessionId, SubSequenceNumber, SummaryId, ToolCallId, TurnId, comparePosition, durablePosition };
|
|
68
|
+
export { BaseStateId, CommandId, CompactionId, ContextVersion, CorrelationId, DurablePosition, DurableSubSequenceNumber, EventId, InferenceId, MessageId, Position, PositionOrder, RunId, RunRequestId, SequenceNumber, SessionId, SubSequenceNumber, SummaryId, ToolCallId, TurnId, comparePosition, durablePosition };
|
|
67
69
|
|
|
68
70
|
//# sourceMappingURL=core.js.map
|