agentfootprint 9.24.0 → 9.26.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 (289) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +7 -1
  3. package/README.md +3 -1
  4. package/ai-instructions/claude-code/SKILL.md +1 -1
  5. package/dist/adapters/code/local.js +102 -2
  6. package/dist/adapters/code/local.js.map +1 -1
  7. package/dist/adapters/hosting/agentcore.js +11 -0
  8. package/dist/adapters/hosting/agentcore.js.map +1 -1
  9. package/dist/adapters/identity/jwks.js +277 -0
  10. package/dist/adapters/identity/jwks.js.map +1 -0
  11. package/dist/adapters/types.js +18 -1
  12. package/dist/adapters/types.js.map +1 -1
  13. package/dist/artifacts/fileArtifacts.js +144 -17
  14. package/dist/artifacts/fileArtifacts.js.map +1 -1
  15. package/dist/artifacts/gcsArtifacts.js +398 -0
  16. package/dist/artifacts/gcsArtifacts.js.map +1 -0
  17. package/dist/artifacts/index.js +17 -1
  18. package/dist/artifacts/index.js.map +1 -1
  19. package/dist/artifacts/objectStore.js +264 -0
  20. package/dist/artifacts/objectStore.js.map +1 -0
  21. package/dist/artifacts/payload.js +41 -2
  22. package/dist/artifacts/payload.js.map +1 -1
  23. package/dist/artifacts/recordingArtifact.js +88 -0
  24. package/dist/artifacts/recordingArtifact.js.map +1 -0
  25. package/dist/artifacts/s3Artifacts.js +542 -0
  26. package/dist/artifacts/s3Artifacts.js.map +1 -0
  27. package/dist/artifacts/scopePath.js +87 -0
  28. package/dist/artifacts/scopePath.js.map +1 -0
  29. package/dist/artifacts/streaming.js +132 -0
  30. package/dist/artifacts/streaming.js.map +1 -0
  31. package/dist/artifacts/types.js +10 -2
  32. package/dist/artifacts/types.js.map +1 -1
  33. package/dist/core/Agent.js +176 -0
  34. package/dist/core/Agent.js.map +1 -1
  35. package/dist/core/agent/AgentBuilder.js +20 -0
  36. package/dist/core/agent/AgentBuilder.js.map +1 -1
  37. package/dist/core/agent/repeatedCall.js +190 -0
  38. package/dist/core/agent/repeatedCall.js.map +1 -0
  39. package/dist/core/agent/stages/toolCalls.js +50 -0
  40. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  41. package/dist/core/codeRunnerTool.js +149 -12
  42. package/dist/core/codeRunnerTool.js.map +1 -1
  43. package/dist/esm/adapters/code/local.d.ts +16 -0
  44. package/dist/esm/adapters/code/local.js +102 -2
  45. package/dist/esm/adapters/code/local.js.map +1 -1
  46. package/dist/esm/adapters/hosting/agentcore.js +11 -0
  47. package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
  48. package/dist/esm/adapters/identity/jwks.d.ts +124 -0
  49. package/dist/esm/adapters/identity/jwks.js +249 -0
  50. package/dist/esm/adapters/identity/jwks.js.map +1 -0
  51. package/dist/esm/adapters/types.d.ts +86 -0
  52. package/dist/esm/adapters/types.js +16 -0
  53. package/dist/esm/adapters/types.js.map +1 -1
  54. package/dist/esm/artifacts/fileArtifacts.d.ts +13 -1
  55. package/dist/esm/artifacts/fileArtifacts.js +145 -18
  56. package/dist/esm/artifacts/fileArtifacts.js.map +1 -1
  57. package/dist/esm/artifacts/gcsArtifacts.d.ts +142 -0
  58. package/dist/esm/artifacts/gcsArtifacts.js +394 -0
  59. package/dist/esm/artifacts/gcsArtifacts.js.map +1 -0
  60. package/dist/esm/artifacts/index.d.ts +5 -1
  61. package/dist/esm/artifacts/index.js +4 -0
  62. package/dist/esm/artifacts/index.js.map +1 -1
  63. package/dist/esm/artifacts/objectStore.d.ts +166 -0
  64. package/dist/esm/artifacts/objectStore.js +252 -0
  65. package/dist/esm/artifacts/objectStore.js.map +1 -0
  66. package/dist/esm/artifacts/payload.d.ts +36 -4
  67. package/dist/esm/artifacts/payload.js +38 -1
  68. package/dist/esm/artifacts/payload.js.map +1 -1
  69. package/dist/esm/artifacts/recordingArtifact.d.ts +76 -0
  70. package/dist/esm/artifacts/recordingArtifact.js +83 -0
  71. package/dist/esm/artifacts/recordingArtifact.js.map +1 -0
  72. package/dist/esm/artifacts/s3Artifacts.d.ts +149 -0
  73. package/dist/esm/artifacts/s3Artifacts.js +538 -0
  74. package/dist/esm/artifacts/s3Artifacts.js.map +1 -0
  75. package/dist/esm/artifacts/scopePath.d.ts +50 -0
  76. package/dist/esm/artifacts/scopePath.js +80 -0
  77. package/dist/esm/artifacts/scopePath.js.map +1 -0
  78. package/dist/esm/artifacts/streaming.d.ts +82 -0
  79. package/dist/esm/artifacts/streaming.js +123 -0
  80. package/dist/esm/artifacts/streaming.js.map +1 -0
  81. package/dist/esm/artifacts/types.d.ts +71 -5
  82. package/dist/esm/artifacts/types.js +10 -2
  83. package/dist/esm/artifacts/types.js.map +1 -1
  84. package/dist/esm/core/Agent.d.ts +66 -2
  85. package/dist/esm/core/Agent.js +176 -0
  86. package/dist/esm/core/Agent.js.map +1 -1
  87. package/dist/esm/core/agent/AgentBuilder.js +20 -0
  88. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  89. package/dist/esm/core/agent/repeatedCall.d.ts +150 -0
  90. package/dist/esm/core/agent/repeatedCall.js +184 -0
  91. package/dist/esm/core/agent/repeatedCall.js.map +1 -0
  92. package/dist/esm/core/agent/stages/toolCalls.d.ts +12 -0
  93. package/dist/esm/core/agent/stages/toolCalls.js +50 -0
  94. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  95. package/dist/esm/core/agent/types.d.ts +82 -0
  96. package/dist/esm/core/codeRunnerTool.d.ts +31 -0
  97. package/dist/esm/core/codeRunnerTool.js +149 -12
  98. package/dist/esm/core/codeRunnerTool.js.map +1 -1
  99. package/dist/esm/events/payloads.d.ts +22 -0
  100. package/dist/esm/events/registry.d.ts +3 -1
  101. package/dist/esm/events/registry.js +2 -0
  102. package/dist/esm/events/registry.js.map +1 -1
  103. package/dist/esm/hosting/admission.d.ts +180 -0
  104. package/dist/esm/hosting/admission.js +188 -0
  105. package/dist/esm/hosting/admission.js.map +1 -0
  106. package/dist/esm/hosting/artifactWire.d.ts +8 -5
  107. package/dist/esm/hosting/artifactWire.js +14 -9
  108. package/dist/esm/hosting/artifactWire.js.map +1 -1
  109. package/dist/esm/hosting/envelope.d.ts +34 -0
  110. package/dist/esm/hosting/envelope.js +81 -0
  111. package/dist/esm/hosting/envelope.js.map +1 -1
  112. package/dist/esm/hosting/errors.d.ts +131 -0
  113. package/dist/esm/hosting/errors.js +195 -0
  114. package/dist/esm/hosting/errors.js.map +1 -1
  115. package/dist/esm/hosting/httpHost.d.ts +21 -0
  116. package/dist/esm/hosting/httpHost.js +44 -2
  117. package/dist/esm/hosting/httpHost.js.map +1 -1
  118. package/dist/esm/hosting/identityVerification.d.ts +154 -0
  119. package/dist/esm/hosting/identityVerification.js +135 -0
  120. package/dist/esm/hosting/identityVerification.js.map +1 -0
  121. package/dist/esm/hosting/index.d.ts +12 -3
  122. package/dist/esm/hosting/index.js +16 -2
  123. package/dist/esm/hosting/index.js.map +1 -1
  124. package/dist/esm/hosting/memorySessions.d.ts +9 -0
  125. package/dist/esm/hosting/memorySessions.js +86 -0
  126. package/dist/esm/hosting/memorySessions.js.map +1 -1
  127. package/dist/esm/hosting/nodeHost.js +8 -0
  128. package/dist/esm/hosting/nodeHost.js.map +1 -1
  129. package/dist/esm/hosting/sessionWire.d.ts +126 -0
  130. package/dist/esm/hosting/sessionWire.js +95 -0
  131. package/dist/esm/hosting/sessionWire.js.map +1 -0
  132. package/dist/esm/hosting/sqliteSessions.js +122 -5
  133. package/dist/esm/hosting/sqliteSessions.js.map +1 -1
  134. package/dist/esm/hosting/standingAgent.js +299 -8
  135. package/dist/esm/hosting/standingAgent.js.map +1 -1
  136. package/dist/esm/hosting/types.d.ts +166 -6
  137. package/dist/esm/hosting/types.js.map +1 -1
  138. package/dist/esm/hosting/wireOps.d.ts +52 -0
  139. package/dist/esm/hosting/wireOps.js +60 -0
  140. package/dist/esm/hosting/wireOps.js.map +1 -0
  141. package/dist/esm/identity.d.ts +1 -0
  142. package/dist/esm/identity.js +6 -0
  143. package/dist/esm/identity.js.map +1 -1
  144. package/dist/esm/index.d.ts +3 -2
  145. package/dist/esm/index.js +10 -1
  146. package/dist/esm/index.js.map +1 -1
  147. package/dist/esm/lib/injection-engine/factories/defineSkill.d.ts +27 -0
  148. package/dist/esm/lib/injection-engine/factories/defineSkill.js +13 -0
  149. package/dist/esm/lib/injection-engine/factories/defineSkill.js.map +1 -1
  150. package/dist/esm/lib/injection-engine/index.d.ts +1 -0
  151. package/dist/esm/lib/injection-engine/index.js +7 -0
  152. package/dist/esm/lib/injection-engine/index.js.map +1 -1
  153. package/dist/esm/lib/injection-engine/skillGraph.js +9 -1
  154. package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
  155. package/dist/esm/lib/injection-engine/skillGraphCheckup.d.ts +1 -1
  156. package/dist/esm/lib/injection-engine/skillGraphCheckup.js.map +1 -1
  157. package/dist/esm/lib/injection-engine/skillSteps.d.ts +16 -0
  158. package/dist/esm/lib/injection-engine/skillSteps.js +5 -0
  159. package/dist/esm/lib/injection-engine/skillSteps.js.map +1 -1
  160. package/dist/esm/lib/injection-engine/skillVocabulary.d.ts +83 -0
  161. package/dist/esm/lib/injection-engine/skillVocabulary.js +218 -0
  162. package/dist/esm/lib/injection-engine/skillVocabulary.js.map +1 -0
  163. package/dist/events/registry.js +2 -0
  164. package/dist/events/registry.js.map +1 -1
  165. package/dist/hosting/admission.js +194 -0
  166. package/dist/hosting/admission.js.map +1 -0
  167. package/dist/hosting/artifactWire.js +14 -9
  168. package/dist/hosting/artifactWire.js.map +1 -1
  169. package/dist/hosting/envelope.js +84 -1
  170. package/dist/hosting/envelope.js.map +1 -1
  171. package/dist/hosting/errors.js +203 -1
  172. package/dist/hosting/errors.js.map +1 -1
  173. package/dist/hosting/httpHost.js +43 -1
  174. package/dist/hosting/httpHost.js.map +1 -1
  175. package/dist/hosting/identityVerification.js +140 -0
  176. package/dist/hosting/identityVerification.js.map +1 -0
  177. package/dist/hosting/index.js +38 -1
  178. package/dist/hosting/index.js.map +1 -1
  179. package/dist/hosting/memorySessions.js +86 -0
  180. package/dist/hosting/memorySessions.js.map +1 -1
  181. package/dist/hosting/nodeHost.js +8 -0
  182. package/dist/hosting/nodeHost.js.map +1 -1
  183. package/dist/hosting/sessionWire.js +100 -0
  184. package/dist/hosting/sessionWire.js.map +1 -0
  185. package/dist/hosting/sqliteSessions.js +121 -4
  186. package/dist/hosting/sqliteSessions.js.map +1 -1
  187. package/dist/hosting/standingAgent.js +297 -6
  188. package/dist/hosting/standingAgent.js.map +1 -1
  189. package/dist/hosting/types.js.map +1 -1
  190. package/dist/hosting/wireOps.js +65 -0
  191. package/dist/hosting/wireOps.js.map +1 -0
  192. package/dist/identity.js +9 -1
  193. package/dist/identity.js.map +1 -1
  194. package/dist/index.js +30 -13
  195. package/dist/index.js.map +1 -1
  196. package/dist/lib/injection-engine/factories/defineSkill.js +13 -0
  197. package/dist/lib/injection-engine/factories/defineSkill.js.map +1 -1
  198. package/dist/lib/injection-engine/index.js +10 -1
  199. package/dist/lib/injection-engine/index.js.map +1 -1
  200. package/dist/lib/injection-engine/skillGraph.js +9 -1
  201. package/dist/lib/injection-engine/skillGraph.js.map +1 -1
  202. package/dist/lib/injection-engine/skillGraphCheckup.js.map +1 -1
  203. package/dist/lib/injection-engine/skillSteps.js +5 -0
  204. package/dist/lib/injection-engine/skillSteps.js.map +1 -1
  205. package/dist/lib/injection-engine/skillVocabulary.js +224 -0
  206. package/dist/lib/injection-engine/skillVocabulary.js.map +1 -0
  207. package/dist/types/adapters/code/local.d.ts +16 -0
  208. package/dist/types/adapters/code/local.d.ts.map +1 -1
  209. package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
  210. package/dist/types/adapters/identity/jwks.d.ts +125 -0
  211. package/dist/types/adapters/identity/jwks.d.ts.map +1 -0
  212. package/dist/types/adapters/types.d.ts +86 -0
  213. package/dist/types/adapters/types.d.ts.map +1 -1
  214. package/dist/types/artifacts/fileArtifacts.d.ts +13 -1
  215. package/dist/types/artifacts/fileArtifacts.d.ts.map +1 -1
  216. package/dist/types/artifacts/gcsArtifacts.d.ts +143 -0
  217. package/dist/types/artifacts/gcsArtifacts.d.ts.map +1 -0
  218. package/dist/types/artifacts/index.d.ts +5 -1
  219. package/dist/types/artifacts/index.d.ts.map +1 -1
  220. package/dist/types/artifacts/objectStore.d.ts +167 -0
  221. package/dist/types/artifacts/objectStore.d.ts.map +1 -0
  222. package/dist/types/artifacts/payload.d.ts +36 -4
  223. package/dist/types/artifacts/payload.d.ts.map +1 -1
  224. package/dist/types/artifacts/recordingArtifact.d.ts +77 -0
  225. package/dist/types/artifacts/recordingArtifact.d.ts.map +1 -0
  226. package/dist/types/artifacts/s3Artifacts.d.ts +150 -0
  227. package/dist/types/artifacts/s3Artifacts.d.ts.map +1 -0
  228. package/dist/types/artifacts/scopePath.d.ts +51 -0
  229. package/dist/types/artifacts/scopePath.d.ts.map +1 -0
  230. package/dist/types/artifacts/streaming.d.ts +83 -0
  231. package/dist/types/artifacts/streaming.d.ts.map +1 -0
  232. package/dist/types/artifacts/types.d.ts +71 -5
  233. package/dist/types/artifacts/types.d.ts.map +1 -1
  234. package/dist/types/core/Agent.d.ts +66 -2
  235. package/dist/types/core/Agent.d.ts.map +1 -1
  236. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  237. package/dist/types/core/agent/repeatedCall.d.ts +151 -0
  238. package/dist/types/core/agent/repeatedCall.d.ts.map +1 -0
  239. package/dist/types/core/agent/stages/toolCalls.d.ts +12 -0
  240. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  241. package/dist/types/core/agent/types.d.ts +82 -0
  242. package/dist/types/core/agent/types.d.ts.map +1 -1
  243. package/dist/types/core/codeRunnerTool.d.ts +31 -0
  244. package/dist/types/core/codeRunnerTool.d.ts.map +1 -1
  245. package/dist/types/events/payloads.d.ts +22 -0
  246. package/dist/types/events/payloads.d.ts.map +1 -1
  247. package/dist/types/events/registry.d.ts +3 -1
  248. package/dist/types/events/registry.d.ts.map +1 -1
  249. package/dist/types/hosting/admission.d.ts +181 -0
  250. package/dist/types/hosting/admission.d.ts.map +1 -0
  251. package/dist/types/hosting/artifactWire.d.ts +8 -5
  252. package/dist/types/hosting/artifactWire.d.ts.map +1 -1
  253. package/dist/types/hosting/envelope.d.ts +34 -0
  254. package/dist/types/hosting/envelope.d.ts.map +1 -1
  255. package/dist/types/hosting/errors.d.ts +131 -0
  256. package/dist/types/hosting/errors.d.ts.map +1 -1
  257. package/dist/types/hosting/httpHost.d.ts +21 -0
  258. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  259. package/dist/types/hosting/identityVerification.d.ts +155 -0
  260. package/dist/types/hosting/identityVerification.d.ts.map +1 -0
  261. package/dist/types/hosting/index.d.ts +12 -3
  262. package/dist/types/hosting/index.d.ts.map +1 -1
  263. package/dist/types/hosting/memorySessions.d.ts +9 -0
  264. package/dist/types/hosting/memorySessions.d.ts.map +1 -1
  265. package/dist/types/hosting/nodeHost.d.ts.map +1 -1
  266. package/dist/types/hosting/sessionWire.d.ts +127 -0
  267. package/dist/types/hosting/sessionWire.d.ts.map +1 -0
  268. package/dist/types/hosting/sqliteSessions.d.ts.map +1 -1
  269. package/dist/types/hosting/standingAgent.d.ts.map +1 -1
  270. package/dist/types/hosting/types.d.ts +166 -6
  271. package/dist/types/hosting/types.d.ts.map +1 -1
  272. package/dist/types/hosting/wireOps.d.ts +53 -0
  273. package/dist/types/hosting/wireOps.d.ts.map +1 -0
  274. package/dist/types/identity.d.ts +1 -0
  275. package/dist/types/identity.d.ts.map +1 -1
  276. package/dist/types/index.d.ts +3 -2
  277. package/dist/types/index.d.ts.map +1 -1
  278. package/dist/types/lib/injection-engine/factories/defineSkill.d.ts +27 -0
  279. package/dist/types/lib/injection-engine/factories/defineSkill.d.ts.map +1 -1
  280. package/dist/types/lib/injection-engine/index.d.ts +1 -0
  281. package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
  282. package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
  283. package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts +1 -1
  284. package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts.map +1 -1
  285. package/dist/types/lib/injection-engine/skillSteps.d.ts +16 -0
  286. package/dist/types/lib/injection-engine/skillSteps.d.ts.map +1 -1
  287. package/dist/types/lib/injection-engine/skillVocabulary.d.ts +84 -0
  288. package/dist/types/lib/injection-engine/skillVocabulary.d.ts.map +1 -0
  289. package/package.json +15 -1
