@namzu/sdk 5.2.0 → 6.1.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.
- package/CHANGELOG.md +237 -0
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +13 -0
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/gateway/__tests__/completion-inbox.test.d.ts +2 -0
- package/dist/gateway/__tests__/completion-inbox.test.d.ts.map +1 -0
- package/dist/gateway/__tests__/completion-inbox.test.js +258 -0
- package/dist/gateway/__tests__/completion-inbox.test.js.map +1 -0
- package/dist/gateway/completion-inbox.d.ts +113 -0
- package/dist/gateway/completion-inbox.d.ts.map +1 -0
- package/dist/gateway/completion-inbox.js +211 -0
- package/dist/gateway/completion-inbox.js.map +1 -0
- package/dist/provider/__tests__/strict-schema.test.js +50 -2
- package/dist/provider/__tests__/strict-schema.test.js.map +1 -1
- package/dist/provider/__tests__/vendor-detail.test.d.ts +2 -0
- package/dist/provider/__tests__/vendor-detail.test.d.ts.map +1 -0
- package/dist/provider/__tests__/vendor-detail.test.js +89 -0
- package/dist/provider/__tests__/vendor-detail.test.js.map +1 -0
- package/dist/provider/errors.d.ts +38 -5
- package/dist/provider/errors.d.ts.map +1 -1
- package/dist/provider/errors.js +107 -5
- package/dist/provider/errors.js.map +1 -1
- package/dist/provider/strict-schema.d.ts.map +1 -1
- package/dist/provider/strict-schema.js +64 -8
- package/dist/provider/strict-schema.js.map +1 -1
- package/dist/public-runtime.d.ts +4 -0
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +10 -0
- package/dist/public-runtime.js.map +1 -1
- package/dist/registry/tool/__tests__/dialect.test.d.ts +2 -0
- package/dist/registry/tool/__tests__/dialect.test.d.ts.map +1 -0
- package/dist/registry/tool/__tests__/dialect.test.js +146 -0
- package/dist/registry/tool/__tests__/dialect.test.js.map +1 -0
- package/dist/registry/tool/dialect.d.ts +50 -0
- package/dist/registry/tool/dialect.d.ts.map +1 -0
- package/dist/registry/tool/dialect.js +138 -0
- package/dist/registry/tool/dialect.js.map +1 -0
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +34 -0
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/registry/toolset/catalog.d.ts.map +1 -1
- package/dist/registry/toolset/catalog.js +10 -5
- package/dist/registry/toolset/catalog.js.map +1 -1
- package/dist/runtime/query/__tests__/completion-notification.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/completion-notification.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/completion-notification.test.js +168 -0
- package/dist/runtime/query/__tests__/completion-notification.test.js.map +1 -0
- package/dist/runtime/query/__tests__/step-allow-list.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/step-allow-list.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/step-allow-list.test.js +171 -0
- package/dist/runtime/query/__tests__/step-allow-list.test.js.map +1 -0
- package/dist/runtime/query/__tests__/stream-recovery.test.js +6 -0
- package/dist/runtime/query/__tests__/stream-recovery.test.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +14 -0
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +20 -1
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +9 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +1 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +74 -1
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +9 -0
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/runtime/query/result.js +6 -0
- package/dist/runtime/query/result.js.map +1 -1
- package/dist/tools/coordinator/__tests__/completion-delivery.test.d.ts +2 -0
- package/dist/tools/coordinator/__tests__/completion-delivery.test.d.ts.map +1 -0
- package/dist/tools/coordinator/__tests__/completion-delivery.test.js +255 -0
- package/dist/tools/coordinator/__tests__/completion-delivery.test.js.map +1 -0
- package/dist/tools/coordinator/__tests__/task-list.test.js +13 -7
- package/dist/tools/coordinator/__tests__/task-list.test.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts +35 -0
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +222 -16
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/types/provider/error.d.ts +20 -4
- package/dist/types/provider/error.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +13 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/SupervisorAgent.ts +14 -0
- package/src/gateway/__tests__/completion-inbox.test.ts +320 -0
- package/src/gateway/completion-inbox.ts +227 -0
- package/src/provider/__tests__/strict-schema.test.ts +58 -2
- package/src/provider/__tests__/vendor-detail.test.ts +107 -0
- package/src/provider/errors.ts +106 -5
- package/src/provider/strict-schema.ts +65 -8
- package/src/public-runtime.ts +11 -0
- package/src/registry/tool/__tests__/dialect.test.ts +200 -0
- package/src/registry/tool/dialect.ts +143 -0
- package/src/registry/tool/execute.ts +35 -0
- package/src/registry/toolset/catalog.ts +10 -5
- package/src/runtime/query/__tests__/completion-notification.test.ts +196 -0
- package/src/runtime/query/__tests__/step-allow-list.test.ts +205 -0
- package/src/runtime/query/__tests__/stream-recovery.test.ts +6 -0
- package/src/runtime/query/executor.ts +21 -1
- package/src/runtime/query/index.ts +11 -0
- package/src/runtime/query/iteration/index.ts +77 -1
- package/src/runtime/query/iteration/phases/context.ts +10 -0
- package/src/runtime/query/result.ts +6 -0
- package/src/tools/coordinator/__tests__/completion-delivery.test.ts +347 -0
- package/src/tools/coordinator/__tests__/task-list.test.ts +13 -7
- package/src/tools/coordinator/index.ts +250 -20
- package/src/types/provider/error.ts +20 -4
- package/src/types/tool/index.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,242 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ab0bb30: a worker that finishes now reaches the supervisor, without polling for it
|
|
8
|
+
|
|
9
|
+
A delegated worker's output reaches the supervisor as the `tool_result` of
|
|
10
|
+
the `create_task` that launched it. That works while the launching call is
|
|
11
|
+
still the live path — and there are two situations where it is not:
|
|
12
|
+
|
|
13
|
+
- the call hit the executor's deadline. The model was told _"timed out… it
|
|
14
|
+
may still be running"_, with no task id, and the worker then finished
|
|
15
|
+
normally holding a result nothing would ever read.
|
|
16
|
+
- there was never a call waiting, because the launch was meant to run
|
|
17
|
+
alongside the turn.
|
|
18
|
+
|
|
19
|
+
In both cases the completion existed, the gateway remembered it, and the
|
|
20
|
+
supervisor was never told. The one tool left to it, `agent_task_list`,
|
|
21
|
+
reported id, state and duration — and dropped the worker's output, reading
|
|
22
|
+
`result.status` and `result.lastError` off the handle while stepping over
|
|
23
|
+
`result.result` between them. So a supervisor could learn that a task had
|
|
24
|
+
definitely finished and still have no way to read what it said.
|
|
25
|
+
`agent_task_list` in a sleep loop was not the model misbehaving; it was the
|
|
26
|
+
only move on the board.
|
|
27
|
+
|
|
28
|
+
**Completions are now delivered rather than polled for.** A run subscribes
|
|
29
|
+
once through `onTaskCompleted` — which every `TaskGateway` already has, so
|
|
30
|
+
no gateway changes — and anything a tool did not hand over inline arrives in
|
|
31
|
+
the transcript as a task notification carrying the id, the agent, the state
|
|
32
|
+
and the output.
|
|
33
|
+
|
|
34
|
+
The distinction is the whole design. An earlier version of this channel was
|
|
35
|
+
removed because it fired for completions the blocking tool had _already_
|
|
36
|
+
delivered, so the supervisor saw each result twice. Tools now claim what they
|
|
37
|
+
deliver, and only unclaimed completions are announced. A blocking
|
|
38
|
+
`create_task` behaves exactly as it did.
|
|
39
|
+
|
|
40
|
+
Three additions come with it:
|
|
41
|
+
|
|
42
|
+
- `create_task` takes `background: true`, returning a `task_id` immediately
|
|
43
|
+
so the supervisor can keep working.
|
|
44
|
+
- `wait_for_task` joins a running task and returns its output. `continue_task`
|
|
45
|
+
blocked, but only as a side effect of sending a message, so a supervisor
|
|
46
|
+
that merely wanted to wait had to invent something to say.
|
|
47
|
+
- `cancel_task` is mounted again. It was dropped on the reasoning that a
|
|
48
|
+
blocking launch leaves every worker terminal before its id is known — true
|
|
49
|
+
then, and untrue now that a background launch hands back a live one.
|
|
50
|
+
|
|
51
|
+
`agent_task_list` also carries the worker's output, in the rendered text
|
|
52
|
+
rather than only in `data`: the executor builds the model-facing tool result
|
|
53
|
+
from `output` alone, so a field added to `data` would have been added
|
|
54
|
+
somewhere the model cannot see.
|
|
55
|
+
|
|
56
|
+
A run no longer settles while a background worker it launched is still
|
|
57
|
+
running — it would have discarded the very result the launch existed to
|
|
58
|
+
produce. The wait is bounded, so a worker that never finishes cannot hold a
|
|
59
|
+
run open.
|
|
60
|
+
|
|
61
|
+
`CompletionInbox` and `formatCompletionNotification` are exported for hosts
|
|
62
|
+
that build the coordinator surface themselves.
|
|
63
|
+
|
|
64
|
+
- 529d10f: a narrowed step now narrows what can RUN, not only what the model is shown
|
|
65
|
+
|
|
66
|
+
`prepareStep.activeTools` documents itself as _"restrict which tools the model
|
|
67
|
+
may call this step, by name"_, and run-level `allowedTools` makes the same
|
|
68
|
+
promise for a whole run. Neither restricted anything.
|
|
69
|
+
|
|
70
|
+
The list decided which schemas went into the request. It was then copied into
|
|
71
|
+
the tool context and read by nothing on the execution path — the registry gated
|
|
72
|
+
on availability and plan mode, and never on the allow-list. So the narrowing was
|
|
73
|
+
a statement about the menu rather than about the kitchen: a model that named a
|
|
74
|
+
withheld tool had it run.
|
|
75
|
+
|
|
76
|
+
That is not a hypothetical. A model names a tool it was not offered whenever it
|
|
77
|
+
repeats a call from earlier in the context, whenever a gateway carries its own
|
|
78
|
+
tool list, and whenever a cached prompt prefix is replayed. A host using this to
|
|
79
|
+
fence a step — the obvious use, and the one the type invites — was fenced by
|
|
80
|
+
nothing.
|
|
81
|
+
|
|
82
|
+
The check now sits where the call is made. A tool outside the list is answered
|
|
83
|
+
with a refusal that names what IS available, so the model can route around it
|
|
84
|
+
rather than guessing.
|
|
85
|
+
|
|
86
|
+
Two details worth stating:
|
|
87
|
+
|
|
88
|
+
- **Absent is not empty.** No list means no restriction; an empty list means the
|
|
89
|
+
step may call nothing. Reading an empty allow-list as "unrestricted" is the
|
|
90
|
+
fail-open this repository has already been bitten by once, in the delegate
|
|
91
|
+
roster.
|
|
92
|
+
- **A step's list beats the run's,** matching the precedence the request already
|
|
93
|
+
used, so the two can no longer disagree.
|
|
94
|
+
|
|
95
|
+
**If you pass `allowedTools` or `activeTools` today, calls that previously ran
|
|
96
|
+
may now be refused.** That is the point of the change, but it is a real
|
|
97
|
+
behavioural difference: a run that quietly depended on the leak will start
|
|
98
|
+
seeing refusals. The refusal is a normal `tool_result`, so the turn continues.
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- 529d10f: a delegated child is no longer strangled by a file-read deadline, and a closed tuple stays closed
|
|
103
|
+
|
|
104
|
+
**The deadline.** `create_task` runs an entire agent and inherited the tool
|
|
105
|
+
executor's generic two-minute default — the one whose own docstring says _"a
|
|
106
|
+
tool that legitimately runs longer declares its own `timeoutMs`"_. It did not.
|
|
107
|
+
|
|
108
|
+
Measured on real traffic: three delegated children finished in 4m21s, 5m58s and
|
|
109
|
+
8m04s while all three parents timed out at 120s. The children were never killed
|
|
110
|
+
— only the parent's wait was — so the blocking path was not occasionally missed,
|
|
111
|
+
it was structurally unreachable, and the supervisor was left calling
|
|
112
|
+
`agent_task_list` in a sleep loop because nothing else was available to it.
|
|
113
|
+
|
|
114
|
+
`DELEGATION_TIMEOUT_MS` is now one hour, exported so it is greppable, and
|
|
115
|
+
applied to `create_task`, `wait_for_task` and `continue_task`. An hour rather
|
|
116
|
+
than "a bit more than eight minutes" because a generic stopwatch is the wrong
|
|
117
|
+
instrument for a child that is making progress: a failure should come from what
|
|
118
|
+
the child is doing. A wedged child is still caught, and the run budget and
|
|
119
|
+
iteration ceiling both still apply above this.
|
|
120
|
+
|
|
121
|
+
**The instruction to poll was ours.** `agent_task_list` described itself as the
|
|
122
|
+
way to _"confirm every launched task reached `completed`"_ and as _"safe to call
|
|
123
|
+
repeatedly"_ — an order to burn a turn on a listing whose answer a blocking
|
|
124
|
+
`create_task` had already delivered. It now says the opposite, and points at the
|
|
125
|
+
cases the listing is actually for. `create_task` gained the matching clause in
|
|
126
|
+
the other direction: until a worker's result arrives, do not fabricate,
|
|
127
|
+
summarise or predict it.
|
|
128
|
+
|
|
129
|
+
**The tuple.** `toSchemaDialect` translated draft-07's `additionalItems: false`
|
|
130
|
+
by dropping it, on the reasoning that 2020-12 closes a tuple by default. It does
|
|
131
|
+
not — with `prefixItems` set and no `items`, elements past the tuple are
|
|
132
|
+
unconstrained — so every closed tuple was silently widened into an open one. A
|
|
133
|
+
schema written to forbid a third element began to allow any number. It now
|
|
134
|
+
emits `items: false`, which the wire accepts.
|
|
135
|
+
|
|
136
|
+
## 6.0.0
|
|
137
|
+
|
|
138
|
+
### Major Changes
|
|
139
|
+
|
|
140
|
+
- f8355de: a failed request now carries the provider's own account of why, scrubbed
|
|
141
|
+
|
|
142
|
+
`ProviderRequestError` has always declared a `detail` field. The constructor
|
|
143
|
+
never read it, so it existed and carried nothing, and the response body was
|
|
144
|
+
parsed to classify the failure and then dropped.
|
|
145
|
+
|
|
146
|
+
That was deliberate and it was an over-correction. An error body can echo a
|
|
147
|
+
request and a request can carry a credential — but a provider rejecting a
|
|
148
|
+
request also names the exact offending field, and deleting that sentence turns
|
|
149
|
+
a one-line diagnosis into hypothesis elimination against a live API. It did:
|
|
150
|
+
the wire spent a day of production downtime repeating
|
|
151
|
+
`tools.0.custom.input_schema: … must match JSON Schema draft 2020-12` while the
|
|
152
|
+
SDK removed the sentence before anyone could read it.
|
|
153
|
+
|
|
154
|
+
Scrubbing what is credential-shaped and keeping the rest is the trade that was
|
|
155
|
+
actually available. `detail` now carries the provider's message, truncated to
|
|
156
|
+
400 characters, with API-key prefixes, bearer headers, cloud access-key ids and
|
|
157
|
+
credential-named JSON fields replaced by `[redacted]`. The same text reaches
|
|
158
|
+
`message`, so a log line that prints only the message is enough to act on.
|
|
159
|
+
|
|
160
|
+
It reaches the run too. `ProviderErrorInfo` — the metadata on failed runs and
|
|
161
|
+
`run_failed` events — had no `detail` field, so the sentence stopped at the
|
|
162
|
+
error object and a host rendering `run.lastProviderError` still had to parse
|
|
163
|
+
`error` to learn which parameter was rejected. That is the re-parsing the
|
|
164
|
+
structured field exists to avoid, so `detail` is on it now:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
if (run.lastProviderError?.kind === "bad_request") {
|
|
168
|
+
console.error(run.lastProviderError.detail);
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Breaking.** The previous contract — "the response body is never interpolated
|
|
173
|
+
into the error message" — was documented, and code may depend on it. Two tests
|
|
174
|
+
in this repository did. If you log `ProviderRequestError.message` somewhere the
|
|
175
|
+
provider's own words must not appear, read `error.kind`, `error.status` and
|
|
176
|
+
`error.providerId` instead and build the string yourself; those are unchanged.
|
|
177
|
+
|
|
178
|
+
What has NOT changed is the `cause` chain: the raw body is still never attached
|
|
179
|
+
as `cause`. A `cause` survives every logger that serializes an error chain,
|
|
180
|
+
which is the channel that would leak the body regardless of what the message
|
|
181
|
+
says.
|
|
182
|
+
|
|
183
|
+
The strict-subset check learned the same lesson in the same release. Its
|
|
184
|
+
deny-list was derived from prose and was wrong in both directions — it refused
|
|
185
|
+
`minLength`/`maxLength`, which the wire accepts, so it would have blocked
|
|
186
|
+
working tools; and it permitted tuples, which the wire rejects, so it vouched
|
|
187
|
+
for a broken one. It is now measured against the live API, and the measurement
|
|
188
|
+
runs as a contract test rather than living in a comment. `minItems` in
|
|
189
|
+
particular is a bound on the _value_, not a rejected keyword: 0 and 1 pass and
|
|
190
|
+
anything above does not, so a required non-empty array is expressible again.
|
|
191
|
+
|
|
192
|
+
### Minor Changes
|
|
193
|
+
|
|
194
|
+
- f8355de: tool schemas are rendered in the dialect each wire actually parses
|
|
195
|
+
|
|
196
|
+
A tool with a tuple-shaped field took down every request that offered it. The
|
|
197
|
+
kernel renders one canonical JSON Schema in draft-07, where a tuple is
|
|
198
|
+
`items: [a, b]`; one of the wires namzu speaks validates tool input as JSON
|
|
199
|
+
Schema 2020-12, where that spelling is invalid and a tuple must be
|
|
200
|
+
`prefixItems`. Every driver forwarded the rendering verbatim, so the built-in
|
|
201
|
+
`read` tool — whose `readRange` is a Zod tuple — produced a 400 that rejected
|
|
202
|
+
the **whole** request, taking every other tool in the call down with it. The
|
|
203
|
+
turn died before generating a token.
|
|
204
|
+
|
|
205
|
+
The failure had nothing to do with strict tool use, which is why the guard
|
|
206
|
+
added for the previous schema outage never saw it: it fires with strict
|
|
207
|
+
validation unset, and with strict on the dialect error arrives _first_.
|
|
208
|
+
|
|
209
|
+
Which dialect a wire parses is a property of the wire, so the conversion now
|
|
210
|
+
happens at each driver's boundary rather than in the renderer:
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
import { toSchemaDialect, findDraft07Only } from "@namzu/sdk";
|
|
214
|
+
|
|
215
|
+
toSchemaDialect(schema, "2020-12"); // items: [a, b] -> prefixItems: [a, b]
|
|
216
|
+
findDraft07Only(schema); // paths that no 2020-12 parser will accept
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
`renderToolSchema` is exported now too, so a caller assembling its own tool
|
|
220
|
+
payload gets the same memoized, `$schema`-stripped, deep-frozen rendering the
|
|
221
|
+
kernel puts on the wire — byte-identical across iterations, which matters
|
|
222
|
+
because the tools block sits at position 0 of the prompt-cache prefix.
|
|
223
|
+
|
|
224
|
+
`ToolCatalog` used to convert schemas through its own inline call with the same
|
|
225
|
+
options. Same output, none of the guarantees: no `$schema` stripping, no
|
|
226
|
+
memoization, no freeze. It goes through `renderToolSchema` now.
|
|
227
|
+
|
|
228
|
+
**Breaking, for the three drivers.** Their `@namzu/sdk` peer range was
|
|
229
|
+
`>=1.3.0` and is now `>=6.0.0`. That range was already wrong — the drivers call
|
|
230
|
+
kernel functions added well after 1.3.0 — and it would now let a package
|
|
231
|
+
manager install a combination that throws on every request carrying a tool.
|
|
232
|
+
Upgrade the kernel alongside the driver.
|
|
233
|
+
|
|
234
|
+
The conversion follows the model on multi-vendor wires. Bedrock's Converse API
|
|
235
|
+
carries several vendors through one request shape, and the 2020-12 requirement
|
|
236
|
+
was measured on one of them, so schemas bound for the others are left in the
|
|
237
|
+
dialect they were rendered in. Guessing there would trade a known break for an
|
|
238
|
+
unmeasured one.
|
|
239
|
+
|
|
3
240
|
## 5.2.0
|
|
4
241
|
|
|
5
242
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupervisorAgent.d.ts","sourceRoot":"","sources":["../../src/agents/SupervisorAgent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SupervisorAgent.d.ts","sourceRoot":"","sources":["../../src/agents/SupervisorAgent.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,KAAK,EACX,UAAU,EACV,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAW,KAAK,EAAU,MAAM,uBAAuB,CAAA;AAEnE,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;CA+P1B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EMPTY_TOKEN_USAGE } from '../constants/limits.js';
|
|
2
|
+
import { CompletionInbox } from '../gateway/completion-inbox.js';
|
|
2
3
|
import { LocalTaskGateway } from '../gateway/local.js';
|
|
3
4
|
import { ToolNameCollisionError, ToolRegistry } from '../registry/tool/execute.js';
|
|
4
5
|
import { drainQuery } from '../runtime/query/index.js';
|
|
@@ -132,8 +133,19 @@ export class SupervisorAgent extends AbstractAgent {
|
|
|
132
133
|
// it does not exist yet. `query` binds them once it does.
|
|
133
134
|
const questionParks = new QuestionParkBinding();
|
|
134
135
|
const pendingAnswers = new PendingAnswers();
|
|
136
|
+
// Created here for the same reason: both ends are here. The tools claim
|
|
137
|
+
// a completion when they deliver it as a `tool_result`, and the loop
|
|
138
|
+
// drains whatever is left over into the transcript — so the inbox has
|
|
139
|
+
// to be the same object on both sides, and this is the only place that
|
|
140
|
+
// sees both.
|
|
141
|
+
//
|
|
142
|
+
// It attaches through `onTaskCompleted`, which every gateway already
|
|
143
|
+
// implements, so a host gateway needs no change to take part.
|
|
144
|
+
const completionInbox = new CompletionInbox();
|
|
145
|
+
completionInbox.attach(gateway);
|
|
135
146
|
const coordinatorToolDefs = buildCoordinatorTools({
|
|
136
147
|
gateway,
|
|
148
|
+
completionInbox,
|
|
137
149
|
workingDirectory: input.workingDirectory,
|
|
138
150
|
runtimeContext: input.runtimeContext,
|
|
139
151
|
allowedAgentIds: config.agentIds,
|
|
@@ -245,6 +257,7 @@ export class SupervisorAgent extends AbstractAgent {
|
|
|
245
257
|
runtimeToolOverrides: input.runtimeToolOverrides,
|
|
246
258
|
runtimeContext: input.runtimeContext,
|
|
247
259
|
taskGateway: gateway,
|
|
260
|
+
completionInbox,
|
|
248
261
|
launchedTasks,
|
|
249
262
|
advisory: config.advisory,
|
|
250
263
|
invocationState: childInvocationState,
|
|
@@ -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,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,EAAE,MAAM,+BAA+B,CAAA;AAWrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAG/D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,qBAAqB,CACpC,WAAkC,EAClC,KAAY,EACZ,MAAc,IAAI,CAAC,GAAG,EAAE;IAExB,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,MAA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AC,WAAW,CAAC,CAAC,CAAC,QAAQ;YAC3D,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,KAAK,EAAE,GAAG,CAAC,UAAU;YACrB,IAAI,EAAE,GAAG,CAAC,QAAQ;YAClB,UAAU,EAAE,GAAG,CAAC,gBAAgB;YAChC,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;YAClC,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,WAAW;YACX,cAAc;YACd,UAAU,EAAE,WAAW,CAAC,MAAM;SAC9B,CAAA;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion-inbox.test.d.ts","sourceRoot":"","sources":["../../../src/gateway/__tests__/completion-inbox.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { CompletionInbox, formatCompletionNotification } from '../completion-inbox.js';
|
|
3
|
+
/**
|
|
4
|
+
* Who tells the supervisor a worker finished.
|
|
5
|
+
*
|
|
6
|
+
* Normally the `create_task` call does: it blocks, and the worker's output
|
|
7
|
+
* comes back as that call's `tool_result`. Two cases have no such call — a
|
|
8
|
+
* launch made in the background, and a blocking launch whose deadline passed
|
|
9
|
+
* while the worker kept going — and until this existed the result of those
|
|
10
|
+
* simply vanished. The gateway still held it; nothing ever read it.
|
|
11
|
+
*
|
|
12
|
+
* An earlier version of this channel was removed in `dc16d58` because it
|
|
13
|
+
* fired for completions the blocking tool had ALREADY delivered, so the
|
|
14
|
+
* supervisor saw every result twice: once as a `tool_result`, once as an
|
|
15
|
+
* orphan envelope. That removal is the reason the tests below care as much
|
|
16
|
+
* about what does NOT get delivered as about what does.
|
|
17
|
+
*/
|
|
18
|
+
function handleFor(taskId, result) {
|
|
19
|
+
return {
|
|
20
|
+
taskId: taskId,
|
|
21
|
+
agentId: 'reviewer',
|
|
22
|
+
state: 'completed',
|
|
23
|
+
createdAt: 1_000,
|
|
24
|
+
completedAt: 3_500,
|
|
25
|
+
...(result !== undefined
|
|
26
|
+
? { result: { status: 'completed', result } }
|
|
27
|
+
: {}),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** A gateway that only does the one thing the inbox uses. */
|
|
31
|
+
function fakeGateway() {
|
|
32
|
+
const listeners = new Set();
|
|
33
|
+
const gateway = {
|
|
34
|
+
onTaskCompleted(cb) {
|
|
35
|
+
listeners.add(cb);
|
|
36
|
+
return () => listeners.delete(cb);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
gateway,
|
|
41
|
+
settle: (h) => {
|
|
42
|
+
for (const cb of listeners)
|
|
43
|
+
cb(h);
|
|
44
|
+
},
|
|
45
|
+
get listeners() {
|
|
46
|
+
return listeners.size;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
describe('a completion nobody waited for reaches the transcript', () => {
|
|
51
|
+
it('queues a settled task and hands it over once', () => {
|
|
52
|
+
const { gateway, settle } = fakeGateway();
|
|
53
|
+
const inbox = new CompletionInbox();
|
|
54
|
+
inbox.attach(gateway);
|
|
55
|
+
settle(handleFor('tsk_1', 'the report'));
|
|
56
|
+
expect(inbox.hasUnheard).toBe(true);
|
|
57
|
+
expect(inbox.drain().map((h) => h.taskId)).toEqual(['tsk_1']);
|
|
58
|
+
// Drained, not peeked: a notification that survives its own delivery
|
|
59
|
+
// is the duplicate bug wearing a different hat.
|
|
60
|
+
expect(inbox.drain()).toEqual([]);
|
|
61
|
+
expect(inbox.hasUnheard).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
it('queues nothing at all when no task settles', () => {
|
|
64
|
+
const { gateway } = fakeGateway();
|
|
65
|
+
const inbox = new CompletionInbox();
|
|
66
|
+
inbox.attach(gateway);
|
|
67
|
+
expect(inbox.hasUnheard).toBe(false);
|
|
68
|
+
expect(inbox.drain()).toEqual([]);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe('a completion the tool already delivered is never delivered twice', () => {
|
|
72
|
+
it('drops a claimed completion', () => {
|
|
73
|
+
// The `dc16d58` regression, pinned. `create_task` blocked, got the
|
|
74
|
+
// result, and returned it as its own tool_result — so the envelope
|
|
75
|
+
// must not also carry it.
|
|
76
|
+
const { gateway, settle } = fakeGateway();
|
|
77
|
+
const inbox = new CompletionInbox();
|
|
78
|
+
inbox.attach(gateway);
|
|
79
|
+
settle(handleFor('tsk_1', 'the report'));
|
|
80
|
+
inbox.claim('tsk_1');
|
|
81
|
+
expect(inbox.hasUnheard).toBe(false);
|
|
82
|
+
expect(inbox.drain()).toEqual([]);
|
|
83
|
+
});
|
|
84
|
+
it('drops it even when the claim beats the announcement', () => {
|
|
85
|
+
// Ordering is not guaranteed: the tool's own `waitForTask` can resolve
|
|
86
|
+
// before the gateway's completion listener runs. A claim that only
|
|
87
|
+
// worked after the announcement would leak a duplicate exactly in the
|
|
88
|
+
// races that are hardest to reproduce.
|
|
89
|
+
const { gateway, settle } = fakeGateway();
|
|
90
|
+
const inbox = new CompletionInbox();
|
|
91
|
+
inbox.attach(gateway);
|
|
92
|
+
inbox.claim('tsk_1');
|
|
93
|
+
settle(handleFor('tsk_1', 'the report'));
|
|
94
|
+
expect(inbox.drain()).toEqual([]);
|
|
95
|
+
});
|
|
96
|
+
it('still delivers the sibling that nobody claimed', () => {
|
|
97
|
+
// The mixed turn: one worker awaited to completion, one abandoned.
|
|
98
|
+
const { gateway, settle } = fakeGateway();
|
|
99
|
+
const inbox = new CompletionInbox();
|
|
100
|
+
inbox.attach(gateway);
|
|
101
|
+
settle(handleFor('tsk_awaited', 'delivered inline'));
|
|
102
|
+
settle(handleFor('tsk_abandoned', 'nobody heard this'));
|
|
103
|
+
inbox.claim('tsk_awaited');
|
|
104
|
+
expect(inbox.drain().map((h) => h.taskId)).toEqual(['tsk_abandoned']);
|
|
105
|
+
});
|
|
106
|
+
it('subscribes once no matter how often it is attached', () => {
|
|
107
|
+
// Two subscriptions would queue every completion twice and reproduce
|
|
108
|
+
// the duplicate delivery from the inside.
|
|
109
|
+
const { gateway, settle, ...rest } = fakeGateway();
|
|
110
|
+
const inbox = new CompletionInbox();
|
|
111
|
+
inbox.attach(gateway);
|
|
112
|
+
inbox.attach(gateway);
|
|
113
|
+
settle(handleFor('tsk_1', 'once'));
|
|
114
|
+
expect(inbox.drain()).toHaveLength(1);
|
|
115
|
+
void rest;
|
|
116
|
+
});
|
|
117
|
+
it('stops listening when closed', () => {
|
|
118
|
+
const { gateway, settle } = fakeGateway();
|
|
119
|
+
const inbox = new CompletionInbox();
|
|
120
|
+
inbox.attach(gateway);
|
|
121
|
+
inbox.close();
|
|
122
|
+
settle(handleFor('tsk_1', 'too late'));
|
|
123
|
+
expect(inbox.drain()).toEqual([]);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe('a launch nobody is waiting for holds the run open', () => {
|
|
127
|
+
it('counts an expected task as pending work before it settles', () => {
|
|
128
|
+
// Without this the run settles while a background worker is still
|
|
129
|
+
// going and discards the result the launch existed to produce.
|
|
130
|
+
const { gateway } = fakeGateway();
|
|
131
|
+
const inbox = new CompletionInbox();
|
|
132
|
+
inbox.attach(gateway);
|
|
133
|
+
expect(inbox.hasPendingWork).toBe(false);
|
|
134
|
+
inbox.expect('tsk_1');
|
|
135
|
+
expect(inbox.hasPendingWork).toBe(true);
|
|
136
|
+
});
|
|
137
|
+
it('stops counting it once it settles', () => {
|
|
138
|
+
const { gateway, settle } = fakeGateway();
|
|
139
|
+
const inbox = new CompletionInbox();
|
|
140
|
+
inbox.attach(gateway);
|
|
141
|
+
inbox.expect('tsk_1');
|
|
142
|
+
settle(handleFor('tsk_1', 'done'));
|
|
143
|
+
// Still pending — as an UNHEARD completion now rather than an
|
|
144
|
+
// outstanding one, which is what the loop drains.
|
|
145
|
+
expect(inbox.hasPendingWork).toBe(true);
|
|
146
|
+
inbox.drain();
|
|
147
|
+
expect(inbox.hasPendingWork).toBe(false);
|
|
148
|
+
});
|
|
149
|
+
it('ignores a task already delivered inline', () => {
|
|
150
|
+
const { gateway } = fakeGateway();
|
|
151
|
+
const inbox = new CompletionInbox();
|
|
152
|
+
inbox.attach(gateway);
|
|
153
|
+
inbox.claim('tsk_1');
|
|
154
|
+
inbox.expect('tsk_1');
|
|
155
|
+
expect(inbox.hasPendingWork).toBe(false);
|
|
156
|
+
});
|
|
157
|
+
it('stops expecting a task that was cancelled', () => {
|
|
158
|
+
// `expect` is only cleared by a COMPLETION, so a cancelled worker used
|
|
159
|
+
// to keep the run open for the whole grace period, every time it tried
|
|
160
|
+
// to settle, waiting for a result that had been called off.
|
|
161
|
+
const { gateway } = fakeGateway();
|
|
162
|
+
const inbox = new CompletionInbox();
|
|
163
|
+
inbox.attach(gateway);
|
|
164
|
+
inbox.expect('tsk_1');
|
|
165
|
+
inbox.forget('tsk_1');
|
|
166
|
+
expect(inbox.hasPendingWork).toBe(false);
|
|
167
|
+
});
|
|
168
|
+
it('waits for an arrival and returns as soon as one lands', async () => {
|
|
169
|
+
const { gateway, settle } = fakeGateway();
|
|
170
|
+
const inbox = new CompletionInbox();
|
|
171
|
+
inbox.attach(gateway);
|
|
172
|
+
inbox.expect('tsk_1');
|
|
173
|
+
const waited = inbox.waitForArrival(5_000);
|
|
174
|
+
settle(handleFor('tsk_1', 'done'));
|
|
175
|
+
await waited;
|
|
176
|
+
expect(inbox.drain().map((h) => h.taskId)).toEqual(['tsk_1']);
|
|
177
|
+
});
|
|
178
|
+
it('does not wait at all when there is nothing outstanding', async () => {
|
|
179
|
+
const { gateway } = fakeGateway();
|
|
180
|
+
const inbox = new CompletionInbox();
|
|
181
|
+
inbox.attach(gateway);
|
|
182
|
+
// A deadline this long would hang the suite if it were honoured.
|
|
183
|
+
await inbox.waitForArrival(600_000);
|
|
184
|
+
});
|
|
185
|
+
it('gives up at the deadline rather than holding a run forever', async () => {
|
|
186
|
+
// The bound is the point: a worker that never finishes must not keep
|
|
187
|
+
// the run open indefinitely.
|
|
188
|
+
const { gateway } = fakeGateway();
|
|
189
|
+
const inbox = new CompletionInbox();
|
|
190
|
+
inbox.attach(gateway);
|
|
191
|
+
inbox.expect('tsk_never');
|
|
192
|
+
await inbox.waitForArrival(10);
|
|
193
|
+
expect(inbox.hasPendingWork).toBe(true);
|
|
194
|
+
});
|
|
195
|
+
it('releases a waiter when the inbox closes', async () => {
|
|
196
|
+
const { gateway } = fakeGateway();
|
|
197
|
+
const inbox = new CompletionInbox();
|
|
198
|
+
inbox.attach(gateway);
|
|
199
|
+
inbox.expect('tsk_1');
|
|
200
|
+
const waited = inbox.waitForArrival(600_000);
|
|
201
|
+
inbox.close();
|
|
202
|
+
await waited;
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
describe('the notification says which task and what it produced', () => {
|
|
206
|
+
it('carries the id, the agent, the state and the output', () => {
|
|
207
|
+
// All four matter. Without the id the supervisor cannot say which of
|
|
208
|
+
// five workers this was; without the output it has to make the extra
|
|
209
|
+
// call this mechanism exists to remove.
|
|
210
|
+
const text = formatCompletionNotification([handleFor('tsk_42', 'the findings')]);
|
|
211
|
+
expect(text).toContain('task_id: tsk_42');
|
|
212
|
+
expect(text).toContain('agent: reviewer');
|
|
213
|
+
expect(text).toContain('state: completed');
|
|
214
|
+
expect(text).toContain('duration_ms: 2500');
|
|
215
|
+
expect(text).toContain('the findings');
|
|
216
|
+
});
|
|
217
|
+
it('names the tool that fetches the rest when it truncates', () => {
|
|
218
|
+
const text = formatCompletionNotification([handleFor('tsk_42', 'x'.repeat(10_000))]);
|
|
219
|
+
expect(text).toContain('truncated');
|
|
220
|
+
// The id is repeated in the truncation notice, so the follow-up call
|
|
221
|
+
// does not require scrolling back up through 4 kB of output.
|
|
222
|
+
expect(text).toContain('wait_for_task with task_id "tsk_42"');
|
|
223
|
+
expect(text.length).toBeLessThan(4_500);
|
|
224
|
+
});
|
|
225
|
+
it('says so rather than going blank when a task produced nothing', () => {
|
|
226
|
+
const text = formatCompletionNotification([handleFor('tsk_42')]);
|
|
227
|
+
expect(text).toContain('task_id: tsk_42');
|
|
228
|
+
expect(text).toContain('produced no output');
|
|
229
|
+
});
|
|
230
|
+
it('groups a batch into one message', () => {
|
|
231
|
+
const text = formatCompletionNotification([
|
|
232
|
+
handleFor('tsk_1', 'first'),
|
|
233
|
+
handleFor('tsk_2', 'second'),
|
|
234
|
+
]);
|
|
235
|
+
expect(text).toContain('2 tasks');
|
|
236
|
+
expect(text).toContain('tsk_1');
|
|
237
|
+
expect(text).toContain('tsk_2');
|
|
238
|
+
});
|
|
239
|
+
it('explains why it is arriving here and not as a tool result', () => {
|
|
240
|
+
// Otherwise the model has to guess whether it missed a call, and the
|
|
241
|
+
// guess it makes is to go looking — which is the polling loop again.
|
|
242
|
+
const text = formatCompletionNotification([handleFor('tsk_1', 'done')]);
|
|
243
|
+
expect(text).toContain('not waiting on it');
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
describe('the inbox does not require anything of a host gateway', () => {
|
|
247
|
+
it('uses only onTaskCompleted', () => {
|
|
248
|
+
// The whole point of attaching through the existing subscription: a
|
|
249
|
+
// host that implements TaskGateway keeps working untouched, and one
|
|
250
|
+
// that was already firing completions into an empty listener set now
|
|
251
|
+
// has a listener.
|
|
252
|
+
const onTaskCompleted = vi.fn(() => () => { });
|
|
253
|
+
const inbox = new CompletionInbox();
|
|
254
|
+
inbox.attach({ onTaskCompleted });
|
|
255
|
+
expect(onTaskCompleted).toHaveBeenCalledTimes(1);
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
//# sourceMappingURL=completion-inbox.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion-inbox.test.js","sourceRoot":"","sources":["../../../src/gateway/__tests__/completion-inbox.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAA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