@fuzdev/fuz_app 0.169.0 → 0.171.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 (171) hide show
  1. package/dist/actions/CLAUDE.md +19 -21
  2. package/dist/actions/action_codegen.d.ts +27 -18
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +90 -90
  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 +4 -4
  9. package/dist/actions/action_rpc.d.ts +1 -1
  10. package/dist/actions/action_rpc.d.ts.map +1 -1
  11. package/dist/actions/action_rpc.js +6 -7
  12. package/dist/actions/action_spec.d.ts +8 -10
  13. package/dist/actions/action_spec.d.ts.map +1 -1
  14. package/dist/actions/action_spec.js +1 -1
  15. package/dist/actions/action_types.d.ts +4 -4
  16. package/dist/actions/action_types.d.ts.map +1 -1
  17. package/dist/actions/action_types.js +2 -2
  18. package/dist/actions/broadcast_api.d.ts +2 -2
  19. package/dist/actions/broadcast_api.js +4 -4
  20. package/dist/actions/compile_action_registry.d.ts +6 -7
  21. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  22. package/dist/actions/compile_action_registry.js +8 -9
  23. package/dist/actions/peer_ping.d.ts.map +1 -1
  24. package/dist/actions/peer_ping.js +3 -2
  25. package/dist/actions/perform_action.d.ts +6 -6
  26. package/dist/actions/perform_action.d.ts.map +1 -1
  27. package/dist/actions/perform_action.js +11 -10
  28. package/dist/actions/socket.svelte.d.ts +1 -1
  29. package/dist/actions/socket.svelte.js +2 -2
  30. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  31. package/dist/actions/ws_socket_session.js +2 -1
  32. package/dist/auth/CLAUDE.md +11 -11
  33. package/dist/auth/admin_action_specs.d.ts +24 -24
  34. package/dist/auth/audit_emitter.d.ts +6 -7
  35. package/dist/auth/audit_emitter.d.ts.map +1 -1
  36. package/dist/auth/audit_emitter.js +11 -22
  37. package/dist/auth/audit_log_ddl.d.ts +1 -1
  38. package/dist/auth/audit_log_ddl.js +1 -1
  39. package/dist/auth/audit_log_queries.d.ts +0 -13
  40. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  41. package/dist/auth/audit_log_queries.js +3 -3
  42. package/dist/auth/audit_log_schema.d.ts +14 -15
  43. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  44. package/dist/auth/audit_log_schema.js +1 -1
  45. package/dist/auth/auth_ddl.d.ts +1 -1
  46. package/dist/auth/auth_ddl.js +1 -1
  47. package/dist/auth/cell_action_specs.d.ts +54 -54
  48. package/dist/auth/cell_actions.d.ts +2 -2
  49. package/dist/auth/cell_actions.js +5 -5
  50. package/dist/auth/middleware.d.ts +6 -2
  51. package/dist/auth/middleware.d.ts.map +1 -1
  52. package/dist/auth/middleware.js +14 -2
  53. package/dist/auth/request_context.d.ts.map +1 -1
  54. package/dist/auth/request_context.js +7 -9
  55. package/dist/auth/role_grant_offer_action_specs.d.ts +6 -6
  56. package/dist/auth/role_grant_offer_ddl.d.ts +1 -1
  57. package/dist/auth/role_grant_offer_ddl.js +1 -1
  58. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  59. package/dist/auth/role_grant_offer_notifications.js +2 -3
  60. package/dist/auth/self_service_role_actions.d.ts +1 -1
  61. package/dist/auth/self_service_role_actions.js +1 -1
  62. package/dist/env/env_schemas.d.ts +1 -2
  63. package/dist/env/env_schemas.d.ts.map +1 -1
  64. package/dist/env/env_schemas.js +3 -4
  65. package/dist/http/CLAUDE.md +30 -31
  66. package/dist/http/auth_shape.d.ts +14 -32
  67. package/dist/http/auth_shape.d.ts.map +1 -1
  68. package/dist/http/auth_shape.js +14 -49
  69. package/dist/http/error_schemas.d.ts +18 -18
  70. package/dist/http/json_text.d.ts +53 -0
  71. package/dist/http/json_text.d.ts.map +1 -0
  72. package/dist/http/json_text.js +152 -0
  73. package/dist/http/jsonrpc_helpers.js +1 -1
  74. package/dist/http/route_error_check.d.ts +2 -2
  75. package/dist/http/route_error_check.d.ts.map +1 -1
  76. package/dist/http/route_error_check.js +2 -3
  77. package/dist/http/route_errors.d.ts +4 -4
  78. package/dist/http/route_errors.d.ts.map +1 -1
  79. package/dist/http/route_errors.js +0 -13
  80. package/dist/http/route_result.d.ts +2 -1
  81. package/dist/http/route_result.d.ts.map +1 -1
  82. package/dist/http/route_spec.d.ts +34 -37
  83. package/dist/http/route_spec.d.ts.map +1 -1
  84. package/dist/http/route_spec.js +31 -31
  85. package/dist/http/schema_helpers.d.ts +77 -68
  86. package/dist/http/schema_helpers.d.ts.map +1 -1
  87. package/dist/http/schema_helpers.js +54 -77
  88. package/dist/http/surface.d.ts.map +1 -1
  89. package/dist/http/surface.js +6 -8
  90. package/dist/primitive_schemas.d.ts +9 -17
  91. package/dist/primitive_schemas.d.ts.map +1 -1
  92. package/dist/primitive_schemas.js +9 -17
  93. package/dist/realtime/sse.d.ts +3 -3
  94. package/dist/realtime/sse.d.ts.map +1 -1
  95. package/dist/realtime/sse.js +2 -2
  96. package/dist/schema_issues.d.ts +39 -147
  97. package/dist/schema_issues.d.ts.map +1 -1
  98. package/dist/schema_issues.js +39 -352
  99. package/dist/schema_meta.d.ts +63 -136
  100. package/dist/schema_meta.d.ts.map +1 -1
  101. package/dist/schema_meta.js +37 -184
  102. package/dist/sensitivity.d.ts +3 -5
  103. package/dist/sensitivity.d.ts.map +1 -1
  104. package/dist/sensitivity.js +3 -5
  105. package/dist/testing/CLAUDE.md +20 -22
  106. package/dist/testing/adversarial_headers.js +2 -2
  107. package/dist/testing/adversarial_input_cases.d.ts +19 -18
  108. package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
  109. package/dist/testing/adversarial_input_cases.js +31 -46
  110. package/dist/testing/assertions.d.ts +2 -2
  111. package/dist/testing/assertions.d.ts.map +1 -1
  112. package/dist/testing/assertions.js +3 -3
  113. package/dist/testing/cross_backend/account_lifecycle.js +2 -2
  114. package/dist/testing/cross_backend/action_manifest.d.ts +10 -9
  115. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  116. package/dist/testing/cross_backend/action_manifest.js +4 -3
  117. package/dist/testing/cross_backend/cell_crud.js +1 -1
  118. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts +0 -62
  119. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts.map +1 -1
  120. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  121. package/dist/testing/cross_backend/conformance_table.js +3 -3
  122. package/dist/testing/cross_backend/cross_rpc.d.ts +3 -4
  123. package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
  124. package/dist/testing/cross_backend/cross_rpc.js +4 -4
  125. package/dist/testing/cross_backend/differential.js +2 -2
  126. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  127. package/dist/testing/cross_backend/identity_parity.js +16 -11
  128. package/dist/testing/cross_backend/origin_conformance.d.ts +9 -9
  129. package/dist/testing/cross_backend/query_shape.js +1 -1
  130. package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
  131. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
  132. package/dist/testing/cross_backend/setup.d.ts +25 -3
  133. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  134. package/dist/testing/cross_backend/setup.js +4 -4
  135. package/dist/testing/cross_backend/sse_round_trip.js +2 -2
  136. package/dist/testing/cross_backend/testing_origin_check.d.ts +4 -4
  137. package/dist/testing/cross_backend/token_lifetime.js +3 -3
  138. package/dist/testing/cross_backend/wire_shapes.js +1 -1
  139. package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -1
  140. package/dist/testing/cross_backend/ws_envelope.js +8 -0
  141. package/dist/testing/cross_backend/ws_round_trip.js +1 -1
  142. package/dist/testing/data_exposure.d.ts.map +1 -1
  143. package/dist/testing/data_exposure.js +1 -1
  144. package/dist/testing/integration.js +2 -2
  145. package/dist/testing/integration_helpers.d.ts.map +1 -1
  146. package/dist/testing/integration_helpers.js +2 -2
  147. package/dist/testing/middleware.d.ts.map +1 -1
  148. package/dist/testing/middleware.js +2 -2
  149. package/dist/testing/rpc_attack_surface.js +1 -1
  150. package/dist/testing/rpc_envelope_cases.d.ts +10 -3
  151. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  152. package/dist/testing/rpc_envelope_cases.js +22 -1
  153. package/dist/testing/rpc_helpers.d.ts +12 -14
  154. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  155. package/dist/testing/rpc_helpers.js +9 -10
  156. package/dist/testing/schema_generators.d.ts +67 -60
  157. package/dist/testing/schema_generators.d.ts.map +1 -1
  158. package/dist/testing/schema_generators.js +154 -159
  159. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  160. package/dist/testing/sse_round_trip.js +2 -2
  161. package/dist/testing/surface_invariants.d.ts +1 -1
  162. package/dist/testing/surface_invariants.js +1 -1
  163. package/dist/ui/form_state.svelte.d.ts +1 -1
  164. package/dist/ui/form_state.svelte.js +1 -1
  165. package/package.json +5 -7
  166. package/dist/zod.d.ts +0 -116
  167. package/dist/zod.d.ts.map +0 -1
  168. package/dist/zod.js +0 -218
  169. package/dist/zod_schemas.d.ts +0 -100
  170. package/dist/zod_schemas.d.ts.map +0 -1
  171. package/dist/zod_schemas.js +0 -157
