@fuzdev/fuz_app 0.149.0 → 0.151.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 (650) hide show
  1. package/README.md +1 -1
  2. package/dist/actions/CLAUDE.md +327 -300
  3. package/dist/actions/action_bridge.d.ts +5 -79
  4. package/dist/actions/action_bridge.d.ts.map +1 -1
  5. package/dist/actions/action_bridge.js +4 -74
  6. package/dist/actions/action_codegen.d.ts +8 -166
  7. package/dist/actions/action_codegen.d.ts.map +1 -1
  8. package/dist/actions/action_codegen.js +19 -95
  9. package/dist/actions/action_dispatcher.d.ts +10 -0
  10. package/dist/actions/action_dispatcher.d.ts.map +1 -1
  11. package/dist/actions/action_dispatcher.js +9 -6
  12. package/dist/actions/action_event.d.ts +1 -2
  13. package/dist/actions/action_event.d.ts.map +1 -1
  14. package/dist/actions/action_event.js +7 -13
  15. package/dist/actions/action_event_helpers.d.ts +1 -40
  16. package/dist/actions/action_event_helpers.d.ts.map +1 -1
  17. package/dist/actions/action_event_helpers.js +1 -25
  18. package/dist/actions/action_event_types.d.ts +1 -1
  19. package/dist/actions/action_event_types.d.ts.map +1 -1
  20. package/dist/actions/action_rpc.d.ts +10 -215
  21. package/dist/actions/action_rpc.d.ts.map +1 -1
  22. package/dist/actions/action_rpc.js +56 -111
  23. package/dist/actions/action_spec.d.ts +2 -2
  24. package/dist/actions/action_spec.js +2 -2
  25. package/dist/actions/action_types.d.ts +229 -8
  26. package/dist/actions/action_types.d.ts.map +1 -1
  27. package/dist/actions/action_types.js +56 -5
  28. package/dist/actions/broadcast_api.d.ts +22 -17
  29. package/dist/actions/broadcast_api.d.ts.map +1 -1
  30. package/dist/actions/broadcast_api.js +16 -27
  31. package/dist/actions/cancel.d.ts +4 -13
  32. package/dist/actions/cancel.d.ts.map +1 -1
  33. package/dist/actions/cancel.js +5 -17
  34. package/dist/actions/compile_action_registry.d.ts +1 -2
  35. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  36. package/dist/actions/connection_closer.d.ts +120 -50
  37. package/dist/actions/connection_closer.d.ts.map +1 -1
  38. package/dist/actions/connection_closer.js +139 -31
  39. package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
  40. package/dist/actions/connection_registry.d.ts.map +1 -0
  41. package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
  42. package/dist/actions/frontend_rpc_client.d.ts +52 -2
  43. package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
  44. package/dist/actions/frontend_rpc_client.js +42 -4
  45. package/dist/actions/peer_ping.d.ts +7 -9
  46. package/dist/actions/peer_ping.d.ts.map +1 -1
  47. package/dist/actions/peer_ping.js +6 -8
  48. package/dist/actions/peer_request.d.ts +6 -5
  49. package/dist/actions/peer_request.d.ts.map +1 -1
  50. package/dist/actions/peer_request.js +6 -5
  51. package/dist/actions/perform_action.d.ts +36 -28
  52. package/dist/actions/perform_action.d.ts.map +1 -1
  53. package/dist/actions/perform_action.js +60 -31
  54. package/dist/actions/protocol.d.ts +14 -0
  55. package/dist/actions/protocol.d.ts.map +1 -1
  56. package/dist/actions/protocol.js +18 -0
  57. package/dist/actions/register_action_ws.d.ts +137 -292
  58. package/dist/actions/register_action_ws.d.ts.map +1 -1
  59. package/dist/actions/register_action_ws.js +155 -903
  60. package/dist/actions/socket.svelte.d.ts +9 -0
  61. package/dist/actions/socket.svelte.d.ts.map +1 -1
  62. package/dist/actions/socket.svelte.js +16 -5
  63. package/dist/actions/transports.d.ts +88 -34
  64. package/dist/actions/transports.d.ts.map +1 -1
  65. package/dist/actions/transports.js +76 -76
  66. package/dist/actions/transports_http.d.ts +48 -12
  67. package/dist/actions/transports_http.d.ts.map +1 -1
  68. package/dist/actions/transports_http.js +75 -44
  69. package/dist/actions/transports_ws.d.ts +29 -0
  70. package/dist/actions/transports_ws.d.ts.map +1 -1
  71. package/dist/actions/transports_ws.js +34 -8
  72. package/dist/actions/ws_endpoint_spec.d.ts +53 -76
  73. package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
  74. package/dist/actions/ws_endpoint_spec.js +27 -10
  75. package/dist/actions/ws_outbound_writer.d.ts +3 -3
  76. package/dist/actions/ws_outbound_writer.js +3 -3
  77. package/dist/actions/ws_socket_session.d.ts +321 -0
  78. package/dist/actions/ws_socket_session.d.ts.map +1 -0
  79. package/dist/actions/ws_socket_session.js +783 -0
  80. package/dist/auth/CLAUDE.md +132 -68
  81. package/dist/auth/account_action_specs.d.ts +2 -0
  82. package/dist/auth/account_action_specs.d.ts.map +1 -1
  83. package/dist/auth/account_actions.d.ts +1 -1
  84. package/dist/auth/account_actions.d.ts.map +1 -1
  85. package/dist/auth/account_actions.js +9 -3
  86. package/dist/auth/account_queries.d.ts +10 -0
  87. package/dist/auth/account_queries.d.ts.map +1 -1
  88. package/dist/auth/account_queries.js +27 -17
  89. package/dist/auth/account_routes.d.ts +2 -1
  90. package/dist/auth/account_routes.d.ts.map +1 -1
  91. package/dist/auth/account_routes.js +14 -17
  92. package/dist/auth/account_schema.d.ts +5 -5
  93. package/dist/auth/account_schema.d.ts.map +1 -1
  94. package/dist/auth/account_schema.js +5 -2
  95. package/dist/auth/actor_lookup_actions.d.ts +1 -1
  96. package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
  97. package/dist/auth/actor_lookup_actions.js +1 -1
  98. package/dist/auth/actor_lookup_queries.d.ts +3 -2
  99. package/dist/auth/actor_lookup_queries.d.ts.map +1 -1
  100. package/dist/auth/actor_lookup_queries.js +6 -3
  101. package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
  102. package/dist/auth/actor_search_action_specs.js +2 -1
  103. package/dist/auth/actor_search_actions.d.ts +1 -1
  104. package/dist/auth/actor_search_actions.d.ts.map +1 -1
  105. package/dist/auth/actor_search_actions.js +1 -1
  106. package/dist/auth/actor_search_queries.d.ts +10 -7
  107. package/dist/auth/actor_search_queries.d.ts.map +1 -1
  108. package/dist/auth/actor_search_queries.js +18 -11
  109. package/dist/auth/admin_action_specs.d.ts +4 -4
  110. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  111. package/dist/auth/admin_action_specs.js +7 -5
  112. package/dist/auth/admin_actions.d.ts +1 -1
  113. package/dist/auth/admin_actions.d.ts.map +1 -1
  114. package/dist/auth/admin_actions.js +47 -48
  115. package/dist/auth/all_cell_actions.d.ts +14 -3
  116. package/dist/auth/all_cell_actions.d.ts.map +1 -1
  117. package/dist/auth/all_cell_actions.js +2 -1
  118. package/dist/auth/api_token_queries.d.ts +1 -0
  119. package/dist/auth/api_token_queries.d.ts.map +1 -1
  120. package/dist/auth/api_token_queries.js +1 -0
  121. package/dist/auth/audit_emitter.d.ts +12 -6
  122. package/dist/auth/audit_emitter.d.ts.map +1 -1
  123. package/dist/auth/audit_emitter.js +11 -5
  124. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  125. package/dist/auth/audit_log_route_schema.js +3 -2
  126. package/dist/auth/audit_log_routes.d.ts +20 -11
  127. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  128. package/dist/auth/audit_log_routes.js +49 -29
  129. package/dist/auth/audit_log_schema.d.ts +14 -21
  130. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  131. package/dist/auth/audit_log_schema.js +19 -23
  132. package/dist/auth/bearer_auth.d.ts +7 -4
  133. package/dist/auth/bearer_auth.d.ts.map +1 -1
  134. package/dist/auth/bearer_auth.js +21 -15
  135. package/dist/auth/bootstrap_account.d.ts +25 -1
  136. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  137. package/dist/auth/bootstrap_account.js +37 -4
  138. package/dist/auth/bootstrap_routes.d.ts +3 -2
  139. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  140. package/dist/auth/bootstrap_routes.js +5 -4
  141. package/dist/auth/cell_action_helpers.d.ts +89 -0
  142. package/dist/auth/cell_action_helpers.d.ts.map +1 -0
  143. package/dist/auth/cell_action_helpers.js +113 -0
  144. package/dist/auth/cell_action_specs.d.ts +215 -15
  145. package/dist/auth/cell_action_specs.d.ts.map +1 -1
  146. package/dist/auth/cell_action_specs.js +103 -16
  147. package/dist/auth/cell_actions.d.ts +58 -27
  148. package/dist/auth/cell_actions.d.ts.map +1 -1
  149. package/dist/auth/cell_actions.js +206 -161
  150. package/dist/auth/cell_audit_actions.d.ts +1 -1
  151. package/dist/auth/cell_audit_actions.d.ts.map +1 -1
  152. package/dist/auth/cell_audit_actions.js +3 -12
  153. package/dist/auth/cell_audit_events.d.ts +1 -1
  154. package/dist/auth/cell_audit_events.d.ts.map +1 -1
  155. package/dist/auth/cell_audit_events.js +3 -2
  156. package/dist/auth/cell_audit_metadata.d.ts +12 -1
  157. package/dist/auth/cell_audit_metadata.d.ts.map +1 -1
  158. package/dist/auth/cell_audit_metadata.js +11 -1
  159. package/dist/auth/cell_field_actions.d.ts +1 -1
  160. package/dist/auth/cell_field_actions.d.ts.map +1 -1
  161. package/dist/auth/cell_field_actions.js +16 -66
  162. package/dist/auth/cell_grant_action_specs.d.ts +9 -2
  163. package/dist/auth/cell_grant_action_specs.d.ts.map +1 -1
  164. package/dist/auth/cell_grant_action_specs.js +10 -3
  165. package/dist/auth/cell_grant_actions.d.ts +105 -11
  166. package/dist/auth/cell_grant_actions.d.ts.map +1 -1
  167. package/dist/auth/cell_grant_actions.js +81 -56
  168. package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
  169. package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
  170. package/dist/auth/cell_grant_audit_metadata.js +7 -4
  171. package/dist/auth/cell_item_actions.d.ts +1 -1
  172. package/dist/auth/cell_item_actions.d.ts.map +1 -1
  173. package/dist/auth/cell_item_actions.js +21 -82
  174. package/dist/auth/cleanup.d.ts +1 -1
  175. package/dist/auth/cleanup.d.ts.map +1 -1
  176. package/dist/auth/cleanup.js +6 -3
  177. package/dist/auth/credential_deadline.d.ts +3 -3
  178. package/dist/auth/credential_deadline.js +3 -3
  179. package/dist/auth/credential_type_schema.d.ts +8 -7
  180. package/dist/auth/credential_type_schema.d.ts.map +1 -1
  181. package/dist/auth/credential_type_schema.js +8 -7
  182. package/dist/auth/daemon_token_middleware.d.ts +12 -6
  183. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  184. package/dist/auth/daemon_token_middleware.js +28 -17
  185. package/dist/auth/deps.d.ts +4 -4
  186. package/dist/auth/fail_floor.d.ts +55 -0
  187. package/dist/auth/fail_floor.d.ts.map +1 -0
  188. package/dist/auth/fail_floor.js +63 -0
  189. package/dist/auth/invite_queries.d.ts +3 -15
  190. package/dist/auth/invite_queries.d.ts.map +1 -1
  191. package/dist/auth/invite_queries.js +3 -21
  192. package/dist/auth/middleware.d.ts +12 -7
  193. package/dist/auth/middleware.d.ts.map +1 -1
  194. package/dist/auth/middleware.js +42 -29
  195. package/dist/auth/migrations.d.ts +5 -33
  196. package/dist/auth/migrations.d.ts.map +1 -1
  197. package/dist/auth/migrations.js +9 -16
  198. package/dist/auth/request_context.d.ts +101 -71
  199. package/dist/auth/request_context.d.ts.map +1 -1
  200. package/dist/auth/request_context.js +137 -140
  201. package/dist/auth/resolved_auth.d.ts +122 -36
  202. package/dist/auth/resolved_auth.d.ts.map +1 -1
  203. package/dist/auth/resolved_auth.js +89 -38
  204. package/dist/auth/role_grant_offer_action_specs.d.ts +117 -16
  205. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  206. package/dist/auth/role_grant_offer_action_specs.js +51 -16
  207. package/dist/auth/role_grant_offer_actions.d.ts +22 -11
  208. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  209. package/dist/auth/role_grant_offer_actions.js +72 -19
  210. package/dist/auth/role_grant_offer_notifications.d.ts +6 -5
  211. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  212. package/dist/auth/role_grant_offer_notifications.js +4 -3
  213. package/dist/auth/role_grant_offer_queries.d.ts +20 -5
  214. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  215. package/dist/auth/role_grant_offer_queries.js +40 -37
  216. package/dist/auth/role_grant_queries.d.ts +44 -76
  217. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  218. package/dist/auth/role_grant_queries.js +73 -118
  219. package/dist/auth/role_grant_sql.d.ts +42 -0
  220. package/dist/auth/role_grant_sql.d.ts.map +1 -0
  221. package/dist/auth/role_grant_sql.js +54 -0
  222. package/dist/auth/role_schema.d.ts +14 -8
  223. package/dist/auth/role_schema.d.ts.map +1 -1
  224. package/dist/auth/role_schema.js +6 -3
  225. package/dist/auth/scope_kind_schema.d.ts +1 -1
  226. package/dist/auth/scope_kind_schema.js +1 -1
  227. package/dist/auth/self_service_role_actions.d.ts +1 -1
  228. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  229. package/dist/auth/self_service_role_actions.js +21 -1
  230. package/dist/auth/session_queries.d.ts +2 -1
  231. package/dist/auth/session_queries.d.ts.map +1 -1
  232. package/dist/auth/session_queries.js +2 -1
  233. package/dist/auth/signup_routes.d.ts +2 -1
  234. package/dist/auth/signup_routes.d.ts.map +1 -1
  235. package/dist/auth/signup_routes.js +14 -13
  236. package/dist/auth/standard_rpc_actions.d.ts +1 -1
  237. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  238. package/dist/auth/token_scope.d.ts +19 -46
  239. package/dist/auth/token_scope.d.ts.map +1 -1
  240. package/dist/auth/token_scope.js +23 -41
  241. package/dist/db/CLAUDE.md +18 -6
  242. package/dist/db/cell_ddl.d.ts +5 -134
  243. package/dist/db/cell_ddl.d.ts.map +1 -1
  244. package/dist/db/cell_ddl.js +28 -17
  245. package/dist/db/cell_field_queries.d.ts +0 -13
  246. package/dist/db/cell_field_queries.d.ts.map +1 -1
  247. package/dist/db/cell_field_queries.js +0 -16
  248. package/dist/db/cell_grant_queries.d.ts +10 -5
  249. package/dist/db/cell_grant_queries.d.ts.map +1 -1
  250. package/dist/db/cell_grant_queries.js +13 -7
  251. package/dist/db/cell_item_queries.d.ts +0 -7
  252. package/dist/db/cell_item_queries.d.ts.map +1 -1
  253. package/dist/db/cell_item_queries.js +0 -10
  254. package/dist/db/cell_queries.d.ts +65 -55
  255. package/dist/db/cell_queries.d.ts.map +1 -1
  256. package/dist/db/cell_queries.js +85 -62
  257. package/dist/db/cell_view_sql.d.ts +1 -6
  258. package/dist/db/cell_view_sql.d.ts.map +1 -1
  259. package/dist/db/cell_view_sql.js +1 -2
  260. package/dist/db/fact_ddl.d.ts +5 -30
  261. package/dist/db/fact_ddl.d.ts.map +1 -1
  262. package/dist/db/fact_ddl.js +14 -13
  263. package/dist/db/fact_store.d.ts +11 -0
  264. package/dist/db/fact_store.d.ts.map +1 -1
  265. package/dist/db/fact_store.js +4 -1
  266. package/dist/db/migrate.d.ts +44 -6
  267. package/dist/db/migrate.d.ts.map +1 -1
  268. package/dist/db/migrate.js +63 -4
  269. package/dist/dev/setup.d.ts +18 -14
  270. package/dist/dev/setup.d.ts.map +1 -1
  271. package/dist/dev/setup.js +42 -39
  272. package/dist/env/dotenv.d.ts +2 -2
  273. package/dist/env/dotenv.js +2 -2
  274. package/dist/env/update_env_variable.d.ts +33 -21
  275. package/dist/env/update_env_variable.d.ts.map +1 -1
  276. package/dist/env/update_env_variable.js +54 -35
  277. package/dist/hono_context.d.ts +15 -90
  278. package/dist/hono_context.d.ts.map +1 -1
  279. package/dist/hono_context.js +9 -56
  280. package/dist/http/CLAUDE.md +35 -20
  281. package/dist/http/auth_shape.d.ts +1 -8
  282. package/dist/http/auth_shape.d.ts.map +1 -1
  283. package/dist/http/auth_shape.js +6 -12
  284. package/dist/http/body_limit.d.ts +3 -1
  285. package/dist/http/body_limit.d.ts.map +1 -1
  286. package/dist/http/body_limit.js +6 -1
  287. package/dist/http/common_routes.d.ts.map +1 -1
  288. package/dist/http/common_routes.js +3 -2
  289. package/dist/http/db_routes.d.ts +3 -3
  290. package/dist/http/db_routes.js +3 -3
  291. package/dist/http/error_schemas.d.ts +1 -2
  292. package/dist/http/error_schemas.d.ts.map +1 -1
  293. package/dist/http/error_schemas.js +1 -2
  294. package/dist/http/health_schema.d.ts +16 -0
  295. package/dist/http/health_schema.d.ts.map +1 -0
  296. package/dist/http/health_schema.js +12 -0
  297. package/dist/http/jsonrpc.d.ts +9 -0
  298. package/dist/http/jsonrpc.d.ts.map +1 -1
  299. package/dist/http/jsonrpc.js +17 -0
  300. package/dist/http/jsonrpc_errors.d.ts +22 -2
  301. package/dist/http/jsonrpc_errors.d.ts.map +1 -1
  302. package/dist/http/jsonrpc_errors.js +70 -23
  303. package/dist/http/jsonrpc_helpers.d.ts +60 -17
  304. package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
  305. package/dist/http/jsonrpc_helpers.js +67 -25
  306. package/dist/http/origin.d.ts +30 -1
  307. package/dist/http/origin.d.ts.map +1 -1
  308. package/dist/http/origin.js +46 -9
  309. package/dist/http/origin_wildcard.d.ts +97 -0
  310. package/dist/http/origin_wildcard.d.ts.map +1 -0
  311. package/dist/http/origin_wildcard.js +142 -0
  312. package/dist/http/pending_effects.d.ts +28 -0
  313. package/dist/http/pending_effects.d.ts.map +1 -1
  314. package/dist/http/pending_effects.js +32 -1
  315. package/dist/http/proxy.d.ts +4 -2
  316. package/dist/http/proxy.d.ts.map +1 -1
  317. package/dist/http/proxy.js +7 -2
  318. package/dist/http/route_spec.d.ts +4 -3
  319. package/dist/http/route_spec.d.ts.map +1 -1
  320. package/dist/http/route_spec.js +54 -45
  321. package/dist/http/surface.d.ts +4 -2
  322. package/dist/http/surface.d.ts.map +1 -1
  323. package/dist/http/surface.js +7 -4
  324. package/dist/http/surface_query.d.ts +9 -50
  325. package/dist/http/surface_query.d.ts.map +1 -1
  326. package/dist/http/surface_query.js +48 -94
  327. package/dist/realtime/audit_log_sse.d.ts +180 -0
  328. package/dist/realtime/audit_log_sse.d.ts.map +1 -0
  329. package/dist/realtime/audit_log_sse.js +154 -0
  330. package/dist/realtime/sse.d.ts +21 -6
  331. package/dist/realtime/sse.d.ts.map +1 -1
  332. package/dist/realtime/sse.js +33 -10
  333. package/dist/realtime/sse_constants.d.ts +29 -2
  334. package/dist/realtime/sse_constants.d.ts.map +1 -1
  335. package/dist/realtime/sse_constants.js +35 -2
  336. package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
  337. package/dist/realtime/sse_registry.d.ts.map +1 -0
  338. package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
  339. package/dist/schema_meta.d.ts +52 -1
  340. package/dist/schema_meta.d.ts.map +1 -1
  341. package/dist/schema_meta.js +123 -6
  342. package/dist/sensitivity.d.ts +9 -3
  343. package/dist/sensitivity.d.ts.map +1 -1
  344. package/dist/sensitivity.js +3 -2
  345. package/dist/server/app_backend.d.ts +8 -5
  346. package/dist/server/app_backend.d.ts.map +1 -1
  347. package/dist/server/app_backend.js +6 -12
  348. package/dist/server/app_server.d.ts +73 -54
  349. package/dist/server/app_server.d.ts.map +1 -1
  350. package/dist/server/app_server.js +115 -78
  351. package/dist/server/app_server_context.d.ts +1 -1
  352. package/dist/server/app_server_context.d.ts.map +1 -1
  353. package/dist/server/env.d.ts +24 -20
  354. package/dist/server/env.d.ts.map +1 -1
  355. package/dist/server/env.js +24 -34
  356. package/dist/server/serve_fact_route.d.ts +12 -16
  357. package/dist/server/serve_fact_route.d.ts.map +1 -1
  358. package/dist/server/serve_fact_route.js +59 -34
  359. package/dist/server/static.d.ts.map +1 -1
  360. package/dist/server/static.js +2 -2
  361. package/dist/testing/CLAUDE.md +213 -179
  362. package/dist/testing/admin_integration.d.ts.map +1 -1
  363. package/dist/testing/admin_integration.js +10 -19
  364. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  365. package/dist/testing/adversarial_headers.js +8 -0
  366. package/dist/testing/app_server.d.ts +9 -75
  367. package/dist/testing/app_server.d.ts.map +1 -1
  368. package/dist/testing/app_server.js +31 -112
  369. package/dist/testing/attack_surface.d.ts.map +1 -1
  370. package/dist/testing/attack_surface.js +3 -4
  371. package/dist/testing/audit_completeness.d.ts.map +1 -1
  372. package/dist/testing/audit_completeness.js +4 -5
  373. package/dist/testing/auth_apps.d.ts +3 -3
  374. package/dist/testing/auth_apps.d.ts.map +1 -1
  375. package/dist/testing/auth_apps.js +9 -6
  376. package/dist/testing/connection_closer_helpers.d.ts +8 -16
  377. package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
  378. package/dist/testing/connection_closer_helpers.js +7 -20
  379. package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
  380. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  381. package/dist/testing/cross_backend/action_manifest.js +13 -3
  382. package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
  383. package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
  384. package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
  385. package/dist/testing/cross_backend/actor_lookup.d.ts.map +1 -1
  386. package/dist/testing/cross_backend/actor_lookup.js +27 -0
  387. package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
  388. package/dist/testing/cross_backend/body_size.js +25 -22
  389. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
  390. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  391. package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
  392. package/dist/testing/cross_backend/capabilities.d.ts +15 -8
  393. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  394. package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
  395. package/dist/testing/cross_backend/cell_gated_create.js +109 -13
  396. package/dist/testing/cross_backend/cell_grant_role.js +2 -2
  397. package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
  398. package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
  399. package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
  400. package/dist/testing/cross_backend/cell_moderate.d.ts +7 -1
  401. package/dist/testing/cross_backend/cell_moderate.d.ts.map +1 -1
  402. package/dist/testing/cross_backend/cell_moderate.js +68 -4
  403. package/dist/testing/cross_backend/cell_ref_admission.d.ts.map +1 -1
  404. package/dist/testing/cross_backend/cell_ref_admission.js +18 -9
  405. package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
  406. package/dist/testing/cross_backend/cell_relations.js +21 -0
  407. package/dist/testing/cross_backend/conformance_table.d.ts +6 -1
  408. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  409. package/dist/testing/cross_backend/conformance_table.js +12 -10
  410. package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
  411. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  412. package/dist/testing/cross_backend/default_backend_configs.js +29 -9
  413. package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
  414. package/dist/testing/cross_backend/default_spine_surface.js +2 -2
  415. package/dist/testing/cross_backend/differential.d.ts +7 -0
  416. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  417. package/dist/testing/cross_backend/differential.js +17 -0
  418. package/dist/testing/cross_backend/expected_schema.json +1 -0
  419. package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
  420. package/dist/testing/cross_backend/fact_serving.js +48 -0
  421. package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
  422. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  423. package/dist/testing/cross_backend/full_spine_mount.js +13 -5
  424. package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
  425. package/dist/testing/cross_backend/origin_scope.js +5 -13
  426. package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
  427. package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
  428. package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
  429. package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
  430. package/dist/testing/cross_backend/postgres_database.js +56 -1
  431. package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
  432. package/dist/testing/cross_backend/query_shape.js +18 -1
  433. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  434. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +96 -2
  435. package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
  436. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
  437. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  438. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
  439. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
  440. package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
  441. package/dist/testing/cross_backend/session_cap.d.ts +8 -0
  442. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  443. package/dist/testing/cross_backend/session_cap.js +66 -2
  444. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  445. package/dist/testing/cross_backend/setup.js +5 -4
  446. package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
  447. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  448. package/dist/testing/cross_backend/spine_suites.js +21 -0
  449. package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
  450. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  451. package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
  452. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  453. package/dist/testing/cross_backend/sse_round_trip.js +4 -3
  454. package/dist/testing/cross_backend/standard.d.ts +6 -12
  455. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  456. package/dist/testing/cross_backend/test_cell_gated_create_authorize.d.ts +18 -19
  457. package/dist/testing/cross_backend/test_cell_gated_create_authorize.d.ts.map +1 -1
  458. package/dist/testing/cross_backend/test_cell_gated_create_authorize.js +66 -42
  459. package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
  460. package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
  461. package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
  462. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  463. package/dist/testing/cross_backend/testing_backdoor.js +4 -6
  464. package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
  465. package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
  466. package/dist/testing/cross_backend/testing_origin_check.js +1 -1
  467. package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
  468. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  469. package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
  470. package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
  471. package/dist/testing/cross_backend/testing_server_bun.js +5 -4
  472. package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
  473. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  474. package/dist/testing/cross_backend/testing_server_core.js +1 -1
  475. package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
  476. package/dist/testing/cross_backend/testing_server_node.js +13 -2
  477. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  478. package/dist/testing/cross_backend/token_lifetime.js +68 -0
  479. package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
  480. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  481. package/dist/testing/cross_backend/transport_composition.js +48 -6
  482. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
  483. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  484. package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
  485. package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
  486. package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
  487. package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
  488. package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
  489. package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
  490. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  491. package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
  492. package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
  493. package/dist/testing/cross_backend/ws_envelope.js +172 -0
  494. package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
  495. package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
  496. package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
  497. package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
  498. package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
  499. package/dist/testing/cross_backend/ws_role_gated.js +2 -2
  500. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  501. package/dist/testing/cross_backend/ws_round_trip.js +6 -4
  502. package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
  503. package/dist/testing/daemon_info.d.ts.map +1 -0
  504. package/dist/testing/daemon_info.js +108 -0
  505. package/dist/testing/daemon_token_rotation.js +1 -1
  506. package/dist/testing/data_exposure.d.ts.map +1 -1
  507. package/dist/testing/data_exposure.js +3 -4
  508. package/dist/testing/db.js +2 -2
  509. package/dist/testing/integration.d.ts.map +1 -1
  510. package/dist/testing/integration.js +35 -65
  511. package/dist/testing/integration_helpers.d.ts +0 -15
  512. package/dist/testing/integration_helpers.d.ts.map +1 -1
  513. package/dist/testing/integration_helpers.js +2 -42
  514. package/dist/testing/middleware.d.ts +20 -12
  515. package/dist/testing/middleware.d.ts.map +1 -1
  516. package/dist/testing/middleware.js +49 -40
  517. package/dist/testing/rate_limiting.d.ts.map +1 -1
  518. package/dist/testing/rate_limiting.js +13 -22
  519. package/dist/testing/resolved_auth.d.ts +30 -0
  520. package/dist/testing/resolved_auth.d.ts.map +1 -0
  521. package/dist/testing/resolved_auth.js +41 -0
  522. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  523. package/dist/testing/rpc_envelope_cases.js +3 -0
  524. package/dist/testing/rpc_helpers.d.ts +1 -1
  525. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  526. package/dist/testing/rpc_helpers.js +2 -1
  527. package/dist/testing/sse_round_trip.d.ts +5 -4
  528. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  529. package/dist/testing/sse_round_trip.js +2 -2
  530. package/dist/testing/stubs.d.ts +2 -2
  531. package/dist/testing/stubs.d.ts.map +1 -1
  532. package/dist/testing/stubs.js +24 -21
  533. package/dist/testing/test_origin.d.ts +25 -0
  534. package/dist/testing/test_origin.d.ts.map +1 -0
  535. package/dist/testing/test_origin.js +28 -0
  536. package/dist/testing/transports/raw_http.d.ts +54 -0
  537. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  538. package/dist/testing/transports/raw_http.js +58 -0
  539. package/dist/testing/transports/ws_raw_client.d.ts +8 -0
  540. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  541. package/dist/testing/transports/ws_raw_client.js +13 -0
  542. package/dist/testing/transports/ws_transport.d.ts +15 -2
  543. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  544. package/dist/testing/transports/ws_transport.js +4 -2
  545. package/dist/testing/ws_round_trip.d.ts +27 -25
  546. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  547. package/dist/testing/ws_round_trip.js +34 -26
  548. package/dist/ui/AccountSessions.svelte +48 -19
  549. package/dist/ui/AccountSessions.svelte.d.ts +2 -17
  550. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
  551. package/dist/ui/AdminAccounts.svelte +6 -1
  552. package/dist/ui/AdminAuditLog.svelte +61 -22
  553. package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
  554. package/dist/ui/AdminInvites.svelte +1 -1
  555. package/dist/ui/AdminOverview.svelte +76 -37
  556. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  557. package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
  558. package/dist/ui/AdminSessions.svelte +1 -1
  559. package/dist/ui/AppShell.svelte +3 -2
  560. package/dist/ui/AppShell.svelte.d.ts +3 -2
  561. package/dist/ui/AppShell.svelte.d.ts.map +1 -1
  562. package/dist/ui/CLAUDE.md +121 -35
  563. package/dist/ui/Datatable.svelte +33 -18
  564. package/dist/ui/Datatable.svelte.d.ts +2 -14
  565. package/dist/ui/Datatable.svelte.d.ts.map +1 -1
  566. package/dist/ui/OpenSignupToggle.svelte +10 -1
  567. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
  568. package/dist/ui/PopoverButton.svelte +13 -8
  569. package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
  570. package/dist/ui/RoleGrantOfferForm.svelte +3 -2
  571. package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
  572. package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
  573. package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
  574. package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
  575. package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
  576. package/dist/ui/SurfaceExplorer.svelte +66 -27
  577. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  578. package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
  579. package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
  580. package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
  581. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  582. package/dist/ui/admin_accounts_state.svelte.js +6 -4
  583. package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
  584. package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
  585. package/dist/ui/admin_rpc_adapters.d.ts +9 -9
  586. package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
  587. package/dist/ui/admin_rpc_adapters.js +9 -9
  588. package/dist/ui/app_settings_state.svelte.d.ts +2 -2
  589. package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
  590. package/dist/ui/audit_log_state.svelte.d.ts +70 -13
  591. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  592. package/dist/ui/audit_log_state.svelte.js +239 -47
  593. package/dist/ui/backend_probe.svelte.d.ts +93 -0
  594. package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
  595. package/dist/ui/backend_probe.svelte.js +140 -0
  596. package/dist/ui/format_scope.d.ts +7 -7
  597. package/dist/ui/format_scope.d.ts.map +1 -1
  598. package/dist/ui/format_scope.js +4 -4
  599. package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
  600. package/dist/ui/keyed_async_slot.svelte.js +2 -2
  601. package/dist/ui/popover.svelte.d.ts +18 -19
  602. package/dist/ui/popover.svelte.d.ts.map +1 -1
  603. package/dist/ui/popover.svelte.js +103 -16
  604. package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
  605. package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
  606. package/dist/ui/role_grant_offers_state.svelte.js +37 -19
  607. package/dist/ui/ui_format.d.ts +17 -0
  608. package/dist/ui/ui_format.d.ts.map +1 -1
  609. package/dist/ui/ui_format.js +20 -0
  610. package/package.json +2 -1
  611. package/dist/actions/register_ws_endpoint.d.ts +0 -79
  612. package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
  613. package/dist/actions/register_ws_endpoint.js +0 -109
  614. package/dist/actions/transports_ws_auth_guard.d.ts +0 -94
  615. package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
  616. package/dist/actions/transports_ws_auth_guard.js +0 -138
  617. package/dist/actions/transports_ws_backend.d.ts.map +0 -1
  618. package/dist/cli/args.d.ts +0 -55
  619. package/dist/cli/args.d.ts.map +0 -1
  620. package/dist/cli/args.js +0 -100
  621. package/dist/cli/config.d.ts +0 -47
  622. package/dist/cli/config.d.ts.map +0 -1
  623. package/dist/cli/config.js +0 -77
  624. package/dist/cli/daemon.d.ts.map +0 -1
  625. package/dist/cli/daemon.js +0 -181
  626. package/dist/cli/help.d.ts +0 -124
  627. package/dist/cli/help.d.ts.map +0 -1
  628. package/dist/cli/help.js +0 -215
  629. package/dist/cli/logger.d.ts +0 -46
  630. package/dist/cli/logger.d.ts.map +0 -1
  631. package/dist/cli/logger.js +0 -48
  632. package/dist/cli/util.d.ts +0 -36
  633. package/dist/cli/util.d.ts.map +0 -1
  634. package/dist/cli/util.js +0 -50
  635. package/dist/realtime/sse_auth_guard.d.ts +0 -197
  636. package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
  637. package/dist/realtime/sse_auth_guard.js +0 -238
  638. package/dist/realtime/subscriber_registry.d.ts.map +0 -1
  639. package/dist/testing/bootstrap_success.d.ts +0 -29
  640. package/dist/testing/bootstrap_success.d.ts.map +0 -1
  641. package/dist/testing/bootstrap_success.js +0 -144
  642. package/dist/testing/mock_fs.d.ts +0 -20
  643. package/dist/testing/mock_fs.d.ts.map +0 -1
  644. package/dist/testing/mock_fs.js +0 -28
  645. package/dist/testing/standard.d.ts +0 -122
  646. package/dist/testing/standard.d.ts.map +0 -1
  647. package/dist/testing/standard.js +0 -73
  648. package/dist/testing/testing_rate_limiter.d.ts +0 -65
  649. package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
  650. package/dist/testing/testing_rate_limiter.js +0 -80
