@aexhq/sdk 0.46.4-canary → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +38 -0
  3. package/README.md +23 -31
  4. package/dist/client/aex.d.ts +33 -0
  5. package/dist/client/aex.js +98 -0
  6. package/dist/client/aex.js.map +1 -0
  7. package/dist/client/credentials.d.ts +25 -0
  8. package/dist/client/credentials.js +97 -0
  9. package/dist/client/credentials.js.map +1 -0
  10. package/dist/client/routing.d.ts +7 -0
  11. package/dist/client/routing.js +29 -0
  12. package/dist/client/routing.js.map +1 -0
  13. package/dist/downloads/download.d.ts +25 -0
  14. package/dist/downloads/download.js +53 -0
  15. package/dist/downloads/download.js.map +1 -0
  16. package/dist/generated/errors.d.ts +12 -0
  17. package/dist/generated/errors.js +81 -0
  18. package/dist/generated/errors.js.map +1 -0
  19. package/dist/generated/resources.d.ts +730 -0
  20. package/dist/generated/resources.js +606 -0
  21. package/dist/generated/resources.js.map +1 -0
  22. package/dist/generated/routes.d.ts +42 -0
  23. package/dist/generated/routes.js +2101 -0
  24. package/dist/generated/routes.js.map +1 -0
  25. package/dist/index.d.ts +20 -50
  26. package/dist/index.js +11 -62
  27. package/dist/index.js.map +1 -1
  28. package/dist/observations/stream.d.ts +1 -0
  29. package/dist/observations/stream.js +18 -0
  30. package/dist/observations/stream.js.map +1 -0
  31. package/dist/transport/errors.d.ts +60 -0
  32. package/dist/transport/errors.js +107 -0
  33. package/dist/transport/errors.js.map +1 -0
  34. package/dist/transport/pagination.d.ts +8 -0
  35. package/dist/transport/pagination.js +34 -0
  36. package/dist/transport/pagination.js.map +1 -0
  37. package/dist/transport/retry.d.ts +21 -0
  38. package/dist/transport/retry.js +37 -0
  39. package/dist/transport/retry.js.map +1 -0
  40. package/dist/transport/transport.d.ts +25 -0
  41. package/dist/transport/transport.js +28 -0
  42. package/dist/transport/transport.js.map +1 -0
  43. package/package.json +63 -30
  44. package/dist/_contracts/account-operations.d.ts +0 -101
  45. package/dist/_contracts/account-operations.js +0 -242
  46. package/dist/_contracts/account-types.d.ts +0 -461
  47. package/dist/_contracts/account-types.js +0 -1
  48. package/dist/_contracts/api-key.d.ts +0 -61
  49. package/dist/_contracts/api-key.js +0 -101
  50. package/dist/_contracts/api-routes.d.ts +0 -20
  51. package/dist/_contracts/api-routes.js +0 -109
  52. package/dist/_contracts/archive-limits.d.ts +0 -3
  53. package/dist/_contracts/archive-limits.js +0 -23
  54. package/dist/_contracts/asset-authoring.d.ts +0 -22
  55. package/dist/_contracts/asset-authoring.js +0 -106
  56. package/dist/_contracts/asset-bundle.d.ts +0 -64
  57. package/dist/_contracts/asset-bundle.js +0 -263
  58. package/dist/_contracts/asset-upload-helper.d.ts +0 -31
  59. package/dist/_contracts/asset-upload-helper.js +0 -84
  60. package/dist/_contracts/billing-admission.d.ts +0 -29
  61. package/dist/_contracts/billing-admission.js +0 -28
  62. package/dist/_contracts/bundle-manifest.d.ts +0 -89
  63. package/dist/_contracts/bundle-manifest.js +0 -158
  64. package/dist/_contracts/canonical-sha256.d.ts +0 -8
  65. package/dist/_contracts/canonical-sha256.js +0 -8
  66. package/dist/_contracts/connection-ticket.d.ts +0 -22
  67. package/dist/_contracts/connection-ticket.js +0 -54
  68. package/dist/_contracts/continuation-event.d.ts +0 -31
  69. package/dist/_contracts/continuation-event.js +0 -6
  70. package/dist/_contracts/contract-parse-error.d.ts +0 -12
  71. package/dist/_contracts/contract-parse-error.js +0 -51
  72. package/dist/_contracts/error-codes.d.ts +0 -26
  73. package/dist/_contracts/error-codes.js +0 -116
  74. package/dist/_contracts/error-factory.d.ts +0 -32
  75. package/dist/_contracts/error-factory.js +0 -174
  76. package/dist/_contracts/event-envelope.d.ts +0 -471
  77. package/dist/_contracts/event-envelope.js +0 -501
  78. package/dist/_contracts/event-stream-client.d.ts +0 -122
  79. package/dist/_contracts/event-stream-client.js +0 -445
  80. package/dist/_contracts/event-view.d.ts +0 -44
  81. package/dist/_contracts/event-view.js +0 -69
  82. package/dist/_contracts/failure-class.d.ts +0 -29
  83. package/dist/_contracts/failure-class.js +0 -73
  84. package/dist/_contracts/http.d.ts +0 -135
  85. package/dist/_contracts/http.js +0 -434
  86. package/dist/_contracts/ids.d.ts +0 -66
  87. package/dist/_contracts/ids.js +0 -119
  88. package/dist/_contracts/index.d.ts +0 -42
  89. package/dist/_contracts/index.js +0 -52
  90. package/dist/_contracts/internal.d.ts +0 -55
  91. package/dist/_contracts/internal.js +0 -113
  92. package/dist/_contracts/models.d.ts +0 -30
  93. package/dist/_contracts/models.js +0 -28
  94. package/dist/_contracts/operation-core.d.ts +0 -36
  95. package/dist/_contracts/operation-core.js +0 -70
  96. package/dist/_contracts/operations.d.ts +0 -218
  97. package/dist/_contracts/operations.js +0 -1496
  98. package/dist/_contracts/otlp-projection.d.ts +0 -78
  99. package/dist/_contracts/otlp-projection.js +0 -171
  100. package/dist/_contracts/post-hook.d.ts +0 -31
  101. package/dist/_contracts/post-hook.js +0 -61
  102. package/dist/_contracts/provider-fault.d.ts +0 -34
  103. package/dist/_contracts/provider-fault.js +0 -68
  104. package/dist/_contracts/retry-core.d.ts +0 -29
  105. package/dist/_contracts/retry-core.js +0 -79
  106. package/dist/_contracts/runner-event.d.ts +0 -117
  107. package/dist/_contracts/runner-event.js +0 -172
  108. package/dist/_contracts/runtime-kind.d.ts +0 -60
  109. package/dist/_contracts/runtime-kind.js +0 -70
  110. package/dist/_contracts/runtime-manifest.d.ts +0 -121
  111. package/dist/_contracts/runtime-manifest.js +0 -83
  112. package/dist/_contracts/runtime-security-profile.d.ts +0 -26
  113. package/dist/_contracts/runtime-security-profile.js +0 -73
  114. package/dist/_contracts/runtime-sizes.d.ts +0 -104
  115. package/dist/_contracts/runtime-sizes.js +0 -111
  116. package/dist/_contracts/runtime-types.d.ts +0 -618
  117. package/dist/_contracts/runtime-types.js +0 -58
  118. package/dist/_contracts/schemas/asset-bundle.d.ts +0 -70
  119. package/dist/_contracts/schemas/asset-bundle.js +0 -107
  120. package/dist/_contracts/schemas/asset-ref.d.ts +0 -61
  121. package/dist/_contracts/schemas/asset-ref.js +0 -118
  122. package/dist/_contracts/schemas/bundle-manifest.d.ts +0 -66
  123. package/dist/_contracts/schemas/bundle-manifest.js +0 -77
  124. package/dist/_contracts/schemas/index.d.ts +0 -32
  125. package/dist/_contracts/schemas/index.js +0 -30
  126. package/dist/_contracts/schemas/mcp-server.d.ts +0 -99
  127. package/dist/_contracts/schemas/mcp-server.js +0 -209
  128. package/dist/_contracts/schemas/models.d.ts +0 -29
  129. package/dist/_contracts/schemas/models.js +0 -51
  130. package/dist/_contracts/schemas/numeric.d.ts +0 -18
  131. package/dist/_contracts/schemas/numeric.js +0 -28
  132. package/dist/_contracts/schemas/post-hook.d.ts +0 -45
  133. package/dist/_contracts/schemas/post-hook.js +0 -68
  134. package/dist/_contracts/schemas/response-assets.d.ts +0 -75
  135. package/dist/_contracts/schemas/response-assets.js +0 -81
  136. package/dist/_contracts/schemas/response-billing.d.ts +0 -208
  137. package/dist/_contracts/schemas/response-billing.js +0 -139
  138. package/dist/_contracts/schemas/response-common.d.ts +0 -132
  139. package/dist/_contracts/schemas/response-common.js +0 -162
  140. package/dist/_contracts/schemas/response-identity.d.ts +0 -648
  141. package/dist/_contracts/schemas/response-identity.js +0 -131
  142. package/dist/_contracts/schemas/response-mcp-servers.d.ts +0 -51
  143. package/dist/_contracts/schemas/response-mcp-servers.js +0 -32
  144. package/dist/_contracts/schemas/response-secrets.d.ts +0 -50
  145. package/dist/_contracts/schemas/response-secrets.js +0 -32
  146. package/dist/_contracts/schemas/response-sessions-internal.d.ts +0 -200
  147. package/dist/_contracts/schemas/response-sessions-internal.js +0 -142
  148. package/dist/_contracts/schemas/response-sessions.d.ts +0 -1598
  149. package/dist/_contracts/schemas/response-sessions.js +0 -377
  150. package/dist/_contracts/schemas/response-webhooks.d.ts +0 -76
  151. package/dist/_contracts/schemas/response-webhooks.js +0 -42
  152. package/dist/_contracts/schemas/response-workspace.d.ts +0 -225
  153. package/dist/_contracts/schemas/response-workspace.js +0 -99
  154. package/dist/_contracts/schemas/runtime-kind.d.ts +0 -31
  155. package/dist/_contracts/schemas/runtime-kind.js +0 -29
  156. package/dist/_contracts/schemas/runtime-security-profile.d.ts +0 -28
  157. package/dist/_contracts/schemas/runtime-security-profile.js +0 -26
  158. package/dist/_contracts/schemas/runtime-sizes.d.ts +0 -70
  159. package/dist/_contracts/schemas/runtime-sizes.js +0 -127
  160. package/dist/_contracts/schemas/session-limits.d.ts +0 -34
  161. package/dist/_contracts/schemas/session-limits.js +0 -39
  162. package/dist/_contracts/schemas/session-machine.d.ts +0 -23
  163. package/dist/_contracts/schemas/session-machine.js +0 -24
  164. package/dist/_contracts/schemas/session-request-config.d.ts +0 -58
  165. package/dist/_contracts/schemas/session-request-config.js +0 -134
  166. package/dist/_contracts/schemas/session-webhook.d.ts +0 -11
  167. package/dist/_contracts/schemas/session-webhook.js +0 -38
  168. package/dist/_contracts/schemas/side-effect-audit.d.ts +0 -98
  169. package/dist/_contracts/schemas/side-effect-audit.js +0 -102
  170. package/dist/_contracts/schemas/submission-assets.d.ts +0 -117
  171. package/dist/_contracts/schemas/submission-assets.js +0 -147
  172. package/dist/_contracts/schemas/submission-body.d.ts +0 -251
  173. package/dist/_contracts/schemas/submission-body.js +0 -378
  174. package/dist/_contracts/schemas/submission-environment.d.ts +0 -79
  175. package/dist/_contracts/schemas/submission-environment.js +0 -179
  176. package/dist/_contracts/schemas/submission-request.d.ts +0 -158
  177. package/dist/_contracts/schemas/submission-request.js +0 -49
  178. package/dist/_contracts/schemas/submission-secrets.d.ts +0 -47
  179. package/dist/_contracts/schemas/submission-secrets.js +0 -108
  180. package/dist/_contracts/schemas/wire.d.ts +0 -118
  181. package/dist/_contracts/schemas/wire.js +0 -171
  182. package/dist/_contracts/schemas/workspace-resources.d.ts +0 -50
  183. package/dist/_contracts/schemas/workspace-resources.js +0 -87
  184. package/dist/_contracts/sdk-errors.d.ts +0 -212
  185. package/dist/_contracts/sdk-errors.js +0 -313
  186. package/dist/_contracts/sdk-secrets.d.ts +0 -67
  187. package/dist/_contracts/sdk-secrets.js +0 -427
  188. package/dist/_contracts/session-archive.d.ts +0 -16
  189. package/dist/_contracts/session-archive.js +0 -92
  190. package/dist/_contracts/session-artifacts.d.ts +0 -189
  191. package/dist/_contracts/session-artifacts.js +0 -264
  192. package/dist/_contracts/session-config.d.ts +0 -373
  193. package/dist/_contracts/session-config.js +0 -562
  194. package/dist/_contracts/session-cost-types.d.ts +0 -211
  195. package/dist/_contracts/session-cost-types.js +0 -69
  196. package/dist/_contracts/session-cost.d.ts +0 -8
  197. package/dist/_contracts/session-cost.js +0 -582
  198. package/dist/_contracts/session-custody.d.ts +0 -165
  199. package/dist/_contracts/session-custody.js +0 -345
  200. package/dist/_contracts/session-file-query.d.ts +0 -14
  201. package/dist/_contracts/session-file-query.js +0 -178
  202. package/dist/_contracts/session-record.d.ts +0 -112
  203. package/dist/_contracts/session-record.js +0 -165
  204. package/dist/_contracts/session-retention.d.ts +0 -201
  205. package/dist/_contracts/session-retention.js +0 -450
  206. package/dist/_contracts/side-effect-audit.d.ts +0 -126
  207. package/dist/_contracts/side-effect-audit.js +0 -520
  208. package/dist/_contracts/sse.d.ts +0 -74
  209. package/dist/_contracts/sse.js +0 -227
  210. package/dist/_contracts/stable.d.ts +0 -45
  211. package/dist/_contracts/stable.js +0 -62
  212. package/dist/_contracts/status.d.ts +0 -25
  213. package/dist/_contracts/status.js +0 -57
  214. package/dist/_contracts/submission-limits.d.ts +0 -61
  215. package/dist/_contracts/submission-limits.js +0 -60
  216. package/dist/_contracts/submission.d.ts +0 -547
  217. package/dist/_contracts/submission.js +0 -812
  218. package/dist/_contracts/suggest.d.ts +0 -15
  219. package/dist/_contracts/suggest.js +0 -53
  220. package/dist/_contracts/testing/response-bindings.d.ts +0 -45
  221. package/dist/_contracts/testing/response-bindings.js +0 -256
  222. package/dist/_contracts/testing/wire-conformance-entry.d.ts +0 -10
  223. package/dist/_contracts/testing/wire-conformance-entry.js +0 -8
  224. package/dist/_contracts/testing/wire-conformance.d.ts +0 -169
  225. package/dist/_contracts/testing/wire-conformance.js +0 -276
  226. package/dist/_contracts/turn-trace.d.ts +0 -28
  227. package/dist/_contracts/turn-trace.js +0 -1
  228. package/dist/_contracts/unknown-field-error.d.ts +0 -13
  229. package/dist/_contracts/unknown-field-error.js +0 -21
  230. package/dist/_contracts/value-guards.d.ts +0 -20
  231. package/dist/_contracts/value-guards.js +0 -34
  232. package/dist/_contracts/webhook-verify.d.ts +0 -34
  233. package/dist/_contracts/webhook-verify.js +0 -93
  234. package/dist/_contracts/wire-observer.d.ts +0 -49
  235. package/dist/_contracts/wire-observer.js +0 -34
  236. package/dist/_contracts/workflow-status.d.ts +0 -7
  237. package/dist/_contracts/workflow-status.js +0 -43
  238. package/dist/_contracts/workspace-resources.d.ts +0 -98
  239. package/dist/_contracts/workspace-resources.js +0 -39
  240. package/dist/archive-limits.d.ts +0 -1
  241. package/dist/archive-limits.js +0 -2
  242. package/dist/archive-limits.js.map +0 -1
  243. package/dist/asset-upload.d.ts +0 -47
  244. package/dist/asset-upload.js +0 -269
  245. package/dist/asset-upload.js.map +0 -1
  246. package/dist/bundle.d.ts +0 -9
  247. package/dist/bundle.js +0 -20
  248. package/dist/bundle.js.map +0 -1
  249. package/dist/canonical-zip.d.ts +0 -68
  250. package/dist/canonical-zip.js +0 -355
  251. package/dist/canonical-zip.js.map +0 -1
  252. package/dist/cli.mjs +0 -12048
  253. package/dist/cli.mjs.sha256 +0 -1
  254. package/dist/client-types.d.ts +0 -192
  255. package/dist/client-types.js +0 -2
  256. package/dist/client-types.js.map +0 -1
  257. package/dist/client.d.ts +0 -464
  258. package/dist/client.js +0 -1207
  259. package/dist/client.js.map +0 -1
  260. package/dist/event-projection.d.ts +0 -22
  261. package/dist/event-projection.js +0 -380
  262. package/dist/event-projection.js.map +0 -1
  263. package/dist/fetch-archive.d.ts +0 -16
  264. package/dist/fetch-archive.js +0 -252
  265. package/dist/fetch-archive.js.map +0 -1
  266. package/dist/file.d.ts +0 -96
  267. package/dist/file.js +0 -272
  268. package/dist/file.js.map +0 -1
  269. package/dist/instructions.d.ts +0 -20
  270. package/dist/instructions.js +0 -40
  271. package/dist/instructions.js.map +0 -1
  272. package/dist/legacy-session-provider-fault.d.ts +0 -7
  273. package/dist/legacy-session-provider-fault.js +0 -38
  274. package/dist/legacy-session-provider-fault.js.map +0 -1
  275. package/dist/mcp-server.d.ts +0 -84
  276. package/dist/mcp-server.js +0 -117
  277. package/dist/mcp-server.js.map +0 -1
  278. package/dist/node-fs.d.ts +0 -29
  279. package/dist/node-fs.js +0 -19
  280. package/dist/node-fs.js.map +0 -1
  281. package/dist/node-walk.d.ts +0 -69
  282. package/dist/node-walk.js +0 -151
  283. package/dist/node-walk.js.map +0 -1
  284. package/dist/path-basename.d.ts +0 -5
  285. package/dist/path-basename.js +0 -9
  286. package/dist/path-basename.js.map +0 -1
  287. package/dist/retry.d.ts +0 -70
  288. package/dist/retry.js +0 -155
  289. package/dist/retry.js.map +0 -1
  290. package/dist/secret.d.ts +0 -65
  291. package/dist/secret.js +0 -110
  292. package/dist/secret.js.map +0 -1
  293. package/dist/session-validate.d.ts +0 -100
  294. package/dist/session-validate.js +0 -303
  295. package/dist/session-validate.js.map +0 -1
  296. package/dist/skill.d.ts +0 -99
  297. package/dist/skill.js +0 -169
  298. package/dist/skill.js.map +0 -1
  299. package/dist/submission-wire.d.ts +0 -13
  300. package/dist/submission-wire.js +0 -69
  301. package/dist/submission-wire.js.map +0 -1
  302. package/dist/tool.d.ts +0 -41
  303. package/dist/tool.js +0 -76
  304. package/dist/tool.js.map +0 -1
  305. package/dist/version.d.ts +0 -9
  306. package/dist/version.js +0 -10
  307. package/dist/version.js.map +0 -1
  308. package/docs/authentication.md +0 -125
  309. package/docs/billing.md +0 -164
  310. package/docs/cleanup.md +0 -27
  311. package/docs/concepts/agent-tools.md +0 -47
  312. package/docs/concepts/composition.md +0 -60
  313. package/docs/concepts/providers-and-runtimes.md +0 -121
  314. package/docs/concepts/sessions.md +0 -51
  315. package/docs/concepts/subagents.md +0 -35
  316. package/docs/credentials.md +0 -116
  317. package/docs/defaults.md +0 -51
  318. package/docs/errors.md +0 -258
  319. package/docs/events.md +0 -143
  320. package/docs/files.md +0 -130
  321. package/docs/limits-and-quotas.md +0 -114
  322. package/docs/limits.md +0 -51
  323. package/docs/mcp.md +0 -47
  324. package/docs/networking.md +0 -114
  325. package/docs/provider-runtime-capabilities.md +0 -32
  326. package/docs/public-surface.json +0 -73
  327. package/docs/quickstart.md +0 -135
  328. package/docs/release.md +0 -44
  329. package/docs/retries.md +0 -108
  330. package/docs/secrets.md +0 -141
  331. package/docs/session-config.md +0 -51
  332. package/docs/session-record.md +0 -58
  333. package/docs/skills.md +0 -65
  334. package/docs/telemetry.md +0 -66
  335. package/docs/testing.md +0 -35
  336. package/docs/vision-skills.md +0 -94
  337. package/docs/webhooks.md +0 -143
