@tangle-network/agent-runtime 0.155.0 → 0.157.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 (81) hide show
  1. package/dist/{activation-B4fRz8QL.js → activation-CLicee7D.js} +3 -3
  2. package/dist/{activation-B4fRz8QL.js.map → activation-CLicee7D.js.map} +1 -1
  3. package/dist/agent.d.ts +2 -2
  4. package/dist/agent.js +2 -2
  5. package/dist/analyst-loop.d.ts +1 -1
  6. package/dist/{authoring-8NW3YQvI.js → authoring-rIDPzwYY.js} +2 -2
  7. package/dist/{authoring-8NW3YQvI.js.map → authoring-rIDPzwYY.js.map} +1 -1
  8. package/dist/candidate-execution/index.js +4 -4
  9. package/dist/{candidate-execution-Ic92NMl9.js → candidate-execution-izJj02pU.js} +4 -4
  10. package/dist/{candidate-execution-Ic92NMl9.js.map → candidate-execution-izJj02pU.js.map} +1 -1
  11. package/dist/conversation.d.ts +1 -1
  12. package/dist/durable.d.ts +11 -8
  13. package/dist/durable.js +2 -4
  14. package/dist/durable.js.map +1 -1
  15. package/dist/{environment-provider-Dz9JB-X_.js → environment-provider-Bn3652YU.js} +2 -2
  16. package/dist/{environment-provider-Dz9JB-X_.js.map → environment-provider-Bn3652YU.js.map} +1 -1
  17. package/dist/{environment-provider-C_QI6VCG.d.ts → environment-provider-BobKk46F.d.ts} +3 -3
  18. package/dist/environment-provider.d.ts +1 -1
  19. package/dist/environment-provider.js +1 -1
  20. package/dist/{graph-BCzC-tnl.js → graph-mN5HXKys.js} +3 -3
  21. package/dist/{graph-BCzC-tnl.js.map → graph-mN5HXKys.js.map} +1 -1
  22. package/dist/{improvement-cycle-g6RsxGbg.js → improvement-cycle-BEENaoCb.js} +11 -7
  23. package/dist/improvement-cycle-BEENaoCb.js.map +1 -0
  24. package/dist/{index-DPFUNEdU.d.ts → index-CLt9zpuD.d.ts} +3 -3
  25. package/dist/{index-DU6lU9GO.d.ts → index-DLnHBu3V.d.ts} +4 -4
  26. package/dist/{index-CNqUQfuv.d.ts → index-DiLGPhai.d.ts} +22 -14
  27. package/dist/index.d.ts +9 -9
  28. package/dist/index.js +11 -11
  29. package/dist/intelligence.d.ts +7 -11
  30. package/dist/intelligence.js +6 -6
  31. package/dist/intelligence.js.map +1 -1
  32. package/dist/kernel.d.ts +7 -7
  33. package/dist/kernel.js +8 -8
  34. package/dist/{knowledge-BDoJh3Me.js → knowledge-HDCUV1kZ.js} +5 -5
  35. package/dist/{knowledge-BDoJh3Me.js.map → knowledge-HDCUV1kZ.js.map} +1 -1
  36. package/dist/knowledge.d.ts +1 -1
  37. package/dist/knowledge.js +1 -1
  38. package/dist/{loop-runner-bin-mX79dLj2.d.ts → loop-runner-bin-BsmAByJ1.d.ts} +3 -3
  39. package/dist/{loop-runner-bin-DyoELXnJ.js → loop-runner-bin-jnF_gdWU.js} +3 -3
  40. package/dist/{loop-runner-bin-DyoELXnJ.js.map → loop-runner-bin-jnF_gdWU.js.map} +1 -1
  41. package/dist/loop-runner-bin.d.ts +1 -1
  42. package/dist/loop-runner-bin.js +1 -1
  43. package/dist/mcp/bin.js +3 -3
  44. package/dist/mcp/index.d.ts +8 -8
  45. package/dist/mcp/index.js +6 -6
  46. package/dist/mcp/index.js.map +1 -1
  47. package/dist/{openai-tools-DUOEbKMV.js → openai-tools-D1VQ5e9p.js} +2 -2
  48. package/dist/{openai-tools-DUOEbKMV.js.map → openai-tools-D1VQ5e9p.js.map} +1 -1
  49. package/dist/{openai-tools-z-whdYNC.d.ts → openai-tools-wkxQ2aEw.d.ts} +2 -2
  50. package/dist/{prepare-DcMjMdj-.js → prepare-VLGnSyav.js} +2 -2
  51. package/dist/{prepare-DcMjMdj-.js.map → prepare-VLGnSyav.js.map} +1 -1
  52. package/dist/primeintellect/index.d.ts +1 -1
  53. package/dist/profiles.d.ts +2 -166
  54. package/dist/{protected-model-port-BzUkspPP.js → protected-model-port-CcCH0Uji.js} +2 -2
  55. package/dist/{protected-model-port-BzUkspPP.js.map → protected-model-port-CcCH0Uji.js.map} +1 -1
  56. package/dist/{redact-BT7-mX8G.d.ts → redact-0AK8JmHW.d.ts} +13 -10
  57. package/dist/researcher-BMFFPwKb.js.map +1 -1
  58. package/dist/{runtime-DuueBLeO.d.ts → runtime-BzY66cd6.d.ts} +4 -4
  59. package/dist/{runtime-DW9t84HW.js → runtime-DVU0WZUA.js} +8 -8
  60. package/dist/{runtime-DW9t84HW.js.map → runtime-DVU0WZUA.js.map} +1 -1
  61. package/dist/{spawn-journal-duo0EkOp.js → spawn-journal-oewq1g2h.js} +1 -4
  62. package/dist/{spawn-journal-duo0EkOp.js.map → spawn-journal-oewq1g2h.js.map} +1 -1
  63. package/dist/{stream-agent-turn-BbcwWw_J.d.ts → stream-agent-turn-jaaFaSXM.d.ts} +3 -3
  64. package/dist/{structural-rollout-B1TocSdq.js → structural-rollout-Cj58xALQ.js} +3 -3
  65. package/dist/{structural-rollout-B1TocSdq.js.map → structural-rollout-Cj58xALQ.js.map} +1 -1
  66. package/dist/substrate-AJoT4HIz.d.ts +284 -0
  67. package/dist/{supervise-gZ3xYJs3.js → supervise-CqwjiXlX.js} +26 -9
  68. package/dist/supervise-CqwjiXlX.js.map +1 -0
  69. package/dist/{supervisor-BmXD0WCJ.js → supervisor-ZlQy5Fwl.js} +6 -33
  70. package/dist/supervisor-ZlQy5Fwl.js.map +1 -0
  71. package/dist/testing.d.ts +2 -2
  72. package/dist/testing.js +12 -12
  73. package/dist/{types-Cz5mCGlY.d.ts → types-BBXdSns1.d.ts} +8 -8
  74. package/dist/{types-DeX8ibLc.d.ts → types-DpdfZoQ3.d.ts} +6 -3
  75. package/dist/{workspace-archive-bugA3OwU.js → workspace-archive-BptlGCEU.js} +2 -2
  76. package/dist/{workspace-archive-bugA3OwU.js.map → workspace-archive-BptlGCEU.js.map} +1 -1
  77. package/package.json +3 -3
  78. package/dist/improvement-cycle-g6RsxGbg.js.map +0 -1
  79. package/dist/substrate-BcnuSHXm.d.ts +0 -117
  80. package/dist/supervise-gZ3xYJs3.js.map +0 -1
  81. package/dist/supervisor-BmXD0WCJ.js.map +0 -1
