@thinkingai/ae-cli 6.0.60 → 6.0.61

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 (82) hide show
  1. package/README.md +4 -1
  2. package/README.zh.md +6 -1
  3. package/bin/runtime-capabilities.json +1 -1
  4. package/dist/{ai-monitor-FCXSLHAP.js → ai-monitor-NUKSJPLE.js} +10 -9
  5. package/dist/ai-monitor.js +14 -13
  6. package/dist/{auth-ATK2SLEV.js → auth-MVAEBGBP.js} +18 -10
  7. package/dist/{automation-FLCPFMN4.js → automation-6L6IAYRK.js} +6 -7
  8. package/dist/{capability-6KTSOI7L.js → capability-74N7AN5X.js} +10 -9
  9. package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
  10. package/dist/{chunk-5E7MTTFN.js → chunk-7WBCSJL6.js} +23 -9
  11. package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
  12. package/dist/{chunk-6M7ZEDT2.js → chunk-BQFLABJQ.js} +11 -7
  13. package/dist/{chunk-KTJXD27G.js → chunk-COOMXFUG.js} +3 -3
  14. package/dist/{chunk-CF6JTT2U.js → chunk-EFGUBGA6.js} +1 -1
  15. package/dist/{chunk-BEYLCUZX.js → chunk-H35VDOAE.js} +3 -3
  16. package/dist/{chunk-F2VFZUGG.js → chunk-HIMOBNEY.js} +2 -2
  17. package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
  18. package/dist/{chunk-AXTO4FTM.js → chunk-HRFYYEXR.js} +3 -3
  19. package/dist/{chunk-2ETRY2CU.js → chunk-JZY6WWAP.js} +9 -8
  20. package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
  21. package/dist/{chunk-P7QDCWJ6.js → chunk-LFJ7N36I.js} +5 -1
  22. package/dist/{chunk-SDKW6LYE.js → chunk-LPKIMGIU.js} +3 -3
  23. package/dist/chunk-NNK3JBH4.js +60 -0
  24. package/dist/{chunk-VJUXKVRE.js → chunk-OTZ4JQDU.js} +2 -2
  25. package/dist/{chunk-HTZ2MLYA.js → chunk-PLNS5J33.js} +11 -5
  26. package/dist/chunk-PUSFEC6B.js +29 -0
  27. package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
  28. package/dist/{chunk-HSZAIPUX.js → chunk-RB26WNLM.js} +7 -5
  29. package/dist/{chunk-VRMGHQKE.js → chunk-SVNED423.js} +11 -11
  30. package/dist/{chunk-HVMCPKOZ.js → chunk-THTROEGD.js} +1 -1
  31. package/dist/{chunk-QVRIDN42.js → chunk-UCMO4LKL.js} +2 -2
  32. package/dist/{chunk-5M5LBRR3.js → chunk-VLOGOM7N.js} +13 -7
  33. package/dist/{chunk-LOR4IA26.js → chunk-XPARQSYS.js} +165 -186
  34. package/dist/{chunk-72NJKS7O.js → chunk-XZDKAR4N.js} +4 -4
  35. package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
  36. package/dist/{compat-check-XD2U7PZ2.js → compat-check-W4XC27RG.js} +5 -4
  37. package/dist/{config-U3GDWU6E.js → config-264GB6C7.js} +7 -6
  38. package/dist/{context-YAQG6YQC.js → context-SOQDFZIB.js} +8 -6
  39. package/dist/{data-integration-QE37EQ3A.js → data-integration-UNJ7EPW2.js} +6 -6
  40. package/dist/{evaluation-2JSF4V47.js → evaluation-Q3AIGFOG.js} +5 -5
  41. package/dist/index.js +46 -42
  42. package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
  43. package/dist/{memory-WEB27VI6.js → memory-ZLTTULZK.js} +6 -7
  44. package/dist/{metadata-7FYE4234.js → metadata-EN2IWCDI.js} +10 -9
  45. package/dist/{model-T7H7Q6BG.js → model-NAKQWK4W.js} +4 -5
  46. package/dist/{personal-semantic-preference-O6VXM74A.js → personal-semantic-preference-UGN67KTN.js} +45 -14
  47. package/dist/{project-semantic-2GGFJWW6.js → project-semantic-5OP3YPZD.js} +9 -8
  48. package/dist/{sync-ULBB7WO5.js → sync-LDJQZRQH.js} +9 -9
  49. package/dist/{te-agent-6RMF7LUV.js → te-agent-WNNAD4AJ.js} +303 -17
  50. package/dist/{te-analysis-HSYC7GNV.js → te-analysis-KIMH6AGU.js} +25 -20
  51. package/dist/{te-community-FLKZGQKB.js → te-community-P7NNBVCS.js} +13 -11
  52. package/dist/{te-dataops-OQQGTCUA.js → te-dataops-ZRKSG4R7.js} +13 -11
  53. package/dist/{te-engage-RIEBHL5T.js → te-engage-PVBVNRSU.js} +9 -8
  54. package/dist/{te-kb-4HG2FMHJ.js → te-kb-W7PRC7QN.js} +68 -17
  55. package/dist/{te-system-AL4B4XZL.js → te-system-F4ZU2HRQ.js} +6 -7
  56. package/dist/{te-team-5O4UVUWE.js → te-team-5ONMRGKF.js} +9 -8
  57. package/dist/{things-TSJ64GBT.js → things-PFENSIF4.js} +9 -8
  58. package/dist/{update-Q5LURAWV.js → update-EUZ4GNND.js} +8 -6
  59. package/dist/{workspace-FF2HXJGR.js → workspace-Z7L33OBQ.js} +6 -7
  60. package/package.json +5 -2
  61. package/skills/ae-agent/SKILL.md +19 -5
  62. package/skills/ae-agent/references/a2a.md +103 -0
  63. package/skills/ae-agent/references/command_index.md +11 -0
  64. package/skills/ae-analysis/SKILL.md +35 -23
  65. package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
  66. package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
  67. package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
  68. package/skills/ae-analysis/references/bad_case_review.md +4 -4
  69. package/skills/ae-analysis/references/command_index.md +7 -7
  70. package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
  71. package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
  72. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
  73. package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
  74. package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
  75. package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
  76. package/skills/ae-analysis/references/project_owner_update.md +5 -1
  77. package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
  78. package/skills/ae-analysis/references/scenario_list.md +5 -6
  79. package/skills/ae-capability/SKILL.md +8 -4
  80. package/skills/ae-kb/SKILL.md +4 -2
  81. package/skills/ae-kb/references/publication.md +45 -0
  82. package/dist/chunk-Y74WTIKJ.js +0 -10
@@ -1,23 +1,27 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
+ getLocalCliPackageInfo
4
+ } from "./chunk-PUSFEC6B.js";
5
+ import {
6
+ internalCallSourceHeaders,
3
7
  peekCliToken
4
- } from "./chunk-HTZ2MLYA.js";
8
+ } from "./chunk-PLNS5J33.js";
5
9
  import {
6
10
  getActiveHost,
7
11
  getConfigDir,
8
12
  isAeSandboxRuntime,
9
13
  readSandboxCliTokenEntry
10
- } from "./chunk-4PSTYEG5.js";
14
+ } from "./chunk-AMURHMS3.js";
11
15
  import {
12
16
  PermissionError,
13
17
  externalCliTokenRequestOptions,
14
18
  normalizeUrl,
15
19
  readExternalCliToken
16
- } from "./chunk-Z3Q2AEIN.js";
20
+ } from "./chunk-R2SVAO4G.js";
17
21
 
18
22
  // src/core/compat-check.ts
19
- import fs11 from "fs";
20
- import path11 from "path";
23
+ import fs10 from "fs";
24
+ import path10 from "path";
21
25
  import { createHash as createHash3 } from "crypto";
22
26
  import { Agent } from "undici";
23
27
 
@@ -307,45 +311,21 @@ function formatCompatNotice(verdict) {
307
311
  }
