@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
@@ -1,209 +0,0 @@
1
- /**
2
- * Schemas for the two MCP server declarations on the request side: the
3
- * non-secret `McpServerRef` that enters the hashed submission, and the
4
- * `SessionConfigMcpServer` a `session.json` may carry with inline `headers`.
5
- *
6
- * Two rules are DEFERRED BACK to `session-config.ts` through {@link McpWirePolicy}
7
- * rather than moved here, and that is deliberate:
8
- * `scripts/cicd/check-parser-ratchet.mjs`'s sibling gate
9
- * `scripts/cicd/check-contract-parity.mjs` locates the SSRF host deny-list
10
- * inside `session-config.ts` — it slices the file from `denyReasonForHostIp` to
11
- * `parseRemoteMcpTransport` and byte-compares that region against
12
- * `platform/packages/shared/src/blueprint.ts`. Moving either function here would
13
- * break the only cross-repo check that keeps the two deny-lists identical, so
14
- * the schema takes them as parameters instead.
15
- */
16
- import * as z from "zod/mini";
17
- import { parseWire, wireObject } from "./wire.js";
18
- export const MCP_SERVER_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,62}$/;
19
- /**
20
- * Canonical error string for any attempt to declare a stdio-shaped MCP
21
- * server (`transport: "stdio"`, or a stdio-only field like `command` /
22
- * `args` / `env`). Pinned in source so every surface — shared parser,
23
- * SDK builder, CLI flag parser, dashboard form — surfaces the same
24
- * message and a user can find it via grep.
25
- */
26
- export const REMOTE_MCP_STDIO_REJECTED_MESSAGE = "stdio MCP servers are not supported by Aex. Aex supports remote MCP servers over HTTP/SSE only.";
27
- /**
28
- * Stdio-only fields. Used by the shape gate to detect a stdio declaration even
29
- * when the caller omits `transport: "stdio"` (e.g. `{ url, command }` — the
30
- * presence of `command` alone identifies it).
31
- */
32
- const STDIO_ONLY_FIELDS = ["command", "args", "env"];
33
- function isStdioShaped(value) {
34
- if (value === null || typeof value !== "object") {
35
- return false;
36
- }
37
- const record = value;
38
- return (record.transport === "stdio" || STDIO_ONLY_FIELDS.some((field) => record[field] !== undefined));
39
- }
40
- /**
41
- * A remote-only precondition on any MCP declaration, whatever else is wrong
42
- * with it.
43
- *
44
- * Deliberately its own schema, parsed BEFORE the strict object rather than
45
- * carried on it as a `.check()`. Zod raises `unrecognized_keys` while parsing
46
- * the object body and skips the object's own checks once the body has issues
47
- * (measured), and `errorFromZod` ranks a rejected key ahead of every other issue
48
- * at the same depth — so no rule expressed on the object can outrank an unknown
49
- * key. `{ command: "local", unknown: true }` must report stdio, not `unknown`,
50
- * which is exactly the sequencing the hand-written parser had: reject the stdio
51
- * shape, then apply the allow-list.
52
- */
53
- export const RemoteMcpShapeSchema = z.unknown().check(z.refine((value) => !isStdioShaped(value), {
54
- error: REMOTE_MCP_STDIO_REJECTED_MESSAGE,
55
- abort: true
56
- }));
57
- /**
58
- * Throw the canonical stdio-rejected error if the record carries any
59
- * stdio-only marker (`transport: "stdio"`, `command`, `args`, `env`).
60
- * Used by both the shared parser and the SDK `McpServer.remote`
61
- * builder so every entry point surfaces the same message.
62
- */
63
- export function rejectStdioMcpShape(record) {
64
- parseWire(RemoteMcpShapeSchema, record);
65
- }
66
- function toUrl(value) {
67
- try {
68
- return new URL(value);
69
- }
70
- catch {
71
- return undefined;
72
- }
73
- }
74
- function mcpServerName(path) {
75
- const message = `${path}.name must match ${MCP_SERVER_NAME_PATTERN.source}`;
76
- return z.string({ error: message }).check(z.regex(MCP_SERVER_NAME_PATTERN, { error: message }));
77
- }
78
- /**
79
- * An http(s) MCP endpoint with no userinfo, on a host the SSRF deny-list allows.
80
- *
81
- * Each check aborts so the reported failure is the first one a reader would hit,
82
- * matching the sequential `new URL()` / protocol / userinfo / host ladder this
83
- * replaces. Auth belongs in `secrets.mcpServers[].headers`: a
84
- * `https://user:pass@host` URL would otherwise be persisted in the non-secret
85
- * session snapshot and hashed into the idempotency key.
86
- */
87
- function mcpServerUrl(path, policy) {
88
- const nonEmpty = `${path}.url must be a non-empty string`;
89
- return z.string({ error: nonEmpty }).check(z.minLength(1, { error: nonEmpty, abort: true }), z.refine((value) => toUrl(value) !== undefined, {
90
- error: (issue) => `${path}.url is not a valid URL: ${String(issue.input)}`,
91
- abort: true
92
- }), z.refine((value) => {
93
- const protocol = toUrl(value)?.protocol;
94
- return protocol === "https:" || protocol === "http:";
95
- }, {
96
- error: (issue) => `${path}.url must use http or https (got ${toUrl(issue.input)?.protocol ?? ""})`,
97
- abort: true
98
- }), z.refine((value) => {
99
- const url = toUrl(value);
100
- return url !== undefined && url.username === "" && url.password === "";
101
- }, {
102
- error: `${path}.url must not contain userinfo (username/password); use secrets.mcpServers[].headers for auth`,
103
- abort: true
104
- }), z.refine((value) => denyReason(value, policy) === null, {
105
- error: (issue) => `${path}.url ${denyReason(issue.input, policy) ?? ""}`,
106
- abort: true
107
- }));
108
- }
109
- function denyReason(value, policy) {
110
- const url = toUrl(value);
111
- return url === undefined ? null : policy.denyReasonForHost(url);
112
- }
113
- /**
114
- * The optional remote transport, validated by the policy's parser so the
115
- * permitted set is stated once — in `session-config.ts`, alongside
116
- * {@link McpWirePolicy}'s other deferred rule.
117
- *
118
- * The value shape is therefore opaque to the generated document (L2); the
119
- * permitted values live in the description registered on the objects below.
120
- */
121
- function mcpServerTransport(path, policy) {
122
- const field = `${path}.transport`;
123
- const failure = (value) => {
124
- try {
125
- policy.parseTransport(value, field);
126
- return null;
127
- }
128
- catch (error) {
129
- return error.message;
130
- }
131
- };
132
- return z.optional(z.unknown().check(z.refine((value) => failure(value) === null, {
133
- error: (issue) => failure(issue.input) ?? "",
134
- abort: true
135
- })));
136
- }
137
- /** Per-request headers, kept out of the non-secret ref — see {@link mcpServerRefSchema}. */
138
- function mcpHeaders(path) {
139
- return z.optional(z.record(z.string(), z.string({
140
- error: (issue) => `${path}.headers.${lastSegment(issue.path)} must be a string`
141
- }), { error: `${path}.headers, when provided, must be a string-keyed object` }));
142
- }
143
- function lastSegment(issuePath) {
144
- const segment = issuePath?.[issuePath.length - 1];
145
- return segment === undefined ? "" : String(segment);
146
- }
147
- /**
148
- * Wire shape of the NON-SECRET half of an MCP server declaration.
149
- *
150
- * Headers belong on `SessionConfigMcpServer`, and the wire
151
- * `submission.mcpServers` must NEVER contain them, so anything other than
152
- * `{name, url, transport}` is rejected explicitly — a caller accidentally
153
- * inlining `headers` into the non-secret half fails loudly instead of having the
154
- * field silently dropped.
155
- */
156
- export function mcpServerRefSchema(path, policy) {
157
- return wireObject(path, {
158
- name: mcpServerName(path),
159
- url: mcpServerUrl(path, policy),
160
- transport: mcpServerTransport(path, policy)
161
- }, {
162
- unknownKey: (objectPath, key, permitted) => `${objectPath}.${key} is not an allowed field for McpServerRef; permitted: ${permitted.join(", ")}`
163
- });
164
- }
165
- /**
166
- * Wire shape of a session-config MCP entry: the non-secret ref plus the inline
167
- * `headers` the SDK splits out at submission time, so config loaded from
168
- * `--config session.json` cannot smuggle unrelated fields past the parser.
169
- */
170
- export function sessionConfigMcpServerSchema(path, policy) {
171
- return wireObject(path, {
172
- name: mcpServerName(path),
173
- url: mcpServerUrl(path, policy),
174
- transport: mcpServerTransport(path, policy),
175
- headers: mcpHeaders(path)
176
- }, {
177
- unknownKey: (objectPath, key, permitted) => `${objectPath}.${key} is not an allowed field for SessionConfigMcpServer; permitted: ${permitted.join(", ")}`
178
- });
179
- }
180
- /** Reject a stdio shape, then validate the non-secret ref mounted at `path`. */
181
- export function parseMcpServerRefWire(input, path, policy) {
182
- parseWire(RemoteMcpShapeSchema, input);
183
- return parseWire(mcpServerRefSchema(path, policy), input);
184
- }
185
- /** Reject a stdio shape, then validate a session-config entry mounted at `path`. */
186
- export function parseSessionConfigMcpServerWire(input, path, policy) {
187
- parseWire(RemoteMcpShapeSchema, input);
188
- return parseWire(sessionConfigMcpServerSchema(path, policy), input);
189
- }
190
- /**
191
- * Drop an absent `transport` so an omitted field never lands as an explicit
192
- * `undefined` on the hashed payload.
193
- *
194
- * Separate from the schema per D4 — see
195
- * {@link import("./asset-ref.js").normalizeAssetRef}.
196
- */
197
- export function normalizeMcpServerRef(wire) {
198
- // `transport` is validated by the policy's parser, which is what narrows it;
199
- // the schema itself only knows the value passed that gate.
200
- const transport = wire.transport;
201
- return transport === undefined
202
- ? { name: wire.name, url: wire.url }
203
- : { name: wire.name, url: wire.url, transport };
204
- }
205
- /** As {@link normalizeMcpServerRef}, preserving inline `headers` when supplied. */
206
- export function normalizeSessionConfigMcpServer(wire) {
207
- const ref = normalizeMcpServerRef(wire);
208
- return wire.headers === undefined ? ref : { ...ref, headers: wire.headers };
209
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Schema for a public model id — a Vercel AI Gateway `creator/model` slug.
3
- *
4
- * Structural only. There is no closed model set: an unknown-but-well-formed
5
- * slug is accepted so a slightly-old client can still name a newly-launched
6
- * model, and the gateway arbitrates at submit time. See `models.ts`.
7
- *
8
- * The pattern is declared here, next to the schema that enforces it, and
9
- * re-exported by `models.ts` as `MODEL_SLUG_PATTERN` — same reason as the
10
- * sibling vocabularies: the parser module imports this one, so the constant
11
- * cannot live there without a cycle.
12
- */
13
- import * as z from "zod/mini";
14
- /**
15
- * Structural gateway model-slug shape: a lowercase `creator`, a `/`, then the
16
- * model segment. Matches Vercel AI Gateway `creator/model` slugs
17
- * (e.g. `anthropic/claude-sonnet-4-6`, `openai/gpt-4.1`, `x-ai/grok-2`).
18
- */
19
- export declare const MODEL_SLUG_PATTERN: RegExp;
20
- type ModelSlugSchema = ReturnType<typeof buildModelSlug>;
21
- declare function buildModelSlug(field: string): z.ZodMiniString<string>;
22
- /**
23
- * The model-slug schema mounted at `field`.
24
- *
25
- * Each check aborts so the reported failure is the first one a reader would
26
- * hit, matching the sequential type/emptiness/pattern ladder it replaces.
27
- */
28
- export declare function modelSlugSchema(field: string): ModelSlugSchema;
29
- export {};
@@ -1,51 +0,0 @@
1
- /**
2
- * Schema for a public model id — a Vercel AI Gateway `creator/model` slug.
3
- *
4
- * Structural only. There is no closed model set: an unknown-but-well-formed
5
- * slug is accepted so a slightly-old client can still name a newly-launched
6
- * model, and the gateway arbitrates at submit time. See `models.ts`.
7
- *
8
- * The pattern is declared here, next to the schema that enforces it, and
9
- * re-exported by `models.ts` as `MODEL_SLUG_PATTERN` — same reason as the
10
- * sibling vocabularies: the parser module imports this one, so the constant
11
- * cannot live there without a cycle.
12
- */
13
- import * as z from "zod/mini";
14
- /**
15
- * Structural gateway model-slug shape: a lowercase `creator`, a `/`, then the
16
- * model segment. Matches Vercel AI Gateway `creator/model` slugs
17
- * (e.g. `anthropic/claude-sonnet-4-6`, `openai/gpt-4.1`, `x-ai/grok-2`).
18
- */
19
- export const MODEL_SLUG_PATTERN = /^[a-z0-9-]+\/[A-Za-z0-9._:-]+$/;
20
- /**
21
- * The field name is part of every message this schema raises, and the same slug
22
- * rule is mounted at several wire paths (`submission.model`, a session request
23
- * config's model, an SDK-selected model). Building per path keeps the messages
24
- * naming the field the caller actually sent; the paths are a small closed set
25
- * of literals, so the built schemas are memoised rather than rebuilt per call.
26
- */
27
- const byField = new Map();
28
- function buildModelSlug(field) {
29
- const notASlugString = `${field} must be a non-empty gateway model slug string ("creator/model")`;
30
- return z
31
- .string({ error: notASlugString })
32
- .check(z.minLength(1, { error: notASlugString, abort: true }), z.refine((value) => MODEL_SLUG_PATTERN.test(value), {
33
- error: (issue) => `${field} must be a gateway model slug of the form "creator/model" matching ${MODEL_SLUG_PATTERN.source} (got ${JSON.stringify(issue.input)})`,
34
- abort: true
35
- }));
36
- }
37
- /**
38
- * The model-slug schema mounted at `field`.
39
- *
40
- * Each check aborts so the reported failure is the first one a reader would
41
- * hit, matching the sequential type/emptiness/pattern ladder it replaces.
42
- */
43
- export function modelSlugSchema(field) {
44
- const existing = byField.get(field);
45
- if (existing !== undefined) {
46
- return existing;
47
- }
48
- const built = buildModelSlug(field);
49
- byField.set(field, built);
50
- return built;
51
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Numeric wire primitives shared by the request schemas.
3
- *
4
- * Each takes the wire path it is mounted at so the message names the field the
5
- * caller actually sent, matching the `optionalPositiveInt(value, "limits.maxTurns")`
6
- * style these replace.
7
- */
8
- import * as z from "zod/mini";
9
- /**
10
- * A positive safe integer — a count. Rejects non-numbers, non-integers,
11
- * unsafe integers, and `<= 0`.
12
- */
13
- export declare function positiveInt(path: string): z.ZodMiniNumber<number>;
14
- /**
15
- * A positive finite number — an amount, so fractional values are allowed
16
- * (`maxSpendUsd: 2.5`). Rejects non-numbers, NaN/Infinity, and `<= 0`.
17
- */
18
- export declare function positiveNumber(path: string): z.ZodMiniNumber<number>;
@@ -1,28 +0,0 @@
1
- /**
2
- * Numeric wire primitives shared by the request schemas.
3
- *
4
- * Each takes the wire path it is mounted at so the message names the field the
5
- * caller actually sent, matching the `optionalPositiveInt(value, "limits.maxTurns")`
6
- * style these replace.
7
- */
8
- import * as z from "zod/mini";
9
- /**
10
- * A positive safe integer — a count. Rejects non-numbers, non-integers,
11
- * unsafe integers, and `<= 0`.
12
- */
13
- export function positiveInt(path) {
14
- const message = `${path} must be a positive safe integer`;
15
- return z
16
- .number({ error: message })
17
- .check(z.refine((value) => Number.isSafeInteger(value) && value > 0, { error: message, abort: true }));
18
- }
19
- /**
20
- * A positive finite number — an amount, so fractional values are allowed
21
- * (`maxSpendUsd: 2.5`). Rejects non-numbers, NaN/Infinity, and `<= 0`.
22
- */
23
- export function positiveNumber(path) {
24
- const message = `${path} must be a positive finite number`;
25
- return z
26
- .number({ error: message })
27
- .check(z.refine((value) => Number.isFinite(value) && value > 0, { error: message, abort: true }));
28
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * Schema for the private post-agent-run verifier hook.
3
- *
4
- * Shape gate only. Turning `timeout` into milliseconds, defaulting `maxTurns`,
5
- * and collapsing an empty command to "no hook" are all normalisation and live in
6
- * `../post-hook.ts` — a `.transform()` here would make the output half of the
7
- * generated spec ungenerable (D4/L1), and the duration parse must keep throwing
8
- * its own branded `parseDurationToMs` error rather than a re-worded schema one.
9
- */
10
- import * as z from "zod/mini";
11
- /**
12
- * Wire shape of a `postHook`, mounted at `path`.
13
- *
14
- * Built per call rather than once at module load because the wire path is a
15
- * parameter of the parser — the same shape is reported as `postHook` on a
16
- * session config and as `submission.postHook` under a submission, and every
17
- * message this family emits names the path the caller actually sent.
18
- *
19
- * Declaration order is the permitted-key order reported on an unknown field.
20
- */
21
- export declare function postHookSchema(path: string): z.ZodMiniObject<{
22
- command: z.ZodMiniString<string>;
23
- timeout: z.ZodMiniOptional<z.ZodMiniString<string>>;
24
- maxTurns: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
25
- maxChars: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniNumber<number>>>;
26
- }, z.core.$strict>;
27
- /**
28
- * The key-and-command gate, without the sibling field rules.
29
- *
30
- * A blank command means "no hook", and that answer is reached BEFORE `timeout`,
31
- * `maxTurns` and `maxChars` are looked at — which is the whole point of the
32
- * blank-command rule: callers pre-fill a hook config with placeholder values and
33
- * leave the command empty until they want it to run. Validating the siblings
34
- * first would reject exactly the configs the rule exists to allow.
35
- *
36
- * So the parse happens in two passes: this one decides whether there is a hook
37
- * at all, and the full {@link postHookSchema} validates the rest only once there
38
- * is. Both read their keys from the same shape, so there is still one
39
- * declaration of what a `postHook` may contain.
40
- */
41
- export declare function postHookGateSchema(path: string): z.ZodMiniObject<{
42
- command: z.ZodMiniString<string>;
43
- }, z.core.$strict>;
44
- /** Validated `postHook` wire input, before normalisation. */
45
- export type PostHookWire = z.infer<ReturnType<typeof postHookSchema>>;
@@ -1,68 +0,0 @@
1
- /**
2
- * Schema for the private post-agent-run verifier hook.
3
- *
4
- * Shape gate only. Turning `timeout` into milliseconds, defaulting `maxTurns`,
5
- * and collapsing an empty command to "no hook" are all normalisation and live in
6
- * `../post-hook.ts` — a `.transform()` here would make the output half of the
7
- * generated spec ungenerable (D4/L1), and the duration parse must keep throwing
8
- * its own branded `parseDurationToMs` error rather than a re-worded schema one.
9
- */
10
- import * as z from "zod/mini";
11
- import { wireObject } from "./wire.js";
12
- /**
13
- * A non-negative safe integer.
14
- *
15
- * Deliberately not `positiveInt` from `./numeric.js`: this admits `0` (a hook
16
- * may be given no repair turns at all) and the wording it fails with — "a
17
- * non-negative integer" — is the message this family already emits.
18
- */
19
- function nonNegativeInt(path) {
20
- const message = `${path} must be a non-negative integer`;
21
- return z
22
- .number({ error: message })
23
- .check(z.refine((value) => Number.isSafeInteger(value) && value >= 0, {
24
- error: message,
25
- abort: true
26
- }));
27
- }
28
- /**
29
- * Wire shape of a `postHook`, mounted at `path`.
30
- *
31
- * Built per call rather than once at module load because the wire path is a
32
- * parameter of the parser — the same shape is reported as `postHook` on a
33
- * session config and as `submission.postHook` under a submission, and every
34
- * message this family emits names the path the caller actually sent.
35
- *
36
- * Declaration order is the permitted-key order reported on an unknown field.
37
- */
38
- export function postHookSchema(path) {
39
- return wireObject(path, {
40
- command: z.string({ error: `${path}.command must be a string` }),
41
- timeout: z.optional(z.string({
42
- error: (issue) => `${path}.timeout must be a duration string (e.g. "5m", "30s"); got ${JSON.stringify(issue.input)}`
43
- })),
44
- maxTurns: z.optional(nonNegativeInt(`${path}.maxTurns`)),
45
- maxChars: z.optional(z.nullable(nonNegativeInt(`${path}.maxChars`)))
46
- });
47
- }
48
- /**
49
- * The key-and-command gate, without the sibling field rules.
50
- *
51
- * A blank command means "no hook", and that answer is reached BEFORE `timeout`,
52
- * `maxTurns` and `maxChars` are looked at — which is the whole point of the
53
- * blank-command rule: callers pre-fill a hook config with placeholder values and
54
- * leave the command empty until they want it to run. Validating the siblings
55
- * first would reject exactly the configs the rule exists to allow.
56
- *
57
- * So the parse happens in two passes: this one decides whether there is a hook
58
- * at all, and the full {@link postHookSchema} validates the rest only once there
59
- * is. Both read their keys from the same shape, so there is still one
60
- * declaration of what a `postHook` may contain.
61
- */
62
- export function postHookGateSchema(path) {
63
- const { command, ...rest } = postHookSchema(path).def.shape;
64
- return wireObject(path, {
65
- command,
66
- ...Object.fromEntries(Object.keys(rest).map((key) => [key, z.optional(z.unknown())]))
67
- });
68
- }
@@ -1,75 +0,0 @@
1
- /**
2
- * Response schemas for the `assets.*` family — the content-addressed byte store
3
- * every workspace resource is built on.
4
- *
5
- * `POST /assets/presign` has THREE distinct 200 bodies and they are genuinely
6
- * different objects, not one object with optional halves: a dedup hit carries
7
- * `contentType` and no upload grant, a single-PUT mint carries `uploadUrl` and
8
- * `requiredHeaders` and no `contentType`, and a multipart mint carries a
9
- * `multipart` block and no top-level upload fields. A union of three strict
10
- * objects says that; one object with everything optional would accept a
11
- * nonsensical mixture and assert almost nothing.
12
- */
13
- import * as z from "zod/mini";
14
- export declare const AssetPresignResponseSchema: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
15
- ok: z.ZodMiniLiteral<true>;
16
- exists: z.ZodMiniLiteral<true>;
17
- assetId: z.ZodMiniString<string>;
18
- contentHash: z.ZodMiniString<string>;
19
- sizeBytes: z.ZodMiniNumberFormat;
20
- contentType: z.ZodMiniString<string>;
21
- storagePath: z.ZodMiniString<string>;
22
- }, z.core.$strict>, z.ZodMiniObject<{
23
- ok: z.ZodMiniLiteral<true>;
24
- exists: z.ZodMiniLiteral<false>;
25
- assetId: z.ZodMiniString<string>;
26
- contentHash: z.ZodMiniString<string>;
27
- sizeBytes: z.ZodMiniNumberFormat;
28
- storagePath: z.ZodMiniString<string>;
29
- uploadUrl: z.ZodMiniString<string>;
30
- requiredHeaders: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
31
- expiresInSeconds: z.ZodMiniNumberFormat;
32
- }, z.core.$strict>, z.ZodMiniObject<{
33
- ok: z.ZodMiniLiteral<true>;
34
- exists: z.ZodMiniLiteral<false>;
35
- assetId: z.ZodMiniString<string>;
36
- contentHash: z.ZodMiniString<string>;
37
- sizeBytes: z.ZodMiniNumberFormat;
38
- multipart: z.ZodMiniObject<{
39
- uploadId: z.ZodMiniString<string>;
40
- key: z.ZodMiniString<string>;
41
- partSize: z.ZodMiniNumberFormat;
42
- partCount: z.ZodMiniNumberFormat;
43
- partUrls: z.ZodMiniArray<z.ZodMiniObject<{
44
- partNumber: z.ZodMiniNumberFormat;
45
- url: z.ZodMiniString<string>;
46
- }, z.core.$strict>>;
47
- expiresInSeconds: z.ZodMiniNumberFormat;
48
- }, z.core.$strict>;
49
- }, z.core.$strict>]>;
50
- export declare const AssetFinalizeResponseSchema: z.ZodMiniObject<{
51
- ok: z.ZodMiniLiteral<true>;
52
- exists: z.ZodMiniLiteral<true>;
53
- assetId: z.ZodMiniString<string>;
54
- contentHash: z.ZodMiniString<string>;
55
- sizeBytes: z.ZodMiniNumberFormat;
56
- contentType: z.ZodMiniString<string>;
57
- }, z.core.$strict>;
58
- export declare const AssetMpuPresignPartsResponseSchema: z.ZodMiniObject<{
59
- ok: z.ZodMiniLiteral<true>;
60
- partUrls: z.ZodMiniArray<z.ZodMiniObject<{
61
- partNumber: z.ZodMiniNumberFormat;
62
- url: z.ZodMiniString<string>;
63
- }, z.core.$strict>>;
64
- expiresInSeconds: z.ZodMiniNumberFormat;
65
- }, z.core.$strict>;
66
- /**
67
- * `POST /assets/mpu/abort`.
68
- *
69
- * Worth knowing while reading a green C4: the handler swallows a failing S3
70
- * `AbortMultipartUpload` and still answers `{ ok: true }`, so this schema
71
- * passing does not mean the abort happened.
72
- */
73
- export declare const AssetMpuAbortResponseSchema: z.ZodMiniObject<{
74
- ok: z.ZodMiniLiteral<true>;
75
- }, z.core.$strict>;
@@ -1,81 +0,0 @@
1
- /**
2
- * Response schemas for the `assets.*` family — the content-addressed byte store
3
- * every workspace resource is built on.
4
- *
5
- * `POST /assets/presign` has THREE distinct 200 bodies and they are genuinely
6
- * different objects, not one object with optional halves: a dedup hit carries
7
- * `contentType` and no upload grant, a single-PUT mint carries `uploadUrl` and
8
- * `requiredHeaders` and no `contentType`, and a multipart mint carries a
9
- * `multipart` block and no top-level upload fields. A union of three strict
10
- * objects says that; one object with everything optional would accept a
11
- * nonsensical mixture and assert almost nothing.
12
- */
13
- import * as z from "zod/mini";
14
- import { describeResponse, responseObject, wireLiteral, wireNonEmptyString, wireNonNegativeInteger, wirePositiveInteger, wireString } from "./response-common.js";
15
- const PresignedPartSchema = responseObject({
16
- partNumber: wirePositiveInteger,
17
- url: wireNonEmptyString
18
- });
19
- /** Dedup hit: the bytes are already stored, so no upload grant is minted. */
20
- const AssetPresignExistingSchema = responseObject({
21
- ok: wireLiteral(true),
22
- exists: wireLiteral(true),
23
- assetId: wireNonEmptyString,
24
- contentHash: wireNonEmptyString,
25
- sizeBytes: wireNonNegativeInteger,
26
- contentType: wireString,
27
- storagePath: wireNonEmptyString
28
- });
29
- /** Single-PUT mint. Note the ABSENCE of `contentType` — the server sends none here. */
30
- const AssetPresignSinglePutSchema = responseObject({
31
- ok: wireLiteral(true),
32
- exists: wireLiteral(false),
33
- assetId: wireNonEmptyString,
34
- contentHash: wireNonEmptyString,
35
- sizeBytes: wireNonNegativeInteger,
36
- storagePath: wireNonEmptyString,
37
- uploadUrl: wireNonEmptyString,
38
- requiredHeaders: z.record(wireString, wireString),
39
- expiresInSeconds: wirePositiveInteger
40
- });
41
- /** Multipart mint. No top-level `storagePath` — the key rides inside `multipart`. */
42
- const AssetPresignMultipartSchema = responseObject({
43
- ok: wireLiteral(true),
44
- exists: wireLiteral(false),
45
- assetId: wireNonEmptyString,
46
- contentHash: wireNonEmptyString,
47
- sizeBytes: wireNonNegativeInteger,
48
- multipart: responseObject({
49
- uploadId: wireNonEmptyString,
50
- key: wireNonEmptyString,
51
- partSize: wirePositiveInteger,
52
- partCount: wirePositiveInteger,
53
- partUrls: z.array(PresignedPartSchema),
54
- expiresInSeconds: wirePositiveInteger
55
- })
56
- });
57
- export const AssetPresignResponseSchema = describeResponse("AssetPresignResponse", "One of three: a dedup hit, a single-PUT upload grant, or a multipart upload plan.", z.union([AssetPresignExistingSchema, AssetPresignSinglePutSchema, AssetPresignMultipartSchema], {
58
- error: "asset presign response must be a dedup hit (exists:true), a single-PUT grant " +
59
- "(uploadUrl + requiredHeaders) or a multipart plan (multipart)"
60
- }));
61
- export const AssetFinalizeResponseSchema = describeResponse("AssetFinalizeResponse", "The committed asset identity. Identical on the single-PUT and multipart-complete paths.", responseObject({
62
- ok: wireLiteral(true),
63
- exists: wireLiteral(true),
64
- assetId: wireNonEmptyString,
65
- contentHash: wireNonEmptyString,
66
- sizeBytes: wireNonNegativeInteger,
67
- contentType: wireString
68
- }));
69
- export const AssetMpuPresignPartsResponseSchema = describeResponse("AssetMpuPresignPartsResponse", "Fresh presigned URLs for the requested multipart part numbers, in request order.", responseObject({
70
- ok: wireLiteral(true),
71
- partUrls: z.array(PresignedPartSchema),
72
- expiresInSeconds: wirePositiveInteger
73
- }));
74
- /**
75
- * `POST /assets/mpu/abort`.
76
- *
77
- * Worth knowing while reading a green C4: the handler swallows a failing S3
78
- * `AbortMultipartUpload` and still answers `{ ok: true }`, so this schema
79
- * passing does not mean the abort happened.
80
- */
81
- export const AssetMpuAbortResponseSchema = describeResponse("AssetMpuAbortResponse", "Acknowledgement of a multipart abort. `ok: true` even when the underlying S3 abort failed.", responseObject({ ok: wireLiteral(true) }));