@tangle-network/agent-runtime 0.338.0 → 0.339.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 (140) hide show
  1. package/dist/{activation-CsbNax2X.d.ts → activation-CJIIl_Ey.d.ts} +4 -24
  2. package/dist/{activation-kbkAuSmY.js → activation-CVSFxis9.js} +5 -18
  3. package/dist/{activation-kbkAuSmY.js.map → activation-CVSFxis9.js.map} +1 -1
  4. package/dist/agent.d.ts +4 -4
  5. package/dist/agent.js +3 -3
  6. package/dist/{bundle-DM60AI2B.js → bundle-DVOhBTic.js} +2 -2
  7. package/dist/{bundle-DM60AI2B.js.map → bundle-DVOhBTic.js.map} +1 -1
  8. package/dist/candidate-execution/index.d.ts +4 -63
  9. package/dist/candidate-execution/index.js +6 -145
  10. package/dist/candidate-execution/index.js.map +1 -1
  11. package/dist/{delegate-Se1YZKMb.js → delegate-CCWE_AkU.js} +2 -2
  12. package/dist/{delegate-Se1YZKMb.js.map → delegate-CCWE_AkU.js.map} +1 -1
  13. package/dist/{driver-control-acknowledgers-T2a1Ouay.js → driver-control-acknowledgers-C53ggdJ6.js} +12 -8
  14. package/dist/driver-control-acknowledgers-C53ggdJ6.js.map +1 -0
  15. package/dist/{durable-file-B_eJr6Mb.js → durable-file-gNI9ILAn.js} +1 -3
  16. package/dist/durable-file-gNI9ILAn.js.map +1 -0
  17. package/dist/durable.d.ts +3 -35
  18. package/dist/durable.js +10 -10
  19. package/dist/durable.js.map +1 -1
  20. package/dist/{graph-CY0wH838.js → graph-CI9JXKqO.js} +4 -4
  21. package/dist/graph-CI9JXKqO.js.map +1 -0
  22. package/dist/{graph-registry-By0tUj4S.js → graph-registry-BnO64cn8.js} +3 -3
  23. package/dist/{graph-registry-By0tUj4S.js.map → graph-registry-BnO64cn8.js.map} +1 -1
  24. package/dist/{improve-CWGBT13K.js → improve-BOXTLWJ3.js} +8 -35
  25. package/dist/improve-BOXTLWJ3.js.map +1 -0
  26. package/dist/{improvement-adapter-D5gwwoXQ.d.ts → improvement-adapter-HUt_-cWA.d.ts} +2 -20
  27. package/dist/index.d.ts +9 -206
  28. package/dist/index.js +91 -302
  29. package/dist/index.js.map +1 -1
  30. package/dist/intelligence.d.ts +10 -142
  31. package/dist/intelligence.js +7 -81
  32. package/dist/intelligence.js.map +1 -1
  33. package/dist/{jsonl-file-DBv31uPi.js → jsonl-file-C9Kde_0Z.js} +2 -2
  34. package/dist/{jsonl-file-DBv31uPi.js.map → jsonl-file-C9Kde_0Z.js.map} +1 -1
  35. package/dist/kernel.d.ts +4 -3
  36. package/dist/kernel.js +12 -14
  37. package/dist/loop-runner-CWzG1bH4.d.ts +32 -0
  38. package/dist/loop-runner-bin.d.ts +32 -2
  39. package/dist/loop-runner-bin.js +93 -1
  40. package/dist/loop-runner-bin.js.map +1 -0
  41. package/dist/loop-runner-pmPIHFVY.js +59 -0
  42. package/dist/loop-runner-pmPIHFVY.js.map +1 -0
  43. package/dist/mcp/bin.js +3 -3
  44. package/dist/mcp/index.d.ts +99 -418
  45. package/dist/mcp/index.js +121 -203
  46. package/dist/mcp/index.js.map +1 -1
  47. package/dist/mcp/memory-bin.js +231 -1
  48. package/dist/mcp/memory-bin.js.map +1 -1
  49. package/dist/model-policy-CyCUwHed.js.map +1 -1
  50. package/dist/placement.d.ts +2 -9
  51. package/dist/placement.js +1 -1
  52. package/dist/placement.js.map +1 -1
  53. package/dist/platform.d.ts +188 -1
  54. package/dist/platform.js +129 -1
  55. package/dist/platform.js.map +1 -1
  56. package/dist/{prepare-Bt0IouPq.js → prepare-bXkvPMJA.js} +8 -160
  57. package/dist/prepare-bXkvPMJA.js.map +1 -0
  58. package/dist/{profile-Do-5xO_D.js → profile-Dpei_Sq0.js} +2 -2
  59. package/dist/profile-Dpei_Sq0.js.map +1 -0
  60. package/dist/{profile-materialization-BnoEf1co.d.ts → profile-materialization-B1wm2SPT.d.ts} +3 -5
  61. package/dist/profiles.d.ts +2 -2
  62. package/dist/profiles.js +3 -40
  63. package/dist/profiles.js.map +1 -1
  64. package/dist/{protected-model-port-DGxQ8_YM.d.ts → protected-model-port-BGgpy2r9.d.ts} +3 -29
  65. package/dist/protected-redaction-DFCeo4vg.js.map +1 -1
  66. package/dist/{provision-supervisor-0jMufp4h.js → provision-supervisor-CJ6Zz6dz.js} +6 -6
  67. package/dist/{provision-supervisor-0jMufp4h.js.map → provision-supervisor-CJ6Zz6dz.js.map} +1 -1
  68. package/dist/{run-cancellation-BoW5Sg9Y.js → run-cancellation-C9oL62sW.js} +3 -7
  69. package/dist/{run-cancellation-BoW5Sg9Y.js.map → run-cancellation-C9oL62sW.js.map} +1 -1
  70. package/dist/{runtime-D37zRSs7.js → runtime-B2fjL9Oi.js} +2531 -2889
  71. package/dist/runtime-B2fjL9Oi.js.map +1 -0
  72. package/dist/{runtime-hooks-Bj6wJHlH.d.ts → runtime-hooks-nsqxSUFL.d.ts} +2 -6
  73. package/dist/{sandbox-profile-compat-xSoVtdWw.js → sandbox-profile-compat-BzVBFqrz.js} +2 -4
  74. package/dist/sandbox-profile-compat-BzVBFqrz.js.map +1 -0
  75. package/dist/{search-executor-DmgUm5p7.js → search-executor-zMumiak_.js} +3 -3
  76. package/dist/search-executor-zMumiak_.js.map +1 -0
  77. package/dist/{server-DQHJszfk.js → server-_4voDNrl.js} +362 -67
  78. package/dist/server-_4voDNrl.js.map +1 -0
  79. package/dist/{structural-rollout-DAvIE8mw.js → structural-rollout-DpLCXzaL.js} +80 -80
  80. package/dist/structural-rollout-DpLCXzaL.js.map +1 -0
  81. package/dist/{substrate-B0TYNrXn.js → substrate-CGDFTSRh.js} +2 -9
  82. package/dist/substrate-CGDFTSRh.js.map +1 -0
  83. package/dist/{supervise-WuPAwfPh.js → supervise-qAwXmPtD.js} +10 -57
  84. package/dist/supervise-qAwXmPtD.js.map +1 -0
  85. package/dist/{supervisor-CPG1I9UN.js → supervisor-DHrUJhEZ.js} +179 -236
  86. package/dist/supervisor-DHrUJhEZ.js.map +1 -0
  87. package/dist/testing.d.ts +2 -2
  88. package/dist/testing.js +13 -13
  89. package/dist/testing.js.map +1 -1
  90. package/dist/tool-loop.d.ts +1 -1
  91. package/dist/{tool-server-Dqer2M4_.js → tool-server-XV4aJwoQ.js} +2 -2
  92. package/dist/tool-server-XV4aJwoQ.js.map +1 -0
  93. package/dist/top-snapshot-CbZE1JsU.js +502 -0
  94. package/dist/top-snapshot-CbZE1JsU.js.map +1 -0
  95. package/dist/tui/bin.js +711 -1
  96. package/dist/tui/bin.js.map +1 -1
  97. package/dist/tui/index.d.ts +2 -70
  98. package/dist/tui/index.js +3 -3
  99. package/dist/{types-CrNWif8-.d.ts → types-CaOXqRTq.d.ts} +713 -2096
  100. package/dist/workspace-store/index.d.ts +2 -27
  101. package/dist/workspace-store/index.js +2 -2
  102. package/dist/workspace-store/index.js.map +1 -1
  103. package/dist/{workspace-streams-BZZds1Fw.d.ts → workspace-streams-BiS4ABah.d.ts} +3 -18
  104. package/package.json +1 -1
  105. package/skills/agent-graphs/references/authoring.md +3 -2
  106. package/dist/coder-yhVWbdWc.js +0 -40
  107. package/dist/coder-yhVWbdWc.js.map +0 -1
  108. package/dist/delegation-status-CF4D0NZ_.js +0 -358
  109. package/dist/delegation-status-CF4D0NZ_.js.map +0 -1
  110. package/dist/driver-control-acknowledgers-T2a1Ouay.js.map +0 -1
  111. package/dist/durable-file-B_eJr6Mb.js.map +0 -1
  112. package/dist/graph-CY0wH838.js.map +0 -1
  113. package/dist/improve-CWGBT13K.js.map +0 -1
  114. package/dist/integrations-6xttbPi9.d.ts +0 -190
  115. package/dist/integrations-dFi-ALk7.js +0 -132
  116. package/dist/integrations-dFi-ALk7.js.map +0 -1
  117. package/dist/kb-gate-C8z2juK8.d.ts +0 -80
  118. package/dist/kb-gate-DpaSwXVx.js +0 -80
  119. package/dist/kb-gate-DpaSwXVx.js.map +0 -1
  120. package/dist/loop-runner-bin-CFnrAHpl.d.ts +0 -164
  121. package/dist/loop-runner-bin-CdPlhy9g.js +0 -246
  122. package/dist/loop-runner-bin-CdPlhy9g.js.map +0 -1
  123. package/dist/memory-server-DXQ8IxGR.js +0 -234
  124. package/dist/memory-server-DXQ8IxGR.js.map +0 -1
  125. package/dist/openai-tools-DoQ32vpe.js +0 -44
  126. package/dist/openai-tools-DoQ32vpe.js.map +0 -1
  127. package/dist/openai-tools-zh2I_uD7.d.ts +0 -24
  128. package/dist/prepare-Bt0IouPq.js.map +0 -1
  129. package/dist/profile-Do-5xO_D.js.map +0 -1
  130. package/dist/runtime-D37zRSs7.js.map +0 -1
  131. package/dist/sandbox-profile-compat-xSoVtdWw.js.map +0 -1
  132. package/dist/search-executor-DmgUm5p7.js.map +0 -1
  133. package/dist/server-DQHJszfk.js.map +0 -1
  134. package/dist/structural-rollout-DAvIE8mw.js.map +0 -1
  135. package/dist/substrate-B0TYNrXn.js.map +0 -1
  136. package/dist/supervise-WuPAwfPh.js.map +0 -1
  137. package/dist/supervisor-CPG1I9UN.js.map +0 -1
  138. package/dist/tool-server-Dqer2M4_.js.map +0 -1
  139. package/dist/top-app-C55Wa7uy.js +0 -1214
  140. package/dist/top-app-C55Wa7uy.js.map +0 -1