@@ -0,0 +1,284 @@
1
+ import { k as Validator, r as Driver, t as AgentRunSpec, w as OutputAdapter } from "./types-DpdfZoQ3.js";
2
+ import { AgentProfile } from "@tangle-network/agent-interface";
3
+ //#region src/profiles/coder.d.ts
4
+ /**
5
+ *
6
+ * `CoderTask` + `coderTaskToPrompt` — the per-task DATA + pure formatter for code-modification tasks
7
+ * (§1.5: the system authors profiles; there is no hardcoded coder profile constant). A domain
8
+ * customizes the worker by authoring its own `AgentProfile` and handing it to a leaf executor
9
+ * (`createWorktreeCliExecutor`) or a fanout (`worktreeFanout`); "is it delivered" is a
10
+ * `DeliverableSpec` (`patchDelivered`), not a bundled validator. This formatter renders a `CoderTask`
11
+ * into the per-task instruction that profile receives.
12
+ *
13
+ * @experimental
14
+ */
15
+ /** @experimental The per-task inputs `coderTaskToPrompt` renders + the worktree gate enforces. */
16
+ interface CoderTask {
17
+ /** What the agent must accomplish. Free-form prose. */
18
+ goal: string;
19
+ /** Absolute path inside the sandbox where the repo lives. */
20
+ repoRoot: string;
21
+ /** Default `main`. The branch the agent diffs against. */
22
+ baseBranch?: string;
23
+ /** Default `pnpm test --run`. */
24
+ testCmd?: string;
25
+ /** Default `pnpm typecheck`. */
26
+ typecheckCmd?: string;
27
+ /** Files the agent may inspect for context. Surfaced verbatim in the prompt. */
28
+ contextFiles?: string[];
29
+ /**
30
+ * Paths the agent must not touch. The mechanical gate hard-fails on any match.
31
+ * Use glob-free literal path prefixes for unambiguous enforcement.
32
+ */
33
+ forbiddenPaths?: string[];
34
+ /** Default 400. Hard cap; the gate hard-fails when exceeded. */
35
+ maxDiffLines?: number;
36
+ }
37
+ /** Render a `CoderTask` into the per-task instruction handed to the coder profile. @experimental */
38
+ declare function coderTaskToPrompt(task: CoderTask): string;
39
+ //#endregion
40
+ //#region src/profiles/researcher.d.ts
41
+ /** Source families a researcher profile may prefer for a task. One owner: the delegation
42
+ * vocabulary (`DelegateResearchArgs.sources`) re-exports this type rather than restating it.
43
+ * @experimental */
44
+ type ResearchSource = 'web' | 'corpus' | 'twitter' | 'github' | 'docs';
45
+ /** Task contract for a source-grounded research agent. @experimental */
46
+ interface ResearchTask {
47
+ /** The research question to answer. */
48
+ question: string;
49
+ /** Bound: e.g. "audience for cpg-founder ICP". */
50
+ scope?: string;
51
+ /** Multi-tenant scope (customer-id, workspace-id). Validator enforces. */
52
+ knowledgeNamespace: string;
53
+ sources?: ResearchSource[];
54
+ recencyWindow?: {
55
+ since?: Date;
56
+ until?: Date;
57
+ };
58
+ maxItems?: number;
59
+ /** Per-item minimum confidence in [0, 1]. Validator scores recall vs this. */
60
+ minConfidence?: number;
61
+ }
62
+ /**
63
+ * Knowledge item emitted by the researcher.
64
+ *
65
+ * Profile-local type. When agent-knowledge promotes `KnowledgeClaim` →
66
+ * top-level `KnowledgeItem` substrate-wide, these fields collapse 1:1.
67
+ *
68
+ * @experimental
69
+ */
70
+ interface KnowledgeItem {
71
+ id: string;
72
+ /** Multi-tenant scope. MUST equal `task.knowledgeNamespace`. */
73
+ namespace: string;
74
+ /** The factual claim, in the researcher's words. */
75
+ claim: string;
76
+ /** Provenance — at least one entry required. */
77
+ evidence: Array<{
78
+ source: string;
79
+ quote?: string;
80
+ url?: string;
81
+ capturedAt: number;
82
+ }>;
83
+ /** Researcher's self-reported confidence in [0, 1]. */
84
+ confidence: number;
85
+ /** Prior item ids this supersedes (chain). */
86
+ supersedes?: string[];
87
+ /** Set if the agent is retracting an earlier item. Unix ms. */
88
+ retractedAt?: number;
89
+ authoredBy: {
90
+ kind: 'human' | 'agent';
91
+ id: string;
92
+ };
93
+ }
94
+ /**
95
+ * A proposed write to the knowledge base. The profile does NOT apply
96
+ * these — the caller decides.
97
+ *
98
+ * @experimental
99
+ */
100
+ type KnowledgeUpdate = {
101
+ kind: 'insert';
102
+ namespace: string;
103
+ item: KnowledgeItem;
104
+ } | {
105
+ kind: 'supersede';
106
+ namespace: string;
107
+ previousId: string;
108
+ item: KnowledgeItem;
109
+ } | {
110
+ kind: 'retract';
111
+ namespace: string;
112
+ itemId: string;
113
+ reason: string;
114
+ };
115
+ /**
116
+ * Researcher output. Required fields are typed; optional fields preserve
117
+ * the agent's free-form intelligence (`notes`, `raw`). The validator
118
+ * enforces the typed minimum.
119
+ *
120
+ * @experimental
121
+ */
122
+ interface ResearchOutput {
123
+ items: KnowledgeItem[];
124
+ citations: Array<{
125
+ url: string;
126
+ quote: string;
127
+ confidence: number;
128
+ }>;
129
+ proposedWrites: KnowledgeUpdate[];
130
+ gaps?: string[];
131
+ notes?: string;
132
+ /** Anything the agent emitted beyond the typed fields. */
133
+ raw?: unknown;
134
+ }
135
+ /** Options for the source-grounded researcher profile preset. @experimental */
136
+ interface ResearcherProfileOptions {
137
+ /** Caller-owned exact harness/provider/model identity. */
138
+ profile: AgentProfile;
139
+ /** Custom system prompt replacement. Default = built-in researcher preset. */
140
+ systemPrompt?: string;
141
+ /** Stable name for `AgentRunSpec.name`. Default = `profile.name`. */
142
+ name?: string;
143
+ /**
144
+ * Default 0.7. Minimum (citations with quote) / items ratio for `valid=true`.
145
+ * Below this floor, citation_density scores < 1 and the item set is gated.
146
+ */
147
+ citationDensityMin?: number;
148
+ }
149
+ /** Build a source-grounded researcher profile with output parsing and validation. @experimental */
150
+ declare function researcherProfile(options: ResearcherProfileOptions & {
151
+ task?: ResearchTask;
152
+ }): {
153
+ profile: AgentProfile;
154
+ taskToPrompt: (task: ResearchTask) => string;
155
+ output: OutputAdapter<ResearchOutput>;
156
+ validator: Validator<ResearchOutput>;
157
+ agentRunSpec: AgentRunSpec<ResearchTask>;
158
+ };
159
+ /** @experimental */
160
+ interface MultiHarnessResearcherFanoutOptions {
161
+ /** Exact execution profiles, one per parallel researcher. */
162
+ profiles: ReadonlyArray<AgentProfile>;
163
+ /** Default citation density floor for the shared validator. */
164
+ citationDensityMin?: number;
165
+ /** Optional task — narrows the validator's namespace check. */
166
+ task?: ResearchTask;
167
+ }
168
+ /**
169
+ * Build a fanout topology over multiple harnesses. The kernel round-robins
170
+ * `agentRuns` across the N parallel iterations and the `FanoutVote` driver
171
+ * picks the highest-scoring valid output.
172
+ *
173
+ * @experimental
174
+ */
175
+ declare function multiHarnessResearcherFanout(options: MultiHarnessResearcherFanoutOptions): {
176
+ agentRuns: AgentRunSpec<ResearchTask>[];
177
+ output: OutputAdapter<ResearchOutput>;
178
+ validator: Validator<ResearchOutput>;
179
+ driver: Driver<ResearchTask, ResearchOutput, 'done'>;
180
+ };
181
+ /**
182
+ * Build a validator that closes over a specific `ResearchTask`'s constraints.
183
+ *
184
+ * Checks in order:
185
+ * 1. Items must be non-empty.
186
+ * 2. Every item carries `evidence.length >= 1`.
187
+ * 3. Every item + proposedWrite is scoped to `task.knowledgeNamespace`
188
+ * (hard-fail on any namespace mismatch — defence in depth for the
189
+ * multi-tenant invariant).
190
+ * 4. Citation density (citations with quote / items) >= floor.
191
+ *
192
+ * Aggregate score:
193
+ * 0.4 · citation_density
194
+ * + 0.2 · source_diversity (distinct sources / max(items, 1))
195
+ * + 0.2 · recency_match (mean fraction within `recencyWindow`)
196
+ * + 0.2 · (1 − gaps/maxGaps), maxGaps = max(items, 1)
197
+ *
198
+ * @experimental
199
+ */
200
+ declare function createResearcherValidator(task: ResearchTask, config?: {
201
+ citationDensityMin?: number;
202
+ namespaceCheck?: boolean;
203
+ }): Validator<ResearchOutput>;
204
+ //#endregion
205
+ //#region src/profiles/ui-auditor/substrate.d.ts
206
+ /**
207
+ *
208
+ * UI audit finding shapes — the unit of evidence a contributor can act on.
209
+ *
210
+ * A finding describes a single, actionable UI problem: lens, severity,
211
+ * route, observation, impact, suggested fix, and screenshot evidence.
212
+ * Findings are produced by the auditor profile, persisted by the issue
213
+ * writer as self-contained GitHub-issue Markdown, and surfaced over MCP.
214
+ *
215
+ * The shapes are deliberately constraining — the validator + writer
216
+ * hard-fail on missing screenshot evidence, missing lens, missing title.
217
+ *
218
+ * @experimental
219
+ */
220
+ /**
221
+ * Canonical audit lenses. Each lens scopes a finding to a single class of
222
+ * problem so a single audit pass can iterate them without pile-on findings
223
+ * under a generic label.
224
+ */
225
+ type UiLens = 'consistency' | 'hierarchy' | 'layout' | 'ux-flow' | 'duplication' | 'accessibility' | 'responsive' | 'states' | 'content' | 'interaction' | 'performance-perceived' | 'other';
226
+ /** Frozen tuple of lenses for validation + iteration. */
227
+ declare const UI_LENSES: readonly UiLens[];
228
+ /**
229
+ * Severity scale.
230
+ * - `critical` — blocks a core task or is an accessibility blocker.
231
+ * - `high` — confusing, broken-looking, or noticeable friction.
232
+ * - `med` — visible polish issue, would be caught in code review.
233
+ * - `low` — nitpick worth fixing eventually.
234
+ */
235
+ type UiFindingSeverity = 'low' | 'med' | 'high' | 'critical';
236
+ /** Frozen severity tuple, ordered worst → least bad for sort/report. */
237
+ declare const UI_FINDING_SEVERITIES: readonly UiFindingSeverity[];
238
+ /** Pointer to a screenshot referenced by a finding (workspace-relative path). */
239
+ interface UiFindingScreenshot {
240
+ path: string;
241
+ viewport?: string;
242
+ label?: string;
243
+ }
244
+ /**
245
+ * A single UI audit finding — the unit of work a contributor can act on.
246
+ *
247
+ * Every field except the documented optionals is required. The auditor
248
+ * validator + writer hard-fail on missing screenshot evidence, missing
249
+ * lens, missing title, etc.
250
+ */
251
+ interface UiFinding {
252
+ /** Monotonic id assigned by the writer when persisting. Optional in-transit. */
253
+ id?: number;
254
+ title: string;
255
+ lens: UiLens;
256
+ severity: UiFindingSeverity;
257
+ /** Logical route the finding was observed on (e.g. `home`, `checkout-step-2`). */
258
+ route: string;
259
+ /** Fully qualified URL the finding was observed at. */
260
+ url?: string;
261
+ /** Viewport string the offending capture was taken at (e.g. `1280x800`). */
262
+ viewport?: string;
263
+ /** CSS selector pinning the offending element, when one can be identified. */
264
+ selector?: string;
265
+ /** 1–3 sentences describing what the screenshot shows that is wrong. */
266
+ observation: string;
267
+ /** Who is affected and how. */
268
+ impact: string;
269
+ /** A specific change a contributor could apply without asking back. */
270
+ suggestedFix: string;
271
+ /** Optional explicit reproduction steps. Writer synthesizes from route/url/selector when omitted. */
272
+ reproSteps?: string;
273
+ /** Free-form tags. */
274
+ tags?: readonly string[];
275
+ /** Screenshot references — must be non-empty for actionable findings. */
276
+ screenshots: readonly UiFindingScreenshot[];
277
+ /** Cross-references to similar findings already on file, by id. */
278
+ similarTo?: readonly number[];
279
+ /** ISO-8601 creation timestamp set by the writer when persisted. */
280
+ createdAt?: string;
281
+ }
282
+ //#endregion
283
+ export { CoderTask as _, UiFindingSeverity as a, KnowledgeUpdate as c, ResearchSource as d, ResearchTask as f, researcherProfile as g, multiHarnessResearcherFanout as h, UiFindingScreenshot as i, MultiHarnessResearcherFanoutOptions as l, createResearcherValidator as m, UI_LENSES as n, UiLens as o, ResearcherProfileOptions as p, UiFinding as r, KnowledgeItem as s, UI_FINDING_SEVERITIES as t, ResearchOutput as u, coderTaskToPrompt as v };
284
+ //# sourceMappingURL=substrate-AJoT4HIz.d.ts.map
@@ -1,11 +1,11 @@
1
1
  import { C as runtimeOwnedScopeOwnerRuntime, S as runtimeOwnedPendingExecutorMaterialization, b as runtimeOwnedExecutorMaterialization, d as providerAttemptEvidence, f as recordRuntimeOwnedDriveHarnessProviderEvidence, i as attestRuntimeOwnedScopeOwner, s as inheritRuntimeOwnedExecutorAttestation, v as runtimeOwnedDriveHarnessProviderEvidence, x as runtimeOwnedExecutorProviderEvidence, y as runtimeOwnedExecutorExecutionBinding } from "./materialization-Ct3I4wu3.js";