@@ -1,12 +1,12 @@
1
1
  # actions/ — SAES (Symmetric Action Event System)
2
2
 
3
- > One declarative `ActionSpec` binds to three transport surfaces (REST,
4
- > JSON-RPC over HTTP, WebSocket) with uniform DEV-only output validation and
5
- > symmetric send/receive.
3
+ > One declarative `ActionSpec` binds to two transport surfaces (JSON-RPC over
4
+ > HTTP, WebSocket) with uniform DEV-only output validation and symmetric
5
+ > send/receive.
6
6
 
7
7
  For consumer wiring (client-authoritative vs server-authoritative dispatch,
8
8
  role-grant-offer UI integration), see ../../../docs/usage.md §Deriving
9
- Route/Event Specs, §Single JSON-RPC 2.0 Endpoint, §WebSocket Endpoint. For
9
+ Event Specs from Action Specs, §Single JSON-RPC 2.0 Endpoint, §WebSocket Endpoint. For
10
10
  DEV-only output validation semantics see ../../../docs/architecture.md
11
11
  §DEV-only Output Validation. For the SAES binding matrix and middleware
12
12
  ordering see the root ../../../CLAUDE.md §Action Spec System (SAES) and
@@ -32,7 +32,7 @@ Canonical source of truth. Three concrete kinds discriminate on `kind`:
32
32
  `RouteAuth` is the flat record
