@cleocode/cleo 2026.3.44 → 2026.3.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -9123,7 +9123,7 @@ var init_tasks_schema = __esm({
9123
9123
  "supersedes"
9124
9124
  ];
9125
9125
  LIFECYCLE_TRANSITION_TYPES = ["automatic", "manual", "forced"];
9126
- EXTERNAL_LINK_TYPES = ["created", "matched", "manual"];
9126
+ EXTERNAL_LINK_TYPES = ["created", "matched", "manual", "transferred"];
9127
9127
  SYNC_DIRECTIONS = ["inbound", "outbound", "bidirectional"];
9128
9128
  tasks = sqliteTable(
9129
9129
  "tasks",
@@ -10583,7 +10583,9 @@ function getBrainDbPath(cwd) {
10583
10583
  function resolveBrainMigrationsFolder() {
10584
10584
  const __filename = fileURLToPath(import.meta.url);
10585
10585
  const __dirname = dirname3(__filename);
10586
- return join7(__dirname, "..", "..", "migrations", "drizzle-brain");
10586
+ const isBundled = __dirname.endsWith("/dist") || __dirname.endsWith("\\dist");
10587
+ const pkgRoot = isBundled ? join7(__dirname, "..") : join7(__dirname, "..", "..");
10588
+ return join7(pkgRoot, "migrations", "drizzle-brain");
10587
10589
  }
10588
10590
  function tableExists(nativeDb, tableName) {
10589
10591
  const result = nativeDb.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(tableName);
@@ -10827,7 +10829,9 @@ function getNexusDbPath() {
10827
10829
  function resolveNexusMigrationsFolder() {
10828
10830
  const __filename = fileURLToPath2(import.meta.url);
10829
10831
  const __dirname = dirname4(__filename);
10830
- return join8(__dirname, "..", "..", "migrations", "drizzle-nexus");
10832
+ const isBundled = __dirname.endsWith("/dist") || __dirname.endsWith("\\dist");
10833
+ const pkgRoot = isBundled ? join8(__dirname, "..") : join8(__dirname, "..", "..");
10834
+ return join8(pkgRoot, "migrations", "drizzle-nexus");
10831
10835
  }
10832
10836
  function tableExists2(nativeDb, tableName) {
10833
10837
  const result = nativeDb.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(tableName);
@@ -11018,7 +11022,7 @@ function getDbPath(cwd) {
11018
11022
  return join9(getCleoDirAbsolute(cwd), DB_FILENAME3);
11019
11023
  }
11020
11024
  async function autoRecoverFromBackup(nativeDb, dbPath, cwd) {
11021
- const log9 = getLogger("sqlite");
11025
+ const log10 = getLogger("sqlite");
11022
11026
  try {
11023
11027
  const countResult = nativeDb.prepare("SELECT COUNT(*) as cnt FROM tasks").get();
11024
11028
  const taskCount = countResult?.cnt ?? 0;
@@ -11039,7 +11043,7 @@ async function autoRecoverFromBackup(nativeDb, dbPath, cwd) {
11039
11043
  if (backupTaskCount < MIN_BACKUP_TASK_COUNT) {
11040
11044
  return;
11041
11045
  }
11042
- log9.warn(
11046
+ log10.warn(
11043
11047
  { dbPath, backupPath: newestBackup.path, backupTasks: backupTaskCount },
11044
11048
  `Empty database detected with ${backupTaskCount}-task backup available. Auto-recovering from backup. This likely happened because git-tracked WAL/SHM files were overwritten during a branch switch (T5188).`
11045
11049
  );
@@ -11057,7 +11061,7 @@ async function autoRecoverFromBackup(nativeDb, dbPath, cwd) {
11057
11061
  const tempPath = dbPath + ".recovery-tmp";
11058
11062
  copyFileSync3(newestBackup.path, tempPath);
11059
11063
  renameSync(tempPath, dbPath);
11060
- log9.info(
11064
+ log10.info(
11061
11065
  { dbPath, backupPath: newestBackup.path, restoredTasks: backupTaskCount },
11062
11066
  "Database auto-recovered from backup successfully."
11063
11067
  );
@@ -11067,7 +11071,7 @@ async function autoRecoverFromBackup(nativeDb, dbPath, cwd) {
11067
11071
  runMigrations(restoredNativeDb, restoredDb);
11068
11072
  _db2 = restoredDb;
11069
11073
  } catch (err) {
11070
- log9.error({ err, dbPath }, "Auto-recovery from backup failed. Continuing with empty database.");
11074
+ log10.error({ err, dbPath }, "Auto-recovery from backup failed. Continuing with empty database.");
11071
11075
  }
11072
11076
  }
11073
11077
  async function getDb(cwd) {
@@ -11098,7 +11102,7 @@ async function getDb(cwd) {
11098
11102
  const { execFileSync: execFileSync17 } = await import("node:child_process");
11099
11103
  const gitCwd = resolve3(dbPath, "..", "..");
11100
11104
  const filesToCheck = [dbPath, dbPath + "-wal", dbPath + "-shm"];
11101
- const log9 = getLogger("sqlite");
11105
+ const log10 = getLogger("sqlite");
11102
11106
  for (const fileToCheck of filesToCheck) {
11103
11107
  try {
11104
11108
  execFileSync17("git", ["ls-files", "--error-unmatch", fileToCheck], {
@@ -11106,7 +11110,7 @@ async function getDb(cwd) {
11106
11110
  stdio: "pipe"
11107
11111
  });
11108
11112
  const basename19 = fileToCheck.split(/[\\/]/).pop();
11109
- log9.warn(
11113
+ log10.warn(
11110
11114
  { path: fileToCheck },
11111
11115
  `${basename19} is tracked by project git \u2014 this risks data loss on branch switch. Run: git rm --cached ${fileToCheck.replace(gitCwd + sep, "")} (see ADR-013, T5188)`
11112
11116
  );
@@ -11128,7 +11132,9 @@ async function getDb(cwd) {
11128
11132
  function resolveMigrationsFolder() {
11129
11133
  const __filename = fileURLToPath3(import.meta.url);
11130
11134
  const __dirname = dirname5(__filename);
11131
- return join9(__dirname, "..", "..", "migrations", "drizzle-tasks");
11135
+ const isBundled = __dirname.endsWith("/dist") || __dirname.endsWith("\\dist");
11136
+ const pkgRoot = isBundled ? join9(__dirname, "..") : join9(__dirname, "..", "..");
11137
+ return join9(pkgRoot, "migrations", "drizzle-tasks");
11132
11138
  }
11133
11139
  function tableExists3(nativeDb, tableName) {
11134
11140
  const result = nativeDb.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(tableName);
@@ -14396,6 +14402,37 @@ function buildExportPackage(tasks2, options) {
14396
14402
  relationshipGraph
14397
14403
  };
14398
14404
  }
14405
+ function exportSingle(taskId, allTasks, projectName) {
14406
+ const task = allTasks.find((t) => t.id === taskId);
14407
+ if (!task) return null;
14408
+ return buildExportPackage([task], {
14409
+ mode: "single",
14410
+ rootTaskIds: [taskId],
14411
+ includeChildren: false,
14412
+ projectName
14413
+ });
14414
+ }
14415
+ function exportSubtree(rootId, allTasks, projectName) {
14416
+ const root = allTasks.find((t) => t.id === rootId);
14417
+ if (!root) return null;
14418
+ const collected = /* @__PURE__ */ new Map();
14419
+ const queue = [rootId];
14420
+ while (queue.length > 0) {
14421
+ const id = queue.shift();
14422
+ const task = allTasks.find((t) => t.id === id);
14423
+ if (!task || collected.has(id)) continue;
14424
+ collected.set(id, task);
14425
+ const children = allTasks.filter((t) => t.parentId === id);
14426
+ queue.push(...children.map((c) => c.id));
14427
+ }
14428
+ const tasks2 = [...collected.values()];
14429
+ return buildExportPackage(tasks2, {
14430
+ mode: "subtree",
14431
+ rootTaskIds: [rootId],
14432
+ includeChildren: true,
14433
+ projectName
14434
+ });
14435
+ }
14399
14436
  var EXPORT_FORMAT_VERSION;
14400
14437
  var init_export2 = __esm({
14401
14438
  "packages/core/src/store/export.ts"() {
@@ -14856,20 +14893,7 @@ function topologicalSort(tasks2) {
14856
14893
  }
14857
14894
  return sorted;
14858
14895
  }
14859
- async function importTasksPackage(params) {
14860
- const { file: file2 } = params;
14861
- try {
14862
- await access2(file2, fsConstants2.R_OK);
14863
- } catch {
14864
- throw new Error(`Export file not found: ${file2}`);
14865
- }
14866
- const content = await readFile4(file2, "utf-8");
14867
- let exportPkg;
14868
- try {
14869
- exportPkg = JSON.parse(content);
14870
- } catch {
14871
- throw new Error(`Invalid JSON in: ${file2}`);
14872
- }
14896
+ async function importFromPackage(exportPkg, options = {}) {
14873
14897
  if (exportPkg._meta?.format !== "cleo-export") {
14874
14898
  throw new Error(
14875
14899
  `Invalid export format (expected 'cleo-export', got '${exportPkg._meta?.format}')`
@@ -14878,16 +14902,16 @@ async function importTasksPackage(params) {
14878
14902
  if (!exportPkg.tasks?.length) {
14879
14903
  throw new Error("Export package contains no tasks");
14880
14904
  }
14881
- const accessor = await getAccessor(params.cwd);
14905
+ const accessor = await getAccessor(options.cwd);
14882
14906
  const { tasks: existingTasks } = await accessor.queryTasks({});
14883
- const onConflict = params.onConflict ?? "fail";
14884
- const onMissingDep = params.onMissingDep ?? "strip";
14885
- const force = params.force ?? false;
14886
- const parentId = params.parent;
14887
- const phaseOverride = params.phase;
14888
- const addLabel = params.addLabel;
14889
- const resetStatus = params.resetStatus;
14890
- const addProvenance = params.provenance !== false;
14907
+ const onConflict = options.onConflict ?? "fail";
14908
+ const onMissingDep = options.onMissingDep === "fail" ? "fail" : "strip";
14909
+ const force = options.force ?? false;
14910
+ const parentId = options.parent;
14911
+ const phaseOverride = options.phase;
14912
+ const addLabel = options.addLabel;
14913
+ const resetStatus = options.resetStatus;
14914
+ const addProvenance = options.provenance !== false;
14891
14915
  if (parentId) {
14892
14916
  const parentExists = existingTasks.some((t) => t.id === parentId);
14893
14917
  if (!parentExists) {
@@ -14956,7 +14980,7 @@ async function importTasksPackage(params) {
14956
14980
  existingTitles.add(remapped.title.toLowerCase());
14957
14981
  existingIds.add(remapped.id);
14958
14982
  }
14959
- if (params.dryRun) {
14983
+ if (options.dryRun) {
14960
14984
  return {
14961
14985
  imported: transformed.length,
14962
14986
  skipped: skipped.length,
@@ -14976,6 +15000,33 @@ async function importTasksPackage(params) {
14976
15000
  idRemap: idRemapJson
14977
15001
  };
14978
15002
  }
15003
+ async function importTasksPackage(params) {
15004
+ const { file: file2 } = params;
15005
+ try {
15006
+ await access2(file2, fsConstants2.R_OK);
15007
+ } catch {
15008
+ throw new Error(`Export file not found: ${file2}`);
15009
+ }
15010
+ const content = await readFile4(file2, "utf-8");
15011
+ let exportPkg;
15012
+ try {
15013
+ exportPkg = JSON.parse(content);
15014
+ } catch {
15015
+ throw new Error(`Invalid JSON in: ${file2}`);
15016
+ }
15017
+ return importFromPackage(exportPkg, {
15018
+ cwd: params.cwd,
15019
+ dryRun: params.dryRun,
15020
+ parent: params.parent,
15021
+ phase: params.phase,
15022
+ addLabel: params.addLabel,
15023
+ provenance: params.provenance,
15024
+ resetStatus: params.resetStatus,
15025
+ onConflict: params.onConflict,
15026
+ onMissingDep: params.onMissingDep === "placeholder" ? "strip" : params.onMissingDep,
15027
+ force: params.force
15028
+ });
15029
+ }
14979
15030
  var init_import_tasks = __esm({
14980
15031
  "packages/core/src/admin/import-tasks.ts"() {
14981
15032
  "use strict";
@@ -34542,7 +34593,7 @@ async function ensureInjection(projectRoot) {
34542
34593
  }
34543
34594
  }
34544
34595
  const agentsMdPath = join36(projectRoot, "AGENTS.md");
34545
- const agentsMdLines = ["@~/.cleo/templates/CLEO-INJECTION.md"];
34596
+ const agentsMdLines = ["@~/.agents/AGENTS.md"];
34546
34597
  const projectContextPath = join36(projectRoot, ".cleo", "project-context.json");
34547
34598
  if (existsSync33(projectContextPath)) {
34548
34599
  agentsMdLines.push("@.cleo/project-context.json");
@@ -34555,7 +34606,8 @@ async function ensureInjection(projectRoot) {
34555
34606
  if (contributorBlock) {
34556
34607
  agentsMdLines.push(contributorBlock);
34557
34608
  }
34558
- const agentsAction = await inject2(agentsMdPath, agentsMdLines.join("\n"));
34609
+ const agentsMdContent = agentsMdLines.join("\n");
34610
+ const agentsAction = await inject2(agentsMdPath, agentsMdContent);
34559
34611
  actions.push(`AGENTS.md CLEO content (${agentsAction})`);
34560
34612
  const content = getInjectionTemplateContent();
34561
34613
  if (content) {
@@ -34570,8 +34622,9 @@ async function ensureInjection(projectRoot) {
34570
34622
  try {
34571
34623
  const globalAgentsDir = getAgentsHome();
34572
34624
  const globalAgentsMd = join36(globalAgentsDir, "AGENTS.md");
34625
+ const globalHubContent = "@~/.cleo/templates/CLEO-INJECTION.md";
34573
34626
  await mkdir4(globalAgentsDir, { recursive: true });
34574
- await inject2(globalAgentsMd, "@~/.cleo/templates/CLEO-INJECTION.md");
34627
+ await inject2(globalAgentsMd, globalHubContent);
34575
34628
  } catch {
34576
34629
  }
34577
34630
  return {
@@ -35079,7 +35132,7 @@ async function ensureProjectContext(projectRoot, opts) {
35079
35132
  try {
35080
35133
  const schemaPath = join37(
35081
35134
  dirname8(fileURLToPath4(import.meta.url)),
35082
- "../../schemas/project-context.schema.json"
35135
+ "../schemas/project-context.schema.json"
35083
35136
  );
35084
35137
  if (existsSync34(schemaPath)) {
35085
35138
  const AjvModule2 = await import("ajv");
@@ -35520,11 +35573,9 @@ async function ensureGlobalTemplates() {
35520
35573
  return { action: "created", path: injectionPath };
35521
35574
  }
35522
35575
  async function ensureGlobalScaffold() {
35523
- const { ensureGlobalSchemas: ensureGlobalSchemas2 } = await Promise.resolve().then(() => (init_schema_management(), schema_management_exports));
35524
35576
  const home = await ensureGlobalHome();
35525
- const schemas = ensureGlobalSchemas2();
35526
35577
  const templates2 = await ensureGlobalTemplates();
35527
- return { home, schemas, templates: templates2 };
35578
+ return { home, templates: templates2 };
35528
35579
  }
35529
35580
  function checkGlobalHome() {
35530
35581
  const cleoHome = getCleoHome();
@@ -35658,7 +35709,7 @@ metrics/
35658
35709
  .backups/
35659
35710
  backups/
35660
35711
  `;
35661
- REQUIRED_GLOBAL_SUBDIRS = ["schemas", "templates"];
35712
+ REQUIRED_GLOBAL_SUBDIRS = ["logs", "templates"];
35662
35713
  }
35663
35714
  });
35664
35715
 
@@ -43370,6 +43421,338 @@ var init_sharing = __esm({
43370
43421
  }
43371
43422
  });
43372
43423
 
43424
+ // packages/core/src/reconciliation/link-store.ts
43425
+ import { randomUUID as randomUUID4 } from "node:crypto";
43426
+ import { and as and5, eq as eq8 } from "drizzle-orm";
43427
+ async function getLinksByProvider(providerId, cwd) {
43428
+ const db = await getDb(cwd);
43429
+ const rows = await db.select().from(externalTaskLinks).where(eq8(externalTaskLinks.providerId, providerId));
43430
+ return rows.map(rowToLink);
43431
+ }
43432
+ async function getLinkByExternalId(providerId, externalId, cwd) {
43433
+ const db = await getDb(cwd);
43434
+ const rows = await db.select().from(externalTaskLinks).where(
43435
+ and5(
43436
+ eq8(externalTaskLinks.providerId, providerId),
43437
+ eq8(externalTaskLinks.externalId, externalId)
43438
+ )
43439
+ );
43440
+ return rows.length > 0 ? rowToLink(rows[0]) : null;
43441
+ }
43442
+ async function getLinksByTaskId(taskId, cwd) {
43443
+ const db = await getDb(cwd);
43444
+ const rows = await db.select().from(externalTaskLinks).where(eq8(externalTaskLinks.taskId, taskId));
43445
+ return rows.map(rowToLink);
43446
+ }
43447
+ async function createLink(params, cwd) {
43448
+ const db = await getDb(cwd);
43449
+ const now2 = (/* @__PURE__ */ new Date()).toISOString();
43450
+ const id = randomUUID4();
43451
+ await db.insert(externalTaskLinks).values({
43452
+ id,
43453
+ taskId: params.taskId,
43454
+ providerId: params.providerId,
43455
+ externalId: params.externalId,
43456
+ externalUrl: params.externalUrl ?? null,
43457
+ externalTitle: params.externalTitle ?? null,
43458
+ linkType: params.linkType,
43459
+ syncDirection: params.syncDirection ?? "inbound",
43460
+ metadataJson: params.metadata ? JSON.stringify(params.metadata) : "{}",
43461
+ linkedAt: now2,
43462
+ lastSyncAt: now2
43463
+ });
43464
+ return {
43465
+ id,
43466
+ taskId: params.taskId,
43467
+ providerId: params.providerId,
43468
+ externalId: params.externalId,
43469
+ externalUrl: params.externalUrl ?? null,
43470
+ externalTitle: params.externalTitle ?? null,
43471
+ linkType: params.linkType,
43472
+ syncDirection: params.syncDirection ?? "inbound",
43473
+ metadata: params.metadata,
43474
+ linkedAt: now2,
43475
+ lastSyncAt: now2
43476
+ };
43477
+ }
43478
+ async function touchLink(linkId, updates, cwd) {
43479
+ const db = await getDb(cwd);
43480
+ const now2 = (/* @__PURE__ */ new Date()).toISOString();
43481
+ const values = { lastSyncAt: now2 };
43482
+ if (updates?.externalTitle !== void 0) {
43483
+ values.externalTitle = updates.externalTitle;
43484
+ }
43485
+ if (updates?.metadata !== void 0) {
43486
+ values.metadataJson = JSON.stringify(updates.metadata);
43487
+ }
43488
+ await db.update(externalTaskLinks).set(values).where(eq8(externalTaskLinks.id, linkId));
43489
+ }
43490
+ async function removeLinksByProvider(providerId, cwd) {
43491
+ const db = await getDb(cwd);
43492
+ const result = await db.delete(externalTaskLinks).where(eq8(externalTaskLinks.providerId, providerId));
43493
+ return Number(result.changes);
43494
+ }
43495
+ function rowToLink(row) {
43496
+ return {
43497
+ id: row.id,
43498
+ taskId: row.taskId,
43499
+ providerId: row.providerId,
43500
+ externalId: row.externalId,
43501
+ externalUrl: row.externalUrl,
43502
+ externalTitle: row.externalTitle,
43503
+ linkType: row.linkType,
43504
+ syncDirection: row.syncDirection,
43505
+ metadata: row.metadataJson ? JSON.parse(row.metadataJson) : void 0,
43506
+ linkedAt: row.linkedAt,
43507
+ lastSyncAt: row.lastSyncAt
43508
+ };
43509
+ }
43510
+ var init_link_store = __esm({
43511
+ "packages/core/src/reconciliation/link-store.ts"() {
43512
+ "use strict";
43513
+ init_sqlite2();
43514
+ init_tasks_schema();
43515
+ }
43516
+ });
43517
+
43518
+ // packages/core/src/nexus/transfer.ts
43519
+ import { randomUUID as randomUUID5 } from "node:crypto";
43520
+ async function previewTransfer(params) {
43521
+ return executeTransferInternal({ ...params, dryRun: true });
43522
+ }
43523
+ async function executeTransfer(params) {
43524
+ return executeTransferInternal(params);
43525
+ }
43526
+ async function executeTransferInternal(params) {
43527
+ const {
43528
+ taskIds,
43529
+ sourceProject: sourceProjectRef,
43530
+ targetProject: targetProjectRef,
43531
+ mode = "copy",
43532
+ scope = "subtree",
43533
+ onConflict = "rename",
43534
+ onMissingDep = "strip",
43535
+ provenance = true,
43536
+ targetParent,
43537
+ transferBrain = false,
43538
+ dryRun = false
43539
+ } = params;
43540
+ if (!taskIds.length) {
43541
+ throw new Error("No task IDs specified for transfer");
43542
+ }
43543
+ const sourceProject = await nexusGetProject(sourceProjectRef);
43544
+ if (!sourceProject) {
43545
+ throw new Error(`Source project not found: ${sourceProjectRef}`);
43546
+ }
43547
+ const targetProject = await nexusGetProject(targetProjectRef);
43548
+ if (!targetProject) {
43549
+ throw new Error(`Target project not found: ${targetProjectRef}`);
43550
+ }
43551
+ if (sourceProject.hash === targetProject.hash) {
43552
+ throw new Error("Source and target projects must be different");
43553
+ }
43554
+ await requirePermission(sourceProject.hash, "read", "nexus.transfer");
43555
+ await requirePermission(targetProject.hash, "write", "nexus.transfer");
43556
+ const sourceAccessor = await getAccessor(sourceProject.path);
43557
+ const { tasks: allSourceTasks } = await sourceAccessor.queryTasks({});
43558
+ const exportPackages = [];
43559
+ for (const taskId of taskIds) {
43560
+ const pkg = scope === "subtree" ? exportSubtree(taskId, allSourceTasks, sourceProject.name) : exportSingle(taskId, allSourceTasks, sourceProject.name);
43561
+ if (!pkg) {
43562
+ throw new Error(`Task not found in source project: ${taskId}`);
43563
+ }
43564
+ exportPackages.push(pkg);
43565
+ }
43566
+ const seenIds = /* @__PURE__ */ new Set();
43567
+ const mergedTasks = [];
43568
+ for (const pkg of exportPackages) {
43569
+ for (const task of pkg.tasks) {
43570
+ if (!seenIds.has(task.id)) {
43571
+ seenIds.add(task.id);
43572
+ mergedTasks.push(task);
43573
+ }
43574
+ }
43575
+ }
43576
+ const mergedPkg = { ...exportPackages[0] };
43577
+ mergedPkg.tasks = mergedTasks;
43578
+ mergedPkg._meta = { ...mergedPkg._meta, taskCount: mergedTasks.length };
43579
+ const importResult = await importFromPackage(mergedPkg, {
43580
+ cwd: targetProject.path,
43581
+ dryRun,
43582
+ parent: targetParent,
43583
+ provenance,
43584
+ onConflict,
43585
+ onMissingDep
43586
+ });
43587
+ const entries = mergedTasks.map((t) => ({
43588
+ sourceId: t.id,
43589
+ targetId: importResult.idRemap[t.id] ?? t.id,
43590
+ title: t.title,
43591
+ type: t.type ?? "task"
43592
+ }));
43593
+ const manifest = {
43594
+ sourceProject: sourceProject.name,
43595
+ targetProject: targetProject.name,
43596
+ mode,
43597
+ scope,
43598
+ entries,
43599
+ idRemap: importResult.idRemap,
43600
+ brainObservationsTransferred: 0
43601
+ };
43602
+ const result = {
43603
+ dryRun,
43604
+ transferred: importResult.imported,
43605
+ skipped: importResult.skipped,
43606
+ archived: 0,
43607
+ linksCreated: 0,
43608
+ brainObservationsTransferred: 0,
43609
+ manifest
43610
+ };
43611
+ if (dryRun) {
43612
+ return result;
43613
+ }
43614
+ let linksCreated = 0;
43615
+ const targetAccessor = await getAccessor(targetProject.path);
43616
+ const { tasks: targetTasks } = await targetAccessor.queryTasks({});
43617
+ const targetTaskIds = new Set(targetTasks.map((t) => t.id));
43618
+ for (const entry of entries) {
43619
+ if (importResult.idRemap[entry.sourceId] && targetTaskIds.has(entry.targetId)) {
43620
+ await createLink(
43621
+ {
43622
+ taskId: entry.targetId,
43623
+ providerId: `nexus:${sourceProject.name}`,
43624
+ externalId: entry.sourceId,
43625
+ externalTitle: entry.title,
43626
+ linkType: "transferred",
43627
+ syncDirection: "inbound",
43628
+ metadata: {
43629
+ transferMode: mode,
43630
+ transferScope: scope,
43631
+ sourceProject: sourceProject.name,
43632
+ transferredAt: (/* @__PURE__ */ new Date()).toISOString()
43633
+ }
43634
+ },
43635
+ targetProject.path
43636
+ );
43637
+ linksCreated++;
43638
+ await createLink(
43639
+ {
43640
+ taskId: entry.sourceId,
43641
+ providerId: `nexus:${targetProject.name}`,
43642
+ externalId: entry.targetId,
43643
+ externalTitle: entry.title,
43644
+ linkType: "transferred",
43645
+ syncDirection: "outbound",
43646
+ metadata: {
43647
+ transferMode: mode,
43648
+ transferScope: scope,
43649
+ targetProject: targetProject.name,
43650
+ transferredAt: (/* @__PURE__ */ new Date()).toISOString()
43651
+ }
43652
+ },
43653
+ sourceProject.path
43654
+ );
43655
+ linksCreated++;
43656
+ }
43657
+ }
43658
+ result.linksCreated = linksCreated;
43659
+ try {
43660
+ const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
43661
+ const { nexusAuditLog: nexusAuditLog2 } = await Promise.resolve().then(() => (init_nexus_schema(), nexus_schema_exports));
43662
+ const db = await getNexusDb2();
43663
+ await db.insert(nexusAuditLog2).values({
43664
+ id: randomUUID5(),
43665
+ action: "transfer",
43666
+ projectHash: sourceProject.hash,
43667
+ projectId: sourceProject.projectId,
43668
+ domain: "nexus",
43669
+ operation: "transfer",
43670
+ success: 1,
43671
+ detailsJson: JSON.stringify({
43672
+ sourceProject: sourceProject.name,
43673
+ targetProject: targetProject.name,
43674
+ mode,
43675
+ scope,
43676
+ taskCount: result.transferred,
43677
+ idRemap: importResult.idRemap
43678
+ })
43679
+ });
43680
+ } catch (err) {
43681
+ log6.warn({ err }, "nexus transfer audit write failed");
43682
+ }
43683
+ if (mode === "move") {
43684
+ let archived = 0;
43685
+ for (const entry of entries) {
43686
+ if (importResult.idRemap[entry.sourceId]) {
43687
+ try {
43688
+ await sourceAccessor.archiveSingleTask(entry.sourceId, {
43689
+ archivedAt: (/* @__PURE__ */ new Date()).toISOString(),
43690
+ archiveReason: `Transferred to ${targetProject.name} as ${entry.targetId}`
43691
+ });
43692
+ archived++;
43693
+ } catch (err) {
43694
+ log6.warn({ err, taskId: entry.sourceId }, "failed to archive source task after transfer");
43695
+ }
43696
+ }
43697
+ }
43698
+ result.archived = archived;
43699
+ }
43700
+ if (transferBrain) {
43701
+ let brainTransferred = 0;
43702
+ try {
43703
+ const sourceBrainDb = await getBrainDb(sourceProject.path);
43704
+ const targetBrainDb = await getBrainDb(targetProject.path);
43705
+ const sourceBrain = new BrainDataAccessor(sourceBrainDb);
43706
+ const targetBrain = new BrainDataAccessor(targetBrainDb);
43707
+ for (const entry of entries) {
43708
+ if (!importResult.idRemap[entry.sourceId]) continue;
43709
+ const links = await sourceBrain.getLinksForTask(entry.sourceId);
43710
+ for (const link of links) {
43711
+ if (link.memoryType !== "observation") continue;
43712
+ const observation = await sourceBrain.getObservation(link.memoryId);
43713
+ if (!observation) continue;
43714
+ const newObsId = `O-${randomUUID5().slice(0, 8)}`;
43715
+ await targetBrain.addObservation({
43716
+ ...observation,
43717
+ id: newObsId,
43718
+ createdAt: observation.createdAt,
43719
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19)
43720
+ });
43721
+ await targetBrain.addLink({
43722
+ memoryType: "observation",
43723
+ memoryId: newObsId,
43724
+ taskId: entry.targetId,
43725
+ linkType: "applies_to",
43726
+ createdAt: (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19)
43727
+ });
43728
+ brainTransferred++;
43729
+ }
43730
+ }
43731
+ } catch (err) {
43732
+ log6.warn({ err }, "brain observation transfer failed");
43733
+ }
43734
+ result.brainObservationsTransferred = brainTransferred;
43735
+ result.manifest.brainObservationsTransferred = brainTransferred;
43736
+ }
43737
+ return result;
43738
+ }
43739
+ var log6;
43740
+ var init_transfer = __esm({
43741
+ "packages/core/src/nexus/transfer.ts"() {
43742
+ "use strict";
43743
+ init_import_tasks();
43744
+ init_logger();
43745
+ init_link_store();
43746
+ init_brain_accessor();
43747
+ init_brain_sqlite();
43748
+ init_data_accessor();
43749
+ init_export2();
43750
+ init_permissions();
43751
+ init_registry3();
43752
+ log6 = getLogger("nexus:transfer");
43753
+ }
43754
+ });
43755
+
43373
43756
  // packages/core/src/nexus/index.ts
43374
43757
  var nexus_exports = {};
43375
43758
  __export(nexus_exports, {
@@ -43382,6 +43765,7 @@ __export(nexus_exports, {
43382
43765
  checkPermissionDetail: () => checkPermissionDetail,
43383
43766
  criticalPath: () => criticalPath,
43384
43767
  discoverRelated: () => discoverRelated,
43768
+ executeTransfer: () => executeTransfer,
43385
43769
  extractKeywords: () => extractKeywords2,
43386
43770
  generateProjectHash: () => generateProjectHash,
43387
43771
  getCurrentProject: () => getCurrentProject,
@@ -43405,6 +43789,7 @@ __export(nexus_exports, {
43405
43789
  orphanDetection: () => orphanDetection,
43406
43790
  parseQuery: () => parseQuery,
43407
43791
  permissionLevel: () => permissionLevel,
43792
+ previewTransfer: () => previewTransfer,
43408
43793
  readRegistry: () => readRegistry,
43409
43794
  readRegistryRequired: () => readRegistryRequired,
43410
43795
  requirePermission: () => requirePermission,
@@ -43427,6 +43812,7 @@ var init_nexus = __esm({
43427
43812
  init_query3();
43428
43813
  init_registry3();
43429
43814
  init_sharing();
43815
+ init_transfer();
43430
43816
  }
43431
43817
  });
43432
43818
 
@@ -44927,100 +45313,6 @@ var init_pipeline = __esm({
44927
45313
  }
44928
45314
  });
44929
45315
 
44930
- // packages/core/src/reconciliation/link-store.ts
44931
- import { randomUUID as randomUUID4 } from "node:crypto";
44932
- import { and as and5, eq as eq8 } from "drizzle-orm";
44933
- async function getLinksByProvider(providerId, cwd) {
44934
- const db = await getDb(cwd);
44935
- const rows = await db.select().from(externalTaskLinks).where(eq8(externalTaskLinks.providerId, providerId));
44936
- return rows.map(rowToLink);
44937
- }
44938
- async function getLinkByExternalId(providerId, externalId, cwd) {
44939
- const db = await getDb(cwd);
44940
- const rows = await db.select().from(externalTaskLinks).where(
44941
- and5(
44942
- eq8(externalTaskLinks.providerId, providerId),
44943
- eq8(externalTaskLinks.externalId, externalId)
44944
- )
44945
- );
44946
- return rows.length > 0 ? rowToLink(rows[0]) : null;
44947
- }
44948
- async function getLinksByTaskId(taskId, cwd) {
44949
- const db = await getDb(cwd);
44950
- const rows = await db.select().from(externalTaskLinks).where(eq8(externalTaskLinks.taskId, taskId));
44951
- return rows.map(rowToLink);
44952
- }
44953
- async function createLink(params, cwd) {
44954
- const db = await getDb(cwd);
44955
- const now2 = (/* @__PURE__ */ new Date()).toISOString();
44956
- const id = randomUUID4();
44957
- await db.insert(externalTaskLinks).values({
44958
- id,
44959
- taskId: params.taskId,
44960
- providerId: params.providerId,
44961
- externalId: params.externalId,
44962
- externalUrl: params.externalUrl ?? null,
44963
- externalTitle: params.externalTitle ?? null,
44964
- linkType: params.linkType,
44965
- syncDirection: params.syncDirection ?? "inbound",
44966
- metadataJson: params.metadata ? JSON.stringify(params.metadata) : "{}",
44967
- linkedAt: now2,
44968
- lastSyncAt: now2
44969
- });
44970
- return {
44971
- id,
44972
- taskId: params.taskId,
44973
- providerId: params.providerId,
44974
- externalId: params.externalId,
44975
- externalUrl: params.externalUrl ?? null,
44976
- externalTitle: params.externalTitle ?? null,
44977
- linkType: params.linkType,
44978
- syncDirection: params.syncDirection ?? "inbound",
44979
- metadata: params.metadata,
44980
- linkedAt: now2,
44981
- lastSyncAt: now2
44982
- };
44983
- }
44984
- async function touchLink(linkId, updates, cwd) {
44985
- const db = await getDb(cwd);
44986
- const now2 = (/* @__PURE__ */ new Date()).toISOString();
44987
- const values = { lastSyncAt: now2 };
44988
- if (updates?.externalTitle !== void 0) {
44989
- values.externalTitle = updates.externalTitle;
44990
- }
44991
- if (updates?.metadata !== void 0) {
44992
- values.metadataJson = JSON.stringify(updates.metadata);
44993
- }
44994
- await db.update(externalTaskLinks).set(values).where(eq8(externalTaskLinks.id, linkId));
44995
- }
44996
- async function removeLinksByProvider(providerId, cwd) {
44997
- const db = await getDb(cwd);
44998
- const result = await db.delete(externalTaskLinks).where(eq8(externalTaskLinks.providerId, providerId));
44999
- return Number(result.changes);
45000
- }
45001
- function rowToLink(row) {
45002
- return {
45003
- id: row.id,
45004
- taskId: row.taskId,
45005
- providerId: row.providerId,
45006
- externalId: row.externalId,
45007
- externalUrl: row.externalUrl,
45008
- externalTitle: row.externalTitle,
45009
- linkType: row.linkType,
45010
- syncDirection: row.syncDirection,
45011
- metadata: row.metadataJson ? JSON.parse(row.metadataJson) : void 0,
45012
- linkedAt: row.linkedAt,
45013
- lastSyncAt: row.lastSyncAt
45014
- };
45015
- }
45016
- var init_link_store = __esm({
45017
- "packages/core/src/reconciliation/link-store.ts"() {
45018
- "use strict";
45019
- init_sqlite2();
45020
- init_tasks_schema();
45021
- }
45022
- });
45023
-
45024
45316
  // packages/core/src/memory/auto-extract.ts
45025
45317
  var auto_extract_exports = {};
45026
45318
  __export(auto_extract_exports, {
@@ -46587,8 +46879,8 @@ var init_release_config = __esm({
46587
46879
  // packages/core/src/release/ci.ts
46588
46880
  import { existsSync as existsSync60, mkdirSync as mkdirSync12, readFileSync as readFileSync42, writeFileSync as writeFileSync6 } from "node:fs";
46589
46881
  import { dirname as dirname13, join as join63 } from "node:path";
46590
- function getPlatformPath(platform3) {
46591
- return PLATFORM_PATHS[platform3];
46882
+ function getPlatformPath(platform5) {
46883
+ return PLATFORM_PATHS[platform5];
46592
46884
  }
46593
46885
  function detectCIPlatform(projectDir) {
46594
46886
  const dir = projectDir ?? process.cwd();
@@ -46682,10 +46974,10 @@ workflows:
46682
46974
  only: /^v.*/
46683
46975
  `;
46684
46976
  }
46685
- function generateCIConfig(platform3, cwd) {
46977
+ function generateCIConfig(platform5, cwd) {
46686
46978
  const releaseConfig = loadReleaseConfig(cwd);
46687
46979
  const gates = releaseConfig.gates.map((g) => ({ name: g.name, command: g.command }));
46688
- switch (platform3) {
46980
+ switch (platform5) {
46689
46981
  case "github-actions":
46690
46982
  return generateGitHubActions({ gates });
46691
46983
  case "gitlab-ci":
@@ -46694,10 +46986,10 @@ function generateCIConfig(platform3, cwd) {
46694
46986
  return generateCircleCI({ gates });
46695
46987
  }
46696
46988
  }
46697
- function writeCIConfig(platform3, options = {}) {
46989
+ function writeCIConfig(platform5, options = {}) {
46698
46990
  const projectDir = options.projectDir ?? process.cwd();
46699
- const outputPath = join63(projectDir, getPlatformPath(platform3));
46700
- const content = generateCIConfig(platform3, projectDir);
46991
+ const outputPath = join63(projectDir, getPlatformPath(platform5));
46992
+ const content = generateCIConfig(platform5, projectDir);
46701
46993
  if (options.dryRun) {
46702
46994
  return { action: "would_write", path: outputPath, content };
46703
46995
  }
@@ -46705,9 +46997,9 @@ function writeCIConfig(platform3, options = {}) {
46705
46997
  writeFileSync6(outputPath, content, "utf-8");
46706
46998
  return { action: "wrote", path: outputPath, content };
46707
46999
  }
46708
- function validateCIConfig(platform3, projectDir) {
47000
+ function validateCIConfig(platform5, projectDir) {
46709
47001
  const dir = projectDir ?? process.cwd();
46710
- const configPath = join63(dir, getPlatformPath(platform3));
47002
+ const configPath = join63(dir, getPlatformPath(platform5));
46711
47003
  if (!existsSync60(configPath)) {
46712
47004
  return { valid: false, exists: false, errors: ["Config file not found"] };
46713
47005
  }
@@ -48410,239 +48702,1463 @@ var init_capability_matrix = __esm({
48410
48702
  CAPABILITY_MATRIX = [
48411
48703
  // === Tasks Domain ===
48412
48704
  // Query operations
48413
- { domain: "tasks", operation: "show", gateway: "query", mode: "native" },
48414
- { domain: "tasks", operation: "list", gateway: "query", mode: "native" },
48415
- { domain: "tasks", operation: "find", gateway: "query", mode: "native" },
48416
- { domain: "tasks", operation: "tree", gateway: "query", mode: "native" },
48417
- { domain: "tasks", operation: "blockers", gateway: "query", mode: "native" },
48418
- { domain: "tasks", operation: "depends", gateway: "query", mode: "native" },
48419
- { domain: "tasks", operation: "analyze", gateway: "query", mode: "native" },
48420
- { domain: "tasks", operation: "next", gateway: "query", mode: "native" },
48421
- { domain: "tasks", operation: "plan", gateway: "query", mode: "native" },
48422
- { domain: "tasks", operation: "relates", gateway: "query", mode: "native" },
48423
- { domain: "tasks", operation: "complexity.estimate", gateway: "query", mode: "native" },
48424
- { domain: "tasks", operation: "history", gateway: "query", mode: "native" },
48425
- { domain: "tasks", operation: "current", gateway: "query", mode: "native" },
48426
- { domain: "tasks", operation: "label.list", gateway: "query", mode: "native" },
48705
+ { domain: "tasks", operation: "show", gateway: "query", mode: "native", preferredChannel: "mcp" },
48706
+ { domain: "tasks", operation: "list", gateway: "query", mode: "native", preferredChannel: "mcp" },
48707
+ { domain: "tasks", operation: "find", gateway: "query", mode: "native", preferredChannel: "mcp" },
48708
+ {
48709
+ domain: "tasks",
48710
+ operation: "tree",
48711
+ gateway: "query",
48712
+ mode: "native",
48713
+ preferredChannel: "either"
48714
+ },
48715
+ {
48716
+ domain: "tasks",
48717
+ operation: "blockers",
48718
+ gateway: "query",
48719
+ mode: "native",
48720
+ preferredChannel: "either"
48721
+ },
48722
+ {
48723
+ domain: "tasks",
48724
+ operation: "depends",
48725
+ gateway: "query",
48726
+ mode: "native",
48727
+ preferredChannel: "either"
48728
+ },
48729
+ {
48730
+ domain: "tasks",
48731
+ operation: "analyze",
48732
+ gateway: "query",
48733
+ mode: "native",
48734
+ preferredChannel: "either"
48735
+ },
48736
+ { domain: "tasks", operation: "next", gateway: "query", mode: "native", preferredChannel: "mcp" },
48737
+ { domain: "tasks", operation: "plan", gateway: "query", mode: "native", preferredChannel: "mcp" },
48738
+ {
48739
+ domain: "tasks",
48740
+ operation: "relates",
48741
+ gateway: "query",
48742
+ mode: "native",
48743
+ preferredChannel: "either"
48744
+ },
48745
+ {
48746
+ domain: "tasks",
48747
+ operation: "complexity.estimate",
48748
+ gateway: "query",
48749
+ mode: "native",
48750
+ preferredChannel: "either"
48751
+ },
48752
+ {
48753
+ domain: "tasks",
48754
+ operation: "history",
48755
+ gateway: "query",
48756
+ mode: "native",
48757
+ preferredChannel: "either"
48758
+ },
48759
+ {
48760
+ domain: "tasks",
48761
+ operation: "current",
48762
+ gateway: "query",
48763
+ mode: "native",
48764
+ preferredChannel: "mcp"
48765
+ },
48766
+ {
48767
+ domain: "tasks",
48768
+ operation: "label.list",
48769
+ gateway: "query",
48770
+ mode: "native",
48771
+ preferredChannel: "either"
48772
+ },
48427
48773
  // Mutate operations
48428
- { domain: "tasks", operation: "add", gateway: "mutate", mode: "native" },
48429
- { domain: "tasks", operation: "update", gateway: "mutate", mode: "native" },
48430
- { domain: "tasks", operation: "complete", gateway: "mutate", mode: "native" },
48431
- { domain: "tasks", operation: "cancel", gateway: "mutate", mode: "native" },
48432
- { domain: "tasks", operation: "delete", gateway: "mutate", mode: "native" },
48433
- { domain: "tasks", operation: "archive", gateway: "mutate", mode: "native" },
48434
- { domain: "tasks", operation: "restore", gateway: "mutate", mode: "native" },
48435
- { domain: "tasks", operation: "reparent", gateway: "mutate", mode: "native" },
48436
- { domain: "tasks", operation: "reorder", gateway: "mutate", mode: "native" },
48437
- { domain: "tasks", operation: "relates.add", gateway: "mutate", mode: "native" },
48438
- { domain: "tasks", operation: "start", gateway: "mutate", mode: "native" },
48439
- { domain: "tasks", operation: "stop", gateway: "mutate", mode: "native" },
48774
+ { domain: "tasks", operation: "add", gateway: "mutate", mode: "native", preferredChannel: "mcp" },
48775
+ {
48776
+ domain: "tasks",
48777
+ operation: "update",
48778
+ gateway: "mutate",
48779
+ mode: "native",
48780
+ preferredChannel: "mcp"
48781
+ },
48782
+ {
48783
+ domain: "tasks",
48784
+ operation: "complete",
48785
+ gateway: "mutate",
48786
+ mode: "native",
48787
+ preferredChannel: "mcp"
48788
+ },
48789
+ {
48790
+ domain: "tasks",
48791
+ operation: "cancel",
48792
+ gateway: "mutate",
48793
+ mode: "native",
48794
+ preferredChannel: "either"
48795
+ },
48796
+ {
48797
+ domain: "tasks",
48798
+ operation: "delete",
48799
+ gateway: "mutate",
48800
+ mode: "native",
48801
+ preferredChannel: "either"
48802
+ },
48803
+ {
48804
+ domain: "tasks",
48805
+ operation: "archive",
48806
+ gateway: "mutate",
48807
+ mode: "native",
48808
+ preferredChannel: "either"
48809
+ },
48810
+ {
48811
+ domain: "tasks",
48812
+ operation: "restore",
48813
+ gateway: "mutate",
48814
+ mode: "native",
48815
+ preferredChannel: "either"
48816
+ },
48817
+ {
48818
+ domain: "tasks",
48819
+ operation: "reparent",
48820
+ gateway: "mutate",
48821
+ mode: "native",
48822
+ preferredChannel: "either"
48823
+ },
48824
+ {
48825
+ domain: "tasks",
48826
+ operation: "reorder",
48827
+ gateway: "mutate",
48828
+ mode: "native",
48829
+ preferredChannel: "either"
48830
+ },
48831
+ {
48832
+ domain: "tasks",
48833
+ operation: "relates.add",
48834
+ gateway: "mutate",
48835
+ mode: "native",
48836
+ preferredChannel: "either"
48837
+ },
48838
+ {
48839
+ domain: "tasks",
48840
+ operation: "start",
48841
+ gateway: "mutate",
48842
+ mode: "native",
48843
+ preferredChannel: "mcp"
48844
+ },
48845
+ {
48846
+ domain: "tasks",
48847
+ operation: "stop",
48848
+ gateway: "mutate",
48849
+ mode: "native",
48850
+ preferredChannel: "mcp"
48851
+ },
48440
48852
  // Sync sub-domain (provider-agnostic task reconciliation)
48441
- { domain: "tasks", operation: "sync.reconcile", gateway: "mutate", mode: "native" },
48442
- { domain: "tasks", operation: "sync.links", gateway: "query", mode: "native" },
48443
- { domain: "tasks", operation: "sync.links.remove", gateway: "mutate", mode: "native" },
48853
+ {
48854
+ domain: "tasks",
48855
+ operation: "sync.reconcile",
48856
+ gateway: "mutate",
48857
+ mode: "native",
48858
+ preferredChannel: "either"
48859
+ },
48860
+ {
48861
+ domain: "tasks",
48862
+ operation: "sync.links",
48863
+ gateway: "query",
48864
+ mode: "native",
48865
+ preferredChannel: "either"
48866
+ },
48867
+ {
48868
+ domain: "tasks",
48869
+ operation: "sync.links.remove",
48870
+ gateway: "mutate",
48871
+ mode: "native",
48872
+ preferredChannel: "either"
48873
+ },
48444
48874
  // === Session Domain ===
48445
48875
  // Query operations
48446
- { domain: "session", operation: "status", gateway: "query", mode: "native" },
48447
- { domain: "session", operation: "list", gateway: "query", mode: "native" },
48448
- { domain: "session", operation: "show", gateway: "query", mode: "native" },
48449
- { domain: "session", operation: "decision.log", gateway: "query", mode: "native" },
48450
- { domain: "session", operation: "context.drift", gateway: "query", mode: "native" },
48451
- { domain: "session", operation: "handoff.show", gateway: "query", mode: "native" },
48452
- { domain: "session", operation: "briefing.show", gateway: "query", mode: "native" },
48453
- { domain: "session", operation: "find", gateway: "query", mode: "native" },
48876
+ {
48877
+ domain: "session",
48878
+ operation: "status",
48879
+ gateway: "query",
48880
+ mode: "native",
48881
+ preferredChannel: "mcp"
48882
+ },
48883
+ {
48884
+ domain: "session",
48885
+ operation: "list",
48886
+ gateway: "query",
48887
+ mode: "native",
48888
+ preferredChannel: "either"
48889
+ },
48890
+ {
48891
+ domain: "session",
48892
+ operation: "show",
48893
+ gateway: "query",
48894
+ mode: "native",
48895
+ preferredChannel: "either"
48896
+ },
48897
+ {
48898
+ domain: "session",
48899
+ operation: "decision.log",
48900
+ gateway: "query",
48901
+ mode: "native",
48902
+ preferredChannel: "either"
48903
+ },
48904
+ {
48905
+ domain: "session",
48906
+ operation: "context.drift",
48907
+ gateway: "query",
48908
+ mode: "native",
48909
+ preferredChannel: "either"
48910
+ },
48911
+ {
48912
+ domain: "session",
48913
+ operation: "handoff.show",
48914
+ gateway: "query",
48915
+ mode: "native",
48916
+ preferredChannel: "mcp"
48917
+ },
48918
+ {
48919
+ domain: "session",
48920
+ operation: "briefing.show",
48921
+ gateway: "query",
48922
+ mode: "native",
48923
+ preferredChannel: "mcp"
48924
+ },
48925
+ {
48926
+ domain: "session",
48927
+ operation: "find",
48928
+ gateway: "query",
48929
+ mode: "native",
48930
+ preferredChannel: "either"
48931
+ },
48454
48932
  // Mutate operations
48455
- { domain: "session", operation: "start", gateway: "mutate", mode: "native" },
48456
- { domain: "session", operation: "end", gateway: "mutate", mode: "native" },
48457
- { domain: "session", operation: "resume", gateway: "mutate", mode: "native" },
48458
- { domain: "session", operation: "suspend", gateway: "mutate", mode: "native" },
48459
- { domain: "session", operation: "gc", gateway: "mutate", mode: "native" },
48460
- { domain: "session", operation: "record.decision", gateway: "mutate", mode: "native" },
48461
- { domain: "session", operation: "record.assumption", gateway: "mutate", mode: "native" },
48933
+ {
48934
+ domain: "session",
48935
+ operation: "start",
48936
+ gateway: "mutate",
48937
+ mode: "native",
48938
+ preferredChannel: "mcp"
48939
+ },
48940
+ {
48941
+ domain: "session",
48942
+ operation: "end",
48943
+ gateway: "mutate",
48944
+ mode: "native",
48945
+ preferredChannel: "mcp"
48946
+ },
48947
+ {
48948
+ domain: "session",
48949
+ operation: "resume",
48950
+ gateway: "mutate",
48951
+ mode: "native",
48952
+ preferredChannel: "either"
48953
+ },
48954
+ {
48955
+ domain: "session",
48956
+ operation: "suspend",
48957
+ gateway: "mutate",
48958
+ mode: "native",
48959
+ preferredChannel: "either"
48960
+ },
48961
+ {
48962
+ domain: "session",
48963
+ operation: "gc",
48964
+ gateway: "mutate",
48965
+ mode: "native",
48966
+ preferredChannel: "either"
48967
+ },
48968
+ {
48969
+ domain: "session",
48970
+ operation: "record.decision",
48971
+ gateway: "mutate",
48972
+ mode: "native",
48973
+ preferredChannel: "either"
48974
+ },
48975
+ {
48976
+ domain: "session",
48977
+ operation: "record.assumption",
48978
+ gateway: "mutate",
48979
+ mode: "native",
48980
+ preferredChannel: "either"
48981
+ },
48462
48982
  // === Admin Domain ===
48463
48983
  // Query operations
48464
- { domain: "admin", operation: "version", gateway: "query", mode: "native" },
48465
- { domain: "admin", operation: "health", gateway: "query", mode: "native" },
48466
- { domain: "admin", operation: "config.show", gateway: "query", mode: "native" },
48467
- { domain: "admin", operation: "stats", gateway: "query", mode: "native" },
48468
- { domain: "admin", operation: "context", gateway: "query", mode: "native" },
48469
- { domain: "admin", operation: "runtime", gateway: "query", mode: "native" },
48470
- { domain: "admin", operation: "job", gateway: "query", mode: "native" },
48471
- { domain: "admin", operation: "dash", gateway: "query", mode: "native" },
48472
- { domain: "admin", operation: "log", gateway: "query", mode: "native" },
48473
- { domain: "admin", operation: "sequence", gateway: "query", mode: "native" },
48474
- { domain: "admin", operation: "help", gateway: "query", mode: "native" },
48475
- { domain: "admin", operation: "token", gateway: "query", mode: "native" },
48476
- { domain: "admin", operation: "export", gateway: "query", mode: "native" },
48477
- { domain: "admin", operation: "adr.show", gateway: "query", mode: "native" },
48478
- { domain: "admin", operation: "adr.find", gateway: "query", mode: "native" },
48984
+ {
48985
+ domain: "admin",
48986
+ operation: "version",
48987
+ gateway: "query",
48988
+ mode: "native",
48989
+ preferredChannel: "either"
48990
+ },
48991
+ {
48992
+ domain: "admin",
48993
+ operation: "health",
48994
+ gateway: "query",
48995
+ mode: "native",
48996
+ preferredChannel: "either"
48997
+ },
48998
+ {
48999
+ domain: "admin",
49000
+ operation: "config.show",
49001
+ gateway: "query",
49002
+ mode: "native",
49003
+ preferredChannel: "either"
49004
+ },
49005
+ {
49006
+ domain: "admin",
49007
+ operation: "stats",
49008
+ gateway: "query",
49009
+ mode: "native",
49010
+ preferredChannel: "either"
49011
+ },
49012
+ {
49013
+ domain: "admin",
49014
+ operation: "context",
49015
+ gateway: "query",
49016
+ mode: "native",
49017
+ preferredChannel: "either"
49018
+ },
49019
+ {
49020
+ domain: "admin",
49021
+ operation: "runtime",
49022
+ gateway: "query",
49023
+ mode: "native",
49024
+ preferredChannel: "either"
49025
+ },
49026
+ {
49027
+ domain: "admin",
49028
+ operation: "job",
49029
+ gateway: "query",
49030
+ mode: "native",
49031
+ preferredChannel: "either"
49032
+ },
49033
+ { domain: "admin", operation: "dash", gateway: "query", mode: "native", preferredChannel: "mcp" },
49034
+ {
49035
+ domain: "admin",
49036
+ operation: "log",
49037
+ gateway: "query",
49038
+ mode: "native",
49039
+ preferredChannel: "either"
49040
+ },
49041
+ {
49042
+ domain: "admin",
49043
+ operation: "sequence",
49044
+ gateway: "query",
49045
+ mode: "native",
49046
+ preferredChannel: "either"
49047
+ },
49048
+ { domain: "admin", operation: "help", gateway: "query", mode: "native", preferredChannel: "mcp" },
49049
+ {
49050
+ domain: "admin",
49051
+ operation: "token",
49052
+ gateway: "query",
49053
+ mode: "native",
49054
+ preferredChannel: "either"
49055
+ },
49056
+ {
49057
+ domain: "admin",
49058
+ operation: "export",
49059
+ gateway: "query",
49060
+ mode: "native",
49061
+ preferredChannel: "either"
49062
+ },
49063
+ {
49064
+ domain: "admin",
49065
+ operation: "adr.show",
49066
+ gateway: "query",
49067
+ mode: "native",
49068
+ preferredChannel: "either"
49069
+ },
49070
+ {
49071
+ domain: "admin",
49072
+ operation: "adr.find",
49073
+ gateway: "query",
49074
+ mode: "native",
49075
+ preferredChannel: "either"
49076
+ },
49077
+ { domain: "admin", operation: "map", gateway: "query", mode: "native", preferredChannel: "mcp" },
48479
49078
  // Mutate operations
48480
- { domain: "admin", operation: "init", gateway: "mutate", mode: "native" },
48481
- { domain: "admin", operation: "config.set", gateway: "mutate", mode: "native" },
48482
- { domain: "admin", operation: "backup", gateway: "mutate", mode: "native" },
48483
- { domain: "admin", operation: "migrate", gateway: "mutate", mode: "native" },
48484
- { domain: "admin", operation: "cleanup", gateway: "mutate", mode: "native" },
48485
- { domain: "admin", operation: "safestop", gateway: "mutate", mode: "native" },
48486
- { domain: "admin", operation: "inject.generate", gateway: "mutate", mode: "native" },
48487
- { domain: "admin", operation: "job.cancel", gateway: "mutate", mode: "native" },
48488
- { domain: "admin", operation: "install.global", gateway: "mutate", mode: "native" },
48489
- { domain: "admin", operation: "token", gateway: "mutate", mode: "native" },
48490
- { domain: "admin", operation: "health", gateway: "mutate", mode: "native" },
48491
- { domain: "admin", operation: "detect", gateway: "mutate", mode: "native" },
48492
- { domain: "admin", operation: "import", gateway: "mutate", mode: "native" },
48493
- { domain: "admin", operation: "context.inject", gateway: "mutate", mode: "native" },
48494
- { domain: "admin", operation: "adr.sync", gateway: "mutate", mode: "native" },
49079
+ {
49080
+ domain: "admin",
49081
+ operation: "init",
49082
+ gateway: "mutate",
49083
+ mode: "native",
49084
+ preferredChannel: "either"
49085
+ },
49086
+ {
49087
+ domain: "admin",
49088
+ operation: "config.set",
49089
+ gateway: "mutate",
49090
+ mode: "native",
49091
+ preferredChannel: "either"
49092
+ },
49093
+ {
49094
+ domain: "admin",
49095
+ operation: "backup",
49096
+ gateway: "mutate",
49097
+ mode: "native",
49098
+ preferredChannel: "either"
49099
+ },
49100
+ {
49101
+ domain: "admin",
49102
+ operation: "migrate",
49103
+ gateway: "mutate",
49104
+ mode: "native",
49105
+ preferredChannel: "either"
49106
+ },
49107
+ {
49108
+ domain: "admin",
49109
+ operation: "cleanup",
49110
+ gateway: "mutate",
49111
+ mode: "native",
49112
+ preferredChannel: "either"
49113
+ },
49114
+ {
49115
+ domain: "admin",
49116
+ operation: "safestop",
49117
+ gateway: "mutate",
49118
+ mode: "native",
49119
+ preferredChannel: "either"
49120
+ },
49121
+ {
49122
+ domain: "admin",
49123
+ operation: "inject.generate",
49124
+ gateway: "mutate",
49125
+ mode: "native",
49126
+ preferredChannel: "either"
49127
+ },
49128
+ {
49129
+ domain: "admin",
49130
+ operation: "job.cancel",
49131
+ gateway: "mutate",
49132
+ mode: "native",
49133
+ preferredChannel: "either"
49134
+ },
49135
+ {
49136
+ domain: "admin",
49137
+ operation: "install.global",
49138
+ gateway: "mutate",
49139
+ mode: "native",
49140
+ preferredChannel: "either"
49141
+ },
49142
+ {
49143
+ domain: "admin",
49144
+ operation: "token",
49145
+ gateway: "mutate",
49146
+ mode: "native",
49147
+ preferredChannel: "either"
49148
+ },
49149
+ {
49150
+ domain: "admin",
49151
+ operation: "health",
49152
+ gateway: "mutate",
49153
+ mode: "native",
49154
+ preferredChannel: "either"
49155
+ },
49156
+ {
49157
+ domain: "admin",
49158
+ operation: "detect",
49159
+ gateway: "mutate",
49160
+ mode: "native",
49161
+ preferredChannel: "either"
49162
+ },
49163
+ {
49164
+ domain: "admin",
49165
+ operation: "import",
49166
+ gateway: "mutate",
49167
+ mode: "native",
49168
+ preferredChannel: "either"
49169
+ },
49170
+ {
49171
+ domain: "admin",
49172
+ operation: "context.inject",
49173
+ gateway: "mutate",
49174
+ mode: "native",
49175
+ preferredChannel: "either"
49176
+ },
49177
+ {
49178
+ domain: "admin",
49179
+ operation: "adr.sync",
49180
+ gateway: "mutate",
49181
+ mode: "native",
49182
+ preferredChannel: "either"
49183
+ },
49184
+ {
49185
+ domain: "admin",
49186
+ operation: "map",
49187
+ gateway: "mutate",
49188
+ mode: "native",
49189
+ preferredChannel: "either"
49190
+ },
48495
49191
  // === Check Domain ===
48496
49192
  // Query operations
48497
- { domain: "check", operation: "schema", gateway: "query", mode: "native" },
48498
- { domain: "check", operation: "protocol", gateway: "query", mode: "native" },
48499
- { domain: "check", operation: "task", gateway: "query", mode: "native" },
48500
- { domain: "check", operation: "manifest", gateway: "query", mode: "native" },
48501
- { domain: "check", operation: "output", gateway: "query", mode: "native" },
48502
- { domain: "check", operation: "compliance.summary", gateway: "query", mode: "native" },
48503
- { domain: "check", operation: "test", gateway: "query", mode: "native" },
48504
- { domain: "check", operation: "coherence", gateway: "query", mode: "native" },
48505
- { domain: "check", operation: "gate.status", gateway: "query", mode: "native" },
48506
- { domain: "check", operation: "archive.stats", gateway: "query", mode: "native" },
48507
- { domain: "check", operation: "grade", gateway: "query", mode: "native" },
48508
- { domain: "check", operation: "grade.list", gateway: "query", mode: "native" },
48509
- { domain: "check", operation: "chain.validate", gateway: "query", mode: "native" },
49193
+ {
49194
+ domain: "check",
49195
+ operation: "schema",
49196
+ gateway: "query",
49197
+ mode: "native",
49198
+ preferredChannel: "either"
49199
+ },
49200
+ {
49201
+ domain: "check",
49202
+ operation: "protocol",
49203
+ gateway: "query",
49204
+ mode: "native",
49205
+ preferredChannel: "either"
49206
+ },
49207
+ {
49208
+ domain: "check",
49209
+ operation: "task",
49210
+ gateway: "query",
49211
+ mode: "native",
49212
+ preferredChannel: "either"
49213
+ },
49214
+ {
49215
+ domain: "check",
49216
+ operation: "manifest",
49217
+ gateway: "query",
49218
+ mode: "native",
49219
+ preferredChannel: "either"
49220
+ },
49221
+ {
49222
+ domain: "check",
49223
+ operation: "output",
49224
+ gateway: "query",
49225
+ mode: "native",
49226
+ preferredChannel: "either"
49227
+ },
49228
+ {
49229
+ domain: "check",
49230
+ operation: "compliance.summary",
49231
+ gateway: "query",
49232
+ mode: "native",
49233
+ preferredChannel: "mcp"
49234
+ },
49235
+ {
49236
+ domain: "check",
49237
+ operation: "test",
49238
+ gateway: "query",
49239
+ mode: "native",
49240
+ preferredChannel: "either"
49241
+ },
49242
+ {
49243
+ domain: "check",
49244
+ operation: "coherence",
49245
+ gateway: "query",
49246
+ mode: "native",
49247
+ preferredChannel: "either"
49248
+ },
49249
+ {
49250
+ domain: "check",
49251
+ operation: "gate.status",
49252
+ gateway: "query",
49253
+ mode: "native",
49254
+ preferredChannel: "either"
49255
+ },
49256
+ {
49257
+ domain: "check",
49258
+ operation: "archive.stats",
49259
+ gateway: "query",
49260
+ mode: "native",
49261
+ preferredChannel: "either"
49262
+ },
49263
+ {
49264
+ domain: "check",
49265
+ operation: "grade",
49266
+ gateway: "query",
49267
+ mode: "native",
49268
+ preferredChannel: "either"
49269
+ },
49270
+ {
49271
+ domain: "check",
49272
+ operation: "grade.list",
49273
+ gateway: "query",
49274
+ mode: "native",
49275
+ preferredChannel: "either"
49276
+ },
49277
+ {
49278
+ domain: "check",
49279
+ operation: "chain.validate",
49280
+ gateway: "query",
49281
+ mode: "native",
49282
+ preferredChannel: "either"
49283
+ },
48510
49284
  // Mutate operations
48511
- { domain: "check", operation: "compliance.record", gateway: "mutate", mode: "native" },
48512
- { domain: "check", operation: "test.run", gateway: "mutate", mode: "native" },
48513
- { domain: "check", operation: "gate.set", gateway: "mutate", mode: "native" },
49285
+ {
49286
+ domain: "check",
49287
+ operation: "compliance.record",
49288
+ gateway: "mutate",
49289
+ mode: "native",
49290
+ preferredChannel: "mcp"
49291
+ },
49292
+ {
49293
+ domain: "check",
49294
+ operation: "test.run",
49295
+ gateway: "mutate",
49296
+ mode: "native",
49297
+ preferredChannel: "either"
49298
+ },
49299
+ {
49300
+ domain: "check",
49301
+ operation: "gate.set",
49302
+ gateway: "mutate",
49303
+ mode: "native",
49304
+ preferredChannel: "either"
49305
+ },
49306
+ {
49307
+ domain: "check",
49308
+ operation: "compliance.sync",
49309
+ gateway: "mutate",
49310
+ mode: "native",
49311
+ preferredChannel: "either"
49312
+ },
48514
49313
  // === Orchestrate Domain ===
48515
49314
  // Query operations
48516
- { domain: "orchestrate", operation: "status", gateway: "query", mode: "native" },
48517
- { domain: "orchestrate", operation: "next", gateway: "query", mode: "native" },
48518
- { domain: "orchestrate", operation: "ready", gateway: "query", mode: "native" },
48519
- { domain: "orchestrate", operation: "analyze", gateway: "query", mode: "native" },
48520
- { domain: "orchestrate", operation: "context", gateway: "query", mode: "native" },
48521
- { domain: "orchestrate", operation: "waves", gateway: "query", mode: "native" },
48522
- { domain: "orchestrate", operation: "bootstrap", gateway: "query", mode: "native" },
48523
- { domain: "orchestrate", operation: "unblock.opportunities", gateway: "query", mode: "native" },
48524
- { domain: "orchestrate", operation: "tessera.list", gateway: "query", mode: "native" },
49315
+ {
49316
+ domain: "orchestrate",
49317
+ operation: "status",
49318
+ gateway: "query",
49319
+ mode: "native",
49320
+ preferredChannel: "either"
49321
+ },
49322
+ {
49323
+ domain: "orchestrate",
49324
+ operation: "next",
49325
+ gateway: "query",
49326
+ mode: "native",
49327
+ preferredChannel: "either"
49328
+ },
49329
+ {
49330
+ domain: "orchestrate",
49331
+ operation: "ready",
49332
+ gateway: "query",
49333
+ mode: "native",
49334
+ preferredChannel: "either"
49335
+ },
49336
+ {
49337
+ domain: "orchestrate",
49338
+ operation: "analyze",
49339
+ gateway: "query",
49340
+ mode: "native",
49341
+ preferredChannel: "either"
49342
+ },
49343
+ {
49344
+ domain: "orchestrate",
49345
+ operation: "context",
49346
+ gateway: "query",
49347
+ mode: "native",
49348
+ preferredChannel: "either"
49349
+ },
49350
+ {
49351
+ domain: "orchestrate",
49352
+ operation: "waves",
49353
+ gateway: "query",
49354
+ mode: "native",
49355
+ preferredChannel: "either"
49356
+ },
49357
+ {
49358
+ domain: "orchestrate",
49359
+ operation: "bootstrap",
49360
+ gateway: "query",
49361
+ mode: "native",
49362
+ preferredChannel: "either"
49363
+ },
49364
+ {
49365
+ domain: "orchestrate",
49366
+ operation: "unblock.opportunities",
49367
+ gateway: "query",
49368
+ mode: "native",
49369
+ preferredChannel: "either"
49370
+ },
49371
+ {
49372
+ domain: "orchestrate",
49373
+ operation: "tessera.list",
49374
+ gateway: "query",
49375
+ mode: "native",
49376
+ preferredChannel: "either"
49377
+ },
48525
49378
  // Mutate operations
48526
- { domain: "orchestrate", operation: "start", gateway: "mutate", mode: "native" },
48527
- { domain: "orchestrate", operation: "spawn", gateway: "mutate", mode: "native" },
48528
- { domain: "orchestrate", operation: "handoff", gateway: "mutate", mode: "native" },
48529
- { domain: "orchestrate", operation: "spawn.execute", gateway: "mutate", mode: "native" },
48530
- { domain: "orchestrate", operation: "validate", gateway: "mutate", mode: "native" },
48531
- { domain: "orchestrate", operation: "parallel", gateway: "mutate", mode: "native" },
48532
- { domain: "orchestrate", operation: "tessera.instantiate", gateway: "mutate", mode: "native" },
49379
+ {
49380
+ domain: "orchestrate",
49381
+ operation: "start",
49382
+ gateway: "mutate",
49383
+ mode: "native",
49384
+ preferredChannel: "either"
49385
+ },
49386
+ {
49387
+ domain: "orchestrate",
49388
+ operation: "spawn",
49389
+ gateway: "mutate",
49390
+ mode: "native",
49391
+ preferredChannel: "mcp"
49392
+ },
49393
+ {
49394
+ domain: "orchestrate",
49395
+ operation: "handoff",
49396
+ gateway: "mutate",
49397
+ mode: "native",
49398
+ preferredChannel: "either"
49399
+ },
49400
+ {
49401
+ domain: "orchestrate",
49402
+ operation: "spawn.execute",
49403
+ gateway: "mutate",
49404
+ mode: "native",
49405
+ preferredChannel: "either"
49406
+ },
49407
+ {
49408
+ domain: "orchestrate",
49409
+ operation: "validate",
49410
+ gateway: "mutate",
49411
+ mode: "native",
49412
+ preferredChannel: "either"
49413
+ },
49414
+ {
49415
+ domain: "orchestrate",
49416
+ operation: "parallel",
49417
+ gateway: "mutate",
49418
+ mode: "native",
49419
+ preferredChannel: "either"
49420
+ },
49421
+ {
49422
+ domain: "orchestrate",
49423
+ operation: "tessera.instantiate",
49424
+ gateway: "mutate",
49425
+ mode: "native",
49426
+ preferredChannel: "either"
49427
+ },
48533
49428
  // === Memory Domain (brain.db cognitive memory -- T5241) ===
48534
49429
  // Query operations
48535
- { domain: "memory", operation: "find", gateway: "query", mode: "native" },
48536
- { domain: "memory", operation: "timeline", gateway: "query", mode: "native" },
48537
- { domain: "memory", operation: "fetch", gateway: "query", mode: "native" },
48538
- { domain: "memory", operation: "decision.find", gateway: "query", mode: "native" },
48539
- { domain: "memory", operation: "pattern.find", gateway: "query", mode: "native" },
48540
- { domain: "memory", operation: "learning.find", gateway: "query", mode: "native" },
48541
- { domain: "memory", operation: "graph.show", gateway: "query", mode: "native" },
48542
- { domain: "memory", operation: "graph.neighbors", gateway: "query", mode: "native" },
48543
- { domain: "memory", operation: "reason.why", gateway: "query", mode: "native" },
48544
- { domain: "memory", operation: "reason.similar", gateway: "query", mode: "native" },
48545
- { domain: "memory", operation: "search.hybrid", gateway: "query", mode: "native" },
49430
+ {
49431
+ domain: "memory",
49432
+ operation: "find",
49433
+ gateway: "query",
49434
+ mode: "native",
49435
+ preferredChannel: "mcp"
49436
+ },
49437
+ {
49438
+ domain: "memory",
49439
+ operation: "timeline",
49440
+ gateway: "query",
49441
+ mode: "native",
49442
+ preferredChannel: "mcp"
49443
+ },
49444
+ {
49445
+ domain: "memory",
49446
+ operation: "fetch",
49447
+ gateway: "query",
49448
+ mode: "native",
49449
+ preferredChannel: "mcp"
49450
+ },
49451
+ {
49452
+ domain: "memory",
49453
+ operation: "decision.find",
49454
+ gateway: "query",
49455
+ mode: "native",
49456
+ preferredChannel: "mcp"
49457
+ },
49458
+ {
49459
+ domain: "memory",
49460
+ operation: "pattern.find",
49461
+ gateway: "query",
49462
+ mode: "native",
49463
+ preferredChannel: "mcp"
49464
+ },
49465
+ {
49466
+ domain: "memory",
49467
+ operation: "learning.find",
49468
+ gateway: "query",
49469
+ mode: "native",
49470
+ preferredChannel: "mcp"
49471
+ },
49472
+ {
49473
+ domain: "memory",
49474
+ operation: "graph.show",
49475
+ gateway: "query",
49476
+ mode: "native",
49477
+ preferredChannel: "either"
49478
+ },
49479
+ {
49480
+ domain: "memory",
49481
+ operation: "graph.neighbors",
49482
+ gateway: "query",
49483
+ mode: "native",
49484
+ preferredChannel: "either"
49485
+ },
49486
+ {
49487
+ domain: "memory",
49488
+ operation: "reason.why",
49489
+ gateway: "query",
49490
+ mode: "native",
49491
+ preferredChannel: "either"
49492
+ },
49493
+ {
49494
+ domain: "memory",
49495
+ operation: "reason.similar",
49496
+ gateway: "query",
49497
+ mode: "native",
49498
+ preferredChannel: "either"
49499
+ },
49500
+ {
49501
+ domain: "memory",
49502
+ operation: "search.hybrid",
49503
+ gateway: "query",
49504
+ mode: "native",
49505
+ preferredChannel: "either"
49506
+ },
48546
49507
  // Mutate operations
48547
- { domain: "memory", operation: "observe", gateway: "mutate", mode: "native" },
48548
- { domain: "memory", operation: "decision.store", gateway: "mutate", mode: "native" },
48549
- { domain: "memory", operation: "pattern.store", gateway: "mutate", mode: "native" },
48550
- { domain: "memory", operation: "learning.store", gateway: "mutate", mode: "native" },
48551
- { domain: "memory", operation: "link", gateway: "mutate", mode: "native" },
48552
- { domain: "memory", operation: "graph.add", gateway: "mutate", mode: "native" },
48553
- { domain: "memory", operation: "graph.remove", gateway: "mutate", mode: "native" },
49508
+ {
49509
+ domain: "memory",
49510
+ operation: "observe",
49511
+ gateway: "mutate",
49512
+ mode: "native",
49513
+ preferredChannel: "mcp"
49514
+ },
49515
+ {
49516
+ domain: "memory",
49517
+ operation: "decision.store",
49518
+ gateway: "mutate",
49519
+ mode: "native",
49520
+ preferredChannel: "mcp"
49521
+ },
49522
+ {
49523
+ domain: "memory",
49524
+ operation: "pattern.store",
49525
+ gateway: "mutate",
49526
+ mode: "native",
49527
+ preferredChannel: "mcp"
49528
+ },
49529
+ {
49530
+ domain: "memory",
49531
+ operation: "learning.store",
49532
+ gateway: "mutate",
49533
+ mode: "native",
49534
+ preferredChannel: "mcp"
49535
+ },
49536
+ {
49537
+ domain: "memory",
49538
+ operation: "link",
49539
+ gateway: "mutate",
49540
+ mode: "native",
49541
+ preferredChannel: "either"
49542
+ },
49543
+ {
49544
+ domain: "memory",
49545
+ operation: "graph.add",
49546
+ gateway: "mutate",
49547
+ mode: "native",
49548
+ preferredChannel: "either"
49549
+ },
49550
+ {
49551
+ domain: "memory",
49552
+ operation: "graph.remove",
49553
+ gateway: "mutate",
49554
+ mode: "native",
49555
+ preferredChannel: "either"
49556
+ },
48554
49557
  // === Pipeline Domain ===
48555
49558
  // Stage sub-domain (RCASD lifecycle)
48556
- { domain: "pipeline", operation: "stage.validate", gateway: "query", mode: "native" },
48557
- { domain: "pipeline", operation: "stage.status", gateway: "query", mode: "native" },
48558
- { domain: "pipeline", operation: "stage.history", gateway: "query", mode: "native" },
48559
- { domain: "pipeline", operation: "stage.record", gateway: "mutate", mode: "native" },
48560
- { domain: "pipeline", operation: "stage.skip", gateway: "mutate", mode: "native" },
48561
- { domain: "pipeline", operation: "stage.reset", gateway: "mutate", mode: "native" },
48562
- { domain: "pipeline", operation: "stage.gate.pass", gateway: "mutate", mode: "native" },
48563
- { domain: "pipeline", operation: "stage.gate.fail", gateway: "mutate", mode: "native" },
49559
+ {
49560
+ domain: "pipeline",
49561
+ operation: "stage.validate",
49562
+ gateway: "query",
49563
+ mode: "native",
49564
+ preferredChannel: "mcp"
49565
+ },
49566
+ {
49567
+ domain: "pipeline",
49568
+ operation: "stage.status",
49569
+ gateway: "query",
49570
+ mode: "native",
49571
+ preferredChannel: "mcp"
49572
+ },
49573
+ {
49574
+ domain: "pipeline",
49575
+ operation: "stage.history",
49576
+ gateway: "query",
49577
+ mode: "native",
49578
+ preferredChannel: "either"
49579
+ },
49580
+ {
49581
+ domain: "pipeline",
49582
+ operation: "stage.record",
49583
+ gateway: "mutate",
49584
+ mode: "native",
49585
+ preferredChannel: "either"
49586
+ },
49587
+ {
49588
+ domain: "pipeline",
49589
+ operation: "stage.skip",
49590
+ gateway: "mutate",
49591
+ mode: "native",
49592
+ preferredChannel: "either"
49593
+ },
49594
+ {
49595
+ domain: "pipeline",
49596
+ operation: "stage.reset",
49597
+ gateway: "mutate",
49598
+ mode: "native",
49599
+ preferredChannel: "either"
49600
+ },
49601
+ {
49602
+ domain: "pipeline",
49603
+ operation: "stage.gate.pass",
49604
+ gateway: "mutate",
49605
+ mode: "native",
49606
+ preferredChannel: "either"
49607
+ },
49608
+ {
49609
+ domain: "pipeline",
49610
+ operation: "stage.gate.fail",
49611
+ gateway: "mutate",
49612
+ mode: "native",
49613
+ preferredChannel: "either"
49614
+ },
48564
49615
  // Manifest sub-domain (T5241)
48565
- { domain: "pipeline", operation: "manifest.show", gateway: "query", mode: "native" },
48566
- { domain: "pipeline", operation: "manifest.list", gateway: "query", mode: "native" },
48567
- { domain: "pipeline", operation: "manifest.find", gateway: "query", mode: "native" },
48568
- { domain: "pipeline", operation: "manifest.stats", gateway: "query", mode: "native" },
48569
- { domain: "pipeline", operation: "manifest.append", gateway: "mutate", mode: "native" },
48570
- { domain: "pipeline", operation: "manifest.archive", gateway: "mutate", mode: "native" },
49616
+ {
49617
+ domain: "pipeline",
49618
+ operation: "manifest.show",
49619
+ gateway: "query",
49620
+ mode: "native",
49621
+ preferredChannel: "either"
49622
+ },
49623
+ {
49624
+ domain: "pipeline",
49625
+ operation: "manifest.list",
49626
+ gateway: "query",
49627
+ mode: "native",
49628
+ preferredChannel: "either"
49629
+ },
49630
+ {
49631
+ domain: "pipeline",
49632
+ operation: "manifest.find",
49633
+ gateway: "query",
49634
+ mode: "native",
49635
+ preferredChannel: "either"
49636
+ },
49637
+ {
49638
+ domain: "pipeline",
49639
+ operation: "manifest.stats",
49640
+ gateway: "query",
49641
+ mode: "native",
49642
+ preferredChannel: "either"
49643
+ },
49644
+ {
49645
+ domain: "pipeline",
49646
+ operation: "manifest.append",
49647
+ gateway: "mutate",
49648
+ mode: "native",
49649
+ preferredChannel: "either"
49650
+ },
49651
+ {
49652
+ domain: "pipeline",
49653
+ operation: "manifest.archive",
49654
+ gateway: "mutate",
49655
+ mode: "native",
49656
+ preferredChannel: "either"
49657
+ },
48571
49658
  // Phase sub-domain (T5326)
48572
- { domain: "pipeline", operation: "phase.show", gateway: "query", mode: "native" },
48573
- { domain: "pipeline", operation: "phase.list", gateway: "query", mode: "native" },
48574
- { domain: "pipeline", operation: "phase.set", gateway: "mutate", mode: "native" },
48575
- { domain: "pipeline", operation: "phase.advance", gateway: "mutate", mode: "native" },
48576
- { domain: "pipeline", operation: "phase.rename", gateway: "mutate", mode: "native" },
48577
- { domain: "pipeline", operation: "phase.delete", gateway: "mutate", mode: "native" },
49659
+ {
49660
+ domain: "pipeline",
49661
+ operation: "phase.show",
49662
+ gateway: "query",
49663
+ mode: "native",
49664
+ preferredChannel: "either"
49665
+ },
49666
+ {
49667
+ domain: "pipeline",
49668
+ operation: "phase.list",
49669
+ gateway: "query",
49670
+ mode: "native",
49671
+ preferredChannel: "either"
49672
+ },
49673
+ {
49674
+ domain: "pipeline",
49675
+ operation: "phase.set",
49676
+ gateway: "mutate",
49677
+ mode: "native",
49678
+ preferredChannel: "either"
49679
+ },
49680
+ {
49681
+ domain: "pipeline",
49682
+ operation: "phase.advance",
49683
+ gateway: "mutate",
49684
+ mode: "native",
49685
+ preferredChannel: "either"
49686
+ },
49687
+ {
49688
+ domain: "pipeline",
49689
+ operation: "phase.rename",
49690
+ gateway: "mutate",
49691
+ mode: "native",
49692
+ preferredChannel: "either"
49693
+ },
49694
+ {
49695
+ domain: "pipeline",
49696
+ operation: "phase.delete",
49697
+ gateway: "mutate",
49698
+ mode: "native",
49699
+ preferredChannel: "either"
49700
+ },
48578
49701
  // Chain sub-domain (T5405)
48579
- { domain: "pipeline", operation: "chain.show", gateway: "query", mode: "native" },
48580
- { domain: "pipeline", operation: "chain.list", gateway: "query", mode: "native" },
48581
- { domain: "pipeline", operation: "chain.add", gateway: "mutate", mode: "native" },
48582
- { domain: "pipeline", operation: "chain.instantiate", gateway: "mutate", mode: "native" },
48583
- { domain: "pipeline", operation: "chain.advance", gateway: "mutate", mode: "native" },
49702
+ {
49703
+ domain: "pipeline",
49704
+ operation: "chain.show",
49705
+ gateway: "query",
49706
+ mode: "native",
49707
+ preferredChannel: "either"
49708
+ },
49709
+ {
49710
+ domain: "pipeline",
49711
+ operation: "chain.list",
49712
+ gateway: "query",
49713
+ mode: "native",
49714
+ preferredChannel: "either"
49715
+ },
49716
+ {
49717
+ domain: "pipeline",
49718
+ operation: "chain.add",
49719
+ gateway: "mutate",
49720
+ mode: "native",
49721
+ preferredChannel: "either"
49722
+ },
49723
+ {
49724
+ domain: "pipeline",
49725
+ operation: "chain.instantiate",
49726
+ gateway: "mutate",
49727
+ mode: "native",
49728
+ preferredChannel: "either"
49729
+ },
49730
+ {
49731
+ domain: "pipeline",
49732
+ operation: "chain.advance",
49733
+ gateway: "mutate",
49734
+ mode: "native",
49735
+ preferredChannel: "either"
49736
+ },
48584
49737
  // Release sub-domain (T5615 consolidated)
48585
- { domain: "pipeline", operation: "release.list", gateway: "query", mode: "native" },
48586
- { domain: "pipeline", operation: "release.show", gateway: "query", mode: "native" },
48587
- { domain: "pipeline", operation: "release.channel.show", gateway: "query", mode: "native" },
48588
- { domain: "pipeline", operation: "release.ship", gateway: "mutate", mode: "native" },
48589
- { domain: "pipeline", operation: "release.cancel", gateway: "mutate", mode: "native" },
48590
- { domain: "pipeline", operation: "release.rollback", gateway: "mutate", mode: "native" },
49738
+ {
49739
+ domain: "pipeline",
49740
+ operation: "release.list",
49741
+ gateway: "query",
49742
+ mode: "native",
49743
+ preferredChannel: "either"
49744
+ },
49745
+ {
49746
+ domain: "pipeline",
49747
+ operation: "release.show",
49748
+ gateway: "query",
49749
+ mode: "native",
49750
+ preferredChannel: "either"
49751
+ },
49752
+ {
49753
+ domain: "pipeline",
49754
+ operation: "release.channel.show",
49755
+ gateway: "query",
49756
+ mode: "native",
49757
+ preferredChannel: "either"
49758
+ },
49759
+ {
49760
+ domain: "pipeline",
49761
+ operation: "release.ship",
49762
+ gateway: "mutate",
49763
+ mode: "native",
49764
+ preferredChannel: "cli"
49765
+ },
49766
+ {
49767
+ domain: "pipeline",
49768
+ operation: "release.cancel",
49769
+ gateway: "mutate",
49770
+ mode: "native",
49771
+ preferredChannel: "either"
49772
+ },
49773
+ {
49774
+ domain: "pipeline",
49775
+ operation: "release.rollback",
49776
+ gateway: "mutate",
49777
+ mode: "native",
49778
+ preferredChannel: "either"
49779
+ },
48591
49780
  // === Tools Domain ===
48592
49781
  // Issue operations
48593
- { domain: "tools", operation: "issue.diagnostics", gateway: "query", mode: "native" },
49782
+ {
49783
+ domain: "tools",
49784
+ operation: "issue.diagnostics",
49785
+ gateway: "query",
49786
+ mode: "native",
49787
+ preferredChannel: "either"
49788
+ },
48594
49789
  // Skill operations
48595
- { domain: "tools", operation: "skill.list", gateway: "query", mode: "native" },
48596
- { domain: "tools", operation: "skill.show", gateway: "query", mode: "native" },
48597
- { domain: "tools", operation: "skill.find", gateway: "query", mode: "native" },
48598
- { domain: "tools", operation: "skill.dispatch", gateway: "query", mode: "native" },
48599
- { domain: "tools", operation: "skill.verify", gateway: "query", mode: "native" },
48600
- { domain: "tools", operation: "skill.dependencies", gateway: "query", mode: "native" },
48601
- { domain: "tools", operation: "skill.spawn.providers", gateway: "query", mode: "native" },
48602
- { domain: "tools", operation: "skill.catalog", gateway: "query", mode: "native" },
48603
- { domain: "tools", operation: "skill.precedence", gateway: "query", mode: "native" },
48604
- { domain: "tools", operation: "skill.install", gateway: "mutate", mode: "native" },
48605
- { domain: "tools", operation: "skill.uninstall", gateway: "mutate", mode: "native" },
48606
- { domain: "tools", operation: "skill.refresh", gateway: "mutate", mode: "native" },
49790
+ {
49791
+ domain: "tools",
49792
+ operation: "skill.list",
49793
+ gateway: "query",
49794
+ mode: "native",
49795
+ preferredChannel: "mcp"
49796
+ },
49797
+ {
49798
+ domain: "tools",
49799
+ operation: "skill.show",
49800
+ gateway: "query",
49801
+ mode: "native",
49802
+ preferredChannel: "mcp"
49803
+ },
49804
+ {
49805
+ domain: "tools",
49806
+ operation: "skill.find",
49807
+ gateway: "query",
49808
+ mode: "native",
49809
+ preferredChannel: "mcp"
49810
+ },
49811
+ {
49812
+ domain: "tools",
49813
+ operation: "skill.dispatch",
49814
+ gateway: "query",
49815
+ mode: "native",
49816
+ preferredChannel: "either"
49817
+ },
49818
+ {
49819
+ domain: "tools",
49820
+ operation: "skill.verify",
49821
+ gateway: "query",
49822
+ mode: "native",
49823
+ preferredChannel: "either"
49824
+ },
49825
+ {
49826
+ domain: "tools",
49827
+ operation: "skill.dependencies",
49828
+ gateway: "query",
49829
+ mode: "native",
49830
+ preferredChannel: "either"
49831
+ },
49832
+ {
49833
+ domain: "tools",
49834
+ operation: "skill.spawn.providers",
49835
+ gateway: "query",
49836
+ mode: "native",
49837
+ preferredChannel: "either"
49838
+ },
49839
+ {
49840
+ domain: "tools",
49841
+ operation: "skill.catalog",
49842
+ gateway: "query",
49843
+ mode: "native",
49844
+ preferredChannel: "either"
49845
+ },
49846
+ {
49847
+ domain: "tools",
49848
+ operation: "skill.precedence",
49849
+ gateway: "query",
49850
+ mode: "native",
49851
+ preferredChannel: "either"
49852
+ },
49853
+ {
49854
+ domain: "tools",
49855
+ operation: "skill.install",
49856
+ gateway: "mutate",
49857
+ mode: "native",
49858
+ preferredChannel: "either"
49859
+ },
49860
+ {
49861
+ domain: "tools",
49862
+ operation: "skill.uninstall",
49863
+ gateway: "mutate",
49864
+ mode: "native",
49865
+ preferredChannel: "either"
49866
+ },
49867
+ {
49868
+ domain: "tools",
49869
+ operation: "skill.refresh",
49870
+ gateway: "mutate",
49871
+ mode: "native",
49872
+ preferredChannel: "either"
49873
+ },
48607
49874
  // Provider operations
48608
- { domain: "tools", operation: "provider.list", gateway: "query", mode: "native" },
48609
- { domain: "tools", operation: "provider.detect", gateway: "query", mode: "native" },
48610
- { domain: "tools", operation: "provider.inject.status", gateway: "query", mode: "native" },
48611
- { domain: "tools", operation: "provider.supports", gateway: "query", mode: "native" },
48612
- { domain: "tools", operation: "provider.hooks", gateway: "query", mode: "native" },
48613
- { domain: "tools", operation: "provider.inject", gateway: "mutate", mode: "native" },
49875
+ {
49876
+ domain: "tools",
49877
+ operation: "provider.list",
49878
+ gateway: "query",
49879
+ mode: "native",
49880
+ preferredChannel: "mcp"
49881
+ },
49882
+ {
49883
+ domain: "tools",
49884
+ operation: "provider.detect",
49885
+ gateway: "query",
49886
+ mode: "native",
49887
+ preferredChannel: "mcp"
49888
+ },
49889
+ {
49890
+ domain: "tools",
49891
+ operation: "provider.inject.status",
49892
+ gateway: "query",
49893
+ mode: "native",
49894
+ preferredChannel: "either"
49895
+ },
49896
+ {
49897
+ domain: "tools",
49898
+ operation: "provider.supports",
49899
+ gateway: "query",
49900
+ mode: "native",
49901
+ preferredChannel: "either"
49902
+ },
49903
+ {
49904
+ domain: "tools",
49905
+ operation: "provider.hooks",
49906
+ gateway: "query",
49907
+ mode: "native",
49908
+ preferredChannel: "either"
49909
+ },
49910
+ {
49911
+ domain: "tools",
49912
+ operation: "provider.inject",
49913
+ gateway: "mutate",
49914
+ mode: "native",
49915
+ preferredChannel: "either"
49916
+ },
49917
+ // Adapter sub-domain (T5240)
49918
+ {
49919
+ domain: "tools",
49920
+ operation: "adapter.list",
49921
+ gateway: "query",
49922
+ mode: "native",
49923
+ preferredChannel: "mcp"
49924
+ },
49925
+ {
49926
+ domain: "tools",
49927
+ operation: "adapter.show",
49928
+ gateway: "query",
49929
+ mode: "native",
49930
+ preferredChannel: "mcp"
49931
+ },
49932
+ {
49933
+ domain: "tools",
49934
+ operation: "adapter.detect",
49935
+ gateway: "query",
49936
+ mode: "native",
49937
+ preferredChannel: "either"
49938
+ },
49939
+ {
49940
+ domain: "tools",
49941
+ operation: "adapter.health",
49942
+ gateway: "query",
49943
+ mode: "native",
49944
+ preferredChannel: "either"
49945
+ },
49946
+ {
49947
+ domain: "tools",
49948
+ operation: "adapter.activate",
49949
+ gateway: "mutate",
49950
+ mode: "native",
49951
+ preferredChannel: "mcp"
49952
+ },
49953
+ {
49954
+ domain: "tools",
49955
+ operation: "adapter.dispose",
49956
+ gateway: "mutate",
49957
+ mode: "native",
49958
+ preferredChannel: "either"
49959
+ },
48614
49960
  // === Nexus Domain ===
48615
49961
  // Query operations
48616
- { domain: "nexus", operation: "status", gateway: "query", mode: "native" },
48617
- { domain: "nexus", operation: "list", gateway: "query", mode: "native" },
48618
- { domain: "nexus", operation: "show", gateway: "query", mode: "native" },
48619
- { domain: "nexus", operation: "search", gateway: "query", mode: "native" },
48620
- { domain: "nexus", operation: "graph", gateway: "query", mode: "native" },
48621
- { domain: "nexus", operation: "deps", gateway: "query", mode: "native" },
48622
- { domain: "nexus", operation: "resolve", gateway: "query", mode: "native" },
48623
- { domain: "nexus", operation: "discover", gateway: "query", mode: "native" },
48624
- { domain: "nexus", operation: "orphans.list", gateway: "query", mode: "native" },
48625
- { domain: "nexus", operation: "blockers.show", gateway: "query", mode: "native" },
48626
- { domain: "nexus", operation: "path.show", gateway: "query", mode: "native" },
48627
- { domain: "nexus", operation: "share.status", gateway: "query", mode: "native" },
49962
+ {
49963
+ domain: "nexus",
49964
+ operation: "status",
49965
+ gateway: "query",
49966
+ mode: "native",
49967
+ preferredChannel: "either"
49968
+ },
49969
+ {
49970
+ domain: "nexus",
49971
+ operation: "list",
49972
+ gateway: "query",
49973
+ mode: "native",
49974
+ preferredChannel: "either"
49975
+ },
49976
+ {
49977
+ domain: "nexus",
49978
+ operation: "show",
49979
+ gateway: "query",
49980
+ mode: "native",
49981
+ preferredChannel: "either"
49982
+ },
49983
+ {
49984
+ domain: "nexus",
49985
+ operation: "search",
49986
+ gateway: "query",
49987
+ mode: "native",
49988
+ preferredChannel: "either"
49989
+ },
49990
+ {
49991
+ domain: "nexus",
49992
+ operation: "graph",
49993
+ gateway: "query",
49994
+ mode: "native",
49995
+ preferredChannel: "either"
49996
+ },
49997
+ {
49998
+ domain: "nexus",
49999
+ operation: "deps",
50000
+ gateway: "query",
50001
+ mode: "native",
50002
+ preferredChannel: "either"
50003
+ },
50004
+ {
50005
+ domain: "nexus",
50006
+ operation: "resolve",
50007
+ gateway: "query",
50008
+ mode: "native",
50009
+ preferredChannel: "either"
50010
+ },
50011
+ {
50012
+ domain: "nexus",
50013
+ operation: "discover",
50014
+ gateway: "query",
50015
+ mode: "native",
50016
+ preferredChannel: "either"
50017
+ },
50018
+ {
50019
+ domain: "nexus",
50020
+ operation: "orphans.list",
50021
+ gateway: "query",
50022
+ mode: "native",
50023
+ preferredChannel: "either"
50024
+ },
50025
+ {
50026
+ domain: "nexus",
50027
+ operation: "blockers.show",
50028
+ gateway: "query",
50029
+ mode: "native",
50030
+ preferredChannel: "either"
50031
+ },
50032
+ {
50033
+ domain: "nexus",
50034
+ operation: "path.show",
50035
+ gateway: "query",
50036
+ mode: "native",
50037
+ preferredChannel: "either"
50038
+ },
50039
+ {
50040
+ domain: "nexus",
50041
+ operation: "share.status",
50042
+ gateway: "query",
50043
+ mode: "native",
50044
+ preferredChannel: "either"
50045
+ },
50046
+ {
50047
+ domain: "nexus",
50048
+ operation: "transfer.preview",
50049
+ gateway: "query",
50050
+ mode: "native",
50051
+ preferredChannel: "either"
50052
+ },
48628
50053
  // Mutate operations
48629
- { domain: "nexus", operation: "init", gateway: "mutate", mode: "native" },
48630
- { domain: "nexus", operation: "register", gateway: "mutate", mode: "native" },
48631
- { domain: "nexus", operation: "unregister", gateway: "mutate", mode: "native" },
48632
- { domain: "nexus", operation: "sync", gateway: "mutate", mode: "native" },
48633
- { domain: "nexus", operation: "reconcile", gateway: "mutate", mode: "native" },
48634
- { domain: "nexus", operation: "permission.set", gateway: "mutate", mode: "native" },
48635
- { domain: "nexus", operation: "share.snapshot.export", gateway: "mutate", mode: "native" },
48636
- { domain: "nexus", operation: "share.snapshot.import", gateway: "mutate", mode: "native" },
50054
+ {
50055
+ domain: "nexus",
50056
+ operation: "init",
50057
+ gateway: "mutate",
50058
+ mode: "native",
50059
+ preferredChannel: "either"
50060
+ },
50061
+ {
50062
+ domain: "nexus",
50063
+ operation: "register",
50064
+ gateway: "mutate",
50065
+ mode: "native",
50066
+ preferredChannel: "either"
50067
+ },
50068
+ {
50069
+ domain: "nexus",
50070
+ operation: "unregister",
50071
+ gateway: "mutate",
50072
+ mode: "native",
50073
+ preferredChannel: "either"
50074
+ },
50075
+ {
50076
+ domain: "nexus",
50077
+ operation: "sync",
50078
+ gateway: "mutate",
50079
+ mode: "native",
50080
+ preferredChannel: "either"
50081
+ },
50082
+ {
50083
+ domain: "nexus",
50084
+ operation: "reconcile",
50085
+ gateway: "mutate",
50086
+ mode: "native",
50087
+ preferredChannel: "either"
50088
+ },
50089
+ {
50090
+ domain: "nexus",
50091
+ operation: "permission.set",
50092
+ gateway: "mutate",
50093
+ mode: "native",
50094
+ preferredChannel: "either"
50095
+ },
50096
+ {
50097
+ domain: "nexus",
50098
+ operation: "share.snapshot.export",
50099
+ gateway: "mutate",
50100
+ mode: "native",
50101
+ preferredChannel: "either"
50102
+ },
50103
+ {
50104
+ domain: "nexus",
50105
+ operation: "share.snapshot.import",
50106
+ gateway: "mutate",
50107
+ mode: "native",
50108
+ preferredChannel: "either"
50109
+ },
50110
+ {
50111
+ domain: "nexus",
50112
+ operation: "transfer",
50113
+ gateway: "mutate",
50114
+ mode: "native",
50115
+ preferredChannel: "either"
50116
+ },
48637
50117
  // === Sticky Domain ===
48638
50118
  // Query operations
48639
- { domain: "sticky", operation: "list", gateway: "query", mode: "native" },
48640
- { domain: "sticky", operation: "show", gateway: "query", mode: "native" },
50119
+ {
50120
+ domain: "sticky",
50121
+ operation: "list",
50122
+ gateway: "query",
50123
+ mode: "native",
50124
+ preferredChannel: "mcp"
50125
+ },
50126
+ {
50127
+ domain: "sticky",
50128
+ operation: "show",
50129
+ gateway: "query",
50130
+ mode: "native",
50131
+ preferredChannel: "mcp"
50132
+ },
48641
50133
  // Mutate operations
48642
- { domain: "sticky", operation: "add", gateway: "mutate", mode: "native" },
48643
- { domain: "sticky", operation: "archive", gateway: "mutate", mode: "native" },
48644
- { domain: "sticky", operation: "convert", gateway: "mutate", mode: "native" },
48645
- { domain: "sticky", operation: "purge", gateway: "mutate", mode: "native" }
50134
+ {
50135
+ domain: "sticky",
50136
+ operation: "add",
50137
+ gateway: "mutate",
50138
+ mode: "native",
50139
+ preferredChannel: "mcp"
50140
+ },
50141
+ {
50142
+ domain: "sticky",
50143
+ operation: "archive",
50144
+ gateway: "mutate",
50145
+ mode: "native",
50146
+ preferredChannel: "either"
50147
+ },
50148
+ {
50149
+ domain: "sticky",
50150
+ operation: "convert",
50151
+ gateway: "mutate",
50152
+ mode: "native",
50153
+ preferredChannel: "either"
50154
+ },
50155
+ {
50156
+ domain: "sticky",
50157
+ operation: "purge",
50158
+ gateway: "mutate",
50159
+ mode: "native",
50160
+ preferredChannel: "either"
50161
+ }
48646
50162
  ];
48647
50163
  }
48648
50164
  });
@@ -51405,6 +52921,7 @@ var init_config2 = __esm({
51405
52921
 
51406
52922
  // packages/core/src/skills/agents/install.ts
51407
52923
  import { existsSync as existsSync67, mkdirSync as mkdirSync14, readdirSync as readdirSync25, readlinkSync, symlinkSync, unlinkSync as unlinkSync4 } from "node:fs";
52924
+ import { platform as platform2 } from "node:os";
51408
52925
  import { basename as basename12, join as join70 } from "node:path";
51409
52926
  function getAgentInstallDir() {
51410
52927
  return getClaudeAgentsDir();
@@ -51435,7 +52952,7 @@ function installAgent(agentDir) {
51435
52952
  }
51436
52953
  }
51437
52954
  try {
51438
- symlinkSync(agentDir, targetPath, "dir");
52955
+ symlinkSync(agentDir, targetPath, DIR_SYMLINK_TYPE);
51439
52956
  return { installed: true, path: targetPath };
51440
52957
  } catch (err) {
51441
52958
  return { installed: false, path: targetPath, error: `Symlink failed: ${err}` };
@@ -51475,11 +52992,13 @@ function uninstallAgent(agentName) {
51475
52992
  return false;
51476
52993
  }
51477
52994
  }
52995
+ var DIR_SYMLINK_TYPE;
51478
52996
  var init_install = __esm({
51479
52997
  "packages/core/src/skills/agents/install.ts"() {
51480
52998
  "use strict";
51481
52999
  init_paths();
51482
53000
  init_config2();
53001
+ DIR_SYMLINK_TYPE = platform2() === "win32" ? "junction" : "dir";
51483
53002
  }
51484
53003
  });
51485
53004
 
@@ -53412,8 +54931,9 @@ var init_validator = __esm({
53412
54931
  // packages/core/src/skills/skill-paths.ts
53413
54932
  import { existsSync as existsSync77, lstatSync, readlinkSync as readlinkSync2, realpathSync as realpathSync2 } from "node:fs";
53414
54933
  import { delimiter, join as join79, resolve as resolve9 } from "node:path";
54934
+ import { getCanonicalSkillsDir as getCanonicalSkillsDir2 } from "@cleocode/caamp";
53415
54935
  function getCaampCanonical() {
53416
- return join79(getAgentsHome(), "skills");
54936
+ return getCanonicalSkillsDir2();
53417
54937
  }
53418
54938
  function getProjectEmbedded(projectRoot) {
53419
54939
  const root = projectRoot ?? process.cwd();
@@ -53533,7 +55053,6 @@ function getSkillSourceType(skillDir, projectRoot) {
53533
55053
  var init_skill_paths = __esm({
53534
55054
  "packages/core/src/skills/skill-paths.ts"() {
53535
55055
  "use strict";
53536
- init_paths();
53537
55056
  }
53538
55057
  });
53539
55058
 
@@ -55464,7 +56983,7 @@ import { createGzip } from "node:zlib";
55464
56983
  async function pruneAuditLog(cleoDir, config2) {
55465
56984
  try {
55466
56985
  if (!config2.auditRetentionDays || config2.auditRetentionDays <= 0) {
55467
- log6.debug("auditRetentionDays is 0 or unset; skipping audit prune");
56986
+ log7.debug("auditRetentionDays is 0 or unset; skipping audit prune");
55468
56987
  return { rowsArchived: 0, rowsDeleted: 0 };
55469
56988
  }
55470
56989
  const cutoff = new Date(Date.now() - config2.auditRetentionDays * 864e5).toISOString();
@@ -55475,7 +56994,7 @@ async function pruneAuditLog(cleoDir, config2) {
55475
56994
  const db = await getDb4(projectRoot);
55476
56995
  const oldRows = await db.select().from(auditLog2).where(lt3(auditLog2.timestamp, cutoff));
55477
56996
  if (oldRows.length === 0) {
55478
- log6.debug("No audit_log rows older than cutoff; nothing to prune");
56997
+ log7.debug("No audit_log rows older than cutoff; nothing to prune");
55479
56998
  return { rowsArchived: 0, rowsDeleted: 0 };
55480
56999
  }
55481
57000
  let archivePath;
@@ -55493,17 +57012,17 @@ async function pruneAuditLog(cleoDir, config2) {
55493
57012
  const inStream = Readable.from([jsonlContent]);
55494
57013
  await pipeline(inStream, gzip, outStream);
55495
57014
  rowsArchived = oldRows.length;
55496
- log6.info(
57015
+ log7.info(
55497
57016
  { archivePath, rowsArchived },
55498
57017
  `Archived ${rowsArchived} audit rows to ${archivePath}`
55499
57018
  );
55500
57019
  } catch (archiveErr) {
55501
- log6.warn({ err: archiveErr }, "Failed to archive audit rows; continuing with deletion");
57020
+ log7.warn({ err: archiveErr }, "Failed to archive audit rows; continuing with deletion");
55502
57021
  archivePath = void 0;
55503
57022
  }
55504
57023
  }
55505
57024
  await db.delete(auditLog2).where(lt3(auditLog2.timestamp, cutoff)).run();
55506
- log6.info(
57025
+ log7.info(
55507
57026
  { rowsDeleted: oldRows.length, cutoff },
55508
57027
  `Pruned ${oldRows.length} audit_log rows older than ${cutoff}`
55509
57028
  );
@@ -55513,16 +57032,16 @@ async function pruneAuditLog(cleoDir, config2) {
55513
57032
  archivePath
55514
57033
  };
55515
57034
  } catch (err) {
55516
- log6.warn({ err }, "audit log pruning failed");
57035
+ log7.warn({ err }, "audit log pruning failed");
55517
57036
  return { rowsArchived: 0, rowsDeleted: 0 };
55518
57037
  }
55519
57038
  }
55520
- var log6;
57039
+ var log7;
55521
57040
  var init_audit_prune = __esm({
55522
57041
  "packages/core/src/audit-prune.ts"() {
55523
57042
  "use strict";
55524
57043
  init_logger();
55525
- log6 = getLogger("prune");
57044
+ log7 = getLogger("prune");
55526
57045
  }
55527
57046
  });
55528
57047
 
@@ -55914,7 +57433,7 @@ function getNodeVersionInfo() {
55914
57433
  };
55915
57434
  }
55916
57435
  function getNodeUpgradeInstructions() {
55917
- const platform3 = detectPlatform();
57436
+ const platform5 = detectPlatform();
55918
57437
  const arch2 = process.arch;
55919
57438
  const instructions = [];
55920
57439
  const hasFnm = commandExists2("fnm");
@@ -55929,7 +57448,7 @@ function getNodeUpgradeInstructions() {
55929
57448
  if (hasVolta) {
55930
57449
  instructions.push(`volta install node@${MINIMUM_NODE_MAJOR}`);
55931
57450
  }
55932
- switch (platform3) {
57451
+ switch (platform5) {
55933
57452
  case "linux":
55934
57453
  if (commandExists2("dnf")) {
55935
57454
  instructions.push(
@@ -55961,7 +57480,7 @@ function getNodeUpgradeInstructions() {
55961
57480
  }
55962
57481
  instructions.push(`https://nodejs.org/en/download/`);
55963
57482
  const recommended = instructions[0] ?? `https://nodejs.org/en/download/`;
55964
- return { platform: platform3, arch: arch2, instructions, recommended };
57483
+ return { platform: platform5, arch: arch2, instructions, recommended };
55965
57484
  }
55966
57485
  function getSystemInfo2() {
55967
57486
  return {
@@ -57496,12 +59015,22 @@ async function startupHealthCheck(projectRoot) {
57496
59015
  message: scaffoldResult.home.action === "skipped" ? "Global home already current" : `Global home ${scaffoldResult.home.action}: ${scaffoldResult.home.details ?? ""}`,
57497
59016
  repaired: scaffoldResult.home.action !== "skipped"
57498
59017
  });
57499
- checks.push({
57500
- check: "global_schemas",
57501
- status: "pass",
57502
- message: `Schemas: ${scaffoldResult.schemas.installed} installed, ${scaffoldResult.schemas.updated} updated of ${scaffoldResult.schemas.total}`,
57503
- repaired: scaffoldResult.schemas.installed > 0 || scaffoldResult.schemas.updated > 0
57504
- });
59018
+ if (!globalSchemaCheck.ok) {
59019
+ const { ensureGlobalSchemas: ensureGlobalSchemas2 } = await Promise.resolve().then(() => (init_schema_management(), schema_management_exports));
59020
+ const schemaResult = ensureGlobalSchemas2();
59021
+ checks.push({
59022
+ check: "global_schemas",
59023
+ status: "pass",
59024
+ message: `Schemas: ${schemaResult.installed} installed, ${schemaResult.updated} updated of ${schemaResult.total}`,
59025
+ repaired: schemaResult.installed > 0 || schemaResult.updated > 0
59026
+ });
59027
+ } else {
59028
+ checks.push({
59029
+ check: "global_schemas",
59030
+ status: "pass",
59031
+ message: `All ${globalSchemaCheck.installed} schemas current`
59032
+ });
59033
+ }
57505
59034
  checks.push({
57506
59035
  check: "global_templates",
57507
59036
  status: "pass",
@@ -59038,13 +60567,13 @@ var init_templates = __esm({
59038
60567
 
59039
60568
  // packages/core/src/ui/aliases.ts
59040
60569
  import { existsSync as existsSync93, readFileSync as readFileSync67, writeFileSync as writeFileSync15 } from "node:fs";
59041
- import { homedir as homedir5, platform as platform2 } from "node:os";
60570
+ import { homedir as homedir5, platform as platform3 } from "node:os";
59042
60571
  import { join as join96 } from "node:path";
59043
60572
  function getCurrentShell() {
59044
60573
  const shell = process.env.SHELL ?? "";
59045
60574
  if (shell.includes("zsh")) return "zsh";
59046
60575
  if (shell.includes("bash")) return "bash";
59047
- if (platform2() === "win32") return "powershell";
60576
+ if (platform3() === "win32") return "powershell";
59048
60577
  return "bash";
59049
60578
  }
59050
60579
  function getRcFilePath(shell) {
@@ -59068,7 +60597,7 @@ function detectAvailableShells() {
59068
60597
  const shells = [];
59069
60598
  if (existsSync93(getRcFilePath("bash")) || existsSync93("/bin/bash")) shells.push("bash");
59070
60599
  if (existsSync93(getRcFilePath("zsh")) || existsSync93("/bin/zsh")) shells.push("zsh");
59071
- if (platform2() === "win32") shells.push("powershell");
60600
+ if (platform3() === "win32") shells.push("powershell");
59072
60601
  return shells;
59073
60602
  }
59074
60603
  function generateBashAliases(cleoPath) {
@@ -59532,27 +61061,10 @@ var init_flags = __esm({
59532
61061
  }
59533
61062
  });
59534
61063
 
59535
- // packages/core/src/ui/injection-legacy.ts
59536
- function getValidationKey(target) {
59537
- return INJECTION_VALIDATION_KEYS[target] ?? target.toLowerCase().replace(/[^a-z0-9]/g, "_");
59538
- }
59539
- var INJECTION_VALIDATION_KEYS;
59540
- var init_injection_legacy = __esm({
59541
- "packages/core/src/ui/injection-legacy.ts"() {
59542
- "use strict";
59543
- INJECTION_VALIDATION_KEYS = {
59544
- "CLAUDE.md": "claude_md",
59545
- "AGENTS.md": "agents_md",
59546
- "GEMINI.md": "gemini_md"
59547
- };
59548
- }
59549
- });
59550
-
59551
61064
  // packages/core/src/ui/index.ts
59552
61065
  var ui_exports = {};
59553
61066
  __export(ui_exports, {
59554
61067
  ALIASES_VERSION: () => ALIASES_VERSION,
59555
- INJECTION_VALIDATION_KEYS: () => INJECTION_VALIDATION_KEYS,
59556
61068
  appendToChangelog: () => appendToChangelog,
59557
61069
  checkAliasesStatus: () => checkAliasesStatus,
59558
61070
  defaultFlags: () => defaultFlags,
@@ -59569,7 +61081,6 @@ __export(ui_exports, {
59569
61081
  getCurrentShell: () => getCurrentShell,
59570
61082
  getInstalledVersion: () => getInstalledVersion,
59571
61083
  getRcFilePath: () => getRcFilePath,
59572
- getValidationKey: () => getValidationKey,
59573
61084
  groupTasksIntoSections: () => groupTasksIntoSections,
59574
61085
  hasAliasBlock: () => hasAliasBlock,
59575
61086
  injectAliases: () => injectAliases,
@@ -59589,7 +61100,6 @@ var init_ui = __esm({
59589
61100
  init_changelog();
59590
61101
  init_command_registry();
59591
61102
  init_flags();
59592
- init_injection_legacy();
59593
61103
  }
59594
61104
  });
59595
61105
 
@@ -62764,11 +64274,29 @@ __export(init_exports, {
62764
64274
  });
62765
64275
  import { existsSync as existsSync100, readdirSync as readdirSync33, readFileSync as readFileSync73 } from "node:fs";
62766
64276
  import { copyFile as copyFile3, lstat, mkdir as mkdir16, readFile as readFile17, symlink, unlink as unlink4, writeFile as writeFile11 } from "node:fs/promises";
64277
+ import { platform as platform4 } from "node:os";
62767
64278
  import { basename as basename17, dirname as dirname19, join as join100 } from "node:path";
62768
64279
  async function initAgentDefinition(created, warnings) {
62769
- const packageRoot = getPackageRoot();
62770
- const agentSourceDir = join100(packageRoot, "agents", "cleo-subagent");
62771
- if (!existsSync100(agentSourceDir)) {
64280
+ let agentSourceDir = null;
64281
+ try {
64282
+ const { createRequire: createRequire6 } = await import("node:module");
64283
+ const req = createRequire6(import.meta.url);
64284
+ const agentsPkgMain = req.resolve("@cleocode/agents/package.json");
64285
+ const agentsPkgRoot = dirname19(agentsPkgMain);
64286
+ const candidate = join100(agentsPkgRoot, "cleo-subagent");
64287
+ if (existsSync100(candidate)) {
64288
+ agentSourceDir = candidate;
64289
+ }
64290
+ } catch {
64291
+ }
64292
+ if (!agentSourceDir) {
64293
+ const packageRoot = getPackageRoot();
64294
+ const bundled = join100(packageRoot, "agents", "cleo-subagent");
64295
+ if (existsSync100(bundled)) {
64296
+ agentSourceDir = bundled;
64297
+ }
64298
+ }
64299
+ if (!agentSourceDir) {
62772
64300
  warnings.push("agents/cleo-subagent/ not found in package, skipping agent definition install");
62773
64301
  return;
62774
64302
  }
@@ -62782,7 +64310,7 @@ async function initAgentDefinition(created, warnings) {
62782
64310
  }
62783
64311
  } catch {
62784
64312
  }
62785
- await symlink(agentSourceDir, globalAgentsDir, "dir");
64313
+ await symlink(agentSourceDir, globalAgentsDir, DIR_SYMLINK_TYPE2);
62786
64314
  created.push("agent: cleo-subagent (symlinked)");
62787
64315
  } catch (_err) {
62788
64316
  try {
@@ -62841,17 +64369,29 @@ async function initCoreSkills(created, warnings) {
62841
64369
  const packageRoot = getPackageRoot();
62842
64370
  let ctSkillsRoot = null;
62843
64371
  try {
62844
- const bundledPath = join100(packageRoot, "packages", "skills");
62845
- if (existsSync100(join100(bundledPath, "skills.json"))) {
62846
- ctSkillsRoot = bundledPath;
62847
- } else {
62848
- const ctSkillsPath = join100(packageRoot, "node_modules", "@cleocode", "skills");
62849
- if (existsSync100(join100(ctSkillsPath, "skills.json"))) {
62850
- ctSkillsRoot = ctSkillsPath;
62851
- }
64372
+ const { createRequire: createRequire6 } = await import("node:module");
64373
+ const req = createRequire6(import.meta.url);
64374
+ const skillsPkgMain = req.resolve("@cleocode/skills/package.json");
64375
+ const skillsPkgRoot = dirname19(skillsPkgMain);
64376
+ if (existsSync100(join100(skillsPkgRoot, "skills.json"))) {
64377
+ ctSkillsRoot = skillsPkgRoot;
62852
64378
  }
62853
64379
  } catch {
62854
64380
  }
64381
+ if (!ctSkillsRoot) {
64382
+ try {
64383
+ const bundledPath = join100(packageRoot, "packages", "skills");
64384
+ if (existsSync100(join100(bundledPath, "skills.json"))) {
64385
+ ctSkillsRoot = bundledPath;
64386
+ } else {
64387
+ const ctSkillsPath = join100(packageRoot, "node_modules", "@cleocode", "skills");
64388
+ if (existsSync100(join100(ctSkillsPath, "skills.json"))) {
64389
+ ctSkillsRoot = ctSkillsPath;
64390
+ }
64391
+ }
64392
+ } catch {
64393
+ }
64394
+ }
62855
64395
  if (!ctSkillsRoot) {
62856
64396
  warnings.push("skills package not found, skipping core skill installation");
62857
64397
  return;
@@ -63143,7 +64683,6 @@ async function initProject(opts = {}) {
63143
64683
  warnings.push(`Contributor MCP setup: ${err instanceof Error ? err.message : String(err)}`);
63144
64684
  }
63145
64685
  await initAgentDefinition(created, warnings);
63146
- await initCoreSkills(created, warnings);
63147
64686
  await initNexusRegistration(projRoot, created, warnings);
63148
64687
  try {
63149
64688
  const { AdapterManager: AdapterManager2 } = await Promise.resolve().then(() => (init_adapters(), adapters_exports));
@@ -63230,6 +64769,7 @@ async function getVersion2(projectRoot) {
63230
64769
  }
63231
64770
  return { version: "0.0.0" };
63232
64771
  }
64772
+ var DIR_SYMLINK_TYPE2;
63233
64773
  var init_init = __esm({
63234
64774
  "packages/core/src/init.ts"() {
63235
64775
  "use strict";
@@ -63243,6 +64783,7 @@ var init_init = __esm({
63243
64783
  init_scaffold();
63244
64784
  init_schema_management();
63245
64785
  init_json2();
64786
+ DIR_SYMLINK_TYPE2 = platform4() === "win32" ? "junction" : "dir";
63246
64787
  }
63247
64788
  });
63248
64789
 
@@ -63265,7 +64806,7 @@ var init_context_alert = __esm({
63265
64806
  });
63266
64807
 
63267
64808
  // packages/core/src/output.ts
63268
- import { randomUUID as randomUUID5 } from "node:crypto";
64809
+ import { randomUUID as randomUUID6 } from "node:crypto";
63269
64810
  function pushWarning(warning) {
63270
64811
  pendingWarnings.push(warning);
63271
64812
  }
@@ -63282,7 +64823,7 @@ function createCliMeta(operation, mvi = "standard") {
63282
64823
  schemaVersion: "2026.2.1",
63283
64824
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
63284
64825
  operation,
63285
- requestId: randomUUID5(),
64826
+ requestId: randomUUID6(),
63286
64827
  transport: "cli",
63287
64828
  strict: true,
63288
64829
  mvi,
@@ -63880,6 +65421,7 @@ __export(src_exports, {
63880
65421
  });
63881
65422
  var init_src2 = __esm({
63882
65423
  "packages/core/src/index.ts"() {
65424
+ "use strict";
63883
65425
  init_src();
63884
65426
  init_adapters();
63885
65427
  init_admin();
@@ -64036,7 +65578,8 @@ async function injectAgentsHub(ctx) {
64036
65578
  await writeFile12(globalAgentsMd, stripped, "utf8");
64037
65579
  }
64038
65580
  }
64039
- const action = await inject2(globalAgentsMd, "@~/.cleo/templates/CLEO-INJECTION.md");
65581
+ const expectedContent = "@~/.cleo/templates/CLEO-INJECTION.md";
65582
+ const action = await inject2(globalAgentsMd, expectedContent);
64040
65583
  ctx.created.push(`~/.agents/AGENTS.md (${action})`);
64041
65584
  } else {
64042
65585
  ctx.created.push("~/.agents/AGENTS.md (would create/update CAAMP block)");
@@ -65298,7 +66841,7 @@ var init_chain_validation = __esm({
65298
66841
  });
65299
66842
 
65300
66843
  // packages/core/src/lifecycle/chain-store.ts
65301
- import { randomUUID as randomUUID6 } from "node:crypto";
66844
+ import { randomUUID as randomUUID7 } from "node:crypto";
65302
66845
  async function addChain(chain, projectRoot) {
65303
66846
  const validation = validateChain(chain);
65304
66847
  if (validation.errors.length > 0) {
@@ -65337,7 +66880,7 @@ async function createInstance(params, projectRoot) {
65337
66880
  if (!chain) {
65338
66881
  throw new Error(`Chain "${params.chainId}" not found`);
65339
66882
  }
65340
- const id = `wci-${randomUUID6().slice(0, 8)}`;
66883
+ const id = `wci-${randomUUID7().slice(0, 8)}`;
65341
66884
  const now2 = (/* @__PURE__ */ new Date()).toISOString();
65342
66885
  const variables = params.variables ?? {};
65343
66886
  const stageToTask = params.stageToTask ?? {};
@@ -67642,7 +69185,7 @@ var init_model_provider_registry = __esm({
67642
69185
  });
67643
69186
 
67644
69187
  // packages/core/src/metrics/token-service.ts
67645
- import { createHash as createHash13, randomUUID as randomUUID7 } from "node:crypto";
69188
+ import { createHash as createHash13, randomUUID as randomUUID8 } from "node:crypto";
67646
69189
  import { existsSync as existsSync106, readdirSync as readdirSync34, readFileSync as readFileSync78 } from "node:fs";
67647
69190
  import { join as join105 } from "node:path";
67648
69191
  function normalizeProvider(provider, model, runtimeProvider) {
@@ -67895,7 +69438,7 @@ async function recordTokenExchange(input) {
67895
69438
  const measurement = await measureTokenExchange(input);
67896
69439
  const db = await getDb4(input.cwd);
67897
69440
  const row = {
67898
- id: randomUUID7(),
69441
+ id: randomUUID8(),
67899
69442
  provider: measurement.provider,
67900
69443
  model: measurement.model,
67901
69444
  transport: input.transport ?? "unknown",
@@ -68122,13 +69665,13 @@ var init_parallel = __esm({
68122
69665
  // packages/core/src/orchestration/skill-ops.ts
68123
69666
  import { existsSync as existsSync107, readdirSync as readdirSync35, readFileSync as readFileSync79 } from "node:fs";
68124
69667
  import { join as join106 } from "node:path";
68125
- import { getCanonicalSkillsDir as getCanonicalSkillsDir2 } from "@cleocode/caamp";
69668
+ import { getCanonicalSkillsDir as getCanonicalSkillsDir3 } from "@cleocode/caamp";
68126
69669
  function getSkillContent(skillName, projectRoot) {
68127
69670
  if (!skillName) {
68128
69671
  throw new CleoError(2 /* INVALID_INPUT */, "skill name is required");
68129
69672
  }
68130
69673
  const projectSkillDir = join106(projectRoot, ".cleo", "skills", skillName);
68131
- const canonicalSkillDir = join106(getCanonicalSkillsDir2(), skillName);
69674
+ const canonicalSkillDir = join106(getCanonicalSkillsDir3(), skillName);
68132
69675
  const skillDir = existsSync107(projectSkillDir) ? projectSkillDir : canonicalSkillDir;
68133
69676
  if (!existsSync107(skillDir)) {
68134
69677
  throw new CleoError(
@@ -68588,7 +70131,7 @@ async function validateAndRepairSequence(cwd, config2 = {}) {
68588
70131
  }
68589
70132
  const repair = await repairSequence(cwd);
68590
70133
  if (repair.repaired) {
68591
- log7.warn(
70134
+ log8.warn(
68592
70135
  { oldCounter: repair.oldCounter, newCounter: repair.newCounter },
68593
70136
  "Sequence repaired"
68594
70137
  );
@@ -68617,7 +70160,7 @@ async function triggerCheckpoint(context, cwd, config2 = {}) {
68617
70160
  try {
68618
70161
  await gitCheckpoint("auto", context, cwd);
68619
70162
  } catch (err) {
68620
- log7.warn({ err }, "Checkpoint failed (non-fatal)");
70163
+ log8.warn({ err }, "Checkpoint failed (non-fatal)");
68621
70164
  }
68622
70165
  vacuumIntoBackup({ cwd }).catch(() => {
68623
70166
  });
@@ -68655,16 +70198,16 @@ async function safeDeleteTask(deleteFn, taskId, cwd, config2 = {}) {
68655
70198
  return result;
68656
70199
  }
68657
70200
  async function forceCheckpointBeforeOperation(operation, cwd) {
68658
- log7.info({ operation }, "Forcing checkpoint before operation");
70201
+ log8.info({ operation }, "Forcing checkpoint before operation");
68659
70202
  try {
68660
70203
  await gitCheckpoint("manual", `pre-${operation}`, cwd);
68661
70204
  } catch (err) {
68662
- log7.error({ err }, "Failed to create pre-operation checkpoint");
70205
+ log8.error({ err }, "Failed to create pre-operation checkpoint");
68663
70206
  }
68664
70207
  vacuumIntoBackup({ cwd, force: true }).catch(() => {
68665
70208
  });
68666
70209
  }
68667
- var log7, DEFAULT_CONFIG2, SafetyError;
70210
+ var log8, DEFAULT_CONFIG2, SafetyError;
68668
70211
  var init_data_safety = __esm({
68669
70212
  "packages/core/src/store/data-safety.ts"() {
68670
70213
  "use strict";
@@ -68674,7 +70217,7 @@ var init_data_safety = __esm({
68674
70217
  init_sqlite2();
68675
70218
  init_sqlite_backup();
68676
70219
  init_tasks_schema();
68677
- log7 = getLogger("data-safety");
70220
+ log8 = getLogger("data-safety");
68678
70221
  DEFAULT_CONFIG2 = {
68679
70222
  verifyWrites: true,
68680
70223
  detectCollisions: true,
@@ -72199,7 +73742,7 @@ async function validateLayer2Semantic(context) {
72199
73742
  }
72200
73743
  if (context.domain === "session" && context.operation === "start") {
72201
73744
  const scope = context.params?.scope;
72202
- if (scope && !scope.match(/^(epic|task|global):/)) {
73745
+ if (scope && scope !== "global" && !scope.match(/^(epic|task):/)) {
72203
73746
  violations.push({
72204
73747
  layer: 2 /* SEMANTIC */,
72205
73748
  severity: "error" /* ERROR */,
@@ -72207,7 +73750,7 @@ async function validateLayer2Semantic(context) {
72207
73750
  message: `Invalid session scope format: ${scope}`,
72208
73751
  field: "scope",
72209
73752
  constraint: "Must be epic:<id>, task:<id>, or global",
72210
- fix: "Use format: epic:T1234, task:T5678, or global"
73753
+ fix: 'Provide scope as "global" or "epic:TXXX"'
72211
73754
  });
72212
73755
  }
72213
73756
  }
@@ -74533,6 +76076,7 @@ __export(internal_exports, {
74533
76076
  ensureProjectContext: () => ensureProjectContext,
74534
76077
  ensureSqliteDb: () => ensureSqliteDb,
74535
76078
  estimateContext: () => estimateContext,
76079
+ executeTransfer: () => executeTransfer,
74536
76080
  exportSnapshot: () => exportSnapshot,
74537
76081
  exportTasks: () => exportTasks,
74538
76082
  exportTasksPackage: () => exportTasksPackage,
@@ -74659,6 +76203,7 @@ __export(internal_exports, {
74659
76203
  gradeSession: () => gradeSession,
74660
76204
  heartbeat: () => heartbeat,
74661
76205
  hooks: () => hooks,
76206
+ importFromPackage: () => importFromPackage,
74662
76207
  importSnapshot: () => importSnapshot,
74663
76208
  importTasks: () => importTasks,
74664
76209
  importTasksPackage: () => importTasksPackage,
@@ -74802,6 +76347,7 @@ __export(internal_exports, {
74802
76347
  predictValidationOutcome: () => predictValidationOutcome,
74803
76348
  prepareRelease: () => prepareRelease,
74804
76349
  prepareSpawn: () => prepareSpawn,
76350
+ previewTransfer: () => previewTransfer,
74805
76351
  protocolEnforcer: () => protocolEnforcer,
74806
76352
  pruneAuditLog: () => pruneAuditLog,
74807
76353
  pull: () => pull,
@@ -75092,6 +76638,7 @@ var init_internal = __esm({
75092
76638
  init_session_memory();
75093
76639
  init_discover();
75094
76640
  init_registry3();
76641
+ init_transfer();
75095
76642
  init_analyze();
75096
76643
  init_critical_path();
75097
76644
  init_orchestration();
@@ -76841,10 +78388,10 @@ function camelToKebab(str) {
76841
78388
  // packages/cleo/src/dispatch/adapters/cli.ts
76842
78389
  init_internal();
76843
78390
  init_renderers();
76844
- import { randomUUID as randomUUID9 } from "node:crypto";
78391
+ import { randomUUID as randomUUID10 } from "node:crypto";
76845
78392
 
76846
78393
  // packages/cleo/src/dispatch/lib/meta.ts
76847
- import { randomUUID as randomUUID8 } from "node:crypto";
78394
+ import { randomUUID as randomUUID9 } from "node:crypto";
76848
78395
  function createDispatchMeta(gateway, domain2, operation, startTime, source = "mcp", requestId, sessionId) {
76849
78396
  return {
76850
78397
  gateway,
@@ -76853,7 +78400,7 @@ function createDispatchMeta(gateway, domain2, operation, startTime, source = "mc
76853
78400
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
76854
78401
  duration_ms: Date.now() - startTime,
76855
78402
  source,
76856
- requestId: requestId ?? randomUUID8(),
78403
+ requestId: requestId ?? randomUUID9(),
76857
78404
  ...sessionId != null && { sessionId }
76858
78405
  };
76859
78406
  }
@@ -79409,6 +80956,95 @@ var OPERATIONS = [
79409
80956
  requiredParams: []
79410
80957
  },
79411
80958
  // ---------------------------------------------------------------------------
80959
+ // nexus.transfer — Cross-project task transfer (T046)
80960
+ // ---------------------------------------------------------------------------
80961
+ {
80962
+ gateway: "query",
80963
+ domain: "nexus",
80964
+ operation: "transfer.preview",
80965
+ description: "nexus.transfer.preview (query) \u2014 preview a cross-project task transfer",
80966
+ tier: 2,
80967
+ idempotent: true,
80968
+ sessionRequired: false,
80969
+ requiredParams: ["taskIds", "sourceProject", "targetProject"],
80970
+ params: [
80971
+ { name: "taskIds", type: "array", required: true, description: "Task IDs to transfer" },
80972
+ {
80973
+ name: "sourceProject",
80974
+ type: "string",
80975
+ required: true,
80976
+ description: "Source project name or hash"
80977
+ },
80978
+ {
80979
+ name: "targetProject",
80980
+ type: "string",
80981
+ required: true,
80982
+ description: "Target project name or hash"
80983
+ },
80984
+ {
80985
+ name: "mode",
80986
+ type: "string",
80987
+ required: false,
80988
+ description: "Transfer mode: 'copy' (default) or 'move'"
80989
+ },
80990
+ {
80991
+ name: "scope",
80992
+ type: "string",
80993
+ required: false,
80994
+ description: "Transfer scope: 'subtree' (default) or 'single'"
80995
+ }
80996
+ ]
80997
+ },
80998
+ {
80999
+ gateway: "mutate",
81000
+ domain: "nexus",
81001
+ operation: "transfer",
81002
+ description: "nexus.transfer (mutate) \u2014 transfer tasks between NEXUS projects",
81003
+ tier: 2,
81004
+ idempotent: false,
81005
+ sessionRequired: false,
81006
+ requiredParams: ["taskIds", "sourceProject", "targetProject"],
81007
+ params: [
81008
+ { name: "taskIds", type: "array", required: true, description: "Task IDs to transfer" },
81009
+ {
81010
+ name: "sourceProject",
81011
+ type: "string",
81012
+ required: true,
81013
+ description: "Source project name or hash"
81014
+ },
81015
+ {
81016
+ name: "targetProject",
81017
+ type: "string",
81018
+ required: true,
81019
+ description: "Target project name or hash"
81020
+ },
81021
+ {
81022
+ name: "mode",
81023
+ type: "string",
81024
+ required: false,
81025
+ description: "Transfer mode: 'copy' (default) or 'move'"
81026
+ },
81027
+ {
81028
+ name: "scope",
81029
+ type: "string",
81030
+ required: false,
81031
+ description: "Transfer scope: 'subtree' (default) or 'single'"
81032
+ },
81033
+ {
81034
+ name: "onConflict",
81035
+ type: "string",
81036
+ required: false,
81037
+ description: "Conflict strategy: 'rename' (default), 'skip', 'duplicate', 'fail'"
81038
+ },
81039
+ {
81040
+ name: "transferBrain",
81041
+ type: "boolean",
81042
+ required: false,
81043
+ description: "Whether to transfer brain observations (default: false)"
81044
+ }
81045
+ ]
81046
+ },
81047
+ // ---------------------------------------------------------------------------
79412
81048
  // sticky — Ephemeral notes for quick capture (T5282)
79413
81049
  // ---------------------------------------------------------------------------
79414
81050
  // Query operations
@@ -82123,8 +83759,15 @@ async function taskList(projectRoot, params) {
82123
83759
  data: { tasks: tasks2, total: result.total, filtered: result.filtered },
82124
83760
  page: result.page
82125
83761
  };
82126
- } catch {
82127
- return engineError("E_NOT_INITIALIZED", "Task database not initialized");
83762
+ } catch (err) {
83763
+ const code = err?.code;
83764
+ if (code === 4) return engineError("E_NOT_FOUND", err.message || "Task not found");
83765
+ if (code === 2)
83766
+ return engineError("E_INVALID_INPUT", err.message || "Invalid input");
83767
+ return engineError(
83768
+ "E_NOT_INITIALIZED",
83769
+ err.message || "Task database not initialized"
83770
+ );
82128
83771
  }
82129
83772
  }
82130
83773
  async function taskFind(projectRoot, query, limit, options) {
@@ -82151,8 +83794,15 @@ async function taskFind(projectRoot, query, limit, options) {
82151
83794
  parentId: r.parentId
82152
83795
  }));
82153
83796
  return { success: true, data: { results, total: results.length } };
82154
- } catch {
82155
- return engineError("E_NOT_INITIALIZED", "Task database not initialized");
83797
+ } catch (err) {
83798
+ const code = err?.code;
83799
+ if (code === 4) return engineError("E_NOT_FOUND", err.message || "Task not found");
83800
+ if (code === 2)
83801
+ return engineError("E_INVALID_INPUT", err.message || "Invalid input");
83802
+ return engineError(
83803
+ "E_NOT_INITIALIZED",
83804
+ err.message || "Task database not initialized"
83805
+ );
82156
83806
  }
82157
83807
  }
82158
83808
  async function taskCreate(projectRoot, params) {
@@ -83083,54 +84733,42 @@ function routeByParam(params, paramName, routes, defaultRoute) {
83083
84733
 
83084
84734
  // packages/cleo/src/dispatch/domains/admin.ts
83085
84735
  var AdminHandler = class {
83086
- projectRoot;
83087
- constructor() {
83088
- this.projectRoot = getProjectRoot();
83089
- }
83090
84736
  // -----------------------------------------------------------------------
83091
84737
  // Query
83092
84738
  // -----------------------------------------------------------------------
83093
84739
  async query(operation, params) {
84740
+ const projectRoot = getProjectRoot();
83094
84741
  const startTime = Date.now();
83095
84742
  try {
83096
84743
  switch (operation) {
83097
84744
  case "version": {
83098
- const result = await getVersion3(this.projectRoot);
84745
+ const result = await getVersion3(projectRoot);
83099
84746
  return wrapResult(result, "query", "admin", operation, startTime);
83100
84747
  }
83101
84748
  case "health": {
83102
84749
  const mode = params?.mode;
83103
84750
  if (mode === "diagnose") {
83104
- const result2 = await systemDoctor(this.projectRoot);
84751
+ const result2 = await systemDoctor(projectRoot);
83105
84752
  return wrapResult(result2, "query", "admin", operation, startTime);
83106
84753
  }
83107
- const result = systemHealth(
83108
- this.projectRoot,
83109
- params
83110
- );
84754
+ const result = systemHealth(projectRoot, params);
83111
84755
  return wrapResult(result, "query", "admin", operation, startTime);
83112
84756
  }
83113
84757
  case "config.show": {
83114
- const result = await configGet(this.projectRoot, params?.key);
84758
+ const result = await configGet(projectRoot, params?.key);
83115
84759
  return wrapResult(result, "query", "admin", operation, startTime);
83116
84760
  }
83117
84761
  case "stats": {
83118
- const result = await systemStats(
83119
- this.projectRoot,
83120
- params
83121
- );
84762
+ const result = await systemStats(projectRoot, params);
83122
84763
  return wrapResult(result, "query", "admin", operation, startTime);
83123
84764
  }
83124
84765
  case "context": {
83125
- const result = systemContext(
83126
- this.projectRoot,
83127
- params
83128
- );
84766
+ const result = systemContext(projectRoot, params);
83129
84767
  return wrapResult(result, "query", "admin", operation, startTime);
83130
84768
  }
83131
84769
  case "runtime": {
83132
84770
  const result = await systemRuntime(
83133
- this.projectRoot,
84771
+ projectRoot,
83134
84772
  params
83135
84773
  );
83136
84774
  return wrapResult(result, "query", "admin", operation, startTime);
@@ -83225,12 +84863,12 @@ var AdminHandler = class {
83225
84863
  }
83226
84864
  case "dash": {
83227
84865
  const blockedTasksLimit = typeof params?.blockedTasksLimit === "number" ? params.blockedTasksLimit : void 0;
83228
- const result = await systemDash(this.projectRoot, { blockedTasksLimit });
84866
+ const result = await systemDash(projectRoot, { blockedTasksLimit });
83229
84867
  return wrapResult(result, "query", "admin", operation, startTime);
83230
84868
  }
83231
84869
  case "log": {
83232
84870
  const result = await systemLog(
83233
- this.projectRoot,
84871
+ projectRoot,
83234
84872
  params
83235
84873
  );
83236
84874
  return wrapResult(result, "query", "admin", operation, startTime);
@@ -83247,7 +84885,7 @@ var AdminHandler = class {
83247
84885
  startTime
83248
84886
  );
83249
84887
  }
83250
- const result = await systemSequence(this.projectRoot, {
84888
+ const result = await systemSequence(projectRoot, {
83251
84889
  action
83252
84890
  });
83253
84891
  return wrapResult(result, "query", "admin", operation, startTime);
@@ -83265,7 +84903,7 @@ var AdminHandler = class {
83265
84903
  case "adr.find": {
83266
84904
  const query = params?.query;
83267
84905
  if (query) {
83268
- const result2 = await findAdrs(this.projectRoot, query, {
84906
+ const result2 = await findAdrs(projectRoot, query, {
83269
84907
  topics: params?.topics,
83270
84908
  keywords: params?.keywords,
83271
84909
  status: params?.status
@@ -83277,7 +84915,7 @@ var AdminHandler = class {
83277
84915
  };
83278
84916
  }
83279
84917
  const { limit, offset } = getListParams(params);
83280
- const result = await listAdrs(this.projectRoot, {
84918
+ const result = await listAdrs(projectRoot, {
83281
84919
  status: params?.status,
83282
84920
  since: params?.since,
83283
84921
  limit,
@@ -83302,7 +84940,7 @@ var AdminHandler = class {
83302
84940
  startTime
83303
84941
  );
83304
84942
  }
83305
- const adr = await showAdr(this.projectRoot, adrId);
84943
+ const adr = await showAdr(projectRoot, adrId);
83306
84944
  if (!adr) {
83307
84945
  return errorResult(
83308
84946
  "query",
@@ -83341,7 +84979,7 @@ var AdminHandler = class {
83341
84979
  since: params?.since,
83342
84980
  until: params?.until
83343
84981
  },
83344
- this.projectRoot
84982
+ projectRoot
83345
84983
  );
83346
84984
  return {
83347
84985
  _meta: dispatchMeta("query", "admin", operation, startTime),
@@ -83368,7 +85006,7 @@ var AdminHandler = class {
83368
85006
  limit,
83369
85007
  offset
83370
85008
  },
83371
- this.projectRoot
85009
+ projectRoot
83372
85010
  );
83373
85011
  return {
83374
85012
  _meta: dispatchMeta("query", "admin", operation, startTime),
@@ -83393,7 +85031,7 @@ var AdminHandler = class {
83393
85031
  startTime
83394
85032
  );
83395
85033
  }
83396
- const result = await showTokenUsage(tokenId, this.projectRoot);
85034
+ const result = await showTokenUsage(tokenId, projectRoot);
83397
85035
  if (!result) {
83398
85036
  return errorResult(
83399
85037
  "query",
@@ -83418,8 +85056,8 @@ var AdminHandler = class {
83418
85056
  case "export": {
83419
85057
  const scope = params?.scope;
83420
85058
  if (scope === "snapshot") {
83421
- const snapshot = await exportSnapshot(this.projectRoot);
83422
- const outputPath = params?.output ?? getDefaultSnapshotPath(this.projectRoot);
85059
+ const snapshot = await exportSnapshot(projectRoot);
85060
+ const outputPath = params?.output ?? getDefaultSnapshotPath(projectRoot);
83423
85061
  await writeSnapshot(snapshot, outputPath);
83424
85062
  return {
83425
85063
  _meta: dispatchMeta("query", "admin", operation, startTime),
@@ -83440,7 +85078,7 @@ var AdminHandler = class {
83440
85078
  filter: params?.filter,
83441
85079
  includeDeps: params?.includeDeps,
83442
85080
  dryRun: params?.dryRun,
83443
- cwd: this.projectRoot
85081
+ cwd: projectRoot
83444
85082
  });
83445
85083
  return {
83446
85084
  _meta: dispatchMeta("query", "admin", operation, startTime),
@@ -83454,7 +85092,7 @@ var AdminHandler = class {
83454
85092
  status: params?.status,
83455
85093
  parent: params?.parent,
83456
85094
  phase: params?.phase,
83457
- cwd: this.projectRoot
85095
+ cwd: projectRoot
83458
85096
  });
83459
85097
  return {
83460
85098
  _meta: dispatchMeta("query", "admin", operation, startTime),
@@ -83464,7 +85102,7 @@ var AdminHandler = class {
83464
85102
  }
83465
85103
  case "map": {
83466
85104
  const { mapCodebase: mapCodebase3 } = await Promise.resolve().then(() => (init_codebase_map_engine(), codebase_map_engine_exports));
83467
- const result = await mapCodebase3(this.projectRoot, {
85105
+ const result = await mapCodebase3(projectRoot, {
83468
85106
  focus: params?.focus,
83469
85107
  storeToBrain: false
83470
85108
  });
@@ -83485,12 +85123,13 @@ var AdminHandler = class {
83485
85123
  // Mutate
83486
85124
  // -----------------------------------------------------------------------
83487
85125
  async mutate(operation, params) {
85126
+ const projectRoot = getProjectRoot();
83488
85127
  const startTime = Date.now();
83489
85128
  try {
83490
85129
  switch (operation) {
83491
85130
  case "init": {
83492
85131
  const result = await initProject2(
83493
- this.projectRoot,
85132
+ projectRoot,
83494
85133
  params
83495
85134
  );
83496
85135
  return wrapResult(result, "mutate", "admin", operation, startTime);
@@ -83499,10 +85138,10 @@ var AdminHandler = class {
83499
85138
  case "health": {
83500
85139
  const mode = params?.mode;
83501
85140
  if (mode === "diagnose") {
83502
- const result2 = await systemDoctor(this.projectRoot);
85141
+ const result2 = await systemDoctor(projectRoot);
83503
85142
  return wrapResult(result2, "mutate", "admin", operation, startTime);
83504
85143
  }
83505
- const result = await systemFix(this.projectRoot);
85144
+ const result = await systemFix(projectRoot);
83506
85145
  return wrapResult(result, "mutate", "admin", operation, startTime);
83507
85146
  }
83508
85147
  case "config.set": {
@@ -83517,7 +85156,7 @@ var AdminHandler = class {
83517
85156
  startTime
83518
85157
  );
83519
85158
  }
83520
- const result = await configSet(this.projectRoot, key, params?.value);
85159
+ const result = await configSet(projectRoot, key, params?.value);
83521
85160
  return wrapResult(result, "mutate", "admin", operation, startTime);
83522
85161
  }
83523
85162
  // Merged: backup absorbs restore and backup.restore via action param (T5615)
@@ -83535,7 +85174,7 @@ var AdminHandler = class {
83535
85174
  startTime
83536
85175
  );
83537
85176
  }
83538
- const result2 = systemRestore(this.projectRoot, {
85177
+ const result2 = systemRestore(projectRoot, {
83539
85178
  backupId,
83540
85179
  force: params?.force
83541
85180
  });
@@ -83553,20 +85192,20 @@ var AdminHandler = class {
83553
85192
  startTime
83554
85193
  );
83555
85194
  }
83556
- const result2 = await backupRestore(this.projectRoot, file2, {
85195
+ const result2 = await backupRestore(projectRoot, file2, {
83557
85196
  dryRun: params?.dryRun
83558
85197
  });
83559
85198
  return wrapResult(result2, "mutate", "admin", operation, startTime);
83560
85199
  }
83561
85200
  const result = systemBackup(
83562
- this.projectRoot,
85201
+ projectRoot,
83563
85202
  params
83564
85203
  );
83565
85204
  return wrapResult(result, "mutate", "admin", operation, startTime);
83566
85205
  }
83567
85206
  case "migrate": {
83568
85207
  const result = await systemMigrate(
83569
- this.projectRoot,
85208
+ projectRoot,
83570
85209
  params
83571
85210
  );
83572
85211
  return wrapResult(result, "mutate", "admin", operation, startTime);
@@ -83583,7 +85222,7 @@ var AdminHandler = class {
83583
85222
  startTime
83584
85223
  );
83585
85224
  }
83586
- const result = await systemCleanup(this.projectRoot, {
85225
+ const result = await systemCleanup(projectRoot, {
83587
85226
  target,
83588
85227
  olderThan: params?.olderThan,
83589
85228
  dryRun: params?.dryRun
@@ -83635,20 +85274,20 @@ var AdminHandler = class {
83635
85274
  }
83636
85275
  case "safestop": {
83637
85276
  const result = systemSafestop(
83638
- this.projectRoot,
85277
+ projectRoot,
83639
85278
  params
83640
85279
  );
83641
85280
  return wrapResult(result, "mutate", "admin", operation, startTime);
83642
85281
  }
83643
85282
  case "inject.generate": {
83644
- const result = await systemInjectGenerate(this.projectRoot);
85283
+ const result = await systemInjectGenerate(projectRoot);
83645
85284
  return wrapResult(result, "mutate", "admin", operation, startTime);
83646
85285
  }
83647
85286
  // adr.sync absorbs adr.validate via validate flag (T5615)
83648
85287
  case "adr.sync": {
83649
85288
  const validate = params?.validate;
83650
85289
  if (validate) {
83651
- const result2 = await validateAllAdrs(this.projectRoot);
85290
+ const result2 = await validateAllAdrs(projectRoot);
83652
85291
  return {
83653
85292
  _meta: dispatchMeta("mutate", "admin", operation, startTime),
83654
85293
  success: result2.valid,
@@ -83661,7 +85300,7 @@ var AdminHandler = class {
83661
85300
  }
83662
85301
  };
83663
85302
  }
83664
- const result = await syncAdrsToDb(this.projectRoot);
85303
+ const result = await syncAdrsToDb(projectRoot);
83665
85304
  return {
83666
85305
  _meta: dispatchMeta("mutate", "admin", operation, startTime),
83667
85306
  success: true,
@@ -83696,7 +85335,7 @@ var AdminHandler = class {
83696
85335
  }
83697
85336
  };
83698
85337
  }
83699
- const result2 = await importSnapshot(snapshot, this.projectRoot);
85338
+ const result2 = await importSnapshot(snapshot, projectRoot);
83700
85339
  return {
83701
85340
  _meta: dispatchMeta("mutate", "admin", operation, startTime),
83702
85341
  success: true,
@@ -83732,7 +85371,7 @@ var AdminHandler = class {
83732
85371
  onConflict: params?.onConflict,
83733
85372
  onMissingDep: params?.onMissingDep,
83734
85373
  force: params?.force,
83735
- cwd: this.projectRoot
85374
+ cwd: projectRoot
83736
85375
  });
83737
85376
  return {
83738
85377
  _meta: dispatchMeta("mutate", "admin", operation, startTime),
@@ -83758,7 +85397,7 @@ var AdminHandler = class {
83758
85397
  onDuplicate: params?.onDuplicate,
83759
85398
  addLabel: params?.addLabel,
83760
85399
  dryRun: params?.dryRun,
83761
- cwd: this.projectRoot
85400
+ cwd: projectRoot
83762
85401
  });
83763
85402
  return {
83764
85403
  _meta: dispatchMeta("mutate", "admin", operation, startTime),
@@ -83768,8 +85407,8 @@ var AdminHandler = class {
83768
85407
  }
83769
85408
  case "detect": {
83770
85409
  const { ensureProjectContext: ensureProjectContext2, ensureContributorMcp: ensureContributorMcp2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
83771
- const contextResult = await ensureProjectContext2(this.projectRoot, { force: true });
83772
- const mcpResult = await ensureContributorMcp2(this.projectRoot);
85410
+ const contextResult = await ensureProjectContext2(projectRoot, { force: true });
85411
+ const mcpResult = await ensureContributorMcp2(projectRoot);
83773
85412
  return wrapResult(
83774
85413
  {
83775
85414
  success: true,
@@ -83801,7 +85440,7 @@ var AdminHandler = class {
83801
85440
  requestPayload: params?.requestPayload,
83802
85441
  responsePayload: params?.responsePayload,
83803
85442
  metadata: params?.metadata,
83804
- cwd: this.projectRoot
85443
+ cwd: projectRoot
83805
85444
  });
83806
85445
  return {
83807
85446
  _meta: dispatchMeta("mutate", "admin", operation, startTime),
@@ -83821,7 +85460,7 @@ var AdminHandler = class {
83821
85460
  startTime
83822
85461
  );
83823
85462
  }
83824
- const result = await deleteTokenUsage(tokenId, this.projectRoot);
85463
+ const result = await deleteTokenUsage(tokenId, projectRoot);
83825
85464
  return {
83826
85465
  _meta: dispatchMeta("mutate", "admin", operation, startTime),
83827
85466
  success: true,
@@ -83844,7 +85483,7 @@ var AdminHandler = class {
83844
85483
  since: params?.since,
83845
85484
  until: params?.until
83846
85485
  },
83847
- this.projectRoot
85486
+ projectRoot
83848
85487
  );
83849
85488
  return {
83850
85489
  _meta: dispatchMeta("mutate", "admin", operation, startTime),
@@ -83875,13 +85514,13 @@ var AdminHandler = class {
83875
85514
  taskId: params?.taskId,
83876
85515
  variant: params?.variant
83877
85516
  },
83878
- this.projectRoot
85517
+ projectRoot
83879
85518
  );
83880
85519
  return wrapResult(result, "mutate", "admin", operation, startTime);
83881
85520
  }
83882
85521
  case "map": {
83883
85522
  const { mapCodebase: mapCodebase3 } = await Promise.resolve().then(() => (init_codebase_map_engine(), codebase_map_engine_exports));
83884
- const result = await mapCodebase3(this.projectRoot, {
85523
+ const result = await mapCodebase3(projectRoot, {
83885
85524
  focus: params?.focus,
83886
85525
  storeToBrain: true
83887
85526
  });
@@ -83962,14 +85601,11 @@ var AdminHandler = class {
83962
85601
  // packages/cleo/src/dispatch/domains/check.ts
83963
85602
  init_internal();
83964
85603
  var CheckHandler = class {
83965
- projectRoot;
83966
- constructor() {
83967
- this.projectRoot = getProjectRoot();
83968
- }
83969
85604
  // -----------------------------------------------------------------------
83970
85605
  // Query
83971
85606
  // -----------------------------------------------------------------------
83972
85607
  async query(operation, params) {
85608
+ const projectRoot = getProjectRoot();
83973
85609
  const startTime = Date.now();
83974
85610
  try {
83975
85611
  switch (operation) {
@@ -83985,7 +85621,7 @@ var CheckHandler = class {
83985
85621
  startTime
83986
85622
  );
83987
85623
  }
83988
- const result = validateSchemaOp(type, params?.data, this.projectRoot);
85624
+ const result = validateSchemaOp(type, params?.data, projectRoot);
83989
85625
  return wrapResult(result, "query", "check", operation, startTime);
83990
85626
  }
83991
85627
  case "task": {
@@ -84000,11 +85636,11 @@ var CheckHandler = class {
84000
85636
  startTime
84001
85637
  );
84002
85638
  }
84003
- const result = await validateTask2(taskId, this.projectRoot);
85639
+ const result = await validateTask2(taskId, projectRoot);
84004
85640
  return wrapResult(result, "query", "check", operation, startTime);
84005
85641
  }
84006
85642
  case "manifest": {
84007
- const result = validateManifest(this.projectRoot);
85643
+ const result = validateManifest(projectRoot);
84008
85644
  return wrapResult(result, "query", "check", operation, startTime);
84009
85645
  }
84010
85646
  case "output": {
@@ -84022,7 +85658,7 @@ var CheckHandler = class {
84022
85658
  const result = validateOutput(
84023
85659
  filePath,
84024
85660
  params?.taskId,
84025
- this.projectRoot
85661
+ projectRoot
84026
85662
  );
84027
85663
  return wrapResult(result, "query", "check", operation, startTime);
84028
85664
  }
@@ -84030,23 +85666,23 @@ var CheckHandler = class {
84030
85666
  const detail = params?.detail;
84031
85667
  const limit = params?.limit;
84032
85668
  if (detail) {
84033
- const result2 = validateComplianceViolations(limit, this.projectRoot);
85669
+ const result2 = validateComplianceViolations(limit, projectRoot);
84034
85670
  return wrapResult(result2, "query", "check", operation, startTime);
84035
85671
  }
84036
- const result = validateComplianceSummary(this.projectRoot);
85672
+ const result = validateComplianceSummary(projectRoot);
84037
85673
  return wrapResult(result, "query", "check", operation, startTime);
84038
85674
  }
84039
85675
  case "test": {
84040
85676
  const format = params?.format;
84041
85677
  if (format === "coverage") {
84042
- const result2 = validateTestCoverage(this.projectRoot);
85678
+ const result2 = validateTestCoverage(projectRoot);
84043
85679
  return wrapResult(result2, "query", "check", operation, startTime);
84044
85680
  }
84045
- const result = validateTestStatus(this.projectRoot);
85681
+ const result = validateTestStatus(projectRoot);
84046
85682
  return wrapResult(result, "query", "check", operation, startTime);
84047
85683
  }
84048
85684
  case "coherence": {
84049
- const result = await validateCoherenceCheck(this.projectRoot);
85685
+ const result = await validateCoherenceCheck(projectRoot);
84050
85686
  return wrapResult(result, "query", "check", operation, startTime);
84051
85687
  }
84052
85688
  case "protocol": {
@@ -84065,12 +85701,12 @@ var CheckHandler = class {
84065
85701
  ...protocolParams,
84066
85702
  votingMatrixFile: params?.votingMatrixFile
84067
85703
  },
84068
- this.projectRoot
85704
+ projectRoot
84069
85705
  );
84070
85706
  return wrapResult(result, "query", "check", operation, startTime);
84071
85707
  }
84072
85708
  case "contribution": {
84073
- const result = await validateProtocolContribution(protocolParams, this.projectRoot);
85709
+ const result = await validateProtocolContribution(protocolParams, projectRoot);
84074
85710
  return wrapResult(result, "query", "check", operation, startTime);
84075
85711
  }
84076
85712
  case "decomposition": {
@@ -84079,12 +85715,12 @@ var CheckHandler = class {
84079
85715
  ...protocolParams,
84080
85716
  epicId: params?.epicId
84081
85717
  },
84082
- this.projectRoot
85718
+ projectRoot
84083
85719
  );
84084
85720
  return wrapResult(result, "query", "check", operation, startTime);
84085
85721
  }
84086
85722
  case "implementation": {
84087
- const result = await validateProtocolImplementation(protocolParams, this.projectRoot);
85723
+ const result = await validateProtocolImplementation(protocolParams, projectRoot);
84088
85724
  return wrapResult(result, "query", "check", operation, startTime);
84089
85725
  }
84090
85726
  case "specification": {
@@ -84093,7 +85729,7 @@ var CheckHandler = class {
84093
85729
  ...protocolParams,
84094
85730
  specFile: params?.specFile
84095
85731
  },
84096
- this.projectRoot
85732
+ projectRoot
84097
85733
  );
84098
85734
  return wrapResult(result, "query", "check", operation, startTime);
84099
85735
  }
@@ -84109,7 +85745,7 @@ var CheckHandler = class {
84109
85745
  startTime
84110
85746
  );
84111
85747
  }
84112
- const result = await validateProtocol(taskId, protocolType, this.projectRoot);
85748
+ const result = await validateProtocol(taskId, protocolType, projectRoot);
84113
85749
  return wrapResult(result, "query", "check", operation, startTime);
84114
85750
  }
84115
85751
  }
@@ -84126,11 +85762,11 @@ var CheckHandler = class {
84126
85762
  startTime
84127
85763
  );
84128
85764
  }
84129
- const result = await validateGateVerify({ taskId }, this.projectRoot);
85765
+ const result = await validateGateVerify({ taskId }, projectRoot);
84130
85766
  return wrapResult(result, "query", "check", operation, startTime);
84131
85767
  }
84132
85768
  case "archive.stats": {
84133
- const result = await systemArchiveStats(this.projectRoot);
85769
+ const result = await systemArchiveStats(projectRoot);
84134
85770
  return wrapResult(result, "query", "check", operation, startTime);
84135
85771
  }
84136
85772
  // T5405: WarpChain validation
@@ -84169,7 +85805,7 @@ var CheckHandler = class {
84169
85805
  startTime
84170
85806
  );
84171
85807
  }
84172
- const gradeResult = await gradeSession2(sessionId, this.projectRoot);
85808
+ const gradeResult = await gradeSession2(sessionId, projectRoot);
84173
85809
  return wrapResult(
84174
85810
  { success: true, data: gradeResult },
84175
85811
  "query",
@@ -84182,7 +85818,7 @@ var CheckHandler = class {
84182
85818
  const { readGrades: readGrades2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
84183
85819
  const limit = typeof params?.limit === "number" ? params.limit : void 0;
84184
85820
  const offset = typeof params?.offset === "number" ? params.offset : void 0;
84185
- const allGrades = await readGrades2(void 0, this.projectRoot);
85821
+ const allGrades = await readGrades2(void 0, projectRoot);
84186
85822
  const sessionId = params?.sessionId;
84187
85823
  const filteredGrades = sessionId ? allGrades.filter((g) => g.sessionId === sessionId) : allGrades;
84188
85824
  const page = paginate(filteredGrades, limit, offset);
@@ -84213,6 +85849,7 @@ var CheckHandler = class {
84213
85849
  // Mutate
84214
85850
  // -----------------------------------------------------------------------
84215
85851
  async mutate(operation, params) {
85852
+ const projectRoot = getProjectRoot();
84216
85853
  const startTime = Date.now();
84217
85854
  try {
84218
85855
  switch (operation) {
@@ -84234,14 +85871,14 @@ var CheckHandler = class {
84234
85871
  result,
84235
85872
  params?.protocol,
84236
85873
  params?.violations,
84237
- this.projectRoot
85874
+ projectRoot
84238
85875
  );
84239
85876
  return wrapResult(engineResult, "mutate", "check", operation, startTime);
84240
85877
  }
84241
85878
  case "test.run": {
84242
85879
  const result = validateTestRun(
84243
85880
  params,
84244
- this.projectRoot
85881
+ projectRoot
84245
85882
  );
84246
85883
  return wrapResult(result, "mutate", "check", operation, startTime);
84247
85884
  }
@@ -84249,7 +85886,7 @@ var CheckHandler = class {
84249
85886
  const { syncComplianceMetrics: syncComplianceMetrics2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
84250
85887
  const result = await syncComplianceMetrics2({
84251
85888
  force: params?.force,
84252
- cwd: this.projectRoot
85889
+ cwd: projectRoot
84253
85890
  });
84254
85891
  return {
84255
85892
  _meta: dispatchMeta("mutate", "check", operation, startTime),
@@ -84277,7 +85914,7 @@ var CheckHandler = class {
84277
85914
  all: params?.all,
84278
85915
  reset: params?.reset
84279
85916
  };
84280
- const result = await validateGateVerify(gateParams, this.projectRoot);
85917
+ const result = await validateGateVerify(gateParams, projectRoot);
84281
85918
  return wrapResult(result, "mutate", "check", operation, startTime);
84282
85919
  }
84283
85920
  default:
@@ -84320,14 +85957,11 @@ var CheckHandler = class {
84320
85957
  // packages/cleo/src/dispatch/domains/memory.ts
84321
85958
  init_src2();
84322
85959
  var MemoryHandler = class {
84323
- projectRoot;
84324
- constructor() {
84325
- this.projectRoot = getProjectRoot();
84326
- }
84327
85960
  // -----------------------------------------------------------------------
84328
85961
  // Query
84329
85962
  // -----------------------------------------------------------------------
84330
85963
  async query(operation, params) {
85964
+ const projectRoot = getProjectRoot();
84331
85965
  const startTime = Date.now();
84332
85966
  try {
84333
85967
  switch (operation) {
@@ -84351,7 +85985,7 @@ var MemoryHandler = class {
84351
85985
  dateStart: params?.dateStart,
84352
85986
  dateEnd: params?.dateEnd
84353
85987
  },
84354
- this.projectRoot
85988
+ projectRoot
84355
85989
  );
84356
85990
  return wrapResult(result, "query", "memory", operation, startTime);
84357
85991
  }
@@ -84373,7 +86007,7 @@ var MemoryHandler = class {
84373
86007
  depthBefore: params?.depthBefore,
84374
86008
  depthAfter: params?.depthAfter
84375
86009
  },
84376
- this.projectRoot
86010
+ projectRoot
84377
86011
  );
84378
86012
  return wrapResult(result, "query", "memory", operation, startTime);
84379
86013
  }
@@ -84389,7 +86023,7 @@ var MemoryHandler = class {
84389
86023
  startTime
84390
86024
  );
84391
86025
  }
84392
- const result = await memoryFetch({ ids }, this.projectRoot);
86026
+ const result = await memoryFetch({ ids }, projectRoot);
84393
86027
  return wrapResult(result, "query", "memory", operation, startTime);
84394
86028
  }
84395
86029
  case "decision.find": {
@@ -84399,7 +86033,7 @@ var MemoryHandler = class {
84399
86033
  taskId: params?.taskId,
84400
86034
  limit: params?.limit
84401
86035
  },
84402
- this.projectRoot
86036
+ projectRoot
84403
86037
  );
84404
86038
  return wrapResult(result, "query", "memory", operation, startTime);
84405
86039
  }
@@ -84412,7 +86046,7 @@ var MemoryHandler = class {
84412
86046
  minFrequency: params?.minFrequency,
84413
86047
  limit: params?.limit
84414
86048
  },
84415
- this.projectRoot
86049
+ projectRoot
84416
86050
  );
84417
86051
  return wrapResult(result, "query", "memory", operation, startTime);
84418
86052
  }
@@ -84425,7 +86059,7 @@ var MemoryHandler = class {
84425
86059
  applicableType: params?.applicableType,
84426
86060
  limit: params?.limit
84427
86061
  },
84428
- this.projectRoot
86062
+ projectRoot
84429
86063
  );
84430
86064
  return wrapResult(result, "query", "memory", operation, startTime);
84431
86065
  }
@@ -84441,7 +86075,7 @@ var MemoryHandler = class {
84441
86075
  startTime
84442
86076
  );
84443
86077
  }
84444
- const result = await memoryGraphShow({ nodeId }, this.projectRoot);
86078
+ const result = await memoryGraphShow({ nodeId }, projectRoot);
84445
86079
  return wrapResult(result, "query", "memory", operation, startTime);
84446
86080
  }
84447
86081
  case "graph.neighbors": {
@@ -84458,7 +86092,7 @@ var MemoryHandler = class {
84458
86092
  }
84459
86093
  const result = await memoryGraphNeighbors(
84460
86094
  { nodeId, edgeType: params?.edgeType },
84461
- this.projectRoot
86095
+ projectRoot
84462
86096
  );
84463
86097
  return wrapResult(result, "query", "memory", operation, startTime);
84464
86098
  }
@@ -84474,7 +86108,7 @@ var MemoryHandler = class {
84474
86108
  startTime
84475
86109
  );
84476
86110
  }
84477
- const result = await memoryReasonWhy({ taskId }, this.projectRoot);
86111
+ const result = await memoryReasonWhy({ taskId }, projectRoot);
84478
86112
  return wrapResult(result, "query", "memory", operation, startTime);
84479
86113
  }
84480
86114
  case "reason.similar": {
@@ -84491,7 +86125,7 @@ var MemoryHandler = class {
84491
86125
  }
84492
86126
  const result = await memoryReasonSimilar(
84493
86127
  { entryId, limit: params?.limit },
84494
- this.projectRoot
86128
+ projectRoot
84495
86129
  );
84496
86130
  return wrapResult(result, "query", "memory", operation, startTime);
84497
86131
  }
@@ -84515,7 +86149,7 @@ var MemoryHandler = class {
84515
86149
  graphWeight: params?.graphWeight,
84516
86150
  limit: params?.limit
84517
86151
  },
84518
- this.projectRoot
86152
+ projectRoot
84519
86153
  );
84520
86154
  return wrapResult(result, "query", "memory", operation, startTime);
84521
86155
  }
@@ -84535,6 +86169,7 @@ var MemoryHandler = class {
84535
86169
  // Mutate
84536
86170
  // -----------------------------------------------------------------------
84537
86171
  async mutate(operation, params) {
86172
+ const projectRoot = getProjectRoot();
84538
86173
  const startTime = Date.now();
84539
86174
  try {
84540
86175
  switch (operation) {
@@ -84559,7 +86194,7 @@ var MemoryHandler = class {
84559
86194
  sourceSessionId: params?.sourceSessionId,
84560
86195
  sourceType: params?.sourceType
84561
86196
  },
84562
- this.projectRoot
86197
+ projectRoot
84563
86198
  );
84564
86199
  return wrapResult(result, "mutate", "memory", operation, startTime);
84565
86200
  }
@@ -84584,7 +86219,7 @@ var MemoryHandler = class {
84584
86219
  taskId: params?.taskId,
84585
86220
  sessionId: params?.sessionId
84586
86221
  },
84587
- this.projectRoot
86222
+ projectRoot
84588
86223
  );
84589
86224
  return wrapResult(result, "mutate", "memory", operation, startTime);
84590
86225
  }
@@ -84612,7 +86247,7 @@ var MemoryHandler = class {
84612
86247
  examples: params?.examples,
84613
86248
  successRate: params?.successRate
84614
86249
  },
84615
- this.projectRoot
86250
+ projectRoot
84616
86251
  );
84617
86252
  return wrapResult(result, "mutate", "memory", operation, startTime);
84618
86253
  }
@@ -84638,7 +86273,7 @@ var MemoryHandler = class {
84638
86273
  application: params?.application,
84639
86274
  applicableTypes: params?.applicableTypes
84640
86275
  },
84641
- this.projectRoot
86276
+ projectRoot
84642
86277
  );
84643
86278
  return wrapResult(result, "mutate", "memory", operation, startTime);
84644
86279
  }
@@ -84655,7 +86290,7 @@ var MemoryHandler = class {
84655
86290
  startTime
84656
86291
  );
84657
86292
  }
84658
- const result = await memoryLink({ taskId, entryId }, this.projectRoot);
86293
+ const result = await memoryLink({ taskId, entryId }, projectRoot);
84659
86294
  return wrapResult(result, "mutate", "memory", operation, startTime);
84660
86295
  }
84661
86296
  case "graph.add": {
@@ -84670,7 +86305,7 @@ var MemoryHandler = class {
84670
86305
  edgeType: params?.edgeType,
84671
86306
  weight: params?.weight
84672
86307
  },
84673
- this.projectRoot
86308
+ projectRoot
84674
86309
  );
84675
86310
  return wrapResult(result, "mutate", "memory", operation, startTime);
84676
86311
  }
@@ -84682,7 +86317,7 @@ var MemoryHandler = class {
84682
86317
  toId: params?.toId,
84683
86318
  edgeType: params?.edgeType
84684
86319
  },
84685
- this.projectRoot
86320
+ projectRoot
84686
86321
  );
84687
86322
  return wrapResult(result, "mutate", "memory", operation, startTime);
84688
86323
  }
@@ -84952,17 +86587,30 @@ async function nexusShareSnapshotImport(projectRoot, inputPath) {
84952
86587
  return engineError("E_INTERNAL", error40 instanceof Error ? error40.message : String(error40));
84953
86588
  }
84954
86589
  }
86590
+ async function nexusTransferPreview(params) {
86591
+ try {
86592
+ const result = await previewTransfer(params);
86593
+ return engineSuccess(result);
86594
+ } catch (error40) {
86595
+ return engineError("E_INTERNAL", error40 instanceof Error ? error40.message : String(error40));
86596
+ }
86597
+ }
86598
+ async function nexusTransferExecute(params) {
86599
+ try {
86600
+ const result = await executeTransfer(params);
86601
+ return engineSuccess(result);
86602
+ } catch (error40) {
86603
+ return engineError("E_INTERNAL", error40 instanceof Error ? error40.message : String(error40));
86604
+ }
86605
+ }
84955
86606
 
84956
86607
  // packages/cleo/src/dispatch/domains/nexus.ts
84957
86608
  var NexusHandler = class {
84958
- projectRoot;
84959
- constructor() {
84960
- this.projectRoot = getProjectRoot();
84961
- }
84962
86609
  // -----------------------------------------------------------------------
84963
86610
  // Query
84964
86611
  // -----------------------------------------------------------------------
84965
86612
  async query(operation, params) {
86613
+ const projectRoot = getProjectRoot();
84966
86614
  const startTime = Date.now();
84967
86615
  try {
84968
86616
  switch (operation) {
@@ -85110,9 +86758,32 @@ var NexusHandler = class {
85110
86758
  return wrapResult(result, "query", "nexus", operation, startTime);
85111
86759
  }
85112
86760
  case "share.status": {
85113
- const result = await nexusShareStatus(this.projectRoot);
86761
+ const result = await nexusShareStatus(projectRoot);
85114
86762
  return wrapResult(result, "query", "nexus", "share.status", startTime);
85115
86763
  }
86764
+ case "transfer.preview": {
86765
+ const taskIds = params?.taskIds;
86766
+ const sourceProject = params?.sourceProject;
86767
+ const targetProject = params?.targetProject;
86768
+ if (!taskIds?.length || !sourceProject || !targetProject) {
86769
+ return errorResult(
86770
+ "query",
86771
+ "nexus",
86772
+ operation,
86773
+ "E_INVALID_INPUT",
86774
+ "taskIds, sourceProject, and targetProject are required",
86775
+ startTime
86776
+ );
86777
+ }
86778
+ const result = await nexusTransferPreview({
86779
+ taskIds,
86780
+ sourceProject,
86781
+ targetProject,
86782
+ mode: params?.mode ?? "copy",
86783
+ scope: params?.scope ?? "subtree"
86784
+ });
86785
+ return wrapResult(result, "query", "nexus", operation, startTime);
86786
+ }
85116
86787
  default:
85117
86788
  return unsupportedOp("query", "nexus", operation, startTime);
85118
86789
  }
@@ -85128,6 +86799,7 @@ var NexusHandler = class {
85128
86799
  // Mutate
85129
86800
  // -----------------------------------------------------------------------
85130
86801
  async mutate(operation, params) {
86802
+ const projectRoot = getProjectRoot();
85131
86803
  const startTime = Date.now();
85132
86804
  try {
85133
86805
  switch (operation) {
@@ -85211,13 +86883,13 @@ var NexusHandler = class {
85211
86883
  return wrapResult(result, "mutate", "nexus", operation, startTime);
85212
86884
  }
85213
86885
  case "reconcile": {
85214
- const projectRoot = params?.projectRoot || process.cwd();
85215
- const result = await nexusReconcileProject(projectRoot);
86886
+ const projectRoot2 = params?.projectRoot || process.cwd();
86887
+ const result = await nexusReconcileProject(projectRoot2);
85216
86888
  return wrapResult(result, "mutate", "nexus", operation, startTime);
85217
86889
  }
85218
86890
  case "share.snapshot.export": {
85219
86891
  const outputPath = params?.outputPath;
85220
- const result = await nexusShareSnapshotExport(this.projectRoot, outputPath);
86892
+ const result = await nexusShareSnapshotExport(projectRoot, outputPath);
85221
86893
  return wrapResult(result, "mutate", "nexus", "share.snapshot.export", startTime);
85222
86894
  }
85223
86895
  case "share.snapshot.import": {
@@ -85232,9 +86904,34 @@ var NexusHandler = class {
85232
86904
  startTime
85233
86905
  );
85234
86906
  }
85235
- const result = await nexusShareSnapshotImport(this.projectRoot, inputPath);
86907
+ const result = await nexusShareSnapshotImport(projectRoot, inputPath);
85236
86908
  return wrapResult(result, "mutate", "nexus", "share.snapshot.import", startTime);
85237
86909
  }
86910
+ case "transfer": {
86911
+ const taskIds = params?.taskIds;
86912
+ const sourceProject = params?.sourceProject;
86913
+ const targetProject = params?.targetProject;
86914
+ if (!taskIds?.length || !sourceProject || !targetProject) {
86915
+ return errorResult(
86916
+ "mutate",
86917
+ "nexus",
86918
+ operation,
86919
+ "E_INVALID_INPUT",
86920
+ "taskIds, sourceProject, and targetProject are required",
86921
+ startTime
86922
+ );
86923
+ }
86924
+ const result = await nexusTransferExecute({
86925
+ taskIds,
86926
+ sourceProject,
86927
+ targetProject,
86928
+ mode: params?.mode ?? "copy",
86929
+ scope: params?.scope ?? "subtree",
86930
+ onConflict: params?.onConflict ?? "rename",
86931
+ transferBrain: params?.transferBrain ?? false
86932
+ });
86933
+ return wrapResult(result, "mutate", "nexus", operation, startTime);
86934
+ }
85238
86935
  default:
85239
86936
  return unsupportedOp("mutate", "nexus", operation, startTime);
85240
86937
  }
@@ -85263,7 +86960,8 @@ var NexusHandler = class {
85263
86960
  "blockers.show",
85264
86961
  "orphans.list",
85265
86962
  "discover",
85266
- "search"
86963
+ "search",
86964
+ "transfer.preview"
85267
86965
  ],
85268
86966
  mutate: [
85269
86967
  "share.snapshot.export",
@@ -85273,7 +86971,8 @@ var NexusHandler = class {
85273
86971
  "unregister",
85274
86972
  "sync",
85275
86973
  "permission.set",
85276
- "reconcile"
86974
+ "reconcile",
86975
+ "transfer"
85277
86976
  ]
85278
86977
  };
85279
86978
  }
@@ -85282,20 +86981,17 @@ var NexusHandler = class {
85282
86981
  // packages/cleo/src/dispatch/domains/orchestrate.ts
85283
86982
  init_internal();
85284
86983
  var OrchestrateHandler = class {
85285
- projectRoot;
85286
- constructor() {
85287
- this.projectRoot = getProjectRoot();
85288
- }
85289
86984
  // -----------------------------------------------------------------------
85290
86985
  // DomainHandler interface
85291
86986
  // -----------------------------------------------------------------------
85292
86987
  async query(operation, params) {
86988
+ const projectRoot = getProjectRoot();
85293
86989
  const startTime = Date.now();
85294
86990
  try {
85295
86991
  switch (operation) {
85296
86992
  case "status": {
85297
86993
  const epicId = params?.epicId;
85298
- const result = await orchestrateStatus(epicId, this.projectRoot);
86994
+ const result = await orchestrateStatus(epicId, projectRoot);
85299
86995
  return wrapResult(result, "query", "orchestrate", operation, startTime);
85300
86996
  }
85301
86997
  case "next": {
@@ -85310,7 +87006,7 @@ var OrchestrateHandler = class {
85310
87006
  startTime
85311
87007
  );
85312
87008
  }
85313
- const result = await orchestrateNext(epicId, this.projectRoot);
87009
+ const result = await orchestrateNext(epicId, projectRoot);
85314
87010
  return wrapResult(result, "query", "orchestrate", operation, startTime);
85315
87011
  }
85316
87012
  case "ready": {
@@ -85325,18 +87021,18 @@ var OrchestrateHandler = class {
85325
87021
  startTime
85326
87022
  );
85327
87023
  }
85328
- const result = await orchestrateReady(epicId, this.projectRoot);
87024
+ const result = await orchestrateReady(epicId, projectRoot);
85329
87025
  return wrapResult(result, "query", "orchestrate", operation, startTime);
85330
87026
  }
85331
87027
  case "analyze": {
85332
87028
  const epicId = params?.epicId;
85333
87029
  const mode = params?.mode;
85334
- const result = await orchestrateAnalyze(epicId, this.projectRoot, mode);
87030
+ const result = await orchestrateAnalyze(epicId, projectRoot, mode);
85335
87031
  return wrapResult(result, "query", "orchestrate", "analyze", startTime);
85336
87032
  }
85337
87033
  case "context": {
85338
87034
  const epicId = params?.epicId;
85339
- const result = await orchestrateContext(epicId, this.projectRoot);
87035
+ const result = await orchestrateContext(epicId, projectRoot);
85340
87036
  return wrapResult(result, "query", "orchestrate", operation, startTime);
85341
87037
  }
85342
87038
  case "waves": {
@@ -85351,16 +87047,16 @@ var OrchestrateHandler = class {
85351
87047
  startTime
85352
87048
  );
85353
87049
  }
85354
- const result = await orchestrateWaves(epicId, this.projectRoot);
87050
+ const result = await orchestrateWaves(epicId, projectRoot);
85355
87051
  return wrapResult(result, "query", "orchestrate", operation, startTime);
85356
87052
  }
85357
87053
  case "bootstrap": {
85358
87054
  const speed = params?.speed;
85359
- const result = await orchestrateBootstrap(this.projectRoot, { speed });
87055
+ const result = await orchestrateBootstrap(projectRoot, { speed });
85360
87056
  return wrapResult(result, "query", "orchestrate", operation, startTime);
85361
87057
  }
85362
87058
  case "unblock.opportunities": {
85363
- const result = await orchestrateUnblockOpportunities(this.projectRoot);
87059
+ const result = await orchestrateUnblockOpportunities(projectRoot);
85364
87060
  return wrapResult(result, "query", "orchestrate", operation, startTime);
85365
87061
  }
85366
87062
  case "tessera.list": {
@@ -85417,6 +87113,7 @@ var OrchestrateHandler = class {
85417
87113
  }
85418
87114
  }
85419
87115
  async mutate(operation, params) {
87116
+ const projectRoot = getProjectRoot();
85420
87117
  const startTime = Date.now();
85421
87118
  try {
85422
87119
  switch (operation) {
@@ -85432,7 +87129,7 @@ var OrchestrateHandler = class {
85432
87129
  startTime
85433
87130
  );
85434
87131
  }
85435
- const result = await orchestrateStartup(epicId, this.projectRoot);
87132
+ const result = await orchestrateStartup(epicId, projectRoot);
85436
87133
  return wrapResult(result, "mutate", "orchestrate", operation, startTime);
85437
87134
  }
85438
87135
  case "spawn": {
@@ -85449,7 +87146,7 @@ var OrchestrateHandler = class {
85449
87146
  }
85450
87147
  const protocolType = params?.protocolType;
85451
87148
  const tier = params?.tier;
85452
- const result = await orchestrateSpawn(taskId, protocolType, this.projectRoot, tier);
87149
+ const result = await orchestrateSpawn(taskId, protocolType, projectRoot, tier);
85453
87150
  return wrapResult(result, "mutate", "orchestrate", operation, startTime);
85454
87151
  }
85455
87152
  case "handoff": {
@@ -85486,7 +87183,7 @@ var OrchestrateHandler = class {
85486
87183
  tier,
85487
87184
  idempotencyKey: params?.idempotencyKey
85488
87185
  },
85489
- this.projectRoot
87186
+ projectRoot
85490
87187
  );
85491
87188
  return wrapResult(result, "mutate", "orchestrate", operation, startTime);
85492
87189
  }
@@ -85509,7 +87206,7 @@ var OrchestrateHandler = class {
85509
87206
  taskId,
85510
87207
  adapterId,
85511
87208
  protocolType,
85512
- this.projectRoot,
87209
+ projectRoot,
85513
87210
  tier
85514
87211
  );
85515
87212
  return wrapResult(result, "mutate", "orchestrate", operation, startTime);
@@ -85526,7 +87223,7 @@ var OrchestrateHandler = class {
85526
87223
  startTime
85527
87224
  );
85528
87225
  }
85529
- const result = await orchestrateValidate(taskId, this.projectRoot);
87226
+ const result = await orchestrateValidate(taskId, projectRoot);
85530
87227
  return wrapResult(result, "mutate", "orchestrate", operation, startTime);
85531
87228
  }
85532
87229
  case "parallel": {
@@ -85554,7 +87251,7 @@ var OrchestrateHandler = class {
85554
87251
  startTime
85555
87252
  );
85556
87253
  }
85557
- const result = await orchestrateParallelStart(epicId, wave, this.projectRoot);
87254
+ const result = await orchestrateParallelStart(epicId, wave, projectRoot);
85558
87255
  return wrapResult(result, "mutate", "orchestrate", "parallel", startTime);
85559
87256
  },
85560
87257
  end: async () => {
@@ -85580,7 +87277,7 @@ var OrchestrateHandler = class {
85580
87277
  startTime
85581
87278
  );
85582
87279
  }
85583
- const result = await orchestrateParallelEnd(epicId, wave, this.projectRoot);
87280
+ const result = await orchestrateParallelEnd(epicId, wave, projectRoot);
85584
87281
  return wrapResult(result, "mutate", "orchestrate", "parallel", startTime);
85585
87282
  }
85586
87283
  });
@@ -85623,7 +87320,7 @@ var OrchestrateHandler = class {
85623
87320
  const instance = await instantiateTessera(
85624
87321
  template,
85625
87322
  { templateId, epicId, variables: { epicId, ...variables } },
85626
- this.projectRoot
87323
+ projectRoot
85627
87324
  );
85628
87325
  return {
85629
87326
  _meta: dispatchMeta("mutate", "orchestrate", operation, startTime),
@@ -85679,9 +87376,8 @@ var OrchestrateHandler = class {
85679
87376
  init_internal();
85680
87377
  import { execFileSync as execFileSync13 } from "node:child_process";
85681
87378
  var PipelineHandler = class {
85682
- projectRoot;
85683
- constructor() {
85684
- this.projectRoot = getProjectRoot();
87379
+ get projectRoot() {
87380
+ return getProjectRoot();
85685
87381
  }
85686
87382
  // -----------------------------------------------------------------------
85687
87383
  // DomainHandler interface
@@ -86554,24 +88250,21 @@ function unbindSession() {
86554
88250
 
86555
88251
  // packages/cleo/src/dispatch/domains/session.ts
86556
88252
  var SessionHandler = class {
86557
- projectRoot;
86558
- constructor() {
86559
- this.projectRoot = getProjectRoot();
86560
- }
86561
88253
  // -----------------------------------------------------------------------
86562
88254
  // Query
86563
88255
  // -----------------------------------------------------------------------
86564
88256
  async query(operation, params) {
88257
+ const projectRoot = getProjectRoot();
86565
88258
  const startTime = Date.now();
86566
88259
  try {
86567
88260
  switch (operation) {
86568
88261
  case "status": {
86569
- const result = await sessionStatus2(this.projectRoot);
88262
+ const result = await sessionStatus2(projectRoot);
86570
88263
  return wrapResult(result, "query", "session", operation, startTime);
86571
88264
  }
86572
88265
  case "list": {
86573
88266
  const result = await sessionList(
86574
- this.projectRoot,
88267
+ projectRoot,
86575
88268
  params
86576
88269
  );
86577
88270
  return wrapResult(result, "query", "session", operation, startTime);
@@ -86591,24 +88284,21 @@ var SessionHandler = class {
86591
88284
  }
86592
88285
  const include = params?.include;
86593
88286
  if (include === "debrief") {
86594
- const result2 = await sessionDebriefShow(this.projectRoot, sessionId);
88287
+ const result2 = await sessionDebriefShow(projectRoot, sessionId);
86595
88288
  return wrapResult(result2, "query", "session", operation, startTime);
86596
88289
  }
86597
- const result = await sessionShow(this.projectRoot, sessionId);
88290
+ const result = await sessionShow(projectRoot, sessionId);
86598
88291
  return wrapResult(result, "query", "session", operation, startTime);
86599
88292
  }
86600
88293
  case "decision.log": {
86601
88294
  const result = await sessionDecisionLog(
86602
- this.projectRoot,
88295
+ projectRoot,
86603
88296
  params
86604
88297
  );
86605
88298
  return wrapResult(result, "query", "session", operation, startTime);
86606
88299
  }
86607
88300
  case "context.drift": {
86608
- const result = await sessionContextDrift(
86609
- this.projectRoot,
86610
- params
86611
- );
88301
+ const result = await sessionContextDrift(projectRoot, params);
86612
88302
  return wrapResult(result, "query", "session", operation, startTime);
86613
88303
  }
86614
88304
  case "handoff.show": {
@@ -86621,11 +88311,11 @@ var SessionHandler = class {
86621
88311
  scopeFilter = { type: "epic", epicId: scope.replace("epic:", "") };
86622
88312
  }
86623
88313
  }
86624
- const result = await sessionHandoff(this.projectRoot, scopeFilter);
88314
+ const result = await sessionHandoff(projectRoot, scopeFilter);
86625
88315
  return wrapResult(result, "query", "session", operation, startTime);
86626
88316
  }
86627
88317
  case "briefing.show": {
86628
- const result = await sessionBriefing(this.projectRoot, {
88318
+ const result = await sessionBriefing(projectRoot, {
86629
88319
  maxNextTasks: params?.maxNextTasks,
86630
88320
  maxBugs: params?.maxBugs,
86631
88321
  maxBlocked: params?.maxBlocked,
@@ -86636,7 +88326,7 @@ var SessionHandler = class {
86636
88326
  }
86637
88327
  case "find": {
86638
88328
  const result = await sessionFind(
86639
- this.projectRoot,
88329
+ projectRoot,
86640
88330
  params
86641
88331
  );
86642
88332
  return wrapResult(result, "query", "session", operation, startTime);
@@ -86656,6 +88346,7 @@ var SessionHandler = class {
86656
88346
  // Mutate
86657
88347
  // -----------------------------------------------------------------------
86658
88348
  async mutate(operation, params) {
88349
+ const projectRoot = getProjectRoot();
86659
88350
  const startTime = Date.now();
86660
88351
  try {
86661
88352
  switch (operation) {
@@ -86671,7 +88362,7 @@ var SessionHandler = class {
86671
88362
  startTime
86672
88363
  );
86673
88364
  }
86674
- const result = await sessionStart(this.projectRoot, {
88365
+ const result = await sessionStart(projectRoot, {
86675
88366
  scope,
86676
88367
  name: params?.name,
86677
88368
  autoStart: params?.autoStart,
@@ -86702,19 +88393,19 @@ var SessionHandler = class {
86702
88393
  return wrapResult(result, "mutate", "session", operation, startTime);
86703
88394
  }
86704
88395
  case "end": {
86705
- const endResult = await sessionEnd(this.projectRoot, params?.note);
88396
+ const endResult = await sessionEnd(projectRoot, params?.note);
86706
88397
  if (endResult.success && endResult.data) {
86707
88398
  const sessionId = endResult.data.sessionId;
86708
88399
  if (sessionId) {
86709
88400
  let debriefResult = null;
86710
88401
  try {
86711
- debriefResult = await sessionComputeDebrief(this.projectRoot, sessionId, {
88402
+ debriefResult = await sessionComputeDebrief(projectRoot, sessionId, {
86712
88403
  note: params?.note,
86713
88404
  nextAction: params?.nextAction
86714
88405
  });
86715
88406
  } catch {
86716
88407
  try {
86717
- await sessionComputeHandoff(this.projectRoot, sessionId, {
88408
+ await sessionComputeHandoff(projectRoot, sessionId, {
86718
88409
  note: params?.note,
86719
88410
  nextAction: params?.nextAction
86720
88411
  });
@@ -86724,7 +88415,7 @@ var SessionHandler = class {
86724
88415
  if (debriefResult?.success && debriefResult.data) {
86725
88416
  try {
86726
88417
  const { persistSessionMemory: persistSessionMemory2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
86727
- await persistSessionMemory2(this.projectRoot, sessionId, debriefResult.data);
88418
+ await persistSessionMemory2(projectRoot, sessionId, debriefResult.data);
86728
88419
  } catch {
86729
88420
  }
86730
88421
  }
@@ -86745,7 +88436,7 @@ var SessionHandler = class {
86745
88436
  startTime
86746
88437
  );
86747
88438
  }
86748
- const result = await sessionResume(this.projectRoot, sessionId);
88439
+ const result = await sessionResume(projectRoot, sessionId);
86749
88440
  return wrapResult(result, "mutate", "session", operation, startTime);
86750
88441
  }
86751
88442
  case "suspend": {
@@ -86761,21 +88452,18 @@ var SessionHandler = class {
86761
88452
  );
86762
88453
  }
86763
88454
  const result = await sessionSuspend(
86764
- this.projectRoot,
88455
+ projectRoot,
86765
88456
  sessionId,
86766
88457
  params?.reason
86767
88458
  );
86768
88459
  return wrapResult(result, "mutate", "session", operation, startTime);
86769
88460
  }
86770
88461
  case "gc": {
86771
- const result = await sessionGc(
86772
- this.projectRoot,
86773
- params?.maxAgeDays
86774
- );
88462
+ const result = await sessionGc(projectRoot, params?.maxAgeDays);
86775
88463
  return wrapResult(result, "mutate", "session", operation, startTime);
86776
88464
  }
86777
88465
  case "record.decision": {
86778
- const result = await sessionRecordDecision(this.projectRoot, {
88466
+ const result = await sessionRecordDecision(projectRoot, {
86779
88467
  sessionId: params?.sessionId,
86780
88468
  taskId: params?.taskId,
86781
88469
  decision: params?.decision,
@@ -86785,7 +88473,7 @@ var SessionHandler = class {
86785
88473
  return wrapResult(result, "mutate", "session", operation, startTime);
86786
88474
  }
86787
88475
  case "record.assumption": {
86788
- const result = await sessionRecordAssumption(this.projectRoot, {
88476
+ const result = await sessionRecordAssumption(projectRoot, {
86789
88477
  sessionId: params?.sessionId,
86790
88478
  taskId: params?.taskId,
86791
88479
  assumption: params?.assumption,
@@ -86926,14 +88614,11 @@ async function stickyPurge(projectRoot, id) {
86926
88614
 
86927
88615
  // packages/cleo/src/dispatch/domains/sticky.ts
86928
88616
  var StickyHandler = class {
86929
- projectRoot;
86930
- constructor() {
86931
- this.projectRoot = getProjectRoot();
86932
- }
86933
88617
  // -----------------------------------------------------------------------
86934
88618
  // Query
86935
88619
  // -----------------------------------------------------------------------
86936
88620
  async query(operation, params) {
88621
+ const projectRoot = getProjectRoot();
86937
88622
  const startTime = Date.now();
86938
88623
  try {
86939
88624
  switch (operation) {
@@ -86943,13 +88628,13 @@ var StickyHandler = class {
86943
88628
  color: params?.color,
86944
88629
  priority: params?.priority
86945
88630
  };
86946
- const result = await stickyList(this.projectRoot, filters);
88631
+ const result = await stickyList(projectRoot, filters);
86947
88632
  if (!result.success) {
86948
88633
  return wrapResult(result, "query", "sticky", operation, startTime);
86949
88634
  }
86950
88635
  const filteredStickies = result.data?.stickies ?? [];
86951
88636
  const hasFilter = filters.status !== void 0 || filters.color !== void 0 || filters.priority !== void 0;
86952
- const totalResult = hasFilter ? await stickyList(this.projectRoot, {}) : result;
88637
+ const totalResult = hasFilter ? await stickyList(projectRoot, {}) : result;
86953
88638
  if (!totalResult.success) {
86954
88639
  return wrapResult(totalResult, "query", "sticky", operation, startTime);
86955
88640
  }
@@ -86979,7 +88664,7 @@ var StickyHandler = class {
86979
88664
  startTime
86980
88665
  );
86981
88666
  }
86982
- const result = await stickyShow(this.projectRoot, stickyId);
88667
+ const result = await stickyShow(projectRoot, stickyId);
86983
88668
  return wrapResult(result, "query", "sticky", operation, startTime);
86984
88669
  }
86985
88670
  default:
@@ -86998,6 +88683,7 @@ var StickyHandler = class {
86998
88683
  // Mutate
86999
88684
  // -----------------------------------------------------------------------
87000
88685
  async mutate(operation, params) {
88686
+ const projectRoot = getProjectRoot();
87001
88687
  const startTime = Date.now();
87002
88688
  try {
87003
88689
  switch (operation) {
@@ -87013,7 +88699,7 @@ var StickyHandler = class {
87013
88699
  startTime
87014
88700
  );
87015
88701
  }
87016
- const result = await stickyAdd(this.projectRoot, {
88702
+ const result = await stickyAdd(projectRoot, {
87017
88703
  content,
87018
88704
  tags: params?.tags,
87019
88705
  color: params?.color,
@@ -87046,7 +88732,7 @@ var StickyHandler = class {
87046
88732
  }
87047
88733
  if (targetType === "task") {
87048
88734
  const result = await stickyConvertToTask(
87049
- this.projectRoot,
88735
+ projectRoot,
87050
88736
  stickyId,
87051
88737
  params?.title
87052
88738
  );
@@ -87063,18 +88749,18 @@ var StickyHandler = class {
87063
88749
  startTime
87064
88750
  );
87065
88751
  }
87066
- const result = await stickyConvertToTaskNote(this.projectRoot, stickyId, taskId);
88752
+ const result = await stickyConvertToTaskNote(projectRoot, stickyId, taskId);
87067
88753
  return wrapResult(result, "mutate", "sticky", operation, startTime);
87068
88754
  } else if (targetType === "session_note") {
87069
88755
  const result = await stickyConvertToSessionNote(
87070
- this.projectRoot,
88756
+ projectRoot,
87071
88757
  stickyId,
87072
88758
  params?.sessionId
87073
88759
  );
87074
88760
  return wrapResult(result, "mutate", "sticky", operation, startTime);
87075
88761
  } else {
87076
88762
  const result = await stickyConvertToMemory(
87077
- this.projectRoot,
88763
+ projectRoot,
87078
88764
  stickyId,
87079
88765
  params?.memoryType
87080
88766
  );
@@ -87093,7 +88779,7 @@ var StickyHandler = class {
87093
88779
  startTime
87094
88780
  );
87095
88781
  }
87096
- const result = await stickyArchive(this.projectRoot, stickyId);
88782
+ const result = await stickyArchive(projectRoot, stickyId);
87097
88783
  return wrapResult(result, "mutate", "sticky", operation, startTime);
87098
88784
  }
87099
88785
  case "purge": {
@@ -87108,7 +88794,7 @@ var StickyHandler = class {
87108
88794
  startTime
87109
88795
  );
87110
88796
  }
87111
- const result = await stickyPurge(this.projectRoot, stickyId);
88797
+ const result = await stickyPurge(projectRoot, stickyId);
87112
88798
  return wrapResult(result, "mutate", "sticky", operation, startTime);
87113
88799
  }
87114
88800
  default:
@@ -87137,23 +88823,20 @@ var StickyHandler = class {
87137
88823
  // packages/cleo/src/dispatch/domains/tasks.ts
87138
88824
  init_src2();
87139
88825
  var TasksHandler = class {
87140
- projectRoot;
87141
- constructor() {
87142
- this.projectRoot = getProjectRoot();
87143
- }
87144
88826
  // -----------------------------------------------------------------------
87145
88827
  // Query
87146
88828
  // -----------------------------------------------------------------------
87147
88829
  async query(operation, params) {
88830
+ const projectRoot = getProjectRoot();
87148
88831
  const startTime = Date.now();
87149
88832
  try {
87150
88833
  switch (operation) {
87151
88834
  case "show": {
87152
- const result = await taskShow(this.projectRoot, params.taskId);
88835
+ const result = await taskShow(projectRoot, params.taskId);
87153
88836
  return wrapResult(result, "query", "tasks", operation, startTime);
87154
88837
  }
87155
88838
  case "list": {
87156
- const result = await taskList(this.projectRoot, {
88839
+ const result = await taskList(projectRoot, {
87157
88840
  parent: params?.parent,
87158
88841
  status: params?.status,
87159
88842
  priority: params?.priority,
@@ -87169,7 +88852,7 @@ var TasksHandler = class {
87169
88852
  }
87170
88853
  case "find": {
87171
88854
  const result = await taskFind(
87172
- this.projectRoot,
88855
+ projectRoot,
87173
88856
  params?.query,
87174
88857
  params?.limit,
87175
88858
  {
@@ -87184,12 +88867,12 @@ var TasksHandler = class {
87184
88867
  }
87185
88868
  case "tree": {
87186
88869
  const taskId = params?.taskId;
87187
- const result = await taskTree(this.projectRoot, taskId);
88870
+ const result = await taskTree(projectRoot, taskId);
87188
88871
  return wrapResult(result, "query", "tasks", operation, startTime);
87189
88872
  }
87190
88873
  case "blockers": {
87191
88874
  const result = await taskBlockers(
87192
- this.projectRoot,
88875
+ projectRoot,
87193
88876
  params
87194
88877
  );
87195
88878
  return wrapResult(result, "query", "tasks", operation, startTime);
@@ -87197,11 +88880,11 @@ var TasksHandler = class {
87197
88880
  case "depends": {
87198
88881
  const action = params?.action;
87199
88882
  if (action === "overview") {
87200
- const result2 = await taskDepsOverview(this.projectRoot);
88883
+ const result2 = await taskDepsOverview(projectRoot);
87201
88884
  return wrapResult(result2, "query", "tasks", operation, startTime);
87202
88885
  }
87203
88886
  if (action === "cycles") {
87204
- const result2 = await taskDepsCycles(this.projectRoot);
88887
+ const result2 = await taskDepsCycles(projectRoot);
87205
88888
  return wrapResult(result2, "query", "tasks", operation, startTime);
87206
88889
  }
87207
88890
  const taskId = params?.taskId;
@@ -87217,64 +88900,64 @@ var TasksHandler = class {
87217
88900
  }
87218
88901
  const direction = params?.direction;
87219
88902
  const tree = params?.tree;
87220
- const result = await taskDepends(this.projectRoot, taskId, direction, tree);
88903
+ const result = await taskDepends(projectRoot, taskId, direction, tree);
87221
88904
  return wrapResult(result, "query", "tasks", operation, startTime);
87222
88905
  }
87223
88906
  case "analyze": {
87224
88907
  const taskId = params?.taskId;
87225
88908
  const tierLimit = params?.tierLimit;
87226
- const result = await taskAnalyze(this.projectRoot, taskId, { tierLimit });
88909
+ const result = await taskAnalyze(projectRoot, taskId, { tierLimit });
87227
88910
  return wrapResult(result, "query", "tasks", operation, startTime);
87228
88911
  }
87229
88912
  case "next": {
87230
88913
  const result = await taskNext(
87231
- this.projectRoot,
88914
+ projectRoot,
87232
88915
  params
87233
88916
  );
87234
88917
  return wrapResult(result, "query", "tasks", operation, startTime);
87235
88918
  }
87236
88919
  case "plan": {
87237
- const result = await taskPlan(this.projectRoot);
88920
+ const result = await taskPlan(projectRoot);
87238
88921
  return wrapResult(result, "query", "tasks", operation, startTime);
87239
88922
  }
87240
88923
  case "relates": {
87241
88924
  const taskId = params.taskId;
87242
88925
  if (params?.mode) {
87243
- const result2 = await taskRelatesFind(this.projectRoot, taskId, {
88926
+ const result2 = await taskRelatesFind(projectRoot, taskId, {
87244
88927
  mode: params.mode,
87245
88928
  threshold: params?.threshold ? Number(params.threshold) : void 0
87246
88929
  });
87247
88930
  return wrapResult(result2, "query", "tasks", operation, startTime);
87248
88931
  }
87249
- const result = await taskRelates(this.projectRoot, taskId);
88932
+ const result = await taskRelates(projectRoot, taskId);
87250
88933
  return wrapResult(result, "query", "tasks", operation, startTime);
87251
88934
  }
87252
88935
  case "complexity.estimate": {
87253
- const result = await taskComplexityEstimate(this.projectRoot, {
88936
+ const result = await taskComplexityEstimate(projectRoot, {
87254
88937
  taskId: params.taskId
87255
88938
  });
87256
88939
  return wrapResult(result, "query", "tasks", operation, startTime);
87257
88940
  }
87258
88941
  case "current": {
87259
- const result = await taskCurrentGet(this.projectRoot);
88942
+ const result = await taskCurrentGet(projectRoot);
87260
88943
  return wrapResult(result, "query", "tasks", operation, startTime);
87261
88944
  }
87262
88945
  case "history": {
87263
88946
  const taskId = params?.taskId;
87264
88947
  if (taskId) {
87265
- const result2 = await taskHistory(this.projectRoot, taskId, params?.limit);
88948
+ const result2 = await taskHistory(projectRoot, taskId, params?.limit);
87266
88949
  return wrapResult(result2, "query", "tasks", operation, startTime);
87267
88950
  }
87268
- const result = await taskWorkHistory2(this.projectRoot);
88951
+ const result = await taskWorkHistory2(projectRoot);
87269
88952
  return wrapResult(result, "query", "tasks", operation, startTime);
87270
88953
  }
87271
88954
  case "label.list": {
87272
- const result = await taskLabelList(this.projectRoot);
88955
+ const result = await taskLabelList(projectRoot);
87273
88956
  return wrapResult(result, "query", "tasks", operation, startTime);
87274
88957
  }
87275
88958
  case "sync.links": {
87276
88959
  const result = await taskSyncLinks(
87277
- this.projectRoot,
88960
+ projectRoot,
87278
88961
  params
87279
88962
  );
87280
88963
  return wrapResult(result, "query", "tasks", operation, startTime);
@@ -87294,11 +88977,12 @@ var TasksHandler = class {
87294
88977
  // Mutate
87295
88978
  // -----------------------------------------------------------------------
87296
88979
  async mutate(operation, params) {
88980
+ const projectRoot = getProjectRoot();
87297
88981
  const startTime = Date.now();
87298
88982
  try {
87299
88983
  switch (operation) {
87300
88984
  case "add": {
87301
- const result = await taskCreate(this.projectRoot, {
88985
+ const result = await taskCreate(projectRoot, {
87302
88986
  title: params.title,
87303
88987
  description: params?.description ?? params.title,
87304
88988
  parent: params?.parent ?? params?.parentId,
@@ -87310,7 +88994,7 @@ var TasksHandler = class {
87310
88994
  return wrapResult(result, "mutate", "tasks", operation, startTime);
87311
88995
  }
87312
88996
  case "update": {
87313
- const result = await taskUpdate(this.projectRoot, params.taskId, {
88997
+ const result = await taskUpdate(projectRoot, params.taskId, {
87314
88998
  title: params?.title,
87315
88999
  description: params?.description,
87316
89000
  status: params?.status,
@@ -87331,7 +89015,7 @@ var TasksHandler = class {
87331
89015
  }
87332
89016
  case "complete": {
87333
89017
  const result = await taskComplete(
87334
- this.projectRoot,
89018
+ projectRoot,
87335
89019
  params.taskId,
87336
89020
  params?.notes
87337
89021
  );
@@ -87339,7 +89023,7 @@ var TasksHandler = class {
87339
89023
  }
87340
89024
  case "delete": {
87341
89025
  const result = await taskDelete(
87342
- this.projectRoot,
89026
+ projectRoot,
87343
89027
  params.taskId,
87344
89028
  params?.force
87345
89029
  );
@@ -87347,7 +89031,7 @@ var TasksHandler = class {
87347
89031
  }
87348
89032
  case "archive": {
87349
89033
  const result = await taskArchive(
87350
- this.projectRoot,
89034
+ projectRoot,
87351
89035
  params?.taskId,
87352
89036
  params?.before
87353
89037
  );
@@ -87357,20 +89041,20 @@ var TasksHandler = class {
87357
89041
  const taskId = params.taskId;
87358
89042
  const from = params?.from;
87359
89043
  if (from === "done") {
87360
- const result2 = await taskReopen(this.projectRoot, taskId, {
89044
+ const result2 = await taskReopen(projectRoot, taskId, {
87361
89045
  status: params?.status,
87362
89046
  reason: params?.reason
87363
89047
  });
87364
89048
  return wrapResult(result2, "mutate", "tasks", operation, startTime);
87365
89049
  }
87366
89050
  if (from === "archived") {
87367
- const result2 = await taskUnarchive(this.projectRoot, taskId, {
89051
+ const result2 = await taskUnarchive(projectRoot, taskId, {
87368
89052
  status: params?.status,
87369
89053
  preserveStatus: params?.preserveStatus
87370
89054
  });
87371
89055
  return wrapResult(result2, "mutate", "tasks", operation, startTime);
87372
89056
  }
87373
- const result = await taskRestore(this.projectRoot, taskId, {
89057
+ const result = await taskRestore(projectRoot, taskId, {
87374
89058
  cascade: params?.cascade,
87375
89059
  notes: params?.notes
87376
89060
  });
@@ -87378,7 +89062,7 @@ var TasksHandler = class {
87378
89062
  }
87379
89063
  case "cancel": {
87380
89064
  const result = await taskCancel(
87381
- this.projectRoot,
89065
+ projectRoot,
87382
89066
  params.taskId,
87383
89067
  params?.reason
87384
89068
  );
@@ -87386,7 +89070,7 @@ var TasksHandler = class {
87386
89070
  }
87387
89071
  case "reparent": {
87388
89072
  const result = await taskReparent(
87389
- this.projectRoot,
89073
+ projectRoot,
87390
89074
  params.taskId,
87391
89075
  params?.newParentId ?? null
87392
89076
  );
@@ -87394,7 +89078,7 @@ var TasksHandler = class {
87394
89078
  }
87395
89079
  case "reorder": {
87396
89080
  const result = await taskReorder(
87397
- this.projectRoot,
89081
+ projectRoot,
87398
89082
  params.taskId,
87399
89083
  params.position
87400
89084
  );
@@ -87413,7 +89097,7 @@ var TasksHandler = class {
87413
89097
  );
87414
89098
  }
87415
89099
  const result = await taskRelatesAdd(
87416
- this.projectRoot,
89100
+ projectRoot,
87417
89101
  params.taskId,
87418
89102
  relatedId,
87419
89103
  params.type,
@@ -87422,15 +89106,15 @@ var TasksHandler = class {
87422
89106
  return wrapResult(result, "mutate", "tasks", operation, startTime);
87423
89107
  }
87424
89108
  case "start": {
87425
- const result = await taskStart(this.projectRoot, params.taskId);
89109
+ const result = await taskStart(projectRoot, params.taskId);
87426
89110
  return wrapResult(result, "mutate", "tasks", operation, startTime);
87427
89111
  }
87428
89112
  case "stop": {
87429
- const result = await taskStop(this.projectRoot);
89113
+ const result = await taskStop(projectRoot);
87430
89114
  return wrapResult(result, "mutate", "tasks", operation, startTime);
87431
89115
  }
87432
89116
  case "sync.reconcile": {
87433
- const result = await taskSyncReconcile(this.projectRoot, {
89117
+ const result = await taskSyncReconcile(projectRoot, {
87434
89118
  providerId: params.providerId,
87435
89119
  externalTasks: params.externalTasks,
87436
89120
  dryRun: params?.dryRun,
@@ -87441,7 +89125,7 @@ var TasksHandler = class {
87441
89125
  return wrapResult(result, "mutate", "tasks", operation, startTime);
87442
89126
  }
87443
89127
  case "sync.links.remove": {
87444
- const result = await taskSyncLinksRemove(this.projectRoot, params.providerId);
89128
+ const result = await taskSyncLinksRemove(projectRoot, params.providerId);
87445
89129
  return wrapResult(result, "mutate", "tasks", operation, startTime);
87446
89130
  }
87447
89131
  default:
@@ -87512,7 +89196,7 @@ import {
87512
89196
  discoverSkill as discoverSkill2,
87513
89197
  discoverSkills,
87514
89198
  getAllProviders as getAllProviders2,
87515
- getCanonicalSkillsDir as getCanonicalSkillsDir3,
89199
+ getCanonicalSkillsDir as getCanonicalSkillsDir4,
87516
89200
  getInstalledProviders as getInstalledProviders3,
87517
89201
  getTrackedSkills,
87518
89202
  injectAll as injectAll2,
@@ -87529,7 +89213,7 @@ function toolsIssueDiagnostics() {
87529
89213
  }
87530
89214
  async function toolsSkillList(limit, offset) {
87531
89215
  try {
87532
- const skills = await discoverSkills(getCanonicalSkillsDir3());
89216
+ const skills = await discoverSkills(getCanonicalSkillsDir4());
87533
89217
  const page = paginate(skills, limit, offset);
87534
89218
  return {
87535
89219
  success: true,
@@ -87548,7 +89232,7 @@ async function toolsSkillList(limit, offset) {
87548
89232
  }
87549
89233
  async function toolsSkillShow(name2) {
87550
89234
  try {
87551
- const skill = await discoverSkill2(`${getCanonicalSkillsDir3()}/${name2}`);
89235
+ const skill = await discoverSkill2(`${getCanonicalSkillsDir4()}/${name2}`);
87552
89236
  if (!skill) {
87553
89237
  return engineError("E_NOT_FOUND", `Skill not found: ${name2}`);
87554
89238
  }
@@ -87560,7 +89244,7 @@ async function toolsSkillShow(name2) {
87560
89244
  async function toolsSkillFind(query) {
87561
89245
  try {
87562
89246
  const q = (query ?? "").toLowerCase();
87563
- const skills = await discoverSkills(getCanonicalSkillsDir3());
89247
+ const skills = await discoverSkills(getCanonicalSkillsDir4());
87564
89248
  const filtered = q ? skills.filter(
87565
89249
  (s) => s.name.toLowerCase().includes(q) || s.metadata.description.toLowerCase().includes(q)
87566
89250
  ) : skills;
@@ -87584,13 +89268,13 @@ function toolsSkillDispatch(name2) {
87584
89268
  }
87585
89269
  async function toolsSkillVerify(name2) {
87586
89270
  try {
87587
- const installed = await discoverSkill2(`${getCanonicalSkillsDir3()}/${name2}`);
89271
+ const installed = await discoverSkill2(`${getCanonicalSkillsDir4()}/${name2}`);
87588
89272
  const catalogEntry = catalog3.getSkill(name2);
87589
89273
  return engineSuccess({
87590
89274
  skill: name2,
87591
89275
  installed: !!installed,
87592
89276
  inCatalog: !!catalogEntry,
87593
- installPath: installed ? `${getCanonicalSkillsDir3()}/${name2}` : null
89277
+ installPath: installed ? `${getCanonicalSkillsDir4()}/${name2}` : null
87594
89278
  });
87595
89279
  } catch (error40) {
87596
89280
  return engineError("E_INTERNAL", error40 instanceof Error ? error40.message : String(error40));
@@ -87995,9 +89679,8 @@ async function toolsAdapterDispose(projectRoot, id) {
87995
89679
 
87996
89680
  // packages/cleo/src/dispatch/domains/tools.ts
87997
89681
  var ToolsHandler = class {
87998
- projectRoot;
87999
- constructor() {
88000
- this.projectRoot = getProjectRoot();
89682
+ get projectRoot() {
89683
+ return getProjectRoot();
88001
89684
  }
88002
89685
  // -----------------------------------------------------------------------
88003
89686
  // DomainHandler interface
@@ -88730,7 +90413,7 @@ function getConfig() {
88730
90413
 
88731
90414
  // packages/cleo/src/dispatch/middleware/audit.ts
88732
90415
  init_internal();
88733
- var log8 = getLogger("audit");
90416
+ var log9 = getLogger("audit");
88734
90417
  var cachedProjectHash;
88735
90418
  function resolveProjectHash() {
88736
90419
  if (cachedProjectHash !== void 0) return cachedProjectHash;
@@ -88761,9 +90444,9 @@ async function writeToSqlite(entry, requestId) {
88761
90444
  const { getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
88762
90445
  const { auditLog: auditLog2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
88763
90446
  const { AuditLogInsertSchema: AuditLogInsertSchema2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
88764
- const { randomUUID: randomUUID10 } = await import("node:crypto");
90447
+ const { randomUUID: randomUUID11 } = await import("node:crypto");
88765
90448
  const payload = {
88766
- id: randomUUID10(),
90449
+ id: randomUUID11(),
88767
90450
  timestamp: entry.timestamp,
88768
90451
  action: entry.operation,
88769
90452
  taskId: entry.metadata.taskId ?? "system",
@@ -88784,7 +90467,7 @@ async function writeToSqlite(entry, requestId) {
88784
90467
  };
88785
90468
  const parsed = AuditLogInsertSchema2.safeParse(payload);
88786
90469
  if (!parsed.success) {
88787
- log8.warn(
90470
+ log9.warn(
88788
90471
  { issues: parsed.error.issues },
88789
90472
  "Audit payload failed Zod validation; skipping insert"
88790
90473
  );
@@ -88793,7 +90476,7 @@ async function writeToSqlite(entry, requestId) {
88793
90476
  const db = await getDb4(process.cwd());
88794
90477
  await db.insert(auditLog2).values(parsed.data).run();
88795
90478
  } catch (err) {
88796
- log8.warn({ err }, "Failed to write audit entry to SQLite");
90479
+ log9.warn({ err }, "Failed to write audit entry to SQLite");
88797
90480
  }
88798
90481
  }
88799
90482
  function createAudit() {
@@ -88824,7 +90507,7 @@ function createAudit() {
88824
90507
  },
88825
90508
  error: response.error?.message
88826
90509
  };
88827
- log8.info(
90510
+ log9.info(
88828
90511
  {
88829
90512
  domain: entry.domain,
88830
90513
  operation: entry.operation,
@@ -88841,7 +90524,7 @@ function createAudit() {
88841
90524
  await writeToSqlite(entry, req.requestId);
88842
90525
  } else {
88843
90526
  writeToSqlite(entry, req.requestId).catch((err) => {
88844
- log8.error({ err }, "Failed to persist audit entry to SQLite");
90527
+ log9.error({ err }, "Failed to persist audit entry to SQLite");
88845
90528
  });
88846
90529
  }
88847
90530
  return response;
@@ -89025,7 +90708,7 @@ async function dispatchFromCli(gateway, domain2, operation, params, outputOpts)
89025
90708
  operation,
89026
90709
  params,
89027
90710
  source: "cli",
89028
- requestId: randomUUID9()
90711
+ requestId: randomUUID10()
89029
90712
  });
89030
90713
  if (response.success) {
89031
90714
  await autoRecordDispatchTokenUsage({
@@ -89078,7 +90761,7 @@ async function dispatchRaw(gateway, domain2, operation, params) {
89078
90761
  operation,
89079
90762
  params,
89080
90763
  source: "cli",
89081
- requestId: randomUUID9()
90764
+ requestId: randomUUID10()
89082
90765
  });
89083
90766
  }
89084
90767
 
@@ -90692,8 +92375,8 @@ function getEnabledPlatforms(cwd) {
90692
92375
  return [];
90693
92376
  }
90694
92377
  }
90695
- function getDefaultOutputPath(platform3) {
90696
- switch (platform3) {
92378
+ function getDefaultOutputPath(platform5) {
92379
+ switch (platform5) {
90697
92380
  case "mintlify":
90698
92381
  return "docs/changelog/overview.mdx";
90699
92382
  case "docusaurus":
@@ -90715,8 +92398,8 @@ function getGitHubRepoSlug(cwd) {
90715
92398
  return "";
90716
92399
  }
90717
92400
  }
90718
- function generateForPlatform(platform3, sourceContent, repoSlug, limit) {
90719
- switch (platform3) {
92401
+ function generateForPlatform(platform5, sourceContent, repoSlug, limit) {
92402
+ switch (platform5) {
90720
92403
  case "mintlify":
90721
92404
  return generateMintlify(sourceContent, repoSlug, limit);
90722
92405
  case "docusaurus":
@@ -94183,11 +95866,11 @@ function registerWebCommand(program) {
94183
95866
  );
94184
95867
  }
94185
95868
  const url2 = status.url;
94186
- const platform3 = process.platform;
95869
+ const platform5 = process.platform;
94187
95870
  try {
94188
- if (platform3 === "linux") {
95871
+ if (platform5 === "linux") {
94189
95872
  spawn2("xdg-open", [url2], { detached: true, stdio: "ignore" }).unref();
94190
- } else if (platform3 === "darwin") {
95873
+ } else if (platform5 === "darwin") {
94191
95874
  spawn2("open", [url2], { detached: true, stdio: "ignore" }).unref();
94192
95875
  }
94193
95876
  } catch {