agentfootprint 9.114.2 → 9.115.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.
Files changed (242) hide show
  1. package/AGENTS.md +205 -528
  2. package/CAPABILITIES.md +3 -0
  3. package/README.md +33 -790
  4. package/ai-instructions/claude-code/SKILL.md +26 -3
  5. package/bin/agentfootprint-lint-tools.mjs +1 -1
  6. package/dist/adapters/hosting/agentCoreA2A.js +5 -0
  7. package/dist/adapters/hosting/agentCoreA2A.js.map +1 -1
  8. package/dist/adapters/hosting/agentcore.js +5 -0
  9. package/dist/adapters/hosting/agentcore.js.map +1 -1
  10. package/dist/adapters/hosting/foundryResponses.js +5 -0
  11. package/dist/adapters/hosting/foundryResponses.js.map +1 -1
  12. package/dist/adapters/observability/agentcore.js +18 -5
  13. package/dist/adapters/observability/agentcore.js.map +1 -1
  14. package/dist/adapters/observability/audit.js +17 -4
  15. package/dist/adapters/observability/audit.js.map +1 -1
  16. package/dist/adapters/observability/otel.js +890 -33
  17. package/dist/adapters/observability/otel.js.map +1 -1
  18. package/dist/artifacts/capability.js +9 -3
  19. package/dist/artifacts/capability.js.map +1 -1
  20. package/dist/bridge/eventMeta.js +40 -1
  21. package/dist/bridge/eventMeta.js.map +1 -1
  22. package/dist/core/Agent.js +40 -6
  23. package/dist/core/Agent.js.map +1 -1
  24. package/dist/core/RunnerBase.js +32 -1
  25. package/dist/core/RunnerBase.js.map +1 -1
  26. package/dist/core/agent/AgentBuilder.js +13 -1
  27. package/dist/core/agent/AgentBuilder.js.map +1 -1
  28. package/dist/core/agent/stages/toolCalls.js +64 -7
  29. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  30. package/dist/core/flowchartAsTool.js +8 -2
  31. package/dist/core/flowchartAsTool.js.map +1 -1
  32. package/dist/core/runbook/runbookAsTool.js +7 -2
  33. package/dist/core/runbook/runbookAsTool.js.map +1 -1
  34. package/dist/core/toolShownArgs.js +55 -0
  35. package/dist/core/toolShownArgs.js.map +1 -0
  36. package/dist/debug.js +1 -1
  37. package/dist/debug.js.map +1 -1
  38. package/dist/esm/adapters/hosting/agentCoreA2A.d.ts +14 -1
  39. package/dist/esm/adapters/hosting/agentCoreA2A.js +5 -0
  40. package/dist/esm/adapters/hosting/agentCoreA2A.js.map +1 -1
  41. package/dist/esm/adapters/hosting/agentcore.d.ts +18 -2
  42. package/dist/esm/adapters/hosting/agentcore.js +5 -0
  43. package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
  44. package/dist/esm/adapters/hosting/foundryResponses.d.ts +15 -1
  45. package/dist/esm/adapters/hosting/foundryResponses.js +5 -0
  46. package/dist/esm/adapters/hosting/foundryResponses.js.map +1 -1
  47. package/dist/esm/adapters/observability/agentcore.d.ts +17 -5
  48. package/dist/esm/adapters/observability/agentcore.js +18 -5
  49. package/dist/esm/adapters/observability/agentcore.js.map +1 -1
  50. package/dist/esm/adapters/observability/audit.d.ts +6 -2
  51. package/dist/esm/adapters/observability/audit.js +17 -4
  52. package/dist/esm/adapters/observability/audit.js.map +1 -1
  53. package/dist/esm/adapters/observability/otel.d.ts +240 -11
  54. package/dist/esm/adapters/observability/otel.js +890 -33
  55. package/dist/esm/adapters/observability/otel.js.map +1 -1
  56. package/dist/esm/artifacts/capability.d.ts +3 -1
  57. package/dist/esm/artifacts/capability.js +9 -3
  58. package/dist/esm/artifacts/capability.js.map +1 -1
  59. package/dist/esm/bridge/eventMeta.d.ts +32 -0
  60. package/dist/esm/bridge/eventMeta.js +38 -0
  61. package/dist/esm/bridge/eventMeta.js.map +1 -1
  62. package/dist/esm/core/Agent.d.ts +18 -5
  63. package/dist/esm/core/Agent.js +42 -8
  64. package/dist/esm/core/Agent.js.map +1 -1
  65. package/dist/esm/core/RunnerBase.d.ts +20 -0
  66. package/dist/esm/core/RunnerBase.js +32 -1
  67. package/dist/esm/core/RunnerBase.js.map +1 -1
  68. package/dist/esm/core/agent/AgentBuilder.js +13 -1
  69. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  70. package/dist/esm/core/agent/stages/toolCalls.d.ts +11 -0
  71. package/dist/esm/core/agent/stages/toolCalls.js +64 -7
  72. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  73. package/dist/esm/core/flowchartAsTool.js +8 -2
  74. package/dist/esm/core/flowchartAsTool.js.map +1 -1
  75. package/dist/esm/core/runbook/runbookAsTool.js +7 -2
  76. package/dist/esm/core/runbook/runbookAsTool.js.map +1 -1
  77. package/dist/esm/core/toolShownArgs.d.ts +62 -0
  78. package/dist/esm/core/toolShownArgs.js +49 -0
  79. package/dist/esm/core/toolShownArgs.js.map +1 -0
  80. package/dist/esm/core-flow/Parallel.d.ts +1 -1
  81. package/dist/esm/debug.js +1 -1
  82. package/dist/esm/debug.js.map +1 -1
  83. package/dist/esm/events/payloads.d.ts +122 -6
  84. package/dist/esm/events/registry.d.ts +3 -1
  85. package/dist/esm/events/registry.js +2 -0
  86. package/dist/esm/events/registry.js.map +1 -1
  87. package/dist/esm/events/types.d.ts +7 -0
  88. package/dist/esm/hosting/artifactWire.d.ts +10 -2
  89. package/dist/esm/hosting/artifactWire.js +20 -2
  90. package/dist/esm/hosting/artifactWire.js.map +1 -1
  91. package/dist/esm/hosting/doorGuard.d.ts +280 -0
  92. package/dist/esm/hosting/doorGuard.js +499 -0
  93. package/dist/esm/hosting/doorGuard.js.map +1 -0
  94. package/dist/esm/hosting/errors.d.ts +113 -0
  95. package/dist/esm/hosting/errors.js +177 -0
  96. package/dist/esm/hosting/errors.js.map +1 -1
  97. package/dist/esm/hosting/httpHost.d.ts +32 -3
  98. package/dist/esm/hosting/httpHost.js +218 -4
  99. package/dist/esm/hosting/httpHost.js.map +1 -1
  100. package/dist/esm/hosting/index.d.ts +7 -5
  101. package/dist/esm/hosting/index.js +10 -3
  102. package/dist/esm/hosting/index.js.map +1 -1
  103. package/dist/esm/hosting/ingressRecord.d.ts +64 -10
  104. package/dist/esm/hosting/ingressRecord.js +65 -6
  105. package/dist/esm/hosting/ingressRecord.js.map +1 -1
  106. package/dist/esm/hosting/nodeHost.d.ts +32 -2
  107. package/dist/esm/hosting/nodeHost.js +10 -0
  108. package/dist/esm/hosting/nodeHost.js.map +1 -1
  109. package/dist/esm/hosting/standingAgent.js +362 -51
  110. package/dist/esm/hosting/standingAgent.js.map +1 -1
  111. package/dist/esm/hosting/turnArtifacts.d.ts +93 -0
  112. package/dist/esm/hosting/turnArtifacts.js +126 -0
  113. package/dist/esm/hosting/turnArtifacts.js.map +1 -0
  114. package/dist/esm/hosting/types.d.ts +196 -3
  115. package/dist/esm/hosting/types.js +10 -0
  116. package/dist/esm/hosting/types.js.map +1 -1
  117. package/dist/esm/hosting/webSocketConversation.d.ts +15 -1
  118. package/dist/esm/hosting/webSocketConversation.js +54 -2
  119. package/dist/esm/hosting/webSocketConversation.js.map +1 -1
  120. package/dist/esm/integrity/disposition/ledger.d.ts +8 -0
  121. package/dist/esm/integrity/disposition/ledger.js +0 -0
  122. package/dist/esm/integrity/disposition/ledger.js.map +1 -1
  123. package/dist/esm/lib/mcp/mcpServe.js +39 -2
  124. package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
  125. package/dist/esm/lib/mcp/types.d.ts +30 -0
  126. package/dist/esm/lib/tool-lint/index.d.ts +1 -1
  127. package/dist/esm/lib/tool-lint/index.js +1 -1
  128. package/dist/esm/recorders/observability/commentary/artifactPhrases.d.ts +4 -0
  129. package/dist/esm/recorders/observability/commentary/artifactPhrases.js +9 -0
  130. package/dist/esm/recorders/observability/commentary/artifactPhrases.js.map +1 -1
  131. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +30 -3
  132. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  133. package/dist/esm/recorders/observability/recordRun.d.ts +12 -0
  134. package/dist/esm/recorders/observability/recordRun.js +17 -1
  135. package/dist/esm/recorders/observability/recordRun.js.map +1 -1
  136. package/dist/esm/strategies/attach.js +87 -1
  137. package/dist/esm/strategies/attach.js.map +1 -1
  138. package/dist/events/registry.js +2 -0
  139. package/dist/events/registry.js.map +1 -1
  140. package/dist/hosting/artifactWire.js +21 -3
  141. package/dist/hosting/artifactWire.js.map +1 -1
  142. package/dist/hosting/doorGuard.js +509 -0
  143. package/dist/hosting/doorGuard.js.map +1 -0
  144. package/dist/hosting/errors.js +183 -1
  145. package/dist/hosting/errors.js.map +1 -1
  146. package/dist/hosting/httpHost.js +218 -4
  147. package/dist/hosting/httpHost.js.map +1 -1
  148. package/dist/hosting/index.js +19 -2
  149. package/dist/hosting/index.js.map +1 -1
  150. package/dist/hosting/ingressRecord.js +66 -6
  151. package/dist/hosting/ingressRecord.js.map +1 -1
  152. package/dist/hosting/nodeHost.js +11 -1
  153. package/dist/hosting/nodeHost.js.map +1 -1
  154. package/dist/hosting/standingAgent.js +359 -48
  155. package/dist/hosting/standingAgent.js.map +1 -1
  156. package/dist/hosting/turnArtifacts.js +130 -0
  157. package/dist/hosting/turnArtifacts.js.map +1 -0
  158. package/dist/hosting/types.js +11 -1
  159. package/dist/hosting/types.js.map +1 -1
  160. package/dist/hosting/webSocketConversation.js +54 -2
  161. package/dist/hosting/webSocketConversation.js.map +1 -1
  162. package/dist/integrity/disposition/ledger.js +0 -0
  163. package/dist/integrity/disposition/ledger.js.map +1 -1
  164. package/dist/lib/mcp/mcpServe.js +39 -2
  165. package/dist/lib/mcp/mcpServe.js.map +1 -1
  166. package/dist/lib/tool-lint/index.js +1 -1
  167. package/dist/recorders/observability/commentary/artifactPhrases.js +10 -1
  168. package/dist/recorders/observability/commentary/artifactPhrases.js.map +1 -1
  169. package/dist/recorders/observability/commentary/commentaryTemplates.js +29 -2
  170. package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  171. package/dist/recorders/observability/recordRun.js +20 -3
  172. package/dist/recorders/observability/recordRun.js.map +1 -1
  173. package/dist/strategies/attach.js +87 -1
  174. package/dist/strategies/attach.js.map +1 -1
  175. package/dist/types/adapters/hosting/agentCoreA2A.d.ts +14 -1
  176. package/dist/types/adapters/hosting/agentCoreA2A.d.ts.map +1 -1
  177. package/dist/types/adapters/hosting/agentcore.d.ts +18 -2
  178. package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
  179. package/dist/types/adapters/hosting/foundryResponses.d.ts +15 -1
  180. package/dist/types/adapters/hosting/foundryResponses.d.ts.map +1 -1
  181. package/dist/types/adapters/observability/agentcore.d.ts +17 -5
  182. package/dist/types/adapters/observability/agentcore.d.ts.map +1 -1
  183. package/dist/types/adapters/observability/audit.d.ts +6 -2
  184. package/dist/types/adapters/observability/audit.d.ts.map +1 -1
  185. package/dist/types/adapters/observability/otel.d.ts +240 -11
  186. package/dist/types/adapters/observability/otel.d.ts.map +1 -1
  187. package/dist/types/artifacts/capability.d.ts +3 -1
  188. package/dist/types/artifacts/capability.d.ts.map +1 -1
  189. package/dist/types/bridge/eventMeta.d.ts +32 -0
  190. package/dist/types/bridge/eventMeta.d.ts.map +1 -1
  191. package/dist/types/core/Agent.d.ts +18 -5
  192. package/dist/types/core/Agent.d.ts.map +1 -1
  193. package/dist/types/core/RunnerBase.d.ts +20 -0
  194. package/dist/types/core/RunnerBase.d.ts.map +1 -1
  195. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  196. package/dist/types/core/agent/stages/toolCalls.d.ts +11 -0
  197. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  198. package/dist/types/core/flowchartAsTool.d.ts.map +1 -1
  199. package/dist/types/core/runbook/runbookAsTool.d.ts.map +1 -1
  200. package/dist/types/core/toolShownArgs.d.ts +63 -0
  201. package/dist/types/core/toolShownArgs.d.ts.map +1 -0
  202. package/dist/types/core-flow/Parallel.d.ts +1 -1
  203. package/dist/types/events/payloads.d.ts +122 -6
  204. package/dist/types/events/payloads.d.ts.map +1 -1
  205. package/dist/types/events/registry.d.ts +3 -1
  206. package/dist/types/events/registry.d.ts.map +1 -1
  207. package/dist/types/events/types.d.ts +7 -0
  208. package/dist/types/events/types.d.ts.map +1 -1
  209. package/dist/types/hosting/artifactWire.d.ts +10 -2
  210. package/dist/types/hosting/artifactWire.d.ts.map +1 -1
  211. package/dist/types/hosting/doorGuard.d.ts +281 -0
  212. package/dist/types/hosting/doorGuard.d.ts.map +1 -0
  213. package/dist/types/hosting/errors.d.ts +113 -0
  214. package/dist/types/hosting/errors.d.ts.map +1 -1
  215. package/dist/types/hosting/httpHost.d.ts +32 -3
  216. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  217. package/dist/types/hosting/index.d.ts +7 -5
  218. package/dist/types/hosting/index.d.ts.map +1 -1
  219. package/dist/types/hosting/ingressRecord.d.ts +64 -10
  220. package/dist/types/hosting/ingressRecord.d.ts.map +1 -1
  221. package/dist/types/hosting/nodeHost.d.ts +32 -2
  222. package/dist/types/hosting/nodeHost.d.ts.map +1 -1
  223. package/dist/types/hosting/standingAgent.d.ts.map +1 -1
  224. package/dist/types/hosting/turnArtifacts.d.ts +94 -0
  225. package/dist/types/hosting/turnArtifacts.d.ts.map +1 -0
  226. package/dist/types/hosting/types.d.ts +196 -3
  227. package/dist/types/hosting/types.d.ts.map +1 -1
  228. package/dist/types/hosting/webSocketConversation.d.ts +15 -1
  229. package/dist/types/hosting/webSocketConversation.d.ts.map +1 -1
  230. package/dist/types/integrity/disposition/ledger.d.ts +8 -0
  231. package/dist/types/integrity/disposition/ledger.d.ts.map +1 -1
  232. package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
  233. package/dist/types/lib/mcp/types.d.ts +30 -0
  234. package/dist/types/lib/mcp/types.d.ts.map +1 -1
  235. package/dist/types/lib/tool-lint/index.d.ts +1 -1
  236. package/dist/types/recorders/observability/commentary/artifactPhrases.d.ts +4 -0
  237. package/dist/types/recorders/observability/commentary/artifactPhrases.d.ts.map +1 -1
  238. package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
  239. package/dist/types/recorders/observability/recordRun.d.ts +12 -0
  240. package/dist/types/recorders/observability/recordRun.d.ts.map +1 -1
  241. package/dist/types/strategies/attach.d.ts.map +1 -1
  242. package/package.json +1 -1
