@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
@@ -12,8 +12,7 @@
12
12
  * - `credential_types` — restricts the credential channel (e.g. daemon_token);
13
13
  * absent = any authenticated credential.
14
14
  * - `required_scope` — the capability an api token's scope must admit to reach
15
- * this route (`rpc:<method>` or `surface:<name>`); route specs only,
16
- * absent = no scope gate.
15
+ * this route (`surface:<name>`); route specs only, absent = no scope gate.
17
16
  *
18
17
  * The same shape governs both `ActionSpec.auth` (in `actions/action_spec.ts`)
19
18
  * and `RouteSpec.auth` (in `http/route_spec.ts`). The canonical schema
@@ -155,12 +154,6 @@ export declare const is_public_auth: (auth: RouteAuth) => boolean;
155
154
  * `acting?: ActingActor`.
156
155
  */
157
156
  export declare const needs_actor: (auth: RouteAuth) => boolean;
158
- /**
159
- * True iff the route declares an account axis (`'optional'` or
160
- * `'required'`). Per registry-time invariant 3 this is implied by
161
- * `needs_actor(auth)` in v1 (no accountless actors yet).
162
- */
163
- export declare const needs_account: (auth: RouteAuth) => boolean;
164
157
  /** True iff the route declares any role gate (`auth.roles?.length`). */
165
158
  export declare const is_role_auth: (auth: RouteAuth) => boolean;
166
159
  /** True iff the route declares any credential-type gate (`auth.credential_types?.length`). */
@@ -1 +1 @@
1
- {"version":3,"file":"auth_shape.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/auth_shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,6DAGtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,SAGtD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa;;;;EAA2C,CAAC;AACtE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;kBA8EnB,CAAC;AACJ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAUlD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,KAAG,OACA,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,SAAS,KAAG,OAAgC,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,SAAS,KAAG,OAAkC,CAAC;AAEnF,wEAAwE;AACxE,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,KAAG,OAA+B,CAAC;A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;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;kBA+EnB,CAAC;AACJ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAUlD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,KAAG,OACA,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,SAAS,KAAG,OAAgC,CAAC;AAE/E,wEAAwE;AACxE,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,KAAG,OAA+B,CAAC;AAE/E,8FAA8F;AAC9F,eAAO,MAAM,wBAAwB,GAAI,MAAM,SAAS,KAAG,OAC3B,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,KAAG,OACQ,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,SAAS,KAAG,OACwB,CAAC;AAYvF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,OAIhE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sCAAsC,GAClD,MAAM,SAAS,EACf,OAAO,WAAW,EAClB,SAAS,MAAM,KACb,IAmBF,CAAC"}
@@ -12,8 +12,7 @@
12
12
  * - `credential_types` — restricts the credential channel (e.g. daemon_token);
13
13
  * absent = any authenticated credential.
14
14
  * - `required_scope` — the capability an api token's scope must admit to reach
15
- * this route (`rpc:<method>` or `surface:<name>`); route specs only,
16
- * absent = no scope gate.
15
+ * this route (`surface:<name>`); route specs only, absent = no scope gate.
17
16
  *
18
17
  * The same shape governs both `ActionSpec.auth` (in `actions/action_spec.ts`)
19
18
  * and `RouteSpec.auth` (in `http/route_spec.ts`). The canonical schema
@@ -141,9 +140,9 @@ export const RouteAuth = z
141
140
  * token is RPC-only). `surface:audit_stream`, `surface:fact_bare`,
142
141
  * `surface:account_verify`, and `surface:app_surface` are the spine's
143
142
  * route-spec ones; a consumer names its own without registering it.
144
- * - `rpc:<method>` — one action method, refused unless the token lists it.
145
- * What a route bridged from an `ActionSpec` declares: it carries the
146
- * method's identity but never reaches the dispatcher's per-method gate.
143
+ *
144
+ * The `rpc:<method>` arm of that vocabulary is the dispatcher's per-method
145
+ * gate, which a route never reaches, so a route may not declare it.
147
146
  *
148
147
  * Declaring it makes the guard resolver mount the refusal ahead of the role
149
148
  * gate, instead of the route hand-rolling the check in its handler (which
@@ -161,7 +160,8 @@ export const RouteAuth = z
161
160
  * route specs too.
162
161
  *
163
162
  * Typed as a plain string here to keep `http/` from importing `auth/`; the
164
- * resolver parses it at registration and throws on a malformed one.
163
+ * resolver checks it at registration and throws on anything but a
164
+ * well-formed `surface:<name>`.
165
165
  */
166
166
  required_scope: z.string().optional()
167
167
  })
@@ -222,12 +222,6 @@ export const is_public_auth = (auth) => auth.account === 'none' && auth.actor ==
222
222
  * `acting?: ActingActor`.
