Sanity Library Reference Docs
    Preparing search index...
    HistoryEntry: (
        | {
            _key: string;
            _type: "stageEntered";
            actor?: Actor;
            at: string;
            fromStage?: string;
            reason?: string;
            stage: string;
            transition?: string;
            via?: "transition"
            | "setStage";
        }
        | {
            _key: string;
            _type: "stageExited";
            actor?: Actor;
            at: string;
            reason?: string;
            stage: string;
            toStage: string;
            transition?: string;
            via?: "transition"
            | "setStage";
        }
        | {
            _key: string;
            _type: "activityStatusChanged";
            activity: string;
            actor?: Actor;
            at: string;
            from: ActivityStatus;
            stage: string;
            to: ActivityStatus;
        }
        | {
            _key: string;
            _type: "actionFired";
            action: string;
            activity: string;
            actor?: Actor;
            at: string;
            driverKind?: "person"
            | "agent"
            | "service"
            | "engine";
            stage: string;
            triggered?: true;
        }
        | {
            _key: string;
            _type: "transitionFired";
            actor?: Actor;
            at: string;
            fromStage: string;
            reason?: string;
            toStage: string;
            transition?: string;
            via?: "transition"
            | "setStage";
        }
        | {
            _key: string;
            _type: "effectQueued";
            at: string;
            effect: string;
            effectKey: string;
            origin: EffectOrigin;
        }
        | {
            _key: string;
            _type: "effectCompleted";
            actor?: Actor;
            at: string;
            detail?: string;
            effect: string;
            effectKey: string;
            outputs?: Record<string, unknown>;
            status: EffectRunStatus;
        }
        | {
            _key: string;
            _type: "effectClaimReleased";
            actor?: Actor;
            at: string;
            claim: PendingEffectClaim;
            effect: string;
            effectKey: string;
            via: "drain-takeover"
            | "sweep";
        }
        | {
            _key: string;
            _type: "spawned";
            activity: string;
            actor?: Actor;
            at: string;
            instanceRef: GlobalDocumentReference;
            rowKey?: string;
        }
        | {
            _key: string;
            _type: "subworkflowAdopted";
            activity: string;
            at: string;
            instanceRef: GlobalDocumentReference;
            rowKey: string;
            stage: string;
        }
        | {
            _key: string;
            _type: "subworkflowResolved";
            activity: string;
            at: string;
            instanceRef: GlobalDocumentReference;
            status: "done"
            | "aborted";
        }
        | {
            _key: string;
            _type: "subworkflowOrphaned";
            at: string;
            detail: string;
            instanceRef: GlobalDocumentReference;
        }
        | {
            _key: string;
            _type: "aborted";
            actor?: Actor;
            at: string;
            reason?: string;
            stage: string;
        }
        | {
            _key: string;
            _type: "opApplied";
            action?: string;
            activity?: string;
            actor?: Actor;
            at: string;
            edit?: true;
            effect?: string;
            opType: string;
            resolved?: Record<string, unknown>;
            stage: string;
            target?: { field: string; scope: FieldScope };
        }
        | {
            _key: string;
            _type: "fieldQueryDiscarded";
            at: string;
            detail: string;
            field: string;
            scope: FieldScope;
        }
    ) & { executionContext?: ExecutionContext }

    One appended audit row. Every actor stamp on one is token-resolved advisory provenance, never authenticated identity — the lake's own document history is the authenticated ground truth.

    On the three stage-movement arms, via discriminates a condition-driven transition ('transition', the default when absent) from an admin override ('setStage'), and the reason beside it is that override's free text.

    Type declaration

    • {
          _key: string;
          _type: "stageEntered";
          actor?: Actor;
          at: string;
          fromStage?: string;
          reason?: string;
          stage: string;
          transition?: string;
          via?: "transition" | "setStage";
      }
    • {
          _key: string;
          _type: "stageExited";
          actor?: Actor;
          at: string;
          reason?: string;
          stage: string;
          toStage: string;
          transition?: string;
          via?: "transition" | "setStage";
      }
    • {
          _key: string;
          _type: "activityStatusChanged";
          activity: string;
          actor?: Actor;
          at: string;
          from: ActivityStatus;
          stage: string;
          to: ActivityStatus;
      }
    • {
          _key: string;
          _type: "actionFired";
          action: string;
          activity: string;
          actor?: Actor;
          at: string;
          driverKind?: "person" | "agent" | "service" | "engine";
          stage: string;
          triggered?: true;
      }
      • _key: string
      • _type: "actionFired"
      • action: string
      • activity: string
      • Optionalactor?: Actor
      • at: string
      • OptionaldriverKind?: "person" | "agent" | "service" | "engine"
      • stage: string
      • Optionaltriggered?: true

        The engine fired this action in a cascade: actor is the cascading token that executed it, not a caller who invoked fireAction.

    • {
          _key: string;
          _type: "transitionFired";
          actor?: Actor;
          at: string;
          fromStage: string;
          reason?: string;
          toStage: string;
          transition?: string;
          via?: "transition" | "setStage";
      }
    • {
          _key: string;
          _type: "effectQueued";
          at: string;
          effect: string;
          effectKey: string;
          origin: EffectOrigin;
      }
    • {
          _key: string;
          _type: "effectCompleted";
          actor?: Actor;
          at: string;
          detail?: string;
          effect: string;
          effectKey: string;
          outputs?: Record<string, unknown>;
          status: EffectRunStatus;
      }
    • {
          _key: string;
          _type: "effectClaimReleased";
          actor?: Actor;
          at: string;
          claim: PendingEffectClaim;
          effect: string;
          effectKey: string;
          via: "drain-takeover" | "sweep";
      }
      • _key: string
      • _type: "effectClaimReleased"
      • Optionalactor?: Actor
      • at: string
      • claim: PendingEffectClaim
      • effect: string
      • effectKey: string
      • via: "drain-takeover" | "sweep"

        drain-takeover = a drain redispatched it; sweep = sweepStaleClaims released it.

    • {
          _key: string;
          _type: "spawned";
          activity: string;
          actor?: Actor;
          at: string;
          instanceRef: GlobalDocumentReference;
          rowKey?: string;
      }
      • _key: string
      • _type: "spawned"
      • activity: string
      • Optionalactor?: Actor
      • at: string
      • instanceRef: GlobalDocumentReference
      • OptionalrowKey?: string

        Identity of the forEach row that produced this child.

    • {
          _key: string;
          _type: "subworkflowAdopted";
          activity: string;
          at: string;
          instanceRef: GlobalDocumentReference;
          rowKey: string;
          stage: string;
      }
    • {
          _key: string;
          _type: "subworkflowResolved";
          activity: string;
          at: string;
          instanceRef: GlobalDocumentReference;
          status: "done" | "aborted";
      }
    • {
          _key: string;
          _type: "subworkflowOrphaned";
          at: string;
          detail: string;
          instanceRef: GlobalDocumentReference;
      }
      • _key: string
      • _type: "subworkflowOrphaned"
      • at: string
      • detail: string
      • instanceRef: GlobalDocumentReference

        A child naming this instance in its ancestors reached terminal, but no registry row matches it — its completion cannot drive any gate. A loud dead-end record.

    • {
          _key: string;
          _type: "aborted";
          actor?: Actor;
          at: string;
          reason?: string;
          stage: string;
      }
    • {
          _key: string;
          _type: "opApplied";
          action?: string;
          activity?: string;
          actor?: Actor;
          at: string;
          edit?: true;
          effect?: string;
          opType: string;
          resolved?: Record<string, unknown>;
          stage: string;
          target?: { field: string; scope: FieldScope };
      }
      • _key: string
      • _type: "opApplied"
      • Optionalaction?: string
      • Optionalactivity?: string

        The op's boundary: an action fire sets activity + action; an edit sets edit (plus activity for an activity-scope field); completion ops set effect.

      • Optionalactor?: Actor
      • at: string
      • Optionaledit?: true
      • Optionaleffect?: string
      • opType: string
      • Optionalresolved?: Record<string, unknown>
      • stage: string
      • Optionaltarget?: { field: string; scope: FieldScope }
    • {
          _key: string;
          _type: "fieldQueryDiscarded";
          at: string;
          detail: string;
          field: string;
          scope: FieldScope;
      }
    • OptionalexecutionContext?: ExecutionContext

      The execution environment that committed this entry — inferred runtime plus the host's declared {kind, id} (see ExecutionContext). Stamped centrally at persist time on every entry the engine appends; absent only on entries stored before the stamp existed.