@spacefast/common 0.0.24 → 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 (320) hide show
  1. package/brand-assets/LICENSE-Haskoy.txt +93 -0
  2. package/brand-assets/haskoy-latin-variable.woff2 +0 -0
  3. package/brand-assets/spacefast-favicon.svg +4 -4
  4. package/brand-assets/spacefast-sf-full-bleed.svg +3 -3
  5. package/brand-assets/spacefast-wordmark.svg +2 -4
  6. package/dist/agents/connect-targets.d.ts +6 -146
  7. package/dist/agents/connect-targets.js +63 -295
  8. package/dist/agents/private-key-oauth.d.ts +31 -2
  9. package/dist/agents/private-key-oauth.js +166 -92
  10. package/dist/agents/registry/core.d.ts +292 -0
  11. package/dist/agents/registry/core.js +1388 -0
  12. package/dist/agents/registry/deeplink-probes.d.ts +23 -0
  13. package/dist/agents/registry/deeplink-probes.js +18 -0
  14. package/dist/agents/registry/node.d.ts +56 -0
  15. package/dist/agents/registry/node.js +339 -0
  16. package/dist/brand-assets-build.js +3 -6
  17. package/dist/brand-assets.d.ts +5 -15
  18. package/dist/brand-assets.js +12 -14
  19. package/dist/brand.d.ts +17 -0
  20. package/dist/brand.js +24 -4
  21. package/dist/config/domains.d.ts +79 -12
  22. package/dist/config/domains.js +128 -29
  23. package/dist/config/index.js +1 -2
  24. package/dist/contracts/abuse.js +9 -24
  25. package/dist/contracts/access-profiles.d.ts +86 -0
  26. package/dist/contracts/access-profiles.js +89 -0
  27. package/dist/contracts/access.d.ts +24 -30
  28. package/dist/contracts/access.js +33 -64
  29. package/dist/contracts/activity.d.ts +18 -1
  30. package/dist/contracts/activity.js +72 -26
  31. package/dist/contracts/analytics.js +8 -10
  32. package/dist/contracts/api-keys.d.ts +77 -52
  33. package/dist/contracts/api-keys.js +44 -24
  34. package/dist/contracts/application-journal.d.ts +216 -0
  35. package/dist/contracts/application-journal.js +167 -0
  36. package/dist/contracts/auth.d.ts +90 -17
  37. package/dist/contracts/auth.js +86 -17
  38. package/dist/contracts/beta.d.ts +9 -4
  39. package/dist/contracts/beta.js +20 -16
  40. package/dist/contracts/billing.d.ts +2 -1
  41. package/dist/contracts/billing.js +37 -11
  42. package/dist/contracts/bootstrap.d.ts +791 -0
  43. package/dist/contracts/bootstrap.js +51 -0
  44. package/dist/contracts/builds.d.ts +209 -18
  45. package/dist/contracts/builds.js +93 -27
  46. package/dist/contracts/channels.d.ts +43 -0
  47. package/dist/contracts/channels.js +25 -9
  48. package/dist/contracts/cli.d.ts +7 -0
  49. package/dist/contracts/cli.js +6 -0
  50. package/dist/contracts/collab-public.d.ts +1 -1
  51. package/dist/contracts/collab-public.js +5 -8
  52. package/dist/contracts/comments.d.ts +44 -34
  53. package/dist/contracts/comments.js +107 -77
  54. package/dist/contracts/commerce.d.ts +165 -0
  55. package/dist/contracts/commerce.js +146 -0
  56. package/dist/contracts/common.d.ts +3 -3
  57. package/dist/contracts/common.js +20 -31
  58. package/dist/contracts/content-contract-verification.d.ts +521 -0
  59. package/dist/contracts/content-contract-verification.js +320 -0
  60. package/dist/contracts/content-platform-fixture.d.ts +1278 -0
  61. package/dist/contracts/content-platform-fixture.js +44 -0
  62. package/dist/contracts/content-program.d.ts +994 -0
  63. package/dist/contracts/content-program.js +658 -0
  64. package/dist/contracts/content-sync.d.ts +290 -0
  65. package/dist/contracts/content-sync.js +167 -0
  66. package/dist/contracts/content.d.ts +432 -0
  67. package/dist/contracts/content.js +303 -0
  68. package/dist/contracts/continuation.d.ts +17 -1
  69. package/dist/contracts/continuation.js +23 -23
  70. package/dist/contracts/countries.js +3 -4
  71. package/dist/contracts/crons.d.ts +52 -0
  72. package/dist/contracts/crons.js +60 -0
  73. package/dist/contracts/dashboard-prefs.d.ts +56 -0
  74. package/dist/contracts/dashboard-prefs.js +51 -0
  75. package/dist/contracts/device-auth.d.ts +234 -37
  76. package/dist/contracts/device-auth.js +267 -53
  77. package/dist/contracts/docs.d.ts +1 -5
  78. package/dist/contracts/docs.js +7 -15
  79. package/dist/contracts/domains.d.ts +501 -93
  80. package/dist/contracts/domains.js +193 -55
  81. package/dist/contracts/email-preferences.d.ts +3 -3
  82. package/dist/contracts/email-preferences.js +6 -7
  83. package/dist/contracts/enums.d.ts +27 -26
  84. package/dist/contracts/enums.js +68 -61
  85. package/dist/contracts/error-code-meta.d.ts +283 -7
  86. package/dist/contracts/error-code-meta.js +97 -5
  87. package/dist/contracts/error-codes.d.ts +5 -5
  88. package/dist/contracts/error-codes.js +82 -17
  89. package/dist/contracts/events.d.ts +100 -20
  90. package/dist/contracts/events.js +107 -20
  91. package/dist/contracts/execution.d.ts +48 -64
  92. package/dist/contracts/execution.js +52 -62
  93. package/dist/contracts/feature-lifecycle.d.ts +73 -27
  94. package/dist/contracts/feature-lifecycle.js +86 -26
  95. package/dist/contracts/features.d.ts +68 -19
  96. package/dist/contracts/features.js +42 -41
  97. package/dist/contracts/fixtures/content-platform-v1.json +1108 -0
  98. package/dist/contracts/frame-session.d.ts +192 -0
  99. package/dist/contracts/frame-session.js +164 -0
  100. package/dist/contracts/functions.d.ts +338 -164
  101. package/dist/contracts/functions.js +367 -198
  102. package/dist/contracts/git.d.ts +27 -33
  103. package/dist/contracts/git.js +10 -11
  104. package/dist/contracts/grant-copy.d.ts +43 -0
  105. package/dist/contracts/grant-copy.js +44 -0
  106. package/dist/contracts/grants.d.ts +62 -54
  107. package/dist/contracts/grants.js +124 -23
  108. package/dist/contracts/ids.d.ts +4 -1
  109. package/dist/contracts/ids.js +6 -3
  110. package/dist/contracts/internal.d.ts +8 -18
  111. package/dist/contracts/internal.js +13 -14
  112. package/dist/contracts/mcp.d.ts +28 -0
  113. package/dist/contracts/mcp.js +28 -0
  114. package/dist/contracts/me.d.ts +6 -1
  115. package/dist/contracts/me.js +12 -6
  116. package/dist/contracts/notifications.d.ts +27 -29
  117. package/dist/contracts/notifications.js +9 -4
  118. package/dist/contracts/oauth-resources.d.ts +112 -10
  119. package/dist/contracts/oauth-resources.js +116 -11
  120. package/dist/contracts/oauth-scope-actions.d.ts +90 -0
  121. package/dist/contracts/oauth-scope-actions.js +126 -0
  122. package/dist/contracts/operations.d.ts +27 -4
  123. package/dist/contracts/operations.js +12 -6
  124. package/dist/contracts/pages.d.ts +31 -7
  125. package/dist/contracts/pages.js +22 -5
  126. package/dist/contracts/partner-notifications.d.ts +3 -0
  127. package/dist/contracts/partner-notifications.js +65 -0
  128. package/dist/contracts/{platform.d.ts → partner.d.ts} +29 -42
  129. package/dist/contracts/{platform.js → partner.js} +27 -40
  130. package/dist/contracts/plan-policy.js +1 -1
  131. package/dist/contracts/principal-assertion.d.ts +43 -0
  132. package/dist/contracts/principal-assertion.js +67 -0
  133. package/dist/contracts/principals.d.ts +73 -0
  134. package/dist/contracts/principals.js +59 -0
  135. package/dist/contracts/privacy.d.ts +11 -0
  136. package/dist/contracts/privacy.js +17 -0
  137. package/dist/contracts/problem-document.js +3 -4
  138. package/dist/contracts/publish-archive.d.ts +269 -161
  139. package/dist/contracts/publish-archive.js +11 -1
  140. package/dist/contracts/push-new.d.ts +8 -8
  141. package/dist/contracts/quotas.js +5 -5
  142. package/dist/contracts/realtime.d.ts +52 -0
  143. package/dist/contracts/realtime.js +54 -0
  144. package/dist/contracts/repository-connections.d.ts +44 -31
  145. package/dist/contracts/repository-connections.js +17 -5
  146. package/dist/contracts/resources.d.ts +105 -14
  147. package/dist/contracts/resources.js +150 -26
  148. package/dist/contracts/route-inventory.d.ts +358 -0
  149. package/dist/contracts/route-inventory.js +141 -0
  150. package/dist/contracts/runtime-api.d.ts +206 -82
  151. package/dist/contracts/runtime-api.js +131 -70
  152. package/dist/contracts/runtime-app.d.ts +13 -23
  153. package/dist/contracts/runtime-app.js +39 -24
  154. package/dist/contracts/runtime-components.d.ts +143 -0
  155. package/dist/contracts/runtime-components.js +199 -0
  156. package/dist/contracts/runtime-db.d.ts +49 -23
  157. package/dist/contracts/runtime-db.js +87 -22
  158. package/dist/contracts/runtime-purge.d.ts +8 -0
  159. package/dist/contracts/runtime-purge.js +5 -0
  160. package/dist/contracts/runtime-services.d.ts +43 -75
  161. package/dist/contracts/runtime-services.js +29 -49
  162. package/dist/contracts/runtime-storage.d.ts +15 -14
  163. package/dist/contracts/runtime-storage.js +30 -14
  164. package/dist/contracts/sf-config-v1.d.ts +48 -14
  165. package/dist/contracts/slugs.js +13 -4
  166. package/dist/contracts/space-config.d.ts +283 -19
  167. package/dist/contracts/space-config.js +430 -80
  168. package/dist/contracts/spaces.d.ts +376 -290
  169. package/dist/contracts/spaces.js +200 -135
  170. package/dist/contracts/superadmin-activity.d.ts +3 -43
  171. package/dist/contracts/superadmin-activity.js +6 -30
  172. package/dist/contracts/superadmin-emails.d.ts +1 -0
  173. package/dist/contracts/superadmin-emails.js +17 -1
  174. package/dist/contracts/superadmin-runtime.d.ts +199 -0
  175. package/dist/contracts/superadmin-runtime.js +141 -0
  176. package/dist/contracts/superadmin-search.d.ts +22 -2
  177. package/dist/contracts/superadmin-search.js +14 -6
  178. package/dist/contracts/superadmin-spaces.d.ts +438 -189
  179. package/dist/contracts/superadmin-spaces.js +131 -25
  180. package/dist/contracts/superadmin-teams.d.ts +5 -2
  181. package/dist/contracts/superadmin-teams.js +1 -2
  182. package/dist/contracts/superadmin-tenants.d.ts +627 -12
  183. package/dist/contracts/superadmin-tenants.js +32 -13
  184. package/dist/contracts/superadmin.d.ts +232 -37
  185. package/dist/contracts/superadmin.js +106 -22
  186. package/dist/contracts/tags.d.ts +85 -58
  187. package/dist/contracts/tags.js +47 -37
  188. package/dist/contracts/teams.d.ts +86 -26
  189. package/dist/contracts/teams.js +90 -31
  190. package/dist/contracts/tenants.d.ts +135 -0
  191. package/dist/contracts/tenants.js +120 -0
  192. package/dist/contracts/test-triggers.d.ts +70 -0
  193. package/dist/contracts/test-triggers.js +116 -0
  194. package/dist/contracts/theme-json.js +3 -8
  195. package/dist/contracts/transfers.d.ts +1 -0
  196. package/dist/contracts/transfers.js +3 -2
  197. package/dist/contracts/usage.d.ts +209 -0
  198. package/dist/contracts/usage.js +124 -12
  199. package/dist/contracts/variables.d.ts +2 -2
  200. package/dist/contracts/variables.js +9 -13
  201. package/dist/contracts/webhooks.d.ts +13 -5
  202. package/dist/contracts/webhooks.js +3 -1
  203. package/dist/contracts/zero.d.ts +72 -81
  204. package/dist/contracts/zero.js +80 -78
  205. package/dist/dashboard-paths/index.d.ts +24 -21
  206. package/dist/dashboard-paths/index.js +35 -47
  207. package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -0
  208. package/dist/dashboard-paths/route-reservations.generated.js +36 -0
  209. package/dist/docs/agent-arrival.d.ts +92 -0
  210. package/dist/docs/agent-arrival.js +227 -0
  211. package/dist/docs/agent-output-policy.d.ts +6 -0
  212. package/dist/docs/agent-output-policy.js +22 -0
  213. package/dist/docs/agent-prose.d.ts +12 -18
  214. package/dist/docs/agent-prose.js +73 -51
  215. package/dist/docs/agent-setup.d.ts +72 -41
  216. package/dist/docs/agent-setup.js +339 -436
  217. package/dist/docs/catalog.d.ts +153 -95
  218. package/dist/docs/catalog.js +163 -48
  219. package/dist/docs/error-docs.d.ts +2098 -1
  220. package/dist/docs/error-docs.js +421 -144
  221. package/dist/docs/index-build.d.ts +0 -1
  222. package/dist/docs/index-build.js +2 -3
  223. package/dist/docs/page-context-prompt.d.ts +77 -0
  224. package/dist/docs/page-context-prompt.js +131 -0
  225. package/dist/docs/reference-urls.d.ts +46 -0
  226. package/dist/docs/reference-urls.js +79 -0
  227. package/dist/docs/search.d.ts +6 -8
  228. package/dist/docs/search.js +10 -13
  229. package/dist/docs/skill-distribution.d.ts +4 -1
  230. package/dist/docs/skill-distribution.js +10 -5
  231. package/dist/docs/skills.d.ts +120 -120
  232. package/dist/docs/skills.js +121 -73
  233. package/dist/docs/start-prompts.d.ts +45 -0
  234. package/dist/docs/start-prompts.js +62 -0
  235. package/dist/domain-exploration.js +9 -13
  236. package/dist/og-template.d.ts +56 -0
  237. package/dist/og-template.js +56 -0
  238. package/dist/slug-policy/index.js +5 -11
  239. package/dist/test-helpers/fetch-stub.js +1 -0
  240. package/dist/utils/browser-credential.d.ts +13 -6
  241. package/dist/utils/browser-credential.js +14 -7
  242. package/dist/utils/build-settings.d.ts +21 -1
  243. package/dist/utils/build-settings.js +133 -15
  244. package/dist/utils/canonical-json.d.ts +3 -5
  245. package/dist/utils/canonical-json.js +4 -5
  246. package/dist/utils/cast-transport.d.ts +5 -17
  247. package/dist/utils/cast-transport.js +6 -19
  248. package/dist/utils/claim-token.js +1 -2
  249. package/dist/utils/comment-avatars.js +4 -6
  250. package/dist/utils/concurrency.js +3 -3
  251. package/dist/utils/content-type.d.ts +7 -6
  252. package/dist/utils/content-type.js +73 -51
  253. package/dist/utils/credential-policy.d.ts +50 -6
  254. package/dist/utils/credential-policy.js +126 -59
  255. package/dist/utils/dns-instructions.js +9 -9
  256. package/dist/utils/egress-policy.fixtures.json +1 -1
  257. package/dist/utils/error-code.js +1 -0
  258. package/dist/utils/generate-space-name.d.ts +3 -8
  259. package/dist/utils/generate-space-name.js +3 -8
  260. package/dist/utils/grant-decision.fixtures.json +2 -2
  261. package/dist/utils/grants.d.ts +0 -1
  262. package/dist/utils/grants.js +7 -8
  263. package/dist/utils/gravatar.d.ts +2 -4
  264. package/dist/utils/gravatar.js +6 -12
  265. package/dist/utils/id-hints.js +14 -23
  266. package/dist/utils/idempotency.d.ts +3 -3
  267. package/dist/utils/idempotency.js +6 -7
  268. package/dist/utils/local-space-state.d.ts +23 -26
  269. package/dist/utils/local-space-state.js +46 -46
  270. package/dist/utils/oauth-signed-query.d.ts +3 -5
  271. package/dist/utils/oauth-signed-query.js +6 -9
  272. package/dist/utils/one-shot-replay.d.ts +7 -6
  273. package/dist/utils/one-shot-replay.js +3 -5
  274. package/dist/utils/page-colors.d.ts +15 -19
  275. package/dist/utils/page-colors.js +23 -45
  276. package/dist/utils/page-fonts.d.ts +1 -1
  277. package/dist/utils/page-fonts.js +8 -20
  278. package/dist/utils/page-preview.d.ts +0 -1
  279. package/dist/utils/page-preview.js +0 -1
  280. package/dist/utils/pages.d.ts +33 -3
  281. package/dist/utils/pages.js +83 -30
  282. package/dist/utils/privacy-regions.d.ts +19 -0
  283. package/dist/utils/privacy-regions.js +91 -0
  284. package/dist/utils/publish-form-data.d.ts +4 -5
  285. package/dist/utils/publish-form-data.js +2 -3
  286. package/dist/utils/publish-policy.d.ts +11 -17
  287. package/dist/utils/publish-policy.fixtures.json +11 -5
  288. package/dist/utils/publish-policy.js +65 -110
  289. package/dist/utils/query-client.d.ts +2 -0
  290. package/dist/utils/query-client.js +10 -1
  291. package/dist/utils/runtime-paths.d.ts +4 -4
  292. package/dist/utils/runtime-paths.js +6 -8
  293. package/dist/utils/runtime-upload.d.ts +9 -0
  294. package/dist/utils/runtime-upload.js +12 -0
  295. package/dist/utils/secure-local-file.d.ts +3 -3
  296. package/dist/utils/secure-local-file.js +23 -40
  297. package/dist/utils/space-config.d.ts +12 -15
  298. package/dist/utils/space-config.js +13 -16
  299. package/dist/utils/static-runtime-policy.d.ts +10 -7
  300. package/dist/utils/static-runtime-policy.fixtures.json +38 -41
  301. package/dist/utils/static-runtime-policy.generated.d.ts +16 -0
  302. package/dist/utils/static-runtime-policy.generated.js +70 -0
  303. package/dist/utils/static-runtime-policy.js +31 -132
  304. package/dist/utils/storage-policy.js +1 -2
  305. package/dist/utils/upload-session.d.ts +4 -1
  306. package/dist/utils/upload-session.js +41 -19
  307. package/dist/utils/version-path.js +11 -19
  308. package/dist/utils/wpcom-auth-redirects.d.ts +5 -14
  309. package/dist/utils/wpcom-auth-redirects.js +1 -4
  310. package/dist/vocabulary.d.ts +13 -13
  311. package/dist/vocabulary.js +52 -27
  312. package/package.json +15 -18
  313. package/dist/agents/client-registry.d.ts +0 -22
  314. package/dist/agents/client-registry.js +0 -41
  315. package/dist/docs/agent-handoff-document.d.ts +0 -15
  316. package/dist/docs/agent-handoff-document.js +0 -180
  317. package/dist/docs/agent-solutions.d.ts +0 -110
  318. package/dist/docs/agent-solutions.js +0 -183
  319. package/dist/utils/query-keys.d.ts +0 -84
  320. package/dist/utils/query-keys.js +0 -108
