opencode-feishu 0.4.0 → 0.4.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/README.md +30 -5
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,6 +71,16 @@ opencode
|
|
|
71
71
|
| `pollInterval` | number | 否 | `1000` | 轮询 AI 响应的间隔(毫秒) |
|
|
72
72
|
| `stablePolls` | number | 否 | `3` | 连续几次轮询内容不变视为回复完成 |
|
|
73
73
|
| `dedupTtl` | number | 否 | `600000` | 消息去重缓存过期时间(毫秒) |
|
|
74
|
+
| `directory` | string | 否 | `""` | 默认工作目录,支持 `~` 和 `${ENV_VAR}` 展开 |
|
|
75
|
+
|
|
76
|
+
## 特性
|
|
77
|
+
|
|
78
|
+
- **多媒体消息支持** — 图片、文件、音频、富文本、卡片等,自动下载为 data URL
|
|
79
|
+
- **实时流式更新** — 通过 `message.part.updated` 事件更新占位消息
|
|
80
|
+
- **群聊静默监听** — 所有群消息作为上下文积累,仅 @提及时回复
|
|
81
|
+
- **入群自动摄入历史消息**
|
|
82
|
+
- **代理支持** — `HTTPS_PROXY` / `HTTP_PROXY` / `ALL_PROXY`
|
|
83
|
+
- **消息去重** — 可配置 TTL
|
|
74
84
|
|
|
75
85
|
## 群聊行为
|
|
76
86
|
|
|
@@ -84,11 +94,26 @@ opencode
|
|
|
84
94
|
## 开发
|
|
85
95
|
|
|
86
96
|
```bash
|
|
87
|
-
npm install
|
|
88
|
-
npm run build
|
|
89
|
-
npm run dev
|
|
90
|
-
npm run typecheck
|
|
91
|
-
npm
|
|
97
|
+
npm install # 安装依赖
|
|
98
|
+
npm run build # 构建
|
|
99
|
+
npm run dev # 开发模式(监听变更)
|
|
100
|
+
npm run typecheck # 类型检查
|
|
101
|
+
npm run release # 交互式版本发布(bumpp:选版本 → commit → tag → push)
|
|
102
|
+
npm publish # 发布到 npm(自动先构建+类型检查)
|
|
103
|
+
npm publish --dry-run # 预览将要发布的内容
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 调试
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# 启用调试日志(结构化 JSON 输出到 stderr)
|
|
110
|
+
FEISHU_DEBUG=1 opencode
|
|
111
|
+
|
|
112
|
+
# 过滤错误日志
|
|
113
|
+
FEISHU_DEBUG=1 opencode 2>&1 | grep '"level":"error"'
|
|
114
|
+
|
|
115
|
+
# 重定向到文件
|
|
116
|
+
FEISHU_DEBUG=1 opencode 2>feishu-debug.log
|
|
92
117
|
```
|
|
93
118
|
|
|
94
119
|
## 许可证
|
package/dist/index.js
CHANGED
|
@@ -99510,9 +99510,10 @@ var FeishuPlugin = async (ctx) => {
|
|
|
99510
99510
|
throw new Error(`\u98DE\u4E66\u914D\u7F6E\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF\uFF1A${configPath} \u5FC5\u987B\u662F\u5408\u6CD5\u7684 JSON (${parseErr})`);
|
|
99511
99511
|
}
|
|
99512
99512
|
if (feishuRaw.directory !== void 0 && typeof feishuRaw.directory !== "string") {
|
|
99513
|
-
|
|
99514
|
-
|
|
99515
|
-
);
|
|
99513
|
+
log("warn", `\u98DE\u4E66\u914D\u7F6E\u8B66\u544A\uFF1A${configPath} \u4E2D\u7684 'directory' \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\uFF0C\u5DF2\u5FFD\u7565`, {
|
|
99514
|
+
actualType: typeof feishuRaw.directory
|
|
99515
|
+
});
|
|
99516
|
+
feishuRaw.directory = void 0;
|
|
99516
99517
|
}
|
|
99517
99518
|
if (!feishuRaw.appId || !feishuRaw.appSecret) {
|
|
99518
99519
|
throw new Error(
|
|
@@ -99529,7 +99530,7 @@ var FeishuPlugin = async (ctx) => {
|
|
|
99529
99530
|
pollInterval: feishuRaw.pollInterval ?? DEFAULT_CONFIG.pollInterval,
|
|
99530
99531
|
stablePolls: feishuRaw.stablePolls ?? DEFAULT_CONFIG.stablePolls,
|
|
99531
99532
|
dedupTtl: feishuRaw.dedupTtl ?? DEFAULT_CONFIG.dedupTtl,
|
|
99532
|
-
directory: feishuRaw.directory ?? ctx.directory ?? DEFAULT_CONFIG.directory
|
|
99533
|
+
directory: expandDirectoryPath(feishuRaw.directory ?? ctx.directory ?? DEFAULT_CONFIG.directory)
|
|
99533
99534
|
};
|
|
99534
99535
|
initDedup(resolvedConfig.dedupTtl);
|
|
99535
99536
|
const botOpenId = await fetchBotOpenId(resolvedConfig.appId, resolvedConfig.appSecret, log);
|
|
@@ -99573,6 +99574,20 @@ var FeishuPlugin = async (ctx) => {
|
|
|
99573
99574
|
};
|
|
99574
99575
|
return hooks;
|
|
99575
99576
|
};
|
|
99577
|
+
function expandDirectoryPath(dir) {
|
|
99578
|
+
if (!dir) return dir;
|
|
99579
|
+
if (dir.startsWith("~")) {
|
|
99580
|
+
dir = join(homedir(), dir.slice(1));
|
|
99581
|
+
}
|
|
99582
|
+
dir = dir.replace(/\$\{(\w+)\}/g, (_match, name) => {
|
|
99583
|
+
const val = process.env[name];
|
|
99584
|
+
if (val === void 0) {
|
|
99585
|
+
throw new Error(`\u73AF\u5883\u53D8\u91CF ${name} \u672A\u8BBE\u7F6E\uFF08directory \u5F15\u7528\u4E86 \${${name}}\uFF09`);
|
|
99586
|
+
}
|
|
99587
|
+
return val;
|
|
99588
|
+
});
|
|
99589
|
+
return dir;
|
|
99590
|
+
}
|
|
99576
99591
|
function resolveEnvPlaceholders(obj) {
|
|
99577
99592
|
if (typeof obj === "string") {
|
|
99578
99593
|
if (!obj.includes("${")) return obj;
|