@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 +0,0 @@
1
- a57352fbb791f3941e71e1c75b56cbe77a1c7616be763c021fe5b37e316a9928 cli.mjs
@@ -1,192 +0,0 @@
1
- import type { ApprovalGate, AexEventView, BuiltinToolName, ModelName, OutputMode, PlatformEnvironmentInput, PlatformSubmission, ResponseFormat, Session, SessionCheckpointRevision, SessionFile, SessionMessage, SessionRun, SessionRuntime, SubmissionAssets, TurnOutcome, TurnResult, TurnTrace, WebSocketFactory } from "./_contracts/index.js";
2
- import type { McpServer } from "./mcp-server.js";
3
- import type { Secret } from "./secret.js";
4
- /**
5
- * A transcript message as the SDK hands it to a caller.
6
- *
7
- * Deliberately NOT an alias of {@link SessionMessage}, which is the WIRE shape
8
- * returned by `GET /api/sessions/{id}/messages` and always carries `timestamp`,
9
- * `sequence` and `content`. A `Message` may also be PROJECTED from the event
10
- * stream by `projectAssistantMessages`, which is building one as the tokens
11
- * arrive and legitimately has no sequence or timestamp yet, and never has the
12
- * wire's `content` array.
13
- *
14
- * Same distinction as `Session` against `SessionWire`: one shape is what the
15
- * server sent, the other is what the client assembled. Conflating them made the
16
- * wire type's guarantees look optional and the projection's gaps look like
17
- * server behaviour.
18
- */
19
- export interface Message {
20
- readonly id: string;
21
- readonly sender: SessionMessage["sender"];
22
- readonly text: string;
23
- readonly timestamp?: string;
24
- readonly turnSeq?: number;
25
- readonly sequence?: number;
26
- }
27
- export type SessionInput = string | readonly string[];
28
- export interface SessionEnvironmentOptions extends Omit<PlatformEnvironmentInput, "envVars"> {
29
- readonly variables?: Readonly<Record<string, string>>;
30
- readonly secrets?: Readonly<Record<string, Secret>>;
31
- }
32
- export interface SessionOverrides {
33
- readonly idleTtl?: string;
34
- readonly timeout?: string;
35
- readonly maxSpendUsd?: number;
36
- /**
37
- * Per-session iteration cap (agent loop turns). Defaults + ceiling are enforced
38
- * server-side; omit to accept the platform default. A positive integer.
39
- */
40
- readonly maxTurns?: number;
41
- }
42
- /** Stable mutation identity used for server-side deduplication and safe transport retries. */
43
- export interface IdempotencyOptions {
44
- readonly idempotencyKey?: string;
45
- }
46
- /**
47
- * Options for creating a resumable session or starting a one-shot run.
48
- * Reusable bytes are published first through `aex.workspace`, then pinned in
49
- * `assets` by resource id and immutable version.
50
- */
51
- export interface SessionCreateOptions extends IdempotencyOptions {
52
- /**
53
- * The model to run, as a Vercel AI Gateway `creator/model` slug string
54
- * (e.g. `"anthropic/claude-haiku-4-5"`, `"deepseek/deepseek-v4-flash"`).
55
- * The managed gateway routes it — no provider selection and no API key.
56
- */
57
- readonly model: ModelName;
58
- readonly system?: string;
59
- /** Immutable workspace resources to materialize for the session. */
60
- readonly assets?: Partial<SubmissionAssets>;
61
- readonly mcpServers?: readonly McpServer[];
62
- /**
63
- * File capture policy for the session's captured files. Omit `allowedDirs`
64
- * to expose regular workspace files from the latest complete checkpoint;
65
- * listed roots narrow capture, and `deniedDirs` subtracts noise.
66
- */
67
- readonly fileCapture?: {
68
- readonly allowedDirs?: readonly string[];
69
- readonly deniedDirs?: readonly string[];
70
- readonly captureTimeoutMs?: number;
71
- readonly maxFileBytes?: number;
72
- readonly maxTotalBytes?: number;
73
- readonly maxFiles?: number;
74
- };
75
- /** Builtin capabilities, kept separate from uploaded custom-tool assets. */
76
- readonly builtinTools?: "default" | "none" | readonly BuiltinToolName[];
77
- /**
78
- * Assistant-output granularity. `"buffered"` (default) delivers ONE coalesced
79
- * `TEXT_MESSAGE_CONTENT` per assistant message. `"stream"` delivers provisional,
80
- * non-replayable per-token `TEXT_MESSAGE_CONTENT` deltas (`replayable:false`,
81
- * `liveSequence`, and no durable `sequence`) as they arrive. Every model
82
- * streams through the managed gateway, so `"stream"` is honored for ALL models.
83
- * A coalesced final `TEXT_MESSAGE_CONTENT` ALWAYS follows the deltas, so a
84
- * buffered consumer sees the same final text either way; deltas are
85
- * provisional until that coalesced block.
86
- */
87
- readonly outputMode?: OutputMode;
88
- /**
89
- * Structured-output policy. `{ kind:'text' }` (default) is free-form;
90
- * `{ kind:'json_schema', schema, strict?, name? }` requests provider-native
91
- * constrained decode against `schema`. The typed outcome is read from
92
- * `start<T>()`'s `result.outcome` (`{ kind:'decoded', value }` or
93
- * `{ kind:'refused', reason }`) — never an untyped hallucinated object.
94
- */
95
- readonly responseFormat?: ResponseFormat;
96
- /**
97
- * Declarative HITL write-gate: the platform puts the session
98
- * `awaiting_approval` BEFORE dispatching any tool in `tools`, independent of
99
- * model prose. Resume with `session.approve()` or reject with
100
- * `session.deny()`.
101
- */
102
- readonly approvalGate?: ApprovalGate;
103
- readonly metadata?: PlatformSubmission["metadata"];
104
- readonly environment?: SessionEnvironmentOptions;
105
- /**
106
- * The execution runtime for the session — grouped as `{ kind, size }`.
107
- *
108
- * - `kind` — which backend runs it: `spot_container` (default; cheapest
109
- * capacity that executes every tool, but a reclaim can replay an
110
- * interrupted step, so side-effecting tools run AT LEAST ONCE),
111
- * `container` (the same host on on-demand capacity, exactly-once), or
112
- * `lambda` (serverless: zero idle billing and seconds-not-minutes cold
113
- * start, availability-gated and currently unable to execute a tool call).
114
- * Prefer the {@link RuntimeKinds} symbol const.
115
- * - `size` — the managed box preset ({@link RuntimeSize}); prefer {@link Sizes}.
116
- *
117
- * Both optional; the platform applies defaults (`spot_container`, the 1 GB tier).
118
- * e.g. `runtime: { kind: "container", size: Sizes.CPU_2_8GB }`.
119
- *
120
- * Runtimes differ in capability, not only in price. Read what a runtime will
121
- * actually do from `whoami().runtimeCapabilities.profilesByRuntimeKind` before
122
- * naming one; a submission that exceeds the selected profile is refused before
123
- * execution rather than degraded.
124
- */
125
- readonly runtime?: SessionRuntime;
126
- readonly overrides?: SessionOverrides;
127
- /**
128
- * Optional callback URL registered on the session. The platform delivers a
129
- * run-scoped `run.finished` or `run.error` event after every run finalizes,
130
- * signed Standard-Webhooks style (verify with {@link verifyAexWebhook}). The
131
- * URL must be https.
132
- */
133
- readonly webhook?: {
134
- readonly url: string;
135
- };
136
- }
137
- export interface SessionSendOptions extends IdempotencyOptions {
138
- readonly webSocketFactory?: WebSocketFactory;
139
- readonly idleTimeoutMs?: number;
140
- readonly pingIntervalMs?: number;
141
- }
142
- export interface SessionStartOptions extends SessionCreateOptions {
143
- readonly message: SessionInput;
144
- readonly deleteAfter?: boolean;
145
- readonly messageIdempotencyKey?: string;
146
- readonly stream?: Omit<SessionSendOptions, "idempotencyKey">;
147
- }
148
- /** Options for {@link Aex.start}. */
149
- export interface StartSessionOptions {
150
- /** Overall wait budget (ms) for the one-shot run to finish. */
151
- readonly timeoutMs?: number;
152
- readonly webSocketFactory?: WebSocketFactory;
153
- readonly idleTimeoutMs?: number;
154
- readonly pingIntervalMs?: number;
155
- /** Throw a {@link SessionStateError} when the session does not succeed. Default false. */
156
- readonly throwOnFailure?: boolean;
157
- }
158
- /**
159
- * The unified finished result of one run (`session.messages.send(...).finished()`). Extends
160
- * the contracts {@link TurnResult}, so `finished()` returns the SAME shape as
161
- * `start()`: the terminal `status` (a {@link SessionTerminalOutcome}), `ok`,
162
- * `costUsd`, and `usage` come from that run's terminal event and are always present.
163
- */
164
- export interface SessionRunResult<T = unknown> extends TurnResult {
165
- readonly sessionId: string;
166
- readonly session: Session;
167
- readonly run: SessionRun;
168
- readonly text: string;
169
- readonly events: readonly AexEventView[];
170
- readonly files: readonly SessionFile[];
171
- /** Committed checkpoint for a finished run; absent when a run errors before one exists. */
172
- readonly checkpoint?: SessionCheckpointRevision;
173
- readonly messages: readonly Message[];
174
- /** The typed schema-decode outcome when a `json_schema` `responseFormat` was set. */
175
- readonly outcome?: TurnOutcome<T>;
176
- }
177
- /**
178
- * The unified finished result of {@link Aex.start}. Extends the contracts
179
- * {@link TurnResult} (the one shape `start()` and `finished()` share), so
180
- * the terminal `status` (a {@link SessionTerminalOutcome}), `ok`, `costUsd`
181
- * (`number`, `>= 0`), and `usage` are always present. RUN_FINISHED is emitted
182
- * only after the checkpoint commit. It is the same result returned by
183
- * `session.messages.send(...).finished()`, plus the decoded event trace.
184
- *
185
- * `T` is the `responseFormat` decode type: when the session was submitted with a
186
- * `json_schema` `responseFormat`, {@link outcome} carries the typed decoded
187
- * value or a typed refusal.
188
- */
189
- export interface SessionResult<T = unknown> extends SessionRunResult<T> {
190
- /** Decoded view of the events: tool calls, usage, and assistant text. */
191
- readonly trace: TurnTrace;
192
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=client-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-types.js","sourceRoot":"","sources":["../src/client-types.ts"],"names":[],"mappings":""}
package/dist/client.d.ts DELETED
@@ -1,464 +0,0 @@
1
- import { HttpClient, SecretString, type AexEventView, type AexStreamEventView, type BillingAutoTopupRequest, type BillingAutoTopupUpdate, type BillingHostedSession, type BillingLedgerPage, type BillingLedgerQuery, type BillingPortalRequest, type BillingSummary, type BillingTopupCheckoutRequest, type ChildSessionRef, type DebugSink, type FetchLike, type OtlpExportLogsServiceRequest, type OtlpExportTraceServiceRequest, type SessionFile, type SessionFileType, type SessionFileLink, type SessionFileLinkOptions, type SessionFileQuery, type SessionFilesQuery, type SessionFilesSnapshot, type SessionFileText, type ReadSessionFileTextOptions, type Session, type SessionCreateRequest, type SessionListPage, type SessionListQuery, type SessionStateChangeAccepted, type SessionWebhookDelivery, type SecretRecord, type OrgRecord, type CreateOrgRequest, type WorkspaceRecord, type CreateWorkspaceRequest, type ApiKeyRecord, type CreateApiKeyRequest, type OrgMemberRecord, type CreateOrgInviteRequest, type OrgInvite, type WorkspaceFileRecord, type WorkspaceInstructionRecord, type WorkspaceResourceListQuery, type WorkspaceResourcePage, type WorkspaceSkillRecord, type WorkspaceToolRecord, type WebhookSigningSecret, type WhoAmI } from "./_contracts/index.js";
2
- import { Instructions } from "./instructions.js";
3
- import { type UploadedAsset } from "./asset-upload.js";
4
- import { File, type ZipStreamDriver } from "./file.js";
5
- import { type RetryOptions } from "./retry.js";
6
- import { Skill } from "./skill.js";
7
- import { Tool } from "./tool.js";
8
- import type { IdempotencyOptions, Message, SessionCreateOptions, SessionInput, SessionResult, SessionRunResult, SessionSendOptions, SessionStartOptions, StartSessionOptions } from "./client-types.js";
9
- export type { IdempotencyOptions, Message, SessionCreateOptions, SessionEnvironmentOptions, SessionInput, SessionOverrides, SessionResult, SessionRunResult, SessionSendOptions, SessionStartOptions, StartSessionOptions } from "./client-types.js";
10
- export interface AexOptions {
11
- /** Workspace-scoped SDK API key. */
12
- readonly apiKey?: string;
13
- /**
14
- * API root, e.g. `https://aex.example.com`. Optional — defaults to the
15
- * canonical prd URL (`https://api.aex.dev`). Dev keys select
16
- * `https://dev-api.aex.dev`; override this for a localhost development stack
17
- * or another hosted aex API endpoint.
18
- */
19
- readonly baseUrl?: string;
20
- /** Optional `fetch` override for testing. */
21
- readonly fetch?: FetchLike;
22
- /**
23
- * Local debug output. `true` prints a redacted one-line trace per HTTP
24
- * request to stderr (method, path, status, elapsed); pass a function to
25
- * route the traces elsewhere. Purely local — nothing is uploaded.
26
- */
27
- readonly debug?: boolean | DebugSink;
28
- /**
29
- * Built-in transport retry policy for hosted API requests and direct asset
30
- * uploads. Reads, idempotent HTTP methods, and mutations carrying a stable
31
- * Idempotency-Key are retried on transient failures with bounded exponential
32
- * backoff + jitter. Unsafe mutations are attempted once.
33
- *
34
- * Omit for sensible defaults (4 attempts, ~2 min budget); pass an object to
35
- * tune `maxAttempts` / delays / `maxElapsedMs`; pass `false` to disable.
36
- */
37
- readonly retry?: RetryOptions | false;
38
- }
39
- export declare class SessionRunStream implements AsyncIterable<AexStreamEventView> {
40
- #private;
41
- constructor(stream: () => AsyncGenerator<AexStreamEventView, SessionRunResult, void>);
42
- [Symbol.asyncIterator](): AsyncIterator<AexStreamEventView>;
43
- finished(): Promise<SessionRunResult>;
44
- }
45
- /**
46
- * Accessor over the session's assistant messages. `session.messages` returns
47
- * this synchronously; each method fetches on call.
48
- */
49
- export interface SessionMessages {
50
- send(input: SessionInput, options?: SessionSendOptions): SessionRunStream;
51
- replayLast(options?: SessionSendOptions): SessionRunStream;
52
- /** Return the full transcript, transparently following bounded API pages. */
53
- list(): Promise<readonly Message[]>;
54
- last(): Promise<Message | undefined>;
55
- first(): Promise<Message | undefined>;
56
- }
57
- /**
58
- * Accessor over the session's events. Snapshot/polling reads yield durable
59
- * {@link AexEventView}s with a replay cursor. The live coordinator may also
60
- * yield provisional {@link AexStreamEventView}s with `replayable:false` and a
61
- * per-run `liveSequence` instead of a durable `sequence`.
62
- */
63
- export interface SessionEvents {
64
- /** Lazily traverse durable history one bounded API page at a time. */
65
- iterate(options?: IterateEventsOptions): AsyncIterable<AexEventView>;
66
- list(): Promise<readonly AexEventView[]>;
67
- last(): Promise<AexEventView | undefined>;
68
- first(): Promise<AexEventView | undefined>;
69
- stream(options?: StreamEventsOptions): AsyncIterable<AexEventView>;
70
- streamEnvelopes(options?: StreamEnvelopesOptions): AsyncIterable<AexStreamEventView>;
71
- archiveLink(options?: SessionFileLinkOptions): Promise<SessionFileLink>;
72
- /** Download the events-namespace archive as a zip. */
73
- download(options?: DownloadOptions): Promise<Uint8Array>;
74
- }
75
- /** Standards-pure OTLP/HTTP JSON pages derived from a session's journal. */
76
- export interface SessionOtel {
77
- traces(): AsyncIterable<OtlpExportTraceServiceRequest>;
78
- logs(): AsyncIterable<OtlpExportLogsServiceRequest>;
79
- }
80
- /**
81
- * Accessor over the session's captured files (`session.files`):
82
- * enumerate, read one as capped text, locate/resolve, and download.
83
- */
84
- export interface SessionFiles {
85
- list(query?: SessionFilesQuery): Promise<SessionFilesSnapshot>;
86
- last(): Promise<SessionFile | undefined>;
87
- first(): Promise<SessionFile | undefined>;
88
- read(selector: SessionFileSelector, options?: ReadSessionFileTextOptions): Promise<SessionFileText>;
89
- find(query: SessionFilesQuery): Promise<readonly SessionFile[]>;
90
- findOne(query: SessionFilesQuery): Promise<SessionFile | null>;
91
- link(selectorOrQuery: SessionFileLinkSelector, options?: SessionFileLinkOptions): Promise<SessionFileLink>;
92
- fetch(selectorOrQuery: SessionFileLinkSelector, options?: SessionFileLinkOptions): Promise<Response>;
93
- /** No selector = files-namespace zip; with selector = one file's raw bytes. */
94
- download(selector?: SessionFileSelector, options?: DownloadOptions): Promise<Uint8Array>;
95
- }
96
- /**
97
- * Accessor over the session's run-scoped webhook ledger (`session.webhooks`).
98
- */
99
- export interface SessionWebhooks {
100
- list(): Promise<readonly SessionWebhookDelivery[]>;
101
- redeliver(deliveryId: string): Promise<void>;
102
- }
103
- export declare class SessionHandle {
104
- #private;
105
- readonly messages: SessionMessages;
106
- readonly events: SessionEvents;
107
- readonly otel: SessionOtel;
108
- readonly files: SessionFiles;
109
- readonly webhooks: SessionWebhooks;
110
- constructor(http: HttpClient, session: Session, fetch?: FetchLike);
111
- get id(): string;
112
- get record(): Session;
113
- suspend(): Promise<SessionStateChangeAccepted>;
114
- cancel(): Promise<SessionStateChangeAccepted>;
115
- resume(): Promise<SessionStateChangeAccepted>;
116
- delete(): Promise<void>;
117
- /**
118
- * Request the HITL write-gate: park this session `awaiting_approval` before
119
- * its next gated action. Imperative counterpart to the declarative
120
- * `approvalGate` submission option. Resume with {@link approve} / reject with
121
- * {@link deny}.
122
- */
123
- requestApproval(): Promise<SessionStateChangeAccepted>;
124
- /** Approve an `awaiting_approval` session so the held turn resumes (→ running). */
125
- approve(): Promise<SessionStateChangeAccepted>;
126
- /** Deny an `awaiting_approval` session; its run is cancelled and the session returns to `idle`. */
127
- deny(): Promise<SessionStateChangeAccepted>;
128
- /**
129
- * Enumerate this session's subagent CHILD sessions (`GET /api/sessions/:id/children`). Each is
130
- * a read-only {@link ChildSessionHandle} with observable events, checkpointed
131
- * files, descendants, lineage, and lifecycle state.
132
- */
133
- children(): Promise<readonly ChildSessionHandle[]>;
134
- /** Re-read the session record from the server and store it as the current record. */
135
- refresh(): Promise<Session>;
136
- /**
137
- * Download EVERYTHING public about this session as one zip, assembled
138
- * client-side from the public read endpoints. Organised into `metadata/`,
139
- * `events/`, and `files/` folders, plus a `manifest.json`. Pass `to` to
140
- * also write the bytes to a file path while still returning them.
141
- */
142
- download(options?: DownloadOptions): Promise<Uint8Array>;
143
- /** Download only the session record (the `metadata` namespace) as a zip. */
144
- downloadMetadata(options?: DownloadOptions): Promise<Uint8Array>;
145
- }
146
- export declare class SessionClient {
147
- #private;
148
- constructor(http: HttpClient, buildCreateRequest: (options: SessionCreateOptions) => Promise<SessionCreateRequest>, fetch?: FetchLike);
149
- create(options: SessionCreateOptions): Promise<SessionHandle>;
150
- open(sessionId: string): Promise<SessionHandle>;
151
- get(sessionId: string): Promise<Session>;
152
- delete(sessionId: string): Promise<void>;
153
- list(query?: SessionListQuery): Promise<SessionListPage>;
154
- }
155
- /** Child-session events accessor (list + polling stream) keyed on a session id. */
156
- export interface ChildSessionEvents {
157
- iterate(options?: IterateEventsOptions): AsyncIterable<AexEventView>;
158
- list(): Promise<readonly AexEventView[]>;
159
- stream(options?: StreamEventsOptions): AsyncIterable<AexEventView>;
160
- }
161
- /**
162
- * Read-only observation handle for a lineage-discoverable subagent child.
163
- * Child ids address events, checkpointed files, and descendants. They are not
164
- * top-level resumable sessions, so this handle deliberately has no get, send,
165
- * cancel, suspend, resume, or delete controls.
166
- */
167
- export declare class ChildSessionHandle {
168
- #private;
169
- readonly events: ChildSessionEvents;
170
- readonly files: SessionFiles;
171
- constructor(http: HttpClient, ref: ChildSessionRef, fetch?: FetchLike);
172
- get id(): string;
173
- get parentSessionId(): string;
174
- get depth(): number | undefined;
175
- /** The lifecycle status captured by the parent lineage read. */
176
- get status(): ChildSessionRef["status"];
177
- get ref(): ChildSessionRef;
178
- /** This child's own subagent children (recursive lineage). */
179
- children(): Promise<readonly ChildSessionHandle[]>;
180
- }
181
- export interface StreamEventsOptions {
182
- /** Starting cursor; only events with `sequence >= from` are considered. Default 0. */
183
- readonly from?: number;
184
- /** Poll interval in ms for the event snapshot loop. Default 1000. */
185
- readonly intervalMs?: number;
186
- readonly signal?: AbortSignal;
187
- }
188
- export interface IterateEventsOptions {
189
- /** Number of durable events requested per API page. Default and maximum: 1000. */
190
- readonly pageSize?: number;
191
- /** Stop before requesting another page, or abort the active page request. */
192
- readonly signal?: AbortSignal;
193
- }
194
- export interface StreamEnvelopesOptions {
195
- /** Starting cursor — events with `sequence >= from` are delivered. Default 0. */
196
- readonly from?: number;
197
- readonly signal?: AbortSignal;
198
- /**
199
- * Half-open watchdog window passed to the coordinator stream. If no frame
200
- * arrives within this many ms, the SDK reconnects and resumes from the
201
- * current cursor. Default 45s. Set 0 to disable.
202
- */
203
- readonly idleTimeoutMs?: number;
204
- /**
205
- * Client keep-alive ping cadence passed to the coordinator stream. Default
206
- * 15s. Set 0 to disable.
207
- */
208
- readonly pingIntervalMs?: number;
209
- /**
210
- * Event-quiet replay self-heal window passed to the coordinator stream. If no
211
- * real event frame arrives within this many ms, the SDK reconnects and replays
212
- * from the current cursor. Default 90s. Set 0 to disable.
213
- */
214
- readonly eventQuietRecheckMs?: number;
215
- }
216
- export type SessionFilePathMatch = "exact" | "suffix";
217
- export interface SessionFilePathSelector {
218
- readonly path: string;
219
- readonly match?: SessionFilePathMatch;
220
- }
221
- export interface SessionFileIdSelector {
222
- readonly id: string;
223
- readonly checkpointId: string;
224
- }
225
- export type SessionFileSelector = SessionFile | SessionFileIdSelector | SessionFilePathSelector;
226
- export type SessionFileLinkSelector = SessionFileSelector | SessionFilesQuery;
227
- export interface DownloadOptions {
228
- readonly to?: string;
229
- /** Immutable checkpoint to read. */
230
- readonly checkpointId?: string;
231
- /**
232
- * Per-attempt timeout for fetching and reading the selected file body.
233
- * Defaults to 30_000ms; idempotent file downloads retry once on timeout.
234
- */
235
- readonly timeoutMs?: number;
236
- }
237
- /**
238
- * Workspace secret management exposed under `client.workspace.secrets`.
239
- *
240
- * Lifecycle parity with assets: a `Secret.value(...)` is per-session and
241
- * gone at terminal; `set` persists a named, searchable workspace secret you can `get` (metadata),
242
- * `rotate`, `list`, and `delete`. The identity is the `name`; the value rotates
243
- * under that stable name.
244
- *
245
- * Values are write-only through the public SDK: `set`/`rotate` send the value in
246
- * the request BODY (never the URL); `get`/`list` return metadata only.
247
- */
248
- export declare class SecretsClient {
249
- #private;
250
- constructor(http: HttpClient);
251
- /** Create a named workspace secret. Accepts a raw string or a `SecretString`. */
252
- set(args: {
253
- readonly name: string;
254
- readonly value: string | SecretString;
255
- }): Promise<SecretRecord>;
256
- /** List workspace secret metadata (searchable by name). Never returns values. */
257
- list(): Promise<readonly SecretRecord[]>;
258
- /** Metadata for one workspace secret by name. Never returns the value. */
259
- get(name: string): Promise<SecretRecord>;
260
- /** Replace the value of an existing workspace secret; bumps its version. */
261
- rotate(args: {
262
- readonly name: string;
263
- readonly value: string | SecretString;
264
- }): Promise<SecretRecord>;
265
- delete(name: string): Promise<void>;
266
- }
267
- /**
268
- * The one-time reveal of a newly created workspace + its first workspace-scoped
269
- * API key. The key is shown exactly once at creation; it is wrapped in a
270
- * redacted {@link SecretString} so it never lands in a log via string coercion —
271
- * call `apiKey.unwrap()` to read the raw value (e.g. to construct a new `Aex`
272
- * client bound to the workspace).
273
- */
274
- export interface NewWorkspaceResult {
275
- readonly workspaceId: string;
276
- /** The workspace-scoped API key, revealed ONCE. Redacted on `toString`/JSON. */
277
- readonly apiKey: SecretString;
278
- readonly slug?: string;
279
- readonly orgId?: string;
280
- }
281
- /** The one-time reveal of a newly minted API key (workspace key or account PAT). */
282
- export interface NewApiKeyResult {
283
- readonly id: string;
284
- /** The freshly minted key value, revealed ONCE. Redacted on `toString`/JSON. */
285
- readonly apiKey: SecretString;
286
- readonly name?: string;
287
- readonly kind?: string;
288
- readonly workspaceId?: string;
289
- readonly scopes?: readonly string[];
290
- }
291
- /**
292
- * Control-plane management of the ORGS the account principal belongs to. Reached
293
- * with an account credential (PAT / device session), NOT a data-plane workspace
294
- * key. An org owns workspaces and is the billing / roles / cap boundary.
295
- *
296
- * Naming: `client.orgs` (plural) is a collection across the account, mirroring
297
- * `client.sessions` / `client.workspaces`.
298
- */
299
- export declare class OrgsClient {
300
- #private;
301
- constructor(http: HttpClient);
302
- /** Create an org; the caller becomes its admin. */
303
- create(args: CreateOrgRequest): Promise<OrgRecord>;
304
- /** List the orgs the caller belongs to. */
305
- list(): Promise<readonly OrgRecord[]>;
306
- /** List an org's members (pending invites appear with `status: "pending"`). */
307
- members(orgId: string): Promise<readonly OrgMemberRecord[]>;
308
- /** Invite an email to the org at a role (`member` by default). */
309
- invite(orgId: string, args: CreateOrgInviteRequest): Promise<OrgInvite>;
310
- }
311
- /**
312
- * Control-plane management of WORKSPACES across the account's orgs. This is the
313
- * PLURAL collection (`client.workspaces`) — distinct from the SINGULAR
314
- * `client.workspace`, which is the data-plane context bound to the current key
315
- * (its files/skills/tools/instructions/secrets). Creating a workspace returns
316
- * its first workspace-scoped key ONCE.
317
- */
318
- export declare class WorkspacesClient {
319
- #private;
320
- constructor(http: HttpClient);
321
- /**
322
- * Create a workspace under an org and reveal its first workspace-scoped API
323
- * key ONCE (wrapped in a redacted {@link SecretString}). The free tier caps at
324
- * 3 workspaces per org.
325
- */
326
- create(args: CreateWorkspaceRequest): Promise<NewWorkspaceResult>;
327
- /** List the workspaces the caller can manage across their orgs. */
328
- list(): Promise<readonly WorkspaceRecord[]>;
329
- /** Delete a workspace by id. Idempotent. */
330
- delete(workspaceId: string): Promise<void>;
331
- }
332
- /**
333
- * Control-plane management of API KEYS — both data-plane workspace keys and
334
- * account PATs. Creating a key reveals its value ONCE (wrapped in a redacted
335
- * {@link SecretString}); list/delete operate on metadata only.
336
- */
337
- export declare class KeysClient {
338
- #private;
339
- constructor(http: HttpClient);
340
- /**
341
- * Mint an API key and reveal its value ONCE. Pass `workspaceId` for a
342
- * data-plane workspace key, or `account: true` for an account PAT. A PAT
343
- * cannot mint another PAT (anti-escalation, enforced server-side).
344
- */
345
- create(args?: CreateApiKeyRequest): Promise<NewApiKeyResult>;
346
- /** List API keys (metadata only; never values). */
347
- list(): Promise<readonly ApiKeyRecord[]>;
348
- /** Revoke/delete an API key by id. Idempotent. */
349
- delete(keyId: string): Promise<void>;
350
- }
351
- /**
352
- * Unified user-facing client for aex. The same class powers the published
353
- * `@aexhq/sdk` SDK and, under the hood, the bundled `aex` CLI. All remote
354
- * operations use the hosted aex API and operate on durable session records.
355
- *
356
- * The SDK never asks the caller for a workspace id — workspace identity
357
- * is derived server-side from the API key on every request. Use
358
- * `client.whoami()` if you want to introspect which workspace the
359
- * token resolves to.
360
- */
361
- export declare class Aex {
362
- #private;
363
- /**
364
- * The SINGULAR data-plane context bound to the current key: this workspace's
365
- * files, skills, tools, instructions, and secrets. (Contrast {@link workspaces},
366
- * the plural control-plane collection.)
367
- */
368
- readonly workspace: WorkspaceClient;
369
- readonly sessions: SessionClient;
370
- /** Control-plane: the orgs the account principal belongs to (roles/members/invites). */
371
- readonly orgs: OrgsClient;
372
- /**
373
- * Control-plane: manage WORKSPACES across your orgs (create/list/delete). The
374
- * PLURAL collection — not to be confused with {@link workspace} (singular), the
375
- * data-plane context of the current key.
376
- */
377
- readonly workspaces: WorkspacesClient;
378
- /** Control-plane: manage API keys — workspace keys and account PATs (create/list/delete). */
379
- readonly keys: KeysClient;
380
- constructor(apiKey: string, options?: Omit<AexOptions, "apiKey">);
381
- constructor(options: AexOptions);
382
- /**
383
- * Convenience one-shot on top of the canonical session API:
384
- * open a session, send `message` as the first run, stream through its durable
385
- * terminal event, then return the collected text,
386
- * events, files, and session record. The returned `sessionId` is the session id,
387
- * so callers can resume later with `aex.sessions.open(sessionId)`.
388
- */
389
- start<T = unknown>(options: SessionStartOptions, opts?: StartSessionOptions): Promise<SessionResult<T>>;
390
- whoami(): Promise<WhoAmI>;
391
- /** Read prepaid balance, current-period allowances, recharge settings, and card state. */
392
- billing(): Promise<BillingSummary>;
393
- /** Buy prepaid credit through hosted checkout; first use also saves the card. */
394
- billingTopup(request: BillingTopupCheckoutRequest, options?: IdempotencyOptions): Promise<BillingHostedSession>;
395
- /** Set the separately consented, off-by-default auto-recharge authority. */
396
- billingAutoTopup(request: BillingAutoTopupRequest): Promise<BillingAutoTopupUpdate>;
397
- /** Create a hosted billing-portal session. */
398
- billingPortal(request?: BillingPortalRequest, options?: IdempotencyOptions): Promise<BillingHostedSession>;
399
- /** Read recent signed credit-ledger rows, newest first. */
400
- billingLedger(query?: BillingLedgerQuery): Promise<BillingLedgerPage>;
401
- /**
402
- * Reveal the workspace webhook signing secret (creating one on first use) —
403
- * the `whsec_<base64>` value `verifyAexWebhook` takes as `secret`. Backed by
404
- * `POST /api/webhook/signing-secret`; repeat calls return the SAME value (the
405
- * hosted API does not rotate it). Treat the reveal as sensitive: never log it.
406
- */
407
- webhookSigningSecret(): Promise<WebhookSigningSecret>;
408
- }
409
- type WorkspaceAssetPublisher = {
410
- upload(args: {
411
- readonly bytes: Uint8Array;
412
- readonly hash: string;
413
- readonly contentType: string;
414
- }): Promise<UploadedAsset>;
415
- uploadStream(args: {
416
- readonly drive: ZipStreamDriver;
417
- readonly contentType: string;
418
- }): Promise<UploadedAsset>;
419
- };
420
- export declare class WorkspaceFilesClient {
421
- private readonly http;
422
- private readonly publisher;
423
- constructor(http: HttpClient, publisher: WorkspaceAssetPublisher);
424
- publish(file: File): Promise<WorkspaceFileRecord>;
425
- list(query?: WorkspaceResourceListQuery): Promise<WorkspaceResourcePage<WorkspaceFileRecord>>;
426
- get(resourceId: string, version?: number): Promise<WorkspaceFileRecord>;
427
- delete(resourceId: string): Promise<void>;
428
- }
429
- export declare class WorkspaceSkillsClient {
430
- private readonly http;
431
- private readonly publisher;
432
- constructor(http: HttpClient, publisher: WorkspaceAssetPublisher);
433
- publish(skill: Skill): Promise<WorkspaceSkillRecord>;
434
- list(query?: WorkspaceResourceListQuery): Promise<WorkspaceResourcePage<WorkspaceSkillRecord>>;
435
- get(resourceId: string, version?: number): Promise<WorkspaceSkillRecord>;
436
- delete(resourceId: string): Promise<void>;
437
- }
438
- export declare class WorkspaceToolsClient {
439
- private readonly http;
440
- private readonly publisher;
441
- constructor(http: HttpClient, publisher: WorkspaceAssetPublisher);
442
- publish(tool: Tool): Promise<WorkspaceToolRecord>;
443
- list(query?: WorkspaceResourceListQuery): Promise<WorkspaceResourcePage<WorkspaceToolRecord>>;
444
- get(resourceId: string, version?: number): Promise<WorkspaceToolRecord>;
445
- delete(resourceId: string): Promise<void>;
446
- }
447
- export declare class WorkspaceInstructionsClient {
448
- private readonly http;
449
- private readonly publisher;
450
- constructor(http: HttpClient, publisher: WorkspaceAssetPublisher);
451
- publish(instructions: Instructions): Promise<WorkspaceInstructionRecord>;
452
- list(query?: WorkspaceResourceListQuery): Promise<WorkspaceResourcePage<WorkspaceInstructionRecord>>;
453
- get(resourceId: string, version?: number): Promise<WorkspaceInstructionRecord>;
454
- delete(resourceId: string): Promise<void>;
455
- }
456
- export declare class WorkspaceClient {
457
- readonly files: WorkspaceFilesClient;
458
- readonly skills: WorkspaceSkillsClient;
459
- readonly tools: WorkspaceToolsClient;
460
- readonly instructions: WorkspaceInstructionsClient;
461
- readonly secrets: SecretsClient;
462
- constructor(http: HttpClient, publisher: WorkspaceAssetPublisher);
463
- }
464
- export type { SessionFileType, SessionFileLink, SessionFileLinkOptions, SessionFileQuery };