@modelzen/feishu-codex-bridge 0.6.7-test.0 → 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 +84 -60
- 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();
|
|
@@ -8510,7 +8510,7 @@ function withCodexHooksFeature(text) {
|
|
|
8510
8510
|
|
|
8511
8511
|
// src/service/update.ts
|
|
8512
8512
|
import { existsSync as existsSync9, readFileSync as readFileSync4 } from "fs";
|
|
8513
|
-
import { dirname as
|
|
8513
|
+
import { dirname as dirname10, join as join15, resolve as resolve6 } from "path";
|
|
8514
8514
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8515
8515
|
|
|
8516
8516
|
// src/service/launchd.ts
|
|
@@ -8538,9 +8538,9 @@ async function ensureLogFiles() {
|
|
|
8538
8538
|
await appendFile(serviceStdoutPath(), "");
|
|
8539
8539
|
await appendFile(serviceStderrPath(), "");
|
|
8540
8540
|
}
|
|
8541
|
-
function appendServiceErr(tag, line) {
|
|
8541
|
+
function appendServiceErr(tag, line, filePath = serviceStderrPath()) {
|
|
8542
8542
|
try {
|
|
8543
|
-
appendFileSync(
|
|
8543
|
+
appendFileSync(filePath, `[${(/* @__PURE__ */ new Date()).toISOString()}] [${tag}] ${line}
|
|
8544
8544
|
`);
|
|
8545
8545
|
} catch {
|
|
8546
8546
|
}
|
|
@@ -8756,7 +8756,7 @@ init_paths();
|
|
|
8756
8756
|
import { spawn as spawn3, spawnSync as spawnSync2 } from "child_process";
|
|
8757
8757
|
import { existsSync as existsSync7, openSync, readFileSync as readFileSync3, renameSync, rmSync, writeFileSync } from "fs";
|
|
8758
8758
|
import { mkdir as mkdir9, writeFile as writeFile8 } from "fs/promises";
|
|
8759
|
-
import { join as join13 } from "path";
|
|
8759
|
+
import { dirname as dirname8, join as join13 } from "path";
|
|
8760
8760
|
var RELAUNCH_TASK_NAME = "feishu-codex-bridge-relaunch";
|
|
8761
8761
|
var RUN_KEY_PATH = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
|
|
8762
8762
|
var RUN_KEY_NAME = "feishu-codex-bridge";
|
|
@@ -8787,18 +8787,20 @@ function buildLauncherVbs() {
|
|
|
8787
8787
|
""
|
|
8788
8788
|
].join("\r\n");
|
|
8789
8789
|
}
|
|
8790
|
-
function startNow(
|
|
8791
|
-
const
|
|
8792
|
-
const
|
|
8790
|
+
function startNow(opts = {}) {
|
|
8791
|
+
const dir = opts.appDir ?? paths.appDir;
|
|
8792
|
+
const out = openSync(join13(dir, "service.log"), "a");
|
|
8793
|
+
const err = openSync(join13(dir, "service.err.log"), "a");
|
|
8793
8794
|
const overrides = { [SERVICE_ENV_FLAG]: "1" };
|
|
8794
|
-
if (envPath) overrides.PATH = envPath;
|
|
8795
|
+
if (opts.envPath) overrides.PATH = opts.envPath;
|
|
8796
|
+
if (opts.userProfile) overrides.USERPROFILE = opts.userProfile;
|
|
8795
8797
|
const child = spawn3(process.execPath, [resolveCliBinPath(), "run"], {
|
|
8796
8798
|
detached: true,
|
|
8797
8799
|
windowsHide: true,
|
|
8798
8800
|
stdio: ["ignore", out, err],
|
|
8799
8801
|
env: mergeProcessEnv(process.env, overrides)
|
|
8800
8802
|
});
|
|
8801
|
-
if (child.pid) writeFileSync(
|
|
8803
|
+
if (child.pid) writeFileSync(join13(dir, "service.pid"), String(child.pid), "utf8");
|
|
8802
8804
|
child.unref();
|
|
8803
8805
|
}
|
|
8804
8806
|
async function installWinStartup() {
|
|
@@ -8809,7 +8811,7 @@ async function installWinStartup() {
|
|
|
8809
8811
|
const reg = spawnSync2(
|
|
8810
8812
|
"reg",
|
|
8811
8813
|
["add", RUN_KEY_PATH, "/v", RUN_KEY_NAME, "/t", "REG_SZ", "/d", `wscript.exe "${launcherVbsPath()}"`, "/f"],
|
|
8812
|
-
{ encoding: "utf8" }
|
|
8814
|
+
{ encoding: "utf8", windowsHide: true }
|
|
8813
8815
|
);
|
|
8814
8816
|
if (reg.status !== 0) {
|
|
8815
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()}`);
|
|
@@ -8818,7 +8820,7 @@ async function installWinStartup() {
|
|
|
8818
8820
|
return statusWinStartup();
|
|
8819
8821
|
}
|
|
8820
8822
|
async function uninstallWinStartup() {
|
|
8821
|
-
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 });
|
|
8822
8824
|
killService();
|
|
8823
8825
|
rmSync(servicePidFile(), { force: true });
|
|
8824
8826
|
}
|
|
@@ -8832,8 +8834,14 @@ async function restartWinStartup() {
|
|
|
8832
8834
|
startNow();
|
|
8833
8835
|
return statusWinStartup();
|
|
8834
8836
|
}
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
+
const reqPath = relaunchRequestFile();
|
|
8838
|
+
writeRelaunchRequest({
|
|
8839
|
+
oldPid,
|
|
8840
|
+
envPath: process.env.PATH ?? "",
|
|
8841
|
+
userProfile: process.env.USERPROFILE ?? "",
|
|
8842
|
+
nonce: `${process.pid}-${Date.now()}`
|
|
8843
|
+
});
|
|
8844
|
+
if (!spawnTreeFreeRelauncher(reqPath)) {
|
|
8837
8845
|
clearRelaunchRequest();
|
|
8838
8846
|
appendServiceErr("relaunch", `no tree-free backend (powershell/schtasks); kept old pid=${oldPid} running, did NOT restart`);
|
|
8839
8847
|
throw new Error("\u65E0\u6CD5\u62C9\u8D77\u300C\u6811\u5916\u300D\u91CD\u542F\u8FDB\u7A0B\uFF08powershell \u4E0E schtasks \u5747\u4E0D\u53EF\u7528\uFF09\uFF1B\u5DF2\u4FDD\u7559\u65E7\u670D\u52A1\u7EE7\u7EED\u8FD0\u884C\uFF0C\u672A\u91CD\u542F\u3002");
|
|
@@ -8850,13 +8858,10 @@ function writeRelaunchRequest(req) {
|
|
|
8850
8858
|
function clearRelaunchRequest() {
|
|
8851
8859
|
rmSync(relaunchRequestFile(), { force: true });
|
|
8852
8860
|
}
|
|
8853
|
-
function
|
|
8854
|
-
|
|
8855
|
-
}
|
|
8856
|
-
function claimRelaunchRequest() {
|
|
8857
|
-
const claim = relaunchClaimFile();
|
|
8861
|
+
function claimRelaunchRequest(reqPath) {
|
|
8862
|
+
const claim = `${reqPath}.claim.${process.pid}`;
|
|
8858
8863
|
try {
|
|
8859
|
-
renameSync(
|
|
8864
|
+
renameSync(reqPath, claim);
|
|
8860
8865
|
} catch {
|
|
8861
8866
|
return null;
|
|
8862
8867
|
}
|
|
@@ -8866,6 +8871,7 @@ function claimRelaunchRequest() {
|
|
|
8866
8871
|
return {
|
|
8867
8872
|
oldPid: r.oldPid,
|
|
8868
8873
|
envPath: typeof r.envPath === "string" ? r.envPath : "",
|
|
8874
|
+
userProfile: typeof r.userProfile === "string" ? r.userProfile : "",
|
|
8869
8875
|
nonce: String(r.nonce ?? "")
|
|
8870
8876
|
};
|
|
8871
8877
|
}
|
|
@@ -8873,37 +8879,49 @@ function claimRelaunchRequest() {
|
|
|
8873
8879
|
}
|
|
8874
8880
|
return null;
|
|
8875
8881
|
}
|
|
8876
|
-
function clearRelaunchClaim() {
|
|
8877
|
-
rmSync(
|
|
8882
|
+
function clearRelaunchClaim(reqPath) {
|
|
8883
|
+
rmSync(`${reqPath}.claim.${process.pid}`, { force: true });
|
|
8878
8884
|
}
|
|
8879
|
-
function buildRelauncherPowershell(binPath = resolveCliBinPath(), nodePath = process.execPath) {
|
|
8880
|
-
const inner = `"${nodePath}" "${binPath}" __win-relaunch`;
|
|
8885
|
+
function buildRelauncherPowershell(reqPath, binPath = resolveCliBinPath(), nodePath = process.execPath) {
|
|
8886
|
+
const inner = `"${nodePath}" "${binPath}" __win-relaunch "${reqPath}"`;
|
|
8881
8887
|
const lit = `'${inner.replace(/'/g, "''")}'`;
|
|
8882
|
-
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
|
+
}
|
|
8890
|
+
function encodePowershellCommand(script) {
|
|
8891
|
+
return Buffer.from(script, "utf16le").toString("base64");
|
|
8883
8892
|
}
|
|
8884
8893
|
function powershellPath() {
|
|
8885
8894
|
const root = process.env.SystemRoot || process.env.windir || "C:\\Windows";
|
|
8886
8895
|
const p = join13(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
8887
8896
|
return existsSync7(p) ? p : null;
|
|
8888
8897
|
}
|
|
8889
|
-
function spawnTreeFreeRelauncher() {
|
|
8898
|
+
function spawnTreeFreeRelauncher(reqPath) {
|
|
8890
8899
|
const ps = powershellPath();
|
|
8891
8900
|
if (ps) {
|
|
8892
|
-
const
|
|
8893
|
-
const child = spawn3(
|
|
8901
|
+
const r = spawnSync2(
|
|
8894
8902
|
ps,
|
|
8895
|
-
["-NoProfile", "-NonInteractive", "-WindowStyle", "Hidden", "-
|
|
8896
|
-
{
|
|
8903
|
+
["-NoProfile", "-NonInteractive", "-WindowStyle", "Hidden", "-EncodedCommand", encodePowershellCommand(buildRelauncherPowershell(reqPath))],
|
|
8904
|
+
{ encoding: "utf8", windowsHide: true, timeout: 2e4 }
|
|
8897
8905
|
);
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
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);
|
|
8901
8919
|
}
|
|
8902
8920
|
appendServiceErr("relaunch", "powershell.exe not found; trying schtasks fallback");
|
|
8903
|
-
return spawnSchtasksRelauncher();
|
|
8921
|
+
return spawnSchtasksRelauncher(reqPath);
|
|
8904
8922
|
}
|
|
8905
|
-
function spawnSchtasksRelauncher() {
|
|
8906
|
-
const tr = `"${process.execPath}" "${resolveCliBinPath()}" __win-relaunch`;
|
|
8923
|
+
function spawnSchtasksRelauncher(reqPath) {
|
|
8924
|
+
const tr = `"${process.execPath}" "${resolveCliBinPath()}" __win-relaunch "${reqPath}"`;
|
|
8907
8925
|
const create = spawnSync2(
|
|
8908
8926
|
"schtasks",
|
|
8909
8927
|
["/create", "/tn", RELAUNCH_TASK_NAME, "/tr", tr, "/sc", "ONCE", "/st", "00:00", "/f"],
|
|
@@ -8925,6 +8943,8 @@ function defaultTaskkill(pid) {
|
|
|
8925
8943
|
return { status: r.status, stderr: (r.stderr || "").toString() };
|
|
8926
8944
|
}
|
|
8927
8945
|
async function runWinRelaunch(deps = {}) {
|
|
8946
|
+
const reqPath = deps.requestPath ?? relaunchRequestFile();
|
|
8947
|
+
const appDir2 = dirname8(reqPath);
|
|
8928
8948
|
const claim = deps.claimRequest ?? claimRelaunchRequest;
|
|
8929
8949
|
const clearClaim = deps.clearRequest ?? clearRelaunchClaim;
|
|
8930
8950
|
const alive = deps.pidAlive ?? pidAlive;
|
|
@@ -8935,9 +8955,12 @@ async function runWinRelaunch(deps = {}) {
|
|
|
8935
8955
|
const pollMs = deps.pollMs ?? 200;
|
|
8936
8956
|
const now = deps.now ?? (() => Date.now());
|
|
8937
8957
|
const ensureLogs = deps.ensureLogs ?? ensureLogFiles;
|
|
8938
|
-
const logLine = deps.logLine ?? ((line) => appendServiceErr("relaunch", line));
|
|
8939
|
-
|
|
8940
|
-
|
|
8958
|
+
const logLine = deps.logLine ?? ((line) => appendServiceErr("relaunch", line, join13(appDir2, "service.err.log")));
|
|
8959
|
+
try {
|
|
8960
|
+
await ensureLogs();
|
|
8961
|
+
} catch {
|
|
8962
|
+
}
|
|
8963
|
+
const req = claim(reqPath);
|
|
8941
8964
|
if (!req) {
|
|
8942
8965
|
logLine("no relaunch request to claim (already handled by another relauncher, or none)");
|
|
8943
8966
|
return;
|
|
@@ -8959,10 +8982,10 @@ async function runWinRelaunch(deps = {}) {
|
|
|
8959
8982
|
return;
|
|
8960
8983
|
}
|
|
8961
8984
|
await sleep(300);
|
|
8962
|
-
start(req.envPath);
|
|
8963
|
-
logLine(`relaunched; new
|
|
8985
|
+
start({ appDir: appDir2, envPath: req.envPath, userProfile: req.userProfile });
|
|
8986
|
+
logLine(`relaunched; new daemon started (appDir=${appDir2})`);
|
|
8964
8987
|
} finally {
|
|
8965
|
-
clearClaim();
|
|
8988
|
+
clearClaim(reqPath);
|
|
8966
8989
|
if (process.platform === "win32") {
|
|
8967
8990
|
try {
|
|
8968
8991
|
spawnSync2("schtasks", ["/delete", "/tn", RELAUNCH_TASK_NAME, "/f"], { stdio: "ignore", windowsHide: true });
|
|
@@ -9007,7 +9030,8 @@ function clearServicePid() {
|
|
|
9007
9030
|
}
|
|
9008
9031
|
function isInstalled() {
|
|
9009
9032
|
const r = spawnSync2("reg", ["query", RUN_KEY_PATH, "/v", RUN_KEY_NAME], {
|
|
9010
|
-
stdio: ["ignore", "ignore", "ignore"]
|
|
9033
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
9034
|
+
windowsHide: true
|
|
9011
9035
|
});
|
|
9012
9036
|
return r.status === 0;
|
|
9013
9037
|
}
|
|
@@ -9041,7 +9065,7 @@ import { spawnSync as spawnSync3 } from "child_process";
|
|
|
9041
9065
|
import { existsSync as existsSync8 } from "fs";
|
|
9042
9066
|
import { mkdir as mkdir10, rm as rm4, writeFile as writeFile9 } from "fs/promises";
|
|
9043
9067
|
import { homedir as homedir5 } from "os";
|
|
9044
|
-
import { dirname as
|
|
9068
|
+
import { dirname as dirname9, join as join14 } from "path";
|
|
9045
9069
|
var SYSTEMD_UNIT_NAME = "feishu-codex-bridge.service";
|
|
9046
9070
|
function systemdUnitPath() {
|
|
9047
9071
|
const base = process.env.XDG_CONFIG_HOME ?? join14(homedir5(), ".config");
|
|
@@ -9099,7 +9123,7 @@ function ensureSystemdOrThrow() {
|
|
|
9099
9123
|
async function installSystemd() {
|
|
9100
9124
|
ensureSystemdOrThrow();
|
|
9101
9125
|
const unitPath = systemdUnitPath();
|
|
9102
|
-
await mkdir10(
|
|
9126
|
+
await mkdir10(dirname9(unitPath), { recursive: true });
|
|
9103
9127
|
await ensureLogFiles();
|
|
9104
9128
|
await writeFile9(unitPath, buildUnit(), "utf8");
|
|
9105
9129
|
const reload = runSystemctl(["daemon-reload"]);
|
|
@@ -9201,7 +9225,7 @@ function isServiceRunning() {
|
|
|
9201
9225
|
// src/service/update.ts
|
|
9202
9226
|
var NPM2 = "npm";
|
|
9203
9227
|
function pkgRoot() {
|
|
9204
|
-
return resolve6(
|
|
9228
|
+
return resolve6(dirname10(fileURLToPath4(import.meta.url)), "..");
|
|
9205
9229
|
}
|
|
9206
9230
|
function pkgJson() {
|
|
9207
9231
|
try {
|
|
@@ -9863,9 +9887,9 @@ function buildUsageShareCard(data, opts = {}) {
|
|
|
9863
9887
|
init_paths();
|
|
9864
9888
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
9865
9889
|
import { mkdirSync as mkdirSync2, readFileSync as readFileSync5, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
|
|
9866
|
-
import { dirname as
|
|
9890
|
+
import { dirname as dirname11 } from "path";
|
|
9867
9891
|
function publishWebConsole(rec, file = paths.webConsoleFile) {
|
|
9868
|
-
mkdirSync2(
|
|
9892
|
+
mkdirSync2(dirname11(file), { recursive: true });
|
|
9869
9893
|
try {
|
|
9870
9894
|
unlinkSync(file);
|
|
9871
9895
|
} catch {
|
|
@@ -9905,7 +9929,7 @@ function stableWebConsoleToken(file = paths.webTokenFile) {
|
|
|
9905
9929
|
}
|
|
9906
9930
|
const token = randomUUID4();
|
|
9907
9931
|
try {
|
|
9908
|
-
mkdirSync2(
|
|
9932
|
+
mkdirSync2(dirname11(file), { recursive: true });
|
|
9909
9933
|
try {
|
|
9910
9934
|
unlinkSync(file);
|
|
9911
9935
|
} catch {
|
|
@@ -10216,7 +10240,7 @@ async function leaveChat(channel, chatId) {
|
|
|
10216
10240
|
init_paths();
|
|
10217
10241
|
import { mkdir as mkdir12, readFile as readFile11, rename as rename5, writeFile as writeFile10 } from "fs/promises";
|
|
10218
10242
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
10219
|
-
import { dirname as
|
|
10243
|
+
import { dirname as dirname12 } from "path";
|
|
10220
10244
|
var FILE_VERSION3 = 2;
|
|
10221
10245
|
var LEGACY_V1_SESSION_FIELD = "codexThreadId";
|
|
10222
10246
|
function migrate(raw) {
|
|
@@ -10252,7 +10276,7 @@ function withLock2(fn) {
|
|
|
10252
10276
|
return run;
|
|
10253
10277
|
}
|
|
10254
10278
|
async function write2(sessions) {
|
|
10255
|
-
await mkdir12(
|
|
10279
|
+
await mkdir12(dirname12(paths.sessionsFile), { recursive: true });
|
|
10256
10280
|
const tmp = `${paths.sessionsFile}.tmp-${process.pid}-${randomUUID5()}`;
|
|
10257
10281
|
const body = { version: FILE_VERSION3, sessions };
|
|
10258
10282
|
await writeFile10(tmp, `${JSON.stringify(body, null, 2)}
|
|
@@ -10868,7 +10892,7 @@ function weaveSender(text, sender) {
|
|
|
10868
10892
|
// src/bot/comments.ts
|
|
10869
10893
|
init_logger();
|
|
10870
10894
|
import { mkdir as mkdir14, readdir as readdir4, readFile as readFile12, writeFile as writeFile11 } from "fs/promises";
|
|
10871
|
-
import { dirname as
|
|
10895
|
+
import { dirname as dirname13, join as join19 } from "path";
|
|
10872
10896
|
var SUPPORTED_FILE_TYPES = /* @__PURE__ */ new Set(["doc", "docx", "sheet", "bitable"]);
|
|
10873
10897
|
var REPLY_MAX_CHARS = 2e3;
|
|
10874
10898
|
function apiErrCode(err) {
|
|
@@ -11000,7 +11024,7 @@ async function loadCommentInstructions(masterFile) {
|
|
|
11000
11024
|
return existing.trim() ? existing : DEFAULT_COMMENT_INSTRUCTIONS;
|
|
11001
11025
|
} catch {
|
|
11002
11026
|
}
|
|
11003
|
-
await mkdir14(
|
|
11027
|
+
await mkdir14(dirname13(masterFile), { recursive: true }).catch(() => void 0);
|
|
11004
11028
|
await writeFile11(masterFile, DEFAULT_COMMENT_INSTRUCTIONS, "utf8").catch(() => void 0);
|
|
11005
11029
|
return DEFAULT_COMMENT_INSTRUCTIONS;
|
|
11006
11030
|
}
|
|
@@ -11012,7 +11036,7 @@ async function syncCommentInstructions(cwd, instructions) {
|
|
|
11012
11036
|
]);
|
|
11013
11037
|
}
|
|
11014
11038
|
async function saveCommentInstructions(masterFile, content) {
|
|
11015
|
-
await mkdir14(
|
|
11039
|
+
await mkdir14(dirname13(masterFile), { recursive: true });
|
|
11016
11040
|
await writeFile11(masterFile, content, "utf8");
|
|
11017
11041
|
}
|
|
11018
11042
|
function renderCommentInstructions(template, tenant, fileType, fileToken) {
|
|
@@ -14283,7 +14307,7 @@ init_logger();
|
|
|
14283
14307
|
// src/admin/host.ts
|
|
14284
14308
|
init_paths();
|
|
14285
14309
|
import { readdir as readdir5, stat as stat4 } from "fs/promises";
|
|
14286
|
-
import { dirname as
|
|
14310
|
+
import { dirname as dirname14, join as join21, resolve as resolve8 } from "path";
|
|
14287
14311
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
14288
14312
|
import { arch, platform as platform2, release } from "os";
|
|
14289
14313
|
function toDaemonStatus(opts) {
|
|
@@ -14335,7 +14359,7 @@ async function collectHostDoctor(logsDir2 = join21(paths.appDir, "logs")) {
|
|
|
14335
14359
|
};
|
|
14336
14360
|
}
|
|
14337
14361
|
function resolveCliBinPath3() {
|
|
14338
|
-
const distDir =
|
|
14362
|
+
const distDir = dirname14(fileURLToPath5(import.meta.url));
|
|
14339
14363
|
return resolve8(distDir, "..", "bin", "feishu-codex-bridge.mjs");
|
|
14340
14364
|
}
|
|
14341
14365
|
function buildDaemonControlCommand(action, binPath = resolveCliBinPath3(), nodePath = process.execPath) {
|
|
@@ -18462,7 +18486,7 @@ async function runSupervisor(bots) {
|
|
|
18462
18486
|
// src/core/single-instance.ts
|
|
18463
18487
|
init_paths();
|
|
18464
18488
|
import { mkdirSync as mkdirSync4, readFileSync as readFileSync6, statSync as statSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
18465
|
-
import { dirname as
|
|
18489
|
+
import { dirname as dirname15 } from "path";
|
|
18466
18490
|
var CLAIM_ATTEMPTS = 5;
|
|
18467
18491
|
var PID_REUSE_SLACK_MS = 15e3;
|
|
18468
18492
|
var EMPTY_LOCK_STALE_MS = 2e3;
|
|
@@ -18508,7 +18532,7 @@ function isLiveHolder(rec, appId) {
|
|
|
18508
18532
|
return true;
|
|
18509
18533
|
}
|
|
18510
18534
|
function acquireSingleInstanceLock(appId, file = paths.processesFile) {
|
|
18511
|
-
mkdirSync4(
|
|
18535
|
+
mkdirSync4(dirname15(file), { recursive: true });
|
|
18512
18536
|
const record = { pid: process.pid, appId, startedAt: Date.now() };
|
|
18513
18537
|
for (let attempt = 0; attempt < CLAIM_ATTEMPTS; attempt++) {
|
|
18514
18538
|
try {
|
|
@@ -19220,8 +19244,8 @@ program.command("web").description("\u672C\u673A Web \u63A7\u5236\u53F0\uFF08\u5
|
|
|
19220
19244
|
program.command("__daemon-control <action>", { hidden: true }).action(async (action) => {
|
|
19221
19245
|
await runDaemonControl(action);
|
|
19222
19246
|
});
|
|
19223
|
-
program.command("__win-relaunch", { hidden: true }).action(async () => {
|
|
19224
|
-
await runWinRelaunch();
|
|
19247
|
+
program.command("__win-relaunch [requestPath]", { hidden: true }).action(async (requestPath) => {
|
|
19248
|
+
await runWinRelaunch({ requestPath });
|
|
19225
19249
|
});
|
|
19226
19250
|
var bot = program.command("bot").description("\u98DE\u4E66\u673A\u5668\u4EBA\u7BA1\u7406\uFF08\u591A\u673A\u5668\u4EBA\uFF09");
|
|
19227
19251
|
bot.command("init [name]").description("\u6CE8\u518C\u4E00\u4E2A\u98DE\u4E66\u673A\u5668\u4EBA\u5E76\u6388\u6743\uFF08\u53EF\u9009\u77ED\u540D\uFF09").action(async (name) => {
|
package/package.json
CHANGED