/** * Auto-Yes handling for `send`, split out of `send.ts` (Issue #4128). */ import type { SendOptions } from '../types'; import type { AutoYesContractPolicy, AutoYesSetResult } from '../types/api-responses'; import { ApiClient } from '../utils/api-client'; import type { RelayEndpointArg } from './relays'; /** * Resolve --duration to milliseconds, exiting on an invalid value. * * Issue #1608: this is called from the option-validation block at the top of * the action, not from enableAutoYes(). enableAutoYes() runs after --contract * has already created the task row, so validating there left a `pending` task * behind for a message that was never sent. */ export declare function resolveAutoYesDurationMs(duration: string | undefined): number; /** * Build auto-yes request body and send it to the API (DRY extraction). * * @param client - API client instance * @param worktreeId - Target worktree ID * @param options - Send command options containing auto-yes settings * @param durationMs - Duration already validated by resolveAutoYesDurationMs() * @param agent - CLI tool resolved for --instance (Issue #1629), else --agent * @param contractPolicy - The policy of the contract this send created (Issue #3723), else null * @param onlyIfOff - Refuse if a grant is on by the time it arrives (Issue #4132) * @param replyTo - The `--reply-to` relay still to be opened after arming (Issue #4449) * @param taskId - The task of `--contract`: the grant goes to its recorded target (Issue #4449) */ export declare function enableAutoYes(client: ApiClient, worktreeId: string, options: SendOptions, durationMs: number, agent: string | undefined, instanceId: string | undefined, contractPolicy?: AutoYesContractPolicy | null, onlyIfOff?: boolean, replyTo?: RelayEndpointArg, taskId?: string): Promise; /** The command that does what this send's --auto-yes asked for, on its own. */ export declare function enableAutoYesCommand(worktreeId: string, options: SendOptions, agent: string | undefined, instanceId: string | undefined): string; /** * {@link enableAutoYes} once the message has gone out (Issue #4159). Whatever fails here is * a warning and the send stays a success, as with {@link registerInstance}: an error exit * reads as "not sent", and a script reading it would send the message twice. A 5xx or no * answer may have armed it, and a grant on before this send may still be, so this says "may". */ export declare function enableAutoYesAfterSend(client: ApiClient, worktreeId: string, options: SendOptions, durationMs: number, agent: string | undefined, instanceId: string | undefined, contractPolicy: AutoYesContractPolicy | null, taskId: string | undefined): Promise; /** * This target's Auto-Yes as the server reads it now, or null when it could not be read. * Always names both: a read naming no tool answers another question. */ export declare function readAutoYes(client: ApiClient, worktreeId: string, target: { cliToolId: string; instanceId: string; }): Promise | null>; /** The name the server gives a grant (Issue #4132). An older server gives none. */ export declare function grantIdOf(state: Pick | null | undefined): string | undefined; /** The command that stops one instance's Auto-Yes. An id that is no tool's own needs the tool as well. */ export declare function stopAutoYesCommand(worktreeId: string, instanceId: string | undefined, cliToolId: string | undefined): string; /** * Turn off the grant this send armed, and no other (Issue #4116). It is read right * before, and the request itself says which grant it means (`expectedGrantId`, Issue * #4132), so a grant someone armed since is theirs and stays, even with the same expiry. * A server too old to name its grants cannot be asked for that: with only the read to go on, * a grant armed right after it would be stopped too, so it is left on (Issue #4159). * `{ enabled: false }` naming nobody would stop * every instance of the worktree, so tool and instance are always named. A grant answered * for another target than the one read beforehand may be overwriting one that was on, * and that read says nothing about it. Anything not certain is left on, with the command * that stops it. */ export declare function withdrawArmedAutoYes(client: ApiClient, worktreeId: string, target: { cliToolId?: string; instanceId?: string; } | null, armed: AutoYesSetResult | undefined): Promise; //# sourceMappingURL=send-auto-yes.d.ts.map