adhdev 0.9.47 → 0.9.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +59 -26
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +59 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9002,7 +9002,8 @@ function getCliScriptCommand(payload) {
|
|
|
9002
9002
|
if (command.type !== "send_message" && command.type !== "pty_write") return null;
|
|
9003
9003
|
const text = typeof command.text === "string" ? command.text.trim() : typeof command.message === "string" ? command.message.trim() : "";
|
|
9004
9004
|
if (!text) return null;
|
|
9005
|
-
|
|
9005
|
+
const enterCount = Number.isInteger(command.enterCount) && command.enterCount > 0 && command.enterCount <= 5 ? command.enterCount : void 0;
|
|
9006
|
+
return { type: command.type, text, ...enterCount ? { enterCount } : {} };
|
|
9006
9007
|
}
|
|
9007
9008
|
var init_cli_script_results = __esm({
|
|
9008
9009
|
"../../oss/packages/daemon-core/src/providers/cli-script-results.ts"() {
|
|
@@ -9264,7 +9265,12 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
9264
9265
|
if (cliCommand?.type === "send_message" && cliCommand.text) {
|
|
9265
9266
|
await adapter.sendMessage(cliCommand.text);
|
|
9266
9267
|
} else if (cliCommand?.type === "pty_write" && cliCommand.text && adapter.writeRaw) {
|
|
9268
|
+
const enterCount = cliCommand.enterCount || 1;
|
|
9267
9269
|
await adapter.writeRaw(cliCommand.text + "\r");
|
|
9270
|
+
for (let i = 1; i < enterCount; i += 1) {
|
|
9271
|
+
await new Promise((resolve16) => setTimeout(resolve16, 50));
|
|
9272
|
+
await adapter.writeRaw("\r");
|
|
9273
|
+
}
|
|
9268
9274
|
}
|
|
9269
9275
|
applyProviderPatch(h, args, parsed.payload);
|
|
9270
9276
|
return {
|
|
@@ -14624,7 +14630,12 @@ var init_cli_provider_instance = __esm({
|
|
|
14624
14630
|
if (cliCommand?.type === "send_message" && cliCommand.text) {
|
|
14625
14631
|
await this.adapter.sendMessage(cliCommand.text);
|
|
14626
14632
|
} else if (cliCommand?.type === "pty_write" && cliCommand.text) {
|
|
14633
|
+
const enterCount = cliCommand.enterCount || 1;
|
|
14627
14634
|
await this.adapter.writeRaw(cliCommand.text + "\r");
|
|
14635
|
+
for (let i = 1; i < enterCount; i += 1) {
|
|
14636
|
+
await new Promise((resolve16) => setTimeout(resolve16, 50));
|
|
14637
|
+
await this.adapter.writeRaw("\r");
|
|
14638
|
+
}
|
|
14628
14639
|
}
|
|
14629
14640
|
this.applyProviderResponse(parsed.payload, { phase: "immediate" });
|
|
14630
14641
|
}
|
|
@@ -37894,16 +37905,28 @@ function appendUpgradeLog(message) {
|
|
|
37894
37905
|
} catch {
|
|
37895
37906
|
}
|
|
37896
37907
|
}
|
|
37897
|
-
function
|
|
37908
|
+
function resolveSiblingNpmInvocation(nodeExecutable, platform12 = process.platform) {
|
|
37898
37909
|
const binDir = path16.dirname(nodeExecutable);
|
|
37899
|
-
|
|
37900
|
-
|
|
37910
|
+
if (platform12 === "win32") {
|
|
37911
|
+
const npmCliPath = path16.join(binDir, "node_modules", "npm", "bin", "npm-cli.js");
|
|
37912
|
+
if (fs8.existsSync(npmCliPath)) {
|
|
37913
|
+
return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: { shell: false } };
|
|
37914
|
+
}
|
|
37915
|
+
for (const candidate of ["npm.exe", "npm"]) {
|
|
37916
|
+
const candidatePath = path16.join(binDir, candidate);
|
|
37917
|
+
if (fs8.existsSync(candidatePath)) {
|
|
37918
|
+
return { executable: candidatePath, argsPrefix: [], execOptions: { shell: false } };
|
|
37919
|
+
}
|
|
37920
|
+
}
|
|
37921
|
+
return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: { shell: false } };
|
|
37922
|
+
}
|
|
37923
|
+
for (const candidate of ["npm"]) {
|
|
37901
37924
|
const candidatePath = path16.join(binDir, candidate);
|
|
37902
37925
|
if (fs8.existsSync(candidatePath)) {
|
|
37903
|
-
return candidatePath;
|
|
37926
|
+
return { executable: candidatePath, argsPrefix: [], execOptions: { shell: false } };
|
|
37904
37927
|
}
|
|
37905
37928
|
}
|
|
37906
|
-
return "npm";
|
|
37929
|
+
return { executable: "npm", argsPrefix: [], execOptions: { shell: false } };
|
|
37907
37930
|
}
|
|
37908
37931
|
function findCurrentPackageRoot(currentCliPath, packageName) {
|
|
37909
37932
|
if (!currentCliPath) return null;
|
|
@@ -37952,26 +37975,30 @@ function resolveInstallPrefixFromPackageRoot(packageRoot, packageName) {
|
|
|
37952
37975
|
}
|
|
37953
37976
|
function resolveCurrentGlobalInstallSurface(options) {
|
|
37954
37977
|
const packageRoot = findCurrentPackageRoot(options.currentCliPath || process.argv[1], options.packageName);
|
|
37978
|
+
const npmInvocation = resolveSiblingNpmInvocation(options.nodeExecutable || process.execPath, options.platform);
|
|
37955
37979
|
return {
|
|
37956
|
-
npmExecutable:
|
|
37980
|
+
npmExecutable: npmInvocation.executable,
|
|
37981
|
+
npmArgsPrefix: npmInvocation.argsPrefix,
|
|
37957
37982
|
packageRoot,
|
|
37958
|
-
installPrefix: packageRoot ? resolveInstallPrefixFromPackageRoot(packageRoot, options.packageName) : null
|
|
37983
|
+
installPrefix: packageRoot ? resolveInstallPrefixFromPackageRoot(packageRoot, options.packageName) : null,
|
|
37984
|
+
execOptions: npmInvocation.execOptions
|
|
37959
37985
|
};
|
|
37960
37986
|
}
|
|
37961
37987
|
function buildPinnedGlobalInstallCommand(options) {
|
|
37962
37988
|
const surface = resolveCurrentGlobalInstallSurface(options);
|
|
37963
|
-
const args = ["install", "-g", `${options.packageName}@${options.targetVersion || "latest"}`, "--force"];
|
|
37989
|
+
const args = [...surface.npmArgsPrefix || [], "install", "-g", `${options.packageName}@${options.targetVersion || "latest"}`, "--force"];
|
|
37964
37990
|
if (surface.installPrefix) {
|
|
37965
37991
|
args.push("--prefix", surface.installPrefix);
|
|
37966
37992
|
}
|
|
37967
37993
|
return {
|
|
37968
37994
|
command: surface.npmExecutable,
|
|
37969
37995
|
args,
|
|
37970
|
-
surface
|
|
37996
|
+
surface,
|
|
37997
|
+
execOptions: surface.execOptions || getNpmExecOptions(options.platform)
|
|
37971
37998
|
};
|
|
37972
37999
|
}
|
|
37973
|
-
function getNpmExecOptions() {
|
|
37974
|
-
return { shell:
|
|
38000
|
+
function getNpmExecOptions(_platform = process.platform) {
|
|
38001
|
+
return { shell: false };
|
|
37975
38002
|
}
|
|
37976
38003
|
function killPid(pid) {
|
|
37977
38004
|
try {
|
|
@@ -38066,11 +38093,10 @@ function removeDaemonPidFile() {
|
|
|
38066
38093
|
}
|
|
38067
38094
|
}
|
|
38068
38095
|
function cleanupStaleGlobalInstallDirs(pkgName, surface) {
|
|
38069
|
-
const npmExecOpts = getNpmExecOptions();
|
|
38070
38096
|
const prefixArgs = surface.installPrefix ? ["--prefix", surface.installPrefix] : [];
|
|
38071
|
-
const npmRoot = (0, import_child_process8.execFileSync)(surface.npmExecutable, ["root", "-g", ...prefixArgs], { encoding: "utf8", ...
|
|
38097
|
+
const npmRoot = (0, import_child_process8.execFileSync)(surface.npmExecutable, [...surface.npmArgsPrefix || [], "root", "-g", ...prefixArgs], { encoding: "utf8", ...surface.execOptions }).trim();
|
|
38072
38098
|
if (!npmRoot) return;
|
|
38073
|
-
const npmPrefix = surface.installPrefix || (0, import_child_process8.execFileSync)(surface.npmExecutable, ["prefix", "-g", ...prefixArgs], { encoding: "utf8", ...
|
|
38099
|
+
const npmPrefix = surface.installPrefix || (0, import_child_process8.execFileSync)(surface.npmExecutable, [...surface.npmArgsPrefix || [], "prefix", "-g", ...prefixArgs], { encoding: "utf8", ...surface.execOptions }).trim();
|
|
38074
38100
|
const binDir = process.platform === "win32" ? npmPrefix : path16.join(npmPrefix, "bin");
|
|
38075
38101
|
const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
|
|
38076
38102
|
const binNames = /* @__PURE__ */ new Set([packageBaseName]);
|
|
@@ -38140,7 +38166,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
38140
38166
|
encoding: "utf8",
|
|
38141
38167
|
stdio: "pipe",
|
|
38142
38168
|
maxBuffer: 20 * 1024 * 1024,
|
|
38143
|
-
...
|
|
38169
|
+
...installCommand.execOptions
|
|
38144
38170
|
}
|
|
38145
38171
|
);
|
|
38146
38172
|
if (installOutput.trim()) {
|
|
@@ -56702,12 +56728,15 @@ function verifyPublishedMandatoryUpdateTarget(packageName, targetVersion, deps =
|
|
|
56702
56728
|
const validation = validateMandatoryUpdateTarget(targetVersion);
|
|
56703
56729
|
if (!validation.valid) throw new Error(validation.error || "invalid mandatory update target");
|
|
56704
56730
|
const run = deps.execFileSync || import_child_process13.execFileSync;
|
|
56705
|
-
const
|
|
56706
|
-
const
|
|
56731
|
+
const surface = resolveCurrentGlobalInstallSurface({ packageName });
|
|
56732
|
+
const npmExecutable = deps.npmExecutable || surface.npmExecutable;
|
|
56733
|
+
const npmArgsPrefix = deps.npmArgsPrefix || surface.npmArgsPrefix || [];
|
|
56734
|
+
const execOptions = deps.execOptions || surface.execOptions || {};
|
|
56735
|
+
const published = String(run(npmExecutable, [...npmArgsPrefix, "view", `${packageName}@${targetVersion}`, "version"], {
|
|
56707
56736
|
encoding: "utf-8",
|
|
56708
56737
|
timeout: 1e4,
|
|
56709
56738
|
stdio: ["pipe", "pipe", "pipe"],
|
|
56710
|
-
...
|
|
56739
|
+
...execOptions
|
|
56711
56740
|
})).trim();
|
|
56712
56741
|
if (published !== targetVersion) {
|
|
56713
56742
|
throw new Error(`Published version mismatch: expected ${targetVersion}, got ${published || "unknown"}`);
|
|
@@ -56914,7 +56943,7 @@ var init_adhdev_daemon = __esm({
|
|
|
56914
56943
|
init_version();
|
|
56915
56944
|
init_src();
|
|
56916
56945
|
init_runtime_defaults();
|
|
56917
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
56946
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.48" });
|
|
56918
56947
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
56919
56948
|
localHttpServer = null;
|
|
56920
56949
|
localWss = null;
|
|
@@ -88585,10 +88614,11 @@ function hasCloudMachineAuth() {
|
|
|
88585
88614
|
function readLatestPublishedCliVersion(execFileSyncLocal) {
|
|
88586
88615
|
const surface = resolveCurrentGlobalInstallSurface({ packageName: "adhdev" });
|
|
88587
88616
|
try {
|
|
88588
|
-
return execFileSyncLocal(surface.npmExecutable, ["view", "adhdev", "version"], {
|
|
88617
|
+
return execFileSyncLocal(surface.npmExecutable, [...surface.npmArgsPrefix || [], "view", "adhdev", "version"], {
|
|
88589
88618
|
encoding: "utf-8",
|
|
88590
88619
|
timeout: 5e3,
|
|
88591
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
88620
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
88621
|
+
...surface.execOptions
|
|
88592
88622
|
}).trim();
|
|
88593
88623
|
} catch {
|
|
88594
88624
|
return null;
|
|
@@ -88596,7 +88626,7 @@ function readLatestPublishedCliVersion(execFileSyncLocal) {
|
|
|
88596
88626
|
}
|
|
88597
88627
|
function readInstalledGlobalCliVersion(execFileSyncLocal) {
|
|
88598
88628
|
const surface = resolveCurrentGlobalInstallSurface({ packageName: "adhdev" });
|
|
88599
|
-
const args = ["list", "-g", "adhdev", "--json"];
|
|
88629
|
+
const args = [...surface.npmArgsPrefix || [], "list", "-g", "adhdev", "--json"];
|
|
88600
88630
|
if (surface.installPrefix) {
|
|
88601
88631
|
args.push("--prefix", surface.installPrefix);
|
|
88602
88632
|
}
|
|
@@ -88604,7 +88634,8 @@ function readInstalledGlobalCliVersion(execFileSyncLocal) {
|
|
|
88604
88634
|
const result = execFileSyncLocal(surface.npmExecutable, args, {
|
|
88605
88635
|
encoding: "utf-8",
|
|
88606
88636
|
timeout: 5e3,
|
|
88607
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
88637
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
88638
|
+
...surface.execOptions
|
|
88608
88639
|
});
|
|
88609
88640
|
const parsed = JSON.parse(result);
|
|
88610
88641
|
return parsed.dependencies?.adhdev?.version || null;
|
|
@@ -88649,7 +88680,8 @@ async function checkForUpdate() {
|
|
|
88649
88680
|
execFileSync5(installCommand.command, installCommand.args, {
|
|
88650
88681
|
encoding: "utf-8",
|
|
88651
88682
|
timeout: 6e4,
|
|
88652
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
88683
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
88684
|
+
...installCommand.execOptions
|
|
88653
88685
|
});
|
|
88654
88686
|
spinner.succeed(`Updated to v${latestVersion}`);
|
|
88655
88687
|
console.log();
|
|
@@ -88935,7 +88967,8 @@ async function installCliOnly() {
|
|
|
88935
88967
|
execFileSyncLocal(installCommand.command, installCommand.args, {
|
|
88936
88968
|
encoding: "utf-8",
|
|
88937
88969
|
timeout: 6e4,
|
|
88938
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
88970
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
88971
|
+
...installCommand.execOptions
|
|
88939
88972
|
});
|
|
88940
88973
|
const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) || "latest";
|
|
88941
88974
|
installSpinner.succeed(`adhdev CLI ${currentVersion ? "updated" : "installed"} \u2713 (v${newVersion})`);
|