308
312
 
309
313
  // src/core/version-sync.ts
310
- import fs9 from "fs";
311
- import path9 from "path";
312
-
313
- // src/core/installation.ts
314
314
  import fs8 from "fs";
315
315
  import path8 from "path";
316
- import crypto3 from "crypto";
317
316
 
318
- // src/core/package-info.ts
319
- import fs2 from "fs";
320
- import path2 from "path";
321
- import { fileURLToPath } from "url";
322
- function getLocalCliPackageInfo() {
323
- let dir = path2.dirname(fileURLToPath(import.meta.url));
324
- for (let i = 0; i < 8; i += 1) {
325
- const candidate = path2.join(dir, "package.json");
326
- try {
327
- if (fs2.existsSync(candidate)) {
328
- const pkg = JSON.parse(fs2.readFileSync(candidate, "utf8"));
329
- if (pkg.name && pkg.version && String(pkg.name).includes("ae-cli")) {
330
- return { name: pkg.name, version: pkg.version, root: dir };
331
- }
332
- }
333
- } catch {
334
- }
335
- const parent = path2.dirname(dir);
336
- if (parent === dir) break;
337
- dir = parent;
338
- }
339
- return { name: "@tant/ae-cli", version: "0.0.0", root: "" };
340
- }
317
+ // src/core/installation.ts
318
+ import fs7 from "fs";
319
+ import path7 from "path";
320
+ import crypto3 from "crypto";
341
321
 
342
322
  // src/core/skills-install.ts
343
- import fs3 from "fs";
323
+ import fs2 from "fs";
344
324
  import os from "os";
345
- import path3 from "path";
325
+ import path2 from "path";
346
326
  import { parseDocument } from "yaml";
347
327
  function globalSkillsDirectory() {
348
- return path3.join(os.homedir(), ".agents", "skills");
328
+ return path2.join(os.homedir(), ".agents", "skills");
349
329
  }
