@tangle-network/agent-runtime 0.143.0 → 0.153.1

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 (113) hide show
  1. package/README.md +32 -0
  2. package/dist/{activation-mi8TgSLM.js → activation-DKxQsHiO.js} +3 -3
  3. package/dist/{activation-mi8TgSLM.js.map → activation-DKxQsHiO.js.map} +1 -1
  4. package/dist/agent.d.ts +1 -1
  5. package/dist/agent.js +3 -3
  6. package/dist/{analyst-loop-CvkmfhUB.js → analyst-loop-B2kTHKNh.js} +2 -2
  7. package/dist/{analyst-loop-CvkmfhUB.js.map → analyst-loop-B2kTHKNh.js.map} +1 -1
  8. package/dist/analyst-loop.js +1 -1
  9. package/dist/{authoring-DuyShLdw.js → authoring-Tk2xFys0.js} +2 -2
  10. package/dist/{authoring-DuyShLdw.js.map → authoring-Tk2xFys0.js.map} +1 -1
  11. package/dist/candidate-execution/index.js +4 -4
  12. package/dist/{candidate-execution-CD5PoNmC.js → candidate-execution-CB9RJbbJ.js} +4 -4
  13. package/dist/{candidate-execution-CD5PoNmC.js.map → candidate-execution-CB9RJbbJ.js.map} +1 -1
  14. package/dist/{conversation-1hNtDeMM.js → conversation-D64WyWrK.js} +4 -4
  15. package/dist/{conversation-1hNtDeMM.js.map → conversation-D64WyWrK.js.map} +1 -1
  16. package/dist/conversation.d.ts +1 -1
  17. package/dist/conversation.js +1 -1
  18. package/dist/durable.d.ts +102 -4
  19. package/dist/durable.js +259 -10
  20. package/dist/durable.js.map +1 -1
  21. package/dist/{environment-provider-B8eZ85Ga.d.ts → environment-provider-DJG0yIYl.d.ts} +2 -2
  22. package/dist/{environment-provider-DCBJ13VP.js → environment-provider-D_MXw3jK.js} +88 -9
  23. package/dist/environment-provider-D_MXw3jK.js.map +1 -0
  24. package/dist/environment-provider.d.ts +1 -1
  25. package/dist/environment-provider.js +1 -1
  26. package/dist/executable-spec-BUcUcEPk.js +73 -0
  27. package/dist/executable-spec-BUcUcEPk.js.map +1 -0
  28. package/dist/{graph-De_XEsfH.js → graph-M0Qr4863.js} +4 -4
  29. package/dist/{graph-De_XEsfH.js.map → graph-M0Qr4863.js.map} +1 -1
  30. package/dist/{improvement-cycle-Bi-Tf4QF.js → improvement-cycle-CDxlGQGE.js} +7 -7
  31. package/dist/{improvement-cycle-Bi-Tf4QF.js.map → improvement-cycle-CDxlGQGE.js.map} +1 -1
  32. package/dist/{index-B8rKtH3U.d.ts → index-BihHgUAI.d.ts} +4 -4
  33. package/dist/{index-C2caGomG.d.ts → index-Dlz7ejRx.d.ts} +339 -503
  34. package/dist/{index-D4sLkOPY.d.ts → index-LQfgFJoX.d.ts} +2 -2
  35. package/dist/index.d.ts +7 -7
  36. package/dist/index.js +13 -13
  37. package/dist/intelligence.d.ts +4 -4
  38. package/dist/intelligence.js +6 -6
  39. package/dist/kernel.d.ts +6 -6
  40. package/dist/kernel.js +13 -13
  41. package/dist/{knowledge-CVE6Wk1i.js → knowledge-DM-i40b9.js} +10 -7
  42. package/dist/{knowledge-CVE6Wk1i.js.map → knowledge-DM-i40b9.js.map} +1 -1
  43. package/dist/knowledge.d.ts +1 -1
  44. package/dist/knowledge.js +1 -1
  45. package/dist/{loop-runner-bin-BoHdQqLm.d.ts → loop-runner-bin-D-BW51yr.d.ts} +3 -3
  46. package/dist/{loop-runner-bin-DdaI1nLL.js → loop-runner-bin-pD5WJuqJ.js} +4 -4
  47. package/dist/{loop-runner-bin-DdaI1nLL.js.map → loop-runner-bin-pD5WJuqJ.js.map} +1 -1
  48. package/dist/loop-runner-bin.d.ts +1 -1
  49. package/dist/loop-runner-bin.js +1 -1
  50. package/dist/{materialization-P86EciBw.js → materialization-Bo6j3Hg9.js} +257 -61
  51. package/dist/materialization-Bo6j3Hg9.js.map +1 -0
  52. package/dist/mcp/bin.js +3 -3
  53. package/dist/mcp/index.d.ts +3 -3
  54. package/dist/mcp/index.js +6 -6
  55. package/dist/{model-policy-DgRJIJse.js → model-policy-Sw4ywhtL.js} +68 -6
  56. package/dist/model-policy-Sw4ywhtL.js.map +1 -0
  57. package/dist/{openai-tools-BiAWKjh6.js → openai-tools-CWBywy-e.js} +2 -2
  58. package/dist/{openai-tools-BiAWKjh6.js.map → openai-tools-CWBywy-e.js.map} +1 -1
  59. package/dist/{prepare-D3n7cA39.js → prepare-C3eFd3UA.js} +2 -2
  60. package/dist/{prepare-D3n7cA39.js.map → prepare-C3eFd3UA.js.map} +1 -1
  61. package/dist/primeintellect/index.d.ts +1 -1
  62. package/dist/profiles.js +1 -1
  63. package/dist/{protected-model-port-bq6bD9YX.js → protected-model-port-Dn2b6peS.js} +2 -2
  64. package/dist/{protected-model-port-bq6bD9YX.js.map → protected-model-port-Dn2b6peS.js.map} +1 -1
  65. package/dist/{redact-DexTuAiX.d.ts → redact-NAptmqKw.d.ts} +3 -3
  66. package/dist/{researcher-CiSY6Wzb.js → researcher-BMFFPwKb.js} +2 -2
  67. package/dist/{researcher-CiSY6Wzb.js.map → researcher-BMFFPwKb.js.map} +1 -1
  68. package/dist/{run-layout-Be_Z0dF8.js → run-layout-C2jgwsCq.js} +111 -6
  69. package/dist/run-layout-C2jgwsCq.js.map +1 -0
  70. package/dist/{runtime-J6Toky8K.d.ts → runtime-B-5dp5Iz.d.ts} +214 -14
  71. package/dist/{runtime-BnqjbOGX.js → runtime-RY_rvv7t.js} +85 -82
  72. package/dist/runtime-RY_rvv7t.js.map +1 -0
  73. package/dist/{sandbox-events-COwCWUVB.js → sandbox-events-DMijDq2p.js} +49 -2
  74. package/dist/sandbox-events-DMijDq2p.js.map +1 -0
  75. package/dist/{spawn-journal-D2HKUImC.js → spawn-journal-CLguaA2A.js} +8 -43
  76. package/dist/spawn-journal-CLguaA2A.js.map +1 -0
  77. package/dist/{stream-agent-turn-C1Vs_3B9.d.ts → stream-agent-turn-BGyszuPH.d.ts} +2 -2
  78. package/dist/{stream-agent-turn-CXRugSGO.js → stream-agent-turn-D6HoaRPV.js} +90 -14
  79. package/dist/stream-agent-turn-D6HoaRPV.js.map +1 -0
  80. package/dist/{structural-rollout-CJgj9YXH.js → structural-rollout-P1YxFRfl.js} +11 -8
  81. package/dist/structural-rollout-P1YxFRfl.js.map +1 -0
  82. package/dist/{supervise-hCgG6ROJ.js → supervise-BezbzKiJ.js} +1550 -1186
  83. package/dist/supervise-BezbzKiJ.js.map +1 -0
  84. package/dist/{supervisor-s8SfZYbW.js → supervisor-DBVlPONC.js} +597 -194
  85. package/dist/supervisor-DBVlPONC.js.map +1 -0
  86. package/dist/testing.d.ts +2 -2
  87. package/dist/testing.js +12 -12
  88. package/dist/{top-app-BMOSKK06.js → top-app-tKo9OrON.js} +189 -86
  89. package/dist/top-app-tKo9OrON.js.map +1 -0
  90. package/dist/tui/bin.js +1 -1
  91. package/dist/tui/index.d.ts +32 -4
  92. package/dist/tui/index.js +1 -1
  93. package/dist/{types-Df9vulGc.d.ts → types-BPQhQRrC.d.ts} +507 -10
  94. package/dist/{util-C1bv6yog.js → util-Bncw0o_F.js} +41 -2
  95. package/dist/util-Bncw0o_F.js.map +1 -0
  96. package/dist/{workspace-archive-C52LjkeN.js → workspace-archive-Dm73lTfB.js} +2 -2
  97. package/dist/{workspace-archive-C52LjkeN.js.map → workspace-archive-Dm73lTfB.js.map} +1 -1
  98. package/package.json +4 -4
  99. package/dist/environment-provider-DCBJ13VP.js.map +0 -1
  100. package/dist/materialization-P86EciBw.js.map +0 -1
  101. package/dist/model-policy-DgRJIJse.js.map +0 -1
  102. package/dist/retained-run-binding-Dp2e8xne.js +0 -268
  103. package/dist/retained-run-binding-Dp2e8xne.js.map +0 -1
  104. package/dist/run-layout-Be_Z0dF8.js.map +0 -1
  105. package/dist/runtime-BnqjbOGX.js.map +0 -1
  106. package/dist/sandbox-events-COwCWUVB.js.map +0 -1
  107. package/dist/spawn-journal-D2HKUImC.js.map +0 -1
  108. package/dist/stream-agent-turn-CXRugSGO.js.map +0 -1
  109. package/dist/structural-rollout-CJgj9YXH.js.map +0 -1
  110. package/dist/supervise-hCgG6ROJ.js.map +0 -1
  111. package/dist/supervisor-s8SfZYbW.js.map +0 -1
  112. package/dist/top-app-BMOSKK06.js.map +0 -1
  113. package/dist/util-C1bv6yog.js.map +0 -1
