agentfootprint 9.91.0 → 9.92.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +123 -0
- package/CLAUDE.md +1 -1
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/core/Agent.js +23 -7
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/buildAgentMessageApiChart.js +10 -0
- package/dist/core/agent/buildAgentMessageApiChart.js.map +1 -1
- package/dist/core/agent/buildToolRegistry.js +90 -33
- package/dist/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +176 -28
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/slots/buildToolsSlot.js +209 -62
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/core/Agent.js +24 -8
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/buildAgentMessageApiChart.js +10 -0
- package/dist/esm/core/agent/buildAgentMessageApiChart.js.map +1 -1
- package/dist/esm/core/agent/buildToolRegistry.d.ts +80 -31
- package/dist/esm/core/agent/buildToolRegistry.js +90 -33
- package/dist/esm/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +43 -5
- package/dist/esm/core/agent/stages/toolCalls.js +174 -27
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +15 -0
- package/dist/esm/core/slots/buildToolsSlot.d.ts +100 -0
- package/dist/esm/core/slots/buildToolsSlot.js +207 -61
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +92 -18
- package/dist/esm/events/registry.d.ts +5 -1
- package/dist/esm/events/registry.js +4 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/events/registry.js +4 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentMessageApiChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildToolRegistry.d.ts +80 -31
- package/dist/types/core/agent/buildToolRegistry.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +43 -5
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +15 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/slots/buildToolsSlot.d.ts +100 -0
- package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +92 -18
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +5 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildAgentMessageApiChart.js","sourceRoot":"","sources":["../../../src/core/agent/buildAgentMessageApiChart.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,6CAAwD;
|
|
1
|
+
{"version":3,"file":"buildAgentMessageApiChart.js","sourceRoot":"","sources":["../../../src/core/agent/buildAgentMessageApiChart.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,6CAAwD;AAExD,mDAAsD;AAEtD,iEAA6E;AAC7E,iEAA2D;AAC3D,yDAAgF;AAEhF,oEAA8D;AAC9D,gFAA0E;AAC1E,gFAA0E;AAC1E,wEAAkE;AAClE,kEAA4D;AAC5D,2DAA6E;AAE7E,wBAAwB;AACxB,MAAM,gBAAgB,GAAG,YAAY,CAAC;AACtC,MAAM,WAAW,GAAG,4BAAW,CAAC,KAAK,CAAC;AAsDtC;;GAEG;AACH,SAAgB,yBAAyB,CAAC,IAA8B;IACtE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACtD,MAAM,aAA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,UAAU,EAAE,UAAU;KACvB,CAAC;SACD,GAAG,EAAE;QACN,sEAAsE;QACtE,yDAAyD;SACxD,WAAW,CACV,YAAY,EACZ,eAAwB,EACxB,aAAa,EACb,iDAAiD,CAClD;SACA,WAAW,CACV,SAAS,EACT,OAAgB,EAChB,UAAU,EACV,+CAA+C,CAChD;QACD,yEAAyE;QACzE,mEAAmE;SAClE,GAAG,CAAC,GAAG,IAAA,iCAAgB,EAAC,0BAAS,CAAC,QAAQ,CAAC,CAAC;QAC7C,oEAAoE;SACnE,kBAAkB,CAAC,OAAO,EAAE,YAAqB,EAAE,4BAAW,CAAC,KAAK,EAAE,eAAe,EAAE;QACtF,IAAI,EAAE,IAAA,iCAAgB,EAAC,4BAAW,CAAC,KAAK,CAAC;KAC1C,CAAC;SACD,iBAAiB,CAAC,gBAAgB,EAAE,WAAW,EAAE,QAAiB,EAAE,oBAAoB,EAAE;QACzF,IAAI,EAAE,IAAA,iCAAgB,EAAC,gBAAgB,CAAC;KACzC,CAAC;QACF,yEAAyE;QACzE,4EAA4E;QAC5E,qEAAqE;SACpE,MAAM,CAAC,SAAS,CAAC;SACjB,iBAAiB,CAChB,WAAW,EACX,OAAO,EACP,UAAmB,EACnB,qCAAqC,CACtC;SACA,UAAU,CAAC,WAAW,CAAC;SACvB,GAAG,EAAE;SACL,KAAK,EAAE,CACX,CAAC;AACJ,CAAC;AA5PD,8DA4PC"}
|
|
@@ -62,16 +62,18 @@
|
|
|
62
62
|
* the autoActivate invariant above exists, and why the name-uniqueness throws
|
|
63
63
|
* below are throws: an identity that is not stable is one the model cannot
|
|
64
64
|
* address. Where a provider schema reaches the wire ahead of a skill tool of
|
|
65
|
-
* the same name, the identity half
|
|
65
|
+
* the same name, the identity half WAS the SHADOW SEAM illustrated below —
|
|
66
|
+
* closed in 9.92.0 by making dispatch follow the offer.
|
|
66
67
|
*
|
|
67
68
|
* `with stable identity` is kept rather than dropped, and the reason is the
|
|
68
69
|
* event. A law reading only "every offered name resolves to something" would
|
|
69
70
|
* be true everywhere and would leave `agentfootprint.tools.shadowed` reporting
|
|
70
71
|
* a deviation from nothing — the framework spends an event on that seam
|
|
71
72
|
* precisely because reading one contract and calling another implementation is
|
|
72
|
-
* a violation of an expectation worth naming.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
73
|
+
* a violation of an expectation worth naming. Since 9.92.0 the clause HOLDS
|
|
74
|
+
* for every name on the wire (dispatch follows the offer); the event now names
|
|
75
|
+
* the collision that would have broken it, and its companion
|
|
76
|
+
* `agentfootprint.tools.claim_swallowed` names the party the collision silenced.
|
|
75
77
|
*
|
|
76
78
|
* Clause two is the whole point of the narrowing dials — `autoActivate`,
|
|
77
79
|
* `skillGraph({ scopeTools })`, `.toolsFromActiveSkill()`, a parked map,
|
|
@@ -138,33 +140,44 @@
|
|
|
138
140
|
* `makeReachableSkills` filters the cursor out of its own successor set,
|
|
139
141
|
* and under `.tree()` the reachable set is `() => []` outright
|
|
140
142
|
* (skillGraph.ts) — a tree routes by predicate and has no cursor to move.
|
|
141
|
-
* • The SHADOW SEAM —
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
143
|
+
* • The SHADOW SEAM — the SAME-EPOCH divergence this file's two maps used
|
|
144
|
+
* to produce, CLOSED in 9.92.0 and kept here because a reader meeting
|
|
145
|
+
* the maps has to know why dispatch no longer reads them first. A
|
|
146
|
+
* `ToolProvider` and a skill can declare the same tool name. The wire
|
|
147
|
+
* merge puts provider schemas ahead of skill injections
|
|
148
|
+
* first-occurrence-wins, so the model reads the PROVIDER's contract; until
|
|
149
|
+
* 9.92.0 `lookupTool` checked `registryByName` first, where every skill
|
|
150
|
+
* tool lives and no provider tool does, so the SKILL's `execute` ran —
|
|
151
|
+
* the contract offered and the implementation that answered were
|
|
152
|
+
* different tools, inside ONE epoch, and an INACTIVE skill could answer
|
|
153
|
+
* a call it was never offered. Now DISPATCH FOLLOWS THE OFFER: the tools
|
|
154
|
+
* slot records which party put each name on the wire (`ServedToolParties`,
|
|
155
|
+
* buildToolsSlot.ts) and `lookupTool` resolves a name on the wire to THAT
|
|
156
|
+
* party's implementation; `registryByName` is the fallback for a name
|
|
157
|
+
* that is not on this epoch's wire at all (the held-out, parked and
|
|
158
|
+
* restored-transcript cases the capability law keeps dispatchable) —
|
|
159
|
+
* reached only for the party the model LAST read the name under, or the
|
|
160
|
+
* name's only holder when it was never served, and put on the record by
|
|
161
|
+
* `agentfootprint.tools.answered_off_wire`; a name whose last-served
|
|
162
|
+
* party can no longer answer is refused (`toolCalls.ts` ·
|
|
163
|
+
* `notServedResult`), never handed to a party the model was not shown
|
|
164
|
+
* under that name. The
|
|
165
|
+
* collision itself is still REPORTED rather than refused, because nothing
|
|
166
|
+
* here can see it coming: the provider's list is resolved per iteration
|
|
167
|
+
* (`list(ctx)`), so there is no build-time moment at which the pair is
|
|
168
|
+
* knowable. The pair this file CAN see — a static `.tool()` against a
|
|
169
|
+
* skill tool — is refused upstream (`validators.ts` ·
|
|
170
|
+
* `validateToolNameUniqueness`), which is the better answer whenever the
|
|
171
|
+
* answer is available that early. `agentfootprint.tools.shadowed` names
|
|
172
|
+
* the wire's party (now the same party in both of its halves) every
|
|
173
|
+
* iteration two contracts compete, and `agentfootprint.tools.claim_swallowed`
|
|
174
|
+
* names every party whose claim is dead that iteration — the loser of a
|
|
175
|
+
* competition, and the claimant that never even reached the merge (a
|
|
176
|
+
* provider tool whose name a registry holder owns, a skill tool named
|
|
177
|
+
* after a framework auto-attach). `toolClaimants` below is what makes the
|
|
178
|
+
* second event possible: the list of who claimed a name, kept instead of
|
|
179
|
+
* collapsed to a winner. Pinned by `test/toolShadowing.test.ts`,
|
|
180
|
+
* `test/core/tools/offer-and-answer.test.ts` and epoch-laws 1(g).
|
|
168
181
|
*
|
|
169
182
|
* MCP does not add a seam of its OWN, and it is worth saying so because it
|
|
170
183
|
* looks like it does: `mcpServe` builds `listing` and `byName` ONCE at
|
|
@@ -205,6 +218,16 @@ function buildToolRegistry(registry, injections, options = {}) {
|
|
|
205
218
|
// a shared Tool reference is genuinely declared by both skills, and a reader
|
|
206
219
|
// asking "may this name be spoken?" needs both ids to answer.
|
|
207
220
|
const declaringSkills = new Map();
|
|
221
|
+
// The claims (9.92.0), in the order the doc on `toolClaimants` states.
|
|
222
|
+
const claims = new Map();
|
|
223
|
+
const claim = (name, c) => {
|
|
224
|
+
const held = claims.get(name);
|
|
225
|
+
if (held === undefined)
|
|
226
|
+
claims.set(name, [c]);
|
|
227
|
+
else
|
|
228
|
+
held.push(c);
|
|
229
|
+
};
|
|
230
|
+
const skillClaims = [];
|
|
208
231
|
for (const skill of skills) {
|
|
209
232
|
const meta = skill.metadata;
|
|
210
233
|
const isAutoActivate = meta?.autoActivate === 'currentSkill';
|
|
@@ -216,6 +239,10 @@ function buildToolRegistry(registry, injections, options = {}) {
|
|
|
216
239
|
declaringSkills.set(name, [skill.id]);
|
|
217
240
|
else if (!declared.includes(skill.id))
|
|
218
241
|
declared.push(skill.id);
|
|
242
|
+
skillClaims.push({
|
|
243
|
+
name,
|
|
244
|
+
claim: { channel: 'skill', id: skill.id, tool: tool },
|
|
245
|
+
});
|
|
219
246
|
// Check EVERY skill tool — including autoActivate ones, which `continue`
|
|
220
247
|
// below and never reach the static registry's gate. (This is the common
|
|
221
248
|
// case: all of Neo's skills are autoActivate, so their scoped tools would
|
|
@@ -303,6 +330,22 @@ function buildToolRegistry(registry, injections, options = {}) {
|
|
|
303
330
|
}
|
|
304
331
|
seenNames.add(entry.name);
|
|
305
332
|
}
|
|
333
|
+
// Claims, in `toolClaimants` order: the augmentedRegistry holders first
|
|
334
|
+
// (registry, read_skill, present — every always-visible skill tool is a
|
|
335
|
+
// skill claim and lands in the next loop, in declaration order, which is
|
|
336
|
+
// the order `skillToolEntries` was pushed in), then every skill claim.
|
|
337
|
+
for (const e of registry) {
|
|
338
|
+
claim(e.name, {
|
|
339
|
+
channel: 'registry',
|
|
340
|
+
...(e.tool.owner && { id: e.tool.owner.id }),
|
|
341
|
+
tool: e.tool,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
for (const e of [...readSkillEntries, ...presentEntries]) {
|
|
345
|
+
claim(e.name, { channel: 'framework', tool: e.tool });
|
|
346
|
+
}
|
|
347
|
+
for (const { name, claim: c } of skillClaims)
|
|
348
|
+
claim(name, c);
|
|
306
349
|
const registryByName = new Map(augmentedRegistry.map((e) => [e.name, e.tool]));
|
|
307
350
|
// autoActivate skill tools live outside augmentedRegistry but MUST
|
|
308
351
|
// be findable by name at dispatch time. Add them to the dispatch
|
|
@@ -332,10 +375,24 @@ function buildToolRegistry(registry, injections, options = {}) {
|
|
|
332
375
|
`name, and a same-named tool would silently take over the model's recorded skips. ` +
|
|
333
376
|
`Rename your tool.`);
|
|
334
377
|
}
|
|
335
|
-
|
|
378
|
+
const skipStep = (0, skillTools_js_1.buildSkipStepTool)();
|
|
379
|
+
registryByName.set(skillSteps_js_1.SKIP_STEP_TOOL_NAME, skipStep);
|
|
380
|
+
// The framework's own claim (9.92.0): a claimant like any other. It wins
|
|
381
|
+
// the wire only when no other party puts the name forward that epoch —
|
|
382
|
+
// the tools slot merges its schema LAST — and when a provider does, the
|
|
383
|
+
// provider's contract is what the model reads and the provider's tool is
|
|
384
|
+
// what answers; the procedure does not advance on a call whose contract
|
|
385
|
+
// the model read from somebody else (recorded-not-built, entry 3).
|
|
386
|
+
claim(skillSteps_js_1.SKIP_STEP_TOOL_NAME, { channel: 'framework', tool: skipStep });
|
|
336
387
|
}
|
|
337
388
|
const toolSchemas = augmentedRegistry.map((e) => e.tool.schema);
|
|
338
|
-
return {
|
|
389
|
+
return {
|
|
390
|
+
augmentedRegistry,
|
|
391
|
+
registryByName,
|
|
392
|
+
toolSchemas,
|
|
393
|
+
toolDeclaringSkills: declaringSkills,
|
|
394
|
+
toolClaimants: claims,
|
|
395
|
+
};
|
|
339
396
|
}
|
|
340
397
|
exports.buildToolRegistry = buildToolRegistry;
|
|
341
398
|
//# sourceMappingURL=buildToolRegistry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildToolRegistry.js","sourceRoot":"","sources":["../../../src/core/agent/buildToolRegistry.ts"],"names":[],"mappings":";AAAA,kFAAkF;AAClF,8FAA8F;AAC9F,+FAA+F;AAC/F,2CAA2C;AAC3C
|
|
1
|
+
{"version":3,"file":"buildToolRegistry.js","sourceRoot":"","sources":["../../../src/core/agent/buildToolRegistry.ts"],"names":[],"mappings":";AAAA,kFAAkF;AAClF,8FAA8F;AAC9F,+FAA+F;AAC/F,2CAA2C;AAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2LG;;;AAEH,4EAAiG;AACjG,4EAAwF;AAGxF,2DAA+D;AAC/D,qDAAoD;AACpD,0CAAuF;AAqFvF;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,QAAsC,EACtC,UAAgC,EAChC,UAAoC,EAAE;IAEtC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC;IAE9D,qEAAqE;IACrE,oEAAoE;IACpE,k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Aa,EAAE,MAAM;KACtB,CAAC;AACJ,CAAC;AA/MD,8CA+MC"}
|
|
@@ -12,10 +12,14 @@
|
|
|
12
12
|
* Treats that answer as the paused tool's result, appends to
|
|
13
13
|
* history, then continues the ReAct iteration loop.
|
|
14
14
|
*
|
|
15
|
-
* Dispatch resolution order:
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Dispatch resolution order (9.92.0 — DISPATCH FOLLOWS THE OFFER):
|
|
16
|
+
* 0. A name on THIS epoch's wire resolves to the party whose contract the
|
|
17
|
+
* model read (`servedTools`, written by the tools slot from the same
|
|
18
|
+
* merge that built the wire): a provider's schema → the provider's tool
|
|
19
|
+
* from `providerToolCache`; anything else → `registryByName`.
|
|
20
|
+
* 1. A name NOT on the wire this epoch — held out by a step, a park or a
|
|
21
|
+
* scoping, or named from a restored transcript — resolves as it always
|
|
22
|
+
* did: `registryByName` first, then the provider cache.
|
|
19
23
|
*
|
|
20
24
|
* Permission gate (when `permissionChecker` is configured) runs BEFORE
|
|
21
25
|
* `tool.execute`. Deny → tool not executed; result is a synthetic
|
|
@@ -44,7 +48,7 @@
|
|
|
44
48
|
* activates that Skill (lifetime: turn).
|
|
45
49
|
*/
|
|
46
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.buildToolCallsHandler = exports.composeReadSkillRefusal = exports.unknownToolResult = exports.atMountedCursor = void 0;
|
|
51
|
+
exports.buildToolCallsHandler = exports.composeReadSkillRefusal = exports.unknownToolResult = exports.notServedResult = exports.atMountedCursor = void 0;
|
|
48
52
|
const codeRunnerTool_js_1 = require("../../codeRunnerTool.js");
|
|
49
53
|
const footprintjs_1 = require("footprintjs");
|
|
50
54
|
const types_js_1 = require("../../../adapters/types.js");
|
|
@@ -220,6 +224,28 @@ exports.atMountedCursor = atMountedCursor;
|
|
|
220
224
|
* Exported for the producer registry, and used by BOTH dispatch doors so they
|
|
221
225
|
* cannot drift.
|
|
222
226
|
*/
|
|
227
|
+
/**
|
|
228
|
+
* What a call gets back when the party whose contract the model read under
|
|
229
|
+
* this name cannot answer it, and no other party may (9.92.0).
|
|
230
|
+
*
|
|
231
|
+
* Two doors reach here. A name that LEFT the wire — the model read a
|
|
232
|
+
* provider's contract on an earlier call and the provider withdrew the name —
|
|
233
|
+
* whose only remaining holder is a party the model was never shown under that
|
|
234
|
+
* name (a scoped skill that never activated): dispatching that holder would
|
|
235
|
+
* hand the model's belief to a stranger's function, which is the silent
|
|
236
|
+
* identity swap this release closed. And a resume in a fresh Agent instance
|
|
237
|
+
* of a provider-served call, where the served party is on the checkpoint but
|
|
238
|
+
* the provider's list has not been resolved on this instance.
|
|
239
|
+
*
|
|
240
|
+
* It names no roster on purpose: `unknownToolResult`'s roster is the DISPATCH
|
|
241
|
+
* map, and the map here holds exactly the implementation this sentence is
|
|
242
|
+
* refusing. Anchored past tense, one clause, like every persistent result.
|
|
243
|
+
*/
|
|
244
|
+
function notServedResult(toolName) {
|
|
245
|
+
return (`Tool '${toolName}' did not run on that call: the implementation whose contract was ` +
|
|
246
|
+
`offered under that name was not available to answer it.`);
|
|
247
|
+
}
|
|
248
|
+
exports.notServedResult = notServedResult;
|
|
223
249
|
function unknownToolResult(toolName, dispatchable) {
|
|
224
250
|
const head = `Unknown tool '${toolName}' on that call.`;
|
|
225
251
|
if (dispatchable.named.length > 0) {
|
|
@@ -428,7 +454,7 @@ function appendBatchResult(scope, entry) {
|
|
|
428
454
|
*/
|
|
429
455
|
const UNSCOPED_RUN = '#no-run-id';
|
|
430
456
|
function buildToolCallsHandler(deps) {
|
|
431
|
-
const { registryByName, externalToolProvider, providerToolCache, permissionChecker } = deps;
|
|
457
|
+
const { registryByName, externalToolProvider, providerToolCache, servedTools, toolClaimants, permissionChecker, } = deps;
|
|
432
458
|
const toolArgValidation = deps.toolArgValidation ?? 'enforce';
|
|
433
459
|
// 8.6.0 — default `'pause'`. Consent is work waiting on a person, and every
|
|
434
460
|
// other place this library needs a person stops the run and asks the caller.
|
|
@@ -1692,15 +1718,91 @@ function buildToolCallsHandler(deps) {
|
|
|
1692
1718
|
// one resolver. The Tools slot already invoked `provider.list(ctx)` this
|
|
1693
1719
|
// iteration and cached the resolved Tool[] in `providerToolCache` — read from
|
|
1694
1720
|
// there to avoid a second discovery call (vital for async network providers).
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1721
|
+
//
|
|
1722
|
+
// DISPATCH FOLLOWS THE OFFER (9.92.0). A name on this epoch's wire resolves
|
|
1723
|
+
// to the implementation of the party whose contract the model read — the
|
|
1724
|
+
// slot's own record of its merge (`servedTools`), never a re-derivation.
|
|
1725
|
+
// Before this, `registryByName` was consulted first for every name, so a
|
|
1726
|
+
// provider's contract on the wire could be answered by a skill's `execute`
|
|
1727
|
+
// (an INACTIVE skill's, even) and a provider's `skip_step` by the framework's
|
|
1728
|
+
// — recorded-not-built entries 1 and 3.
|
|
1729
|
+
//
|
|
1730
|
+
// A name NOT on the wire keeps the capability law's held-out clause — a
|
|
1731
|
+
// later step's tool, a parked map's tool, a scoped tool named from a
|
|
1732
|
+
// restored transcript still run — under ONE condition: the party that
|
|
1733
|
+
// answers is the party the model LAST READ the name under (`lastServed`), or
|
|
1734
|
+
// the name's only holder when it was never served this run. A name whose
|
|
1735
|
+
// last-served party can no longer answer (a provider withdrew it) is REFUSED
|
|
1736
|
+
// as a recorded tool result rather than handed to a party the model was
|
|
1737
|
+
// never shown under that name; a never-served name held by two parties is
|
|
1738
|
+
// refused the same way. Every off-wire dispatch that DOES happen is put on
|
|
1739
|
+
// the record by `tools.answered_off_wire`.
|
|
1740
|
+
const fromProviderCache = (toolName) => externalToolProvider
|
|
1741
|
+
? (providerToolCache?.current ?? []).find((t) => t.schema.name === toolName)
|
|
1742
|
+
: undefined;
|
|
1743
|
+
const providerParty = {
|
|
1744
|
+
channel: 'provider',
|
|
1745
|
+
...(externalToolProvider?.id !== undefined && { id: externalToolProvider.id }),
|
|
1746
|
+
};
|
|
1747
|
+
/** The party a registry-routed name belongs to — its first build-time claimant. */
|
|
1748
|
+
const registryPartyOf = (toolName) => {
|
|
1749
|
+
const first = toolClaimants?.get(toolName)?.[0];
|
|
1750
|
+
return first === undefined
|
|
1751
|
+
? { channel: 'registry' }
|
|
1752
|
+
: { channel: first.channel, ...(first.id !== undefined && { id: first.id }) };
|
|
1753
|
+
};
|
|
1754
|
+
const resolveTool = (toolName, pinned) => {
|
|
1755
|
+
const wireParty = pinned ?? servedTools?.current.get(toolName);
|
|
1756
|
+
if (wireParty !== undefined) {
|
|
1757
|
+
const owner = wireParty.channel === 'provider'
|
|
1758
|
+
? fromProviderCache(toolName)
|
|
1759
|
+
: registryByName.get(toolName);
|
|
1760
|
+
return owner !== undefined
|
|
1761
|
+
? { tool: owner, party: wireParty }
|
|
1762
|
+
: { refusal: notServedResult(toolName) };
|
|
1763
|
+
}
|
|
1764
|
+
const registryHolder = registryByName.get(toolName);
|
|
1765
|
+
const providerHolder = fromProviderCache(toolName);
|
|
1766
|
+
if (registryHolder === undefined && providerHolder === undefined)
|
|
1767
|
+
return {};
|
|
1768
|
+
const last = servedTools?.lastServed.get(toolName);
|
|
1769
|
+
if (last !== undefined) {
|
|
1770
|
+
const owner = last.channel === 'provider' ? providerHolder : registryHolder;
|
|
1771
|
+
return owner !== undefined
|
|
1772
|
+
? { tool: owner, party: last, offWire: true }
|
|
1773
|
+
: { refusal: notServedResult(toolName) };
|
|
1774
|
+
}
|
|
1775
|
+
if (registryHolder !== undefined && providerHolder !== undefined) {
|
|
1776
|
+
return { refusal: notServedResult(toolName) };
|
|
1777
|
+
}
|
|
1778
|
+
return registryHolder !== undefined
|
|
1779
|
+
? { tool: registryHolder, party: registryPartyOf(toolName), offWire: true }
|
|
1780
|
+
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1781
|
+
{ tool: providerHolder, party: providerParty, offWire: true };
|
|
1703
1782
|
};
|
|
1783
|
+
const lookupTool = (toolName, pinned) => resolveTool(toolName, pinned).tool;
|
|
1784
|
+
/** The record of an off-wire dispatch — once per such call, before it runs. */
|
|
1785
|
+
const noteOffWire = (scope, resolved, call) => {
|
|
1786
|
+
if (resolved.offWire !== true || resolved.party === undefined)
|
|
1787
|
+
return;
|
|
1788
|
+
(0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.tools.answered_off_wire', {
|
|
1789
|
+
toolName: call.toolName,
|
|
1790
|
+
toolCallId: call.toolCallId,
|
|
1791
|
+
iteration: call.iteration,
|
|
1792
|
+
answeredBy: resolved.party.channel,
|
|
1793
|
+
...(resolved.party.id !== undefined && { answeredById: resolved.party.id }),
|
|
1794
|
+
});
|
|
1795
|
+
};
|
|
1796
|
+
// The framework's own `skip_step` — `buildToolRegistry` installs it in the
|
|
1797
|
+
// dispatch map whenever a skill declares steps. The step bookkeeping below
|
|
1798
|
+
// keys on THIS instance having answered, not on the name: since 9.92.0 a
|
|
1799
|
+
// provider's `skip_step` on the wire is the provider's to answer, and a
|
|
1800
|
+
// procedure must not advance on a call whose contract the model read from
|
|
1801
|
+
// somebody else (recorded-not-built, entry 3).
|
|
1802
|
+
const frameworkSkipStep = deps.stepPlanFor ? registryByName.get(skillSteps_js_1.SKIP_STEP_TOOL_NAME) : undefined;
|
|
1803
|
+
const frameworkSkipStepAnswered = (name, answered) => frameworkSkipStep !== undefined &&
|
|
1804
|
+
name === skillSteps_js_1.SKIP_STEP_TOOL_NAME &&
|
|
1805
|
+
answered === frameworkSkipStep;
|
|
1704
1806
|
/**
|
|
1705
1807
|
* Every member id of every map the kernel currently holds PARKED (9.86.0
|
|
1706
1808
|
* fix pass) — asked of `parkedMemberIds`, the kernel's own owner of the fact.
|
|
@@ -1815,9 +1917,17 @@ function buildToolCallsHandler(deps) {
|
|
|
1815
1917
|
// runs now. Fail-closed: a blocked/failed credential surfaces to the model
|
|
1816
1918
|
// and the tool does NOT run. A tool that pauses again during an approved
|
|
1817
1919
|
// resume can't re-pause (resume returns void), so that is surfaced as an error.
|
|
1818
|
-
const resolveCredentialAndExecute = async (scope,
|
|
1819
|
-
|
|
1820
|
-
|
|
1920
|
+
const resolveCredentialAndExecute = async (scope, resolved, toolName, args, toolCallId, iteration, env) => {
|
|
1921
|
+
const tool = resolved.tool;
|
|
1922
|
+
// The two refusals share one door here too (9.92.0): a name nothing holds,
|
|
1923
|
+
// and a name whose offered party cannot answer on this resume.
|
|
1924
|
+
if (!tool) {
|
|
1925
|
+
return {
|
|
1926
|
+
result: resolved.refusal ?? unknownToolResult(toolName, dispatchRoster(scope)),
|
|
1927
|
+
error: true,
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1930
|
+
noteOffWire(scope, resolved, { toolName, toolCallId, iteration });
|
|
1821
1931
|
// Declared artifact arguments (9.22.0) — the same resolution the batch
|
|
1822
1932
|
// loop applies, at this door: a resumed call's refs are judged exactly
|
|
1823
1933
|
// as an inline call's, BEFORE credentials, and a refusal means the tool
|
|
@@ -2124,7 +2234,8 @@ function buildToolCallsHandler(deps) {
|
|
|
2124
2234
|
const runIdentity = scope.runIdentity;
|
|
2125
2235
|
const env = scope.$getEnv();
|
|
2126
2236
|
for (const tc of toolCalls) {
|
|
2127
|
-
const
|
|
2237
|
+
const resolved = resolveTool(tc.name);
|
|
2238
|
+
const tool = resolved.tool;
|
|
2128
2239
|
(0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.tool_start', {
|
|
2129
2240
|
toolName: tc.name,
|
|
2130
2241
|
toolCallId: tc.id,
|
|
@@ -2395,6 +2506,11 @@ function buildToolCallsHandler(deps) {
|
|
|
2395
2506
|
scope.pausedAskArgs = chain.args;
|
|
2396
2507
|
scope.pausedAskIndex = chain.index;
|
|
2397
2508
|
scope.pausedAskMiddleware = chain.middleware;
|
|
2509
|
+
// The party this call was resolved against (9.92.0) — so a resume
|
|
2510
|
+
// in a FRESH instance dispatches to the same party, never to the
|
|
2511
|
+
// build-time map's first holder. Pause-path-only.
|
|
2512
|
+
if (resolved.party !== undefined)
|
|
2513
|
+
scope.pausedToolParty = resolved.party;
|
|
2398
2514
|
// Which surface will collect the decision — carried so the
|
|
2399
2515
|
// resume-side ledger rows can say which component ANSWERED.
|
|
2400
2516
|
// Written only when one exists: a component-less ask's
|
|
@@ -2550,6 +2666,9 @@ function buildToolCallsHandler(deps) {
|
|
|
2550
2666
|
scope.pausedToolStartMs = startMs;
|
|
2551
2667
|
scope.pausedCheckIn = true;
|
|
2552
2668
|
scope.pausedCheckInArgs = callArgs;
|
|
2669
|
+
// Same carrier as the middleware-ask pause (9.92.0).
|
|
2670
|
+
if (resolved.party !== undefined)
|
|
2671
|
+
scope.pausedToolParty = resolved.party;
|
|
2553
2672
|
// Which surface will collect the decision — read back on resume
|
|
2554
2673
|
// so `checkin.decision` says which component ANSWERED. Written
|
|
2555
2674
|
// only when one exists (byte-identical otherwise).
|
|
@@ -2643,6 +2762,9 @@ function buildToolCallsHandler(deps) {
|
|
|
2643
2762
|
scope.pausedCredential = true;
|
|
2644
2763
|
scope.pausedCredentialArgs = callArgs;
|
|
2645
2764
|
scope.pausedCredentialService = need.credential;
|
|
2765
|
+
// Same carrier as the middleware-ask pause (9.92.0).
|
|
2766
|
+
if (resolved.party !== undefined)
|
|
2767
|
+
scope.pausedToolParty = resolved.party;
|
|
2646
2768
|
// A defined return value triggers the footprintjs pause; this
|
|
2647
2769
|
// object becomes the checkpoint's pauseData, and standingAgent's
|
|
2648
2770
|
// describePause hands it to the caller as `PendingAsk`.
|
|
@@ -2689,8 +2811,13 @@ function buildToolCallsHandler(deps) {
|
|
|
2689
2811
|
}
|
|
2690
2812
|
if (!credentialBlocked && !wantsBlocked) {
|
|
2691
2813
|
try {
|
|
2692
|
-
|
|
2693
|
-
|
|
2814
|
+
// The two refusals share one door: a name nothing holds, and a
|
|
2815
|
+
// name whose offered party cannot answer (9.92.0). Both land as
|
|
2816
|
+
// an errored tool result the model reads, on the same path.
|
|
2817
|
+
if (!tool) {
|
|
2818
|
+
throw new Error(resolved.refusal ?? unknownToolResult(tc.name, dispatchRoster(scope)));
|
|
2819
|
+
}
|
|
2820
|
+
noteOffWire(scope, resolved, { toolName: tc.name, toolCallId: tc.id, iteration });
|
|
2694
2821
|
// Set BEFORE the await: a tool that throws has still run, and a
|
|
2695
2822
|
// tool that does not exist has not. This flag is the entire
|
|
2696
2823
|
// precondition of the after-tool moment below.
|
|
@@ -3083,7 +3210,7 @@ function buildToolCallsHandler(deps) {
|
|
|
3083
3210
|
// Postures never gate it — skipping is judgment inside a step, not
|
|
3084
3211
|
// routing. Zero-cost gate: `stepPlanFor` is undefined on every agent
|
|
3085
3212
|
// without a stepped skill.
|
|
3086
|
-
if (
|
|
3213
|
+
if (frameworkSkipStepAnswered(tc.name, tool) && !error && !denied) {
|
|
3087
3214
|
result = applySkipStep(scope, { args: callArgs, toolCallId: tc.id, iteration });
|
|
3088
3215
|
}
|
|
3089
3216
|
// ── present bookkeeping (9.22.0) ───────────────────────────────
|
|
@@ -3459,7 +3586,12 @@ function buildToolCallsHandler(deps) {
|
|
|
3459
3586
|
// continue here must see the same `toolSource` the links before the
|
|
3460
3587
|
// ask saw. A chain that changed its mind about where a tool came from
|
|
3461
3588
|
// halfway through one dispatch would be worse than not knowing.
|
|
3462
|
-
|
|
3589
|
+
//
|
|
3590
|
+
// Resolved against the party the CHECKPOINT carries (9.92.0): a
|
|
3591
|
+
// fresh instance has an empty served record and Compose has not
|
|
3592
|
+
// re-run, so without it the build-time map's first holder answered.
|
|
3593
|
+
const resolved = resolveTool(toolName, scope.pausedToolParty);
|
|
3594
|
+
const tool = resolved.tool;
|
|
3463
3595
|
const rest = await (0, runChain_js_1.runToolChain)(deps.toolMiddleware ?? [], {
|
|
3464
3596
|
toolName,
|
|
3465
3597
|
...(tool?.source !== undefined && { toolSource: tool.source }),
|
|
@@ -3522,7 +3654,7 @@ function buildToolCallsHandler(deps) {
|
|
|
3522
3654
|
}
|
|
3523
3655
|
else {
|
|
3524
3656
|
const env = scope.$getEnv();
|
|
3525
|
-
const dispatched = await resolveCredentialAndExecute(scope,
|
|
3657
|
+
const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, rest.args, toolCallId, iteration, env);
|
|
3526
3658
|
result = dispatched.result;
|
|
3527
3659
|
error = dispatched.error;
|
|
3528
3660
|
// A ceiling-refused call RAN but must not advance a step (9.20.0);
|
|
@@ -3537,7 +3669,7 @@ function buildToolCallsHandler(deps) {
|
|
|
3537
3669
|
// placeholder just landed — replace it with the authoritative
|
|
3538
3670
|
// sentence BEFORE the chain's last word, the execute loop's
|
|
3539
3671
|
// composition kept.
|
|
3540
|
-
if (
|
|
3672
|
+
if (frameworkSkipStepAnswered(toolName, tool) && stepToolRan) {
|
|
3541
3673
|
result = applySkipStep(scope, { args: rest.args, toolCallId, iteration });
|
|
3542
3674
|
}
|
|
3543
3675
|
// present behind a middleware ask, approved (9.22.0): same
|
|
@@ -3641,6 +3773,11 @@ function buildToolCallsHandler(deps) {
|
|
|
3641
3773
|
// carried one must not gain the key (byte-identical).
|
|
3642
3774
|
if (answeredVia !== undefined)
|
|
3643
3775
|
scope.pausedComponentId = undefined;
|
|
3776
|
+
// The served party the checkpoint carried is consumed with it (9.92.0);
|
|
3777
|
+
// written back only when it was there, so an older checkpoint's resume
|
|
3778
|
+
// commits exactly what it always did.
|
|
3779
|
+
if (scope.pausedToolParty !== undefined)
|
|
3780
|
+
scope.pausedToolParty = undefined;
|
|
3644
3781
|
return;
|
|
3645
3782
|
}
|
|
3646
3783
|
// ── Check-in decision path ───────────────────────────────────────
|
|
@@ -3683,8 +3820,10 @@ function buildToolCallsHandler(deps) {
|
|
|
3683
3820
|
let resumeEnvelope;
|
|
3684
3821
|
if (decision.approved) {
|
|
3685
3822
|
const env = scope.$getEnv();
|
|
3686
|
-
|
|
3687
|
-
const
|
|
3823
|
+
// Resolved against the party the checkpoint carries (9.92.0).
|
|
3824
|
+
const resolved = resolveTool(toolName, scope.pausedToolParty);
|
|
3825
|
+
const tool = resolved.tool;
|
|
3826
|
+
const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, args, toolCallId, iteration, env);
|
|
3688
3827
|
result = dispatched.result;
|
|
3689
3828
|
error = dispatched.error;
|
|
3690
3829
|
// Same ceiling law as the ask path: ran ≠ completed a step (9.20.0).
|
|
@@ -3772,6 +3911,11 @@ function buildToolCallsHandler(deps) {
|
|
|
3772
3911
|
// Cleared ONLY when it was set — see the ask path's twin note.
|
|
3773
3912
|
if (answeredVia !== undefined)
|
|
3774
3913
|
scope.pausedComponentId = undefined;
|
|
3914
|
+
// The served party the checkpoint carried is consumed with it (9.92.0);
|
|
3915
|
+
// written back only when it was there, so an older checkpoint's resume
|
|
3916
|
+
// commits exactly what it always did.
|
|
3917
|
+
if (scope.pausedToolParty !== undefined)
|
|
3918
|
+
scope.pausedToolParty = undefined;
|
|
3775
3919
|
return;
|
|
3776
3920
|
}
|
|
3777
3921
|
// ── Credential-consent decision path (8.6.0) ─────────────────────
|
|
@@ -3791,8 +3935,10 @@ function buildToolCallsHandler(deps) {
|
|
|
3791
3935
|
const iteration = scope.iteration;
|
|
3792
3936
|
const args = (scope.pausedCredentialArgs ?? {});
|
|
3793
3937
|
const env = scope.$getEnv();
|
|
3794
|
-
|
|
3795
|
-
const
|
|
3938
|
+
// Resolved against the party the checkpoint carries (9.92.0).
|
|
3939
|
+
const resolved = resolveTool(toolName, scope.pausedToolParty);
|
|
3940
|
+
const tool = resolved.tool;
|
|
3941
|
+
const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, args, toolCallId, iteration, env);
|
|
3796
3942
|
const result = dispatched.result;
|
|
3797
3943
|
const error = dispatched.error;
|
|
3798
3944
|
let modelResult;
|
|
@@ -3871,6 +4017,8 @@ function buildToolCallsHandler(deps) {
|
|
|
3871
4017
|
scope.pausedCredential = false;
|
|
3872
4018
|
scope.pausedCredentialArgs = undefined;
|
|
3873
4019
|
scope.pausedCredentialService = undefined;
|
|
4020
|
+
if (scope.pausedToolParty !== undefined)
|
|
4021
|
+
scope.pausedToolParty = undefined;
|
|
3874
4022
|
return;
|
|
3875
4023
|
}
|
|
3876
4024
|
// ── The `pauseHere` / `askHuman` path ────────────────────────────
|