@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,15 +1,14 @@
1
1
  import { z } from "zod";
2
- export const SITE_PAGE_IDS = ["404", "password", "denied", "login", "index", "preview"];
2
+ export const SITE_PAGE_IDS = ["404", "denied", "access", "index", "preview"];
3
3
  export const sitePageIdSchema = z.enum(SITE_PAGE_IDS);
4
- export const ROUTE_PAGE_IDS = ["404", "password", "denied", "login"];
4
+ export const ROUTE_PAGE_IDS = ["404", "denied", "access"];
5
5
  export const routePageIdSchema = z.enum(ROUTE_PAGE_IDS);
6
- export const CUSTOM_PAGE_IDS = ["404", "password", "denied", "index", "preview"];
6
+ export const CUSTOM_PAGE_IDS = ["404", "denied", "access", "index", "preview"];
7
7
  export const customPageIdSchema = z.enum(CUSTOM_PAGE_IDS);
8
8
  export const PLATFORM_PAGE_IDS = [
9
9
  "undeployed",
10
10
  "suspended",
11
11
  "legal",
12
- "visit-cap",
13
12
  "gone",
14
13
  "runtime-error",
15
14
  "rate-limited",
@@ -21,9 +20,9 @@ export const PLATFORM_PAGE_IDS = [
21
20
  export const platformPageIdSchema = z.enum(PLATFORM_PAGE_IDS);
22
21
  export const PAGE_ELEMENTS = [
23
22
  "sf-content",
24
- "sf-password-form",
25
- "sf-login",
26
23
  "sf-denial-context",
24
+ "sf-access-status",
25
+ "sf-access-lanes",
27
26
  "sf-page-path",
28
27
  "sf-page-title",
29
28
  "sf-page-summary",
@@ -37,42 +36,39 @@ export const PAGE_CATALOG = {
37
36
  "404": {
38
37
  id: "404",
39
38
  status: 404,
40
- cacheControl: "public, max-age=0, s-maxage=60, must-revalidate",
39
+ cacheControl: "public, max-age=0, s-maxage=600, stale-while-revalidate=60",
41
40
  noindex: false,
42
41
  customTemplate: true,
43
42
  },
44
- password: {
45
- id: "password",
46
- status: 401,
47
- cacheControl: "private, no-store",
48
- noindex: true,
49
- customTemplate: true,
50
- },
51
43
  denied: {
52
44
  id: "denied",
53
45
  status: 403,
54
46
  cacheControl: "private, no-store",
55
47
  noindex: true,
56
- customTemplate: true,
48
+ customTemplate: false,
57
49
  },
58
- login: {
59
- id: "login",
60
- status: 401,
50
+ // The visitor access page: the deny surface WITH lanes (sign in, SSO,
51
+ // password, request an invite). Rendered by the runtime at the requested URL;
52
+ // publishers may fully retheme it — the runtime injects the functional lane
53
+ // blocks into the sf-access-* slots so forms and states stay correct.
54
+ access: {
55
+ id: "access",
56
+ status: 403,
61
57
  cacheControl: "private, no-store",
62
58
  noindex: true,
63
- customTemplate: false,
59
+ customTemplate: true,
64
60
  },
65
61
  index: {
66
62
  id: "index",
67
63
  status: 200,
68
- cacheControl: "public, max-age=0, s-maxage=60, must-revalidate",
64
+ cacheControl: "public, max-age=0, s-maxage=600, stale-while-revalidate=60",
69
65
  noindex: false,
70
66
  customTemplate: true,
71
67
  },
72
68
  preview: {
73
69
  id: "preview",
74
70
  status: 200,
75
- cacheControl: "public, max-age=0, s-maxage=60, must-revalidate",
71
+ cacheControl: "public, max-age=0, s-maxage=600, stale-while-revalidate=60",
76
72
  noindex: false,
77
73
  customTemplate: true,
78
74
  },
@@ -1,10 +1,8 @@
1
1
  import { z } from "zod";
2
- export declare const PLAN_DISABLED_BEHAVIOR_CODES: readonly ["free_external_proxy_disabled", "free_headers_basic_auth_disabled", "routing_rules_over_plan", "immutable_version_requires_login"];
2
+ export declare const PLAN_DISABLED_BEHAVIOR_CODES: readonly ["free_external_proxy_disabled", "routing_rules_over_plan"];
3
3
  export declare const planDisabledBehaviorSchema: z.ZodObject<{
4
4
  code: z.ZodEnum<{
5
5
  free_external_proxy_disabled: "free_external_proxy_disabled";
6
- free_headers_basic_auth_disabled: "free_headers_basic_auth_disabled";
7
- immutable_version_requires_login: "immutable_version_requires_login";
8
6
  routing_rules_over_plan: "routing_rules_over_plan";
9
7
  }>;
10
8
  behavior: z.ZodString;
@@ -12,7 +10,6 @@ export declare const planDisabledBehaviorSchema: z.ZodObject<{
12
10
  warning: "warning";
13
11
  ignored: "ignored";
14
12
  platform_page: "platform_page";
15
- login_redirect: "login_redirect";
16
13
  }>;
17
14
  }, z.core.$strip>;
18
15
  export type PlanDisabledBehavior = z.infer<typeof planDisabledBehaviorSchema>;
@@ -41,7 +38,6 @@ export declare const PlanPolicyResponseSchema: z.ZodObject<{
41
38
  subTeams: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
42
39
  externalDomainGroups: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
43
40
  boughtDomains: z.ZodLiteral<"unlimited">;
44
- publicImmutableVersionWindowDays: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
45
41
  maxFileBytes: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
46
42
  maxVersionFiles: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
47
43
  routingRules: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"unlimited">]>;
@@ -69,8 +65,6 @@ export declare const PlanPolicyResponseSchema: z.ZodObject<{
69
65
  disabledBehaviors: z.ZodOptional<z.ZodArray<z.ZodObject<{
70
66
  code: z.ZodEnum<{
71
67
  free_external_proxy_disabled: "free_external_proxy_disabled";
72
- free_headers_basic_auth_disabled: "free_headers_basic_auth_disabled";
73
- immutable_version_requires_login: "immutable_version_requires_login";
74
68
  routing_rules_over_plan: "routing_rules_over_plan";
75
69
  }>;
76
70
  behavior: z.ZodString;
@@ -78,7 +72,6 @@ export declare const PlanPolicyResponseSchema: z.ZodObject<{
78
72
  warning: "warning";
79
73
  ignored: "ignored";
80
74
  platform_page: "platform_page";
81
- login_redirect: "login_redirect";
82
75
  }>;
83
76
  }, z.core.$strip>>>;
84
77
  }, z.core.$strip>;
@@ -5,9 +5,7 @@ import { planCodeSchema, planLimitValueSchema } from "./features.js";
5
5
  // plan does not include them (internal-docs/platform.md "Plans And Limits").
6
6
  export const PLAN_DISABLED_BEHAVIOR_CODES = [
7
7
  "free_external_proxy_disabled",
8
- "free_headers_basic_auth_disabled",
9
8
  "routing_rules_over_plan",
10
- "immutable_version_requires_login",
11
9
  ];
12
10
  export const planDisabledBehaviorSchema = z.object({
13
11
  code: z
@@ -15,7 +13,7 @@ export const planDisabledBehaviorSchema = z.object({
15
13
  .describe("Stable code identifying the disabled behavior."),
16
14
  behavior: z.string().describe("What the platform does instead of honoring the behavior."),
17
15
  renderedAs: z
18
- .enum(["warning", "platform_page", "login_redirect", "ignored"])
16
+ .enum(["warning", "platform_page", "ignored"])
19
17
  .describe("How the disablement surfaces to users."),
20
18
  });
21
19
  export const PlanPolicyResponseSchema = z.object({
@@ -40,7 +38,6 @@ export const PlanPolicyResponseSchema = z.object({
40
38
  boughtDomains: z
41
39
  .literal("unlimited")
42
40
  .describe("Domains bought through Spacefast never count against external domain limits."),
43
- publicImmutableVersionWindowDays: planLimitValueSchema,
44
41
  maxFileBytes: planLimitValueSchema,
45
42
  maxVersionFiles: planLimitValueSchema.describe("Files per version; plan policy may lower the 100,000-file contract ceiling, never raise it."),
46
43
  routingRules: planLimitValueSchema,
@@ -28,15 +28,51 @@ export declare const accessLogEntrySchema: z.ZodObject<{
28
28
  status: z.ZodNumber;
29
29
  bytes: z.ZodNumber;
30
30
  }, z.core.$strip>;
31
+ /**
32
+ * One line a space's own code wrote, from whichever execution tier serves it.
33
+ *
34
+ * This is `executionLogEntrySchema` verbatim rather than a platform-shaped
35
+ * restatement of it: both tiers already emit that shape, and re-declaring it
36
+ * here would be a second definition to keep in sync with the runtimes that
37
+ * produce the records.
38
+ *
39
+ * Unlike its access-log sibling there is no `ts` alongside `timestamp`. That
40
+ * duplication is a compatibility alias the access log carries for callers that
41
+ * predate the rename; runtime logs have never been served to anyone, so there
42
+ * is no caller to keep and no reason to inherit the wart.
43
+ */
31
44
  export declare const runtimeLogEntrySchema: z.ZodObject<{
32
- ts: z.ZodString;
45
+ id: z.ZodString;
33
46
  timestamp: z.ZodString;
34
- level: z.ZodString;
35
- code: z.ZodString;
47
+ level: z.ZodEnum<{
48
+ info: "info";
49
+ error: "error";
50
+ debug: "debug";
51
+ warn: "warn";
52
+ }>;
53
+ requestId: z.ZodNullable<z.ZodString>;
54
+ versionId: z.ZodNullable<z.ZodString>;
55
+ handlerName: z.ZodNullable<z.ZodString>;
36
56
  message: z.ZodString;
37
- file: z.ZodNullable<z.ZodString>;
38
- line: z.ZodNullable<z.ZodString>;
57
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
58
+ }, z.core.$strict>;
59
+ export type RuntimeLogEntry = z.infer<typeof runtimeLogEntrySchema>;
60
+ /**
61
+ * Handler logs are filtered, not windowed.
62
+ *
63
+ * The access log takes `since`/`until` because the provider indexes by time.
64
+ * Neither execution tier does: Zero pages a local append-only store by cursor,
65
+ * and the origin walks day files backwards from newest. Accepting a `since`
66
+ * here would mean ignoring it, so it is absent — the filters below are the ones
67
+ * both tiers actually honour.
68
+ */
69
+ export declare const runtimeLogListQuerySchema: z.ZodObject<{
70
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
71
+ cursor: z.ZodOptional<z.ZodString>;
72
+ requestId: z.ZodOptional<z.ZodString>;
73
+ handlerName: z.ZodOptional<z.ZodString>;
39
74
  }, z.core.$strip>;
75
+ export type RuntimeLogListQuery = z.infer<typeof runtimeLogListQuerySchema>;
40
76
  export declare const accessLogListResponseSchema: z.ZodObject<{
41
77
  data: z.ZodArray<z.ZodObject<{
42
78
  ts: z.ZodString;
@@ -72,40 +108,52 @@ export declare const accessLogListResponseSchema: z.ZodObject<{
72
108
  retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
73
109
  }, z.core.$strip>>>;
74
110
  }, z.core.$strip>;
111
+ /**
112
+ * Paged handler logs.
113
+ *
114
+ * The pagination block is deliberately the same `CursorPaginationSchema` the
115
+ * access log uses — the two kinds sit side by side under one command, and a
116
+ * caller should not have to learn a second paging idiom to read the other half
117
+ * of its own space.
118
+ *
119
+ * One thing about that cursor is worth stating rather than discovering: **an
120
+ * empty page does not mean the end.** `hasMore` is true whenever the server
121
+ * stopped before reaching the oldest retained line, and the origin reader stops
122
+ * on its own per-page bounds — day count, line count, bytes scanned — which it
123
+ * can hit while a `requestId` or `handlerName` filter matched nothing in the
124
+ * stretch it read. Both tiers satisfy the same rule: **`hasMore: false` means
125
+ * you have seen everything; `hasMore: true` means keep paging, whatever `data`
126
+ * held.** A client that stops on the first empty page will silently truncate a
127
+ * filtered search.
128
+ *
129
+ * No `warnings` array, unlike the access log. Its one diagnostic is
130
+ * `log_retention_clamped`, which reports a requested window being cut back to
131
+ * the plan's retention — and there is no window to clamp here. An empty
132
+ * diagnostics channel would be a field every caller must handle and no server
133
+ * ever fills.
134
+ */
75
135
  export declare const runtimeLogListResponseSchema: z.ZodObject<{
76
136
  data: z.ZodArray<z.ZodObject<{
77
- ts: z.ZodString;
137
+ id: z.ZodString;
78
138
  timestamp: z.ZodString;
79
- level: z.ZodString;
80
- code: z.ZodString;
139
+ level: z.ZodEnum<{
140
+ info: "info";
141
+ error: "error";
142
+ debug: "debug";
143
+ warn: "warn";
144
+ }>;
145
+ requestId: z.ZodNullable<z.ZodString>;
146
+ versionId: z.ZodNullable<z.ZodString>;
147
+ handlerName: z.ZodNullable<z.ZodString>;
81
148
  message: z.ZodString;
82
- file: z.ZodNullable<z.ZodString>;
83
- line: z.ZodNullable<z.ZodString>;
84
- }, z.core.$strip>>;
149
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
150
+ }, z.core.$strict>>;
85
151
  pagination: z.ZodObject<{
86
152
  nextCursor: z.ZodNullable<z.ZodString>;
87
153
  hasMore: z.ZodBoolean;
88
154
  }, z.core.$strip>;
89
- warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
90
- code: z.ZodString;
91
- severity: z.ZodEnum<{
92
- info: "info";
93
- error: "error";
94
- warning: "warning";
95
- }>;
96
- message: z.ZodString;
97
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
99
- registrar: "registrar";
100
- wpcloud: "wpcloud";
101
- dns: "dns";
102
- runtime: "runtime";
103
- }>>>;
104
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
105
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
106
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
107
- }, z.core.$strip>>>;
108
155
  }, z.core.$strip>;
156
+ export type RuntimeLogListResponse = z.infer<typeof runtimeLogListResponseSchema>;
109
157
  export declare const analyticsQuerySchema: z.ZodObject<{
110
158
  window: z.ZodOptional<z.ZodEnum<{
111
159
  custom: "custom";
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { CursorPaginationSchema, baseDiagnosticSchema, cursorListQuerySchema } from "./common.js";
3
+ import { executionLogEntrySchema } from "./execution.js";
3
4
  export const domainPurchaseContactSchema = z.object({
4
5
  firstName: z.string().trim().min(1).max(80),
5
6
  lastName: z.string().trim().min(1).max(80),
@@ -27,14 +28,40 @@ export const accessLogEntrySchema = z.object({
27
28
  status: z.number().int(),
28
29
  bytes: z.number().int().nonnegative(),
29
30
  });
30
- export const runtimeLogEntrySchema = z.object({
31
- ts: z.string().datetime(),
32
- timestamp: z.string().datetime(),
33
- level: z.string(),
34
- code: z.string(),
35
- message: z.string(),
36
- file: z.string().nullable(),
37
- line: z.string().nullable(),
31
+ /**
32
+ * One line a space's own code wrote, from whichever execution tier serves it.
33
+ *
34
+ * This is `executionLogEntrySchema` verbatim rather than a platform-shaped
35
+ * restatement of it: both tiers already emit that shape, and re-declaring it
36
+ * here would be a second definition to keep in sync with the runtimes that
37
+ * produce the records.
38
+ *
39
+ * Unlike its access-log sibling there is no `ts` alongside `timestamp`. That
40
+ * duplication is a compatibility alias the access log carries for callers that
41
+ * predate the rename; runtime logs have never been served to anyone, so there
42
+ * is no caller to keep and no reason to inherit the wart.
43
+ */
44
+ export const runtimeLogEntrySchema = executionLogEntrySchema;
45
+ /**
46
+ * Handler logs are filtered, not windowed.
47
+ *
48
+ * The access log takes `since`/`until` because the provider indexes by time.
49
+ * Neither execution tier does: Zero pages a local append-only store by cursor,
50
+ * and the origin walks day files backwards from newest. Accepting a `since`
51
+ * here would mean ignoring it, so it is absent — the filters below are the ones
52
+ * both tiers actually honour.
53
+ */
54
+ export const runtimeLogListQuerySchema = cursorListQuerySchema.extend({
55
+ requestId: z
56
+ .string()
57
+ .min(1)
58
+ .optional()
59
+ .describe("Return only lines emitted while serving this request."),
60
+ handlerName: z
61
+ .string()
62
+ .min(1)
63
+ .optional()
64
+ .describe("Return only lines from this handler — a Zero mutation or a Functions handler."),
38
65
  });
39
66
  export const accessLogListResponseSchema = z.object({
40
67
  data: z.array(accessLogEntrySchema),
@@ -44,21 +71,41 @@ export const accessLogListResponseSchema = z.object({
44
71
  .optional()
45
72
  .describe("List-level diagnostics; log_retention_clamped names the effective `since` when the requested window exceeds the plan's log retention."),
46
73
  });
74
+ /**
75
+ * Paged handler logs.
76
+ *
77
+ * The pagination block is deliberately the same `CursorPaginationSchema` the
78
+ * access log uses — the two kinds sit side by side under one command, and a
79
+ * caller should not have to learn a second paging idiom to read the other half
80
+ * of its own space.
81
+ *
82
+ * One thing about that cursor is worth stating rather than discovering: **an
83
+ * empty page does not mean the end.** `hasMore` is true whenever the server
84
+ * stopped before reaching the oldest retained line, and the origin reader stops
85
+ * on its own per-page bounds — day count, line count, bytes scanned — which it
86
+ * can hit while a `requestId` or `handlerName` filter matched nothing in the
87
+ * stretch it read. Both tiers satisfy the same rule: **`hasMore: false` means
88
+ * you have seen everything; `hasMore: true` means keep paging, whatever `data`
89
+ * held.** A client that stops on the first empty page will silently truncate a
90
+ * filtered search.
91
+ *
92
+ * No `warnings` array, unlike the access log. Its one diagnostic is
93
+ * `log_retention_clamped`, which reports a requested window being cut back to
94
+ * the plan's retention — and there is no window to clamp here. An empty
95
+ * diagnostics channel would be a field every caller must handle and no server
96
+ * ever fills.
97
+ */
47
98
  export const runtimeLogListResponseSchema = z.object({
48
99
  data: z.array(runtimeLogEntrySchema),
49
100
  pagination: CursorPaginationSchema,
50
- warnings: z
51
- .array(baseDiagnosticSchema)
52
- .optional()
53
- .describe("List-level diagnostics; log_retention_clamped names the effective `since` when the requested window exceeds the plan's log retention."),
54
101
  });
55
102
  export const analyticsQuerySchema = z.object({
56
103
  window: z
57
104
  .enum(["48h", "7d", "30d", "custom"])
58
105
  .optional()
59
- .describe('Analytics summary window; defaults to "7d". "custom" requires since/until.'),
60
- since: z.string().datetime().optional().describe("Custom analytics start."),
61
- until: z.string().datetime().optional().describe("Custom analytics end."),
106
+ .describe('Analytics summary window. Defaults to "7d". "custom" requires since/until.'),
107
+ since: z.string().datetime().optional().describe("Start of the custom analytics window."),
108
+ until: z.string().datetime().optional().describe("End of the custom analytics window."),
62
109
  });
63
110
  // Served by `GET /v1/spaces/{spaceId}/analytics`: traffic summary over the
64
111
  // requested window, read from Spacefast's own per-space rollups (ingested on
@@ -66,7 +113,7 @@ export const analyticsQuerySchema = z.object({
66
113
  // Counts cover main hostnames only: default, custom-domain, and channel.
67
114
  // Immutable version-URL traffic is ingested but never surfaced here.
68
115
  export const analyticsResponseSchema = z.object({
69
- spaceId: z.string().describe("Space the traffic was aggregated for."),
116
+ spaceId: z.string().describe("The space id the traffic was aggregated for."),
70
117
  window: z.enum(["48h", "7d", "30d", "custom"]).describe("Resolved summary window."),
71
118
  since: z.string().describe("Resolved window start (ISO 8601), after retention clamping."),
72
119
  until: z.string().describe("Resolved window end (ISO 8601)."),
@@ -74,15 +121,17 @@ export const analyticsResponseSchema = z.object({
74
121
  dataAsOf: z
75
122
  .string()
76
123
  .nullable()
77
- .describe("End of the last fully-ingested hour; null while the first ingest is running."),
78
- refreshing: z.boolean().describe("Whether an ingest run is active or was just triggered."),
124
+ .describe("End of the last fully-ingested hour; null until the first ingest starts."),
125
+ refreshing: z
126
+ .boolean()
127
+ .describe("Whether an ingest run is active or the server just triggered one."),
79
128
  views: z
80
129
  .number()
81
130
  .describe("Successful non-crawler requests (status < 400, assets included) summed across main hostnames over the window."),
82
131
  visitors: z
83
132
  .number()
84
133
  .nullable()
85
- .describe("Unique-visitor estimate. Currently always null: per-hostname unique-visitor data is not yet available from the hosting provider."),
134
+ .describe("Unique-visitor estimate. Always null because per-hostname unique-visitor data is not yet available from the hosting provider."),
86
135
  bandwidthBytes: z.number().describe("Total response bytes in the window."),
87
136
  visitorsByHost: z
88
137
  .array(z.object({
@@ -93,7 +142,7 @@ export const analyticsResponseSchema = z.object({
93
142
  views: z.number(),
94
143
  })),
95
144
  }))
96
- .describe("Per-hostname daily visitor estimates. Currently always empty: per-hostname unique-visitor data is not yet available from the hosting provider."),
145
+ .describe("Per-hostname daily visitor estimates. Always empty because per-hostname unique-visitor data is not yet available from the hosting provider."),
97
146
  topPaths: z
98
147
  .array(z.object({ path: z.string(), views: z.number() }))
99
148
  .describe("Most-viewed paths, capped at 10."),
@@ -0,0 +1,14 @@
1
+ export interface ProblemDocument {
2
+ code: string | undefined;
3
+ detail: string | undefined;
4
+ type: string | undefined;
5
+ title: string | undefined;
6
+ pointer: string | undefined;
7
+ /** Raw, unnarrowed: each caller decides what shape it accepts. */
8
+ details: unknown;
9
+ suggestions: string[];
10
+ next: string[];
11
+ requestId: string | undefined;
12
+ }
13
+ /** Returns undefined when the payload cannot be a problem document at all. */
14
+ export declare function parseProblemDocument(payload: unknown): ProblemDocument | undefined;
@@ -0,0 +1,35 @@
1
+ // Reader for the RFC 9457 problem document every 4xx/5xx response carries, so the
2
+ // client surfaces (CLI, MCP, SDK) share one definition of which members exist and
3
+ // which values are trusted. Callers keep their own entry guards, message fallbacks
4
+ // and public field names — this only extracts the wire members.
5
+ /** Returns undefined when the payload cannot be a problem document at all. */
6
+ export function parseProblemDocument(payload) {
7
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
8
+ return undefined;
9
+ }
10
+ const problem = payload;
11
+ if (!("code" in problem) && !("detail" in problem)) {
12
+ return undefined;
13
+ }
14
+ const stringField = (name) => {
15
+ const value = problem[name];
16
+ return typeof value === "string" ? value : undefined;
17
+ };
18
+ const stringArray = (name) => {
19
+ const value = problem[name];
20
+ return Array.isArray(value)
21
+ ? value.filter((entry) => typeof entry === "string")
22
+ : [];
23
+ };
24
+ return {
25
+ code: stringField("code"),
26
+ detail: stringField("detail"),
27
+ type: stringField("type"),
28
+ title: stringField("title"),
29
+ pointer: stringField("pointer"),
30
+ details: problem.details,
31
+ suggestions: stringArray("suggestions"),
32
+ next: stringArray("next"),
33
+ requestId: stringField("requestId"),
34
+ };
35
+ }
@@ -50,6 +50,19 @@ export declare const PushNewSessionSchema: z.ZodObject<{
50
50
  reusedVersionId: z.ZodNullable<z.ZodString>;
51
51
  webhookDeliveryId: z.ZodNullable<z.ZodString>;
52
52
  liveUrl: z.ZodString;
53
+ open: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
54
+ url: z.ZodString;
55
+ expiresAt: z.ZodNullable<z.ZodString>;
56
+ kind: z.ZodLiteral<"link">;
57
+ }, z.core.$strip>, z.ZodObject<{
58
+ url: z.ZodString;
59
+ expiresAt: z.ZodString;
60
+ kind: z.ZodEnum<{
61
+ management: "management";
62
+ person: "person";
63
+ claim_preview: "claim_preview";
64
+ }>;
65
+ }, z.core.$strip>]>>;
53
66
  sessionUrl: z.ZodString;
54
67
  logsUrl: z.ZodNullable<z.ZodString>;
55
68
  claimUrl: z.ZodString;
@@ -95,6 +108,19 @@ export declare const PushNewCreateSessionResponseSchema: z.ZodObject<{
95
108
  reusedVersionId: z.ZodNullable<z.ZodString>;
96
109
  webhookDeliveryId: z.ZodNullable<z.ZodString>;
97
110
  liveUrl: z.ZodString;
111
+ open: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
112
+ url: z.ZodString;
113
+ expiresAt: z.ZodNullable<z.ZodString>;
114
+ kind: z.ZodLiteral<"link">;
115
+ }, z.core.$strip>, z.ZodObject<{
116
+ url: z.ZodString;
117
+ expiresAt: z.ZodString;
118
+ kind: z.ZodEnum<{
119
+ management: "management";
120
+ person: "person";
121
+ claim_preview: "claim_preview";
122
+ }>;
123
+ }, z.core.$strip>]>>;
98
124
  sessionUrl: z.ZodString;
99
125
  logsUrl: z.ZodNullable<z.ZodString>;
100
126
  claimUrl: z.ZodString;
@@ -108,6 +134,19 @@ export declare const PushNewCreateSessionResponseSchema: z.ZodObject<{
108
134
  }, z.core.$strip>;
109
135
  export declare const PushNewStatusResponseSchema: z.ZodObject<{
110
136
  id: z.ZodString;
137
+ open: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
138
+ url: z.ZodString;
139
+ expiresAt: z.ZodNullable<z.ZodString>;
140
+ kind: z.ZodLiteral<"link">;
141
+ }, z.core.$strip>, z.ZodObject<{
142
+ url: z.ZodString;
143
+ expiresAt: z.ZodString;
144
+ kind: z.ZodEnum<{
145
+ management: "management";
146
+ person: "person";
147
+ claim_preview: "claim_preview";
148
+ }>;
149
+ }, z.core.$strip>]>>;
111
150
  status: z.ZodEnum<{
112
151
  live: "live";
113
152
  failed: "failed";
@@ -121,10 +160,10 @@ export declare const PushNewStatusResponseSchema: z.ZodObject<{
121
160
  createdAt: z.ZodString;
122
161
  spaceId: z.ZodString;
123
162
  updatedAt: z.ZodString;
124
- ref: z.ZodNullable<z.ZodString>;
163
+ branch: z.ZodString;
125
164
  versionId: z.ZodNullable<z.ZodString>;
165
+ ref: z.ZodNullable<z.ZodString>;
126
166
  spaceSlug: z.ZodString;
127
- branch: z.ZodString;
128
167
  commitSha: z.ZodNullable<z.ZodString>;
129
168
  repositoryFullName: z.ZodNullable<z.ZodString>;
130
169
  slug: z.ZodString;
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { privateOpenSchema } from "./access.js";
2
3
  export const pushNewSessionStatusSchema = z.enum([
3
4
  "waiting_for_push",
4
5
  "waiting_for_upload",
@@ -31,6 +32,9 @@ export const PushNewSessionSchema = z.object({
31
32
  reusedVersionId: z.string().nullable(),
32
33
  webhookDeliveryId: z.string().nullable(),
33
34
  liveUrl: z.string().url(),
35
+ open: privateOpenSchema
36
+ .nullable()
37
+ .describe("Reusable Open link for the private space at live `/`. A null expiry means it remains valid until revoked."),
34
38
  sessionUrl: z.string().url(),
35
39
  logsUrl: z.string().url().nullable(),
36
40
  claimUrl: z.string().url(),
@@ -14,5 +14,4 @@ export declare const ANONYMOUS_PUBLISH_CAPS: {
14
14
  readonly maxInlineBodyBytes: number;
15
15
  readonly maxFilesPerVersion: 1000;
16
16
  readonly maxPublishesPerIpPerHour: 20;
17
- readonly maxLifetimeViews: 100;
18
17
  };
@@ -36,9 +36,4 @@ export const ANONYMOUS_PUBLISH_CAPS = {
36
36
  maxFilesPerVersion: 1000,
37
37
  // Anonymous publish/space-create attempts per IP per hour.
38
38
  maxPublishesPerIpPerHour: WORST_CASE_QUOTAS.maxPublishesPerIpPerHour,
39
- // Views (non-crawler, status<400 requests) an unclaimed space may serve over
40
- // its whole claim window before it goes dark behind the claim-nudge
41
- // tombstone. Enforced by the periodic visit-quota sweep, so it is
42
- // deliberately approximate — claiming the space lifts it entirely.
43
- maxLifetimeViews: 100,
44
39
  };
@@ -124,8 +124,8 @@ export declare const repositoryImportRemoteSchema: z.ZodObject<{
124
124
  bitbucket: "bitbucket";
125
125
  generic: "generic";
126
126
  }>>;
127
- repositoryFullName: z.ZodString;
128
127
  credential: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
+ repositoryFullName: z.ZodString;
129
129
  repositoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
130
  repositoryName: z.ZodOptional<z.ZodString>;
131
131
  defaultBranch: z.ZodDefault<z.ZodString>;