lark-relay 0.4.2 → 0.4.3
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/bin/lark-relay.js +6 -1
- package/lib/help.js +14 -2
- package/package.json +1 -1
package/bin/lark-relay.js
CHANGED
|
@@ -258,7 +258,12 @@ async function cmdDispatch(argv) {
|
|
|
258
258
|
if (a.list) return dispatch.cmdList()
|
|
259
259
|
const task = a._[0]
|
|
260
260
|
if (!task) {
|
|
261
|
-
|
|
261
|
+
// 空参 = 求教,和 take 一致(exit 0);带了 flag 却没任务名是写错,短错误
|
|
262
|
+
if (argv.length === 0) {
|
|
263
|
+
process.stdout.write(`${help.DISPATCH_HELP}\n`)
|
|
264
|
+
return 0
|
|
265
|
+
}
|
|
266
|
+
process.stderr.write('需要任务名($LR_ROOT/<任务名>/dispatch.yaml)。看现有任务:`lark-relay dispatch --list`\n')
|
|
262
267
|
return 2
|
|
263
268
|
}
|
|
264
269
|
return await dispatch.run(task, { once: !!a.once })
|
package/lib/help.js
CHANGED
|
@@ -64,6 +64,9 @@ tokenStatus 为 expired 的 profile 自动跳过并 warn(永久失败,重试是
|
|
|
64
64
|
8s 后才起 consumer,收到 0 条)。collect 独立常驻,才能让 take/dispatch 侧
|
|
65
65
|
崩了、claude 跑 30 分钟、会话关几小时,都不丢消息。
|
|
66
66
|
|
|
67
|
+
装完先 \`lark-relay status\` 确认 -- collect 行应为 running;不在跑看
|
|
68
|
+
\`systemctl status lark-relay-collect\` 的日志。
|
|
69
|
+
|
|
67
70
|
落盘:~/.lark-relay/store/<app>/<YYYY-MM-DD>/<纳秒>_<pid>_<seq>.json
|
|
68
71
|
回收由 collect 进程内每小时自查一次,删超期的整个日期目录(不另起 gc 单元/timer)。
|
|
69
72
|
|
|
@@ -78,7 +81,9 @@ const STATUS_HELP = `一眼看清全局:谁在跑、积压多少、游标在哪
|
|
|
78
81
|
lark-relay status --json # 机器可读
|
|
79
82
|
|
|
80
83
|
排障入口:某消费者「落后」很多 -> 它的 take/dispatch 没在跑或卡住;
|
|
81
|
-
「无消费者」= 白采,可考虑 --exclude
|
|
84
|
+
「无消费者」= 白采,可考虑 --exclude。
|
|
85
|
+
collect 行不是 running -> \`systemctl status lark-relay-collect\` 看日志,
|
|
86
|
+
collect 停摆的每一秒都在丢消息。`
|
|
82
87
|
|
|
83
88
|
const DISPATCH_HELP = `常驻:等消息 -> 唤起 claude 干活 -> 结果回群。无人在场也跑。
|
|
84
89
|
|
|
@@ -115,7 +120,13 @@ mode 三个场景(一个键定死全部行为,不用拼组合)
|
|
|
115
120
|
最佳实践
|
|
116
121
|
· 边界写 instructions,别指望 --add-dir 目录的 CLAUDE.md(启动不加载)
|
|
117
122
|
· 改完 yaml 先 --once 跑一轮验证,再 enable
|
|
118
|
-
·
|
|
123
|
+
· 高风险发布仍建议人工执行
|
|
124
|
+
|
|
125
|
+
退出码(--once)
|
|
126
|
+
0 跑了一轮,或没等到消息但正常结束
|
|
127
|
+
1 取批异常(看 stderr)
|
|
128
|
+
2 任务不存在或配置错
|
|
129
|
+
4 等消息超时(5min 没消息)`
|
|
119
130
|
|
|
120
131
|
const GUIDE = `lark-relay -- Lark 事件中继站。三个命令:收下来 / 我来取 / 派给别人。
|
|
121
132
|
|
|
@@ -136,6 +147,7 @@ const GUIDE = `lark-relay -- Lark 事件中继站。三个命令:收下来 / 我
|
|
|
136
147
|
前置:collect 必须在跑
|
|
137
148
|
lark-relay status # collect 行应为 running
|
|
138
149
|
进程不在的时刻消息永久丢失,不是延迟送达。
|
|
150
|
+
不在跑 -> systemctl enable --now lark-relay-collect(或 \`lark-relay collect\` 前台调试)
|
|
139
151
|
|
|
140
152
|
take 三步(照做)
|
|
141
153
|
1. 查群 ID lark-cli --profile <app> im +chat-search --as user --query "<群名>"
|