@fuzdev/fuz_app 0.168.1 → 0.170.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 (239) hide show
  1. package/dist/actions/CLAUDE.md +17 -19
  2. package/dist/actions/action_codegen.d.ts +32 -23
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +101 -80
  5. package/dist/actions/action_event.d.ts +0 -8
  6. package/dist/actions/action_event.d.ts.map +1 -1
  7. package/dist/actions/action_event.js +7 -6
  8. package/dist/actions/action_event_data.d.ts +18 -18
  9. package/dist/actions/action_rpc.d.ts +1 -1
  10. package/dist/actions/action_rpc.js +1 -1
  11. package/dist/actions/action_spec.d.ts +8 -10
  12. package/dist/actions/action_spec.d.ts.map +1 -1
  13. package/dist/actions/action_spec.js +1 -1
  14. package/dist/actions/action_types.d.ts +4 -4
  15. package/dist/actions/action_types.d.ts.map +1 -1
  16. package/dist/actions/action_types.js +2 -2
  17. package/dist/actions/broadcast_api.d.ts +2 -2
  18. package/dist/actions/broadcast_api.js +4 -4
  19. package/dist/actions/compile_action_registry.d.ts +6 -7
  20. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  21. package/dist/actions/compile_action_registry.js +8 -9
  22. package/dist/actions/perform_action.d.ts +6 -6
  23. package/dist/actions/perform_action.d.ts.map +1 -1
  24. package/dist/actions/perform_action.js +11 -10
  25. package/dist/actions/socket.svelte.d.ts +1 -1
  26. package/dist/actions/socket.svelte.js +2 -2
  27. package/dist/auth/CLAUDE.md +11 -11
  28. package/dist/auth/account_action_specs.d.ts +11 -11
  29. package/dist/auth/account_action_specs.js +1 -1
  30. package/dist/auth/account_route_schema.d.ts +18 -18
  31. package/dist/auth/account_route_schema.js +1 -1
  32. package/dist/auth/account_routes.js +1 -1
  33. package/dist/auth/account_schema.d.ts +38 -40
  34. package/dist/auth/account_schema.d.ts.map +1 -1
  35. package/dist/auth/account_schema.js +7 -8
  36. package/dist/auth/actor_lookup_action_specs.d.ts +7 -7
  37. package/dist/auth/actor_lookup_action_specs.js +1 -1
  38. package/dist/auth/actor_search_action_specs.d.ts +6 -6
  39. package/dist/auth/actor_search_action_specs.js +1 -1
  40. package/dist/auth/admin_action_specs.d.ts +166 -166
  41. package/dist/auth/admin_action_specs.js +1 -1
  42. package/dist/auth/app_settings_schema.d.ts +3 -3
  43. package/dist/auth/app_settings_schema.d.ts.map +1 -1
  44. package/dist/auth/app_settings_schema.js +1 -1
  45. package/dist/auth/audit_emitter.d.ts +6 -7
  46. package/dist/auth/audit_emitter.d.ts.map +1 -1
  47. package/dist/auth/audit_emitter.js +11 -22
  48. package/dist/auth/audit_log_ddl.d.ts +1 -1
  49. package/dist/auth/audit_log_ddl.js +1 -1
  50. package/dist/auth/audit_log_queries.d.ts +0 -13
  51. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  52. package/dist/auth/audit_log_queries.js +3 -3
  53. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  54. package/dist/auth/audit_log_route_schema.js +1 -1
  55. package/dist/auth/audit_log_schema.d.ts +69 -70
  56. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  57. package/dist/auth/audit_log_schema.js +2 -2
  58. package/dist/auth/auth_ddl.d.ts +1 -1
  59. package/dist/auth/auth_ddl.js +1 -1
  60. package/dist/auth/bootstrap_route_schema.d.ts +4 -4
  61. package/dist/auth/bootstrap_route_schema.js +1 -1
  62. package/dist/auth/cell_action_specs.d.ts +466 -466
  63. package/dist/auth/cell_action_specs.js +1 -1
  64. package/dist/auth/cell_actions.d.ts +2 -2
  65. package/dist/auth/cell_actions.js +5 -5
  66. package/dist/auth/cell_audit_action_specs.d.ts +14 -14
  67. package/dist/auth/cell_audit_action_specs.js +1 -1
  68. package/dist/auth/cell_audit_metadata.d.ts +8 -8
  69. package/dist/auth/cell_audit_metadata.js +1 -1
  70. package/dist/auth/cell_field_action_specs.d.ts +55 -55
  71. package/dist/auth/cell_field_action_specs.js +1 -1
  72. package/dist/auth/cell_field_audit_metadata.d.ts +4 -4
  73. package/dist/auth/cell_field_audit_metadata.js +1 -1
  74. package/dist/auth/cell_grant_action_specs.d.ts +61 -61
  75. package/dist/auth/cell_grant_action_specs.js +1 -1
  76. package/dist/auth/cell_grant_audit_metadata.d.ts +10 -10
  77. package/dist/auth/cell_grant_audit_metadata.js +1 -1
  78. package/dist/auth/cell_item_action_specs.d.ts +76 -76
  79. package/dist/auth/cell_item_action_specs.js +1 -1
  80. package/dist/auth/cell_item_audit_metadata.d.ts +5 -5
  81. package/dist/auth/cell_item_audit_metadata.js +1 -1
  82. package/dist/auth/invite_schema.d.ts +11 -11
  83. package/dist/auth/invite_schema.d.ts.map +1 -1
  84. package/dist/auth/invite_schema.js +1 -1
  85. package/dist/auth/name_schema.js +1 -1
  86. package/dist/auth/password.js +1 -1
  87. package/dist/auth/request_context.js +2 -2
  88. package/dist/auth/role_grant_offer_action_specs.d.ts +182 -182
  89. package/dist/auth/role_grant_offer_action_specs.js +1 -1
  90. package/dist/auth/role_grant_offer_ddl.d.ts +1 -1
  91. package/dist/auth/role_grant_offer_ddl.js +1 -1
  92. package/dist/auth/role_grant_offer_notifications.d.ts +107 -107
  93. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  94. package/dist/auth/role_grant_offer_notifications.js +3 -4
  95. package/dist/auth/role_grant_offer_schema.d.ts +9 -9
  96. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
  97. package/dist/auth/role_grant_offer_schema.js +1 -1
  98. package/dist/auth/self_service_role_action_specs.d.ts +2 -2
  99. package/dist/auth/self_service_role_action_specs.js +1 -1
  100. package/dist/auth/self_service_role_actions.d.ts +1 -1
  101. package/dist/auth/self_service_role_actions.js +1 -1
  102. package/dist/auth/signup_route_schema.d.ts +2 -2
  103. package/dist/auth/signup_route_schema.js +1 -1
  104. package/dist/auth/token_scope.d.ts +8 -8
  105. package/dist/db/file_fact_url.d.ts +1 -1
  106. package/dist/env/env_schemas.d.ts +1 -2
  107. package/dist/env/env_schemas.d.ts.map +1 -1
  108. package/dist/env/env_schemas.js +3 -4
  109. package/dist/http/CLAUDE.md +30 -32
  110. package/dist/http/auth_shape.d.ts +17 -52
  111. package/dist/http/auth_shape.d.ts.map +1 -1
  112. package/dist/http/auth_shape.js +19 -61
  113. package/dist/http/db_routes.d.ts +1 -1
  114. package/dist/http/db_routes.d.ts.map +1 -1
  115. package/dist/http/db_routes.js +1 -1
  116. package/dist/http/error_schemas.d.ts +36 -36
  117. package/dist/http/jsonrpc.d.ts +11 -11
  118. package/dist/http/jsonrpc_helpers.js +1 -1
  119. package/dist/http/route_error_check.d.ts +2 -2
  120. package/dist/http/route_error_check.d.ts.map +1 -1
  121. package/dist/http/route_error_check.js +2 -3
  122. package/dist/http/route_errors.d.ts +4 -4
  123. package/dist/http/route_errors.d.ts.map +1 -1
  124. package/dist/http/route_errors.js +0 -13
  125. package/dist/http/route_spec.d.ts +33 -36
  126. package/dist/http/route_spec.d.ts.map +1 -1
  127. package/dist/http/route_spec.js +21 -22
  128. package/dist/http/schema_helpers.d.ts +75 -67
  129. package/dist/http/schema_helpers.d.ts.map +1 -1
  130. package/dist/http/schema_helpers.js +54 -76
  131. package/dist/http/surface.d.ts.map +1 -1
  132. package/dist/http/surface.js +6 -8
  133. package/dist/primitive_schemas.d.ts +162 -112
  134. package/dist/primitive_schemas.d.ts.map +1 -1
  135. package/dist/primitive_schemas.js +129 -161
  136. package/dist/realtime/sse.d.ts +3 -3
  137. package/dist/realtime/sse.d.ts.map +1 -1
  138. package/dist/realtime/sse.js +2 -2
  139. package/dist/schema_issues.d.ts +41 -146
  140. package/dist/schema_issues.d.ts.map +1 -1
  141. package/dist/schema_issues.js +39 -322
  142. package/dist/schema_meta.d.ts +63 -136
  143. package/dist/schema_meta.d.ts.map +1 -1
  144. package/dist/schema_meta.js +37 -184
  145. package/dist/sensitivity.d.ts +3 -5
  146. package/dist/sensitivity.d.ts.map +1 -1
  147. package/dist/sensitivity.js +3 -5
  148. package/dist/server/serve_fact_route.js +1 -1
  149. package/dist/server/surface_route.js +1 -1
  150. package/dist/testing/CLAUDE.md +23 -25
  151. package/dist/testing/adversarial_headers.js +2 -2
  152. package/dist/testing/adversarial_input_cases.d.ts +19 -18
  153. package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
  154. package/dist/testing/adversarial_input_cases.js +29 -42
  155. package/dist/testing/assertions.d.ts +2 -2
  156. package/dist/testing/assertions.d.ts.map +1 -1
  157. package/dist/testing/assertions.js +3 -3
  158. package/dist/testing/cross_backend/account_lifecycle.js +2 -2
  159. package/dist/testing/cross_backend/action_manifest.d.ts +10 -9
  160. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  161. package/dist/testing/cross_backend/action_manifest.js +4 -3
  162. package/dist/testing/cross_backend/cell_crud.js +1 -1
  163. package/dist/testing/cross_backend/conformance_case.d.ts +96 -114
  164. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  165. package/dist/testing/cross_backend/conformance_case.js +0 -256
  166. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts +0 -62
  167. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts.map +1 -1
  168. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  169. package/dist/testing/cross_backend/conformance_table.js +3 -3
  170. package/dist/testing/cross_backend/cross_rpc.d.ts +3 -4
  171. package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
  172. package/dist/testing/cross_backend/cross_rpc.js +4 -4
  173. package/dist/testing/cross_backend/differential.js +2 -2
  174. package/dist/testing/cross_backend/fact_serving.js +1 -1
  175. package/dist/testing/cross_backend/identity_parity.js +9 -9
  176. package/dist/testing/cross_backend/origin_conformance.d.ts +9 -9
  177. package/dist/testing/cross_backend/query_shape.js +1 -1
  178. package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
  179. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
  180. package/dist/testing/cross_backend/setup.d.ts +26 -4
  181. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  182. package/dist/testing/cross_backend/setup.js +7 -8
  183. package/dist/testing/cross_backend/sse_round_trip.js +2 -2
  184. package/dist/testing/cross_backend/testing_origin_check.d.ts +12 -12
  185. package/dist/testing/cross_backend/testing_reset_actions.d.ts +608 -201
  186. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  187. package/dist/testing/cross_backend/testing_reset_actions.js +46 -55
  188. package/dist/testing/cross_backend/token_lifetime.js +3 -3
  189. package/dist/testing/cross_backend/wire_shapes.js +1 -1
  190. package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
  191. package/dist/testing/cross_backend/ws_outbound_overflow.js +35 -0
  192. package/dist/testing/cross_backend/ws_round_trip.js +1 -1
  193. package/dist/testing/data_exposure.d.ts.map +1 -1
  194. package/dist/testing/data_exposure.js +1 -1
  195. package/dist/testing/integration.js +2 -2
  196. package/dist/testing/integration_helpers.d.ts.map +1 -1
  197. package/dist/testing/integration_helpers.js +2 -2
  198. package/dist/testing/middleware.d.ts.map +1 -1
  199. package/dist/testing/middleware.js +2 -2
  200. package/dist/testing/rpc_attack_surface.js +1 -1
  201. package/dist/testing/rpc_envelope_cases.d.ts +3 -3
  202. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  203. package/dist/testing/rpc_envelope_cases.js +1 -1
  204. package/dist/testing/rpc_helpers.d.ts +12 -14
  205. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  206. package/dist/testing/rpc_helpers.js +9 -11
  207. package/dist/testing/schema_generators.d.ts +67 -60
  208. package/dist/testing/schema_generators.d.ts.map +1 -1
  209. package/dist/testing/schema_generators.js +144 -151
  210. package/dist/testing/schema_introspect.d.ts +438 -78
  211. package/dist/testing/schema_introspect.d.ts.map +1 -1
  212. package/dist/testing/schema_introspect.js +26 -26
  213. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  214. package/dist/testing/sse_round_trip.js +2 -2
  215. package/dist/testing/surface_invariants.d.ts +1 -1
  216. package/dist/testing/surface_invariants.js +1 -1
  217. package/dist/testing/transports/bootstrap.d.ts +1 -1
  218. package/dist/testing/transports/bootstrap.d.ts.map +1 -1
  219. package/dist/testing/transports/bootstrap.js +1 -1
  220. package/dist/ui/BootstrapForm.svelte +1 -2
  221. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  222. package/dist/ui/SignupForm.svelte +1 -2
  223. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  224. package/dist/ui/admin_accounts_state.svelte.d.ts +5 -5
  225. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  226. package/dist/ui/admin_invites_state.svelte.d.ts +1 -1
  227. package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
  228. package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
  229. package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
  230. package/dist/ui/form_state.svelte.d.ts +1 -1
  231. package/dist/ui/form_state.svelte.js +1 -1
  232. package/dist/ui/role_grant_offers_state.svelte.d.ts +1 -1
  233. package/package.json +7 -9
  234. package/dist/primitive_schemas_fuz.d.ts +0 -178
  235. package/dist/primitive_schemas_fuz.d.ts.map +0 -1
  236. package/dist/primitive_schemas_fuz.js +0 -149
  237. package/dist/zod.d.ts +0 -101
  238. package/dist/zod.d.ts.map +0 -1
  239. package/dist/zod.js +0 -195
