@thinkingai/ae-cli 6.1.32 → 6.1.33

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 (94) hide show
  1. package/README.md +6 -3
  2. package/README.zh.md +8 -3
  3. package/bin/runtime-capabilities.json +1 -1
  4. package/dist/{ai-monitor-MKMHSSNI.js → ai-monitor-OHTSU6SV.js} +10 -9
  5. package/dist/ai-monitor.js +14 -13
  6. package/dist/{auth-CZHHPZOQ.js → auth-2MOK4OI6.js} +18 -9
  7. package/dist/{automation-FLCPFMN4.js → automation-6L6IAYRK.js} +6 -7
  8. package/dist/{capability-64KVJFIA.js → capability-EMIHQJA3.js} +10 -9
  9. package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
  10. package/dist/{chunk-4XKTRCRK.js → chunk-4IQYPWCX.js} +9 -8
  11. package/dist/{chunk-T7WF4HYW.js → chunk-7DHSB3FL.js} +3 -3
  12. package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
  13. package/dist/{chunk-6M7ZEDT2.js → chunk-BQFLABJQ.js} +11 -7
  14. package/dist/{chunk-KTJXD27G.js → chunk-COOMXFUG.js} +3 -3
  15. package/dist/{chunk-NLEXY2TM.js → chunk-DWAG2QJM.js} +7 -5
  16. package/dist/{chunk-DWBYNGSR.js → chunk-E3ONSFUN.js} +165 -186
  17. package/dist/{chunk-CF6JTT2U.js → chunk-EFGUBGA6.js} +1 -1
  18. package/dist/{chunk-BNBCMCYN.js → chunk-EWVEAERM.js} +11 -11
  19. package/dist/{chunk-F2VFZUGG.js → chunk-HIMOBNEY.js} +2 -2
  20. package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
  21. package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
  22. package/dist/{chunk-FCAA7I2D.js → chunk-KD5UC33N.js} +23 -9
  23. package/dist/{chunk-P7QDCWJ6.js → chunk-LFJ7N36I.js} +5 -1
  24. package/dist/chunk-NNK3JBH4.js +60 -0
  25. package/dist/{chunk-3ULDJJTZ.js → chunk-O45NOIWR.js} +2 -2
  26. package/dist/{chunk-HTZ2MLYA.js → chunk-PLNS5J33.js} +11 -5
  27. package/dist/chunk-PUSFEC6B.js +29 -0
  28. package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
  29. package/dist/{chunk-TMQGS4TO.js → chunk-RC3PPCYD.js} +3 -3
  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-72NJKS7O.js → chunk-XZDKAR4N.js} +4 -4
  34. package/dist/{chunk-IDDWEZ7F.js → chunk-YE6MJB5V.js} +3 -3
  35. package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
  36. package/dist/{compat-check-ZJNCMNQV.js → compat-check-CADG7GND.js} +5 -4
  37. package/dist/{config-FSH2NMNZ.js → config-PFD3KWQG.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 +47 -43
  42. package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
  43. package/dist/{memory-VEZZVAAP.js → memory-HKNGUIPK.js} +6 -7
  44. package/dist/{metadata-3IWHX3V4.js → metadata-GFWR5ZHC.js} +10 -9
  45. package/dist/{model-T7H7Q6BG.js → model-NAKQWK4W.js} +4 -5
  46. package/dist/{personal-semantic-preference-YITU23SA.js → personal-semantic-preference-JCTKXLC3.js} +45 -14
  47. package/dist/{project-semantic-MHEXJF3C.js → project-semantic-B2NWQOKK.js} +9 -8
  48. package/dist/{sync-AQHVCSPI.js → sync-UQH4J4BD.js} +9 -9
  49. package/dist/{te-agent-RXI7WOH4.js → te-agent-L6EYFQCC.js} +303 -17
  50. package/dist/{te-analysis-CZY74HVF.js → te-analysis-U7NNOY66.js} +25 -20
  51. package/dist/{te-community-DKCYUBCM.js → te-community-3UQEW3KD.js} +13 -11
  52. package/dist/{te-dataops-QEH6VE56.js → te-dataops-SUNYXF5G.js} +13 -11
  53. package/dist/{te-engage-WK7WKDKF.js → te-engage-KMXZJ2KN.js} +9 -8
  54. package/dist/{te-experiment-LH3RPIOE.js → te-experiment-IEYKP6VC.js} +215 -28
  55. package/dist/{te-kb-UPORIOVN.js → te-kb-MT3V5ZMH.js} +68 -17
  56. package/dist/{te-system-AL4B4XZL.js → te-system-F4ZU2HRQ.js} +6 -7
  57. package/dist/{te-team-LLVTO2G4.js → te-team-M6E6XQ5H.js} +9 -8
  58. package/dist/{things-XLMLBYQR.js → things-FRLBZV2Z.js} +9 -8
  59. package/dist/{update-7J5UQHSK.js → update-NULYHVE6.js} +8 -6
  60. package/dist/{workspace-FF2HXJGR.js → workspace-Z7L33OBQ.js} +6 -7
  61. package/package.json +6 -3
  62. package/skills/ae-agent/SKILL.md +19 -5
  63. package/skills/ae-agent/references/a2a.md +103 -0
  64. package/skills/ae-agent/references/command_index.md +11 -0
  65. package/skills/ae-analysis/SKILL.md +35 -23
  66. package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
  67. package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
  68. package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
  69. package/skills/ae-analysis/references/bad_case_review.md +4 -4
  70. package/skills/ae-analysis/references/command_index.md +7 -7
  71. package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
  72. package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
  73. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
  74. package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
  75. package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
  76. package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
  77. package/skills/ae-analysis/references/project_owner_update.md +5 -1
  78. package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
  79. package/skills/ae-analysis/references/scenario_list.md +5 -6
  80. package/skills/ae-capability/SKILL.md +8 -4
  81. package/skills/ae-experiment/SKILL.md +45 -16
  82. package/skills/ae-experiment/references/experiment_approval.md +87 -29
  83. package/skills/ae-experiment/references/manage_experiment.md +7 -3
  84. package/skills/ae-experiment/references/manage_traffic_domains.md +131 -0
  85. package/skills/ae-experiment/references/query_experiment_detail.md +8 -0
  86. package/skills/ae-experiment/references/query_experiment_list.md +6 -0
  87. package/skills/ae-experiment/references/save_experiment.md +39 -13
  88. package/skills/ae-experiment/references/save_metric.md +29 -2
  89. package/skills/ae-experiment/references/save_submit_experiment.md +11 -7
  90. package/skills/ae-experiment/references/save_submit_external_experiment.md +16 -14
  91. package/skills/ae-experiment/references/save_traffic_layer.md +17 -1
  92. package/skills/ae-kb/SKILL.md +4 -2
  93. package/skills/ae-kb/references/publication.md +45 -0
  94. 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 = {
@@ -605,19 +585,19 @@ function canManageGlobalSkills() {
605
585
 
606
586
  // src/core/business-skill-refresh.ts
607
587
  import crypto from "crypto";
608
- import fs6 from "fs";
609
- import path6 from "path";
588
+ import fs5 from "fs";
589
+ import path5 from "path";
610
590
 
611
591
  // src/core/business-skill-sync.ts
612
- import fs5 from "fs";
592
+ import fs4 from "fs";
613
593
  import os3 from "os";
614
- import path5 from "path";
594
+ import path4 from "path";
615
595
  import { createHash as createHash2, randomUUID } from "crypto";
616
596
 
617
597
  // src/core/skills-tool.ts
618
- import fs4 from "fs";
598
+ import fs3 from "fs";
619
599
  import os2 from "os";
620
- import path4 from "path";
600
+ import path3 from "path";
621
601
  import { createHash } from "crypto";
622
602
  import { createRequire, isBuiltin } from "module";
623
603
  import { pathToFileURL } from "url";
@@ -626,12 +606,12 @@ var MANAGED_SKILLS_TOOL_VERSION = "1.5.12";
626
606
  var TOOL_SOURCE_SHA256 = "5a2c18ddd70886d5367e39a0f88827ffd1024420e4d9db08149742386c088d2d";
627
607
  function skillPathIdentity(file) {
628
608
  try {
629
- const stat = fs4.lstatSync(file, { bigint: true });
609
+ const stat = fs3.lstatSync(file, { bigint: true });
630
610
  return {
631
611
  dev: String(stat.dev),
632
612
  ino: String(stat.ino),
633
613
  type: stat.isSymbolicLink() ? "symlink" : stat.isDirectory() ? "directory" : stat.isFile() ? "file" : "other",
634
- ...stat.isSymbolicLink() ? { link: fs4.readlinkSync(file) } : {}
614
+ ...stat.isSymbolicLink() ? { link: fs3.readlinkSync(file) } : {}
635
615
  };
636
616
  } catch (error) {
637
617
  if (error.code === "ENOENT") return null;
@@ -640,28 +620,28 @@ function skillPathIdentity(file) {
640
620
  }
641
621
  function realSkillPath(file) {
642
622
  try {
643
- return fs4.realpathSync(file);
623
+ return fs3.realpathSync(file);
644
624
  } catch (error) {
645
625
  if (error.code !== "ENOENT") throw error;
646
- const parent = path4.dirname(file);
626
+ const parent = path3.dirname(file);
647
627
  if (parent === file) throw error;
648
- return path4.join(realSkillPath(parent), path4.basename(file));
628
+ return path3.join(realSkillPath(parent), path3.basename(file));
649
629
  }
650
630
  }
651
631
  function skillPathProblem(targetDirectory, skill, sourceRoot) {
652
632
  try {
653
- const target = realSkillPath(path4.resolve(targetDirectory, skill));
654
- const source = realSkillPath(path4.resolve(sourceRoot));
655
- const overlaps = (a, b) => a === b || a.startsWith(b + path4.sep);
633
+ const target = realSkillPath(path3.resolve(targetDirectory, skill));
634
+ const source = realSkillPath(path3.resolve(sourceRoot));
635
+ const overlaps = (a, b) => a === b || a.startsWith(b + path3.sep);
656
636
  if (overlaps(target, source) || overlaps(source, target)) return "package_source_overlap";
657
- let parent = path4.resolve(targetDirectory);
637
+ let parent = path3.resolve(targetDirectory);
658
638
  while (true) {
659
639
  try {
660
- if (fs4.lstatSync(parent).isSymbolicLink()) return "copy_parent_linked";
640
+ if (fs3.lstatSync(parent).isSymbolicLink()) return "copy_parent_linked";
661
641
  } catch (error) {
662
642
  if (error.code !== "ENOENT") throw error;
663
643
  }
664
- const next = path4.dirname(parent);
644
+ const next = path3.dirname(parent);
665
645
  if (next === parent) return null;
666
646
  parent = next;
667
647
  }
@@ -671,27 +651,27 @@ function skillPathProblem(targetDirectory, skill, sourceRoot) {
671
651
  }
672
652
  function skillCopyHash(directory, source = false) {
673
653
  try {
674
- if (!fs4.lstatSync(directory).isDirectory()) throw new Error("Not a regular Skill directory.");
654
+ if (!fs3.lstatSync(directory).isDirectory()) throw new Error("Not a regular Skill directory.");
675
655
  } catch (error) {
676
656
  if (error.code === "ENOENT") return null;
677
657
  throw error;
678
658
  }
679
659
  const hash = createHash("sha256");
680
660
  const visit = (relative) => {
681
- for (const name of fs4.readdirSync(path4.join(directory, relative)).sort()) {
661
+ for (const name of fs3.readdirSync(path3.join(directory, relative)).sort()) {
682
662
  if (name === ".DS_Store") continue;
683
- const child = path4.join(relative, name);
684
- const absolute = path4.join(directory, child);
685
- const stat = fs4.lstatSync(absolute);
663
+ const child = path3.join(relative, name);
664
+ const absolute = path3.join(directory, child);
665
+ const stat = fs3.lstatSync(absolute);
686
666
  if (source && (name === "metadata.json" || stat.isDirectory() && [".git", "__pycache__", "__pypackages__"].includes(name))) continue;
687
- const normalized = child.split(path4.sep).join("/");
667
+ const normalized = child.split(path3.sep).join("/");
688
668
  if (stat.isSymbolicLink()) throw new Error("Symbolic links are not managed Skill copies.");
689
669
  if (stat.isDirectory()) {
690
670
  hash.update(`directory:${normalized}\0`);
691
671
  visit(child);
692
672
  } else if (stat.isFile()) {
693
673
  hash.update(`file:${normalized}\0${stat.size}\0`);
694
- hash.update(fs4.readFileSync(absolute));
674
+ hash.update(fs3.readFileSync(absolute));
695
675
  } else throw new Error("Unsupported Skill file type.");
696
676
  }
697
677
  };
@@ -748,7 +728,7 @@ function adaptedToolSource(source, entry) {
748
728
  );
749
729
  source = replaceOnce(source, "main().finally(() => flushTelemetry().then(() => process.exit(0)));", "");
750
730
  const require2 = createRequire(entry);
751
- const resolveImport = (specifier) => isBuiltin(specifier) ? specifier : pathToFileURL(specifier.startsWith(".") ? path4.resolve(path4.dirname(entry), specifier) : require2.resolve(specifier)).href;
731
+ const resolveImport = (specifier) => isBuiltin(specifier) ? specifier : pathToFileURL(specifier.startsWith(".") ? path3.resolve(path3.dirname(entry), specifier) : require2.resolve(specifier)).href;
752
732
  source = source.replace(
753
733
  /\bfrom (['"])([^'"]+)\1/g,
754
734
  (_match, quote, specifier) => `from ${quote}${resolveImport(specifier)}${quote}`
@@ -958,19 +938,19 @@ catch { process.stdout.write(JSON.stringify({ ok: false })); process.exitCode =
958
938
  `;
959
939
  function createPinnedSkillsTool(options = {}) {
960
940
  const require2 = createRequire(import.meta.url);
961
- const packageFile = options.entry ? path4.join(path4.dirname(options.entry), "..", "package.json") : require2.resolve("skills/package.json");
962
- const entry = options.entry ?? path4.join(path4.dirname(packageFile), "dist", "cli.mjs");
963
- const metadata = JSON.parse(fs4.readFileSync(packageFile, "utf8"));
964
- const source = fs4.readFileSync(entry, "utf8");
941
+ const packageFile = options.entry ? path3.join(path3.dirname(options.entry), "..", "package.json") : require2.resolve("skills/package.json");
942
+ const entry = options.entry ?? path3.join(path3.dirname(packageFile), "dist", "cli.mjs");
943
+ const metadata = JSON.parse(fs3.readFileSync(packageFile, "utf8"));
944
+ const source = fs3.readFileSync(entry, "utf8");
965
945
  if (metadata.version !== MANAGED_SKILLS_TOOL_VERSION || createHash("sha256").update(source).digest("hex") !== TOOL_SOURCE_SHA256) {
966
946
  throw new Error("Managed Skill synchronization requires the verified skills@1.5.12 package.");
967
947
  }
968
948
  const script = adaptedToolSource(source, entry);
969
949
  const run = (request) => {
970
- const directory = fs4.mkdtempSync(path4.join(os2.tmpdir(), "ae-cli-skills-tool-"));
971
- const worker = path4.join(directory, "adapter.mjs");
950
+ const directory = fs3.mkdtempSync(path3.join(os2.tmpdir(), "ae-cli-skills-tool-"));
951
+ const worker = path3.join(directory, "adapter.mjs");
972
952
  try {
973
- fs4.writeFileSync(worker, script, { mode: 384 });
953
+ fs3.writeFileSync(worker, script, { mode: 384 });
974
954
  const result2 = spawn2.sync(process.execPath, [worker], {
975
955
  input: JSON.stringify(request),
976
956
  encoding: "utf8",
@@ -987,7 +967,7 @@ function createPinnedSkillsTool(options = {}) {
987
967
  } catch {
988
968
  throw new Error("Skills adapter failed. Check the pinned package and directory permissions.");
989
969
  } finally {
990
- fs4.rmSync(directory, { recursive: true, force: true });
970
+ fs3.rmSync(directory, { recursive: true, force: true });
991
971
  }
992
972
  };
993
973
  return {
@@ -1004,17 +984,17 @@ var POLICY_HASH = createHash2("sha256").update(JSON.stringify({ removal_policy:
1004
984
  function historicalCliSkills(options) {
1005
985
  const env = options.env ?? process.env;
1006
986
  const home = env.HOME || env.USERPROFILE || os3.homedir();
1007
- const file = env.XDG_STATE_HOME ? path5.join(env.XDG_STATE_HOME, "skills", ".skill-lock.json") : path5.join(home, ".agents", ".skill-lock.json");
987
+ const file = env.XDG_STATE_HOME ? path4.join(env.XDG_STATE_HOME, "skills", ".skill-lock.json") : path4.join(home, ".agents", ".skill-lock.json");
1008
988
  const names = /* @__PURE__ */ new Set();
1009
989
  let content = "";
1010
990
  const isCliSource = (value, type) => {
1011
991
  if (typeof value !== "string") return false;
1012
- if (type === "local" && path5.isAbsolute(value)) {
1013
- const source2 = path5.resolve(value);
1014
- if (source2 === path5.resolve(options.skillsDirectory)) return true;
1015
- if (path5.basename(source2) !== "skills") return false;
992
+ if (type === "local" && path4.isAbsolute(value)) {
993
+ const source2 = path4.resolve(value);
994
+ if (source2 === path4.resolve(options.skillsDirectory)) return true;
995
+ if (path4.basename(source2) !== "skills") return false;
1016
996
  try {
1017
- const pkg = JSON.parse(fs5.readFileSync(path5.join(source2, "..", "package.json"), "utf8"));
997
+ const pkg = JSON.parse(fs4.readFileSync(path4.join(source2, "..", "package.json"), "utf8"));
1018
998
  return ["@tant/ae-cli", "@thinkingai/ae-cli"].includes(pkg.name) && typeof pkg.bin?.["ae-cli"] === "string";
1019
999
  } catch {
1020
1000
  return false;
@@ -1032,7 +1012,7 @@ function historicalCliSkills(options) {
1032
1012
  ].includes(source);
1033
1013
  };
1034
1014
  try {
1035
- content = fs5.readFileSync(file, "utf8");
1015
+ content = fs4.readFileSync(file, "utf8");
1036
1016
  const lock = JSON.parse(content);
1037
1017
  const mapped = new Set(Object.values(skill_businesses_default).flat());
1038
1018
  if (typeof lock.version === "number" && lock.skills && typeof lock.skills === "object") {
@@ -1049,11 +1029,11 @@ function historicalCliSkills(options) {
1049
1029
  function writeJson(file, value) {
1050
1030
  const temporary = `${file}.${process.pid}.${randomUUID()}.tmp`;
1051
1031
  try {
1052
- fs5.writeFileSync(temporary, JSON.stringify(value, null, 2) + "\n", { mode: 384, flag: "wx" });
1053
- fs5.renameSync(temporary, file);
1032
+ fs4.writeFileSync(temporary, JSON.stringify(value, null, 2) + "\n", { mode: 384, flag: "wx" });
1033
+ fs4.renameSync(temporary, file);
1054
1034
  } finally {
1055
1035
  try {
1056
- fs5.unlinkSync(temporary);
1036
+ fs4.unlinkSync(temporary);
1057
1037
  } catch {
1058
1038
  }
1059
1039
  }
@@ -1073,15 +1053,15 @@ function contextIdentity(options) {
1073
1053
  }
1074
1054
  function reserveBusinessSkillContext(options) {
1075
1055
  const directory = options.stateDirectory ?? getConfigDir();
1076
- fs5.mkdirSync(directory, { recursive: true, mode: 448 });
1056
+ fs4.mkdirSync(directory, { recursive: true, mode: 448 });
1077
1057
  const generation = randomUUID();
1078
- writeJson(path5.join(directory, CONTEXT_FILE), { ...contextIdentity(options), generation });
1058
+ writeJson(path4.join(directory, CONTEXT_FILE), { ...contextIdentity(options), generation });
1079
1059
  return generation;
1080
1060
  }
1081
1061
  function currentContext(options, file, generation) {
1082
1062
  try {
1083
1063
  if (options.isCurrentContext && !options.isCurrentContext()) return false;
1084
- const active = JSON.parse(fs5.readFileSync(file, "utf8"));
1064
+ const active = JSON.parse(fs4.readFileSync(file, "utf8"));
1085
1065
  const identity = contextIdentity(options);
1086
1066
  return active.generation === generation && active.host === identity.host && active.token_fingerprint === identity.token_fingerprint;
1087
1067
  } catch {
@@ -1089,12 +1069,12 @@ function currentContext(options, file, generation) {
1089
1069
  }
1090
1070
  }
1091
1071
  function isBusinessSkillContextCurrent(options) {
1092
- return currentContext(options, path5.join(options.stateDirectory ?? getConfigDir(), CONTEXT_FILE), options.generation);
1072
+ return currentContext(options, path4.join(options.stateDirectory ?? getConfigDir(), CONTEXT_FILE), options.generation);
1093
1073
  }
1094
1074
  function takeLock(file) {
1095
1075
  const owner = randomUUID();
1096
1076
  const ownerName = `owner-${process.pid}-${owner}.json`;
1097
- const candidate = fs5.mkdtempSync(`${file}.candidate-`);
1077
+ const candidate = fs4.mkdtempSync(`${file}.candidate-`);
1098
1078
  const alive = (pid) => {
1099
1079
  try {
1100
1080
  process.kill(pid, 0);
@@ -1104,29 +1084,29 @@ function takeLock(file) {
1104
1084
  }
1105
1085
  };
1106
1086
  try {
1107
- fs5.chmodSync(candidate, 448);
1108
- fs5.writeFileSync(path5.join(candidate, ownerName), JSON.stringify({ pid: process.pid, owner }), { mode: 384 });
1087
+ fs4.chmodSync(candidate, 448);
1088
+ fs4.writeFileSync(path4.join(candidate, ownerName), JSON.stringify({ pid: process.pid, owner }), { mode: 384 });
1109
1089
  for (let attempt = 0; attempt < 4; attempt++) {
1110
1090
  try {
1111
- fs5.renameSync(candidate, file);
1091
+ fs4.renameSync(candidate, file);
1112
1092
  try {
1113
- fs5.unlinkSync(`${file}.reclaim`);
1093
+ fs4.unlinkSync(`${file}.reclaim`);
1114
1094
  } catch {
1115
1095
  }
1116
1096
  return () => {
1117
1097
  try {
1118
- fs5.unlinkSync(path5.join(file, ownerName));
1098
+ fs4.unlinkSync(path4.join(file, ownerName));
1119
1099
  } catch {
1120
1100
  }
1121
1101
  try {
1122
- fs5.rmdirSync(file);
1102
+ fs4.rmdirSync(file);
1123
1103
  } catch {
1124
1104
  }
1125
1105
  };
1126
1106
  } catch (error) {
1127
1107
  let stat;
1128
1108
  try {
1129
- stat = fs5.lstatSync(file);
1109
+ stat = fs4.lstatSync(file);
1130
1110
  } catch (cause) {
1131
1111
  if (cause.code === "ENOENT") continue;
1132
1112
  throw error;
@@ -1135,12 +1115,12 @@ function takeLock(file) {
1135
1115
  if (stat.isFile()) {
1136
1116
  let pid;
1137
1117
  try {
1138
- pid = JSON.parse(fs5.readFileSync(file, "utf8")).pid;
1118
+ pid = JSON.parse(fs4.readFileSync(file, "utf8")).pid;
1139
1119
  } catch {
1140
1120
  }
1141
1121
  if (typeof pid === "number" && Number.isInteger(pid) && pid > 0 && alive(pid)) return null;
1142
1122
  try {
1143
- fs5.unlinkSync(file);
1123
+ fs4.unlinkSync(file);
1144
1124
  } catch (cause) {
1145
1125
  if (!["ENOENT", "EISDIR", "EPERM"].includes(cause.code ?? "")) throw cause;
1146
1126
  }
@@ -1149,7 +1129,7 @@ function takeLock(file) {
1149
1129
  if (!stat.isDirectory()) return null;
1150
1130
  let names;
1151
1131
  try {
1152
- names = fs5.readdirSync(file);
1132
+ names = fs4.readdirSync(file);
1153
1133
  } catch (cause) {
1154
1134
  if (cause.code === "ENOENT") continue;
1155
1135
  throw cause;
@@ -1160,13 +1140,13 @@ function takeLock(file) {
1160
1140
  }
1161
1141
  for (const name of names) {
1162
1142
  try {
1163
- fs5.unlinkSync(path5.join(file, name));
1143
+ fs4.unlinkSync(path4.join(file, name));
1164
1144
  } catch (cause) {
1165
1145
  if (cause.code !== "ENOENT") throw cause;
1166
1146
  }
1167
1147
  }
1168
1148
  try {
1169
- fs5.rmdirSync(file);
1149
+ fs4.rmdirSync(file);
1170
1150
  } catch (cause) {
1171
1151
  if (!["ENOENT", "ENOTEMPTY", "EEXIST"].includes(cause.code ?? "")) throw cause;
1172
1152
  }
@@ -1174,13 +1154,13 @@ function takeLock(file) {
1174
1154
  }
1175
1155
  return null;
1176
1156
  } finally {
1177
- fs5.rmSync(candidate, { recursive: true, force: true });
1157
+ fs4.rmSync(candidate, { recursive: true, force: true });
1178
1158
  }
1179
1159
  }
1180
1160
  function readLedger(file) {
1181
1161
  let value;
1182
1162
  try {
1183
- value = JSON.parse(fs5.readFileSync(file, "utf8"));
1163
+ value = JSON.parse(fs4.readFileSync(file, "utf8"));
1184
1164
  } catch (error) {
1185
1165
  if (error.code === "ENOENT") return { schema_version: 1, copies: {} };
1186
1166
  throw new Error("Managed Skill ledger is unreadable.");
@@ -1189,12 +1169,12 @@ function readLedger(file) {
1189
1169
  throw new Error("Managed Skill ledger has an unsupported format.");
1190
1170
  }
1191
1171
  for (const [filePath, copy] of Object.entries(value.copies)) {
1192
- 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.");
1172
+ 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.");
1193
1173
  }
1194
1174
  return value;
1195
1175
  }
1196
1176
  function result(skill, target, reason) {
1197
- return { skill, agent: target.agent, path: path5.join(target.directory, skill), ...reason ? { reason } : {} };
1177
+ return { skill, agent: target.agent, path: path4.join(target.directory, skill), ...reason ? { reason } : {} };
1198
1178
  }
1199
1179
  function directInstallerLink(file, target, text) {
1200
1180
  if (typeof text !== "string") return false;
@@ -1202,21 +1182,21 @@ function directInstallerLink(file, target, text) {
1202
1182
  if (process.platform === "win32") {
1203
1183
  if (value.toUpperCase().startsWith("\\\\?\\UNC\\")) value = "\\\\" + value.slice(8);
1204
1184
  else if (value.startsWith("\\\\?\\") || value.startsWith("\\??\\")) value = value.slice(4);
1205
- return [target, path5.relative(path5.dirname(file), target)].some((expected) => value.toLowerCase() === expected.toLowerCase());
1185
+ return [target, path4.relative(path4.dirname(file), target)].some((expected) => value.toLowerCase() === expected.toLowerCase());
1206
1186
  }
1207
- return value === target || value === path5.relative(path5.dirname(file), target);
1187
+ return value === target || value === path4.relative(path4.dirname(file), target);
1208
1188
  }
1209
1189
  function legacySkillLink(file, skill, sourceRoot, sourceHash, targets, ledger, removing = false) {
1210
1190
  const canonical = targets.find((target2) => target2.agent === "universal");
1211
1191
  if (!canonical) return;
1212
- const target = path5.join(canonical.directory, skill);
1192
+ const target = path4.join(canonical.directory, skill);
1213
1193
  const managed = ledger.copies[target];
1214
1194
  if (!managed || managed.skill !== skill || managed.agent !== canonical.agent || !removing && managed.hash !== sourceHash || skillPathProblem(canonical.directory, skill, sourceRoot)) return;
1215
1195
  try {
1216
- if (!fs5.lstatSync(file).isSymbolicLink()) return;
1217
- const text = fs5.readlinkSync(file);
1196
+ if (!fs4.lstatSync(file).isSymbolicLink()) return;
1197
+ const text = fs4.readlinkSync(file);
1218
1198
  if (!directInstallerLink(file, target, text)) return;
1219
- if (!removing && (skillCopyHash(target) !== sourceHash || fs5.realpathSync(file) !== fs5.realpathSync(target))) return;
1199
+ if (!removing && (skillCopyHash(target) !== sourceHash || fs4.realpathSync(file) !== fs4.realpathSync(target))) return;
1220
1200
  return { target, text };
1221
1201
  } catch {
1222
1202
  return;
@@ -1233,20 +1213,20 @@ function syncBusinessSkills(options) {
1233
1213
  managed_count: 0
1234
1214
  };
1235
1215
  const directory = options.stateDirectory ?? getConfigDir();
1236
- const contextFile = path5.join(directory, CONTEXT_FILE);
1216
+ const contextFile = path4.join(directory, CONTEXT_FILE);
1237
1217
  let unlock = null;
1238
1218
  try {
1239
1219
  if (options.isCurrentContext && !options.isCurrentContext()) {
1240
1220
  report.status = "stale";
1241
1221
  return report;
1242
1222
  }
1243
- fs5.mkdirSync(directory, { recursive: true, mode: 448 });
1223
+ fs4.mkdirSync(directory, { recursive: true, mode: 448 });
1244
1224
  const generation = options.generation ?? reserveBusinessSkillContext(options);
1245
1225
  if (!currentContext(options, contextFile, generation)) {
1246
1226
  report.status = "stale";
1247
1227
  return report;
1248
1228
  }
1249
- unlock = takeLock(path5.join(directory, LOCK_FILE));
1229
+ unlock = takeLock(path4.join(directory, LOCK_FILE));
1250
1230
  if (!unlock) {
1251
1231
  report.status = "busy";
1252
1232
  return report;
@@ -1255,7 +1235,7 @@ function syncBusinessSkills(options) {
1255
1235
  report.status = "stale";
1256
1236
  return report;
1257
1237
  }
1258
- const ledgerFile = path5.join(directory, LEDGER_FILE);
1238
+ const ledgerFile = path4.join(directory, LEDGER_FILE);
1259
1239
  const ledger = readLedger(ledgerFile);
1260
1240
  const packageVersion = options.packageVersion ?? "unknown";
1261
1241
  const history = historicalCliSkills(options);
@@ -1263,7 +1243,7 @@ function syncBusinessSkills(options) {
1263
1243
  ...contextIdentity(options),
1264
1244
  package_version: packageVersion,
1265
1245
  businesses: normalizeBusinesses(options.businesses),
1266
- source_root: fs5.realpathSync(options.skillsDirectory),
1246
+ source_root: fs4.realpathSync(options.skillsDirectory),
1267
1247
  policy_hash: POLICY_HASH,
1268
1248
  history_hash: history.hash
1269
1249
  };
@@ -1309,7 +1289,7 @@ function syncBusinessSkills(options) {
1309
1289
  for (const name of skills) {
1310
1290
  const state = getSkillBusinessState(name, options.businesses);
1311
1291
  if (options.mode !== "adopt" && state === void 0) continue;
1312
- const source = path5.join(options.skillsDirectory, name);
1292
+ const source = path4.join(options.skillsDirectory, name);
1313
1293
  const sourceHash = bundled.some((skill) => skill.name === name) ? skillCopyHash(source, true) : null;
1314
1294
  if (!sourceHash && options.mode === "adopt") throw new Error("Complete package Skill source is missing.");
1315
1295
  for (const target of targets) {
@@ -1334,7 +1314,7 @@ function syncBusinessSkills(options) {
1334
1314
  }
1335
1315
  const legacyLink2 = node.type === "symlink" ? legacySkillLink(item.path, name, options.skillsDirectory, sourceHash ?? "", targets, ledger, true) : void 0;
1336
1316
  const canonical = targets.find((copy) => copy.agent === "universal");
1337
- const historicalLink = node.type === "symlink" && canonical && directInstallerLink(item.path, path5.join(canonical.directory, name), node.link);
1317
+ const historicalLink = node.type === "symlink" && canonical && directInstallerLink(item.path, path4.join(canonical.directory, name), node.link);
1338
1318
  const historicalCopy = history.names.has(name) && (target.agent === "universal" && node.type !== "symlink" || historicalLink);
1339
1319
  if (!managed && (legacyLink2 || historicalCopy)) {
1340
1320
  ledger.copies[item.path] = {
@@ -1404,7 +1384,7 @@ function syncBusinessSkills(options) {
1404
1384
  if (managed) delete ledger.copies[item.path];
1405
1385
  continue;
1406
1386
  }
1407
- if (actualHash === null && !target.detected && !managed && !fs5.existsSync(target.directory)) continue;
1387
+ if (actualHash === null && !target.detected && !managed && !fs4.existsSync(target.directory)) continue;
1408
1388
  operations.push({
1409
1389
  action: "install",
1410
1390
  skill: name,
@@ -1497,8 +1477,8 @@ function syncRefreshedBusinessSkills(refresh, businesses) {
1497
1477
  if (!Object.keys(states).length) return;
1498
1478
  try {
1499
1479
  const pkg = getLocalCliPackageInfo();
1500
- const options = { ...refresh, skillsDirectory: path6.join(pkg.root, "skills"), businesses: states, packageVersion: pkg.version };
1501
- if (!fs6.existsSync(path6.join(getConfigDir(), "business-skills.json"))) {
1480
+ const options = { ...refresh, skillsDirectory: path5.join(pkg.root, "skills"), businesses: states, packageVersion: pkg.version };
1481
+ if (!fs5.existsSync(path5.join(getConfigDir(), "business-skills.json"))) {
1502
1482
  const adoption = syncBusinessSkills({ ...options, mode: "adopt" });
1503
1483
  if (["failed", "busy", "stale"].includes(adoption.status)) {
1504
1484
  if (adoption.status !== "stale") process.stderr.write("[ae-cli] Skills could not be synchronized. Retry: ae-cli config refresh\n");
@@ -1518,14 +1498,14 @@ function syncRefreshedBusinessSkills(refresh, businesses) {
1518
1498
  var BUSINESS_CONFIG_TTL_MS = 10 * 60 * 1e3;
1519
1499
  var UNAVAILABLE_TTL_MS = 5 * 60 * 1e3;
1520
1500
  function cachePath() {
1521
- return path7.join(getConfigDir(), "business-config.json");
1501
+ return path6.join(getConfigDir(), "business-config.json");
1522
1502
  }
1523
1503
  function cacheKey(host, token) {
1524
1504
  return `${normalizeUrl(host)}#${crypto2.createHash("sha256").update(token).digest("hex")}`;
1525
1505
  }
1526
1506
  function readStore() {
1527
1507
  try {
1528
- const value = JSON.parse(fs7.readFileSync(cachePath(), "utf8"));
1508
+ const value = JSON.parse(fs6.readFileSync(cachePath(), "utf8"));
1529
1509
  if (value?.entries && typeof value.entries === "object" && !Array.isArray(value.entries)) return value;
1530
1510
  } catch {
1531
1511
  }
@@ -1537,13 +1517,13 @@ function remember(host, token, entry) {
1537
1517
  const target = cachePath();
1538
1518
  const temporary = `${target}.${process.pid}.${crypto2.randomBytes(6).toString("hex")}.tmp`;
1539
1519
  try {
1540
- fs7.mkdirSync(path7.dirname(target), { recursive: true });
1541
- fs7.writeFileSync(temporary, JSON.stringify(store), { encoding: "utf8", mode: 384 });
1542
- fs7.renameSync(temporary, target);
1543
- fs7.chmodSync(target, 384);
1520
+ fs6.mkdirSync(path6.dirname(target), { recursive: true });
1521
+ fs6.writeFileSync(temporary, JSON.stringify(store), { encoding: "utf8", mode: 384 });
1522
+ fs6.renameSync(temporary, target);
1523
+ fs6.chmodSync(target, 384);
1544
1524
  } catch {
1545
1525
  try {
1546
- fs7.rmSync(temporary, { force: true });
1526
+ fs6.rmSync(temporary, { force: true });
1547
1527
  } catch {
1548
1528
  }
1549
1529
  }
@@ -1612,7 +1592,7 @@ async function readBusinessConfigForExecution(hostOverride, synchronizeSkills =
1612
1592
  const token = peekCliToken(host);
1613
1593
  if (!token) return {};
1614
1594
  return await resolveBusinessConfig(host, token, async () => {
1615
- const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-ZJNCMNQV.js");
1595
+ const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-CADG7GND.js");
1616
1596
  return fetchCliConfig2(host, token);
1617
1597
  }, Date.now(), synchronizeSkills);
1618
1598
  } catch {
@@ -1660,7 +1640,7 @@ function failInstallation(report, stage, message, cause = "validation") {
1660
1640
  function installPlan(packageName, version, root = "<npm-root>") {
1661
1641
  const config = distribution(packageName);
1662
1642
  const target = exactVersion(version);
1663
- const executable = path8.join(root, packageName, "bin", "ae-cli.js");
1643
+ const executable = path7.join(root, packageName, "bin", "ae-cli.js");
1664
1644
  return [
1665
1645
  `npm install -g ${packageName}@${target} --registry=${config.registry}`,
1666
1646
  `node ${JSON.stringify(executable)} install`
@@ -1680,27 +1660,27 @@ function skipGlobalSkillReason() {
1680
1660
  }
1681
1661
  function readPackage(root) {
1682
1662
  try {
1683
- return JSON.parse(fs8.readFileSync(path8.join(root, "package.json"), "utf8"));
1663
+ return JSON.parse(fs7.readFileSync(path7.join(root, "package.json"), "utf8"));
1684
1664
  } catch {
1685
1665
  return null;
1686
1666
  }
1687
1667
  }
1688
1668
  function linked(root) {
1689
1669
  try {
1690
- return fs8.lstatSync(root).isSymbolicLink();
1670
+ return fs7.lstatSync(root).isSymbolicLink();
1691
1671
  } catch {
1692
1672
  return false;
1693
1673
  }
1694
1674
  }
1695
1675
  function cliBinBelongsToPackage(bin, packageRoot, platform) {
1696
- const entry = fs8.realpathSync(path8.join(packageRoot, "bin", "ae-cli.js"));
1697
- if (platform !== "win32") return fs8.realpathSync(bin) === entry;
1698
- const shim = fs8.readFileSync(bin, "utf8");
1676
+ const entry = fs7.realpathSync(path7.join(packageRoot, "bin", "ae-cli.js"));
1677
+ if (platform !== "win32") return fs7.realpathSync(bin) === entry;
1678
+ const shim = fs7.readFileSync(bin, "utf8");
1699
1679
  const targets = [...shim.matchAll(/"%(?:dp0%|~dp0)[\\/]([^"\r\n]+)"/gi)];
1700
1680
  return targets.some(([, relative]) => {
1701
1681
  try {
1702
- const target = path8.resolve(path8.dirname(bin), relative.replace(/\\/g, path8.sep));
1703
- return fs8.realpathSync(target).toLowerCase() === entry.toLowerCase();
1682
+ const target = path7.resolve(path7.dirname(bin), relative.replace(/\\/g, path7.sep));
1683
+ return fs7.realpathSync(target).toLowerCase() === entry.toLowerCase();
1704
1684
  } catch {
1705
1685
  return false;
1706
1686
  }
@@ -1741,9 +1721,9 @@ function runInstallation(options = {}) {
1741
1721
  const prefixResult = runner(npm, ["prefix", "-g"], 15e3);
1742
1722
  const globalRoot = rootResult.stdout.trim();
1743
1723
  const prefix = prefixResult.stdout.trim();
1744
- 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.");
1745
- const packageRoot = path8.join(globalRoot, packageName);
1746
- const bin = platform === "win32" ? path8.join(prefix, "ae-cli.cmd") : path8.join(prefix, "bin", "ae-cli");
1724
+ 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.");
1725
+ const packageRoot = path7.join(globalRoot, packageName);
1726
+ const bin = platform === "win32" ? path7.join(prefix, "ae-cli.cmd") : path7.join(prefix, "bin", "ae-cli");
1747
1727
  report.cli.path = bin;
1748
1728
  const env = options.env ?? process.env;
1749
1729
  const installedBefore = readPackage(packageRoot);
@@ -1766,8 +1746,8 @@ function runInstallation(options = {}) {
1766
1746
  };
1767
1747
  const generation = reserveBusinessSkillContext({ ...identity, stateDirectory });
1768
1748
  context = { ...identity, stateDirectory, generation, isCurrentContext };
1769
- if (!fs8.existsSync(path8.join(stateDirectory, "business-skills.json")) && installedBefore?.name === packageName) {
1770
- const previousSkills = path8.join(packageRoot, "skills");
1749
+ if (!fs7.existsSync(path7.join(stateDirectory, "business-skills.json")) && installedBefore?.name === packageName) {
1750
+ const previousSkills = path7.join(packageRoot, "skills");
1771
1751
  try {
1772
1752
  readBundledSkills(previousSkills);
1773
1753
  syncSkills({ ...context, skillsDirectory: previousSkills, businesses: {}, mode: "adopt", packageVersion: installedBefore.version });
@@ -1779,7 +1759,7 @@ function runInstallation(options = {}) {
1779
1759
  return failInstallation(report, "skills_local", "The active environment changed before installation. Re-run install or update for the current environment.");
1780
1760
  }
1781
1761
  }
1782
- if (options.skipCliInstall || installedBefore?.name === packageName && installedBefore.version === target && fs8.existsSync(bin)) {
1762
+ if (options.skipCliInstall || installedBefore?.name === packageName && installedBefore.version === target && fs7.existsSync(bin)) {
1783
1763
  report.cli.action = "skipped";
1784
1764
  progress("[ae-cli] [2/4] Verifying the existing CLI...");
1785
1765
  } else {
@@ -1792,16 +1772,16 @@ function runInstallation(options = {}) {
1792
1772
  stage = "package_validation";
1793
1773
  const installed = readPackage(packageRoot);
1794
1774
  if (installed?.name !== packageName || installed.version !== target) return failInstallation(report, stage, "Installed CLI package identity or version does not match the requested distribution.");
1795
- 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.");
1775
+ 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.");
1796
1776
  if (!cliBinBelongsToPackage(bin, packageRoot, platform)) return failInstallation(report, stage, "The global executable does not belong to the installed CLI package.");
1797
1777
  const versionResult = runner(bin, ["--version"], 15e3);
1798
1778
  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.");
1799
- report.cli.entrypoint = fs8.realpathSync(path8.join(packageRoot, "bin", "ae-cli.js"));
1779
+ report.cli.entrypoint = fs7.realpathSync(path7.join(packageRoot, "bin", "ae-cli.js"));
1800
1780
  report.cli.verified = true;
1801
1781
  const pathKey = platform === "win32" ? Object.keys(env).find((key) => key.toLowerCase() === "path") : "PATH";
1802
- 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}`));
1803
- if (!installedPathBin || fs8.realpathSync(installedPathBin) !== fs8.realpathSync(bin)) {
1804
- report.cli.warnings.push(`Add ${path8.dirname(bin)} to the front of PATH and refresh the shell command cache. The absolute executable was verified.`);
1782
+ 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}`));
1783
+ if (!installedPathBin || fs7.realpathSync(installedPathBin) !== fs7.realpathSync(bin)) {
1784
+ report.cli.warnings.push(`Add ${path7.dirname(bin)} to the front of PATH and refresh the shell command cache. The absolute executable was verified.`);
1805
1785
  report.next_steps.push(`Use the verified executable at ${bin}, or correct PATH before invoking ae-cli.`);
1806
1786
  }
1807
1787
  if (skipSkills) {
@@ -1810,7 +1790,7 @@ function runInstallation(options = {}) {
1810
1790
  progress(`[ae-cli] [3/4] ${skipSkills}`);
1811
1791
  } else if (context) {
1812
1792
  stage = "skills_local";
1813
- const skillsPath = path8.join(packageRoot, "skills");
1793
+ const skillsPath = path7.join(packageRoot, "skills");
1814
1794
  const skills = readBundledSkills(skillsPath);
1815
1795
  if (!isBusinessSkillContextCurrent(context)) {
1816
1796
  return failInstallation(report, stage, "The active environment changed during CLI installation. Re-run install or update to synchronize its Skills.");
@@ -1873,14 +1853,14 @@ var LOCK_STALE_MS = 10 * 60 * 1e3;
1873
1853
  var SYNC_STATE_FILE = "version-sync.json";
1874
1854
  var SYNC_LOCK_FILE = "version-sync.lock";
1875
1855
  function syncStatePath() {
1876
- return path9.join(getConfigDir(), SYNC_STATE_FILE);
1856
+ return path8.join(getConfigDir(), SYNC_STATE_FILE);
1877
1857
  }
1878
1858
  function syncLockPath() {
1879
- return path9.join(getConfigDir(), SYNC_LOCK_FILE);
1859
+ return path8.join(getConfigDir(), SYNC_LOCK_FILE);
1880
1860
  }
1881
1861
  function readSyncStore() {
1882
1862
  try {
1883
- const raw = JSON.parse(fs9.readFileSync(syncStatePath(), "utf8"));
1863
+ const raw = JSON.parse(fs8.readFileSync(syncStatePath(), "utf8"));
1884
1864
  if (raw && typeof raw === "object" && raw.hosts && typeof raw.hosts === "object") {
1885
1865
  return raw;
1886
1866
  }
@@ -1890,8 +1870,8 @@ function readSyncStore() {
1890
1870
  }
1891
1871
  function writeSyncStore(store) {
1892
1872
  try {
1893
- fs9.mkdirSync(getConfigDir(), { recursive: true });
1894
- fs9.writeFileSync(syncStatePath(), JSON.stringify(store, null, 2));
1873
+ fs8.mkdirSync(getConfigDir(), { recursive: true });
1874
+ fs8.writeFileSync(syncStatePath(), JSON.stringify(store, null, 2));
1895
1875
  } catch {
1896
1876
  }
1897
1877
  }
@@ -1995,20 +1975,20 @@ function friendlyVersionSyncFailure(result2) {
1995
1975
  return `Version synchronization failed at ${result2.stage}.`;
1996
1976
  }
1997
1977
  function acquireInstallLock(now) {
1998
- fs9.mkdirSync(getConfigDir(), { recursive: true });
1978
+ fs8.mkdirSync(getConfigDir(), { recursive: true });
1999
1979
  const file = syncLockPath();
2000
1980
  try {
2001
- return fs9.openSync(file, "wx");
1981
+ return fs8.openSync(file, "wx");
2002
1982
  } catch {
2003
1983
  try {
2004
- const age = now.getTime() - fs9.statSync(file).mtimeMs;
1984
+ const age = now.getTime() - fs8.statSync(file).mtimeMs;
2005
1985
  if (age >= LOCK_STALE_MS) {
2006
- fs9.unlinkSync(file);
2007
- return fs9.openSync(file, "wx");
1986
+ fs8.unlinkSync(file);
1987
+ return fs8.openSync(file, "wx");
2008
1988
  }
2009
1989
  } catch {
2010
1990
  try {
2011
- return fs9.openSync(file, "wx");
1991
+ return fs8.openSync(file, "wx");
2012
1992
  } catch {
2013
1993
  return null;
2014
1994
  }
@@ -2018,11 +1998,11 @@ function acquireInstallLock(now) {
2018
1998
  }
2019
1999
  function releaseInstallLock(fd) {
2020
2000
  try {
2021
- fs9.closeSync(fd);
2001
+ fs8.closeSync(fd);
2022
2002
  } catch {
2023
2003
  }
2024
2004
  try {
2025
- fs9.unlinkSync(syncLockPath());
2005
+ fs8.unlinkSync(syncLockPath());
2026
2006
  } catch {
2027
2007
  }
2028
2008
  }
@@ -2084,12 +2064,12 @@ function autoSyncDirection(current, expected) {
2084
2064
 
2085
2065
  // src/core/feature-config.ts
2086
2066
  import crypto4 from "crypto";
2087
- import fs10 from "fs";
2088
- import path10 from "path";
2067
+ import fs9 from "fs";
2068
+ import path9 from "path";
2089
2069
  var FEATURE_TTL_MS = 24 * 60 * 60 * 1e3;
2090
2070
  var UNAVAILABLE_TTL_MS2 = 5 * 60 * 1e3;
2091
2071
  function cachePath2() {
2092
- return path10.join(getConfigDir(), "feature-config.json");
2072
+ return path9.join(getConfigDir(), "feature-config.json");
2093
2073
  }
2094
2074
  function cacheKey2(host, token) {
2095
2075
  const fingerprint = crypto4.createHash("sha256").update(token).digest("hex");
@@ -2097,7 +2077,7 @@ function cacheKey2(host, token) {
2097
2077
  }
2098
2078
  function readStore2() {
2099
2079
  try {
2100
- const value = JSON.parse(fs10.readFileSync(cachePath2(), "utf8"));
2080
+ const value = JSON.parse(fs9.readFileSync(cachePath2(), "utf8"));
2101
2081
  return value?.entries && typeof value.entries === "object" ? value : { entries: {} };
2102
2082
  } catch {
2103
2083
  return { entries: {} };
@@ -2107,13 +2087,13 @@ function writeStore(store) {
2107
2087
  const target = cachePath2();
2108
2088
  const temp = `${target}.${process.pid}.${crypto4.randomBytes(6).toString("hex")}.tmp`;
2109
2089
  try {
2110
- fs10.mkdirSync(path10.dirname(target), { recursive: true });
2111
- fs10.writeFileSync(temp, JSON.stringify(store), { encoding: "utf8", mode: 384 });
2112
- fs10.renameSync(temp, target);
2113
- fs10.chmodSync(target, 384);
2090
+ fs9.mkdirSync(path9.dirname(target), { recursive: true });
2091
+ fs9.writeFileSync(temp, JSON.stringify(store), { encoding: "utf8", mode: 384 });
2092
+ fs9.renameSync(temp, target);
2093
+ fs9.chmodSync(target, 384);
2114
2094
  } catch {
2115
2095
  try {
2116
- fs10.rmSync(temp, { force: true });
2096
+ fs9.rmSync(temp, { force: true });
2117
2097
  } catch {
2118
2098
  }
2119
2099
  }
@@ -2160,13 +2140,13 @@ var NOTIFY_INTERVAL_MS = 24 * 60 * 60 * 1e3;
2160
2140
  var FETCH_TIMEOUT_MS = 3e3;
2161
2141
  var CLI_CONFIG_PATH = "/v1/ta/cli/config";
2162
2142
  function cacheFilePath() {
2163
- return path11.join(getConfigDir(), "compat-check.json");
2143
+ return path10.join(getConfigDir(), "compat-check.json");
2164
2144
  }
2165
2145
  function readStore3() {
2166
2146
  try {
2167
2147
  const file = cacheFilePath();
2168
- if (!fs11.existsSync(file)) return { hosts: {} };
2169
- const raw = JSON.parse(fs11.readFileSync(file, "utf8"));
2148
+ if (!fs10.existsSync(file)) return { hosts: {} };
2149
+ const raw = JSON.parse(fs10.readFileSync(file, "utf8"));
2170
2150
  if (!raw || typeof raw !== "object" || !raw.hosts) return { hosts: {} };
2171
2151
  return raw;
2172
2152
  } catch {
@@ -2176,8 +2156,8 @@ function readStore3() {
2176
2156
  function writeStore2(store) {
2177
2157
  try {
2178
2158
  const dir = getConfigDir();
2179
- if (!fs11.existsSync(dir)) fs11.mkdirSync(dir, { recursive: true });
2180
- fs11.writeFileSync(cacheFilePath(), JSON.stringify(store, null, 2));
2159
+ if (!fs10.existsSync(dir)) fs10.mkdirSync(dir, { recursive: true });
2160
+ fs10.writeFileSync(cacheFilePath(), JSON.stringify(store, null, 2));
2181
2161
  } catch {
2182
2162
  }
2183
2163
  }
@@ -2236,7 +2216,7 @@ async function fetchCliConfig(host, cliToken) {
2236
2216
  const options = {
2237
2217
  dispatcher,
2238
2218
  signal: controller.signal,
2239
- headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {} },
2219
+ headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {}, ...internalCallSourceHeaders() },
2240
2220
  ...externalCliTokenRequestOptions(url.toString())
2241
2221
  };
2242
2222
  resp = await fetch(url.toString(), options);
@@ -2502,7 +2482,6 @@ function notifyIfHostCompat(pkg, hostOverride) {
2502
2482
  export {
2503
2483
  exactVersion,
2504
2484
  installHost,
2505
- getLocalCliPackageInfo,
2506
2485
  businessForCommand,
2507
2486
  businessForCapability,
2508
2487
  canManageGlobalSkills,