@@ -0,0 +1,143 @@
1
+ /**
2
+ * artifacts/gcsArtifacts — the claim-check store in a Cloud Storage bucket.
3
+ *
4
+ * The same five verbs, the same laws, a different vendor's client. Read
5
+ * `objectStore.ts` first for the laws both object adapters obey; read
6
+ * `s3Artifacts.ts` beside this one to see what is genuinely per-vendor rather
7
+ * than per-implementation. Three things really are different here, and each
8
+ * one changes what an operator pays:
9
+ *
10
+ * 1. **A listing carries the metadata.** `bucket.getFiles()` hands back File
11
+ * objects with their metadata already populated — creation time, size AND
12
+ * the custom entry holding the ticket. So `list()` is ONE call per page
13
+ * and needs no per-row read, where the S3 adapter must HEAD each row it
14
+ * returns. Same port, same promise, cheaper here; said out loud because
15
+ * "the cloud adapters behave identically" is true of the CONTRACT and not
16
+ * of the bill.
17
+ * 2. **A bigger metadata budget.** Custom metadata is capped at 8 KiB
18
+ * (keys and values together), against 2 KB on the other column. The
19
+ * ticket is checked against it at put and refused by name, so the cap is
20
+ * a stated limit and not a surprise from the service.
21
+ * 3. **The client has no command objects.** Methods hang off a chain —
22
+ * `storage.bucket(b).file(k).save(...)` — which is why this column's pin
23
+ * test asserts a METHOD CHAIN rather than a set of command names.
24
+ *
25
+ * ── The object key ──────────────────────────────────────────────────────────
26
+ * `[<prefix>/]<tenant>/<principal>/<conversation>/<ref>`, scope-partitioned by
27
+ * `scopePath.ts` — the same percent-encoding law as the directory adapter, so
28
+ * a tenant of literally `'..'` is a NAME here too. A ref alone opens nothing:
29
+ * a wrong scope computes a different object name, the service answers 404, and
30
+ * the caller reads `null`.
31
+ *
32
+ * ── What a 404 is allowed to mean here ──────────────────────────────────────
33
+ * A missing object and a missing bucket look the SAME on this column
34
+ * (`code: 404`, reason `notFound`, differing only in prose this adapter will
35
+ * not parse). So the split is made by the call instead: only a read of one
36
+ * named object may read a 404 as "not there". A 404 from a save or a listing
37
+ * is not an answer to anything the caller asked — it goes through the
38
+ * sanitizer, because nothing downstream converts it and the client's own text
39
+ * for it carries the object name.
40
+ *
41
+ * ── Retention, and the operator's bulk tool ─────────────────────────────────
42
+ * `ttlMs` stamps `expiresAt` AT MINT (stated, never sprung); expiry is
43
+ * enforced on READ and the expired object is deleted on the way past; budgets
44
+ * evict oldest-first (an object store has no cheap read-recency). A put SCANS
45
+ * the scope only when a byte/count budget is configured — with no budget there
46
+ * is nothing to plan, and a put stays a single upload.
47
+ *
48
+ * Reclaiming what nobody reads again is **Object Lifecycle Management**, the
49
+ * operator's bulk tool. This adapter does not create rules: a lifecycle rule
50
+ * is a cost and compliance decision that belongs to your infrastructure.
51
+ * Align it like this:
52
+ *
53
+ * ```jsonc
54
+ * // Delete objects 7 days after creation. Keep the rule LONGER than the
55
+ * // store's ttlMs, never shorter: `expiresAt` is the promise printed on the
56
+ * // ticket, and a lifecycle rule that deletes first makes a live ticket
57
+ * // resolve to null BEFORE the time it stated. Longer, and lifecycle is what
58
+ * // it should be — the backstop for what the store's own sweep never
59
+ * // revisited.
60
+ * { "lifecycle": { "rule": [
61
+ * { "action": { "type": "Delete" },
62
+ * "condition": { "age": 7, "matchesPrefix": ["artifacts/"] } }
63
+ * ]}}
64
+ * ```
65
+ *
66
+ * ── Lazy peer dependency ────────────────────────────────────────────────────
67
+ * `@google-cloud/storage` is an OPTIONAL peer dependency, required at
68
+ * CONSTRUCTION (the sqliteSessions law): importing the barrel costs a browser
69
+ * bundle nothing, and a missing install refuses where the config was written.
70
+ * Pass `storage` to share the client your app already built.
71
+ *
72
+ * ── Status ──────────────────────────────────────────────────────────────────
73
+ * Contract-shaped and tested; awaiting field use. The method chain it calls is
74
+ * pinned against the really-installed package by
75
+ * `test/adapters/google/google-surface-pin.test.ts`; the behavior is proved
76
+ * against an emulation double that speaks the same chain. No live call has
77
+ * been made from this repository.
78
+ */
79
+ /// <reference types="node" />
80
+ import { type ArtifactRetention } from './retention.js';
81
+ import { type ArtifactStore } from './types.js';
82
+ /** One object's metadata, as this adapter reads it. */
83
+ export interface GcsFileMetadataLike {
84
+ readonly size?: string | number;
85
+ readonly timeCreated?: string;
86
+ readonly contentType?: string;
87
+ /** The custom entries — where the ticket rides. */
88
+ readonly metadata?: Record<string, unknown>;
89
+ }
90
+ /** One object handle, as this adapter calls it. */
91
+ export interface GcsFileLike {
92
+ /** Populated by a listing; a File built by `bucket.file()` may not have it. */
93
+ readonly name?: string;
94
+ readonly metadata?: GcsFileMetadataLike;
95
+ save(data: Uint8Array | string, options?: unknown): Promise<unknown>;
96
+ download(options?: unknown): Promise<[Uint8Array]>;
97
+ getMetadata(options?: unknown): Promise<[GcsFileMetadataLike, unknown?]>;
98
+ delete(options?: unknown): Promise<unknown>;
99
+ createReadStream(options?: unknown): NodeJS.ReadableStream;
100
+ createWriteStream(options?: unknown): NodeJS.WritableStream;
101
+ }
102
+ /** One bucket handle, as this adapter calls it. */
103
+ export interface GcsBucketLike {
104
+ file(name: string): GcsFileLike;
105
+ getFiles(query?: unknown): Promise<[GcsFileLike[], unknown?, unknown?]>;
106
+ }
107
+ /** The client, as this adapter calls it. */
108
+ export interface GcsStorageLike {
109
+ bucket(name: string): GcsBucketLike;
110
+ }
111
+ /** The module shape this adapter loads. */
112
+ export interface GcsSdkModule {
113
+ readonly Storage?: new (config: Record<string, unknown>) => GcsStorageLike;
114
+ }
115
+ /** Options for {@link gcsArtifacts}. */
116
+ export interface GcsArtifactsOptions {
117
+ /** The bucket. It must already exist — this library never creates one. */
118
+ readonly bucket: string;
119
+ /** Object-name prefix inside the bucket, so a bucket can be shared. */
120
+ readonly prefix?: string;
121
+ /** Project id for the client this factory builds. Ignored when `storage` is
122
+ * passed — that client's configuration is yours. */
123
+ readonly projectId?: string;
124
+ /** Your own pre-built client; configuration and credentials stay yours. */
125
+ readonly storage?: GcsStorageLike;
126
+ /** Retention dials. Budgets evict OLDEST-first (no cheap read-recency). */
127
+ readonly retention?: ArtifactRetention;
128
+ /** @internal Test seam — the SDK module, injected. */
129
+ readonly _sdk?: GcsSdkModule;
130
+ /** @internal Test seam — a client injected past the SDK entirely. */
131
+ readonly _storage?: GcsStorageLike;
132
+ /** @internal Test seam — the clock. Defaults to `Date.now`. */
133
+ readonly _now?: () => number;
134
+ }
135
+ /**
136
+ * An artifact store in a Cloud Storage bucket.
137
+ *
138
+ * @example
139
+ * const store = gcsArtifacts({ bucket: 'my-agent-artifacts', prefix: 'artifacts' });
140
+ * const agent = Agent.create({ provider, artifacts: store });
141
+ */
142
+ export declare function gcsArtifacts(options: GcsArtifactsOptions): ArtifactStore;
143
+ //# sourceMappingURL=gcsArtifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcsArtifacts.d.ts","sourceRoot":"","sources":["../../../src/artifacts/gcsArtifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;;AAwBH,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAUL,KAAK,aAAa,EAGnB,MAAM,YAAY,CAAC;AAapB,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C;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AAmB;IAClC,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;yDACqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC;IAClC,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAC;IACvC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,MAAM,CAAC;CAC9B;AAsDD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa,CAgRxE"}
@@ -9,14 +9,18 @@
9
9
  * (`present`), and the placement threshold (`placement`). See README.md in