@@ -0,0 +1,51 @@
1
+ import { z } from "zod";
2
+ import { CursorPaginationSchema, ProblemDetailsSchema } from "./common.js";
3
+ import { meResponseSchema } from "./me.js";
4
+ import { SpaceSchema } from "./resources.js";
5
+ import { spaceRuntimeStatusSchema } from "./spaces.js";
6
+ import { TeamDetailSchema, TeamSummarySchema } from "./teams.js";
7
+ // `GET /v1/bootstrap`: the one-hop cold start. Every field here is an existing
8
+ // contract referenced by name — `me` is what `GET /v1/me` returns, `teams` is
9
+ // what `GET /v1/teams` returns, and so on — so a client can seed its per-resource
10
+ // caches from this payload without a second definition of anything.
11
+ export const bootstrapQuerySchema = z.object({
12
+ teamRef: z
13
+ .string()
14
+ .optional()
15
+ .describe("Team id or slug to resolve. It also scopes slug resolution for `spaceRef` and selects the team on the support boot payload. Present but blank is a request error, never `not_requested`."),
16
+ spaceRef: z
17
+ .string()
18
+ .optional()
19
+ .describe("Space reference: a `spc_` id, a hostname or URL, or a slug. Slugs resolve only within spaces you can already reach, so an unclaimed space is reachable by id or hostname only. Present but blank is a request error, never `not_requested`."),
20
+ });
21
+ // The per-slot problem: the RFC 9457 document minus `requestId` (the request has
22
+ // exactly one, and repeating it in every slot of a 200 body is noise).
23
+ // Everything else is byte-identical to the 4xx document, so the same error
24
+ // renderer works on a slot problem unchanged — there is no second taxonomy.
25
+ export const bootstrapProblemSchema = ProblemDetailsSchema.omit({ requestId: true }).describe("Why this slot did not resolve: the same problem document the dedicated endpoint would have returned, minus the request id carried by the response itself.");
26
+ /**
27
+ * A resolution slot. A caller reaches a value ONLY through `status: "resolved"`.
28
+ * This is deliberate: the dashboard's space read is route admission, and a bare
29
+ * `null` invites reading "could not resolve" as "nothing was asked for".
30
+ */
31
+ function bootstrapSlot(value, description) {
32
+ return z
33
+ .discriminatedUnion("status", [
34
+ z.object({ status: z.literal("resolved"), value }),
35
+ z.object({ status: z.literal("unresolved"), problem: bootstrapProblemSchema }),
36
+ z.object({ status: z.literal("not_requested") }),
37
+ ])
38
+ .describe(`${description}: the resolved value, the problem that stopped it, or not asked for.`);
39
+ }
40
+ export const bootstrapResponseSchema = z.object({
41
+ me: meResponseSchema
42
+ .nullable()
43
+ .describe("The authenticated identity, exactly as `GET /v1/me` returns it. Null only for a claim-token caller, which has no identity."),
44
+ teams: z
45
+ .array(TeamSummarySchema)
46
+ .describe("The teams this credential can act for, newest-first — the same set `GET /v1/teams` returns. Empty for a claim-token caller."),
47
+ teamsPagination: CursorPaginationSchema.describe("Paging for `teams`. `hasMore: true` means this credential reaches more teams than the boot payload carried; page the rest from `GET /v1/teams`."),
48
+ resolvedTeam: bootstrapSlot(TeamDetailSchema, "The team named by `teamRef`"),
49
+ resolvedSpace: bootstrapSlot(SpaceSchema, "The space named by `spaceRef`"),
50
+ spaceRuntime: bootstrapSlot(spaceRuntimeStatusSchema, "Serving status of the resolved space"),
51
+ });
@@ -1,4 +1,16 @@
1
1
  import { z } from "zod";
