@bolloon/bolloon-agent 0.2.8 → 0.2.10

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.
Files changed (268) hide show
  1. package/README.md +467 -467
  2. package/bin/bolloon-cli.cjs +183 -183
  3. package/bin/bolloon.cjs +0 -0
  4. package/bin/bolloon.js +157 -0
  5. package/dist/agents/agent-manifest-protocol.js +0 -52
  6. package/dist/agents/constraint-layer.js +19 -19
  7. package/dist/agents/pi-sdk.js +287 -1213
  8. package/dist/agents/shell-guard.js +2 -2
  9. package/dist/agents/workflow-pivot-loop.js +2 -81
  10. package/dist/bollharness/src/scripts/deploy-guard.js +8 -8
  11. package/dist/bollharness-integration/context-router-judgment.js +4 -4
  12. package/dist/bollharness-integration/context-router.js +292 -292
  13. package/dist/bollharness-integration/gate-state-machine.js +13 -26
  14. package/dist/bollharness-integration/integration.js +0 -71
  15. package/dist/bollharness-integration/llm-judgment-engine.js +134 -134
  16. package/dist/bollharness-integration/skill-adapter.js +127 -52
  17. package/dist/bootstrap/context-collector.js +3 -6
  18. package/dist/bootstrap/lifecycle-hooks.js +1 -15
  19. package/dist/cli-entry.js +35 -39
  20. package/dist/constraint-runtime/src/_archive_helper.js +9 -0
  21. package/dist/constraint-runtime/src/agent/coordinator.js +48 -0
  22. package/dist/constraint-runtime/src/agent/index.js +1 -0
  23. package/dist/constraint-runtime/src/assistant/index.js +12 -0
  24. package/dist/constraint-runtime/src/bootstrap/index.js +12 -0
  25. package/dist/constraint-runtime/src/bootstrap_graph.js +13 -0
  26. package/dist/constraint-runtime/src/bridge/index.js +12 -0
  27. package/dist/constraint-runtime/src/buddy/index.js +12 -0
  28. package/dist/constraint-runtime/src/cli/index.js +12 -0
  29. package/dist/constraint-runtime/src/command_graph.js +10 -0
  30. package/dist/constraint-runtime/src/commands.js +60 -0
  31. package/dist/constraint-runtime/src/components/index.js +12 -0
  32. package/dist/constraint-runtime/src/constants/index.js +12 -0
  33. package/dist/constraint-runtime/src/constraint/budget.js +22 -0
  34. package/dist/constraint-runtime/src/constraint/index.js +2 -0
  35. package/dist/constraint-runtime/src/constraint/permission.js +20 -0
  36. package/dist/constraint-runtime/src/context.js +30 -0
  37. package/dist/constraint-runtime/src/coordinator/index.js +12 -0
  38. package/dist/constraint-runtime/src/cost_hook.js +4 -0
  39. package/dist/constraint-runtime/src/cost_tracker.js +8 -0
  40. package/dist/constraint-runtime/src/deferred_init.js +10 -0
  41. package/dist/constraint-runtime/src/direct_modes.js +6 -0
  42. package/dist/constraint-runtime/src/dynamic-tool-loader.js +85 -0
  43. package/dist/constraint-runtime/src/entrypoints/index.js +12 -0
  44. package/dist/constraint-runtime/src/execution_registry.js +44 -0
  45. package/dist/constraint-runtime/src/history.js +9 -0
  46. package/dist/constraint-runtime/src/hooks/index.js +12 -0
  47. package/dist/constraint-runtime/src/index.js +26 -0
  48. package/dist/constraint-runtime/src/ink.js +4 -0
  49. package/dist/constraint-runtime/src/keybindings/index.js +12 -0
  50. package/dist/constraint-runtime/src/memdir/index.js +12 -0
  51. package/dist/constraint-runtime/src/migrations/index.js +12 -0
  52. package/dist/constraint-runtime/src/models.js +1 -0
  53. package/dist/constraint-runtime/src/moreright/index.js +12 -0
  54. package/dist/constraint-runtime/src/native_ts/index.js +12 -0
  55. package/dist/constraint-runtime/src/output_styles/index.js +12 -0
  56. package/dist/constraint-runtime/src/parity_audit.js +12 -0
  57. package/dist/constraint-runtime/src/plugins/index.js +12 -0
  58. package/dist/constraint-runtime/src/port_manifest.js +11 -0
  59. package/dist/constraint-runtime/src/prefetch.js +9 -0
  60. package/dist/constraint-runtime/src/query.js +1 -0
  61. package/dist/constraint-runtime/src/remote/index.js +12 -0
  62. package/dist/constraint-runtime/src/remote_runtime.js +9 -0
  63. package/dist/constraint-runtime/src/runtime/index.js +1 -0
  64. package/dist/constraint-runtime/src/runtime/session.js +35 -0
  65. package/dist/constraint-runtime/src/schemas/index.js +12 -0
  66. package/dist/constraint-runtime/src/screens/index.js +12 -0
  67. package/dist/constraint-runtime/src/server/index.js +12 -0
  68. package/dist/constraint-runtime/src/services/index.js +12 -0
  69. package/dist/constraint-runtime/src/session_store.js +22 -0
  70. package/dist/constraint-runtime/src/setup.js +30 -0
  71. package/dist/constraint-runtime/src/skills/index.js +1 -0
  72. package/dist/constraint-runtime/src/skills/skill-registry.js +28 -0
  73. package/dist/constraint-runtime/src/state/index.js +12 -0
  74. package/dist/constraint-runtime/src/system_init.js +20 -0
  75. package/dist/constraint-runtime/src/thinking/engine.js +42 -0
  76. package/dist/constraint-runtime/src/thinking/index.js +1 -0
  77. package/dist/constraint-runtime/src/tool_pool.js +8 -0
  78. package/dist/constraint-runtime/src/tools/OpenCLI/execAdapter.js +7 -0
  79. package/dist/constraint-runtime/src/tools/OpenCLI/listAdapters.js +7 -0
  80. package/dist/constraint-runtime/src/tools/OpenCLI/runCommand.js +7 -0
  81. package/dist/constraint-runtime/src/tools/SafeSDK/confirmTransaction.js +6 -0
  82. package/dist/constraint-runtime/src/tools/SafeSDK/createTransaction.js +8 -0
  83. package/dist/constraint-runtime/src/tools/SafeSDK/executeTransaction.js +6 -0
  84. package/dist/constraint-runtime/src/tools/SafeSDK/getBalance.js +6 -0
  85. package/dist/constraint-runtime/src/tools/SafeSDK/getPendingTransactions.js +6 -0
  86. package/dist/constraint-runtime/src/tools/SafeSDK/proposeTransaction.js +6 -0
  87. package/dist/constraint-runtime/src/tools.js +80 -0
  88. package/dist/constraint-runtime/src/transcript.js +19 -0
  89. package/dist/constraint-runtime/src/types/index.js +12 -0
  90. package/dist/constraint-runtime/src/upstream_proxy/index.js +12 -0
  91. package/dist/constraint-runtime/src/utils/index.js +12 -0
  92. package/dist/constraint-runtime/src/vim/index.js +12 -0
  93. package/dist/constraint-runtime/src/voice/index.js +12 -0
  94. package/dist/constraint-runtime/tests/agent.test.js +16 -0
  95. package/dist/constraint-runtime/tests/constraint.test.js +41 -0
  96. package/dist/constraint-runtime/tests/skill.test.js +19 -0
  97. package/dist/constraint-runtime/tests/thinking.test.js +22 -0
  98. package/dist/context-compaction/auto-compact.js +7 -7
  99. package/dist/electron-preload.js +1 -18
  100. package/dist/electron-preload.js.map +1 -1
  101. package/dist/electron.js +168 -3
  102. package/dist/electron.js.map +1 -1
  103. package/dist/index.js +116 -136
  104. package/dist/llm/config-store.js +8 -24
  105. package/dist/llm/llm-judgment-client.js +102 -102
  106. package/dist/llm/pi-ai.js +85 -126
  107. package/dist/llm/system-prompt/layers/channel/local.md +14 -14
  108. package/dist/llm/system-prompt/layers/channel/p2p-agent.md +18 -18
  109. package/dist/llm/system-prompt/layers/channel/p2p-visitor.md +19 -19
  110. package/dist/llm/system-prompt/layers/core/artifacts_storage.md +89 -89
  111. package/dist/llm/system-prompt/layers/core/evenhandedness.md +21 -21
  112. package/dist/llm/system-prompt/layers/core/hibs_reminders.md +15 -15
  113. package/dist/llm/system-prompt/layers/core/identity.md +37 -37
  114. package/dist/llm/system-prompt/layers/core/knowledge.md +17 -17
  115. package/dist/llm/system-prompt/layers/core/memory_system.md +12 -12
  116. package/dist/llm/system-prompt/layers/core/network_filesystem.md +28 -28
  117. package/dist/llm/system-prompt/layers/core/refusal.md +37 -37
  118. package/dist/llm/system-prompt/layers/core/tone.md +31 -31
  119. package/dist/llm/system-prompt/layers/core/tools.thin.md +13 -13
  120. package/dist/llm/system-prompt/layers/core/wellbeing.md +41 -41
  121. package/dist/llm/system-prompt/layers/role/architect.md +20 -20
  122. package/dist/llm/system-prompt/layers/role/expert.md +19 -19
  123. package/dist/llm/system-prompt/layers/role/implementer.md +15 -15
  124. package/dist/llm/system-prompt/layers/role/security.md +15 -15
  125. package/dist/llm/system-prompt/layers/tool/artifacts.md +72 -72
  126. package/dist/llm/system-prompt/layers/tool/bash.md +25 -25
  127. package/dist/llm/system-prompt/layers/tool/hibs_api.md +171 -171
  128. package/dist/llm/system-prompt/layers/tool/image_search.md +70 -70
  129. package/dist/llm/system-prompt/layers/tool/manifest.md +89 -89
  130. package/dist/llm/system-prompt/layers/tool/mcp_apps.md +53 -53
  131. package/dist/llm/system-prompt/layers/tool/web_search.md +83 -83
  132. package/dist/llm/tool-manifest/ask_user_input.js +1 -1
  133. package/dist/llm/tool-manifest/bash.js +3 -3
  134. package/dist/llm/tool-manifest/create_file.js +4 -4
  135. package/dist/llm/tool-manifest/fetch_sports_data.js +3 -3
  136. package/dist/llm/tool-manifest/image_search.js +2 -2
  137. package/dist/llm/tool-manifest/mcp.js +2 -2
  138. package/dist/llm/tool-manifest/message_compose.js +3 -3
  139. package/dist/llm/tool-manifest/places.js +2 -2
  140. package/dist/llm/tool-manifest/present_files.js +1 -1
  141. package/dist/llm/tool-manifest/recipe.js +2 -2
  142. package/dist/llm/tool-manifest/str_replace.js +5 -5
  143. package/dist/llm/tool-manifest/view.js +3 -3
  144. package/dist/llm/tool-manifest/weather.js +4 -4
  145. package/dist/llm/tool-manifest/web.js +4 -4
  146. package/dist/pi-ecosystem-colony/index.js +365 -0
  147. package/dist/pi-ecosystem-judgment/causal-judge.js +51 -51
  148. package/dist/pi-ecosystem-judgment/distill-prompt.js +42 -42
  149. package/dist/pi-ecosystem-judgment/distillation.js +14 -14
  150. package/dist/pi-ecosystem-judgment/monitor-gate.js +28 -28
  151. package/dist/pi-ecosystem-judgment/value-injection.js +102 -102
  152. package/dist/security/context-router-tool.js +15 -15
  153. package/dist/security/tool-gate.js +0 -11
  154. package/dist/social/ant-colony/AdaptiveHeartbeat.js +101 -0
  155. package/dist/social/ant-colony/PheromoneEngine.js +227 -0
  156. package/dist/social/ant-colony/index.js +6 -0
  157. package/dist/social/ant-colony/types.js +24 -0
  158. package/dist/test/ai-judgment-test.js +80 -0
  159. package/dist/test/bollharness-integration.test.js +318 -0
  160. package/dist/test/channel-agent-multi-dialogue.js +205 -0
  161. package/dist/test/channel-heartbeat-agent-test.js +201 -0
  162. package/dist/test/constraint-layer.test.js +164 -0
  163. package/dist/test/diap-identity-test.js +172 -0
  164. package/dist/test/diap-quick-test.js +62 -0
  165. package/dist/test/global-shared-context.test.js +315 -0
  166. package/dist/test/harness-judgment-injection.test.js +246 -0
  167. package/dist/test/harness-workflow-integrator-test.js +228 -0
  168. package/dist/test/human-value-store.test.js +243 -0
  169. package/dist/test/hybrid-integration-test.js +118 -0
  170. package/dist/test/hybrid-messenger-verify.js +55 -0
  171. package/dist/test/iroh-bistream-debug.js +38 -0
  172. package/dist/test/iroh-communication.test.js +66 -0
  173. package/dist/test/iroh-debug-test.js +57 -0
  174. package/dist/test/iroh-diap-test.js +71 -0
  175. package/dist/test/iroh-direct-connect.js +55 -0
  176. package/dist/test/iroh-e2e-fixed.js +89 -0
  177. package/dist/test/iroh-e2e-same-process.js +63 -0
  178. package/dist/test/iroh-e2e.js +66 -0
  179. package/dist/test/iroh-final-e2e.js +72 -0
  180. package/dist/test/iroh-relay-test.js +37 -0
  181. package/dist/test/iroh-simple-test.js +41 -0
  182. package/dist/test/iroh-transport-verify.js +54 -0
  183. package/dist/test/iroh-transport.test.js +37 -0
  184. package/dist/test/iroh-two-nodes.js +70 -0
  185. package/dist/test/iroh-verify.js +44 -0
  186. package/dist/test/judgment-decision.test.js +219 -0
  187. package/dist/test/llm-judgment-integration.test.js +220 -0
  188. package/dist/test/p2p-agent-complex-dialogue.js +385 -0
  189. package/dist/test/p2p-agent-dialogue.js +341 -0
  190. package/dist/test/p2p-agent-full-bidirectional.js +510 -0
  191. package/dist/test/p2p-agent-harness-flow.js +437 -0
  192. package/dist/test/p2p-agent-harness-single.js +143 -0
  193. package/dist/test/p2p-ai-dialogue-test.js +318 -0
  194. package/dist/test/p2p-cid-connect-test.js +195 -0
  195. package/dist/test/p2p-connect-receiver.js +69 -0
  196. package/dist/test/p2p-doc-transfer.js +110 -0
  197. package/dist/test/p2p-identity-page-test.js +77 -0
  198. package/dist/test/p2p-iroh-test.js +171 -0
  199. package/dist/test/p2p-minimal-test.js +241 -0
  200. package/dist/test/p2p-node-1.js +148 -0
  201. package/dist/test/p2p-node-2.js +148 -0
  202. package/dist/test/p2p-server.js +281 -0
  203. package/dist/test/p2p-two-nodes-test.js +438 -0
  204. package/dist/test/pi-sdk.test.js +44 -0
  205. package/dist/test/set-persona.js +40 -0
  206. package/dist/test/simple.test.js +9 -0
  207. package/dist/test/storage-integration.test.js +150 -0
  208. package/dist/test/subagent-manager.test.js +276 -0
  209. package/dist/test/test-gate-flow.test.js +81 -0
  210. package/dist/test/workflow-engine.test.js +87 -0
  211. package/dist/test/workflow-pivot-loop.test.js +246 -0
  212. package/dist/web/api-config.html +520 -520
  213. package/dist/web/client.js +2917 -3791
  214. package/dist/web/components/p2p/index.js +234 -276
  215. package/dist/web/components/wallet-viem.mjs +118 -118
  216. package/dist/web/index.html +374 -373
  217. package/dist/web/manifest.json +20 -20
  218. package/dist/web/server.js +23 -775
  219. package/dist/web/style.css +4737 -4737
  220. package/dist/web/ui/message-renderer.js +373 -451
  221. package/dist/web/ui/step-timeline.js +255 -351
  222. package/package.json +160 -157
  223. package/scripts/build-cli.js +216 -0
  224. package/scripts/build-web.ts +125 -0
  225. package/scripts/postinstall.js +153 -0
  226. package/bin/bolloon-daemon.sh +0 -207
  227. package/bin/ipfs +0 -0
  228. package/dist/agents/chat-segmenter.js +0 -298
  229. package/dist/agents/judgment-protocol.js +0 -479
  230. package/dist/agents/parse-tool-call.js +0 -304
  231. package/dist/agents/peer-manifest-loader.js +0 -210
  232. package/dist/agents/react-loop.js +0 -120
  233. package/dist/agents/session-store.js +0 -171
  234. package/dist/agents/tool-registry.js +0 -136
  235. package/dist/bootstrap/chat-archiver.js +0 -276
  236. package/dist/bootstrap/memory-compressor.js +0 -170
  237. package/dist/bootstrap/persona-loader.js +0 -94
  238. package/dist/electron/config.js +0 -16
  239. package/dist/electron/config.js.map +0 -1
  240. package/dist/electron/dialogs.js +0 -71
  241. package/dist/electron/dialogs.js.map +0 -1
  242. package/dist/electron/first-run.js +0 -129
  243. package/dist/electron/first-run.js.map +0 -1
  244. package/dist/electron/ipc.js +0 -16
  245. package/dist/electron/ipc.js.map +0 -1
  246. package/dist/electron/logger.js +0 -77
  247. package/dist/electron/logger.js.map +0 -1
  248. package/dist/electron/main.js +0 -60
  249. package/dist/electron/main.js.map +0 -1
  250. package/dist/electron/menu.js +0 -140
  251. package/dist/electron/menu.js.map +0 -1
  252. package/dist/electron/paths.js +0 -33
  253. package/dist/electron/paths.js.map +0 -1
  254. package/dist/electron/server.js +0 -74
  255. package/dist/electron/server.js.map +0 -1
  256. package/dist/electron/tray.js +0 -73
  257. package/dist/electron/tray.js.map +0 -1
  258. package/dist/electron/window.js +0 -69
  259. package/dist/electron/window.js.map +0 -1
  260. package/dist/network/local-inbox-bus.js +0 -73
  261. package/dist/network/p2p-outbox.js +0 -161
  262. package/dist/network/peer-fs.js +0 -420
  263. package/dist/network/peer-resource-bridge.js +0 -216
  264. package/dist/web/components/p2p/P2PModal.js +0 -188
  265. package/dist/web/components/p2p/p2p-modal.js +0 -664
  266. package/dist/web/components/p2p/p2p-tools.js +0 -248
  267. package/dist/web/input-validator.js +0 -103
  268. package/dist/web/util/safe-name.js +0 -32
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@ import { HybridMessenger } from './network/hybrid-messenger.js';
4
4
  import * as ed25519 from '@noble/ed25519';
