/** * Automatic first-run migration executor: project-tier signaldock.db → conduit.db. * * Implements ADR-037 §8 — on the first cleo invocation after upgrading to * v2026.4.12, if a project-tier `.cleo/signaldock.db` exists and * `.cleo/conduit.db` does not, this module migrates all project-local data to * conduit.db and copies global-identity rows to the global-tier signaldock.db. * * Key properties: * - Idempotent: `needsSignaldockToConduitMigration` returns false once conduit.db exists. * - Atomic per file: transactions are used for conduit.db and global signaldock.db writes. * - Non-destructive: legacy signaldock.db is renamed to `.pre-t310.bak`, not deleted. * - Multi-project safe: `INSERT OR IGNORE` prevents duplicate global rows when multiple * projects migrate the same agent. * - Migrated agents flagged `requires_reauth=1` (new KDF scheme, ADR-037 §5). * * @task T358 * @epic T310 * @why ADR-037 §8 — automatic first-run migration from the pre-T310 project-tier * signaldock.db to the new T310 topology (conduit.db + global signaldock.db * + global-salt). Runs once per project on first cleo invocation after upgrade. */ /** * Result returned by `migrateSignaldockToConduit`. * * @task T358 * @epic T310 */ export interface MigrationResult { /** `migrated` = migration ran and succeeded; `no-op` = not needed; `failed` = error occurred. */ status: 'migrated' | 'no-op' | 'failed'; /** Absolute path to the project root that was migrated. */ projectRoot: string; /** Number of agents copied to global signaldock.db. */ agentsCopied: number; /** Absolute path to the conduit.db that was created. */ conduitPath: string; /** Absolute path to the global signaldock.db. */ globalSignaldockPath: string; /** Absolute path to the legacy `.pre-t310.bak` file, or null if rename did not complete. */ bakPath: string | null; /** Errors encountered during migration steps. Never thrown — always captured here. */ errors: Array<{ step: string; error: string; }>; } /** * Returns true when the legacy migration is needed for the given project. * * Detection heuristic (ADR-037 §8): * - `.cleo/signaldock.db` EXISTS AND `.cleo/conduit.db` DOES NOT EXIST * * Idempotent: returns false once conduit.db is present, regardless of .bak state. * * @param projectRoot - Absolute path to the project root directory. * @returns True if migration is needed; false otherwise. * * @task T358 * @epic T310 */ export declare function needsSignaldockToConduitMigration(projectRoot: string): boolean; /** * Runs the signaldock.db → conduit.db migration for the given project. * * The migration is atomic per file (SQLite transactions for DB writes, atomic * rename for the backup step). Failures are captured in `result.errors` and * the function never throws — callers receive a `MigrationResult` with * `status: 'failed'` on error. * * Safe to call when no migration is needed (returns `{status: 'no-op', ...}`). * Safe to call on a partially-migrated install (idempotent via needsMigration check). * * @param projectRoot - Absolute path to the project root directory. * @returns A `MigrationResult` describing what was done and any errors encountered. * * @task T358 * @epic T310 */ export declare function migrateSignaldockToConduit(projectRoot: string): Promise; //# sourceMappingURL=migrate-signaldock-to-conduit.d.ts.map