@spacefast/common 0.0.26 → 0.2.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 (302) hide show
  1. package/dist/agents/connect-targets.d.ts +6 -146
  2. package/dist/agents/connect-targets.js +63 -295
  3. package/dist/agents/private-key-oauth.d.ts +31 -1
  4. package/dist/agents/private-key-oauth.js +124 -33
  5. package/dist/agents/registry/core.d.ts +292 -0
  6. package/dist/agents/registry/core.js +1388 -0
  7. package/dist/agents/registry/deeplink-probes.d.ts +23 -0
  8. package/dist/agents/registry/deeplink-probes.js +18 -0
  9. package/dist/agents/registry/node.d.ts +56 -0
  10. package/dist/agents/registry/node.js +339 -0
  11. package/dist/brand-assets-build.js +1 -2
  12. package/dist/brand-assets.js +4 -7
  13. package/dist/brand.d.ts +17 -0
  14. package/dist/brand.js +24 -4
  15. package/dist/config/domains.d.ts +55 -28
  16. package/dist/config/domains.js +85 -41
  17. package/dist/config/index.js +1 -2
  18. package/dist/contracts/abuse.js +9 -24
  19. package/dist/contracts/access-profiles.d.ts +86 -0
  20. package/dist/contracts/access-profiles.js +89 -0
  21. package/dist/contracts/access.d.ts +21 -27
  22. package/dist/contracts/access.js +33 -64
  23. package/dist/contracts/activity.d.ts +18 -1
  24. package/dist/contracts/activity.js +70 -26
  25. package/dist/contracts/analytics.js +8 -10
  26. package/dist/contracts/api-keys.d.ts +77 -52
  27. package/dist/contracts/api-keys.js +44 -24
  28. package/dist/contracts/application-journal.d.ts +216 -0
  29. package/dist/contracts/application-journal.js +167 -0
  30. package/dist/contracts/auth.d.ts +90 -17
  31. package/dist/contracts/auth.js +86 -17
  32. package/dist/contracts/beta.d.ts +9 -4
  33. package/dist/contracts/beta.js +20 -16
  34. package/dist/contracts/billing.js +7 -11
  35. package/dist/contracts/bootstrap.d.ts +791 -0
  36. package/dist/contracts/bootstrap.js +51 -0
  37. package/dist/contracts/builds.d.ts +186 -7
  38. package/dist/contracts/builds.js +75 -21
  39. package/dist/contracts/channels.d.ts +43 -0
  40. package/dist/contracts/channels.js +25 -9
  41. package/dist/contracts/cli.d.ts +7 -0
  42. package/dist/contracts/cli.js +6 -0
  43. package/dist/contracts/collab-public.d.ts +1 -1
  44. package/dist/contracts/collab-public.js +5 -8
  45. package/dist/contracts/comments.d.ts +45 -35
  46. package/dist/contracts/comments.js +107 -77
  47. package/dist/contracts/commerce.d.ts +165 -0
  48. package/dist/contracts/commerce.js +146 -0
  49. package/dist/contracts/common.d.ts +3 -3
  50. package/dist/contracts/common.js +18 -29
  51. package/dist/contracts/content-contract-verification.d.ts +521 -0
  52. package/dist/contracts/content-contract-verification.js +320 -0
  53. package/dist/contracts/content-platform-fixture.d.ts +1278 -0
  54. package/dist/contracts/content-platform-fixture.js +44 -0
  55. package/dist/contracts/content-program.d.ts +994 -0
  56. package/dist/contracts/content-program.js +658 -0
  57. package/dist/contracts/content-sync.d.ts +290 -0
  58. package/dist/contracts/content-sync.js +167 -0
  59. package/dist/contracts/content.d.ts +432 -0
  60. package/dist/contracts/content.js +303 -0
  61. package/dist/contracts/continuation.d.ts +17 -1
  62. package/dist/contracts/continuation.js +23 -23
  63. package/dist/contracts/countries.js +3 -4
  64. package/dist/contracts/crons.d.ts +17 -0
  65. package/dist/contracts/crons.js +33 -15
  66. package/dist/contracts/dashboard-prefs.d.ts +56 -0
  67. package/dist/contracts/dashboard-prefs.js +51 -0
  68. package/dist/contracts/device-auth.d.ts +234 -37
  69. package/dist/contracts/device-auth.js +267 -53
  70. package/dist/contracts/docs.d.ts +6 -10
  71. package/dist/contracts/docs.js +5 -13
  72. package/dist/contracts/domains.d.ts +499 -102
  73. package/dist/contracts/domains.js +169 -58
  74. package/dist/contracts/email-preferences.d.ts +3 -3
  75. package/dist/contracts/email-preferences.js +6 -7
  76. package/dist/contracts/enums.d.ts +26 -26
  77. package/dist/contracts/enums.js +61 -54
  78. package/dist/contracts/error-code-meta.d.ts +269 -7
  79. package/dist/contracts/error-code-meta.js +80 -5
  80. package/dist/contracts/error-codes.d.ts +5 -5
  81. package/dist/contracts/error-codes.js +78 -16
  82. package/dist/contracts/events.d.ts +100 -20
  83. package/dist/contracts/events.js +107 -20
  84. package/dist/contracts/execution.d.ts +47 -66
  85. package/dist/contracts/execution.js +51 -64
  86. package/dist/contracts/feature-lifecycle.d.ts +70 -14
  87. package/dist/contracts/feature-lifecycle.js +86 -15
  88. package/dist/contracts/features.d.ts +100 -37
  89. package/dist/contracts/features.js +21 -27
  90. package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
  91. package/dist/contracts/frame-session.d.ts +192 -0
  92. package/dist/contracts/frame-session.js +164 -0
  93. package/dist/contracts/functions.d.ts +218 -211
  94. package/dist/contracts/functions.js +273 -260
  95. package/dist/contracts/grant-copy.d.ts +43 -0
  96. package/dist/contracts/grant-copy.js +44 -0
  97. package/dist/contracts/grants.d.ts +64 -56
  98. package/dist/contracts/grants.js +124 -23
  99. package/dist/contracts/ids.d.ts +4 -1
  100. package/dist/contracts/ids.js +4 -1
  101. package/dist/contracts/internal.d.ts +5 -4
  102. package/dist/contracts/internal.js +12 -3
  103. package/dist/contracts/mcp.d.ts +17 -0
  104. package/dist/contracts/mcp.js +23 -0
  105. package/dist/contracts/me.d.ts +6 -1
  106. package/dist/contracts/me.js +12 -6
  107. package/dist/contracts/notifications.d.ts +27 -29
  108. package/dist/contracts/notifications.js +9 -4
  109. package/dist/contracts/oauth-resources.d.ts +112 -10
  110. package/dist/contracts/oauth-resources.js +116 -11
  111. package/dist/contracts/oauth-scope-actions.d.ts +90 -0
  112. package/dist/contracts/oauth-scope-actions.js +126 -0
  113. package/dist/contracts/operations.d.ts +27 -4
  114. package/dist/contracts/operations.js +11 -5
  115. package/dist/contracts/pages.d.ts +29 -5
  116. package/dist/contracts/pages.js +22 -5
  117. package/dist/contracts/partner-notifications.d.ts +3 -0
  118. package/dist/contracts/partner-notifications.js +65 -0
  119. package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
  120. package/dist/contracts/{platform.js → partner.js} +27 -40
  121. package/dist/contracts/plan-policy.d.ts +1 -1
  122. package/dist/contracts/principal-assertion.d.ts +43 -0
  123. package/dist/contracts/principal-assertion.js +67 -0
  124. package/dist/contracts/principals.d.ts +73 -0
  125. package/dist/contracts/principals.js +59 -0
  126. package/dist/contracts/privacy.d.ts +11 -0
  127. package/dist/contracts/privacy.js +17 -0
  128. package/dist/contracts/problem-document.js +3 -4
  129. package/dist/contracts/publish-archive.d.ts +116 -18
  130. package/dist/contracts/publish-archive.js +6 -3
  131. package/dist/contracts/push-new.d.ts +4 -4
  132. package/dist/contracts/quotas.js +3 -3
  133. package/dist/contracts/realtime.d.ts +52 -0
  134. package/dist/contracts/realtime.js +54 -0
  135. package/dist/contracts/repository-connections.d.ts +1 -1
  136. package/dist/contracts/repository-connections.js +6 -2
  137. package/dist/contracts/resources.d.ts +105 -14
  138. package/dist/contracts/resources.js +145 -21
  139. package/dist/contracts/route-inventory.d.ts +358 -0
  140. package/dist/contracts/route-inventory.js +141 -0
  141. package/dist/contracts/runtime-api.d.ts +112 -35
  142. package/dist/contracts/runtime-api.js +86 -66
  143. package/dist/contracts/runtime-app.d.ts +11 -21
  144. package/dist/contracts/runtime-app.js +39 -24
  145. package/dist/contracts/runtime-components.d.ts +143 -0
  146. package/dist/contracts/runtime-components.js +199 -0
  147. package/dist/contracts/runtime-db.d.ts +45 -19
  148. package/dist/contracts/runtime-db.js +85 -20
  149. package/dist/contracts/runtime-purge.js +3 -5
  150. package/dist/contracts/runtime-services.d.ts +43 -75
  151. package/dist/contracts/runtime-services.js +29 -49
  152. package/dist/contracts/runtime-storage.d.ts +14 -14
  153. package/dist/contracts/runtime-storage.js +28 -13
  154. package/dist/contracts/sf-config-v1.d.ts +14 -18
  155. package/dist/contracts/slugs.js +13 -4
  156. package/dist/contracts/space-config.d.ts +235 -28
  157. package/dist/contracts/space-config.js +246 -91
  158. package/dist/contracts/spaces.d.ts +360 -255
  159. package/dist/contracts/spaces.js +190 -122
  160. package/dist/contracts/superadmin-activity.d.ts +3 -43
  161. package/dist/contracts/superadmin-activity.js +6 -30
  162. package/dist/contracts/superadmin-emails.d.ts +1 -0
  163. package/dist/contracts/superadmin-emails.js +17 -1
  164. package/dist/contracts/superadmin-runtime.d.ts +199 -0
  165. package/dist/contracts/superadmin-runtime.js +141 -0
  166. package/dist/contracts/superadmin-search.d.ts +22 -2
  167. package/dist/contracts/superadmin-search.js +14 -6
  168. package/dist/contracts/superadmin-spaces.d.ts +435 -186
  169. package/dist/contracts/superadmin-spaces.js +131 -25
  170. package/dist/contracts/superadmin-teams.d.ts +3 -0
  171. package/dist/contracts/superadmin-teams.js +1 -2
  172. package/dist/contracts/superadmin-tenants.d.ts +627 -6
  173. package/dist/contracts/superadmin-tenants.js +32 -7
  174. package/dist/contracts/superadmin.d.ts +98 -16
  175. package/dist/contracts/superadmin.js +63 -10
  176. package/dist/contracts/tags.d.ts +85 -58
  177. package/dist/contracts/tags.js +44 -34
  178. package/dist/contracts/teams.d.ts +72 -9
  179. package/dist/contracts/teams.js +84 -25
  180. package/dist/contracts/tenants.d.ts +135 -0
  181. package/dist/contracts/tenants.js +120 -0
  182. package/dist/contracts/test-triggers.d.ts +70 -0
  183. package/dist/contracts/test-triggers.js +116 -0
  184. package/dist/contracts/theme-json.js +3 -8
  185. package/dist/contracts/transfers.d.ts +1 -0
  186. package/dist/contracts/transfers.js +1 -0
  187. package/dist/contracts/usage.d.ts +209 -0
  188. package/dist/contracts/usage.js +124 -12
  189. package/dist/contracts/variables.d.ts +2 -2
  190. package/dist/contracts/variables.js +9 -13
  191. package/dist/contracts/webhooks.d.ts +13 -5
  192. package/dist/contracts/webhooks.js +3 -1
  193. package/dist/contracts/zero.d.ts +57 -64
  194. package/dist/contracts/zero.js +68 -66
  195. package/dist/dashboard-paths/index.d.ts +24 -21
  196. package/dist/dashboard-paths/index.js +35 -47
  197. package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
  198. package/dist/dashboard-paths/route-reservations.generated.js +36 -0
  199. package/dist/docs/agent-arrival.d.ts +92 -0
  200. package/dist/docs/agent-arrival.js +227 -0
  201. package/dist/docs/agent-output-policy.d.ts +6 -0
  202. package/dist/docs/agent-output-policy.js +22 -0
  203. package/dist/docs/agent-prose.d.ts +11 -17
  204. package/dist/docs/agent-prose.js +62 -37
  205. package/dist/docs/agent-setup.d.ts +72 -41
  206. package/dist/docs/agent-setup.js +336 -436
  207. package/dist/docs/catalog.d.ts +147 -89
  208. package/dist/docs/catalog.js +157 -42
  209. package/dist/docs/error-docs.d.ts +2098 -1
  210. package/dist/docs/error-docs.js +281 -16
  211. package/dist/docs/index-build.d.ts +0 -1
  212. package/dist/docs/index-build.js +2 -3
  213. package/dist/docs/page-context-prompt.d.ts +77 -0
  214. package/dist/docs/page-context-prompt.js +131 -0
  215. package/dist/docs/reference-urls.d.ts +46 -0
  216. package/dist/docs/reference-urls.js +79 -0
  217. package/dist/docs/search.d.ts +6 -8
  218. package/dist/docs/search.js +10 -13
  219. package/dist/docs/skill-distribution.d.ts +4 -1
  220. package/dist/docs/skill-distribution.js +10 -5
  221. package/dist/docs/skills.d.ts +117 -117
  222. package/dist/docs/skills.js +120 -72
  223. package/dist/docs/start-prompts.d.ts +45 -0
  224. package/dist/docs/start-prompts.js +62 -0
  225. package/dist/domain-exploration.js +9 -13
  226. package/dist/og-template.d.ts +56 -0
  227. package/dist/og-template.js +56 -0
  228. package/dist/slug-policy/index.js +5 -11
  229. package/dist/utils/browser-credential.d.ts +13 -6
  230. package/dist/utils/browser-credential.js +14 -7
  231. package/dist/utils/build-settings.d.ts +16 -0
  232. package/dist/utils/build-settings.js +63 -17
  233. package/dist/utils/canonical-json.d.ts +3 -5
  234. package/dist/utils/canonical-json.js +3 -5
  235. package/dist/utils/cast-transport.d.ts +5 -17
  236. package/dist/utils/cast-transport.js +6 -19
  237. package/dist/utils/claim-token.js +1 -2
  238. package/dist/utils/comment-avatars.js +4 -6
  239. package/dist/utils/concurrency.js +2 -3
  240. package/dist/utils/content-type.d.ts +7 -6
  241. package/dist/utils/content-type.js +73 -51
  242. package/dist/utils/credential-policy.d.ts +50 -6
  243. package/dist/utils/credential-policy.js +123 -57
  244. package/dist/utils/egress-policy.fixtures.json +1 -1
  245. package/dist/utils/generate-space-name.d.ts +3 -8
  246. package/dist/utils/generate-space-name.js +3 -8
  247. package/dist/utils/grants.d.ts +0 -1
  248. package/dist/utils/grants.js +4 -7
  249. package/dist/utils/gravatar.d.ts +2 -4
  250. package/dist/utils/gravatar.js +6 -12
  251. package/dist/utils/id-hints.js +14 -23
  252. package/dist/utils/idempotency.d.ts +3 -3
  253. package/dist/utils/idempotency.js +6 -7
  254. package/dist/utils/local-space-state.d.ts +15 -15
  255. package/dist/utils/local-space-state.js +34 -23
  256. package/dist/utils/oauth-signed-query.d.ts +3 -5
  257. package/dist/utils/oauth-signed-query.js +6 -9
  258. package/dist/utils/one-shot-replay.d.ts +3 -5
  259. package/dist/utils/one-shot-replay.js +3 -5
  260. package/dist/utils/page-colors.d.ts +4 -10
  261. package/dist/utils/page-colors.js +11 -35
  262. package/dist/utils/page-fonts.js +6 -11
  263. package/dist/utils/page-preview.d.ts +0 -1
  264. package/dist/utils/page-preview.js +0 -1
  265. package/dist/utils/pages.d.ts +22 -11
  266. package/dist/utils/pages.js +70 -30
  267. package/dist/utils/privacy-regions.d.ts +19 -0
  268. package/dist/utils/privacy-regions.js +91 -0
  269. package/dist/utils/publish-form-data.d.ts +4 -5
  270. package/dist/utils/publish-form-data.js +2 -3
  271. package/dist/utils/publish-policy.d.ts +10 -23
  272. package/dist/utils/publish-policy.js +63 -116
  273. package/dist/utils/query-client.d.ts +2 -0
  274. package/dist/utils/query-client.js +10 -1
  275. package/dist/utils/runtime-paths.d.ts +4 -4
  276. package/dist/utils/runtime-paths.js +6 -8
  277. package/dist/utils/runtime-upload.d.ts +4 -0
  278. package/dist/utils/runtime-upload.js +5 -0
  279. package/dist/utils/secure-local-file.d.ts +3 -3
  280. package/dist/utils/secure-local-file.js +18 -24
  281. package/dist/utils/space-config.d.ts +11 -14
  282. package/dist/utils/space-config.js +10 -16
  283. package/dist/utils/static-runtime-policy.d.ts +5 -8
  284. package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
  285. package/dist/utils/static-runtime-policy.generated.js +70 -0
  286. package/dist/utils/static-runtime-policy.js +17 -84
  287. package/dist/utils/storage-policy.js +1 -2
  288. package/dist/utils/upload-session.js +8 -14
  289. package/dist/utils/version-path.js +11 -19
  290. package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
  291. package/dist/utils/wpcom-auth-redirects.js +1 -4
  292. package/dist/vocabulary.d.ts +7 -7
  293. package/dist/vocabulary.js +30 -16
  294. package/package.json +14 -2
  295. package/dist/agents/client-registry.d.ts +0 -22
  296. package/dist/agents/client-registry.js +0 -41
  297. package/dist/docs/agent-handoff-document.d.ts +0 -15
  298. package/dist/docs/agent-handoff-document.js +0 -180
  299. package/dist/docs/agent-solutions.d.ts +0 -110
  300. package/dist/docs/agent-solutions.js +0 -183
  301. package/dist/utils/query-keys.d.ts +0 -84
  302. package/dist/utils/query-keys.js +0 -108
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The realtime cache lane's wire contract: one schema, both ends of the socket.
3
+ *
4
+ * The control plane publishes `resource.changed` onto a Space's Cast notice room
5
+ * whenever a mutation moves something a dashboard reads back
6
+ * (`apps/control-plane/src/comments/notices.ts`), and the dashboard turns those
7
+ * notices into targeted query invalidations
8
+ * (`packages/app-shell/src/lib/realtime-invalidation.ts`). Nothing renders this
9
+ * notice — it is read by code only — so the two sides agreeing on the shape is
10
+ * the entire contract, and they agree by importing the same schema rather than
11
+ * by keeping two copies in step.
12
+ *
13
+ * This lane is deliberately not part of the HTTP API: it carries no data, only
14
+ * the name of what moved. A missed notice costs a later refetch, never
15
+ * correctness.
16
+ */
17
+ import { z } from "zod";
18
+ /** The notice kind. Shares the `notice` event with Cast's own comment kinds. */
19
+ export const RESOURCE_CHANGED = "resource.changed";
20
+ /**
21
+ * The payload shape.
22
+ *
23
+ * `resource` is singular and names the kind of thing that moved rather than a
24
+ * table or a query key, so the receiver can map it onto whatever keys it holds.
25
+ * `ids` is advisory and deliberately lenient: a notice may name exactly what
26
+ * moved or nothing at all, and a list a build cannot read falls back to the
27
+ * empty list — which reads as "the whole resource kind moved". The failure mode
28
+ * of a malformed notice should be a broader refresh, never a missed one.
29
+ *
30
+ * camelCase and self-contained: a receiver reads `resource`/`spaceId`/`ids` and
31
+ * nothing else. The snake_case fields that ride alongside on the wire belong to
32
+ * the rendered notice lanes that share this room.
33
+ */
34
+ export const resourceChangedNoticeSchema = z.object({
35
+ kind: z.literal(RESOURCE_CHANGED),
36
+ resource: z.string().min(1),
37
+ spaceId: z.string().min(1),
38
+ ids: z.array(z.string()).optional().catch([]),
39
+ });
40
+ /**
41
+ * The publisher's only way to shape a notice.
42
+ *
43
+ * Omitting `ids` (or passing an empty list) sends no `ids` field at all — JSON
44
+ * has no undefined — which is the "this whole resource moved" signal: always
45
+ * correct, just less targeted.
46
+ */
47
+ export function resourceChangedNotice(input) {
48
+ return resourceChangedNoticeSchema.parse({
49
+ kind: RESOURCE_CHANGED,
50
+ resource: input.resource,
51
+ spaceId: input.spaceId,
52
+ ids: input.ids === undefined || input.ids.length === 0 ? undefined : [...input.ids],
53
+ });
54
+ }
@@ -138,10 +138,10 @@ export declare const repositoryImportRemoteSchema: z.ZodObject<{
138
138
  generic: "generic";
139
139
  }>>;