2
+ export declare const BuildSettingsOverrideSchema: z.ZodObject<{
3
+ rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4
+ installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
+ installCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
+ buildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ outputDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ ignoredBuildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
+ frameworkPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
+ platformPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodBoolean>;
12
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
13
+ }, z.core.$strip>;
2
14
  export declare const BuildSettingsSchema: z.ZodObject<{
3
15
  rootDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
4
16
  installDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -158,6 +170,37 @@ export declare const BuildSchema: z.ZodObject<{
158
170
  branch: z.ZodOptional<z.ZodString>;
159
171
  pullRequestNumber: z.ZodOptional<z.ZodNumber>;
160
172
  }, z.core.$strict>], "kind">;
173
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
174
+ kind: z.ZodEnum<{
175
+ build: "build";
176
+ agent: "agent";
177
+ api: "api";
178
+ dashboard: "dashboard";
179
+ cli: "cli";
180
+ git: "git";
181
+ direct_upload: "direct_upload";
182
+ import: "import";
183
+ variable_update: "variable_update";
184
+ config_update: "config_update";
185
+ }>;
186
+ client: z.ZodOptional<z.ZodString>;
187
+ branch: z.ZodOptional<z.ZodString>;
188
+ commit: z.ZodOptional<z.ZodString>;
189
+ message: z.ZodOptional<z.ZodString>;
190
+ dirty: z.ZodOptional<z.ZodBoolean>;
191
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
192
+ git: z.ZodOptional<z.ZodObject<{
193
+ repository: z.ZodOptional<z.ZodNullable<z.ZodString>>;
194
+ repositoryFullName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
195
+ repositoryUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
+ ref: z.ZodOptional<z.ZodNullable<z.ZodString>>;
197
+ branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
198
+ branchAliasUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
199
+ commit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
200
+ commitSha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
201
+ pullRequestNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
202
+ }, z.core.$catchall<z.ZodUnknown>>>;
203
+ }, z.core.$strip>>>;
161
204
  settingsSnapshot: z.ZodObject<{
162
205
  rootDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
163
206
  installDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -188,7 +231,7 @@ export declare const BuildSchema: z.ZodObject<{
188
231
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
189
232
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
190
233
  registrar: "registrar";
191
- wpcloud: "wpcloud";
234
+ infra: "infra";
192
235
  dns: "dns";
193
236
  runtime: "runtime";
194
237
  }>>>;
@@ -213,16 +256,85 @@ export declare const buildCreateRequestSchema: z.ZodObject<{
213
256
  pullRequestNumber: z.ZodOptional<z.ZodNumber>;
214
257
  }, z.core.$strip>], "kind">;
