@spacefast/common 0.0.24 → 0.0.26

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 (145) hide show
  1. package/brand-assets/LICENSE-Haskoy.txt +93 -0
  2. package/brand-assets/haskoy-latin-variable.woff2 +0 -0
  3. package/brand-assets/spacefast-favicon.svg +4 -4
  4. package/brand-assets/spacefast-sf-full-bleed.svg +3 -3
  5. package/brand-assets/spacefast-wordmark.svg +2 -4
  6. package/dist/agents/connect-targets.js +1 -1
  7. package/dist/agents/private-key-oauth.d.ts +0 -1
  8. package/dist/agents/private-key-oauth.js +46 -63
  9. package/dist/brand-assets-build.js +4 -6
  10. package/dist/brand-assets.d.ts +5 -15
  11. package/dist/brand-assets.js +15 -14
  12. package/dist/config/domains.d.ts +47 -7
  13. package/dist/config/domains.js +65 -10
  14. package/dist/contracts/access.d.ts +3 -3
  15. package/dist/contracts/activity.d.ts +1 -1
  16. package/dist/contracts/activity.js +5 -3
  17. package/dist/contracts/api-keys.js +2 -2
  18. package/dist/contracts/billing.d.ts +2 -1
  19. package/dist/contracts/billing.js +30 -0
  20. package/dist/contracts/builds.d.ts +34 -22
  21. package/dist/contracts/builds.js +18 -6
  22. package/dist/contracts/channels.js +1 -1
  23. package/dist/contracts/comments.d.ts +1 -1
  24. package/dist/contracts/common.d.ts +6 -6
  25. package/dist/contracts/common.js +5 -5
  26. package/dist/contracts/crons.d.ts +35 -0
  27. package/dist/contracts/crons.js +42 -0
  28. package/dist/contracts/device-auth.js +1 -1
  29. package/dist/contracts/docs.d.ts +5 -5
  30. package/dist/contracts/docs.js +2 -2
  31. package/dist/contracts/domains.d.ts +74 -63
  32. package/dist/contracts/domains.js +29 -2
  33. package/dist/contracts/enums.d.ts +3 -2
  34. package/dist/contracts/enums.js +10 -10
  35. package/dist/contracts/error-code-meta.d.ts +14 -0
  36. package/dist/contracts/error-code-meta.js +17 -0
  37. package/dist/contracts/error-codes.d.ts +1 -1
  38. package/dist/contracts/error-codes.js +4 -1
  39. package/dist/contracts/execution.d.ts +15 -12
  40. package/dist/contracts/execution.js +15 -12
  41. package/dist/contracts/feature-lifecycle.d.ts +4 -14
  42. package/dist/contracts/feature-lifecycle.js +0 -11
  43. package/dist/contracts/features.d.ts +33 -47
  44. package/dist/contracts/features.js +27 -20
  45. package/dist/contracts/functions.d.ts +169 -2
  46. package/dist/contracts/functions.js +160 -4
  47. package/dist/contracts/git.d.ts +27 -33
  48. package/dist/contracts/git.js +10 -11
  49. package/dist/contracts/grants.d.ts +2 -2
  50. package/dist/contracts/ids.js +2 -2
  51. package/dist/contracts/internal.d.ts +5 -16
  52. package/dist/contracts/internal.js +2 -12
  53. package/dist/contracts/mcp.d.ts +11 -0
  54. package/dist/contracts/mcp.js +5 -0
  55. package/dist/contracts/me.js +1 -1
  56. package/dist/contracts/operations.d.ts +4 -4
  57. package/dist/contracts/operations.js +2 -2
  58. package/dist/contracts/pages.d.ts +6 -6
  59. package/dist/contracts/plan-policy.d.ts +1 -1
  60. package/dist/contracts/plan-policy.js +1 -1
  61. package/dist/contracts/platform.d.ts +4 -4
  62. package/dist/contracts/publish-archive.d.ts +170 -160
  63. package/dist/contracts/publish-archive.js +8 -1
  64. package/dist/contracts/push-new.d.ts +4 -4
  65. package/dist/contracts/quotas.js +2 -2
  66. package/dist/contracts/repository-connections.d.ts +43 -30
  67. package/dist/contracts/repository-connections.js +11 -3
  68. package/dist/contracts/resources.d.ts +8 -8
  69. package/dist/contracts/resources.js +6 -6
  70. package/dist/contracts/runtime-api.d.ts +103 -56
  71. package/dist/contracts/runtime-api.js +67 -26
  72. package/dist/contracts/runtime-app.d.ts +2 -2
  73. package/dist/contracts/runtime-db.d.ts +6 -6
  74. package/dist/contracts/runtime-db.js +2 -2
  75. package/dist/contracts/runtime-purge.d.ts +8 -0
  76. package/dist/contracts/runtime-purge.js +7 -0
  77. package/dist/contracts/runtime-storage.d.ts +3 -2
  78. package/dist/contracts/runtime-storage.js +2 -1
  79. package/dist/contracts/sf-config-v1.d.ts +48 -10
  80. package/dist/contracts/space-config.d.ts +60 -3
  81. package/dist/contracts/space-config.js +213 -18
  82. package/dist/contracts/spaces.d.ts +55 -74
  83. package/dist/contracts/spaces.js +11 -14
  84. package/dist/contracts/superadmin-spaces.d.ts +9 -9
  85. package/dist/contracts/superadmin-teams.d.ts +2 -2
  86. package/dist/contracts/superadmin-tenants.d.ts +0 -6
  87. package/dist/contracts/superadmin-tenants.js +1 -7
  88. package/dist/contracts/superadmin.d.ts +135 -22
  89. package/dist/contracts/superadmin.js +43 -12
  90. package/dist/contracts/tags.d.ts +21 -21
  91. package/dist/contracts/tags.js +3 -3
  92. package/dist/contracts/teams.d.ts +14 -17
  93. package/dist/contracts/teams.js +6 -6
  94. package/dist/contracts/transfers.js +2 -2
  95. package/dist/contracts/variables.d.ts +4 -4
  96. package/dist/contracts/variables.js +3 -3
  97. package/dist/contracts/webhooks.d.ts +4 -4
  98. package/dist/contracts/zero.d.ts +15 -17
  99. package/dist/contracts/zero.js +12 -12
  100. package/dist/docs/agent-prose.d.ts +1 -1
  101. package/dist/docs/agent-prose.js +11 -14
  102. package/dist/docs/agent-setup.js +5 -2
  103. package/dist/docs/catalog.d.ts +7 -7
  104. package/dist/docs/catalog.js +7 -7
  105. package/dist/docs/error-docs.js +145 -133
  106. package/dist/docs/skills.d.ts +12 -12
  107. package/dist/docs/skills.js +4 -4
  108. package/dist/test-helpers/fetch-stub.js +1 -0
  109. package/dist/utils/build-settings.d.ts +5 -1
  110. package/dist/utils/build-settings.js +82 -10
  111. package/dist/utils/canonical-json.js +1 -0
  112. package/dist/utils/concurrency.js +1 -0
  113. package/dist/utils/credential-policy.js +4 -3
  114. package/dist/utils/dns-instructions.js +9 -9
  115. package/dist/utils/error-code.js +1 -0
  116. package/dist/utils/grant-decision.fixtures.json +2 -2
  117. package/dist/utils/grants.js +3 -1
  118. package/dist/utils/local-space-state.d.ts +8 -11
  119. package/dist/utils/local-space-state.js +13 -24
  120. package/dist/utils/one-shot-replay.d.ts +4 -1
  121. package/dist/utils/page-colors.d.ts +14 -12
  122. package/dist/utils/page-colors.js +15 -13
  123. package/dist/utils/page-fonts.d.ts +1 -1
  124. package/dist/utils/page-fonts.js +11 -18
  125. package/dist/utils/pages.d.ts +20 -1
  126. package/dist/utils/pages.js +22 -9
  127. package/dist/utils/publish-policy.d.ts +7 -0
  128. package/dist/utils/publish-policy.fixtures.json +11 -5
  129. package/dist/utils/publish-policy.js +9 -1
  130. package/dist/utils/query-keys.d.ts +4 -4
  131. package/dist/utils/query-keys.js +2 -2
  132. package/dist/utils/runtime-upload.d.ts +5 -0
  133. package/dist/utils/runtime-upload.js +7 -0
  134. package/dist/utils/secure-local-file.js +5 -16
  135. package/dist/utils/space-config.d.ts +1 -1
  136. package/dist/utils/space-config.js +3 -0
  137. package/dist/utils/static-runtime-policy.d.ts +9 -3
  138. package/dist/utils/static-runtime-policy.fixtures.json +38 -41
  139. package/dist/utils/static-runtime-policy.js +22 -56
  140. package/dist/utils/upload-session.d.ts +4 -1
  141. package/dist/utils/upload-session.js +33 -5
  142. package/dist/utils/version-path.js +1 -1
  143. package/dist/vocabulary.d.ts +8 -8
  144. package/dist/vocabulary.js +31 -20
  145. package/package.json +2 -17
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { appRoutePathSchema, executionCapabilitiesSchema, executionSha256Schema, httpMethodSchema, } from "./execution.js";
2
+ import { appRoutePathSchema, executionBase64Schema, executionCapabilitiesSchema, executionSha256Schema, httpMethodSchema, } from "./execution.js";
3
3
  /**
4
4
  * Spacefast Functions: tenant workers run as Cloudflare Dynamic Workers.
5
5
  *
@@ -51,7 +51,21 @@ export const FUNCTIONS_RUNTIME_ROUTE_PATHS = {
51
51
  logs: `${FUNCTIONS_PLATFORM_ROUTE_PREFIX}/logs`,
52
52
  /** Where a dispatched worker calls back for brokered capabilities. */