140
140
  credential: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ defaultBranch: z.ZodDefault<z.ZodString>;
141
142
  repositoryFullName: z.ZodString;
142
143
  repositoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
144
  repositoryName: z.ZodOptional<z.ZodString>;
144
- defaultBranch: z.ZodDefault<z.ZodString>;
145
145
  productionBranch: z.ZodOptional<z.ZodString>;
146
146
  cloneUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
147
147
  buildSettings: z.ZodOptional<z.ZodObject<{
@@ -118,8 +118,12 @@ export const RepositoryWebhookDeliverySchema = z.object({
118
118
  updatedAt: z.string().datetime(),
119
119
  });
120
120
  export const repositoryWebhookDeliveryListQuerySchema = cursorListQuerySchema.extend({
121
- connectionType: repositoryConnectionTypeSchema.optional(),
122
- status: repositoryWebhookDeliveryStatusSchema.optional(),
121
+ connectionType: repositoryConnectionTypeSchema
122
+ .optional()
123
+ .describe("Return only deliveries for this connection type."),
124
+ status: repositoryWebhookDeliveryStatusSchema
125
+ .optional()
126
+ .describe("Return only deliveries in this processing state."),
123
127
  });
124
128
  export const repositoryWebhookDeliveryListResponseSchema = z.object({
125
129
  data: z.array(RepositoryWebhookDeliverySchema),
@@ -3,8 +3,8 @@ export declare const DiagnosticSchema: z.ZodObject<{
3
3
  code: z.ZodString;
4
4
  severity: z.ZodEnum<{
5
5
  info: "info";
6
- error: "error";
7
6
  warning: "warning";
7
+ error: "error";
8
8
  }>;
9
9
  message: z.ZodString;
10
10
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -35,30 +35,65 @@ export declare const ChannelPointerSchema: z.ZodObject<{
35
35
  }, z.core.$strip>;
36
36
  export type ChannelPointer = z.infer<typeof ChannelPointerSchema>;
37
37
  export declare const spaceSettingsDigestSchema: z.ZodString;
38
+ export declare const spaceInfrastructureSchema: z.ZodObject<{
39
+ region: z.ZodNullable<z.ZodString>;
40
+ runtimeInstanceId: z.ZodNullable<z.ZodString>;
41
+ providerMainHostname: z.ZodNullable<z.ZodString>;
42
+ provisioningState: z.ZodEnum<{
43
+ provisioning: "provisioning";
44
+ degraded: "degraded";
45
+ converged: "converged";
46
+ }>;
47
+ }, z.core.$strip>;
48
+ export type SpaceInfrastructure = z.infer<typeof spaceInfrastructureSchema>;
49
+ export declare const spaceGitSchema: z.ZodObject<{
50
+ managedBy: z.ZodEnum<{
51
+ spacefast: "spacefast";
52
+ github: "github";
53
+ }>;
54
+ remoteUrl: z.ZodNullable<z.ZodString>;
55
+ repository: z.ZodNullable<z.ZodString>;
56
+ defaultBranch: z.ZodNullable<z.ZodString>;
57
+ }, z.core.$strip>;
58
+ export type SpaceGit = z.infer<typeof spaceGitSchema>;
38
59
  export declare const SpaceSchema: z.ZodObject<{
39
60
  id: z.ZodString;
40
- tenantId: z.ZodString;
41
- providerRef: z.ZodNullable<z.ZodString>;
42
- providerClientId: z.ZodNullable<z.ZodString>;
61
+ tenantId: z.ZodOptional<z.ZodString>;
62
+ mode: z.ZodOptional<z.ZodEnum<{
63
+ live: "live";
64
+ test: "test";
65
+ }>>;
66
+ providerRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ providerClientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
68
  teamId: z.ZodNullable<z.ZodString>;
44
69
  teamSlug: z.ZodNullable<z.ZodString>;
45
- principal: z.ZodNullable<z.ZodObject<{
70
+ principal: z.ZodOptional<z.ZodNullable<z.ZodObject<{
46
71
  tenantId: z.ZodString;
47
72
  principalType: z.ZodEnum<{
48
73
  team: "team";
49
74
  external: "external";
50
75
  }>;
51
76
  principalId: z.ZodString;
77
+ }, z.core.$strip>>>;
78
+ infrastructure: z.ZodOptional<z.ZodObject<{
79
+ region: z.ZodNullable<z.ZodString>;
80
+ runtimeInstanceId: z.ZodNullable<z.ZodString>;
81
+ providerMainHostname: z.ZodNullable<z.ZodString>;
82
+ provisioningState: z.ZodEnum<{
83
+ provisioning: "provisioning";
84
+ degraded: "degraded";
85
+ converged: "converged";
86
+ }>;
52
87
  }, z.core.$strip>>;
53
88
  anonymous: z.ZodBoolean;
54
89
  slug: z.ZodString;
55
90
  title: z.ZodString;
56
91
  status: z.ZodEnum<{
57
92
  active: "active";
93
+ failed: "failed";
58
94
  provisioning: "provisioning";
59
95
  updating: "updating";
60
96
  deleting: "deleting";
61
- failed: "failed";
62
97
  }>;
63
98
  disabled: z.ZodNullable<z.ZodObject<{
64
99
  at: z.ZodNullable<z.ZodString>;
@@ -185,6 +220,16 @@ export declare const SpaceSchema: z.ZodObject<{
185
220
  }, z.core.$strip>>;
186
221
  settingsDigest: z.ZodString;
187
222
  noindex: z.ZodBoolean;
223
+ pinnedAt: z.ZodNullable<z.ZodString>;
224
+ git: z.ZodNullable<z.ZodObject<{
225
+ managedBy: z.ZodEnum<{
226
+ spacefast: "spacefast";
227
+ github: "github";
228
+ }>;
229
+ remoteUrl: z.ZodNullable<z.ZodString>;
230
+ repository: z.ZodNullable<z.ZodString>;
231
+ defaultBranch: z.ZodNullable<z.ZodString>;
232
+ }, z.core.$strip>>;
188
233
  operation: z.ZodNullable<z.ZodObject<{
189
234
  id: z.ZodString;
190
235
  kind: z.ZodString;
@@ -208,8 +253,8 @@ export declare const SpaceSchema: z.ZodObject<{
208
253
  code: z.ZodString;
209
254
  severity: z.ZodEnum<{
210
255
  info: "info";
211
- error: "error";
212
256
  warning: "warning";
257
+ error: "error";
213
258
  }>;
214
259
  message: z.ZodString;
215
260
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -229,15 +274,28 @@ export declare const SpaceSchema: z.ZodObject<{
229
274
  createdAt: z.ZodString;
230
275
  updatedAt: z.ZodString;
231
276
  }, z.core.$strip>;
277
+ export declare const CONSUMER_HIDDEN_SPACE_FIELDS: readonly ["tenantId", "mode", "principal", "providerRef", "providerClientId", "infrastructure"];
278
+ export type ConsumerHiddenSpaceField = (typeof CONSUMER_HIDDEN_SPACE_FIELDS)[number];
279
+ export declare const publishSourceGitSchema: z.ZodObject<{
280
+ repository: z.ZodOptional<z.ZodNullable<z.ZodString>>;
281
+ repositoryFullName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
282
+ repositoryUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
283
+ ref: z.ZodOptional<z.ZodNullable<z.ZodString>>;
284
+ branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
+ branchAliasUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
286
+ commit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
287
+ commitSha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
288
+ pullRequestNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
289
+ }, z.core.$catchall<z.ZodUnknown>>;
232
290
  export declare const PublishSourceSchema: z.ZodObject<{
233
291
  kind: z.ZodEnum<{
234
292
  build: "build";
235
293
  agent: "agent";
236
294
  api: "api";
237
295
  dashboard: "dashboard";
238
- direct_upload: "direct_upload";
239
296
  cli: "cli";
240
297
  git: "git";
298
+ direct_upload: "direct_upload";
241
299
  import: "import";
242
300
  variable_update: "variable_update";
243
301
  config_update: "config_update";
@@ -261,6 +319,23 @@ export declare const PublishSourceSchema: z.ZodObject<{
261
319
  }, z.core.$catchall<z.ZodUnknown>>>;
262
320
  }, z.core.$strip>;
263
321
  export type PublishSource = z.infer<typeof PublishSourceSchema>;
322
+ export declare const VersionPublisherSchema: z.ZodObject<{
323
+ type: z.ZodEnum<{
324
+ system: "system";
325
+ user: "user";
326
+ api_key: "api_key";
327
+ partner_token: "partner_token";
328
+ oauth_client: "oauth_client";
329
+ anonymous_claim: "anonymous_claim";
330
+ }>;
331
+ displayName: z.ZodString;
332
+ avatarUrl: z.ZodNullable<z.ZodString>;
333
+ authorizedBy: z.ZodNullable<z.ZodObject<{
334
+ displayName: z.ZodString;
335
+ avatarUrl: z.ZodNullable<z.ZodString>;
336
+ }, z.core.$strip>>;
337
+ }, z.core.$strip>;
338
+ export type VersionPublisher = z.infer<typeof VersionPublisherSchema>;
264
339
  export declare const VersionSchema: z.ZodObject<{
265
340
  id: z.ZodString;
266
341
  ref: z.ZodNullable<z.ZodString>;
@@ -272,9 +347,9 @@ export declare const VersionSchema: z.ZodObject<{
272
347
  agent: "agent";
273
348
  api: "api";
274
349
  dashboard: "dashboard";
275
- direct_upload: "direct_upload";
276
350
  cli: "cli";
277
351
  git: "git";
352
+ direct_upload: "direct_upload";
278
353
  import: "import";
279
354
  variable_update: "variable_update";
280
355
  config_update: "config_update";
@@ -297,6 +372,22 @@ export declare const VersionSchema: z.ZodObject<{
297
372
  pullRequestNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
298
373
  }, z.core.$catchall<z.ZodUnknown>>>;
299
374
  }, z.core.$strip>>;
375
+ publisher: z.ZodNullable<z.ZodObject<{
376
+ type: z.ZodEnum<{
377
+ system: "system";
378
+ user: "user";
379
+ api_key: "api_key";
380
+ partner_token: "partner_token";
381
+ oauth_client: "oauth_client";
382
+ anonymous_claim: "anonymous_claim";
383
+ }>;
384
+ displayName: z.ZodString;
385
+ avatarUrl: z.ZodNullable<z.ZodString>;
386
+ authorizedBy: z.ZodNullable<z.ZodObject<{
387
+ displayName: z.ZodString;
388
+ avatarUrl: z.ZodNullable<z.ZodString>;
389
+ }, z.core.$strip>>;
390
+ }, z.core.$strip>>;
300
391
  status: z.ZodEnum<{
301
392
  failed: "failed";
302
393
  canceled: "canceled";
@@ -323,15 +414,15 @@ export declare const VersionSchema: z.ZodObject<{
323
414
  filesRemovedCount: z.ZodNumber;
324
415
  pendingUploads: z.ZodArray<z.ZodObject<{
325
416
  path: z.ZodString;
326
- size: z.ZodNumber;
327
- sha256: z.ZodOptional<z.ZodString>;
328
417
  sourceUrl: z.ZodOptional<z.ZodString>;
418
+ sha256: z.ZodOptional<z.ZodString>;
419
+ size: z.ZodNumber;
329
420
  }, z.core.$strip>>;
330
421
  skippedPaths: z.ZodArray<z.ZodString>;
331
422
  immutableUrl: z.ZodNullable<z.ZodString>;
332
423
  immutableUrlStatus: z.ZodNullable<z.ZodEnum<{
333
424
  ready: "ready";
334
- converging: "converging";
425
+ pending: "pending";
335
426
  }>>;
336
427
  isCurrentProduction: z.ZodBoolean;
337
428
  siteTitle: z.ZodString;
@@ -439,8 +530,8 @@ export declare const VersionSchema: z.ZodObject<{
439
530
  code: z.ZodString;
440
531
  severity: z.ZodEnum<{
441
532
  info: "info";
442
- error: "error";
443
533
  warning: "warning";
534
+ error: "error";
444
535
  }>;
445
536
  message: z.ZodString;
446
537
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -466,8 +557,8 @@ export declare const VersionSchema: z.ZodObject<{
466
557
  code: z.ZodString;
467
558
  severity: z.ZodEnum<{
468
559
  info: "info";
469
- error: "error";
470
560
  warning: "warning";
561
+ error: "error";
471
562
  }>;
472
563
  message: z.ZodString;
473
564
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { AsyncOperationSchema, baseDiagnosticSchema } from "./common.js";
3
- import { publishSourceKind, versionStatus, spaceDisabledReasonCode, spaceStatus } from "./enums.js";
3
+ import { publishSourceKind, tenantMode, versionStatus, spaceDisabledReasonCode, spaceStatus, VERSION_IN_FLIGHT_STATUSES, } from "./enums.js";
4
4
  import { pendingUploadSchema } from "./internal.js";
5
5
  import { spaceConfigSchema } from "./space-config.js";
6
6
  export const DiagnosticSchema = baseDiagnosticSchema.extend({
@@ -27,23 +27,97 @@ export const ChannelPointerSchema = z.object({
27
27
  export const spaceSettingsDigestSchema = z
28
28
  .string()
29
29
  .regex(/^[0-9a-f]{64}$/, "must be a 64-character lowercase hex sha256 digest");
30
+ // Where a space actually runs. Partner tenants reconcile placement and health
31
+ // against their own records, so this is the real handle set rather than a
32
+ // status word: the region it was placed in, the runtime instance serving it,
33
+ // the provider hostname that instance answers on, and one derived convergence
34
+ // state. Every handle is null until the space is placed.
35
+ export const spaceInfrastructureSchema = z.object({
36
+ region: z.string().nullable().describe("Concrete region the space's site was placed in."),
37
+ runtimeInstanceId: z.string().nullable().describe("Runtime instance serving this space."),
38
+ providerMainHostname: z
39
+ .string()
40
+ .nullable()
41
+ .describe("Primary hostname the provider answers on for this space's site."),
42
+ provisioningState: z
43
+ .enum(["provisioning", "converged", "degraded"])
44
+ .describe("Convergence of the space against its intended infrastructure: still being placed, matching intent, or failing to converge."),
45
+ });
46
+ /*
47
+ * Where a space's git remote is, and who owns it.
48
+ *
49
+ * The two cases are not the same offer. A Spacefast-hosted space hands out a
50
+ * remote you can push to, and pushing publishes. A space bound to a GitHub
51
+ * repository has GitHub as its source of truth: there is no remote to give out,
52
+ * because a direct push would be overwritten by the next sync. `managedBy` is
53
+ * the field a client branches on, so it never has to infer which world it is in
54
+ * from an absent one — `remoteUrl` is non-null exactly when it is `spacefast`,
55
+ * and `repository` exactly when it is `github`.
56
+ *
57
+ * Deliberately one flat object rather than a discriminated union: this schema
58
+ * is reachable from the Space resource and from every publish receipt, and a
59
+ * union here pushed the router's whole inferred type graph past TypeScript's
60
+ * instantiation-depth limit (api/structural-router.test.ts). The invariant that
61
+ * a union would have carried in the type is stated above and enforced by the
62
+ * one function that builds this block (push-new/space-git.ts).
63
+ *
64
+ * `remoteUrl` never carries a credential. Authentication is HTTP Basic with the
65
+ * username `t` and a space key or API key as the password, so the credential
66
+ * lives wherever that client already keeps it instead of being duplicated into
67
+ * a URL that lands in shell history and `git remote -v`.
68
+ */
69
+ export const spaceGitSchema = z.object({
70
+ managedBy: z
71
+ .enum(["spacefast", "github"])
72
+ .describe("Who owns this space's git history. `spacefast`: push `remoteUrl` to publish. `github`: the space deploys from `repository` and direct pushes are refused."),
73
+ remoteUrl: z
74
+ .string()
75
+ .nullable()
76
+ .describe("Credential-free git remote to push to, or null when `managedBy` is `github`. Authenticate as HTTP Basic user `t` with a space key or API key as the password."),
77
+ repository: z
78
+ .string()
79
+ .nullable()
80
+ .describe("`owner/name` of the GitHub repository this space deploys from, else null."),
81
+ defaultBranch: z
82
+ .string()
83
+ .nullable()
84
+ .describe("Branch that publishes to the live channel when pushed."),
85
+ });
86
+ // Every `CONSUMER_HIDDEN_SPACE_FIELDS` member below is `.optional()` because
87
+ // the consumer projection OMITS it rather than nulling it — absent means "not
88
+ // your surface", null means "nothing here yet", and the response validator has
89
+ // to accept both bodies from the one shared schema.
30
90
  export const SpaceSchema = z.object({
31
91
  id: z.string(),
32
- tenantId: z.string(),
92
+ tenantId: z.string().optional(),
93
+ // Derived from the owning tenant, never stored on the space: `test` for a
94
+ // space under a linked test tenant, `live` otherwise. A platform-surface
95
+ // field like `tenantId` — stripped from the consumer view.
96
+ mode: tenantMode
97
+ .optional()
98
+ .describe("`test` when the owning tenant is a linked test tenant, `live` otherwise."),
33
99
  // Raw provider identity of the site this space IS — deliberately not hidden
34
100
  // behind an abstraction, because a platform tenant provisioning under its own
35
101
  // WP.Cloud client needs the real handle to reconcile against. Both are
36
102
  // platform-surface fields (like `tenantId` and `principal`): the public API
37
103
  // reference strips them, the platform document keeps them. Null until the
38
104
  // space is placed.
39
- providerRef: z.string().nullable().describe("WP Cloud `atomic_site_id` serving this space."),
105
+ providerRef: z
106
+ .string()
107
+ .nullable()
108
+ .optional()
109
+ .describe("WP Cloud `atomic_site_id` serving this space."),
40
110
  providerClientId: z
41
111
  .string()
42
112
  .nullable()
113
+ .optional()
43
114
  .describe("WP Cloud client identity (`pvc_...`) the space's site is provisioned under."),
44
115
  teamId: z.string().nullable(),
45
116
  teamSlug: z.string().nullable(),
46
- principal: PrincipalRefSchema.nullable(),
117
+ principal: PrincipalRefSchema.nullable().optional(),
118
+ // Present only for callers holding `infrastructure:read` on the space's
119
+ // tenant; absent (not null) for everyone else.
120
+ infrastructure: spaceInfrastructureSchema.optional(),
47
121
  anonymous: z.boolean(),
48
122
  slug: z.string(),
49
123
  title: z.string(),
@@ -114,14 +188,56 @@ export const SpaceSchema = z.object({
114
188
  noindex: z
115
189
  .boolean()
116
190
  .describe("When true, the live production hostnames serve platform noindex directives. Immutable version and preview hostnames are always noindex regardless of this setting."),
191
+ pinnedAt: z
192
+ .string()
193
+ .datetime()
194
+ .nullable()
195
+ .describe("Instant the space was pinned to the top of its team's space list, or null when it is not pinned. The pin is team-wide: everyone who can see the team sees it."),
196
+ git: spaceGitSchema
197
+ .nullable()
198
+ .describe("Git remote for this space, or null when it has no repository yet. Push to `remoteUrl` to publish."),
117
199
  operation: AsyncOperationSchema.nullable(),
118
200
  createdAt: z.string().datetime(),
119
201
  updatedAt: z.string().datetime(),
120
202
  });
203
+ // The fields a consumer-class credential never sees on a Space. ONE source of
204
+ // truth: the response serializer omits exactly these for consumer callers, and
205
+ // the public API reference strips exactly these from the shared schemas. They
206
+ // are tenancy, on-behalf-of identity, and raw infrastructure — meaningful to a
207
+ // partner running spaces for its own customers, noise (or a leak) to everyone
208
+ // else.
209
+ //
210
+ // It lives below SpaceSchema so `satisfies` can pin every name to a real field:
211
+ // a typo, or a later rename on the schema, is a compile error here rather than
212
+ // a field that quietly stops being hidden.
213
+ export const CONSUMER_HIDDEN_SPACE_FIELDS = [
214
+ "tenantId",
215
+ "mode",
216
+ "principal",
217
+ "providerRef",
218
+ "providerClientId",
219
+ "infrastructure",
220
+ ];
121
221
  // PublishSource (the platform spec "PublishSource"): the single
122
222
  // provenance shape for how a version came to exist. Sent on publish/version
123
223
  // create and echoed on the Version resource. Structured CI/git detail beyond
124
224
  // the named fields rides in `metadata` (string values only).
225
+ // The git block of a PublishSource, exported on its own so servers echoing
226
+ // declared provenance can validate just this piece without reaching into the
227
+ // parent schema's internals.
228
+ export const publishSourceGitSchema = z
229
+ .object({
230
+ repository: z.string().nullable().optional(),
231
+ repositoryFullName: z.string().nullable().optional(),
232
+ repositoryUrl: z.string().nullable().optional(),
233
+ ref: z.string().nullable().optional(),
234
+ branch: z.string().nullable().optional(),
235
+ branchAliasUrl: z.string().nullable().optional(),
236
+ commit: z.string().nullable().optional(),
237
+ commitSha: z.string().nullable().optional(),
238
+ pullRequestNumber: z.number().nullable().optional(),
239
+ })
240
+ .catchall(z.unknown());
125
241
  export const PublishSourceSchema = z.object({
126
242
  kind: publishSourceKind.describe("How this version was produced."),
127
243
  client: z
@@ -144,20 +260,27 @@ export const PublishSourceSchema = z.object({
144
260
  .record(z.string(), z.string())
145
261
  .optional()
146
262
  .describe("Additional provenance (repository, CI run URL, workflow, actor, ...)."),
147
- git: z
148
- .object({
149
- repository: z.string().nullable().optional(),
150
- repositoryFullName: z.string().nullable().optional(),
151
- repositoryUrl: z.string().nullable().optional(),
152
- ref: z.string().nullable().optional(),
153
- branch: z.string().nullable().optional(),
154
- branchAliasUrl: z.string().nullable().optional(),
155
- commit: z.string().nullable().optional(),
156
- commitSha: z.string().nullable().optional(),
157
- pullRequestNumber: z.number().nullable().optional(),
158
- })
159
- .catchall(z.unknown())
160
- .optional(),
263
+ git: publishSourceGitSchema.optional(),
264
+ });
265
+ const VersionPublisherPersonSchema = z.object({
266
+ displayName: z.string().describe("The person's display name."),
267
+ avatarUrl: z
268
+ .string()
269
+ .nullable()
270
+ .describe("The person's avatar URL. The value is null when no avatar exists."),
271
+ });
272
+ export const VersionPublisherSchema = z.object({
273
+ type: z
274
+ .enum(["user", "api_key", "partner_token", "oauth_client", "anonymous_claim", "system"])
275
+ .describe("The type of actor that published the version."),
276
+ displayName: z
277
+ .string()
278
+ .describe("The display name of the person, agent, or system that published the version."),
279
+ avatarUrl: z
280
+ .string()
281
+ .nullable()
282
+ .describe("The publisher's avatar URL. The value is null when no avatar exists."),
283
+ authorizedBy: VersionPublisherPersonSchema.nullable().describe("The person who authorized the publisher. The value is null when the publisher is a person or has no known authorizer."),
161
284
  });
162
285
  export const VersionSchema = z.object({
163
286
  id: z.string(),
@@ -169,6 +292,7 @@ export const VersionSchema = z.object({
169
292
  number: z.number().int().positive().nullable(),
170
293
  spaceId: z.string(),
171
294
  source: PublishSourceSchema.nullable().describe("Publish provenance: who/what produced this version."),
295
+ publisher: VersionPublisherSchema.nullable().describe("The actor that published the version. The value is null for a legacy version with no attribution."),
172
296
  status: versionStatus,
173
297
  failureCode: z.string().nullable(),
174
298
  failureMessage: z.string().nullable(),
@@ -208,9 +332,9 @@ export const VersionSchema = z.object({
208
332
  .nullable()
209
333
  .describe("Permanent version URL (v{number}--{label}.view.fast form), computed once and stored at ready; survives slug changes, transfers, and channel repointing. Null before ready."),
210
334
  immutableUrlStatus: z
211
- .enum(["converging", "ready"])
335
+ .enum(["pending", "ready"])
212
336
  .nullable()
213
- .describe("Whether the immutable version URL provider alias has converged. converging means the URL may not resolve yet."),
337
+ .describe("Whether the immutable version URL is ready. pending means the URL might not resolve yet."),
214
338
  isCurrentProduction: z.boolean(),
215
339
  siteTitle: z.string(),
216
340
  config: spaceConfigSchema
@@ -228,7 +352,7 @@ export const VersionSchema = z.object({
228
352
  readyAt: z.string().datetime().nullable(),
229
353
  updatedAt: z.string().datetime(),
230
354
  });
231
- const activeVersionStatuses = new Set(["created", "uploading", "uploaded", "finalizing"]);
355
+ const activeVersionStatuses = new Set(VERSION_IN_FLIGHT_STATUSES);
232
356
  export function hasActiveVersionStatus(status) {
233
357
  return Boolean(status && activeVersionStatuses.has(status));
234
358
  }