@aexhq/sdk 0.46.4-canary → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +38 -0
  3. package/README.md +23 -31
  4. package/dist/client/aex.d.ts +33 -0
  5. package/dist/client/aex.js +98 -0
  6. package/dist/client/aex.js.map +1 -0
  7. package/dist/client/credentials.d.ts +25 -0
  8. package/dist/client/credentials.js +97 -0
  9. package/dist/client/credentials.js.map +1 -0
  10. package/dist/client/routing.d.ts +7 -0
  11. package/dist/client/routing.js +29 -0
  12. package/dist/client/routing.js.map +1 -0
  13. package/dist/downloads/download.d.ts +25 -0
  14. package/dist/downloads/download.js +53 -0
  15. package/dist/downloads/download.js.map +1 -0
  16. package/dist/generated/errors.d.ts +12 -0
  17. package/dist/generated/errors.js +81 -0
  18. package/dist/generated/errors.js.map +1 -0
  19. package/dist/generated/resources.d.ts +730 -0
  20. package/dist/generated/resources.js +606 -0
  21. package/dist/generated/resources.js.map +1 -0
  22. package/dist/generated/routes.d.ts +42 -0
  23. package/dist/generated/routes.js +2101 -0
  24. package/dist/generated/routes.js.map +1 -0
  25. package/dist/index.d.ts +20 -50
  26. package/dist/index.js +11 -62
  27. package/dist/index.js.map +1 -1
  28. package/dist/observations/stream.d.ts +1 -0
  29. package/dist/observations/stream.js +18 -0
  30. package/dist/observations/stream.js.map +1 -0
  31. package/dist/transport/errors.d.ts +60 -0
  32. package/dist/transport/errors.js +107 -0
  33. package/dist/transport/errors.js.map +1 -0
  34. package/dist/transport/pagination.d.ts +8 -0
  35. package/dist/transport/pagination.js +34 -0
  36. package/dist/transport/pagination.js.map +1 -0
  37. package/dist/transport/retry.d.ts +21 -0
  38. package/dist/transport/retry.js +37 -0
  39. package/dist/transport/retry.js.map +1 -0
  40. package/dist/transport/transport.d.ts +25 -0
  41. package/dist/transport/transport.js +28 -0
  42. package/dist/transport/transport.js.map +1 -0
  43. package/package.json +63 -30
  44. package/dist/_contracts/account-operations.d.ts +0 -101
  45. package/dist/_contracts/account-operations.js +0 -242
  46. package/dist/_contracts/account-types.d.ts +0 -461
  47. package/dist/_contracts/account-types.js +0 -1
  48. package/dist/_contracts/api-key.d.ts +0 -61
  49. package/dist/_contracts/api-key.js +0 -101
  50. package/dist/_contracts/api-routes.d.ts +0 -20
  51. package/dist/_contracts/api-routes.js +0 -109
  52. package/dist/_contracts/archive-limits.d.ts +0 -3
  53. package/dist/_contracts/archive-limits.js +0 -23
  54. package/dist/_contracts/asset-authoring.d.ts +0 -22
  55. package/dist/_contracts/asset-authoring.js +0 -106
  56. package/dist/_contracts/asset-bundle.d.ts +0 -64
  57. package/dist/_contracts/asset-bundle.js +0 -263
  58. package/dist/_contracts/asset-upload-helper.d.ts +0 -31
  59. package/dist/_contracts/asset-upload-helper.js +0 -84
  60. package/dist/_contracts/billing-admission.d.ts +0 -29
  61. package/dist/_contracts/billing-admission.js +0 -28
  62. package/dist/_contracts/bundle-manifest.d.ts +0 -89
  63. package/dist/_contracts/bundle-manifest.js +0 -158
  64. package/dist/_contracts/canonical-sha256.d.ts +0 -8
  65. package/dist/_contracts/canonical-sha256.js +0 -8
  66. package/dist/_contracts/connection-ticket.d.ts +0 -22
  67. package/dist/_contracts/connection-ticket.js +0 -54
  68. package/dist/_contracts/continuation-event.d.ts +0 -31
  69. package/dist/_contracts/continuation-event.js +0 -6
  70. package/dist/_contracts/contract-parse-error.d.ts +0 -12
  71. package/dist/_contracts/contract-parse-error.js +0 -51
  72. package/dist/_contracts/error-codes.d.ts +0 -26
  73. package/dist/_contracts/error-codes.js +0 -116
  74. package/dist/_contracts/error-factory.d.ts +0 -32
  75. package/dist/_contracts/error-factory.js +0 -174
  76. package/dist/_contracts/event-envelope.d.ts +0 -471
  77. package/dist/_contracts/event-envelope.js +0 -501
  78. package/dist/_contracts/event-stream-client.d.ts +0 -122
  79. package/dist/_contracts/event-stream-client.js +0 -445
  80. package/dist/_contracts/event-view.d.ts +0 -44
  81. package/dist/_contracts/event-view.js +0 -69
  82. package/dist/_contracts/failure-class.d.ts +0 -29
  83. package/dist/_contracts/failure-class.js +0 -73
  84. package/dist/_contracts/http.d.ts +0 -135
  85. package/dist/_contracts/http.js +0 -434
  86. package/dist/_contracts/ids.d.ts +0 -66
  87. package/dist/_contracts/ids.js +0 -119
  88. package/dist/_contracts/index.d.ts +0 -42
  89. package/dist/_contracts/index.js +0 -52
  90. package/dist/_contracts/internal.d.ts +0 -55
  91. package/dist/_contracts/internal.js +0 -113
  92. package/dist/_contracts/models.d.ts +0 -30
  93. package/dist/_contracts/models.js +0 -28
  94. package/dist/_contracts/operation-core.d.ts +0 -36
  95. package/dist/_contracts/operation-core.js +0 -70
  96. package/dist/_contracts/operations.d.ts +0 -218
  97. package/dist/_contracts/operations.js +0 -1496
  98. package/dist/_contracts/otlp-projection.d.ts +0 -78
  99. package/dist/_contracts/otlp-projection.js +0 -171
  100. package/dist/_contracts/post-hook.d.ts +0 -31
  101. package/dist/_contracts/post-hook.js +0 -61
  102. package/dist/_contracts/provider-fault.d.ts +0 -34
  103. package/dist/_contracts/provider-fault.js +0 -68
  104. package/dist/_contracts/retry-core.d.ts +0 -29
  105. package/dist/_contracts/retry-core.js +0 -79
  106. package/dist/_contracts/runner-event.d.ts +0 -117
  107. package/dist/_contracts/runner-event.js +0 -172
  108. package/dist/_contracts/runtime-kind.d.ts +0 -60
  109. package/dist/_contracts/runtime-kind.js +0 -70
  110. package/dist/_contracts/runtime-manifest.d.ts +0 -121
  111. package/dist/_contracts/runtime-manifest.js +0 -83
  112. package/dist/_contracts/runtime-security-profile.d.ts +0 -26
  113. package/dist/_contracts/runtime-security-profile.js +0 -73
  114. package/dist/_contracts/runtime-sizes.d.ts +0 -104
  115. package/dist/_contracts/runtime-sizes.js +0 -111
  116. package/dist/_contracts/runtime-types.d.ts +0 -618
  117. package/dist/_contracts/runtime-types.js +0 -58
  118. package/dist/_contracts/schemas/asset-bundle.d.ts +0 -70
  119. package/dist/_contracts/schemas/asset-bundle.js +0 -107
  120. package/dist/_contracts/schemas/asset-ref.d.ts +0 -61
  121. package/dist/_contracts/schemas/asset-ref.js +0 -118
  122. package/dist/_contracts/schemas/bundle-manifest.d.ts +0 -66
  123. package/dist/_contracts/schemas/bundle-manifest.js +0 -77
  124. package/dist/_contracts/schemas/index.d.ts +0 -32
  125. package/dist/_contracts/schemas/index.js +0 -30
  126. package/dist/_contracts/schemas/mcp-server.d.ts +0 -99
  127. package/dist/_contracts/schemas/mcp-server.js +0 -209
  128. package/dist/_contracts/schemas/models.d.ts +0 -29
  129. package/dist/_contracts/schemas/models.js +0 -51
  130. package/dist/_contracts/schemas/numeric.d.ts +0 -18
  131. package/dist/_contracts/schemas/numeric.js +0 -28
  132. package/dist/_contracts/schemas/post-hook.d.ts +0 -45
  133. package/dist/_contracts/schemas/post-hook.js +0 -68
  134. package/dist/_contracts/schemas/response-assets.d.ts +0 -75
  135. package/dist/_contracts/schemas/response-assets.js +0 -81
  136. package/dist/_contracts/schemas/response-billing.d.ts +0 -208
  137. package/dist/_contracts/schemas/response-billing.js +0 -139
  138. package/dist/_contracts/schemas/response-common.d.ts +0 -132
  139. package/dist/_contracts/schemas/response-common.js +0 -162
  140. package/dist/_contracts/schemas/response-identity.d.ts +0 -648
  141. package/dist/_contracts/schemas/response-identity.js +0 -131
  142. package/dist/_contracts/schemas/response-mcp-servers.d.ts +0 -51
  143. package/dist/_contracts/schemas/response-mcp-servers.js +0 -32
  144. package/dist/_contracts/schemas/response-secrets.d.ts +0 -50
  145. package/dist/_contracts/schemas/response-secrets.js +0 -32
  146. package/dist/_contracts/schemas/response-sessions-internal.d.ts +0 -200
  147. package/dist/_contracts/schemas/response-sessions-internal.js +0 -142
  148. package/dist/_contracts/schemas/response-sessions.d.ts +0 -1598
  149. package/dist/_contracts/schemas/response-sessions.js +0 -377
  150. package/dist/_contracts/schemas/response-webhooks.d.ts +0 -76
  151. package/dist/_contracts/schemas/response-webhooks.js +0 -42
  152. package/dist/_contracts/schemas/response-workspace.d.ts +0 -225
  153. package/dist/_contracts/schemas/response-workspace.js +0 -99
  154. package/dist/_contracts/schemas/runtime-kind.d.ts +0 -31
  155. package/dist/_contracts/schemas/runtime-kind.js +0 -29
  156. package/dist/_contracts/schemas/runtime-security-profile.d.ts +0 -28
  157. package/dist/_contracts/schemas/runtime-security-profile.js +0 -26
  158. package/dist/_contracts/schemas/runtime-sizes.d.ts +0 -70
  159. package/dist/_contracts/schemas/runtime-sizes.js +0 -127
  160. package/dist/_contracts/schemas/session-limits.d.ts +0 -34
  161. package/dist/_contracts/schemas/session-limits.js +0 -39
  162. package/dist/_contracts/schemas/session-machine.d.ts +0 -23
  163. package/dist/_contracts/schemas/session-machine.js +0 -24
  164. package/dist/_contracts/schemas/session-request-config.d.ts +0 -58
  165. package/dist/_contracts/schemas/session-request-config.js +0 -134
  166. package/dist/_contracts/schemas/session-webhook.d.ts +0 -11
  167. package/dist/_contracts/schemas/session-webhook.js +0 -38
  168. package/dist/_contracts/schemas/side-effect-audit.d.ts +0 -98
  169. package/dist/_contracts/schemas/side-effect-audit.js +0 -102
  170. package/dist/_contracts/schemas/submission-assets.d.ts +0 -117
  171. package/dist/_contracts/schemas/submission-assets.js +0 -147
  172. package/dist/_contracts/schemas/submission-body.d.ts +0 -251
  173. package/dist/_contracts/schemas/submission-body.js +0 -378
  174. package/dist/_contracts/schemas/submission-environment.d.ts +0 -79
  175. package/dist/_contracts/schemas/submission-environment.js +0 -179
  176. package/dist/_contracts/schemas/submission-request.d.ts +0 -158
  177. package/dist/_contracts/schemas/submission-request.js +0 -49
  178. package/dist/_contracts/schemas/submission-secrets.d.ts +0 -47
  179. package/dist/_contracts/schemas/submission-secrets.js +0 -108
  180. package/dist/_contracts/schemas/wire.d.ts +0 -118
  181. package/dist/_contracts/schemas/wire.js +0 -171
  182. package/dist/_contracts/schemas/workspace-resources.d.ts +0 -50
  183. package/dist/_contracts/schemas/workspace-resources.js +0 -87
  184. package/dist/_contracts/sdk-errors.d.ts +0 -212
  185. package/dist/_contracts/sdk-errors.js +0 -313
  186. package/dist/_contracts/sdk-secrets.d.ts +0 -67
  187. package/dist/_contracts/sdk-secrets.js +0 -427
  188. package/dist/_contracts/session-archive.d.ts +0 -16
  189. package/dist/_contracts/session-archive.js +0 -92
  190. package/dist/_contracts/session-artifacts.d.ts +0 -189
  191. package/dist/_contracts/session-artifacts.js +0 -264
  192. package/dist/_contracts/session-config.d.ts +0 -373
  193. package/dist/_contracts/session-config.js +0 -562
  194. package/dist/_contracts/session-cost-types.d.ts +0 -211
  195. package/dist/_contracts/session-cost-types.js +0 -69
  196. package/dist/_contracts/session-cost.d.ts +0 -8
  197. package/dist/_contracts/session-cost.js +0 -582
  198. package/dist/_contracts/session-custody.d.ts +0 -165
  199. package/dist/_contracts/session-custody.js +0 -345
  200. package/dist/_contracts/session-file-query.d.ts +0 -14
  201. package/dist/_contracts/session-file-query.js +0 -178
  202. package/dist/_contracts/session-record.d.ts +0 -112
  203. package/dist/_contracts/session-record.js +0 -165
  204. package/dist/_contracts/session-retention.d.ts +0 -201
  205. package/dist/_contracts/session-retention.js +0 -450
  206. package/dist/_contracts/side-effect-audit.d.ts +0 -126
  207. package/dist/_contracts/side-effect-audit.js +0 -520
  208. package/dist/_contracts/sse.d.ts +0 -74
  209. package/dist/_contracts/sse.js +0 -227
  210. package/dist/_contracts/stable.d.ts +0 -45
  211. package/dist/_contracts/stable.js +0 -62
  212. package/dist/_contracts/status.d.ts +0 -25
  213. package/dist/_contracts/status.js +0 -57
  214. package/dist/_contracts/submission-limits.d.ts +0 -61
  215. package/dist/_contracts/submission-limits.js +0 -60
  216. package/dist/_contracts/submission.d.ts +0 -547
  217. package/dist/_contracts/submission.js +0 -812
  218. package/dist/_contracts/suggest.d.ts +0 -15
  219. package/dist/_contracts/suggest.js +0 -53
  220. package/dist/_contracts/testing/response-bindings.d.ts +0 -45
  221. package/dist/_contracts/testing/response-bindings.js +0 -256
  222. package/dist/_contracts/testing/wire-conformance-entry.d.ts +0 -10
  223. package/dist/_contracts/testing/wire-conformance-entry.js +0 -8
  224. package/dist/_contracts/testing/wire-conformance.d.ts +0 -169
  225. package/dist/_contracts/testing/wire-conformance.js +0 -276
  226. package/dist/_contracts/turn-trace.d.ts +0 -28
  227. package/dist/_contracts/turn-trace.js +0 -1
  228. package/dist/_contracts/unknown-field-error.d.ts +0 -13
  229. package/dist/_contracts/unknown-field-error.js +0 -21
  230. package/dist/_contracts/value-guards.d.ts +0 -20
  231. package/dist/_contracts/value-guards.js +0 -34
  232. package/dist/_contracts/webhook-verify.d.ts +0 -34
  233. package/dist/_contracts/webhook-verify.js +0 -93
  234. package/dist/_contracts/wire-observer.d.ts +0 -49
  235. package/dist/_contracts/wire-observer.js +0 -34
  236. package/dist/_contracts/workflow-status.d.ts +0 -7
  237. package/dist/_contracts/workflow-status.js +0 -43
  238. package/dist/_contracts/workspace-resources.d.ts +0 -98
  239. package/dist/_contracts/workspace-resources.js +0 -39
  240. package/dist/archive-limits.d.ts +0 -1
  241. package/dist/archive-limits.js +0 -2
  242. package/dist/archive-limits.js.map +0 -1
  243. package/dist/asset-upload.d.ts +0 -47
  244. package/dist/asset-upload.js +0 -269
  245. package/dist/asset-upload.js.map +0 -1
  246. package/dist/bundle.d.ts +0 -9
  247. package/dist/bundle.js +0 -20
  248. package/dist/bundle.js.map +0 -1
  249. package/dist/canonical-zip.d.ts +0 -68
  250. package/dist/canonical-zip.js +0 -355
  251. package/dist/canonical-zip.js.map +0 -1
  252. package/dist/cli.mjs +0 -12048
  253. package/dist/cli.mjs.sha256 +0 -1
  254. package/dist/client-types.d.ts +0 -192
  255. package/dist/client-types.js +0 -2
  256. package/dist/client-types.js.map +0 -1
  257. package/dist/client.d.ts +0 -464
  258. package/dist/client.js +0 -1207
  259. package/dist/client.js.map +0 -1
  260. package/dist/event-projection.d.ts +0 -22
  261. package/dist/event-projection.js +0 -380
  262. package/dist/event-projection.js.map +0 -1
  263. package/dist/fetch-archive.d.ts +0 -16
  264. package/dist/fetch-archive.js +0 -252
  265. package/dist/fetch-archive.js.map +0 -1
  266. package/dist/file.d.ts +0 -96
  267. package/dist/file.js +0 -272
  268. package/dist/file.js.map +0 -1
  269. package/dist/instructions.d.ts +0 -20
  270. package/dist/instructions.js +0 -40
  271. package/dist/instructions.js.map +0 -1
  272. package/dist/legacy-session-provider-fault.d.ts +0 -7
  273. package/dist/legacy-session-provider-fault.js +0 -38
  274. package/dist/legacy-session-provider-fault.js.map +0 -1
  275. package/dist/mcp-server.d.ts +0 -84
  276. package/dist/mcp-server.js +0 -117
  277. package/dist/mcp-server.js.map +0 -1
  278. package/dist/node-fs.d.ts +0 -29
  279. package/dist/node-fs.js +0 -19
  280. package/dist/node-fs.js.map +0 -1
  281. package/dist/node-walk.d.ts +0 -69
  282. package/dist/node-walk.js +0 -151
  283. package/dist/node-walk.js.map +0 -1
  284. package/dist/path-basename.d.ts +0 -5
  285. package/dist/path-basename.js +0 -9
  286. package/dist/path-basename.js.map +0 -1
  287. package/dist/retry.d.ts +0 -70
  288. package/dist/retry.js +0 -155
  289. package/dist/retry.js.map +0 -1
  290. package/dist/secret.d.ts +0 -65
  291. package/dist/secret.js +0 -110
  292. package/dist/secret.js.map +0 -1
  293. package/dist/session-validate.d.ts +0 -100
  294. package/dist/session-validate.js +0 -303
  295. package/dist/session-validate.js.map +0 -1
  296. package/dist/skill.d.ts +0 -99
  297. package/dist/skill.js +0 -169
  298. package/dist/skill.js.map +0 -1
  299. package/dist/submission-wire.d.ts +0 -13
  300. package/dist/submission-wire.js +0 -69
  301. package/dist/submission-wire.js.map +0 -1
  302. package/dist/tool.d.ts +0 -41
  303. package/dist/tool.js +0 -76
  304. package/dist/tool.js.map +0 -1
  305. package/dist/version.d.ts +0 -9
  306. package/dist/version.js +0 -10
  307. package/dist/version.js.map +0 -1
  308. package/docs/authentication.md +0 -125
  309. package/docs/billing.md +0 -164
  310. package/docs/cleanup.md +0 -27
  311. package/docs/concepts/agent-tools.md +0 -47
  312. package/docs/concepts/composition.md +0 -60
  313. package/docs/concepts/providers-and-runtimes.md +0 -121
  314. package/docs/concepts/sessions.md +0 -51
  315. package/docs/concepts/subagents.md +0 -35
  316. package/docs/credentials.md +0 -116
  317. package/docs/defaults.md +0 -51
  318. package/docs/errors.md +0 -258
  319. package/docs/events.md +0 -143
  320. package/docs/files.md +0 -130
  321. package/docs/limits-and-quotas.md +0 -114
  322. package/docs/limits.md +0 -51
  323. package/docs/mcp.md +0 -47
  324. package/docs/networking.md +0 -114
  325. package/docs/provider-runtime-capabilities.md +0 -32
  326. package/docs/public-surface.json +0 -73
  327. package/docs/quickstart.md +0 -135
  328. package/docs/release.md +0 -44
  329. package/docs/retries.md +0 -108
  330. package/docs/secrets.md +0 -141
  331. package/docs/session-config.md +0 -51
  332. package/docs/session-record.md +0 -58
  333. package/docs/skills.md +0 -65
  334. package/docs/telemetry.md +0 -66
  335. package/docs/testing.md +0 -35
  336. package/docs/vision-skills.md +0 -94
  337. package/docs/webhooks.md +0 -143