10
10
  * this folder for the one-job map and the import direction.
11
11
  */
12
- export { ArtifactIntegrityError, InvalidArtifactError, UnknownParentRefError, type ArtifactListOptions, type ArtifactListResult, type ArtifactMeta, type ArtifactOrigin, type ArtifactPutResult, type ArtifactRecord, type ArtifactRef, type ArtifactScope, type ArtifactStore, type ArtifactSweepReason, type PutArtifactInput, type SweptArtifact, } from './types.js';
12
+ export { ArtifactIntegrityError, InvalidArtifactError, UnknownParentRefError, type ArtifactListOptions, type ArtifactListResult, type ArtifactMeta, type ArtifactOrigin, type ArtifactPutResult, type ArtifactRecord, type ArtifactRef, type ArtifactScope, type ArtifactStore, type ArtifactStreamPutInput, type ArtifactStreamRecord, type ArtifactSweepReason, type PutArtifactInput, type SweptArtifact, } from './types.js';
13
13
  export { ARTIFACT_REF_PREFIX, isArtifactRef, mintArtifactRef } from './naming.js';
14
14
  export { type ArtifactRetention } from './retention.js';
15
15
  export { inMemoryArtifacts, DEFAULT_IN_MEMORY_ARTIFACT_RETENTION, type InMemoryArtifacts, type InMemoryArtifactsOptions, } from './inMemoryArtifacts.js';