33
33
  `{account, actor, roles?, credential_types?, required_scope?}` from
34
34
  `http/auth_shape.ts` — same shape governs `RouteSpec.auth` so one auth
35
- surface drives REST and SAES. Cross-axis invariants: roles imply
35
+ surface drives routes and SAES. Cross-axis invariants: roles imply
36
36
  `actor: 'required'`; `account: 'none'` implies `actor: 'none'` (no
37
37
  accountless actors in v1); the unrestricted leaf
38
38
  (`account: 'none', actor: 'none'`) cannot declare roles or credential
@@ -65,12 +65,11 @@ dropping per-spec `*_METHOD` constants (readers dereference `.method`). See
65
65
 
66
66
  ## Kind → binding matrix
67
67
 
68
- - `request_response` — REST `RouteSpec` via bridge; RPC `RouteSpec` via `create_rpc_endpoint`; WS dispatch yes; no SSE.
69
- - `remote_notification` — no REST/RPC routes; WS server push; SSE `EventSpec` via bridge.
70
- - `local_call` — none (no REST, no RPC, no WS, no SSE).
68
+ - `request_response` — RPC `RouteSpec` via `create_rpc_endpoint`; WS dispatch yes; no SSE.
69
+ - `remote_notification` — no RPC routes; WS server push; SSE `EventSpec` via `create_action_event_spec`.
70
+ - `local_call` — none (no RPC, no WS, no SSE).
71
71
 
72
- `create_action_route_spec` throws if `spec.auth` is null (notifications and
73
- local calls cannot become routes). `create_action_event_spec` throws on any
72
+ `create_action_event_spec` (`actions/action_bridge.ts`) throws on any
74
73
  non-`remote_notification` kind.
75
74
 
76
75
  ## Registry compile (`actions/compile_action_registry.ts`)
@@ -127,25 +126,20 @@ and options on each function's TSDoc.
127
126
  - `get_executor_phases(spec, executor)` — phases an executor participates in for the spec.
128
127
  - `get_handler_return_type` — TS type a phase handler must return; side-effect imports `ActionOutputs`.
129
128
  - `generate_phase_handlers` — per-action typed handler-map fragment.
130
- - `generate_actions_api_method_signature` — single source of truth for the typed `FrontendActionsApi` method shape. Its `input?:` follows `action_input_is_optional` — the schema accepts `undefined`, or accepts `{}` and is not marked `.meta({empty_input_handler_guarded: true})` (`SchemaFieldMeta`, read by `is_empty_input_handler_guarded` in `schema_meta.ts` — set on `cell_get`, `cell_field_list` and `cell_item_list`, whose `{}` reaches a handler guard that refuses it with a declared reason, so their input stays required; a consumer marks its own the same way); an input-shape invariant test reads the same rule.
129
+ - `generate_frontend_actions_api` — typed `FrontendActionsApi` interface. Each method's `input?:` follows `action_input_is_optional` — the schema accepts `undefined`, or accepts `{}` and is not marked `.meta({empty_input_handler_guarded: true})` (`SchemaFieldMeta`, read by `is_empty_input_handler_guarded` in `schema_meta.ts` — set on `cell_get`, `cell_field_list` and `cell_item_list`, whose `{}` reaches a handler guard that refuses it with a declared reason, so their input stays required; a consumer marks its own the same way); an input-shape invariant test reads the same rule.
131
130
  - `generate_action_method_enums` — up to nine `z.enum` + `z.infer` pairs.
132
- - `generate_action_method_enum_block` — lower-level escape hatch for cross-product enums.
133
131
  - `generate_typed_action_event_alias` — fixed-shape `TypedActionEvent<TMethod, TPhase, TStep>` alias.
134
132
  - `generate_action_specs_record` — `ActionSpecs` runtime const + interface + `action_specs` array.
135
133
  - `generate_action_inputs_outputs` — `ActionInputs` + `ActionOutputs` runtime consts + interfaces.
136
134
  - `generate_action_event_datas` — `ActionEventDatas` interface; per-spec variants.
137
- - `generate_frontend_actions_api` — typed `FrontendActionsApi` interface.
138
135
  - `generate_frontend_action_handlers` — `FrontendActionHandlers` interface (Tier 2 only).
139
136
  - `generate_backend_actions_api` — `BackendActionsApi` interface + `broadcast_action_specs` array.
140
- - `generate_backend_action_handlers_map` — `BackendActionHandlers` mapped type.
141
137
  - `compose_gen_file` — wrapper: banner + `imports.build()` + blocks join.
142
138
  - `create_namespace_qualifier(sources, imports)` — multi-source consumer helper; registers `import * as ns` per source.
143
139
 
144
- Shared defaults: `DEFAULT_COLLECTIONS_PATH = './action_collections.ts'`,
145
- `DEFAULT_SPECS_MODULE = './action_specs.ts'`,
146
- `DEFAULT_METATYPES_PATH = './action_metatypes.ts'`,
147
- `resolve_spec_qualifier` (the default-vs-callback resolver every
148
- multi-source-aware helper uses).
140
+ Shared defaults: `collections_path` is `'./action_collections.ts'`,
141
+ `specs_module` is `'./action_specs.ts'`, and `metatypes_path` is
142
+ `'./action_metatypes.ts'`.
149
143
 
150
144
  ### Codegen invariants
151
145
 
@@ -172,40 +166,13 @@ Never calls `generate_typed_action_event_alias` or
172
166
  zzz) emits the full set including `ActionEventDatas`, `TypedActionEvent`,
173
167
  and `FrontendActionHandlers`.
174
168
 
175
- ## HTTP bridge (`actions/action_bridge.ts`)
176
-
177
- Derives transport-specific specs from action specs. HTTP-specific concerns
178
- (path, handler, errors) come from options, not the action spec.
179
-
180
- - `create_action_route_spec(spec, options)` — one action → one `RouteSpec`. HTTP method defaults by `side_effects` (`true` → POST, `false` → GET; override via `options.http_method`). `route.auth` is `spec.auth` plus a derived `required_scope`. `transaction: spec.side_effects`. Throws if `spec.auth` is null.
181
-
182
- **The bridge carries the token-scope gate across.** A bridged route runs
183
- `options.handler` through the REST pipeline and never reaches
184
- `perform_action`, so the dispatcher's per-method scope check cannot fire on it
185
- — leaving a bearer-reachable surface a **narrowed** token walks through, which
186
- is what the RPC-only rule exists to prevent. So the derived spec declares
187
- `auth.required_scope: 'rpc:<method>'` and `fuz_auth_guard_resolver` mounts the
188
- refusal ahead of the role gate. Per-method rather than a blanket refusal
189
- because a bridged route _has_ a method identity, which the non-RPC surfaces
190
- the RPC-only rule covers do not.
191
-
192
- Bridge something with no request/response shape — an SSE stream, a file
193
- download — and the whole-surface rule applies instead: pass `options.auth` with
194
- `required_scope: 'surface:<name>'`, naming your own surface (the vocabulary is
195
- open on the identifier). An `options.auth` that omits `required_scope` still
196
- gets the derived one; public actions get none (the guard would enforce
197
- nothing). fuz_app mounts no bridged routes itself; this is consumer-facing.
198
-
199
- - `create_action_event_spec(spec, {channel?})` — one notification action → one `EventSpec` for SSE surface + `create_validated_broadcaster`. Throws on non-`remote_notification` kind.
200
- - `derive_http_method(side_effects)` — exported for custom bridges.
201
-
202
169
  ## Single JSON-RPC 2.0 endpoint (`actions/action_rpc.ts`)
203
170
 
204
171
  `create_rpc_endpoint({path, actions, log, action_ip_rate_limiter, action_account_rate_limiter}): RouteSpec[]`
205
172
  produces **two** route specs on the same path (GET + POST) that share one
206
173
  internal dispatcher. The two limiters are required `RateLimiter | null` with
207
174
  no default — `null` is the explicit off switch — and the same holds on
208
- `register_action_ws` / `register_ws_endpoint`, so a hand mount can't run
175
+ `register_action_ws`, so a hand mount can't run
209
176
  unthrottled by omission. `create_app_server` passes its own to every endpoint
210
177
  it mounts (../../../docs/usage.md §Rate limiters). Per-action auth lives inside the dispatcher; the outer routes
211
178
  use `auth: {account: 'none', actor: 'none'}` and `transaction: false`.
@@ -229,26 +196,32 @@ Shim responsibilities (per-request):
229
196
 
230
197
  1. Parse envelope (POST body / GET query string); parse errors → `parse_error` 400. GET reads `method` / `id` / `params` via Hono's `c.req.query()` — first occurrence wins on a duplicated key, unknown keys are ignored, and an empty value counts as missing. This is the cross-impl contract (the Rust GET dispatch mirrors it via `fuz_http`'s `query_first`, including the id numeric-vs-string normalization), pinned by the `query_shape` cross suite.
231
198
  2. Lookup method in the `compile_action_registry`-built map; unknown → `method_not_found`.
232
- 3. GET read restriction — GET rejected for `side_effects: true` actions.
233
- 4. Build `PerformActionInput` from `c.var` + `get_client_ip` + `c.req.raw.signal`. Test-preset escape hatch reads `TEST_CONTEXT_PRESET_KEY` + `REQUEST_CONTEXT_KEY`.
199
+ 3. GET read restriction — GET rejected for `side_effects: true` actions. Every response the GET handler writes, its refusals included, carries `Cache-Control: no-store` (`RPC_GET_CACHE_CONTROL`; a pre-handler middleware refusal, like the origin 403, does not): a read answers one caller at one moment.
200
+ 4. Build `PerformActionInput` from `get_resolved_auth(c)` + `get_client_ip` + `c.req.raw.signal`. Test-preset escape hatch reads `TEST_CONTEXT_PRESET_KEY` + `REQUEST_CONTEXT_KEY`.
234
201
  5. Call `perform_action` (shared core).
235
- 6. Bind result via `perform_action_result_to_envelope(id, result)`; `c.json(envelope, result.status)`.
236
-
237
- Error paths: `ThrownJsonrpcError` (duck-typed via `err instanceof Error &&
238
- typeof err.code === 'number'` to handle cross-copy `instanceof` misses,
239
- e.g. when consumers like zzz throw their own `ThrownJsonrpcError`)
240
- preserves code + data verbatim. Generic throws become `internal_error` 500;
241
- message is the raw error under `DEV`, "internal server error" otherwise.
242
-
243
- A result `c.json` cannot serialize (a `bigint`, a cycle) answers the same
244
- `internal_error` 500 rather than throwing. By then `perform_action` has
202
+ 6. Bind result via `serialize_action_result(id, result, method, log)` (`actions/perform_action.ts`, shared with WS) → `{body, status}`, written with `c.json`'s content type.
203
+
204
+ Error paths: `ThrownJsonrpcError` (recognized through
205
+ `to_thrown_jsonrpc_error` in `http/jsonrpc_errors.ts` by its realm-global
206
+ brand, so one from a second fuz_app copy — e.g. a consumer like zzz resolving
207
+ its own — matches where `instanceof` misses; the REST catch layer, the frontend
208
+ transports, and `ActionEvent` read thrown errors the same way) preserves code +
209
+ data verbatim. Anything else takes the generic path: a foreign error class
210
+ carrying a JSON-RPC `code`, a `ThrownJsonrpcError` whose `code` was cast
211
+ outside the JSON-RPC set, a `DOMException`. Generic throws become
212
+ `internal_error` 500; message is the raw error under `DEV`, "internal server
213
+ error" otherwise.
214
+
215
+ A result that cannot be serialized (a `bigint`, a cycle) answers the same
216
+ `internal_error` 500 rather than throwing (`serialize_action_result`, which the
217
+ WS dispatcher shares). By then `perform_action` has
245
218
  committed, and a throw would have the route wrapper
246
219
  (`dispatch_with_post_commit_rollback`) discard the handler's
247
220
  `post_commit_effects` — the connection closes of a revocation that did land.
248
221
 
249
222
  ### Per-request handler shape
250
223
 
251
- Unified across HTTP RPC + WS via `ActionContext`:
224
+ Unified across HTTP RPC + WS via `ActionContext` (`actions/action_types.ts`):
252
225
 
