@bolloon/bolloon-agent 0.4.13 → 0.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -127
- package/bin/bolloon-cli.cjs +183 -183
- package/bin/bolloon-daemon.sh +207 -0
- package/bin/bolloon.cjs +0 -0
- package/dist/agents/agent-gateway.js +130 -0
- package/dist/agents/constraint-layer.js +19 -19
- package/dist/agents/gateway-group.js +261 -0
- package/dist/agents/gateway-network.js +278 -0
- package/dist/agents/judgment-protocol.js +14 -14
- package/dist/agents/pi-sdk-tools.js +117 -0
- package/dist/agents/pi-sdk-types.js +12 -12
- package/dist/agents/pi-sdk.js +101 -101
- package/dist/agents/skill-organizer.js +19 -19
- package/dist/agents/workflow-pivot-loop.js +2 -2
- package/dist/agents/x402/x402Pay.js +4 -0
- package/dist/bollharness/src/scripts/deploy-guard.js +8 -8
- package/dist/bollharness-integration/context-router-judgment.js +4 -4
- package/dist/bollharness-integration/context-router.js +292 -292
- package/dist/bollharness-integration/gate-state-machine.js +13 -13
- package/dist/bollharness-integration/llm-judgment-engine.js +134 -134
- package/dist/bollharness-integration/skill-adapter.js +21 -21
- package/dist/bootstrap/chat-archiver.js +14 -14
- package/dist/bootstrap/context-os.js +24 -24
- package/dist/bootstrap/memory-compressor.js +13 -13
- package/dist/cli-entry.js +36 -36
- package/dist/constraint-runtime/reference_data/archive_surface_snapshot.json +63 -0
- package/dist/constraint-runtime/reference_data/commands_snapshot.json +1037 -0
- package/dist/constraint-runtime/reference_data/subsystems/assistant.json +8 -0
- package/dist/constraint-runtime/reference_data/subsystems/bootstrap.json +8 -0
- package/dist/constraint-runtime/reference_data/subsystems/bridge.json +32 -0
- package/dist/constraint-runtime/reference_data/subsystems/buddy.json +13 -0
- package/dist/constraint-runtime/reference_data/subsystems/cli.json +26 -0
- package/dist/constraint-runtime/reference_data/subsystems/components.json +32 -0
- package/dist/constraint-runtime/reference_data/subsystems/constants.json +28 -0
- package/dist/constraint-runtime/reference_data/subsystems/coordinator.json +8 -0
- package/dist/constraint-runtime/reference_data/subsystems/entrypoints.json +15 -0
- package/dist/constraint-runtime/reference_data/subsystems/hooks.json +32 -0
- package/dist/constraint-runtime/reference_data/subsystems/keybindings.json +21 -0
- package/dist/constraint-runtime/reference_data/subsystems/memdir.json +15 -0
- package/dist/constraint-runtime/reference_data/subsystems/migrations.json +18 -0
- package/dist/constraint-runtime/reference_data/subsystems/moreright.json +8 -0
- package/dist/constraint-runtime/reference_data/subsystems/native_ts.json +11 -0
- package/dist/constraint-runtime/reference_data/subsystems/outputStyles.json +8 -0
- package/dist/constraint-runtime/reference_data/subsystems/plugins.json +9 -0
- package/dist/constraint-runtime/reference_data/subsystems/remote.json +11 -0
- package/dist/constraint-runtime/reference_data/subsystems/schemas.json +8 -0
- package/dist/constraint-runtime/reference_data/subsystems/screens.json +10 -0
- package/dist/constraint-runtime/reference_data/subsystems/server.json +10 -0
- package/dist/constraint-runtime/reference_data/subsystems/services.json +32 -0
- package/dist/constraint-runtime/reference_data/subsystems/skills.json +27 -0
- package/dist/constraint-runtime/reference_data/subsystems/state.json +13 -0
- package/dist/constraint-runtime/reference_data/subsystems/types.json +18 -0
- package/dist/constraint-runtime/reference_data/subsystems/upstreamproxy.json +9 -0
- package/dist/constraint-runtime/reference_data/subsystems/utils.json +32 -0
- package/dist/constraint-runtime/reference_data/subsystems/vim.json +12 -0
- package/dist/constraint-runtime/reference_data/subsystems/voice.json +8 -0
- package/dist/constraint-runtime/reference_data/tools_snapshot.json +922 -0
- package/dist/constraint-runtime/tools/PolymarketSDK/econ-integration.d.ts +55 -0
- package/dist/constraint-runtime/tools/PolymarketSDK/econ-integration.js +59 -0
- package/dist/context-compaction/auto-compact.js +7 -7
- package/dist/electron/config.js.map +1 -0
- package/dist/electron/dialogs.js.map +1 -0
- package/dist/electron/first-run.js +54 -54
- package/dist/electron/first-run.js.map +1 -0
- package/dist/electron/ipc.js.map +1 -0
- package/dist/electron/logger.js.map +1 -0
- package/dist/electron/main.js.map +1 -0
- package/dist/electron/menu.js.map +1 -0
- package/dist/electron/paths.js.map +1 -0
- package/dist/electron/server.js.map +1 -0
- package/dist/electron/tray.js.map +1 -0
- package/dist/electron/window.js.map +1 -0
- package/dist/electron-build/electron/first-run.js +54 -54
- package/dist/electron-preload.js.map +1 -1
- package/dist/electron.js.map +1 -1
- package/dist/index.js +112 -112
- package/dist/llm/llm-judgment-client.js +102 -102
- package/dist/llm/pi-ai.js +48 -48
- package/dist/llm/system-prompt/layers/channel/human-async.md +41 -41
- package/dist/llm/system-prompt/layers/channel/local.md +14 -14
- package/dist/llm/system-prompt/layers/channel/p2p-agent.md +18 -18
- package/dist/llm/system-prompt/layers/channel/p2p-peer-sync.md +51 -51
- package/dist/llm/system-prompt/layers/channel/p2p-proactive.md +43 -43
- package/dist/llm/system-prompt/layers/channel/p2p-visitor.md +19 -19
- package/dist/llm/system-prompt/layers/channel/session-handoff.md +61 -61
- package/dist/llm/system-prompt/layers/core/artifacts_storage.md +89 -89
- package/dist/llm/system-prompt/layers/core/evenhandedness.md +21 -21
- package/dist/llm/system-prompt/layers/core/external-engagement.md +73 -73
- package/dist/llm/system-prompt/layers/core/hibs_reminders.md +15 -15
- package/dist/llm/system-prompt/layers/core/identity.md +48 -48
- package/dist/llm/system-prompt/layers/core/knowledge.md +17 -17
- package/dist/llm/system-prompt/layers/core/memory_system.md +12 -12
- package/dist/llm/system-prompt/layers/core/network_filesystem.md +28 -28
- package/dist/llm/system-prompt/layers/core/refusal.md +37 -37
- package/dist/llm/system-prompt/layers/core/tone.md +31 -31
- package/dist/llm/system-prompt/layers/core/tools.thin.md +13 -13
- package/dist/llm/system-prompt/layers/core/wellbeing.md +41 -41
- package/dist/llm/system-prompt/layers/role/architect.md +20 -20
- package/dist/llm/system-prompt/layers/role/expert.md +19 -19
- package/dist/llm/system-prompt/layers/role/implementer.md +15 -15
- package/dist/llm/system-prompt/layers/role/security.md +15 -15
- package/dist/llm/system-prompt/layers/tool/artifacts.md +72 -72
- package/dist/llm/system-prompt/layers/tool/bash.md +25 -25
- package/dist/llm/system-prompt/layers/tool/goal_handoff.md +77 -77
- package/dist/llm/system-prompt/layers/tool/hibs_api.md +171 -171
- package/dist/llm/system-prompt/layers/tool/image_search.md +70 -70
- package/dist/llm/system-prompt/layers/tool/manifest.md +89 -89
- package/dist/llm/system-prompt/layers/tool/mcp_apps.md +53 -53
- package/dist/llm/system-prompt/layers/tool/p2p_request.md +61 -61
- package/dist/llm/system-prompt/layers/tool/web_search.md +83 -83
- package/dist/llm/tool-manifest/ask_user_input.js +1 -1
- package/dist/llm/tool-manifest/bash.js +3 -3
- package/dist/llm/tool-manifest/create_file.js +4 -4
- package/dist/llm/tool-manifest/fetch_sports_data.js +3 -3
- package/dist/llm/tool-manifest/image_search.js +2 -2
- package/dist/llm/tool-manifest/index.js +59 -0
- package/dist/llm/tool-manifest/mcp.js +2 -2
- package/dist/llm/tool-manifest/message_compose.js +3 -3
- package/dist/llm/tool-manifest/places.js +2 -2
- package/dist/llm/tool-manifest/present_files.js +1 -1
- package/dist/llm/tool-manifest/recipe.js +2 -2
- package/dist/llm/tool-manifest/str_replace.js +5 -5
- package/dist/llm/tool-manifest/view.js +3 -3
- package/dist/llm/tool-manifest/weather.js +4 -4
- package/dist/llm/tool-manifest/web.js +4 -4
- package/dist/network/p2p.js +78 -4
- package/dist/orbitdb/cid-database.js +39 -10
- package/dist/pi-ecosystem-judgment/causal-judge.js +51 -51
- package/dist/pi-ecosystem-judgment/distill-prompt.js +42 -42
- package/dist/pi-ecosystem-judgment/distillation.js +14 -14
- package/dist/pi-ecosystem-judgment/index.js +1 -1
- package/dist/pi-ecosystem-judgment/monitor-gate.js +28 -28
- package/dist/pi-ecosystem-judgment/value-injection.js +102 -102
- package/dist/security/context-router-tool.js +15 -15
- package/dist/utils/auto-update.js.map +1 -0
- package/dist/web/a2ui-client.js +1594 -223
- package/dist/web/api-config.html +779 -779
- package/dist/web/client-hearth.js +10 -10
- package/dist/web/client.js +273 -0
- package/dist/web/client.js.map +7 -0
- package/dist/web/components/wallet-viem.mjs +118 -118
- package/dist/web/index.html +502 -485
- package/dist/web/manifest.json +20 -20
- package/dist/web/mobile-agent.js +397 -0
- package/dist/web/mobile-core.js +86235 -0
- package/dist/web/mobile-data.js +346 -0
- package/dist/web/mobile-http-api.js +71 -0
- package/dist/web/mobile-p2p.js +250 -0
- package/dist/web/mobile-payments.js +80 -0
- package/dist/web/mobile-wallet.js +226 -0
- package/dist/web/mobile.css +483 -6
- package/dist/web/mobile.html +99 -50
- package/dist/web/mobile.js +1040 -187
- package/dist/web/server.js +196 -13
- package/dist/web/style.css +5062 -4946
- package/package.json +201 -198
- package/scripts/build-cli.js +215 -215
- package/scripts/build-web.ts +162 -149
- package/scripts/postinstall.js +152 -152
- package/bin/bolloon.js +0 -157
- package/dist/agents/python-exec.js +0 -115
- package/dist/pi-ecosystem-colony/index.js +0 -365
- package/dist/social/ant-colony/AdaptiveHeartbeat.js +0 -101
- package/dist/social/ant-colony/PheromoneEngine.js +0 -227
- package/dist/social/ant-colony/index.js +0 -6
- package/dist/social/ant-colony/types.js +0 -24
- package/dist/storage/trajectory.js +0 -101
- package/dist/test/ai-judgment-test.js +0 -80
- package/dist/test/bollharness-integration.test.js +0 -318
- package/dist/test/channel-agent-multi-dialogue.js +0 -205
- package/dist/test/channel-heartbeat-agent-test.js +0 -201
- package/dist/test/constraint-layer.test.js +0 -164
- package/dist/test/diap-identity-test.js +0 -172
- package/dist/test/diap-quick-test.js +0 -62
- package/dist/test/global-shared-context.test.js +0 -315
- package/dist/test/harness-judgment-injection.test.js +0 -246
- package/dist/test/harness-workflow-integrator-test.js +0 -228
- package/dist/test/human-value-store.test.js +0 -243
- package/dist/test/hybrid-integration-test.js +0 -118
- package/dist/test/hybrid-messenger-verify.js +0 -55
- package/dist/test/iroh-bistream-debug.js +0 -38
- package/dist/test/iroh-communication.test.js +0 -66
- package/dist/test/iroh-debug-test.js +0 -57
- package/dist/test/iroh-diap-test.js +0 -71
- package/dist/test/iroh-direct-connect.js +0 -55
- package/dist/test/iroh-e2e-fixed.js +0 -89
- package/dist/test/iroh-e2e-same-process.js +0 -63
- package/dist/test/iroh-e2e.js +0 -66
- package/dist/test/iroh-final-e2e.js +0 -72
- package/dist/test/iroh-relay-test.js +0 -37
- package/dist/test/iroh-simple-test.js +0 -41
- package/dist/test/iroh-transport-verify.js +0 -54
- package/dist/test/iroh-transport.test.js +0 -37
- package/dist/test/iroh-two-nodes.js +0 -70
- package/dist/test/iroh-verify.js +0 -44
- package/dist/test/judgment-decision.test.js +0 -219
- package/dist/test/llm-judgment-integration.test.js +0 -220
- package/dist/test/p2p-agent-complex-dialogue.js +0 -385
- package/dist/test/p2p-agent-dialogue.js +0 -341
- package/dist/test/p2p-agent-full-bidirectional.js +0 -510
- package/dist/test/p2p-agent-harness-flow.js +0 -437
- package/dist/test/p2p-agent-harness-single.js +0 -143
- package/dist/test/p2p-ai-dialogue-test.js +0 -318
- package/dist/test/p2p-cid-connect-test.js +0 -195
- package/dist/test/p2p-connect-receiver.js +0 -69
- package/dist/test/p2p-doc-transfer.js +0 -110
- package/dist/test/p2p-identity-page-test.js +0 -77
- package/dist/test/p2p-iroh-test.js +0 -171
- package/dist/test/p2p-minimal-test.js +0 -241
- package/dist/test/p2p-node-1.js +0 -148
- package/dist/test/p2p-node-2.js +0 -148
- package/dist/test/p2p-server.js +0 -281
- package/dist/test/p2p-two-nodes-test.js +0 -438
- package/dist/test/pi-sdk.test.js +0 -44
- package/dist/test/set-persona.js +0 -40
- package/dist/test/simple.test.js +0 -9
- package/dist/test/storage-integration.test.js +0 -150
- package/dist/test/subagent-manager.test.js +0 -276
- package/dist/test/test-gate-flow.test.js +0 -81
- package/dist/test/workflow-engine.test.js +0 -87
- package/dist/test/workflow-pivot-loop.test.js +0 -246
package/dist/agents/pi-sdk.js
CHANGED
|
@@ -202,13 +202,13 @@ export class PiAgentSession {
|
|
|
202
202
|
/** Bootstrap SessionStart 拼的 system prompt 片段 (用完即清) */
|
|
203
203
|
bootstrapAddition = '';
|
|
204
204
|
/** 2026-08-12 (Task3 认知卸载): 工具选择与认知卸载指南 — 注入 system prompt, 降低"模型不触发 write/edit/read"率. */
|
|
205
|
-
static TOOL_SELECTION_GUIDE = `【工具选择与认知卸载指南 (严格遵循)】
|
|
206
|
-
- 写/改文件: 必须用 write_file / edit_file (不要用 terminal 拼字符串写文件).
|
|
207
|
-
- 读文件: 用 read_file / read_directory / list_files.
|
|
208
|
-
- 跑命令/查状态/装依赖/跑脚本: 用 terminal.
|
|
209
|
-
- 执行 git 操作: 用 git_* 专用工具 (git_diff/git_commit/git_push/git_branch/git_log).
|
|
210
|
-
- 查看/调用技能: 用 list_skills / use_skill.
|
|
211
|
-
- 认知卸载: 当任务对你过大或反复失败时, 不要死磕 — 用 delegate_to_engine 把编码/复杂任务委派给外部引擎 (codex/claude-code/opencode), 或把目标拆小分步完成.
|
|
205
|
+
static TOOL_SELECTION_GUIDE = `【工具选择与认知卸载指南 (严格遵循)】
|
|
206
|
+
- 写/改文件: 必须用 write_file / edit_file (不要用 terminal 拼字符串写文件).
|
|
207
|
+
- 读文件: 用 read_file / read_directory / list_files.
|
|
208
|
+
- 跑命令/查状态/装依赖/跑脚本: 用 terminal.
|
|
209
|
+
- 执行 git 操作: 用 git_* 专用工具 (git_diff/git_commit/git_push/git_branch/git_log).
|
|
210
|
+
- 查看/调用技能: 用 list_skills / use_skill.
|
|
211
|
+
- 认知卸载: 当任务对你过大或反复失败时, 不要死磕 — 用 delegate_to_engine 把编码/复杂任务委派给外部引擎 (codex/claude-code/opencode), 或把目标拆小分步完成.
|
|
212
212
|
- 每步只选一个最合适的工具, 先读后写, 写完验证 (跑 tsc/vitest 或读回文件).`;
|
|
213
213
|
/** 当前 prompt 开始时间 (供 Stop hook 计算 durationMs) */
|
|
214
214
|
promptStartTime = 0;
|
|
@@ -1061,40 +1061,40 @@ export class PiAgentSession {
|
|
|
1061
1061
|
}
|
|
1062
1062
|
// M2.4: persona 缓存
|
|
1063
1063
|
if (!this.cachedPersonaSection && this.persona) {
|
|
1064
|
-
this.cachedPersonaSection = `
|
|
1065
|
-
角色描述: ${this.persona.description || '无'}
|
|
1066
|
-
性格特点: ${this.persona.personality || '无'}
|
|
1067
|
-
问候语: ${this.persona.greeting || '无'}
|
|
1064
|
+
this.cachedPersonaSection = `
|
|
1065
|
+
角色描述: ${this.persona.description || '无'}
|
|
1066
|
+
性格特点: ${this.persona.personality || '无'}
|
|
1067
|
+
问候语: ${this.persona.greeting || '无'}
|
|
1068
1068
|
`;
|
|
1069
1069
|
}
|
|
1070
|
-
const systemPrompt = `${this.bootstrapAddition}你是 ${this.identity.name},基于ReAct (Reasoning + Acting)模式工作。${this.cachedPersonaSection}
|
|
1071
|
-
当前工作目录: ${this.cwd}
|
|
1072
|
-
当前身份: ${this.identity.name} (${this.identity.did})
|
|
1073
|
-
${this.currentIntentHint}
|
|
1074
|
-
|
|
1075
|
-
${this.getToolDefinitions()}
|
|
1076
|
-
|
|
1077
|
-
${PiAgentSession.TOOL_SELECTION_GUIDE}
|
|
1078
|
-
|
|
1079
|
-
工作模式:
|
|
1080
|
-
1. 理解用户自然语言请求
|
|
1081
|
-
2. 分析需要哪些工具来完成
|
|
1082
|
-
3. 按顺序调用工具并观察结果
|
|
1083
|
-
4. 根据观察结果决定下一步
|
|
1084
|
-
5. 最终给出完整回答
|
|
1085
|
-
|
|
1086
|
-
重要 (一次命中要求):
|
|
1087
|
-
- 每次只调用一个工具
|
|
1088
|
-
- 仔细分析工具返回结果
|
|
1089
|
-
- 当任务完成时,必须在回答末尾添加 <final gen> 标记表示结束
|
|
1090
|
-
- 如果需要更多信息,继续调用工具
|
|
1091
|
-
|
|
1092
|
-
【工具调用格式 (严格遵守, 否则系统无法解析)】
|
|
1093
|
-
- 你只能输出**一个**工具调用, 不要堆叠多个 invoke
|
|
1094
|
-
- 工具调用格式: {"name":"<tool_name>","input":{"arg1":"value1"}}
|
|
1095
|
-
- 用 markdown json code block 包裹: \`\`\`json\n{"name":"X","input":{...}}\n\`\`\`
|
|
1096
|
-
- 工具调用前可以简短思考 (1-2 句话), 但**不要写长篇 thinking** (会撞 max_tokens)
|
|
1097
|
-
- 工具调用后必须等结果, 不要在同一个回复里继续输出
|
|
1070
|
+
const systemPrompt = `${this.bootstrapAddition}你是 ${this.identity.name},基于ReAct (Reasoning + Acting)模式工作。${this.cachedPersonaSection}
|
|
1071
|
+
当前工作目录: ${this.cwd}
|
|
1072
|
+
当前身份: ${this.identity.name} (${this.identity.did})
|
|
1073
|
+
${this.currentIntentHint}
|
|
1074
|
+
|
|
1075
|
+
${this.getToolDefinitions()}
|
|
1076
|
+
|
|
1077
|
+
${PiAgentSession.TOOL_SELECTION_GUIDE}
|
|
1078
|
+
|
|
1079
|
+
工作模式:
|
|
1080
|
+
1. 理解用户自然语言请求
|
|
1081
|
+
2. 分析需要哪些工具来完成
|
|
1082
|
+
3. 按顺序调用工具并观察结果
|
|
1083
|
+
4. 根据观察结果决定下一步
|
|
1084
|
+
5. 最终给出完整回答
|
|
1085
|
+
|
|
1086
|
+
重要 (一次命中要求):
|
|
1087
|
+
- 每次只调用一个工具
|
|
1088
|
+
- 仔细分析工具返回结果
|
|
1089
|
+
- 当任务完成时,必须在回答末尾添加 <final gen> 标记表示结束
|
|
1090
|
+
- 如果需要更多信息,继续调用工具
|
|
1091
|
+
|
|
1092
|
+
【工具调用格式 (严格遵守, 否则系统无法解析)】
|
|
1093
|
+
- 你只能输出**一个**工具调用, 不要堆叠多个 invoke
|
|
1094
|
+
- 工具调用格式: {"name":"<tool_name>","input":{"arg1":"value1"}}
|
|
1095
|
+
- 用 markdown json code block 包裹: \`\`\`json\n{"name":"X","input":{...}}\n\`\`\`
|
|
1096
|
+
- 工具调用前可以简短思考 (1-2 句话), 但**不要写长篇 thinking** (会撞 max_tokens)
|
|
1097
|
+
- 工具调用后必须等结果, 不要在同一个回复里继续输出
|
|
1098
1098
|
- <final gen> 只在**真完成所有任务**时输出, 不要在工具调用前/中输出${this.judgmentGateAddition}${this.contextHintAddition}`;
|
|
1099
1099
|
// 2026-06-15: 把 currentOnStream 传给 loop, 让 step-timeline 在 pivot 循环里也能 emit step_start/done
|
|
1100
1100
|
// 之前 loop.execute() 不接 streamCallback, 导致 step-timeline 只能看到老 runReActLoop 路径
|
|
@@ -1286,10 +1286,10 @@ ${PiAgentSession.TOOL_SELECTION_GUIDE}
|
|
|
1286
1286
|
}
|
|
1287
1287
|
// M2.4: persona section 缓存 — persona 在 loadPersona() 时一次设定, 此后不变
|
|
1288
1288
|
if (!this.cachedPersonaSection && this.persona) {
|
|
1289
|
-
this.cachedPersonaSection = `
|
|
1290
|
-
角色描述: ${this.persona.description || '无'}
|
|
1291
|
-
性格特点: ${this.persona.personality || '无'}
|
|
1292
|
-
问候语: ${this.persona.greeting || '无'}
|
|
1289
|
+
this.cachedPersonaSection = `
|
|
1290
|
+
角色描述: ${this.persona.description || '无'}
|
|
1291
|
+
性格特点: ${this.persona.personality || '无'}
|
|
1292
|
+
问候语: ${this.persona.greeting || '无'}
|
|
1293
1293
|
`;
|
|
1294
1294
|
}
|
|
1295
1295
|
const personaSection = this.cachedPersonaSection;
|
|
@@ -1307,28 +1307,28 @@ ${PiAgentSession.TOOL_SELECTION_GUIDE}
|
|
|
1307
1307
|
.join('\n');
|
|
1308
1308
|
loopProgressSection = `\n【本轮循环进度】你已完成以下 ${loopActionLog.length} 个动作, 这是连续执行的同一轮任务:\n${actionLines}\n请基于已有结果继续推进, 不要重复执行上面已成功的动作. 全部完成后用 <final gen> 结束.\n`;
|
|
1309
1309
|
}
|
|
1310
|
-
const systemPrompt = `${this.bootstrapAddition}你是 ${this.identity.name},基于ReAct (Reasoning + Acting)模式工作。${personaSection}
|
|
1311
|
-
当前工作目录: ${this.cwd}
|
|
1312
|
-
当前身份: ${this.identity.name} (${this.identity.did})
|
|
1313
|
-
${refineContext}
|
|
1314
|
-
${this.currentIntentHint}
|
|
1315
|
-
${loopProgressSection}
|
|
1316
|
-
|
|
1317
|
-
${toolDefs}
|
|
1318
|
-
|
|
1319
|
-
${PiAgentSession.TOOL_SELECTION_GUIDE}
|
|
1320
|
-
|
|
1321
|
-
工作模式:
|
|
1322
|
-
1. 理解用户自然语言请求
|
|
1323
|
-
2. 分析需要哪些工具来完成
|
|
1324
|
-
3. 按顺序调用工具并观察结果
|
|
1325
|
-
4. 根据观察结果决定下一步
|
|
1326
|
-
5. 最终给出完整回答
|
|
1327
|
-
|
|
1328
|
-
重要:
|
|
1329
|
-
- 每次只调用一个工具
|
|
1330
|
-
- 仔细分析工具返回结果
|
|
1331
|
-
- 当任务完成时,必须在回答末尾添加 <final gen> 标记表示结束
|
|
1310
|
+
const systemPrompt = `${this.bootstrapAddition}你是 ${this.identity.name},基于ReAct (Reasoning + Acting)模式工作。${personaSection}
|
|
1311
|
+
当前工作目录: ${this.cwd}
|
|
1312
|
+
当前身份: ${this.identity.name} (${this.identity.did})
|
|
1313
|
+
${refineContext}
|
|
1314
|
+
${this.currentIntentHint}
|
|
1315
|
+
${loopProgressSection}
|
|
1316
|
+
|
|
1317
|
+
${toolDefs}
|
|
1318
|
+
|
|
1319
|
+
${PiAgentSession.TOOL_SELECTION_GUIDE}
|
|
1320
|
+
|
|
1321
|
+
工作模式:
|
|
1322
|
+
1. 理解用户自然语言请求
|
|
1323
|
+
2. 分析需要哪些工具来完成
|
|
1324
|
+
3. 按顺序调用工具并观察结果
|
|
1325
|
+
4. 根据观察结果决定下一步
|
|
1326
|
+
5. 最终给出完整回答
|
|
1327
|
+
|
|
1328
|
+
重要:
|
|
1329
|
+
- 每次只调用一个工具
|
|
1330
|
+
- 仔细分析工具返回结果
|
|
1331
|
+
- 当任务完成时,必须在回答末尾添加 <final gen> 标记表示结束
|
|
1332
1332
|
- 如果需要更多信息,继续调用工具${this.judgmentGateAddition}${this.contextHintAddition}`;
|
|
1333
1333
|
// 3 个恢复机制 (Claude Code 论文 9-step pipeline 内部):
|
|
1334
1334
|
// 1. max output token 升级 (最多 3 次, 每次 maxOutputTokens 翻倍)
|
|
@@ -2399,37 +2399,37 @@ ${PiAgentSession.TOOL_SELECTION_GUIDE}
|
|
|
2399
2399
|
getDefaultResponse(input) {
|
|
2400
2400
|
const operationsRef = PiAgentSession.getOperationsReference();
|
|
2401
2401
|
if (operationsRef) {
|
|
2402
|
-
return `收到了: "${input}"
|
|
2403
|
-
|
|
2404
|
-
我是一个判断力处理智能体,支持自然语言交互。
|
|
2405
|
-
|
|
2406
|
-
可用操作(直接说出即可):
|
|
2407
|
-
${this.extractOperationsFromRef(operationsRef)}
|
|
2408
|
-
|
|
2409
|
-
示例请求:
|
|
2410
|
-
- "读取 src/index.ts 文件"
|
|
2411
|
-
- "总结一下 README.md"
|
|
2412
|
-
- "查看当前连接了哪些节点"
|
|
2402
|
+
return `收到了: "${input}"
|
|
2403
|
+
|
|
2404
|
+
我是一个判断力处理智能体,支持自然语言交互。
|
|
2405
|
+
|
|
2406
|
+
可用操作(直接说出即可):
|
|
2407
|
+
${this.extractOperationsFromRef(operationsRef)}
|
|
2408
|
+
|
|
2409
|
+
示例请求:
|
|
2410
|
+
- "读取 src/index.ts 文件"
|
|
2411
|
+
- "总结一下 README.md"
|
|
2412
|
+
- "查看当前连接了哪些节点"
|
|
2413
2413
|
- "向 QmABC... 发送测试消息"`;
|
|
2414
2414
|
}
|
|
2415
|
-
return `收到了: "${input}"
|
|
2416
|
-
|
|
2417
|
-
我是一个判断力处理智能体,支持自然语言交互。
|
|
2418
|
-
|
|
2419
|
-
可用操作(直接说出即可):
|
|
2420
|
-
- "读取 README.md" - 读取并分析文档
|
|
2421
|
-
- "总结文档" - 总结文档内容
|
|
2422
|
-
- "改进文档,按照X要求" - 改进文档
|
|
2423
|
-
- "查看节点" - 查看已连接的对等节点
|
|
2424
|
-
- "向X发送消息Y" - 向对等节点发送消息
|
|
2425
|
-
- "广播消息X" - 广播消息到所有节点
|
|
2426
|
-
- "查看身份" - 查看当前智能体身份
|
|
2427
|
-
- "查看日志" - 查看最近操作日志
|
|
2428
|
-
|
|
2429
|
-
示例请求:
|
|
2430
|
-
- "读取 src/index.ts 文件"
|
|
2431
|
-
- "总结一下 README.md"
|
|
2432
|
-
- "查看当前连接了哪些节点"
|
|
2415
|
+
return `收到了: "${input}"
|
|
2416
|
+
|
|
2417
|
+
我是一个判断力处理智能体,支持自然语言交互。
|
|
2418
|
+
|
|
2419
|
+
可用操作(直接说出即可):
|
|
2420
|
+
- "读取 README.md" - 读取并分析文档
|
|
2421
|
+
- "总结文档" - 总结文档内容
|
|
2422
|
+
- "改进文档,按照X要求" - 改进文档
|
|
2423
|
+
- "查看节点" - 查看已连接的对等节点
|
|
2424
|
+
- "向X发送消息Y" - 向对等节点发送消息
|
|
2425
|
+
- "广播消息X" - 广播消息到所有节点
|
|
2426
|
+
- "查看身份" - 查看当前智能体身份
|
|
2427
|
+
- "查看日志" - 查看最近操作日志
|
|
2428
|
+
|
|
2429
|
+
示例请求:
|
|
2430
|
+
- "读取 src/index.ts 文件"
|
|
2431
|
+
- "总结一下 README.md"
|
|
2432
|
+
- "查看当前连接了哪些节点"
|
|
2433
2433
|
- "向 QmABC... 发送测试消息"`;
|
|
2434
2434
|
}
|
|
2435
2435
|
extractOperationsFromRef(ref) {
|
|
@@ -2454,13 +2454,13 @@ ${this.extractOperationsFromRef(operationsRef)}
|
|
|
2454
2454
|
}
|
|
2455
2455
|
}
|
|
2456
2456
|
return operationLines.length > 0 ? operationLines.join('\n') :
|
|
2457
|
-
` - "读取 README.md" - 读取并分析文档
|
|
2458
|
-
- "总结文档" - 总结文档内容
|
|
2459
|
-
- "改进文档,按照X要求" - 改进文档
|
|
2460
|
-
- "查看节点" - 查看已连接的对等节点
|
|
2461
|
-
- "向X发送消息Y" - 向对等节点发送消息
|
|
2462
|
-
- "广播消息X" - 广播消息到所有节点
|
|
2463
|
-
- "查看身份" - 查看当前智能体身份
|
|
2457
|
+
` - "读取 README.md" - 读取并分析文档
|
|
2458
|
+
- "总结文档" - 总结文档内容
|
|
2459
|
+
- "改进文档,按照X要求" - 改进文档
|
|
2460
|
+
- "查看节点" - 查看已连接的对等节点
|
|
2461
|
+
- "向X发送消息Y" - 向对等节点发送消息
|
|
2462
|
+
- "广播消息X" - 广播消息到所有节点
|
|
2463
|
+
- "查看身份" - 查看当前智能体身份
|
|
2464
2464
|
- "查看日志" - 查看最近操作日志`;
|
|
2465
2465
|
}
|
|
2466
2466
|
async suggestRename(messages) {
|
|
@@ -143,25 +143,25 @@ export async function scanLeftoverSkills(opts = {}) {
|
|
|
143
143
|
// ───────────────────────── B. 经验进化 (LLM 完整总结) ─────────────────────────
|
|
144
144
|
/** 把候选的工具调用记录扩写成完整经验 — LLM prompt (结构化 JSON 输出) */
|
|
145
145
|
export function buildEvolvePrompt(c) {
|
|
146
|
-
return `你是经验总结专家。下面是 Bolloon 智能体在一轮运行中连续成功调用的工具记录 (已运行 ${c.runs || 1} 次)。
|
|
147
|
-
|
|
148
|
-
工具记录:
|
|
149
|
-
名称: ${c.name}
|
|
150
|
-
描述: ${c.description}
|
|
151
|
-
原始记录:
|
|
152
|
-
${String(c.body || '').slice(0, 4000)}
|
|
153
|
-
|
|
154
|
-
请把这份"工具调用记录"扩写成一份完整的、可复用的经验文档, 要求:
|
|
155
|
-
1. name: 一个简短的小写英文名 (字母数字连字符, 概括这套操作)
|
|
156
|
-
2. description: 一句话描述 (什么场景用)
|
|
157
|
-
3. body: 完整经验正文, 按以下结构:
|
|
158
|
-
## 背景 — 这套操作在什么场景下用, 解决什么问题
|
|
159
|
-
## 触发条件 — 什么信号/需求出现时应该使用
|
|
160
|
-
## 流程 — 具体步骤 (保留原始工具名), 每步说明目的
|
|
161
|
-
## 注意事项 — 易错点 / 边界情况 / 已知坑
|
|
162
|
-
## 验证 — 怎么确认结果正确
|
|
163
|
-
|
|
164
|
-
只输出一个 JSON 对象, 不要任何其他文字:
|
|
146
|
+
return `你是经验总结专家。下面是 Bolloon 智能体在一轮运行中连续成功调用的工具记录 (已运行 ${c.runs || 1} 次)。
|
|
147
|
+
|
|
148
|
+
工具记录:
|
|
149
|
+
名称: ${c.name}
|
|
150
|
+
描述: ${c.description}
|
|
151
|
+
原始记录:
|
|
152
|
+
${String(c.body || '').slice(0, 4000)}
|
|
153
|
+
|
|
154
|
+
请把这份"工具调用记录"扩写成一份完整的、可复用的经验文档, 要求:
|
|
155
|
+
1. name: 一个简短的小写英文名 (字母数字连字符, 概括这套操作)
|
|
156
|
+
2. description: 一句话描述 (什么场景用)
|
|
157
|
+
3. body: 完整经验正文, 按以下结构:
|
|
158
|
+
## 背景 — 这套操作在什么场景下用, 解决什么问题
|
|
159
|
+
## 触发条件 — 什么信号/需求出现时应该使用
|
|
160
|
+
## 流程 — 具体步骤 (保留原始工具名), 每步说明目的
|
|
161
|
+
## 注意事项 — 易错点 / 边界情况 / 已知坑
|
|
162
|
+
## 验证 — 怎么确认结果正确
|
|
163
|
+
|
|
164
|
+
只输出一个 JSON 对象, 不要任何其他文字:
|
|
165
165
|
{"name": "...", "description": "...", "body": "..."}`;
|
|
166
166
|
}
|
|
167
167
|
/** 解析 LLM 返回的 JSON (容错: 剥 markdown 代码块, 取第一个 {...}) */
|
|
@@ -876,8 +876,8 @@ export class WorkflowPivotLoop {
|
|
|
876
876
|
// 完整重装只在 iter=1 和 compact 之后两次
|
|
877
877
|
const lines = fullSystemPrompt.split('\n');
|
|
878
878
|
const identityLine = lines.find((l) => l.includes('你是') && !l.includes('(续)')) ?? '';
|
|
879
|
-
return `[continuation] 你的 persona + tools + judgments 已在首轮 messageHistory 中.
|
|
880
|
-
${identityLine ? identityLine + '\n' : ''}当前 step 别再读 persona 全文, 继续推进任务即可.
|
|
879
|
+
return `[continuation] 你的 persona + tools + judgments 已在首轮 messageHistory 中.
|
|
880
|
+
${identityLine ? identityLine + '\n' : ''}当前 step 别再读 persona 全文, 继续推进任务即可.
|
|
881
881
|
> <final gen> 只在真完成时输出.`;
|
|
882
882
|
}
|
|
883
883
|
/**
|
|
@@ -216,6 +216,10 @@ export async function createX402PaymentFetch(params) {
|
|
|
216
216
|
client.register(info.caip2, new ExactEvmScheme(signer));
|
|
217
217
|
client.registerV1(info.v1, new ExactEvmScheme(signer));
|
|
218
218
|
}
|
|
219
|
+
// @x402 2.25+ 新增 spendControls 默认白名单 (只放行各网络 default asset), 会拒掉
|
|
220
|
+
// USDC 等非默认代币的支付要求 → 关掉资产门禁, 恢复 2.21 语义 (额度上限仍由
|
|
221
|
+
// 上面的 registerPolicy / maxPaymentAmount 控制, 资产种类信任服务端 402 头声明)
|
|
222
|
+
client.setSpendControls(false);
|
|
219
223
|
return wrapFetchWithPayment(params.fetchImpl || fetch, client);
|
|
220
224
|
}
|
|
221
225
|
function parseHumanTokenAmount(amount, decimals) {
|
|
@@ -104,17 +104,17 @@ function checkRsync(cmd) {
|
|
|
104
104
|
function block(reason, host = null) {
|
|
105
105
|
let guidance;
|
|
106
106
|
if (host === PROD_IP) {
|
|
107
|
-
guidance = `请使用标准部署流程:
|
|
108
|
-
后端: bash scripts/deploy.sh --yes
|
|
109
|
-
Demo 正式: bash scripts/deploy-demo.sh <name> --channel prod --yes
|
|
110
|
-
Demo 内测: bash scripts/deploy-demo.sh <name> --channel preview --yes
|
|
111
|
-
Edge/Nginx: bash scripts/deploy-edge.sh --yes
|
|
107
|
+
guidance = `请使用标准部署流程:
|
|
108
|
+
后端: bash scripts/deploy.sh --yes
|
|
109
|
+
Demo 正式: bash scripts/deploy-demo.sh <name> --channel prod --yes
|
|
110
|
+
Demo 内测: bash scripts/deploy-demo.sh <name> --channel preview --yes
|
|
111
|
+
Edge/Nginx: bash scripts/deploy-edge.sh --yes
|
|
112
112
|
详见 Bolloon.md Development Commands。`;
|
|
113
113
|
}
|
|
114
114
|
else if (BRIDGE_VPS_HOSTS.includes(host ?? "")) {
|
|
115
|
-
guidance = `Bridge VPS 必须走 git pull 更新路径:
|
|
116
|
-
ssh root@${host} 'sudo -u boll git -C /opt/boll pull --ff-only'
|
|
117
|
-
scp/rsync 直传会重新制造 orphan worktree。
|
|
115
|
+
guidance = `Bridge VPS 必须走 git pull 更新路径:
|
|
116
|
+
ssh root@${host} 'sudo -u boll git -C /opt/boll pull --ff-only'
|
|
117
|
+
scp/rsync 直传会重新制造 orphan worktree。
|
|
118
118
|
详见 docs/issues/guard-20260408-0445-bridge-vps-orphan-worktree.md。`;
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
@@ -253,9 +253,9 @@ export async function generateJudgmentInjection(filePath, gate, options = {}) {
|
|
|
253
253
|
const header = gate === 3
|
|
254
254
|
? '# Plan Freeze - Decision Principles'
|
|
255
255
|
: `# Gate ${gate} - Active Judgments`;
|
|
256
|
-
return `${header}
|
|
257
|
-
# Path: ${filePath}
|
|
258
|
-
# Confidence: ${(result.confidence * 100).toFixed(0)}%
|
|
259
|
-
|
|
256
|
+
return `${header}
|
|
257
|
+
# Path: ${filePath}
|
|
258
|
+
# Confidence: ${(result.confidence * 100).toFixed(0)}%
|
|
259
|
+
|
|
260
260
|
${result.contextYaml}`;
|
|
261
261
|
}
|