@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,20 +1,28 @@
1
1
  // The single error-code table (internal-docs/platform.md "Global API Conventions").
2
- // Every error envelope `code` the control plane emits is a member of this table, and
3
- // `docsUrl` is derived mechanically from the code (`https://spacefast.com/docs/errors/{code}`).
2
+ // Every problem document `code` the control plane emits is a member of this table, and
3
+ // the problem `type` is derived mechanically from the code
4
+ // (`https://spacefast.com/docs/errors/{code}`).
4
5
  // The conformance suite asserts the derivation rule so links never rot, and error docs
5
6
  // pages are generated from this enum. Control-plane error constructors are typed against
6
7
  // `ErrorCode`, so emitting a code that is not in the table is a typecheck (CI) failure;
7
8
  // the remaining untyped string paths (low-level serializer, superadmin Better Auth
8
- // passthrough) fold into the typed envelope in the F2 envelope chunk.
9
+ // passthrough) fold into the typed problem document in the F2 envelope chunk.
9
10
  // A code's meaning stays stable while it can be emitted. Retiring an API surface removes
10
11
  // its dead codes and generated references together. Diagnostic codes share this table so
11
12
  // every current diagnostic also carries a resolvable docs link.
12
- import { ERROR_DOCS_BASE_URL } from "../brand.js";
13
- export { ERROR_DOCS_BASE_URL };
14
- /** `docsUrl` derivation rule: docs origin + `/{code}`. Asserted by the conformance suite. */
13
+ import { DOCS_BASE_URL } from "../config/domains.js";
14
+ export const ERROR_DOCS_BASE_URL = `${DOCS_BASE_URL}/errors`;
15
+ /** Media type of every 4xx/5xx response body (RFC 9457 problem details). */
16
+ export const PROBLEM_CONTENT_TYPE = "application/problem+json";
17
+ /** Problem `type` URI derivation rule: docs origin + `/{code}`. Asserted by the conformance suite. */
15
18
  export function errorDocsUrl(code) {
16
19
  return `${ERROR_DOCS_BASE_URL}/${code}`;
17
20
  }