53
53
  relay: `${FUNCTIONS_PLATFORM_ROUTE_PREFIX}/relay`,
54
+ /**
55
+ * Where the execution host asks the space origin to drop cached responses —
56
+ * an OpenNext `revalidatePath` must reach the CDN in front of wp.cloud, and
57
+ * only the origin can speak for its own cache. Authenticated with the
58
+ * version-scoped purge credential in the `sf-purge-token` request header.
59
+ */
60
+ purge: `${FUNCTIONS_PLATFORM_ROUTE_PREFIX}/purge`,
54
61
  };
62
+ /**
63
+ * The header the execution host presents at the origin purge route. Outside the
64
+ * `sf-fx-` namespace on purpose: that prefix names dispatch instructions the
65
+ * origin SENDS, and is stripped from anything inbound before tenant code — a
66
+ * purge call is the host speaking for itself, like a relay call.
67
+ */
68
+ export const FUNCTIONS_PURGE_TOKEN_HEADER = "sf-purge-token";
55
69
  /**
56
70
  * Where invocation counts are reported, on the CONTROL PLANE rather than the
57
71
  * space origin.
@@ -89,7 +103,17 @@ export const FUNCTIONS_RUNTIME_STORAGE_ROOT = "__spacefast/functions";
89
103
  * was never given.
90
104
  */
