@namzu/sdk 8.0.0 → 10.0.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 (104) hide show
  1. package/CHANGELOG.md +244 -0
  2. package/dist/agents/SupervisorAgent.d.ts.map +1 -1
  3. package/dist/agents/SupervisorAgent.js +14 -6
  4. package/dist/agents/SupervisorAgent.js.map +1 -1
  5. package/dist/agents/__tests__/a-policy-nobody-can-select.test.d.ts +2 -0
  6. package/dist/agents/__tests__/a-policy-nobody-can-select.test.d.ts.map +1 -0
  7. package/dist/agents/__tests__/a-policy-nobody-can-select.test.js +177 -0
  8. package/dist/agents/__tests__/a-policy-nobody-can-select.test.js.map +1 -0
  9. package/dist/gateway/__tests__/a-knob-nobody-can-turn.test.d.ts +2 -0
  10. package/dist/gateway/__tests__/a-knob-nobody-can-turn.test.d.ts.map +1 -0
  11. package/dist/gateway/__tests__/a-knob-nobody-can-turn.test.js +114 -0
  12. package/dist/gateway/__tests__/a-knob-nobody-can-turn.test.js.map +1 -0
  13. package/dist/gateway/local.d.ts.map +1 -1
  14. package/dist/gateway/local.js +19 -6
  15. package/dist/gateway/local.js.map +1 -1
  16. package/dist/manager/agent/__tests__/lifecycle.test.js +56 -0
  17. package/dist/manager/agent/__tests__/lifecycle.test.js.map +1 -1
  18. package/dist/manager/agent/lifecycle.d.ts.map +1 -1
  19. package/dist/manager/agent/lifecycle.js +62 -33
  20. package/dist/manager/agent/lifecycle.js.map +1 -1
  21. package/dist/manager/plan/__tests__/a-plan-that-succeeded-is-not-failed.test.d.ts +2 -0
  22. package/dist/manager/plan/__tests__/a-plan-that-succeeded-is-not-failed.test.d.ts.map +1 -0
  23. package/dist/manager/plan/__tests__/a-plan-that-succeeded-is-not-failed.test.js +73 -0
  24. package/dist/manager/plan/__tests__/a-plan-that-succeeded-is-not-failed.test.js.map +1 -0
  25. package/dist/manager/plan/lifecycle.d.ts +48 -0
  26. package/dist/manager/plan/lifecycle.d.ts.map +1 -1
  27. package/dist/manager/plan/lifecycle.js +56 -0
  28. package/dist/manager/plan/lifecycle.js.map +1 -1
  29. package/dist/runtime/query/__tests__/the-plan-graph-reaches-a-host.test.d.ts +2 -0
  30. package/dist/runtime/query/__tests__/the-plan-graph-reaches-a-host.test.d.ts.map +1 -0
  31. package/dist/runtime/query/__tests__/the-plan-graph-reaches-a-host.test.js +62 -0
  32. package/dist/runtime/query/__tests__/the-plan-graph-reaches-a-host.test.js.map +1 -0
  33. package/dist/runtime/query/events.d.ts.map +1 -1
  34. package/dist/runtime/query/events.js +5 -0
  35. package/dist/runtime/query/events.js.map +1 -1
  36. package/dist/runtime/query/index.d.ts +0 -1
  37. package/dist/runtime/query/index.d.ts.map +1 -1
  38. package/dist/runtime/query/index.js +0 -1
  39. package/dist/runtime/query/index.js.map +1 -1
  40. package/dist/runtime/query/iteration/phases/context.d.ts +0 -17
  41. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  42. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  43. package/dist/store/task/disk.d.ts.map +1 -1
  44. package/dist/store/task/disk.js +14 -0
  45. package/dist/store/task/disk.js.map +1 -1
  46. package/dist/store/task/memory.d.ts.map +1 -1
  47. package/dist/store/task/memory.js +14 -0
  48. package/dist/store/task/memory.js.map +1 -1
  49. package/dist/tools/coordinator/__tests__/a-failed-worker-is-not-an-answer.test.d.ts +2 -0
  50. package/dist/tools/coordinator/__tests__/a-failed-worker-is-not-an-answer.test.d.ts.map +1 -0
  51. package/dist/tools/coordinator/__tests__/a-failed-worker-is-not-an-answer.test.js +101 -0
  52. package/dist/tools/coordinator/__tests__/a-failed-worker-is-not-an-answer.test.js.map +1 -0
  53. package/dist/tools/coordinator/__tests__/the-plan-a-human-approves.test.d.ts +2 -0
  54. package/dist/tools/coordinator/__tests__/the-plan-a-human-approves.test.d.ts.map +1 -0
  55. package/dist/tools/coordinator/__tests__/the-plan-a-human-approves.test.js +99 -0
  56. package/dist/tools/coordinator/__tests__/the-plan-a-human-approves.test.js.map +1 -0
  57. package/dist/tools/coordinator/agent.d.ts.map +1 -1
  58. package/dist/tools/coordinator/agent.js +17 -23
  59. package/dist/tools/coordinator/agent.js.map +1 -1
  60. package/dist/tools/coordinator/index.d.ts.map +1 -1
  61. package/dist/tools/coordinator/index.js +33 -3
  62. package/dist/tools/coordinator/index.js.map +1 -1
  63. package/dist/tools/coordinator/outcome.d.ts +60 -0
  64. package/dist/tools/coordinator/outcome.d.ts.map +1 -0
  65. package/dist/tools/coordinator/outcome.js +68 -0
  66. package/dist/tools/coordinator/outcome.js.map +1 -0
  67. package/dist/types/agent/gateway.d.ts +19 -2
  68. package/dist/types/agent/gateway.d.ts.map +1 -1
  69. package/dist/types/agent/supervisor.d.ts +38 -1
  70. package/dist/types/agent/supervisor.d.ts.map +1 -1
  71. package/dist/types/plan/index.d.ts +26 -0
  72. package/dist/types/plan/index.d.ts.map +1 -1
  73. package/dist/types/run/events.d.ts +17 -0
  74. package/dist/types/run/events.d.ts.map +1 -1
  75. package/dist/types/run/events.js.map +1 -1
  76. package/dist/types/task/index.d.ts +19 -1
  77. package/dist/types/task/index.d.ts.map +1 -1
  78. package/dist/types/task/index.js +10 -1
  79. package/dist/types/task/index.js.map +1 -1
  80. package/package.json +1 -1
  81. package/src/agents/SupervisorAgent.ts +15 -9
  82. package/src/agents/__tests__/a-policy-nobody-can-select.test.ts +202 -0
  83. package/src/gateway/__tests__/a-knob-nobody-can-turn.test.ts +139 -0
  84. package/src/gateway/local.ts +19 -7
  85. package/src/manager/agent/__tests__/lifecycle.test.ts +74 -0
  86. package/src/manager/agent/lifecycle.ts +72 -42
  87. package/src/manager/plan/__tests__/a-plan-that-succeeded-is-not-failed.test.ts +88 -0
  88. package/src/manager/plan/lifecycle.ts +61 -0
  89. package/src/runtime/query/__tests__/the-plan-graph-reaches-a-host.test.ts +79 -0
  90. package/src/runtime/query/events.ts +5 -0
  91. package/src/runtime/query/index.ts +0 -6
  92. package/src/runtime/query/iteration/phases/context.ts +0 -19
  93. package/src/store/task/disk.ts +15 -0
  94. package/src/store/task/memory.ts +15 -0
  95. package/src/tools/coordinator/__tests__/a-failed-worker-is-not-an-answer.test.ts +133 -0
  96. package/src/tools/coordinator/__tests__/the-plan-a-human-approves.test.ts +121 -0
  97. package/src/tools/coordinator/agent.ts +17 -25
  98. package/src/tools/coordinator/index.ts +33 -3
  99. package/src/tools/coordinator/outcome.ts +70 -0
  100. package/src/types/agent/gateway.ts +19 -2
  101. package/src/types/agent/supervisor.ts +40 -1
  102. package/src/types/plan/index.ts +29 -0
  103. package/src/types/run/events.ts +17 -0
  104. package/src/types/task/index.ts +22 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,249 @@
