@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,471 +0,0 @@
1
- /**
2
- * The unified aex event envelope.
3
- *
4
- * One versioned, self-describing record that every subscriber sees, derived
5
- * from the unified {@link RunnerEvent}. Managed runtime adapters emit
6
- * byte-identical envelopes for the same logical event by construction. This is
7
- * the shape the coordinator (Phase 2) appends, broadcasts, and archives.
8
- *
9
- * - **CloudEvents-shaped** self-describing envelope: a stable `id`, the
10
- * coarse `source`, the AG-UI-aligned `type`, the `subject` (session), a
11
- * `time`, the `sequence` cursor, and the typed `data`.
12
- * - **AG-UI vocabulary** for `type` where it maps; aex-specific events
13
- * ride AG-UI's reserved `CUSTOM` carrier under an `aex.*` name, so an
14
- * off-the-shelf AG-UI client reads an aex start with no glue.
15
- * - Two aex extensions: a coarse `source` (filter first by origin) and
16
- * an optional human `message` (log / CLI / dashboard rendering).
17
- *
18
- * Unified observability spine:
19
- * the envelope additionally carries four ordering attributes so BOTH the typed
20
- * event stream and the high-volume hosted-platform log stream ride one per-session
21
- * coordinator:
22
- * - `channel` — "event" (the typed AG-UI stream) or "log" (a verbose log
23
- * line). The single axis a consumer splits the unified stream
24
- * on.
25
- * - `sourceSeq` — a per-SOURCE monotonic counter assigned AT the source. The
26
- * DO's hard guarantee is that records of the same source are
27
- * never reordered relative to their `sourceSeq`.
28
- * - `emittedAt` — source wall-clock ms at emit. Carried, never trusted for
29
- * cross-source ordering (clocks are independent; the coordinator gives
30
- * no synchronized clock). A client may re-sort by it for a
31
- * best-effort time view.
32
- * The coordinator remains the single serial ordering authority: it assigns the global
33
- * `sequence` on arrival, which is the canonical stream order. `sourceSeq` /
34
- * `emittedAt` are CARRIED through broadcast + archive, not used to reorder.
35
- *
36
- * This module is a pure projection plus honest guards and a strict AG-UI
37
- * projection for consumers.
38
- */
39
- import type { JsonValue } from "./submission.js";
40
- import { type SessionTerminalOutcome } from "./status.js";
41
- import type { RunnerEvent } from "./runner-event.js";
42
- import { type AexFailureClass } from "./failure-class.js";
43
- import { type ProviderFault } from "./provider-fault.js";
44
- /** CloudEvents `specversion` the envelope conforms to. */
45
- export declare const AEX_EVENT_SPECVERSION: "1.0";
46
- /**
47
- * Mapping version. Bump when the RunnerEvent → envelope projection changes
48
- * shape (new `source`/`type`, renamed data field). Independent of
49
- * {@link AEX_EVENT_SPECVERSION} (the CloudEvents version) and of
50
- * `RUNNER_EVENT_VERSION` (the upstream wire version).
51
- */
52
- export declare const AEX_EVENT_MAP_VERSION: 2;
53
- /**
54
- * Coarse origin classifier — the first axis a consumer filters on.
55
- * - `agent` — the model: text, reasoning, builtin tool calls/results.
56
- * - `api` — the hosted aex API path.
57
- * - `runtime` — the execution runtime: lifecycle, diagnostics, non-fatal
58
- * stream errors.
59
- * - `mcp` — an MCP server (a tool call/result routed through MCP).
60
- * - `aex` — the platform: skills, files, and other aex-native events.
61
- * - `workflow`— the orchestration layer.
62
- * - `host` — the managed host the runtime executes on; distinct from the
63
- * runtime process itself.
64
- */
65
- export declare const AEX_EVENT_SOURCES: readonly ["agent", "api", "runtime", "mcp", "aex", "workflow", "host"];
66
- export type AexEventSource = (typeof AEX_EVENT_SOURCES)[number] | string;
67
- /**
68
- * The channel a record rides on the unified per-session stream:
69
- * - `event` — the typed, low-volume, fully-replayed AG-UI event stream.
70
- * - `log` — a high-volume verbose log line (level + message + fields). The
71
- * coordinator prunes flushed log rows after evidence archival
72
- * (logs are append-only, events are kept). Absent on the wire ⇒
73
- * `event`.
74
- */
75
- export declare const AEX_EVENT_CHANNELS: readonly ["event", "log"];
76
- export type AexEventChannel = (typeof AEX_EVENT_CHANNELS)[number];
77
- /**
78
- * Log severity carried by a `channel: "log"` record (the `LOG` event type).
79
- * NOTE: the platform owner's canonical term for the middle level is "warning";
80
- * we keep "warn" for consistency with the existing in-code vocabulary — the
81
- * mapping is `warning ≡ warn`.
82
- */
83
- export declare const AEX_LOG_LEVELS: readonly ["info", "warn", "error"];
84
- export type AexLogLevel = (typeof AEX_LOG_LEVELS)[number];
85
- /**
86
- * The AG-UI-aligned `type` vocabulary the envelope emits. A subset of the
87
- * full AG-UI protocol — the events aex actually produces today — plus
88
- * `CUSTOM`, AG-UI's reserved carrier for aex-native events.
89
- */
90
- export declare const AEX_EVENT_TYPES: readonly ["RUN_STARTED", "RUN_FINISHED", "RUN_ERROR", "TEXT_MESSAGE_CONTENT", "TOOL_CALL_START", "TOOL_CALL_RESULT", "CUSTOM", "LOG"];
91
- export type AexEventType = (typeof AEX_EVENT_TYPES)[number] | string;
92
- /**
93
- * Opt-in producer identity for at-least-once ingest. This is distinct from the
94
- * coarse envelope `source`/`sourceSeq`: only producers maintaining a
95
- * session-scoped monotonic counter set this pair.
96
- */
97
- export interface AexEventDedup {
98
- /** Free-form producer identity, not the coarse envelope source. */
99
- readonly source: string;
100
- /** Producer-monotonic integer scoped to `source` within the session. */
101
- readonly sourceSeq: number;
102
- }
103
- /** Fields shared by durable events and provisional live-only stream frames. */
104
- export interface AexEventBase {
105
- /** CloudEvents specversion. Always {@link AEX_EVENT_SPECVERSION}. */
106
- readonly specversion: typeof AEX_EVENT_SPECVERSION;
107
- /** Stable, globally unique event id. This is the stream dedupe key. */
108
- readonly id: string;
109
- /** Coarse origin classifier. */
110
- readonly source: AexEventSource;
111
- /** AG-UI-aligned event type. */
112
- readonly type: AexEventType;
113
- /** The session this event belongs to (CloudEvents `subject`). */
114
- readonly subject: string;
115
- /** AG-UI thread identity. Equal to {@link subject} for an aex session. */
116
- readonly threadId: string;
117
- /** AG-UI run identity. A new id is allocated for every session turn. */
118
- readonly runId: string;
119
- /** W3C-compatible 16-byte trace identity, encoded as 32 lowercase hex characters. */
120
- readonly traceId?: string;
121
- /** W3C-compatible 8-byte span identity, encoded as 16 lowercase hex characters. */
122
- readonly spanId?: string;
123
- /** Parent span identity when this event represents a non-root span. */
124
- readonly parentSpanId?: string;
125
- /** ISO-8601 event time (session base + the RunnerEvent's relative `tMs`). */
126
- readonly time: string;
127
- /**
128
- * Which sub-stream this record rides. Absent ⇒ `"event"` (existing typed
129
- * producers don't set it; the coordinator defaults it on ingest).
130
- */
131
- readonly channel?: AexEventChannel;
132
- /**
133
- * Per-SOURCE monotonic counter assigned at the source. The coordinator
134
- * preserves the order of same-source records by `sourceSeq` and never
135
- * reorders them; cross-source order is by arrival (`sequence`) only.
136
- */
137
- readonly sourceSeq?: number;
138
- /** Source wall-clock ms at emit. Carried for a best-effort client time view. */
139
- readonly emittedAt?: number;
140
- /**
141
- * The DO's authoritative receive time (wall-clock ms), stamped at ingest
142
- * alongside the global {@link sequence}. This is the authoritative wall-clock
143
- * companion to `sequence` — distinct from `emittedAt` (the SOURCE's clock) and
144
- * `time` (the LOGICAL time = session base + relative tMs).
145
- *
146
- * NOTE: some edge clocks are coarsened/frozen-at-I/O, so `receivedAt` is
147
- * precisely "the coordinator's last-I/O wall-clock at ingest" — that is fine
148
- * as the authoritative receive marker. It does NOT need to exceed `emittedAt`:
149
- * the source runs on a different host with an independent clock, so cross-host
150
- * drift can leave `receivedAt < emittedAt` and that is expected, not an error.
151
- */
152
- readonly receivedAt?: number;
153
- /**
154
- * Log severity, first-class on a `channel: "log"` record (mirrors
155
- * `data.level`). Optional: only `log`-channel records carry it; typed `event`
156
- * records omit it. ("warn" ≡ the owner's "warning" — see {@link AEX_LOG_LEVELS}.)
157
- */
158
- readonly level?: AexLogLevel;
159
- /** Optional human-readable summary for log / CLI / dashboard rendering. */
160
- readonly message?: string;
161
- /** Optional producer identity used by the coordinator's idempotent ingest. */
162
- readonly dedup?: AexEventDedup;
163
- /** True only for producer-authored broadcast-only frames. */
164
- readonly ephemeral?: boolean;
165
- /**
166
- * Typed payload. For `CUSTOM` events this is `{ name, value }` (AG-UI's
167
- * custom carrier, `name` = `aex.<kind>`); for typed events it is the
168
- * RunnerEvent's own data, projected to AG-UI fields by {@link toAGUI}.
169
- */
170
- readonly data: Readonly<Record<string, JsonValue>>;
171
- }
172
- /**
173
- * A durable, replayable event. `sequence` is the session-wide persistence and
174
- * reconnect cursor used by list/archive APIs and coordinator replay.
175
- */
176
- export interface AexEvent extends AexEventBase {
177
- readonly replayable?: true;
178
- readonly liveSequence?: never;
179
- readonly sequence: number;
180
- }
181
- /**
182
- * A provisional live-only frame. It is never returned by list/archive APIs and
183
- * cannot advance a durable reconnect cursor. `liveSequence` orders frames only
184
- * within this run's live delivery; `id` is the stable duplicate-suppression key.
185
- */
186
- export interface AexLiveEvent extends AexEventBase {
187
- readonly replayable: false;
188
- readonly liveSequence: number;
189
- readonly sequence?: never;
190
- readonly receivedAt: number;
191
- readonly ephemeral: true;
192
- }
193
- /** Events a live coordinator WebSocket may yield. */
194
- export type AexStreamEvent = AexEvent | AexLiveEvent;
195
- /** Payload carried by a valid public `RUN_STARTED` event. */
196
- export type AexRunStartedData = Readonly<Record<string, JsonValue>> & {
197
- readonly source?: string;
198
- readonly turnSeq?: number;
199
- readonly mode?: string;
200
- readonly provider?: string;
201
- readonly model?: string;
202
- };
203
- /** Payload carried by a valid public `RUN_FINISHED` event. */
204
- export type AexRunFinishedData = Readonly<Record<string, JsonValue>> & {
205
- readonly outcome: SessionTerminalOutcome;
206
- readonly result?: JsonValue;
207
- };
208
- /** Payload carried by a valid public `RUN_ERROR` event. */
209
- export type AexRunErrorData = Readonly<Record<string, JsonValue>> & {
210
- readonly outcome: SessionTerminalOutcome;
211
- /** CLOSED taxonomy ({@link AEX_FAILURE_CLASSES}) — branchable, never an open string. */
212
- readonly failureClass: AexFailureClass;
213
- readonly failureMessage: string;
214
- readonly providerFault?: ProviderFault;
215
- };
216
- /** Payload carried by a valid public assistant-text event. */
217
- export type AexTextMessageData = Readonly<Record<string, JsonValue>> & {
218
- readonly text: string;
219
- readonly messageId?: string;
220
- readonly eventId?: string;
221
- /** True only on a provisional, non-replayable live delta. */
222
- readonly delta?: boolean;
223
- readonly truncated?: boolean;
224
- };
225
- /** Payload carried by a valid public tool-call start. */
226
- export type AexToolCallStartData = Readonly<Record<string, JsonValue>> & {
227
- readonly id: string;
228
- readonly name: string;
229
- readonly arguments?: Readonly<Record<string, JsonValue>>;
230
- readonly messageId?: string;
231
- };
232
- /** Payload carried by a valid public tool-call result. */
233
- export type AexToolCallResultData = Readonly<Record<string, JsonValue>> & {
234
- readonly id: string;
235
- readonly content: JsonValue;
236
- readonly isError?: boolean;
237
- readonly messageId?: string;
238
- /** True when `content` was CLIPPED to fit the event budget — not the whole result. */
239
- readonly truncated?: boolean;
240
- };
241
- /** Payload carried by AG-UI's CUSTOM carrier. */
242
- export type AexCustomData<Name extends string = string> = Readonly<Record<string, JsonValue>> & {
243
- readonly name: Name;
244
- readonly value: JsonValue;
245
- };
246
- /** Payload carried by a public log-channel record. */
247
- export type AexLogData = Readonly<Record<string, JsonValue>> & {
248
- readonly level: AexLogLevel;
249
- readonly message: string;
250
- readonly fields?: Readonly<Record<string, JsonValue>>;
251
- /** True when a dominant field was CLIPPED to fit the event budget. */
252
- readonly truncated?: boolean;
253
- };
254
- export type AexRunStartedEvent = AexEventBase & {
255
- readonly type: "RUN_STARTED";
256
- readonly data: AexRunStartedData;
257
- };
258
- export type AexRunFinishedEvent = AexEventBase & {
259
- readonly type: "RUN_FINISHED";
260
- readonly data: AexRunFinishedData;
261
- };
262
- export type AexRunErrorEvent = AexEventBase & {
263
- readonly type: "RUN_ERROR";
264
- readonly data: AexRunErrorData;
265
- };
266
- export type AexTextMessageEvent = AexEventBase & {
267
- readonly type: "TEXT_MESSAGE_CONTENT";
268
- readonly data: AexTextMessageData;
269
- };
270
- export type AexToolCallStartEvent = AexEventBase & {
271
- readonly type: "TOOL_CALL_START";
272
- readonly data: AexToolCallStartData;
273
- };
274
- export type AexToolCallResultEvent = AexEventBase & {
275
- readonly type: "TOOL_CALL_RESULT";
276
- readonly data: AexToolCallResultData;
277
- };
278
- export type AexCustomEvent<Name extends string = string> = AexEventBase & {
279
- readonly type: "CUSTOM";
280
- readonly data: AexCustomData<Name>;
281
- };
282
- export type AexLogEvent = AexEventBase & {
283
- readonly type: "LOG";
284
- readonly channel: "log";
285
- readonly level: AexLogLevel;
286
- readonly data: AexLogData;
287
- };
288
- /** All public event shapes this package currently understands. */
289
- export type KnownAexEventBase = AexRunStartedEvent | AexRunFinishedEvent | AexRunErrorEvent | AexTextMessageEvent | AexToolCallStartEvent | AexToolCallResultEvent | AexCustomEvent | AexLogEvent;
290
- /** A validated known durable event. Raw {@link AexEvent} deliberately remains open. */
291
- export type KnownAexEvent = AexEvent & KnownAexEventBase;
292
- /** A validated known provisional event. */
293
- export type KnownAexLiveEvent = AexLiveEvent & KnownAexEventBase;
294
- /** A validated known durable or provisional stream event. */
295
- export type KnownAexStreamEvent = AexStreamEvent & KnownAexEventBase;
296
- /** Stable diagnostic for a recognized type whose payload violates its contract. */
297
- export interface MalformedAexEventIssue {
298
- readonly code: "malformed_known_event";
299
- readonly type: (typeof AEX_EVENT_TYPES)[number];
300
- readonly path: string;
301
- readonly expected: string;
302
- }
303
- /** Explicit failure thrown when a malformed known event is projected. */
304
- export declare class MalformedAexEventError extends Error {
305
- readonly code: "malformed_known_event";
306
- readonly issue: MalformedAexEventIssue;
307
- constructor(issue: MalformedAexEventIssue);
308
- }
309
- /**
310
- * Result of classifying an open event without changing it. Unknown future types
311
- * remain raw; malformed recognized types are a separate, explicit state.
312
- */
313
- export type AexEventClassification<T extends AexEventBase = AexEventBase> = {
314
- readonly kind: "known";
315
- readonly event: T & KnownAexEventBase;
316
- } | {
317
- readonly kind: "unknown";
318
- readonly event: T;
319
- } | {
320
- readonly kind: "malformed_known";
321
- readonly event: T;
322
- readonly issue: MalformedAexEventIssue;
323
- };
324
- /** True only for a provisional frame outside the durable replay sequence. */
325
- export declare function isAexLiveEvent(event: AexStreamEvent): event is AexLiveEvent;
326
- /** True only for a durable event carrying a replay cursor. */
327
- export declare function isReplayableEvent(event: AexStreamEvent): event is AexEvent;
328
- /** Compatibility spelling used by the hosted platform. */
329
- export declare const isReplayableAexEvent: typeof isReplayableEvent;
330
- /** Context the mapper needs to stamp absolute identity/time onto an event. */
331
- export interface AexEventContext {
332
- readonly sessionId: string;
333
- /** The real AG-UI run id for the session turn being projected. */
334
- readonly runId: string;
335
- /**
336
- * Run-start epoch ms. The RunnerEvent's `tMs` is relative to this, so
337
- * `time = new Date(baseMs + tMs)`. Pass the session's `createdAtMs`.
338
- */
339
- readonly baseMs: number;
340
- }
341
- /**
342
- * Project a {@link RunnerEvent} onto the unified public envelope. Internal
343
- * runtime completion has no public projection: only the platform-authored
344
- * RUN_FINISHED/RUN_ERROR event is a completion boundary.
345
- */
346
- export declare function runnerEventToAexEvent(evt: RunnerEvent, ctx: AexEventContext): AexEvent | null;
347
- /** A log line as a producer hands it to {@link logToInbound} (pre-coordinator). */
348
- export interface AexLogLine {
349
- readonly level: AexLogLevel;
350
- readonly message: string;
351
- readonly fields?: Readonly<Record<string, JsonValue>>;
352
- /** Source wall-clock ms at emit. */
353
- readonly emittedAt: number;
354
- /** Per-source monotonic counter assigned at the source. */
355
- readonly sourceSeq: number;
356
- }
357
- /**
358
- * The inbound (pre-seq) envelope a producer POSTs for a `channel: "log"` line.
359
- * The coordinator stamps `specversion`/`id`/`subject`/`sequence` (the ordering
360
- * authority) AND `receivedAt` (its authoritative receive time) on ingest, so a
361
- * producer never supplies any of them.
362
- */
363
- export type AexInboundLog = Omit<AexEvent, "specversion" | "id" | "subject" | "threadId" | "runId" | "sequence" | "receivedAt">;
364
- /**
365
- * Project a log line onto an inbound coordinator envelope. The coordinator
366
- * stamps `specversion`/`id`/`subject`/`sequence` on ingest (it is the ordering
367
- * authority); everything else — `channel`, `source`, `sourceSeq`, `emittedAt`,
368
- * and the `LOG` payload — is supplied here.
369
- */
370
- export declare function logToInbound(source: AexEventSource, line: AexLogLine): AexInboundLog;
371
- /** Classify an open event without cloning or rewriting it. */
372
- export declare function classifyAexEvent<T extends AexEventBase>(event: T): AexEventClassification<T>;
373
- /** True only for a currently understood event with a valid payload. */
374
- export declare function isKnownAexEvent<T extends AexEventBase>(e: T): e is T & KnownAexEventBase;
375
- export declare function isRunStarted<T extends AexEventBase>(e: T): e is T & AexRunStartedEvent;
376
- export declare function isRunFinished<T extends AexEventBase>(e: T): e is T & AexRunFinishedEvent;
377
- export declare function isRunError<T extends AexEventBase>(e: T): e is T & AexRunErrorEvent;
378
- /** A valid terminal event of either flavour (finished or error). */
379
- export declare function isRunTerminal<T extends AexEventBase>(e: T): e is T & (AexRunFinishedEvent | AexRunErrorEvent);
380
- export declare function isTextMessage<T extends AexEventBase>(e: T): e is T & AexTextMessageEvent;
381
- export declare function isToolCallStart<T extends AexEventBase>(e: T): e is T & AexToolCallStartEvent;
382
- export declare function isToolCallResult<T extends AexEventBase>(e: T): e is T & AexToolCallResultEvent;
383
- export declare function isCustom<T extends AexEventBase>(e: T): e is T & AexCustomEvent;
384
- /** The `aex.*` name of a valid CUSTOM event, or null otherwise. */
385
- export declare function customName(e: AexEventBase): string | null;
386
- /**
387
- * The CUSTOM `data.name` of the HITL write-gate park: the session has reached the
388
- * `awaiting_approval` state before a gated action and is holding for an
389
- * `approve()`/`deny()`. Structural (independent of model prose).
390
- */
391
- export declare const AEX_SESSION_AWAITING_APPROVAL_NAME = "aex.session.awaiting_approval";
392
- /** The CUSTOM `data.name` carrying a schema-decoded value (`{ value }`). */
393
- export declare const AEX_RESULT_DECODED_NAME = "aex.result.decoded";
394
- /** The CUSTOM `data.name` carrying a typed decode refusal (`{ reason, detail? }`). */
395
- export declare const AEX_RESULT_REFUSED_NAME = "aex.result.refused";
396
- /** True for the HITL `awaiting_approval` gate event. */
397
- export declare function isAwaitingApproval<T extends AexEventBase>(e: T): e is T & AexCustomEvent<typeof AEX_SESSION_AWAITING_APPROVAL_NAME>;
398
- /** True for a schema-decoded terminal result event. */
399
- export declare function isResultDecoded<T extends AexEventBase>(e: T): e is T & AexCustomEvent<typeof AEX_RESULT_DECODED_NAME>;
400
- /** True for a typed decode-refusal terminal result event. */
401
- export declare function isResultRefused<T extends AexEventBase>(e: T): e is T & AexCustomEvent<typeof AEX_RESULT_REFUSED_NAME>;
402
- export declare function isFromSource(e: AexEventBase, source: AexEventSource): boolean;
403
- /** The channel a record rides, defaulting an absent value to `"event"`. */
404
- export declare function channelOf(e: AexEventBase): AexEventChannel;
405
- /** True when a record is a valid log line (the `log` channel / `LOG` type). */
406
- export declare function isLog<T extends AexEventBase>(e: T): e is T & AexLogEvent;
407
- /** True when a record is a typed AG-UI event (the `event` channel). */
408
- export declare function isEventChannel(e: AexEventBase): boolean;
409
- /**
410
- * The coordinator's embedded store caps a
411
- * single row at 2 MB. Events whose serialized form exceeds the budget must be
412
- * split before insert (the coordinator's responsibility); the archive uses the
413
- * same bound. A conservative margin under the hard 2 MiB leaves room for row
414
- * overhead and column framing.
415
- */
416
- export declare const EVENT_ROW_MAX_BYTES: 2000000;
417
- /** Serialized UTF-8 byte length of an event (the size the row must hold). */
418
- export declare function serializedEventBytes(e: AexEvent): number;
419
- /** True when an event's serialized form exceeds the row budget and must be split. */
420
- export declare function exceedsRowBudget(e: AexEvent, max?: number): boolean;
421
- /**
422
- * AG-UI events aex projects to. Each carries the AG-UI `type` discriminant
423
- * and a numeric `timestamp` (ms), plus the type-specific fields an off-the-shelf
424
- * AG-UI client expects. Aex's envelope extensions (`source`, `message`, the
425
- * CloudEvents framing) are dropped — `rawEvent` carries the original for clients
426
- * that want it.
427
- */
428
- export type AguiEvent = {
429
- type: "RUN_STARTED";
430
- timestamp: number;
431
- threadId: string;
432
- runId: string;
433
- } | {
434
- type: "RUN_FINISHED";
435
- timestamp: number;
436
- threadId: string;
437
- runId: string;
438
- result?: JsonValue;
439
- } | {
440
- type: "RUN_ERROR";
441
- timestamp: number;
442
- message: string;
443
- code?: string;
444
- } | {
445
- type: "TEXT_MESSAGE_CONTENT";
446
- timestamp: number;
447
- messageId: string;
448
- delta: string;
449
- } | {
450
- type: "TOOL_CALL_START";
451
- timestamp: number;
452
- toolCallId: string;
453
- toolCallName: string;
454
- } | {
455
- type: "TOOL_CALL_RESULT";
456
- timestamp: number;
457
- messageId: string;
458
- toolCallId: string;
459
- content: JsonValue;
460
- } | {
461
- type: "CUSTOM";
462
- timestamp: number;
463
- name: string;
464
- value: JsonValue;
465
- };
466
- /**
467
- * Project an aex envelope to a strict AG-UI event so an off-the-shelf
468
- * AG-UI client can consume an aex start with no glue. This is the
469
- * client-side projection the SDK exposes.
470
- */
471
- export declare function toAGUI(e: AexEventBase): AguiEvent;