agentfootprint 9.21.0 → 9.22.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 (106) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +1 -1
  3. package/README.md +1 -0
  4. package/ai-instructions/claude-code/SKILL.md +1 -1
  5. package/dist/artifacts/capability.js.map +1 -1
  6. package/dist/artifacts/index.js +18 -4
  7. package/dist/artifacts/index.js.map +1 -1
  8. package/dist/artifacts/placement.js +86 -0
  9. package/dist/artifacts/placement.js.map +1 -0
  10. package/dist/artifacts/present.js +98 -0
  11. package/dist/artifacts/present.js.map +1 -0
  12. package/dist/artifacts/wants.js +240 -0
  13. package/dist/artifacts/wants.js.map +1 -0
  14. package/dist/core/Agent.js +56 -5
  15. package/dist/core/Agent.js.map +1 -1
  16. package/dist/core/agent/buildToolRegistry.js +30 -1
  17. package/dist/core/agent/buildToolRegistry.js.map +1 -1
  18. package/dist/core/agent/presentTool.js +59 -0
  19. package/dist/core/agent/presentTool.js.map +1 -0
  20. package/dist/core/agent/stages/toolCalls.js +265 -14
  21. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  22. package/dist/core/codeRunnerTool.js +89 -3
  23. package/dist/core/codeRunnerTool.js.map +1 -1
  24. package/dist/core/tools.js +7 -0
  25. package/dist/core/tools.js.map +1 -1
  26. package/dist/esm/adapters/types.d.ts +17 -1
  27. package/dist/esm/artifacts/capability.d.ts +10 -3
  28. package/dist/esm/artifacts/capability.js.map +1 -1
  29. package/dist/esm/artifacts/index.d.ts +8 -3
  30. package/dist/esm/artifacts/index.js +8 -3
  31. package/dist/esm/artifacts/index.js.map +1 -1
  32. package/dist/esm/artifacts/placement.d.ts +74 -0
  33. package/dist/esm/artifacts/placement.js +79 -0
  34. package/dist/esm/artifacts/placement.js.map +1 -0
  35. package/dist/esm/artifacts/present.d.ts +77 -0
  36. package/dist/esm/artifacts/present.js +94 -0
  37. package/dist/esm/artifacts/present.js.map +1 -0
  38. package/dist/esm/artifacts/wants.d.ts +104 -0
  39. package/dist/esm/artifacts/wants.js +234 -0
  40. package/dist/esm/artifacts/wants.js.map +1 -0
  41. package/dist/esm/core/Agent.d.ts +5 -2
  42. package/dist/esm/core/Agent.js +56 -5
  43. package/dist/esm/core/Agent.js.map +1 -1
  44. package/dist/esm/core/agent/buildToolRegistry.d.ts +11 -1
  45. package/dist/esm/core/agent/buildToolRegistry.js +30 -1
  46. package/dist/esm/core/agent/buildToolRegistry.js.map +1 -1
  47. package/dist/esm/core/agent/presentTool.d.ts +22 -0
  48. package/dist/esm/core/agent/presentTool.js +55 -0
  49. package/dist/esm/core/agent/presentTool.js.map +1 -0
  50. package/dist/esm/core/agent/stages/toolCalls.d.ts +12 -0
  51. package/dist/esm/core/agent/stages/toolCalls.js +265 -14
  52. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  53. package/dist/esm/core/agent/types.d.ts +33 -4
  54. package/dist/esm/core/codeRunnerTool.js +89 -3
  55. package/dist/esm/core/codeRunnerTool.js.map +1 -1
  56. package/dist/esm/core/tools.d.ts +34 -0
  57. package/dist/esm/core/tools.js +7 -0
  58. package/dist/esm/core/tools.js.map +1 -1
  59. package/dist/esm/events/payloads.d.ts +27 -1
  60. package/dist/esm/events/registry.d.ts +3 -1
  61. package/dist/esm/events/registry.js +2 -0
  62. package/dist/esm/events/registry.js.map +1 -1
  63. package/dist/esm/index.d.ts +2 -1
  64. package/dist/esm/index.js +7 -0
  65. package/dist/esm/index.js.map +1 -1
  66. package/dist/esm/lib/mcp/mcpServe.js +9 -0
  67. package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
  68. package/dist/events/registry.js +2 -0
  69. package/dist/events/registry.js.map +1 -1
  70. package/dist/index.js +18 -7
  71. package/dist/index.js.map +1 -1
  72. package/dist/lib/mcp/mcpServe.js +9 -0
  73. package/dist/lib/mcp/mcpServe.js.map +1 -1
  74. package/dist/types/adapters/types.d.ts +17 -1
  75. package/dist/types/adapters/types.d.ts.map +1 -1
  76. package/dist/types/artifacts/capability.d.ts +10 -3
  77. package/dist/types/artifacts/capability.d.ts.map +1 -1
  78. package/dist/types/artifacts/index.d.ts +8 -3
  79. package/dist/types/artifacts/index.d.ts.map +1 -1
  80. package/dist/types/artifacts/placement.d.ts +75 -0
  81. package/dist/types/artifacts/placement.d.ts.map +1 -0
  82. package/dist/types/artifacts/present.d.ts +78 -0
  83. package/dist/types/artifacts/present.d.ts.map +1 -0
  84. package/dist/types/artifacts/wants.d.ts +105 -0
  85. package/dist/types/artifacts/wants.d.ts.map +1 -0
  86. package/dist/types/core/Agent.d.ts +5 -2
  87. package/dist/types/core/Agent.d.ts.map +1 -1
  88. package/dist/types/core/agent/buildToolRegistry.d.ts +11 -1
  89. package/dist/types/core/agent/buildToolRegistry.d.ts.map +1 -1
  90. package/dist/types/core/agent/presentTool.d.ts +23 -0
  91. package/dist/types/core/agent/presentTool.d.ts.map +1 -0
  92. package/dist/types/core/agent/stages/toolCalls.d.ts +12 -0
  93. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  94. package/dist/types/core/agent/types.d.ts +33 -4
  95. package/dist/types/core/agent/types.d.ts.map +1 -1
  96. package/dist/types/core/codeRunnerTool.d.ts.map +1 -1
  97. package/dist/types/core/tools.d.ts +34 -0
  98. package/dist/types/core/tools.d.ts.map +1 -1
  99. package/dist/types/events/payloads.d.ts +27 -1
  100. package/dist/types/events/payloads.d.ts.map +1 -1
  101. package/dist/types/events/registry.d.ts +3 -1
  102. package/dist/types/events/registry.d.ts.map +1 -1
  103. package/dist/types/index.d.ts +2 -1
  104. package/dist/types/index.d.ts.map +1 -1
  105. package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
  106. package/package.json +1 -1
