@spacefast/common 0.0.12 → 0.0.17

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 (189) hide show
  1. package/dist/agents/client-registry.d.ts +22 -0
  2. package/dist/agents/client-registry.js +41 -0
  3. package/dist/agents/connect-targets.d.ts +51 -6
  4. package/dist/agents/connect-targets.js +93 -28
  5. package/dist/brand.d.ts +0 -11
  6. package/dist/brand.js +0 -20
  7. package/dist/config/domains.d.ts +15 -6
  8. package/dist/config/domains.js +24 -10
  9. package/dist/config/postgres-budget.d.ts +3 -0
  10. package/dist/config/postgres-budget.js +6 -1
  11. package/dist/config/postgres-budget.json +2 -1
  12. package/dist/contracts/abuse.js +1 -1
  13. package/dist/contracts/access.d.ts +486 -1196
  14. package/dist/contracts/access.js +323 -1054
  15. package/dist/contracts/activity.d.ts +1 -1
  16. package/dist/contracts/activity.js +11 -15
  17. package/dist/contracts/api-keys.d.ts +16 -0
  18. package/dist/contracts/api-keys.js +11 -9
  19. package/dist/contracts/archives.d.ts +1 -2
  20. package/dist/contracts/archives.js +15 -17
  21. package/dist/contracts/beta.js +1 -1
  22. package/dist/contracts/builds.js +14 -14
  23. package/dist/contracts/channels.js +2 -2
  24. package/dist/contracts/comments.d.ts +143 -99
  25. package/dist/contracts/comments.js +194 -79
  26. package/dist/contracts/common.d.ts +12 -12
  27. package/dist/contracts/common.js +33 -30
  28. package/dist/contracts/continuation.js +5 -5
  29. package/dist/contracts/countries.js +2 -7
  30. package/dist/contracts/data-source-routes.d.ts +20 -0
  31. package/dist/contracts/data-source-routes.js +15 -0
  32. package/dist/contracts/device-auth.d.ts +13 -9
  33. package/dist/contracts/device-auth.js +12 -12
  34. package/dist/contracts/docs.d.ts +10 -10
  35. package/dist/contracts/domains.js +39 -33
  36. package/dist/contracts/enums.d.ts +4 -14
  37. package/dist/contracts/enums.js +3 -10
  38. package/dist/contracts/error-code-meta.d.ts +122 -56
  39. package/dist/contracts/error-code-meta.js +43 -19
  40. package/dist/contracts/error-codes.d.ts +7 -4
  41. package/dist/contracts/error-codes.js +48 -24
  42. package/dist/contracts/events.d.ts +22 -15
  43. package/dist/contracts/events.js +33 -5
  44. package/dist/contracts/execution.d.ts +238 -0
  45. package/dist/contracts/execution.js +309 -0
  46. package/dist/contracts/feature-lifecycle.d.ts +39 -188
  47. package/dist/contracts/feature-lifecycle.js +52 -196
  48. package/dist/contracts/features.d.ts +13 -115
  49. package/dist/contracts/features.js +5 -35
  50. package/dist/contracts/functions.d.ts +597 -0
  51. package/dist/contracts/functions.js +475 -0
  52. package/dist/contracts/grants.d.ts +1175 -0
  53. package/dist/contracts/grants.js +783 -0
  54. package/dist/contracts/ids.d.ts +7 -5
  55. package/dist/contracts/ids.js +7 -7
  56. package/dist/contracts/internal.js +2 -2
  57. package/dist/contracts/mcp.d.ts +17 -556
  58. package/dist/contracts/mcp.js +9 -103
  59. package/dist/contracts/me.js +3 -4
  60. package/dist/contracts/notifications.d.ts +108 -0
  61. package/dist/contracts/notifications.js +54 -0
  62. package/dist/contracts/oauth-resources.d.ts +22 -5
  63. package/dist/contracts/oauth-resources.js +23 -2
  64. package/dist/contracts/operations.d.ts +0 -48
  65. package/dist/contracts/operations.js +0 -19
  66. package/dist/contracts/pages.d.ts +10 -14
  67. package/dist/contracts/pages.js +17 -21
  68. package/dist/contracts/plan-policy.d.ts +1 -8
  69. package/dist/contracts/plan-policy.js +1 -4
  70. package/dist/contracts/platform.d.ts +78 -30
  71. package/dist/contracts/platform.js +69 -20
  72. package/dist/contracts/problem-document.d.ts +14 -0
  73. package/dist/contracts/problem-document.js +35 -0
  74. package/dist/contracts/push-new.d.ts +41 -2
  75. package/dist/contracts/push-new.js +4 -0
  76. package/dist/contracts/quotas.d.ts +0 -1
  77. package/dist/contracts/quotas.js +0 -5
  78. package/dist/contracts/repository-connections.d.ts +1 -1
  79. package/dist/contracts/resources.d.ts +16 -71
  80. package/dist/contracts/resources.js +13 -16
  81. package/dist/contracts/runtime-api.d.ts +666 -303
  82. package/dist/contracts/runtime-api.js +272 -113
  83. package/dist/contracts/runtime-app.d.ts +168 -0
  84. package/dist/contracts/runtime-app.js +42 -0
  85. package/dist/contracts/runtime-db.d.ts +424 -0
  86. package/dist/contracts/runtime-db.js +108 -0
  87. package/dist/contracts/runtime-storage.d.ts +120 -0
  88. package/dist/contracts/runtime-storage.js +40 -0
  89. package/dist/contracts/sf-config-v1.d.ts +54 -1
  90. package/dist/contracts/sf-config-v1.js +2 -2
  91. package/dist/contracts/sites.d.ts +6 -0
  92. package/dist/contracts/sites.js +30 -11
  93. package/dist/contracts/space-config.d.ts +91 -121
  94. package/dist/contracts/space-config.js +464 -42
  95. package/dist/contracts/spaces.d.ts +300 -171
  96. package/dist/contracts/spaces.js +128 -98
  97. package/dist/contracts/superadmin-emails.d.ts +2 -2
  98. package/dist/contracts/superadmin-spaces.d.ts +26 -130
  99. package/dist/contracts/superadmin-spaces.js +22 -0
  100. package/dist/contracts/superadmin-tenants.js +4 -4
  101. package/dist/contracts/superadmin.d.ts +4 -0
  102. package/dist/contracts/superadmin.js +14 -1
  103. package/dist/contracts/tags.d.ts +6 -6
  104. package/dist/contracts/tags.js +1 -1
  105. package/dist/contracts/teams.d.ts +9 -9
  106. package/dist/contracts/teams.js +25 -16
  107. package/dist/contracts/theme-json.js +1 -1
  108. package/dist/contracts/transfers.d.ts +0 -1
  109. package/dist/contracts/transfers.js +4 -4
  110. package/dist/contracts/variables.js +3 -3
  111. package/dist/contracts/zero.d.ts +384 -596
  112. package/dist/contracts/zero.js +167 -299
  113. package/dist/dashboard-paths/index.d.ts +18 -3
  114. package/dist/dashboard-paths/index.js +19 -0
  115. package/dist/docs/agent-handoff-document.d.ts +2 -2
  116. package/dist/docs/agent-handoff-document.js +8 -7
  117. package/dist/docs/agent-prose.d.ts +22 -3
  118. package/dist/docs/agent-prose.js +227 -55
  119. package/dist/docs/agent-setup.d.ts +14 -11
  120. package/dist/docs/agent-setup.js +289 -61
  121. package/dist/docs/agent-solutions.d.ts +6 -6
  122. package/dist/docs/agent-solutions.js +24 -22
  123. package/dist/docs/catalog.d.ts +53 -98
  124. package/dist/docs/catalog.js +90 -117
  125. package/dist/docs/error-docs.js +304 -236
  126. package/dist/docs/skill-distribution.d.ts +2 -0
  127. package/dist/docs/skill-distribution.js +7 -4
  128. package/dist/docs/skills.d.ts +546 -0
  129. package/dist/docs/skills.js +340 -0
  130. package/dist/utils/auth-redirect.d.ts +1 -3
  131. package/dist/utils/auth-redirect.js +1 -21
  132. package/dist/utils/browser-credential.d.ts +19 -0
  133. package/dist/utils/browser-credential.js +62 -0
  134. package/dist/utils/build-settings.d.ts +2 -0
  135. package/dist/utils/build-settings.js +61 -9
  136. package/dist/utils/comment-avatars.d.ts +7 -0
  137. package/dist/utils/comment-avatars.js +42 -0
  138. package/dist/utils/content-type.d.ts +3 -3
  139. package/dist/utils/content-type.js +38 -61
  140. package/dist/utils/credential-policy.d.ts +1 -1
  141. package/dist/utils/credential-policy.js +4 -0
  142. package/dist/utils/domain-diagnostics.d.ts +5 -5
  143. package/dist/utils/domain-diagnostics.js +21 -10
  144. package/dist/utils/egress-policy.fixtures.json +1 -1
  145. package/dist/utils/grants.d.ts +53 -0
  146. package/dist/utils/grants.js +160 -0
  147. package/dist/utils/local-space-state.d.ts +78 -4
  148. package/dist/utils/local-space-state.js +384 -82
  149. package/dist/utils/one-shot-replay.d.ts +14 -0
  150. package/dist/utils/one-shot-replay.js +21 -0
  151. package/dist/utils/page-preview.d.ts +7 -0
  152. package/dist/utils/page-preview.js +9 -0
  153. package/dist/utils/pages.d.ts +2 -5
  154. package/dist/utils/pages.js +64 -33
  155. package/dist/utils/publish-form-data.d.ts +22 -0
  156. package/dist/utils/publish-form-data.js +26 -0
  157. package/dist/utils/publish-policy.d.ts +34 -4
  158. package/dist/utils/publish-policy.js +149 -62
  159. package/dist/utils/query-keys.d.ts +8 -10
  160. package/dist/utils/query-keys.js +14 -10
  161. package/dist/utils/runtime-paths.d.ts +3 -0
  162. package/dist/utils/runtime-paths.js +7 -0
  163. package/dist/utils/secure-local-file.d.ts +73 -0
  164. package/dist/utils/secure-local-file.js +1373 -0
  165. package/dist/utils/space-config.d.ts +17 -4
  166. package/dist/utils/space-config.js +151 -8
  167. package/dist/utils/static-runtime-policy.d.ts +5 -0
  168. package/dist/utils/static-runtime-policy.js +54 -10
  169. package/dist/utils/storage-policy.d.ts +20 -0
  170. package/dist/utils/storage-policy.fixtures.json +174 -0
  171. package/dist/utils/storage-policy.js +193 -0
  172. package/dist/utils/upload-session.d.ts +15 -1
  173. package/dist/utils/upload-session.js +68 -2
  174. package/dist/utils/version-file-browser.d.ts +13 -0
  175. package/dist/utils/version-file-browser.js +59 -0
  176. package/package.json +20 -1
  177. package/dist/contracts/mounts.d.ts +0 -142
  178. package/dist/contracts/mounts.js +0 -56
  179. package/dist/utils/access-grant.d.ts +0 -14
  180. package/dist/utils/access-grant.js +0 -88
  181. package/dist/utils/access-match.d.ts +0 -46
  182. package/dist/utils/access-match.fixtures.json +0 -513
  183. package/dist/utils/access-match.js +0 -312
  184. package/dist/utils/access-verdict.fixtures.json +0 -421
  185. package/dist/utils/asset-fingerprint.d.ts +0 -53
  186. package/dist/utils/asset-fingerprint.js +0 -574
  187. package/dist/utils/sf-config-v1.d.ts +0 -2
  188. package/dist/utils/sf-config-v1.fixtures.json +0 -9
  189. package/dist/utils/sf-config-v1.js +0 -551
