A11 TypeScript API - v0.2.1
    Preparing search index...

    Class Action

    One schema-described unit of local work or remote agent work.

    An action binds an ActionSchema to input/output AsyncNodes and, for a local run, an application handler. It is a one-shot state machine: configure the id, schema, collaborators, headers, and port mappings; then choose run for local execution or call for remote dispatch. Configuration that changes identity or port shape is frozen after start.

    Remote calls have two milestones. waitForDispatch reports whether the peer accepted the action, while wait follows its eventual status after handler and output-writer cleanup. Local handlers can create children with makeNested; a shared session applies nested limits and includes tracked children in session-wide abort, but each child has an independent cancellation signal.

    Index
    • get signal(): AbortSignal

      AbortSignal a handler can observe for cooperative cancellation.

      Returns AbortSignal

    • Materialize schema autofills into empty input nodes before a handler runs.

      Returns Promise<Status>

    • Request cooperative cancellation once.

      Local handlers observe signal; remote calls also send the reserved cancellation action. cancel() initiates the transition—await wait() if teardown and output abort propagation must be complete.

      Returns Status

    • Parameters

      • name: string

      Returns boolean

    • Copy framework-scoped metadata to a nested action.

      Parameters

      • target: Action
      • prefix: string = ACTION_HEADER_PREFIX

      Returns Status

    • Parameters

      • name: string

      Returns StatusOr<Uint8Array<ArrayBufferLike> | null>

    • Open a named input node and optionally mirror local writes to the peer.

      Parameters

      • name: string
      • OptionalbindStream: boolean

      Returns Promise<StatusOr<AsyncNode>>

    • Open a named output node and optionally mirror local writes to the peer.

      Parameters

      • name: string
      • OptionalbindStream: boolean

      Returns Promise<StatusOr<AsyncNode>>

    • Parameters

      • name: string

      Returns boolean

    • Create a child action from a schema or registered name.

      With propagateIo, the child shares the parent's node map, stream, and session, while retaining its own id, derived port ids, and AbortSignal. The registry is shared in either mode, and framework headers are forwarded when forwardHeaders is true. A shared session supplies nested concurrency limits and session-wide abort; cancelling only the parent is not recursive.

      Parameters

      • schemaOrName: string | ActionSchema
      • propagateIo: boolean = true
      • forwardHeaders: boolean = true

      Returns StatusOr<Action>

    • Replace the call id and remap default port ids before starting.

      Parameters

      • id: string

      Returns Status

    • Await the remote dispatch acknowledgement, not handler completion.

      Parameters

      • OptionaltimeoutMs: number

      Returns Promise<Status>

    • Derive the stable action-id#port-name id for one action port node.

      Parameters

      • actionId: string
      • nodeName: string

      Returns StatusOr<string>