Anchorage API reference
    Preparing search index...
    Index

    Constructors

    Accessors

    • get executionFence(): ExecutionFenceStore | undefined

      The deployment execution fence this runtime enforces, or undefined when the host built an unfenced runtime. Exposed so the surfaces ABOVE the runtime — the run object's routes, the thread DO's signal routes — gate on the same store rather than constructing a second one, and so DurableObjectRunner can assert that a runtime built against a bound database is never fence-less.

      Returns ExecutionFenceStore | undefined

    • get pubsub(): PubSub | undefined

      The host pubsub identity this runtime was built with, or undefined when the host configured none. Exposed so callers can verify the identity and so an agent runner sharing this runtime's isolate takes THIS instance rather than building a second feed.

      Returns PubSub | undefined

    • get startIdempotency(): StartIdempotencyStore | undefined

      The deployment's start reservations, or undefined for a host with no database to reserve against. Exposed for the same reason the fence is: the surfaces ABOVE this runtime reserve and claim against it, and two stores over two bindings would be two different tables answering the same key.

      Returns StartIdempotencyStore | undefined

    Methods

    • status() for a caller about to CONCLUDE something irreversible from what it reads — delete a wake record, spend an abandonment budget, resume a run.

      Mastra answers a state read from an in-memory Run whenever storage is unavailable or the row lookup comes back empty while this isolate still holds the run, and that fallback reports the Run object's own status ('pending' until something updates it) with no suspended paths and no requestContext at all. Projecting it is indistinguishable from evidence about the run. Mastra stamps isFromInMemory on it at its single construction site and the persisted branch builds its result field by field without ever copying the marker, so this throws on exactly the reads that did not reach storage. null still means the read SUCCEEDED and found nothing.

      status() stays the projection read, unchanged for every existing caller: a summary is still the best answer an HTTP status route can give.

      Parameters

      • workflowId: string
      • runId: string

      Returns Promise<RunSummary | null>

    • Marks idempotent terminal side-effect cleanup after every hook succeeds.

      Parameters

      • workflowId: string
      • runId: string
      • expectedRevision: number
      • now: number = ...

      Returns Promise<RunSummary>

    • Is this run EXECUTING in this isolate right now?

      The liveness half of the idempotent-start replay decision, answered from the same #activeRuns map the cancel path uses — the runtime's own record of runs it is currently driving. It is in-memory ON PURPOSE: liveness is a property of an isolate that is running code, and any durable proxy for it (a journal, a heartbeat, a timestamp) would keep saying "live" after the isolate that wrote it was evicted, which is precisely the case the probe exists to detect.

      A false here therefore means "not running HERE", which is authoritative only where the run has exactly one possible host — a run Durable Object addressed by idFromName(workflowId:runId), or the thread object an agent run is bound to. Callers that probe across an object boundary must ask the object that owns the run, never their own runtime.

      Parameters

      • workflowId: string
      • runId: string

      Returns boolean

    • Reconcile an interrupted start against the token stored in the authoritative workflow snapshot. Mastra's createRun() first persists a tokenless pending shell; if no executed snapshot replaced it, the shell is abandoned and must not become a successful FlowSafe run.

      Parameters

      • workflowId: string
      • runId: string
      • attemptToken: string

      Returns Promise<RunSummary | null>

    • Register an agent that a runtime-owned workflow resolves by id.

      Durable-agent workflows persist only the agent id. Keeping the raw agent on the same Mastra instance as the workflow lets a resumed run resolve it after isolate eviction, when the original DurableAgent instance is gone.

      Type Parameters

      • TAgentId extends string
      • TTools extends ToolsInput
      • TOutput

      Parameters

      Returns void

    • The PROJECTION read: the best answer available about a run, which is what an HTTP status route, a broadcast frame or an existence check wants.

      It can answer from Mastra's in-memory fallback, so a caller about to conclude something IRREVERSIBLE from what it reads — deleting wake state, spending an abandonment budget, resuming a run, deleting a row — must use RunnerRuntime.authoritativeStatus instead, which refuses a read that did not reach storage.

      Parameters

      • workflowId: string
      • runId: string

      Returns Promise<RunSummary | null>