@fuzdev/fuz_app 0.50.0 → 0.52.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 (374) hide show
  1. package/dist/actions/CLAUDE.md +16 -3
  2. package/dist/actions/action_bridge.d.ts +3 -1
  3. package/dist/actions/action_bridge.d.ts.map +1 -1
  4. package/dist/actions/action_bridge.js +3 -1
  5. package/dist/actions/action_codegen.d.ts +44 -13
  6. package/dist/actions/action_codegen.d.ts.map +1 -1
  7. package/dist/actions/action_codegen.js +58 -20
  8. package/dist/actions/action_event.d.ts +44 -1
  9. package/dist/actions/action_event.d.ts.map +1 -1
  10. package/dist/actions/action_event.js +44 -1
  11. package/dist/actions/action_event_helpers.d.ts +26 -0
  12. package/dist/actions/action_event_helpers.d.ts.map +1 -1
  13. package/dist/actions/action_event_helpers.js +26 -1
  14. package/dist/actions/action_peer.d.ts +17 -0
  15. package/dist/actions/action_peer.d.ts.map +1 -1
  16. package/dist/actions/action_peer.js +8 -0
  17. package/dist/actions/action_registry.d.ts +2 -2
  18. package/dist/actions/action_registry.js +2 -2
  19. package/dist/actions/action_rpc.d.ts +4 -0
  20. package/dist/actions/action_rpc.d.ts.map +1 -1
  21. package/dist/actions/action_rpc.js +4 -0
  22. package/dist/actions/action_spec.d.ts +23 -3
  23. package/dist/actions/action_spec.d.ts.map +1 -1
  24. package/dist/actions/action_spec.js +17 -3
  25. package/dist/actions/action_types.d.ts +2 -2
  26. package/dist/actions/action_types.js +2 -2
  27. package/dist/actions/cancel.d.ts +2 -2
  28. package/dist/actions/cancel.js +2 -2
  29. package/dist/actions/heartbeat.d.ts +2 -2
  30. package/dist/actions/heartbeat.js +2 -2
  31. package/dist/actions/protocol.d.ts +1 -1
  32. package/dist/actions/protocol.js +1 -1
  33. package/dist/actions/register_action_ws.d.ts +4 -1
  34. package/dist/actions/register_action_ws.d.ts.map +1 -1
  35. package/dist/actions/register_action_ws.js +4 -1
  36. package/dist/actions/register_ws_endpoint.d.ts +3 -0
  37. package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
  38. package/dist/actions/register_ws_endpoint.js +3 -0
  39. package/dist/actions/request_tracker.svelte.d.ts +14 -1
  40. package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
  41. package/dist/actions/request_tracker.svelte.js +14 -1
  42. package/dist/actions/socket.svelte.d.ts +35 -15
  43. package/dist/actions/socket.svelte.d.ts.map +1 -1
  44. package/dist/actions/socket.svelte.js +33 -13
  45. package/dist/actions/transports.d.ts +12 -3
  46. package/dist/actions/transports.d.ts.map +1 -1
  47. package/dist/actions/transports.js +16 -7
  48. package/dist/actions/transports_http.d.ts +7 -0
  49. package/dist/actions/transports_http.d.ts.map +1 -1
  50. package/dist/actions/transports_http.js +7 -0
  51. package/dist/actions/transports_ws.d.ts +13 -0
  52. package/dist/actions/transports_ws.d.ts.map +1 -1
  53. package/dist/actions/transports_ws.js +13 -0
  54. package/dist/actions/transports_ws_auth_guard.d.ts +6 -2
  55. package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
  56. package/dist/actions/transports_ws_auth_guard.js +6 -2
  57. package/dist/actions/transports_ws_backend.d.ts +14 -1
  58. package/dist/actions/transports_ws_backend.d.ts.map +1 -1
  59. package/dist/actions/transports_ws_backend.js +14 -1
  60. package/dist/auth/CLAUDE.md +40 -4
  61. package/dist/auth/account_queries.d.ts +10 -0
  62. package/dist/auth/account_queries.d.ts.map +1 -1
  63. package/dist/auth/account_queries.js +10 -0
  64. package/dist/auth/account_routes.d.ts +3 -3
  65. package/dist/auth/account_routes.js +3 -3
  66. package/dist/auth/account_schema.d.ts +1 -1
  67. package/dist/auth/account_schema.js +1 -1
  68. package/dist/auth/admin_actions.d.ts +1 -0
  69. package/dist/auth/admin_actions.d.ts.map +1 -1
  70. package/dist/auth/admin_actions.js +1 -0
  71. package/dist/auth/api_token.d.ts +1 -1
  72. package/dist/auth/api_token.js +1 -1
  73. package/dist/auth/api_token_queries.d.ts +7 -0
  74. package/dist/auth/api_token_queries.d.ts.map +1 -1
  75. package/dist/auth/api_token_queries.js +7 -0
  76. package/dist/auth/app_settings_queries.d.ts +4 -0
  77. package/dist/auth/app_settings_queries.d.ts.map +1 -1
  78. package/dist/auth/app_settings_queries.js +4 -0
  79. package/dist/auth/audit_log_queries.d.ts +6 -0
  80. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  81. package/dist/auth/audit_log_queries.js +6 -0
  82. package/dist/auth/audit_log_routes.d.ts +1 -1
  83. package/dist/auth/audit_log_routes.js +1 -1
  84. package/dist/auth/audit_log_schema.d.ts +3 -1
  85. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  86. package/dist/auth/audit_log_schema.js +134 -55
  87. package/dist/auth/bearer_auth.d.ts +2 -0
  88. package/dist/auth/bearer_auth.d.ts.map +1 -1
  89. package/dist/auth/bearer_auth.js +2 -0
  90. package/dist/auth/bootstrap_account.d.ts +3 -0
  91. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  92. package/dist/auth/bootstrap_account.js +3 -0
  93. package/dist/auth/cleanup.d.ts +6 -0
  94. package/dist/auth/cleanup.d.ts.map +1 -1
  95. package/dist/auth/cleanup.js +6 -0
  96. package/dist/auth/daemon_token.d.ts +1 -1
  97. package/dist/auth/daemon_token.js +1 -1
  98. package/dist/auth/daemon_token_middleware.d.ts +5 -1
  99. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  100. package/dist/auth/daemon_token_middleware.js +5 -1
  101. package/dist/auth/ddl.d.ts +1 -1
  102. package/dist/auth/ddl.js +1 -1
  103. package/dist/auth/invite_queries.d.ts +4 -0
  104. package/dist/auth/invite_queries.d.ts.map +1 -1
  105. package/dist/auth/invite_queries.js +4 -0
  106. package/dist/auth/password.d.ts +1 -1
  107. package/dist/auth/password.js +1 -1
  108. package/dist/auth/permit_offer_action_specs.d.ts +5 -0
  109. package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
  110. package/dist/auth/permit_offer_action_specs.js +10 -0
  111. package/dist/auth/permit_offer_queries.d.ts +19 -0
  112. package/dist/auth/permit_offer_queries.d.ts.map +1 -1
  113. package/dist/auth/permit_offer_queries.js +19 -0
  114. package/dist/auth/permit_queries.d.ts +8 -0
  115. package/dist/auth/permit_queries.d.ts.map +1 -1
  116. package/dist/auth/permit_queries.js +8 -0
  117. package/dist/auth/request_context.d.ts +1 -0
  118. package/dist/auth/request_context.d.ts.map +1 -1
  119. package/dist/auth/request_context.js +1 -0
  120. package/dist/auth/role_schema.d.ts +2 -0
  121. package/dist/auth/role_schema.d.ts.map +1 -1
  122. package/dist/auth/role_schema.js +2 -0
  123. package/dist/auth/route_guards.d.ts +1 -1
  124. package/dist/auth/route_guards.js +1 -1
  125. package/dist/auth/self_service_role_action_specs.d.ts +1 -1
  126. package/dist/auth/self_service_role_action_specs.js +1 -1
  127. package/dist/auth/self_service_role_actions.d.ts +2 -1
  128. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  129. package/dist/auth/self_service_role_actions.js +2 -1
  130. package/dist/auth/session_lifecycle.d.ts +3 -0
  131. package/dist/auth/session_lifecycle.d.ts.map +1 -1
  132. package/dist/auth/session_lifecycle.js +3 -0
  133. package/dist/auth/session_middleware.d.ts +5 -0
  134. package/dist/auth/session_middleware.d.ts.map +1 -1
  135. package/dist/auth/session_middleware.js +5 -0
  136. package/dist/auth/session_queries.d.ts +10 -1
  137. package/dist/auth/session_queries.d.ts.map +1 -1
  138. package/dist/auth/session_queries.js +10 -1
  139. package/dist/auth/signup_routes.d.ts +1 -1
  140. package/dist/auth/signup_routes.js +1 -1
  141. package/dist/cli/config.d.ts +2 -0
  142. package/dist/cli/config.d.ts.map +1 -1
  143. package/dist/cli/config.js +2 -0
  144. package/dist/cli/daemon.d.ts +6 -1
  145. package/dist/cli/daemon.d.ts.map +1 -1
  146. package/dist/cli/daemon.js +6 -1
  147. package/dist/cli/util.d.ts +1 -1
  148. package/dist/cli/util.js +1 -1
  149. package/dist/db/assert_row.d.ts +2 -1
  150. package/dist/db/assert_row.d.ts.map +1 -1
  151. package/dist/db/assert_row.js +2 -1
  152. package/dist/db/create_db.d.ts +5 -2
  153. package/dist/db/create_db.d.ts.map +1 -1
  154. package/dist/db/create_db.js +5 -2
  155. package/dist/db/db.d.ts +22 -7
  156. package/dist/db/db.d.ts.map +1 -1
  157. package/dist/db/db.js +21 -6
  158. package/dist/db/db_pg.d.ts +2 -1
  159. package/dist/db/db_pg.d.ts.map +1 -1
  160. package/dist/db/db_pg.js +5 -3
  161. package/dist/db/db_pglite.d.ts +3 -2
  162. package/dist/db/db_pglite.d.ts.map +1 -1
  163. package/dist/db/db_pglite.js +3 -2
  164. package/dist/db/migrate.d.ts +8 -4
  165. package/dist/db/migrate.d.ts.map +1 -1
  166. package/dist/db/migrate.js +6 -2
  167. package/dist/db/sql_identifier.d.ts +2 -1
  168. package/dist/db/sql_identifier.d.ts.map +1 -1
  169. package/dist/db/sql_identifier.js +2 -1
  170. package/dist/db/status.d.ts +4 -1
  171. package/dist/db/status.d.ts.map +1 -1
  172. package/dist/db/status.js +5 -2
  173. package/dist/dev/setup.d.ts +18 -2
  174. package/dist/dev/setup.d.ts.map +1 -1
  175. package/dist/dev/setup.js +18 -2
  176. package/dist/env/dotenv.d.ts +2 -1
  177. package/dist/env/dotenv.d.ts.map +1 -1
  178. package/dist/env/dotenv.js +2 -1
  179. package/dist/env/load.d.ts +1 -1
  180. package/dist/env/load.js +1 -1
  181. package/dist/env/resolve.d.ts +1 -1
  182. package/dist/env/resolve.js +1 -1
  183. package/dist/env/update_env_variable.d.ts +2 -0
  184. package/dist/env/update_env_variable.d.ts.map +1 -1
  185. package/dist/env/update_env_variable.js +2 -0
  186. package/dist/hono_context.d.ts +1 -1
  187. package/dist/hono_context.js +1 -1
  188. package/dist/http/jsonrpc_errors.d.ts +2 -2
  189. package/dist/http/jsonrpc_errors.js +2 -2
  190. package/dist/http/jsonrpc_helpers.d.ts +2 -2
  191. package/dist/http/jsonrpc_helpers.js +2 -2
  192. package/dist/http/middleware_spec.d.ts +1 -1
  193. package/dist/http/middleware_spec.js +1 -1
  194. package/dist/http/origin.d.ts +1 -1
  195. package/dist/http/origin.js +1 -1
  196. package/dist/http/pending_effects.d.ts +4 -0
  197. package/dist/http/pending_effects.d.ts.map +1 -1
  198. package/dist/http/pending_effects.js +4 -0
  199. package/dist/http/proxy.d.ts +3 -0
  200. package/dist/http/proxy.d.ts.map +1 -1
  201. package/dist/http/proxy.js +3 -0
  202. package/dist/http/route_spec.d.ts +1 -0
  203. package/dist/http/route_spec.d.ts.map +1 -1
  204. package/dist/http/route_spec.js +7 -0
  205. package/dist/http/schema_helpers.d.ts +1 -1
  206. package/dist/http/schema_helpers.js +1 -1
  207. package/dist/http/surface.d.ts +1 -1
  208. package/dist/http/surface.js +1 -1
  209. package/dist/rate_limiter.d.ts +14 -1
  210. package/dist/rate_limiter.d.ts.map +1 -1
  211. package/dist/rate_limiter.js +14 -1
  212. package/dist/realtime/sse.d.ts +7 -1
  213. package/dist/realtime/sse.d.ts.map +1 -1
  214. package/dist/realtime/sse.js +3 -1
  215. package/dist/realtime/sse_auth_guard.d.ts +21 -21
  216. package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
  217. package/dist/realtime/sse_auth_guard.js +24 -24
  218. package/dist/realtime/subscriber_registry.d.ts +4 -2
  219. package/dist/realtime/subscriber_registry.d.ts.map +1 -1
  220. package/dist/realtime/subscriber_registry.js +4 -2
  221. package/dist/runtime/deno.d.ts +1 -1
  222. package/dist/runtime/deno.js +1 -1
  223. package/dist/runtime/fs.d.ts +5 -0
  224. package/dist/runtime/fs.d.ts.map +1 -1
  225. package/dist/runtime/fs.js +5 -0
  226. package/dist/runtime/mock.d.ts +6 -0
  227. package/dist/runtime/mock.d.ts.map +1 -1
  228. package/dist/runtime/mock.js +6 -0
  229. package/dist/runtime/node.d.ts +1 -1
  230. package/dist/runtime/node.js +1 -1
  231. package/dist/server/app_backend.d.ts +1 -0
  232. package/dist/server/app_backend.d.ts.map +1 -1
  233. package/dist/server/app_backend.js +1 -0
  234. package/dist/server/app_server.d.ts +4 -0
  235. package/dist/server/app_server.d.ts.map +1 -1
  236. package/dist/server/app_server.js +4 -0
  237. package/dist/server/validate_nginx.d.ts +3 -0
  238. package/dist/server/validate_nginx.d.ts.map +1 -1
  239. package/dist/testing/admin_integration.d.ts +5 -0
  240. package/dist/testing/admin_integration.d.ts.map +1 -1
  241. package/dist/testing/admin_integration.js +5 -0
  242. package/dist/testing/adversarial_headers.d.ts +5 -3
  243. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  244. package/dist/testing/adversarial_headers.js +5 -3
  245. package/dist/testing/adversarial_input.d.ts +4 -0
  246. package/dist/testing/adversarial_input.d.ts.map +1 -1
  247. package/dist/testing/adversarial_input.js +4 -0
  248. package/dist/testing/app_server.d.ts +3 -0
  249. package/dist/testing/app_server.d.ts.map +1 -1
  250. package/dist/testing/app_server.js +11 -0
  251. package/dist/testing/assertions.d.ts +23 -7
  252. package/dist/testing/assertions.d.ts.map +1 -1
  253. package/dist/testing/assertions.js +23 -7
  254. package/dist/testing/audit_completeness.d.ts +4 -0
  255. package/dist/testing/audit_completeness.d.ts.map +1 -1
  256. package/dist/testing/audit_completeness.js +4 -0
  257. package/dist/testing/auth_apps.d.ts +3 -0
  258. package/dist/testing/auth_apps.d.ts.map +1 -1
  259. package/dist/testing/auth_apps.js +3 -0
  260. package/dist/testing/db.d.ts +9 -1
  261. package/dist/testing/db.d.ts.map +1 -1
  262. package/dist/testing/db.js +9 -1
  263. package/dist/testing/error_coverage.d.ts +9 -0
  264. package/dist/testing/error_coverage.d.ts.map +1 -1
  265. package/dist/testing/error_coverage.js +9 -0
  266. package/dist/testing/integration.d.ts +4 -0
  267. package/dist/testing/integration.d.ts.map +1 -1
  268. package/dist/testing/integration.js +4 -0
  269. package/dist/testing/integration_helpers.d.ts +10 -4
  270. package/dist/testing/integration_helpers.d.ts.map +1 -1
  271. package/dist/testing/integration_helpers.js +10 -4
  272. package/dist/testing/middleware.d.ts +5 -0
  273. package/dist/testing/middleware.d.ts.map +1 -1
  274. package/dist/testing/middleware.js +5 -0
  275. package/dist/testing/rate_limiting.d.ts +3 -0
  276. package/dist/testing/rate_limiting.d.ts.map +1 -1
  277. package/dist/testing/rate_limiting.js +3 -0
  278. package/dist/testing/rpc_attack_surface.js +1 -1
  279. package/dist/testing/rpc_helpers.d.ts +21 -8
  280. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  281. package/dist/testing/rpc_helpers.js +22 -9
  282. package/dist/testing/schema_generators.d.ts +7 -2
  283. package/dist/testing/schema_generators.d.ts.map +1 -1
  284. package/dist/testing/schema_generators.js +7 -2
  285. package/dist/testing/sse_round_trip.d.ts +3 -0
  286. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  287. package/dist/testing/sse_round_trip.js +3 -0
  288. package/dist/testing/stubs.d.ts +7 -0
  289. package/dist/testing/stubs.d.ts.map +1 -1
  290. package/dist/testing/stubs.js +7 -0
  291. package/dist/testing/surface_invariants.d.ts +14 -0
  292. package/dist/testing/surface_invariants.d.ts.map +1 -1
  293. package/dist/testing/surface_invariants.js +14 -0
  294. package/dist/testing/ws_round_trip.d.ts +13 -1
  295. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  296. package/dist/testing/ws_round_trip.js +1 -1
  297. package/dist/ui/AccountSessions.svelte +9 -0
  298. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
  299. package/dist/ui/AdminAccounts.svelte +10 -0
  300. package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
  301. package/dist/ui/AdminAuditLog.svelte +10 -0
  302. package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
  303. package/dist/ui/AdminInvites.svelte +9 -0
  304. package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
  305. package/dist/ui/AdminOverview.svelte +10 -0
  306. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  307. package/dist/ui/AdminPermitHistory.svelte +9 -0
  308. package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -1
  309. package/dist/ui/AdminSessions.svelte +10 -0
  310. package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
  311. package/dist/ui/AdminSettings.svelte +9 -0
  312. package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
  313. package/dist/ui/AdminSurface.svelte +9 -0
  314. package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
  315. package/dist/ui/AppShell.svelte +24 -0
  316. package/dist/ui/AppShell.svelte.d.ts +23 -0
  317. package/dist/ui/AppShell.svelte.d.ts.map +1 -1
  318. package/dist/ui/BootstrapForm.svelte +17 -0
  319. package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
  320. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  321. package/dist/ui/ColumnLayout.svelte +11 -0
  322. package/dist/ui/ColumnLayout.svelte.d.ts +10 -0
  323. package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -1
  324. package/dist/ui/Datatable.svelte +18 -0
  325. package/dist/ui/Datatable.svelte.d.ts +17 -0
  326. package/dist/ui/Datatable.svelte.d.ts.map +1 -1
  327. package/dist/ui/LoginForm.svelte +18 -0
  328. package/dist/ui/LoginForm.svelte.d.ts +9 -0
  329. package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
  330. package/dist/ui/LogoutButton.svelte +9 -0
  331. package/dist/ui/LogoutButton.svelte.d.ts +8 -0
  332. package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
  333. package/dist/ui/MenuLink.svelte +10 -0
  334. package/dist/ui/MenuLink.svelte.d.ts +9 -0
  335. package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
  336. package/dist/ui/OpenSignupToggle.svelte +9 -0
  337. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
  338. package/dist/ui/SignupForm.svelte +16 -0
  339. package/dist/ui/SignupForm.svelte.d.ts +4 -0
  340. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  341. package/dist/ui/SurfaceExplorer.svelte +9 -0
  342. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  343. package/dist/ui/account_sessions_state.svelte.d.ts +2 -2
  344. package/dist/ui/account_sessions_state.svelte.js +1 -1
  345. package/dist/ui/admin_rpc_adapters.d.ts +1 -1
  346. package/dist/ui/admin_rpc_adapters.js +1 -1
  347. package/dist/ui/audit_log_state.svelte.d.ts +6 -1
  348. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  349. package/dist/ui/audit_log_state.svelte.js +6 -1
  350. package/dist/ui/auth_state.svelte.d.ts +16 -4
  351. package/dist/ui/auth_state.svelte.d.ts.map +1 -1
  352. package/dist/ui/auth_state.svelte.js +16 -4
  353. package/dist/ui/form_state.svelte.d.ts +9 -0
  354. package/dist/ui/form_state.svelte.d.ts.map +1 -1
  355. package/dist/ui/form_state.svelte.js +9 -0
  356. package/dist/ui/loadable.svelte.d.ts +6 -1
  357. package/dist/ui/loadable.svelte.d.ts.map +1 -1
  358. package/dist/ui/loadable.svelte.js +6 -1
  359. package/dist/ui/permit_offers_state.svelte.d.ts +2 -0
  360. package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
  361. package/dist/ui/permit_offers_state.svelte.js +2 -0
  362. package/dist/ui/popover.svelte.d.ts +17 -4
  363. package/dist/ui/popover.svelte.d.ts.map +1 -1
  364. package/dist/ui/popover.svelte.js +17 -4
  365. package/dist/ui/position_helpers.d.ts +1 -0
  366. package/dist/ui/position_helpers.d.ts.map +1 -1
  367. package/dist/ui/position_helpers.js +1 -0
  368. package/dist/ui/sidebar_state.svelte.d.ts +22 -9
  369. package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
  370. package/dist/ui/sidebar_state.svelte.js +17 -2
  371. package/dist/ui/table_state.svelte.d.ts +14 -0
  372. package/dist/ui/table_state.svelte.d.ts.map +1 -1
  373. package/dist/ui/table_state.svelte.js +14 -0
  374. package/package.json +1 -1