21
+ /** Problem `title` derivation rule: the snake_case code as a sentence ("version_not_found" → "Version not found"). */
22
+ export function errorTitle(code) {
23
+ const words = code.replaceAll("_", " ");
24
+ return words.charAt(0).toUpperCase() + words.slice(1);
25
+ }
18
26
  export const ERROR_CODES = [
19
27
  "abuse_report_invalid_transition",
20
28
  "abuse_report_rate_limited",
@@ -59,8 +67,12 @@ export const ERROR_CODES = [
59
67
  "cli_upgrade_required",
60
68
  "comment_screenshot_rate_limited",
61
69
  "config_file_too_large",
70
+ "config_functions_key_removed",
62
71
  "config_invalid",
63
72
  "config_meta_too_long",
73
+ "config_name_too_long",
74
+ "config_runtime_entry_missing",
75
+ "config_runtime_invalid_kind",
64
76
  "config_templates_over_limit",
65
77
  "continuation_unavailable",
66
78
  "continuation_used",
@@ -72,6 +84,7 @@ export const ERROR_CODES = [
72
84
  "csam_policy_floor",
73
85
  "custom_certificates_require_dedicated_site",
74
86
  "data_location_immutable",
87
+ "db_not_available",
75
88
  "device_authorization_failed",
76
89
  "device_verification_rate_limited",
77
90
  "dns_export_required",
@@ -135,11 +148,9 @@ export const ERROR_CODES = [
135
148
  "files_mode_does_not_support_spa",
136
149
  "forbidden",
137
150
  "free_external_proxy_disabled",
138
- "free_headers_basic_auth_disabled",
139
151
  "google_play_webhook_identity_not_configured",
140
152
  "idempotency_conflict_in_progress",
141
153
  "idempotency_key_reused",
142
- "immutable_version_requires_login",
143
154
  "import_archive_not_uploaded",
144
155
  "import_not_cancelable",
145
156
  "import_not_waiting_for_archive",
@@ -190,10 +201,11 @@ export const ERROR_CODES = [
190
201
  "manifest_body_too_large",
191
202
  "manifest_duplicate_path",
192
203
  "manifest_too_many_files",
193
- "mcp_acted_for_team_deleted",
194
204
  "member_already_exists",
205
+ "method_not_allowed",
195
206
  "missing_route_param",
196
207
  "move_target_capacity_lost",
208
+ "name_managed_by_config",
197
209
  "nameserver_delegation_required",
198
210
  "nameserver_divergence",
199
211
  "noop_publish",
@@ -237,17 +249,19 @@ export const ERROR_CODES = [
237
249
  "rate_limited",
238
250
  "registration_expired",
239
251
  "registration_expiring",
252
+ "resource_revision_changed",
240
253
  "routing_rules_over_plan",
241
254
  "runtime_action_forbidden",
242
255
  "runtime_api_not_found",
243
256
  "runtime_callback_forbidden",
257
+ "runtime_dev_unsupported",
244
258
  "runtime_engine_zip_missing",
245
259
  "runtime_hostname_unassigned",
246
260
  "runtime_instance_mismatch",
247
261
  "runtime_jti_missing",
248
262
  "runtime_jti_replayed",
249
263
  "runtime_jwks_key_missing",
250
- "runtime_logs_unavailable",
264
+ "runtime_kind_mismatch",
251
265
  "runtime_management_unavailable",
252
266
  "runtime_not_provisioned",
253
267
  "runtime_operation_missing",
@@ -260,9 +274,9 @@ export const ERROR_CODES = [
260
274
  "runtime_upload_required",
261
275
  "scan_pending",
262
276
  "secret_variable_in_template",
277
+ "service_booting",
263
278
  "service_signature_invalid",
264
279
  "site_already_deleted",
265
- "site_capacity_exceeded",
266
280
  "site_has_live_spaces",
267
281
  "site_not_static",
268
282
  "site_required",
@@ -275,6 +289,7 @@ export const ERROR_CODES = [
275
289
  "source_archive_expansion_ratio_exceeded",
276
290
  "source_archive_validation_busy",
277
291
  "space_already_claimed",
292
+ "space_capacity_warming",
278
293
  "space_claim_unavailable",
279
294
  "space_claimed_credential_available",
280
295
  "space_disabled",
@@ -286,27 +301,34 @@ export const ERROR_CODES = [
286
301
  "space_import_archive_too_large",
287
302
  "space_import_config_only_archive",
288
303
  "space_import_runtime_schema_unsupported",
304
+ "space_move_would_strand_zero_data",
289
305
  "space_moving",
290
306
  "space_no_live_version",
291
307
  "space_not_disabled",
292
308
  "space_not_restorable",
309
+ "space_person_already_member",
310
+ "space_person_invitation_pending",
311
+ "space_person_self_invite",
293
312
  "space_ref_ambiguous",
294
313
  "space_ref_required",
295
314
  "space_transferring",
296
315
  "space_unclaimed",
297
316
  "ssl_renewal_blocked",
298
317
  "static_control_file_not_supported",
299
- "static_mount_path_conflict",
300
- "static_mount_source_not_ready",
301
- "static_mount_target_forbidden",
302
- "static_mount_target_in_use",
303
- "static_mount_target_not_live",
304
- "static_mount_target_not_ready",
305
- "static_mount_target_not_static",
306
318
  "static_runtime_control_path_not_supported",
307
319
  "static_runtime_required",
320
+ "storage_auth_required",
308
321
  "storage_bucket_unavailable",
322
+ "storage_content_blocked",
323
+ "storage_delete_forbidden",
324
+ "storage_empty_file",
325
+ "storage_file_too_large",
326
+ "storage_key_invalid",
327
+ "storage_object_not_found",
328
+ "storage_quota_already_unlimited",
329
+ "storage_quota_decrease_not_supported",
309
330
  "storage_quota_exceeded",
331
+ "storage_unavailable",
310
332
  "storage_usage_unavailable",
311
333
  "stripe_error",
312
334
  "superseded_by_publish",
@@ -337,7 +359,6 @@ export const ERROR_CODES = [
337
359
  "upload_hash_mismatch",
338
360
  "upload_path_not_canonical",
339
361
  "upload_path_not_declared",
340
- "upload_session_cap_exceeded",
341
362
  "upload_size_mismatch",
342
363
  "user_banned",
343
364
  "validation_error",
@@ -396,6 +417,12 @@ export const ERROR_CODES = [
396
417
  "zero_client_bundle_not_loaded",
397
418
  "zero_db_connect_failed",
398
419
  "zero_db_execute_failed",
420
+ "zero_db_export_cursor_invalid",
421
+ "zero_db_export_failed",
422
+ "zero_db_export_page_too_large",
423
+ "zero_db_export_query_invalid",
424
+ "zero_db_export_schema_changed",
425
+ "zero_db_export_schema_unavailable",
399
426
  "zero_db_host_install_failed",
400
427
  "zero_db_operation_invalid",
401
428
  "zero_db_operation_too_large",
@@ -403,6 +430,8 @@ export const ERROR_CODES = [
403
430
  "zero_db_query_failed",
404
431
  "zero_db_row_invalid",
405
432
  "zero_db_sql_invalid",
433
+ "zero_db_target_denied",
434
+ "zero_db_tls_required",
406
435
  "zero_db_too_many_params",
407
436
  "zero_db_transaction_active",
408
437
  "zero_db_transaction_commit_failed",
@@ -472,11 +501,6 @@ export const ERROR_CODES = [
472
501
  "zero_runs_require_runtime_compiler",
473
502
  "zero_runs_too_many",
474
503
  "zero_shopify_unavailable",
475
- "zero_source_compile_failed",
476
- "zero_source_hash_mismatch",
477
- "zero_source_invalid",
478
- "zero_source_path_invalid",
479
- "zero_source_unreadable",
480
504
  ];
481
505
  const ERROR_CODE_SET = new Set(ERROR_CODES);
482
506
  export function isErrorCode(value) {
@@ -29,7 +29,7 @@ export type EventActor = z.infer<typeof eventActorSchema>;
29
29
  export declare const EVENT_CATALOG: {
30
30
  "client.page_viewed": {
31
31
  sources: ("www" | "dashboard")[];
32
- actors: ("anonymous_id" | "analytics_id")[];
32
+ actors: ("analytics_id" | "anonymous_id")[];
33
33
  properties: z.ZodObject<{
34
34
  path: z.ZodString;
35
35
  referrer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -37,7 +37,7 @@ export declare const EVENT_CATALOG: {
37
37
  };
38
38
  "client.web_vital.measured": {
39
39
  sources: ("www" | "dashboard")[];
40
- actors: ("anonymous_id" | "analytics_id")[];
40
+ actors: ("analytics_id" | "anonymous_id")[];
41
41
  properties: z.ZodObject<{
42
42
  metric: z.ZodEnum<{
43
43
  CLS: "CLS";
@@ -51,11 +51,18 @@ export declare const EVENT_CATALOG: {
51
51
  }, z.core.$strict>;
52
52
  };
53
53
  "client.error.observed": {
54
- sources: ("www" | "dashboard" | "cli" | "other")[];
55
- actors: ("anonymous_id" | "analytics_id" | "anonymous_machine")[];
54
+ sources: ("www" | "dashboard")[];
55
+ actors: ("analytics_id" | "anonymous_id")[];
56
56
  properties: z.ZodObject<{
57
+ kind: z.ZodEnum<{
58
+ uncaught_exception: "uncaught_exception";
59
+ unhandled_rejection: "unhandled_rejection";
60
+ }>;
57
61
  error_class: z.ZodString;
58
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ message: z.ZodNullable<z.ZodString>;
63
+ frames: z.ZodNullable<z.ZodString>;
64
+ fingerprint: z.ZodString;
65
+ path: z.ZodString;
59
66
  }, z.core.$strict>;
60
67
  };
61
68
  "cli.command.completed": {
@@ -69,27 +76,27 @@ export declare const EVENT_CATALOG: {
69
76
  };
70
77
  "browser.funnel.claim_page_viewed": {
71
78
  sources: ("www" | "dashboard")[];
72
- actors: ("anonymous_id" | "analytics_id")[];
79
+ actors: ("analytics_id" | "anonymous_id")[];
73
80
  properties: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
74
81
  };
75
82
  "browser.funnel.claim_token_validated": {
76
83
  sources: ("www" | "dashboard")[];
77
- actors: ("anonymous_id" | "analytics_id")[];
84
+ actors: ("analytics_id" | "anonymous_id")[];
78
85
  properties: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
79
86
  };
80
87
  "browser.funnel.space_claimed": {
81
88
  sources: ("www" | "dashboard")[];
82
- actors: ("anonymous_id" | "analytics_id")[];
89
+ actors: ("analytics_id" | "anonymous_id")[];
83
90
  properties: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
84
91
  };
85
92
  "browser.funnel.claim_rescue_countdown_viewed": {
86
93
  sources: ("www" | "dashboard")[];
87
- actors: ("anonymous_id" | "analytics_id")[];
94
+ actors: ("analytics_id" | "anonymous_id")[];
88
95
  properties: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
89
96
  };
90
97
  "browser.funnel.claim_reminder_requested": {
91
98
  sources: ("www" | "dashboard")[];
92
- actors: ("anonymous_id" | "analytics_id")[];
99
+ actors: ("analytics_id" | "anonymous_id")[];
93
100
  properties: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
94
101
  };
95
102
  "domain.search.session_started": {
@@ -190,7 +197,7 @@ export declare const EVENT_CATALOG: {
190
197
  };
191
198
  "publish.receipt.created": {
192
199
  sources: "control-plane"[];
193
- actors: ("system" | "anonymous_id" | "analytics_id")[];
200
+ actors: ("system" | "analytics_id" | "anonymous_id")[];
194
201
  properties: z.ZodObject<{
195
202
  access: z.ZodString;
196
203
  anonymous: z.ZodBoolean;
@@ -202,7 +209,7 @@ export declare const EVENT_CATALOG: {
202
209
  };
203
210
  "version.intent.created": {
204
211
  sources: "control-plane"[];
205
- actors: ("system" | "anonymous_id" | "analytics_id")[];
212
+ actors: ("system" | "analytics_id" | "anonymous_id")[];
206
213
  properties: z.ZodObject<{
207
214
  access: z.ZodString;
208
215
  file_count: z.ZodNumber;
@@ -217,7 +224,7 @@ export declare const EVENT_CATALOG: {
217
224
  };
218
225
  "version.finalize.queued": {
219
226
  sources: "control-plane"[];
220
- actors: ("system" | "anonymous_id" | "analytics_id")[];
227
+ actors: ("system" | "analytics_id" | "anonymous_id")[];
221
228
  properties: z.ZodObject<{
222
229
  access: z.ZodString;
223
230
  async: z.ZodBoolean;
@@ -228,7 +235,7 @@ export declare const EVENT_CATALOG: {
228
235
  };
229
236
  "version.promote.queued": {
230
237
  sources: "control-plane"[];
231
- actors: ("system" | "anonymous_id" | "analytics_id")[];
238
+ actors: ("system" | "analytics_id" | "anonymous_id")[];
232
239
  properties: z.ZodObject<{
233
240
  access: z.ZodString;
234
241
  async: z.ZodBoolean;
@@ -237,7 +244,7 @@ export declare const EVENT_CATALOG: {
237
244
  };
238
245
  "feature.blocked": {
239
246
  sources: "control-plane"[];
240
- actors: ("system" | "anonymous_id" | "analytics_id")[];
247
+ actors: ("system" | "analytics_id" | "anonymous_id")[];
241
248
  properties: z.ZodObject<{
242
249
  feature: z.ZodString;
243
250
  plan: z.ZodNullable<z.ZodString>;
@@ -9,7 +9,7 @@ const occurredAtSchema = z
9
9
  .string()
10
10
  .datetime()
11
11
  .optional()
12
- .describe("Client-side event time; the server receive time is authoritative when omitted.");
12
+ .describe("Client-side event time; server receipt time is authoritative when omitted.");
13
13
  const pathSchema = z
14
14
  .string()
15
15
  .min(1)
@@ -68,10 +68,38 @@ const webVitalPropertiesSchema = z
68
68
  path: pathSchema,
69
69
  })
70
70
  .strict();
71
+ // An uncaught browser error is not a single label — `error.name` is "Error" for
72
+ // almost every application throw, so a one-field shape both fails to attribute
73
+ // and (because it feeds the sender's dedupe key) suppresses genuinely distinct
74
+ // errors. Model the fingerprint instead: signal kind, thrown-value class,
75
+ // redacted message, top frames, and a deterministic grouping key. Every string
76
+ // stays within `propertyValueSchema`'s 512-char cap — the generic property bag
77
+ // validates alongside this schema, so a longer field would 400 at ingest.
71
78
  const clientErrorPropertiesSchema = z
72
79
  .object({
73
- error_class: z.string().min(1).max(128),
74
- path: pathSchema.nullable().optional(),
80
+ kind: z
81
+ .enum(["uncaught_exception", "unhandled_rejection"])
82
+ .describe("Which browser signal produced this — orthogonal to what was thrown."),
83
+ error_class: z
84
+ .string()
85
+ .min(1)
86
+ .max(128)
87
+ .describe("Constructor name, or `NonError:<typeof>` when a non-Error was thrown."),
88
+ message: z
89
+ .string()
90
+ .max(512)
91
+ .nullable()
92
+ .describe("Redacted, truncated message; null when the thrown value carries none."),
93
+ frames: z
94
+ .string()
95
+ .max(512)
96
+ .nullable()
97
+ .describe("Top stack frames, newest first, origin-relative, ' | '-joined."),
98
+ fingerprint: z
99
+ .string()
100
+ .regex(/^[0-9a-z]{1,16}$/)
101
+ .describe("Deterministic dedupe/group key over kind, class, normalized message, top frame."),
102
+ path: pathSchema,
75
103
  })
76
104
  .strict();
77
105
  const cliCommandPropertiesSchema = z
@@ -184,8 +212,8 @@ export const EVENT_CATALOG = {
184
212
  properties: webVitalPropertiesSchema,
185
213
  },
186
214
  "client.error.observed": {
187
- sources: ["dashboard", "www", "cli", "other"],
188
- actors: ["analytics_id", "anonymous_id", "anonymous_machine"],
215
+ sources: ["dashboard", "www"],
216
+ actors: ["analytics_id", "anonymous_id"],
189
217
  properties: clientErrorPropertiesSchema,
190
218
  },
191
219
  "cli.command.completed": {
@@ -0,0 +1,238 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The platform execution layer: everything true of running tenant code on
4
+ * Spacefast regardless of which product is running it.
5
+ *
6
+ * Two products sit on top of this file, and they are genuinely different
7
+ * things rather than two configurations of one thing:
8
+ *
9
+ * - **Zero** (`./zero.js`) runs capsules — schema, queries, mutations and
10
+ * endpoints that share one parent-owned transaction — in the native runner
11
+ * on a dedicated wp.cloud site, next to that site's MySQL.
12
+ * - **Functions** (`./functions.js`) runs workers on Cloudflare Workers for
13
+ * Platforms, carrying npm and framework output that we could never sandbox
14
+ * as well ourselves.
15
+ *
16
+ * The only surface both can host is an endpoint that touches neither the
17
+ * database nor the caller's identity — see `endpointIsPortable`. That is the
18
+ * portable seam, and it is deliberately narrow: a capsule handler's semantics
19
+ * depend on the transaction wrapped around it, which does not exist on an
20
+ * isolate a continent away from the database.
21
+ */
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
+ /**
34
+ * How a live runtime delivers realtime invalidations.
35
+ *
36
+ * One vocabulary end to end: the finalize payload, the client config a serving
37
+ * runtime hands the browser, and every API response all name the transport
38
+ * with these three values. `central` is the hosted relay, `cast` is the
39
+ * collaboration service, and `local` is a dev machine serving its own socket —
40
+ * a distinction a customer can act on, unlike the component names the transports
41
+ * used to be called after.
42
+ */
43
+ export declare const RUNTIME_REALTIME_MODES: readonly ["central", "cast", "local"];
44
+ export declare const runtimeRealtimeModeSchema: z.ZodEnum<{
45
+ local: "local";
46
+ cast: "cast";
47
+ central: "central";
48
+ }>;
49
+ export type RuntimeRealtimeMode = z.infer<typeof runtimeRealtimeModeSchema>;
50
+ export declare const EXECUTION_ENV_MAX_KEYS = 64;
51
+ export declare const EXECUTION_ENV_NAME_MAX_BYTES = 128;
52
+ export declare const EXECUTION_ENV_VALUE_MAX_BYTES: number;
53
+ export declare const EXECUTION_ENV_TOTAL_VALUE_MAX_BYTES: number;
54
+ /**
55
+ * Server-only variables for whichever runtime this version declares. Publish
56
+ * syncs the file into the space's variables as secrets; the shared publish
57
+ * denylist (`.env.*`) keeps the file itself out of every artifact, so the
58
+ * values reach the runtime through variables and never through content.
59
+ */
60
+ export declare const SERVER_ENV_FILE = ".env.server";
61
+ /** Lakebed's documented server-only env filename, accepted for capsule portability. */
62
+ export declare const LAKEBED_SERVER_ENV_FILE = ".env.lakebed.server";
63
+ /**
64
+ * Names the platform reserves for itself in the tenant environment. Tenant
65
+ * code cannot set these, so it cannot spoof the values the broker trusts.
66
+ */
67
+ export declare const EXECUTION_ENV_RESERVED_PREFIXES: readonly ["SPACEFAST_", "ZERO_"];
68
+ /** Paths the platform owns on every space, whatever the product. */
69
+ export declare const PLATFORM_ROUTE_PREFIX = "/__spacefast";
70
+ /**
71
+ * First path segments the platform claims. Matched as segment prefixes rather
72
+ * than whole segments because the runtime already reserves the whole family —
73
+ * `/__stattic_probe` is a live serving path, and `upload-policy.php` refuses
74
+ * any first segment starting with either of these. Encoding it the same way
75
+ * here keeps a capsule or worker from declaring a route the origin would
76
+ * intercept before it ever reached them.
77
+ */
78
+ export declare const PLATFORM_RESERVED_ROUTE_SEGMENT_PREFIXES: readonly ["__spacefast", "__stattic", "__span"];
79
+ export declare const executionSha256Schema: z.ZodString;
80
+ export declare const executionBase64Schema: z.ZodString;
81
+ export declare const executionIdentifierSchema: z.ZodString;
82
+ export declare const executionEnvNameSchema: z.ZodString;
83
+ /**
84
+ * Builds the route-path schema for a product. Structural rules — normalization,
85
+ * traversal, wildcards, the platform's own prefixes — are identical everywhere
86
+ * and live here. Each product passes the extra paths and prefixes its own app
87
+ * shell claims, because those differ: Zero's client router owns `/auth/*`,
88
+ * a Functions worker owns nothing beyond what the platform reserves.
89
+ */
90
+ export declare function appRoutePathSchema(options: {
91
+ subject: string;
92
+ reservedPaths?: readonly string[];
93
+ reservedPrefixes?: readonly string[];
94
+ }): z.ZodString;
95
+ export declare const httpMethodSchema: z.ZodEnum<{
96
+ POST: "POST";
97
+ PUT: "PUT";
98
+ GET: "GET";
99
+ HEAD: "HEAD";
100
+ PATCH: "PATCH";
101
+ DELETE: "DELETE";
102
+ OPTIONS: "OPTIONS";
103
+ }>;
104
+ export type HttpMethod = z.infer<typeof httpMethodSchema>;
105
+ /**
106
+ * What a handler is allowed to reach. Declared at build time from what the
107
+ * source actually imports, not from what the author claims, and printed in the
108
+ * publish receipt so placement is never a surprise.
109
+ */
110
+ export declare const executionCapabilitiesSchema: z.ZodDefault<z.ZodObject<{
111
+ db: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
112
+ fetch: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
113
+ auth: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
114
+ env: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
115
+ realtime: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
116
+ logging: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
117
+ }, z.core.$strip>>;
118
+ export type ExecutionCapabilities = z.infer<typeof executionCapabilitiesSchema>;
119
+ /**
120
+ * The portable seam, stated as one predicate.
121
+ *
122
+ * `db` and `auth` are the two capabilities that bind a handler to the local
123
+ * tier. `db` because Zero's store guarantees every handler runs inside one
124
+ * parent-owned transaction, which an isolate reaching the database over a
125
+ * 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.
128
+ *
129
+ * Nothing here decides placement automatically: the product a version deploys
130
+ * to is a property of what its author wrote, and this predicate only reports
131
+ * whether the code could also have run on the other tier.
132
+ */
133
+ export declare function endpointIsPortable(capabilities: ExecutionCapabilities): boolean;
134
+ /**
135
+ * A source-carrying handler, before it is compiled to whichever tier will run
136
+ * it. Both products publish these; only the capability set decides which of
137
+ * them could accept a given one.
138
+ */
139
+ export declare function executionEndpointSourceSchema(routePathSchema: z.ZodType<string>): z.ZodObject<{
140
+ method: z.ZodEnum<{
141
+ POST: "POST";
142
+ PUT: "PUT";
143
+ GET: "GET";
144
+ HEAD: "HEAD";
145
+ PATCH: "PATCH";
146
+ DELETE: "DELETE";
147
+ OPTIONS: "OPTIONS";
148
+ }>;
149
+ path: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
150
+ endpointId: z.ZodString;
151
+ source: z.ZodString;
152
+ capabilities: z.ZodDefault<z.ZodObject<{
153
+ db: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
154
+ fetch: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
155
+ auth: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
156
+ env: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
157
+ realtime: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
158
+ logging: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
159
+ }, z.core.$strip>>;
160
+ }, z.core.$strict>;
161
+ /**
162
+ * Byte-carrying artifacts travel inline in the finalize payload rather than as
163
+ * a separate upload, so a version's code lands in the same atomic write as the
164
+ * rest of it. The storage root and ceiling differ per product, hence a factory.
165
+ */
166
+ export declare function executionBundleSchema(options: {
167
+ bundleRoot: string;
168
+ maxBytes: number;
169
+ }): z.ZodObject<{
170
+ path: z.ZodString;
171
+ sha256: z.ZodString;
172
+ size: z.ZodNumber;
173
+ contentBase64: z.ZodString;
174
+ }, z.core.$strict>;
175
+ export declare function executionStaticFileSchema(options: {
176
+ storageRoot: string;
177
+ maxBytes: number;
178
+ }): z.ZodObject<{
179
+ path: z.ZodString;
180
+ contentType: z.ZodString;
181
+ sha256: z.ZodString;
182
+ size: z.ZodNumber;
183
+ contentBase64: z.ZodString;
184
+ }, z.core.$strict>;
185
+ /**
186
+ * Whether a version's execution surface may be read by anyone or only by the
187
+ * space's own members. Both products expose an inspect route; the policy is
188
+ * the same question on each.
189
+ */
190
+ export declare const executionInspectPolicySchema: z.ZodEnum<{
191
+ public: "public";
192
+ private: "private";
193
+ }>;
194
+ 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>;