Sanity Library Reference Docs
    Preparing search index...
    • Drive a workflow instance reactively from any document store. Watches the instance and its SubscriptionDocument set through the supplied WorkflowObserver, feeds their optimistic values into the engine's session ready-gated, and re-evaluates as they change. The session never advances on its own — the consumer calls tick/fireAction, which commit through the engine's own (lake-guarded) client, not the store. A settled commit re-evaluates immediately — surfaces repaint without waiting for the store to echo the write.

      Parameters

      • __namedParameters: {
            engine: Engine;
            guardScope?: readonly string[];
            host?: WorkflowSessionHost;
            instanceId: string;
            observer: WorkflowObserver;
            opts?: { grantsFromPath?: string };
        }
        • engine: Engine
        • OptionalguardScope?: readonly string[]

          The id-set of every co-mounted session, handed identically to each one so the observer can consolidate guard observation into one shared live query per resource (WorkflowObserver.observeGuards sharedIds). Must include instanceId. Omitted, guards are observed per instance.

        • Optionalhost?: WorkflowSessionHost

          The adapter package hosting this session — rides the WorkflowSessionStarted adoption event, and (when set) is pushed once per host store as the surface user property so the host's session stream is sliceable per surface. Adapters pass theirs; a direct consumer is custom (never pushed — an unknown host's stream is not ours to stamp).

        • instanceId: string
        • observer: WorkflowObserver
        • Optionalopts?: { grantsFromPath?: string }

      Returns WorkflowSession