2
2
  import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError, o as NotFoundError, r as BackendTransportError, t as AgentEvalError$1 } from "./errors-CDZ8XsVj.js";
3
3
  import { n as detachedSnapshot, t as detachedFrozen } from "./snapshot-CTAf4uuA.js";
4
- import { b as workerTraceAnalysisStore, i as InMemorySpawnJournal, n as FileSpawnJournal, r as InMemoryResultBlobStore, t as FileResultBlobStore, x as contentAddress, y as parseWorkerToolTraceArtifact } from "./spawn-journal-duo0EkOp.js";
4
+ import { b as workerTraceAnalysisStore, i as InMemorySpawnJournal, n as FileSpawnJournal, r as InMemoryResultBlobStore, t as FileResultBlobStore, x as contentAddress, y as parseWorkerToolTraceArtifact } from "./spawn-journal-oewq1g2h.js";
5
5
  import { _ as unmeteredSpend, r as chargedTokens, u as promptCacheTokenClasses } from "./util-D6ZEuBMi.js";
6
6
  import { i as writeAllBytes, n as parseCommittedJsonLines, r as prepareJsonlAppend, t as isNoEntError } from "./jsonl-file-CDfsCI5s.js";
7
7
  import { a as concreteProfileModel, c as profileModelExecutionSettings, d as agentHarness, f as harnessRunsAgent, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile } from "./model-policy-Sw4ywhtL.js";
