/** * * Purpose: * Build a dry-run-only autonomous RD swarm planner that turns a * user-supplied goal + change-id + mode into a *resumable* plan: * goal package (done / resume conditions), capability reuse list, * checkpoint queue, worker-queue placeholders (no spawn), evidence * requirements, and resume instructions. * * - `validateChangeId` + `planArtifactPath` + `buildWorkspaceUnavailable` * - `planRdSwarmGraph` shape from `src/services/rd-swarm/rd-swarm-service.ts` * * Style: * - Named function exports — matches `rd-swarm-service.ts` + `artifact-boundary.ts`. * - Hand-rolled `Result` unions — no `neverthrow` dep. * - Pure path math + intentional capability fs reads (no side effects). * - No real workers, no MCP install, no settings mutation, no target-repo edit. * * Hard ban: * - MUST NOT install / invoke / import any external skill or MCP server. * - MUST NOT launch workers or mutate the target repo. * - MUST NOT touch `src/services/openspec/artifact-boundary.ts`, * `src/services/tech/`, or `src/services/rd-swarm/`. */ import { buildWorkspaceUnavailable, type Result, type BoundaryError } from '../openspec/artifact-boundary.js'; export type AutonomousMode = 'code' | 'team'; export type GoalCommandMarker = { marker: '/goal'; nonDurable: true; notes: string; }; export type AutonomousGoalPackage = { changeId: string; goal: string; mode: AutonomousMode; autonomyMode: 'dry-run'; nonGoals: string[]; doneCondition: string; resumeCondition: string; riskNotes: string[]; goalCommand?: GoalCommandMarker; }; export type CheckpointStatus = 'pending' | 'verified' | 'failed'; export type Checkpoint = { id: string; name: string; evidencePath: string; status: CheckpointStatus; }; export type WorkerQueueEntry = { taskId: string; wave: string; status: 'planned' | 'running' | 'done' | 'blocked'; briefPath: string; dependsOn: string[]; }; export type EvidenceRequirement = { id: string; kind: 'validation-report' | 'coverage-report' | 'reducer-report'; path: string; required: boolean; }; export type CapabilityEntry = { source: string; purpose: string; trustLevel: 'internal' | 'external' | 'unknown'; activation: string; risk: string; }; export type CapabilityReuseResult = { entries: CapabilityEntry[]; truncated: boolean; warnings: string[]; }; export type ResumeInstructions = { summary: string; steps: string[]; checkpointStates: Array<{ id: string; status: CheckpointStatus; }>; }; export type AutonomousRdPlan = { changeId: string; goal: string; mode: AutonomousMode; autonomyMode: 'dry-run'; available: boolean; goalPackage: AutonomousGoalPackage; capabilityReuse: CapabilityReuseResult; checkpoints: Checkpoint[]; workerQueue: WorkerQueueEntry[]; evidence: EvidenceRequirement[]; artifactRoot: string; gateStatus: { techApprovalRequired: boolean; techStatus: string; skipReason?: string; }; blockedReasons: string[]; nextActions: string[]; resumeInstructions: ResumeInstructions; }; export type BuildAutonomousGoalPackageInput = { changeId: string; goal: string; mode: AutonomousMode; maxWorkers: number; dryRun: true; workspaceRoot: string; }; export type PlanAutonomousRdSwarmInput = BuildAutonomousGoalPackageInput & { requiresTechApproval?: boolean; }; export declare function buildAutonomousGoalPackage(input: BuildAutonomousGoalPackageInput): AutonomousGoalPackage; export declare function planCapabilityReuse(input: { workspaceRoot: string; }): CapabilityReuseResult; export declare function buildResumeInstructions(plan: AutonomousRdPlan): ResumeInstructions; export declare function planAutonomousRdSwarm(input: PlanAutonomousRdSwarmInput): AutonomousRdPlan; export type { Result, BoundaryError }; export { buildWorkspaceUnavailable };