@fuzdev/fuz_app 0.180.0 → 0.182.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 (389) hide show
  1. package/dist/actions/CLAUDE.md +38 -20
  2. package/dist/actions/action_rpc.d.ts +25 -6
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +56 -48
  5. package/dist/actions/action_types.d.ts +31 -13
  6. package/dist/actions/action_types.d.ts.map +1 -1
  7. package/dist/actions/action_types.js +1 -1
  8. package/dist/actions/notification_sender.d.ts +83 -0
  9. package/dist/actions/notification_sender.d.ts.map +1 -0
  10. package/dist/actions/notification_sender.js +85 -0
  11. package/dist/actions/perform_action.d.ts +13 -4
  12. package/dist/actions/perform_action.d.ts.map +1 -1
  13. package/dist/actions/perform_action.js +27 -18
  14. package/dist/actions/register_action_ws.d.ts +20 -2
  15. package/dist/actions/register_action_ws.d.ts.map +1 -1
  16. package/dist/actions/register_action_ws.js +17 -5
  17. package/dist/actions/ws_socket_session.d.ts +3 -0
  18. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  19. package/dist/actions/ws_socket_session.js +3 -2
  20. package/dist/auth/CLAUDE.md +84 -59
  21. package/dist/auth/account_actions.d.ts.map +1 -1
  22. package/dist/auth/account_actions.js +30 -3
  23. package/dist/auth/account_queries.d.ts +213 -2
  24. package/dist/auth/account_queries.d.ts.map +1 -1
  25. package/dist/auth/account_queries.js +255 -2
  26. package/dist/auth/account_route_schema.d.ts +26 -16
  27. package/dist/auth/account_route_schema.d.ts.map +1 -1
  28. package/dist/auth/account_route_schema.js +10 -24
  29. package/dist/auth/account_routes.d.ts +5 -7
  30. package/dist/auth/account_routes.d.ts.map +1 -1
  31. package/dist/auth/account_routes.js +110 -89
  32. package/dist/auth/admin_actions.d.ts.map +1 -1
  33. package/dist/auth/admin_actions.js +117 -25
  34. package/dist/auth/api_token_queries.d.ts +29 -12
  35. package/dist/auth/api_token_queries.d.ts.map +1 -1
  36. package/dist/auth/api_token_queries.js +42 -27
  37. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  38. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  39. package/dist/auth/audit_log_routes.d.ts +1 -1
  40. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  41. package/dist/auth/audit_log_routes.js +10 -12
  42. package/dist/auth/audit_log_schema.js +4 -4
  43. package/dist/auth/bearer_auth.d.ts +4 -3
  44. package/dist/auth/bearer_auth.d.ts.map +1 -1
  45. package/dist/auth/bearer_auth.js +37 -32
  46. package/dist/auth/bootstrap_account.d.ts +65 -37
  47. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_account.js +115 -66
  49. package/dist/auth/bootstrap_route_schema.d.ts +6 -2
  50. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  51. package/dist/auth/bootstrap_route_schema.js +7 -2
  52. package/dist/auth/bootstrap_routes.d.ts +50 -33
  53. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  54. package/dist/auth/bootstrap_routes.js +109 -87
  55. package/dist/auth/bootstrap_token_store.d.ts +60 -0
  56. package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
  57. package/dist/auth/bootstrap_token_store.js +39 -0
  58. package/dist/auth/credential_headers.d.ts +71 -0
  59. package/dist/auth/credential_headers.d.ts.map +1 -0
  60. package/dist/auth/credential_headers.js +100 -0
  61. package/dist/auth/daemon_token.d.ts +13 -1
  62. package/dist/auth/daemon_token.d.ts.map +1 -1
  63. package/dist/auth/daemon_token.js +14 -2
  64. package/dist/auth/daemon_token_middleware.d.ts +10 -11
  65. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  66. package/dist/auth/daemon_token_middleware.js +39 -30
  67. package/dist/auth/deps.d.ts +10 -11
  68. package/dist/auth/deps.d.ts.map +1 -1
  69. package/dist/auth/invite_queries.d.ts +18 -0
  70. package/dist/auth/invite_queries.d.ts.map +1 -1
  71. package/dist/auth/invite_queries.js +24 -0
  72. package/dist/auth/request_context.d.ts +97 -76
  73. package/dist/auth/request_context.d.ts.map +1 -1
  74. package/dist/auth/request_context.js +93 -104
  75. package/dist/auth/resolved_auth.d.ts +10 -5
  76. package/dist/auth/resolved_auth.d.ts.map +1 -1
  77. package/dist/auth/resolved_auth.js +2 -2
  78. package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
  79. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  80. package/dist/auth/role_grant_offer_action_specs.js +5 -3
  81. package/dist/auth/role_grant_offer_actions.d.ts +7 -11
  82. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  83. package/dist/auth/role_grant_offer_actions.js +97 -106
  84. package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
  85. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  86. package/dist/auth/role_grant_offer_ddl.js +9 -2
  87. package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
  88. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  89. package/dist/auth/role_grant_offer_notifications.js +75 -22
  90. package/dist/auth/role_grant_offer_queries.d.ts +143 -9
  91. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  92. package/dist/auth/role_grant_offer_queries.js +266 -66
  93. package/dist/auth/role_grant_offer_schema.js +1 -1
  94. package/dist/auth/role_grant_queries.d.ts +57 -10
  95. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  96. package/dist/auth/role_grant_queries.js +81 -22
  97. package/dist/auth/role_grant_sql.d.ts +21 -0
  98. package/dist/auth/role_grant_sql.d.ts.map +1 -1
  99. package/dist/auth/role_grant_sql.js +21 -0
  100. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  101. package/dist/auth/self_service_role_actions.js +9 -2
  102. package/dist/auth/session_cookie.d.ts +105 -25
  103. package/dist/auth/session_cookie.d.ts.map +1 -1
  104. package/dist/auth/session_cookie.js +124 -15
  105. package/dist/auth/session_middleware.d.ts +83 -54
  106. package/dist/auth/session_middleware.d.ts.map +1 -1
  107. package/dist/auth/session_middleware.js +92 -66
  108. package/dist/auth/session_queries.d.ts +95 -14
  109. package/dist/auth/session_queries.d.ts.map +1 -1
  110. package/dist/auth/session_queries.js +98 -19
  111. package/dist/auth/signup_route_schema.d.ts +5 -5
  112. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  113. package/dist/auth/signup_route_schema.js +4 -4
  114. package/dist/auth/signup_routes.d.ts.map +1 -1
  115. package/dist/auth/signup_routes.js +17 -14
  116. package/dist/auth/standard_rpc_actions.d.ts +6 -19
  117. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  118. package/dist/auth/standard_rpc_actions.js +5 -6
  119. package/dist/auth/token_scope.d.ts +6 -8
  120. package/dist/auth/token_scope.d.ts.map +1 -1
  121. package/dist/auth/token_scope.js +6 -9
  122. package/dist/dev/setup.d.ts +6 -1
  123. package/dist/dev/setup.d.ts.map +1 -1
  124. package/dist/dev/setup.js +42 -34
  125. package/dist/hono_context.d.ts +21 -0
  126. package/dist/hono_context.d.ts.map +1 -1
  127. package/dist/hono_context.js +17 -0
  128. package/dist/http/CLAUDE.md +156 -48
  129. package/dist/http/auth_shape.d.ts +4 -4
  130. package/dist/http/common_routes.js +1 -1
  131. package/dist/http/db_routes.d.ts +4 -3
  132. package/dist/http/db_routes.d.ts.map +1 -1
  133. package/dist/http/db_routes.js +14 -14
  134. package/dist/http/dev_route_error_check.d.ts +6 -3
  135. package/dist/http/dev_route_error_check.d.ts.map +1 -1
  136. package/dist/http/dev_route_error_check.js +6 -3
  137. package/dist/http/dev_set_cookie_check.d.ts +53 -0
  138. package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
  139. package/dist/http/dev_set_cookie_check.js +80 -0
  140. package/dist/http/error_schemas.d.ts +45 -22
  141. package/dist/http/error_schemas.d.ts.map +1 -1
  142. package/dist/http/error_schemas.js +53 -26
  143. package/dist/http/header_lines.d.ts +42 -0
  144. package/dist/http/header_lines.d.ts.map +1 -0
  145. package/dist/http/header_lines.js +80 -0
  146. package/dist/http/host.d.ts +12 -9
  147. package/dist/http/host.d.ts.map +1 -1
  148. package/dist/http/host.js +25 -20
  149. package/dist/http/origin.d.ts +7 -22
  150. package/dist/http/origin.d.ts.map +1 -1
  151. package/dist/http/origin.js +11 -25
  152. package/dist/http/proxy.d.ts +1 -0
  153. package/dist/http/proxy.d.ts.map +1 -1
  154. package/dist/http/proxy.js +3 -0
  155. package/dist/http/request_headers.d.ts +95 -0
  156. package/dist/http/request_headers.d.ts.map +1 -0
  157. package/dist/http/request_headers.js +110 -0
  158. package/dist/http/request_target.d.ts +134 -0
  159. package/dist/http/request_target.d.ts.map +1 -0
  160. package/dist/http/request_target.js +193 -0
  161. package/dist/http/route_error_check.d.ts +4 -11
  162. package/dist/http/route_error_check.d.ts.map +1 -1
  163. package/dist/http/route_error_check.js +4 -21
  164. package/dist/http/route_result.d.ts +127 -23
  165. package/dist/http/route_result.d.ts.map +1 -1
  166. package/dist/http/route_result.js +97 -19
  167. package/dist/http/route_spec.d.ts +299 -83
  168. package/dist/http/route_spec.d.ts.map +1 -1
  169. package/dist/http/route_spec.js +548 -71
  170. package/dist/http/simple_request.d.ts +19 -14
  171. package/dist/http/simple_request.d.ts.map +1 -1
  172. package/dist/http/simple_request.js +17 -29
  173. package/dist/http/surface.d.ts +2 -0
  174. package/dist/http/surface.d.ts.map +1 -1
  175. package/dist/http/surface.js +4 -1
  176. package/dist/realtime/outbound_budget.d.ts +1 -2
  177. package/dist/realtime/outbound_budget.d.ts.map +1 -1
  178. package/dist/realtime/outbound_budget.js +1 -2
  179. package/dist/realtime/sse.d.ts +47 -17
  180. package/dist/realtime/sse.d.ts.map +1 -1
  181. package/dist/realtime/sse.js +115 -93
  182. package/dist/realtime/sse_constants.d.ts +7 -1
  183. package/dist/realtime/sse_constants.d.ts.map +1 -1
  184. package/dist/realtime/sse_constants.js +12 -1
  185. package/dist/realtime/sse_registry.d.ts +3 -3
  186. package/dist/realtime/sse_registry.js +3 -3
  187. package/dist/runtime/deps.d.ts +20 -4
  188. package/dist/runtime/deps.d.ts.map +1 -1
  189. package/dist/runtime/mock.d.ts +7 -1
  190. package/dist/runtime/mock.d.ts.map +1 -1
  191. package/dist/runtime/mock.js +33 -3
  192. package/dist/runtime/node.d.ts.map +1 -1
  193. package/dist/runtime/node.js +2 -1
  194. package/dist/runtime/secure_file.d.ts +71 -10
  195. package/dist/runtime/secure_file.d.ts.map +1 -1
  196. package/dist/runtime/secure_file.js +91 -11
  197. package/dist/server/app_backend.d.ts +0 -8
  198. package/dist/server/app_backend.d.ts.map +1 -1
  199. package/dist/server/app_backend.js +4 -4
  200. package/dist/server/app_server.d.ts +54 -33
  201. package/dist/server/app_server.d.ts.map +1 -1
  202. package/dist/server/app_server.js +69 -41
  203. package/dist/server/serve_fact_route.d.ts +3 -3
  204. package/dist/server/serve_fact_route.d.ts.map +1 -1
  205. package/dist/server/serve_fact_route.js +59 -55
  206. package/dist/server/static.d.ts +20 -0
  207. package/dist/server/static.d.ts.map +1 -1
  208. package/dist/server/static.js +56 -8
  209. package/dist/server/unmatched_route.d.ts +42 -0
  210. package/dist/server/unmatched_route.d.ts.map +1 -0
  211. package/dist/server/unmatched_route.js +64 -0
  212. package/dist/testing/CLAUDE.md +406 -1202
  213. package/dist/testing/app_server.d.ts +3 -1
  214. package/dist/testing/app_server.d.ts.map +1 -1
  215. package/dist/testing/app_server.js +5 -9
  216. package/dist/testing/auth_apps.d.ts.map +1 -1
  217. package/dist/testing/auth_apps.js +3 -2
  218. package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
  219. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  220. package/dist/testing/cross_backend/account_lifecycle.js +320 -6
  221. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
  222. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  223. package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
  224. package/dist/testing/cross_backend/capabilities.d.ts +68 -5
  225. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  226. package/dist/testing/cross_backend/capabilities.js +20 -4
  227. package/dist/testing/cross_backend/cell_gated_create.js +1 -1
  228. package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
  229. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  230. package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
  231. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  232. package/dist/testing/cross_backend/conformance_table.js +179 -23
  233. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  234. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
  235. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  236. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
  237. package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
  238. package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
  239. package/dist/testing/cross_backend/credential_conformance.js +296 -0
  240. package/dist/testing/cross_backend/credential_conformance.json +1284 -0
  241. package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
  242. package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
  243. package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
  244. package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
  245. package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
  246. package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
  247. package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
  248. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
  249. package/dist/testing/cross_backend/credential_wire.js +188 -0
  250. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  251. package/dist/testing/cross_backend/default_backend_configs.js +22 -2
  252. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
  253. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  254. package/dist/testing/cross_backend/default_spine_surface.js +3 -7
  255. package/dist/testing/cross_backend/differential.d.ts +1 -1
  256. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  257. package/dist/testing/cross_backend/differential.js +3 -2
  258. package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
  259. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  260. package/dist/testing/cross_backend/differential_normalize.js +11 -5
  261. package/dist/testing/cross_backend/full_spine_mount.d.ts +4 -10
  262. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  263. package/dist/testing/cross_backend/full_spine_mount.js +11 -4
  264. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  265. package/dist/testing/cross_backend/identity_parity.js +4 -0
  266. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  267. package/dist/testing/cross_backend/in_process_setup.js +78 -4
  268. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  269. package/dist/testing/cross_backend/login_security.js +13 -10
  270. package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
  271. package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
  272. package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
  273. package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
  274. package/dist/testing/cross_backend/request_header_conformance.js +196 -0
  275. package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
  276. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
  277. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
  278. package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
  279. package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
  280. package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
  281. package/dist/testing/cross_backend/request_target_conformance.js +186 -0
  282. package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
  283. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
  284. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
  285. package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
  286. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  287. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
  288. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
  289. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  290. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +185 -31
  291. package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
  292. package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
  293. package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
  294. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
  295. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  296. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
  297. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  298. package/dist/testing/cross_backend/session_cap.js +82 -34
  299. package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
  300. package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
  301. package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
  302. package/dist/testing/cross_backend/session_login.d.ts +24 -0
  303. package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
  304. package/dist/testing/cross_backend/session_login.js +31 -0
  305. package/dist/testing/cross_backend/setup.d.ts +117 -0
  306. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  307. package/dist/testing/cross_backend/setup.js +193 -9
  308. package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
  309. package/dist/testing/cross_backend/simple_request.js +5 -0
  310. package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
  311. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  312. package/dist/testing/cross_backend/spine_suites.js +88 -5
  313. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  314. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  315. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  316. package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
  317. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  318. package/dist/testing/cross_backend/sse_round_trip.js +205 -64
  319. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  320. package/dist/testing/cross_backend/testing_backdoor.js +5 -2
  321. package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
  322. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
  323. package/dist/testing/cross_backend/testing_credential_read.js +175 -0
  324. package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
  325. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  326. package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
  327. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  328. package/dist/testing/cross_backend/token_lifetime.js +58 -2
  329. package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
  330. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  331. package/dist/testing/cross_backend/transport_composition.js +13 -10
  332. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  333. package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
  334. package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
  335. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  336. package/dist/testing/cross_backend/ws_endpoint.js +19 -2
  337. package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
  338. package/dist/testing/cross_backend/ws_role_gated.js +2 -3
  339. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  340. package/dist/testing/cross_backend/ws_round_trip.js +28 -12
  341. package/dist/testing/cross_backend/xfail.d.ts +44 -11
  342. package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
  343. package/dist/testing/cross_backend/xfail.js +68 -23
  344. package/dist/testing/data_exposure.d.ts.map +1 -1
  345. package/dist/testing/data_exposure.js +4 -3
  346. package/dist/testing/integration.d.ts +1 -2
  347. package/dist/testing/integration.d.ts.map +1 -1
  348. package/dist/testing/integration.js +14 -8
  349. package/dist/testing/integration_helpers.d.ts +50 -3
  350. package/dist/testing/integration_helpers.d.ts.map +1 -1
  351. package/dist/testing/integration_helpers.js +87 -9
  352. package/dist/testing/middleware.d.ts +3 -1
  353. package/dist/testing/middleware.d.ts.map +1 -1
  354. package/dist/testing/middleware.js +14 -7
  355. package/dist/testing/resolved_auth.d.ts +3 -1
  356. package/dist/testing/resolved_auth.d.ts.map +1 -1
  357. package/dist/testing/resolved_auth.js +4 -4
  358. package/dist/testing/round_trip.d.ts +6 -2
  359. package/dist/testing/round_trip.d.ts.map +1 -1
  360. package/dist/testing/round_trip.js +17 -6
  361. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  362. package/dist/testing/rpc_envelope_cases.js +7 -0
  363. package/dist/testing/rpc_helpers.d.ts +4 -2
  364. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  365. package/dist/testing/rpc_helpers.js +6 -1
  366. package/dist/testing/rpc_round_trip.d.ts +13 -2
  367. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  368. package/dist/testing/rpc_round_trip.js +25 -6
  369. package/dist/testing/schema_generators.d.ts +2 -2
  370. package/dist/testing/schema_generators.d.ts.map +1 -1
  371. package/dist/testing/schema_generators.js +4 -4
  372. package/dist/testing/stubs.d.ts +2 -2
  373. package/dist/testing/stubs.d.ts.map +1 -1
  374. package/dist/testing/stubs.js +13 -10
  375. package/dist/testing/transports/fetch_transport.d.ts +6 -3
  376. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  377. package/dist/testing/transports/fetch_transport.js +31 -19
  378. package/dist/testing/transports/raw_http.d.ts +61 -1
  379. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  380. package/dist/testing/transports/raw_http.js +61 -1
  381. package/dist/testing/transports/ws_raw_client.d.ts +20 -0
  382. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  383. package/dist/testing/transports/ws_raw_client.js +10 -4
  384. package/dist/testing/transports/ws_transport.d.ts +21 -1
  385. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  386. package/dist/testing/transports/ws_transport.js +58 -20
  387. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  388. package/dist/testing/ws_round_trip.js +8 -4
  389. package/package.json +1 -1