5
5
  import { sha512 } from '@noble/hashes/sha2.js';
6
6
  import * as fs from 'fs/promises';
7
- import * as path from 'path';
8
7
  import { documentReader } from './documents/reader.js';
9
8
  import { initMinimax } from './constraints/index.js';
10
9
  import { createAgentSession } from './agents/pi-sdk.js';
@@ -31,10 +30,10 @@ const CLEAR_LINE = '\x1b[2K';
31
30
  const HIDE_CURSOR = '\x1b[?25l';
32
31
  const SHOW_CURSOR = '\x1b[?25h';
33
32
  const s = {
34
- banner: () => console.log(`\n${CYAN}${BOLD}
35
- ╔═══════════════════════════════════════════╗
36
- ║ ${WHITE}🤖 Bolloon ${CYAN} ║
37
- ║ ${WHITE}P2P AI Document Processor${CYAN} ║
33
+ banner: () => console.log(`\n${CYAN}${BOLD}
34
+ ╔═══════════════════════════════════════════╗
35
+ ║ ${WHITE}🤖 Bolloon ${CYAN} ║
36
+ ║ ${WHITE}P2P AI Document Processor${CYAN} ║
38
37
  ╚═══════════════════════════════════════════╝${RESET}\n`),
39
38
  step: (num, total, text, status) => {
40
39
  const check = status === 'ok' ? `${GREEN}✓` :
@@ -577,10 +576,10 @@ async function runToolCommand(tool, args, outputJson, comm) {
577
576
  const running = irohTransport.isRunning();
578
577
  const irohPeers = irohTransport.getPeers();
579
578
  const messenger = hybridMessenger ? 'HybridMessenger 就绪' : 'HybridMessenger 未初始化';
580
- response = `iroh P2P 状态:
581
- 运行中: ${running ? '是' : '否'}
582
- Node ID: ${nodeId ? nodeId.substring(0, 32) + '...' : 'N/A'}
583
- 已知节点: ${irohPeers.length}
579
+ response = `iroh P2P 状态:
580
+ 运行中: ${running ? '是' : '否'}
581
+ Node ID: ${nodeId ? nodeId.substring(0, 32) + '...' : 'N/A'}
582
+ 已知节点: ${irohPeers.length}
584
583
  ${messenger}`;
585
584
  break;
586
585
  }
@@ -751,14 +750,6 @@ async function runToolCommand(tool, args, outputJson, comm) {
751
750
  `已加载 Harness Skills: ${harnessSkills.length}\n\n` +
752
751
  `Skills:\n${skills.map(s => ` - ${s.name}: ${s.description}`).join('\n')}\n\n` +
753
752
  `Gates: 0-8 (8-Gate 工作流)`;
754
- // Fix 1: write-back 初始化摘要到 AGENTS.md
755
- try {
756
- const fs_write = await import('fs');
757
- const agentMd = path.join(process.cwd(), 'AGENTS.md');
758
- const entry = `\n<!-- bolloon-init -->\n**Bollharness 初始化**: ${new Date().toISOString().slice(0, 10)} | Skills: ${skills.length} | Gates: 0-8\n`;
759
- fs_write.appendFileSync(agentMd, entry);
760
- }
761
- catch { /* 静默 */ }
762
753
  break;
763
754
  }
764
755
  case 'harness-gate': {
@@ -815,14 +806,6 @@ async function runToolCommand(tool, args, outputJson, comm) {
815
806
  response = `📊 变更分类: ${result.classification}\n` +
816
807
  `最小路径: ${result.minimum_gates}\n` +
817
808
  `快速通道: ${result.fast_track ? '✅ 可用' : '❌ 不可用'}`;
818
- // Fix 1: write-back 分类结果到 CLAUDE.md
819
- try {
820
- const fs_write = await import('fs');
821
- const agentMd = path.join(process.cwd(), 'CLAUDE.md');
822
- const entry = `\n<!-- bolloon-classify -->\n**变更分类**: ${result.classification} | ${description} | ${new Date().toISOString().slice(0, 10)}\n`;
823
- fs_write.appendFileSync(agentMd, entry);
824
- }
825
- catch { /* 静默 */ }
826
809
  break;
827
810
  }
828
811
  case 'harness-context': {
@@ -1683,111 +1666,111 @@ function parseArgs() {
1683
1666
  return result;
1684
1667
  }
1685
1668
  function printHelp() {
1686
- console.log(`
1687
- 🤖 Bolloon Agent - AI 可调用文档处理智能体
1688
-
1689
- 用法:
1690
- npx tsx src/index.ts [选项] [参数]
1691
-
1692
- 选项:
1693
- # 文档处理
1694
- --read <file> 读取文档 (txt, md, pdf, docx)
1695
- --summarize <file> [ctx] 总结文档,可选上下文
1696
- --improve <file> <req> 改进文档,req 为改进要求
1697
-
1698
- # P2P 网络
1699
- --peers 列出已连接的对等节点
1700
- --broadcast <msg> 广播消息到所有节点
1701
- --send <peerId> <msg> 向指定节点发送消息
1702
-
1703
- # 智能体
1704
- --identity 显示当前智能体身份
1705
- --logs 显示操作日志
1706
- --search <keyword> 搜索文件
1707
- --tools 显示所有可用工具
1708
-
1709
- # SubAgent 管理
1710
- --agents 列出所有 SubAgent
1711
- --register-agent <name> [cap1] [cap2]... 注册新 SubAgent
1712
- --delegate <任务描述> [能力要求...] 委派任务给最佳 Agent
1713
-
1714
- # 全局共享上下文
1715
- --context 显示全局共享上下文摘要
1716
- --global-agents 显示全局 Agent 注册表
1717
- --add-action <内容> [重要性] 添加用户行动到共享上下文
1718
-
1719
- # Bollharness 治理框架
1720
- --harness-init 初始化 Bollharness 治理框架
1721
- --harness-gate 显示当前 Gate 状态
1722
- --harness-transition [PASS|BLOCK] 执行 Gate 转移
1723
- --harness-skill <name> [action] 执行 Harness Skill
1724
- --harness-classify <描述> 分类变更类型
1725
- --harness-context <file> 获取文件上下文
1726
- --harness-check <file> 执行 Guard 检查
1727
- --harness-archive 归档当前 Session 到 Harness
1728
- --harness-sessions 列出 Session 归档记录
1729
- --harness-session-context [id] 获取 Session 上下文
1730
-
1731
- # 自动更新
1732
- --update-check 检查 npm 包更新
1733
- --update-now [pkg] 更新到最新版本
1734
-
1735
- # 跨机聊天 (commits-as-messages, 共享 GitHub 仓库)
1736
- --chat-init 初始化 .comm/ 目录 (一次性)
1737
- --chat-send "消息正文" 把消息写到 .comm/<role>/, commit + push
1738
- --chat-pull 拉取远端 .comm/ 的新消息并显示
1739
- --chat-list 列出本地所有已同步消息
1740
- --chat-watch [--interval 15s] 后台定时拉取, 有新消息时输出
1741
- --chat-status 一屏查看: role / publicKey / remote / ahead-behind
1742
-
1743
- # 纯 P2P 私聊 (不走 GitHub, 不写 git, 不持久化)
1744
- --chat-p2p-send <peer|publicKey> "消息正文" 通过 P2P 直接发一条
1745
- --chat-p2p-listen 后台监听对方 P2P 私聊消息 (Ctrl-C 退出)
1746
-
1747
- # 跨机 agent 协作 (对方 bolloon --web 起着才能处理, 走 P2P 不经 GitHub)
1748
- --collab <peer|publicKey> "<任务描述>" 派任务给对端 LLM 干活, 等回结果 (90s 超时)
1749
-
1750
- # AI 对话
1751
- --prompt, -p <text> 通用 AI 对话(默认)
1752
- --model <name> 指定使用的模型
1753
-
1754
- # 输出控制
1755
- --json, -j 输出 JSON 格式
1756
- --output, -o <file> 结果保存到文件
1757
- --web 启动 Web UI 模式
1758
- --help, -h 显示帮助信息
1759
-
1760
- 示例:
1761
- # 文档处理
1762
- npx tsx src/index.ts --read 想法.md
1763
- npx tsx src/index.ts --summarize docs/想法.md
1764
- npx tsx src/index.ts --improve docs/README.md "让内容更简洁"
1765
- npx tsx src/index.ts --read 想法.md -o summary.txt
1766
-
1767
- # P2P 网络
1768
- npx tsx src/index.ts --peers
1769
- npx tsx src/index.ts --broadcast "Hello everyone"
1770
- npx tsx src/index.ts --send QmABC... "私信内容"
1771
-
1772
- # AI 对话
1773
- npx tsx src/index.ts --prompt "总结 README.md"
1774
- npx tsx src/index.ts -p "分析这个项目" -j
1775
-
1776
- # 交互模式
1777
- npx tsx src/index.ts
1778
-
1779
- # Web 模式
1780
- npx tsx src/index.ts --web
1781
-
1782
- 环境变量:
1783
- MINIMAX_API_KEY MiniMax API 密钥
1784
- DEEPSEEK_API_KEY DeepSeek API 密钥
1785
- KIMI_API_KEY / MOONSHOT_API_KEY Kimi/Moonshot API 密钥
1786
- GLM_API_KEY / ZHIPU_API_KEY 智谱 GLM API 密钥
1787
- QWEN_API_KEY / DASHSCOPE_API_KEY 通义千问 API 密钥
1788
- OPENAI_API_KEY OpenAI API 密钥(Pi SDK)
1789
- ANTHROPIC_API_KEY Anthropic API 密钥(Pi SDK)
1790
- PORT Web 服务端口(默认 54188)
1669
+ console.log(`
1670
+ 🤖 Bolloon Agent - AI 可调用文档处理智能体
1671
+
1672
+ 用法:
1673
+ npx tsx src/index.ts [选项] [参数]
1674
+
1675
+ 选项:
1676
+ # 文档处理
1677
+ --read <file> 读取文档 (txt, md, pdf, docx)
1678
+ --summarize <file> [ctx] 总结文档,可选上下文
1679
+ --improve <file> <req> 改进文档,req 为改进要求
1680
+
1681
+ # P2P 网络
1682
+ --peers 列出已连接的对等节点
1683
+ --broadcast <msg> 广播消息到所有节点
1684
+ --send <peerId> <msg> 向指定节点发送消息
1685
+
1686
+ # 智能体
1687
+ --identity 显示当前智能体身份
1688
+ --logs 显示操作日志
1689
+ --search <keyword> 搜索文件
1690
+ --tools 显示所有可用工具
1691
+
1692
+ # SubAgent 管理
1693
+ --agents 列出所有 SubAgent
1694
+ --register-agent <name> [cap1] [cap2]... 注册新 SubAgent
1695
+ --delegate <任务描述> [能力要求...] 委派任务给最佳 Agent
1696
+
1697
+ # 全局共享上下文
1698
+ --context 显示全局共享上下文摘要
1699
+ --global-agents 显示全局 Agent 注册表
1700
+ --add-action <内容> [重要性] 添加用户行动到共享上下文
1701
+
1702
+ # Bollharness 治理框架
1703
+ --harness-init 初始化 Bollharness 治理框架
1704
+ --harness-gate 显示当前 Gate 状态
1705
+ --harness-transition [PASS|BLOCK] 执行 Gate 转移
1706
+ --harness-skill <name> [action] 执行 Harness Skill
1707
+ --harness-classify <描述> 分类变更类型
1708
+ --harness-context <file> 获取文件上下文
1709
+ --harness-check <file> 执行 Guard 检查
1710
+ --harness-archive 归档当前 Session 到 Harness
1711
+ --harness-sessions 列出 Session 归档记录
1712
+ --harness-session-context [id] 获取 Session 上下文
1713
+
1714
+ # 自动更新
1715
+ --update-check 检查 npm 包更新
1716
+ --update-now [pkg] 更新到最新版本
1717
+
1718
+ # 跨机聊天 (commits-as-messages, 共享 GitHub 仓库)
1719
+ --chat-init 初始化 .comm/ 目录 (一次性)
1720
+ --chat-send "消息正文" 把消息写到 .comm/<role>/, commit + push
1721
+ --chat-pull 拉取远端 .comm/ 的新消息并显示
1722
+ --chat-list 列出本地所有已同步消息
1723
+ --chat-watch [--interval 15s] 后台定时拉取, 有新消息时输出
1724
+ --chat-status 一屏查看: role / publicKey / remote / ahead-behind
1725
+
1726
+ # 纯 P2P 私聊 (不走 GitHub, 不写 git, 不持久化)
1727
+ --chat-p2p-send <peer|publicKey> "消息正文" 通过 P2P 直接发一条
1728
+ --chat-p2p-listen 后台监听对方 P2P 私聊消息 (Ctrl-C 退出)
1729
+
1730
+ # 跨机 agent 协作 (对方 bolloon --web 起着才能处理, 走 P2P 不经 GitHub)
1731
+ --collab <peer|publicKey> "<任务描述>" 派任务给对端 LLM 干活, 等回结果 (90s 超时)
1732
+
1733
+ # AI 对话
1734
+ --prompt, -p <text> 通用 AI 对话(默认)
1735
+ --model <name> 指定使用的模型
1736
+
1737
+ # 输出控制
1738
+ --json, -j 输出 JSON 格式
1739
+ --output, -o <file> 结果保存到文件
1740
+ --web 启动 Web UI 模式
1741
+ --help, -h 显示帮助信息
1742
+
1743
+ 示例:
1744
+ # 文档处理
1745
+ npx tsx src/index.ts --read 想法.md
1746
+ npx tsx src/index.ts --summarize docs/想法.md
1747
+ npx tsx src/index.ts --improve docs/README.md "让内容更简洁"
1748
+ npx tsx src/index.ts --read 想法.md -o summary.txt
1749
+
1750
+ # P2P 网络
1751
+ npx tsx src/index.ts --peers
1752
+ npx tsx src/index.ts --broadcast "Hello everyone"
1753
+ npx tsx src/index.ts --send QmABC... "私信内容"
1754
+
1755
+ # AI 对话
1756
+ npx tsx src/index.ts --prompt "总结 README.md"
1757
+ npx tsx src/index.ts -p "分析这个项目" -j
1758
+
1759
+ # 交互模式
1760
+ npx tsx src/index.ts
1761
+
1762
+ # Web 模式
1763
+ npx tsx src/index.ts --web
1764
+
1765
+ 环境变量:
1766
+ MINIMAX_API_KEY MiniMax API 密钥
1767
+ DEEPSEEK_API_KEY DeepSeek API 密钥
1768
+ KIMI_API_KEY / MOONSHOT_API_KEY Kimi/Moonshot API 密钥
1769
+ GLM_API_KEY / ZHIPU_API_KEY 智谱 GLM API 密钥
1770
+ QWEN_API_KEY / DASHSCOPE_API_KEY 通义千问 API 密钥
1771
+ OPENAI_API_KEY OpenAI API 密钥(Pi SDK)
1772
+ ANTHROPIC_API_KEY Anthropic API 密钥(Pi SDK)
1773
+ PORT Web 服务端口(默认 54188)
1791
1774
  `);
1792
1775
  }
1793
1776
  // ---------------------------------------------------------------------------
@@ -1928,12 +1911,9 @@ async function main() {
1928
1911
  }
1929
1912
  const { createWebServer, openBrowser } = await import('./web/server.js');
1930
1913
  s.info(`启动 Web 服务端口 ${port}...`);
1931
- // 2026-06-24: CLI 默认 loopback bind (安全), LAN 访问需 BOLLOON_HOST=0.0.0.0
1932
- const bindHost = process.env.BOLLOON_HOST;
1933
- const { port: actualPort } = await createWebServer(port, { selfImprove, ...(bindHost ? { host: bindHost } : {}) });
1934
- const displayHost = bindHost ?? '127.0.0.1';
1935
- s.success(`浏览器已打开 → http://${displayHost}:${actualPort}`);
1936
- openBrowser(`http://${displayHost}:${actualPort}`);
1914
+ const { port: actualPort } = await createWebServer(port, { selfImprove });
1915
+ s.success(`浏览器已打开 http://localhost:${actualPort}`);
1916
+ openBrowser(`http://localhost:${actualPort}`);
1937
1917
  }
1938
1918
  else if (isNonInteractive) {
1939
1919
  console.log = originalLog;
@@ -11,7 +11,7 @@ export const DEFAULT_PROVIDER_CONFIGS = {
11
11
  enabled: false,
12
12
  apiKey: '',
13
13
  baseUrl: 'https://api.openai.com/v1',
14
- model: 'gpt-5.5',
14
+ model: 'gpt-4',
15
15
  temperature: 0.7,
16
16
  maxTokens: 4096,
17
17
  requiresApiKey: true
@@ -20,7 +20,7 @@ export const DEFAULT_PROVIDER_CONFIGS = {
20
20
  enabled: false,
21
21
  apiKey: '',
22
22
  baseUrl: 'https://api.anthropic.com/v1',
23
- model: 'claude-sonnet-4-5-20250929',
23
+ model: 'claude-3-5-sonnet-20241022',
24
24
  temperature: 0.7,
25
25
  maxTokens: 4096,
26
26
  requiresApiKey: true
@@ -29,7 +29,7 @@ export const DEFAULT_PROVIDER_CONFIGS = {
29
29
  enabled: false,
30
30
  apiKey: '',
31
31
  baseUrl: 'https://openrouter.ai/api/v1',
32
- model: 'anthropic/claude-sonnet-4.5',
32
+ model: 'anthropic/claude-3.5-sonnet',
33
33
  temperature: 0.7,
34
34
  maxTokens: 4096,
35
35
  requiresApiKey: true
@@ -38,7 +38,7 @@ export const DEFAULT_PROVIDER_CONFIGS = {
38
38
  enabled: false,
39
39
  apiKey: '',
40
40
  baseUrl: 'https://generativelanguage.googleapis.com/v1beta',
41
- model: 'gemini-3.5-pro',
41
+ model: 'gemini-2.0-flash',
42
42
  temperature: 0.7,
43
43
  maxTokens: 4096,
44
44
  requiresApiKey: true
@@ -97,16 +97,6 @@ export const DEFAULT_PROVIDER_CONFIGS = {
97
97
  maxTokens: 4096,
98
98
  requiresApiKey: true
99
99
  },
100
- // 小米 MiMo (openai 兼容) — 默认 base URL https://api.xiaomi.com/v1
101
- mimo: {
102
- enabled: false,
103
- apiKey: '',
104
- baseUrl: 'https://api.xiaomi.com/v1',
105
- model: 'mimo-v2.5-pro',
106
- temperature: 0.7,
107
- maxTokens: 4096,
108
- requiresApiKey: true
109
- },
110
100
  local: {
111
101
  enabled: false,
112
102
  apiKey: '',
@@ -118,10 +108,10 @@ export const DEFAULT_PROVIDER_CONFIGS = {
118
108
  }
119
109
  };
120
110
  export const PROVIDER_INFO = {
121
- openai: { name: 'OpenAI', description: 'GPT-4, GPT-3.5 等模型', requiresApiKey: true, models: ['gpt-4.1', 'gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo', 'gpt-3.5-turbo'] },
122
- anthropic: { name: 'Anthropic', description: 'Claude 3.5+ 系列模型', requiresApiKey: true, models: ['claude-sonnet-4-5-20250929', 'claude-3-5-sonnet-20241022', 'claude-3-5-haiku-20241022', 'claude-3-opus-20240229'] },
123
- openrouter: { name: 'OpenRouter', description: '聚合多个 AI 供应商', requiresApiKey: true, models: ['anthropic/claude-sonnet-4.5', 'anthropic/claude-3.5-sonnet'] },
124
- gemini: { name: 'Google Gemini', description: 'Gemini 系列模型', requiresApiKey: true, models: ['gemini-2.5-pro', 'gemini-2.0-flash', 'gemini-1.5-pro', 'gemini-1.5-flash'] },
111
+ openai: { name: 'OpenAI', description: 'GPT-4, GPT-3.5 等模型', requiresApiKey: true, models: ['gpt-4', 'gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo', 'gpt-3.5-turbo'] },
112
+ anthropic: { name: 'Anthropic', description: 'Claude 3.5 系列模型', requiresApiKey: true, models: ['claude-3-5-sonnet-20241022', 'claude-3-5-haiku-20241022', 'claude-3-opus-20240229'] },
113
+ openrouter: { name: 'OpenRouter', description: '聚合多个 AI 供应商', requiresApiKey: true },
114
+ gemini: { name: 'Google Gemini', description: 'Gemini 系列模型', requiresApiKey: true, models: ['gemini-2.0-flash', 'gemini-1.5-pro', 'gemini-1.5-flash'] },
125
115
  ollama: { name: 'Ollama', description: '本地 LLM 运行框架', requiresApiKey: false },
126
116
  minimax: {
127
117
  name: 'MiniMax',
@@ -133,7 +123,6 @@ export const PROVIDER_INFO = {
133
123
  kimi: { name: 'Kimi (月之暗面)', description: 'Moonshot 长上下文模型', requiresApiKey: true, models: ['moonshot-v1-8k', 'moonshot-v1-32k', 'moonshot-v1-128k'] },
134
124
  glm: { name: 'GLM (智谱)', description: '智谱 ChatGLM 系列模型', requiresApiKey: true, models: ['glm-4-flash', 'glm-4', 'glm-4-plus', 'glm-4-air', 'glm-4-airx'] },
135
125
  qwen: { name: 'Qwen (通义千问)', description: '阿里云通义千问系列', requiresApiKey: true, models: ['qwen-plus', 'qwen-max', 'qwen-turbo', 'qwen-long'] },
136
- mimo: { name: 'MiMo (小米)', description: '小米 MiMo V2 系列 (openai 兼容)', requiresApiKey: true, models: ['mimo-v2.5-pro', 'mimo-v2-pro', 'mimo-v2-omni', 'mimo-v2-flash', 'mimo-v2.5-pro-ultraspeed'] },
137
126
  local: { name: '本地模型', description: '本地部署的模型服务', requiresApiKey: false }
138
127
  };
139
128
  function getDefaultConfig() {
@@ -165,9 +154,6 @@ function getDefaultConfig() {
165
154
  if (process.env.QWEN_API_KEY || process.env.DASHSCOPE_API_KEY) {
166
155
  envConfigs.qwen = { ...DEFAULT_PROVIDER_CONFIGS.qwen, enabled: true, apiKey: process.env.QWEN_API_KEY || process.env.DASHSCOPE_API_KEY || '' };
167
156
  }
168
- if (process.env.MIMO_API_KEY) {
169
- envConfigs.mimo = { ...DEFAULT_PROVIDER_CONFIGS.mimo, enabled: true, apiKey: process.env.MIMO_API_KEY };
170
- }
171
157
  if (process.env.OLLAMA_BASE_URL) {
172
158
  envConfigs.ollama = { ...DEFAULT_PROVIDER_CONFIGS.ollama, enabled: true, baseUrl: process.env.OLLAMA_BASE_URL };
173
159
  }
@@ -190,8 +176,6 @@ function getDefaultConfig() {
190
176
  activeProvider = 'glm';
191
177
  else if (process.env.QWEN_API_KEY || process.env.DASHSCOPE_API_KEY)
192
178
  activeProvider = 'qwen';
193
- else if (process.env.MIMO_API_KEY)
194
- activeProvider = 'mimo';
195
179
  else if (process.env.OLLAMA_BASE_URL)
196
180
  activeProvider = 'ollama';
197
181
  const providers = { ...DEFAULT_PROVIDER_CONFIGS };
@@ -31,55 +31,55 @@ export const JUDGMENT_PROMPTS = {
31
31
  default: {
32
32
  systemPrompt: '',
33
33
  systemPromptResolver: () => loadRoleLayer('role.expert', '你是一个专业的 AI 任务分析专家. '),
34
- userPromptTemplate: `【当前输入】
35
- {user_input}
36
-
37
- 【对话历史】
38
- {history}
39
-
40
- 【发送者】
41
- {sender_name}
42
-
43
- 请分析以上输入,判断:
44
-
45
- ## 理解
46
- 1. 问题本质是什么?(how-to / why / what / should / feasibility)
47
- 2. 核心需求是什么?
48
- 3. 有哪些隐含信息需要注意?
49
-
50
- ## 评估
51
- 1. 复杂性等级(simple / moderate / complex / profound)
52
- 2. 为什么是这个等级?
53
- 3. 需要多深的理解?(surface / deeper / fundamental)
54
-
55
- ## 决策
56
- 1. 推荐处理方式(answer / analyze / design / implement / coordinate)
57
- 2. 为什么这样处理?
58
-
59
- ## 路由
60
- 1. 应该调用哪些 Skills?(arch / guardian-fixer / harness-eng / harness-dev / task-arch / crystal-learn)
61
- 2. 需要什么协作模式?(solo / pair / team)
62
-
63
- 请用 JSON 格式输出,格式如下:
64
- {
65
- "understanding": {
66
- "essence": "问题本质",
67
- "coreNeed": "核心需求",
68
- "implicit": ["隐含信息1", "隐含信息2"]
69
- },
70
- "assessment": {
71
- "complexity": "complex",
72
- "complexityReason": "评估理由",
73
- "depth": "deeper"
74
- },
75
- "decision": {
76
- "approach": "design",
77
- "reasoning": "决策理由"
78
- },
79
- "routing": {
80
- "skills": ["arch", "guardian-fixer"],
81
- "collaboration": "pair"
82
- }
34
+ userPromptTemplate: `【当前输入】
35
+ {user_input}
36
+
37
+ 【对话历史】
38
+ {history}
39
+
40
+ 【发送者】
41
+ {sender_name}
42
+
43
+ 请分析以上输入,判断:
44
+
45
+ ## 理解
46
+ 1. 问题本质是什么?(how-to / why / what / should / feasibility)
47
+ 2. 核心需求是什么?
48
+ 3. 有哪些隐含信息需要注意?
49
+
50
+ ## 评估
51
+ 1. 复杂性等级(simple / moderate / complex / profound)
52
+ 2. 为什么是这个等级?
53
+ 3. 需要多深的理解?(surface / deeper / fundamental)
54
+
55
+ ## 决策
56
+ 1. 推荐处理方式(answer / analyze / design / implement / coordinate)
57
+ 2. 为什么这样处理?
58
+
59
+ ## 路由
60
+ 1. 应该调用哪些 Skills?(arch / guardian-fixer / harness-eng / harness-dev / task-arch / crystal-learn)
61
+ 2. 需要什么协作模式?(solo / pair / team)
62
+
63
+ 请用 JSON 格式输出,格式如下:
64
+ {
65
+ "understanding": {
66
+ "essence": "问题本质",
67
+ "coreNeed": "核心需求",
68
+ "implicit": ["隐含信息1", "隐含信息2"]
69
+ },
70
+ "assessment": {
71
+ "complexity": "complex",
72
+ "complexityReason": "评估理由",
73
+ "depth": "deeper"
74
+ },
75
+ "decision": {
76
+ "approach": "design",
77
+ "reasoning": "决策理由"
78
+ },
79
+ "routing": {
80
+ "skills": ["arch", "guardian-fixer"],
81
+ "collaboration": "pair"
82
+ }
83
83
  }`,
84
84
  outputFormat: 'json'
85
85
  },
@@ -87,26 +87,26 @@ export const JUDGMENT_PROMPTS = {
87
87
  architecture: {
88
88
  systemPrompt: '',
89
89
  systemPromptResolver: () => loadRoleLayer('role.architect', '你是一个经验丰富的系统架构师. '),
90
- userPromptTemplate: `【架构设计问题】
91
- {user_input}
92
-
93
- 【上下文】
94
- {context}
95
-
96
- 请进行架构分析,判断是否需要 Harness 介入。
97
-
98
- 分析维度:
99
- 1. 涉及哪些架构维度?(分层、微服务、事件驱动等)
100
- 2. 需要什么级别的架构设计?(概念性、逻辑性、物理性)
101
- 3. 有什么架构风险需要考虑?
102
-
103
- 输出 JSON:
104
- {
105
- "needsHarness": true/false,
106
- "gate": 0-8,
107
- "skills": ["arch", "harness-eng"],
108
- "architectureType": "microservices/layered/event-driven/etc",
109
- "concerns": ["concern1", "concern2"]
90
+ userPromptTemplate: `【架构设计问题】
91
+ {user_input}
92
+
93
+ 【上下文】
94
+ {context}
95
+
96
+ 请进行架构分析,判断是否需要 Harness 介入。
97
+
98
+ 分析维度:
99
+ 1. 涉及哪些架构维度?(分层、微服务、事件驱动等)
100
+ 2. 需要什么级别的架构设计?(概念性、逻辑性、物理性)
101
+ 3. 有什么架构风险需要考虑?
102
+
103
+ 输出 JSON:
104
+ {
105
+ "needsHarness": true/false,
106
+ "gate": 0-8,
107
+ "skills": ["arch", "harness-eng"],
108
+ "architectureType": "microservices/layered/event-driven/etc",
109
+ "concerns": ["concern1", "concern2"]
110
110
  }`,
111
111
  outputFormat: 'json'
112
112
  },
@@ -114,22 +114,22 @@ export const JUDGMENT_PROMPTS = {
114
114
  code: {
115
115
  systemPrompt: '',
116
116
  systemPromptResolver: () => loadRoleLayer('role.implementer', '你是一个高效的代码实现专家. '),
117
- userPromptTemplate: `【代码问题】
118
- {user_input}
119
-
120
- 请判断这个问题:
121
-
122
- 1. 是新功能实现还是修复问题?
123
- 2. 涉及哪些代码层面?(业务逻辑、数据访问、接口设计)
124
- 3. 需要什么测试覆盖?
125
-
126
- 输出 JSON:
127
- {
128
- "needsHarness": true/false,
129
- "gate": 0-8,
130
- "skills": ["harness-dev", "guardian-fixer"],
131
- "codeType": "feature/fix/refactor",
132
- "testCoverage": "unit/integration/e2e"
117
+ userPromptTemplate: `【代码问题】
118
+ {user_input}
119
+
120
+ 请判断这个问题:
121
+
122
+ 1. 是新功能实现还是修复问题?
123
+ 2. 涉及哪些代码层面?(业务逻辑、数据访问、接口设计)
124
+ 3. 需要什么测试覆盖?
125
+
126
+ 输出 JSON:
127
+ {
128
+ "needsHarness": true/false,
129
+ "gate": 0-8,
130
+ "skills": ["harness-dev", "guardian-fixer"],
131
+ "codeType": "feature/fix/refactor",
132
+ "testCoverage": "unit/integration/e2e"
133
133
  }`,
134
134
  outputFormat: 'json'
135
135
  },
@@ -137,23 +137,23 @@ export const JUDGMENT_PROMPTS = {
137
137
  security: {
138
138
  systemPrompt: '',
139
139
  systemPromptResolver: () => loadRoleLayer('role.security', '你是一个严格的安全专家. '),
140
- userPromptTemplate: `【安全问题】
141
- {user_input}
142
-
143
- 请分析安全问题:
144
-
145
- 1. 涉及哪些安全维度?(认证、授权、数据保护、传输安全)
146
- 2. 风险等级?(低/中/高/严重)
147
- 3. 需要什么安全措施?
148
-
149
- 输出 JSON:
150
- {
151
- "needsHarness": true,
152
- "gate": 4,
153
- "skills": ["guardian-fixer", "arch"],
154
- "securityDimensions": ["authentication", "authorization"],
155
- "riskLevel": "high",
156
- "recommendations": ["rec1", "rec2"]
140
+ userPromptTemplate: `【安全问题】
141
+ {user_input}
142
+
143
+ 请分析安全问题:
144
+
145
+ 1. 涉及哪些安全维度?(认证、授权、数据保护、传输安全)
146
+ 2. 风险等级?(低/中/高/严重)
147
+ 3. 需要什么安全措施?
148
+
149
+ 输出 JSON:
150
+ {
151
+ "needsHarness": true,
152
+ "gate": 4,
153
+ "skills": ["guardian-fixer", "arch"],
154
+ "securityDimensions": ["authentication", "authorization"],
155
+ "riskLevel": "high",
156
+ "recommendations": ["rec1", "rec2"]
157
157
  }`,
158
158
  outputFormat: 'json'
159
159
  }