223
223
  */
224
224
  export const needs_actor = (auth) => auth.actor !== 'none';
225
- /**
226
- * True iff the route declares an account axis (`'optional'` or
227
- * `'required'`). Per registry-time invariant 3 this is implied by
228
- * `needs_actor(auth)` in v1 (no accountless actors yet).
229
- */
230
- export const needs_account = (auth) => auth.account !== 'none';
231
225
  /** True iff the route declares any role gate (`auth.roles?.length`). */
232
226
  export const is_role_auth = (auth) => !!auth.roles?.length;
233
227
  /** True iff the route declares any credential-type gate (`auth.credential_types?.length`). */
@@ -67,8 +67,10 @@ import type { MiddlewareHandler } from 'hono';
67
67
  /**
68
68
  * Create the body size limit middleware.
69
69
  *
70
- * @param max_size - the largest accepted body, in bytes
70
+ * @param max_size - the largest accepted body, in bytes; a safe integer, `0` or more
71
71
  * @returns middleware answering `413` `{error: 'payload_too_large'}` past the cap and `400` `{error: 'invalid_content_length'}` to a `Content-Length` that is not a run of digits
72
+ * @throws Error when `max_size` is not a safe integer `0` or more — a `NaN` cap
73
+ * compares false against every length and would admit any body
72
74
  */
73
75
  export declare const create_body_limit_middleware: (max_size: number) => MiddlewareHandler;
74
76
  //# sourceMappingURL=body_limit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"body_limit.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/body_limit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAQ9C;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GAAI,UAAU,MAAM,KAAG,iBAwB/D,CAAC"}
1
+ {"version":3,"file":"body_limit.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/body_limit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAQ9C;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GAAI,UAAU,MAAM,KAAG,iBA6B/D,CAAC"}
@@ -70,10 +70,15 @@ const CONTENT_LENGTH_DIGITS = /^[0-9]+$/;
70
70
  /**
71
71
  * Create the body size limit middleware.
72
72
  *
73
- * @param max_size - the largest accepted body, in bytes
73
+ * @param max_size - the largest accepted body, in bytes; a safe integer, `0` or more
74
74
  * @returns middleware answering `413` `{error: 'payload_too_large'}` past the cap and `400` `{error: 'invalid_content_length'}` to a `Content-Length` that is not a run of digits
75
+ * @throws Error when `max_size` is not a safe integer `0` or more — a `NaN` cap
76
+ * compares false against every length and would admit any body
75
77
  */
