@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
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Pushing a server-initiated JSON-RPC notification to an account's live
3
+ * WebSocket connections.
4
+ *
5
+ * **Why the handler context carries it.** A notification carries a domain
6
+ * payload (an offer, a revoked grant) that only the handler holds, so the
7
+ * handler builds the message and queues the send after its commit
8
+ * (`queue_offer_notification` in `auth/role_grant_offer_notifications.ts`).
9
+ * `perform_action` puts the sender on every `ActionContext`, so no action
10
+ * factory takes one and none can be wired with the wrong one: an offer
11
+ * created over HTTP RPC must reach the recipient's sockets on the WebSocket
12
+ * registry, which a sender bound to any other registry would miss silently.
13
+ *
14
+ * **Why a fan-out.** `create_app_backend` puts one
15
+ * `RealtimeNotificationSender` on `AppDeps.notification_sender`, and
16
+ * `create_app_server` adds every WebSocket connection registry it mounts.
17
+ * The registries are created at mount, after the RPC and WebSocket action
18
+ * factories run, so a sender read at send time is the only one that reaches
19
+ * them. A server mounting no WebSocket endpoint holds an empty fan-out, and
20
+ * its sends reach no one.
21
+ *
22
+ * Twin of the Rust spine's `NotificationSender` and `NoopNotificationSender`;
23
+ * the Rust backend serves one connection registry on every endpoint, which
24
+ * the fan-out stands in for.
25
+ *
26
+ * @module
27
+ */
28
+ import type { Uuid } from '../primitive_schemas.js';
29
+ import type { JsonrpcNotification } from '../http/jsonrpc.js';
30
+ /**
31
+ * Send a JSON-RPC notification to every admitted socket bound to an account.
32
+ *
33
+ * `ConnectionRegistry` satisfies this structurally — its `send_to_account`
34
+ * accepts the broader `JsonrpcMessageFromServerToClient`. The interface
35
+ * stays narrow so handlers don't couple to the concrete registry and tests
36
+ * can capture sends with no WebSocket machinery.
37
+ *
38
+ * Returns how many sockets accepted the notification — bookkeeping, not a
39
+ * delivery receipt; `0` means the account has no live socket.
40
+ */
41
+ export interface NotificationSender {
42
+ send_to_account: (account_id: Uuid, message: JsonrpcNotification) => number;
43
+ }
44
+ /**
45
+ * A `NotificationSender` that sends nothing — for a hand-mounted dispatcher
46
+ * whose actions have no live connection to reach.
47
+ */
48
+ export declare const noop_notification_sender: NotificationSender;
49
+ /**
50
+ * One `NotificationSender` over every WebSocket connection registry of a
51
+ * backend.
52
+ *
53
+ * Each send reaches every member and returns the sum, so an account with
54
+ * sockets on two registries hears the notification on each. A member that
55
+ * throws does not stop the others: every member is called, then the first
56
+ * error is thrown for the caller (the post-commit flush) to log.
57
+ */
58
+ export interface RealtimeNotificationSender extends NotificationSender {
59
+ /**
60
+ * Add a registry's sender, returning a remover for this addition.
61
+ *
62
+ * Membership is by reference: a sender added twice — two endpoints sharing
63
+ * one registry — is one member, and every send reaches it once, so no
64
+ * socket hears a notification twice. Each `add` is counted, and its
65
+ * remover releases only that count: the sender stays a member until every
66
+ * addition is removed. Calling a remover again is a no-op.
67
+ *
68
+ * @param sender - the registry's sender
69
+ * @returns a remover for this addition, idempotent
70
+ */
71
+ add: (sender: NotificationSender) => () => void;
72
+ /** Count of distinct members — introspection for tests and diagnostics. */
73
+ member_count: () => number;
74
+ }
75
+ /**
76
+ * Create an empty `RealtimeNotificationSender`.
77
+ *
78
+ * `create_app_backend` creates the one on `AppDeps.notification_sender`, and
79
+ * `create_app_server` adds each WebSocket connection registry it mounts,
80
+ * removing them when its assembly fails or the server closes.
81
+ */
82
+ export declare const create_realtime_notification_sender: () => RealtimeNotificationSender;
83
+ //# sourceMappingURL=notification_sender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification_sender.d.ts","sourceRoot":"","sources":["../../src/lib/actions/notification_sender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IAClC,eAAe,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,KAAK,MAAM,CAAC;CAC5E;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,kBAErC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACrE;;;;;;;;;;;OAWG;IACH,GAAG,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,MAAM,IAAI,CAAC;IAChD,2EAA2E;IAC3E,YAAY,EAAE,MAAM,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mCAAmC,QAAO,0BAqCtD,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Pushing a server-initiated JSON-RPC notification to an account's live
3
+ * WebSocket connections.
4
+ *
5
+ * **Why the handler context carries it.** A notification carries a domain
6
+ * payload (an offer, a revoked grant) that only the handler holds, so the
7
+ * handler builds the message and queues the send after its commit
8
+ * (`queue_offer_notification` in `auth/role_grant_offer_notifications.ts`).
9
+ * `perform_action` puts the sender on every `ActionContext`, so no action
10
+ * factory takes one and none can be wired with the wrong one: an offer
11
+ * created over HTTP RPC must reach the recipient's sockets on the WebSocket
12
+ * registry, which a sender bound to any other registry would miss silently.
13
+ *
14
+ * **Why a fan-out.** `create_app_backend` puts one
15
+ * `RealtimeNotificationSender` on `AppDeps.notification_sender`, and
16
+ * `create_app_server` adds every WebSocket connection registry it mounts.
17
+ * The registries are created at mount, after the RPC and WebSocket action
18
+ * factories run, so a sender read at send time is the only one that reaches
19
+ * them. A server mounting no WebSocket endpoint holds an empty fan-out, and
20
+ * its sends reach no one.
21
+ *
22
+ * Twin of the Rust spine's `NotificationSender` and `NoopNotificationSender`;
23
+ * the Rust backend serves one connection registry on every endpoint, which
24
+ * the fan-out stands in for.
25
+ *
26
+ * @module
27
+ */
28
+ /**
29
+ * A `NotificationSender` that sends nothing — for a hand-mounted dispatcher
30
+ * whose actions have no live connection to reach.
31
+ */
32
+ export const noop_notification_sender = Object.freeze({
33
+ send_to_account: () => 0
34
+ });
35
+ /**
36
+ * Create an empty `RealtimeNotificationSender`.
37
+ *
38
+ * `create_app_backend` creates the one on `AppDeps.notification_sender`, and
39
+ * `create_app_server` adds each WebSocket connection registry it mounts,
40
+ * removing them when its assembly fails or the server closes.
41
+ */
42
+ export const create_realtime_notification_sender = () => {
43
+ // member → how many additions hold it; iteration order is first addition
44
+ const members = new Map();
45
+ return Object.freeze({
46
+ add: (sender) => {
47
+ members.set(sender, (members.get(sender) ?? 0) + 1);
48
+ let removed = false;
49
+ return () => {
50
+ if (removed)
51
+ return;
52
+ removed = true;
53
+ const count = members.get(sender);
54
+ if (count === undefined)
55
+ return;
56
+ if (count <= 1)
57
+ members.delete(sender);
58
+ else
59
+ members.set(sender, count - 1);
60
+ };
61
+ },
62
+ member_count: () => members.size,
63
+ send_to_account: (account_id, message) => {
64
+ let count = 0;
65
+ let failed = false;
66
+ let first_error;
67
+ for (const member of members.keys()) {
68
+ try {
69
+ count += member.send_to_account(account_id, message);
70
+ }
71
+ catch (error) {
72
+ // keep going — one registry's failure must not keep the
73
+ // notification from the account's sockets on another
74
+ if (!failed) {
75
+ failed = true;
76
+ first_error = error;
77
+ }
78
+ }
79
+ }
80
+ if (failed)
81
+ throw first_error;
82
+ return count;
83
+ }
84
+ });
85
+ };
@@ -71,6 +71,7 @@ import { type JsonrpcRequestId, type JsonrpcErrorObject } from '../http/jsonrpc.
71
71
  import type { RateLimiter } from '../rate_limiter.js';