16
16
  export { fileArtifacts, UnreadableArtifactFileError, type FileArtifactsOptions, } from './fileArtifacts.js';
17
17
  export { sqliteArtifacts, UnreadableArtifactStoreError, type SqliteArtifacts, type SqliteArtifactsOptions, } from './sqliteArtifacts.js';
18
+ export { s3Artifacts, type S3ArtifactsOptions } from './s3Artifacts.js';
19
+ export { gcsArtifacts, type GcsArtifactsOptions } from './gcsArtifacts.js';
20
+ export { assertStreamBytes, bytesAsStream, canGetArtifactStream, canPutArtifactStream, canStreamArtifacts, collectStream, type GetStreamingArtifactStore, type PutStreamingArtifactStore, type StreamingArtifactStore, } from './streaming.js';
18
21
  export { bindArtifacts, unconfiguredArtifacts, type ArtifactEventFact, type ArtifactEventSink, type ArtifactOp, type ArtifactRefusalReason, type BindArtifactsOptions, type ToolArtifactPutInput, type ToolArtifacts, } from './capability.js';
19
22
  export { assertToolWants, resolveToolWants, wantsNeedsStoreRefusal, type ToolWants, type WantsRefusal, type WantsResolution, } from './wants.js';
20
23
  export { PRESENT_TOOL_NAME, presentArtifact, type PresentOutcome, type PresentSnapshot, type PresentedResult, } from './present.js';