@@ -17,9 +17,8 @@ ordering see the root ../../../CLAUDE.md §Action Spec System (SAES) and
17
17
  to the code. This file documents the cross-cutting invariants and the
18
18
  shapes that span multiple files.
19
19
 
20
- Every exported Zod schema is paired with a same-named `z.infer` type export
21
- — ecosystem-wide rule (Skill(fuz-stack) §Zod schemas). New schemas keep
22
- the pair invariant.
20
+ Every exported schema is a `@fuzdev/fuz_schema` schema paired with a
21
+ same-named `Infer` type export. New schemas keep the pair invariant.
23
22
 
24
23
  ## Action specs (`actions/action_spec.ts`)
25
24
 
@@ -27,14 +26,14 @@ Canonical source of truth. Specs are plain objects typed by TS interfaces
27
26
  (`ActionSpec` and its three kinds, `ActionSpecUnion`), written with
28
27
  `satisfies` so their literals survive; nothing parses a spec at runtime, so
29
28
  every required field is spelled — no defaults. `input` / `output` are a
30
- `ValidationSchema`, Zod or `@fuzdev/fuz_schema`. `ActionKind`,
29
+ `@fuzdev/fuz_schema` schema (`AnySchema`). `ActionKind`,
31
30
  `ActionInitiator` and `ActionEventPhase` are fuz_schema `one_of`s
