@fuzdev/fuz_app 0.140.0 → 0.142.0

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 (311) hide show
  1. package/dist/actions/CLAUDE.md +72 -22
  2. package/dist/actions/action_rpc.d.ts +5 -1
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +9 -1
  5. package/dist/actions/connection_closer.d.ts +44 -4
  6. package/dist/actions/connection_closer.d.ts.map +1 -1
  7. package/dist/actions/connection_closer.js +33 -3
  8. package/dist/actions/perform_action.d.ts +10 -0
  9. package/dist/actions/perform_action.d.ts.map +1 -1
  10. package/dist/actions/perform_action.js +23 -9
  11. package/dist/actions/register_action_ws.d.ts +42 -6
  12. package/dist/actions/register_action_ws.d.ts.map +1 -1
  13. package/dist/actions/register_action_ws.js +87 -19
  14. package/dist/actions/register_ws_endpoint.d.ts +15 -6
  15. package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
  16. package/dist/actions/register_ws_endpoint.js +10 -4
  17. package/dist/actions/socket.svelte.d.ts +19 -4
  18. package/dist/actions/socket.svelte.d.ts.map +1 -1
  19. package/dist/actions/socket.svelte.js +31 -4
  20. package/dist/actions/transports.d.ts +30 -1
  21. package/dist/actions/transports.d.ts.map +1 -1
  22. package/dist/actions/transports.js +30 -1
  23. package/dist/actions/transports_ws_auth_guard.d.ts +13 -6
  24. package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
  25. package/dist/actions/transports_ws_auth_guard.js +24 -10
  26. package/dist/actions/transports_ws_backend.d.ts +51 -5
  27. package/dist/actions/transports_ws_backend.d.ts.map +1 -1
  28. package/dist/actions/transports_ws_backend.js +62 -9
  29. package/dist/actions/ws_endpoint_spec.d.ts +11 -10
  30. package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
  31. package/dist/auth/CLAUDE.md +44 -22
  32. package/dist/auth/account_actions.d.ts.map +1 -1
  33. package/dist/auth/account_actions.js +12 -1
  34. package/dist/auth/account_route_schema.d.ts +1 -0
  35. package/dist/auth/account_route_schema.d.ts.map +1 -1
  36. package/dist/auth/account_route_schema.js +12 -0
  37. package/dist/auth/account_routes.d.ts +7 -2
  38. package/dist/auth/account_routes.d.ts.map +1 -1
  39. package/dist/auth/account_routes.js +240 -187
  40. package/dist/auth/admin_action_specs.d.ts +6 -1
  41. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  42. package/dist/auth/admin_action_specs.js +6 -1
  43. package/dist/auth/admin_actions.d.ts.map +1 -1
  44. package/dist/auth/admin_actions.js +14 -2
  45. package/dist/auth/api_token.d.ts +20 -0
  46. package/dist/auth/api_token.d.ts.map +1 -1
  47. package/dist/auth/api_token.js +21 -1
  48. package/dist/auth/api_token_queries.d.ts +22 -4
  49. package/dist/auth/api_token_queries.d.ts.map +1 -1
  50. package/dist/auth/api_token_queries.js +11 -6
  51. package/dist/auth/audit_log_routes.d.ts +10 -0
  52. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  53. package/dist/auth/audit_log_routes.js +20 -0
  54. package/dist/auth/audit_log_schema.d.ts +30 -5
  55. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  56. package/dist/auth/audit_log_schema.js +30 -0
  57. package/dist/auth/bearer_auth.d.ts +4 -2
  58. package/dist/auth/bearer_auth.d.ts.map +1 -1
  59. package/dist/auth/bearer_auth.js +19 -8
  60. package/dist/auth/bootstrap_route_schema.d.ts +1 -0
  61. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  62. package/dist/auth/bootstrap_route_schema.js +1 -0
  63. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  64. package/dist/auth/bootstrap_routes.js +85 -76
  65. package/dist/auth/cell_action_specs.d.ts +7 -3
  66. package/dist/auth/cell_action_specs.d.ts.map +1 -1
  67. package/dist/auth/cell_action_specs.js +9 -5
  68. package/dist/auth/cell_actions.d.ts +3 -3
  69. package/dist/auth/cell_actions.d.ts.map +1 -1
  70. package/dist/auth/cell_actions.js +67 -38
  71. package/dist/auth/cell_authorize.d.ts +69 -8
  72. package/dist/auth/cell_authorize.d.ts.map +1 -1
  73. package/dist/auth/cell_authorize.js +89 -9
  74. package/dist/auth/cell_field_action_specs.d.ts +5 -4
  75. package/dist/auth/cell_field_action_specs.d.ts.map +1 -1
  76. package/dist/auth/cell_field_action_specs.js +7 -7
  77. package/dist/auth/cell_field_actions.d.ts +7 -5
  78. package/dist/auth/cell_field_actions.d.ts.map +1 -1
  79. package/dist/auth/cell_field_actions.js +24 -22
  80. package/dist/auth/cell_grant_action_specs.d.ts +6 -0
  81. package/dist/auth/cell_grant_action_specs.d.ts.map +1 -1
  82. package/dist/auth/cell_grant_action_specs.js +6 -0
  83. package/dist/auth/cell_grant_actions.d.ts +3 -1
  84. package/dist/auth/cell_grant_actions.d.ts.map +1 -1
  85. package/dist/auth/cell_grant_actions.js +16 -2
  86. package/dist/auth/cell_item_action_specs.d.ts +5 -4
  87. package/dist/auth/cell_item_action_specs.d.ts.map +1 -1
  88. package/dist/auth/cell_item_action_specs.js +7 -7
  89. package/dist/auth/cell_item_actions.d.ts +6 -5
  90. package/dist/auth/cell_item_actions.d.ts.map +1 -1
  91. package/dist/auth/cell_item_actions.js +23 -22
  92. package/dist/auth/cell_relation_list_limit.d.ts +20 -0
  93. package/dist/auth/cell_relation_list_limit.d.ts.map +1 -0
  94. package/dist/auth/cell_relation_list_limit.js +27 -0
  95. package/dist/auth/cell_relation_visibility.d.ts +4 -3
  96. package/dist/auth/cell_relation_visibility.d.ts.map +1 -1
  97. package/dist/auth/cell_relation_visibility.js +6 -5
  98. package/dist/auth/cell_steward.d.ts +45 -0
  99. package/dist/auth/cell_steward.d.ts.map +1 -0
  100. package/dist/auth/cell_steward.js +53 -0
  101. package/dist/auth/cleanup.d.ts +9 -9
  102. package/dist/auth/cleanup.js +9 -9
  103. package/dist/auth/credential_deadline.d.ts +95 -0
  104. package/dist/auth/credential_deadline.d.ts.map +1 -0
  105. package/dist/auth/credential_deadline.js +139 -0
  106. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  107. package/dist/auth/daemon_token_middleware.js +4 -1
  108. package/dist/auth/middleware.d.ts +90 -12
  109. package/dist/auth/middleware.d.ts.map +1 -1
  110. package/dist/auth/middleware.js +115 -16
  111. package/dist/auth/request_context.d.ts +8 -2
  112. package/dist/auth/request_context.d.ts.map +1 -1
  113. package/dist/auth/request_context.js +20 -4
  114. package/dist/auth/resolved_auth.d.ts +13 -2
  115. package/dist/auth/resolved_auth.d.ts.map +1 -1
  116. package/dist/auth/resolved_auth.js +5 -4
  117. package/dist/auth/role_grant_offer_action_specs.d.ts +5 -0
  118. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  119. package/dist/auth/role_grant_offer_action_specs.js +6 -1
  120. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  121. package/dist/auth/role_grant_offer_actions.js +23 -16
  122. package/dist/auth/role_grant_offer_queries.d.ts +8 -6
  123. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  124. package/dist/auth/role_grant_offer_queries.js +16 -8
  125. package/dist/auth/session_cookie.d.ts +4 -0
  126. package/dist/auth/session_cookie.d.ts.map +1 -1
  127. package/dist/auth/session_cookie.js +3 -2
  128. package/dist/auth/session_middleware.d.ts +1 -1
  129. package/dist/auth/session_middleware.d.ts.map +1 -1
  130. package/dist/auth/session_middleware.js +4 -1
  131. package/dist/auth/session_queries.d.ts +19 -2
  132. package/dist/auth/session_queries.d.ts.map +1 -1
  133. package/dist/auth/session_queries.js +8 -2
  134. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  135. package/dist/auth/signup_route_schema.js +1 -0
  136. package/dist/auth/signup_routes.d.ts +4 -3
  137. package/dist/auth/signup_routes.d.ts.map +1 -1
  138. package/dist/auth/signup_routes.js +157 -134
  139. package/dist/auth/token_scope.d.ts +7 -1
  140. package/dist/auth/token_scope.d.ts.map +1 -1
  141. package/dist/auth/token_scope.js +8 -2
  142. package/dist/db/CLAUDE.md +32 -19
  143. package/dist/db/cell_ddl.d.ts +1 -2
  144. package/dist/db/cell_ddl.d.ts.map +1 -1
  145. package/dist/db/cell_ddl.js +1 -2
  146. package/dist/db/cell_field_queries.d.ts +20 -18
  147. package/dist/db/cell_field_queries.d.ts.map +1 -1
  148. package/dist/db/cell_field_queries.js +28 -22
  149. package/dist/db/cell_item_queries.d.ts +20 -14
  150. package/dist/db/cell_item_queries.d.ts.map +1 -1
  151. package/dist/db/cell_item_queries.js +28 -18
  152. package/dist/db/cell_moderation.d.ts +67 -0
  153. package/dist/db/cell_moderation.d.ts.map +1 -0
  154. package/dist/db/cell_moderation.js +66 -0
  155. package/dist/db/cell_queries.d.ts +44 -14
  156. package/dist/db/cell_queries.d.ts.map +1 -1
  157. package/dist/db/cell_queries.js +68 -45
  158. package/dist/db/cell_view_sql.d.ts +102 -0
  159. package/dist/db/cell_view_sql.d.ts.map +1 -0
  160. package/dist/db/cell_view_sql.js +112 -0
  161. package/dist/db/db_pg.d.ts +1 -1
  162. package/dist/db/db_pg.js +1 -1
  163. package/dist/hono_context.d.ts +23 -0
  164. package/dist/hono_context.d.ts.map +1 -1
  165. package/dist/hono_context.js +19 -0
  166. package/dist/http/CLAUDE.md +41 -15
  167. package/dist/http/auth_shape.d.ts +5 -2
  168. package/dist/http/auth_shape.d.ts.map +1 -1
  169. package/dist/http/auth_shape.js +5 -2
  170. package/dist/http/ip_canonical.d.ts +30 -3
  171. package/dist/http/ip_canonical.d.ts.map +1 -1
  172. package/dist/http/ip_canonical.js +50 -3
  173. package/dist/http/middleware_spec.d.ts +16 -0
  174. package/dist/http/middleware_spec.d.ts.map +1 -1
  175. package/dist/http/origin.d.ts +113 -18
  176. package/dist/http/origin.d.ts.map +1 -1
  177. package/dist/http/origin.js +247 -127
  178. package/dist/http/route_spec.d.ts +21 -0
  179. package/dist/http/route_spec.d.ts.map +1 -1
  180. package/dist/http/schema_helpers.d.ts +22 -0
  181. package/dist/http/schema_helpers.d.ts.map +1 -1
  182. package/dist/http/schema_helpers.js +24 -0
  183. package/dist/http/surface.d.ts +6 -1
  184. package/dist/http/surface.d.ts.map +1 -1
  185. package/dist/http/surface.js +12 -5
  186. package/dist/primitive_schemas.d.ts +10 -1
  187. package/dist/primitive_schemas.d.ts.map +1 -1
  188. package/dist/primitive_schemas.js +11 -2
  189. package/dist/rate_limiter.d.ts +179 -12
  190. package/dist/rate_limiter.d.ts.map +1 -1
  191. package/dist/rate_limiter.js +352 -42
  192. package/dist/realtime/sse_auth_guard.d.ts +22 -6
  193. package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
  194. package/dist/realtime/sse_auth_guard.js +31 -12
  195. package/dist/realtime/subscriber_registry.d.ts +10 -1
  196. package/dist/realtime/subscriber_registry.d.ts.map +1 -1
  197. package/dist/realtime/subscriber_registry.js +10 -1
  198. package/dist/server/app_server.d.ts +20 -7
  199. package/dist/server/app_server.d.ts.map +1 -1
  200. package/dist/server/app_server.js +8 -3
  201. package/dist/server/env.d.ts +2 -1
  202. package/dist/server/env.d.ts.map +1 -1
  203. package/dist/server/env.js +7 -17
  204. package/dist/server/serve_fact_route.d.ts +8 -4
  205. package/dist/server/serve_fact_route.d.ts.map +1 -1
  206. package/dist/server/serve_fact_route.js +16 -6
  207. package/dist/testing/CLAUDE.md +164 -25
  208. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  209. package/dist/testing/adversarial_headers.js +13 -6
  210. package/dist/testing/connection_closer_helpers.d.ts +6 -1
  211. package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
  212. package/dist/testing/connection_closer_helpers.js +4 -0
  213. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  214. package/dist/testing/cross_backend/account_lifecycle.js +37 -2
  215. package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
  216. package/dist/testing/cross_backend/body_size.js +14 -65
  217. package/dist/testing/cross_backend/capabilities.d.ts +26 -2
  218. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  219. package/dist/testing/cross_backend/capabilities.js +9 -3
  220. package/dist/testing/cross_backend/cell_gated_create.d.ts +38 -0
  221. package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
  222. package/dist/testing/cross_backend/cell_gated_create.js +401 -5
  223. package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
  224. package/dist/testing/cross_backend/cell_relations.js +145 -2
  225. package/dist/testing/cross_backend/conformance_case.d.ts +11 -3
  226. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  227. package/dist/testing/cross_backend/conformance_case.js +6 -0
  228. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  229. package/dist/testing/cross_backend/conformance_table.js +20 -19
  230. package/dist/testing/cross_backend/credential_deadline.d.ts +25 -0
  231. package/dist/testing/cross_backend/credential_deadline.d.ts.map +1 -0
  232. package/dist/testing/cross_backend/credential_deadline.js +185 -0
  233. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  234. package/dist/testing/cross_backend/default_backend_configs.js +13 -2
  235. package/dist/testing/cross_backend/expected_schema.json +0 -1
  236. package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -0
  237. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  238. package/dist/testing/cross_backend/full_spine_mount.js +7 -1
  239. package/dist/testing/cross_backend/login_security.d.ts +16 -0
  240. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  241. package/dist/testing/cross_backend/login_security.js +154 -0
  242. package/dist/testing/cross_backend/narrowed_api_token.d.ts +23 -0
  243. package/dist/testing/cross_backend/narrowed_api_token.d.ts.map +1 -0
  244. package/dist/testing/cross_backend/narrowed_api_token.js +40 -0
  245. package/dist/testing/cross_backend/origin.d.ts.map +1 -1
  246. package/dist/testing/cross_backend/origin.js +6 -26
  247. package/dist/testing/cross_backend/origin_conformance.d.ts +152 -0
  248. package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -0
  249. package/dist/testing/cross_backend/origin_conformance.js +136 -0
  250. package/dist/testing/cross_backend/origin_conformance.json +1679 -0
  251. package/dist/testing/cross_backend/origin_scope.d.ts +16 -0
  252. package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -0
  253. package/dist/testing/cross_backend/origin_scope.js +140 -0
  254. package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
  255. package/dist/testing/cross_backend/query_shape.js +24 -2
  256. package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts +35 -0
  257. package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts.map +1 -0
  258. package/dist/testing/cross_backend/role_grant_cross_helpers.js +64 -0
  259. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +8 -0
  260. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  261. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +44 -33
  262. package/dist/testing/cross_backend/role_grant_participation.d.ts.map +1 -1
  263. package/dist/testing/cross_backend/role_grant_participation.js +64 -0
  264. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
  265. package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +6 -4
  266. package/dist/testing/cross_backend/spine_surface_constants.d.ts +20 -1
  267. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  268. package/dist/testing/cross_backend/spine_surface_constants.js +23 -1
  269. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  270. package/dist/testing/cross_backend/testing_backdoor.js +20 -7
  271. package/dist/testing/cross_backend/testing_reset_actions.d.ts +180 -5
  272. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  273. package/dist/testing/cross_backend/testing_reset_actions.js +154 -5
  274. package/dist/testing/cross_backend/token_scope_surface.d.ts.map +1 -1
  275. package/dist/testing/cross_backend/token_scope_surface.js +25 -21
  276. package/dist/testing/cross_backend/transport_composition.d.ts +60 -0
  277. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -0
  278. package/dist/testing/cross_backend/transport_composition.js +364 -0
  279. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  280. package/dist/testing/cross_backend/ts_spine_backend_config.js +21 -6
  281. package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
  282. package/dist/testing/cross_backend/ws_action_rate_limit.js +21 -1
  283. package/dist/testing/cross_backend/ws_role_gated.d.ts +38 -0
  284. package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -0
  285. package/dist/testing/cross_backend/ws_role_gated.js +142 -0
  286. package/dist/testing/entities.d.ts +23 -0
  287. package/dist/testing/entities.d.ts.map +1 -1
  288. package/dist/testing/entities.js +37 -0
  289. package/dist/testing/integration.d.ts.map +1 -1
  290. package/dist/testing/integration.js +3 -1
  291. package/dist/testing/middleware.d.ts +10 -0
  292. package/dist/testing/middleware.d.ts.map +1 -1
  293. package/dist/testing/middleware.js +31 -7
  294. package/dist/testing/schema_introspect.js +1 -1
  295. package/dist/testing/schema_parity.d.ts +4 -3
  296. package/dist/testing/schema_parity.d.ts.map +1 -1
  297. package/dist/testing/schema_parity.js +4 -3
  298. package/dist/testing/schema_ready_fixture.d.ts +2 -4
  299. package/dist/testing/schema_ready_fixture.d.ts.map +1 -1
  300. package/dist/testing/schema_ready_fixture.js +2 -4
  301. package/dist/testing/stubs.d.ts +16 -3
  302. package/dist/testing/stubs.d.ts.map +1 -1
  303. package/dist/testing/stubs.js +20 -7
  304. package/dist/testing/surface_invariants.js +2 -2
  305. package/dist/ui/auth_state.svelte.d.ts +10 -0
  306. package/dist/ui/auth_state.svelte.d.ts.map +1 -1
  307. package/dist/ui/auth_state.svelte.js +22 -4
  308. package/package.json +1 -1
  309. package/dist/db/cell_history_ddl.d.ts +0 -38
  310. package/dist/db/cell_history_ddl.d.ts.map +0 -1
  311. package/dist/db/cell_history_ddl.js +0 -61