24
+ export { recordingPutInput, RECORDING_ARTIFACT_KIND, RECORDING_MEDIA_TYPE, UnserializableRecordingError, type RecordingMintFacts, } from './recordingArtifact.js';
21
25
  export { assertArtifactPlacement, isPlacedToolResult, placedResultKind, placedToolResult, type ArtifactPlacement, type PlacedToolResult, } from './placement.js';
22
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/artifacts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,YAAY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AiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,aAAa,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,kBAAkB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * artifacts/objectStore — the half every REMOTE OBJECT adapter shares.
3
+ *
4
+ * Two adapters put artifacts in somebody else's bucket. They speak different
5
+ * SDKs and dispatch different operations, and that is exactly where a vendor
6
+ * belongs — but the laws they follow must not fork, so the laws live here:
7
+ *
8
+ * 1. **The payload is the object body, and it is the CANONICAL BYTES** —
9
+ * the same bytes `meta.bytes` counts and a digest covers. Not a JSON
10
+ * envelope wrapping base64: a stored report should be downloadable with
11
+ * the vendor's own console and be the report. That choice is also what
12
+ * makes `getStream` possible at all — a body you have to parse is a body
13
+ * you cannot stream.
14
+ * 2. **The meta rides as ONE object-metadata entry** ({@link ARTIFACT_META_KEY}),
15
+ * an ASCII-safe JSON envelope. One key, one truth: a "helpful" second
16
+ * copy of `kind` in a sibling field is a second thing that can disagree.
17
+ * ASCII because user metadata travels as an HTTP header on at least one
18
+ * of these services — a label with an em-dash in it must not be
19
+ * mangled at the transport — and JSON-with-escapes rather than base64
20
+ * because an operator reading the console should be able to SEE what the
21
+ * ticket says.
22
+ * 3. **The metadata budget is checked at put and REFUSED by name.** Both
23
+ * services cap user metadata (the caps differ; each adapter states its
24
+ * own). A refusal that names the field to shorten beats a vendor's
25
+ * "MetadataTooLarge" at document 400, and beats silent truncation
26
+ * always.
27
+ * 4. **Missing means null; unreadable means an error.** A 404 is the
28
+ * port's deliberate "no data" ambiguity — but only when the call ASKED
29
+ * ABOUT ONE OBJECT. A write and a listing do not ask that question, so a
30
+ * 404 from one of them is the service saying something else entirely (the
31
+ * bucket does not exist, the endpoint is wrong); nobody downstream turns
32
+ * it into `null`, so letting it past the sanitizer hands the caller the
33
+ * SDK's own text — which contains the object key. That is what
34
+ * {@link NotFoundMeaning} makes each call site declare, and why the
35
+ * default is the safe one. Anything else — denied, throttled, a network
36
+ * failure — is NOT "no data" either, and answering `null` for it would
37
+ * report an empty scope over objects that exist. Each adapter maps its
38
+ * own SDK's missing-object shape; everything else raises through
39
+ * {@link objectSdkFailure}.
40
+ * 5. **Listings order by the SERVICE's own creation time**, which comes back
41
+ * free on a listing, and page by offset over that sorted list. The port
42
+ * promises newest-first ACROSS pages; a bucket's key order is
43
+ * lexicographic, so a cursor that was the service's own continuation
44
+ * token would page in the wrong order and call it paging.
45
+ *
46
+ * Nothing in this file imports an SDK, names a vendor, or knows a wire
47
+ * format. It is the part of an object adapter that can be unit-tested with
48
+ * nothing but strings.
49
+ */
50
+ import type { PayloadShape } from './payload.js';
51
+ import { type ArtifactListOptions, type ArtifactListResult, type ArtifactMeta } from './types.js';
52
+ /** The single object-metadata key that carries the ticket. */
53
+ export declare const ARTIFACT_META_KEY = "af-artifact";
54
+ /**
55
+ * Encode a ticket for the object's metadata, refusing one that will not fit.
56
+ *
57
+ * @param meta the minted ticket.
58
+ * @param shape how the payload must be rebuilt from the body's bytes.
59
+ * @param budget the service's user-metadata cap, in bytes.
60
+ * @param adapter the factory name, for the refusal.
61
+ * @throws InvalidArtifactError when the encoded ticket exceeds the budget —
62
+ * naming the fields that are big enough to be the reason.
63
+ */
64
+ export declare function encodeArtifactMetaValue(meta: ArtifactMeta, shape: PayloadShape, budget: number, adapter: string): string;
65
+ /**
66
+ * Read a ticket back off an object's metadata.
67
+ *
68
+ * `undefined` for anything this runtime must not interpret: no entry (not
69
+ * ours — a foreign object in a shared bucket is left alone), unparseable, a
70
+ * newer envelope version, or a ref that is not a minted ref. Refusing to
71
+ * interpret is the point: a half-read ticket would be a confident description
72
+ * of the wrong thing.
73
+ */
74
+ export declare function decodeArtifactMetaValue(value: unknown): {
75
+ readonly meta: ArtifactMeta;
76
+ readonly shape: PayloadShape;
77
+ } | undefined;
78
+ /** Case-insensitive lookup in a metadata bag. At least one of these services
79
+ * lower-cases user-metadata keys in transit, so the key written and the key
80
+ * read back are not guaranteed to be the same string. */
81
+ export declare function readMetadataEntry(bag: Record<string, unknown> | undefined, key: string): unknown;
82
+ /** Has the calendar passed this ticket? The one expiry predicate both object
83
+ * adapters use, so "expired" cannot mean two things. */
84
+ export declare function isExpiredMeta(meta: ArtifactMeta, now: number): boolean;
85
+ /**
86
+ * Re-raise a failed SDK call WITHOUT its text (the `sdkFailure` law, applied
87
+ * to object storage).
88
+ *
89
+ * A cloud SDK reports transport and validation failures by echoing request
90
+ * detail into the message: the bucket, the KEY — which here contains the
91
+ * tenant, the principal and the conversation id — and sometimes a signed URL
92
+ * or a header the request carried. This library then hands that string to the
93
+ * LLM as a tool result, puts it on the commit log, and ships it to every sink
94
+ * attached. One echo and the scope tuple is in the conversation.
95
+ *
96
+ * So the text does not come through. What does is the part that is both safe
97
+ * and actionable: which operation failed, the exception's NAME, and the HTTP
98
+ * status. The original is deliberately NOT attached as `cause` — a cause
99
+ * travels into every serializer that walks own properties, which would undo
100
+ * all of this in one `JSON.stringify`.
101
+ */
102
+ export declare function objectSdkFailure(adapter: string, operation: string, err: unknown): Error;
103
+ /**
104
+ * What a "not found" from ONE call is allowed to mean.
105
+ *
106
+ * The distinction is not academic: it decides whether an SDK error object
107
+ * leaves this library intact.
108
+ *
109
+ * • `'missing-object'` — the call named one object and asked whether it is
110
+ * there. Not-found is the port's deliberate "no data", so the SDK's own
111
+ * error travels back to the CALL SITE, which immediately converts it to
112
+ * `null`/`undefined`. It never leaves the adapter, so its text never reaches
113
+ * an event, a log, or a model.
114
+ *
115
+ * • `'not-an-answer'` — the call asked no such question (it wrote, or it
116
+ * listed). A not-found here means something the caller did not ask about is
117
+ * wrong — most often that the bucket itself is not there — and NOTHING
118
+ * downstream is waiting to convert it. It goes through
119
+ * {@link objectSdkFailure} like every other failure.
120
+ *
121
+ * This is the DEFAULT for exactly that reason: a call site that says nothing
122
+ * gets the sanitizer. Leaking has to be typed out on purpose, next to the
123
+ * `catch` that proves the error is caught.
124
+ */
125
+ export type NotFoundMeaning = 'missing-object' | 'not-an-answer';
126
+ /**
127
+ * The one gate every object adapter runs its SDK failures through.
128
+ *
129
+ * Returns what to throw — the sanitized error for anything the caller is not
130
+ * standing by to interpret, the original ONLY for a genuine missing object at
131
+ * a call site that declared it asks about one, and our own refusals verbatim
132
+ * (an {@link InvalidArtifactError} is this library's sentence, already written
133
+ * for a human, and re-wrapping it would replace a teaching refusal with a
134
+ * transport complaint).
135
+ *
136
+ * Built once per adapter so the vendor's not-found detection is bound in one
137
+ * place: two call sites in the same adapter cannot end up disagreeing about
138
+ * what "missing" looks like.
139
+ *
140
+ * @param adapter the factory name, for the message.
141
+ * @param isMissingObject the adapter's own reading of its SDK's
142
+ * "no such object" — the one genuinely per-vendor part.
143
+ */
144
+ export declare function objectFailurePolicy(adapter: string, isMissingObject: (err: unknown) => boolean): (operation: string, err: unknown, meaning: NotFoundMeaning) => unknown;
145
+ /** One row of a scope listing, before the tickets are paged. */
146
+ export interface ObjectListingRow {
147
+ readonly meta: ArtifactMeta;
148
+ /** The service's own creation time for the object (ms). The sort key —
149
+ * see law 5 in the module header. */
150
+ readonly serviceCreatedAt: number;
151
+ }
152
+ /**
153
+ * The port's paging law over a scope's rows: newest first, offset cursor.
154
+ *
155
+ * Sorted by the SERVICE's creation time (falling back to the ticket's own
156
+ * `createdAt` when a listing did not carry one), ties broken by ref so two
157
+ * objects written in the same millisecond still page deterministically.
158
+ */
159
+ export declare function pageObjectListing(rows: readonly ObjectListingRow[], options: ArtifactListOptions | undefined): ArtifactListResult;
160
+ /** The offset a cursor names. Total: a cursor this store did not mint reads
161
+ * as "start at the beginning" rather than as an error — a caller cannot
162
+ * learn anything about another scope by guessing one. */
163
+ export declare function decodeOffsetCursor(cursor: string | undefined): number;
164
+ /** Validate a bucket name option at construction — the same shape of refusal
165
+ * every adapter here gives for a missing required option. */
166
+ export declare function assertBucketOption(adapter: string, option: string, value: unknown): string;
167
+ //# sourceMappingURL=objectStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectStore.d.ts","sourceRoot":"","sources":["../../../src/artifacts/objectStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAyB/C;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,MAAM,CAwBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAAG,SAAS,CAgB3E;AAED;;0DAE0D;AAC1D,wB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canonicalPayloadBytes(data: unknown): Uint8Array;
30
30
  /** Payload size in bytes — UTF-8 for text/JSON, byteLength for binary. */
