import type { HarnessSession } from "#harness/types.js";
import type { BackgroundWorkflowToolRun, TaskAgentDispatchContext } from "#harness/workflow-tool-runs.js";
import type { JsonValue } from "#shared/json.js";
import type { TaskMetadata } from "#tasks/types.js";
import type { ContextReader } from "#context/key.js";
import { type SessionAuth } from "#context/keys.js";
export declare function createTaskAgentDispatchContext(ctx: ContextReader, auth: SessionAuth): TaskAgentDispatchContext;
export type BackgroundTaskDraft = Omit<BackgroundWorkflowToolRun, "address"> & {
    readonly address: {
        readonly hookToken: string;
    };
};
/** Derives the replay-stable task identity before its owning run is started. */
export declare function prepareBackgroundTask(input: {
    readonly callId: string;
    readonly dispatchContext: TaskAgentDispatchContext;
    readonly metadata: TaskMetadata;
    readonly parentSessionId: string;
    readonly parentStepIndex?: number;
    readonly parentTurnId: string;
    readonly session: HarnessSession;
}): BackgroundTaskDraft;
/** Releases task events only after the parent session index committed. */
export declare function acknowledgeDelegatedTasksStep(input: {
    readonly tasks: readonly {
        readonly taskInboxToken: string;
        readonly taskId: string;
        readonly taskRunId: string;
    }[];
}): Promise<void>;
/** Silently terminates a task whose child dispatch failed before parent indexing. */
export declare function rejectDelegatedDispatch(input: {
    readonly error: JsonValue;
    readonly task: BackgroundWorkflowToolRun;
}): Promise<void>;
