import type { ToolCall } from "../types.js"; export type TaskUpdateState = "pending" | "in_progress" | "done" | "failed" | "skipped"; export interface TaskUpdateIntent { readonly call: ToolCall; readonly taskId: string; readonly state: string; } export interface BatchTaskDescriptor { readonly taskId: string; readonly title: string; readonly targetState: string; } export interface DependencyReminderInput { readonly taskId: string; readonly title: string; readonly targetState: string; readonly blockers: readonly { readonly id: string; readonly title: string; }[]; } /** Read the taskId/state pair a task.update call is asserting (raw, unresolved). */ export declare function readTaskUpdateArgs(call: ToolCall): { taskId: string; state: string; } | undefined; /** Distinct task ids advanced to done/in_progress across the given intents. */ export declare function distinctAdvancingTaskIds(intents: readonly TaskUpdateIntent[]): string[]; /** Distinct task ids per advancing state in one message. */ export declare function advancingStateCounts(intents: readonly TaskUpdateIntent[]): { done: number; inProgress: number; }; /** * True only when a single message advances too many tasks to be a healthy * lockstep handoff. Closing one task and opening the next (≤1 done AND ≤1 * in_progress) is allowed; completing several at once, or opening several at * once, is what we hold for verification. */ export declare function isSimultaneousTaskAdvance(intents: readonly TaskUpdateIntent[]): boolean; /** Stable signature for a set of intents so an identical re-issue confirms it. */ export declare function batchUpdateSignature(intents: readonly TaskUpdateIntent[]): string; /** Stable signature for opening a single task before its dependencies land. */ export declare function dependencySignature(taskId: string, state: string, blockerIds: readonly string[]): string; /** * Model-facing reminder for a simultaneous multi-task update. Instructs the * model to confirm by re-issuing the identical calls, or to sync one by one. */ export declare function buildMultiUpdateReminder(descriptors: readonly BatchTaskDescriptor[]): string; export declare function buildDependencyReminder(input: DependencyReminderInput): string; /** Distinct task ids a message tries to open (`in_progress`) at once. */ export declare function openingTaskIds(intents: readonly TaskUpdateIntent[]): string[]; /** * Model-facing rejection for opening several tasks in one message. Unlike the * batch-completion hold this is not confirmable: `count(active foreground * tasks) <= 1` is a persistence invariant, so a confirmed multi-open would only * be demoted again on commit. */ export declare function buildMultiOpenRejection(descriptors: readonly BatchTaskDescriptor[]): string; /** Short, identifiable toast for a rejected multi-open. */ export declare function multiOpenToast(count: number): string; /** Short, identifiable toast for a batched multi-task update. */ export declare function multiUpdateToast(count: number): string; /** Short, identifiable toast for opening a task before its dependencies. */ export declare function dependencyToast(taskId: string): string;