@bolloon/bolloon-agent 0.1.35 → 0.1.37

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 (502) hide show
  1. package/README.md +1 -1
  2. package/dist/agents/p2p-chat-tools.js +6 -6
  3. package/dist/agents/permission-mode.js +115 -0
  4. package/dist/agents/pi-sdk.js +435 -25
  5. package/dist/agents/pre-tool-validator.js +194 -0
  6. package/dist/agents/workflow-pivot-loop.js +113 -12
  7. package/dist/bollharness-integration/context-router.js +2 -2
  8. package/dist/bollharness-integration/guard-checker.js +1 -1
  9. package/dist/bootstrap/bootstrap.js +3 -0
  10. package/dist/bootstrap/context-collector.js +17 -1
  11. package/dist/bootstrap/context-hierarchy.js +218 -0
  12. package/dist/bootstrap/lifecycle-hooks.js +86 -24
  13. package/dist/bootstrap/project-context.js +10 -3
  14. package/dist/context-compaction/auto-compact.js +144 -0
  15. package/dist/context-compaction/budget-gate.js +28 -0
  16. package/dist/context-compaction/budget-reduce.js +35 -0
  17. package/dist/context-compaction/context-collapse.js +66 -0
  18. package/dist/context-compaction/index.js +21 -0
  19. package/dist/context-compaction/microcompact.js +51 -0
  20. package/dist/context-compaction/pipeline.js +123 -0
  21. package/dist/context-compaction/snip.js +45 -0
  22. package/dist/context-compaction/token-estimator.js +35 -0
  23. package/dist/context-compaction/types.js +19 -0
  24. package/dist/heartbeat/HealthMonitor.js +3 -2
  25. package/dist/index.js +38 -2
  26. package/dist/llm/llm-judgment-client.js +32 -30
  27. package/dist/llm/pi-ai.js +103 -16
  28. package/dist/llm/system-prompt/health.js +129 -0
  29. package/dist/llm/system-prompt/registry.js +246 -0
  30. package/dist/llm/system-prompt/strip-hibsml.js +51 -0
  31. package/dist/llm/tool-manifest/ask_user_input.js +35 -0
  32. package/dist/llm/tool-manifest/bash.js +23 -0
  33. package/dist/llm/tool-manifest/create_file.js +24 -0
  34. package/dist/llm/tool-manifest/fetch_sports_data.js +26 -0
  35. package/dist/llm/tool-manifest/image_search.js +24 -0
  36. package/dist/llm/tool-manifest/index.js +69 -0
  37. package/dist/llm/tool-manifest/mcp.js +43 -0
  38. package/dist/llm/tool-manifest/message_compose.js +31 -0
  39. package/dist/llm/tool-manifest/places.js +83 -0
  40. package/dist/llm/tool-manifest/present_files.js +21 -0
  41. package/dist/llm/tool-manifest/recipe.js +40 -0
  42. package/dist/llm/tool-manifest/recommend_apps.js +23 -0
  43. package/dist/llm/tool-manifest/str_replace.js +27 -0
  44. package/dist/llm/tool-manifest/types.js +7 -0
  45. package/dist/llm/tool-manifest/view.js +24 -0
  46. package/dist/llm/tool-manifest/weather.js +27 -0
  47. package/dist/llm/tool-manifest/web.js +51 -0
  48. package/dist/network/p2p-direct.js +23 -0
  49. package/dist/network/source-intent-broadcaster.js +203 -0
  50. package/dist/network/source-intent.js +100 -0
  51. package/dist/pi-ecosystem-judgment/adaptive-scan.js +48 -0
  52. package/dist/pi-ecosystem-judgment/injection-gate.js +54 -12
  53. package/dist/pi-ecosystem-judgment/value-injection.js +8 -2
  54. package/dist/security/context-router-tool.js +1 -1
  55. package/dist/security/input-scanner.js +223 -0
  56. package/dist/web/client.js +3089 -4458
  57. package/dist/web/index.html +58 -67
  58. package/dist/web/server.js +299 -117
  59. package/dist/web/style.css +531 -249
  60. package/dist/web/ui/message-renderer.js +352 -0
  61. package/dist/web/ui/step-timeline.js +279 -0
  62. package/package.json +2 -2
  63. package/.auto-evolve-calls +0 -1
  64. package/.last-auto-evolve-baseline +0 -1
  65. package/Bolloon.md +0 -103
  66. package/dist/agents/constraint-layer.js.map +0 -1
  67. package/dist/agents/pi-sdk.js.map +0 -1
  68. package/dist/agents/workflow-engine.js.map +0 -1
  69. package/dist/bollharness/src/index.js +0 -5
  70. package/dist/bollharness/src/scripts/checks/check_adr_plan_numbering.js +0 -6
  71. package/dist/bollharness/src/scripts/checks/check_api_types.js +0 -45
  72. package/dist/bollharness/src/scripts/checks/check_artifact_link.js +0 -146
  73. package/dist/bollharness/src/scripts/checks/check_bridge_deps.js +0 -6
  74. package/dist/bollharness/src/scripts/checks/check_bugfix_binding.js +0 -6
  75. package/dist/bollharness/src/scripts/checks/check_bugfix_binding_ci.js +0 -6
  76. package/dist/bollharness/src/scripts/checks/check_doc_file_references.js +0 -6
  77. package/dist/bollharness/src/scripts/checks/check_doc_freshness.js +0 -135
  78. package/dist/bollharness/src/scripts/checks/check_doc_links.js +0 -31
  79. package/dist/bollharness/src/scripts/checks/check_file_existence_claims.js +0 -6
  80. package/dist/bollharness/src/scripts/checks/check_fragment_integrity.js +0 -34
  81. package/dist/bollharness/src/scripts/checks/check_hook_installed.js +0 -63
  82. package/dist/bollharness/src/scripts/checks/check_issue_closure.js +0 -41
  83. package/dist/bollharness/src/scripts/checks/check_mcp_parity.js +0 -6
  84. package/dist/bollharness/src/scripts/checks/check_security.js +0 -48
  85. package/dist/bollharness/src/scripts/checks/check_skill_parity.js +0 -6
  86. package/dist/bollharness/src/scripts/checks/check_versions.js +0 -6
  87. package/dist/bollharness/src/scripts/checks/finding.js +0 -13
  88. package/dist/bollharness/src/scripts/checks/next_decision_number.js +0 -20
  89. package/dist/bollharness/src/scripts/checks/regenerate_magic_docs.js +0 -6
  90. package/dist/bollharness/src/scripts/ci/detect_rebaseline_triggers.js +0 -8
  91. package/dist/bollharness/src/scripts/ci/scan_subprocess_cfg.js +0 -8
  92. package/dist/bollharness/src/scripts/ci/scan_verify_artifacts.js +0 -8
  93. package/dist/bollharness/src/scripts/ci/scan_yaml_schema.js +0 -8
  94. package/dist/bollharness/src/scripts/context_router.js +0 -67
  95. package/dist/bollharness/src/scripts/deploy-guard.js +0 -157
  96. package/dist/bollharness/src/scripts/guard-feedback.js +0 -192
  97. package/dist/bollharness/src/scripts/guard_router.js +0 -158
  98. package/dist/bollharness/src/scripts/hooks/_hook_output.js +0 -6
  99. package/dist/bollharness/src/scripts/hooks/auto-python3.js +0 -6
  100. package/dist/bollharness/src/scripts/hooks/deploy-progress-on-session-end.js +0 -6
  101. package/dist/bollharness/src/scripts/hooks/failure-analyzer.js +0 -6
  102. package/dist/bollharness/src/scripts/hooks/gate-judgment-inject.js +0 -92
  103. package/dist/bollharness/src/scripts/hooks/gate-transition-judgment.js +0 -63
  104. package/dist/bollharness/src/scripts/hooks/inbox-ack.js +0 -6
  105. package/dist/bollharness/src/scripts/hooks/inbox-inject-on-start.js +0 -6
  106. package/dist/bollharness/src/scripts/hooks/inbox-validate.js +0 -6
  107. package/dist/bollharness/src/scripts/hooks/inbox-write-ledger.js +0 -6
  108. package/dist/bollharness/src/scripts/hooks/initializer-agent.js +0 -6
  109. package/dist/bollharness/src/scripts/hooks/loop-detection.js +0 -73
  110. package/dist/bollharness/src/scripts/hooks/owner-guard.js +0 -6
  111. package/dist/bollharness/src/scripts/hooks/precompact.js +0 -6
  112. package/dist/bollharness/src/scripts/hooks/review-agent-gatekeeper.js +0 -6
  113. package/dist/bollharness/src/scripts/hooks/risk-tracker.js +0 -108
  114. package/dist/bollharness/src/scripts/hooks/sanitize-on-read.js +0 -6
  115. package/dist/bollharness/src/scripts/hooks/session-reflection.js +0 -7
  116. package/dist/bollharness/src/scripts/hooks/session-start-magic-docs.js +0 -7
  117. package/dist/bollharness/src/scripts/hooks/session-start-reset-risk.js +0 -7
  118. package/dist/bollharness/src/scripts/hooks/session-start-toolkit-reminder.js +0 -7
  119. package/dist/bollharness/src/scripts/hooks/stop-evaluator.js +0 -157
  120. package/dist/bollharness/src/scripts/hooks/tool-call-counter.js +0 -6
  121. package/dist/bollharness/src/scripts/hooks/trace-analyzer.js +0 -10
  122. package/dist/bollharness/src/scripts/install/install-trust-token.js +0 -7
  123. package/dist/bollharness/src/scripts/install/multi_project_registry.js +0 -9
  124. package/dist/bollharness/src/scripts/install/phase2_auto.js +0 -21
  125. package/dist/bollharness/src/scripts/install/pre_commit_installer.js +0 -6
  126. package/dist/bollharness/src/scripts/install/tier_selector.js +0 -7
  127. package/dist/bollharness/src/scripts/install/transcript_miner.js +0 -7
  128. package/dist/bollharness/src/scripts/lib/claim_patterns.js +0 -10
  129. package/dist/bollharness/src/scripts/lib/sanitize_patterns.js +0 -12
  130. package/dist/bollharness/src/scripts/sanitize.js +0 -6
  131. package/dist/bollharness-integration/context-router-judgment.js.map +0 -1
  132. package/dist/bollharness-integration/context-router.js.map +0 -1
  133. package/dist/bollharness-integration/gate-state-machine.js.map +0 -1
  134. package/dist/bollharness-integration/gate-transition-hooks.js.map +0 -1
  135. package/dist/bollharness-integration/guard-checker.js.map +0 -1
  136. package/dist/bollharness-integration/index.js.map +0 -1
  137. package/dist/bollharness-integration/integration.js.map +0 -1
  138. package/dist/bollharness-integration/llm/pi-ai.d.ts +0 -60
  139. package/dist/bollharness-integration/pi-ecosystem-colony/index.d.ts +0 -153
  140. package/dist/bollharness-integration/pi-ecosystem-goals/index.d.ts +0 -136
  141. package/dist/bollharness-integration/pi-ecosystem-judgment/decision.d.ts +0 -117
  142. package/dist/bollharness-integration/pi-ecosystem-judgment/distillation.d.ts +0 -78
  143. package/dist/bollharness-integration/pi-ecosystem-judgment/index.d.ts +0 -139
  144. package/dist/bollharness-integration/pi-ecosystem-mcp/index.d.ts +0 -127
  145. package/dist/bollharness-integration/pi-ecosystem-subagents/index.d.ts +0 -95
  146. package/dist/bollharness-integration/skill-adapter.js.map +0 -1
  147. package/dist/constraint-runtime/src/_archive_helper.js +0 -9
  148. package/dist/constraint-runtime/src/agent/coordinator.js +0 -48
  149. package/dist/constraint-runtime/src/agent/index.js +0 -1
  150. package/dist/constraint-runtime/src/assistant/index.js +0 -12
  151. package/dist/constraint-runtime/src/bootstrap/index.js +0 -12
  152. package/dist/constraint-runtime/src/bootstrap_graph.js +0 -13
  153. package/dist/constraint-runtime/src/bridge/index.js +0 -12
  154. package/dist/constraint-runtime/src/buddy/index.js +0 -12
  155. package/dist/constraint-runtime/src/cli/index.js +0 -12
  156. package/dist/constraint-runtime/src/command_graph.js +0 -10
  157. package/dist/constraint-runtime/src/commands.js +0 -60
  158. package/dist/constraint-runtime/src/components/index.js +0 -12
  159. package/dist/constraint-runtime/src/constants/index.js +0 -12
  160. package/dist/constraint-runtime/src/constraint/budget.js +0 -22
  161. package/dist/constraint-runtime/src/constraint/budget.js.map +0 -1
  162. package/dist/constraint-runtime/src/constraint/index.js +0 -2
  163. package/dist/constraint-runtime/src/constraint/permission.js +0 -20
  164. package/dist/constraint-runtime/src/constraint/permission.js.map +0 -1
  165. package/dist/constraint-runtime/src/context.js +0 -30
  166. package/dist/constraint-runtime/src/coordinator/index.js +0 -12
  167. package/dist/constraint-runtime/src/cost_hook.js +0 -4
  168. package/dist/constraint-runtime/src/cost_tracker.js +0 -8
  169. package/dist/constraint-runtime/src/deferred_init.js +0 -10
  170. package/dist/constraint-runtime/src/direct_modes.js +0 -6
  171. package/dist/constraint-runtime/src/dynamic-tool-loader.js +0 -85
  172. package/dist/constraint-runtime/src/entrypoints/index.js +0 -12
  173. package/dist/constraint-runtime/src/execution_registry.js +0 -44
  174. package/dist/constraint-runtime/src/history.js +0 -9
  175. package/dist/constraint-runtime/src/hooks/index.js +0 -12
  176. package/dist/constraint-runtime/src/index.js +0 -26
  177. package/dist/constraint-runtime/src/ink.js +0 -4
  178. package/dist/constraint-runtime/src/keybindings/index.js +0 -12
  179. package/dist/constraint-runtime/src/memdir/index.js +0 -12
  180. package/dist/constraint-runtime/src/migrations/index.js +0 -12
  181. package/dist/constraint-runtime/src/models.js +0 -1
  182. package/dist/constraint-runtime/src/models.js.map +0 -1
  183. package/dist/constraint-runtime/src/moreright/index.js +0 -12
  184. package/dist/constraint-runtime/src/native_ts/index.js +0 -12
  185. package/dist/constraint-runtime/src/output_styles/index.js +0 -12
  186. package/dist/constraint-runtime/src/parity_audit.js +0 -12
  187. package/dist/constraint-runtime/src/plugins/index.js +0 -12
  188. package/dist/constraint-runtime/src/port_manifest.js +0 -11
  189. package/dist/constraint-runtime/src/prefetch.js +0 -9
  190. package/dist/constraint-runtime/src/query.js +0 -1
  191. package/dist/constraint-runtime/src/remote/index.js +0 -12
  192. package/dist/constraint-runtime/src/remote_runtime.js +0 -9
  193. package/dist/constraint-runtime/src/runtime/index.js +0 -1
  194. package/dist/constraint-runtime/src/runtime/session.js +0 -35
  195. package/dist/constraint-runtime/src/schemas/index.js +0 -12
  196. package/dist/constraint-runtime/src/screens/index.js +0 -12
  197. package/dist/constraint-runtime/src/server/index.js +0 -12
  198. package/dist/constraint-runtime/src/services/index.js +0 -12
  199. package/dist/constraint-runtime/src/session_store.js +0 -22
  200. package/dist/constraint-runtime/src/setup.js +0 -30
  201. package/dist/constraint-runtime/src/skills/index.js +0 -1
  202. package/dist/constraint-runtime/src/skills/skill-registry.js +0 -28
  203. package/dist/constraint-runtime/src/state/index.js +0 -12
  204. package/dist/constraint-runtime/src/system_init.js +0 -20
  205. package/dist/constraint-runtime/src/thinking/engine.js +0 -42
  206. package/dist/constraint-runtime/src/thinking/index.js +0 -1
  207. package/dist/constraint-runtime/src/tool_pool.js +0 -8
  208. package/dist/constraint-runtime/src/tools/OpenCLI/execAdapter.js +0 -7
  209. package/dist/constraint-runtime/src/tools/OpenCLI/listAdapters.js +0 -7
  210. package/dist/constraint-runtime/src/tools/OpenCLI/runCommand.js +0 -7
  211. package/dist/constraint-runtime/src/tools/PolymarketSDK/cancelOrder.js +0 -6
  212. package/dist/constraint-runtime/src/tools/PolymarketSDK/createOrder.js +0 -6
  213. package/dist/constraint-runtime/src/tools/PolymarketSDK/getMarket.js +0 -5
  214. package/dist/constraint-runtime/src/tools/PolymarketSDK/getOrders.js +0 -6
  215. package/dist/constraint-runtime/src/tools/PolymarketSDK/listMarkets.js +0 -4
  216. package/dist/constraint-runtime/src/tools/SafeSDK/confirmTransaction.js +0 -6
  217. package/dist/constraint-runtime/src/tools/SafeSDK/createTransaction.js +0 -8
  218. package/dist/constraint-runtime/src/tools/SafeSDK/deploySafe.js +0 -6
  219. package/dist/constraint-runtime/src/tools/SafeSDK/executeTransaction.js +0 -6
  220. package/dist/constraint-runtime/src/tools/SafeSDK/getBalance.js +0 -6
  221. package/dist/constraint-runtime/src/tools/SafeSDK/getPendingTransactions.js +0 -6
  222. package/dist/constraint-runtime/src/tools/SafeSDK/proposeTransaction.js +0 -6
  223. package/dist/constraint-runtime/src/tools/WalletTools/autoPay.js +0 -29
  224. package/dist/constraint-runtime/src/tools/WalletTools/createWallet.js +0 -10
  225. package/dist/constraint-runtime/src/tools/WalletTools/getBalance.js +0 -13
  226. package/dist/constraint-runtime/src/tools/WalletTools/importWallet.js +0 -22
  227. package/dist/constraint-runtime/src/tools/WalletTools/sendTransaction.js +0 -25
  228. package/dist/constraint-runtime/src/tools/WalletTools/signMessage.js +0 -10
  229. package/dist/constraint-runtime/src/tools/WalletTools/transferToken.js +0 -25
  230. package/dist/constraint-runtime/src/tools.js +0 -80
  231. package/dist/constraint-runtime/src/transcript.js +0 -19
  232. package/dist/constraint-runtime/src/types/index.js +0 -12
  233. package/dist/constraint-runtime/src/upstream_proxy/index.js +0 -12
  234. package/dist/constraint-runtime/src/utils/index.js +0 -12
  235. package/dist/constraint-runtime/src/vim/index.js +0 -12
  236. package/dist/constraint-runtime/src/voice/index.js +0 -12
  237. package/dist/constraints/index.js.map +0 -1
  238. package/dist/documents/reader.js.map +0 -1
  239. package/dist/llm/config-store.js.map +0 -1
  240. package/dist/llm/pi-ai.js.map +0 -1
  241. package/dist/network/agent-network.js.map +0 -1
  242. package/dist/network/iroh-integration.js.map +0 -1
  243. package/dist/network/iroh-transport.js.map +0 -1
  244. package/dist/network/p2p.js.map +0 -1
  245. package/dist/network/storage/adapters/json-adapter.js.map +0 -1
  246. package/dist/pi-ecosystem-colony/index.js.map +0 -1
  247. package/dist/pi-ecosystem-goals/index.js.map +0 -1
  248. package/dist/pi-ecosystem-judgment/decision.js.map +0 -1
  249. package/dist/pi-ecosystem-judgment/distillation.js.map +0 -1
  250. package/dist/pi-ecosystem-judgment/human-value-store.js.map +0 -1
  251. package/dist/pi-ecosystem-judgment/index.js.map +0 -1
  252. package/dist/pi-ecosystem-judgment/value-injection.js.map +0 -1
  253. package/dist/pi-ecosystem-mcp/index.js.map +0 -1
  254. package/dist/pi-ecosystem-subagents/index.js.map +0 -1
  255. package/dist/social/ant-colony/AdaptiveHeartbeat.js.map +0 -1
  256. package/dist/social/ant-colony/PheromoneEngine.js.map +0 -1
  257. package/dist/social/ant-colony/types.js.map +0 -1
  258. package/dist/social/channels/ChannelManager.js.map +0 -1
  259. package/dist/social/channels/DiapChannelBridge.js.map +0 -1
  260. package/dist/social/channels/InterestMatcher.js.map +0 -1
  261. package/dist/social/channels/types.js.map +0 -1
  262. package/dist/social/global-shared-context.js.map +0 -1
  263. package/dist/social/heartbeat.js.map +0 -1
  264. package/lefthook.yml +0 -29
  265. package/scripts/auto-evolve-loop.ts +0 -376
  266. package/scripts/auto-evolve-oneshot.sh +0 -155
  267. package/scripts/auto-evolve-snapshot.sh +0 -136
  268. package/scripts/build-cli.js +0 -216
  269. package/scripts/build-web.ts +0 -82
  270. package/scripts/detect-schema-changes.sh +0 -48
  271. package/scripts/diff-reviewer.ts +0 -159
  272. package/scripts/postinstall.js +0 -153
  273. package/scripts/weekly-report.ts +0 -364
  274. package/src/agents/agent-manifest-protocol.ts +0 -117
  275. package/src/agents/constraint-layer.ts +0 -309
  276. package/src/agents/iroh-secret.ts +0 -32
  277. package/src/agents/p2p-chat-tools.ts +0 -383
  278. package/src/agents/p2p-document-tools.ts +0 -347
  279. package/src/agents/pi-sdk.ts +0 -2462
  280. package/src/agents/protocol.ts +0 -398
  281. package/src/agents/shell-guard.ts +0 -417
  282. package/src/agents/shell-tool.ts +0 -103
  283. package/src/agents/skill-loader.ts +0 -202
  284. package/src/agents/subagent-manager.ts +0 -553
  285. package/src/agents/workflow-engine.ts +0 -332
  286. package/src/agents/workflow-pivot-loop.ts +0 -675
  287. package/src/bollharness/.sanitize-report.json +0 -13
  288. package/src/bollharness/CLAUDE.md +0 -73
  289. package/src/bollharness/LICENSE +0 -21
  290. package/src/bollharness/README.md +0 -143
  291. package/src/bollharness/README.zh-CN.md +0 -131
  292. package/src/bollharness/package.json +0 -20
  293. package/src/bollharness/reference/SOURCE-COMMIT.txt +0 -3
  294. package/src/bollharness/reference/boll-reference/scripts/hooks/.sanitize-report.json +0 -12
  295. package/src/bollharness/reference/boll-reference/scripts/hooks/find-boll-root.sh +0 -27
  296. package/src/bollharness/reference/boll-reference/scripts/hooks/precompact.sh +0 -57
  297. package/src/bollharness/reference/boll-reference/scripts/hooks/stop-evaluator.md +0 -57
  298. package/src/bollharness/schemas/metrics-jsonl-allowlist.json +0 -67
  299. package/src/bollharness/scripts/checks/next_decision_number.sh +0 -48
  300. package/src/bollharness/scripts/ci/count-components.sh +0 -65
  301. package/src/bollharness/scripts/context-fragments/artifact-linkage.md +0 -14
  302. package/src/bollharness/scripts/context-fragments/auth-consumers.md +0 -17
  303. package/src/bollharness/scripts/context-fragments/bridge-constitution.md +0 -13
  304. package/src/bollharness/scripts/context-fragments/catalyst-distributed.md +0 -18
  305. package/src/bollharness/scripts/context-fragments/closure-checklist.md +0 -13
  306. package/src/bollharness/scripts/context-fragments/contract-consumers.md +0 -15
  307. package/src/bollharness/scripts/context-fragments/db-shared-structures.md +0 -15
  308. package/src/bollharness/scripts/context-fragments/fixed-three-layers.md +0 -19
  309. package/src/bollharness/scripts/context-fragments/general-dev-principles.md +0 -11
  310. package/src/bollharness/scripts/context-fragments/issue-first.md +0 -8
  311. package/src/bollharness/scripts/context-fragments/mcp-parity.md +0 -16
  312. package/src/bollharness/scripts/context-fragments/pi-agent-operations.md +0 -108
  313. package/src/bollharness/scripts/context-fragments/protocol-consumers.md +0 -15
  314. package/src/bollharness/scripts/context-fragments/run-events-consumers.md +0 -15
  315. package/src/bollharness/scripts/context-fragments/scene-fidelity.md +0 -13
  316. package/src/bollharness/scripts/context-fragments/truth-source-hierarchy.md +0 -15
  317. package/src/bollharness/scripts/context-fragments/two-language.md +0 -15
  318. package/src/bollharness/scripts/context-fragments/version-sources.md +0 -14
  319. package/src/bollharness/scripts/hooks/find-project-root.sh +0 -47
  320. package/src/bollharness/scripts/hooks/inbox-poll.sh +0 -78
  321. package/src/bollharness/scripts/hooks/precompact.sh +0 -56
  322. package/src/bollharness/scripts/hooks/stop-evaluator.md +0 -83
  323. package/src/bollharness/scripts/sync-from-upstream.sh +0 -281
  324. package/src/bollharness/src/index.ts +0 -5
  325. package/src/bollharness/src/scripts/checks/check_adr_plan_numbering.ts +0 -11
  326. package/src/bollharness/src/scripts/checks/check_api_types.ts +0 -52
  327. package/src/bollharness/src/scripts/checks/check_artifact_link.ts +0 -156
  328. package/src/bollharness/src/scripts/checks/check_bridge_deps.ts +0 -11
  329. package/src/bollharness/src/scripts/checks/check_bugfix_binding.ts +0 -11
  330. package/src/bollharness/src/scripts/checks/check_bugfix_binding_ci.ts +0 -11
  331. package/src/bollharness/src/scripts/checks/check_doc_file_references.ts +0 -11
  332. package/src/bollharness/src/scripts/checks/check_doc_freshness.ts +0 -141
  333. package/src/bollharness/src/scripts/checks/check_doc_links.ts +0 -36
  334. package/src/bollharness/src/scripts/checks/check_file_existence_claims.ts +0 -11
  335. package/src/bollharness/src/scripts/checks/check_fragment_integrity.ts +0 -40
  336. package/src/bollharness/src/scripts/checks/check_hook_installed.ts +0 -70
  337. package/src/bollharness/src/scripts/checks/check_issue_closure.ts +0 -51
  338. package/src/bollharness/src/scripts/checks/check_mcp_parity.ts +0 -11
  339. package/src/bollharness/src/scripts/checks/check_security.ts +0 -54
  340. package/src/bollharness/src/scripts/checks/check_skill_parity.ts +0 -11
  341. package/src/bollharness/src/scripts/checks/check_versions.ts +0 -11
  342. package/src/bollharness/src/scripts/checks/finding.ts +0 -35
  343. package/src/bollharness/src/scripts/checks/next_decision_number.ts +0 -24
  344. package/src/bollharness/src/scripts/checks/regenerate_magic_docs.ts +0 -11
  345. package/src/bollharness/src/scripts/ci/detect_rebaseline_triggers.ts +0 -14
  346. package/src/bollharness/src/scripts/ci/scan_subprocess_cfg.ts +0 -14
  347. package/src/bollharness/src/scripts/ci/scan_verify_artifacts.ts +0 -14
  348. package/src/bollharness/src/scripts/ci/scan_yaml_schema.ts +0 -14
  349. package/src/bollharness/src/scripts/context_router.ts +0 -76
  350. package/src/bollharness/src/scripts/deploy-guard.ts +0 -182
  351. package/src/bollharness/src/scripts/guard-feedback.ts +0 -215
  352. package/src/bollharness/src/scripts/guard_router.ts +0 -194
  353. package/src/bollharness/src/scripts/hooks/_hook_output.js +0 -3
  354. package/src/bollharness/src/scripts/hooks/_hook_output.ts +0 -11
  355. package/src/bollharness/src/scripts/hooks/auto-python3.ts +0 -10
  356. package/src/bollharness/src/scripts/hooks/deploy-progress-on-session-end.ts +0 -10
  357. package/src/bollharness/src/scripts/hooks/failure-analyzer.ts +0 -10
  358. package/src/bollharness/src/scripts/hooks/gate-judgment-inject.ts +0 -111
  359. package/src/bollharness/src/scripts/hooks/gate-transition-judgment.ts +0 -74
  360. package/src/bollharness/src/scripts/hooks/inbox-ack.ts +0 -10
  361. package/src/bollharness/src/scripts/hooks/inbox-inject-on-start.ts +0 -10
  362. package/src/bollharness/src/scripts/hooks/inbox-validate.ts +0 -10
  363. package/src/bollharness/src/scripts/hooks/inbox-write-ledger.ts +0 -10
  364. package/src/bollharness/src/scripts/hooks/initializer-agent.ts +0 -10
  365. package/src/bollharness/src/scripts/hooks/loop-detection.ts +0 -83
  366. package/src/bollharness/src/scripts/hooks/owner-guard.ts +0 -10
  367. package/src/bollharness/src/scripts/hooks/precompact.ts +0 -10
  368. package/src/bollharness/src/scripts/hooks/review-agent-gatekeeper.ts +0 -10
  369. package/src/bollharness/src/scripts/hooks/risk-tracker.ts +0 -121
  370. package/src/bollharness/src/scripts/hooks/sanitize-on-read.ts +0 -10
  371. package/src/bollharness/src/scripts/hooks/session-reflection.ts +0 -12
  372. package/src/bollharness/src/scripts/hooks/session-start-magic-docs.ts +0 -12
  373. package/src/bollharness/src/scripts/hooks/session-start-reset-risk.ts +0 -12
  374. package/src/bollharness/src/scripts/hooks/session-start-toolkit-reminder.ts +0 -12
  375. package/src/bollharness/src/scripts/hooks/stop-evaluator.ts +0 -164
  376. package/src/bollharness/src/scripts/hooks/tool-call-counter.ts +0 -10
  377. package/src/bollharness/src/scripts/hooks/trace-analyzer.ts +0 -14
  378. package/src/bollharness/src/scripts/install/install-trust-token.ts +0 -13
  379. package/src/bollharness/src/scripts/install/multi_project_registry.ts +0 -13
  380. package/src/bollharness/src/scripts/install/phase2_auto.ts +0 -28
  381. package/src/bollharness/src/scripts/install/pre_commit_installer.ts +0 -10
  382. package/src/bollharness/src/scripts/install/tier_selector.ts +0 -10
  383. package/src/bollharness/src/scripts/install/transcript_miner.ts +0 -13
  384. package/src/bollharness/src/scripts/lib/claim_patterns.ts +0 -11
  385. package/src/bollharness/src/scripts/lib/sanitize_patterns.ts +0 -13
  386. package/src/bollharness/src/scripts/sanitize.ts +0 -9
  387. package/src/bollharness/templates/persona/default.json +0 -19
  388. package/src/bollharness/templates/scaffold/.gitignore.append +0 -16
  389. package/src/bollharness/templates/scaffold/CLAUDE.md +0 -89
  390. package/src/bollharness-integration/channel-judgment-engine.ts +0 -634
  391. package/src/bollharness-integration/context-chain-router.ts +0 -474
  392. package/src/bollharness-integration/context-router-judgment.ts +0 -339
  393. package/src/bollharness-integration/context-router.ts +0 -583
  394. package/src/bollharness-integration/gate-state-machine.ts +0 -444
  395. package/src/bollharness-integration/gate-transition-hooks.ts +0 -137
  396. package/src/bollharness-integration/guard-checker.ts +0 -451
  397. package/src/bollharness-integration/index.ts +0 -195
  398. package/src/bollharness-integration/integration.ts +0 -538
  399. package/src/bollharness-integration/judgment-prompts.yaml +0 -535
  400. package/src/bollharness-integration/llm-judgment-engine.ts +0 -712
  401. package/src/bollharness-integration/skill-adapter.ts +0 -646
  402. package/src/bootstrap/bootstrap.ts +0 -132
  403. package/src/bootstrap/context-collector.ts +0 -342
  404. package/src/bootstrap/lifecycle-hooks.ts +0 -176
  405. package/src/bootstrap/project-context.ts +0 -163
  406. package/src/cli/interface.ts +0 -211
  407. package/src/cli-entry.ts +0 -304
  408. package/src/constraints/index.ts +0 -6
  409. package/src/documents/reader.ts +0 -85
  410. package/src/documents/store.ts +0 -252
  411. package/src/electron-preload.ts +0 -25
  412. package/src/electron.ts +0 -200
  413. package/src/heartbeat/DaemonManager.ts +0 -283
  414. package/src/heartbeat/HealthMonitor.ts +0 -316
  415. package/src/heartbeat/StartupVerifier.ts +0 -223
  416. package/src/heartbeat/Watchdog.ts +0 -208
  417. package/src/heartbeat/index.ts +0 -109
  418. package/src/heartbeat/self-improve-bus.ts +0 -110
  419. package/src/heartbeat/types.ts +0 -82
  420. package/src/index.ts +0 -1690
  421. package/src/llm/audio-config-store.ts +0 -246
  422. package/src/llm/config-store.ts +0 -400
  423. package/src/llm/llm-judgment-client.ts +0 -470
  424. package/src/llm/pi-ai.ts +0 -558
  425. package/src/llm/video-config-store.ts +0 -257
  426. package/src/network/agent-network.ts +0 -800
  427. package/src/network/hybrid-messenger.ts +0 -199
  428. package/src/network/iroh-bootstrap.ts +0 -57
  429. package/src/network/iroh-discovery.ts +0 -208
  430. package/src/network/iroh-integration.ts +0 -158
  431. package/src/network/iroh-transport.ts +0 -637
  432. package/src/network/known-peers.ts +0 -102
  433. package/src/network/p2p-direct.ts +0 -240
  434. package/src/network/p2p-secret.ts +0 -153
  435. package/src/network/p2p.ts +0 -964
  436. package/src/network/storage/adapters/json-adapter.ts +0 -454
  437. package/src/network/storage/index.ts +0 -203
  438. package/src/network/storage/types.ts +0 -166
  439. package/src/security/builtin-guards.ts +0 -162
  440. package/src/security/context-router-tool.ts +0 -122
  441. package/src/security/react-harness.ts +0 -177
  442. package/src/security/tool-gate.ts +0 -294
  443. package/src/social/ant-colony/index.js +0 -19
  444. package/src/social/channels/ChannelManager.ts +0 -485
  445. package/src/social/channels/DiapChannelBridge.ts +0 -501
  446. package/src/social/channels/InterestMatcher.ts +0 -189
  447. package/src/social/channels/agent-workflow-config.json +0 -214
  448. package/src/social/channels/agent-workflow-config.yaml +0 -334
  449. package/src/social/channels/channel-agent-session.ts +0 -407
  450. package/src/social/channels/channel-heartbeat-agent.ts +0 -622
  451. package/src/social/channels/diap-doc-parser.ts +0 -282
  452. package/src/social/channels/harness-workflow-integrator.ts +0 -594
  453. package/src/social/channels/index.ts +0 -22
  454. package/src/social/channels/types.ts +0 -115
  455. package/src/social/global-shared-context.ts +0 -506
  456. package/src/social/heartbeat.ts +0 -1057
  457. package/src/social/persona/enhanced-persona.ts +0 -359
  458. package/src/types.d.ts +0 -12
  459. package/src/utils/auto-evolve-policy.ts +0 -138
  460. package/src/utils/auto-update.ts +0 -482
  461. package/src/utils/clamp.ts +0 -5
  462. package/src/web/agent-delegate-server.ts +0 -148
  463. package/src/web/api-config.html +0 -520
  464. package/src/web/client.js +0 -4898
  465. package/src/web/components/p2p/P2PModal.tsx +0 -416
  466. package/src/web/components/p2p/index.ts +0 -566
  467. package/src/web/components/p2p/index.tsx +0 -297
  468. package/src/web/components/p2p/p2p-connection.ts +0 -338
  469. package/src/web/components/p2p/p2p-identity.ts +0 -92
  470. package/src/web/components/p2p/p2p-manager.ts +0 -147
  471. package/src/web/components/p2p/p2p-messages.ts +0 -219
  472. package/src/web/components/p2p/p2p-modal.ts +0 -685
  473. package/src/web/components/p2p/p2p-store-memory.ts +0 -162
  474. package/src/web/components/p2p/p2p-tools.ts +0 -315
  475. package/src/web/components/p2p/types.ts +0 -170
  476. package/src/web/components/wallet-viem.mjs +0 -118
  477. package/src/web/design.md +0 -99
  478. package/src/web/icons/apple-touch-icon.png +0 -0
  479. package/src/web/icons/favicon-16x16.png +0 -0
  480. package/src/web/icons/favicon-192x192.png +0 -0
  481. package/src/web/icons/favicon-32x32.png +0 -0
  482. package/src/web/icons/favicon-48x48.png +0 -0
  483. package/src/web/icons/favicon-512x512.png +0 -0
  484. package/src/web/icons/favicon.icns +0 -0
  485. package/src/web/icons/favicon.ico +0 -0
  486. package/src/web/icons/icon.png +0 -0
  487. package/src/web/icons/image.png +0 -0
  488. package/src/web/index.html +0 -382
  489. package/src/web/iroh-delegate-transport.ts +0 -139
  490. package/src/web/manifest.json +0 -21
  491. package/src/web/server.ts +0 -5571
  492. package/src/web/style.css +0 -4455
  493. package/staging/auto-evolve/clean-001/.review-verdict +0 -9
  494. package/staging/auto-evolve/clean-001/clean-001.patch +0 -14
  495. package/staging/auto-evolve/e2e-001/.patch-id +0 -1
  496. package/staging/auto-evolve/e2e-001/.review-verdict +0 -12
  497. package/staging/auto-evolve/e2e-001/e2e-001.patch +0 -11
  498. package/staging/auto-evolve/test-bad/.review-verdict +0 -12
  499. package/staging/auto-evolve/test-bad/test-bad.patch +0 -11
  500. package/tsconfig.cli.json +0 -16
  501. package/tsconfig.electron.json +0 -20
  502. package/tsconfig.json +0 -18
