@bolloon/bolloon-agent 0.3.51 → 0.4.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/README.md +135 -135
- package/bin/bolloon-cli.cjs +183 -183
- package/bin/bolloon.cjs +0 -0
- package/bin/bolloon.js +157 -0
- package/dist/agents/constraint-layer.js +19 -19
- package/dist/agents/judgment-protocol.js +14 -14
- package/dist/agents/loop-review.js +21 -0
- package/dist/agents/pi-sdk-tools.js +86 -2
- package/dist/agents/pi-sdk-types.js +12 -12
- package/dist/agents/pi-sdk.js +90 -90
- package/dist/agents/shell-guard.js +22 -1
- package/dist/agents/skill-organizer.js +19 -19
- package/dist/agents/verify-recipe.js +84 -0
- package/dist/agents/workflow-pivot-loop.js +101 -13
- package/dist/bollharness/src/scripts/deploy-guard.js +8 -8
- package/dist/bollharness-integration/context-router-judgment.js +4 -4
- package/dist/bollharness-integration/context-router.js +292 -292
- package/dist/bollharness-integration/gate-state-machine.js +13 -13
- package/dist/bollharness-integration/llm-judgment-engine.js +134 -134
- package/dist/bollharness-integration/skill-adapter.js +21 -21
- package/dist/bootstrap/chat-archiver.js +14 -14
- package/dist/bootstrap/context-os.js +50 -40
- package/dist/bootstrap/memory-compressor.js +13 -13
- package/dist/cli-entry.js +36 -36
- package/dist/context-compaction/auto-compact.js +7 -7
- package/dist/electron/first-run.js +54 -54
- package/dist/electron-build/electron/first-run.js +54 -54
- package/dist/electron-preload.js.map +1 -1
- package/dist/electron.js.map +1 -1
- package/dist/external-engines/delegate-handle.js +70 -0
- package/dist/external-engines/delegate.js +24 -3
- package/dist/index.js +112 -112
- package/dist/llm/error-lessons.js +53 -0
- package/dist/llm/llm-judgment-client.js +102 -102
- package/dist/llm/pi-ai.js +61 -48
- package/dist/llm/system-prompt/layers/channel/human-async.md +41 -41
- package/dist/llm/system-prompt/layers/channel/local.md +14 -14
- package/dist/llm/system-prompt/layers/channel/p2p-agent.md +18 -18
- package/dist/llm/system-prompt/layers/channel/p2p-peer-sync.md +51 -51
- package/dist/llm/system-prompt/layers/channel/p2p-proactive.md +43 -43
- package/dist/llm/system-prompt/layers/channel/p2p-visitor.md +19 -19
- package/dist/llm/system-prompt/layers/channel/session-handoff.md +61 -61
- package/dist/llm/system-prompt/layers/core/artifacts_storage.md +89 -89
- package/dist/llm/system-prompt/layers/core/evenhandedness.md +21 -21
- package/dist/llm/system-prompt/layers/core/external-engagement.md +73 -73
- package/dist/llm/system-prompt/layers/core/hibs_reminders.md +15 -15
- package/dist/llm/system-prompt/layers/core/identity.md +48 -48
- package/dist/llm/system-prompt/layers/core/knowledge.md +17 -17
- package/dist/llm/system-prompt/layers/core/memory_system.md +12 -12
- package/dist/llm/system-prompt/layers/core/network_filesystem.md +28 -28
- package/dist/llm/system-prompt/layers/core/refusal.md +37 -37
- package/dist/llm/system-prompt/layers/core/tone.md +31 -31
- package/dist/llm/system-prompt/layers/core/tools.thin.md +13 -13
- package/dist/llm/system-prompt/layers/core/wellbeing.md +41 -41
- package/dist/llm/system-prompt/layers/role/architect.md +20 -20
- package/dist/llm/system-prompt/layers/role/expert.md +19 -19
- package/dist/llm/system-prompt/layers/role/implementer.md +15 -15
- package/dist/llm/system-prompt/layers/role/security.md +15 -15
- package/dist/llm/system-prompt/layers/tool/artifacts.md +72 -72
- package/dist/llm/system-prompt/layers/tool/bash.md +25 -25
- package/dist/llm/system-prompt/layers/tool/goal_handoff.md +77 -77
- package/dist/llm/system-prompt/layers/tool/hibs_api.md +171 -171
- package/dist/llm/system-prompt/layers/tool/image_search.md +70 -70
- package/dist/llm/system-prompt/layers/tool/manifest.md +89 -89
- package/dist/llm/system-prompt/layers/tool/mcp_apps.md +53 -53
- package/dist/llm/system-prompt/layers/tool/p2p_request.md +61 -61
- package/dist/llm/system-prompt/layers/tool/web_search.md +83 -83
- package/dist/llm/system-prompt/registry.js +9 -1
- package/dist/llm/tool-manifest/ask_user_input.js +1 -1
- package/dist/llm/tool-manifest/bash.js +3 -3
- package/dist/llm/tool-manifest/create_file.js +4 -4
- package/dist/llm/tool-manifest/fetch_sports_data.js +3 -3
- package/dist/llm/tool-manifest/image_search.js +2 -2
- package/dist/llm/tool-manifest/index.js +0 -59
- package/dist/llm/tool-manifest/mcp.js +2 -2
- package/dist/llm/tool-manifest/message_compose.js +3 -3
- package/dist/llm/tool-manifest/places.js +2 -2
- package/dist/llm/tool-manifest/present_files.js +1 -1
- package/dist/llm/tool-manifest/recipe.js +2 -2
- package/dist/llm/tool-manifest/str_replace.js +5 -5
- package/dist/llm/tool-manifest/view.js +3 -3
- package/dist/llm/tool-manifest/weather.js +4 -4
- package/dist/llm/tool-manifest/web.js +4 -4
- package/dist/locales/en.js +28 -0
- package/dist/locales/zh.js +26 -0
- package/dist/pi-ecosystem-colony/index.js +365 -0
- package/dist/pi-ecosystem-judgment/causal-judge.js +51 -51
- package/dist/pi-ecosystem-judgment/distill-prompt.js +42 -42
- package/dist/pi-ecosystem-judgment/distillation.js +14 -14
- package/dist/pi-ecosystem-judgment/monitor-gate.js +28 -28
- package/dist/pi-ecosystem-judgment/value-injection.js +102 -102
- package/dist/security/context-router-tool.js +15 -15
- package/dist/social/ant-colony/AdaptiveHeartbeat.js +101 -0
- package/dist/social/ant-colony/PheromoneEngine.js +227 -0
- package/dist/social/ant-colony/index.js +6 -0
- package/dist/social/ant-colony/types.js +24 -0
- package/dist/storage/trajectory.js +101 -0
- package/dist/test/ai-judgment-test.js +80 -0
- package/dist/test/bollharness-integration.test.js +318 -0
- package/dist/test/channel-agent-multi-dialogue.js +205 -0
- package/dist/test/channel-heartbeat-agent-test.js +201 -0
- package/dist/test/constraint-layer.test.js +164 -0
- package/dist/test/diap-identity-test.js +172 -0
- package/dist/test/diap-quick-test.js +62 -0
- package/dist/test/global-shared-context.test.js +315 -0
- package/dist/test/harness-judgment-injection.test.js +246 -0
- package/dist/test/harness-workflow-integrator-test.js +228 -0
- package/dist/test/human-value-store.test.js +243 -0
- package/dist/test/hybrid-integration-test.js +118 -0
- package/dist/test/hybrid-messenger-verify.js +55 -0
- package/dist/test/iroh-bistream-debug.js +38 -0
- package/dist/test/iroh-communication.test.js +66 -0
- package/dist/test/iroh-debug-test.js +57 -0
- package/dist/test/iroh-diap-test.js +71 -0
- package/dist/test/iroh-direct-connect.js +55 -0
- package/dist/test/iroh-e2e-fixed.js +89 -0
- package/dist/test/iroh-e2e-same-process.js +63 -0
- package/dist/test/iroh-e2e.js +66 -0
- package/dist/test/iroh-final-e2e.js +72 -0
- package/dist/test/iroh-relay-test.js +37 -0
- package/dist/test/iroh-simple-test.js +41 -0
- package/dist/test/iroh-transport-verify.js +54 -0
- package/dist/test/iroh-transport.test.js +37 -0
- package/dist/test/iroh-two-nodes.js +70 -0
- package/dist/test/iroh-verify.js +44 -0
- package/dist/test/judgment-decision.test.js +219 -0
- package/dist/test/llm-judgment-integration.test.js +220 -0
- package/dist/test/p2p-agent-complex-dialogue.js +385 -0
- package/dist/test/p2p-agent-dialogue.js +341 -0
- package/dist/test/p2p-agent-full-bidirectional.js +510 -0
- package/dist/test/p2p-agent-harness-flow.js +437 -0
- package/dist/test/p2p-agent-harness-single.js +143 -0
- package/dist/test/p2p-ai-dialogue-test.js +318 -0
- package/dist/test/p2p-cid-connect-test.js +195 -0
- package/dist/test/p2p-connect-receiver.js +69 -0
- package/dist/test/p2p-doc-transfer.js +110 -0
- package/dist/test/p2p-identity-page-test.js +77 -0
- package/dist/test/p2p-iroh-test.js +171 -0
- package/dist/test/p2p-minimal-test.js +241 -0
- package/dist/test/p2p-node-1.js +148 -0
- package/dist/test/p2p-node-2.js +148 -0
- package/dist/test/p2p-server.js +281 -0
- package/dist/test/p2p-two-nodes-test.js +438 -0
- package/dist/test/pi-sdk.test.js +44 -0
- package/dist/test/set-persona.js +40 -0
- package/dist/test/simple.test.js +9 -0
- package/dist/test/storage-integration.test.js +150 -0
- package/dist/test/subagent-manager.test.js +276 -0
- package/dist/test/test-gate-flow.test.js +81 -0
- package/dist/test/workflow-engine.test.js +87 -0
- package/dist/test/workflow-pivot-loop.test.js +246 -0
- package/dist/web/api-config.html +779 -779
- package/dist/web/client-hearth.js +10 -10
- package/dist/web/client.js +54 -0
- package/dist/web/components/wallet-viem.mjs +118 -118
- package/dist/web/delivery-ledger.js +103 -0
- package/dist/web/i18n.js +104 -0
- package/dist/web/index.html +472 -472
- package/dist/web/manifest.json +20 -20
- package/dist/web/routes-tasks.js +242 -24
- package/dist/web/server-storage.js +111 -0
- package/dist/web/server.js +55 -26
- package/dist/web/style.css +4946 -4946
- package/dist/web/task-breaker.js +18 -0
- package/dist/web/task-cancel.js +35 -0
- package/dist/web/task-deps.js +36 -0
- package/dist/web/task-review.js +27 -0
- package/dist/web/task-verify.js +60 -0
- package/package.json +196 -193
- package/scripts/build-cli.js +215 -215
- package/scripts/build-web.ts +130 -130
- package/scripts/postinstall.js +152 -152
- package/bin/bolloon-daemon.sh +0 -207
- package/dist/constraint-runtime/reference_data/archive_surface_snapshot.json +0 -63
- package/dist/constraint-runtime/reference_data/commands_snapshot.json +0 -1037
- package/dist/constraint-runtime/reference_data/subsystems/assistant.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/bootstrap.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/bridge.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/buddy.json +0 -13
- package/dist/constraint-runtime/reference_data/subsystems/cli.json +0 -26
- package/dist/constraint-runtime/reference_data/subsystems/components.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/constants.json +0 -28
- package/dist/constraint-runtime/reference_data/subsystems/coordinator.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/entrypoints.json +0 -15
- package/dist/constraint-runtime/reference_data/subsystems/hooks.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/keybindings.json +0 -21
- package/dist/constraint-runtime/reference_data/subsystems/memdir.json +0 -15
- package/dist/constraint-runtime/reference_data/subsystems/migrations.json +0 -18
- package/dist/constraint-runtime/reference_data/subsystems/moreright.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/native_ts.json +0 -11
- package/dist/constraint-runtime/reference_data/subsystems/outputStyles.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/plugins.json +0 -9
- package/dist/constraint-runtime/reference_data/subsystems/remote.json +0 -11
- package/dist/constraint-runtime/reference_data/subsystems/schemas.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/screens.json +0 -10
- package/dist/constraint-runtime/reference_data/subsystems/server.json +0 -10
- package/dist/constraint-runtime/reference_data/subsystems/services.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/skills.json +0 -27
- package/dist/constraint-runtime/reference_data/subsystems/state.json +0 -13
- package/dist/constraint-runtime/reference_data/subsystems/types.json +0 -18
- package/dist/constraint-runtime/reference_data/subsystems/upstreamproxy.json +0 -9
- package/dist/constraint-runtime/reference_data/subsystems/utils.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/vim.json +0 -12
- package/dist/constraint-runtime/reference_data/subsystems/voice.json +0 -8
- package/dist/constraint-runtime/reference_data/tools_snapshot.json +0 -922
- package/dist/electron/config.js.map +0 -1
- package/dist/electron/dialogs.js.map +0 -1
- package/dist/electron/first-run.js.map +0 -1
- package/dist/electron/ipc.js.map +0 -1
- package/dist/electron/logger.js.map +0 -1
- package/dist/electron/main.js.map +0 -1
- package/dist/electron/menu.js.map +0 -1
- package/dist/electron/paths.js.map +0 -1
- package/dist/electron/server.js.map +0 -1
- package/dist/electron/tray.js.map +0 -1
- package/dist/electron/window.js.map +0 -1
- package/dist/utils/auto-update.js.map +0 -1
- package/dist/web/client.js.map +0 -7
|
@@ -19,101 +19,101 @@ import { getPiSDKConfig } from '../llm/config-store.js';
|
|
|
19
19
|
/**
|
|
20
20
|
* 判断用的 Prompt 模板(可以从 YAML 加载)
|
|
21
21
|
*/
|
|
22
|
-
export const JUDGMENT_PROMPT_TEMPLATE = `你是一个专业的 AI 任务分析专家。你的职责是深入理解用户的问题,并给出精准的判断。
|
|
23
|
-
|
|
24
|
-
【输入】
|
|
25
|
-
{user_input}
|
|
26
|
-
|
|
27
|
-
【历史上下文】
|
|
28
|
-
{history_context}
|
|
29
|
-
|
|
30
|
-
请分析以上输入,回答以下问题:
|
|
31
|
-
|
|
32
|
-
## 1. 问题理解
|
|
33
|
-
|
|
34
|
-
**问题本质**:用户真正想要什么?这是什么类型的问题?
|
|
35
|
-
- how-to: 寻求操作指导
|
|
36
|
-
- why: 寻求解释
|
|
37
|
-
- what: 寻求定义
|
|
38
|
-
- should: 寻求建议
|
|
39
|
-
- feasibility: 寻求可行性评估
|
|
40
|
-
|
|
41
|
-
**核心需求**:用户最想要的结果是什么?
|
|
42
|
-
|
|
43
|
-
**隐含信息**:有什么用户没有明确说但需要考虑的因素?
|
|
44
|
-
- 时间压力?
|
|
45
|
-
- 质量要求?
|
|
46
|
-
- 风险限制?
|
|
47
|
-
- 团队协作?
|
|
48
|
-
|
|
49
|
-
## 2. 复杂性评估
|
|
50
|
-
|
|
51
|
-
**复杂性等级**:这个问题有多复杂?
|
|
52
|
-
- simple: 简单任务,直接可答
|
|
53
|
-
- moderate: 中等复杂,需要一定思考
|
|
54
|
-
- complex: 复杂问题,需要深入分析
|
|
55
|
-
- profound: 深刻问题,需要本质性思考
|
|
56
|
-
|
|
57
|
-
**评估理由**:为什么认为这是这个复杂性等级?
|
|
58
|
-
|
|
59
|
-
**深度**:需要多深的理解?
|
|
60
|
-
- surface: 表面理解即可
|
|
61
|
-
- deeper: 需要分析
|
|
62
|
-
- fundamental: 需要本质性思考
|
|
63
|
-
|
|
64
|
-
## 3. 处理决策
|
|
65
|
-
|
|
66
|
-
**推荐方式**:
|
|
67
|
-
- answer: 直接回答
|
|
68
|
-
- analyze: 深入分析
|
|
69
|
-
- design: 设计方案
|
|
70
|
-
- implement: 实现代码
|
|
71
|
-
- coordinate: 协调多智能体
|
|
72
|
-
|
|
73
|
-
**决策理由**:为什么推荐这个处理方式?
|
|
74
|
-
|
|
75
|
-
## 4. 路由决策
|
|
76
|
-
|
|
77
|
-
**应该调用的 Skills**(可选多个):
|
|
78
|
-
- arch: 架构设计
|
|
79
|
-
- harness-dev: 开发实现
|
|
80
|
-
- guardian-fixer: 代码审查
|
|
81
|
-
- harness-eng: 工程协调
|
|
82
|
-
- harness-eng-test: 测试工程
|
|
83
|
-
- task-arch: 任务分解
|
|
84
|
-
- crystal-learn: 反思学习
|
|
85
|
-
|
|
86
|
-
**参与智能体**(可选):
|
|
87
|
-
- architect: 架构师
|
|
88
|
-
- developer: 开发者
|
|
89
|
-
- reviewer: 审查员
|
|
90
|
-
- coordinator: 协调者
|
|
91
|
-
|
|
92
|
-
**协作模式**:
|
|
93
|
-
- solo: 单独处理
|
|
94
|
-
- pair: 配对协作
|
|
95
|
-
- team: 团队协作
|
|
96
|
-
|
|
97
|
-
## 5. 产出要求
|
|
98
|
-
|
|
99
|
-
**需要的产物**:
|
|
100
|
-
- 问题分析
|
|
101
|
-
- 方案设计
|
|
102
|
-
- 代码实现
|
|
103
|
-
- 测试用例
|
|
104
|
-
- 其他
|
|
105
|
-
|
|
106
|
-
**Gate 建议**(如果有):
|
|
107
|
-
- Gate 0: 问题锁定
|
|
108
|
-
- Gate 1: 架构设计
|
|
109
|
-
- Gate 2: 架构审查
|
|
110
|
-
- Gate 3: 计划制定
|
|
111
|
-
- Gate 4: 计划审查
|
|
112
|
-
- Gate 5: 任务分解
|
|
113
|
-
- Gate 6: 任务审查
|
|
114
|
-
- Gate 7: 代码实现
|
|
115
|
-
- Gate 8: 测试验证
|
|
116
|
-
|
|
22
|
+
export const JUDGMENT_PROMPT_TEMPLATE = `你是一个专业的 AI 任务分析专家。你的职责是深入理解用户的问题,并给出精准的判断。
|
|
23
|
+
|
|
24
|
+
【输入】
|
|
25
|
+
{user_input}
|
|
26
|
+
|
|
27
|
+
【历史上下文】
|
|
28
|
+
{history_context}
|
|
29
|
+
|
|
30
|
+
请分析以上输入,回答以下问题:
|
|
31
|
+
|
|
32
|
+
## 1. 问题理解
|
|
33
|
+
|
|
34
|
+
**问题本质**:用户真正想要什么?这是什么类型的问题?
|
|
35
|
+
- how-to: 寻求操作指导
|
|
36
|
+
- why: 寻求解释
|
|
37
|
+
- what: 寻求定义
|
|
38
|
+
- should: 寻求建议
|
|
39
|
+
- feasibility: 寻求可行性评估
|
|
40
|
+
|
|
41
|
+
**核心需求**:用户最想要的结果是什么?
|
|
42
|
+
|
|
43
|
+
**隐含信息**:有什么用户没有明确说但需要考虑的因素?
|
|
44
|
+
- 时间压力?
|
|
45
|
+
- 质量要求?
|
|
46
|
+
- 风险限制?
|
|
47
|
+
- 团队协作?
|
|
48
|
+
|
|
49
|
+
## 2. 复杂性评估
|
|
50
|
+
|
|
51
|
+
**复杂性等级**:这个问题有多复杂?
|
|
52
|
+
- simple: 简单任务,直接可答
|
|
53
|
+
- moderate: 中等复杂,需要一定思考
|
|
54
|
+
- complex: 复杂问题,需要深入分析
|
|
55
|
+
- profound: 深刻问题,需要本质性思考
|
|
56
|
+
|
|
57
|
+
**评估理由**:为什么认为这是这个复杂性等级?
|
|
58
|
+
|
|
59
|
+
**深度**:需要多深的理解?
|
|
60
|
+
- surface: 表面理解即可
|
|
61
|
+
- deeper: 需要分析
|
|
62
|
+
- fundamental: 需要本质性思考
|
|
63
|
+
|
|
64
|
+
## 3. 处理决策
|
|
65
|
+
|
|
66
|
+
**推荐方式**:
|
|
67
|
+
- answer: 直接回答
|
|
68
|
+
- analyze: 深入分析
|
|
69
|
+
- design: 设计方案
|
|
70
|
+
- implement: 实现代码
|
|
71
|
+
- coordinate: 协调多智能体
|
|
72
|
+
|
|
73
|
+
**决策理由**:为什么推荐这个处理方式?
|
|
74
|
+
|
|
75
|
+
## 4. 路由决策
|
|
76
|
+
|
|
77
|
+
**应该调用的 Skills**(可选多个):
|
|
78
|
+
- arch: 架构设计
|
|
79
|
+
- harness-dev: 开发实现
|
|
80
|
+
- guardian-fixer: 代码审查
|
|
81
|
+
- harness-eng: 工程协调
|
|
82
|
+
- harness-eng-test: 测试工程
|
|
83
|
+
- task-arch: 任务分解
|
|
84
|
+
- crystal-learn: 反思学习
|
|
85
|
+
|
|
86
|
+
**参与智能体**(可选):
|
|
87
|
+
- architect: 架构师
|
|
88
|
+
- developer: 开发者
|
|
89
|
+
- reviewer: 审查员
|
|
90
|
+
- coordinator: 协调者
|
|
91
|
+
|
|
92
|
+
**协作模式**:
|
|
93
|
+
- solo: 单独处理
|
|
94
|
+
- pair: 配对协作
|
|
95
|
+
- team: 团队协作
|
|
96
|
+
|
|
97
|
+
## 5. 产出要求
|
|
98
|
+
|
|
99
|
+
**需要的产物**:
|
|
100
|
+
- 问题分析
|
|
101
|
+
- 方案设计
|
|
102
|
+
- 代码实现
|
|
103
|
+
- 测试用例
|
|
104
|
+
- 其他
|
|
105
|
+
|
|
106
|
+
**Gate 建议**(如果有):
|
|
107
|
+
- Gate 0: 问题锁定
|
|
108
|
+
- Gate 1: 架构设计
|
|
109
|
+
- Gate 2: 架构审查
|
|
110
|
+
- Gate 3: 计划制定
|
|
111
|
+
- Gate 4: 计划审查
|
|
112
|
+
- Gate 5: 任务分解
|
|
113
|
+
- Gate 6: 任务审查
|
|
114
|
+
- Gate 7: 代码实现
|
|
115
|
+
- Gate 8: 测试验证
|
|
116
|
+
|
|
117
117
|
请用 JSON 格式输出分析结果。`;
|
|
118
118
|
/**
|
|
119
119
|
* LLM-native Judgment Engine
|
|
@@ -434,20 +434,20 @@ export const SKILL_PROMPTS = {
|
|
|
434
434
|
arch: {
|
|
435
435
|
name: 'arch',
|
|
436
436
|
description: '架构设计专家',
|
|
437
|
-
systemPrompt: `你是一个经验丰富的系统架构师。你擅长:
|
|
438
|
-
- 从需求中提取本质问题
|
|
439
|
-
- 设计可扩展的系统架构
|
|
440
|
-
- 权衡技术方案
|
|
441
|
-
- 识别架构风险
|
|
442
|
-
|
|
443
|
-
你相信:
|
|
444
|
-
- 本质和实现必须分离
|
|
445
|
-
- 好的架构从简单规则中生长
|
|
437
|
+
systemPrompt: `你是一个经验丰富的系统架构师。你擅长:
|
|
438
|
+
- 从需求中提取本质问题
|
|
439
|
+
- 设计可扩展的系统架构
|
|
440
|
+
- 权衡技术方案
|
|
441
|
+
- 识别架构风险
|
|
442
|
+
|
|
443
|
+
你相信:
|
|
444
|
+
- 本质和实现必须分离
|
|
445
|
+
- 好的架构从简单规则中生长
|
|
446
446
|
- 复杂性应该被控制而非消除`,
|
|
447
|
-
userPromptTemplate: `用户需求:{user_input}
|
|
448
|
-
|
|
449
|
-
{context}
|
|
450
|
-
|
|
447
|
+
userPromptTemplate: `用户需求:{user_input}
|
|
448
|
+
|
|
449
|
+
{context}
|
|
450
|
+
|
|
451
451
|
请进行架构分析:`,
|
|
452
452
|
examples: [
|
|
453
453
|
{
|
|
@@ -460,40 +460,40 @@ export const SKILL_PROMPTS = {
|
|
|
460
460
|
'harness-dev': {
|
|
461
461
|
name: 'harness-dev',
|
|
462
462
|
description: '开发实现专家',
|
|
463
|
-
systemPrompt: `你是一个高效的代码实现专家。你擅长:
|
|
464
|
-
- 快速理解和实现需求
|
|
465
|
-
- 编写清晰、可维护的代码
|
|
466
|
-
- 遵循最佳实践
|
|
467
|
-
- 处理边界情况
|
|
468
|
-
|
|
469
|
-
你相信:
|
|
470
|
-
- 代码即文档
|
|
471
|
-
- 测试是代码的一部分
|
|
463
|
+
systemPrompt: `你是一个高效的代码实现专家。你擅长:
|
|
464
|
+
- 快速理解和实现需求
|
|
465
|
+
- 编写清晰、可维护的代码
|
|
466
|
+
- 遵循最佳实践
|
|
467
|
+
- 处理边界情况
|
|
468
|
+
|
|
469
|
+
你相信:
|
|
470
|
+
- 代码即文档
|
|
471
|
+
- 测试是代码的一部分
|
|
472
472
|
- 简单优于复杂`,
|
|
473
|
-
userPromptTemplate: `任务:{user_input}
|
|
474
|
-
|
|
475
|
-
技术栈:{tech_stack}
|
|
476
|
-
|
|
473
|
+
userPromptTemplate: `任务:{user_input}
|
|
474
|
+
|
|
475
|
+
技术栈:{tech_stack}
|
|
476
|
+
|
|
477
477
|
请实现代码:`,
|
|
478
478
|
outputFormat: 'code'
|
|
479
479
|
},
|
|
480
480
|
'guardian-fixer': {
|
|
481
481
|
name: 'guardian-fixer',
|
|
482
482
|
description: '代码审查专家',
|
|
483
|
-
systemPrompt: `你是一个严格的代码审查专家。你擅长:
|
|
484
|
-
- 发现潜在问题
|
|
485
|
-
- 提出改进建议
|
|
486
|
-
- 确保代码质量
|
|
487
|
-
- 平衡效率和安全性
|
|
488
|
-
|
|
489
|
-
你相信:
|
|
490
|
-
- 细节决定成败
|
|
491
|
-
- 代码审查是质量保障的最后防线
|
|
483
|
+
systemPrompt: `你是一个严格的代码审查专家。你擅长:
|
|
484
|
+
- 发现潜在问题
|
|
485
|
+
- 提出改进建议
|
|
486
|
+
- 确保代码质量
|
|
487
|
+
- 平衡效率和安全性
|
|
488
|
+
|
|
489
|
+
你相信:
|
|
490
|
+
- 细节决定成败
|
|
491
|
+
- 代码审查是质量保障的最后防线
|
|
492
492
|
- 建设性批评比否定更有价值`,
|
|
493
|
-
userPromptTemplate: `代码:\n{code}
|
|
494
|
-
|
|
495
|
-
审查范围:{scope}
|
|
496
|
-
|
|
493
|
+
userPromptTemplate: `代码:\n{code}
|
|
494
|
+
|
|
495
|
+
审查范围:{scope}
|
|
496
|
+
|
|
497
497
|
请进行审查:`,
|
|
498
498
|
outputFormat: 'structured'
|
|
499
499
|
}
|
|
@@ -377,16 +377,16 @@ export class PeerSyncSkill extends BaseSkill {
|
|
|
377
377
|
}
|
|
378
378
|
this.log(`peer-sync 启动: target_id=${targetId}`);
|
|
379
379
|
// 选 peer 的策略由 LLM 决定 (根据 list_peers 输出 + expertise tag)
|
|
380
|
-
return this.callLm(`You are a peer-selection specialist for the bolloon P2P network.
|
|
381
|
-
Given a target_id and task description, output structured JSON with:
|
|
382
|
-
- selectedPeer: DID of the best peer (or null if none suitable)
|
|
383
|
-
- channelName: human-readable name for the new channel
|
|
384
|
-
- initialMessage: first message to send (≤ 200 chars, brief + asks for acceptance)
|
|
385
|
-
- estimatedRounds: expected back-and-forth count (1-10)
|
|
386
|
-
|
|
387
|
-
Rules:
|
|
388
|
-
- Prefer peers with matching expertise tag
|
|
389
|
-
- If no peer matches, return selectedPeer: null
|
|
380
|
+
return this.callLm(`You are a peer-selection specialist for the bolloon P2P network.
|
|
381
|
+
Given a target_id and task description, output structured JSON with:
|
|
382
|
+
- selectedPeer: DID of the best peer (or null if none suitable)
|
|
383
|
+
- channelName: human-readable name for the new channel
|
|
384
|
+
- initialMessage: first message to send (≤ 200 chars, brief + asks for acceptance)
|
|
385
|
+
- estimatedRounds: expected back-and-forth count (1-10)
|
|
386
|
+
|
|
387
|
+
Rules:
|
|
388
|
+
- Prefer peers with matching expertise tag
|
|
389
|
+
- If no peer matches, return selectedPeer: null
|
|
390
390
|
- Don't over-explain — peer agent has same identity layer as you`, `target_id: ${targetId}\ntask: ${task}`);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
@@ -412,17 +412,17 @@ export class HabitDistillSkill extends BaseSkill {
|
|
|
412
412
|
}
|
|
413
413
|
this.log(`habit-distill 启动: session=${sessionKey}`);
|
|
414
414
|
// 抽取习性的 prompt — 让 LLM 输出结构化 JSON
|
|
415
|
-
return this.callLm(`You are a habit-extraction specialist.
|
|
416
|
-
Given a summary of user-assistant interaction, output JSON with:
|
|
417
|
-
- habits: [{ content: string, tags: string[], weight: 'low'|'medium'|'high' }]
|
|
418
|
-
- content: 一个用户偏好/习性的简短描述 (≤ 100 字)
|
|
419
|
-
- tags: 标签如 ['input-style', 'terminology', 'recurring-topic', 'correction']
|
|
420
|
-
- weight: 影响判断力注入门时的优先级
|
|
421
|
-
- skipReason: 若不该蒸馏 (用户拒绝/任务太简单/judgment 库饱和), 填理由
|
|
422
|
-
|
|
423
|
-
Rules:
|
|
424
|
-
- 习性必须是"用户可观察到的稳定模式", 不是单次偏好
|
|
425
|
-
- 隐私相关打 tags 含 'private', 注入门自动过滤
|
|
415
|
+
return this.callLm(`You are a habit-extraction specialist.
|
|
416
|
+
Given a summary of user-assistant interaction, output JSON with:
|
|
417
|
+
- habits: [{ content: string, tags: string[], weight: 'low'|'medium'|'high' }]
|
|
418
|
+
- content: 一个用户偏好/习性的简短描述 (≤ 100 字)
|
|
419
|
+
- tags: 标签如 ['input-style', 'terminology', 'recurring-topic', 'correction']
|
|
420
|
+
- weight: 影响判断力注入门时的优先级
|
|
421
|
+
- skipReason: 若不该蒸馏 (用户拒绝/任务太简单/judgment 库饱和), 填理由
|
|
422
|
+
|
|
423
|
+
Rules:
|
|
424
|
+
- 习性必须是"用户可观察到的稳定模式", 不是单次偏好
|
|
425
|
+
- 隐私相关打 tags 含 'private', 注入门自动过滤
|
|
426
426
|
- 不要重复已有 judgment (调用方负责查重)`, `Session: ${sessionKey}\nMessages summary: ${recentMessagesSummary || '(caller should pass loadMessages output)'}`);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -117,20 +117,20 @@ function templateMonthlySummary(opts) {
|
|
|
117
117
|
const channelSet = new Set(opts.entries.map(e => e.channelName).filter(Boolean));
|
|
118
118
|
const sampleUser = user.slice(0, 5).map(e => ` - [${e.ts}] ${e.text.slice(0, 80)}`).join('\n');
|
|
119
119
|
const sampleAi = ai.slice(0, 5).map(e => ` - [${e.ts}] ${e.text.slice(0, 80)}`).join('\n');
|
|
120
|
-
return `# 月度对话摘要 — ${opts.yearMonth} (peer ${opts.publicKey.slice(0, 12)}…)
|
|
121
|
-
|
|
122
|
-
时间: ${opts.timestamp}
|
|
123
|
-
对话轮次: ${opts.entries.length} (user=${user.length}, ai=${ai.length})
|
|
124
|
-
涉及 channel: ${Array.from(channelSet).slice(0, 10).join(', ') || '(无)'}
|
|
125
|
-
|
|
126
|
-
## 用户关键提问
|
|
127
|
-
${sampleUser || ' (无)'}
|
|
128
|
-
|
|
129
|
-
## AI 关键回答
|
|
130
|
-
${sampleAi || ' (无)'}
|
|
131
|
-
|
|
132
|
-
## 备注
|
|
133
|
-
- 此摘要由模板生成 (LLM 调用失败 fallback)
|
|
120
|
+
return `# 月度对话摘要 — ${opts.yearMonth} (peer ${opts.publicKey.slice(0, 12)}…)
|
|
121
|
+
|
|
122
|
+
时间: ${opts.timestamp}
|
|
123
|
+
对话轮次: ${opts.entries.length} (user=${user.length}, ai=${ai.length})
|
|
124
|
+
涉及 channel: ${Array.from(channelSet).slice(0, 10).join(', ') || '(无)'}
|
|
125
|
+
|
|
126
|
+
## 用户关键提问
|
|
127
|
+
${sampleUser || ' (无)'}
|
|
128
|
+
|
|
129
|
+
## AI 关键回答
|
|
130
|
+
${sampleAi || ' (无)'}
|
|
131
|
+
|
|
132
|
+
## 备注
|
|
133
|
+
- 此摘要由模板生成 (LLM 调用失败 fallback)
|
|
134
134
|
`;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
@@ -25,21 +25,21 @@ import * as fs from 'fs/promises';
|
|
|
25
25
|
import * as os from 'os';
|
|
26
26
|
import * as path from 'path';
|
|
27
27
|
export const CONTEXT_OS_LAYERS = [
|
|
28
|
-
{ key: '01-Me', name: '我是谁', store: '经过验证的原则、不可碰的边界、稳定偏好', notStore: '临时情绪、未经验证的念头', usage: '防止 AI 用错误的方式帮助你' },
|
|
29
|
-
{ key: '02-Network', name: '我认识谁', store: '有真实关系、能力可定位、能在具体问题上调用的人', notStore: '只看过主页的陌生人', usage: '需要咨询、合作、求证时找到正确的人' },
|
|
30
|
-
{ key: '03-Current', name: '我现在在做什么', store: '今天/本周的现实状态、工作现场、阻塞项', notStore: '长期知识、项目历史全文', usage: '防止 AI 按过期状态给建议' },
|
|
31
|
-
{ key: '04-Projects', name: '我正在推进什么', store: '有明确交付、真实进度、可验证证据的项目', notStore: '只有想法的脑暴', usage: '让 AI 按项目真实边界推进' },
|
|
32
|
-
{ key: '05-Prompts', name: '已验证可复用的提示词', store: '至少复用过、效果稳定的 Prompt', notStore: '一次性调试 Prompt', usage: '跨项目、跨工具复用工作方法' },
|
|
33
|
-
{ key: '06-Protocols', name: 'AI 和系统该如何工作', store: '为防止真实错误而产生、被重复调用的规则', notStore: '纯理论流程', usage: '把"知道"变成"每次都会做"' },
|
|
34
|
-
{ key: '07-Knowledge', name: '哪些领域知识未来复用', store: '未来至少三个项目可能复用的领域理解', notStore: '随手可搜的常识', usage: '技术/行业问题的长期积累' },
|
|
35
|
-
{ key: '08-Insights', name: '哪些已验证的判断改变决策', store: '能改变决策、产品方向或自我认知的已验证判断', notStore: '情绪碎片、未经验证的直觉', usage: '防止重复踩同一种坑' },
|
|
36
|
-
{ key: '09-Tools', name: '哪些工具和脚本省时间', store: '实际用过、能节约时间、包含回退方案的工具经验', notStore: '只安装未使用的软件', usage: '提升执行效率,避免重复试错' },
|
|
37
|
-
{ key: '10-Skills', name: '哪些能力可验证交付', store: '可外部验证、能交付、有作品支撑的能力', notStore: '"我想学"的愿望', usage: '简历、分工、能力缺口识别' },
|
|
38
|
-
{ key: '11-Write', name: '哪些写作可复用', store: '可以引用、改写、发布的成熟表达', notStore: '未整理草稿', usage: '保持跨场景表达一致' },
|
|
39
|
-
{ key: '12-Analysis', name: '决策过程与复盘', store: '有推理链、可事后复盘的研究与决策', notStore: '只有结论的事后合理化', usage: '重要决策可追溯、可修正' },
|
|
40
|
-
{ key: 'output', name: '对外交付物', store: '给外部的人看的最终交付物', notStore: '内部草稿', usage: '可直接分享给他人' },
|
|
41
|
-
{ key: 'research', name: '研究中间成果', store: '研究中的中间成果', notStore: '结论已定型的资产', usage: '未完成研究的暂存' },
|
|
42
|
-
{ key: 'tmp', name: '一次性草稿', store: '一次性草稿与临时文件', notStore: '任何未来要复用的东西', usage: '定期清理' },
|
|
28
|
+
{ key: '01-Me', kind: 'stable', name: '我是谁', store: '经过验证的原则、不可碰的边界、稳定偏好', notStore: '临时情绪、未经验证的念头', usage: '防止 AI 用错误的方式帮助你' },
|
|
29
|
+
{ key: '02-Network', kind: 'stable', name: '我认识谁', store: '有真实关系、能力可定位、能在具体问题上调用的人', notStore: '只看过主页的陌生人', usage: '需要咨询、合作、求证时找到正确的人' },
|
|
30
|
+
{ key: '03-Current', kind: 'stable', name: '我现在在做什么', store: '今天/本周的现实状态、工作现场、阻塞项', notStore: '长期知识、项目历史全文', usage: '防止 AI 按过期状态给建议' },
|
|
31
|
+
{ key: '04-Projects', kind: 'stable', name: '我正在推进什么', store: '有明确交付、真实进度、可验证证据的项目', notStore: '只有想法的脑暴', usage: '让 AI 按项目真实边界推进' },
|
|
32
|
+
{ key: '05-Prompts', kind: 'stable', name: '已验证可复用的提示词', store: '至少复用过、效果稳定的 Prompt', notStore: '一次性调试 Prompt', usage: '跨项目、跨工具复用工作方法' },
|
|
33
|
+
{ key: '06-Protocols', kind: 'stable', name: 'AI 和系统该如何工作', store: '为防止真实错误而产生、被重复调用的规则', notStore: '纯理论流程', usage: '把"知道"变成"每次都会做"' },
|
|
34
|
+
{ key: '07-Knowledge', kind: 'stable', name: '哪些领域知识未来复用', store: '未来至少三个项目可能复用的领域理解', notStore: '随手可搜的常识', usage: '技术/行业问题的长期积累' },
|
|
35
|
+
{ key: '08-Insights', kind: 'stable', name: '哪些已验证的判断改变决策', store: '能改变决策、产品方向或自我认知的已验证判断', notStore: '情绪碎片、未经验证的直觉', usage: '防止重复踩同一种坑' },
|
|
36
|
+
{ key: '09-Tools', kind: 'stable', name: '哪些工具和脚本省时间', store: '实际用过、能节约时间、包含回退方案的工具经验', notStore: '只安装未使用的软件', usage: '提升执行效率,避免重复试错' },
|
|
37
|
+
{ key: '10-Skills', kind: 'stable', name: '哪些能力可验证交付', store: '可外部验证、能交付、有作品支撑的能力', notStore: '"我想学"的愿望', usage: '简历、分工、能力缺口识别' },
|
|
38
|
+
{ key: '11-Write', kind: 'stable', name: '哪些写作可复用', store: '可以引用、改写、发布的成熟表达', notStore: '未整理草稿', usage: '保持跨场景表达一致' },
|
|
39
|
+
{ key: '12-Analysis', kind: 'stable', name: '决策过程与复盘', store: '有推理链、可事后复盘的研究与决策', notStore: '只有结论的事后合理化', usage: '重要决策可追溯、可修正' },
|
|
40
|
+
{ key: 'output', kind: 'work', name: '对外交付物', store: '给外部的人看的最终交付物', notStore: '内部草稿', usage: '可直接分享给他人' },
|
|
41
|
+
{ key: 'research', kind: 'work', name: '研究中间成果', store: '研究中的中间成果', notStore: '结论已定型的资产', usage: '未完成研究的暂存' },
|
|
42
|
+
{ key: 'tmp', kind: 'scratch', name: '一次性草稿', store: '一次性草稿与临时文件', notStore: '任何未来要复用的东西', usage: '定期清理' },
|
|
43
43
|
];
|
|
44
44
|
const LAYER_KEYS = new Set(CONTEXT_OS_LAYERS.map((l) => l.key));
|
|
45
45
|
// ============================================================
|
|
@@ -72,27 +72,35 @@ function slugify(s) {
|
|
|
72
72
|
// 初始化: 建目录 + 每层 README (幂等)
|
|
73
73
|
// ============================================================
|
|
74
74
|
function layerReadme(l) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
75
|
+
const kindNote = {
|
|
76
|
+
stable: '持久原则层 — 跨 session 复用, 不随便删',
|
|
77
|
+
work: '工作成果层 — 有明确生命周期, 交付/定型后归档',
|
|
78
|
+
scratch: '一次性层 — 定期 prune, 不承诺保留',
|
|
79
|
+
}[l.kind];
|
|
80
|
+
return `# ${l.key} — ${l.name}
|
|
81
|
+
|
|
82
|
+
## 工作区类别 (workspace kind)
|
|
83
|
+
${kindNote}
|
|
84
|
+
|
|
85
|
+
## 这一层回答的问题
|
|
86
|
+
${l.name}
|
|
87
|
+
|
|
88
|
+
## 存什么
|
|
89
|
+
${l.store}
|
|
90
|
+
|
|
91
|
+
## 不该存什么
|
|
92
|
+
${l.notStore}
|
|
93
|
+
|
|
94
|
+
## 典型用途
|
|
95
|
+
${l.usage}
|
|
96
|
+
|
|
97
|
+
## 价值判断标准 (Context OS §5)
|
|
98
|
+
写入前先回答: **未来哪个具体场景会用到它?**
|
|
99
|
+
回答不出 = 噪音, 留在 tmp/, 不进正式层.
|
|
100
|
+
|
|
101
|
+
## 价值生命周期
|
|
102
|
+
阶段0 临时价值点 (对话中刚出现, 未验证) → 阶段1 验证 (被使用/确认)
|
|
103
|
+
→ 阶段2 固化 (本层唯一位置) → 阶段3 索引化 (高频引用) → 阶段4 归档/删除.
|
|
96
104
|
`;
|
|
97
105
|
}
|
|
98
106
|
export async function ensureContextOsDirs(home, agentId) {
|
|
@@ -181,7 +189,9 @@ export async function readContextAssets(layer, keyword, home, agentId) {
|
|
|
181
189
|
const raw = await fs.readFile(path.join(getLayerDir(key, home, agentId), f), 'utf-8');
|
|
182
190
|
const titleM = raw.match(/^title:\s*(.+)$/m);
|
|
183
191
|
const createdM = raw.match(/^created:\s*(.+)$/m);
|
|
184
|
-
|
|
192
|
+
// 2026-08-11 (Hermes 全限幅): 标题截断到 80 字符, 防单条超长标题霸占 listing
|
|
193
|
+
const rawTitle = titleM ? titleM[1].trim() : f.replace(/\.md$/, '');
|
|
194
|
+
const title = rawTitle.length > 80 ? rawTitle.slice(0, 80) + '…' : rawTitle;
|
|
185
195
|
if (kw && !(title.toLowerCase().includes(kw) || raw.toLowerCase().includes(kw)))
|
|
186
196
|
continue;
|
|
187
197
|
entries.push({ file: f, title, createdAt: createdM ? createdM[1].trim() : '' });
|
|
@@ -189,10 +199,10 @@ export async function readContextAssets(layer, keyword, home, agentId) {
|
|
|
189
199
|
catch { /* 单文件损坏跳过 */ }
|
|
190
200
|
}
|
|
191
201
|
entries.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
192
|
-
out.push({ layer: key, name: l.name, fileCount: entries.length, files: entries.slice(0, 20) });
|
|
202
|
+
out.push({ layer: key, name: l.name, kind: l.kind, fileCount: entries.length, files: entries.slice(0, 20) });
|
|
193
203
|
}
|
|
194
204
|
catch {
|
|
195
|
-
out.push({ layer: key, name: l.name, fileCount: 0, files: [] });
|
|
205
|
+
out.push({ layer: key, name: l.name, kind: l.kind, fileCount: 0, files: [] });
|
|
196
206
|
}
|
|
197
207
|
}
|
|
198
208
|
return out;
|
|
@@ -217,6 +227,6 @@ export async function readAssetBody(layer, file, home) {
|
|
|
217
227
|
export function formatLayerListing(listings) {
|
|
218
228
|
if (listings.length === 0)
|
|
219
229
|
return '';
|
|
220
|
-
const lines = listings.map((l) => ` - ${l.layer} (${l.name}): ${l.fileCount} 篇` + (l.files.length > 0 ? ` — ${l.files.slice(0, 3).map((f) => f.title).join(' / ')}` : ''));
|
|
230
|
+
const lines = listings.map((l) => ` - ${l.layer} (${l.name})${l.kind ? ` [${l.kind}]` : ''}: ${l.fileCount} 篇` + (l.files.length > 0 ? ` — ${l.files.slice(0, 3).map((f) => f.title).join(' / ')}` : ''));
|
|
221
231
|
return `[系统上下文] 资产层 (Context OS 12+3 层, 先看 03-Current 再按任务路由):\n${lines.join('\n')}\n\n`;
|
|
222
232
|
}
|
|
@@ -94,19 +94,19 @@ function templateSummary(opts) {
|
|
|
94
94
|
const aiMsgs = opts.newMessages.filter(m => m.type === 'ai');
|
|
95
95
|
const userSnippet = userMsgs.slice(0, 3).map(m => ` - ${m.content.slice(0, 80)}`).join('\n');
|
|
96
96
|
const aiSnippet = aiMsgs.slice(0, 3).map(m => ` - ${m.content.slice(0, 80)}`).join('\n');
|
|
97
|
-
return `# Session 摘要 — ${opts.channelId} / ${opts.sessionId}
|
|
98
|
-
|
|
99
|
-
时间: ${opts.timestamp}
|
|
100
|
-
新增消息数: ${opts.newMessages.length} (user=${userMsgs.length}, ai=${aiMsgs.length})
|
|
101
|
-
|
|
102
|
-
## 用户关键提问
|
|
103
|
-
${userSnippet || ' (无)'}
|
|
104
|
-
|
|
105
|
-
## AI 关键回答
|
|
106
|
-
${aiSnippet || ' (无)'}
|
|
107
|
-
|
|
108
|
-
## 备注
|
|
109
|
-
- 此摘要由模板生成 (LLM 调用失败 fallback)
|
|
97
|
+
return `# Session 摘要 — ${opts.channelId} / ${opts.sessionId}
|
|
98
|
+
|
|
99
|
+
时间: ${opts.timestamp}
|
|
100
|
+
新增消息数: ${opts.newMessages.length} (user=${userMsgs.length}, ai=${aiMsgs.length})
|
|
101
|
+
|
|
102
|
+
## 用户关键提问
|
|
103
|
+
${userSnippet || ' (无)'}
|
|
104
|
+
|
|
105
|
+
## AI 关键回答
|
|
106
|
+
${aiSnippet || ' (无)'}
|
|
107
|
+
|
|
108
|
+
## 备注
|
|
109
|
+
- 此摘要由模板生成 (LLM 调用失败 fallback)
|
|
110
110
|
`;
|
|
111
111
|
}
|
|
112
112
|
/**
|
package/dist/cli-entry.js
CHANGED
|
@@ -50,42 +50,42 @@ function printBannerCli() {
|
|
|
50
50
|
printBanner(VERSION);
|
|
51
51
|
}
|
|
52
52
|
function printHelp() {
|
|
53
|
-
console.log(`
|
|
54
|
-
${BOLD}用法:${RESET}
|
|
55
|
-
bolloon [选项] [命令] [参数]
|
|
56
|
-
|
|
57
|
-
${BOLD}选项:${RESET}
|
|
58
|
-
--gui, -g 启动图形界面 (Electron)
|
|
59
|
-
--web, -w 启动 Web UI (浏览器)
|
|
60
|
-
--cli, -c 启动命令行界面
|
|
61
|
-
--version, -v 显示版本信息
|
|
62
|
-
--help, -h 显示帮助信息
|
|
63
|
-
|
|
64
|
-
${BOLD}命令:${RESET}
|
|
65
|
-
bolloon update [--now] 检查更新 / 立即更新 (bolloon update --now)
|
|
66
|
-
bolloon model [name] [model] 列出 / 切换模型供应商 (如: bolloon model deepseek deepseek-v4-flash)
|
|
67
|
-
bolloon read <file> 读取文档
|
|
68
|
-
bolloon summarize <file> 总结文档
|
|
69
|
-
bolloon improve <file> <req> 改进文档
|
|
70
|
-
bolloon engine list 列出外部编码智能体
|
|
71
|
-
bolloon engine run <prompt> 委派任务给智能体
|
|
72
|
-
bolloon x402 fetch <url> x402 自动支付 HTTP 请求
|
|
73
|
-
bolloon x402 balance <address> 查询 x402 钱包余额
|
|
74
|
-
|
|
75
|
-
${BOLD}示例:${RESET}
|
|
76
|
-
bolloon # 启动图形界面
|
|
77
|
-
bolloon --web # 启动 Web UI
|
|
78
|
-
bolloon --cli # 命令行模式
|
|
79
|
-
bolloon model # 查看当前模型供应商
|
|
80
|
-
bolloon model minimax # 切换到 MiniMax
|
|
81
|
-
bolloon update # 检查更新
|
|
82
|
-
bolloon update --now # 立即更新
|
|
83
|
-
|
|
84
|
-
${BOLD}环境变量:${RESET}
|
|
85
|
-
MINIMAX_API_KEY MiniMax API 密钥
|
|
86
|
-
OPENAI_API_KEY OpenAI API 密钥
|
|
87
|
-
ANTHROPIC_API_KEY Anthropic API 密钥
|
|
88
|
-
PORT Web 服务端口 (默认 54188)
|
|
53
|
+
console.log(`
|
|
54
|
+
${BOLD}用法:${RESET}
|
|
55
|
+
bolloon [选项] [命令] [参数]
|
|
56
|
+
|
|
57
|
+
${BOLD}选项:${RESET}
|
|
58
|
+
--gui, -g 启动图形界面 (Electron)
|
|
59
|
+
--web, -w 启动 Web UI (浏览器)
|
|
60
|
+
--cli, -c 启动命令行界面
|
|
61
|
+
--version, -v 显示版本信息
|
|
62
|
+
--help, -h 显示帮助信息
|
|
63
|
+
|
|
64
|
+
${BOLD}命令:${RESET}
|
|
65
|
+
bolloon update [--now] 检查更新 / 立即更新 (bolloon update --now)
|
|
66
|
+
bolloon model [name] [model] 列出 / 切换模型供应商 (如: bolloon model deepseek deepseek-v4-flash)
|
|
67
|
+
bolloon read <file> 读取文档
|
|
68
|
+
bolloon summarize <file> 总结文档
|
|
69
|
+
bolloon improve <file> <req> 改进文档
|
|
70
|
+
bolloon engine list 列出外部编码智能体
|
|
71
|
+
bolloon engine run <prompt> 委派任务给智能体
|
|
72
|
+
bolloon x402 fetch <url> x402 自动支付 HTTP 请求
|
|
73
|
+
bolloon x402 balance <address> 查询 x402 钱包余额
|
|
74
|
+
|
|
75
|
+
${BOLD}示例:${RESET}
|
|
76
|
+
bolloon # 启动图形界面
|
|
77
|
+
bolloon --web # 启动 Web UI
|
|
78
|
+
bolloon --cli # 命令行模式
|
|
79
|
+
bolloon model # 查看当前模型供应商
|
|
80
|
+
bolloon model minimax # 切换到 MiniMax
|
|
81
|
+
bolloon update # 检查更新
|
|
82
|
+
bolloon update --now # 立即更新
|
|
83
|
+
|
|
84
|
+
${BOLD}环境变量:${RESET}
|
|
85
|
+
MINIMAX_API_KEY MiniMax API 密钥
|
|
86
|
+
OPENAI_API_KEY OpenAI API 密钥
|
|
87
|
+
ANTHROPIC_API_KEY Anthropic API 密钥
|
|
88
|
+
PORT Web 服务端口 (默认 54188)
|
|
89
89
|
`);
|
|
90
90
|
}
|
|
91
91
|
function getDistDir() {
|
|
@@ -45,13 +45,13 @@ async function writeCache(scope, key, summary) {
|
|
|
45
45
|
console.warn('[compactor] cache write failed (silent):', err);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
const SUMMARIZE_SYSTEM = `你是一个对话历史压缩助手.
|
|
49
|
-
你的任务: 把给定的对话历史压缩成 1-2 句话的摘要, 保留所有出现过的 tool names.
|
|
50
|
-
要求:
|
|
51
|
-
- 保留所有用户的关键需求
|
|
52
|
-
- 保留所有调用过的 tool names (例如 read_file, shell_exec, use_skill 等)
|
|
53
|
-
- 保留关键决策和发现
|
|
54
|
-
- 不要添加原对话中没有的信息
|
|
48
|
+
const SUMMARIZE_SYSTEM = `你是一个对话历史压缩助手.
|
|
49
|
+
你的任务: 把给定的对话历史压缩成 1-2 句话的摘要, 保留所有出现过的 tool names.
|
|
50
|
+
要求:
|
|
51
|
+
- 保留所有用户的关键需求
|
|
52
|
+
- 保留所有调用过的 tool names (例如 read_file, shell_exec, use_skill 等)
|
|
53
|
+
- 保留关键决策和发现
|
|
54
|
+
- 不要添加原对话中没有的信息
|
|
55
55
|
- 输出纯文本, 不要 JSON, 不要 markdown 标题`;
|
|
56
56
|
export async function autoCompact(history, opts = {}) {
|
|
57
57
|
try {
|