@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
@@ -1,23 +1,30 @@
1
1
  import { z } from "zod";
2
2
  import { CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
3
  import { planCodeSchema, planLimitValueSchema } from "./features.js";
4
+ import { systemPresentationSchema } from "./space-config.js";
5
+ import { ManifestStatusSchema } from "./tenants.js";
4
6
  export const TEAM_ROLE_VALUES = ["owner", "admin", "member"];
5
7
  export const teamMemberRole = z.enum(TEAM_ROLE_VALUES);
6
8
  /**
7
- * Better Auth stores the member role as free text, so every surface that reads
8
- * it back has to land on the same canonical value. Unknown roles carry no
9
- * privilege, so they read as the least-privileged one.
9
+ * Better Auth stores the member role as free text. Unknown roles carry no
10
+ * privilege, so they read as `member`.
10
11
  */
11
12
  export function normalizeTeamMemberRole(role) {
12
13
  const parsed = teamMemberRole.safeParse(role ?? "member");
13
14
  return parsed.success ? parsed.data : "member";
14
15
  }
16
+ // An invitation is its own resource under `/v1/team-invitations`, so the team
17
+ // it belongs to travels in the body (create) or the query (list) instead of a
18
+ // path segment.
15
19
  export const teamInvitationCreateSchema = z.object({
20
+ teamId: z.string().trim().min(1).describe("The team to invite this person to."),
16
21
  email: z.string().trim().email().toLowerCase(),
17
22
  role: teamMemberRole.default("member"),
18
23
  });
19
24
  export const teamMemberListQuerySchema = cursorListQuerySchema;
20
- export const teamInvitationListQuerySchema = cursorListQuerySchema;
25
+ export const teamInvitationListQuerySchema = cursorListQuerySchema.extend({
26
+ teamId: z.string().trim().min(1).describe("The team whose invitations to list."),
27
+ });
21
28
  export const teamListQuerySchema = cursorListQuerySchema;
22
29
  export const teamSpaceListQuerySchema = cursorListQuerySchema;
23
30
  export const TeamMemberUserSchema = z.object({
@@ -26,10 +33,9 @@ export const TeamMemberUserSchema = z.object({
26
33
  email: z.string().email().describe("The member's email address."),
27
34
  image: z.string().nullable().describe("Avatar URL, or null when the user has none."),
28
35
  });
29
- // The one membership shape: every surface that shows or edits a team member
30
- // (dashboard, superadmin, CLI, MCP) types from this. Better Auth's
31
- // organization plugin owns the underlying rows, but its plugin-inferred types
32
- // never cross an app boundary.
36
+ // The one membership shape every surface types from. Better Auth's organization
37
+ // plugin owns the underlying rows; its inferred types never cross an app
38
+ // boundary.
33
39
  export const TeamMemberSchema = z.object({
34
40
  id: z.string().describe("The membership id, stable for the life of the membership."),
35
41
  teamId: z.string().describe("The team this membership belongs to."),
@@ -41,16 +47,40 @@ export const TeamMemberSchema = z.object({
41
47
  export const teamMemberRoleUpdateSchema = z.object({
42
48
  role: teamMemberRole.describe("The role to grant this member."),
43
49
  });
50
+ /**
51
+ * The one invitation status vocabulary, shared by the collection and the by-id
52
+ * read. Better Auth's organization plugin owns the stored column and writes
53
+ * `pending | accepted | rejected | canceled`; `expired` is derived, because a
54
+ * still-pending invitation past `expiresAt` can never be accepted and no writer
55
+ * ever rewrites the row.
56
+ */
57
+ export const teamInvitationStatus = z.enum([
58
+ "pending",
59
+ "accepted",
60
+ "rejected",
61
+ "canceled",
62
+ "expired",
63
+ ]);
64
+ /**
65
+ * The stored column is free text over a closed domain. An unrecognized value is
66
+ * not something a recipient may act on, so it fails closed to `canceled` —
67
+ * never `pending` (which would offer a dead link) and never `accepted` (which
68
+ * would claim a membership nobody holds).
69
+ */
70
+ export function normalizeTeamInvitationStatus(status) {
71
+ const parsed = teamInvitationStatus.safeParse(status);
72
+ return parsed.success ? parsed.data : "canceled";
73
+ }
44
74
  export const TeamInvitationSchema = z.object({
45
75
  id: z.string(),
46
76
  teamId: z.string(),
47
77
  email: z.string().email(),
48
78
  role: teamMemberRole,
49
- status: z.string(),
79
+ status: teamInvitationStatus,
50
80
  expiresAt: z.string().datetime(),
51
81
  createdAt: z.string().datetime(),
52
82
  });
53
- // Team (internal-docs/platform.md "Team"): Better Auth team in the main
83
+ // Team (the platform spec "Team"): Better Auth team in the main
54
84
  // tenant, carrying the resolved plan and default data location.
55
85
  export const teamPlanCode = planCodeSchema;
56
86
  export const TeamSummarySchema = z.object({
@@ -73,6 +103,14 @@ export const TeamDetailSchema = TeamSummarySchema.extend({
73
103
  .string()
74
104
  .nullable()
75
105
  .describe("Stripe customer id linked to this team; null until billing is initialized."),
106
+ systemSpaceId: z
107
+ .string()
108
+ .nullable()
109
+ .describe("The space that supplies this team's page, theme, and presentation defaults."),
110
+ manifestStatus: ManifestStatusSchema.describe("The status of the restricted manifest from the team's system space."),
111
+ presentation: systemPresentationSchema
112
+ .nullable()
113
+ .describe("The presentation from the team's system space, or null when no value is active."),
76
114
  });
77
115
  export const teamListResponseSchema = z.object({
78
116
  data: z.array(TeamSummarySchema),
@@ -89,14 +127,14 @@ export const teamJoinResponseSchema = z.object({
89
127
  role: z.literal("member"),
90
128
  }),
91
129
  });
92
- // Accepting an invitation is by its id (the opaque token carried in the accept
93
- // email link and returned by the invitations list/preview endpoints).
94
- export const teamInvitationAcceptSchema = z.object({
130
+ // Every by-id invitation door read, accept, resend, revoke is addressed by
131
+ // the opaque token carried in the invite link.
132
+ export const teamInvitationParamsSchema = z.object({
95
133
  invitationId: z
96
134
  .string()
97
135
  .trim()
98
136
  .min(1)
99
- .describe("The invitation id to accept (the token from the invite link)."),
137
+ .describe("The invitation id (the token from the invite link)."),
100
138
  });
101
139
  export const teamInvitationAcceptResponseSchema = z.object({
102
140
  data: z.object({
@@ -112,8 +150,7 @@ export const teamInvitationListResponseSchema = z.object({
112
150
  });
113
151
  // Team activity is served by `GET /v1/teams/{teamId}/activity`, a facade over
114
152
  // the one activity store using the ActivityEvent contract (contracts/activity.ts).
115
- // `defaultDataLocation` is the spec Team field: "auto" lets placement decide,
116
- // any other value must be an available placement region id.
153
+ // Any value other than "auto" must be an available placement region id.
117
154
  export const teamDataLocationSchema = z
118
155
  .string()
119
156
  .trim()
@@ -123,22 +160,21 @@ export const teamDataLocationSchema = z
123
160
  export const teamSettingsUpdateSchema = z.object({
124
161
  defaultDataLocation: teamDataLocationSchema,
125
162
  });
126
- const wpCloudCapabilityOptionSchema = z.object({
163
+ const infraCapabilityOptionSchema = z.object({
127
164
  id: z.string(),
128
165
  label: z.string(),
129
166
  });
130
- // Served by `GET /v1/teams/{teamId}/settings` (and echoed by the PATCH):
131
- // the default data location plus the placement options it may take.
167
+ // Served by `GET /v1/teams/{teamId}/settings`, and echoed by the PATCH.
132
168
  export const teamSettingsResponseSchema = z.object({
133
169
  teamId: z.string().describe("The team id the settings belong to."),
134
170
  defaultDataLocation: teamDataLocationSchema,
135
171
  regionOptions: z
136
- .array(wpCloudCapabilityOptionSchema)
172
+ .array(infraCapabilityOptionSchema)
137
173
  .describe("Placement regions currently available for new spaces."),
138
- wpCloudCapabilities: z
174
+ infraCapabilities: z
139
175
  .object({
140
- datacenters: z.array(wpCloudCapabilityOptionSchema),
141
- phpVersions: z.array(wpCloudCapabilityOptionSchema),
176
+ datacenters: z.array(infraCapabilityOptionSchema),
177
+ phpVersion: z.literal("8.5"),
142
178
  })
143
179
  .describe("Live capabilities for the team's infra provider account."),
144
180
  });
@@ -153,7 +189,7 @@ export const teamUsageResponseSchema = z.object({
153
189
  members: z.number().int().describe("Team members."),
154
190
  storageBytes: z
155
191
  .number()
156
- .describe("Disk actually occupied across the team's spaces, as measured by the serving infrastructure. Nothing is deduplicated: a file present in two spaces sits on two disks and counts twice."),
192
+ .describe("Disk occupied across the team's spaces, as measured by the serving infrastructure. Nothing is deduplicated: a file present in two spaces sits on two disks and counts twice."),
157
193
  storageQuotaBytes: z
158
194
  .union([z.number(), z.literal("unlimited")])
159
195
  .describe('Plan storage quota; "unlimited" when unbounded.'),
@@ -161,7 +197,7 @@ export const teamUsageResponseSchema = z.object({
161
197
  storageCalculatedAt: z
162
198
  .string()
163
199
  .nullable()
164
- .describe("How far back the weakest measurement behind this total reaches. Null when the team's storage has not been measured yet. This is a lagging meter expect it to trail the present by about an hour."),
200
+ .describe("How far back the weakest measurement behind this total reaches. Null when the team's storage has not been measured yet. The meter lags the present by about an hour."),
165
201
  buildsDeploysThisMonth: z
166
202
  .number()
167
203
  .int()
@@ -180,17 +216,21 @@ export const teamUsageResponseSchema = z.object({
180
216
  title: z.string().describe("Space display title."),
181
217
  storageBytes: z
182
218
  .number()
183
- .describe("Disk this space occupies, as measured by the infrastructure serving it. Zero for a space that has not been measured yet."),
219
+ .describe("Disk this space occupies, as measured by the infrastructure serving it. Zero until the space has been measured."),
184
220
  }))
185
221
  .describe("Per-space storage breakdown for spaces the caller can read."),
186
222
  });
187
- // Served by `GET /v1/teams/invitations/{invitationId}/preview`: the unauthenticated
188
- // invite landing view (email is masked, never the full address).
189
- export const teamInvitationPreviewSchema = z.object({
223
+ // Served by `GET /v1/team-invitations/{invitationId}`: the unauthenticated
224
+ // invite landing view. Same field names and same status vocabulary as the
225
+ // collection item; the address is masked and the team name is carried so the
226
+ // page can render before sign-in.
227
+ export const teamInvitationDetailSchema = z.object({
190
228
  id: z.string().describe("Invitation id."),
191
229
  teamName: z.string().describe("Inviting team's display name."),
192
- invitedEmail: z.string().describe("Masked invited email address."),
193
- status: z.enum(["pending", "expired", "closed"]).describe("Whether the invite can be accepted."),
230
+ email: z
231
+ .string()
232
+ .describe("The invited address, masked (`ja****@example.com`); never the full address."),
233
+ status: teamInvitationStatus.describe("Current state of the invitation. Only `pending` can be accepted."),
194
234
  expiresAt: z.string().describe("Instant when the invitation expires."),
195
235
  });
196
236
  export const teamCreateSchema = z.object({
@@ -219,6 +259,25 @@ export const teamUpdateSchema = z
219
259
  logo: z.string().trim().max(2048).nullable().optional(),
220
260
  metadata: z.string().nullable().optional(),
221
261
  defaultDataLocation: teamDataLocationSchema.optional(),
262
+ systemSpaceId: z
263
+ .string()
264
+ .nullable()
265
+ .optional()
266
+ .describe("Set the team's system space. Use null to clear the current system space."),
267
+ baseSystemSpaceId: z
268
+ .string()
269
+ .nullable()
270
+ .optional()
271
+ .describe("The current system-space id that the caller expects. The update fails if this value is stale."),
272
+ })
273
+ .superRefine((value, ctx) => {
274
+ if (value.baseSystemSpaceId !== undefined && value.systemSpaceId === undefined) {
275
+ ctx.addIssue({
276
+ code: "custom",
277
+ message: "baseSystemSpaceId requires systemSpaceId.",
278
+ path: ["baseSystemSpaceId"],
279
+ });
280
+ }
222
281
  })
223
282
  .refine((value) => Object.keys(value).length > 0, {
224
283
  message: "At least one team field is required.",
@@ -0,0 +1,135 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * One manifest key's materialization status, as it surfaces on the tenant
4
+ * self-view. This is a projection, not the stored blob: the reconcile records a
5
+ * `declared` snapshot per item, but that (and any ownership proof inside it) is
6
+ * NEVER serialized to a partner surface — the self-view carries only where each
7
+ * key landed, not what was declared.
8
+ */
9
+ export declare const ManifestStatusItemSchema: z.ZodObject<{
10
+ key: z.ZodString;
11
+ state: z.ZodEnum<{
12
+ active: "active";
13
+ failed: "failed";
14
+ pending: "pending";
15
+ }>;
16
+ detail: z.ZodOptional<z.ZodString>;
17
+ since: z.ZodString;
18
+ audience: z.ZodOptional<z.ZodString>;
19
+ }, z.core.$strip>;
20
+ export type ManifestStatusItem = z.infer<typeof ManifestStatusItemSchema>;
21
+ /**
22
+ * The materialization status of the tenant's system-space manifest: one item per
23
+ * declared key, plus the live version they were all converged from. Empty items
24
+ * with a null `sourceVersionId` means nothing is materialized (no designated
25
+ * system space, no live version, or an empty manifest).
26
+ */
27
+ export declare const ManifestStatusSchema: z.ZodObject<{
28
+ items: z.ZodArray<z.ZodObject<{
29
+ key: z.ZodString;
30
+ state: z.ZodEnum<{
31
+ active: "active";
32
+ failed: "failed";
33
+ pending: "pending";
34
+ }>;
35
+ detail: z.ZodOptional<z.ZodString>;
36
+ since: z.ZodString;
37
+ audience: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>>;
39
+ sourceVersionId: z.ZodNullable<z.ZodString>;
40
+ }, z.core.$strip>;
41
+ export type ManifestStatus = z.infer<typeof ManifestStatusSchema>;
42
+ /**
43
+ * A tenant's view of itself.
44
+ *
45
+ * Deliberately a self-view and not a tenant directory: a credential is rooted
46
+ * at exactly one tenant, so the only tenant it can read is its own. There is no
47
+ * list, and asking for another tenant's id is a refusal rather than an empty
48
+ * result.
49
+ *
50
+ * `provisioning.mode` is derived, not stored: a tenant whose sites run under
51
+ * its own provider client is `byo`, everything else is `managed`. That means
52
+ * the answer follows the actual account wiring instead of a flag someone has to
53
+ * remember to flip.
54
+ */
55
+ export declare const TenantSelfSchema: z.ZodObject<{
56
+ id: z.ZodString;
57
+ kind: z.ZodEnum<{
58
+ internal: "internal";
59
+ main: "main";
60
+ partner: "partner";
61
+ }>;
62
+ mode: z.ZodEnum<{
63
+ live: "live";
64
+ test: "test";
65
+ }>;
66
+ status: z.ZodEnum<{
67
+ active: "active";
68
+ past_due: "past_due";
69
+ suspended: "suspended";
70
+ deleted: "deleted";
71
+ }>;
72
+ name: z.ZodString;
73
+ defaultRegion: z.ZodNullable<z.ZodString>;
74
+ provisioning: z.ZodObject<{
75
+ mode: z.ZodEnum<{
76
+ managed: "managed";
77
+ byo: "byo";
78
+ }>;
79
+ providerClientId: z.ZodNullable<z.ZodString>;
80
+ }, z.core.$strip>;
81
+ systemSpaceId: z.ZodNullable<z.ZodString>;
82
+ manifestStatus: z.ZodObject<{
83
+ items: z.ZodArray<z.ZodObject<{
84
+ key: z.ZodString;
85
+ state: z.ZodEnum<{
86
+ active: "active";
87
+ failed: "failed";
88
+ pending: "pending";
89
+ }>;
90
+ detail: z.ZodOptional<z.ZodString>;
91
+ since: z.ZodString;
92
+ audience: z.ZodOptional<z.ZodString>;
93
+ }, z.core.$strip>>;
94
+ sourceVersionId: z.ZodNullable<z.ZodString>;
95
+ }, z.core.$strip>;
96
+ presentation: z.ZodNullable<z.ZodObject<{
97
+ name: z.ZodOptional<z.ZodString>;
98
+ logo: z.ZodOptional<z.ZodString>;
99
+ supportUrl: z.ZodOptional<z.ZodString>;
100
+ claimOrigin: z.ZodOptional<z.ZodString>;
101
+ accessHandoffOrigin: z.ZodOptional<z.ZodString>;
102
+ problemDocsBaseUrl: z.ZodOptional<z.ZodString>;
103
+ contacts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
104
+ }, z.core.$strict>>;
105
+ createdAt: z.ZodString;
106
+ updatedAt: z.ZodString;
107
+ }, z.core.$strip>;
108
+ export type TenantSelf = z.infer<typeof TenantSelfSchema>;
109
+ /**
110
+ * Compare-and-swap on the system space, house style: send the value you believe
111
+ * is current as `baseSystemSpaceId` and the write is rejected with a conflict
112
+ * if it has moved under you. Omit it to write unconditionally. This mirrors
113
+ * `baseSettingsDigest` on spaces — the CAS token rides in the body, not in an
114
+ * `If-Match` header.
115
+ */
116
+ export declare const tenantPatchSchema: z.ZodObject<{
117
+ systemSpaceId: z.ZodNullable<z.ZodString>;
118
+ baseSystemSpaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
119
+ }, z.core.$strip>;
120
+ export type TenantPatch = z.infer<typeof tenantPatchSchema>;
121
+ export declare const TenantParamsSchema: z.ZodObject<{
122
+ tenantId: z.ZodString;
123
+ }, z.core.$strip>;
124
+ /**
125
+ * Promote the linked test tenant's system-space configuration onto this (live)
126
+ * tenant. An explicit export/copy, never a mode flip: the test tenant's
127
+ * system-space manifest (minus its token issuers, which each mode declares
128
+ * distinctly) is carried onto the live tenant's designated system space and
129
+ * reconciled with fresh ids and fresh verification. Test data stays test.
130
+ *
131
+ * No parameters today; the body is reserved for future promotion options
132
+ * (a subset of keys to promote, a dry-run, a CAS token).
133
+ */
134
+ export declare const tenantPromoteSchema: z.ZodObject<{}, z.core.$strip>;
135
+ export type TenantPromote = z.infer<typeof tenantPromoteSchema>;
@@ -0,0 +1,120 @@
1
+ import { z } from "zod";
2
+ import { tenantKind, tenantMode, tenantStatus } from "./enums.js";
3
+ import { systemPresentationSchema } from "./space-config.js";
4
+ /**
5
+ * One manifest key's materialization status, as it surfaces on the tenant
6
+ * self-view. This is a projection, not the stored blob: the reconcile records a
7
+ * `declared` snapshot per item, but that (and any ownership proof inside it) is
8
+ * NEVER serialized to a partner surface — the self-view carries only where each
9
+ * key landed, not what was declared.
10
+ */
11
+ export const ManifestStatusItemSchema = z.object({
12
+ key: z.string().describe("The manifest key this item materializes."),
13
+ state: z
14
+ .enum(["pending", "active", "failed"])
15
+ .describe("Where the last reconcile landed this key."),
16
+ detail: z
17
+ .string()
18
+ .optional()
19
+ .describe("Human-readable reason, present when the state warrants one (typically `failed`)."),
20
+ since: z
21
+ .string()
22
+ .datetime()
23
+ .describe("When this key last CHANGED state — stable across no-op re-runs, so it reads as `<state> since …`."),
24
+ audience: z
25
+ .string()
26
+ .optional()
27
+ .describe("`tokenIssuers` only: the server-minted opaque audience for the issuer this key materialized. Not a secret — it rides in every partner token's `aud` claim and is verified server-side — and the partner needs it to sign the activation proof and to mint tokens, so it is served here rather than handed over out of band."),
28
+ });
29
+ /**
30
+ * The materialization status of the tenant's system-space manifest: one item per
31
+ * declared key, plus the live version they were all converged from. Empty items
32
+ * with a null `sourceVersionId` means nothing is materialized (no designated
33
+ * system space, no live version, or an empty manifest).
34
+ */
35
+ export const ManifestStatusSchema = z.object({
36
+ items: z.array(ManifestStatusItemSchema).describe("Per-key materialization status."),
37
+ sourceVersionId: z
38
+ .string()
39
+ .nullable()
40
+ .describe("The system space's live version every item was converged from, or null when nothing is materialized."),
41
+ });
42
+ /**
43
+ * A tenant's view of itself.
44
+ *
45
+ * Deliberately a self-view and not a tenant directory: a credential is rooted
46
+ * at exactly one tenant, so the only tenant it can read is its own. There is no
47
+ * list, and asking for another tenant's id is a refusal rather than an empty
48
+ * result.
49
+ *
50
+ * `provisioning.mode` is derived, not stored: a tenant whose sites run under
51
+ * its own provider client is `byo`, everything else is `managed`. That means
52
+ * the answer follows the actual account wiring instead of a flag someone has to
53
+ * remember to flip.
54
+ */
55
+ export const TenantSelfSchema = z.object({
56
+ id: z.string().describe("Tenant id."),
57
+ kind: tenantKind.describe("Tenant class."),
58
+ mode: tenantMode.describe("`test` for a linked test tenant (a sandbox twin), `live` otherwise. Distinct from `provisioning.mode`."),
59
+ status: tenantStatus.describe("Whether the tenant is active, past due, suspended, or deleted."),
60
+ name: z.string().describe("Human-readable tenant name."),
61
+ defaultRegion: z
62
+ .string()
63
+ .nullable()
64
+ .describe("Region new spaces are placed in unless one is requested; null means auto."),
65
+ provisioning: z
66
+ .object({
67
+ mode: z
68
+ .enum(["managed", "byo"])
69
+ .describe("`byo` when the tenant's sites run under its own provider client, `managed` when they run under ours."),
70
+ providerClientId: z
71
+ .string()
72
+ .nullable()
73
+ .describe("The tenant's own provider client (`pvc_`), when it has one."),
74
+ })
75
+ .describe("How this tenant's infrastructure is accounted for."),
76
+ systemSpaceId: z
77
+ .string()
78
+ .nullable()
79
+ .describe("Space designated as this tenant's own system surface (its dashboard, portal, or control page). Must be a space this tenant owns."),
80
+ manifestStatus: ManifestStatusSchema.describe("Materialization status of the system-space manifest, reconciled from that space's live version."),
81
+ presentation: systemPresentationSchema
82
+ .nullable()
83
+ .describe("The partner-facing branding and links currently materialized from the system-space manifest, or null when none is materialized."),
84
+ createdAt: z.string().datetime(),
85
+ updatedAt: z.string().datetime(),
86
+ });
87
+ /**
88
+ * Compare-and-swap on the system space, house style: send the value you believe
89
+ * is current as `baseSystemSpaceId` and the write is rejected with a conflict
90
+ * if it has moved under you. Omit it to write unconditionally. This mirrors
91
+ * `baseSettingsDigest` on spaces — the CAS token rides in the body, not in an
92
+ * `If-Match` header.
93
+ */
94
+ export const tenantPatchSchema = z.object({
95
+ systemSpaceId: z
96
+ .string()
97
+ .nullable()
98
+ .describe("Space to designate as the tenant's system surface, or null to clear it."),
99
+ baseSystemSpaceId: z
100
+ .string()
101
+ .nullable()
102
+ .optional()
103
+ .describe("The systemSpaceId the caller believes is current. When supplied and stale, the write is rejected instead of applied."),
104
+ });
105
+ export const TenantParamsSchema = z.object({
106
+ tenantId: z.string().min(1).describe("Tenant id. Must be the credential's own tenant."),
107
+ });
108
+ /**
109
+ * Promote the linked test tenant's system-space configuration onto this (live)
110
+ * tenant. An explicit export/copy, never a mode flip: the test tenant's
111
+ * system-space manifest (minus its token issuers, which each mode declares
112
+ * distinctly) is carried onto the live tenant's designated system space and
113
+ * reconciled with fresh ids and fresh verification. Test data stays test.
114
+ *
115
+ * No parameters today; the body is reserved for future promotion options
116
+ * (a subset of keys to promote, a dry-run, a CAS token).
117
+ */
118
+ export const tenantPromoteSchema = z
119
+ .object({})
120
+ .describe("Promotion request. No parameters yet; reserved for future options.");
@@ -0,0 +1,70 @@
1
+ import { z } from "zod";
2
+ import type { TenantMode } from "./enums.js";
3
+ export declare const testTriggerValues: readonly ["build_failure", "domain_verification_pending", "domain_verification_failed", "tls_failure", "rate_limit", "webhook_retry", "principal_suspension", "usage_correction"];
4
+ export declare const testTrigger: z.ZodEnum<{
5
+ rate_limit: "rate_limit";
6
+ build_failure: "build_failure";
7
+ domain_verification_pending: "domain_verification_pending";
8
+ domain_verification_failed: "domain_verification_failed";
9
+ tls_failure: "tls_failure";
10
+ webhook_retry: "webhook_retry";
11
+ principal_suspension: "principal_suspension";
12
+ usage_correction: "usage_correction";
13
+ }>;
14
+ export type TestTrigger = z.infer<typeof testTrigger>;
15
+ /**
16
+ * Every trigger, in one record: the reserved token, the input that carries it,
17
+ * and what a test tenant gets instead of success.
18
+ *
19
+ * `carrier` and `effect` are contract text, not commentary — the partner API
20
+ * document renders its trigger table straight from them, so a renamed token or
21
+ * a new trigger cannot leave the published contract describing something else.
22
+ *
23
+ * No token is a substring of another, so a plain `includes` scan is unambiguous.
24
+ * Keep them lowercase — the detector lowercases the input, and every carrier (a
25
+ * DNS label, a slug, a principal id) is compared case-insensitively.
26
+ */
27
+ export declare const TEST_TRIGGER_META: {
28
+ readonly build_failure: {
29
+ readonly sentinel: "sf-sim-build-fail";
30
+ readonly carrier: "space slug";
31
+ readonly effect: "the space's next build fails";
32
+ };
33
+ readonly domain_verification_pending: {
34
+ readonly sentinel: "sf-sim-domain-pending";
35
+ readonly carrier: "custom domain name";
36
+ readonly effect: "domain verification stays pending";
37
+ };
38
+ readonly domain_verification_failed: {
39
+ readonly sentinel: "sf-sim-domain-fail";
40
+ readonly carrier: "custom domain name";
41
+ readonly effect: "domain verification fails";
42
+ };
43
+ readonly tls_failure: {
44
+ readonly sentinel: "sf-sim-tls-fail";
45
+ readonly carrier: "custom domain name";
46
+ readonly effect: "certificate issuance fails";
47
+ };
48
+ readonly rate_limit: {
49
+ readonly sentinel: "sf-sim-rate-limit";
50
+ readonly carrier: "space slug (on create)";
51
+ readonly effect: "the create returns 429 `rate_limited`";
52
+ };
53
+ readonly webhook_retry: {
54
+ readonly sentinel: "sf-sim-webhook-retry";
55
+ readonly carrier: "webhook URL";
56
+ readonly effect: "delivery fails and enters the retry schedule";
57
+ };
58
+ readonly principal_suspension: {
59
+ readonly sentinel: "sf-sim-suspend";
60
+ readonly carrier: "external principal id";
61
+ readonly effect: "the principal is suspended";
62
+ };
63
+ readonly usage_correction: {
64
+ readonly sentinel: "sf-sim-usage-correction";
65
+ readonly carrier: "space slug";
66
+ readonly effect: "the next settled usage sample appends a linked correction";
67
+ };
68
+ };
69
+ export declare function detectTestTrigger(input: string | null | undefined): TestTrigger | null;
70
+ export declare function resolveTestTrigger(mode: TenantMode | string | null | undefined, input: string | null | undefined): TestTrigger | null;