@aexhq/sdk 0.46.5-canary → 0.51.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 (346) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +38 -0
  3. package/README.md +54 -29
  4. package/dist/client/aex.d.ts +33 -0
  5. package/dist/client/aex.js +108 -0
  6. package/dist/client/aex.js.map +1 -0
  7. package/dist/client/credentials.d.ts +25 -0
  8. package/dist/client/credentials.js +97 -0
  9. package/dist/client/credentials.js.map +1 -0
  10. package/dist/client/routing.d.ts +7 -0
  11. package/dist/client/routing.js +29 -0
  12. package/dist/client/routing.js.map +1 -0
  13. package/dist/downloads/download.d.ts +18 -0
  14. package/dist/downloads/download.js +67 -0
  15. package/dist/downloads/download.js.map +1 -0
  16. package/dist/generated/errors.d.ts +12 -0
  17. package/dist/generated/errors.js +82 -0
  18. package/dist/generated/errors.js.map +1 -0
  19. package/dist/generated/models.d.ts +1392 -0
  20. package/dist/generated/models.js +62 -0
  21. package/dist/generated/models.js.map +1 -0
  22. package/dist/generated/resources.d.ts +710 -0
  23. package/dist/generated/resources.js +582 -0
  24. package/dist/generated/resources.js.map +1 -0
  25. package/dist/generated/routes.d.ts +44 -0
  26. package/dist/generated/routes.js +1905 -0
  27. package/dist/generated/routes.js.map +1 -0
  28. package/dist/index.d.ts +21 -50
  29. package/dist/index.js +14 -62
  30. package/dist/index.js.map +1 -1
  31. package/dist/node/session-file-limits.d.ts +4 -0
  32. package/dist/node/session-file-limits.js +7 -0
  33. package/dist/node/session-file-limits.js.map +1 -0
  34. package/dist/node/session-files.d.ts +80 -0
  35. package/dist/node/session-files.js +254 -0
  36. package/dist/node/session-files.js.map +1 -0
  37. package/dist/observations/stream.d.ts +1 -0
  38. package/dist/observations/stream.js +18 -0
  39. package/dist/observations/stream.js.map +1 -0
  40. package/dist/transport/errors.d.ts +60 -0
  41. package/dist/transport/errors.js +107 -0
  42. package/dist/transport/errors.js.map +1 -0
  43. package/dist/transport/pagination.d.ts +8 -0
  44. package/dist/transport/pagination.js +34 -0
  45. package/dist/transport/pagination.js.map +1 -0
  46. package/dist/transport/retry.d.ts +21 -0
  47. package/dist/transport/retry.js +37 -0
  48. package/dist/transport/retry.js.map +1 -0
  49. package/dist/transport/transport.d.ts +25 -0
  50. package/dist/transport/transport.js +33 -0
  51. package/dist/transport/transport.js.map +1 -0
  52. package/package.json +67 -30
  53. package/dist/_contracts/account-operations.d.ts +0 -101
  54. package/dist/_contracts/account-operations.js +0 -242
  55. package/dist/_contracts/account-types.d.ts +0 -461
  56. package/dist/_contracts/account-types.js +0 -1
  57. package/dist/_contracts/api-key.d.ts +0 -61
  58. package/dist/_contracts/api-key.js +0 -101
  59. package/dist/_contracts/api-routes.d.ts +0 -20
  60. package/dist/_contracts/api-routes.js +0 -109
  61. package/dist/_contracts/archive-limits.d.ts +0 -3
  62. package/dist/_contracts/archive-limits.js +0 -23
  63. package/dist/_contracts/asset-authoring.d.ts +0 -22
  64. package/dist/_contracts/asset-authoring.js +0 -106
  65. package/dist/_contracts/asset-bundle.d.ts +0 -64
  66. package/dist/_contracts/asset-bundle.js +0 -263
  67. package/dist/_contracts/asset-upload-helper.d.ts +0 -31
  68. package/dist/_contracts/asset-upload-helper.js +0 -84
  69. package/dist/_contracts/billing-admission.d.ts +0 -29
  70. package/dist/_contracts/billing-admission.js +0 -28
  71. package/dist/_contracts/bundle-manifest.d.ts +0 -89
  72. package/dist/_contracts/bundle-manifest.js +0 -158
  73. package/dist/_contracts/canonical-sha256.d.ts +0 -8
  74. package/dist/_contracts/canonical-sha256.js +0 -8
  75. package/dist/_contracts/connection-ticket.d.ts +0 -22
  76. package/dist/_contracts/connection-ticket.js +0 -54
  77. package/dist/_contracts/continuation-event.d.ts +0 -31
  78. package/dist/_contracts/continuation-event.js +0 -6
  79. package/dist/_contracts/contract-parse-error.d.ts +0 -12
  80. package/dist/_contracts/contract-parse-error.js +0 -51
  81. package/dist/_contracts/error-codes.d.ts +0 -26
  82. package/dist/_contracts/error-codes.js +0 -116
  83. package/dist/_contracts/error-factory.d.ts +0 -32
  84. package/dist/_contracts/error-factory.js +0 -174
  85. package/dist/_contracts/event-envelope.d.ts +0 -471
  86. package/dist/_contracts/event-envelope.js +0 -501
  87. package/dist/_contracts/event-stream-client.d.ts +0 -122
  88. package/dist/_contracts/event-stream-client.js +0 -445
  89. package/dist/_contracts/event-view.d.ts +0 -44
  90. package/dist/_contracts/event-view.js +0 -69
  91. package/dist/_contracts/failure-class.d.ts +0 -29
  92. package/dist/_contracts/failure-class.js +0 -73
  93. package/dist/_contracts/http.d.ts +0 -135
  94. package/dist/_contracts/http.js +0 -434
  95. package/dist/_contracts/ids.d.ts +0 -66
  96. package/dist/_contracts/ids.js +0 -119
  97. package/dist/_contracts/index.d.ts +0 -42
  98. package/dist/_contracts/index.js +0 -52
  99. package/dist/_contracts/internal.d.ts +0 -55
  100. package/dist/_contracts/internal.js +0 -113
  101. package/dist/_contracts/models.d.ts +0 -30
  102. package/dist/_contracts/models.js +0 -28
  103. package/dist/_contracts/operation-core.d.ts +0 -36
  104. package/dist/_contracts/operation-core.js +0 -70
  105. package/dist/_contracts/operations.d.ts +0 -218
  106. package/dist/_contracts/operations.js +0 -1496
  107. package/dist/_contracts/otlp-projection.d.ts +0 -78
  108. package/dist/_contracts/otlp-projection.js +0 -171
  109. package/dist/_contracts/post-hook.d.ts +0 -31
  110. package/dist/_contracts/post-hook.js +0 -61
  111. package/dist/_contracts/provider-fault.d.ts +0 -34
  112. package/dist/_contracts/provider-fault.js +0 -68
  113. package/dist/_contracts/retry-core.d.ts +0 -29
  114. package/dist/_contracts/retry-core.js +0 -79
  115. package/dist/_contracts/runner-event.d.ts +0 -117
  116. package/dist/_contracts/runner-event.js +0 -172
  117. package/dist/_contracts/runtime-kind.d.ts +0 -60
  118. package/dist/_contracts/runtime-kind.js +0 -70
  119. package/dist/_contracts/runtime-manifest.d.ts +0 -121
  120. package/dist/_contracts/runtime-manifest.js +0 -83
  121. package/dist/_contracts/runtime-security-profile.d.ts +0 -26
  122. package/dist/_contracts/runtime-security-profile.js +0 -73
  123. package/dist/_contracts/runtime-sizes.d.ts +0 -104
  124. package/dist/_contracts/runtime-sizes.js +0 -111
  125. package/dist/_contracts/runtime-types.d.ts +0 -618
  126. package/dist/_contracts/runtime-types.js +0 -58
  127. package/dist/_contracts/schemas/asset-bundle.d.ts +0 -70
  128. package/dist/_contracts/schemas/asset-bundle.js +0 -107
  129. package/dist/_contracts/schemas/asset-ref.d.ts +0 -61
  130. package/dist/_contracts/schemas/asset-ref.js +0 -118
  131. package/dist/_contracts/schemas/bundle-manifest.d.ts +0 -66
  132. package/dist/_contracts/schemas/bundle-manifest.js +0 -77
  133. package/dist/_contracts/schemas/index.d.ts +0 -32
  134. package/dist/_contracts/schemas/index.js +0 -30
  135. package/dist/_contracts/schemas/mcp-server.d.ts +0 -99
  136. package/dist/_contracts/schemas/mcp-server.js +0 -209
  137. package/dist/_contracts/schemas/models.d.ts +0 -29
  138. package/dist/_contracts/schemas/models.js +0 -51
  139. package/dist/_contracts/schemas/numeric.d.ts +0 -18
  140. package/dist/_contracts/schemas/numeric.js +0 -28
  141. package/dist/_contracts/schemas/post-hook.d.ts +0 -45
  142. package/dist/_contracts/schemas/post-hook.js +0 -68
  143. package/dist/_contracts/schemas/response-assets.d.ts +0 -75
  144. package/dist/_contracts/schemas/response-assets.js +0 -81
  145. package/dist/_contracts/schemas/response-billing.d.ts +0 -208
  146. package/dist/_contracts/schemas/response-billing.js +0 -139
  147. package/dist/_contracts/schemas/response-common.d.ts +0 -132
  148. package/dist/_contracts/schemas/response-common.js +0 -162
  149. package/dist/_contracts/schemas/response-identity.d.ts +0 -648
  150. package/dist/_contracts/schemas/response-identity.js +0 -131
  151. package/dist/_contracts/schemas/response-mcp-servers.d.ts +0 -51
  152. package/dist/_contracts/schemas/response-mcp-servers.js +0 -32
  153. package/dist/_contracts/schemas/response-secrets.d.ts +0 -50
  154. package/dist/_contracts/schemas/response-secrets.js +0 -32
  155. package/dist/_contracts/schemas/response-sessions-internal.d.ts +0 -200
  156. package/dist/_contracts/schemas/response-sessions-internal.js +0 -142
  157. package/dist/_contracts/schemas/response-sessions.d.ts +0 -1598
  158. package/dist/_contracts/schemas/response-sessions.js +0 -377
  159. package/dist/_contracts/schemas/response-webhooks.d.ts +0 -76
  160. package/dist/_contracts/schemas/response-webhooks.js +0 -42
  161. package/dist/_contracts/schemas/response-workspace.d.ts +0 -225
  162. package/dist/_contracts/schemas/response-workspace.js +0 -99
  163. package/dist/_contracts/schemas/runtime-kind.d.ts +0 -31
  164. package/dist/_contracts/schemas/runtime-kind.js +0 -29
  165. package/dist/_contracts/schemas/runtime-security-profile.d.ts +0 -28
  166. package/dist/_contracts/schemas/runtime-security-profile.js +0 -26
  167. package/dist/_contracts/schemas/runtime-sizes.d.ts +0 -70
  168. package/dist/_contracts/schemas/runtime-sizes.js +0 -127
  169. package/dist/_contracts/schemas/session-limits.d.ts +0 -34
  170. package/dist/_contracts/schemas/session-limits.js +0 -39
  171. package/dist/_contracts/schemas/session-machine.d.ts +0 -23
  172. package/dist/_contracts/schemas/session-machine.js +0 -24
  173. package/dist/_contracts/schemas/session-request-config.d.ts +0 -58
  174. package/dist/_contracts/schemas/session-request-config.js +0 -134
  175. package/dist/_contracts/schemas/session-webhook.d.ts +0 -11
  176. package/dist/_contracts/schemas/session-webhook.js +0 -38
  177. package/dist/_contracts/schemas/side-effect-audit.d.ts +0 -98
  178. package/dist/_contracts/schemas/side-effect-audit.js +0 -102
  179. package/dist/_contracts/schemas/submission-assets.d.ts +0 -117
  180. package/dist/_contracts/schemas/submission-assets.js +0 -147
  181. package/dist/_contracts/schemas/submission-body.d.ts +0 -251
  182. package/dist/_contracts/schemas/submission-body.js +0 -378
  183. package/dist/_contracts/schemas/submission-environment.d.ts +0 -79
  184. package/dist/_contracts/schemas/submission-environment.js +0 -179
  185. package/dist/_contracts/schemas/submission-request.d.ts +0 -158
  186. package/dist/_contracts/schemas/submission-request.js +0 -49
  187. package/dist/_contracts/schemas/submission-secrets.d.ts +0 -47
  188. package/dist/_contracts/schemas/submission-secrets.js +0 -108
  189. package/dist/_contracts/schemas/wire.d.ts +0 -118
  190. package/dist/_contracts/schemas/wire.js +0 -171
  191. package/dist/_contracts/schemas/workspace-resources.d.ts +0 -50
  192. package/dist/_contracts/schemas/workspace-resources.js +0 -87
  193. package/dist/_contracts/sdk-errors.d.ts +0 -212
  194. package/dist/_contracts/sdk-errors.js +0 -313
  195. package/dist/_contracts/sdk-secrets.d.ts +0 -67
  196. package/dist/_contracts/sdk-secrets.js +0 -427
  197. package/dist/_contracts/session-archive.d.ts +0 -16
  198. package/dist/_contracts/session-archive.js +0 -92
  199. package/dist/_contracts/session-artifacts.d.ts +0 -189
  200. package/dist/_contracts/session-artifacts.js +0 -264
  201. package/dist/_contracts/session-config.d.ts +0 -373
  202. package/dist/_contracts/session-config.js +0 -562
  203. package/dist/_contracts/session-cost-types.d.ts +0 -211
  204. package/dist/_contracts/session-cost-types.js +0 -69
  205. package/dist/_contracts/session-cost.d.ts +0 -8
  206. package/dist/_contracts/session-cost.js +0 -582
  207. package/dist/_contracts/session-custody.d.ts +0 -165
  208. package/dist/_contracts/session-custody.js +0 -345
  209. package/dist/_contracts/session-file-query.d.ts +0 -14
  210. package/dist/_contracts/session-file-query.js +0 -178
  211. package/dist/_contracts/session-record.d.ts +0 -112
  212. package/dist/_contracts/session-record.js +0 -165
  213. package/dist/_contracts/session-retention.d.ts +0 -201
  214. package/dist/_contracts/session-retention.js +0 -450
  215. package/dist/_contracts/side-effect-audit.d.ts +0 -126
  216. package/dist/_contracts/side-effect-audit.js +0 -520
  217. package/dist/_contracts/sse.d.ts +0 -74
  218. package/dist/_contracts/sse.js +0 -227
  219. package/dist/_contracts/stable.d.ts +0 -45
  220. package/dist/_contracts/stable.js +0 -62
  221. package/dist/_contracts/status.d.ts +0 -25
  222. package/dist/_contracts/status.js +0 -57
  223. package/dist/_contracts/submission-limits.d.ts +0 -61
  224. package/dist/_contracts/submission-limits.js +0 -60
  225. package/dist/_contracts/submission.d.ts +0 -547
  226. package/dist/_contracts/submission.js +0 -812
  227. package/dist/_contracts/suggest.d.ts +0 -15
  228. package/dist/_contracts/suggest.js +0 -53
  229. package/dist/_contracts/testing/response-bindings.d.ts +0 -45
  230. package/dist/_contracts/testing/response-bindings.js +0 -256
  231. package/dist/_contracts/testing/wire-conformance-entry.d.ts +0 -10
  232. package/dist/_contracts/testing/wire-conformance-entry.js +0 -8
  233. package/dist/_contracts/testing/wire-conformance.d.ts +0 -169
  234. package/dist/_contracts/testing/wire-conformance.js +0 -276
  235. package/dist/_contracts/turn-trace.d.ts +0 -28
  236. package/dist/_contracts/turn-trace.js +0 -1
  237. package/dist/_contracts/unknown-field-error.d.ts +0 -13
  238. package/dist/_contracts/unknown-field-error.js +0 -21
  239. package/dist/_contracts/value-guards.d.ts +0 -20
  240. package/dist/_contracts/value-guards.js +0 -34
  241. package/dist/_contracts/webhook-verify.d.ts +0 -34
  242. package/dist/_contracts/webhook-verify.js +0 -93
  243. package/dist/_contracts/wire-observer.d.ts +0 -49
  244. package/dist/_contracts/wire-observer.js +0 -34
  245. package/dist/_contracts/workflow-status.d.ts +0 -7
  246. package/dist/_contracts/workflow-status.js +0 -43
  247. package/dist/_contracts/workspace-resources.d.ts +0 -98
  248. package/dist/_contracts/workspace-resources.js +0 -39
  249. package/dist/archive-limits.d.ts +0 -1
  250. package/dist/archive-limits.js +0 -2
  251. package/dist/archive-limits.js.map +0 -1
  252. package/dist/asset-upload.d.ts +0 -47
  253. package/dist/asset-upload.js +0 -269
  254. package/dist/asset-upload.js.map +0 -1
  255. package/dist/bundle.d.ts +0 -9
  256. package/dist/bundle.js +0 -20
  257. package/dist/bundle.js.map +0 -1
  258. package/dist/canonical-zip.d.ts +0 -68
  259. package/dist/canonical-zip.js +0 -355
  260. package/dist/canonical-zip.js.map +0 -1
  261. package/dist/cli.mjs +0 -12048
  262. package/dist/cli.mjs.sha256 +0 -1
  263. package/dist/client-types.d.ts +0 -192
  264. package/dist/client-types.js +0 -2
  265. package/dist/client-types.js.map +0 -1
  266. package/dist/client.d.ts +0 -464
  267. package/dist/client.js +0 -1207
  268. package/dist/client.js.map +0 -1
  269. package/dist/event-projection.d.ts +0 -22
  270. package/dist/event-projection.js +0 -380
  271. package/dist/event-projection.js.map +0 -1
  272. package/dist/fetch-archive.d.ts +0 -16
  273. package/dist/fetch-archive.js +0 -252
  274. package/dist/fetch-archive.js.map +0 -1
  275. package/dist/file.d.ts +0 -96
  276. package/dist/file.js +0 -272
  277. package/dist/file.js.map +0 -1
  278. package/dist/instructions.d.ts +0 -20
  279. package/dist/instructions.js +0 -40
  280. package/dist/instructions.js.map +0 -1
  281. package/dist/legacy-session-provider-fault.d.ts +0 -7
  282. package/dist/legacy-session-provider-fault.js +0 -38
  283. package/dist/legacy-session-provider-fault.js.map +0 -1
  284. package/dist/mcp-server.d.ts +0 -84
  285. package/dist/mcp-server.js +0 -117
  286. package/dist/mcp-server.js.map +0 -1
  287. package/dist/node-fs.d.ts +0 -29
  288. package/dist/node-fs.js +0 -19
  289. package/dist/node-fs.js.map +0 -1
  290. package/dist/node-walk.d.ts +0 -69
  291. package/dist/node-walk.js +0 -151
  292. package/dist/node-walk.js.map +0 -1
  293. package/dist/path-basename.d.ts +0 -5
  294. package/dist/path-basename.js +0 -9
  295. package/dist/path-basename.js.map +0 -1
  296. package/dist/retry.d.ts +0 -70
  297. package/dist/retry.js +0 -155
  298. package/dist/retry.js.map +0 -1
  299. package/dist/secret.d.ts +0 -65
  300. package/dist/secret.js +0 -110
  301. package/dist/secret.js.map +0 -1
  302. package/dist/session-validate.d.ts +0 -100
  303. package/dist/session-validate.js +0 -303
  304. package/dist/session-validate.js.map +0 -1
  305. package/dist/skill.d.ts +0 -99
  306. package/dist/skill.js +0 -169
  307. package/dist/skill.js.map +0 -1
  308. package/dist/submission-wire.d.ts +0 -13
  309. package/dist/submission-wire.js +0 -69
  310. package/dist/submission-wire.js.map +0 -1
  311. package/dist/tool.d.ts +0 -41
  312. package/dist/tool.js +0 -76
  313. package/dist/tool.js.map +0 -1
  314. package/dist/version.d.ts +0 -9
  315. package/dist/version.js +0 -10
  316. package/dist/version.js.map +0 -1
  317. package/docs/authentication.md +0 -125
  318. package/docs/billing.md +0 -164
  319. package/docs/cleanup.md +0 -27
  320. package/docs/concepts/agent-tools.md +0 -47
  321. package/docs/concepts/composition.md +0 -60
  322. package/docs/concepts/providers-and-runtimes.md +0 -121
  323. package/docs/concepts/sessions.md +0 -51
  324. package/docs/concepts/subagents.md +0 -35
  325. package/docs/credentials.md +0 -116
  326. package/docs/defaults.md +0 -51
  327. package/docs/errors.md +0 -258
  328. package/docs/events.md +0 -143
  329. package/docs/files.md +0 -130
  330. package/docs/limits-and-quotas.md +0 -114
  331. package/docs/limits.md +0 -51
  332. package/docs/mcp.md +0 -47
  333. package/docs/networking.md +0 -114
  334. package/docs/provider-runtime-capabilities.md +0 -32
  335. package/docs/public-surface.json +0 -73
  336. package/docs/quickstart.md +0 -135
  337. package/docs/release.md +0 -44
  338. package/docs/retries.md +0 -108
  339. package/docs/secrets.md +0 -141
  340. package/docs/session-config.md +0 -51
  341. package/docs/session-record.md +0 -58
  342. package/docs/skills.md +0 -65
  343. package/docs/telemetry.md +0 -66
  344. package/docs/testing.md +0 -35
  345. package/docs/vision-skills.md +0 -94
  346. package/docs/webhooks.md +0 -143
