@thinkingai/ae-cli 6.1.41 → 6.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-installation-guide.md +3 -2
- package/dist/{ai-monitor-OOOD4QDK.js → ai-monitor-E62FT3TT.js} +4 -4
- package/dist/ai-monitor.js +5 -5
- package/dist/{auth-6BUUY5XS.js → auth-SDK5OAGP.js} +3 -3
- package/dist/{capability-XXFCANX7.js → capability-F6YWGPZZ.js} +2 -2
- package/dist/{chunk-5YQSCMGS.js → chunk-CDBW5RE6.js} +1 -1
- package/dist/{chunk-EHH3ZF7D.js → chunk-DIYDOOBL.js} +1 -1
- package/dist/{chunk-I7H72CMN.js → chunk-GTENC5CO.js} +104 -82
- package/dist/{chunk-FPPCXG6K.js → chunk-KAZ5FWPB.js} +1 -1
- package/dist/{chunk-6W56UQPO.js → chunk-N2QILIGH.js} +1 -1
- package/dist/{chunk-BEVWMPCZ.js → chunk-ZK6KEGUR.js} +3 -3
- package/dist/{chunk-KDRE7SWM.js → chunk-ZSKLELL7.js} +1 -1
- package/dist/{compat-check-AO3BFA3N.js → compat-check-J5K3NO5G.js} +1 -1
- package/dist/{config-N5V4VNER.js → config-O3W6XLHO.js} +3 -3
- package/dist/index.js +20 -19
- package/dist/{metadata-OUJPEMLD.js → metadata-3GA2N27I.js} +4 -4
- package/dist/{personal-semantic-preference-WEAIZQXM.js → personal-semantic-preference-T2HFF2V4.js} +3 -3
- package/dist/{project-semantic-6VXUYU4A.js → project-semantic-WJOP2HGJ.js} +3 -3
- package/dist/{sync-BAV3UY46.js → sync-K65X7ODO.js} +2 -2
- package/dist/{te-analysis-43RCOPUA.js → te-analysis-7E2GVKOR.js} +4 -4
- package/dist/{te-community-ECNTP35Z.js → te-community-NQNSLNON.js} +3 -3
- package/dist/{te-dataops-ISEKYRLZ.js → te-dataops-PMI7UX36.js} +2 -2
- package/dist/{te-engage-LBKIZXZO.js → te-engage-EZBV5IPQ.js} +3 -3
- package/dist/{te-experiment-5TPQKN6B.js → te-experiment-RDB3TYBG.js} +3 -3
- package/dist/{te-kb-SHL56BJ5.js → te-kb-OWPJB243.js} +2 -2
- package/dist/{te-team-EZ3TZTLV.js → te-team-NCMN34IL.js} +2 -2
- package/dist/{update-WE7VNRKZ.js → update-LYVYF3KJ.js} +2 -2
- package/dist/{web-runtime-H53QKJS2.js → web-runtime-XJWDFVP3.js} +8 -4
- package/package.json +1 -1
- package/skills/ae-onboarding/SKILL.md +2 -4
- package/skills/ae-onboarding/references/onboarding_run.md +5 -1
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
|
|
26
26
|
// src/core/compat-check.ts
|
|
27
27
|
import fs10 from "fs";
|
|
28
|
-
import
|
|
28
|
+
import path12 from "path";
|
|
29
29
|
import { createHash as createHash3 } from "crypto";
|
|
30
30
|
import { Agent } from "undici";
|
|
31
31
|
|
|
@@ -316,7 +316,7 @@ function formatCompatNotice(verdict) {
|
|
|
316
316
|
|
|
317
317
|
// src/core/version-sync.ts
|
|
318
318
|
import fs8 from "fs";
|
|
319
|
-
import
|
|
319
|
+
import path10 from "path";
|
|
320
320
|
|
|
321
321
|
// src/core/onboarding/contracts.ts
|
|
322
322
|
var DEMO_CONTEXT = "project.plg_demo.context";
|
|
@@ -1346,7 +1346,7 @@ async function verifyAndCompleteProgress(deps, host, runId) {
|
|
|
1346
1346
|
|
|
1347
1347
|
// src/core/installation.ts
|
|
1348
1348
|
import fs7 from "fs";
|
|
1349
|
-
import
|
|
1349
|
+
import path9 from "path";
|
|
1350
1350
|
import crypto4 from "crypto";
|
|
1351
1351
|
|
|
1352
1352
|
// src/core/skills-install.ts
|
|
@@ -1431,6 +1431,7 @@ function verifyGlobalSkills(skills, directory) {
|
|
|
1431
1431
|
}
|
|
1432
1432
|
|
|
1433
1433
|
// src/core/host-guidance.ts
|
|
1434
|
+
import path4 from "path";
|
|
1434
1435
|
function normalizeRegistrationLanguage(value) {
|
|
1435
1436
|
const language = value.trim().toLowerCase().split(/[_.:@-]/)[0];
|
|
1436
1437
|
if (language === "zh" || language === "cn") return "zh-CN";
|
|
@@ -1438,14 +1439,32 @@ function normalizeRegistrationLanguage(value) {
|
|
|
1438
1439
|
if (language === "ko" || language === "kr") return "ko-KR";
|
|
1439
1440
|
return language === "en" ? "en-US" : void 0;
|
|
1440
1441
|
}
|
|
1441
|
-
function
|
|
1442
|
-
|
|
1442
|
+
function terminalRegistrationLanguage(env) {
|
|
1443
|
+
const locale = [env.LC_ALL, env.LC_MESSAGES, env.LANG, env.LANGUAGE].map((value) => value?.trim()).find((value) => value && !/^(?:C|POSIX)(?:[.@].*)?$/i.test(value));
|
|
1444
|
+
return normalizeRegistrationLanguage(locale ?? "");
|
|
1445
|
+
}
|
|
1446
|
+
function localRegistrationLanguage(env = process.env, platform = process.platform, runner = defaultInstallRunner) {
|
|
1447
|
+
const override = normalizeRegistrationLanguage(env.AE_LANG ?? "");
|
|
1448
|
+
if (override) return override;
|
|
1449
|
+
let systemLocale;
|
|
1450
|
+
if (platform === "darwin") {
|
|
1451
|
+
const result2 = runner("/usr/bin/defaults", ["read", "-g", "AppleLanguages"], 1e3);
|
|
1452
|
+
if (commandSucceeded(result2)) {
|
|
1453
|
+
systemLocale = result2.stdout.match(/^\s*\(\s*"?([\w-]+)"?\s*[,)]/u)?.[1];
|
|
1454
|
+
}
|
|
1455
|
+
} else if (platform === "win32") {
|
|
1456
|
+
const powershell = path4.win32.join(env.SystemRoot ?? "C:\\Windows", "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
1457
|
+
const result2 = runner(powershell, ["-NoProfile", "-NonInteractive", "-Command", "(Get-UICulture).Name"], 2e3);
|
|
1458
|
+
if (commandSucceeded(result2)) systemLocale = result2.stdout.trim();
|
|
1459
|
+
}
|
|
1460
|
+
return systemLocale ? normalizeRegistrationLanguage(systemLocale) : terminalRegistrationLanguage(env);
|
|
1443
1461
|
}
|
|
1444
|
-
function onboardingDeviceMarket(
|
|
1445
|
-
return
|
|
1462
|
+
function onboardingDeviceMarket(language) {
|
|
1463
|
+
return language === "zh-CN" ? "cn" : "us";
|
|
1446
1464
|
}
|
|
1447
1465
|
function registrationLanguage(language, env = process.env) {
|
|
1448
|
-
|
|
1466
|
+
const locale = language || env.AE_LANG || env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE || "";
|
|
1467
|
+
return normalizeRegistrationLanguage(locale) ?? "en-US";
|
|
1449
1468
|
}
|
|
1450
1469
|
function registrationMarket(language) {
|
|
1451
1470
|
return { "zh-CN": "cn", "en-US": "us", "ja-JP": "jp", "ko-KR": "kr" }[language];
|
|
@@ -1480,7 +1499,7 @@ function missingAeHostGuidance() {
|
|
|
1480
1499
|
// src/core/business-config.ts
|
|
1481
1500
|
import crypto3 from "crypto";
|
|
1482
1501
|
import fs6 from "fs";
|
|
1483
|
-
import
|
|
1502
|
+
import path8 from "path";
|
|
1484
1503
|
|
|
1485
1504
|
// src/core/skill-businesses.json
|
|
1486
1505
|
var skill_businesses_default = {
|
|
@@ -1667,18 +1686,18 @@ function canManageGlobalSkills() {
|
|
|
1667
1686
|
// src/core/business-skill-refresh.ts
|
|
1668
1687
|
import crypto2 from "crypto";
|
|
1669
1688
|
import fs5 from "fs";
|
|
1670
|
-
import
|
|
1689
|
+
import path7 from "path";
|
|
1671
1690
|
|
|
1672
1691
|
// src/core/business-skill-sync.ts
|
|
1673
1692
|
import fs4 from "fs";
|
|
1674
1693
|
import os3 from "os";
|
|
1675
|
-
import
|
|
1694
|
+
import path6 from "path";
|
|
1676
1695
|
import { createHash as createHash2, randomUUID } from "crypto";
|
|
1677
1696
|
|
|
1678
1697
|
// src/core/skills-tool.ts
|
|
1679
1698
|
import fs3 from "fs";
|
|
1680
1699
|
import os2 from "os";
|
|
1681
|
-
import
|
|
1700
|
+
import path5 from "path";
|
|
1682
1701
|
import { createHash } from "crypto";
|
|
1683
1702
|
import { createRequire, isBuiltin } from "module";
|
|
1684
1703
|
import { pathToFileURL } from "url";
|
|
@@ -1704,25 +1723,25 @@ function realSkillPath(file) {
|
|
|
1704
1723
|
return fs3.realpathSync(file);
|
|
1705
1724
|
} catch (error) {
|
|
1706
1725
|
if (error.code !== "ENOENT") throw error;
|
|
1707
|
-
const parent =
|
|
1726
|
+
const parent = path5.dirname(file);
|
|
1708
1727
|
if (parent === file) throw error;
|
|
1709
|
-
return
|
|
1728
|
+
return path5.join(realSkillPath(parent), path5.basename(file));
|
|
1710
1729
|
}
|
|
1711
1730
|
}
|
|
1712
1731
|
function skillPathProblem(targetDirectory, skill, sourceRoot) {
|
|
1713
1732
|
try {
|
|
1714
|
-
const target = realSkillPath(
|
|
1715
|
-
const source = realSkillPath(
|
|
1716
|
-
const overlaps = (a, b) => a === b || a.startsWith(b +
|
|
1733
|
+
const target = realSkillPath(path5.resolve(targetDirectory, skill));
|
|
1734
|
+
const source = realSkillPath(path5.resolve(sourceRoot));
|
|
1735
|
+
const overlaps = (a, b) => a === b || a.startsWith(b + path5.sep);
|
|
1717
1736
|
if (overlaps(target, source) || overlaps(source, target)) return "package_source_overlap";
|
|
1718
|
-
let parent =
|
|
1737
|
+
let parent = path5.resolve(targetDirectory);
|
|
1719
1738
|
while (true) {
|
|
1720
1739
|
try {
|
|
1721
1740
|
if (fs3.lstatSync(parent).isSymbolicLink()) return "copy_parent_linked";
|
|
1722
1741
|
} catch (error) {
|
|
1723
1742
|
if (error.code !== "ENOENT") throw error;
|
|
1724
1743
|
}
|
|
1725
|
-
const next =
|
|
1744
|
+
const next = path5.dirname(parent);
|
|
1726
1745
|
if (next === parent) return null;
|
|
1727
1746
|
parent = next;
|
|
1728
1747
|
}
|
|
@@ -1739,13 +1758,13 @@ function skillCopyHash(directory, source = false) {
|
|
|
1739
1758
|
}
|
|
1740
1759
|
const hash = createHash("sha256");
|
|
1741
1760
|
const visit = (relative) => {
|
|
1742
|
-
for (const name of fs3.readdirSync(
|
|
1761
|
+
for (const name of fs3.readdirSync(path5.join(directory, relative)).sort()) {
|
|
1743
1762
|
if (name === ".DS_Store") continue;
|
|
1744
|
-
const child =
|
|
1745
|
-
const absolute =
|
|
1763
|
+
const child = path5.join(relative, name);
|
|
1764
|
+
const absolute = path5.join(directory, child);
|
|
1746
1765
|
const stat = fs3.lstatSync(absolute);
|
|
1747
1766
|
if (source && (name === "metadata.json" || stat.isDirectory() && [".git", "__pycache__", "__pypackages__"].includes(name))) continue;
|
|
1748
|
-
const normalized = child.split(
|
|
1767
|
+
const normalized = child.split(path5.sep).join("/");
|
|
1749
1768
|
if (stat.isSymbolicLink()) throw new Error("Symbolic links are not managed Skill copies.");
|
|
1750
1769
|
if (stat.isDirectory()) {
|
|
1751
1770
|
hash.update(`directory:${normalized}\0`);
|
|
@@ -1809,7 +1828,7 @@ function adaptedToolSource(source, entry) {
|
|
|
1809
1828
|
);
|
|
1810
1829
|
source = replaceOnce(source, "main().finally(() => flushTelemetry().then(() => process.exit(0)));", "");
|
|
1811
1830
|
const require2 = createRequire(entry);
|
|
1812
|
-
const resolveImport = (specifier) => isBuiltin(specifier) ? specifier : pathToFileURL(specifier.startsWith(".") ?
|
|
1831
|
+
const resolveImport = (specifier) => isBuiltin(specifier) ? specifier : pathToFileURL(specifier.startsWith(".") ? path5.resolve(path5.dirname(entry), specifier) : require2.resolve(specifier)).href;
|
|
1813
1832
|
source = source.replace(
|
|
1814
1833
|
/\bfrom (['"])([^'"]+)\1/g,
|
|
1815
1834
|
(_match, quote, specifier) => `from ${quote}${resolveImport(specifier)}${quote}`
|
|
@@ -2019,8 +2038,8 @@ catch { process.stdout.write(JSON.stringify({ ok: false })); process.exitCode =
|
|
|
2019
2038
|
`;
|
|
2020
2039
|
function createPinnedSkillsTool(options = {}) {
|
|
2021
2040
|
const require2 = createRequire(import.meta.url);
|
|
2022
|
-
const packageFile = options.entry ?
|
|
2023
|
-
const entry = options.entry ??
|
|
2041
|
+
const packageFile = options.entry ? path5.join(path5.dirname(options.entry), "..", "package.json") : require2.resolve("skills/package.json");
|
|
2042
|
+
const entry = options.entry ?? path5.join(path5.dirname(packageFile), "dist", "cli.mjs");
|
|
2024
2043
|
const metadata = JSON.parse(fs3.readFileSync(packageFile, "utf8"));
|
|
2025
2044
|
const source = fs3.readFileSync(entry, "utf8");
|
|
2026
2045
|
if (metadata.version !== MANAGED_SKILLS_TOOL_VERSION || createHash("sha256").update(source).digest("hex") !== TOOL_SOURCE_SHA256) {
|
|
@@ -2028,8 +2047,8 @@ function createPinnedSkillsTool(options = {}) {
|
|
|
2028
2047
|
}
|
|
2029
2048
|
const script = adaptedToolSource(source, entry);
|
|
2030
2049
|
const run = (request2) => {
|
|
2031
|
-
const directory = fs3.mkdtempSync(
|
|
2032
|
-
const worker =
|
|
2050
|
+
const directory = fs3.mkdtempSync(path5.join(os2.tmpdir(), "ae-cli-skills-tool-"));
|
|
2051
|
+
const worker = path5.join(directory, "adapter.mjs");
|
|
2033
2052
|
try {
|
|
2034
2053
|
fs3.writeFileSync(worker, script, { mode: 384 });
|
|
2035
2054
|
const result2 = spawn2.sync(process.execPath, [worker], {
|
|
@@ -2065,17 +2084,17 @@ var POLICY_HASH = createHash2("sha256").update(JSON.stringify({ removal_policy:
|
|
|
2065
2084
|
function historicalCliSkills(options) {
|
|
2066
2085
|
const env = options.env ?? process.env;
|
|
2067
2086
|
const home = env.HOME || env.USERPROFILE || os3.homedir();
|
|
2068
|
-
const file = env.XDG_STATE_HOME ?
|
|
2087
|
+
const file = env.XDG_STATE_HOME ? path6.join(env.XDG_STATE_HOME, "skills", ".skill-lock.json") : path6.join(home, ".agents", ".skill-lock.json");
|
|
2069
2088
|
const names = /* @__PURE__ */ new Set();
|
|
2070
2089
|
let content = "";
|
|
2071
2090
|
const isCliSource = (value, type) => {
|
|
2072
2091
|
if (typeof value !== "string") return false;
|
|
2073
|
-
if (type === "local" &&
|
|
2074
|
-
const source2 =
|
|
2075
|
-
if (source2 ===
|
|
2076
|
-
if (
|
|
2092
|
+
if (type === "local" && path6.isAbsolute(value)) {
|
|
2093
|
+
const source2 = path6.resolve(value);
|
|
2094
|
+
if (source2 === path6.resolve(options.skillsDirectory)) return true;
|
|
2095
|
+
if (path6.basename(source2) !== "skills") return false;
|
|
2077
2096
|
try {
|
|
2078
|
-
const pkg = JSON.parse(fs4.readFileSync(
|
|
2097
|
+
const pkg = JSON.parse(fs4.readFileSync(path6.join(source2, "..", "package.json"), "utf8"));
|
|
2079
2098
|
return ["@tant/ae-cli", "@thinkingai/ae-cli"].includes(pkg.name) && typeof pkg.bin?.["ae-cli"] === "string";
|
|
2080
2099
|
} catch {
|
|
2081
2100
|
return false;
|
|
@@ -2136,7 +2155,7 @@ function reserveBusinessSkillContext(options) {
|
|
|
2136
2155
|
const directory = options.stateDirectory ?? getConfigDir();
|
|
2137
2156
|
fs4.mkdirSync(directory, { recursive: true, mode: 448 });
|
|
2138
2157
|
const generation = randomUUID();
|
|
2139
|
-
writeJson(
|
|
2158
|
+
writeJson(path6.join(directory, CONTEXT_FILE), { ...contextIdentity(options), generation });
|
|
2140
2159
|
return generation;
|
|
2141
2160
|
}
|
|
2142
2161
|
function currentContext(options, file, generation) {
|
|
@@ -2150,7 +2169,7 @@ function currentContext(options, file, generation) {
|
|
|
2150
2169
|
}
|
|
2151
2170
|
}
|
|
2152
2171
|
function isBusinessSkillContextCurrent(options) {
|
|
2153
|
-
return currentContext(options,
|
|
2172
|
+
return currentContext(options, path6.join(options.stateDirectory ?? getConfigDir(), CONTEXT_FILE), options.generation);
|
|
2154
2173
|
}
|
|
2155
2174
|
function takeLock(file) {
|
|
2156
2175
|
const owner = randomUUID();
|
|
@@ -2166,7 +2185,7 @@ function takeLock(file) {
|
|
|
2166
2185
|
};
|
|
2167
2186
|
try {
|
|
2168
2187
|
fs4.chmodSync(candidate, 448);
|
|
2169
|
-
fs4.writeFileSync(
|
|
2188
|
+
fs4.writeFileSync(path6.join(candidate, ownerName), JSON.stringify({ pid: process.pid, owner }), { mode: 384 });
|
|
2170
2189
|
for (let attempt = 0; attempt < 4; attempt++) {
|
|
2171
2190
|
try {
|
|
2172
2191
|
fs4.renameSync(candidate, file);
|
|
@@ -2176,7 +2195,7 @@ function takeLock(file) {
|
|
|
2176
2195
|
}
|
|
2177
2196
|
return () => {
|
|
2178
2197
|
try {
|
|
2179
|
-
fs4.unlinkSync(
|
|
2198
|
+
fs4.unlinkSync(path6.join(file, ownerName));
|
|
2180
2199
|
} catch {
|
|
2181
2200
|
}
|
|
2182
2201
|
try {
|
|
@@ -2221,7 +2240,7 @@ function takeLock(file) {
|
|
|
2221
2240
|
}
|
|
2222
2241
|
for (const name of names) {
|
|
2223
2242
|
try {
|
|
2224
|
-
fs4.unlinkSync(
|
|
2243
|
+
fs4.unlinkSync(path6.join(file, name));
|
|
2225
2244
|
} catch (cause) {
|
|
2226
2245
|
if (cause.code !== "ENOENT") throw cause;
|
|
2227
2246
|
}
|
|
@@ -2250,12 +2269,12 @@ function readLedger(file) {
|
|
|
2250
2269
|
throw new Error("Managed Skill ledger has an unsupported format.");
|
|
2251
2270
|
}
|
|
2252
2271
|
for (const [filePath, copy] of Object.entries(value.copies)) {
|
|
2253
|
-
if (!
|
|
2272
|
+
if (!path6.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.");
|
|
2254
2273
|
}
|
|
2255
2274
|
return value;
|
|
2256
2275
|
}
|
|
2257
2276
|
function result(skill, target, reason) {
|
|
2258
|
-
return { skill, agent: target.agent, path:
|
|
2277
|
+
return { skill, agent: target.agent, path: path6.join(target.directory, skill), ...reason ? { reason } : {} };
|
|
2259
2278
|
}
|
|
2260
2279
|
function directInstallerLink(file, target, text) {
|
|
2261
2280
|
if (typeof text !== "string") return false;
|
|
@@ -2263,14 +2282,14 @@ function directInstallerLink(file, target, text) {
|
|
|
2263
2282
|
if (process.platform === "win32") {
|
|
2264
2283
|
if (value.toUpperCase().startsWith("\\\\?\\UNC\\")) value = "\\\\" + value.slice(8);
|
|
2265
2284
|
else if (value.startsWith("\\\\?\\") || value.startsWith("\\??\\")) value = value.slice(4);
|
|
2266
|
-
return [target,
|
|
2285
|
+
return [target, path6.relative(path6.dirname(file), target)].some((expected) => value.toLowerCase() === expected.toLowerCase());
|
|
2267
2286
|
}
|
|
2268
|
-
return value === target || value ===
|
|
2287
|
+
return value === target || value === path6.relative(path6.dirname(file), target);
|
|
2269
2288
|
}
|
|
2270
2289
|
function legacySkillLink(file, skill, sourceRoot, sourceHash, targets, ledger, removing = false) {
|
|
2271
2290
|
const canonical = targets.find((target2) => target2.agent === "universal");
|
|
2272
2291
|
if (!canonical) return;
|
|
2273
|
-
const target =
|
|
2292
|
+
const target = path6.join(canonical.directory, skill);
|
|
2274
2293
|
const managed = ledger.copies[target];
|
|
2275
2294
|
if (!managed || managed.skill !== skill || managed.agent !== canonical.agent || !removing && managed.hash !== sourceHash || skillPathProblem(canonical.directory, skill, sourceRoot)) return;
|
|
2276
2295
|
try {
|
|
@@ -2294,7 +2313,7 @@ function syncBusinessSkills(options) {
|
|
|
2294
2313
|
managed_count: 0
|
|
2295
2314
|
};
|
|
2296
2315
|
const directory = options.stateDirectory ?? getConfigDir();
|
|
2297
|
-
const contextFile =
|
|
2316
|
+
const contextFile = path6.join(directory, CONTEXT_FILE);
|
|
2298
2317
|
let unlock = null;
|
|
2299
2318
|
try {
|
|
2300
2319
|
if (options.isCurrentContext && !options.isCurrentContext()) {
|
|
@@ -2307,7 +2326,7 @@ function syncBusinessSkills(options) {
|
|
|
2307
2326
|
report.status = "stale";
|
|
2308
2327
|
return report;
|
|
2309
2328
|
}
|
|
2310
|
-
unlock = takeLock(
|
|
2329
|
+
unlock = takeLock(path6.join(directory, LOCK_FILE));
|
|
2311
2330
|
if (!unlock) {
|
|
2312
2331
|
report.status = "busy";
|
|
2313
2332
|
return report;
|
|
@@ -2316,7 +2335,7 @@ function syncBusinessSkills(options) {
|
|
|
2316
2335
|
report.status = "stale";
|
|
2317
2336
|
return report;
|
|
2318
2337
|
}
|
|
2319
|
-
const ledgerFile =
|
|
2338
|
+
const ledgerFile = path6.join(directory, LEDGER_FILE);
|
|
2320
2339
|
const ledger = readLedger(ledgerFile);
|
|
2321
2340
|
const packageVersion = options.packageVersion ?? "unknown";
|
|
2322
2341
|
const history = historicalCliSkills(options);
|
|
@@ -2370,7 +2389,7 @@ function syncBusinessSkills(options) {
|
|
|
2370
2389
|
for (const name of skills) {
|
|
2371
2390
|
const state = getSkillBusinessState(name, options.businesses);
|
|
2372
2391
|
if (options.mode !== "adopt" && state === void 0) continue;
|
|
2373
|
-
const source =
|
|
2392
|
+
const source = path6.join(options.skillsDirectory, name);
|
|
2374
2393
|
const sourceHash = bundled.some((skill) => skill.name === name) ? skillCopyHash(source, true) : null;
|
|
2375
2394
|
if (!sourceHash && options.mode === "adopt") throw new Error("Complete package Skill source is missing.");
|
|
2376
2395
|
for (const target of targets) {
|
|
@@ -2395,7 +2414,7 @@ function syncBusinessSkills(options) {
|
|
|
2395
2414
|
}
|
|
2396
2415
|
const legacyLink2 = node.type === "symlink" ? legacySkillLink(item.path, name, options.skillsDirectory, sourceHash ?? "", targets, ledger, true) : void 0;
|
|
2397
2416
|
const canonical = targets.find((copy) => copy.agent === "universal");
|
|
2398
|
-
const historicalLink = node.type === "symlink" && canonical && directInstallerLink(item.path,
|
|
2417
|
+
const historicalLink = node.type === "symlink" && canonical && directInstallerLink(item.path, path6.join(canonical.directory, name), node.link);
|
|
2399
2418
|
const historicalCopy = history.names.has(name) && (target.agent === "universal" && node.type !== "symlink" || historicalLink);
|
|
2400
2419
|
if (!managed && (legacyLink2 || historicalCopy)) {
|
|
2401
2420
|
ledger.copies[item.path] = {
|
|
@@ -2558,8 +2577,8 @@ function syncRefreshedBusinessSkills(refresh, businesses) {
|
|
|
2558
2577
|
if (!Object.keys(states).length) return;
|
|
2559
2578
|
try {
|
|
2560
2579
|
const pkg = getLocalCliPackageInfo();
|
|
2561
|
-
const options = { ...refresh, skillsDirectory:
|
|
2562
|
-
if (!fs5.existsSync(
|
|
2580
|
+
const options = { ...refresh, skillsDirectory: path7.join(pkg.root, "skills"), businesses: states, packageVersion: pkg.version };
|
|
2581
|
+
if (!fs5.existsSync(path7.join(getConfigDir(), "business-skills.json"))) {
|
|
2563
2582
|
const adoption = syncBusinessSkills({ ...options, mode: "adopt" });
|
|
2564
2583
|
if (["failed", "busy", "stale"].includes(adoption.status)) {
|
|
2565
2584
|
if (adoption.status !== "stale") process.stderr.write("[ae-cli] Skills could not be synchronized. Retry: ae-cli config refresh\n");
|
|
@@ -2579,7 +2598,7 @@ function syncRefreshedBusinessSkills(refresh, businesses) {
|
|
|
2579
2598
|
var BUSINESS_CONFIG_TTL_MS = 10 * 60 * 1e3;
|
|
2580
2599
|
var UNAVAILABLE_TTL_MS = 5 * 60 * 1e3;
|
|
2581
2600
|
function cachePath() {
|
|
2582
|
-
return
|
|
2601
|
+
return path8.join(getConfigDir(), "business-config.json");
|
|
2583
2602
|
}
|
|
2584
2603
|
function cacheKey(host, token) {
|
|
2585
2604
|
return `${normalizeUrl(host)}#${crypto3.createHash("sha256").update(token).digest("hex")}`;
|
|
@@ -2598,7 +2617,7 @@ function remember(host, token, entry) {
|
|
|
2598
2617
|
const target = cachePath();
|
|
2599
2618
|
const temporary = `${target}.${process.pid}.${crypto3.randomBytes(6).toString("hex")}.tmp`;
|
|
2600
2619
|
try {
|
|
2601
|
-
fs6.mkdirSync(
|
|
2620
|
+
fs6.mkdirSync(path8.dirname(target), { recursive: true });
|
|
2602
2621
|
fs6.writeFileSync(temporary, JSON.stringify(store), { encoding: "utf8", mode: 384 });
|
|
2603
2622
|
fs6.renameSync(temporary, target);
|
|
2604
2623
|
fs6.chmodSync(target, 384);
|
|
@@ -2673,7 +2692,7 @@ async function readBusinessConfigForExecution(hostOverride, synchronizeSkills =
|
|
|
2673
2692
|
const token = peekCliToken(host);
|
|
2674
2693
|
if (!token) return {};
|
|
2675
2694
|
return await resolveBusinessConfig(host, token, async () => {
|
|
2676
|
-
const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-
|
|
2695
|
+
const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-J5K3NO5G.js");
|
|
2677
2696
|
return fetchCliConfig2(host, token);
|
|
2678
2697
|
}, Date.now(), synchronizeSkills);
|
|
2679
2698
|
} catch {
|
|
@@ -2704,9 +2723,10 @@ function newInstallationReport(packageName, version, dryRun = false) {
|
|
|
2704
2723
|
return {
|
|
2705
2724
|
ok: false,
|
|
2706
2725
|
dry_run: dryRun,
|
|
2707
|
-
// Keep the next interaction visible before
|
|
2726
|
+
// Keep the next interaction and detected language visible before Skill synchronization details.
|
|
2708
2727
|
next_action: void 0,
|
|
2709
2728
|
interaction: void 0,
|
|
2729
|
+
local_language: void 0,
|
|
2710
2730
|
cli: { package: packageName, version, path: null, entrypoint: null, verified: false, action: "pending", warnings: [] },
|
|
2711
2731
|
skills: {
|
|
2712
2732
|
directory: globalSkillsDirectory(),
|
|
@@ -2732,7 +2752,7 @@ function failInstallation(report, stage, message, cause = "validation") {
|
|
|
2732
2752
|
function installPlan(packageName, version, root = "<npm-root>") {
|
|
2733
2753
|
const config = distribution(packageName);
|
|
2734
2754
|
const target = exactVersion(version);
|
|
2735
|
-
const executable =
|
|
2755
|
+
const executable = path9.join(root, packageName, "bin", "ae-cli.js");
|
|
2736
2756
|
return [
|
|
2737
2757
|
`npm install -g ${packageName}@${target} --registry=${config.registry}`,
|
|
2738
2758
|
`node ${JSON.stringify(executable)} install`
|
|
@@ -2752,7 +2772,7 @@ function skipGlobalSkillReason() {
|
|
|
2752
2772
|
}
|
|
2753
2773
|
function readPackage(root) {
|
|
2754
2774
|
try {
|
|
2755
|
-
return JSON.parse(fs7.readFileSync(
|
|
2775
|
+
return JSON.parse(fs7.readFileSync(path9.join(root, "package.json"), "utf8"));
|
|
2756
2776
|
} catch {
|
|
2757
2777
|
return null;
|
|
2758
2778
|
}
|
|
@@ -2765,13 +2785,13 @@ function linked(root) {
|
|
|
2765
2785
|
}
|
|
2766
2786
|
}
|
|
2767
2787
|
function cliBinBelongsToPackage(bin, packageRoot, platform) {
|
|
2768
|
-
const entry = fs7.realpathSync(
|
|
2788
|
+
const entry = fs7.realpathSync(path9.join(packageRoot, "bin", "ae-cli.js"));
|
|
2769
2789
|
if (platform !== "win32") return fs7.realpathSync(bin) === entry;
|
|
2770
2790
|
const shim = fs7.readFileSync(bin, "utf8");
|
|
2771
2791
|
const targets = [...shim.matchAll(/"%(?:dp0%|~dp0)[\\/]([^"\r\n]+)"/gi)];
|
|
2772
2792
|
return targets.some(([, relative]) => {
|
|
2773
2793
|
try {
|
|
2774
|
-
const target =
|
|
2794
|
+
const target = path9.resolve(path9.dirname(bin), relative.replace(/\\/g, path9.sep));
|
|
2775
2795
|
return fs7.realpathSync(target).toLowerCase() === entry.toLowerCase();
|
|
2776
2796
|
} catch {
|
|
2777
2797
|
return false;
|
|
@@ -2813,9 +2833,9 @@ function runInstallation(options = {}) {
|
|
|
2813
2833
|
const prefixResult = runner(npm, ["prefix", "-g"], 15e3);
|
|
2814
2834
|
const globalRoot = rootResult.stdout.trim();
|
|
2815
2835
|
const prefix = prefixResult.stdout.trim();
|
|
2816
|
-
if (!commandSucceeded(rootResult) || !commandSucceeded(prefixResult) || !
|
|
2817
|
-
const packageRoot =
|
|
2818
|
-
const bin = platform === "win32" ?
|
|
2836
|
+
if (!commandSucceeded(rootResult) || !commandSucceeded(prefixResult) || !path9.isAbsolute(globalRoot) || !path9.isAbsolute(prefix) || /[\r\n]/.test(globalRoot + prefix)) return failInstallation(report, stage, "Cannot resolve npm global root and prefix. Check npm configuration.");
|
|
2837
|
+
const packageRoot = path9.join(globalRoot, packageName);
|
|
2838
|
+
const bin = platform === "win32" ? path9.join(prefix, "ae-cli.cmd") : path9.join(prefix, "bin", "ae-cli");
|
|
2819
2839
|
report.cli.path = bin;
|
|
2820
2840
|
const env = options.env ?? process.env;
|
|
2821
2841
|
const installedBefore = readPackage(packageRoot);
|
|
@@ -2838,8 +2858,8 @@ function runInstallation(options = {}) {
|
|
|
2838
2858
|
};
|
|
2839
2859
|
const generation = reserveBusinessSkillContext({ ...identity, stateDirectory });
|
|
2840
2860
|
context = { ...identity, stateDirectory, generation, isCurrentContext };
|
|
2841
|
-
if (!fs7.existsSync(
|
|
2842
|
-
const previousSkills =
|
|
2861
|
+
if (!fs7.existsSync(path9.join(stateDirectory, "business-skills.json")) && installedBefore?.name === packageName) {
|
|
2862
|
+
const previousSkills = path9.join(packageRoot, "skills");
|
|
2843
2863
|
try {
|
|
2844
2864
|
readInstallableSkills(previousSkills);
|
|
2845
2865
|
syncSkills({ ...context, skillsDirectory: previousSkills, businesses: {}, mode: "adopt", packageVersion: installedBefore.version });
|
|
@@ -2868,12 +2888,12 @@ function runInstallation(options = {}) {
|
|
|
2868
2888
|
if (!cliBinBelongsToPackage(bin, packageRoot, platform)) return failInstallation(report, stage, "The global executable does not belong to the installed CLI package.");
|
|
2869
2889
|
const versionResult = runner(bin, ["--version"], 15e3);
|
|
2870
2890
|
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.");
|
|
2871
|
-
report.cli.entrypoint = fs7.realpathSync(
|
|
2891
|
+
report.cli.entrypoint = fs7.realpathSync(path9.join(packageRoot, "bin", "ae-cli.js"));
|
|
2872
2892
|
report.cli.verified = true;
|
|
2873
2893
|
const pathKey = platform === "win32" ? Object.keys(env).find((key) => key.toLowerCase() === "path") : "PATH";
|
|
2874
|
-
const installedPathBin = (env[pathKey ?? "PATH"] ?? "").split(platform === "win32" ? ";" :
|
|
2894
|
+
const installedPathBin = (env[pathKey ?? "PATH"] ?? "").split(platform === "win32" ? ";" : path9.delimiter).filter(Boolean).map((dir) => path9.join(dir.replace(/^"(.*)"$/, "$1"), platform === "win32" ? "ae-cli.cmd" : "ae-cli")).find((file) => fs7.existsSync(file) && !file.includes(`${path9.sep}_npx${path9.sep}`));
|
|
2875
2895
|
if (!installedPathBin || fs7.realpathSync(installedPathBin) !== fs7.realpathSync(bin)) {
|
|
2876
|
-
report.cli.warnings.push(`Add ${
|
|
2896
|
+
report.cli.warnings.push(`Add ${path9.dirname(bin)} to the front of PATH and refresh the shell command cache. The absolute executable was verified.`);
|
|
2877
2897
|
report.next_steps.push(`Use the verified executable at ${bin}, or correct PATH before invoking ae-cli.`);
|
|
2878
2898
|
}
|
|
2879
2899
|
if (skipSkills) {
|
|
@@ -2882,7 +2902,7 @@ function runInstallation(options = {}) {
|
|
|
2882
2902
|
progress(`[ae-cli] [3/4] ${skipSkills}`);
|
|
2883
2903
|
} else if (context) {
|
|
2884
2904
|
stage = "skills_local";
|
|
2885
|
-
const skillsPath =
|
|
2905
|
+
const skillsPath = path9.join(packageRoot, "skills");
|
|
2886
2906
|
const skills = readInstallableSkills(skillsPath);
|
|
2887
2907
|
if (!isBusinessSkillContextCurrent(context)) {
|
|
2888
2908
|
return failInstallation(report, stage, "The active environment changed during CLI installation. Re-run install or update to synchronize its Skills.");
|
|
@@ -2938,13 +2958,11 @@ function runInstallation(options = {}) {
|
|
|
2938
2958
|
report.ok = true;
|
|
2939
2959
|
return report;
|
|
2940
2960
|
}
|
|
2941
|
-
const localLanguage = localRegistrationLanguage(env);
|
|
2942
|
-
const language = localLanguage ?? "en-US";
|
|
2943
|
-
const deviceMarket = onboardingDeviceMarket(env);
|
|
2944
2961
|
if (guideAccountSetup) {
|
|
2962
|
+
const localLanguage = localRegistrationLanguage(env, platform, runner);
|
|
2945
2963
|
if (localLanguage) report.local_language = localLanguage;
|
|
2946
|
-
report.onboarding_market =
|
|
2947
|
-
const onboardingSkillPath =
|
|
2964
|
+
report.onboarding_market = onboardingDeviceMarket(localLanguage);
|
|
2965
|
+
const onboardingSkillPath = path9.join(packageRoot, "skills", "ae-onboarding", "SKILL.md");
|
|
2948
2966
|
if (fs7.existsSync(onboardingSkillPath)) report.onboarding_skill_path = onboardingSkillPath;
|
|
2949
2967
|
if (report.auth.authenticated === true) {
|
|
2950
2968
|
report.next_action = isOnboardingProgressHost(report.auth.host ?? void 0) ? "check_onboarding" : "continue_using_ae";
|
|
@@ -2971,14 +2989,17 @@ function runInstallation(options = {}) {
|
|
|
2971
2989
|
}
|
|
2972
2990
|
if (chooseAccount || !report.auth.host) {
|
|
2973
2991
|
const source = cliEntrySource(void 0, env);
|
|
2974
|
-
const registration = aeRegistrationUrl(chooseAccount ? deviceMarket === "cn" ? "zh-CN" : "en-US" : language, env, source);
|
|
2975
2992
|
if (chooseAccount) {
|
|
2976
2993
|
report.next_steps.push(`After the user confirms signup in the overseas test environment, run ae-cli analysis onboarding run --website-env test --region us --source ${source} --browser system --format json. Use jp or kr for the corresponding requested test market and keep the returned session_id.`);
|
|
2977
|
-
report.next_steps.push(
|
|
2994
|
+
report.next_steps.push(
|
|
2995
|
+
"For production signup, honor an explicitly requested or confirmed market first. Otherwise compare local_language with the language of the user\u2019s own request, excluding commands, links, quoted text, and picker labels. Map Chinese to cn, English to us, Japanese to jp, and Korean to kr. If both signals agree or only one maps to a market, use that market. When the two markets differ, show only those two options and wait. Use us if neither language maps to a market.",
|
|
2996
|
+
`After the user chooses \u201CCreate an AE account\u201D or directly asks to sign up, run ae-cli analysis onboarding run --region <market> --source ${source} --browser system --format json with the resolved market. Pass --language separately for the display preference. If the browser cannot open, share the returned login_url. Read the returned skill_path and resume with its session_id after sign-in.`
|
|
2997
|
+
);
|
|
2978
2998
|
} else {
|
|
2999
|
+
const language = registrationLanguage(void 0, env);
|
|
3000
|
+
const registration = aeRegistrationUrl(language, env, source);
|
|
2979
3001
|
report.next_steps.push(`New or returning website users: for guided website verification, run ae-cli analysis onboarding run --language ${language} --source ${source} --browser system. For manual registration or sign-in, use ${registration} in the system default browser.`);
|
|
2980
3002
|
}
|
|
2981
|
-
if (chooseAccount) report.next_steps.push(`Chinese device locales, including Traditional Chinese, default to China. Other device locales default to the United States. The current default is ${deviceMarket}. Explicit --region cn|jp|kr|us still selects the requested market. Display language changes presentation only.`);
|
|
2982
3003
|
}
|
|
2983
3004
|
if (chooseAccount) report.next_steps.push("Existing AE users: confirm their original AE environment URL and use it for login. Ask for that URL if it is unknown.");
|
|
2984
3005
|
else if (!report.auth.host) report.next_steps.push("Existing AE users: use your original environment URL, or ask your administrator.");
|
|
@@ -3000,10 +3021,10 @@ var LOCK_STALE_MS = 10 * 60 * 1e3;
|
|
|
3000
3021
|
var SYNC_STATE_FILE = "version-sync.json";
|
|
3001
3022
|
var SYNC_LOCK_FILE = "version-sync.lock";
|
|
3002
3023
|
function syncStatePath() {
|
|
3003
|
-
return
|
|
3024
|
+
return path10.join(getConfigDir(), SYNC_STATE_FILE);
|
|
3004
3025
|
}
|
|
3005
3026
|
function syncLockPath() {
|
|
3006
|
-
return
|
|
3027
|
+
return path10.join(getConfigDir(), SYNC_LOCK_FILE);
|
|
3007
3028
|
}
|
|
3008
3029
|
function readSyncStore() {
|
|
3009
3030
|
try {
|
|
@@ -3212,11 +3233,11 @@ function autoSyncDirection(current, expected) {
|
|
|
3212
3233
|
// src/core/feature-config.ts
|
|
3213
3234
|
import crypto5 from "crypto";
|
|
3214
3235
|
import fs9 from "fs";
|
|
3215
|
-
import
|
|
3236
|
+
import path11 from "path";
|
|
3216
3237
|
var FEATURE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
3217
3238
|
var UNAVAILABLE_TTL_MS2 = 5 * 60 * 1e3;
|
|
3218
3239
|
function cachePath2() {
|
|
3219
|
-
return
|
|
3240
|
+
return path11.join(getConfigDir(), "feature-config.json");
|
|
3220
3241
|
}
|
|
3221
3242
|
function cacheKey2(host, token) {
|
|
3222
3243
|
const fingerprint = crypto5.createHash("sha256").update(token).digest("hex");
|
|
@@ -3234,7 +3255,7 @@ function writeStore(store) {
|
|
|
3234
3255
|
const target = cachePath2();
|
|
3235
3256
|
const temp = `${target}.${process.pid}.${crypto5.randomBytes(6).toString("hex")}.tmp`;
|
|
3236
3257
|
try {
|
|
3237
|
-
fs9.mkdirSync(
|
|
3258
|
+
fs9.mkdirSync(path11.dirname(target), { recursive: true });
|
|
3238
3259
|
fs9.writeFileSync(temp, JSON.stringify(store), { encoding: "utf8", mode: 384 });
|
|
3239
3260
|
fs9.renameSync(temp, target);
|
|
3240
3261
|
fs9.chmodSync(target, 384);
|
|
@@ -3287,7 +3308,7 @@ var NOTIFY_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
|
3287
3308
|
var FETCH_TIMEOUT_MS = 3e3;
|
|
3288
3309
|
var CLI_CONFIG_PATH = "/v1/ta/cli/config";
|
|
3289
3310
|
function cacheFilePath() {
|
|
3290
|
-
return
|
|
3311
|
+
return path12.join(getConfigDir(), "compat-check.json");
|
|
3291
3312
|
}
|
|
3292
3313
|
function readStore3() {
|
|
3293
3314
|
try {
|
|
@@ -3679,6 +3700,7 @@ export {
|
|
|
3679
3700
|
readProgress,
|
|
3680
3701
|
verifyAndCompleteProgress,
|
|
3681
3702
|
normalizeRegistrationLanguage,
|
|
3703
|
+
localRegistrationLanguage,
|
|
3682
3704
|
onboardingDeviceMarket,
|
|
3683
3705
|
registrationLanguage,
|
|
3684
3706
|
registrationMarket,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
printError,
|
|
11
11
|
printOutput
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-N2QILIGH.js";
|
|
13
13
|
import {
|
|
14
14
|
TeAgentApiError,
|
|
15
15
|
TeAgentCredentialsError
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
businessForCommand,
|
|
21
21
|
formatCapabilityMissCompatHint,
|
|
22
22
|
readCurrentBusinessConfig
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-GTENC5CO.js";
|
|
24
24
|
import {
|
|
25
25
|
CapabilityGatewayError
|
|
26
26
|
} from "./chunk-WG27BD67.js";
|
|
@@ -470,7 +470,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
470
470
|
}
|
|
471
471
|
const ctx = {
|
|
472
472
|
async onboarding(action, input) {
|
|
473
|
-
const { invokeOnboarding } = await import("./web-runtime-
|
|
473
|
+
const { invokeOnboarding } = await import("./web-runtime-XJWDFVP3.js");
|
|
474
474
|
return invokeOnboarding(action, input);
|
|
475
475
|
},
|
|
476
476
|
has(name) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
invalidateBusinessSkillSynchronization,
|
|
5
5
|
refreshEnvironmentAfterLogin,
|
|
6
6
|
refreshEnvironmentConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CDBW5RE6.js";
|
|
8
8
|
import {
|
|
9
9
|
MultiselectCancelled,
|
|
10
10
|
promptSingleSelect
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
printError,
|
|
14
14
|
printOutput
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-N2QILIGH.js";
|
|
16
16
|
import {
|
|
17
17
|
aeRegistrationUrl,
|
|
18
18
|
fetchCliConfig,
|
|
19
19
|
missingAeHostHint,
|
|
20
20
|
readCurrentBusinessConfig,
|
|
21
21
|
resolveKbAutoDiscoveryFeature
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-GTENC5CO.js";
|
|
23
23
|
import "./chunk-WG27BD67.js";
|
|
24
24
|
import {
|
|
25
25
|
peekCliToken
|