@aexhq/sdk 0.46.5-canary → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +38 -0
  3. package/README.md +54 -29
  4. package/dist/client/aex.d.ts +33 -0
  5. package/dist/client/aex.js +108 -0
  6. package/dist/client/aex.js.map +1 -0
  7. package/dist/client/credentials.d.ts +25 -0
  8. package/dist/client/credentials.js +97 -0
  9. package/dist/client/credentials.js.map +1 -0
  10. package/dist/client/routing.d.ts +7 -0
  11. package/dist/client/routing.js +29 -0
  12. package/dist/client/routing.js.map +1 -0
  13. package/dist/downloads/download.d.ts +18 -0
  14. package/dist/downloads/download.js +67 -0
  15. package/dist/downloads/download.js.map +1 -0
  16. package/dist/generated/errors.d.ts +12 -0
  17. package/dist/generated/errors.js +82 -0
  18. package/dist/generated/errors.js.map +1 -0
  19. package/dist/generated/models.d.ts +1392 -0
  20. package/dist/generated/models.js +62 -0
  21. package/dist/generated/models.js.map +1 -0
  22. package/dist/generated/resources.d.ts +710 -0
  23. package/dist/generated/resources.js +582 -0
  24. package/dist/generated/resources.js.map +1 -0
  25. package/dist/generated/routes.d.ts +44 -0
  26. package/dist/generated/routes.js +1905 -0
  27. package/dist/generated/routes.js.map +1 -0
  28. package/dist/index.d.ts +21 -50
  29. package/dist/index.js +14 -62
  30. package/dist/index.js.map +1 -1
  31. package/dist/node/session-file-limits.d.ts +4 -0
  32. package/dist/node/session-file-limits.js +7 -0
  33. package/dist/node/session-file-limits.js.map +1 -0
  34. package/dist/node/session-files.d.ts +80 -0
  35. package/dist/node/session-files.js +254 -0
  36. package/dist/node/session-files.js.map +1 -0
  37. package/dist/observations/stream.d.ts +1 -0
  38. package/dist/observations/stream.js +18 -0
  39. package/dist/observations/stream.js.map +1 -0
  40. package/dist/transport/errors.d.ts +60 -0
  41. package/dist/transport/errors.js +107 -0
  42. package/dist/transport/errors.js.map +1 -0
  43. package/dist/transport/pagination.d.ts +8 -0
  44. package/dist/transport/pagination.js +34 -0
  45. package/dist/transport/pagination.js.map +1 -0
  46. package/dist/transport/retry.d.ts +21 -0
  47. package/dist/transport/retry.js +37 -0
  48. package/dist/transport/retry.js.map +1 -0
  49. package/dist/transport/transport.d.ts +25 -0
  50. package/dist/transport/transport.js +33 -0
  51. package/dist/transport/transport.js.map +1 -0
  52. package/package.json +67 -30
  53. package/dist/_contracts/account-operations.d.ts +0 -101
  54. package/dist/_contracts/account-operations.js +0 -242
  55. package/dist/_contracts/account-types.d.ts +0 -461
  56. package/dist/_contracts/account-types.js +0 -1
  57. package/dist/_contracts/api-key.d.ts +0 -61
  58. package/dist/_contracts/api-key.js +0 -101
  59. package/dist/_contracts/api-routes.d.ts +0 -20
  60. package/dist/_contracts/api-routes.js +0 -109
  61. package/dist/_contracts/archive-limits.d.ts +0 -3
  62. package/dist/_contracts/archive-limits.js +0 -23
  63. package/dist/_contracts/asset-authoring.d.ts +0 -22
  64. package/dist/_contracts/asset-authoring.js +0 -106
  65. package/dist/_contracts/asset-bundle.d.ts +0 -64
  66. package/dist/_contracts/asset-bundle.js +0 -263
  67. package/dist/_contracts/asset-upload-helper.d.ts +0 -31
  68. package/dist/_contracts/asset-upload-helper.js +0 -84
  69. package/dist/_contracts/billing-admission.d.ts +0 -29
  70. package/dist/_contracts/billing-admission.js +0 -28
  71. package/dist/_contracts/bundle-manifest.d.ts +0 -89
  72. package/dist/_contracts/bundle-manifest.js +0 -158
  73. package/dist/_contracts/canonical-sha256.d.ts +0 -8
  74. package/dist/_contracts/canonical-sha256.js +0 -8
  75. package/dist/_contracts/connection-ticket.d.ts +0 -22
  76. package/dist/_contracts/connection-ticket.js +0 -54
  77. package/dist/_contracts/continuation-event.d.ts +0 -31
  78. package/dist/_contracts/continuation-event.js +0 -6
  79. package/dist/_contracts/contract-parse-error.d.ts +0 -12
  80. package/dist/_contracts/contract-parse-error.js +0 -51
  81. package/dist/_contracts/error-codes.d.ts +0 -26
  82. package/dist/_contracts/error-codes.js +0 -116
  83. package/dist/_contracts/error-factory.d.ts +0 -32
  84. package/dist/_contracts/error-factory.js +0 -174
  85. package/dist/_contracts/event-envelope.d.ts +0 -471
  86. package/dist/_contracts/event-envelope.js +0 -501
  87. package/dist/_contracts/event-stream-client.d.ts +0 -122
  88. package/dist/_contracts/event-stream-client.js +0 -445
  89. package/dist/_contracts/event-view.d.ts +0 -44
  90. package/dist/_contracts/event-view.js +0 -69
  91. package/dist/_contracts/failure-class.d.ts +0 -29
  92. package/dist/_contracts/failure-class.js +0 -73
  93. package/dist/_contracts/http.d.ts +0 -135
  94. package/dist/_contracts/http.js +0 -434
  95. package/dist/_contracts/ids.d.ts +0 -66
  96. package/dist/_contracts/ids.js +0 -119
  97. package/dist/_contracts/index.d.ts +0 -42
  98. package/dist/_contracts/index.js +0 -52
  99. package/dist/_contracts/internal.d.ts +0 -55
  100. package/dist/_contracts/internal.js +0 -113
  101. package/dist/_contracts/models.d.ts +0 -30
  102. package/dist/_contracts/models.js +0 -28
  103. package/dist/_contracts/operation-core.d.ts +0 -36
  104. package/dist/_contracts/operation-core.js +0 -70
  105. package/dist/_contracts/operations.d.ts +0 -218
  106. package/dist/_contracts/operations.js +0 -1496
  107. package/dist/_contracts/otlp-projection.d.ts +0 -78
  108. package/dist/_contracts/otlp-projection.js +0 -171
  109. package/dist/_contracts/post-hook.d.ts +0 -31
  110. package/dist/_contracts/post-hook.js +0 -61
  111. package/dist/_contracts/provider-fault.d.ts +0 -34
  112. package/dist/_contracts/provider-fault.js +0 -68
  113. package/dist/_contracts/retry-core.d.ts +0 -29
  114. package/dist/_contracts/retry-core.js +0 -79
  115. package/dist/_contracts/runner-event.d.ts +0 -117
  116. package/dist/_contracts/runner-event.js +0 -172
  117. package/dist/_contracts/runtime-kind.d.ts +0 -60
  118. package/dist/_contracts/runtime-kind.js +0 -70
  119. package/dist/_contracts/runtime-manifest.d.ts +0 -121
  120. package/dist/_contracts/runtime-manifest.js +0 -83
  121. package/dist/_contracts/runtime-security-profile.d.ts +0 -26
  122. package/dist/_contracts/runtime-security-profile.js +0 -73
  123. package/dist/_contracts/runtime-sizes.d.ts +0 -104
  124. package/dist/_contracts/runtime-sizes.js +0 -111
  125. package/dist/_contracts/runtime-types.d.ts +0 -618
  126. package/dist/_contracts/runtime-types.js +0 -58
  127. package/dist/_contracts/schemas/asset-bundle.d.ts +0 -70
  128. package/dist/_contracts/schemas/asset-bundle.js +0 -107
  129. package/dist/_contracts/schemas/asset-ref.d.ts +0 -61
  130. package/dist/_contracts/schemas/asset-ref.js +0 -118
  131. package/dist/_contracts/schemas/bundle-manifest.d.ts +0 -66
  132. package/dist/_contracts/schemas/bundle-manifest.js +0 -77
  133. package/dist/_contracts/schemas/index.d.ts +0 -32
  134. package/dist/_contracts/schemas/index.js +0 -30
  135. package/dist/_contracts/schemas/mcp-server.d.ts +0 -99
  136. package/dist/_contracts/schemas/mcp-server.js +0 -209
  137. package/dist/_contracts/schemas/models.d.ts +0 -29
  138. package/dist/_contracts/schemas/models.js +0 -51
  139. package/dist/_contracts/schemas/numeric.d.ts +0 -18
  140. package/dist/_contracts/schemas/numeric.js +0 -28
  141. package/dist/_contracts/schemas/post-hook.d.ts +0 -45
  142. package/dist/_contracts/schemas/post-hook.js +0 -68
  143. package/dist/_contracts/schemas/response-assets.d.ts +0 -75
  144. package/dist/_contracts/schemas/response-assets.js +0 -81
  145. package/dist/_contracts/schemas/response-billing.d.ts +0 -208
  146. package/dist/_contracts/schemas/response-billing.js +0 -139
  147. package/dist/_contracts/schemas/response-common.d.ts +0 -132
  148. package/dist/_contracts/schemas/response-common.js +0 -162
  149. package/dist/_contracts/schemas/response-identity.d.ts +0 -648
  150. package/dist/_contracts/schemas/response-identity.js +0 -131
  151. package/dist/_contracts/schemas/response-mcp-servers.d.ts +0 -51
  152. package/dist/_contracts/schemas/response-mcp-servers.js +0 -32
  153. package/dist/_contracts/schemas/response-secrets.d.ts +0 -50
  154. package/dist/_contracts/schemas/response-secrets.js +0 -32
  155. package/dist/_contracts/schemas/response-sessions-internal.d.ts +0 -200
  156. package/dist/_contracts/schemas/response-sessions-internal.js +0 -142
  157. package/dist/_contracts/schemas/response-sessions.d.ts +0 -1598
  158. package/dist/_contracts/schemas/response-sessions.js +0 -377
  159. package/dist/_contracts/schemas/response-webhooks.d.ts +0 -76
  160. package/dist/_contracts/schemas/response-webhooks.js +0 -42
  161. package/dist/_contracts/schemas/response-workspace.d.ts +0 -225
  162. package/dist/_contracts/schemas/response-workspace.js +0 -99
  163. package/dist/_contracts/schemas/runtime-kind.d.ts +0 -31
  164. package/dist/_contracts/schemas/runtime-kind.js +0 -29
  165. package/dist/_contracts/schemas/runtime-security-profile.d.ts +0 -28
  166. package/dist/_contracts/schemas/runtime-security-profile.js +0 -26
  167. package/dist/_contracts/schemas/runtime-sizes.d.ts +0 -70
  168. package/dist/_contracts/schemas/runtime-sizes.js +0 -127
  169. package/dist/_contracts/schemas/session-limits.d.ts +0 -34
  170. package/dist/_contracts/schemas/session-limits.js +0 -39
  171. package/dist/_contracts/schemas/session-machine.d.ts +0 -23
  172. package/dist/_contracts/schemas/session-machine.js +0 -24
  173. package/dist/_contracts/schemas/session-request-config.d.ts +0 -58
  174. package/dist/_contracts/schemas/session-request-config.js +0 -134
  175. package/dist/_contracts/schemas/session-webhook.d.ts +0 -11
  176. package/dist/_contracts/schemas/session-webhook.js +0 -38
  177. package/dist/_contracts/schemas/side-effect-audit.d.ts +0 -98
  178. package/dist/_contracts/schemas/side-effect-audit.js +0 -102
  179. package/dist/_contracts/schemas/submission-assets.d.ts +0 -117
  180. package/dist/_contracts/schemas/submission-assets.js +0 -147
  181. package/dist/_contracts/schemas/submission-body.d.ts +0 -251
  182. package/dist/_contracts/schemas/submission-body.js +0 -378
  183. package/dist/_contracts/schemas/submission-environment.d.ts +0 -79
  184. package/dist/_contracts/schemas/submission-environment.js +0 -179
  185. package/dist/_contracts/schemas/submission-request.d.ts +0 -158
  186. package/dist/_contracts/schemas/submission-request.js +0 -49
  187. package/dist/_contracts/schemas/submission-secrets.d.ts +0 -47
  188. package/dist/_contracts/schemas/submission-secrets.js +0 -108
  189. package/dist/_contracts/schemas/wire.d.ts +0 -118
  190. package/dist/_contracts/schemas/wire.js +0 -171
  191. package/dist/_contracts/schemas/workspace-resources.d.ts +0 -50
  192. package/dist/_contracts/schemas/workspace-resources.js +0 -87
  193. package/dist/_contracts/sdk-errors.d.ts +0 -212
  194. package/dist/_contracts/sdk-errors.js +0 -313
  195. package/dist/_contracts/sdk-secrets.d.ts +0 -67
  196. package/dist/_contracts/sdk-secrets.js +0 -427
  197. package/dist/_contracts/session-archive.d.ts +0 -16
  198. package/dist/_contracts/session-archive.js +0 -92
  199. package/dist/_contracts/session-artifacts.d.ts +0 -189
  200. package/dist/_contracts/session-artifacts.js +0 -264
  201. package/dist/_contracts/session-config.d.ts +0 -373
  202. package/dist/_contracts/session-config.js +0 -562
  203. package/dist/_contracts/session-cost-types.d.ts +0 -211
  204. package/dist/_contracts/session-cost-types.js +0 -69
  205. package/dist/_contracts/session-cost.d.ts +0 -8
  206. package/dist/_contracts/session-cost.js +0 -582
  207. package/dist/_contracts/session-custody.d.ts +0 -165
  208. package/dist/_contracts/session-custody.js +0 -345
  209. package/dist/_contracts/session-file-query.d.ts +0 -14
  210. package/dist/_contracts/session-file-query.js +0 -178
  211. package/dist/_contracts/session-record.d.ts +0 -112
  212. package/dist/_contracts/session-record.js +0 -165
  213. package/dist/_contracts/session-retention.d.ts +0 -201
  214. package/dist/_contracts/session-retention.js +0 -450
  215. package/dist/_contracts/side-effect-audit.d.ts +0 -126
  216. package/dist/_contracts/side-effect-audit.js +0 -520
  217. package/dist/_contracts/sse.d.ts +0 -74
  218. package/dist/_contracts/sse.js +0 -227
  219. package/dist/_contracts/stable.d.ts +0 -45
  220. package/dist/_contracts/stable.js +0 -62
  221. package/dist/_contracts/status.d.ts +0 -25
  222. package/dist/_contracts/status.js +0 -57
  223. package/dist/_contracts/submission-limits.d.ts +0 -61
  224. package/dist/_contracts/submission-limits.js +0 -60
  225. package/dist/_contracts/submission.d.ts +0 -547
  226. package/dist/_contracts/submission.js +0 -812
  227. package/dist/_contracts/suggest.d.ts +0 -15
  228. package/dist/_contracts/suggest.js +0 -53
  229. package/dist/_contracts/testing/response-bindings.d.ts +0 -45
  230. package/dist/_contracts/testing/response-bindings.js +0 -256
  231. package/dist/_contracts/testing/wire-conformance-entry.d.ts +0 -10
  232. package/dist/_contracts/testing/wire-conformance-entry.js +0 -8
  233. package/dist/_contracts/testing/wire-conformance.d.ts +0 -169
  234. package/dist/_contracts/testing/wire-conformance.js +0 -276
  235. package/dist/_contracts/turn-trace.d.ts +0 -28
  236. package/dist/_contracts/turn-trace.js +0 -1
  237. package/dist/_contracts/unknown-field-error.d.ts +0 -13
  238. package/dist/_contracts/unknown-field-error.js +0 -21
  239. package/dist/_contracts/value-guards.d.ts +0 -20
  240. package/dist/_contracts/value-guards.js +0 -34
  241. package/dist/_contracts/webhook-verify.d.ts +0 -34
  242. package/dist/_contracts/webhook-verify.js +0 -93
  243. package/dist/_contracts/wire-observer.d.ts +0 -49
  244. package/dist/_contracts/wire-observer.js +0 -34
  245. package/dist/_contracts/workflow-status.d.ts +0 -7
  246. package/dist/_contracts/workflow-status.js +0 -43
  247. package/dist/_contracts/workspace-resources.d.ts +0 -98
  248. package/dist/_contracts/workspace-resources.js +0 -39
  249. package/dist/archive-limits.d.ts +0 -1
  250. package/dist/archive-limits.js +0 -2
  251. package/dist/archive-limits.js.map +0 -1
  252. package/dist/asset-upload.d.ts +0 -47
  253. package/dist/asset-upload.js +0 -269
  254. package/dist/asset-upload.js.map +0 -1
  255. package/dist/bundle.d.ts +0 -9
  256. package/dist/bundle.js +0 -20
  257. package/dist/bundle.js.map +0 -1
  258. package/dist/canonical-zip.d.ts +0 -68
  259. package/dist/canonical-zip.js +0 -355
  260. package/dist/canonical-zip.js.map +0 -1
  261. package/dist/cli.mjs +0 -12048
  262. package/dist/cli.mjs.sha256 +0 -1
  263. package/dist/client-types.d.ts +0 -192
  264. package/dist/client-types.js +0 -2
  265. package/dist/client-types.js.map +0 -1
  266. package/dist/client.d.ts +0 -464
  267. package/dist/client.js +0 -1207
  268. package/dist/client.js.map +0 -1
  269. package/dist/event-projection.d.ts +0 -22
  270. package/dist/event-projection.js +0 -380
  271. package/dist/event-projection.js.map +0 -1
  272. package/dist/fetch-archive.d.ts +0 -16
  273. package/dist/fetch-archive.js +0 -252
  274. package/dist/fetch-archive.js.map +0 -1
  275. package/dist/file.d.ts +0 -96
  276. package/dist/file.js +0 -272
  277. package/dist/file.js.map +0 -1
  278. package/dist/instructions.d.ts +0 -20
  279. package/dist/instructions.js +0 -40
  280. package/dist/instructions.js.map +0 -1
  281. package/dist/legacy-session-provider-fault.d.ts +0 -7
  282. package/dist/legacy-session-provider-fault.js +0 -38
  283. package/dist/legacy-session-provider-fault.js.map +0 -1
  284. package/dist/mcp-server.d.ts +0 -84
  285. package/dist/mcp-server.js +0 -117
  286. package/dist/mcp-server.js.map +0 -1
  287. package/dist/node-fs.d.ts +0 -29
  288. package/dist/node-fs.js +0 -19
  289. package/dist/node-fs.js.map +0 -1
  290. package/dist/node-walk.d.ts +0 -69
  291. package/dist/node-walk.js +0 -151
  292. package/dist/node-walk.js.map +0 -1
  293. package/dist/path-basename.d.ts +0 -5
  294. package/dist/path-basename.js +0 -9
  295. package/dist/path-basename.js.map +0 -1
  296. package/dist/retry.d.ts +0 -70
  297. package/dist/retry.js +0 -155
  298. package/dist/retry.js.map +0 -1
  299. package/dist/secret.d.ts +0 -65
  300. package/dist/secret.js +0 -110
  301. package/dist/secret.js.map +0 -1
  302. package/dist/session-validate.d.ts +0 -100
  303. package/dist/session-validate.js +0 -303
  304. package/dist/session-validate.js.map +0 -1
  305. package/dist/skill.d.ts +0 -99
  306. package/dist/skill.js +0 -169
  307. package/dist/skill.js.map +0 -1
  308. package/dist/submission-wire.d.ts +0 -13
  309. package/dist/submission-wire.js +0 -69
  310. package/dist/submission-wire.js.map +0 -1
  311. package/dist/tool.d.ts +0 -41
  312. package/dist/tool.js +0 -76
  313. package/dist/tool.js.map +0 -1
  314. package/dist/version.d.ts +0 -9
  315. package/dist/version.js +0 -10
  316. package/dist/version.js.map +0 -1
  317. package/docs/authentication.md +0 -125
  318. package/docs/billing.md +0 -164
  319. package/docs/cleanup.md +0 -27
  320. package/docs/concepts/agent-tools.md +0 -47
  321. package/docs/concepts/composition.md +0 -60
  322. package/docs/concepts/providers-and-runtimes.md +0 -121
  323. package/docs/concepts/sessions.md +0 -51
  324. package/docs/concepts/subagents.md +0 -35
  325. package/docs/credentials.md +0 -116
  326. package/docs/defaults.md +0 -51
  327. package/docs/errors.md +0 -258
  328. package/docs/events.md +0 -143
  329. package/docs/files.md +0 -130
  330. package/docs/limits-and-quotas.md +0 -114
  331. package/docs/limits.md +0 -51
  332. package/docs/mcp.md +0 -47
  333. package/docs/networking.md +0 -114
  334. package/docs/provider-runtime-capabilities.md +0 -32
  335. package/docs/public-surface.json +0 -73
  336. package/docs/quickstart.md +0 -135
  337. package/docs/release.md +0 -44
  338. package/docs/retries.md +0 -108
  339. package/docs/secrets.md +0 -141
  340. package/docs/session-config.md +0 -51
  341. package/docs/session-record.md +0 -58
  342. package/docs/skills.md +0 -65
  343. package/docs/telemetry.md +0 -66
  344. package/docs/testing.md +0 -35
  345. package/docs/vision-skills.md +0 -94
  346. package/docs/webhooks.md +0 -143
