Anchorage API reference
    Preparing search index...

    The env bindings the composed Worker reads. A host's own Env extends this (its workers-typed D1Database/DurableObjectNamespace/Queue bindings satisfy these structural subsets) and adds whatever its hooks need.

    interface FlowsafeWorkerEnv {
        APPROVAL_ALLOW_SELF_DECISION?: string;
        APPROVAL_RETENTION_DAYS?: string;
        APPROVAL_SLA_SECONDS?: string;
        AUDIT_QUEUE?: AuditQueue<ApprovalAuditEvent>;
        DB: ApprovalDatabase & SnapshotDatabase;
        HUB?: HubNamespaceLike<unknown>;
        NOTIFICATION_RETENTION_DAYS?: string;
        RUN_RETENTION_DAYS?: string;
        RUNNER: RunnerNamespaceLike;
        SCHEDULE_TRIGGER_RETENTION_DAYS?: string;
        SIEM_AUTH_HEADER?: string;
        SIEM_ENDPOINT?: string;
        STREAM_TICKET_SECRET?: string;
        THREAD_RETENTION_DAYS?: string;
        THREAD_STATE_RETENTION_DAYS?: string;
    }
    Index

    Properties

    APPROVAL_ALLOW_SELF_DECISION?: string

    Separation-of-duties exemption (var). Unset or a false spelling = SoD on (default); true = every decider may self-decide; a comma-separated role list (e.g. admin or admin,reviewer) = only those roles. Any invalid value falls back to OFF (fail closed).

    APPROVAL_RETENTION_DAYS?: string

    Cron purges DECIDED approval records older than this (var; default 30; 0 = immediately).

    APPROVAL_SLA_SECONDS?: string

    Default SLA seconds for new approvals (var; default 14400 = 4h).

    Optional audit export: queue producer binding + SIEM collector config.

    D1: the approval store AND the Mastra snapshot table live here.

    HUB?: HubNamespaceLike<unknown>

    Optional per-tenant hub Durable Object namespace for live streaming. Present together with STREAM_TICKET_SECRET => the composer mounts the stream stage and fans approval mutations out to the tenant hub; either absent => streaming stays unmounted and the client remains poll-only.

    NOTIFICATION_RETENTION_DAYS?: string

    Agent-inbox TTL in days. The purge cron reaps terminal mastra_notifications rows past this age (pending rows are never reaped — one may await a future deliverAt). UNSET/EMPTY/INVALID => the duty does not run and no notification ever expires (opt-in, like THREAD_RETENTION_DAYS — a durable inbox is meant to be readable until the host says otherwise).

    RUN_RETENTION_DAYS?: string

    Cron purges terminal run snapshots older than this (var; default 30; 0 = immediately).

    The runner DO namespace createDoRunTopology drives.

    SCHEDULE_TRIGGER_RETENTION_DAYS?: string

    Schedule-trigger history TTL in days. The purge cron reaps mastra_schedule_triggers rows past this age by their actualFireAt. UNSET/EMPTY/INVALID => the duty does not run (opt-in; a schedule's fire history is inspectable until the host sets a window). The schedule rows themselves are standing config — never TTL'd, reaped only at offboarding.

    SIEM_AUTH_HEADER?: string
    SIEM_ENDPOINT?: string
    STREAM_TICKET_SECRET?: string

    Dedicated stream-ticket signing secret. Absent means no streaming.

    THREAD_RETENTION_DAYS?: string

    Agent-memory thread TTL in days (var; docs/agent-memory-tenancy.md item 7): the purge cron deletes threads untouched for longer than this, with their messages. UNSET, EMPTY, or INVALID => the duty does not run and no thread ever expires — the opt-in default, because a thread is a conversation a host means to keep, not a terminal run snapshot that is finished by definition. There is no safe number to pick on an operator's behalf here, so anything short of a number the operator actually named is answered by NOT deleting (a config-error line marks the invalid case). Unlike RUN_RETENTION_DAYS this var decides whether an irreversible delete happens at all, so it does not take numberVar's fallback — see optionalNumberVar in env-vars.ts.

    THREAD_STATE_RETENTION_DAYS?: string

    Thread-state TTL in days. The purge cron reaps mastra_thread_state rows (state-signal lanes + goals) untouched for longer than this. UNSET/EMPTY/INVALID => the duty does not run (opt-in; an active goal bumps updatedAt so it never ages out).