/** * GroupRegistry — single authoritative source for group state. * * Module-level singleton with JSONL persistence at * ~/.mcp-codex-subagent/groups/.jsonl * * Mirrors TaskStore patterns: explicit state machine, bounded, * deterministic transitions. */ import { type GroupState, type AgentState, type GroupRecord, type AgentRecord, type AgentSpec } from './types.js'; export interface CreateGroupOptions { agents: AgentSpec[]; baseCwd: string; dependsOn: string[]; groupName?: string; branch?: string; worktreePath?: string; baseCommit?: string; } export declare class GroupRegistry { private readonly groups; createGroup(opts: CreateGroupOptions): GroupRecord; transitionGroup(id: string, newState: GroupState, opts?: { error?: string; commitSha?: string; baseCommit?: string; }): boolean; transitionAgent(groupId: string, alias: string, newState: AgentState, opts?: { error?: string; taskId?: string; pid?: number; }): boolean; /** * Increment the attempt counter for an agent. */ incrementAttempts(groupId: string, alias: string): void; getGroup(id: string): GroupRecord | undefined; getAllGroups(): GroupRecord[]; getAllNonTerminal(): GroupRecord[]; getAgent(groupId: string, alias: string): AgentRecord | undefined; /** * Check if all agents in a group have reached terminal states. */ allAgentsTerminal(groupId: string): boolean; /** * Check whether all dependencies are met for a group. * Returns 'met' if all dep groups are done_success, * 'failed' if any dep group is done_failed or done_timeout, * 'pending' if any dep group is still running. */ areDependenciesMet(dependsOn: string[]): 'met' | 'pending' | 'failed'; /** * Check if all agents that completed successfully. */ allAgentsSucceeded(groupId: string): boolean; /** * Write the group record to disk as JSONL. * Full rewrite (groups are small; simpler than append-only). */ persist(id: string): void; /** * Load all group records from disk on startup. */ loadAll(): void; resetForTesting(): void; private generateUniqueId; } export declare const groupRegistry: GroupRegistry; //# sourceMappingURL=registry.d.ts.map