@@ -1,189 +0,0 @@
1
- /**
2
- * Single source of truth for a session's artifact namespaces.
3
- *
4
- * Every session stores public files and internal diagnostics under its
5
- * workspace-scoped session prefix:
6
- *
7
- * workspaces/<workspaceId>/sessions/<sessionId>/checkpoints/current.json
8
- * workspaces/<workspaceId>/sessions/<sessionId>/checkpoints/<checkpointId>/workspace/index.json
9
- * workspaces/<workspaceId>/sessions/<sessionId>/checkpoints/<checkpointId>/workspace/objects/<fileId>
10
- * workspaces/<workspaceId>/sessions/<sessionId>/internal/logs/<rel>
11
- *
12
- * The latest complete checkpoint is the recovery source and the public files
13
- * source. Diagnostics reach storage as workspace dotdirs (`.runtime-logs/...`,
14
- * `.host-logs/...`, etc.); the stored path uses canonical log namespaces.
15
- */
16
- export declare const WORKSPACES_PREFIX = "workspaces";
17
- export declare const SESSIONS_PREFIX = "sessions";
18
- export declare const SESSION_CHECKPOINTS_PREFIX = "checkpoints";
19
- export declare const SESSION_INTERNAL_PREFIX = "internal";
20
- export declare const SESSION_INTERNAL_LOGS_PREFIX = "internal/logs";
21
- export declare const S3_RETENTION_TAG_KEY = "aex-retention";
22
- export declare const S3_RETENTION_TAG_VALUES: readonly ["session-file-current", "workspace-asset", "session-core", "checkpoint-pending", "checkpoint-superseded", "upload-staging", "internal-log", "internal-event", "internal-usage", "admin-archive"];
23
- export type S3ObjectRetentionTagValue = (typeof S3_RETENTION_TAG_VALUES)[number];
24
- /**
25
- * Internal raw-usage export namespace (cost & usage metering). Lives under
26
- * `internal/` so public downloads never include it by default. Holds
27
- * `SessionUsageSample` ndjson — the durable system of record for raw usage, written
28
- * by the coordinator event stream; the public-safe `session_cost` table holds the summary.
29
- */
30
- export declare const SESSION_INTERNAL_USAGE_PREFIX = "internal/usage";
31
- /** Object-key prefix (trailing slash) every session-local object for a session lives under. */
32
- export declare function runSessionPrefix(workspaceId: string, sessionId: string): string;
33
- /** Object key for a session's raw-usage ndjson chunk (n = monotonic chunk index). */
34
- export declare function runInternalUsageKey(workspaceId: string, sessionId: string, chunk: number): string;
35
- /** Object-key prefix (trailing slash) for a session's current-file checkpoints. */
36
- export declare function runCheckpointPrefix(workspaceId: string, sessionId: string): string;
37
- /** Pointer to the latest complete checkpoint. Written last during checkpoint commit. */
38
- export declare function runCheckpointCurrentKey(workspaceId: string, sessionId: string): string;
39
- /** Optional compact list of available checkpoints for admin/debug views. */
40
- export declare function runCheckpointIndexKey(workspaceId: string, sessionId: string): string;
41
- export declare function runCheckpointManifestKey(workspaceId: string, sessionId: string, checkpointId: string): string;
42
- export declare function runCheckpointWorkspaceIndexKey(workspaceId: string, sessionId: string, checkpointId: string): string;
43
- export declare function runCheckpointWorkspaceObjectKey(workspaceId: string, sessionId: string, checkpointId: string, fileId: string): string;
44
- export declare function runCheckpointBrainJournalKey(workspaceId: string, sessionId: string, checkpointId: string): string;
45
- export declare function runCheckpointBrainStateKey(workspaceId: string, sessionId: string, checkpointId: string): string;
46
- /** Object-key prefix (trailing slash) for operator-built archive zips for a session. */
47
- export declare function runAdminArchivePrefix(workspaceId: string, sessionId: string): string;
48
- /** Object-key prefix (trailing slash) for generated event archive files for a session. */
49
- export declare function runEventArchivePrefix(workspaceId: string, sessionId: string): string;
50
- /**
51
- * Relative-path prefixes that mark a stored artifact as a platform diagnostic
52
- * rather than a session deliverable. Dotted forms are upload-time paths.
53
- */
54
- export declare const SESSION_LOG_REL_PREFIXES: readonly [".runtime-logs/", ".host-logs/", ".provider-proxy/", ".control-plane/", ".anthropic-debug/", "runtime/", "host/", "provider-proxy/", "control-plane/", "anthropic-debug/"];
55
- /** True when a workspace-relative artifact path belongs to the internal logs namespace. */
56
- export declare function isSessionLogRelPath(rel: string): boolean;
57
- /**
58
- * The artifact's path relative to its namespace prefix as stored. Diagnostics
59
- * are canonicalized (`.runtime-logs/x` -> `runtime/x`).
60
- */
61
- export declare function sessionArtifactRel(rel: string): string;
62
- /**
63
- * Storage key for a session artifact uploaded with relative path `rel`, routing
64
- * diagnostics into `internal/logs/`. Workspace files are stored by checkpoint
65
- * helpers, not by this function.
66
- */
67
- export declare function sessionInternalArtifactKey(workspaceId: string, sessionId: string, rel: string): string;
68
- /**
69
- * Opaque, non-reversible file id. Derived as SHA-256 hex of
70
- * `sessionId:relPath` so a caller cannot construct an id by guessing a filename.
71
- * It is the single id scheme for session files: the checkpoint index records it,
72
- * the list route emits it, the download/link routes resolve it back to a path
73
- * from the latest checkpoint index, and the object key uses it directly. Hex is
74
- * URL-safe. WebCrypto, no new dep.
75
- */
76
- export declare function opaqueSessionFileId(sessionId: string, relPath: string): Promise<string>;
77
- export interface SessionCheckpointCurrent {
78
- readonly v: 2;
79
- readonly workspaceId: string;
80
- readonly sessionId: string;
81
- readonly checkpointId: string;
82
- readonly runId: string;
83
- readonly turnSeq: number;
84
- readonly manifestKey: string;
85
- readonly committedAt: string;
86
- readonly throughSeq: number;
87
- }
88
- /** Public identity of one complete, immutable session-files checkpoint. */
89
- export interface SessionCheckpointRevision {
90
- readonly checkpointId: string;
91
- readonly runId: string;
92
- readonly turnSeq: number;
93
- readonly committedAt: string;
94
- readonly throughSeq: number;
95
- }
96
- export interface SessionCheckpointIndex {
97
- readonly v: 2;
98
- readonly workspaceId: string;
99
- readonly sessionId: string;
100
- readonly currentCheckpointId: string;
101
- readonly checkpoints: readonly SessionCheckpointIndexEntry[];
102
- }
103
- export interface SessionCheckpointIndexEntry {
104
- readonly checkpointId: string;
105
- readonly runId: string;
106
- readonly turnSeq: number;
107
- readonly manifestKey: string;
108
- readonly committedAt: string;
109
- readonly throughSeq: number;
110
- readonly fileCount: number;
111
- readonly totalBytes: number;
112
- }
113
- export interface SessionCheckpointManifest {
114
- readonly v: 2;
115
- readonly workspaceId: string;
116
- readonly sessionId: string;
117
- readonly checkpointId: string;
118
- readonly runId: string;
119
- readonly turnSeq: number;
120
- readonly status: "complete";
121
- readonly createdAt: string;
122
- readonly committedAt: string;
123
- readonly throughSeq: number;
124
- readonly workspace: {
125
- readonly indexKey: string;
126
- readonly fileCount: number;
127
- readonly totalBytes: number;
128
- };
129
- readonly brain?: {
130
- readonly journalKey?: string;
131
- readonly stateKey?: string;
132
- };
133
- }
134
- export interface SessionWorkspaceFile {
135
- readonly fileId: string;
136
- readonly path: string;
137
- readonly sizeBytes: number;
138
- readonly contentType: string;
139
- readonly objectKey: string;
140
- readonly sha256: string;
141
- readonly createdAt: string;
142
- }
143
- export interface SessionCheckpointWorkspaceIndex {
144
- readonly v: 2;
145
- readonly workspaceId: string;
146
- readonly sessionId: string;
147
- readonly checkpointId: string;
148
- readonly runId: string;
149
- readonly turnSeq: number;
150
- readonly fileCount: number;
151
- readonly totalBytes: number;
152
- readonly files: readonly SessionWorkspaceFile[];
153
- }
154
- /** The `asset_` id form the API emits for a workspace asset. */
155
- export declare const WORKSPACE_ASSET_ID_PREFIX: "asset_";
156
- /** The `sha256:` content-hash URI form carried on pinned resource versions. */
157
- export declare const WORKSPACE_ASSET_HASH_URI_PREFIX: "sha256:";
158
- /**
159
- * Either the canonical key for a valid asset id, or an explicit rejection. There
160
- * is no third outcome and no permissive variant: an id the API answers 400 for
161
- * must not silently become a readable object key on the client side.
162
- */
163
- export type WorkspaceAssetKeyResult = {
164
- readonly ok: true;
165
- readonly key: string;
166
- readonly assetId: string;
167
- } | {
168
- readonly ok: false;
169
- };
170
- /**
171
- * Storage key for a workspace's snapshotted asset, addressed by its content hash.
172
- * Used only for pre-checkpoint reusable workspace assets; session boot
173
- * materializes those assets into an initial checkpoint before execution.
174
- *
175
- * Accepts `asset_<hex>`, `sha256:<hex>`, and the bare hex, and rejects everything
176
- * else. This repo cannot import the platform's owner module, so this is a
177
- * DELIBERATE MIRROR held byte-identical by a cross-repo parity test
178
- * (`platform/scripts/validate/object-store-key-public-parity.test.ts`). Change
179
- * one side and that test fails; do not change one side alone.
180
- */
181
- export declare function workspaceAssetKey(workspaceId: string, rawAssetId: string): WorkspaceAssetKeyResult;
182
- /**
183
- * Retention class for an S3 key. Writers set this as the `aex-retention` object
184
- * tag so bucket lifecycle rules can apply per logical namespace even though the
185
- * useful category sits after dynamic workspace/session ids.
186
- */
187
- export declare function s3ObjectRetentionTagValue(key: string): S3ObjectRetentionTagValue | undefined;
188
- /** S3 PutObject/CreateMultipartUpload/Upload `Tagging` header value for a key. */
189
- export declare function s3ObjectRetentionTaggingHeader(key: string): string | undefined;
@@ -1,264 +0,0 @@
1
- /**
2
- * Single source of truth for a session's artifact namespaces.
3
- *
4
- * Every session stores public files and internal diagnostics under its
5
- * workspace-scoped session prefix:
6
- *
7
- * workspaces/<workspaceId>/sessions/<sessionId>/checkpoints/current.json
8
- * workspaces/<workspaceId>/sessions/<sessionId>/checkpoints/<checkpointId>/workspace/index.json
9
- * workspaces/<workspaceId>/sessions/<sessionId>/checkpoints/<checkpointId>/workspace/objects/<fileId>
10
- * workspaces/<workspaceId>/sessions/<sessionId>/internal/logs/<rel>
11
- *
12
- * The latest complete checkpoint is the recovery source and the public files
13
- * source. Diagnostics reach storage as workspace dotdirs (`.runtime-logs/...`,
14
- * `.host-logs/...`, etc.); the stored path uses canonical log namespaces.
15
- */
16
- export const WORKSPACES_PREFIX = "workspaces";
17
- export const SESSIONS_PREFIX = "sessions";
18
- export const SESSION_CHECKPOINTS_PREFIX = "checkpoints";
19
- export const SESSION_INTERNAL_PREFIX = "internal";
20
- export const SESSION_INTERNAL_LOGS_PREFIX = `${SESSION_INTERNAL_PREFIX}/logs`;
21
- export const S3_RETENTION_TAG_KEY = "aex-retention";
22
- export const S3_RETENTION_TAG_VALUES = [
23
- "session-file-current",
24
- "workspace-asset",
25
- "session-core",
26
- "checkpoint-pending",
27
- "checkpoint-superseded",
28
- "upload-staging",
29
- "internal-log",
30
- "internal-event",
31
- "internal-usage",
32
- "admin-archive"
33
- ];
34
- /**
35
- * Internal raw-usage export namespace (cost & usage metering). Lives under
36
- * `internal/` so public downloads never include it by default. Holds
37
- * `SessionUsageSample` ndjson — the durable system of record for raw usage, written
38
- * by the coordinator event stream; the public-safe `session_cost` table holds the summary.
39
- */
40
- export const SESSION_INTERNAL_USAGE_PREFIX = `${SESSION_INTERNAL_PREFIX}/usage`;
41
- /** Object-key prefix (trailing slash) every session-local object for a session lives under. */
42
- export function runSessionPrefix(workspaceId, sessionId) {
43
- return `${WORKSPACES_PREFIX}/${workspaceId}/${SESSIONS_PREFIX}/${sessionId}/`;
44
- }
45
- /** Object key for a session's raw-usage ndjson chunk (n = monotonic chunk index). */
46
- export function runInternalUsageKey(workspaceId, sessionId, chunk) {
47
- return `${runSessionPrefix(workspaceId, sessionId)}${SESSION_INTERNAL_USAGE_PREFIX}/${chunk}.ndjson`;
48
- }
49
- /** Object-key prefix (trailing slash) for a session's current-file checkpoints. */
50
- export function runCheckpointPrefix(workspaceId, sessionId) {
51
- return `${runSessionPrefix(workspaceId, sessionId)}${SESSION_CHECKPOINTS_PREFIX}/`;
52
- }
53
- /** Pointer to the latest complete checkpoint. Written last during checkpoint commit. */
54
- export function runCheckpointCurrentKey(workspaceId, sessionId) {
55
- return `${runCheckpointPrefix(workspaceId, sessionId)}current.json`;
56
- }
57
- /** Optional compact list of available checkpoints for admin/debug views. */
58
- export function runCheckpointIndexKey(workspaceId, sessionId) {
59
- return `${runCheckpointPrefix(workspaceId, sessionId)}index.json`;
60
- }
61
- export function runCheckpointManifestKey(workspaceId, sessionId, checkpointId) {
62
- return `${runCheckpointPrefix(workspaceId, sessionId)}${checkpointId}/manifest.json`;
63
- }
64
- export function runCheckpointWorkspaceIndexKey(workspaceId, sessionId, checkpointId) {
65
- return `${runCheckpointPrefix(workspaceId, sessionId)}${checkpointId}/workspace/index.json`;
66
- }
67
- export function runCheckpointWorkspaceObjectKey(workspaceId, sessionId, checkpointId, fileId) {
68
- return `${runCheckpointPrefix(workspaceId, sessionId)}${checkpointId}/workspace/objects/${fileId}`;
69
- }
70
- export function runCheckpointBrainJournalKey(workspaceId, sessionId, checkpointId) {
71
- return `${runCheckpointPrefix(workspaceId, sessionId)}${checkpointId}/brain/journal.jsonl`;
72
- }
73
- export function runCheckpointBrainStateKey(workspaceId, sessionId, checkpointId) {
74
- return `${runCheckpointPrefix(workspaceId, sessionId)}${checkpointId}/brain/state.json`;
75
- }
76
- /** Object-key prefix (trailing slash) for operator-built archive zips for a session. */
77
- export function runAdminArchivePrefix(workspaceId, sessionId) {
78
- return `${runSessionPrefix(workspaceId, sessionId)}${SESSION_INTERNAL_PREFIX}/admin-archives/`;
79
- }
80
- /** Object-key prefix (trailing slash) for generated event archive files for a session. */
81
- export function runEventArchivePrefix(workspaceId, sessionId) {
82
- return `${runSessionPrefix(workspaceId, sessionId)}${SESSION_INTERNAL_PREFIX}/events/`;
83
- }
84
- /**
85
- * Relative-path prefixes that mark a stored artifact as a platform diagnostic
86
- * rather than a session deliverable. Dotted forms are upload-time paths.
87
- */
88
- export const SESSION_LOG_REL_PREFIXES = [
89
- ".runtime-logs/",
90
- ".host-logs/",
91
- ".provider-proxy/",
92
- ".control-plane/",
93
- ".anthropic-debug/",
94
- "runtime/",
95
- "host/",
96
- "provider-proxy/",
97
- "control-plane/",
98
- "anthropic-debug/"
99
- ];
100
- /** True when a workspace-relative artifact path belongs to the internal logs namespace. */
101
- export function isSessionLogRelPath(rel) {
102
- return SESSION_LOG_REL_PREFIXES.some((prefix) => matchesRelPrefix(rel, prefix));
103
- }
104
- /**
105
- * The artifact's path relative to its namespace prefix as stored. Diagnostics
106
- * are canonicalized (`.runtime-logs/x` -> `runtime/x`).
107
- */
108
- export function sessionArtifactRel(rel) {
109
- if (rel.startsWith(".runtime-logs/"))
110
- return `runtime/${rel.slice(".runtime-logs/".length)}`;
111
- if (rel.startsWith("runtime/"))
112
- return rel;
113
- if (rel.startsWith(".host-logs/"))
114
- return `host/${rel.slice(".host-logs/".length)}`;
115
- if (rel.startsWith("host/"))
116
- return rel;
117
- if (rel.startsWith(".provider-proxy/"))
118
- return `provider-proxy/${rel.slice(".provider-proxy/".length)}`;
119
- if (rel.startsWith("provider-proxy/"))
120
- return rel;
121
- if (rel.startsWith(".control-plane/"))
122
- return `control-plane/${rel.slice(".control-plane/".length)}`;
123
- if (rel.startsWith("control-plane/"))
124
- return rel;
125
- if (rel.startsWith(".anthropic-debug/"))
126
- return `provider-proxy/${rel.slice(".anthropic-debug/".length)}`;
127
- if (rel.startsWith("anthropic-debug/"))
128
- return `provider-proxy/${rel.slice("anthropic-debug/".length)}`;
129
- return rel;
130
- }
131
- /**
132
- * Storage key for a session artifact uploaded with relative path `rel`, routing
133
- * diagnostics into `internal/logs/`. Workspace files are stored by checkpoint
134
- * helpers, not by this function.
135
- */
136
- export function sessionInternalArtifactKey(workspaceId, sessionId, rel) {
137
- return `${runSessionPrefix(workspaceId, sessionId)}${SESSION_INTERNAL_LOGS_PREFIX}/${sessionArtifactRel(rel)}`;
138
- }
139
- /**
140
- * Opaque, non-reversible file id. Derived as SHA-256 hex of
141
- * `sessionId:relPath` so a caller cannot construct an id by guessing a filename.
142
- * It is the single id scheme for session files: the checkpoint index records it,
143
- * the list route emits it, the download/link routes resolve it back to a path
144
- * from the latest checkpoint index, and the object key uses it directly. Hex is
145
- * URL-safe. WebCrypto, no new dep.
146
- */
147
- export async function opaqueSessionFileId(sessionId, relPath) {
148
- const data = new TextEncoder().encode(`${sessionId}:${relPath}`);
149
- const digest = await crypto.subtle.digest("SHA-256", data);
150
- return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("");
151
- }
152
- function matchesRelPrefix(rel, prefix) {
153
- if (prefix.endsWith("/"))
154
- return rel.startsWith(prefix);
155
- return rel === prefix || rel.startsWith(`${prefix}/`);
156
- }
157
- /** The `asset_` id form the API emits for a workspace asset. */
158
- export const WORKSPACE_ASSET_ID_PREFIX = "asset_";
159
- /** The `sha256:` content-hash URI form carried on pinned resource versions. */
160
- export const WORKSPACE_ASSET_HASH_URI_PREFIX = "sha256:";
161
- /** A workspace asset is addressed by a bare lowercase SHA-256 hex digest; nothing else. */
162
- const WORKSPACE_ASSET_HASH_HEX = /^[0-9a-f]{64}$/u;
163
- /**
164
- * Storage key for a workspace's snapshotted asset, addressed by its content hash.
165
- * Used only for pre-checkpoint reusable workspace assets; session boot
166
- * materializes those assets into an initial checkpoint before execution.
167
- *
168
- * Accepts `asset_<hex>`, `sha256:<hex>`, and the bare hex, and rejects everything
169
- * else. This repo cannot import the platform's owner module, so this is a
170
- * DELIBERATE MIRROR held byte-identical by a cross-repo parity test
171
- * (`platform/scripts/validate/object-store-key-public-parity.test.ts`). Change
172
- * one side and that test fails; do not change one side alone.
173
- */
174
- export function workspaceAssetKey(workspaceId, rawAssetId) {
175
- let decoded;
176
- try {
177
- decoded = decodeURIComponent(rawAssetId).trim();
178
- }
179
- catch {
180
- // A malformed percent-escape is an invalid asset id, not an internal error.
181
- return { ok: false };
182
- }
183
- const hex = decoded.startsWith(WORKSPACE_ASSET_ID_PREFIX)
184
- ? decoded.slice(WORKSPACE_ASSET_ID_PREFIX.length)
185
- : decoded.startsWith(WORKSPACE_ASSET_HASH_URI_PREFIX)
186
- ? decoded.slice(WORKSPACE_ASSET_HASH_URI_PREFIX.length)
187
- : decoded;
188
- if (!WORKSPACE_ASSET_HASH_HEX.test(hex))
189
- return { ok: false };
190
- return {
191
- ok: true,
192
- key: `${WORKSPACES_PREFIX}/${workspaceId}/assets/content/${hex}`,
193
- assetId: `${WORKSPACE_ASSET_ID_PREFIX}${hex}`
194
- };
195
- }
196
- /**
197
- * Retention class for an S3 key. Writers set this as the `aex-retention` object
198
- * tag so bucket lifecycle rules can apply per logical namespace even though the
199
- * useful category sits after dynamic workspace/session ids.
200
- */
201
- export function s3ObjectRetentionTagValue(key) {
202
- const normalized = key.replace(/^\/+/, "");
203
- if (normalized.startsWith(`${WORKSPACES_PREFIX}/`)) {
204
- const parts = normalized.split("/");
205
- if (parts[2] === "assets" && parts[3] === "content" && parts.length >= 5)
206
- return "workspace-asset";
207
- if (parts[2] === "uploads" && parts.length >= 4)
208
- return "upload-staging";
209
- if (parts[2] !== SESSIONS_PREFIX || parts.length < 5)
210
- return undefined;
211
- const rel = parts.slice(4).join("/");
212
- if (rel.startsWith(`${SESSION_CHECKPOINTS_PREFIX}/`)) {
213
- if (rel.includes("/workspace/objects/"))
214
- return "session-file-current";
215
- return "session-core";
216
- }
217
- if (rel.startsWith(`${SESSION_INTERNAL_PREFIX}/admin-archives/`))
218
- return "admin-archive";
219
- if (rel.startsWith(`${SESSION_INTERNAL_PREFIX}/events/`))
220
- return "internal-event";
221
- if (rel.startsWith(`${SESSION_INTERNAL_USAGE_PREFIX}/`))
222
- return "internal-usage";
223
- if (rel.startsWith(`${SESSION_INTERNAL_LOGS_PREFIX}/`))
224
- return "internal-log";
225
- if (rel.startsWith(`${SESSION_INTERNAL_PREFIX}/`))
226
- return "internal-log";
227
- return undefined;
228
- }
229
- // Current control-plane core is still read by the running container from the
230
- // internal control namespace. It is not a public files namespace and can be cut
231
- // over independently after boot/journal consumers move to workspace-scoped keys.
232
- if (normalized.startsWith(`${SESSIONS_PREFIX}/`)) {
233
- const parts = normalized.split("/");
234
- if (parts.length < 4 || parts[2] !== "session")
235
- return undefined;
236
- const rel = parts.slice(3).join("/");
237
- if (rel.startsWith("logs/"))
238
- return "internal-log";
239
- if (rel.startsWith("internal/usage/"))
240
- return "internal-usage";
241
- if (rel.startsWith("internal/events/"))
242
- return "internal-event";
243
- if (rel.startsWith("admin-archives/") || rel.startsWith("internal/admin-archives/"))
244
- return "admin-archive";
245
- if (rel === "terminal-failure.json")
246
- return "internal-log";
247
- if (rel === "boot.json" ||
248
- rel === "settle.json" ||
249
- rel === "control.json" ||
250
- rel === "secrets.sealed" ||
251
- rel.startsWith("journal/") ||
252
- rel.startsWith("turns/")) {
253
- return "session-core";
254
- }
255
- }
256
- return undefined;
257
- }
258
- /** S3 PutObject/CreateMultipartUpload/Upload `Tagging` header value for a key. */
259
- export function s3ObjectRetentionTaggingHeader(key) {
260
- const value = s3ObjectRetentionTagValue(key);
261
- if (value === undefined)
262
- return undefined;
263
- return `${encodeURIComponent(S3_RETENTION_TAG_KEY)}=${encodeURIComponent(value)}`;
264
- }