actions/action_event.ts view source
import {ActionEvent} from '@fuzdev/fuz_app/actions/action_event.js'; Action event that manages the lifecycle of an action through its state machine.
generics
ActionEvent<TMethod extends string = string, TPhase extends ActionEventPhase = ActionEventPhase, TStep extends ActionEventStep = ActionEventStep>TMethod
stringstringTPhase
TStep
environment
spec
method narrows to TMethod so consumers passing a typed TApi to
create_rpc_client get event.spec.method typed as the union of
their API's method names rather than plain string. The runtime
value comes from lookup_action_spec(method) keyed off the Proxy
get trap, so the narrowing matches the dispatched method.
type (RequestResponseActionSpec & { method: TMethod; }) | (RemoteNotificationActionSpec & { method: TMethod; }) | (LocalCallActionSpec & { method: TMethod; })
constructor
type new <TMethod extends string = string, TPhase extends ActionEventPhase = "send_request" | "receive_request" | "send_response" | "receive_response" | "send_error" | "receive_error" | "send" | "receive" | "execute", TStep extends ActionEventStep = "initial" | ... 3 more ... | "failed">(environment: ActionEventEnvironment, spec: ActionSpecUnion, data: ActionEventDataUnion<...>): ActionEvent<...>
environment
spec
data
toJSON
type (): ActionEventDataUnion<TMethod>
observe
Subscribe a listener fired on every data transition.
type (listener: ActionEventChangeObserver<TMethod>): () => void
listener
called with (new_data, old_data, event) after each mutation
ActionEventChangeObserver<TMethod>() => voidunsubscribe function
mutates
this— adds `listener` to the internal observer set
set_data
Replace the event's data and notify observers.
type (new_data: ActionEventDataUnion<TMethod>): void
new_data
voidmutates
this— sets `data` and fires every registered observer in insertion order
parse
Parse the event's payload against the action's schemas — spec.input
for outgoing and incoming calls, spec.output for a received response.
A received response's result is validated like any other inbound data,
except that keys spec.output doesn't declare are dropped rather than
refused (safe_parse_dropping_unknown_keys). On success output becomes
the parsed value (brands, defaults, and transforms applied); on any
other mismatch the event moves to receive_error with an
internal_error whose data.reason is ERROR_RESPONSE_OUTPUT_INVALID
(the remote broke its contract — not the caller's input), the same path
an error response takes.
type (): this
thisthis for chaining with handle_async / handle_sync
throws
Error- if called from a step other than `initial`
mutates
this— transitions step from `initial` to `parsed` (or to `failed` / `receive_error` on validation or response error)
handle_async
Execute the handler for the current phase.
type (): Promise<void>
Promise<void>throws
Error- if called from a step other than `parsed` (or `failed`, which no-ops). Handler-thrown `ThrownJsonrpcError` is caught and routed through error phases; other throws are wrapped as `internal_error` carrying the thrown message (see `#to_handler_error`).
mutates
this— transitions step `parsed → handling → handled`, or to `failed` / `send_error` / `receive_error` on handler throw. No-op when already `failed`.
handle_sync
Execute handler synchronously (only for sync local_call actions).
type (): void
voidthrows
Error- if the spec is not a sync `local_call`, or if called from a step other than `parsed` (or `failed`, which no-ops).
mutates
this— transitions step `parsed → handling → handled`, or to `failed` on handler throw. No-op when already `failed`.
transition
Transition to a new phase.
type (phase: "send_request" | "receive_request" | "send_response" | "receive_response" | "send_error" | "receive_error" | "send" | "receive" | "execute"): void
phase
the next phase to transition into
voidthrows
Error- if called from a step other than `handled` (or `failed`, which no-ops), or if the phase transition is illegal for the current phase
mutates
this— replaces `data` with a fresh phase-initial record, carrying forward `request` / `response` / `error` / `output` as appropriate for the kind/phase pair
is_complete
type (): boolean
booleanupdate_progress
type (progress: unknown): void
progress
unknownvoidset_request
type (request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>): void
request
voidset_response
type (response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<...>; jsonrpc: "2.0"; id: string | ... 1 more ... | null; } & Record<...>)): void
response
voidset_notification
type (notification: { method: string; jsonrpc: "2.0"; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>): void
notification
voiddata
type ({ kind: "request_response"; phase: "send_request"; step: "initial"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_request"; step: "parsed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_request"; step: "handling"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_request"; step: "handled"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_request"; step: "failed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: ({ method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>) | null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_request"; step: "initial"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_request"; step: "parsed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_request"; step: "handling"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_request"; step: "handled"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_request"; step: "failed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_response"; step: "initial"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: null; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_response"; step: "parsed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: null; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_response"; step: "handling"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_response"; step: "handled"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_response"; step: "failed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_response"; step: "initial"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: null; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_response"; step: "parsed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: null; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_response"; step: "handling"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_response"; step: "handled"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_response"; step: "failed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_error"; step: "initial"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: null; request: ({ method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>) | null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_error"; step: "parsed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: null; request: ({ method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>) | null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_error"; step: "handling"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: ({ method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>) | null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "send_error"; step: "handled"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: ({ method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>) | null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_error"; step: "initial"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: null; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_error"; step: "parsed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: null; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_error"; step: "handling"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "request_response"; phase: "receive_error"; step: "handled"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: { method: string; jsonrpc: "2.0"; id: string | number; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; response: ({ jsonrpc: "2.0"; id: string | number; result: unknown; } & Record<string, unknown>) | ({ error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; jsonrpc: "2.0"; id: string | number | null; } & Record<string, unknown>); notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "send"; step: "initial"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "send"; step: "parsed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "send"; step: "handling"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: unknown; request: null; response: null; notification: { method: string; jsonrpc: "2.0"; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "send"; step: "handled"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: unknown; request: null; response: null; notification: { method: string; jsonrpc: "2.0"; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "send"; step: "failed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: null; response: null; notification: ({ method: string; jsonrpc: "2.0"; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>) | null; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "receive"; step: "initial"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: null; response: null; notification: { method: string; jsonrpc: "2.0"; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "receive"; step: "parsed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: null; response: null; notification: { method: string; jsonrpc: "2.0"; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "receive"; step: "handling"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: unknown; request: null; response: null; notification: { method: string; jsonrpc: "2.0"; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "receive"; step: "handled"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: unknown; request: null; response: null; notification: { method: string; jsonrpc: "2.0"; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; } & { phase: TPhase; step: TStep; }) | ({ kind: "remote_notification"; phase: "receive"; step: "failed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: null; response: null; notification: { method: string; jsonrpc: "2.0"; params?: ({} & Record<string, unknown>) | undefined; } & Record<string, unknown>; } & { phase: TPhase; step: TStep; }) | ({ kind: "local_call"; phase: "execute"; step: "initial"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "local_call"; phase: "execute"; step: "parsed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: null; request: null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "local_call"; phase: "execute"; step: "handling"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: null; progress: unknown; request: null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "local_call"; phase: "execute"; step: "handled"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: unknown; error: null; progress: unknown; request: null; response: null; notification: null; } & { phase: TPhase; step: TStep; }) | ({ kind: "local_call"; phase: "execute"; step: "failed"; method: TMethod; executor: "frontend" | "backend"; input: unknown; output: null; error: { code: -32700 | -32600 | -32601 | -32602 | -32603 | Branded<number, "JsonrpcServerErrorCode">; message: string; data?: unknown; } & Record<string, unknown>; progress: unknown; request: null; response: null; notification: null; } & { phase: TPhase; step: TStep; })