@aexhq/sdk 0.46.5-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
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 aex contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,38 @@
1
+ aex
2
+ Copyright 2026 aex contributors
3
+
4
+ This product includes software developed by the aex project
5
+ (https://github.com/aexhq/aex).
6
+
7
+ Licensed under the Apache License, Version 2.0. The full text is in LICENSE.
8
+
9
+ --------------------------------------------------------------------------------
10
+ Third-party software redistributed in published artifacts
11
+ --------------------------------------------------------------------------------
12
+
13
+ Zod (`zod`)
14
+ Copyright (c) 2025 Colin McDonnell
15
+ Licensed under the MIT License:
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
34
+
35
+ `scripts/validate/package-metadata.test.ts` asserts that every production
36
+ dependency of every publishable package in this repository appears above. Adding
37
+ a runtime dependency to a published package without recording it here fails that
38
+ gate.
package/README.md CHANGED
@@ -1,48 +1,40 @@
1
1
  # @aexhq/sdk
2
2
 
3
- The TypeScript SDK and bundled CLI for durable aex agent sessions.
3
+ The TypeScript SDK for explicit aex v1 sessions.
4
4
 
5
5
  ```bash
6
6
  npm i @aexhq/sdk
7
7
  ```
8
8
 
9
- Model access is managed: name a model by its `creator/model` gateway slug and
10
- the platform's key routes it. You supply no provider API key.
11
-
12
9
  ```ts
13
10
  import { Aex } from "@aexhq/sdk";
14
11
 
15
- const aex = new Aex(process.env.AEX_API_KEY!);
16
- const session = await aex.sessions.create({
17
- model: "anthropic/claude-haiku-4-5"
18
- });
19
-
20
- const result = await session.messages.send("Summarize this repository.").finished();
21
- console.log(result.status, result.text, result.costUsd);
22
-
23
- const resumed = await aex.sessions.open(session.id);
24
- console.log(resumed.record.acceptsMessages, resumed.record.lastRun);
12
+ const aex = new Aex(process.env.AEX_WORKSPACE_API_KEY!);
13
+ const runs = await aex.sessions.sessionRunsList({ sessionId: "ses_…" });
14
+ console.log(runs);
25
15
  ```
26
16
 
27
- The public surface is organized by ownership:
17
+ The SDK exposes explicit bootstrap resources (`account`, `organizations`,
18
+ `workspaces`, `apiKeys`, and `billing`) and region-pinned workspace resources
19
+ (`sessions`, operations, files, registries, secrets, approvals, telemetry, and
20
+ usage). Long-running mutations return durable operation handles.
28
21
 
29
- - `aex.sessions`: create, reopen, get, list, and delete sessions.
30
- - `session.messages`, `session.events`, `session.files`: stable session-owned resources.
31
- - `aex.workspace.files`, `.skills`, `.tools`, `.instructions`, `.secrets`: reusable workspace resources.
32
- - `aex.start()`: the one-shot create, send, and finish convenience.
22
+ Every resource method is generated from the published contract, one per
23
+ operation the platform serves. An operation the contract declares and nothing
24
+ serves yet has **no method**: a method that could only ever fail would put the
25
+ platform's answer in the client, where it goes stale the day the route lands.
26
+ `ROUTES` still carries all of them with a `deferred` flag, and
27
+ `aex.execute(routeId, …)` stays total over every route id, so a deferred
28
+ operation remains callable by anyone who wants to see the `501` for themselves.
33
29
 
34
- Session submissions accept immutable pinned refs under `assets`, with builtin
35
- capabilities configured separately through `builtinTools`. A successful
36
- `RUN_FINISHED` is the consistency boundary: checkpointed files, usage, cost,
37
- messages, and session state are committed before `finished()` resolves.
30
+ The SDK exposes only the strict v1 resource model. Registered inputs are
31
+ overwrite-by-name resources whose PUT result reports `created`, `replaced`, or
32
+ `unchanged`. Returned byte-bearing values contain checksum/size descriptors,
33
+ never inline bytes or upload IDs. Persisted/live file reads, current registered
34
+ file downloads, and telemetry exports remain explicit.
38
35
 
39
- See the [Quickstart](docs/quickstart.md), [Events](docs/events.md),
40
- [Files](docs/files.md), and [Composition](docs/concepts/composition.md) guides.
41
- Runnable projects are collected in
42
- [`aexhq/examples`](https://github.com/aexhq/examples).
36
+ The native `aex` command is distributed as a signed platform archive.
43
37
 
44
- The package also includes the CLI:
38
+ ## License
45
39
 
46
- ```bash
47
- npx aex --help
48
- ```
40
+ Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,33 @@
1
+ import { type AexTransport } from "../transport/transport.js";
2
+ import { type RouteId } from "../generated/routes.js";
3
+ import { GeneratedResources, type ExecuteOptions } from "../generated/resources.js";
4
+ export interface AexOptions {
5
+ readonly apiKey: string;
6
+ readonly centralBaseUrl?: string;
7
+ readonly regionalBaseUrl?: string;
8
+ readonly workspaceId?: string;
9
+ readonly transport?: AexTransport;
10
+ readonly fetch?: typeof globalThis.fetch;
11
+ readonly signal?: AbortSignal;
12
+ }
13
+ /**
14
+ * The client.
15
+ *
16
+ * The resource namespaces come from `GeneratedResources`, which the contract
17
+ * generator writes: one method per served operation, and none for an operation
18
+ * the platform does not answer. `execute` stays total over `RouteId`, so a
19
+ * deferred or streaming operation is still callable by anyone who wants to see
20
+ * what the platform actually says.
21
+ */
22
+ export declare class Aex extends GeneratedResources {
23
+ #private;
24
+ readonly transport: AexTransport;
25
+ constructor(apiKey: string, options?: Omit<AexOptions, "apiKey">);
26
+ constructor(options: AexOptions);
27
+ execute<T>(routeId: RouteId, bindings?: Readonly<Record<string, string>>, options?: ExecuteOptions): Promise<T>;
28
+ static buildInfo(): Readonly<{
29
+ packageVersion: string;
30
+ contractDigest: string;
31
+ sourceSha: string;
32
+ }>;
33
+ }
@@ -0,0 +1,98 @@
1
+ import { parseCredential } from "./credentials.js";
2
+ import { resolveCentralBaseUrl, resolveRegionalBaseUrl } from "./routing.js";
3
+ import { FetchTransport } from "../transport/transport.js";
4
+ import { CONTRACT_DIGEST, ROUTES } from "../generated/routes.js";
5
+ import { GeneratedResources } from "../generated/resources.js";
6
+ /**
7
+ * The client.
8
+ *
9
+ * The resource namespaces come from `GeneratedResources`, which the contract
10
+ * generator writes: one method per served operation, and none for an operation
11
+ * the platform does not answer. `execute` stays total over `RouteId`, so a
12
+ * deferred or streaming operation is still callable by anyone who wants to see
13
+ * what the platform actually says.
14
+ */
15
+ export class Aex extends GeneratedResources {
16
+ transport;
17
+ #credential;
18
+ #signal;
19
+ constructor(apiKeyOrOptions, rest = {}) {
20
+ super();
21
+ const options = typeof apiKeyOrOptions === "string"
22
+ ? { ...rest, apiKey: apiKeyOrOptions }
23
+ : apiKeyOrOptions;
24
+ this.#credential = parseCredential(options.apiKey);
25
+ this.#signal = options.signal;
26
+ if (options.transport) {
27
+ this.transport = options.transport;
28
+ }
29
+ else {
30
+ this.transport = new FetchTransport({
31
+ central: resolveCentralBaseUrl(options.centralBaseUrl),
32
+ regional: resolveRegionalBaseUrl(this.#credential, options),
33
+ }, options.fetch);
34
+ }
35
+ }
36
+ async execute(routeId, bindings = {}, options = {}) {
37
+ const route = ROUTES[routeId];
38
+ let path = route.path;
39
+ for (const [name, value] of Object.entries(bindings)) {
40
+ path = path.replace(`{${name}}`, encodeURIComponent(value));
41
+ }
42
+ const query = new URLSearchParams(options.query ?? {}).toString();
43
+ if (query)
44
+ path = `${path}?${query}`;
45
+ const headers = new Headers({
46
+ authorization: this.#credential.authorizationHeader(),
47
+ accept: "application/json",
48
+ "Aex-Client": "aex-sdk/0.50.0",
49
+ });
50
+ if (options.idempotencyKey)
51
+ headers.set("Idempotency-Key", options.idempotencyKey);
52
+ if (options.operationId)
53
+ headers.set("Aex-Operation-Id", options.operationId);
54
+ let bytes;
55
+ if (options.body !== undefined) {
56
+ headers.set("content-type", "application/json");
57
+ bytes = encodeCanonicalJson(options.body);
58
+ }
59
+ const request = {
60
+ routeId,
61
+ method: route.method,
62
+ path,
63
+ headers,
64
+ ...(bytes ? { body: bytes } : {}),
65
+ ...(this.#signal ? { signal: this.#signal } : {}),
66
+ };
67
+ const response = await this.transport.execute(request);
68
+ return response.body;
69
+ }
70
+ static buildInfo() {
71
+ return Object.freeze({ packageVersion: "0.50.0", contractDigest: CONTRACT_DIGEST, sourceSha: "development" });
72
+ }
73
+ }
74
+ /**
75
+ * Encodes one request body with object members in sorted order.
76
+ *
77
+ * The platform derives a replay intent from the bytes it receives, so two calls
78
+ * a caller believes are identical must serialize identically. Ordering every
79
+ * object once here is the rule that makes that true; the alternative is a
80
+ * per-route encoder, which is what this replaced.
81
+ */
82
+ function encodeCanonicalJson(body) {
83
+ return new TextEncoder().encode(JSON.stringify(canonical(body)));
84
+ }
85
+ function canonical(value) {
86
+ if (Array.isArray(value))
87
+ return value.map(canonical);
88
+ if (value === null || typeof value !== "object")
89
+ return value;
90
+ const ordered = {};
91
+ for (const key of Object.keys(value).sort()) {
92
+ const member = value[key];
93
+ if (member !== undefined)
94
+ ordered[key] = canonical(member);
95
+ }
96
+ return ordered;
97
+ }
98
+ //# sourceMappingURL=aex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aex.js","sourceRoot":"","sources":["../../src/client/aex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAuC,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,EAAgB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAuB,MAAM,2BAA2B,CAAC;AAYpF;;;;;;;;GAQG;AACH,MAAM,OAAO,GAAI,SAAQ,kBAAkB;IAChC,SAAS,CAAe;IACxB,WAAW,CAAmB;IAC9B,OAAO,CAA0B;IAI1C,YAAY,eAAoC,EAAE,OAAmC,EAAE;QACrF,KAAK,EAAE,CAAC;QACR,MAAM,OAAO,GAAG,OAAO,eAAe,KAAK,QAAQ;YACjD,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE;YACtC,CAAC,CAAC,eAAe,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;QAC9B,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACrC,CAAC;aAA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MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAgC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACvE,MAAM,MAAM,GAAI,KAAiC,CAAC,GAAG,CAAC,CAAC;QACvD,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,25 @@
1
+ export type RegionCode = "use1" | "use2" | "usw2" | "apne1" | "euw1";
2
+ declare abstract class Credential {
3
+ #private;
4
+ protected constructor(value: string);
5
+ authorizationHeader(): string;
6
+ redacted(): string;
7
+ toJSON(): string;
8
+ }
9
+ export declare class WorkspaceApiKey extends Credential {
10
+ #private;
11
+ private constructor();
12
+ static parse(value: string): WorkspaceApiKey;
13
+ regionCode(): RegionCode;
14
+ /** The workspace the key authorizes, as the public prefixed identifier. */
15
+ workspaceId(): string;
16
+ regionalBaseUrl(): string;
17
+ }
18
+ export declare class AccountToken extends Credential {
19
+ private constructor();
20
+ static parse(value: string): AccountToken;
21
+ }
22
+ export type ParsedCredential = WorkspaceApiKey | AccountToken;
23
+ export declare function parseCredential(value: string): ParsedCredential;
24
+ export declare function regionalHost(region: RegionCode): string;
25
+ export {};
@@ -0,0 +1,97 @@
1
+ import { AexConfigError } from "../transport/errors.js";
2
+ const BODY = "([0-9a-hjkmnp-tv-z]{26})";
3
+ const SECRET = "([A-Za-z0-9_-]{42}[AEIMQUYcgkosw048])";
4
+ // `aex_wk_<region>_<workspace>_<key>_<secret>`: a workspace key names both the
5
+ // region that serves it and the workspace it authorizes, so a regional endpoint
6
+ // can address every row it must read without a central round trip first.
7
+ const WORKSPACE_KEY = new RegExp(`^aex_wk_(use1|use2|usw2|apne1|euw1)_${BODY}_${BODY}_${SECRET}$`);
8
+ const ACCOUNT_TOKEN = new RegExp(`^aex_at_${BODY}_${SECRET}$`);
9
+ const CROCKFORD = "0123456789abcdefghjkmnpqrstvwxyz";
10
+ const HOSTS = Object.freeze({
11
+ use1: "https://us-east-1.api.aex.dev",
12
+ use2: "https://us-east-2.api.aex.dev",
13
+ usw2: "https://us-west-2.api.aex.dev",
14
+ apne1: "https://ap-northeast-1.api.aex.dev",
15
+ euw1: "https://eu-west-1.api.aex.dev",
16
+ });
17
+ class Credential {
18
+ #value;
19
+ constructor(value) {
20
+ this.#value = value;
21
+ }
22
+ authorizationHeader() {
23
+ return `Bearer ${this.#value}`;
24
+ }
25
+ redacted() {
26
+ return `${this.#value.slice(0, this.#value.indexOf("_", 7) + 1)}[redacted]`;
27
+ }
28
+ toJSON() {
29
+ return this.redacted();
30
+ }
31
+ }
32
+ export class WorkspaceApiKey extends Credential {
33
+ #region;
34
+ #workspaceId;
35
+ constructor(value, region, workspaceId) {
36
+ super(value);
37
+ this.#region = region;
38
+ this.#workspaceId = workspaceId;
39
+ }
40
+ static parse(value) {
41
+ const match = WORKSPACE_KEY.exec(value);
42
+ if (!match || !isUuid7Body(match[2] ?? "") || !isUuid7Body(match[3] ?? "")) {
43
+ throw new AexConfigError("invalid credential: expected an aex_wk_ workspace key with UUIDv7 workspace and key ids");
44
+ }
45
+ return new WorkspaceApiKey(value, match[1], `wsp_${match[2]}`);
46
+ }
47
+ regionCode() {
48
+ return this.#region;
49
+ }
50
+ /** The workspace the key authorizes, as the public prefixed identifier. */
51
+ workspaceId() {
52
+ return this.#workspaceId;
53
+ }
54
+ regionalBaseUrl() {
55
+ return HOSTS[this.#region];
56
+ }
57
+ }
58
+ export class AccountToken extends Credential {
59
+ constructor(value) {
60
+ super(value);
61
+ }
62
+ static parse(value) {
63
+ const match = ACCOUNT_TOKEN.exec(value);
64
+ if (!match || !isUuid7Body(match[1] ?? "")) {
65
+ throw new AexConfigError("invalid credential: expected an aex_at_ account token");
66
+ }
67
+ return new AccountToken(value);
68
+ }
69
+ }
70
+ export function parseCredential(value) {
71
+ if (value.startsWith("aex_wk_"))
72
+ return WorkspaceApiKey.parse(value);
73
+ if (value.startsWith("aex_at_"))
74
+ return AccountToken.parse(value);
75
+ throw new AexConfigError("invalid credential: expected prefix aex_wk_ or aex_at_");
76
+ }
77
+ export function regionalHost(region) {
78
+ return HOSTS[region];
79
+ }
80
+ function isUuid7Body(body) {
81
+ let value = 0n;
82
+ for (const character of body) {
83
+ const digit = CROCKFORD.indexOf(character);
84
+ if (digit < 0)
85
+ return false;
86
+ value = (value << 5n) | BigInt(digit);
87
+ }
88
+ if (value >= (1n << 128n))
89
+ return false;
90
+ const bytes = new Uint8Array(16);
91
+ for (let index = bytes.length - 1; index >= 0; index -= 1) {
92
+ bytes[index] = Number(value & 0xffn);
93
+ value >>= 8n;
94
+ }
95
+ return (bytes[6] & 0xf0) === 0x70 && (bytes[8] & 0xc0) === 0x80;
96
+ }
97
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/client/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG,uCAAuC,CAAC;AACvD,+EAA+E;AAC/E,gFAAgF;AAChF,yEAAyE;AACzE,MAAM,aAAa,GAAG,IAAI,MAAM,CAC9B,uCAAuC,IAAI,IAAI,IAAI,IAAI,MAAM,GAAG,CACjE,CAAC;AACF,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,WAAW,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC;AAC/D,MAAM,SAAS,GAAG,kCAAkC,CAAC;AAIrD,MAAM,KAAK,GAAyC,MAAM,CAAC,MAAM,CAAC;IAChE,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE,+BAA+B;IACrC,KAAK,EAAE,oCAAoC;IAC3C,IAAI,E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AC5B,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,KAAK,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACjC,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1D,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;QACrC,KAAK,KAAK,EAAE,CAAC;IACf,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;AACpE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type ParsedCredential } from "./credentials.js";
2
+ export interface RegionalRoutingOptions {
3
+ readonly regionalBaseUrl?: string;
4
+ readonly workspaceId?: string;
5
+ }
6
+ export declare function resolveRegionalBaseUrl(credential: ParsedCredential, options: RegionalRoutingOptions): string;
7
+ export declare function resolveCentralBaseUrl(value?: string): string;
@@ -0,0 +1,29 @@
1
+ import { AccountToken, WorkspaceApiKey } from "./credentials.js";
2
+ import { AexConfigError } from "../transport/errors.js";
3
+ function validateBaseUrl(value) {
4
+ let url;
5
+ try {
6
+ url = new URL(value);
7
+ }
8
+ catch {
9
+ throw new AexConfigError("base URL must be an absolute HTTPS URL");
10
+ }
11
+ if (url.protocol !== "https:" || url.username || url.password || url.search || url.hash) {
12
+ throw new AexConfigError("base URL must be HTTPS without credentials, query, or fragment");
13
+ }
14
+ return url.toString().replace(/\/$/, "");
15
+ }
16
+ export function resolveRegionalBaseUrl(credential, options) {
17
+ if (options.regionalBaseUrl)
18
+ return validateBaseUrl(options.regionalBaseUrl);
19
+ if (credential instanceof WorkspaceApiKey)
20
+ return credential.regionalBaseUrl();
21
+ if (credential instanceof AccountToken && options.workspaceId) {
22
+ throw new AexConfigError("an account token with workspaceId must resolve placement through workspace_get before regional I/O");
23
+ }
24
+ throw new AexConfigError("an account token requires regionalBaseUrl or workspaceId for regional routes");
25
+ }
26
+ export function resolveCentralBaseUrl(value = "https://api.aex.dev") {
27
+ return validateBaseUrl(value);
28
+ }
29
+ //# sourceMappingURL=routing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/client/routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAyB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOxD,SAAS,eAAe,CAAC,KAAa;IACpC,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,cAAc,CAAC,wCAAwC,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACxF,MAAM,IAAI,cAAc,CAAC,gEAAgE,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,UAA4B,EAC5B,OAA+B;IAE/B,IAAI,OAAO,CAAC,eAAe;QAAE,OAAO,eAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7E,IAAI,UAAU,YAAY,eAAe;QAAE,OAAO,UAAU,CAAC,eAAe,EAAE,CAAC;IAC/E,IAAI,UAAU,YAAY,YAAY,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QAC9D,MAAM,IAAI,cAAc,CACtB,oGAAoG,CACrG,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,cAAc,CACtB,8EAA8E,CAC/E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAK,GAAG,qBAAqB;IACjE,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,25 @@
1
+ export interface DownloadRange {
2
+ readonly start: number;
3
+ readonly endExclusive: number;
4
+ }
5
+ export interface DownloadGrant {
6
+ readonly url: string;
7
+ readonly headers?: Readonly<Record<string, string>>;
8
+ readonly expiresAt: string;
9
+ readonly sizeBytes: number;
10
+ readonly authorizedBytes: number;
11
+ readonly measurementId: string;
12
+ readonly sha256: string;
13
+ }
14
+ export declare const MAX_SINGLE_GET_BYTES = 5000000000000;
15
+ type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
16
+ export declare function planDownloadRanges(sizeBytes: number, selected?: DownloadRange): readonly DownloadRange[];
17
+ export declare class Download {
18
+ #private;
19
+ readonly grant: DownloadGrant;
20
+ constructor(grant: DownloadGrant, fetchLike?: FetchLike);
21
+ bytes(): Promise<Uint8Array>;
22
+ text(): Promise<string>;
23
+ json<T>(): Promise<T>;
24
+ }
25
+ export {};