agentfootprint 9.68.0 → 9.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CLAUDE.md +2 -0
  2. package/ai-instructions/setup.sh +0 -0
  3. package/bin/agentfootprint-index.mjs +0 -0
  4. package/bin/agentfootprint-lint-tools.mjs +0 -0
  5. package/canonical-notes.json +16 -0
  6. package/dist/adapters/browser/agentcore.js +203 -0
  7. package/dist/adapters/browser/agentcore.js.map +1 -0
  8. package/dist/adapters/types.js.map +1 -1
  9. package/dist/artifacts/placement.js +21 -7
  10. package/dist/artifacts/placement.js.map +1 -1
  11. package/dist/core/agent/stages/toolCalls.js +7 -1
  12. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  13. package/dist/core/tools.js +32 -1
  14. package/dist/core/tools.js.map +1 -1
  15. package/dist/doors/providers.js +9 -3
  16. package/dist/doors/providers.js.map +1 -1
  17. package/dist/esm/adapters/browser/agentcore.d.ts +141 -0
  18. package/dist/esm/adapters/browser/agentcore.js +199 -0
  19. package/dist/esm/adapters/browser/agentcore.js.map +1 -0
  20. package/dist/esm/adapters/types.d.ts +82 -0
  21. package/dist/esm/adapters/types.js.map +1 -1
  22. package/dist/esm/artifacts/placement.d.ts +22 -7
  23. package/dist/esm/artifacts/placement.js +21 -7
  24. package/dist/esm/artifacts/placement.js.map +1 -1
  25. package/dist/esm/core/agent/stages/toolCalls.d.ts +3 -2
  26. package/dist/esm/core/agent/stages/toolCalls.js +7 -1
  27. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  28. package/dist/esm/core/agent/types.d.ts +3 -2
  29. package/dist/esm/core/tools.d.ts +55 -0
  30. package/dist/esm/core/tools.js +30 -0
  31. package/dist/esm/core/tools.js.map +1 -1
  32. package/dist/esm/doors/providers.d.ts +1 -0
  33. package/dist/esm/doors/providers.js +4 -0
  34. package/dist/esm/doors/providers.js.map +1 -1
  35. package/dist/esm/index.d.ts +1 -1
  36. package/dist/esm/index.js +6 -1
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/esm/lib/injection-engine/types.d.ts +2 -1
  39. package/dist/esm/lib/injection-engine/types.js.map +1 -1
  40. package/dist/index.js +8 -3
  41. package/dist/index.js.map +1 -1
  42. package/dist/lib/injection-engine/types.js.map +1 -1
  43. package/dist/types/adapters/browser/agentcore.d.ts +142 -0
  44. package/dist/types/adapters/browser/agentcore.d.ts.map +1 -0
  45. package/dist/types/adapters/types.d.ts +82 -0
  46. package/dist/types/adapters/types.d.ts.map +1 -1
  47. package/dist/types/artifacts/placement.d.ts +22 -7
  48. package/dist/types/artifacts/placement.d.ts.map +1 -1
  49. package/dist/types/core/agent/stages/toolCalls.d.ts +3 -2
  50. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  51. package/dist/types/core/agent/types.d.ts +3 -2
  52. package/dist/types/core/agent/types.d.ts.map +1 -1
  53. package/dist/types/core/tools.d.ts +55 -0
  54. package/dist/types/core/tools.d.ts.map +1 -1
  55. package/dist/types/doors/providers.d.ts +1 -0
  56. package/dist/types/doors/providers.d.ts.map +1 -1
  57. package/dist/types/index.d.ts +1 -1
  58. package/dist/types/index.d.ts.map +1 -1
  59. package/dist/types/lib/injection-engine/types.d.ts +2 -1
  60. package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
  61. package/package.json +5 -3
package/CLAUDE.md CHANGED
@@ -40,6 +40,7 @@ not in this table, search `src/index.ts` for the nearest noun before writing cod
40
40
  | declaring an agent's whole setup as one named, versioned thing — a preset, a template, a blueprint, "the support agent we all use" | `defineAgentRecipe` + `AgentBuilder.recipe()` | `src/recipes/` | 9.48.0 |