@@ -58,13 +58,39 @@ export declare const is_notification_send_with_parsed_input: <TMethod extends st
58
58
  step: "parsed" | "handling";
59
59
  input: unknown;
60
60
  };
61
+ /**
62
+ * Validate that a step transition is legal per `ACTION_EVENT_STEP_TRANSITIONS`.
63
+ *
64
+ * @throws Error if `from → to` is not a permitted transition
65
+ */
61
66
  export declare const validate_step_transition: (from: ActionEventStep, to: ActionEventStep) => void;
67
+ /**
68
+ * Validate that `phase` is one of the phases allowed for `kind` per
69
+ * `ACTION_EVENT_PHASE_BY_KIND`.
70
+ *
71
+ * @throws Error if `phase` is not valid for `kind`
72
+ */
62
73
  export declare const validate_phase_for_kind: (kind: ActionKind, phase: ActionEventPhase) => void;
74
+ /**
75
+ * Validate that a phase chain is legal per `ACTION_EVENT_PHASE_TRANSITIONS`.
76
+ *
77
+ * @throws Error if `from → to` is not the permitted next phase (or `from` is terminal)
78
+ */
63
79
  export declare const validate_phase_transition: (from: ActionEventPhase, to: ActionEventPhase) => void;
64
80
  export declare const get_initial_phase: (kind: ActionKind, initiator: ActionInitiator, executor: ActionExecutor) => ActionEventPhase | null;
