@aexhq/sdk 0.46.4-canary → 0.50.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 (337) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +38 -0
  3. package/README.md +23 -31
  4. package/dist/client/aex.d.ts +33 -0
  5. package/dist/client/aex.js +98 -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 +25 -0
  14. package/dist/downloads/download.js +53 -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 +81 -0
  18. package/dist/generated/errors.js.map +1 -0
  19. package/dist/generated/resources.d.ts +730 -0
  20. package/dist/generated/resources.js +606 -0
  21. package/dist/generated/resources.js.map +1 -0
  22. package/dist/generated/routes.d.ts +42 -0
  23. package/dist/generated/routes.js +2101 -0
  24. package/dist/generated/routes.js.map +1 -0
  25. package/dist/index.d.ts +20 -50
  26. package/dist/index.js +11 -62
  27. package/dist/index.js.map +1 -1
  28. package/dist/observations/stream.d.ts +1 -0
  29. package/dist/observations/stream.js +18 -0
  30. package/dist/observations/stream.js.map +1 -0
  31. package/dist/transport/errors.d.ts +60 -0
  32. package/dist/transport/errors.js +107 -0
  33. package/dist/transport/errors.js.map +1 -0
  34. package/dist/transport/pagination.d.ts +8 -0
  35. package/dist/transport/pagination.js +34 -0
  36. package/dist/transport/pagination.js.map +1 -0
  37. package/dist/transport/retry.d.ts +21 -0
  38. package/dist/transport/retry.js +37 -0
  39. package/dist/transport/retry.js.map +1 -0
  40. package/dist/transport/transport.d.ts +25 -0
  41. package/dist/transport/transport.js +28 -0
  42. package/dist/transport/transport.js.map +1 -0
  43. package/package.json +63 -30
  44. package/dist/_contracts/account-operations.d.ts +0 -101
  45. package/dist/_contracts/account-operations.js +0 -242
  46. package/dist/_contracts/account-types.d.ts +0 -461
  47. package/dist/_contracts/account-types.js +0 -1
  48. package/dist/_contracts/api-key.d.ts +0 -61
  49. package/dist/_contracts/api-key.js +0 -101
  50. package/dist/_contracts/api-routes.d.ts +0 -20
  51. package/dist/_contracts/api-routes.js +0 -109
  52. package/dist/_contracts/archive-limits.d.ts +0 -3
  53. package/dist/_contracts/archive-limits.js +0 -23
  54. package/dist/_contracts/asset-authoring.d.ts +0 -22
  55. package/dist/_contracts/asset-authoring.js +0 -106
  56. package/dist/_contracts/asset-bundle.d.ts +0 -64
  57. package/dist/_contracts/asset-bundle.js +0 -263
  58. package/dist/_contracts/asset-upload-helper.d.ts +0 -31
  59. package/dist/_contracts/asset-upload-helper.js +0 -84
  60. package/dist/_contracts/billing-admission.d.ts +0 -29
  61. package/dist/_contracts/billing-admission.js +0 -28
  62. package/dist/_contracts/bundle-manifest.d.ts +0 -89
  63. package/dist/_contracts/bundle-manifest.js +0 -158
  64. package/dist/_contracts/canonical-sha256.d.ts +0 -8
  65. package/dist/_contracts/canonical-sha256.js +0 -8
  66. package/dist/_contracts/connection-ticket.d.ts +0 -22
  67. package/dist/_contracts/connection-ticket.js +0 -54
  68. package/dist/_contracts/continuation-event.d.ts +0 -31
  69. package/dist/_contracts/continuation-event.js +0 -6
  70. package/dist/_contracts/contract-parse-error.d.ts +0 -12
  71. package/dist/_contracts/contract-parse-error.js +0 -51
  72. package/dist/_contracts/error-codes.d.ts +0 -26
  73. package/dist/_contracts/error-codes.js +0 -116
  74. package/dist/_contracts/error-factory.d.ts +0 -32
  75. package/dist/_contracts/error-factory.js +0 -174
  76. package/dist/_contracts/event-envelope.d.ts +0 -471
  77. package/dist/_contracts/event-envelope.js +0 -501
  78. package/dist/_contracts/event-stream-client.d.ts +0 -122
  79. package/dist/_contracts/event-stream-client.js +0 -445
  80. package/dist/_contracts/event-view.d.ts +0 -44
  81. package/dist/_contracts/event-view.js +0 -69
  82. package/dist/_contracts/failure-class.d.ts +0 -29
  83. package/dist/_contracts/failure-class.js +0 -73
  84. package/dist/_contracts/http.d.ts +0 -135
  85. package/dist/_contracts/http.js +0 -434
  86. package/dist/_contracts/ids.d.ts +0 -66
  87. package/dist/_contracts/ids.js +0 -119
  88. package/dist/_contracts/index.d.ts +0 -42
  89. package/dist/_contracts/index.js +0 -52
  90. package/dist/_contracts/internal.d.ts +0 -55
  91. package/dist/_contracts/internal.js +0 -113
  92. package/dist/_contracts/models.d.ts +0 -30
  93. package/dist/_contracts/models.js +0 -28
  94. package/dist/_contracts/operation-core.d.ts +0 -36
  95. package/dist/_contracts/operation-core.js +0 -70
  96. package/dist/_contracts/operations.d.ts +0 -218
  97. package/dist/_contracts/operations.js +0 -1496
  98. package/dist/_contracts/otlp-projection.d.ts +0 -78
  99. package/dist/_contracts/otlp-projection.js +0 -171
  100. package/dist/_contracts/post-hook.d.ts +0 -31
  101. package/dist/_contracts/post-hook.js +0 -61
  102. package/dist/_contracts/provider-fault.d.ts +0 -34
  103. package/dist/_contracts/provider-fault.js +0 -68
  104. package/dist/_contracts/retry-core.d.ts +0 -29
  105. package/dist/_contracts/retry-core.js +0 -79
  106. package/dist/_contracts/runner-event.d.ts +0 -117
  107. package/dist/_contracts/runner-event.js +0 -172
  108. package/dist/_contracts/runtime-kind.d.ts +0 -60
  109. package/dist/_contracts/runtime-kind.js +0 -70
  110. package/dist/_contracts/runtime-manifest.d.ts +0 -121
  111. package/dist/_contracts/runtime-manifest.js +0 -83
  112. package/dist/_contracts/runtime-security-profile.d.ts +0 -26
  113. package/dist/_contracts/runtime-security-profile.js +0 -73
  114. package/dist/_contracts/runtime-sizes.d.ts +0 -104
  115. package/dist/_contracts/runtime-sizes.js +0 -111
  116. package/dist/_contracts/runtime-types.d.ts +0 -618
  117. package/dist/_contracts/runtime-types.js +0 -58
  118. package/dist/_contracts/schemas/asset-bundle.d.ts +0 -70
  119. package/dist/_contracts/schemas/asset-bundle.js +0 -107
  120. package/dist/_contracts/schemas/asset-ref.d.ts +0 -61
  121. package/dist/_contracts/schemas/asset-ref.js +0 -118
  122. package/dist/_contracts/schemas/bundle-manifest.d.ts +0 -66
  123. package/dist/_contracts/schemas/bundle-manifest.js +0 -77
  124. package/dist/_contracts/schemas/index.d.ts +0 -32
  125. package/dist/_contracts/schemas/index.js +0 -30
  126. package/dist/_contracts/schemas/mcp-server.d.ts +0 -99
  127. package/dist/_contracts/schemas/mcp-server.js +0 -209
  128. package/dist/_contracts/schemas/models.d.ts +0 -29
  129. package/dist/_contracts/schemas/models.js +0 -51
  130. package/dist/_contracts/schemas/numeric.d.ts +0 -18
  131. package/dist/_contracts/schemas/numeric.js +0 -28
  132. package/dist/_contracts/schemas/post-hook.d.ts +0 -45
  133. package/dist/_contracts/schemas/post-hook.js +0 -68
  134. package/dist/_contracts/schemas/response-assets.d.ts +0 -75
  135. package/dist/_contracts/schemas/response-assets.js +0 -81
  136. package/dist/_contracts/schemas/response-billing.d.ts +0 -208
  137. package/dist/_contracts/schemas/response-billing.js +0 -139
  138. package/dist/_contracts/schemas/response-common.d.ts +0 -132
  139. package/dist/_contracts/schemas/response-common.js +0 -162
  140. package/dist/_contracts/schemas/response-identity.d.ts +0 -648
  141. package/dist/_contracts/schemas/response-identity.js +0 -131
  142. package/dist/_contracts/schemas/response-mcp-servers.d.ts +0 -51
  143. package/dist/_contracts/schemas/response-mcp-servers.js +0 -32
  144. package/dist/_contracts/schemas/response-secrets.d.ts +0 -50
  145. package/dist/_contracts/schemas/response-secrets.js +0 -32
  146. package/dist/_contracts/schemas/response-sessions-internal.d.ts +0 -200
  147. package/dist/_contracts/schemas/response-sessions-internal.js +0 -142
  148. package/dist/_contracts/schemas/response-sessions.d.ts +0 -1598
  149. package/dist/_contracts/schemas/response-sessions.js +0 -377
  150. package/dist/_contracts/schemas/response-webhooks.d.ts +0 -76
  151. package/dist/_contracts/schemas/response-webhooks.js +0 -42
  152. package/dist/_contracts/schemas/response-workspace.d.ts +0 -225
  153. package/dist/_contracts/schemas/response-workspace.js +0 -99
  154. package/dist/_contracts/schemas/runtime-kind.d.ts +0 -31
  155. package/dist/_contracts/schemas/runtime-kind.js +0 -29
  156. package/dist/_contracts/schemas/runtime-security-profile.d.ts +0 -28
  157. package/dist/_contracts/schemas/runtime-security-profile.js +0 -26
  158. package/dist/_contracts/schemas/runtime-sizes.d.ts +0 -70
  159. package/dist/_contracts/schemas/runtime-sizes.js +0 -127
  160. package/dist/_contracts/schemas/session-limits.d.ts +0 -34
  161. package/dist/_contracts/schemas/session-limits.js +0 -39
  162. package/dist/_contracts/schemas/session-machine.d.ts +0 -23
  163. package/dist/_contracts/schemas/session-machine.js +0 -24
  164. package/dist/_contracts/schemas/session-request-config.d.ts +0 -58
  165. package/dist/_contracts/schemas/session-request-config.js +0 -134
  166. package/dist/_contracts/schemas/session-webhook.d.ts +0 -11
  167. package/dist/_contracts/schemas/session-webhook.js +0 -38
  168. package/dist/_contracts/schemas/side-effect-audit.d.ts +0 -98
  169. package/dist/_contracts/schemas/side-effect-audit.js +0 -102
  170. package/dist/_contracts/schemas/submission-assets.d.ts +0 -117
  171. package/dist/_contracts/schemas/submission-assets.js +0 -147
  172. package/dist/_contracts/schemas/submission-body.d.ts +0 -251
  173. package/dist/_contracts/schemas/submission-body.js +0 -378
  174. package/dist/_contracts/schemas/submission-environment.d.ts +0 -79
  175. package/dist/_contracts/schemas/submission-environment.js +0 -179
  176. package/dist/_contracts/schemas/submission-request.d.ts +0 -158
  177. package/dist/_contracts/schemas/submission-request.js +0 -49
  178. package/dist/_contracts/schemas/submission-secrets.d.ts +0 -47
  179. package/dist/_contracts/schemas/submission-secrets.js +0 -108
  180. package/dist/_contracts/schemas/wire.d.ts +0 -118
  181. package/dist/_contracts/schemas/wire.js +0 -171
  182. package/dist/_contracts/schemas/workspace-resources.d.ts +0 -50
  183. package/dist/_contracts/schemas/workspace-resources.js +0 -87
  184. package/dist/_contracts/sdk-errors.d.ts +0 -212
  185. package/dist/_contracts/sdk-errors.js +0 -313
  186. package/dist/_contracts/sdk-secrets.d.ts +0 -67
  187. package/dist/_contracts/sdk-secrets.js +0 -427
  188. package/dist/_contracts/session-archive.d.ts +0 -16
  189. package/dist/_contracts/session-archive.js +0 -92
  190. package/dist/_contracts/session-artifacts.d.ts +0 -189
  191. package/dist/_contracts/session-artifacts.js +0 -264
  192. package/dist/_contracts/session-config.d.ts +0 -373
  193. package/dist/_contracts/session-config.js +0 -562
  194. package/dist/_contracts/session-cost-types.d.ts +0 -211
  195. package/dist/_contracts/session-cost-types.js +0 -69
  196. package/dist/_contracts/session-cost.d.ts +0 -8
  197. package/dist/_contracts/session-cost.js +0 -582
  198. package/dist/_contracts/session-custody.d.ts +0 -165
  199. package/dist/_contracts/session-custody.js +0 -345
  200. package/dist/_contracts/session-file-query.d.ts +0 -14
  201. package/dist/_contracts/session-file-query.js +0 -178
  202. package/dist/_contracts/session-record.d.ts +0 -112
  203. package/dist/_contracts/session-record.js +0 -165
  204. package/dist/_contracts/session-retention.d.ts +0 -201
  205. package/dist/_contracts/session-retention.js +0 -450
  206. package/dist/_contracts/side-effect-audit.d.ts +0 -126
  207. package/dist/_contracts/side-effect-audit.js +0 -520
  208. package/dist/_contracts/sse.d.ts +0 -74
  209. package/dist/_contracts/sse.js +0 -227
  210. package/dist/_contracts/stable.d.ts +0 -45
  211. package/dist/_contracts/stable.js +0 -62
  212. package/dist/_contracts/status.d.ts +0 -25
  213. package/dist/_contracts/status.js +0 -57
  214. package/dist/_contracts/submission-limits.d.ts +0 -61
  215. package/dist/_contracts/submission-limits.js +0 -60
  216. package/dist/_contracts/submission.d.ts +0 -547
  217. package/dist/_contracts/submission.js +0 -812
  218. package/dist/_contracts/suggest.d.ts +0 -15
  219. package/dist/_contracts/suggest.js +0 -53
  220. package/dist/_contracts/testing/response-bindings.d.ts +0 -45
  221. package/dist/_contracts/testing/response-bindings.js +0 -256
  222. package/dist/_contracts/testing/wire-conformance-entry.d.ts +0 -10
  223. package/dist/_contracts/testing/wire-conformance-entry.js +0 -8
  224. package/dist/_contracts/testing/wire-conformance.d.ts +0 -169
  225. package/dist/_contracts/testing/wire-conformance.js +0 -276
  226. package/dist/_contracts/turn-trace.d.ts +0 -28
  227. package/dist/_contracts/turn-trace.js +0 -1
  228. package/dist/_contracts/unknown-field-error.d.ts +0 -13
  229. package/dist/_contracts/unknown-field-error.js +0 -21
  230. package/dist/_contracts/value-guards.d.ts +0 -20
  231. package/dist/_contracts/value-guards.js +0 -34
  232. package/dist/_contracts/webhook-verify.d.ts +0 -34
  233. package/dist/_contracts/webhook-verify.js +0 -93
  234. package/dist/_contracts/wire-observer.d.ts +0 -49
  235. package/dist/_contracts/wire-observer.js +0 -34
  236. package/dist/_contracts/workflow-status.d.ts +0 -7
  237. package/dist/_contracts/workflow-status.js +0 -43
  238. package/dist/_contracts/workspace-resources.d.ts +0 -98
  239. package/dist/_contracts/workspace-resources.js +0 -39
  240. package/dist/archive-limits.d.ts +0 -1
  241. package/dist/archive-limits.js +0 -2
  242. package/dist/archive-limits.js.map +0 -1
  243. package/dist/asset-upload.d.ts +0 -47
  244. package/dist/asset-upload.js +0 -269
  245. package/dist/asset-upload.js.map +0 -1
  246. package/dist/bundle.d.ts +0 -9
  247. package/dist/bundle.js +0 -20
  248. package/dist/bundle.js.map +0 -1
  249. package/dist/canonical-zip.d.ts +0 -68
  250. package/dist/canonical-zip.js +0 -355
  251. package/dist/canonical-zip.js.map +0 -1
  252. package/dist/cli.mjs +0 -12048
  253. package/dist/cli.mjs.sha256 +0 -1
  254. package/dist/client-types.d.ts +0 -192
  255. package/dist/client-types.js +0 -2
  256. package/dist/client-types.js.map +0 -1
  257. package/dist/client.d.ts +0 -464
  258. package/dist/client.js +0 -1207
  259. package/dist/client.js.map +0 -1
  260. package/dist/event-projection.d.ts +0 -22
  261. package/dist/event-projection.js +0 -380
  262. package/dist/event-projection.js.map +0 -1
  263. package/dist/fetch-archive.d.ts +0 -16
  264. package/dist/fetch-archive.js +0 -252
  265. package/dist/fetch-archive.js.map +0 -1
  266. package/dist/file.d.ts +0 -96
  267. package/dist/file.js +0 -272
  268. package/dist/file.js.map +0 -1
  269. package/dist/instructions.d.ts +0 -20
  270. package/dist/instructions.js +0 -40
  271. package/dist/instructions.js.map +0 -1
  272. package/dist/legacy-session-provider-fault.d.ts +0 -7
  273. package/dist/legacy-session-provider-fault.js +0 -38
  274. package/dist/legacy-session-provider-fault.js.map +0 -1
  275. package/dist/mcp-server.d.ts +0 -84
  276. package/dist/mcp-server.js +0 -117
  277. package/dist/mcp-server.js.map +0 -1
  278. package/dist/node-fs.d.ts +0 -29
  279. package/dist/node-fs.js +0 -19
  280. package/dist/node-fs.js.map +0 -1
  281. package/dist/node-walk.d.ts +0 -69
  282. package/dist/node-walk.js +0 -151
  283. package/dist/node-walk.js.map +0 -1
  284. package/dist/path-basename.d.ts +0 -5
  285. package/dist/path-basename.js +0 -9
  286. package/dist/path-basename.js.map +0 -1
  287. package/dist/retry.d.ts +0 -70
  288. package/dist/retry.js +0 -155
  289. package/dist/retry.js.map +0 -1
  290. package/dist/secret.d.ts +0 -65
  291. package/dist/secret.js +0 -110
  292. package/dist/secret.js.map +0 -1
  293. package/dist/session-validate.d.ts +0 -100
  294. package/dist/session-validate.js +0 -303
  295. package/dist/session-validate.js.map +0 -1
  296. package/dist/skill.d.ts +0 -99
  297. package/dist/skill.js +0 -169
  298. package/dist/skill.js.map +0 -1
  299. package/dist/submission-wire.d.ts +0 -13
  300. package/dist/submission-wire.js +0 -69
  301. package/dist/submission-wire.js.map +0 -1
  302. package/dist/tool.d.ts +0 -41
  303. package/dist/tool.js +0 -76
  304. package/dist/tool.js.map +0 -1
  305. package/dist/version.d.ts +0 -9
  306. package/dist/version.js +0 -10
  307. package/dist/version.js.map +0 -1
  308. package/docs/authentication.md +0 -125
  309. package/docs/billing.md +0 -164
  310. package/docs/cleanup.md +0 -27
  311. package/docs/concepts/agent-tools.md +0 -47
  312. package/docs/concepts/composition.md +0 -60
  313. package/docs/concepts/providers-and-runtimes.md +0 -121
  314. package/docs/concepts/sessions.md +0 -51
  315. package/docs/concepts/subagents.md +0 -35
  316. package/docs/credentials.md +0 -116
  317. package/docs/defaults.md +0 -51
  318. package/docs/errors.md +0 -258
  319. package/docs/events.md +0 -143
  320. package/docs/files.md +0 -130
  321. package/docs/limits-and-quotas.md +0 -114
  322. package/docs/limits.md +0 -51
  323. package/docs/mcp.md +0 -47
  324. package/docs/networking.md +0 -114
  325. package/docs/provider-runtime-capabilities.md +0 -32
  326. package/docs/public-surface.json +0 -73
  327. package/docs/quickstart.md +0 -135
  328. package/docs/release.md +0 -44
  329. package/docs/retries.md +0 -108
  330. package/docs/secrets.md +0 -141
  331. package/docs/session-config.md +0 -51
  332. package/docs/session-record.md +0 -58
  333. package/docs/skills.md +0 -65
  334. package/docs/telemetry.md +0 -66
  335. package/docs/testing.md +0 -35
  336. package/docs/vision-skills.md +0 -94
  337. package/docs/webhooks.md +0 -143
