import type { AgentInvocationRequest } from "#execution/tools/subagent/invoke-agent.js";
import type { RuntimeSubagentResult } from "#shared/action-types.js";
import type { HandleEventFn } from "#harness/types.js";
import { type SubagentCalledStreamEvent } from "#protocol/message.js";
import { type DurableSessionState } from "#execution/durable-session-store.js";
import type { RuntimeSubagentChildResult } from "#shared/action-types.js";
export type AgentInvocationDispatchResult = {
    readonly kind: "dispatched";
    readonly agentId: string;
    readonly event: SubagentCalledStreamEvent;
    readonly serializedContext?: Record<string, unknown>;
    readonly sessionState: DurableSessionState;
} | {
    readonly kind: "failed";
    readonly result: RuntimeSubagentResult;
    readonly serializedContext?: Record<string, unknown>;
    readonly sessionState: DurableSessionState;
};
export type TaskAgentInvocationDispatchResult = {
    readonly kind: "not-admitted";
    readonly sessionState: DurableSessionState;
} | AgentInvocationDispatchResult;
/** Dispatches one owner-scoped local or remote agent invocation. */
export declare function dispatchAgentInvocation(input: {
    readonly callbackBaseUrl: string;
    readonly emit?: HandleEventFn;
    readonly replyTo: string;
    readonly request: AgentInvocationRequest;
    readonly serializedContext: Record<string, unknown>;
    readonly sessionState: DurableSessionState;
    readonly ownerId: string;
    readonly taskId?: string | undefined;
}): Promise<AgentInvocationDispatchResult>;
/**
 * Dispatches one agent request after any task-owned invocation is admitted.
 * The callback origin is parent-owned, so it is derived from this workflow's
 * own metadata rather than accepted from the inbound request.
 */
export declare function dispatchTaskAgentInvocationStep(input: Omit<Parameters<typeof dispatchAgentInvocation>[0], "callbackBaseUrl" | "emit">): Promise<TaskAgentInvocationDispatchResult>;
/** Applies an owner-scoped child settlement to the parent session's canonical state. */
export declare function settleTaskAgentInvocationStep(input: {
    readonly accumulateUsage?: boolean;
    readonly ownerId: string;
    readonly result: RuntimeSubagentChildResult;
    readonly serializedContext: Record<string, unknown>;
    readonly sessionState: DurableSessionState;
    readonly taskId?: string | undefined;
}): Promise<{
    readonly serializedContext: Record<string, unknown>;
    readonly sessionState: DurableSessionState;
}>;
/** Releases any child leases still owned by a completed workflow-tool run. */
export declare function releaseAgentInvocationOwnerStep(input: {
    readonly cancelled?: boolean;
    readonly ownerId: string;
    readonly sessionState: DurableSessionState;
}): Promise<{
    readonly sessionState: DurableSessionState;
}>;