91
105
  export const FUNCTIONS_RUNTIME_BUNDLE_ROOT = `${FUNCTIONS_RUNTIME_STORAGE_ROOT}/bundles`;
106
+ /**
107
+ * Where a version's Next-cache seed document lives — the build-time prerender
108
+ * and fetch-cache entries that warm the execution host's cache object so the
109
+ * first visitor gets the page the build rendered instead of a live re-render.
110
+ * A sibling of `bundles/` with the same properties: publishable through the
111
+ * ordinary upload path (its own carve-out in publish-policy), never servable
112
+ * as static content, read back only through the signed artifact route.
113
+ */
114
+ export const FUNCTIONS_RUNTIME_SEED_ROOT = `${FUNCTIONS_RUNTIME_STORAGE_ROOT}/seeds`;
92
115
  export const FUNCTIONS_BUNDLE_FORMAT = "spacefast.functions.bundle.v1";
116
+ export const FUNCTIONS_SEED_FORMAT = "spacefast.functions.seed.v1";
93
117
  /**
94
118
  * Ceiling on a bundle's decoded size.
95
119
  *
@@ -100,13 +124,66 @@ export const FUNCTIONS_BUNDLE_FORMAT = "spacefast.functions.bundle.v1";
100
124
  * modules are large, rather than at dispatch, where the tenant sees a 502.
101
125
  */
102
126
  export const FUNCTIONS_BUNDLE_MAX_BYTES = 8 * 1024 * 1024;
127
+ /**
128
+ * Ceilings on the cache seed document. Per-entry mirrors the cache object's
129
+ * own row limit (an entry the object would refuse is dead weight in the
130
+ * document); the total bounds what the host pulls and ingests on a cold
131
+ * cache. Both are enforced in the CLI, where an overflow can say WHICH pages
132
+ * were left out — an omitted entry is not an error, it just renders live on
133
+ * first request like any cache miss.
134
+ */
135
+ export const FUNCTIONS_SEED_ENTRY_MAX_BYTES = 2 * 1024 * 1024 - 8192;
136
+ // The Durable Object buffers the JSON once, then decoding/parsing temporarily
137
+ // holds the text and object graph beside it. Keep the document far below
138
+ // Cloudflare's 128 MiB SHARED-isolate ceiling; several objects can occupy that
139
+ // isolate, and the host enforces this bound again while streaming the response.
140
+ export const FUNCTIONS_SEED_MAX_BYTES = 8 * 1024 * 1024;
141
+ /**
142
+ * One warm-cache entry: exactly what the runtime's incremental-cache client
143
+ * would have written for `key` had it rendered the page itself. `valueJson`
144
+ * is carried as the JSON string it already is on disk (OpenNext's `.cache` /
145
+ * fetch-cache files) — re-parsing it here would only invite the seed writer
146
+ * and the cache client to disagree about serialization.
147
+ */
148
+ export const functionsSeedEntrySchema = z
149
+ .object({
150
+ key: z.string().min(1).max(2048),
151
+ cacheType: z.enum(["cache", "fetch"]),
152
+ valueJson: z.string().min(1),
153
+ /** Epoch milliseconds the entry was built, so staleness math holds. */
154
+ lastModified: z.number().int().nonnegative(),
155
+ })
156
+ .strict();
157
+ /** The document served at a seed URL; host and CLI validate the same shape. */
158
+ export const functionsSeedManifestSchema = z
159
+ .object({
160
+ format: z.literal(FUNCTIONS_SEED_FORMAT),
161
+ entries: z.array(functionsSeedEntrySchema),
162
+ })
163
+ .strict();
103
164
  const functionsRoutePathSchema = appRoutePathSchema({
104
165
  subject: "Function routes",
105
166
  });
167
+ /**
168
+ * How many entries the origin's dispatch table accepts.
169
+ *
170
+ * Exported because the CLI classifier has to compact its route claims BEFORE
171
+ * assembling the artifact — discovering the ceiling as a validation error at
172
+ * finalize would mean a build that classified fine fails at the last step — so
173
+ * the ceiling has to be a value both sides can read, not a literal each side
174
+ * spells for itself.
175
+ */
176
+ export const FUNCTIONS_MAX_ROUTES = 256;
106
177
  /**
107
178
  * A worker's dynamic route table. Anything not matched here is answered from
108
179
  * the version's static content by wp.cloud and never reaches Cloudflare, which
109
180
  * is both the cheaper path and the one that keeps assets ours.
181
+ *
182
+ * A `subtree` entry covers its own path AND everything below it: the engine
183
+ * expands one into both `path` and `path/:splat`
184
+ * (`_stattic_runtime_functions_routes_artifact`, runtime/engine/admin/management.php),
185
+ * which is why `wholeSiteRoutes()` is a single `/` subtree entry and why an
186
+ * exact entry beside a subtree entry at the same path is dead weight.
110
187
  */
111
188
  export const functionsRouteSchema = z