215
258
  settings: z.ZodOptional<z.ZodObject<{
216
- rootDirectory: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
217
- installDirectory: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
218
- installCommand: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
219
- buildCommand: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
220
- outputDirectory: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
221
- ignoredBuildCommand: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
222
- frameworkPreset: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
223
- platformPreset: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
224
- allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
225
- timeoutSeconds: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
259
+ rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
260
+ installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
261
+ installCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
262
+ buildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
263
+ outputDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
264
+ ignoredBuildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
265
+ frameworkPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
266
+ platformPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
267
+ allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodBoolean>;
268
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
269
+ }, z.core.$strip>>;
270
+ target: z.ZodOptional<z.ZodObject<{
271
+ channel: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
272
+ preview: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
273
+ }, z.core.$strip>>;
274
+ diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
275
+ code: z.ZodString;
276
+ severity: z.ZodEnum<{
277
+ info: "info";
278
+ warning: "warning";
279
+ error: "error";
280
+ }>;
281
+ message: z.ZodString;
282
+ path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
283
+ provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
284
+ registrar: "registrar";
285
+ infra: "infra";
286
+ dns: "dns";
287
+ runtime: "runtime";
288
+ }>>>;
289
+ details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
290
+ fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
291
+ retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
292
+ }, z.core.$strip>>>;
293
+ wait: z.ZodDefault<z.ZodBoolean>;
294
+ }, z.core.$strict>;
295
+ export declare const buildSourceSchema: z.ZodEnum<{
296
+ wordpress: "wordpress";
297
+ }>;
298
+ export declare const wordpressBuildTriggerRequestSchema: z.ZodObject<{
299
+ source: z.ZodLiteral<"wordpress">;
300
+ sourceUrl: z.ZodString;
301
+ }, z.core.$strict>;
302
+ /**
303
+ * `POST /v1/spaces/{spaceId}/builds` takes either a caller-described build or a
304
+ * named managed source. `source` is a real discriminator, not a plain union
305
+ * arm: zod routes the body to exactly one variant and reports the failure
306
+ * inside it, so a validation problem keeps its RFC 6901 pointer
307
+ * (`/input/kind`, `/sourceUrl`) instead of collapsing to a top-level
308
+ * `invalid_union` with nowhere to point. Both variants are strict, so a body
309
+ * carrying `source` alongside `input` is rejected rather than quietly read as
310
+ * a caller-described build.
311
+ */
312
+ export declare const spaceBuildCreateRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
313
+ source: z.ZodLiteral<"wordpress">;
314
+ sourceUrl: z.ZodString;
315
+ }, z.core.$strict>, z.ZodObject<{
316
+ input: z.ZodDiscriminatedUnion<[z.ZodObject<{
317
+ kind: z.ZodLiteral<"archive">;
318
+ sourceMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
319
+ }, z.core.$strict>, z.ZodObject<{
320
+ kind: z.ZodLiteral<"repository">;
321
+ repositoryConnectionId: z.ZodString;
322
+ ref: z.ZodOptional<z.ZodString>;
323
+ commit: z.ZodOptional<z.ZodString>;
324
+ branch: z.ZodOptional<z.ZodString>;
325
+ pullRequestNumber: z.ZodOptional<z.ZodNumber>;
326
+ }, z.core.$strip>], "kind">;
327
+ settings: z.ZodOptional<z.ZodObject<{
328
+ rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
329
+ installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
330
+ installCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
331
+ buildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
332
+ outputDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
333
+ ignoredBuildCommand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
334
+ frameworkPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
335
+ platformPreset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
336
+ allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodBoolean>;
337
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
226
338
  }, z.core.$strip>>;
227
339
  target: z.ZodOptional<z.ZodObject<{
228
340
  channel: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
@@ -239,7 +351,7 @@ export declare const buildCreateRequestSchema: z.ZodObject<{
239
351
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
240
352
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
241
353
  registrar: "registrar";
242
- wpcloud: "wpcloud";
354
+ infra: "infra";
243
355
  dns: "dns";
244
356
  runtime: "runtime";
245
357
  }>>>;
@@ -248,6 +360,18 @@ export declare const buildCreateRequestSchema: z.ZodObject<{
248
360
  retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
249
361
  }, z.core.$strip>>>;
250
362
  wait: z.ZodDefault<z.ZodBoolean>;
363
+ source: z.ZodOptional<z.ZodUndefined>;
364
+ }, z.core.$strict>], "source">;
365
+ export declare const buildPreflightQuerySchema: z.ZodObject<{
366
+ source: z.ZodEnum<{
367
+ wordpress: "wordpress";
368
+ }>;
369
+ sourceUrl: z.ZodString;
370
+ }, z.core.$strict>;
371
+ export declare const buildPreflightResponseSchema: z.ZodObject<{
372
+ data: z.ZodObject<{
373
+ ready: z.ZodLiteral<true>;
374
+ }, z.core.$strict>;
251
375
  }, z.core.$strip>;