65
81
  export declare const should_validate_output: (kind: ActionKind, phase: ActionEventPhase) => boolean;
66
82
  export declare const is_action_complete: (data: ActionEventData) => boolean;
67
83
  export declare const create_initial_data: (kind: ActionKind, phase: ActionEventPhase, method: string, executor: ActionExecutor, input: unknown) => ActionEventData;
84
+ /**
85
+ * Pull the terminal `Result` from an action event.
86
+ *
87
+ * `data.error` populated → error path (covers both explicit `failed` and
88
+ * the unhandled `receive_error` / `send_error` case where no handler was
89
+ * registered for the error phase). `step === 'handled'` → success path.
90
+ *
91
+ * @throws Error if the event is in a non-terminal state (programming error —
92
+ * callers should check `is_action_complete` first)
93
+ */
68
94
  export declare const extract_action_result: (event: ActionEvent) => Result<{
69
95
  value: ActionEventData["output"];
70
96
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"action_event_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_event_helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,E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G,IAIrF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,MAAM,UAAU,EAAE,OAAO,gBAAgB,KAAG,IAInF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,MAAM,gBAAgB,EAAE,IAAI,gBAAgB,KAAG,IAKxF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC7B,MAAM,UAAU,EAChB,WAAW,eAAe,EAC1B,UAAU,cAAc,KACtB,gBAAgB,GAAG,IAWrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,MAAM,UAAU,EAAE,OAAO,gBAAgB,KAAG,OAEpC,CAAC;AAEhD,eAAO,MAAM,kBAAkB,GAAI,MAAM,eAAe,KAAG,OAO1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC/B,MAAM,UAAU,EAChB,OAAO,gBAAgB,EACvB,QAAQ,MAAM,EACd,UAAU,cAAc,EACxB,OAAO,OAAO,KACZ,eAaD,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GACjC,OAAO,WAAW,KAChB,MAAM,CAAC;IAAC,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAA;CAAC,EAAE;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAC,CAuBxE,CAAC"}
@@ -27,17 +27,32 @@ export const is_failed = (data) => data.step === 'failed';
27
27
  // are created when transitioning from 'parsed' to 'handling'
