claude-codex-wechat 0.1.54 → 0.1.55
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/server/cli.js +94 -40
- package/package.json +1 -1
package/dist/server/cli.js
CHANGED
|
@@ -5,8 +5,8 @@ import { createRequire as __cjsCreateRequire } from 'node:module'; const require
|
|
|
5
5
|
import { execFile as execFile2 } from "node:child_process";
|
|
6
6
|
import { existsSync as existsSync11, readFileSync as readFileSync10 } from "node:fs";
|
|
7
7
|
import { promisify as promisify2 } from "node:util";
|
|
8
|
-
import { dirname as
|
|
9
|
-
import { fileURLToPath as
|
|
8
|
+
import { dirname as dirname10, join as join15 } from "node:path";
|
|
9
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
10
10
|
|
|
11
11
|
// src/daemon/bootstrap.ts
|
|
12
12
|
import { networkInterfaces } from "node:os";
|
|
@@ -14,8 +14,8 @@ import { networkInterfaces } from "node:os";
|
|
|
14
14
|
// src/daemon/server.ts
|
|
15
15
|
import { mkdtempSync, existsSync as existsSync9, writeFileSync as writeFileSync2 } from "node:fs";
|
|
16
16
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
17
|
-
import { dirname as
|
|
18
|
-
import { fileURLToPath as
|
|
17
|
+
import { dirname as dirname8, join as join12 } from "node:path";
|
|
18
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
19
19
|
import Fastify from "fastify";
|
|
20
20
|
|
|
21
21
|
// src/channels/platforms.ts
|
|
@@ -3650,6 +3650,55 @@ var CodexAppServerClient = class {
|
|
|
3650
3650
|
}
|
|
3651
3651
|
};
|
|
3652
3652
|
|
|
3653
|
+
// src/providers/codex/bridgeDeveloperInstructions.ts
|
|
3654
|
+
import { dirname as dirname6, join as join10 } from "node:path";
|
|
3655
|
+
import { fileURLToPath } from "node:url";
|
|
3656
|
+
function buildCodexBridgeInstructions(input = {}) {
|
|
3657
|
+
const apiBaseUrl = input.apiBaseUrl ?? defaultApiBaseUrl();
|
|
3658
|
+
const douyinScript = input.douyinScriptPath ?? defaultDouyinScriptPath();
|
|
3659
|
+
return [
|
|
3660
|
+
"\u4F60\u6B63\u8FD0\u884C\u5728\u4E00\u4E2A\u5FAE\u4FE1\u6865\u63A5\u73AF\u5883\u4E2D\uFF0C\u7528\u6237\u901A\u8FC7\u5FAE\u4FE1\u4E0E\u4F60\u5BF9\u8BDD\u3002",
|
|
3661
|
+
"",
|
|
3662
|
+
"## \u73AF\u5883\u8BF4\u660E",
|
|
3663
|
+
"- \u7528\u6237\u770B\u5230\u7684\u662F\u5FAE\u4FE1\u804A\u5929\u754C\u9762\uFF0C\u6CA1\u6709\u4EA4\u4E92\u5F0F\u5F39\u7A97\u6216\u6309\u94AE\uFF1B\u9700\u8981\u7528\u6237\u505A\u9009\u62E9\u65F6\u7528\u5E8F\u53F7\u5217\u8868\u3002",
|
|
3664
|
+
'- \u7528\u6237\u8BF4\u7684"\u53D1\u7ED9\u6211""\u53D1\u5230\u5FAE\u4FE1""\u53D1\u51FA\u6765""\u4F20\u7ED9\u6211"\uFF0C\u90FD\u662F\u6307\u628A\u6587\u4EF6\u53D1\u9001\u5230\u4ED6\u7684\u5FAE\u4FE1\u3002',
|
|
3665
|
+
"",
|
|
3666
|
+
"## \u53D1\u9001\u6587\u4EF6\u5230\u7528\u6237\u5FAE\u4FE1",
|
|
3667
|
+
"\u7528 shell \u8C03\u7528\u6865\u63A5\u5C42\u7684\u53D1\u9001\u7AEF\u70B9\u5373\u53EF\uFF08kind \u53D6 image / video / audio / file\uFF09\uFF1A",
|
|
3668
|
+
"```bash",
|
|
3669
|
+
`curl -sS -X POST ${apiBaseUrl}/api/channel/send-media \\`,
|
|
3670
|
+
" -H 'Content-Type: application/json' \\",
|
|
3671
|
+
` -d '{"kind":"video","filePath":"/absolute/path/to/file.mp4"}'`,
|
|
3672
|
+
"```",
|
|
3673
|
+
"- filePath \u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84\u3002",
|
|
3674
|
+
'- \u8FD4\u56DE {"ok":true} \u5373\u53D1\u9001\u6210\u529F\uFF1B\u5931\u8D25\u65F6\u628A\u9519\u8BEF\u539F\u6587\u544A\u8BC9\u7528\u6237\uFF0C\u5E76\u7ED9\u51FA\u6587\u4EF6\u672C\u5730\u8DEF\u5F84\u3002',
|
|
3675
|
+
"",
|
|
3676
|
+
"## \u6296\u97F3\u89C6\u9891\u4E0B\u8F7D",
|
|
3677
|
+
"\u5F53\u7528\u6237\u53D1\u6765\u542B\u6296\u97F3\u94FE\u63A5\uFF08v.douyin.com\u3001douyin.com\uFF09\u7684\u6D88\u606F\u6216\u5206\u4EAB\u6587\u6848\u65F6\uFF1A",
|
|
3678
|
+
'- \u7ACB\u5373\u6267\u884C\u4E0B\u8F7D\uFF0C\u4E0D\u8981\u53CD\u95EE\u7528\u6237"\u8981\u4E0B\u8F7D\u8FD8\u662F\u8981\u603B\u7ED3"\u2014\u2014\u4E0B\u8F7D\u5E76\u53D1\u9001\u5C31\u662F\u9ED8\u8BA4\u9884\u671F\u3002',
|
|
3679
|
+
"```bash",
|
|
3680
|
+
`node ${douyinScript} "<\u6296\u97F3\u94FE\u63A5\u6216\u6574\u6BB5\u5206\u4EAB\u6587\u6848>" --output /tmp`,
|
|
3681
|
+
"```",
|
|
3682
|
+
"- \u811A\u672C\u6210\u529F\u65F6\u8F93\u51FA `\u2705 \u5DF2\u4FDD\u5B58: <\u6587\u4EF6\u7EDD\u5BF9\u8DEF\u5F84>`\uFF1B\u53D6\u8BE5\u8DEF\u5F84\uFF0C\u6309\u4E0A\u9762\u7684\u65B9\u5F0F\u4EE5 kind=video \u53D1\u9001\u5230\u5FAE\u4FE1\u3002",
|
|
3683
|
+
"- \u652F\u6301\u77ED\u94FE\u3001\u5B8C\u6574\u94FE\u63A5\u3001\u5206\u4EAB\u6587\u6848\u3001\u7EAF aweme_id\uFF0C\u53EF\u4EE5\u628A\u6574\u6BB5\u6587\u6848\u539F\u6837\u4F20\u8FDB\u53BB\u3002",
|
|
3684
|
+
"- \u5206\u4EAB\u6D88\u606F\u5E38\u9644\u5E26\u5361\u7247\u7F29\u7565\u56FE\uFF0C\u52A0\u8F7D\u5931\u8D25\u65E0\u5173\u7D27\u8981\uFF0C\u76F4\u63A5\u5FFD\u7565\uFF0C\u4E0D\u8981\u56E0\u6B64\u6539\u804A\u56FE\u7247\u3002",
|
|
3685
|
+
'- \u4E0B\u8F7D\u5931\u8D25\u5148\u539F\u6837\u91CD\u8BD5\u4E00\u6B21\uFF1B\u4ECD\u5931\u8D25\u5C31\u4E00\u53E5\u8BDD\u544A\u8BC9\u7528\u6237"\u6296\u97F3\u4E0B\u8F7D\u5931\u8D25\uFF1A<\u539F\u56E0>"\uFF0C\u4E0D\u8981\u5C94\u5F00\u8BDD\u9898\u3002',
|
|
3686
|
+
"",
|
|
3687
|
+
"## \u884C\u4E3A\u51C6\u5219",
|
|
3688
|
+
'- \u7528\u6237\u7684"\u6211"\u5C31\u662F\u4ED6\u7684\u5FAE\u4FE1\uFF0C"\u53D1\u7ED9\u6211"\u5C31\u662F\u53D1\u5230\u5FAE\u4FE1\u3002',
|
|
3689
|
+
'- \u6267\u884C\u5B8C\u6210\u540E\u7B80\u77ED\u786E\u8BA4\uFF08\u5982"\u5DF2\u53D1\u9001"\uFF09\uFF0C\u4E0D\u9700\u8981\u5197\u957F\u89E3\u91CA\u3002',
|
|
3690
|
+
'- \u4F60\u751F\u6210\u4E86\u6587\u4EF6\uFF08\u56FE\u8868\u3001\u4EE3\u7801\u3001\u6587\u6863\u7B49\uFF09\u540E\uFF0C\u7528\u6237\u8BF4"\u53D1\u7ED9\u6211"\u5C31\u76F4\u63A5\u6309\u4E0A\u9762\u7684\u65B9\u5F0F\u53D1\u9001\u3002'
|
|
3691
|
+
].join("\n");
|
|
3692
|
+
}
|
|
3693
|
+
function defaultApiBaseUrl() {
|
|
3694
|
+
const port = process.env.BRIDGE_PORT ?? "8787";
|
|
3695
|
+
return `http://127.0.0.1:${port}`;
|
|
3696
|
+
}
|
|
3697
|
+
function defaultDouyinScriptPath() {
|
|
3698
|
+
const here2 = dirname6(fileURLToPath(import.meta.url));
|
|
3699
|
+
return join10(here2, "..", "mcp", "scripts", "douyin-download.mjs");
|
|
3700
|
+
}
|
|
3701
|
+
|
|
3653
3702
|
// src/providers/codex/codexInteractiveRunner.ts
|
|
3654
3703
|
var IDLE_SENTINEL2 = /* @__PURE__ */ Symbol("idle_timeout");
|
|
3655
3704
|
function withIdleTimeout(promise, ms) {
|
|
@@ -3751,10 +3800,12 @@ var CodexInteractiveRunner = class {
|
|
|
3751
3800
|
command;
|
|
3752
3801
|
syncThreadForResume;
|
|
3753
3802
|
idleTimeoutMs;
|
|
3803
|
+
bridgeInstructions;
|
|
3754
3804
|
constructor(input = {}) {
|
|
3755
3805
|
this.command = input.command;
|
|
3756
3806
|
this.syncThreadForResume = input.syncThreadForResume ?? syncCodexThreadForResume;
|
|
3757
3807
|
this.idleTimeoutMs = input.idleTimeoutMs ?? 18e4;
|
|
3808
|
+
this.bridgeInstructions = input.bridgeInstructions ?? buildCodexBridgeInstructions();
|
|
3758
3809
|
}
|
|
3759
3810
|
async startSession(input) {
|
|
3760
3811
|
const session = {
|
|
@@ -3791,7 +3842,9 @@ var CodexInteractiveRunner = class {
|
|
|
3791
3842
|
const resumed = await withIdleTimeout(client.request("thread/resume", {
|
|
3792
3843
|
threadId: session.threadId,
|
|
3793
3844
|
cwd: session.cwd,
|
|
3794
|
-
persistExtendedHistory: true
|
|
3845
|
+
persistExtendedHistory: true,
|
|
3846
|
+
// resume 也要带:恢复出来的会话同样跑在微信桥接环境里。
|
|
3847
|
+
developerInstructions: this.bridgeInstructions
|
|
3795
3848
|
}).catch(() => void 0), this.idleTimeoutMs);
|
|
3796
3849
|
if (resumed === IDLE_SENTINEL2) {
|
|
3797
3850
|
await this.handleIdleTimeout(session);
|
|
@@ -3805,7 +3858,8 @@ var CodexInteractiveRunner = class {
|
|
|
3805
3858
|
persistExtendedHistory: true,
|
|
3806
3859
|
experimentalRawEvents: true,
|
|
3807
3860
|
sandboxPolicy: { type: "disabled" },
|
|
3808
|
-
approvalMode: "never"
|
|
3861
|
+
approvalMode: "never",
|
|
3862
|
+
developerInstructions: this.bridgeInstructions
|
|
3809
3863
|
}), this.idleTimeoutMs);
|
|
3810
3864
|
if (started === IDLE_SENTINEL2) {
|
|
3811
3865
|
await this.handleIdleTimeout(session);
|
|
@@ -5436,12 +5490,12 @@ var RelayTunnelRouter = class {
|
|
|
5436
5490
|
|
|
5437
5491
|
// src/shared/version.ts
|
|
5438
5492
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
5439
|
-
import { dirname as
|
|
5440
|
-
import { fileURLToPath } from "node:url";
|
|
5493
|
+
import { dirname as dirname7, join as join11 } from "node:path";
|
|
5494
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
5441
5495
|
function readClientVersion() {
|
|
5442
5496
|
try {
|
|
5443
|
-
const here2 =
|
|
5444
|
-
const pkg = JSON.parse(readFileSync8(
|
|
5497
|
+
const here2 = dirname7(fileURLToPath2(import.meta.url));
|
|
5498
|
+
const pkg = JSON.parse(readFileSync8(join11(here2, "..", "..", "package.json"), "utf8"));
|
|
5445
5499
|
return typeof pkg.version === "string" && pkg.version ? pkg.version : "0.0.0";
|
|
5446
5500
|
} catch {
|
|
5447
5501
|
return "0.0.0";
|
|
@@ -5460,7 +5514,7 @@ function readUpdateStatusBestEffort(configPath) {
|
|
|
5460
5514
|
function createDaemonServer(options = {}) {
|
|
5461
5515
|
const app = Fastify({ logger: true });
|
|
5462
5516
|
const events = new BridgeEventHub();
|
|
5463
|
-
const configPath = options.configPath ?? process.env.BRIDGE_CONFIG ??
|
|
5517
|
+
const configPath = options.configPath ?? process.env.BRIDGE_CONFIG ?? join12(mkdtempSync(join12(tmpdir2(), "claude-codex-wechat-")), "config.json");
|
|
5464
5518
|
const persistedConfig = loadBridgeConfig(configPath);
|
|
5465
5519
|
const bridgeDefaults = {
|
|
5466
5520
|
defaultProvider: options.bridgeDefaults?.defaultProvider ?? persistedConfig.bridge?.defaultProvider ?? "claude-code",
|
|
@@ -5497,10 +5551,10 @@ function createDaemonServer(options = {}) {
|
|
|
5497
5551
|
const lastProviderSessions = new LastProviderSessionStore(configPath);
|
|
5498
5552
|
const sessionBindingMatch = /* @__PURE__ */ new Map();
|
|
5499
5553
|
const bridgePort = process.env.BRIDGE_PORT ?? "8787";
|
|
5500
|
-
const mcpConfigPath =
|
|
5501
|
-
const serverDir =
|
|
5502
|
-
const mcpMediaServerTs =
|
|
5503
|
-
const mcpMediaServerJs =
|
|
5554
|
+
const mcpConfigPath = join12(dirname8(configPath), "mcp-media.json");
|
|
5555
|
+
const serverDir = dirname8(fileURLToPath3(import.meta.url));
|
|
5556
|
+
const mcpMediaServerTs = join12(serverDir, "..", "mcp", "mediaServer.ts");
|
|
5557
|
+
const mcpMediaServerJs = join12(serverDir, "..", "mcp", "mediaServer.js");
|
|
5504
5558
|
const useTs = existsSync9(mcpMediaServerTs) && !existsSync9(mcpMediaServerJs);
|
|
5505
5559
|
const mcpCommand = useTs ? "tsx" : "node";
|
|
5506
5560
|
const mcpArgs = [useTs ? mcpMediaServerTs : mcpMediaServerJs];
|
|
@@ -5535,7 +5589,7 @@ function createDaemonServer(options = {}) {
|
|
|
5535
5589
|
});
|
|
5536
5590
|
}
|
|
5537
5591
|
const weixinStateStore = configPath ? new FileWeixinStateStore(configPath) : void 0;
|
|
5538
|
-
const weixinMediaDir = configPath ?
|
|
5592
|
+
const weixinMediaDir = configPath ? join12(dirname8(configPath), "media") : void 0;
|
|
5539
5593
|
const managedWechatChannel = options.channel ? null : new ManagedWeixinDirectAdapter(options.wechat, weixinStateStore, weixinMediaDir);
|
|
5540
5594
|
const channel = options.channel ?? managedWechatChannel;
|
|
5541
5595
|
const weixinOutboundGate = managedWechatChannel && weixinStateStore ? new WeixinOutboundGate({
|
|
@@ -5893,7 +5947,7 @@ async function resolveProviderCommands(providers) {
|
|
|
5893
5947
|
|
|
5894
5948
|
// src/daemon/staticFrontend.ts
|
|
5895
5949
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
5896
|
-
import { join as
|
|
5950
|
+
import { join as join13 } from "node:path";
|
|
5897
5951
|
import fastifyStatic from "@fastify/static";
|
|
5898
5952
|
function attachStaticFrontend(webRoot2) {
|
|
5899
5953
|
return async (app) => {
|
|
@@ -5901,7 +5955,7 @@ function attachStaticFrontend(webRoot2) {
|
|
|
5901
5955
|
root: webRoot2,
|
|
5902
5956
|
wildcard: false
|
|
5903
5957
|
});
|
|
5904
|
-
const indexHtml = readFileSync9(
|
|
5958
|
+
const indexHtml = readFileSync9(join13(webRoot2, "index.html"), "utf8");
|
|
5905
5959
|
app.setNotFoundHandler((request, reply) => {
|
|
5906
5960
|
if (request.url.startsWith("/api")) {
|
|
5907
5961
|
reply.code(404).send({ error: "not_found" });
|
|
@@ -5916,7 +5970,7 @@ function attachStaticFrontend(webRoot2) {
|
|
|
5916
5970
|
import { existsSync as existsSync10, statSync, openSync as openSync2, closeSync as closeSync2, watchFile } from "node:fs";
|
|
5917
5971
|
import { mkdir as mkdir4, readFile as readFile6, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
|
|
5918
5972
|
import { homedir as homedir8 } from "node:os";
|
|
5919
|
-
import { dirname as
|
|
5973
|
+
import { dirname as dirname9, join as join14 } from "node:path";
|
|
5920
5974
|
import { createReadStream } from "node:fs";
|
|
5921
5975
|
import { execFile, spawn as spawn7 } from "node:child_process";
|
|
5922
5976
|
import { createInterface } from "node:readline";
|
|
@@ -6093,37 +6147,37 @@ async function readServiceStatus(context) {
|
|
|
6093
6147
|
throw new Error("service_status_not_supported_on_this_platform");
|
|
6094
6148
|
}
|
|
6095
6149
|
function buildLaunchdSpec(context) {
|
|
6096
|
-
const stateDir =
|
|
6150
|
+
const stateDir = join14(homedir8(), ".claude-codex-wechat");
|
|
6097
6151
|
return {
|
|
6098
6152
|
label: "com.claude-codex-wechat",
|
|
6099
|
-
plistPath:
|
|
6153
|
+
plistPath: join14(homedir8(), "Library", "LaunchAgents", "com.claude-codex-wechat.plist"),
|
|
6100
6154
|
programArgs: [context.nodePath ?? process.execPath, context.cliEntrypointPath, "__daemon"],
|
|
6101
6155
|
workingDirectory: homedir8(),
|
|
6102
|
-
stdoutPath:
|
|
6103
|
-
stderrPath:
|
|
6156
|
+
stdoutPath: join14(stateDir, "logs", "service.stdout.log"),
|
|
6157
|
+
stderrPath: join14(stateDir, "logs", "service.stderr.log"),
|
|
6104
6158
|
environment: buildServiceEnvironment(context)
|
|
6105
6159
|
};
|
|
6106
6160
|
}
|
|
6107
6161
|
function buildSystemdUserSpec(context) {
|
|
6108
|
-
const stateDir =
|
|
6162
|
+
const stateDir = join14(homedir8(), ".claude-codex-wechat");
|
|
6109
6163
|
return {
|
|
6110
6164
|
unitName: "claude-codex-wechat.service",
|
|
6111
|
-
unitPath:
|
|
6165
|
+
unitPath: join14(homedir8(), ".config", "systemd", "user", "claude-codex-wechat.service"),
|
|
6112
6166
|
execStart: [context.nodePath ?? process.execPath, context.cliEntrypointPath, "__daemon"],
|
|
6113
6167
|
workingDirectory: homedir8(),
|
|
6114
|
-
stdoutPath:
|
|
6115
|
-
stderrPath:
|
|
6168
|
+
stdoutPath: join14(stateDir, "logs", "service.stdout.log"),
|
|
6169
|
+
stderrPath: join14(stateDir, "logs", "service.stderr.log"),
|
|
6116
6170
|
environment: buildServiceEnvironment(context)
|
|
6117
6171
|
};
|
|
6118
6172
|
}
|
|
6119
6173
|
function buildProcessSpec(context) {
|
|
6120
|
-
const stateDir =
|
|
6174
|
+
const stateDir = join14(homedir8(), ".claude-codex-wechat");
|
|
6121
6175
|
return {
|
|
6122
|
-
pidPath:
|
|
6176
|
+
pidPath: join14(stateDir, "service.pid"),
|
|
6123
6177
|
command: [context.nodePath ?? process.execPath, context.cliEntrypointPath, "__daemon"],
|
|
6124
6178
|
workingDirectory: homedir8(),
|
|
6125
|
-
stdoutPath:
|
|
6126
|
-
stderrPath:
|
|
6179
|
+
stdoutPath: join14(stateDir, "logs", "service.stdout.log"),
|
|
6180
|
+
stderrPath: join14(stateDir, "logs", "service.stderr.log"),
|
|
6127
6181
|
environment: buildServiceEnvironment(context)
|
|
6128
6182
|
};
|
|
6129
6183
|
}
|
|
@@ -6154,8 +6208,8 @@ function buildServiceEnvironment(context) {
|
|
|
6154
6208
|
return env;
|
|
6155
6209
|
}
|
|
6156
6210
|
async function applyLaunchdService(spec) {
|
|
6157
|
-
await mkdir4(
|
|
6158
|
-
await mkdir4(
|
|
6211
|
+
await mkdir4(dirname9(spec.plistPath), { recursive: true });
|
|
6212
|
+
await mkdir4(dirname9(spec.stdoutPath), { recursive: true });
|
|
6159
6213
|
await writeFile4(spec.plistPath, renderLaunchdPlist(spec), "utf8");
|
|
6160
6214
|
const guiDomain = `gui/${process.getuid?.() ?? 0}`;
|
|
6161
6215
|
await runLaunchctl(["bootout", guiDomain, spec.plistPath]).catch(() => void 0);
|
|
@@ -6163,8 +6217,8 @@ async function applyLaunchdService(spec) {
|
|
|
6163
6217
|
await runLaunchctl(["kickstart", "-k", `${guiDomain}/${spec.label}`]);
|
|
6164
6218
|
}
|
|
6165
6219
|
async function writeSystemdUnit(spec) {
|
|
6166
|
-
await mkdir4(
|
|
6167
|
-
await mkdir4(
|
|
6220
|
+
await mkdir4(dirname9(spec.unitPath), { recursive: true });
|
|
6221
|
+
await mkdir4(dirname9(spec.stdoutPath), { recursive: true });
|
|
6168
6222
|
await writeFile4(spec.unitPath, renderSystemdUnit(spec), "utf8");
|
|
6169
6223
|
}
|
|
6170
6224
|
function renderLaunchdPlist(spec) {
|
|
@@ -6258,7 +6312,7 @@ async function readPidFile(pidPath) {
|
|
|
6258
6312
|
}
|
|
6259
6313
|
}
|
|
6260
6314
|
async function writePidFile(pidPath, pid) {
|
|
6261
|
-
await mkdir4(
|
|
6315
|
+
await mkdir4(dirname9(pidPath), { recursive: true });
|
|
6262
6316
|
await writeFile4(pidPath, `${pid}
|
|
6263
6317
|
`, "utf8");
|
|
6264
6318
|
}
|
|
@@ -6273,7 +6327,7 @@ async function killPid(pid) {
|
|
|
6273
6327
|
process.kill(pid, "SIGTERM");
|
|
6274
6328
|
}
|
|
6275
6329
|
async function spawnDetachedDaemon(spec) {
|
|
6276
|
-
await mkdir4(
|
|
6330
|
+
await mkdir4(dirname9(spec.stdoutPath), { recursive: true });
|
|
6277
6331
|
const outFd = openSync2(spec.stdoutPath, "a");
|
|
6278
6332
|
const errFd = openSync2(spec.stderrPath, "a");
|
|
6279
6333
|
try {
|
|
@@ -6398,8 +6452,8 @@ async function performUpgrade(deps) {
|
|
|
6398
6452
|
|
|
6399
6453
|
// src/cli.ts
|
|
6400
6454
|
var execFileAsync2 = promisify2(execFile2);
|
|
6401
|
-
var here =
|
|
6402
|
-
var webRoot =
|
|
6455
|
+
var here = dirname10(fileURLToPath4(import.meta.url));
|
|
6456
|
+
var webRoot = join15(here, "..", "web");
|
|
6403
6457
|
async function main() {
|
|
6404
6458
|
const command = process.argv[2];
|
|
6405
6459
|
switch (command) {
|
|
@@ -6598,7 +6652,7 @@ async function cmdUninstall() {
|
|
|
6598
6652
|
}
|
|
6599
6653
|
function createServiceContext() {
|
|
6600
6654
|
return {
|
|
6601
|
-
cliEntrypointPath:
|
|
6655
|
+
cliEntrypointPath: fileURLToPath4(import.meta.url),
|
|
6602
6656
|
nodePath: process.execPath,
|
|
6603
6657
|
configPath: process.env.BRIDGE_CONFIG ?? defaultConfigPath(),
|
|
6604
6658
|
port: Number(process.env.BRIDGE_PORT ?? 8787)
|