253
226
  ```ts
254
227
  interface ActionContext {
@@ -260,7 +233,7 @@ interface ActionContext {
260
233
  pending_effects: Array<Promise<void>>; // eager — see http/CLAUDE.md §Pending Effects
261
234
  post_commit_effects: Array<() => void | Promise<void>>; // deferred — push via `emit_after_commit`
262
235
  client_ip: string;
263
- credential_type: CredentialType | null; // same value the credential_types gate consumed
236
+ credential_type: BuiltinCredentialType | null; // same value the credential_types gate consumed
264
237
  log: Logger;
265
238
  notify: (method, params) => void; // HTTP: DEV-mode warn + drop; WS: socket-scoped
266
239
  signal: AbortSignal; // HTTP: client-disconnect; WS: AbortSignal.any([socket_close, request_cancel])
@@ -311,8 +284,10 @@ Pipeline (401 → authz → 403 → 429 → 400 → handler):
311
284
  5. Validate params (400) — `spec.input.safeParse` with `z.void()` / `?? {}` rules; a `z.void()` input reads absent, `null` (GET `?params=null`), and `{}` alike as the no-arg call (`to_input_params` in `http/schema_helpers.ts`, via `to_void_params`, the twin of the Rust `require_void_params`; the peer receive path in `ActionDispatcher` runs the same normalizer) and refuses any other shape. A refusal is `to_invalid_params_error`: the generic `invalid params`, `data.reason` when the first issue's field declares an `invalid_reason` in its `.meta()` and no issue sits on the input itself, such as an unknown key (`resolve_issues_invalid_reason`, `schema_meta.ts` — see ../../../docs/architecture.md §Error Schema System), and the Zod issues DEV-only
312
285
  6. Dispatch + DEV output validation + error normalization — `spec.side_effects` picks transaction vs pool. `ThrownJsonrpcError` preserves code + data; generic throws become `internal_error`
313
286
 
314
- `PerformActionInput` carries `account_id`, `credential_type`, `client_ip`,
315
- `signal`, `notify`, optional `connection_id`, optional `preset`.
287
+ `PerformActionInput` carries `auth` (the request's `ResolvedAuth`, `null` for
288
+ anonymous — the authorization phase reads its account, the post-authorization
289
+ gates its type and scope, `ActionContext` its type and session hash),
290
+ `client_ip`, `signal`, `notify`, optional `connection_id`, optional `preset`.
316
291
  `PerformActionDeps` carries `db` (pool-level), `pending_effects`, `log`,
317
292
  the two rate limiters. Audit writes are out-of-band: factories close over
318
293
  `AppDeps.audit` independently.
@@ -328,10 +303,10 @@ surface consistency.
328
303
  ## DEV-only output validation — uniform across surfaces
329
304
 
330
305
  Critical invariant: every action-handler surface applies DEV-only output
331
- validation and produces the **same failure mode** — log an error, return
306
+ validation and produces the **same failure mode** as REST routes'
307
+ `wrap_output_validation` (`http/route_spec.ts`) — log an error, return
332
308
  the response unchanged, do not throw, do not mutate status.
333
309
 
334
- - REST bridge — `http/route_spec.ts` `wrap_output_validation` (applied via `apply_route_specs`; inherited by `create_action_route_spec`). Production hot path short-circuits (no parse).
335
310
  - HTTP RPC + WebSocket dispatch — `actions/perform_action.ts` `if (DEV) spec.output.safeParse(output)` inside the shared dispatch core. Production hot path short-circuits (no parse).
336
311
 
337
312
  Caller-facing `input` schemas are validated **always** (DEV + production)
@@ -343,40 +318,63 @@ Validation for full rationale.
343
318
 
344
319
  `Transport` is the unifying interface — overloaded `send(message, options?)`
345
320
  returning `Promise<JsonrpcResponseOrError>` for requests and
346
- `Promise<JsonrpcErrorResponse | null>` for notifications, plus `is_ready()`
347
- and optional `dispose()`. All transports share `TransportSendOptions`:
321
+ `Promise<JsonrpcErrorResponse | null>` for notifications, plus `is_ready()`,
322
+ optional `queues` (a request sent with `queue` waits on it while not ready —
323
+ `FrontendWebsocketTransport`, while its connection `will_reconnect`), and
324
+ optional `dispose()`. All transports share
325
+ `TransportSendOptions`:
348
326
 
349
327
  - `signal?: AbortSignal` — per-call cancel. Bottoms out at
350
328
  `FrontendWebsocketClient.request({signal})` on WS (sends `cancel`
351
329
  notification on abort) and at `fetch({signal})` on HTTP.
352
330
  - `queue?: boolean` — per-call durable-queue opt-in. Honored only by
353
331
  `FrontendWebsocketTransport` on the `request_response` path (default
354
- `false`). HTTP, backend, and WS notifications all ignore it.
355
-
356
- `Transports` registry holds multiple transports with a `current` selection
357
- and `allow_fallback: boolean` (default `true`). Explicit
358
- `transport_for_method` (on `rpc_client`) or
359
- `default_send_options.transport_name` (on `ActionDispatcher`) takes precedence.
332
+ `false`). HTTP and WS notifications ignore it.
333
+
334
+ `Transports` holds transports by name; the first registered is the default.
335
+ `get_transport(name?, {queue?})` returns the preferred transport — the named
336
+ one, else the default — when it is ready, or when it is not but the call is a
337
+ queued request and it `queues`; otherwise the first ready transport, the
338
+ default first. Explicit `transport_for_method` (on `rpc_client`) or
339
+ `default_send_options.transport_name` (on `ActionDispatcher`) names it.
340
+
341
+ **Queue routing.** `ActionDispatcher.send` resolves a request's `queue` once —
342
+ the call's, else `default_send_options.queue`, else off — and it drives both
343
+ the transport choice and the send, so a WS-routed request on a disconnected
344
+ socket waits in the client's durable queue and replays on reconnect (or
345
+ rejects when its `signal` aborts; the queue is size-bounded, not timed). It
346
+ queues only while a reconnect is coming: `FrontendWebsocketTransport.queues`
347
+ reads the connection's `will_reconnect` (`FrontendWebsocketClient`:
348
+ `connecting` or `reconnecting`), so after a close that reopens nothing on its
349
+ own — superseded (4004), permission revoked (4006), `disconnect()`,
350
+ `cancel_reconnect()`, auto-reconnect off — the request falls back to a ready
351
+ transport (HTTP) rather than wait for a `connect()`. (Requests already queued
352
+ before a `cancel_reconnect()` or `set_reconnect(false)` stay queued for the
353
+ next `connect()`.) A notification never queues: it fails fast, or falls back to
354
+ a ready transport.
355
+ The RPC layer defaults it off; a client-authoritative app opts in on the peer
356
+ (`create_frontend_rpc_client`'s `ws.queue`). `FrontendWebsocketClient`'s own
357
+ raw `request()` keeps its default-on queue.
360
358
 
361
359
  ### WS close codes (`actions/transports.ts`)
362
360
 
363
- - `WS_CLOSE_SESSION_REVOKED = 4001` — server revoked auth (reason `WS_CLOSE_SESSION_REVOKED_REASON`, `Session revoked`); client enters permanent `revoked` state, no reconnect. Also the close for an upgrade refused at admission because its credential was revoked mid-upgrade — indistinguishable on the wire by design — and for a socket whose credential expired while open, with reason `WS_CLOSE_CREDENTIAL_EXPIRED_REASON` (`Credential expired`), which the client treats as the same `revoked` state.
364
- - `WS_CLOSE_CLIENT_HEARTBEAT_TIMEOUT = 4002` — client observed receive-silence past its receive timeout (`resolve_heartbeat_receive_timeout`).
365
- - `WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT = 4003` — server observed receive-silence past `DEFAULT_SERVER_HEARTBEAT_TIMEOUT` (60s).
366
- - `WS_CLOSE_CONNECTION_LIMIT = 4004` — server closed this socket to admit a newer one on the same account, past the per-account connection cap (reason `connection limit`). Not a revocation: the client stays `closed` with `superseded` set and no reconnect, until `connect()` is called. Twin of the Rust spine's constant.
361
+ - `WS_CLOSE_SESSION_REVOKED = 4001` — server revoked auth (reason `WS_CLOSE_SESSION_REVOKED_REASON`, `Session revoked`); client enters permanent `revoked` state, no reconnect. Also the close for an upgrade refused at admission because its credential was revoked, or its acting actor soft-deleted, mid-upgrade — indistinguishable on the wire by design — and for a socket whose credential expired while open, with reason `WS_CLOSE_CREDENTIAL_EXPIRED_REASON` (`Credential expired`), which the client treats as the same `revoked` state.
362
+ - `WS_CLOSE_CLIENT_HEARTBEAT_TIMEOUT = 4002` — client observed receive-silence past its receive timeout (`resolve_heartbeat_receive_timeout`), with reason `WS_CLOSE_CLIENT_HEARTBEAT_TIMEOUT_REASON` (`client heartbeat timeout`). TS-only reason: the client is the same against either spine.
363
+ - `WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT = 4003` — server observed receive-silence past `DEFAULT_WS_RECEIVE_TIMEOUT` (60s), with reason `WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT_REASON` (`server heartbeat timeout`). Twin of the Rust spine's constants.
364
+ - `WS_CLOSE_CONNECTION_LIMIT = 4004` — server closed this socket to admit a newer one on the same account, past the per-account connection cap (reason `WS_CLOSE_CONNECTION_LIMIT_REASON`, `connection limit`). Not a revocation: the client stays `closed` with `superseded` set and no reconnect, until `connect()` is called. Twin of the Rust spine's constant.
367
365
  - `WS_CLOSE_OUTBOUND_OVERFLOW = 4005` — the server had more waiting to be written to this socket than its outbound budget holds (reason `WS_CLOSE_OUTBOUND_OVERFLOW_REASON`, `outbound queue overflow`); what was waiting is dropped. Not a revocation, and nothing took the connection's place: the client reconnects under its ordinary backoff. Twin of the Rust spine's constant.
368
366
  - `WS_CLOSE_PERMISSION_REVOKED = 4006` — the socket's account lost a role its endpoint's `required_roles` lists: a revoked global grant (reason `WS_CLOSE_PERMISSION_REVOKED_REASON`, `Permission revoked`), mid-life or at admission. Nothing is sent after it. Not a revocation of the credential: the client stays `closed` until `connect()` is called, without setting `revoked` or `superseded`, and rejects pending and queued requests `forbidden`. Twin of the Rust spine's constant.
369
- - `WS_CLOSE_GOING_AWAY = 1001` — the server is shutting down (reason `WS_CLOSE_GOING_AWAY_REASON`, `Server shutting down`): `close_all_sockets`, which `AppServer.close` runs. Also the close for an upgrade the shutdown refuses — pending at the close-all, or born closed after it. Not a revocation: the client reconnects under its ordinary backoff.
370
- - `WS_CLOSE_MESSAGE_TOO_BIG = 1009` — server received a message over its `max_message_bytes` cap (RFC 6455 "Message Too Big").
371
- - `WS_CLOSE_POLICY_VIOLATION = 1008` — a socket sent too much while it was still opening (before admission and `on_socket_open` completed): past `MAX_PRE_ADMISSION_FRAMES` frames or the `PRE_ADMISSION_QUEUE_BYTES_FACTOR` byte budget.
372
- - `WS_CLOSE_INTERNAL_ERROR = 1011` — the admission credential re-check itself failed (reason `internal error`), `on_socket_open` threw (reason `socket bootstrap failed`), or the socket's connection was removed from the transport without a close (reason `connection unregistered`). Not a revocation: the client reconnects under its ordinary backoff. Twin of the Rust spine's constant.
367
+ - `WS_CLOSE_GOING_AWAY = 1001` — the server is shutting down (reason `WS_CLOSE_GOING_AWAY_REASON`, `Server shutting down`): `close_all_connections`, which `AppServer.close` runs. Also the close for an upgrade the shutdown refuses — pending at the close-all, or born closed after it. Not a revocation: the client reconnects under its ordinary backoff.
368
+ - `WS_CLOSE_MESSAGE_TOO_BIG = 1009` — server received a message over its `max_message_bytes` cap (RFC 6455 "Message Too Big"), with reason `WS_CLOSE_MESSAGE_TOO_BIG_REASON` (`message too big`). Twin of the Rust spine's constants.
369
+ - `WS_CLOSE_POLICY_VIOLATION = 1008` — a socket sent too much while it was still opening (before admission and `on_socket_open` completed): past `MAX_PRE_ADMISSION_FRAMES` frames or the `PRE_ADMISSION_QUEUE_BYTES_FACTOR` byte budget (reason `WS_CLOSE_PRE_ADMISSION_OVERFLOW_REASON`). TS-only: the Rust spine reads no frame before admission (they wait in the socket for its loop), so it has no pre-admission queue to overflow and never sends 1008.
370
+ - `WS_CLOSE_INTERNAL_ERROR = 1011` — the admission credential re-check itself failed or opening the socket threw (reason `WS_CLOSE_INTERNAL_ERROR_REASON`, `internal error` — shared with the Rust spine), `on_socket_open` threw (`WS_CLOSE_SOCKET_OPEN_FAILED_REASON`, `socket bootstrap failed`), or the socket's connection was removed from the transport without a close (`WS_CLOSE_CONNECTION_UNREGISTERED_REASON`, `connection unregistered`) — the last two TS-only. Not a revocation: the client reconnects under its ordinary backoff. Twin of the Rust spine's constant.
373
371
 
374
372
  ### Transport modules
375
373
 
376
- - `actions/transports_http.ts` — `frontend_http_rpc`; thin `fetch` adapter, POST default, GET on `has_side_effects(method) === false`.
377
- - `actions/transports_ws.ts` — `frontend_websocket_rpc`; thin adapter over `WebsocketRpcConnection` (default impl: `FrontendWebsocketClient`). Answers inbound server→client requests: a built-in `peer_ping_responder` for `peer/ping` (zero-wiring liveness), any other request routed through `peer.receive` with the response sent back over the socket (the frontend half of the ActionPeer receive loop).
378
- - `actions/transports_ws_backend.ts` — `backend_websocket_rpc`; server-side WS with session tracking, two-phase registration (`register_pending` / `admit`), the per-account cap, and the per-connection outbound budget; satisfies `FilterableBroadcastTransport`. Server→client requests via `request_connection` (correlation registry in `actions/peer_request.ts`).
379
- - `actions/ws_outbound_writer.ts` — `WsOutboundWriter`, the outbound queue and write pump of one connection, which every frame the transport sends goes through; `realtime/outbound_budget.ts` is the accounting it shares with SSE.
374
+ - `actions/transports_http.ts` — `frontend_http_rpc`; thin `fetch` adapter over `FrontendHttpTransportOptions` (`{url, headers?, lookup_action_spec, max_get_url_length?}`). The transport owns the request policy, derived from the spec `lookup_action_spec` returns, so a hand-built transport can't drop a rule: POST by default; a read (`side_effects: false`) is a GET with no `content-type`, unless its input carries a `'secret'` or `'personal'` value at any depth (`schema_has_sensitive_field`, walked once per spec — a GET puts the params in the URL, which proxies and logs record) or its path and query exceed `max_get_url_length` (`DEFAULT_MAX_GET_URL_LENGTH`, 4096), which go as POST. A method the lookup doesn't know is a POST. The endpoint answers every GET with `Cache-Control: no-store` (`RPC_GET_CACHE_CONTROL`).
375
+ - `actions/transports_ws.ts` — `frontend_websocket_rpc`; thin adapter over `WebsocketRpcConnection` (default impl: `FrontendWebsocketClient`), `queues` while the connection `will_reconnect`. Also `to_same_origin_ws_url(path)`, the page-origin WebSocket URL a same-origin backend is reached at (`path` itself off the browser). Answers inbound server→client requests: a built-in `peer_ping_responder` for `peer/ping` (zero-wiring liveness), any other request routed through `peer.receive` with the response sent back over the socket (the frontend half of the ActionPeer receive loop).
376
+ - `actions/connection_registry.ts` — `ConnectionRegistry`, server-side WS with session tracking, two-phase registration (`register_pending` / `admit`), the per-account cap, and the per-connection outbound budget; the broadcast target of `create_broadcast_api` (`broadcast`, `broadcast_filtered`). Not a `Transport`: it sends nothing a client requested. Server→client requests via `request_connection` (correlation registry in `actions/peer_request.ts`).
377
+ - `actions/ws_outbound_writer.ts` — `WsOutboundWriter`, the outbound queue and write pump of one connection, which every frame the registry sends goes through; `realtime/outbound_budget.ts` is the accounting it shares with SSE.
380
378
 
381
379
  `FrontendHttpTransport` on non-OK HTTP returns the body as-is when it's a
382
380
  JSON-RPC error response for the request (same `id` compared as strings since GET sends it as a query param, or `null`) — the
@@ -392,7 +390,7 @@ buffering would masquerade as success at the rpc_client layer. Requests
392
390
  route via `queue`.
393
391
 
394
392
  **WS message cap.** `DEFAULT_WS_MAX_MESSAGE_BYTES` (1 MiB, in
395
- `actions/transports.ts`, equal to `DEFAULT_MAX_BODY_SIZE` and the twin of the
393
+ `actions/transports.ts`, equal to `DEFAULT_BODY_LIMIT_BYTES` and the twin of the
396
394
  Rust spine's constant) bounds one message both ways. `register_action_ws`
397
395
  (`max_message_bytes`, also on `WsEndpointSpec`) closes the socket with
398
396
  `WS_CLOSE_MESSAGE_TOO_BIG` on a larger inbound message, before parsing — no
@@ -407,15 +405,15 @@ sends it — otherwise the close would fail every request in flight on the
407
405
  socket. A consumer that raises the server cap passes the same value to the
408
406
  client; `null` skips the client-side measurement.
409
407
 
410
- ### `BackendWebsocketTransport` — server-side WS state
408
+ ### `ConnectionRegistry` — server-side WS state
411
409
 
412
410
  One map keyed by `connection_id` (branded `Uuid`), in registration order:
413
411
  `#connections: Map<Uuid, ConnectionEntry>`, each entry `{ws, identity,