252
376
  export declare const buildSourceArchiveUploadSchema: z.ZodObject<{
253
377
  id: z.ZodString;
@@ -279,7 +403,8 @@ export declare const buildSourceArchiveUploadSchema: z.ZodObject<{
279
403
  contentType: z.ZodOptional<z.ZodString>;
280
404
  }, z.core.$strip>>>;
281
405
  links: z.ZodObject<{
282
- resume: z.ZodString;
406
+ refresh: z.ZodString;
407
+ resume: z.ZodOptional<z.ZodString>;
283
408
  finalize: z.ZodString;
284
409
  }, z.core.$strip>;
285
410
  details: z.ZodOptional<z.ZodObject<{
@@ -302,7 +427,7 @@ export declare const buildSourceArchiveUploadSchema: z.ZodObject<{
302
427
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
303
428
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
304
429
  registrar: "registrar";
305
- wpcloud: "wpcloud";
430
+ infra: "infra";
306
431
  dns: "dns";
307
432
  runtime: "runtime";
308
433
  }>>>;
@@ -336,6 +461,37 @@ export declare const buildCreateResponseSchema: z.ZodObject<{
336
461
  branch: z.ZodOptional<z.ZodString>;
337
462
  pullRequestNumber: z.ZodOptional<z.ZodNumber>;
338
463
  }, z.core.$strict>], "kind">;
464
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
465
+ kind: z.ZodEnum<{
466
+ build: "build";
467
+ agent: "agent";
468
+ api: "api";
469
+ dashboard: "dashboard";
470
+ cli: "cli";
471
+ git: "git";
472
+ direct_upload: "direct_upload";
473
+ import: "import";
474
+ variable_update: "variable_update";
475
+ config_update: "config_update";
476
+ }>;
477
+ client: z.ZodOptional<z.ZodString>;
478
+ branch: z.ZodOptional<z.ZodString>;
479
+ commit: z.ZodOptional<z.ZodString>;
480
+ message: z.ZodOptional<z.ZodString>;
481
+ dirty: z.ZodOptional<z.ZodBoolean>;
482
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
483
+ git: z.ZodOptional<z.ZodObject<{
484
+ repository: z.ZodOptional<z.ZodNullable<z.ZodString>>;
485
+ repositoryFullName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
486
+ repositoryUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
487
+ ref: z.ZodOptional<z.ZodNullable<z.ZodString>>;
488
+ branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
489
+ branchAliasUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
490
+ commit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
491
+ commitSha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
492
+ pullRequestNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
493
+ }, z.core.$catchall<z.ZodUnknown>>>;
494
+ }, z.core.$strip>>>;
339
495
  settingsSnapshot: z.ZodObject<{
340
496
  rootDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
341
497
  installDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -366,7 +522,7 @@ export declare const buildCreateResponseSchema: z.ZodObject<{
366
522
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
367
523
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
368
524
  registrar: "registrar";
369
- wpcloud: "wpcloud";
525
+ infra: "infra";
370
526
  dns: "dns";
371
527
  runtime: "runtime";
372
528
  }>>>;
@@ -408,7 +564,8 @@ export declare const buildCreateResponseSchema: z.ZodObject<{
408
564
  contentType: z.ZodOptional<z.ZodString>;
409
565
  }, z.core.$strip>>>;
410
566
  links: z.ZodObject<{
411
- resume: z.ZodString;
567
+ refresh: z.ZodString;
568
+ resume: z.ZodOptional<z.ZodString>;
412
569
  finalize: z.ZodString;
413
570
  }, z.core.$strip>;
414
571
  details: z.ZodOptional<z.ZodObject<{
@@ -431,7 +588,7 @@ export declare const buildCreateResponseSchema: z.ZodObject<{
431
588
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
432
589
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
433
590
  registrar: "registrar";
434
- wpcloud: "wpcloud";
591
+ infra: "infra";
435
592
  dns: "dns";
436
593
  runtime: "runtime";
437
594
  }>>>;
@@ -470,6 +627,37 @@ export declare const buildListResponseSchema: z.ZodObject<{
470
627
  branch: z.ZodOptional<z.ZodString>;
471
628
  pullRequestNumber: z.ZodOptional<z.ZodNumber>;
472
629
  }, z.core.$strict>], "kind">;
630
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
631
+ kind: z.ZodEnum<{
632
+ build: "build";
633
+ agent: "agent";
634
+ api: "api";
635
+ dashboard: "dashboard";
636
+ cli: "cli";
637
+ git: "git";
638
+ direct_upload: "direct_upload";
639
+ import: "import";
640
+ variable_update: "variable_update";
641
+ config_update: "config_update";
642
+ }>;
643
+ client: z.ZodOptional<z.ZodString>;
644
+ branch: z.ZodOptional<z.ZodString>;
645
+ commit: z.ZodOptional<z.ZodString>;
646
+ message: z.ZodOptional<z.ZodString>;
647
+ dirty: z.ZodOptional<z.ZodBoolean>;
648
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
649
+ git: z.ZodOptional<z.ZodObject<{
650
+ repository: z.ZodOptional<z.ZodNullable<z.ZodString>>;
651
+ repositoryFullName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
652
+ repositoryUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
653
+ ref: z.ZodOptional<z.ZodNullable<z.ZodString>>;
654
+ branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
655
+ branchAliasUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
656
+ commit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
657
+ commitSha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
658
+ pullRequestNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
659
+ }, z.core.$catchall<z.ZodUnknown>>>;
660
+ }, z.core.$strip>>>;
473
661
  settingsSnapshot: z.ZodObject<{
474
662
  rootDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
475
663
  installDirectory: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -500,7 +688,7 @@ export declare const buildListResponseSchema: z.ZodObject<{
500
688
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
501
689
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
502
690
  registrar: "registrar";
503
- wpcloud: "wpcloud";
691
+ infra: "infra";
504
692
  dns: "dns";
505
693
  runtime: "runtime";
506
694
  }>>>;
@@ -546,4 +734,7 @@ export type InternalBuildExecutionLaunch = z.infer<typeof buildExecutionLaunchSc
546
734
  export type InternalBuildExecutionSupervision = z.infer<typeof buildExecutionSupervisionSchema>;
547
735
  export type BuildCreateRequest = z.infer<typeof buildCreateRequestSchema>;
548
736
  export type BuildCreateResponse = z.infer<typeof buildCreateResponseSchema>;
737
+ export type WordPressBuildTriggerRequest = z.infer<typeof wordpressBuildTriggerRequestSchema>;
738
+ export type SpaceBuildCreateRequest = z.infer<typeof spaceBuildCreateRequestSchema>;
739
+ export type BuildPreflightQuery = z.infer<typeof buildPreflightQuerySchema>;
549
740
  export {};
@@ -2,18 +2,34 @@ import { z } from "zod";
2
2
  import { CursorPaginationSchema, baseDiagnosticSchema, cursorListQuerySchema, dataEnvelope, } from "./common.js";
3
3
  import { buildStatus } from "./enums.js";
4
4
  import { uploadInstructionsSchema } from "./internal.js";
5
+ import { PublishSourceSchema } from "./resources.js";
6
+ import { wordpressDataSourceUrlSchema } from "./space-config.js";
5
7
  import { versionLogEntrySchema } from "./spaces.js";
6
8
  const nullableCommandSchema = z.string().trim().min(1).nullable();
7
- const buildTimeoutSecondsSchema = z.number().int().min(60).max(7200).default(900);
9
+ const buildTimeoutSecondsSchema = z.number().int().min(60).max(7200);
8
10
  const scpStyleGitRemotePattern = /^[^@\s/:]+@[^:\s]+:[^\s]+$/;
9
11
  const gitCloneUrlSchema = z
10
12
  .string()
11
13
  .trim()
12
14
  .min(1)
13
15
  .refine((value) => scpStyleGitRemotePattern.test(value) || z.string().url().safeParse(value).success, "Clone URL must be a URL or scp-style Git remote.");
14
- // Build (`bld_`, internal-docs/platform.md "Build"): a first-class resource with
16
+ // Build (`bld_`, the platform spec "Build"): a first-class resource with
15
17
  // its own table; ids are opaque and NEVER derived from version ids. The runner
16
18
  // mints the produced version through the normal finalize path.
19
+ export const BuildSettingsOverrideSchema = z
20
+ .object({
21
+ rootDirectory: nullableCommandSchema.optional(),
22
+ installDirectory: nullableCommandSchema.optional(),
23
+ installCommand: nullableCommandSchema.optional(),
24
+ buildCommand: nullableCommandSchema.optional(),
25
+ outputDirectory: nullableCommandSchema.optional(),
26
+ ignoredBuildCommand: nullableCommandSchema.optional(),
27
+ frameworkPreset: nullableCommandSchema.optional(),
28
+ platformPreset: nullableCommandSchema.optional(),
29
+ allowUnsupportedPlatformFeatures: z.boolean().optional(),
30
+ timeoutSeconds: buildTimeoutSecondsSchema.optional(),
31
+ })
32
+ .describe("Sparse per-request build setting overrides applied over saved settings.");
17
33
  export const BuildSettingsSchema = z
18
34
  .object({
19
35
  rootDirectory: nullableCommandSchema.default(null),
@@ -25,7 +41,7 @@ export const BuildSettingsSchema = z
25
41
  frameworkPreset: nullableCommandSchema.default(null),
26
42
  platformPreset: nullableCommandSchema.default(null),
27
43
  allowUnsupportedPlatformFeatures: z.boolean().default(false),
28
- timeoutSeconds: buildTimeoutSecondsSchema,
44
+ timeoutSeconds: buildTimeoutSecondsSchema.default(900),
29
45
  })
30
46
  .describe("Resolved build settings. Builds persist this as an immutable `settingsSnapshot`.");
31
47
  export const BuildTargetSchema = z
@@ -40,8 +56,6 @@ export const BuildTargetSchema = z
40
56
  preview: z.boolean().default(false).describe("Whether the build targets preview behavior."),
41
57
  })
