@bolloon/bolloon-agent 0.2.8 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +467 -467
- package/bin/bolloon-cli.cjs +183 -183
- package/bin/bolloon.cjs +0 -0
- package/bin/bolloon.js +157 -0
- package/dist/agents/agent-manifest-protocol.js +0 -52
- package/dist/agents/constraint-layer.js +19 -19
- package/dist/agents/pi-sdk.js +287 -1213
- package/dist/agents/shell-guard.js +2 -2
- package/dist/agents/workflow-pivot-loop.js +2 -81
- 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 -26
- package/dist/bollharness-integration/integration.js +0 -71
- package/dist/bollharness-integration/llm-judgment-engine.js +134 -134
- package/dist/bollharness-integration/skill-adapter.js +127 -52
- package/dist/bootstrap/context-collector.js +3 -6
- package/dist/bootstrap/lifecycle-hooks.js +1 -15
- package/dist/cli-entry.js +35 -39
- package/dist/constraint-runtime/src/_archive_helper.js +9 -0
- package/dist/constraint-runtime/src/agent/coordinator.js +48 -0
- package/dist/constraint-runtime/src/agent/index.js +1 -0
- package/dist/constraint-runtime/src/assistant/index.js +12 -0
- package/dist/constraint-runtime/src/bootstrap/index.js +12 -0
- package/dist/constraint-runtime/src/bootstrap_graph.js +13 -0
- package/dist/constraint-runtime/src/bridge/index.js +12 -0
- package/dist/constraint-runtime/src/buddy/index.js +12 -0
- package/dist/constraint-runtime/src/cli/index.js +12 -0
- package/dist/constraint-runtime/src/command_graph.js +10 -0
- package/dist/constraint-runtime/src/commands.js +60 -0
- package/dist/constraint-runtime/src/components/index.js +12 -0
- package/dist/constraint-runtime/src/constants/index.js +12 -0
- package/dist/constraint-runtime/src/constraint/budget.js +22 -0
- package/dist/constraint-runtime/src/constraint/index.js +2 -0
- package/dist/constraint-runtime/src/constraint/permission.js +20 -0
- package/dist/constraint-runtime/src/context.js +30 -0
- package/dist/constraint-runtime/src/coordinator/index.js +12 -0
- package/dist/constraint-runtime/src/cost_hook.js +4 -0
- package/dist/constraint-runtime/src/cost_tracker.js +8 -0
- package/dist/constraint-runtime/src/deferred_init.js +10 -0
- package/dist/constraint-runtime/src/direct_modes.js +6 -0
- package/dist/constraint-runtime/src/dynamic-tool-loader.js +85 -0
- package/dist/constraint-runtime/src/entrypoints/index.js +12 -0
- package/dist/constraint-runtime/src/execution_registry.js +44 -0
- package/dist/constraint-runtime/src/history.js +9 -0
- package/dist/constraint-runtime/src/hooks/index.js +12 -0
- package/dist/constraint-runtime/src/index.js +26 -0
- package/dist/constraint-runtime/src/ink.js +4 -0
- package/dist/constraint-runtime/src/keybindings/index.js +12 -0
- package/dist/constraint-runtime/src/memdir/index.js +12 -0
- package/dist/constraint-runtime/src/migrations/index.js +12 -0
- package/dist/constraint-runtime/src/models.js +1 -0
- package/dist/constraint-runtime/src/moreright/index.js +12 -0
- package/dist/constraint-runtime/src/native_ts/index.js +12 -0
- package/dist/constraint-runtime/src/output_styles/index.js +12 -0
- package/dist/constraint-runtime/src/parity_audit.js +12 -0
- package/dist/constraint-runtime/src/plugins/index.js +12 -0
- package/dist/constraint-runtime/src/port_manifest.js +11 -0
- package/dist/constraint-runtime/src/prefetch.js +9 -0
- package/dist/constraint-runtime/src/query.js +1 -0
- package/dist/constraint-runtime/src/remote/index.js +12 -0
- package/dist/constraint-runtime/src/remote_runtime.js +9 -0
- package/dist/constraint-runtime/src/runtime/index.js +1 -0
- package/dist/constraint-runtime/src/runtime/session.js +35 -0
- package/dist/constraint-runtime/src/schemas/index.js +12 -0
- package/dist/constraint-runtime/src/screens/index.js +12 -0
- package/dist/constraint-runtime/src/server/index.js +12 -0
- package/dist/constraint-runtime/src/services/index.js +12 -0
- package/dist/constraint-runtime/src/session_store.js +22 -0
- package/dist/constraint-runtime/src/setup.js +30 -0
- package/dist/constraint-runtime/src/skills/index.js +1 -0
- package/dist/constraint-runtime/src/skills/skill-registry.js +28 -0
- package/dist/constraint-runtime/src/state/index.js +12 -0
- package/dist/constraint-runtime/src/system_init.js +20 -0
- package/dist/constraint-runtime/src/thinking/engine.js +42 -0
- package/dist/constraint-runtime/src/thinking/index.js +1 -0
- package/dist/constraint-runtime/src/tool_pool.js +8 -0
- package/dist/constraint-runtime/src/tools/OpenCLI/execAdapter.js +7 -0
- package/dist/constraint-runtime/src/tools/OpenCLI/listAdapters.js +7 -0
- package/dist/constraint-runtime/src/tools/OpenCLI/runCommand.js +7 -0
- package/dist/constraint-runtime/src/tools/SafeSDK/confirmTransaction.js +6 -0
- package/dist/constraint-runtime/src/tools/SafeSDK/createTransaction.js +8 -0
- package/dist/constraint-runtime/src/tools/SafeSDK/executeTransaction.js +6 -0
- package/dist/constraint-runtime/src/tools/SafeSDK/getBalance.js +6 -0
- package/dist/constraint-runtime/src/tools/SafeSDK/getPendingTransactions.js +6 -0
- package/dist/constraint-runtime/src/tools/SafeSDK/proposeTransaction.js +6 -0
- package/dist/constraint-runtime/src/tools.js +80 -0
- package/dist/constraint-runtime/src/transcript.js +19 -0
- package/dist/constraint-runtime/src/types/index.js +12 -0
- package/dist/constraint-runtime/src/upstream_proxy/index.js +12 -0
- package/dist/constraint-runtime/src/utils/index.js +12 -0
- package/dist/constraint-runtime/src/vim/index.js +12 -0
- package/dist/constraint-runtime/src/voice/index.js +12 -0
- package/dist/constraint-runtime/tests/agent.test.js +16 -0
- package/dist/constraint-runtime/tests/constraint.test.js +41 -0
- package/dist/constraint-runtime/tests/skill.test.js +19 -0
- package/dist/constraint-runtime/tests/thinking.test.js +22 -0
- package/dist/context-compaction/auto-compact.js +7 -7
- package/dist/electron-preload.js +1 -18
- package/dist/electron-preload.js.map +1 -1
- package/dist/electron.js +168 -3
- package/dist/electron.js.map +1 -1
- package/dist/index.js +116 -136
- package/dist/llm/config-store.js +8 -24
- package/dist/llm/llm-judgment-client.js +102 -102
- package/dist/llm/pi-ai.js +85 -126
- 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-visitor.md +19 -19
- 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/hibs_reminders.md +15 -15
- package/dist/llm/system-prompt/layers/core/identity.md +37 -37
- 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/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/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/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/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 +0 -11
- 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/web/api-config.html +520 -520
- package/dist/web/client.js +2917 -3791
- package/dist/web/components/p2p/index.js +234 -276
- package/dist/web/components/wallet-viem.mjs +118 -118
- package/dist/web/index.html +374 -373
- package/dist/web/manifest.json +20 -20
- package/dist/web/server.js +23 -775
- package/dist/web/style.css +4737 -4737
- package/dist/web/ui/message-renderer.js +373 -451
- package/dist/web/ui/step-timeline.js +255 -351
- package/package.json +160 -157
- package/scripts/build-cli.js +216 -0
- package/scripts/build-web.ts +125 -0
- package/scripts/postinstall.js +153 -0
- package/bin/bolloon-daemon.sh +0 -207
- package/bin/ipfs +0 -0
- package/dist/agents/chat-segmenter.js +0 -298
- package/dist/agents/judgment-protocol.js +0 -479
- package/dist/agents/parse-tool-call.js +0 -304
- package/dist/agents/peer-manifest-loader.js +0 -210
- package/dist/agents/react-loop.js +0 -120
- package/dist/agents/session-store.js +0 -171
- package/dist/agents/tool-registry.js +0 -136
- package/dist/bootstrap/chat-archiver.js +0 -276
- package/dist/bootstrap/memory-compressor.js +0 -170
- package/dist/bootstrap/persona-loader.js +0 -94
- package/dist/electron/config.js +0 -16
- package/dist/electron/config.js.map +0 -1
- package/dist/electron/dialogs.js +0 -71
- package/dist/electron/dialogs.js.map +0 -1
- package/dist/electron/first-run.js +0 -129
- package/dist/electron/first-run.js.map +0 -1
- package/dist/electron/ipc.js +0 -16
- package/dist/electron/ipc.js.map +0 -1
- package/dist/electron/logger.js +0 -77
- package/dist/electron/logger.js.map +0 -1
- package/dist/electron/main.js +0 -60
- package/dist/electron/main.js.map +0 -1
- package/dist/electron/menu.js +0 -140
- package/dist/electron/menu.js.map +0 -1
- package/dist/electron/paths.js +0 -33
- package/dist/electron/paths.js.map +0 -1
- package/dist/electron/server.js +0 -74
- package/dist/electron/server.js.map +0 -1
- package/dist/electron/tray.js +0 -73
- package/dist/electron/tray.js.map +0 -1
- package/dist/electron/window.js +0 -69
- package/dist/electron/window.js.map +0 -1
- package/dist/network/local-inbox-bus.js +0 -73
- package/dist/network/p2p-outbox.js +0 -161
- package/dist/network/peer-fs.js +0 -420
- package/dist/network/peer-resource-bridge.js +0 -216
- package/dist/web/components/p2p/P2PModal.js +0 -188
- package/dist/web/components/p2p/p2p-modal.js +0 -664
- package/dist/web/components/p2p/p2p-tools.js +0 -248
- package/dist/web/input-validator.js +0 -103
- package/dist/web/util/safe-name.js +0 -32
|
@@ -11,8 +11,6 @@ import { GateStateMachine } from './gate-state-machine.js';
|
|
|
11
11
|
import { GuardChecker, runGuards } from './guard-checker.js';
|
|
12
12
|
import { ContextRouter } from './context-router.js';
|
|
13
13
|
import { createSkillAdapter } from './skill-adapter.js';
|
|
14
|
-
import * as fs from 'fs';
|
|
15
|
-
import * as path from 'path';
|
|
16
14
|
/**
|
|
17
15
|
* Main integration class
|
|
18
16
|
*/
|
|
@@ -31,76 +29,11 @@ export class BollharnessIntegration {
|
|
|
31
29
|
contextEnabled: config.contextEnabled ?? true,
|
|
32
30
|
skillsEnabled: config.skillsEnabled ?? true,
|
|
33
31
|
gatesEnabled: config.gatesEnabled ?? true,
|
|
34
|
-
persistencePath: config.persistencePath,
|
|
35
32
|
};
|
|
36
33
|
this.gateMachine = new GateStateMachine();
|
|
37
34
|
this.guardChecker = new GuardChecker();
|
|
38
35
|
this.contextRouter = new ContextRouter();
|
|
39
36
|
this.skillAdapter = createSkillAdapter();
|
|
40
|
-
if (this.config.persistencePath) {
|
|
41
|
-
this.loadState();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
saveState() {
|
|
45
|
-
if (!this.config.persistencePath)
|
|
46
|
-
return;
|
|
47
|
-
try {
|
|
48
|
-
const gateState = this.gateMachine.getState();
|
|
49
|
-
const data = JSON.stringify({
|
|
50
|
-
gateState: {
|
|
51
|
-
currentGate: gateState.currentGate,
|
|
52
|
-
entrySatisfied: gateState.entrySatisfied,
|
|
53
|
-
blockers: gateState.blockers,
|
|
54
|
-
requiredArtifact: gateState.requiredArtifact,
|
|
55
|
-
requiredNextSkill: gateState.requiredNextSkill,
|
|
56
|
-
valueInjection: gateState.valueInjection,
|
|
57
|
-
artifacts: Array.from(gateState.artifacts.entries()),
|
|
58
|
-
conversationHistory: gateState.conversationHistory,
|
|
59
|
-
},
|
|
60
|
-
sessionArchives: this.sessionArchives,
|
|
61
|
-
currentSessionId: this.currentSessionId,
|
|
62
|
-
}, null, 2);
|
|
63
|
-
const dir = path.dirname(this.config.persistencePath);
|
|
64
|
-
if (!fs.existsSync(dir)) {
|
|
65
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
66
|
-
}
|
|
67
|
-
fs.writeFileSync(this.config.persistencePath, data, 'utf-8');
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
console.warn(`[BollharnessIntegration] 持久化失败: ${err.message}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
loadState() {
|
|
74
|
-
if (!this.config.persistencePath)
|
|
75
|
-
return;
|
|
76
|
-
try {
|
|
77
|
-
if (!fs.existsSync(this.config.persistencePath))
|
|
78
|
-
return;
|
|
79
|
-
const raw = fs.readFileSync(this.config.persistencePath, 'utf-8');
|
|
80
|
-
const data = JSON.parse(raw);
|
|
81
|
-
if (data.gateState) {
|
|
82
|
-
this.gateMachine.restore({
|
|
83
|
-
currentGate: data.gateState.currentGate,
|
|
84
|
-
entrySatisfied: data.gateState.entrySatisfied,
|
|
85
|
-
blockers: data.gateState.blockers,
|
|
86
|
-
requiredArtifact: data.gateState.requiredArtifact,
|
|
87
|
-
requiredNextSkill: data.gateState.requiredNextSkill,
|
|
88
|
-
requiredReviewSubstrate: undefined,
|
|
89
|
-
valueInjection: data.gateState.valueInjection || '',
|
|
90
|
-
artifacts: new Map(data.gateState.artifacts || []),
|
|
91
|
-
conversationHistory: data.gateState.conversationHistory || [],
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
if (data.sessionArchives) {
|
|
95
|
-
this.sessionArchives = data.sessionArchives;
|
|
96
|
-
}
|
|
97
|
-
if (data.currentSessionId) {
|
|
98
|
-
this.currentSessionId = data.currentSessionId;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch (err) {
|
|
102
|
-
console.warn(`[BollharnessIntegration] 状态恢复失败: ${err.message}`);
|
|
103
|
-
}
|
|
104
37
|
}
|
|
105
38
|
/**
|
|
106
39
|
* Process a file edit with all enabled checks
|
|
@@ -195,14 +128,12 @@ export class BollharnessIntegration {
|
|
|
195
128
|
*/
|
|
196
129
|
submitGateArtifact(name, artifact) {
|
|
197
130
|
this.gateMachine.submitArtifact(name, artifact);
|
|
198
|
-
this.saveState();
|
|
199
131
|
}
|
|
200
132
|
/**
|
|
201
133
|
* Attempt gate transition
|
|
202
134
|
*/
|
|
203
135
|
async transitionGate(reviewResult) {
|
|
204
136
|
const transition = await this.gateMachine.transition(reviewResult);
|
|
205
|
-
this.saveState();
|
|
206
137
|
return {
|
|
207
138
|
success: transition.blockers.length === 0,
|
|
208
139
|
transition,
|
|
@@ -315,7 +246,6 @@ export class BollharnessIntegration {
|
|
|
315
246
|
};
|
|
316
247
|
this.sessionArchives.push(archive);
|
|
317
248
|
this.currentSessionId = id;
|
|
318
|
-
this.saveState();
|
|
319
249
|
return archive;
|
|
320
250
|
}
|
|
321
251
|
/**
|
|
@@ -403,7 +333,6 @@ export class BollharnessIntegration {
|
|
|
403
333
|
*/
|
|
404
334
|
startNewSession() {
|
|
405
335
|
this.currentSessionId = `session_${Date.now()}`;
|
|
406
|
-
this.saveState();
|
|
407
336
|
return this.currentSessionId;
|
|
408
337
|
}
|
|
409
338
|
/**
|
|
@@ -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
|
}
|
|
@@ -88,10 +88,6 @@ function loadAllHarnessSkills() {
|
|
|
88
88
|
* Base skill class for bollharness-compatible skills
|
|
89
89
|
*/
|
|
90
90
|
export class BaseSkill {
|
|
91
|
-
static llm = null;
|
|
92
|
-
static setLlm(instance) {
|
|
93
|
-
BaseSkill.llm = instance;
|
|
94
|
-
}
|
|
95
91
|
log(message, level = 'info') {
|
|
96
92
|
const prefix = level === 'error' ? '❌' : level === 'warn' ? '⚠️' : 'ℹ️';
|
|
97
93
|
console.log(`${prefix} [${this.name}] ${message}`);
|
|
@@ -99,33 +95,6 @@ export class BaseSkill {
|
|
|
99
95
|
formatOutput(output) {
|
|
100
96
|
return JSON.stringify(output, null, 2);
|
|
101
97
|
}
|
|
102
|
-
async callLm(system, user) {
|
|
103
|
-
let llm = BaseSkill.llm;
|
|
104
|
-
if (!llm) {
|
|
105
|
-
try {
|
|
106
|
-
const { getMinimax } = await import('../llm/pi-ai.js');
|
|
107
|
-
const m = getMinimax();
|
|
108
|
-
if (m && typeof m.chat === 'function') {
|
|
109
|
-
BaseSkill.setLlm(m);
|
|
110
|
-
llm = m;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
return this.formatOutput({ warning: 'LLM 未注入', name: this.name });
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (!llm) {
|
|
118
|
-
return this.formatOutput({ warning: 'LLM 未注入', name: this.name });
|
|
119
|
-
}
|
|
120
|
-
try {
|
|
121
|
-
const res = await llm.chat([{ role: 'user', content: user }], system);
|
|
122
|
-
return res.reply || '(空回复)';
|
|
123
|
-
}
|
|
124
|
-
catch (err) {
|
|
125
|
-
this.log(`LLM 调用失败: ${err.message}`, 'error');
|
|
126
|
-
return this.formatOutput({ error: `LLM 调用失败: ${err.message}` });
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
98
|
}
|
|
130
99
|
/**
|
|
131
100
|
* Architecture Skill - Project architect for architecture decisions
|
|
@@ -134,12 +103,58 @@ export class ArchSkill extends BaseSkill {
|
|
|
134
103
|
name = 'arch';
|
|
135
104
|
description = 'Project architect. Responsible for architecture decisions, scheme comparison, and boundary freezing.';
|
|
136
105
|
async execute(params) {
|
|
137
|
-
const task =
|
|
106
|
+
const task = params.task || params.description;
|
|
138
107
|
this.log('Analyzing architecture task');
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
108
|
+
// Extract essence
|
|
109
|
+
const essence = this.extractEssence(task);
|
|
110
|
+
// Find tensions
|
|
111
|
+
const tensions = this.identifyTensions(task);
|
|
112
|
+
// Compare alternatives
|
|
113
|
+
const alternatives = this.compareAlternatives(task);
|
|
114
|
+
// Identify boundaries to freeze
|
|
115
|
+
const boundaries = this.identifyBoundaries(task);
|
|
116
|
+
return this.formatOutput({
|
|
117
|
+
essence,
|
|
118
|
+
tensions,
|
|
119
|
+
alternatives,
|
|
120
|
+
boundaries,
|
|
121
|
+
recommendation: this.makeRecommendation(task, alternatives),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
extractEssence(task) {
|
|
125
|
+
// Simplified essence extraction
|
|
126
|
+
return `The core challenge is: ${task}`;
|
|
127
|
+
}
|
|
128
|
+
identifyTensions(task) {
|
|
129
|
+
return [
|
|
130
|
+
'Simplicity vs Flexibility',
|
|
131
|
+
'Performance vs Maintainability',
|
|
132
|
+
'Coupling vs Cohesion',
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
compareAlternatives(task) {
|
|
136
|
+
return [
|
|
137
|
+
{
|
|
138
|
+
name: 'Option A: Direct Implementation',
|
|
139
|
+
tradeoffs: ['Fast to implement', 'May not scale'],
|
|
140
|
+
recommendation: 'Suitable for MVP',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'Option B: Abstraction Layer',
|
|
144
|
+
tradeoffs: ['More upfront work', 'Better for extension'],
|
|
145
|
+
recommendation: 'Suitable for long-term',
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
identifyBoundaries(task) {
|
|
150
|
+
return [
|
|
151
|
+
'API contract boundaries',
|
|
152
|
+
'Data format boundaries',
|
|
153
|
+
'Capability boundaries',
|
|
154
|
+
];
|
|
155
|
+
}
|
|
156
|
+
makeRecommendation(task, alternatives) {
|
|
157
|
+
return alternatives[1]?.recommendation || 'Consider abstraction layer for long-term maintainability';
|
|
143
158
|
}
|
|
144
159
|
}
|
|
145
160
|
/**
|
|
@@ -206,9 +221,18 @@ export class LeadSkill extends BaseSkill {
|
|
|
206
221
|
gate_pack: this.getGatePack(),
|
|
207
222
|
});
|
|
208
223
|
}
|
|
209
|
-
|
|
224
|
+
classifyChange(params) {
|
|
210
225
|
const description = params.description || '';
|
|
211
|
-
|
|
226
|
+
// Simplified classification
|
|
227
|
+
const isPolicy = description.includes('policy') || description.includes('boundary');
|
|
228
|
+
const isContract = description.includes('API') || description.includes('contract') || description.includes('schema');
|
|
229
|
+
const isImplementation = !isPolicy && !isContract;
|
|
230
|
+
return this.formatOutput({
|
|
231
|
+
classification: isPolicy ? 'policy' : isContract ? 'contract' : 'implementation',
|
|
232
|
+
description,
|
|
233
|
+
minimum_gate_path: isPolicy ? '0→8 (full)' : isContract ? '0→8 (full + consumers)' : '0→7 (fast track eligible)',
|
|
234
|
+
fast_track_eligible: isImplementation,
|
|
235
|
+
});
|
|
212
236
|
}
|
|
213
237
|
}
|
|
214
238
|
/**
|
|
@@ -218,12 +242,44 @@ export class TaskArchSkill extends BaseSkill {
|
|
|
218
242
|
name = 'task-arch';
|
|
219
243
|
description = 'Task decomposition. Breaks down PLAN into parallelizable work packages (WP).';
|
|
220
244
|
async execute(params) {
|
|
221
|
-
const plan =
|
|
245
|
+
const plan = params.plan;
|
|
222
246
|
this.log('Decomposing plan into work packages');
|
|
223
|
-
|
|
224
|
-
|
|
247
|
+
// Extract work packages
|
|
248
|
+
const workPackages = this.extractWorkPackages(plan);
|
|
249
|
+
// Identify seams
|
|
250
|
+
const seams = this.identifySeams(workPackages);
|
|
251
|
+
// Identify integration points
|
|
252
|
+
const integration = this.identifyIntegration(workPackages);
|
|
253
|
+
return this.formatOutput({
|
|
254
|
+
work_packages: workPackages,
|
|
255
|
+
seams,
|
|
256
|
+
integration,
|
|
257
|
+
seam_owners: this.assignSeamOwners(seams),
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
extractWorkPackages(plan) {
|
|
261
|
+
// Simplified WP extraction
|
|
262
|
+
return [
|
|
263
|
+
{ id: 'WP-1', description: 'Core implementation', files: ['src/agents/*.ts'] },
|
|
264
|
+
{ id: 'WP-2', description: 'Network layer', files: ['src/network/*.ts'] },
|
|
265
|
+
{ id: 'WP-3', description: 'Testing', files: ['src/test/*.ts'] },
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
identifySeams(packages) {
|
|
269
|
+
return [
|
|
270
|
+
{ from: 'WP-1', to: 'WP-2', interface: 'P2PNetwork interface' },
|
|
271
|
+
{ from: 'WP-1', to: 'WP-3', interface: 'Test fixtures' },
|
|
272
|
+
];
|
|
273
|
+
}
|
|
274
|
+
identifyIntegration(packages) {
|
|
275
|
+
return ['Integration test at WP-1/WP-2 boundary'];
|
|
276
|
+
}
|
|
277
|
+
assignSeamOwners(seams) {
|
|
278
|
+
const owners = {};
|
|
279
|
+
for (const seam of seams) {
|
|
280
|
+
owners[`${seam.from}/${seam.to}`] = 'integration-owner';
|
|
225
281
|
}
|
|
226
|
-
return
|
|
282
|
+
return owners;
|
|
227
283
|
}
|
|
228
284
|
}
|
|
229
285
|
/**
|
|
@@ -342,12 +398,35 @@ export class CrystalLearnSkill extends BaseSkill {
|
|
|
342
398
|
name = 'crystal-learn';
|
|
343
399
|
description = 'Extracts failure patterns and maintains invariants.';
|
|
344
400
|
async execute(params) {
|
|
345
|
-
const task =
|
|
346
|
-
this.log('Extracting failure patterns
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
401
|
+
const task = params.task;
|
|
402
|
+
this.log('Extracting failure patterns');
|
|
403
|
+
// Identify failure modes
|
|
404
|
+
const failures = this.identifyFailures(task);
|
|
405
|
+
// Extract patterns
|
|
406
|
+
const patterns = this.extractPatterns(failures);
|
|
407
|
+
// Generate invariants
|
|
408
|
+
const invariants = this.generateInvariants(patterns);
|
|
409
|
+
return this.formatOutput({
|
|
410
|
+
failure_modes: failures,
|
|
411
|
+
patterns,
|
|
412
|
+
invariants,
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
identifyFailures(task) {
|
|
416
|
+
return [
|
|
417
|
+
'Truth source split',
|
|
418
|
+
'Verification decay',
|
|
419
|
+
'Orphaned seams',
|
|
420
|
+
];
|
|
421
|
+
}
|
|
422
|
+
extractPatterns(failures) {
|
|
423
|
+
return failures.map(f => ({
|
|
424
|
+
pattern: f,
|
|
425
|
+
prevention: `Implement guard to prevent ${f}`,
|
|
426
|
+
}));
|
|
427
|
+
}
|
|
428
|
+
generateInvariants(patterns) {
|
|
429
|
+
return patterns.map(p => `INV: ${p.pattern} must not occur`);
|
|
351
430
|
}
|
|
352
431
|
}
|
|
353
432
|
/**
|
|
@@ -403,10 +482,6 @@ export class SkillAdapter {
|
|
|
403
482
|
getSkill(name) {
|
|
404
483
|
return this.registry.get(name);
|
|
405
484
|
}
|
|
406
|
-
injectLlm(llm) {
|
|
407
|
-
BaseSkill.setLlm(llm);
|
|
408
|
-
this.log('LLM 已注入到所有 BaseSkill');
|
|
409
|
-
}
|
|
410
485
|
listSkills() {
|
|
411
486
|
return this.registry.list();
|
|
412
487
|
}
|
|
@@ -136,13 +136,10 @@ async function collectJudgmentsSummary(topN) {
|
|
|
136
136
|
topValues,
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
async function collectSkills(
|
|
139
|
+
async function collectSkills() {
|
|
140
140
|
const home = process.env.HOME || os.homedir() || '/tmp';
|
|
141
141
|
const userSkillsDir = path.join(home, '.bolloon', 'skills');
|
|
142
|
-
|
|
143
|
-
// 在测试或子进程里能正确隔离项目级 skill 目录 (之前 process.cwd() 会读到
|
|
144
|
-
// caller 的 cwd, 测试空目录时泄漏真实项目 skills).
|
|
145
|
-
const projectSkillsDir = path.join(projectCwd || process.cwd(), '.bolloon', 'skills');
|
|
142
|
+
const projectSkillsDir = path.join(process.cwd(), '.bolloon', 'skills');
|
|
146
143
|
const out = [];
|
|
147
144
|
const seen = new Set();
|
|
148
145
|
for (const dir of [userSkillsDir, projectSkillsDir]) {
|
|
@@ -276,7 +273,7 @@ export async function collectBolloonContext(opts) {
|
|
|
276
273
|
collectProject(cwd, bolloonMdMaxBytes),
|
|
277
274
|
collectGit(cwd, gitCommitLimit),
|
|
278
275
|
collectPersona(),
|
|
279
|
-
collectSkills(
|
|
276
|
+
collectSkills(),
|
|
280
277
|
Promise.resolve(collectEnv()),
|
|
281
278
|
collectPending(opts),
|
|
282
279
|
collectHierarchy(cwd),
|