28
28
  export const is_send_request_with_parsed_input = (data) => is_send_request(data) && (data.step === 'parsed' || data.step === 'handling');
29
29
  export const is_notification_send_with_parsed_input = (data) => is_notification_send(data) && (data.step === 'parsed' || data.step === 'handling');
30
- // Validation helpers
30
+ /**
31
+ * Validate that a step transition is legal per `ACTION_EVENT_STEP_TRANSITIONS`.
32
+ *
33
+ * @throws Error if `from → to` is not a permitted transition
34
+ */
31
35
  export const validate_step_transition = (from, to) => {
32
36
  if (!ACTION_EVENT_STEP_TRANSITIONS[from].includes(to)) {
33
37
  throw new Error(`Invalid step transition from '${from}' to '${to}'`);
34
38
  }
35
39
  };
40
+ /**
41
+ * Validate that `phase` is one of the phases allowed for `kind` per
42
+ * `ACTION_EVENT_PHASE_BY_KIND`.
43
+ *
44
+ * @throws Error if `phase` is not valid for `kind`
45
+ */
36
46
  export const validate_phase_for_kind = (kind, phase) => {
37
47
  if (!ACTION_EVENT_PHASE_BY_KIND[kind].includes(phase)) {
38
48
  throw new Error(`Invalid phase '${phase}' for ${kind} action`);
39
49
  }
40
50
  };
