/** * Library-mode live workflow-event tail for {@link LocalClient}. * * Server mode rides the `/watch` WebSocket channel; library mode has the engine * in-process, so it iterates the engine's own {@link WorkflowHandle} event * stream — the same primitive `handle.addEventListener` already uses — and maps * each dispatched `Event` into the transport-neutral {@link WorkflowEvent} * record (`{ type, timestamp, data }`). That mapping mirrors the server's * watch-channel serialization, so both clients deliver the same event records * and terminate on the same lifecycle events; only the wire in between differs. * * Like the HTTP tail, the local tail also replays the workflow's persisted * event history on connect (via `engine.getEvents`) so a tail opened after * events were already persisted still delivers them — the two transports honor * the same unified catch-up contract — deduping the overlap window so an event * present in both the replayed history and the live stream is delivered once. * * @module client/local-event-tail */ import type { Engine } from '../core/engine.ts'; import type { WorkflowEventTail } from './event-tail.ts'; /** * Build a {@link WorkflowEventTail} backed by the in-process engine. The tail * replays the workflow's persisted event history on connect, then delivers live * lifecycle/activity events until the workflow reaches a terminal state or * {@link WorkflowEventTail.close} is called. If the workflow has already * finished, the persisted history ends with the terminal event so the tail * still terminates cleanly. */ export declare function createLocalWorkflowEventTail(engine: Engine, workflowId: string): WorkflowEventTail;