@@ -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 `@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, so a Zod schema holding one wraps it as `z.enum(ActionMethod.def)`.
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` — the `ActionInputs`, `ActionCallInputs` and `ActionOutputs` interfaces, types only (a const's inferred type would be written out whole in a declaration file, TS7056 past enough specs; the schemas are read off `ActionSpecs`), 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.
@@ -206,7 +205,7 @@ spines, and an authorized one is `invalid_params`.
206
205
 
207
206
  Shim responsibilities (per-request):
208
207
 
209
- 1. Parse envelope (POST body / GET query string); parse errors → `parse_error` 400. GET reads `method` / `id` / `params` via Hono's `c.req.query()` — first occurrence wins on a duplicated key, unknown keys are ignored, and an empty value counts as missing. This is the cross-impl contract (the Rust GET dispatch mirrors it via `fuz_http`'s `query_first`, including the id numeric-vs-string normalization), pinned by the `query_shape` cross suite.
208
+ 1. Parse envelope (POST body / GET query string, each through `parse_json_text`, `http/json_text.ts`, so JSON the Rust spine refuses is refused here too); parse errors → `parse_error` 400, a `GET` `params` that is no JSON `invalid_params`. GET reads `method` / `id` / `params` via Hono's `c.req.query()` — first occurrence wins on a duplicated key, unknown keys are ignored, and an empty value counts as missing. This is the cross-impl contract (the Rust GET dispatch mirrors it via `fuz_http`'s `query_first`, including the id numeric-vs-string normalization), pinned by the `query_shape` cross suite.
210
209
  2. Lookup method in the `compile_action_registry`-built map; unknown → `method_not_found`.
