/** * Auto-Yes duration definitions (Issue #3913) * * The one definition of how long an Auto-Yes grant may last: any whole number * of hours from 1 to 24. Server (route, state), browser (confirm dialog, new * task) and CLI (`--duration`) all read it from here. * * Dependency-free on purpose: no `@/` alias and no safe-regex2, so the CLI * build (tsconfig.cli.json sets `"paths": {}`) can re-export it through a * relative path (`src/cli/config/duration-constants.ts`) instead of keeping a * copy. `scripts/orchestrate/launch-worker.mjs` cannot import TypeScript and * copies only {@link AUTO_YES_DURATION_FLAG_PATTERN}; a unit test keeps the * copy equal to this one. */ /** Milliseconds per hour */ export declare const AUTO_YES_MS_PER_HOUR = 3600000; /** Shortest grant, in hours */ export declare const MIN_AUTO_YES_HOURS = 1; /** Longest grant, in hours (agreed upper bound, 2026-10-25) */ export declare const MAX_AUTO_YES_HOURS = 24; /** * Every allowed duration in milliseconds: 1h, 2h, ..., 24h. * * Written out as literals so {@link AutoYesDuration} stays a literal union — * a `number` would let NaN, Infinity and fractions through the type. */ export declare const AUTO_YES_DURATIONS: readonly [3600000, 7200000, 10800000, 14400000, 18000000, 21600000, 25200000, 28800000, 32400000, 36000000, 39600000, 43200000, 46800000, 50400000, 54000000, 57600000, 61200000, 64800000, 68400000, 72000000, 75600000, 79200000, 82800000, 86400000]; /** Auto-Yes duration type (literal union of the 24 values in AUTO_YES_DURATIONS) */ export type AutoYesDuration = typeof AUTO_YES_DURATIONS[number]; /** The often-used durations offered as one-tap choices (1h / 3h / 8h) */ export declare const PRESET_AUTO_YES_DURATIONS: readonly [3600000, 10800000, 28800000]; /** Default Auto-Yes duration (1 hour = 3600000ms) */ export declare const DEFAULT_AUTO_YES_DURATION: AutoYesDuration; /** * Type guard: check whether a value is one of the 24 allowed durations. * Rejects every non-number, NaN, ±Infinity, fractions of an hour and values * outside 1〜24h. */ export declare function isAllowedDuration(value: unknown): value is AutoYesDuration; /** Whole hours of an allowed duration (e.g. 18000000 → 5) */ export declare function autoYesDurationToHours(duration: AutoYesDuration): number; /** The duration for a whole number of hours, or null outside 1〜24 */ export declare function hoursToAutoYesDuration(hours: number): AutoYesDuration | null; /** * The CLI `--duration` format: `1h`〜`24h`, lower-case `h`, no leading zero, * sign, whitespace, fraction or other unit. */ export declare const AUTO_YES_DURATION_FLAG_PATTERN: RegExp; /** How the CLI help and errors name the accepted range */ export declare const AUTO_YES_DURATION_FLAG_RANGE = "1h-24h, whole hours"; /** * Parse a CLI `--duration` value (e.g. '5h') to milliseconds. * @returns The duration, or null when the value is not `1h`〜`24h` */ export declare function parseAutoYesDurationFlag(flag: string): AutoYesDuration | null; //# sourceMappingURL=auto-yes-duration.d.ts.map