41
41
  | naming your own branches and nodes — which prefix is reserved, and telling framework plumbing from consumer structure in a trace | `RESERVED_SUBFLOW_PREFIX` + `isReservedSubflowSegment` | `src/conventions.ts` | 9.49.0 |
42
42
  | keeping a large tool result out of the model's context | `artifacts` + `wants` + `placement` | `src/artifacts/` | 9.21.0 |
43
+ | the ticket placement just minted being REFUSED by your own `wants` argument as a kind mismatch — because the mint says `tool-result/<toolName>` and your consumer says `dataset/rows` | `Tool.resultKind` + `placedResultKind(toolName, declared?)` (the mint speaks the consumer's vocabulary; the exact-match matcher is untouched) | `src/artifacts/placement.ts` | 9.70.0 |
43
44
  | letting the UI draw an artifact without the model naming a component | `registerArtifactComponent` (in the `agentfootprint-lens` package) | — | — |
44
45
  | finding which tools the model keeps writing by hand | `agentfootprint.tools.code_run` + `codeShape` | `src/core/codeRunnerTool.ts` | 9.46.0 |
45
46
  | a skill wrongly activated by a keyword staying loaded for the whole turn — suspending/parking a map's prompt + tools when its contribution goes unused, WITHOUT touching its cursor, and re-engaging it on evidence | `.maps()` + `advanceEngagement` + `agentfootprint.map.engaged/parked` + skip reason `'parked'` | `src/maps/` | 9.58.0 |
@@ -47,6 +48,7 @@ not in this table, search `src/index.ts` for the nearest noun before writing cod
47
48
  | asking a debugging model "what did this run contradict itself about, and why?" — the Context Integrity findings, joined to the step that filed them | `find_context_errors` | `src/lib/trace-toolpack/traceToolpack.ts` | 9.61.0 |
48
49
  | a tool answering "I looked and found nothing", routably | `absent` | `src/core/agent/coverage/absent.ts` | 9.43.0 |
49
50
  | stating what a clean answer does NOT rule out | `coverage` | `src/core/agent/coverage/ledger.ts` | 9.43.0 |
51
+ | minting one of those shapes from a tool that is NOT JavaScript — the canonical note sentences and reserved marker keys as DATA, so a Python/Go/Rust sidecar reads a file instead of regex-scraping `dist/esm` (which a consumer really did) | `canonical-notes.json` at the package root + the `./canonical-notes.json` exports entry, GENERATED from the built barrel by `scripts/gen-canonical-notes.mjs` | `scripts/gen-canonical-notes.mjs` | 9.70.0 |
50
52
  | proving a session store really honours the port | `runSessionLifecycleConformance` | `src/hosting/conformance/` | 9.37.0 |
51
53
  | deciding who owns a contested session write | `resolveSessionOwner` | `src/hosting/sessionOwnership.ts` | 9.37.0 |
52
54
  | making a caller-supplied id safe for a backend | `encodeIdentityField` | `src/memory/identity/encode.ts` | 9.40.0 |
File without changes
File without changes
File without changes
@@ -0,0 +1,16 @@
1
+ {
2
+ "$comment": "GENERATED by scripts/gen-canonical-notes.mjs from this package's own built exports - do not edit by hand. These are the strings a tool written in another language must reproduce byte for byte: the static notes each result shape carries, the reserved marker keys that make those shapes recognizable, and the coverage block's heading. Keys are the exported constant names, so the same value is reachable as a TypeScript import from the package's main entry point. The package version lives in package.json.",
3
+ "notes": {
4
+ "ABSENCE_NOTE": "The search ran and matched nothing. This is an ANSWER, not an error: nothing failed, nothing was substituted for what was asked, and calling this tool again with the same arguments returns this same result. `checked` is the ground this answer covers; anything under `not_checked` or `cannot_cover` is ground it does NOT cover, and reaching that needs a different question, not a retry.",
5
+ "COVERAGE_NOTE": "This result covers only what `checked` lists. `not_checked` is ground this call did not look at, and `cannot_cover` is ground this tool can never see — a clean result here is NOT evidence about either, and no retry changes `cannot_cover`. Carry these limits into any answer you build on this result.",
6
+ "SEMANTICS_NOTE": "Typed data, not prose. `grain` and `provenance` are caveats that travel with the numbers: check `is_counter` before summing values from a series, read `measured_at` (and `age_seconds`) as how old the data is, and treat everything under `not_covered` as ground this result does NOT cover — a clean look here says nothing about it."
7
+ },
8
+ "markers": {
9
+ "ABSENCE_MARKER": "af_absent",
10
+ "COVERAGE_MARKER": "af_coverage",
11
+ "SEMANTICS_MARKER": "af_semantics"
12
+ },
13
+ "headings": {
14
+ "COVERAGE_BLOCK_HEADING": "Coverage of this answer"
15
+ }
16
+ }
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ /**
3
+ * agentCoreBrowser — AWS Bedrock AgentCore **Browser** as a {@link BrowserRunner}.
4
+ *
5
+ * A managed Chrome in AWS's account that an agent can drive, a person can watch
6
+ * live, and — the part this adapter exists for — a person can TAKE OVER
7
+ * mid-session and hand back.
8
+ *
9
+ * ── Two channels, and only one of them is here ───────────────────────────────
10
+ * A browser session has two doors, and confusing them wastes a day:
11
+ *
12
+ * 1. **The automation stream** — a CDP WebSocket. Navigate, find an element,
13
+ * fill a form: everything page-shaped happens here, driven by Playwright
14
+ * or another CDP client. This adapter hands you
15
+ * {@link BrowserSession.automationEndpoint} and stays out of the way. It
16
+ * does not depend on Playwright and does not drive the page for you.
17
+ * 2. **`InvokeBrowser`** — the data-plane operation this adapter calls. It is
18
+ * OS-LEVEL input ABOVE the page: mouse, keyboard, screenshots. Its action
19
+ * union, read off the SDK rather than remembered, is exactly
20
+ * `mouseClick | mouseMove | mouseDrag | mouseScroll | keyType | keyPress |
21
+ * keyShortcut | screenshot`. **There is no navigate action**, and a reader
22
+ * expecting one is looking at the wrong door.
23
+ *
24
+ * ── The takeover ─────────────────────────────────────────────────────────────
25
+ * `UpdateBrowserStream` with `automationStreamUpdate.streamStatus` set to
26
+ * `DISABLED` stops the automation channel and leaves the live-view user in
27
+ * control; `ENABLED` gives it back. That is `handControlTo('person' | 'agent')`
28
+ * here, and it composes with this library's check-in: the agent pauses, a
29
+ * person finishes the login, the agent resumes on the page they left — and both
30
+ * handovers are ordinary events in the trace.
31
+ *
32
+ * ── How this talks to the SDK (the 9.4.0 law) ────────────────────────────────
33
+ * Through `client.send(new SomeCommand(input))`, never a method on the client —
34
+ * a bare `@aws-sdk/client-*` Client carries `send` and `destroy` and nothing
35
+ * else. Every command name and request shape below was read off a real install
36
+ * of `@aws-sdk/client-bedrock-agentcore` **3.1118.0**, including the action
37
+ * union above and `ScreenshotResult`'s `{ status, error?, data? }`.
38
+ *
39
+ * ── One documented contradiction, left as AWS wrote it ───────────────────────
40
+ * The devguide says a session defaults to 15 minutes; `StartBrowserSession`'s
41
+ * API reference says 3600 seconds. This adapter sends nothing unless you pass
42
+ * `sessionTimeoutSeconds`, so the default is whatever the service applies —
43
+ * rather than this file picking a side in somebody else's disagreement.
44
+ *
45
+ * Pattern: Adapter (GoF) + lazy peer-dep load — the SDK is required only when
46
+ * `start()` first runs, or never, if you inject `_client` / `_sdk`.
47
+ */
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.agentCoreBrowser = exports.AWS_SYSTEM_BROWSER = void 0;
50
+ const lazyRequire_js_1 = require("../../lib/lazyRequire.js");
51
+ /** AWS's managed browser. A custom `CreateBrowser` resource id goes here instead. */
52
+ exports.AWS_SYSTEM_BROWSER = 'aws.browser.v1';
53
+ const BUTTONS = { left: 'LEFT', middle: 'MIDDLE', right: 'RIGHT' };
54
+ function createBrowserClient(options) {
55
+ let mod;
56
+ if (options._sdk) {
57
+ mod = options._sdk;
58
+ }
59
+ else {
60
+ try {
61
+ mod = (0, lazyRequire_js_1.lazyRequire)('@aws-sdk/client-bedrock-agentcore');
62
+ }
63
+ catch {
64
+ throw new Error('agentCoreBrowser requires the `@aws-sdk/client-bedrock-agentcore` peer dependency.\n' +
65
+ ' Install: npm install @aws-sdk/client-bedrock-agentcore\n' +
66
+ ' Or pass `_client` for a pre-built or mock client.');
67
+ }
68
+ }
69
+ if (!mod.BedrockAgentCoreClient) {
70
+ throw new Error('agentCoreBrowser: `@aws-sdk/client-bedrock-agentcore` is installed but ' +
71
+ '`BedrockAgentCoreClient` was not found. Update the SDK.');
72
+ }
73
+ const sdk = new mod.BedrockAgentCoreClient({ ...(options.region && { region: options.region }) });
74
+ const send = async (Ctor, name, input) => {
75
+ if (!Ctor) {
76
+ throw new Error(`agentCoreBrowser: \`@aws-sdk/client-bedrock-agentcore\` is missing ${name}. ` +
77
+ 'Upgrade the SDK, or pass `_client` with your own mapping.');
78
+ }
79
+ return sdk.send(new Ctor(input));
80
+ };
81
+ return {
82
+ async startBrowserSession(input) {
83
+ return (await send(mod.StartBrowserSessionCommand, 'StartBrowserSessionCommand', input));
84
+ },
85
+ async invokeBrowser(input) {
86
+ return (await send(mod.InvokeBrowserCommand, 'InvokeBrowserCommand', input));
87
+ },
88
+ async updateBrowserStream(input) {
89
+ await send(mod.UpdateBrowserStreamCommand, 'UpdateBrowserStreamCommand', input);
90
+ },
91
+ async stopBrowserSession(input) {
92
+ await send(mod.StopBrowserSessionCommand, 'StopBrowserSessionCommand', input);
93
+ },
94
+ };
95
+ }
96
+ /**
97
+ * Build a {@link BrowserRunner} backed by AgentCore Browser.
98
+ *
99
+ * @example A session, a person taking over, and the agent resuming
100
+ * const browser = agentCoreBrowser({ region: 'us-east-1' });
101
+ * const session = await browser.start({ key: toolSessionKey(ctx, 'run') });
102
+ *
103
+ * // Page work goes over CDP, not through this adapter:
104
+ * // const page = await chromium.connectOverCDP(session.automationEndpoint!)
105
+ *
106
+ * await session.handControlTo?.('person'); // they finish the login
107
+ * await session.handControlTo?.('agent'); // and the agent carries on
108
+ * await session.stop();
109
+ */
110
+ function agentCoreBrowser(options = {}) {
111
+ const browserIdentifier = options.browserIdentifier ?? exports.AWS_SYSTEM_BROWSER;
112
+ let client;
113
+ const getClient = () => {
114
+ client ??= options._client ?? createBrowserClient(options);
115
+ return client;
116
+ };
117
+ return {
118
+ id: options.id ?? 'agentcore-browser',
119
+ async start(req) {
120
+ const c = getClient();
121
+ const started = await c.startBrowserSession({
122
+ browserIdentifier,
123
+ name: req.key,
124
+ ...(options.sessionTimeoutSeconds !== undefined && {
125
+ sessionTimeoutSeconds: options.sessionTimeoutSeconds,
126
+ }),
127
+ ...(options.viewport !== undefined && { viewPort: options.viewport }),
128
+ });
129
+ const sessionId = started.sessionId;
130
+ if (!sessionId) {
131
+ throw new Error('agentCoreBrowser: StartBrowserSession returned no sessionId, so there is no session ' +
132
+ 'to drive. Check the browser identifier and the execution role.');
133
+ }
134
+ const act = async (action) => {
135
+ const answer = await c.invokeBrowser({ browserIdentifier, sessionId, action });
136
+ return answer.result;
137
+ };
138
+ const automationEndpoint = started.streams?.automationStream?.streamEndpoint;
139
+ const liveViewEndpoint = started.streams?.liveViewStream?.streamEndpoint;
140
+ const session = {
141
+ id: sessionId,
142
+ ...(automationEndpoint !== undefined && { automationEndpoint }),
143
+ ...(liveViewEndpoint !== undefined && { liveViewEndpoint }),
144
+ async click({ x, y, button, clicks }) {
145
+ await act({
146
+ mouseClick: {
147
+ x,
148
+ y,
149
+ ...(button !== undefined && { button: BUTTONS[button] }),
150
+ ...(clicks !== undefined && { clickCount: clicks }),
151
+ },
152
+ });
153
+ },
154
+ async type(text) {
155
+ await act({ keyType: { text } });
156
+ },
157
+ async press({ key, times }) {
158
+ await act({ keyPress: { key, ...(times !== undefined && { presses: times }) } });
159
+ },
160
+ async screenshot() {
161
+ const result = await act({ screenshot: { format: 'PNG' } });
162
+ const shot = result?.screenshot;
163
+ if (!shot?.data) {
164
+ // The result member carries its own status and error, so a failed
165
+ // screenshot says what the service said rather than answering with
166
+ // an empty image that reads as a blank page.
167
+ throw new Error(`agentCoreBrowser: the screenshot did not produce image data` +
168
+ `${shot?.status ? ` (status ${shot.status})` : ''}` +
169
+ `${shot?.error ? `: ${shot.error}` : '.'}`);
170
+ }
171
+ return { data: shot.data, format: 'png' };
172
+ },
173
+ async handControlTo(driver) {
174
+ // The person takes over by DISABLING automation: the live-view user
175
+ // is already connected, and stopping the automation stream is what
176
+ // lets their input through.
177
+ await c.updateBrowserStream({
178
+ browserIdentifier,
179
+ sessionId,
180
+ streamUpdate: {
181
+ automationStreamUpdate: {
182
+ streamStatus: driver === 'person' ? 'DISABLED' : 'ENABLED',
183
+ },
184
+ },
185
+ });
186
+ },
187
+ async stop() {
188
+ try {
189
+ await c.stopBrowserSession({ browserIdentifier, sessionId });
190
+ }
191
+ catch {
192
+ // A managed session reaped by its own idle timeout is the ordinary
193
+ // case, and stopping one that is already gone is a no-op — the port
194
+ // says so, and a throw here would fail a teardown that succeeded.
195
+ }
196
+ },
197
+ };
198
+ return session;
199
+ },
200
+ };
201
+ }
202
+ exports.agentCoreBrowser = agentCoreBrowser;
203
+ //# sourceMappingURL=agentcore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentcore.js","sourceRoot":"","sources":["../../../src/adapters/browser/agentcore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;;;AAGH,6DAAuD;AAEvD,qFAAqF;AACxE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AC3D;yBACF;qBACF,CAAC,CAAC;gBACL,CAAC;gBAED,KAAK,CAAC,IAAI;oBACR,IAAI,CAAC;wBACH,MAAM,CAAC,CAAC,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC,CAAC;oBAC/D,CAAC;oBAAC,MAAM,CAAC;wBACP,mEAAmE;wBACnE,oEAAoE;wBACpE,kEAAkE;oBACpE,CAAC;gBACH,CAAC;aACF,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AA5GD,4CA4GC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAsHH;;;;GAIG;AACU,QAAA,2BAA2B,GAAwB,MAAM,CAAC,MAAM,CAAC;IAC5E,MAAM;IACN,WAAW;CACZ,CAAC,CAAC;AAqsBH;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,OAAsC,EACtC,UAAgC;IAEhC,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,UAAU,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AACxD,CAAC;AAPD,wCAOC;AAqDD;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,kBAAkB,CAAC;AAgGpD;uDACuD;AACvD,SAAgB,kBAAkB,CAChC,OAAoB;IAEpB,OAAO,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,CAAC;AACnD,CAAC;AAJD,gDAIC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAsHH;;;;GAIG;AACU,QAAA,2BAA2B,GAAwB,MAAM,CAAC,MAAM,CAAC;IAC5E,MAAM;IACN,WAAW;CACZ,CAAC,CAAC;AAqsBH;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,OAAsC,EACtC,UAAgC;IAEhC,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,UAAU,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AACxD,CAAC;AAPD,wCAOC;AAqID;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,kBAAkB,CAAC;AAgGpD;uDACuD;AACvD,SAAgB,kBAAkB,CAChC,OAAoB;IAEpB,OAAO,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,CAAC;AACnD,CAAC;AAJD,gDAIC"}
@@ -5,7 +5,8 @@
5
5
  * An OPTIONAL operator dial on the agent's artifacts wiring:
6
6
  * `Agent.create({ artifacts: { store, placement: { maxInlineChars: N } } })`.
7
7
  * A tool result whose finalized text exceeds the threshold is checked into
8
- * the store (kind `tool-result/<toolName>`) and the model receives the claim
8
+ * the store (kind `tool-result/<toolName>`, or the tool's declared
9
+ * `resultKind` — see `placedResultKind`) and the model receives the claim
9
10
  * ticket instead — a SHORT substitute naming ref + meta + how to consume it.
10
11
  * The whole 879,073-token failure class, retired by configuration.
11
12
  *
@@ -49,12 +50,25 @@ function assertArtifactPlacement(site, placement) {
49
50
  }
50
51
  }