211
210
  3. GET read restriction — GET rejected for `side_effects: true` actions. Every response the GET handler writes, its refusals included, carries `Cache-Control: no-store` (`RPC_GET_CACHE_CONTROL`; a pre-handler middleware refusal, like the origin 403, does not): a read answers one caller at one moment.
212
211
  4. Build `PerformActionInput` from `get_resolved_auth(c)` + `get_client_ip` + `c.req.raw.signal`. Test-preset escape hatch reads `has_test_context_preset(c)` + `REQUEST_CONTEXT_KEY`.
@@ -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`
@@ -870,7 +868,7 @@ the duplicate-id and overflow wire strings, and the `on_socket_open` /
870
868
  Per-message dispatch delegates to `perform_action` — the shared core that
871
869
  HTTP RPC also calls. The socket session owns only WS-specific concerns:
872
870
 
873
- - **Wire envelope parsing** — JSON.parse → batch rejection → `classify_jsonrpc_message` (`http/jsonrpc_helpers.ts`, the twin of the Rust `fuz_http::classify`, the same classifier the HTTP POST path runs) → per-arm handling: an `invalid` answers its error on its id; a `response` routes to the socket's pending peer request; a `notification` routes `cancel` and is otherwise dropped; a `request` goes on to the duplicate-id and in-flight checks and dispatch. The classifier runs the twin's order — version, then the `method` axis, then `id`, then the `JsonrpcRequest` envelope — so `{method: 'x'}` and `{jsonrpc: '1.0', method: 'x'}` answer `invalid_request` rather than being dropped as notifications; a response is the twin's shape exactly (no string `method`, a string/number `id`, exactly one of `result` / `error`), so a hybrid like `{method, id, result}` stays a dispatchable request; and `params: null`, an array `params`, or a non-string/number `id` answers `invalid_request` (-32600) on both transports rather than reaching the dispatcher as `invalid_params`. Notifications stay unvalidated (they carry no id to echo). A non-object frame answers `id: null`. POST answers a notification or a response `invalid_request` on `id: null`, as the Rust spine does.
871
+ - **Wire envelope parsing** — `parse_json_text` (`http/json_text.ts`: what the Rust spine's `serde_json` refuses is a `parse_error` here too) → batch rejection → `classify_jsonrpc_message` (`http/jsonrpc_helpers.ts`, the twin of the Rust `fuz_http::classify`, the same classifier the HTTP POST path runs) → per-arm handling: an `invalid` answers its error on its id; a `response` routes to the socket's pending peer request; a `notification` routes `cancel` and is otherwise dropped; a `request` goes on to the duplicate-id and in-flight checks and dispatch. The classifier runs the twin's order — version, then the `method` axis, then `id`, then the `JsonrpcRequest` envelope — so `{method: 'x'}` and `{jsonrpc: '1.0', method: 'x'}` answer `invalid_request` rather than being dropped as notifications; a response is the twin's shape exactly (no string `method`, a string/number `id`, exactly one of `result` / `error`), so a hybrid like `{method, id, result}` stays a dispatchable request; and `params: null`, an array `params`, or a non-string/number `id` answers `invalid_request` (-32600) on both transports rather than reaching the dispatcher as `invalid_params`. Notifications stay unvalidated (they carry no id to echo). A non-object frame answers `id: null`. POST answers a notification or a response `invalid_request` on `id: null`, as the Rust spine does.
874
872
  - **Cancel-notification interception** — `{request_id → AbortController}` map; aborts the matching pending controller before the cancel bubbles past the dispatcher
875
873
  - **Duplicate live ids refused** — a request whose id names a request still running on the socket is answered `invalid_request` with `data.reason` `ERROR_DUPLICATE_REQUEST_ID` and not dispatched; the running request keeps its controller, its cancel entry, and its reply id. An id is free again once its request is answered. Same refusal on the Rust spine
876
874
  - **In-flight ceiling** — at most `MAX_INBOUND_DISPATCHES_PER_CONNECTION` (128) requests run at once per socket (`@hono/node-ws` does not await `onMessage`, so nothing else bounds them); one more is answered `queue_overflow` (`WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE`) and not dispatched, and the socket stays open and keeps reading — a reply to a server-initiated request still gets through. The duplicate check runs first; neither refusal reaches `perform_action`, so neither charges the action rate limiters. Same cap, message, and order as the Rust spine's `MAX_INBOUND_DISPATCHES_PER_CONNECTION`
@@ -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,14 +120,12 @@ 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. */
@@ -139,8 +137,7 @@ export type ActionMethodEnumKind = 'all' | 'request_response' | 'remote_notifica
139
137
  * `LocalCallActionMethod`, `FrontendActionMethod`, `BackendActionMethod`,
140
138
  * `FrontendRequestResponseMethod`, `BackendRequestResponseMethod`,
141
139
  * `BroadcastActionMethod`. Pairs each runtime const with an `Infer` type
142
- * alias under the same identifier. A const's `def` is its array of methods;
143
- * a Zod schema that holds one takes `z.enum(ActionMethod.def)`.
140
+ * alias under the same identifier. A const's `def` is its array of methods.
144
141
  *
145
142
  * Protocol-action methods (`heartbeat`, `cancel`) are filtered out by
146
143
  * default — pass `include_protocol_actions: true` if a consumer genuinely
@@ -201,22 +198,34 @@ export declare const generate_action_specs_record: (specs: ReadonlyArray<ActionS
201
198
  include_protocol_actions?: boolean;
202
199
  }) => string;
203
200
  /**
204
- * Emit `ActionInputs` + `ActionOutputs` runtime consts and matching interfaces.
205
- * The runtime consts reference `specs.{method}_action_spec.input` /
206
- * `.output`; the interfaces type each as its schema's output: `z.infer` for a
207
- * Zod schema, `Infer` for a `@fuzdev/fuz_schema` one.
201
+ * Emit the `ActionInputs`, `ActionCallInputs` and `ActionOutputs`
202
+ * interfaces, each member a type over `specs.{method}_action_spec.input` /
203
+ * `.output`. Types only: the schemas are read off the specs themselves
204
+ * (`ActionSpecs`), and a type reference stays a reference in a declaration
205
+ * file, where an unannotated const's inferred type is written out whole.
208
206
  *
209
- * Adds `import {z} from 'zod';` when any schema is Zod's,
210
- * `import type {Infer} from '@fuzdev/fuz_schema/schema.ts';` when any is
211
- * fuz_schema's, and the `* as specs` namespace import.
207
+ * The two sides of a call see different types for one input schema, so the
208
+ * interfaces split by side:
209
+ *
210
+ * - `ActionInputs` types each input as its schema's output (`Infer`) — the
211
+ * parsed value a handler, an action event, or a notification receiver reads,
212
+ * with defaults filled and transforms applied.
213
+ * - `ActionCallInputs` types each input as its schema's input (`InferInput`)
214
+ * — what a caller passes, before the parse: a `with_default` field is
215
+ * optional there and required in `ActionInputs`. The call surfaces
216
+ * (`FrontendActionsApi`, `BackendActionsApi`) read it.
217
+ * - `ActionOutputs` types each output as its schema's output, what a caller
218
+ * receives.
219
+ *
220
+ * Adds `import type {Infer, InferInput} from '@fuzdev/fuz_schema/schema.ts';`
221
+ * and the `* as specs` namespace import.
212
222
  *
213
223
  * @param options.qualify_spec - per-spec qualified identifier callback for
214
224
  * multi-source consumers. The helper appends `.input` / `.output` to the
215
225
  * callback's return value. When set, the helper skips the default
216
226
  * `* as specs` import — the consumer manages its own namespace imports —
217
227
  * and `specs_module` is ignored. Single-source consumers omit it.
218
- * @throws Error naming the method when an input or output is neither a Zod
219
- * nor a fuz_schema schema
228
+ * @throws Error naming the method when an input or output is no schema
220
229
  */
221
230
  export declare const generate_action_inputs_outputs: (specs: ReadonlyArray<ActionSpecUnion>, imports: ImportBuilder, options?: {
222
231
  specs_module?: string;
@@ -256,7 +265,7 @@ export declare const generate_action_event_datas: (specs: ReadonlyArray<ActionSp
256
265
  *
257
266
  * Imports are registered per emitted line — only what the spec set actually references shows up on
258
267
  * `imports`. A spec set with no async methods skips `RpcClientCallOptions`;
259
- * one with no inputs skips `ActionInputs`; sync `local_call` methods with
268
+ * one with no inputs skips `ActionCallInputs`; sync `local_call` methods with
260
269
  * `sync_returns_value: true` (the default) skip `Result` / `JsonrpcErrorObject`.
261
270
  *
262
271
  * The interface name is fixed at `FrontendActionsApi` — the symmetric counterpart
@@ -297,7 +306,7 @@ export declare const generate_frontend_action_handlers: (specs: ReadonlyArray<Ac
297
306
  * exclusion list.
298
307
  *
299
308
  * Adds the `* as specs` namespace import (from `specs_module`), the
300
- * `ActionInputs` type import (from `collections_path`), and the
309
+ * `ActionCallInputs` type import (from `collections_path`), and the
301
310
  * `ActionSpecUnion` type import.
302
311
  *
303
312
  * 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,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB,G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;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' : '';
@@ -523,8 +518,7 @@ const resolve_spec_qualifier = (imports, options) => {
523
518
  * `LocalCallActionMethod`, `FrontendActionMethod`, `BackendActionMethod`,
524
519
  * `FrontendRequestResponseMethod`, `BackendRequestResponseMethod`,
525
520
  * `BroadcastActionMethod`. Pairs each runtime const with an `Infer` type
526
- * alias under the same identifier. A const's `def` is its array of methods;
527
- * a Zod schema that holds one takes `z.enum(ActionMethod.def)`.
521
+ * alias under the same identifier. A const's `def` is its array of methods.
528
522
  *
529
523
  * Protocol-action methods (`heartbeat`, `cancel`) are filtered out by
530
524
  * default — pass `include_protocol_actions: true` if a consumer genuinely
@@ -656,87 +650,93 @@ ${type_lines}
656
650
  export const action_specs: Array<ActionSpecUnion> = Object.values(ActionSpecs);`;
