@cleocode/core 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.
Files changed (166) hide show
  1. package/dist/admin/import-tasks.d.ts +10 -2
  2. package/dist/admin/import-tasks.d.ts.map +1 -1
  3. package/dist/bootstrap.d.ts.map +1 -1
  4. package/dist/index.js +1890 -504
  5. package/dist/index.js.map +4 -4
  6. package/dist/init.d.ts.map +1 -1
  7. package/dist/injection.d.ts +1 -1
  8. package/dist/injection.d.ts.map +1 -1
  9. package/dist/internal.d.ts +3 -1
  10. package/dist/internal.d.ts.map +1 -1
  11. package/dist/nexus/index.d.ts +2 -0
  12. package/dist/nexus/index.d.ts.map +1 -1
  13. package/dist/nexus/transfer-types.d.ts +123 -0
  14. package/dist/nexus/transfer-types.d.ts.map +1 -0
  15. package/dist/nexus/transfer.d.ts +31 -0
  16. package/dist/nexus/transfer.d.ts.map +1 -0
  17. package/dist/routing/capability-matrix.d.ts +6 -4
  18. package/dist/routing/capability-matrix.d.ts.map +1 -1
  19. package/dist/scaffold.d.ts +16 -9
  20. package/dist/scaffold.d.ts.map +1 -1
  21. package/dist/skills/agents/install.d.ts.map +1 -1
  22. package/dist/skills/routing-table.d.ts +17 -16
  23. package/dist/skills/routing-table.d.ts.map +1 -1
  24. package/dist/skills/skill-paths.d.ts.map +1 -1
  25. package/dist/store/brain-sqlite.d.ts +4 -1
  26. package/dist/store/brain-sqlite.d.ts.map +1 -1
  27. package/dist/store/nexus-sqlite.d.ts +4 -1
  28. package/dist/store/nexus-sqlite.d.ts.map +1 -1
  29. package/dist/store/sqlite.d.ts +4 -1
  30. package/dist/store/sqlite.d.ts.map +1 -1
  31. package/dist/store/tasks-schema.d.ts +3 -3
  32. package/dist/store/tasks-schema.d.ts.map +1 -1
  33. package/dist/store/validation-schemas.d.ts +5 -4
  34. package/dist/store/validation-schemas.d.ts.map +1 -1
  35. package/dist/system/health.d.ts.map +1 -1
  36. package/dist/ui/index.d.ts +0 -1
  37. package/dist/ui/index.d.ts.map +1 -1
  38. package/package.json +9 -4
  39. package/schemas/adr-frontmatter.schema.json +72 -0
  40. package/schemas/agent-configs.schema.json +120 -0
  41. package/schemas/agent-registry.json +243 -0
  42. package/schemas/agent-registry.schema.json +132 -0
  43. package/schemas/archive/research-manifest.schema.json +257 -0
  44. package/schemas/archive.schema.json +450 -0
  45. package/schemas/brain-decision.schema.json +69 -0
  46. package/schemas/brain-learning.schema.json +57 -0
  47. package/schemas/brain-pattern.schema.json +72 -0
  48. package/schemas/config.schema.json +2606 -0
  49. package/schemas/context-state.schema.json +137 -0
  50. package/schemas/contribution.schema.json +722 -0
  51. package/schemas/critical-path.schema.json +246 -0
  52. package/schemas/deps-cache.schema.json +97 -0
  53. package/schemas/doctor-output.schema.json +283 -0
  54. package/schemas/error.schema.json +161 -0
  55. package/schemas/export-package.schema.json +375 -0
  56. package/schemas/global-config.schema.json +219 -0
  57. package/schemas/grade.schema.json +49 -0
  58. package/schemas/log.schema.json +250 -0
  59. package/schemas/metrics.schema.json +328 -0
  60. package/schemas/migrations.schema.json +150 -0
  61. package/schemas/nexus-registry.schema.json +90 -0
  62. package/schemas/operation-constitution.schema.json +438 -0
  63. package/schemas/output.schema.json +164 -0
  64. package/schemas/project-context.schema.json +164 -0
  65. package/schemas/project-info.schema.json +180 -0
  66. package/schemas/projects-registry.schema.json +107 -0
  67. package/schemas/protocol-frontmatter.schema.json +72 -0
  68. package/schemas/rcasd-consensus-report.schema.json +10 -0
  69. package/schemas/rcasd-evidence.schema.json +42 -0
  70. package/schemas/rcasd-gate-result.schema.json +46 -0
  71. package/schemas/rcasd-hitl-resolution.schema.json +10 -0
  72. package/schemas/rcasd-index.schema.json +10 -0
  73. package/schemas/rcasd-manifest.schema.json +10 -0
  74. package/schemas/rcasd-research-output.schema.json +10 -0
  75. package/schemas/rcasd-spec-frontmatter.schema.json +10 -0
  76. package/schemas/rcasd-stage-transition.schema.json +38 -0
  77. package/schemas/releases.schema.json +267 -0
  78. package/schemas/skills-manifest.schema.json +91 -0
  79. package/schemas/skillsmp.schema.json +208 -0
  80. package/schemas/spec-index.schema.json +196 -0
  81. package/schemas/system-flow-atlas.schema.json +125 -0
  82. package/src/__tests__/injection-chain.test.ts +11 -10
  83. package/src/__tests__/injection-mvi-tiers.test.ts +4 -2
  84. package/src/admin/import-tasks.ts +53 -29
  85. package/src/agents/__tests__/capacity.test.d.ts +7 -0
  86. package/src/agents/__tests__/capacity.test.d.ts.map +1 -0
  87. package/src/agents/__tests__/capacity.test.js +173 -0
  88. package/src/agents/__tests__/capacity.test.js.map +1 -0
  89. package/src/agents/__tests__/registry.test.d.ts +8 -0
  90. package/src/agents/__tests__/registry.test.d.ts.map +1 -0
  91. package/src/agents/__tests__/registry.test.js +348 -0
  92. package/src/agents/__tests__/registry.test.js.map +1 -0
  93. package/src/agents/__tests__/retry.test.d.ts +7 -0
  94. package/src/agents/__tests__/retry.test.d.ts.map +1 -0
  95. package/src/agents/__tests__/retry.test.js +225 -0
  96. package/src/agents/__tests__/retry.test.js.map +1 -0
  97. package/src/bootstrap.ts +3 -1
  98. package/src/init.ts +63 -18
  99. package/src/injection.ts +11 -5
  100. package/src/intelligence/__tests__/impact.test.d.ts +15 -0
  101. package/src/intelligence/__tests__/impact.test.d.ts.map +1 -0
  102. package/src/intelligence/__tests__/impact.test.js +384 -0
  103. package/src/intelligence/__tests__/impact.test.js.map +1 -0
  104. package/src/intelligence/__tests__/patterns.test.d.ts +8 -0
  105. package/src/intelligence/__tests__/patterns.test.d.ts.map +1 -0
  106. package/src/intelligence/__tests__/patterns.test.js +370 -0
  107. package/src/intelligence/__tests__/patterns.test.js.map +1 -0
  108. package/src/intelligence/__tests__/prediction.test.d.ts +8 -0
  109. package/src/intelligence/__tests__/prediction.test.d.ts.map +1 -0
  110. package/src/intelligence/__tests__/prediction.test.js +314 -0
  111. package/src/intelligence/__tests__/prediction.test.js.map +1 -0
  112. package/src/internal.ts +7 -1
  113. package/src/nexus/__tests__/nexus-e2e.test.d.ts +12 -0
  114. package/src/nexus/__tests__/nexus-e2e.test.d.ts.map +1 -0
  115. package/src/nexus/__tests__/nexus-e2e.test.js +1220 -0
  116. package/src/nexus/__tests__/nexus-e2e.test.js.map +1 -0
  117. package/src/nexus/__tests__/transfer.test.d.ts +8 -0
  118. package/src/nexus/__tests__/transfer.test.d.ts.map +1 -0
  119. package/src/nexus/__tests__/transfer.test.js +372 -0
  120. package/src/nexus/__tests__/transfer.test.js.map +1 -0
  121. package/src/nexus/__tests__/transfer.test.ts +446 -0
  122. package/src/nexus/index.ts +14 -0
  123. package/src/nexus/transfer-types.ts +129 -0
  124. package/src/nexus/transfer.ts +314 -0
  125. package/src/routing/capability-matrix.ts +1435 -205
  126. package/src/scaffold.ts +18 -11
  127. package/src/skills/__tests__/routing-table.test.ts +53 -33
  128. package/src/skills/agents/install.ts +9 -1
  129. package/src/skills/routing-table.ts +39 -253
  130. package/src/skills/skill-paths.ts +3 -2
  131. package/src/store/__tests__/project-detect.test.ts +1 -1
  132. package/src/store/brain-sqlite.ts +7 -3
  133. package/src/store/nexus-sqlite.ts +7 -3
  134. package/src/store/sqlite.ts +9 -3
  135. package/src/store/tasks-schema.ts +1 -1
  136. package/src/system/health.ts +18 -7
  137. package/src/ui/index.ts +0 -6
  138. package/src/validation/operation-gate-validators.ts +2 -2
  139. package/templates/CLEO-INJECTION.md +120 -0
  140. package/templates/README.md +29 -0
  141. package/templates/agent-registry.json +305 -0
  142. package/templates/cleo-gitignore +74 -0
  143. package/templates/config.template.json +187 -0
  144. package/templates/git-hooks/commit-msg +149 -0
  145. package/templates/git-hooks/pre-commit +40 -0
  146. package/templates/git-hooks/pre-push +79 -0
  147. package/templates/github/ISSUE_TEMPLATE/bug_report.yml +143 -0
  148. package/templates/github/ISSUE_TEMPLATE/config.yml +8 -0
  149. package/templates/github/ISSUE_TEMPLATE/feature_request.yml +125 -0
  150. package/templates/github/ISSUE_TEMPLATE/help_question.yml +99 -0
  151. package/templates/global-config.template.json +56 -0
  152. package/templates/hooks/precompact-safestop.sh +89 -0
  153. package/templates/issue-templates/bug_report.yml +143 -0
  154. package/templates/issue-templates/config.yml +8 -0
  155. package/templates/issue-templates/feature_request.yml +125 -0
  156. package/templates/issue-templates/help_question.yml +99 -0
  157. package/templates/skillsmp.json.example +28 -0
  158. package/templates/skillsmp.json.example.md +214 -0
  159. package/dist/ui/injection-legacy.d.ts +0 -26
  160. package/dist/ui/injection-legacy.d.ts.map +0 -1
  161. package/src/ui/__tests__/injection-registry.test.d.ts +0 -11
  162. package/src/ui/__tests__/injection-registry.test.d.ts.map +0 -1
  163. package/src/ui/__tests__/injection-registry.test.js +0 -46
  164. package/src/ui/__tests__/injection-registry.test.js.map +0 -1
  165. package/src/ui/__tests__/injection-registry.test.ts +0 -57
  166. package/src/ui/injection-legacy.ts +0 -44
