@modelzen/feishu-codex-bridge 0.3.11 → 0.3.12-test.1
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/README.md +50 -4
- package/dist/cli.js +13592 -5824
- package/dist/index.d.ts +13 -0
- package/dist/index.js +28 -3
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,13 @@ declare const paths: {
|
|
|
29
29
|
secretsFile: string;
|
|
30
30
|
keystoreSaltFile: string;
|
|
31
31
|
npmCacheDir: string;
|
|
32
|
+
/**
|
|
33
|
+
* 按需重后端(claude-sdk 等 npm-ondemand 包)私装目录:一个扁平
|
|
34
|
+
* `~/.feishu-codex-bridge/backends/node_modules` 放所有按需后端的 npm 包。
|
|
35
|
+
* 永远在用户 HOME 下、用户可写(零 sudo/brew),与全局包目录的权限死结解耦。
|
|
36
|
+
* 解析靠 createRequire(backendsDir/...).resolve(见 agent/backend-loader);
|
|
37
|
+
* 安装靠 `npm install --prefix backendsDir`(见 agent/installer)。 */
|
|
38
|
+
backendsDir: string;
|
|
32
39
|
/** 空白项目默认落地目录 */
|
|
33
40
|
projectsRootDir: string;
|
|
34
41
|
larkCliDir: string;
|
|
@@ -45,6 +52,12 @@ declare const paths: {
|
|
|
45
52
|
/** Inbound file attachments downloaded from chat, handed to codex by absolute
|
|
46
53
|
* path (codex has no native file input). TTL-pruned like {@link mediaDir}. */
|
|
47
54
|
inboundDir: string;
|
|
55
|
+
/** daemon 内嵌 Web 控制台的发现文件 {port, token, pid}(0600,daemon 退出
|
|
56
|
+
* 清理)——`web` 子命令据此直接打开 daemon 控制台而不是再起只读副本。 */
|
|
57
|
+
webConsoleFile: string;
|
|
58
|
+
/** 稳定的 Web 控制台 token(0600,**不随进程退出清理**)——让重启 / 预览→daemon
|
|
59
|
+
* 切换后浏览器里那条带 token 的 URL 始终有效,不再 401。删此文件即轮换 token。 */
|
|
60
|
+
webTokenFile: string;
|
|
48
61
|
};
|
|
49
62
|
|
|
50
63
|
export { log, newTraceId, paths, withTrace };
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { AsyncLocalStorage } from "async_hooks";
|
|
3
3
|
import { createWriteStream, mkdirSync } from "fs";
|
|
4
4
|
import { open, readdir, rm, stat } from "fs/promises";
|
|
5
|
+
import { tmpdir } from "os";
|
|
5
6
|
import { join as join2 } from "path";
|
|
6
7
|
|
|
7
8
|
// src/config/paths.ts
|
|
@@ -35,6 +36,13 @@ var paths = {
|
|
|
35
36
|
secretsFile: join(appDir, "secrets.enc"),
|
|
36
37
|
keystoreSaltFile: join(appDir, ".keystore.salt"),
|
|
37
38
|
npmCacheDir: join(appDir, "npm-cache"),
|
|
39
|
+
/**
|
|
40
|
+
* 按需重后端(claude-sdk 等 npm-ondemand 包)私装目录:一个扁平
|
|
41
|
+
* `~/.feishu-codex-bridge/backends/node_modules` 放所有按需后端的 npm 包。
|
|
42
|
+
* 永远在用户 HOME 下、用户可写(零 sudo/brew),与全局包目录的权限死结解耦。
|
|
43
|
+
* 解析靠 createRequire(backendsDir/...).resolve(见 agent/backend-loader);
|
|
44
|
+
* 安装靠 `npm install --prefix backendsDir`(见 agent/installer)。 */
|
|
45
|
+
backendsDir: join(appDir, "backends"),
|
|
38
46
|
/** 空白项目默认落地目录 */
|
|
39
47
|
projectsRootDir: join(appDir, "projects"),
|
|
40
48
|
larkCliDir,
|
|
@@ -50,7 +58,13 @@ var paths = {
|
|
|
50
58
|
mediaDir: join(appDir, "media"),
|
|
51
59
|
/** Inbound file attachments downloaded from chat, handed to codex by absolute
|
|
52
60
|
* path (codex has no native file input). TTL-pruned like {@link mediaDir}. */
|
|
53
|
-
inboundDir: join(appDir, "inbound")
|
|
61
|
+
inboundDir: join(appDir, "inbound"),
|
|
62
|
+
/** daemon 内嵌 Web 控制台的发现文件 {port, token, pid}(0600,daemon 退出
|
|
63
|
+
* 清理)——`web` 子命令据此直接打开 daemon 控制台而不是再起只读副本。 */
|
|
64
|
+
webConsoleFile: join(appDir, "web-console.json"),
|
|
65
|
+
/** 稳定的 Web 控制台 token(0600,**不随进程退出清理**)——让重启 / 预览→daemon
|
|
66
|
+
* 切换后浏览器里那条带 token 的 URL 始终有效,不再 401。删此文件即轮换 token。 */
|
|
67
|
+
webTokenFile: join(appDir, "web-token")
|
|
54
68
|
};
|
|
55
69
|
|
|
56
70
|
// src/core/logger.ts
|
|
@@ -70,7 +84,14 @@ var STDOUT_INFO_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
|
70
84
|
"card.action",
|
|
71
85
|
"card.launch",
|
|
72
86
|
"agent.spawn",
|
|
73
|
-
"agent.exit"
|
|
87
|
+
"agent.exit",
|
|
88
|
+
// 自愈链路(kill -9 / 崩溃恢复)的关键节点——低频高信号,进终端便于 e2e 直读:
|
|
89
|
+
// 驱逐(轮间死 / 轮中死)与恢复来源(store resume / 重建 / 全新会话)。
|
|
90
|
+
"agent.dead-thread-evict",
|
|
91
|
+
"agent.session-evict",
|
|
92
|
+
"agent.resume-ok",
|
|
93
|
+
"agent.resume-recreate",
|
|
94
|
+
"agent.session-fresh"
|
|
74
95
|
]);
|
|
75
96
|
var als = new AsyncLocalStorage();
|
|
76
97
|
var stream = null;
|
|
@@ -78,8 +99,12 @@ var currentDate = "";
|
|
|
78
99
|
function todayKey() {
|
|
79
100
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
80
101
|
}
|
|
102
|
+
function inTestEnv() {
|
|
103
|
+
return Boolean(process.env.VITEST) || process.env.NODE_ENV === "test";
|
|
104
|
+
}
|
|
105
|
+
var TEST_LOGS_DIR = join2(tmpdir(), "feishu-codex-bridge-test-logs");
|
|
81
106
|
function logsDir() {
|
|
82
|
-
return join2(paths.appDir, "logs");
|
|
107
|
+
return inTestEnv() ? TEST_LOGS_DIR : join2(paths.appDir, "logs");
|
|
83
108
|
}
|
|
84
109
|
function getStream() {
|
|
85
110
|
const today = todayKey();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modelzen/feishu-codex-bridge",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12-test.1",
|
|
4
4
|
"description": "Bridge Feishu/Lark messenger with local Codex via app-server (project=group, thread=session)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,12 +28,14 @@
|
|
|
28
28
|
"release": "bash scripts/release.sh"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@agentclientprotocol/sdk": "0.25.0",
|
|
31
32
|
"@larksuiteoapi/node-sdk": "^1.65.0",
|
|
32
33
|
"commander": "^12.1.0",
|
|
33
34
|
"cross-spawn": "^7.0.6",
|
|
34
35
|
"qrcode-terminal": "^0.12.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
38
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.175",
|
|
37
39
|
"@types/cross-spawn": "^6.0.6",
|
|
38
40
|
"@types/node": "^22.10.0",
|
|
39
41
|
"@types/qrcode-terminal": "^0.12.2",
|