42
58
  .describe("Where a successful build should publish or run in preview mode.");
43
- // Shared by InternalBuildSourceSchema and InternalBuildInputSchema: both carry
44
- // this exact archive-source member in their `kind` discriminated union.
45
59
  const internalArchiveBuildSourceSchema = z.object({
46
60
  kind: z.literal("archive").describe("Build from an uploaded source archive."),
47
61
  uploadId: z.string().optional().describe("Upload session (`upl_`) carrying the archive."),
@@ -67,11 +81,7 @@ const internalArchiveBuildSourceSchema = z.object({
67
81
  compressedBytes: z.number().int().nonnegative().optional(),
68
82
  expandedBytes: z.number().int().nonnegative().optional(),
69
83
  fileCount: z.number().int().nonnegative().optional(),
70
- expiresAt: z
71
- .string()
72
- .datetime()
73
- .optional()
74
- .describe("Server-enforced upload expiry while the archive is waiting for upload."),
84
+ expiresAt: z.string().datetime().optional().describe("Server-enforced upload expiry."),
75
85
  });
76
86
  const InternalBuildSourceSchema = z
77
87
  .discriminatedUnion("kind", [
@@ -142,7 +152,7 @@ export const BuildCreateInputSchema = z
142
152
  sourceMetadata: z
143
153
  .record(z.string(), z.unknown())
144
154
  .optional()
145
- .describe("Optional source provenance for the produced version."),
155
+ .describe("Source provenance for the produced version."),
146
156
  })
147
157
  .strict(),
148
158
  z.object({
@@ -155,10 +165,9 @@ export const BuildCreateInputSchema = z
155
165
  }),
156
166
  ])
