@fuzdev/fuz_app 0.169.0 → 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 (154) hide show
  1. package/dist/actions/CLAUDE.md +17 -19
  2. package/dist/actions/action_codegen.d.ts +25 -18
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +83 -67
  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.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/admin_action_specs.d.ts +24 -24
  29. package/dist/auth/audit_emitter.d.ts +6 -7
  30. package/dist/auth/audit_emitter.d.ts.map +1 -1
  31. package/dist/auth/audit_emitter.js +11 -22
  32. package/dist/auth/audit_log_ddl.d.ts +1 -1
  33. package/dist/auth/audit_log_ddl.js +1 -1
  34. package/dist/auth/audit_log_queries.d.ts +0 -13
  35. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  36. package/dist/auth/audit_log_queries.js +3 -3
  37. package/dist/auth/audit_log_schema.d.ts +14 -15
  38. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  39. package/dist/auth/audit_log_schema.js +1 -1
  40. package/dist/auth/auth_ddl.d.ts +1 -1
  41. package/dist/auth/auth_ddl.js +1 -1
  42. package/dist/auth/cell_action_specs.d.ts +54 -54
  43. package/dist/auth/cell_actions.d.ts +2 -2
  44. package/dist/auth/cell_actions.js +5 -5
  45. package/dist/auth/request_context.js +2 -2
  46. package/dist/auth/role_grant_offer_action_specs.d.ts +6 -6
  47. package/dist/auth/role_grant_offer_ddl.d.ts +1 -1
  48. package/dist/auth/role_grant_offer_ddl.js +1 -1
  49. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  50. package/dist/auth/role_grant_offer_notifications.js +2 -3
  51. package/dist/auth/self_service_role_actions.d.ts +1 -1
  52. package/dist/auth/self_service_role_actions.js +1 -1
  53. package/dist/env/env_schemas.d.ts +1 -2
  54. package/dist/env/env_schemas.d.ts.map +1 -1
  55. package/dist/env/env_schemas.js +3 -4
  56. package/dist/http/CLAUDE.md +29 -31
  57. package/dist/http/auth_shape.d.ts +14 -32
  58. package/dist/http/auth_shape.d.ts.map +1 -1
  59. package/dist/http/auth_shape.js +14 -49
  60. package/dist/http/error_schemas.d.ts +18 -18
  61. package/dist/http/jsonrpc_helpers.js +1 -1
  62. package/dist/http/route_error_check.d.ts +2 -2
  63. package/dist/http/route_error_check.d.ts.map +1 -1
  64. package/dist/http/route_error_check.js +2 -3
  65. package/dist/http/route_errors.d.ts +4 -4
  66. package/dist/http/route_errors.d.ts.map +1 -1
  67. package/dist/http/route_errors.js +0 -13
  68. package/dist/http/route_spec.d.ts +33 -36
  69. package/dist/http/route_spec.d.ts.map +1 -1
  70. package/dist/http/route_spec.js +21 -22
  71. package/dist/http/schema_helpers.d.ts +75 -67
  72. package/dist/http/schema_helpers.d.ts.map +1 -1
  73. package/dist/http/schema_helpers.js +54 -77
  74. package/dist/http/surface.d.ts.map +1 -1
  75. package/dist/http/surface.js +6 -8
  76. package/dist/primitive_schemas.d.ts +9 -17
  77. package/dist/primitive_schemas.d.ts.map +1 -1
  78. package/dist/primitive_schemas.js +9 -17
  79. package/dist/realtime/sse.d.ts +3 -3
  80. package/dist/realtime/sse.d.ts.map +1 -1
  81. package/dist/realtime/sse.js +2 -2
  82. package/dist/schema_issues.d.ts +39 -147
  83. package/dist/schema_issues.d.ts.map +1 -1
  84. package/dist/schema_issues.js +39 -352
  85. package/dist/schema_meta.d.ts +63 -136
  86. package/dist/schema_meta.d.ts.map +1 -1
  87. package/dist/schema_meta.js +37 -184
  88. package/dist/sensitivity.d.ts +3 -5
  89. package/dist/sensitivity.d.ts.map +1 -1
  90. package/dist/sensitivity.js +3 -5
  91. package/dist/testing/CLAUDE.md +20 -22
  92. package/dist/testing/adversarial_headers.js +2 -2
  93. package/dist/testing/adversarial_input_cases.d.ts +19 -18
  94. package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
  95. package/dist/testing/adversarial_input_cases.js +29 -42
  96. package/dist/testing/assertions.d.ts +2 -2
  97. package/dist/testing/assertions.d.ts.map +1 -1
  98. package/dist/testing/assertions.js +3 -3
  99. package/dist/testing/cross_backend/account_lifecycle.js +2 -2
  100. package/dist/testing/cross_backend/action_manifest.d.ts +10 -9
  101. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  102. package/dist/testing/cross_backend/action_manifest.js +4 -3
  103. package/dist/testing/cross_backend/cell_crud.js +1 -1
  104. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts +0 -62
  105. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts.map +1 -1
  106. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  107. package/dist/testing/cross_backend/conformance_table.js +3 -3
  108. package/dist/testing/cross_backend/cross_rpc.d.ts +3 -4
  109. package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
  110. package/dist/testing/cross_backend/cross_rpc.js +4 -4
  111. package/dist/testing/cross_backend/differential.js +2 -2
  112. package/dist/testing/cross_backend/identity_parity.js +9 -9
  113. package/dist/testing/cross_backend/origin_conformance.d.ts +9 -9
  114. package/dist/testing/cross_backend/query_shape.js +1 -1
  115. package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
  116. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
  117. package/dist/testing/cross_backend/setup.d.ts +25 -3
  118. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  119. package/dist/testing/cross_backend/setup.js +4 -4
  120. package/dist/testing/cross_backend/sse_round_trip.js +2 -2
  121. package/dist/testing/cross_backend/testing_origin_check.d.ts +4 -4
  122. package/dist/testing/cross_backend/token_lifetime.js +3 -3
  123. package/dist/testing/cross_backend/wire_shapes.js +1 -1
  124. package/dist/testing/cross_backend/ws_round_trip.js +1 -1
  125. package/dist/testing/data_exposure.d.ts.map +1 -1
  126. package/dist/testing/data_exposure.js +1 -1
  127. package/dist/testing/integration.js +2 -2
  128. package/dist/testing/integration_helpers.d.ts.map +1 -1
  129. package/dist/testing/integration_helpers.js +2 -2
  130. package/dist/testing/middleware.d.ts.map +1 -1
  131. package/dist/testing/middleware.js +2 -2
  132. package/dist/testing/rpc_attack_surface.js +1 -1
  133. package/dist/testing/rpc_envelope_cases.d.ts +3 -3
  134. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  135. package/dist/testing/rpc_envelope_cases.js +1 -1
  136. package/dist/testing/rpc_helpers.d.ts +12 -14
  137. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  138. package/dist/testing/rpc_helpers.js +9 -10
  139. package/dist/testing/schema_generators.d.ts +67 -60
  140. package/dist/testing/schema_generators.d.ts.map +1 -1
  141. package/dist/testing/schema_generators.js +150 -145
  142. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  143. package/dist/testing/sse_round_trip.js +2 -2
  144. package/dist/testing/surface_invariants.d.ts +1 -1
  145. package/dist/testing/surface_invariants.js +1 -1
  146. package/dist/ui/form_state.svelte.d.ts +1 -1
  147. package/dist/ui/form_state.svelte.js +1 -1
  148. package/package.json +5 -7
  149. package/dist/zod.d.ts +0 -116
  150. package/dist/zod.d.ts.map +0 -1
  151. package/dist/zod.js +0 -218
  152. package/dist/zod_schemas.d.ts +0 -100
  153. package/dist/zod_schemas.d.ts.map +0 -1
  154. 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` — `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,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,32 @@ 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 `ActionInputs` + `ActionOutputs` runtime consts and matching
