cli-swarm 0.1.0 → 0.2.0
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/package.json +2 -2
- package/skills/calctool/SKILL.md +22 -16
- package/skills/swarm/SKILL.md +8 -0
- package/skills/swarm/swarm-runtime.mjs +62 -6
- package/README.md +0 -36
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cli-swarm",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "swarm
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "swarm 智能体蜂群编排多 IDE 安装器:从 cli.tax 自动拉取并分发到本机所有已装 IDE。支持 check 更新检测。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cli-swarm": "install.mjs"
|
package/skills/calctool/SKILL.md
CHANGED
|
@@ -18,8 +18,10 @@ description: '按需生成「万能计算工具」:用户输入一个领域需
|
|
|
18
18
|
2. 情报蜂群(research) —— 自动派情报智能体搜索行业标准/抓指定地址,
|
|
19
19
|
产出可溯源参考包(老板说"电商"等关键词时自动触发)
|
|
20
20
|
↓
|
|
21
|
-
3.
|
|
22
|
-
imports/reports/pages
|
|
21
|
+
3. 蜂群编排(swarm-orchestrate)—— 需求自动拆解为 fields/formulas/rules/
|
|
22
|
+
imports/reports/pages 项目 JSON,交给 swarm 大脑编排:企业组织架构派单 →
|
|
23
|
+
认领 → 执行 → 回传 → 红绿灯监控 → 固定运维(心跳/回收/接替/继承)
|
|
24
|
+
→ 安全守卫(注入检测),确定性合并
|
|
23
25
|
↓
|
|
24
26
|
4. 编译工具(compile-tool) —— 引擎定义 → 可运行工程文件清单
|
|
25
27
|
(App 壳/公式引擎/存储/构建,页面自动生成:录入/指标卡/报告)
|
|
@@ -109,29 +111,28 @@ defaultLocale: zh-CN
|
|
|
109
111
|
- 发布为版本化引擎,任何公式/字段/阈值变化都创建新版本,不原地修改
|
|
110
112
|
- 输出:可运行的在线工具 + 引擎定义包 + 验收报告 + 完成前门禁结论
|
|
111
113
|
|
|
112
|
-
##
|
|
114
|
+
## 多智能体蜂群模式(接入 swarm 编排,推荐复杂工具用)
|
|
113
115
|
|
|
114
|
-
单智能体 `compile-inline` 适合简单工具;复杂工具(多字段 + 多公式 + 规则 + 导入 +
|
|
116
|
+
单智能体 `compile-inline` 适合简单工具;复杂工具(多字段 + 多公式 + 规则 + 导入 + 报告)用**蜂群编排(swarm)**:通过智能体大脑调度创建 N 个子智能体,企业级组织架构规则 + 项目 JSON 任务派单/认领/回传 + 红绿灯 + 固定运维与安全守卫——准确率更高、产出更强、可观测可自治。
|
|
115
117
|
|
|
116
|
-
###
|
|
117
|
-
- `ide`:用当前 IDE 的多智能体(subagent)执行蜂群(默认)
|
|
118
|
-
- `hermes_local`:用用户本地安装的 Hermes 执行蜂群
|
|
118
|
+
### 接入方式(swarm-orchestrate)
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
1. **brain-handshake**:协商大脑模式(ide/hermes_local),返回蜂群能力
|
|
123
|
-
2. **brain-invoke**:传需求 → **自动拆解**为蜂群任务(按需派发,需要几个派几个):
|
|
120
|
+
1. **swarm-orchestrate**:传需求 → calctool **自动拆解**为项目 JSON(需要几个派几个):
|
|
121
|
+
- `research` 情报收集(有领域关键词才派)
|
|
124
122
|
- `fields` 字段目录(入口,总是有)
|
|
125
123
|
- `formulas` 公式图(有公式才派)· 独立复核
|
|
126
124
|
- `rules` 规则包(有规则才派)· 独立复核
|
|
127
125
|
- `imports` 导入映射(有导入才派)
|
|
128
126
|
- `reports` 报告模板(有报告才派)
|
|
129
127
|
- `pages` 页面规格(总是有)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
2. **swarm 大脑编排**:项目 JSON 交给 swarm 运行时(https://cli.tax/zj7fTPVh4p):
|
|
129
|
+
- `org-chart`:按企业组织架构创建 N 个子智能体(board/dispatcher/ops/security-guard/workers)
|
|
130
|
+
- `dispatch`:依赖图驱动派单(fields 先 → formulas/imports 并行 → reports → pages)
|
|
131
|
+
- `claim`:worker 认领任务;`report`:回传结果
|
|
132
|
+
- `traffic-light`:每任务/智能体实时绿/黄/红状态 + 进度/错误汇报
|
|
133
|
+
- `ops`:固定运维——心跳检测,卡死/死亡自动回收,派新智能体继承任务续跑
|
|
134
|
+
- `security-guard`:固定安全守卫——注入/危险指令检测、异常警报
|
|
135
|
+
3. **确定性合并**:收集全部 worker 回传 → 合并为引擎定义 → 校验 → 发布
|
|
135
136
|
|
|
136
137
|
### 准确率与用户控制
|
|
137
138
|
- **准确率**:合并后引擎定义必须通过确定性校验(引用闭合/公式链/单位/Decimal/无环),0 findings 才发布
|
|
@@ -159,6 +160,11 @@ defaultLocale: zh-CN
|
|
|
159
160
|
- `references/import-ocr.md` —— 导入与 OCR(Excel 映射/图片识别/草稿确认)
|
|
160
161
|
- `references/finance-example.md` —— 经营健康诊断完整范例(50 字段 → 10 指标 → 报告)
|
|
161
162
|
|
|
163
|
+
### Blueprint 协同(可选)
|
|
164
|
+
`brain-handshake` 时可选择 `blueprintEnabled`:生成引擎定义后,先交给 Blueprint 技能规划工具开发蓝图
|
|
165
|
+
(`blueprint-orchestrate` → `https://cli.tax/wvz6zmRWmX`,operation `compile-inline`),
|
|
166
|
+
再回到蜂群执行开发任务,验收标准全部可追溯。不开启时直接蜂群生成,全程框架一致。
|
|
167
|
+
|
|
162
168
|
## 安全规则
|
|
163
169
|
|
|
164
170
|
- 不执行任意 JavaScript;公式只走受控 AST
|
package/skills/swarm/SKILL.md
CHANGED
|
@@ -39,9 +39,17 @@ description: '通过智能体大脑调度创建 N 个子智能体,用企业级
|
|
|
39
39
|
- 用户需要企业级分工、任务认领回传、进度红绿灯的可观测协作
|
|
40
40
|
- 用户需要自动回收卡死智能体并让继任者继承任务的自治能力
|
|
41
41
|
- 用户需要内置安全守卫(防注入、异常警报)的多智能体系统
|
|
42
|
+
- 用户希望任务先由 Blueprint 技能规划为可追溯蓝图,再交给蜂群执行(可选协同)
|
|
42
43
|
|
|
43
44
|
不要用于:单智能体就能完成的简单任务(用单 agent 即可);与任务编排无关的纯计算。
|
|
44
45
|
|
|
46
|
+
## Blueprint 协同(可选)
|
|
47
|
+
|
|
48
|
+
intake 时可选择 `blueprintEnabled`:任务先交给 Blueprint 技能规划为可追溯的工程蓝图
|
|
49
|
+
(结构/引用/验收全部闭合),再回到蜂群派单执行。开启后 org-chart 的下一步是 `blueprint-bridge`,
|
|
50
|
+
由它生成 blueprint 请求负载(`https://cli.tax/wvz6zmRWmX`,operation `compile-inline`),
|
|
51
|
+
拿到蓝图后继续 `dispatch → claim → report`,红绿灯与运维/安全守卫保持不变。
|
|
52
|
+
|
|
45
53
|
## 核心原则
|
|
46
54
|
|
|
47
55
|
1. **组织即规则**:协作结构 = 企业级组织架构(决策/管理/执行三层),派单、审批、汇报都遵循层级规则。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// swarm runtime v0.
|
|
1
|
+
// swarm runtime v0.2.0 — 智能体蜂群编排的确定性运行时(可选 Blueprint 协同规划)
|
|
2
2
|
// 自包含、无外部依赖。通过组织架构规则调度 N 个子智能体,
|
|
3
3
|
// 围绕项目 JSON 完成 派单/认领/回传,红绿灯状态 + 进度/错误汇报,
|
|
4
4
|
// 固定 运维智能体(心跳/回收/接替/继承)与 安全守卫智能体(注入/危险指令检测)。
|
|
@@ -8,10 +8,10 @@ const ERROR_SCHEMA = "swarm.skill.error/1.0";
|
|
|
8
8
|
const ORG_SCHEMA = "swarm.org-chart/1.0";
|
|
9
9
|
const TASK_SCHEMA = "swarm.tasks/1.0";
|
|
10
10
|
const COMPILER_NAME = "swarm";
|
|
11
|
-
const COMPILER_VERSION = "0.
|
|
11
|
+
const COMPILER_VERSION = "0.2.0";
|
|
12
12
|
|
|
13
13
|
const PURE_OPERATIONS = new Set([
|
|
14
|
-
"capabilities", "help", "intake", "org-chart", "dispatch", "claim",
|
|
14
|
+
"capabilities", "help", "intake", "org-chart", "blueprint-bridge", "dispatch", "claim",
|
|
15
15
|
"report", "swarm-status", "traffic-light", "security-check", "validate-json",
|
|
16
16
|
]);
|
|
17
17
|
|
|
@@ -367,13 +367,20 @@ const INTAKE_QUESTIONS = [
|
|
|
367
367
|
required: false,
|
|
368
368
|
example: "strict",
|
|
369
369
|
},
|
|
370
|
+
{
|
|
371
|
+
id: "blueprintEnabled",
|
|
372
|
+
prompt: "Use Blueprint to plan tasks before dispatch? (yes: tasks are planned by the Blueprint skill for traceable acceptance; no: direct dispatch)",
|
|
373
|
+
required: false,
|
|
374
|
+
example: "no",
|
|
375
|
+
},
|
|
370
376
|
];
|
|
371
377
|
|
|
372
378
|
const OPERATION_CATALOG = Object.freeze([
|
|
373
379
|
{ operation: "capabilities", summary: "Discover swarm capabilities and operations.", input: {}, example: { schemaVersion: REQUEST_SCHEMA, requestId: "demo-1", operation: "capabilities", input: {} } },
|
|
374
380
|
{ operation: "help", summary: "Return the usage guide and operation catalog.", input: {}, example: { schemaVersion: REQUEST_SCHEMA, requestId: "demo-2", operation: "help", input: {} } },
|
|
375
381
|
{ operation: "intake", summary: "Return the intake questions before orchestrating a swarm.", input: {}, example: { schemaVersion: REQUEST_SCHEMA, requestId: "demo-3", operation: "intake", input: {} } },
|
|
376
|
-
{ operation: "org-chart", summary: "Build the enterprise org-chart (board/management/execution).", input: { workerCount: "number of workers", projectName: "string" }, example: { schemaVersion: REQUEST_SCHEMA, requestId: "demo-4", operation: "org-chart", input: { workerCount: 6 } } },
|
|
382
|
+
{ operation: "org-chart", summary: "Build the enterprise org-chart (board/management/execution).", input: { workerCount: "number of workers", projectName: "string", blueprintEnabled: "use Blueprint to plan tasks" }, example: { schemaVersion: REQUEST_SCHEMA, requestId: "demo-4", operation: "org-chart", input: { workerCount: 6, blueprintEnabled: false } } },
|
|
383
|
+
{ operation: "blueprint-bridge", summary: "Plan project JSON into a traceable blueprint, then dispatch its tasks to the swarm.", input: { projectName: "string", tasks: "task array" }, example: { schemaVersion: REQUEST_SCHEMA, requestId: "demo-4b", operation: "blueprint-bridge", input: { projectName: "swarm-run", tasks: [] } } },
|
|
377
384
|
{ operation: "dispatch", summary: "Dispatch a backlog task to a worker.", input: { tasks: "task array", taskId: "string", workerId: "string", actorRole: "dispatcher|board" }, example: { schemaVersion: REQUEST_SCHEMA, requestId: "demo-5", operation: "dispatch", input: { tasks: [], taskId: "task-0001", workerId: "worker-001", actorRole: "dispatcher" } } },
|
|
378
385
|
{ operation: "claim", summary: "Worker claims an assigned task.", input: { tasks: "task array", taskId: "string", workerId: "string" }, example: { schemaVersion: REQUEST_SCHEMA, requestId: "demo-6", operation: "claim", input: { tasks: [], taskId: "task-0001", workerId: "worker-001" } } },
|
|
379
386
|
{ operation: "report", summary: "Worker reports a result back.", input: { tasks: "task array", taskId: "string", workerId: "string", report: "object" }, example: { schemaVersion: REQUEST_SCHEMA, requestId: "demo-7", operation: "report", input: { tasks: [], taskId: "task-0001", workerId: "worker-001", report: { output: "done" } } } },
|
|
@@ -428,7 +435,7 @@ export async function run(request) {
|
|
|
428
435
|
if (operation === "intake") {
|
|
429
436
|
return okResponse(requestId, {
|
|
430
437
|
questions: INTAKE_QUESTIONS,
|
|
431
|
-
nextStep: { operation: "org-chart", instruction: "Turn the answers into an org-chart, then dispatch the project tasks." },
|
|
438
|
+
nextStep: { operation: "org-chart", instruction: "Turn the answers into an org-chart; optionally plan tasks with Blueprint (input.blueprintEnabled), then dispatch the project tasks." },
|
|
432
439
|
});
|
|
433
440
|
}
|
|
434
441
|
|
|
@@ -436,11 +443,60 @@ export async function run(request) {
|
|
|
436
443
|
const org = buildOrgChart(input);
|
|
437
444
|
const findings = validateOrgChart(org);
|
|
438
445
|
if (findings.length) return blockedResponse(requestId, request, findings);
|
|
446
|
+
const blueprintEnabled = input.blueprintEnabled === true || text(input.blueprintEnabled).toLowerCase() === "yes";
|
|
439
447
|
return okResponse(requestId, {
|
|
440
448
|
org,
|
|
449
|
+
blueprintEnabled,
|
|
441
450
|
fixedAgents: ["board", "dispatcher", "ops", "security-guard"],
|
|
442
451
|
workerCount: org.layers.execution.length,
|
|
443
|
-
nextStep:
|
|
452
|
+
nextStep: blueprintEnabled
|
|
453
|
+
? { operation: "blueprint-bridge", instruction: "Blueprint is enabled: call blueprint-bridge to plan the project JSON into a traceable blueprint, then dispatch its tasks to the swarm." }
|
|
454
|
+
: { operation: "dispatch", instruction: "Feed the project JSON; dispatch backlog tasks to workers by dependency order." },
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// blueprint 协同桥:把项目 JSON 转为 blueprint 请求(与 calctool 的 blueprint-orchestrate 对称)。
|
|
459
|
+
// 用户选择 blueprintEnabled 后调用,由 blueprint 技能规划可追溯任务,再回到 swarm 派单执行。
|
|
460
|
+
if (operation === "blueprint-bridge") {
|
|
461
|
+
const projectName = text(input.projectName || "swarm-run");
|
|
462
|
+
const tasks = Array.isArray(input.tasks) ? input.tasks : [];
|
|
463
|
+
const blueprintRequest = {
|
|
464
|
+
schemaVersion: REQUEST_SCHEMA,
|
|
465
|
+
requestId: text(input.requestId || "swarm-bp-1"),
|
|
466
|
+
operation: "blueprint-bridge",
|
|
467
|
+
input: {
|
|
468
|
+
schemaVersion: "blueprint.skill.request/1.0",
|
|
469
|
+
operation: "compile-inline",
|
|
470
|
+
input: {
|
|
471
|
+
goal: projectName,
|
|
472
|
+
blueprint: {
|
|
473
|
+
schemaVersion: "blueprint.ir/1.0",
|
|
474
|
+
blueprintId: `swarm-${projectName}`,
|
|
475
|
+
requirements: [
|
|
476
|
+
{ id: "fact-goal", status: "confirmed", statement: `蜂群目标:${projectName}` },
|
|
477
|
+
{ id: "fact-tasks", status: "confirmed", statement: `任务清单:${tasks.length} 项` },
|
|
478
|
+
],
|
|
479
|
+
modules: [],
|
|
480
|
+
nodes: tasks.map((task, index) => ({
|
|
481
|
+
id: `task-${index + 1}`,
|
|
482
|
+
moduleId: "swarm-tasks",
|
|
483
|
+
title: text(task.title || task.taskId || `任务 ${index + 1}`),
|
|
484
|
+
inputs: [],
|
|
485
|
+
outputs: [{ name: "done", exposed: true }],
|
|
486
|
+
requirementRefs: ["fact-goal", "fact-tasks"],
|
|
487
|
+
})),
|
|
488
|
+
edges: [],
|
|
489
|
+
acceptance: tasks.map((task, index) => ({ id: `acc-${index + 1}`, text: `任务 ${index + 1} 回传并被验收`, nodeRef: `task-${index + 1}` })),
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
return okResponse(requestId, {
|
|
495
|
+
status: "planned",
|
|
496
|
+
blueprintEnabled: true,
|
|
497
|
+
blueprintEndpoint: "https://cli.tax/wvz6zmRWmX",
|
|
498
|
+
blueprintRequest,
|
|
499
|
+
nextStep: { operation: "dispatch", instruction: "POST the blueprintRequest to https://cli.tax/wvz6zmRWmX (operation compile-inline) to get the traceable blueprint, then dispatch its tasks to the swarm workers." },
|
|
444
500
|
});
|
|
445
501
|
}
|
|
446
502
|
|
package/README.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# cli-swarm
|
|
2
|
-
|
|
3
|
-
**智能体蜂群编排 skill 多 IDE 安装器** —— 大脑调度 N 个子智能体,企业级组织架构规则 + 项目 JSON 任务派单/认领/回传 + 红绿灯状态 + 固定运维(心跳/回收/接替/继承)与安全守卫(注入检测/警报)。
|
|
4
|
-
|
|
5
|
-
- **CLI.Tax 源**: `https://cli.tax/zj7fTPVh4p`(`swarm.skill.request/1.0`)
|
|
6
|
-
- **多 IDE 安装器**: 检测本机已装 IDE(Codex/DSH/Claude/Cursor/…),把 skill 分发到各 IDE 用户级根
|
|
7
|
-
- **更新感知**: 每次 install 对比 cli.tax 最新版本并提示 ⤴;`check` 子命令主动检查
|
|
8
|
-
|
|
9
|
-
## 一键安装(npm)
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npx cli-swarm@latest install
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
自动完成:从 cli.tax 拉取 swarm + blueprint + calctool → 检测本机已装 IDE → 分发到每个 IDE。
|
|
16
|
-
更新:同一命令(`@latest` 自动拉新版),且每次 install 会对比 cli.tax 最新版本并提示 ⤴。
|
|
17
|
-
|
|
18
|
-
## 从本仓库安装
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
git clone https://github.com/88208555/swarm.git
|
|
22
|
-
cd swarm
|
|
23
|
-
node install.mjs install # 自动检测本机已装 IDE 并分发
|
|
24
|
-
node install.mjs check # 检查已安装 skill 是否有新版本
|
|
25
|
-
node install.mjs update # 幂等覆盖更新
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## 更新感知(check)
|
|
29
|
-
|
|
30
|
-
安装器写入 `install-meta.json`(来源/版本/时间)到每个 skill 目录;SKILL.md 注入版本横幅,
|
|
31
|
-
IDE 每次读取即可见版本与更新入口。主动检查:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
node install.mjs check # 遍历本机已装 IDE,对比 cli.tax 最新版本
|
|
35
|
-
npx cli-swarm@latest check # 单包检查
|
|
36
|
-
```
|