@tangle-network/agent-runtime 0.153.2 → 0.156.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.
Files changed (85) hide show
  1. package/dist/{activation-Bbic0THc.js → activation-B4fRz8QL.js} +3 -3
  2. package/dist/{activation-Bbic0THc.js.map → activation-B4fRz8QL.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{authoring-CcVhJ1lP.js → authoring-C4uCoDmO.js} +2 -2
  6. package/dist/{authoring-CcVhJ1lP.js.map → authoring-C4uCoDmO.js.map} +1 -1
  7. package/dist/candidate-execution/index.js +4 -4
  8. package/dist/{candidate-execution-DYOB1juU.js → candidate-execution-Ic92NMl9.js} +4 -4
  9. package/dist/{candidate-execution-DYOB1juU.js.map → candidate-execution-Ic92NMl9.js.map} +1 -1
  10. package/dist/{conversation-BHMwAiMo.js → conversation-DLYKdh6W.js} +4 -4
  11. package/dist/{conversation-BHMwAiMo.js.map → conversation-DLYKdh6W.js.map} +1 -1
  12. package/dist/conversation.d.ts +1 -1
  13. package/dist/conversation.js +1 -1
  14. package/dist/durable.d.ts +2 -2
  15. package/dist/durable.js +1 -1
  16. package/dist/{environment-provider-DJG0yIYl.d.ts → environment-provider-C_QI6VCG.d.ts} +2 -2
  17. package/dist/{environment-provider-3eCszBEm.js → environment-provider-Dz9JB-X_.js} +2 -2
  18. package/dist/{environment-provider-3eCszBEm.js.map → environment-provider-Dz9JB-X_.js.map} +1 -1
  19. package/dist/environment-provider.d.ts +1 -1
  20. package/dist/environment-provider.js +1 -1
  21. package/dist/{executable-spec-BUcUcEPk.js → executable-spec-7ovS7PBo.js} +2 -2
  22. package/dist/{executable-spec-BUcUcEPk.js.map → executable-spec-7ovS7PBo.js.map} +1 -1
  23. package/dist/{graph-CIh2HDmH.js → graph-BibNm6a-.js} +3 -3
  24. package/dist/{graph-CIh2HDmH.js.map → graph-BibNm6a-.js.map} +1 -1
  25. package/dist/{improvement-cycle-GCDSsTN6.js → improvement-cycle-g6RsxGbg.js} +6 -6
  26. package/dist/{improvement-cycle-GCDSsTN6.js.map → improvement-cycle-g6RsxGbg.js.map} +1 -1
  27. package/dist/{index-DLn9WI-f.d.ts → index-B2A_KtAZ.d.ts} +23 -9
  28. package/dist/{index-lMADJLfq.d.ts → index-BYGBIxtx.d.ts} +4 -4
  29. package/dist/{index-rxVSm9-z.d.ts → index-DPFUNEdU.d.ts} +2 -2
  30. package/dist/index.d.ts +7 -7
  31. package/dist/index.js +13 -13
  32. package/dist/intelligence.d.ts +4 -4
  33. package/dist/intelligence.js +6 -6
  34. package/dist/kernel.d.ts +5 -5
  35. package/dist/kernel.js +9 -9
  36. package/dist/{knowledge-CaY53BW2.js → knowledge-DeP-wG8l.js} +5 -5
  37. package/dist/{knowledge-CaY53BW2.js.map → knowledge-DeP-wG8l.js.map} +1 -1
  38. package/dist/knowledge.d.ts +1 -1
  39. package/dist/knowledge.js +1 -1
  40. package/dist/{loop-runner-bin-BwPqxKhR.d.ts → loop-runner-bin-9VUQihh7.d.ts} +3 -3
  41. package/dist/{loop-runner-bin-Dw43kB_-.js → loop-runner-bin-LvaprzUz.js} +3 -3
  42. package/dist/{loop-runner-bin-Dw43kB_-.js.map → loop-runner-bin-LvaprzUz.js.map} +1 -1
  43. package/dist/loop-runner-bin.d.ts +1 -1
  44. package/dist/loop-runner-bin.js +1 -1
  45. package/dist/{materialization-Dl9J8ek4.js → materialization-Ct3I4wu3.js} +22 -3
  46. package/dist/{materialization-Dl9J8ek4.js.map → materialization-Ct3I4wu3.js.map} +1 -1
  47. package/dist/mcp/bin.js +3 -3
  48. package/dist/mcp/index.d.ts +5 -5
  49. package/dist/mcp/index.js +5 -5
  50. package/dist/{openai-tools-C4XKuK4t.js → openai-tools-CkSQJppW.js} +2 -2
  51. package/dist/{openai-tools-C4XKuK4t.js.map → openai-tools-CkSQJppW.js.map} +1 -1
  52. package/dist/{prepare-C5tI-H4o.js → prepare-DcMjMdj-.js} +19 -14
  53. package/dist/prepare-DcMjMdj-.js.map +1 -0
  54. package/dist/primeintellect/index.d.ts +1 -1
  55. package/dist/{protected-model-port-DHDKNeY7.js → protected-model-port-BzUkspPP.js} +2 -2
  56. package/dist/{protected-model-port-DHDKNeY7.js.map → protected-model-port-BzUkspPP.js.map} +1 -1
  57. package/dist/{redact-NAptmqKw.d.ts → redact-BT7-mX8G.d.ts} +3 -3
  58. package/dist/{runtime--Jsq8JCC.js → runtime-D-NDRp4y.js} +24 -12
  59. package/dist/runtime-D-NDRp4y.js.map +1 -0
  60. package/dist/{runtime-B-5dp5Iz.d.ts → runtime-DuueBLeO.d.ts} +4 -4
  61. package/dist/{snapshot-cK9K420n.js → snapshot-CTAf4uuA.js} +8 -3
  62. package/dist/snapshot-CTAf4uuA.js.map +1 -0
  63. package/dist/{spawn-journal-BLnveCRS.js → spawn-journal-duo0EkOp.js} +2 -2
  64. package/dist/{spawn-journal-BLnveCRS.js.map → spawn-journal-duo0EkOp.js.map} +1 -1
  65. package/dist/{stream-agent-turn-BGyszuPH.d.ts → stream-agent-turn-BbcwWw_J.d.ts} +2 -2
  66. package/dist/{stream-agent-turn-DYi8ymsU.js → stream-agent-turn-FRZAuXAL.js} +3 -3
  67. package/dist/{stream-agent-turn-DYi8ymsU.js.map → stream-agent-turn-FRZAuXAL.js.map} +1 -1
  68. package/dist/{structural-rollout-D7V-HgXJ.js → structural-rollout-B1TocSdq.js} +5 -5
  69. package/dist/{structural-rollout-D7V-HgXJ.js.map → structural-rollout-B1TocSdq.js.map} +1 -1
  70. package/dist/{supervise-k_8VOASb.js → supervise-BVE0XAJa.js} +44 -64
  71. package/dist/supervise-BVE0XAJa.js.map +1 -0
  72. package/dist/{supervisor-CMZsJ7Wn.js → supervisor-BmXD0WCJ.js} +25 -28
  73. package/dist/supervisor-BmXD0WCJ.js.map +1 -0
  74. package/dist/testing.d.ts +2 -2
  75. package/dist/testing.js +12 -12
  76. package/dist/{types-BPQhQRrC.d.ts → types-Cz5mCGlY.d.ts} +4 -4
  77. package/dist/{workspace-archive-B9ui4rrR.js → workspace-archive-bugA3OwU.js} +2 -13
  78. package/dist/workspace-archive-bugA3OwU.js.map +1 -0
  79. package/package.json +1 -1
  80. package/dist/prepare-C5tI-H4o.js.map +0 -1
  81. package/dist/runtime--Jsq8JCC.js.map +0 -1
  82. package/dist/snapshot-cK9K420n.js.map +0 -1
  83. package/dist/supervise-k_8VOASb.js.map +0 -1
  84. package/dist/supervisor-CMZsJ7Wn.js.map +0 -1
  85. package/dist/workspace-archive-B9ui4rrR.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"materialization-Dl9J8ek4.js","names":[],"sources":["../src/runtime/turn-input.ts","../src/runtime/retained-run-binding.ts","../src/runtime/supervise/materialization.ts"],"sourcesContent":["import {\n AgentExactRunControlRefSchema,\n type ContextTransferRequest,\n type InputPart,\n} from '@tangle-network/agent-interface'\nimport type { AgentTurnInput } from '@tangle-network/agent-interface/environment-provider'\nimport type { PromptInputPart, PromptOptions } from '@tangle-network/sandbox'\n\n/**\n * Copy only fields that describe a new provider turn.\n *\n * Session, replay, continuation, and transfer coordinates are runtime-owned\n * and are injected by the caller that owns that lifecycle. Keeping this copy\n * explicit also makes JavaScript callers subject to the same boundary.\n */\nexport function freshTurnInput(\n input: AgentTurnInput,\n runtime: {\n readonly turnId: string\n readonly detach: true\n readonly sessionId?: string\n readonly executionId?: string\n readonly contextTransfer?: ContextTransferRequest\n },\n): AgentTurnInput {\n const fresh: AgentTurnInput = {\n ...(input.prompt === undefined ? {} : { prompt: input.prompt }),\n ...(input.parts === undefined ? {} : { parts: input.parts }),\n ...(input.model === undefined ? {} : { model: input.model }),\n ...(input.timeoutMs === undefined ? {} : { timeoutMs: input.timeoutMs }),\n ...(input.context === undefined ? {} : { context: input.context }),\n ...(input.interactions === undefined ? {} : { interactions: input.interactions }),\n ...(input.providerOptions === undefined ? {} : { providerOptions: input.providerOptions }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n turnId: runtime.turnId,\n detach: runtime.detach,\n ...(runtime.sessionId === undefined ? {} : { sessionId: runtime.sessionId }),\n ...(runtime.executionId === undefined ? {} : { executionId: runtime.executionId }),\n ...(runtime.contextTransfer === undefined ? {} : { contextTransfer: runtime.contextTransfer }),\n }\n return fresh\n}\n\n/** Project canonical turn parts onto the Sandbox prompt vocabulary once. */\nexport function promptFromAgentTurnInput(input: AgentTurnInput): string | PromptInputPart[] {\n if (input.parts !== undefined) return input.parts.map(promptPartFromInputPart)\n return input.prompt ?? providerMessageText(input.providerOptions) ?? ''\n}\n\n/** Project canonical turn controls onto the Sandbox prompt options once. */\nexport function promptOptionsFromAgentTurnInput(input: AgentTurnInput): PromptOptions {\n const providerBackend =\n input.providerOptions?.backend &&\n typeof input.providerOptions.backend === 'object' &&\n !Array.isArray(input.providerOptions.backend)\n ? (input.providerOptions.backend as NonNullable<PromptOptions['backend']>)\n : undefined\n const backend = {\n ...(providerBackend ?? {}),\n ...(input.interactions === undefined ? {} : { interactions: input.interactions }),\n }\n const runControlRef =\n input.controlRef === undefined\n ? undefined\n : AgentExactRunControlRefSchema.parse(input.controlRef)\n return {\n ...(input.sessionId === undefined ? {} : { sessionId: input.sessionId }),\n ...(input.model === undefined ? {} : { model: input.model }),\n ...(input.timeoutMs === undefined ? {} : { timeoutMs: input.timeoutMs }),\n ...(input.context === undefined ? {} : { context: input.context }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n ...(input.executionId === undefined ? {} : { executionId: input.executionId }),\n ...(input.lastEventId === undefined ? {} : { lastEventId: input.lastEventId }),\n ...(input.turnId === undefined ? {} : { turnId: input.turnId }),\n ...(input.detach === undefined ? {} : { detach: input.detach }),\n ...(runControlRef === undefined ? {} : { runControlRef }),\n ...(Object.keys(backend).length === 0 ? {} : { backend }),\n }\n}\n\n/** Read a text fallback from provider-specific conversation options. */\nexport function providerMessageText(\n providerOptions: Record<string, unknown> | undefined,\n): string | undefined {\n const messages = providerOptions?.messages\n if (!Array.isArray(messages)) return undefined\n for (let index = messages.length - 1; index >= 0; index -= 1) {\n const message = messages[index]\n if (!message || typeof message !== 'object' || Array.isArray(message)) continue\n if (!('role' in message) || message.role !== 'user') continue\n if (!('content' in message)) continue\n if (typeof message.content === 'string') return message.content\n }\n return undefined\n}\n\nfunction promptPartFromInputPart(part: InputPart): PromptInputPart {\n if (part.type === 'text' || part.type === 'image') return part\n if (part.content !== undefined || part.path !== undefined) {\n throw new Error(\n 'Sandbox file prompt parts require a URL; inline content and local paths are not representable',\n )\n }\n if (!part.filename || !part.url) {\n throw new Error('Sandbox file prompt parts require both filename and URL')\n }\n return {\n type: 'file',\n filename: part.filename,\n ...(part.mediaType === undefined ? {} : { mediaType: part.mediaType }),\n url: part.url,\n }\n}\n","import {\n type AgentExactRunControlRef,\n AgentExactRunControlRefSchema,\n type AgentRunCancellationAcknowledgement,\n AgentRunCancellationAcknowledgementSchema,\n type AgentRunCancellationRequest,\n AgentRunCancellationRequestSchema,\n agentRunCancellationAcknowledgementMatchesRequest,\n agentRunCancellationRequestDigest,\n canonicalCandidateDigest,\n type InteractionResponseCommand,\n type NativeContextBoundaryProof,\n type StreamEvent,\n} from '@tangle-network/agent-interface'\nimport type {\n AgentEnvironment,\n AgentEnvironmentEvent,\n AgentSession,\n AgentSessionStatus,\n AgentTurnResult,\n} from '@tangle-network/agent-interface/environment-provider'\n\nexport function exactSession(\n environment: AgentEnvironment,\n controlRef: AgentExactRunControlRef,\n): { session: AgentSession; controlRef: AgentExactRunControlRef } {\n if (environment.id !== controlRef.environmentId || environment.provider !== controlRef.provider) {\n throw new Error('provider reconstructed a different retained environment')\n }\n if (!environment.session || !controlRef.sessionId) {\n throw new Error('retained run control requires a provider session id')\n }\n const session = environment.session(controlRef.sessionId, { controlRef })\n if (session.id !== controlRef.sessionId) {\n throw new Error('provider reconstructed a different session')\n }\n if (session.controlRef === undefined) {\n throw new Error('provider session did not return its provider-owned run control reference')\n }\n const currentControlRef = AgentExactRunControlRefSchema.parse(session.controlRef)\n if (!sameControlCoordinates(currentControlRef, controlRef)) {\n throw new Error('provider session reconstructed a different retained session')\n }\n if (canonicalCandidateDigest(currentControlRef) !== canonicalCandidateDigest(controlRef)) {\n throw new Error('provider session did not retain the exact run control reference')\n }\n return { session, controlRef: currentControlRef }\n}\n\nexport function sameControlCoordinates(\n left: AgentExactRunControlRef,\n right: AgentExactRunControlRef,\n): boolean {\n return canonicalCandidateDigest(left) === canonicalCandidateDigest(right)\n}\n\nexport function freezeControlRef(controlRef: AgentExactRunControlRef): AgentExactRunControlRef {\n return Object.freeze({ ...AgentExactRunControlRefSchema.parse(controlRef) })\n}\n\nexport function copyControlRef(controlRef: AgentExactRunControlRef): AgentExactRunControlRef {\n return { ...controlRef }\n}\n\nexport function exactControlRef(\n candidate: unknown,\n expected: { provider: string; environmentId: string; sessionId: string },\n): AgentExactRunControlRef {\n if (!candidate) throw new Error('provider dispatch returned no durable run control reference')\n const controlRef = AgentExactRunControlRefSchema.parse(candidate)\n if (\n controlRef.provider !== expected.provider ||\n controlRef.environmentId !== expected.environmentId ||\n controlRef.sessionId !== expected.sessionId\n ) {\n throw new Error('provider dispatch returned control coordinates for another run')\n }\n return controlRef\n}\n\nexport function exactContinuedControlRef(\n candidate: AgentExactRunControlRef,\n initial: AgentExactRunControlRef,\n): AgentExactRunControlRef {\n const controlRef = AgentExactRunControlRefSchema.parse(candidate)\n if (\n controlRef.provider !== initial.provider ||\n controlRef.environmentId !== initial.environmentId ||\n controlRef.sessionId !== initial.sessionId\n ) {\n throw new Error('provider continuation advanced to another retained session')\n }\n if (controlRef.runId === initial.runId && controlRef.executionId === initial.executionId) {\n throw new Error('provider continuation did not return a new exact run execution')\n }\n return controlRef\n}\n\nexport function assertInteractionBinding(\n controlRef: AgentExactRunControlRef,\n command: InteractionResponseCommand,\n): void {\n // This digest identifies the interaction request, not the retained turn.\n // The provider validates it against its durable interaction record.\n if (\n command.binding.runId !== controlRef.runId ||\n command.binding.provider !== controlRef.provider ||\n command.binding.environmentId !== controlRef.environmentId ||\n command.binding.sessionId !== controlRef.sessionId ||\n command.binding.executionId !== controlRef.executionId\n ) {\n throw new Error('interaction response command does not target this retained run')\n }\n}\n\nexport function assertBoundaryBinding(\n controlRef: AgentExactRunControlRef,\n proof: NativeContextBoundaryProof,\n): void {\n if (\n proof.runId !== controlRef.runId ||\n proof.provider !== controlRef.provider ||\n proof.environmentId !== controlRef.environmentId ||\n proof.sessionId !== controlRef.sessionId ||\n proof.executionId !== controlRef.executionId ||\n proof.requestDigest !== controlRef.requestDigest\n ) {\n throw new Error('native context proof does not identify this retained run')\n }\n}\n\nexport function assertSequence(value: unknown, label: string): asserts value is number {\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) {\n throw new Error(`${label} must be a non-negative safe integer`)\n }\n}\n\nexport function assertResultBinding(\n controlRef: AgentExactRunControlRef,\n result: AgentTurnResult,\n): void {\n if (result.sessionId !== controlRef.sessionId) {\n throw new Error('provider returned a result for another retained session')\n }\n const metadata = result.metadata\n if (controlRef.executionId !== undefined && metadata?.executionId !== controlRef.executionId) {\n throw new Error('provider returned a result for another retained execution')\n }\n if (metadata?.runId !== controlRef.runId) {\n throw new Error('provider returned a result for another retained run')\n }\n if (metadata?.requestDigest !== controlRef.requestDigest) {\n throw new Error('provider returned a result for another retained request')\n }\n}\n\ninterface ExactCancelOptions {\n readonly signal?: AbortSignal\n}\n\nexport class RetainedRunProviderContractError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'RetainedRunProviderContractError'\n }\n}\n\nexport function cancellationRequest(\n controlRef: AgentExactRunControlRef,\n operationId: string,\n reason?: string,\n): AgentRunCancellationRequest {\n const material = {\n operationId,\n run: AgentExactRunControlRefSchema.parse(controlRef),\n ...(reason === undefined ? {} : { reason }),\n }\n return AgentRunCancellationRequestSchema.parse({\n ...material,\n requestDigest: agentRunCancellationRequestDigest(material),\n })\n}\n\nexport async function exactSessionCancel(\n session: AgentSession,\n request: AgentRunCancellationRequest,\n options: ExactCancelOptions,\n): Promise<AgentRunCancellationAcknowledgement> {\n if (!session.cancelRun) {\n throw new Error('provider session does not expose durable cancellation operations')\n }\n let acknowledgement: unknown\n try {\n acknowledgement = await awaitAbortable(\n Promise.resolve().then(() => session.cancelRun!(request, options)),\n options.signal,\n )\n } catch (error) {\n if (error instanceof RetainedRunProviderContractError) throw error\n throw error\n }\n let exactAcknowledgement: AgentRunCancellationAcknowledgement\n try {\n exactAcknowledgement = AgentRunCancellationAcknowledgementSchema.parse(acknowledgement)\n } catch {\n throw new RetainedRunProviderContractError(\n 'provider returned an invalid retained cancellation acknowledgement',\n )\n }\n if (!agentRunCancellationAcknowledgementMatchesRequest(request, exactAcknowledgement)) {\n throw new RetainedRunProviderContractError(\n 'provider returned a retained cancellation acknowledgement for another request',\n )\n }\n return exactAcknowledgement\n}\n\nexport function hasDurableCancel(session: AgentSession): boolean {\n return typeof session.cancelRun === 'function'\n}\n\nexport async function awaitAbortable<T>(\n work: PromiseLike<T>,\n signal: AbortSignal | undefined,\n): Promise<T> {\n if (signal === undefined) return await work\n if (signal.aborted) {\n void Promise.resolve(work).catch(() => undefined)\n throw abortError(signal.reason)\n }\n return await new Promise<T>((resolve, reject) => {\n let settled = false\n const cleanup = () => signal.removeEventListener('abort', onAbort)\n const onAbort = () => {\n queueMicrotask(() => {\n if (settled) return\n settled = true\n cleanup()\n reject(abortError(signal.reason))\n })\n }\n signal.addEventListener('abort', onAbort, { once: true })\n Promise.resolve(work).then(\n (value) => {\n if (settled) return\n settled = true\n cleanup()\n resolve(value)\n },\n (error) => {\n if (settled) return\n settled = true\n cleanup()\n reject(error)\n },\n )\n })\n}\n\nexport async function exactSessionResult(session: AgentSession): Promise<AgentTurnResult> {\n return session.result()\n}\n\nexport function assertEventBinding(\n source: AgentEnvironmentEvent,\n controlRef: AgentExactRunControlRef,\n): void {\n const transport = isRecord(source) ? source : undefined\n const payload = isRecord(source.data) ? source.data : undefined\n const providerEvent = isRecord(source.providerEvent) ? source.providerEvent : undefined\n const bindings = [\n { value: transport, checkSessionId: true },\n {\n value: payload,\n // The canonical session.updated payload identifies the harness-native chat.\n // It is event content, not the retained provider session coordinate.\n checkSessionId: source.type !== 'session.updated',\n },\n { value: providerEvent, checkSessionId: true },\n ]\n for (const { value, checkSessionId } of bindings) {\n if (value === undefined) continue\n if (value.runId !== undefined && value.runId !== controlRef.runId) {\n throw new Error('provider returned an event for another retained run')\n }\n if (value.executionId !== undefined && value.executionId !== controlRef.executionId) {\n throw new Error('provider returned an event for another retained execution')\n }\n if (\n checkSessionId &&\n value.sessionId !== undefined &&\n value.sessionId !== controlRef.sessionId\n ) {\n throw new Error('provider returned an event for another retained session')\n }\n }\n}\n\n/** Validate the nested coordinates carried by a canonical interaction request. */\nexport function assertCanonicalEventBinding(\n controlRef: AgentExactRunControlRef,\n event: StreamEvent,\n): void {\n if (event.type !== 'interaction') return\n const binding = event.request.binding\n if (\n binding.runId !== controlRef.runId ||\n binding.provider !== controlRef.provider ||\n binding.environmentId !== controlRef.environmentId ||\n binding.sessionId !== controlRef.sessionId ||\n binding.executionId !== controlRef.executionId ||\n binding.interactionId !== event.request.id\n ) {\n throw new Error('provider returned an interaction for another retained execution')\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport function assertStableText(value: string, label: string): void {\n if (value.length === 0 || value.trim() !== value) {\n throw new Error(`${label} must be non-empty and have no outer whitespace`)\n }\n}\n\nexport function abortError(reason: unknown): Error {\n const error = new Error(\n reason instanceof Error ? reason.message : reason === undefined ? 'aborted' : String(reason),\n )\n error.name = 'AbortError'\n return error\n}\n\nexport function assertWaitDuration(value: number, label: string): void {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new Error(`${label} must be a non-negative safe integer`)\n }\n}\n\n/**\n * Whether a session can still change state.\n *\n * Exhaustive over `AgentSessionStatus` by construction: the map below is `satisfies\n * Record<AgentSessionStatus, boolean>`, so a member added upstream fails to compile here instead of\n * being silently classified as non-terminal. Written as a boolean chain, `stopped` was missing —\n * and a `status({ waitMs })` call on an already-stopped session then polled every 25 ms for the\n * whole wait before returning the answer it already had at the first snapshot.\n *\n * `unknown` is deliberately NOT terminal: it says the provider could not tell us, which is the one\n * state where continuing to poll is the point. That differs from\n * `sandboxSessionStatusFromAgentSessionStatus`, which projects `unknown` to `failed` because a run\n * RESULT must never claim success without proof — a different question about the same word.\n */\nconst sessionStatusIsTerminal = {\n pending: false,\n provisioning: false,\n running: false,\n unknown: false,\n stopped: true,\n completed: true,\n cancelled: true,\n failed: true,\n expired: true,\n} satisfies Record<AgentSessionStatus, boolean>\n\nexport function isTerminalSessionStatus(status: AgentSessionStatus | null): boolean {\n return status !== null && sessionStatusIsTerminal[status]\n}\n\nexport function delay(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) return Promise.reject(abortError(signal.reason))\n return new Promise((resolveDelay, rejectDelay) => {\n const timer = setTimeout(finish, ms)\n function finish() {\n signal?.removeEventListener('abort', onAbort)\n resolveDelay()\n }\n function onAbort() {\n clearTimeout(timer)\n signal?.removeEventListener('abort', onAbort)\n rejectDelay(abortError(signal?.reason))\n }\n signal?.addEventListener('abort', onAbort, { once: true })\n })\n}\n","import { randomUUID } from 'node:crypto'\nimport {\n agentProfileSchema,\n canonicalAgentProfileDigest,\n canonicalCandidateDigest,\n type Sha256Digest,\n} from '@tangle-network/agent-interface'\nimport { ValidationError } from '../../errors'\nimport { detachedSnapshot } from './snapshot'\nimport type {\n ExecutionBindingReceipt,\n Executor,\n ExecutorExecutionBinding,\n ExecutorMaterialization,\n ProfileMaterializationReceipt,\n ProviderModelAttemptEvidence,\n ProviderModelExecutionEvidence,\n Runtime,\n UnknownMaterializationReason,\n} from './types'\n\ntype RuntimeOwnedExecutorMaterialization =\n | {\n readonly kind: 'known'\n readonly declaration: ExecutorMaterialization\n readonly binding?: ExecutorExecutionBinding\n }\n | {\n /** A Runtime-owned external executor whose exact launch is known, but whose remote\n * materializer has not yet returned its terminal acknowledgement. This private state lets\n * Runtime validate the planned authority before execution without presenting it as proof\n * that the remote process actually used that plan. */\n readonly kind: 'pending'\n readonly runtime: Runtime\n readonly declaration: ExecutorMaterialization\n readonly binding: ExecutorExecutionBinding\n }\n | { readonly kind: 'deferred'; readonly runtime: Runtime }\n\ninterface RuntimeOwnedExecutorMaterializationRef {\n current: RuntimeOwnedExecutorMaterialization\n}\n\nconst runtimeOwnedExecutorMaterializations = new WeakMap<\n object,\n RuntimeOwnedExecutorMaterializationRef\n>()\nconst runtimeOwnedScopeOwners = new WeakMap<object, Runtime>()\nconst runtimeOwnedExecutorProviderEvidenceState = new WeakMap<\n object,\n {\n readonly attempts: Array<{\n readonly observations: string[]\n identityConflict?: boolean\n providerDispatch?: 'not_started'\n }>\n }\n>()\nconst runtimeOwnedDriveHarnessProviderEvidenceState = new WeakMap<\n object,\n ProviderModelExecutionEvidence\n>()\n\ninterface KnownReceiptInput {\n readonly authoredProfileDigest: Sha256Digest\n readonly runtime: Runtime\n readonly declaration: ExecutorMaterialization\n}\n\ninterface UnknownReceiptInput {\n readonly authoredProfileDigest?: Sha256Digest\n readonly runtime: Runtime\n readonly reason: UnknownMaterializationReason\n}\n\nconst declarationKeys = new Set([\n 'effectiveProfile',\n 'backend',\n 'model',\n 'execution',\n 'materializer',\n 'plan',\n 'platformAttachments',\n])\n\n/**\n * Bind a declaration to a runtime-owned executor without putting an attestable method on the\n * public Executor interface. This module is not a package export: arbitrary caller executors stay\n * unknown even if they add a lookalike `materialization()` property.\n */\nexport function attestRuntimeOwnedExecutor<Out>(\n executor: Executor<Out>,\n declaration: ExecutorMaterialization,\n binding?: ExecutorExecutionBinding,\n): Executor<Out> {\n runtimeOwnedExecutorMaterializations.set(executor as object, {\n current: Object.freeze({\n kind: 'known',\n declaration: detachedSnapshot(declaration, 'runtime-owned executor materialization'),\n ...(binding === undefined\n ? {}\n : {\n binding: detachedSnapshot(binding, 'runtime-owned executor execution binding'),\n }),\n }),\n })\n ensureProviderEvidenceState(executor)\n return executor\n}\n\n/** Brand an external Runtime executor whose exact remote materialization is provable only after\n * its terminal protocol acknowledgement. The declaration is a planned authority check, never a\n * known receipt; callers must finalize this same object after validating the acknowledgement. */\nexport function attestRuntimeOwnedPendingExecutor<Out>(\n executor: Executor<Out>,\n runtime: Runtime,\n declaration: ExecutorMaterialization,\n binding: ExecutorExecutionBinding,\n): Executor<Out> {\n runtimeOwnedExecutorMaterializations.set(executor as object, {\n current: Object.freeze({\n kind: 'pending',\n runtime,\n declaration: detachedSnapshot(declaration, 'pending executor materialization'),\n binding: detachedSnapshot(binding, 'pending executor execution binding'),\n }),\n })\n return executor\n}\n\n/** Replace a private pending brand with terminally acknowledged evidence. A caller-owned executor\n * cannot enter this path because only this module can create the pending WeakMap entry. */\nexport function finalizeRuntimeOwnedPendingExecutor<Out>(\n executor: Executor<Out>,\n declaration: ExecutorMaterialization,\n binding: ExecutorExecutionBinding,\n): Executor<Out> {\n const ref = runtimeOwnedExecutorMaterializations.get(executor as object)\n if (ref?.current.kind !== 'pending' || ref.current.runtime !== executor.runtime) {\n throw new ValidationError(\n 'executor materialization: terminal acknowledgement has no matching Runtime-owned pending executor',\n )\n }\n ref.current = Object.freeze({\n kind: 'known',\n declaration: detachedSnapshot(declaration, 'runtime-owned executor materialization'),\n binding: detachedSnapshot(binding, 'runtime-owned executor execution binding'),\n })\n return executor\n}\n\n/** Mark a runtime-owned orchestration executor whose exact leaf declaration is published through\n * its private nested Scope before the first backend inference. Arbitrary executors cannot opt in. */\nexport function attestRuntimeOwnedDeferredExecutor<Out>(\n executor: Executor<Out>,\n runtime: Runtime,\n): Executor<Out> {\n runtimeOwnedExecutorMaterializations.set(executor as object, {\n current: Object.freeze({ kind: 'deferred', runtime }),\n })\n return executor\n}\n\n/** Preserve the runtime-owned attestation when a trusted wrapper changes result semantics only. */\nexport function inheritRuntimeOwnedExecutorAttestation<In, Out>(\n source: Executor<In>,\n wrapper: Executor<Out>,\n): Executor<Out> {\n const ref = runtimeOwnedExecutorMaterializations.get(source as object)\n if (ref !== undefined) {\n runtimeOwnedExecutorMaterializations.set(wrapper as object, ref)\n }\n const providerState = ensureProviderEvidenceState(source)\n runtimeOwnedExecutorProviderEvidenceState.set(wrapper as object, providerState)\n return wrapper\n}\n\nfunction ensureProviderEvidenceState<Out>(executor: Executor<Out>): {\n readonly attempts: Array<{\n readonly observations: string[]\n identityConflict?: boolean\n providerDispatch?: 'not_started'\n }>\n} {\n const existing = runtimeOwnedExecutorProviderEvidenceState.get(executor as object)\n if (existing !== undefined) return existing\n const state = { attempts: [] }\n runtimeOwnedExecutorProviderEvidenceState.set(executor as object, state)\n return state\n}\n\n/** Read a declaration only when Runtime itself branded this exact executor object. */\nexport function runtimeOwnedExecutorMaterialization<Out>(\n executor: Executor<Out>,\n): ExecutorMaterialization | undefined {\n const attestation = runtimeOwnedExecutorMaterializations.get(executor as object)?.current\n return attestation?.kind === 'known' ? attestation.declaration : undefined\n}\n\n/** Read one attempt binding only from the private brand on this exact executor object. */\nexport function runtimeOwnedExecutorExecutionBinding<Out>(\n executor: Executor<Out>,\n): ExecutorExecutionBinding | undefined {\n const attestation = runtimeOwnedExecutorMaterializations.get(executor as object)?.current\n return attestation?.kind === 'known' ? attestation.binding : undefined\n}\n\n/** Read a planned external declaration only for Runtime's private pending brand. This is useful for\n * pre-execution authority checks, but must never be turned into a known durable receipt. */\nexport function runtimeOwnedPendingExecutorMaterialization<Out>(executor: Executor<Out>):\n | {\n readonly runtime: Runtime\n readonly declaration: ExecutorMaterialization\n readonly binding: ExecutorExecutionBinding\n }\n | undefined {\n const attestation = runtimeOwnedExecutorMaterializations.get(executor as object)?.current\n return attestation?.kind === 'pending'\n ? {\n runtime: attestation.runtime,\n declaration: attestation.declaration,\n binding: attestation.binding,\n }\n : undefined\n}\n\n/** Read the expected leaf runtime only for a privately branded deferred orchestration executor. */\nexport function runtimeOwnedDeferredExecutorRuntime<Out>(\n executor: Executor<Out>,\n): Runtime | undefined {\n const attestation = runtimeOwnedExecutorMaterializations.get(executor as object)?.current\n return attestation?.kind === 'deferred' ? attestation.runtime : undefined\n}\n\n/** Propagate trust from a built-in driver adapter to the Agent and recursive executor it owns. */\nexport function attestRuntimeOwnedScopeOwner<T extends object>(owner: T, runtime: Runtime): T {\n runtimeOwnedScopeOwners.set(owner, runtime)\n return owner\n}\n\n/** Return a built-in scope owner's expected concrete leaf runtime; caller-owned functions/Agents\n * deliberately have no entry even if they add lookalike fields. */\nexport function runtimeOwnedScopeOwnerRuntime(owner: object): Runtime | undefined {\n return runtimeOwnedScopeOwners.get(owner)\n}\n\n/** Mark one provider inference attempt on a Runtime-owned executor. */\nexport function recordRuntimeOwnedProviderAttemptStart<Out>(executor: Executor<Out>): void {\n const state = ensureProviderEvidenceState(executor)\n state.attempts.push({ observations: [] })\n}\n\n/** Mark the current attempt as rejected before provider dispatch.\n *\n * The caller may use this only after consuming the Router-owned\n * `provider_dispatch: \"not_started\"` fact. Any other error stays an empty,\n * unknown attempt and must not be upgraded here.\n */\nexport function recordRuntimeOwnedProviderDispatchNotStarted<Out>(executor: Executor<Out>): void {\n const state = ensureProviderEvidenceState(executor)\n const attempt = state.attempts.at(-1)\n if (attempt === undefined) {\n throw new ValidationError('provider dispatch rejection arrived before an attempt started')\n }\n if (attempt.observations.length > 0 || attempt.identityConflict === true) {\n throw new ValidationError(\n 'provider dispatch rejection arrived after provider identity evidence was observed',\n )\n }\n attempt.providerDispatch = 'not_started'\n}\n\n/** Record a trusted served model on the current provider attempt. */\nexport function recordRuntimeOwnedProviderModel<Out>(executor: Executor<Out>, model: string): void {\n const state = runtimeOwnedExecutorProviderEvidenceState.get(executor as object)\n const attempt = state?.attempts.at(-1)\n if (attempt === undefined) {\n throw new ValidationError('provider model observation arrived before an attempt started')\n }\n if (attempt.observations.at(-1) !== model) attempt.observations.push(model)\n}\n\n/** Convert process-local provider observations into a frozen, replayable evidence value. */\nexport function runtimeOwnedExecutorProviderEvidence<Out>(\n executor: Executor<Out>,\n): ProviderModelExecutionEvidence | undefined {\n const state = runtimeOwnedExecutorProviderEvidenceState.get(executor as object)\n if (state === undefined || state.attempts.length === 0) return undefined\n const attempts: ReadonlyArray<ProviderModelAttemptEvidence> = Object.freeze(\n state.attempts.map((attempt) =>\n Object.freeze({\n observations: Object.freeze([...attempt.observations]),\n ...(attempt.identityConflict ? { identityConflict: true } : {}),\n ...(attempt.providerDispatch === 'not_started'\n ? { providerDispatch: 'not_started' as const }\n : {}),\n }),\n ),\n )\n const models = Object.freeze([...new Set(attempts.flatMap((attempt) => attempt.observations))])\n const missing = attempts.some(\n (attempt) => attempt.observations.length === 0 && attempt.providerDispatch !== 'not_started',\n )\n const conflict = attempts.some((attempt) => attempt.identityConflict === true)\n const served = attempts.some((attempt) => attempt.observations.length > 0)\n return Object.freeze(\n missing || conflict || !served\n ? {\n status: 'unknown' as const,\n attempts,\n models,\n reason: conflict\n ? ('provider-model-conflict' as const)\n : ('provider-model-missing' as const),\n }\n : { status: 'known' as const, attempts, models },\n )\n}\n\n/** Mark the current provider attempt unusable after conflicting served identity metadata. */\nexport function recordRuntimeOwnedProviderIdentityConflict<Out>(executor: Executor<Out>): void {\n const state = ensureProviderEvidenceState(executor)\n const attempt = state.attempts.at(-1)\n if (attempt === undefined) {\n throw new ValidationError('provider identity conflict arrived before an attempt started')\n }\n attempt.identityConflict = true\n}\n\n/** Attach one executor's provider evidence to a Runtime-owned root drive for final projection. */\nexport function recordRuntimeOwnedDriveHarnessProviderEvidence(\n owner: object,\n evidence: ProviderModelExecutionEvidence | undefined,\n): void {\n if (evidence === undefined) return\n const prior = runtimeOwnedDriveHarnessProviderEvidenceState.get(owner)\n if (prior === undefined) {\n runtimeOwnedDriveHarnessProviderEvidenceState.set(owner, evidence)\n return\n }\n const attempts = Object.freeze([...prior.attempts, ...evidence.attempts])\n const models = Object.freeze([...new Set([...prior.models, ...evidence.models])])\n const missing = attempts.some(\n (attempt) => attempt.observations.length === 0 && attempt.providerDispatch !== 'not_started',\n )\n const conflict = attempts.some((attempt) => attempt.identityConflict === true)\n const served = attempts.some((attempt) => attempt.observations.length > 0)\n runtimeOwnedDriveHarnessProviderEvidenceState.set(\n owner,\n Object.freeze(\n missing || conflict || !served\n ? {\n status: 'unknown' as const,\n attempts,\n models,\n reason: conflict\n ? ('provider-model-conflict' as const)\n : ('provider-model-missing' as const),\n }\n : { status: 'known' as const, attempts, models },\n ),\n )\n}\n\n/** Read provider evidence recorded by a Runtime-owned root drive. */\nexport function runtimeOwnedDriveHarnessProviderEvidence(\n owner: object,\n): ProviderModelExecutionEvidence | undefined {\n return runtimeOwnedDriveHarnessProviderEvidenceState.get(owner)\n}\n\n/** Build one kernel-owned known receipt from a data-only executor declaration. */\nexport function knownMaterializationReceipt(\n input: KnownReceiptInput,\n): ProfileMaterializationReceipt {\n const declaration = detachedSnapshot(input.declaration, 'executor materialization')\n assertExactDeclaration(declaration)\n const effectiveProfile = agentProfileSchema.safeParse(declaration.effectiveProfile)\n if (!effectiveProfile.success) {\n throw new ValidationError('executor materialization: effectiveProfile must be an AgentProfile')\n }\n assertNonEmpty(declaration.backend, 'backend')\n assertNonEmpty(declaration.materializer, 'materializer')\n assertNonEmpty(declaration.execution?.kind, 'execution.kind')\n assertNonEmpty(declaration.execution?.id, 'execution.id')\n assertModel(declaration.model)\n\n let effectiveProfileDigest: Sha256Digest\n let materializationPlanDigest: Sha256Digest\n let platformAttachmentsDigest: Sha256Digest | undefined\n try {\n effectiveProfileDigest = canonicalAgentProfileDigest(effectiveProfile.data)\n materializationPlanDigest = canonicalCandidateDigest(jsonWireSnapshot(declaration.plan))\n platformAttachmentsDigest =\n declaration.platformAttachments === undefined\n ? undefined\n : canonicalCandidateDigest(jsonWireSnapshot(declaration.platformAttachments))\n } catch (error) {\n throw new ValidationError(\n 'executor materialization: profile, plan, and attachments must be finite RFC 8785 JSON',\n { cause: error },\n )\n }\n\n return Object.freeze({\n status: 'known' as const,\n authoredProfileDigest: input.authoredProfileDigest,\n effectiveProfileDigest,\n materializationPlanDigest,\n ...(platformAttachmentsDigest === undefined ? {} : { platformAttachmentsDigest }),\n runtime: input.runtime,\n backend: declaration.backend,\n model: declaration.model,\n execution: declaration.execution,\n materializer: declaration.materializer,\n })\n}\n\n/** Build an explicit unknown receipt without fabricating any executor-owned identity. */\nexport function unknownMaterializationReceipt(\n input: UnknownReceiptInput,\n): ProfileMaterializationReceipt {\n return Object.freeze({\n status: 'unknown' as const,\n ...(input.authoredProfileDigest === undefined\n ? {}\n : { authoredProfileDigest: input.authoredProfileDigest }),\n runtime: input.runtime,\n reason: input.reason,\n })\n}\n\n/** Mint a process-unique attempt id before executor construction. */\nexport function newExecutionAttemptId(nodeId: string): string {\n return `${nodeId}:attempt:${randomUUID()}`\n}\n\n/** Build the immutable safe receipt for a full, transient execution binding. */\nexport function knownExecutionBindingReceipt(\n materialization: ProfileMaterializationReceipt,\n bindingInput: ExecutorExecutionBinding,\n): ExecutionBindingReceipt {\n const binding = detachedSnapshot(bindingInput, 'executor execution binding')\n assertNonEmpty(binding.attemptId, 'binding.attemptId')\n assertSafeDescriptor(binding.descriptor)\n let materializationReceiptDigest: Sha256Digest\n let bindingDigest: Sha256Digest\n try {\n materializationReceiptDigest = canonicalCandidateDigest(materialization)\n // Bind the exact JSON document a backend receives. Optional AgentProfile fields are represented\n // as `undefined` in memory but omitted by JSON transport; normalize that one distinction while\n // rejecting every non-finite/non-data value instead of silently coercing it.\n bindingDigest = canonicalCandidateDigest(jsonWireSnapshot(binding.binding))\n } catch (error) {\n throw new ValidationError('executor binding must be finite RFC 8785 JSON', { cause: error })\n }\n return Object.freeze({\n status: 'known' as const,\n attemptId: binding.attemptId,\n materializationReceiptDigest,\n bindingDigest,\n descriptor: binding.descriptor,\n })\n}\n\n/** Preserve an attempt boundary even when its caller-owned transport cannot be attested. */\nexport function unknownExecutionBindingReceipt(\n materialization: ProfileMaterializationReceipt,\n attemptId: string,\n reason: UnknownMaterializationReason,\n): ExecutionBindingReceipt {\n assertNonEmpty(attemptId, 'binding.attemptId')\n return Object.freeze({\n status: 'unknown' as const,\n attemptId,\n materializationReceiptDigest: canonicalCandidateDigest(materialization),\n reason,\n })\n}\n\n/** Derive an authored-profile digest without turning non-canonical input into a fake identity. */\nexport function authoredProfileDigest(profile: unknown): Sha256Digest | undefined {\n try {\n return canonicalAgentProfileDigest(agentProfileSchema.parse(profile))\n } catch {\n return undefined\n }\n}\n\nfunction assertExactDeclaration(value: ExecutorMaterialization): void {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new ValidationError('executor materialization: declaration must be an object')\n }\n const unknown = Object.keys(value).filter((key) => !declarationKeys.has(key))\n if (unknown.length > 0) {\n throw new ValidationError(\n `executor materialization: unknown declaration fields: ${unknown.sort().join(', ')}`,\n )\n }\n if (!Object.hasOwn(value, 'plan')) {\n throw new ValidationError('executor materialization: plan is required')\n }\n}\n\nfunction assertModel(model: ExecutorMaterialization['model']): void {\n if (typeof model !== 'object' || model === null || Array.isArray(model)) {\n throw new ValidationError('executor materialization: model must be a known/unknown identity')\n }\n const keys = Object.keys(model).sort()\n if (model.status === 'known') {\n if (keys.join(',') !== 'id,status') {\n throw new ValidationError('executor materialization: known model accepts only status and id')\n }\n assertNonEmpty(model.id, 'model.id')\n return\n }\n if (model.status === 'unknown') {\n if (keys.join(',') !== 'reason,status') {\n throw new ValidationError(\n 'executor materialization: unknown model accepts only status and reason',\n )\n }\n assertNonEmpty(model.reason, 'model.reason')\n return\n }\n throw new ValidationError('executor materialization: model.status must be known or unknown')\n}\n\nfunction assertNonEmpty(value: unknown, field: string): asserts value is string {\n if (typeof value !== 'string' || value.trim().length === 0) {\n throw new ValidationError(`executor materialization: ${field} must be a non-empty string`)\n }\n}\n\nfunction assertSafeDescriptor(descriptor: ExecutorExecutionBinding['descriptor']): void {\n if (typeof descriptor !== 'object' || descriptor === null || Array.isArray(descriptor)) {\n throw new ValidationError('executor binding: descriptor must be an object')\n }\n for (const [key, value] of Object.entries(descriptor)) {\n if (/(url|uri|token|key|secret|bearer|credential|authorization)/i.test(key)) {\n throw new ValidationError(`executor binding: unsafe descriptor key ${JSON.stringify(key)}`)\n }\n if (\n value !== null &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n ) {\n throw new ValidationError(\n `executor binding: descriptor ${JSON.stringify(key)} must be scalar`,\n )\n }\n if (typeof value === 'string' && (value.includes('://') || value.includes('@'))) {\n throw new ValidationError(\n `executor binding: descriptor ${JSON.stringify(key)} contains transport or credential text`,\n )\n }\n }\n}\n\nfunction jsonWireSnapshot(value: unknown, path = '$'): unknown {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return value\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) {\n throw new ValidationError(`executor binding: ${path} must be finite`)\n }\n return value\n }\n if (Array.isArray(value)) {\n return value.map((item, index) => {\n if (item === undefined) {\n throw new ValidationError(`executor binding: ${path}[${index}] cannot be undefined`)\n }\n return jsonWireSnapshot(item, `${path}[${index}]`)\n })\n }\n if (typeof value !== 'object' || value === null) {\n throw new ValidationError(`executor binding: ${path} must be JSON data`)\n }\n const prototype = Object.getPrototypeOf(value)\n if (prototype !== Object.prototype && prototype !== null) {\n throw new ValidationError(`executor binding: ${path} must be a plain object`)\n }\n const out: Record<string, unknown> = {}\n for (const [key, item] of Object.entries(value as Record<string, unknown>)) {\n if (item === undefined) continue\n out[key] = jsonWireSnapshot(item, `${path}.${key}`)\n }\n return out\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAgB,eACd,OACA,SAOgB;CAgBhB,OAAO;EAdL,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;EAC7D,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;EAC1D,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;EAC1D,GAAI,MAAM,cAAc,KAAA,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M,IAAI,gBACR,gCAAgC,KAAK,UAAU,GAAG,EAAE,uCACtD;CAEJ;AACF;AAEA,SAAS,iBAAiB,OAAgB,OAAO,KAAc;CAC7D,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO;CACtF,IAAI,OAAO,UAAU,UAAU;EAC7B,IAAI,CAAC,OAAO,SAAS,KAAK,GACxB,MAAM,IAAI,gBAAgB,qBAAqB,KAAK,gBAAgB;EAEtE,OAAO;CACT;CACA,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,KAAK,MAAM,UAAU;EAChC,IAAI,SAAS,KAAA,GACX,MAAM,IAAI,gBAAgB,qBAAqB,KAAK,GAAG,MAAM,sBAAsB;EAErF,OAAO,iBAAiB,MAAM,GAAG,KAAK,GAAG,MAAM,EAAE;CACnD,CAAC;CAEH,IAAI,OAAO,UAAU,YAAY,UAAU,MACzC,MAAM,IAAI,gBAAgB,qBAAqB,KAAK,mBAAmB;CAEzE,MAAM,YAAY,OAAO,eAAe,KAAK;CAC7C,IAAI,cAAc,OAAO,aAAa,cAAc,MAClD,MAAM,IAAI,gBAAgB,qBAAqB,KAAK,wBAAwB;CAE9E,MAAM,MAA+B,CAAC;CACtC,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,KAAgC,GAAG;EAC1E,IAAI,SAAS,KAAA,GAAW;EACxB,IAAI,OAAO,iBAAiB,MAAM,GAAG,KAAK,GAAG,KAAK;CACpD;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"materialization-Ct3I4wu3.js","names":[],"sources":["../src/runtime/turn-input.ts","../src/runtime/retained-run-binding.ts","../src/runtime/supervise/materialization.ts"],"sourcesContent":["import {\n AgentExactRunControlRefSchema,\n type ContextTransferRequest,\n type InputPart,\n} from '@tangle-network/agent-interface'\nimport type { AgentTurnInput } from '@tangle-network/agent-interface/environment-provider'\nimport type { PromptInputPart, PromptOptions } from '@tangle-network/sandbox'\n\n/**\n * Copy only fields that describe a new provider turn.\n *\n * Session, replay, continuation, and transfer coordinates are runtime-owned\n * and are injected by the caller that owns that lifecycle. Keeping this copy\n * explicit also makes JavaScript callers subject to the same boundary.\n */\nexport function freshTurnInput(\n input: AgentTurnInput,\n runtime: {\n readonly turnId: string\n readonly detach: true\n readonly sessionId?: string\n readonly executionId?: string\n readonly contextTransfer?: ContextTransferRequest\n },\n): AgentTurnInput {\n const fresh: AgentTurnInput = {\n ...(input.prompt === undefined ? {} : { prompt: input.prompt }),\n ...(input.parts === undefined ? {} : { parts: input.parts }),\n ...(input.model === undefined ? {} : { model: input.model }),\n ...(input.timeoutMs === undefined ? {} : { timeoutMs: input.timeoutMs }),\n ...(input.context === undefined ? {} : { context: input.context }),\n ...(input.interactions === undefined ? {} : { interactions: input.interactions }),\n ...(input.providerOptions === undefined ? {} : { providerOptions: input.providerOptions }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n turnId: runtime.turnId,\n detach: runtime.detach,\n ...(runtime.sessionId === undefined ? {} : { sessionId: runtime.sessionId }),\n ...(runtime.executionId === undefined ? {} : { executionId: runtime.executionId }),\n ...(runtime.contextTransfer === undefined ? {} : { contextTransfer: runtime.contextTransfer }),\n }\n return fresh\n}\n\n/** Project canonical turn parts onto the Sandbox prompt vocabulary once. */\nexport function promptFromAgentTurnInput(input: AgentTurnInput): string | PromptInputPart[] {\n if (input.parts !== undefined) return input.parts.map(promptPartFromInputPart)\n return input.prompt ?? providerMessageText(input.providerOptions) ?? ''\n}\n\n/** Project canonical turn controls onto the Sandbox prompt options once. */\nexport function promptOptionsFromAgentTurnInput(input: AgentTurnInput): PromptOptions {\n const providerBackend =\n input.providerOptions?.backend &&\n typeof input.providerOptions.backend === 'object' &&\n !Array.isArray(input.providerOptions.backend)\n ? (input.providerOptions.backend as NonNullable<PromptOptions['backend']>)\n : undefined\n const backend = {\n ...(providerBackend ?? {}),\n ...(input.interactions === undefined ? {} : { interactions: input.interactions }),\n }\n const runControlRef =\n input.controlRef === undefined\n ? undefined\n : AgentExactRunControlRefSchema.parse(input.controlRef)\n return {\n ...(input.sessionId === undefined ? {} : { sessionId: input.sessionId }),\n ...(input.model === undefined ? {} : { model: input.model }),\n ...(input.timeoutMs === undefined ? {} : { timeoutMs: input.timeoutMs }),\n ...(input.context === undefined ? {} : { context: input.context }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n ...(input.executionId === undefined ? {} : { executionId: input.executionId }),\n ...(input.lastEventId === undefined ? {} : { lastEventId: input.lastEventId }),\n ...(input.turnId === undefined ? {} : { turnId: input.turnId }),\n ...(input.detach === undefined ? {} : { detach: input.detach }),\n ...(runControlRef === undefined ? {} : { runControlRef }),\n ...(Object.keys(backend).length === 0 ? {} : { backend }),\n }\n}\n\n/** Read a text fallback from provider-specific conversation options. */\nexport function providerMessageText(\n providerOptions: Record<string, unknown> | undefined,\n): string | undefined {\n const messages = providerOptions?.messages\n if (!Array.isArray(messages)) return undefined\n for (let index = messages.length - 1; index >= 0; index -= 1) {\n const message = messages[index]\n if (!message || typeof message !== 'object' || Array.isArray(message)) continue\n if (!('role' in message) || message.role !== 'user') continue\n if (!('content' in message)) continue\n if (typeof message.content === 'string') return message.content\n }\n return undefined\n}\n\nfunction promptPartFromInputPart(part: InputPart): PromptInputPart {\n if (part.type === 'text' || part.type === 'image') return part\n if (part.content !== undefined || part.path !== undefined) {\n throw new Error(\n 'Sandbox file prompt parts require a URL; inline content and local paths are not representable',\n )\n }\n if (!part.filename || !part.url) {\n throw new Error('Sandbox file prompt parts require both filename and URL')\n }\n return {\n type: 'file',\n filename: part.filename,\n ...(part.mediaType === undefined ? {} : { mediaType: part.mediaType }),\n url: part.url,\n }\n}\n","import {\n type AgentExactRunControlRef,\n AgentExactRunControlRefSchema,\n type AgentRunCancellationAcknowledgement,\n AgentRunCancellationAcknowledgementSchema,\n type AgentRunCancellationRequest,\n AgentRunCancellationRequestSchema,\n agentRunCancellationAcknowledgementMatchesRequest,\n agentRunCancellationRequestDigest,\n canonicalCandidateDigest,\n type InteractionResponseCommand,\n type NativeContextBoundaryProof,\n type StreamEvent,\n} from '@tangle-network/agent-interface'\nimport type {\n AgentEnvironment,\n AgentEnvironmentEvent,\n AgentSession,\n AgentSessionStatus,\n AgentTurnResult,\n} from '@tangle-network/agent-interface/environment-provider'\n\nexport function exactSession(\n environment: AgentEnvironment,\n controlRef: AgentExactRunControlRef,\n): { session: AgentSession; controlRef: AgentExactRunControlRef } {\n if (environment.id !== controlRef.environmentId || environment.provider !== controlRef.provider) {\n throw new Error('provider reconstructed a different retained environment')\n }\n if (!environment.session || !controlRef.sessionId) {\n throw new Error('retained run control requires a provider session id')\n }\n const session = environment.session(controlRef.sessionId, { controlRef })\n if (session.id !== controlRef.sessionId) {\n throw new Error('provider reconstructed a different session')\n }\n if (session.controlRef === undefined) {\n throw new Error('provider session did not return its provider-owned run control reference')\n }\n const currentControlRef = AgentExactRunControlRefSchema.parse(session.controlRef)\n if (!sameControlCoordinates(currentControlRef, controlRef)) {\n throw new Error('provider session reconstructed a different retained session')\n }\n if (canonicalCandidateDigest(currentControlRef) !== canonicalCandidateDigest(controlRef)) {\n throw new Error('provider session did not retain the exact run control reference')\n }\n return { session, controlRef: currentControlRef }\n}\n\nexport function sameControlCoordinates(\n left: AgentExactRunControlRef,\n right: AgentExactRunControlRef,\n): boolean {\n return canonicalCandidateDigest(left) === canonicalCandidateDigest(right)\n}\n\nexport function freezeControlRef(controlRef: AgentExactRunControlRef): AgentExactRunControlRef {\n return Object.freeze({ ...AgentExactRunControlRefSchema.parse(controlRef) })\n}\n\nexport function copyControlRef(controlRef: AgentExactRunControlRef): AgentExactRunControlRef {\n return { ...controlRef }\n}\n\nexport function exactControlRef(\n candidate: unknown,\n expected: { provider: string; environmentId: string; sessionId: string },\n): AgentExactRunControlRef {\n if (!candidate) throw new Error('provider dispatch returned no durable run control reference')\n const controlRef = AgentExactRunControlRefSchema.parse(candidate)\n if (\n controlRef.provider !== expected.provider ||\n controlRef.environmentId !== expected.environmentId ||\n controlRef.sessionId !== expected.sessionId\n ) {\n throw new Error('provider dispatch returned control coordinates for another run')\n }\n return controlRef\n}\n\nexport function exactContinuedControlRef(\n candidate: AgentExactRunControlRef,\n initial: AgentExactRunControlRef,\n): AgentExactRunControlRef {\n const controlRef = AgentExactRunControlRefSchema.parse(candidate)\n if (\n controlRef.provider !== initial.provider ||\n controlRef.environmentId !== initial.environmentId ||\n controlRef.sessionId !== initial.sessionId\n ) {\n throw new Error('provider continuation advanced to another retained session')\n }\n if (controlRef.runId === initial.runId && controlRef.executionId === initial.executionId) {\n throw new Error('provider continuation did not return a new exact run execution')\n }\n return controlRef\n}\n\nexport function assertInteractionBinding(\n controlRef: AgentExactRunControlRef,\n command: InteractionResponseCommand,\n): void {\n // This digest identifies the interaction request, not the retained turn.\n // The provider validates it against its durable interaction record.\n if (\n command.binding.runId !== controlRef.runId ||\n command.binding.provider !== controlRef.provider ||\n command.binding.environmentId !== controlRef.environmentId ||\n command.binding.sessionId !== controlRef.sessionId ||\n command.binding.executionId !== controlRef.executionId\n ) {\n throw new Error('interaction response command does not target this retained run')\n }\n}\n\nexport function assertBoundaryBinding(\n controlRef: AgentExactRunControlRef,\n proof: NativeContextBoundaryProof,\n): void {\n if (\n proof.runId !== controlRef.runId ||\n proof.provider !== controlRef.provider ||\n proof.environmentId !== controlRef.environmentId ||\n proof.sessionId !== controlRef.sessionId ||\n proof.executionId !== controlRef.executionId ||\n proof.requestDigest !== controlRef.requestDigest\n ) {\n throw new Error('native context proof does not identify this retained run')\n }\n}\n\nexport function assertSequence(value: unknown, label: string): asserts value is number {\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) {\n throw new Error(`${label} must be a non-negative safe integer`)\n }\n}\n\nexport function assertResultBinding(\n controlRef: AgentExactRunControlRef,\n result: AgentTurnResult,\n): void {\n if (result.sessionId !== controlRef.sessionId) {\n throw new Error('provider returned a result for another retained session')\n }\n const metadata = result.metadata\n if (controlRef.executionId !== undefined && metadata?.executionId !== controlRef.executionId) {\n throw new Error('provider returned a result for another retained execution')\n }\n if (metadata?.runId !== controlRef.runId) {\n throw new Error('provider returned a result for another retained run')\n }\n if (metadata?.requestDigest !== controlRef.requestDigest) {\n throw new Error('provider returned a result for another retained request')\n }\n}\n\ninterface ExactCancelOptions {\n readonly signal?: AbortSignal\n}\n\nexport class RetainedRunProviderContractError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'RetainedRunProviderContractError'\n }\n}\n\nexport function cancellationRequest(\n controlRef: AgentExactRunControlRef,\n operationId: string,\n reason?: string,\n): AgentRunCancellationRequest {\n const material = {\n operationId,\n run: AgentExactRunControlRefSchema.parse(controlRef),\n ...(reason === undefined ? {} : { reason }),\n }\n return AgentRunCancellationRequestSchema.parse({\n ...material,\n requestDigest: agentRunCancellationRequestDigest(material),\n })\n}\n\nexport async function exactSessionCancel(\n session: AgentSession,\n request: AgentRunCancellationRequest,\n options: ExactCancelOptions,\n): Promise<AgentRunCancellationAcknowledgement> {\n if (!session.cancelRun) {\n throw new Error('provider session does not expose durable cancellation operations')\n }\n let acknowledgement: unknown\n try {\n acknowledgement = await awaitAbortable(\n Promise.resolve().then(() => session.cancelRun!(request, options)),\n options.signal,\n )\n } catch (error) {\n if (error instanceof RetainedRunProviderContractError) throw error\n throw error\n }\n let exactAcknowledgement: AgentRunCancellationAcknowledgement\n try {\n exactAcknowledgement = AgentRunCancellationAcknowledgementSchema.parse(acknowledgement)\n } catch {\n throw new RetainedRunProviderContractError(\n 'provider returned an invalid retained cancellation acknowledgement',\n )\n }\n if (!agentRunCancellationAcknowledgementMatchesRequest(request, exactAcknowledgement)) {\n throw new RetainedRunProviderContractError(\n 'provider returned a retained cancellation acknowledgement for another request',\n )\n }\n return exactAcknowledgement\n}\n\nexport function hasDurableCancel(session: AgentSession): boolean {\n return typeof session.cancelRun === 'function'\n}\n\nexport async function awaitAbortable<T>(\n work: PromiseLike<T>,\n signal: AbortSignal | undefined,\n): Promise<T> {\n if (signal === undefined) return await work\n if (signal.aborted) {\n void Promise.resolve(work).catch(() => undefined)\n throw abortError(signal.reason)\n }\n return await new Promise<T>((resolve, reject) => {\n let settled = false\n const cleanup = () => signal.removeEventListener('abort', onAbort)\n const onAbort = () => {\n queueMicrotask(() => {\n if (settled) return\n settled = true\n cleanup()\n reject(abortError(signal.reason))\n })\n }\n signal.addEventListener('abort', onAbort, { once: true })\n Promise.resolve(work).then(\n (value) => {\n if (settled) return\n settled = true\n cleanup()\n resolve(value)\n },\n (error) => {\n if (settled) return\n settled = true\n cleanup()\n reject(error)\n },\n )\n })\n}\n\nexport async function exactSessionResult(session: AgentSession): Promise<AgentTurnResult> {\n return session.result()\n}\n\nexport function assertEventBinding(\n source: AgentEnvironmentEvent,\n controlRef: AgentExactRunControlRef,\n): void {\n const transport = isRecord(source) ? source : undefined\n const payload = isRecord(source.data) ? source.data : undefined\n const providerEvent = isRecord(source.providerEvent) ? source.providerEvent : undefined\n const bindings = [\n { value: transport, checkSessionId: true },\n {\n value: payload,\n // The canonical session.updated payload identifies the harness-native chat.\n // It is event content, not the retained provider session coordinate.\n checkSessionId: source.type !== 'session.updated',\n },\n { value: providerEvent, checkSessionId: true },\n ]\n for (const { value, checkSessionId } of bindings) {\n if (value === undefined) continue\n if (value.runId !== undefined && value.runId !== controlRef.runId) {\n throw new Error('provider returned an event for another retained run')\n }\n if (value.executionId !== undefined && value.executionId !== controlRef.executionId) {\n throw new Error('provider returned an event for another retained execution')\n }\n if (\n checkSessionId &&\n value.sessionId !== undefined &&\n value.sessionId !== controlRef.sessionId\n ) {\n throw new Error('provider returned an event for another retained session')\n }\n }\n}\n\n/** Validate the nested coordinates carried by a canonical interaction request. */\nexport function assertCanonicalEventBinding(\n controlRef: AgentExactRunControlRef,\n event: StreamEvent,\n): void {\n if (event.type !== 'interaction') return\n const binding = event.request.binding\n if (\n binding.runId !== controlRef.runId ||\n binding.provider !== controlRef.provider ||\n binding.environmentId !== controlRef.environmentId ||\n binding.sessionId !== controlRef.sessionId ||\n binding.executionId !== controlRef.executionId ||\n binding.interactionId !== event.request.id\n ) {\n throw new Error('provider returned an interaction for another retained execution')\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport function assertStableText(value: string, label: string): void {\n if (value.length === 0 || value.trim() !== value) {\n throw new Error(`${label} must be non-empty and have no outer whitespace`)\n }\n}\n\nexport function abortError(reason: unknown): Error {\n const error = new Error(\n reason instanceof Error ? reason.message : reason === undefined ? 'aborted' : String(reason),\n )\n error.name = 'AbortError'\n return error\n}\n\nexport function assertWaitDuration(value: number, label: string): void {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new Error(`${label} must be a non-negative safe integer`)\n }\n}\n\n/**\n * Whether a session can still change state.\n *\n * Exhaustive over `AgentSessionStatus` by construction: the map below is `satisfies\n * Record<AgentSessionStatus, boolean>`, so a member added upstream fails to compile here instead of\n * being silently classified as non-terminal. Written as a boolean chain, `stopped` was missing —\n * and a `status({ waitMs })` call on an already-stopped session then polled every 25 ms for the\n * whole wait before returning the answer it already had at the first snapshot.\n *\n * `unknown` is deliberately NOT terminal: it says the provider could not tell us, which is the one\n * state where continuing to poll is the point. That differs from\n * `sandboxSessionStatusFromAgentSessionStatus`, which projects `unknown` to `failed` because a run\n * RESULT must never claim success without proof — a different question about the same word.\n */\nconst sessionStatusIsTerminal = {\n pending: false,\n provisioning: false,\n running: false,\n unknown: false,\n stopped: true,\n completed: true,\n cancelled: true,\n failed: true,\n expired: true,\n} satisfies Record<AgentSessionStatus, boolean>\n\nexport function isTerminalSessionStatus(status: AgentSessionStatus | null): boolean {\n return status !== null && sessionStatusIsTerminal[status]\n}\n\nexport function delay(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) return Promise.reject(abortError(signal.reason))\n return new Promise((resolveDelay, rejectDelay) => {\n const timer = setTimeout(finish, ms)\n function finish() {\n signal?.removeEventListener('abort', onAbort)\n resolveDelay()\n }\n function onAbort() {\n clearTimeout(timer)\n signal?.removeEventListener('abort', onAbort)\n rejectDelay(abortError(signal?.reason))\n }\n signal?.addEventListener('abort', onAbort, { once: true })\n })\n}\n","import { randomUUID } from 'node:crypto'\nimport {\n agentProfileSchema,\n canonicalAgentProfileDigest,\n canonicalCandidateDigest,\n type Sha256Digest,\n} from '@tangle-network/agent-interface'\nimport { ValidationError } from '../../errors'\nimport { detachedSnapshot } from './snapshot'\nimport type {\n ExecutionBindingReceipt,\n Executor,\n ExecutorExecutionBinding,\n ExecutorMaterialization,\n ProfileMaterializationReceipt,\n ProviderModelAttemptEvidence,\n ProviderModelExecutionEvidence,\n Runtime,\n UnknownMaterializationReason,\n} from './types'\n\ntype RuntimeOwnedExecutorMaterialization =\n | {\n readonly kind: 'known'\n readonly declaration: ExecutorMaterialization\n readonly binding?: ExecutorExecutionBinding\n }\n | {\n /** A Runtime-owned external executor whose exact launch is known, but whose remote\n * materializer has not yet returned its terminal acknowledgement. This private state lets\n * Runtime validate the planned authority before execution without presenting it as proof\n * that the remote process actually used that plan. */\n readonly kind: 'pending'\n readonly runtime: Runtime\n readonly declaration: ExecutorMaterialization\n readonly binding: ExecutorExecutionBinding\n }\n | { readonly kind: 'deferred'; readonly runtime: Runtime }\n\ninterface RuntimeOwnedExecutorMaterializationRef {\n current: RuntimeOwnedExecutorMaterialization\n}\n\nconst runtimeOwnedExecutorMaterializations = new WeakMap<\n object,\n RuntimeOwnedExecutorMaterializationRef\n>()\nconst runtimeOwnedScopeOwners = new WeakMap<object, Runtime>()\nconst runtimeOwnedExecutorProviderEvidenceState = new WeakMap<\n object,\n {\n readonly attempts: Array<{\n readonly observations: string[]\n identityConflict?: boolean\n providerDispatch?: 'not_started'\n }>\n }\n>()\nconst runtimeOwnedDriveHarnessProviderEvidenceState = new WeakMap<\n object,\n ProviderModelExecutionEvidence\n>()\n\ninterface KnownReceiptInput {\n readonly authoredProfileDigest: Sha256Digest\n readonly runtime: Runtime\n readonly declaration: ExecutorMaterialization\n}\n\ninterface UnknownReceiptInput {\n readonly authoredProfileDigest?: Sha256Digest\n readonly runtime: Runtime\n readonly reason: UnknownMaterializationReason\n}\n\nconst declarationKeys = new Set([\n 'effectiveProfile',\n 'backend',\n 'model',\n 'execution',\n 'materializer',\n 'plan',\n 'platformAttachments',\n])\n\n/**\n * Bind a declaration to a runtime-owned executor without putting an attestable method on the\n * public Executor interface. This module is not a package export: arbitrary caller executors stay\n * unknown even if they add a lookalike `materialization()` property.\n */\nexport function attestRuntimeOwnedExecutor<Out>(\n executor: Executor<Out>,\n declaration: ExecutorMaterialization,\n binding?: ExecutorExecutionBinding,\n): Executor<Out> {\n runtimeOwnedExecutorMaterializations.set(executor as object, {\n current: Object.freeze({\n kind: 'known',\n declaration: detachedSnapshot(declaration, 'runtime-owned executor materialization'),\n ...(binding === undefined\n ? {}\n : {\n binding: detachedSnapshot(binding, 'runtime-owned executor execution binding'),\n }),\n }),\n })\n ensureProviderEvidenceState(executor)\n return executor\n}\n\n/** Brand an external Runtime executor whose exact remote materialization is provable only after\n * its terminal protocol acknowledgement. The declaration is a planned authority check, never a\n * known receipt; callers must finalize this same object after validating the acknowledgement. */\nexport function attestRuntimeOwnedPendingExecutor<Out>(\n executor: Executor<Out>,\n runtime: Runtime,\n declaration: ExecutorMaterialization,\n binding: ExecutorExecutionBinding,\n): Executor<Out> {\n runtimeOwnedExecutorMaterializations.set(executor as object, {\n current: Object.freeze({\n kind: 'pending',\n runtime,\n declaration: detachedSnapshot(declaration, 'pending executor materialization'),\n binding: detachedSnapshot(binding, 'pending executor execution binding'),\n }),\n })\n return executor\n}\n\n/** Replace a private pending brand with terminally acknowledged evidence. A caller-owned executor\n * cannot enter this path because only this module can create the pending WeakMap entry. */\nexport function finalizeRuntimeOwnedPendingExecutor<Out>(\n executor: Executor<Out>,\n declaration: ExecutorMaterialization,\n binding: ExecutorExecutionBinding,\n): Executor<Out> {\n const ref = runtimeOwnedExecutorMaterializations.get(executor as object)\n if (ref?.current.kind !== 'pending' || ref.current.runtime !== executor.runtime) {\n throw new ValidationError(\n 'executor materialization: terminal acknowledgement has no matching Runtime-owned pending executor',\n )\n }\n ref.current = Object.freeze({\n kind: 'known',\n declaration: detachedSnapshot(declaration, 'runtime-owned executor materialization'),\n binding: detachedSnapshot(binding, 'runtime-owned executor execution binding'),\n })\n return executor\n}\n\n/** Mark a runtime-owned orchestration executor whose exact leaf declaration is published through\n * its private nested Scope before the first backend inference. Arbitrary executors cannot opt in. */\nexport function attestRuntimeOwnedDeferredExecutor<Out>(\n executor: Executor<Out>,\n runtime: Runtime,\n): Executor<Out> {\n runtimeOwnedExecutorMaterializations.set(executor as object, {\n current: Object.freeze({ kind: 'deferred', runtime }),\n })\n return executor\n}\n\n/** Preserve the runtime-owned attestation when a trusted wrapper changes result semantics only. */\nexport function inheritRuntimeOwnedExecutorAttestation<In, Out>(\n source: Executor<In>,\n wrapper: Executor<Out>,\n): Executor<Out> {\n const ref = runtimeOwnedExecutorMaterializations.get(source as object)\n if (ref !== undefined) {\n runtimeOwnedExecutorMaterializations.set(wrapper as object, ref)\n }\n const providerState = ensureProviderEvidenceState(source)\n runtimeOwnedExecutorProviderEvidenceState.set(wrapper as object, providerState)\n return wrapper\n}\n\nfunction ensureProviderEvidenceState<Out>(executor: Executor<Out>): {\n readonly attempts: Array<{\n readonly observations: string[]\n identityConflict?: boolean\n providerDispatch?: 'not_started'\n }>\n} {\n const existing = runtimeOwnedExecutorProviderEvidenceState.get(executor as object)\n if (existing !== undefined) return existing\n const state = { attempts: [] }\n runtimeOwnedExecutorProviderEvidenceState.set(executor as object, state)\n return state\n}\n\n/** Read a declaration only when Runtime itself branded this exact executor object. */\nexport function runtimeOwnedExecutorMaterialization<Out>(\n executor: Executor<Out>,\n): ExecutorMaterialization | undefined {\n const attestation = runtimeOwnedExecutorMaterializations.get(executor as object)?.current\n return attestation?.kind === 'known' ? attestation.declaration : undefined\n}\n\n/** Read one attempt binding only from the private brand on this exact executor object. */\nexport function runtimeOwnedExecutorExecutionBinding<Out>(\n executor: Executor<Out>,\n): ExecutorExecutionBinding | undefined {\n const attestation = runtimeOwnedExecutorMaterializations.get(executor as object)?.current\n return attestation?.kind === 'known' ? attestation.binding : undefined\n}\n\n/** Read a planned external declaration only for Runtime's private pending brand. This is useful for\n * pre-execution authority checks, but must never be turned into a known durable receipt. */\nexport function runtimeOwnedPendingExecutorMaterialization<Out>(executor: Executor<Out>):\n | {\n readonly runtime: Runtime\n readonly declaration: ExecutorMaterialization\n readonly binding: ExecutorExecutionBinding\n }\n | undefined {\n const attestation = runtimeOwnedExecutorMaterializations.get(executor as object)?.current\n return attestation?.kind === 'pending'\n ? {\n runtime: attestation.runtime,\n declaration: attestation.declaration,\n binding: attestation.binding,\n }\n : undefined\n}\n\n/** Read the expected leaf runtime only for a privately branded deferred orchestration executor. */\nexport function runtimeOwnedDeferredExecutorRuntime<Out>(\n executor: Executor<Out>,\n): Runtime | undefined {\n const attestation = runtimeOwnedExecutorMaterializations.get(executor as object)?.current\n return attestation?.kind === 'deferred' ? attestation.runtime : undefined\n}\n\n/** Propagate trust from a built-in driver adapter to the Agent and recursive executor it owns. */\nexport function attestRuntimeOwnedScopeOwner<T extends object>(owner: T, runtime: Runtime): T {\n runtimeOwnedScopeOwners.set(owner, runtime)\n return owner\n}\n\n/** Return a built-in scope owner's expected concrete leaf runtime; caller-owned functions/Agents\n * deliberately have no entry even if they add lookalike fields. */\nexport function runtimeOwnedScopeOwnerRuntime(owner: object): Runtime | undefined {\n return runtimeOwnedScopeOwners.get(owner)\n}\n\n/** Mark one provider inference attempt on a Runtime-owned executor. */\nexport function recordRuntimeOwnedProviderAttemptStart<Out>(executor: Executor<Out>): void {\n const state = ensureProviderEvidenceState(executor)\n state.attempts.push({ observations: [] })\n}\n\n/** Mark the current attempt as rejected before provider dispatch.\n *\n * The caller may use this only after consuming the Router-owned\n * `provider_dispatch: \"not_started\"` fact. Any other error stays an empty,\n * unknown attempt and must not be upgraded here.\n */\nexport function recordRuntimeOwnedProviderDispatchNotStarted<Out>(executor: Executor<Out>): void {\n const state = ensureProviderEvidenceState(executor)\n const attempt = state.attempts.at(-1)\n if (attempt === undefined) {\n throw new ValidationError('provider dispatch rejection arrived before an attempt started')\n }\n if (attempt.observations.length > 0 || attempt.identityConflict === true) {\n throw new ValidationError(\n 'provider dispatch rejection arrived after provider identity evidence was observed',\n )\n }\n attempt.providerDispatch = 'not_started'\n}\n\n/** Record a trusted served model on the current provider attempt. */\nexport function recordRuntimeOwnedProviderModel<Out>(executor: Executor<Out>, model: string): void {\n const state = runtimeOwnedExecutorProviderEvidenceState.get(executor as object)\n const attempt = state?.attempts.at(-1)\n if (attempt === undefined) {\n throw new ValidationError('provider model observation arrived before an attempt started')\n }\n if (attempt.observations.at(-1) !== model) attempt.observations.push(model)\n}\n\n/** Convert process-local provider observations into a frozen, replayable evidence value. */\nexport function runtimeOwnedExecutorProviderEvidence<Out>(\n executor: Executor<Out>,\n): ProviderModelExecutionEvidence | undefined {\n const state = runtimeOwnedExecutorProviderEvidenceState.get(executor as object)\n if (state === undefined || state.attempts.length === 0) return undefined\n const attempts: ReadonlyArray<ProviderModelAttemptEvidence> = Object.freeze(\n state.attempts.map((attempt) =>\n Object.freeze({\n observations: Object.freeze([...attempt.observations]),\n ...(attempt.identityConflict ? { identityConflict: true } : {}),\n ...(attempt.providerDispatch === 'not_started'\n ? { providerDispatch: 'not_started' as const }\n : {}),\n }),\n ),\n )\n const models = Object.freeze([...new Set(attempts.flatMap((attempt) => attempt.observations))])\n const missing = attempts.some(\n (attempt) => attempt.observations.length === 0 && attempt.providerDispatch !== 'not_started',\n )\n const conflict = attempts.some((attempt) => attempt.identityConflict === true)\n const served = attempts.some((attempt) => attempt.observations.length > 0)\n return Object.freeze(\n missing || conflict || !served\n ? {\n status: 'unknown' as const,\n attempts,\n models,\n reason: conflict\n ? ('provider-model-conflict' as const)\n : ('provider-model-missing' as const),\n }\n : { status: 'known' as const, attempts, models },\n )\n}\n\n/** Mark the current provider attempt unusable after conflicting served identity metadata. */\nexport function recordRuntimeOwnedProviderIdentityConflict<Out>(executor: Executor<Out>): void {\n const state = ensureProviderEvidenceState(executor)\n const attempt = state.attempts.at(-1)\n if (attempt === undefined) {\n throw new ValidationError('provider identity conflict arrived before an attempt started')\n }\n attempt.identityConflict = true\n}\n\n/** Attach one executor's provider evidence to a Runtime-owned root drive for final projection. */\nexport function recordRuntimeOwnedDriveHarnessProviderEvidence(\n owner: object,\n evidence: ProviderModelExecutionEvidence | undefined,\n): void {\n if (evidence === undefined) return\n const prior = runtimeOwnedDriveHarnessProviderEvidenceState.get(owner)\n if (prior === undefined) {\n runtimeOwnedDriveHarnessProviderEvidenceState.set(owner, evidence)\n return\n }\n const attempts = Object.freeze([...prior.attempts, ...evidence.attempts])\n const models = Object.freeze([...new Set([...prior.models, ...evidence.models])])\n const missing = attempts.some(\n (attempt) => attempt.observations.length === 0 && attempt.providerDispatch !== 'not_started',\n )\n const conflict = attempts.some((attempt) => attempt.identityConflict === true)\n const served = attempts.some((attempt) => attempt.observations.length > 0)\n runtimeOwnedDriveHarnessProviderEvidenceState.set(\n owner,\n Object.freeze(\n missing || conflict || !served\n ? {\n status: 'unknown' as const,\n attempts,\n models,\n reason: conflict\n ? ('provider-model-conflict' as const)\n : ('provider-model-missing' as const),\n }\n : { status: 'known' as const, attempts, models },\n ),\n )\n}\n\n/** Read provider evidence recorded by a Runtime-owned root drive. */\nexport function runtimeOwnedDriveHarnessProviderEvidence(\n owner: object,\n): ProviderModelExecutionEvidence | undefined {\n return runtimeOwnedDriveHarnessProviderEvidenceState.get(owner)\n}\n\n/** Build one kernel-owned known receipt from a data-only executor declaration. */\nexport function knownMaterializationReceipt(\n input: KnownReceiptInput,\n): ProfileMaterializationReceipt {\n const declaration = detachedSnapshot(input.declaration, 'executor materialization')\n assertExactDeclaration(declaration)\n const effectiveProfile = agentProfileSchema.safeParse(declaration.effectiveProfile)\n if (!effectiveProfile.success) {\n throw new ValidationError('executor materialization: effectiveProfile must be an AgentProfile')\n }\n assertNonEmpty(declaration.backend, 'backend')\n assertNonEmpty(declaration.materializer, 'materializer')\n assertNonEmpty(declaration.execution?.kind, 'execution.kind')\n assertNonEmpty(declaration.execution?.id, 'execution.id')\n assertModel(declaration.model)\n\n let effectiveProfileDigest: Sha256Digest\n let materializationPlanDigest: Sha256Digest\n let platformAttachmentsDigest: Sha256Digest | undefined\n try {\n effectiveProfileDigest = canonicalAgentProfileDigest(effectiveProfile.data)\n materializationPlanDigest = canonicalCandidateDigest(jsonWireSnapshot(declaration.plan))\n platformAttachmentsDigest =\n declaration.platformAttachments === undefined\n ? undefined\n : canonicalCandidateDigest(jsonWireSnapshot(declaration.platformAttachments))\n } catch (error) {\n throw new ValidationError(\n 'executor materialization: profile, plan, and attachments must be finite RFC 8785 JSON',\n { cause: error },\n )\n }\n\n return Object.freeze({\n status: 'known' as const,\n authoredProfileDigest: input.authoredProfileDigest,\n effectiveProfileDigest,\n materializationPlanDigest,\n ...(platformAttachmentsDigest === undefined ? {} : { platformAttachmentsDigest }),\n runtime: input.runtime,\n backend: declaration.backend,\n model: declaration.model,\n execution: declaration.execution,\n materializer: declaration.materializer,\n })\n}\n\n/** Build an explicit unknown receipt without fabricating any executor-owned identity. */\nexport function unknownMaterializationReceipt(\n input: UnknownReceiptInput,\n): ProfileMaterializationReceipt {\n return Object.freeze({\n status: 'unknown' as const,\n ...(input.authoredProfileDigest === undefined\n ? {}\n : { authoredProfileDigest: input.authoredProfileDigest }),\n runtime: input.runtime,\n reason: input.reason,\n })\n}\n\n/** Mint a process-unique attempt id before executor construction. */\nexport function newExecutionAttemptId(nodeId: string): string {\n return `${nodeId}:attempt:${randomUUID()}`\n}\n\n/** Build the immutable safe receipt for a full, transient execution binding. */\nexport function knownExecutionBindingReceipt(\n materialization: ProfileMaterializationReceipt,\n bindingInput: ExecutorExecutionBinding,\n): ExecutionBindingReceipt {\n const binding = detachedSnapshot(bindingInput, 'executor execution binding')\n assertNonEmpty(binding.attemptId, 'binding.attemptId')\n assertSafeDescriptor(binding.descriptor)\n let materializationReceiptDigest: Sha256Digest\n let bindingDigest: Sha256Digest\n try {\n materializationReceiptDigest = canonicalCandidateDigest(materialization)\n // Bind the exact JSON document a backend receives. Optional AgentProfile fields are represented\n // as `undefined` in memory but omitted by JSON transport; normalize that one distinction while\n // rejecting every non-finite/non-data value instead of silently coercing it.\n bindingDigest = canonicalCandidateDigest(jsonWireSnapshot(binding.binding))\n } catch (error) {\n throw new ValidationError('executor binding must be finite RFC 8785 JSON', { cause: error })\n }\n return Object.freeze({\n status: 'known' as const,\n attemptId: binding.attemptId,\n materializationReceiptDigest,\n bindingDigest,\n descriptor: binding.descriptor,\n })\n}\n\n/** Preserve an attempt boundary even when its caller-owned transport cannot be attested. */\nexport function unknownExecutionBindingReceipt(\n materialization: ProfileMaterializationReceipt,\n attemptId: string,\n reason: UnknownMaterializationReason,\n): ExecutionBindingReceipt {\n assertNonEmpty(attemptId, 'binding.attemptId')\n return Object.freeze({\n status: 'unknown' as const,\n attemptId,\n materializationReceiptDigest: canonicalCandidateDigest(materialization),\n reason,\n })\n}\n\n/** Derive an authored-profile digest without turning non-canonical input into a fake identity. */\nexport function authoredProfileDigest(profile: unknown): Sha256Digest | undefined {\n try {\n return canonicalAgentProfileDigest(agentProfileSchema.parse(profile))\n } catch {\n return undefined\n }\n}\n\nfunction assertExactDeclaration(value: ExecutorMaterialization): void {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new ValidationError('executor materialization: declaration must be an object')\n }\n const unknown = Object.keys(value).filter((key) => !declarationKeys.has(key))\n if (unknown.length > 0) {\n throw new ValidationError(\n `executor materialization: unknown declaration fields: ${unknown.sort().join(', ')}`,\n )\n }\n if (!Object.hasOwn(value, 'plan')) {\n throw new ValidationError('executor materialization: plan is required')\n }\n}\n\nfunction assertModel(model: ExecutorMaterialization['model']): void {\n if (typeof model !== 'object' || model === null || Array.isArray(model)) {\n throw new ValidationError('executor materialization: model must be a known/unknown identity')\n }\n const keys = Object.keys(model).sort()\n if (model.status === 'known') {\n if (keys.join(',') !== 'id,status') {\n throw new ValidationError('executor materialization: known model accepts only status and id')\n }\n assertNonEmpty(model.id, 'model.id')\n return\n }\n if (model.status === 'unknown') {\n if (keys.join(',') !== 'reason,status') {\n throw new ValidationError(\n 'executor materialization: unknown model accepts only status and reason',\n )\n }\n assertNonEmpty(model.reason, 'model.reason')\n return\n }\n throw new ValidationError('executor materialization: model.status must be known or unknown')\n}\n\nfunction assertNonEmpty(value: unknown, field: string): asserts value is string {\n if (typeof value !== 'string' || value.trim().length === 0) {\n throw new ValidationError(`executor materialization: ${field} must be a non-empty string`)\n }\n}\n\nfunction assertSafeDescriptor(descriptor: ExecutorExecutionBinding['descriptor']): void {\n if (typeof descriptor !== 'object' || descriptor === null || Array.isArray(descriptor)) {\n throw new ValidationError('executor binding: descriptor must be an object')\n }\n for (const [key, value] of Object.entries(descriptor)) {\n if (/(url|uri|token|key|secret|bearer|credential|authorization)/i.test(key)) {\n throw new ValidationError(`executor binding: unsafe descriptor key ${JSON.stringify(key)}`)\n }\n if (\n value !== null &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n ) {\n throw new ValidationError(\n `executor binding: descriptor ${JSON.stringify(key)} must be scalar`,\n )\n }\n if (typeof value === 'string' && (value.includes('://') || value.includes('@'))) {\n throw new ValidationError(\n `executor binding: descriptor ${JSON.stringify(key)} contains transport or credential text`,\n )\n }\n }\n}\n\nfunction jsonWireSnapshot(value: unknown, path = '$'): unknown {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return value\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) {\n throw new ValidationError(`executor binding: ${path} must be finite`)\n }\n return value\n }\n if (Array.isArray(value)) {\n return value.map((item, index) => {\n if (item === undefined) {\n throw new ValidationError(`executor binding: ${path}[${index}] cannot be undefined`)\n }\n return jsonWireSnapshot(item, `${path}[${index}]`)\n })\n }\n if (typeof value !== 'object' || value === null) {\n throw new ValidationError(`executor binding: ${path} must be JSON data`)\n }\n const prototype = Object.getPrototypeOf(value)\n if (prototype !== Object.prototype && prototype !== null) {\n throw new ValidationError(`executor binding: ${path} must be a plain object`)\n }\n const out: Record<string, unknown> = {}\n for (const [key, item] of Object.entries(value as Record<string, unknown>)) {\n if (item === undefined) continue\n out[key] = jsonWireSnapshot(item, `${path}.${key}`)\n }\n return out\n}\n\n/**\n * The provider-identity evidence for ONE attempt, from the served model alone. `unknown` with a\n * `provider-model-missing` reason when the attempt produced no model, because an attempt that\n * cannot name what served it is not evidence that nothing did.\n */\nexport function providerAttemptEvidence(model: string | undefined): ProviderModelExecutionEvidence {\n const attempts = Object.freeze([\n Object.freeze({ observations: Object.freeze(model === undefined ? [] : [model]) }),\n ])\n const models = Object.freeze(model === undefined ? [] : [model])\n return Object.freeze(\n model === undefined\n ? { status: 'unknown' as const, attempts, models, reason: 'provider-model-missing' as const }\n : { status: 'known' as const, attempts, models },\n )\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAgB,eACd,OACA,SAOgB;CAgBhB,OAAO;EAdL,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;EAC7D,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;EAC1D,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;EAC1D,GAAI,MAAM,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,MAAM,UAAU;EACtE,GAAI,MAAM,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,MAAM,QAAQ;EAChE,GAAI,MAAM,iBAAiB,KAAA,IAAY,CAAC,IAAI,EAAE,cAAc,MAAM,aAAa;EAC/E,GAAI,MAAM,oBAAoB,KAAA,IAAY,CAAC,IAAI,EAAE,iBAAiB,MAAM,gBAAgB;EACxF,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ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,KAAK,GACrB,OAAO,MAAM,KAAK,MAAM,UAAU;EAChC,IAAI,SAAS,KAAA,GACX,MAAM,IAAI,gBAAgB,qBAAqB,KAAK,GAAG,MAAM,sBAAsB;EAErF,OAAO,iBAAiB,MAAM,GAAG,KAAK,GAAG,MAAM,EAAE;CACnD,CAAC;CAEH,IAAI,OAAO,UAAU,YAAY,UAAU,MACzC,MAAM,IAAI,gBAAgB,qBAAqB,KAAK,mBAAmB;CAEzE,MAAM,YAAY,OAAO,eAAe,KAAK;CAC7C,IAAI,cAAc,OAAO,aAAa,cAAc,MAClD,MAAM,IAAI,gBAAgB,qBAAqB,KAAK,wBAAwB;CAE9E,MAAM,MAA+B,CAAC;CACtC,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,KAAgC,GAAG;EAC1E,IAAI,SAAS,KAAA,GAAW;EACxB,IAAI,OAAO,iBAAiB,MAAM,GAAG,KAAK,GAAG,KAAK;CACpD;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,wBAAwB,OAA2D;CACjG,MAAM,WAAW,OAAO,OAAO,CAC7B,OAAO,OAAO,EAAE,cAAc,OAAO,OAAO,UAAU,KAAA,IAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CACnF,CAAC;CACD,MAAM,SAAS,OAAO,OAAO,UAAU,KAAA,IAAY,CAAC,IAAI,CAAC,KAAK,CAAC;CAC/D,OAAO,OAAO,OACZ,UAAU,KAAA,IACN;EAAE,QAAQ;EAAoB;EAAU;EAAQ,QAAQ;CAAkC,IAC1F;EAAE,QAAQ;EAAkB;EAAU;CAAO,CACnD;AACF"}
package/dist/mcp/bin.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { i as ConfigError } from "../errors-CDZ8XsVj.js";
3
- import { Dt as readTraceContextFromEnv } from "../supervisor-CMZsJ7Wn.js";
4
- import { C as createMcpServer, Z as DelegationTaskQueue, st as FileDelegationStore } from "../supervise-k_8VOASb.js";
5
- import { a as supervisorInstructions } from "../authoring-CcVhJ1lP.js";
3
+ import { Dt as readTraceContextFromEnv } from "../supervisor-BmXD0WCJ.js";
4
+ import { C as createMcpServer, Q as DelegationTaskQueue, ct as FileDelegationStore } from "../supervise-BVE0XAJa.js";
5
+ import { a as supervisorInstructions } from "../authoring-C4uCoDmO.js";
6
6
  //#region src/mcp/delegate-supervisor-provisioning.ts
7
7
  function trimmed(value) {
8
8
  const v = value?.trim();
@@ -1,7 +1,7 @@
1
1
  import { E as SandboxClient, h as LoopSandboxPlacement } from "../types-DeX8ibLc.js";
2
- import { $d as DelegationTraceCollector, $l as MakeWorkerAgent, $u as DetachedTurn, Ad as DelegateUiAuditResult, Au as validateDelegateArgs, Bd as DelegationStatus, Bl as AuthorizeDownMessage, Bu as DetachedWinnerSelection, Cd as DelegateFeedbackArgs, Cu as DELEGATE_INPUT_SCHEMA, Dd as DelegateResearchResult, Du as DelegateHandlerOptions, Ed as DelegateResearchConfig, Eu as DelegateError, Fd as DelegationHistoryEntry, Fu as CoderDelegate, Gd as ResearchOutputShape, Gu as settleDetachedCoderTurn, Hd as DelegationStatusResult, Hl as ContinuationInstruction, Hu as UiAuditorDelegate, Id as DelegationHistoryResult, Il as AnalystFindingEvent, Iu as CoderReview, Jd as UiAuditorDelegationOutput, Jl as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, Ju as FleetWorkspaceExecutorOptions, Kd as ResearchSource, Kl as CoordinationTools, Ku as DelegationExecutor, Ld as DelegationProfile, Lu as CoderReviewer, Md as DelegationError, Mu as FeedbackStore, Nd as DelegationFeedbackSnapshot, Nu as InMemoryFeedbackStore, Od as DelegateUiAuditArgs, Ou as DelegateResult, Pd as DelegationHistoryArgs, Pu as eventToSnapshot, Qd as DelegationTraceCaps, Ql as DownMessageEvent, Qu as DetachedSessionRefParts, Rd as DelegationProgress, Rl as AnalystRegistry, Ru as DelegateRunCtx, Sd as DelegateCodeResult, Su as DELEGATE_DESCRIPTION, Td as DelegateResearchArgs, Tu as DelegateArgs, Ud as FeedbackRating, Uu as coderTaskFromArgs, Vd as DelegationStatusArgs, Vl as AuthorizedDownMessage, Vu as SettleDetachedCoderTurnOptions, Wd as FeedbackRefersTo, Wl as CoordinationEvent, Wu as detachedSessionDelegate, Xd as DELEGATION_TRACE_MAX_BYTES, Xl as DownMessageDeliveryAttempt, Xu as createFleetWorkspaceExecutor, Yd as CappedDelegationTrace, Yl as DownMessageAuthorizationInput, Yu as SiblingSandboxExecutorOptions, Zd as DELEGATION_TRACE_MAX_SPANS, Zl as DownMessageDeliveryOutcome, Zu as createSiblingSandboxExecutor, _d as SubmitInput, ad as detachedTurnEvents, af as DelegationPersistenceError, au as QuestionRecord, bd as DelegateCodeArgs, bu as createInProcessTransport, cd as runDetachedTurn, cf as FileDelegationStore, dd as DelegationResumeContext, ed as DetachedTurnResumeDriverOptions, ef as DelegationTraceSpan, eu as Question, fd as DelegationResumeDriver, gd as DelegationTaskQueueOptions, gu as createCoordinationTools, hd as DelegationTaskQueue, id as createDetachedTurnResumeDriver, if as createDelegationTraceCollector, iu as QuestionPolicy, jd as DelegateUiAuditRoute, ju as FeedbackEvent, kd as DelegateUiAuditConfig, ku as createDelegateHandler, ld as DelegationArgs, lf as FileDelegationStoreOptions, md as DelegationRunContext, mu as WorkerWatchOptions, nd as DriveTurnTick, nf as capDelegationTrace, nu as QuestionLevel, od as formatDetachedSessionRef, of as DelegationStateCorruptError, ou as QuestionUrgency, pd as DelegationResumeTick, pu as WorkerSpawnContext, qd as UiAuditLensFilter, ql as CoordinationToolsOptions, qu as FleetHandle, rd as RunDetachedTurnOptions, rf as composeLoopTraceEmitters, ru as QuestionOption, sd as parseDetachedSessionRef, sf as DelegationStore, su as SettledWorker, td as DriveTurnCapableBox, tf as buildDelegationTraceSpans, tu as QuestionDecision, ud as DelegationRecord, uf as InMemoryDelegationStore, vd as SubmitOutput, vu as McpServer, wd as DelegateFeedbackResult, wf as CoderOutput, wu as DELEGATE_TOOL_NAME, xd as DelegateCodeConfig, xu as createMcpServer, yd as hashIdempotencyInput, yu as McpServerOptions, zd as DelegationResultPayload, zu as DetachedSessionDelegateOptions } from "../index-DLn9WI-f.js";
3
- import { _t as createPropagatingTraceEmitter, bt as traceContextToEnv, gt as TraceContext, vt as mergeTraceEnv, yt as readTraceContextFromEnv } from "../types-BPQhQRrC.js";
4
- import { $ as LocalHarnessResult, Bt as JsonRpcMessage, Ht as McpToolDescriptor, J as CodexExecutionPolicy, Q as LocalHarness, Ut as McpTransport, Vt as JsonRpcResponse, X as DEFAULT_LOCAL_HARNESS, Y as CodexTokenUsage, Z as LOCAL_HARNESSES, at as CreateWorktreeOptions, ct as GitRunner, dt as captureWorktreeDiff, et as RunLocalHarnessOptions, ft as createWorktree, it as runLocalHarness, lt as RemoveWorktreeOptions, nt as localHarnessExecutable, ot as DiffOptions, pt as removeWorktree, q as CodexExecutionEvidence, rt as parseCodexTokenUsage, st as DiffResult, tt as harnessSupportsReasoningEffort, ut as WorktreeHandle } from "../runtime-B-5dp5Iz.js";
2
+ import { $d as DELEGATION_TRACE_MAX_BYTES, $l as MakeWorkerAgent, $u as createSiblingSandboxExecutor, Ad as DelegateUiAuditArgs, Au as DelegateResult, Bd as DelegationProgress, Bl as AuthorizeDownMessage, Bu as DelegateRunCtx, Cd as DelegateCodeConfig, Cu as createMcpServer, Dd as DelegateResearchArgs, Df as CoderOutput, Du as DelegateArgs, Ed as DelegateFeedbackResult, Eu as DELEGATE_TOOL_NAME, Fd as DelegationFeedbackSnapshot, Fu as InMemoryFeedbackStore, Gd as FeedbackRating, Gu as coderTaskFromArgs, Hd as DelegationStatus, Hl as ContinuationInstruction, Hu as DetachedWinnerSelection, Id as DelegationHistoryArgs, Il as AnalystFindingEvent, Iu as eventToSnapshot, Jd as ResearchSource, Jl as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, Ju as DelegationExecutor, Kd as FeedbackRefersTo, Kl as CoordinationTools, Ku as detachedSessionDelegate, Ld as DelegationHistoryEntry, Lu as CoderDelegate, Md as DelegateUiAuditResult, Mu as validateDelegateArgs, Nd as DelegateUiAuditRoute, Nu as FeedbackEvent, Od as DelegateResearchConfig, Ou as DelegateError, Pd as DelegationError, Pu as FeedbackStore, Qd as CappedDelegationTrace, Ql as DownMessageEvent, Qu as createFleetWorkspaceExecutor, Rd as DelegationHistoryResult, Rl as AnalystRegistry, Ru as CoderReview, Sd as DelegateCodeArgs, Su as createInProcessTransport, Td as DelegateFeedbackArgs, Tu as DELEGATE_INPUT_SCHEMA, Ud as DelegationStatusArgs, Uu as SettleDetachedCoderTurnOptions, Vd as DelegationResultPayload, Vl as AuthorizedDownMessage, Vu as DetachedSessionDelegateOptions, Wd as DelegationStatusResult, Wl as CoordinationEvent, Wu as UiAuditorDelegate, Xd as UiAuditorDelegationOutput, Xl as DownMessageDeliveryAttempt, Xu as FleetWorkspaceExecutorOptions, Yd as UiAuditLensFilter, Yl as DownMessageAuthorizationInput, Yu as FleetHandle, Zd as delegationProfiles, Zl as DownMessageDeliveryOutcome, Zu as SiblingSandboxExecutorOptions, _d as DelegationTaskQueue, _u as createCoordinationTools, ad as RunDetachedTurnOptions, af as capDelegationTrace, au as QuestionPolicy, bd as SubmitOutput, bu as McpServer, cd as formatDetachedSessionRef, cf as DelegationPersistenceError, cu as SettledWorker, dd as DelegationArgs, df as FileDelegationStore, ed as DetachedSessionRefParts, ef as DELEGATION_TRACE_MAX_SPANS, eu as Question, fd as DelegationRecord, ff as FileDelegationStoreOptions, gd as DelegationRunContext, hd as DelegationResumeTick, hu as WorkerWatchOptions, id as DriveTurnTick, if as buildDelegationTraceSpans, iu as QuestionOption, jd as DelegateUiAuditConfig, ju as createDelegateHandler, kd as DelegateResearchResult, ku as DelegateHandlerOptions, ld as parseDetachedSessionRef, lf as DelegationStateCorruptError, md as DelegationResumeDriver, mu as WorkerSpawnContext, nd as DetachedTurnResumeDriverOptions, nf as DelegationTraceCollector, nu as QuestionEscalationTarget, od as createDetachedTurnResumeDriver, of as composeLoopTraceEmitters, ou as QuestionRecord, pd as DelegationResumeContext, pf as InMemoryDelegationStore, qd as ResearchOutputShape, ql as CoordinationToolsOptions, qu as settleDetachedCoderTurn, rd as DriveTurnCapableBox, rf as DelegationTraceSpan, ru as QuestionLevel, sd as detachedTurnEvents, sf as createDelegationTraceCollector, su as QuestionUrgency, td as DetachedTurn, tf as DelegationTraceCaps, tu as QuestionDecision, ud as runDetachedTurn, uf as DelegationStore, vd as DelegationTaskQueueOptions, wd as DelegateCodeResult, wu as DELEGATE_DESCRIPTION, xd as hashIdempotencyInput, xu as McpServerOptions, yd as SubmitInput, yu as questionEscalationTargets, zd as DelegationProfile, zu as CoderReviewer } from "../index-B2A_KtAZ.js";
3
+ import { _t as createPropagatingTraceEmitter, bt as traceContextToEnv, gt as TraceContext, vt as mergeTraceEnv, yt as readTraceContextFromEnv } from "../types-Cz5mCGlY.js";
4
+ import { $ as LocalHarnessResult, Bt as JsonRpcMessage, Ht as McpToolDescriptor, J as CodexExecutionPolicy, Q as LocalHarness, Ut as McpTransport, Vt as JsonRpcResponse, X as DEFAULT_LOCAL_HARNESS, Y as CodexTokenUsage, Z as LOCAL_HARNESSES, at as CreateWorktreeOptions, ct as GitRunner, dt as captureWorktreeDiff, et as RunLocalHarnessOptions, ft as createWorktree, it as runLocalHarness, lt as RemoveWorktreeOptions, nt as localHarnessExecutable, ot as DiffOptions, pt as removeWorktree, q as CodexExecutionEvidence, rt as parseCodexTokenUsage, st as DiffResult, tt as harnessSupportsReasoningEffort, ut as WorktreeHandle } from "../runtime-DuueBLeO.js";
5
5
  import { o as UiLens } from "../substrate-BcnuSHXm.js";
6
6
  import { a as KbGateResult, i as FactJudgeVerdict, n as FactCandidate, o as createKbGate, r as FactJudge, t as CreateKbGateOptions } from "../kb-gate-C8z2juK8.js";
7
7
  import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-z-whdYNC.js";
@@ -388,7 +388,7 @@ declare const DELEGATION_HISTORY_INPUT_SCHEMA: {
388
388
  };
389
389
  readonly profile: {
390
390
  readonly type: "string";
391
- readonly enum: readonly ["coder", "researcher"];
391
+ readonly enum: readonly ["coder", "researcher", "ui-auditor"];
392
392
  };
393
393
  readonly since: {
394
394
  readonly type: "string";
@@ -441,5 +441,5 @@ interface DelegationStatusHandlerOptions {
441
441
  /** Build the MCP tool handler that polls a `DelegationTaskQueue` for task status. @stable */
442
442
  declare function createDelegationStatusHandler(options: DelegationStatusHandlerOptions): (raw: unknown) => Promise<DelegationStatusResult>;
443
443
  //#endregion
444
- export { type AgentMemorySpec, type AnalystFindingEvent, type AnalystRegistry, type AuthorizeDownMessage, type AuthorizedDownMessage, type CappedDelegationTrace, type CoderDelegate, type CoderOutput, type CoderReview, type CoderReviewer, CodexExecutionDiagnosticError, type CodexExecutionEvidence, type CodexExecutionFailureDiagnostic, type CodexExecutionPolicy, type CodexTokenUsage, type ContinuationInstruction, type CoordinationEvent, type CoordinationTools, type CoordinationToolsOptions, type CreateKbGateOptions, type CreateMemoryToolServerOptions, type CreateWorktreeOptions, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_LOCAL_HARNESS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, type DelegateArgs, type DelegateCodeArgs, type DelegateCodeConfig, type DelegateCodeResult, type DelegateError, type DelegateFeedbackArgs, type DelegateFeedbackHandlerOptions, type DelegateFeedbackResult, type DelegateHandlerOptions, type DelegateResearchArgs, type DelegateResearchConfig, type DelegateResearchResult, type DelegateResult, type DelegateRunCtx, type DelegateUiAuditArgs, type DelegateUiAuditConfig, type DelegateUiAuditHandlerOptions, type DelegateUiAuditResult, type DelegateUiAuditRoute, type DelegationArgs, type DelegationError, type DelegationExecutor, type DelegationFeedbackSnapshot, type DelegationHistoryArgs, type DelegationHistoryEntry, type DelegationHistoryHandlerOptions, type DelegationHistoryResult, DelegationPersistenceError, type DelegationProfile, type DelegationProgress, type DelegationRecord, type DelegationResultPayload, type DelegationResumeContext, type DelegationResumeDriver, type DelegationResumeTick, type DelegationRunContext, DelegationStateCorruptError, type DelegationStatus, type DelegationStatusArgs, type DelegationStatusHandlerOptions, type DelegationStatusResult, type DelegationStore, DelegationTaskQueue, type DelegationTaskQueueOptions, type DelegationTraceCaps, type DelegationTraceCollector, type DelegationTraceSpan, type DetachedSessionDelegateOptions, type DetachedSessionRefParts, type DetachedTurn, type DetachedTurnResumeDriverOptions, type DetachedWinnerSelection, type DetectExecutorArgs, type DiffOptions, type DiffResult, type DownMessageAuthorizationInput, type DownMessageDeliveryAttempt, type DownMessageDeliveryOutcome, type DownMessageEvent, type DriveTurnCapableBox, type DriveTurnTick, type FactCandidate, type FactJudge, type FactJudgeVerdict, type FeedbackEvent, type FeedbackRating, type FeedbackRefersTo, type FeedbackStore, FileDelegationStore, type FileDelegationStoreOptions, type FleetHandle, type FleetWorkspaceExecutorOptions, type GitRunner, InMemoryDelegationStore, InMemoryFeedbackStore, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, type JsonRpcMessage, type JsonRpcResponse, type KbGateResult, LOCAL_HARNESSES, type LocalHarness, type LocalHarnessResult, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, type MakeWorkerAgent, type McpServer, type McpServerOptions, type McpToolDescriptor, type McpTransport, type MemoryItem, type Question, type QuestionDecision, type QuestionLevel, type QuestionOption, type QuestionPolicy, type QuestionRecord, type QuestionUrgency, type RemoveWorktreeOptions, type ResearchOutputShape, type ResearchSource, type ResolvedMemoryEnv, type RunDetachedTurnOptions, type RunLocalHarnessOptions, type SettleDetachedCoderTurnOptions, type SettledWorker, type SiblingSandboxExecutorOptions, type StdioToolServer, type StdioToolServerOptions, type SubmitInput, type SubmitOutput, type TraceContext, type UiAuditLensFilter, type UiAuditorDelegate, type UiAuditorDelegationOutput, type WorkerSpawnContext, type WorkerWatchOptions, type WorktreeHandle, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, harnessSupportsReasoningEffort, hashIdempotencyInput, localHarnessExecutable, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, mergeTraceEnv, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
444
+ export { type AgentMemorySpec, type AnalystFindingEvent, type AnalystRegistry, type AuthorizeDownMessage, type AuthorizedDownMessage, type CappedDelegationTrace, type CoderDelegate, type CoderOutput, type CoderReview, type CoderReviewer, CodexExecutionDiagnosticError, type CodexExecutionEvidence, type CodexExecutionFailureDiagnostic, type CodexExecutionPolicy, type CodexTokenUsage, type ContinuationInstruction, type CoordinationEvent, type CoordinationTools, type CoordinationToolsOptions, type CreateKbGateOptions, type CreateMemoryToolServerOptions, type CreateWorktreeOptions, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_LOCAL_HARNESS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, type DelegateArgs, type DelegateCodeArgs, type DelegateCodeConfig, type DelegateCodeResult, type DelegateError, type DelegateFeedbackArgs, type DelegateFeedbackHandlerOptions, type DelegateFeedbackResult, type DelegateHandlerOptions, type DelegateResearchArgs, type DelegateResearchConfig, type DelegateResearchResult, type DelegateResult, type DelegateRunCtx, type DelegateUiAuditArgs, type DelegateUiAuditConfig, type DelegateUiAuditHandlerOptions, type DelegateUiAuditResult, type DelegateUiAuditRoute, type DelegationArgs, type DelegationError, type DelegationExecutor, type DelegationFeedbackSnapshot, type DelegationHistoryArgs, type DelegationHistoryEntry, type DelegationHistoryHandlerOptions, type DelegationHistoryResult, DelegationPersistenceError, type DelegationProfile, type DelegationProgress, type DelegationRecord, type DelegationResultPayload, type DelegationResumeContext, type DelegationResumeDriver, type DelegationResumeTick, type DelegationRunContext, DelegationStateCorruptError, type DelegationStatus, type DelegationStatusArgs, type DelegationStatusHandlerOptions, type DelegationStatusResult, type DelegationStore, DelegationTaskQueue, type DelegationTaskQueueOptions, type DelegationTraceCaps, type DelegationTraceCollector, type DelegationTraceSpan, type DetachedSessionDelegateOptions, type DetachedSessionRefParts, type DetachedTurn, type DetachedTurnResumeDriverOptions, type DetachedWinnerSelection, type DetectExecutorArgs, type DiffOptions, type DiffResult, type DownMessageAuthorizationInput, type DownMessageDeliveryAttempt, type DownMessageDeliveryOutcome, type DownMessageEvent, type DriveTurnCapableBox, type DriveTurnTick, type FactCandidate, type FactJudge, type FactJudgeVerdict, type FeedbackEvent, type FeedbackRating, type FeedbackRefersTo, type FeedbackStore, FileDelegationStore, type FileDelegationStoreOptions, type FleetHandle, type FleetWorkspaceExecutorOptions, type GitRunner, InMemoryDelegationStore, InMemoryFeedbackStore, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, type JsonRpcMessage, type JsonRpcResponse, type KbGateResult, LOCAL_HARNESSES, type LocalHarness, type LocalHarnessResult, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, type MakeWorkerAgent, type McpServer, type McpServerOptions, type McpToolDescriptor, type McpTransport, type MemoryItem, type Question, type QuestionDecision, type QuestionEscalationTarget, type QuestionLevel, type QuestionOption, type QuestionPolicy, type QuestionRecord, type QuestionUrgency, type RemoveWorktreeOptions, type ResearchOutputShape, type ResearchSource, type ResolvedMemoryEnv, type RunDetachedTurnOptions, type RunLocalHarnessOptions, type SettleDetachedCoderTurnOptions, type SettledWorker, type SiblingSandboxExecutorOptions, type StdioToolServer, type StdioToolServerOptions, type SubmitInput, type SubmitOutput, type TraceContext, type UiAuditLensFilter, type UiAuditorDelegate, type UiAuditorDelegationOutput, type WorkerSpawnContext, type WorkerWatchOptions, type WorktreeHandle, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, delegationProfiles, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, harnessSupportsReasoningEffort, hashIdempotencyInput, localHarnessExecutable, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, mergeTraceEnv, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, questionEscalationTargets, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
445
445
  //# sourceMappingURL=index.d.ts.map
package/dist/mcp/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { i as ConfigError, m as ValidationError } from "../errors-CDZ8XsVj.js";
2
2
  import { g as throwIfAborted, h as throwAbort, o as deleteBoxSafe, p as sleep } from "../util-D6ZEuBMi.js";
3
3
  import { t as assertExecutableAgentProfile } from "../model-policy-Sw4ywhtL.js";
4
- import { $t as LOCAL_HARNESSES, Dt as readTraceContextFromEnv, Et as mergeTraceEnv, Jt as runWorktreeHarness, Ot as traceContextToEnv, Qt as DEFAULT_LOCAL_HARNESS, Tt as createPropagatingTraceEmitter, Xt as createWorktree, Yt as captureWorktreeDiff, Zt as removeWorktree, _t as runAgentRounds, en as harnessSupportsReasoningEffort, mt as createSandboxForSpec, nn as parseCodexTokenUsage, rn as CodexExecutionDiagnosticError, tn as localHarnessExecutable } from "../supervisor-CMZsJ7Wn.js";
5
- import { E as runCoderChecks, ft as selectValidWinner } from "../runtime--Jsq8JCC.js";
6
- import { $ as DELEGATION_TRACE_MAX_BYTES, A as DELEGATION_HISTORY_INPUT_SCHEMA, B as DELEGATE_FEEDBACK_INPUT_SCHEMA, C as createMcpServer, D as createDelegationStatusHandler, E as DELEGATION_STATUS_TOOL_NAME, F as DELEGATE_UI_AUDIT_INPUT_SCHEMA, G as DELEGATE_INPUT_SCHEMA, H as createDelegateFeedbackHandler, I as DELEGATE_UI_AUDIT_TOOL_NAME, J as validateDelegateArgs, K as DELEGATE_TOOL_NAME, L as createDelegateUiAuditHandler, M as createDelegationHistoryHandler, N as validateDelegationHistoryArgs, Nt as createCoordinationTools, O as validateDelegationStatusArgs, P as DELEGATE_UI_AUDIT_DESCRIPTION, Q as hashIdempotencyInput, R as validateDelegateUiAuditArgs, S as createInProcessTransport, T as DELEGATION_STATUS_INPUT_SCHEMA, U as validateDelegateFeedbackArgs, V as DELEGATE_FEEDBACK_TOOL_NAME, W as DELEGATE_DESCRIPTION, Z as DelegationTaskQueue, at as DelegationPersistenceError, ct as InMemoryDelegationStore, et as DELEGATION_TRACE_MAX_SPANS, it as createDelegationTraceCollector, j as DELEGATION_HISTORY_TOOL_NAME, jt as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, k as DELEGATION_HISTORY_DESCRIPTION, lt as InMemoryFeedbackStore, nt as capDelegationTrace, ot as DelegationStateCorruptError, q as createDelegateHandler, rt as composeLoopTraceEmitters, st as FileDelegationStore, tt as buildDelegationTraceSpans, ut as eventToSnapshot, w as DELEGATION_STATUS_DESCRIPTION, z as DELEGATE_FEEDBACK_DESCRIPTION } from "../supervise-k_8VOASb.js";
4
+ import { $t as LOCAL_HARNESSES, Dt as readTraceContextFromEnv, Et as mergeTraceEnv, Jt as runWorktreeHarness, Ot as traceContextToEnv, Qt as DEFAULT_LOCAL_HARNESS, Tt as createPropagatingTraceEmitter, Xt as createWorktree, Yt as captureWorktreeDiff, Zt as removeWorktree, _t as runAgentRounds, en as harnessSupportsReasoningEffort, mt as createSandboxForSpec, nn as parseCodexTokenUsage, rn as CodexExecutionDiagnosticError, tn as localHarnessExecutable } from "../supervisor-BmXD0WCJ.js";
5
+ import { E as runCoderChecks, ft as selectValidWinner } from "../runtime-D-NDRp4y.js";
6
+ import { $ as hashIdempotencyInput, A as DELEGATION_HISTORY_INPUT_SCHEMA, B as DELEGATE_FEEDBACK_DESCRIPTION, C as createMcpServer, D as createDelegationStatusHandler, E as DELEGATION_STATUS_TOOL_NAME, F as DELEGATE_UI_AUDIT_DESCRIPTION, G as DELEGATE_DESCRIPTION, H as DELEGATE_FEEDBACK_TOOL_NAME, I as DELEGATE_UI_AUDIT_INPUT_SCHEMA, It as questionEscalationTargets, J as createDelegateHandler, K as DELEGATE_INPUT_SCHEMA, L as DELEGATE_UI_AUDIT_TOOL_NAME, M as createDelegationHistoryHandler, Mt as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, N as validateDelegationHistoryArgs, O as validateDelegationStatusArgs, P as delegationProfiles, Pt as createCoordinationTools, Q as DelegationTaskQueue, R as createDelegateUiAuditHandler, S as createInProcessTransport, T as DELEGATION_STATUS_INPUT_SCHEMA, U as createDelegateFeedbackHandler, V as DELEGATE_FEEDBACK_INPUT_SCHEMA, W as validateDelegateFeedbackArgs, Y as validateDelegateArgs, at as createDelegationTraceCollector, ct as FileDelegationStore, dt as eventToSnapshot, et as DELEGATION_TRACE_MAX_BYTES, it as composeLoopTraceEmitters, j as DELEGATION_HISTORY_TOOL_NAME, k as DELEGATION_HISTORY_DESCRIPTION, lt as InMemoryDelegationStore, nt as buildDelegationTraceSpans, ot as DelegationPersistenceError, q as DELEGATE_TOOL_NAME, rt as capDelegationTrace, st as DelegationStateCorruptError, tt as DELEGATION_TRACE_MAX_SPANS, ut as InMemoryFeedbackStore, w as DELEGATION_STATUS_DESCRIPTION, z as validateDelegateUiAuditArgs } from "../supervise-BVE0XAJa.js";
7
7
  import { t as createStdioToolServer } from "../tool-server-DEmLr9YY.js";
8
8
  import { t as createKbGate } from "../kb-gate-DpaSwXVx.js";
9
- import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-C4XKuK4t.js";
9
+ import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-CkSQJppW.js";
10
10
  import { t as coderTaskToPrompt } from "../coder-yhVWbdWc.js";
11
11
  import { a as createMemoryToolServer, c as resolveMemoryFromEnv, i as MEMORY_NAME_ENV, n as MEMORY_ITEMS_ENV, o as parseMemoryItems, r as MEMORY_LOG_ENV, s as readMemoryItemsFile, t as MEMORY_FILE_ENV } from "../memory-server-DsKOhzGf.js";
12
12
  import { agentProfileSchema } from "@tangle-network/agent-interface";
@@ -1119,6 +1119,6 @@ const singleShotDriver = {
1119
1119
  }
1120
1120
  };
1121
1121
  //#endregion
1122
- export { CodexExecutionDiagnosticError, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_LOCAL_HARNESS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, DelegationPersistenceError, DelegationStateCorruptError, DelegationTaskQueue, FileDelegationStore, InMemoryDelegationStore, InMemoryFeedbackStore, LOCAL_HARNESSES, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, harnessSupportsReasoningEffort, hashIdempotencyInput, localHarnessExecutable, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, mergeTraceEnv, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
1122
+ export { CodexExecutionDiagnosticError, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_LOCAL_HARNESS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, DelegationPersistenceError, DelegationStateCorruptError, DelegationTaskQueue, FileDelegationStore, InMemoryDelegationStore, InMemoryFeedbackStore, LOCAL_HARNESSES, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, delegationProfiles, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, harnessSupportsReasoningEffort, hashIdempotencyInput, localHarnessExecutable, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, mergeTraceEnv, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, questionEscalationTargets, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
1123
1123
 
1124
1124
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { A as DELEGATION_HISTORY_INPUT_SCHEMA, B as DELEGATE_FEEDBACK_INPUT_SCHEMA, E as DELEGATION_STATUS_TOOL_NAME, T as DELEGATION_STATUS_INPUT_SCHEMA, V as DELEGATE_FEEDBACK_TOOL_NAME, j as DELEGATION_HISTORY_TOOL_NAME, k as DELEGATION_HISTORY_DESCRIPTION, w as DELEGATION_STATUS_DESCRIPTION, z as DELEGATE_FEEDBACK_DESCRIPTION } from "./supervise-k_8VOASb.js";
1
+ import { A as DELEGATION_HISTORY_INPUT_SCHEMA, B as DELEGATE_FEEDBACK_DESCRIPTION, E as DELEGATION_STATUS_TOOL_NAME, H as DELEGATE_FEEDBACK_TOOL_NAME, T as DELEGATION_STATUS_INPUT_SCHEMA, V as DELEGATE_FEEDBACK_INPUT_SCHEMA, j as DELEGATION_HISTORY_TOOL_NAME, k as DELEGATION_HISTORY_DESCRIPTION, w as DELEGATION_STATUS_DESCRIPTION } from "./supervise-BVE0XAJa.js";
2
2
  //#region src/mcp/openai-tools.ts
3
3
  function buildTool(name, description, parameters) {
4
4
  return {
@@ -41,4 +41,4 @@ function mcpToolsForRuntimeMcpSubset(names) {
41
41
  //#endregion
42
42
  export { mcpToolsForRuntimeMcpSubset as n, mcpToolsForRuntimeMcp as t };
43
43
 
44
- //# sourceMappingURL=openai-tools-C4XKuK4t.js.map
44
+ //# sourceMappingURL=openai-tools-CkSQJppW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openai-tools-C4XKuK4t.js","names":[],"sources":["../src/mcp/openai-tools.ts"],"sourcesContent":["/**\n *\n * OpenAI Chat Completions `tools[]` projection of the queue-bound agent-runtime\n * MCP delegation tools.\n *\n * Use when a caller-owned OpenAI-compatible transport needs the model to call\n * `delegate_feedback`, `delegation_status`, and `delegation_history`. Execution\n * is the caller's responsibility (typically the parent sandbox runtime's MCP\n * mount); Runtime's profile-bound model path materializes profile tools through\n * its executor instead.\n *\n * Sandbox-SDK callers do NOT need this helper: the sandbox runtime mounts\n * MCP servers natively and the in-sandbox harness discovers tools via the\n * runtime, not via an OpenAI tools array.\n *\n * Tool name + description + JSON-schema are pulled from the canonical\n * `DELEGATE_*` constants exported by `./tools/*` so the projection cannot\n * drift from the server's own validators.\n *\n * @experimental\n */\n\nimport type { OpenAIChatTool } from '../types'\nimport {\n DELEGATE_FEEDBACK_DESCRIPTION,\n DELEGATE_FEEDBACK_INPUT_SCHEMA,\n DELEGATE_FEEDBACK_TOOL_NAME,\n} from './tools/delegate-feedback'\nimport {\n DELEGATION_HISTORY_DESCRIPTION,\n DELEGATION_HISTORY_INPUT_SCHEMA,\n DELEGATION_HISTORY_TOOL_NAME,\n} from './tools/delegation-history'\nimport {\n DELEGATION_STATUS_DESCRIPTION,\n DELEGATION_STATUS_INPUT_SCHEMA,\n DELEGATION_STATUS_TOOL_NAME,\n} from './tools/delegation-status'\n\nfunction buildTool(\n name: string,\n description: string,\n parameters: Readonly<Record<string, unknown>>,\n): OpenAIChatTool {\n // `parameters` arrives as a deeply-readonly `as const` literal. The\n // OpenAI-compatible transports JSON-serialize the body, so a shallow copy\n // into a plain object is sufficient and shields callers that mutate\n // the returned descriptor from corrupting the source constant.\n return {\n type: 'function',\n function: { name, description, parameters: { ...parameters } },\n }\n}\n\n/**\n *\n * Returns the queue-bound delegation tools projected into OpenAI Chat\n * Completions `tools[]` shape. The order is stable: `delegate_feedback`,\n * `delegation_status`, `delegation_history`.\n *\n * @experimental\n */\nexport function mcpToolsForRuntimeMcp(): OpenAIChatTool[] {\n return [\n buildTool(\n DELEGATE_FEEDBACK_TOOL_NAME,\n DELEGATE_FEEDBACK_DESCRIPTION,\n DELEGATE_FEEDBACK_INPUT_SCHEMA as Readonly<Record<string, unknown>>,\n ),\n buildTool(\n DELEGATION_STATUS_TOOL_NAME,\n DELEGATION_STATUS_DESCRIPTION,\n DELEGATION_STATUS_INPUT_SCHEMA as Readonly<Record<string, unknown>>,\n ),\n buildTool(\n DELEGATION_HISTORY_TOOL_NAME,\n DELEGATION_HISTORY_DESCRIPTION,\n DELEGATION_HISTORY_INPUT_SCHEMA as Readonly<Record<string, unknown>>,\n ),\n ]\n}\n\n/**\n *\n * Subset filter — return only the projected tools whose `function.name`\n * appears in `names`. Useful for curated mounts (e.g. only the queue-bound\n * delegation tools, omitting `delegate_feedback`). Unknown names are\n * silently ignored; pass an empty array to get an empty result.\n *\n * @experimental\n */\nexport function mcpToolsForRuntimeMcpSubset(names: ReadonlyArray<string>): OpenAIChatTool[] {\n const allowed = new Set(names)\n return mcpToolsForRuntimeMcp().filter((tool) => allowed.has(tool.function.name))\n}\n"],"mappings":";;AAuCA,SAAS,UACP,MACA,aACA,YACgB;CAKhB,OAAO;EACL,MAAM;EACN,UAAU;GAAE;GAAM;GAAa,YAAY,EAAE,GAAG,WAAW;EAAE;CAC/D;AACF;;;;;;;;;AAUA,SAAgB,wBAA0C;CACxD,OAAO;EACL,UACE,6BACA,+BACA,8BACF;EACA,UACE,6BACA,+BACA,8BACF;EACA,UACE,8BACA,gCACA,+BACF;CACF;AACF;;;;;;;;;;AAWA,SAAgB,4BAA4B,OAAgD;CAC1F,MAAM,UAAU,IAAI,IAAI,KAAK;CAC7B,OAAO,sBAAsB,CAAC,CAAC,QAAQ,SAAS,QAAQ,IAAI,KAAK,SAAS,IAAI,CAAC;AACjF"}
1
+ {"version":3,"file":"openai-tools-CkSQJppW.js","names":[],"sources":["../src/mcp/openai-tools.ts"],"sourcesContent":["/**\n *\n * OpenAI Chat Completions `tools[]` projection of the queue-bound agent-runtime\n * MCP delegation tools.\n *\n * Use when a caller-owned OpenAI-compatible transport needs the model to call\n * `delegate_feedback`, `delegation_status`, and `delegation_history`. Execution\n * is the caller's responsibility (typically the parent sandbox runtime's MCP\n * mount); Runtime's profile-bound model path materializes profile tools through\n * its executor instead.\n *\n * Sandbox-SDK callers do NOT need this helper: the sandbox runtime mounts\n * MCP servers natively and the in-sandbox harness discovers tools via the\n * runtime, not via an OpenAI tools array.\n *\n * Tool name + description + JSON-schema are pulled from the canonical\n * `DELEGATE_*` constants exported by `./tools/*` so the projection cannot\n * drift from the server's own validators.\n *\n * @experimental\n */\n\nimport type { OpenAIChatTool } from '../types'\nimport {\n DELEGATE_FEEDBACK_DESCRIPTION,\n DELEGATE_FEEDBACK_INPUT_SCHEMA,\n DELEGATE_FEEDBACK_TOOL_NAME,\n} from './tools/delegate-feedback'\nimport {\n DELEGATION_HISTORY_DESCRIPTION,\n DELEGATION_HISTORY_INPUT_SCHEMA,\n DELEGATION_HISTORY_TOOL_NAME,\n} from './tools/delegation-history'\nimport {\n DELEGATION_STATUS_DESCRIPTION,\n DELEGATION_STATUS_INPUT_SCHEMA,\n DELEGATION_STATUS_TOOL_NAME,\n} from './tools/delegation-status'\n\nfunction buildTool(\n name: string,\n description: string,\n parameters: Readonly<Record<string, unknown>>,\n): OpenAIChatTool {\n // `parameters` arrives as a deeply-readonly `as const` literal. The\n // OpenAI-compatible transports JSON-serialize the body, so a shallow copy\n // into a plain object is sufficient and shields callers that mutate\n // the returned descriptor from corrupting the source constant.\n return {\n type: 'function',\n function: { name, description, parameters: { ...parameters } },\n }\n}\n\n/**\n *\n * Returns the queue-bound delegation tools projected into OpenAI Chat\n * Completions `tools[]` shape. The order is stable: `delegate_feedback`,\n * `delegation_status`, `delegation_history`.\n *\n * @experimental\n */\nexport function mcpToolsForRuntimeMcp(): OpenAIChatTool[] {\n return [\n buildTool(\n DELEGATE_FEEDBACK_TOOL_NAME,\n DELEGATE_FEEDBACK_DESCRIPTION,\n DELEGATE_FEEDBACK_INPUT_SCHEMA as Readonly<Record<string, unknown>>,\n ),\n buildTool(\n DELEGATION_STATUS_TOOL_NAME,\n DELEGATION_STATUS_DESCRIPTION,\n DELEGATION_STATUS_INPUT_SCHEMA as Readonly<Record<string, unknown>>,\n ),\n buildTool(\n DELEGATION_HISTORY_TOOL_NAME,\n DELEGATION_HISTORY_DESCRIPTION,\n DELEGATION_HISTORY_INPUT_SCHEMA as Readonly<Record<string, unknown>>,\n ),\n ]\n}\n\n/**\n *\n * Subset filter — return only the projected tools whose `function.name`\n * appears in `names`. Useful for curated mounts (e.g. only the queue-bound\n * delegation tools, omitting `delegate_feedback`). Unknown names are\n * silently ignored; pass an empty array to get an empty result.\n *\n * @experimental\n */\nexport function mcpToolsForRuntimeMcpSubset(names: ReadonlyArray<string>): OpenAIChatTool[] {\n const allowed = new Set(names)\n return mcpToolsForRuntimeMcp().filter((tool) => allowed.has(tool.function.name))\n}\n"],"mappings":";;AAuCA,SAAS,UACP,MACA,aACA,YACgB;CAKhB,OAAO;EACL,MAAM;EACN,UAAU;GAAE;GAAM;GAAa,YAAY,EAAE,GAAG,WAAW;EAAE;CAC/D;AACF;;;;;;;;;AAUA,SAAgB,wBAA0C;CACxD,OAAO;EACL,UACE,6BACA,+BACA,8BACF;EACA,UACE,6BACA,+BACA,8BACF;EACA,UACE,8BACA,gCACA,+BACF;CACF;AACF;;;;;;;;;;AAWA,SAAgB,4BAA4B,OAAgD;CAC1F,MAAM,UAAU,IAAI,IAAI,KAAK;CAC7B,OAAO,sBAAsB,CAAC,CAAC,QAAQ,SAAS,QAAQ,IAAI,KAAK,SAAS,IAAI,CAAC;AACjF"}
@@ -1,4 +1,4 @@
1
- import { x as contentAddress } from "./spawn-journal-BLnveCRS.js";
1
+ import { x as contentAddress } from "./spawn-journal-duo0EkOp.js";
2
2
  import { i as redactProtectedValue, n as createProtectedRecordRedactor, r as redactProtectedReason, t as assertNoProtectedBytes } from "./protected-redaction--F3v1oo8.js";
3
3
  import { agentCandidateArtifactRefSchema, agentCandidateBenchmarkResultEvidenceSchema, agentCandidateBenchmarkSuiteSchema, agentCandidateBenchmarkTaskSchema, agentCandidateBundleSchema, agentCandidateContainerSchema, agentCandidateExecutionLimitsSchema, agentCandidateExecutionPlanEvidenceSchema, agentCandidateExecutionPlanMaterialSchema, agentCandidateMaterializationReceiptSchema, agentCandidateModelAccessNetworkSchema, agentCandidateModelSettlementEvidenceSchema, agentCandidateProfileActivationSchema, agentCandidateProfilePlanEvidenceSchema, agentCandidateProfileSchema, agentCandidateResolvedModelSchema, agentCandidateRunCellSchema, agentCandidateRunReceiptSchema, agentCandidateTaskOutcomeEvidenceSchema, agentCandidateTaskOutcomeSpecSchema, agentCandidateTerminationSchema, agentCandidateWorkspaceManifestMaterialSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, agentProfileDiffSchema, agentProfileSchema, applyAgentProfileDiff, sha256DigestSchema } from "@tangle-network/agent-interface";
4
4
  import { REDACTION_VERSION, canonicalJson, isLlmSpan } from "@tangle-network/agent-eval";
@@ -489,6 +489,22 @@ function assertExactObjectKeys(value, required, label, optional = []) {
489
489
  for (const key of Object.keys(value)) if (!allowed.has(key)) throw new Error(`${label} contains unknown field ${key}`);
490
490
  for (const key of required) if (!(key in value)) throw new Error(`${label} is missing field ${key}`);
491
491
  }
492
+ /**
493
+ * Reject a string carrying a lone surrogate. A well-formed UTF-16 string round-trips through UTF-8
494
+ * unchanged; a lone surrogate does not, so a value that passes here is safe to persist and re-read
495
+ * as the same bytes.
496
+ */
497
+ function isWellFormedUnicode(value) {
498
+ for (let index = 0; index < value.length; index++) {
499
+ const code = value.charCodeAt(index);
500
+ if (code >= 55296 && code <= 56319) {
501
+ const next = value.charCodeAt(index + 1);
502
+ if (!(next >= 56320 && next <= 57343)) return false;
503
+ index++;
504
+ } else if (code >= 56320 && code <= 57343) return false;
505
+ }
506
+ return true;
507
+ }
492
508
  //#endregion
493
509
  //#region src/candidate-execution/claim-file-formats.ts
494
510
  function sealCandidatePreparationEvidence(value, executionPlanDigest) {
@@ -4462,21 +4478,10 @@ function exactProfileExecutorFiles(sourceFiles, expectedFiles) {
4462
4478
  };
4463
4479
  });
4464
4480
  }
4465
- function isWellFormedUnicode(value) {
4466
- for (let index = 0; index < value.length; index++) {
4467
- const code = value.charCodeAt(index);
4468
- if (code >= 55296 && code <= 56319) {
4469
- const next = value.charCodeAt(index + 1);
4470
- if (!(next >= 56320 && next <= 57343)) return false;
4471
- index++;
4472
- } else if (code >= 56320 && code <= 57343) return false;
4473
- }
4474
- return true;
4475
- }
4476
4481
  function errorMessage(error) {
4477
4482
  return error instanceof Error ? error.message : String(error);
4478
4483
  }
4479
4484
  //#endregion
4480
- export { parseExactAgentProfile as $, verifyMaterializedWorkspace as A, rejectedStage as B, assertNoGitIndirection as C, captureMaterializedWorkspace as D, candidateWorkspaceManifest as E, assertTerminalAllowedInPhase as F, agentCandidateProfileAsAgentProfile as G, sealTerminalDigest as H, assertTerminalMatchesClaim as I, createAgentCandidateProfileActivation as J, applyExactAgentProfileDiff as K, assertTerminalMatchesStaged as L, candidateCleanupTimeout as M, withinCandidateCleanupDeadline as N, readVerifiedArtifact as O, assertRecoveryMatchesStaged as P, parseAgentCandidateProfileActivation as Q, recoveredTerminalRecord as R, CANDIDATE_TRACE_TAGS as S, runCandidateGit as T, terminalRecord as U, requireStagedTerminal as V, assertExactObjectKeys as W, materializeAgentCandidateProfilePlan as X, freezeGenericAgentCandidateProfile as Y, omitUndefinedObjectFields as Z, candidateExecutionClaim as _, persistCandidateOutputArtifact as a, deepFreezeCandidate as at, consumePreparedCandidateExecution as b, CANDIDATE_KNOWLEDGE_ROOT_ENV as c, omitTopLevelDigest as ct, verifiedResourceTextByDigest as d, parseExactAgentProfileDiff as et, verifyAgentCandidateBundle as f, candidateClaimFileInternals as g, InMemoryAgentCandidateExecutionClaimStore as h, persistCandidateModelSettlementEvidence as i, canonicalCandidateDocument as it, candidateCleanupDeadline as j, verifyBytes as k, candidateKnowledgeExecutionPaths as l, sha256Bytes as lt, usdToNanos as m, executePreparedAgentCandidate as n, canonicalCandidateBytes as nt, sealAgentCandidateExecutorStopAcknowledgement as o, embeddedCandidateArtifact as ot, sealAgentCandidateModelSettlement as p, assertCandidateProfileBinding as q, RecoveryAgentCandidateTraceStore as r, canonicalCandidateDigest$1 as rt, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV as s, immutableCandidateValue as st, prepareAgentCandidateExecution as t, parseExactCandidateProfile as tt, AGENT_CANDIDATE_EXECUTION_SUPPORT as u, verifyCanonicalCandidateDocument as ut, assertPreparedCandidateIntegrity as v, readCandidateGitTreeFiles as w, CANDIDATE_TRACE_ENV as x, beginPreparedCandidateDisposal as y, rejectedFinish as z };
4485
+ export { parseAgentCandidateProfileActivation as $, verifyMaterializedWorkspace as A, rejectedStage as B, assertNoGitIndirection as C, captureMaterializedWorkspace as D, candidateWorkspaceManifest as E, assertTerminalAllowedInPhase as F, isWellFormedUnicode as G, sealTerminalDigest as H, assertTerminalMatchesClaim as I, assertCandidateProfileBinding as J, agentCandidateProfileAsAgentProfile as K, assertTerminalMatchesStaged as L, candidateCleanupTimeout as M, withinCandidateCleanupDeadline as N, readVerifiedArtifact as O, assertRecoveryMatchesStaged as P, omitUndefinedObjectFields as Q, recoveredTerminalRecord as R, CANDIDATE_TRACE_TAGS as S, runCandidateGit as T, terminalRecord as U, requireStagedTerminal as V, assertExactObjectKeys as W, freezeGenericAgentCandidateProfile as X, createAgentCandidateProfileActivation as Y, materializeAgentCandidateProfilePlan as Z, candidateExecutionClaim as _, persistCandidateOutputArtifact as a, canonicalCandidateDocument as at, consumePreparedCandidateExecution as b, CANDIDATE_KNOWLEDGE_ROOT_ENV as c, immutableCandidateValue as ct, verifiedResourceTextByDigest as d, verifyCanonicalCandidateDocument as dt, parseExactAgentProfile as et, verifyAgentCandidateBundle as f, candidateClaimFileInternals as g, InMemoryAgentCandidateExecutionClaimStore as h, persistCandidateModelSettlementEvidence as i, canonicalCandidateDigest$1 as it, candidateCleanupDeadline as j, verifyBytes as k, candidateKnowledgeExecutionPaths as l, omitTopLevelDigest as lt, usdToNanos as m, executePreparedAgentCandidate as n, parseExactCandidateProfile as nt, sealAgentCandidateExecutorStopAcknowledgement as o, deepFreezeCandidate as ot, sealAgentCandidateModelSettlement as p, applyExactAgentProfileDiff as q, RecoveryAgentCandidateTraceStore as r, canonicalCandidateBytes as rt, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV as s, embeddedCandidateArtifact as st, prepareAgentCandidateExecution as t, parseExactAgentProfileDiff as tt, AGENT_CANDIDATE_EXECUTION_SUPPORT as u, sha256Bytes as ut, assertPreparedCandidateIntegrity as v, readCandidateGitTreeFiles as w, CANDIDATE_TRACE_ENV as x, beginPreparedCandidateDisposal as y, rejectedFinish as z };
4481
4486
 
4482
- //# sourceMappingURL=prepare-C5tI-H4o.js.map
4487
+ //# sourceMappingURL=prepare-DcMjMdj-.js.map