@spacefast/common 0.0.3 → 0.0.6

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 (159) hide show
  1. package/dist/agents/connect-targets.d.ts +133 -0
  2. package/dist/agents/connect-targets.js +224 -0
  3. package/dist/brand.d.ts +1 -0
  4. package/dist/brand.js +5 -0
  5. package/dist/config/domains.d.ts +12 -6
  6. package/dist/config/domains.js +30 -38
  7. package/dist/contracts/access.d.ts +829 -129
  8. package/dist/contracts/access.js +771 -148
  9. package/dist/contracts/activity.d.ts +5 -5
  10. package/dist/contracts/activity.js +28 -2
  11. package/dist/contracts/annotations.d.ts +3 -5
  12. package/dist/contracts/api-keys.d.ts +9 -10
  13. package/dist/contracts/api-keys.js +9 -6
  14. package/dist/contracts/archives.d.ts +22 -16
  15. package/dist/contracts/archives.js +11 -4
  16. package/dist/contracts/billing.d.ts +21 -30
  17. package/dist/contracts/builds.d.ts +21 -17
  18. package/dist/contracts/builds.js +12 -0
  19. package/dist/contracts/channels.d.ts +2 -2
  20. package/dist/contracts/common.d.ts +7 -5
  21. package/dist/contracts/common.js +4 -0
  22. package/dist/contracts/continuation.d.ts +63 -0
  23. package/dist/contracts/continuation.js +91 -0
  24. package/dist/contracts/countries.d.ts +2 -0
  25. package/dist/contracts/countries.js +261 -0
  26. package/dist/contracts/deployments.d.ts +34 -34
  27. package/dist/contracts/device-auth.d.ts +4 -11
  28. package/dist/contracts/device-auth.js +4 -0
  29. package/dist/contracts/docs.d.ts +119 -0
  30. package/dist/contracts/docs.js +51 -0
  31. package/dist/contracts/domains.d.ts +295 -253
  32. package/dist/contracts/domains.js +26 -4
  33. package/dist/contracts/enums.d.ts +17 -18
  34. package/dist/contracts/enums.js +25 -14
  35. package/dist/contracts/error-code-meta.d.ts +84 -0
  36. package/dist/contracts/error-code-meta.js +99 -10
  37. package/dist/contracts/error-codes.d.ts +1 -1
  38. package/dist/contracts/error-codes.js +17 -0
  39. package/dist/contracts/events.d.ts +13 -13
  40. package/dist/contracts/features.d.ts +93 -23
  41. package/dist/contracts/features.js +178 -13
  42. package/dist/contracts/git.d.ts +3 -9
  43. package/dist/contracts/ids.d.ts +5 -0
  44. package/dist/contracts/ids.js +5 -0
  45. package/dist/contracts/internal.d.ts +3 -3
  46. package/dist/contracts/mcp.d.ts +34 -36
  47. package/dist/contracts/me.d.ts +8 -8
  48. package/dist/contracts/me.js +1 -1
  49. package/dist/contracts/oauth-resources.d.ts +19 -8
  50. package/dist/contracts/oauth-resources.js +44 -13
  51. package/dist/contracts/operations.d.ts +2 -2
  52. package/dist/contracts/plan-policy.d.ts +4 -4
  53. package/dist/contracts/platform.d.ts +3 -105
  54. package/dist/contracts/platform.js +0 -50
  55. package/dist/contracts/push-new.d.ts +4 -4
  56. package/dist/contracts/quotas.d.ts +2 -0
  57. package/dist/contracts/quotas.js +8 -0
  58. package/dist/contracts/repository-connections.d.ts +1 -3
  59. package/dist/contracts/resources.d.ts +112 -28
  60. package/dist/contracts/resources.js +26 -2
  61. package/dist/contracts/routes.d.ts +0 -2
  62. package/dist/contracts/runtime-api.d.ts +365 -43
  63. package/dist/contracts/runtime-api.js +275 -6
  64. package/dist/contracts/sites.d.ts +45 -28
  65. package/dist/contracts/sites.js +21 -0
  66. package/dist/contracts/space-config.d.ts +201 -2
  67. package/dist/contracts/space-config.js +135 -5
  68. package/dist/contracts/spaces.d.ts +423 -162
  69. package/dist/contracts/spaces.js +94 -8
  70. package/dist/contracts/superadmin-emails.d.ts +7 -5
  71. package/dist/contracts/superadmin-emails.js +8 -0
  72. package/dist/contracts/superadmin-queues.d.ts +32 -32
  73. package/dist/contracts/superadmin-spaces.d.ts +418 -24
  74. package/dist/contracts/superadmin-spaces.js +24 -0
  75. package/dist/contracts/superadmin-tenants.d.ts +8 -8
  76. package/dist/contracts/superadmin.d.ts +17 -104
  77. package/dist/contracts/superadmin.js +6 -14
  78. package/dist/contracts/tags.d.ts +42 -41
  79. package/dist/contracts/tags.js +2 -1
  80. package/dist/contracts/teams.d.ts +40 -23
  81. package/dist/contracts/teams.js +20 -1
  82. package/dist/contracts/theme-json.d.ts +30 -0
  83. package/dist/contracts/theme-json.js +48 -0
  84. package/dist/contracts/transfers.d.ts +9 -9
  85. package/dist/contracts/variables.d.ts +14 -16
  86. package/dist/contracts/variables.js +0 -5
  87. package/dist/contracts/webhooks.d.ts +6 -4
  88. package/dist/contracts/webhooks.js +1 -1
  89. package/dist/contracts/zero.d.ts +13 -18
  90. package/dist/docs/agent-prose.d.ts +43 -3
  91. package/dist/docs/agent-prose.js +153 -10
  92. package/dist/docs/agent-setup.js +48 -15
  93. package/dist/docs/agent-solutions.d.ts +5 -5
  94. package/dist/docs/agent-solutions.js +2 -2
  95. package/dist/docs/catalog.d.ts +650 -0
  96. package/dist/docs/catalog.js +758 -0
  97. package/dist/docs/error-docs.d.ts +0 -2
  98. package/dist/docs/error-docs.js +89 -35
  99. package/dist/docs/index-build.d.ts +17 -0
  100. package/dist/docs/index-build.js +24 -0
  101. package/dist/docs/search.d.ts +54 -0
  102. package/dist/docs/search.js +96 -0
  103. package/dist/docs/skill-distribution.d.ts +5 -3
  104. package/dist/docs/skill-distribution.js +8 -8
  105. package/dist/utils/access-match.d.ts +39 -0
  106. package/dist/utils/access-match.js +296 -0
  107. package/dist/utils/auth-redirect.d.ts +3 -1
  108. package/dist/utils/auth-redirect.js +21 -1
  109. package/dist/utils/build-settings.d.ts +6 -0
  110. package/dist/utils/build-settings.js +429 -46
  111. package/dist/utils/claim-token.d.ts +8 -0
  112. package/dist/utils/claim-token.js +23 -2
  113. package/dist/utils/content-type.d.ts +1 -0
  114. package/dist/utils/content-type.js +1 -1
  115. package/dist/utils/credential-policy.d.ts +54 -0
  116. package/dist/utils/{access-policy.js → credential-policy.js} +28 -2
  117. package/dist/utils/gate-theme.d.ts +61 -0
  118. package/dist/utils/gate-theme.js +217 -0
  119. package/dist/utils/git-repository.d.ts +0 -1
  120. package/dist/utils/git-repository.js +0 -3
  121. package/dist/utils/id-hints.d.ts +8 -0
  122. package/dist/utils/id-hints.js +61 -0
  123. package/dist/utils/local-space-state.d.ts +91 -0
  124. package/dist/utils/local-space-state.js +251 -0
  125. package/dist/utils/oauth-signed-query.d.ts +8 -0
  126. package/dist/utils/oauth-signed-query.js +26 -0
  127. package/dist/utils/publish-detection.d.ts +0 -8
  128. package/dist/utils/publish-detection.js +0 -93
  129. package/dist/utils/publish-policy.d.ts +6 -5
  130. package/dist/utils/publish-policy.js +71 -7
  131. package/dist/utils/query-keys.d.ts +17 -6
  132. package/dist/utils/query-keys.js +27 -4
  133. package/dist/utils/runtime-paths.d.ts +0 -1
  134. package/dist/utils/runtime-paths.js +0 -1
  135. package/dist/utils/runtime-upload-batch.d.ts +18 -0
  136. package/dist/utils/runtime-upload-batch.js +90 -0
  137. package/dist/utils/runtime-upload.d.ts +2 -0
  138. package/dist/utils/runtime-upload.js +5 -0
  139. package/dist/utils/space-config.d.ts +4 -0
  140. package/dist/utils/space-config.js +10 -1
  141. package/dist/utils/space-theme.d.ts +2 -0
  142. package/dist/utils/space-theme.js +9 -0
  143. package/dist/utils/static-runtime-policy.d.ts +1 -1
  144. package/dist/utils/static-runtime-policy.js +47 -15
  145. package/dist/utils/upload-session.d.ts +1 -1
  146. package/dist/utils/wpcom-auth-redirects.d.ts +32 -2
  147. package/dist/utils/wpcom-auth-redirects.js +26 -10
  148. package/dist/vocabulary.d.ts +130 -30
  149. package/dist/vocabulary.js +77 -36
  150. package/package.json +16 -1
  151. package/dist/contracts/account.d.ts +0 -28
  152. package/dist/contracts/account.js +0 -54
  153. package/dist/contracts/intercom.d.ts +0 -6
  154. package/dist/contracts/intercom.js +0 -5
  155. package/dist/contracts/telemetry.d.ts +0 -2
  156. package/dist/contracts/telemetry.js +0 -1
  157. package/dist/utils/access-policy.d.ts +0 -39
  158. package/dist/utils/error-display.d.ts +0 -7
  159. package/dist/utils/error-display.js +0 -42