@@ -10,9 +10,9 @@
10
10
  import { Hono, type Context } from 'hono';
11
11
  import type { UpgradeWebSocket } from 'hono/ws';
12
12
  import type { AnySchema } from '@fuzdev/fuz_schema/schema.ts';
13
- import { type SessionOptions, type SessionCookieOptions } from '../auth/session_cookie.js';
14
- import type { BootstrapAccountSuccess } from '../auth/bootstrap_account.js';
15
- import type { EventSpec } from '../realtime/sse.js';
13
+ import { type SessionOptions } from '../auth/session_cookie.js';
14
+ import type { BootstrapTokenStore } from '../auth/bootstrap_token_store.js';
15
+ import { type EventSpec } from '../realtime/sse.js';
16
16
  import { type AuditLogSse } from '../realtime/audit_log_sse.js';
17
17
  import { RateLimiter, type RateLimiterMode, type RateLimiterOptions } from '../rate_limiter.js';
18
18
  import type { DaemonTokenState } from '../auth/daemon_token.js';
@@ -24,7 +24,7 @@ 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
26
  import type { MiddlewareCarveOut, MiddlewareSpec } from '../http/middleware_spec.js';
27
- import { type BootstrapStatus } from '../auth/bootstrap_routes.js';
27
+ import { type BootstrapStatus, type OnBootstrap } from '../auth/bootstrap_routes.js';
28
28
  import { type EffectErrorContext } from '../http/pending_effects.js';
