@spacefast/common 0.2.2 → 0.4.1

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 (226) hide show
  1. package/dist/agents/marketplace-prompts.d.ts +1 -0
  2. package/dist/agents/marketplace-prompts.js +6 -0
  3. package/dist/agents/registry/core.d.ts +4 -12
  4. package/dist/agents/registry/core.js +7 -28
  5. package/dist/config/domains.d.ts +10 -8
  6. package/dist/config/domains.js +4 -7
  7. package/dist/contracts/access-core.d.ts +135 -0
  8. package/dist/contracts/access-core.js +242 -0
  9. package/dist/contracts/access-profiles.d.ts +8 -8
  10. package/dist/contracts/access-profiles.js +8 -8
  11. package/dist/contracts/access.d.ts +14 -103
  12. package/dist/contracts/access.js +10 -210
  13. package/dist/contracts/activity.d.ts +54 -55
  14. package/dist/contracts/activity.js +38 -9
  15. package/dist/contracts/api-keys.d.ts +69 -26
  16. package/dist/contracts/api-keys.js +29 -2
  17. package/dist/contracts/application-journal.d.ts +197 -4
  18. package/dist/contracts/application-journal.js +97 -16
  19. package/dist/contracts/auth.d.ts +20 -0
  20. package/dist/contracts/auth.js +18 -0
  21. package/dist/contracts/beta.d.ts +13 -0
  22. package/dist/contracts/beta.js +28 -0
  23. package/dist/contracts/billing.d.ts +2 -2
  24. package/dist/contracts/bootstrap.d.ts +23 -6
  25. package/dist/contracts/builds.d.ts +18 -4
  26. package/dist/contracts/builds.js +7 -4
  27. package/dist/contracts/channels.d.ts +43 -0
  28. package/dist/contracts/channels.js +22 -6
  29. package/dist/contracts/comments.d.ts +49 -0
  30. package/dist/contracts/comments.js +61 -2
  31. package/dist/contracts/commerce.d.ts +19 -13
  32. package/dist/contracts/connector-access.d.ts +28 -0
  33. package/dist/contracts/connector-access.js +31 -0
  34. package/dist/contracts/connectors.d.ts +2382 -0
  35. package/dist/contracts/connectors.js +941 -0
  36. package/dist/contracts/content-contract-verification.d.ts +112 -58
  37. package/dist/contracts/content-contract-verification.js +42 -54
  38. package/dist/contracts/content-model-emit.d.ts +97 -0
  39. package/dist/contracts/content-model-emit.js +306 -0
  40. package/dist/contracts/content-model-sdk.d.ts +101 -0
  41. package/dist/contracts/content-model-sdk.js +232 -0
  42. package/dist/contracts/{content-program.d.ts → content-model.d.ts} +338 -82
  43. package/dist/contracts/{content-program.js → content-model.js} +291 -63
  44. package/dist/contracts/content-platform-fixture.d.ts +380 -110
  45. package/dist/contracts/content-platform-fixture.js +8 -8
  46. package/dist/contracts/content-sync.d.ts +197 -74
  47. package/dist/contracts/content-sync.js +98 -37
  48. package/dist/contracts/content.d.ts +30 -422
  49. package/dist/contracts/content.js +34 -294
  50. package/dist/contracts/dashboard-prefs.d.ts +10 -3
  51. package/dist/contracts/dashboard-prefs.js +6 -3
  52. package/dist/contracts/data-location.d.ts +9 -0
  53. package/dist/contracts/data-location.js +7 -0
  54. package/dist/contracts/deployment-comparison.d.ts +67 -0
  55. package/dist/contracts/deployment-comparison.js +68 -0
  56. package/dist/contracts/device-auth.d.ts +55 -11
  57. package/dist/contracts/domains.d.ts +40 -16
  58. package/dist/contracts/domains.js +23 -0
  59. package/dist/contracts/enums.d.ts +1 -10
  60. package/dist/contracts/enums.js +0 -15
  61. package/dist/contracts/error-code-meta.d.ts +384 -20
  62. package/dist/contracts/error-code-meta.js +200 -5
  63. package/dist/contracts/error-codes.d.ts +17 -4
  64. package/dist/contracts/error-codes.js +108 -10
  65. package/dist/contracts/events.d.ts +5 -0
  66. package/dist/contracts/events.js +12 -3
  67. package/dist/contracts/execution.d.ts +5 -1
  68. package/dist/contracts/execution.js +4 -0
  69. package/dist/contracts/feature-lifecycle.d.ts +53 -20
  70. package/dist/contracts/feature-lifecycle.js +65 -23
  71. package/dist/contracts/features.d.ts +57 -31
  72. package/dist/contracts/features.js +0 -1
  73. package/dist/contracts/feedback.d.ts +124 -0
  74. package/dist/contracts/feedback.js +64 -0
  75. package/dist/contracts/fixtures/content-model-sdk-v1.generated.d.ts +129 -0
  76. package/dist/contracts/fixtures/content-model-sdk-v1.generated.js +48 -0
  77. package/dist/contracts/fixtures/content-platform-v1.json +101 -49
  78. package/dist/contracts/frame-session.d.ts +60 -10
  79. package/dist/contracts/frame-session.js +52 -12
  80. package/dist/contracts/functions.d.ts +28 -2
  81. package/dist/contracts/functions.js +25 -2
  82. package/dist/contracts/grant-copy.d.ts +2 -0
  83. package/dist/contracts/grant-copy.js +2 -0
  84. package/dist/contracts/grants-core.d.ts +95 -0
  85. package/dist/contracts/grants-core.js +435 -0
  86. package/dist/contracts/grants.d.ts +13 -84
  87. package/dist/contracts/grants.js +21 -369
  88. package/dist/contracts/ids-core.d.ts +11 -0
  89. package/dist/contracts/ids-core.js +14 -0
  90. package/dist/contracts/ids.d.ts +7 -4
  91. package/dist/contracts/ids.js +12 -4
  92. package/dist/contracts/internal.d.ts +18 -0
  93. package/dist/contracts/internal.js +19 -0
  94. package/dist/contracts/mcp.d.ts +8 -18
  95. package/dist/contracts/mcp.js +2 -23
  96. package/dist/contracts/notifications.d.ts +4 -1
  97. package/dist/contracts/notifications.js +1 -0
  98. package/dist/contracts/oauth-resources.d.ts +46 -9
  99. package/dist/contracts/oauth-resources.js +50 -1
  100. package/dist/contracts/oauth-scope-actions.d.ts +27 -3
  101. package/dist/contracts/oauth-scope-actions.js +18 -8
  102. package/dist/contracts/operations.d.ts +1 -1
  103. package/dist/contracts/partner-account.d.ts +629 -0
  104. package/dist/contracts/partner-account.js +18 -0
  105. package/dist/contracts/principal-assertion.d.ts +74 -1
  106. package/dist/contracts/principal-assertion.js +67 -3
  107. package/dist/contracts/publish-archive.d.ts +22 -1
  108. package/dist/contracts/push-new.d.ts +3 -3
  109. package/dist/contracts/push-new.js +1 -1
  110. package/dist/contracts/quotas.js +2 -1
  111. package/dist/contracts/repository-connections.d.ts +10 -6
  112. package/dist/contracts/repository-connections.js +15 -0
  113. package/dist/contracts/resources.d.ts +6 -5
  114. package/dist/contracts/resources.js +7 -0
  115. package/dist/contracts/route-inventory.d.ts +74 -19
  116. package/dist/contracts/route-inventory.js +20 -6
  117. package/dist/contracts/runtime-api.d.ts +415 -4
  118. package/dist/contracts/runtime-api.js +60 -15
  119. package/dist/contracts/runtime-app.d.ts +6 -1
  120. package/dist/contracts/runtime-components.d.ts +646 -18
  121. package/dist/contracts/runtime-components.js +304 -188
  122. package/dist/contracts/runtime-services.d.ts +15 -0
  123. package/dist/contracts/runtime-services.js +25 -0
  124. package/dist/contracts/runtime-storage.d.ts +32 -0
  125. package/dist/contracts/runtime-storage.js +37 -0
  126. package/dist/contracts/source-workspaces.d.ts +511 -0
  127. package/dist/contracts/source-workspaces.js +276 -0
  128. package/dist/contracts/space-config-spacefast.d.ts +394 -0
  129. package/dist/contracts/space-config-spacefast.js +70 -0
  130. package/dist/contracts/space-config.d.ts +177 -90
  131. package/dist/contracts/space-config.js +77 -92
  132. package/dist/contracts/spaces.d.ts +132 -24
  133. package/dist/contracts/spaces.js +77 -13
  134. package/dist/contracts/superadmin-connectors.d.ts +371 -0
  135. package/dist/contracts/superadmin-connectors.js +61 -0
  136. package/dist/contracts/superadmin-emails.d.ts +1 -1
  137. package/dist/contracts/superadmin-emails.js +1 -1
  138. package/dist/contracts/superadmin-entities.d.ts +105 -0
  139. package/dist/contracts/superadmin-entities.js +64 -0
  140. package/dist/contracts/superadmin-runtime.d.ts +35 -116
  141. package/dist/contracts/superadmin-runtime.js +13 -69
  142. package/dist/contracts/superadmin-search.d.ts +12 -14
  143. package/dist/contracts/superadmin-search.js +2 -2
  144. package/dist/contracts/superadmin-spaces.d.ts +15 -72
  145. package/dist/contracts/superadmin-spaces.js +2 -7
  146. package/dist/contracts/superadmin-teams.d.ts +12 -0
  147. package/dist/contracts/superadmin-teams.js +7 -1
  148. package/dist/contracts/superadmin-tenants.d.ts +44 -16
  149. package/dist/contracts/superadmin.d.ts +2 -2
  150. package/dist/contracts/tags.d.ts +12 -12
  151. package/dist/contracts/teams.d.ts +29 -1
  152. package/dist/contracts/teams.js +24 -2
  153. package/dist/contracts/tenants.d.ts +98 -0
  154. package/dist/contracts/tenants.js +20 -0
  155. package/dist/contracts/transfers.d.ts +92 -0
  156. package/dist/contracts/transfers.js +37 -0
  157. package/dist/contracts/usage.d.ts +9 -1
  158. package/dist/contracts/usage.js +2 -0
  159. package/dist/contracts/visual-review.d.ts +448 -0
  160. package/dist/contracts/visual-review.js +156 -0
  161. package/dist/contracts/wordpress-php-toolkit.json +9 -0
  162. package/dist/contracts/work-mode.d.ts +24 -0
  163. package/dist/contracts/work-mode.js +17 -0
  164. package/dist/contracts/wp-cli.d.ts +66 -0
  165. package/dist/contracts/wp-cli.js +68 -0
  166. package/dist/contracts/zero-catalog.d.ts +29 -0
  167. package/dist/contracts/zero-catalog.js +55 -0
  168. package/dist/contracts/zero-platform-abilities.generated.d.ts +31 -0
  169. package/dist/contracts/zero-platform-abilities.generated.js +373 -0
  170. package/dist/contracts/zero-spacefast.d.ts +444 -0
  171. package/dist/contracts/zero-spacefast.js +149 -0
  172. package/dist/contracts/zero-types.d.ts +47 -0
  173. package/dist/contracts/zero-types.js +263 -0
  174. package/dist/contracts/zero.d.ts +781 -14
  175. package/dist/contracts/zero.js +204 -10
  176. package/dist/dashboard-paths/index.d.ts +2 -2
  177. package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -2
  178. package/dist/dashboard-paths/route-reservations.generated.js +5 -0
  179. package/dist/docs/agent-prose.d.ts +1 -1
  180. package/dist/docs/agent-prose.js +15 -18
  181. package/dist/docs/agent-setup.d.ts +1 -1
  182. package/dist/docs/agent-setup.js +5 -13
  183. package/dist/docs/catalog.d.ts +64 -28
  184. package/dist/docs/catalog.js +155 -28
  185. package/dist/docs/error-docs.d.ts +361 -17
  186. package/dist/docs/error-docs.js +365 -21
  187. package/dist/docs/reference-urls.js +1 -1
  188. package/dist/docs/skills.d.ts +84 -84
  189. package/dist/docs/skills.js +66 -47
  190. package/dist/docs/start-prompts.d.ts +14 -0
  191. package/dist/docs/start-prompts.js +20 -0
  192. package/dist/utils/account-labels.d.ts +7 -0
  193. package/dist/utils/account-labels.js +15 -0
  194. package/dist/utils/auth.d.ts +1 -0
  195. package/dist/utils/auth.js +1 -0
  196. package/dist/utils/credential-policy.d.ts +22 -1
  197. package/dist/utils/credential-policy.js +55 -6
  198. package/dist/utils/local-space-state.d.ts +7 -0
  199. package/dist/utils/local-space-state.js +7 -0
  200. package/dist/utils/logger.d.ts +34 -0
  201. package/dist/utils/logger.js +144 -0
  202. package/dist/utils/page-routes.d.ts +9 -0
  203. package/dist/utils/page-routes.js +82 -0
  204. package/dist/utils/pages.d.ts +2 -0
  205. package/dist/utils/pages.js +7 -0
  206. package/dist/utils/publish-form-data.d.ts +2 -0
  207. package/dist/utils/publish-form-data.js +2 -0
  208. package/dist/utils/publish-policy-spacefast.d.ts +13 -0
  209. package/dist/utils/publish-policy-spacefast.js +117 -0
  210. package/dist/utils/publish-policy.d.ts +22 -16
  211. package/dist/utils/publish-policy.fixtures.json +15 -0
  212. package/dist/utils/publish-policy.js +62 -139
  213. package/dist/utils/query-client.js +9 -1
  214. package/dist/utils/runtime-upload.d.ts +4 -0
  215. package/dist/utils/runtime-upload.js +5 -0
  216. package/dist/utils/space-config.d.ts +2 -3
  217. package/dist/utils/space-config.js +1 -1
  218. package/dist/utils/uploaded-source.d.ts +4 -0
  219. package/dist/utils/uploaded-source.js +12 -0
  220. package/dist/visual-review.d.ts +4 -0
  221. package/dist/visual-review.js +208 -0
  222. package/dist/vocabulary.d.ts +38 -0
  223. package/dist/vocabulary.js +55 -0
  224. package/package.json +7 -2
  225. package/dist/agents/registry/deeplink-probes.d.ts +0 -23
  226. package/dist/agents/registry/deeplink-probes.js +0 -18