package/docs/telemetry.md DELETED
@@ -1,66 +0,0 @@
1
- ---
2
- title: OpenTelemetry export
3
- ---
4
-
5
- # OpenTelemetry export
6
-
7
- aex exposes each session's customer-visible trace and log timeline as
8
- standards-pure OTLP/HTTP JSON. The session journal remains the source of truth;
9
- the API derives telemetry from that durable history when you read it. This is
10
- a pull surface. It does not configure a push drain or create another telemetry
11
- store.
12
-
13
- ## SDK
14
-
15
- Open a session and iterate its trace or log pages:
16
-
17
- ```ts
18
- import { Aex } from "aex";
19
-
20
- const aex = new Aex({ apiKey: process.env.AEX_API_KEY! });
21
- const session = await aex.sessions.open("ses_...");
22
-
23
- for await (const request of session.otel.traces()) {
24
- // `request` is an OTLP ExportTraceServiceRequest JSON body.
25
- await fetch("http://localhost:4318/v1/traces", {
26
- method: "POST",
27
- headers: { "content-type": "application/json" },
28
- body: JSON.stringify(request)
29
- });
30
- }
31
-
32
- for await (const request of session.otel.logs()) {
33
- // `request` is an OTLP ExportLogsServiceRequest JSON body.
34
- }
35
- ```
36
-
37
- The SDK follows the API's opaque `x-aex-next-cursor` response header. Cursor
38
- metadata is never inserted into the OTLP body. Each yielded value can therefore
39
- be posted directly to the corresponding OTLP/HTTP endpoint.
40
-
41
- ## CLI
42
-
43
- Export all trace pages as one OTLP body:
44
-
45
- ```bash
46
- aex otel <session-id> --signal traces --json > traces.otlp.json
47
- curl -H 'content-type: application/json' \
48
- --data-binary @traces.otlp.json \
49
- http://localhost:4318/v1/traces
50
- ```
51
-
52
- Use `--signal logs` for an `ExportLogsServiceRequest`. Without `--json`, the
53
- same body is printed with indentation for reading. A local OpenTelemetry
54
- Collector can forward these requests to Jaeger or another compatible backend.
55
-
56
- ## Data boundary
57
-
58
- Only customer-visible, public-safe attributes are projected. Arbitrary event
59
- payload fields, prompts, credentials, private provider metadata, URLs, and
60
- operational details do not become telemetry attributes. Trace and span IDs on
61
- the event envelope let this external projection correlate with the same turn
62
- without exposing a private journal contract.
63
-
64
- The OpenTelemetry `gen_ai.*` semantic conventions are pre-1.0 and may evolve.
65
- aex keeps its documented public projection stable, while a future release may
66
- adopt renamed upstream attributes through the normal versioned release process.
package/docs/testing.md DELETED
@@ -1,35 +0,0 @@
1
- ---
2
- title: Testing
3
- ---
4
-
5
- # Testing
6
-
7
- aex uses test-first development.
8
- For repository changes, default the first meaningful test to blackbox behavior
9
- from requirements, public contracts, docs, logs, or user-visible evidence before
10
- reading or changing implementation.
11
-
12
- Workspace-wide commands:
13
-
14
- ```text
15
- bun run lint # typecheck/build prerequisites + lint
16
- bun run test # unit, all packages, deterministic
17
- bun run test:user:offline # clean Bun install of packed/published SDK, no live API
18
- bun run test:user # live hosted API user tests
19
- bun run test:user:heavy # explicit heavy live canary
20
- bun run docs:build # generated docs + Next build
21
- bun run pack:sdk # SDK pack dry-run + public boundary check
22
- ```
23
-
24
- Unit tests are deterministic and may use fakes. Offline user tests install the
25
- packed or published SDK into clean Bun temp projects and do not need provider
26
- credentials.
27
-
28
- When neither `AEX_USER_TEST_TARBALL` nor `AEX_USER_TEST_VERSION` is set, the
29
- user-test fixture packs the current workspace SDK into a tempdir and installs
30
- that artifact. CI or release validation can pin an explicit artifact with
31
- exactly one of `AEX_USER_TEST_TARBALL` or `AEX_USER_TEST_VERSION`.
32
-
33
- Live user tests run against a hosted aex API and fail loudly when required env
34
- is missing: `AEX_API_URL` and `AEX_API_KEY`. Model access uses the managed
35
- gateway; no customer provider key is part of test configuration.
@@ -1,94 +0,0 @@
1
- ---
2
- title: Call a vision API from a skill
3
- ---
4
-
5
- # Call a vision API from a skill
6
-
7
- aex has no built-in vision tool. The agent's `model` slug selects the reasoning
8
- model for the session; if a skill needs image understanding mid-session, ship a
9
- skill that calls the vision API with normal HTTP and pass that API's key as a
10
- runtime secret. (That key is yours and unrelated to model access — aex serves the
11
- session's own model through its managed gateway.)
12
-
13
- The runnable example lives at [`vision-skill/` in aexhq/examples](https://github.com/aexhq/examples/tree/main/vision-skill).
14
- It captions a frame with ByteDance Doubao Seed Vision (Ark) and returns a
15
- per-noun "does the frame depict X?" verdict.
16
-
17
- ## Submit the session
18
-
19
- ```ts
20
- import { Aex, Secret, Skill } from "@aexhq/sdk";
21
-
22
- const aex = new Aex({ apiKey: process.env.AEX_API_KEY! });
23
-
24
- const result = await aex.start({
25
- model: "anthropic/claude-haiku-4-5",
26
- message: "Read skills/frame-vision-gate/SKILL.md, then caption and verify the frame.",
27
- skills: [await Skill.fromDir("./vision-skill", { name: "frame-vision-gate" })],
28
- environment: {
29
- secrets: {
30
- DOUBAO_API_KEY: Secret.value(process.env.DOUBAO_API_KEY!)
31
- },
32
- networking: {
33
- mode: "limited",
34
- allowedHosts: ["ark.ap-southeast.bytepluses.com"]
35
- }
36
- },
37
- });
38
-
39
- console.log(result.sessionId, result.text);
40
- ```
41
-
42
- `Skill.fromDir("./vision-skill", ...)` is resolved relative to the process
43
- CWD. Run the script from the directory that contains `vision-skill/` (the
44
- root of the examples repo).
45
-
46
- ## Call the provider from the skill
47
-
48
- Inside the session, the skill reads `DOUBAO_API_KEY` and makes an
49
- OpenAI-compatible chat-completions request with Python's standard HTTP client.
50
- The image is base64-inlined as a data URL in the request body:
51
-
52
- ```python
53
- import base64, json, os, urllib.request
54
-
55
- b64 = base64.b64encode(open("/workspace/files/frame.jpg", "rb").read()).decode()
56
- request_body = {
57
- "model": "doubao-seed-1-6-vision-250815",
58
- "temperature": 0,
59
- "response_format": {"type": "json_object"},
60
- "messages": [
61
- {"role": "system", "content": "Describe only what the pixels show."},
62
- {"role": "user", "content": [
63
- {"type": "text", "text": "Does this frame depict an owlbear? Answer as JSON."},
64
- {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}}
65
- ]}
66
- ]
67
- }
68
-
69
- req = urllib.request.Request(
70
- "https://ark.ap-southeast.bytepluses.com/api/v3/chat/completions",
71
- data=json.dumps(request_body).encode("utf-8"),
72
- headers={
73
- "Authorization": f"Bearer {os.environ['DOUBAO_API_KEY']}",
74
- "Content-Type": "application/json"
75
- },
76
- method="POST",
77
- )
78
- ```
79
-
80
- The same pattern works for OpenAI, Gemini's OpenAI-compatible endpoint, or any
81
- other HTTPS model API. Put the key in `environment.secrets`, allow-list the host
82
- when using limited networking, and use the provider's normal SDK or HTTP API.
83
-
84
- ## Payload size
85
-
86
- Base64 images are larger than their source files. Scale frames before captioning
87
- when possible, for example:
88
-
89
- ```bash
90
- ffmpeg -i source.mp4 -vf fps=1,scale=960:-1 frame_%03d.jpg
91
- ```
92
-
93
- This keeps upload size and model cost bounded without losing the signal most
94
- vision models need.
package/docs/webhooks.md DELETED
@@ -1,143 +0,0 @@
1
- ---
2
- title: Webhooks
3
- ---
4
-
5
- # Webhooks
6
-
7
- aex can notify your endpoint whenever a run finishes. Register the callback on a
8
- session and the platform delivers one run-scoped event after each run finalizes:
9
- `run.finished` for AG-UI `RUN_FINISHED`, or `run.error` for `RUN_ERROR`. Sending
10
- another message on the same session produces another independently identifiable
11
- delivery.
12
-
13
- ## Register a callback
14
-
15
- ```ts
16
- import { Aex } from "@aexhq/sdk";
17
-
18
- const aex = new Aex(process.env.AEX_API_KEY!);
19
-
20
- const session = await aex.sessions.create({
21
- model: "anthropic/claude-haiku-4-5",
22
- webhook: { url: "https://hooks.example.com/aex" },
23
- });
24
- ```
25
-
26
- ```bash
27
- aex start \
28
- --api-key "$AEX_API_KEY" \
29
- --model anthropic/claude-haiku-4-5 \
30
- --prompt "Write the report." \
31
- --webhook https://hooks.example.com/aex
32
- ```
33
-
34
- The URL must be `https`. The callback URL is an operational concern, not part
35
- of the submission fingerprint: retrying the same submission with the same
36
- idempotency key but a different callback URL never conflicts.
37
-
38
- ## What gets delivered
39
-
40
- Each finalized run produces one frozen CloudEvents envelope. A successful
41
- `run.finished` delivery is sent only after its checkpoint and session-file
42
- revision are committed and the session read model is consistent. A `run.error`
43
- delivery represents the corresponding finalized `RUN_ERROR`; `checkpoint` is
44
- present only when that run committed one. Retries and manual redelivery resend
45
- the same bytes and `webhook-id`.
46
-
47
- ```json
48
- {
49
- "specversion": "1.0",
50
- "id": "whd_run_01J...",
51
- "source": "aex",
52
- "type": "run.finished",
53
- "subject": "run_01J...",
54
- "time": "2026-07-02T12:34:56.000Z",
55
- "data": {
56
- "sessionId": "session_01J...",
57
- "runId": "run_01J...",
58
- "turnSeq": 3,
59
- "outcome": "succeeded",
60
- "terminalAt": "2026-07-02T12:34:56.000Z",
61
- "checkpoint": {
62
- "checkpointId": "checkpoint_01J...",
63
- "runId": "run_01J...",
64
- "turnSeq": 3,
65
- "committedAt": "2026-07-02T12:34:55.900Z",
66
- "throughSeq": 4097
67
- },
68
- "reason": null,
69
- "failureClass": null,
70
- "costTelemetry": { "billedCostUsd": 0.42 }
71
- }
72
- }
73
- ```
74
-
75
- `subject` and `data.runId` identify the run; `data.sessionId` identifies the
76
- resumable thread. `outcome` is the terminal run outcome. `reason` and
77
- `failureClass` carry failure detail for `run.error`; `checkpoint` and
78
- `costTelemetry` are included when available.
79
-
80
- ## Verify deliveries
81
-
82
- Deliveries are signed [Standard Webhooks](https://www.standardwebhooks.com/)
83
- style: HMAC-SHA256 over `` `${webhook-id}.${webhook-timestamp}.${rawBody}` ``,
84
- sent in three headers — `webhook-id` (stable for that run across retries; your dedupe key),
85
- `webhook-timestamp` (unix seconds), and `webhook-signature` (a space-delimited
86
- list of `v1,<base64>` entries).
87
-
88
- The signing key is a per-workspace secret. Reveal it (it is created on first
89
- use) with either surface:
90
-
91
- ```bash
92
- aex webhooks secret --api-key "$AEX_API_KEY" # prints whsec_...
93
- ```
94
-
95
- ```ts
96
- const { whsec } = await aex.webhookSigningSecret();
97
- ```
98
-
99
- Verify inbound requests with the exported `verifyAexWebhook` — pure Web Crypto,
100
- identical under Bun and Node, and interoperable with the `standardwebhooks`
101
- reference library:
102
-
103
- ```ts
104
- import { verifyAexWebhook } from "@aexhq/sdk";
105
-
106
- // In your HTTP handler — use the EXACT raw body bytes, never re-serialize.
107
- const ok = await verifyAexWebhook({
108
- rawBody,
109
- headers: request.headers,
110
- secret: process.env.AEX_WEBHOOK_SECRET! // the whsec_... value
111
- });
112
- if (!ok) return new Response("bad signature", { status: 401 });
113
- ```
114
-
115
- `verifyAexWebhook` rejects stale timestamps (default tolerance 300 seconds) and
116
- compares signatures constant-time. It accepts every `v1` entry in the signature
117
- list, so it is already rotation-ready — but **server-side rotation of the
118
- signing secret is not available yet**: `aex webhooks secret` reveals or creates
119
- the one workspace secret and there is no rotate endpoint today. If your secret
120
- is compromised, contact <support@aex.dev>.
121
-
122
- ## Delivery ledger and redelivery
123
-
124
- Each session keeps a ledger with one row per finalized run, including its
125
- `runId`, `turnSeq`, event type, attempts, last status code, and last error:
126
-
127
- ```ts
128
- const deliveries = await session.webhooks.list();
129
- await session.webhooks.redeliver(deliveries[0]!.id);
130
- ```
131
-
132
- ```bash
133
- aex deliveries <session-id> --api-key "$AEX_API_KEY"
134
- ```
135
-
136
- Redelivery re-sends that run's frozen payload with the **same** `webhook-id`, so
137
- a consumer that dedupes on `webhook-id` handles retries, redeliveries, and
138
- at-least-once delivery uniformly. Different runs have different delivery IDs.
139
- An empty ledger means the session carried no `webhook` or no run has finalized
140
- yet.
141
-
142
- For the terminal-event mechanics behind delivery timing, see
143
- [Events](events.md).