31
31
  export declare function measureArtifactBytes(data: unknown): number;
32
+ /**
33
+ * Which of the three payload shapes a value is. The durable envelope carries
34
+ * it, and so does an object store's metadata — the canonical bytes alone
35
+ * cannot say whether `"7"` was the string `'7'` or the JSON number `7`, and a
36
+ * store that guessed would hand back a different value than it was given.
37
+ */
38
+ export type PayloadShape = 'text' | 'binary' | 'json';
39
+ /** The shape a payload will be stored under. Total: everything that is not a
40
+ * string or a `Uint8Array` rides as JSON (and is refused at measure/encode if
41
+ * JSON cannot carry it). */
42
+ export declare function payloadShapeOf(data: unknown): PayloadShape;
43
+ /**
44
+ * Rebuild a payload from its CANONICAL BYTES and its shape — the read half of
45
+ * `canonicalPayloadBytes`, for stores that hold the bytes themselves (an
46
+ * object body, a stream) rather than the text envelope.
47
+ *
48
+ * Round-trip law: `decodeCanonicalPayload(payloadShapeOf(x),
49
+ * canonicalPayloadBytes(x))` equals `x` for every payload this library
50
+ * accepts — which is what lets `bytes`, the digest, and the stored object all
51
+ * be the same bytes in every adapter.
52
+ */
53
+ export declare function decodeCanonicalPayload(shape: PayloadShape, bytes: Uint8Array): unknown;
32
54
  /** `sha-256:<hex>` over the canonical bytes. */
