import { BaseWorkflow, type WorkflowCtx } from '@adonis-agora/durable';
import type { AgentRunInput } from '../types.js';
/**
 * The workflow input. A superset of {@link AgentRunInput} carrying the one field only the durable
 * runner threads: `sinkRunId`, the TOP-LEVEL run whose live stream this run writes into. A sub-agent
 * (child workflow) forwards its tokens into its ancestor's sink so the human watching the parent
 * sees the delegate's output; a top-level run leaves it unset (it owns its own sink, keyed by runId).
 */
export interface DurableAgentRunInput extends AgentRunInput {
    sinkRunId?: string;
}
/**
 * The agent turn AS a durable workflow — the replay-safe counterpart of `InlineAgentRunner`. The
 * shared `runAgentLoop` body drives model→tools→model exactly as inline; the durable hooks make it
 * suspend-and-resume:
 *  - `step(name, fn)` → `ctx.localStep` — every LLM turn, tool execution, and persist/quota write is a
 *    checkpoint, so a replay returns the cached result instead of re-running it (stable ids, no
 *    double-write, no re-streamed tokens). The run-tracing SPANS (`agora:agent:llm.turn` /
 *    `tool.execution` / `retrieval`) are emitted from INSIDE these step bodies, so a replay — which
 *    skips the bodies — never re-emits them. Unlike the inline runner, the durable workflow does NOT
 *    emit a body-level root `turn` span (the body replays, which would duplicate it); the trace is
 *    rooted implicitly by `traceId = runId`, which every child span already carries.
 *  - `awaitApproval(call)` / `awaitAnswers(request)` → `ctx.waitForSignal('tool:<runId>:<callId>')` —
 *    an action tool or a question set suspends the run with zero compute until an approve/reject or
 *    answers signal arrives (namespaced by run, so one run's reply can never satisfy another's).
 *    A DELEGATED run suspends the same way, on its own runId — which is what `sinkRunId` exists for:
 *    its frames land in the stream the human is already watching and carry that runId, so a
 *    sub-agent's own HITL wait can be seen, and therefore answered.
 *  - `runAgent(name, task)` → `ctx.child(AgentRunWorkflow, …)` — sub-agent delegation is a tracked,
 *    replay-safe CHILD run (a node in the durable dashboard) that streams into the top-level sink.
 *  - `startAgent(…)` → a run of its own, started from a journaled `detach:<toolCallId>` step — a
 *    DETACHED delegation: no suspend, so the turn ends with a receipt; the child owns its own stream
 *    and posts its answer into the delegating thread (`deliverTo`), and a Stop on this turn does not
 *    reach it. A run that journaled a `spawn:` (`ctx.startChild`) there before replays that.
 *  - `openSink()` → the run's own sink writer (top-level) or a {@link childSinkWriter} (a child).
 *
 * Instantiated by the engine with no arguments; its deps come from {@link getDurableAgentContext}.
 */
export declare class AgentRunWorkflow extends BaseWorkflow {
    static workflow: {
        name: string;
        version: string;
        origin: string;
    };
    run(ctx: WorkflowCtx, input: DurableAgentRunInput): Promise<{
        text: string;
    }>;
}
//# sourceMappingURL=agent-run-workflow.d.ts.map