@@ -1,131 +0,0 @@
1
- /**
2
- * Response schema for `GET /whoami` — the data-plane identity canary.
3
- *
4
- * This is the route `parseWhoAmI` already hand-guards, including an explicit
5
- * "these three fields were removed and must not reappear" check for `caps`,
6
- * `tokenId` and `tokenName`. A strict object generalises that: EVERY undeclared
7
- * field is a reappearance, not just the three someone remembered to list.
8
- *
9
- * The CONTROL plane serves a different body at the same path — an
10
- * `account_token` principal, parsed by `parseAccountWhoAmI`. It is declared here
11
- * too, and the two are NOT unioned: unioning them would let a data-plane whoami
12
- * pass while carrying a control-plane body. They are kept apart by ORIGIN
13
- * instead — `WireResponse` carries the origin it came from, and the harness is
14
- * installed with the plane its bindings describe. See
15
- * `testing/response-bindings.ts`.
16
- */
17
- import * as z from "zod/mini";
18
- import { BILLING_ADMISSION_STATES } from "../billing-admission.js";
19
- import { RUNTIME_KINDS } from "./runtime-kind.js";
20
- import { RUNTIME_SIZES } from "./runtime-sizes.js";
21
- import { describeResponse, responseObject, wireBoolean, wireEnum, wireLiteral, wireNonEmptyString, wireNumber, wireString } from "./response-common.js";
22
- const optional = z.optional;
23
- /** A per-runtime-kind partial map, strict about which kinds may appear. */
24
- function byRuntimeKind(value) {
25
- return responseObject({
26
- container: optional(value),
27
- spot_container: optional(value),
28
- lambda: optional(value)
29
- });
30
- }
31
- const RuntimeProfileSchema = responseObject({
32
- schemaVersion: wireLiteral(1),
33
- runtimeKind: wireEnum(RUNTIME_KINDS),
34
- capabilities: responseObject({
35
- toolExecution: wireEnum(["supported", "unsupported"]),
36
- workspaceCheckpoint: wireEnum(["supported", "unsupported"]),
37
- workspaceFileCapture: wireEnum(["supported", "unsupported"]),
38
- streamingDeltas: wireEnum(["supported", "unsupported"]),
39
- approvalGate: wireEnum(["supported", "unsupported"]),
40
- postHook: wireEnum(["supported", "unsupported"]),
41
- mcpTools: wireEnum(["supported", "unsupported"]),
42
- scheduledWait: wireEnum(["supported", "unsupported"]),
43
- customerSecrets: wireEnum(["supported", "unsupported"]),
44
- containedEgress: wireEnum(["supported", "unsupported"])
45
- }),
46
- limits: responseObject({
47
- maxSessionMs: wireNumber,
48
- maxSingleEffectMs: wireNumber,
49
- maxWorkspaceBytes: wireNumber,
50
- maxConcurrentToolCalls: wireNumber
51
- }),
52
- delivery: responseObject({
53
- toolExecution: wireEnum(["at-least-once", "exactly-once"]),
54
- coldStartClass: wireEnum(["warm", "cold-seconds", "cold-tens-of-seconds"]),
55
- idleBilling: wireEnum(["wall-clock", "zero"])
56
- }),
57
- computeBasis: wireEnum(["wall_clock", "microvm_running"])
58
- });
59
- const RuntimeProfilesSchema = responseObject({
60
- container: RuntimeProfileSchema,
61
- spot_container: RuntimeProfileSchema,
62
- lambda: RuntimeProfileSchema
63
- });
64
- export const RuntimeCapabilitiesSchema = describeResponse("RuntimeCapabilities", "Authenticated runtime availability and behavior profiles for the workspace. " +
65
- "`sizesByRuntimeKind` and `unavailable` are complementary partial maps over " +
66
- "the runtime kinds; `profilesByRuntimeKind` is total.", responseObject({
67
- schemaVersion: wireLiteral(1),
68
- capabilityVersion: wireNonEmptyString,
69
- capabilityHash: wireNonEmptyString,
70
- availableRuntimeKinds: z.array(wireEnum(RUNTIME_KINDS)),
71
- sizesByRuntimeKind: byRuntimeKind(z.array(wireEnum(RUNTIME_SIZES))),
72
- unavailable: byRuntimeKind(responseObject({ code: wireNonEmptyString })),
73
- profilesByRuntimeKind: RuntimeProfilesSchema
74
- }));
75
- /**
76
- * Effective workspace limits, from the same read models admission uses.
77
- *
78
- * Every field is REQUIRED. The plan catalog is gone, and with it the optional
79
- * `pastDueAt` / `graceEndsAt` pair that only existed while a subscription could
80
- * be in arrears — prepaid credit cannot go negative, so there is no dunning
81
- * state to report. What gates a submit now is the pair
82
- * (`balanceUsd`, `llmTokenAllowanceRemainingUsd`), and `admissionState` says
83
- * which of the three card-derived states produced the caps above it. A strict
84
- * schema still expecting the retired fields fails C4 against the current server.
85
- *
86
- * `admissionState` is a CLOSED enum here — unlike an allowance `dimension`, the
87
- * three admission states are public contract (`BillingAdmissionState`), not
88
- * hosted policy, so the declared union and the wire assertion share one list.
89
- */
90
- export const WhoAmILimitsSchema = describeResponse("WhoAmILimits", "Effective concurrency, rate, spend and prepaid-credit limits plus the card-derived admission state.", responseObject({
91
- maxConcurrentSessions: wireNumber,
92
- submitRatePerMinute: wireNumber,
93
- spendCapUsd: wireNumber,
94
- monthSpendUsd: wireNumber,
95
- balanceUsd: wireNumber,
96
- balanceGraceFloorUsd: wireNumber,
97
- llmTokenAllowanceRemainingUsd: wireNumber,
98
- creditGateActive: wireBoolean,
99
- paymentMethodStatus: wireEnum(["none", "active"]),
100
- admissionState: wireEnum(BILLING_ADMISSION_STATES),
101
- autoTopupEnabled: wireBoolean,
102
- accountType: wireEnum(["standard", "internal"])
103
- }));
104
- /** `GET /whoami` on the DATA plane (workspace API key). */
105
- export const WhoAmIResponseSchema = describeResponse("WhoAmIResponse", "Identity of a workspace API key. Strict: a removed field reappearing fails, " +
106
- "which is what the hand-written `caps`/`tokenId`/`tokenName` guard did for three names.", responseObject({
107
- ok: wireLiteral(true),
108
- principalType: wireLiteral("api_key"),
109
- workspaceId: wireNonEmptyString,
110
- scopes: z.array(wireNonEmptyString),
111
- limits: WhoAmILimitsSchema,
112
- runtimeCapabilities: optional(RuntimeCapabilitiesSchema)
113
- }));
114
- /**
115
- * `GET /whoami` on the CONTROL plane (account PAT / device session).
116
- *
117
- * Not bound to a data-plane route: `api-routes.ts` describes the data plane, and
118
- * the control plane has no route table in this package yet. Declared so the
119
- * shape has one statement, and so a control-plane binding table can be built
120
- * without re-deriving it.
121
- */
122
- export const AccountWhoAmIResponseSchema = describeResponse("AccountWhoAmIResponse", "Identity of a control-plane account token. No workspace, no data-plane limits.", responseObject({
123
- ok: wireLiteral(true),
124
- principalType: wireLiteral("account_token"),
125
- appUserId: wireNonEmptyString,
126
- scopes: z.array(wireString),
127
- orgId: optional(wireString),
128
- tokenId: optional(wireString),
129
- tokenName: optional(wireString),
130
- tokenKind: optional(wireString)
131
- }));
@@ -1,51 +0,0 @@
1
- /**
2
- * Response schemas for the `mcpServers.*` family — persisted workspace MCP
3
- * server configuration.
4
- *
5
- * `headerShape` is header NAMES only; the values live in the secret store. As
6
- * with secrets, the strict object is what keeps that true: a `headers` or
7
- * `authorization` key appearing on a read fails the suite.
8
- *
9
- * These four routes had NO declared client type: `operations.ts` has no
10
- * mcp-server operations, so the CLI/dashboard reached them directly and cast the
11
- * result. `McpServerRecord` / `McpServerList` in `runtime-types.ts` are now
12
- * `z.infer`red from the schemas below, so the contract has exactly one
13
- * statement. The shapes themselves come from the server projection in
14
- * `api/routes/mcp-servers.ts`.
15
- *
16
- * `workspaceId` is the PUBLIC `wsp_<hex>` form here (the handler runs it through
17
- * `publicWorkspaceId`), matching `whoami` — and NOT matching the billing ledger,
18
- * the admin-billing routes or the workspace erase, which all emit raw ids.
19
- */
20
- import * as z from "zod/mini";
21
- export declare const McpServerRecordSchema: z.ZodMiniObject<{
22
- id: z.ZodMiniString<string>;
23
- workspaceId: z.ZodMiniString<string>;
24
- name: z.ZodMiniString<string>;
25
- url: z.ZodMiniString<string>;
26
- headerShape: z.ZodMiniArray<z.ZodMiniString<string>>;
27
- createdAt: z.ZodMiniString<string>;
28
- updatedAt: z.ZodMiniString<string>;
29
- }, z.core.$strict>;
30
- export declare const McpServerResponseSchema: z.ZodMiniObject<{
31
- mcpServer: z.ZodMiniObject<{
32
- id: z.ZodMiniString<string>;
33
- workspaceId: z.ZodMiniString<string>;
34
- name: z.ZodMiniString<string>;
35
- url: z.ZodMiniString<string>;
36
- headerShape: z.ZodMiniArray<z.ZodMiniString<string>>;
37
- createdAt: z.ZodMiniString<string>;
38
- updatedAt: z.ZodMiniString<string>;
39
- }, z.core.$strict>;
40
- }, z.core.$strict>;
41
- export declare const McpServerListResponseSchema: z.ZodMiniObject<{
42
- mcpServers: z.ZodMiniArray<z.ZodMiniObject<{
43
- id: z.ZodMiniString<string>;
44
- workspaceId: z.ZodMiniString<string>;
45
- name: z.ZodMiniString<string>;
46
- url: z.ZodMiniString<string>;
47
- headerShape: z.ZodMiniArray<z.ZodMiniString<string>>;
48
- createdAt: z.ZodMiniString<string>;
49
- updatedAt: z.ZodMiniString<string>;
50
- }, z.core.$strict>>;
51
- }, z.core.$strict>;
@@ -1,32 +0,0 @@
1
- /**
2
- * Response schemas for the `mcpServers.*` family — persisted workspace MCP
3
- * server configuration.
4
- *
5
- * `headerShape` is header NAMES only; the values live in the secret store. As
6
- * with secrets, the strict object is what keeps that true: a `headers` or
7
- * `authorization` key appearing on a read fails the suite.
8
- *
9
- * These four routes had NO declared client type: `operations.ts` has no
10
- * mcp-server operations, so the CLI/dashboard reached them directly and cast the
11
- * result. `McpServerRecord` / `McpServerList` in `runtime-types.ts` are now
12
- * `z.infer`red from the schemas below, so the contract has exactly one
13
- * statement. The shapes themselves come from the server projection in
14
- * `api/routes/mcp-servers.ts`.
15
- *
16
- * `workspaceId` is the PUBLIC `wsp_<hex>` form here (the handler runs it through
17
- * `publicWorkspaceId`), matching `whoami` — and NOT matching the billing ledger,
18
- * the admin-billing routes or the workspace erase, which all emit raw ids.
19
- */
20
- import * as z from "zod/mini";
21
- import { describeResponse, responseObject, wireNonEmptyString, wireString } from "./response-common.js";
22
- export const McpServerRecordSchema = describeResponse("McpServerRecord", "One persisted workspace MCP server. `headerShape` lists header NAMES only.", responseObject({
23
- id: wireNonEmptyString,
24
- workspaceId: wireNonEmptyString,
25
- name: wireNonEmptyString,
26
- url: wireNonEmptyString,
27
- headerShape: z.array(wireString),
28
- createdAt: wireNonEmptyString,
29
- updatedAt: wireNonEmptyString
30
- }));
31
- export const McpServerResponseSchema = describeResponse("McpServerResponse", "One workspace MCP server configuration.", responseObject({ mcpServer: McpServerRecordSchema }));
32
- export const McpServerListResponseSchema = describeResponse("McpServerListResponse", "Every workspace MCP server, newest first. Not paged.", responseObject({ mcpServers: z.array(McpServerRecordSchema) }));
@@ -1,50 +0,0 @@
1
- /**
2
- * Response schemas for the `secrets.*` family — the workspace secret store.
3
- *
4
- * These records are METADATA ONLY by design: the persisted value is write-only
5
- * through this API. A strict object is the check that keeps it that way — if a
6
- * `value`, `envelope` or `ciphertext` key ever appears on a read, the suite
7
- * fails rather than the value quietly reaching a log.
8
- *
9
- * Divergence from the declared `SecretRecord`: that interface makes `createdAt`
10
- * and `updatedAt` optional and adds `deletedAt?: string | null`. The server
11
- * sends all six fields unconditionally and never a `deletedAt`. `deletedAt` is
12
- * kept (our own type declares it). The index signature that interface also
13
- * carried is gone — see `response-common.ts`.
14
- *
15
- * `createdAt` / `updatedAt` are ISO-8601 with a `Z`, unlike the billing
16
- * timestamps, which are raw Data-API text.
17
- */
18
- import * as z from "zod/mini";
19
- export declare const SecretRecordSchema: z.ZodMiniObject<{
20
- id: z.ZodMiniString<string>;
21
- name: z.ZodMiniString<string>;
22
- version: z.ZodMiniNumberFormat;
23
- state: z.ZodMiniLiteral<"ready">;
24
- createdAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
25
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
26
- deletedAt: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
27
- }, z.core.$strict>;
28
- /** `POST /secrets` (201), `GET /secrets/{name}` (200), `POST /secrets/{name}/rotate` (200). */
29
- export declare const SecretResponseSchema: z.ZodMiniObject<{
30
- secret: z.ZodMiniObject<{
31
- id: z.ZodMiniString<string>;
32
- name: z.ZodMiniString<string>;
33
- version: z.ZodMiniNumberFormat;
34
- state: z.ZodMiniLiteral<"ready">;
35
- createdAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
36
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
37
- deletedAt: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
38
- }, z.core.$strict>;
39
- }, z.core.$strict>;
40
- export declare const SecretListResponseSchema: z.ZodMiniObject<{
41
- secrets: z.ZodMiniArray<z.ZodMiniObject<{
42
- id: z.ZodMiniString<string>;
43
- name: z.ZodMiniString<string>;
44
- version: z.ZodMiniNumberFormat;
45
- state: z.ZodMiniLiteral<"ready">;
46
- createdAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
47
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
48
- deletedAt: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
49
- }, z.core.$strict>>;
50
- }, z.core.$strict>;
@@ -1,32 +0,0 @@
1
- /**
2
- * Response schemas for the `secrets.*` family — the workspace secret store.
3
- *
4
- * These records are METADATA ONLY by design: the persisted value is write-only
5
- * through this API. A strict object is the check that keeps it that way — if a
6
- * `value`, `envelope` or `ciphertext` key ever appears on a read, the suite
7
- * fails rather than the value quietly reaching a log.
8
- *
9
- * Divergence from the declared `SecretRecord`: that interface makes `createdAt`
10
- * and `updatedAt` optional and adds `deletedAt?: string | null`. The server
11
- * sends all six fields unconditionally and never a `deletedAt`. `deletedAt` is
12
- * kept (our own type declares it). The index signature that interface also
13
- * carried is gone — see `response-common.ts`.
14
- *
15
- * `createdAt` / `updatedAt` are ISO-8601 with a `Z`, unlike the billing
16
- * timestamps, which are raw Data-API text.
17
- */
18
- import * as z from "zod/mini";
19
- import { describeResponse, responseObject, wireLiteral, wireNonEmptyString, wirePositiveInteger, wireString } from "./response-common.js";
20
- const optional = z.optional;
21
- export const SecretRecordSchema = describeResponse("SecretRecord", "Metadata for one workspace secret. Never carries the value.", responseObject({
22
- id: wireNonEmptyString,
23
- name: wireNonEmptyString,
24
- version: wirePositiveInteger,
25
- state: wireLiteral("ready"),
26
- createdAt: optional(wireString),
27
- updatedAt: optional(wireString),
28
- deletedAt: optional(z.nullable(wireString))
29
- }));
30
- /** `POST /secrets` (201), `GET /secrets/{name}` (200), `POST /secrets/{name}/rotate` (200). */
31
- export const SecretResponseSchema = describeResponse("SecretResponse", "One workspace secret's metadata.", responseObject({ secret: SecretRecordSchema }));
32
- export const SecretListResponseSchema = describeResponse("SecretListResponse", "Every workspace secret's metadata, ordered by name. Not paged.", responseObject({ secrets: z.array(SecretRecordSchema) }));
@@ -1,200 +0,0 @@
1
- /**
2
- * Response schemas for the three session routes that are JSON but are not part
3
- * of the bearer-key SDK surface: the OTLP telemetry pull, and the two
4
- * writer-token hops the in-container runtime uses to read a child's result and
5
- * to finalize it.
6
- *
7
- * They are separated from `response-sessions.ts` because they have a different
8
- * audience and a different failure mode: nothing in this repository's
9
- * `HttpClient` call sites can produce them, so they are permanently
10
- * "unexercised" in a C4 report. `testing/response-bindings.ts` names that fact
11
- * rather than leaving a reader to infer thin coverage.
12
- *
13
- * The OTLP shapes are the ONE place where the wire is standards-defined rather
14
- * than ours: they mirror `otlp-projection.ts`, which is itself the declaration
15
- * of what `toOTLP` emits, so this schema and that type must agree exactly.
16
- */
17
- import * as z from "zod/mini";
18
- export declare const ChildResultResponseSchema: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
19
- id: z.ZodMiniString<string>;
20
- state: z.ZodMiniEnum<{
21
- running: "running";
22
- queued: "queued";
23
- settling: "settling";
24
- }>;
25
- files: z.ZodMiniArray<z.ZodMiniObject<{
26
- id: z.ZodMiniString<string>;
27
- path: z.ZodMiniString<string>;
28
- checkpointId: z.ZodMiniString<string>;
29
- sizeBytes: z.ZodMiniNumberFormat;
30
- sha256: z.ZodMiniString<string>;
31
- contentType: z.ZodMiniString<string>;
32
- }, z.core.$strict>>;
33
- }, z.core.$strict>, z.ZodMiniObject<{
34
- id: z.ZodMiniString<string>;
35
- state: z.ZodMiniLiteral<"finished">;
36
- outcome: z.ZodMiniEnum<{
37
- succeeded: "succeeded";
38
- failed: "failed";
39
- timed_out: "timed_out";
40
- cancelled: "cancelled";
41
- interrupted: "interrupted";
42
- }>;
43
- files: z.ZodMiniArray<z.ZodMiniObject<{
44
- id: z.ZodMiniString<string>;
45
- path: z.ZodMiniString<string>;
46
- checkpointId: z.ZodMiniString<string>;
47
- sizeBytes: z.ZodMiniNumberFormat;
48
- sha256: z.ZodMiniString<string>;
49
- contentType: z.ZodMiniString<string>;
50
- }, z.core.$strict>>;
51
- text: z.ZodMiniOptional<z.ZodMiniString<string>>;
52
- failureClass: z.ZodMiniOptional<z.ZodMiniString<string>>;
53
- failureMessage: z.ZodMiniOptional<z.ZodMiniString<string>>;
54
- conflicts: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
55
- path: z.ZodMiniString<string>;
56
- kind: z.ZodMiniEnum<{
57
- blocked: "blocked";
58
- stale: "stale";
59
- }>;
60
- resolved: z.ZodMiniLiteral<false>;
61
- }, z.core.$strict>>>;
62
- }, z.core.$strict>]>;
63
- export declare const ChildFinalizeResponseSchema: z.ZodMiniObject<{
64
- id: z.ZodMiniString<string>;
65
- lifecycleStatus: z.ZodMiniEnum<{
66
- error: "error";
67
- idle: "idle";
68
- }>;
69
- outcome: z.ZodMiniEnum<{
70
- succeeded: "succeeded";
71
- failed: "failed";
72
- timed_out: "timed_out";
73
- cancelled: "cancelled";
74
- interrupted: "interrupted";
75
- }>;
76
- checkpoint: z.ZodMiniOptional<z.ZodMiniObject<{
77
- checkpointId: z.ZodMiniString<string>;
78
- runId: z.ZodMiniString<string>;
79
- turnSeq: z.ZodMiniNumberFormat;
80
- committedAt: z.ZodMiniString<string>;
81
- throughSeq: z.ZodMiniNumberFormat;
82
- }, z.core.$strict>>;
83
- failureClass: z.ZodMiniOptional<z.ZodMiniString<string>>;
84
- failureMessage: z.ZodMiniOptional<z.ZodMiniString<string>>;
85
- childCostUsd: z.ZodMiniNumber<number>;
86
- providerUsage: z.ZodMiniArray<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
87
- }, z.core.$strict>;
88
- /**
89
- * The OTLP body, keyed by the requested signal.
90
- *
91
- * A union of two SINGLE-KEY strict objects is the schema form of what
92
- * `assertStandardsPureOtlpBody` asserts by hand: exactly one root key, and no
93
- * aex pagination smuggled into a standards body — the cursor rides in the
94
- * `x-aex-next-cursor` HEADER, which this schema cannot see and must therefore
95
- * not tolerate in the body.
96
- */
97
- export declare const SessionOtlpResponseSchema: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
98
- resourceSpans: z.ZodMiniArray<z.ZodMiniObject<{
99
- resource: z.ZodMiniObject<{
100
- attributes: z.ZodMiniArray<z.ZodMiniObject<{
101
- key: z.ZodMiniString<string>;
102
- value: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
103
- stringValue: z.ZodMiniString<string>;
104
- }, z.core.$strict>, z.ZodMiniObject<{
105
- boolValue: z.ZodMiniBoolean<boolean>;
106
- }, z.core.$strict>, z.ZodMiniObject<{
107
- intValue: z.ZodMiniString<string>;
108
- }, z.core.$strict>, z.ZodMiniObject<{
109
- doubleValue: z.ZodMiniNumber<number>;
110
- }, z.core.$strict>]>;
111
- }, z.core.$strict>>;
112
- }, z.core.$strict>;
113
- scopeSpans: z.ZodMiniArray<z.ZodMiniObject<{
114
- scope: z.ZodMiniObject<{
115
- name: z.ZodMiniString<string>;
116
- version: z.ZodMiniOptional<z.ZodMiniString<string>>;
117
- }, z.core.$strict>;
118
- spans: z.ZodMiniArray<z.ZodMiniObject<{
119
- traceId: z.ZodMiniString<string>;
120
- spanId: z.ZodMiniString<string>;
121
- parentSpanId: z.ZodMiniOptional<z.ZodMiniString<string>>;
122
- name: z.ZodMiniString<string>;
123
- kind: z.ZodMiniLiteral<1>;
124
- startTimeUnixNano: z.ZodMiniString<string>;
125
- endTimeUnixNano: z.ZodMiniString<string>;
126
- attributes: z.ZodMiniArray<z.ZodMiniObject<{
127
- key: z.ZodMiniString<string>;
128
- value: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
129
- stringValue: z.ZodMiniString<string>;
130
- }, z.core.$strict>, z.ZodMiniObject<{
131
- boolValue: z.ZodMiniBoolean<boolean>;
132
- }, z.core.$strict>, z.ZodMiniObject<{
133
- intValue: z.ZodMiniString<string>;
134
- }, z.core.$strict>, z.ZodMiniObject<{
135
- doubleValue: z.ZodMiniNumber<number>;
136
- }, z.core.$strict>]>;
137
- }, z.core.$strict>>;
138
- status: z.ZodMiniObject<{
139
- code: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<1>, z.ZodMiniLiteral<2>]>;
140
- }, z.core.$strict>;
141
- }, z.core.$strict>>;
142
- }, z.core.$strict>>;
143
- }, z.core.$strict>>;
144
- }, z.core.$strict>, z.ZodMiniObject<{
145
- resourceLogs: z.ZodMiniArray<z.ZodMiniObject<{
146
- resource: z.ZodMiniObject<{
147
- attributes: z.ZodMiniArray<z.ZodMiniObject<{
148
- key: z.ZodMiniString<string>;
149
- value: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
150
- stringValue: z.ZodMiniString<string>;
151
- }, z.core.$strict>, z.ZodMiniObject<{
152
- boolValue: z.ZodMiniBoolean<boolean>;
153
- }, z.core.$strict>, z.ZodMiniObject<{
154
- intValue: z.ZodMiniString<string>;
155
- }, z.core.$strict>, z.ZodMiniObject<{
156
- doubleValue: z.ZodMiniNumber<number>;
157
- }, z.core.$strict>]>;
158
- }, z.core.$strict>>;
159
- }, z.core.$strict>;
160
- scopeLogs: z.ZodMiniArray<z.ZodMiniObject<{
161
- scope: z.ZodMiniObject<{
162
- name: z.ZodMiniString<string>;
163
- version: z.ZodMiniOptional<z.ZodMiniString<string>>;
164
- }, z.core.$strict>;
165
- logRecords: z.ZodMiniArray<z.ZodMiniObject<{
166
- timeUnixNano: z.ZodMiniString<string>;
167
- observedTimeUnixNano: z.ZodMiniString<string>;
168
- severityNumber: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<9>, z.ZodMiniLiteral<13>, z.ZodMiniLiteral<17>]>;
169
- severityText: z.ZodMiniEnum<{
170
- INFO: "INFO";
171
- WARN: "WARN";
172
- ERROR: "ERROR";
173
- }>;
174
- body: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
175
- stringValue: z.ZodMiniString<string>;
176
- }, z.core.$strict>, z.ZodMiniObject<{
177
- boolValue: z.ZodMiniBoolean<boolean>;
178
- }, z.core.$strict>, z.ZodMiniObject<{
179
- intValue: z.ZodMiniString<string>;
180
- }, z.core.$strict>, z.ZodMiniObject<{
181
- doubleValue: z.ZodMiniNumber<number>;
182
- }, z.core.$strict>]>;
183
- attributes: z.ZodMiniArray<z.ZodMiniObject<{
184
- key: z.ZodMiniString<string>;
185
- value: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
186
- stringValue: z.ZodMiniString<string>;
187
- }, z.core.$strict>, z.ZodMiniObject<{
188
- boolValue: z.ZodMiniBoolean<boolean>;
189
- }, z.core.$strict>, z.ZodMiniObject<{
190
- intValue: z.ZodMiniString<string>;
191
- }, z.core.$strict>, z.ZodMiniObject<{
192
- doubleValue: z.ZodMiniNumber<number>;
193
- }, z.core.$strict>]>;
194
- }, z.core.$strict>>;
195
- traceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
196
- spanId: z.ZodMiniOptional<z.ZodMiniString<string>>;
197
- }, z.core.$strict>>;
198
- }, z.core.$strict>>;
199
- }, z.core.$strict>>;
200
- }, z.core.$strict>]>;
@@ -1,142 +0,0 @@
1
- /**
2
- * Response schemas for the three session routes that are JSON but are not part
3
- * of the bearer-key SDK surface: the OTLP telemetry pull, and the two
4
- * writer-token hops the in-container runtime uses to read a child's result and
5
- * to finalize it.
6
- *
7
- * They are separated from `response-sessions.ts` because they have a different
8
- * audience and a different failure mode: nothing in this repository's
9
- * `HttpClient` call sites can produce them, so they are permanently
10
- * "unexercised" in a C4 report. `testing/response-bindings.ts` names that fact
11
- * rather than leaving a reader to infer thin coverage.
12
- *
13
- * The OTLP shapes are the ONE place where the wire is standards-defined rather
14
- * than ours: they mirror `otlp-projection.ts`, which is itself the declaration
15
- * of what `toOTLP` emits, so this schema and that type must agree exactly.
16
- */
17
- import * as z from "zod/mini";
18
- import { SESSION_TERMINAL_OUTCOMES } from "../status.js";
19
- import { CheckpointRevisionSchema } from "./response-sessions.js";
20
- import { describeResponse, responseObject, wireEnum, wireLiteral, wireNonEmptyString, wireNonNegativeInteger, wireNonNegativeNumber, wireString } from "./response-common.js";
21
- const optional = z.optional;
22
- // ===========================================================================
23
- // GET /sessions/{id}/result — writer-token child result
24
- // ===========================================================================
25
- /**
26
- * A child file as the result route projects it.
27
- *
28
- * NOTE the key is `path`, not `filename` — this is NOT the
29
- * `publicFileFromObject` shape the public `/files` routes emit. Two projections
30
- * of one concept, differing in one key name.
31
- */
32
- const ChildResultFileSchema = responseObject({
33
- id: wireNonEmptyString,
34
- path: wireString,
35
- checkpointId: wireNonEmptyString,
36
- sizeBytes: wireNonNegativeInteger,
37
- sha256: wireString,
38
- contentType: wireString
39
- });
40
- const ChildResultPendingSchema = responseObject({
41
- id: wireNonEmptyString,
42
- state: wireEnum(["settling", "running", "queued"]),
43
- files: z.array(ChildResultFileSchema)
44
- });
45
- const ChildResultFinishedSchema = responseObject({
46
- id: wireNonEmptyString,
47
- state: wireLiteral("finished"),
48
- outcome: wireEnum(SESSION_TERMINAL_OUTCOMES),
49
- files: z.array(ChildResultFileSchema),
50
- text: optional(wireString),
51
- failureClass: optional(wireString),
52
- failureMessage: optional(wireString),
53
- conflicts: optional(z.array(responseObject({
54
- path: wireString,
55
- kind: wireEnum(["stale", "blocked"]),
56
- resolved: wireLiteral(false)
57
- })))
58
- });
59
- export const ChildResultResponseSchema = describeResponse("ChildResultResponse", "A subagent child's result: still in flight, or finished with its outcome and files.", z.union([ChildResultPendingSchema, ChildResultFinishedSchema], {
60
- error: 'child result must be state "settling"/"running"/"queued", or "finished" with an outcome'
61
- }));
62
- // ===========================================================================
63
- // POST /sessions/{id}/finalize — writer-token child settle hop
64
- // ===========================================================================
65
- export const ChildFinalizeResponseSchema = describeResponse("ChildFinalizeResponse", "The settled child's terminal facts. No `session` envelope — this route is not " +
66
- "shaped like the public session routes.", responseObject({
67
- id: wireNonEmptyString,
68
- lifecycleStatus: wireEnum(["idle", "error"]),
69
- outcome: wireEnum(SESSION_TERMINAL_OUTCOMES),
70
- checkpoint: optional(CheckpointRevisionSchema),
71
- failureClass: optional(wireString),
72
- failureMessage: optional(wireString),
73
- childCostUsd: wireNonNegativeNumber,
74
- providerUsage: z.array(z.record(wireString, z.unknown()))
75
- }));
76
- // ===========================================================================
77
- // GET /sessions/{id}/otel — standards-pure OTLP/HTTP JSON
78
- // ===========================================================================
79
- /**
80
- * OTLP `AnyValue`, restricted to the scalars the projection emits.
81
- *
82
- * A strict union rather than a loose object: OTLP's own `AnyValue` admits
83
- * arrays and kvlists, and `otlp-projection.ts` deliberately emits neither.
84
- */
85
- const OtlpAnyValueSchema = z.union([
86
- responseObject({ stringValue: wireString }),
87
- responseObject({ boolValue: z.boolean() }),
88
- responseObject({ intValue: wireString }),
89
- responseObject({ doubleValue: z.number() })
90
- ], { error: "OTLP AnyValue must be one of stringValue, boolValue, intValue, doubleValue" });
91
- const OtlpKeyValueSchema = responseObject({ key: wireString, value: OtlpAnyValueSchema });
92
- const OtlpResourceSchema = responseObject({ attributes: z.array(OtlpKeyValueSchema) });
93
- const OtlpScopeSchema = responseObject({
94
- name: wireString,
95
- version: optional(wireString)
96
- });
97
- const OtlpTraceSpanSchema = responseObject({
98
- traceId: wireString,
99
- spanId: wireString,
100
- parentSpanId: optional(wireString),
101
- name: wireString,
102
- kind: wireLiteral(1),
103
- startTimeUnixNano: wireString,
104
- endTimeUnixNano: wireString,
105
- attributes: z.array(OtlpKeyValueSchema),
106
- status: responseObject({ code: z.union([wireLiteral(1), wireLiteral(2)]) })
107
- });
108
- const OtlpLogRecordSchema = responseObject({
109
- timeUnixNano: wireString,
110
- observedTimeUnixNano: wireString,
111
- severityNumber: z.union([wireLiteral(9), wireLiteral(13), wireLiteral(17)]),
112
- severityText: wireEnum(["INFO", "WARN", "ERROR"]),
113
- body: OtlpAnyValueSchema,
114
- attributes: z.array(OtlpKeyValueSchema),
115
- traceId: optional(wireString),
116
- spanId: optional(wireString)
117
- });
118
- const OtlpTracesSchema = responseObject({
119
- resourceSpans: z.array(responseObject({
120
- resource: OtlpResourceSchema,
121
- scopeSpans: z.array(responseObject({ scope: OtlpScopeSchema, spans: z.array(OtlpTraceSpanSchema) }))
122
- }))
123
- });
124
- const OtlpLogsSchema = responseObject({
125
- resourceLogs: z.array(responseObject({
126
- resource: OtlpResourceSchema,
127
- scopeLogs: z.array(responseObject({ scope: OtlpScopeSchema, logRecords: z.array(OtlpLogRecordSchema) }))
128
- }))
129
- });
130
- /**
131
- * The OTLP body, keyed by the requested signal.
132
- *
133
- * A union of two SINGLE-KEY strict objects is the schema form of what
134
- * `assertStandardsPureOtlpBody` asserts by hand: exactly one root key, and no
135
- * aex pagination smuggled into a standards body — the cursor rides in the
136
- * `x-aex-next-cursor` HEADER, which this schema cannot see and must therefore
137
- * not tolerate in the body.
138
- */
139
- export const SessionOtlpResponseSchema = describeResponse("SessionOtlpResponse", "A standards-pure OTLP/HTTP JSON export body: `resourceSpans` for traces, " +
140
- "`resourceLogs` for logs, and nothing else. Pagination is a response header.", z.union([OtlpTracesSchema, OtlpLogsSchema], {
141
- error: "session OTLP response must contain exactly one of resourceSpans or resourceLogs"
142
- }));