1
1
  # Changelog
2
2
 
3
+ ## 10.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 84660f7: `drainQuery` no longer accepts `launchedTasks`, a map nothing ever read.
8
+
9
+ `SupervisorAgent` created a `Map<TaskId, LaunchedTaskMeta>`, filled it from
10
+ `onTaskLaunched`, and threaded it through `drainQuery` into the iteration
11
+ context. Nothing consulted it — six mentions across the repository, every one a
12
+ declaration, an assignment, or a hand-off, and no reader at any of them. It is
13
+ what remains of the old non-blocking delegation flow, whose consumer was removed
14
+ when `create_task` became blocking.
15
+
16
+ For a host the field was inert in both directions: nothing writes a
17
+ host-supplied map, so passing one did nothing and reading it back gave an empty
18
+ map. Removed straight out rather than deprecated, on the rule that a deprecation
19
+ window exists so working code can migrate and there is no working code to
20
+ migrate off a field with no producer and no reader.
21
+
22
+ **What stays.** `onTaskLaunched` on the coordinator tool options, and the meta it
23
+ carries. The `Agent` tool still calls it, so it remains a real seam for a host
24
+ that builds coordinator tools directly and wants to observe launches. What went
25
+ was the accumulator, not the signal.
26
+
27
+ **Breaking:** `launchedTasks` is gone from `drainQuery`'s parameters, and
28
+ `LaunchedTaskMeta` is no longer exported from the iteration context module. If
29
+ you passed either, delete the argument — it was not doing anything. To observe
30
+ launches, pass `onTaskLaunched` to `buildCoordinatorTools`.
31
+
32
+ ## 9.0.0
33
+
34
+ ### Major Changes
35
+
36
+ - 16dc634: A failed worker is reported as a failure, and a plan task can say it failed.
37
+
38
+ **`create_task` reported a failed worker as a success.** Two layers can disagree
39
+ about whether a delegated run succeeded: the gateway's `TaskHandle.state`, and
40
+ the run's own `BaseAgentResult.status`. The kernel's `finalizeChild` always calls
41
+ `markCompleted`, so `state === 'completed'` holds for a child that ran and
42
+ returned `status: 'failed'` — and `create_task` asked only that layer. The model
43
+ received the failure text as an answer, the tool result carried
44
+ `isError: false`, and the plan task was written closed as though the work had
45
+ been done.
46
+
47
+ The correct two-authority predicate was already written, twenty lines away, in
48
+ the canonical `Agent` tool — put there because a review caught it on that site,
49
+ and nothing carried the answer to the other one. It now lives in one place both
50
+ reach.
51
+
52
+ **`TaskStatus` gains `failed`, and that is the breaking part.** A unit that did
53
+ not succeed had nowhere to say so, which is why a failed delegation was recorded
54
+ as `completed` with the failure encoded as prose in `description`: a reader
55
+ scanning statuses saw work that had been done, and a dependent unit had no way
56
+ to tell at all.
57
+
58
+ If you switch exhaustively over `TaskStatus`, or hold a `Record<TaskStatus, T>`,
59
+ you need a `failed` arm. `isTerminalTaskStatus` now returns `true` for it —
60
+ terminal means "will not change on its own", not "succeeded", and a unit blocked
61
+ on something that failed would otherwise wait forever for a status that will
62
+ never arrive. In the store's transition ranking `failed` sits alongside
63
+ `completed` rather than after it, so `in_progress → failed` is allowed and
64
+ `completed → failed` is not.
65
+
66
+ **Two smaller repairs ride along.** A background launch refused for want of a
67
+ completion inbox now marks its plan task failed rather than leaving it in
68
+ progress with no worker behind it — nothing later closes a task whose launch
69
+ never happened. And the `Agent` tool passes `parentSpan` when creating its
70
+ child, so a delegated run joins the turn that asked for it instead of starting
71
+ its own root trace; `create_task` has done this all along.
72
+
73
+ - a743c7e: A delegated run is built with the config its caller asked for, and a supervisor can select its sibling-failure policy.
74
+
75
+ Two capabilities were declared, documented, typed, and unreachable. Both are the
76
+ same defect: a knob wired to nothing, which reads to a caller as a knob that
77
+ works.
78
+
79
+ **`CreateTaskOptions.configOverrides` was accepted and dropped.**
80
+ `LocalTaskGateway.createTask` built its own `configOverrides` object out of
81
+ `parentSpan` alone and never read the field, so a caller pinning a delegated run
82
+ to a cheaper model, or capping its iterations, got the agent's defaults and no
83
+ indication anything had been ignored. It is forwarded now. A caller who sets
84
+ both the field and the dedicated `parentSpan` option gets the dedicated one for
85
+ the span — that is the specific field for the job — and keeps every other
86
+ override alongside it.
87
+
88
+ **`siblingFailurePolicy` could not be selected by any host.**
89
+ `LocalTaskGateway` has honoured it since it was written and the cancellation
90
+ machinery behind `'cancel-siblings'` is complete — but it was the fifth
91
+ constructor argument of a gateway `SupervisorAgent` builds itself, and the
92
+ supervisor passed four. Every host in existence ran `'continue'`, and the only
93
+ route to the other value was to construct the gateway by hand and pass it as
94
+ `config.gateway`. It is now `SupervisorAgentConfig.siblingFailurePolicy`.
95
+
96
+ `'continue'` remains the default and deliberately so: partial results are
97
+ usually worth having, and tearing down healthy siblings on any failure lets one
98
+ flaky child waste four good ones. `'cancel-siblings'` is for a fan-out whose
99
+ parts only mean something together. The choice is now expressible; the answer
100
+ has not changed. The field is ignored when the host supplies its own `gateway`,
101
+ which owns its policy.
102
+
103
+ **Breaking:** `CreateTaskOptions.configOverrides` is now typed
104
+ `Partial<BaseAgentConfig>` instead of `Record<string, unknown>`. It lands on
105
+ `SendMessageOptions.configOverrides`, which is already that shape, and the loose
106
+ type let a misspelled key type-check and then silently do nothing — the same
107
+ silence the field was already producing. If you pass a key that is not on
108
+ `BaseAgentConfig`, it will now fail to compile; that key was never being applied.
109
+
110
+ **Also:** the two-authority failure check in `LocalTaskGateway` moves to
111
+ `taskFailed` in `tools/coordinator/outcome.ts`, next to `taskSucceeded`. It is
112
+ deliberately _not_ the negation of that predicate — a task that is still running
113
+ satisfies neither, and cancelling a fan-out on `!taskSucceeded` would tear down
114
+ siblings the moment the first child had merely not finished yet. The gateway's
115
+ copy was correct; a rule each caller has to remember is one a caller eventually
116
+ forgets, which is what happened to `taskSucceeded` before it was consolidated.
117
+
118
+ - 529b343: `PlanManager.completePlan` refuses an unreported step instead of scoring it a failure.
119
+
120
+ **A plan that fully succeeded was reported as failed.** `completePlan` asked one
121
+ question — "is every step `completed` or `skipped`?" — and everything that was
122
+ not fell to the same branch. A step still `pending` therefore produced
123
+ `status: 'failed'`, indistinguishable from a step that genuinely failed. Since
124
+ `addStep` defaults every step to `pending`, a host that added steps, did the
125
+ work, and settled the plan without calling `updateStepStatus` on each one got
126
+ `failed` for a plan where nothing had gone wrong. That is the path of least
127
+ effort through this API, not an unusual one.
128
+
129
+ The two cases are different facts and deserve different answers. A step that
130
+ FAILED is an outcome: report the plan failed. A step nobody reported on is not
131
+ an outcome at all — it says the caller and the plan disagree about whether the
132
+ work is over, and answering `failed` settles that disagreement by inventing a
133
+ result.
134
+
135
+ **What changes for you.** `completePlan()` now throws when any step is still
136
+ `pending` or `running`. The message names the unfinished steps and both ways
137
+ forward, because a caller in this position either forgot to report progress or
138
+ called too early, and only they know which:
139
+
140
+ - report each step with `updateStepStatus` — `'skipped'` is a valid outcome for
141
+ work that was planned and then not needed; or
142
+ - call `failPlan` if the plan is being abandoned, which marks unfinished steps
143
+ `skipped` and settles the plan as failed.
144
+
145
+ Behaviour is unchanged once every step has reported: all `completed` or
146
+ `skipped` still yields `completed`, and any `failed` still yields `failed`.
147
+ No code in this repository called `completePlan`, so nothing inside the kernel
148
+ changes behaviour; the affected callers are hosts.
149
+
150
+ **`PlanManager` now says which half of it the kernel drives.** The kernel builds
151
+ a plan, gates it, translates its events, and settles it on failure — it never
152
+ reports a step outcome and never settles a plan that succeeded. That is a
153
+ deliberate split, since `drainQuery` hands the manager to the host through
154
+ `onContextCreated` for exactly this purpose, and a search for callers inside the
155
+ package finds none because the callers are outside it. The absence had already
156
+ been read once as a dead layer and proposed for deletion; what that would have
157
+ deleted is a working human-in-the-loop approval gate. It is written down now.
158
+
159
+ ### Minor Changes
160
+
161
+ - e355049: The plan a human approves names the agent the model chose.
162
+
163
+ `approve_plan` asks the model for an `agent_id` per step — "which agent handles
164
+ this" — and reduced the answer to a boolean. The step got
165
+ `toolName: 'create_task'` when any agent was named and nothing when not, so the
166
+ name was dropped between the model saying it and the human being shown the plan.
167
+
168
+ The approval is the one moment where that difference can still be acted on.
169
+ Approving "delegate this step" is not the same as approving "delegate this step
170
+ to the agent with shell access", and a reviewer who cannot see which agent was
171
+ chosen cannot withhold approval from the wrong one. Two delegated steps reached
172
+ the approver identical in every field.
173
+
174
+ `PlanStep` gains `agentId?: string`, populated by `approve_plan` from the
175
+ model's choice. A host rendering a plan approval can show it directly. Absent
176
+ still means the step is the orchestrator's own work, which is what omitting
177
+ `agent_id` says — so absent stays absent rather than becoming a placeholder.
178
+
179
+ Typed rather than folded into the existing `estimatedInput`, which is `unknown`:
180
+ an approval gate's whole job is being readable, and a field a host must cast
181
+ before it can render is one a host renders wrong or not at all. `estimatedInput`
182
+ is now documented as having no producer and no reader, since that is what it
183
+ has, and it is left in place because it is on the published typings.
184
+
185
+ - 16dc634: A host can see the fan-out gate, and the plan graph the model is already keeping.
186
+
187
+ **`SupervisorAgentConfig` gains `maxToolConcurrency`.** The kernel has honoured
188
+ it all along and `ReactiveAgent` forwards it — it was missing on the one agent
189
+ whose entire job is delegation. So the agent that fans out could not set the gate
190
+ that bounds a fan-out, while the agent that does not fan out could, and a host
191
+ wanting a narrower one had to reach past the supervisor to `drainQuery`.
192
+
193
+ Note what it bounds: how many delegated children run **concurrently**, not how
194
+ many a turn may launch. A model emitting twenty `create_task` blocks still
195
+ launches twenty; they queue.
196
+
197
+ **`task_created` and `task_updated` carry `blockedBy`.** The task store
198
+ maintains a full dependency graph — `blocks` and `blockedBy` mirrored on both
199
+ ends, written under a lock, deadlock-avoided — and none of it reached the wire.
200
+ A host could draw a flat list of units and nothing about their order, while the
201
+ model was already maintaining the order.
202
+
203
+ Absent rather than empty when a unit depends on nothing, so a reader can tell
204
+ "no dependencies" from an emitter that predates the field.
205
+
206
+ **And `block()` announced nothing at all.** Both stores wrote the edge and
207
+ emitted no event, so the graph was observable only by polling: a listener saw a
208
+ unit created and never learned that something now waits on it. Both stores now
209
+ announce **both ends**, because both changed — a host tracking one side would
210
+ draw half the edge. The disk store announces only when something actually
211
+ changed, so re-establishing an existing edge stays silent.
212
+
213
+ That second half is the one worth knowing about if you consume these events: the
214
+ field alone would have been useless, because the moment a dependency is created
215
+ was never on the wire in the first place.
216
+
217
+ ### Patch Changes
218
+
219
+ - 16dc634: A concurrent fan-out no longer allocates more budget than the parent has.
220
+
221
+ `sendMessage` read the parent's remaining budget at the top and debited it after
222
+ `provisionSpawn` — putting the two halves of a read-modify-write on either side
223
+ of an await, with the only critical section in between. So siblings launched
224
+ from one assistant turn all read the same undebited number and each took a
225
+ fraction of it. Measured: \*\*four concurrent children were handed 50 000 + 50 000
226
+
227
+ - 50 000 + 50 000 from a pool of 100 000.\*\*
228
+
229
+ `create_task`'s own description instructs exactly the shape that triggers it —
230
+ _"'fan out 8 specialists' is one assistant message with 8 create_task blocks"_ —
231
+ so the documented usage was the reproduction.
232
+
233
+ The read, the refusal when an allocation floors to zero, and the debit now all
234
+ happen inside the per-parent spawn lock. That keeps the property the debit's
235
+ placement was chosen for — a spawn this call rejects burns no allocation — while
236
+ closing the race that placement opened. It was introduced by a correct fix to a
237
+ different bug: moving the debit after the provisioning put it outside the lock.
238
+
239
+ **Nothing pinned it**, and the reason is worth knowing if you write tests here:
240
+ the existing concurrency test builds a fresh context per call, so each spawn got
241
+ its own tracker — it measures width, not budget. The sequential tests pass
242
+ because a refund makes the arithmetic close. The regression test holds its
243
+ children open, because a settled child refunds and the refund restores a
244
+ plausible number; a test that measures after settle sees a healthy total and
245
+ reports nothing.
246
+
3
247
  ## 8.0.0
