@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
|
@@ -224,319 +224,319 @@ export class ContextRouter {
|
|
|
224
224
|
* These can be stored in context-fragments/ directory
|
|
225
225
|
*/
|
|
226
226
|
export const CONTEXT_FRAGMENTS = {
|
|
227
|
-
'general-dev-principles': `# General Development Principles
|
|
228
|
-
|
|
229
|
-
## Core Values
|
|
230
|
-
- **Code over Convention**: Write code that works correctly, not just conventionally
|
|
231
|
-
- **Explicit over Implicit**: Make dependencies and side effects visible
|
|
232
|
-
- **Composition over Inheritance**: Prefer composing behavior to inheriting it
|
|
233
|
-
- **Fail Fast**: Detect errors early and fail loudly
|
|
234
|
-
|
|
235
|
-
## Code Quality
|
|
236
|
-
- Write self-documenting code with clear intent
|
|
237
|
-
- Keep functions small and focused (single responsibility)
|
|
238
|
-
- Avoid premature optimization
|
|
239
|
-
- Test at boundaries
|
|
240
|
-
|
|
241
|
-
## Collaboration
|
|
242
|
-
- Commit early and often
|
|
243
|
-
- Write meaningful commit messages
|
|
244
|
-
- Review code for clarity, not just correctness
|
|
227
|
+
'general-dev-principles': `# General Development Principles
|
|
228
|
+
|
|
229
|
+
## Core Values
|
|
230
|
+
- **Code over Convention**: Write code that works correctly, not just conventionally
|
|
231
|
+
- **Explicit over Implicit**: Make dependencies and side effects visible
|
|
232
|
+
- **Composition over Inheritance**: Prefer composing behavior to inheriting it
|
|
233
|
+
- **Fail Fast**: Detect errors early and fail loudly
|
|
234
|
+
|
|
235
|
+
## Code Quality
|
|
236
|
+
- Write self-documenting code with clear intent
|
|
237
|
+
- Keep functions small and focused (single responsibility)
|
|
238
|
+
- Avoid premature optimization
|
|
239
|
+
- Test at boundaries
|
|
240
|
+
|
|
241
|
+
## Collaboration
|
|
242
|
+
- Commit early and often
|
|
243
|
+
- Write meaningful commit messages
|
|
244
|
+
- Review code for clarity, not just correctness
|
|
245
245
|
- Leave code better than you found it`,
|
|
246
|
-
'code-quality': `# Code Quality Guidelines
|
|
247
|
-
|
|
248
|
-
## Readability
|
|
249
|
-
- Use meaningful variable and function names
|
|
250
|
-
- Add comments that explain *why*, not *what*
|
|
251
|
-
- Keep lines under 100 characters
|
|
252
|
-
- Use consistent formatting
|
|
253
|
-
|
|
254
|
-
## Maintainability
|
|
255
|
-
- DRY (Don't Repeat Yourself)
|
|
256
|
-
- SOLID principles
|
|
257
|
-
- Keep modules loosely coupled
|
|
258
|
-
- Make side effects explicit
|
|
259
|
-
|
|
260
|
-
## Testing
|
|
261
|
-
- Test behavior, not implementation
|
|
262
|
-
- Cover edge cases
|
|
263
|
-
- Write tests before debugging
|
|
246
|
+
'code-quality': `# Code Quality Guidelines
|
|
247
|
+
|
|
248
|
+
## Readability
|
|
249
|
+
- Use meaningful variable and function names
|
|
250
|
+
- Add comments that explain *why*, not *what*
|
|
251
|
+
- Keep lines under 100 characters
|
|
252
|
+
- Use consistent formatting
|
|
253
|
+
|
|
254
|
+
## Maintainability
|
|
255
|
+
- DRY (Don't Repeat Yourself)
|
|
256
|
+
- SOLID principles
|
|
257
|
+
- Keep modules loosely coupled
|
|
258
|
+
- Make side effects explicit
|
|
259
|
+
|
|
260
|
+
## Testing
|
|
261
|
+
- Test behavior, not implementation
|
|
262
|
+
- Cover edge cases
|
|
263
|
+
- Write tests before debugging
|
|
264
264
|
- Aim for meaningful assertions`,
|
|
265
|
-
'agent-architecture': `# Agent Architecture Patterns
|
|
266
|
-
|
|
267
|
-
## Multi-Agent Design
|
|
268
|
-
- Define clear agent responsibilities
|
|
269
|
-
- Use message passing for inter-agent communication
|
|
270
|
-
- Maintain agent isolation
|
|
271
|
-
- Implement graceful degradation
|
|
272
|
-
|
|
273
|
-
## Skill System
|
|
274
|
-
- Skills should be composable
|
|
275
|
-
- Each skill has single responsibility
|
|
276
|
-
- Skills communicate via structured interfaces
|
|
265
|
+
'agent-architecture': `# Agent Architecture Patterns
|
|
266
|
+
|
|
267
|
+
## Multi-Agent Design
|
|
268
|
+
- Define clear agent responsibilities
|
|
269
|
+
- Use message passing for inter-agent communication
|
|
270
|
+
- Maintain agent isolation
|
|
271
|
+
- Implement graceful degradation
|
|
272
|
+
|
|
273
|
+
## Skill System
|
|
274
|
+
- Skills should be composable
|
|
275
|
+
- Each skill has single responsibility
|
|
276
|
+
- Skills communicate via structured interfaces
|
|
277
277
|
- Version skills for compatibility`,
|
|
278
|
-
'multi-agent-patterns': `# Multi-Agent Collaboration Patterns
|
|
279
|
-
|
|
280
|
-
## Task Delegation
|
|
281
|
-
- Match tasks to agent capabilities
|
|
282
|
-
- Track task state across agents
|
|
283
|
-
- Handle partial failures gracefully
|
|
284
|
-
- Aggregate results appropriately
|
|
285
|
-
|
|
286
|
-
## Communication
|
|
287
|
-
- Use structured message formats
|
|
288
|
-
- Implement acknowledgment protocols
|
|
289
|
-
- Handle timeouts and retries
|
|
278
|
+
'multi-agent-patterns': `# Multi-Agent Collaboration Patterns
|
|
279
|
+
|
|
280
|
+
## Task Delegation
|
|
281
|
+
- Match tasks to agent capabilities
|
|
282
|
+
- Track task state across agents
|
|
283
|
+
- Handle partial failures gracefully
|
|
284
|
+
- Aggregate results appropriately
|
|
285
|
+
|
|
286
|
+
## Communication
|
|
287
|
+
- Use structured message formats
|
|
288
|
+
- Implement acknowledgment protocols
|
|
289
|
+
- Handle timeouts and retries
|
|
290
290
|
- Log for debugging`,
|
|
291
|
-
'documentation-standards': `# Documentation Standards
|
|
292
|
-
|
|
293
|
-
## When to Document
|
|
294
|
-
- Document *why*, not *what*
|
|
295
|
-
- Keep docs close to code
|
|
296
|
-
- Update docs with code changes
|
|
297
|
-
- Delete outdated documentation
|
|
298
|
-
|
|
299
|
-
## Types of Documentation
|
|
300
|
-
- README: Project overview and setup
|
|
301
|
-
- API docs: Usage examples
|
|
302
|
-
- Architecture docs: Design decisions
|
|
291
|
+
'documentation-standards': `# Documentation Standards
|
|
292
|
+
|
|
293
|
+
## When to Document
|
|
294
|
+
- Document *why*, not *what*
|
|
295
|
+
- Keep docs close to code
|
|
296
|
+
- Update docs with code changes
|
|
297
|
+
- Delete outdated documentation
|
|
298
|
+
|
|
299
|
+
## Types of Documentation
|
|
300
|
+
- README: Project overview and setup
|
|
301
|
+
- API docs: Usage examples
|
|
302
|
+
- Architecture docs: Design decisions
|
|
303
303
|
- Inline comments: Complex logic explanation`,
|
|
304
|
-
'decision-tracking': `# Decision Tracking with ADRs
|
|
305
|
-
|
|
306
|
-
## ADR Format
|
|
307
|
-
- Title and status
|
|
308
|
-
- Context and problem statement
|
|
309
|
-
- Decision and rationale
|
|
310
|
-
- Consequences (positive and negative)
|
|
311
|
-
|
|
312
|
-
## When to Create ADR
|
|
313
|
-
- Architectural changes
|
|
314
|
-
- Technology choices
|
|
315
|
-
- Process changes
|
|
304
|
+
'decision-tracking': `# Decision Tracking with ADRs
|
|
305
|
+
|
|
306
|
+
## ADR Format
|
|
307
|
+
- Title and status
|
|
308
|
+
- Context and problem statement
|
|
309
|
+
- Decision and rationale
|
|
310
|
+
- Consequences (positive and negative)
|
|
311
|
+
|
|
312
|
+
## When to Create ADR
|
|
313
|
+
- Architectural changes
|
|
314
|
+
- Technology choices
|
|
315
|
+
- Process changes
|
|
316
316
|
- Cross-cutting concerns`,
|
|
317
|
-
'adr-patterns': `# Architecture Decision Records
|
|
318
|
-
|
|
319
|
-
## Structure
|
|
320
|
-
1. **Title**: Brief descriptive title
|
|
321
|
-
2. **Status**: Proposed, Accepted, Deprecated
|
|
322
|
-
3. **Context**: Background and constraints
|
|
323
|
-
4. **Decision**: What we decided
|
|
324
|
-
5. **Consequences**: What changed
|
|
325
|
-
|
|
326
|
-
## Review Process
|
|
327
|
-
- Propose with clear rationale
|
|
328
|
-
- Solicit feedback from stakeholders
|
|
329
|
-
- Document dissenting opinions
|
|
317
|
+
'adr-patterns': `# Architecture Decision Records
|
|
318
|
+
|
|
319
|
+
## Structure
|
|
320
|
+
1. **Title**: Brief descriptive title
|
|
321
|
+
2. **Status**: Proposed, Accepted, Deprecated
|
|
322
|
+
3. **Context**: Background and constraints
|
|
323
|
+
4. **Decision**: What we decided
|
|
324
|
+
5. **Consequences**: What changed
|
|
325
|
+
|
|
326
|
+
## Review Process
|
|
327
|
+
- Propose with clear rationale
|
|
328
|
+
- Solicit feedback from stakeholders
|
|
329
|
+
- Document dissenting opinions
|
|
330
330
|
- Update status as decisions evolve`,
|
|
331
|
-
'project-governance': `# Project Governance
|
|
332
|
-
|
|
333
|
-
## Truth Sources
|
|
334
|
-
- Bolloon.md: Project overview and norms
|
|
335
|
-
- docs/: Architecture and decisions
|
|
336
|
-
- code/: Implementation
|
|
337
|
-
- issues/: Tracking and discussions
|
|
338
|
-
|
|
339
|
-
## Decision Making
|
|
340
|
-
- Small changes: Direct implementation
|
|
341
|
-
- Medium changes: Discuss first
|
|
331
|
+
'project-governance': `# Project Governance
|
|
332
|
+
|
|
333
|
+
## Truth Sources
|
|
334
|
+
- Bolloon.md: Project overview and norms
|
|
335
|
+
- docs/: Architecture and decisions
|
|
336
|
+
- code/: Implementation
|
|
337
|
+
- issues/: Tracking and discussions
|
|
338
|
+
|
|
339
|
+
## Decision Making
|
|
340
|
+
- Small changes: Direct implementation
|
|
341
|
+
- Medium changes: Discuss first
|
|
342
342
|
- Large changes: ADR required`,
|
|
343
|
-
'truth-source-hierarchy': `# Truth Source Hierarchy
|
|
344
|
-
|
|
345
|
-
## Priority Order
|
|
346
|
-
1. **Code**: Ground truth for behavior
|
|
347
|
-
2. **Tests**: Verification of behavior
|
|
348
|
-
3. **Docs**: Explanation of behavior
|
|
349
|
-
4. **Comments**: Intent and caveats
|
|
350
|
-
5. **Commits**: History and rationale
|
|
351
|
-
|
|
352
|
-
## Conflict Resolution
|
|
353
|
-
- Code vs docs: Code wins
|
|
354
|
-
- Comments vs code: Code wins
|
|
355
|
-
- Multiple docs: Newest wins
|
|
343
|
+
'truth-source-hierarchy': `# Truth Source Hierarchy
|
|
344
|
+
|
|
345
|
+
## Priority Order
|
|
346
|
+
1. **Code**: Ground truth for behavior
|
|
347
|
+
2. **Tests**: Verification of behavior
|
|
348
|
+
3. **Docs**: Explanation of behavior
|
|
349
|
+
4. **Comments**: Intent and caveats
|
|
350
|
+
5. **Commits**: History and rationale
|
|
351
|
+
|
|
352
|
+
## Conflict Resolution
|
|
353
|
+
- Code vs docs: Code wins
|
|
354
|
+
- Comments vs code: Code wins
|
|
355
|
+
- Multiple docs: Newest wins
|
|
356
356
|
- Stale info: Delete or update`,
|
|
357
|
-
'testing-patterns': `# Testing Patterns
|
|
358
|
-
|
|
359
|
-
## Test Structure
|
|
360
|
-
- Arrange: Set up test data
|
|
361
|
-
- Act: Execute the behavior
|
|
362
|
-
- Assert: Verify the outcomes
|
|
363
|
-
|
|
364
|
-
## Test Types
|
|
365
|
-
- Unit tests: Single function/class
|
|
366
|
-
- Integration tests: Component interaction
|
|
367
|
-
- E2E tests: Full system flow
|
|
368
|
-
|
|
369
|
-
## Best Practices
|
|
370
|
-
- Test one thing per test
|
|
371
|
-
- Use descriptive test names
|
|
372
|
-
- Keep tests independent
|
|
357
|
+
'testing-patterns': `# Testing Patterns
|
|
358
|
+
|
|
359
|
+
## Test Structure
|
|
360
|
+
- Arrange: Set up test data
|
|
361
|
+
- Act: Execute the behavior
|
|
362
|
+
- Assert: Verify the outcomes
|
|
363
|
+
|
|
364
|
+
## Test Types
|
|
365
|
+
- Unit tests: Single function/class
|
|
366
|
+
- Integration tests: Component interaction
|
|
367
|
+
- E2E tests: Full system flow
|
|
368
|
+
|
|
369
|
+
## Best Practices
|
|
370
|
+
- Test one thing per test
|
|
371
|
+
- Use descriptive test names
|
|
372
|
+
- Keep tests independent
|
|
373
373
|
- Mock external dependencies`,
|
|
374
|
-
'quality-standards': `# Quality Standards
|
|
375
|
-
|
|
376
|
-
## Code Review Checklist
|
|
377
|
-
- [ ] Does it work correctly?
|
|
378
|
-
- [ ] Is it readable?
|
|
379
|
-
- [ ] Are there tests?
|
|
380
|
-
- [ ] Is it documented?
|
|
381
|
-
- [ ] Are there security concerns?
|
|
382
|
-
- [ ] Performance implications?
|
|
383
|
-
|
|
384
|
-
## Definition of Done
|
|
385
|
-
- Code complete
|
|
386
|
-
- Tests passing
|
|
387
|
-
- Documentation updated
|
|
374
|
+
'quality-standards': `# Quality Standards
|
|
375
|
+
|
|
376
|
+
## Code Review Checklist
|
|
377
|
+
- [ ] Does it work correctly?
|
|
378
|
+
- [ ] Is it readable?
|
|
379
|
+
- [ ] Are there tests?
|
|
380
|
+
- [ ] Is it documented?
|
|
381
|
+
- [ ] Are there security concerns?
|
|
382
|
+
- [ ] Performance implications?
|
|
383
|
+
|
|
384
|
+
## Definition of Done
|
|
385
|
+
- Code complete
|
|
386
|
+
- Tests passing
|
|
387
|
+
- Documentation updated
|
|
388
388
|
- No known issues`,
|
|
389
|
-
'workflow-patterns': `# Workflow Patterns
|
|
390
|
-
|
|
391
|
-
## Pipeline Design
|
|
392
|
-
- Input validation
|
|
393
|
-
- Transformation steps
|
|
394
|
-
- Output generation
|
|
395
|
-
- Error handling
|
|
396
|
-
|
|
397
|
-
## State Management
|
|
398
|
-
- Track workflow progress
|
|
399
|
-
- Handle partial completion
|
|
400
|
-
- Support retry logic
|
|
389
|
+
'workflow-patterns': `# Workflow Patterns
|
|
390
|
+
|
|
391
|
+
## Pipeline Design
|
|
392
|
+
- Input validation
|
|
393
|
+
- Transformation steps
|
|
394
|
+
- Output generation
|
|
395
|
+
- Error handling
|
|
396
|
+
|
|
397
|
+
## State Management
|
|
398
|
+
- Track workflow progress
|
|
399
|
+
- Handle partial completion
|
|
400
|
+
- Support retry logic
|
|
401
401
|
- Log state changes`,
|
|
402
|
-
'orchestration-patterns': `# Orchestration Patterns
|
|
403
|
-
|
|
404
|
-
## Task Coordination
|
|
405
|
-
- Define task dependencies
|
|
406
|
-
- Execute in correct order
|
|
407
|
-
- Handle parallel execution
|
|
408
|
-
- Aggregate results
|
|
409
|
-
|
|
410
|
-
## Error Recovery
|
|
411
|
-
- Identify failure points
|
|
412
|
-
- Implement retry strategies
|
|
413
|
-
- Rollback when needed
|
|
402
|
+
'orchestration-patterns': `# Orchestration Patterns
|
|
403
|
+
|
|
404
|
+
## Task Coordination
|
|
405
|
+
- Define task dependencies
|
|
406
|
+
- Execute in correct order
|
|
407
|
+
- Handle parallel execution
|
|
408
|
+
- Aggregate results
|
|
409
|
+
|
|
410
|
+
## Error Recovery
|
|
411
|
+
- Identify failure points
|
|
412
|
+
- Implement retry strategies
|
|
413
|
+
- Rollback when needed
|
|
414
414
|
- Notify stakeholders`,
|
|
415
|
-
'document-processing': `# Document Processing
|
|
416
|
-
|
|
417
|
-
## Supported Formats
|
|
418
|
-
- Markdown: Primary format
|
|
419
|
-
- PDF: Via external parser
|
|
420
|
-
- DOCX: Via external parser
|
|
421
|
-
- Plain text: Direct reading
|
|
422
|
-
|
|
423
|
-
## Processing Pipeline
|
|
424
|
-
- Load document
|
|
425
|
-
- Extract text
|
|
426
|
-
- Chunk content
|
|
427
|
-
- Process chunks
|
|
415
|
+
'document-processing': `# Document Processing
|
|
416
|
+
|
|
417
|
+
## Supported Formats
|
|
418
|
+
- Markdown: Primary format
|
|
419
|
+
- PDF: Via external parser
|
|
420
|
+
- DOCX: Via external parser
|
|
421
|
+
- Plain text: Direct reading
|
|
422
|
+
|
|
423
|
+
## Processing Pipeline
|
|
424
|
+
- Load document
|
|
425
|
+
- Extract text
|
|
426
|
+
- Chunk content
|
|
427
|
+
- Process chunks
|
|
428
428
|
- Aggregate results`,
|
|
429
|
-
'parser-patterns': `# Parser Patterns
|
|
430
|
-
|
|
431
|
-
## Design Principles
|
|
432
|
-
- Single responsibility per parser
|
|
433
|
-
- Consistent error handling
|
|
434
|
-
- Graceful degradation
|
|
435
|
-
- Clear error messages
|
|
436
|
-
|
|
437
|
-
## Content Extraction
|
|
438
|
-
- Strip formatting
|
|
439
|
-
- Preserve structure
|
|
440
|
-
- Handle encoding
|
|
429
|
+
'parser-patterns': `# Parser Patterns
|
|
430
|
+
|
|
431
|
+
## Design Principles
|
|
432
|
+
- Single responsibility per parser
|
|
433
|
+
- Consistent error handling
|
|
434
|
+
- Graceful degradation
|
|
435
|
+
- Clear error messages
|
|
436
|
+
|
|
437
|
+
## Content Extraction
|
|
438
|
+
- Strip formatting
|
|
439
|
+
- Preserve structure
|
|
440
|
+
- Handle encoding
|
|
441
441
|
- Validate content`,
|
|
442
|
-
'p2p-protocols': `# P2P Protocols
|
|
443
|
-
|
|
444
|
-
## Connection Management
|
|
445
|
-
- Bootstrap connections
|
|
446
|
-
- Maintain peer list
|
|
447
|
-
- Handle disconnections
|
|
448
|
-
- Reconnect gracefully
|
|
449
|
-
|
|
450
|
-
## Message Routing
|
|
451
|
-
- Direct messages
|
|
452
|
-
- Broadcast messages
|
|
453
|
-
- Topic subscriptions
|
|
442
|
+
'p2p-protocols': `# P2P Protocols
|
|
443
|
+
|
|
444
|
+
## Connection Management
|
|
445
|
+
- Bootstrap connections
|
|
446
|
+
- Maintain peer list
|
|
447
|
+
- Handle disconnections
|
|
448
|
+
- Reconnect gracefully
|
|
449
|
+
|
|
450
|
+
## Message Routing
|
|
451
|
+
- Direct messages
|
|
452
|
+
- Broadcast messages
|
|
453
|
+
- Topic subscriptions
|
|
454
454
|
- Message queuing`,
|
|
455
|
-
'connection-patterns': `# Connection Patterns
|
|
456
|
-
|
|
457
|
-
## Lifecycle
|
|
458
|
-
- Connect
|
|
459
|
-
- Authenticate
|
|
460
|
-
- Exchange
|
|
461
|
-
- Disconnect
|
|
462
|
-
|
|
463
|
-
## Reliability
|
|
464
|
-
- Heartbeat monitoring
|
|
465
|
-
- Timeout handling
|
|
466
|
-
- Retry mechanisms
|
|
455
|
+
'connection-patterns': `# Connection Patterns
|
|
456
|
+
|
|
457
|
+
## Lifecycle
|
|
458
|
+
- Connect
|
|
459
|
+
- Authenticate
|
|
460
|
+
- Exchange
|
|
461
|
+
- Disconnect
|
|
462
|
+
|
|
463
|
+
## Reliability
|
|
464
|
+
- Heartbeat monitoring
|
|
465
|
+
- Timeout handling
|
|
466
|
+
- Retry mechanisms
|
|
467
467
|
- Graceful degradation`,
|
|
468
|
-
'constraint-design': `# Constraint Design
|
|
469
|
-
|
|
470
|
-
## Principles
|
|
471
|
-
- Constraints should be explicit
|
|
472
|
-
- Fail with clear messages
|
|
473
|
-
- Allow override when needed
|
|
474
|
-
- Document rationale
|
|
475
|
-
|
|
476
|
-
## Implementation
|
|
477
|
-
- Pre-conditions
|
|
478
|
-
- Post-conditions
|
|
479
|
-
- Invariants
|
|
468
|
+
'constraint-design': `# Constraint Design
|
|
469
|
+
|
|
470
|
+
## Principles
|
|
471
|
+
- Constraints should be explicit
|
|
472
|
+
- Fail with clear messages
|
|
473
|
+
- Allow override when needed
|
|
474
|
+
- Document rationale
|
|
475
|
+
|
|
476
|
+
## Implementation
|
|
477
|
+
- Pre-conditions
|
|
478
|
+
- Post-conditions
|
|
479
|
+
- Invariants
|
|
480
480
|
- Error handling`,
|
|
481
|
-
'validation-patterns': `# Validation Patterns
|
|
482
|
-
|
|
483
|
-
## Input Validation
|
|
484
|
-
- Type checking
|
|
485
|
-
- Range validation
|
|
486
|
-
- Format validation
|
|
487
|
-
- Business rule validation
|
|
488
|
-
|
|
489
|
-
## Error Reporting
|
|
490
|
-
- Clear error messages
|
|
491
|
-
- Field-level errors
|
|
492
|
-
- Actionable suggestions
|
|
481
|
+
'validation-patterns': `# Validation Patterns
|
|
482
|
+
|
|
483
|
+
## Input Validation
|
|
484
|
+
- Type checking
|
|
485
|
+
- Range validation
|
|
486
|
+
- Format validation
|
|
487
|
+
- Business rule validation
|
|
488
|
+
|
|
489
|
+
## Error Reporting
|
|
490
|
+
- Clear error messages
|
|
491
|
+
- Field-level errors
|
|
492
|
+
- Actionable suggestions
|
|
493
493
|
- Error codes`,
|
|
494
|
-
'social-protocols': `# Social Protocols
|
|
495
|
-
|
|
496
|
-
## Agent Discovery
|
|
497
|
-
- Broadcast presence
|
|
498
|
-
- Maintain registry
|
|
499
|
-
- Handle joins/leaves
|
|
500
|
-
- Cache agent info
|
|
501
|
-
|
|
502
|
-
## Collaboration
|
|
503
|
-
- Task distribution
|
|
504
|
-
- Result aggregation
|
|
505
|
-
- Conflict resolution
|
|
494
|
+
'social-protocols': `# Social Protocols
|
|
495
|
+
|
|
496
|
+
## Agent Discovery
|
|
497
|
+
- Broadcast presence
|
|
498
|
+
- Maintain registry
|
|
499
|
+
- Handle joins/leaves
|
|
500
|
+
- Cache agent info
|
|
501
|
+
|
|
502
|
+
## Collaboration
|
|
503
|
+
- Task distribution
|
|
504
|
+
- Result aggregation
|
|
505
|
+
- Conflict resolution
|
|
506
506
|
- Consensus building`,
|
|
507
|
-
'agent-discovery': `# Agent Discovery
|
|
508
|
-
|
|
509
|
-
## Registration
|
|
510
|
-
- Announce capabilities
|
|
511
|
-
- Update status
|
|
512
|
-
- Heartbeat mechanism
|
|
513
|
-
- Graceful cleanup
|
|
514
|
-
|
|
515
|
-
## Lookup
|
|
516
|
-
- Search by capability
|
|
517
|
-
- Filter by status
|
|
518
|
-
- Sort by relevance
|
|
507
|
+
'agent-discovery': `# Agent Discovery
|
|
508
|
+
|
|
509
|
+
## Registration
|
|
510
|
+
- Announce capabilities
|
|
511
|
+
- Update status
|
|
512
|
+
- Heartbeat mechanism
|
|
513
|
+
- Graceful cleanup
|
|
514
|
+
|
|
515
|
+
## Lookup
|
|
516
|
+
- Search by capability
|
|
517
|
+
- Filter by status
|
|
518
|
+
- Sort by relevance
|
|
519
519
|
- Cache results`,
|
|
520
|
-
'project-intro': `# Project Introduction
|
|
521
|
-
|
|
522
|
-
## Overview
|
|
523
|
-
Bolloon is a P2P AI document processing system with multi-agent collaboration.
|
|
524
|
-
|
|
525
|
-
## Key Features
|
|
526
|
-
- Document processing pipeline
|
|
527
|
-
- P2P network communication
|
|
528
|
-
- Multi-agent task coordination
|
|
520
|
+
'project-intro': `# Project Introduction
|
|
521
|
+
|
|
522
|
+
## Overview
|
|
523
|
+
Bolloon is a P2P AI document processing system with multi-agent collaboration.
|
|
524
|
+
|
|
525
|
+
## Key Features
|
|
526
|
+
- Document processing pipeline
|
|
527
|
+
- P2P network communication
|
|
528
|
+
- Multi-agent task coordination
|
|
529
529
|
- Constraint-based guardrails`,
|
|
530
|
-
'getting-started': `# Getting Started
|
|
531
|
-
|
|
532
|
-
## Setup
|
|
533
|
-
1. Install dependencies
|
|
534
|
-
2. Configure environment
|
|
535
|
-
3. Initialize P2P identity
|
|
536
|
-
4. Start processing
|
|
537
|
-
|
|
538
|
-
## Basic Usage
|
|
539
|
-
- Process documents
|
|
540
|
-
- Coordinate with peers
|
|
530
|
+
'getting-started': `# Getting Started
|
|
531
|
+
|
|
532
|
+
## Setup
|
|
533
|
+
1. Install dependencies
|
|
534
|
+
2. Configure environment
|
|
535
|
+
3. Initialize P2P identity
|
|
536
|
+
4. Start processing
|
|
537
|
+
|
|
538
|
+
## Basic Usage
|
|
539
|
+
- Process documents
|
|
540
|
+
- Coordinate with peers
|
|
541
541
|
- Monitor performance`,
|
|
542
542
|
};
|
|
@@ -106,19 +106,6 @@ export class GateStateMachine {
|
|
|
106
106
|
getState() {
|
|
107
107
|
return { ...this.state, artifacts: new Map(this.state.artifacts), conversationHistory: [...this.state.conversationHistory] };
|
|
108
108
|
}
|
|
109
|
-
restore(state) {
|
|
110
|
-
this.state = {
|
|
111
|
-
currentGate: state.currentGate,
|
|
112
|
-
entrySatisfied: state.entrySatisfied,
|
|
113
|
-
blockers: [...state.blockers],
|
|
114
|
-
requiredArtifact: state.requiredArtifact,
|
|
115
|
-
requiredNextSkill: state.requiredNextSkill,
|
|
116
|
-
requiredReviewSubstrate: state.requiredReviewSubstrate,
|
|
117
|
-
valueInjection: state.valueInjection,
|
|
118
|
-
artifacts: new Map(state.artifacts),
|
|
119
|
-
conversationHistory: [...state.conversationHistory],
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
109
|
getCurrentGate() {
|
|
123
110
|
return this.state.currentGate;
|
|
124
111
|
}
|
|
@@ -309,19 +296,19 @@ export class GateStateMachine {
|
|
|
309
296
|
*/
|
|
310
297
|
async expandSituationWithUserInput(baseSituation, userInput) {
|
|
311
298
|
const model = getModel();
|
|
312
|
-
const prompt = `基于以下 Gate 情境模板和用户当前输入,生成一个更具体的情境描述。
|
|
313
|
-
|
|
314
|
-
Gate 情境模板:${baseSituation}
|
|
315
|
-
|
|
316
|
-
用户当前输入/artifact 内容:
|
|
317
|
-
${userInput.substring(0, 1000)}
|
|
318
|
-
|
|
319
|
-
要求:
|
|
320
|
-
1. 结合用户输入,把情境描述具体化
|
|
321
|
-
2. 保留原始 Gate 情境的重点(用词可以调整)
|
|
322
|
-
3. 提取用户输入中与该 Gate 决策相关的关键信息
|
|
323
|
-
4. 输出一个 50-150 字的自然语言情境描述
|
|
324
|
-
|
|
299
|
+
const prompt = `基于以下 Gate 情境模板和用户当前输入,生成一个更具体的情境描述。
|
|
300
|
+
|
|
301
|
+
Gate 情境模板:${baseSituation}
|
|
302
|
+
|
|
303
|
+
用户当前输入/artifact 内容:
|
|
304
|
+
${userInput.substring(0, 1000)}
|
|
305
|
+
|
|
306
|
+
要求:
|
|
307
|
+
1. 结合用户输入,把情境描述具体化
|
|
308
|
+
2. 保留原始 Gate 情境的重点(用词可以调整)
|
|
309
|
+
3. 提取用户输入中与该 Gate 决策相关的关键信息
|
|
310
|
+
4. 输出一个 50-150 字的自然语言情境描述
|
|
311
|
+
|
|
325
312
|
直接输出情境描述,不要解释。`;
|
|
326
313
|
const result = await model.chat(prompt, '');
|
|
327
314
|
return result.reply.trim();
|