414
412
  admitted, abort_controller, writer}`. `identity` is the `ConnectionIdentity`
415
- `{token_hash, account_id, api_token_id, required_roles}` (session sets
416
- `token_hash`, bearer sets `api_token_id`, daemon-token sets both null;
413
+ `{session_hash, account_id, api_token_id, required_roles}` (session sets
414
+ `session_hash`, bearer sets `api_token_id`, daemon-token sets both null;
417
415
  `required_roles` is what the endpoint gated the upgrade on, per registration,
418
- since endpoints with different gates can share one transport).
416
+ since endpoints with different gates can share one registry).
419
417
 
420
418
  The id is the connection's only handle — `register_pending` / `add_connection`
421
419
  return it and `admit` / `remove_connection` / `is_registered` take it. There is
@@ -428,19 +426,20 @@ open and removes by it.
428
426
  socket exists, and a revocation closes only the connections *registered* under
429
427
  what it revoked — so a one-step registration leaves a window in which a
430
428
  revocation closes nothing and the socket is then admitted on a dead credential.
431
- The transport splits registration to close it (the twin of the Rust
429
+ The registry splits registration to close it (the twin of the Rust
432
430
  `fuz_realtime` `ConnectionRegistry`, same method names):
433
431
 
434
- - `register_pending(ws, token_hash, account_id, api_token_id?, abort_controller?, required_roles?)`
435
- inserts the entry **un-admitted**. Every `close_sockets_for_*` matches it
436
- from that instant. Otherwise it is inert: no `send` broadcast,
432
+ - `register_pending(ws, identity, abort_controller?)` (`identity: ConnectionIdentity`, as
433
+ the Rust `register_pending(sender, identity, signal)`; `add_connection` takes the same)
434
+ inserts the entry **un-admitted**. Every `close_connections` matches it
435
+ from that instant. Otherwise it is inert: no `broadcast`,
437
436
  `broadcast_filtered` (the predicate never sees it), `send_to_account`, or
438
- `request_connection` (`connection_gone`) reaches it; `get_connection_count`,
439
- `is_ready`, and `is_registered` don't see it
440
- (`get_pending_connection_count` does); the cap neither counts nor evicts it.
437
+ `request_connection` (`connection_gone`) reaches it; `connection_count`
438
+ and `is_registered` don't see it
439
+ (`pending_connection_count` does); the cap neither counts nor evicts it.
441
440
  - the caller re-reads the credential (`revalidate_resolved_auth`).
442
441
  - `take_pending_close_code(connection_id)` — after a refused `admit`, the
443
- close code the transport closed the pending entry with (4001, 4006, 1001),
442
+ close code the registry closed the pending entry with (4001, 4006, 1001),
444
443
  read once; what `register_action_ws` logs the refusal by.
445
444
  - `admit(connection_id)` returns `false` when the entry is gone — a revocation
446
445
  closed it while pending — and evicts nothing; otherwise it enforces the cap
@@ -454,12 +453,12 @@ harnesses that register a socket directly. An upgrade that authenticated a sessi
454
453
  uses the two-phase form.
455
454
 
456
455
  **Abort at close time.** The `abort_controller` passed at registration is the
457
- socket's per-connection controller. The transport aborts it when it closes the
456
+ socket's per-connection controller. The registry aborts it when it closes the
458
457
  connection — a revocation or a cap eviction — so in-flight handlers see
459
458
  `signal.aborted` at once, not when the close handshake lands.
460
459
  `remove_connection` only removes: it neither closes nor aborts.
461
460
 
462
- **Per-account connection cap.** `new BackendWebsocketTransport({max_connections_per_account})`
461
+ **Per-account connection cap.** `new ConnectionRegistry({max_connections_per_account})`
463
462
  — default `DEFAULT_MAX_CONNECTIONS_PER_ACCOUNT` (50), `null` disables, anything
464
463
  but a positive integer throws. The policy is **evict-oldest**: admission always
465
464
  admits the new connection, first closing the account's oldest admitted ones
@@ -472,7 +471,7 @@ real user. The check runs at **admission** (`admit`, or `add_connection`),
472
471
  which `register_action_ws` reaches in `onOpen` — after every upgrade gate
473
472
  (origin, auth, token scope, acting actor, role) and the credential re-read — so a refused or
474
473
  just-revoked request never closes someone's socket. An evicted connection
475
- leaves the transport's map at once — no broadcast or peer request reaches it,
474
+ leaves the registry's map at once — no broadcast or peer request reaches it,
476
475
  its pending peer requests drain as `connection_gone`, it stops counting toward
477
476
  the cap, its controller is aborted, and `register_action_ws` dispatches nothing
478
477
  more on it — while the socket itself is only closed once the close handshake
@@ -480,9 +479,9 @@ completes. Its `on_socket_close` fires when the close lands, and the
480
479
  `remove_connection` before it is a no-op. An eviction logs
481
480
  `ws: connection cap closed oldest` at
482
481
  info with `{account_id, closed, max}` (the Rust spine's line) through the
483
- transport's `log` (a `[ws]` logger when unset, `null` silences;
484
- `register_action_ws` passes its own to the transport it creates). The cap is per transport:
485
- endpoints sharing one transport share one count per account. The twin of the
482
+ registry's `log` (a `[ws]` logger when unset, `null` silences;
483
+ `register_action_ws` passes its own to the registry it creates). The cap is per registry:
484
+ endpoints sharing one registry share one count per account. The twin of the
486
485
  Rust `fuz_realtime` `ConnectionRegistry`'s cap — same default, same policy,
487
486
  same close code and reason — pinned on both by the
488
487
  `describe_ws_connection_cap_cross_tests` suite.
@@ -504,7 +503,7 @@ which bypasses the budget. A send never waits and never throws.
504
503
  frames over in order, on the microtask after a send and as the buffer drains.
505
504
  So a second send in one synchronous run reaches the socket a microtask later.
506
505
  - **The budget.** What waits is held to `outbound_queue_bytes`
507
- (`new BackendWebsocketTransport({outbound_queue_bytes})`, default
506
+ (`new ConnectionRegistry({outbound_queue_bytes})`, default
508
507
  `DEFAULT_WS_OUTBOUND_QUEUE_BYTES`, 4 MiB — its own constant, not derived from
509
508
  `max_message_bytes`; anything but a positive integer throws): each waiting
510
509
  frame is charged its UTF-8 length plus `OUTBOUND_FRAME_OVERHEAD_BYTES` (64),
@@ -555,22 +554,20 @@ or admitted — removal, abort, then the close through the writer — and answer
555
554
  with it (heartbeat timeout, oversized message, failed `on_socket_open`, refused
556
555
  admission).
557
556
 
558
- Targeted closure (all return socket count closed, use
559
- `WS_CLOSE_SESSION_REVOKED`, match pending and admitted entries alike, and abort
560
- each closed connection's controller):
561
-
562
- - `close_sockets_for_session(token_hash)`
563
- - `close_sockets_for_token(api_token_id)`
564
- - `close_sockets_for_account(account_id)` — coarse, covers session + bearer + daemon-token
565
-
566
- `close_sockets_for_role(account_id, role)` closes the account's connections
567
- whose `required_roles` include `role`, pending included, with
557
+ Targeted closure is `close_connections(target)` (`ConnectionCloser`, below):
558
+ it returns the socket count closed, matches pending and admitted entries alike
559
+ by `connection_identity_matches(identity, target)` — the twin of the Rust
560
+ `ConnectionIdentity::matches` — and aborts each closed connection's
561
+ controller. A `session` (`session_hash`), `token` (`api_token_id`), or
562
+ `account` (`account_id` — coarse, covers session + bearer + daemon-token)
563
+ target closes with `WS_CLOSE_SESSION_REVOKED`; a `role` target closes the
564
+ account's connections whose `required_roles` include `role` with
568
565
  `WS_CLOSE_PERMISSION_REVOKED` instead — over-closing an any-of gate (the loss
569
566
  of any listed role closes, whether or not the account still holds another).
570
567
 
571
- `close_all_sockets()` closes every connection, pending and admitted, with
568
+ `close_all_connections()` closes every connection, pending and admitted, with
572
569
  `WS_CLOSE_GOING_AWAY` instead — the shutdown close, removing and aborting each
573
- the same way — and leaves the transport **closing** for good (`is_closing()`):
570
+ the same way — and leaves the registry **closing** for good (`is_closing()`):
574
571
  every later registration is **born closed**. `register_pending` and
575
572
  `add_connection` then insert nothing, abort the caller's controller, and close
576
573
  the socket with `WS_CLOSE_GOING_AWAY` before returning an id that names
@@ -580,18 +577,19 @@ synchronous step as the closes, so an admission that finds its entry gone
580
577
  during shutdown reads the shutdown, never a revocation. Twin of the Rust
581
578
  registry's closing flag.
582
579
 
583
- Fan-out, to admitted connections only: `send(notification)` broadcasts to every
584
- connection; `broadcast_filtered(message, predicate)` runs per-connection ACL
585
- predicate over `ConnectionIdentity`; `send_to_account` wraps `broadcast_filtered` and
580
+ Fan-out, to admitted connections only, each returning how many connections
581
+ accepted the message: `broadcast(notification)` to every connection;
582
+ `broadcast_filtered(message, predicate)` runs per-connection ACL predicate over
583
+ `ConnectionIdentity`; `send_to_account` wraps `broadcast_filtered` and
586
584
  structurally satisfies `NotificationSender` (see `auth/CLAUDE.md` §WS
587
- notifications). `send(request)` is a misuse (a request has no single
588
- broadcast target) and returns an error envelope.
585
+ notifications). A server→client request has no broadcast form; it targets one
586
+ connection (`request_connection`, below).
589
587
 
590
588
  Server→client request/response (ActionPeer): `request_connection(connection_id,
591
589
  method, params, {timeout_ms?})` sends a `{jsonrpc, method, params, id}` frame to
592
590
  exactly one socket and awaits the reply, returning a `PeerRequestOutcome`
593
591
  (`{ok: true, value}` | `{ok: false, error: PeerRequestError}` —
594
- `timeout`/`connection_gone`/`too_many_in_flight`/`client_error`). The transport
592
+ `timeout`/`connection_gone`/`too_many_in_flight`/`client_error`). The registry
595
593
  owns the socket + the send; the correlation registry — id allocation, the pending
596
594
  map (nested `connection_id → s{n}` id, the nesting being the per-connection
597
595
  isolation guarantee), deadlines, and the in-flight cap — is `PendingPeerRequests`
@@ -600,7 +598,7 @@ in **`actions/peer_request.ts`** (also home to the peer types/constants +
600
598
  socket. `register_action_ws` routes inbound responses back via
601
599
  `resolve_peer_response` (→ `#pending.resolve`); connection close drains pending as
602
600
  `connection_gone`. Defaults: `DEFAULT_PEER_REQUEST_TIMEOUT` (10s),
603
- `MAX_IN_FLIGHT_PEER_REQUESTS_PER_CONNECTION` (256). Threaded to handlers as
601
+ `DEFAULT_MAX_IN_FLIGHT_PEER_REQUESTS_PER_CONNECTION` (256). Threaded to handlers as
604
602
  `ActionContext.request_client` (WS only; `undefined` on HTTP RPC). The `peer/ping`
605
603
  protocol action drives it; see `actions/peer_ping.ts`. An inbound reply matching
606
604
  no pending entry (unsolicited / cross-connection / late) is dropped + audited via
@@ -616,32 +614,34 @@ persistence + rehydration by the consumer.
616
614
  A WebSocket and an SSE stream are authorized once, at open, so a revocation
617
615
  takes effect on an open connection only when something closes it.
618
616
  `ConnectionCloser` is that capability — the twin of the Rust spine's
619
- `SocketRevoker`:
617
+ `ConnectionCloser`:
620
618
 
621
619
  ```ts
622
620
  interface ConnectionCloser {
623
- close_sockets_for_session: (session_token_hash: string) => number;
624
- close_sockets_for_token: (api_token_id: string) => number;
625
- close_sockets_for_account: (account_id: Uuid) => number;
626
- close_sockets_for_role: (account_id: Uuid, role: string) => number; // a revoked global grant
627
- close_all_sockets: () => number; // shutdown, never a revocation
621
+ close_connections: (target: ConnectionCloseTarget) => number;
622
+ close_all_connections: () => number; // shutdown, never a revocation
628
623
  }
624
+ type ConnectionCloseTarget =
625
+ | {kind: 'session'; session_hash: string}
626
+ | {kind: 'token'; api_token_id: string}
627
+ | {kind: 'account'; account_id: Uuid}
628
+ | {kind: 'role'; account_id: Uuid; role: string}; // a revoked global grant
629
629
  ```
630
630
 
