agent-phonon 0.2.8 → 0.2.9
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.js +43 -21
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +43 -21
- package/dist/daemon.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -4726,6 +4726,7 @@ ${prompt}`;
|
|
|
4726
4726
|
return new Promise((resolve5) => {
|
|
4727
4727
|
const child = spawn3(this.env.binPath ?? "codex", args2, {
|
|
4728
4728
|
cwd: this.cwd,
|
|
4729
|
+
shell: process.platform === "win32",
|
|
4729
4730
|
env: { ...process.env, ...opts.environment ?? {}, ...this.env.apiKey ? { OPENAI_API_KEY: this.env.apiKey } : {} }
|
|
4730
4731
|
});
|
|
4731
4732
|
this.current = child;
|
|
@@ -4853,7 +4854,7 @@ var CodexAdapter = class {
|
|
|
4853
4854
|
}
|
|
4854
4855
|
probeVersion() {
|
|
4855
4856
|
return new Promise((resolve5) => {
|
|
4856
|
-
const child = spawn3(this.env.binPath ?? "codex", ["--version"]);
|
|
4857
|
+
const child = spawn3(this.env.binPath ?? "codex", ["--version"], { shell: process.platform === "win32" });
|
|
4857
4858
|
let out = "";
|
|
4858
4859
|
child.stdout.on("data", (d) => out += d.toString());
|
|
4859
4860
|
child.on("error", () => resolve5(null));
|
|
@@ -5165,6 +5166,7 @@ ${prompt}`;
|
|
|
5165
5166
|
return new Promise((resolve5) => {
|
|
5166
5167
|
const child = spawn5(this.env.binPath ?? "hermes", args2, {
|
|
5167
5168
|
cwd: this.cwd,
|
|
5169
|
+
shell: process.platform === "win32",
|
|
5168
5170
|
env: { ...process.env, ...opts.environment ?? {}, HERMES_PROFILE: this.profile }
|
|
5169
5171
|
});
|
|
5170
5172
|
this.current = child;
|
|
@@ -5329,7 +5331,7 @@ var HermesAdapter = class {
|
|
|
5329
5331
|
/** 枚举 Hermes profile(去 ANSI 色解析 profile list)。 */
|
|
5330
5332
|
listProfiles() {
|
|
5331
5333
|
return new Promise((resolve5) => {
|
|
5332
|
-
const child = spawn5(this.env.binPath ?? "hermes", ["profile", "list"]);
|
|
5334
|
+
const child = spawn5(this.env.binPath ?? "hermes", ["profile", "list"], { shell: process.platform === "win32" });
|
|
5333
5335
|
let out = "";
|
|
5334
5336
|
child.stdout.on("data", (d) => out += d.toString());
|
|
5335
5337
|
child.on("error", () => resolve5([{ name: this.defaultProfile }]));
|
|
@@ -5349,7 +5351,7 @@ var HermesAdapter = class {
|
|
|
5349
5351
|
}
|
|
5350
5352
|
probeVersion() {
|
|
5351
5353
|
return new Promise((resolve5) => {
|
|
5352
|
-
const child = spawn5(this.env.binPath ?? "hermes", ["--version"]);
|
|
5354
|
+
const child = spawn5(this.env.binPath ?? "hermes", ["--version"], { shell: process.platform === "win32" });
|
|
5353
5355
|
let out = "";
|
|
5354
5356
|
child.stdout.on("data", (d) => out += d.toString());
|
|
5355
5357
|
child.on("error", () => resolve5(null));
|
|
@@ -5584,7 +5586,7 @@ ${prompt}`;
|
|
|
5584
5586
|
if (v !== void 0)
|
|
5585
5587
|
childEnv[k] = v;
|
|
5586
5588
|
}
|
|
5587
|
-
const child = spawn6(this.env.binPath ?? "claude", args2, { cwd: this.cwd, env: { ...childEnv, ...opts.environment ?? {} } });
|
|
5589
|
+
const child = spawn6(this.env.binPath ?? "claude", args2, { cwd: this.cwd, shell: process.platform === "win32", env: { ...childEnv, ...opts.environment ?? {} } });
|
|
5588
5590
|
this.current = child;
|
|
5589
5591
|
let buf = "";
|
|
5590
5592
|
let acc = "";
|
|
@@ -5726,7 +5728,7 @@ var ClaudeCodeAdapter = class {
|
|
|
5726
5728
|
}
|
|
5727
5729
|
probeVersion() {
|
|
5728
5730
|
return new Promise((resolve5) => {
|
|
5729
|
-
const child = spawn6(this.env.binPath ?? "claude", ["--version"]);
|
|
5731
|
+
const child = spawn6(this.env.binPath ?? "claude", ["--version"], { shell: process.platform === "win32" });
|
|
5730
5732
|
let out = "";
|
|
5731
5733
|
child.stdout.on("data", (d) => out += d.toString());
|
|
5732
5734
|
child.on("error", () => resolve5(null));
|
|
@@ -6137,26 +6139,42 @@ function readOpenClawGatewayToken() {
|
|
|
6137
6139
|
// src/commands.ts
|
|
6138
6140
|
import { spawnSync } from "node:child_process";
|
|
6139
6141
|
import { existsSync as existsSync12, cpSync, mkdirSync as mkdirSync4, rmSync as rmSync3, writeFileSync as writeFileSync4, readFileSync as readFileSync5 } from "node:fs";
|
|
6140
|
-
import { homedir as homedir10 } from "node:os";
|
|
6141
|
-
import { join as join12, dirname as dirname5 } from "node:path";
|
|
6142
|
+
import { homedir as homedir10, platform as platform2 } from "node:os";
|
|
6143
|
+
import { join as join12, dirname as dirname5, delimiter } from "node:path";
|
|
6142
6144
|
import { fileURLToPath } from "node:url";
|
|
6143
6145
|
function probe(bin, args2 = ["--version"]) {
|
|
6144
|
-
const r = spawnSync(bin, args2, { timeout: 8e3 });
|
|
6146
|
+
const r = spawnSync(bin, args2, { timeout: 8e3, shell: platform2() === "win32" });
|
|
6145
6147
|
return { ok: r.status === 0, out: (r.stdout?.toString() ?? "").trim().split("\n")[0] ?? "" };
|
|
6146
6148
|
}
|
|
6149
|
+
function executableNames(bin) {
|
|
6150
|
+
if (platform2() !== "win32") return [bin];
|
|
6151
|
+
const exts = (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").map((e) => e.toLowerCase());
|
|
6152
|
+
return [bin, ...exts.map((e) => `${bin}${e}`), ...exts.map((e) => `${bin}${e.toUpperCase()}`)];
|
|
6153
|
+
}
|
|
6147
6154
|
function commandPath(bin) {
|
|
6148
|
-
const
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
join12(
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6155
|
+
const home = homedir10();
|
|
6156
|
+
const appData = process.env.APPDATA;
|
|
6157
|
+
const localAppData = process.env.LOCALAPPDATA;
|
|
6158
|
+
const dirs = [
|
|
6159
|
+
join12(home, ".npm-global", "bin"),
|
|
6160
|
+
join12(home, ".local", "bin"),
|
|
6161
|
+
join12(home, ".bun", "bin"),
|
|
6162
|
+
join12(home, ".cargo", "bin"),
|
|
6163
|
+
...appData ? [join12(appData, "npm")] : [],
|
|
6164
|
+
...localAppData ? [join12(localAppData, "Programs"), join12(localAppData, "Microsoft", "WindowsApps")] : [],
|
|
6165
|
+
"/opt/homebrew/bin",
|
|
6166
|
+
"/usr/local/bin",
|
|
6167
|
+
"/usr/bin",
|
|
6168
|
+
...(process.env.PATH ?? "").split(delimiter).filter(Boolean)
|
|
6156
6169
|
];
|
|
6157
|
-
for (const
|
|
6158
|
-
|
|
6159
|
-
|
|
6170
|
+
for (const dir of dirs) {
|
|
6171
|
+
for (const name of executableNames(bin)) {
|
|
6172
|
+
const p = join12(dir, name);
|
|
6173
|
+
if (existsSync12(p)) return p;
|
|
6174
|
+
}
|
|
6175
|
+
}
|
|
6176
|
+
const r = platform2() === "win32" ? spawnSync("where.exe", [bin], { timeout: 3e3 }) : spawnSync("sh", ["-lc", `command -v ${bin}`], { timeout: 3e3 });
|
|
6177
|
+
const out = (r.stdout?.toString() ?? "").trim().split(/\r?\n/)[0];
|
|
6160
6178
|
return r.status === 0 && out ? out : void 0;
|
|
6161
6179
|
}
|
|
6162
6180
|
function gatewayReachable(url) {
|
|
@@ -6169,8 +6187,12 @@ function gatewayReachable(url) {
|
|
|
6169
6187
|
}
|
|
6170
6188
|
}
|
|
6171
6189
|
function openCodeBin() {
|
|
6172
|
-
const
|
|
6173
|
-
|
|
6190
|
+
const bundledDir = join12(homedir10(), ".opencode", "bin");
|
|
6191
|
+
for (const name of executableNames("opencode")) {
|
|
6192
|
+
const p = join12(bundledDir, name);
|
|
6193
|
+
if (existsSync12(p)) return p;
|
|
6194
|
+
}
|
|
6195
|
+
return commandPath("opencode") ?? "opencode";
|
|
6174
6196
|
}
|
|
6175
6197
|
function autoDetectAdapters(adapters) {
|
|
6176
6198
|
const out = [...adapters];
|