SoulFire TypeScript SDK 2.10.3
    Preparing search index...

    Class SoulFireTask<Result>

    A handle for a server task with a typed result.

    Starting a task waits for acceptance, not completion. Server lifecycle policies control execution after acceptance. Use wait to inspect terminal status, or result to require successful completion and decode the result.

    Observing this handle does not take ownership of the job. Interrupting an observer or result wait does not itself cancel it. Call cancel, use a run* stream, or use SoulFireBot.collect for cancellation ownership.

    Type Parameters

    • Result extends DescMessage | undefined = undefined
    Index
    • get terminal(): boolean

      Whether the cached status is completed, cancelled, failed, or timed out.

      This property does not fetch current state. Use refresh for a new snapshot.

      Returns boolean

    • Request task cancellation and update the cached snapshot.

      Parameters

      • reason: string = ""

        Explanation recorded with the cancellation request.

      • Optionaloptions: CallOptions

        RPC call options; the SDK includes any active control token.

      Returns Effect<BotTask, SoulFireOperationError>

      An Effect that produces the server's updated task snapshot.

      Inspect status when completion can race with cancellation.

    • Observe task revisions until the task ends.

      Parameters

      • Optionaloptions: { afterRevision?: bigint; call?: CallOptions }

        Revision to resume after and RPC call options. The revision defaults to the cached snapshot's revision when the stream opens.

      Returns Stream<BotTaskEvent, SoulFireOperationError>

      A lazy Stream of task events.

      Direct consumption does not update snapshot. Closing this observer does not cancel the server task.

    • Wait for successful completion and decode the typed task result.

      Parameters

      • Optionaloptions: { call?: CallOptions }

      Returns Effect<
          Result extends DescMessage ? MessageShape<Result> : BotTask,
          SoulFireOperationError,
      >

      An Effect that produces the result selected by the start method. Without a result schema, it produces the completed task snapshot.

      Failure, cancellation, timeout, or a missing or incompatible result fails with SoulFireTaskFailed in the Effect error channel. The error retains the server task snapshot. Interrupting this wait does not itself cancel the task.

      wait to inspect unsuccessful terminal states.

    • Wait for a terminal state and update snapshot.

      Parameters

      • Optionaloptions: { call?: CallOptions }

      Returns Effect<BotTask, SoulFireOperationError>

      An Effect that produces a snapshot for any terminal status, including failure and cancellation. Use result to require success.

      Returns immediately if the cached state is terminal. Otherwise, consumes updates and fetches state if the event stream ends before a terminal update. Interrupting this wait does not itself cancel the server task.