202
+ * interfaces, plus the `ActionCallInputs` interface. The runtime consts
203
+ * reference `specs.{method}_action_spec.input` / `.output`.
208
204
  *
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.
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.
212
220
  *
213
221
  * @param options.qualify_spec - per-spec qualified identifier callback for
214
222
  * multi-source consumers. The helper appends `.input` / `.output` to the
215
223
  * callback's return value. When set, the helper skips the default
216
224
  * `* as specs` import — the consumer manages its own namespace imports —
217
225
  * 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
226
+ * @throws Error naming the method when an input or output is no schema
220
227
  */
221
228
  export declare const generate_action_inputs_outputs: (specs: ReadonlyArray<ActionSpecUnion>, imports: ImportBuilder, options?: {
222
229
  specs_module?: string;
@@ -256,7 +263,7 @@ export declare const generate_action_event_datas: (specs: ReadonlyArray<ActionSp
256
263
  *
257
264
  * Imports are registered per emitted line — only what the spec set actually references shows up on
258
265
  * `imports`. A spec set with no async methods skips `RpcClientCallOptions`;
259
- * one with no inputs skips `ActionInputs`; sync `local_call` methods with
266
+ * one with no inputs skips `ActionCallInputs`; sync `local_call` methods with
260
267
  * `sync_returns_value: true` (the default) skip `Result` / `JsonrpcErrorObject`.
261
268
  *
262
269
  * The interface name is fixed at `FrontendActionsApi` — the symmetric counterpart
@@ -297,7 +304,7 @@ export declare const generate_frontend_action_handlers: (specs: ReadonlyArray<Ac
297
304
  * exclusion list.
298
305
  *
299
306
  * Adds the `* as specs` namespace import (from `specs_module`), the
300
- * `ActionInputs` type import (from `collections_path`), and the
307
+ * `ActionCallInputs` type import (from `collections_path`), and the
301
308
  * `ActionSpecUnion` type import.
302
309
  *
303
310
  * Method signature shape today is `(input) => Promise<void>` — matches the
@@ -1 +1 @@
1
- {"version":3,"file":"action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,CAAC;IAAC,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAAE,KACzE,MA+BF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,4BAA4B,GACxC,OAAO,aAAa,CAAC,eAAe,CAAC,EACrC,SAAS,aAAa,EACtB,UAAU;IACT,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' : '';
@@ -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,27 +650,37 @@ ${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 `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.
663
669
  *
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.
670
+ * Adds `import type {Infer, InferInput} from '@fuzdev/fuz_schema/schema.ts';`
671
+ * and the `* as specs` namespace import.
667
672
  *
668
673
  * @param options.qualify_spec - per-spec qualified identifier callback for
669
674
  * multi-source consumers. The helper appends `.input` / `.output` to the
670
675
  * callback's return value. When set, the helper skips the default
671
676
  * `* as specs` import — the consumer manages its own namespace imports —
672
677
  * 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
678
+ * @throws Error naming the method when an input or output is no schema
675
679
  */
676
680
  export const generate_action_inputs_outputs = (specs, imports, options) => {
677
681
  const filtered = filter_protocol_actions(specs, options?.include_protocol_actions);
678
682
  if (filtered.length === 0) {
679
- // Empty spec list — emit minimal valid output and skip the `zod` /
683
+ // Empty spec list — emit minimal valid output and skip the `Infer` /
680
684
  // `* as specs` imports that would have nothing to reference.
681
685
  return `/**
682
686
  * Action parameter schemas indexed by method name.
@@ -686,6 +690,12 @@ export const generate_action_inputs_outputs = (specs, imports, options) => {
686
690
  export const ActionInputs = {} as const;
687
691
  export interface ActionInputs {}
688
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
+
689
699
  /**
690
700
  * Action result schemas indexed by method name.
691
701
  * These represent the output data for each action,
@@ -694,28 +704,26 @@ export interface ActionInputs {}
694
704
  export const ActionOutputs = {} as const;
695
705
  export interface ActionOutputs {}`;
696
706
  }
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');
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');
706
712
  const qualify = resolve_spec_qualifier(imports, options);
707
- const infer = (library) => library === 'zod' ? 'z.infer' : 'Infer';
708
713
  const inputs_value = filtered
709
714
  .map((s) => `\t${to_action_property_key(s.method)}: ${qualify(s)}.input,`)
710
715
  .join('\n');
711
716
  const inputs_type = filtered
712
- .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>;`)
713
721
  .join('\n');
714
722
  const outputs_value = filtered
715
723
  .map((s) => `\t${to_action_property_key(s.method)}: ${qualify(s)}.output,`)
716
724
  .join('\n');
717
725
  const outputs_type = filtered
718
- .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>;`)
719
727
  .join('\n');
720
728
  return `/**
721
729
  * Action parameter schemas indexed by method name.
@@ -729,6 +737,14 @@ export interface ActionInputs {
729
737
  ${inputs_type}
730
738
  }
731
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
+
732
748
  /**
733
749
  * Action result schemas indexed by method name.
734
750
  * These represent the output data for each action,
@@ -807,7 +823,7 @@ ${lines.join('\n')}
807
823
  *
808
824
  * Imports are registered per emitted line — only what the spec set actually references shows up on
809
825
  * `imports`. A spec set with no async methods skips `RpcClientCallOptions`;
810
- * one with no inputs skips `ActionInputs`; sync `local_call` methods with
826
+ * one with no inputs skips `ActionCallInputs`; sync `local_call` methods with
811
827
  * `sync_returns_value: true` (the default) skip `Result` / `JsonrpcErrorObject`.
812
828
  *
813
829
  * The interface name is fixed at `FrontendActionsApi` — the symmetric counterpart
@@ -897,7 +913,7 @@ ${lines};
897
913
  * exclusion list.
898
914
  *
899
915
  * Adds the `* as specs` namespace import (from `specs_module`), the
900
- * `ActionInputs` type import (from `collections_path`), and the
916
+ * `ActionCallInputs` type import (from `collections_path`), and the
901
917
  * `ActionSpecUnion` type import.
902
918
  *
903
919
  * Method signature shape today is `(input) => Promise<void>` — matches the
@@ -927,18 +943,18 @@ export const generate_backend_actions_api = (specs, imports, options) => {
927
943
  */`;
928
944
  if (broadcast.length === 0) {
929
945
  // No backend-initiated remote_notifications — skip `* as specs` and
930
- // `ActionInputs` imports that would have nothing to reference.
946
+ // `ActionCallInputs` imports that would have nothing to reference.
931
947
  return `${interface_doc}
932
948
  export interface BackendActionsApi {}
933
949
 
934
950
  export const broadcast_action_specs: ReadonlyArray<ActionSpecUnion> = [];`;
935
951
  }
936
952
  const collections_path = options?.collections_path ?? DEFAULT_COLLECTIONS_PATH;
937
- imports.add_type(collections_path, 'ActionInputs');
953
+ imports.add_type(collections_path, 'ActionCallInputs');
938
954
  const qualify = resolve_spec_qualifier(imports, options);
939
955
  const interface_body = '\n' +
940
956
  broadcast
941
- .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>;`)
942
958
  .join('\n') +
943
959
  '\n';
944
960
  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;AAmBhF,MAAM,MAAM,yBAAyB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,IAAI,CACxE,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACvC,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACvC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,KACvB,IAAI,CAAC;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;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GAAI,OAAO,SAAS,MAAM,GAAG,MAAM,EAC5E,MAAM,oBAAoB,CAAC,OAAO,CAAC,EACnC,aAAa,sBAAsB,KACjC,WAAW,CAAC,OAAO,CAOrB,CAAC"}
@@ -6,13 +6,14 @@
6
6
  *
7
7
  * @module
8
8
  */
9
+ import { parse } from '@fuzdev/fuz_schema/schema.ts';
9
10
  import { create_uuid } from '../primitive_schemas.js';
10
11
  import { to_error_message } from '@fuzdev/fuz_util/error.ts';
11
12
  import { create_jsonrpc_request, create_jsonrpc_response, create_jsonrpc_error_response, create_jsonrpc_notification, to_jsonrpc_params, is_jsonrpc_error_response } from '../http/jsonrpc_helpers.js';
12
13
  import { dev_only, jsonrpc_error_messages, to_thrown_jsonrpc_error, UNKNOWN_ERROR_MESSAGE } from '../http/jsonrpc_errors.js';
13
14
  import { safe_parse_dropping_unknown_keys } from '../http/schema_helpers.js';
14
15
  import { resolve_issues_invalid_reason } from '../schema_meta.js';
15
- import { format_issues, parse_any, to_wire_issues } from '../schema_issues.js';
16
+ import { format_issues, to_wire_issues } from '../schema_issues.js';
16
17
  import { validate_step_transition, validate_phase_transition, should_validate_output, is_action_complete, create_initial_data, get_initial_phase, is_request_response, is_send_request_with_parsed_input, is_notification_send_with_parsed_input } from './action_event_helpers.js';
17
18
  /**
18
19
  * `error.data.reason` on the `internal_error` a client reports when a
@@ -28,7 +29,7 @@ export const ERROR_RESPONSE_OUTPUT_INVALID = 'response_output_invalid';
28
29
  */
29
30
  const to_local_invalid_params_data = (input, issues, value) => {
30
31
  const reason = resolve_issues_invalid_reason(input, issues, value);
31
- const validation_errors = to_wire_issues(issues, value);
32
+ const validation_errors = to_wire_issues(issues);
32
33
  return reason === undefined ? { validation_errors } : { validation_errors, reason };
33
34
  };
34
35
  /**
@@ -128,7 +129,7 @@ export class ActionEvent {
128
129
  else {
129
130
  this.#transition_to_error_phase('receive_error', jsonrpc_error_messages.internal_error(`response failed output validation for ${this.spec.method}: ${format_issues(parsed.issues)}`, {
130
131
  reason: ERROR_RESPONSE_OUTPUT_INVALID,
131
- validation_errors: to_wire_issues(parsed.issues, this.#data.output)
132
+ validation_errors: to_wire_issues(parsed.issues)
132
133
  }));
133
134
  }
134
135
  return this;
@@ -139,7 +140,7 @@ export class ActionEvent {
139
140
  return this;
140
141
  }
141
142
  }
142
- const parsed = parse_any(this.spec.input, this.#data.input);
143
+ const parsed = parse(this.spec.input, this.#data.input);
143
144
  if (parsed.ok) {
144
145
  this.#transition_step('parsed', { input: parsed.value });
145
146
  }
@@ -372,12 +373,12 @@ export class ActionEvent {
372
373
  }
373
374
  #complete_handling(output) {
374
375
  if (output !== undefined && should_validate_output(this.spec.kind, this.#data.phase)) {
375
- const parsed = parse_any(this.spec.output, output);
376
+ const parsed = parse(this.spec.output, output);
376
377
  if (parsed.ok) {
377
378
  this.#transition_step('handled', { output: parsed.value });
378
379
  }
379
380
  else {
380
- this.#fail(jsonrpc_error_messages.validation_error(`failed to parse output: ${format_issues(parsed.issues)}`, { output, validation_errors: to_wire_issues(parsed.issues, output) }));
381
+ this.#fail(jsonrpc_error_messages.validation_error(`failed to parse output: ${format_issues(parsed.issues)}`, { output, validation_errors: to_wire_issues(parsed.issues) }));
381
382
  }
382
383
  }
383
384
  else {