@@ -100,16 +100,20 @@
100
100
  */
101
101
  Object.defineProperty(exports, "__esModule", { value: true });
102
102
  exports.standingAgent = void 0;
103
+ const footprintjs_1 = require("footprintjs");
103
104
  const capability_js_1 = require("../artifacts/capability.js");
104
105
  const askComponent_js_1 = require("../core/askComponent.js");
105
106
  const inputRequest_js_1 = require("../core/inputRequest.js");
106
107
  const pause_js_1 = require("../core/pause.js");
108
+ const artifactWire_js_1 = require("./artifactWire.js");
109
+ const naming_js_1 = require("../artifacts/naming.js");
107
110
  const durability_js_1 = require("./durability.js");
108
111
  const envelope_js_1 = require("./envelope.js");
109
112
  const errors_js_1 = require("./errors.js");
110
113
  const identityVerification_js_1 = require("./identityVerification.js");
111
114
  const admission_js_1 = require("./admission.js");
112
115
  const ingressRecord_js_1 = require("./ingressRecord.js");
116
+ const turnArtifacts_js_1 = require("./turnArtifacts.js");
113
117
  const sessionWire_js_1 = require("./sessionWire.js");
114
118
  const types_js_1 = require("./types.js");
115
119
  /**
@@ -221,6 +225,16 @@ async function standingAgent(options) {
221
225
  `uses the one instance you passed. Drop it, or switch to 'agentFactory' to get ` +
222
226
  `the per-session pool it describes.`);
223
227
  }
228
+ // A bound on the artifact hand-over that could never fire is not a bound —
229
+ // and a hand-over that may hold a lane forever is the outage it exists to
230
+ // prevent. Refused here, before a socket exists.
231
+ const turnArtifactsTimeoutMs = options.turnArtifactsTimeoutMs ?? types_js_1.TURN_ARTIFACTS_TIMEOUT_MS;
232
+ if (!Number.isFinite(turnArtifactsTimeoutMs) || turnArtifactsTimeoutMs <= 0) {
233
+ throw new Error(`[hosting] standingAgent was given turnArtifactsTimeoutMs: ${String(options.turnArtifactsTimeoutMs)}. It is how long a turn's artifact hand-over (reply.turnArtifacts) may hold the ` +
234
+ `reply, so it has to be a positive, finite number of milliseconds — a bound that ` +
235
+ `can never fire would let one host's hung store hold every other session. Drop it ` +
236
+ `for the default (${types_js_1.TURN_ARTIFACTS_TIMEOUT_MS} ms).`);
237
+ }
224
238
  const maxActiveSessions = options.maxActiveSessions ?? types_js_1.DEFAULT_MAX_ACTIVE_SESSIONS;
225
239
  if (factory !== undefined && (!Number.isInteger(maxActiveSessions) || maxActiveSessions < 1)) {
226
240
  throw new Error(`[hosting] standingAgent was given maxActiveSessions: ${String(options.maxActiveSessions)}. ` +
@@ -527,7 +541,7 @@ async function standingAgent(options) {
527
541
  // "concurrent run", and must not make the turn wait either.
528
542
  if (identified.artifact !== undefined) {
529
543
  try {
530
- await answerArtifact(identified.artifact, identified, reply);
544
+ await answerArtifact(identified.artifact, identified, verified, reply);
531
545
  }
532
546
  catch (err) {
533
547
  reply.fail(err instanceof Error ? err : new Error(String(err)));
@@ -578,7 +592,7 @@ async function standingAgent(options) {
578
592
  ledger.admit(spendKey);
579
593
  }
580
594
  const lane = laneFor(sessionId);
581
- await serialize(lane, sessionKey, () => answerOne(lane, sessions, identified, reply, sessionId, verified, spendKey), queueAnyway);
595
+ await serialize(lane, sessionKey, () => answerOne(lane, sessions, identified, reply, sessionId, verified, spendKey, note), queueAnyway);
582
596
  }
583
597
  catch (err) {
584
598
  reply.fail(err instanceof Error ? err : new Error(String(err)));
@@ -700,13 +714,17 @@ async function standingAgent(options) {
700
714
  *
701
715
  * ── The scope is the run's own, re-composed — one isolation rule ────────
702
716
  * A ref is redeemed under EXACTLY the scope the run's tools minted it in:
703
- * `identityForRequest(userId, sessionId, storedIdentity)` when the request
704
- * names a user — the same call, on the same inputs, that composed the run's
705
- * identity — else the session rung `{ conversationId: sessionId }` (what
706
- * seed derives for an identity-less served run). No new spelling exists to
707
- * drift. The stored identity is read only when a `userId` arrived (it is
708
- * the only rung that needs the stored tenant/conversation tuple), through
709
- * the same wake → hydrate → refuse-unreadable steps a turn takes.
717
+ * `sessionArtifactScope(userId, sessionId, storedIdentity)` — the same
718
+ * function a turn's hand-over (`reply.turnArtifacts`) is bound with, so a
719
+ * host's filing and this redemption compose one tuple from the same inputs
720
+ * for the same caller. It is `identityForRequest` when the request names a
721
+ * user — the same call, on the same inputs, that composed the run's
722
+ * identity — else the session rung
723
+ * `{ conversationId: sessionId }` (what seed derives for an identity-less
724
+ * served run). No new spelling exists to drift. The stored identity is read
725
+ * only when a `userId` arrived (it is the only rung that needs the stored
726
+ * tenant/conversation tuple), through the same wake → hydrate →
727
+ * refuse-unreadable steps a turn takes.
710
728
  *
711
729
  * A ref from another session — or a right session presented with the wrong
712
730
  * identity — composes a different tuple, and the store answers a wrong
@@ -722,10 +740,29 @@ async function standingAgent(options) {
722
740
  * hosting door, and a phantom tool name would be an actor that does not
723
741
  * exist.
724
742
  *
743
+ * ── Nothing a stranger chose reaches the record ──────────────────────────
744
+ * Every fact this door emits is stamped with the session the request NAMED
745
+ * (`emitArtifactFact`), and that stamp decides which run's recording keeps
746
+ * it (`eventBelongsToRun`). So the door checks, before it emits anything or
747
+ * builds a lane:
748
+ *
749
+ * 1. **The ref's shape** (`isArtifactRef`) — free text posing as a ref would
750
+ * be text written into a live recording (the wire readers refuse it too;
751
+ * this covers a host that builds `HostRequest.artifact` itself).
752
+ * 2. **At a verifying door, ownership** — the turn door's own rule
753
+ * (`mayOpenSession`) for a stored conversation; for one whose FIRST turn
754
+ * is still in flight (nothing stored yet), only the caller that turn is
755
+ * serving. Anyone else gets the ONE not-found, and nothing is emitted —
756
+ * a stranger can neither write into another person's recording nor flood
757
+ * it until its own events are evicted.
758
+ *
759
+ * At a door with no verifier the session id IS the key, by law: whoever
760
+ * presents it may redeem under it, and its facts are that session's.
761
+ *
725
762
  * Zero-cost when unused: an agent without a store answers with the teaching
726
763
  * refusal naming the attach, and nothing else in the composer changes.
727
764
  */