657
651
  };
658
652
  /**
659
- * Emit `ActionInputs` + `ActionOutputs` runtime consts and matching interfaces.
660
- * The runtime consts reference `specs.{method}_action_spec.input` /
661
- * `.output`; the interfaces type each as its schema's output: `z.infer` for a
662
- * Zod schema, `Infer` for a `@fuzdev/fuz_schema` one.
653
+ * Emit the `ActionInputs`, `ActionCallInputs` and `ActionOutputs`
654
+ * interfaces, each member a type over `specs.{method}_action_spec.input` /
655
+ * `.output`. Types only: the schemas are read off the specs themselves
656
+ * (`ActionSpecs`), and a type reference stays a reference in a declaration
657
+ * file, where an unannotated const's inferred type is written out whole.
658
+ *
659
+ * The two sides of a call see different types for one input schema, so the
660
+ * interfaces split by side:
661
+ *
662
+ * - `ActionInputs` types each input as its schema's output (`Infer`) — the
663
+ * parsed value a handler, an action event, or a notification receiver reads,
664
+ * with defaults filled and transforms applied.
665
+ * - `ActionCallInputs` types each input as its schema's input (`InferInput`)
666
+ * — what a caller passes, before the parse: a `with_default` field is
667
+ * optional there and required in `ActionInputs`. The call surfaces
668
+ * (`FrontendActionsApi`, `BackendActionsApi`) read it.
669
+ * - `ActionOutputs` types each output as its schema's output, what a caller
670
+ * receives.
663
671
  *
664
- * Adds `import {z} from 'zod';` when any schema is Zod's,
665
- * `import type {Infer} from '@fuzdev/fuz_schema/schema.ts';` when any is
666
- * fuz_schema's, and the `* as specs` namespace import.
672
+ * Adds `import type {Infer, InferInput} from '@fuzdev/fuz_schema/schema.ts';`
673
+ * and the `* as specs` namespace import.
667
674
  *
668
675
  * @param options.qualify_spec - per-spec qualified identifier callback for
669
676
  * multi-source consumers. The helper appends `.input` / `.output` to the
670
677
  * callback's return value. When set, the helper skips the default
671
678
  * `* as specs` import — the consumer manages its own namespace imports —
672
679
  * and `specs_module` is ignored. Single-source consumers omit it.
673
- * @throws Error naming the method when an input or output is neither a Zod
674
- * nor a fuz_schema schema
680
+ * @throws Error naming the method when an input or output is no schema
675
681
  */