@@ -49,12 +49,13 @@ On each usable settle of `from`, its routes edges are tried in declaration order
49
49
  `when` compares JSON scalars only (`equals`, `in`, `exists` at an RFC 6901 pointer, or `all` of several); a numeric or stateful rule is a field the node settles, such as a boolean or a counter.
50
50
  A match reads `from` unless it names a node listed in the edge's `evidence`; a pointer that does not resolve does not match.
51
51
  An edge without `when` is the default branch: at most one per node, and last.
52
- A node target receives `{ from: { node, result }, evidence }` and the edge directive; `{ stop: reason }` ends the run with no winner; `{ finish: reason }` makes this settle part of the output.
52
+ A node target receives `{ from: { node, result }, evidence }` (a join's target `{ from: { nodes }, evidence }`) and the edge directive; `{ stop: reason }` ends the run with no winner; `{ finish: reason }` makes this settle part of the output.
53
53
  The output is `{ [node]: latest usable result }` over terminal nodes (no outgoing routes or map edge) and finish sources, and the deliverable decides it.
54
54
  Every routes cycle, each subcycle included, must cross an edge with an explicit `maxTraversals`: a cap on `a -> b` does not bound a `b <-> c` loop beside it. An edge at its cap is skipped and matching continues, so give a repair loop a fallback edge.
55
55
  `continuity: 'resume'` continues the target's latest settled session.
56
+ A routes edge into a node that already has a settled worker in this flow (a back edge) spawns it with `successorOf` that latest settled worker; the spawn key does not change.
56
57
  A fork lists two or more nodes in `to`: one traversal spawns them all at once, each under key `route:<edge>#<traversal>:<node>`.
57
- A join lists two or more nodes in `from`: it fires once every member has settled usably since it last fired, its target's evidence holds each member's latest result, it carries no `when`, and it is the only routes edge leaving each member.
58
+ A join lists two or more nodes in `from`: it fires once every member has settled usably since it last fired, its target's task is `{ from: { nodes: <members in declared order> }, evidence }` with each member's latest result in `evidence`, the same whichever member settled last, so a resumed run derives the same task; it carries no `when`, and it is the only routes edge leaving each member.
58
59
  A route into a node that still has a running worker throws `GraphRouteError` with reason `target-live`; converging branches use a join.
59
60
  A map edge may leave any flow node, and its join may have routes edges.
60
61
  A maps edge's `graph` item and a `run_graph` subtask may be flow graphs (`entry` on the topology). Inside a maps item, every entry whose task is `{ item: true }` receives the item value, and a down settle ends that item only, so `onItemFailure` decides the join.
@@ -1,40 +0,0 @@
1
- //#region src/profiles/coder.ts
2
- /**
3
- *
4
- * `CoderTask` + `coderTaskToPrompt` — the per-task DATA + pure formatter for code-modification tasks
5
- * (§1.5: the system authors profiles; there is no hardcoded coder profile constant). A domain
6
- * customizes the worker by authoring its own `AgentProfile` and handing it to a leaf executor
7
- * (`createWorktreeCliExecutor`) or a fanout (`worktreeFanout`); "is it delivered" is a
8
- * `DeliverableSpec` (`patchDelivered`), not a bundled validator. This formatter renders a `CoderTask`
9
- * into the per-task instruction that profile receives.
10
- *
11
- * @experimental
12
- */
13
- const DEFAULT_MAX_DIFF_LINES = 400;
14
- /** Render a `CoderTask` into the per-task instruction handed to the coder profile. @experimental */
15
- function coderTaskToPrompt(task) {
16
- const base = task.baseBranch ?? "main";
17
- const testCmd = task.testCmd ?? "pnpm test --run";
18
- const typecheckCmd = task.typecheckCmd ?? "pnpm typecheck";
19
- const maxDiff = task.maxDiffLines ?? DEFAULT_MAX_DIFF_LINES;
20
- const forbidden = task.forbiddenPaths?.length ? task.forbiddenPaths.join(", ") : "(none)";
21
- const context = task.contextFiles?.length ? task.contextFiles.map((f) => ` - ${f}`).join("\n") : " (none)";
22
- return [
23
- `Goal: ${task.goal}`,
24
- `Repo: ${task.repoRoot}`,
25
- `Base branch: ${base}`,
26
- `Run tests with: ${testCmd}`,
27
- `Run typecheck with: ${typecheckCmd}`,
28
- `Forbidden paths: ${forbidden}`,
29
- `Max diff lines: ${maxDiff}`,
30
- "Context files:",
31
- context,
32
- "",
33
- "Produce a minimal patch on a fresh branch. Run tests and typecheck before",
34
- "returning. Emit the final JSON result block exactly as instructed."
35
- ].join("\n");
36
- }
37
- //#endregion
38
- export { coderTaskToPrompt as t };
39
-
40
- //# sourceMappingURL=coder-yhVWbdWc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coder-yhVWbdWc.js","names":[],"sources":["../src/profiles/coder.ts"],"sourcesContent":["/**\n *\n * `CoderTask` + `coderTaskToPrompt` — the per-task DATA + pure formatter for code-modification tasks\n * (§1.5: the system authors profiles; there is no hardcoded coder profile constant). A domain\n * customizes the worker by authoring its own `AgentProfile` and handing it to a leaf executor\n * (`createWorktreeCliExecutor`) or a fanout (`worktreeFanout`); \"is it delivered\" is a\n * `DeliverableSpec` (`patchDelivered`), not a bundled validator. This formatter renders a `CoderTask`\n * into the per-task instruction that profile receives.\n *\n * @experimental\n */\n\nconst DEFAULT_MAX_DIFF_LINES = 400\n\n/** @experimental The per-task inputs `coderTaskToPrompt` renders + the worktree gate enforces. */\nexport interface CoderTask {\n /** What the agent must accomplish. Free-form prose. */\n goal: string\n /** Absolute path inside the sandbox where the repo lives. */\n repoRoot: string\n /** Default `main`. The branch the agent diffs against. */\n baseBranch?: string\n /** Default `pnpm test --run`. */\n testCmd?: string\n /** Default `pnpm typecheck`. */\n typecheckCmd?: string\n /** Files the agent may inspect for context. Surfaced verbatim in the prompt. */\n contextFiles?: string[]\n /**\n * Paths the agent must not touch. The mechanical gate hard-fails on any match.\n * Use glob-free literal path prefixes for unambiguous enforcement.\n */\n forbiddenPaths?: string[]\n /** Default 400. Hard cap; the gate hard-fails when exceeded. */\n maxDiffLines?: number\n}\n\n/** Render a `CoderTask` into the per-task instruction handed to the coder profile. @experimental */\nexport function coderTaskToPrompt(task: CoderTask): string {\n const base = task.baseBranch ?? 'main'\n const testCmd = task.testCmd ?? 'pnpm test --run'\n const typecheckCmd = task.typecheckCmd ?? 'pnpm typecheck'\n const maxDiff = task.maxDiffLines ?? DEFAULT_MAX_DIFF_LINES\n const forbidden = task.forbiddenPaths?.length ? task.forbiddenPaths.join(', ') : '(none)'\n const context = task.contextFiles?.length\n ? task.contextFiles.map((f) => ` - ${f}`).join('\\n')\n : ' (none)'\n return [\n `Goal: ${task.goal}`,\n `Repo: ${task.repoRoot}`,\n `Base branch: ${base}`,\n `Run tests with: ${testCmd}`,\n `Run typecheck with: ${typecheckCmd}`,\n `Forbidden paths: ${forbidden}`,\n `Max diff lines: ${maxDiff}`,\n 'Context files:',\n context,\n '',\n 'Produce a minimal patch on a fresh branch. Run tests and typecheck before',\n 'returning. Emit the final JSON result block exactly as instructed.',\n ].join('\\n')\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,yBAAyB;;AA0B/B,SAAgB,kBAAkB,MAAyB;CACzD,MAAM,OAAO,KAAK,cAAc;CAChC,MAAM,UAAU,KAAK,WAAW;CAChC,MAAM,eAAe,KAAK,gBAAgB;CAC1C,MAAM,UAAU,KAAK,gBAAgB;CACrC,MAAM,YAAY,KAAK,gBAAgB,SAAS,KAAK,eAAe,KAAK,IAAI,IAAI;CACjF,MAAM,UAAU,KAAK,cAAc,SAC/B,KAAK,aAAa,KAAK,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,IAAI,IAClD;CACJ,OAAO;EACL,SAAS,KAAK;EACd,SAAS,KAAK;EACd,gBAAgB;EAChB,mBAAmB;EACnB,uBAAuB;EACvB,oBAAoB;EACpB,mBAAmB;EACnB;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;AACb"}
@@ -1,358 +0,0 @@
1
- import { o as NotFoundError } from "./errors-DodWX-cb.js";
2
- //#region src/mcp/feedback-store.ts
3
- /** In-memory `FeedbackStore` — suitable for single-process use and tests. @stable */
4
- var InMemoryFeedbackStore = class {
5
- events = [];
6
- async put(event) {
7
- this.events.push({ ...event });
8
- }
9
- async list(filter = {}) {
10
- let out = this.events;
11
- if (filter.namespace !== void 0) out = out.filter((event) => event.namespace === filter.namespace);
12
- if (filter.refersToRef !== void 0) out = out.filter((event) => event.refersTo.ref === filter.refersToRef);
13
- return out.map((event) => ({ ...event }));
14
- }
15
- };
16
- /**
17
- * Project a `FeedbackEvent` down to the snapshot shape carried on
18
- * `delegation_history` entries.
19
- *
20
- * @stable
21
- */
22
- function eventToSnapshot(event) {
23
- const snap = {
24
- id: event.id,
25
- score: event.rating.score,
26
- by: event.by,
27
- notes: event.rating.notes,
28
- capturedAt: event.capturedAt
29
- };
30
- if (event.rating.label) snap.label = event.rating.label;
31
- return snap;
32
- }
33
- //#endregion
34
- //#region src/mcp/tools/delegate-feedback.ts
35
- /** MCP tool name for the `delegate_feedback` feedback-recording tool. @stable */
36
- const DELEGATE_FEEDBACK_TOOL_NAME = "delegate_feedback";
37
- /** Human-readable description of the `delegate_feedback` MCP tool, injected into the tool manifest. @stable */
38
- const DELEGATE_FEEDBACK_DESCRIPTION = [
39
- "Record feedback on a delegation, artifact, or outcome. Synchronous — the",
40
- "event is durably stored when this call returns.",
41
- "",
42
- "Use when: you (the agent), the user, or a downstream judge has formed an",
43
- "opinion about a piece of work and want it persisted for calibration,",
44
- "pricing, or future routing. Every call is a new event — multiple ratings",
45
- "on the same target are expected and never deduped.",
46
- "",
47
- "`refersTo.kind`:",
48
- " - \"delegation\": ref is a taskId returned by delegate_ui_audit",
49
- " - \"artifact\": ref is a URI/path/git-sha — anything you can dereference",
50
- " - \"outcome\": ref is a free-form description of a downstream result",
51
- "",
52
- "`by`:",
53
- " - \"agent\": the agent itself rated the work",
54
- " - \"user\": the human user rated it",
55
- " - \"downstream-judge\": an automated evaluator emitted the rating",
56
- "",
57
- "When ref names a known taskId, the rating is also attached to the",
58
- "delegation record so delegation_history surfaces it inline."
59
- ].join("\n");
60
- /** JSON Schema for `delegate_feedback` tool arguments (`refersTo`, `rating`, `by`, optional fields). @stable */
61
- const DELEGATE_FEEDBACK_INPUT_SCHEMA = {
62
- type: "object",
63
- properties: {
64
- refersTo: {
65
- type: "object",
66
- properties: {
67
- kind: {
68
- type: "string",
69
- enum: [
70
- "delegation",
71
- "artifact",
72
- "outcome"
73
- ]
74
- },
75
- ref: { type: "string" }
76
- },
77
- required: ["kind", "ref"],
78
- additionalProperties: false
79
- },
80
- rating: {
81
- type: "object",
82
- properties: {
83
- score: {
84
- type: "number",
85
- minimum: 0,
86
- maximum: 1
87
- },
88
- label: {
89
- type: "string",
90
- enum: [
91
- "good",
92
- "bad",
93
- "neutral",
94
- "mixed"
95
- ]
96
- },
97
- notes: { type: "string" }
98
- },
99
- required: ["score", "notes"],
100
- additionalProperties: false
101
- },
102
- by: {
103
- type: "string",
104
- enum: [
105
- "agent",
106
- "user",
107
- "downstream-judge"
108
- ]
109
- },
110
- capturedAt: { type: "string" },
111
- namespace: { type: "string" }
112
- },
113
- required: [
114
- "refersTo",
115
- "rating",
116
- "by"
117
- ],
118
- additionalProperties: false
119
- };
120
- /** Parse and validate raw MCP tool input into typed `DelegateFeedbackArgs`; throws `TypeError` on bad input. @stable */
121
- function validateDelegateFeedbackArgs(raw) {
122
- if (raw === null || typeof raw !== "object") throw new TypeError("delegate_feedback: arguments must be an object");
123
- const value = raw;
124
- const refersTo = validateRefersTo(value.refersTo);
125
- const rating = validateRating(value.rating);
126
- const by = value.by;
127
- if (by !== "agent" && by !== "user" && by !== "downstream-judge") throw new TypeError("delegate_feedback: `by` must be one of \"agent\" | \"user\" | \"downstream-judge\"");
128
- const args = {
129
- refersTo,
130
- rating,
131
- by
132
- };
133
- if (value.capturedAt !== void 0) {
134
- if (typeof value.capturedAt !== "string" || Number.isNaN(Date.parse(value.capturedAt))) throw new TypeError("delegate_feedback: `capturedAt` must be an ISO datetime");
135
- args.capturedAt = value.capturedAt;
136
- }
137
- if (typeof value.namespace === "string") args.namespace = value.namespace;
138
- return args;
139
- }
140
- function validateRefersTo(raw) {
141
- if (raw === null || typeof raw !== "object") throw new TypeError("delegate_feedback: `refersTo` must be an object");
142
- const value = raw;
143
- const kind = value.kind;
144
- if (kind !== "delegation" && kind !== "artifact" && kind !== "outcome") throw new TypeError("delegate_feedback: `refersTo.kind` must be one of \"delegation\" | \"artifact\" | \"outcome\"");
145
- const ref = value.ref;
146
- if (typeof ref !== "string" || ref.trim().length === 0) throw new TypeError("delegate_feedback: `refersTo.ref` must be a non-empty string");
147
- return {
148
- kind,
149
- ref: ref.trim()
150
- };
151
- }
152
- function validateRating(raw) {
153
- if (raw === null || typeof raw !== "object") throw new TypeError("delegate_feedback: `rating` must be an object");
154
- const value = raw;
155
- const score = Number(value.score);
156
- if (!Number.isFinite(score) || score < 0 || score > 1) throw new RangeError("delegate_feedback: `rating.score` must be a number in [0, 1]");
157
- const notes = value.notes;
158
- if (typeof notes !== "string") throw new TypeError("delegate_feedback: `rating.notes` must be a string");
159
- const rating = {
160
- score,
161
- notes
162
- };
163
- const label = value.label;
164
- if (label !== void 0) {
165
- if (label !== "good" && label !== "bad" && label !== "neutral" && label !== "mixed") throw new TypeError("delegate_feedback: `rating.label` must be one of \"good\" | \"bad\" | \"neutral\" | \"mixed\"");
166
- rating.label = label;
167
- }
168
- return rating;
169
- }
170
- /** Build the MCP tool handler that persists feedback events and attaches them to delegation records. @stable */
171
- function createDelegateFeedbackHandler(options) {
172
- const generateId = options.generateId ?? randomFeedbackId;
173
- const now = options.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
174
- return async (raw) => {
175
- const args = validateDelegateFeedbackArgs(raw);
176
- const id = generateId();
177
- const event = {
178
- id,
179
- refersTo: args.refersTo,
180
- rating: args.rating,
181
- by: args.by,
182
- capturedAt: args.capturedAt ?? now(),
183
- namespace: args.namespace
184
- };
185
- await options.store.put(event);
186
- if (args.refersTo.kind === "delegation") options.queue.attachFeedback(args.refersTo.ref, eventToSnapshot(event));
187
- return {
188
- recorded: true,
189
- id
190
- };
191
- };
192
- }
193
- function randomFeedbackId() {
194
- return `fbk-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
195
- }
196
- //#endregion
197
- //#region src/mcp/types.ts
198
- /**
199
- * Every delegation profile a queued record can carry. One owner: the tool schemas and validators
200
- * that filter on a profile read this list, so a profile added here cannot be one a tool refuses.
201
- * @experimental
202
- */
203
- const delegationProfiles = [
204
- "coder",
205
- "researcher",
206
- "ui-auditor"
207
- ];
208
- //#endregion
209
- //#region src/mcp/tools/delegation-history.ts
210
- /** MCP tool name for the `delegation_history` read-past-delegations tool. @stable */
211
- const DELEGATION_HISTORY_TOOL_NAME = "delegation_history";
212
- /** Human-readable description of the `delegation_history` MCP tool, injected into the tool manifest. @stable */
213
- const DELEGATION_HISTORY_DESCRIPTION = [
214
- "Read past delegations newest-first. Each entry carries the original",
215
- "arguments, current status, cost, and any feedback attached via",
216
- "delegate_feedback.",
217
- "",
218
- "Use when: you want to introspect prior decisions — \"have I asked this",
219
- "question before?",
220
- "did the last patch land?",
221
- "what's the historical",
222
- "success rate of coder delegations on this repo?\". Feed the results back",
223
- "into your own routing and calibration.",
224
- "",
225
- "Each entry carries `hasTrace` — when true, the full loop-trace span tree",
226
- "is retrievable via delegation_status { taskId, includeTrace: true }.",
227
- "",
228
- `Filters: \`namespace\` (multi-tenant scope), \`profile\` (${delegationProfiles.map((profile) => `"${profile}"`).join(" | ")}),`,
229
- "`since` (ISO date — only delegations started at-or-after). `limit` defaults",
230
- "to 50, capped at 500."
231
- ].join("\n");
232
- /** JSON Schema for `delegation_history` tool arguments (optional `namespace`, `profile`, `since`, `limit`). @stable */
233
- const DELEGATION_HISTORY_INPUT_SCHEMA = {
234
- type: "object",
235
- properties: {
236
- namespace: { type: "string" },
237
- profile: {
238
- type: "string",
239
- enum: delegationProfiles
240
- },
241
- since: {
242
- type: "string",
243
- description: "ISO datetime — earliest startedAt to include."
244
- },
245
- limit: {
246
- type: "integer",
247
- minimum: 1,
248
- maximum: 500
249
- }
250
- },
251
- additionalProperties: false
252
- };
253
- /** Parse and validate raw MCP tool input into typed `DelegationHistoryArgs`; throws `TypeError` on bad input. @stable */
254
- function validateDelegationHistoryArgs(raw) {
255
- if (raw === void 0 || raw === null) return {};
256
- if (typeof raw !== "object") throw new TypeError("delegation_history: arguments must be an object");
257
- const value = raw;
258
- const out = {};
259
- if (value.namespace !== void 0) {
260
- if (typeof value.namespace !== "string") throw new TypeError("delegation_history: `namespace` must be a string");
261
- out.namespace = value.namespace;
262
- }
263
- if (value.profile !== void 0) {
264
- if (!delegationProfiles.includes(value.profile)) throw new TypeError(`delegation_history: \`profile\` must be one of ${delegationProfiles.join(", ")}`);
265
- out.profile = value.profile;
266
- }
267
- if (value.since !== void 0) {
268
- if (typeof value.since !== "string" || Number.isNaN(Date.parse(value.since))) throw new TypeError("delegation_history: `since` must be an ISO datetime");
269
- out.since = value.since;
270
- }
271
- if (value.limit !== void 0) {
272
- const n = Number(value.limit);
273
- if (!Number.isFinite(n) || n < 1 || n > 500) throw new RangeError("delegation_history: `limit` must be an integer in [1, 500]");
274
- out.limit = Math.trunc(n);
275
- }
276
- return out;
277
- }
278
- /** Build the MCP tool handler that reads filtered past delegations from a `DelegationTaskQueue`. @stable */
279
- function createDelegationHistoryHandler(options) {
280
- return async (raw) => {
281
- const args = validateDelegationHistoryArgs(raw);
282
- return { delegations: options.queue.history(args) };
283
- };
284
- }
285
- //#endregion
286
- //#region src/mcp/tools/delegation-status.ts
287
- /**
288
- *
289
- * `delegation_status` MCP tool — synchronous poll. Returns the current
290
- * state machine + optional progress + final result (when terminal).
291
- *
292
- * @stable
293
- */
294
- /** MCP tool name for the `delegation_status` synchronous-poll tool. @stable */
295
- const DELEGATION_STATUS_TOOL_NAME = "delegation_status";
296
- /** Human-readable description of the `delegation_status` MCP tool, injected into the tool manifest. @stable */
297
- const DELEGATION_STATUS_DESCRIPTION = [
298
- "Poll the status of an async delegation. Returns the current state",
299
- "(pending | running | completed | failed | cancelled), optional progress,",
300
- "and the final result when status === \"completed\".",
301
- "",
302
- "Use when: you previously kicked off an async delegation (delegate_ui_audit)",
303
- "and need to know whether the work is done. The agent's right rhythm is to",
304
- "call this every minute or two while waiting; do not busy-poll.",
305
- "",
306
- "For a completed delegate_ui_audit run, `result.output` is the array of UI",
307
- "findings — one self-contained Markdown finding per issue, each with an",
308
- "embedded screenshot and a suggested fix.",
309
- "",
310
- "Pass includeTrace: true to also receive the journaled loop-trace span",
311
- "tree (loop → round → iteration, with placement/cost/verdict metadata).",
312
- "Default false — keep routine polls light.",
313
- "",
314
- "Throws NotFoundError when taskId is unknown — never silently returns",
315
- "`pending` for a typo."
316
- ].join("\n");
317
- /** JSON Schema for `delegation_status` tool arguments (`taskId` + optional `includeTrace`). @stable */
318
- const DELEGATION_STATUS_INPUT_SCHEMA = {
319
- type: "object",
320
- properties: {
321
- taskId: {
322
- type: "string",
323
- description: "Returned by delegate_ui_audit."
324
- },
325
- includeTrace: {
326
- type: "boolean",
327
- description: "Also return the journaled loop-trace span tree for this delegation. Default false."
328
- }
329
- },
330
- required: ["taskId"],
331
- additionalProperties: false
332
- };
333
- /** Parse and validate raw MCP tool input into typed `DelegationStatusArgs`; throws `TypeError` on bad input. @stable */
334
- function validateDelegationStatusArgs(raw) {
335
- if (raw === null || typeof raw !== "object") throw new TypeError("delegation_status: arguments must be an object");
336
- const value = raw;
337
- const taskId = value.taskId;
338
- if (typeof taskId !== "string" || taskId.trim().length === 0) throw new TypeError("delegation_status: `taskId` must be a non-empty string");
339
- const out = { taskId: taskId.trim() };
340
- if (value.includeTrace !== void 0) {
341
- if (typeof value.includeTrace !== "boolean") throw new TypeError("delegation_status: `includeTrace` must be a boolean");
342
- out.includeTrace = value.includeTrace;
343
- }
344
- return out;
345
- }
346
- /** Build the MCP tool handler that polls a `DelegationTaskQueue` for task status. @stable */
347
- function createDelegationStatusHandler(options) {
348
- return async (raw) => {
349
- const args = validateDelegationStatusArgs(raw);
350
- const status = options.queue.status(args.taskId, args.includeTrace !== void 0 ? { includeTrace: args.includeTrace } : void 0);
351
- if (!status) throw new NotFoundError(`delegation_status: unknown taskId "${args.taskId}"`);
352
- return status;
353
- };
354
- }
355
- //#endregion
356
- export { InMemoryFeedbackStore as _, validateDelegationStatusArgs as a, DELEGATION_HISTORY_TOOL_NAME as c, delegationProfiles as d, DELEGATE_FEEDBACK_DESCRIPTION as f, validateDelegateFeedbackArgs as g, createDelegateFeedbackHandler as h, createDelegationStatusHandler as i, createDelegationHistoryHandler as l, DELEGATE_FEEDBACK_TOOL_NAME as m, DELEGATION_STATUS_INPUT_SCHEMA as n, DELEGATION_HISTORY_DESCRIPTION as o, DELEGATE_FEEDBACK_INPUT_SCHEMA as p, DELEGATION_STATUS_TOOL_NAME as r, DELEGATION_HISTORY_INPUT_SCHEMA as s, DELEGATION_STATUS_DESCRIPTION as t, validateDelegationHistoryArgs as u, eventToSnapshot as v };
357
-
358
- //# sourceMappingURL=delegation-status-CF4D0NZ_.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delegation-status-CF4D0NZ_.js","names":[],"sources":["../src/mcp/feedback-store.ts","../src/mcp/tools/delegate-feedback.ts","../src/mcp/types.ts","../src/mcp/tools/delegation-history.ts","../src/mcp/tools/delegation-status.ts"],"sourcesContent":["/**\n *\n * Feedback persistence surface for the MCP layer.\n *\n * Feedback storage is product policy, so the MCP layer depends on this narrow\n * interface instead of choosing a knowledge store. The default implementation\n * is in-memory; consumers wire their own durable adapter via\n * `createMcpServer({ feedbackStore })`.\n *\n * Feedback events are append-only: every rating is a new event with a\n * fresh id, even when the same delegation is rated multiple times. The\n * caller decides how to roll up scores downstream.\n *\n * @stable\n */\n\nimport type { DelegateFeedbackArgs, DelegationFeedbackSnapshot } from './types'\n\n/** @stable */\nexport interface FeedbackEvent {\n id: string\n refersTo: DelegateFeedbackArgs['refersTo']\n rating: DelegateFeedbackArgs['rating']\n by: DelegateFeedbackArgs['by']\n capturedAt: string\n namespace?: string\n}\n\n/** @stable */\nexport interface FeedbackStore {\n /** Append a new event. Never dedupes — every rating is its own event. */\n put(event: FeedbackEvent): Promise<void>\n /**\n * List events filtered by `namespace`. When `namespace` is omitted, list\n * across all namespaces. Returns events in insertion order.\n */\n list(filter?: { namespace?: string; refersToRef?: string }): Promise<FeedbackEvent[]>\n}\n\n/** In-memory `FeedbackStore` — suitable for single-process use and tests. @stable */\nexport class InMemoryFeedbackStore implements FeedbackStore {\n private readonly events: FeedbackEvent[] = []\n\n async put(event: FeedbackEvent): Promise<void> {\n this.events.push({ ...event })\n }\n\n async list(filter: { namespace?: string; refersToRef?: string } = {}): Promise<FeedbackEvent[]> {\n let out = this.events\n if (filter.namespace !== undefined) {\n out = out.filter((event) => event.namespace === filter.namespace)\n }\n if (filter.refersToRef !== undefined) {\n out = out.filter((event) => event.refersTo.ref === filter.refersToRef)\n }\n return out.map((event) => ({ ...event }))\n }\n}\n\n/**\n * Project a `FeedbackEvent` down to the snapshot shape carried on\n * `delegation_history` entries.\n *\n * @stable\n */\nexport function eventToSnapshot(event: FeedbackEvent): DelegationFeedbackSnapshot {\n const snap: DelegationFeedbackSnapshot = {\n id: event.id,\n score: event.rating.score,\n by: event.by,\n notes: event.rating.notes,\n capturedAt: event.capturedAt,\n }\n if (event.rating.label) snap.label = event.rating.label\n return snap\n}\n","/**\n *\n * `delegate_feedback` MCP tool — synchronous record of agent / user /\n * downstream-judge feedback on a delegation, artifact, or outcome.\n *\n * The store is append-only. Every rating is its own event; no dedupe.\n * When `refersTo.kind === 'delegation'`, the snapshot is also attached\n * to the matching queue record so `delegation_history` surfaces it\n * inline without a join.\n *\n * @stable\n */\n\nimport type { FeedbackStore } from '../feedback-store'\nimport { eventToSnapshot } from '../feedback-store'\nimport type { DelegationTaskQueue } from '../task-queue'\nimport type {\n DelegateFeedbackArgs,\n DelegateFeedbackResult,\n FeedbackRating,\n FeedbackRefersTo,\n} from '../types'\n\n/** MCP tool name for the `delegate_feedback` feedback-recording tool. @stable */\nexport const DELEGATE_FEEDBACK_TOOL_NAME = 'delegate_feedback'\n\n/** Human-readable description of the `delegate_feedback` MCP tool, injected into the tool manifest. @stable */\nexport const DELEGATE_FEEDBACK_DESCRIPTION = [\n 'Record feedback on a delegation, artifact, or outcome. Synchronous — the',\n 'event is durably stored when this call returns.',\n '',\n 'Use when: you (the agent), the user, or a downstream judge has formed an',\n 'opinion about a piece of work and want it persisted for calibration,',\n 'pricing, or future routing. Every call is a new event — multiple ratings',\n 'on the same target are expected and never deduped.',\n '',\n '`refersTo.kind`:',\n ' - \"delegation\": ref is a taskId returned by delegate_ui_audit',\n ' - \"artifact\": ref is a URI/path/git-sha — anything you can dereference',\n ' - \"outcome\": ref is a free-form description of a downstream result',\n '',\n '`by`:',\n ' - \"agent\": the agent itself rated the work',\n ' - \"user\": the human user rated it',\n ' - \"downstream-judge\": an automated evaluator emitted the rating',\n '',\n 'When ref names a known taskId, the rating is also attached to the',\n 'delegation record so delegation_history surfaces it inline.',\n].join('\\n')\n\n/** JSON Schema for `delegate_feedback` tool arguments (`refersTo`, `rating`, `by`, optional fields). @stable */\nexport const DELEGATE_FEEDBACK_INPUT_SCHEMA = {\n type: 'object',\n properties: {\n refersTo: {\n type: 'object',\n properties: {\n kind: { type: 'string', enum: ['delegation', 'artifact', 'outcome'] },\n ref: { type: 'string' },\n },\n required: ['kind', 'ref'],\n additionalProperties: false,\n },\n rating: {\n type: 'object',\n properties: {\n score: { type: 'number', minimum: 0, maximum: 1 },\n label: { type: 'string', enum: ['good', 'bad', 'neutral', 'mixed'] },\n notes: { type: 'string' },\n },\n required: ['score', 'notes'],\n additionalProperties: false,\n },\n by: { type: 'string', enum: ['agent', 'user', 'downstream-judge'] },\n capturedAt: { type: 'string' },\n namespace: { type: 'string' },\n },\n required: ['refersTo', 'rating', 'by'],\n additionalProperties: false,\n} as const\n\n/** Parse and validate raw MCP tool input into typed `DelegateFeedbackArgs`; throws `TypeError` on bad input. @stable */\nexport function validateDelegateFeedbackArgs(raw: unknown): DelegateFeedbackArgs {\n if (raw === null || typeof raw !== 'object') {\n throw new TypeError('delegate_feedback: arguments must be an object')\n }\n const value = raw as Record<string, unknown>\n const refersTo = validateRefersTo(value.refersTo)\n const rating = validateRating(value.rating)\n const by = value.by\n if (by !== 'agent' && by !== 'user' && by !== 'downstream-judge') {\n throw new TypeError(\n 'delegate_feedback: `by` must be one of \"agent\" | \"user\" | \"downstream-judge\"',\n )\n }\n const args: DelegateFeedbackArgs = { refersTo, rating, by }\n if (value.capturedAt !== undefined) {\n if (typeof value.capturedAt !== 'string' || Number.isNaN(Date.parse(value.capturedAt))) {\n throw new TypeError('delegate_feedback: `capturedAt` must be an ISO datetime')\n }\n args.capturedAt = value.capturedAt\n }\n if (typeof value.namespace === 'string') args.namespace = value.namespace\n return args\n}\n\nfunction validateRefersTo(raw: unknown): FeedbackRefersTo {\n if (raw === null || typeof raw !== 'object') {\n throw new TypeError('delegate_feedback: `refersTo` must be an object')\n }\n const value = raw as Record<string, unknown>\n const kind = value.kind\n if (kind !== 'delegation' && kind !== 'artifact' && kind !== 'outcome') {\n throw new TypeError(\n 'delegate_feedback: `refersTo.kind` must be one of \"delegation\" | \"artifact\" | \"outcome\"',\n )\n }\n const ref = value.ref\n if (typeof ref !== 'string' || ref.trim().length === 0) {\n throw new TypeError('delegate_feedback: `refersTo.ref` must be a non-empty string')\n }\n return { kind, ref: ref.trim() }\n}\n\nfunction validateRating(raw: unknown): FeedbackRating {\n if (raw === null || typeof raw !== 'object') {\n throw new TypeError('delegate_feedback: `rating` must be an object')\n }\n const value = raw as Record<string, unknown>\n const score = Number(value.score)\n if (!Number.isFinite(score) || score < 0 || score > 1) {\n throw new RangeError('delegate_feedback: `rating.score` must be a number in [0, 1]')\n }\n const notes = value.notes\n if (typeof notes !== 'string') {\n throw new TypeError('delegate_feedback: `rating.notes` must be a string')\n }\n const rating: FeedbackRating = { score, notes }\n const label = value.label\n if (label !== undefined) {\n if (label !== 'good' && label !== 'bad' && label !== 'neutral' && label !== 'mixed') {\n throw new TypeError(\n 'delegate_feedback: `rating.label` must be one of \"good\" | \"bad\" | \"neutral\" | \"mixed\"',\n )\n }\n rating.label = label\n }\n return rating\n}\n\n/** @stable */\nexport interface DelegateFeedbackHandlerOptions {\n queue: DelegationTaskQueue\n store: FeedbackStore\n generateId?: () => string\n now?: () => string\n}\n\n/** Build the MCP tool handler that persists feedback events and attaches them to delegation records. @stable */\nexport function createDelegateFeedbackHandler(\n options: DelegateFeedbackHandlerOptions,\n): (raw: unknown) => Promise<DelegateFeedbackResult> {\n const generateId = options.generateId ?? randomFeedbackId\n const now = options.now ?? (() => new Date().toISOString())\n return async (raw) => {\n const args = validateDelegateFeedbackArgs(raw)\n const id = generateId()\n const event = {\n id,\n refersTo: args.refersTo,\n rating: args.rating,\n by: args.by,\n capturedAt: args.capturedAt ?? now(),\n namespace: args.namespace,\n }\n await options.store.put(event)\n if (args.refersTo.kind === 'delegation') {\n options.queue.attachFeedback(args.refersTo.ref, eventToSnapshot(event))\n }\n return { recorded: true, id }\n }\n}\n\nfunction randomFeedbackId(): string {\n const t = Date.now().toString(36)\n const r = Math.random().toString(36).slice(2, 10)\n return `fbk-${t}-${r}`\n}\n","/**\n *\n * MCP delegation tool surface — the typed inputs/outputs the product agent\n * sees over the wire. These types are the contract; the JSON schemas under\n * `tools/*` mirror them for the MCP `tools/list` advertisement.\n *\n * Async semantics: `delegate_ui_audit` returns a `taskId` immediately. The\n * product agent polls `delegation_status` until the task transitions to\n * `completed` | `failed` | `cancelled`. `delegate_feedback` +\n * `delegation_history` are synchronous reads / writes against the local\n * task queue + feedback store.\n *\n * @experimental\n */\n\nimport type { CoderTask } from '../profiles/coder'\nimport type { ResearchSource } from '../profiles/researcher'\nimport type { UiFinding, UiLens } from '../profiles/ui-auditor/substrate'\nimport type { DelegationTraceSpan } from './delegation-trace'\nimport type { CoderOutput } from './detached-coder'\n\n/**\n * Every delegation profile a queued record can carry. One owner: the tool schemas and validators\n * that filter on a profile read this list, so a profile added here cannot be one a tool refuses.\n * @experimental\n */\nexport const delegationProfiles = ['coder', 'researcher', 'ui-auditor'] as const\n\n/** @experimental */\nexport type DelegationProfile = (typeof delegationProfiles)[number]\n\n/** @experimental */\nexport type DelegationStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled'\n\n/**\n * Minimal `CoderTask` overrides exposed over the MCP wire. The full\n * `CoderTask` carries fields the kernel synthesizes from `goal` +\n * `repoRoot` — the agent only edits the few that materially gate\n * validator behavior.\n *\n * @experimental\n */\nexport interface DelegateCodeConfig {\n testCmd?: string\n typecheckCmd?: string\n forbiddenPaths?: string[]\n maxDiffLines?: number\n}\n\n/** @experimental */\nexport interface DelegateCodeArgs {\n /** Natural-language description of what the coder must accomplish. */\n goal: string\n /** Absolute path inside the sandbox where the repo lives. */\n repoRoot: string\n /** Optional free-form context the agent surfaces in the prompt prelude. */\n contextHint?: string\n /**\n * When > 1, dispatches `multiHarnessCoderFanout` across the delegate's configured exact profiles\n * and picks the highest-scoring passing patch. Default 1.\n */\n variants?: number\n /** Validator + prompt overrides the agent knows for this repo. */\n config?: DelegateCodeConfig\n /** Multi-tenant scope (customer-id, workspace-id). */\n namespace?: string\n}\n\n/** @experimental */\nexport interface DelegateCodeResult {\n taskId: string\n /** Best-effort hint — coder loops can take minutes-to-hours. */\n estimatedDurationMs?: number\n}\n\nexport type { ResearchSource }\n\n/** @experimental */\nexport interface DelegateResearchConfig {\n recencyWindow?: { since?: string; until?: string }\n maxItems?: number\n minConfidence?: number\n}\n\n/** @experimental */\nexport interface DelegateResearchArgs {\n question: string\n namespace: string\n scope?: string\n sources?: ResearchSource[]\n variants?: number\n config?: DelegateResearchConfig\n}\n\n/** @experimental */\nexport interface DelegateResearchResult {\n taskId: string\n estimatedDurationMs?: number\n}\n\n/** @experimental */\nexport interface FeedbackRefersTo {\n kind: 'delegation' | 'artifact' | 'outcome'\n /** For `'delegation'`, this is the taskId. */\n ref: string\n}\n\n/** @experimental */\nexport interface FeedbackRating {\n /** [0, 1]. */\n score: number\n label?: 'good' | 'bad' | 'neutral' | 'mixed'\n notes: string\n}\n\n/** @experimental */\nexport interface DelegateFeedbackArgs {\n refersTo: FeedbackRefersTo\n rating: FeedbackRating\n by: 'agent' | 'user' | 'downstream-judge'\n /** ISO timestamp; defaults to server clock when omitted. */\n capturedAt?: string\n namespace?: string\n}\n\n/** @experimental */\nexport interface DelegateFeedbackResult {\n recorded: true\n id: string\n}\n\n/** @experimental */\nexport interface DelegationStatusArgs {\n taskId: string\n /**\n * Return the delegation's compact loop-trace span tree alongside the\n * status. Default false — status polls stay light; opt in when you need\n * the topology (which iterations ran, where they were placed, what each\n * cost) rather than just the state machine.\n */\n includeTrace?: boolean\n}\n\n/** @experimental */\nexport interface DelegationProgress {\n iteration: number\n phase: string\n}\n\n/** @experimental */\nexport interface DelegationError {\n message: string\n kind: string\n}\n\n/**\n * Polymorphic `result` field: `CoderOutput` when the underlying profile\n * is `'coder'`, a structurally-typed research output when `'researcher'`.\n * The MCP wire carries it as JSON either way.\n *\n * @experimental\n */\nexport type DelegationResultPayload =\n | { profile: 'coder'; output: CoderOutput }\n | { profile: 'researcher'; output: ResearchOutputShape }\n | { profile: 'ui-auditor'; output: UiAuditorDelegationOutput }\n\n/**\n * Wire-shape of a completed UI-audit delegation. The `findings` array\n * contains every finding persisted to the workspace during the run,\n * already enriched with `id` and `createdAt` by the writer. `workspaceDir`\n * is the absolute path to the workspace; `indexFile` is the workspace-\n * relative path to the regenerated index.md.\n *\n * @experimental\n */\nexport interface UiAuditorDelegationOutput {\n workspaceDir: string\n indexFile: string\n findings: UiFinding[]\n /** Total iterations the loop ran for this delegation. */\n iterations: number\n}\n\n/** @experimental */\nexport type UiAuditLensFilter = readonly UiLens[]\n\n/** Optional per-route capture spec the agent surfaces over the wire. */\nexport interface DelegateUiAuditRoute {\n /** Stable route name (used in screenshot filenames + finding metadata). */\n name: string\n /** Fully-qualified URL. */\n url: string\n /** Viewports to capture at. Defaults to `[{ width: 1280, height: 800 }]`. */\n viewports?: readonly { width: number; height: number }[]\n /** Default false. Full-page captures for the broad lenses. */\n fullPage?: boolean\n /** Selector to wait for before capture. */\n waitFor?: string\n}\n\n/** @experimental */\nexport interface DelegateUiAuditConfig {\n /**\n * Lenses to iterate. Default: every lens except `'other'`. Order is\n * preserved — the driver iterates lens-by-lens.\n */\n lenses?: UiAuditLensFilter\n /** Maximum total iterations across all (lens × route) pairs. Default 33 (11 lenses × 3 routes). */\n maxIterations?: number\n /** Maximum concurrent iterations within a single plan() round. Default 2. */\n maxConcurrency?: number\n /** Free-form product context surfaced to the judge. */\n productContext?: string\n}\n\n/** @experimental */\nexport interface DelegateUiAuditArgs {\n /** Workspace root for the audit (absolute path). */\n workspaceDir: string\n /** Routes to audit. Must be non-empty. */\n routes: readonly DelegateUiAuditRoute[]\n /** Multi-tenant scope. */\n namespace?: string\n config?: DelegateUiAuditConfig\n}\n\n/** @experimental */\nexport interface DelegateUiAuditResult {\n taskId: string\n estimatedDurationMs?: number\n}\n\n/**\n * Provider-neutral research output carried over the MCP boundary. The MCP\n * layer accepts this structural shape instead of coupling its wire contract to\n * one research implementation.\n *\n * @experimental\n */\nexport interface ResearchOutputShape {\n items: unknown[]\n citations: unknown[]\n proposedWrites: unknown[]\n gaps?: string[]\n notes?: string\n [key: string]: unknown\n}\n\n/** @experimental */\nexport interface DelegationStatusResult {\n taskId: string\n profile: DelegationProfile\n status: DelegationStatus\n progress?: DelegationProgress\n result?: DelegationResultPayload\n error?: DelegationError\n costUsd?: number\n startedAt: string\n completedAt?: string\n /** Compact loop-trace span tree; present only when `includeTrace: true` was passed and spans were recorded. */\n trace?: DelegationTraceSpan[]\n /** Present when oldest trace spans were dropped to honor the trace caps. */\n traceTruncated?: true\n /** Inherited trace identity recorded at submit — join key into the caller's trace. */\n traceId?: string\n /** Caller span that dispatched the delegation, when one was inherited. */\n parentSpanId?: string\n}\n\n/** @experimental */\nexport interface DelegationHistoryArgs {\n namespace?: string\n profile?: DelegationProfile\n /** ISO date — only delegations started at-or-after `since` are returned. */\n since?: string\n /** Default 50. Hard cap 500. */\n limit?: number\n}\n\n/** @experimental */\nexport interface DelegationFeedbackSnapshot {\n id: string\n score: number\n label?: FeedbackRating['label']\n by: DelegateFeedbackArgs['by']\n notes: string\n capturedAt: string\n}\n\n/** @experimental */\nexport interface DelegationHistoryEntry {\n taskId: string\n profile: DelegationProfile\n namespace?: string\n args: DelegateCodeArgs | DelegateResearchArgs | DelegateUiAuditArgs\n status: DelegationStatus\n feedback?: DelegationFeedbackSnapshot[]\n costUsd?: number\n startedAt: string\n completedAt?: string\n /**\n * True when the record carries a journaled loop trace. History stays\n * light by design — fetch the spans via\n * `delegation_status { taskId, includeTrace: true }`.\n */\n hasTrace: boolean\n /** Inherited trace identity recorded at submit — join key into the caller's trace. */\n traceId?: string\n}\n\n/** @experimental */\nexport interface DelegationHistoryResult {\n delegations: DelegationHistoryEntry[]\n}\n\n/**\n * Re-export `CoderTask` so callers wiring custom delegates don't have to\n * import from `./profiles` themselves.\n *\n * @experimental\n */\nexport type { CoderOutput, CoderTask }\n","/**\n *\n * `delegation_history` MCP tool — synchronous read of past delegations.\n * The agent uses this for self-introspection — \"have I delegated this\n * kind of task before? did it work?\" — and calibration.\n *\n * @stable\n */\n\nimport type {\n DelegationHistoryArgs,\n DelegationHistoryResult,\n DelegationProfile,\n DelegationTaskQueue,\n} from '../task-queue'\nimport { delegationProfiles } from '../types'\n\n/** MCP tool name for the `delegation_history` read-past-delegations tool. @stable */\nexport const DELEGATION_HISTORY_TOOL_NAME = 'delegation_history'\n\n/** Human-readable description of the `delegation_history` MCP tool, injected into the tool manifest. @stable */\nexport const DELEGATION_HISTORY_DESCRIPTION = [\n 'Read past delegations newest-first. Each entry carries the original',\n 'arguments, current status, cost, and any feedback attached via',\n 'delegate_feedback.',\n '',\n 'Use when: you want to introspect prior decisions — \"have I asked this',\n 'question before?',\n 'did the last patch land?',\n \"what's the historical\",\n 'success rate of coder delegations on this repo?\". Feed the results back',\n 'into your own routing and calibration.',\n '',\n 'Each entry carries `hasTrace` — when true, the full loop-trace span tree',\n 'is retrievable via delegation_status { taskId, includeTrace: true }.',\n '',\n `Filters: \\`namespace\\` (multi-tenant scope), \\`profile\\` (${delegationProfiles\n .map((profile) => `\"${profile}\"`)\n .join(' | ')}),`,\n '`since` (ISO date — only delegations started at-or-after). `limit` defaults',\n 'to 50, capped at 500.',\n].join('\\n')\n\n/** JSON Schema for `delegation_history` tool arguments (optional `namespace`, `profile`, `since`, `limit`). @stable */\nexport const DELEGATION_HISTORY_INPUT_SCHEMA = {\n type: 'object',\n properties: {\n namespace: { type: 'string' },\n profile: { type: 'string', enum: delegationProfiles },\n since: { type: 'string', description: 'ISO datetime — earliest startedAt to include.' },\n limit: { type: 'integer', minimum: 1, maximum: 500 },\n },\n additionalProperties: false,\n} as const\n\n/** Parse and validate raw MCP tool input into typed `DelegationHistoryArgs`; throws `TypeError` on bad input. @stable */\nexport function validateDelegationHistoryArgs(raw: unknown): DelegationHistoryArgs {\n if (raw === undefined || raw === null) return {}\n if (typeof raw !== 'object') {\n throw new TypeError('delegation_history: arguments must be an object')\n }\n const value = raw as Record<string, unknown>\n const out: DelegationHistoryArgs = {}\n if (value.namespace !== undefined) {\n if (typeof value.namespace !== 'string') {\n throw new TypeError('delegation_history: `namespace` must be a string')\n }\n out.namespace = value.namespace\n }\n if (value.profile !== undefined) {\n if (!delegationProfiles.includes(value.profile as DelegationProfile)) {\n throw new TypeError(\n `delegation_history: \\`profile\\` must be one of ${delegationProfiles.join(', ')}`,\n )\n }\n out.profile = value.profile as DelegationProfile\n }\n if (value.since !== undefined) {\n if (typeof value.since !== 'string' || Number.isNaN(Date.parse(value.since))) {\n throw new TypeError('delegation_history: `since` must be an ISO datetime')\n }\n out.since = value.since\n }\n if (value.limit !== undefined) {\n const n = Number(value.limit)\n if (!Number.isFinite(n) || n < 1 || n > 500) {\n throw new RangeError('delegation_history: `limit` must be an integer in [1, 500]')\n }\n out.limit = Math.trunc(n)\n }\n return out\n}\n\n/** @stable */\nexport interface DelegationHistoryHandlerOptions {\n queue: DelegationTaskQueue\n}\n\n/** Build the MCP tool handler that reads filtered past delegations from a `DelegationTaskQueue`. @stable */\nexport function createDelegationHistoryHandler(\n options: DelegationHistoryHandlerOptions,\n): (raw: unknown) => Promise<DelegationHistoryResult> {\n return async (raw) => {\n const args = validateDelegationHistoryArgs(raw)\n return { delegations: options.queue.history(args) }\n }\n}\n","/**\n *\n * `delegation_status` MCP tool — synchronous poll. Returns the current\n * state machine + optional progress + final result (when terminal).\n *\n * @stable\n */\n\nimport { NotFoundError } from '../../errors'\nimport type {\n DelegationStatusArgs,\n DelegationStatusResult,\n DelegationTaskQueue,\n} from '../task-queue'\n\n/** MCP tool name for the `delegation_status` synchronous-poll tool. @stable */\nexport const DELEGATION_STATUS_TOOL_NAME = 'delegation_status'\n\n/** Human-readable description of the `delegation_status` MCP tool, injected into the tool manifest. @stable */\nexport const DELEGATION_STATUS_DESCRIPTION = [\n 'Poll the status of an async delegation. Returns the current state',\n '(pending | running | completed | failed | cancelled), optional progress,',\n 'and the final result when status === \"completed\".',\n '',\n 'Use when: you previously kicked off an async delegation (delegate_ui_audit)',\n \"and need to know whether the work is done. The agent's right rhythm is to\",\n 'call this every minute or two while waiting; do not busy-poll.',\n '',\n 'For a completed delegate_ui_audit run, `result.output` is the array of UI',\n 'findings — one self-contained Markdown finding per issue, each with an',\n 'embedded screenshot and a suggested fix.',\n '',\n 'Pass includeTrace: true to also receive the journaled loop-trace span',\n 'tree (loop → round → iteration, with placement/cost/verdict metadata).',\n 'Default false — keep routine polls light.',\n '',\n 'Throws NotFoundError when taskId is unknown — never silently returns',\n '`pending` for a typo.',\n].join('\\n')\n\n/** JSON Schema for `delegation_status` tool arguments (`taskId` + optional `includeTrace`). @stable */\nexport const DELEGATION_STATUS_INPUT_SCHEMA = {\n type: 'object',\n properties: {\n taskId: { type: 'string', description: 'Returned by delegate_ui_audit.' },\n includeTrace: {\n type: 'boolean',\n description:\n 'Also return the journaled loop-trace span tree for this delegation. Default false.',\n },\n },\n required: ['taskId'],\n additionalProperties: false,\n} as const\n\n/** Parse and validate raw MCP tool input into typed `DelegationStatusArgs`; throws `TypeError` on bad input. @stable */\nexport function validateDelegationStatusArgs(raw: unknown): DelegationStatusArgs {\n if (raw === null || typeof raw !== 'object') {\n throw new TypeError('delegation_status: arguments must be an object')\n }\n const value = raw as Record<string, unknown>\n const taskId = value.taskId\n if (typeof taskId !== 'string' || taskId.trim().length === 0) {\n throw new TypeError('delegation_status: `taskId` must be a non-empty string')\n }\n const out: DelegationStatusArgs = { taskId: taskId.trim() }\n if (value.includeTrace !== undefined) {\n if (typeof value.includeTrace !== 'boolean') {\n throw new TypeError('delegation_status: `includeTrace` must be a boolean')\n }\n out.includeTrace = value.includeTrace\n }\n return out\n}\n\n/** @stable */\nexport interface DelegationStatusHandlerOptions {\n queue: DelegationTaskQueue\n}\n\n/** Build the MCP tool handler that polls a `DelegationTaskQueue` for task status. @stable */\nexport function createDelegationStatusHandler(\n options: DelegationStatusHandlerOptions,\n): (raw: unknown) => Promise<DelegationStatusResult> {\n return async (raw) => {\n const args = validateDelegationStatusArgs(raw)\n const status = options.queue.status(\n args.taskId,\n args.includeTrace !== undefined ? { includeTrace: args.includeTrace } : undefined,\n )\n if (!status) {\n throw new NotFoundError(`delegation_status: unknown taskId \"${args.taskId}\"`)\n }\n return status\n }\n}\n"],"mappings":";;;AAwCA,IAAa,wBAAb,MAA4D;CAC1D,SAA2C,CAAC;CAE5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