728
- async function answerArtifact(op, request, reply) {
765
+ async function answerArtifact(op, request, verified, reply) {
729
766
  const sessionId = request.sessionId;
730
767
  if (sessionId === undefined) {
731
768
  // An anonymous run scopes its artifacts to its own runId — a name no
@@ -735,6 +772,18 @@ async function standingAgent(options) {
735
772
  reply.fail(new errors_js_1.ArtifactSessionRequiredError(op.op));
736
773
  return;
737
774
  }
775
+ if (!(0, naming_js_1.isArtifactRef)(op.ref)) {
776
+ reply.fail(new errors_js_1.InvalidWireOpError(`'artifact-${op.op}' ${artifactWire_js_1.NOT_A_REF}`));
777
+ return;
778
+ }
779
+ // Read the stored conversation once: its OWNER (a verifying door) and its
780
+ // identity tuple (any request naming a user) both come from it.
781
+ const needsStored = identityOptions !== undefined || request.userId !== undefined;
782
+ const envelope = needsStored ? await storedFor(sessionId) : undefined;
783
+ if (identityOptions !== undefined && !mayRedeemFrom(sessionId, envelope, verified)) {
784
+ reply.fail(new errors_js_1.ArtifactNotFoundError(op.ref));
785
+ return;
786
+ }
738
787
  const lane = laneFor(sessionId);
739
788
  // Admitted for the duration: a lane with work is never evicted, and a
740
789
  // resolution mid-flight is work — retiring the instance under it would
@@ -746,26 +795,17 @@ async function standingAgent(options) {
746
795
  // The fail-closed law at the wire: the refusal lands on the record
747
796
  // (`no-store`, the same reason `ctx.artifacts` teaches with) and the
748
797
  // reply names the attach.
749
- emitArtifactFact(lane.agent, {
750
- type: 'refused',
751
- op: op.op,
752
- reason: 'no-store',
753
- ref: op.ref,
754
- });
798
+ emitArtifactFact(lane.agent, { type: 'refused', op: op.op, reason: 'no-store', ref: op.ref }, { sessionId });
755
799
  reply.fail(new errors_js_1.NoArtifactStoreError(op.op));
756
800
  return;
757
801
  }
758
802
  let stored;
759
- if (request.userId !== undefined) {
760
- await sessions.onWake?.(sessionId, 'artifact');
803
+ if (request.userId !== undefined && envelope !== undefined) {
761
804
  try {
762
- const envelope = await sessions.hydrate(sessionId);
763
- if (envelope !== undefined) {
764
- stored =
765
- envelope.format === 'flowchart-v1'
766
- ? (0, envelope_js_1.readPausedRun)(envelope).conversation.identity
767
- : (0, envelope_js_1.readEnvelope)(envelope).identity;
768
- }
805
+ stored =
806
+ envelope.format === 'flowchart-v1'
807
+ ? (0, envelope_js_1.readPausedRun)(envelope).conversation.identity
808
+ : (0, envelope_js_1.readEnvelope)(envelope).identity;
769
809
  }
770
810
  catch (err) {
771
811
  // The same law as a turn: an unreadable stored conversation is a
@@ -774,11 +814,9 @@ async function standingAgent(options) {
774
814
  throw err instanceof errors_js_1.UnreadableEnvelopeError ? err.withSession(sessionId) : err;
775
815
  }
776
816
  }
777
- const scope = identityForRequest(request.userId, sessionId, stored) ?? {
778
- conversationId: sessionId,
779
- };
817
+ const scope = sessionArtifactScope(request.userId, sessionId, stored);
780
818
  const bound = (0, capability_js_1.bindArtifacts)(store, scope, {
781
- onEvent: (fact) => emitArtifactFact(lane.agent, fact),
819
+ onEvent: (fact) => emitArtifactFact(lane.agent, fact, { sessionId }),
782
820
  });
783
821
  if (op.op === 'head') {
784
822
  const meta = await bound.head(op.ref);
@@ -805,6 +843,34 @@ async function standingAgent(options) {
805
843
  lane.lastUsedMs = Date.now();
806
844
  }
807
845
  }
846
+ /** The stored conversation for a redemption — woken and hydrated the way a
847
+ * turn does it, the unreadable-envelope law included. */
848
+ async function storedFor(sessionId) {
849
+ await sessions.onWake?.(sessionId, 'artifact');
850
+ try {
851
+ return await sessions.hydrate(sessionId);
852
+ }
853
+ catch (err) {
854
+ throw err instanceof errors_js_1.UnreadableEnvelopeError ? err.withSession(sessionId) : err;
855
+ }
856
+ }
857
+ /**
858
+ * May this caller redeem under `sessionId` at a VERIFYING door?
859
+ *
860
+ * A stored conversation answers with the turn door's own rule
861
+ * (`mayOpenSession`) — asked leniently, before any strict reader, for the
862
+ * same reason the turn door asks it first. With nothing stored yet the only
863
+ * conversation that can hold artifacts is one whose FIRST turn is in flight
864
+ * right now (a chart presented mid-turn), and then only the caller that turn
865
+ * is serving may redeem. Read from the lane WITHOUT building one: a refused
866
+ * caller never makes the pool grow or evict.
867
+ */
868
+ function mayRedeemFrom(sessionId, envelope, verified) {
869
+ if (envelope !== undefined)
870
+ return mayOpenSession(envelope, verified);
871
+ const serving = shared ?? pool.get(sessionId);
872
+ return serving?.activeSessionId === sessionId && serving.activeOwner === verified?.userId;
873
+ }
808
874
  /**
809
875
  * Whose conversation is this — and may THIS caller open it? (9.26.0)
810
876
  *
@@ -865,12 +931,13 @@ async function standingAgent(options) {
865
931
  return true;
866
932
  return (0, envelope_js_1.envelopeOwner)(stored) === verified?.userId;
867
933
  }
868
- async function answerOne(lane, store, request, reply, sessionId, verified, spendKey) {
934
+ async function answerOne(lane, store, request, reply, sessionId, verified, spendKey, note) {
869
935
  const runner = lane.agent;
870
936
  lane.activeReply = reply;
871
937
  // The writer only ever writes for the run it is inside; an anonymous
872
938
  // request has nowhere to write to and gets nothing.
873
939
  lane.activeSessionId = sessionId;
940
+ lane.activeOwner = verified?.userId;
874
941
  // Whose usage this lane's next token and cost events belong to. Set only
875
942
  // with an admission policy; the subscriptions that read it do not exist
876
943
  // otherwise.
@@ -943,6 +1010,24 @@ async function standingAgent(options) {
943
1010
  // produces `undefined` here and every earlier release's behaviour is
944
1011
  // unchanged.
945
1012
  const identity = identityForRequest(request.userId, sessionId, prior?.identity ?? paused?.conversation.identity);
1013
+ // What this turn offers a host that files its own artifacts
1014
+ // (`reply.turnArtifacts`): WHERE its claim tickets are redeemed — the one
1015
+ // composition the artifact door re-composes for the same caller, built
1016
+ // only if a host asks — and where a hook failure is recorded. No session,
1017
+ // no scope: nothing a later request presents could ever redeem an
1018
+ // anonymous run's artifacts, so there is nothing to bind.
1019
+ const stored = prior?.identity ?? paused?.conversation.identity;
1020
+ const offer = {
1021
+ ...(sessionId !== undefined && {
1022
+ session: {
1023
+ id: sessionId,
1024
+ scope: () => sessionArtifactScope(request.userId, sessionId, stored),
1025
+ },
1026
+ }),
1027
+ timeoutMs: turnArtifactsTimeoutMs,
1028
+ ...(request.signal !== undefined && { signal: request.signal }),
1029
+ note,
1030
+ };
946
1031
  const runOptions = request.signal !== undefined || sessionId !== undefined || identity !== undefined
947
1032
  ? {
948
1033
  ...(request.signal !== undefined && { env: { signal: request.signal } }),
@@ -998,11 +1083,14 @@ async function standingAgent(options) {
998
1083
  runner.abandonPause();
999
1084
  if (sessionId !== undefined)
1000
1085
  await runner.closeToolSessions({ scope: 'run', sessionId });
1086
+ // A turn that ends, so the host is offered its binding like any
1087
+ // other — but no run happened, so there is no run id to stamp.
1088
+ await offerTurnArtifacts(runner, reply, offer, () => undefined);
1001
1089
  reply.complete(output);
1002
1090
  return;
1003
1091
  }
1004
1092
  }
1005
- await deliver(lane, await runner.resume(paused.checkpoint, request.decision, runOptions), store, reply, sessionId, paused);
1093
+ await deliver(lane, await runner.resume(paused.checkpoint, request.decision, runOptions), store, reply, sessionId, offer, paused);
1006
1094
  return;
1007
1095
  }
1008
1096
  if (paused && sessionId !== undefined) {
@@ -1014,7 +1102,7 @@ async function standingAgent(options) {
1014
1102
  const output = prior
1015
1103
  ? await runner.run({ message: request.input, continueFrom: prior }, runOptions)
1016
1104
  : await runner.run({ message: request.input }, runOptions);
1017
- await deliver(lane, output, store, reply, sessionId);
1105
+ await deliver(lane, output, store, reply, sessionId, offer);
1018
1106
  }
1019
1107
  catch (err) {
1020
1108
  // A run that threw still has to drain. A write left in flight would race
@@ -1028,11 +1116,12 @@ async function standingAgent(options) {
1028
1116
  finally {
1029
1117
  lane.activeReply = undefined;
1030
1118
  lane.activeSessionId = undefined;
1119
+ lane.activeOwner = undefined;
1031
1120
  lane.activeSpendKey = undefined;
1032
1121
  }
1033
1122
  }
1034
1123
  /** Store what the run left behind, then end the reply with the right terminal. */
1035
- async function deliver(lane, output, store, reply, sessionId, priorPause) {
1124
+ async function deliver(lane, output, store, reply, sessionId, offer, priorPause) {
1036
1125
  const runner = lane.agent;
1037
1126
  // Mid-run writes settle FIRST. Ordering, not tidiness: an 'async' write
1038
1127
  // still in flight would otherwise land after the terminal envelope and
@@ -1053,6 +1142,13 @@ async function standingAgent(options) {
1053
1142
  if (sessionId !== undefined && conversation) {
1054
1143
  await store.persist(sessionId, (0, envelope_js_1.toPausedEnvelope)({ checkpoint: output.checkpoint, conversation, pending }));
1055
1144
  if (reply.awaiting) {
1145
+ // The run id for `origin` comes from the conversation just
1146
+ // snapshotted. When that is the PRIOR pause's — re-used because
1147
+ // the same question is still open, which is what a partial answer
1148
+ // does WITHOUT running anything — no origin is stamped: this
1149
+ // request ran nothing, and the instance's last run may be another
1150
+ // session's. Absent is never wrong; a borrowed run id would be.
1151
+ await offerTurnArtifacts(runner, reply, offer, () => conversation === priorPause?.conversation ? undefined : conversation?.runId);
1056
1152
  reply.awaiting(pending);
1057
1153
  return;
1058
1154
  }
@@ -1087,17 +1183,37 @@ async function standingAgent(options) {
1087
1183
  runner.abandonPause();
1088
1184
  }
1089
1185
  }
1186
+ let conversation;
1090
1187
  if (sessionId !== undefined) {
1091
- const conversation = runner.checkpoint();
1188
+ conversation = runner.checkpoint();
1092
1189
  // Persist BEFORE answering: the caller learns the answer only once the
1093
1190
  // conversation that produced it is durable, so a queued next turn can
1094
1191
  // never read state older than the answer already given.
1095
1192
  if (conversation)
1096
1193
  await store.persist(sessionId, (0, envelope_js_1.toEnvelope)(conversation));
1097
1194
  }
1195
+ // The snapshot just persisted names the run that answered — the same id
1196
+ // the run's own recording carries on its `origin` — so stamping a host's
1197
+ // filing costs no second snapshot.
1198
+ await offerTurnArtifacts(runner, reply, offer, () => conversation?.runId);
1098
1199
  reply.complete(typeof output === 'string' ? output : String(output));
1099
1200
  }
1100
- const handle = await host.serve(handler);
1201
+ // The HOST's own refusals — a forged request its door guard turned away, a
1202
+ // session id over the bound — never reach `handler`, so they would never
1203
+ // reach the record either. Subscribed only when a sink is set (the zero-delta
1204
+ // path stays zero), and only on a host that reports them (feature-detected).
1205
+ // Before `serve`, so a refusal in the first instant of serving is not lost.
1206
+ const stopHostRefusals = ingressSink !== undefined && typeof host.onRefusal === 'function'
1207
+ ? host.onRefusal((refusal) => (0, ingressRecord_js_1.recordHostRefusal)(refusal, ingressSink))
1208
+ : undefined;
1209
+ let handle;
1210
+ try {
1211
+ handle = await host.serve(handler);
1212
+ }
1213
+ catch (err) {
1214
+ stopHostRefusals?.();
1215
+ throw err;
1216
+ }
1101
1217
  // ── Shutdown ────────────────────────────────────────────────────────
1102
1218
  //
1103
1219
  // Telemetry drains on close, because a batching exporter that loses its
@@ -1124,6 +1240,7 @@ async function standingAgent(options) {
1124
1240
  function closeOnce() {
1125
1241
  closing ??= (async () => {
1126
1242
  await handle.close();
1243
+ stopHostRefusals?.();
1127
1244
  if (shared !== undefined) {
1128
1245
  shared.detach();
1129
1246
  if (shutdownMode !== 'none') {
@@ -1220,6 +1337,165 @@ function identityForRequest(userId, sessionId, stored) {
1220
1337
  principal: userId,
1221
1338
  };
1222
1339
  }
1340
+ /**
1341
+ * The scope a SESSION's claim tickets live in, for the request being served —
1342
+ * the ONE composition of that tuple, shared by the two doors that need it.
1343
+ *
1344
+ * `answerArtifact` redeems under it, and a turn hands its host a store bound
1345
+ * to it (`reply.turnArtifacts`). One function rather than two call sites that
1346
+ * agree today: the field bug this exists for was a host that composed its own
1347
+ * tuple, got the session rung right and the signed-in rung wrong, and filed
1348
+ * every ticket where redemption would never look. Deliberately NOT exported —
1349
+ * a function a host can call with a user id is a function a host can call
1350
+ * with SOMEBODY ELSE's user id.
1351
+ *
1352
+ * `identityForRequest` when the request names a user, else the session rung
1353
+ * `{ conversationId: sessionId }` — what seed derives for an identity-less
1354
+ * served run.
1355
+ */
1356
+ function sessionArtifactScope(userId, sessionId, stored) {
1357
+ return identityForRequest(userId, sessionId, stored) ?? { conversationId: sessionId };
1358
+ }
1359
+ /**
1360
+ * Hand this turn's binding to a host that asked for it — AWAITED while the
1361
+ * session's lane is still held, BOUNDED, immediately before the turn's
1362
+ * terminal.
1363
+ *
1364
+ * Four guarantees, each one a finding an earlier cut of this seam failed:
1365
+ *
1366
+ * - **Inside the turn.** The composer awaits the hook here, so a host files
1367
+ * while no other run can be in flight on this instance.
1368
+ * - **Bounded.** The hook and every operation it started race ONE deadline
1369
+ * (`turnArtifactsTimeoutMs`) and the request's signal. Whichever ends the
1370
+ * wait, the binding is revoked, nothing in flight is cancelled (it may
1371
+ * still land — its facts name their own session and run, so they cannot
1372
+ * enter anyone else's record), the cause is reported and the terminal is
1373
+ * delivered — so one host's hung store or hook can hold neither every other
1374
+ * session (the shared shape), nor a pooled lane, nor `close()`.
1375
+ * - **Never the terminal's decision, never silent.** A hook that throws, an
1376
+ * operation that fails, the bound, the abort and a call after the turn are
1377
+ * reported (`turnArtifactsFailed`) and the terminal is delivered anyway.
1378
+ * - **Revoked when the turn ends.** A verb called later is refused by name
1379
+ * (`TurnArtifactsExpiredError`), already handled, and reported.
1380
+ *
1381
+ * A host without the hook gets nothing built: no binding, no scope, no store
1382
+ * lookup, no run-id read, no timer.
1383
+ */
1384
+ async function offerTurnArtifacts(agent, reply, offer, runIdOf) {
1385
+ if (reply.turnArtifacts === undefined)
1386
+ return;
1387
+ const session = offer.session;
1388
+ // WHOSE facts these are, captured NOW — the binding owns "whose run", never
1389
+ // the agent's mutable current-run state when a late fact lands.
1390
+ const runId = session !== undefined ? runIdOf() : undefined;
1391
+ const attribution = session === undefined
1392
+ ? undefined
1393
+ : { sessionId: session.id, ...(runId !== undefined && { runId }) };
1394
+ const failed = (failure) => turnArtifactsFailed(agent, attribution, offer.note, failure);
1395
+ const opened = (0, turnArtifacts_js_1.openTurnArtifacts)({
1396
+ store: agent.getArtifactStore(),
1397
+ scope: session?.scope(),
1398
+ runId,
1399
+ onEvent: (fact) => {
1400
+ // Only a bound hand-over reports facts, and only a session binds.
1401
+ if (attribution !== undefined)
1402
+ emitArtifactFact(agent, fact, attribution);
1403
+ },
1404
+ onFailure: (failure) => failed({
1405
+ cause: failure.cause,
1406
+ op: failure.op,
1407
+ ...(failure.cause === 'operation' && errorClassOf(failure.error)),
1408
+ }),
1409
+ });
1410
+ const handOver = (async () => {
1411
+ try {
1412
+ await reply.turnArtifacts?.(opened.turn);
1413
+ }
1414
+ catch (err) {
1415
+ // A hook that merely re-threw an operation's failure was already counted.
1416
+ if (!opened.reported(err))
1417
+ failed({ cause: 'hook', ...errorClassOf(err) });
1418
+ }
1419
+ await opened.drain();
1420
+ })();
1421
+ try {
1422
+ const ended = await withinBound(handOver, offer.timeoutMs, offer.signal);
1423
+ if (ended !== 'settled')
1424
+ failed({ cause: ended });
1425
+ }
1426
+ finally {
1427
+ opened.revoke();
1428
+ }
1429
+ }
1430
+ /**
1431
+ * Wait for `work`, but no longer than `timeoutMs` and no longer than `signal`
1432
+ * allows. `work` is NOT cancelled when the wait ends — there is nothing to
1433
+ * cancel a store's in-flight write with, and pretending otherwise would be
1434
+ * worse than saying we stopped waiting (the `toolSessions.ts · withTimeout`
1435
+ * law). The timer is unref'd, so a pending hand-over can never be the reason a
1436
+ * process stays up.
1437
+ */
1438
+ async function withinBound(work, timeoutMs, signal) {
1439
+ if (signal?.aborted === true)
1440
+ return 'abort';
1441
+ let timer;
1442
+ let onAbort;
1443
+ try {
1444
+ return await Promise.race([
1445
+ work.then(() => 'settled'),
1446
+ new Promise((resolve) => {
1447
+ timer = setTimeout(() => resolve('timeout'), timeoutMs);
1448
+ timer.unref?.();
1449
+ }),
1450
+ new Promise((resolve) => {
1451
+ if (signal === undefined)
1452
+ return;
1453
+ onAbort = () => resolve('abort');
1454
+ signal.addEventListener('abort', onAbort, { once: true });
1455
+ }),
1456
+ ]);
1457
+ }
1458
+ finally {
1459
+ if (timer !== undefined)
1460
+ clearTimeout(timer);
1461
+ if (onAbort !== undefined)
1462
+ signal?.removeEventListener('abort', onAbort);
1463
+ }
1464
+ }
1465
+ /** The routable half of a failure — class and code, never the message. */
1466
+ function errorClassOf(err) {
1467
+ const code = err?.code;
1468
+ return {
1469
+ ...(err instanceof Error && { errorClass: err.constructor?.name ?? err.name }),
1470
+ ...(typeof code === 'string' && { errorCode: code }),
1471
+ };
1472
+ }
1473
+ /**
1474
+ * Record one failure of a turn's artifact hand-over — on the serving agent's
1475
+ * stream as `agentfootprint.artifacts.hand_over_failed`, stamped with the
1476
+ * session and run it was FOR; the first one on the ingress record's census
1477
+ * (`IngressRecord.turnArtifactsFailure`); and on the console in dev mode. The
1478
+ * swallow is the library's decision, so the visibility is its duty: the
1479
+ * default deployment keeps no ingress sink, and a missing story must not be
1480
+ * silent there (the `toolSessions.ts` law 5, "never throws into the run — but
1481
+ * never silent either"). It never reaches the reply.
1482
+ */
1483
+ function turnArtifactsFailed(agent, attribution, note, failure) {
1484
+ const payload = {
1485
+ cause: failure.cause,
1486
+ ...(failure.op !== undefined && { op: failure.op }),
1487
+ ...(failure.errorClass !== undefined && { errorClass: failure.errorClass }),
1488
+ ...(failure.errorCode !== undefined && { errorCode: failure.errorCode }),
1489
+ };
1490
+ note?.turnArtifactsFailed(payload);
1491
+ if (attribution !== undefined) {
1492
+ agent.emitAttributed('agentfootprint.artifacts.hand_over_failed', { ...payload }, attribution);
1493
+ }
1494
+ if ((0, footprintjs_1.isDevMode)()) {
1495
+ // eslint-disable-next-line no-console
1496
+ console.error('[hosting] reply.turnArtifacts hand-over failed; the reply was delivered anyway:', payload);
1497
+ }
1498
+ }
1223
1499
  /**
1224
1500
  * End the reply with a resolved artifact — through the terminal built for it
1225
1501
  * when the host has one, and through the named refusal when it does not.
@@ -1252,34 +1528,69 @@ function deliverSessions(reply, op, result) {
1252
1528
  reply.fail(new errors_js_1.SessionsNotCarriedError(op));
1253
1529
  }
1254
1530
  /**
1255
- * Put one capability fact on the serving agent's typed record — the wire
1256
- * door's adapter onto the SAME `artifacts.resolved` / `artifacts.refused`
1257
- * events every tool redemption rides, minus the `tool` field (the redeemer
1258
- * was the hosting door, and payloads never carry an actor that does not
1531
+ * Put one capability fact on the serving agent's typed record — the hosting
1532
+ * door's adapter onto the SAME `artifacts.*` events every tool's use of
1533
+ * `ctx.artifacts` rides, minus the `tool` field (the actor was the hosting
1534
+ * door or the host's own code, and payloads never carry an actor that does not
1259
1535
  * exist).
1260
1536
  *
1261
- * `minted` and `expired` have no arm because a read-only door cannot produce
1262
- * them — only `put` does, and the wire deliberately has no put. Dropped when
1263
- * nobody listens (the dispatcher's own fast path), so an unobserved agent
1264
- * pays one listener check per fact and nothing more.
1537
+ * Two bindings feed it. The wire's redemption (`artifact-head` /
1538
+ * `artifact-get`) is read-only and only ever produces `resolved` / `refused`
1539
+ * — the wire deliberately has no put. The turn's hand-over
1540
+ * (`reply.turnArtifacts`) is the host's own code filing for its turn, so its
1541
+ * `put` produces `minted` and, when retention made room, `expired` —
1542
+ * tool-less, like the run's own recording mint, and carrying every meta field
1543
+ * a tool's mint carries.
1544
+ *
1545
+ * Every fact is stamped with the SESSION it was produced for
1546
+ * (`RunnerBase.emitAttributed`). The door answers outside any run and — for a
1547
+ * redemption — outside the lane, so on an instance shared by several sessions
1548
+ * a fact can be delivered while ANOTHER session's run is in flight; the stamp
1549
+ * is what keeps it out of that run's recording and self-explain evidence
1550
+ * (`bridge/eventMeta.ts · eventBelongsToRun`). Delivery to listeners is
1551
+ * unchanged. Dropped when nobody listens (the dispatcher's own fast path), so
1552
+ * an unobserved agent pays one listener check per fact and nothing more.
1265
1553
  */
1266
- function emitArtifactFact(agent, fact) {
1554
+ function emitArtifactFact(agent, fact, attribution) {
1267
1555
  switch (fact.type) {
1556
+ case 'minted': {
1557
+ const meta = fact.meta;
1558
+ agent.emitAttributed('agentfootprint.artifacts.minted', {
1559
+ ref: meta.ref,
1560
+ kind: meta.kind,
1561
+ mediaType: meta.mediaType,
1562
+ bytes: meta.bytes,
1563
+ ...(meta.label !== undefined && { label: meta.label }),
1564
+ ...(meta.digest !== undefined && { digest: meta.digest }),
1565
+ ...(meta.expiresAt !== undefined && { expiresAt: meta.expiresAt }),
1566
+ ...(meta.origin !== undefined && { origin: meta.origin }),
1567
+ ...(meta.parentRefs !== undefined && { parentRefs: meta.parentRefs }),
1568
+ }, attribution);
1569
+ return;
1570
+ }
1571
+ case 'expired':
1572
+ agent.emitAttributed('agentfootprint.artifacts.expired', {
1573
+ ref: fact.swept.ref,
1574
+ reason: fact.swept.reason,
1575
+ kind: fact.swept.kind,
1576
+ bytes: fact.swept.bytes,
1577
+ }, attribution);
1578
+ return;
1268
1579
  case 'resolved':
1269
- agent.emit('agentfootprint.artifacts.resolved', {
1580
+ agent.emitAttributed('agentfootprint.artifacts.resolved', {
1270
1581
  ref: fact.ref,
1271
1582
  via: fact.via,
1272
1583
  kind: fact.kind,
1273
1584
  bytes: fact.bytes,
1274
- });
1585
+ }, attribution);
1275
1586
  return;
1276
1587
  case 'refused':
1277
- agent.emit('agentfootprint.artifacts.refused', {
1588
+ agent.emitAttributed('agentfootprint.artifacts.refused', {
1278
1589
  op: fact.op,
1279
1590
  reason: fact.reason,
1280
1591
  ...(fact.ref !== undefined && { ref: fact.ref }),
1281
1592
  ...(fact.detail !== undefined && { detail: fact.detail }),
1282
- });
1593
+ }, attribution);
1283
1594
  return;
1284
1595
  default:
1285
1596
  return;