@@ -92,18 +92,22 @@ declare const InternalBuildExecutionSchema: z.ZodObject<{
92
92
  sandboxId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
93
93
  region: z.ZodDefault<z.ZodNullable<z.ZodString>>;
94
94
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
95
+ phases: z.ZodOptional<z.ZodArray<z.ZodObject<{
96
+ phase: z.ZodString;
97
+ at: z.ZodString;
98
+ }, z.core.$strip>>>;
95
99
  }, z.core.$strip>;
96
100
  export declare const BuildSchema: z.ZodObject<{
97
101
  id: z.ZodString;
98
102
  spaceId: z.ZodString;
99
103
  status: z.ZodEnum<{
100
104
  failed: "failed";
101
- queued: "queued";
102
- running: "running";
103
- succeeded: "succeeded";
104
105
  canceled: "canceled";
105
106
  waiting_for_source: "waiting_for_source";
106
107
  uploading_source: "uploading_source";
108
+ queued: "queued";
109
+ running: "running";
110
+ succeeded: "succeeded";
107
111
  skipped: "skipped";
108
112
  }>;
109
113
  input: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -144,9 +148,9 @@ export declare const BuildSchema: z.ZodObject<{
144
148
  message: z.ZodString;
145
149
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
146
150
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
151
+ registrar: "registrar";
147
152
  wpcloud: "wpcloud";
148
153
  dns: "dns";
149
- registrar: "registrar";
150
154
  runtime: "runtime";
151
155
  }>>>;
152
156
  details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -195,9 +199,9 @@ export declare const buildCreateRequestSchema: z.ZodObject<{
195
199
  message: z.ZodString;
196
200
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
197
201
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
202
+ registrar: "registrar";
198
203
  wpcloud: "wpcloud";
199
204
  dns: "dns";
200
- registrar: "registrar";
201
205
  runtime: "runtime";
202
206
  }>>>;
203
207
  details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -209,8 +213,8 @@ export declare const buildCreateRequestSchema: z.ZodObject<{
209
213
  export declare const buildSourceArchiveUploadSchema: z.ZodObject<{
210
214
  id: z.ZodString;
211
215
  mode: z.ZodEnum<{
212
- dist: "dist";
213
216
  source: "source";
217
+ dist: "dist";
214
218
  }>;
215
219
  expiresAt: z.ZodString;
216
220
  summary: z.ZodObject<{
@@ -258,9 +262,9 @@ export declare const buildSourceArchiveUploadSchema: z.ZodObject<{
258
262
  message: z.ZodString;
259
263
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
260
264
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
265
+ registrar: "registrar";
261
266
  wpcloud: "wpcloud";
262
267
  dns: "dns";
263
- registrar: "registrar";
264
268
  runtime: "runtime";
265
269
  }>>>;
266
270
  details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -276,12 +280,12 @@ export declare const buildCreateResponseSchema: z.ZodObject<{
276
280
  spaceId: z.ZodString;
277
281
  status: z.ZodEnum<{
278
282
  failed: "failed";
279
- queued: "queued";
280
- running: "running";
281
- succeeded: "succeeded";
282
283
  canceled: "canceled";
283
284
  waiting_for_source: "waiting_for_source";
284
285
  uploading_source: "uploading_source";
286
+ queued: "queued";
287
+ running: "running";
288
+ succeeded: "succeeded";
285
289
  skipped: "skipped";
286
290
  }>;
287
291
  input: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -322,9 +326,9 @@ export declare const buildCreateResponseSchema: z.ZodObject<{
322
326
  message: z.ZodString;
323
327
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
324
328
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
329
+ registrar: "registrar";
325
330
  wpcloud: "wpcloud";
326
331
  dns: "dns";
327
- registrar: "registrar";
328
332
  runtime: "runtime";
329
333
  }>>>;
330
334
  details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -338,8 +342,8 @@ export declare const buildCreateResponseSchema: z.ZodObject<{
338
342
  upload: z.ZodDefault<z.ZodNullable<z.ZodObject<{
339
343
  id: z.ZodString;
340
344
  mode: z.ZodEnum<{
341
- dist: "dist";
342
345
  source: "source";
346
+ dist: "dist";
343
347
  }>;
344
348
  expiresAt: z.ZodString;
345
349
  summary: z.ZodObject<{
@@ -387,9 +391,9 @@ export declare const buildCreateResponseSchema: z.ZodObject<{
387
391
  message: z.ZodString;
388
392
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
389
393
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
394
+ registrar: "registrar";
390
395
  wpcloud: "wpcloud";
391
396
  dns: "dns";
392
- registrar: "registrar";
393
397
  runtime: "runtime";
394
398
  }>>>;
395
399
  details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -410,12 +414,12 @@ export declare const buildListResponseSchema: z.ZodObject<{
410
414
  spaceId: z.ZodString;
411
415
  status: z.ZodEnum<{
412
416
  failed: "failed";
413
- queued: "queued";
414
- running: "running";
415
- succeeded: "succeeded";
416
417
  canceled: "canceled";
417
418
  waiting_for_source: "waiting_for_source";
418
419
  uploading_source: "uploading_source";
420
+ queued: "queued";
421
+ running: "running";
422
+ succeeded: "succeeded";
419
423
  skipped: "skipped";
420
424
  }>;
421
425
  input: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -456,9 +460,9 @@ export declare const buildListResponseSchema: z.ZodObject<{
456
460
  message: z.ZodString;
457
461
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
458
462
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
463
+ registrar: "registrar";
459
464
  wpcloud: "wpcloud";
460
465
  dns: "dns";
461
- registrar: "registrar";
462
466
  runtime: "runtime";
463
467
  }>>>;
464
468
  details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -168,6 +168,14 @@ export const BuildCreateInputSchema = z
168
168
  }),
169
169
  ])
170
170
  .describe("What a new build should run against.");
171
+ // One phase-timeline entry the build runner appends via recordBuildPhase
172
+ // (apps/control-plane/src/builds/runner.ts BUILD_PHASES); `phase` stays a
173
+ // plain string here since the runner's specific phase vocabulary is an
174
+ // app-level concern, not a shared contract.
175
+ const buildExecutionPhaseSchema = z.object({
176
+ phase: z.string().min(1).describe("Build phase name; see BUILD_PHASES in builds/runner.ts."),
177
+ at: z.string().datetime(),
178
+ });
171
179
  const InternalBuildExecutionSchema = z
172
180
  .object({
173
181
  runner: z.string().nullable().default(null),
@@ -175,6 +183,10 @@ const InternalBuildExecutionSchema = z
175
183
  sandboxId: z.string().nullable().default(null),
176
184
  region: z.string().nullable().default(null),
177
185
  metadata: z.record(z.string(), z.unknown()).default({}),
186
+ phases: z
187
+ .array(buildExecutionPhaseSchema)
188
+ .optional()
189
+ .describe("Phase timeline the runner appends to via recordBuildPhase."),
178
190
  })
179
191
  .describe("Internal runner execution metadata surfaced only where appropriate.");
180
192
  export const BuildSchema = z.object({
@@ -12,11 +12,11 @@ export declare const channelHistoryEntrySchema: z.ZodObject<{
12
12
  channel: z.ZodString;
13
13
  previousVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
14
  actorType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
15
+ system: "system";
15
16
  user: "user";
16
17
  api_key: "api_key";
17
18
  oauth_client: "oauth_client";
18
19
  anonymous_claim: "anonymous_claim";
19
- system: "system";
20
20
  }>>>;
21
21
  actorId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
22
  at: z.ZodString;
@@ -37,11 +37,11 @@ export declare const channelHistoryResponseSchema: z.ZodObject<{
37
37
  channel: z.ZodString;
38
38
  previousVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
39
  actorType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
40
+ system: "system";
40
41
  user: "user";
41
42
  api_key: "api_key";
42
43
  oauth_client: "oauth_client";
43
44
  anonymous_claim: "anonymous_claim";
44
- system: "system";
45
45
  }>>>;
46
46
  actorId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
47
  at: z.ZodString;
@@ -15,9 +15,9 @@ export declare const baseDiagnosticSchema: z.ZodObject<{
15
15
  message: z.ZodString;
16
16
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
17
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
18
+ registrar: "registrar";
18
19
  wpcloud: "wpcloud";
19
20
  dns: "dns";
20
- registrar: "registrar";
21
21
  runtime: "runtime";
22
22
  }>>>;
23
23
  details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -110,9 +110,11 @@ export declare const ApiErrorResponseSchema: z.ZodObject<{
110
110
  docsUrl: z.ZodString;
111
111
  details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
112
112
  suggestions: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
+ next: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
114
  requestId: z.ZodOptional<z.ZodString>;
114
115
  }, z.core.$strip>;
115
116
  }, z.core.$strip>;
117
+ export type ApiErrorResponse = z.infer<typeof ApiErrorResponseSchema>;
116
118
  export declare function dataEnvelope<T extends z.ZodType>(data: T): z.ZodObject<{
117
119
  data: T;
118
120
  }, z.core.$strip>;
@@ -155,10 +157,10 @@ export declare const AsyncOperationSchema: z.ZodObject<{
155
157
  kind: z.ZodString;
156
158
  status: z.ZodEnum<{
157
159
  failed: "failed";
160
+ canceled: "canceled";
158
161
  queued: "queued";
159
162
  running: "running";
160
163
  succeeded: "succeeded";
161
- canceled: "canceled";
162
164
  }>;
163
165
  resources: z.ZodArray<z.ZodObject<{
164
166
  type: z.ZodString;
@@ -179,9 +181,9 @@ export declare const AsyncOperationSchema: z.ZodObject<{
179
181
  message: z.ZodString;
180
182
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
183
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
184
+ registrar: "registrar";
182
185
  wpcloud: "wpcloud";
183
186
  dns: "dns";
184
- registrar: "registrar";
185
187
  runtime: "runtime";
186
188
  }>>>;
187
189
  details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -199,10 +201,10 @@ export declare function mutationEnvelope<T extends z.ZodType>(data: T): z.ZodObj
199
201
  kind: z.ZodString;
200
202
  status: z.ZodEnum<{
201
203
  failed: "failed";
204
+ canceled: "canceled";
202
205
  queued: "queued";
203
206
  running: "running";
204
207
  succeeded: "succeeded";
205
- canceled: "canceled";
206
208
  }>;
207
209
  resources: z.ZodArray<z.ZodObject<{
208
210
  type: z.ZodString;
@@ -223,9 +225,9 @@ export declare function mutationEnvelope<T extends z.ZodType>(data: T): z.ZodObj
223
225
  message: z.ZodString;
224
226
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
225
227
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
228
+ registrar: "registrar";
226
229
  wpcloud: "wpcloud";
227
230
  dns: "dns";
228
- registrar: "registrar";
229
231
  runtime: "runtime";
230
232
  }>>>;
231
233
  details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -83,6 +83,10 @@ export const ApiErrorResponseSchema = z.object({
83
83
  .array(z.string())
84
84
  .optional()
85
85
  .describe("Actionable recovery steps safe to show in dashboards, SDKs, and CLI output."),
86
+ next: z
87
+ .array(z.string())
88
+ .optional()
89
+ .describe("Copy-pasteable commands or API requests an agent can run next."),
86
90
  requestId: z.string().optional().describe("Request id to quote when contacting support."),
87
91
  }),
88
92
  });
@@ -0,0 +1,63 @@
1
+ import { z } from "zod";
2
+ export declare const RequiresActionTypeSchema: z.ZodEnum<{
3
+ device_authorization: "device_authorization";
4
+ }>;
5
+ export declare const RequiresActionSchema: z.ZodObject<{
6
+ actionType: z.ZodEnum<{
7
+ device_authorization: "device_authorization";
8
+ }>;
9
+ instruction: z.ZodString;
10
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ continuationToken: z.ZodString;
12
+ pollAfterSeconds: z.ZodNumber;
13
+ expiresAt: z.ZodString;
14
+ }, z.core.$strict>;
15
+ export type RequiresAction = z.infer<typeof RequiresActionSchema>;
16
+ /** The canonical `{ requiresAction }` envelope, additive alongside `{ data }` / `{ error }`. */
17
+ export declare const RequiresActionEnvelopeSchema: z.ZodObject<{
18
+ requiresAction: z.ZodObject<{
19
+ actionType: z.ZodEnum<{
20
+ device_authorization: "device_authorization";
21
+ }>;
22
+ instruction: z.ZodString;
23
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ continuationToken: z.ZodString;
25
+ pollAfterSeconds: z.ZodNumber;
26
+ expiresAt: z.ZodString;
27
+ }, z.core.$strict>;
28
+ }, z.core.$strict>;
29
+ export declare const ActionResumeRequestSchema: z.ZodObject<{
30
+ continuationToken: z.ZodString;
31
+ }, z.core.$strict>;
32
+ export declare const ActionResumeResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
+ status: z.ZodLiteral<"pending">;
34
+ requiresAction: z.ZodObject<{
35
+ actionType: z.ZodEnum<{
36
+ device_authorization: "device_authorization";
37
+ }>;
38
+ instruction: z.ZodString;
39
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ continuationToken: z.ZodString;
41
+ pollAfterSeconds: z.ZodNumber;
42
+ expiresAt: z.ZodString;
43
+ }, z.core.$strict>;
44
+ }, z.core.$strict>, z.ZodObject<{
45
+ status: z.ZodLiteral<"completed">;
46
+ actionType: z.ZodEnum<{
47
+ device_authorization: "device_authorization";
48
+ }>;
49
+ result: z.ZodRecord<z.ZodString, z.ZodUnknown>;
50
+ }, z.core.$strict>, z.ZodObject<{
51
+ status: z.ZodLiteral<"denied">;
52
+ actionType: z.ZodEnum<{
53
+ device_authorization: "device_authorization";
54
+ }>;
55
+ message: z.ZodString;
56
+ }, z.core.$strict>, z.ZodObject<{
57
+ status: z.ZodLiteral<"expired">;
58
+ actionType: z.ZodEnum<{
59
+ device_authorization: "device_authorization";
60
+ }>;
61
+ message: z.ZodString;
62
+ }, z.core.$strict>], "status">;
63
+ export type ActionResumeResponse = z.infer<typeof ActionResumeResponseSchema>;
@@ -0,0 +1,91 @@
1
+ import { z } from "zod";
2
+ import { AnyObjectSchema } from "./common.js";
3
+ // Canonical `requires_action` result envelope (W5: agent dead-end fix).
4
+ //
5
+ // Some flows cannot finish inside a single request: they need an out-of-band
6
+ // human step (approve a device in the browser, confirm an approval). Historically
7
+ // those flows returned an `{ error }` an agent could not programmatically continue
8
+ // from — it was forced into the browser and the automation died. This envelope is
9
+ // the additive third shape alongside `{ data }` / `{ error }`: it tells the caller
10
+ // exactly what human step is pending, where to send the human, and — crucially —
11
+ // hands back a short-lived, single-use, principal-scoped continuation token plus a
12
+ // poll hint so the SAME agent can drive the flow to completion through the
13
+ // generalized resume endpoint once the human step is done.
14
+ export const RequiresActionTypeSchema = z
15
+ .enum(["device_authorization"])
16
+ .describe("Stable identifier for the out-of-band step a flow is blocked on. New blocking steps are added HERE so resume stays one generalized contract.");
17
+ export const RequiresActionSchema = z
18
+ .object({
19
+ actionType: RequiresActionTypeSchema,
20
+ instruction: z
21
+ .string()
22
+ .describe("Human-facing instruction describing the step a person must complete out of band."),
23
+ url: z
24
+ .string()
25
+ .url()
26
+ .nullable()
27
+ .optional()
28
+ .describe("Where to send the human to complete the step, when a destination exists."),
29
+ continuationToken: z
30
+ .string()
31
+ .min(1)
32
+ .describe("Short-lived, single-use-on-completion, principal-scoped capability the agent presents to POST /v1/actions/resume to poll and complete this exact flow. Treat as a secret; never log it."),
33
+ pollAfterSeconds: z
34
+ .number()
35
+ .int()
36
+ .positive()
37
+ .describe("Minimum number of seconds to wait before calling resume again (retry-after hint)."),
38
+ expiresAt: z
39
+ .string()
40
+ .datetime()
41
+ .describe("Instant by which the human step must be completed — the originating flow's own deadline. Resume after this returns a terminal `expired` status (the token survives a short grace past this so resume can report that), but the flow can no longer be redeemed."),
42
+ })
43
+ .strict();
44
+ /** The canonical `{ requiresAction }` envelope, additive alongside `{ data }` / `{ error }`. */
45
+ export const RequiresActionEnvelopeSchema = z
46
+ .object({ requiresAction: RequiresActionSchema })
47
+ .strict();
48
+ // Generalized resume/poll contract. One endpoint (`POST /v1/actions/resume`)
49
+ // drives every requires_action flow to completion from its continuation token, so
50
+ // agents learn the pattern once and reuse it everywhere.
51
+ export const ActionResumeRequestSchema = z
52
+ .object({
53
+ continuationToken: z
54
+ .string()
55
+ .trim()
56
+ .min(1)
57
+ .max(4096)
58
+ .describe("Continuation token from a `requiresAction` envelope. Body-only, never a URL."),
59
+ })
60
+ .strict();
61
+ export const ActionResumeResponseSchema = z
62
+ .discriminatedUnion("status", [
63
+ z
64
+ .object({
65
+ status: z.literal("pending"),
66
+ requiresAction: RequiresActionSchema.describe("The human step is still incomplete. Wait `pollAfterSeconds` and resume again with the same token."),
67
+ })
68
+ .strict(),
69
+ z
70
+ .object({
71
+ status: z.literal("completed"),
72
+ actionType: RequiresActionTypeSchema,
73
+ result: AnyObjectSchema.describe("The flow's success payload, redeemed exactly once. For device_authorization this carries the one-time `apiKey` and any `claimedSpaceId`."),
74
+ })
75
+ .strict(),
76
+ z
77
+ .object({
78
+ status: z.literal("denied"),
79
+ actionType: RequiresActionTypeSchema,
80
+ message: z.string(),
81
+ })
82
+ .strict(),
83
+ z
84
+ .object({
85
+ status: z.literal("expired"),
86
+ actionType: RequiresActionTypeSchema,
87
+ message: z.string(),
88
+ })
89
+ .strict(),
90
+ ])
91
+ .describe("Consistent resume result across flows: keep polling on `pending`, read the one-time payload on `completed`, stop on `denied`/`expired`.");
@@ -0,0 +1,2 @@
1
+ export declare const ISO_COUNTRY_CODES: readonly ["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"];
2
+ export type IsoCountryCode = (typeof ISO_COUNTRY_CODES)[number];