8
- import { B as createExecutorRegistry, D as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, F as bridgeRuntimeAttachmentsKey, I as bridgeStopSignalKey, L as captureReusableExecutorConfig, Lt as generateSpanId, M as bindReusableExecutorExecutionId, N as bridgeAdmissionRead, O as teardownExecutor, P as bridgeModelRouteRefusal, Pt as createOtelExporter, St as runBrainLoop, U as WORKER_TRACE_PROPAGATION, V as snapshotExecutorConfig, Vt as toOtelAttributes, _n as unsupportedProfileDimensions, a as pickBestDelivered, an as assertProfileMaterialization, c as driverChild, cn as fullProfileMaterialization, d as deriveNodeExecutionIdentity, dn as promptModelProfileMaterialization, dt as isLiveNodeStatus, f as meterRuntimeOwnedAccounting, ft as isTerminalNodeStatus, h as scopeOwnerExecutorNodeContext, hn as renderUnsupported, j as spendFromUsageEvents, jt as buildLoopSpanNodes, k as assertValidBudget, l as withDriverExecutor, ln as profileMaterializationAxes$1, m as recordScopeOwnerMaterialization, n as createSupervisor, nt as createInbox, o as runFinalizer, on as controlProfileMaterialization, p as meterRuntimeOwnedProviderAttempt, r as bestDelivered, s as runTree, sn as defineProfileMaterializationContract, st as createPeerMailbox, t as createRootHandle, un as promptControlProfileMaterialization, w as freeSlots, xt as routerBrain, yn as worktreeCliProfileMaterialization, z as createExecutor } from "./supervisor-BmXD0WCJ.js";
8
+ import { B as createExecutorRegistry, D as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, F as bridgeRuntimeAttachmentsKey, I as bridgeStopSignalKey, L as captureReusableExecutorConfig, Lt as generateSpanId, M as bindReusableExecutorExecutionId, N as bridgeAdmissionRead, O as teardownExecutor, P as bridgeModelRouteRefusal, Pt as createOtelExporter, St as runBrainLoop, U as WORKER_TRACE_PROPAGATION, V as snapshotExecutorConfig, Vt as toOtelAttributes, _n as unsupportedProfileDimensions, a as pickBestDelivered, an as assertProfileMaterialization, c as driverChild, cn as fullProfileMaterialization, d as deriveNodeExecutionIdentity, dn as promptModelProfileMaterialization, dt as isLiveNodeStatus, f as meterRuntimeOwnedAccounting, ft as isTerminalNodeStatus, h as scopeOwnerExecutorNodeContext, hn as renderUnsupported, j as spendFromUsageEvents, jt as buildLoopSpanNodes, k as assertValidBudget, l as withDriverExecutor, ln as profileMaterializationAxes$1, m as recordScopeOwnerMaterialization, n as createSupervisor, nt as createInbox, o as runFinalizer, on as controlProfileMaterialization, p as meterRuntimeOwnedProviderAttempt, r as bestDelivered, s as runTree, sn as defineProfileMaterializationContract, st as createPeerMailbox, t as createRootHandle, un as promptControlProfileMaterialization, w as freeSlots, xt as routerBrain, yn as worktreeCliProfileMaterialization, z as createExecutor } from "./supervisor-ZlQy5Fwl.js";
9
9
  import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
