@colinlu50/openclaw-lark-stream 2026.3.28 → 2026.3.30

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.en.md CHANGED
@@ -2,6 +2,8 @@ English | [中文](./README.md)
2
2
 
3
3
  # OpenClaw Lark/Feishu Plugin — Stream Card Fork
4
4
 
5
+ ![demo](./demo.gif)
6
+
5
7
  Fork of the official [openclaw-larksuite](https://github.com/larksuite/openclaw-larksuite) plugin with **streaming block output** and **tool call indicators**.
6
8
 
7
9
  ## What's Changed
package/README.md CHANGED
@@ -2,27 +2,32 @@
2
2
 
3
3
  # OpenClaw 飞书插件 — 流式卡片 Fork
4
4
 
5
+ ![demo](./demo.gif)
6
+
5
7
  基于官方 [openclaw-larksuite](https://github.com/larksuite/openclaw-larksuite) 插件的 Fork,支持**流式分块输出**和**工具调用状态展示**。
6
8
 
7
- ## 改动说明
9
+ ## 改动说明
8
10
 
9
11
  官方插件在 LLM 生成完一个 block 后才一次性推送结果。本 Fork 实现了:
10
12
 
11
- - **实时流式追加** — 每个 block 的内容在生成过程中逐步追加到流式卡片
13
+ - **实时流式输出** — 每个 block 的内容在生成过程中逐步追加到流式卡片
12
14
  - **工具调用状态** — agent 调用工具时,卡片顶部实时显示当前工具,完成后自动折叠为摘要面板
13
15
 
14
- ## 安装
16
+ ## 📢 News
15
17
 
16
- 需要 [OpenClaw](https://openclaw.ai)(>= 2026.2.26)和 Node.js(>= v22)。
18
+ - **2026.3.23** 发布第一版,支持实时流式输出和工具调用状态展示
17
19
 
18
- ```bash
19
- openclaw plugins install @colinlu50/openclaw-lark-stream
20
- ```
20
+ ## 📦 安装
21
21
 
22
- 安装完成后重启网关:
22
+ 需要 [OpenClaw](https://openclaw.ai)(>= 2026.2.26)和 Node.js(>= v22)。
23
+
24
+ > 查看 OpenClaw 版本:`openclaw -v`,如版本过低请先升级:
25
+ > ```bash
26
+ > npm install -g openclaw
27
+ > ```
23
28
 
24
29
  ```bash
25
- openclaw gateway restart
30
+ npx -y @colinlu50/openclaw-lark-stream install
26
31
  ```
27
32
 
28
33
  > 如果之前安装过官方插件,先卸载:
@@ -39,7 +44,7 @@ cd openclaw-lark-stream && npm install && npm run build
39
44
  openclaw gateway restart
40
45
  ```
41
46
 
42
- ## 配置
47
+ ## ⚙️ 配置
43
48
 
44
49
  卡片底栏默认显示耗时和完成状态,如需关闭:
45
50
 
@@ -51,6 +56,6 @@ openclaw config set channels.feishu.footer.status false # 隐藏完成状态
51
56
  - **elapsed** — 卡片底栏显示总响应耗时(如 `耗时 3.2s`)
52
57
  - **status** — 卡片底栏显示完成状态(`已完成` / `出错` / `已停止`)
53
58
 
54
- ## 许可证
59
+ ## 📄 许可证
55
60
 
56
61
  MIT — 与上游项目相同。
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { execFileSync } from "node:child_process";
4
- import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
+ import { execFileSync, execSync } from "node:child_process";
4
+ import { existsSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
7
  const SELF_PACKAGE = "@colinlu50/openclaw-lark-stream";
@@ -16,39 +16,34 @@ const args = process.argv.slice(2);
16
16
  const subcommand = args[0];
17
17
 
18
18
  // ── install / update ──
19
- // 1) Let @larksuite/openclaw-lark-tools run the full interactive setup
20
- // (version check, bot config, gateway restart, etc.)
21
- // 2) Then swap the installed official code with our fork
19
+ // 1) Clean existing plugin state so tools gets a fresh environment
20
+ // 2) Let @larksuite/openclaw-lark-tools run the interactive setup (bot config)
21
+ // 3) Clean again (tools installs official code), then install our fork
22
22
  if (subcommand === "install" || subcommand === "update") {
23
- // Step 1: Run tools for interactive setup (installs official + configures bot)
24
- // Don't exit on error — config is already saved, we still need to swap the code.
23
+ // Step 1: Clean existing state so tools doesn't choke on stale plugins
24
+ cleanPluginState();
25
+
26
+ // Step 2: Run tools for interactive setup (bot config, version check, etc.)
25
27
  const toolsArgs = args.slice();
26
28
  try {
27
29
  runTools(toolsArgs);
28
30
  } catch {
29
- // Tools may fail on gateway restart etc. — that's OK, config is preserved.
31
+ // Tools may fail on gateway restart / interactive prompt — that's OK,
32
+ // bot config is already saved to openclaw.json at this point.
30
33
  }
31
34
 
32
- // Step 2: Clean up old plugin dirs + config references, then install ours
35
+ // Step 3: Clean official plugin + any staging leftovers, install ours
36
+ cleanPluginState();
33
37
  try {
34
- for (const dir of [OFFICIAL_DIR, SELF_DIR]) {
35
- if (existsSync(dir)) {
36
- console.log(`\nRemoving ${dir}...`);
37
- rmSync(dir, { recursive: true, force: true });
38
- }
39
- }
40
- // Remove stale "openclaw-lark" references from config so openclaw doesn't
41
- // fail validation when the directory is gone.
42
- cleanConfigReferences("openclaw-lark");
43
-
44
38
  console.log(`\nInstalling ${SELF_PACKAGE}...`);
45
- execFileSync("openclaw", ["plugins", "install", SELF_PACKAGE], {
39
+ execSync(`openclaw plugins install ${SELF_PACKAGE}`, {
46
40
  stdio: "inherit",
47
41
  });
48
42
  console.log(`\n✅ ${SELF_PACKAGE} installed successfully.`);
49
43
  console.log("Run: openclaw gateway restart");
50
44
  } catch (error) {
51
- console.error(`\n❌ Failed to install ${SELF_PACKAGE}. The bot config is preserved.`);
45
+ console.error(`\n❌ Failed to install ${SELF_PACKAGE}.`);
46
+ console.error(error.message || error);
52
47
  console.error("You can retry with: openclaw plugins install " + SELF_PACKAGE);
53
48
  process.exit(error.status ?? 1);
54
49
  }
@@ -62,6 +57,39 @@ try {
62
57
  process.exit(error.status ?? 1);
63
58
  }
64
59
 
60
+ // ---------------------------------------------------------------------------
61
+ // Helpers
62
+ // ---------------------------------------------------------------------------
63
+
64
+ /**
65
+ * Remove all plugin directories, staging leftovers, and stale config
66
+ * references so that openclaw has a clean state for the next install.
67
+ */
68
+ function cleanPluginState() {
69
+ // Remove plugin directories
70
+ for (const dir of [OFFICIAL_DIR, SELF_DIR]) {
71
+ if (existsSync(dir)) {
72
+ console.log(`Removing ${dir}...`);
73
+ rmSync(dir, { recursive: true, force: true });
74
+ }
75
+ }
76
+ // Remove leftover staging directories (.openclaw-install-stage-*)
77
+ if (existsSync(EXTENSIONS_DIR)) {
78
+ try {
79
+ for (const entry of readdirSync(EXTENSIONS_DIR)) {
80
+ if (entry.startsWith(".openclaw-install-stage-")) {
81
+ const p = join(EXTENSIONS_DIR, entry);
82
+ console.log(`Removing staging dir ${p}...`);
83
+ rmSync(p, { recursive: true, force: true });
84
+ }
85
+ }
86
+ } catch { /* ignore readdir errors */ }
87
+ }
88
+ // Clean config references for both plugin IDs
89
+ cleanConfigReferences("openclaw-lark");
90
+ cleanConfigReferences("openclaw-lark-stream");
91
+ }
92
+
65
93
  /**
66
94
  * Remove stale plugin references from openclaw.json so that
67
95
  * `openclaw plugins install` doesn't fail config validation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colinlu50/openclaw-lark-stream",
3
- "version": "2026.3.28",
3
+ "version": "2026.3.30",
4
4
  "description": "OpenClaw Lark/Feishu channel plugin",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",