@chbo297/infoflow 2026.5.7-beta.1 → 2026.5.7-beta.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/README.md +36 -3
- package/package.json +2 -5
- package/dist/src/cli.js +0 -157
package/README.md
CHANGED
|
@@ -37,18 +37,50 @@ bash scripts/deploy.sh
|
|
|
37
37
|
BAIDU_NPM_REGISTRY=http://registry.npm.baidu-int.com bash scripts/deploy.sh
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### 首次安装(推荐命令)
|
|
41
|
+
|
|
42
|
+
首次在机器上安装时,推荐使用以下两种方式。
|
|
43
|
+
|
|
44
|
+
方式 A:通过独立 tools 包安装并部署(推荐,支持 `update` 子命令)
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 正式版(latest)
|
|
48
|
+
npx -y @chbo297/infoflow-openclaw-tools update --version 2026.5.6 --registry https://registry.npmjs.org
|
|
49
|
+
|
|
50
|
+
# Beta 版(示例)
|
|
51
|
+
npx -y @chbo297/infoflow-openclaw-tools@beta update --version 2026.5.7-beta.2 --registry https://registry.npmjs.org
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
方式 B:通过 OpenClaw 插件命令安装
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# 正式版
|
|
58
|
+
openclaw plugins install @chbo297/infoflow@2026.5.6
|
|
59
|
+
|
|
60
|
+
# Beta 版(示例)
|
|
61
|
+
openclaw plugins install @chbo297/infoflow@2026.5.7-beta.2
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
安装后建议检查插件状态:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
openclaw plugins list
|
|
68
|
+
openclaw plugins inspect infoflow
|
|
69
|
+
```
|
|
70
|
+
|
|
40
71
|
### 通过 npx 一键更新安装
|
|
41
72
|
|
|
42
|
-
发布到 npm
|
|
73
|
+
发布到 npm 后,可直接通过独立 tools 包执行安装/升级:
|
|
43
74
|
|
|
44
75
|
```bash
|
|
45
|
-
|
|
76
|
+
npx -y @chbo297/infoflow-openclaw-tools update --version 2026.5.6 --registry https://registry.npmjs.org
|
|
46
77
|
```
|
|
47
78
|
|
|
48
79
|
常用参数:
|
|
49
80
|
|
|
50
81
|
- `--version <version>`: 指定安装版本(默认 `latest`)
|
|
51
|
-
- `--registry <url>`:
|
|
82
|
+
- `--registry <url>`: 插件包下载源(默认 `https://registry.npmjs.org`)
|
|
83
|
+
- `--baidu-registry <url>`: `@baidu/infoflow-sdk-nodejs` 下载源(默认读取 `npm_config_registry`,否则回退 `http://registry.npm.baidu-int.com`)
|
|
52
84
|
- `--channel-id <id>`: 目标插件目录名(默认 `infoflow`,安装到 `~/.openclaw/extensions/<id>`)
|
|
53
85
|
- `--dry-run`: 仅打印命令,不写入系统
|
|
54
86
|
|
|
@@ -56,6 +88,7 @@ npm_config_registry=http://registry.npm.baidu-int.com npx -y @chbo297/infoflow u
|
|
|
56
88
|
|
|
57
89
|
- `npx ... update` 与 `bash scripts/deploy.sh` 复用同一套部署核心逻辑(依赖安装、websocket 依赖校验、构建、配置写入、按状态重启 gateway)。
|
|
58
90
|
- 如果 gateway 未运行,脚本会跳过重启,仅完成插件安装与构建。
|
|
91
|
+
- 插件包 `@chbo297/infoflow` 不再内置 `child_process` CLI,避免被 `openclaw plugins install` 的危险代码检测拦截。
|
|
59
92
|
|
|
60
93
|
### WebSocket 模式(可选)
|
|
61
94
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chbo297/infoflow",
|
|
3
|
-
"version": "2026.5.7-beta.
|
|
3
|
+
"version": "2026.5.7-beta.3",
|
|
4
4
|
"description": "OpenClaw Infoflow (如流) channel plugin for Baidu enterprise messaging",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"infoflow-openclaw": "dist/src/cli.js"
|
|
9
|
-
},
|
|
10
7
|
"license": "MIT",
|
|
11
8
|
"keywords": [
|
|
12
9
|
"openclaw",
|
|
@@ -48,7 +45,7 @@
|
|
|
48
45
|
}
|
|
49
46
|
},
|
|
50
47
|
"scripts": {
|
|
51
|
-
"build": "tsc -p tsconfig.build.json",
|
|
48
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
52
49
|
"typecheck": "tsc --noEmit",
|
|
53
50
|
"test": "vitest run"
|
|
54
51
|
},
|
package/dist/src/cli.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
3
|
-
import { homedir, tmpdir } from "node:os";
|
|
4
|
-
import { dirname, join, resolve } from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { spawnSync } from "node:child_process";
|
|
7
|
-
const DEFAULT_REGISTRY = "http://registry.npm.baidu-int.com";
|
|
8
|
-
function printHelp() {
|
|
9
|
-
console.log(`Usage:
|
|
10
|
-
npx -y @chbo297/infoflow update [options]
|
|
11
|
-
|
|
12
|
-
Commands:
|
|
13
|
-
update Download and install/update Infoflow plugin
|
|
14
|
-
|
|
15
|
-
Options:
|
|
16
|
-
--version <version> Package version (default: latest)
|
|
17
|
-
--registry <url> npm registry URL (default: npm_config_registry or ${DEFAULT_REGISTRY})
|
|
18
|
-
--channel-id <id> OpenClaw channel/plugin id (default: infoflow)
|
|
19
|
-
--dry-run Print commands without changing system
|
|
20
|
-
--source-dir <path> Internal use: deploy directly from local source directory
|
|
21
|
-
-h, --help Show help
|
|
22
|
-
`);
|
|
23
|
-
}
|
|
24
|
-
function runOrFail(command, args, cwd, dryRun) {
|
|
25
|
-
const line = [command, ...args].join(" ");
|
|
26
|
-
console.log(`$ (${cwd}) ${line}`);
|
|
27
|
-
if (dryRun)
|
|
28
|
-
return;
|
|
29
|
-
const result = spawnSync(command, args, { cwd, stdio: "inherit" });
|
|
30
|
-
if (result.status !== 0) {
|
|
31
|
-
process.exit(result.status ?? 1);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function runAndCollect(command, args, cwd) {
|
|
35
|
-
const result = spawnSync(command, args, { cwd, encoding: "utf8" });
|
|
36
|
-
if (result.status !== 0) {
|
|
37
|
-
if (result.stdout)
|
|
38
|
-
process.stdout.write(result.stdout);
|
|
39
|
-
if (result.stderr)
|
|
40
|
-
process.stderr.write(result.stderr);
|
|
41
|
-
process.exit(result.status ?? 1);
|
|
42
|
-
}
|
|
43
|
-
return result.stdout ?? "";
|
|
44
|
-
}
|
|
45
|
-
function parseArgs(argv) {
|
|
46
|
-
const args = [...argv];
|
|
47
|
-
const command = args.shift() ?? "";
|
|
48
|
-
const options = {
|
|
49
|
-
version: "latest",
|
|
50
|
-
registry: process.env.npm_config_registry || DEFAULT_REGISTRY,
|
|
51
|
-
channelId: "infoflow",
|
|
52
|
-
dryRun: false,
|
|
53
|
-
};
|
|
54
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
55
|
-
const value = args[i];
|
|
56
|
-
if (value === "--version")
|
|
57
|
-
options.version = args[++i] ?? options.version;
|
|
58
|
-
else if (value === "--registry")
|
|
59
|
-
options.registry = args[++i] ?? options.registry;
|
|
60
|
-
else if (value === "--channel-id")
|
|
61
|
-
options.channelId = args[++i] ?? options.channelId;
|
|
62
|
-
else if (value === "--source-dir")
|
|
63
|
-
options.sourceDir = args[++i];
|
|
64
|
-
else if (value === "--dry-run")
|
|
65
|
-
options.dryRun = true;
|
|
66
|
-
else if (value === "-h" || value === "--help") {
|
|
67
|
-
printHelp();
|
|
68
|
-
process.exit(0);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
console.error(`Unknown option: ${value}`);
|
|
72
|
-
printHelp();
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return { command, options };
|
|
77
|
-
}
|
|
78
|
-
function installFromRegistry(options, packageName, pluginDir) {
|
|
79
|
-
const tempRoot = mkdtempSync(join(tmpdir(), "infoflow-update-"));
|
|
80
|
-
try {
|
|
81
|
-
const spec = `${packageName}@${options.version}`;
|
|
82
|
-
let tarball = "";
|
|
83
|
-
if (options.dryRun) {
|
|
84
|
-
console.log(`$ (${tempRoot}) npm pack ${spec} --registry ${options.registry} --json`);
|
|
85
|
-
tarball = "<generated-by-npm-pack>.tgz";
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
const output = runAndCollect("npm", ["pack", spec, "--registry", options.registry, "--json"], tempRoot);
|
|
89
|
-
const parsed = JSON.parse(output);
|
|
90
|
-
tarball = parsed[0]?.filename ?? "";
|
|
91
|
-
if (!tarball) {
|
|
92
|
-
console.error("Unable to resolve packed tarball filename from npm pack output.");
|
|
93
|
-
process.exit(1);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
runOrFail("tar", ["-xzf", tarball], tempRoot, options.dryRun);
|
|
97
|
-
runOrFail("mkdir", ["-p", pluginDir], tempRoot, options.dryRun);
|
|
98
|
-
runOrFail("rsync", ["-av", "--delete", `${join(tempRoot, "package")}/`, `${pluginDir}/`, "--exclude", "node_modules"], tempRoot, options.dryRun);
|
|
99
|
-
}
|
|
100
|
-
finally {
|
|
101
|
-
if (!options.dryRun)
|
|
102
|
-
rmSync(tempRoot, { recursive: true, force: true });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function installFromSource(options, pluginDir) {
|
|
106
|
-
const sourceDir = resolve(options.sourceDir);
|
|
107
|
-
runOrFail("mkdir", ["-p", pluginDir], sourceDir, options.dryRun);
|
|
108
|
-
runOrFail("rsync", [
|
|
109
|
-
"-av",
|
|
110
|
-
"--delete",
|
|
111
|
-
`${sourceDir}/`,
|
|
112
|
-
`${pluginDir}/`,
|
|
113
|
-
"--exclude",
|
|
114
|
-
"node_modules",
|
|
115
|
-
"--exclude",
|
|
116
|
-
"dist",
|
|
117
|
-
"--exclude",
|
|
118
|
-
".git",
|
|
119
|
-
], sourceDir, options.dryRun);
|
|
120
|
-
}
|
|
121
|
-
function main() {
|
|
122
|
-
const { command, options } = parseArgs(process.argv.slice(2));
|
|
123
|
-
if (!command) {
|
|
124
|
-
printHelp();
|
|
125
|
-
process.exit(0);
|
|
126
|
-
}
|
|
127
|
-
if (command !== "update") {
|
|
128
|
-
console.error(`Unknown command: ${command}`);
|
|
129
|
-
printHelp();
|
|
130
|
-
process.exit(1);
|
|
131
|
-
}
|
|
132
|
-
const filePath = fileURLToPath(import.meta.url);
|
|
133
|
-
const packageDir = resolve(dirname(filePath), "..", "..");
|
|
134
|
-
const pkg = JSON.parse(readFileSync(resolve(packageDir, "package.json"), "utf8"));
|
|
135
|
-
const packageName = pkg.name || "@chbo297/infoflow";
|
|
136
|
-
const pluginDir = resolve(process.env.HOME || homedir(), ".openclaw", "extensions", options.channelId);
|
|
137
|
-
if (options.sourceDir) {
|
|
138
|
-
installFromSource(options, pluginDir);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
installFromRegistry(options, packageName, pluginDir);
|
|
142
|
-
}
|
|
143
|
-
const commonScriptPath = join(pluginDir, "scripts", "lib", "deploy-common.sh");
|
|
144
|
-
runOrFail("bash", [
|
|
145
|
-
commonScriptPath,
|
|
146
|
-
"--plugin-dir",
|
|
147
|
-
pluginDir,
|
|
148
|
-
"--plugin-id",
|
|
149
|
-
options.channelId,
|
|
150
|
-
"--config-file",
|
|
151
|
-
resolve(process.env.HOME || homedir(), ".openclaw", "openclaw.json"),
|
|
152
|
-
"--baidu-registry",
|
|
153
|
-
options.registry,
|
|
154
|
-
...(options.dryRun ? ["--dry-run"] : []),
|
|
155
|
-
], pluginDir, options.dryRun);
|
|
156
|
-
}
|
|
157
|
-
main();
|