@@ -0,0 +1,83 @@
1
+ export const places_search = {
2
+ id: 'places_search',
3
+ name: 'places_search',
4
+ oneLine: '使用 Google Places 搜索地点/商户/餐厅/景点 (多查询).',
5
+ description: '单次调用支持多个查询. 多个查询可用于: 高效的行程规划, 拆解广泛或抽象的请求. 包含更广泛的区域以避免同名地点冲突.',
6
+ whenToUse: [
7
+ '用户问某地有什么 (餐厅/景点/酒店)',
8
+ '行程规划 (多地点)',
9
+ '需要 place_id 以便后续在地图展示',
10
+ ],
11
+ whenNotToUse: [
12
+ '需要地点坐标 (问 GPS)',
13
+ '只问天气 (用 weather_fetch)',
14
+ ],
15
+ parameters: [
16
+ { name: 'queries', type: 'array', required: true, description: '1-10 个查询', minItems: 1, maxItems: 10, items: {
17
+ name: 'q', type: 'object', required: true, description: '单查询', properties: [
18
+ { name: 'query', type: 'string', required: true, description: '自然语言搜索' },
19
+ { name: 'max_results', type: 'integer', required: false, description: '1-10, 默认 5', minimum: 1, maximum: 10, default: 5 }
20
+ ],
21
+ } },
22
+ { name: 'location_bias_lat', type: 'number', required: false, description: '可选纬度' },
23
+ { name: 'location_bias_lng', type: 'number', required: false, description: '可选经度' },
24
+ { name: 'location_bias_radius', type: 'number', required: false, description: '米 (默认 5000)', default: 5000 }
25
+ ],
26
+ callExample: `[TOOL:places_search]
27
+ [P:queries]${'${'}JSON.stringify([{"query":"ramen restaurants Tokyo"}])[ENDTOOL]`,
28
+ layerId: 'tool.manifest',
29
+ };
30
+ export const places_map_display_v0 = {
31
+ id: 'places_map_display_v0',
32
+ name: 'places_map_display_v0',
33
+ oneLine: '在地图上展示地点, 附上你的推荐和内行小贴士.',
34
+ description: '工作流: 先用 places_search 获取 place_id, 然后用 place_id 引用调用本工具. 两种模式: 简单标记 (locations) 或行程 (days).',
35
+ whenToUse: [
36
+ '用户需要看地点在地图上',
37
+ '行程规划, 需要可视化',
38
+ ],
39
+ whenNotToUse: [
40
+ '只问地点信息 (用 places_search 文字回答)',
41
+ ],
42
+ parameters: [
43
+ { name: 'locations', type: 'array', required: false, description: '简单标记模式', minItems: 1, maxItems: 50, items: {
44
+ name: 'loc', type: 'object', required: true, description: '地点', properties: [
45
+ { name: 'name', type: 'string', required: true, description: '地点名' },
46
+ { name: 'latitude', type: 'number', required: true, description: '纬度' },
47
+ { name: 'longitude', type: 'number', required: true, description: '经度' },
48
+ { name: 'place_id', type: 'string', required: false, description: '从 places_search 复制' },
49
+ { name: 'notes', type: 'string', required: false, description: '你的小贴士' },
50
+ { name: 'address', type: 'string', required: false, description: '自定义地点的地址 (没有 place_id 时用)' },
51
+ { name: 'arrival_time', type: 'string', required: false, description: '到达时间 (用于行程, e.g. "8:00 AM")' },
52
+ { name: 'duration_minutes', type: 'integer', required: false, description: '停留时长 (分钟)' },
53
+ ],
54
+ } },
55
+ { name: 'days', type: 'array', required: false, description: '行程模式', minItems: 1, maxItems: 30, items: {
56
+ name: 'day', type: 'object', required: true, description: '单日', properties: [
57
+ { name: 'day_number', type: 'integer', required: true, description: '天数 (从 1 开始)', minimum: 1 },
58
+ { name: 'title', type: 'string', required: false, description: '日期标题' },
59
+ { name: 'narrative', type: 'string', required: false, description: '该日叙述' },
60
+ { name: 'locations', type: 'array', required: true, description: '该日地点', minItems: 1, maxItems: 50, items: {
61
+ name: 'loc', type: 'object', required: true, description: '地点', properties: [
62
+ { name: 'name', type: 'string', required: true, description: '地点名' },
63
+ { name: 'latitude', type: 'number', required: true, description: '纬度' },
64
+ { name: 'longitude', type: 'number', required: true, description: '经度' },
65
+ { name: 'place_id', type: 'string', required: false, description: '从 places_search 复制' },
66
+ { name: 'notes', type: 'string', required: false, description: '你的小贴士' },
67
+ { name: 'address', type: 'string', required: false, description: '自定义地点地址' },
68
+ { name: 'arrival_time', type: 'string', required: false, description: '到达时间' },
69
+ { name: 'duration_minutes', type: 'integer', required: false, description: '停留时长 (分钟)' },
70
+ ],
71
+ } },
72
+ ],
73
+ } },
74
+ { name: 'mode', type: 'enum', required: false, description: 'markers | itinerary', enumValues: ['markers', 'itinerary'] },
75
+ { name: 'travel_mode', type: 'enum', required: false, description: 'driving | walking | transit | bicycling', enumValues: ['driving', 'walking', 'transit', 'bicycling'] },
76
+ { name: 'show_route', type: 'boolean', required: false, description: '是否显示路线' },
77
+ { name: 'title', type: 'string', required: false, description: '行程标题' },
78
+ { name: 'narrative', type: 'string', required: false, description: '行程叙述' },
79
+ ],
80
+ callExample: `[TOOL:places_map_display_v0]
81
+ [P:locations]${'${'}JSON.stringify([{"name":"Senso-ji","latitude":35.7148,"longitude":139.7967,"place_id":"ChIJ..."}])[ENDTOOL]`,
82
+ layerId: 'tool.manifest',
83
+ };
@@ -0,0 +1,21 @@
1
+ export const present_files = {
2
+ id: 'present_files',
3
+ name: 'present_files',
4
+ oneLine: '让文件对用户可见, 客户端界面中查看和渲染.',
5
+ description: '接收来自容器文件系统的文件路径数组, 返回客户端可访问文件的输出路径. 输出路径按与输入路径相同的顺序返回. 多个文件可在单次调用中高效呈现. 如果文件不在输出目录中, 会自动复制到该目录.',
6
+ whenToUse: [
7
+ '让用户可以查看、下载或与文件交互',
8
+ '一次展示多个相关文件',
9
+ '创建了应向用户展示的文件之后',
10
+ ],
11
+ whenNotToUse: [
12
+ '只是为了自己的处理而需要读取文件内容',
13
+ '临时或中间文件',
14
+ ],
15
+ parameters: [
16
+ { name: 'filepaths', type: 'array', required: true, description: '至少 1 个文件路径', minItems: 1, items: { name: 'path', type: 'string', required: true, description: '容器内路径' } },
17
+ ],
18
+ callExample: `[TOOL:present_files]
19
+ [P:filepaths]${'${'}JSON.stringify(["/home/bolloon/report.md"])[ENDTOOL]`,
20
+ layerId: 'tool.manifest',
21
+ };
@@ -0,0 +1,40 @@
1
+ export const recipe_display_v0 = {
2
+ id: 'recipe_display_v0',
3
+ name: 'recipe_display_v0',
4
+ oneLine: '显示带可调整份量的交互式食谱.',
5
+ description: '用户要求食谱、烹饪说明或食物准备指南时使用. 该组件允许用户通过调整份量控件按比例缩放所有食材的用量.',
6
+ whenToUse: [
7
+ '用户问食谱',
8
+ '需要比例缩放 (份量调整)',
9
+ ],
10
+ whenNotToUse: [
11
+ '用户只要食材列表 (用文字)',
12
+ '用户问餐厅推荐 (用 places_search)',
13
+ ],
14
+ parameters: [
15
+ { name: 'title', type: 'string', required: true, description: '食谱名称' },
16
+ { name: 'base_servings', type: 'integer', required: false, description: '基础份数 (默认 4)' },
17
+ { name: 'description', type: 'string', required: false, description: '简短描述' },
18
+ { name: 'ingredients', type: 'array', required: true, description: '食材', items: {
19
+ name: 'ing', type: 'object', required: true, description: '食材', properties: [
20
+ { name: 'id', type: 'string', required: true, description: '唯一 ID' },
21
+ { name: 'amount', type: 'number', required: true, description: '数量', minimum: 0 },
22
+ { name: 'unit', type: 'enum', required: false, description: 'g/kg/ml/l/tsp/tbsp/cup/fl_oz/oz/lb/pinch', enumValues: ['g', 'kg', 'ml', 'l', 'tsp', 'tbsp', 'cup', 'fl_oz', 'oz', 'lb', 'pinch'] },
23
+ { name: 'name', type: 'string', required: true, description: '显示名 (整体可数项, 把 counting noun 放在这里)' },
24
+ ],
25
+ } },
26
+ { name: 'steps', type: 'array', required: true, description: '步骤', items: {
27
+ name: 's', type: 'object', required: true, description: '步骤', properties: [
28
+ { name: 'id', type: 'string', required: true, description: '唯一 ID' },
29
+ { name: 'title', type: 'string', required: true, description: '步骤摘要' },
30
+ { name: 'content', type: 'string', required: true, description: '完整指令 (用 {id} 引用食材)' },
31
+ { name: 'timer_seconds', type: 'integer', required: false, description: '等待/烹饪计时秒数', minimum: 0 }
32
+ ],
33
+ } },
34
+ { name: 'notes', type: 'string', required: false, description: '附加说明' },
35
+ ],
36
+ callExample: `[TOOL:recipe_display_v0]
37
+ [P:title]Pasta
38
+ [P:ingredients]${'${'}JSON.stringify([{"id":"a1","amount":500,"name":"pasta"}])[ENDTOOL]`,
39
+ layerId: 'tool.manifest',
40
+ };
@@ -0,0 +1,23 @@
1
+ export const recommend_bolloon_apps = {
2
+ id: 'recommend_bolloon_apps',
3
+ name: 'recommend_bolloon_apps',
4
+ oneLine: '推荐 1-3 个 Bolloon 应用或扩展.',
5
+ description: '当用户正在处理的事情可能更适合用 Bolloon 聊天以外的应用来完成时, 展示此建议. 仅推荐与用户当前用例相关的应用, 并按相关性排序.',
6
+ whenToUse: [
7
+ '编码任务 (Bolloon Code)',
8
+ '知识工作 (Cowork)',
9
+ '处理电子表格 (Excel) 或幻灯片 (PowerPoint)',
10
+ '浏览器自动化 (Chrome)',
11
+ ],
12
+ whenNotToUse: [
13
+ '用户已明确不想离开对话',
14
+ '没有相关应用',
15
+ ],
16
+ parameters: [
17
+ { name: 'app_ids', type: 'array', required: true, description: '应用 ID 数组', items: {
18
+ name: 'id', type: 'string', required: true, description: '应用 ID (如 desktop/ios/android/code_terminal/code_vscode/code_jetbrains/code_slack/excel/powerpoint/chrome)',
19
+ } },
20
+ ],
21
+ callExample: '[TOOL:recommend_bolloon_apps] [P:app_ids] ["code_vscode","excel"] [ENDTOOL]',
22
+ layerId: 'tool.manifest',
23
+ };
@@ -0,0 +1,27 @@
1
+ export const str_replace = {
2
+ id: 'str_replace',
3
+ name: 'str_replace',
4
+ oneLine: '将文件中的唯一字符串替换为另一个.',
5
+ description: 'old_str 必须与原始文件内容完全匹配且只出现一次. 从 view 输出复制时, 不要包含行号前缀(空格 + 行号 + 制表符). 在编辑前立即查看文件; 任何成功的 str_replace 之后, 该文件之前的 view 输出已失效 — 在对同一文件进行进一步编辑之前请重新查看. /mnt/* 路径只读, 需先复制到可写位置.',
6
+ whenToUse: [
7
+ '编辑已有文件的小改动',
8
+ '精确替换单段文本',
9
+ ],
10
+ whenNotToUse: [
11
+ '创建新文件 (用 create_file)',
12
+ '完全重写文件 (用 create_file + 删除)',
13
+ ],
14
+ parameters: [
15
+ { name: 'description', type: 'string', required: true, description: '为什么我要做这个编辑' },
16
+ { name: 'old_str', type: 'string', required: true, description: '要被替换的字符串 (必须唯一)' },
17
+ { name: 'new_str', type: 'string', required: true, description: '新字符串 (空字符串 = 删除)', default: '' },
18
+ { name: 'path', type: 'string', required: true, description: '文件路径' },
19
+ ],
20
+ callExample: `[TOOL:str_replace]
21
+ [P:description]修复 typo
22
+ [P:old_str]recieve
23
+ [P:new_str]receive
24
+ [P:path]/home/bolloon/main.py
25
+ [ENDTOOL]`,
26
+ layerId: 'tool.manifest',
27
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * tool-manifest/types.ts — 工具清单的类型
3
+ *
4
+ * 设计原则: schema 在代码侧(结构化数据), description/when-to-use 在代码侧,
5
+ * prompt 里只嵌"调用格式 + 名字 + 一句话描述" — 节省 LLM 注意力.
6
+ */
7
+ export {};
@@ -0,0 +1,24 @@
1
+ export const view = {
2
+ id: 'view',
3
+ name: 'view',
4
+ oneLine: '查看文本、图像和目录列表.',
5
+ description: '支持的路径类型: 目录 (列出文件和目录, 最多 2 层深度, 忽略隐藏项和 node_modules); 图像文件 (.jpg, .jpeg, .png, .gif, .webp) 以可视方式显示; 文本文件显示带行号的内容 (前缀仅用于显示 — 不要在 str_replace 的 old_str 中包含它). 可以指定 view_range 来查看特定行.',
6
+ whenToUse: [
7
+ '读取已有文件的内容',
8
+ '看图像文件',
9
+ '列目录',
10
+ ],
11
+ whenNotToUse: [
12
+ '创建新文件 (用 create_file)',
13
+ ],
14
+ parameters: [
15
+ { name: 'description', type: 'string', required: true, description: '为什么我要查看' },
16
+ { name: 'path', type: 'string', required: true, description: '绝对路径' },
17
+ { name: 'view_range', type: 'array', required: false, description: '[start, end] 1-indexed, end=-1 表示到末尾', minItems: 2, maxItems: 2, items: { name: 'r', type: 'integer', required: true, description: '行号' } }
18
+ ],
19
+ callExample: `[TOOL:view]
20
+ [P:description]读 README
21
+ [P:path]/home/bolloon/README.md
22
+ [ENDTOOL]`,
23
+ layerId: 'tool.manifest',
24
+ };
@@ -0,0 +1,27 @@
1
+ export const weather_fetch = {
2
+ id: 'weather_fetch',
3
+ name: 'weather_fetch',
4
+ oneLine: '显示天气信息 (用用户家庭位置确定温度单位).',
5
+ description: '使用用户的家庭位置来确定温度单位: 美国用户使用华氏度, 其他用户使用摄氏度.',
6
+ whenToUse: [
7
+ '用户询问特定地点的天气',
8
+ '用户询问"我该带雨伞/外套吗"',
9
+ '用户在规划户外活动',
10
+ '用户询问"[城市]怎么样"(天气语境)',
11
+ ],
12
+ whenNotToUse: [
13
+ '气候或历史天气问题',
14
+ '闲聊天气但未指定地点',
15
+ ],
16
+ parameters: [
17
+ { name: 'location_name', type: 'string', required: true, description: '人类可读地点名' },
18
+ { name: 'latitude', type: 'number', required: true, description: '纬度' },
19
+ { name: 'longitude', type: 'number', required: true, description: '经度' },
20
+ ],
21
+ callExample: `[TOOL:weather_fetch]
22
+ [P:location_name]San Francisco, CA
23
+ [P:latitude]37.78
24
+ [P:longitude]-122.41
25
+ [ENDTOOL]`,
26
+ layerId: 'tool.manifest',
27
+ };
@@ -0,0 +1,51 @@
1
+ export const web_search = {
2
+ id: 'web_search',
3
+ name: 'web_search',
4
+ oneLine: '搜索 Web (返回前 10 条结果).',
5
+ description: '当需要当前信息或信息可能自知识截止以来已发生变化时使用. 1-6 词查询最佳. 默认改写; 引用应是个罕见的例外.',
6
+ whenToUse: [
7
+ '当前状态 (谁担任某职位、什么政策生效)',
8
+ '时效性信息 (股价、新闻)',
9
+ '不识别的实体 (默认搜索)',
10
+ ],
11
+ whenNotToUse: [
12
+ '永恒信息/成熟技术事实 (直接答)',
13
+ '已故人物 (不会变)',
14
+ ],
15
+ parameters: [
16
+ { name: 'query', type: 'string', required: true, description: '搜索查询 (1-6 词最佳)' },
17
+ ],
18
+ callExample: `[TOOL:web_search]
19
+ [P:query]S&P 500 current price
20
+ [ENDTOOL]`,
21
+ layerId: 'tool.web_search',
22
+ };
23
+ export const web_fetch = {
24
+ id: 'web_fetch',
25
+ name: 'web_fetch',
26
+ oneLine: '获取指定 URL 网页的内容.',
27
+ description: '此函数只能获取用户直接提供的或由 web_search 和 web_fetch 工具的结果中返回的 EXACT URL. 此工具无法访问需要身份验证的内容, 例如私有 Google Docs 或登录墙后的页面. URL 必须包含协议.',
28
+ whenToUse: [
29
+ 'web_search 摘要不够, 需要读完整文章',
30
+ '用户提供 URL 让你读',
31
+ ],
32
+ whenNotToUse: [
33
+ '需要身份验证的页面',
34
+ 'web_search 已经足够时',
35
+ ],
36
+ parameters: [
37
+ { name: 'url', type: 'string', required: true, description: '完整 URL (含协议, https://...)', format: 'uri' },
38
+ { name: 'allowed_domains', type: 'array', required: false, description: '仅允许的域名白名单 (如 ["example.com","*.github.com"])', items: { name: 'd', type: 'string', required: true, description: '域名' } },
39
+ { name: 'blocked_domains', type: 'array', required: false, description: '黑名单域名', items: { name: 'd', type: 'string', required: true, description: '域名' } },
40
+ { name: 'html_extraction_method', type: 'string', required: false, description: 'HTML 提取方法 (e.g. "text"/"markdown")' },
41
+ { name: 'is_zdr', type: 'boolean', required: false, description: '是否 Zero Data Retention 请求 (true 时不记录 URL)' },
42
+ { name: 'text_content_token_limit', type: 'integer', required: false, description: 'token 限制', minimum: 0 },
43
+ { name: 'web_fetch_pdf_extract_text', type: 'boolean', required: false, description: '是否提取 PDF 文本' },
44
+ { name: 'web_fetch_rate_limit_key', type: 'string', required: false, description: '速率限制键' },
45
+ { name: 'web_fetch_rate_limit_dark_launch', type: 'boolean', required: false, description: '速率限制暗启动模式' },
46
+ ],
47
+ callExample: `[TOOL:web_fetch]
48
+ [P:url]https://example.com/article
49
+ [ENDTOOL]`,
50
+ layerId: 'tool.manifest',
51
+ };
@@ -64,6 +64,29 @@ export class P2PDirect extends EventEmitter {
64
64
  conn.on('data', (chunk) => {
65
65
  const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
66
66
  console.log(`[P2PDirect:${this.name}] 收到数据 from ${remotePubKeyHex.substring(0, 12)}... (${buf.length} bytes)`);
67
+ // P-Action 3: untrusted-input scanner (默认 silence-on-fail + log-only)
68
+ // 包装层 跨机器 @-mention 代发 (已 WORKING) 不能 block-on-suspicion
69
+ try {
70
+ // 动态 import 避免循环依赖 + 启动时加载
71
+ // (lazy require to keep cold-start fast)
72
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
73
+ const { scanInput, writeScanAudit, shouldHardBlock } = require('../security/input-scanner.js');
74
+ const result = scanInput(buf, { source: 'p2p' });
75
+ if (shouldHardBlock(result)) {
76
+ console.warn(`[P2PDirect:${this.name}] 阻断恶意消息 from ${remotePubKeyHex.substring(0, 12)}... (verdict=${result.verdict}, threats=${result.threats.length})`);
77
+ writeScanAudit(result, { fromPublicKey: remotePubKeyHex, blocked: true }).catch(() => { });
78
+ return; // 不 emit('data'), 跨机中转不传播
79
+ }
80
+ if (result.verdict !== 'pass') {
81
+ // log-only: 仍然 emit('data'), 但写 audit 留痕
82
+ writeScanAudit(result, { fromPublicKey: remotePubKeyHex, blocked: false }).catch(() => { });
83
+ console.log(`[P2PDirect:${this.name}] 输入扫描 verdict=${result.verdict} (${result.threats.length} threats) from ${remotePubKeyHex.substring(0, 12)}... (audit-only)`);
84
+ }
85
+ }
86
+ catch (err) {
87
+ // scanner 自身挂掉 → 静默, 不阻断
88
+ console.warn(`[P2PDirect:${this.name}] input scanner failed (silent, fail-safe):`, err);
89
+ }
67
90
  this.emit('data', {
68
91
  data: buf,
69
92
  fromPublicKey: remotePubKeyHex,
@@ -0,0 +1,203 @@
1
+ /**
2
+ * source-intent-broadcaster.ts — 包装 P2PDirect, 收发 SourceIntentMsg
3
+ *
4
+ * 用法:
5
+ * const p2p = new P2PDirect({ name: 'bolloon', role: 'source-agent' });
6
+ * await p2p.start();
7
+ * const sb = new SourceIntentBroadcaster(p2p, { agent: 'agent-A@mac1' });
8
+ * await sb.start();
9
+ *
10
+ * // 我方要改 src/foo.ts 行 42-50
11
+ * const conflict = await sb.reserve({ taskId, file: 'src/foo.ts', lines: [42, 50] });
12
+ * if (conflict) {
13
+ * // 对方已 reserve, 选: 让出 / 改别的 / 强制
14
+ * } else {
15
+ * sb.writeFileAndCommit(...);
16
+ * await sb.broadcastCommitIntent({ taskId, file, lines, sha, diffHash });
17
+ * }
18
+ *
19
+ * 主题: 复用现有 'bolloon-agent-harness' topic (P2PDirect 已 join),
20
+ * 上层加 'source-intent:' 前缀避免和别的协议混.
21
+ */
22
+ import { EventEmitter } from 'events';
23
+ import { ReserveLock, } from './source-intent.js';
24
+ export class SourceIntentBroadcaster extends EventEmitter {
25
+ p2p;
26
+ agent;
27
+ topic;
28
+ waitMs;
29
+ lock = new ReserveLock();
30
+ started = false;
31
+ dataHandler = null;
32
+ constructor(p2p, opts) {
33
+ super();
34
+ this.p2p = p2p;
35
+ this.agent = opts.agent;
36
+ this.topic = opts.topic || 'bolloon-agent-harness';
37
+ this.waitMs = opts.waitMs ?? 200;
38
+ }
39
+ async start() {
40
+ if (this.started)
41
+ return;
42
+ // 确保 p2p 已 join topic
43
+ await this.p2p.joinTopic(this.topic);
44
+ this.dataHandler = (data, from) => {
45
+ try {
46
+ const text = data.toString('utf8');
47
+ // 协议前缀 'source-intent:'
48
+ if (!text.startsWith('source-intent:'))
49
+ return;
50
+ const json = text.slice('source-intent:'.length);
51
+ const msg = JSON.parse(json);
52
+ this.onMessage(msg, from);
53
+ }
54
+ catch (err) {
55
+ // 静默忽略非本协议消息
56
+ }
57
+ };
58
+ this.p2p.on('data', this.dataHandler);
59
+ this.started = true;
60
+ }
61
+ stop() {
62
+ if (!this.started)
63
+ return;
64
+ if (this.dataHandler)
65
+ this.p2p.off('data', this.dataHandler);
66
+ this.started = false;
67
+ }
68
+ /**
69
+ * 申请 reserve (file, lines).
70
+ * 返回 {ok:true} → 成功 (没有重叠)
71
+ * 返回 {ok:false, existing} → 本地 lock 已有重叠, LLM 决定让出 / 改方向 / 强制
72
+ */
73
+ async reserve(args) {
74
+ const now = Date.now();
75
+ const msg = {
76
+ type: 'reserve',
77
+ taskId: args.taskId,
78
+ agent: this.agent,
79
+ file: args.file,
80
+ lines: args.lines,
81
+ expiresAt: now + ReserveLock.TTL_MS,
82
+ ts: now,
83
+ };
84
+ // 1. 先查本地 lock: 本端/远端任何 reserve 重叠都立即冲突 (避免 [5,15] 漏检 [1,10])
85
+ const existing = this.lock.isReserved(args.file, args.lines);
86
+ if (existing) {
87
+ return { ok: false, existing: { agent: existing.agent, lines: existing.lines } };
88
+ }
89
+ // 2. 写本地 lock
90
+ this.lock.add({
91
+ taskId: msg.taskId,
92
+ agent: msg.agent,
93
+ file: msg.file,
94
+ lines: msg.lines,
95
+ expiresAt: msg.expiresAt,
96
+ ts: msg.ts,
97
+ });
98
+ // 3. 广播
99
+ this.broadcastMsg(msg);
100
+ // 4. 等待 waitMs 看远端是否 ack 同一区间
101
+ return new Promise((resolve) => {
102
+ const timer = setTimeout(() => {
103
+ this.off('remoteConflict', onRemote);
104
+ resolve({ ok: true });
105
+ }, this.waitMs);
106
+ const onRemote = (existing) => {
107
+ clearTimeout(timer);
108
+ resolve({ ok: false, existing });
109
+ };
110
+ this.once('remoteConflict', onRemote);
111
+ });
112
+ }
113
+ /** 释放我方 reserve */
114
+ release(args) {
115
+ const msg = {
116
+ type: 'release',
117
+ taskId: args.taskId,
118
+ agent: this.agent,
119
+ file: args.file,
120
+ lines: args.lines,
121
+ ts: Date.now(),
122
+ };
123
+ this.lock.release(args.file, args.lines);
124
+ this.broadcastMsg(msg);
125
+ }
126
+ /** commit 后广播, 供对方做轻量审计 (diffHash 验真伪) */
127
+ async broadcastCommitIntent(args) {
128
+ const msg = {
129
+ type: 'commit-intent',
130
+ taskId: args.taskId,
131
+ agent: this.agent,
132
+ file: args.file,
133
+ lines: args.lines,
134
+ sha: args.sha,
135
+ diffHash: args.diffHash,
136
+ ts: Date.now(),
137
+ };
138
+ this.broadcastMsg(msg);
139
+ }
140
+ /** 取所有 live reserves (给 pi-ai 注入到 LLM 系统 prompt) */
141
+ liveReserves() {
142
+ return this.lock.live();
143
+ }
144
+ // ---- 内部 ----
145
+ broadcastMsg(msg) {
146
+ const text = 'source-intent:' + JSON.stringify(msg);
147
+ this.p2p.broadcast(Buffer.from(text, 'utf8'));
148
+ }
149
+ onMessage(msg, from) {
150
+ // 忽略自己发出的消息 (P2PDirect 自身会发到自己的 loopback)
151
+ if (msg.agent === this.agent)
152
+ return;
153
+ switch (msg.type) {
154
+ case 'reserve': {
155
+ // 检查本地是否已 reserve 重叠区间
156
+ const existing = this.lock.isReserved(msg.file, msg.lines);
157
+ if (existing) {
158
+ // 我方有重叠, 对方也 reserve → 触发 conflict
159
+ this.emit('remoteConflict', { agent: msg.agent, lines: msg.lines });
160
+ // 自己也回一个 ack 让对方知道我方已 reserve
161
+ const ack = {
162
+ type: 'ack',
163
+ taskId: existing.taskId,
164
+ agent: this.agent,
165
+ file: existing.file,
166
+ lines: existing.lines,
167
+ ts: Date.now(),
168
+ };
169
+ this.broadcastMsg(ack);
170
+ }
171
+ // 记入 lock (远端的 reserve 我方也要避开, LLM 看 prompt 知道)
172
+ this.lock.add({
173
+ taskId: msg.taskId,
174
+ agent: msg.agent,
175
+ file: msg.file,
176
+ lines: msg.lines,
177
+ expiresAt: msg.expiresAt,
178
+ ts: msg.ts,
179
+ });
180
+ this.emit('remoteReserve', msg);
181
+ break;
182
+ }
183
+ case 'ack': {
184
+ // 远端 ack 我方已 reserve 同一区间 → 立即触发 conflict
185
+ const local = this.lock.isReserved(msg.file, msg.lines);
186
+ if (local) {
187
+ this.emit('remoteConflict', { agent: msg.agent, lines: msg.lines });
188
+ }
189
+ break;
190
+ }
191
+ case 'release': {
192
+ this.lock.release(msg.file, msg.lines);
193
+ this.emit('remoteRelease', msg);
194
+ break;
195
+ }
196
+ case 'commit-intent': {
197
+ this.lock.release(msg.file, msg.lines);
198
+ this.emit('remoteCommit', msg);
199
+ break;
200
+ }
201
+ }
202
+ }
203
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * source-intent.ts — 行级 P2P 协作: 类型 + reserve.lock
3
+ *
4
+ * 为什么: 两台机上的智能体要协作维护同一份源码仓库, 粗粒度 task 协调不够
5
+ * (同一文件不同行会冲突). 用行级 reserve 让 LLM 在改前先广播"我要改 X 行",
6
+ * 对方看到重叠可让出/改方向/强制 merge.
7
+ *
8
+ * 数据流 (P2P RPC 消息, 走现有 P2PDirect.broadcast):
9
+ * reserve → 我方申请改 file:[start,end]
10
+ * ack → 对方也在这区间, 互相知道, 等 commit-intent 时看谁先到
11
+ * release → 我方放弃 (LLM 决定改别的行)
12
+ * commit-intent → 我方 commit 后广播, 附 diffHash, 对方用 diffHash 验真伪
13
+ *
14
+ * 兜底:
15
+ * - TTL 5min, reserve 不 release 就过期
16
+ * - 200ms 等待 + 检冲突, 极端 race 双方都收到 conflict, LLM 自己重选
17
+ * - diffHash 不去判语义, 行级 merge 后 lefthook 失败 → revert
18
+ */
19
+ import { EventEmitter } from 'events';
20
+ /**
21
+ * 检测两个 LineRange 是否重叠.
22
+ * 规则: 任一区间的一端落在对方区间内 → 重叠.
23
+ * 不重叠示例: [1,5] vs [6,10] (边界相邻不算重叠).
24
+ */
25
+ export function rangesOverlap(a, b) {
26
+ return a[0] <= b[1] && b[0] <= a[1];
27
+ }
28
+ /**
29
+ * ReserveLock — 本地内存表, 记录"我方 + 远端"所有 live reserves.
30
+ *
31
+ * 事件:
32
+ * 'added' 新增 reserve (我方或远端)
33
+ * 'removed' reserve 被释放 / 过期
34
+ * 'conflict' 检测到重叠 (a,b)
35
+ */
36
+ export class ReserveLock extends EventEmitter {
37
+ /** key = `${file}:${start}-${end}` */
38
+ byKey = new Map();
39
+ /** TTL: 5 min, 兜底防止对方死掉/网络断后 reserve 永远不释放 */
40
+ static TTL_MS = 5 * 60 * 1000;
41
+ /** 清理过期 reserve, 触发 'removed' 事件 */
42
+ sweep(now = Date.now()) {
43
+ for (const [k, r] of this.byKey) {
44
+ if (r.expiresAt <= now) {
45
+ this.byKey.delete(k);
46
+ this.emit('removed', r);
47
+ }
48
+ }
49
+ }
50
+ /** 我方/远端 reserve, 仅清自己区间后写入 (不清全表, 避免过期 reserve 干扰 add 测试) */
51
+ add(r) {
52
+ const key = keyOf(r.file, r.lines);
53
+ const prev = this.byKey.get(key);
54
+ this.byKey.set(key, r);
55
+ if (prev) {
56
+ // 同一区间已被对方 reserve, 我方再 reserve → 触发冲突
57
+ this.emit('conflict', { a: prev, b: r });
58
+ }
59
+ else {
60
+ this.emit('added', r);
61
+ }
62
+ }
63
+ /** 释放指定 reserve (我方 LLM 决定让出时调用) */
64
+ release(file, lines) {
65
+ const key = keyOf(file, lines);
66
+ const r = this.byKey.get(key);
67
+ if (!r)
68
+ return null;
69
+ this.byKey.delete(key);
70
+ this.emit('removed', r);
71
+ return r;
72
+ }
73
+ /** 查询某 (file, lines) 是否已被 reserve (含我方) */
74
+ isReserved(file, lines, now = Date.now()) {
75
+ this.sweep(now);
76
+ for (const r of this.byKey.values()) {
77
+ if (r.file === file && rangesOverlap(r.lines, lines)) {
78
+ return r;
79
+ }
80
+ }
81
+ return null;
82
+ }
83
+ /** 取所有 live reserves (给 pi-ai 注入到系统 prompt) */
84
+ live(now = Date.now()) {
85
+ this.sweep(now);
86
+ return [...this.byKey.values()];
87
+ }
88
+ /** 调试: dump 全部 */
89
+ dump() {
90
+ return [...this.byKey.values()];
91
+ }
92
+ }
93
+ function keyOf(file, lines) {
94
+ return `${file}:${lines[0]}-${lines[1]}`;
95
+ }
96
+ /** 算 diffHash (git diff 的 sha256 前 16 字符) */
97
+ export function diffHashOf(diffText) {
98
+ const crypto = require('crypto');
99
+ return crypto.createHash('sha256').update(diffText, 'utf8').digest('hex').slice(0, 16);
100
+ }