350
330
  function skillName(content) {
351
331
  const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
@@ -357,30 +337,30 @@ function skillName(content) {
357
337
  return data.name;
358
338
  }
359
339
  function readFiles(root, prefix = "", files = /* @__PURE__ */ new Map()) {
360
- for (const entry of fs3.readdirSync(path3.join(root, prefix), { withFileTypes: true })) {
340
+ for (const entry of fs2.readdirSync(path2.join(root, prefix), { withFileTypes: true })) {
361
341
  if (entry.name.startsWith(".") || ["metadata.json", "__pycache__", "__pypackages__"].includes(entry.name)) continue;
362
- const relative = path3.join(prefix, entry.name);
342
+ const relative = path2.join(prefix, entry.name);
363
343
  if (entry.isSymbolicLink()) throw new Error("Bundled Skills must contain regular files.");
364
344
  if (entry.isDirectory()) readFiles(root, relative, files);
365
- else if (entry.isFile()) files.set(relative, fs3.readFileSync(path3.join(root, relative)));
345
+ else if (entry.isFile()) files.set(relative, fs2.readFileSync(path2.join(root, relative)));
366
346
  }
367
347
  return files;
368
348
  }
369
349
  function readBundledSkills(directory, select) {
370
- const entries = fs3.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
350
+ const entries = fs2.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
371
351
  const names = /* @__PURE__ */ new Set();
372
352
  const skills = entries.flatMap((entry) => {
373
353
  try {
374
354
  let selectedName;
375
355
  if (select) {
376
- const header = path3.join(directory, entry.name, "SKILL.md");
377
- if (!fs3.lstatSync(header).isFile()) throw new Error("Bundled Skill metadata must be a regular file.");
378
- selectedName = skillName(fs3.readFileSync(header, "utf8"));
356
+ const header = path2.join(directory, entry.name, "SKILL.md");
357
+ if (!fs2.lstatSync(header).isFile()) throw new Error("Bundled Skill metadata must be a regular file.");
358
+ selectedName = skillName(fs2.readFileSync(header, "utf8"));
379
359
  if (names.has(selectedName)) throw new Error("Duplicate bundled Skill name.");
380
360
  names.add(selectedName);
381
361
  if (!select(selectedName)) return [];
382
362
  }
383
- const files = readFiles(path3.join(directory, entry.name));
363
+ const files = readFiles(path2.join(directory, entry.name));
384
364
  const name = skillName(files.get("SKILL.md").toString("utf8"));
385
365
  if (selectedName !== void 0 && selectedName !== name) throw new Error("Bundled Skill metadata changed.");
386
366
  return [{ name, files }];
@@ -398,12 +378,12 @@ function verifyGlobalSkills(skills, directory) {
398
378
  return skills.flatMap((skill) => {
399
379
  let reason = "";
400
380
  try {
401
- const target = path3.join(directory, skill.name);
402
- if (skillName(fs3.readFileSync(path3.join(target, "SKILL.md"), "utf8")) !== skill.name) {
381
+ const target = path2.join(directory, skill.name);
382
+ if (skillName(fs2.readFileSync(path2.join(target, "SKILL.md"), "utf8")) !== skill.name) {
403
383
  reason = "Installed Skill name does not match the bundled Skill.";
404
384
  } else {
405
385
  for (const [file, expected] of skill.files) {
406
- if (!fs3.readFileSync(path3.join(target, file)).equals(expected)) {
386
+ if (!fs2.readFileSync(path2.join(target, file)).equals(expected)) {
407
387
  reason = "Installed files do not match the CLI package version.";
408
388
  break;
409
389
  }
@@ -418,8 +398,8 @@ function verifyGlobalSkills(skills, directory) {
418
398
 
419
399
  // src/core/business-config.ts
420
400
  import crypto2 from "crypto";
421
- import fs7 from "fs";
422
- import path7 from "path";
401
+ import fs6 from "fs";
402
+ import path6 from "path";
423
403
 
424
404
  // src/core/skill-businesses.json
425
405
  var skill_businesses_default = {
@@ -599,19 +579,19 @@ function canManageGlobalSkills() {
599
579
 
600
580
  // src/core/business-skill-refresh.ts
601
581
  import crypto from "crypto";
602
- import fs6 from "fs";
603
- import path6 from "path";
582
+ import fs5 from "fs";
583
+ import path5 from "path";
604
584
 
605
585
  // src/core/business-skill-sync.ts
606
- import fs5 from "fs";
586
+ import fs4 from "fs";
607
587
  import os3 from "os";
608
- import path5 from "path";
588
+ import path4 from "path";
609
589
  import { createHash as createHash2, randomUUID } from "crypto";
610
590
 
611
591
  // src/core/skills-tool.ts
612
- import fs4 from "fs";
592
+ import fs3 from "fs";
613
593
  import os2 from "os";
614
- import path4 from "path";
594
+ import path3 from "path";
615
595
  import { createHash } from "crypto";
616
596
  import { createRequire, isBuiltin } from "module";
617
597
  import { pathToFileURL } from "url";
@@ -620,12 +600,12 @@ var MANAGED_SKILLS_TOOL_VERSION = "1.5.12";
620
600
  var TOOL_SOURCE_SHA256 = "5a2c18ddd70886d5367e39a0f88827ffd1024420e4d9db08149742386c088d2d";
621
601
  function skillPathIdentity(file) {
622
602
  try {
623
- const stat = fs4.lstatSync(file, { bigint: true });
603
+ const stat = fs3.lstatSync(file, { bigint: true });
624
604
  return {
625
605
  dev: String(stat.dev),
626
606
  ino: String(stat.ino),
627
607
  type: stat.isSymbolicLink() ? "symlink" : stat.isDirectory() ? "directory" : stat.isFile() ? "file" : "other",
628
- ...stat.isSymbolicLink() ? { link: fs4.readlinkSync(file) } : {}
608
+ ...stat.isSymbolicLink() ? { link: fs3.readlinkSync(file) } : {}
629
609
  };
630
610
  } catch (error) {
631
611
  if (error.code === "ENOENT") return null;
@@ -634,28 +614,28 @@ function skillPathIdentity(file) {
634
614
  }
635
615
  function realSkillPath(file) {
636
616
  try {
637
- return fs4.realpathSync(file);
617
+ return fs3.realpathSync(file);
638
618
  } catch (error) {
639
619
  if (error.code !== "ENOENT") throw error;
640
- const parent = path4.dirname(file);
620
+ const parent = path3.dirname(file);
641
621
  if (parent === file) throw error;
642
- return path4.join(realSkillPath(parent), path4.basename(file));
622
+ return path3.join(realSkillPath(parent), path3.basename(file));
643
623
  }
644
624
  }
645
625
  function skillPathProblem(targetDirectory, skill, sourceRoot) {
646
626
  try {
647
- const target = realSkillPath(path4.resolve(targetDirectory, skill));
648
- const source = realSkillPath(path4.resolve(sourceRoot));
649
- const overlaps = (a, b) => a === b || a.startsWith(b + path4.sep);
627
+ const target = realSkillPath(path3.resolve(targetDirectory, skill));
628
+ const source = realSkillPath(path3.resolve(sourceRoot));
629
+ const overlaps = (a, b) => a === b || a.startsWith(b + path3.sep);
650
630
  if (overlaps(target, source) || overlaps(source, target)) return "package_source_overlap";
651
- let parent = path4.resolve(targetDirectory);
631
+ let parent = path3.resolve(targetDirectory);
652
632
  while (true) {
653
633
  try {
654
- if (fs4.lstatSync(parent).isSymbolicLink()) return "copy_parent_linked";
634
+ if (fs3.lstatSync(parent).isSymbolicLink()) return "copy_parent_linked";
655
635
  } catch (error) {
656
636
  if (error.code !== "ENOENT") throw error;
657
637
  }
658
- const next = path4.dirname(parent);
638
+ const next = path3.dirname(parent);
659
639
  if (next === parent) return null;
660
640
  parent = next;
661
641
  }
@@ -665,27 +645,27 @@ function skillPathProblem(targetDirectory, skill, sourceRoot) {
665
645
  }
666
646
  function skillCopyHash(directory, source = false) {
667
647
  try {
668
- if (!fs4.lstatSync(directory).isDirectory()) throw new Error("Not a regular Skill directory.");
648
+ if (!fs3.lstatSync(directory).isDirectory()) throw new Error("Not a regular Skill directory.");
669
649
  } catch (error) {
670
650
  if (error.code === "ENOENT") return null;
671
651
  throw error;
672
652
  }
673
653
  const hash = createHash("sha256");
674
654
  const visit = (relative) => {
675
- for (const name of fs4.readdirSync(path4.join(directory, relative)).sort()) {
655
+ for (const name of fs3.readdirSync(path3.join(directory, relative)).sort()) {
676
656
  if (name === ".DS_Store") continue;
677
- const child = path4.join(relative, name);
678
- const absolute = path4.join(directory, child);
679
- const stat = fs4.lstatSync(absolute);
657
+ const child = path3.join(relative, name);
658
+ const absolute = path3.join(directory, child);
659
+ const stat = fs3.lstatSync(absolute);
680
660
  if (source && (name === "metadata.json" || stat.isDirectory() && [".git", "__pycache__", "__pypackages__"].includes(name))) continue;
681
- const normalized = child.split(path4.sep).join("/");
661
+ const normalized = child.split(path3.sep).join("/");
682
662
  if (stat.isSymbolicLink()) throw new Error("Symbolic links are not managed Skill copies.");
683
663
  if (stat.isDirectory()) {
684
664
  hash.update(`directory:${normalized}\0`);
685
665
  visit(child);
686
666
  } else if (stat.isFile()) {
687
667
  hash.update(`file:${normalized}\0${stat.size}\0`);
688
- hash.update(fs4.readFileSync(absolute));
668
+ hash.update(fs3.readFileSync(absolute));
689
669
  } else throw new Error("Unsupported Skill file type.");
690
670
  }
691
671
  };
@@ -742,7 +722,7 @@ function adaptedToolSource(source, entry) {
742
722
  );
743
723
  source = replaceOnce(source, "main().finally(() => flushTelemetry().then(() => process.exit(0)));", "");
744
724
  const require2 = createRequire(entry);
745
- const resolveImport = (specifier) => isBuiltin(specifier) ? specifier : pathToFileURL(specifier.startsWith(".") ? path4.resolve(path4.dirname(entry), specifier) : require2.resolve(specifier)).href;
725
+ const resolveImport = (specifier) => isBuiltin(specifier) ? specifier : pathToFileURL(specifier.startsWith(".") ? path3.resolve(path3.dirname(entry), specifier) : require2.resolve(specifier)).href;
746
726
  source = source.replace(
747
727
  /\bfrom (['"])([^'"]+)\1/g,
748
728
  (_match, quote, specifier) => `from ${quote}${resolveImport(specifier)}${quote}`
@@ -952,19 +932,19 @@ catch { process.stdout.write(JSON.stringify({ ok: false })); process.exitCode =
952
932
  `;
953
933
  function createPinnedSkillsTool(options = {}) {
954
934
  const require2 = createRequire(import.meta.url);
955
- const packageFile = options.entry ? path4.join(path4.dirname(options.entry), "..", "package.json") : require2.resolve("skills/package.json");
956
- const entry = options.entry ?? path4.join(path4.dirname(packageFile), "dist", "cli.mjs");
957
- const metadata = JSON.parse(fs4.readFileSync(packageFile, "utf8"));
958
- const source = fs4.readFileSync(entry, "utf8");
935
+ const packageFile = options.entry ? path3.join(path3.dirname(options.entry), "..", "package.json") : require2.resolve("skills/package.json");
936
+ const entry = options.entry ?? path3.join(path3.dirname(packageFile), "dist", "cli.mjs");
937
+ const metadata = JSON.parse(fs3.readFileSync(packageFile, "utf8"));
938
+ const source = fs3.readFileSync(entry, "utf8");
959
939
  if (metadata.version !== MANAGED_SKILLS_TOOL_VERSION || createHash("sha256").update(source).digest("hex") !== TOOL_SOURCE_SHA256) {
960
940
  throw new Error("Managed Skill synchronization requires the verified skills@1.5.12 package.");
961
941
  }
962
942
  const script = adaptedToolSource(source, entry);
963
943
  const run = (request) => {
964
- const directory = fs4.mkdtempSync(path4.join(os2.tmpdir(), "ae-cli-skills-tool-"));
965
- const worker = path4.join(directory, "adapter.mjs");
944
+ const directory = fs3.mkdtempSync(path3.join(os2.tmpdir(), "ae-cli-skills-tool-"));
945
+ const worker = path3.join(directory, "adapter.mjs");
966
946
  try {
967
- fs4.writeFileSync(worker, script, { mode: 384 });
947
+ fs3.writeFileSync(worker, script, { mode: 384 });
968
948
  const result2 = spawn2.sync(process.execPath, [worker], {
969
949
  input: JSON.stringify(request),
970
950
  encoding: "utf8",
@@ -981,7 +961,7 @@ function createPinnedSkillsTool(options = {}) {
981
961
  } catch {
982
962
  throw new Error("Skills adapter failed. Check the pinned package and directory permissions.");
983
963
  } finally {
984
- fs4.rmSync(directory, { recursive: true, force: true });
964
+ fs3.rmSync(directory, { recursive: true, force: true });
985
965
  }
986
966
  };
987
967
  return {
@@ -998,17 +978,17 @@ var POLICY_HASH = createHash2("sha256").update(JSON.stringify({ removal_policy:
998
978
  function historicalCliSkills(options) {
999
979
  const env = options.env ?? process.env;
1000
980
  const home = env.HOME || env.USERPROFILE || os3.homedir();
1001
- const file = env.XDG_STATE_HOME ? path5.join(env.XDG_STATE_HOME, "skills", ".skill-lock.json") : path5.join(home, ".agents", ".skill-lock.json");
981
+ const file = env.XDG_STATE_HOME ? path4.join(env.XDG_STATE_HOME, "skills", ".skill-lock.json") : path4.join(home, ".agents", ".skill-lock.json");
1002
982
  const names = /* @__PURE__ */ new Set();
1003
983
  let content = "";
1004
984
  const isCliSource = (value, type) => {
1005
985
  if (typeof value !== "string") return false;
1006
- if (type === "local" && path5.isAbsolute(value)) {
1007
- const source2 = path5.resolve(value);
1008
- if (source2 === path5.resolve(options.skillsDirectory)) return true;
1009
- if (path5.basename(source2) !== "skills") return false;
986
+ if (type === "local" && path4.isAbsolute(value)) {
987
+ const source2 = path4.resolve(value);
988
+ if (source2 === path4.resolve(options.skillsDirectory)) return true;
989
+ if (path4.basename(source2) !== "skills") return false;
1010
990
  try {
1011
- const pkg = JSON.parse(fs5.readFileSync(path5.join(source2, "..", "package.json"), "utf8"));
991
+ const pkg = JSON.parse(fs4.readFileSync(path4.join(source2, "..", "package.json"), "utf8"));
1012
992
  return ["@tant/ae-cli", "@thinkingai/ae-cli"].includes(pkg.name) && typeof pkg.bin?.["ae-cli"] === "string";
1013
993
  } catch {
1014
994
  return false;
@@ -1026,7 +1006,7 @@ function historicalCliSkills(options) {
1026
1006
  ].includes(source);
1027
1007
  };
1028
1008
  try {
1029
- content = fs5.readFileSync(file, "utf8");
1009
+ content = fs4.readFileSync(file, "utf8");
1030
1010
  const lock = JSON.parse(content);
1031
1011
  const mapped = new Set(Object.values(skill_businesses_default).flat());
1032
1012
  if (typeof lock.version === "number" && lock.skills && typeof lock.skills === "object") {
@@ -1043,11 +1023,11 @@ function historicalCliSkills(options) {
1043
1023
  function writeJson(file, value) {
1044
1024
  const temporary = `${file}.${process.pid}.${randomUUID()}.tmp`;
1045
1025
  try {
1046
- fs5.writeFileSync(temporary, JSON.stringify(value, null, 2) + "\n", { mode: 384, flag: "wx" });
1047
- fs5.renameSync(temporary, file);
1026
+ fs4.writeFileSync(temporary, JSON.stringify(value, null, 2) + "\n", { mode: 384, flag: "wx" });
1027
+ fs4.renameSync(temporary, file);
1048
1028
  } finally {
1049
1029
  try {
1050
- fs5.unlinkSync(temporary);
1030
+ fs4.unlinkSync(temporary);
1051
1031
  } catch {
1052
1032
  }
1053
1033
  }
@@ -1067,15 +1047,15 @@ function contextIdentity(options) {
1067
1047
  }
1068
1048
  function reserveBusinessSkillContext(options) {
1069
1049
  const directory = options.stateDirectory ?? getConfigDir();
1070
- fs5.mkdirSync(directory, { recursive: true, mode: 448 });
1050
+ fs4.mkdirSync(directory, { recursive: true, mode: 448 });
1071
1051
  const generation = randomUUID();
1072
- writeJson(path5.join(directory, CONTEXT_FILE), { ...contextIdentity(options), generation });
1052
+ writeJson(path4.join(directory, CONTEXT_FILE), { ...contextIdentity(options), generation });
1073
1053
  return generation;
1074
1054
  }
1075
1055
  function currentContext(options, file, generation) {
1076
1056
  try {
1077
1057
  if (options.isCurrentContext && !options.isCurrentContext()) return false;
1078
- const active = JSON.parse(fs5.readFileSync(file, "utf8"));
1058
+ const active = JSON.parse(fs4.readFileSync(file, "utf8"));
1079
1059
  const identity = contextIdentity(options);
1080
1060
  return active.generation === generation && active.host === identity.host && active.token_fingerprint === identity.token_fingerprint;
1081
1061
  } catch {
@@ -1083,12 +1063,12 @@ function currentContext(options, file, generation) {
1083
1063
  }
1084
1064
  }
1085
1065
  function isBusinessSkillContextCurrent(options) {
1086
- return currentContext(options, path5.join(options.stateDirectory ?? getConfigDir(), CONTEXT_FILE), options.generation);
1066
+ return currentContext(options, path4.join(options.stateDirectory ?? getConfigDir(), CONTEXT_FILE), options.generation);
1087
1067
  }
1088
1068
  function takeLock(file) {
1089
1069
  const owner = randomUUID();
1090
1070
  const ownerName = `owner-${process.pid}-${owner}.json`;
1091
- const candidate = fs5.mkdtempSync(`${file}.candidate-`);
1071
+ const candidate = fs4.mkdtempSync(`${file}.candidate-`);
1092
1072
  const alive = (pid) => {
1093
1073
  try {
1094
1074
  process.kill(pid, 0);
@@ -1098,29 +1078,29 @@ function takeLock(file) {
1098
1078
  }
1099
1079
  };
1100
1080
  try {
1101
- fs5.chmodSync(candidate, 448);
1102
- fs5.writeFileSync(path5.join(candidate, ownerName), JSON.stringify({ pid: process.pid, owner }), { mode: 384 });
1081
+ fs4.chmodSync(candidate, 448);
1082
+ fs4.writeFileSync(path4.join(candidate, ownerName), JSON.stringify({ pid: process.pid, owner }), { mode: 384 });
1103
1083
  for (let attempt = 0; attempt < 4; attempt++) {
1104
1084
  try {
1105
- fs5.renameSync(candidate, file);
1085
+ fs4.renameSync(candidate, file);
1106
1086
  try {
1107
- fs5.unlinkSync(`${file}.reclaim`);
1087
+ fs4.unlinkSync(`${file}.reclaim`);
1108
1088
  } catch {
1109
1089
  }
1110
1090
  return () => {
1111
1091
  try {
1112
- fs5.unlinkSync(path5.join(file, ownerName));
1092
+ fs4.unlinkSync(path4.join(file, ownerName));
1113
1093
  } catch {
1114
1094
  }
1115
1095
  try {
1116
- fs5.rmdirSync(file);
1096
+ fs4.rmdirSync(file);
1117
1097
  } catch {
1118
1098
  }
1119
1099
  };
1120
1100
  } catch (error) {
1121
1101
  let stat;
1122
1102
  try {
1123
- stat = fs5.lstatSync(file);
1103
+ stat = fs4.lstatSync(file);
1124
1104
  } catch (cause) {
1125
1105
  if (cause.code === "ENOENT") continue;
1126
1106
  throw error;
@@ -1129,12 +1109,12 @@ function takeLock(file) {
1129
1109
  if (stat.isFile()) {
1130
1110
  let pid;
1131
1111
  try {
1132
- pid = JSON.parse(fs5.readFileSync(file, "utf8")).pid;
1112
+ pid = JSON.parse(fs4.readFileSync(file, "utf8")).pid;
1133
1113
  } catch {
1134
1114
  }
1135
1115
  if (typeof pid === "number" && Number.isInteger(pid) && pid > 0 && alive(pid)) return null;
1136
1116
  try {
1137
- fs5.unlinkSync(file);
1117
+ fs4.unlinkSync(file);
1138
1118
  } catch (cause) {
1139
1119
  if (!["ENOENT", "EISDIR", "EPERM"].includes(cause.code ?? "")) throw cause;
1140
1120
  }
@@ -1143,7 +1123,7 @@ function takeLock(file) {
1143
1123
  if (!stat.isDirectory()) return null;
1144
1124
  let names;
1145
1125
  try {
1146
- names = fs5.readdirSync(file);
1126
+ names = fs4.readdirSync(file);
1147
1127
  } catch (cause) {
1148
1128
  if (cause.code === "ENOENT") continue;
1149
1129
  throw cause;
@@ -1154,13 +1134,13 @@ function takeLock(file) {
1154
1134
  }
1155
1135
  for (const name of names) {
1156
1136
  try {
1157
- fs5.unlinkSync(path5.join(file, name));
1137
+ fs4.unlinkSync(path4.join(file, name));
1158
1138
  } catch (cause) {
1159
1139
  if (cause.code !== "ENOENT") throw cause;
1160
1140
  }
1161
1141
  }
1162
1142
  try {
1163
- fs5.rmdirSync(file);
1143
+ fs4.rmdirSync(file);
1164
1144
  } catch (cause) {
1165
1145
  if (!["ENOENT", "ENOTEMPTY", "EEXIST"].includes(cause.code ?? "")) throw cause;
1166
1146
  }
@@ -1168,13 +1148,13 @@ function takeLock(file) {
1168
1148
  }
1169
1149
  return null;
1170
1150
  } finally {
1171
- fs5.rmSync(candidate, { recursive: true, force: true });
1151
+ fs4.rmSync(candidate, { recursive: true, force: true });
1172
1152
  }
1173
1153
  }
1174
1154
  function readLedger(file) {
1175
1155
  let value;
1176
1156
  try {
1177
- value = JSON.parse(fs5.readFileSync(file, "utf8"));
1157
+ value = JSON.parse(fs4.readFileSync(file, "utf8"));
1178
1158
  } catch (error) {
1179
1159
  if (error.code === "ENOENT") return { schema_version: 1, copies: {} };
1180
1160
  throw new Error("Managed Skill ledger is unreadable.");
@@ -1183,12 +1163,12 @@ function readLedger(file) {
1183
1163
  throw new Error("Managed Skill ledger has an unsupported format.");
1184
1164
  }
1185
1165
  for (const [filePath, copy] of Object.entries(value.copies)) {
1186
- if (!path5.isAbsolute(filePath) || !copy || typeof copy.skill !== "string" || typeof copy.agent !== "string" || !/^[a-f0-9]{64}$/.test(copy.hash) || typeof copy.package_version !== "string") throw new Error("Managed Skill ledger has an invalid copy.");
1166
+ if (!path4.isAbsolute(filePath) || !copy || typeof copy.skill !== "string" || typeof copy.agent !== "string" || !/^[a-f0-9]{64}$/.test(copy.hash) || typeof copy.package_version !== "string") throw new Error("Managed Skill ledger has an invalid copy.");
1187
1167
  }
1188
1168
  return value;
1189
1169
  }
1190
1170
  function result(skill, target, reason) {
1191
- return { skill, agent: target.agent, path: path5.join(target.directory, skill), ...reason ? { reason } : {} };
1171
+ return { skill, agent: target.agent, path: path4.join(target.directory, skill), ...reason ? { reason } : {} };
1192
1172
  }
1193
1173
  function directInstallerLink(file, target, text) {
1194
1174
  if (typeof text !== "string") return false;
@@ -1196,21 +1176,21 @@ function directInstallerLink(file, target, text) {
1196
1176
  if (process.platform === "win32") {
1197
1177
  if (value.toUpperCase().startsWith("\\\\?\\UNC\\")) value = "\\\\" + value.slice(8);
1198
1178
  else if (value.startsWith("\\\\?\\") || value.startsWith("\\??\\")) value = value.slice(4);
1199
- return [target, path5.relative(path5.dirname(file), target)].some((expected) => value.toLowerCase() === expected.toLowerCase());
1179
+ return [target, path4.relative(path4.dirname(file), target)].some((expected) => value.toLowerCase() === expected.toLowerCase());
1200
1180
  }
1201
- return value === target || value === path5.relative(path5.dirname(file), target);
1181
+ return value === target || value === path4.relative(path4.dirname(file), target);
1202
1182
  }
1203
1183
  function legacySkillLink(file, skill, sourceRoot, sourceHash, targets, ledger, removing = false) {
1204
1184
  const canonical = targets.find((target2) => target2.agent === "universal");
1205
1185
  if (!canonical) return;
1206
- const target = path5.join(canonical.directory, skill);
1186
+ const target = path4.join(canonical.directory, skill);
1207
1187
  const managed = ledger.copies[target];
1208
1188
  if (!managed || managed.skill !== skill || managed.agent !== canonical.agent || !removing && managed.hash !== sourceHash || skillPathProblem(canonical.directory, skill, sourceRoot)) return;
1209
1189
  try {
1210
- if (!fs5.lstatSync(file).isSymbolicLink()) return;
1211
- const text = fs5.readlinkSync(file);
1190
+ if (!fs4.lstatSync(file).isSymbolicLink()) return;
1191
+ const text = fs4.readlinkSync(file);
1212
1192
  if (!directInstallerLink(file, target, text)) return;
1213
- if (!removing && (skillCopyHash(target) !== sourceHash || fs5.realpathSync(file) !== fs5.realpathSync(target))) return;
1193
+ if (!removing && (skillCopyHash(target) !== sourceHash || fs4.realpathSync(file) !== fs4.realpathSync(target))) return;
1214
1194
  return { target, text };
1215
1195
  } catch {
1216
1196
  return;
@@ -1227,20 +1207,20 @@ function syncBusinessSkills(options) {
1227
1207
  managed_count: 0
1228
1208
  };
1229
1209
  const directory = options.stateDirectory ?? getConfigDir();
1230
- const contextFile = path5.join(directory, CONTEXT_FILE);
1210
+ const contextFile = path4.join(directory, CONTEXT_FILE);
1231
1211
  let unlock = null;
1232
1212
  try {
1233
1213
  if (options.isCurrentContext && !options.isCurrentContext()) {
1234
1214
  report.status = "stale";
1235
1215
  return report;
1236
1216
  }
1237
- fs5.mkdirSync(directory, { recursive: true, mode: 448 });
1217
+ fs4.mkdirSync(directory, { recursive: true, mode: 448 });
1238
1218
  const generation = options.generation ?? reserveBusinessSkillContext(options);
1239
1219
  if (!currentContext(options, contextFile, generation)) {
1240
1220
  report.status = "stale";
1241
1221
  return report;
1242
1222
  }
1243
- unlock = takeLock(path5.join(directory, LOCK_FILE));
1223
+ unlock = takeLock(path4.join(directory, LOCK_FILE));
1244
1224
  if (!unlock) {
1245
1225
  report.status = "busy";
1246
1226
  return report;
@@ -1249,7 +1229,7 @@ function syncBusinessSkills(options) {
1249
1229
  report.status = "stale";
1250
1230
  return report;
1251
1231
  }
1252
- const ledgerFile = path5.join(directory, LEDGER_FILE);
1232
+ const ledgerFile = path4.join(directory, LEDGER_FILE);
1253
1233
  const ledger = readLedger(ledgerFile);
1254
1234
  const packageVersion = options.packageVersion ?? "unknown";
1255
1235
  const history = historicalCliSkills(options);
@@ -1257,7 +1237,7 @@ function syncBusinessSkills(options) {
1257
1237
  ...contextIdentity(options),
1258
1238
  package_version: packageVersion,
1259
1239
  businesses: normalizeBusinesses(options.businesses),
1260
- source_root: fs5.realpathSync(options.skillsDirectory),
1240
+ source_root: fs4.realpathSync(options.skillsDirectory),
1261
1241
  policy_hash: POLICY_HASH,
1262
1242
  history_hash: history.hash
1263
1243
  };
@@ -1303,7 +1283,7 @@ function syncBusinessSkills(options) {
1303
1283
  for (const name of skills) {
1304
1284
  const state = getSkillBusinessState(name, options.businesses);
1305
1285
  if (options.mode !== "adopt" && state === void 0) continue;
1306
- const source = path5.join(options.skillsDirectory, name);
1286
+ const source = path4.join(options.skillsDirectory, name);
1307
1287
  const sourceHash = bundled.some((skill) => skill.name === name) ? skillCopyHash(source, true) : null;
1308
1288
  if (!sourceHash && options.mode === "adopt") throw new Error("Complete package Skill source is missing.");
1309
1289
  for (const target of targets) {
@@ -1328,7 +1308,7 @@ function syncBusinessSkills(options) {
1328
1308
  }
1329
1309
  const legacyLink2 = node.type === "symlink" ? legacySkillLink(item.path, name, options.skillsDirectory, sourceHash ?? "", targets, ledger, true) : void 0;
1330
1310
  const canonical = targets.find((copy) => copy.agent === "universal");
1331
- const historicalLink = node.type === "symlink" && canonical && directInstallerLink(item.path, path5.join(canonical.directory, name), node.link);
1311
+ const historicalLink = node.type === "symlink" && canonical && directInstallerLink(item.path, path4.join(canonical.directory, name), node.link);
1332
1312
  const historicalCopy = history.names.has(name) && (target.agent === "universal" && node.type !== "symlink" || historicalLink);
1333
1313
  if (!managed && (legacyLink2 || historicalCopy)) {
1334
1314
  ledger.copies[item.path] = {
@@ -1398,7 +1378,7 @@ function syncBusinessSkills(options) {
1398
1378
  if (managed) delete ledger.copies[item.path];
1399
1379
  continue;
1400
1380
  }
1401
- if (actualHash === null && !target.detected && !managed && !fs5.existsSync(target.directory)) continue;
1381
+ if (actualHash === null && !target.detected && !managed && !fs4.existsSync(target.directory)) continue;
1402
1382
  operations.push({
1403
1383
  action: "install",
1404
1384
  skill: name,
@@ -1491,8 +1471,8 @@ function syncRefreshedBusinessSkills(refresh, businesses) {
1491
1471
  if (!Object.keys(states).length) return;
1492
1472
  try {
1493
1473
  const pkg = getLocalCliPackageInfo();
1494
- const options = { ...refresh, skillsDirectory: path6.join(pkg.root, "skills"), businesses: states, packageVersion: pkg.version };
1495
- if (!fs6.existsSync(path6.join(getConfigDir(), "business-skills.json"))) {
1474
+ const options = { ...refresh, skillsDirectory: path5.join(pkg.root, "skills"), businesses: states, packageVersion: pkg.version };
1475
+ if (!fs5.existsSync(path5.join(getConfigDir(), "business-skills.json"))) {
1496
1476
  const adoption = syncBusinessSkills({ ...options, mode: "adopt" });
1497
1477
  if (["failed", "busy", "stale"].includes(adoption.status)) {
1498
1478
  if (adoption.status !== "stale") process.stderr.write("[ae-cli] Skills could not be synchronized. Retry: ae-cli config refresh\n");
@@ -1512,14 +1492,14 @@ function syncRefreshedBusinessSkills(refresh, businesses) {
1512
1492
  var BUSINESS_CONFIG_TTL_MS = 10 * 60 * 1e3;
1513
1493
  var UNAVAILABLE_TTL_MS = 5 * 60 * 1e3;
1514
1494
  function cachePath() {
1515
- return path7.join(getConfigDir(), "business-config.json");
1495
+ return path6.join(getConfigDir(), "business-config.json");
1516
1496
  }
1517
1497
  function cacheKey(host, token) {
1518
1498
  return `${normalizeUrl(host)}#${crypto2.createHash("sha256").update(token).digest("hex")}`;
1519
1499
  }
1520
1500
  function readStore() {
1521
1501
  try {
1522
- const value = JSON.parse(fs7.readFileSync(cachePath(), "utf8"));
1502
+ const value = JSON.parse(fs6.readFileSync(cachePath(), "utf8"));
1523
1503
  if (value?.entries && typeof value.entries === "object" && !Array.isArray(value.entries)) return value;
1524
1504
  } catch {
1525
1505
  }
@@ -1531,13 +1511,13 @@ function remember(host, token, entry) {
1531
1511
  const target = cachePath();
1532
1512
  const temporary = `${target}.${process.pid}.${crypto2.randomBytes(6).toString("hex")}.tmp`;
1533
1513
  try {
1534
- fs7.mkdirSync(path7.dirname(target), { recursive: true });
1535
- fs7.writeFileSync(temporary, JSON.stringify(store), { encoding: "utf8", mode: 384 });
1536
- fs7.renameSync(temporary, target);
1537
- fs7.chmodSync(target, 384);
1514
+ fs6.mkdirSync(path6.dirname(target), { recursive: true });
1515
+ fs6.writeFileSync(temporary, JSON.stringify(store), { encoding: "utf8", mode: 384 });
1516
+ fs6.renameSync(temporary, target);
1517
+ fs6.chmodSync(target, 384);
1538
1518
  } catch {
1539
1519
  try {
1540
- fs7.rmSync(temporary, { force: true });
1520
+ fs6.rmSync(temporary, { force: true });
1541
1521
  } catch {
1542
1522
  }
1543
1523
  }
@@ -1606,7 +1586,7 @@ async function readBusinessConfigForExecution(hostOverride, synchronizeSkills =
1606
1586
  const token = peekCliToken(host);
1607
1587
  if (!token) return {};
1608
1588
  return await resolveBusinessConfig(host, token, async () => {
1609
- const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-XD2U7PZ2.js");
1589
+ const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-W4XC27RG.js");
1610
1590
  return fetchCliConfig2(host, token);
1611
1591
  }, Date.now(), synchronizeSkills);
1612
1592
  } catch {
@@ -1654,7 +1634,7 @@ function failInstallation(report, stage, message, cause = "validation") {
1654
1634
  function installPlan(packageName, version, root = "<npm-root>") {
1655
1635
  const config = distribution(packageName);
1656
1636
  const target = exactVersion(version);
1657
- const executable = path8.join(root, packageName, "bin", "ae-cli.js");
1637
+ const executable = path7.join(root, packageName, "bin", "ae-cli.js");
1658
1638
  return [
1659
1639
  `npm install -g ${packageName}@${target} --registry=${config.registry}`,
1660
1640
  `node ${JSON.stringify(executable)} install`
@@ -1674,27 +1654,27 @@ function skipGlobalSkillReason() {
1674
1654
  }
1675
1655
  function readPackage(root) {
1676
1656
  try {
1677
- return JSON.parse(fs8.readFileSync(path8.join(root, "package.json"), "utf8"));
1657
+ return JSON.parse(fs7.readFileSync(path7.join(root, "package.json"), "utf8"));
1678
1658
  } catch {
1679
1659
  return null;
1680
1660
  }
1681
1661
  }
1682
1662
  function linked(root) {
1683
1663
  try {
1684
- return fs8.lstatSync(root).isSymbolicLink();
1664
+ return fs7.lstatSync(root).isSymbolicLink();
1685
1665
  } catch {
1686
1666
  return false;
1687
1667
  }
1688
1668
  }
1689
1669
  function cliBinBelongsToPackage(bin, packageRoot, platform) {
1690
- const entry = fs8.realpathSync(path8.join(packageRoot, "bin", "ae-cli.js"));
1691
- if (platform !== "win32") return fs8.realpathSync(bin) === entry;
1692
- const shim = fs8.readFileSync(bin, "utf8");
1670
+ const entry = fs7.realpathSync(path7.join(packageRoot, "bin", "ae-cli.js"));
1671
+ if (platform !== "win32") return fs7.realpathSync(bin) === entry;
1672
+ const shim = fs7.readFileSync(bin, "utf8");
1693
1673
  const targets = [...shim.matchAll(/"%(?:dp0%|~dp0)[\\/]([^"\r\n]+)"/gi)];
1694
1674
  return targets.some(([, relative]) => {
1695
1675
  try {
1696
- const target = path8.resolve(path8.dirname(bin), relative.replace(/\\/g, path8.sep));
1697
- return fs8.realpathSync(target).toLowerCase() === entry.toLowerCase();
1676
+ const target = path7.resolve(path7.dirname(bin), relative.replace(/\\/g, path7.sep));
1677
+ return fs7.realpathSync(target).toLowerCase() === entry.toLowerCase();
1698
1678
  } catch {
1699
1679
  return false;
1700
1680
  }
@@ -1735,9 +1715,9 @@ function runInstallation(options = {}) {
1735
1715
  const prefixResult = runner(npm, ["prefix", "-g"], 15e3);
1736
1716
  const globalRoot = rootResult.stdout.trim();
1737
1717
  const prefix = prefixResult.stdout.trim();
1738
- if (!commandSucceeded(rootResult) || !commandSucceeded(prefixResult) || !path8.isAbsolute(globalRoot) || !path8.isAbsolute(prefix) || /[\r\n]/.test(globalRoot + prefix)) return failInstallation(report, stage, "Cannot resolve npm global root and prefix. Check npm configuration.");
1739
- const packageRoot = path8.join(globalRoot, packageName);
1740
- const bin = platform === "win32" ? path8.join(prefix, "ae-cli.cmd") : path8.join(prefix, "bin", "ae-cli");
1718
+ if (!commandSucceeded(rootResult) || !commandSucceeded(prefixResult) || !path7.isAbsolute(globalRoot) || !path7.isAbsolute(prefix) || /[\r\n]/.test(globalRoot + prefix)) return failInstallation(report, stage, "Cannot resolve npm global root and prefix. Check npm configuration.");
1719
+ const packageRoot = path7.join(globalRoot, packageName);
1720
+ const bin = platform === "win32" ? path7.join(prefix, "ae-cli.cmd") : path7.join(prefix, "bin", "ae-cli");
1741
1721
  report.cli.path = bin;
1742
1722
  const env = options.env ?? process.env;
1743
1723
  const installedBefore = readPackage(packageRoot);
@@ -1760,8 +1740,8 @@ function runInstallation(options = {}) {
1760
1740
  };
1761
1741
  const generation = reserveBusinessSkillContext({ ...identity, stateDirectory });
1762
1742
  context = { ...identity, stateDirectory, generation, isCurrentContext };
1763
- if (!fs8.existsSync(path8.join(stateDirectory, "business-skills.json")) && installedBefore?.name === packageName) {
1764
- const previousSkills = path8.join(packageRoot, "skills");
1743
+ if (!fs7.existsSync(path7.join(stateDirectory, "business-skills.json")) && installedBefore?.name === packageName) {
1744
+ const previousSkills = path7.join(packageRoot, "skills");
1765
1745
  try {
1766
1746
  readBundledSkills(previousSkills);
1767
1747
  syncSkills({ ...context, skillsDirectory: previousSkills, businesses: {}, mode: "adopt", packageVersion: installedBefore.version });
@@ -1773,7 +1753,7 @@ function runInstallation(options = {}) {
1773
1753
  return failInstallation(report, "skills_local", "The active environment changed before installation. Re-run install or update for the current environment.");
1774
1754
  }
1775
1755
  }
1776
- if (options.skipCliInstall || installedBefore?.name === packageName && installedBefore.version === target && fs8.existsSync(bin)) {
1756
+ if (options.skipCliInstall || installedBefore?.name === packageName && installedBefore.version === target && fs7.existsSync(bin)) {
1777
1757
  report.cli.action = "skipped";
1778
1758
  progress("[ae-cli] [2/4] Verifying the existing CLI...");
1779
1759
  } else {
@@ -1786,16 +1766,16 @@ function runInstallation(options = {}) {
1786
1766
  stage = "package_validation";
1787
1767
  const installed = readPackage(packageRoot);
1788
1768
  if (installed?.name !== packageName || installed.version !== target) return failInstallation(report, stage, "Installed CLI package identity or version does not match the requested distribution.");
1789
- if (!fs8.existsSync(bin)) return failInstallation(report, stage, "npm did not create the global ae-cli executable. Enable npm bin-links, reinstall, and add the global executable directory to PATH.");
1769
+ if (!fs7.existsSync(bin)) return failInstallation(report, stage, "npm did not create the global ae-cli executable. Enable npm bin-links, reinstall, and add the global executable directory to PATH.");
1790
1770
  if (!cliBinBelongsToPackage(bin, packageRoot, platform)) return failInstallation(report, stage, "The global executable does not belong to the installed CLI package.");
1791
1771
  const versionResult = runner(bin, ["--version"], 15e3);
1792
1772
  if (!commandSucceeded(versionResult) || versionResult.stdout.trim() !== target) return failInstallation(report, stage, "ae-cli --version did not return the requested version. Refresh the shell command cache and check npm bin links.");
1793
- report.cli.entrypoint = fs8.realpathSync(path8.join(packageRoot, "bin", "ae-cli.js"));
1773
+ report.cli.entrypoint = fs7.realpathSync(path7.join(packageRoot, "bin", "ae-cli.js"));
1794
1774
  report.cli.verified = true;
1795
1775
  const pathKey = platform === "win32" ? Object.keys(env).find((key) => key.toLowerCase() === "path") : "PATH";
1796
- const installedPathBin = (env[pathKey ?? "PATH"] ?? "").split(platform === "win32" ? ";" : path8.delimiter).filter(Boolean).map((dir) => path8.join(dir.replace(/^"(.*)"$/, "$1"), platform === "win32" ? "ae-cli.cmd" : "ae-cli")).find((file) => fs8.existsSync(file) && !file.includes(`${path8.sep}_npx${path8.sep}`));
1797
- if (!installedPathBin || fs8.realpathSync(installedPathBin) !== fs8.realpathSync(bin)) {
1798
- report.cli.warnings.push(`Add ${path8.dirname(bin)} to the front of PATH and refresh the shell command cache. The absolute executable was verified.`);
1776
+ const installedPathBin = (env[pathKey ?? "PATH"] ?? "").split(platform === "win32" ? ";" : path7.delimiter).filter(Boolean).map((dir) => path7.join(dir.replace(/^"(.*)"$/, "$1"), platform === "win32" ? "ae-cli.cmd" : "ae-cli")).find((file) => fs7.existsSync(file) && !file.includes(`${path7.sep}_npx${path7.sep}`));
1777
+ if (!installedPathBin || fs7.realpathSync(installedPathBin) !== fs7.realpathSync(bin)) {
1778
+ report.cli.warnings.push(`Add ${path7.dirname(bin)} to the front of PATH and refresh the shell command cache. The absolute executable was verified.`);
1799
1779
  report.next_steps.push(`Use the verified executable at ${bin}, or correct PATH before invoking ae-cli.`);
1800
1780
  }
1801
1781
  if (skipSkills) {
@@ -1804,7 +1784,7 @@ function runInstallation(options = {}) {
1804
1784
  progress(`[ae-cli] [3/4] ${skipSkills}`);
1805
1785
  } else if (context) {
1806
1786
  stage = "skills_local";
1807
- const skillsPath = path8.join(packageRoot, "skills");
1787
+ const skillsPath = path7.join(packageRoot, "skills");
1808
1788
  const skills = readBundledSkills(skillsPath);
1809
1789
  if (!isBusinessSkillContextCurrent(context)) {
1810
1790
  return failInstallation(report, stage, "The active environment changed during CLI installation. Re-run install or update to synchronize its Skills.");
@@ -1867,14 +1847,14 @@ var LOCK_STALE_MS = 10 * 60 * 1e3;
1867
1847
  var SYNC_STATE_FILE = "version-sync.json";
1868
1848
  var SYNC_LOCK_FILE = "version-sync.lock";
1869
1849
  function syncStatePath() {
1870
- return path9.join(getConfigDir(), SYNC_STATE_FILE);
1850
+ return path8.join(getConfigDir(), SYNC_STATE_FILE);
1871
1851
  }
1872
1852
  function syncLockPath() {
1873
- return path9.join(getConfigDir(), SYNC_LOCK_FILE);
1853
+ return path8.join(getConfigDir(), SYNC_LOCK_FILE);
1874
1854
  }
1875
1855
  function readSyncStore() {
1876
1856
  try {
1877
- const raw = JSON.parse(fs9.readFileSync(syncStatePath(), "utf8"));
1857
+ const raw = JSON.parse(fs8.readFileSync(syncStatePath(), "utf8"));
1878
1858
  if (raw && typeof raw === "object" && raw.hosts && typeof raw.hosts === "object") {
1879
1859
  return raw;
1880
1860
  }
@@ -1884,8 +1864,8 @@ function readSyncStore() {
1884
1864
  }
1885
1865
  function writeSyncStore(store) {
1886
1866
  try {
1887
- fs9.mkdirSync(getConfigDir(), { recursive: true });
1888
- fs9.writeFileSync(syncStatePath(), JSON.stringify(store, null, 2));
1867
+ fs8.mkdirSync(getConfigDir(), { recursive: true });
1868
+ fs8.writeFileSync(syncStatePath(), JSON.stringify(store, null, 2));
1889
1869
  } catch {
1890
1870
  }
1891
1871
  }
@@ -1989,20 +1969,20 @@ function friendlyVersionSyncFailure(result2) {
1989
1969
  return `Version synchronization failed at ${result2.stage}.`;
1990
1970
  }
1991
1971
  function acquireInstallLock(now) {
1992
- fs9.mkdirSync(getConfigDir(), { recursive: true });
1972
+ fs8.mkdirSync(getConfigDir(), { recursive: true });
1993
1973
  const file = syncLockPath();
1994
1974
  try {
1995
- return fs9.openSync(file, "wx");
1975
+ return fs8.openSync(file, "wx");
1996
1976
  } catch {
1997
1977
  try {
1998
- const age = now.getTime() - fs9.statSync(file).mtimeMs;
1978
+ const age = now.getTime() - fs8.statSync(file).mtimeMs;
1999
1979
  if (age >= LOCK_STALE_MS) {
2000
- fs9.unlinkSync(file);
2001
- return fs9.openSync(file, "wx");
1980
+ fs8.unlinkSync(file);
1981
+ return fs8.openSync(file, "wx");
2002
1982
  }
2003
1983
  } catch {
2004
1984
  try {
2005
- return fs9.openSync(file, "wx");
1985
+ return fs8.openSync(file, "wx");
2006
1986
  } catch {
2007
1987
  return null;
2008
1988
  }
@@ -2012,11 +1992,11 @@ function acquireInstallLock(now) {
2012
1992
  }
2013
1993
  function releaseInstallLock(fd) {
2014
1994
  try {
2015
- fs9.closeSync(fd);
1995
+ fs8.closeSync(fd);
2016
1996
  } catch {
2017
1997
  }
2018
1998
  try {
2019
- fs9.unlinkSync(syncLockPath());
1999
+ fs8.unlinkSync(syncLockPath());
2020
2000
  } catch {
2021
2001
  }
2022
2002
  }
@@ -2078,12 +2058,12 @@ function autoSyncDirection(current, expected) {
2078
2058
 
2079
2059
  // src/core/feature-config.ts
2080
2060
  import crypto4 from "crypto";
2081
- import fs10 from "fs";
2082
- import path10 from "path";
2061
+ import fs9 from "fs";
2062
+ import path9 from "path";
2083
2063
  var FEATURE_TTL_MS = 24 * 60 * 60 * 1e3;
2084
2064
  var UNAVAILABLE_TTL_MS2 = 5 * 60 * 1e3;
2085
2065
  function cachePath2() {
2086
- return path10.join(getConfigDir(), "feature-config.json");
2066
+ return path9.join(getConfigDir(), "feature-config.json");
2087
2067
  }
2088
2068
  function cacheKey2(host, token) {
2089
2069
  const fingerprint = crypto4.createHash("sha256").update(token).digest("hex");
@@ -2091,7 +2071,7 @@ function cacheKey2(host, token) {
2091
2071
  }
2092
2072
  function readStore2() {
2093
2073
  try {
2094
- const value = JSON.parse(fs10.readFileSync(cachePath2(), "utf8"));
2074
+ const value = JSON.parse(fs9.readFileSync(cachePath2(), "utf8"));
2095
2075
  return value?.entries && typeof value.entries === "object" ? value : { entries: {} };
2096
2076
  } catch {
2097
2077
  return { entries: {} };
@@ -2101,13 +2081,13 @@ function writeStore(store) {
2101
2081
  const target = cachePath2();
2102
2082
  const temp = `${target}.${process.pid}.${crypto4.randomBytes(6).toString("hex")}.tmp`;
2103
2083
  try {
2104
- fs10.mkdirSync(path10.dirname(target), { recursive: true });
2105
- fs10.writeFileSync(temp, JSON.stringify(store), { encoding: "utf8", mode: 384 });
2106
- fs10.renameSync(temp, target);
2107
- fs10.chmodSync(target, 384);
2084
+ fs9.mkdirSync(path9.dirname(target), { recursive: true });
2085
+ fs9.writeFileSync(temp, JSON.stringify(store), { encoding: "utf8", mode: 384 });
2086
+ fs9.renameSync(temp, target);
2087
+ fs9.chmodSync(target, 384);
2108
2088
  } catch {
2109
2089
  try {
2110
- fs10.rmSync(temp, { force: true });
2090
+ fs9.rmSync(temp, { force: true });
2111
2091
  } catch {
2112
2092
  }
2113
2093
  }
@@ -2154,13 +2134,13 @@ var NOTIFY_INTERVAL_MS = 24 * 60 * 60 * 1e3;
2154
2134
  var FETCH_TIMEOUT_MS = 3e3;
2155
2135
  var CLI_CONFIG_PATH = "/v1/ta/cli/config";
2156
2136
  function cacheFilePath() {
2157
- return path11.join(getConfigDir(), "compat-check.json");
2137
+ return path10.join(getConfigDir(), "compat-check.json");
2158
2138
  }
2159
2139
  function readStore3() {
2160
2140
  try {
2161
2141
  const file = cacheFilePath();
2162
- if (!fs11.existsSync(file)) return { hosts: {} };
2163
- const raw = JSON.parse(fs11.readFileSync(file, "utf8"));
2142
+ if (!fs10.existsSync(file)) return { hosts: {} };
2143
+ const raw = JSON.parse(fs10.readFileSync(file, "utf8"));
2164
2144
  if (!raw || typeof raw !== "object" || !raw.hosts) return { hosts: {} };
2165
2145
  return raw;
2166
2146
  } catch {
@@ -2170,8 +2150,8 @@ function readStore3() {
2170
2150
  function writeStore2(store) {
2171
2151
  try {
2172
2152
  const dir = getConfigDir();
2173
- if (!fs11.existsSync(dir)) fs11.mkdirSync(dir, { recursive: true });
2174
- fs11.writeFileSync(cacheFilePath(), JSON.stringify(store, null, 2));
2153
+ if (!fs10.existsSync(dir)) fs10.mkdirSync(dir, { recursive: true });
2154
+ fs10.writeFileSync(cacheFilePath(), JSON.stringify(store, null, 2));
2175
2155
  } catch {
2176
2156
  }
2177
2157
  }
@@ -2230,7 +2210,7 @@ async function fetchCliConfig(host, cliToken) {
2230
2210
  const options = {
2231
2211
  dispatcher,
2232
2212
  signal: controller.signal,
2233
- headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {} },
2213
+ headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {}, ...internalCallSourceHeaders() },
2234
2214
  ...externalCliTokenRequestOptions(url.toString())
2235
2215
  };
2236
2216
  resp = await fetch(url.toString(), options);
@@ -2496,7 +2476,6 @@ function notifyIfHostCompat(pkg, hostOverride) {
2496
2476
  export {
2497
2477
  exactVersion,
2498
2478
  installHost,
2499
- getLocalCliPackageInfo,
2500
2479
  businessForCommand,
2501
2480
  businessForCapability,
2502
2481
  canManageGlobalSkills,