nikou-cli 0.1.5 → 0.1.7

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 CHANGED
@@ -154,10 +154,13 @@ nikou-cli mcp remove apifox --tools codex,claude
154
154
 
155
155
  ## AI Hook 主从节点
156
156
 
157
- Hook 模式包含一个主节点和多个从节点:
157
+ Hook 支持三种启动模式:
158
158
 
159
- - 主节点:连接聊天平台,接收消息,维护 Worker 列表,并把任务分发给从节点。
160
- - 从节点:连接主节点,收到任务后调用 Codex、Claude 或 Gemini 执行。
159
+ - 本机一体:一条命令同时启动主节点和本地从节点,适合单机使用。
160
+ - 单独从节点:只启动 Worker,连接已有主节点。
161
+ - 一主多从:单独启动一个主节点,再让多台机器的从节点接入。
162
+
163
+ 主节点负责连接聊天平台、接收消息、维护 Worker 列表并分发任务。从节点负责连接主节点,收到任务后调用 Codex、Claude 或 Gemini 执行。
161
164
 
162
165
  ### 初始化配置
163
166
 
@@ -169,10 +172,14 @@ nikou-cli hook init
169
172
 
170
173
  ```bash
171
174
  ai-hook init
172
- ai-hook
175
+ ai-hook local
173
176
  ```
174
177
 
175
- 初始化时会提示主节点地址:如果旧配置里已有主节点,直接回车沿用;没有默认值时输入 IP 或域名即可。`ai-hook` 默认等价于 `nikou-cli hook worker codex`;如需 Claude:
178
+ 初始化时会提示部署方式和主节点地址。没有远端主节点配置时默认选择本机一体,并使用 `127.0.0.1`;如果旧配置里已有非本机主节点地址,默认选择从节点并沿用该地址。
179
+
180
+ 单独从节点连接已有主节点时,不要求配置主节点专用的 `hook.bind_allowed_user_ids`。本机一体或单独启动主节点时,仍必须至少配置一个允许绑定的飞书 `user_id`。
181
+
182
+ `ai-hook` 裸命令为兼容旧习惯,仍默认等价于 `nikou-cli hook worker codex`;如需只启动 Claude Worker:
176
183
 
177
184
  ```bash
178
185
  ai-hook claude --model opus
@@ -204,6 +211,14 @@ ai-hook claude --model opus
204
211
  "auth": {
205
212
  "api_url": "https://your-platform.example.com/api/v1",
206
213
  "cli_auth_secret": "CHANGE_ME"
214
+ },
215
+ "nacos_skill_sync": {
216
+ "enabled": true,
217
+ "profile": "nikou-block",
218
+ "label": "latest",
219
+ "interval": "30s",
220
+ "plan_poll_interval_ms": 60000,
221
+ "auto_upload": false
207
222
  }
208
223
  }
209
224
  ```
@@ -214,6 +229,47 @@ ai-hook claude --model opus
214
229
  - `shared_secret` 用于主从节点握手,生产环境不要复用机器人密钥。
215
230
  - `knowledge_base_ip` 和 `knowledge_base_dir` 请按自己的机器和目录配置,默认值只是本机占位。
216
231
 
232
+ ### Skill 订阅自动同步
233
+
234
+ Worker 启动后会使用 `auth.api_url` 和 `auth.cli_auth_secret` 向平台拉取 Nacos Skill Sync 计划。只要平台开启 Nacos,用户在页面订阅的 Skill 会自动加入本机 `nacos-cli skill-sync`:
235
+
236
+ ```bash
237
+ nacos-cli profile set nikou-block ...
238
+ nacos-cli skill-sync mode nacos --profile nikou-block
239
+ nacos-cli skill-sync add <skill> --non-interactive --profile nikou-block
240
+ nacos-cli skill-sync start --foreground --non-interactive --profile nikou-block --label latest
241
+ ```
242
+
243
+ 默认不需要手动配置 Nacos profile;平台会下发可访问的 Nacos 地址、namespace、profile 和 label。`auto_upload` 默认关闭,遇到本地冲突时不会覆盖本地文件,只会上报同步状态。
244
+
245
+ ### 本机一体启动
246
+
247
+ 默认 Codex:
248
+
249
+ ```bash
250
+ ai-hook local
251
+ ```
252
+
253
+ Claude:
254
+
255
+ ```bash
256
+ ai-hook local claude --model sonnet
257
+ ```
258
+
259
+ Gemini:
260
+
261
+ ```bash
262
+ ai-hook local gemini
263
+ ```
264
+
265
+ 完整入口也可以写成:
266
+
267
+ ```bash
268
+ nikou-cli hook local codex
269
+ ```
270
+
271
+ 如果主节点监听 `0.0.0.0`,本机内嵌从节点会自动连接 `127.0.0.1`。
272
+
217
273
  ### 启动主节点
218
274
 
219
275
  ```bash
package/dist/ai-hook.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  normalizeCliArgs
4
- } from "./chunk-F3EPGM5N.js";
4
+ } from "./chunk-OQQEIFQV.js";
5
5
 
6
6
  // src/ai-hook.ts
7
7
  process.argv = [
@@ -1,7 +1,7 @@
1
1
  // src/cli-entry.ts
2
2
  import path from "path";
3
3
  var AI_HOOK_COMMAND_NAMES = /* @__PURE__ */ new Set(["ai-hook", "ai-hook.cmd", "ai-hook.exe"]);
4
- var HOOK_SUBCOMMANDS = /* @__PURE__ */ new Set(["master", "init", "worker", "log", "help"]);
4
+ var HOOK_SUBCOMMANDS = /* @__PURE__ */ new Set(["master", "init", "worker", "local", "log", "help"]);
5
5
  function normalizeCliArgs(commandPath, args) {
6
6
  const commandName = path.basename(commandPath || "");
7
7
  if (!AI_HOOK_COMMAND_NAMES.has(commandName)) {