157
167
  .describe("What a new build should run against.");
158
- // One phase-timeline entry the build runner appends via recordBuildPhase
159
- // (apps/control-plane/src/builds/runner.ts BUILD_PHASES); `phase` stays a
160
- // plain string here since the runner's specific phase vocabulary is an
161
- // app-level concern, not a shared contract.
168
+ // One phase-timeline entry the runner appends via recordBuildPhase
169
+ // (apps/control-plane/src/builds/runner.ts BUILD_PHASES). `phase` stays a plain
170
+ // string: the runner's phase vocabulary is app-level, not a shared contract.
162
171
  const buildExecutionPhaseSchema = z.object({
163
172
  phase: z.string().min(1).describe("Build phase name. See `BUILD_PHASES` in `builds/runner.ts`."),
164
173
  at: z.string().datetime(),
@@ -197,12 +206,15 @@ const InternalBuildExecutionSchema = z
197
206
  .optional()
198
207
  .describe("Phase timeline that the runner appends to with `recordBuildPhase`."),
199
208
  })
200
- .describe("Internal runner execution metadata surfaced only where appropriate.");
209
+ .describe("Internal runner execution metadata. Not part of the public Build resource.");
201
210
  export const BuildSchema = z.object({
202
211
  id: z.string().describe("Build id (`bld_`); opaque and never derived from a version id."),
203
212
  spaceId: z.string().describe("Space (`spc_`) the build produces a version for."),
204
213
  status: buildStatus.describe("Build lifecycle status."),
205
214
  input: PublicBuildInputSchema,
215
+ source: PublishSourceSchema.nullable()
216
+ .default(null)
217
+ .describe("Publish provenance as declared at build start (client, git ref data, publish message). Present on failed and running builds too; the produced version's `source` is the authoritative copy once one exists. Null when nothing was declared."),
206
218
  settingsSnapshot: BuildSettingsSchema,
207
219
  target: BuildTargetSchema,
208
220
  retryOfBuildId: z
@@ -224,18 +236,73 @@ export const BuildSchema = z.object({
224
236
  startedAt: z.string().datetime().nullable().describe("When the runner picked the build up."),
225
237
  finishedAt: z.string().datetime().nullable().describe("When the build reached a terminal state."),
226
238
  });
227
- export const buildCreateRequestSchema = z.object({
239
+ export const buildCreateRequestSchema = z
240
+ .object({
228
241
  input: BuildCreateInputSchema,
229
- settings: BuildSettingsSchema.partial()
230
- .optional()
231
- .describe("Per-run settings overrides, persisted as `settingsSnapshot` after resolution."),
242
+ settings: BuildSettingsOverrideSchema.optional().describe("Per-run settings overrides, persisted as `settingsSnapshot` after resolution."),
232
243
  target: BuildTargetSchema.partial().optional(),
233
244
  diagnostics: z
234
245
  .array(baseDiagnosticSchema)
235
246
  .optional()
236
- .describe("Optional diagnostics already known before the build is queued."),
247
+ .describe("Diagnostics already known before the build is queued."),
237
248
  wait: z.boolean().default(false),
238
- });
249
+ })
250
+ // Strict so a typo is a validation failure instead of a silently dropped
251
+ // field, and so a body that names a managed `source` can never be read as a
252
+ // caller-described build.
253
+ .strict();
254
+ // A build source is a named way of deciding what to build. `wordpress` reads
255
+ // the Space's configured WordPress source and its connected production
256
+ // repository, so the caller names the source and nothing else — no input,
257
+ // commands, settings, refs, or targets.
258
+ //
259
+ // It is an enum of one, and adding a second value is not a one-line edit: each
260
+ // source owns a request variant in the create union, a resolver that finds its
261
+ // repository, and its own preflight branch. The enum is how a caller names a
262
+ // source, not an extension point.
263
+ export const buildSourceSchema = z
264
+ .enum(["wordpress"])
265
+ .describe("Managed build source that decides what to build on the caller's behalf. `wordpress` is the only one.");
266
+ export const wordpressBuildTriggerRequestSchema = z
267
+ .object({
268
+ source: z.literal("wordpress").describe("Build the Space's configured WordPress source."),
269
+ sourceUrl: wordpressDataSourceUrlSchema.describe("Configured WordPress URL that changed, as stored in the Space's data sources."),
270
+ })
271
+ .strict()
272
+ .describe("Trigger a production build for a Space's configured WordPress source.");
273
+ /**
274
+ * `POST /v1/spaces/{spaceId}/builds` takes either a caller-described build or a
275
+ * named managed source. `source` is a real discriminator, not a plain union
276
+ * arm: zod routes the body to exactly one variant and reports the failure
277
+ * inside it, so a validation problem keeps its RFC 6901 pointer
278
+ * (`/input/kind`, `/sourceUrl`) instead of collapsing to a top-level
279
+ * `invalid_union` with nowhere to point. Both variants are strict, so a body
280
+ * carrying `source` alongside `input` is rejected rather than quietly read as
281
+ * a caller-described build.
282
+ */
283
+ export const spaceBuildCreateRequestSchema = z
284
+ .discriminatedUnion("source", [
285
+ wordpressBuildTriggerRequestSchema,
286
+ buildCreateRequestSchema.extend({
287
+ source: z
288
+ .undefined()
289
+ .optional()
290
+ .meta({ description: "Omit `source` to describe the build yourself." }),
291
+ }),
292
+ ])
293
+ .describe("A caller-described build, or a build triggered from a managed source.");
294
+ export const buildPreflightQuerySchema = z
295
+ .object({
296
+ source: buildSourceSchema,
297
+ sourceUrl: wordpressDataSourceUrlSchema.describe("Configured WordPress URL to check, as stored in the Space's data sources."),
298
+ })
299
+ .strict()
300
+ .describe("Which managed source to check before triggering builds from it.");
301
+ export const buildPreflightResponseSchema = dataEnvelope(z
302
+ .object({
303
+ ready: z.literal(true).describe("The source can trigger production builds right now."),
304
+ })
305
+ .strict());
239
306
  export const buildSourceArchiveUploadSchema = uploadInstructionsSchema;
240
307
  export const buildCreateResponseSchema = dataEnvelope(z.object({
241
308
  build: BuildSchema,
@@ -252,17 +319,16 @@ export const buildLogListResponseSchema = z.object({
252
319
  data: z.array(versionLogEntrySchema),
253
320
  pagination: CursorPaginationSchema,
254
321
  });
255
- // Branch-to-channel integration config (spec "Lifecycle model": "branch-to-
256
- // channel mapping rules live on the Space as integration config"). Launch only
257
- // supports `live`; keep the stored config aligned with publish/finalize until
258
- // named channels ship.
322
+ // Branch-to-channel integration config (spec "Lifecycle model": mapping rules
323
+ // live on the Space as integration config). Launch only supports `live`; keep
324
+ // the stored config aligned with publish/finalize until named channels ship.
259
325
  export const spaceBuildIntegrationSchema = z
260
326
  .object({
261
327
  branchChannels: z
262
328
  .record(z.string().min(1).describe("Git branch or ref name."), z.literal("live").describe("Channel the branch's builds promote to."))
263
329
  .describe("Exact branch or ref name to channel name, for example `{ main: 'live' }`."),
264
330
  })
265
- .describe("Per-space build integration config that defines where repository builds promote.");
331
+ .describe("Per-space build integration config: where repository builds promote.");
266
332
  /** Channel a repository build promotes to, or null when the ref is unmapped (default channel applies). */
267
333
  export function resolveBuildChannel(integration, ref) {
268
334
  return integration?.branchChannels[ref] ?? null;