76
78
  export const create_body_limit_middleware = (max_size) => {
79
+ if (!Number.isSafeInteger(max_size) || max_size < 0) {
80
+ throw new Error(`create_body_limit_middleware: max_size must be a safe integer 0 or more, got ${max_size}`);
81
+ }
77
82
  const streaming_limit = bodyLimit({
78
83
  maxSize: max_size,
79
84
  onError: (c) => c.json({ error: ERROR_PAYLOAD_TOO_LARGE }, 413)
@@ -1 +1 @@
1
- {"version":3,"file":"common_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/common_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAO,SAQ1C,CAAC;AAKH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,GAAG,GAAG,MAAM,KAAG,cAkBxD,CAAC;AAEF,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IACjC;;;;OAIG;IACH,QAAQ,EAAE,cAAc,CAAC;IACzB,gFAAgF;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,iBAAiB,KAAG,SAoCpE,CAAC;AAEF,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IACnC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,aAAa,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,GAAI,SAAS,mBAAmB,KAAG,SAQ7E,CAAC"}
1
+ {"version":3,"file":"common_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/common_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAO,SAQ1C,CAAC;AAKH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,GAAG,GAAG,MAAM,KAAG,cAkBxD,CAAC;AAEF,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IACjC;;;;OAIG;IACH,QAAQ,EAAE,cAAc,CAAC;IACzB,gFAAgF;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,iBAAiB,KAAG,SAoCpE,CAAC;AAEF,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IACnC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,aAAa,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,GAAI,SAAS,mBAAmB,KAAG,SAQ7E,CAAC"}
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { readFileSync } from 'node:fs';
10
10
  import { z } from 'zod';
11
+ import { HEALTH_PATH, HealthResponse } from './health_schema.js';
11
12
  import { check_schema_drift, format_schema_drift, READY_ERROR } from '../db/schema_ready.js';
12
13
  /**
13
14
  * Create a public health check route spec.
@@ -17,12 +18,12 @@ import { check_schema_drift, format_schema_drift, READY_ERROR } from '../db/sche
17
18
  */
18
19
  export const create_health_route_spec = () => ({
19
20
  method: 'GET',
20
- path: '/health',
21
+ path: HEALTH_PATH,
21
22
  auth: { account: 'none', actor: 'none' },
22
23
  handler: (c) => c.json({ status: 'ok' }),
23
24
  description: 'Health check',
24
25
  input: z.null(),
25
- output: z.strictObject({ status: z.literal('ok') })
26
+ output: HealthResponse
26
27
  });
27
28
  /** Module-level cache of loaded expected-schema fixtures, keyed by URL. */
28
29
  const expected_schema_cache = new Map();
@@ -75,9 +75,9 @@ export declare const NON_BROWSABLE_TABLES: ReadonlyArray<string>;
75
75
  * row whose meaning lives in the domain layer:
76
76
  *
77
77
  * - `audit_log` — the trail and the tamper path would otherwise be the same
78
- * surface. It is also part of how revocation propagates: `realtime/sse_auth_guard.ts`
79
- * and the WS auth guard close live connections by listening to audit events, so a
80
- * raw row delete here is invisible to them.
78
+ * surface. It is also part of how revocation propagates: the revocation guard
79
+ * (`create_revocation_guard`) closes live connections by listening to audit
80
+ * events, so a raw row delete here is invisible to it.
81
81
  * `bootstrap_lock` — deleting the singleton leaves `check_bootstrap_status`
82
82
  * advertising an open bootstrap window on the next boot that
83
83
  * `bootstrap_account.ts`'s atomic flip then always refuses.
@@ -57,9 +57,9 @@ export const NON_BROWSABLE_TABLES = Object.freeze([
57
57
  * row whose meaning lives in the domain layer:
58
58
  *
59
59
  * - `audit_log` — the trail and the tamper path would otherwise be the same
60
- * surface. It is also part of how revocation propagates: `realtime/sse_auth_guard.ts`
61
- * and the WS auth guard close live connections by listening to audit events, so a
62
- * raw row delete here is invisible to them.
60
+ * surface. It is also part of how revocation propagates: the revocation guard
61
+ * (`create_revocation_guard`) closes live connections by listening to audit
62
+ * events, so a raw row delete here is invisible to it.
63
63
  * `bootstrap_lock` — deleting the singleton leaves `check_bootstrap_status`
64
64
  * advertising an open bootstrap window on the next boot that
65
65
  * `bootstrap_account.ts`'s atomic flip then always refuses.
@@ -223,8 +223,7 @@ export type CredentialTypeRequiredError = z.infer<typeof CredentialTypeRequiredE
223
223
  * `docs/security.md` §Token scoping.
224
224
  *
225
225
  * `required_scope` carries the capability string the route demands, verbatim
226
- * from its `auth.required_scope` — `surface:audit_stream` for a non-RPC
227
- * surface, `rpc:<method>` for a bridged action — matching the Rust
226
+ * from its `auth.required_scope` (`surface:audit_stream`, …) — matching the Rust
228
227
  * `token_scope_surface_denied_response` and the dispatcher's own per-method
229
228
  * denial. Third in the family with `PermissionError` and
230
229
  * `CredentialTypeRequiredError` — each names what the route demanded rather
@@ -1 +1 @@
1
- {"version":3,"file":"error_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/error_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI9D,0CAA0C;AAC1C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,uDAAuD;AACvD,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAEpE,6CAA6C;AAC7C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAI1E,wCAAwC;AACxC,eAAO,MAAM,6BAA6B,EAAG,yBAAkC,CAAC;AAEhF,+CAA+C;AAC/C,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAElF;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAElF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,yCAAyC;AACzC,eAAO,MAAM,yBAAyB,EAAG,qBAA8B,CAAC;AAExE,sFAAsF;AACtF,eAAO,MAAM,yBAAyB,EAAG,qBAA8B,CAAC;AAExE,qDAAqD;AACrD,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,4BAA4B,EAAG,wBAAiC,CAAC;AAI9E,uCAAuC;AACvC,eAAO,MAAM,sBAA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AsB;;iBAEjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,sBAAsB;;iBAEjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAEnE;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;;;EAAoC,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,yBAAyB;IACzC,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,oBAAoB,GAAI,6EAOlC,yBAAyB,KAAG,iBA8C9B,CAAC"}
@@ -233,8 +233,7 @@ export const CredentialTypeRequiredError = z.looseObject({
233
233
  * `docs/security.md` §Token scoping.
234
234
  *
235
235
  * `required_scope` carries the capability string the route demands, verbatim
236
- * from its `auth.required_scope` — `surface:audit_stream` for a non-RPC
237
- * surface, `rpc:<method>` for a bridged action — matching the Rust
236
+ * from its `auth.required_scope` (`surface:audit_stream`, …) — matching the Rust
238
237
  * `token_scope_surface_denied_response` and the dispatcher's own per-method
239
238
  * denial. Third in the family with `PermissionError` and
240
239
  * `CredentialTypeRequiredError` — each names what the route demanded rather
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The liveness route's path and response shape — browser-safe, so the server
3
+ * route spec (`http/common_routes.ts`) and the client probe
4
+ * (`ui/backend_probe.svelte.ts`) share one definition.
5
+ *
6
+ * @module
7
+ */
8
+ import { z } from 'zod';
9
+ /** The public liveness route both spines mount. */
10
+ export declare const HEALTH_PATH = "/health";
11
+ /** The liveness route's response body. */
12
+ export declare const HealthResponse: z.ZodObject<{
13
+ status: z.ZodLiteral<"ok">;
14
+ }, z.core.$strict>;
15
+ export type HealthResponse = z.infer<typeof HealthResponse>;
16
+ //# sourceMappingURL=health_schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/health_schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,mDAAmD;AACnD,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,0CAA0C;AAC1C,eAAO,MAAM,cAAc;;kBAA8C,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The liveness route's path and response shape — browser-safe, so the server
3
+ * route spec (`http/common_routes.ts`) and the client probe
4
+ * (`ui/backend_probe.svelte.ts`) share one definition.
5
+ *
6
+ * @module
7
+ */
8
+ import { z } from 'zod';
9
+ /** The public liveness route both spines mount. */
10
+ export const HEALTH_PATH = '/health';
11
+ /** The liveness route's response body. */
12
+ export const HealthResponse = z.strictObject({ status: z.literal('ok') });
@@ -96,6 +96,15 @@ export type JsonrpcServerErrorCode = z.infer<typeof JsonrpcServerErrorCode>;
96
96
  */
97
97
  export declare const JsonrpcErrorCode: z.ZodUnion<readonly [z.ZodLiteral<-32700>, z.ZodLiteral<-32600>, z.ZodLiteral<-32601>, z.ZodLiteral<-32602>, z.ZodLiteral<-32603>, z.core.$ZodBranded<z.ZodNumber, "JsonrpcServerErrorCode", "out">]>;
98
98
  export type JsonrpcErrorCode = z.infer<typeof JsonrpcErrorCode>;
99
+ /**
100
+ * Whether `value` is a valid JSON-RPC error code — the codes `JsonrpcErrorCode`
101
+ * parses, but integer-only in the server range. A numeric `code` alone doesn't make an error a
102
+ * JSON-RPC one: a `DOMException`'s `code` is a small positive number.
103
+ *
104
+ * @param value - the candidate code
105
+ * @returns whether `value` is one of the standard codes or an integer in the server range
106
+ */
107
+ export declare const is_jsonrpc_error_code: (value: unknown) => value is JsonrpcErrorCode;
99
108
  /** Error object within a JSON-RPC error response. */
100
109
  export declare const JsonrpcErrorObject: z.ZodObject<{
101
110
  code: z.ZodUnion<readonly [z.ZodLiteral<-32700>, z.ZodLiteral<-32600>, z.ZodLiteral<-32601>, z.ZodLiteral<-32602>, z.ZodLiteral<-32603>, z.core.$ZodBranded<z.ZodNumber, "JsonrpcServerErrorCode", "out">]>;
@@ -1 +1 @@
1
- {"version":3,"file":"jsonrpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,oFAAoF;AACpF,eAAO,MAAM,gBAAgB,iDAAoC,CAAC;AAClE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,8BAA8B;AAC9B,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,4FAA4F;AAC5F,eAAO,MAAM,oBAAoB,iDA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gB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,gBASxB,CAAC;AAEzC,qDAAqD;AACrD,eAAO,MAAM,kBAAkB;;;;iBAI7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,mDAAmD;AACnD,eAAO,MAAM,oBAAoB;;;;;;;;iBAI/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,kDAAkD;AAClD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;mBAAmD,CAAC;AACvF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,uFAAuF;AACvF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;mBAKzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,wEAAwE;AACxE,eAAO,MAAM,gCAAgC;;;;;;;;;mBAAiD,CAAC;AAC/F,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAEhG,0FAA0F;AAC1F,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;mBAI3C,CAAC;AACH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
@@ -101,6 +101,23 @@ export const JsonrpcErrorCode = z.union([
101
101
  z.literal(JSONRPC_INTERNAL_ERROR),
102
102
  JsonrpcServerErrorCode
103
103
  ]);
104
+ /**
105
+ * Whether `value` is a valid JSON-RPC error code — the codes `JsonrpcErrorCode`
106
+ * parses, but integer-only in the server range. A numeric `code` alone doesn't make an error a
107
+ * JSON-RPC one: a `DOMException`'s `code` is a small positive number.
108
+ *
109
+ * @param value - the candidate code
110
+ * @returns whether `value` is one of the standard codes or an integer in the server range
111
+ */
112
+ export const is_jsonrpc_error_code = (value) => typeof value === 'number' &&
113
+ (value === JSONRPC_PARSE_ERROR ||
114
+ value === JSONRPC_INVALID_REQUEST ||
115
+ value === JSONRPC_METHOD_NOT_FOUND ||
116
+ value === JSONRPC_INVALID_PARAMS ||
117
+ value === JSONRPC_INTERNAL_ERROR ||
118
+ (Number.isInteger(value) &&
119
+ value >= JSONRPC_SERVER_ERROR_END &&
120
+ value <= JSONRPC_SERVER_ERROR_START));
104
121
  /** Error object within a JSON-RPC error response. */
105
122
  export const JsonrpcErrorObject = z.looseObject({
106
123
  code: JsonrpcErrorCode,
@@ -68,8 +68,8 @@ export declare const dev_only: <T>(value: T) => T | undefined;
68
68
  */
69
69
  export declare const jsonrpc_error_messages: Readonly<Record<JsonrpcErrorName, (...args: Array<any>) => JsonrpcErrorObject>>;
70
70
  /**
71
- * Error class carrying a JSON-RPC error code — thrown by handlers,
72
- * caught by `apply_route_specs` and mapped to HTTP status + JSON-RPC error response.
71
+ * Error class carrying a JSON-RPC error code — thrown by handlers, read by
72
+ * `to_thrown_jsonrpc_error`, and mapped to HTTP status + JSON-RPC error response.
73
73
  *
74
74
  * Named for what it is: an error with a JSON-RPC error code that gets thrown.
75
75
  */
@@ -78,6 +78,26 @@ export declare class ThrownJsonrpcError extends Error {
78
78
  data?: unknown;
79
79
  constructor(code: JsonrpcErrorCode, message: string, data?: unknown, options?: ErrorOptions);
80
80
  }
81
+ /**
82
+ * The JSON-RPC error a thrown value carries: a `ThrownJsonrpcError` from any
83
+ * copy of fuz_app, recognized by its realm-global brand rather than
84
+ * `instanceof` (two resolved copies of fuz_app in one process have two
85
+ * classes), whose `code` is a JSON-RPC error code. Anything else is no
86
+ * JSON-RPC error — a foreign error class carrying a JSON-RPC-shaped `code`
87
+ * (another library's RPC error), or a `ThrownJsonrpcError` whose `code` was
88
+ * cast outside the JSON-RPC set — so each caller masks it.
89
+ *
90
+ * The one thrown → wire conversion: the REST catch layer
91
+ * (`apply_route_specs`), the RPC dispatch core (`perform_action`),
92
+ * `create_jsonrpc_error_response_from_thrown`, the frontend HTTP and
93
+ * WebSocket transports, and `ActionEvent`'s handler-throw normalization all
94
+ * read a thrown error through it, each keeping its own masking of everything
95
+ * else.
96
+ *
97
+ * @param err - the thrown value
98
+ * @returns the error object (`data` present only when the error carries one), or `null` when `err` is no JSON-RPC error
99
+ */
100
+ export declare const to_thrown_jsonrpc_error: (err: unknown) => JsonrpcErrorObject | null;
81
101
  /**
82
102
  * Named constructors for `ThrownJsonrpcError`.
83
103
  *
@@ -1 +1 @@
1
- {"version":3,"file":"jsonrpc_errors.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/jsonrpc_errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAQN,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,MAAM,cAAc,CAAC;AAEtB,0CAA0C;AAC1C,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AAErD,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GACzB,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,WAAW,GACX,WAAW,GACX,UAAU,GACV,kBAAkB,GAClB,cAAc,GACd,qBAAqB,GACrB,SAAS,GACT,gBAAgB,GAChB,mBAAmB,CAAC;AAEvB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,EA4C1B,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,e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@
18
18
  * @module
19
19
  */
20
20
  import { DEV } from 'esm-env';
21
- import { JSONRPC_PARSE_ERROR, JSONRPC_INVALID_REQUEST, JSONRPC_METHOD_NOT_FOUND, JSONRPC_INVALID_PARAMS, JSONRPC_INTERNAL_ERROR, JSONRPC_SERVER_ERROR_START, JSONRPC_SERVER_ERROR_END } from './jsonrpc.js';
21
+ import { JSONRPC_PARSE_ERROR, JSONRPC_INVALID_REQUEST, JSONRPC_METHOD_NOT_FOUND, JSONRPC_INVALID_PARAMS, JSONRPC_INTERNAL_ERROR, JSONRPC_SERVER_ERROR_START, JSONRPC_SERVER_ERROR_END, is_jsonrpc_error_code } from './jsonrpc.js';
22
22
  /** Default message for unknown errors. */
23
23
  export const UNKNOWN_ERROR_MESSAGE = 'unknown error';
24
24
  /**
@@ -185,8 +185,15 @@ export const jsonrpc_error_messages = Object.freeze({
185
185
  })
186
186
  });
187
187
  /**
188
- * Error class carrying a JSON-RPC error code — thrown by handlers,
189
- * caught by `apply_route_specs` and mapped to HTTP status + JSON-RPC error response.
188
+ * Realm-global brand on `ThrownJsonrpcError.prototype`. `Symbol.for` makes
189
+ * every copy of this module that one process resolves mint the same key, so
190
+ * `to_thrown_jsonrpc_error` recognizes a `ThrownJsonrpcError` from any copy
191
+ * of fuz_app, where `instanceof` sees only its own class.
192
+ */
193
+ const THROWN_JSONRPC_ERROR_BRAND = Symbol.for('@fuzdev/fuz_app/ThrownJsonrpcError');
194
+ /**
195
+ * Error class carrying a JSON-RPC error code — thrown by handlers, read by
196
+ * `to_thrown_jsonrpc_error`, and mapped to HTTP status + JSON-RPC error response.
190
197
  *
191
198
  * Named for what it is: an error with a JSON-RPC error code that gets thrown.
192
199
  */
@@ -199,6 +206,37 @@ export class ThrownJsonrpcError extends Error {
199
206
  this.data = data;
200
207
  }
201
208
  }
209
+ Object.defineProperty(ThrownJsonrpcError.prototype, THROWN_JSONRPC_ERROR_BRAND, { value: true });
210
+ /**
211
+ * The JSON-RPC error a thrown value carries: a `ThrownJsonrpcError` from any
212
+ * copy of fuz_app, recognized by its realm-global brand rather than
213
+ * `instanceof` (two resolved copies of fuz_app in one process have two
214
+ * classes), whose `code` is a JSON-RPC error code. Anything else is no
215
+ * JSON-RPC error — a foreign error class carrying a JSON-RPC-shaped `code`
216
+ * (another library's RPC error), or a `ThrownJsonrpcError` whose `code` was
217
+ * cast outside the JSON-RPC set — so each caller masks it.
218
+ *
219
+ * The one thrown → wire conversion: the REST catch layer
220
+ * (`apply_route_specs`), the RPC dispatch core (`perform_action`),
221
+ * `create_jsonrpc_error_response_from_thrown`, the frontend HTTP and
222
+ * WebSocket transports, and `ActionEvent`'s handler-throw normalization all
223
+ * read a thrown error through it, each keeping its own masking of everything
224
+ * else.
225
+ *
226
+ * @param err - the thrown value
227
+ * @returns the error object (`data` present only when the error carries one), or `null` when `err` is no JSON-RPC error
228
+ */
229
+ export const to_thrown_jsonrpc_error = (err) => {
230
+ if (!(err instanceof Error))
231
+ return null;
232
+ const { code, data, [THROWN_JSONRPC_ERROR_BRAND]: brand } = err;
233
+ if (brand !== true || !is_jsonrpc_error_code(code))
234
+ return null;
235
+ const error = { code, message: err.message };
236
+ if (data !== undefined)
237
+ error.data = data;
238
+ return error;
239
+ };
202
240
  const create_error_thrower = (error_fn) => (...args) => {
203
241
  const m = error_fn(...args);
204
242
  return new ThrownJsonrpcError(m.code, m.message, m.data);
@@ -226,6 +264,31 @@ export const jsonrpc_errors = {
226
264
  request_cancelled: create_error_thrower(jsonrpc_error_messages.request_cancelled)
227
265
  };
228
266
  // --- HTTP status mapping ---
267
+ /**
268
+ * The HTTP status each base JSON-RPC error code answers, keyed by name so a
269
+ * builtin added without a status is a type error. Entry order is the reverse
270
+ * map's tie-break (last wins).
271
+ */
272
+ const BASE_JSONRPC_ERROR_CODE_HTTP_STATUSES = {
273
+ parse_error: 400,
274
+ invalid_request: 400,
275
+ method_not_found: 404,
276
+ invalid_params: 400,
277
+ internal_error: 500,
278
+ unauthenticated: 401,
279
+ forbidden: 403,
280
+ not_found: 404,
281
+ conflict: 409,
282
+ validation_error: 422,
283
+ // queue_overflow shares 429 with rate_limited — listed first so the
284
+ // last-wins reverse map resolves 429 to rate_limited (a policy) rather
285
+ // than a full buffer
286
+ queue_overflow: 429,
287
+ rate_limited: 429,
288
+ service_unavailable: 503,
289
+ timeout: 504,
290
+ request_cancelled: 499 // nginx "client closed request"
291
+ };
229
292
  /**
230
293
  * The HTTP status each JSON-RPC error code answers — the base set, plus each
231
294
  * consumer code `register_jsonrpc_error_code` adds.
@@ -233,26 +296,10 @@ export const jsonrpc_errors = {
233
296
  * Module-private so a consumer can't remap a base code or skip the checks
234
297
  * registration makes; read it through `jsonrpc_error_code_to_http_status`.
235
298
  */
236
- const jsonrpc_error_code_http_statuses = new Map([
237
- [JSONRPC_PARSE_ERROR, 400],
238
- [JSONRPC_INVALID_REQUEST, 400],
239
- [JSONRPC_METHOD_NOT_FOUND, 404],
240
- [JSONRPC_INVALID_PARAMS, 400],
241
- [JSONRPC_INTERNAL_ERROR, 500],
242
- [JSONRPC_ERROR_CODES.unauthenticated, 401],
243
- [JSONRPC_ERROR_CODES.forbidden, 403],
244
- [JSONRPC_ERROR_CODES.not_found, 404],
245
- [JSONRPC_ERROR_CODES.conflict, 409],
246
- [JSONRPC_ERROR_CODES.validation_error, 422],
247
- // queue_overflow shares 429 with rate_limited — listed first so the
248
- // last-wins reverse map resolves 429 to rate_limited (a policy) rather
249
- // than a full buffer
250
- [JSONRPC_ERROR_CODES.queue_overflow, 429],
251
- [JSONRPC_ERROR_CODES.rate_limited, 429],
252
- [JSONRPC_ERROR_CODES.service_unavailable, 503],
253
- [JSONRPC_ERROR_CODES.timeout, 504],
254
- [JSONRPC_ERROR_CODES.request_cancelled, 499] // nginx "client closed request"
255
- ]);
299
+ const jsonrpc_error_code_http_statuses = new Map(Object.entries(BASE_JSONRPC_ERROR_CODE_HTTP_STATUSES).map(([name, status]) => [
300
+ JSONRPC_ERROR_CODES[name],
301
+ status
302
+ ]));
256
303
  /** Every code `JSONRPC_ERROR_CODES` defines — the numbers a consumer code may not reuse. */
257
304
  const BASE_JSONRPC_ERROR_CODE_SET = new Set(Object.values(JSONRPC_ERROR_CODES));
258
305
  /**
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @module
9
9
  */
10
- import { type JsonrpcErrorResponse, type JsonrpcMethod, type JsonrpcNotification, type JsonrpcNotificationParams, type JsonrpcRequest, type JsonrpcRequestId, type JsonrpcRequestParams, type JsonrpcResponse, type JsonrpcResult, type JsonrpcMessage, JSONRPC_VERSION } from './jsonrpc.js';
10
+ import { JsonrpcRequest, type JsonrpcErrorObject, type JsonrpcErrorResponse, type JsonrpcMethod, type JsonrpcNotification, type JsonrpcNotificationParams, type JsonrpcRequestId, type JsonrpcRequestParams, type JsonrpcResponse, type JsonrpcResult, JSONRPC_VERSION } from './jsonrpc.js';
11
11
  /** Creates a JSON-RPC request message. */
12
12
  export declare const create_jsonrpc_request: (method: JsonrpcMethod, params: JsonrpcRequestParams | undefined, id: JsonrpcRequestId) => JsonrpcRequest;
13
13
  /** Creates a JSON-RPC success response message. */
@@ -18,8 +18,11 @@ export declare const create_jsonrpc_notification: (method: JsonrpcMethod, params
18
18
  export declare const create_jsonrpc_error_response: (id: JsonrpcErrorResponse["id"], error: JsonrpcErrorResponse["error"]) => JsonrpcErrorResponse;
19
19
  /**
20
20
  * Creates a JSON-RPC error response from any error.
21
- * Handles `ThrownJsonrpcError` (preserves code/message/data) and
22
- * regular `Error` objects (maps to internal_error, includes stack in DEV).
21
+ * Handles a thrown JSON-RPC error — a `ThrownJsonrpcError` from any copy of
22
+ * fuz_app, recognized by its brand (`to_thrown_jsonrpc_error`) — by
23
+ * preserving its code/message/data, and maps any other `Error`, a foreign
24
+ * class carrying a JSON-RPC `code` included, to internal_error, with its
25
+ * message and stack in DEV.
23
26
  */
24
27
  export declare const create_jsonrpc_error_response_from_thrown: (id: JsonrpcRequestId | null, error: unknown) => JsonrpcErrorResponse;
25
28
  /** Checks if a value is a valid JSON-RPC request id (string or finite number). */
@@ -28,8 +31,6 @@ export declare const is_jsonrpc_request_id: (id: unknown) => id is JsonrpcReques
28
31
  export declare const is_jsonrpc_object: (message: unknown) => message is {
29
32
  jsonrpc: typeof JSONRPC_VERSION;
30
33
  };
31
- /** Checks if a value is any valid JSON-RPC message or batch array. */
32
- export declare const is_jsonrpc_message: (message: unknown) => message is JsonrpcMessage | Array<JsonrpcMessage>;
33
34
  /** Checks if a value is a JSON-RPC request (has method + id). */
34
35
  export declare const is_jsonrpc_request: (message: unknown) => message is JsonrpcRequest;
35
36
  /** Checks if a value is a JSON-RPC notification (has method, no id). */
@@ -44,21 +45,63 @@ export declare const is_jsonrpc_error_response: (message: unknown) => message is
44
45
  */
45
46
  export declare const to_jsonrpc_message_id: (message_or_id: unknown) => JsonrpcRequestId | null;
46
47
  /**
47
- * The id an error response to a rejected envelope can echo: the frame's
48
- * `id` when the frame is an object carrying a valid one, else `null`.
48
+ * Normalizes input to JSON-RPC params format.
49
+ * Returns `undefined` for null/undefined, wraps primitives in `{value}`.
50
+ */
51
+ export declare const to_jsonrpc_params: (input: unknown) => Record<string, any> | undefined;
52
+ /**
53
+ * A parsed JSON value classified as a JSON-RPC message by
54
+ * `classify_jsonrpc_message` — transport-agnostic, each transport applying
55
+ * its own semantics to the arms:
49
56
  *
50
- * Unlike `to_jsonrpc_message_id`, a scalar frame (`5`, `"x"`) is never read
51
- * as its own id — a non-object body has no id to echo, which is the Rust
52
- * twin's `classify` answer too. Both transports use this for the
53
- * `invalid_request` reply.
57
+ * - `request` — a valid request envelope, ready for dispatch.
58
+ * - `notification` — a string `method` and no `id` key. `params` is handed
59
+ * back unvalidated (a notification has no id to answer an error on).
60
+ * The WebSocket path routes `cancel` and drops every other one; HTTP
61
+ * answers `invalid_request` with `id: null`.
62
+ * - `response` — no string `method`, a string or number `id`, and exactly
63
+ * one of `result` / `error`: a reply to a server-initiated request. The
64
+ * WebSocket path routes it to the pending peer request; HTTP issues no
65
+ * server-initiated requests, so it answers `invalid_request` with `id: null`.
66
+ * - `invalid` — the error to answer and the id to answer it on.
54
67
  *
55
- * @param frame - the parsed body, of any shape
56
- * @returns the echoable id, or `null`
68
+ * Twin of the Rust spine's `fuz_http::Classified`.
57
69
  */
58
- export declare const to_jsonrpc_envelope_id: (frame: unknown) => JsonrpcRequestId | null;
70
+ export type ClassifiedJsonrpcMessage = {
71
+ kind: 'request';
72
+ request: JsonrpcRequest;
73
+ } | {
74
+ kind: 'notification';
75
+ method: JsonrpcMethod;
76
+ params: unknown;
77
+ } | {
78
+ kind: 'response';
79
+ response: JsonrpcResponse | JsonrpcErrorResponse;
80
+ } | {
81
+ kind: 'invalid';
82
+ id: JsonrpcRequestId | null;
83
+ error: JsonrpcErrorObject;
84
+ };
59
85
  /**
60
- * Normalizes input to JSON-RPC params format.
61
- * Returns `undefined` for null/undefined, wraps primitives in `{value}`.
86
+ * Classify a parsed JSON value as a JSON-RPC message, in the Rust twin's
87
+ * order: version, then the `method` axis (none, or a non-string one: a
88
+ * response or invalid), then `id` (none: a notification), then the request
89
+ * envelope (`JsonrpcRequest` — string or number `id`, `params` absent or an
90
+ * object).
91
+ *
92
+ * The `method` axis is string-typed like the twin, whose
93
+ * `obj.get("method").and_then(Value::as_str)` reads a present non-string
94
+ * `method` as absent — so `{id, method: 123, result}` is a response on both
95
+ * sides. The `result` / `error` exclusive-or refuses a frame carrying both.
96
+ *
97
+ * Every `invalid` is `invalid_request`. Its `id` is the frame's own when the
98
+ * frame is an object carrying a string or number one, else `null` — a
99
+ * non-object frame (an array included) has none. A refused request envelope
100
+ * carries the schema's issues in DEV, as `data.issues`; nothing else carries
101
+ * data.
102
+ *
103
+ * @param json - the parsed frame or body, of any shape
104
+ * @returns the classification
62
105
  */
63
- export declare const to_jsonrpc_params: (input: unknown) => Record<string, any> | undefined;
106
+ export declare const classify_jsonrpc_message: (json: unknown) => ClassifiedJsonrpcMessage;
64
107
  //# sourceMappingURL=jsonrpc_helpers.d.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