@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
@@ -4,22 +4,20 @@ export declare const SPACE_ACCESS_PRESETS: readonly ["private", "team", "public"
4
4
  export declare const ACCESS_HANDOFF_MEDIA_TYPE = "application/vnd.spacefast.access-handoff+json";
5
5
  export declare const spaceAccessPresetSchema: z.ZodEnum<{
6
6
  team: "team";
7
- public: "public";
8
7
  private: "private";
8
+ public: "public";
9
9
  }>;
10
10
  export type SpaceAccessPreset = z.infer<typeof spaceAccessPresetSchema>;
11
11
  /**
12
12
  * The sharing vocabulary. Capabilities are the ground truth; a role is a named
13
- * set of them, ordered from least to most. This is the only role enum and the
14
- * only role⇄capability mapping in the product every surface (dashboard, CLI,
15
- * API, comments) names access with these four words and derives capabilities
16
- * here rather than keeping its own preset list.
13
+ * set of them, ordered from least to most. This is the product's only role enum
14
+ * and role⇄capability mapping: every surface derives its capabilities here.
17
15
  */
18
16
  export declare const ACCESS_ROLES: readonly ["viewer", "commenter", "editor", "manager"];
19
17
  export declare const accessRoleSchema: z.ZodEnum<{
18
+ editor: "editor";
20
19
  viewer: "viewer";
21
20
  commenter: "commenter";
22
- editor: "editor";
23
21
  manager: "manager";
24
22
  }>;
25
23
  export type AccessRole = z.infer<typeof accessRoleSchema>;
@@ -31,15 +29,13 @@ export declare const ACCESS_ROLE_CAPABILITIES: {
31
29
  };
32
30
  export declare function accessRoleCapabilities(role: AccessRole): GrantCapability[];
33
31
  /**
34
- * The role a capability set amounts to, named by the strongest capability it
35
- * carries. A Grant assembled capability-by-capability need not match a role
36
- * exactly; this reports the role it reaches, never more.
32
+ * The role a capability set amounts to: the strongest role it reaches, never
33
+ * more. A Grant assembled capability-by-capability need not match one exactly.
37
34
  */
38
35
  export declare function accessRoleForCapabilities(capabilities: readonly GrantCapability[]): AccessRole;
39
36
  /**
40
- * Roles a credential-backed audience can carry. A Link or a password is a
41
- * secret anyone can forward, so it never publishes and never manages access —
42
- * the same boundary `grantSchema` enforces on the capabilities themselves.
37
+ * Roles a forwardable secret (a Link, a password) can carry. It never publishes
38
+ * and never manages access; `grantSchema` enforces that on capabilities too.
43
39
  */
44
40
  export declare const VISITOR_ACCESS_ROLES: readonly ["viewer", "commenter"];
45
41
  export type VisitorAccessRole = (typeof VISITOR_ACCESS_ROLES)[number];
@@ -70,18 +66,17 @@ export declare function accountPrincipal(userId: string): AccountPrincipal;
70
66
  /** The user id behind an account principal; null for anonymous or malformed. */
71
67
  export declare function accountPrincipalUserId(principal: string | undefined | null): string | null;
72
68
  /**
73
- * The identity an authority reference names on its own, if any. Credential
74
- * classes name nobody. This is the ONE place a class maps to an identity: at
75
- * the exchange that just authenticated it, never downstream.
69
+ * The identity an authority reference names on its own, if any. The ONE place a
70
+ * class maps to an identity: at the exchange that authenticated it, never after.
76
71
  */
77
72
  export declare function principalForAuthority(reference: AuthorityReference): IdentifiedPrincipal | undefined;
78
73
  export declare const personGrantSchema: z.ZodObject<{
79
74
  id: z.ZodString;
80
75
  scope: z.ZodString;
81
76
  role: z.ZodEnum<{
77
+ editor: "editor";
82
78
  viewer: "viewer";
83
79
  commenter: "commenter";
84
- editor: "editor";
85
80
  manager: "manager";
86
81
  }>;
87
82
  target: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -120,9 +115,9 @@ export declare const spacePersonSchema: z.ZodObject<{
120
115
  id: z.ZodString;
121
116
  scope: z.ZodString;
122
117
  role: z.ZodEnum<{
118
+ editor: "editor";
123
119
  viewer: "viewer";
124
120
  commenter: "commenter";
125
- editor: "editor";
126
121
  manager: "manager";
127
122
  }>;
128
123
  target: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -175,9 +170,9 @@ export declare const spacePeopleListSchema: z.ZodObject<{
175
170
  id: z.ZodString;
176
171
  scope: z.ZodString;
177
172
  role: z.ZodEnum<{
173
+ editor: "editor";
178
174
  viewer: "viewer";
179
175
  commenter: "commenter";
180
- editor: "editor";
181
176
  manager: "manager";
182
177
  }>;
183
178
  target: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -373,9 +368,9 @@ export declare const canonicalAccessRequestStatusSchema: z.ZodEnum<{
373
368
  denied: "denied";
374
369
  }>;
375
370
  export declare const accessRequestRoleSchema: z.ZodEnum<{
371
+ editor: "editor";
376
372
  viewer: "viewer";
377
373
  commenter: "commenter";
378
- editor: "editor";
379
374
  manager: "manager";
380
375
  }>;
381
376
  export type AccessRequestRole = z.infer<typeof accessRequestRoleSchema>;
@@ -386,9 +381,9 @@ export declare const canonicalAccessRequestSchema: z.ZodObject<{
386
381
  email: z.ZodString;
387
382
  scope: z.ZodString;
388
383
  requestedRole: z.ZodEnum<{
384
+ editor: "editor";
389
385
  viewer: "viewer";
390
386
  commenter: "commenter";
391
- editor: "editor";
392
387
  manager: "manager";
393
388
  }>;
394
389
  message: z.ZodNullable<z.ZodString>;
@@ -424,9 +419,9 @@ export type LinkCapabilities = z.infer<typeof linkCapabilitiesSchema>;
424
419
  export declare const personGrantWriteSchema: z.ZodObject<{
425
420
  scope: z.ZodString;
426
421
  role: z.ZodEnum<{
422
+ editor: "editor";
427
423
  viewer: "viewer";
428
424
  commenter: "commenter";
429
- editor: "editor";
430
425
  manager: "manager";
431
426
  }>;
432
427
  target: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -446,9 +441,9 @@ export declare const spacePersonInviteWriteSchema: z.ZodObject<{
446
441
  grants: z.ZodArray<z.ZodObject<{
447
442
  scope: z.ZodString;
448
443
  role: z.ZodEnum<{
444
+ editor: "editor";
449
445
  viewer: "viewer";
450
446
  commenter: "commenter";
451
- editor: "editor";
452
447
  manager: "manager";
453
448
  }>;
454
449
  target: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -469,9 +464,9 @@ export declare const spacePersonGrantSetWriteSchema: z.ZodObject<{
469
464
  grants: z.ZodArray<z.ZodObject<{
470
465
  scope: z.ZodString;
471
466
  role: z.ZodEnum<{
467
+ editor: "editor";
472
468
  viewer: "viewer";
473
469
  commenter: "commenter";
474
- editor: "editor";
475
470
  manager: "manager";
476
471
  }>;
477
472
  target: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -564,9 +559,9 @@ export declare const canonicalAccessRequestCreateSchema: z.ZodObject<{
564
559
  email: z.ZodString;
565
560
  scope: z.ZodString;
566
561
  requestedRole: z.ZodDefault<z.ZodEnum<{
562
+ editor: "editor";
567
563
  viewer: "viewer";
568
564
  commenter: "commenter";
569
- editor: "editor";
570
565
  manager: "manager";
571
566
  }>>;
572
567
  message: z.ZodOptional<z.ZodString>;
@@ -574,9 +569,9 @@ export declare const canonicalAccessRequestCreateSchema: z.ZodObject<{
574
569
  export declare const canonicalAccessRequestApproveSchema: z.ZodObject<{
575
570
  scope: z.ZodOptional<z.ZodString>;
576
571
  role: z.ZodOptional<z.ZodEnum<{
572
+ editor: "editor";
577
573
  viewer: "viewer";
578
574
  commenter: "commenter";
579
- editor: "editor";
580
575
  manager: "manager";
581
576
  }>>;
582
577
  }, z.core.$strip>;
@@ -617,23 +612,22 @@ export type PrivateOpen = z.infer<typeof privateOpenSchema>;
617
612
  export declare const teamSpaceAccessDefaultSchema: z.ZodObject<{
618
613
  newSpaceGrantPreset: z.ZodEnum<{
619
614
  team: "team";
620
- public: "public";
621
615
  private: "private";
616
+ public: "public";
622
617
  }>;
623
618
  }, z.core.$strip>;
624
619
  export declare const teamSpaceAccessDefaultWriteSchema: z.ZodObject<{
625
620
  newSpaceGrantPreset: z.ZodEnum<{
626
621
  team: "team";
627
- public: "public";
628
622
  private: "private";
623
+ public: "public";
629
624
  }>;
630
625
  }, z.core.$strip>;
631
626
  export declare const ACCESS_TOKEN_KID = "spacefast-runtime-v1";
632
627
  export declare const ACCESS_TOKEN_ALG = "EdDSA";
633
628
  /**
634
- * The claim-schema version every platform token carries in `v`. One signer,
635
- * one claim contract: a verifier that understands v1 refuses a token minted
636
- * under a later shape instead of reading unknown claims optimistically.
629
+ * The claim-schema version every platform token carries in `v`. A verifier that
630
+ * understands v1 refuses a token minted under a later shape.
637
631
  */
638
632
  export declare const PLATFORM_TOKEN_CLAIM_VERSION: 1;
639
633
  export declare const BLOB_GATE_DOWNLOAD_TTL_SECONDS: number;
@@ -1,17 +1,12 @@
1
1
  import { z } from "zod";
2
2
  import { grantConstraintsPatchSchema, grantConstraintsSchema, grantResourceSetSchema, grantTargetSelectorSchema, } from "./grants.js";
3
- // ---------------------------------------------------------------------------
4
- // Canonical sharing model
5
- // ---------------------------------------------------------------------------
6
3
  export const SPACE_ACCESS_PRESETS = ["private", "team", "public"];
7
4
  export const ACCESS_HANDOFF_MEDIA_TYPE = "application/vnd.spacefast.access-handoff+json";
8
5
  export const spaceAccessPresetSchema = z.enum(SPACE_ACCESS_PRESETS);
9
6
  /**
10
7
  * The sharing vocabulary. Capabilities are the ground truth; a role is a named
11
- * set of them, ordered from least to most. This is the only role enum and the
12
- * only role⇄capability mapping in the product every surface (dashboard, CLI,
13
- * API, comments) names access with these four words and derives capabilities
14
- * here rather than keeping its own preset list.
8
+ * set of them, ordered from least to most. This is the product's only role enum
9
+ * and role⇄capability mapping: every surface derives its capabilities here.
15
10
  */
16
11
  export const ACCESS_ROLES = ["viewer", "commenter", "editor", "manager"];
17
12
  export const accessRoleSchema = z.enum(ACCESS_ROLES);
@@ -25,9 +20,8 @@ export function accessRoleCapabilities(role) {
25
20
  return [...ACCESS_ROLE_CAPABILITIES[role]];
26
21
  }
27
22
  /**
28
- * The role a capability set amounts to, named by the strongest capability it
29
- * carries. A Grant assembled capability-by-capability need not match a role
30
- * exactly; this reports the role it reaches, never more.
23
+ * The role a capability set amounts to: the strongest role it reaches, never
24
+ * more. A Grant assembled capability-by-capability need not match one exactly.
31
25
  */
32
26
  export function accessRoleForCapabilities(capabilities) {
33
27
  if (capabilities.includes("access.manage"))
@@ -39,9 +33,8 @@ export function accessRoleForCapabilities(capabilities) {
39
33
  return "viewer";
40
34
  }
41
35
  /**
42
- * Roles a credential-backed audience can carry. A Link or a password is a
43
- * secret anyone can forward, so it never publishes and never manages access —
44
- * the same boundary `grantSchema` enforces on the capabilities themselves.
36
+ * Roles a forwardable secret (a Link, a password) can carry. It never publishes
37
+ * and never manages access; `grantSchema` enforces that on capabilities too.
45
38
  */
46
39
  export const VISITOR_ACCESS_ROLES = [
47
40
  "viewer",
@@ -137,16 +130,12 @@ export const authorityReferenceSchema = z
137
130
  .string()
138
131
  .regex(/^(member|person|link|password|machine|claim-preview|external):[A-Za-z0-9_.-]+$/);
139
132
  // WHO a session is, orthogonal to WHAT it may do. A session has exactly one
140
- // principal and any number of authorities; neither implies the other. A member
141
- // who arrives by share link is still that member, and a link authority alone
142
- // never makes someone anonymous.
133
+ // principal and any number of authorities; neither implies the other.
143
134
  export const accountPrincipalSchema = z.string().regex(/^account:[A-Za-z0-9_-]+$/);
144
- // The three kinds of somebody. `account:` is a Spacefast user. `person:` is
145
- // someone this Space invited by email and who accepted a real, named identity
146
- // with no platform account behind it. `external:` is a subject an identity
147
- // connection vouched for. Anything else a share Link, a password, a machine
148
- // key, a claim preview — authenticates no one: those sessions stay anonymous
149
- // and carry the credential purely as an authority.
135
+ // `person:` is someone this Space invited by email and who accepted, a named
136
+ // identity with no platform account behind it. `external:` is a subject an
137
+ // identity connection vouched for. Every other authority class (Link, password,
138
+ // machine, claim preview) authenticates no one and leaves the session anonymous.
150
139
  export const identifiedPrincipalSchema = z
151
140
  .string()
152
141
  .regex(/^(?:account|person|external):[A-Za-z0-9_.-]+$/);
@@ -161,9 +150,8 @@ export function accountPrincipalUserId(principal) {
161
150
  return principal.slice("account:".length);
162
151
  }
163
152
  /**
164
- * The identity an authority reference names on its own, if any. Credential
165
- * classes name nobody. This is the ONE place a class maps to an identity: at
166
- * the exchange that just authenticated it, never downstream.
153
+ * The identity an authority reference names on its own, if any. The ONE place a
154
+ * class maps to an identity: at the exchange that authenticated it, never after.
167
155
  */
168
156
  export function principalForAuthority(reference) {
169
157
  return reference.startsWith("person:") || reference.startsWith("external:")
@@ -238,16 +226,14 @@ export const accessShareLinkSchema = z.object({
238
226
  export const accessShareLinkWithUrlSchema = accessShareLinkSchema.extend({
239
227
  url: z.string().url(),
240
228
  });
241
- // Reads re-derive the durable branded URL from the sealed token. Links minted
242
- // before branded URLs existed report null until the backfill mints theirs,
243
- // rather than pretending to hold a URL that would not open.
229
+ // Reads re-derive the branded URL from the sealed token. Links minted before
230
+ // branded URLs existed report null until the backfill mints theirs.
244
231
  export const accessShareLinkReadSchema = accessShareLinkSchema.extend({
245
232
  url: z.string().url().nullable(),
246
233
  });
247
- // The publish receipt exposes one durable access capability in both of its
248
- // useful transports: a browser entry URL and the raw token integrations send
249
- // in X-SF-Authorization. It is access to published bytes, never proof of
250
- // ownership; claim credentials stay a separate receipt field.
234
+ // One durable access capability in both transports: a browser entry URL and the
235
+ // raw token integrations send in X-SF-Authorization. It is access to published
236
+ // bytes, never proof of ownership; claim credentials are a separate receipt field.
251
237
  export const publishedAccessSchema = z.object({
252
238
  url: z.string().url(),
253
239
  token: z.string().min(16).max(512),
@@ -292,8 +278,6 @@ export const linkCapabilitiesSchema = z
292
278
  export const personGrantWriteSchema = z.object({
293
279
  scope: accessScopePathSchema,
294
280
  role: accessRoleSchema,
295
- // A Person can be invited to the live site, to one immutable Version, to a
296
- // branch, or to every Version — the same selector Links and Grants take.
297
281
  target: grantTargetSelectorSchema.default({ kind: "live" }),
298
282
  });
299
283
  export const spacePersonInviteWriteSchema = z.object({
@@ -307,8 +291,6 @@ export const accessShareLinkCreateSchema = z.object({
307
291
  name: z.string().trim().min(1).max(200),
308
292
  landingPath: accessScopePathSchema.default("/"),
309
293
  resources: grantResourceSetSchema,
310
- // Anonymous commenting is a product default: a Link that names no
311
- // capabilities admits reading the page and leaving a comment.
312
294
  capabilities: linkCapabilitiesSchema.default(["page.view", "comments.read", "comments.write"]),
313
295
  constraints: grantConstraintsSchema.default({}),
314
296
  target: grantTargetSelectorSchema.default({ kind: "live" }),
@@ -353,27 +335,21 @@ export const teamSpaceAccessDefaultSchema = z.object({
353
335
  export const teamSpaceAccessDefaultWriteSchema = z.object({
354
336
  newSpaceGrantPreset: spaceAccessPresetSchema,
355
337
  });
356
- // ---------------------------------------------------------------------------
357
- // Unified visitor and collaboration tokens
358
- // ---------------------------------------------------------------------------
359
338
  export const ACCESS_TOKEN_KID = "spacefast-runtime-v1";
360
339
  export const ACCESS_TOKEN_ALG = "EdDSA";
361
340
  /**
362
- * The claim-schema version every platform token carries in `v`. One signer,
363
- * one claim contract: a verifier that understands v1 refuses a token minted
364
- * under a later shape instead of reading unknown claims optimistically.
341
+ * The claim-schema version every platform token carries in `v`. A verifier that
342
+ * understands v1 refuses a token minted under a later shape.
365
343
  */
366
344
  export const PLATFORM_TOKEN_CLAIM_VERSION = 1;
367
345
  export const BLOB_GATE_DOWNLOAD_TTL_SECONDS = 10 * 60;
368
346
  export const BLOB_GATE_SCAN_TTL_SECONDS = 60 * 60;
369
347
  export const BLOB_GATE_UPLOAD_TTL_SECONDS = 60 * 60;
370
348
  export const RUNTIME_JWKS_WELL_KNOWN_FILENAME = "spacefast-runtime-jwks.json";
371
- // Public identity attached only when a token consumer needs to render the
372
- // person behind an authority. Collaboration tickets carry this audience-bound
373
- // claim so Cast can paint an avatar without ever seeing an address: the
374
- // minting side normalizes a provider avatar or derives one from the email,
375
- // then drops the email. Raw email and provider-private profile metadata never
376
- // belong here.
349
+ // Public identity, attached only when a consumer must render the person behind
350
+ // an authority. The minting side normalizes a provider avatar or derives one
351
+ // from the email, then drops the email. Raw email and provider-private profile
352
+ // metadata never belong here.
377
353
  export const accessTokenPublicProfileSchema = z
378
354
  .object({
379
355
  name: z.string().min(1).max(120).optional(),
@@ -386,32 +362,25 @@ export const accessTokenPublicProfileSchema = z
386
362
  .strict();
387
363
  export const accessTokenPayloadSchema = z.object({
388
364
  // Typed purpose from the one platform signer. The runtime REQUIRES exactly
389
- // this value before consuming the jti: a system-view token (or any other
390
- // purpose signed by the same key) can never redeem into a visitor session,
391
- // and a handoff can never pass a system-view check.
365
+ // this value before consuming the jti, so no other purpose signed by the same
366
+ // key can redeem into a visitor session.
392
367
  purpose: z.literal("handoff"),
393
- // Claim-schema version stamped by the one signer.
394
368
  v: z.literal(PLATFORM_TOKEN_CLAIM_VERSION),
395
369
  sub: authorityReferenceSchema,
396
- // Who this handoff authenticated, when it authenticated anybody. The account
397
- // lane names the signed-in user; the invite and identity-connection lanes
398
- // name the Person or external subject they just proved. Link, password,
399
- // machine, and claim-preview lanes never set it, and its absence means the
400
- // runtime session is anonymous. Identity comes from here alone — never
401
- // inferred from the authority classes below.
370
+ // Who this handoff authenticated, when it authenticated anybody. Its absence
371
+ // means the runtime session is anonymous. Identity comes from here alone,
372
+ // never inferred from the authority classes below.
402
373
  principal: identifiedPrincipalSchema.optional(),
403
374
  authorities: z.array(authorityReferenceSchema).min(1).max(16),
404
375
  exp: z.number().int().nonnegative(),
405
376
  nbf: z.number().int().nonnegative(),
406
377
  iat: z.number().int().nonnegative(),
407
378
  iss: z.string().min(1),
408
- // The Space this handoff belongs to, and the token's identity: a Space keeps
409
- // its id across claim, rename, and every custom domain it later answers on,
410
- // so the audience is stable where a serving host is not.
379
+ // The Space this handoff belongs to. A Space keeps its id across claim,
380
+ // rename, and custom domains, so the audience is stable where a host is not.
411
381
  aud: z.string().min(1),
412
- // The lowercased serving host the handoff was minted for. Host binding did
413
- // not go away when `aud` stopped carrying it — it lives here, and the runtime
414
- // rejects a token presented on any other host.
382
+ // The lowercased serving host the handoff was minted for. The runtime rejects
383
+ // a token presented on any other host.
415
384
  host: z.string().min(1),
416
385
  spaceId: z.string().min(1),
417
386
  // Shared opaque identity for the runtime session and its access-origin
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const ACTIVITY_EVENT_CODES: readonly ["space.created", "space.claimed", "feedback.lead_claim_pending", "space.transferred", "space.expired", "space.disabled", "space.enabled", "space.deleted", "space.config_updated", "space.slug_updated", "site.provision_requested", "site.placement_hold_set", "site.placement_hold_cleared", "site.burst_toggled", "space.access_logout_all", "space.access_transfer_scrub", "space.share_link_created", "space.share_link_revoked", "space.access_request_created", "space.access_request_resolved", "space.grant_created", "space.grant_updated", "space.grant_revoked", "team.access_defaults_updated", "version.created", "version.ready", "version.warning", "version.failed", "version.expired", "version.canceled", "version.deleted", "channel.promoted", "build.created", "build.succeeded", "build.failed", "build.canceled", "build.skipped", "domain.created", "domain.verified", "domain.verification_failed", "domain.control_lost", "domain.dns_updated", "domain.nameservers_updated", "domain.registration_purchased", "domain.registration_renewed", "domain.registration_expiring", "domain.registration_expired", "domain.transfer_in_started", "domain.transfer_out_started", "domain.deleted", "domain.attached", "domain.activated", "domain.blocked", "domain.detached", "transfer.requested", "transfer.confirmed", "transfer.completed", "transfer.canceled", "transfer.expired", "transfer.failed", "variable.updated", "variable.deleted", "api_key.created", "api_key.updated", "api_key.revoked", "agent_handoff.created", "agent_handoff.redeemed", "agent_handoff.revoked", "webhook.created", "webhook.updated", "webhook.secret_rotated", "webhook.disabled", "webhook.deleted", "team.updated", "team.slug_updated", "team.member_added", "team.member_removed", "team.member_role_updated", "team.builds_deploys_quota_exceeded", "tenant.past_due", "tenant.suspended", "tenant.reactivated", "tenant.deleted", "comment.token_minted", "comment.created", "comment.reply_created", "comment.archived", "comment.unarchived", "abuse_report.created", "abuse_report.updated", "claim.blocked_takedown", "claim.authority_rotated", "user.created", "user.signed_in", "user.deleted", "user.impersonation_started", "user.impersonation_stopped", "user.two_factor_enabled", "user.two_factor_disabled"];
2
+ export declare const ACTIVITY_EVENT_CODES: readonly ["space.created", "space.claimed", "feedback.lead_claim_pending", "space.transferred", "space.expired", "space.disabled", "space.enabled", "space.deleted", "space.config_updated", "space.slug_updated", "site.provision_requested", "site.burst_toggled", "space.access_logout_all", "space.access_transfer_scrub", "space.share_link_created", "space.share_link_revoked", "space.access_request_created", "space.access_request_resolved", "space.grant_created", "space.grant_updated", "space.grant_revoked", "team.access_defaults_updated", "version.created", "version.ready", "version.warning", "version.failed", "version.expired", "version.canceled", "version.deleted", "channel.promoted", "build.created", "build.succeeded", "build.failed", "build.canceled", "build.skipped", "domain.created", "domain.verified", "domain.verification_failed", "domain.control_lost", "domain.dns_updated", "domain.nameservers_updated", "domain.registration_purchased", "domain.registration_renewed", "domain.registration_expiring", "domain.registration_expired", "domain.transfer_in_started", "domain.transfer_out_started", "domain.deleted", "domain.attached", "domain.activated", "domain.blocked", "domain.detached", "transfer.requested", "transfer.confirmed", "transfer.completed", "transfer.canceled", "transfer.expired", "transfer.failed", "cron.failed", "variable.updated", "variable.deleted", "api_key.created", "api_key.updated", "api_key.revoked", "agent_handoff.created", "agent_handoff.redeemed", "agent_handoff.revoked", "webhook.created", "webhook.updated", "webhook.secret_rotated", "webhook.disabled", "webhook.deleted", "team.updated", "team.slug_updated", "team.member_added", "team.member_removed", "team.member_role_updated", "team.builds_deploys_quota_exceeded", "tenant.past_due", "tenant.suspended", "tenant.reactivated", "tenant.deleted", "principal.plan_reset", "principal.space_quota_exceeded", "principal.suspended", "principal.unsuspended", "principal.closed", "usage.threshold_crossed", "usage.period_finalized", "usage.corrected", "principal.notification.claim", "principal.notification.space_expiry", "principal.notification.access_invitation", "principal.notification.access_request", "principal.notification.access_verification", "principal.notification.publish_receipt", "principal.notification.comment", "comment.token_minted", "comment.created", "comment.reply_created", "comment.archived", "comment.unarchived", "abuse_report.created", "abuse_report.updated", "claim.blocked_takedown", "claim.authority_rotated", "user.created", "user.signed_in", "user.deleted", "user.impersonation_started", "user.impersonation_stopped", "user.two_factor_enabled", "user.two_factor_disabled", "user.password_set", "user.password_changed", "user.provider_linked", "user.provider_unlinked", "user.email_added", "user.email_removed", "user.primary_email_changed", "user.superadmin_granted", "user.superadmin_revoked", "user.privacy_updated", "user.deletion_requested", "user.deletion_completed"];
3
3
  export type ActivityEventCode = (typeof ACTIVITY_EVENT_CODES)[number];
4
4
  export declare function isActivityEventCode(value: string): value is ActivityEventCode;
5
5
  export declare function isValidActivityEventFilter(filter: string): boolean;
@@ -10,6 +10,9 @@ export declare const activityActorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
10
10
  }, z.core.$strip>, z.ZodObject<{
11
11
  type: z.ZodLiteral<"api_key">;
12
12
  id: z.ZodString;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ type: z.ZodLiteral<"partner_token">;
15
+ id: z.ZodString;
13
16
  }, z.core.$strip>, z.ZodObject<{
14
17
  type: z.ZodLiteral<"oauth_client">;
15
18
  id: z.ZodString;
@@ -32,6 +35,10 @@ export declare const activityEventSchema: z.ZodObject<{
32
35
  id: z.ZodString;
33
36
  sequence: z.ZodNumber;
34
37
  tenantId: z.ZodString;
38
+ mode: z.ZodEnum<{
39
+ live: "live";
40
+ test: "test";
41
+ }>;
35
42
  principal: z.ZodNullable<z.ZodObject<{
36
43
  tenantId: z.ZodString;
37
44
  principalType: z.ZodEnum<{
@@ -47,6 +54,9 @@ export declare const activityEventSchema: z.ZodObject<{
47
54
  }, z.core.$strip>, z.ZodObject<{
48
55
  type: z.ZodLiteral<"api_key">;
49
56
  id: z.ZodString;
57
+ }, z.core.$strip>, z.ZodObject<{
58
+ type: z.ZodLiteral<"partner_token">;
59
+ id: z.ZodString;
50
60
  }, z.core.$strip>, z.ZodObject<{
51
61
  type: z.ZodLiteral<"oauth_client">;
52
62
  id: z.ZodString;
@@ -80,6 +90,10 @@ export declare const activityListResponseSchema: z.ZodObject<{
80
90
  id: z.ZodString;
81
91
  sequence: z.ZodNumber;
82
92
  tenantId: z.ZodString;
93
+ mode: z.ZodEnum<{
94
+ live: "live";
95
+ test: "test";
96
+ }>;
83
97
  principal: z.ZodNullable<z.ZodObject<{
84
98
  tenantId: z.ZodString;
85
99
  principalType: z.ZodEnum<{
@@ -95,6 +109,9 @@ export declare const activityListResponseSchema: z.ZodObject<{
95
109
  }, z.core.$strip>, z.ZodObject<{
96
110
  type: z.ZodLiteral<"api_key">;
97
111
  id: z.ZodString;
112
+ }, z.core.$strip>, z.ZodObject<{
113
+ type: z.ZodLiteral<"partner_token">;
114
+ id: z.ZodString;
98
115
  }, z.core.$strip>, z.ZodObject<{
99
116
  type: z.ZodLiteral<"oauth_client">;
100
117
  id: z.ZodString;
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
2
  import { AnyObjectSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
- // The single event taxonomy (internal-docs/platform.md "Event taxonomy").
4
- // Every emitted activity event and every webhook `events` filter selects on
5
- // these codes.
6
- // `appendActivityEvent` is typed against this list, so emitting a code that is
7
- // not in the table is a typecheck (CI) failure.
3
+ import { tenantMode } from "./enums.js";
4
+ import { PRINCIPAL_NOTIFICATION_EVENT_CODES } from "./partner-notifications.js";
5
+ // The single event taxonomy (the platform spec "Event taxonomy"). Every emitted
6
+ // event and every webhook `events` filter selects on these codes, and
7
+ // `appendActivityEvent` is typed against the list, so an off-list code fails CI.
8
8
  export const ACTIVITY_EVENT_CODES = [
9
9
  // space
10
10
  "space.created",
@@ -19,8 +19,6 @@ export const ACTIVITY_EVENT_CODES = [
19
19
  "space.slug_updated",
20
20
  // site
21
21
  "site.provision_requested",
22
- "site.placement_hold_set",
23
- "site.placement_hold_cleared",
24
22
  "site.burst_toggled",
25
23
  // access
26
24
  "space.access_logout_all",
@@ -75,6 +73,8 @@ export const ACTIVITY_EVENT_CODES = [
75
73
  "transfer.canceled",
76
74
  "transfer.expired",
77
75
  "transfer.failed",
76
+ // cron (only failures are reported; a run that succeeds is silent)
77
+ "cron.failed",
78
78
  // variable (key-level only; never values)
79
79
  "variable.updated",
80
80
  "variable.deleted",
@@ -92,38 +92,59 @@ export const ACTIVITY_EVENT_CODES = [
92
92
  "webhook.secret_rotated",
93
93
  "webhook.disabled",
94
94
  "webhook.deleted",
95
- // team (builds_deploys_quota_exceeded is a shipped additive extension: the
96
- // pooled monthly builds+deploys meter is SOFT — it tracks, never blocks)
95
+ // team (the pooled monthly builds+deploys meter is SOFT: it tracks, never blocks)
97
96
  "team.updated",
98
97
  "team.slug_updated",
99
98
  "team.member_added",
100
99
  "team.member_removed",
101
100
  "team.member_role_updated",
102
101
  "team.builds_deploys_quota_exceeded",
103
- // tenant (tenant.deleted is a shipped additive extension)
102
+ // tenant
104
103
  "tenant.past_due",
105
104
  "tenant.suspended",
106
105
  "tenant.reactivated",
107
106
  "tenant.deleted",
107
+ // principal (partner commerce lifecycle; §4/§5). `plan_reset` fires when a
108
+ // plan an external principal is assigned to drops out of the tenant's
109
+ // system-space plan catalog and the assignment falls back to the default.
110
+ "principal.plan_reset",
111
+ // Fires when an external principal creates a space that trips its plan's
112
+ // space-count quota under the `warn` enforcement policy — the create is
113
+ // allowed through and this records the overage instead of blocking.
114
+ "principal.space_quota_exceeded",
115
+ // Lifecycle transitions (§4). `suspended` darkens the principal's spaces
116
+ // (402 suspended page) and blocks its mutations; `unsuspended` restores both;
117
+ // `closed` is terminal. Each carries the acting actor so a Spacefast-applied
118
+ // status is distinguishable from a partner-applied one.
119
+ "principal.suspended",
120
+ "principal.unsuspended",
121
+ "principal.closed",
122
+ // partner usage ledger
123
+ "usage.threshold_crossed",
124
+ "usage.period_finalized",
125
+ "usage.corrected",
126
+ // principal notifications (partner API §7): the customer-facing notifications
127
+ // a partner white-labels. Spacefast delegates them — instead of emailing the
128
+ // partner's own end customer, it emits the event here for the partner to
129
+ // deliver. Defined in partner-notifications.ts (the subscribe-side catalog)
130
+ // and folded in so each is a first-class taxonomy code with a grammar row and
131
+ // a valid webhook filter.
132
+ ...PRINCIPAL_NOTIFICATION_EVENT_CODES,
108
133
  // comments
109
134
  "comment.token_minted",
110
135
  "comment.created",
111
136
  "comment.reply_created",
112
137
  "comment.archived",
113
138
  "comment.unarchived",
114
- // abuse (additive extension: operator-tunable abuse-control telemetry)
139
+ // abuse
115
140
  "abuse_report.created",
116
141
  "abuse_report.updated",
117
- // claim (additive extension: a claim attempt against a taken-down space is
118
- // flagged, never silently 404ed — internal-docs/platform.md "Abuse Posture")
142
+ // claim (an attempt against a taken-down space is flagged, never silently 404ed)
119
143
  "claim.blocked_takedown",
120
144
  "claim.authority_rotated",
121
- // user (additive extension: account lifecycle plus the 2FA and
122
- // admin-impersonation effects that must surface through ActivityEvent
123
- // internal-docs/platform.md Better Auth usage). `user.created` fires once on
124
- // signup; `user.signed_in` fires per non-impersonation session creation;
125
- // `user.deleted` fires on account deletion and retains the analyticsId in
126
- // its details so right-to-erasure can be completed in every provider.
145
+ // user. `user.signed_in` fires per non-impersonation session creation.
146
+ // `user.deleted` retains the analyticsId in its details so right-to-erasure
147
+ // can be completed in every provider.
127
148
  "user.created",
128
149
  "user.signed_in",
129
150
  "user.deleted",
@@ -131,20 +152,43 @@ export const ACTIVITY_EVENT_CODES = [
131
152
  "user.impersonation_stopped",
132
153
  "user.two_factor_enabled",
133
154
  "user.two_factor_disabled",
155
+ // Security notifications (auth/security-events.ts): every auth mutation that
156
+ // changes how the account can be entered lands here AND mails the owner
157
+ // through the same pipeline. Ids only in details, never addresses or names.
158
+ "user.password_set",
159
+ "user.password_changed",
160
+ "user.provider_linked",
161
+ "user.provider_unlinked",
162
+ "user.email_added",
163
+ "user.email_removed",
164
+ "user.primary_email_changed",
165
+ "user.superadmin_granted",
166
+ "user.superadmin_revoked",
167
+ "user.privacy_updated",
168
+ "user.deletion_requested",
169
+ "user.deletion_completed",
134
170
  ];
135
171
  const ACTIVITY_EVENT_CODE_SET = new Set(ACTIVITY_EVENT_CODES);
136
- const ACTIVITY_EVENT_RESOURCES = new Set(ACTIVITY_EVENT_CODES.map((code) => code.split(".", 1)[0]));
172
+ // Every dot-delimited prefix a code carries, at each segment boundary — the set
173
+ // a prefix wildcard may name. `version.ready` contributes `version`;
174
+ // `principal.notification.claim` contributes both `principal` and
175
+ // `principal.notification`, so a partner can subscribe to the whole
176
+ // `principal.notification.*` class in one filter.
177
+ const ACTIVITY_EVENT_PREFIXES = new Set(ACTIVITY_EVENT_CODES.flatMap((code) => {
178
+ const parts = code.split(".");
179
+ return parts.slice(0, -1).map((_, index) => parts.slice(0, index + 1).join("."));
180
+ }));
137
181
  export function isActivityEventCode(value) {
138
182
  return ACTIVITY_EVENT_CODE_SET.has(value);
139
183
  }
140
- // Webhook `events` filters accept exact codes, prefix wildcards ("version.*"),
141
- // and the catch-all ["*"].
184
+ // Webhook `events` filters accept exact codes, prefix wildcards ("version.*",
185
+ // "principal.notification.*"), and the catch-all ["*"].
142
186
  export function isValidActivityEventFilter(filter) {
143
187
  if (filter === "*") {
144
188
  return true;
145
189
  }
146
190
  if (filter.endsWith(".*")) {
147
- return ACTIVITY_EVENT_RESOURCES.has(filter.slice(0, -2));
191
+ return ACTIVITY_EVENT_PREFIXES.has(filter.slice(0, -2));
148
192
  }
149
193
  return ACTIVITY_EVENT_CODE_SET.has(filter);
150
194
  }
@@ -156,6 +200,7 @@ export function matchesActivityEventFilters(filters, code) {
156
200
  export const activityActorSchema = z.discriminatedUnion("type", [
157
201
  z.object({ type: z.literal("user"), id: z.string().min(1) }),
158
202
  z.object({ type: z.literal("api_key"), id: z.string().min(1) }),
203
+ z.object({ type: z.literal("partner_token"), id: z.string().min(1) }),
159
204
  z.object({ type: z.literal("oauth_client"), id: z.string().min(1) }),
160
205
  z.object({ type: z.literal("anonymous_claim"), id: z.string().min(1) }),
161
206
  z.object({ type: z.literal("system"), id: z.string().min(1) }),
@@ -169,6 +214,7 @@ export const activityEventSchema = z.object({
169
214
  id: z.string(),
170
215
  sequence: z.number().int().nonnegative(),
171
216
  tenantId: z.string(),
217
+ mode: tenantMode.describe("`test` when the event's tenant is a linked test tenant, `live` otherwise."),
172
218
  principal: activityPrincipalSchema.nullable(),
173
219
  spaceId: z.string().nullable(),
174
220
  actor: activityActorSchema,
@@ -181,9 +227,9 @@ export const activityQuerySchema = cursorListQuerySchema.extend({
181
227
  principalType: z
182
228
  .enum(["team", "external"])
183
229
  .optional()
184
- .describe("Filter to events owned by a team or an external customer principal."),
185
- principalId: z.string().min(1).optional().describe("Filter to a single principal id."),
186
- spaceId: z.string().min(1).optional().describe("Filter to events for one space."),
230
+ .describe("Filter by owning principal type."),
231
+ principalId: z.string().min(1).optional().describe("Filter to one principal."),
232
+ spaceId: z.string().min(1).optional().describe("Filter to one space."),
187
233
  code: z
188
234
  .string()
189
235
  .min(1)