676
682
  export const generate_action_inputs_outputs = (specs, imports, options) => {
677
683
  const filtered = filter_protocol_actions(specs, options?.include_protocol_actions);
678
684
  if (filtered.length === 0) {
679
- // Empty spec list — emit minimal valid output and skip the `zod` /
685
+ // Empty spec list — emit minimal valid output and skip the `Infer` /
680
686
  // `* as specs` imports that would have nothing to reference.
681
687
  return `/**
682
- * Action parameter schemas indexed by method name.
683
- * These represent the input data for each action,
684
- * e.g. JSON-RPC request/notification params and local call arguments.
688
+ * Action inputs indexed by method name, as parsed: each input schema's output
689
+ * type, e.g. JSON-RPC request/notification params and local call arguments.
685
690
  */
686
- export const ActionInputs = {} as const;
687
691
  export interface ActionInputs {}
688
692
 
689
693
  /**
690
- * Action result schemas indexed by method name.
691
- * These represent the output data for each action,
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
+
699
+ /**
700
+ * Action outputs indexed by method name: each output schema's output type,
692
701
  * e.g. JSON-RPC response results and local call return values.
693
702
  */
694
- export const ActionOutputs = {} as const;
695
703
  export interface ActionOutputs {}`;
696
704
  }
697
- const libraries = filtered.map((s) => ({
698
- input: to_spec_schema_library(s, 'input'),
699
- output: to_spec_schema_library(s, 'output')
700
- }));
701
- const uses = (library) => libraries.some((l) => l.input === library || l.output === library);
702
- if (uses('zod'))
703
- imports.add('zod', 'z');
704
- if (uses('fuz_schema'))
705
- imports.add_type('@fuzdev/fuz_schema/schema.ts', 'Infer');
705
+ for (const s of filtered) {
706
+ assert_spec_schema(s, 'input');
707
+ assert_spec_schema(s, 'output');
708
+ }
709
+ imports.add_types('@fuzdev/fuz_schema/schema.ts', 'Infer', 'InferInput');
706
710
  const qualify = resolve_spec_qualifier(imports, options);
707
- const infer = (library) => library === 'zod' ? 'z.infer' : 'Infer';
708
- const inputs_value = filtered
709
- .map((s) => `\t${to_action_property_key(s.method)}: ${qualify(s)}.input,`)
710
- .join('\n');
711
711
  const inputs_type = filtered
712
- .map((s, i) => `\t${to_action_property_key(s.method)}: ${infer(libraries[i].input)}<typeof ${qualify(s)}.input>;`)
712
+ .map((s) => `\t${to_action_property_key(s.method)}: Infer<typeof ${qualify(s)}.input>;`)
713
713
  .join('\n');
714
- const outputs_value = filtered
715
- .map((s) => `\t${to_action_property_key(s.method)}: ${qualify(s)}.output,`)
714
+ const call_inputs_type = filtered
715
+ .map((s) => `\t${to_action_property_key(s.method)}: InferInput<typeof ${qualify(s)}.input>;`)
716
716
  .join('\n');
717
717
  const outputs_type = filtered
718
- .map((s, i) => `\t${to_action_property_key(s.method)}: ${infer(libraries[i].output)}<typeof ${qualify(s)}.output>;`)
718
+ .map((s) => `\t${to_action_property_key(s.method)}: Infer<typeof ${qualify(s)}.output>;`)
719
719
  .join('\n');
720
720
  return `/**
721
- * Action parameter schemas indexed by method name.
722
- * These represent the input data for each action,
723
- * e.g. JSON-RPC request/notification params and local call arguments.
721
+ * Action inputs indexed by method name, as parsed: each input schema's output
722
+ * type, e.g. JSON-RPC request/notification params and local call arguments.
724
723
  */
725
- export const ActionInputs = {
726
- ${inputs_value}
727
- } as const;
728
724
  export interface ActionInputs {
729
725
  ${inputs_type}
730
726
  }
731
727
 
732
728
  /**
733
- * Action result schemas indexed by method name.
734
- * These represent the output data for each action,
729
+ * Action inputs as a caller passes them, indexed by method name:
730
+ * each input schema's input type, before the parse.
731
+ */
732
+ export interface ActionCallInputs {
733
+ ${call_inputs_type}
734
+ }
735
+
736
+ /**
737
+ * Action outputs indexed by method name: each output schema's output type,
735
738
  * e.g. JSON-RPC response results and local call return values.
736
739
  */
737
- export const ActionOutputs = {
738
- ${outputs_value}
739
- } as const;
740
740
  export interface ActionOutputs {
741
741
  ${outputs_type}
742
742
  }`;
@@ -807,7 +807,7 @@ ${lines.join('\n')}
807
807
  *
808
808
  * Imports are registered per emitted line — only what the spec set actually references shows up on
809
809
  * `imports`. A spec set with no async methods skips `RpcClientCallOptions`;
810
- * one with no inputs skips `ActionInputs`; sync `local_call` methods with
810
+ * one with no inputs skips `ActionCallInputs`; sync `local_call` methods with
811
811
  * `sync_returns_value: true` (the default) skip `Result` / `JsonrpcErrorObject`.
812
812
  *
813
813
  * The interface name is fixed at `FrontendActionsApi` — the symmetric counterpart
@@ -897,7 +897,7 @@ ${lines};
897
897
  * exclusion list.
898
898
  *
899
899
  * Adds the `* as specs` namespace import (from `specs_module`), the
900
- * `ActionInputs` type import (from `collections_path`), and the
900
+ * `ActionCallInputs` type import (from `collections_path`), and the
901
901
  * `ActionSpecUnion` type import.
902
902
  *
903
903
  * Method signature shape today is `(input) => Promise<void>` — matches the
@@ -927,18 +927,18 @@ export const generate_backend_actions_api = (specs, imports, options) => {
927
927
  */`;
928
928
  if (broadcast.length === 0) {
929
929
  // No backend-initiated remote_notifications — skip `* as specs` and
930
- // `ActionInputs` imports that would have nothing to reference.
930
+ // `ActionCallInputs` imports that would have nothing to reference.
931
931
  return `${interface_doc}
932
932
  export interface BackendActionsApi {}
933
933
 
934
934
  export const broadcast_action_specs: ReadonlyArray<ActionSpecUnion> = [];`;
935
935
  }
936
936
  const collections_path = options?.collections_path ?? DEFAULT_COLLECTIONS_PATH;
937
- imports.add_type(collections_path, 'ActionInputs');
937
+ imports.add_type(collections_path, 'ActionCallInputs');
938
938
  const qualify = resolve_spec_qualifier(imports, options);
939
939
  const interface_body = '\n' +
940
940
  broadcast
941
- .map((s) => `\t${to_action_property_key(s.method)}: (input: ActionInputs['${s.method}']) => Promise<void>;`)
941
+ .map((s) => `\t${to_action_property_key(s.method)}: (input: ActionCallInputs['${s.method}']) => Promise<void>;`)
942
942
  .join('\n') +
943
943
  '\n';
944
944
  const array_body = '\n' + broadcast.map((s) => `\t${qualify(s)},`).join('\n') + '\n';
@@ -1,11 +1,3 @@
1
- /**
2
- * ActionEvent — state machine for action lifecycle management.
3
- *
4
- * Manages an action through its phases (send_request → receive_response, etc.)
5
- * and steps (initial → parsed → handling → handled/failed).
6
- *
7
- * @module
8
- */
9
1
  import type { ActionEventPhase, ActionSpecUnion } from './action_spec.js';
10
2
  import type { JsonrpcRequest, JsonrpcResponseOrError, JsonrpcNotification } from '../http/jsonrpc.js';
11
3
  import type { ActionEventEnvironment, ActionEventStep } from './action_event_types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"action_event.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_event.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAc,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAyBtF,OAAO,KAAK,EACX,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,KAAK,EAAmB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAapF;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,EAAG,yBAAkC,CAAC;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