@@ -165,7 +165,16 @@ export interface PendingSubscription {
165
165
  * // first: a client that already left closes the stream, its listener runs at
166
166
  * // once, and `admit` then refuses the removed registration
167
167
  * stream.on_close(pending.unsubscribe);
168
- * if (!registry.admit(pending, stream)) stream.close(); // the body is the connect comment alone
168
+ * if (!registry.admit(pending, stream)) {
169
+ * stream.close(); // the body is the connect comment alone
170
+ * } else {
171
+ * // expiry writes nothing a revocation closes on: end at the credential's deadline
172
+ * stream.on_close(
173
+ * schedule_credential_deadline(get_resolved_auth(c)?.credential_deadline ?? null, () =>
174
+ * stream.close()
175
+ * )
176
+ * );
177
+ * }
169
178
  * return response;
170
179
  * ```
171
180
  */
@@ -1 +1 @@
1
- {"version":3,"file":"subscriber_registry.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/subscriber_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,0EAA0E;AAC1E,MAAM,WAAW,UAAU,CAAC,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrB,sEAAsE;IACtE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7B,mDAAmD;IACnD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qEAAqE;IACrE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC3B;AASD,wCAAwC;AACxC,MAAM,WAAW,yBAAyB;IACzC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAChC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,WAAW,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,qBAAa,kBAAkB,CAAC,CAAC;;gBAYpB,OAAO,CAAC,EAAE,yBAAyB;IAK/C;;;OAGG;IACH,IAAI,KAAK,IAAI,MAAM,CAMlB;IAED;;;OAGG;IACH,IAAI,aAAa,IAAI,MAAM,CAM1B;IAED;;;;;OAKG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,IAAI;IAavE;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,mBAAmB;IAYlE;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO;IASlE;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IASzC;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAM3C;;;;;;;;;;;;OAYG;IACH,SAAS,IAAI,MAAM;CAsFnB"}
1
+ {"version":3,"file":"subscriber_registry.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/subscriber_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,y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O,CAErB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,IAAI;IAavE;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,mBAAmB;IAYlE;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO;IASlE;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IASzC;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAM3C;;;;;;;;;;;;OAYG;IACH,SAAS,IAAI,MAAM;CAsFnB"}
@@ -105,7 +105,16 @@ import { Logger } from '@fuzdev/fuz_util/log.ts';
105
105
  * // first: a client that already left closes the stream, its listener runs at
106
106
  * // once, and `admit` then refuses the removed registration
107
107
  * stream.on_close(pending.unsubscribe);
108
- * if (!registry.admit(pending, stream)) stream.close(); // the body is the connect comment alone
108
+ * if (!registry.admit(pending, stream)) {
109
+ * stream.close(); // the body is the connect comment alone
110
+ * } else {
111
+ * // expiry writes nothing a revocation closes on: end at the credential's deadline
112
+ * stream.on_close(
113
+ * schedule_credential_deadline(get_resolved_auth(c)?.credential_deadline ?? null, () =>
114
+ * stream.close()
115
+ * )
116
+ * );
117
+ * }
109
118
  * return response;
110
119
  * ```
111
120
  */
@@ -23,7 +23,7 @@ import '../hono_context.js';
23
23
  import { type ServeStaticFactory } from './static.js';
24
24
  import { type AppSurfaceSpec, type AppSurfaceDiagnostic, type RpcEndpointSpec } from '../http/surface.js';
25
25
  import { type RouteSpec } from '../http/route_spec.js';
26
- import type { MiddlewareSpec } from '../http/middleware_spec.js';
26
+ import type { MiddlewareCarveOut, MiddlewareSpec } from '../http/middleware_spec.js';
27
27
  import { type BootstrapStatus } from '../auth/bootstrap_routes.js';
28
28
  import { type WsEndpointSpec } from '../actions/ws_endpoint_spec.js';
29
29
  import type { BackendWebsocketTransport } from '../actions/transports_ws_backend.js';
@@ -90,6 +90,18 @@ export interface AppServerOptions {
90
90
  session_options: SessionOptions<string>;
91
91
  /** Parsed allowed origin patterns. */
92
92
  allowed_origins: Array<RegExp>;
93
+ /**
94
+ * Paths the origin check skips, each with its reason. The check covers
95
+ * every path by default (`ORIGIN_MIDDLEWARE_PATH`) — a request with no
96
+ * `Origin` passes it anyway, so probes and CLI clients need no carve-out;
97
+ * one is for a path that refuses browser callers by other means. Copied at
98
+ * assembly, so a later change to this array changes nothing; assembly
99
+ * throws on a carve-out with no reason, or one that overlaps the auth
100
+ * middleware's scope (`AUTH_MIDDLEWARE_PATH`) — every route that reads or
101
+ * mints a credential, and every RPC, WS, and bootstrap endpoint, sits
102
+ * there (`assert_origin_carve_outs_valid`).
103
+ */
104
+ origin_carve_outs?: Array<MiddlewareCarveOut>;
93
105
  /** Trusted proxy options. */
94
106
  proxy: {
95
107
  trusted_proxies: Array<string>;
@@ -212,7 +224,8 @@ export interface AppServerOptions {
212
224
  * Add layers anywhere (before the proxy spec, between it and the auth
213
225
  * stack, between the auth layers, or after), but keep each of those specs
214
226
  * — its `handler`, not just its `name` — mounted once at its original path
215
- * (`'*'` for the proxy, `AUTH_MIDDLEWARE_PATH` for auth) in its original
227
+ * (`'*'` for the proxy and the origin check, `AUTH_MIDDLEWARE_PATH` for the
228
+ * rest of the auth stack) in its original
216
229
  * order: the endpoint auth-scope check (`assert_endpoint_in_auth_scope`)
217
230
  * and client-IP rate limiting (`get_client_ip`) assume it, so assembly
218
231
  * throws (`assert_middleware_stack_mounted`) if the transform moves, drops,
@@ -249,11 +262,11 @@ export interface AppServerOptions {
249
262
  * audits each newly expired role_grant offer once.
250
263
  *
251
264
  * **Off by default; a production server should turn it on.** Without it
252
- * nothing sweeps: expired session rows accumulate, a WebSocket or audit
253
- * stream outlives the expiry of the session it opened on until it
254
- * disconnects, and an offer's expiry is never audited. With it, a
255
- * connection outlives its session's expiry by at most one interval. The
256
- * Rust spine's servers all schedule the twin (`spawn_auth_cleanup`).
265
+ * nothing sweeps: expired session rows accumulate and an offer's expiry is
266
+ * never audited. Connections do not depend on it — each closes at its
267
+ * credential's deadline (`auth/credential_deadline.ts`), and the sweep's
268
+ * close repeats that one. The Rust spine's servers all schedule the twin
269
+ * (`spawn_auth_cleanup`).
257
270
  *
258
271
  * Pass `true` for the default interval
259
272
  * (`DEFAULT_AUTH_CLEANUP_INTERVAL_MS`), or `{interval_ms}` for another.
@@ -1 +1 @@
1
- {"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAIN,KAAK,WAAW,EAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACN,WAAW,EAMX,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,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IAC3D,aAAa,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;CACnE;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GACtC,OAAO,sBAAsB,KAC3B,KAAK,CAAC,oBAAoB,CAiD5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,SAAS,CAQpF,CAAC"}
@@ -25,7 +25,7 @@ import { apply_middleware_specs, apply_route_specs, prefix_route_specs } from '.
25
25
  import { check_bootstrap_status, create_bootstrap_route_specs } from '../auth/bootstrap_routes.js';
26
26
  import { create_surface_route_spec } from './surface_route.js';
27
27
  import { flush_pending_effects, flush_post_commit_effects } from '../http/pending_effects.js';
28
- import { assert_endpoint_in_auth_scope, assert_middleware_stack_mounted, create_auth_middleware_specs } from '../auth/middleware.js';
28
+ import { assert_credential_routes_in_auth_scope, assert_endpoint_in_auth_scope, assert_middleware_stack_mounted, create_auth_middleware_specs } from '../auth/middleware.js';
29
29
  import { fuz_auth_guard_resolver } from '../auth/auth_guard_resolver.js';
30
30
  import { create_fuz_authorization_handler } from '../auth/request_context.js';
31
31
  import { create_body_limit_middleware } from '../http/body_limit.js';
@@ -270,7 +270,7 @@ const assemble_app_server = async (options, releases) => {
270
270
  })
271
271
  : null;
272
272
  if (audit_sse) {
273
- releases.push(deps.connection_closer.add(create_sse_connection_closer(audit_sse.registry)));
273
+ releases.push(deps.connection_closer.add(create_sse_connection_closer(audit_sse.registry, audit_sse.required_role)));
274
274
  releases.push(deps.audit.add_listener(audit_sse.on_audit_event));
275
275
  }
276
276
  // Proxy middleware
@@ -279,7 +279,8 @@ const assemble_app_server = async (options, releases) => {
279
279
  const auth_middleware = await create_auth_middleware_specs(deps, {
280
280
  allowed_origins: options.allowed_origins,
281
281
  session_options: options.session_options,
282
- daemon_token_state: options.daemon_token_state
282
+ daemon_token_state: options.daemon_token_state,
283
+ origin_carve_outs: options.origin_carve_outs
283
284
  });
284
285
  const stack_specs = [proxy_spec, ...auth_middleware];
285
286
  let middleware_specs = stack_specs;
@@ -384,6 +385,10 @@ const assemble_app_server = async (options, releases) => {
384
385
  factory_routes.push(create_surface_route_spec(surface_ref));
385
386
  }
386
387
  const route_specs = [...consumer_routes, ...factory_routes];
388
+ // a route that reads or mints a credential outside the auth scope would
389
+ // skip session parsing or fall under an origin carve-out — consumer
390
+ // prefixes included (account and signup specs are relative)
391
+ assert_credential_routes_in_auth_scope(route_specs);
387
392
  // WS path checks — pure data, so they run before anything mounts.
388
393
  // `register_ws_endpoint` mounts a `GET path` upgrade route: a duplicate
389
394
  // path, or one a `RouteSpec` already registered as `GET path`, would be
@@ -60,7 +60,8 @@ export type ServerEnvOptionsResult = ServerEnvOptions | ServerEnvOptionsError;
60
60
  /**
61
61
  * Validate a loaded `BaseServerEnv` and produce the artifacts needed for server init.
62
62
  *
63
- * Handles keyring validation, origin parsing, and bootstrap token path extraction.
63
+ * Handles keyring validation, origin parsing (every refused allowlist entry is
64
+ * reported, each on its own line), and bootstrap token path extraction.
64
65
  * Returns a Result so callers handle errors their own way (exit, logging, etc).
65
66
  *
66
67
  * @param env - a loaded and Zod-validated `BaseServerEnv`
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAA4B,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG5E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;kBAoDxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,EA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gB,GAAG,qBAAqB,CAAC;AAE9E;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,aAAa,KAAG,sBAmBxD,CAAC"}
@@ -9,9 +9,8 @@
9
9
  * @module
10
10
  */
11
11
  import { z } from 'zod';
12
- import { to_error_message } from '@fuzdev/fuz_util/error.ts';
13
12
  import { create_validated_keyring } from '../auth/keyring.js';
14
- import { parse_allowed_origins } from '../http/origin.js';
13
+ import { format_allowed_origins_error, parse_allowed_origins } from '../http/origin.js';
15
14
  /**
16
15
  * Base Zod schema for server environment variables.
17
16
  *
@@ -76,7 +75,8 @@ export const BaseServerEnv = z.strictObject({
76
75
  /**
77
76
  * Validate a loaded `BaseServerEnv` and produce the artifacts needed for server init.
78
77
  *
79
- * Handles keyring validation, origin parsing, and bootstrap token path extraction.
78
+ * Handles keyring validation, origin parsing (every refused allowlist entry is
79
+ * reported, each on its own line), and bootstrap token path extraction.
80
80
  * Returns a Result so callers handle errors their own way (exit, logging, etc).
81
81
  *
82
82
  * @param env - a loaded and Zod-validated `BaseServerEnv`
@@ -87,28 +87,18 @@ export const validate_server_env = (env) => {
87
87
  if (!keyring_result.ok) {
88
88
  return { ok: false, field: 'SECRET_FUZ_COOKIE_KEYS', errors: keyring_result.errors };
89
89
  }
90
- let allowed_origins;
91
- try {
92
- allowed_origins = parse_allowed_origins(env.FUZ_ALLOWED_ORIGINS);
93
- }
94
- catch (err) {
95
- return {
96
- ok: false,
97
- field: 'FUZ_ALLOWED_ORIGINS',
98
- errors: [to_error_message(err, 'Invalid FUZ_ALLOWED_ORIGINS')]
99
- };
100
- }
101
- if (allowed_origins.length === 0) {
90
+ const origins_result = parse_allowed_origins(env.FUZ_ALLOWED_ORIGINS);
91
+ if (!origins_result.ok) {
102
92
  return {
103
93
  ok: false,
104
94
  field: 'FUZ_ALLOWED_ORIGINS',
105
- errors: ['FUZ_ALLOWED_ORIGINS contains no valid patterns']
95
+ errors: origins_result.errors.map(format_allowed_origins_error)
106
96
  };
107
97
  }
108
98
  return {
109
99
  ok: true,
110
100
  keyring: keyring_result.keyring,
111
- allowed_origins,
101
+ allowed_origins: origins_result.origins,
112
102
  bootstrap_token_path: env.FUZ_BOOTSTRAP_TOKEN_PATH ?? null
113
103
  };
114
104
  };
@@ -5,8 +5,10 @@
5
5
  *
6
6
  * - `GET /api/cells/:cell_id/facts/:hash` — the **per-reference read**.
7
7
  * The request names the referencing cell. Authz is scoped to that one
8
- * reference: `can_view_cell(caller, cell) AND cell.refs includes hash`.
9
- * This is the path non-admin callers use, and the only path for
8
+ * reference: `(can_view_cell(caller, cell) OR the steward arm) AND
9
+ * cell.refs includes hash`, the steward arm being the governing root's
10
+ * manager reading a pending or rejected contribution
11
+ * (`auth/cell_steward.ts`). This is the path non-admin callers use, and the only path for
10
12
  * confidential content.
11
13
  * - `GET /api/facts/:hash` — the **bare-hash read**, restricted to admins.
12
14
  *
@@ -52,7 +54,8 @@
52
54
  * (populated by the `/api/*` session middleware) by resolving the caller's
53
55
  * single actor and loading their role_grants. Unauthed callers pass through
54
56
  * with `req_ctx: null` and are admitted only by a `cell.visibility ===
55
- * 'public'` cell. Multi-actor accounts fall through with `req_ctx: null`
57
+ * 'public'` cell whose `moderation` admits an audience (unmoderated or
58
+ * `'approved'`). Multi-actor accounts fall through with `req_ctx: null`
56
59
  * — there's no `acting?` slot on a pure-public route, so multi-actor
57
60
  * callers are treated as anonymous.
58
61
  *
@@ -121,7 +124,8 @@ export interface CreateServeFactRouteSpecOptions {
121
124
  * — the per-reference read.
122
125
  *
123
126
  * Resolves the named cell (404 if missing / soft-deleted), requires
124
- * `can_view_cell(caller, cell)` AND `cell.refs` to include the hash
127
+ * `can_view_cell(caller, cell)` — or the steward arm,
128
+ * `cell_steward_admits` — AND `cell.refs` to include the hash
125
129
  * (else 404, masked), then serves the bytes. Authz is scoped to this one
126
130
  * `(cell, hash)` edge — never unioned across the fact's other referrers.
127
131
  *
@@ -1 +1 @@
1
- {"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAetD,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAM/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkEjD,MAAM,WAAW,+BAA+B;IAC/C;;;;;;OAMG;IACH,IAAI,EAAE,OAAO,CAAC;IACd,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ;AAkHD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,GAC7C,SAAS,+BAA+B,KACtC,SAgDF,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,+BAA+B,KACtC,SA2CF,CAAC"}
1
+ {"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAetD,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAO/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkEjD,MAAM,WAAW,+BAA+B;IAC/C;;;;;;OAMG;IACH,IAAI,EAAE,OAAO,CAAC;IACd,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ;AAkHD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iCAAiC,GAC7C,SAAS,+BAA+B,KACtC,SAuDF,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,+BAA+B,KACtC,SA2CF,CAAC"}
@@ -5,8 +5,10 @@
5
5
  *
6
6
  * - `GET /api/cells/:cell_id/facts/:hash` — the **per-reference read**.
7
7
  * The request names the referencing cell. Authz is scoped to that one
8
- * reference: `can_view_cell(caller, cell) AND cell.refs includes hash`.
9
- * This is the path non-admin callers use, and the only path for
8
+ * reference: `(can_view_cell(caller, cell) OR the steward arm) AND
9
+ * cell.refs includes hash`, the steward arm being the governing root's
10
+ * manager reading a pending or rejected contribution
11
+ * (`auth/cell_steward.ts`). This is the path non-admin callers use, and the only path for
10
12
  * confidential content.
11
13
  * - `GET /api/facts/:hash` — the **bare-hash read**, restricted to admins.
12
14
  *
@@ -52,7 +54,8 @@
52
54
  * (populated by the `/api/*` session middleware) by resolving the caller's
53
55
  * single actor and loading their role_grants. Unauthed callers pass through
54
56
  * with `req_ctx: null` and are admitted only by a `cell.visibility ===
55
- * 'public'` cell. Multi-actor accounts fall through with `req_ctx: null`
57
+ * 'public'` cell whose `moderation` admits an audience (unmoderated or
58
+ * `'approved'`). Multi-actor accounts fall through with `req_ctx: null`
56
59
  * — there's no `acting?` slot on a pure-public route, so multi-actor
57
60
  * callers are treated as anonymous.
58
61
  *
@@ -106,6 +109,7 @@ import { query_get_fact, query_get_fact_meta } from '../db/fact_queries.js';
106
109
  import { query_cell_get } from '../db/cell_queries.js';
107
110
  import { query_cell_grant_list_for_cell } from '../db/cell_grant_queries.js';
108
111
  import { can_view_cell } from '../auth/cell_authorize.js';
112
+ import { cell_steward_admits } from '../auth/cell_steward.js';
109
113
  import { parse_file_fact_url } from '../db/file_fact_url.js';
110
114
  /** `Cache-Control` for fact responses — 5 min revocation window. */
111
115
  const CACHE_CONTROL = 'private, max-age=300';
@@ -254,7 +258,8 @@ const build_public_request_context = async (c, route) => {
254
258
  * — the per-reference read.
255
259
  *
256
260
  * Resolves the named cell (404 if missing / soft-deleted), requires
257
- * `can_view_cell(caller, cell)` AND `cell.refs` to include the hash
261
+ * `can_view_cell(caller, cell)` — or the steward arm,
262
+ * `cell_steward_admits` — AND `cell.refs` to include the hash
258
263
  * (else 404, masked), then serves the bytes. Authz is scoped to this one
259
264
  * `(cell, hash)` edge — never unioned across the fact's other referrers.
260
265
  *
@@ -268,7 +273,8 @@ export const create_serve_cell_fact_route_spec = (options) => {
268
273
  method: 'GET',
269
274
  path: '/api/cells/:cell_id/facts/:hash',
270
275
  auth: { account: 'none', actor: 'none' },
271
- description: 'Serve content-addressed fact bytes through a named referencing cell. 404 unless the cell admits the caller via can_view_cell AND references the hash (per-reference, never union-of-referrers).',
276
+ reads_credential: true,
277
+ description: "Serve content-addressed fact bytes through a named referencing cell. 404 unless the cell admits the caller via can_view_cell (or the steward arm: the governing root's manager reading a pending or rejected contribution) AND references the hash (per-reference, never union-of-referrers).",
272
278
  params: cell_fact_params_schema,
273
279
  input: z.null(),
274
280
  // The body is a binary stream; no JSON output schema applies.
@@ -297,7 +303,11 @@ export const create_serve_cell_fact_route_spec = (options) => {
297
303
  const grants = req_ctx
298
304
  ? await query_cell_grant_list_for_cell({ db: route.db }, cell.id)
299
305
  : null;
300
- if (!can_view_cell(req_ctx, cell, grants)) {
306
+ // The governing root's manager also reads a pending or rejected
307
+ // contribution's facts (the steward arm, `auth/cell_steward.ts`),
308
+ // checked only once the view check denies.
309
+ if (!can_view_cell(req_ctx, cell, grants) &&
310
+ !(await cell_steward_admits({ db: route.db }, req_ctx, cell))) {
301
311
  // 404 (not 403) so an unviewable cell→fact edge doesn't leak.
302
312
  return c.body(null, 404);
303
313
  }