/** * Sigil sync — populate the NEXUS `sigils` table from canonical CANT agents. * * Walks the bundled `@cleocode/agents` package and upserts one sigil per * canonical agent. Canonical agents are the .cant personas that ship with * CLEO and become available globally after `cleo init` / * `installSeedAgentsGlobally`: * * - `cleo-subagent` — universal protocol base * - `project-orchestrator` — high-tier coordinator (seed) * - `project-dev-lead` — mid-tier decomposer (seed) * - `project-code-worker` — mid-tier code executor (seed) * - `project-docs-worker` — mid-tier docs executor (seed) * - `project-security-worker` — mid-tier security review (seed) * - `agent-architect` — meta-agent (synthesises agents) * - `playbook-architect` — meta-agent (synthesises .cantbook playbooks) * * Per ADR-055 D032, dogfood personas (cleo-prime, cleoos-opus-orchestrator, * etc.) are intentionally NOT included — they are not in `@cleocode/agents`. * * Sigil contents are extracted directly from each .cant file: * - peerId ← `agent :` line * - displayName ← peerId * - role ← `role:` field * - cantFile ← absolute path to the .cant file * - systemPromptFragment ← `prompt:` block when present, else `description:` * - capabilityFlags ← JSON-encoded {tier, parent, model, persist} * * Idempotent — running multiple times produces stable results. Last-writer- * wins on every field except `peerId`. * * @task T1386 * @epic T1148 */ import { type EngineResult } from '../engine-result.js'; import { resetNexusDbState } from '../store/nexus-sqlite.js'; /** * Result of {@link syncCanonicalSigils}. */ export interface SigilSyncResult { /** Total number of sigils upserted (created + updated). */ count: number; /** Peer IDs that were upserted, sorted alphabetically. */ peerIds: string[]; /** Absolute path to the seed-agents directory used for the sync. */ seedAgentsDir: string | null; /** Absolute path to the cleo-subagent.cant file used for the sync. */ cleoSubagentFile: string | null; /** Absolute path to the meta agents directory used for the sync. */ metaDir: string | null; /** Warnings encountered during sync (missing files, parse failures). */ warnings: string[]; } /** * Internal record shape parsed from a single .cant file. */ interface ParsedSigil { peerId: string; role: string; description: string; parent: string | null; tier: string | null; model: string | null; persist: string | null; systemPromptFragment: string | null; cantFile: string; } /** * Parse the minimum subset of CANT syntax needed to derive a sigil: * - The `agent :` declaration line yields the peerId. * - Top-level scalar fields (role, description, parent, tier, model, * persist) are read by their leading 2-space indent. * - The `prompt:` block (single-line `"..."` or pipe block `|`) is read * for use as the system-prompt fragment. * * This is intentionally a string scanner rather than a full CANT parser — * the canonical .cant files are stable, and depending on `@cleocode/cant` * here would create a runtime dependency cycle (cant → core → cant). * * @param cantFile - Absolute path to the .cant file. * @returns Parsed sigil fields, or `null` if the file lacks an * `agent :` declaration. */ export declare function parseSigilFromCant(cantFile: string): ParsedSigil | null; /** * Result of {@link resolveCanonicalCantFiles}. */ export interface CanonicalCantFiles { /** Absolute path to the templates directory, or `null` if not found. */ seedAgentsDir: string | null; /** Absolute path to cleo-subagent.cant, or `null` if not found. */ cleoSubagentFile: string | null; /** Absolute path to the meta-agent directory, or `null` if not found. */ metaDir: string | null; /** Absolute paths of every canonical .cant file located on disk. */ files: string[]; } /** * Resolve the absolute paths to all canonical .cant files inside the * `@cleocode/agents` package. * * Mirrors the multi-candidate resolution used by `resolveSeedAgentsDir` in * `packages/core/src/init.ts` so the same code path works across npm install, * workspace dev, and bundled CLI layouts. * * @returns Object containing the resolved directories plus the flat list of * .cant files that exist on disk. Missing files are silently skipped — * callers receive a reduced list rather than an error. */ export declare function resolveCanonicalCantFiles(): Promise; /** * Populate the `sigils` table with one row per canonical CANT agent. * * Idempotent — re-running upserts the same rows in place. Returns a summary * of what was synced so callers (init flow, CLI command) can report progress. * * @returns A {@link SigilSyncResult} summarising the upserts and any * warnings (e.g. missing files). */ export declare function syncCanonicalSigils(): Promise; /** * Reset the nexus DB singleton — re-exported so callers (notably tests) can * isolate state without reaching into another module. This is a thin * passthrough; the actual implementation lives in * `packages/core/src/store/nexus-sqlite.ts`. */ export { resetNexusDbState }; export declare function nexusSigilSync(): Promise>; //# sourceMappingURL=sigil-sync.d.ts.map