112
189
  .object({
@@ -120,14 +197,17 @@ export const functionsRouteSchema = z
120
197
  * One module in a bundle, in the shape the Worker Loader consumes.
121
198
  *
122
199
  * `commonjs` exists because bundlers still emit it and rejecting it would fail
123
- * builds for a format the runtime accepts. Binary module types are deliberately
124
- * absent: nothing we build today emits them, and adding one later is additive.
200
+ * builds for a format the runtime accepts. Binary modules cross this JSON wire
201
+ * format as base64; the Functions host turns them back into ArrayBuffers at the
202
+ * Worker Loader boundary.
125
203
  */
126
204
  export const functionsBundleModuleSchema = z.union([
127
205
  z.object({ js: z.string() }).strict(),
128
206
  z.object({ cjs: z.string() }).strict(),
129
207
  z.object({ text: z.string() }).strict(),
130
208
  z.object({ json: z.unknown() }).strict(),
209
+ z.object({ wasm: executionBase64Schema }).strict(),
210
+ z.object({ data: executionBase64Schema }).strict(),
131
211
  ]);
132
212
  /**
133
213
  * The document served at a bundle URL and parsed by the host.
@@ -168,6 +248,25 @@ export const functionsBundleRefSchema = z
168
248
  size: z.number().int().nonnegative().max(FUNCTIONS_BUNDLE_MAX_BYTES),
169
249
  })
170
250
  .strict();
251
+ /**
252
+ * Where a version's cache seed document sits in its content store — the
253
+ * bundle ref's sibling, with the seed's own root and ceiling. `entries` is
254
+ * carried so status surfaces can say what the seed holds without fetching it.
255
+ */
256
+ export const functionsSeedRefSchema = z
257
+ .object({
258
+ path: z
259
+ .string()
260
+ .min(1)
261
+ .startsWith(`${FUNCTIONS_RUNTIME_SEED_ROOT}/`)
262
+ .refine((path) => !path.split("/").includes(".."), {
263
+ message: "Function seed paths cannot traverse outside the seed root.",
264
+ }),
265
+ sha256: executionSha256Schema,
266
+ size: z.number().int().nonnegative().max(FUNCTIONS_SEED_MAX_BYTES),
267
+ entries: z.number().int().nonnegative(),
268
+ })
269
+ .strict();
171
270
  /**
172
271
  * The path a bundle is served from.
173
272
  *
@@ -189,6 +288,15 @@ export const functionsBundleRefSchema = z
189
288
  export function functionsBundlePath(input) {
190
289
  return `${FUNCTIONS_BUNDLE_ROUTE_PREFIX}/${bundleDigest(input.sha256)}/${input.token}/bundle.json`;
191
290
  }
291
+ /**
292
+ * The seed document's read path — the bundle route with a different terminal
293
+ * filename and its own token audience. One signed artifact route on the
294
+ * origin serves both: the filename says what the digest names, the token's
295
+ * audience says what the caller was authorised to read.
296
+ */
297
+ export function functionsSeedPath(input) {
298
+ return `${FUNCTIONS_BUNDLE_ROUTE_PREFIX}/${bundleDigest(input.sha256)}/${input.token}/seed.json`;
299
+ }
192
300
  /**
193
301
  * Where the bundle actually sits in the published version — the same path minus
194
302
  * the token segment. The token authorises the read; it does not name the file,
@@ -197,6 +305,10 @@ export function functionsBundlePath(input) {
197
305
  export function functionsBundleStoragePath(input) {
198
306
  return `${FUNCTIONS_RUNTIME_BUNDLE_ROOT}/${bundleDigest(input.sha256)}/bundle.json`;
199
307
  }
308
+ /** The seed's storage twin of `functionsBundleStoragePath`. */
309
+ export function functionsSeedStoragePath(input) {
310
+ return `${FUNCTIONS_RUNTIME_SEED_ROOT}/${bundleDigest(input.sha256)}/seed.json`;
311
+ }
200
312
  /**
201
313
  * The digest is carried in contracts as `sha256:<hex>` but appears in paths as
202
314
  * bare hex: a colon is legal in a path segment yet needlessly invites
@@ -229,9 +341,26 @@ export const functionsWorkerArtifactSchema = z
229
341
  */
230
342
  mainModule: z.string().min(1).max(1024),
231
343
  bundle: functionsBundleRefSchema,
344
+ /**
345
+ * The build-time cache seed, or null when the build produced nothing
346
+ * worth warming (no prerenders left with the worker, no fetch cache).
347
+ * A ref, not content: the document rides the version's own file tree
348
+ * like the bundle, and the host pulls it through a signed URL minted at
349
+ * finalize.
350
+ */
351
+ seed: functionsSeedRefSchema.nullable().default(null),
232
352
  compatibilityDate: functionsCompatibilityDateSchema,
233
353
  compatibilityFlags: z.array(z.string().min(1).max(128)).max(32).default([]),
234
- routes: z.array(functionsRouteSchema).max(256).default([]),
354
+ routes: z.array(functionsRouteSchema).max(FUNCTIONS_MAX_ROUTES).default([]),
355
+ /**
356
+ * Cookie names whose presence must skip the origin's static fast path on
357
+ * claimed routes — the framework's draft/preview session markers. Data
358
+ * from the classifier, not names the engine knows: the origin checks the
359
+ * Cookie header against this list and dispatches instead of serving the
360
+ * extracted file, which is what lets a fully-static page still honor a
361
+ * draft session without a build-wide draft-usage proof.
362
+ */
363
+ bypassCookies: z.array(z.string().min(1).max(128)).max(8).default([]),
235
364
  /**
236
365
  * Aggregate of what the worker's handlers reach, used to decide which
237
366
  * brokered capabilities the relay will honour for this version. A worker
@@ -356,6 +485,13 @@ export const functionsHostConfigSchema = z
356
485
  * single artifact.
357
486
  */
358
487
  bundleUrl: z.string().url(),
488
+ /**
489
+ * Where the host pulls the version's cache seed, minted beside the bundle
490
+ * URL for the same reasons — null exactly when the artifact carries no
491
+ * seed. The host folds it into the cache object's cold-start path, never
492
+ * into request serving: an unreachable seed is a cold cache, not an error.
493
+ */
494
+ seedUrl: z.string().url().nullable().default(null),
359
495
  })