29
29
  import { type WsEndpointSpec } from '../actions/ws_endpoint_spec.js';
30
30
  import type { ConnectionRegistry } from '../actions/connection_registry.js';
@@ -47,7 +47,7 @@ import { type AuthCleanupScheduleOptions } from '../auth/cleanup.js';
47
47
  * `check_bootstrap_status`. For tests asserting on the
48
48
  * disabled-but-present wire shape.
49
49
  * - `live` — route mounted, real token verification. Success path
50
- * reachable. `token_path` is required (non-nullable).
50
+ * reachable. `token_store` is required.
51
51
  */
52
52
  export type BootstrapServerOptions = BootstrapDisabledOptions | BootstrapSurfaceOnlyOptions | BootstrapLiveOptions;
53
53
  export interface BootstrapDisabledOptions {
@@ -60,14 +60,16 @@ export interface BootstrapSurfaceOnlyOptions {
60
60
  }
61
61
  export interface BootstrapLiveOptions {
62
62
  mode: 'live';
63
- token_path: string;
64
- /** Route prefix for bootstrap routes. Default `'/api/account'`; must sit under `/api/`. */
65
- route_prefix?: string;
66
63
  /**
67
- * Called after successful bootstrap (account + session created).
68
- * Use for app-specific post-bootstrap work like generating API tokens.
64
+ * The one-shot token — production passes
65
+ * `create_file_bootstrap_token_store(runtime, path)` over
66
+ * `FUZ_BOOTSTRAP_TOKEN_PATH`.
69
67
  */
70
- on_bootstrap?: (result: BootstrapAccountSuccess, c: Context) => Promise<void>;
68
+ token_store: BootstrapTokenStore;
69
+ /** Route prefix for bootstrap routes. Default `'/api/account'`; must sit under `/api/`. */
70
+ route_prefix?: string;
71
+ /** Called after a successful bootstrap commits (see `OnBootstrap`). */
72
+ on_bootstrap?: OnBootstrap;
71
73
  }
72
74
  /**
73
75
  * Configuration for `create_app_server()`.
@@ -78,7 +80,12 @@ export interface BootstrapLiveOptions {
78
80
  export interface AppServerOptions {
79
81
  /** Pre-initialized backend from `create_app_backend()`. */
80
82
  backend: AppBackend;
81
- /** Session options for cookie-based auth. */
83
+ /**
84
+ * Session options for cookie-based auth. Assembly throws on options that
85
+ * cannot write the cookie: a `cookie_name` that is no RFC 6265 cookie-name,
86
+ * or — found by minting a sample cookie — an `encode_identity` or `max_age`
87
+ * the `Set-Cookie` grammar cannot carry.
88
+ */
82
89
  session_options: SessionOptions<string>;
83
90
  /**
84
91
  * Parsed allowed origin patterns, as `parse_allowed_origins` returns them
@@ -356,7 +363,7 @@ export interface AppServerOptions {
356
363
  * `(ctx: AppServerContext) => ReadonlyArray<WsEndpointSpec>`
357
364
  * (evaluated after the server context is assembled). Use the factory
358
365
  * form when action lists depend on `ctx.deps` — e.g. when spreading
359
- * `create_standard_rpc_actions({...ctx.deps, notification_sender})` over WS.
366
+ * `create_standard_rpc_actions(ctx.deps)` over WS.
360
367
  *
361
368
  * When non-empty, `upgrade_websocket` must be supplied (throws
362
369
  * otherwise). A factory returning `[]` does NOT trip the check —
@@ -380,7 +387,11 @@ export interface AppServerOptions {
380
387
  * the revocation handlers' post-commit closes reach its sockets, and so
381
388
  * does the one revocation guard `create_app_server` registers on that
382
389
  * closer (`create_revocation_guard`) when it mounts a WS endpoint or the
383
- * audit stream. `AppServer.close` removes it again.
390
+ * audit stream. Each is added to `deps.notification_sender` too, so a
391
+ * notification any action handler sends — over HTTP RPC or a socket —
392
+ * reaches the account's sockets on every mounted registry, once per
393
+ * registry however many endpoints share it. `AppServer.close` removes
394
+ * both memberships again.
384
395
  */
385
396
  ws_endpoints?: ReadonlyArray<WsEndpointSpec> | ((context: AppServerContext) => ReadonlyArray<WsEndpointSpec>);
386
397
  /**
@@ -465,14 +476,16 @@ export interface AppServer {
465
476
  * a closed registry hosts no other server
466
477
  * 3. release what assembly acquired, last acquired first: remove the
467
478
  * audit listeners `create_app_server` registered on `deps.audit` (the
468
- * revocation guard, the audit-log SSE listener) and the closer members it added to
469
- * `deps.connection_closer` (each mounted connection registry, the audit stream
470
- * registry), and `dispose` the rate limiters it built for omitted
471
- * options — never one passed in, which its caller owns. A release that
472
- * throws is logged and the rest still run. The backend's emitter and
473
- * closer are left as they were before assembly, so a failed assembly
474
- * can be retried on the same backend, and a backend whose `close` you
475
- * own (a test harness) can host another server
479
+ * revocation guard, the audit-log SSE listener), the members it added
480
+ * to `deps.connection_closer` (each mounted connection registry, the
481
+ * audit stream registry) and to `deps.notification_sender` (each
482
+ * mounted connection registry), and `dispose` the rate limiters it
483
+ * built for omitted options — never one passed in, which its caller
484
+ * owns. A release that throws is logged and the rest still run. The
485
+ * backend's emitter, closer and notification sender are left as they
486
+ * were before assembly, so a failed assembly can be retried on the same
487
+ * backend, and a backend whose `close` you own (a test harness) can
488
+ * host another server
476
489
  * 4. close the database connection (`AppBackend.close`)
477
490
  *
478
491
  * Idempotent: a second call settles with the first one's outcome (a failed
@@ -592,8 +605,6 @@ export declare const resolve_rate_limiters: (options: Pick<AppServerOptions, App
592
605
  * @internal
593
606
  */
594
607
  export interface ConfigDiagnosticsInput {
595
- /** The session cookie overrides, from `AppServerOptions.session_options`. */
596
- cookie_options: Partial<SessionCookieOptions> | undefined;
597
608
  /** The `rate_limiters` mode, defaulted. */
598
609
  rate_limiter_mode: RateLimiterMode;
599
610
  /** The resolved limiters, from `resolve_rate_limiters`. */
@@ -603,7 +614,7 @@ export interface ConfigDiagnosticsInput {
603
614
  }
604
615
  /**
605
616
  * The config-level diagnostics `create_app_server` appends to the surface's
606
- * spec-level ones: a weakened session cookie, and an open rate-limited
617
+ * spec-level ones: an open rate-limited
607
618
  * surface — one warning for `'disabled_for_testing'`, otherwise one per
608
619
  * explicitly-null limiter, so a deployment that disables login's limiter but
609
620
  * keeps signup's reads differently from one that disables both — and a
@@ -619,8 +630,14 @@ export declare const collect_config_diagnostics: (input: ConfigDiagnosticsInput)
619
630
  * middleware → auth middleware → bootstrap status → route specs (consumer,
620
631
  * bootstrap, RPC endpoints, surface) → surface generation → Hono app assembly
621
632
  * (routes, then WS endpoints) → post-route middleware → static serving → the
622
- * auth cleanup schedule. Database migrations belong to the backend lifecycle —
623
- * pass `migration_namespaces` to `create_app_backend`.
633
+ * unmatched-route handler → the auth cleanup schedule. Database migrations
634
+ * belong to the backend lifecycle — pass `migration_namespaces` to
635
+ * `create_app_backend`.
636
+ *
637
+ * The app routes on the raw request path (`get_request_path`), as the Rust
638
+ * spine's router does, and answers a request no route serves from
639
+ * `create_unmatched_route_handler`: a method its path doesn't serve is a 405
640
+ * with `Allow`, a path no route serves a 404, JSON under the auth scope.
624
641
  *
625
642
  * When `audit_log_sse` is set, the SSE registry's listener is registered via
626
643
  * `backend.deps.audit.add_listener` — no shallow-copy of `AppDeps`. That
@@ -628,7 +645,10 @@ export declare const collect_config_diagnostics: (input: ConfigDiagnosticsInput)
628
645
  * to `backend.deps.connection_closer`, so the revocation handlers built from
629
646
  * `ctx.deps` close their connections with no further wiring, and — when the
630
647
  * server mounts either — one `create_revocation_guard` listener on that closer
631
- * repeats each close on the audit row.
648
+ * repeats each close on the audit row. Each WebSocket connection registry is
649
+ * added to `backend.deps.notification_sender` as well, the sender every
650
+ * mounted RPC and WebSocket dispatcher puts on its handler contexts, so an
651
+ * action's notification reaches the account's sockets with no wiring either.
632
652
  * The
633
653
  * `audit_sse` field on the returned `AppServer` (and the
634
654
  * `AppServerContext` passed to `create_route_specs`) is non-null in that
@@ -637,11 +657,12 @@ export declare const collect_config_diagnostics: (input: ConfigDiagnosticsInput)
637
657
  *
638
658
  * Assembly acquires a few things that outlive it — the rate limiters it
639
659
  * builds, the listeners it registers on `deps.audit`, the members it adds to
640
- * `deps.connection_closer` — and records a release for each as it goes. When
641
- * assembly throws, every release recorded so far runs, last acquired first
642
- * (one that throws is logged and the rest still run), and the original error
643
- * is rethrown: a failed assembly leaves the backend's emitter and closer as
644
- * it found them and no limiter timer running. When `auth_cleanup` is set, the
660
+ * `deps.connection_closer` and `deps.notification_sender` — and records a
661
+ * release for each as it goes. When assembly throws, every release recorded
662
+ * so far runs, last acquired first (one that throws is logged and the rest
663
+ * still run), and the original error is rethrown: a failed assembly leaves
664
+ * the backend's emitter, closer and notification sender as it found them and
665
+ * no limiter timer running. When `auth_cleanup` is set, the
645
666
  * auth cleanup schedule starts as the last step of assembly — nothing after
646
667
  * it can throw, so an assembly that throws leaves no schedule running.
647
668
  *
@@ -1 +1 @@
1
- {"version":3,"file":"app_server.d.ts","sourceRoot":"","sources":["../../src/lib/server/app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B,KAAG,OAAO,CAAC,SAAS,CAQpF,CAAC"}
@@ -9,7 +9,9 @@
9
9
  */
10
10
  import { Hono } from 'hono';
11
11
  import { logger } from 'hono/logger';
12
- import { session_cookie_options } from '../auth/session_cookie.js';
12
+ import { SESSION_AGE_MAX, create_session_cookie_value, format_session_set_cookie, is_cookie_name } from '../auth/session_cookie.js';
13
+ import { generate_session_token } from '../auth/session_queries.js';
14
+ import { create_sse_stream } from '../realtime/sse.js';
13
15
  import { create_audit_log_sse, create_sse_connection_closer, audit_log_event_specs } from '../realtime/audit_log_sse.js';
14
16
  import { BaseServerEnv } from './env.js';
15
17
  import { RateLimiter, announce_rate_limiters_disabled, default_login_ip_rate_limit, default_login_account_rate_limit, default_action_account_rate_limit, default_action_ip_rate_limit } from '../rate_limiter.js';
@@ -18,10 +20,13 @@ import { RateLimiter, announce_rate_limiters_disabled, default_login_ip_rate_lim
18
20
  import '../hono_context.js';
19
21
  import { create_proxy_middleware_spec } from '../http/proxy.js';
20
22
  import { create_static_middleware } from './static.js';
23
+ import { create_unmatched_route_handler } from './unmatched_route.js';
24
+ import { get_request_path } from '../http/request_target.js';
21
25
  import { log_startup_summary } from './startup.js';
22
26
  import { create_app_error_handler } from './app_error_handler.js';
23
27
  import { create_app_surface_spec } from '../http/surface.js';
24
28
  import { create_dev_route_error_check } from '../http/dev_route_error_check.js';
29
+ import { create_dev_set_cookie_check } from '../http/dev_set_cookie_check.js';
25
30
  import { apply_middleware_specs, apply_route_specs, prefix_route_specs } from '../http/route_spec.js';
26
31
  import { check_bootstrap_status, create_bootstrap_route_specs } from '../auth/bootstrap_routes.js';
27
32
  import { create_surface_route_spec } from './surface_route.js';
@@ -129,7 +134,7 @@ export const resolve_rate_limiters = (options) => {
129
134
  };
130
135
  /**
131
136
  * The config-level diagnostics `create_app_server` appends to the surface's
132
- * spec-level ones: a weakened session cookie, and an open rate-limited
137
+ * spec-level ones: an open rate-limited
133
138
  * surface — one warning for `'disabled_for_testing'`, otherwise one per
134
139
  * explicitly-null limiter, so a deployment that disables login's limiter but
135
140
  * keeps signup's reads differently from one that disables both — and a
@@ -139,30 +144,6 @@ export const resolve_rate_limiters = (options) => {
139
144
  */
140
145
  export const collect_config_diagnostics = (input) => {
141
146
  const diagnostics = [];
142
- const { cookie_options } = input;
143
- if (cookie_options) {
144
- if (cookie_options.secure === false) {
145
- diagnostics.push({
146
- level: 'warning',
147
- category: 'security',
148
- message: 'Session cookie secure=false — cookies sent over HTTP'
149
- });
150
- }
151
- if (cookie_options.sameSite && cookie_options.sameSite !== session_cookie_options.sameSite) {
152
- diagnostics.push({
153
- level: 'warning',
154
- category: 'security',
155
- message: `Session cookie sameSite='${cookie_options.sameSite}' — weakened from default '${session_cookie_options.sameSite}'`
156
- });
157
- }
158
- if (cookie_options.httpOnly === false) {
159
- diagnostics.push({
160
- level: 'warning',
161
- category: 'security',
162
- message: 'Session cookie httpOnly=false — cookie accessible to JS'
163
- });
164
- }
165
- }
166
147
  if (input.rate_limiter_mode === 'disabled_for_testing') {
167
148
  // one warning for the mode rather than one per limiter it nulled
168
149
  diagnostics.push({
@@ -200,8 +181,14 @@ export const collect_config_diagnostics = (input) => {
200
181
  * middleware → auth middleware → bootstrap status → route specs (consumer,
201
182
  * bootstrap, RPC endpoints, surface) → surface generation → Hono app assembly
202
183
  * (routes, then WS endpoints) → post-route middleware → static serving → the
203
- * auth cleanup schedule. Database migrations belong to the backend lifecycle —
204
- * pass `migration_namespaces` to `create_app_backend`.
184
+ * unmatched-route handler → the auth cleanup schedule. Database migrations
185
+ * belong to the backend lifecycle — pass `migration_namespaces` to
186
+ * `create_app_backend`.
187
+ *
188
+ * The app routes on the raw request path (`get_request_path`), as the Rust
189
+ * spine's router does, and answers a request no route serves from
190
+ * `create_unmatched_route_handler`: a method its path doesn't serve is a 405
191
+ * with `Allow`, a path no route serves a 404, JSON under the auth scope.
205
192
  *
206
193
  * When `audit_log_sse` is set, the SSE registry's listener is registered via
207
194
  * `backend.deps.audit.add_listener` — no shallow-copy of `AppDeps`. That
@@ -209,7 +196,10 @@ export const collect_config_diagnostics = (input) => {
209
196
  * to `backend.deps.connection_closer`, so the revocation handlers built from
210
197
  * `ctx.deps` close their connections with no further wiring, and — when the
211
198
  * server mounts either — one `create_revocation_guard` listener on that closer
212
- * repeats each close on the audit row.
199
+ * repeats each close on the audit row. Each WebSocket connection registry is
200
+ * added to `backend.deps.notification_sender` as well, the sender every
201
+ * mounted RPC and WebSocket dispatcher puts on its handler contexts, so an
202
+ * action's notification reaches the account's sockets with no wiring either.
213
203
  * The
214
204
  * `audit_sse` field on the returned `AppServer` (and the
215
205
  * `AppServerContext` passed to `create_route_specs`) is non-null in that
@@ -218,11 +208,12 @@ export const collect_config_diagnostics = (input) => {
218
208
  *
219
209
  * Assembly acquires a few things that outlive it — the rate limiters it
220
210
  * builds, the listeners it registers on `deps.audit`, the members it adds to
221
- * `deps.connection_closer` — and records a release for each as it goes. When
222
- * assembly throws, every release recorded so far runs, last acquired first
223
- * (one that throws is logged and the rest still run), and the original error
224
- * is rethrown: a failed assembly leaves the backend's emitter and closer as
225
- * it found them and no limiter timer running. When `auth_cleanup` is set, the
211
+ * `deps.connection_closer` and `deps.notification_sender` — and records a
212
+ * release for each as it goes. When assembly throws, every release recorded
213
+ * so far runs, last acquired first (one that throws is logged and the rest
214
+ * still run), and the original error is rethrown: a failed assembly leaves
215
+ * the backend's emitter, closer and notification sender as it found them and
216
+ * no limiter timer running. When `auth_cleanup` is set, the
226
217
  * auth cleanup schedule starts as the last step of assembly — nothing after
227
218
  * it can throw, so an assembly that throws leaves no schedule running.
228
219
  *
@@ -268,6 +259,23 @@ const assemble_app_server = async (options, releases) => {
268
259
  const { deps } = backend;
269
260
  const { log } = deps;
270
261
  // option checks first, before anything is acquired
262
+ if (!is_cookie_name(options.session_options.cookie_name)) {
263
+ // a name the `Cookie` grammar cannot carry would be written as a header
264
+ // that reads back differently — refused here rather than at the first login
265
+ throw new Error(`create_app_server: session cookie name ${JSON.stringify(options.session_options.cookie_name)} is not an RFC 6265 cookie-name`);
266
+ }
267
+ // Mint a sample cookie the way a login does. Options that cannot write one
268
+ // — an `encode_identity` emitting a character outside the cookie grammar, a
269
+ // `max_age` that is no whole number of seconds — would otherwise throw at
270
+ // the first mint, which for bootstrap comes after its one-shot token is
271
+ // spent.
272
+ try {
273
+ format_session_set_cookie(options.session_options.cookie_name, await create_session_cookie_value(deps.keyring, generate_session_token(), options.session_options), options.session_options.max_age ?? SESSION_AGE_MAX);
274
+ }
275
+ catch (error) {
276
+ throw new Error('create_app_server: session_options cannot mint a session cookie — ' +
277
+ (error instanceof Error ? error.message : String(error)), { cause: error });
278
+ }
271
279
  if (options.allowed_origins.length === 0) {
272
280
  throw new Error('create_app_server: allowed_origins is empty — list at least one origin pattern ' +
273
281
  '(an empty list refuses every browser request)');
@@ -341,8 +349,8 @@ const assemble_app_server = async (options, releases) => {
341
349
  // - 'surface_only': route mounted but permanently unavailable; status placeholder.
342
350
  // - 'live': real disk + lock check via `check_bootstrap_status`.
343
351
  const bootstrap_status = options.bootstrap?.mode === 'live'
344
- ? await check_bootstrap_status(deps, { token_path: options.bootstrap.token_path })
345
- : { available: false, token_path: null };
352
+ ? await check_bootstrap_status(deps, { token_store: options.bootstrap.token_store })
353
+ : { available: false };
346
354
  // Surface route ref — factory manages the circular ref
347
355
  const surface_ref = {
348
356
  surface: {
@@ -375,6 +383,7 @@ const assemble_app_server = async (options, releases) => {
375
383
  const bootstrap_routes = create_bootstrap_route_specs(deps, {
376
384
  session_options: options.session_options,
377
385
  bootstrap_status,
386
+ token_store: options.bootstrap.mode === 'live' ? options.bootstrap.token_store : null,
378
387
  on_bootstrap: options.bootstrap.mode === 'live' ? options.bootstrap.on_bootstrap : undefined,
379
388
  bootstrap_ip_rate_limiter
380
389
  });
@@ -398,7 +407,8 @@ const assemble_app_server = async (options, releases) => {
398
407
  actions: endpoint.actions,
399
408
  log,
400
409
  action_ip_rate_limiter,
401
- action_account_rate_limiter
410
+ action_account_rate_limiter,
411
+ notification_sender: deps.notification_sender
402
412
  }));
403
413
  }
404
414
  }
@@ -505,7 +515,6 @@ const assemble_app_server = async (options, releases) => {
505
515
  });
506
516
  // Config-level diagnostics (concatenated after spec-level from generate_app_surface)
507
517
  const config_diagnostics = collect_config_diagnostics({
508
- cookie_options: options.session_options.cookie_options,
509
518
  rate_limiter_mode,
510
519
  rate_limiters,
511
520
  max_body_size: options.max_body_size
@@ -516,8 +525,9 @@ const assemble_app_server = async (options, releases) => {
516
525
  // Backfill the surface ref — factory owns this lifecycle
517
526
  surface_ref.surface = surface_spec.surface;
518
527
  log_startup_summary(surface_spec.surface, log, options.env_values);
519
- // Hono app assembly
520
- const app = new Hono();
528
+ // Hono app assembly, routing on the raw path: nothing is percent-decoded
529
+ // before the router, so every path-keyed layer reads the spelling it matched
530
+ const app = new Hono({ getPath: get_request_path });
521
531
  // A throw that escapes every route catch — a credential leg's failed read
522
532
  // above all — answers here: 503 for a failed pool checkout, Hono's default
523
533
  // 500 for anything else.
@@ -531,6 +541,12 @@ const assemble_app_server = async (options, releases) => {
531
541
  });
532
542
  if (dev_route_error_check)
533
543
  app.use('*', dev_route_error_check);
544
+ // DEV only, beside it: logs a response that does not lead with the
545
+ // `Set-Cookie` line the session middleware put on the context — one built
546
+ // past the context, by a layer the route system doesn't own
547
+ const dev_set_cookie_check = create_dev_set_cookie_check({ log });
548
+ if (dev_set_cookie_check)
549
+ app.use('*', dev_set_cookie_check);
534
550
  // Two-queue side-effect flush. `pending_effects` collects eager
535
551
  // fire-and-forget promises (audit emits, api-token usage). `post_commit_effects` collects deferred thunks pushed via
536
552
  // `emit_after_commit` (WS notifications, anything that must observe a
@@ -575,7 +591,10 @@ const assemble_app_server = async (options, releases) => {
575
591
  }
576
592
  apply_middleware_specs(app, middleware_specs);
577
593
  const authorize = create_fuz_authorization_handler({ db: deps.db });
578
- apply_route_specs(app, route_specs, fuz_auth_guard_resolver, log, deps.db, authorize);
594
+ apply_route_specs(app, route_specs, fuz_auth_guard_resolver, log, deps.db, {
595
+ authorize,
596
+ open_sse: create_sse_stream
597
+ });
579
598
  // WS endpoint auto-mount — must run after `app` exists and
580
599
  // `apply_route_specs` has registered the request routes. Each spec
581
600
  // becomes a `register_action_ws` call. `post_route_middleware` and static
@@ -606,12 +625,17 @@ const assemble_app_server = async (options, releases) => {
606
625
  required_roles: endpoint.required_roles,
607
626
  action_ip_rate_limiter,
608
627
  action_account_rate_limiter,
628
+ notification_sender: deps.notification_sender,
609
629
  on_effect_error
610
630
  });
611
631
  mounted_ws_endpoints[endpoint.path] = endpoint_registry;
612
632
  // every revocation's close — the handlers' and the guard's — reaches
613
633
  // this registry
614
634
  releases.push(deps.connection_closer.add(endpoint_registry));
635
+ // and so does every action's notification, from either transport; a
636
+ // registry two endpoints share is one member, so no socket hears a
637
+ // notification twice
638
+ releases.push(deps.notification_sender.add(endpoint_registry));
615
639
  }
616
640
  }
617
641
  // Post-route middleware (before static serving)
@@ -625,6 +649,10 @@ const assemble_app_server = async (options, releases) => {
625
649
  app.use('/*', mw);
626
650
  }
627
651
  }
652
+ // What no route answers: a 405 where the path serves another method, else
653
+ // the 404 — read from the app's own router, so every route registered on
654
+ // it counts, one added after assembly included
655
+ app.notFound(create_unmatched_route_handler(app.router));
628
656
  // Auth cleanup — opt-in, and last: nothing after it can throw, so a failed
629
657
  // assembly never leaves a schedule running. Its own throw (an invalid
630
658
  // `interval_ms`) comes before any pass starts, and unwinds `releases` like
@@ -71,14 +71,14 @@
71
71
  * Auth shape on the cell-scoped route is `{account: 'none', actor: 'none'}`
72
72
  * — the dispatcher's authorization phase is skipped for pure-public routes,
73
73
  * so the handler builds the `RequestContext` itself from the resolved account
74
- * id (`get_public_account_id`, over what the `/api/*` auth middleware set) by
74
+ * (`get_public_account`, over what the `/api/*` auth middleware set) by
75
75
  * resolving the caller's single actor and loading their role_grants.
76
76
  * Unauthed callers pass through with `req_ctx: null` and are admitted only by
77
77
  * a `cell.visibility === 'public'` cell whose `moderation` admits an audience (unmoderated or
78
78
  * `'approved'`). Multi-actor accounts fall through with `req_ctx: null`
79
79
  * — there's no `acting?` slot on a pure-public route, so multi-actor
80
80
  * callers are treated as anonymous. A scope-narrowed API token is treated as
81
- * anonymous too, not refused (`get_public_account_id`): a narrowed token
81
+ * anonymous too, not refused (`get_public_account`): a narrowed token
82
82
  * reaches no non-RPC surface, but on a route that admits anonymous callers
83
83
  * a 403 would enforce nothing — the holder drops the `Authorization` header and
84
84
  * re-reads every public cell anyway.
@@ -160,7 +160,7 @@ export interface CreateServeFactRouteSpecOptions {
160
160
  * other referrers.
161
161
  *
162
162
  * Pure-public auth — the handler builds the per-request `RequestContext`
163
- * from the resolved account id (`get_public_account_id`) and enforces
163
+ * from the resolved account id (`get_public_account`) and enforces
164
164
  * visibility per-reference.
165
165
  */
166
166
  export declare const create_serve_cell_fact_route_spec: (options: CreateServeFactRouteSpecOptions) => RouteSpec;
@@ -1 +1 @@
1
- {"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmIG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AActD,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkBjD,MAAM,WAAW,+BAA+B;IAC/C,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ;AAsJD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iCAAiC,GAC7C,SAAS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