33
55
  export declare function computeArtifactDigest(data: unknown): Promise<string>;
34
- /** How a payload rides a file or a SQL TEXT column. One shape, two adapters. */
56
+ /** How a payload rides a file or a SQL TEXT column. One shape, two adapters.
57
+ *
58
+ * `'external'` (9.25.0) is the STREAMED case and exists only where a store
59
+ * can hold bytes beside the envelope: the payload is not in `value` at all —
60
+ * `value` names the sibling file that holds it, and the artifact reads back
61
+ * as binary. Only `fileArtifacts` writes it; `decodeArtifactData` refuses it
62
+ * by name, because a decoder that cannot reach the bytes must not pretend. */
35
63
  export interface EncodedPayload {
36
- readonly shape: 'text' | 'binary' | 'json';
37
- /** `text`: the string. `binary`: base64. `json`: the JSON serialization. */
64
+ readonly shape: PayloadShape | 'external';
65
+ /** `text`: the string. `binary`: base64. `json`: the JSON serialization.
66
+ * `external`: the name of the sibling file holding the raw bytes. */
38
67
  readonly value: string;
39
68
  }
40
69
  /** Encode for durable storage. Validates exactly as `measure` does. */
41
70
  export declare function encodeArtifactData(data: unknown): EncodedPayload;
