@modelzen/feishu-codex-bridge 0.6.7-test.1 → 0.6.7-test.2
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 +21 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5139,7 +5139,7 @@ function openUrl(url) {
|
|
|
5139
5139
|
args = [url];
|
|
5140
5140
|
}
|
|
5141
5141
|
try {
|
|
5142
|
-
const child = spawn(cmd, args, { stdio: "ignore", detached: true });
|
|
5142
|
+
const child = spawn(cmd, args, { stdio: "ignore", detached: true, windowsHide: true });
|
|
5143
5143
|
child.on("error", () => {
|
|
5144
5144
|
});
|
|
5145
5145
|
child.unref();
|
|
@@ -8811,7 +8811,7 @@ async function installWinStartup() {
|
|
|
8811
8811
|
const reg = spawnSync2(
|
|
8812
8812
|
"reg",
|
|
8813
8813
|
["add", RUN_KEY_PATH, "/v", RUN_KEY_NAME, "/t", "REG_SZ", "/d", `wscript.exe "${launcherVbsPath()}"`, "/f"],
|
|
8814
|
-
{ encoding: "utf8" }
|
|
8814
|
+
{ encoding: "utf8", windowsHide: true }
|
|
8815
8815
|
);
|
|
8816
8816
|
if (reg.status !== 0) {
|
|
8817
8817
|
throw new Error(`\u5199\u5165\u767B\u5F55\u81EA\u542F\u6CE8\u518C\u8868\u9879\u5931\u8D25\uFF08exit ${reg.status ?? "unknown"}\uFF09\uFF1A${(reg.stderr || reg.stdout || "").trim()}`);
|
|
@@ -8820,7 +8820,7 @@ async function installWinStartup() {
|
|
|
8820
8820
|
return statusWinStartup();
|
|
8821
8821
|
}
|
|
8822
8822
|
async function uninstallWinStartup() {
|
|
8823
|
-
spawnSync2("reg", ["delete", RUN_KEY_PATH, "/v", RUN_KEY_NAME, "/f"], { stdio: "ignore" });
|
|
8823
|
+
spawnSync2("reg", ["delete", RUN_KEY_PATH, "/v", RUN_KEY_NAME, "/f"], { stdio: "ignore", windowsHide: true });
|
|
8824
8824
|
killService();
|
|
8825
8825
|
rmSync(servicePidFile(), { force: true });
|
|
8826
8826
|
}
|
|
@@ -8885,7 +8885,7 @@ function clearRelaunchClaim(reqPath) {
|
|
|
8885
8885
|
function buildRelauncherPowershell(reqPath, binPath = resolveCliBinPath(), nodePath = process.execPath) {
|
|
8886
8886
|
const inner = `"${nodePath}" "${binPath}" __win-relaunch "${reqPath}"`;
|
|
8887
8887
|
const lit = `'${inner.replace(/'/g, "''")}'`;
|
|
8888
|
-
return `$c=${lit}; try { Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{ CommandLine=$c } -ErrorAction Stop
|
|
8888
|
+
return `$c=${lit}; try { $r = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{ CommandLine=$c } -ErrorAction Stop; Write-Output ('cim rv=' + $r.ReturnValue + ' pid=' + $r.ProcessId) } catch { Write-Output ('cim-error: ' + $_.Exception.Message); schtasks /create /tn ${RELAUNCH_TASK_NAME} /tr $c /sc ONCE /st 00:00 /f | Out-Null; $cr=$LASTEXITCODE; schtasks /run /tn ${RELAUNCH_TASK_NAME} | Out-Null; Write-Output ('schtasks create=' + $cr + ' run=' + $LASTEXITCODE) }`;
|
|
8889
8889
|
}
|
|
8890
8890
|
function encodePowershellCommand(script) {
|
|
8891
8891
|
return Buffer.from(script, "utf16le").toString("base64");
|
|
@@ -8898,15 +8898,24 @@ function powershellPath() {
|
|
|
8898
8898
|
function spawnTreeFreeRelauncher(reqPath) {
|
|
8899
8899
|
const ps = powershellPath();
|
|
8900
8900
|
if (ps) {
|
|
8901
|
-
const
|
|
8902
|
-
const child = spawn3(
|
|
8901
|
+
const r = spawnSync2(
|
|
8903
8902
|
ps,
|
|
8904
8903
|
["-NoProfile", "-NonInteractive", "-WindowStyle", "Hidden", "-EncodedCommand", encodePowershellCommand(buildRelauncherPowershell(reqPath))],
|
|
8905
|
-
{
|
|
8904
|
+
{ encoding: "utf8", windowsHide: true, timeout: 2e4 }
|
|
8906
8905
|
);
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8906
|
+
const out = [
|
|
8907
|
+
`exit=${r.status ?? "?"}`,
|
|
8908
|
+
r.error ? `err=${r.error.message}` : "",
|
|
8909
|
+
(r.stdout || "").replace(/\s+/g, " ").trim(),
|
|
8910
|
+
(r.stderr || "").replace(/\s+/g, " ").trim()
|
|
8911
|
+
].filter(Boolean).join(" ");
|
|
8912
|
+
appendServiceErr("relaunch", `powershell submit: ${out.slice(0, 900)}`);
|
|
8913
|
+
const stdout = r.stdout || "";
|
|
8914
|
+
if (!r.error && r.status === 0 && (/cim rv=0\b/.test(stdout) || /schtasks .*run=0\b/.test(stdout))) {
|
|
8915
|
+
return true;
|
|
8916
|
+
}
|
|
8917
|
+
appendServiceErr("relaunch", "powershell did not confirm a launch; trying node-side schtasks fallback");
|
|
8918
|
+
return spawnSchtasksRelauncher(reqPath);
|
|
8910
8919
|
}
|
|
8911
8920
|
appendServiceErr("relaunch", "powershell.exe not found; trying schtasks fallback");
|
|
8912
8921
|
return spawnSchtasksRelauncher(reqPath);
|
|
@@ -9021,7 +9030,8 @@ function clearServicePid() {
|
|
|
9021
9030
|
}
|
|
9022
9031
|
function isInstalled() {
|
|
9023
9032
|
const r = spawnSync2("reg", ["query", RUN_KEY_PATH, "/v", RUN_KEY_NAME], {
|
|
9024
|
-
stdio: ["ignore", "ignore", "ignore"]
|
|
9033
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
9034
|
+
windowsHide: true
|
|
9025
9035
|
});
|
|
9026
9036
|
return r.status === 0;
|
|
9027
9037
|
}
|
package/package.json
CHANGED