@@ -1,72 +1,268 @@
1
1
  import { m as ValidationError } from "./errors-CDZ8XsVj.js";
2
2
  import { t as detachedSnapshot } from "./snapshot-cK9K420n.js";
3
- import { t as assertExecutableAgentProfile } from "./model-policy-DgRJIJse.js";
4
- import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest } from "@tangle-network/agent-interface";
3
+ import { AgentExactRunControlRefSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, agentRunCancellationRequestDigest, canonicalAgentProfileDigest, canonicalCandidateDigest } from "@tangle-network/agent-interface";
5
4
  import { randomUUID } from "node:crypto";
6
- //#region src/runtime/sandbox-outcome.ts
7
- /** Map the public Sandbox outcome to Runtime's stream and verdict vocabulary. */
8
- function projectSandboxOutcome(outcome) {
9
- if (outcome.status === "success") return {
10
- status: "completed",
11
- reason: "turn completed",
12
- verdict: {
13
- valid: true,
14
- score: 1
15
- }
5
+ //#region src/runtime/turn-input.ts
6
+ /**
7
+ * Copy only fields that describe a new provider turn.
8
+ *
9
+ * Session, replay, continuation, and transfer coordinates are runtime-owned
10
+ * and are injected by the caller that owns that lifecycle. Keeping this copy
11
+ * explicit also makes JavaScript callers subject to the same boundary.
12
+ */
13
+ function freshTurnInput(input, runtime) {
14
+ return {
15
+ ...input.prompt === void 0 ? {} : { prompt: input.prompt },
16
+ ...input.parts === void 0 ? {} : { parts: input.parts },
17
+ ...input.model === void 0 ? {} : { model: input.model },
18
+ ...input.timeoutMs === void 0 ? {} : { timeoutMs: input.timeoutMs },
19
+ ...input.context === void 0 ? {} : { context: input.context },
20
+ ...input.interactions === void 0 ? {} : { interactions: input.interactions },
21
+ ...input.providerOptions === void 0 ? {} : { providerOptions: input.providerOptions },
22
+ ...input.signal === void 0 ? {} : { signal: input.signal },
23
+ turnId: runtime.turnId,
24
+ detach: runtime.detach,
25
+ ...runtime.sessionId === void 0 ? {} : { sessionId: runtime.sessionId },
26
+ ...runtime.executionId === void 0 ? {} : { executionId: runtime.executionId },
27
+ ...runtime.contextTransfer === void 0 ? {} : { contextTransfer: runtime.contextTransfer }
16
28
  };
17
- const reason = outcome.error ?? "Sandbox agent run failed";
18
- if (outcome.status === "failed") return {
19
- status: "failed",
20
- reason,
21
- verdict: {
22
- valid: false,
23
- score: 0
24
- },
25
- error: {
26
- kind: "backend",
27
- message: reason
28
- }
29
+ }
30
+ /** Project canonical turn parts onto the Sandbox prompt vocabulary once. */
31
+ function promptFromAgentTurnInput(input) {
32
+ if (input.parts !== void 0) return input.parts.map(promptPartFromInputPart);
33
+ return input.prompt ?? providerMessageText(input.providerOptions) ?? "";
34
+ }
35
+ /** Project canonical turn controls onto the Sandbox prompt options once. */
36
+ function promptOptionsFromAgentTurnInput(input) {
37
+ const backend = {
38
+ ...(input.providerOptions?.backend && typeof input.providerOptions.backend === "object" && !Array.isArray(input.providerOptions.backend) ? input.providerOptions.backend : void 0) ?? {},
39
+ ...input.interactions === void 0 ? {} : { interactions: input.interactions }
29
40
  };
41
+ const runControlRef = input.controlRef === void 0 ? void 0 : AgentExactRunControlRefSchema.parse(input.controlRef);
30
42
  return {
31
- status: "blocked",
32
- reason,
33
- verdict: {
34
- valid: false,
35
- score: 0
36
- }
43
+ ...input.sessionId === void 0 ? {} : { sessionId: input.sessionId },
44
+ ...input.model === void 0 ? {} : { model: input.model },
45
+ ...input.timeoutMs === void 0 ? {} : { timeoutMs: input.timeoutMs },
46
+ ...input.context === void 0 ? {} : { context: input.context },
47
+ ...input.signal === void 0 ? {} : { signal: input.signal },
48
+ ...input.executionId === void 0 ? {} : { executionId: input.executionId },
49
+ ...input.lastEventId === void 0 ? {} : { lastEventId: input.lastEventId },
50
+ ...input.turnId === void 0 ? {} : { turnId: input.turnId },
51
+ ...input.detach === void 0 ? {} : { detach: input.detach },
52
+ ...runControlRef === void 0 ? {} : { runControlRef },
53
+ ...Object.keys(backend).length === 0 ? {} : { backend }
37
54
  };
38
55
  }
39
- /** Read an outcome that Runtime attached to one of its own executor artifacts. */
40
- function readSandboxOutcome(value) {
41
- if (!value || typeof value !== "object") return void 0;
42
- const outcome = value.outcome;
43
- if (!outcome || typeof outcome !== "object") return void 0;
44
- return outcome;
56
+ /** Read a text fallback from provider-specific conversation options. */
57
+ function providerMessageText(providerOptions) {
58
+ const messages = providerOptions?.messages;
59
+ if (!Array.isArray(messages)) return void 0;
60
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
61
+ const message = messages[index];
62
+ if (!message || typeof message !== "object" || Array.isArray(message)) continue;
63
+ if (!("role" in message) || message.role !== "user") continue;
64
+ if (!("content" in message)) continue;
65
+ if (typeof message.content === "string") return message.content;
66
+ }
67
+ }
68
+ function promptPartFromInputPart(part) {
69
+ if (part.type === "text" || part.type === "image") return part;
70
+ if (part.content !== void 0 || part.path !== void 0) throw new Error("Sandbox file prompt parts require a URL; inline content and local paths are not representable");
71
+ if (!part.filename || !part.url) throw new Error("Sandbox file prompt parts require both filename and URL");
72
+ return {
73
+ type: "file",
74
+ filename: part.filename,
75
+ ...part.mediaType === void 0 ? {} : { mediaType: part.mediaType },
76
+ url: part.url
77
+ };
45
78
  }
46
79
  //#endregion
47
- //#region src/runtime/supervise/executable-spec.ts
48
- /**
49
- * Parse one untrusted profile into the exact immutable value execution may consume.
50
- *
51
- * Snapshotting before schema parsing reads caller-owned fields once. Snapshotting the parsed
52
- * result prevents downstream custom code from changing any identity or authority field.
53
- */
54
- function executableAgentProfileSnapshot(raw, context) {
55
- const input = detachedSnapshot(raw, `${context}: AgentProfile input`);
56
- const profile = agentProfileSchema.parse(input);
57
- assertExecutableAgentProfile(profile, context);
58
- return detachedSnapshot(profile, `${context}: parsed AgentProfile`);
59
- }
60
- /** Snapshot an executable spec while retaining trusted callbacks by reference. */
61
- function executableAgentSpecSnapshot(raw, context) {
62
- const { profile: rawProfile, harness, execution: rawExecution, ...runtimeExtensions } = raw;
63
- const profile = executableAgentProfileSnapshot(rawProfile, context);
64
- const execution = rawExecution === void 0 ? void 0 : detachedSnapshot(rawExecution, `${context}: execution attribution`);
65
- return Object.freeze({
66
- ...runtimeExtensions,
67
- profile,
68
- harness,
69
- ...execution === void 0 ? {} : { execution }
80
+ //#region src/runtime/retained-run-binding.ts
81
+ function exactSession(environment, controlRef) {
82
+ if (environment.id !== controlRef.environmentId || environment.provider !== controlRef.provider) throw new Error("provider reconstructed a different retained environment");
83
+ if (!environment.session || !controlRef.sessionId) throw new Error("retained run control requires a provider session id");
84
+ const session = environment.session(controlRef.sessionId, { controlRef });
85
+ if (session.id !== controlRef.sessionId) throw new Error("provider reconstructed a different session");
86
+ if (session.controlRef === void 0) throw new Error("provider session did not return its provider-owned run control reference");
87
+ const currentControlRef = AgentExactRunControlRefSchema.parse(session.controlRef);
88
+ if (!sameControlCoordinates(currentControlRef, controlRef)) throw new Error("provider session reconstructed a different retained session");
89
+ if (canonicalCandidateDigest(currentControlRef) !== canonicalCandidateDigest(controlRef)) throw new Error("provider session did not retain the exact run control reference");
90
+ return {
91
+ session,
92
+ controlRef: currentControlRef
93
+ };
94
+ }
95
+ function sameControlCoordinates(left, right) {
96
+ return canonicalCandidateDigest(left) === canonicalCandidateDigest(right);
97
+ }
98
+ function freezeControlRef(controlRef) {
99
+ return Object.freeze({ ...AgentExactRunControlRefSchema.parse(controlRef) });
100
+ }
101
+ function copyControlRef(controlRef) {
102
+ return { ...controlRef };
103
+ }
104
+ function exactControlRef(candidate, expected) {
105
+ if (!candidate) throw new Error("provider dispatch returned no durable run control reference");
106
+ const controlRef = AgentExactRunControlRefSchema.parse(candidate);
107
+ if (controlRef.provider !== expected.provider || controlRef.environmentId !== expected.environmentId || controlRef.sessionId !== expected.sessionId) throw new Error("provider dispatch returned control coordinates for another run");
108
+ return controlRef;
109
+ }
110
+ function exactContinuedControlRef(candidate, initial) {
111
+ const controlRef = AgentExactRunControlRefSchema.parse(candidate);
112
+ if (controlRef.provider !== initial.provider || controlRef.environmentId !== initial.environmentId || controlRef.sessionId !== initial.sessionId) throw new Error("provider continuation advanced to another retained session");
113
+ if (controlRef.runId === initial.runId && controlRef.executionId === initial.executionId) throw new Error("provider continuation did not return a new exact run execution");
114
+ return controlRef;
115
+ }
116
+ function assertInteractionBinding(controlRef, command) {
117
+ if (command.binding.runId !== controlRef.runId || command.binding.provider !== controlRef.provider || command.binding.environmentId !== controlRef.environmentId || command.binding.sessionId !== controlRef.sessionId || command.binding.executionId !== controlRef.executionId) throw new Error("interaction response command does not target this retained run");
118
+ }
119
+ function assertBoundaryBinding(controlRef, proof) {
120
+ if (proof.runId !== controlRef.runId || proof.provider !== controlRef.provider || proof.environmentId !== controlRef.environmentId || proof.sessionId !== controlRef.sessionId || proof.executionId !== controlRef.executionId || proof.requestDigest !== controlRef.requestDigest) throw new Error("native context proof does not identify this retained run");
121
+ }
122
+ function assertSequence(value, label) {
123
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw new Error(`${label} must be a non-negative safe integer`);
124
+ }
125
+ function assertResultBinding(controlRef, result) {
126
+ if (result.sessionId !== controlRef.sessionId) throw new Error("provider returned a result for another retained session");
127
+ const metadata = result.metadata;
128
+ if (controlRef.executionId !== void 0 && metadata?.executionId !== controlRef.executionId) throw new Error("provider returned a result for another retained execution");
129
+ if (metadata?.runId !== controlRef.runId) throw new Error("provider returned a result for another retained run");
130
+ if (metadata?.requestDigest !== controlRef.requestDigest) throw new Error("provider returned a result for another retained request");
131
+ }
132
+ var RetainedRunProviderContractError = class extends Error {
133
+ constructor(message) {
134
+ super(message);
135
+ this.name = "RetainedRunProviderContractError";
136
+ }
137
+ };
138
+ function cancellationRequest(controlRef, operationId, reason) {
139
+ const material = {
140
+ operationId,
141
+ run: AgentExactRunControlRefSchema.parse(controlRef),
142
+ ...reason === void 0 ? {} : { reason }
143
+ };
144
+ return AgentRunCancellationRequestSchema.parse({
145
+ ...material,
146
+ requestDigest: agentRunCancellationRequestDigest(material)
147
+ });
148
+ }
149
+ async function exactSessionCancel(session, request, options) {
150
+ if (!session.cancelRun) throw new Error("provider session does not expose durable cancellation operations");
151
+ let acknowledgement;
152
+ try {
153
+ acknowledgement = await awaitAbortable(Promise.resolve().then(() => session.cancelRun(request, options)), options.signal);
154
+ } catch (error) {
155
+ if (error instanceof RetainedRunProviderContractError) throw error;
156
+ throw error;
157
+ }
158
+ let exactAcknowledgement;
159
+ try {
160
+ exactAcknowledgement = AgentRunCancellationAcknowledgementSchema.parse(acknowledgement);
161
+ } catch {
162
+ throw new RetainedRunProviderContractError("provider returned an invalid retained cancellation acknowledgement");
163
+ }
164
+ if (!agentRunCancellationAcknowledgementMatchesRequest(request, exactAcknowledgement)) throw new RetainedRunProviderContractError("provider returned a retained cancellation acknowledgement for another request");
165
+ return exactAcknowledgement;
166
+ }
167
+ function hasDurableCancel(session) {
168
+ return typeof session.cancelRun === "function";
169
+ }
170
+ async function awaitAbortable(work, signal) {
171
+ if (signal === void 0) return await work;
172
+ if (signal.aborted) {
173
+ Promise.resolve(work).catch(() => void 0);
174
+ throw abortError(signal.reason);
175
+ }
176
+ return await new Promise((resolve, reject) => {
177
+ let settled = false;
178
+ const cleanup = () => signal.removeEventListener("abort", onAbort);
179
+ const onAbort = () => {
180
+ queueMicrotask(() => {
181
+ if (settled) return;
182
+ settled = true;
183
+ cleanup();
184
+ reject(abortError(signal.reason));
185
+ });
186
+ };
187
+ signal.addEventListener("abort", onAbort, { once: true });
188
+ Promise.resolve(work).then((value) => {
189
+ if (settled) return;
190
+ settled = true;
191
+ cleanup();
192
+ resolve(value);
193
+ }, (error) => {
194
+ if (settled) return;
195
+ settled = true;
196
+ cleanup();
197
+ reject(error);
198
+ });
199
+ });
200
+ }
201
+ async function exactSessionResult(session) {
202
+ return session.result();
203
+ }
204
+ function assertEventBinding(source, controlRef) {
205
+ const transport = isRecord(source) ? source : void 0;
206
+ const payload = isRecord(source.data) ? source.data : void 0;
207
+ const providerEvent = isRecord(source.providerEvent) ? source.providerEvent : void 0;
208
+ const bindings = [
209
+ {
210
+ value: transport,
211
+ checkSessionId: true
212
+ },
213
+ {
214
+ value: payload,
215
+ checkSessionId: source.type !== "session.updated"
216
+ },
217
+ {
218
+ value: providerEvent,
219
+ checkSessionId: true
220
+ }
221
+ ];
222
+ for (const { value, checkSessionId } of bindings) {
223
+ if (value === void 0) continue;
224
+ if (value.runId !== void 0 && value.runId !== controlRef.runId) throw new Error("provider returned an event for another retained run");
225
+ if (value.executionId !== void 0 && value.executionId !== controlRef.executionId) throw new Error("provider returned an event for another retained execution");
226
+ if (checkSessionId && value.sessionId !== void 0 && value.sessionId !== controlRef.sessionId) throw new Error("provider returned an event for another retained session");
227
+ }
228
+ }
229
+ /** Validate the nested coordinates carried by a canonical interaction request. */
230
+ function assertCanonicalEventBinding(controlRef, event) {
231
+ if (event.type !== "interaction") return;
232
+ const binding = event.request.binding;
233
+ if (binding.runId !== controlRef.runId || binding.provider !== controlRef.provider || binding.environmentId !== controlRef.environmentId || binding.sessionId !== controlRef.sessionId || binding.executionId !== controlRef.executionId || binding.interactionId !== event.request.id) throw new Error("provider returned an interaction for another retained execution");
234
+ }
235
+ function isRecord(value) {
236
+ return typeof value === "object" && value !== null && !Array.isArray(value);
237
+ }
238
+ function assertStableText(value, label) {
239
+ if (value.length === 0 || value.trim() !== value) throw new Error(`${label} must be non-empty and have no outer whitespace`);
240
+ }
241
+ function abortError(reason) {
242
+ const error = new Error(reason instanceof Error ? reason.message : reason === void 0 ? "aborted" : String(reason));
243
+ error.name = "AbortError";
244
+ return error;
245
+ }
246
+ function assertWaitDuration(value, label) {
247
+ if (!Number.isSafeInteger(value) || value < 0) throw new Error(`${label} must be a non-negative safe integer`);
248
+ }
249
+ function isTerminalSessionStatus(status) {
250
+ return status === "completed" || status === "failed" || status === "cancelled" || status === "expired";
251
+ }
252
+ function delay(ms, signal) {
253
+ if (signal?.aborted) return Promise.reject(abortError(signal.reason));
254
+ return new Promise((resolveDelay, rejectDelay) => {
255
+ const timer = setTimeout(finish, ms);
256
+ function finish() {
257
+ signal?.removeEventListener("abort", onAbort);
258
+ resolveDelay();
259
+ }
260
+ function onAbort() {
261
+ clearTimeout(timer);
262
+ signal?.removeEventListener("abort", onAbort);
263
+ rejectDelay(abortError(signal?.reason));
264
+ }
265
+ signal?.addEventListener("abort", onAbort, { once: true });
70
266
  });
71
267
  }
72
268
  //#endregion
@@ -400,6 +596,6 @@ function jsonWireSnapshot(value, path = "$") {
400
596
  return out;
401
597
  }
402
598
  //#endregion
403
- export { unknownExecutionBindingReceipt as C, projectSandboxOutcome as D, executableAgentSpecSnapshot as E, readSandboxOutcome as O, runtimeOwnedScopeOwnerRuntime as S, executableAgentProfileSnapshot as T, runtimeOwnedDriveHarnessProviderEvidence as _, authoredProfileDigest as a, runtimeOwnedExecutorProviderEvidence as b, knownExecutionBindingReceipt as c, recordRuntimeOwnedDriveHarnessProviderEvidence as d, recordRuntimeOwnedProviderAttemptStart as f, runtimeOwnedDeferredExecutorRuntime as g, recordRuntimeOwnedProviderModel as h, attestRuntimeOwnedScopeOwner as i, knownMaterializationReceipt as l, recordRuntimeOwnedProviderIdentityConflict as m, attestRuntimeOwnedExecutor as n, finalizeRuntimeOwnedPendingExecutor as o, recordRuntimeOwnedProviderDispatchNotStarted as p, attestRuntimeOwnedPendingExecutor as r, inheritRuntimeOwnedExecutorAttestation as s, attestRuntimeOwnedDeferredExecutor as t, newExecutionAttemptId as u, runtimeOwnedExecutorExecutionBinding as v, unknownMaterializationReceipt as w, runtimeOwnedPendingExecutorMaterialization as x, runtimeOwnedExecutorMaterialization as y };
599
+ export { assertInteractionBinding as A, exactControlRef as B, unknownExecutionBindingReceipt as C, assertBoundaryBinding as D, abortError as E, awaitAbortable as F, hasDurableCancel as G, exactSessionCancel as H, cancellationRequest as I, freshTurnInput as J, isTerminalSessionStatus as K, copyControlRef as L, assertSequence as M, assertStableText as N, assertCanonicalEventBinding as O, assertWaitDuration as P, delay as R, runtimeOwnedScopeOwnerRuntime as S, RetainedRunProviderContractError as T, exactSessionResult as U, exactSession as V, freezeControlRef as W, promptOptionsFromAgentTurnInput as X, promptFromAgentTurnInput as Y, providerMessageText as Z, runtimeOwnedDriveHarnessProviderEvidence as _, authoredProfileDigest as a, runtimeOwnedExecutorProviderEvidence as b, knownExecutionBindingReceipt as c, recordRuntimeOwnedDriveHarnessProviderEvidence as d, recordRuntimeOwnedProviderAttemptStart as f, runtimeOwnedDeferredExecutorRuntime as g, recordRuntimeOwnedProviderModel as h, attestRuntimeOwnedScopeOwner as i, assertResultBinding as j, assertEventBinding as k, knownMaterializationReceipt as l, recordRuntimeOwnedProviderIdentityConflict as m, attestRuntimeOwnedExecutor as n, finalizeRuntimeOwnedPendingExecutor as o, recordRuntimeOwnedProviderDispatchNotStarted as p, sameControlCoordinates as q, attestRuntimeOwnedPendingExecutor as r, inheritRuntimeOwnedExecutorAttestation as s, attestRuntimeOwnedDeferredExecutor as t, newExecutionAttemptId as u, runtimeOwnedExecutorExecutionBinding as v, unknownMaterializationReceipt as w, runtimeOwnedPendingExecutorMaterialization as x, runtimeOwnedExecutorMaterialization as y, exactContinuedControlRef as z };
404
600
 
405
- //# sourceMappingURL=materialization-P86EciBw.js.map
601
+ //# sourceMappingURL=materialization-Bo6j3Hg9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materialization-Bo6j3Hg9.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\nexport function isTerminalSessionStatus(status: AgentSessionStatus | null): boolean {\n return (\n status === 'completed' || status === 'failed' || status === 'cancelled' || status === 'expired'\n )\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,c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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"}
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 { St as readTraceContextFromEnv } from "../supervisor-s8SfZYbW.js";
4
- import { C as createMcpServer, Z as DelegationTaskQueue, st as FileDelegationStore } from "../supervise-hCgG6ROJ.js";
5
- import { a as supervisorInstructions } from "../authoring-DuyShLdw.js";
3
+ import { Tt as readTraceContextFromEnv } from "../supervisor-DBVlPONC.js";
4
+ import { C as createMcpServer, Z as DelegationTaskQueue, st as FileDelegationStore } from "../supervise-BezbzKiJ.js";
5
+ import { a as supervisorInstructions } from "../authoring-Tk2xFys0.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 DelegationTraceCaps, $l as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, $u as DetachedSessionRefParts, Ad as DelegateUiAuditConfig, Au as createDelegateHandler, Bd as DelegationResultPayload, Bu as DetachedSessionDelegateOptions, Cd as DelegateCodeResult, Cu as DELEGATE_DESCRIPTION, Dd as DelegateResearchConfig, Du as DelegateError, Ed as DelegateResearchArgs, Eu as DelegateArgs, Fd as DelegationHistoryArgs, Fu as eventToSnapshot, Gd as FeedbackRefersTo, Gu as detachedSessionDelegate, Hd as DelegationStatusArgs, Hu as SettleDetachedCoderTurnOptions, Id as DelegationHistoryEntry, Iu as CoderDelegate, Jd as UiAuditLensFilter, Jl as ContinuationInstruction, Ju as FleetHandle, Kd as ResearchOutputShape, Kl as AuthorizeDownMessage, Ku as settleDetachedCoderTurn, Ld as DelegationHistoryResult, Lu as CoderReview, Md as DelegateUiAuditRoute, Mu as FeedbackEvent, Nd as DelegationError, Nu as FeedbackStore, Od as DelegateResearchResult, Ou as DelegateHandlerOptions, Pd as DelegationFeedbackSnapshot, Pu as InMemoryFeedbackStore, Qd as DELEGATION_TRACE_MAX_SPANS, Ql as CoordinationToolsOptions, Qu as createSiblingSandboxExecutor, Rd as DelegationProfile, Ru as CoderReviewer, Sd as DelegateCodeConfig, Su as createMcpServer, Td as DelegateFeedbackResult, Tu as DELEGATE_TOOL_NAME, Ud as DelegationStatusResult, Ul as AnalystFindingEvent, Uu as UiAuditorDelegate, Vd as DelegationStatus, Vu as DetachedWinnerSelection, Wd as FeedbackRating, Wl as AnalystRegistry, Wu as coderTaskFromArgs, Xd as CappedDelegationTrace, Xf as CoderOutput, Xl as CoordinationEvent, Xu as SiblingSandboxExecutorOptions, Yd as UiAuditorDelegationOutput, Yu as FleetWorkspaceExecutorOptions, Zd as DELEGATION_TRACE_MAX_BYTES, Zl as CoordinationTools, Zu as createFleetWorkspaceExecutor, _d as DelegationTaskQueueOptions, _u as createCoordinationTools, ad as createDetachedTurnResumeDriver, af as createDelegationTraceCollector, au as Question, bd as hashIdempotencyInput, bu as McpServerOptions, cd as parseDetachedSessionRef, cf as DelegationStore, cu as QuestionOption, dd as DelegationRecord, df as InMemoryDelegationStore, du as QuestionUrgency, ed as DetachedTurn, ef as DelegationTraceCollector, eu as DownMessageAuthorizationInput, fd as DelegationResumeContext, fu as SettledWorker, gd as DelegationTaskQueue, hd as DelegationRunContext, hu as WorkerWatchOptions, id as RunDetachedTurnOptions, if as composeLoopTraceEmitters, iu as MakeWorkerAgent, jd as DelegateUiAuditResult, ju as validateDelegateArgs, kd as DelegateUiAuditArgs, ku as DelegateResult, ld as runDetachedTurn, lf as FileDelegationStore, lu as QuestionPolicy, md as DelegationResumeTick, mu as WorkerSpawnContext, nd as DriveTurnCapableBox, nf as buildDelegationTraceSpans, nu as DownMessageDeliveryOutcome, od as detachedTurnEvents, of as DelegationPersistenceError, ou as QuestionDecision, pd as DelegationResumeDriver, qd as ResearchSource, ql as AuthorizedDownMessage, qu as DelegationExecutor, rd as DriveTurnTick, rf as capDelegationTrace, ru as DownMessageEvent, sd as formatDetachedSessionRef, sf as DelegationStateCorruptError, su as QuestionLevel, td as DetachedTurnResumeDriverOptions, tf as DelegationTraceSpan, tu as DownMessageDeliveryAttempt, ud as DelegationArgs, uf as FileDelegationStoreOptions, uu as QuestionRecord, vd as SubmitInput, wd as DelegateFeedbackArgs, wu as DELEGATE_INPUT_SCHEMA, xd as DelegateCodeArgs, xu as createInProcessTransport, yd as SubmitOutput, yu as McpServer, zd as DelegationProgress, zu as DelegateRunCtx } from "../index-C2caGomG.js";
3
- import { dt as mergeTraceEnv, ft as readTraceContextFromEnv, lt as TraceContext, pt as traceContextToEnv, ut as createPropagatingTraceEmitter } from "../types-Df9vulGc.js";
4
- import { $ as RemoveWorktreeOptions, At as JsonRpcMessage, B as DEFAULT_LOCAL_HARNESS, G as harnessSupportsReasoningEffort, H as LocalHarness, J as runLocalHarness, K as localHarnessExecutable, L as CodexExecutionEvidence, Mt as McpToolDescriptor, Nt as McpTransport, Q as GitRunner, R as CodexExecutionPolicy, U as LocalHarnessResult, V as LOCAL_HARNESSES, W as RunLocalHarnessOptions, X as DiffOptions, Y as CreateWorktreeOptions, Z as DiffResult, et as WorktreeHandle, jt as JsonRpcResponse, nt as createWorktree, q as parseCodexTokenUsage, rt as removeWorktree, tt as captureWorktreeDiff, z as CodexTokenUsage } from "../runtime-J6Toky8K.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-Dlz7ejRx.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";
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";
package/dist/mcp/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { i as ConfigError, m as ValidationError } from "../errors-CDZ8XsVj.js";
2
- import { d as sleep, i as deleteBoxSafe, m as throwIfAborted, p as throwAbort } from "../util-C1bv6yog.js";
3
- import { t as assertExecutableAgentProfile } from "../model-policy-DgRJIJse.js";
4
- import { Ct as traceContextToEnv, Gt as createWorktree, Jt as LOCAL_HARNESSES, Kt as removeWorktree, Qt as CodexExecutionDiagnosticError, St as readTraceContextFromEnv, Ut as runWorktreeHarness, Wt as captureWorktreeDiff, Xt as localHarnessExecutable, Yt as harnessSupportsReasoningEffort, Zt as parseCodexTokenUsage, bt as createPropagatingTraceEmitter, ft as runAgentRounds, lt as createSandboxForSpec, qt as DEFAULT_LOCAL_HARNESS, xt as mergeTraceEnv } from "../supervisor-s8SfZYbW.js";
5
- import { T as runCoderChecks, dt as selectValidWinner } from "../runtime-BnqjbOGX.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, Dt as createCoordinationTools, 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, O as validateDelegationStatusArgs, P as DELEGATE_UI_AUDIT_DESCRIPTION, Q as hashIdempotencyInput, R as validateDelegateUiAuditArgs, S as createInProcessTransport, T as DELEGATION_STATUS_INPUT_SCHEMA, Tt as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, 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, 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-hCgG6ROJ.js";
2
+ import { g as throwIfAborted, h as throwAbort, o as deleteBoxSafe, p as sleep } from "../util-Bncw0o_F.js";
3
+ import { t as assertExecutableAgentProfile } from "../model-policy-Sw4ywhtL.js";
4
+ import { $t as localHarnessExecutable, Ct as createPropagatingTraceEmitter, Et as traceContextToEnv, Jt as createWorktree, Kt as runWorktreeHarness, Qt as harnessSupportsReasoningEffort, Tt as readTraceContextFromEnv, Xt as DEFAULT_LOCAL_HARNESS, Yt as removeWorktree, Zt as LOCAL_HARNESSES, en as parseCodexTokenUsage, ft as createSandboxForSpec, ht as runAgentRounds, qt as captureWorktreeDiff, tn as CodexExecutionDiagnosticError, wt as mergeTraceEnv } from "../supervisor-DBVlPONC.js";
5
+ import { E as runCoderChecks, ft as selectValidWinner } from "../runtime-RY_rvv7t.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-BezbzKiJ.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-BiAWKjh6.js";
9
+ import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-CWBywy-e.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";