42
- /** Decode what {@link encodeArtifactData} wrote. Total over its own output. */
71
+ /** Decode what {@link encodeArtifactData} wrote. Total over its own output;
72
+ * an `'external'` envelope is the one thing it refuses, by name — the bytes
73
+ * live beside the envelope and only the adapter that wrote them can reach
74
+ * them. */
43
75
  export declare function decodeArtifactData(encoded: EncodedPayload): unknown;
44
76
  //# sourceMappingURL=payload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/artifacts/payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAuB/D;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAE1D;AAED,gDAAgD;AAChD,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAS1E;AAID,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAKhE;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CASnE"}
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/artifacts/payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAuB/D;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAE1D;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtD;;6BAE6B;AAC7B,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAI1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAStF;AAED,gDAAgD;AAChD,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAS1E;AAID;;;;;;+EAM+E;AAC/E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,CAAC;IAC1C;0EACsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAKhE;AAED;;;YAGY;AACZ,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAenE"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * artifacts/recordingArtifact — a finished run, checked into the store like any
3
+ * other payload.
4
+ *
5
+ * `recordRun` has produced `{ snapshot, events, structure }` since 8.x and the
6
+ * lens family has consumed exactly that shape since. What nobody shipped was
7
+ * the boring half in between: WHERE a completed run's recording goes so a
8
+ * screen can ask for it later. Every deployment that wanted the Lens over the
9
+ * wire wrote the same twenty lines — record the run, serialize it, put it
10
+ * somewhere with a key, hand the key to the frontend — and each one wrote a
11
+ * slightly different, slightly wrong version of retention and scoping.
12
+ *
13
+ * All four of those problems already have an answer in this package: the
14
+ * artifact store IS a keyed payload store with scope isolation, retention and
15
+ * a read-only wire. So a recording is simply an artifact of kind
16
+ * `'recording/run'`, and the wire ops that already redeem claim tickets serve
17
+ * it with **zero new operations** — `{ op: 'artifact-get', ref }` returns the
18
+ * recording, and the frontend does what it always did with the bytes.
19
+ *
20
+ * ── Why the payload is TEXT and not an object ───────────────────────────────
21
+ * The recording is minted as its JSON text — the same bytes
22
+ * `JSON.stringify(recorder.toRecording())` produces, which is precisely what
23
+ * `observeRecording(JSON.parse(text))` consumes on the viewer side. Two
24
+ * reasons, and both are about not lying:
25
+ *
26
+ * • `recordRun` states that `snapshot` and `structure` are the runner's OWN
27
+ * objects, held by reference. An in-process store handed those would keep
28
+ * a live view into a finished run's state — the artifact would silently
29
+ * change if anything touched it. Serializing detaches it, once, here.
30
+ * • A recording that cannot be serialized cannot be delivered over any wire
31
+ * either, so failing at the mint is failing at the honest moment rather
32
+ * than at whatever reads it next.
33
+ */
34
+ import type { PutArtifactInput } from './types.js';
35
+ /** The consumer vocabulary a run recording is stored under. One kind, exact
36
+ * match — the same rule every `wants` declaration is judged by. */
37
+ export declare const RECORDING_ARTIFACT_KIND = "recording/run";
38
+ /** The media type a recording is minted with. */
39
+ export declare const RECORDING_MEDIA_TYPE = "application/json";
40
+ /** What a recording mint needs to know beyond the recording itself. */
41
+ export interface RecordingMintFacts {
42
+ /** The run this recording is OF — stamped on `origin.runId`, which is the
43
+ * join back to the trace. */
44
+ readonly runId?: string;
45
+ /**
46
+ * The operator's label, when they set one.
47
+ *
48
+ * Used VERBATIM when present: an operator who named their recordings meant
49
+ * that name, and a library that decorated it would be overruling them. The
50
+ * consequence is worth stating — a static label repeats on every run, and
51
+ * what distinguishes two recordings is the ref and `origin.runId`, never the
52
+ * label. With no label the composed one names the run, which is the most
53
+ * useful honest sentence available at mint time.
54
+ */
55
+ readonly label?: string;
56
+ }
57
+ /**
58
+ * Raised when a recording could not be turned into bytes.
59
+ *
60
+ * Its own class because the CALLER's answer differs from every other mint
61
+ * failure: a full store is retryable and a cyclic snapshot is not.
62
+ */
63
+ export declare class UnserializableRecordingError extends Error {
64
+ readonly code: "ERR_UNSERIALIZABLE_RECORDING";
65
+ constructor(detail: string);
66
+ }
67
+ /**
68
+ * Turn one finished recording into the `put` input that stores it.
69
+ *
70
+ * Pure: no store, no events, no agent. The caller owns WHEN this happens (after
71
+ * the answer is composed) and what to do when it fails.
72
+ *
73
+ * @throws UnserializableRecordingError when the recording cannot be
74
+ * JSON-serialized — a cyclic object in a snapshot, most likely.
75
+ */
76
+ export declare function recordingPutInput(recording: unknown, facts?: RecordingMintFacts): PutArtifactInput;
77
+ //# sourceMappingURL=recordingArtifact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordingArtifact.d.ts","sourceRoot":"","sources":["../../../src/artifacts/recordingArtifact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;oEACoE;AACpE,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD,iDAAiD;AACjD,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAEvD,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC;kCAC8B;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,iCAA2C;gBAE5C,MAAM,EAAE,MAAM;CAS3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,OAAO,EAClB,KAAK,GAAE,kBAAuB,GAC7B,gBAAgB,CAiBlB"}