4
248
 
5
249
  ### Major Changes
@@ -1 +1 @@
1
- {"version":3,"file":"SupervisorAgent.d.ts","sourceRoot":"","sources":["../../src/agents/SupervisorAgent.ts"],"names":[],"mappings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uBAAuB,CAAA;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACpC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,KAAK,EAAE,KAAK,EACZ,GAAG,GAAE,MAAmB,GACtB,eAAe,EAAE,CAcnB;AAED,4DAA4D;AAC5D,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,CAEnF;AAED,qBAAa,eAAgB,SAAQ,aAAa,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAC/F,QAAQ,CAAC,IAAI,EAAG,YAAY,CAAS;gBAEzB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc,CAAC;IAalE;;;;;;;;OAQG;IACG,GAAG,CACR,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,qBAAqB,CAAC;YAMnB,YAAY;CAwR1B"}
@@ -121,12 +121,18 @@ export class SupervisorAgent extends AbstractAgent {
121
121
  projectId,
122
122
  parentActor,
123
123
  };
124
- gateway = new LocalTaskGateway(config.agentManager, taskContext, listener, input);
124
+ // The only hop between the config and the gateway's policy. Omit it
125
+ // and the field is settable, documented, and read by nothing —
126
+ // which is exactly the state it was in before.
127
+ gateway = new LocalTaskGateway(config.agentManager, taskContext, listener, input, {
128
+ ...(config.siblingFailurePolicy
129
+ ? { siblingFailurePolicy: config.siblingFailurePolicy }
130
+ : {}),
131
+ });
125
132
  }