51
+ /**
52
+ * Validate that a phase chain is legal per `ACTION_EVENT_PHASE_TRANSITIONS`.
53
+ *
54
+ * @throws Error if `from → to` is not the permitted next phase (or `from` is terminal)
55
+ */
41
56
  export const validate_phase_transition = (from, to) => {
42
57
  const expected = ACTION_EVENT_PHASE_TRANSITIONS[from];
43
58
  if (expected !== to) {
@@ -81,6 +96,16 @@ export const create_initial_data = (kind, phase, method, executor, input) => ({
81
96
  response: null,
82
97
  notification: null,
83
98
  });
99
+ /**
100
+ * Pull the terminal `Result` from an action event.
101
+ *
102
+ * `data.error` populated → error path (covers both explicit `failed` and
103
+ * the unhandled `receive_error` / `send_error` case where no handler was
104
+ * registered for the error phase). `step === 'handled'` → success path.
105
+ *
106
+ * @throws Error if the event is in a non-terminal state (programming error —
107
+ * callers should check `is_action_complete` first)
108
+ */
84
109
  export const extract_action_result = (event) => {
85
110
  const { data } = event;
86
111
  // `data.error` populated → error path. This covers two cases:
@@ -31,8 +31,25 @@ export declare class ActionPeer {
31
31
  readonly transports: Transports;
32
32
  default_send_options: Omit<ActionPeerSendOptions, 'signal'>;
33
33
  constructor(options: ActionPeerOptions);
34
+ /**
35
+ * Resolve a transport (per-call name → default name → registry default)
36
+ * and forward the message. Catches unexpected throws and converts them
37
+ * to JSON-RPC error responses — this method never throws.
38
+ *
39
+ * @returns the response envelope for requests, or `null` for successful
40
+ * notifications (`JsonrpcErrorResponse` if the notification's transport
41
+ * send failed)
42
+ */
34
43
  send(message: JsonrpcRequest, options?: ActionPeerSendOptions): Promise<JsonrpcResponseOrError>;
35
44
  send(message: JsonrpcNotification, options?: ActionPeerSendOptions): Promise<JsonrpcErrorResponse | null>;
45
+ /**
46
+ * Dispatch an inbound JSON-RPC message — request, notification, or
47
+ * malformed envelope. Never throws; unexpected failures become
48
+ * JSON-RPC error responses.
49
+ *
50
+ * @returns response message for requests, `null` for notifications, or
51
+ * an `invalid_request` error for malformed input
52
+ */
36
53
  receive(message: unknown): Promise<JsonrpcMessageFromServerToClient | null>;
37
54
  }
38
55
  //# sourceMappingURL=action_peer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action_peer.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_peer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEN,gCAAgC,EAChC,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EAAC,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAOpE;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAClE,cAAc,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IACjC,WAAW,EAAE,sBAAsB,CAAC;IAGpC,UAAU,CAAC,EAAE,UAAU,CAAC;IAKxB,oBAAoB,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;CAC7D;AAED,qBAAa,UAAU;;IACtB,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAMhC,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;gBAEhD,OAAO,EAAE,iBAAiB;IAOh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C,EAAE,qBAAqB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAC5B,IAAI,CACT,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA8CvC;;;;;;;OAOG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gCAAgC,GAAG,IAAI,CAAC;CAyIjF"}
@@ -48,6 +48,14 @@ export class ActionPeer {
48
48
  return create_jsonrpc_error_response_from_thrown(to_jsonrpc_message_id(message), error);
49
49
  } // TODO finally?
50
50
  }
51
+ /**
52
+ * Dispatch an inbound JSON-RPC message — request, notification, or
53
+ * malformed envelope. Never throws; unexpected failures become
54
+ * JSON-RPC error responses.
55
+ *
56
+ * @returns response message for requests, `null` for notifications, or
57
+ * an `invalid_request` error for malformed input
58
+ */
51
59
  async receive(message) {
52
60
  try {
53
61
  const result = await this.#receive_message(message);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `ActionRegistry` — query and filter utility over `ActionSpecUnion[]`.
3
3
  *
4
- * Vocabulary (set in API review III, see the `docs/` directory and the SAES quest):
4
+ * Vocabulary (see the `docs/` directory):
5
5
  * - `*_handled_*` — request_response specs the named side **receives**
6
6
  * (so the named side owns the handler). Used by codegen to emit typed
7
7
  * handler maps.
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * Cache discipline: `spec_by_method` (Map) and the internal streams-target
19
19
  * set lazy-memoize because the Map is consulted per-RPC dispatch
20
- * (`frontend_rpc_client.ts` wires it into `lookup_action_spec`) and the
20
+ * (`actions/frontend_rpc_client.ts` wires it into `lookup_action_spec`) and the
21
21
  * streams set is rebuilt by two public getters. Array-returning getters
22
22
  * recompute on each call so callers can mutate the result freely
23
23
  * (`.sort()`, `.push(injected)` on a copy, etc.) without affecting the
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `ActionRegistry` — query and filter utility over `ActionSpecUnion[]`.
3
3
  *
4
- * Vocabulary (set in API review III, see the `docs/` directory and the SAES quest):
4
+ * Vocabulary (see the `docs/` directory):
5
5
  * - `*_handled_*` — request_response specs the named side **receives**
6
6
  * (so the named side owns the handler). Used by codegen to emit typed
7
7
  * handler maps.
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * Cache discipline: `spec_by_method` (Map) and the internal streams-target
19
19
  * set lazy-memoize because the Map is consulted per-RPC dispatch
20
- * (`frontend_rpc_client.ts` wires it into `lookup_action_spec`) and the
20
+ * (`actions/frontend_rpc_client.ts` wires it into `lookup_action_spec`) and the
21
21
  * streams set is rebuilt by two public getters. Array-returning getters
22
22
  * recompute on each call so callers can mutate the result freely
23
23
  * (`.sort()`, `.push(injected)` on a copy, etc.) without affecting the
@@ -132,6 +132,10 @@ export interface CreateRpcEndpointOptions {
132
132
  *
133
133
  * @param options - endpoint path, actions, and logger
134
134
  * @returns route specs (GET + POST) ready for `apply_route_specs`
135
+ * @throws Error if two actions share the same `spec.method` (registration-time
136
+ * duplicate detection); also throws if any action's `spec.input` is
137
+ * `z.null()` (JSON-RPC 2.0 §4.2 forbids `params: null` on the wire — use
138
+ * `z.void()` for parameterless methods).
135
139
  */
136
140
  export declare const create_rpc_endpoint: (options: CreateRpcEndpointOptions) => Array<RouteSpec>;
137
141
  //# sourceMappingURL=action_rpc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action_rpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAAgC,KAAK,cAAc,EAAC,MAAM,4BAA4B,CAA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AAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;OAQG;IACH,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD;;;;OAIG;IACH,MAAM,EAAE,WAAW,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,CACxD,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,aAAa,KACd,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,aAAa,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,SAAS,yBAAyB,EACjE,MAAM,KAAK,EACX,SAAS,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KACvE,SAGD,CAAC;AAEH,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACxC,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;CACZ;AA4DD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,wBAAwB,KAAG,KAAK,CAAC,SAAS,CAsQtF,CAAC"}
@@ -118,6 +118,10 @@ const check_action_auth = (auth, request_context, credential_type) => {
118
118
  *
119
119
  * @param options - endpoint path, actions, and logger
120
120
  * @returns route specs (GET + POST) ready for `apply_route_specs`
121
+ * @throws Error if two actions share the same `spec.method` (registration-time
122
+ * duplicate detection); also throws if any action's `spec.input` is
123
+ * `z.null()` (JSON-RPC 2.0 §4.2 forbids `params: null` on the wire — use
124
+ * `z.void()` for parameterless methods).
121
125
  */
122
126
  export const create_rpc_endpoint = (options) => {
123
127
  const { path: endpoint_path, actions, log } = options;
@@ -3,7 +3,10 @@
3
3
  *
4
4
  * Extracted from zzz's action system. Action specs define method, kind,
5
5
  * auth, side effects, and input/output schemas. Bridge functions in
6
- * `action_bridge.ts` derive `RouteSpec` and `EventSpec` from them.
6
+ * `actions/action_bridge.ts` derive `RouteSpec` and `EventSpec` from them.
7
+ *
8
+ * @see `actions/action_rpc.ts` for the JSON-RPC dispatcher
9
+ * @see `actions/register_action_ws.ts` for the WebSocket dispatcher
7
10
  *
8
11
  * TODO @action-system-review The action system (action_spec, action_registry,
9
12
  * action_codegen, action_bridge) will evolve significantly as RPC patterns settle.
@@ -59,6 +62,16 @@ export declare const ActionSpec: z.ZodObject<{
59
62
  * consumer-side concern.
60
63
  */
61
64
  streams: z.ZodOptional<z.ZodString>;
65
+ /**
66
+ * Error reason codes this action may surface via `error.data.reason` on
67
+ * failure. Declarative metadata mirroring the `streams` precedent —
68
+ * codegen, UI form-state matching, and docs read it off the spec instead
69
+ * of scanning handler implementations. Reuses the same `as const` string
70
+ * constants the handler throws (e.g. `ERROR_OFFER_*`) so call sites can
71
+ * import either side. Optional — actions that surface only standard
72
+ * transport errors leave it unset.
73
+ */
74
+ error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
62
75
  }, z.core.$strict>;
63
76
  export type ActionSpec = z.infer<typeof ActionSpec>;
64
77
  export declare const RequestResponseActionSpec: z.ZodObject<{
@@ -73,6 +86,7 @@ export declare const RequestResponseActionSpec: z.ZodObject<{
73
86
  output: z.ZodCustom<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
74
87
  description: z.ZodString;
75
88
  streams: z.ZodOptional<z.ZodString>;
89
+ error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
76
90
  kind: z.ZodDefault<z.ZodLiteral<"request_response">>;
77
91
  auth: z.ZodUnion<readonly [z.ZodLiteral<"public">, z.ZodLiteral<"authenticated">, z.ZodLiteral<"keeper">, z.ZodObject<{
78
92
  role: z.ZodString;
@@ -90,6 +104,7 @@ export declare const RemoteNotificationActionSpec: z.ZodObject<{
90
104
  input: z.ZodCustom<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
91
105
  description: z.ZodString;
92
106
  streams: z.ZodOptional<z.ZodString>;
107
+ error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
93
108
  kind: z.ZodDefault<z.ZodLiteral<"remote_notification">>;
94
109
  auth: z.ZodDefault<z.ZodNull>;
95
110
  side_effects: z.ZodDefault<z.ZodLiteral<true>>;
@@ -98,8 +113,8 @@ export declare const RemoteNotificationActionSpec: z.ZodObject<{
98
113
  }, z.core.$strict>;
99
114
  export type RemoteNotificationActionSpec = z.infer<typeof RemoteNotificationActionSpec>;
100
115
  /**
101
- * Local calls can wrap synchronous or asynchronous actions,
102
- * and are the escape hatch for remote APIs that do not support SAES.
116
+ * Local calls can wrap synchronous or asynchronous actions, and are the
117
+ * escape hatch for remote APIs that do not support SAES.
103
118
  */
104
119
  export declare const LocalCallActionSpec: z.ZodObject<{
105
120
  method: z.ZodString;
@@ -114,6 +129,7 @@ export declare const LocalCallActionSpec: z.ZodObject<{
114
129
  async: z.ZodBoolean;
115
130
  description: z.ZodString;
116
131
  streams: z.ZodOptional<z.ZodString>;
132
+ error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
117
133
  kind: z.ZodDefault<z.ZodLiteral<"local_call">>;
118
134
  auth: z.ZodDefault<z.ZodNull>;
119
135
  }, z.core.$strict>;
@@ -130,6 +146,7 @@ export declare const ActionSpecUnion: z.ZodUnion<readonly [z.ZodObject<{
130
146
  output: z.ZodCustom<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
131
147
  description: z.ZodString;
132
148
  streams: z.ZodOptional<z.ZodString>;
149
+ error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
133
150
  kind: z.ZodDefault<z.ZodLiteral<"request_response">>;
134
151
  auth: z.ZodUnion<readonly [z.ZodLiteral<"public">, z.ZodLiteral<"authenticated">, z.ZodLiteral<"keeper">, z.ZodObject<{
135
152
  role: z.ZodString;
@@ -145,6 +162,7 @@ export declare const ActionSpecUnion: z.ZodUnion<readonly [z.ZodObject<{
145
162
  input: z.ZodCustom<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
146
163
  description: z.ZodString;
147
164
  streams: z.ZodOptional<z.ZodString>;
165
+ error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
148
166
  kind: z.ZodDefault<z.ZodLiteral<"remote_notification">>;
149
167
  auth: z.ZodDefault<z.ZodNull>;
150
168
  side_effects: z.ZodDefault<z.ZodLiteral<true>>;
@@ -163,10 +181,12 @@ export declare const ActionSpecUnion: z.ZodUnion<readonly [z.ZodObject<{
163
181
  async: z.ZodBoolean;
164
182
  description: z.ZodString;
165
183
  streams: z.ZodOptional<z.ZodString>;
184
+ error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
166
185
  kind: z.ZodDefault<z.ZodLiteral<"local_call">>;
167
186
  auth: z.ZodDefault<z.ZodNull>;
168
187
  }, z.core.$strict>]>;
169
188
  export type ActionSpecUnion = z.infer<typeof ActionSpecUnion>;
189
+ /** Structural type guard for any `ActionSpecUnion` variant — checks `kind` is one of the three known values. */
170
190
  export declare const is_action_spec: (value: unknown) => value is ActionSpecUnion;
171
191
  export declare const ActionEventPhase: z.ZodEnum<{
172
192
  send_request: "send_request";
@@ -1 +1 @@
1
- {"version":3,"file":"action_spec.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,UAAU;;;;EAAoE,CAAC;AAC5F,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,eAAe;;;;EAA0C,CAAC;AACvE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU;;oBAKrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;IAUtB;;;;;;OAMG;;kBAEF,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;kBAIpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;kBAMvC,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAExF;;;GAGG;AACH,e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;IAEH;;;;;;;;OAQG;;kBAEF,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;kBAIpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;kBAMvC,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;kBAG9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAI1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,gHAAgH;AAChH,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,eAKoB,CAAC;AAE9E,eAAO,MAAM,gBAAgB;;;;;;;;;;EAU3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -3,7 +3,10 @@
3
3
  *
4
4
  * Extracted from zzz's action system. Action specs define method, kind,
5
5
  * auth, side effects, and input/output schemas. Bridge functions in
6
- * `action_bridge.ts` derive `RouteSpec` and `EventSpec` from them.
6
+ * `actions/action_bridge.ts` derive `RouteSpec` and `EventSpec` from them.
7
+ *
8
+ * @see `actions/action_rpc.ts` for the JSON-RPC dispatcher
9
+ * @see `actions/register_action_ws.ts` for the WebSocket dispatcher
7
10
  *
8
11
  * TODO @action-system-review The action system (action_spec, action_registry,
9
12
  * action_codegen, action_bridge) will evolve significantly as RPC patterns settle.
@@ -40,6 +43,16 @@ export const ActionSpec = z.strictObject({
40
43
  * consumer-side concern.
41
44
  */
42
45
  streams: z.string().optional(),
46
+ /**
47
+ * Error reason codes this action may surface via `error.data.reason` on
48
+ * failure. Declarative metadata mirroring the `streams` precedent —
49
+ * codegen, UI form-state matching, and docs read it off the spec instead
50
+ * of scanning handler implementations. Reuses the same `as const` string
51
+ * constants the handler throws (e.g. `ERROR_OFFER_*`) so call sites can
52
+ * import either side. Optional — actions that surface only standard
53
+ * transport errors leave it unset.
54
+ */
55
+ error_reasons: z.array(z.string()).readonly().optional(),
43
56
  });
44
57
  export const RequestResponseActionSpec = ActionSpec.extend({
45
58
  kind: z.literal('request_response').default('request_response'),
@@ -54,8 +67,8 @@ export const RemoteNotificationActionSpec = ActionSpec.extend({
54
67
  async: z.literal(true).default(true),
55
68
  });
56
69
  /**
57
- * Local calls can wrap synchronous or asynchronous actions,
58
- * and are the escape hatch for remote APIs that do not support SAES.
70
+ * Local calls can wrap synchronous or asynchronous actions, and are the
71
+ * escape hatch for remote APIs that do not support SAES.
59
72
  */
60
73
  export const LocalCallActionSpec = ActionSpec.extend({
61
74
  kind: z.literal('local_call').default('local_call'),
@@ -66,6 +79,7 @@ export const ActionSpecUnion = z.union([
66
79
  RemoteNotificationActionSpec,
67
80
  LocalCallActionSpec,
68
81
  ]);
82
+ /** Structural type guard for any `ActionSpecUnion` variant — checks `kind` is one of the three known values. */
69
83
  export const is_action_spec = (value) => value !== null &&
70
84
  typeof value === 'object' &&
71
85
  'method' in value &&
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Shared type surface for the action system — context, handler, composable Action tuple.
3
3
  *
4
- * These types sit above `action_spec.ts` (pure Zod schemas) and below the
5
- * dispatchers (`register_action_ws.ts`, `action_rpc.ts`). Extracted so the
4
+ * These types sit above `actions/action_spec.ts` (pure Zod schemas) and below the
5
+ * dispatchers (`actions/register_action_ws.ts`, `actions/action_rpc.ts`). Extracted so the
6
6
  * shared protocol actions (e.g. `heartbeat_action`) can name them without
7
7
  * pulling in server-only modules.
8
8
  *
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Shared type surface for the action system — context, handler, composable Action tuple.
3
3
  *
4
- * These types sit above `action_spec.ts` (pure Zod schemas) and below the
5
- * dispatchers (`register_action_ws.ts`, `action_rpc.ts`). Extracted so the
4
+ * These types sit above `actions/action_spec.ts` (pure Zod schemas) and below the
5
+ * dispatchers (`actions/register_action_ws.ts`, `actions/action_rpc.ts`). Extracted so the
6
6
  * shared protocol actions (e.g. `heartbeat_action`) can name them without
7
7
  * pulling in server-only modules.
8
8
  *
@@ -14,7 +14,7 @@
14
14
  * handler). The handler exists for symmetry with other protocol actions
15
15
  * like `heartbeat_action`; the dispatcher never calls it. Consumers
16
16
  * spread `cancel_action` (or the `protocol_actions` bundle from
17
- * `./protocol.js`) into their server's `actions` array so `spec_by_method`
17
+ * `actions/protocol.ts`) into their server's `actions` array so `spec_by_method`
18
18
  * knows about it (enabling input validation on incoming cancels) and so
19
19
  * `create_rpc_client` codegen produces `app.api.cancel()` when desired —
20
20
  * though `FrontendWebsocketClient.request({signal})` sends the cancel on
@@ -69,7 +69,7 @@ export declare const cancel_action_spec: {
69
69
  export declare const cancel_handler: () => void;
70
70
  /**
71
71
  * Protocol-action tuple — spread into the server's `actions` array (or via
72
- * `protocol_actions` from `./protocol.js`) so the dispatcher registers the
72
+ * `protocol_actions` from `actions/protocol.ts`) so the dispatcher registers the
73
73
  * spec for input validation and so `create_rpc_client` codegen sees the
74
74
  * method. The client doesn't need to call it directly;
75
75
  * `FrontendWebsocketClient.request({signal})` sends the cancel notification
@@ -14,7 +14,7 @@
14
14
  * handler). The handler exists for symmetry with other protocol actions
15
15
  * like `heartbeat_action`; the dispatcher never calls it. Consumers
16
16
  * spread `cancel_action` (or the `protocol_actions` bundle from
17
- * `./protocol.js`) into their server's `actions` array so `spec_by_method`
17
+ * `actions/protocol.ts`) into their server's `actions` array so `spec_by_method`
18
18
  * knows about it (enabling input validation on incoming cancels) and so
19
19
  * `create_rpc_client` codegen produces `app.api.cancel()` when desired —
20
20
  * though `FrontendWebsocketClient.request({signal})` sends the cancel on
@@ -66,7 +66,7 @@ export const cancel_action_spec = {
66
66
  export const cancel_handler = () => { }; // eslint-disable-line @typescript-eslint/no-empty-function
67
67
  /**
68
68
  * Protocol-action tuple — spread into the server's `actions` array (or via
69
- * `protocol_actions` from `./protocol.js`) so the dispatcher registers the
69
+ * `protocol_actions` from `actions/protocol.ts`) so the dispatcher registers the
70
70
  * spec for input validation and so `create_rpc_client` codegen sees the
71
71
  * method. The client doesn't need to call it directly;
72
72
  * `FrontendWebsocketClient.request({signal})` sends the cancel notification
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared heartbeat action — a fuz_app protocol action carrying both a spec
3
3
  * and a handler in one tuple. Consumers spread `heartbeat_action` (or the
4
- * `protocol_actions` bundle from `./protocol.js`) into the server's
4
+ * `protocol_actions` bundle from `actions/protocol.ts`) into the server's
5
5
  * `actions` array so disconnect detection works identically across every
6
6
  * repo without per-consumer ping plumbing.
7
7
  *
@@ -39,7 +39,7 @@ export declare const heartbeat_action_spec: {
39
39
  export declare const heartbeat_handler: () => Record<string, never>;
40
40
  /**
41
41
  * Protocol-action tuple — spread into the server's `actions` array for
42
- * dispatch (or via `protocol_actions` from `./protocol.js`) so the
42
+ * dispatch (or via `protocol_actions` from `actions/protocol.ts`) so the
43
43
  * dispatcher resolves the heartbeat handler. The frontend-side spread
44
44
  * happens via `protocol_action_specs` — the client doesn't run the echo
45
45
  * handler, but the spec must be in `ActionRegistry` so `create_rpc_client`
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared heartbeat action — a fuz_app protocol action carrying both a spec
3
3
  * and a handler in one tuple. Consumers spread `heartbeat_action` (or the
4
- * `protocol_actions` bundle from `./protocol.js`) into the server's
4
+ * `protocol_actions` bundle from `actions/protocol.ts`) into the server's
5
5
  * `actions` array so disconnect detection works identically across every
6
6
  * repo without per-consumer ping plumbing.
7
7
  *
@@ -38,7 +38,7 @@ export const heartbeat_action_spec = {
38
38
  export const heartbeat_handler = () => ({});
39
39
  /**
40
40
  * Protocol-action tuple — spread into the server's `actions` array for
41
- * dispatch (or via `protocol_actions` from `./protocol.js`) so the
41
+ * dispatch (or via `protocol_actions` from `actions/protocol.ts`) so the
42
42
  * dispatcher resolves the heartbeat handler. The frontend-side spread
43
43
  * happens via `protocol_action_specs` — the client doesn't run the echo
44
44
  * handler, but the spec must be in `ActionRegistry` so `create_rpc_client`
@@ -7,7 +7,7 @@
7
7
  * fuz_app, not consumer domain logic. The split is intentional: the server
8
8
  * needs `{spec, handler}` tuples to drive dispatch; the frontend
9
9
  * `ActionRegistry` only stores specs. The codegen
10
- * `include_protocol_actions: false` default (in `action_codegen.ts`) is the
10
+ * `include_protocol_actions: false` default (in `actions/action_codegen.ts`) is the
11
11
  * third leg of this contract — protocol actions are excluded from
12
12
  * generated typed surfaces because consumers spread them in at
13
13
  * registration time.
@@ -7,7 +7,7 @@
7
7
  * fuz_app, not consumer domain logic. The split is intentional: the server
8
8
  * needs `{spec, handler}` tuples to drive dispatch; the frontend
9
9
  * `ActionRegistry` only stores specs. The codegen
10
- * `include_protocol_actions: false` default (in `action_codegen.ts`) is the
10
+ * `include_protocol_actions: false` default (in `actions/action_codegen.ts`) is the
11
11
  * third leg of this contract — protocol actions are excluded from
12
12
  * generated typed surfaces because consumers spread them in at
13
13
  * registration time.
@@ -157,12 +157,15 @@ export interface RegisterActionWsResult {
157
157
  * - Per-action auth: `public` / `authenticated` pass through (upgrade auth
158
158
  * already verified identity); `keeper` requires `daemon_token` credential
159
159
  * type *and* the keeper role; role-based `{role}` requires the named role
160
- * via `has_role`, matching the HTTP path in `action_rpc.ts`.
160
+ * via `has_role`, matching the HTTP path in `actions/action_rpc.ts`.
161
161
  * - DEV mode validates handler output against the spec's `output` schema and
162
162
  * warns on mismatches.
163
163
  *
164
164
  * @returns the transport (supplied or freshly created) — retain it to wire
165
165
  * `create_ws_auth_guard` or broadcast on audit events.
166
+ * @mutates options.app - registers a `GET path` route via `upgradeWebSocket`
167
+ * @mutates options.transport - on every message, adds/removes connections
168
+ * in the transport's internal maps via `add_connection` / `remove_connection`
166
169
  */
167
170
  export declare const register_action_ws: <TCtx extends BaseHandlerContext>(options: RegisterActionWsOptions<TCtx>) => RegisterActionWsResult;
168
171
  //# sourceMappingURL=register_action_ws.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register_action_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_action_ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACxC,OAAO,KAAK,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAEzD,OAAO,EAAS,KAAK,MAAM,IAAI,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAiBjD,OAAO,EAAC,KAAK,MAAM,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAG7F,OAAO,EAAC,yBAAyB,EAAE,KAAK,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAE9F,YAAY,EAAC,MAAM,EAAE,kBAAkB,EAAE,eAAe,EAAC,CAAC;AAE1D,0EAA0E;AAC1E,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IACjC,qFAAqF;IACrF,EAAE,EAAE,SAAS,CAAC;IACd,4EAA4E;IAC5E,aAAa,EAAE,IAAI,CAAC;IACpB,oDAAoD;IACpD,QAAQ,EAAE,kBAAkB,CAAC;IA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tC,yEAAyE;IACzE,SAAS,EAAE,yBAAyB,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,SAAS,kBAAkB,EACjE,SAAS,uBAAuB,CAAC,IAAI,CAAC,KACpC,sBA8WF,CAAC"}
@@ -55,12 +55,15 @@ export const DEFAULT_SERVER_HEARTBEAT_TIMEOUT = 60_000;
55
55
  * - Per-action auth: `public` / `authenticated` pass through (upgrade auth
56
56
  * already verified identity); `keeper` requires `daemon_token` credential
57
57
  * type *and* the keeper role; role-based `{role}` requires the named role
58
- * via `has_role`, matching the HTTP path in `action_rpc.ts`.
58
+ * via `has_role`, matching the HTTP path in `actions/action_rpc.ts`.
59
59
  * - DEV mode validates handler output against the spec's `output` schema and
60
60
  * warns on mismatches.
61
61
  *
62
62
  * @returns the transport (supplied or freshly created) — retain it to wire
63
63
  * `create_ws_auth_guard` or broadcast on audit events.
64
+ * @mutates options.app - registers a `GET path` route via `upgradeWebSocket`
65
+ * @mutates options.transport - on every message, adds/removes connections
66
+ * in the transport's internal maps via `add_connection` / `remove_connection`
64
67
  */
65
68
  export const register_action_ws = (options) => {
66
69
  const { path, app, upgradeWebSocket, actions, extend_context, transport = new BackendWebsocketTransport(), heartbeat = true, artificial_delay = 0, log = new Logger('[ws]'), on_socket_open, on_socket_close, } = options;
@@ -41,6 +41,9 @@ export interface RegisterWsEndpointOptions<TCtx extends BaseHandlerContext> exte
41
41
  * Returns the `BackendWebsocketTransport` (supplied or freshly
42
42
  * created), same as `register_action_ws` — retain it to wire
43
43
  * `create_ws_auth_guard` on `on_audit_event` or to broadcast.
44
+ *
45
+ * @mutates options.app - applies origin/auth/role middleware via `app.use`,
46
+ * then registers the `GET path` route via the inner `register_action_ws`
44
47
  */
45
48
  export declare const register_ws_endpoint: <TCtx extends BaseHandlerContext>(options: RegisterWsEndpointOptions<TCtx>) => RegisterActionWsResult;
46
49
  //# sourceMappingURL=register_ws_endpoint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register_ws_endpoint.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_ws_endpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAEN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAE1D,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB,CACzC,IAAI,SAAS,kBAAkB,CAC9B,SAAQ,uBAAuB,CAAC,IAAI,CAAC;IACtC;;;;OAIG;IACH,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,QAAQ,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,SAAS,kBAAkB,EACnE,SAAS,yBAAyB,CAAC,IAAI,CAAC,KACtC,sBAUF,CAAC"}
1
+ {"version":3,"file":"register_ws_endpoint.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_ws_endpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAEN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAE1D,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB,CACzC,IAAI,SAAS,kBAAkB,CAC9B,SAAQ,uBAAuB,CAAC,IAAI,CAAC;IACtC;;;;OAIG;IACH,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,QAAQ,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,SAAS,kBAAkB,EACnE,SAAS,yBAAyB,CAAC,IAAI,CAAC,KACtC,sBAUF,CAAC"}
@@ -26,6 +26,9 @@ import { register_action_ws, } from './register_action_ws.js';
26
26
  * Returns the `BackendWebsocketTransport` (supplied or freshly
27
27
  * created), same as `register_action_ws` — retain it to wire
28
28
  * `create_ws_auth_guard` on `on_audit_event` or to broadcast.
29
+ *
30
+ * @mutates options.app - applies origin/auth/role middleware via `app.use`,
31
+ * then registers the `GET path` route via the inner `register_action_ws`
29
32
  */
30
33
  export const register_ws_endpoint = (options) => {
31
34
  const { app, path, allowed_origins, required_role, log = new Logger('[ws]'), ...rest } = options;
@@ -35,18 +35,26 @@ export declare class RequestTracker {
35
35
  * Track a new request with the given id.
36
36
  * @param id - the request id
37
37
  * @returns a deferred promise that will be resolved when the response is received
38
+ * @mutates this - inserts a `RequestTrackerItem` into `pending_requests`
39
+ * and arms a timeout that auto-rejects after `request_timeout_ms`;
40
+ * clears any prior timeout for the same id
38
41
  */
39
42
  track_request(id: JsonrpcRequestId): Deferred<JsonrpcResponseOrError>;
40
43
  /**
41
44
  * Resolve a pending request with the given response data.
42
45
  * @param id - the request id
43
46
  * @param response - the response data
47
+ * @mutates this - clears the timeout, marks status `'success'`,
48
+ * resolves the deferred, and removes the entry from `pending_requests`
44
49
  */
45
50
  resolve_request(id: JsonrpcRequestId, response: JsonrpcResponseOrError): void;
46
51
  /**
47
52
  * Rejects a pending request with the given error.
48
53
  * @param id - the request id
49
54
  * @param error_message - the complete `JsonrpcErrorResponse` object
55
+ * @mutates this - clears the timeout, marks status `'failure'`,
56
+ * rejects the deferred with a `ThrownJsonrpcError`, and removes the
57
+ * entry from `pending_requests`
50
58
  */
51
59
  reject_request(id: JsonrpcRequestId, error_message: JsonrpcErrorResponse): void;
52
60
  /**
@@ -55,13 +63,18 @@ export declare class RequestTracker {
55
63
  */
56
64
  handle_message(message: any): void;
57
65
  /**
58
- * Cancel a pending request.
66
+ * Cancel a pending request without rejecting its deferred — just
67
+ * cleanup. The caller's promise stays unsettled; pair with an external
68
+ * resolution if needed.
59
69
  * @param id - the request id
70
+ * @mutates this - clears the timeout and removes the entry from `pending_requests`
60
71
  */
61
72
  cancel_request(id: JsonrpcRequestId): void;
62
73
  /**
63
74
  * Cancel all pending requests.
64
75
  * @param reason - optional reason to include in rejection
76
+ * @mutates this - clears every timeout, marks each status `'failure'`,
77
+ * rejects each deferred with `internal_error`, and empties `pending_requests`
65
78
  */
66
79
  cancel_all_requests(reason?: string): void;
67
80
  }