@@ -1,121 +0,0 @@
1
- ---
2
- title: Models & runtimes
3
- description: How gateway model slugs map to managed runtime execution.
4
- icon: Network
5
- ---
6
-
7
- aex routes every model through the managed Vercel AI Gateway. You name a model
8
- by its gateway `creator/model` **slug** and the platform's single managed key
9
- handles the upstream provider relationship — there is no `provider` selector and
10
- you never supply a provider API key.
11
-
12
- ```ts
13
- model: "anthropic/claude-haiku-4-5" // creator/model gateway slug
14
- ```
15
-
16
- The slug is validated at the boundary by `parseModelSlug` (shape only). The
17
- catalog is OPEN: a well-formed slug the gateway serves just works with zero code
18
- changes; a slug this SDK does not recognize is still accepted and arbitrated by
19
- the gateway at submit time.
20
-
21
- All submissions run on a managed runtime. The optional `runtime` object has two
22
- independent selectors:
23
-
24
- - `runtime.kind` selects the execution backend: `RuntimeKinds.SPOT_CONTAINER`
25
- (the default, `"spot_container"`), `RuntimeKinds.CONTAINER`
26
- (`"container"`), or `RuntimeKinds.LAMBDA` (`"lambda"`).
27
- - `runtime.size` selects a managed machine-size preset; use `Sizes.*` in
28
- TypeScript.
29
-
30
- Omit either field to use its default (`spot_container` for `kind` and
31
- `0.25cpu-1gb` for `size`). The CLI equivalents are `--runtime <kind>` and
32
- `--runtime-size <size>`.
33
-
34
- An explicit runtime request is never silently replaced with another runtime. If
35
- the requested runtime cannot do what the submission asks — a capability it does
36
- not support, a session deadline past its lifetime, a workspace larger than it
37
- provisions — the submission fails before execution rather than running in a
38
- degraded mode.
39
-
40
- ## What each runtime can actually do
41
-
42
- Runtime choice is not free of behavioral consequences, and this SDK does not
43
- claim otherwise. Every runtime publishes a **profile**: the capabilities it
44
- performs, the limits it enforces, and the delivery semantics it guarantees. Read
45
- it at runtime with `aex.whoami().runtimeCapabilities.profilesByRuntimeKind`
46
- (CLI: `aex whoami --json`); the capability hash identifies the exact document
47
- the service used.
48
-
49
- Four differences are real, permanent, and cannot be equalized:
50
-
51
- | Difference | Where it is published | What it means for you |
52
- | --- | --- | --- |
53
- | **Idle billing and cold start** | `profile.delivery.idleBilling`, `profile.delivery.coldStartClass` | This is the product reason the runtimes exist. `lambda` bills **zero** while a session is parked or waiting and cold-starts in seconds; the container runtimes bill **wall clock** for the whole session and cold-start in tens of seconds. |
54
- | **`spot_container` runs side-effecting tools at least once** | `profile.delivery.toolExecution` | A Spot reclaim replays the interrupted step, so a tool with an external side effect may run more than once. `container` and `lambda` are `exactly-once`. If your tools are not idempotent, choose `container`. |
55
- | **MicroVM disk and lifetime** | `profile.limits.maxWorkspaceBytes`, `profile.limits.maxSessionMs` | `lambda` runs in a MicroVM with a 32 GiB disk and an 8-hour hard lifetime. These are host limits, not policy, and admission rejects a submission that exceeds them. |
56
- | **One atomic effect is capped** | `profile.limits.maxSingleEffectMs` | A single LLM call or tool call may run for at most 14 minutes on **every** runtime. On `lambda` the live budget can be shorter still, bounded by the remaining invocation time. An overrun fails that tool call with a typed error; it never silently drops the turn. |
57
-
58
- Capabilities are declared per runtime and are either `supported` or
59
- `unsupported` — there is no partial state. A capability the selected runtime
60
- does not support is refused at admission, so a runtime can never advertise a
61
- tool it cannot execute.
62
-
63
- > **Availability today.** `lambda` is not generally available. It can finish an
64
- > LLM turn but cannot yet execute a tool call, and its profile says so:
65
- > `toolExecution`, `workspaceCheckpoint`, `workspaceFileCapture`,
66
- > `streamingDeltas`, `approvalGate`, `postHook`, `mcpTools`, `scheduledWait`,
67
- > `customerSecrets`, and `containedEgress` are all `unsupported`. The default is
68
- > `spot_container` because it is the cheapest runtime that executes every tool.
69
- > Check `availableRuntimeKinds` before naming a runtime: during a staged rollout
70
- > a runtime may be part of the SDK vocabulary without appearing in your
71
- > workspace's available set.
72
-
73
- Subagents behave identically on every runtime: a subagent shares its parent's
74
- workspace and sees the files the parent just wrote.
75
-
76
- ## Selection
77
-
78
- ### TypeScript
79
-
80
- ```ts
81
- import { RuntimeKinds, Sizes } from "@aexhq/sdk";
82
-
83
- const capabilities = (await aex.whoami()).runtimeCapabilities;
84
- if (!capabilities?.availableRuntimeKinds.includes(RuntimeKinds.CONTAINER)) {
85
- throw new Error("Container runtime is not available for this workspace");
86
- }
87
-
88
- // Tools with external side effects should not run on interruption-tolerant
89
- // capacity: check the published delivery semantics rather than assuming.
90
- const profile = capabilities.profilesByRuntimeKind[RuntimeKinds.CONTAINER];
91
- if (profile.delivery.toolExecution !== "exactly-once") {
92
- throw new Error("this workload needs exactly-once tool execution");
93
- }
94
-
95
- await aex.start({
96
- model: "openai/gpt-4.1",
97
- message: "Summarise the attached files.",
98
- runtime: {
99
- kind: RuntimeKinds.CONTAINER,
100
- size: Sizes.CPU_0_25_1GB
101
- }
102
- });
103
- ```
104
-
105
- ### CLI
106
-
107
- ```bash
108
- aex start \
109
- --api-key "$AEX_API_KEY" \
110
- --model openai/gpt-4.1 \
111
- --runtime container \
112
- --runtime-size 0.25cpu-1gb \
113
- --prompt "Summarise the attached files." \
114
- --follow
115
- ```
116
-
117
- Events, files, streaming/replay, controls, cleanup, and downloads use the same
118
- SDK and CLI **surface** for every runtime and model — the same calls, the same
119
- shapes, the same stable error codes. What a given runtime will actually perform
120
- behind that surface is the profile above. For the model-access contract, see the
121
- generated [model access reference](../provider-runtime-capabilities.md).
@@ -1,51 +0,0 @@
1
- ---
2
- title: Sessions
3
- description: Resumable threads, explicit runs, and committed checkpoints.
4
- icon: Play
5
- ---
6
-
7
- A session is a resumable thread. Its `status` describes whether that thread can
8
- progress, not whether the previous run succeeded. Typical resumable states are
9
- `running`, `idle`, `suspended`, `awaiting_approval`, and recoverable `error`.
10
- The previous run verdict is available as `lastRun.outcome` and on its terminal
11
- RUN event.
12
-
13
- ```ts
14
- const session = await aex.sessions.create({ model });
15
-
16
- const run = session.messages.send("Write the report and save it as a file.");
17
- for await (const event of run) console.log(event.type);
18
- const result = await run.finished();
19
-
20
- console.log(result.status); // succeeded | failed | timed_out | cancelled | interrupted
21
- console.log(result.session.status); // usually idle after a successful run
22
- ```
23
-
24
- `finished()` resolves only after `RUN_FINISHED` or `RUN_ERROR`. A
25
- `RUN_FINISHED` is the consistency barrier: session state, usage, checkpoint,
26
- and checkpoint-backed files are committed before it is emitted. This release does not
27
- expose a separate pre-checkpoint "brain idle" wait. The committed session
28
- projection must identify that exact run in `lastRun`; an idle projection with a
29
- missing or older `lastRun` is treated as inconsistent and `finished()` fails.
30
-
31
- The three common namespaces are stable properties:
32
-
33
- ```ts
34
- const messages = await session.messages.list();
35
- const snapshot = await session.files.list();
36
-
37
- for await (const event of session.events.iterate()) {
38
- console.log(event.type);
39
- }
40
-
41
- console.log(snapshot.revision.checkpointId);
42
- console.log(snapshot.files);
43
- ```
44
-
45
- Reopen a durable session with `aex.sessions.open(id)`. Use a stable
46
- `idempotencyKey` for create and message mutations that your application may
47
- repeat. Reads and explicitly idempotent mutations receive bounded transport
48
- retries; a user run is never replayed as a whole by the SDK.
49
-
50
- `aex.start(...)` is the one-shot create, send, and finish convenience. It
51
- returns the same five-value run outcome and committed file snapshot.
@@ -1,35 +0,0 @@
1
- ---
2
- title: Subagents
3
- description: Delegate bounded work to child sessions and inspect their lineage.
4
- icon: GitFork
5
- ---
6
-
7
- The builtin `subagent` capability lets an agent delegate work to child sessions.
8
- Enable it with the default builtin set or include it explicitly in
9
- `builtinTools`. Use `builtinTools: "none"` to disable agent-driven delegation.
10
-
11
- Children are durable session records with their own events and checkpointed
12
- files. Discover them from the parent handle:
13
-
14
- ```ts
15
- const children = await session.children();
16
-
17
- for (const child of children) {
18
- console.log(child.id, child.parentSessionId, child.depth, child.status);
19
- const events = await child.events.list();
20
- const snapshot = await child.files.list();
21
- const descendants = await child.children();
22
- console.log(child.ref.lastRun?.outcome, events.length, snapshot.files.length, descendants.length);
23
- }
24
- ```
25
-
26
- Child `status` is a session lifecycle state. Inspect `lastRun.outcome` or the
27
- child's terminal RUN event for its run verdict. Child handles are read-only:
28
- they expose events, checkpointed files, and recursive lineage, but not top-level
29
- session controls such as send, cancel, suspend, resume, or delete.
30
-
31
- Provider credentials are inherited through the hosted runtime's vaulted
32
- channel; they are not copied into public child submissions or event payloads.
33
- Depth, breadth, and spend limits are enforced server-side. Use
34
- `overrides.maxSpendUsd` and a deliberate builtin selection to bound a parent
35
- workflow.
@@ -1,116 +0,0 @@
1
- ---
2
- title: Credentials
3
- ---
4
-
5
- # Credentials
6
-
7
- aex uses explicit, per-session credentials:
8
-
9
- - `AEX_API_KEY` authenticates the SDK or CLI to aex.
10
- - `McpServer.remote(..., { headers })` carries MCP auth when a remote MCP server needs it.
11
- - `environment.secrets` carries runtime secrets for your own code.
12
-
13
- Model access needs **no** provider API key: aex routes every model through the
14
- managed Vercel AI Gateway with its own key. You name a model by its
15
- `creator/model` gateway slug and nothing else.
16
-
17
- Secrets never belong in reusable session config, files, prompts, or examples.
18
-
19
- ## The client credential
20
-
21
- Pass your aex API key directly to the constructor — `new Aex(apiKey)` — or as
22
- the `apiKey` option:
23
-
24
- ```ts
25
- import { Aex } from "@aexhq/sdk";
26
-
27
- const aex = new Aex(process.env.AEX_API_KEY!); // preferred shorthand
28
- // equivalently:
29
- // const aex = new Aex({ apiKey: process.env.AEX_API_KEY! });
30
- ```
31
-
32
- See [Authentication](authentication.md) for how keys are scoped, rotated, and
33
- issued during the beta.
34
-
35
- ## Choosing a model
36
-
37
- Name the model by its Vercel AI Gateway `creator/model` slug. There is no
38
- `provider` field and no provider key — the platform's managed gateway key routes
39
- the call.
40
-
41
- ```ts
42
- const result = await aex.start({
43
- model: "anthropic/claude-haiku-4-5",
44
- message: "Write a short report and save it as a file.",
45
- });
46
- ```
47
-
48
- ## Runtime secrets
49
-
50
- Use `environment.secrets` for credentials your code needs at runtime. The value
51
- can be ephemeral with `Secret.value(...)` or a workspace secret reference with
52
- `Secret.ref(...)`.
53
-
54
- ```ts
55
- import { Aex, Secret } from "@aexhq/sdk";
56
-
57
- const aex = new Aex({ apiKey: process.env.AEX_API_KEY! });
58
-
59
- await aex.start({
60
- model: "anthropic/claude-haiku-4-5",
61
- message: "Call https://api.example.com/v1/status with INTERNAL_API_TOKEN and summarize it.",
62
- environment: {
63
- secrets: {
64
- INTERNAL_API_TOKEN: Secret.value(process.env.INTERNAL_API_TOKEN!)
65
- },
66
- networking: {
67
- mode: "limited",
68
- allowedHosts: ["api.example.com"]
69
- }
70
- },
71
- });
72
- ```
73
-
74
- Inside the session, use normal HTTP code for the service:
75
-
76
- ```bash
77
- curl -sS \
78
- -H "Authorization: Bearer $INTERNAL_API_TOKEN" \
79
- https://api.example.com/v1/status
80
- ```
81
-
82
- ## Workspace secrets
83
-
84
- Store reusable values once, then reference them by name:
85
-
86
- ```ts
87
- await aex.workspace.secrets.set({
88
- name: "internal-api-token",
89
- value: process.env.INTERNAL_API_TOKEN!
90
- });
91
-
92
- await aex.start({
93
- model: "anthropic/claude-haiku-4-5",
94
- message: "Use INTERNAL_API_TOKEN for the status request.",
95
- environment: {
96
- secrets: {
97
- INTERNAL_API_TOKEN: Secret.ref("internal-api-token")
98
- }
99
- },
100
- });
101
- ```
102
-
103
- Secret reads return metadata only; they never return the stored value.
104
-
105
- ## Networking
106
-
107
- Networking is open by default within the platform's managed egress ceiling. Use
108
- `environment.networking.mode: "limited"` with `allowedHosts` when you want a
109
- session's own code to reach only named hosts. See [Networking](networking.md) for
110
- the two-layer enforcement model.
111
-
112
- ## Explicit call-site rule
113
-
114
- There is no `defaultSecrets` and no client-held secret state. Each
115
- `aex.sessions.create(...)` or `aex.start(...)` call should show the MCP auth and
116
- runtime secrets needed for that call.
package/docs/defaults.md DELETED
@@ -1,51 +0,0 @@
1
- ---
2
- title: Defaults
3
- ---
4
-
5
- # Defaults
6
-
7
- These are the public values aex applies when you omit the corresponding option.
8
- Runtime-size presets are defined in public
9
- [`runtime-sizes.ts`](https://github.com/aexhq/aex/blob/main/packages/contracts/src/runtime-sizes.ts).
10
- For hard ceilings and adjustable limits, see
11
- [Limits & quotas](limits-and-quotas.md).
12
-
13
- ## Session
14
-
15
- | Option | Default | How to override |
16
- | --- | --- | --- |
17
- | `timeout` | 8 hours | `overrides.timeout` (minimum 1 minute, maximum 8 hours) |
18
- | `runtime` | `0.25cpu-1gb` (0.25 vCPU, 1 GB) | `runtime` or `Sizes.*` |
19
- | `overrides.maxSpendUsd` | No per-session spend cap | A positive USD amount |
20
- | `overrides.maxTurns` | 20 iterations | A positive integer, up to 200 |
21
-
22
- ## Tools and MCP
23
-
24
- | Option | Default | How to override |
25
- | --- | --- | --- |
26
- | Per-call exec timeout | 30 minutes | Tool call `timeoutMs` |
27
- | `web_fetch` returned body | 500 KB (UTF-8) | Tool argument `max_bytes` |
28
- | MCP connect timeout | 30 seconds | MCP server `connectTimeoutMs` |
29
- | MCP `tools/call` timeout | 30 minutes | MCP server `callTimeoutMs` |
30
-
31
- ## Links and tickets
32
-
33
- | Option | Default | How to override |
34
- | --- | --- | --- |
35
- | Signed URL TTL | 300 seconds at the API layer; `session.files.link(...)` defaults to `"1h"` | `expiresSeconds` or the SDK's `expiresIn` |
36
- | Event-stream ticket TTL | 60 seconds | `ttlMs` |
37
-
38
- ## Subagents
39
-
40
- Subagent breadth and depth use managed budgets rather than fixed public numeric
41
- entitlements. The service supports high recursive depth and large fan-out;
42
- contact support before relying on unusually large workloads.
43
-
44
- ## Workspace
45
-
46
- Workspace storage is bounded by your plan's monthly storage grant, not by a
47
- fixed per-workspace number. The Free plan includes 5 GB; paid plans have no
48
- per-dimension storage quota and bill usage beyond the included allowance once
49
- you add a payment method and enable overage. Admission, concurrency, and other
50
- adjustable workspace limits are returned by `aex.whoami()` (CLI: `aex whoami`);
51
- contact support when the effective value does not fit your workload.
package/docs/errors.md DELETED
@@ -1,258 +0,0 @@
1
- ---
2
- title: Errors
3
- ---
4
-
5
- # Errors
6
-
7
- Every API error is a JSON body with a machine-readable `error` code; most also
8
- carry a human `message` and the self-describing fields named below.
9
-
10
- ## Typed errors in the SDK
11
-
12
- The SDK maps every non-2xx response through one factory to a typed exception. All
13
- inherit `AexApiError`, which carries the HTTP `status`, the parsed `body`
14
- (secret-shape-scanned client-side, in your process, when the error is
15
- constructed), the server's stable `apiCode` (a machine-branchable identity distinct
16
- from the human `message`), and a `requestId` for support correlation. The
17
- factory dispatches to a subclass by code/status:
18
-
19
- | Class | Fires for | Extra fields |
20
- | --- | --- | --- |
21
- | `AexAuthError` | `401` / `403` (unauthorized, forbidden, insufficient_scope, token_invalid/revoked/expired, malformed_token) | `requiredScope` (on `insufficient_scope`) |
22
- | `AexIdempotencyConflictError` | `409` `idempotency_conflict` | — |
23
- | `AexNotFoundError` | `404` `not_found` | — |
24
- | `AexRateLimitError` | `429` (rate_limited, workspace_concurrency_exceeded, workspace_submit_rate_exceeded) | `retryAfterMs` (when advertised) |
25
- | `AexApiError` (base) | every other stable code (session_busy, checkpoint_not_available, session_not_terminal, session_terminal, event_archive_too_large, event_archive_deadline_exceeded, workspace_inactive, insufficient_credits, account_blocked, workspace_spend_cap_exceeded, upstream_error, internal_error, …) | — |
26
-
27
- Branch with the exported guards instead of parsing bodies or matching status
28
- codes: `isAuthError`, `isInsufficientScope`, `isIdempotencyConflict`,
29
- `isNotFound`, and `isRateLimited`.
30
-
31
- ```ts
32
- import { isInsufficientScope, isIdempotencyConflict } from "@aexhq/sdk";
33
-
34
- try {
35
- await aex.start(config);
36
- } catch (err) {
37
- if (isInsufficientScope(err)) {
38
- // err.requiredScope names the missing scope; mint a key that includes it.
39
- } else if (isIdempotencyConflict(err)) {
40
- // same key, different body — use a fresh key or resend the byte-identical body.
41
- }
42
- }
43
- ```
44
-
45
- The **stable** `apiCode` set the SDK types and dispatches on is: `unauthorized`,
46
- `forbidden`, `insufficient_scope`, `token_invalid`, `token_revoked`,
47
- `token_expired`, `malformed_token`, `not_found`, `idempotency_conflict`,
48
- `session_busy`, `checkpoint_not_available`, `session_not_terminal`, `session_terminal`,
49
- `event_archive_too_large`, `event_archive_deadline_exceeded`, `unknown_workspace`,
50
- `workspace_inactive`, `workspace_concurrency_exceeded`, `workspace_submit_rate_exceeded`,
51
- `workspace_spend_cap_exceeded`, `insufficient_credits`, `account_blocked`,
52
- `rate_limited`, `upstream_error`, `internal_error`. A code outside this set (e.g. a validation
53
- `error` a route reports) still surfaces as an `AexApiError` with the `status` and
54
- `body.error` preserved; `apiCode` is then `undefined`.
55
-
56
- Transport failures with no HTTP response (DNS, connection refused, TLS reset)
57
- surface as `AexNetworkError`; client-side config validation surfaces as
58
- `SessionConfigValidationError` (`err.code === "SESSION_CONFIG_INVALID"`) before any
59
- request is sent. Its stable machine-readable payload is exactly
60
- `err.details = { field }`, where `field` is the rejected public option path such
61
- as `overrides.timeout`. Branch on `details.field`; the human `message` may change
62
- and never includes the rejected value.
63
-
64
- Strict public contract parsers throw their existing error classes and messages,
65
- with non-enumerable metadata that can be narrowed through
66
- `isContractParseError(err)`. The guard preserves the original error object and
67
- specialized class; `err.code === CONTRACT_PARSE_ERROR` and `err.parser` identify
68
- the nearest strict parser that rejected the input.
69
-
70
- Parser names describe behavior: `parse*` is strict and throws for malformed
71
- present input, while `tryParse*` is a non-throwing recognizer that returns
72
- `null` or `undefined`. The older `parseApiKey`, `parseBundleManifest`, and
73
- internal retry-header names, plus `validateSkillBundleEntry` and
74
- `validateSkillBundleManifest`, remain callable compatibility wrappers. New code
75
- should use `tryParseApiKey`, `tryParseBundleManifest`,
76
- `parseSkillBundleEntry`, and `parseSkillBundleManifest`.
77
-
78
- ## 401 — authentication
79
-
80
- | Code | Meaning |
81
- | --- | --- |
82
- | `unauthorized` | Missing or empty bearer token. |
83
- | `token_invalid` | Bearer token is structurally valid but does not match a live credential, has a bad signature, or belongs to an inactive workspace. |
84
- | `token_revoked` | Bearer token matched a revoked credential. |
85
- | `token_expired` | Short-lived internal writer token is past its expiry. |
86
-
87
- Check the token value and that it has not been deleted or revoked. `aex whoami`
88
- is the cheapest way to validate a credential. See
89
- [Authentication](authentication.md).
90
-
91
- ## 403 — authorization
92
-
93
- | Code | Meaning |
94
- | --- | --- |
95
- | `insufficient_scope` | The token is valid but lacks the route's required scope. The body's `requiredScope` field names the missing scope. |
96
- | `unknown_workspace` | The token does not route to a known workspace. |
97
- | `forbidden` | The authenticated workspace does not own the addressed resource. |
98
-
99
- ```json
100
- { "error": "insufficient_scope", "requiredScope": "sessions:write" }
101
- ```
102
-
103
- ## 400 — validation
104
-
105
- | Code | Meaning |
106
- | --- | --- |
107
- | `bad_request` | Missing or unparseable request body. |
108
- | `invalid_submission` | The submission failed shape validation; `message` names the offending field. |
109
- | `invalid_model` | `model` is not a `creator/model` gateway slug (for example `anthropic/claude-haiku-4-5`). |
110
- | `malformed_token` | The bearer value is not a structurally valid aex token. |
111
-
112
- 400s are permanent for that request — fix the input rather than retrying.
113
- The SDK's client-side validation (`SessionConfigValidationError`) catches most of
114
- these before the request is sent.
115
-
116
- ## 402 — payment required
117
-
118
- Three distinct submit gates return 402; every body is self-describing.
119
-
120
- **`insufficient_credits`** — the free model-usage allowance for this UTC month
121
- AND the prepaid balance are both empty. A submit is admitted while either one is
122
- positive, so this fires only when both are gone.
123
-
124
- ```json
125
- {
126
- "error": "insufficient_credits",
127
- "message": "Free model-usage allowance exhausted ($0.00 of $2.00 left this month) and the prepaid balance is $0.00. Add a payment method and buy credits to continue running.",
128
- "balanceUsd": 0,
129
- "balanceGraceFloorUsd": 0,
130
- "paymentMethodStatus": "none",
131
- "admissionState": "free",
132
- "exhaustedDimension": "llm_token_usd",
133
- "allowanceRemaining": { "llm_token_usd": 0, "egress_gb": 4.2, "web_search_calls": 36 }
134
- }
135
- ```
136
-
137
- `allowanceRemaining` covers **every** dimension, not just the exhausted one, so
138
- a client can render the whole allowance panel from the error alone.
139
- `admissionState` (`free` / `carded_manual` / `carded_auto`) is what the remedy in
140
- `message` follows: add a card, top up, or find out why the automatic recharge did
141
- not land.
142
-
143
- **`account_blocked`** — the organization is blocked (for example a disputed
144
- payment under review). This is a **separate code on purpose**: buying credit does
145
- not lift a block, so a client must not offer a top-up here.
146
-
147
- ```json
148
- {
149
- "error": "account_blocked",
150
- "message": "This organization cannot start new work because a disputed payment is under review (blocked 2026-07-24). Adding credit will not restore access — contact support to resolve it.",
151
- "reason": "dispute",
152
- "blockedAt": "2026-07-24T09:00:00.000Z",
153
- "admissionState": "carded_manual"
154
- }
155
- ```
156
-
157
- **`workspace_spend_cap_exceeded`** — the workspace's monthly spend cap is
158
- reached. The cap resets at the start of the next UTC month; contact support to
159
- raise it.
160
-
161
- ```json
162
- {
163
- "error": "workspace_spend_cap_exceeded",
164
- "message": "Monthly spend cap of $250 reached ($251.13 accrued this month). The cap resets at the start of the next UTC month; contact support to raise it.",
165
- "capUsd": 250,
166
- "accruedUsd": 251.13
167
- }
168
- ```
169
-
170
- ## 429 — rate limits
171
-
172
- **`workspace_concurrency_exceeded`** — admitting one more live run would exceed
173
- the workspace's concurrent-run cap. Wait for a session to finish, or contact
174
- support to raise the cap.
175
-
176
- ```json
177
- {
178
- "error": "workspace_concurrency_exceeded",
179
- "message": "Workspace concurrency limit reached: 50 live sessions at the cap of 50. Wait for a session to finish, or contact support to raise your workspace limit.",
180
- "cap": 50,
181
- "observed": 50
182
- }
183
- ```
184
-
185
- **`workspace_submit_rate_exceeded`** — too many submits in the current
186
- one-minute window. Retry shortly.
187
-
188
- ```json
189
- {
190
- "error": "workspace_submit_rate_exceeded",
191
- "message": "Submit rate limit of 120/minute exceeded. Retry shortly, or contact support to raise your workspace limit.",
192
- "perMin": 120,
193
- "observed": 121
194
- }
195
- ```
196
-
197
- The `limit`-naming fields (`cap`/`perMin`) and the `observed` window value make
198
- each deny self-describing, so a client can back off proportionally. To
199
- anticipate both 429s and both 402s *before* submitting, read the effective caps
200
- from `aex.whoami().limits` — the values come from the same resolution code the
201
- gates enforce. See [Limits & quotas](limits-and-quotas.md).
202
-
203
- ## 404 — not found
204
-
205
- `not_found`: the id does not exist **or** belongs to another workspace (aex
206
- does not distinguish the two). The SDK raises `AexNotFoundError` (guard:
207
- `isNotFound(err)`).
208
-
209
- ## 409 — conflicts and inactive workspaces
210
-
211
- | Code | Meaning |
212
- | --- | --- |
213
- | `idempotency_conflict` | The `idempotencyKey` was already used with a different request body. The SDK raises `AexIdempotencyConflictError` (guard: `isIdempotencyConflict(err)`). |
214
- | `session_busy` | The session is handling another turn or lifecycle transition. Wait for its current operation to finish. |
215
- | `checkpoint_not_available` | No committed checkpoint exists yet for a checkpoint-backed read such as `session.files.list()`. Wait for the current run to finish. This remains a base `AexApiError`, not an idempotency conflict. |
216
- | `session_not_terminal` | The requested operation requires a terminal session state. |
217
- | `session_terminal` | The session has ended and cannot perform the requested action. |
218
- | `workspace_inactive` | A workspace deletion fence won the admission race, so the workspace no longer accepts new session work. The body carries `workspaceStatus` (normally `deleting`). Use an active workspace. |
219
-
220
- For `idempotency_conflict`, use a fresh idempotency key for a genuinely new request, or resubmit
221
- the byte-identical body to replay the original result (a matching retry returns
222
- the existing session rather than conflicting). Note that the SDK validates the
223
- key client-side first: an empty or whitespace-only `idempotencyKey` throws
224
- `SessionConfigValidationError` before the request is sent, as does a key longer
225
- than 255 characters. Never pass `""`.
226
-
227
- `workspace_inactive` is not an idempotency conflict and is not transient for
228
- that workspace. It remains a base `AexApiError`; branch on
229
- `err.apiCode === "workspace_inactive"` and inspect `err.body.workspaceStatus`
230
- when the current lifecycle state matters.
231
-
232
- ## 413/503 — synchronous event archive limits
233
-
234
- | Code | Meaning |
235
- | --- | --- |
236
- | `event_archive_too_large` (413) | The history exceeds the synchronous archive's source, candidate, or estimated-output limit. |
237
- | `event_archive_deadline_exceeded` (503) | The synchronous archive could not finish inside its server request budget. |
238
-
239
- Both are stable base `AexApiError` codes with `retryable: false`. The SDK does
240
- not retry `session.events.archiveLink()` automatically. Traverse the history
241
- with `session.events.iterate()` instead of repeating the bulk export.
242
-
243
- ## 5xx — server errors
244
-
245
- | Code | Meaning |
246
- | --- | --- |
247
- | `internal_error` (500) | Unexpected server fault. Retry with backoff; report persistent cases. |
248
- | `db_resuming` (503) | The database tier is resuming from idle. Transient — retry. |
249
-
250
- The SDK retries transient failures automatically: HTTP `429`, `5xx`, `529`, and
251
- network errors get bounded exponential backoff with full jitter, honoring any
252
- `Retry-After` header. Tune or disable this with the client `retry` option; use
253
- `isRateLimited(err)` / `AexRateLimitError` to handle persistent throttling
254
- without parsing raw bodies. Automatic retries are limited to reads and other
255
- idempotent HTTP methods, or mutations carrying a stable `Idempotency-Key`.
256
- Session create/send requests always carry one stable key across transport
257
- attempts, so a retried request cannot create a second billable run. The SDK
258
- never retries an entire user scenario or a failed application run.