/** * Atomic agent ID counter allocation. * Spec: §4.1.1 step 5 — round-2 W8 + round-3 C1/C2 * * Two-layer locking: * 1. JS-level same-process mutex (per-template) to serialize within process * 2. Cross-process file lock to serialize between processes * This prevents the failure mode where the file lock's PID check sees the same * PID twice in same-process concurrent calls and retries succeed by chance. */ /** * Validate an agent ID against the sanity regex. * * @param id - Agent ID to validate * @returns True if the id matches the regex */ export declare function isValidAgentId(id: string): boolean; /** * Sanitize a template name to be safe as the agent ID prefix. * Removes characters outside `[A-Za-z0-9_-]`. * * @param name - Template name * @returns Sanitized name (may be empty if input had no safe characters) */ export declare function sanitizeTemplateName(name: string): string; /** * For tests: reset the JS-level mutex chains. */ export declare function resetCounterChains(): void; export interface NextAgentIdParams { templateName: string; /** Absolute path to the .orca directory (where agents/ lives) */ orcaDir: string; /** Parent session info — used to populate LockInfo */ parentSession: { sessionId: string; sessionPath: string; }; } /** * Allocate the next agent ID for a given template, monotonically. * * Spec: §4.1.1 step 5 * * @param params - Parameters * @returns A monotonically increasing agent ID like "scout-1", "scout-2", ... * @throws Error if the file lock cannot be acquired after retries */ export declare function nextAgentId(params: NextAgentIdParams): Promise; //# sourceMappingURL=agent-id.d.ts.map