package/AGENTS.md CHANGED
@@ -475,7 +475,7 @@ Resilience decorators live on the `agentfootprint/resilience` subpath
475
475
  (not the main barrel). Each preserves the `LLMProvider` interface and
476
476
  stacks freely.
477
477
 
478
- ### Observability — 89 typed events across 21 domains
478
+ ### Observability — 90 typed events across 21 domains
479
479
 
480
480
  ```typescript
481
481
  agent.on('agentfootprint.context.injected', (e) =>
package/CLAUDE.md CHANGED
@@ -60,7 +60,7 @@ Traps: `src/observability/` holds the finder IMPLEMENTATIONS (canonical home; `d
60
60
  - **Embedder fingerprint** (8.9.0) → `Embedder.id` (optional; every shipped embedder sets one, and NONE include dims — the store appends `@<dims>` itself, so an id carrying its own size double-stamps) + `indexDocuments` defaulting `embedderId` to it + `SqliteVectorStore.reconcileFingerprint` (the only comparison site). Rule: dimensions ALWAYS decide, model ids decide only when BOTH sides named themselves — refusing on an absent name would block the majority of callers who never pass `embedderId`.
61
61
  - **Retrieval record** (8.8.0) → FOUR stages write one object in sequence: `loadRelevant` (candidates+scores+threshold verdicts) → `pickByBudget` (re-marks admitted→over-budget/over-max-entries) → `formatDefault` (`promptFragment` + `promptPosition`) → the read mount's outputMapper lifts it to root as `retrievalEvidence_<id>`. `memoryRecallInjections` then splits ONE recall into one ActiveInjection PER CHUNK — guarded by a byte-equality check (`fragments.join('\n\n') === systemContent`) that falls back to the single injection rather than change the prompt. `rank` (score order) and `promptPosition` (picker order) are DIFFERENT and both load-bearing: joining fragments in rank order reproduces the right bytes in a sequence the model never saw.
62
62
  - **AgentState** → all 8 stages/ files, both builders' mappers, memory-wire STRING-TYPED keys ('runIdentity'/'turnNumber'/… buildAgentChart.ts:177-180 — not refactor-safe), finalizeResult's `reliabilityFail*`/`policyHalt*` reads (rename silently kills the typed errors).