631
- `BackendWebsocketTransport` satisfies it structurally;
632
- `create_sse_connection_closer(registry, required_role)` (`realtime/sse_auth_guard.ts`) adapts
633
- a `SubscriberRegistry` (`close_all_sockets` is `SubscriberRegistry.close_all`;
634
- `close_sockets_for_role` closes the account's streams when `role` is the
631
+ `ConnectionRegistry` satisfies it structurally;
632
+ `create_sse_connection_closer(registry, required_role)` (`realtime/audit_log_sse.ts`) adapts
633
+ an `SseRegistry` (`close_all_connections` is `SseRegistry.close_all`;
634
+ a `role` target closes the account's streams when `role` is the
635
635
  registry's gating role). No handler closes for a role: a role revocation's
636
- closes come from the audit listeners alone.
637
- Closing is idempotent and synchronous. `close_all_sockets` is the one method no
636
+ closes come from the revocation guard alone (below).
637
+ Closing is idempotent and synchronous. `close_all_connections` is the one method no
638
638
  revocation calls: `AppServer.close` runs it on `deps.connection_closer` to end
639
639
  every live connection of the backend at shutdown, and it has no
640
- `ConnectionCloseTarget` variant. It also leaves each member closing — the WS
641
- transport and `SubscriberRegistry` refuse every later registration (born
642
- closed) — so a closed transport or registry hosts nothing more. Its Rust
643
- counterpart is `ShutdownCloser::close_all_sockets`, a supertrait of
644
- `SocketRevoker`.
640
+ `ConnectionCloseTarget` variant. It also leaves each member closing — the WS connection
641
+ registry and `SseRegistry` refuse every later registration (born
642
+ closed) — so a closed connection registry or SSE registry hosts nothing more. Its Rust
643
+ counterpart is `ShutdownCloser::close_all_connections`, a supertrait of
644
+ `ConnectionCloser`.
645
645
 
646
646
  **Every revocation closes after its commit.** A handler inside a route or
647
647
  action transaction never calls a closer inline: it calls
@@ -649,15 +649,13 @@ action transaction never calls a closer inline: it calls
649
649
  which puts the close on the request's post-commit queue (`emit_after_commit`).
650
650
  The close runs once the handler's transaction has committed and is discarded
651
651
  when the handler throws — a rolled-back revocation closes nothing. `target` is
652
- a `ConnectionCloseTarget` (`{kind: 'session', session_token_hash}` /
653
- `{kind: 'token', api_token_id}` / `{kind: 'account', account_id}` /
654
- `{kind: 'role', account_id, role}`);
655
- `close_connections(closer, target)` is the immediate form the queue runs. A
652
+ a `ConnectionCloseTarget`; `closer.close_connections(target)` is the
653
+ immediate form the queue runs. A
656
654
  handler with no wrapping transaction (`/login`, `/password`) opens its own
657
655
  around its writes and closes straight after that commit with
658
656
  `close_connections_after_commit(closer, target, log)`, which logs a failing
659
- close as the post-commit flush does. Twin of `queue_socket_close` /
660
- `SocketCloseTarget`.
657
+ close as the post-commit flush does. Twin of `queue_connection_close` /
658
+ `ConnectionCloseTarget`.
661
659
 
662
660
  The order is load-bearing for admission: a connection registers, then re-reads
663
661
  its credential, so a close that missed the registration must belong to a
@@ -674,15 +672,15 @@ carry caller-supplied ids.
674
672
  by reference: a closer added twice is one member, reached once. `add` returns a
675
673
  remover for that addition (idempotent); additions are counted, so the closer
676
674
  stays a member until every addition is removed — one owner releasing a shared
677
- transport leaves it reachable for the others.
675
+ registry leaves it reachable for the others.
678
676
  `create_app_backend` puts one on `AppDeps.connection_closer`; `create_app_server`
679
- adds each mounted WS transport and the audit stream registry itself (passing
680
- `connection_closer: null` to the mount functions so it holds the removers), and
681
- removes them when its assembly fails or `AppServer.close` runs — after
682
- `close_all_sockets` across them all. Twin of
683
- `RealtimeRevoker`. A member that throws does not stop the fan-out — every
677
+ adds each mounted WS connection registry and the audit stream registry itself (passing
678
+ `connection_closer: null` to the mount functions so it holds the removers),
679
+ registers the revocation guard on it, and removes them when its assembly fails
680
+ or `AppServer.close` runs — after `close_all_connections` across them all. Twin of
681
+ `RealtimeCloser`. A member that throws does not stop the fan-out — every
684
682
  member is called, then the first error is thrown for the caller to log;
685
- `BackendWebsocketTransport` and `SubscriberRegistry.close_by_identity` treat a
683
+ `ConnectionRegistry` and `SseRegistry.close_by_identity` treat a
686
684
  throwing socket or stream the same way. `noop_connection_closer` is a `ConnectionCloser` that closes
687
685
  nothing, for hand-built action-factory deps on a backend with no
688
686
  live-connection surface.
@@ -695,13 +693,13 @@ It is required where it is read, so it can't be forgotten:
695
693
  the connections of each expired session it deletes — `auth/CLAUDE.md`
696
694
  §Cleanup), and the
697
695
  `connection_closer: RealtimeCloser | null` option of `register_action_ws` /
698
- `register_ws_endpoint` / `create_audit_log_sse`, which add their transport to it
699
- (`null` is the explicit opt-out, or for a caller that adds the transport itself
696
+ `create_audit_log_sse`, which add their registry to it
697
+ (`null` is the explicit opt-out, or for a caller that adds the registry itself
700
698
  to hold the remover, as `create_app_server` does).
701
699
 
702
- ## WS auth guard (`actions/transports_ws_auth_guard.ts`)
700
+ ### Revocation guard (`create_revocation_guard`)
703
701
 
704
- The audit-listener half of revocation: `create_ws_auth_guard(closer, log)`
702
+ The audit-listener half of revocation: `create_revocation_guard(closer, log)`
705
703
  returns an `on_audit_event` callback that repeats a revocation's close when its
706
704
  audit row is announced. It covers a revocation emitted by code that holds no
707
705
  closer; for the builtin handlers it is a repeat of the close they already
@@ -709,40 +707,43 @@ queued. A success row is announced only after its request's transaction commits
709
707
  (`auth/CLAUDE.md` §Audit emitter), so the guard's close is post-commit too. Its
710
708
  closes reach a connection still pending admission.
711
709
 
712
- `closer` is any `ConnectionCloser` — a `BackendWebsocketTransport`, or a
713
- `RealtimeCloser` to cover every transport from one listener. For standard WS
714
- endpoints mounted via `AppServerOptions.ws_endpoints`, `create_app_server`
715
- registers the guard via `backend.deps.audit.add_listener` automatically (per
716
- `WsEndpointSpec.auth_guard`). For custom wiring, register inside the consumer's
717
- `audit_factory` body.
718
-
719
- It dispatches on the `RevocationScope` each event declares in
720
- `audit_event_revocation_scopes` (`auth/audit_log_schema.ts`), the table the SSE
721
- guard reads too — one declaration, so the two can't drift:
722
-
723
- - `session` (`session_revoke`) → `close_sockets_for_session(metadata.session_id)`
724
- - `token` (`token_revoke`) → `close_sockets_for_token(metadata.token_id)`
710
+ **One guard, on the fan-out.** `create_app_server` registers one on
711
+ `deps.connection_closer` when it mounts a WS endpoint or the audit stream —
712
+ after the audit stream's broadcast listener, so a revocation's row reaches the
713
+ stream before the close — and the fan-out carries each close to every member:
714
+ each WS connection registry and the audit stream registry (`create_sse_connection_closer`).
715
+ A consumer wiring outside `create_app_server` registers its own, over a closer
716
+ holding its transports, inside its `audit_factory` body.
717
+
718
+ It maps each row to a close target with `to_connection_close_target(event)` —
719
+ the twin of the Rust `ConnectionCloseTarget::from_audit_event` — then calls
720
+ `closer.close_connections(target)`. The mapping dispatches on the
721
+ `RevocationScope` each event declares in `audit_event_revocation_scopes`
722
+ (`auth/audit_log_schema.ts`), and a row missing its key (an empty string
723
+ included) maps to nothing:
724
+
725
+ - `session` (`session_revoke`) → `{kind: 'session', session_hash: metadata.session_id}`
726
+ - `token` (`token_revoke`) → `{kind: 'token', api_token_id: metadata.token_id}`
725
727
  - `account` (`session_revoke_all`, `token_revoke_all`, `password_change`,
726
728
  `logout`, `account_delete`, `account_purge`) →
727
- `close_sockets_for_account(target_account_id ?? account_id)`
728
- - `role` (`role_grant_revoke`) → `close_sockets_for_role(target_account_id ??
729
- account_id, metadata.role)` when the revoked grant was global
729
+ `{kind: 'account', account_id: target_account_id ?? account_id}`
730
+ - `role` (`role_grant_revoke`) → `{kind: 'role', account_id: target_account_id ??
731
+ account_id, role: metadata.role}` when the revoked grant was global
730
732
  (`to_global_role_revocation`); a scoped revoke closes nothing. Per-message
731
733
  dispatch re-authorizes each request against its own action, but nothing
732
- re-checks what a socket admitted by a role gate receives — every push its
733
- endpoint sends — so the socket closes, with `WS_CLOSE_PERMISSION_REVOKED`.
734
- The SSE guard closes its streams on the same rows. No handler closes for a
735
- role, so this guard is the one closer.
734
+ re-checks what a connection admitted by a role gate receives — every push its
735
+ endpoint sends, every row the stream sends — so a socket closes with
736
+ `WS_CLOSE_PERMISSION_REVOKED` and a stream gated on the role ends. No handler
737
+ closes for a role, so this guard is the one closer.
736
738
  - `none` → nothing — every other event, and any event type fuz_app doesn't
737
739
  define
738
740
 
739
- `outcome === 'failure'` events are ignored — they carry attacker-controlled
740
- identifiers. Reacting to them would let an authenticated caller close
741
- another user's socket by guessing a session hash or token id.
742
-
743
- ## WebSocket dispatch — three layered entry points
741
+ Only `outcome === 'success'` events act — a failure carries attacker-controlled
742
+ identifiers, and an outcome outside the enum is no revocation. Reacting to them would let an authenticated caller close
743
+ another user's connection by guessing a session hash or token id. Twin of the
744
+ Rust spine's `register_revocation_guard`.
744
745
 
745
- In decreasing abstraction.
746
+ ## WebSocket endpoints
746
747
 
747
748
  ### `create_app_server.ws_endpoints` — canonical mount surface
748
749
 
@@ -751,7 +752,7 @@ of `WsEndpointSpec` or a factory
751
752
  `(ctx: AppServerContext) => ReadonlyArray<WsEndpointSpec>`; factory form
752
753
  runs after server context is assembled so action lists can depend on
753
754
  `ctx.deps` / `ctx.action_*_rate_limiter`. Each entry is auto-mounted via
754
- `register_ws_endpoint` against the assembled Hono app.
755
+ `register_action_ws` against the assembled Hono app.
755
756
 
756
757
  `create_upgrade_websocket: (app: Hono) => UpgradeWebSocket` returns the
757
758
  Hono adapter helper. It is a factory because Node's `createNodeWebSocket({app})`
@@ -765,103 +766,114 @@ NOT trip the check, so feature-flag gated WS surfaces stay safe.
765
766
  What every auto-mount gets, so no hand mount has to remember it: the
766
767
  `action_ip_rate_limiter` / `action_account_rate_limiter` instances the RPC
767
768
  endpoints charge (one budget per action across transports), the server's
768
- `allowed_origins` when the spec sets none (`resolve_ws_endpoints`, read by
769
- both the mount and the surface), registration ahead of
770
- `post_route_middleware` and `static_serving`, the surface entry, and the
771
- guards below. A `ws_endpoints` or `rpc_endpoints` path outside the auth
772
- middleware's scope (`AUTH_MIDDLEWARE_PATH`, `'/api/*'`, from
773
- `auth/middleware.ts` — matched with `middleware_applies`, so `/api` itself is
774
- inside) throws at assembly (`assert_endpoint_in_auth_scope`, which
769
+ `allowed_origins` when the spec sets none and the sole RPC endpoint's actions
770
+ when it omits `actions` (`resolve_ws_endpoints`, read by both the mount and the
771
+ surface), registration ahead of `post_route_middleware` and `static_serving`,
772
+ the surface entry, and the revocation guard. A `ws_endpoints` or `rpc_endpoints`
773
+ path outside the auth middleware's scope (`AUTH_MIDDLEWARE_PATH`, `'/api/*'`,
774
+ from `auth/middleware.ts` — matched with `middleware_applies`, so `/api` itself
775
+ is inside) throws at assembly (`assert_endpoint_in_auth_scope`, which
775
776
  `create_test_app_surface_spec` also runs): there no session or bearer is
776
777
  parsed and every caller would be unauthenticated.
777
778
 
778
779
  `WsEndpointSpec` fields: `path`, `allowed_origins?` (default: the server's),
779
- `actions`,
780
- `required_roles?`, `transport?`, `max_connections_per_account?`,
781
- `outbound_queue_bytes?`, `heartbeat?`,
782
- `artificial_delay?`, `max_message_bytes?`,
783
- `on_socket_open?`, `on_socket_close?`, `auth_guard?` (default `true`,
784
- deduped by reference identity via `WeakSet<BackendWebsocketTransport>`),
785
- `extra_audit_handlers?`. Every mounted transport is added to
786
- `deps.connection_closer`, whatever `auth_guard` says — the flag opts out of
787
- the audit listener, not of the handlers' closes.
780
+ `actions?`, `required_roles?`, `registry?`, `max_connections_per_account?`,
781
+ `outbound_queue_bytes?`, `receive_timeout?`, `max_message_bytes?`,
782
+ `on_socket_open?`, `on_socket_close?`. Every mounted registry is added to
783
+ `deps.connection_closer`.
784
+
785
+ **One action set across transports.** A spec that omits `actions` serves the
786
+ actions of the server's sole `rpc_endpoints` entry through `to_ws_actions`
787
+ (`actions/protocol.ts`): `protocol_actions` first, then the RPC list less any
788
+ protocol action it carries (`peer_ping_action` rides the RPC list so an HTTP
789
+ caller is refused `peer_no_transport` rather than `method_not_found`). One set
790
+ of handler closures then runs on both transports. Assembly throws when a spec
791
+ omits `actions` and no RPC endpoint, or more than one, resolves.
788
792
 
789
793
  `max_connections_per_account` sets the per-account connection cap on the
790
- transport the mount creates (`RegisterActionWsOptions` carries the same field).
791
- It throws alongside `transport` — a supplied transport carries its own cap, set
794
+ registry the mount creates (`RegisterActionWsOptions` carries the same field).
795
+ It throws alongside `registry` — a supplied registry carries its own cap, set
792
796
  where it was constructed, and an option that silently did nothing would read as
793
797
  enforced. `outbound_queue_bytes` sets the per-connection outbound budget on that
794
- transport the same way (default `DEFAULT_WS_OUTBOUND_QUEUE_BYTES`; zero or a
798
+ registry the same way (default `DEFAULT_WS_OUTBOUND_QUEUE_BYTES`; zero or a
795
799
  non-positive value throws at assembly, as does passing it alongside
796
- `transport`).
800
+ `registry`).
797
801
 
798
- Mounted transport reachable at `app_server.ws_endpoints[path]`
799
- (`Readonly<Record<string, BackendWebsocketTransport>>`). Duplicate paths
802
+ Mounted registry reachable at `app_server.ws_endpoints[path]`
803
+ (`Readonly<Record<string, ConnectionRegistry>>`). Duplicate paths
800
804
  across `WsEndpointSpec`s throw at assembly, before any endpoint mounts.
801
805
  Cross-surface collisions (same `GET <path>` on both `RouteSpec` and
802
806
  `WsEndpointSpec`) throw with exact-string match. Pattern overlap (e.g.
803
807
  `GET /api/:resource` vs `/api/ws`) is not detected — Hono's specific-before-wildcard routing keeps
804
808
  those working but avoid the overlap.
805
809
 
806
- `auth_guard` is also the one closer of a role revocation: with it off for a
807
- transport, a revoked role closes none of its sockets. When multiple specs share a transport,
808
- **any** spec with `auth_guard !== false` wires the guard for that
809
- transport (OR-semantics).
810
-
811
810
  `AppSurfaceWsEndpoint.methods` surfaces `request_response` +
812
811
  `remote_notification` specs only — `local_call` specs are filtered out
813
812
  because they don't dispatch over WS.
814
813
 
815
- ### `register_ws_endpoint` — middle tier
816
-
817
- Composes the standard upgrade stack:
818
-
819
- 1. `verify_request_source(allowed_origins)`
820
- 2. `require_auth`
821
- 3. `require_token_scope('surface:ws_upgrade')` — a narrowed token cannot hold a socket
822
- 4. Upgrade-time authorization phase — resolves the acting actor (`?acting=` through `parse_acting`; malformed reads as omitted), seeds `REQUEST_CONTEXT_KEY` for the inner `register_action_ws`
823
- 5. Optional `require_role(required_roles)` — any-of disjunction (coarse upgrade-time gate; per-action `auth` in each spec still applies at dispatch time)
824
- 6. Delegates to `register_action_ws`
825
-
826
- Extends `RegisterActionWsOptions` with `allowed_origins` (required here —
827
- there is no server list to default from) and optional `required_roles`, and
828
- inherits its required `connection_closer` and action limiters. Returns
829
- `{transport}`. Most consumers reach for
830
- `ws_endpoints` above. Call it directly only to mount a WS endpoint outside
831
- `create_app_server`'s assembly.
832
-
833
- ### `register_action_ws` — lower-level dispatcher
834
-
835
- Exposed for tests (`create_ws_test_harness`) that need to drive the
836
- dispatcher without the origin/auth front-stack.
814
+ ### `register_action_ws` — the endpoint
815
+
816
+ Mounts one `GET path` route, its guards in the route-spec pipeline's
817
+ coarse-to-fine order (from `fuz_auth_guard_resolver` over the upgrade's auth
818
+ shape `{account: 'required', actor: 'required', roles?, required_scope:
819
+ 'surface:ws_upgrade'}`):
820
+
821
+ 1. `verify_request_source(allowed_origins)` — 403
822
+ 2. `require_auth` — 401
823
+ 3. `require_token_scope('surface:ws_upgrade')` — a narrowed token cannot hold a socket (403 `token_scope_required`)
824
+ 4. The authorization phase (`run_authorization_phase`, `auth/request_context.ts`) — resolves the acting actor (`?acting=` through `parse_acting`; malformed reads as omitted, and the route declares no query schema, so a credential-less `?acting=garbage` is still the 401), seeds `REQUEST_CONTEXT_KEY`
825
+ 5. `require_role(required_roles)` when the endpoint is gated — any-of disjunction (coarse upgrade-time gate; per-action `auth` in each spec still applies at dispatch time)
826
+ 6. `upgradeWebSocket`
827
+
828
+ Only `GET` is mounted (Hono serves `HEAD` through it, guards included), so any
829
+ other method on the path is a 404. Takes
830
+ `allowed_origins` (required — `create_app_server` passes the server's), the
831
+ required `connection_closer` and action limiters, and optional
832
+ `required_roles`; returns `{registry}`. Most consumers reach for
833
+ `ws_endpoints` above; call it directly only to mount a WS endpoint outside
834
+ `create_app_server`'s assembly. Tests drive the dispatcher without the
835
+ guards through `create_ws_test_harness`, which invokes the captured events
836
+ factory directly.
837
+
838
+ The per-socket half lives in `actions/ws_socket_session.ts`:
839
+ `create_ws_socket_events(endpoint, upgrade)` returns the `WSEvents` for one
840
+ upgraded socket — admission, the pre-admission queue, the receive watchdog,
841
+ the credential deadline, frame dispatch, and close. `register_action_ws` reads
842
+ the Hono context at upgrade into a `WsSocketUpgrade` and derives the
843
+ endpoint's `WsSocketEndpoint` once; the module never touches the Hono app.
844
+ Its exports include the socket bounds (`MAX_PRE_ADMISSION_FRAMES`,
845
+ `PRE_ADMISSION_QUEUE_BYTES_FACTOR`, `MAX_INBOUND_DISPATCHES_PER_CONNECTION`),
846
+ the duplicate-id and overflow wire strings, and the `on_socket_open` /
847
+ `on_socket_close` contexts (`SocketOpenContext`, `SocketCloseContext`).
837
848
 
838
849
  Per-message dispatch delegates to `perform_action` — the shared core that
839
- HTTP RPC also calls. `register_action_ws` owns only WS-specific concerns:
850
+ HTTP RPC also calls. The socket session owns only WS-specific concerns:
840
851
 
841
- - **Wire envelope parsing** — JSON.parse → batch rejection → peer-response routing → envelope-version guard → notification interception (cancel, silent drop) → `JsonrpcRequest.safeParse` → per-message dispatch. The version guard is what makes `{method: 'x'}` and `{jsonrpc: '1.0', method: 'x'}` an `invalid_request` answer rather than a silently dropped notification, matching the first check the Rust `classify` runs. Peer-response routing is the twin's response shape exactly — no `method` key, a string/number `id`, exactly one of `result` / `error` — so a hybrid frame like `{method, id, result}` stays a dispatchable request instead of being demuxed and swallowed. The envelope schema is the same one the HTTP POST path runs, so `params: null`, an array `params`, or a non-string/number `id` answers `invalid_request` (-32600) on both transports rather than reaching the dispatcher as `invalid_params`. It runs **after** the notification/cancel block: notifications carry no id to echo and stay unvalidated, and `cancel` routing precedes it. The version guard echoes the id via `to_jsonrpc_envelope_id` (a scalar frame answers `id: null`), the later steps via `to_jsonrpc_message_id`.
852
+ - **Wire envelope parsing** — JSON.parse → batch rejection → `classify_jsonrpc_message` (`http/jsonrpc_helpers.ts`, the twin of the Rust `fuz_http::classify`, the same classifier the HTTP POST path runs) → per-arm handling: an `invalid` answers its error on its id; a `response` routes to the socket's pending peer request; a `notification` routes `cancel` and is otherwise dropped; a `request` goes on to the duplicate-id and in-flight checks and dispatch. The classifier runs the twin's order — version, then the `method` axis, then `id`, then the `JsonrpcRequest` envelope — so `{method: 'x'}` and `{jsonrpc: '1.0', method: 'x'}` answer `invalid_request` rather than being dropped as notifications; a response is the twin's shape exactly (no string `method`, a string/number `id`, exactly one of `result` / `error`), so a hybrid like `{method, id, result}` stays a dispatchable request; and `params: null`, an array `params`, or a non-string/number `id` answers `invalid_request` (-32600) on both transports rather than reaching the dispatcher as `invalid_params`. Notifications stay unvalidated (they carry no id to echo). A non-object frame answers `id: null`. POST answers a notification or a response `invalid_request` on `id: null`, as the Rust spine does.
842
853
  - **Cancel-notification interception** — `{request_id → AbortController}` map; aborts the matching pending controller before the cancel bubbles past the dispatcher
843
854
  - **Duplicate live ids refused** — a request whose id names a request still running on the socket is answered `invalid_request` with `data.reason` `ERROR_DUPLICATE_REQUEST_ID` and not dispatched; the running request keeps its controller, its cancel entry, and its reply id. An id is free again once its request is answered. Same refusal on the Rust spine
844
- - **In-flight ceiling** — at most `MAX_INBOUND_DISPATCHES_PER_CONNECTION` (128) requests run at once per socket (`@hono/node-ws` does not await `onMessage`, so nothing else bounds them); one more is answered `queue_overflow` (`WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE`) and not dispatched, and the socket stays open and keeps reading — a reply to a server-initiated request still gets through. The duplicate check runs first; neither refusal reaches `perform_action`, so neither charges the action rate limiters. Same cap, message, and order as the Rust spine's `MAX_INBOUND_DISPATCHES_PER_CONN`
845
- - **Socket-scoped notify** — `(method, params) => transport.send_to(connection_id, notification)`, threaded into `perform_action` as `notify`
846
- - **Every send through the transport** — responses, error frames, and notifications all go through `transport.send_to`, so they are held to the connection's outbound budget; a handler that sends past it closes its own socket with `WS_CLOSE_OUTBOUND_OVERFLOW` and gets no response written
855
+ - **In-flight ceiling** — at most `MAX_INBOUND_DISPATCHES_PER_CONNECTION` (128) requests run at once per socket (`@hono/node-ws` does not await `onMessage`, so nothing else bounds them); one more is answered `queue_overflow` (`WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE`) and not dispatched, and the socket stays open and keeps reading — a reply to a server-initiated request still gets through. The duplicate check runs first; neither refusal reaches `perform_action`, so neither charges the action rate limiters. Same cap, message, and order as the Rust spine's `MAX_INBOUND_DISPATCHES_PER_CONNECTION`
856
+ - **Socket-scoped notify** — `(method, params) => registry.send_to(connection_id, notification)`, threaded into `perform_action` as `notify`
857
+ - **Every send through the registry** — responses, error frames, and notifications all go through `registry.send_to`, so they are held to the connection's outbound budget; a handler that sends past it closes its own socket with `WS_CLOSE_OUTBOUND_OVERFLOW` and gets no response written
847
858
  - **Composed abort signal** — `AbortSignal.any([socket_close, per_request_cancel])`, threaded as `signal`
848
- - **Connection lifecycle** — admission (`transport.register_pending` → credential re-read → `transport.admit`, which enforces the per-account connection cap) / `remove_connection`, `on_socket_open` / `_close` hooks, server heartbeat
859
+ - **Connection lifecycle** — admission (`registry.register_pending` → `recheck_admission` → `registry.admit`, which enforces the per-account connection cap) / `remove_connection`, `on_socket_open` / `_close` hooks, server heartbeat
849
860
  - **The inbound gate** — frames queue until the socket is admitted and `on_socket_open` has completed; frames on a socket the server closed are dropped
850
861
 
851
862
  **Admission.** `onOpen` registers the connection pending (synchronously, with
852
- the socket's `AbortController`), re-reads the credential captured at upgrade
853
- (`revalidate_resolved_auth({db}, resolved)` — session row / token row / account
854
- row, no touch; `resolved` is `get_resolved_auth(c)`, the one derivation the
855
- audit stream shares, read off the keys the auth middleware set), then
856
- `transport.admit`s. A dead credential, or a pending entry a revocation closed
863
+ the socket's `AbortController`), re-reads what the gates read
864
+ (`recheck_admission({db}, {resolved, request_context, required_roles})`,
865
+ `auth/resolved_auth.ts`, which the audit stream shares: the credential —
866
+ session row / token row / account row, no touch — the acting actor, and the
867
+ role; `resolved` is `get_resolved_auth(c)`, the value the auth middleware
868
+ set), then `registry.admit`s. A dead credential, or a pending entry a revocation closed
857
869
  meanwhile, closes the socket with `WS_CLOSE_SESSION_REVOKED` and the reason a
858
870
  revoked socket gets; a re-check that throws closes it with
859
871
  `WS_CLOSE_INTERNAL_ERROR` (`internal error`) — fail closed, never admitted
860
- unchecked. An endpoint with `required_roles` re-reads them beside the
861
- credential — the acting actor's grants afresh (`refresh_role_grants`), a global
862
- grant of any listed role admitting, as the gate in front did — and refuses a
863
- lost role with `WS_CLOSE_PERMISSION_REVOKED`; a failed role read is the same
864
- 1011. During shutdown a refusal is the shutdown's instead: an upgrade
872
+ unchecked. A soft-deleted acting actor is refused like a dead credential. An
873
+ endpoint with `required_roles` re-reads them beside the credential — the acting
874
+ actor's grants afresh (`refresh_role_grants`), a global grant of any listed role
875
+ admitting, as the gate in front did — and refuses a lost role with
876
+ `WS_CLOSE_PERMISSION_REVOKED`; a failed role read is the same 1011. During shutdown a refusal is the shutdown's instead: an upgrade
865
877
  pending at the close-all was closed by it with `WS_CLOSE_GOING_AWAY` and its
866
878
  controller aborted, so the refusal after the re-read — even one the closing
867
879
  database failed — writes nothing more; an upgrade that registers after it is
@@ -876,13 +888,13 @@ revocation closes only after its commit — see
876
888
  ../../../docs/security.md §Connection Admission and §Closing on Revocation.
877
889
 
878
890
  `connection_closer: RealtimeCloser | null` is a required option: the endpoint's
879
- transport is added to it, so the revocation handlers' post-commit closes reach
891
+ registry is added to it, so the revocation handlers' post-commit closes reach
880
892
  the sockets opened here. The add is the mount's last step, so a mount that
881
893
  throws (a registry that fails to compile) adds nothing; the addition is
882
- permanent, its remover not returned. `null` is for a transport no revocation
894
+ permanent, its remover not returned. `null` is for a registry no revocation
883
895
  has to reach (a harness driving the dispatcher directly), or one the caller
884
896
  adds itself to hold the remover — `create_app_server` passes `null` and adds
885
- the transport after the mount returns, releasing it when assembly fails or
897
+ the registry after the mount returns, releasing it when assembly fails or
886
898
  the server closes.
887
899
 
888
900
  Because `onOpen` awaits, an adapter can deliver `onMessage` before admission
@@ -903,24 +915,24 @@ returns a promise that settles when the frame was dispatched or dropped.
903
915
 
904
916
  The queue holds **every** inbound frame, replies to server-initiated requests
905
917
  included — so an `on_socket_open` hook that awaits
906
- `transport.request_connection` on its own connection gets no reply until it
918
+ `registry.request_connection` on its own connection gets no reply until it
907
919
  returns (it times out); start such a request without awaiting it.
908
920
 
909
921
  **A server-closed socket dispatches nothing.** An adapter can keep delivering
910
922
  frames after the server calls `ws.close(…)`, until the close handshake
911
923
  completes — `@hono/node-ws` does, for up to the `ws` close timeout when the
912
924
  client withholds its close frame. So every server-side close removes the
913
- connection from the transport and aborts the socket's controller **at close
914
- time**: the transport does both for a revocation or a cap eviction, and
915
- `register_action_ws`'s `end_socket` does both — through
916
- `transport.close_connection` — for a heartbeat timeout, a credential
925
+ connection from the registry and aborts the socket's controller **at close
926
+ time**: the registry does both for a revocation or a cap eviction, and
927
+ `ws_socket_session.ts`'s `end_socket` does both — through
928
+ `registry.close_connection` — for a heartbeat timeout, a credential
917
929
  expiry, an oversized message, a failed `on_socket_open`, and a refused
918
930
  admission.
919
931
  `onMessage` then drops any frame whose socket has ended — no dispatch, no
920
- error reply. A connection the transport no longer holds though nothing closed
921
- its socket (a bare `transport.remove_connection`; `transport.is_registered` is
932
+ error reply. A connection the registry no longer holds though nothing closed
933
+ its socket (a bare `registry.remove_connection`; `registry.is_registered` is
922
934
  the twin of the Rust `is_registered`) is ended on its next frame with
923
- `WS_CLOSE_INTERNAL_ERROR` (`connection unregistered`), so it can't linger as a
935
+ `WS_CLOSE_INTERNAL_ERROR` (`WS_CLOSE_CONNECTION_UNREGISTERED_REASON`), so it can't linger as a
924
936
  socket that reads everything, answers nothing, and — being chatty — is never
925
937
  reaped by the heartbeat. Only a frame that is queued or dispatched counts as
926
938
  heartbeat activity.
@@ -930,18 +942,20 @@ heartbeat activity.
930
942
  changes during a connection lifetime are picked up on the next message —
931
943
  no in-place refresh. A revoked global grant of a role the endpoint's
932
944
  `required_roles` lists closes the socket (`WS_CLOSE_PERMISSION_REVOKED`,
933
- through `create_ws_auth_guard`), since nothing else re-checks what it
945
+ through the revocation guard), since nothing else re-checks what it
934
946
  receives. Authentication
935
947
  invalidation (a session or token revoke, `password_change`, a logout, an
936
948
  account delete, a cap eviction) still closes the socket — the revoking
937
- handler through `connection_closer`, `create_ws_auth_guard` again on the
949
+ handler through `connection_closer`, the revocation guard again on the
938
950
  audit row.
939
951
 
940
- Per-message side-effect queues: `pending_effects` (eager) drains via
941
- `flush_pending_effects`; `post_commit_effects` (deferred — pushed by
942
- handlers via `emit_after_commit`) drains via `flush_post_commit_effects`.
943
- Both flush in the same `try/finally` that releases the request controller,
944
- after the reply is sent, and every rejection is logged. Nothing orders that
952
+ Per-message side-effect queues: `pending_effects` (eager) and
953
+ `post_commit_effects` (deferred — pushed by handlers via
954
+ `emit_after_commit`) drain through `flush_request_effects`, the flush the
955
+ HTTP middleware shares. Both flush in the same `try/finally` that releases
956
+ the request controller, after the reply is sent; every rejection is logged
957
+ and reaches `on_effect_error` (`create_app_server` threads its own to the
958
+ endpoints it mounts) with `{transport: 'ws', method, path}`. Nothing orders that
945
959
  flush against other frames: frames on an admitted socket are not serialized
946
960
  (`handle_frame` calls aren't chained, and an adapter need not await
947
961
  `onMessage` — `@hono/node-ws` doesn't), so a message's effects can still be
@@ -971,21 +985,25 @@ held by the cross-backend WS suite.)
971
985
  **Lifecycle hooks.** `on_socket_open({ws, connection_id, identity, notify, signal})`
972
986
  fires once the connection is admitted and before the first message dispatches
973
987
  (frames sent meanwhile wait); awaited; throws log + an `internal_error` frame +
974
- close with `WS_CLOSE_INTERNAL_ERROR` `'socket bootstrap failed'`, unregistering
988
+ close with `WS_CLOSE_INTERNAL_ERROR` and `WS_CLOSE_SOCKET_OPEN_FAILED_REASON`, unregistering
975
989
  the connection.
976
990
  `on_socket_close({ws, connection_id, identity})` fires — only for a socket that
977
991
  was admitted — after
978
- `transport.remove_connection(connection_id)` — a slow hook never holds a dead
992
+ `registry.remove_connection(connection_id)` — a slow hook never holds a dead
979
993
  entry that broadcasts still target and the per-account cap still counts.
980
994
  `connection_id` and `identity` are the values captured at open, so the hook
981
995
  reads them the same way after a client close, a revocation, or a connection-cap
982
996
  eviction; its `ws` is the close event's context, which on some adapters is not
983
997
  the object `on_socket_open` received. Errors logged and swallowed.
984
998
 
985
- **Server-side heartbeat** (`heartbeat?: boolean | ServerHeartbeatOptions`):
986
- default-on, 60s silence timeout. Any inbound message resets
987
- `last_receive_time` — chatty clients never trip it. The timer starts at
988
- admission, and the first timeout window after it is exempt (cold-start grace).
999
+ **Receive timeout** (`receive_timeout?: number | null`, ms): default-on at
1000
+ `DEFAULT_WS_RECEIVE_TIMEOUT` (60s) — the twin of the Rust spine's
1001
+ `ActionWsOptions.receive_timeout` — `null` keeps silent sockets open, and a
1002
+ value that is not positive, or is past `WS_RECEIVE_TIMEOUT_MAX` (2³¹ − 1 ms,
1003
+ the longest delay a timer honors; TS-only), throws at registration. Any
1004
+ inbound message resets `last_receive_time` — chatty clients never trip it. The
1005
+ timer starts at admission, and the first timeout window after it is exempt
1006
+ (cold-start grace).
989
1007
  Tick interval is `timeout / 2`, so event-loop blockage pauses the timer itself.
990
1008
  A timeout unregisters the connection and aborts its signal along with the
991
1009
  `WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT` close.
@@ -1003,7 +1021,7 @@ socket ends. Twin of the Rust loop's `WsLoopOptions::credential_deadline`.
1003
1021
 
1004
1022
  Two abort signals composed via `AbortSignal.any`:
1005
1023
 
1006
- - `socket_abort_controller` — per-socket, fires when the socket ends: at the server's close (revocation, cap eviction, heartbeat timeout, …) or the client's. Registered with the transport, which aborts it on the closes it makes. Drives every handler's `ctx.signal`.
1024
+ - `socket_abort_controller` — per-socket, fires when the socket ends: at the server's close (revocation, cap eviction, heartbeat timeout, …) or the client's. Registered with the registry, which aborts it on the closes it makes. Drives every handler's `ctx.signal`.
1007
1025
  - `pending_controllers: Map<JsonrpcRequestId, AbortController>` — per-request. Registered before dispatch (one entry per running request — a duplicate live id is refused — so its size is the in-flight count the ceiling bounds), cleared in `finally` so late cancels for a completed id (or a reused id) can't null-abort the wrong handler. Unknown cancels no-op.
1008
1026
 
1009
1027
  ## Protocol actions (`actions/protocol.ts`)
@@ -1022,14 +1040,14 @@ Two const arrays:
1022
1040
  - `protocol_actions: ReadonlyArray<Action>` — for the server's `register_action_ws` `actions`. Spread before consumer-owned actions.
1023
1041
  - `protocol_action_specs: ReadonlyArray<ActionSpecUnion>` — derived via `.map(a => a.spec)` so the two arrays cannot drift. For the frontend `ActionRegistry`.
1024
1042
 
1025
- Asymmetry intentional — server runs handlers (heartbeat echo, cancel
1026
- stub, peer/ping round-trip), frontend registry only stores specs. Both
1043
+ Asymmetry intentional — server runs handlers (heartbeat echo, peer/ping
1044
+ round-trip; cancel is dispatcher-owned), frontend registry only stores specs. Both
1027
1045
  bundles plus the codegen `include_protocol_actions: false` default form a
1028
1046
  three-leg contract; `PROTOCOL_ACTION_METHODS` (in `actions/action_codegen.ts`)
1029
1047
  is the method-name set that drives both the codegen filter and the action-manifest
1030
1048
  exclusion.
1031
1049
 
1032
- **Not auto-spread by `create_frontend_rpc_client` or `register_ws_endpoint`** —
1050
+ **Not auto-spread by `create_frontend_rpc_client` or `register_action_ws`** —
1033
1051
  bundled helpers stay pure factories so the dispatch surface stays
1034
1052
  grep-traceable at every registration site and consumers can override
1035
1053
  individual protocol actions without an opt-out flag.
@@ -1037,8 +1055,8 @@ individual protocol actions without an opt-out flag.
1037
1055
  ### Individual actions
1038
1056
 
1039
1057
  - **`heartbeat_action`** — `request_response`, `initiator: 'frontend'`, `auth: 'authenticated'`, `side_effects: false`, parameterless `z.void()` input (absent / `null` / `{}` params — the Rust `require_void_params` shapes), empty-object output. Handler is a stateless no-op echo. Client's activity-aware heartbeat timer fires this whenever idle past `DEFAULT_HEARTBEAT_INTERVAL`; server's `register_action_ws` heartbeat tracker counts the incoming message as activity.
1040
- - **`cancel_action`** — `remote_notification`, `initiator: 'frontend'`, `auth: null`, `side_effects: true`. Params: `CancelNotificationParams = z.strictObject({request_id: JsonrpcRequestId})`. **Handler is an empty stub** — cancel semantics are dispatcher-owned (`register_action_ws` has the `{request_id → AbortController}` map). Wire format is snake_case `cancel` + `{request_id}`, not MCP's `$/cancelRequest` + `{requestId}` — MCP adoption would happen at an MCP adapter's translation layer, not in the base transport.
1041
- - **`peer_ping_action`** — `request_response`, `initiator: 'both'`, `auth: public`, `side_effects: false`. Input `PingActionInput = {nonce?, timeout_ms?}` (`.default({})`); output `PingResponse = {nonce, protocol_version}`. The client→server invocation drives the **server→client** direction: the handler calls `ctx.request_client('peer/ping', {nonce})`, awaits the echo, validates it against `PingResponse` + checks the nonce, and returns it. Over HTTP RPC (`ctx.request_client` absent) it refuses with `peer_no_transport`, so it's mounted on both the WS endpoint (via this bundle) and the HTTP RPC endpoint (the spine full mount). `timeout_ms` is clamped shorten-only. `data.reason` codes (`peer_timeout` / `peer_connection_gone` / `peer_no_transport` / `peer_too_many_in_flight` / `peer_ping_invalid_reply` / `peer_ping_nonce_mismatch`) + the `PingResponse` shape (whose `protocol_version` is `PEER_PROTOCOL_VERSION`) are the cross-impl wire contract (twins of the Rust `REASON_PEER_*`). The frontend half — `peer_ping_responder` (the echo a client sends back, wired into `FrontendWebsocketTransport`) — lives here too. `peer_ping_action` is a plain `RpcAction` literal (not `rpc_action(...)`), so the module stays free of the runtime `action_rpc.ts` import and `protocol_action_specs` doesn't drag the dispatch core into frontend bundles — same discipline as `heartbeat`/`cancel`. See `actions/peer_ping.ts`.
1058
+ - **`cancel_action`** — `remote_notification`, `initiator: 'frontend'`, `auth: null`, `side_effects: true`. Params: `CancelNotificationParams = z.strictObject({request_id: JsonrpcRequestId})`. **No handler** (`cancel_action = {spec}`) — cancel semantics are dispatcher-owned (`register_action_ws` has the `{request_id → AbortController}` map). Wire format is snake_case `cancel` + `{request_id}`, not MCP's `$/cancelRequest` + `{requestId}` — MCP adoption would happen at an MCP adapter's translation layer, not in the base transport.
1059
+ - **`peer_ping_action`** — `request_response`, `initiator: 'both'`, `auth: public`, `side_effects: false`. Input `PingActionInput = {nonce?, timeout_ms?}` (`.default({})`); output `PingResponse = {nonce, protocol_version}`. The client→server invocation drives the **server→client** direction: the handler calls `ctx.request_client('peer/ping', {nonce})`, awaits the echo, validates it against `PingResponse` + checks the nonce, and returns it. Over HTTP RPC (`ctx.request_client` absent) it refuses with `peer_no_transport`, so it's mounted on both the WS endpoint (via this bundle) and the HTTP RPC endpoint (the spine full mount). `timeout_ms` is clamped shorten-only. `data.reason` codes (`peer_timeout` / `peer_connection_gone` / `peer_no_transport` / `peer_too_many_in_flight` / `peer_ping_invalid_reply` / `peer_ping_nonce_mismatch`) + the `PingResponse` shape (whose `protocol_version` is `PEER_PROTOCOL_VERSION`) are the cross-impl wire contract (twins of the Rust `REASON_PEER_*`). The frontend half — `peer_ping_responder` (the echo a client sends back, wired into `FrontendWebsocketTransport`) — lives here too. `peer_ping_action` imports nothing from the dispatch core, so `protocol_action_specs` doesn't drag it into frontend bundles — same discipline as `heartbeat`/`cancel`. See `actions/peer_ping.ts`.
1042
1060
 
1043
1061
  ## Event state machine
1044
1062
 
@@ -1050,7 +1068,7 @@ high-level shapes that span modules:
1050
1068
 
1051
1069
  - **39-variant discriminated union** — `ActionEventDataUnion<TMethod, TInput, TOutput>` across `kind` + `phase` + `step` (28 for `request_response`, 6 for `remote_notification`, 5 for `local_call`). Narrows `input` / `output` / `error` / `request` / `response` / `notification` / `progress` at each lifecycle point.
1052
1070
  - **Step transitions** — `initial → parsed | failed`, `parsed → handling | failed`, `handling → handled | failed`, `handled`/`failed` terminal. `validate_step_transition(from, to)` throws on illegal moves.
1053
- - **Phase transitions** — chained: `send_request → receive_response`, `receive_request → send_response`; everything else terminal. `validate_phase_for_kind` + `validate_phase_transition` enforce.
1071
+ - **Phase transitions** — chained: `send_request → receive_response`, `receive_request → send_response`; everything else terminal. `validate_phase_transition` enforces.
1054
1072
  - **`ActionEvent.parse()`** — `initial → parsed` via `spec.input.safeParse`. Input validation failures **fail immediately** without routing through an error phase (client-side programming errors, not runtime conditions with handlers); their `invalid_params` `data` is `{validation_errors, reason?}`, `reason` the declared `invalid_reason` the server would answer. Handler errors DO route through `send_error` / `receive_error`. On `receive_response` with error response, transitions to `receive_error` instead of failing; a success response's `result` is validated against `spec.output` (always, not DEV-only — it's inbound data; undeclared keys are dropped rather than refused, so an older client survives an added response field) and `output` becomes the parsed value, or the event moves to `receive_error` with an `internal_error` carrying `data: {reason: ERROR_RESPONSE_OUTPUT_INVALID, validation_errors}` — a remote contract break, deliberately distinct from the `invalid_params` / `validation_error` of bad caller input.
1055
1073
  - **Handler throws** — `ThrownJsonrpcError` keeps code/message/data; any other throw becomes `internal_error` carrying the thrown message. When the error answers a remote caller (`receive_request` / `send_response`), the raw message goes through `dev_only` like the server dispatch core.
1056
1074
  - **Protocol message creation is automatic** — transitioning `parsed → handling` on `send_request` materializes the outgoing `JsonrpcRequest` with a fresh `create_uuid()` id; on `send` (notification) it materializes the `JsonrpcNotification`.
@@ -1073,7 +1091,7 @@ all-optional object input accepts a call that omits them).
1073
1091
  "ActionPeer" — unbackticked throughout the peer/ping + `request_client` docs — is
1074
1092
  the _capability_ it participates in: the bidirectional peer request/response
1075
1093
  feature. It's a concept, not a symbol. The server→client half of that capability
1076
- is `BackendWebsocketTransport.request_connection` + `PendingPeerRequests` (see
1094
+ is `ConnectionRegistry.request_connection` + `PendingPeerRequests` (see
1077
1095
  `actions/peer_request.ts`), not this class.
1078
1096
 
1079
1097
  ## Reactive frontend client
@@ -1174,7 +1192,7 @@ doesn't get probed as a thenable by `await`.
1174
1192
 
1175
1193
  ### Frontend factory (`actions/frontend_rpc_client.ts`)
1176
1194
 
1177
- `create_frontend_rpc_client<TApi>({specs, path?, transports?, transport_for_method?, on_action_event?, lookup_action_handler?, log?})`
1195
+ `create_frontend_rpc_client<TApi>({specs, path?, http_headers?, max_get_url_length?, ws?, transports?, transport_for_method?, on_action_event?, lookup_action_handler?, log?})`
1178
1196
  bundles `ActionRegistry + ActionEventEnvironment + Transports + ActionDispatcher +
1179
1197
  create_rpc_client + create_throwing_api` boilerplate every consumer
1180
1198
  repeats — plus the `lookup_action_handler: () => undefined` stub (frontend
@@ -1186,12 +1204,21 @@ Returns both Proxy shapes from one factory call:
1186
1204
  - `api: ThrowingApi<TApi>` — typed throwing Proxy. Default for hot-path call sites.
1187
1205
  - `api_result: TApi` — typed Result-shaped Proxy. For sites that inspect `error.data.reason` without try/catch.
1188
1206
  - `peer`, `environment` — exposed for advanced consumers.
1189
-
1190
- Default transport is `FrontendHttpTransport(path ?? '/api/rpc')`. Pass
1191
- `transports` for WS-first or mixed setups (the default HTTP transport is
1192
- **not** registered when `transports` is supplied). `local_call` specs in
1193
- `specs` silently no-op because `lookup_action_handler` always returns
1194
- `undefined`.
1207
+ - `socket` — the `ws.client`, or `null`.
1208
+
1209
+ Transports: a `FrontendHttpTransport` on `path ?? '/api/rpc'` over the
1210
+ registry's `lookup_action_spec` (a hand-built transport passes its own
1211
+ environment's), so a read goes as a GET; and, with `ws: {client, queue?, max_message_bytes?}`, a
1212
+ `FrontendWebsocketTransport` over the caller's client, registered after it,
1213
+ which every `request_response` method routes to unless `transport_for_method`
1214
+ says otherwise (HTTP stays the fallback while the socket is down). The caller
1215
+ builds and connects the client — `new
1216
+ FrontendWebsocketClient(to_same_origin_ws_url('/api/ws'))` — so the factory
1217
+ never imports `socket.svelte.ts` and an HTTP-only bundle stays socket-free.
1218
+ `ws.queue` sets the peer's default `queue` (Queue routing above). Pass
1219
+ `transports` to replace the built-ins (exclusive with `ws`, `http_headers`,
1220
+ `max_get_url_length`). `local_call` specs in `specs` silently no-op because
1221
+ `lookup_action_handler` always returns `undefined`.
1195
1222
 
1196
1223
  `all_standard_action_specs` (in `auth/standard_action_specs.ts`) is
1197
1224
  transport-agnostic — when a consumer spreads `create_standard_rpc_actions`
@@ -1202,24 +1229,23 @@ route per-call (e.g. return `'frontend_websocket_rpc'` for `account_*` /
1202
1229
 
1203
1230
  ## Broadcast API (`actions/broadcast_api.ts`)
1204
1231
 
1205
- `create_broadcast_api({peer, specs, log?, should_deliver?})` — builds a
1232
+ `create_broadcast_api({registry, specs, log?, should_deliver?})` — builds a
1206
1233
  typed `{method: (input) => Promise<void>}` object from a list of action
1207
1234
  specs. Counterpart to `register_action_ws`: that handles frontend-initiated
1208
1235
  request-scoped dispatch, this handles backend-initiated broadcast.
1209
1236
  Request-scoped streaming stays on `ctx.notify` inside a handler.
1210
1237
 
1211
1238
  Per-method call: validates input against `spec.input` (logs + returns on
1212
- failure), wraps in `JsonrpcNotification`, sends via the peer's resolved
1213
- transport. `transport_name` on `peer.default_send_options` pins the target
1214
- deterministically — no fallback, because broadcast is 1→N over a specific
1215
- primary transport and "any ready transport" could reach an unexpected
1216
- audience. Silently skips when none ready.
1239
+ failure), wraps in `JsonrpcNotification`, and sends it on `registry` — a
1240
+ `BroadcastTarget`, `Pick<ConnectionRegistry, 'broadcast' |
1241
+ 'broadcast_filtered'>`, typically `app_server.ws_endpoints[path]` or the
1242
+ registry a `WsEndpointSpec` supplies. No `Transports` collection and no fallback:
1243
+ broadcast is 1→N over one named registry. No connections reaches nobody.
1217
1244
 
1218
1245
  `should_deliver: (identity, method, input) => boolean` — optional
1219
1246
  per-connection ACL predicate. When set, fans out via
1220
- `transport.broadcast_filtered` (feature-detected via
1221
- `is_filterable_broadcast_transport`). Errors logged but never thrown —
1222
- broadcasts are fire-and-forget.
1247
+ `registry.broadcast_filtered`; otherwise `registry.broadcast`. Errors logged
1248
+ but never thrown — broadcasts are fire-and-forget.
1223
1249
 
1224
1250
  Typed surface: consumers declare an explicit `interface BackendActionsApi`
1225
1251
  and pin via `create_broadcast_api<BackendActionsApi>({...})` — unchecked
@@ -1232,5 +1258,6 @@ Sits above `action_spec.ts` (pure Zod) and below the dispatchers. Extracted
1232
1258
  so composable primitives (e.g. `heartbeat_action`) can name the types
1233
1259
  without pulling in server-only modules.
1234
1260
 
1235
- - `Action<TSpec>` — `{spec: TSpec, handler?: ActionHandler}`. Polymorphic on `kind`: `request_response` specs require a handler for dispatch; `remote_notification` specs may declare a stub for symmetry but are dispatcher-handled (e.g. `cancel`); `local_call` specs never reach a network dispatcher.
1236
- - `RpcAction = Action<RequestResponseActionSpec> & {handler: ActionHandler}` — narrowing the HTTP RPC dispatcher accepts (`create_rpc_endpoint`) and the `rpc_action` binder produces.
1261
+ - `Action<TSpec>` — `{spec: TSpec, handler?: ActionHandler}`. Polymorphic on `kind`: `request_response` specs require a handler for dispatch; `remote_notification` specs are dispatcher-handled (e.g. `cancel`, which has no handler); `local_call` specs never reach a network dispatcher.
1262
+ - `ActionContext` + its narrowed tiers (`ActionAuthContext`, `ActionActorContext`), the handler signatures (`ActionHandler`, `AuthActionHandler`, `ActorActionHandler`), `HandlerForSpec`, and the `rpc_action` binder — the handler-side surface every action factory names. `actions/action_rpc.ts` keeps only `create_rpc_endpoint` + its options.
1263
+ - `RpcAction` — `{spec: RequestResponseActionSpec, handler: ActionHandler}`, what the dispatchers accept (`create_rpc_endpoint`, `register_action_ws`) and the `rpc_action` binder produces.