10
10
  import { C as writeWorkerCancellation, S as writeRunCancellation, a as readRunCancelRequest, c as readWorkerCancellation, o as readRunCancellation, s as readWorkerCancelRequests } from "./run-layout-C2jgwsCq.js";
11
11
  import { t as createStdioToolServer } from "./tool-server-DEmLr9YY.js";
@@ -143,6 +143,10 @@ function createEventBus(now = Date.now) {
143
143
  *
144
144
  * @experimental
145
145
  */
146
+ /** Where a question this driver cannot answer goes next. `answer_question` accepts these and
147
+ * nothing else, so the decision type states them and nothing else. */
148
+ const questionEscalationTargets = ["parent", "user"];
149
+ const isQuestionEscalationTarget = (value) => questionEscalationTargets.includes(value);
146
150
  /** Producer-side cleanliness for the `finding` event. The findings payload is arbitrary analyst
147
151
  * output, the digest a subscriber computes (RFC 8785) throws on ANY `undefined` value — nested
148
152
  * included — and a throwing subscriber leaves the event invisible to EVERY subscriber. The
@@ -1433,7 +1437,7 @@ function createCoordinationTools(opts) {
1433
1437
  deferReason: { type: "string" },
1434
1438
  escalateTo: {
1435
1439
  type: "string",
1436
- enum: ["parent", "user"]
1440
+ enum: questionEscalationTargets
1437
1441
  },
1438
1442
  escalateReason: { type: "string" }
1439
1443
  },
@@ -1468,7 +1472,8 @@ function createCoordinationTools(opts) {
1468
1472
  kind: "defer",
1469
1473
  reason: a.deferReason
1470
1474
  }) });
1471
- if (a.escalateTo === "parent" || a.escalateTo === "user") {
1475
+ if (typeof a.escalateTo === "string" && a.escalateTo.length > 0) {
1476
+ if (!isQuestionEscalationTarget(a.escalateTo)) throw new Error(`answer_question: escalateTo must be one of ${questionEscalationTargets.join(", ")}; received ${JSON.stringify(a.escalateTo)}`);
1472
1477
  const escalateReason = typeof a.escalateReason === "string" && a.escalateReason.length > 0 ? a.escalateReason : "driver escalated";
1473
1478
  return Promise.resolve({ question: decideQuestion(questionId, {
1474
1479
  kind: "escalate",
@@ -4846,6 +4851,18 @@ function defaultEstimate(args) {
4846
4851
  return PER_LENS_PER_ROUTE_ESTIMATE_MS * lenses * routes;
4847
4852
  }
4848
4853
  //#endregion
4854
+ //#region src/mcp/types.ts
4855
+ /**
4856
+ * Every delegation profile a queued record can carry. One owner: the tool schemas and validators
4857
+ * that filter on a profile read this list, so a profile added here cannot be one a tool refuses.
4858
+ * @experimental
4859
+ */
4860
+ const delegationProfiles = [
4861
+ "coder",
4862
+ "researcher",
4863
+ "ui-auditor"
4864
+ ];
4865
+ //#endregion
4849
4866
  //#region src/mcp/tools/delegation-history.ts
4850
4867
  /** MCP tool name for the `delegation_history` read-past-delegations tool. @stable */
4851
4868
  const DELEGATION_HISTORY_TOOL_NAME = "delegation_history";
@@ -4865,7 +4882,7 @@ const DELEGATION_HISTORY_DESCRIPTION = [
4865
4882
  "Each entry carries `hasTrace` — when true, the full loop-trace span tree",
4866
4883
  "is retrievable via delegation_status { taskId, includeTrace: true }.",
4867
4884
  "",
4868
- "Filters: `namespace` (multi-tenant scope), `profile` (\"coder\" | \"researcher\"),",
4885
+ `Filters: \`namespace\` (multi-tenant scope), \`profile\` (${delegationProfiles.map((profile) => `"${profile}"`).join(" | ")}),`,
4869
4886
  "`since` (ISO date — only delegations started at-or-after). `limit` defaults",
4870
4887
  "to 50, capped at 500."
4871
4888
  ].join("\n");
@@ -4876,7 +4893,7 @@ const DELEGATION_HISTORY_INPUT_SCHEMA = {
4876
4893
  namespace: { type: "string" },
4877
4894
  profile: {
4878
4895
  type: "string",
4879
- enum: ["coder", "researcher"]
4896
+ enum: delegationProfiles
4880
4897
  },
4881
4898
  since: {
4882
4899
  type: "string",
@@ -4901,7 +4918,7 @@ function validateDelegationHistoryArgs(raw) {
4901
4918
  out.namespace = value.namespace;
4902
4919
  }
4903
4920
  if (value.profile !== void 0) {
4904
- if (value.profile !== "coder" && value.profile !== "researcher") throw new TypeError("delegation_history: `profile` must be \"coder\" or \"researcher\"");
4921
+ if (!delegationProfiles.includes(value.profile)) throw new TypeError(`delegation_history: \`profile\` must be one of ${delegationProfiles.join(", ")}`);
4905
4922
  out.profile = value.profile;
4906
4923
  }
4907
4924
  if (value.since !== void 0) {
@@ -7170,6 +7187,6 @@ function rootProviderModelEvidenceFromExecution(evidence) {
7170
7187
  return evidence ?? rootProviderModelEvidence([]);
7171
7188
  }
7172
7189
  //#endregion
7173
- export { DELEGATION_TRACE_MAX_BYTES as $, DELEGATION_HISTORY_INPUT_SCHEMA as A, mapExecutorResult as At, DELEGATE_FEEDBACK_INPUT_SCHEMA as B, createMcpServer as C, plateauLength as Ct, createDelegationStatusHandler as D, FileCoordinationLog as Dt, DELEGATION_STATUS_TOOL_NAME as E, createInMemoryRunContext as Et, DELEGATE_UI_AUDIT_INPUT_SCHEMA as F, createEventBus as Ft, DELEGATE_INPUT_SCHEMA as G, createDelegateFeedbackHandler as H, DELEGATE_UI_AUDIT_TOOL_NAME as I, defaultToolDetectors as It, validateDelegateArgs as J, DELEGATE_TOOL_NAME as K, createDelegateUiAuditHandler as L, watchTrace as Lt, createDelegationHistoryHandler as M, canonicalFindingEvent as Mt, validateDelegationHistoryArgs as N, createCoordinationTools as Nt, validateDelegationStatusArgs as O, createSupervisorSpanRecorder as Ot, DELEGATE_UI_AUDIT_DESCRIPTION as P, normalizeAnalyzeOnSettle as Pt, hashIdempotencyInput as Q, validateDelegateUiAuditArgs as R, createInProcessTransport as S, bestSoFar as St, DELEGATION_STATUS_INPUT_SCHEMA as T, createFileRunContext as Tt, validateDelegateFeedbackArgs as U, DELEGATE_FEEDBACK_TOOL_NAME as V, DELEGATE_DESCRIPTION as W, delegate as X, defaultDelegateBudget as Y, DelegationTaskQueue as Z, promptHandle as _, noProgressFor as _t, assertCoordinationBinding as a, DelegationPersistenceError as at, classifyDriverFailure as b, anytimeReport as bt, supervisorAgentWithTestBrain as c, InMemoryDelegationStore as ct, delegatesWorkerBriefPrompt as d, driverAgent as dt, DELEGATION_TRACE_MAX_SPANS as et, dumbContinuationFailPrompt as f, finalizeBestDelivered as ft, naiveContinuationPrompt as g, createProgressTracker as gt, kernelPromptRegistry as h, anyOf as ht, workerFromBackend as i, createDelegationTraceCollector as it, DELEGATION_HISTORY_TOOL_NAME as j, DEFAULT_AWAIT_EVENT_TIMEOUT_MS as jt, DELEGATION_HISTORY_DESCRIPTION as k, gateOnDeliverable as kt, analyzesFindingsReportPrompt as l, InMemoryFeedbackStore as lt, formatPromptHandle as m, allWorkersStalled as mt, supervise as n, capDelegationTrace as nt, resolveSupervisorProfile as o, DelegationStateCorruptError as ot, dumbContinuationPassPrompt as p, allOf as pt, createDelegateHandler as q, superviseWithTestBrain as r, composeLoopTraceEmitters as rt, supervisorAgent as s, FileDelegationStore as st, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, buildDelegationTraceSpans as tt, createPromptRegistry as u, eventToSnapshot as ut, supervisorPolicyPrompt as v, plateau as vt, DELEGATION_STATUS_DESCRIPTION as w, renderAnytimeTable as wt, serveCoordinationMcp as x, areaUnderCurve as xt, DriverAttemptsExhaustedError as y, sampleFromSettled as yt, DELEGATE_FEEDBACK_DESCRIPTION as z };
7190
+ export { hashIdempotencyInput as $, DELEGATION_HISTORY_INPUT_SCHEMA as A, gateOnDeliverable as At, DELEGATE_FEEDBACK_DESCRIPTION as B, createMcpServer as C, bestSoFar as Ct, createDelegationStatusHandler as D, createInMemoryRunContext as Dt, DELEGATION_STATUS_TOOL_NAME as E, createFileRunContext as Et, DELEGATE_UI_AUDIT_DESCRIPTION as F, normalizeAnalyzeOnSettle as Ft, DELEGATE_DESCRIPTION as G, DELEGATE_FEEDBACK_TOOL_NAME as H, DELEGATE_UI_AUDIT_INPUT_SCHEMA as I, questionEscalationTargets as It, createDelegateHandler as J, DELEGATE_INPUT_SCHEMA as K, DELEGATE_UI_AUDIT_TOOL_NAME as L, createEventBus as Lt, createDelegationHistoryHandler as M, DEFAULT_AWAIT_EVENT_TIMEOUT_MS as Mt, validateDelegationHistoryArgs as N, canonicalFindingEvent as Nt, validateDelegationStatusArgs as O, FileCoordinationLog as Ot, delegationProfiles as P, createCoordinationTools as Pt, DelegationTaskQueue as Q, createDelegateUiAuditHandler as R, defaultToolDetectors as Rt, createInProcessTransport as S, areaUnderCurve as St, DELEGATION_STATUS_INPUT_SCHEMA as T, renderAnytimeTable as Tt, createDelegateFeedbackHandler as U, DELEGATE_FEEDBACK_INPUT_SCHEMA as V, validateDelegateFeedbackArgs as W, defaultDelegateBudget as X, validateDelegateArgs as Y, delegate as Z, promptHandle as _, createProgressTracker as _t, assertCoordinationBinding as a, createDelegationTraceCollector as at, classifyDriverFailure as b, sampleFromSettled as bt, supervisorAgentWithTestBrain as c, FileDelegationStore as ct, delegatesWorkerBriefPrompt as d, eventToSnapshot as dt, DELEGATION_TRACE_MAX_BYTES as et, dumbContinuationFailPrompt as f, driverAgent as ft, naiveContinuationPrompt as g, anyOf as gt, kernelPromptRegistry as h, allWorkersStalled as ht, workerFromBackend as i, composeLoopTraceEmitters as it, DELEGATION_HISTORY_TOOL_NAME as j, mapExecutorResult as jt, DELEGATION_HISTORY_DESCRIPTION as k, createSupervisorSpanRecorder as kt, analyzesFindingsReportPrompt as l, InMemoryDelegationStore as lt, formatPromptHandle as m, allOf as mt, supervise as n, buildDelegationTraceSpans as nt, resolveSupervisorProfile as o, DelegationPersistenceError as ot, dumbContinuationPassPrompt as p, finalizeBestDelivered as pt, DELEGATE_TOOL_NAME as q, superviseWithTestBrain as r, capDelegationTrace as rt, supervisorAgent as s, DelegationStateCorruptError as st, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, DELEGATION_TRACE_MAX_SPANS as tt, createPromptRegistry as u, InMemoryFeedbackStore as ut, supervisorPolicyPrompt as v, noProgressFor as vt, DELEGATION_STATUS_DESCRIPTION as w, plateauLength as wt, serveCoordinationMcp as x, anytimeReport as xt, DriverAttemptsExhaustedError as y, plateau as yt, validateDelegateUiAuditArgs as z, watchTrace as zt };
7174
7191
 
7175
- //# sourceMappingURL=supervise-gZ3xYJs3.js.map
7192
+ //# sourceMappingURL=supervise-CqwjiXlX.js.map