126
133
  else {
127
134
  throw new Error("SupervisorAgentConfig requires either 'gateway' or 'agentManager'");
128
135
  }
129
- const launchedTasks = new Map();
130
136
  let planManagerRef;
131
137
  // Created here because the TOOLS are created here: the durability
132
138
  // channel has to reach the tool instance, and the run that supplies
@@ -163,9 +169,6 @@ export class SupervisorAgent extends AbstractAgent {
163
169
  taskStore: input.taskStore,
164
170
  runId,
165
171
  getPlanManager: () => planManagerRef,
166
- onTaskLaunched: (agentTaskId, meta) => {
167
- launchedTasks.set(agentTaskId, meta);
168
- },
169
172
  // With a resume handler present the coordinator surface gains
170
173
  // ask_user_question — the model can park the run on a question
171
174
  // routed through the same HITL channel as plan approvals.
@@ -252,6 +255,12 @@ export class SupervisorAgent extends AbstractAgent {
252
255
  },
253
256
  questionParks,
254
257
  pendingAnswers,
258
+ // How wide a fan-out actually runs. Absent leaves the kernel
259
+ // default — the same forwarding ReactiveAgent has always done,
260
+ // missing from the one agent whose job is delegation.
261
+ ...(config.maxToolConcurrency !== undefined
262
+ ? { maxToolConcurrency: config.maxToolConcurrency }
263
+ : {}),
255
264
  agentId: this.metadata.id,
256
265
  agentName: this.metadata.name,
257
266
  workingDirectory: input.workingDirectory,
@@ -273,7 +282,6 @@ export class SupervisorAgent extends AbstractAgent {
273
282
  runtimeContext: input.runtimeContext,
274
283
  taskGateway: gateway,
275
284
  completionInbox,
276
- launchedTasks,
277
285
  advisory: config.advisory,
278
286
  invocationState: childInvocationState,
279
287
  // HITL surface: forward optional review-time hooks so hosts can
@@ -1 +1 @@
1
- {"version":3,"file":"SupervisorAgent.js","sourceRoot":"","sources":["../../src/agents/SupervisorAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AACvF,OAAO,EAAE,qBAAqB,EA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AC,KAAK,EAAE,CAAA;QACxB,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=a-policy-nobody-can-select.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a-policy-nobody-can-select.test.d.ts","sourceRoot":"","sources":["../../../src/agents/__tests__/a-policy-nobody-can-select.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,177 @@
1
+ import { mkdtemp } from 'node:fs/promises';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { describe, expect, it } from 'vitest';
5
+ import { MockLLMProvider, registerMock } from '../../provider/index.js';
6
+ import { ToolRegistry } from '../../registry/index.js';
7
+ import { SupervisorAgent } from '../SupervisorAgent.js';
8
+ /**
9
+ * `'cancel-siblings'` was unreachable from every entry point.
10
+ *
11
+ * `LocalTaskGateway` has honoured the policy since it was written and the
12
+ * cancellation machinery behind it is complete — but the policy was the fifth
13
+ * constructor argument of a gateway the supervisor builds itself, and the
14
+ * supervisor passed four. So every host in existence ran `'continue'`, and the
15
+ * only way to reach the other value was to construct the gateway by hand and
16
+ * hand it in through `config.gateway`. A policy nobody can select is not a
17
+ * policy, and the tests it had all constructed the gateway directly, so they
18
+ * passed while nothing upstream could turn it on.
19
+ *
20
+ * The assertion is deliberately the cancellation itself. Asserting that the run
21
+ * completed would pass with the forwarding deleted — a fan-out under
22
+ * `'continue'` completes too — and prove nothing.
23
+ */
24
+ registerMock();
25
+ const FAILING = 'doomed';
26
+ const SLOW = 'patient';
27
+ /**
28
+ * A manager whose slow child only settles when someone cancels it — which is
29
+ * what an abort actually does, and what lets this run terminate at all.
30
+ */
31
+ class FanOutManager {
32
+ cancelled = [];
33
+ tasks = new Map();
34
+ releaseSlow;
35
+ slowSettled = new Promise((resolve) => {
36
+ this.releaseSlow = resolve;
37
+ });
38
+ markLaunched;
39
+ /**
40
+ * The doomed child does not settle until BOTH have launched.
41
+ *
42
+ * Without this the test is a race it usually wins: the sibling policy only
43
+ * cancels tasks the gateway is already tracking, so if the failure lands
44
+ * before the slow child finishes registering, nothing is cancelled, nothing
45
+ * releases the slow child, and the run hangs until the delegation timeout.
46
+ * That happened once here. A fan-out where one leg dies while another is
47
+ * genuinely in flight is the scenario being tested, so the harness states
48
+ * it instead of hoping for it.
49
+ */
50
+ bothLaunched = new Promise((resolve) => {
51
+ this.markLaunched = resolve;
52
+ });
53
+ async sendMessage(options) {
54
+ const failing = options.agentId === FAILING;
55
+ const taskId = (failing ? 'task_doomed' : 'task_patient');
56
+ const task = {
57
+ taskId,
58
+ agentId: options.agentId,
59
+ agent: {},
60
+ childAbortController: new AbortController(),
61
+ context: {},
62
+ // The failing child is `completed` at the gateway layer and
63
+ // `failed` in its own result — the two-authority split that makes
64
+ // this worth checking at all.
65
+ state: (failing ? 'completed' : 'running'),
66
+ pendingMessages: [],
67
+ createdAt: 1,
68
+ ...(failing
69
+ ? { result: { runId: 'run_child', status: 'failed', result: 'it broke' } }
70
+ : {}),
71
+ };
72
+ this.tasks.set(taskId, task);
73
+ if (this.tasks.size === 2)
74
+ this.markLaunched?.();
75
+ return task;
76
+ }
77
+ cancel(taskId) {
78
+ this.cancelled.push(taskId);
79
+ const task = this.tasks.get(taskId);
80
+ if (task)
81
+ task.state = 'failed';
82
+ this.releaseSlow?.();
83
+ }
84
+ async waitForCompletion(taskId) {
85
+ if (taskId === 'task_patient')
86
+ await this.slowSettled;
87
+ // The doomed child fails only once its sibling is actually in flight —
88
+ // see `bothLaunched`. Registration happens inside `createTask` right
89
+ // after `sendMessage` returns, so waiting a further microtask turn is
90
+ // what puts this after it rather than racing it.
91
+ else {
92
+ await this.bothLaunched.then(() => undefined);
93
+ // Safety valve, and it is what makes a REGRESSION legible. If the
94
+ // policy never reaches the gateway, nothing cancels the slow child
95
+ // and this run hangs until the delegation timeout — so the test
96
+ // would report "timed out after 60s" instead of "the sibling was
97
+ // not cancelled". Releasing it here means the assertion below is
98
+ // what fails, and it fails in a second.
99
+ setTimeout(() => this.releaseSlow?.(), 250).unref?.();
100
+ }
101
+ }
102
+ getInstance(taskId) {
103
+ return this.tasks.get(taskId);
104
+ }
105
+ cancelAll() { }
106
+ async continueTask() { }
107
+ queueMessage() { }
108
+ drainMessages() {
109
+ return [];
110
+ }
111
+ listByParent() {
112
+ return [];
113
+ }
114
+ listActive() {
115
+ return [];
116
+ }
117
+ getState() {
118
+ return undefined;
119
+ }
120
+ on() { }
121
+ off() { }
122
+ cleanup() { }
123
+ dispose() { }
124
+ }
125
+ async function fanOut(policy) {
126
+ const agentManager = new FanOutManager();
127
+ const agent = new SupervisorAgent({
128
+ id: 'sup_policy',
129
+ name: 'Supervisor',
130
+ version: '1',
131
+ category: 'test',
132
+ description: 'coordinates workers',
133
+ });
134
+ await agent.run({
135
+ messages: [{ role: 'user', content: 'go', timestamp: 1 }],
136
+ workingDirectory: await mkdtemp(join(tmpdir(), 'namzu-sibling-policy-')),
137
+ }, {
138
+ provider: new MockLLMProvider({
139
+ turns: [
140
+ {
141
+ toolCalls: [
142
+ {
143
+ name: 'create_task',
144
+ args: { agent_id: SLOW, prompt: 'long work', description: 'the patient one' },
145
+ },
146
+ {
147
+ name: 'create_task',
148
+ args: { agent_id: FAILING, prompt: 'doomed work', description: 'the doomed one' },
149
+ },
150
+ ],
151
+ },
152
+ { text: 'done' },
153
+ ],
154
+ }),
155
+ agentIds: [SLOW, FAILING],
156
+ agentManager,
157
+ tools: new ToolRegistry(),
158
+ systemPrompt: 'You coordinate.',
159
+ model: 'mock-model',
160
+ tokenBudget: 100_000,
161
+ timeoutMs: 30_000,
162
+ maxIterations: 3,
163
+ sessionId: 'ses_policy',
164
+ threadId: 'thd_policy',
165
+ projectId: 'prj_policy',
166
+ tenantId: 'tnt_policy',
167
+ ...(policy ? { siblingFailurePolicy: policy } : {}),
168
+ });
169
+ return agentManager;
170
+ }
171
+ describe('a supervisor can say what a failed child means for its siblings', () => {
172
+ it('reaches the gateway, so cancel-siblings actually stops the rest', async () => {
173
+ const manager = await fanOut('cancel-siblings');
174
+ expect(manager.cancelled).toContain('task_patient');
175
+ }, 60_000);
176
+ });
177
+ //# sourceMappingURL=a-policy-nobody-can-select.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a-policy-nobody-can-select.test.js","sourceRoot":"","sources":["../../../src/agents/__tests__/a-policy-nobody-can-select.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAWtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD;;;;;;;;;;;;;;;GAeG;AAEH,YAAY,EAAE,CAAA;AAEd,MAAM,OAAO,GAAG,QAAiB,CAAA;AACjC,MAAM,IAAI,GAAG,SAAkB,CAAA;AAE/B;;;GAGG;AACH,MAAM,aAAa;IACT,SAAS,GAAa,EAAE,CAAA;IAChB,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAA;IAC7C,WAAW,CAAa;IACf,WAAW,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAC5D,IAAI,CAAC,WAAW,GAAG,OAAO,CAAA;IAC3B,CAAC,CAAC,CAAA;IACM,YAAY,CAAa;IACjC;;;;;;;;;;OAUG;IACc,YAAY,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAC7D,IAAI,CAAC,YAAY,GAAG,OAAO,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,WAAW,CAAC,OAA2B;QAC5C,MAAM,OA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C,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,cAAwB,CAAC,CAAA;IAC9D,CAAC,EAAE,MAAM,CAAC,CAAA;AACX,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=a-knob-nobody-can-turn.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a-knob-nobody-can-turn.test.d.ts","sourceRoot":"","sources":["../../../src/gateway/__tests__/a-knob-nobody-can-turn.test.ts"],"names":[],"mappings":""}