72
72
  import type { RpcAction } from './action_types.js';
73
73
  import type { RequestClient } from './peer_request.js';
74
+ import type { NotificationSender } from './notification_sender.js';
74
75
  /**
75
76
  * Per-call inputs to `perform_action`. Each transport assembles this from
76
77
  * its wire envelope + connection identity.
@@ -89,10 +90,10 @@ export interface PerformActionInput {
89
90
  * post-authorization gates read, and its type and session hash what the
90
91
  * handler sees on `ActionContext`.
91
92
  */
92
- auth: ResolvedAuth | null;
93
+ credential: ResolvedAuth | null;
93
94
  /** Resolved client IP (`'unknown'` if upstream couldn't resolve). */
94
95
  client_ip: string;
95
- /** Per-request abort signal. HTTP: `c.req.raw.signal`. WS: `AbortSignal.any([socket, request])`. */
96
+ /** Per-request abort signal. HTTP: `RouteContext.signal`. WS: `AbortSignal.any([socket, request])`. */
96
97
  signal: AbortSignal;
97
98
  /** Send a request-scoped notification. HTTP: DEV-warn-and-drop. WS: socket-scoped. */
98
99
  notify: (method: string, params: unknown) => void;
@@ -138,6 +139,14 @@ export interface PerformActionDeps {
138
139
  post_commit_effects: Array<() => void | Promise<void>>;
139
140
  /** Logger threaded into `ActionContext.log`. */
140
141
  log: Logger;
142
+ /**
143
+ * Threaded into `ActionContext.notification_sender` — the backend's one
144
+ * sender on both transports, so a send from an HTTP handler reaches the
145
+ * WebSocket registries. Under DEV the handler gets it wrapped in
146
+ * `create_validated_notification_sender`, so every send site is checked
147
+ * as DEV output validation checks every result.
148
+ */
149
+ notification_sender: NotificationSender;
141
150
  /** Per-IP limiter (shared across transports). `null` disables. */
142
151
  action_ip_rate_limiter: RateLimiter | null;
143
152
  /** Per-account limiter (shared across transports). `null` disables. */
@@ -146,7 +155,7 @@ export interface PerformActionDeps {
146
155
  /**
147
156
  * Discriminated result of `perform_action`. Each transport binds this to
148
157
  * its wire shape: HTTP RPC folds the error into a JSON-RPC envelope and
149
- * returns it as a `route_raw` result over `c.body`; WS sends the response
158
+ * returns it as a `route_raw` result; WS sends the response
150
159
  * over the socket.
151
160
  */
152
161
  export type PerformActionResult = {
@@ -165,7 +174,7 @@ export type PerformActionResult = {
165
174
  * Phase order: 401 → authz → 403 → 429 → 400 → handler. On the test-preset path
166
175
  * the dispatcher skips the live authorization phase and uses the supplied
167
176
  * pre-baked context for post-authorization checks; the 401 still fires when
168
- * the harness omits `auth`.
177
+ * the harness omits `credential`.
169
178
  */
170
179
  export declare const perform_action: (input: PerformActionInput, deps: PerformActionDeps) => Promise<PerformActionResult>;
171
180
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"perform_action.d.ts","sourceRoot":"","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAS,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAOtC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAGvB,MAAM,oBAAoB,CAAC;AAkB5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAgC,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,kEAAkE;IAClE,MAAM,EAAE,SAAS,CAAC;IAClB,qGAAqG;IACrG,UAAU,EAAE,OAAO,CAAC;IACpB,sDAAsD;IACtD,UAAU,EAAE,gBAAgB,CAAC;IAC7B;;;;;;OAMG;IACH,IAAI,EAAE,YAAY,GAAG,IAAI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,MAAM,mBAAmB,GAC9B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhG;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAC1B,OAAO,kBAAkB,EACzB,MAAM,iBAAiB,KACrB,OAAO,CAAC,mBAAmB,CAgM7B,CAAC;AA8BF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GACnC,OAAO,SAAS,EAChB,QAAQ,aAAa,CAAC,WAAW,CAAC,EAClC,QAAQ,OAAO,KACb,kBAOF,CAAC;AAiEF;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,GAC1C,2BAA2B,aAAa,CAAC,MAAM,CAAC,KAC9C,kBAIA,CAAC;AAqEJ,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,GACnC,IAAI,gBAAgB,EACpB,QAAQ,mBAAmB,EAC3B,QAAQ,MAAM,EACd,KAAK,MAAM,KACT,sBAkBF,CAAC"}
@@ -76,6 +76,7 @@ import { create_jsonrpc_error_response, create_jsonrpc_response } from '../http/
76
76
  import { jsonrpc_error_messages, jsonrpc_error_code_to_http_status, http_status_to_jsonrpc_error_code, JSONRPC_ERROR_CODES, dev_only, to_thrown_jsonrpc_error } from '../http/jsonrpc_errors.js';
77
77
  import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_PARAMS_NUL, ERROR_PARAMS_PROTO_KEY, ERROR_TOKEN_SCOPE_REQUIRED } from '../http/error_schemas.js';
78
78
  import { is_public_auth, needs_actor, parse_acting } from '../http/auth_shape.js';
79
+ import { create_validated_notification_sender } from '../auth/role_grant_offer_notifications.js';
79
80
  import { token_scope_admits_method, token_scope_method_capability } from '../auth/token_scope.js';
80
81
  /**
81
82
  * The shared dispatch core. Pure data — no Hono context, no socket. Each
@@ -85,16 +86,16 @@ import { token_scope_admits_method, token_scope_method_capability } from '../aut
85
86
  * Phase order: 401 → authz → 403 → 429 → 400 → handler. On the test-preset path
86
87
  * the dispatcher skips the live authorization phase and uses the supplied
87
88
  * pre-baked context for post-authorization checks; the 401 still fires when
88
- * the harness omits `auth`.
89
+ * the harness omits `credential`.
89
90
  */
90
91
  export const perform_action = async (input, deps) => {
91
- const { action, raw_params, request_id: id, auth, client_ip, signal, notify, connection_id, request_client, preset } = input;
92
- const { db, pending_effects, post_commit_effects, log, action_ip_rate_limiter, action_account_rate_limiter } = deps;
92
+ const { action, raw_params, request_id: id, credential, client_ip, signal, notify, connection_id, request_client, preset } = input;
93
+ const { db, pending_effects, post_commit_effects, log, notification_sender, action_ip_rate_limiter, action_account_rate_limiter } = deps;
93
94
  const { spec, handler } = action;
94
95
  const action_auth = spec.auth;
95
- const account_id = auth?.account_id ?? null;
96
+ const account = credential?.account ?? null;
96
97
  // step 1: pre-authorization auth — 401 short-circuit.
97
- const pre = check_action_auth_pre_authorization(action_auth, account_id);
98
+ const pre = check_action_auth_pre_authorization(action_auth, account?.id ?? null);
98
99
  if (pre)
99
100
  return error_result(pre);
100
101
  // step 2: authorization phase. `acting` reads off the raw params rather
@@ -114,12 +115,16 @@ export const perform_action = async (input, deps) => {
114
115
  // dispatcher does.
115
116
  let result;
116
117
  try {
117
- result = await apply_authorization_phase({ db }, account_id, action_auth, read_acting(action_auth, raw_params));
118
+ result = await apply_authorization_phase({ db }, account, action_auth, read_acting(action_auth, raw_params));
118
119
  }
119
120
  catch (err) {
120
121
  return thrown_error_result(err, `authorization phase error: ${spec.method}`, log);
121
122
  }
122
123
  if (!result.ok) {
124
+ // an account removed since its credential was read: the dead
125
+ // credential's 401, as the pre-authorization gate answers it
126
+ if (result.status === 401)
127
+ return error_result(unauthenticated_error());
123
128
  const { error: reason, ...rest } = result.body;
124
129
  const code = http_status_to_jsonrpc_error_code(result.status);
125
130
  return {
@@ -133,7 +138,7 @@ export const perform_action = async (input, deps) => {
133
138
  request_context = result.request_context;
134
139
  }
135
140
  // step 3: post-authorization auth — credential gate, then scope, then role.
136
- const post = check_action_auth_post_authorization(action_auth, request_context, auth, action.spec.method);
141
+ const post = check_action_auth_post_authorization(action_auth, request_context, credential, action.spec.method);
137
142
  if (post)
138
143
  return error_result(post);
139
144
  // step 4: rate limit — throttle-requests semantics (record on every
@@ -208,10 +213,11 @@ export const perform_action = async (input, deps) => {
208
213
  pending_effects,
209
214
  post_commit_effects,
210
215
  client_ip,
211
- credential_type: auth?.credential_type ?? null,
212
- session_hash: resolved_auth_session_hash(auth),
216
+ credential_type: credential?.credential_type ?? null,
217
+ session_hash: resolved_auth_session_hash(credential),
213
218
  log,
214
219
  notify,
220
+ notification_sender: create_validated_notification_sender(notification_sender, log),
215
221
  signal
216
222
  };
217
223
  const output = await handler(validated_input, action_context);
@@ -321,18 +327,21 @@ const read_acting = (auth, raw_params) => {
321
327
  */
322
328
  const check_action_auth_pre_authorization = (auth, account_id) => {
323
329
  if (auth.account === 'required' || auth.actor === 'required') {
324
- if (account_id == null) {
325
- // Carry the reason on `error.data.reason` (symmetric with the 403
326
- // credential / role gates) so a 401 can be asserted on reason, not
327
- // just status. The reason is generic — it leaks nothing about
328
- // whether a credential was present or what the route demanded.
329
- return jsonrpc_error_messages.unauthenticated('unauthenticated', {
330
- reason: ERROR_AUTHENTICATION_REQUIRED
331
- });
332
- }
330
+ if (account_id == null)
331
+ return unauthenticated_error();
333
332
  }
334
333
  return null;
335
334
  };
335
+ /**
336
+ * The dead or missing credential's 401. Carries the reason on
337
+ * `error.data.reason` (symmetric with the 403 credential / role gates) so a
338
+ * 401 can be asserted on reason, not just status. The reason is generic — it
339
+ * leaks nothing about whether a credential was present or what the route
340
+ * demanded.
341
+ */
342
+ const unauthenticated_error = () => jsonrpc_error_messages.unauthenticated('unauthenticated', {
343
+ reason: ERROR_AUTHENTICATION_REQUIRED
344
+ });
336
345
  /**
337
346
  * The credential-type 403 — one builder, so the dispatcher's gate below and a
338
347
  * handler that gates a credential channel on its input (`account_delete`'s
@@ -22,14 +22,18 @@
22
22
  * observe far more than it was granted.
23
23
  * 4. **Authorization phase** (`run_authorization_phase`) — the acting actor
24
24
  * from the `?acting=<uuid>` query string (`parse_acting`; malformed reads
25
- * as omitted), against the authenticated account, building the
25
+ * as omitted, but a query holding an escape that doesn't decode, in any
26
+ * key, is a 400 `invalid_query_params` — `read_request_query_pairs`),
27
+ * against the authenticated account, building the
26
28
  * `RequestContext` per-message dispatch reads (400s on actor selection).
27
29
  * Multi-actor accounts must supply `?acting`; single-actor accounts work
28
30
  * without it.
29
31
  * 5. `require_role(required_roles)`, for a gated endpoint (403).
30
32
  *
31
33
  * Only `GET` is mounted (Hono serves `HEAD` through it), so any other method
32
- * on the path is a 404. The guards run as middleware ahead of
34
+ * on the path is the assembled server's 405 (`server/unmatched_route.ts`),
35
+ * and a `GET` the guards admit that asks for no upgrade passes on to its
36
+ * 404. The guards run as middleware ahead of
33
37
  * `upgradeWebSocket`, whose callback must return `WSEvents` and so cannot
34
38
  * produce a refusal.
35
39
  *
@@ -61,6 +65,7 @@ import { type Logger as LoggerType } from '@fuzdev/fuz_util/log.ts';
61
65
  import type { RoleName } from '../auth/role_schema.js';
62
66
  import type { EffectErrorContext } from '../http/pending_effects.js';
63
67
  import type { RateLimiter } from '../rate_limiter.js';
68
+ import type { NotificationSender } from './notification_sender.js';
64
69
  import type { Db } from '../db/db.js';
65
70
  import { type Action } from './action_types.js';
66
71
  import type { RealtimeCloser } from './connection_closer.js';
@@ -248,6 +253,19 @@ export interface RegisterActionWsOptions {
248
253
  * dispatcher.
249
254
  */
250
255
  action_account_rate_limiter: RateLimiter | null;
256
+ /**
257
+ * What every handler's `ctx.notification_sender` sends through — the
258
+ * backend's (`AppDeps.notification_sender`), the one `create_app_server`
259
+ * passes, so a frame's action notifies sockets on every registry the
260
+ * backend mounts, not just this endpoint's. Required, with no default: a
261
+ * sender left out would drop every notification silently. Unlike
262
+ * `connection_closer`, it is only sent through: this endpoint's registry
263
+ * joins the backend's sender when `create_app_server` adds it, so a hand
264
+ * mount over that sender adds the returned registry itself
265
+ * (`RealtimeNotificationSender.add`). A harness with one registry passes
266
+ * that registry; `noop_notification_sender` sends nothing.
267
+ */
268
+ notification_sender: NotificationSender;
251
269
  /**
252
270
  * Called when an eager pending effect of a frame's action rejects, after
253
271
  * the rejection is logged — the WS half of `create_app_server`'s
@@ -1 +1 @@
1
- {"version":3,"file":"register_action_ws.d.ts","sourceRoot":"","sources":["../../src/lib/actions/register_action_ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAS5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAKvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAGN,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,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE;;;;;;;;OAQG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C;;;;;;OAMG;IACH,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD;;;;;;;;;;;OAWG;IACH,mBAAmB,EAAE,kBAAkB,CAAC;IACxC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACxE;AAED,sCAAsC;AACtC,MAAM,WAAW,sBAAsB;IACtC,wEAAwE;IACxE,QAAQ,EAAE,kBAAkB,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,uBAAuB,KAAG,sBAuLrE,CAAC"}
@@ -22,14 +22,18 @@
22
22
  * observe far more than it was granted.
23
23
  * 4. **Authorization phase** (`run_authorization_phase`) — the acting actor
24
24
  * from the `?acting=<uuid>` query string (`parse_acting`; malformed reads
25
- * as omitted), against the authenticated account, building the
25
+ * as omitted, but a query holding an escape that doesn't decode, in any
26
+ * key, is a 400 `invalid_query_params` — `read_request_query_pairs`),
27
+ * against the authenticated account, building the
26
28
  * `RequestContext` per-message dispatch reads (400s on actor selection).
27
29
  * Multi-actor accounts must supply `?acting`; single-actor accounts work
28
30
  * without it.
29
31
  * 5. `require_role(required_roles)`, for a gated endpoint (403).
30
32
  *
31
33
  * Only `GET` is mounted (Hono serves `HEAD` through it), so any other method
32
- * on the path is a 404. The guards run as middleware ahead of
34
+ * on the path is the assembled server's 405 (`server/unmatched_route.ts`),
35
+ * and a `GET` the guards admit that asks for no upgrade passes on to its
36
+ * 404. The guards run as middleware ahead of
33
37
  * `upgradeWebSocket`, whose callback must return `WSEvents` and so cannot
34
38
  * produce a refusal.
35
39
  *
@@ -62,6 +66,8 @@ import { get_resolved_auth } from '../auth/resolved_auth.js';
62
66
  import { verify_request_source } from '../http/origin.js';
63
67
  import { parse_acting } from '../http/auth_shape.js';
64
68
  import { get_client_ip } from '../http/client_ip.js';
69
+ import { ERROR_INVALID_QUERY_PARAMS } from '../http/error_schemas.js';
70
+ import { query_first, read_request_query_pairs } from '../http/request_target.js';
65
71
  import { has_test_context_preset } from '../hono_context.js';
66
72
  import {} from './action_types.js';
67
73
  import { compile_action_registry } from './compile_action_registry.js';
@@ -147,7 +153,7 @@ export const register_action_ws = (options) => {
147
153
  throw new Error(`register_action_ws: outbound_queue_bytes configures the registry created for ${options.path}, ` +
148
154
  'but a registry was supplied — set the budget on that ConnectionRegistry instead');
149
155
  }
150
- const { path, app, upgradeWebSocket, actions, db, receive_timeout = DEFAULT_WS_RECEIVE_TIMEOUT, allowed_origins, max_message_bytes = DEFAULT_WS_MAX_MESSAGE_BYTES, log = new Logger('[ws]'), on_socket_open, on_socket_close, action_ip_rate_limiter, action_account_rate_limiter, on_effect_error, required_roles = [] } = options;
156
+ const { path, app, upgradeWebSocket, actions, db, receive_timeout = DEFAULT_WS_RECEIVE_TIMEOUT, allowed_origins, max_message_bytes = DEFAULT_WS_MAX_MESSAGE_BYTES, log = new Logger('[ws]'), on_socket_open, on_socket_close, action_ip_rate_limiter, action_account_rate_limiter, notification_sender, on_effect_error, required_roles = [] } = options;
151
157
  const registry = options.registry ??
152
158
  new ConnectionRegistry({
153
159
  max_connections_per_account: options.max_connections_per_account,
@@ -196,11 +202,17 @@ export const register_action_ws = (options) => {
196
202
  on_socket_close,
197
203
  action_ip_rate_limiter,
198
204
  action_account_rate_limiter,
205
+ notification_sender,
199
206
  on_effect_error,
200
207
  required_roles
201
208
  };
202
209
  app.get(path, verify_request_source(allowed_origins), ...pre_authorization, async (c, next) => {
203
- const refused = await run_authorization_phase(c, { db }, upgrade_auth, parse_acting(c.req.query('acting')));
210
+ // the query is decoded strictly, every key, before `acting` is read;
211
+ // a malformed but decodable `acting` still reads as omitted
212
+ const query = read_request_query_pairs(c);
213
+ if (!query.ok)
214
+ return c.json({ error: ERROR_INVALID_QUERY_PARAMS }, 400);
215
+ const refused = await run_authorization_phase(c, { db }, upgrade_auth, parse_acting(query_first(query.value, 'acting')));
204
216
  if (refused)
205
217
  return refused;
206
218
  return next();
@@ -238,7 +250,7 @@ export const register_action_ws = (options) => {
238
250
  if (resolved === null) {
239
251
  throw new Error(`register_action_ws: no resolved credential for the upgrade on ${path} — is the auth middleware wired?`);
240
252
  }
241
- if (resolved.account_id !== upgrade_context.account.id) {
253
+ if (resolved.account.id !== upgrade_context.account.id) {
242
254
  throw new Error(`register_action_ws: the credential and the request context name different accounts for the upgrade on ${path}`);
243
255
  }
244
256
  // Test escape hatch — captured once at upgrade. perform_action
@@ -115,6 +115,7 @@ import type { RoleName } from '../auth/role_schema.js';
115
115
  import { type ResolvedAuth } from '../auth/resolved_auth.js';
116
116
  import { type EffectErrorContext } from '../http/pending_effects.js';
117
117
  import type { RateLimiter } from '../rate_limiter.js';
118
+ import type { NotificationSender } from './notification_sender.js';
118
119
  import type { Db } from '../db/db.js';
119
120
  import type { RpcAction } from './action_types.js';
120
121
  import type { ConnectionRegistry, ConnectionIdentity } from './connection_registry.js';
@@ -279,6 +280,8 @@ export interface WsSocketEndpoint {
279
280
  action_ip_rate_limiter: RateLimiter | null;
280
281
  /** Per-account action rate limiter; `null` turns the account check off. */
281
282
  action_account_rate_limiter: RateLimiter | null;
283
+ /** What every handler's `ctx.notification_sender` sends through. */
284
+ notification_sender: NotificationSender;
282
285
  /** Called when an eager pending effect of a frame's action rejects; `undefined` for none. */
283
286
  on_effect_error: ((error: unknown, context: EffectErrorContext) => void) | undefined;
284
287
  /** Roles the endpoint's upgrade is gated on; empty for an ungated endpoint. */
@@ -1 +1 @@
1
- {"version":3,"file":"ws_socket_session.d.ts","sourceRoot":"","sources":["../../src/lib/actions/ws_socket_session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAyB,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAStD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAsBnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAKvF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qCAAqC,MAAM,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,oCAAoC,oDACC,CAAC;AAEnD;;;;;;GAMG;AACH,eA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EAAE,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACrF,+EAA+E;IAC/E,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;CACxC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC/B,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,cAAc,EAAE;QAAE,eAAe,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,GAAG,SAAS,CAAC;IACvE;;;;OAIG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB,gGAAgG;IAChG,eAAe,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,UAAU,gBAAgB,EAC1B,SAAS,eAAe,KACtB,QA+oBF,CAAC"}
@@ -204,7 +204,7 @@ const send_error_response = (registry, connection_id, id, error) => {
204
204
  * @internal
205
205
  */
206
206
  export const create_ws_socket_events = (endpoint, upgrade) => {
207
- const { path, db, log, registry, action_map, receive_timeout, receive_tick_interval, max_message_bytes, pre_admission_queue_max_bytes, on_socket_open, on_socket_close, action_ip_rate_limiter, action_account_rate_limiter, on_effect_error, required_roles } = endpoint;
207
+ const { path, db, log, registry, action_map, receive_timeout, receive_tick_interval, max_message_bytes, pre_admission_queue_max_bytes, on_socket_open, on_socket_close, action_ip_rate_limiter, action_account_rate_limiter, notification_sender, on_effect_error, required_roles } = endpoint;
208
208
  const { client_ip, upgrade_preset, resolved, upgrade_context } = upgrade;
209
209
  // the request context's account — `register_action_ws` holds it to the
210
210
  // credential's before the upgrade
@@ -636,7 +636,7 @@ export const create_ws_socket_events = (endpoint, upgrade) => {
636
636
  action,
637
637
  raw_params: params,
638
638
  request_id: id,
639
- auth: resolved,
639
+ credential: resolved,
640
640
  client_ip,
641
641
  signal,
642
642
  notify,
@@ -648,6 +648,7 @@ export const create_ws_socket_events = (endpoint, upgrade) => {
648
648
  pending_effects,
649
649
  post_commit_effects,
650
650
  log,
651
+ notification_sender,
651
652
  action_ip_rate_limiter,
652
653
  action_account_rate_limiter
653
654
  });