360
496
  .strict();
361
497
  /**
@@ -402,6 +538,23 @@ export const functionsUsageConfigSchema = z
402
538
  token: z.string().min(1),
403
539
  })
404
540
  .strict();
541
+ /**
542
+ * The credential the execution host presents at the origin's purge route.
543
+ *
544
+ * Only the token lives here: the purge route is on whichever hostname the
545
+ * visitor actually hit, so the origin composes the URL from the request host at
546
+ * dispatch time — exactly as it does for log intake — instead of freezing one
547
+ * hostname at finalize. A third credential rather than a reuse of the relay's,
548
+ * for the relay's own reason: purging cached responses is a distinct authority,
549
+ * and a worker whose relay is unusable must still be able to invalidate what it
550
+ * rendered. Version-scoped and folded into the host's isolate identity like its
551
+ * siblings, so a republish revokes it.
552
+ */
553
+ export const functionsPurgeConfigSchema = z
554
+ .object({
555
+ token: z.string().min(1),
556
+ })
557
+ .strict();
405
558
  /**
406
559
  * What a build declares about its worker — everything the CLI can know from the
407
560
  * author's project alone.
@@ -441,6 +594,7 @@ export const functionsRuntimeConfigSchema = functionsSourceFinalizeSchema
441
594
  grantedCapabilities: z.array(functionsDispatchCapabilitySchema).max(10).default([]),
442
595
  relay: functionsRelayConfigSchema.nullable().default(null),
443
596
  usage: functionsUsageConfigSchema.nullable().default(null),
597
+ purge: functionsPurgeConfigSchema.nullable().default(null),
444
598
  /**
445
599
  * Resolved at finalize, so a worker reading configuration never calls back
446
600
  * to us for it — and so rotating a variable is a republish with an audit
@@ -475,9 +629,11 @@ export function createFunctionsSourceFinalize(input) {
475
629
  entry: input.entry,
476
630
  mainModule: input.mainModule,
477
631
  bundle: input.bundle,
632
+ seed: input.seed ?? null,
478
633
  compatibilityDate: input.compatibilityDate,
479
634
  compatibilityFlags: input.compatibilityFlags ?? [],
480
635
  routes: input.routes ?? [],
636
+ bypassCookies: input.bypassCookies ?? [],
481
637
  capabilities: input.capabilities ?? {},
482
638
  platform: { nextCache: input.nextCache ?? false },
483
639
  },
@@ -96,16 +96,16 @@ export declare const gitConnectionCreateSchema: z.ZodPipe<z.ZodObject<{
96
96
  autoDeployProduction: z.ZodDefault<z.ZodBoolean>;
97
97
  autoDeployPreviews: z.ZodDefault<z.ZodBoolean>;
98
98
  buildSettings: z.ZodOptional<z.ZodObject<{
99
- rootDirectory: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
100
- installDirectory: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
101
- installCommand: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
102
- buildCommand: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
103
- outputDirectory: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
104
- ignoredBuildCommand: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
105
- frameworkPreset: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
106
- platformPreset: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
107
- allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
108
- timeoutSeconds: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
99
+ rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
+ installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
+ installCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ buildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
+ outputDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
+ ignoredBuildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
105
+ frameworkPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
106
+ platformPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
107
+ allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodBoolean>;
108
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
109
109
  }, z.core.$strip>>;
110
110
  }, z.core.$strip>, z.ZodTransform<{
111
111
  productionBranch: string;
@@ -163,16 +163,16 @@ export declare const gitConnectionPatchSchema: z.ZodObject<{
163
163
  autoDeployProduction: z.ZodOptional<z.ZodBoolean>;
164
164
  autoDeployPreviews: z.ZodOptional<z.ZodBoolean>;
165
165
  buildSettings: z.ZodOptional<z.ZodObject<{
166
- rootDirectory: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
167
- installDirectory: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
168
- installCommand: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
169
- buildCommand: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
170
- outputDirectory: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
171
- ignoredBuildCommand: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
172
- frameworkPreset: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
173
- platformPreset: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
174
- allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
175
- timeoutSeconds: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
166
+ rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
167
+ installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
168
+ installCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
169
+ buildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
170
+ outputDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
+ ignoredBuildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
+ frameworkPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
173
+ platformPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
174
+ allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodBoolean>;
175
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
176
176
  }, z.core.$strip>>;
177
177
  }, z.core.$strip>;
178
178
  export declare const gitConnectionAnalyzeSchema: z.ZodObject<{
@@ -249,7 +249,13 @@ export declare const githubInstallationSchema: z.ZodObject<{
249
249
  htmlUrl: z.ZodNullable<z.ZodString>;
250
250
  }, z.core.$strip>;
251
251
  export declare const githubInstallationsResponseSchema: z.ZodObject<{
252
- appConfigured: z.ZodBoolean;
252
+ readiness: z.ZodObject<{
253
+ canAuthorize: z.ZodBoolean;
254
+ canInstall: z.ZodBoolean;
255
+ webhookReady: z.ZodBoolean;
256
+ codeStorageReady: z.ZodBoolean;
257
+ ready: z.ZodBoolean;
258
+ }, z.core.$strip>;
253
259
  installUrl: z.ZodNullable<z.ZodString>;
254
260
  installations: z.ZodArray<z.ZodObject<{
255
261
  id: z.ZodString;
@@ -258,18 +264,6 @@ export declare const githubInstallationsResponseSchema: z.ZodObject<{
258
264
  htmlUrl: z.ZodNullable<z.ZodString>;
259
265
  }, z.core.$strip>>;
260
266
  }, z.core.$strip>;
261
- export declare const githubInstallationClaimSchema: z.ZodObject<{
262
- installationId: z.ZodString;
263
- state: z.ZodString;
264
- }, z.core.$strip>;
265
- export declare const githubInstallationClaimResponseSchema: z.ZodObject<{
266
- installation: z.ZodObject<{
267
- id: z.ZodString;
268
- accountLogin: z.ZodString;
269
- accountType: z.ZodNullable<z.ZodString>;
270
- htmlUrl: z.ZodNullable<z.ZodString>;
271
- }, z.core.$strip>;
272
- }, z.core.$strip>;
273
267
  export declare const githubRepositorySchema: z.ZodObject<{
274
268
  id: z.ZodString;
275
269
  name: z.ZodString;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { BuildSettingsSchema } from "./builds.js";
2
+ import { BuildSettingsOverrideSchema, BuildSettingsSchema } from "./builds.js";
3
3
  import { gitProvider } from "./enums.js";
4
4
  const nullableString = z.string().trim().min(1).nullable();
5
5
  export const buildTargetValues = ["production", "preview"];
@@ -55,7 +55,7 @@ export const gitConnectionCreateSchema = z
55
55
  credential: z.string().trim().min(1).nullable().optional(),
56
56
  autoDeployProduction: z.boolean().default(true),
57
57
  autoDeployPreviews: z.boolean().default(true),
58
- buildSettings: gitBuildSettingsSchema.partial().optional(),
58
+ buildSettings: BuildSettingsOverrideSchema.optional(),
59
59
  })
60
60
  .transform((value) => ({
61
61
  ...value,
@@ -67,7 +67,7 @@ export const gitConnectionPatchSchema = z.object({
67
67
  credential: z.string().trim().min(1).nullable().optional(),
68
68
  autoDeployProduction: z.boolean().optional(),
69
69
  autoDeployPreviews: z.boolean().optional(),
70
- buildSettings: gitBuildSettingsSchema.partial().optional(),
70
+ buildSettings: BuildSettingsOverrideSchema.optional(),
71
71
  });
72
72
  export const gitConnectionAnalyzeSchema = z.object({
73
73
  ref: z.string().trim().min(1).optional(),
@@ -95,17 +95,16 @@ export const githubInstallationSchema = z.object({
95
95
  htmlUrl: z.string().url().nullable(),
96
96
  });
97
97
  export const githubInstallationsResponseSchema = z.object({
98
- appConfigured: z.boolean(),
98
+ readiness: z.object({
99
+ canAuthorize: z.boolean(),
100
+ canInstall: z.boolean(),
101
+ webhookReady: z.boolean(),
102
+ codeStorageReady: z.boolean(),
103
+ ready: z.boolean(),
104
+ }),
99
105
  installUrl: z.string().url().nullable(),
100
106
  installations: z.array(githubInstallationSchema),
101
107
  });
102
- export const githubInstallationClaimSchema = z.object({
103
- installationId: z.string().trim().min(1),
104
- state: z.string().trim().min(1),
105
- });
106
- export const githubInstallationClaimResponseSchema = z.object({
107
- installation: githubInstallationSchema,
108
- });
109
108
  export const githubRepositorySchema = z.object({
110
109
  id: z.string(),
111
110
  name: z.string(),
@@ -12,8 +12,8 @@ export declare const GRANT_AUDIENCE_KINDS: readonly ["public", "team", "person",
12
12
  export declare const grantAudienceKindSchema: z.ZodEnum<{
13
13
  link: "link";
14
14
  team: "team";
15
- external: "external";
16
15
  public: "public";
16
+ external: "external";
17
17
  person: "person";
18
18
  password: "password";
19
19
  machine: "machine";
@@ -424,8 +424,8 @@ export declare const grantCheckQuerySchema: z.ZodObject<{
424
424
  audience: z.ZodDefault<z.ZodEnum<{
425
425
  link: "link";
426
426
  team: "team";
427
- external: "external";
428
427
  public: "public";
428
+ external: "external";
429
429
  person: "person";
430
430
  password: "password";
431
431
  machine: "machine";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- // Id prefix registry (internal-docs/platform.md "Id prefix registry", L1106-1127).
2
+ // Id prefix registry (the platform spec "Id prefix registry").
3
3
  // Every PUBLIC resource registers a prefix here before it ships; ids are globally
4
4
  // unique and handle ids (operations, exports, imports, transfers, builds) are
5
5
  // fetchable at a top-level collection with no extra context. Control-plane-internal
@@ -49,7 +49,7 @@ export function registeredIdSchema(prefix) {
49
49
  }
50
50
  // The main Stattic tenant every self-serve team/user/resource lives under. A
51
51
  // well-known CONSTANT, never configuration: grammatically a normal tenant id with
52
- // zero special cases in contracts, policy URIs, or parsers (spec L1100-1105).
52
+ // zero special cases in contracts, policy URIs, or parsers (per the platform spec).
53
53
  export const MAIN_TENANT_ID = "ten_main";
54
54
  /** Mint a globally unique id for a registered public resource prefix. */