51
52
  exports.assertArtifactPlacement = assertArtifactPlacement;
52
- /** The kind vocabulary a placement mint declares: `tool-result/<toolName>`.
53
- * Honest it says exactly what the payload is and which tool produced it —
54
- * and it is what a `wants` declaration or a `present` call names to consume
55
- * the placed result. */
56
- function placedResultKind(toolName) {
57
- return `tool-result/${toolName}`;
53
+ /**
54
+ * The kind vocabulary a placement mint declares THE one decision, and the
55
+ * only place it is made.
56
+ *
57
+ * Default: `tool-result/<toolName>`. Honest — it says exactly what the payload
58
+ * is and which tool produced it — and it is what a `wants` declaration or a
59
+ * `present` call names to consume the placed result.
60
+ *
61
+ * `declared` is the tool's own `Tool.resultKind` (9.70.0), and when a tool
62
+ * declares one it WINS. The reason is the exact-match law on the consuming
63
+ * end: `wants` matches kinds by exact string equality — no wildcards, no
64
+ * hierarchy — so the framework's default vocabulary is a ticket a
65
+ * `wants: { dataset: 'dataset/rows' }` argument must refuse. Rather than
66
+ * loosen the matcher (a ticket would stop being a promise) or make consumers
67
+ * re-mint at the seam (the framework declining to carry its own ref), the
68
+ * MINT speaks the author's vocabulary. Absent → today's bytes exactly.
69
+ */
70
+ function placedResultKind(toolName, declared) {
71
+ return declared ?? `tool-result/${toolName}`;
58
72
  }
59
73
  exports.placedResultKind = placedResultKind;
60
74
  /** Type guard for consumers reading `tool_end.result` or a tool message. */
@@ -1 +1 @@
1
- {"version":3,"file":"placement.js","sourceRoot":"","sources":["../../src/artifacts/placement.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;;;AAyBH;;;GAGG;AACH,SAAgB,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;AAfD,0DAeC;AAED;;;yBAGyB;AACzB,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,OAAO,eAAe,QAAQ,EAAE,CAAC;AACnC,CAAC;AAFD,4CAEC;AAqBD,4EAA4E;AAC5E,SAAg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olCallsHandler(deps) {
1158
1158
  // `mediaType` states what that text is: a JSON serialization when the
1159
1159
  // tool returned a value, plain text when it returned a string.
1160
1160
  meta = await bound.artifacts.put({
1161
- kind: (0, placement_js_1.placedResultKind)(call.toolName),
1161
+ // The tool's own `resultKind` when it declared one (9.70.0), the
1162
+ // framework's `tool-result/<name>` when it did not. Resolved HERE
1163
+ // rather than threaded through the five dispatch doors: `lookupTool`
1164
+ // is the closure's one resolver (registry + this iteration's cached
1165
+ // provider list), so a sixth door added later cannot forget to carry
1166
+ // the declaration — the `capResults` landmine, avoided by shape.
1167
+ kind: (0, placement_js_1.placedResultKind)(call.toolName, lookupTool(call.toolName)?.resultKind),
1162
1168
  mediaType: typeof values.modelResult === 'string' ? 'text/plain' : 'application/json',
1163
1169
  data: text,
1164
1170
  label: `${call.toolName} result`,