@spacefast/common 0.0.2 → 0.0.5
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.
- package/dist/contracts/access.d.ts +4 -4
- package/dist/contracts/activity.d.ts +4 -4
- package/dist/contracts/annotations.d.ts +1 -1
- package/dist/contracts/api-keys.d.ts +6 -6
- package/dist/contracts/archives.d.ts +14 -14
- package/dist/contracts/billing.d.ts +21 -21
- package/dist/contracts/builds.d.ts +8 -8
- package/dist/contracts/channels.d.ts +2 -2
- package/dist/contracts/common.d.ts +5 -5
- package/dist/contracts/continuation.d.ts +66 -0
- package/dist/contracts/continuation.js +91 -0
- package/dist/contracts/deployments.d.ts +18 -18
- package/dist/contracts/device-auth.d.ts +6 -6
- package/dist/contracts/domains.d.ts +247 -247
- package/dist/contracts/enums.d.ts +2 -2
- package/dist/contracts/error-code-meta.d.ts +12 -0
- package/dist/contracts/error-code-meta.js +3 -0
- package/dist/contracts/error-codes.d.ts +1 -1
- package/dist/contracts/error-codes.js +3 -0
- package/dist/contracts/events.d.ts +12 -12
- package/dist/contracts/features.d.ts +17 -17
- package/dist/contracts/git.d.ts +3 -3
- package/dist/contracts/internal.d.ts +3 -3
- package/dist/contracts/mcp.d.ts +34 -34
- package/dist/contracts/me.d.ts +8 -8
- package/dist/contracts/operations.d.ts +2 -2
- package/dist/contracts/plan-policy.d.ts +4 -4
- package/dist/contracts/platform.d.ts +3 -3
- package/dist/contracts/repository-connections.d.ts +5 -5
- package/dist/contracts/resources.d.ts +15 -15
- package/dist/contracts/runtime-api.d.ts +4 -4
- package/dist/contracts/sites.d.ts +26 -26
- package/dist/contracts/spaces.d.ts +179 -89
- package/dist/contracts/spaces.js +57 -3
- package/dist/contracts/superadmin-emails.d.ts +3 -3
- package/dist/contracts/superadmin-queues.d.ts +58 -58
- package/dist/contracts/superadmin-spaces.d.ts +275 -9
- package/dist/contracts/superadmin-spaces.js +24 -0
- package/dist/contracts/superadmin-tenants.d.ts +8 -8
- package/dist/contracts/superadmin.d.ts +12 -12
- package/dist/contracts/tags.d.ts +38 -38
- package/dist/contracts/teams.d.ts +26 -8
- package/dist/contracts/teams.js +20 -0
- package/dist/contracts/transfers.d.ts +9 -9
- package/dist/contracts/variables.d.ts +14 -14
- package/dist/contracts/webhooks.d.ts +4 -4
- package/dist/contracts/zero.d.ts +8 -8
- package/dist/docs/agent-prose.js +8 -4
- package/dist/docs/agent-setup.js +3 -2
- package/dist/docs/error-docs.js +16 -4
- package/dist/utils/query-keys.d.ts +2 -2
- package/dist/utils/static-runtime-policy.d.ts +21 -0
- package/dist/utils/static-runtime-policy.js +119 -3
- package/package.json +2 -1
|
@@ -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`.");
|
|
@@ -4,9 +4,9 @@ export declare const deploymentStatusSchema: z.ZodEnum<{
|
|
|
4
4
|
queued: "queued";
|
|
5
5
|
canceled: "canceled";
|
|
6
6
|
ready: "ready";
|
|
7
|
+
building: "building";
|
|
7
8
|
waiting_for_source: "waiting_for_source";
|
|
8
9
|
skipped: "skipped";
|
|
9
|
-
building: "building";
|
|
10
10
|
}>;
|
|
11
11
|
export declare const DeploymentSourceSchema: z.ZodObject<{
|
|
12
12
|
kind: z.ZodNullable<z.ZodString>;
|
|
@@ -73,10 +73,10 @@ export declare const DeploymentChannelStateSchema: z.ZodObject<{
|
|
|
73
73
|
}, z.core.$strip>;
|
|
74
74
|
export declare const DeploymentActivityGroupSchema: z.ZodObject<{
|
|
75
75
|
kind: z.ZodEnum<{
|
|
76
|
-
version: "version";
|
|
77
76
|
channel: "channel";
|
|
78
|
-
|
|
77
|
+
version: "version";
|
|
79
78
|
branch: "branch";
|
|
79
|
+
source: "source";
|
|
80
80
|
pull_request: "pull_request";
|
|
81
81
|
}>;
|
|
82
82
|
key: z.ZodString;
|
|
@@ -104,10 +104,10 @@ export declare const DeploymentSchema: z.ZodObject<{
|
|
|
104
104
|
}, z.core.$strip>>;
|
|
105
105
|
activityGroup: z.ZodObject<{
|
|
106
106
|
kind: z.ZodEnum<{
|
|
107
|
-
version: "version";
|
|
108
107
|
channel: "channel";
|
|
109
|
-
|
|
108
|
+
version: "version";
|
|
110
109
|
branch: "branch";
|
|
110
|
+
source: "source";
|
|
111
111
|
pull_request: "pull_request";
|
|
112
112
|
}>;
|
|
113
113
|
key: z.ZodString;
|
|
@@ -118,18 +118,18 @@ export declare const DeploymentSchema: z.ZodObject<{
|
|
|
118
118
|
queued: "queued";
|
|
119
119
|
canceled: "canceled";
|
|
120
120
|
ready: "ready";
|
|
121
|
+
building: "building";
|
|
121
122
|
waiting_for_source: "waiting_for_source";
|
|
122
123
|
skipped: "skipped";
|
|
123
|
-
building: "building";
|
|
124
124
|
}>;
|
|
125
125
|
versionStatus: z.ZodNullable<z.ZodEnum<{
|
|
126
126
|
failed: "failed";
|
|
127
127
|
canceled: "canceled";
|
|
128
128
|
ready: "ready";
|
|
129
129
|
expired: "expired";
|
|
130
|
-
created: "created";
|
|
131
130
|
building: "building";
|
|
132
131
|
prepared: "prepared";
|
|
132
|
+
created: "created";
|
|
133
133
|
uploading: "uploading";
|
|
134
134
|
uploaded: "uploaded";
|
|
135
135
|
finalizing: "finalizing";
|
|
@@ -216,9 +216,9 @@ export declare const DeploymentSchema: z.ZodObject<{
|
|
|
216
216
|
diagnostics: z.ZodArray<z.ZodObject<{
|
|
217
217
|
code: z.ZodString;
|
|
218
218
|
severity: z.ZodEnum<{
|
|
219
|
-
info: "info";
|
|
220
219
|
warning: "warning";
|
|
221
220
|
error: "error";
|
|
221
|
+
info: "info";
|
|
222
222
|
}>;
|
|
223
223
|
message: z.ZodString;
|
|
224
224
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -268,10 +268,10 @@ export declare const deploymentListResponseSchema: z.ZodObject<{
|
|
|
268
268
|
}, z.core.$strip>>;
|
|
269
269
|
activityGroup: z.ZodObject<{
|
|
270
270
|
kind: z.ZodEnum<{
|
|
271
|
-
version: "version";
|
|
272
271
|
channel: "channel";
|
|
273
|
-
|
|
272
|
+
version: "version";
|
|
274
273
|
branch: "branch";
|
|
274
|
+
source: "source";
|
|
275
275
|
pull_request: "pull_request";
|
|
276
276
|
}>;
|
|
277
277
|
key: z.ZodString;
|
|
@@ -282,18 +282,18 @@ export declare const deploymentListResponseSchema: z.ZodObject<{
|
|
|
282
282
|
queued: "queued";
|
|
283
283
|
canceled: "canceled";
|
|
284
284
|
ready: "ready";
|
|
285
|
+
building: "building";
|
|
285
286
|
waiting_for_source: "waiting_for_source";
|
|
286
287
|
skipped: "skipped";
|
|
287
|
-
building: "building";
|
|
288
288
|
}>;
|
|
289
289
|
versionStatus: z.ZodNullable<z.ZodEnum<{
|
|
290
290
|
failed: "failed";
|
|
291
291
|
canceled: "canceled";
|
|
292
292
|
ready: "ready";
|
|
293
293
|
expired: "expired";
|
|
294
|
-
created: "created";
|
|
295
294
|
building: "building";
|
|
296
295
|
prepared: "prepared";
|
|
296
|
+
created: "created";
|
|
297
297
|
uploading: "uploading";
|
|
298
298
|
uploaded: "uploaded";
|
|
299
299
|
finalizing: "finalizing";
|
|
@@ -380,9 +380,9 @@ export declare const deploymentListResponseSchema: z.ZodObject<{
|
|
|
380
380
|
diagnostics: z.ZodArray<z.ZodObject<{
|
|
381
381
|
code: z.ZodString;
|
|
382
382
|
severity: z.ZodEnum<{
|
|
383
|
-
info: "info";
|
|
384
383
|
warning: "warning";
|
|
385
384
|
error: "error";
|
|
385
|
+
info: "info";
|
|
386
386
|
}>;
|
|
387
387
|
message: z.ZodString;
|
|
388
388
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -433,10 +433,10 @@ export declare const deploymentGetResponseSchema: z.ZodObject<{
|
|
|
433
433
|
}, z.core.$strip>>;
|
|
434
434
|
activityGroup: z.ZodObject<{
|
|
435
435
|
kind: z.ZodEnum<{
|
|
436
|
-
version: "version";
|
|
437
436
|
channel: "channel";
|
|
438
|
-
|
|
437
|
+
version: "version";
|
|
439
438
|
branch: "branch";
|
|
439
|
+
source: "source";
|
|
440
440
|
pull_request: "pull_request";
|
|
441
441
|
}>;
|
|
442
442
|
key: z.ZodString;
|
|
@@ -447,18 +447,18 @@ export declare const deploymentGetResponseSchema: z.ZodObject<{
|
|
|
447
447
|
queued: "queued";
|
|
448
448
|
canceled: "canceled";
|
|
449
449
|
ready: "ready";
|
|
450
|
+
building: "building";
|
|
450
451
|
waiting_for_source: "waiting_for_source";
|
|
451
452
|
skipped: "skipped";
|
|
452
|
-
building: "building";
|
|
453
453
|
}>;
|
|
454
454
|
versionStatus: z.ZodNullable<z.ZodEnum<{
|
|
455
455
|
failed: "failed";
|
|
456
456
|
canceled: "canceled";
|
|
457
457
|
ready: "ready";
|
|
458
458
|
expired: "expired";
|
|
459
|
-
created: "created";
|
|
460
459
|
building: "building";
|
|
461
460
|
prepared: "prepared";
|
|
461
|
+
created: "created";
|
|
462
462
|
uploading: "uploading";
|
|
463
463
|
uploaded: "uploaded";
|
|
464
464
|
finalizing: "finalizing";
|
|
@@ -545,9 +545,9 @@ export declare const deploymentGetResponseSchema: z.ZodObject<{
|
|
|
545
545
|
diagnostics: z.ZodArray<z.ZodObject<{
|
|
546
546
|
code: z.ZodString;
|
|
547
547
|
severity: z.ZodEnum<{
|
|
548
|
-
info: "info";
|
|
549
548
|
warning: "warning";
|
|
550
549
|
error: "error";
|
|
550
|
+
info: "info";
|
|
551
551
|
}>;
|
|
552
552
|
message: z.ZodString;
|
|
553
553
|
path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -23,8 +23,8 @@ export type DeviceAuthorizationPollRequest = z.infer<typeof DeviceAuthorizationP
|
|
|
23
23
|
export declare const DeviceAuthorizationStatusSchema: z.ZodEnum<{
|
|
24
24
|
expired: "expired";
|
|
25
25
|
pending: "pending";
|
|
26
|
-
approved: "approved";
|
|
27
26
|
denied: "denied";
|
|
27
|
+
approved: "approved";
|
|
28
28
|
consumed: "consumed";
|
|
29
29
|
}>;
|
|
30
30
|
export type DeviceAuthorizationStatus = z.infer<typeof DeviceAuthorizationStatusSchema>;
|
|
@@ -32,8 +32,8 @@ export declare const DeviceAuthorizationPollResponseSchema: z.ZodObject<{
|
|
|
32
32
|
status: z.ZodEnum<{
|
|
33
33
|
expired: "expired";
|
|
34
34
|
pending: "pending";
|
|
35
|
-
approved: "approved";
|
|
36
35
|
denied: "denied";
|
|
36
|
+
approved: "approved";
|
|
37
37
|
consumed: "consumed";
|
|
38
38
|
}>;
|
|
39
39
|
apiKey: z.ZodOptional<z.ZodObject<{
|
|
@@ -42,17 +42,17 @@ export declare const DeviceAuthorizationPollResponseSchema: z.ZodObject<{
|
|
|
42
42
|
tenantId: z.ZodNullable<z.ZodString>;
|
|
43
43
|
subject: z.ZodNullable<z.ZodObject<{
|
|
44
44
|
type: z.ZodEnum<{
|
|
45
|
+
team: "team";
|
|
45
46
|
external: "external";
|
|
46
|
-
user: "user";
|
|
47
47
|
system: "system";
|
|
48
|
-
|
|
48
|
+
user: "user";
|
|
49
49
|
}>;
|
|
50
50
|
id: z.ZodString;
|
|
51
51
|
}, z.core.$strip>>;
|
|
52
52
|
ownerPrincipal: z.ZodNullable<z.ZodObject<{
|
|
53
53
|
type: z.ZodEnum<{
|
|
54
|
-
external: "external";
|
|
55
54
|
team: "team";
|
|
55
|
+
external: "external";
|
|
56
56
|
}>;
|
|
57
57
|
id: z.ZodString;
|
|
58
58
|
}, z.core.$strip>>;
|
|
@@ -150,8 +150,8 @@ export declare const DeviceAuthorizationVerifyResponseSchema: z.ZodObject<{
|
|
|
150
150
|
status: z.ZodEnum<{
|
|
151
151
|
expired: "expired";
|
|
152
152
|
pending: "pending";
|
|
153
|
-
approved: "approved";
|
|
154
153
|
denied: "denied";
|
|
154
|
+
approved: "approved";
|
|
155
155
|
consumed: "consumed";
|
|
156
156
|
}>;
|
|
157
157
|
clientId: z.ZodNullable<z.ZodString>;
|