55
55
  export function createId(prefix) {
@@ -1,9 +1,4 @@
1
1
  import { z } from "zod";
2
- export declare const conventionFilesSchema: z.ZodObject<{
3
- redirects: z.ZodOptional<z.ZodString>;
4
- headers: z.ZodOptional<z.ZodString>;
5
- routes: z.ZodOptional<z.ZodString>;
6
- }, z.core.$strip>;
7
2
  export declare const manifestFileSchema: z.ZodObject<{
8
3
  path: z.ZodString;
9
4
  size: z.ZodNumber;
@@ -11,19 +6,13 @@ export declare const manifestFileSchema: z.ZodObject<{
11
6
  contentType: z.ZodOptional<z.ZodString>;
12
7
  sourceUrl: z.ZodOptional<z.ZodString>;
13
8
  }, z.core.$strip>;
14
- export declare const uploadManifestFileSchema: z.ZodUnion<readonly [z.ZodObject<{
15
- path: z.ZodString;
16
- size: z.ZodNumber;
17
- contentType: z.ZodOptional<z.ZodString>;
18
- sourceUrl: z.ZodOptional<z.ZodString>;
19
- sha256: z.ZodString;
20
- }, z.core.$strip>, z.ZodObject<{
9
+ export declare const uploadManifestFileSchema: z.ZodObject<{
21
10
  path: z.ZodString;
22
11
  size: z.ZodNumber;
23
12
  sha256: z.ZodOptional<z.ZodString>;
24
13
  contentType: z.ZodOptional<z.ZodString>;
25
- sourceUrl: z.ZodString;
26
- }, z.core.$strip>]>;
14
+ sourceUrl: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>;
27
16
  export declare const pendingUploadSchema: z.ZodObject<{
28
17
  path: z.ZodString;
29
18
  size: z.ZodNumber;
@@ -97,14 +86,14 @@ export declare const uploadInstructionsSchema: z.ZodObject<{
97
86
  code: z.ZodString;
98
87
  severity: z.ZodEnum<{
99
88
  info: "info";
100
- warning: "warning";
101
89
  error: "error";
90
+ warning: "warning";
102
91
  }>;
103
92
  message: z.ZodString;
104
93
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
105
94
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
106
95
  registrar: "registrar";
107
- wpcloud: "wpcloud";
96
+ infra: "infra";
108
97
  dns: "dns";
109
98
  runtime: "runtime";
110
99
  }>>>;
@@ -1,10 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { baseDiagnosticSchema } from "./common.js";
3
- export const conventionFilesSchema = z.object({
4
- redirects: z.string().optional(),
5
- headers: z.string().optional(),
6
- routes: z.string().optional(),
7
- });
8
3
  const manifestSha256Schema = z
9
4
  .string()
10
5
  .regex(/^[0-9a-f]{64}$/, "sha256 must be 64 lowercase hex characters without a prefix.")
@@ -20,18 +15,13 @@ export const manifestFileSchema = z.object({
20
15
  size: z.number().int().nonnegative().describe("File size in bytes."),
21
16
  sha256: manifestSha256Schema
22
17
  .optional()
23
- .describe("SHA-256 content digest: exactly 64 lowercase hex characters, no `sha256:` prefix (Version.manifestHash is the only prefixed form). Required when the caller uploads local bytes; may be absent on historical records and sourceUrl entries."),
18
+ .describe("Optional SHA-256 content digest: exactly 64 lowercase hex characters, no `sha256:` prefix (Version.manifestHash is the only prefixed form). Omit it to let the runtime hash uploaded bytes; include it to upload by content address, with the digest verified as the bytes land."),
24
19
  contentType: z.string().optional().describe("Optional content type for serving metadata."),
25
20
  sourceUrl: manifestSourceUrlSchema
26
21
  .optional()
27
22
  .describe("Optional HTTPS URL the runtime can fetch directly for this file instead of receiving bytes from the client."),
28
23
  });
29
- export const uploadManifestFileSchema = z
30
- .union([
31
- manifestFileSchema.extend({ sha256: manifestSha256Schema }),
32
- manifestFileSchema.extend({ sourceUrl: manifestSourceUrlSchema }),
33
- ])
34
- .describe("A declared upload file. Local bytes require sha256. A sourceUrl entry may omit sha256 because the runtime computes it while fetching.");
24
+ export const uploadManifestFileSchema = manifestFileSchema.describe("A declared upload file. sha256 is optional: omit it for runtime-hashed path uploads or sourceUrl fetches; include it for content-addressed uploads.");
35
25
  export const pendingUploadSchema = manifestFileSchema.pick({
36
26
  path: true,
37
27
  size: true,
@@ -155,6 +155,16 @@ export declare const hostedMcpDashboardResponseSchema: z.ZodObject<{
155
155
  }, z.core.$strip>>;
156
156
  }, z.core.$strip>;
157
157
  }, z.core.$strip>;
158
+ export declare const hostedMcpProxyTokenSchema: z.ZodObject<{
159
+ accessToken: z.ZodString;
160
+ expiresAt: z.ZodString;
161
+ }, z.core.$strip>;
162
+ export declare const hostedMcpProxyTokenResponseSchema: z.ZodObject<{
163
+ data: z.ZodObject<{
164
+ accessToken: z.ZodString;
165
+ expiresAt: z.ZodString;
166
+ }, z.core.$strip>;
167
+ }, z.core.$strip>;
158
168
  export declare const hostedMcpCloseSessionResponseSchema: z.ZodObject<{
159
169
  data: z.ZodObject<{
160
170
  sessionId: z.ZodString;
@@ -243,5 +253,6 @@ export declare const hostedMcpApprovalResponseSchema: z.ZodObject<{
243
253
  export type HostedMcpSession = z.infer<typeof hostedMcpSessionSchema>;
244
254
  export type HostedMcpSessionEvent = z.infer<typeof hostedMcpSessionEventSchema>;
245
255
  export type HostedMcpDashboard = z.infer<typeof hostedMcpDashboardSchema>;
256
+ export type HostedMcpProxyToken = z.infer<typeof hostedMcpProxyTokenSchema>;
246
257
  export type HostedMcpPausedExecution = z.infer<typeof hostedMcpPausedExecutionSchema>;
247
258
  export type HostedMcpApprovalAction = z.infer<typeof hostedMcpApprovalActionSchema>;
@@ -50,6 +50,11 @@ export const hostedMcpDashboardSchema = z.object({
50
50
  events: z.array(hostedMcpSessionEventSchema),
51
51
  });
52
52
  export const hostedMcpDashboardResponseSchema = dataEnvelope(hostedMcpDashboardSchema);
53
+ export const hostedMcpProxyTokenSchema = z.object({
54
+ accessToken: z.string().min(1),
55
+ expiresAt: z.string().datetime(),
56
+ });
57
+ export const hostedMcpProxyTokenResponseSchema = dataEnvelope(hostedMcpProxyTokenSchema);
53
58
  export const hostedMcpCloseSessionResponseSchema = dataEnvelope(hostedMcpSessionSchema);
54
59
  export const hostedMcpSessionEventsResponseSchema = dataEnvelope(z.object({
55
60
  session: hostedMcpSessionSchema,
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { betaEligibleTeamSourceSchema } from "./beta.js";
3
3
  import { planCodeSchema } from "./features.js";
4
- // `GET /v1/me` (internal-docs/platform.md route catalog): the authenticated
4
+ // `GET /v1/me` (the platform spec route catalog): the authenticated
5
5
  // subject, its tenant grants, principal/team memberships, and a plan summary.
6
6
  // Works for every credential kind — sessions resolve their user and team
7
7
  // memberships; machine credentials resolve the teams and tenants their policy
@@ -36,14 +36,14 @@ export declare const UserOperationSchema: z.ZodObject<{
36
36
  code: z.ZodString;
37
37
  severity: z.ZodEnum<{
38
38
  info: "info";
39
- warning: "warning";
40
39
  error: "error";
40
+ warning: "warning";
41
41
  }>;
42
42
  message: z.ZodString;
43
43
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
44
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
45
45
  registrar: "registrar";
46
- wpcloud: "wpcloud";
46
+ infra: "infra";
47
47
  dns: "dns";
48
48
  runtime: "runtime";
49
49
  }>>>;
@@ -110,14 +110,14 @@ export declare const operationListResponseSchema: z.ZodObject<{
110
110
  code: z.ZodString;
111
111
  severity: z.ZodEnum<{
112
112
  info: "info";
113
- warning: "warning";
114
113
  error: "error";
114
+ warning: "warning";
115
115
  }>;
116
116
  message: z.ZodString;
117
117
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
118
118
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
119
119
  registrar: "registrar";
120
- wpcloud: "wpcloud";
120
+ infra: "infra";
121
121
  dns: "dns";
122
122
  runtime: "runtime";
123
123
  }>>>;
@@ -32,13 +32,13 @@ export const operationListQuerySchema = cursorListQuerySchema.extend({
32
32
  .string()
33
33
  .min(1)
34
34
  .optional()
35
- .describe("Filter to operations touching one resource type, e.g. `space`."),
35
+ .describe("Filter to operations touching one resource type, for example `space`."),
36
36
  resourceId: z.string().min(1).optional().describe("Filter to operations touching one resource."),
37
37
  spaceId: z
38
38
  .string()
39
39
  .min(1)
40
40
  .optional()
41
- .describe("Filter to operations pertaining to one Space — its own operations plus those of its versions and builds. The Space must be readable by the caller."),
41
+ .describe("Filter to operations for one Space — its own operations plus those of its versions and builds. The Space must be readable by the caller."),
42
42
  });
43
43
  export const operationListResponseSchema = z.object({
44
44
  data: z.array(UserOperationSchema),