package/dist/index.js CHANGED
@@ -9122,7 +9122,7 @@ var init_tasks_schema = __esm({
9122
9122
  "supersedes"
9123
9123
  ];
9124
9124
  LIFECYCLE_TRANSITION_TYPES = ["automatic", "manual", "forced"];
9125
- EXTERNAL_LINK_TYPES = ["created", "matched", "manual"];
9125
+ EXTERNAL_LINK_TYPES = ["created", "matched", "manual", "transferred"];
9126
9126
  SYNC_DIRECTIONS = ["inbound", "outbound", "bidirectional"];
9127
9127
  tasks = sqliteTable(
9128
9128
  "tasks",
@@ -10579,7 +10579,9 @@ function getBrainDbPath(cwd) {
10579
10579
  function resolveBrainMigrationsFolder() {
10580
10580
  const __filename = fileURLToPath(import.meta.url);
10581
10581
  const __dirname = dirname3(__filename);
10582
- return join7(__dirname, "..", "..", "migrations", "drizzle-brain");
10582
+ const isBundled = __dirname.endsWith("/dist") || __dirname.endsWith("\\dist");
10583
+ const pkgRoot = isBundled ? join7(__dirname, "..") : join7(__dirname, "..", "..");
10584
+ return join7(pkgRoot, "migrations", "drizzle-brain");
10583
10585
  }
10584
10586
  function tableExists(nativeDb, tableName) {
10585
10587
  const result = nativeDb.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(tableName);
@@ -10823,7 +10825,9 @@ function getNexusDbPath() {
10823
10825
  function resolveNexusMigrationsFolder() {
10824
10826
  const __filename = fileURLToPath2(import.meta.url);
10825
10827
  const __dirname = dirname4(__filename);
10826
- return join8(__dirname, "..", "..", "migrations", "drizzle-nexus");
10828
+ const isBundled = __dirname.endsWith("/dist") || __dirname.endsWith("\\dist");
10829
+ const pkgRoot = isBundled ? join8(__dirname, "..") : join8(__dirname, "..", "..");
10830
+ return join8(pkgRoot, "migrations", "drizzle-nexus");
10827
10831
  }
10828
10832
  function tableExists2(nativeDb, tableName) {
10829
10833
  const result = nativeDb.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(tableName);
@@ -11014,7 +11018,7 @@ function getDbPath(cwd) {
11014
11018
  return join9(getCleoDirAbsolute(cwd), DB_FILENAME3);
11015
11019
  }
11016
11020
  async function autoRecoverFromBackup(nativeDb, dbPath, cwd) {
11017
- const log7 = getLogger("sqlite");
11021
+ const log8 = getLogger("sqlite");
11018
11022
  try {
11019
11023
  const countResult = nativeDb.prepare("SELECT COUNT(*) as cnt FROM tasks").get();
11020
11024
  const taskCount = countResult?.cnt ?? 0;
@@ -11035,7 +11039,7 @@ async function autoRecoverFromBackup(nativeDb, dbPath, cwd) {
11035
11039
  if (backupTaskCount < MIN_BACKUP_TASK_COUNT) {
11036
11040
  return;
11037
11041
  }
11038
- log7.warn(
11042
+ log8.warn(
11039
11043
  { dbPath, backupPath: newestBackup.path, backupTasks: backupTaskCount },
11040
11044
  `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).`
11041
11045
  );
@@ -11053,7 +11057,7 @@ async function autoRecoverFromBackup(nativeDb, dbPath, cwd) {
11053
11057
  const tempPath = dbPath + ".recovery-tmp";
11054
11058
  copyFileSync3(newestBackup.path, tempPath);
11055
11059
  renameSync(tempPath, dbPath);
11056
- log7.info(
11060
+ log8.info(
11057
11061
  { dbPath, backupPath: newestBackup.path, restoredTasks: backupTaskCount },
11058
11062
  "Database auto-recovered from backup successfully."
11059
11063
  );
@@ -11063,7 +11067,7 @@ async function autoRecoverFromBackup(nativeDb, dbPath, cwd) {
11063
11067
  runMigrations(restoredNativeDb, restoredDb);
11064
11068
  _db2 = restoredDb;
11065
11069
  } catch (err) {
11066
- log7.error({ err, dbPath }, "Auto-recovery from backup failed. Continuing with empty database.");
11070
+ log8.error({ err, dbPath }, "Auto-recovery from backup failed. Continuing with empty database.");
11067
11071
  }
11068
11072
  }
11069
11073
  async function getDb(cwd) {
@@ -11094,7 +11098,7 @@ async function getDb(cwd) {
11094
11098
  const { execFileSync: execFileSync11 } = await import("node:child_process");
11095
11099
  const gitCwd = resolve3(dbPath, "..", "..");
11096
11100
  const filesToCheck = [dbPath, dbPath + "-wal", dbPath + "-shm"];
11097
- const log7 = getLogger("sqlite");
11101
+ const log8 = getLogger("sqlite");
11098
11102
  for (const fileToCheck of filesToCheck) {
11099
11103
  try {
11100
11104
  execFileSync11("git", ["ls-files", "--error-unmatch", fileToCheck], {
@@ -11102,7 +11106,7 @@ async function getDb(cwd) {
11102
11106
  stdio: "pipe"
11103
11107
  });
11104
11108
  const basename18 = fileToCheck.split(/[\\/]/).pop();
11105
- log7.warn(
11109
+ log8.warn(
11106
11110
  { path: fileToCheck },
11107
11111
  `${basename18} 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)`
11108
11112
  );
@@ -11124,7 +11128,9 @@ async function getDb(cwd) {
11124
11128
  function resolveMigrationsFolder() {
11125
11129
  const __filename = fileURLToPath3(import.meta.url);
11126
11130
  const __dirname = dirname5(__filename);
11127
- return join9(__dirname, "..", "..", "migrations", "drizzle-tasks");
11131
+ const isBundled = __dirname.endsWith("/dist") || __dirname.endsWith("\\dist");
11132
+ const pkgRoot = isBundled ? join9(__dirname, "..") : join9(__dirname, "..", "..");
11133
+ return join9(pkgRoot, "migrations", "drizzle-tasks");
11128
11134
  }
11129
11135
  function tableExists3(nativeDb, tableName) {
11130
11136
  const result = nativeDb.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(tableName);
@@ -18466,16 +18472,6 @@ var init_json_schema_validator = __esm({
18466
18472
  });
18467
18473
 
18468
18474
  // packages/core/src/schema-management.ts
18469
- var schema_management_exports = {};
18470
- __export(schema_management_exports, {
18471
- checkGlobalSchemas: () => checkGlobalSchemas,
18472
- checkSchemaStaleness: () => checkSchemaStaleness,
18473
- cleanProjectSchemas: () => cleanProjectSchemas,
18474
- ensureGlobalSchemas: () => ensureGlobalSchemas,
18475
- getSchemaVersion: () => getSchemaVersion2,
18476
- listInstalledSchemas: () => listInstalledSchemas,
18477
- resolveSchemaPath: () => resolveSchemaPath
18478
- });
18479
18475
  import {
18480
18476
  copyFileSync as copyFileSync4,
18481
18477
  existsSync as existsSync30,
@@ -18601,70 +18597,6 @@ function checkGlobalSchemas() {
18601
18597
  stale
18602
18598
  };
18603
18599
  }
18604
- function checkSchemaStaleness() {
18605
- const globalDir = getCleoSchemasDir();
18606
- const bundledFiles = listBundledSchemas();
18607
- const stale = [];
18608
- const current = [];
18609
- const missing = [];
18610
- const packageRoot = getPackageRoot();
18611
- const bundledDir = join34(packageRoot, "schemas");
18612
- for (const file2 of bundledFiles) {
18613
- const globalPath = join34(globalDir, file2);
18614
- if (!existsSync30(globalPath)) {
18615
- missing.push(file2);
18616
- continue;
18617
- }
18618
- const bundledVersion = readVersionFromPath(join34(bundledDir, file2));
18619
- const globalVersion = readVersionFromPath(globalPath);
18620
- if (bundledVersion !== null && bundledVersion !== globalVersion) {
18621
- stale.push(file2);
18622
- } else {
18623
- current.push(file2);
18624
- }
18625
- }
18626
- return { stale, current, missing };
18627
- }
18628
- function listInstalledSchemas() {
18629
- const globalDir = getCleoSchemasDir();
18630
- if (!existsSync30(globalDir)) return [];
18631
- let files;
18632
- try {
18633
- files = readdirSync16(globalDir).filter((f) => f.endsWith(".schema.json"));
18634
- } catch {
18635
- return [];
18636
- }
18637
- return files.map((name2) => {
18638
- const fullPath = join34(globalDir, name2);
18639
- return {
18640
- name: name2,
18641
- path: fullPath,
18642
- version: readVersionFromPath(fullPath)
18643
- };
18644
- });
18645
- }
18646
- async function cleanProjectSchemas(projectRoot) {
18647
- const projectSchemasDir = join34(projectRoot, ".cleo", "schemas");
18648
- if (!existsSync30(projectSchemasDir)) {
18649
- return { cleaned: false };
18650
- }
18651
- try {
18652
- const stat2 = statSync7(projectSchemasDir);
18653
- if (!stat2.isDirectory()) {
18654
- return { cleaned: false };
18655
- }
18656
- } catch {
18657
- return { cleaned: false };
18658
- }
18659
- const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
18660
- const backupDir = join34(projectRoot, ".cleo", "backups", "schemas");
18661
- const backupTarget = join34(backupDir, `schemas-${timestamp2}`);
18662
- if (!existsSync30(backupDir)) {
18663
- mkdirSync8(backupDir, { recursive: true });
18664
- }
18665
- renameSync3(projectSchemasDir, backupTarget);
18666
- return { cleaned: true };
18667
- }
18668
18600
  var init_schema_management = __esm({
18669
18601
  "packages/core/src/schema-management.ts"() {
18670
18602
  "use strict";
@@ -18870,7 +18802,7 @@ async function ensureInjection(projectRoot) {
18870
18802
  }
18871
18803
  }
18872
18804
  const agentsMdPath = join36(projectRoot, "AGENTS.md");
18873
- const agentsMdLines = ["@~/.cleo/templates/CLEO-INJECTION.md"];
18805
+ const agentsMdLines = ["@~/.agents/AGENTS.md"];
18874
18806
  const projectContextPath = join36(projectRoot, ".cleo", "project-context.json");
18875
18807
  if (existsSync32(projectContextPath)) {
18876
18808
  agentsMdLines.push("@.cleo/project-context.json");
@@ -18883,7 +18815,8 @@ async function ensureInjection(projectRoot) {
18883
18815
  if (contributorBlock) {
18884
18816
  agentsMdLines.push(contributorBlock);
18885
18817
  }
18886
- const agentsAction = await inject2(agentsMdPath, agentsMdLines.join("\n"));
18818
+ const agentsMdContent = agentsMdLines.join("\n");
18819
+ const agentsAction = await inject2(agentsMdPath, agentsMdContent);
18887
18820
  actions.push(`AGENTS.md CLEO content (${agentsAction})`);
18888
18821
  const content = getInjectionTemplateContent();
18889
18822
  if (content) {
@@ -18898,8 +18831,9 @@ async function ensureInjection(projectRoot) {
18898
18831
  try {
18899
18832
  const globalAgentsDir = getAgentsHome();
18900
18833
  const globalAgentsMd = join36(globalAgentsDir, "AGENTS.md");
18834
+ const globalHubContent = "@~/.cleo/templates/CLEO-INJECTION.md";
18901
18835
  await mkdir4(globalAgentsDir, { recursive: true });
18902
- await inject2(globalAgentsMd, "@~/.cleo/templates/CLEO-INJECTION.md");
18836
+ await inject2(globalAgentsMd, globalHubContent);
18903
18837
  } catch {
18904
18838
  }
18905
18839
  return {
@@ -19407,7 +19341,7 @@ async function ensureProjectContext(projectRoot, opts) {
19407
19341
  try {
19408
19342
  const schemaPath = join37(
19409
19343
  dirname8(fileURLToPath4(import.meta.url)),
19410
- "../../schemas/project-context.schema.json"
19344
+ "../schemas/project-context.schema.json"
19411
19345
  );
19412
19346
  if (existsSync33(schemaPath)) {
19413
19347
  const AjvModule = await import("ajv");
@@ -19848,11 +19782,9 @@ async function ensureGlobalTemplates() {
19848
19782
  return { action: "created", path: injectionPath };
19849
19783
  }
19850
19784
  async function ensureGlobalScaffold() {
19851
- const { ensureGlobalSchemas: ensureGlobalSchemas2 } = await Promise.resolve().then(() => (init_schema_management(), schema_management_exports));
19852
19785
  const home = await ensureGlobalHome();
19853
- const schemas = ensureGlobalSchemas2();
19854
19786
  const templates = await ensureGlobalTemplates();
19855
- return { home, schemas, templates };
19787
+ return { home, templates };
19856
19788
  }
19857
19789
  function checkGlobalHome() {
19858
19790
  const cleoHome = getCleoHome();
@@ -19986,7 +19918,7 @@ metrics/
19986
19918
  .backups/
19987
19919
  backups/
19988
19920
  `;
19989
- REQUIRED_GLOBAL_SUBDIRS = ["schemas", "templates"];
19921
+ REQUIRED_GLOBAL_SUBDIRS = ["logs", "templates"];
19990
19922
  }
19991
19923
  });
19992
19924
 
@@ -24246,6 +24178,37 @@ function buildExportPackage(tasks2, options) {
24246
24178
  relationshipGraph
24247
24179
  };
24248
24180
  }
24181
+ function exportSingle(taskId, allTasks, projectName) {
24182
+ const task = allTasks.find((t) => t.id === taskId);
24183
+ if (!task) return null;
24184
+ return buildExportPackage([task], {
24185
+ mode: "single",
24186
+ rootTaskIds: [taskId],
24187
+ includeChildren: false,
24188
+ projectName
24189
+ });
24190
+ }
24191
+ function exportSubtree(rootId, allTasks, projectName) {
24192
+ const root = allTasks.find((t) => t.id === rootId);
24193
+ if (!root) return null;
24194
+ const collected = /* @__PURE__ */ new Map();
24195
+ const queue = [rootId];
24196
+ while (queue.length > 0) {
24197
+ const id = queue.shift();
24198
+ const task = allTasks.find((t) => t.id === id);
24199
+ if (!task || collected.has(id)) continue;
24200
+ collected.set(id, task);
24201
+ const children = allTasks.filter((t) => t.parentId === id);
24202
+ queue.push(...children.map((c) => c.id));
24203
+ }
24204
+ const tasks2 = [...collected.values()];
24205
+ return buildExportPackage(tasks2, {
24206
+ mode: "subtree",
24207
+ rootTaskIds: [rootId],
24208
+ includeChildren: true,
24209
+ projectName
24210
+ });
24211
+ }
24249
24212
 
24250
24213
  // packages/core/src/admin/export-tasks.ts
24251
24214
  function parseFilter(filter) {
@@ -24678,20 +24641,7 @@ function topologicalSort(tasks2) {
24678
24641
  }
24679
24642
  return sorted;
24680
24643
  }
24681
- async function importTasksPackage(params) {
24682
- const { file: file2 } = params;
24683
- try {
24684
- await access2(file2, fsConstants2.R_OK);
24685
- } catch {
24686
- throw new Error(`Export file not found: ${file2}`);
24687
- }
24688
- const content = await readFile4(file2, "utf-8");
24689
- let exportPkg;
24690
- try {
24691
- exportPkg = JSON.parse(content);
24692
- } catch {
24693
- throw new Error(`Invalid JSON in: ${file2}`);
24694
- }
24644
+ async function importFromPackage(exportPkg, options = {}) {
24695
24645
  if (exportPkg._meta?.format !== "cleo-export") {
24696
24646
  throw new Error(
24697
24647
  `Invalid export format (expected 'cleo-export', got '${exportPkg._meta?.format}')`
@@ -24700,16 +24650,16 @@ async function importTasksPackage(params) {
24700
24650
  if (!exportPkg.tasks?.length) {
24701
24651
  throw new Error("Export package contains no tasks");
24702
24652
  }
24703
- const accessor = await getAccessor(params.cwd);
24653
+ const accessor = await getAccessor(options.cwd);
24704
24654
  const { tasks: existingTasks } = await accessor.queryTasks({});
24705
- const onConflict = params.onConflict ?? "fail";
24706
- const onMissingDep = params.onMissingDep ?? "strip";
24707
- const force = params.force ?? false;
24708
- const parentId = params.parent;
24709
- const phaseOverride = params.phase;
24710
- const addLabel = params.addLabel;
24711
- const resetStatus = params.resetStatus;
24712
- const addProvenance = params.provenance !== false;
24655
+ const onConflict = options.onConflict ?? "fail";
24656
+ const onMissingDep = options.onMissingDep === "fail" ? "fail" : "strip";
24657
+ const force = options.force ?? false;
24658
+ const parentId = options.parent;
24659
+ const phaseOverride = options.phase;
24660
+ const addLabel = options.addLabel;
24661
+ const resetStatus = options.resetStatus;
24662
+ const addProvenance = options.provenance !== false;
24713
24663
  if (parentId) {
24714
24664
  const parentExists = existingTasks.some((t) => t.id === parentId);
24715
24665
  if (!parentExists) {
@@ -24778,7 +24728,7 @@ async function importTasksPackage(params) {
24778
24728
  existingTitles.add(remapped.title.toLowerCase());
24779
24729
  existingIds.add(remapped.id);
24780
24730
  }
24781
- if (params.dryRun) {
24731
+ if (options.dryRun) {
24782
24732
  return {
24783
24733
  imported: transformed.length,
24784
24734
  skipped: skipped.length,
@@ -24798,6 +24748,33 @@ async function importTasksPackage(params) {
24798
24748
  idRemap: idRemapJson
24799
24749
  };
24800
24750
  }
24751
+ async function importTasksPackage(params) {
24752
+ const { file: file2 } = params;
24753
+ try {
24754
+ await access2(file2, fsConstants2.R_OK);
24755
+ } catch {
24756
+ throw new Error(`Export file not found: ${file2}`);
24757
+ }
24758
+ const content = await readFile4(file2, "utf-8");
24759
+ let exportPkg;
24760
+ try {
24761
+ exportPkg = JSON.parse(content);
24762
+ } catch {
24763
+ throw new Error(`Invalid JSON in: ${file2}`);
24764
+ }
24765
+ return importFromPackage(exportPkg, {
24766
+ cwd: params.cwd,
24767
+ dryRun: params.dryRun,
24768
+ parent: params.parent,
24769
+ phase: params.phase,
24770
+ addLabel: params.addLabel,
24771
+ provenance: params.provenance,
24772
+ resetStatus: params.resetStatus,
24773
+ onConflict: params.onConflict,
24774
+ onMissingDep: params.onMissingDep === "placeholder" ? "strip" : params.onMissingDep,
24775
+ force: params.force
24776
+ });
24777
+ }
24801
24778
 
24802
24779
  // packages/core/src/adrs/index.ts
24803
24780
  var adrs_exports = {};
@@ -43851,6 +43828,7 @@ __export(nexus_exports, {
43851
43828
  checkPermissionDetail: () => checkPermissionDetail,
43852
43829
  criticalPath: () => criticalPath,
43853
43830
  discoverRelated: () => discoverRelated,
43831
+ executeTransfer: () => executeTransfer,
43854
43832
  extractKeywords: () => extractKeywords2,
43855
43833
  generateProjectHash: () => generateProjectHash,
43856
43834
  getCurrentProject: () => getCurrentProject,
@@ -43874,6 +43852,7 @@ __export(nexus_exports, {
43874
43852
  orphanDetection: () => orphanDetection,
43875
43853
  parseQuery: () => parseQuery,
43876
43854
  permissionLevel: () => permissionLevel,
43855
+ previewTransfer: () => previewTransfer,
43877
43856
  readRegistry: () => readRegistry,
43878
43857
  readRegistryRequired: () => readRegistryRequired,
43879
43858
  requirePermission: () => requirePermission,
@@ -44751,6 +44730,325 @@ async function syncGitignore(cwd) {
44751
44730
  return { updated: true, entriesCount: entries.length };
44752
44731
  }
44753
44732
 
44733
+ // packages/core/src/nexus/transfer.ts
44734
+ import { randomUUID as randomUUID5 } from "node:crypto";
44735
+ init_logger();
44736
+
44737
+ // packages/core/src/reconciliation/link-store.ts
44738
+ init_sqlite2();
44739
+ init_tasks_schema();
44740
+ import { randomUUID as randomUUID4 } from "node:crypto";
44741
+ import { and as and5, eq as eq8 } from "drizzle-orm";
44742
+ async function getLinksByProvider(providerId, cwd) {
44743
+ const db = await getDb(cwd);
44744
+ const rows = await db.select().from(externalTaskLinks).where(eq8(externalTaskLinks.providerId, providerId));
44745
+ return rows.map(rowToLink);
44746
+ }
44747
+ async function getLinkByExternalId(providerId, externalId, cwd) {
44748
+ const db = await getDb(cwd);
44749
+ const rows = await db.select().from(externalTaskLinks).where(
44750
+ and5(
44751
+ eq8(externalTaskLinks.providerId, providerId),
44752
+ eq8(externalTaskLinks.externalId, externalId)
44753
+ )
44754
+ );
44755
+ return rows.length > 0 ? rowToLink(rows[0]) : null;
44756
+ }
44757
+ async function getLinksByTaskId(taskId, cwd) {
44758
+ const db = await getDb(cwd);
44759
+ const rows = await db.select().from(externalTaskLinks).where(eq8(externalTaskLinks.taskId, taskId));
44760
+ return rows.map(rowToLink);
44761
+ }
44762
+ async function createLink(params, cwd) {
44763
+ const db = await getDb(cwd);
44764
+ const now = (/* @__PURE__ */ new Date()).toISOString();
44765
+ const id = randomUUID4();
44766
+ await db.insert(externalTaskLinks).values({
44767
+ id,
44768
+ taskId: params.taskId,
44769
+ providerId: params.providerId,
44770
+ externalId: params.externalId,
44771
+ externalUrl: params.externalUrl ?? null,
44772
+ externalTitle: params.externalTitle ?? null,
44773
+ linkType: params.linkType,
44774
+ syncDirection: params.syncDirection ?? "inbound",
44775
+ metadataJson: params.metadata ? JSON.stringify(params.metadata) : "{}",
44776
+ linkedAt: now,
44777
+ lastSyncAt: now
44778
+ });
44779
+ return {
44780
+ id,
44781
+ taskId: params.taskId,
44782
+ providerId: params.providerId,
44783
+ externalId: params.externalId,
44784
+ externalUrl: params.externalUrl ?? null,
44785
+ externalTitle: params.externalTitle ?? null,
44786
+ linkType: params.linkType,
44787
+ syncDirection: params.syncDirection ?? "inbound",
44788
+ metadata: params.metadata,
44789
+ linkedAt: now,
44790
+ lastSyncAt: now
44791
+ };
44792
+ }
44793
+ async function touchLink(linkId, updates, cwd) {
44794
+ const db = await getDb(cwd);
44795
+ const now = (/* @__PURE__ */ new Date()).toISOString();
44796
+ const values = { lastSyncAt: now };
44797
+ if (updates?.externalTitle !== void 0) {
44798
+ values.externalTitle = updates.externalTitle;
44799
+ }
44800
+ if (updates?.metadata !== void 0) {
44801
+ values.metadataJson = JSON.stringify(updates.metadata);
44802
+ }
44803
+ await db.update(externalTaskLinks).set(values).where(eq8(externalTaskLinks.id, linkId));
44804
+ }
44805
+ async function removeLinksByProvider(providerId, cwd) {
44806
+ const db = await getDb(cwd);
44807
+ const result = await db.delete(externalTaskLinks).where(eq8(externalTaskLinks.providerId, providerId));
44808
+ return Number(result.changes);
44809
+ }
44810
+ function rowToLink(row) {
44811
+ return {
44812
+ id: row.id,
44813
+ taskId: row.taskId,
44814
+ providerId: row.providerId,
44815
+ externalId: row.externalId,
44816
+ externalUrl: row.externalUrl,
44817
+ externalTitle: row.externalTitle,
44818
+ linkType: row.linkType,
44819
+ syncDirection: row.syncDirection,
44820
+ metadata: row.metadataJson ? JSON.parse(row.metadataJson) : void 0,
44821
+ linkedAt: row.linkedAt,
44822
+ lastSyncAt: row.lastSyncAt
44823
+ };
44824
+ }
44825
+
44826
+ // packages/core/src/nexus/transfer.ts
44827
+ init_brain_accessor();
44828
+ init_brain_sqlite();
44829
+ init_data_accessor();
44830
+ init_registry3();
44831
+ var log6 = getLogger("nexus:transfer");
44832
+ async function previewTransfer(params) {
44833
+ return executeTransferInternal({ ...params, dryRun: true });
44834
+ }
44835
+ async function executeTransfer(params) {
44836
+ return executeTransferInternal(params);
44837
+ }
44838
+ async function executeTransferInternal(params) {
44839
+ const {
44840
+ taskIds,
44841
+ sourceProject: sourceProjectRef,
44842
+ targetProject: targetProjectRef,
44843
+ mode = "copy",
44844
+ scope = "subtree",
44845
+ onConflict = "rename",
44846
+ onMissingDep = "strip",
44847
+ provenance = true,
44848
+ targetParent,
44849
+ transferBrain = false,
44850
+ dryRun = false
44851
+ } = params;
44852
+ if (!taskIds.length) {
44853
+ throw new Error("No task IDs specified for transfer");
44854
+ }
44855
+ const sourceProject = await nexusGetProject(sourceProjectRef);
44856
+ if (!sourceProject) {
44857
+ throw new Error(`Source project not found: ${sourceProjectRef}`);
44858
+ }
44859
+ const targetProject = await nexusGetProject(targetProjectRef);
44860
+ if (!targetProject) {
44861
+ throw new Error(`Target project not found: ${targetProjectRef}`);
44862
+ }
44863
+ if (sourceProject.hash === targetProject.hash) {
44864
+ throw new Error("Source and target projects must be different");
44865
+ }
44866
+ await requirePermission(sourceProject.hash, "read", "nexus.transfer");
44867
+ await requirePermission(targetProject.hash, "write", "nexus.transfer");
44868
+ const sourceAccessor = await getAccessor(sourceProject.path);
44869
+ const { tasks: allSourceTasks } = await sourceAccessor.queryTasks({});
44870
+ const exportPackages = [];
44871
+ for (const taskId of taskIds) {
44872
+ const pkg = scope === "subtree" ? exportSubtree(taskId, allSourceTasks, sourceProject.name) : exportSingle(taskId, allSourceTasks, sourceProject.name);
44873
+ if (!pkg) {
44874
+ throw new Error(`Task not found in source project: ${taskId}`);
44875
+ }
44876
+ exportPackages.push(pkg);
44877
+ }
44878
+ const seenIds = /* @__PURE__ */ new Set();
44879
+ const mergedTasks = [];
44880
+ for (const pkg of exportPackages) {
44881
+ for (const task of pkg.tasks) {
44882
+ if (!seenIds.has(task.id)) {
44883
+ seenIds.add(task.id);
44884
+ mergedTasks.push(task);
44885
+ }
44886
+ }
44887
+ }
44888
+ const mergedPkg = { ...exportPackages[0] };
44889
+ mergedPkg.tasks = mergedTasks;
44890
+ mergedPkg._meta = { ...mergedPkg._meta, taskCount: mergedTasks.length };
44891
+ const importResult = await importFromPackage(mergedPkg, {
44892
+ cwd: targetProject.path,
44893
+ dryRun,
44894
+ parent: targetParent,
44895
+ provenance,
44896
+ onConflict,
44897
+ onMissingDep
44898
+ });
44899
+ const entries = mergedTasks.map((t) => ({
44900
+ sourceId: t.id,
44901
+ targetId: importResult.idRemap[t.id] ?? t.id,
44902
+ title: t.title,
44903
+ type: t.type ?? "task"
44904
+ }));
44905
+ const manifest = {
44906
+ sourceProject: sourceProject.name,
44907
+ targetProject: targetProject.name,
44908
+ mode,
44909
+ scope,
44910
+ entries,
44911
+ idRemap: importResult.idRemap,
44912
+ brainObservationsTransferred: 0
44913
+ };
44914
+ const result = {
44915
+ dryRun,
44916
+ transferred: importResult.imported,
44917
+ skipped: importResult.skipped,
44918
+ archived: 0,
44919
+ linksCreated: 0,
44920
+ brainObservationsTransferred: 0,
44921
+ manifest
44922
+ };
44923
+ if (dryRun) {
44924
+ return result;
44925
+ }
44926
+ let linksCreated = 0;
44927
+ const targetAccessor = await getAccessor(targetProject.path);
44928
+ const { tasks: targetTasks } = await targetAccessor.queryTasks({});
44929
+ const targetTaskIds = new Set(targetTasks.map((t) => t.id));
44930
+ for (const entry of entries) {
44931
+ if (importResult.idRemap[entry.sourceId] && targetTaskIds.has(entry.targetId)) {
44932
+ await createLink(
44933
+ {
44934
+ taskId: entry.targetId,
44935
+ providerId: `nexus:${sourceProject.name}`,
44936
+ externalId: entry.sourceId,
44937
+ externalTitle: entry.title,
44938
+ linkType: "transferred",
44939
+ syncDirection: "inbound",
44940
+ metadata: {
44941
+ transferMode: mode,
44942
+ transferScope: scope,
44943
+ sourceProject: sourceProject.name,
44944
+ transferredAt: (/* @__PURE__ */ new Date()).toISOString()
44945
+ }
44946
+ },
44947
+ targetProject.path
44948
+ );
44949
+ linksCreated++;
44950
+ await createLink(
44951
+ {
44952
+ taskId: entry.sourceId,
44953
+ providerId: `nexus:${targetProject.name}`,
44954
+ externalId: entry.targetId,
44955
+ externalTitle: entry.title,
44956
+ linkType: "transferred",
44957
+ syncDirection: "outbound",
44958
+ metadata: {
44959
+ transferMode: mode,
44960
+ transferScope: scope,
44961
+ targetProject: targetProject.name,
44962
+ transferredAt: (/* @__PURE__ */ new Date()).toISOString()
44963
+ }
44964
+ },
44965
+ sourceProject.path
44966
+ );
44967
+ linksCreated++;
44968
+ }
44969
+ }
44970
+ result.linksCreated = linksCreated;
44971
+ try {
44972
+ const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
44973
+ const { nexusAuditLog: nexusAuditLog2 } = await Promise.resolve().then(() => (init_nexus_schema(), nexus_schema_exports));
44974
+ const db = await getNexusDb2();
44975
+ await db.insert(nexusAuditLog2).values({
44976
+ id: randomUUID5(),
44977
+ action: "transfer",
44978
+ projectHash: sourceProject.hash,
44979
+ projectId: sourceProject.projectId,
44980
+ domain: "nexus",
44981
+ operation: "transfer",
44982
+ success: 1,
44983
+ detailsJson: JSON.stringify({
44984
+ sourceProject: sourceProject.name,
44985
+ targetProject: targetProject.name,
44986
+ mode,
44987
+ scope,
44988
+ taskCount: result.transferred,
44989
+ idRemap: importResult.idRemap
44990
+ })
44991
+ });
44992
+ } catch (err) {
44993
+ log6.warn({ err }, "nexus transfer audit write failed");
44994
+ }
44995
+ if (mode === "move") {
44996
+ let archived = 0;
44997
+ for (const entry of entries) {
44998
+ if (importResult.idRemap[entry.sourceId]) {
44999
+ try {
45000
+ await sourceAccessor.archiveSingleTask(entry.sourceId, {
45001
+ archivedAt: (/* @__PURE__ */ new Date()).toISOString(),
45002
+ archiveReason: `Transferred to ${targetProject.name} as ${entry.targetId}`
45003
+ });
45004
+ archived++;
45005
+ } catch (err) {
45006
+ log6.warn({ err, taskId: entry.sourceId }, "failed to archive source task after transfer");
45007
+ }
45008
+ }
45009
+ }
45010
+ result.archived = archived;
45011
+ }
45012
+ if (transferBrain) {
45013
+ let brainTransferred = 0;
45014
+ try {
45015
+ const sourceBrainDb = await getBrainDb(sourceProject.path);
45016
+ const targetBrainDb = await getBrainDb(targetProject.path);
45017
+ const sourceBrain = new BrainDataAccessor(sourceBrainDb);
45018
+ const targetBrain = new BrainDataAccessor(targetBrainDb);
45019
+ for (const entry of entries) {
45020
+ if (!importResult.idRemap[entry.sourceId]) continue;
45021
+ const links = await sourceBrain.getLinksForTask(entry.sourceId);
45022
+ for (const link of links) {
45023
+ if (link.memoryType !== "observation") continue;
45024
+ const observation = await sourceBrain.getObservation(link.memoryId);
45025
+ if (!observation) continue;
45026
+ const newObsId = `O-${randomUUID5().slice(0, 8)}`;
45027
+ await targetBrain.addObservation({
45028
+ ...observation,
45029
+ id: newObsId,
45030
+ createdAt: observation.createdAt,
45031
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19)
45032
+ });
45033
+ await targetBrain.addLink({
45034
+ memoryType: "observation",
45035
+ memoryId: newObsId,
45036
+ taskId: entry.targetId,
45037
+ linkType: "applies_to",
45038
+ createdAt: (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19)
45039
+ });
45040
+ brainTransferred++;
45041
+ }
45042
+ }
45043
+ } catch (err) {
45044
+ log6.warn({ err }, "brain observation transfer failed");
45045
+ }
45046
+ result.brainObservationsTransferred = brainTransferred;
45047
+ result.manifest.brainObservationsTransferred = brainTransferred;
45048
+ }
45049
+ return result;
45050
+ }
45051
+
44754
45052
  // packages/core/src/observability/index.ts
44755
45053
  var observability_exports = {};
44756
45054
  __export(observability_exports, {
@@ -46149,95 +46447,6 @@ __export(reconciliation_exports, {
46149
46447
  touchLink: () => touchLink
46150
46448
  });
46151
46449
 
46152
- // packages/core/src/reconciliation/link-store.ts
46153
- init_sqlite2();
46154
- init_tasks_schema();
46155
- import { randomUUID as randomUUID4 } from "node:crypto";
46156
- import { and as and5, eq as eq8 } from "drizzle-orm";
46157
- async function getLinksByProvider(providerId, cwd) {
46158
- const db = await getDb(cwd);
46159
- const rows = await db.select().from(externalTaskLinks).where(eq8(externalTaskLinks.providerId, providerId));
46160
- return rows.map(rowToLink);
46161
- }
46162
- async function getLinkByExternalId(providerId, externalId, cwd) {
46163
- const db = await getDb(cwd);
46164
- const rows = await db.select().from(externalTaskLinks).where(
46165
- and5(
46166
- eq8(externalTaskLinks.providerId, providerId),
46167
- eq8(externalTaskLinks.externalId, externalId)
46168
- )
46169
- );
46170
- return rows.length > 0 ? rowToLink(rows[0]) : null;
46171
- }
46172
- async function getLinksByTaskId(taskId, cwd) {
46173
- const db = await getDb(cwd);
46174
- const rows = await db.select().from(externalTaskLinks).where(eq8(externalTaskLinks.taskId, taskId));
46175
- return rows.map(rowToLink);
46176
- }
46177
- async function createLink(params, cwd) {
46178
- const db = await getDb(cwd);
46179
- const now = (/* @__PURE__ */ new Date()).toISOString();
46180
- const id = randomUUID4();
46181
- await db.insert(externalTaskLinks).values({
46182
- id,
46183
- taskId: params.taskId,
46184
- providerId: params.providerId,
46185
- externalId: params.externalId,
46186
- externalUrl: params.externalUrl ?? null,
46187
- externalTitle: params.externalTitle ?? null,
46188
- linkType: params.linkType,
46189
- syncDirection: params.syncDirection ?? "inbound",
46190
- metadataJson: params.metadata ? JSON.stringify(params.metadata) : "{}",
46191
- linkedAt: now,
46192
- lastSyncAt: now
46193
- });
46194
- return {
46195
- id,
46196
- taskId: params.taskId,
46197
- providerId: params.providerId,
46198
- externalId: params.externalId,
46199
- externalUrl: params.externalUrl ?? null,
46200
- externalTitle: params.externalTitle ?? null,
46201
- linkType: params.linkType,
46202
- syncDirection: params.syncDirection ?? "inbound",
46203
- metadata: params.metadata,
46204
- linkedAt: now,
46205
- lastSyncAt: now
46206
- };
46207
- }
46208
- async function touchLink(linkId, updates, cwd) {
46209
- const db = await getDb(cwd);
46210
- const now = (/* @__PURE__ */ new Date()).toISOString();
46211
- const values = { lastSyncAt: now };
46212
- if (updates?.externalTitle !== void 0) {
46213
- values.externalTitle = updates.externalTitle;
46214
- }
46215
- if (updates?.metadata !== void 0) {
46216
- values.metadataJson = JSON.stringify(updates.metadata);
46217
- }
46218
- await db.update(externalTaskLinks).set(values).where(eq8(externalTaskLinks.id, linkId));
46219
- }
46220
- async function removeLinksByProvider(providerId, cwd) {
46221
- const db = await getDb(cwd);
46222
- const result = await db.delete(externalTaskLinks).where(eq8(externalTaskLinks.providerId, providerId));
46223
- return Number(result.changes);
46224
- }
46225
- function rowToLink(row) {
46226
- return {
46227
- id: row.id,
46228
- taskId: row.taskId,
46229
- providerId: row.providerId,
46230
- externalId: row.externalId,
46231
- externalUrl: row.externalUrl,
46232
- externalTitle: row.externalTitle,
46233
- linkType: row.linkType,
46234
- syncDirection: row.syncDirection,
46235
- metadata: row.metadataJson ? JSON.parse(row.metadataJson) : void 0,
46236
- linkedAt: row.linkedAt,
46237
- lastSyncAt: row.lastSyncAt
46238
- };
46239
- }
46240
-
46241
46450
  // packages/core/src/reconciliation/reconciliation-engine.ts
46242
46451
  init_data_accessor();
46243
46452
  init_add();
@@ -47268,8 +47477,8 @@ var PLATFORM_PATHS = {
47268
47477
  "gitlab-ci": ".gitlab-ci.yml",
47269
47478
  circleci: ".circleci/config.yml"
47270
47479
  };
47271
- function getPlatformPath(platform3) {
47272
- return PLATFORM_PATHS[platform3];
47480
+ function getPlatformPath(platform5) {
47481
+ return PLATFORM_PATHS[platform5];
47273
47482
  }
47274
47483
  function detectCIPlatform(projectDir) {
47275
47484
  const dir = projectDir ?? process.cwd();
@@ -47363,10 +47572,10 @@ workflows:
47363
47572
  only: /^v.*/
47364
47573
  `;
47365
47574
  }
47366
- function generateCIConfig(platform3, cwd) {
47575
+ function generateCIConfig(platform5, cwd) {
47367
47576
  const releaseConfig = loadReleaseConfig(cwd);
47368
47577
  const gates = releaseConfig.gates.map((g) => ({ name: g.name, command: g.command }));
47369
- switch (platform3) {
47578
+ switch (platform5) {
47370
47579
  case "github-actions":
47371
47580
  return generateGitHubActions({ gates });
47372
47581
  case "gitlab-ci":
@@ -47375,10 +47584,10 @@ function generateCIConfig(platform3, cwd) {
47375
47584
  return generateCircleCI({ gates });
47376
47585
  }
47377
47586
  }
47378
- function writeCIConfig(platform3, options = {}) {
47587
+ function writeCIConfig(platform5, options = {}) {
47379
47588
  const projectDir = options.projectDir ?? process.cwd();
47380
- const outputPath = join63(projectDir, getPlatformPath(platform3));
47381
- const content = generateCIConfig(platform3, projectDir);
47589
+ const outputPath = join63(projectDir, getPlatformPath(platform5));
47590
+ const content = generateCIConfig(platform5, projectDir);
47382
47591
  if (options.dryRun) {
47383
47592
  return { action: "would_write", path: outputPath, content };
47384
47593
  }
@@ -47386,9 +47595,9 @@ function writeCIConfig(platform3, options = {}) {
47386
47595
  writeFileSync6(outputPath, content, "utf-8");
47387
47596
  return { action: "wrote", path: outputPath, content };
47388
47597
  }
47389
- function validateCIConfig(platform3, projectDir) {
47598
+ function validateCIConfig(platform5, projectDir) {
47390
47599
  const dir = projectDir ?? process.cwd();
47391
- const configPath = join63(dir, getPlatformPath(platform3));
47600
+ const configPath = join63(dir, getPlatformPath(platform5));
47392
47601
  if (!existsSync59(configPath)) {
47393
47602
  return { valid: false, exists: false, errors: ["Config file not found"] };
47394
47603
  }
@@ -48930,239 +49139,1463 @@ __export(routing_exports, {
48930
49139
  var CAPABILITY_MATRIX = [
48931
49140
  // === Tasks Domain ===
48932
49141
  // Query operations
48933
- { domain: "tasks", operation: "show", gateway: "query", mode: "native" },
48934
- { domain: "tasks", operation: "list", gateway: "query", mode: "native" },
48935
- { domain: "tasks", operation: "find", gateway: "query", mode: "native" },
48936
- { domain: "tasks", operation: "tree", gateway: "query", mode: "native" },
48937
- { domain: "tasks", operation: "blockers", gateway: "query", mode: "native" },
48938
- { domain: "tasks", operation: "depends", gateway: "query", mode: "native" },
48939
- { domain: "tasks", operation: "analyze", gateway: "query", mode: "native" },
48940
- { domain: "tasks", operation: "next", gateway: "query", mode: "native" },
48941
- { domain: "tasks", operation: "plan", gateway: "query", mode: "native" },
48942
- { domain: "tasks", operation: "relates", gateway: "query", mode: "native" },
48943
- { domain: "tasks", operation: "complexity.estimate", gateway: "query", mode: "native" },
48944
- { domain: "tasks", operation: "history", gateway: "query", mode: "native" },
48945
- { domain: "tasks", operation: "current", gateway: "query", mode: "native" },
48946
- { domain: "tasks", operation: "label.list", gateway: "query", mode: "native" },
49142
+ { domain: "tasks", operation: "show", gateway: "query", mode: "native", preferredChannel: "mcp" },
49143
+ { domain: "tasks", operation: "list", gateway: "query", mode: "native", preferredChannel: "mcp" },
49144
+ { domain: "tasks", operation: "find", gateway: "query", mode: "native", preferredChannel: "mcp" },
49145
+ {
49146
+ domain: "tasks",
49147
+ operation: "tree",
49148
+ gateway: "query",
49149
+ mode: "native",
49150
+ preferredChannel: "either"
49151
+ },
49152
+ {
49153
+ domain: "tasks",
49154
+ operation: "blockers",
49155
+ gateway: "query",
49156
+ mode: "native",
49157
+ preferredChannel: "either"
49158
+ },
49159
+ {
49160
+ domain: "tasks",
49161
+ operation: "depends",
49162
+ gateway: "query",
49163
+ mode: "native",
49164
+ preferredChannel: "either"
49165
+ },
49166
+ {
49167
+ domain: "tasks",
49168
+ operation: "analyze",
49169
+ gateway: "query",
49170
+ mode: "native",
49171
+ preferredChannel: "either"
49172
+ },
49173
+ { domain: "tasks", operation: "next", gateway: "query", mode: "native", preferredChannel: "mcp" },
49174
+ { domain: "tasks", operation: "plan", gateway: "query", mode: "native", preferredChannel: "mcp" },
49175
+ {
49176
+ domain: "tasks",
49177
+ operation: "relates",
49178
+ gateway: "query",
49179
+ mode: "native",
49180
+ preferredChannel: "either"
49181
+ },
49182
+ {
49183
+ domain: "tasks",
49184
+ operation: "complexity.estimate",
49185
+ gateway: "query",
49186
+ mode: "native",
49187
+ preferredChannel: "either"
49188
+ },
49189
+ {
49190
+ domain: "tasks",
49191
+ operation: "history",
49192
+ gateway: "query",
49193
+ mode: "native",
49194
+ preferredChannel: "either"
49195
+ },
49196
+ {
49197
+ domain: "tasks",
49198
+ operation: "current",
49199
+ gateway: "query",
49200
+ mode: "native",
49201
+ preferredChannel: "mcp"
49202
+ },
49203
+ {
49204
+ domain: "tasks",
49205
+ operation: "label.list",
49206
+ gateway: "query",
49207
+ mode: "native",
49208
+ preferredChannel: "either"
49209
+ },
48947
49210
  // Mutate operations
48948
- { domain: "tasks", operation: "add", gateway: "mutate", mode: "native" },
48949
- { domain: "tasks", operation: "update", gateway: "mutate", mode: "native" },
48950
- { domain: "tasks", operation: "complete", gateway: "mutate", mode: "native" },
48951
- { domain: "tasks", operation: "cancel", gateway: "mutate", mode: "native" },
48952
- { domain: "tasks", operation: "delete", gateway: "mutate", mode: "native" },
48953
- { domain: "tasks", operation: "archive", gateway: "mutate", mode: "native" },
48954
- { domain: "tasks", operation: "restore", gateway: "mutate", mode: "native" },
48955
- { domain: "tasks", operation: "reparent", gateway: "mutate", mode: "native" },
48956
- { domain: "tasks", operation: "reorder", gateway: "mutate", mode: "native" },
48957
- { domain: "tasks", operation: "relates.add", gateway: "mutate", mode: "native" },
48958
- { domain: "tasks", operation: "start", gateway: "mutate", mode: "native" },
48959
- { domain: "tasks", operation: "stop", gateway: "mutate", mode: "native" },
49211
+ { domain: "tasks", operation: "add", gateway: "mutate", mode: "native", preferredChannel: "mcp" },
49212
+ {
49213
+ domain: "tasks",
49214
+ operation: "update",
49215
+ gateway: "mutate",
49216
+ mode: "native",
49217
+ preferredChannel: "mcp"
49218
+ },
49219
+ {
49220
+ domain: "tasks",
49221
+ operation: "complete",
49222
+ gateway: "mutate",
49223
+ mode: "native",
49224
+ preferredChannel: "mcp"
49225
+ },
49226
+ {
49227
+ domain: "tasks",
49228
+ operation: "cancel",
49229
+ gateway: "mutate",
49230
+ mode: "native",
49231
+ preferredChannel: "either"
49232
+ },
49233
+ {
49234
+ domain: "tasks",
49235
+ operation: "delete",
49236
+ gateway: "mutate",
49237
+ mode: "native",
49238
+ preferredChannel: "either"
49239
+ },
49240
+ {
49241
+ domain: "tasks",
49242
+ operation: "archive",
49243
+ gateway: "mutate",
49244
+ mode: "native",
49245
+ preferredChannel: "either"
49246
+ },
49247
+ {
49248
+ domain: "tasks",
49249
+ operation: "restore",
49250
+ gateway: "mutate",
49251
+ mode: "native",
49252
+ preferredChannel: "either"
49253
+ },
49254
+ {
49255
+ domain: "tasks",
49256
+ operation: "reparent",
49257
+ gateway: "mutate",
49258
+ mode: "native",
49259
+ preferredChannel: "either"
49260
+ },
49261
+ {
49262
+ domain: "tasks",
49263
+ operation: "reorder",
49264
+ gateway: "mutate",
49265
+ mode: "native",
49266
+ preferredChannel: "either"
49267
+ },
49268
+ {
49269
+ domain: "tasks",
49270
+ operation: "relates.add",
49271
+ gateway: "mutate",
49272
+ mode: "native",
49273
+ preferredChannel: "either"
49274
+ },
49275
+ {
49276
+ domain: "tasks",
49277
+ operation: "start",
49278
+ gateway: "mutate",
49279
+ mode: "native",
49280
+ preferredChannel: "mcp"
49281
+ },
49282
+ {
49283
+ domain: "tasks",
49284
+ operation: "stop",
49285
+ gateway: "mutate",
49286
+ mode: "native",
49287
+ preferredChannel: "mcp"
49288
+ },
48960
49289
  // Sync sub-domain (provider-agnostic task reconciliation)
48961
- { domain: "tasks", operation: "sync.reconcile", gateway: "mutate", mode: "native" },
48962
- { domain: "tasks", operation: "sync.links", gateway: "query", mode: "native" },
48963
- { domain: "tasks", operation: "sync.links.remove", gateway: "mutate", mode: "native" },
49290
+ {
49291
+ domain: "tasks",
49292
+ operation: "sync.reconcile",
49293
+ gateway: "mutate",
49294
+ mode: "native",
49295
+ preferredChannel: "either"
49296
+ },
49297
+ {
49298
+ domain: "tasks",
49299
+ operation: "sync.links",
49300
+ gateway: "query",
49301
+ mode: "native",
49302
+ preferredChannel: "either"
49303
+ },
49304
+ {
49305
+ domain: "tasks",
49306
+ operation: "sync.links.remove",
49307
+ gateway: "mutate",
49308
+ mode: "native",
49309
+ preferredChannel: "either"
49310
+ },
48964
49311
  // === Session Domain ===
48965
49312
  // Query operations
48966
- { domain: "session", operation: "status", gateway: "query", mode: "native" },
48967
- { domain: "session", operation: "list", gateway: "query", mode: "native" },
48968
- { domain: "session", operation: "show", gateway: "query", mode: "native" },
48969
- { domain: "session", operation: "decision.log", gateway: "query", mode: "native" },
48970
- { domain: "session", operation: "context.drift", gateway: "query", mode: "native" },
48971
- { domain: "session", operation: "handoff.show", gateway: "query", mode: "native" },
48972
- { domain: "session", operation: "briefing.show", gateway: "query", mode: "native" },
48973
- { domain: "session", operation: "find", gateway: "query", mode: "native" },
49313
+ {
49314
+ domain: "session",
49315
+ operation: "status",
49316
+ gateway: "query",
49317
+ mode: "native",
49318
+ preferredChannel: "mcp"
49319
+ },
49320
+ {
49321
+ domain: "session",
49322
+ operation: "list",
49323
+ gateway: "query",
49324
+ mode: "native",
49325
+ preferredChannel: "either"
49326
+ },
49327
+ {
49328
+ domain: "session",
49329
+ operation: "show",
49330
+ gateway: "query",
49331
+ mode: "native",
49332
+ preferredChannel: "either"
49333
+ },
49334
+ {
49335
+ domain: "session",
49336
+ operation: "decision.log",
49337
+ gateway: "query",
49338
+ mode: "native",
49339
+ preferredChannel: "either"
49340
+ },
49341
+ {
49342
+ domain: "session",
49343
+ operation: "context.drift",
49344
+ gateway: "query",
49345
+ mode: "native",
49346
+ preferredChannel: "either"
49347
+ },
49348
+ {
49349
+ domain: "session",
49350
+ operation: "handoff.show",
49351
+ gateway: "query",
49352
+ mode: "native",
49353
+ preferredChannel: "mcp"
49354
+ },
49355
+ {
49356
+ domain: "session",
49357
+ operation: "briefing.show",
49358
+ gateway: "query",
49359
+ mode: "native",
49360
+ preferredChannel: "mcp"
49361
+ },
49362
+ {
49363
+ domain: "session",
49364
+ operation: "find",
49365
+ gateway: "query",
49366
+ mode: "native",
49367
+ preferredChannel: "either"
49368
+ },
48974
49369
  // Mutate operations
48975
- { domain: "session", operation: "start", gateway: "mutate", mode: "native" },
48976
- { domain: "session", operation: "end", gateway: "mutate", mode: "native" },
48977
- { domain: "session", operation: "resume", gateway: "mutate", mode: "native" },
48978
- { domain: "session", operation: "suspend", gateway: "mutate", mode: "native" },
48979
- { domain: "session", operation: "gc", gateway: "mutate", mode: "native" },
48980
- { domain: "session", operation: "record.decision", gateway: "mutate", mode: "native" },
48981
- { domain: "session", operation: "record.assumption", gateway: "mutate", mode: "native" },
49370
+ {
49371
+ domain: "session",
49372
+ operation: "start",
49373
+ gateway: "mutate",
49374
+ mode: "native",
49375
+ preferredChannel: "mcp"
49376
+ },
49377
+ {
49378
+ domain: "session",
49379
+ operation: "end",
49380
+ gateway: "mutate",
49381
+ mode: "native",
49382
+ preferredChannel: "mcp"
49383
+ },
49384
+ {
49385
+ domain: "session",
49386
+ operation: "resume",
49387
+ gateway: "mutate",
49388
+ mode: "native",
49389
+ preferredChannel: "either"
49390
+ },
49391
+ {
49392
+ domain: "session",
49393
+ operation: "suspend",
49394
+ gateway: "mutate",
49395
+ mode: "native",
49396
+ preferredChannel: "either"
49397
+ },
49398
+ {
49399
+ domain: "session",
49400
+ operation: "gc",
49401
+ gateway: "mutate",
49402
+ mode: "native",
49403
+ preferredChannel: "either"
49404
+ },
49405
+ {
49406
+ domain: "session",
49407
+ operation: "record.decision",
49408
+ gateway: "mutate",
49409
+ mode: "native",
49410
+ preferredChannel: "either"
49411
+ },
49412
+ {
49413
+ domain: "session",
49414
+ operation: "record.assumption",
49415
+ gateway: "mutate",
49416
+ mode: "native",
49417
+ preferredChannel: "either"
49418
+ },
48982
49419
  // === Admin Domain ===
48983
49420
  // Query operations
48984
- { domain: "admin", operation: "version", gateway: "query", mode: "native" },
48985
- { domain: "admin", operation: "health", gateway: "query", mode: "native" },
48986
- { domain: "admin", operation: "config.show", gateway: "query", mode: "native" },
48987
- { domain: "admin", operation: "stats", gateway: "query", mode: "native" },
48988
- { domain: "admin", operation: "context", gateway: "query", mode: "native" },
48989
- { domain: "admin", operation: "runtime", gateway: "query", mode: "native" },
48990
- { domain: "admin", operation: "job", gateway: "query", mode: "native" },
48991
- { domain: "admin", operation: "dash", gateway: "query", mode: "native" },
48992
- { domain: "admin", operation: "log", gateway: "query", mode: "native" },
48993
- { domain: "admin", operation: "sequence", gateway: "query", mode: "native" },
48994
- { domain: "admin", operation: "help", gateway: "query", mode: "native" },
48995
- { domain: "admin", operation: "token", gateway: "query", mode: "native" },
48996
- { domain: "admin", operation: "export", gateway: "query", mode: "native" },
48997
- { domain: "admin", operation: "adr.show", gateway: "query", mode: "native" },
48998
- { domain: "admin", operation: "adr.find", gateway: "query", mode: "native" },
49421
+ {
49422
+ domain: "admin",
49423
+ operation: "version",
49424
+ gateway: "query",
49425
+ mode: "native",
49426
+ preferredChannel: "either"
49427
+ },
49428
+ {
49429
+ domain: "admin",
49430
+ operation: "health",
49431
+ gateway: "query",
49432
+ mode: "native",
49433
+ preferredChannel: "either"
49434
+ },
49435
+ {
49436
+ domain: "admin",
49437
+ operation: "config.show",
49438
+ gateway: "query",
49439
+ mode: "native",
49440
+ preferredChannel: "either"
49441
+ },
49442
+ {
49443
+ domain: "admin",
49444
+ operation: "stats",
49445
+ gateway: "query",
49446
+ mode: "native",
49447
+ preferredChannel: "either"
49448
+ },
49449
+ {
49450
+ domain: "admin",
49451
+ operation: "context",
49452
+ gateway: "query",
49453
+ mode: "native",
49454
+ preferredChannel: "either"
49455
+ },
49456
+ {
49457
+ domain: "admin",
49458
+ operation: "runtime",
49459
+ gateway: "query",
49460
+ mode: "native",
49461
+ preferredChannel: "either"
49462
+ },
49463
+ {
49464
+ domain: "admin",
49465
+ operation: "job",
49466
+ gateway: "query",
49467
+ mode: "native",
49468
+ preferredChannel: "either"
49469
+ },
49470
+ { domain: "admin", operation: "dash", gateway: "query", mode: "native", preferredChannel: "mcp" },
49471
+ {
49472
+ domain: "admin",
49473
+ operation: "log",
49474
+ gateway: "query",
49475
+ mode: "native",
49476
+ preferredChannel: "either"
49477
+ },
49478
+ {
49479
+ domain: "admin",
49480
+ operation: "sequence",
49481
+ gateway: "query",
49482
+ mode: "native",
49483
+ preferredChannel: "either"
49484
+ },
49485
+ { domain: "admin", operation: "help", gateway: "query", mode: "native", preferredChannel: "mcp" },
49486
+ {
49487
+ domain: "admin",
49488
+ operation: "token",
49489
+ gateway: "query",
49490
+ mode: "native",
49491
+ preferredChannel: "either"
49492
+ },
49493
+ {
49494
+ domain: "admin",
49495
+ operation: "export",
49496
+ gateway: "query",
49497
+ mode: "native",
49498
+ preferredChannel: "either"
49499
+ },
49500
+ {
49501
+ domain: "admin",
49502
+ operation: "adr.show",
49503
+ gateway: "query",
49504
+ mode: "native",
49505
+ preferredChannel: "either"
49506
+ },
49507
+ {
49508
+ domain: "admin",
49509
+ operation: "adr.find",
49510
+ gateway: "query",
49511
+ mode: "native",
49512
+ preferredChannel: "either"
49513
+ },
49514
+ { domain: "admin", operation: "map", gateway: "query", mode: "native", preferredChannel: "mcp" },
48999
49515
  // Mutate operations
49000
- { domain: "admin", operation: "init", gateway: "mutate", mode: "native" },
49001
- { domain: "admin", operation: "config.set", gateway: "mutate", mode: "native" },
49002
- { domain: "admin", operation: "backup", gateway: "mutate", mode: "native" },
49003
- { domain: "admin", operation: "migrate", gateway: "mutate", mode: "native" },
49004
- { domain: "admin", operation: "cleanup", gateway: "mutate", mode: "native" },
49005
- { domain: "admin", operation: "safestop", gateway: "mutate", mode: "native" },
49006
- { domain: "admin", operation: "inject.generate", gateway: "mutate", mode: "native" },
49007
- { domain: "admin", operation: "job.cancel", gateway: "mutate", mode: "native" },
49008
- { domain: "admin", operation: "install.global", gateway: "mutate", mode: "native" },
49009
- { domain: "admin", operation: "token", gateway: "mutate", mode: "native" },
49010
- { domain: "admin", operation: "health", gateway: "mutate", mode: "native" },
49011
- { domain: "admin", operation: "detect", gateway: "mutate", mode: "native" },
49012
- { domain: "admin", operation: "import", gateway: "mutate", mode: "native" },
49013
- { domain: "admin", operation: "context.inject", gateway: "mutate", mode: "native" },
49014
- { domain: "admin", operation: "adr.sync", gateway: "mutate", mode: "native" },
49516
+ {
49517
+ domain: "admin",
49518
+ operation: "init",
49519
+ gateway: "mutate",
49520
+ mode: "native",
49521
+ preferredChannel: "either"
49522
+ },
49523
+ {
49524
+ domain: "admin",
49525
+ operation: "config.set",
49526
+ gateway: "mutate",
49527
+ mode: "native",
49528
+ preferredChannel: "either"
49529
+ },
49530
+ {
49531
+ domain: "admin",
49532
+ operation: "backup",
49533
+ gateway: "mutate",
49534
+ mode: "native",
49535
+ preferredChannel: "either"
49536
+ },
49537
+ {
49538
+ domain: "admin",
49539
+ operation: "migrate",
49540
+ gateway: "mutate",
49541
+ mode: "native",
49542
+ preferredChannel: "either"
49543
+ },
49544
+ {
49545
+ domain: "admin",
49546
+ operation: "cleanup",
49547
+ gateway: "mutate",
49548
+ mode: "native",
49549
+ preferredChannel: "either"
49550
+ },
49551
+ {
49552
+ domain: "admin",
49553
+ operation: "safestop",
49554
+ gateway: "mutate",
49555
+ mode: "native",
49556
+ preferredChannel: "either"
49557
+ },
49558
+ {
49559
+ domain: "admin",
49560
+ operation: "inject.generate",
49561
+ gateway: "mutate",
49562
+ mode: "native",
49563
+ preferredChannel: "either"
49564
+ },
49565
+ {
49566
+ domain: "admin",
49567
+ operation: "job.cancel",
49568
+ gateway: "mutate",
49569
+ mode: "native",
49570
+ preferredChannel: "either"
49571
+ },
49572
+ {
49573
+ domain: "admin",
49574
+ operation: "install.global",
49575
+ gateway: "mutate",
49576
+ mode: "native",
49577
+ preferredChannel: "either"
49578
+ },
49579
+ {
49580
+ domain: "admin",
49581
+ operation: "token",
49582
+ gateway: "mutate",
49583
+ mode: "native",
49584
+ preferredChannel: "either"
49585
+ },
49586
+ {
49587
+ domain: "admin",
49588
+ operation: "health",
49589
+ gateway: "mutate",
49590
+ mode: "native",
49591
+ preferredChannel: "either"
49592
+ },
49593
+ {
49594
+ domain: "admin",
49595
+ operation: "detect",
49596
+ gateway: "mutate",
49597
+ mode: "native",
49598
+ preferredChannel: "either"
49599
+ },
49600
+ {
49601
+ domain: "admin",
49602
+ operation: "import",
49603
+ gateway: "mutate",
49604
+ mode: "native",
49605
+ preferredChannel: "either"
49606
+ },
49607
+ {
49608
+ domain: "admin",
49609
+ operation: "context.inject",
49610
+ gateway: "mutate",
49611
+ mode: "native",
49612
+ preferredChannel: "either"
49613
+ },
49614
+ {
49615
+ domain: "admin",
49616
+ operation: "adr.sync",
49617
+ gateway: "mutate",
49618
+ mode: "native",
49619
+ preferredChannel: "either"
49620
+ },
49621
+ {
49622
+ domain: "admin",
49623
+ operation: "map",
49624
+ gateway: "mutate",
49625
+ mode: "native",
49626
+ preferredChannel: "either"
49627
+ },
49015
49628
  // === Check Domain ===
49016
49629
  // Query operations
49017
- { domain: "check", operation: "schema", gateway: "query", mode: "native" },
49018
- { domain: "check", operation: "protocol", gateway: "query", mode: "native" },
49019
- { domain: "check", operation: "task", gateway: "query", mode: "native" },
49020
- { domain: "check", operation: "manifest", gateway: "query", mode: "native" },
49021
- { domain: "check", operation: "output", gateway: "query", mode: "native" },
49022
- { domain: "check", operation: "compliance.summary", gateway: "query", mode: "native" },
49023
- { domain: "check", operation: "test", gateway: "query", mode: "native" },
49024
- { domain: "check", operation: "coherence", gateway: "query", mode: "native" },
49025
- { domain: "check", operation: "gate.status", gateway: "query", mode: "native" },
49026
- { domain: "check", operation: "archive.stats", gateway: "query", mode: "native" },
49027
- { domain: "check", operation: "grade", gateway: "query", mode: "native" },
49028
- { domain: "check", operation: "grade.list", gateway: "query", mode: "native" },
49029
- { domain: "check", operation: "chain.validate", gateway: "query", mode: "native" },
49630
+ {
49631
+ domain: "check",
49632
+ operation: "schema",
49633
+ gateway: "query",
49634
+ mode: "native",
49635
+ preferredChannel: "either"
49636
+ },
49637
+ {
49638
+ domain: "check",
49639
+ operation: "protocol",
49640
+ gateway: "query",
49641
+ mode: "native",
49642
+ preferredChannel: "either"
49643
+ },
49644
+ {
49645
+ domain: "check",
49646
+ operation: "task",
49647
+ gateway: "query",
49648
+ mode: "native",
49649
+ preferredChannel: "either"
49650
+ },
49651
+ {
49652
+ domain: "check",
49653
+ operation: "manifest",
49654
+ gateway: "query",
49655
+ mode: "native",
49656
+ preferredChannel: "either"
49657
+ },
49658
+ {
49659
+ domain: "check",
49660
+ operation: "output",
49661
+ gateway: "query",
49662
+ mode: "native",
49663
+ preferredChannel: "either"
49664
+ },
49665
+ {
49666
+ domain: "check",
49667
+ operation: "compliance.summary",
49668
+ gateway: "query",
49669
+ mode: "native",
49670
+ preferredChannel: "mcp"
49671
+ },
49672
+ {
49673
+ domain: "check",
49674
+ operation: "test",
49675
+ gateway: "query",
49676
+ mode: "native",
49677
+ preferredChannel: "either"
49678
+ },
49679
+ {
49680
+ domain: "check",
49681
+ operation: "coherence",
49682
+ gateway: "query",
49683
+ mode: "native",
49684
+ preferredChannel: "either"
49685
+ },
49686
+ {
49687
+ domain: "check",
49688
+ operation: "gate.status",
49689
+ gateway: "query",
49690
+ mode: "native",
49691
+ preferredChannel: "either"
49692
+ },
49693
+ {
49694
+ domain: "check",
49695
+ operation: "archive.stats",
49696
+ gateway: "query",
49697
+ mode: "native",
49698
+ preferredChannel: "either"
49699
+ },
49700
+ {
49701
+ domain: "check",
49702
+ operation: "grade",
49703
+ gateway: "query",
49704
+ mode: "native",
49705
+ preferredChannel: "either"
49706
+ },
49707
+ {
49708
+ domain: "check",
49709
+ operation: "grade.list",
49710
+ gateway: "query",
49711
+ mode: "native",
49712
+ preferredChannel: "either"
49713
+ },
49714
+ {
49715
+ domain: "check",
49716
+ operation: "chain.validate",
49717
+ gateway: "query",
49718
+ mode: "native",
49719
+ preferredChannel: "either"
49720
+ },
49030
49721
  // Mutate operations
49031
- { domain: "check", operation: "compliance.record", gateway: "mutate", mode: "native" },
49032
- { domain: "check", operation: "test.run", gateway: "mutate", mode: "native" },
49033
- { domain: "check", operation: "gate.set", gateway: "mutate", mode: "native" },
49722
+ {
49723
+ domain: "check",
49724
+ operation: "compliance.record",
49725
+ gateway: "mutate",
49726
+ mode: "native",
49727
+ preferredChannel: "mcp"
49728
+ },
49729
+ {
49730
+ domain: "check",
49731
+ operation: "test.run",
49732
+ gateway: "mutate",
49733
+ mode: "native",
49734
+ preferredChannel: "either"
49735
+ },
49736
+ {
49737
+ domain: "check",
49738
+ operation: "gate.set",
49739
+ gateway: "mutate",
49740
+ mode: "native",
49741
+ preferredChannel: "either"
49742
+ },
49743
+ {
49744
+ domain: "check",
49745
+ operation: "compliance.sync",
49746
+ gateway: "mutate",
49747
+ mode: "native",
49748
+ preferredChannel: "either"
49749
+ },
49034
49750
  // === Orchestrate Domain ===
49035
49751
  // Query operations
49036
- { domain: "orchestrate", operation: "status", gateway: "query", mode: "native" },
49037
- { domain: "orchestrate", operation: "next", gateway: "query", mode: "native" },
49038
- { domain: "orchestrate", operation: "ready", gateway: "query", mode: "native" },
49039
- { domain: "orchestrate", operation: "analyze", gateway: "query", mode: "native" },
49040
- { domain: "orchestrate", operation: "context", gateway: "query", mode: "native" },
49041
- { domain: "orchestrate", operation: "waves", gateway: "query", mode: "native" },
49042
- { domain: "orchestrate", operation: "bootstrap", gateway: "query", mode: "native" },
49043
- { domain: "orchestrate", operation: "unblock.opportunities", gateway: "query", mode: "native" },
49044
- { domain: "orchestrate", operation: "tessera.list", gateway: "query", mode: "native" },
49752
+ {
49753
+ domain: "orchestrate",
49754
+ operation: "status",
49755
+ gateway: "query",
49756
+ mode: "native",
49757
+ preferredChannel: "either"
49758
+ },
49759
+ {
49760
+ domain: "orchestrate",
49761
+ operation: "next",
49762
+ gateway: "query",
49763
+ mode: "native",
49764
+ preferredChannel: "either"
49765
+ },
49766
+ {
49767
+ domain: "orchestrate",
49768
+ operation: "ready",
49769
+ gateway: "query",
49770
+ mode: "native",
49771
+ preferredChannel: "either"
49772
+ },
49773
+ {
49774
+ domain: "orchestrate",
49775
+ operation: "analyze",
49776
+ gateway: "query",
49777
+ mode: "native",
49778
+ preferredChannel: "either"
49779
+ },
49780
+ {
49781
+ domain: "orchestrate",
49782
+ operation: "context",
49783
+ gateway: "query",
49784
+ mode: "native",
49785
+ preferredChannel: "either"
49786
+ },
49787
+ {
49788
+ domain: "orchestrate",
49789
+ operation: "waves",
49790
+ gateway: "query",
49791
+ mode: "native",
49792
+ preferredChannel: "either"
49793
+ },
49794
+ {
49795
+ domain: "orchestrate",
49796
+ operation: "bootstrap",
49797
+ gateway: "query",
49798
+ mode: "native",
49799
+ preferredChannel: "either"
49800
+ },
49801
+ {
49802
+ domain: "orchestrate",
49803
+ operation: "unblock.opportunities",
49804
+ gateway: "query",
49805
+ mode: "native",
49806
+ preferredChannel: "either"
49807
+ },
49808
+ {
49809
+ domain: "orchestrate",
49810
+ operation: "tessera.list",
49811
+ gateway: "query",
49812
+ mode: "native",
49813
+ preferredChannel: "either"
49814
+ },
49045
49815
  // Mutate operations
49046
- { domain: "orchestrate", operation: "start", gateway: "mutate", mode: "native" },
49047
- { domain: "orchestrate", operation: "spawn", gateway: "mutate", mode: "native" },
49048
- { domain: "orchestrate", operation: "handoff", gateway: "mutate", mode: "native" },
49049
- { domain: "orchestrate", operation: "spawn.execute", gateway: "mutate", mode: "native" },
49050
- { domain: "orchestrate", operation: "validate", gateway: "mutate", mode: "native" },
49051
- { domain: "orchestrate", operation: "parallel", gateway: "mutate", mode: "native" },
49052
- { domain: "orchestrate", operation: "tessera.instantiate", gateway: "mutate", mode: "native" },
49816
+ {
49817
+ domain: "orchestrate",
49818
+ operation: "start",
49819
+ gateway: "mutate",
49820
+ mode: "native",
49821
+ preferredChannel: "either"
49822
+ },
49823
+ {
49824
+ domain: "orchestrate",
49825
+ operation: "spawn",
49826
+ gateway: "mutate",
49827
+ mode: "native",
49828
+ preferredChannel: "mcp"
49829
+ },
49830
+ {
49831
+ domain: "orchestrate",
49832
+ operation: "handoff",
49833
+ gateway: "mutate",
49834
+ mode: "native",
49835
+ preferredChannel: "either"
49836
+ },
49837
+ {
49838
+ domain: "orchestrate",
49839
+ operation: "spawn.execute",
49840
+ gateway: "mutate",
49841
+ mode: "native",
49842
+ preferredChannel: "either"
49843
+ },
49844
+ {
49845
+ domain: "orchestrate",
49846
+ operation: "validate",
49847
+ gateway: "mutate",
49848
+ mode: "native",
49849
+ preferredChannel: "either"
49850
+ },
49851
+ {
49852
+ domain: "orchestrate",
49853
+ operation: "parallel",
49854
+ gateway: "mutate",
49855
+ mode: "native",
49856
+ preferredChannel: "either"
49857
+ },
49858
+ {
49859
+ domain: "orchestrate",
49860
+ operation: "tessera.instantiate",
49861
+ gateway: "mutate",
49862
+ mode: "native",
49863
+ preferredChannel: "either"
49864
+ },
49053
49865
  // === Memory Domain (brain.db cognitive memory -- T5241) ===
49054
49866
  // Query operations
49055
- { domain: "memory", operation: "find", gateway: "query", mode: "native" },
49056
- { domain: "memory", operation: "timeline", gateway: "query", mode: "native" },
49057
- { domain: "memory", operation: "fetch", gateway: "query", mode: "native" },
49058
- { domain: "memory", operation: "decision.find", gateway: "query", mode: "native" },
49059
- { domain: "memory", operation: "pattern.find", gateway: "query", mode: "native" },
49060
- { domain: "memory", operation: "learning.find", gateway: "query", mode: "native" },
49061
- { domain: "memory", operation: "graph.show", gateway: "query", mode: "native" },
49062
- { domain: "memory", operation: "graph.neighbors", gateway: "query", mode: "native" },
49063
- { domain: "memory", operation: "reason.why", gateway: "query", mode: "native" },
49064
- { domain: "memory", operation: "reason.similar", gateway: "query", mode: "native" },
49065
- { domain: "memory", operation: "search.hybrid", gateway: "query", mode: "native" },
49867
+ {
49868
+ domain: "memory",
49869
+ operation: "find",
49870
+ gateway: "query",
49871
+ mode: "native",
49872
+ preferredChannel: "mcp"
49873
+ },
49874
+ {
49875
+ domain: "memory",
49876
+ operation: "timeline",
49877
+ gateway: "query",
49878
+ mode: "native",
49879
+ preferredChannel: "mcp"
49880
+ },
49881
+ {
49882
+ domain: "memory",
49883
+ operation: "fetch",
49884
+ gateway: "query",
49885
+ mode: "native",
49886
+ preferredChannel: "mcp"
49887
+ },
49888
+ {
49889
+ domain: "memory",
49890
+ operation: "decision.find",
49891
+ gateway: "query",
49892
+ mode: "native",
49893
+ preferredChannel: "mcp"
49894
+ },
49895
+ {
49896
+ domain: "memory",
49897
+ operation: "pattern.find",
49898
+ gateway: "query",
49899
+ mode: "native",
49900
+ preferredChannel: "mcp"
49901
+ },
49902
+ {
49903
+ domain: "memory",
49904
+ operation: "learning.find",
49905
+ gateway: "query",
49906
+ mode: "native",
49907
+ preferredChannel: "mcp"
49908
+ },
49909
+ {
49910
+ domain: "memory",
49911
+ operation: "graph.show",
49912
+ gateway: "query",
49913
+ mode: "native",
49914
+ preferredChannel: "either"
49915
+ },
49916
+ {
49917
+ domain: "memory",
49918
+ operation: "graph.neighbors",
49919
+ gateway: "query",
49920
+ mode: "native",
49921
+ preferredChannel: "either"
49922
+ },
49923
+ {
49924
+ domain: "memory",
49925
+ operation: "reason.why",
49926
+ gateway: "query",
49927
+ mode: "native",
49928
+ preferredChannel: "either"
49929
+ },
49930
+ {
49931
+ domain: "memory",
49932
+ operation: "reason.similar",
49933
+ gateway: "query",
49934
+ mode: "native",
49935
+ preferredChannel: "either"
49936
+ },
49937
+ {
49938
+ domain: "memory",
49939
+ operation: "search.hybrid",
49940
+ gateway: "query",
49941
+ mode: "native",
49942
+ preferredChannel: "either"
49943
+ },
49066
49944
  // Mutate operations
49067
- { domain: "memory", operation: "observe", gateway: "mutate", mode: "native" },
49068
- { domain: "memory", operation: "decision.store", gateway: "mutate", mode: "native" },
49069
- { domain: "memory", operation: "pattern.store", gateway: "mutate", mode: "native" },
49070
- { domain: "memory", operation: "learning.store", gateway: "mutate", mode: "native" },
49071
- { domain: "memory", operation: "link", gateway: "mutate", mode: "native" },
49072
- { domain: "memory", operation: "graph.add", gateway: "mutate", mode: "native" },
49073
- { domain: "memory", operation: "graph.remove", gateway: "mutate", mode: "native" },
49945
+ {
49946
+ domain: "memory",
49947
+ operation: "observe",
49948
+ gateway: "mutate",
49949
+ mode: "native",
49950
+ preferredChannel: "mcp"
49951
+ },
49952
+ {
49953
+ domain: "memory",
49954
+ operation: "decision.store",
49955
+ gateway: "mutate",
49956
+ mode: "native",
49957
+ preferredChannel: "mcp"
49958
+ },
49959
+ {
49960
+ domain: "memory",
49961
+ operation: "pattern.store",
49962
+ gateway: "mutate",
49963
+ mode: "native",
49964
+ preferredChannel: "mcp"
49965
+ },
49966
+ {
49967
+ domain: "memory",
49968
+ operation: "learning.store",
49969
+ gateway: "mutate",
49970
+ mode: "native",
49971
+ preferredChannel: "mcp"
49972
+ },
49973
+ {
49974
+ domain: "memory",
49975
+ operation: "link",
49976
+ gateway: "mutate",
49977
+ mode: "native",
49978
+ preferredChannel: "either"
49979
+ },
49980
+ {
49981
+ domain: "memory",
49982
+ operation: "graph.add",
49983
+ gateway: "mutate",
49984
+ mode: "native",
49985
+ preferredChannel: "either"
49986
+ },
49987
+ {
49988
+ domain: "memory",
49989
+ operation: "graph.remove",
49990
+ gateway: "mutate",
49991
+ mode: "native",
49992
+ preferredChannel: "either"
49993
+ },
49074
49994
  // === Pipeline Domain ===
49075
49995
  // Stage sub-domain (RCASD lifecycle)
49076
- { domain: "pipeline", operation: "stage.validate", gateway: "query", mode: "native" },
49077
- { domain: "pipeline", operation: "stage.status", gateway: "query", mode: "native" },
49078
- { domain: "pipeline", operation: "stage.history", gateway: "query", mode: "native" },
49079
- { domain: "pipeline", operation: "stage.record", gateway: "mutate", mode: "native" },
49080
- { domain: "pipeline", operation: "stage.skip", gateway: "mutate", mode: "native" },
49081
- { domain: "pipeline", operation: "stage.reset", gateway: "mutate", mode: "native" },
49082
- { domain: "pipeline", operation: "stage.gate.pass", gateway: "mutate", mode: "native" },
49083
- { domain: "pipeline", operation: "stage.gate.fail", gateway: "mutate", mode: "native" },
49996
+ {
49997
+ domain: "pipeline",
49998
+ operation: "stage.validate",
49999
+ gateway: "query",
50000
+ mode: "native",
50001
+ preferredChannel: "mcp"
50002
+ },
50003
+ {
50004
+ domain: "pipeline",
50005
+ operation: "stage.status",
50006
+ gateway: "query",
50007
+ mode: "native",
50008
+ preferredChannel: "mcp"
50009
+ },
50010
+ {
50011
+ domain: "pipeline",
50012
+ operation: "stage.history",
50013
+ gateway: "query",
50014
+ mode: "native",
50015
+ preferredChannel: "either"
50016
+ },
50017
+ {
50018
+ domain: "pipeline",
50019
+ operation: "stage.record",
50020
+ gateway: "mutate",
50021
+ mode: "native",
50022
+ preferredChannel: "either"
50023
+ },
50024
+ {
50025
+ domain: "pipeline",
50026
+ operation: "stage.skip",
50027
+ gateway: "mutate",
50028
+ mode: "native",
50029
+ preferredChannel: "either"
50030
+ },
50031
+ {
50032
+ domain: "pipeline",
50033
+ operation: "stage.reset",
50034
+ gateway: "mutate",
50035
+ mode: "native",
50036
+ preferredChannel: "either"
50037
+ },
50038
+ {
50039
+ domain: "pipeline",
50040
+ operation: "stage.gate.pass",
50041
+ gateway: "mutate",
50042
+ mode: "native",
50043
+ preferredChannel: "either"
50044
+ },
50045
+ {
50046
+ domain: "pipeline",
50047
+ operation: "stage.gate.fail",
50048
+ gateway: "mutate",
50049
+ mode: "native",
50050
+ preferredChannel: "either"
50051
+ },
49084
50052
  // Manifest sub-domain (T5241)
49085
- { domain: "pipeline", operation: "manifest.show", gateway: "query", mode: "native" },
49086
- { domain: "pipeline", operation: "manifest.list", gateway: "query", mode: "native" },
49087
- { domain: "pipeline", operation: "manifest.find", gateway: "query", mode: "native" },
49088
- { domain: "pipeline", operation: "manifest.stats", gateway: "query", mode: "native" },
49089
- { domain: "pipeline", operation: "manifest.append", gateway: "mutate", mode: "native" },
49090
- { domain: "pipeline", operation: "manifest.archive", gateway: "mutate", mode: "native" },
50053
+ {
50054
+ domain: "pipeline",
50055
+ operation: "manifest.show",
50056
+ gateway: "query",
50057
+ mode: "native",
50058
+ preferredChannel: "either"
50059
+ },
50060
+ {
50061
+ domain: "pipeline",
50062
+ operation: "manifest.list",
50063
+ gateway: "query",
50064
+ mode: "native",
50065
+ preferredChannel: "either"
50066
+ },
50067
+ {
50068
+ domain: "pipeline",
50069
+ operation: "manifest.find",
50070
+ gateway: "query",
50071
+ mode: "native",
50072
+ preferredChannel: "either"
50073
+ },
50074
+ {
50075
+ domain: "pipeline",
50076
+ operation: "manifest.stats",
50077
+ gateway: "query",
50078
+ mode: "native",
50079
+ preferredChannel: "either"
50080
+ },
50081
+ {
50082
+ domain: "pipeline",
50083
+ operation: "manifest.append",
50084
+ gateway: "mutate",
50085
+ mode: "native",
50086
+ preferredChannel: "either"
50087
+ },
50088
+ {
50089
+ domain: "pipeline",
50090
+ operation: "manifest.archive",
50091
+ gateway: "mutate",
50092
+ mode: "native",
50093
+ preferredChannel: "either"
50094
+ },
49091
50095
  // Phase sub-domain (T5326)
49092
- { domain: "pipeline", operation: "phase.show", gateway: "query", mode: "native" },
49093
- { domain: "pipeline", operation: "phase.list", gateway: "query", mode: "native" },
49094
- { domain: "pipeline", operation: "phase.set", gateway: "mutate", mode: "native" },
49095
- { domain: "pipeline", operation: "phase.advance", gateway: "mutate", mode: "native" },
49096
- { domain: "pipeline", operation: "phase.rename", gateway: "mutate", mode: "native" },
49097
- { domain: "pipeline", operation: "phase.delete", gateway: "mutate", mode: "native" },
50096
+ {
50097
+ domain: "pipeline",
50098
+ operation: "phase.show",
50099
+ gateway: "query",
50100
+ mode: "native",
50101
+ preferredChannel: "either"
50102
+ },
50103
+ {
50104
+ domain: "pipeline",
50105
+ operation: "phase.list",
50106
+ gateway: "query",
50107
+ mode: "native",
50108
+ preferredChannel: "either"
50109
+ },
50110
+ {
50111
+ domain: "pipeline",
50112
+ operation: "phase.set",
50113
+ gateway: "mutate",
50114
+ mode: "native",
50115
+ preferredChannel: "either"
50116
+ },
50117
+ {
50118
+ domain: "pipeline",
50119
+ operation: "phase.advance",
50120
+ gateway: "mutate",
50121
+ mode: "native",
50122
+ preferredChannel: "either"
50123
+ },
50124
+ {
50125
+ domain: "pipeline",
50126
+ operation: "phase.rename",
50127
+ gateway: "mutate",
50128
+ mode: "native",
50129
+ preferredChannel: "either"
50130
+ },
50131
+ {
50132
+ domain: "pipeline",
50133
+ operation: "phase.delete",
50134
+ gateway: "mutate",
50135
+ mode: "native",
50136
+ preferredChannel: "either"
50137
+ },
49098
50138
  // Chain sub-domain (T5405)
49099
- { domain: "pipeline", operation: "chain.show", gateway: "query", mode: "native" },
49100
- { domain: "pipeline", operation: "chain.list", gateway: "query", mode: "native" },
49101
- { domain: "pipeline", operation: "chain.add", gateway: "mutate", mode: "native" },
49102
- { domain: "pipeline", operation: "chain.instantiate", gateway: "mutate", mode: "native" },
49103
- { domain: "pipeline", operation: "chain.advance", gateway: "mutate", mode: "native" },
50139
+ {
50140
+ domain: "pipeline",
50141
+ operation: "chain.show",
50142
+ gateway: "query",
50143
+ mode: "native",
50144
+ preferredChannel: "either"
50145
+ },
50146
+ {
50147
+ domain: "pipeline",
50148
+ operation: "chain.list",
50149
+ gateway: "query",
50150
+ mode: "native",
50151
+ preferredChannel: "either"
50152
+ },
50153
+ {
50154
+ domain: "pipeline",
50155
+ operation: "chain.add",
50156
+ gateway: "mutate",
50157
+ mode: "native",
50158
+ preferredChannel: "either"
50159
+ },
50160
+ {
50161
+ domain: "pipeline",
50162
+ operation: "chain.instantiate",
50163
+ gateway: "mutate",
50164
+ mode: "native",
50165
+ preferredChannel: "either"
50166
+ },
50167
+ {
50168
+ domain: "pipeline",
50169
+ operation: "chain.advance",
50170
+ gateway: "mutate",
50171
+ mode: "native",
50172
+ preferredChannel: "either"
50173
+ },
49104
50174
  // Release sub-domain (T5615 consolidated)
49105
- { domain: "pipeline", operation: "release.list", gateway: "query", mode: "native" },
49106
- { domain: "pipeline", operation: "release.show", gateway: "query", mode: "native" },
49107
- { domain: "pipeline", operation: "release.channel.show", gateway: "query", mode: "native" },
49108
- { domain: "pipeline", operation: "release.ship", gateway: "mutate", mode: "native" },
49109
- { domain: "pipeline", operation: "release.cancel", gateway: "mutate", mode: "native" },
49110
- { domain: "pipeline", operation: "release.rollback", gateway: "mutate", mode: "native" },
50175
+ {
50176
+ domain: "pipeline",
50177
+ operation: "release.list",
50178
+ gateway: "query",
50179
+ mode: "native",
50180
+ preferredChannel: "either"
50181
+ },
50182
+ {
50183
+ domain: "pipeline",
50184
+ operation: "release.show",
50185
+ gateway: "query",
50186
+ mode: "native",
50187
+ preferredChannel: "either"
50188
+ },
50189
+ {
50190
+ domain: "pipeline",
50191
+ operation: "release.channel.show",
50192
+ gateway: "query",
50193
+ mode: "native",
50194
+ preferredChannel: "either"
50195
+ },
50196
+ {
50197
+ domain: "pipeline",
50198
+ operation: "release.ship",
50199
+ gateway: "mutate",
50200
+ mode: "native",
50201
+ preferredChannel: "cli"
50202
+ },
50203
+ {
50204
+ domain: "pipeline",
50205
+ operation: "release.cancel",
50206
+ gateway: "mutate",
50207
+ mode: "native",
50208
+ preferredChannel: "either"
50209
+ },
50210
+ {
50211
+ domain: "pipeline",
50212
+ operation: "release.rollback",
50213
+ gateway: "mutate",
50214
+ mode: "native",
50215
+ preferredChannel: "either"
50216
+ },
49111
50217
  // === Tools Domain ===
49112
50218
  // Issue operations
49113
- { domain: "tools", operation: "issue.diagnostics", gateway: "query", mode: "native" },
50219
+ {
50220
+ domain: "tools",
50221
+ operation: "issue.diagnostics",
50222
+ gateway: "query",
50223
+ mode: "native",
50224
+ preferredChannel: "either"
50225
+ },
49114
50226
  // Skill operations
49115
- { domain: "tools", operation: "skill.list", gateway: "query", mode: "native" },
49116
- { domain: "tools", operation: "skill.show", gateway: "query", mode: "native" },
49117
- { domain: "tools", operation: "skill.find", gateway: "query", mode: "native" },
49118
- { domain: "tools", operation: "skill.dispatch", gateway: "query", mode: "native" },
49119
- { domain: "tools", operation: "skill.verify", gateway: "query", mode: "native" },
49120
- { domain: "tools", operation: "skill.dependencies", gateway: "query", mode: "native" },
49121
- { domain: "tools", operation: "skill.spawn.providers", gateway: "query", mode: "native" },
49122
- { domain: "tools", operation: "skill.catalog", gateway: "query", mode: "native" },
49123
- { domain: "tools", operation: "skill.precedence", gateway: "query", mode: "native" },
49124
- { domain: "tools", operation: "skill.install", gateway: "mutate", mode: "native" },
49125
- { domain: "tools", operation: "skill.uninstall", gateway: "mutate", mode: "native" },
49126
- { domain: "tools", operation: "skill.refresh", gateway: "mutate", mode: "native" },
50227
+ {
50228
+ domain: "tools",
50229
+ operation: "skill.list",
50230
+ gateway: "query",
50231
+ mode: "native",
50232
+ preferredChannel: "mcp"
50233
+ },
50234
+ {
50235
+ domain: "tools",
50236
+ operation: "skill.show",
50237
+ gateway: "query",
50238
+ mode: "native",
50239
+ preferredChannel: "mcp"
50240
+ },
50241
+ {
50242
+ domain: "tools",
50243
+ operation: "skill.find",
50244
+ gateway: "query",
50245
+ mode: "native",
50246
+ preferredChannel: "mcp"
50247
+ },
50248
+ {
50249
+ domain: "tools",
50250
+ operation: "skill.dispatch",
50251
+ gateway: "query",
50252
+ mode: "native",
50253
+ preferredChannel: "either"
50254
+ },
50255
+ {
50256
+ domain: "tools",
50257
+ operation: "skill.verify",
50258
+ gateway: "query",
50259
+ mode: "native",
50260
+ preferredChannel: "either"
50261
+ },
50262
+ {
50263
+ domain: "tools",
50264
+ operation: "skill.dependencies",
50265
+ gateway: "query",
50266
+ mode: "native",
50267
+ preferredChannel: "either"
50268
+ },
50269
+ {
50270
+ domain: "tools",
50271
+ operation: "skill.spawn.providers",
50272
+ gateway: "query",
50273
+ mode: "native",
50274
+ preferredChannel: "either"
50275
+ },
50276
+ {
50277
+ domain: "tools",
50278
+ operation: "skill.catalog",
50279
+ gateway: "query",
50280
+ mode: "native",
50281
+ preferredChannel: "either"
50282
+ },
50283
+ {
50284
+ domain: "tools",
50285
+ operation: "skill.precedence",
50286
+ gateway: "query",
50287
+ mode: "native",
50288
+ preferredChannel: "either"
50289
+ },
50290
+ {
50291
+ domain: "tools",
50292
+ operation: "skill.install",
50293
+ gateway: "mutate",
50294
+ mode: "native",
50295
+ preferredChannel: "either"
50296
+ },
50297
+ {
50298
+ domain: "tools",
50299
+ operation: "skill.uninstall",
50300
+ gateway: "mutate",
50301
+ mode: "native",
50302
+ preferredChannel: "either"
50303
+ },
50304
+ {
50305
+ domain: "tools",
50306
+ operation: "skill.refresh",
50307
+ gateway: "mutate",
50308
+ mode: "native",
50309
+ preferredChannel: "either"
50310
+ },
49127
50311
  // Provider operations
49128
- { domain: "tools", operation: "provider.list", gateway: "query", mode: "native" },
49129
- { domain: "tools", operation: "provider.detect", gateway: "query", mode: "native" },
49130
- { domain: "tools", operation: "provider.inject.status", gateway: "query", mode: "native" },
49131
- { domain: "tools", operation: "provider.supports", gateway: "query", mode: "native" },
49132
- { domain: "tools", operation: "provider.hooks", gateway: "query", mode: "native" },
49133
- { domain: "tools", operation: "provider.inject", gateway: "mutate", mode: "native" },
50312
+ {
50313
+ domain: "tools",
50314
+ operation: "provider.list",
50315
+ gateway: "query",
50316
+ mode: "native",
50317
+ preferredChannel: "mcp"
50318
+ },
50319
+ {
50320
+ domain: "tools",
50321
+ operation: "provider.detect",
50322
+ gateway: "query",
50323
+ mode: "native",
50324
+ preferredChannel: "mcp"
50325
+ },
50326
+ {
50327
+ domain: "tools",
50328
+ operation: "provider.inject.status",
50329
+ gateway: "query",
50330
+ mode: "native",
50331
+ preferredChannel: "either"
50332
+ },
50333
+ {
50334
+ domain: "tools",
50335
+ operation: "provider.supports",
50336
+ gateway: "query",
50337
+ mode: "native",
50338
+ preferredChannel: "either"
50339
+ },
50340
+ {
50341
+ domain: "tools",
50342
+ operation: "provider.hooks",
50343
+ gateway: "query",
50344
+ mode: "native",
50345
+ preferredChannel: "either"
50346
+ },
50347
+ {
50348
+ domain: "tools",
50349
+ operation: "provider.inject",
50350
+ gateway: "mutate",
50351
+ mode: "native",
50352
+ preferredChannel: "either"
50353
+ },
50354
+ // Adapter sub-domain (T5240)
50355
+ {
50356
+ domain: "tools",
50357
+ operation: "adapter.list",
50358
+ gateway: "query",
50359
+ mode: "native",
50360
+ preferredChannel: "mcp"
50361
+ },
50362
+ {
50363
+ domain: "tools",
50364
+ operation: "adapter.show",
50365
+ gateway: "query",
50366
+ mode: "native",
50367
+ preferredChannel: "mcp"
50368
+ },
50369
+ {
50370
+ domain: "tools",
50371
+ operation: "adapter.detect",
50372
+ gateway: "query",
50373
+ mode: "native",
50374
+ preferredChannel: "either"
50375
+ },
50376
+ {
50377
+ domain: "tools",
50378
+ operation: "adapter.health",
50379
+ gateway: "query",
50380
+ mode: "native",
50381
+ preferredChannel: "either"
50382
+ },
50383
+ {
50384
+ domain: "tools",
50385
+ operation: "adapter.activate",
50386
+ gateway: "mutate",
50387
+ mode: "native",
50388
+ preferredChannel: "mcp"
50389
+ },
50390
+ {
50391
+ domain: "tools",
50392
+ operation: "adapter.dispose",
50393
+ gateway: "mutate",
50394
+ mode: "native",
50395
+ preferredChannel: "either"
50396
+ },
49134
50397
  // === Nexus Domain ===
49135
50398
  // Query operations
49136
- { domain: "nexus", operation: "status", gateway: "query", mode: "native" },
49137
- { domain: "nexus", operation: "list", gateway: "query", mode: "native" },
49138
- { domain: "nexus", operation: "show", gateway: "query", mode: "native" },
49139
- { domain: "nexus", operation: "search", gateway: "query", mode: "native" },
49140
- { domain: "nexus", operation: "graph", gateway: "query", mode: "native" },
49141
- { domain: "nexus", operation: "deps", gateway: "query", mode: "native" },
49142
- { domain: "nexus", operation: "resolve", gateway: "query", mode: "native" },
49143
- { domain: "nexus", operation: "discover", gateway: "query", mode: "native" },
49144
- { domain: "nexus", operation: "orphans.list", gateway: "query", mode: "native" },
49145
- { domain: "nexus", operation: "blockers.show", gateway: "query", mode: "native" },
49146
- { domain: "nexus", operation: "path.show", gateway: "query", mode: "native" },
49147
- { domain: "nexus", operation: "share.status", gateway: "query", mode: "native" },
50399
+ {
50400
+ domain: "nexus",
50401
+ operation: "status",
50402
+ gateway: "query",
50403
+ mode: "native",
50404
+ preferredChannel: "either"
50405
+ },
50406
+ {
50407
+ domain: "nexus",
50408
+ operation: "list",
50409
+ gateway: "query",
50410
+ mode: "native",
50411
+ preferredChannel: "either"
50412
+ },
50413
+ {
50414
+ domain: "nexus",
50415
+ operation: "show",
50416
+ gateway: "query",
50417
+ mode: "native",
50418
+ preferredChannel: "either"
50419
+ },
50420
+ {
50421
+ domain: "nexus",
50422
+ operation: "search",
50423
+ gateway: "query",
50424
+ mode: "native",
50425
+ preferredChannel: "either"
50426
+ },
50427
+ {
50428
+ domain: "nexus",
50429
+ operation: "graph",
50430
+ gateway: "query",
50431
+ mode: "native",
50432
+ preferredChannel: "either"
50433
+ },
50434
+ {
50435
+ domain: "nexus",
50436
+ operation: "deps",
50437
+ gateway: "query",
50438
+ mode: "native",
50439
+ preferredChannel: "either"
50440
+ },
50441
+ {
50442
+ domain: "nexus",
50443
+ operation: "resolve",
50444
+ gateway: "query",
50445
+ mode: "native",
50446
+ preferredChannel: "either"
50447
+ },
50448
+ {
50449
+ domain: "nexus",
50450
+ operation: "discover",
50451
+ gateway: "query",
50452
+ mode: "native",
50453
+ preferredChannel: "either"
50454
+ },
50455
+ {
50456
+ domain: "nexus",
50457
+ operation: "orphans.list",
50458
+ gateway: "query",
50459
+ mode: "native",
50460
+ preferredChannel: "either"
50461
+ },
50462
+ {
50463
+ domain: "nexus",
50464
+ operation: "blockers.show",
50465
+ gateway: "query",
50466
+ mode: "native",
50467
+ preferredChannel: "either"
50468
+ },
50469
+ {
50470
+ domain: "nexus",
50471
+ operation: "path.show",
50472
+ gateway: "query",
50473
+ mode: "native",
50474
+ preferredChannel: "either"
50475
+ },
50476
+ {
50477
+ domain: "nexus",
50478
+ operation: "share.status",
50479
+ gateway: "query",
50480
+ mode: "native",
50481
+ preferredChannel: "either"
50482
+ },
50483
+ {
50484
+ domain: "nexus",
50485
+ operation: "transfer.preview",
50486
+ gateway: "query",
50487
+ mode: "native",
50488
+ preferredChannel: "either"
50489
+ },
49148
50490
  // Mutate operations
49149
- { domain: "nexus", operation: "init", gateway: "mutate", mode: "native" },
49150
- { domain: "nexus", operation: "register", gateway: "mutate", mode: "native" },
49151
- { domain: "nexus", operation: "unregister", gateway: "mutate", mode: "native" },
49152
- { domain: "nexus", operation: "sync", gateway: "mutate", mode: "native" },
49153
- { domain: "nexus", operation: "reconcile", gateway: "mutate", mode: "native" },
49154
- { domain: "nexus", operation: "permission.set", gateway: "mutate", mode: "native" },
49155
- { domain: "nexus", operation: "share.snapshot.export", gateway: "mutate", mode: "native" },
49156
- { domain: "nexus", operation: "share.snapshot.import", gateway: "mutate", mode: "native" },
50491
+ {
50492
+ domain: "nexus",
50493
+ operation: "init",
50494
+ gateway: "mutate",
50495
+ mode: "native",
50496
+ preferredChannel: "either"
50497
+ },
50498
+ {
50499
+ domain: "nexus",
50500
+ operation: "register",
50501
+ gateway: "mutate",
50502
+ mode: "native",
50503
+ preferredChannel: "either"
50504
+ },
50505
+ {
50506
+ domain: "nexus",
50507
+ operation: "unregister",
50508
+ gateway: "mutate",
50509
+ mode: "native",
50510
+ preferredChannel: "either"
50511
+ },
50512
+ {
50513
+ domain: "nexus",
50514
+ operation: "sync",
50515
+ gateway: "mutate",
50516
+ mode: "native",
50517
+ preferredChannel: "either"
50518
+ },
50519
+ {
50520
+ domain: "nexus",
50521
+ operation: "reconcile",
50522
+ gateway: "mutate",
50523
+ mode: "native",
50524
+ preferredChannel: "either"
50525
+ },
50526
+ {
50527
+ domain: "nexus",
50528
+ operation: "permission.set",
50529
+ gateway: "mutate",
50530
+ mode: "native",
50531
+ preferredChannel: "either"
50532
+ },
50533
+ {
50534
+ domain: "nexus",
50535
+ operation: "share.snapshot.export",
50536
+ gateway: "mutate",
50537
+ mode: "native",
50538
+ preferredChannel: "either"
50539
+ },
50540
+ {
50541
+ domain: "nexus",
50542
+ operation: "share.snapshot.import",
50543
+ gateway: "mutate",
50544
+ mode: "native",
50545
+ preferredChannel: "either"
50546
+ },
50547
+ {
50548
+ domain: "nexus",
50549
+ operation: "transfer",
50550
+ gateway: "mutate",
50551
+ mode: "native",
50552
+ preferredChannel: "either"
50553
+ },
49157
50554
  // === Sticky Domain ===
49158
50555
  // Query operations
49159
- { domain: "sticky", operation: "list", gateway: "query", mode: "native" },
49160
- { domain: "sticky", operation: "show", gateway: "query", mode: "native" },
50556
+ {
50557
+ domain: "sticky",
50558
+ operation: "list",
50559
+ gateway: "query",
50560
+ mode: "native",
50561
+ preferredChannel: "mcp"
50562
+ },
50563
+ {
50564
+ domain: "sticky",
50565
+ operation: "show",
50566
+ gateway: "query",
50567
+ mode: "native",
50568
+ preferredChannel: "mcp"
50569
+ },
49161
50570
  // Mutate operations
49162
- { domain: "sticky", operation: "add", gateway: "mutate", mode: "native" },
49163
- { domain: "sticky", operation: "archive", gateway: "mutate", mode: "native" },
49164
- { domain: "sticky", operation: "convert", gateway: "mutate", mode: "native" },
49165
- { domain: "sticky", operation: "purge", gateway: "mutate", mode: "native" }
50571
+ {
50572
+ domain: "sticky",
50573
+ operation: "add",
50574
+ gateway: "mutate",
50575
+ mode: "native",
50576
+ preferredChannel: "mcp"
50577
+ },
50578
+ {
50579
+ domain: "sticky",
50580
+ operation: "archive",
50581
+ gateway: "mutate",
50582
+ mode: "native",
50583
+ preferredChannel: "either"
50584
+ },
50585
+ {
50586
+ domain: "sticky",
50587
+ operation: "convert",
50588
+ gateway: "mutate",
50589
+ mode: "native",
50590
+ preferredChannel: "either"
50591
+ },
50592
+ {
50593
+ domain: "sticky",
50594
+ operation: "purge",
50595
+ gateway: "mutate",
50596
+ mode: "native",
50597
+ preferredChannel: "either"
50598
+ }
49166
50599
  ];
49167
50600
  function getOperationMode(domain2, operation, gateway) {
49168
50601
  const entry = CAPABILITY_MATRIX.find(
@@ -50182,7 +51615,9 @@ function extractBody(content) {
50182
51615
  // packages/core/src/skills/agents/install.ts
50183
51616
  init_paths();
50184
51617
  import { existsSync as existsSync66, mkdirSync as mkdirSync14, readdirSync as readdirSync25, readlinkSync, symlinkSync, unlinkSync as unlinkSync4 } from "node:fs";
51618
+ import { platform as platform2 } from "node:os";
50185
51619
  import { basename as basename12, join as join70 } from "node:path";
51620
+ var DIR_SYMLINK_TYPE = platform2() === "win32" ? "junction" : "dir";
50186
51621
  function getAgentInstallDir() {
50187
51622
  return getClaudeAgentsDir();
50188
51623
  }
@@ -50212,7 +51647,7 @@ function installAgent(agentDir) {
50212
51647
  }
50213
51648
  }
50214
51649
  try {
50215
- symlinkSync(agentDir, targetPath, "dir");
51650
+ symlinkSync(agentDir, targetPath, DIR_SYMLINK_TYPE);
50216
51651
  return { installed: true, path: targetPath };
50217
51652
  } catch (err) {
50218
51653
  return { installed: false, path: targetPath, error: `Symlink failed: ${err}` };
@@ -52108,11 +53543,11 @@ async function validateOrchestratorCompliance(epicId, cwd) {
52108
53543
  }
52109
53544
 
52110
53545
  // packages/core/src/skills/skill-paths.ts
52111
- init_paths();
52112
53546
  import { existsSync as existsSync76, lstatSync, readlinkSync as readlinkSync2, realpathSync as realpathSync2 } from "node:fs";
52113
53547
  import { delimiter, join as join79, resolve as resolve9 } from "node:path";
53548
+ import { getCanonicalSkillsDir as getCanonicalSkillsDir2 } from "@cleocode/caamp";
52114
53549
  function getCaampCanonical() {
52115
- return join79(getAgentsHome(), "skills");
53550
+ return getCanonicalSkillsDir2();
52116
53551
  }
52117
53552
  function getProjectEmbedded(projectRoot) {
52118
53553
  const root = projectRoot ?? process.cwd();
@@ -53945,11 +55380,11 @@ import { join as join84 } from "node:path";
53945
55380
  import { Readable } from "node:stream";
53946
55381
  import { pipeline } from "node:stream/promises";
53947
55382
  import { createGzip } from "node:zlib";
53948
- var log6 = getLogger("prune");
55383
+ var log7 = getLogger("prune");
53949
55384
  async function pruneAuditLog(cleoDir, config2) {
53950
55385
  try {
53951
55386
  if (!config2.auditRetentionDays || config2.auditRetentionDays <= 0) {
53952
- log6.debug("auditRetentionDays is 0 or unset; skipping audit prune");
55387
+ log7.debug("auditRetentionDays is 0 or unset; skipping audit prune");
53953
55388
  return { rowsArchived: 0, rowsDeleted: 0 };
53954
55389
  }
53955
55390
  const cutoff = new Date(Date.now() - config2.auditRetentionDays * 864e5).toISOString();
@@ -53960,7 +55395,7 @@ async function pruneAuditLog(cleoDir, config2) {
53960
55395
  const db = await getDb3(projectRoot);
53961
55396
  const oldRows = await db.select().from(auditLog2).where(lt3(auditLog2.timestamp, cutoff));
53962
55397
  if (oldRows.length === 0) {
53963
- log6.debug("No audit_log rows older than cutoff; nothing to prune");
55398
+ log7.debug("No audit_log rows older than cutoff; nothing to prune");
53964
55399
  return { rowsArchived: 0, rowsDeleted: 0 };
53965
55400
  }
53966
55401
  let archivePath;
@@ -53978,17 +55413,17 @@ async function pruneAuditLog(cleoDir, config2) {
53978
55413
  const inStream = Readable.from([jsonlContent]);
53979
55414
  await pipeline(inStream, gzip, outStream);
53980
55415
  rowsArchived = oldRows.length;
53981
- log6.info(
55416
+ log7.info(
53982
55417
  { archivePath, rowsArchived },
53983
55418
  `Archived ${rowsArchived} audit rows to ${archivePath}`
53984
55419
  );
53985
55420
  } catch (archiveErr) {
53986
- log6.warn({ err: archiveErr }, "Failed to archive audit rows; continuing with deletion");
55421
+ log7.warn({ err: archiveErr }, "Failed to archive audit rows; continuing with deletion");
53987
55422
  archivePath = void 0;
53988
55423
  }
53989
55424
  }
53990
55425
  await db.delete(auditLog2).where(lt3(auditLog2.timestamp, cutoff)).run();
53991
- log6.info(
55426
+ log7.info(
53992
55427
  { rowsDeleted: oldRows.length, cutoff },
53993
55428
  `Pruned ${oldRows.length} audit_log rows older than ${cutoff}`
53994
55429
  );
@@ -53998,7 +55433,7 @@ async function pruneAuditLog(cleoDir, config2) {
53998
55433
  archivePath
53999
55434
  };
54000
55435
  } catch (err) {
54001
- log6.warn({ err }, "audit log pruning failed");
55436
+ log7.warn({ err }, "audit log pruning failed");
54002
55437
  return { rowsArchived: 0, rowsDeleted: 0 };
54003
55438
  }
54004
55439
  }
@@ -54258,7 +55693,7 @@ function getNodeVersionInfo() {
54258
55693
  };
54259
55694
  }
54260
55695
  function getNodeUpgradeInstructions() {
54261
- const platform3 = detectPlatform();
55696
+ const platform5 = detectPlatform();
54262
55697
  const arch2 = process.arch;
54263
55698
  const instructions = [];
54264
55699
  const hasFnm = commandExists2("fnm");
@@ -54273,7 +55708,7 @@ function getNodeUpgradeInstructions() {
54273
55708
  if (hasVolta) {
54274
55709
  instructions.push(`volta install node@${MINIMUM_NODE_MAJOR}`);
54275
55710
  }
54276
- switch (platform3) {
55711
+ switch (platform5) {
54277
55712
  case "linux":
54278
55713
  if (commandExists2("dnf")) {
54279
55714
  instructions.push(
@@ -54305,7 +55740,7 @@ function getNodeUpgradeInstructions() {
54305
55740
  }
54306
55741
  instructions.push(`https://nodejs.org/en/download/`);
54307
55742
  const recommended = instructions[0] ?? `https://nodejs.org/en/download/`;
54308
- return { platform: platform3, arch: arch2, instructions, recommended };
55743
+ return { platform: platform5, arch: arch2, instructions, recommended };
54309
55744
  }
54310
55745
  function getSystemInfo2() {
54311
55746
  return {
@@ -56877,7 +58312,6 @@ function validateLabels2(labels, repoLabels) {
56877
58312
  var ui_exports = {};
56878
58313
  __export(ui_exports, {
56879
58314
  ALIASES_VERSION: () => ALIASES_VERSION,
56880
- INJECTION_VALIDATION_KEYS: () => INJECTION_VALIDATION_KEYS,
56881
58315
  appendToChangelog: () => appendToChangelog,
56882
58316
  checkAliasesStatus: () => checkAliasesStatus,
56883
58317
  defaultFlags: () => defaultFlags,
@@ -56894,7 +58328,6 @@ __export(ui_exports, {
56894
58328
  getCurrentShell: () => getCurrentShell,
56895
58329
  getInstalledVersion: () => getInstalledVersion,
56896
58330
  getRcFilePath: () => getRcFilePath,
56897
- getValidationKey: () => getValidationKey,
56898
58331
  groupTasksIntoSections: () => groupTasksIntoSections,
56899
58332
  hasAliasBlock: () => hasAliasBlock,
56900
58333
  injectAliases: () => injectAliases,
@@ -56910,7 +58343,7 @@ __export(ui_exports, {
56910
58343
 
56911
58344
  // packages/core/src/ui/aliases.ts
56912
58345
  import { existsSync as existsSync92, readFileSync as readFileSync67, writeFileSync as writeFileSync15 } from "node:fs";
56913
- import { homedir as homedir5, platform as platform2 } from "node:os";
58346
+ import { homedir as homedir5, platform as platform3 } from "node:os";
56914
58347
  import { join as join96 } from "node:path";
56915
58348
  var MARKER_START = "# CLEO-CLAUDE-ALIASES:START";
56916
58349
  var MARKER_END = "# CLEO-CLAUDE-ALIASES:END";
@@ -56925,7 +58358,7 @@ function getCurrentShell() {
56925
58358
  const shell = process.env.SHELL ?? "";
56926
58359
  if (shell.includes("zsh")) return "zsh";
56927
58360
  if (shell.includes("bash")) return "bash";
56928
- if (platform2() === "win32") return "powershell";
58361
+ if (platform3() === "win32") return "powershell";
56929
58362
  return "bash";
56930
58363
  }
56931
58364
  function getRcFilePath(shell) {
@@ -56949,7 +58382,7 @@ function detectAvailableShells() {
56949
58382
  const shells = [];
56950
58383
  if (existsSync92(getRcFilePath("bash")) || existsSync92("/bin/bash")) shells.push("bash");
56951
58384
  if (existsSync92(getRcFilePath("zsh")) || existsSync92("/bin/zsh")) shells.push("zsh");
56952
- if (platform2() === "win32") shells.push("powershell");
58385
+ if (platform3() === "win32") shells.push("powershell");
56953
58386
  return shells;
56954
58387
  }
56955
58388
  function generateBashAliases(cleoPath) {
@@ -57381,16 +58814,6 @@ function isJsonOutput(flags) {
57381
58814
  return resolveFormat(flags.format) === "json";
57382
58815
  }
57383
58816
 
57384
- // packages/core/src/ui/injection-legacy.ts
57385
- var INJECTION_VALIDATION_KEYS = {
57386
- "CLAUDE.md": "claude_md",
57387
- "AGENTS.md": "agents_md",
57388
- "GEMINI.md": "gemini_md"
57389
- };
57390
- function getValidationKey(target) {
57391
- return INJECTION_VALIDATION_KEYS[target] ?? target.toLowerCase().replace(/[^a-z0-9]/g, "_");
57392
- }
57393
-
57394
58817
  // packages/core/src/validation/index.ts
57395
58818
  var validation_exports = {};
57396
58819
  __export(validation_exports, {
@@ -60371,15 +61794,34 @@ init_injection();
60371
61794
  init_memory_bridge();
60372
61795
  import { existsSync as existsSync99, readdirSync as readdirSync33, readFileSync as readFileSync73 } from "node:fs";
60373
61796
  import { copyFile as copyFile3, lstat, mkdir as mkdir16, readFile as readFile17, symlink, unlink as unlink4, writeFile as writeFile11 } from "node:fs/promises";
61797
+ import { platform as platform4 } from "node:os";
60374
61798
  import { basename as basename17, dirname as dirname19, join as join100 } from "node:path";
60375
61799
  init_paths();
60376
61800
  init_scaffold();
60377
61801
  init_schema_management();
60378
61802
  init_json2();
61803
+ var DIR_SYMLINK_TYPE2 = platform4() === "win32" ? "junction" : "dir";
60379
61804
  async function initAgentDefinition(created, warnings) {
60380
- const packageRoot = getPackageRoot();
60381
- const agentSourceDir = join100(packageRoot, "agents", "cleo-subagent");
60382
- if (!existsSync99(agentSourceDir)) {
61805
+ let agentSourceDir = null;
61806
+ try {
61807
+ const { createRequire: createRequire5 } = await import("node:module");
61808
+ const req = createRequire5(import.meta.url);
61809
+ const agentsPkgMain = req.resolve("@cleocode/agents/package.json");
61810
+ const agentsPkgRoot = dirname19(agentsPkgMain);
61811
+ const candidate = join100(agentsPkgRoot, "cleo-subagent");
61812
+ if (existsSync99(candidate)) {
61813
+ agentSourceDir = candidate;
61814
+ }
61815
+ } catch {
61816
+ }
61817
+ if (!agentSourceDir) {
61818
+ const packageRoot = getPackageRoot();
61819
+ const bundled = join100(packageRoot, "agents", "cleo-subagent");
61820
+ if (existsSync99(bundled)) {
61821
+ agentSourceDir = bundled;
61822
+ }
61823
+ }
61824
+ if (!agentSourceDir) {
60383
61825
  warnings.push("agents/cleo-subagent/ not found in package, skipping agent definition install");
60384
61826
  return;
60385
61827
  }
@@ -60393,7 +61835,7 @@ async function initAgentDefinition(created, warnings) {
60393
61835
  }
60394
61836
  } catch {
60395
61837
  }
60396
- await symlink(agentSourceDir, globalAgentsDir, "dir");
61838
+ await symlink(agentSourceDir, globalAgentsDir, DIR_SYMLINK_TYPE2);
60397
61839
  created.push("agent: cleo-subagent (symlinked)");
60398
61840
  } catch (_err) {
60399
61841
  try {
@@ -60410,61 +61852,6 @@ async function initAgentDefinition(created, warnings) {
60410
61852
  }
60411
61853
  }
60412
61854
  }
60413
- async function initCoreSkills(created, warnings) {
60414
- try {
60415
- const { getInstalledProviders: getInstalledProviders3, installSkill: installSkill2, registerSkillLibraryFromPath } = await import("@cleocode/caamp");
60416
- const providers = getInstalledProviders3();
60417
- if (providers.length === 0) {
60418
- return;
60419
- }
60420
- const packageRoot = getPackageRoot();
60421
- let ctSkillsRoot = null;
60422
- try {
60423
- const bundledPath = join100(packageRoot, "packages", "skills");
60424
- if (existsSync99(join100(bundledPath, "skills.json"))) {
60425
- ctSkillsRoot = bundledPath;
60426
- } else {
60427
- const ctSkillsPath = join100(packageRoot, "node_modules", "@cleocode", "skills");
60428
- if (existsSync99(join100(ctSkillsPath, "skills.json"))) {
60429
- ctSkillsRoot = ctSkillsPath;
60430
- }
60431
- }
60432
- } catch {
60433
- }
60434
- if (!ctSkillsRoot) {
60435
- warnings.push("skills package not found, skipping core skill installation");
60436
- return;
60437
- }
60438
- try {
60439
- registerSkillLibraryFromPath(ctSkillsRoot);
60440
- } catch {
60441
- warnings.push("Failed to register skill library with CAAMP");
60442
- }
60443
- const catalogPath = join100(ctSkillsRoot, "skills.json");
60444
- const catalog3 = JSON.parse(readFileSync73(catalogPath, "utf-8"));
60445
- const skills = catalog3.skills ?? [];
60446
- const coreSkills = skills.filter((s) => s.tier <= 2);
60447
- const installed = [];
60448
- for (const skill of coreSkills) {
60449
- const skillSourceDir = dirname19(join100(ctSkillsRoot, skill.path));
60450
- if (!existsSync99(skillSourceDir)) {
60451
- continue;
60452
- }
60453
- try {
60454
- const result = await installSkill2(skillSourceDir, skill.name, providers, true);
60455
- if (result.success) {
60456
- installed.push(skill.name);
60457
- }
60458
- } catch {
60459
- }
60460
- }
60461
- if (installed.length > 0) {
60462
- created.push(`skills: ${installed.length} core skills installed`);
60463
- }
60464
- } catch (err) {
60465
- warnings.push(`Core skill install: ${err instanceof Error ? err.message : String(err)}`);
60466
- }
60467
- }
60468
61855
  async function initNexusRegistration(projectRoot, created, warnings) {
60469
61856
  try {
60470
61857
  const { nexusReconcile: nexusReconcile2 } = await Promise.resolve().then(() => (init_registry3(), registry_exports3));
@@ -60722,7 +62109,6 @@ async function initProject(opts = {}) {
60722
62109
  warnings.push(`Contributor MCP setup: ${err instanceof Error ? err.message : String(err)}`);
60723
62110
  }
60724
62111
  await initAgentDefinition(created, warnings);
60725
- await initCoreSkills(created, warnings);
60726
62112
  await initNexusRegistration(projRoot, created, warnings);
60727
62113
  try {
60728
62114
  const { AdapterManager: AdapterManager2 } = await Promise.resolve().then(() => (init_adapters(), adapters_exports));
@@ -60816,7 +62202,7 @@ init_logger();
60816
62202
 
60817
62203
  // packages/core/src/output.ts
60818
62204
  init_errors3();
60819
- import { randomUUID as randomUUID5 } from "node:crypto";
62205
+ import { randomUUID as randomUUID6 } from "node:crypto";
60820
62206
 
60821
62207
  // packages/core/src/sessions/context-alert.ts
60822
62208
  init_paths();
@@ -60849,7 +62235,7 @@ function createCliMeta(operation, mvi = "standard") {
60849
62235
  schemaVersion: "2026.2.1",
60850
62236
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
60851
62237
  operation,
60852
- requestId: randomUUID5(),
62238
+ requestId: randomUUID6(),
60853
62239
  transport: "cli",
60854
62240
  strict: true,
60855
62241
  mvi,