@@ -1,14 +1,52 @@
1
1
  import { z } from "zod";
2
+ import type { GrantCapability } from "./grants-core.js";
2
3
  export declare const exactOriginSchema: z.core.$ZodBranded<z.ZodString, "ExactOrigin", "out">;
3
4
  export type ExactOrigin = z.infer<typeof exactOriginSchema>;
5
+ /**
6
+ * Ordered weakest-first: the runtime projects exactly one of these onto the
7
+ * request's principal and nothing is ever stored on the WordPress user.
8
+ */
9
+ export declare const WORDPRESS_PRINCIPAL_ROLES: readonly ["subscriber", "editor", "administrator"];
10
+ export declare const wordpressPrincipalRoleSchema: z.ZodEnum<{
11
+ editor: "editor";
12
+ subscriber: "subscriber";
13
+ administrator: "administrator";
14
+ }>;
15
+ export type WordPressPrincipalRole = z.infer<typeof wordpressPrincipalRoleSchema>;
16
+ /**
17
+ * THE grant→WordPress-role mapping site. WordPress roles are not authority
18
+ * here: the management JWT and the Grant decision already admitted the request
19
+ * before this runs, and this only decides which WordPress capabilities the
20
+ * runtime projects for the one request it is answering.
21
+ *
22
+ * Deliberately conservative, and deliberately coarse — WordPress has no role
23
+ * that means "may comment", so:
24
+ *
25
+ * - `access.manage` — the caller may change who reaches this Space, so they
26
+ * are the Space's administrator. Safe only because the managed editor is
27
+ * locked: no login screen, no file editing or plugin installs, and an
28
+ * allowlist of admin screens (content-kernel.php). Widening that lock means
29
+ * revisiting this line, because `administrator` carries `manage_options`.
30
+ * - `content.publish` — may write documents, so `editor`.
31
+ * - `page.view` / `comments.read` — may read managed content, including
32
+ * unpublished drafts through the content API, so `subscriber`.
33
+ * - `comments.write` alone (and no capabilities at all) — comments are stored
34
+ * by the platform, not by WordPress. `null`: no WordPress user is created,
35
+ * and the request answers as nobody.
36
+ */
37
+ export declare function wordpressRoleForGrantCapabilities(capabilities: Iterable<GrantCapability>): WordPressPrincipalRole | null;
4
38
  export declare const principalAssertionV1Schema: z.ZodUnion<readonly [z.ZodObject<{
5
39
  actor: z.ZodObject<{
6
40
  kind: z.ZodLiteral<"user">;
7
41
  id: z.ZodString;
8
42
  }, z.core.$strict>;
9
- subject: z.ZodOptional<z.ZodObject<{
43
+ subject: z.ZodObject<{
10
44
  issuer: z.ZodString;
11
45
  subject: z.ZodString;
46
+ }, z.core.$strict>;
47
+ profile: z.ZodOptional<z.ZodObject<{
48
+ displayName: z.ZodOptional<z.ZodString>;
49
+ avatarUrl: z.ZodOptional<z.ZodString>;
12
50
  }, z.core.$strict>>;
13
51
  format: z.ZodLiteral<"spacefast.principal">;
14
52
  version: z.ZodLiteral<1>;
@@ -22,11 +60,41 @@ export declare const principalAssertionV1Schema: z.ZodUnion<readonly [z.ZodObjec
22
60
  nonce: z.ZodString;
23
61
  issuedAt: z.ZodNumber;
24
62
  expiresAt: z.ZodNumber;
63
+ wordpressRole: z.ZodNullable<z.ZodEnum<{
64
+ editor: "editor";
65
+ subscriber: "subscriber";
66
+ administrator: "administrator";
67
+ }>>;
25
68
  }, z.core.$strict>, z.ZodObject<{
26
69
  actor: z.ZodObject<{
27
70
  kind: z.ZodLiteral<"service">;
28
71
  id: z.ZodString;
29
72
  }, z.core.$strict>;
73
+ profile: z.ZodOptional<z.ZodObject<{
74
+ displayName: z.ZodOptional<z.ZodString>;
75
+ avatarUrl: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strict>>;
77
+ format: z.ZodLiteral<"spacefast.principal">;
78
+ version: z.ZodLiteral<1>;
79
+ audience: z.ZodObject<{
80
+ spaceId: z.ZodTemplateLiteral<`spc_${string}`>;
81
+ runtimeInstanceId: z.ZodString;
82
+ host: z.core.$ZodBranded<z.ZodString, "ExactOrigin", "out">;
83
+ }, z.core.$strict>;
84
+ sessionVersion: z.ZodNumber;
85
+ accessGeneration: z.ZodNumber;
86
+ nonce: z.ZodString;
87
+ issuedAt: z.ZodNumber;
88
+ expiresAt: z.ZodNumber;
89
+ wordpressRole: z.ZodNullable<z.ZodEnum<{
90
+ editor: "editor";
91
+ subscriber: "subscriber";
92
+ administrator: "administrator";
93
+ }>>;
94
+ }, z.core.$strict>, z.ZodObject<{
95
+ actor: z.ZodObject<{
96
+ kind: z.ZodLiteral<"anonymous">;
97
+ }, z.core.$strict>;
30
98
  format: z.ZodLiteral<"spacefast.principal">;
31
99
  version: z.ZodLiteral<1>;
32
100
  audience: z.ZodObject<{
@@ -39,5 +107,10 @@ export declare const principalAssertionV1Schema: z.ZodUnion<readonly [z.ZodObjec
39
107
  nonce: z.ZodString;
40
108
  issuedAt: z.ZodNumber;
41
109
  expiresAt: z.ZodNumber;
110
+ wordpressRole: z.ZodNullable<z.ZodEnum<{
111
+ editor: "editor";
112
+ subscriber: "subscriber";
113
+ administrator: "administrator";
114
+ }>>;
42
115
  }, z.core.$strict>]>;
43
116
  export type PrincipalAssertionV1 = z.infer<typeof principalAssertionV1Schema>;
@@ -1,5 +1,7 @@
1
1
  import { z } from "zod";
2
- import { registeredIdSchema } from "./ids.js";
2
+ // The `spc_` shape is this assertion's wire format, validated through the
3
+ // prefixed-id grammar rather than the host's prefix registry.
4
+ import { prefixedIdSchema } from "./ids-core.js";
3
5
  function isExactHttpOrigin(value) {
4
6
  let url;
5
7
  try {
@@ -24,7 +26,7 @@ export const exactOriginSchema = z
24
26
  .brand();
25
27
  const principalAudienceSchema = z
26
28
  .object({
27
- spaceId: registeredIdSchema("spc"),
29
+ spaceId: prefixedIdSchema("spc", "Space"),
28
30
  runtimeInstanceId: z.string().min(1).max(255),
29
31
  host: exactOriginSchema,
30
32
  })
@@ -35,6 +37,49 @@ const principalSubjectSchema = z
35
37
  subject: z.string().min(1).max(512),
36
38
  })
37
39
  .strict();
40
+ const principalProfileSchema = z
41
+ .object({
42
+ displayName: z.string().trim().min(1).max(255).optional(),
43
+ avatarUrl: z.string().url().max(2_000).optional(),
44
+ })
45
+ .strict();
46
+ /**
47
+ * Ordered weakest-first: the runtime projects exactly one of these onto the
48
+ * request's principal and nothing is ever stored on the WordPress user.
49
+ */
50
+ export const WORDPRESS_PRINCIPAL_ROLES = ["subscriber", "editor", "administrator"];
51
+ export const wordpressPrincipalRoleSchema = z.enum(WORDPRESS_PRINCIPAL_ROLES);
52
+ /**
53
+ * THE grant→WordPress-role mapping site. WordPress roles are not authority
54
+ * here: the management JWT and the Grant decision already admitted the request
55
+ * before this runs, and this only decides which WordPress capabilities the
56
+ * runtime projects for the one request it is answering.
57
+ *
58
+ * Deliberately conservative, and deliberately coarse — WordPress has no role
59
+ * that means "may comment", so:
60
+ *
61
+ * - `access.manage` — the caller may change who reaches this Space, so they
62
+ * are the Space's administrator. Safe only because the managed editor is
63
+ * locked: no login screen, no file editing or plugin installs, and an
64
+ * allowlist of admin screens (content-kernel.php). Widening that lock means
65
+ * revisiting this line, because `administrator` carries `manage_options`.
66
+ * - `content.publish` — may write documents, so `editor`.
67
+ * - `page.view` / `comments.read` — may read managed content, including
68
+ * unpublished drafts through the content API, so `subscriber`.
69
+ * - `comments.write` alone (and no capabilities at all) — comments are stored
70
+ * by the platform, not by WordPress. `null`: no WordPress user is created,
71
+ * and the request answers as nobody.
72
+ */
73
+ export function wordpressRoleForGrantCapabilities(capabilities) {
74
+ const held = new Set(capabilities);
75
+ if (held.has("access.manage"))
76
+ return "administrator";
77
+ if (held.has("content.publish"))
78
+ return "editor";
79
+ if (held.has("page.view") || held.has("comments.read"))
80
+ return "subscriber";
81
+ return null;
82
+ }
38
83
  const principalAssertionFields = {
39
84
  format: z.literal("spacefast.principal"),
40
85
  version: z.literal(1),
@@ -44,6 +89,9 @@ const principalAssertionFields = {
44
89
  nonce: z.string().min(16).max(512),
45
90
  issuedAt: z.number().int().nonnegative(),
46
91
  expiresAt: z.number().int().positive(),
92
+ // Re-derived per request from the caller's Grant capabilities and never read
93
+ // back from WordPress. `null` is "this caller needs no WordPress user".
94
+ wordpressRole: wordpressPrincipalRoleSchema.nullable(),
47
95
  };
48
96
  export const principalAssertionV1Schema = z
49
97
  .union([
@@ -51,17 +99,33 @@ export const principalAssertionV1Schema = z
51
99
  .object({
52
100
  ...principalAssertionFields,
53
101
  actor: z.object({ kind: z.literal("user"), id: z.string().min(1).max(255) }).strict(),
54
- subject: principalSubjectSchema.optional(),
102
+ subject: principalSubjectSchema,
103
+ profile: principalProfileSchema.optional(),
55
104
  })
56
105
  .strict(),
57
106
  z
58
107
  .object({
59
108
  ...principalAssertionFields,
60
109
  actor: z.object({ kind: z.literal("service"), id: z.string().min(1).max(255) }).strict(),
110
+ profile: principalProfileSchema.optional(),
111
+ })
112
+ .strict(),
113
+ z
114
+ .object({
115
+ ...principalAssertionFields,
116
+ actor: z.object({ kind: z.literal("anonymous") }).strict(),
61
117
  })
62
118
  .strict(),
63
119
  ])
64
120
  .refine((assertion) => assertion.expiresAt > assertion.issuedAt, {
65
121
  path: ["expiresAt"],
66
122
  message: "expiresAt must be after issuedAt",
123
+ })
124
+ .refine((assertion) => assertion.expiresAt - assertion.issuedAt <= 300, {
125
+ path: ["expiresAt"],
126
+ message: "principal assertions may live for at most five minutes",
127
+ })
128
+ .refine((assertion) => assertion.actor.kind !== "anonymous" || assertion.wordpressRole === null, {
129
+ path: ["wordpressRole"],
130
+ message: "an anonymous actor has no WordPress role",
67
131
  });
@@ -133,6 +133,9 @@ export declare const archivePublishReceiptSchema: z.ZodObject<{
133
133
  superseded: "superseded";
134
134
  }>;
135
135
  currentLiveVersionId: z.ZodNullable<z.ZodString>;
136
+ reason: z.ZodOptional<z.ZodEnum<{
137
+ channel_promotion_manual: "channel_promotion_manual";
138
+ }>>;
136
139
  }, z.core.$strip>>;
137
140
  next: z.ZodObject<{
138
141
  action: z.ZodEnum<{
@@ -153,6 +156,7 @@ export declare const archivePublishReceiptSchema: z.ZodObject<{
153
156
  remoteUrl: z.ZodNullable<z.ZodString>;
154
157
  repository: z.ZodNullable<z.ZodString>;
155
158
  defaultBranch: z.ZodNullable<z.ZodString>;
159
+ provisioned: z.ZodBoolean;
156
160
  }, z.core.$strip>>;
157
161
  access: z.ZodOptional<z.ZodObject<{
158
162
  url: z.ZodString;
@@ -331,6 +335,9 @@ export declare const publishResponseReceiptSchema: z.ZodUnion<readonly [z.ZodObj
331
335
  superseded: "superseded";
332
336
  }>;
333
337
  currentLiveVersionId: z.ZodNullable<z.ZodString>;
338
+ reason: z.ZodOptional<z.ZodEnum<{
339
+ channel_promotion_manual: "channel_promotion_manual";
340
+ }>>;
334
341
  }, z.core.$strip>>;
335
342
  next: z.ZodObject<{
336
343
  action: z.ZodEnum<{
@@ -351,6 +358,7 @@ export declare const publishResponseReceiptSchema: z.ZodUnion<readonly [z.ZodObj
351
358
  remoteUrl: z.ZodNullable<z.ZodString>;
352
359
  repository: z.ZodNullable<z.ZodString>;
353
360
  defaultBranch: z.ZodNullable<z.ZodString>;
361
+ provisioned: z.ZodBoolean;
354
362
  }, z.core.$strip>>;
355
363
  access: z.ZodOptional<z.ZodObject<{
356
364
  url: z.ZodString;
@@ -432,6 +440,9 @@ export declare const publishResponseReceiptSchema: z.ZodUnion<readonly [z.ZodObj
432
440
  superseded: "superseded";
433
441
  }>;
434
442
  currentLiveVersionId: z.ZodNullable<z.ZodString>;
443
+ reason: z.ZodOptional<z.ZodEnum<{
444
+ channel_promotion_manual: "channel_promotion_manual";
445
+ }>>;
435
446
  }, z.core.$strip>;
436
447
  next: z.ZodObject<{
437
448
  action: z.ZodEnum<{
@@ -452,14 +463,15 @@ export declare const publishResponseReceiptSchema: z.ZodUnion<readonly [z.ZodObj
452
463
  remoteUrl: z.ZodNullable<z.ZodString>;
453
464
  repository: z.ZodNullable<z.ZodString>;
454
465
  defaultBranch: z.ZodNullable<z.ZodString>;
466
+ provisioned: z.ZodBoolean;
455
467
  }, z.core.$strip>>;
456
468
  authMode: z.ZodOptional<z.ZodEnum<{
457
469
  anonymous: "anonymous";
458
470
  authenticated: "authenticated";
459
471
  }>>;
460
472
  persistence: z.ZodOptional<z.ZodEnum<{
461
- managed: "managed";
462
473
  temporary: "temporary";
474
+ managed: "managed";
463
475
  }>>;
464
476
  operation: z.ZodOptional<z.ZodObject<{
465
477
  id: z.ZodString;
@@ -531,6 +543,15 @@ export declare const publishResponseReceiptSchema: z.ZodUnion<readonly [z.ZodObj
531
543
  sha256: z.ZodOptional<z.ZodString>;
532
544
  contentType: z.ZodOptional<z.ZodString>;
533
545
  }, z.core.$strip>>>;
546
+ bulk: z.ZodOptional<z.ZodObject<{
547
+ kind: z.ZodLiteral<"zip-cas-v1">;
548
+ method: z.ZodLiteral<"PUT">;
549
+ url: z.ZodUnion<[z.ZodString, z.ZodString]>;
550
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
551
+ maxCompressedBytes: z.ZodNumber;
552
+ maxExpandedBytes: z.ZodNumber;
553
+ maxBlobs: z.ZodNumber;
554
+ }, z.core.$strip>>;
534
555
  links: z.ZodObject<{
535
556
  refresh: z.ZodString;
536
557
  resume: z.ZodOptional<z.ZodString>;
@@ -59,8 +59,8 @@ export declare const PushNewSessionSchema: z.ZodObject<{
59
59
  expiresAt: z.ZodString;
60
60
  kind: z.ZodEnum<{
61
61
  management: "management";
62
- person: "person";
63
62
  claim_preview: "claim_preview";
63
+ person: "person";
64
64
  }>;
65
65
  }, z.core.$strip>]>>;
66
66
  sessionUrl: z.ZodString;
@@ -117,8 +117,8 @@ export declare const PushNewCreateSessionResponseSchema: z.ZodObject<{
117
117
  expiresAt: z.ZodString;
118
118
  kind: z.ZodEnum<{
119
119
  management: "management";
120
- person: "person";
121
120
  claim_preview: "claim_preview";
121
+ person: "person";
122
122
  }>;
123
123
  }, z.core.$strip>]>>;
124
124
  sessionUrl: z.ZodString;
@@ -143,8 +143,8 @@ export declare const PushNewStatusResponseSchema: z.ZodObject<{
143
143
  expiresAt: z.ZodString;
144
144
  kind: z.ZodEnum<{
145
145
  management: "management";
146
- person: "person";
147
146
  claim_preview: "claim_preview";
147
+ person: "person";
148
148
  }>;
149
149
  }, z.core.$strip>]>>;
150
150
  status: z.ZodEnum<{
@@ -13,7 +13,7 @@ export const pushNewSourceKindSchema = z.enum(["git", "direct_upload"]);
13
13
  export const pushNewUploadModeSchema = z.enum(["static_publish", "source_archive_build"]);
14
14
  const nullableDateTime = z.string().datetime().nullable();
15
15
  export const PushNewSessionSchema = z.object({
16
- id: z.string().describe("push.new session id (`psh_...`)."),
16
+ id: z.string().describe("Git push session id (`psh_...`)."),
17
17
  status: pushNewSessionStatusSchema,
18
18
  sourceKind: pushNewSourceKindSchema,
19
19
  uploadMode: pushNewUploadModeSchema.nullable(),
@@ -1,3 +1,4 @@
1
+ import { MAX_VERSION_TOTAL_BYTES } from "../utils/publish-policy.js";
1
2
  // Crude worst-case quotas (the platform spec "Abuse Posture"): hard,
2
3
  // launch-day abuse controls that exist independently of plan limits. One named
3
4
  // raise-only table: raise a limit later, never lower one. Enforcement points
@@ -5,7 +6,7 @@
5
6
  // activity/ops events so thresholds are tuned from data.
6
7
  export const WORST_CASE_QUOTAS = {
7
8
  // Per-version artifact ceiling (sum of file bytes; enforced at manifest intake).
8
- maxArtifactBytes: 2 * 1024 * 1024 * 1024,
9
+ maxArtifactBytes: MAX_VERSION_TOTAL_BYTES,
9
10
  // Inline one-shot publish body cap (compressed archive bytes).
10
11
  maxInlinePublishBodyBytes: 128 * 1024 * 1024,
11
12
  // Versions a free/anonymous space may accumulate before old ones must go.
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  export declare const repositoryConnectionTypeSchema: z.ZodEnum<{
3
- hosted: "hosted";
4
3
  connected: "connected";
4
+ hosted: "hosted";
5
5
  }>;
6
6
  export declare const repositoryConnectionSyncStatusSchema: z.ZodEnum<{
7
7
  failed: "failed";
@@ -25,8 +25,8 @@ export declare const RepositoryConnectionSchema: z.ZodObject<{
25
25
  generic: "generic";
26
26
  }>;
27
27
  connectionType: z.ZodEnum<{
28
- hosted: "hosted";
29
28
  connected: "connected";
29
+ hosted: "hosted";
30
30
  }>;
31
31
  repositoryId: z.ZodNullable<z.ZodString>;
32
32
  installationId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -39,6 +39,7 @@ export declare const RepositoryConnectionSchema: z.ZodObject<{
39
39
  credentialConfigured: z.ZodBoolean;
40
40
  autoDeployProduction: z.ZodBoolean;
41
41
  autoDeployPreviews: z.ZodBoolean;
42
+ githubPreviewCommentsEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
42
43
  buildSettings: z.ZodObject<{
43
44
  rootDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
44
45
  installDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -79,8 +80,8 @@ export declare const repositoryConnectionCreateSchema: z.ZodObject<{
79
80
  generic: "generic";
80
81
  }>>;
81
82
  connectionType: z.ZodDefault<z.ZodEnum<{
82
- hosted: "hosted";
83
83
  connected: "connected";
84
+ hosted: "hosted";
84
85
  }>>;
85
86
  repositoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
87
  repositoryName: z.ZodOptional<z.ZodString>;
@@ -93,6 +94,7 @@ export declare const repositoryConnectionCreateSchema: z.ZodObject<{
93
94
  credential: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
95
  autoDeployProduction: z.ZodDefault<z.ZodBoolean>;
95
96
  autoDeployPreviews: z.ZodDefault<z.ZodBoolean>;
97
+ githubPreviewCommentsEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
96
98
  buildSettings: z.ZodOptional<z.ZodObject<{
97
99
  rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
100
  installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -108,8 +110,8 @@ export declare const repositoryConnectionCreateSchema: z.ZodObject<{
108
110
  }, z.core.$strip>;
109
111
  export declare const repositoryConnectionPatchSchema: z.ZodObject<{
110
112
  connectionType: z.ZodOptional<z.ZodEnum<{
111
- hosted: "hosted";
112
113
  connected: "connected";
114
+ hosted: "hosted";
113
115
  }>>;
114
116
  productionBranch: z.ZodOptional<z.ZodString>;
115
117
  cloneUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -117,6 +119,7 @@ export declare const repositoryConnectionPatchSchema: z.ZodObject<{
117
119
  credential: z.ZodOptional<z.ZodNullable<z.ZodString>>;
118
120
  autoDeployProduction: z.ZodOptional<z.ZodBoolean>;
119
121
  autoDeployPreviews: z.ZodOptional<z.ZodBoolean>;
122
+ githubPreviewCommentsEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
120
123
  buildSettings: z.ZodOptional<z.ZodObject<{
121
124
  rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
122
125
  installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -137,13 +140,14 @@ export declare const repositoryImportRemoteSchema: z.ZodObject<{
137
140
  bitbucket: "bitbucket";
138
141
  generic: "generic";
139
142
  }>>;
140
- credential: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
143
  defaultBranch: z.ZodDefault<z.ZodString>;
142
144
  repositoryFullName: z.ZodString;
145
+ credential: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
146
  repositoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
147
  repositoryName: z.ZodOptional<z.ZodString>;
145
148
  productionBranch: z.ZodOptional<z.ZodString>;
146
149
  cloneUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
150
+ githubPreviewCommentsEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
147
151
  buildSettings: z.ZodOptional<z.ZodObject<{
148
152
  rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
149
153
  installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -197,8 +201,8 @@ export declare const repositoryWebhookDeliveryListQuerySchema: z.ZodObject<{
197
201
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
198
202
  cursor: z.ZodOptional<z.ZodString>;
199
203
  connectionType: z.ZodOptional<z.ZodEnum<{
200
- hosted: "hosted";
201
204
  connected: "connected";
205
+ hosted: "hosted";
202
206
  }>>;
203
207
  status: z.ZodOptional<z.ZodEnum<{
204
208
  failed: "failed";
@@ -41,6 +41,11 @@ export const RepositoryConnectionSchema = z.object({
41
41
  credentialConfigured: z.boolean(),
42
42
  autoDeployProduction: z.boolean(),
43
43
  autoDeployPreviews: z.boolean(),
44
+ githubPreviewCommentsEnabled: z
45
+ .boolean()
46
+ .nullable()
47
+ .optional()
48
+ .describe("Controls GitHub preview comments for this Space. Set null to use the team setting."),
44
49
  buildSettings: BuildSettingsSchema,
45
50
  syncStatus: repositoryConnectionSyncStatusSchema,
46
51
  providerAccessStatus: repositoryProviderAccessStatusSchema.default("active"),
@@ -72,6 +77,11 @@ export const repositoryConnectionCreateSchema = z.object({
72
77
  credential: z.string().trim().min(1).nullable().optional(),
73
78
  autoDeployProduction: z.boolean().default(true),
74
79
  autoDeployPreviews: z.boolean().default(true),
80
+ githubPreviewCommentsEnabled: z
81
+ .boolean()
82
+ .nullable()
83
+ .optional()
84
+ .describe("Controls GitHub preview comments for this Space. Set null to use the team setting."),
75
85
  buildSettings: BuildSettingsOverrideSchema.optional(),
76
86
  });
77
87
  export const repositoryConnectionPatchSchema = z.object({
@@ -82,6 +92,11 @@ export const repositoryConnectionPatchSchema = z.object({
82
92
  credential: z.string().trim().min(1).nullable().optional(),
83
93
  autoDeployProduction: z.boolean().optional(),
84
94
  autoDeployPreviews: z.boolean().optional(),
95
+ githubPreviewCommentsEnabled: z
96
+ .boolean()
97
+ .nullable()
98
+ .optional()
99
+ .describe("Controls GitHub preview comments for this Space. Set null to use the team setting."),
85
100
  buildSettings: BuildSettingsOverrideSchema.optional(),
86
101
  });
87
102
  // Importing an existing external remote is an action/flag, not a connection
@@ -41,8 +41,8 @@ export declare const spaceInfrastructureSchema: z.ZodObject<{
41
41
  providerMainHostname: z.ZodNullable<z.ZodString>;
42
42
  provisioningState: z.ZodEnum<{
43
43
  provisioning: "provisioning";
44
- degraded: "degraded";
45
44
  converged: "converged";
45
+ degraded: "degraded";
46
46
  }>;
47
47
  }, z.core.$strip>;
48
48
  export type SpaceInfrastructure = z.infer<typeof spaceInfrastructureSchema>;
@@ -54,6 +54,7 @@ export declare const spaceGitSchema: z.ZodObject<{
54
54
  remoteUrl: z.ZodNullable<z.ZodString>;
55
55
  repository: z.ZodNullable<z.ZodString>;
56
56
  defaultBranch: z.ZodNullable<z.ZodString>;
57
+ provisioned: z.ZodBoolean;
57
58
  }, z.core.$strip>;
58
59
  export type SpaceGit = z.infer<typeof spaceGitSchema>;
59
60
  export declare const SpaceSchema: z.ZodObject<{
@@ -81,8 +82,8 @@ export declare const SpaceSchema: z.ZodObject<{
81
82
  providerMainHostname: z.ZodNullable<z.ZodString>;
82
83
  provisioningState: z.ZodEnum<{
83
84
  provisioning: "provisioning";
84
- degraded: "degraded";
85
85
  converged: "converged";
86
+ degraded: "degraded";
86
87
  }>;
87
88
  }, z.core.$strip>>;
88
89
  anonymous: z.ZodBoolean;
@@ -90,10 +91,10 @@ export declare const SpaceSchema: z.ZodObject<{
90
91
  title: z.ZodString;
91
92
  status: z.ZodEnum<{
92
93
  active: "active";
93
- failed: "failed";
94
94
  provisioning: "provisioning";
95
95
  updating: "updating";
96
96
  deleting: "deleting";
97
+ failed: "failed";
97
98
  }>;
98
99
  disabled: z.ZodNullable<z.ZodObject<{
99
100
  at: z.ZodNullable<z.ZodString>;
@@ -205,7 +206,6 @@ export declare const SpaceSchema: z.ZodObject<{
205
206
  burstable: z.ZodOptional<z.ZodBoolean>;
206
207
  }, z.core.$strict>>;
207
208
  markdownNegotiation: z.ZodOptional<z.ZodBoolean>;
208
- experimental_gutenberg: z.ZodOptional<z.ZodBoolean>;
209
209
  inject: z.ZodOptional<z.ZodObject<{
210
210
  head: z.ZodOptional<z.ZodArray<z.ZodString>>;
211
211
  bodyStart: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -229,6 +229,7 @@ export declare const SpaceSchema: z.ZodObject<{
229
229
  remoteUrl: z.ZodNullable<z.ZodString>;
230
230
  repository: z.ZodNullable<z.ZodString>;
231
231
  defaultBranch: z.ZodNullable<z.ZodString>;
232
+ provisioned: z.ZodBoolean;
232
233
  }, z.core.$strip>>;
233
234
  operation: z.ZodNullable<z.ZodObject<{
234
235
  id: z.ZodString;
@@ -405,6 +406,7 @@ export declare const VersionSchema: z.ZodObject<{
405
406
  failedStage: z.ZodNullable<z.ZodString>;
406
407
  manifestHash: z.ZodNullable<z.ZodString>;
407
408
  buildId: z.ZodNullable<z.ZodString>;
409
+ gitCommitSha: z.ZodNullable<z.ZodString>;
408
410
  importedFromVersionId: z.ZodNullable<z.ZodString>;
409
411
  variables: z.ZodNull;
410
412
  fileCount: z.ZodNullable<z.ZodNumber>;
@@ -494,7 +496,6 @@ export declare const VersionSchema: z.ZodObject<{
494
496
  burstable: z.ZodOptional<z.ZodBoolean>;
495
497
  }, z.core.$strict>>;
496
498
  markdownNegotiation: z.ZodOptional<z.ZodBoolean>;
497
- experimental_gutenberg: z.ZodOptional<z.ZodBoolean>;
498
499
  inject: z.ZodOptional<z.ZodObject<{
499
500
  head: z.ZodOptional<z.ZodArray<z.ZodString>>;
500
501
  bodyStart: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -82,6 +82,9 @@ export const spaceGitSchema = z.object({
82
82
  .string()
83
83
  .nullable()
84
84
  .describe("Branch that publishes to the live channel when pushed."),
85
+ provisioned: z
86
+ .boolean()
87
+ .describe("Whether the repository behind this block exists yet. Always true for a GitHub binding; for a hosted remote, true once it was minted or first pushed to, and false while there is nothing to browse."),
85
88
  });
86
89
  // Every `CONSUMER_HIDDEN_SPACE_FIELDS` member below is `.optional()` because
87
90
  // the consumer projection OMITS it rather than nulling it — absent means "not
@@ -301,6 +304,10 @@ export const VersionSchema = z.object({
301
304
  manifestHash: z.string().nullable(),
302
305
  // Build (`bld_`) that produced this version; null for direct uploads.
303
306
  buildId: z.string().nullable(),
307
+ gitCommitSha: z
308
+ .string()
309
+ .nullable()
310
+ .describe("Commit the build for this version was made from; null for direct uploads."),
304
311
  // Import provenance: the source version this one was materialized from.
305
312
  importedFromVersionId: z.string().nullable(),
306
313
  // Finalize-time dependency digests remain server-internal: historical rows