32
31
  (`ActionEventData` validates with them), built from the const lists `ACTION_KINDS`,
33
32
  `ACTION_INITIATORS` and `ACTION_EVENT_PHASES`; `is_action_spec` reads
34
33
  `ACTION_KINDS`. Three concrete kinds discriminate on `kind`:
35
34
 
36
35
  - `request_response` — `auth: RouteAuth` (non-null), `side_effects` arbitrary, `output` arbitrary, `async: true`.
37
- - `remote_notification` — `auth: null`, `side_effects: true`, `output` a void schema (`z.ZodVoid` or fuz_schema's `s.void`), `async: true`.
36
+ - `remote_notification` — `auth: null`, `side_effects: true`, `output` fuz_schema's void schema, `s.void`, `async: true`.
38
37
  - `local_call` — `auth: null`, `side_effects` arbitrary, `output` arbitrary, `async` boolean.
39
38
 
40
39
  `RouteAuth` is the flat record
@@ -88,12 +87,12 @@ non-`remote_notification` kind.
88
87
  `create_rpc_endpoint` and `register_action_ws`. Validates these checks in
89
88
  order and returns the `Map<method, RpcAction>` the dispatchers use:
90
89
 
91
- - **Schema slots** — `input` and `output` each hold a Zod or a fuz_schema schema (via `assert_validation_schema`, `schema_issues.ts`), on every spec; a value of neither library throws naming the action and the slot.
90
+ - **Schema slots** — `input` and `output` each hold a fuz_schema schema (via `assert_validation_schema`, `schema_issues.ts`), on every spec; a value that is no schema throws naming the action and the slot.
92
91
  - **Auth-shape cross-axis invariants** — roles imply a required actor, no accountless actor, nothing to gate on unrestricted auth (via `assert_route_auth_invariants`).
93
92
  - **Auth-shape biconditional** — `actor !== 'none' ⟺ input declares acting?: ActingActor` (via `assert_route_auth_acting_biconditional`).
94
93
  - **No `auth.required_scope`** — the slot is route-spec-only; nothing mounts a guard from it on an action, so declaring it would be a control that silently does nothing. Narrowed tokens are gated per method by the scope check in `perform_action`, which derives the `rpc:<method>` capability from `spec.method` rather than trusting a hand-written one.
95
94
  - **Rate-limit account axis** — `rate_limit: 'account' | 'both'` requires `auth.account === 'required'`.
96
- - **JSON-RPC §4.2 wire validity** — `request_response` specs with a handler may not use a null schema (`z.null()`, fuz_schema `literal(null)`) for input (use a void schema, `z.void()` or fuz_schema `s.void`, for nullary), nor a void schema for output (a response always carries a `result`, which clients validate against `spec.output`; use a null schema when there's nothing to return). Both are detected by shape (`is_null_schema` / `is_void_schema`), so a `meta` copy counts.
95
+ - **JSON-RPC §4.2 wire validity** — `request_response` specs with a handler may not use a null schema (`literal(null)`) for input (use a void schema, `s.void`, for nullary), nor a void schema for output (a response always carries a `result`, which clients validate against `spec.output`; use a null schema when there's nothing to return). Both are detected by shape (`is_null_schema` / `is_void_schema`), so a `meta` copy counts.
97
96
  - **Unique method names** across the array.
98
97
 
99
98
  Only `request_response` specs with a handler reach the dispatch map;
@@ -138,11 +137,11 @@ and options on each function's TSDoc.
138
137
  - `get_executor_phases(spec, executor)` — phases an executor participates in for the spec.
139
138
  - `get_handler_return_type` — TS type a phase handler must return; side-effect imports `ActionOutputs`.
140
139
  - `generate_phase_handlers` — per-action typed handler-map fragment.
141
- - `generate_frontend_actions_api` — typed `FrontendActionsApi` interface. A void or null input of either library (`is_void_schema`, `is_null_schema`) emits `input?: void`; otherwise each method's `input?:` follows `action_input_is_optional` (parsed with `parse_any`) — the schema accepts `undefined`, or accepts `{}` and is not marked `.meta({empty_input_handler_guarded: true})` (`SchemaFieldMeta`, read by `is_empty_input_handler_guarded` in `schema_meta.ts` — set on `cell_get`, `cell_field_list` and `cell_item_list`, whose `{}` reaches a handler guard that refuses it with a declared reason, so their input stays required; a consumer marks its own the same way); an input-shape invariant test reads the same rule.
142
- - `generate_action_method_enums` — up to nine `z.enum` + `z.infer` pairs.
140
+ - `generate_frontend_actions_api` — typed `FrontendActionsApi` interface. A void or null input (`is_void_schema`, `is_null_schema`) emits `input?: void`; otherwise each method's `input?:` follows `action_input_is_optional` (by `parse`) — the schema accepts `undefined`, or accepts `{}` and is not marked `meta(…, {empty_input_handler_guarded: true})` (read by `is_empty_input_handler_guarded` in `schema_meta.ts` — set on `cell_get`, `cell_field_list` and `cell_item_list`, whose `{}` reaches a handler guard that refuses it with a declared reason, so their input stays required; a consumer marks its own the same way); an input-shape invariant test reads the same rule. Each input is typed `ActionCallInputs[method]`, the schema's input type — what a caller passes before the parse, so a `with_default` field is optional at the call.
141
+ - `generate_action_method_enums` — up to nine `@fuzdev/fuz_schema` `one_of` + `Infer` pairs, importing `{one_of, type Infer}` from `@fuzdev/fuz_schema/schema.ts`; a const's `def` is its method array.
143
142
  - `generate_typed_action_event_alias` — fixed-shape `TypedActionEvent<TMethod, TPhase, TStep>` alias.
144
143
  - `generate_action_specs_record` — `ActionSpecs` runtime const + type + `action_specs` array. The const is annotated with the type (`readonly` members), so a consumer's declaration emit names the type instead of writing every spec's schema types out, which past enough specs is TS7056. The type is an alias, not an interface: an alias has an implicit index signature, so `Object.values(ActionSpecs)` stays typed and `action_specs` checks each spec against `ActionSpecUnion` (over an interface it is `any[]`).
145
- - `generate_action_inputs_outputs` — `ActionInputs` + `ActionOutputs` runtime consts + interfaces, each schema typed as its output: `z.infer<typeof …>` for a Zod schema, fuz_schema's `Infer<typeof …>` for a `@fuzdev/fuz_schema` one, importing `z` and `Infer` only when a schema of that library is present; a schema of neither throws naming the method.
144
+ - `generate_action_inputs_outputs` — `ActionInputs` + `ActionOutputs` runtime consts + interfaces, plus the `ActionCallInputs` interface, importing `Infer` and `InferInput`; a value that is no schema throws naming the method. The two sides of a call see one input schema differently, so its types split by side: `ActionInputs` is each input's output type (`Infer<typeof …>`) — the parsed value a handler, an action event (`ActionEventDatas`) or a notification receiver reads, defaults filled and transforms applied; `ActionCallInputs` is its input type (`InferInput<typeof …>`) — what a caller passes, which the call surfaces (`FrontendActionsApi`, `BackendActionsApi`) take, so a `with_default` field is optional there and required in `ActionInputs`. `ActionOutputs` is each output's output type, what a caller receives.
146
145
  - `generate_action_event_datas` — `ActionEventDatas` interface; per-spec variants.
147
146
  - `generate_frontend_action_handlers` — `FrontendActionHandlers` interface (Tier 2 only).
148
147
  - `generate_backend_actions_api` — `BackendActionsApi` interface + `broadcast_action_specs` array.
@@ -260,9 +259,8 @@ interface RpcAction {
260
259
  ### `rpc_action(spec, handler)` — typed binder
261
260
 
262
261
  `rpc_action<TSpec extends RequestResponseActionSpec>(spec, handler)` pins
263
- the handler's input / output types to `ValidationOutput<TSpec['input']>` /
264
- `ValidationOutput<TSpec['output']>` (`schema_issues.ts`: fuz_schema's `Infer`
265
- or Zod's `z.output`, per spec) and tightens `ctx.auth` per the conditional
262
+ the handler's input / output types to `Infer<TSpec['input']>` /
263
+ `Infer<TSpec['output']>` and tightens `ctx.auth` per the conditional
266
264
  `HandlerForSpec<TSpec>`:
267
265
 
268
266
  - `auth.actor === 'required'` → `ctx.auth: RequestActorContext`.
@@ -294,7 +292,7 @@ Pipeline (401 → authz → 403 → 429 → 400 → handler):
294
292
  2. Authorization phase — `apply_authorization_phase` against `account_id` + `read_acting(auth, raw_params)`, which takes the selector off the raw params (malformed reads as omitted) since validation runs later. Test escape hatch via `preset.request_context`
295
293
  3. Post-authorization auth (403) — credential-type gate, then token scope, then role
296
294
  4. Rate limit (429) — throttle-requests semantics, ahead of validation so malformed params charge the budget and a throttled caller pays no schema work
297
- 5. Validate params (400) — first, object params holding an own `__proto__` key at any depth are refused on every input with `data.reason` `params_proto_key` (`json_has_own_proto_key` in `http/schema_helpers.ts`, an iterative walk; `ERROR_PARAMS_PROTO_KEY`; the Rust twin walks after its params-shape check, so a non-object `params` stays the schema's reasonless refusal); then `spec.input` parses them (`parse_any`, `schema_issues.ts` — a Zod or fuz_schema schema) with void / `?? {}` rules; a void input (`is_void_schema`: `z.void()` or fuz_schema `s.void`) reads absent, `null` (GET `?params=null`), and `{}` alike as the no-arg call (`to_input_params` in `http/schema_helpers.ts`, via `to_void_params`, the twin of the Rust `require_void_params`; the peer receive path in `ActionDispatcher` runs the same normalizer) and refuses any other shape. A refusal is `to_invalid_params_error`: the generic `invalid params`, `data.reason` when the first issue's field declares an `invalid_reason` in its `.meta()` and no issue sits on the input itself, such as an unknown key (`resolve_issues_invalid_reason`, `schema_meta.ts` — see ../../../docs/architecture.md §Error Schema System), and the issues DEV-only, as `WireIssue`s (`to_wire_issues`)
295
+ 5. Validate params (400) — first, object params holding an own `__proto__` key at any depth are refused on every input with `data.reason` `params_proto_key` (`json_has_own_proto_key` in `http/schema_helpers.ts`, an iterative walk; `ERROR_PARAMS_PROTO_KEY`; the Rust twin walks after its params-shape check, so a non-object `params` stays the schema's reasonless refusal); then `spec.input` parses them (`parse`) with void / `?? {}` rules; a void input (`is_void_schema`: `s.void`) reads absent, `null` (GET `?params=null`), and `{}` alike as the no-arg call (`to_input_params` in `http/schema_helpers.ts`, via `to_void_params`, the twin of the Rust `require_void_params`; the peer receive path in `ActionDispatcher` runs the same normalizer) and refuses any other shape. A refusal is `to_invalid_params_error`: the generic `invalid params`, `data.reason` when the first issue's field declares an `invalid_reason` in its `meta` and no issue sits on the input itself, such as an unknown key (`resolve_issues_invalid_reason`, `schema_meta.ts` — see ../../../docs/architecture.md §Error Schema System), and the issues DEV-only, as `WireIssue`s (`to_wire_issues`)
298
296
  6. Dispatch + DEV output validation + error normalization — `spec.side_effects` picks transaction vs pool. `ThrownJsonrpcError` preserves code + data; generic throws become `internal_error`
299
297
 
300
298
  `PerformActionInput` carries `auth` (the request's `ResolvedAuth`, `null` for
@@ -320,7 +318,7 @@ validation and produces the **same failure mode** as REST routes'
320
318
  `wrap_output_validation` (`http/route_spec.ts`) — log an error, return
321
319
  the response unchanged, do not throw, do not mutate status.
322
320
 
323
- - HTTP RPC + WebSocket dispatch — `actions/perform_action.ts` `if (DEV) spec.output.safeParse(output)` inside the shared dispatch core. Production hot path short-circuits (no parse).
321
+ - HTTP RPC + WebSocket dispatch — `actions/perform_action.ts` `if (DEV) parse(spec.output, output)` inside the shared dispatch core. Production hot path short-circuits (no parse).
324
322
 
325
323
  Caller-facing `input` schemas are validated **always** (DEV + production)
326
324
  — they're the contract with external callers. Server-authored `output`
@@ -1091,7 +1089,7 @@ high-level shapes that span modules:
1091
1089
  - **Discriminated union** — `ActionEventDataUnion<TMethod, TInput, TOutput>` across `kind` + `phase` + `step`, a variant per lifecycle point of each kind. Narrows `input` / `output` / `error` / `request` / `response` / `notification` / `progress` at each lifecycle point.
1092
1090
  - **Step transitions** — `initial → parsed | failed`, `parsed → handling | failed`, `handling → handled | failed`, `handled`/`failed` terminal. `validate_step_transition(from, to)` throws on illegal moves.
1093
1091
  - **Phase transitions** — chained: `send_request → receive_response`, `receive_request → send_response`; everything else terminal. `validate_phase_transition` enforces.
1094
- - **`ActionEvent.parse()`** — `initial → parsed` via `parse_any(spec.input, …)`. Input validation failures **fail immediately** without routing through an error phase (client-side programming errors, not runtime conditions with handlers); their `invalid_params` `data` is `{validation_errors, reason?}`, `reason` the declared `invalid_reason` the server would answer. Handler errors DO route through `send_error` / `receive_error`. On `receive_response` with error response, transitions to `receive_error` instead of failing; a success response's `result` is validated against `spec.output` (always, not DEV-only — it's inbound data; undeclared keys are dropped rather than refused, so an older client survives an added response field) and `output` becomes the parsed value, or the event moves to `receive_error` with an `internal_error` carrying `data: {reason: ERROR_RESPONSE_OUTPUT_INVALID, validation_errors}` — a remote contract break, deliberately distinct from the `invalid_params` / `validation_error` of bad caller input.
1092
+ - **`ActionEvent.parse()`** — `initial → parsed` via `parse(spec.input, …)`. Input validation failures **fail immediately** without routing through an error phase (client-side programming errors, not runtime conditions with handlers); their `invalid_params` `data` is `{validation_errors, reason?}`, `reason` the declared `invalid_reason` the server would answer. Handler errors DO route through `send_error` / `receive_error`. On `receive_response` with error response, transitions to `receive_error` instead of failing; a success response's `result` is validated against `spec.output` (always, not DEV-only — it's inbound data; undeclared keys are dropped rather than refused, so an older client survives an added response field) and `output` becomes the parsed value, or the event moves to `receive_error` with an `internal_error` carrying `data: {reason: ERROR_RESPONSE_OUTPUT_INVALID, validation_errors}` — a remote contract break, deliberately distinct from the `invalid_params` / `validation_error` of bad caller input.
1095
1093
  - **Handler throws** — `ThrownJsonrpcError` keeps code/message/data; any other throw becomes `internal_error` carrying the thrown message. When the error answers a remote caller (`receive_request` / `send_response`), the raw message goes through `dev_only` like the server dispatch core.
1096
1094
  - **Protocol message creation is automatic** — transitioning `parsed → handling` on `send_request` materializes the outgoing `JsonrpcRequest` with a fresh `create_uuid()` id; on `send` (notification) it materializes the `JsonrpcNotification`.
1097
1095
 
@@ -1105,7 +1103,7 @@ methods) go to `environment.log`; unset falls back to `console_action_log`
1105
1103
  (warn/error to `console`, debug dropped) so failures are never silent, and
1106
1104
  `log: null` opts out (`resolve_action_log`). An inbound request or notification
1107
1105
  reads its params through the server dispatch core's normalizer
1108
- (`to_input_params`): for a void input (`z.void()` or fuz_schema `s.void`),
1106
+ (`to_input_params`): for a void input (`s.void`),
1109
1107
  absent, `null`, and `{}` alike are the no-arg call; for any other input,
1110
1108
  absent or `null` params are `{}` (so an all-optional object input accepts a
1111
1109
  call that omits them).
@@ -1258,8 +1256,8 @@ specs. Counterpart to `register_action_ws`: that handles frontend-initiated
1258
1256
  request-scoped dispatch, this handles backend-initiated broadcast.
1259
1257
  Request-scoped streaming stays on `ctx.notify` inside a handler.
1260
1258
 
1261
- Per-method call: validates input against `spec.input`, Zod or fuz_schema
1262
- (`parse_any`; logs + returns on failure), wraps in `JsonrpcNotification`, and sends it on `registry` — a
1259
+ Per-method call: validates input against `spec.input`
1260
+ (`parse`; logs + returns on failure), wraps in `JsonrpcNotification`, and sends it on `registry` — a
1263
1261
  `BroadcastTarget`, `Pick<ConnectionRegistry, 'broadcast' |
1264
1262
  'broadcast_filtered'>`, typically `app_server.ws_endpoints[path]` or the
1265
1263
  registry a `WsEndpointSpec` supplies. No `Transports` collection and no fallback:
@@ -120,33 +120,32 @@ export declare const generate_phase_handlers: (spec: ActionSpecUnion, executor:
120
120
  /**
121
121
  * Whether a caller may omit an action's input: its schema accepts `undefined`,
122
122
  * or accepts `{}` (what an omitted input is validated as) and is not marked
123
- * `empty_input_handler_guarded` (`SchemaFieldMeta`, read by
124
- * `is_empty_input_handler_guarded`). The rule codegen emits `input?:` by and
125
- * the input-shape invariant tests read. The input is a Zod or a
126
- * `@fuzdev/fuz_schema` schema, parsed with `parse_any`.
123
+ * `empty_input_handler_guarded` (read by `is_empty_input_handler_guarded`).
124
+ * The rule codegen emits `input?:` by and the input-shape invariant tests
125
+ * read, parsed with `parse`.
127
126
  *
128
127
  * @param spec - the action spec
129
128
  * @returns whether the typed surface makes the input optional
130
- * @throws Error when the input is neither a Zod nor a fuz_schema schema
131
129
  */
132
130
  export declare const action_input_is_optional: (spec: Pick<ActionSpecUnion, "input">) => boolean;
133
131
  /** Discriminator for `generate_action_method_enums` — which method-set enums to emit. */
134
132
  export type ActionMethodEnumKind = 'all' | 'request_response' | 'remote_notification' | 'local_call' | 'frontend' | 'backend' | 'frontend_handled' | 'backend_handled' | 'broadcast';
135
133
  /**
136
- * Emit one or more `z.enum([...])` declarations for action method names —
134
+ * Emit one or more `@fuzdev/fuz_schema` `one_of([...])` declarations for
135
+ * action method names —
137
136
  * `ActionMethod`, `RequestResponseActionMethod`, `RemoteNotificationActionMethod`,
138
137
  * `LocalCallActionMethod`, `FrontendActionMethod`, `BackendActionMethod`,
139
138
  * `FrontendRequestResponseMethod`, `BackendRequestResponseMethod`,
140
- * `BroadcastActionMethod`. Pairs each runtime const with a `z.infer` type
141
- * alias under the same identifier.
139
+ * `BroadcastActionMethod`. Pairs each runtime const with an `Infer` type
140
+ * alias under the same identifier. A const's `def` is its array of methods.
142
141
  *
143
142
  * Protocol-action methods (`heartbeat`, `cancel`) are filtered out by
144
143
  * default — pass `include_protocol_actions: true` if a consumer genuinely
145
- * wants them on their typed surface. Empty kinds are skipped so the helper
146
- * never emits `z.enum([])` (zod runtime-throws on that).
144
+ * wants them on their typed surface. Empty kinds are skipped, so every
145
+ * emitted const names at least one method.
147
146
  *
148
- * Adds `import {z} from 'zod';` to `imports` only when at least one block
149
- * is emitted (idempotent).
147
+ * Adds `import {one_of, type Infer} from '@fuzdev/fuz_schema/schema.ts';` to
148
+ * `imports` only when at least one block is emitted (idempotent).
150
149
  *
151
150
  * @param options.emit - subset of enums to emit; defaults to every kind
152
151
  * @param options.include_protocol_actions - when true, retains `heartbeat` /
@@ -199,22 +198,32 @@ export declare const generate_action_specs_record: (specs: ReadonlyArray<ActionS
199
198
  include_protocol_actions?: boolean;
200
199
  }) => string;
201
200
  /**
202
- * Emit `ActionInputs` + `ActionOutputs` runtime consts and matching interfaces.
203
- * The runtime consts reference `specs.{method}_action_spec.input` /
204
- * `.output`; the interfaces type each as its schema's output: `z.infer` for a
205
- * Zod schema, `Infer` for a `@fuzdev/fuz_schema` one.
201
+ * Emit `ActionInputs` + `ActionOutputs` runtime consts and matching
202
+ * interfaces, plus the `ActionCallInputs` interface. The runtime consts
203
+ * reference `specs.{method}_action_spec.input` / `.output`.
206
204
  *
207
- * Adds `import {z} from 'zod';` when any schema is Zod's,
208
- * `import type {Infer} from '@fuzdev/fuz_schema/schema.ts';` when any is
209
- * fuz_schema's, and the `* as specs` namespace import.
205
+ * The two sides of a call see different types for one input schema, so the
206
+ * interfaces split by side:
207
+ *
208
+ * - `ActionInputs` types each input as its schema's output (`Infer`) — the
209
+ * parsed value a handler, an action event, or a notification receiver reads,
210
+ * with defaults filled and transforms applied.
211
+ * - `ActionCallInputs` types each input as its schema's input (`InferInput`)
212
+ * — what a caller passes, before the parse: a `with_default` field is
213
+ * optional there and required in `ActionInputs`. The call surfaces
214
+ * (`FrontendActionsApi`, `BackendActionsApi`) read it.
215
+ * - `ActionOutputs` types each output as its schema's output, what a caller
216
+ * receives.
217
+ *
218
+ * Adds `import type {Infer, InferInput} from '@fuzdev/fuz_schema/schema.ts';`
219
+ * and the `* as specs` namespace import.
210
220
  *
211
221
  * @param options.qualify_spec - per-spec qualified identifier callback for
212
222
  * multi-source consumers. The helper appends `.input` / `.output` to the
213
223
  * callback's return value. When set, the helper skips the default
214
224
  * `* as specs` import — the consumer manages its own namespace imports —
215
225
  * and `specs_module` is ignored. Single-source consumers omit it.
216
- * @throws Error naming the method when an input or output is neither a Zod
217
- * nor a fuz_schema schema
226
+ * @throws Error naming the method when an input or output is no schema
218
227
  */
219
228
  export declare const generate_action_inputs_outputs: (specs: ReadonlyArray<ActionSpecUnion>, imports: ImportBuilder, options?: {
220
229
  specs_module?: string;
@@ -254,7 +263,7 @@ export declare const generate_action_event_datas: (specs: ReadonlyArray<ActionSp
254
263
  *
255
264
  * Imports are registered per emitted line — only what the spec set actually references shows up on
256
265
  * `imports`. A spec set with no async methods skips `RpcClientCallOptions`;
257
- * one with no inputs skips `ActionInputs`; sync `local_call` methods with
266
+ * one with no inputs skips `ActionCallInputs`; sync `local_call` methods with
258
267
  * `sync_returns_value: true` (the default) skip `Result` / `JsonrpcErrorObject`.
259
268
  *
260
269
  * The interface name is fixed at `FrontendActionsApi` — the symmetric counterpart
@@ -295,7 +304,7 @@ export declare const generate_frontend_action_handlers: (specs: ReadonlyArray<Ac
295
304
  * exclusion list.
296
305
  *
297
306
  * Adds the `* as specs` namespace import (from `specs_module`), the
298
- * `ActionInputs` type import (from `collections_path`), and the
307
+ * `ActionCallInputs` type import (from `collections_path`), and the
299
308
  * `ActionSpecUnion` type import.
300
309
  *
301
310
  * Method signature shape today is `(input) => Promise<void>` — matches the
@@ -1 +1 @@
1
- {"version":3,"file":"action_codegen.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_codegen.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG1E;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,+CAAgD,CAAC;AAErF,8FA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YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,CAAC;IACjD,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACnC,KACC,MA2CF,CAAC;AAMF;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,0BAA0B,GACtC,SAAS,aAAa,CAAC,UAAU,CAAC,EAClC,SAAS,aAAa,KACpB;IACF,YAAY,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,CAAC;IAChD,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CAiC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B,KAAG,MAYH,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { UnreachableError } from '@fuzdev/fuz_util/error.ts';
2
- import { is_schema } from '@fuzdev/fuz_schema/schema.ts';
2
+ import { parse } from '@fuzdev/fuz_schema/schema.ts';
3
3
  import { is_empty_input_handler_guarded } from '../schema_meta.js';
4
4
  import { is_null_schema, is_void_schema } from '../http/schema_helpers.js';
5
- import { assert_zod_schema, parse_any } from '../schema_issues.js';
5
+ import { assert_validation_schema } from '../schema_issues.js';
6
6
  import { ActionRegistry } from './action_registry.js';
7
7
  /**
8
8
  * Method names of fuz_app's protocol actions — `heartbeat` (auth-aware client
@@ -323,35 +323,29 @@ const to_action_property_key = (method) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(met
323
323
  /**
324
324
  * Whether a caller may omit an action's input: its schema accepts `undefined`,
325
325
  * or accepts `{}` (what an omitted input is validated as) and is not marked
326
- * `empty_input_handler_guarded` (`SchemaFieldMeta`, read by
327
- * `is_empty_input_handler_guarded`). The rule codegen emits `input?:` by and
328
- * the input-shape invariant tests read. The input is a Zod or a
329
- * `@fuzdev/fuz_schema` schema, parsed with `parse_any`.
326
+ * `empty_input_handler_guarded` (read by `is_empty_input_handler_guarded`).
327
+ * The rule codegen emits `input?:` by and the input-shape invariant tests
328
+ * read, parsed with `parse`.
330
329
  *
331
330
  * @param spec - the action spec
332
331
  * @returns whether the typed surface makes the input optional
333
- * @throws Error when the input is neither a Zod nor a fuz_schema schema
334
332
  */
335
333
  export const action_input_is_optional = (spec) => {
336
- if (parse_any(spec.input, undefined).ok)
334
+ if (parse(spec.input, undefined).ok)
337
335
  return true;
338
336
  if (is_empty_input_handler_guarded(spec.input))
339
337
  return false;
340
- return parse_any(spec.input, {}).ok;
338
+ return parse(spec.input, {}).ok;
341
339
  };
342
340
  /**
343
- * Which library a spec's input or output schema is of — the type it is
344
- * emitted as follows from it: `z.infer` for Zod, fuz_schema's `Infer` for
345
- * `@fuzdev/fuz_schema`, each the schema's output type.
341
+ * Throw unless a spec's input or output is a `@fuzdev/fuz_schema` schema,
342
+ * naming the method and the slot — codegen reads specs nothing has
343
+ * registered, so it checks them itself.
346
344
  *
347
- * @throws Error naming the method and the schema when it is of neither library
345
+ * @throws Error naming the method and the slot when it is no schema
348
346
  */
349
- const to_spec_schema_library = (spec, which) => {
350
- const schema = spec[which];
351
- if (is_schema(schema))
352
- return 'fuz_schema';
353
- assert_zod_schema(schema, `action '${spec.method}' ${which}`);
354
- return 'zod';
347
+ const assert_spec_schema = (spec, which) => {
348
+ assert_validation_schema(spec[which], `action '${spec.method}' ${which}`);
355
349
  };
356
350
  /**
357
351
  * Generates one method line of the typed `FrontendActionsApi` interface for a
@@ -370,8 +364,12 @@ const to_spec_schema_library = (spec, which) => {
370
364
  * failure). Earlier emit shapes declared notifications as `=> void` —
371
365
  * regenerate consumer typed clients to pick up the corrected return.
372
366
  *
367
+ * The input is typed by `ActionCallInputs` — the schema's input type, what
368
+ * the caller passes before the parse — so a defaulted field is optional at the
369
+ * call while the handler reads it filled in (`ActionInputs`).
370
+ *
373
371
  * Registers exactly the imports the emitted line references on `imports`:
374
- * `ActionInputs` (when the spec has input), `ActionOutputs` (always),
372
+ * `ActionCallInputs` (when the spec has input), `ActionOutputs` (always),
375
373
  * `RpcClientCallOptions` (async only), and `Result` + `JsonrpcErrorObject`
376
374
  * (any return shape that wraps the value in `Result<{value}, {error}>` —
377
375
  * every async method, plus sync `local_call` when `sync_returns_value:
@@ -381,46 +379,43 @@ const to_spec_schema_library = (spec, which) => {
381
379
  *
382
380
  * **Optional-input detection.** The emitted parameter is `input?:` (caller
383
381
  * may omit the argument) when either (a) the schema accepts `undefined` —
384
- * `z.optional(z.strictObject(...))` and similar wrappers — or (b) the
385
- * schema accepts the empty object `{}` — `z.strictObject({acting:
386
- * ActingActor})` and other all-optional-fields strict objects. The second
387
- * probe mirrors the dispatcher's HTTP convention (`raw_params ?? {}` for
388
- * non-`z.void()` schemas in `actions/action_rpc.ts` / `http/route_spec.ts`):
382
+ * `optional(object(...))` and similar wrappers — or (b) the schema accepts
383
+ * the empty object `{}` — `object({acting: ActingActor})` and other
384
+ * all-optional-fields strict objects. The second probe mirrors the
385
+ * dispatcher's HTTP convention (`raw_params ?? {}` for non-void schemas in `actions/action_rpc.ts` / `http/route_spec.ts`):
389
386
  * if a request with no params reaches the handler, this is the value the
390
387
  * schema is asked to validate. A schema with required fields fails both
391
- * probes and stays `input:` (required at the typed surface). Refinements
392
- * and transforms run as part of the parse (`parse_any`), so their accept/reject
388
+ * probes and stays `input:` (required at the typed surface). Checks and
389
+ * transforms run as part of the parse (`parse`), so their accept/reject
393
390
  * decisions feed into the optional/required choice naturally. An input
394
391
  * marked `empty_input_handler_guarded` is the exception: its schema accepts
395
392
  * `{}` but the handler refuses it, so it stays `input:`
396
393
  * (`action_input_is_optional` is the one rule).
397
394
  *
398
- * **No-input detection.** A void or null input — `z.void()`, `z.null()`, or
399
- * a `@fuzdev/fuz_schema` `literal(undefined)` (`s.void`) or `literal(null)`,
400
- * read by shape (`is_void_schema`, `is_null_schema`) — emits `input?: void`
401
- * and no `ActionInputs` import.
395
+ * **No-input detection.** A void or null input — `literal(undefined)`
396
+ * (`s.void`) or `literal(null)`, read by shape (`is_void_schema`, `is_null_schema`) — emits `input?: void`
397
+ * and no `ActionCallInputs` import.
402
398
  *
403
399
  * @param options.sync_returns_value - When true (default), sync `local_call`
404
400
  * methods return the output value directly; when false they're wrapped in
405
401
  * `Result<{value, error}>` like async methods. Set to `false` if your
406
402
  * `FrontendActionsApi` treats every method uniformly.
407
- * @param options.collections_path - Import path that `ActionInputs` /
403
+ * @param options.collections_path - Import path that `ActionCallInputs` /
408
404
  * `ActionOutputs` resolve to. Defaults to `'./action_collections.ts'`.
409
- * @returns one line like `foo: (input: ActionInputs['foo'], options?: RpcClientCallOptions) => Promise<Result<...>>;`
410
- * @throws Error naming the method when the input is neither a Zod nor a
411
- * fuz_schema schema
405
+ * @returns one line like `foo: (input: ActionCallInputs['foo'], options?: RpcClientCallOptions) => Promise<Result<...>>;`
406
+ * @throws Error naming the method when the input is no schema
412
407
  */
413
408
  const generate_actions_api_method_signature = (spec, imports, options) => {
414
409
  const sync_returns_value = options?.sync_returns_value ?? true;
415
410
  const collections_path = options?.collections_path ?? DEFAULT_COLLECTIONS_PATH;
416
- to_spec_schema_library(spec, 'input');
411
+ assert_spec_schema(spec, 'input');
417
412
  const has_input = !is_null_schema(spec.input) && !is_void_schema(spec.input);
418
413
  const input_optional = has_input && action_input_is_optional(spec);
419
414
  const input_param = has_input
420
- ? `input${input_optional ? '?' : ''}: ActionInputs['${spec.method}']`
415
+ ? `input${input_optional ? '?' : ''}: ActionCallInputs['${spec.method}']`
421
416
  : 'input?: void';
422
417
  if (has_input)
423
- imports.add_type(collections_path, 'ActionInputs');
418
+ imports.add_type(collections_path, 'ActionCallInputs');
424
419
  imports.add_type(collections_path, 'ActionOutputs');
425
420
  const is_async = spec.kind === 'request_response' || spec.kind === 'remote_notification' || spec.async;
426
421
  const options_param = is_async ? ', options?: RpcClientCallOptions' : '';
@@ -460,19 +455,20 @@ const generate_actions_api_method_signature = (spec, imports, options) => {
460
455
  // `create_namespace_qualifier` automates the source-table → qualifier wiring.
461
456
  // --------------------------------------------------------------------------
462
457
  /**
463
- * Format a `z.enum([...])` runtime const + matching `z.infer` type alias.
464
- * Caller is responsible for ensuring `methods` is non-empty (`z.enum([])` is
465
- * invalid) and registering the `zod` import on the `ImportBuilder`.
458
+ * Format a `@fuzdev/fuz_schema` `one_of([...])` runtime const + matching
459
+ * `Infer` type alias. Caller is responsible for ensuring `methods` is
460
+ * non-empty and registering the `one_of` and `Infer` imports on the
461
+ * `ImportBuilder`.
466
462
  */
467
463
  const format_method_enum_block = (name, jsdoc, methods) => {
468
464
  const lines = methods.map((m) => `\t'${m}',`).join('\n');
469
465
  return `/**
470
466
  * ${jsdoc}
471
467
  */
472
- export const ${name} = z.enum([
468
+ export const ${name} = one_of([
473
469
  ${lines}
474
470
  ]);
475
- export type ${name} = z.infer<typeof ${name}>;`;
471
+ export type ${name} = Infer<typeof ${name}>;`;
476
472
  };
477
473
  /** Default emit set — every enum kind. */
478
474
  const action_method_enum_kinds_all = new Set([
@@ -516,20 +512,21 @@ const resolve_spec_qualifier = (imports, options) => {
516
512
  return (s) => `specs.${to_action_spec_identifier(s.method)}`;
517
513
  };
518
514
  /**
519
- * Emit one or more `z.enum([...])` declarations for action method names —
515
+ * Emit one or more `@fuzdev/fuz_schema` `one_of([...])` declarations for
516
+ * action method names —
520
517
  * `ActionMethod`, `RequestResponseActionMethod`, `RemoteNotificationActionMethod`,
521
518
  * `LocalCallActionMethod`, `FrontendActionMethod`, `BackendActionMethod`,
522
519
  * `FrontendRequestResponseMethod`, `BackendRequestResponseMethod`,
523
- * `BroadcastActionMethod`. Pairs each runtime const with a `z.infer` type
524
- * alias under the same identifier.
520
+ * `BroadcastActionMethod`. Pairs each runtime const with an `Infer` type
521
+ * alias under the same identifier. A const's `def` is its array of methods.
525
522
  *
526
523
  * Protocol-action methods (`heartbeat`, `cancel`) are filtered out by
527
524
  * default — pass `include_protocol_actions: true` if a consumer genuinely
528
- * wants them on their typed surface. Empty kinds are skipped so the helper
529
- * never emits `z.enum([])` (zod runtime-throws on that).
525
+ * wants them on their typed surface. Empty kinds are skipped, so every
526
+ * emitted const names at least one method.
530
527
  *
531
- * Adds `import {z} from 'zod';` to `imports` only when at least one block
532
- * is emitted (idempotent).
528
+ * Adds `import {one_of, type Infer} from '@fuzdev/fuz_schema/schema.ts';` to
529
+ * `imports` only when at least one block is emitted (idempotent).
533
530
  *
534
531
  * @param options.emit - subset of enums to emit; defaults to every kind
535
532
  * @param options.include_protocol_actions - when true, retains `heartbeat` /
@@ -543,8 +540,9 @@ export const generate_action_method_enums = (specs, imports, options) => {
543
540
  const emit_block = (kind, name, methods, jsdoc) => {
544
541
  if (!emit.has(kind))
545
542
  return;
546
- // `z.enum([])` is invalid — skip empty kinds rather than emit broken code.
547
- // Consumers that need a kind to exist should check their spec set, not the helper.
543
+ // skip empty kinds: an enum of no methods types as `never`, which no
544
+ // consumer wants. Consumers that need a kind to exist should check their
545
+ // spec set, not the helper
548
546
  if (methods.length === 0)
549
547
  return;
550
548
  blocks.push(format_method_enum_block(name, jsdoc, methods));
@@ -564,7 +562,8 @@ export const generate_action_method_enums = (specs, imports, options) => {
564
562
  emit_block('broadcast', 'BroadcastActionMethod', registry.broadcast_methods, "Names of remote_notification actions exposed by the broadcast API (backend-initiated, excluding request-scoped progress notifications named by another action's `streams`).");
565
563
  if (blocks.length === 0)
566
564
  return '';
567
- imports.add('zod', 'z');
565
+ imports.add('@fuzdev/fuz_schema/schema.ts', 'one_of');
566
+ imports.add_type('@fuzdev/fuz_schema/schema.ts', 'Infer');
568
567
  return blocks.join('\n\n');
569
568
  };
570
569
  /**
@@ -651,27 +650,37 @@ ${type_lines}
651
650
  export const action_specs: Array<ActionSpecUnion> = Object.values(ActionSpecs);`;
652
651
  };
653
652
  /**
654
- * Emit `ActionInputs` + `ActionOutputs` runtime consts and matching interfaces.
655
- * The runtime consts reference `specs.{method}_action_spec.input` /
656
- * `.output`; the interfaces type each as its schema's output: `z.infer` for a
657
- * Zod schema, `Infer` for a `@fuzdev/fuz_schema` one.
653
+ * Emit `ActionInputs` + `ActionOutputs` runtime consts and matching
654
+ * interfaces, plus the `ActionCallInputs` interface. The runtime consts
655
+ * reference `specs.{method}_action_spec.input` / `.output`.
656
+ *
657
+ * The two sides of a call see different types for one input schema, so the
658
+ * interfaces split by side:
659
+ *
660
+ * - `ActionInputs` types each input as its schema's output (`Infer`) — the
661
+ * parsed value a handler, an action event, or a notification receiver reads,
662
+ * with defaults filled and transforms applied.
663
+ * - `ActionCallInputs` types each input as its schema's input (`InferInput`)
664
+ * — what a caller passes, before the parse: a `with_default` field is
665
+ * optional there and required in `ActionInputs`. The call surfaces
666
+ * (`FrontendActionsApi`, `BackendActionsApi`) read it.
667
+ * - `ActionOutputs` types each output as its schema's output, what a caller
668
+ * receives.
658
669
  *
659
- * Adds `import {z} from 'zod';` when any schema is Zod's,
660
- * `import type {Infer} from '@fuzdev/fuz_schema/schema.ts';` when any is
661
- * fuz_schema's, and the `* as specs` namespace import.
670
+ * Adds `import type {Infer, InferInput} from '@fuzdev/fuz_schema/schema.ts';`
671
+ * and the `* as specs` namespace import.
662
672
  *
663
673
  * @param options.qualify_spec - per-spec qualified identifier callback for
664
674
  * multi-source consumers. The helper appends `.input` / `.output` to the
665
675
  * callback's return value. When set, the helper skips the default
666
676
  * `* as specs` import — the consumer manages its own namespace imports —
667
677
  * and `specs_module` is ignored. Single-source consumers omit it.
668
- * @throws Error naming the method when an input or output is neither a Zod
669
- * nor a fuz_schema schema
678
+ * @throws Error naming the method when an input or output is no schema
670
679
  */
671
680
  export const generate_action_inputs_outputs = (specs, imports, options) => {
672
681
  const filtered = filter_protocol_actions(specs, options?.include_protocol_actions);
673
682
  if (filtered.length === 0) {
674
- // Empty spec list — emit minimal valid output and skip the `zod` /
683
+ // Empty spec list — emit minimal valid output and skip the `Infer` /
675
684
  // `* as specs` imports that would have nothing to reference.
676
685
  return `/**
677
686
  * Action parameter schemas indexed by method name.
@@ -681,6 +690,12 @@ export const generate_action_inputs_outputs = (specs, imports, options) => {
681
690
  export const ActionInputs = {} as const;
682
691
  export interface ActionInputs {}
683
692
 
693
+ /**
694
+ * Action inputs as a caller passes them, indexed by method name:
695
+ * each input schema's input type, before the parse.
696
+ */
697
+ export interface ActionCallInputs {}
698
+
684
699
  /**
685
700
  * Action result schemas indexed by method name.
686
701
  * These represent the output data for each action,
@@ -689,28 +704,26 @@ export interface ActionInputs {}
689
704
  export const ActionOutputs = {} as const;
690
705
  export interface ActionOutputs {}`;
691
706
  }
692
- const libraries = filtered.map((s) => ({
693
- input: to_spec_schema_library(s, 'input'),
694
- output: to_spec_schema_library(s, 'output')
695
- }));
696
- const uses = (library) => libraries.some((l) => l.input === library || l.output === library);
697
- if (uses('zod'))
698
- imports.add('zod', 'z');
699
- if (uses('fuz_schema'))
700
- imports.add_type('@fuzdev/fuz_schema/schema.ts', 'Infer');
707
+ for (const s of filtered) {
708
+ assert_spec_schema(s, 'input');
709
+ assert_spec_schema(s, 'output');
710
+ }
711
+ imports.add_types('@fuzdev/fuz_schema/schema.ts', 'Infer', 'InferInput');
701
712
  const qualify = resolve_spec_qualifier(imports, options);
702
- const infer = (library) => library === 'zod' ? 'z.infer' : 'Infer';
703
713
  const inputs_value = filtered
704
714
  .map((s) => `\t${to_action_property_key(s.method)}: ${qualify(s)}.input,`)
705
715
  .join('\n');
706
716
  const inputs_type = filtered
707
- .map((s, i) => `\t${to_action_property_key(s.method)}: ${infer(libraries[i].input)}<typeof ${qualify(s)}.input>;`)
717
+ .map((s) => `\t${to_action_property_key(s.method)}: Infer<typeof ${qualify(s)}.input>;`)
718
+ .join('\n');
719
+ const call_inputs_type = filtered
720
+ .map((s) => `\t${to_action_property_key(s.method)}: InferInput<typeof ${qualify(s)}.input>;`)
708
721
  .join('\n');
709
722
  const outputs_value = filtered
710
723
  .map((s) => `\t${to_action_property_key(s.method)}: ${qualify(s)}.output,`)
711
724
  .join('\n');
712
725
  const outputs_type = filtered
713
- .map((s, i) => `\t${to_action_property_key(s.method)}: ${infer(libraries[i].output)}<typeof ${qualify(s)}.output>;`)
726
+ .map((s) => `\t${to_action_property_key(s.method)}: Infer<typeof ${qualify(s)}.output>;`)
714
727
  .join('\n');
715
728
  return `/**
716
729
  * Action parameter schemas indexed by method name.
@@ -724,6 +737,14 @@ export interface ActionInputs {
724
737
  ${inputs_type}
725
738
  }
726
739
 
740
+ /**
741
+ * Action inputs as a caller passes them, indexed by method name:
742
+ * each input schema's input type, before the parse.
743
+ */
744
+ export interface ActionCallInputs {
745
+ ${call_inputs_type}
746
+ }
747
+
727
748
  /**
728
749
  * Action result schemas indexed by method name.
729
750
  * These represent the output data for each action,
@@ -802,7 +823,7 @@ ${lines.join('\n')}
802
823
  *
803
824
  * Imports are registered per emitted line — only what the spec set actually references shows up on
804
825
  * `imports`. A spec set with no async methods skips `RpcClientCallOptions`;
805
- * one with no inputs skips `ActionInputs`; sync `local_call` methods with
826
+ * one with no inputs skips `ActionCallInputs`; sync `local_call` methods with
806
827
  * `sync_returns_value: true` (the default) skip `Result` / `JsonrpcErrorObject`.
807
828
  *
808
829
  * The interface name is fixed at `FrontendActionsApi` — the symmetric counterpart
@@ -892,7 +913,7 @@ ${lines};
892
913
  * exclusion list.
893
914
  *
894
915
  * Adds the `* as specs` namespace import (from `specs_module`), the
895
- * `ActionInputs` type import (from `collections_path`), and the
916
+ * `ActionCallInputs` type import (from `collections_path`), and the
896
917
  * `ActionSpecUnion` type import.
897
918
  *
898
919
  * Method signature shape today is `(input) => Promise<void>` — matches the
@@ -922,18 +943,18 @@ export const generate_backend_actions_api = (specs, imports, options) => {
922
943
  */`;
923
944
  if (broadcast.length === 0) {
924
945
  // No backend-initiated remote_notifications — skip `* as specs` and
925
- // `ActionInputs` imports that would have nothing to reference.
946
+ // `ActionCallInputs` imports that would have nothing to reference.
926
947
  return `${interface_doc}
927
948
  export interface BackendActionsApi {}
928
949
 
929
950
  export const broadcast_action_specs: ReadonlyArray<ActionSpecUnion> = [];`;
930
951
  }
931
952
  const collections_path = options?.collections_path ?? DEFAULT_COLLECTIONS_PATH;
932
- imports.add_type(collections_path, 'ActionInputs');
953
+ imports.add_type(collections_path, 'ActionCallInputs');
933
954
  const qualify = resolve_spec_qualifier(imports, options);
934
955
  const interface_body = '\n' +
935
956
  broadcast
936
- .map((s) => `\t${to_action_property_key(s.method)}: (input: ActionInputs['${s.method}']) => Promise<void>;`)
957
+ .map((s) => `\t${to_action_property_key(s.method)}: (input: ActionCallInputs['${s.method}']) => Promise<void>;`)
937
958
  .join('\n') +
938
959
  '\n';
939
960
  const array_body = '\n' + broadcast.map((s) => `\t${qualify(s)},`).join('\n') + '\n';