@spacefast/common 0.0.9 → 0.0.11
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/activity.d.ts +1 -1
- package/dist/contracts/activity.js +11 -6
- package/dist/contracts/annotations.d.ts +2 -0
- package/dist/contracts/annotations.js +2 -1
- package/dist/contracts/api-keys.d.ts +4 -0
- package/dist/contracts/api-keys.js +4 -0
- package/dist/contracts/archives.d.ts +2 -8
- package/dist/contracts/archives.js +3 -8
- package/dist/contracts/builds.d.ts +1 -0
- package/dist/contracts/builds.js +5 -0
- package/dist/contracts/comments.d.ts +309 -0
- package/dist/contracts/comments.js +200 -0
- package/dist/contracts/device-auth.d.ts +221 -1
- package/dist/contracts/device-auth.js +106 -4
- package/dist/contracts/device-team-scope.d.ts +10 -0
- package/dist/contracts/device-team-scope.js +17 -0
- package/dist/contracts/error-code-meta.d.ts +52 -0
- package/dist/contracts/error-code-meta.js +13 -0
- package/dist/contracts/error-codes.d.ts +1 -1
- package/dist/contracts/error-codes.js +13 -0
- package/dist/contracts/features.d.ts +37 -38
- package/dist/contracts/features.js +51 -59
- package/dist/contracts/generated-feature-launch-entries.d.ts +2 -2
- package/dist/contracts/generated-feature-launch-entries.js +6 -6
- package/dist/contracts/ids.d.ts +1 -1
- package/dist/contracts/ids.js +1 -1
- package/dist/contracts/oauth-resources.d.ts +7 -0
- package/dist/contracts/oauth-resources.js +10 -2
- package/dist/contracts/operations.d.ts +1 -3
- package/dist/contracts/operations.js +5 -1
- package/dist/contracts/pages.d.ts +70 -0
- package/dist/contracts/pages.js +89 -0
- package/dist/contracts/publishes.d.ts +5 -0
- package/dist/contracts/publishes.js +25 -8
- package/dist/contracts/resources.d.ts +14 -62
- package/dist/contracts/runtime-api.d.ts +13 -15
- package/dist/contracts/runtime-api.js +12 -70
- package/dist/contracts/space-config.d.ts +32 -90
- package/dist/contracts/space-config.js +49 -54
- package/dist/contracts/spaces.d.ts +47 -187
- package/dist/contracts/spaces.js +19 -3
- package/dist/contracts/superadmin-spaces.d.ts +14 -62
- package/dist/contracts/superadmin-teams.d.ts +79 -0
- package/dist/contracts/superadmin-teams.js +36 -0
- package/dist/contracts/superadmin.d.ts +2 -0
- package/dist/contracts/superadmin.js +1 -0
- package/dist/contracts/teams.d.ts +1 -0
- package/dist/contracts/teams.js +8 -0
- package/dist/contracts/theme-json.js +4 -5
- package/dist/dashboard-paths/index.d.ts +31 -0
- package/dist/dashboard-paths/index.js +80 -0
- package/dist/docs/agent-handoff-document.d.ts +15 -0
- package/dist/docs/agent-handoff-document.js +179 -0
- package/dist/docs/agent-setup.d.ts +12 -1
- package/dist/docs/agent-setup.js +30 -16
- package/dist/docs/catalog.d.ts +2 -2
- package/dist/docs/catalog.js +2 -2
- package/dist/docs/error-docs.js +52 -0
- package/dist/utils/asset-fingerprint.d.ts +53 -0
- package/dist/utils/asset-fingerprint.js +574 -0
- package/dist/utils/credential-policy.d.ts +5 -0
- package/dist/utils/credential-policy.js +31 -8
- package/dist/utils/pages.d.ts +53 -0
- package/dist/utils/pages.js +274 -0
- package/dist/utils/query-keys.d.ts +4 -3
- package/dist/utils/query-keys.js +4 -3
- package/dist/utils/space-config.d.ts +2 -2
- package/dist/utils/space-config.js +1 -1
- package/dist/utils/wpcom-auth-redirects.d.ts +0 -4
- package/dist/utils/wpcom-auth-redirects.js +0 -6
- package/dist/vocabulary.d.ts +2 -2
- package/package.json +6 -1
- package/dist/contracts/space-theme.d.ts +0 -25
- package/dist/contracts/space-theme.js +0 -49
- package/dist/utils/gate-theme.d.ts +0 -61
- package/dist/utils/gate-theme.js +0 -217
- package/dist/utils/space-theme.d.ts +0 -18
- package/dist/utils/space-theme.js +0 -98
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
|
|
3
|
+
export const collaborationModeSchema = z.enum(["review"]);
|
|
4
|
+
export const commentThreadStatusSchema = z.enum(["open", "archived"]);
|
|
5
|
+
// The space access levels capability follows (SPACEFAST-CAST-PLAN D-2). Invited
|
|
6
|
+
// reviewers are space invitees with one of these levels; the on-page overlay and
|
|
7
|
+
// inbox re-evaluate the effective level server-side at join — this is only the
|
|
8
|
+
// stored grant the dashboard manages.
|
|
9
|
+
export const collaborationReviewerLevelSchema = z.enum(["viewer", "commenter", "editor"]);
|
|
10
|
+
// An invited reviewer: a person (by email) granted a level on the space's review
|
|
11
|
+
// surface. Kept in settingsJson so adding/removing reviewers never requires a
|
|
12
|
+
// republish (read from the ETag'd overlay-config, SPACEFAST-CAST-PLAN §4.2).
|
|
13
|
+
export const collaborationInvitedReviewerSchema = z.object({
|
|
14
|
+
email: z.string().email(),
|
|
15
|
+
level: collaborationReviewerLevelSchema,
|
|
16
|
+
});
|
|
17
|
+
export const collaborationSettingsSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
anonymousReviewers: z.boolean().optional(),
|
|
20
|
+
publishedAnonymousCommenters: z.boolean().optional(),
|
|
21
|
+
invitedReviewers: z.array(collaborationInvitedReviewerSchema).optional(),
|
|
22
|
+
// Whether comments are surfaced on the live/published host (vs preview-only).
|
|
23
|
+
// The published loader (SPACEFAST-CAST-PLAN §4.2) mounts the orb on a live
|
|
24
|
+
// host only when this is true; toggling it never requires a republish — the
|
|
25
|
+
// always-injected inert tag reads behavior from the ETag'd overlay-config.
|
|
26
|
+
publishedComments: z.boolean().optional(),
|
|
27
|
+
allowedOrigins: z.array(z.string().min(1)).optional(),
|
|
28
|
+
notificationPreferences: z
|
|
29
|
+
.object({
|
|
30
|
+
newThreads: z.boolean().default(true),
|
|
31
|
+
newReplies: z.boolean().default(true),
|
|
32
|
+
statusChanges: z.boolean().default(true),
|
|
33
|
+
})
|
|
34
|
+
.partial()
|
|
35
|
+
.optional(),
|
|
36
|
+
})
|
|
37
|
+
.catchall(z.unknown());
|
|
38
|
+
export const collaborationSchema = z.object({
|
|
39
|
+
spaceId: z.string(),
|
|
40
|
+
enabled: z.boolean(),
|
|
41
|
+
mode: collaborationModeSchema,
|
|
42
|
+
castResourceId: z.string().nullable(),
|
|
43
|
+
castResourceKey: z.string().nullable(),
|
|
44
|
+
settings: collaborationSettingsSchema,
|
|
45
|
+
createdAt: z.string().datetime().nullable(),
|
|
46
|
+
updatedAt: z.string().datetime().nullable(),
|
|
47
|
+
});
|
|
48
|
+
export const collaborationUpdateSchema = z.object({
|
|
49
|
+
enabled: z.boolean(),
|
|
50
|
+
mode: collaborationModeSchema.optional(),
|
|
51
|
+
settings: collaborationSettingsSchema.optional(),
|
|
52
|
+
});
|
|
53
|
+
export const collaborationTokenRequestSchema = z.object({
|
|
54
|
+
versionId: z.string().min(1).optional(),
|
|
55
|
+
pagePath: z.string().min(1).default("/"),
|
|
56
|
+
displayName: z.string().min(1).max(120).optional(),
|
|
57
|
+
});
|
|
58
|
+
export const collaborationTokenResponseSchema = z.object({
|
|
59
|
+
token: z.string(),
|
|
60
|
+
expiresAt: z.string().datetime(),
|
|
61
|
+
cast: z.object({
|
|
62
|
+
resource: z.string(),
|
|
63
|
+
room: z.string().nullable(),
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
export const collaborationHandoffRequestSchema = z.object({
|
|
67
|
+
versionId: z.string().min(1),
|
|
68
|
+
pagePath: z.string().min(1).default("/"),
|
|
69
|
+
});
|
|
70
|
+
export const collaborationHandoffResponseSchema = z.object({
|
|
71
|
+
handoffToken: z.string(),
|
|
72
|
+
expiresAt: z.string().datetime(),
|
|
73
|
+
url: z.string().url().nullable(),
|
|
74
|
+
});
|
|
75
|
+
export const collaborationHandoffExchangeSchema = z.object({
|
|
76
|
+
handoffToken: z.string().min(16),
|
|
77
|
+
});
|
|
78
|
+
export const realtimeTokenRequestSchema = z.object({
|
|
79
|
+
versionId: z.string().optional(),
|
|
80
|
+
scope: z.enum(["space", "version"]).default("space"),
|
|
81
|
+
});
|
|
82
|
+
export const realtimeTokenResponseSchema = z.object({
|
|
83
|
+
token: z.string(),
|
|
84
|
+
expiresAt: z.string().datetime(),
|
|
85
|
+
cast: z.object({
|
|
86
|
+
resource: z.string(),
|
|
87
|
+
room: z.string(),
|
|
88
|
+
loaderUrl: z.string().url(),
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
export const noticePublishSchema = z.object({
|
|
92
|
+
versionId: z.string().optional(),
|
|
93
|
+
kind: z.string().min(1).max(80).default("version.ready"),
|
|
94
|
+
title: z.string().min(1).max(160),
|
|
95
|
+
message: z.string().min(1).max(2_000),
|
|
96
|
+
level: z.enum(["info", "success", "warning", "error"]).default("info"),
|
|
97
|
+
payload: z.record(z.string(), z.unknown()).optional(),
|
|
98
|
+
durable: z.boolean().default(true),
|
|
99
|
+
idempotencyKey: z.string().min(1).max(320).optional(),
|
|
100
|
+
});
|
|
101
|
+
export const noticePublishResponseSchema = z.object({
|
|
102
|
+
status: z.string(),
|
|
103
|
+
event: z.record(z.string(), z.unknown()).nullable(),
|
|
104
|
+
broadcast: z.record(z.string(), z.unknown()).nullable(),
|
|
105
|
+
});
|
|
106
|
+
export const collabOverlayConfigQuerySchema = z.object({
|
|
107
|
+
path: z.string().min(1).optional(),
|
|
108
|
+
versionId: z.string().min(1).optional(),
|
|
109
|
+
host: z.string().min(1).optional(),
|
|
110
|
+
});
|
|
111
|
+
// Snake case is intentional: the injected Collab SDK consumes this alongside
|
|
112
|
+
// Cast's snake-case join payload without a remapping layer.
|
|
113
|
+
export const collabOverlayConfigSchema = z.object({
|
|
114
|
+
enabled: z.boolean(),
|
|
115
|
+
anonymous_commenters: z.boolean(),
|
|
116
|
+
resource_key: z.string().nullable(),
|
|
117
|
+
room_key: z.string().nullable(),
|
|
118
|
+
version: z.object({
|
|
119
|
+
id: z.string().nullable(),
|
|
120
|
+
current: z.string().nullable(),
|
|
121
|
+
}),
|
|
122
|
+
ws_url: z.string().nullable(),
|
|
123
|
+
endpoints: z.object({
|
|
124
|
+
token: z.string().url(),
|
|
125
|
+
handoff_exchange: z.string().url(),
|
|
126
|
+
auth_bridge: z.string().url(),
|
|
127
|
+
screenshots: z.string().url(),
|
|
128
|
+
}),
|
|
129
|
+
features: z.object({
|
|
130
|
+
drawing: z.boolean(),
|
|
131
|
+
capture: z.boolean(),
|
|
132
|
+
notices: z.boolean(),
|
|
133
|
+
}),
|
|
134
|
+
});
|
|
135
|
+
export const commentAuthorSchema = z.object({
|
|
136
|
+
kind: z.string().nullable(),
|
|
137
|
+
id: z.string().nullable(),
|
|
138
|
+
name: z.string().nullable(),
|
|
139
|
+
});
|
|
140
|
+
export const commentTargetSchema = z.record(z.string(), z.unknown()).nullable();
|
|
141
|
+
export const commentThreadSchema = z.object({
|
|
142
|
+
id: z.string(),
|
|
143
|
+
castThreadId: z.string(),
|
|
144
|
+
spaceId: z.string(),
|
|
145
|
+
versionId: z.string().nullable(),
|
|
146
|
+
channel: z.string().nullable(),
|
|
147
|
+
pagePath: z.string(),
|
|
148
|
+
url: z.string().nullable(),
|
|
149
|
+
status: commentThreadStatusSchema,
|
|
150
|
+
unread: z.boolean(),
|
|
151
|
+
unreadCount: z.number().int().min(0),
|
|
152
|
+
body: z.string().nullable(),
|
|
153
|
+
author: commentAuthorSchema.nullable(),
|
|
154
|
+
target: commentTargetSchema,
|
|
155
|
+
comments: z.array(z.record(z.string(), z.unknown())),
|
|
156
|
+
permalink: z.string().nullable(),
|
|
157
|
+
updatedAt: z.string().datetime().nullable(),
|
|
158
|
+
});
|
|
159
|
+
export const commentListQuerySchema = cursorListQuerySchema.extend({
|
|
160
|
+
versionId: z.string().optional(),
|
|
161
|
+
status: commentThreadStatusSchema.optional(),
|
|
162
|
+
pagePath: z.string().optional(),
|
|
163
|
+
});
|
|
164
|
+
export const commentCreateSchema = z.object({
|
|
165
|
+
pagePath: z.string().min(1).default("/"),
|
|
166
|
+
body: z.string().min(1).max(16_000),
|
|
167
|
+
target: commentTargetSchema.optional(),
|
|
168
|
+
idempotencyKey: z.string().min(1).max(320).optional(),
|
|
169
|
+
});
|
|
170
|
+
export const commentScreenshotCreateSchema = z.object({
|
|
171
|
+
versionId: z.string().min(1),
|
|
172
|
+
pagePath: z.string().min(1).default("/"),
|
|
173
|
+
contentType: z.enum(["image/png", "image/jpeg", "image/webp"]),
|
|
174
|
+
contentBase64: z.string().min(1),
|
|
175
|
+
});
|
|
176
|
+
export const commentScreenshotSchema = z.object({
|
|
177
|
+
id: z.string(),
|
|
178
|
+
key: z.string(),
|
|
179
|
+
url: z.string().url(),
|
|
180
|
+
expiresAt: z.string().datetime(),
|
|
181
|
+
});
|
|
182
|
+
export const commentReplySchema = z.object({
|
|
183
|
+
body: z.string().min(1).max(16_000),
|
|
184
|
+
idempotencyKey: z.string().min(1).max(320).optional(),
|
|
185
|
+
});
|
|
186
|
+
export const commentPatchSchema = z.object({
|
|
187
|
+
status: commentThreadStatusSchema.optional(),
|
|
188
|
+
});
|
|
189
|
+
export const commentExportQuerySchema = z.object({
|
|
190
|
+
format: z.enum(["markdown", "json"]).default("markdown"),
|
|
191
|
+
status: commentThreadStatusSchema.optional(),
|
|
192
|
+
});
|
|
193
|
+
export const commentListResponseSchema = z.object({
|
|
194
|
+
data: z.array(commentThreadSchema),
|
|
195
|
+
pagination: CursorPaginationSchema,
|
|
196
|
+
});
|
|
197
|
+
export const commentExportResponseSchema = z.object({
|
|
198
|
+
format: z.enum(["markdown", "json"]),
|
|
199
|
+
content: z.string(),
|
|
200
|
+
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export { DeviceTeamScopeSchema } from "./device-team-scope.js";
|
|
3
|
+
export type { DeviceTeamScope } from "./device-team-scope.js";
|
|
2
4
|
export declare const DeviceAuthorizationStartRequestSchema: z.ZodObject<{
|
|
3
5
|
clientId: z.ZodDefault<z.ZodString>;
|
|
4
6
|
scope: z.ZodOptional<z.ZodString>;
|
|
@@ -64,6 +66,7 @@ export declare const DeviceAuthorizationPollResponseSchema: z.ZodObject<{
|
|
|
64
66
|
team_admin: "team_admin";
|
|
65
67
|
billing_viewer: "billing_viewer";
|
|
66
68
|
}>>;
|
|
69
|
+
teamScope: z.ZodNullable<z.ZodType<import("./device-team-scope.js").DeviceTeamScope, unknown, z.core.$ZodTypeInternals<import("./device-team-scope.js").DeviceTeamScope, unknown>>>;
|
|
67
70
|
policy: z.ZodNullable<z.ZodObject<{
|
|
68
71
|
version: z.ZodLiteral<"2026-06-09">;
|
|
69
72
|
statements: z.ZodArray<z.ZodObject<{
|
|
@@ -163,7 +166,8 @@ export declare const DeviceAuthorizationVerifyResponseSchema: z.ZodObject<{
|
|
|
163
166
|
}, z.core.$strip>;
|
|
164
167
|
export declare const DeviceAuthorizationApproveRequestSchema: z.ZodObject<{
|
|
165
168
|
userCode: z.ZodString;
|
|
166
|
-
|
|
169
|
+
teams: z.ZodType<import("./device-team-scope.js").DeviceTeamScope, unknown, z.core.$ZodTypeInternals<import("./device-team-scope.js").DeviceTeamScope, unknown>>;
|
|
170
|
+
claimTeamId: z.ZodOptional<z.ZodString>;
|
|
167
171
|
preset: z.ZodEnum<{
|
|
168
172
|
ci_deploy: "ci_deploy";
|
|
169
173
|
space_publisher: "space_publisher";
|
|
@@ -185,3 +189,219 @@ export declare const DeviceAuthorizationDenyRequestSchema: z.ZodObject<{
|
|
|
185
189
|
export declare const DeviceAuthorizationDenyResponseSchema: z.ZodObject<{
|
|
186
190
|
status: z.ZodLiteral<"denied">;
|
|
187
191
|
}, z.core.$strip>;
|
|
192
|
+
export declare const AGENT_HANDOFF_CLIENT_TARGETS: readonly ["claude-code", "codex", "cursor", "vscode"];
|
|
193
|
+
export type AgentHandoffClientTarget = (typeof AGENT_HANDOFF_CLIENT_TARGETS)[number];
|
|
194
|
+
export declare const AgentHandoffCreateRequestSchema: z.ZodObject<{
|
|
195
|
+
teamId: z.ZodString;
|
|
196
|
+
spaceId: z.ZodString;
|
|
197
|
+
clientTargetId: z.ZodEnum<{
|
|
198
|
+
"claude-code": "claude-code";
|
|
199
|
+
cursor: "cursor";
|
|
200
|
+
vscode: "vscode";
|
|
201
|
+
codex: "codex";
|
|
202
|
+
}>;
|
|
203
|
+
}, z.core.$strict>;
|
|
204
|
+
export type AgentHandoffCreateRequest = z.infer<typeof AgentHandoffCreateRequestSchema>;
|
|
205
|
+
export declare const AgentHandoffCreateResponseSchema: z.ZodObject<{
|
|
206
|
+
id: z.ZodString;
|
|
207
|
+
url: z.ZodString;
|
|
208
|
+
expiresAt: z.ZodString;
|
|
209
|
+
teamId: z.ZodString;
|
|
210
|
+
spaceId: z.ZodString;
|
|
211
|
+
clientTargetId: z.ZodEnum<{
|
|
212
|
+
"claude-code": "claude-code";
|
|
213
|
+
cursor: "cursor";
|
|
214
|
+
vscode: "vscode";
|
|
215
|
+
codex: "codex";
|
|
216
|
+
}>;
|
|
217
|
+
}, z.core.$strict>;
|
|
218
|
+
export type AgentHandoffCreateResponse = z.infer<typeof AgentHandoffCreateResponseSchema>;
|
|
219
|
+
export declare const AgentHandoffRedeemRequestSchema: z.ZodObject<{
|
|
220
|
+
url: z.ZodString;
|
|
221
|
+
clientTargetId: z.ZodOptional<z.ZodEnum<{
|
|
222
|
+
"claude-code": "claude-code";
|
|
223
|
+
cursor: "cursor";
|
|
224
|
+
vscode: "vscode";
|
|
225
|
+
codex: "codex";
|
|
226
|
+
}>>;
|
|
227
|
+
}, z.core.$strict>;
|
|
228
|
+
export type AgentHandoffRedeemRequest = z.infer<typeof AgentHandoffRedeemRequestSchema>;
|
|
229
|
+
export declare const AgentHandoffRedeemResponseSchema: z.ZodObject<{
|
|
230
|
+
status: z.ZodLiteral<"redeemed">;
|
|
231
|
+
apiKey: z.ZodObject<{
|
|
232
|
+
id: z.ZodString;
|
|
233
|
+
name: z.ZodNullable<z.ZodString>;
|
|
234
|
+
tenantId: z.ZodNullable<z.ZodString>;
|
|
235
|
+
subject: z.ZodNullable<z.ZodObject<{
|
|
236
|
+
type: z.ZodEnum<{
|
|
237
|
+
team: "team";
|
|
238
|
+
external: "external";
|
|
239
|
+
system: "system";
|
|
240
|
+
user: "user";
|
|
241
|
+
}>;
|
|
242
|
+
id: z.ZodString;
|
|
243
|
+
}, z.core.$strip>>;
|
|
244
|
+
ownerPrincipal: z.ZodNullable<z.ZodObject<{
|
|
245
|
+
type: z.ZodEnum<{
|
|
246
|
+
team: "team";
|
|
247
|
+
external: "external";
|
|
248
|
+
}>;
|
|
249
|
+
id: z.ZodString;
|
|
250
|
+
}, z.core.$strip>>;
|
|
251
|
+
createdByUserId: z.ZodString;
|
|
252
|
+
preset: z.ZodNullable<z.ZodEnum<{
|
|
253
|
+
ci_deploy: "ci_deploy";
|
|
254
|
+
space_publisher: "space_publisher";
|
|
255
|
+
space_admin: "space_admin";
|
|
256
|
+
site_admin: "site_admin";
|
|
257
|
+
domain_manager: "domain_manager";
|
|
258
|
+
team_admin: "team_admin";
|
|
259
|
+
billing_viewer: "billing_viewer";
|
|
260
|
+
}>>;
|
|
261
|
+
teamScope: z.ZodNullable<z.ZodType<import("./device-team-scope.js").DeviceTeamScope, unknown, z.core.$ZodTypeInternals<import("./device-team-scope.js").DeviceTeamScope, unknown>>>;
|
|
262
|
+
policy: z.ZodNullable<z.ZodObject<{
|
|
263
|
+
version: z.ZodLiteral<"2026-06-09">;
|
|
264
|
+
statements: z.ZodArray<z.ZodObject<{
|
|
265
|
+
effect: z.ZodEnum<{
|
|
266
|
+
allow: "allow";
|
|
267
|
+
deny: "deny";
|
|
268
|
+
}>;
|
|
269
|
+
actions: z.ZodArray<z.ZodEnum<{
|
|
270
|
+
"*": "*";
|
|
271
|
+
"sites:read": "sites:read";
|
|
272
|
+
"sites:create": "sites:create";
|
|
273
|
+
"sites:write": "sites:write";
|
|
274
|
+
"sites:delete": "sites:delete";
|
|
275
|
+
"sites:policy.write": "sites:policy.write";
|
|
276
|
+
"spaces:read": "spaces:read";
|
|
277
|
+
"spaces:create": "spaces:create";
|
|
278
|
+
"spaces:write": "spaces:write";
|
|
279
|
+
"spaces:delete": "spaces:delete";
|
|
280
|
+
"spaces:publish": "spaces:publish";
|
|
281
|
+
"spaces:transfer": "spaces:transfer";
|
|
282
|
+
"spaces:export": "spaces:export";
|
|
283
|
+
"spaces:import": "spaces:import";
|
|
284
|
+
"versions:read": "versions:read";
|
|
285
|
+
"versions:promote": "versions:promote";
|
|
286
|
+
"versions:delete": "versions:delete";
|
|
287
|
+
"versions:download": "versions:download";
|
|
288
|
+
"domains:read": "domains:read";
|
|
289
|
+
"domains:create": "domains:create";
|
|
290
|
+
"domains:verify": "domains:verify";
|
|
291
|
+
"domains:assign": "domains:assign";
|
|
292
|
+
"domains:bind": "domains:bind";
|
|
293
|
+
"domains:delete": "domains:delete";
|
|
294
|
+
"domains:dns.write": "domains:dns.write";
|
|
295
|
+
"domains:dns.credentials.write": "domains:dns.credentials.write";
|
|
296
|
+
"domains:purchase": "domains:purchase";
|
|
297
|
+
"webhooks:read": "webhooks:read";
|
|
298
|
+
"webhooks:write": "webhooks:write";
|
|
299
|
+
"builds:read": "builds:read";
|
|
300
|
+
"builds:create": "builds:create";
|
|
301
|
+
"teams:read": "teams:read";
|
|
302
|
+
"teams:write": "teams:write";
|
|
303
|
+
"teams:members.write": "teams:members.write";
|
|
304
|
+
"billing:read": "billing:read";
|
|
305
|
+
"billing:write": "billing:write";
|
|
306
|
+
"tokens:read": "tokens:read";
|
|
307
|
+
"tokens:create": "tokens:create";
|
|
308
|
+
"tokens:revoke": "tokens:revoke";
|
|
309
|
+
"mcp:tools": "mcp:tools";
|
|
310
|
+
"runtime:manage": "runtime:manage";
|
|
311
|
+
}>>;
|
|
312
|
+
resources: z.ZodArray<z.ZodString>;
|
|
313
|
+
conditions: z.ZodOptional<z.ZodObject<{
|
|
314
|
+
"request.client": z.ZodOptional<z.ZodEnum<{
|
|
315
|
+
api: "api";
|
|
316
|
+
dashboard: "dashboard";
|
|
317
|
+
cli: "cli";
|
|
318
|
+
worker: "worker";
|
|
319
|
+
}>>;
|
|
320
|
+
}, z.core.$strict>>;
|
|
321
|
+
}, z.core.$strict>>;
|
|
322
|
+
}, z.core.$strict>>;
|
|
323
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
324
|
+
secretPreview: z.ZodString;
|
|
325
|
+
secret: z.ZodOptional<z.ZodString>;
|
|
326
|
+
notBefore: z.ZodNullable<z.ZodString>;
|
|
327
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
328
|
+
ipAllowlist: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
329
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
330
|
+
enabled: z.ZodBoolean;
|
|
331
|
+
createdAt: z.ZodString;
|
|
332
|
+
updatedAt: z.ZodString;
|
|
333
|
+
lastRequestAt: z.ZodNullable<z.ZodString>;
|
|
334
|
+
}, z.core.$strip>;
|
|
335
|
+
teamId: z.ZodString;
|
|
336
|
+
spaceId: z.ZodString;
|
|
337
|
+
clientTargetId: z.ZodEnum<{
|
|
338
|
+
"claude-code": "claude-code";
|
|
339
|
+
cursor: "cursor";
|
|
340
|
+
vscode: "vscode";
|
|
341
|
+
codex: "codex";
|
|
342
|
+
}>;
|
|
343
|
+
}, z.core.$strict>;
|
|
344
|
+
export type AgentHandoffRedeemResponse = z.infer<typeof AgentHandoffRedeemResponseSchema>;
|
|
345
|
+
export declare const AgentHandoffRevokeResponseSchema: z.ZodObject<{
|
|
346
|
+
status: z.ZodLiteral<"revoked">;
|
|
347
|
+
}, z.core.$strict>;
|
|
348
|
+
export type AgentHandoffRevokeResponse = z.infer<typeof AgentHandoffRevokeResponseSchema>;
|
|
349
|
+
export declare const AgentHandoffListQuerySchema: z.ZodObject<{
|
|
350
|
+
teamId: z.ZodString;
|
|
351
|
+
}, z.core.$strip>;
|
|
352
|
+
export type AgentHandoffListQuery = z.infer<typeof AgentHandoffListQuerySchema>;
|
|
353
|
+
export declare const AgentHandoffStatusSchema: z.ZodEnum<{
|
|
354
|
+
pending: "pending";
|
|
355
|
+
revoked: "revoked";
|
|
356
|
+
redeemed: "redeemed";
|
|
357
|
+
}>;
|
|
358
|
+
export declare const AgentHandoffSummarySchema: z.ZodObject<{
|
|
359
|
+
id: z.ZodString;
|
|
360
|
+
teamId: z.ZodString;
|
|
361
|
+
spaceId: z.ZodString;
|
|
362
|
+
clientTargetId: z.ZodEnum<{
|
|
363
|
+
"claude-code": "claude-code";
|
|
364
|
+
cursor: "cursor";
|
|
365
|
+
vscode: "vscode";
|
|
366
|
+
codex: "codex";
|
|
367
|
+
}>;
|
|
368
|
+
status: z.ZodEnum<{
|
|
369
|
+
pending: "pending";
|
|
370
|
+
revoked: "revoked";
|
|
371
|
+
redeemed: "redeemed";
|
|
372
|
+
}>;
|
|
373
|
+
createdAt: z.ZodString;
|
|
374
|
+
expiresAt: z.ZodString;
|
|
375
|
+
redeemedAt: z.ZodNullable<z.ZodString>;
|
|
376
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
377
|
+
}, z.core.$strict>;
|
|
378
|
+
export type AgentHandoffSummary = z.infer<typeof AgentHandoffSummarySchema>;
|
|
379
|
+
export declare const AgentHandoffListResponseSchema: z.ZodArray<z.ZodObject<{
|
|
380
|
+
id: z.ZodString;
|
|
381
|
+
teamId: z.ZodString;
|
|
382
|
+
spaceId: z.ZodString;
|
|
383
|
+
clientTargetId: z.ZodEnum<{
|
|
384
|
+
"claude-code": "claude-code";
|
|
385
|
+
cursor: "cursor";
|
|
386
|
+
vscode: "vscode";
|
|
387
|
+
codex: "codex";
|
|
388
|
+
}>;
|
|
389
|
+
status: z.ZodEnum<{
|
|
390
|
+
pending: "pending";
|
|
391
|
+
revoked: "revoked";
|
|
392
|
+
redeemed: "redeemed";
|
|
393
|
+
}>;
|
|
394
|
+
createdAt: z.ZodString;
|
|
395
|
+
expiresAt: z.ZodString;
|
|
396
|
+
redeemedAt: z.ZodNullable<z.ZodString>;
|
|
397
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
398
|
+
}, z.core.$strict>>;
|
|
399
|
+
export type AgentHandoffListResponse = z.infer<typeof AgentHandoffListResponseSchema>;
|
|
400
|
+
export declare const AgentHandoffDeclineReasonSchema: z.ZodEnum<{
|
|
401
|
+
expired: "expired";
|
|
402
|
+
revoked: "revoked";
|
|
403
|
+
invalid_handoff: "invalid_handoff";
|
|
404
|
+
already_redeemed: "already_redeemed";
|
|
405
|
+
client_mismatch: "client_mismatch";
|
|
406
|
+
origin_mismatch: "origin_mismatch";
|
|
407
|
+
}>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { AGENT_HANDOFF_DECLINE_REASONS } from "../docs/agent-setup.js";
|
|
2
3
|
import { ApiKeyPresetSchema, ApiKeySchema } from "./api-keys.js";
|
|
4
|
+
import { DeviceTeamScopeSchema } from "./device-team-scope.js";
|
|
5
|
+
export { DeviceTeamScopeSchema } from "./device-team-scope.js";
|
|
3
6
|
// Device authorization flow (internal-docs/platform.md Credential Bootstrap):
|
|
4
7
|
// `POST /v1/auth/device` starts the flow, `POST /v1/auth/device/poll` redeems
|
|
5
8
|
// it. Device codes are bearer capabilities: they ride POST bodies only, are
|
|
@@ -120,8 +123,8 @@ export const DeviceAuthorizationVerifyResponseSchema = z.object({
|
|
|
120
123
|
.describe("Explicit claim handoff attached to this device authorization, if any."),
|
|
121
124
|
});
|
|
122
125
|
// Approval intent (`POST /v1/auth/device/approve`): the approver chooses the
|
|
123
|
-
// team and preset. If the device start request carried a claim handoff,
|
|
124
|
-
// also claims that anonymous space into the
|
|
126
|
+
// team scope and preset. If the device start request carried a claim handoff,
|
|
127
|
+
// approval also claims that anonymous space into the explicit destination team after the approval CAS
|
|
125
128
|
// wins. The intent persists server-side and the poll mints from it; the chosen
|
|
126
129
|
// preset's compiled policy must be a subset of the approver's effective
|
|
127
130
|
// team-role policy.
|
|
@@ -133,10 +136,12 @@ export const DeviceAuthorizationApproveRequestSchema = z
|
|
|
133
136
|
.min(1)
|
|
134
137
|
.max(32)
|
|
135
138
|
.describe("User code shown on the device being approved (dashes ignored)."),
|
|
136
|
-
|
|
139
|
+
teams: DeviceTeamScopeSchema.describe("Team access granted to the device: all current and future memberships, an explicit non-empty team list, or sign-in-only access."),
|
|
140
|
+
claimTeamId: z
|
|
137
141
|
.string()
|
|
138
142
|
.min(1)
|
|
139
|
-
.
|
|
143
|
+
.optional()
|
|
144
|
+
.describe("Explicit destination team for a claim handoff. Required when the flow carries a claim."),
|
|
140
145
|
preset: ApiKeyPresetSchema.describe("Policy preset for the minted key. Its compiled policy must be a subset of the approver's team-role policy."),
|
|
141
146
|
agentContinuation: z
|
|
142
147
|
.boolean()
|
|
@@ -164,3 +169,100 @@ export const DeviceAuthorizationDenyRequestSchema = z.object({
|
|
|
164
169
|
export const DeviceAuthorizationDenyResponseSchema = z.object({
|
|
165
170
|
status: z.literal("denied").describe("The device authorization is denied."),
|
|
166
171
|
});
|
|
172
|
+
export const AGENT_HANDOFF_CLIENT_TARGETS = ["claude-code", "codex", "cursor", "vscode"];
|
|
173
|
+
export const AgentHandoffCreateRequestSchema = z
|
|
174
|
+
.object({
|
|
175
|
+
teamId: z.string().min(1).describe("Team that owns the selected Space."),
|
|
176
|
+
spaceId: z.string().min(1).describe("Finite Space scope granted to the agent."),
|
|
177
|
+
clientTargetId: z
|
|
178
|
+
.enum(AGENT_HANDOFF_CLIENT_TARGETS)
|
|
179
|
+
.describe("CLI-redeemable client family the handoff is bound to."),
|
|
180
|
+
})
|
|
181
|
+
.strict();
|
|
182
|
+
export const AgentHandoffCreateResponseSchema = z
|
|
183
|
+
.object({
|
|
184
|
+
id: z.string().min(1).describe("Opaque app-private handoff document identifier."),
|
|
185
|
+
url: z
|
|
186
|
+
.string()
|
|
187
|
+
.url()
|
|
188
|
+
.describe("Sensitive one-time handoff URL. This is the only response field containing the fragment secret."),
|
|
189
|
+
expiresAt: z
|
|
190
|
+
.string()
|
|
191
|
+
.datetime()
|
|
192
|
+
.describe("Instant after which the handoff cannot be redeemed."),
|
|
193
|
+
teamId: z.string().min(1).describe("Team that owns the selected Space."),
|
|
194
|
+
spaceId: z.string().min(1).describe("Finite Space scope granted to the agent."),
|
|
195
|
+
clientTargetId: z
|
|
196
|
+
.enum(AGENT_HANDOFF_CLIENT_TARGETS)
|
|
197
|
+
.describe("CLI-redeemable client family the handoff is bound to."),
|
|
198
|
+
})
|
|
199
|
+
.strict();
|
|
200
|
+
export const AgentHandoffRedeemRequestSchema = z
|
|
201
|
+
.object({
|
|
202
|
+
url: z
|
|
203
|
+
.string()
|
|
204
|
+
.min(1)
|
|
205
|
+
.describe("Full sensitive handoff link, supplied only in the request body."),
|
|
206
|
+
clientTargetId: z
|
|
207
|
+
.enum(AGENT_HANDOFF_CLIENT_TARGETS)
|
|
208
|
+
.optional()
|
|
209
|
+
.describe("Declared redeeming client family, when the client can identify itself."),
|
|
210
|
+
})
|
|
211
|
+
.strict();
|
|
212
|
+
export const AgentHandoffRedeemResponseSchema = z
|
|
213
|
+
.object({
|
|
214
|
+
status: z.literal("redeemed").describe("The handoff was redeemed exactly once."),
|
|
215
|
+
apiKey: ApiKeySchema.describe("Finite Space-scoped API key including its one-time secret."),
|
|
216
|
+
teamId: z.string().min(1).describe("Team that owns the selected Space."),
|
|
217
|
+
spaceId: z.string().min(1).describe("Finite Space scope granted to the agent."),
|
|
218
|
+
clientTargetId: z
|
|
219
|
+
.enum(AGENT_HANDOFF_CLIENT_TARGETS)
|
|
220
|
+
.describe("CLI-redeemable client family the handoff is bound to."),
|
|
221
|
+
})
|
|
222
|
+
.strict();
|
|
223
|
+
export const AgentHandoffRevokeResponseSchema = z
|
|
224
|
+
.object({
|
|
225
|
+
status: z.literal("revoked").describe("The unused handoff is revoked."),
|
|
226
|
+
})
|
|
227
|
+
.strict();
|
|
228
|
+
// List (`GET /v1/auth/agent-handoffs?teamId=…`): the human handoff ledger. Session-only,
|
|
229
|
+
// scoped to one team, bounded to the newest rows (active handoffs are few and short-lived,
|
|
230
|
+
// so the bound can never hide a revocable link); rows are the truthful lifecycle record,
|
|
231
|
+
// never the secret (the fragment secret exists only in the one create response and is
|
|
232
|
+
// never listed or replayed).
|
|
233
|
+
export const AgentHandoffListQuerySchema = z.object({
|
|
234
|
+
teamId: z.string().min(1).describe("Team whose issued agent handoffs to list."),
|
|
235
|
+
});
|
|
236
|
+
export const AgentHandoffStatusSchema = z
|
|
237
|
+
.enum(["pending", "redeemed", "revoked"])
|
|
238
|
+
.describe("Stored lifecycle status. `expired` is not a stored status — it is derived by the caller from `expiresAt`.");
|
|
239
|
+
export const AgentHandoffSummarySchema = z
|
|
240
|
+
.object({
|
|
241
|
+
id: z.string().min(1).describe("Opaque app-private handoff document identifier."),
|
|
242
|
+
teamId: z.string().min(1).describe("Team that owns the selected Space."),
|
|
243
|
+
spaceId: z.string().min(1).describe("Finite Space scope granted to the agent."),
|
|
244
|
+
clientTargetId: z
|
|
245
|
+
.enum(AGENT_HANDOFF_CLIENT_TARGETS)
|
|
246
|
+
.describe("CLI-redeemable client family the handoff is bound to."),
|
|
247
|
+
status: AgentHandoffStatusSchema,
|
|
248
|
+
createdAt: z.string().datetime().describe("Instant the handoff was minted."),
|
|
249
|
+
expiresAt: z
|
|
250
|
+
.string()
|
|
251
|
+
.datetime()
|
|
252
|
+
.describe("Instant after which the handoff cannot be redeemed."),
|
|
253
|
+
redeemedAt: z
|
|
254
|
+
.string()
|
|
255
|
+
.datetime()
|
|
256
|
+
.nullable()
|
|
257
|
+
.describe("Instant the handoff was redeemed, if it was."),
|
|
258
|
+
revokedAt: z
|
|
259
|
+
.string()
|
|
260
|
+
.datetime()
|
|
261
|
+
.nullable()
|
|
262
|
+
.describe("Instant the handoff was revoked, if it was."),
|
|
263
|
+
})
|
|
264
|
+
.strict();
|
|
265
|
+
export const AgentHandoffListResponseSchema = z.array(AgentHandoffSummarySchema);
|
|
266
|
+
export const AgentHandoffDeclineReasonSchema = z
|
|
267
|
+
.enum(AGENT_HANDOFF_DECLINE_REASONS)
|
|
268
|
+
.describe("Terminal reason an authenticated handoff exchange was declined.");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const DeviceTeamScopeSchema = z.discriminatedUnion("mode", [
|
|
3
|
+
z.object({ mode: z.literal("all") }).strict(),
|
|
4
|
+
z
|
|
5
|
+
.object({
|
|
6
|
+
mode: z.literal("teams"),
|
|
7
|
+
teamIds: z
|
|
8
|
+
.array(z.string().min(1))
|
|
9
|
+
.min(1)
|
|
10
|
+
.max(100)
|
|
11
|
+
.refine((teamIds) => new Set(teamIds).size === teamIds.length, {
|
|
12
|
+
message: "teamIds must be unique.",
|
|
13
|
+
}),
|
|
14
|
+
})
|
|
15
|
+
.strict(),
|
|
16
|
+
z.object({ mode: z.literal("none") }).strict(),
|
|
17
|
+
]);
|