@bolloon/bolloon-agent 0.3.37 → 0.3.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -135
- package/bin/bolloon-cli.cjs +183 -183
- package/bin/bolloon.cjs +0 -0
- package/bin/bolloon.js +157 -0
- package/dist/agents/constraint-layer.js +19 -19
- package/dist/agents/judgment-protocol.js +14 -14
- package/dist/agents/loop-review.js +58 -0
- package/dist/agents/pi-sdk-tools.js +107 -0
- package/dist/agents/pi-sdk-types.js +12 -12
- package/dist/agents/pi-sdk.js +133 -91
- package/dist/agents/workflow-pivot-loop.js +2 -2
- 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/bootstrap.js +14 -1
- package/dist/bootstrap/chat-archiver.js +14 -14
- package/dist/bootstrap/context-collector.js +5 -1
- package/dist/bootstrap/context-os.js +21 -21
- package/dist/bootstrap/memory-compressor.js +13 -13
- package/dist/cli/ink-app.js +46 -8
- package/dist/cli/loading-tui.js +7 -5
- package/dist/cli/mention-data.js +2 -1
- package/dist/cli-entry.js +37 -37
- package/dist/constraint-runtime/setup.js +1 -1
- package/dist/constraint-runtime/tools/PolymarketSDK/cancelOrder.d.ts +3 -13
- package/dist/constraint-runtime/tools/PolymarketSDK/cancelOrder.js +4 -16
- package/dist/constraint-runtime/tools/PolymarketSDK/createOrder.d.ts +3 -24
- package/dist/constraint-runtime/tools/PolymarketSDK/createOrder.js +4 -31
- package/dist/constraint-runtime/tools/PolymarketSDK/getMarket.d.ts +0 -1
- package/dist/constraint-runtime/tools/PolymarketSDK/getMarket.js +3 -14
- package/dist/constraint-runtime/tools/PolymarketSDK/getOrders.d.ts +2 -11
- package/dist/constraint-runtime/tools/PolymarketSDK/getOrders.js +4 -23
- package/dist/constraint-runtime/tools/PolymarketSDK/listMarkets.d.ts +0 -4
- package/dist/constraint-runtime/tools/PolymarketSDK/listMarkets.js +2 -22
- package/dist/context-compaction/auto-compact.js +7 -7
- package/dist/electron/first-run.js +54 -54
- package/dist/electron-build/electron/first-run.js +54 -54
- package/dist/electron-build/utils/auto-update.js +8 -0
- package/dist/electron-build/utils/auto-update.js.map +1 -1
- package/dist/electron-preload.js.map +1 -1
- package/dist/electron.js.map +1 -1
- package/dist/index.js +246 -143
- package/dist/llm/config-store.js +18 -2
- package/dist/llm/llm-judgment-client.js +102 -102
- package/dist/llm/pi-ai.js +77 -59
- 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 +0 -59
- package/dist/llm/tool-manifest/mcp.js +2 -2
- package/dist/llm/tool-manifest/message_compose.js +3 -3
- package/dist/llm/tool-manifest/places.js +2 -2
- package/dist/llm/tool-manifest/present_files.js +1 -1
- package/dist/llm/tool-manifest/recipe.js +2 -2
- package/dist/llm/tool-manifest/str_replace.js +5 -5
- package/dist/llm/tool-manifest/view.js +3 -3
- package/dist/llm/tool-manifest/weather.js +4 -4
- package/dist/llm/tool-manifest/web.js +4 -4
- package/dist/migration/external-agent-migrator.js +300 -0
- package/dist/pi-ecosystem-colony/index.js +365 -0
- package/dist/pi-ecosystem-judgment/causal-judge.js +51 -51
- package/dist/pi-ecosystem-judgment/distill-prompt.js +42 -42
- package/dist/pi-ecosystem-judgment/distillation.js +14 -14
- package/dist/pi-ecosystem-judgment/monitor-gate.js +28 -28
- package/dist/pi-ecosystem-judgment/value-injection.js +102 -102
- package/dist/security/context-router-tool.js +15 -15
- package/dist/security/tool-gate.js +2 -0
- package/dist/social/ant-colony/AdaptiveHeartbeat.js +101 -0
- package/dist/social/ant-colony/PheromoneEngine.js +227 -0
- package/dist/social/ant-colony/index.js +6 -0
- package/dist/social/ant-colony/types.js +24 -0
- package/dist/test/ai-judgment-test.js +80 -0
- package/dist/test/bollharness-integration.test.js +318 -0
- package/dist/test/channel-agent-multi-dialogue.js +205 -0
- package/dist/test/channel-heartbeat-agent-test.js +201 -0
- package/dist/test/constraint-layer.test.js +164 -0
- package/dist/test/diap-identity-test.js +172 -0
- package/dist/test/diap-quick-test.js +62 -0
- package/dist/test/global-shared-context.test.js +315 -0
- package/dist/test/harness-judgment-injection.test.js +246 -0
- package/dist/test/harness-workflow-integrator-test.js +228 -0
- package/dist/test/human-value-store.test.js +243 -0
- package/dist/test/hybrid-integration-test.js +118 -0
- package/dist/test/hybrid-messenger-verify.js +55 -0
- package/dist/test/iroh-bistream-debug.js +38 -0
- package/dist/test/iroh-communication.test.js +66 -0
- package/dist/test/iroh-debug-test.js +57 -0
- package/dist/test/iroh-diap-test.js +71 -0
- package/dist/test/iroh-direct-connect.js +55 -0
- package/dist/test/iroh-e2e-fixed.js +89 -0
- package/dist/test/iroh-e2e-same-process.js +63 -0
- package/dist/test/iroh-e2e.js +66 -0
- package/dist/test/iroh-final-e2e.js +72 -0
- package/dist/test/iroh-relay-test.js +37 -0
- package/dist/test/iroh-simple-test.js +41 -0
- package/dist/test/iroh-transport-verify.js +54 -0
- package/dist/test/iroh-transport.test.js +37 -0
- package/dist/test/iroh-two-nodes.js +70 -0
- package/dist/test/iroh-verify.js +44 -0
- package/dist/test/judgment-decision.test.js +219 -0
- package/dist/test/llm-judgment-integration.test.js +220 -0
- package/dist/test/p2p-agent-complex-dialogue.js +385 -0
- package/dist/test/p2p-agent-dialogue.js +341 -0
- package/dist/test/p2p-agent-full-bidirectional.js +510 -0
- package/dist/test/p2p-agent-harness-flow.js +437 -0
- package/dist/test/p2p-agent-harness-single.js +143 -0
- package/dist/test/p2p-ai-dialogue-test.js +318 -0
- package/dist/test/p2p-cid-connect-test.js +195 -0
- package/dist/test/p2p-connect-receiver.js +69 -0
- package/dist/test/p2p-doc-transfer.js +110 -0
- package/dist/test/p2p-identity-page-test.js +77 -0
- package/dist/test/p2p-iroh-test.js +171 -0
- package/dist/test/p2p-minimal-test.js +241 -0
- package/dist/test/p2p-node-1.js +148 -0
- package/dist/test/p2p-node-2.js +148 -0
- package/dist/test/p2p-server.js +281 -0
- package/dist/test/p2p-two-nodes-test.js +438 -0
- package/dist/test/pi-sdk.test.js +44 -0
- package/dist/test/set-persona.js +40 -0
- package/dist/test/simple.test.js +9 -0
- package/dist/test/storage-integration.test.js +150 -0
- package/dist/test/subagent-manager.test.js +276 -0
- package/dist/test/test-gate-flow.test.js +81 -0
- package/dist/test/workflow-engine.test.js +87 -0
- package/dist/test/workflow-pivot-loop.test.js +246 -0
- package/dist/utils/auto-update.js +7 -0
- package/dist/web/api-config.html +779 -779
- package/dist/web/client-hearth.js +10 -10
- package/dist/web/components/wallet-viem.mjs +118 -118
- package/dist/web/index.html +424 -424
- package/dist/web/manifest.json +20 -20
- package/dist/web/server.js +13 -13
- package/dist/web/style.css +4914 -4914
- package/package.json +193 -193
- package/scripts/build-cli.js +215 -215
- package/scripts/build-web.ts +130 -130
- package/scripts/postinstall.js +152 -152
- package/bin/bolloon-daemon.sh +0 -207
- package/dist/constraint-runtime/reference_data/archive_surface_snapshot.json +0 -63
- package/dist/constraint-runtime/reference_data/commands_snapshot.json +0 -1037
- package/dist/constraint-runtime/reference_data/subsystems/assistant.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/bootstrap.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/bridge.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/buddy.json +0 -13
- package/dist/constraint-runtime/reference_data/subsystems/cli.json +0 -26
- package/dist/constraint-runtime/reference_data/subsystems/components.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/constants.json +0 -28
- package/dist/constraint-runtime/reference_data/subsystems/coordinator.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/entrypoints.json +0 -15
- package/dist/constraint-runtime/reference_data/subsystems/hooks.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/keybindings.json +0 -21
- package/dist/constraint-runtime/reference_data/subsystems/memdir.json +0 -15
- package/dist/constraint-runtime/reference_data/subsystems/migrations.json +0 -18
- package/dist/constraint-runtime/reference_data/subsystems/moreright.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/native_ts.json +0 -11
- package/dist/constraint-runtime/reference_data/subsystems/outputStyles.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/plugins.json +0 -9
- package/dist/constraint-runtime/reference_data/subsystems/remote.json +0 -11
- package/dist/constraint-runtime/reference_data/subsystems/schemas.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/screens.json +0 -10
- package/dist/constraint-runtime/reference_data/subsystems/server.json +0 -10
- package/dist/constraint-runtime/reference_data/subsystems/services.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/skills.json +0 -27
- package/dist/constraint-runtime/reference_data/subsystems/state.json +0 -13
- package/dist/constraint-runtime/reference_data/subsystems/types.json +0 -18
- package/dist/constraint-runtime/reference_data/subsystems/upstreamproxy.json +0 -9
- package/dist/constraint-runtime/reference_data/subsystems/utils.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/vim.json +0 -12
- package/dist/constraint-runtime/reference_data/subsystems/voice.json +0 -8
- package/dist/constraint-runtime/reference_data/tools_snapshot.json +0 -922
- package/dist/constraint-runtime/tools/PolymarketSDK/clobShared.d.ts +0 -50
- package/dist/constraint-runtime/tools/PolymarketSDK/clobShared.js +0 -78
- package/dist/electron/config.js.map +0 -1
- package/dist/electron/dialogs.js.map +0 -1
- package/dist/electron/first-run.js.map +0 -1
- package/dist/electron/ipc.js.map +0 -1
- package/dist/electron/logger.js.map +0 -1
- package/dist/electron/main.js.map +0 -1
- package/dist/electron/menu.js.map +0 -1
- package/dist/electron/paths.js.map +0 -1
- package/dist/electron/server.js.map +0 -1
- package/dist/electron/tray.js.map +0 -1
- package/dist/electron/window.js.map +0 -1
- package/dist/utils/auto-update.js.map +0 -1
- package/dist/web/client.js.map +0 -7
|
@@ -19,101 +19,101 @@ import { getPiSDKConfig } from '../llm/config-store.js';
|
|
|
19
19
|
/**
|
|
20
20
|
* 判断用的 Prompt 模板(可以从 YAML 加载)
|
|
21
21
|
*/
|
|
22
|
-
export const JUDGMENT_PROMPT_TEMPLATE = `你是一个专业的 AI 任务分析专家。你的职责是深入理解用户的问题,并给出精准的判断。
|
|
23
|
-
|
|
24
|
-
【输入】
|
|
25
|
-
{user_input}
|
|
26
|
-
|
|
27
|
-
【历史上下文】
|
|
28
|
-
{history_context}
|
|
29
|
-
|
|
30
|
-
请分析以上输入,回答以下问题:
|
|
31
|
-
|
|
32
|
-
## 1. 问题理解
|
|
33
|
-
|
|
34
|
-
**问题本质**:用户真正想要什么?这是什么类型的问题?
|
|
35
|
-
- how-to: 寻求操作指导
|
|
36
|
-
- why: 寻求解释
|
|
37
|
-
- what: 寻求定义
|
|
38
|
-
- should: 寻求建议
|
|
39
|
-
- feasibility: 寻求可行性评估
|
|
40
|
-
|
|
41
|
-
**核心需求**:用户最想要的结果是什么?
|
|
42
|
-
|
|
43
|
-
**隐含信息**:有什么用户没有明确说但需要考虑的因素?
|
|
44
|
-
- 时间压力?
|
|
45
|
-
- 质量要求?
|
|
46
|
-
- 风险限制?
|
|
47
|
-
- 团队协作?
|
|
48
|
-
|
|
49
|
-
## 2. 复杂性评估
|
|
50
|
-
|
|
51
|
-
**复杂性等级**:这个问题有多复杂?
|
|
52
|
-
- simple: 简单任务,直接可答
|
|
53
|
-
- moderate: 中等复杂,需要一定思考
|
|
54
|
-
- complex: 复杂问题,需要深入分析
|
|
55
|
-
- profound: 深刻问题,需要本质性思考
|
|
56
|
-
|
|
57
|
-
**评估理由**:为什么认为这是这个复杂性等级?
|
|
58
|
-
|
|
59
|
-
**深度**:需要多深的理解?
|
|
60
|
-
- surface: 表面理解即可
|
|
61
|
-
- deeper: 需要分析
|
|
62
|
-
- fundamental: 需要本质性思考
|
|
63
|
-
|
|
64
|
-
## 3. 处理决策
|
|
65
|
-
|
|
66
|
-
**推荐方式**:
|
|
67
|
-
- answer: 直接回答
|
|
68
|
-
- analyze: 深入分析
|
|
69
|
-
- design: 设计方案
|
|
70
|
-
- implement: 实现代码
|
|
71
|
-
- coordinate: 协调多智能体
|
|
72
|
-
|
|
73
|
-
**决策理由**:为什么推荐这个处理方式?
|
|
74
|
-
|
|
75
|
-
## 4. 路由决策
|
|
76
|
-
|
|
77
|
-
**应该调用的 Skills**(可选多个):
|
|
78
|
-
- arch: 架构设计
|
|
79
|
-
- harness-dev: 开发实现
|
|
80
|
-
- guardian-fixer: 代码审查
|
|
81
|
-
- harness-eng: 工程协调
|
|
82
|
-
- harness-eng-test: 测试工程
|
|
83
|
-
- task-arch: 任务分解
|
|
84
|
-
- crystal-learn: 反思学习
|
|
85
|
-
|
|
86
|
-
**参与智能体**(可选):
|
|
87
|
-
- architect: 架构师
|
|
88
|
-
- developer: 开发者
|
|
89
|
-
- reviewer: 审查员
|
|
90
|
-
- coordinator: 协调者
|
|
91
|
-
|
|
92
|
-
**协作模式**:
|
|
93
|
-
- solo: 单独处理
|
|
94
|
-
- pair: 配对协作
|
|
95
|
-
- team: 团队协作
|
|
96
|
-
|
|
97
|
-
## 5. 产出要求
|
|
98
|
-
|
|
99
|
-
**需要的产物**:
|
|
100
|
-
- 问题分析
|
|
101
|
-
- 方案设计
|
|
102
|
-
- 代码实现
|
|
103
|
-
- 测试用例
|
|
104
|
-
- 其他
|
|
105
|
-
|
|
106
|
-
**Gate 建议**(如果有):
|
|
107
|
-
- Gate 0: 问题锁定
|
|
108
|
-
- Gate 1: 架构设计
|
|
109
|
-
- Gate 2: 架构审查
|
|
110
|
-
- Gate 3: 计划制定
|
|
111
|
-
- Gate 4: 计划审查
|
|
112
|
-
- Gate 5: 任务分解
|
|
113
|
-
- Gate 6: 任务审查
|
|
114
|
-
- Gate 7: 代码实现
|
|
115
|
-
- Gate 8: 测试验证
|
|
116
|
-
|
|
22
|
+
export const JUDGMENT_PROMPT_TEMPLATE = `你是一个专业的 AI 任务分析专家。你的职责是深入理解用户的问题,并给出精准的判断。
|
|
23
|
+
|
|
24
|
+
【输入】
|
|
25
|
+
{user_input}
|
|
26
|
+
|
|
27
|
+
【历史上下文】
|
|
28
|
+
{history_context}
|
|
29
|
+
|
|
30
|
+
请分析以上输入,回答以下问题:
|
|
31
|
+
|
|
32
|
+
## 1. 问题理解
|
|
33
|
+
|
|
34
|
+
**问题本质**:用户真正想要什么?这是什么类型的问题?
|
|
35
|
+
- how-to: 寻求操作指导
|
|
36
|
+
- why: 寻求解释
|
|
37
|
+
- what: 寻求定义
|
|
38
|
+
- should: 寻求建议
|
|
39
|
+
- feasibility: 寻求可行性评估
|
|
40
|
+
|
|
41
|
+
**核心需求**:用户最想要的结果是什么?
|
|
42
|
+
|
|
43
|
+
**隐含信息**:有什么用户没有明确说但需要考虑的因素?
|
|
44
|
+
- 时间压力?
|
|
45
|
+
- 质量要求?
|
|
46
|
+
- 风险限制?
|
|
47
|
+
- 团队协作?
|
|
48
|
+
|
|
49
|
+
## 2. 复杂性评估
|
|
50
|
+
|
|
51
|
+
**复杂性等级**:这个问题有多复杂?
|
|
52
|
+
- simple: 简单任务,直接可答
|
|
53
|
+
- moderate: 中等复杂,需要一定思考
|
|
54
|
+
- complex: 复杂问题,需要深入分析
|
|
55
|
+
- profound: 深刻问题,需要本质性思考
|
|
56
|
+
|
|
57
|
+
**评估理由**:为什么认为这是这个复杂性等级?
|
|
58
|
+
|
|
59
|
+
**深度**:需要多深的理解?
|
|
60
|
+
- surface: 表面理解即可
|
|
61
|
+
- deeper: 需要分析
|
|
62
|
+
- fundamental: 需要本质性思考
|
|
63
|
+
|
|
64
|
+
## 3. 处理决策
|
|
65
|
+
|
|
66
|
+
**推荐方式**:
|
|
67
|
+
- answer: 直接回答
|
|
68
|
+
- analyze: 深入分析
|
|
69
|
+
- design: 设计方案
|
|
70
|
+
- implement: 实现代码
|
|
71
|
+
- coordinate: 协调多智能体
|
|
72
|
+
|
|
73
|
+
**决策理由**:为什么推荐这个处理方式?
|
|
74
|
+
|
|
75
|
+
## 4. 路由决策
|
|
76
|
+
|
|
77
|
+
**应该调用的 Skills**(可选多个):
|
|
78
|
+
- arch: 架构设计
|
|
79
|
+
- harness-dev: 开发实现
|
|
80
|
+
- guardian-fixer: 代码审查
|
|
81
|
+
- harness-eng: 工程协调
|
|
82
|
+
- harness-eng-test: 测试工程
|
|
83
|
+
- task-arch: 任务分解
|
|
84
|
+
- crystal-learn: 反思学习
|
|
85
|
+
|
|
86
|
+
**参与智能体**(可选):
|
|
87
|
+
- architect: 架构师
|
|
88
|
+
- developer: 开发者
|
|
89
|
+
- reviewer: 审查员
|
|
90
|
+
- coordinator: 协调者
|
|
91
|
+
|
|
92
|
+
**协作模式**:
|
|
93
|
+
- solo: 单独处理
|
|
94
|
+
- pair: 配对协作
|
|
95
|
+
- team: 团队协作
|
|
96
|
+
|
|
97
|
+
## 5. 产出要求
|
|
98
|
+
|
|
99
|
+
**需要的产物**:
|
|
100
|
+
- 问题分析
|
|
101
|
+
- 方案设计
|
|
102
|
+
- 代码实现
|
|
103
|
+
- 测试用例
|
|
104
|
+
- 其他
|
|
105
|
+
|
|
106
|
+
**Gate 建议**(如果有):
|
|
107
|
+
- Gate 0: 问题锁定
|
|
108
|
+
- Gate 1: 架构设计
|
|
109
|
+
- Gate 2: 架构审查
|
|
110
|
+
- Gate 3: 计划制定
|
|
111
|
+
- Gate 4: 计划审查
|
|
112
|
+
- Gate 5: 任务分解
|
|
113
|
+
- Gate 6: 任务审查
|
|
114
|
+
- Gate 7: 代码实现
|
|
115
|
+
- Gate 8: 测试验证
|
|
116
|
+
|
|
117
117
|
请用 JSON 格式输出分析结果。`;
|
|
118
118
|
/**
|
|
119
119
|
* LLM-native Judgment Engine
|
|
@@ -434,20 +434,20 @@ export const SKILL_PROMPTS = {
|
|
|
434
434
|
arch: {
|
|
435
435
|
name: 'arch',
|
|
436
436
|
description: '架构设计专家',
|
|
437
|
-
systemPrompt: `你是一个经验丰富的系统架构师。你擅长:
|
|
438
|
-
- 从需求中提取本质问题
|
|
439
|
-
- 设计可扩展的系统架构
|
|
440
|
-
- 权衡技术方案
|
|
441
|
-
- 识别架构风险
|
|
442
|
-
|
|
443
|
-
你相信:
|
|
444
|
-
- 本质和实现必须分离
|
|
445
|
-
- 好的架构从简单规则中生长
|
|
437
|
+
systemPrompt: `你是一个经验丰富的系统架构师。你擅长:
|
|
438
|
+
- 从需求中提取本质问题
|
|
439
|
+
- 设计可扩展的系统架构
|
|
440
|
+
- 权衡技术方案
|
|
441
|
+
- 识别架构风险
|
|
442
|
+
|
|
443
|
+
你相信:
|
|
444
|
+
- 本质和实现必须分离
|
|
445
|
+
- 好的架构从简单规则中生长
|
|
446
446
|
- 复杂性应该被控制而非消除`,
|
|
447
|
-
userPromptTemplate: `用户需求:{user_input}
|
|
448
|
-
|
|
449
|
-
{context}
|
|
450
|
-
|
|
447
|
+
userPromptTemplate: `用户需求:{user_input}
|
|
448
|
+
|
|
449
|
+
{context}
|
|
450
|
+
|
|
451
451
|
请进行架构分析:`,
|
|
452
452
|
examples: [
|
|
453
453
|
{
|
|
@@ -460,40 +460,40 @@ export const SKILL_PROMPTS = {
|
|
|
460
460
|
'harness-dev': {
|
|
461
461
|
name: 'harness-dev',
|
|
462
462
|
description: '开发实现专家',
|
|
463
|
-
systemPrompt: `你是一个高效的代码实现专家。你擅长:
|
|
464
|
-
- 快速理解和实现需求
|
|
465
|
-
- 编写清晰、可维护的代码
|
|
466
|
-
- 遵循最佳实践
|
|
467
|
-
- 处理边界情况
|
|
468
|
-
|
|
469
|
-
你相信:
|
|
470
|
-
- 代码即文档
|
|
471
|
-
- 测试是代码的一部分
|
|
463
|
+
systemPrompt: `你是一个高效的代码实现专家。你擅长:
|
|
464
|
+
- 快速理解和实现需求
|
|
465
|
+
- 编写清晰、可维护的代码
|
|
466
|
+
- 遵循最佳实践
|
|
467
|
+
- 处理边界情况
|
|
468
|
+
|
|
469
|
+
你相信:
|
|
470
|
+
- 代码即文档
|
|
471
|
+
- 测试是代码的一部分
|
|
472
472
|
- 简单优于复杂`,
|
|
473
|
-
userPromptTemplate: `任务:{user_input}
|
|
474
|
-
|
|
475
|
-
技术栈:{tech_stack}
|
|
476
|
-
|
|
473
|
+
userPromptTemplate: `任务:{user_input}
|
|
474
|
+
|
|
475
|
+
技术栈:{tech_stack}
|
|
476
|
+
|
|
477
477
|
请实现代码:`,
|
|
478
478
|
outputFormat: 'code'
|
|
479
479
|
},
|
|
480
480
|
'guardian-fixer': {
|
|
481
481
|
name: 'guardian-fixer',
|
|
482
482
|
description: '代码审查专家',
|
|
483
|
-
systemPrompt: `你是一个严格的代码审查专家。你擅长:
|
|
484
|
-
- 发现潜在问题
|
|
485
|
-
- 提出改进建议
|
|
486
|
-
- 确保代码质量
|
|
487
|
-
- 平衡效率和安全性
|
|
488
|
-
|
|
489
|
-
你相信:
|
|
490
|
-
- 细节决定成败
|
|
491
|
-
- 代码审查是质量保障的最后防线
|
|
483
|
+
systemPrompt: `你是一个严格的代码审查专家。你擅长:
|
|
484
|
+
- 发现潜在问题
|
|
485
|
+
- 提出改进建议
|
|
486
|
+
- 确保代码质量
|
|
487
|
+
- 平衡效率和安全性
|
|
488
|
+
|
|
489
|
+
你相信:
|
|
490
|
+
- 细节决定成败
|
|
491
|
+
- 代码审查是质量保障的最后防线
|
|
492
492
|
- 建设性批评比否定更有价值`,
|
|
493
|
-
userPromptTemplate: `代码:\n{code}
|
|
494
|
-
|
|
495
|
-
审查范围:{scope}
|
|
496
|
-
|
|
493
|
+
userPromptTemplate: `代码:\n{code}
|
|
494
|
+
|
|
495
|
+
审查范围:{scope}
|
|
496
|
+
|
|
497
497
|
请进行审查:`,
|
|
498
498
|
outputFormat: 'structured'
|
|
499
499
|
}
|
|
@@ -377,16 +377,16 @@ export class PeerSyncSkill extends BaseSkill {
|
|
|
377
377
|
}
|
|
378
378
|
this.log(`peer-sync 启动: target_id=${targetId}`);
|
|
379
379
|
// 选 peer 的策略由 LLM 决定 (根据 list_peers 输出 + expertise tag)
|
|
380
|
-
return this.callLm(`You are a peer-selection specialist for the bolloon P2P network.
|
|
381
|
-
Given a target_id and task description, output structured JSON with:
|
|
382
|
-
- selectedPeer: DID of the best peer (or null if none suitable)
|
|
383
|
-
- channelName: human-readable name for the new channel
|
|
384
|
-
- initialMessage: first message to send (≤ 200 chars, brief + asks for acceptance)
|
|
385
|
-
- estimatedRounds: expected back-and-forth count (1-10)
|
|
386
|
-
|
|
387
|
-
Rules:
|
|
388
|
-
- Prefer peers with matching expertise tag
|
|
389
|
-
- If no peer matches, return selectedPeer: null
|
|
380
|
+
return this.callLm(`You are a peer-selection specialist for the bolloon P2P network.
|
|
381
|
+
Given a target_id and task description, output structured JSON with:
|
|
382
|
+
- selectedPeer: DID of the best peer (or null if none suitable)
|
|
383
|
+
- channelName: human-readable name for the new channel
|
|
384
|
+
- initialMessage: first message to send (≤ 200 chars, brief + asks for acceptance)
|
|
385
|
+
- estimatedRounds: expected back-and-forth count (1-10)
|
|
386
|
+
|
|
387
|
+
Rules:
|
|
388
|
+
- Prefer peers with matching expertise tag
|
|
389
|
+
- If no peer matches, return selectedPeer: null
|
|
390
390
|
- Don't over-explain — peer agent has same identity layer as you`, `target_id: ${targetId}\ntask: ${task}`);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
@@ -412,17 +412,17 @@ export class HabitDistillSkill extends BaseSkill {
|
|
|
412
412
|
}
|
|
413
413
|
this.log(`habit-distill 启动: session=${sessionKey}`);
|
|
414
414
|
// 抽取习性的 prompt — 让 LLM 输出结构化 JSON
|
|
415
|
-
return this.callLm(`You are a habit-extraction specialist.
|
|
416
|
-
Given a summary of user-assistant interaction, output JSON with:
|
|
417
|
-
- habits: [{ content: string, tags: string[], weight: 'low'|'medium'|'high' }]
|
|
418
|
-
- content: 一个用户偏好/习性的简短描述 (≤ 100 字)
|
|
419
|
-
- tags: 标签如 ['input-style', 'terminology', 'recurring-topic', 'correction']
|
|
420
|
-
- weight: 影响判断力注入门时的优先级
|
|
421
|
-
- skipReason: 若不该蒸馏 (用户拒绝/任务太简单/judgment 库饱和), 填理由
|
|
422
|
-
|
|
423
|
-
Rules:
|
|
424
|
-
- 习性必须是"用户可观察到的稳定模式", 不是单次偏好
|
|
425
|
-
- 隐私相关打 tags 含 'private', 注入门自动过滤
|
|
415
|
+
return this.callLm(`You are a habit-extraction specialist.
|
|
416
|
+
Given a summary of user-assistant interaction, output JSON with:
|
|
417
|
+
- habits: [{ content: string, tags: string[], weight: 'low'|'medium'|'high' }]
|
|
418
|
+
- content: 一个用户偏好/习性的简短描述 (≤ 100 字)
|
|
419
|
+
- tags: 标签如 ['input-style', 'terminology', 'recurring-topic', 'correction']
|
|
420
|
+
- weight: 影响判断力注入门时的优先级
|
|
421
|
+
- skipReason: 若不该蒸馏 (用户拒绝/任务太简单/judgment 库饱和), 填理由
|
|
422
|
+
|
|
423
|
+
Rules:
|
|
424
|
+
- 习性必须是"用户可观察到的稳定模式", 不是单次偏好
|
|
425
|
+
- 隐私相关打 tags 含 'private', 注入门自动过滤
|
|
426
426
|
- 不要重复已有 judgment (调用方负责查重)`, `Session: ${sessionKey}\nMessages summary: ${recentMessagesSummary || '(caller should pass loadMessages output)'}`);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -10,12 +10,25 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { runAdaptiveScan, logEvolution } from '../pi-ecosystem-judgment/adaptive-scan.js';
|
|
12
12
|
import { collectBolloonContext } from './context-collector.js';
|
|
13
|
+
import { migrateAllExternalAgents, formatMigrationNotices } from '../migration/external-agent-migrator.js';
|
|
13
14
|
/**
|
|
14
15
|
* 入口: web server / CLI 启动时调一次
|
|
15
16
|
*/
|
|
16
17
|
export async function bootstrapBolloon(opts = {}) {
|
|
17
18
|
const start = Date.now();
|
|
18
19
|
const errors = [];
|
|
20
|
+
// 0. 外部智能体 (openclaw/hermes) 数据迁移 — 隐式处理, 静默跑, 结果通告用户
|
|
21
|
+
let externalAgentMigrations = [];
|
|
22
|
+
try {
|
|
23
|
+
externalAgentMigrations = await migrateAllExternalAgents();
|
|
24
|
+
for (const line of formatMigrationNotices(externalAgentMigrations)) {
|
|
25
|
+
console.log(`[bootstrap] ${line}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
errors.push(`external-migration: ${err.message}`);
|
|
30
|
+
console.warn('[bootstrap] 外部智能体迁移失败 (非致命):', err);
|
|
31
|
+
}
|
|
19
32
|
// 1. 类 B 启动扫描
|
|
20
33
|
let scanResult = {
|
|
21
34
|
scannedAt: new Date().toISOString(),
|
|
@@ -80,7 +93,7 @@ export async function bootstrapBolloon(opts = {}) {
|
|
|
80
93
|
}
|
|
81
94
|
const durationMs = Date.now() - start;
|
|
82
95
|
console.log(`[bootstrap] 完成 (${durationMs}ms, ${errors.length} 个错误)`);
|
|
83
|
-
return { context, scanResult, durationMs, errors };
|
|
96
|
+
return { context, scanResult, durationMs, errors, externalAgentMigrations };
|
|
84
97
|
}
|
|
85
98
|
// ============================================================
|
|
86
99
|
// 定时任务: 每天 0:00 跑类 B 自适应扫描
|
|
@@ -117,20 +117,20 @@ function templateMonthlySummary(opts) {
|
|
|
117
117
|
const channelSet = new Set(opts.entries.map(e => e.channelName).filter(Boolean));
|
|
118
118
|
const sampleUser = user.slice(0, 5).map(e => ` - [${e.ts}] ${e.text.slice(0, 80)}`).join('\n');
|
|
119
119
|
const sampleAi = ai.slice(0, 5).map(e => ` - [${e.ts}] ${e.text.slice(0, 80)}`).join('\n');
|
|
120
|
-
return `# 月度对话摘要 — ${opts.yearMonth} (peer ${opts.publicKey.slice(0, 12)}…)
|
|
121
|
-
|
|
122
|
-
时间: ${opts.timestamp}
|
|
123
|
-
对话轮次: ${opts.entries.length} (user=${user.length}, ai=${ai.length})
|
|
124
|
-
涉及 channel: ${Array.from(channelSet).slice(0, 10).join(', ') || '(无)'}
|
|
125
|
-
|
|
126
|
-
## 用户关键提问
|
|
127
|
-
${sampleUser || ' (无)'}
|
|
128
|
-
|
|
129
|
-
## AI 关键回答
|
|
130
|
-
${sampleAi || ' (无)'}
|
|
131
|
-
|
|
132
|
-
## 备注
|
|
133
|
-
- 此摘要由模板生成 (LLM 调用失败 fallback)
|
|
120
|
+
return `# 月度对话摘要 — ${opts.yearMonth} (peer ${opts.publicKey.slice(0, 12)}…)
|
|
121
|
+
|
|
122
|
+
时间: ${opts.timestamp}
|
|
123
|
+
对话轮次: ${opts.entries.length} (user=${user.length}, ai=${ai.length})
|
|
124
|
+
涉及 channel: ${Array.from(channelSet).slice(0, 10).join(', ') || '(无)'}
|
|
125
|
+
|
|
126
|
+
## 用户关键提问
|
|
127
|
+
${sampleUser || ' (无)'}
|
|
128
|
+
|
|
129
|
+
## AI 关键回答
|
|
130
|
+
${sampleAi || ' (无)'}
|
|
131
|
+
|
|
132
|
+
## 备注
|
|
133
|
+
- 此摘要由模板生成 (LLM 调用失败 fallback)
|
|
134
134
|
`;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
@@ -184,7 +184,11 @@ function collectEnv() {
|
|
|
184
184
|
let llmProvider = 'unknown';
|
|
185
185
|
try {
|
|
186
186
|
const home = process.env.HOME || os.homedir() || '/tmp';
|
|
187
|
-
|
|
187
|
+
// 2026-08-07: bolloon-config.json 优先, 旧 llm-config.json 兜底
|
|
188
|
+
let cfgPath = path.join(home, '.bolloon', 'bolloon-config.json');
|
|
189
|
+
if (!require('fs').existsSync(cfgPath))
|
|
190
|
+
cfgPath = path.join(home, '.bolloon', 'llm-config.json');
|
|
191
|
+
const cfg = require(cfgPath);
|
|
188
192
|
if (cfg && typeof cfg === 'object' && 'provider' in cfg) {
|
|
189
193
|
llmProvider = String(cfg.provider);
|
|
190
194
|
}
|
|
@@ -63,27 +63,27 @@ function slugify(s) {
|
|
|
63
63
|
// 初始化: 建目录 + 每层 README (幂等)
|
|
64
64
|
// ============================================================
|
|
65
65
|
function layerReadme(l) {
|
|
66
|
-
return `# ${l.key} — ${l.name}
|
|
67
|
-
|
|
68
|
-
## 这一层回答的问题
|
|
69
|
-
${l.name}
|
|
70
|
-
|
|
71
|
-
## 存什么
|
|
72
|
-
${l.store}
|
|
73
|
-
|
|
74
|
-
## 不该存什么
|
|
75
|
-
${l.notStore}
|
|
76
|
-
|
|
77
|
-
## 典型用途
|
|
78
|
-
${l.usage}
|
|
79
|
-
|
|
80
|
-
## 价值判断标准 (Context OS §5)
|
|
81
|
-
写入前先回答: **未来哪个具体场景会用到它?**
|
|
82
|
-
回答不出 = 噪音, 留在 tmp/, 不进正式层.
|
|
83
|
-
|
|
84
|
-
## 价值生命周期
|
|
85
|
-
阶段0 临时价值点 (对话中刚出现, 未验证) → 阶段1 验证 (被使用/确认)
|
|
86
|
-
→ 阶段2 固化 (本层唯一位置) → 阶段3 索引化 (高频引用) → 阶段4 归档/删除.
|
|
66
|
+
return `# ${l.key} — ${l.name}
|
|
67
|
+
|
|
68
|
+
## 这一层回答的问题
|
|
69
|
+
${l.name}
|
|
70
|
+
|
|
71
|
+
## 存什么
|
|
72
|
+
${l.store}
|
|
73
|
+
|
|
74
|
+
## 不该存什么
|
|
75
|
+
${l.notStore}
|
|
76
|
+
|
|
77
|
+
## 典型用途
|
|
78
|
+
${l.usage}
|
|
79
|
+
|
|
80
|
+
## 价值判断标准 (Context OS §5)
|
|
81
|
+
写入前先回答: **未来哪个具体场景会用到它?**
|
|
82
|
+
回答不出 = 噪音, 留在 tmp/, 不进正式层.
|
|
83
|
+
|
|
84
|
+
## 价值生命周期
|
|
85
|
+
阶段0 临时价值点 (对话中刚出现, 未验证) → 阶段1 验证 (被使用/确认)
|
|
86
|
+
→ 阶段2 固化 (本层唯一位置) → 阶段3 索引化 (高频引用) → 阶段4 归档/删除.
|
|
87
87
|
`;
|
|
88
88
|
}
|
|
89
89
|
export async function ensureContextOsDirs(home) {
|
|
@@ -94,19 +94,19 @@ function templateSummary(opts) {
|
|
|
94
94
|
const aiMsgs = opts.newMessages.filter(m => m.type === 'ai');
|
|
95
95
|
const userSnippet = userMsgs.slice(0, 3).map(m => ` - ${m.content.slice(0, 80)}`).join('\n');
|
|
96
96
|
const aiSnippet = aiMsgs.slice(0, 3).map(m => ` - ${m.content.slice(0, 80)}`).join('\n');
|
|
97
|
-
return `# Session 摘要 — ${opts.channelId} / ${opts.sessionId}
|
|
98
|
-
|
|
99
|
-
时间: ${opts.timestamp}
|
|
100
|
-
新增消息数: ${opts.newMessages.length} (user=${userMsgs.length}, ai=${aiMsgs.length})
|
|
101
|
-
|
|
102
|
-
## 用户关键提问
|
|
103
|
-
${userSnippet || ' (无)'}
|
|
104
|
-
|
|
105
|
-
## AI 关键回答
|
|
106
|
-
${aiSnippet || ' (无)'}
|
|
107
|
-
|
|
108
|
-
## 备注
|
|
109
|
-
- 此摘要由模板生成 (LLM 调用失败 fallback)
|
|
97
|
+
return `# Session 摘要 — ${opts.channelId} / ${opts.sessionId}
|
|
98
|
+
|
|
99
|
+
时间: ${opts.timestamp}
|
|
100
|
+
新增消息数: ${opts.newMessages.length} (user=${userMsgs.length}, ai=${aiMsgs.length})
|
|
101
|
+
|
|
102
|
+
## 用户关键提问
|
|
103
|
+
${userSnippet || ' (无)'}
|
|
104
|
+
|
|
105
|
+
## AI 关键回答
|
|
106
|
+
${aiSnippet || ' (无)'}
|
|
107
|
+
|
|
108
|
+
## 备注
|
|
109
|
+
- 此摘要由模板生成 (LLM 调用失败 fallback)
|
|
110
110
|
`;
|
|
111
111
|
}
|
|
112
112
|
/**
|
package/dist/cli/ink-app.js
CHANGED
|
@@ -41,6 +41,13 @@ const MentionPopup = ({ title, items, sel, width, loading }) => {
|
|
|
41
41
|
};
|
|
42
42
|
const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH }) => {
|
|
43
43
|
const [input, setInput] = useState('');
|
|
44
|
+
// 2026-08-07: inputRef 同步镜像 input — useInput 回调拿最新值 (闭包里的 input 是陈旧的)
|
|
45
|
+
const inputRef = useRef('');
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
inputRef.current = input;
|
|
48
|
+
}, [input]);
|
|
49
|
+
// 2026-08-07: 提交防重 (InkApp \n/\r 兜底 + TextInput 双触发场景)
|
|
50
|
+
const lastSubmitRef = useRef({ t: 0, v: '' });
|
|
44
51
|
const [msgs, setMsgs] = useState([]);
|
|
45
52
|
const [status, setStatus] = useState(initialStatus);
|
|
46
53
|
const { exit } = useApp();
|
|
@@ -285,6 +292,11 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
|
|
|
285
292
|
}, []);
|
|
286
293
|
const onSubmit = useCallback((value) => {
|
|
287
294
|
const trimmed = value.trim();
|
|
295
|
+
// 2026-08-07: 防重 — \n/\r 兜底分支与 TextInput 可能都触发提交, 1.5s 内同值只提交一次
|
|
296
|
+
const now = Date.now();
|
|
297
|
+
if (lastSubmitRef.current.v === trimmed && now - lastSubmitRef.current.t < 1500)
|
|
298
|
+
return;
|
|
299
|
+
lastSubmitRef.current = { t: now, v: trimmed };
|
|
288
300
|
if (!trimmed)
|
|
289
301
|
return;
|
|
290
302
|
// 入历史 (去重最近一条, 上限 100)
|
|
@@ -349,13 +361,13 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
|
|
|
349
361
|
setSel(s => Math.min(filtered.length - 1, s + 1));
|
|
350
362
|
return;
|
|
351
363
|
}
|
|
352
|
-
if ((key.tab || key.return) && filtered.length > 0) {
|
|
364
|
+
if ((key.tab || key.return || /[\n\r]/.test(_input)) && filtered.length > 0) {
|
|
353
365
|
const it = filtered[safeSel];
|
|
354
366
|
if (it)
|
|
355
367
|
acceptMention(it);
|
|
356
368
|
return;
|
|
357
369
|
}
|
|
358
|
-
if (key.return && filtered.length === 0) {
|
|
370
|
+
if ((key.return || /[\n\r]/.test(_input)) && filtered.length === 0) {
|
|
359
371
|
// 弹窗无匹配项: Enter = 提交当前输入 (否则 /channel 无参 + Enter 永远提交不了 — 2026-08-06)
|
|
360
372
|
const v = input.trim();
|
|
361
373
|
if (v)
|
|
@@ -409,7 +421,19 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
|
|
|
409
421
|
return; // 其余键忽略 (return/tab/esc 等由 TextInput 或上层处理)
|
|
410
422
|
}
|
|
411
423
|
// ── 正常模式 ──
|
|
412
|
-
//
|
|
424
|
+
// 2026-08-07: Enter 兜底 — pty/管道下 termios 可能把 \r 转 \n 且 node 把整 chunk
|
|
425
|
+
// 当一次 keypress (key.return=false), TextInput 的 onSubmit 永不触发 → 消息发不出去.
|
|
426
|
+
// 应用层把 \n/\r 一律视为提交 (兼容 raw/cooked 两种模式, 不依赖 termios).
|
|
427
|
+
if (/[\n\r]/.test(_input)) {
|
|
428
|
+
const before = String(_input).split(/[\n\r]/)[0];
|
|
429
|
+
const val = inputRef.current + before;
|
|
430
|
+
if (val.trim())
|
|
431
|
+
onSubmit(val);
|
|
432
|
+
else
|
|
433
|
+
setInput('');
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
// Tab 命令补齐 (匹配触发符后的 token 再补)
|
|
413
437
|
if (key.tab) {
|
|
414
438
|
doTabCompletion();
|
|
415
439
|
return;
|
|
@@ -468,14 +492,28 @@ const InkApp = ({ onPrompt, initialStatus, getStatusUpdate, terminalW, terminalH
|
|
|
468
492
|
// TextInput handles actual input; useInput only for Ctrl+C / Esc
|
|
469
493
|
});
|
|
470
494
|
// 自动更新状态栏 (每秒)
|
|
495
|
+
// 2026-08-07 修复: 依赖必须为空 [] — [getStatusUpdate] 在渲染间引用变化 (Ink 内部元素重建),
|
|
496
|
+
// effect 每次渲染 cleanup+setup → setInterval 刚建立就被清除 → 永不 tick → 状态栏恒初始值.
|
|
497
|
+
// getStatusUpdate 是 startInk 传入的模块级函数 (引用稳定), 空依赖首渲染捕获即可, 内部实时读.
|
|
471
498
|
useEffect(() => {
|
|
499
|
+
// 挂载时立即同步刷新一次状态栏 (不等 1s 后第一个 tick)
|
|
500
|
+
try {
|
|
501
|
+
const s0 = getStatusUpdate();
|
|
502
|
+
if (s0)
|
|
503
|
+
setStatus(s0);
|
|
504
|
+
}
|
|
505
|
+
catch { /* 状态栏更新失败不致命 */ }
|
|
472
506
|
const timer = setInterval(() => {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
507
|
+
try {
|
|
508
|
+
const s = getStatusUpdate();
|
|
509
|
+
if (s)
|
|
510
|
+
setStatus(s);
|
|
511
|
+
}
|
|
512
|
+
catch { /* 状态栏更新失败不致命 */ }
|
|
476
513
|
}, 1000);
|
|
477
514
|
return () => clearInterval(timer);
|
|
478
|
-
|
|
515
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
516
|
+
}, []);
|
|
479
517
|
// 调试/测试钩子: 输入变化时通知外部 (pty 测试用)
|
|
480
518
|
useEffect(() => {
|
|
481
519
|
globalThis.__inkOnInput?.(input);
|
|
@@ -511,7 +549,7 @@ export function startInk(onPrompt, initialStatus, getStatusUpdate) {
|
|
|
511
549
|
stdout: process.stdout,
|
|
512
550
|
stdin: process.stdin,
|
|
513
551
|
exitOnCtrlC: false,
|
|
514
|
-
patchConsole: false, //
|
|
552
|
+
patchConsole: false, // 重要: 阻止 Ink 劫持 console.log
|
|
515
553
|
});
|
|
516
554
|
}
|
|
517
555
|
export function stopInk() {
|
package/dist/cli/loading-tui.js
CHANGED
|
@@ -23,12 +23,14 @@ function bg(r, g, b) { return `\x1b[48;2;${r};${g};${b}m`; }
|
|
|
23
23
|
const C_ACCENT = fg(0xc4, 0xd6, 0x40); // #c4d640
|
|
24
24
|
const C_ACCENT_BG = bg(0xc4, 0xd6, 0x40);
|
|
25
25
|
const C_TEXT = fg(0xd8, 0xd8, 0xc8); // #d8d8c8
|
|
26
|
+
const C_WHITE = fg(0xff, 0xff, 0xff); // #ffffff 纯白 (2026-08-07: 用户要求回复字体白色显眼)
|
|
26
27
|
const C_DIM = fg(0x90, 0x90, 0x88); // #909088
|
|
27
28
|
const C_MUTED = fg(0x60, 0x60, 0x58); // #606058
|
|
28
29
|
const C_OK = fg(0x22, 0xc5, 0x5e); // #22c55e
|
|
29
30
|
const C_ERROR = fg(0xef, 0x44, 0x44); // #ef4444
|
|
30
31
|
const C_WARN = fg(0xf5, 0x9e, 0x0b); // #f59e0b
|
|
31
|
-
const C_BORDER = fg(0x3a, 0x3a, 0x36); // #3a3a36
|
|
32
|
+
const C_BORDER = fg(0x3a, 0x3a, 0x36); // #3a3a36 (暗描边)
|
|
33
|
+
const C_BORDER_BRIGHT = fg(0x8a, 0x8a, 0x7e); // #8a8a7e (2026-08-07: 对话框边框提亮, 告别灰白)
|
|
32
34
|
const HIDE = '\x1b[?25l';
|
|
33
35
|
const SHOW = '\x1b[?25h';
|
|
34
36
|
// 版本信息 — 从 package.json 读取, 不再硬编码
|
|
@@ -287,11 +289,11 @@ export function renderMessageBox(opts) {
|
|
|
287
289
|
const inner = Math.max(20, dispWidth(title) + 4, maxLine);
|
|
288
290
|
const width = Math.min(termWidth() - 2, opts.width ?? inner + 4);
|
|
289
291
|
const lines = [];
|
|
290
|
-
// 2026-08-
|
|
291
|
-
lines.push(`${
|
|
292
|
+
// 2026-08-07: 边框提亮 (C_BORDER_BRIGHT), 正文纯白 (C_WHITE) — 告别灰白内容
|
|
293
|
+
lines.push(`${C_BORDER_BRIGHT}${boxTop(`${color}${title}${RESET}`, width, RD)}${RESET}`);
|
|
292
294
|
for (const l of wrapText(opts.body, width - 4))
|
|
293
|
-
lines.push(`${
|
|
294
|
-
lines.push(`${
|
|
295
|
+
lines.push(`${C_BORDER_BRIGHT}${boxRow(`${C_WHITE}${l}${RESET}`, width, 'left', RD)}${RESET}`);
|
|
296
|
+
lines.push(`${C_BORDER_BRIGHT}${boxBottom(width, RD)}${RESET}`);
|
|
295
297
|
return lines.join('\n');
|
|
296
298
|
}
|
|
297
299
|
/** 取首条非空行作为预览 (按可见宽度截断, 加省略号) */
|
package/dist/cli/mention-data.js
CHANGED
|
@@ -203,7 +203,8 @@ export async function loadFiles(_query, base = process.cwd(), maxDepth = 3, cap
|
|
|
203
203
|
dirs.push({ dir: full, depth: depth + 1 });
|
|
204
204
|
}
|
|
205
205
|
else if (e.isFile()) {
|
|
206
|
-
|
|
206
|
+
// label/insert 统一用 `/` 分隔 (展示 + matchFileScore split + 弹窗插入一致), 跨平台
|
|
207
|
+
const rel = path.relative(base, full).split(path.sep).join('/');
|
|
207
208
|
out.push({ kind: 'file', label: rel, hint: '', insert: rel });
|
|
208
209
|
}
|
|
209
210
|
}
|