@@ -1,225 +0,0 @@
1
- /**
2
- * Response schemas for the versioned `workspace.*` resource families and for the
3
- * GDPR workspace erase.
4
- *
5
- * The four resource kinds share one server projection (`publicResource`) plus a
6
- * per-kind metadata spread, so they are built here from one shared shape rather
7
- * than written out four times. The per-kind extras are exactly the whitelist the
8
- * publish path stores: `mountPath` for a file, `description` for a skill,
9
- * `description` + `entry` + `input_schema` for a tool, and nothing at all for an
10
- * instruction.
11
- *
12
- * Divergence from the declared types: `WorkspaceResourceRecordFields` declares
13
- * `updatedAt?`, and the server projection never emits one. It stays optional
14
- * here — our own published type permits it, so a deployment that starts sending
15
- * it is not drift.
16
- */
17
- import * as z from "zod/mini";
18
- export declare const WorkspaceFileRecordSchema: z.ZodMiniObject<{
19
- mountPath: z.ZodMiniString<string>;
20
- resourceId: z.ZodMiniString<string>;
21
- name: z.ZodMiniString<string>;
22
- version: z.ZodMiniNumberFormat;
23
- assetId: z.ZodMiniString<string>;
24
- contentHash: z.ZodMiniString<string>;
25
- sizeBytes: z.ZodMiniNumberFormat;
26
- contentType: z.ZodMiniString<string>;
27
- createdAt: z.ZodMiniString<string>;
28
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
29
- kind: z.ZodMiniLiteral<"file">;
30
- }, z.core.$strict>;
31
- export declare const WorkspaceSkillRecordSchema: z.ZodMiniObject<{
32
- description: z.ZodMiniString<string>;
33
- resourceId: z.ZodMiniString<string>;
34
- name: z.ZodMiniString<string>;
35
- version: z.ZodMiniNumberFormat;
36
- assetId: z.ZodMiniString<string>;
37
- contentHash: z.ZodMiniString<string>;
38
- sizeBytes: z.ZodMiniNumberFormat;
39
- contentType: z.ZodMiniString<string>;
40
- createdAt: z.ZodMiniString<string>;
41
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
42
- kind: z.ZodMiniLiteral<"skill">;
43
- }, z.core.$strict>;
44
- export declare const WorkspaceToolRecordSchema: z.ZodMiniObject<{
45
- description: z.ZodMiniString<string>;
46
- entry: z.ZodMiniString<string>;
47
- input_schema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
48
- resourceId: z.ZodMiniString<string>;
49
- name: z.ZodMiniString<string>;
50
- version: z.ZodMiniNumberFormat;
51
- assetId: z.ZodMiniString<string>;
52
- contentHash: z.ZodMiniString<string>;
53
- sizeBytes: z.ZodMiniNumberFormat;
54
- contentType: z.ZodMiniString<string>;
55
- createdAt: z.ZodMiniString<string>;
56
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
57
- kind: z.ZodMiniLiteral<"tool">;
58
- }, z.core.$strict>;
59
- export declare const WorkspaceInstructionRecordSchema: z.ZodMiniObject<{
60
- resourceId: z.ZodMiniString<string>;
61
- name: z.ZodMiniString<string>;
62
- version: z.ZodMiniNumberFormat;
63
- assetId: z.ZodMiniString<string>;
64
- contentHash: z.ZodMiniString<string>;
65
- sizeBytes: z.ZodMiniNumberFormat;
66
- contentType: z.ZodMiniString<string>;
67
- createdAt: z.ZodMiniString<string>;
68
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
69
- kind: z.ZodMiniLiteral<"instruction">;
70
- }, z.core.$strict>;
71
- export declare const WorkspaceFileResponseSchema: z.ZodMiniObject<{
72
- resource: z.ZodMiniObject<{
73
- mountPath: z.ZodMiniString<string>;
74
- resourceId: z.ZodMiniString<string>;
75
- name: z.ZodMiniString<string>;
76
- version: z.ZodMiniNumberFormat;
77
- assetId: z.ZodMiniString<string>;
78
- contentHash: z.ZodMiniString<string>;
79
- sizeBytes: z.ZodMiniNumberFormat;
80
- contentType: z.ZodMiniString<string>;
81
- createdAt: z.ZodMiniString<string>;
82
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
83
- kind: z.ZodMiniLiteral<"file">;
84
- }, z.core.$strict>;
85
- }, z.core.$strict>;
86
- export declare const WorkspaceSkillResponseSchema: z.ZodMiniObject<{
87
- resource: z.ZodMiniObject<{
88
- description: z.ZodMiniString<string>;
89
- resourceId: z.ZodMiniString<string>;
90
- name: z.ZodMiniString<string>;
91
- version: z.ZodMiniNumberFormat;
92
- assetId: z.ZodMiniString<string>;
93
- contentHash: z.ZodMiniString<string>;
94
- sizeBytes: z.ZodMiniNumberFormat;
95
- contentType: z.ZodMiniString<string>;
96
- createdAt: z.ZodMiniString<string>;
97
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
98
- kind: z.ZodMiniLiteral<"skill">;
99
- }, z.core.$strict>;
100
- }, z.core.$strict>;
101
- export declare const WorkspaceToolResponseSchema: z.ZodMiniObject<{
102
- resource: z.ZodMiniObject<{
103
- description: z.ZodMiniString<string>;
104
- entry: z.ZodMiniString<string>;
105
- input_schema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
106
- resourceId: z.ZodMiniString<string>;
107
- name: z.ZodMiniString<string>;
108
- version: z.ZodMiniNumberFormat;
109
- assetId: z.ZodMiniString<string>;
110
- contentHash: z.ZodMiniString<string>;
111
- sizeBytes: z.ZodMiniNumberFormat;
112
- contentType: z.ZodMiniString<string>;
113
- createdAt: z.ZodMiniString<string>;
114
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
115
- kind: z.ZodMiniLiteral<"tool">;
116
- }, z.core.$strict>;
117
- }, z.core.$strict>;
118
- export declare const WorkspaceInstructionResponseSchema: z.ZodMiniObject<{
119
- resource: z.ZodMiniObject<{
120
- resourceId: z.ZodMiniString<string>;
121
- name: z.ZodMiniString<string>;
122
- version: z.ZodMiniNumberFormat;
123
- assetId: z.ZodMiniString<string>;
124
- contentHash: z.ZodMiniString<string>;
125
- sizeBytes: z.ZodMiniNumberFormat;
126
- contentType: z.ZodMiniString<string>;
127
- createdAt: z.ZodMiniString<string>;
128
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
129
- kind: z.ZodMiniLiteral<"instruction">;
130
- }, z.core.$strict>;
131
- }, z.core.$strict>;
132
- export declare const WorkspaceFilePageResponseSchema: z.ZodMiniObject<{
133
- resources: z.ZodMiniArray<z.ZodMiniObject<{
134
- mountPath: z.ZodMiniString<string>;
135
- resourceId: z.ZodMiniString<string>;
136
- name: z.ZodMiniString<string>;
137
- version: z.ZodMiniNumberFormat;
138
- assetId: z.ZodMiniString<string>;
139
- contentHash: z.ZodMiniString<string>;
140
- sizeBytes: z.ZodMiniNumberFormat;
141
- contentType: z.ZodMiniString<string>;
142
- createdAt: z.ZodMiniString<string>;
143
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
144
- kind: z.ZodMiniLiteral<"file">;
145
- }, z.core.$strict>>;
146
- nextCursor: z.ZodMiniOptional<z.ZodMiniString<string>>;
147
- }, z.core.$strict>;
148
- export declare const WorkspaceSkillPageResponseSchema: z.ZodMiniObject<{
149
- resources: z.ZodMiniArray<z.ZodMiniObject<{
150
- description: z.ZodMiniString<string>;
151
- resourceId: z.ZodMiniString<string>;
152
- name: z.ZodMiniString<string>;
153
- version: z.ZodMiniNumberFormat;
154
- assetId: z.ZodMiniString<string>;
155
- contentHash: z.ZodMiniString<string>;
156
- sizeBytes: z.ZodMiniNumberFormat;
157
- contentType: z.ZodMiniString<string>;
158
- createdAt: z.ZodMiniString<string>;
159
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
160
- kind: z.ZodMiniLiteral<"skill">;
161
- }, z.core.$strict>>;
162
- nextCursor: z.ZodMiniOptional<z.ZodMiniString<string>>;
163
- }, z.core.$strict>;
164
- export declare const WorkspaceToolPageResponseSchema: z.ZodMiniObject<{
165
- resources: z.ZodMiniArray<z.ZodMiniObject<{
166
- description: z.ZodMiniString<string>;
167
- entry: z.ZodMiniString<string>;
168
- input_schema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
169
- resourceId: z.ZodMiniString<string>;
170
- name: z.ZodMiniString<string>;
171
- version: z.ZodMiniNumberFormat;
172
- assetId: z.ZodMiniString<string>;
173
- contentHash: z.ZodMiniString<string>;
174
- sizeBytes: z.ZodMiniNumberFormat;
175
- contentType: z.ZodMiniString<string>;
176
- createdAt: z.ZodMiniString<string>;
177
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
178
- kind: z.ZodMiniLiteral<"tool">;
179
- }, z.core.$strict>>;
180
- nextCursor: z.ZodMiniOptional<z.ZodMiniString<string>>;
181
- }, z.core.$strict>;
182
- export declare const WorkspaceInstructionPageResponseSchema: z.ZodMiniObject<{
183
- resources: z.ZodMiniArray<z.ZodMiniObject<{
184
- resourceId: z.ZodMiniString<string>;
185
- name: z.ZodMiniString<string>;
186
- version: z.ZodMiniNumberFormat;
187
- assetId: z.ZodMiniString<string>;
188
- contentHash: z.ZodMiniString<string>;
189
- sizeBytes: z.ZodMiniNumberFormat;
190
- contentType: z.ZodMiniString<string>;
191
- createdAt: z.ZodMiniString<string>;
192
- updatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
193
- kind: z.ZodMiniLiteral<"instruction">;
194
- }, z.core.$strict>>;
195
- nextCursor: z.ZodMiniOptional<z.ZodMiniString<string>>;
196
- }, z.core.$strict>;
197
- /**
198
- * `DELETE /workspaces/{workspaceId}` — the owner's GDPR hard-erase.
199
- *
200
- * A 200 with counters, not a 204, and idempotent: erasing an absent workspace
201
- * answers 200 with every counter at zero, indistinguishable from erasing an
202
- * empty one.
203
- *
204
- * This response had no declared client type — `deleteWorkspace()` in
205
- * `operations.ts` targets the CONTROL plane's `DELETE /api/workspaces/{id}` and
206
- * returns `void`. Same method, same path pattern, different plane; see the
207
- * plane-collision note in `testing/response-bindings.ts`. `WorkspaceEraseResult`
208
- * in `runtime-types.ts` is now `z.infer`red from the schema below, and names the
209
- * distinction so the two routes are no longer one undifferentiated `void`.
210
- *
211
- * `workspaceId` here is the RAW id, not the public `wsp_<hex>` form `whoami` and
212
- * the MCP-server records carry.
213
- */
214
- export declare const WorkspaceEraseResponseSchema: z.ZodMiniObject<{
215
- ok: z.ZodMiniLiteral<true>;
216
- workspaceId: z.ZodMiniString<string>;
217
- erased: z.ZodMiniObject<{
218
- workspaceId: z.ZodMiniString<string>;
219
- sessionsErased: z.ZodMiniNumberFormat;
220
- deletedObjects: z.ZodMiniNumberFormat;
221
- deletedConnections: z.ZodMiniNumberFormat;
222
- deletedEgressRows: z.ZodMiniNumberFormat;
223
- deletedEgressPolicies: z.ZodMiniNumberFormat;
224
- }, z.core.$strict>;
225
- }, z.core.$strict>;
@@ -1,99 +0,0 @@
1
- /**
2
- * Response schemas for the versioned `workspace.*` resource families and for the
3
- * GDPR workspace erase.
4
- *
5
- * The four resource kinds share one server projection (`publicResource`) plus a
6
- * per-kind metadata spread, so they are built here from one shared shape rather
7
- * than written out four times. The per-kind extras are exactly the whitelist the
8
- * publish path stores: `mountPath` for a file, `description` for a skill,
9
- * `description` + `entry` + `input_schema` for a tool, and nothing at all for an
10
- * instruction.
11
- *
12
- * Divergence from the declared types: `WorkspaceResourceRecordFields` declares
13
- * `updatedAt?`, and the server projection never emits one. It stays optional
14
- * here — our own published type permits it, so a deployment that starts sending
15
- * it is not drift.
16
- */
17
- import * as z from "zod/mini";
18
- import { describeResponse, responseObject, wireLiteral, wireNonEmptyString, wireNonNegativeInteger, wirePositiveInteger, wireString } from "./response-common.js";
19
- const optional = z.optional;
20
- /** The nine keys every workspace resource record carries, whatever its kind. */
21
- const commonResourceShape = {
22
- resourceId: wireNonEmptyString,
23
- name: wireNonEmptyString,
24
- version: wirePositiveInteger,
25
- assetId: wireNonEmptyString,
26
- contentHash: wireNonEmptyString,
27
- sizeBytes: wireNonNegativeInteger,
28
- contentType: wireString,
29
- createdAt: wireNonEmptyString,
30
- updatedAt: optional(wireString)
31
- };
32
- export const WorkspaceFileRecordSchema = describeResponse("WorkspaceFileRecord", "An immutable published workspace file version, addressed by asset bytes.", responseObject({
33
- kind: wireLiteral("file"),
34
- ...commonResourceShape,
35
- mountPath: wireNonEmptyString
36
- }));
37
- export const WorkspaceSkillRecordSchema = describeResponse("WorkspaceSkillRecord", "An immutable published workspace skill version.", responseObject({
38
- kind: wireLiteral("skill"),
39
- ...commonResourceShape,
40
- description: wireNonEmptyString
41
- }));
42
- export const WorkspaceToolRecordSchema = describeResponse("WorkspaceToolRecord", "An immutable published workspace tool version. `input_schema` is the " +
43
- "provider-visible JSON Schema object, carried opaquely.", responseObject({
44
- kind: wireLiteral("tool"),
45
- ...commonResourceShape,
46
- description: wireNonEmptyString,
47
- entry: wireNonEmptyString,
48
- input_schema: z.record(wireString, z.unknown())
49
- }));
50
- export const WorkspaceInstructionRecordSchema = describeResponse("WorkspaceInstructionRecord", "An immutable published workspace instruction version. No per-kind extras.", responseObject({
51
- kind: wireLiteral("instruction"),
52
- ...commonResourceShape
53
- }));
54
- function singleResource(record) {
55
- return responseObject({ resource: record });
56
- }
57
- function resourcePage(record) {
58
- return responseObject({
59
- resources: z.array(record),
60
- nextCursor: optional(wireNonEmptyString)
61
- });
62
- }
63
- export const WorkspaceFileResponseSchema = describeResponse("WorkspaceFileResponse", "One published workspace file version.", singleResource(WorkspaceFileRecordSchema));
64
- export const WorkspaceSkillResponseSchema = describeResponse("WorkspaceSkillResponse", "One published workspace skill version.", singleResource(WorkspaceSkillRecordSchema));
65
- export const WorkspaceToolResponseSchema = describeResponse("WorkspaceToolResponse", "One published workspace tool version.", singleResource(WorkspaceToolRecordSchema));
66
- export const WorkspaceInstructionResponseSchema = describeResponse("WorkspaceInstructionResponse", "One published workspace instruction version.", singleResource(WorkspaceInstructionRecordSchema));
67
- export const WorkspaceFilePageResponseSchema = describeResponse("WorkspaceFilePageResponse", "One page of workspace files, ordered by name. `nextCursor` is omitted on the last page.", resourcePage(WorkspaceFileRecordSchema));
68
- export const WorkspaceSkillPageResponseSchema = describeResponse("WorkspaceSkillPageResponse", "One page of workspace skills, ordered by name.", resourcePage(WorkspaceSkillRecordSchema));
69
- export const WorkspaceToolPageResponseSchema = describeResponse("WorkspaceToolPageResponse", "One page of workspace tools, ordered by name.", resourcePage(WorkspaceToolRecordSchema));
70
- export const WorkspaceInstructionPageResponseSchema = describeResponse("WorkspaceInstructionPageResponse", "One page of workspace instructions, ordered by name.", resourcePage(WorkspaceInstructionRecordSchema));
71
- /**
72
- * `DELETE /workspaces/{workspaceId}` — the owner's GDPR hard-erase.
73
- *
74
- * A 200 with counters, not a 204, and idempotent: erasing an absent workspace
75
- * answers 200 with every counter at zero, indistinguishable from erasing an
76
- * empty one.
77
- *
78
- * This response had no declared client type — `deleteWorkspace()` in
79
- * `operations.ts` targets the CONTROL plane's `DELETE /api/workspaces/{id}` and
80
- * returns `void`. Same method, same path pattern, different plane; see the
81
- * plane-collision note in `testing/response-bindings.ts`. `WorkspaceEraseResult`
82
- * in `runtime-types.ts` is now `z.infer`red from the schema below, and names the
83
- * distinction so the two routes are no longer one undifferentiated `void`.
84
- *
85
- * `workspaceId` here is the RAW id, not the public `wsp_<hex>` form `whoami` and
86
- * the MCP-server records carry.
87
- */
88
- export const WorkspaceEraseResponseSchema = describeResponse("WorkspaceEraseResponse", "Counters from a workspace hard-erase. Idempotent: all zero when nothing was there.", responseObject({
89
- ok: wireLiteral(true),
90
- workspaceId: wireNonEmptyString,
91
- erased: responseObject({
92
- workspaceId: wireNonEmptyString,
93
- sessionsErased: wireNonNegativeInteger,
94
- deletedObjects: wireNonNegativeInteger,
95
- deletedConnections: wireNonNegativeInteger,
96
- deletedEgressRows: wireNonNegativeInteger,
97
- deletedEgressPolicies: wireNonNegativeInteger
98
- })
99
- }));
@@ -1,31 +0,0 @@
1
- /**
2
- * Schema for the managed execution-runtime selector.
3
- *
4
- * The token set lives here rather than beside the product documentation in
5
- * `runtime-kind.ts` for one reason: the schema and the vocabulary must be the
6
- * same statement. A schema built from a list declared elsewhere would have to
7
- * import it, and `runtime-kind.ts` already imports this module — a cycle whose
8
- * evaluation order decides whether the enum sees an initialised list or a
9
- * temporal-dead-zone error. Declaring the tokens where the schema is built
10
- * removes the question; `runtime-kind.ts` re-exports them unchanged.
11
- */
12
- import * as z from "zod/mini";
13
- /** The accepted execution-runtime values (the wire/CLI tokens). */
14
- export declare const RUNTIME_KINDS: readonly ["container", "spot_container", "lambda"];
15
- /**
16
- * Wire shape of `runtimeKind`.
17
- *
18
- * Omission is the caller's signal to take {@link import("../runtime-kind.js").DEFAULT_RUNTIME_KIND},
19
- * and it is handled by `parseRuntimeKind` rather than by an `optional()` here:
20
- * the field is required once present, and a defaulted schema would describe a
21
- * value the wire never carries.
22
- *
23
- * One diagnostic covers every rejection — wrong type, wrong case, unknown token
24
- * — because that is the only distinction a caller can act on: the message names
25
- * the whole menu.
26
- */
27
- export declare const RuntimeKindSchema: z.ZodMiniEnum<{
28
- container: "container";
29
- spot_container: "spot_container";
30
- lambda: "lambda";
31
- }>;
@@ -1,29 +0,0 @@
1
- /**
2
- * Schema for the managed execution-runtime selector.
3
- *
4
- * The token set lives here rather than beside the product documentation in
5
- * `runtime-kind.ts` for one reason: the schema and the vocabulary must be the
6
- * same statement. A schema built from a list declared elsewhere would have to
7
- * import it, and `runtime-kind.ts` already imports this module — a cycle whose
8
- * evaluation order decides whether the enum sees an initialised list or a
9
- * temporal-dead-zone error. Declaring the tokens where the schema is built
10
- * removes the question; `runtime-kind.ts` re-exports them unchanged.
11
- */
12
- import * as z from "zod/mini";
13
- /** The accepted execution-runtime values (the wire/CLI tokens). */
14
- export const RUNTIME_KINDS = ["container", "spot_container", "lambda"];
15
- /**
16
- * Wire shape of `runtimeKind`.
17
- *
18
- * Omission is the caller's signal to take {@link import("../runtime-kind.js").DEFAULT_RUNTIME_KIND},
19
- * and it is handled by `parseRuntimeKind` rather than by an `optional()` here:
20
- * the field is required once present, and a defaulted schema would describe a
21
- * value the wire never carries.
22
- *
23
- * One diagnostic covers every rejection — wrong type, wrong case, unknown token
24
- * — because that is the only distinction a caller can act on: the message names
25
- * the whole menu.
26
- */
27
- export const RuntimeKindSchema = z.enum(RUNTIME_KINDS, {
28
- error: (issue) => `runtimeKind must be one of: ${RUNTIME_KINDS.join(", ")} (got ${JSON.stringify(issue.input)})`
29
- });
@@ -1,28 +0,0 @@
1
- /**
2
- * Schema for the per-submission security-profile selector.
3
- *
4
- * Vocabulary only. What each profile permits — open networking, runtime package
5
- * installs, customer env vars, MCP servers — is policy evaluated against a
6
- * submission by `evaluateRuntimeSecurityProfile`, and must not migrate here: a
7
- * schema that enforced policy would reject a submission for reasons the wire
8
- * shape cannot express.
9
- *
10
- * The token set is declared here, next to the schema built from it, and
11
- * re-exported by `runtime-security-profile.ts` — see the sibling note in
12
- * `runtime-kind.ts` for why the constant cannot live on the parser side.
13
- */
14
- import * as z from "zod/mini";
15
- /** The accepted security-profile values (the wire tokens). */
16
- export declare const RUNTIME_SECURITY_PROFILES: readonly ["strict", "standard", "developer"];
17
- /**
18
- * Wire shape of `securityProfile`.
19
- *
20
- * Omission (and, for back-compat with records that spelled "unset" as `null`,
21
- * an explicit null) is handled by `parseRuntimeSecurityProfile`, which resolves
22
- * it to the `standard` policy rather than to a wire value.
23
- */
24
- export declare const RuntimeSecurityProfileSchema: z.ZodMiniEnum<{
25
- strict: "strict";
26
- standard: "standard";
27
- developer: "developer";
28
- }>;
@@ -1,26 +0,0 @@
1
- /**
2
- * Schema for the per-submission security-profile selector.
3
- *
4
- * Vocabulary only. What each profile permits — open networking, runtime package
5
- * installs, customer env vars, MCP servers — is policy evaluated against a
6
- * submission by `evaluateRuntimeSecurityProfile`, and must not migrate here: a
7
- * schema that enforced policy would reject a submission for reasons the wire
8
- * shape cannot express.
9
- *
10
- * The token set is declared here, next to the schema built from it, and
11
- * re-exported by `runtime-security-profile.ts` — see the sibling note in
12
- * `runtime-kind.ts` for why the constant cannot live on the parser side.
13
- */
14
- import * as z from "zod/mini";
15
- /** The accepted security-profile values (the wire tokens). */
16
- export const RUNTIME_SECURITY_PROFILES = ["strict", "standard", "developer"];
17
- /**
18
- * Wire shape of `securityProfile`.
19
- *
20
- * Omission (and, for back-compat with records that spelled "unset" as `null`,
21
- * an explicit null) is handled by `parseRuntimeSecurityProfile`, which resolves
22
- * it to the `standard` policy rather than to a wire value.
23
- */
24
- export const RuntimeSecurityProfileSchema = z.enum(RUNTIME_SECURITY_PROFILES, {
25
- error: (issue) => `securityProfile must be one of: ${RUNTIME_SECURITY_PROFILES.join(", ")} (got ${JSON.stringify(issue.input)})`
26
- });
@@ -1,70 +0,0 @@
1
- /**
2
- * Schemas for the two sizing-and-lifetime fields a session carries: the
3
- * `runtimeSize` preset token and the `timeout` duration string.
4
- *
5
- * The preset tokens and the accepted-timeout bounds are declared here because
6
- * they are what the schemas assert; `runtime-sizes.ts` imports this module and
7
- * re-exports them, so declaring them there instead would be a cycle whose
8
- * evaluation order decides between an initialised constant and a
9
- * temporal-dead-zone error. The resource table each token maps to
10
- * (`RUNTIME_SIZE_PRESETS`) stays on the product side and is proved exhaustive
11
- * against these tokens at compile time.
12
- */
13
- import * as z from "zod/mini";
14
- /** The accepted runtime-size values (the wire/CLI tokens), ordered as offered. */
15
- export declare const RUNTIME_SIZES: readonly ["0.25cpu-1gb", "0.5cpu-4gb", "1cpu-6gb", "2cpu-8gb", "4cpu-12gb"];
16
- /**
17
- * Wire shape of `runtimeSize`. Omission is handled by `parseRuntimeSize`, which
18
- * leaves the default to the consumer rather than landing one on the request.
19
- */
20
- export declare const RuntimeSizeSchema: z.ZodMiniEnum<{
21
- "0.25cpu-1gb": "0.25cpu-1gb";
22
- "0.5cpu-4gb": "0.5cpu-4gb";
23
- "1cpu-6gb": "1cpu-6gb";
24
- "2cpu-8gb": "2cpu-8gb";
25
- "4cpu-12gb": "4cpu-12gb";
26
- }>;
27
- /**
28
- * Hard ceiling for an explicitly supplied session deadline (8 hours).
29
- * This bounds accepted customer input and lifetime reasoning; it is not the
30
- * omission default (`DEFAULT_SESSION_TIMEOUT_MS`) even while both policies
31
- * currently resolve to eight hours. Bounds on accepted input belong to the
32
- * schema; the omission default is policy and stays with the resolver.
33
- */
34
- export declare const MAX_SESSION_TIMEOUT_MS: number;
35
- /** Floor on a session deadline (1 minute). */
36
- export declare const MIN_SESSION_TIMEOUT_MS: number;
37
- /**
38
- * A human duration string (`"1h"`, `"90m"`, `"3600s"`, `"500ms"`, or a bare-ms
39
- * integer).
40
- *
41
- * Grammar and magnitude are two checks, not one, because they fail for
42
- * different reasons and say so: a string that does not match the grammar at all
43
- * is malformed, while one that matches but names a magnitude too large to be a
44
- * finite number is a number problem. Both abort so the first failure is the
45
- * reported one.
46
- */
47
- export declare const DurationSchema: z.ZodMiniString<string>;
48
- /**
49
- * Convert a validated duration string to whole milliseconds.
50
- *
51
- * Deliberately NOT a `.transform()` on {@link DurationSchema}: `z.toJSONSchema(s,
52
- * {io:"output"})` throws on any transform, which would make the response half of
53
- * the generated spec ungenerable (L1). Schemas validate; `normalize*()`
54
- * functions transform. Input is assumed to have passed {@link DurationSchema}.
55
- */
56
- export declare function normalizeDurationToMs(duration: string): number;
57
- /**
58
- * Wire shape of `timeout` — a duration string, rejected by type before the
59
- * grammar is consulted so a caller who sent a number learns that first.
60
- */
61
- export declare const SessionTimeoutSchema: z.ZodMiniString<string>;
62
- /**
63
- * The accepted window for a resolved session deadline.
64
- *
65
- * A bound on the decoded milliseconds rather than on the duration string, since
66
- * `"90m"` and `"5400000"` are the same deadline and must be judged the same
67
- * way. Invisible in the generated spec (L2) — a JSON Schema for a string cannot
68
- * state a bound on what the string decodes to — which is why it is named here.
69
- */
70
- export declare const SessionTimeoutMsSchema: z.ZodMiniNumber<number>;
@@ -1,127 +0,0 @@
1
- /**
2
- * Schemas for the two sizing-and-lifetime fields a session carries: the
3
- * `runtimeSize` preset token and the `timeout` duration string.
4
- *
5
- * The preset tokens and the accepted-timeout bounds are declared here because
6
- * they are what the schemas assert; `runtime-sizes.ts` imports this module and
7
- * re-exports them, so declaring them there instead would be a cycle whose
8
- * evaluation order decides between an initialised constant and a
9
- * temporal-dead-zone error. The resource table each token maps to
10
- * (`RUNTIME_SIZE_PRESETS`) stays on the product side and is proved exhaustive
11
- * against these tokens at compile time.
12
- */
13
- import * as z from "zod/mini";
14
- /** The accepted runtime-size values (the wire/CLI tokens), ordered as offered. */
15
- export const RUNTIME_SIZES = [
16
- "0.25cpu-1gb",
17
- "0.5cpu-4gb",
18
- "1cpu-6gb",
19
- "2cpu-8gb",
20
- "4cpu-12gb"
21
- ];
22
- /**
23
- * Wire shape of `runtimeSize`. Omission is handled by `parseRuntimeSize`, which
24
- * leaves the default to the consumer rather than landing one on the request.
25
- */
26
- export const RuntimeSizeSchema = z.enum(RUNTIME_SIZES, {
27
- error: (issue) => `runtimeSize must be one of: ${RUNTIME_SIZES.join(", ")} (got ${JSON.stringify(issue.input)})`
28
- });
29
- // ===========================================================================
30
- // Session timeout
31
- // ===========================================================================
32
- /**
33
- * Hard ceiling for an explicitly supplied session deadline (8 hours).
34
- * This bounds accepted customer input and lifetime reasoning; it is not the
35
- * omission default (`DEFAULT_SESSION_TIMEOUT_MS`) even while both policies
36
- * currently resolve to eight hours. Bounds on accepted input belong to the
37
- * schema; the omission default is policy and stays with the resolver.
38
- */
39
- export const MAX_SESSION_TIMEOUT_MS = 8 * 60 * 60 * 1000;
40
- /** Floor on a session deadline (1 minute). */
41
- export const MIN_SESSION_TIMEOUT_MS = 60 * 1000;
42
- /**
43
- * The duration grammar: a non-negative magnitude and an optional unit, where a
44
- * bare magnitude means milliseconds. Surrounding whitespace is tolerated.
45
- */
46
- const DURATION_PATTERN = /^(\d+(?:\.\d+)?)(ms|s|m|h)?$/;
47
- const UNIT_FACTOR_MS = { ms: 1, s: 1_000, m: 60_000, h: 3_600_000 };
48
- /**
49
- * The magnitude and unit factor a duration string names, or `undefined` when it
50
- * does not match the grammar. A bare magnitude means milliseconds.
51
- */
52
- function durationParts(value) {
53
- const match = DURATION_PATTERN.exec(value.trim());
54
- if (match === null) {
55
- return undefined;
56
- }
57
- return {
58
- magnitude: Number(match[1]),
59
- factorMs: UNIT_FACTOR_MS[(match[2] ?? "ms")]
60
- };
61
- }
62
- function malformed(input) {
63
- return `invalid duration ${JSON.stringify(input)} (expected e.g. "1h", "90m", "30s", "500ms", or a bare ms integer)`;
64
- }
65
- /**
66
- * A human duration string (`"1h"`, `"90m"`, `"3600s"`, `"500ms"`, or a bare-ms
67
- * integer).
68
- *
69
- * Grammar and magnitude are two checks, not one, because they fail for
70
- * different reasons and say so: a string that does not match the grammar at all
71
- * is malformed, while one that matches but names a magnitude too large to be a
72
- * finite number is a number problem. Both abort so the first failure is the
73
- * reported one.
74
- */
75
- export const DurationSchema = z
76
- .string({ error: (issue) => malformed(issue.input) })
77
- .check(z.refine((value) => durationParts(value) !== undefined, {
78
- error: (issue) => malformed(issue.input),
79
- abort: true
80
- }), z.refine((value) => {
81
- const parts = durationParts(value);
82
- return parts !== undefined && Number.isFinite(parts.magnitude) && parts.magnitude >= 0;
83
- }, {
84
- error: (issue) => `invalid duration ${JSON.stringify(issue.input)} (must be a non-negative number)`,
85
- abort: true
86
- }));
87
- /**
88
- * Convert a validated duration string to whole milliseconds.
89
- *
90
- * Deliberately NOT a `.transform()` on {@link DurationSchema}: `z.toJSONSchema(s,
91
- * {io:"output"})` throws on any transform, which would make the response half of
92
- * the generated spec ungenerable (L1). Schemas validate; `normalize*()`
93
- * functions transform. Input is assumed to have passed {@link DurationSchema}.
94
- */
95
- export function normalizeDurationToMs(duration) {
96
- const parts = durationParts(duration);
97
- if (parts === undefined) {
98
- // Unreachable through `parseDurationToMs`, which validates first. Raising
99
- // the schema's own wording rather than returning NaN keeps a direct caller
100
- // from propagating a silently bad number, and keeps one statement of the
101
- // message.
102
- throw new Error(malformed(duration));
103
- }
104
- return Math.round(parts.magnitude * parts.factorMs);
105
- }
106
- /**
107
- * Wire shape of `timeout` — a duration string, rejected by type before the
108
- * grammar is consulted so a caller who sent a number learns that first.
109
- */
110
- export const SessionTimeoutSchema = z.string({
111
- error: (issue) => `timeout must be a duration string (e.g. "1h", "30m"); got ${JSON.stringify(issue.input)}`
112
- });
113
- /**
114
- * The accepted window for a resolved session deadline.
115
- *
116
- * A bound on the decoded milliseconds rather than on the duration string, since
117
- * `"90m"` and `"5400000"` are the same deadline and must be judged the same
118
- * way. Invisible in the generated spec (L2) — a JSON Schema for a string cannot
119
- * state a bound on what the string decodes to — which is why it is named here.
120
- */
121
- export const SessionTimeoutMsSchema = z.number().check(z.refine((ms) => ms >= MIN_SESSION_TIMEOUT_MS, {
122
- error: (issue) => `timeout must be at least ${MIN_SESSION_TIMEOUT_MS}ms (1m); got ${issue.input}ms`,
123
- abort: true
124
- }), z.refine((ms) => ms <= MAX_SESSION_TIMEOUT_MS, {
125
- error: (issue) => `timeout must be at most ${MAX_SESSION_TIMEOUT_MS}ms (8h); got ${issue.input}ms`,
126
- abort: true
127
- }));