63
- - **events/** → 89 typed events across 21 domains (counts anti-drift-tested against this file — update BOTH when adding events): ALL_EVENT_TYPES exhaustiveness tests, DomainWildcard hand-list, ~42 importers (recorders, strategies, stream, commentary).
63
+ - **events/** → 90 typed events across 21 domains (counts anti-drift-tested against this file — update BOTH when adding events): ALL_EVENT_TYPES exhaustiveness tests, DomainWildcard hand-list, ~42 importers (recorders, strategies, stream, commentary).
64
64
  - **adapters/types.ts LLMMessage/LLMRequest** → 62 importers: tool_use round-trip (toolCalls.ts:115-135), wire assembly (callLLM.ts:150-160), providers, cache strategies, security/extractSequence, reliability loop.
65
65
  - **Cache** → strategy registration is a MODULE SIDE EFFECT (src/index.ts:15-17); an entry point skipping that import silently falls back to NoOp. Resolved once per Agent at construction (Agent.ts:347).
66
66
  - **Injection engine eval semantics** → Evaluate stage cursor keystone (buildInjectionEngineSubflow.ts:214-222), Route stage MIRRORS slot filters (keep in sync with buildSystemPromptSlot), read_skill gate (toolCalls.ts:747). The gate's allowed set is TWO kinds of id (8.4.0): a HOP (`deps.allowedSkillIds` = `graph.reachableSkills(cursor)` — activates AND moves the cursor) ∪ an OPEN skill (`deps.openSkillIds` = `Agent.openSkillIds()`, Agent.ts:1052 — a registered skill whose trigger is `llm-activated` AND that the graph declares no incoming edge to; activates, never moves the cursor). Both clauses are load-bearing: the trigger test is "read_skill can really activate this", the edge test keeps a bare model edge `.route(a,m)` from-gated. **8.5.0** extends the SAME trigger test three ways: a decision `tree()` returns `[]` from `reachableSkills` (leaves compile to `rule` triggers, so a pick could only be accepted then dropped — the gate refuses with a tree-specific message, `deps.skillGraphIsTree`, derived in AgentBuilder from `graph.nodes.some(kind==='predicate')`); `surfaceMode:'tool-only'` is refused at agent build for any skill whose trigger is not `llm-activated` (skillBodyDelivery.ts — the read_skill tool result is the only channel that mode has, and the graph never calls read_skill); and `read_skill`'s DESCRIPTION is rebuilt per iteration from `reachableSkills(cursor) ∪ open` (Agent.readSkillOfferFor → buildToolsSlot's `readSkillFor`). **The read_skill ENUM must stay the full catalog** — `toolArgValidation` defaults to `'enforce'` and runs at toolCalls.ts:570, BEFORE the gate at :765, and sets `error = true` which the gate skips; narrowing the enum silently retires the teaching refusal, `skill.rejected`, routeRecorder's rejection hops and the rejected-cap governor.
package/README.md CHANGED
@@ -879,6 +879,7 @@ The flowchart, recorders, and tests don't change between dev and prod.
879
879
 
880
880
  **Operability**
881
881
  - Provider-agnostic prompt caching — declarative per-injection, per-iteration marker recomputation
882
+ - Artifacts (the claim check) — tools check data into a governed store (`ctx.artifacts`; in-memory / file / SQLite) and the model routes ~26-char tickets instead of hauling payloads: `wants` resolves ref arguments at dispatch with teaching refusals, the placement threshold (`artifacts: { store, placement }`) auto-refs oversized tool results, and the auto-attached `present` tool hands a ref to the screen with a durable description snapshot — every mint / resolve / refusal / presentation a typed event
882
883
  - Human-in-the-loop pause / resume — a tool calls `pauseHere(...)` (or `askHuman(...)`); `isPaused(result)` hands you a JSON-serializable checkpoint, and `agent.resume(checkpoint, input)` continues hours later on a different server
883
884
  - Resilience primitives — `withRetry`, `withFallback`, `withCircuitBreaker`, `.outputFallback`, `agent.resumeOnError`
884
885
  - 60+ typed observability events — `agent` · `composition` · `context` · `stream` · `tools` · `skill` · `memory` · `cache` · `cost` · `permission` · `eval` · `embedding` · `pause` · `error` · `fallback` · `resilience` · `reliability` · `risk`
@@ -379,7 +379,7 @@ if (isPaused(result)) {
379
379
  }
380
380
  ```
381
381
 
382
- ## Observability — 89 typed events × 21 domains
382
+ ## Observability — 90 typed events × 21 domains
383
383
 
384
384
  ```typescript
385
385
  agent.on('agentfootprint.context.injected', (e) =>
@@ -1 +1 @@
1
- {"version":3,"file":"capability.js","sourceRoot":"","sources":["../../src/artifacts/capability.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,yCAcoB;AAkEpB;;;GAGG;AACH,SAAgB,aAAa,CAC3B,KAAoB,EACpB,KAAoB,EACpB,UAAgC,EAAE;IAElC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACpC,MAAM,MAAM,GAAG,CAAC,IAAuB,EAAQ,EAAE;QAC/C,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO;QACL,KAAK,CAAC,GAAG,CAAC,KAA2B;YACnC,IAAI,CAAC;gBACH,sEAAsE;gBACtE,sDAAsD;gBACtD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CA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AG,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC;QACtC,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;KAC3B,CAAC;AACJ,CAAC;AApBD,sDAoBC"}
@@ -4,12 +4,14 @@
4
4
  *
5
5
  * The claim-check store: shapes + the five-verb port (`types`), the ref
6
6
  * grammar (`naming`), the payload laws (`payload`), the eviction law
7
- * (`retention`), the shared put pipeline (`minting`), three adapters, and
8
- * the `ctx.artifacts` capability (`capability`). See README.md in this
9
- * folder for the one-job map and the import direction.
7
+ * (`retention`), the shared put pipeline (`minting`), three adapters, the
8
+ * `ctx.artifacts` capability (`capability`) and the Phase-2 data legs:
9
+ * ref arguments at dispatch (`wants`), the hand-to-the-screen verb
10
+ * (`present`), and the placement threshold (`placement`). See README.md in
11
+ * this folder for the one-job map and the import direction.
10
12
  */
11
13
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.unconfiguredArtifacts = exports.bindArtifacts = exports.UnreadableArtifactStoreError = exports.sqliteArtifacts = exports.UnreadableArtifactFileError = exports.fileArtifacts = exports.DEFAULT_IN_MEMORY_ARTIFACT_RETENTION = exports.inMemoryArtifacts = exports.mintArtifactRef = exports.isArtifactRef = exports.ARTIFACT_REF_PREFIX = exports.UnknownParentRefError = exports.InvalidArtifactError = exports.ArtifactIntegrityError = void 0;
14
+ exports.placedToolResult = exports.placedResultKind = exports.isPlacedToolResult = exports.assertArtifactPlacement = exports.presentArtifact = exports.PRESENT_TOOL_NAME = exports.wantsNeedsStoreRefusal = exports.resolveToolWants = exports.assertToolWants = exports.unconfiguredArtifacts = exports.bindArtifacts = exports.UnreadableArtifactStoreError = exports.sqliteArtifacts = exports.UnreadableArtifactFileError = exports.fileArtifacts = exports.DEFAULT_IN_MEMORY_ARTIFACT_RETENTION = exports.inMemoryArtifacts = exports.mintArtifactRef = exports.isArtifactRef = exports.ARTIFACT_REF_PREFIX = exports.UnknownParentRefError = exports.InvalidArtifactError = exports.ArtifactIntegrityError = void 0;
13
15
  var types_js_1 = require("./types.js");
14
16
  Object.defineProperty(exports, "ArtifactIntegrityError", { enumerable: true, get: function () { return types_js_1.ArtifactIntegrityError; } });
15
17
  Object.defineProperty(exports, "InvalidArtifactError", { enumerable: true, get: function () { return types_js_1.InvalidArtifactError; } });
