/** * Pure state-change → stimulus translator for the flow connector. * * Given the previous and current {@link FlowExecution} snapshots, decides * whether the runner should be woken with a fresh turn and (if so) what * kind of stimulus to render. Returns `null` when no turn is warranted * (e.g. the snapshots are deep-equal). * * Today's FlowOrchestrator subscribes to `adapter.onStateChange(...)` and * forwards the snapshot to the host without kicking a turn — the host * issues explicit turn-kicking commands (`approve_flow_node`, etc.). Phase * 3 of the flow-connector extraction adds this function as the connector- * side decision point so a future direct path (FlowAdapter → * SessionStimulusBus → runner) can reproduce today's coalesced "state * changed → maybe a turn" semantics without going through the orchestrator. * * Default behaviour mirrors today exactly: any structural change in the * FlowExecution snapshot produces a single `{ kind: "state_changed" }` * stimulus. Phase 4 may refine this with kind discriminators (approval- * received, input-received, etc.) once the orchestrator's onStateChange * subscription is removed; until then we keep gating purely on equality. * * @docLink packages/factory-assets/flow#stimulus-driver */ import type { FlowExecution } from "@skaile/workspaces/types"; import type { TurnStimulus } from "./prompt-fragments.js"; /** * Decide whether a state transition warrants kicking an agent turn, and * which kind of stimulus to render. Returns `null` to suppress turn-kicking * when nothing observable changed. * * Pure — depends only on its inputs. * * @param oldExec - Previous FlowExecution snapshot (or `undefined` on the * first emission, e.g. immediately after `connect()`). * @param newExec - Current FlowExecution snapshot. * @returns A {@link TurnStimulus} when a turn should be kicked, or `null`. * * @docLink packages/factory-assets/flow#compute-stimulus */ export declare function computeStimulus(oldExec: FlowExecution | undefined, newExec: FlowExecution): TurnStimulus | null; //# sourceMappingURL=stimulus-driver.d.ts.map