@@ -1,32 +1,29 @@
1
1
  import { z } from "zod";
2
+ import { SPACE_SLUG_MAX_LENGTH } from "../slug-policy/index.js";
3
+ import { publishedAccessSchema } from "./access.js";
2
4
  import { AsyncOperationSchema, baseDiagnosticSchema, CursorPaginationSchema, cursorListQuerySchema, } from "./common.js";
3
5
  import { versionStatus, spaceStatus } from "./enums.js";
6
+ import { runtimeKindSchema } from "./execution.js";
4
7
  import { conventionFilesSchema, uploadInstructionsSchema, manifestFileSchema } from "./internal.js";
5
8
  import { VersionSchema, PublishSourceSchema, SpaceSchema, spaceSettingsDigestSchema, } from "./resources.js";
6
- import { spaceConfigSchema, spacePlacementConfigSchema } from "./space-config.js";
9
+ import { runtimeAppSchema } from "./runtime-app.js";
10
+ import { SPACE_CONFIG_ACCEPTED_FILES, spaceConfigSchema, spacePlacementConfigSchema, } from "./space-config.js";
7
11
  import { principalIdSchema } from "./transfers.js";
8
- import { zeroRuntimeKindSchema } from "./zero.js";
9
- export const AnonymousSpaceAccessSchema = z.object({
10
- claimToken: z
11
- .string()
12
- .nullable()
13
- .describe("One-time, space-scoped credential returned only at anonymous space creation. Save it immediately — it is never shown again and is required to publish and manage the space until it is claimed."),
14
- claimUrl: z
12
+ export const spaceClaimReceiptSchema = z.object({
13
+ token: z
15
14
  .string()
16
- .nullable()
17
- .describe("Browser-only claim link in `/claim#nonce` form. The fragment is a human handoff capability; API clients use the claim token as bearer auth for publish/update/status/exchange."),
18
- expiresAt: z
19
- .string()
20
- .datetime()
21
- .nullable()
22
- .describe("When the unclaimed space expires if nobody publishes to it or claims it."),
23
- warning: z
15
+ .min(1)
16
+ .describe("One-time, space-scoped credential returned only at anonymous space creation. Save it immediately. The server never shows it again. You need it to publish and manage the space until the space is claimed."),
17
+ url: z
24
18
  .string()
25
- .describe("Human-readable notice explaining that the space is anonymous and will expire unless claimed."),
19
+ .url()
20
+ .describe("Browser-only claim link with a short-lived, one-use path token. The access origin consumes it into an HttpOnly handoff, then redirects to a clean claim page. API clients use the separate claim token as bearer auth for publish, update, status, and exchange."),
21
+ expiresAt: z.string().datetime(),
26
22
  });
27
23
  export const SpaceCreateResponseSchema = z.object({
28
24
  space: SpaceSchema,
29
- anonymousAccess: AnonymousSpaceAccessSchema.optional(),
25
+ access: publishedAccessSchema,
26
+ claim: spaceClaimReceiptSchema.optional(),
30
27
  });
31
28
  // Stored per-version diagnostic surfaced on the space diagnostics feed: the shared
32
29
  // Diagnostic shape (contracts/common.ts) plus persistence identity.
@@ -70,31 +67,39 @@ export const spaceCreateSchema = z
70
67
  export const spacePatchSchema = z
71
68
  .object({
72
69
  title: z.string().min(1).max(255).optional(),
70
+ slug: z
71
+ .string()
72
+ .min(2)
73
+ .max(SPACE_SLUG_MAX_LENGTH)
74
+ .optional()
75
+ .describe("Renames the space and its managed view.fast hostname. Send slug by itself. Previously managed hostnames keep a temporary 307 redirect that preserves path and query to the current hostname. Immutable version URLs do not change."),
73
76
  config: spaceConfigSchema
74
77
  .nullable()
75
78
  .optional()
76
79
  .describe("Replaces the stored SpaceConfig overlay; null clears it."),
77
80
  baseSettingsDigest: spaceSettingsDigestSchema
78
81
  .optional()
79
- .describe("Optimistic-concurrency base for versioned settings (title/config): the `settingsDigest` read from the Space resource when the form was loaded. When provided and the space's current settings digest no longer matches, the PATCH fails with 409 publish_base_changed and changes nothing."),
82
+ .describe("Optimistic-concurrency base for versioned settings (title and config): the `settingsDigest` read from the Space resource when the form loaded. If provided and the space's current settings digest no longer matches, the PATCH fails with 409 `publish_base_changed` and changes nothing."),
80
83
  force: z
81
84
  .boolean()
82
85
  .optional()
83
- .describe("With baseSettingsDigest: acknowledge a changed base and overwrite anyway. The forced overwrite is recorded in the space activity feed. Never the default."),
86
+ .describe("With `baseSettingsDigest`, acknowledge a changed base and overwrite anyway. The server records the forced overwrite in the space activity feed. This is never the default."),
84
87
  dataLocation: z.string().min(1).optional(),
85
88
  placement: spacePlacementConfigSchema.optional(),
86
89
  noindex: z
87
90
  .boolean()
88
91
  .optional()
89
- .describe("Hide the live production site from search engines. Applies only to claimed spaces' live hostnames; preview and version hostnames are always noindex."),
92
+ .describe("Hide the live production site from search engines. This applies only to live hostnames of claimed spaces. Preview and version hostnames are always noindex."),
90
93
  })
91
- // Strict so an unknown field (notably `slug`) is rejected with a validation
92
- // error rather than silently stripped. Slug rename is a deliberately
93
- // post-flip surface (its dormant reserve/commit core + retained-hostname 308
94
- // serving land with the slug-rename activation card); accepting-and-dropping
95
- // `slug` here would be a silent no-op, so the live PATCH must refuse it.
96
94
  .strict()
97
95
  .superRefine((value, ctx) => {
96
+ if (value.slug !== undefined && Object.keys(value).some((key) => key !== "slug")) {
97
+ ctx.addIssue({
98
+ code: z.ZodIssueCode.custom,
99
+ message: "slug must be updated in a separate request.",
100
+ path: ["slug"],
101
+ });
102
+ }
98
103
  if (value.force === true && value.baseSettingsDigest === undefined) {
99
104
  ctx.addIssue({
100
105
  code: z.ZodIssueCode.custom,
@@ -108,7 +113,7 @@ export const spaceClaimSchema = z
108
113
  claimToken: z
109
114
  .string()
110
115
  .min(1)
111
- .describe("One-time claim token returned at anonymous creation. API clients send it as bearer auth; browser claim links carry a separate nonce fragment."),
116
+ .describe("One-time claim token returned at anonymous creation. API clients send it as bearer auth; browser claim links carry a separate browser handoff credential."),
112
117
  teamId: z
113
118
  .string()
114
119
  .min(1)
@@ -122,7 +127,7 @@ export const spaceClaimSchema = z
122
127
  agentContinuation: z
123
128
  .boolean()
124
129
  .optional()
125
- .describe("User consent to keep the publishing agent authorized after the claim. The server independently proves continuation eligibility; consent cannot grant continuation for an ineligible space."),
130
+ .describe("User consent to keep the publishing agent authorized after the claim. The server independently proves continuation eligibility. Consent cannot grant continuation for an ineligible space."),
126
131
  })
127
132
  .superRefine((value, ctx) => {
128
133
  if (value.teamId && value.targetTeamId && value.teamId !== value.targetTeamId) {
@@ -135,18 +140,18 @@ export const spaceClaimSchema = z
135
140
  });
136
141
  export const anonymousClaimAssignSchema = z.object({
137
142
  teamId: z.string().min(1).optional(),
138
- nonce: z.string().min(1).optional().describe("Browser claim nonce from the claim URL fragment."),
143
+ nonce: z.string().min(1).optional().describe("Browser claim nonce from the claim handoff."),
139
144
  agentContinuation: z
140
145
  .boolean()
141
146
  .optional()
142
- .describe("User consent to keep the publishing agent authorized after the claim. The server independently proves continuation eligibility; consent cannot grant continuation for an ineligible space."),
147
+ .describe("User consent to keep the publishing agent authorized after the claim. The server independently proves continuation eligibility. Consent cannot grant continuation for an ineligible space."),
143
148
  });
144
149
  export const anonymousClaimResolveSchema = z.object({
145
- nonce: z.string().min(1).optional().describe("Browser claim nonce from the claim URL fragment."),
150
+ nonce: z.string().min(1).optional().describe("Browser claim nonce from the claim handoff."),
146
151
  agentContinuation: z
147
152
  .boolean()
148
153
  .optional()
149
- .describe("User consent applied when resolve auto-claims. The server independently proves continuation eligibility; consent cannot grant continuation for an ineligible space."),
154
+ .describe("User consent applied when resolve auto-claims. The server independently proves continuation eligibility. Consent cannot grant continuation for an ineligible space."),
150
155
  });
151
156
  export const anonymousClaimTeamSchema = z.object({
152
157
  id: z.string(),
@@ -159,6 +164,25 @@ export const anonymousClaimSpacePreviewSchema = z.object({
159
164
  liveUrl: z.string().nullable(),
160
165
  createdAt: z.string().datetime().nullable(),
161
166
  });
167
+ export const anonymousClaimSharingSummarySchema = z.object({
168
+ people: z.array(z.object({
169
+ id: z.string(),
170
+ displayName: z.string(),
171
+ status: z.enum(["pending", "accepted"]),
172
+ grants: z.array(z.object({
173
+ scope: z.string().startsWith("/"),
174
+ role: z.enum(["viewer", "commenter", "editor"]),
175
+ })),
176
+ })),
177
+ links: z.array(z.object({
178
+ id: z.string(),
179
+ revision: z.number().int().positive(),
180
+ name: z.string(),
181
+ landingPath: z.string().startsWith("/"),
182
+ scopes: z.array(z.string().startsWith("/")),
183
+ expiresAt: z.string().datetime().nullable(),
184
+ })),
185
+ });
162
186
  export const anonymousClaimResponseSchema = z.object({
163
187
  state: z.enum(["unclaimed", "claimed"]),
164
188
  action: z.enum(["claimed", "login_required", "team_required", "confirm_assign"]),
@@ -167,17 +191,19 @@ export const anonymousClaimResponseSchema = z.object({
167
191
  expiresAt: z.string().datetime().nullable(),
168
192
  claimedAt: z.string().datetime().nullable(),
169
193
  }),
194
+ access: publishedAccessSchema,
170
195
  continuation: z
171
196
  .object({
172
197
  eligible: z
173
198
  .boolean()
174
- .describe("Server-proven: the publish intent records an originating agent holding the claim token, the one-time exchange is unredeemed, and a safe secretless return exists. Only then may the UI offer continuation."),
199
+ .describe("Server-proven continuation eligibility. Eligible means the publish intent records an originating agent that holds the claim token, the one-time exchange is unredeemed, and a safe secretless return exists. Only then can the UI offer continuation."),
175
200
  granted: z
176
201
  .boolean()
177
- .describe("True once the claim left the one-time continuation exchange open for the originating agent."),
202
+ .describe("Whether the claim left the one-time continuation exchange open for the originating agent."),
178
203
  })
179
204
  .describe("Server-authoritative continuation eligibility and claim result."),
180
205
  teams: z.array(anonymousClaimTeamSchema).optional(),
206
+ sharing: anonymousClaimSharingSummarySchema,
181
207
  });
182
208
  export const anonymousClaimStatusResponseSchema = z.object({
183
209
  publish: z.object({
@@ -203,8 +229,9 @@ export const anonymousClaimStatusResponseSchema = z.object({
203
229
  continuation: z
204
230
  .enum(["available", "used", "unavailable"])
205
231
  .optional()
206
- .describe("Present once the space is claimed: whether this claim token can still be exchanged once for a durable access token (POST /v1/anonymous-claim/exchange)."),
232
+ .describe("Present once the space is claimed. Whether this claim token can still be exchanged once for a durable API key (POST /v1/anonymous-claim/exchange)."),
207
233
  }),
234
+ access: publishedAccessSchema,
208
235
  });
209
236
  export const anonymousClaimExchangeResponseSchema = z.object({
210
237
  space: z.object({
@@ -215,12 +242,26 @@ export const anonymousClaimExchangeResponseSchema = z.object({
215
242
  credential: z.object({
216
243
  accessToken: z
217
244
  .string()
218
- .describe("Durable publish access token minted by the one-time exchange. Shown exactly once store it (e.g. .spacefast/state.json) and never print it."),
245
+ .describe("Durable publish API key minted by the one-time exchange. Shown exactly once. Store it (for example, in .spacefast/state.json) and never print it."),
219
246
  accessTokenId: z.string(),
220
247
  label: z.string().nullable(),
221
248
  teamId: z.string(),
222
249
  }),
223
250
  });
251
+ export const anonymousClaimRotateSchema = z.object({
252
+ spaceId: z.string().min(1),
253
+ });
254
+ export const anonymousClaimRotateResponseSchema = z.object({
255
+ spaceId: z.string(),
256
+ claimToken: z
257
+ .string()
258
+ .describe("Replacement claim token. Shown exactly once; store it before leaving this response."),
259
+ claimNonce: z
260
+ .string()
261
+ .describe("Replacement browser claim nonce embedded in claimUrl. Shown exactly once."),
262
+ claimUrl: z.string().url(),
263
+ expiresAt: z.string().datetime(),
264
+ });
224
265
  export const spaceClaimReminderSchema = z.object({
225
266
  email: z
226
267
  .string()
@@ -238,28 +279,14 @@ const manifestMutationFieldsSchema = {
238
279
  deletePaths: z
239
280
  .array(z.string().min(1))
240
281
  .default([])
241
- .describe("Explicit paths to remove when publishMode is additive. Omitted paths are retained; only paths listed here are deleted."),
282
+ .describe("Explicit paths to remove when `publishMode` is additive. Omitted paths are retained. Only listed paths are deleted."),
242
283
  immutableAssetPrefixes: z
243
284
  .array(z.string().min(2))
244
285
  .optional()
245
- .describe("Publisher-owned directory prefixes whose declared files are immutable generation assets. Snapshot publishes retain the current generation's matching files for exactly one subsequent generation."),
286
+ .describe("Publisher-owned directory prefixes whose declared files are immutable generation assets. Snapshot publishes retain the matching files from the current generation for exactly one subsequent generation."),
246
287
  };
247
288
  function refineManifestMutationRules(value, ctx) {
248
- if (value.files === undefined && value.deletePaths.length > 0) {
249
- ctx.addIssue({
250
- code: z.ZodIssueCode.custom,
251
- message: "deletePaths requires a declared files manifest.",
252
- path: ["deletePaths"],
253
- });
254
- }
255
289
  if (value.immutableAssetPrefixes !== undefined) {
256
- if (value.files === undefined) {
257
- ctx.addIssue({
258
- code: z.ZodIssueCode.custom,
259
- message: "immutableAssetPrefixes requires a declared files manifest.",
260
- path: ["immutableAssetPrefixes"],
261
- });
262
- }
263
290
  if (value.publishMode !== "snapshot") {
264
291
  ctx.addIssue({
265
292
  code: z.ZodIssueCode.custom,
@@ -275,16 +302,16 @@ export const spaceVersionCreateSchema = z
275
302
  publishMode: z
276
303
  .enum(["additive", "snapshot"])
277
304
  .default("additive")
278
- .describe("How to interpret omitted paths in files: additive retains existing paths unless explicitly replaced; snapshot treats files as the complete desired manifest."),
305
+ .describe("How to interpret omitted paths in `files`: `additive` retains existing paths unless explicitly replaced; `snapshot` treats `files` as the complete desired manifest."),
279
306
  sourceMetadata: z
280
307
  .record(z.string(), z.unknown())
281
308
  .optional()
282
- .describe("Additional control-plane-only provenance for build/deploy read models."),
309
+ .describe("Additional control-plane-only provenance for build and deploy read models."),
283
310
  buildLog: z
284
311
  .string()
285
312
  .max(64_000)
286
313
  .optional()
287
- .describe("Bounded build transcript for deploys that ran a local build before publishing."),
314
+ .describe("Build transcript truncated to a bounded size for deploys that ran a local build before publishing."),
288
315
  conventionFiles: conventionFilesSchema
289
316
  .optional()
290
317
  .describe("Routing convention contents used when deciding whether this publish is unchanged. The same values are supplied again when the version is finalized."),
@@ -294,8 +321,7 @@ export const spaceVersionCreateSchema = z
294
321
  .describe("Finalize intent for a declared upload. When every declared file lands, the version finalizes itself; the explicit finalize call remains available for recovery and replay."),
295
322
  files: z
296
323
  .array(manifestFileSchema)
297
- .optional()
298
- .describe("Full desired file manifest. For first deploys, send path/size/contentType without hashes so upload can begin immediately. For updates, include sha256 to let the server skip unchanged files. Omit entirely for an open session: the upload token then authorizes any policy-valid path within plan caps and finalize derives the manifest from what was uploaded."),
324
+ .describe("The complete desired file manifest. For first deploys, send `path`, `size`, and `contentType` without hashes so upload can begin immediately. For updates, include `sha256` so the server can skip unchanged files."),
299
325
  ...manifestMutationFieldsSchema,
300
326
  })
301
327
  .superRefine(refineManifestMutationRules);
@@ -308,12 +334,16 @@ export const spaceListSchema = z.object({
308
334
  pagination: CursorPaginationSchema,
309
335
  });
310
336
  export const spaceListQuerySchema = cursorListQuerySchema.extend({
311
- team: z.string().min(1).optional().describe("Filter to spaces owned by this team id or slug."),
337
+ team: z
338
+ .string()
339
+ .min(1)
340
+ .optional()
341
+ .describe("Filter that limits results to spaces owned by this team id or slug."),
312
342
  });
313
343
  export const spaceVersionListQuerySchema = cursorListQuerySchema;
314
344
  // Version processing log lines (upload/finalize/promote output), newest-first.
315
345
  export const versionLogEntrySchema = z.object({
316
- timestamp: z.string().datetime().describe("When the version last changed state."),
346
+ timestamp: z.string().datetime().describe("Instant when the version last changed state."),
317
347
  level: z.string().describe("Log severity: info or error."),
318
348
  code: z.string().describe("Stable version.{status} code for the line."),
319
349
  message: z.string().describe("Human-readable log line."),
@@ -375,8 +405,10 @@ export const spaceFilesResponseSchema = z.object({
375
405
  index: spaceVersionFileIndexSchema,
376
406
  search: spaceVersionFilesSearchSchema,
377
407
  });
378
- export const spaceVersionFileQuerySchema = z.object({
408
+ export const spaceVersionFilePathQuerySchema = z.object({
379
409
  path: z.string().min(1),
410
+ });
411
+ export const spaceVersionFileQuerySchema = spaceVersionFilePathQuerySchema.extend({
380
412
  download: z.string().optional(),
381
413
  });
382
414
  export const spaceVersionFileResponseSchema = z.object({
@@ -390,13 +422,6 @@ export const spaceVersionFileResponseSchema = z.object({
390
422
  truncated: z.boolean(),
391
423
  cached: z.boolean(),
392
424
  });
393
- export const spaceVersionFileDirectUrlResponseSchema = z.object({
394
- versionId: z.string(),
395
- path: z.string(),
396
- url: z.string().url(),
397
- managementHostname: z.string(),
398
- expiresInSeconds: z.number().int().positive(),
399
- });
400
425
  export const spaceVersionFileUrlPreviewSchema = z.object({
401
426
  versionId: z.string(),
402
427
  path: z.string(),
@@ -448,8 +473,22 @@ export const spaceVersionConventionArtifactContentResponseSchema = spaceVersionC
448
473
  content: z.string(),
449
474
  truncated: z.boolean(),
450
475
  });
476
+ /**
477
+ * Where a routing diagnostic came from — a committed path in the version the
478
+ * publisher can open. Wider than the convention artifacts: the Spacefast config
479
+ * file states routing rules too, and they compile through the same compiler and
480
+ * report the same codes. Every accepted config filename is listed because
481
+ * finalize reads whichever one the version ships, and naming the canonical
482
+ * `sf.jsonc` at a version that committed `spacefast.jsonc` sends the publisher
483
+ * to a file that is not there.
484
+ */
485
+ export const spaceVersionRoutingDiagnosticFileSchema = z.enum([
486
+ "_redirects",
487
+ "_headers",
488
+ ...SPACE_CONFIG_ACCEPTED_FILES,
489
+ ]);
451
490
  export const spaceVersionRoutingDiagnosticSchema = z.object({
452
- file: spaceVersionConventionArtifactPathSchema,
491
+ file: spaceVersionRoutingDiagnosticFileSchema,
453
492
  line: z.number().int().nonnegative(),
454
493
  severity: z.enum(["warning", "error"]),
455
494
  code: z.string(),
@@ -466,7 +505,6 @@ export const spaceVersionComputedRoutingSummarySchema = z.object({
466
505
  headerRuleCount: z.number().int().nonnegative(),
467
506
  staticRedirectCount: z.number().int().nonnegative(),
468
507
  dynamicRedirectCount: z.number().int().nonnegative(),
469
- basicAuthRuleCount: z.number().int().nonnegative(),
470
508
  proxyRuleCount: z.number().int().nonnegative(),
471
509
  }),
472
510
  diagnostics: z.array(spaceVersionRoutingDiagnosticSchema),
@@ -527,7 +565,7 @@ export const spaceVersionIntentResponseSchema = z.object({
527
565
  .describe("Created version id, or null when the manifest matched and nothing changed."),
528
566
  upload: uploadInstructionsSchema
529
567
  .nullable()
530
- .describe("Runtime upload session, present only while bytes still need uploading. Upload, then finalize."),
568
+ .describe("Runtime upload session; present only while bytes still need uploading. Upload first, then finalize."),
531
569
  ignoredPaths: z
532
570
  .array(z.string())
533
571
  .default([])
@@ -541,8 +579,7 @@ export const publishRequestSchema = z
541
579
  principal: principalRefInputSchema.optional(),
542
580
  files: z
543
581
  .array(manifestFileSchema)
544
- .optional()
545
- .describe("Desired file manifest for a declared publish session. Clients upload returned paths, then finalize. Omit for inline one-shot and open-session publishes."),
582
+ .describe("Desired file manifest for a declared publish session. Clients upload returned paths, then finalize."),
546
583
  ...manifestMutationFieldsSchema,
547
584
  source: PublishSourceSchema.optional().describe('Publish provenance recorded on the version; defaults to {kind: "direct_upload"}.'),
548
585
  // Same fields, same bounds as spaceVersionCreateSchema: a publish that ran
@@ -560,13 +597,13 @@ export const publishRequestSchema = z
560
597
  publishMode: z
561
598
  .enum(["additive", "snapshot"])
562
599
  .default("additive")
563
- .describe("How to interpret omitted paths in files: additive retains existing paths unless explicitly replaced; snapshot treats files as the complete desired manifest."),
600
+ .describe("How to interpret omitted paths in `files`: `additive` retains existing paths unless explicitly replaced; `snapshot` treats `files` as the complete desired manifest."),
564
601
  email: z
565
602
  .string()
566
603
  .email()
567
604
  .max(320)
568
605
  .optional()
569
- .describe("Optional expiry-reminder address for anonymous publishes. Stored only until the space is claimed or expires, then deleted; never logged."),
606
+ .describe("Optional expiry-reminder address for anonymous publishes. The server stores it only until the space is claimed or expires, then deletes it. It is never logged."),
570
607
  channel: z
571
608
  .enum(["live"])
572
609
  .nullable()
@@ -579,9 +616,7 @@ export const publishRequestSchema = z
579
616
  dataLocation: z.string().min(1).optional(),
580
617
  })
581
618
  .optional(),
582
- config: spaceConfigSchema
583
- .optional()
584
- .describe("SpaceConfig overlay to store on the space (sf.jsonc contents)."),
619
+ config: spaceConfigSchema.optional().describe("SpaceConfig overlay to store on the space."),
585
620
  })
586
621
  .superRefine((value, ctx) => {
587
622
  if (value.teamId && value.principal?.type === "team" && value.teamId !== value.principal.id) {
@@ -618,7 +653,7 @@ export const publishActivationSchema = z.object({
618
653
  channel: z
619
654
  .enum(["live"])
620
655
  .nullable()
621
- .describe("Channel this publish targeted. null = ready version without promotion."),
656
+ .describe("Channel this publish targeted; null means a ready version without promotion."),
622
657
  outcome: z
623
658
  .enum(["activated", "unpromoted", "superseded", "pending"])
624
659
  .describe("activated: the live pointer moved to this version. unpromoted: ready with channel null, by request. superseded: ready, but a newer publish holds the live pointer. pending: not settled yet."),
@@ -633,7 +668,7 @@ export const publishActivationSchema = z.object({
633
668
  export const publishNextSchema = z.object({
634
669
  action: z
635
670
  .enum(["done", "upload", "finalize", "poll"])
636
- .describe("done: stop, this request's intent is settled. upload: PUT the upload targets, then follow the finalize link. finalize: all bytes are present, POST url to commit. poll: server-side work in flight, GET url after retryAfter seconds."),
671
+ .describe("What the caller does next: `done` (stop; this request intent is settled), `upload` (PUT upload targets, then follow the finalize link), `finalize` (all bytes are present, POST `url` to commit), or `poll` (server-side work is in flight, GET `url` after `retryAfter` seconds)."),
637
672
  url: z.string().optional().describe("The endpoint the action applies to."),
638
673
  retryAfter: z
639
674
  .number()
@@ -641,29 +676,21 @@ export const publishNextSchema = z.object({
641
676
  .positive()
642
677
  .optional()
643
678
  .describe("Polling cadence in seconds; present only when action is poll."),
644
- hint: z.string().max(140).describe("One plain sentence for an agent mid-loop."),
679
+ hint: z.string().max(140).describe("One plain sentence for an agent in the middle of a loop."),
645
680
  });
646
681
  export const publishReceiptSchema = z.object({
647
682
  space: publishReceiptSpaceSchema,
683
+ access: publishedAccessSchema.optional(),
648
684
  version: publishReceiptVersionSchema,
649
685
  activation: publishActivationSchema,
650
686
  next: publishNextSchema,
651
687
  operation: AsyncOperationSchema.optional().describe("Background finalize operation when publish work continues asynchronously."),
652
- // Paste-ready one-liner (URL + claim nudge) so agents propagate consistent
653
- // claim copy into transcripts (internal-docs/platform.md M1a "share blurb").
654
- shareBlurb: z.string(),
655
688
  upload: publishUploadReceiptSchema.optional(),
656
- claim: z
657
- .object({
658
- token: z.string().optional(),
659
- url: z.string(),
660
- expiresAt: z.string().datetime(),
661
- })
662
- .optional(),
689
+ claim: spaceClaimReceiptSchema.optional(),
663
690
  diagnostics: z
664
691
  .array(baseDiagnosticSchema)
665
692
  .optional()
666
- .describe("Publish diagnostics: the `noop_publish` info diagnostic when nothing changed (the only noop signal), manifest warnings such as `path_case_collision`, and serving-shape notes such as `single_html_index` or `files_mode_inferred`."),
693
+ .describe("Publish diagnostics. Includes the `noop_publish` info diagnostic when nothing changed (the only noop signal), manifest warnings such as `path_case_collision`, and serving-shape notes such as `single_html_index` or `files_mode_inferred`."),
667
694
  links: z
668
695
  .object({
669
696
  resume: z
@@ -695,7 +722,7 @@ export const spaceVersionResumeResponseSchema = z.object({
695
722
  versionId: z.string(),
696
723
  upload: uploadInstructionsSchema
697
724
  .nullable()
698
- .describe("Fresh runtime upload session, present only while files still need uploading. Upload, then finalize."),
725
+ .describe("Fresh runtime upload session; present only while files still need uploading. Upload first, then finalize."),
699
726
  ignoredPaths: z
700
727
  .array(z.string())
701
728
  .default([])
@@ -711,7 +738,7 @@ export const versionPromoteSchema = z
711
738
  .string()
712
739
  .min(1)
713
740
  .optional()
714
- .describe('Channel to point at this version; defaults to "live". Non-live channel names are rejected with channel_unsupported until additional channels ship.'),
741
+ .describe('Channel to point at this version. Defaults to "live". Non-live channel names are rejected with `channel_unsupported` until additional channels ship.'),
715
742
  })
716
743
  .optional()
717
744
  .default({});
@@ -730,25 +757,28 @@ export const spaceRuntimeStatusSchema = z.object({
730
757
  liveVersionId: z
731
758
  .string()
732
759
  .nullable()
733
- .describe("Version that the live space URL currently points to, if any."),
760
+ .describe("Version that the live space URL now points to, if any."),
734
761
  pendingVersionId: z
735
762
  .string()
736
763
  .nullable()
737
- .describe("Version that live traffic is trying to publish, if any."),
764
+ .describe("Version that live traffic is trying to publish now, if any."),
738
765
  liveUrl: z
739
766
  .string()
740
767
  .nullable()
741
- .describe("Live space URL. Flips to the latest version after a successful publish to `live`."),
768
+ .describe("Live space URL. It moves to the latest version after a successful publish to `live`."),
742
769
  runtimeState: spaceStatus.describe("Space operation-lifecycle status."),
743
770
  liveVersionStatus: versionStatus.nullable(),
744
- liveRuntimeKind: zeroRuntimeKindSchema
771
+ liveRuntimeKind: runtimeKindSchema
745
772
  .nullable()
746
773
  .describe("Runtime kind declared by the live version, if any."),
747
774
  pendingVersionStatus: versionStatus.nullable(),
748
775
  operation: AsyncOperationSchema.nullable(),
776
+ app: runtimeAppSchema
777
+ .nullable()
778
+ .describe("What the live version runs: its Zero capsule or Functions worker, discriminated by `runtimeKind`. Null for a static space. Also null for callers whose credential does not carry `versions:read`, because app details read version contents, not serving state."),
749
779
  });
750
780
  export const spaceApplyChangeBaseSchema = z.object({
751
- kind: z.enum(["variable", "routing", "password", "settings"]),
781
+ kind: z.enum(["variable", "routing", "access", "settings"]),
752
782
  name: z.string(),
753
783
  label: z.string(),
754
784
  });
@@ -7,12 +7,12 @@ export declare const superadminEmailListQuerySchema: z.ZodObject<{
7
7
  status: z.ZodDefault<z.ZodEnum<{
8
8
  all: "all";
9
9
  failed: "failed";
10
- delivered: "delivered";
11
- dropped: "dropped";
12
10
  scheduled: "scheduled";
11
+ delivered: "delivered";
13
12
  sent: "sent";
14
13
  suppressed: "suppressed";
15
14
  bounced: "bounced";
15
+ dropped: "dropped";
16
16
  complained: "complained";
17
17
  opened: "opened";
18
18
  clicked: "clicked";