@@ -30,4 +32,16 @@ Object.defineProperty(exports, "UnreadableArtifactStoreError", { enumerable: tru
30
32
  var capability_js_1 = require("./capability.js");
31
33
  Object.defineProperty(exports, "bindArtifacts", { enumerable: true, get: function () { return capability_js_1.bindArtifacts; } });
32
34
  Object.defineProperty(exports, "unconfiguredArtifacts", { enumerable: true, get: function () { return capability_js_1.unconfiguredArtifacts; } });
35
+ var wants_js_1 = require("./wants.js");
36
+ Object.defineProperty(exports, "assertToolWants", { enumerable: true, get: function () { return wants_js_1.assertToolWants; } });
37
+ Object.defineProperty(exports, "resolveToolWants", { enumerable: true, get: function () { return wants_js_1.resolveToolWants; } });
38
+ Object.defineProperty(exports, "wantsNeedsStoreRefusal", { enumerable: true, get: function () { return wants_js_1.wantsNeedsStoreRefusal; } });
39
+ var present_js_1 = require("./present.js");
40
+ Object.defineProperty(exports, "PRESENT_TOOL_NAME", { enumerable: true, get: function () { return present_js_1.PRESENT_TOOL_NAME; } });
41
+ Object.defineProperty(exports, "presentArtifact", { enumerable: true, get: function () { return present_js_1.presentArtifact; } });
42
+ var placement_js_1 = require("./placement.js");
43
+ Object.defineProperty(exports, "assertArtifactPlacement", { enumerable: true, get: function () { return placement_js_1.assertArtifactPlacement; } });
44
+ Object.defineProperty(exports, "isPlacedToolResult", { enumerable: true, get: function () { return placement_js_1.isPlacedToolResult; } });
45
+ Object.defineProperty(exports, "placedResultKind", { enumerable: true, get: function () { return placement_js_1.placedResultKind; } });
46
+ Object.defineProperty(exports, "placedToolResult", { enumerable: true, get: function () { return placement_js_1.placedToolResult; } });
33
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,uCAgBoB;AAflB,kHAAA,sBAAsB,OAAA;AACtB,gHAAA,oBAAoB,OAAA;AACpB,iHAAA,qBAAqB,OAAA;AAcvB,yCAAkF;AAAzE,gHAAA,mBAAmB,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,4GAAA,eAAe,OAAA;AAE5D,+DAKgC;AAJ9B,yHAAA,iBAAiB,OAAA;AACjB,4IAAA,oCAAoC,OAAA;AAItC,uDAI4B;AAH1B,iHAAA,aAAa,OAAA;AACb,+HAAA,2BAA2B,OAAA;AAG7B,2DAK8B;AAJ5B,qHAAA,eAAe,OAAA;AACf,kIAAA,4BAA4B,OAAA;AAI9B,iDAUyB;AATvB,8GAAA,aAAa,OAAA;AACb,sHAAA,qBAAqB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,uCAgBoB;AAflB,kHAAA,sBAAsB,OAAA;AACtB,gHAAA,oBAAoB,OAAA;AACpB,iHAAA,qBAAqB,OAAA;AAcvB,yCAAkF;AAAzE,gHAAA,mBAAmB,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,4GAAA,eAAe,OAAA;AAE5D,+DAKgC;AAJ9B,yHAAA,iBAAiB,OAAA;AACjB,4IAAA,oCAAoC,OAAA;AAItC,uDAI4B;AAH1B,iHAAA,aAAa,OAAA;AACb,+HAAA,2BAA2B,OAAA;AAG7B,2DAK8B;AAJ5B,qHAAA,eAAe,OAAA;AACf,kIAAA,4BAA4B,OAAA;AAI9B,iDAUyB;AATvB,8GAAA,aAAa,OAAA;AACb,sHAAA,qBAAqB,OAAA;AASvB,uCAOoB;AANlB,2GAAA,eAAe,OAAA;AACf,4GAAA,gBAAgB,OAAA;AAChB,kHAAA,sBAAsB,OAAA;AAKxB,2CAMsB;AALpB,+GAAA,iBAAiB,OAAA;AACjB,6GAAA,eAAe,OAAA;AAKjB,+CAOwB;AANtB,uHAAA,uBAAuB,OAAA;AACvB,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAChB,gHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /**
3
+ * artifacts/placement — the placement threshold (Phase 2, Leg 3).
4
+ *
5
+ * An OPTIONAL operator dial on the agent's artifacts wiring:
6
+ * `Agent.create({ artifacts: { store, placement: { maxInlineChars: N } } })`.
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
9
+ * ticket instead — a SHORT substitute naming ref + meta + how to consume it.
10
+ * The whole 879,073-token failure class, retired by configuration.
11
+ *
12
+ * PRECEDENCE with the other two ceilings, stated once and owned here:
13
+ * 1. the tool's own `resultCeiling` (the AUTHOR's refusal) is judged FIRST,
14
+ * at the execute boundary — a refused result is a short teaching
15
+ * sentence, so placement never sees the payload at all;
16
+ * 2. placement (the OPERATOR's ref-ing) is judged next, on what the
17
+ * after-tool governance chain let through — a rule that already
18
+ * summarized a huge result is measured on what it produced;
19
+ * 3. the agent-level `maxToolResultChars` truncation net runs LAST — with
20
+ * placement on it measures the ticket, so it should now rarely fire.
21
+ *
22
+ * A placed result is a TICKET, not a refusal: declared effects are still
23
+ * judged and procedure steps advance normally — the result ARRIVED; it just
24
+ * travels by reference. The decision is never silent: the mint lands as
25
+ * `agentfootprint.artifacts.minted` (origin joining it to the tool call) and
26
+ * the substitution states itself in the result the model reads.
27
+ *
28
+ * This module is the PURE half — the dial shape, its build-time refusals,
29
+ * the measure rule (shared with both ceilings: strings as-is, everything
30
+ * else `safeStringify`d by the caller), and the substitute composer. The
31
+ * dispatch layer owns the mint and the events.
32
+ */
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.placedToolResult = exports.isPlacedToolResult = exports.placedResultKind = exports.assertArtifactPlacement = void 0;
35
+ /**
36
+ * Refuse a placement dial this library cannot honor, where it is configured
37
+ * — never at the first oversized result of the first run.
38
+ */
39
+ function assertArtifactPlacement(site, placement) {
40
+ if (placement === undefined)
41
+ return;
42
+ const value = placement.maxInlineChars;
43
+ if (!Number.isFinite(value) || !Number.isInteger(value) || value <= 0) {
44
+ throw new Error(`${site}: artifacts.placement.maxInlineChars must be a positive whole number of ` +
45
+ `characters, and ${String(value)} is not one. It is the threshold over which a tool ` +
46
+ `result is checked into the artifact store and the model reads the claim ticket ` +
47
+ `instead. To turn placement OFF, omit \`placement\` — absent means results are never ` +
48
+ `measured and never placed, exactly as before.`);
49
+ }
50
+ }
51
+ 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}`;
58
+ }
59
+ exports.placedResultKind = placedResultKind;
60
+ /** Type guard for consumers reading `tool_end.result` or a tool message. */
61
+ function isPlacedToolResult(value) {
62
+ return (typeof value === 'object' &&
63
+ value !== null &&
64
+ value.placed === true &&
65
+ typeof value.ref === 'string' &&
66
+ typeof value.reason === 'string');
67
+ }
68
+ exports.isPlacedToolResult = isPlacedToolResult;
69
+ /** Compose the ticket from the mint the dispatch layer performed. */
70
+ function placedToolResult(toolName, meta, sizeChars, maxInlineChars) {
71
+ return {
72
+ placed: true,
73
+ ref: meta.ref,
74
+ kind: meta.kind,
75
+ mediaType: meta.mediaType,
76
+ bytes: meta.bytes,
77
+ reason: `${toolName} returned ${sizeChars} chars, over the ${maxInlineChars}-char placement ` +
78
+ `threshold, so the full result was stored as artifact '${meta.ref}' ` +
79
+ `(${meta.kind}) instead of entering this conversation. Route the ref: pass the ` +
80
+ `string '${meta.ref}' to a tool whose argument wants '${meta.kind}', or call ` +
81
+ `present({ ref: '${meta.ref}', as: … }) to hand it to the screen. Do not retype or ` +
82
+ `summarize content you have not read.`,
83
+ };
84
+ }
85
+ exports.placedToolResult = placedToolResult;
86
+ //# sourceMappingURL=placement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placement.js","sourceRoot":"","sources":["../../src/artifacts/placement.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;;;AAeH;;;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,SAAgB,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;AARD,gDAQC;AAED,qEAAqE;AACrE,SAAgB,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;AApBD,4CAoBC"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /**
3
+ * artifacts/present — the hand-to-the-screen verb (Phase 2, Leg 2).
4
+ *
5
+ * `present({ ref, as, label? })` is how the model finishes an analytics
6
+ * answer WITHOUT serializing what the screen will show: it names the ticket
7
+ * (`ref`), the consumer vocabulary for how to render it (`as: 'bar-chart'`,
8
+ * `'table'`, …), and optionally the human title. The framework `head`s the
9
+ * ref under the run's own scope and the RESULT carries a DESCRIPTION
10
+ * SNAPSHOT — `{ kind, mediaType, bytes, label }` — so the claim ticket
11
+ * describes the parcel: a conversation reloaded after the artifact expired
12
+ * can still render an honest placeholder from history alone ("Chart —
13
+ * 'Q3 sales by region' (bar-chart, 41 KB) — expired; re-run to regenerate"),
14
+ * because the snapshot lives INSIDE the tool result, the one thing provider
15
+ * message history keeps typed and durable. Never a blank pane.
16
+ *
17
+ * `as` is deliberately NOT validated against a component registry — that
18
+ * registry is a later phase (the frontend leg); until then the value is
19
+ * stored as data and travels on the `artifacts.presented` event exactly as
20
+ * spoken.
21
+ *
22
+ * This module is the PURE half — the tool's name/schema constants, the
23
+ * snapshot shape, and the resolution over the five-verb port. The tool SHELL
24
+ * (a placeholder whose result the agent loop overwrites — the `skip_step`
25
+ * pattern) lives in core, which is also where the typed
26
+ * `agentfootprint.artifacts.presented` event is emitted. Core wires
27
+ * artifacts; never the reverse.
28
+ */
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.presentArtifact = exports.PRESENT_TOOL_NAME = void 0;
31
+ /**
32
+ * The reserved name of the auto-attached tool. Reserved ONLY when a store is
33
+ * attached (the `read_skill` seam): a storeless agent may keep its own
34
+ * `present`, because the framework attaches nothing there.
35
+ */
36
+ exports.PRESENT_TOOL_NAME = 'present';
37
+ /** How many live refs a miss refusal lists. A lesson, not a catalog. */
38
+ const PRESENT_LIST_LIMIT = 10;
39
+ /** `art_h7Kq… [chart/spec · 41210 bytes · 'Q3 sales']` — one listed ref. */
40
+ function describeRef(meta) {
41
+ return `${meta.ref} [${meta.kind} · ${meta.bytes} bytes${meta.label !== undefined ? ` · '${meta.label}'` : ''}]`;
42
+ }
43
+ /**
44
+ * Resolve one `present` call over the port — ONE law for every dispatch
45
+ * door. `head`, never `get`: presenting is the render-by-ref decision, and
46
+ * the screen pays for the bytes later, under its own identity.
47
+ */
48
+ async function presentArtifact(store, scope, args) {
49
+ const ref = args.ref;
50
+ const as = args.as;
51
+ if (typeof ref !== 'string' || ref.trim().length === 0) {
52
+ return {
53
+ ok: false,
54
+ refusal: `present needs \`ref\` — the art_… ticket of the artifact to hand to the screen. ` +
55
+ `Store the data first (a tool that mints, or the placement threshold), then present ` +
56
+ `its ref.`,
57
+ };
58
+ }
59
+ if (typeof as !== 'string' || as.trim().length === 0) {
60
+ return {
61
+ ok: false,
62
+ refusal: `present needs \`as\` — the consumer vocabulary for how the screen should render ` +
63
+ `'${ref}' (e.g. 'bar-chart', 'table', 'image'). Say what it is; the screen picks ` +
64
+ `the renderer.`,
65
+ };
66
+ }
67
+ const meta = await store.head(scope, ref);
68
+ if (meta === null) {
69
+ const page = await store.list(scope, { limit: PRESENT_LIST_LIMIT });
70
+ const listing = page.artifacts.length === 0
71
+ ? `Nothing is live in this run's scope right now — store the data first, then present ` +
72
+ `its ref.`
73
+ : `Live refs in scope: ${page.artifacts.map(describeRef).join(', ')}.`;
74
+ return {
75
+ ok: false,
76
+ missedRef: ref,
77
+ refusal: `present('${ref}') found nothing under that ref in this run's scope — expired, ` +
78
+ `swept, or never stored here. Nothing was presented. ${listing}`,
79
+ };
80
+ }
81
+ const label = typeof args.label === 'string' && args.label.trim().length > 0 ? args.label : meta.label;
82
+ return {
83
+ ok: true,
84
+ result: {
85
+ presented: true,
86
+ ref: meta.ref,
87
+ as,
88
+ snapshot: {
89
+ kind: meta.kind,
90
+ mediaType: meta.mediaType,
91
+ bytes: meta.bytes,
92
+ ...(label !== undefined && { label }),
93
+ },
94
+ },
95
+ };
96
+ }
97
+ exports.presentArtifact = presentArtifact;
98
+ //# sourceMappingURL=present.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"present.js","sourceRoot":"","sources":["../../src/artifacts/present.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AAIH;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAyC3C,wEAAwE;AACxE,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,4EAA4E;AAC5E,SAAS,WAAW,CAAC,IAAkB;IACrC,OAAO,GAAG,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,KAAK,SAC9C,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EACpD,GAAG,CAAC;AACN,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,eAAe,CACnC,KAAoB,EACpB,KAAoB,EACpB,IAAuC;IAEvC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACrB,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;IACnB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,C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;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,EAAE;YACF,QAAQ,EAAE;gBACR,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;aACtC;SACF;KACF,CAAC;AACJ,CAAC;AAzDD,0CAyDC"}
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ /**
3
+ * artifacts/wants — ref ARGUMENTS at dispatch (Phase 2, Leg 1).
4
+ *
5
+ * A tool declares `wants: { dataset: 'dataset/rows' }` and the FRAMEWORK
6
+ * resolves the ref before `execute`: the model speaks the ~26-char ticket as
7
+ * the argument, dispatch redeems it under the run's own scope and kind-checks
8
+ * the meta, and the handler receives the RESOLVED DATA (plus the meta on
9
+ * `ctx.wanted`). A stale, unknown, or wrong-kind ref NEVER reaches the tool —
10
+ * the model reads a teaching refusal that lists the live refs of the wanted
11
+ * kind in scope (the innerRunRecords law: correct by naming what CAN resolve).
12
+ *
13
+ * The declare-and-push precedent, verb for verb: `needs` resolves a credential
14
+ * before execute and injects `ctx.credential`; `wants` resolves data before
15
+ * execute and injects it into the args. Both fail closed; neither lets the
16
+ * model fabricate what the framework could not deliver.
17
+ *
18
+ * This module is the PURE half — validation at `defineTool` time and
19
+ * resolution over the five-verb port. It never imports `core/`: the
20
+ * tool-dispatch layer composes the scope, adapts the outcome onto the typed
21
+ * `agentfootprint.artifacts.*` events (`op: 'dispatch'`), and refuses the
22
+ * call. Core wires artifacts; never the reverse.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.wantsNeedsStoreRefusal = exports.resolveToolWants = exports.assertToolWants = void 0;
26
+ const types_js_1 = require("./types.js");
27
+ /**
28
+ * Refuse a `wants` declaration this library cannot honor, at definition time
29
+ * — naming the tool and the fix, never at the first dispatch of the first
30
+ * run. Checks, per declared argument:
31
+ * • the kind is a non-empty string (a blank kind can never match a mint);
32
+ * • when the tool's `inputSchema` declares `properties`, the argument
33
+ * exists there (a wants-arg the model is never offered can never be
34
+ * filled);
35
+ * • when that property declares a `type`, it is `'string'` — the model
36
+ * passes the REF, never the bytes, so any other type is a schema that
37
+ * asks the model to inline what this feature exists to keep out.
38
+ */
39
+ function assertToolWants(toolName, wants, inputSchema) {
40
+ if (wants === undefined)
41
+ return;
42
+ const entries = Object.entries(wants);
43
+ if (entries.length === 0) {
44
+ throw new Error(`defineTool: tool '${toolName}' declares wants: {} — an empty declaration resolves ` +
45
+ `nothing and reads as one that does. Name at least one argument ` +
46
+ `(e.g. wants: { dataset: 'dataset/rows' }), or omit \`wants\` — absent means no ` +
47
+ `argument is resolved, exactly as before.`);
48
+ }
49
+ const properties = inputSchema !== undefined &&
50
+ typeof inputSchema.properties === 'object' &&
51
+ inputSchema.properties !== null
52
+ ? inputSchema.properties
53
+ : undefined;
54
+ for (const [argName, kind] of entries) {
55
+ if (typeof kind !== 'string' || kind.trim().length === 0) {
56
+ throw new Error(`defineTool: tool '${toolName}' declares wants.${argName} = ${JSON.stringify(kind)}, ` +
57
+ `which is not an artifact kind. The value is the consumer vocabulary the resolved ` +
58
+ `artifact's meta.kind must equal exactly (e.g. 'dataset/rows').`);
59
+ }
60
+ if (properties !== undefined && !(argName in properties)) {
61
+ throw new Error(`defineTool: tool '${toolName}' declares wants.${argName}, but inputSchema.properties ` +
62
+ `has no '${argName}' — the model is never offered that argument, so no ref could ` +
63
+ `ever arrive to resolve. Add it to inputSchema (type: 'string' — the model passes ` +
64
+ `the art_… ref), or drop it from \`wants\`.`);
65
+ }
66
+ const property = properties?.[argName];
67
+ const declaredType = typeof property === 'object' && property !== null
68
+ ? property.type
69
+ : undefined;
70
+ if (declaredType !== undefined && declaredType !== 'string') {
71
+ throw new Error(`defineTool: tool '${toolName}' declares wants.${argName}, but inputSchema declares ` +
72
+ `that argument as type '${String(declaredType)}'. A wants-argument is spoken as the ` +
73
+ `ref STRING (the model routes the ticket, never the bytes) — declare it ` +
74
+ `{ type: 'string' }.`);
75
+ }
76
+ }
77
+ }
78
+ exports.assertToolWants = assertToolWants;
79
+ /** How many live refs a refusal lists, and how many rows the listing pages
80
+ * through to find them. Bounded — a refusal is a lesson, not a catalog. */
81
+ const LIVE_REF_LIST_LIMIT = 10;
82
+ const LIVE_REF_SCAN_LIMIT = 200;
83
+ /** The live refs of `kind` in scope, newest first, bounded — what a refusal
84
+ * names so the model can correct instead of retrying the same dead ref. */
85
+ async function liveRefsOfKind(store, scope, kind) {
86
+ const found = [];
87
+ let cursor;
88
+ let scanned = 0;
89
+ // Page cap beside the row cap: a misbehaving BYO store that returns empty
90
+ // pages with a never-advancing cursor must not spin this loop forever — the
91
+ // row-based SCAN_LIMIT only advances when pages carry rows.
92
+ let pages = 0;
93
+ do {
94
+ const page = await store.list(scope, { ...(cursor !== undefined && { cursor }) });
95
+ for (const meta of page.artifacts) {
96
+ scanned += 1;
97
+ if (meta.kind === kind)
98
+ found.push(meta);
99
+ if (found.length >= LIVE_REF_LIST_LIMIT || scanned >= LIVE_REF_SCAN_LIMIT)
100
+ return found;
101
+ }
102
+ cursor = page.cursor === cursor ? undefined : page.cursor;
103
+ pages += 1;
104
+ } while (cursor !== undefined && pages < 50);
105
+ return found;
106
+ }
107
+ /** `art_h7Kq… ('Q3 rows', 6100 bytes)` — one listed live ref. */
108
+ function describeLiveRef(meta) {
109
+ return `${meta.ref}${meta.label !== undefined ? ` ('${meta.label}', ${meta.bytes} bytes)` : ` (${meta.bytes} bytes)`}`;
110
+ }
111
+ /** The correcting clause: what CAN resolve, or the honest "nothing can". */
112
+ function liveRefsClause(kind, live) {
113
+ if (live.length === 0) {
114
+ return (`No live '${kind}' artifacts exist in this run's scope right now — produce one first ` +
115
+ `(a tool that stores '${kind}', or re-run the step that minted it).`);
116
+ }
117
+ return `Live '${kind}' refs in scope: ${live
118
+ .map(describeLiveRef)
119
+ .join(', ')}. Pass one of these.`;
120
+ }
121
+ /**
122
+ * Resolve one tool's declared `wants` against the run's scope — the whole
123
+ * Leg-1 law in one place, shared by every dispatch door.
124
+ *
125
+ * Per declared argument that is PRESENT in the call args (an absent optional
126
+ * argument is the model choosing not to pass one — nothing to resolve):
127
+ * • a non-string value is refused (`invalid-input`) — the argument is
128
+ * spoken as the ref string, never the bytes;
129
+ * • a ref that does not resolve in scope is refused
130
+ * (`missing-or-expired`), listing the live refs of the wanted kind;
131
+ * • a ref whose meta.kind differs from the declaration is refused
132
+ * (`kind-mismatch`), naming both kinds and listing what would fit;
133
+ * • a stored payload failing its digest re-check is refused
134
+ * (`digest-mismatch`) — corrupt bytes never reach the tool as if whole.
135
+ *
136
+ * ALL declared args are judged before answering, so one refusal teaches the
137
+ * whole correction rather than one argument per retry loop.
138
+ */
139
+ async function resolveToolWants(store, scope, toolName, wants, args) {
140
+ const refusals = [];
141
+ const wanted = {};
142
+ const resolvedList = [];
143
+ const nextArgs = { ...args };
144
+ for (const [argName, kind] of Object.entries(wants)) {
145
+ if (!(argName in args) || args[argName] === undefined)
146
+ continue;
147
+ const spoken = args[argName];
148
+ if (typeof spoken !== 'string' || spoken.trim().length === 0) {
149
+ const live = await liveRefsOfKind(store, scope, kind);
150
+ refusals.push({
151
+ argName,
152
+ kind,
153
+ reason: 'invalid-input',
154
+ detail: `'${argName}' must be an artifact ref STRING (an art_… ticket), not ` +
155
+ `${Array.isArray(spoken) ? 'an array' : `a ${typeof spoken}`} — this tool declares ` +
156
+ `it wants '${kind}' there and the framework resolves the ref for you; never inline ` +
157
+ `the data. ${liveRefsClause(kind, live)}`,
158
+ });
159
+ continue;
160
+ }
161
+ let record;
162
+ try {
163
+ record = await store.get(scope, spoken);
164
+ }
165
+ catch (err) {
166
+ if (err instanceof types_js_1.ArtifactIntegrityError) {
167
+ refusals.push({
168
+ argName,
169
+ kind,
170
+ reason: 'digest-mismatch',
171
+ ref: spoken,
172
+ detail: `'${argName}' = ${spoken} failed its integrity re-check — the stored payload no ` +
173
+ `longer matches its minted digest, and corrupt bytes are never delivered as ` +
174
+ `whole. Re-create the artifact from its source, then pass the new ref.`,
175
+ });
176
+ continue;
177
+ }
178
+ throw err;
179
+ }
180
+ if (record === null) {
181
+ const live = await liveRefsOfKind(store, scope, kind);
182
+ refusals.push({
183
+ argName,
184
+ kind,
185
+ reason: 'missing-or-expired',
186
+ ref: spoken,
187
+ detail: `'${argName}' = ${spoken} does not resolve in this run's scope — expired, swept, ` +
188
+ `or never stored here. ${liveRefsClause(kind, live)}`,
189
+ });
190
+ continue;
191
+ }
192
+ if (record.meta.kind !== kind) {
193
+ const live = await liveRefsOfKind(store, scope, kind);
194
+ refusals.push({
195
+ argName,
196
+ kind,
197
+ reason: 'kind-mismatch',
198
+ ref: spoken,
199
+ detail: `'${argName}' = ${spoken} resolves, but it is '${record.meta.kind}' and this ` +
200
+ `argument wants '${kind}' — the wrong parcel for this ticket window. ` +
201
+ `${liveRefsClause(kind, live)}`,
202
+ });
203
+ continue;
204
+ }
205
+ nextArgs[argName] = record.data;
206
+ wanted[argName] = record.meta;
207
+ resolvedList.push({ argName, meta: record.meta });
208
+ }
209
+ if (refusals.length > 0) {
210
+ return {
211
+ ok: false,
212
+ refusals,
213
+ refusal: `Tool '${toolName}' was not executed — its declared artifact argument` +
214
+ `${refusals.length > 1 ? 's' : ''} did not resolve. ` +
215
+ refusals.map((r) => r.detail).join(' '),
216
+ };
217
+ }
218
+ return { ok: true, args: nextArgs, wanted, resolved: resolvedList };
219
+ }
220
+ exports.resolveToolWants = resolveToolWants;
221
+ /**
222
+ * The teaching refusal for a `wants`-declaring tool dispatched where NO
223
+ * artifact store is attached — fail-closed, naming the config fix, because
224
+ * running the tool with the raw ref string where it expects resolved data
225
+ * would be accepted-and-silently-wrong. (Agent dispatch refuses this at
226
+ * BUILD for statically registered tools; this sentence serves the doors
227
+ * that only meet the tool at dispatch — provider-served tools, `mcpServe`.)
228
+ */
229
+ function wantsNeedsStoreRefusal(toolName, wants) {
230
+ const declared = Object.entries(wants)
231
+ .map(([arg, kind]) => `${arg}: '${kind}'`)
232
+ .join(', ');
233
+ return (`Tool '${toolName}' declares artifact arguments (wants: { ${declared} }) but no artifact ` +
234
+ `store is attached here, so its refs cannot be resolved and the tool was not executed. ` +
235
+ `This is configuration, not something to retry: attach a store ` +
236
+ `(Agent.create({ ..., artifacts }) — inMemoryArtifacts(), fileArtifacts({ directory }), ` +
237
+ `or sqliteArtifacts({ file })), or serve this tool from an agent that has one.`);
238
+ }
239
+ exports.wantsNeedsStoreRefusal = wantsNeedsStoreRefusal;
240
+ //# sourceMappingURL=wants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wants.js","sourceRoot":"","sources":["../../src/artifacts/wants.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,yCAAoD;AAWpD;;;;;;;;;;;GAWG;AACH,SAAgB,eAAe,CAC7B,QAAgB,EAChB,KAA4B,EAC5B,WAA0D;IAE1D,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,qBAAqB,QAAQ,uDAAuD;YAClF,iEAAiE;YACjE,iFAAiF;YACjF,0CAA0C,CAC7C,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,GACd,WAAW,KAAK,SAAS;QACzB,OAAO,WAAW,CAAC,UAAU,KAAK,QAAQ;QAC1C,WAAW,CAAC,UAAU,KAAK,IAAI;QAC7B,CAAC,CAAE,WAAW,CAAC,UAAgD;QAC/D,CAAC,CAAC,SAAS,CAAC;IAChB,KAAK,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE,CAAC;QACtC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,I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