Action event that manages the lifecycle of an action through its state machine.
generics
TMethod
TEnvironment
TPhase
TStep
environment
type TEnvironment
spec
type ActionSpecUnion
constructor
type new <TMethod extends ActionMethod = "completion_create" | "completion_progress" | "directory_create" | "diskfile_delete" | "diskfile_update" | "filer_change" | "ollama_copy" | "ollama_create" | ... 11 more ... | "toggle_main_menu", TEnvironment extends ActionEventEnvironment = ActionEventEnvironment, TPhase extends ActionEventPhase = "send_request" | ... 7 more ... | "execute", TStep extends ActionEventStep = "initial" | ... 3 more ... | "failed">(environment: TEnvironment, spec: { ...; } | ... 1 more ... | { ...; }, data: ActionEventDatas[TMethod]): ActionEvent<...>
environment
TEnvironmentspec
{ method: "completion_create" | "completion_progress" | "directory_create" | "diskfile_delete" | "diskfile_update" | "filer_change" | "ollama_copy" | "ollama_create" | "ollama_delete" | ... 10 more ... | "toggle_main_menu"; ... 6 more ...; async: true; } | { ...; } | { ...; }data
ActionEventDatas[TMethod]toJSON
type (): ActionEventDatas[TMethod]
ActionEventDatas[TMethod]observe
type (listener: ActionEventChangeObserver<TMethod>): () => void
listener
ActionEventChangeObserver<TMethod>() => voidset_data
type (new_data: ActionEventDatas[TMethod]): void
new_data
ActionEventDatas[TMethod]voidparse
Parse input data according to the action's schema.
type (): this
thishandle_async
Execute the handler for the current phase.
type (): Promise<void>
Promise<void>handle_sync
Execute handler synchronously (only for sync local_call actions).
type (): void
voidtransition
Transition to a new phase.
type (phase: "send_request" | "receive_request" | "send_response" | "receive_response" | "send_error" | "receive_error" | "send" | "receive" | "execute"): void
phase
"send_request" | "receive_request" | "send_response" | "receive_response" | "send_error" | "receive_error" | "send" | "receive" | "execute"voidis_complete
type (): boolean
booleanupdate_progress
type (progress: unknown): void
progress
unknownvoidset_request
type (request: { [x: string]: unknown; jsonrpc: "2.0"; id: string | number; method: string; params?: { [x: string]: unknown; _meta?: { [x: string]: unknown; progressToken?: string | number | undefined; } | undefined; } | undefined; }): void
request
{ [x: string]: unknown; jsonrpc: "2.0"; id: string | number; method: string; params?: { [x: string]: unknown; _meta?: { [x: string]: unknown; progressToken?: string | number | undefined; } | undefined; } | undefined; }voidset_response
type (response: { [x: string]: unknown; jsonrpc: "2.0"; id: string | number; result: { [x: string]: unknown; _meta?: { [x: string]: unknown; } | undefined; }; } | { [x: string]: unknown; jsonrpc: "2.0"; id: string | number | null; error: { [x: string]: unknown; code: -32700 | ... 4 more ... | (number & $brand<...>); message: string; data?: unknown; }; }): void
response
{ [x: string]: unknown; jsonrpc: "2.0"; id: string | number; result: { [x: string]: unknown; _meta?: { [x: string]: unknown; } | undefined; }; } | { [x: string]: unknown; jsonrpc: "2.0"; id: string | number | null; error: { [x: string]: unknown; code: -32700 | ... 4 more ... | (number & $brand<...>); message: string...voidset_notification
type (notification: { [x: string]: unknown; jsonrpc: "2.0"; method: string; params?: { [x: string]: unknown; _meta?: { [x: string]: unknown; } | undefined; } | undefined; }): void
notification
{ [x: string]: unknown; jsonrpc: "2.0"; method: string; params?: { [x: string]: unknown; _meta?: { [x: string]: unknown; } | undefined; } | undefined; }void