@spacefast/common 0.0.21 → 0.0.24

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 (182) hide show
  1. package/dist/agents/connect-targets.d.ts +9 -6
  2. package/dist/agents/connect-targets.js +9 -6
  3. package/dist/config/domains.d.ts +1 -1
  4. package/dist/config/domains.js +1 -0
  5. package/dist/config/index.d.ts +0 -1
  6. package/dist/config/index.js +0 -1
  7. package/dist/contracts/abuse.d.ts +2 -0
  8. package/dist/contracts/abuse.js +12 -0
  9. package/dist/contracts/access.d.ts +121 -9
  10. package/dist/contracts/access.js +73 -9
  11. package/dist/contracts/activity.d.ts +1 -1
  12. package/dist/contracts/activity.js +0 -9
  13. package/dist/contracts/api-keys.d.ts +21 -21
  14. package/dist/contracts/beta.js +1 -1
  15. package/dist/contracts/billing.d.ts +1 -34
  16. package/dist/contracts/billing.js +4 -53
  17. package/dist/contracts/builds.d.ts +8 -8
  18. package/dist/contracts/builds.js +10 -3
  19. package/dist/contracts/cli.d.ts +10 -0
  20. package/dist/contracts/cli.js +10 -0
  21. package/dist/contracts/collab-public.d.ts +63 -0
  22. package/dist/contracts/collab-public.js +46 -0
  23. package/dist/contracts/comments.d.ts +283 -54
  24. package/dist/contracts/comments.js +173 -52
  25. package/dist/contracts/common.d.ts +3 -3
  26. package/dist/contracts/device-auth.d.ts +6 -6
  27. package/dist/contracts/device-auth.js +1 -1
  28. package/dist/contracts/docs.d.ts +5 -5
  29. package/dist/contracts/domains.d.ts +36 -36
  30. package/dist/contracts/enums.d.ts +33 -30
  31. package/dist/contracts/enums.js +52 -38
  32. package/dist/contracts/error-code-meta.d.ts +37 -126
  33. package/dist/contracts/error-code-meta.js +12 -41
  34. package/dist/contracts/error-codes.d.ts +1 -1
  35. package/dist/contracts/error-codes.js +10 -32
  36. package/dist/contracts/execution.d.ts +35 -57
  37. package/dist/contracts/execution.js +41 -40
  38. package/dist/contracts/feature-lifecycle-core.d.ts +0 -6
  39. package/dist/contracts/feature-lifecycle-core.js +2 -31
  40. package/dist/contracts/feature-lifecycle.d.ts +8 -38
  41. package/dist/contracts/feature-lifecycle.js +16 -48
  42. package/dist/contracts/features.d.ts +15 -13
  43. package/dist/contracts/features.js +39 -38
  44. package/dist/contracts/functions.d.ts +97 -70
  45. package/dist/contracts/functions.js +101 -34
  46. package/dist/contracts/git.d.ts +1 -1
  47. package/dist/contracts/grants.d.ts +7 -3
  48. package/dist/contracts/grants.js +18 -9
  49. package/dist/contracts/internal.d.ts +14 -1
  50. package/dist/contracts/internal.js +17 -7
  51. package/dist/contracts/oauth-resources.d.ts +4 -3
  52. package/dist/contracts/oauth-resources.js +12 -3
  53. package/dist/contracts/operations.d.ts +90 -5
  54. package/dist/contracts/operations.js +75 -1
  55. package/dist/contracts/pages.d.ts +6 -1
  56. package/dist/contracts/pages.js +24 -1
  57. package/dist/contracts/plan-policy.d.ts +1 -3
  58. package/dist/contracts/plan-policy.js +1 -2
  59. package/dist/contracts/platform.d.ts +61 -148
  60. package/dist/contracts/platform.js +70 -126
  61. package/dist/contracts/publish-archive.d.ts +498 -0
  62. package/dist/contracts/publish-archive.js +25 -0
  63. package/dist/contracts/resources.d.ts +12 -24
  64. package/dist/contracts/resources.js +32 -12
  65. package/dist/contracts/runtime-api.d.ts +369 -175
  66. package/dist/contracts/runtime-api.js +372 -348
  67. package/dist/contracts/runtime-app.d.ts +127 -120
  68. package/dist/contracts/runtime-app.js +19 -10
  69. package/dist/contracts/runtime-db.d.ts +1 -1
  70. package/dist/contracts/runtime-services.d.ts +219 -0
  71. package/dist/contracts/runtime-services.js +437 -0
  72. package/dist/contracts/runtime-storage.d.ts +45 -32
  73. package/dist/contracts/runtime-storage.js +30 -8
  74. package/dist/contracts/space-config.d.ts +10 -16
  75. package/dist/contracts/space-config.js +14 -10
  76. package/dist/contracts/spaces.d.ts +241 -436
  77. package/dist/contracts/spaces.js +128 -145
  78. package/dist/contracts/superadmin-activity.d.ts +57 -4
  79. package/dist/contracts/superadmin-activity.js +48 -2
  80. package/dist/contracts/superadmin-search.d.ts +126 -0
  81. package/dist/contracts/superadmin-search.js +61 -0
  82. package/dist/contracts/superadmin-spaces.d.ts +358 -89
  83. package/dist/contracts/superadmin-spaces.js +97 -24
  84. package/dist/contracts/superadmin-teams.d.ts +28 -10
  85. package/dist/contracts/superadmin-teams.js +5 -8
  86. package/dist/contracts/superadmin.d.ts +0 -32
  87. package/dist/contracts/superadmin.js +3 -11
  88. package/dist/contracts/tags.d.ts +9 -9
  89. package/dist/contracts/teams.d.ts +44 -2
  90. package/dist/contracts/teams.js +43 -23
  91. package/dist/contracts/transfers.d.ts +0 -49
  92. package/dist/contracts/transfers.js +2 -6
  93. package/dist/contracts/usage.d.ts +61 -0
  94. package/dist/contracts/usage.js +64 -0
  95. package/dist/contracts/variables.d.ts +2 -7
  96. package/dist/contracts/variables.js +6 -5
  97. package/dist/contracts/webhooks.d.ts +2 -2
  98. package/dist/contracts/zero.d.ts +87 -56
  99. package/dist/contracts/zero.js +82 -20
  100. package/dist/dashboard-paths/index.d.ts +1 -1
  101. package/dist/dashboard-paths/index.js +1 -0
  102. package/dist/docs/agent-prose.d.ts +1 -1
  103. package/dist/docs/agent-prose.js +62 -66
  104. package/dist/docs/agent-setup.js +49 -23
  105. package/dist/docs/agent-solutions.d.ts +4 -4
  106. package/dist/docs/agent-solutions.js +8 -8
  107. package/dist/docs/catalog.d.ts +19 -19
  108. package/dist/docs/catalog.js +30 -19
  109. package/dist/docs/error-docs.js +63 -151
  110. package/dist/docs/skills.d.ts +3 -3
  111. package/dist/docs/skills.js +1 -1
  112. package/dist/test-helpers/fetch-stub.d.ts +16 -0
  113. package/dist/test-helpers/fetch-stub.js +24 -0
  114. package/dist/utils/build-settings.js +9 -3
  115. package/dist/utils/canonical-json.d.ts +10 -0
  116. package/dist/utils/canonical-json.js +21 -0
  117. package/dist/utils/cast-transport.d.ts +28 -0
  118. package/dist/utils/cast-transport.js +52 -0
  119. package/dist/utils/claim-token.d.ts +0 -8
  120. package/dist/utils/claim-token.js +3 -15
  121. package/dist/utils/credential-policy.d.ts +1 -1
  122. package/dist/utils/env-file.d.ts +17 -0
  123. package/dist/utils/env-file.js +96 -0
  124. package/dist/utils/error-code.d.ts +2 -0
  125. package/dist/utils/error-code.js +7 -0
  126. package/dist/utils/generate-space-name.d.ts +8 -10
  127. package/dist/utils/generate-space-name.js +206 -21
  128. package/dist/utils/grant-decision.fixtures.json +2938 -0
  129. package/dist/utils/grants.d.ts +2 -0
  130. package/dist/utils/grants.js +25 -2
  131. package/dist/utils/gravatar.d.ts +9 -0
  132. package/dist/utils/gravatar.js +31 -0
  133. package/dist/utils/idempotency.d.ts +6 -0
  134. package/dist/utils/idempotency.js +28 -0
  135. package/dist/utils/local-space-state.d.ts +1 -5
  136. package/dist/utils/local-space-state.js +7 -26
  137. package/dist/utils/page-fonts.d.ts +2 -2
  138. package/dist/utils/page-fonts.js +22 -4
  139. package/dist/utils/pages.d.ts +1 -2
  140. package/dist/utils/pages.js +21 -5
  141. package/dist/utils/publish-form-data.d.ts +12 -0
  142. package/dist/utils/publish-form-data.js +10 -0
  143. package/dist/utils/publish-policy.d.ts +20 -0
  144. package/dist/utils/publish-policy.fixtures.json +397 -0
  145. package/dist/utils/publish-policy.js +36 -19
  146. package/dist/utils/push-new.d.ts +7 -0
  147. package/dist/utils/push-new.js +7 -0
  148. package/dist/utils/query-keys.d.ts +0 -1
  149. package/dist/utils/query-keys.js +0 -1
  150. package/dist/utils/runtime-paths.d.ts +5 -0
  151. package/dist/utils/runtime-paths.js +5 -0
  152. package/dist/utils/runtime-upload-batch.d.ts +0 -5
  153. package/dist/utils/runtime-upload-batch.js +1 -27
  154. package/dist/utils/runtime-upload.d.ts +3 -13
  155. package/dist/utils/runtime-upload.js +4 -14
  156. package/dist/utils/space-config.d.ts +0 -33
  157. package/dist/utils/space-config.js +5 -326
  158. package/dist/utils/storage-policy.d.ts +1 -1
  159. package/dist/utils/storage-policy.js +3 -1
  160. package/dist/utils/structured-error.d.ts +14 -0
  161. package/dist/utils/structured-error.js +22 -0
  162. package/dist/utils/version-path.js +12 -3
  163. package/dist/vocabulary.d.ts +5 -3
  164. package/dist/vocabulary.js +13 -10
  165. package/package.json +10 -5
  166. package/dist/config/postgres-budget.d.ts +0 -129
  167. package/dist/config/postgres-budget.js +0 -140
  168. package/dist/config/postgres-budget.json +0 -51
  169. package/dist/contracts/archives.d.ts +0 -331
  170. package/dist/contracts/archives.js +0 -120
  171. package/dist/contracts/deployments.d.ts +0 -574
  172. package/dist/contracts/deployments.js +0 -97
  173. package/dist/contracts/sites.d.ts +0 -416
  174. package/dist/contracts/sites.js +0 -168
  175. package/dist/contracts/superadmin-queues.d.ts +0 -414
  176. package/dist/contracts/superadmin-queues.js +0 -202
  177. package/dist/contracts/superadmin-runtime.d.ts +0 -27
  178. package/dist/contracts/superadmin-runtime.js +0 -38
  179. package/dist/index.d.ts +0 -1
  180. package/dist/index.js +0 -1
  181. package/dist/utils/api.d.ts +0 -4
  182. package/dist/utils/api.js +0 -13
