agentfootprint 9.69.0 → 9.71.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/CLAUDE.md +2 -0
- package/canonical-notes.json +16 -0
- package/dist/artifacts/placement.js +21 -7
- package/dist/artifacts/placement.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +7 -1
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/tools.js +102 -29
- package/dist/core/tools.js.map +1 -1
- package/dist/esm/artifacts/placement.d.ts +22 -7
- package/dist/esm/artifacts/placement.js +21 -7
- package/dist/esm/artifacts/placement.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +3 -2
- package/dist/esm/core/agent/stages/toolCalls.js +7 -1
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +3 -2
- package/dist/esm/core/tools.d.ts +80 -0
- package/dist/esm/core/tools.js +98 -28
- package/dist/esm/core/tools.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +6 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/types.d.ts +2 -1
- package/dist/esm/lib/injection-engine/types.js.map +1 -1
- package/dist/esm/lib/mcp/index.d.ts +1 -0
- package/dist/esm/lib/mcp/index.js +3 -0
- package/dist/esm/lib/mcp/index.js.map +1 -1
- package/dist/esm/lib/mcp/mcpClient.d.ts +6 -0
- package/dist/esm/lib/mcp/mcpClient.js +14 -0
- package/dist/esm/lib/mcp/mcpClient.js.map +1 -1
- package/dist/esm/lib/mcp/mcpServe.d.ts +8 -0
- package/dist/esm/lib/mcp/mcpServe.js +23 -5
- package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
- package/dist/esm/lib/mcp/mockMcpClient.d.ts +26 -0
- package/dist/esm/lib/mcp/mockMcpClient.js +5 -0
- package/dist/esm/lib/mcp/mockMcpClient.js.map +1 -1
- package/dist/esm/lib/mcp/toolExtras.d.ts +129 -0
- package/dist/esm/lib/mcp/toolExtras.js +198 -0
- package/dist/esm/lib/mcp/toolExtras.js.map +1 -0
- package/dist/esm/lib/mcp/types.d.ts +18 -5
- package/dist/esm/tool-providers/index.d.ts +2 -2
- package/dist/esm/tool-providers/index.js +5 -1
- package/dist/esm/tool-providers/index.js.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/injection-engine/types.js.map +1 -1
- package/dist/lib/mcp/index.js +5 -1
- package/dist/lib/mcp/index.js.map +1 -1
- package/dist/lib/mcp/mcpClient.js +14 -0
- package/dist/lib/mcp/mcpClient.js.map +1 -1
- package/dist/lib/mcp/mcpServe.js +23 -5
- package/dist/lib/mcp/mcpServe.js.map +1 -1
- package/dist/lib/mcp/mockMcpClient.js +5 -0
- package/dist/lib/mcp/mockMcpClient.js.map +1 -1
- package/dist/lib/mcp/toolExtras.js +204 -0
- package/dist/lib/mcp/toolExtras.js.map +1 -0
- package/dist/tool-providers/index.js +5 -1
- package/dist/tool-providers/index.js.map +1 -1
- package/dist/types/artifacts/placement.d.ts +22 -7
- package/dist/types/artifacts/placement.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +3 -2
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +3 -2
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/tools.d.ts +80 -0
- package/dist/types/core/tools.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/types.d.ts +2 -1
- package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
- package/dist/types/lib/mcp/index.d.ts +1 -0
- package/dist/types/lib/mcp/index.d.ts.map +1 -1
- package/dist/types/lib/mcp/mcpClient.d.ts +6 -0
- package/dist/types/lib/mcp/mcpClient.d.ts.map +1 -1
- package/dist/types/lib/mcp/mcpServe.d.ts +8 -0
- package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
- package/dist/types/lib/mcp/mockMcpClient.d.ts +26 -0
- package/dist/types/lib/mcp/mockMcpClient.d.ts.map +1 -1
- package/dist/types/lib/mcp/toolExtras.d.ts +130 -0
- package/dist/types/lib/mcp/toolExtras.d.ts.map +1 -0
- package/dist/types/lib/mcp/types.d.ts +18 -5
- package/dist/types/lib/mcp/types.d.ts.map +1 -1
- package/dist/types/tool-providers/index.d.ts +2 -2
- package/dist/types/tool-providers/index.d.ts.map +1 -1
- package/package.json +5 -3
package/dist/core/tools.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Emits: N/A (types only).
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.defineTool = exports.warnIfInvalidToolName = exports.assertValidToolName = exports.assertResultClass = exports.assertResultCeiling = void 0;
|
|
11
|
+
exports.defineTool = exports.warnIfInvalidToolName = exports.assertValidToolName = exports.assertArgumentsFrom = exports.assertToolOwner = exports.assertResultKind = exports.assertResultClass = exports.assertResultCeiling = void 0;
|
|
12
12
|
const footprintjs_1 = require("footprintjs");
|
|
13
13
|
const wants_js_1 = require("../artifacts/wants.js");
|
|
14
14
|
const types_js_1 = require("../lib/semantics/types.js");
|
|
@@ -22,7 +22,11 @@ const askComponent_js_1 = require("./askComponent.js");
|
|
|
22
22
|
function assertResultCeiling(toolName, ceiling) {
|
|
23
23
|
if (ceiling === undefined)
|
|
24
24
|
return;
|
|
25
|
-
|
|
25
|
+
// Destructured through a fallback because this rule is also asked about
|
|
26
|
+
// values NO COMPILER vetted — a `_meta` bag from a foreign MCP server
|
|
27
|
+
// (`readToolExtras`). A `null` or a number must reach the teaching refusal
|
|
28
|
+
// below, not blow up on the destructuring on the way to it.
|
|
29
|
+
const { maxChars, narrowBy } = (ceiling ?? {});
|
|
26
30
|
if (!Number.isFinite(maxChars) || !Number.isInteger(maxChars) || maxChars <= 0) {
|
|
27
31
|
throw new Error(`defineTool: tool '${toolName}' declares resultCeiling.maxChars = ${String(maxChars)}, ` +
|
|
28
32
|
`which is not a positive whole number of characters. The ceiling is the size over ` +
|
|
@@ -61,6 +65,96 @@ function assertResultClass(toolName, resultClass) {
|
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
exports.assertResultClass = assertResultClass;
|
|
68
|
+
/**
|
|
69
|
+
* Refuse a `resultKind` that could never be redeemed, at definition time —
|
|
70
|
+
* naming the tool and the fix (the `assertResultCeiling` / `assertResultClass`
|
|
71
|
+
* law: a declaration this library cannot honor fails HERE, never at the first
|
|
72
|
+
* oversized result of the first run). Exported beside them for consumers
|
|
73
|
+
* assembling `Tool` objects by hand.
|
|
74
|
+
*
|
|
75
|
+
* The one rule is non-blankness, and it is not a formality: the kind is what a
|
|
76
|
+
* `wants` argument is matched against by exact string equality, so a blank or
|
|
77
|
+
* whitespace-only kind mints a ticket no declaration can ever name — the same
|
|
78
|
+
* refusal `assertToolWants` raises on the consuming end, raised on the
|
|
79
|
+
* producing end too. There is deliberately NO charset or shape rule: the kind
|
|
80
|
+
* is the consumer's vocabulary, and the library does not own it.
|
|
81
|
+
*/
|
|
82
|
+
function assertResultKind(toolName, resultKind) {
|
|
83
|
+
if (resultKind === undefined)
|
|
84
|
+
return;
|
|
85
|
+
if (typeof resultKind !== 'string' || resultKind.trim().length === 0) {
|
|
86
|
+
throw new Error(`defineTool: tool '${toolName}' declares resultKind ${JSON.stringify(resultKind)}, which ` +
|
|
87
|
+
`is not a kind anything could want. It is the artifact kind a PLACED result is minted ` +
|
|
88
|
+
`under, matched by exact string equality against a consuming tool's ` +
|
|
89
|
+
`\`wants\` (e.g. 'dataset/rows'), so a blank kind is a ticket no argument can redeem. ` +
|
|
90
|
+
`Name the kind your consumers declare, or omit the field — omitting it mints ` +
|
|
91
|
+
`\`tool-result/${toolName}\`, exactly as before.`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.assertResultKind = assertResultKind;
|
|
95
|
+
/**
|
|
96
|
+
* Refuse an `owner` stamp with a blank half, at definition time — naming the
|
|
97
|
+
* tool and what a blank half would do.
|
|
98
|
+
*
|
|
99
|
+
* An identity edge with a blank half is worse than none: the Context Integrity
|
|
100
|
+
* checks JOIN on it, so a blank `kind` or `id` joins the wrong subjects rather
|
|
101
|
+
* than no subjects. Extracted from `defineTool` (9.71.0) so the MCP ingest
|
|
102
|
+
* boundary can hold the SAME line on a declaration that arrived over the wire —
|
|
103
|
+
* one rule, one message, two doors.
|
|
104
|
+
*
|
|
105
|
+
* Deliberately NOT a closed-set check on `kind`: the union is enforced by the
|
|
106
|
+
* compiler for anyone calling `defineTool`, and the value is only ever read
|
|
107
|
+
* into a prose reason (`owned by <kind> '<id>'`), never switched on.
|
|
108
|
+
*/
|
|
109
|
+
function assertToolOwner(toolName, owner) {
|
|
110
|
+
if (owner === undefined)
|
|
111
|
+
return;
|
|
112
|
+
// Same reason as `assertResultCeiling`: this is also asked about untyped
|
|
113
|
+
// values from a foreign MCP server, so a scalar or a `null` must land on the
|
|
114
|
+
// message rather than on a TypeError from the destructuring.
|
|
115
|
+
const { kind, id } = (owner ?? {});
|
|
116
|
+
if (typeof owner !== 'object' ||
|
|
117
|
+
typeof kind !== 'string' ||
|
|
118
|
+
kind.length === 0 ||
|
|
119
|
+
typeof id !== 'string' ||
|
|
120
|
+
id.length === 0) {
|
|
121
|
+
throw new Error(`defineTool('${toolName}'): \`owner\` must carry a non-empty kind and id — it is ` +
|
|
122
|
+
`the identity edge integrity checks join on, and a blank half joins the wrong ` +
|
|
123
|
+
`subjects. Got ${JSON.stringify(owner)}.`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.assertToolOwner = assertToolOwner;
|
|
127
|
+
/**
|
|
128
|
+
* Refuse an `argumentsFrom` edge that could never join, at definition time.
|
|
129
|
+
*
|
|
130
|
+
* The dangling-reference and unsupported-argument checks join on these names,
|
|
131
|
+
* so a blank one — or a tool grounded by itself — would join the wrong subjects
|
|
132
|
+
* or none at all. Extracted from `defineTool` (9.71.0) for the same reason as
|
|
133
|
+
* {@link assertToolOwner}: the MCP ingest boundary enforces the identical rule
|
|
134
|
+
* on a declaration a remote server sent.
|
|
135
|
+
*/
|
|
136
|
+
function assertArgumentsFrom(toolName, argumentsFrom) {
|
|
137
|
+
if (argumentsFrom === undefined)
|
|
138
|
+
return;
|
|
139
|
+
// The array check is part of the rule, not a formality: a foreign server can
|
|
140
|
+
// put a bare string here, and `for…of` over one would walk its CHARACTERS
|
|
141
|
+
// and refuse them one letter at a time.
|
|
142
|
+
if (!Array.isArray(argumentsFrom) || argumentsFrom.length === 0) {
|
|
143
|
+
throw new Error(`defineTool('${toolName}'): \`argumentsFrom\` must name at least one tool — ` +
|
|
144
|
+
`omitting the field is how "no grounds" is said.`);
|
|
145
|
+
}
|
|
146
|
+
for (const ground of argumentsFrom) {
|
|
147
|
+
if (typeof ground !== 'string' || ground.length === 0) {
|
|
148
|
+
throw new Error(`defineTool('${toolName}'): \`argumentsFrom\` entries must be non-empty tool ` +
|
|
149
|
+
`names. Got ${JSON.stringify(ground)}.`);
|
|
150
|
+
}
|
|
151
|
+
if (ground === toolName) {
|
|
152
|
+
throw new Error(`defineTool('${toolName}'): \`argumentsFrom\` names the tool itself — a tool ` +
|
|
153
|
+
`cannot be its own argument ground.`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.assertArgumentsFrom = assertArgumentsFrom;
|
|
64
158
|
/**
|
|
65
159
|
* Ergonomic builder for `Tool`. Equivalent to constructing an object
|
|
66
160
|
* literal with `schema` + `execute`, but flatter and safer — the name
|
|
@@ -138,6 +232,9 @@ function defineTool(options) {
|
|
|
138
232
|
// A class outside the closed set fails HERE too — not at the first
|
|
139
233
|
// `check:semantics` run of the first CI pipeline.
|
|
140
234
|
assertResultClass(options.name, options.resultClass);
|
|
235
|
+
// A placed-result kind nothing could want fails HERE too — not at the first
|
|
236
|
+
// oversized result of the first run with placement configured.
|
|
237
|
+
assertResultKind(options.name, options.resultKind);
|
|
141
238
|
// A decision component for a gate that never fires is configuration that
|
|
142
239
|
// lies — configured-and-inert looks exactly like configured-and-working
|
|
143
240
|
// (the `.checkIn({ scorer })`-with-minimal-evidence precedent). And a
|
|
@@ -159,36 +256,11 @@ function defineTool(options) {
|
|
|
159
256
|
(0, wants_js_1.assertToolWants)(options.name, options.wants, options.inputSchema ?? { type: 'object', properties: {} });
|
|
160
257
|
// An identity edge with a blank half is worse than none: a checker would
|
|
161
258
|
// join on it and compare the wrong subjects. Refused HERE, naming the tool.
|
|
162
|
-
|
|
163
|
-
const { kind, id } = options.owner;
|
|
164
|
-
if (typeof kind !== 'string' ||
|
|
165
|
-
kind.length === 0 ||
|
|
166
|
-
typeof id !== 'string' ||
|
|
167
|
-
id.length === 0) {
|
|
168
|
-
throw new Error(`defineTool('${options.name}'): \`owner\` must carry a non-empty kind and id — it is ` +
|
|
169
|
-
`the identity edge integrity checks join on, and a blank half joins the wrong ` +
|
|
170
|
-
`subjects. Got ${JSON.stringify(options.owner)}.`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
259
|
+
assertToolOwner(options.name, options.owner);
|
|
173
260
|
// The grounds edge is judged at the same door and for the same reason: the
|
|
174
261
|
// dangling-reference check joins on these names, and a blank one — or a
|
|
175
262
|
// tool grounded by itself — would join the wrong subjects or none.
|
|
176
|
-
|
|
177
|
-
if (options.argumentsFrom.length === 0) {
|
|
178
|
-
throw new Error(`defineTool('${options.name}'): \`argumentsFrom\` must name at least one tool — ` +
|
|
179
|
-
`omitting the field is how "no grounds" is said.`);
|
|
180
|
-
}
|
|
181
|
-
for (const ground of options.argumentsFrom) {
|
|
182
|
-
if (typeof ground !== 'string' || ground.length === 0) {
|
|
183
|
-
throw new Error(`defineTool('${options.name}'): \`argumentsFrom\` entries must be non-empty tool ` +
|
|
184
|
-
`names. Got ${JSON.stringify(ground)}.`);
|
|
185
|
-
}
|
|
186
|
-
if (ground === options.name) {
|
|
187
|
-
throw new Error(`defineTool('${options.name}'): \`argumentsFrom\` names the tool itself — a tool ` +
|
|
188
|
-
`cannot be its own argument ground.`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
263
|
+
assertArgumentsFrom(options.name, options.argumentsFrom);
|
|
192
264
|
return {
|
|
193
265
|
schema: {
|
|
194
266
|
name: options.name,
|
|
@@ -206,6 +278,7 @@ function defineTool(options) {
|
|
|
206
278
|
...(options.capabilities !== undefined && { capabilities: options.capabilities }),
|
|
207
279
|
...(options.resultCeiling !== undefined && { resultCeiling: options.resultCeiling }),
|
|
208
280
|
...(options.resultClass !== undefined && { resultClass: options.resultClass }),
|
|
281
|
+
...(options.resultKind !== undefined && { resultKind: options.resultKind }),
|
|
209
282
|
...(options.owner !== undefined && { owner: options.owner }),
|
|
210
283
|
...(options.argumentsFrom !== undefined && { argumentsFrom: options.argumentsFrom }),
|
|
211
284
|
...(options.repeatedWhen !== undefined && { repeatedWhen: options.repeatedWhen }),
|
package/dist/core/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/core/tools.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,6CAAwC;AAKxC,oDAAwE;AAGxE,wDAAiF;AACjF,uDAA0E;
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/core/tools.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,6CAAwC;AAKxC,oDAAwE;AAGxE,wDAAiF;AACjF,uDAA0E;AA6R1E;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,QAAgB,EAChB,OAAsC;IAEtC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO;IAClC,wEAAwE;IACxE,sEAAsE;IACtE,2EAA2E;IAC3E,4DAA4D;IAC5D,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAA+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,CAAC;QACjF,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,SAAS,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;QACpF,GAAG,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;QAC9E,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QAC3E,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QAC5D,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,SAAS,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;QACpF,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;QACjF,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC;AApED,gCAoEC"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* An OPTIONAL operator dial on the agent's artifacts wiring:
|
|
5
5
|
* `Agent.create({ artifacts: { store, placement: { maxInlineChars: N } } })`.
|
|
6
6
|
* A tool result whose finalized text exceeds the threshold is checked into
|
|
7
|
-
* the store (kind `tool-result/<toolName
|
|
7
|
+
* the store (kind `tool-result/<toolName>`, or the tool's declared
|
|
8
|
+
* `resultKind` — see `placedResultKind`) and the model receives the claim
|
|
8
9
|
* ticket instead — a SHORT substitute naming ref + meta + how to consume it.
|
|
9
10
|
* The whole 879,073-token failure class, retired by configuration.
|
|
10
11
|
*
|
|
@@ -55,11 +56,24 @@ export interface ArtifactPlacement {
|
|
|
55
56
|
* — never at the first oversized result of the first run.
|
|
56
57
|
*/
|
|
57
58
|
export declare function assertArtifactPlacement(site: string, placement: ArtifactPlacement | undefined): void;
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
59
|
+
/**
|
|
60
|
+
* The kind vocabulary a placement mint declares — THE one decision, and the
|
|
61
|
+
* only place it is made.
|
|
62
|
+
*
|
|
63
|
+
* Default: `tool-result/<toolName>`. Honest — it says exactly what the payload
|
|
64
|
+
* is and which tool produced it — and it is what a `wants` declaration or a
|
|
65
|
+
* `present` call names to consume the placed result.
|
|
66
|
+
*
|
|
67
|
+
* `declared` is the tool's own `Tool.resultKind` (9.70.0), and when a tool
|
|
68
|
+
* declares one it WINS. The reason is the exact-match law on the consuming
|
|
69
|
+
* end: `wants` matches kinds by exact string equality — no wildcards, no
|
|
70
|
+
* hierarchy — so the framework's default vocabulary is a ticket a
|
|
71
|
+
* `wants: { dataset: 'dataset/rows' }` argument must refuse. Rather than
|
|
72
|
+
* loosen the matcher (a ticket would stop being a promise) or make consumers
|
|
73
|
+
* re-mint at the seam (the framework declining to carry its own ref), the
|
|
74
|
+
* MINT speaks the author's vocabulary. Absent → today's bytes exactly.
|
|
75
|
+
*/
|
|
76
|
+
export declare function placedResultKind(toolName: string, declared?: string): string;
|
|
63
77
|
/**
|
|
64
78
|
* The substitute the model reads in place of the payload — ONE shape, always
|
|
65
79
|
* the object (the `TruncatedToolResult` law: a consumer branches on
|
|
@@ -70,7 +84,8 @@ export interface PlacedToolResult {
|
|
|
70
84
|
/** Always `true`. The field a consumer branches on. */
|
|
71
85
|
readonly placed: true;
|
|
72
86
|
readonly ref: string;
|
|
73
|
-
/**
|
|
87
|
+
/** The minted kind — what a consumer names to want it. The tool's declared
|
|
88
|
+
* `Tool.resultKind` when it has one, `tool-result/<toolName>` otherwise. */
|
|
74
89
|
readonly kind: string;
|
|
75
90
|
readonly mediaType: string;
|
|
76
91
|
/** The stored payload's true size — the chars the window did NOT pay. */
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* An OPTIONAL operator dial on the agent's artifacts wiring:
|
|
5
5
|
* `Agent.create({ artifacts: { store, placement: { maxInlineChars: N } } })`.
|
|
6
6
|
* A tool result whose finalized text exceeds the threshold is checked into
|
|
7
|
-
* the store (kind `tool-result/<toolName
|
|
7
|
+
* the store (kind `tool-result/<toolName>`, or the tool's declared
|
|
8
|
+
* `resultKind` — see `placedResultKind`) and the model receives the claim
|
|
8
9
|
* ticket instead — a SHORT substitute naming ref + meta + how to consume it.
|
|
9
10
|
* The whole 879,073-token failure class, retired by configuration.
|
|
10
11
|
*
|
|
@@ -45,12 +46,25 @@ export function assertArtifactPlacement(site, placement) {
|
|
|
45
46
|
`measured and never placed, exactly as before.`);
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The kind vocabulary a placement mint declares — THE one decision, and the
|
|
51
|
+
* only place it is made.
|
|
52
|
+
*
|
|
53
|
+
* Default: `tool-result/<toolName>`. Honest — it says exactly what the payload
|
|
54
|
+
* is and which tool produced it — and it is what a `wants` declaration or a
|
|
55
|
+
* `present` call names to consume the placed result.
|
|
56
|
+
*
|
|
57
|
+
* `declared` is the tool's own `Tool.resultKind` (9.70.0), and when a tool
|
|
58
|
+
* declares one it WINS. The reason is the exact-match law on the consuming
|
|
59
|
+
* end: `wants` matches kinds by exact string equality — no wildcards, no
|
|
60
|
+
* hierarchy — so the framework's default vocabulary is a ticket a
|
|
61
|
+
* `wants: { dataset: 'dataset/rows' }` argument must refuse. Rather than
|
|
62
|
+
* loosen the matcher (a ticket would stop being a promise) or make consumers
|
|
63
|
+
* re-mint at the seam (the framework declining to carry its own ref), the
|
|
64
|
+
* MINT speaks the author's vocabulary. Absent → today's bytes exactly.
|
|
65
|
+
*/
|
|
66
|
+
export function placedResultKind(toolName, declared) {
|
|
67
|
+
return declared ?? `tool-result/${toolName}`;
|
|
54
68
|
}
|
|
55
69
|
/** Type guard for consumers reading `tool_end.result` or a tool message. */
|
|
56
70
|
export function isPlacedToolResult(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement.js","sourceRoot":"","sources":["../../../src/artifacts/placement.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"placement.js","sourceRoot":"","sources":["../../../src/artifacts/placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAyBH;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAAY,EACZ,SAAwC;IAExC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO;IACpC,MAAM,KAAK,GAAG,SAAS,CAAC,cAAc,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,0EAA0E;YAC/E,mBAAmB,MAAM,CAAC,KAAK,CAAC,qDAAqD;YACrF,iFAAiF;YACjF,sFAAsF;YACtF,+CAA+C,CAClD,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,QAAiB;IAClE,OAAO,QAAQ,IAAI,eAAe,QAAQ,EAAE,CAAC;AAC/C,CAAC;AAsBD,4EAA4E;AAC5E,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAA8B,CAAC,MAAM,KAAK,IAAI;QAC/C,OAAQ,KAA2B,CAAC,GAAG,KAAK,QAAQ;QACpD,OAAQ,KAA8B,CAAC,MAAM,KAAK,QAAQ,CAC3D,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,gBAAgB,CAC9B,QAAgB,EAChB,IAAkB,EAClB,SAAiB,EACjB,cAAsB;IAEtB,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EACJ,GAAG,QAAQ,aAAa,SAAS,oBAAoB,cAAc,kBAAkB;YACrF,yDAAyD,IAAI,CAAC,GAAG,IAAI;YACrE,IAAI,IAAI,CAAC,IAAI,mEAAmE;YAChF,WAAW,IAAI,CAAC,GAAG,qCAAqC,IAAI,CAAC,IAAI,aAAa;YAC9E,mBAAmB,IAAI,CAAC,GAAG,yDAAyD;YACpF,sCAAsC;KACzC,CAAC;AACJ,CAAC"}
|
|
@@ -103,8 +103,9 @@ export interface ToolCallsHandlerDeps {
|
|
|
103
103
|
* The placement threshold (9.22.0) — the operator's ref-ing dial. When set
|
|
104
104
|
* (only ever beside `artifactStore`; the Agent option's shape enforces it),
|
|
105
105
|
* every finalized tool result on every dispatch path is measured, and one
|
|
106
|
-
* whose text exceeds `maxInlineChars` is checked into the store (
|
|
107
|
-
* `tool-result/<toolName>`
|
|
106
|
+
* whose text exceeds `maxInlineChars` is checked into the store (under the
|
|
107
|
+
* tool's declared `resultKind`, or `tool-result/<toolName>` when it
|
|
108
|
+
* declares none) with the model reading the claim ticket
|
|
108
109
|
* instead. Judged AFTER the tool's own `resultCeiling` and the after-tool
|
|
109
110
|
* chain, BEFORE the `maxToolResultChars` truncation net. Undefined — the
|
|
110
111
|
* default — and results are never measured against it (zero-cost).
|
|
@@ -1155,7 +1155,13 @@ export function buildToolCallsHandler(deps) {
|
|
|
1155
1155
|
// `mediaType` states what that text is: a JSON serialization when the
|
|
1156
1156
|
// tool returned a value, plain text when it returned a string.
|
|
1157
1157
|
meta = await bound.artifacts.put({
|
|
1158
|
-
|
|
1158
|
+
// The tool's own `resultKind` when it declared one (9.70.0), the
|
|
1159
|
+
// framework's `tool-result/<name>` when it did not. Resolved HERE
|
|
1160
|
+
// rather than threaded through the five dispatch doors: `lookupTool`
|
|
1161
|
+
// is the closure's one resolver (registry + this iteration's cached
|
|
1162
|
+
// provider list), so a sixth door added later cannot forget to carry
|
|
1163
|
+
// the declaration — the `capResults` landmine, avoided by shape.
|
|
1164
|
+
kind: placedResultKind(call.toolName, lookupTool(call.toolName)?.resultKind),
|
|
1159
1165
|
mediaType: typeof values.modelResult === 'string' ? 'text/plain' : 'application/json',
|
|
1160
1166
|
data: text,
|
|
1161
1167
|
label: `${call.toolName} result`,
|