@@ -34,19 +34,14 @@ export const ERROR_CODES = [
34
34
  "agent_handoff_origin_unsupported",
35
35
  "ambiguous_space_slug",
36
36
  "anonymous_expired",
37
- "anonymous_pool_unavailable",
38
37
  "anonymous_publish_rate_limited",
39
38
  "anonymous_space_limit_reached",
40
39
  "api_key_scope_underivable",
41
- "archive_body_required",
42
40
  "archive_too_large",
43
41
  "auth_code_required",
44
42
  "authorization_pending",
45
- "billing_receipt_invalid",
46
- "billing_receipt_not_bound_to_team",
47
- "billing_store_not_configured",
48
- "billing_subscription_conflict",
49
- "billing_unknown_product",
43
+ "blob_gate_record_missing",
44
+ "blob_gate_token_invalid",
50
45
  "build_command_missing",
51
46
  "build_execution_unavailable",
52
47
  "build_failed",
@@ -65,7 +60,6 @@ export const ERROR_CODES = [
65
60
  "claim_target_not_found",
66
61
  "claimed_space_quota_exceeded",
67
62
  "cli_upgrade_required",
68
- "comment_screenshot_rate_limited",
69
63
  "config_file_too_large",
70
64
  "config_functions_key_removed",
71
65
  "config_invalid",
@@ -82,7 +76,6 @@ export const ERROR_CODES = [
82
76
  "credential_revoked",
83
77
  "csam_blocked",
84
78
  "csam_policy_floor",
85
- "custom_certificates_require_dedicated_site",
86
79
  "data_location_immutable",
87
80
  "db_not_available",
88
81
  "device_authorization_failed",
@@ -142,19 +135,14 @@ export const ERROR_CODES = [
142
135
  "event_payload_too_large",
143
136
  "event_rate_limited",
144
137
  "expired_token",
145
- "export_archive_not_ready",
146
- "export_version_not_found",
147
138
  "feature_unavailable",
148
139
  "files_mode_does_not_support_spa",
149
140
  "forbidden",
150
141
  "free_external_proxy_disabled",
151
- "google_play_webhook_identity_not_configured",
152
142
  "idempotency_conflict_in_progress",
153
143
  "idempotency_key_reused",
154
- "import_archive_not_uploaded",
155
- "import_not_cancelable",
156
- "import_not_waiting_for_archive",
157
144
  "incumbent_controls_dns",
145
+ "ingest_admission_exceeded",
158
146
  "inject_invalid",
159
147
  "inject_snippet_too_large",
160
148
  "internal_error",
@@ -165,7 +153,6 @@ export const ERROR_CODES = [
165
153
  "invalid_domain",
166
154
  "invalid_domain_name",
167
155
  "invalid_file_path",
168
- "invalid_google_play_webhook_identity",
169
156
  "invalid_grant",
170
157
  "invalid_idempotency_key",
171
158
  "invalid_publish_archive",
@@ -214,15 +201,16 @@ export const ERROR_CODES = [
214
201
  "path_case_collision",
215
202
  "path_too_long",
216
203
  "placement_invalid_burstable",
217
- "placement_mode_requires_plan",
218
204
  "plan_grant_already_active",
219
205
  "plan_grant_already_revoked",
220
206
  "platform_tenant_immutable_client",
221
207
  "policy_exceeds_grantor",
222
208
  "principal_space_mismatch",
209
+ "promote_admission_exceeded",
223
210
  "provider_error",
224
211
  "provider_job_failed",
225
212
  "provider_job_timeout",
213
+ "provider_privilege",
226
214
  "provider_runtime_feature_unsupported",
227
215
  "provider_site_id_required",
228
216
  "proxy_upstream_denied",
@@ -241,6 +229,7 @@ export const ERROR_CODES = [
241
229
  "publish_not_cancelable",
242
230
  "publish_path_collision",
243
231
  "publish_path_invalid",
232
+ "publish_session_expired",
244
233
  "publish_setup_failed",
245
234
  "publish_snapshot_empty",
246
235
  "publish_upload_failed",
@@ -250,12 +239,14 @@ export const ERROR_CODES = [
250
239
  "registration_expired",
251
240
  "registration_expiring",
252
241
  "resource_revision_changed",
242
+ "response_headers_unservable",
243
+ "response_table_too_large",
244
+ "review_item_claimed",
253
245
  "routing_rules_over_plan",
254
246
  "runtime_action_forbidden",
255
247
  "runtime_api_not_found",
256
248
  "runtime_callback_forbidden",
257
249
  "runtime_dev_unsupported",
258
- "runtime_engine_zip_missing",
259
250
  "runtime_hostname_unassigned",
260
251
  "runtime_instance_mismatch",
261
252
  "runtime_jti_missing",
@@ -265,6 +256,7 @@ export const ERROR_CODES = [
265
256
  "runtime_management_unavailable",
266
257
  "runtime_not_provisioned",
267
258
  "runtime_operation_missing",
259
+ "runtime_purge_failed",
268
260
  "runtime_scope_forbidden",
269
261
  "runtime_token_bad_signature",
270
262
  "runtime_token_expired",
@@ -289,7 +281,6 @@ export const ERROR_CODES = [
289
281
  "source_archive_expansion_ratio_exceeded",
290
282
  "source_archive_validation_busy",
291
283
  "space_already_claimed",
292
- "space_capacity_warming",
293
284
  "space_claim_unavailable",
294
285
  "space_claimed_credential_available",
295
286
  "space_disabled",
@@ -297,12 +288,6 @@ export const ERROR_CODES = [
297
288
  "space_has_active_publish",
298
289
  "space_has_active_version",
299
290
  "space_hostname_identity_missing",
300
- "space_import_archive_invalid",
301
- "space_import_archive_too_large",
302
- "space_import_config_only_archive",
303
- "space_import_runtime_schema_unsupported",
304
- "space_move_would_strand_zero_data",
305
- "space_moving",
306
291
  "space_no_live_version",
307
292
  "space_not_disabled",
308
293
  "space_not_restorable",
@@ -329,7 +314,6 @@ export const ERROR_CODES = [
329
314
  "storage_quota_decrease_not_supported",
330
315
  "storage_quota_exceeded",
331
316
  "storage_unavailable",
332
- "storage_usage_unavailable",
333
317
  "stripe_error",
334
318
  "superseded_by_publish",
335
319
  "takeover_notice_window",
@@ -348,7 +332,6 @@ export const ERROR_CODES = [
348
332
  "tenant_suspended",
349
333
  "theme_value_invalid",
350
334
  "transfer_cross_tenant_unsupported",
351
- "transfer_move_failed",
352
335
  "transfer_not_cancelable",
353
336
  "transfer_push_failed",
354
337
  "transfer_source_changed",
@@ -362,7 +345,6 @@ export const ERROR_CODES = [
362
345
  "upload_size_mismatch",
363
346
  "user_banned",
364
347
  "validation_error",
365
- "variable_cascade_failed",
366
348
  "verification_required",
367
349
  "version_already_live",
368
350
  "version_artifact_not_found",
@@ -387,7 +369,6 @@ export const ERROR_CODES = [
387
369
  "version_total_bytes_exceeded",
388
370
  "webhook_delivery_budget_exceeded",
389
371
  "whois_unavailable",
390
- "wp_cloud_anonymous_pool_required",
391
372
  "wp_cloud_assignment_kind_mismatch",
392
373
  "wp_cloud_assignment_space_mismatch",
393
374
  "wp_cloud_assignment_team_mismatch",
@@ -396,7 +377,6 @@ export const ERROR_CODES = [
396
377
  "wp_cloud_site_still_assigned",
397
378
  "wp_cloud_team_shared_site_exists",
398
379
  "wp_cloud_webhook_secret_not_configured",
399
- "zero_activating",
400
380
  "zero_ai_unavailable",
401
381
  "zero_artifact_abi_mismatch",
402
382
  "zero_artifact_invalid",
@@ -478,7 +458,6 @@ export const ERROR_CODES = [
478
458
  "zero_replay_query_invalid",
479
459
  "zero_replay_unavailable",
480
460
  "zero_request_body_too_large",
481
- "zero_requires_dedicated_plan",
482
461
  "zero_response_header_forbidden",
483
462
  "zero_response_header_invalid",
484
463
  "zero_response_too_large",
@@ -500,7 +479,6 @@ export const ERROR_CODES = [
500
479
  "zero_runs_invalid",
501
480
  "zero_runs_require_runtime_compiler",
502
481
  "zero_runs_too_many",
503
- "zero_shopify_unavailable",
504
482
  ];
505
483
  const ERROR_CODE_SET = new Set(ERROR_CODES);
506
484
  export function isErrorCode(value) {
@@ -18,18 +18,12 @@ import { z } from "zod";
18
18
  * portable seam, and it is deliberately narrow: a capsule handler's semantics
19
19
  * depend on the transaction wrapped around it, which does not exist on an
20
20
  * isolate a continent away from the database.
21
+ *
22
+ * Neither is a "kind" a space declares. Every space owns a site, so what runs
23
+ * is a routing decision derived from what the published tree carries: static
24
+ * files, a worker, a capsule, or any mix of the three in one publish. There is
25
+ * no enum here to disagree with the tree.
21
26
  */
22
- /**
23
- * What a live version runs. `static` is bytes on disk with no execution at
24
- * all, and remains the overwhelming majority of traffic; the other two each
25
- * name a product.
26
- */
27
- export declare const runtimeKindSchema: z.ZodEnum<{
28
- zero: "zero";
29
- functions: "functions";
30
- static: "static";
31
- }>;
32
- export type RuntimeKind = z.infer<typeof runtimeKindSchema>;
33
27
  /**
34
28
  * How a live runtime delivers realtime invalidations.
35
29
  *
@@ -60,6 +54,7 @@ export declare const EXECUTION_ENV_TOTAL_VALUE_MAX_BYTES: number;
60
54
  export declare const SERVER_ENV_FILE = ".env.server";
61
55
  /** Lakebed's documented server-only env filename, accepted for capsule portability. */
62
56
  export declare const LAKEBED_SERVER_ENV_FILE = ".env.lakebed.server";
57
+ export declare const SERVER_ENV_FILES: readonly [".env.server", ".env.lakebed.server"];
63
58
  /**
64
59
  * Names the platform reserves for itself in the tenant environment. Tenant
65
60
  * code cannot set these, so it cannot spoof the values the broker trusts.
@@ -114,8 +109,18 @@ export declare const executionCapabilitiesSchema: z.ZodDefault<z.ZodObject<{
114
109
  env: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
115
110
  realtime: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
116
111
  logging: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
112
+ gravatar: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
113
+ spam: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
114
+ email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
117
115
  }, z.core.$strip>>;
118
116
  export type ExecutionCapabilities = z.infer<typeof executionCapabilitiesSchema>;
117
+ /**
118
+ * The order every surface renders a capability list in. Fixed rather than
119
+ * derived from a response body, so two spaces never list their capabilities
120
+ * differently because JSON came back reshuffled — and declared here, beside the
121
+ * schema, so adding a capability cannot leave a renderer silently omitting it.
122
+ */
123
+ export declare const EXECUTION_CAPABILITY_ORDER: readonly ["db", "fetch", "auth", "env", "realtime", "logging", "gravatar", "spam", "email"];
119
124
  /**
120
125
  * The portable seam, stated as one predicate.
121
126
  *
@@ -123,8 +128,15 @@ export type ExecutionCapabilities = z.infer<typeof executionCapabilitiesSchema>;
123
128
  * tier. `db` because Zero's store guarantees every handler runs inside one
124
129
  * parent-owned transaction, which an isolate reaching the database over a
125
130
  * relay cannot offer. `auth` because capsule identity is resolved against that
126
- * same transaction's view. Everything else — fetch, env, realtime, logging
127
- * is brokered identically on both tiers and does not constrain placement.
131
+ * same transaction's view. Everything else — fetch, env, realtime, logging, and
132
+ * the three platform services — is brokered identically on both tiers and does
133
+ * not constrain placement.
134
+ *
135
+ * `email` is the one worth stating explicitly, because it looks like it should
136
+ * bind: a Zero mutation's send is atomic with its database writes, and a
137
+ * Function's is not. That is a difference in the *guarantee* either tier can
138
+ * offer, not in what the handler is allowed to reach, and placement follows
139
+ * what code reaches. An author who needs that atomicity writes a capsule.
128
140
  *
129
141
  * Nothing here decides placement automatically: the product a version deploys
130
142
  * to is a property of what its author wrote, and this predicate only reports
@@ -156,6 +168,9 @@ export declare function executionEndpointSourceSchema(routePathSchema: z.ZodType
156
168
  env: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
157
169
  realtime: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
158
170
  logging: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
171
+ gravatar: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
172
+ spam: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
173
+ email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
159
174
  }, z.core.$strip>>;
160
175
  }, z.core.$strict>;
161
176
  /**
@@ -175,6 +190,13 @@ export declare function executionBundleSchema(options: {
175
190
  export declare function executionStaticFileSchema(options: {
176
191
  storageRoot: string;
177
192
  maxBytes: number;
193
+ /**
194
+ * The one underscore-prefixed root a platform compile may write into. Author
195
+ * trees still cannot: the leading-underscore ban is what keeps `_headers` and
196
+ * `_redirects` from being forged as content, and this exemption is a literal
197
+ * prefix the compiler owns, not a relaxation of the rule.
198
+ */
199
+ platformAssetRoot?: string;
178
200
  }): z.ZodObject<{
179
201
  path: z.ZodString;
180
202
  contentType: z.ZodString;
@@ -192,47 +214,3 @@ export declare const executionInspectPolicySchema: z.ZodEnum<{
192
214
  private: "private";
193
215
  }>;
194
216
  export type ExecutionInspectPolicy = z.infer<typeof executionInspectPolicySchema>;
195
- export declare const executionLogEntrySchema: z.ZodObject<{
196
- id: z.ZodString;
197
- timestamp: z.ZodString;
198
- level: z.ZodEnum<{
199
- info: "info";
200
- error: "error";
201
- debug: "debug";
202
- warn: "warn";
203
- }>;
204
- requestId: z.ZodNullable<z.ZodString>;
205
- versionId: z.ZodNullable<z.ZodString>;
206
- handlerName: z.ZodNullable<z.ZodString>;
207
- message: z.ZodString;
208
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
209
- }, z.core.$strict>;
210
- export type ExecutionLogEntry = z.infer<typeof executionLogEntrySchema>;
211
- export declare const executionLogListQuerySchema: z.ZodObject<{
212
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
213
- cursor: z.ZodOptional<z.ZodString>;
214
- requestId: z.ZodOptional<z.ZodString>;
215
- handlerName: z.ZodOptional<z.ZodString>;
216
- }, z.core.$strict>;
217
- export type ExecutionLogListQuery = z.infer<typeof executionLogListQuerySchema>;
218
- export declare const executionLogListResponseSchema: z.ZodObject<{
219
- data: z.ZodArray<z.ZodObject<{
220
- id: z.ZodString;
221
- timestamp: z.ZodString;
222
- level: z.ZodEnum<{
223
- info: "info";
224
- error: "error";
225
- debug: "debug";
226
- warn: "warn";
227
- }>;
228
- requestId: z.ZodNullable<z.ZodString>;
229
- versionId: z.ZodNullable<z.ZodString>;
230
- handlerName: z.ZodNullable<z.ZodString>;
231
- message: z.ZodString;
232
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
233
- }, z.core.$strict>>;
234
- pagination: z.ZodObject<{
235
- nextCursor: z.ZodNullable<z.ZodString>;
236
- }, z.core.$strict>;
237
- }, z.core.$strict>;
238
- export type ExecutionLogListResponse = z.infer<typeof executionLogListResponseSchema>;
@@ -18,13 +18,12 @@ import { z } from "zod";
18
18
  * portable seam, and it is deliberately narrow: a capsule handler's semantics
19
19
  * depend on the transaction wrapped around it, which does not exist on an
20
20
  * isolate a continent away from the database.
21
+ *
22
+ * Neither is a "kind" a space declares. Every space owns a site, so what runs
23
+ * is a routing decision derived from what the published tree carries: static
24
+ * files, a worker, a capsule, or any mix of the three in one publish. There is
25
+ * no enum here to disagree with the tree.
21
26
  */
22
- /**
23
- * What a live version runs. `static` is bytes on disk with no execution at
24
- * all, and remains the overwhelming majority of traffic; the other two each
25
- * name a product.
26
- */
27
- export const runtimeKindSchema = z.enum(["static", "zero", "functions"]);
28
27
  /**
29
28
  * How a live runtime delivers realtime invalidations.
30
29
  *
@@ -50,6 +49,7 @@ export const EXECUTION_ENV_TOTAL_VALUE_MAX_BYTES = 64 * 1024;
50
49
  export const SERVER_ENV_FILE = ".env.server";
51
50
  /** Lakebed's documented server-only env filename, accepted for capsule portability. */
52
51
  export const LAKEBED_SERVER_ENV_FILE = ".env.lakebed.server";
52
+ export const SERVER_ENV_FILES = [SERVER_ENV_FILE, LAKEBED_SERVER_ENV_FILE];
53
53
  /**
54
54
  * Names the platform reserves for itself in the tenant environment. Tenant
55
55
  * code cannot set these, so it cannot spoof the values the broker trusts.
@@ -187,9 +187,31 @@ export const executionCapabilitiesSchema = z
187
187
  env: z.boolean().default(false),
188
188
  realtime: z.boolean().default(false),
189
189
  logging: z.boolean().default(false),
190
+ gravatar: z.boolean().default(false),
191
+ spam: z.boolean().default(false),
192
+ email: z.boolean().default(false),
190
193
  })
191
194
  .partial()
192
195
  .default({});
196
+ /**
197
+ * The order every surface renders a capability list in. Fixed rather than
198
+ * derived from a response body, so two spaces never list their capabilities
199
+ * differently because JSON came back reshuffled — and declared here, beside the
200
+ * schema, so adding a capability cannot leave a renderer silently omitting it.
201
+ */
202
+ export const EXECUTION_CAPABILITY_ORDER = [
203
+ "db",
204
+ "fetch",
205
+ "auth",
206
+ "env",
207
+ "realtime",
208
+ "logging",
209
+ "gravatar",
210
+ "spam",
211
+ "email",
212
+ ];
213
+ // A capability added to executionCapabilitiesSchema must also be added to the order above.
214
+ true;
193
215
  /**
194
216
  * The portable seam, stated as one predicate.
195
217
  *
@@ -197,8 +219,15 @@ export const executionCapabilitiesSchema = z
197
219
  * tier. `db` because Zero's store guarantees every handler runs inside one
198
220
  * parent-owned transaction, which an isolate reaching the database over a
199
221
  * relay cannot offer. `auth` because capsule identity is resolved against that
200
- * same transaction's view. Everything else — fetch, env, realtime, logging
201
- * is brokered identically on both tiers and does not constrain placement.
222
+ * same transaction's view. Everything else — fetch, env, realtime, logging, and
223
+ * the three platform services — is brokered identically on both tiers and does
224
+ * not constrain placement.
225
+ *
226
+ * `email` is the one worth stating explicitly, because it looks like it should
227
+ * bind: a Zero mutation's send is atomic with its database writes, and a
228
+ * Function's is not. That is a difference in the *guarantee* either tier can
229
+ * offer, not in what the handler is allowed to reach, and placement follows
230
+ * what code reaches. An author who needs that atomicity writes a capsule.
202
231
  *
203
232
  * Nothing here decides placement automatically: the product a version deploys
204
233
  * to is a property of what its author wrote, and this predicate only reports
@@ -248,6 +277,7 @@ export function executionBundleSchema(options) {
248
277
  .strict();
249
278
  }
250
279
  export function executionStaticFileSchema(options) {
280
+ const platformAssetPrefix = options.platformAssetRoot ? `${options.platformAssetRoot}/` : null;
251
281
  return z
252
282
  .object({
253
283
  path: z
@@ -260,7 +290,9 @@ export function executionStaticFileSchema(options) {
260
290
  .refine((path) => !path.startsWith(`${options.storageRoot}/`), {
261
291
  message: `Static files cannot use ${options.storageRoot}.`,
262
292
  })
263
- .refine((path) => !path.startsWith("_") && !path.startsWith("."), {
293
+ .refine((path) => (!path.startsWith("_") ||
294
+ (platformAssetPrefix !== null && path.startsWith(platformAssetPrefix))) &&
295
+ !path.startsWith("."), {
264
296
  message: "Static file paths cannot use private root prefixes.",
265
297
  }),
266
298
  contentType: z.string().min(1).max(255),
@@ -276,34 +308,3 @@ export function executionStaticFileSchema(options) {
276
308
  * the same question on each.
277
309
  */
278
310
  export const executionInspectPolicySchema = z.enum(["private", "public"]);
279
- export const executionLogEntrySchema = z
280
- .object({
281
- id: z.string().min(1),
282
- timestamp: z.string().datetime(),
283
- level: z.enum(["debug", "info", "warn", "error"]),
284
- requestId: z.string().min(1).nullable(),
285
- versionId: z.string().min(1).nullable(),
286
- /** Zero names the mutation; Functions names the handler. */
287
- handlerName: z.string().min(1).nullable(),
288
- message: z.string(),
289
- metadata: z.record(z.string(), z.unknown()).default({}),
290
- })
291
- .strict();
292
- export const executionLogListQuerySchema = z
293
- .object({
294
- limit: z.coerce.number().int().min(1).max(100).default(50),
295
- cursor: z.string().min(1).optional(),
296
- requestId: z.string().min(1).optional(),
297
- handlerName: z.string().min(1).optional(),
298
- })
299
- .strict();
300
- export const executionLogListResponseSchema = z
301
- .object({
302
- data: z.array(executionLogEntrySchema),
303
- pagination: z
304
- .object({
305
- nextCursor: z.string().nullable(),
306
- })
307
- .strict(),
308
- })
309
- .strict();
@@ -1,9 +1,5 @@
1
1
  export declare const FEATURE_STAGES: readonly ["internal", "private_beta", "ga"];
2
2
  export type FeatureStage = (typeof FEATURE_STAGES)[number];
3
- export declare const FEATURE_ASSIGNMENT_SCOPES: readonly ["user", "team", "global"];
4
- export type FeatureAssignmentScope = (typeof FEATURE_ASSIGNMENT_SCOPES)[number];
5
- export declare const FEATURE_EXECUTION_ACTOR_POLICIES: readonly ["request_actor", "persisted_request_actor", "resource_team", "global_policy"];
6
- export type FeatureExecutionActorPolicy = (typeof FEATURE_EXECUTION_ACTOR_POLICIES)[number];
7
3
  export declare const FEATURE_OWNER_IDS: readonly ["team:access", "team:build-platform", "team:collaboration", "team:commerce", "team:domains", "team:publishing", "team:runtime", "team:spaces", "team:tag-manager", "team:zero"];
8
4
  export type FeatureOwnerId = (typeof FEATURE_OWNER_IDS)[number];
9
5
  export type FeatureRegistryEntry<K extends string = string, DependencyKey extends string = K> = {
@@ -14,7 +10,6 @@ export type FeatureRegistryEntry<K extends string = string, DependencyKey extend
14
10
  readonly stage: FeatureStage;
15
11
  readonly surface: boolean;
16
12
  readonly defaultEnabled: boolean;
17
- readonly assignmentScopes: readonly FeatureAssignmentScope[];
18
13
  readonly docs: {
19
14
  readonly channel: "public" | "handbook";
20
15
  readonly slug: string;
@@ -26,7 +21,6 @@ export type FeatureRegistryEntry<K extends string = string, DependencyKey extend
26
21
  readonly reviewAfter: string | null;
27
22
  readonly removeAfter: string | null;
28
23
  readonly gaAt: string | null;
29
- readonly allowedActorPolicies: readonly FeatureExecutionActorPolicy[];
30
24
  readonly downRamp: {
31
25
  readonly code: string;
32
26
  readonly summary: string;
@@ -1,11 +1,4 @@
1
1
  export const FEATURE_STAGES = ["internal", "private_beta", "ga"];
2
- export const FEATURE_ASSIGNMENT_SCOPES = ["user", "team", "global"];
3
- export const FEATURE_EXECUTION_ACTOR_POLICIES = [
4
- "request_actor",
5
- "persisted_request_actor",
6
- "resource_team",
7
- "global_policy",
8
- ];
9
2
  export const FEATURE_OWNER_IDS = [
10
3
  "team:access",
11
4
  "team:build-platform",
@@ -21,10 +14,8 @@ export const FEATURE_OWNER_IDS = [
21
14
  export function freezeFeatureRegistryEntry(definition) {
22
15
  return Object.freeze({
23
16
  ...definition,
24
- assignmentScopes: Object.freeze([...definition.assignmentScopes]),
25
17
  docs: definition.docs === null ? null : Object.freeze({ ...definition.docs }),
26
18
  requires: Object.freeze([...definition.requires]),
27
- allowedActorPolicies: Object.freeze([...definition.allowedActorPolicies]),
28
19
  downRamp: Object.freeze({ ...definition.downRamp }),
29
20
  });
30
21
  }
@@ -104,21 +95,8 @@ export function validateFeatureLifecycleRegistry(registry) {
104
95
  if (hasRequiredMetadata(definition.downRamp.code) &&
105
96
  !/^[a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)*$/.test(definition.downRamp.code))
106
97
  errors.push(`${definition.key}: downRamp.code must use canonical snake_case`);
107
- if (definition.assignmentScopes.length === 0 || !definition.assignmentScopes.includes("global"))
108
- errors.push(`${definition.key}: assignmentScopes must include global`);
109
- if (definition.allowedActorPolicies.length === 0)
110
- errors.push(`${definition.key}: allowedActorPolicies must not be empty`);
111
- for (const [field, values] of [
112
- ["assignmentScopes", definition.assignmentScopes],
113
- ["allowedActorPolicies", definition.allowedActorPolicies],
114
- ["requires", definition.requires],
115
- ]) {
116
- for (const duplicate of duplicateValues(values))
117
- errors.push(`${definition.key}: ${field} contains duplicate ${duplicate}`);
118
- }
119
- if (definition.allowedActorPolicies.includes("global_policy") &&
120
- (definition.assignmentScopes.length !== 1 || definition.assignmentScopes[0] !== "global"))
121
- errors.push(`${definition.key}: global policy requires exactly global assignment scope`);
98
+ for (const duplicate of duplicateValues(definition.requires))
99
+ errors.push(`${definition.key}: requires contains duplicate ${duplicate}`);
122
100
  if (definition.stage !== "ga" && definition.surface && definition.defaultEnabled)
123
101
  errors.push(`${definition.key}: non-GA features default off`);
124
102
  if (definition.stage === "ga" && definition.surface && !definition.defaultEnabled)
@@ -173,19 +151,12 @@ export function validateFeatureLifecycleRegistry(registry) {
173
151
  definition.removeAfter !== null &&
174
152
  definition.gaAt > definition.removeAfter)
175
153
  errors.push(`${definition.key}: gaAt must not follow removeAfter`);
176
- if (definition.assignmentScopes.includes("user") &&
177
- !definition.allowedActorPolicies.some((policy) => policy === "request_actor" || policy === "persisted_request_actor"))
178
- errors.push(`${definition.key}: user scope requires an actor-aware policy`);
179
154
  for (const dependency of definition.requires) {
180
155
  const dependencyDefinition = byKey.get(dependency);
181
156
  if (!dependencyDefinition) {
182
157
  errors.push(`${definition.key}: unknown dependency ${dependency}`);
183
158
  continue;
184
159
  }
185
- if (definition.allowedActorPolicies.some((policy) => !dependencyDefinition.allowedActorPolicies.includes(policy)))
186
- errors.push(`${definition.key}: actor policies must be allowed by dependency ${dependency}`);
187
- if (definition.assignmentScopes.some((scope) => !dependencyDefinition.assignmentScopes.includes(scope)))
188
- errors.push(`${definition.key}: assignment scopes must be supported by dependency ${dependency}`);
189
160
  if (FEATURE_STAGES.indexOf(dependencyDefinition.stage) <
190
161
  FEATURE_STAGES.indexOf(definition.stage))
191
162
  errors.push(`${definition.key}: dependency ${dependency} must be at least as mature as its dependent`);