@bolloon/bolloon-agent 0.1.36 → 0.1.38
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/package.json +2 -2
- package/.auto-evolve-calls +0 -1
- package/.last-auto-evolve-baseline +0 -1
- package/.playwright-mcp/page-2026-06-16T07-51-45-706Z.yml +0 -130
- package/.playwright-mcp/page-2026-06-16T07-56-44-116Z.yml +0 -131
- package/Bolloon.md +0 -144
- package/Dive-into/CITATION.cff +0 -17
- package/Dive-into/LICENSE +0 -25
- package/Dive-into/README.md +0 -598
- package/Dive-into/README_zh.md +0 -599
- package/Dive-into/assets/context.png +0 -0
- package/Dive-into/assets/extensibility.png +0 -0
- package/Dive-into/assets/iteration.png +0 -0
- package/Dive-into/assets/layered_architecture.png +0 -0
- package/Dive-into/assets/main_structure.png +0 -0
- package/Dive-into/assets/permission.png +0 -0
- package/Dive-into/assets/session_compact.png +0 -0
- package/Dive-into/assets/subagent.png +0 -0
- package/Dive-into/paper/Dive_into_Claude_Code.pdf +0 -0
- package/dist/agents/constraint-layer.js.map +0 -1
- package/dist/agents/pi-sdk.js.map +0 -1
- package/dist/agents/workflow-engine.js.map +0 -1
- package/dist/bollharness/src/index.js +0 -5
- package/dist/bollharness/src/scripts/checks/check_adr_plan_numbering.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_api_types.js +0 -45
- package/dist/bollharness/src/scripts/checks/check_artifact_link.js +0 -146
- package/dist/bollharness/src/scripts/checks/check_bridge_deps.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_bugfix_binding.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_bugfix_binding_ci.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_doc_file_references.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_doc_freshness.js +0 -135
- package/dist/bollharness/src/scripts/checks/check_doc_links.js +0 -31
- package/dist/bollharness/src/scripts/checks/check_file_existence_claims.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_fragment_integrity.js +0 -34
- package/dist/bollharness/src/scripts/checks/check_hook_installed.js +0 -63
- package/dist/bollharness/src/scripts/checks/check_issue_closure.js +0 -41
- package/dist/bollharness/src/scripts/checks/check_mcp_parity.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_security.js +0 -48
- package/dist/bollharness/src/scripts/checks/check_skill_parity.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_versions.js +0 -6
- package/dist/bollharness/src/scripts/checks/finding.js +0 -13
- package/dist/bollharness/src/scripts/checks/next_decision_number.js +0 -20
- package/dist/bollharness/src/scripts/checks/regenerate_magic_docs.js +0 -6
- package/dist/bollharness/src/scripts/ci/detect_rebaseline_triggers.js +0 -8
- package/dist/bollharness/src/scripts/ci/scan_subprocess_cfg.js +0 -8
- package/dist/bollharness/src/scripts/ci/scan_verify_artifacts.js +0 -8
- package/dist/bollharness/src/scripts/ci/scan_yaml_schema.js +0 -8
- package/dist/bollharness/src/scripts/context_router.js +0 -67
- package/dist/bollharness/src/scripts/deploy-guard.js +0 -157
- package/dist/bollharness/src/scripts/guard-feedback.js +0 -192
- package/dist/bollharness/src/scripts/guard_router.js +0 -158
- package/dist/bollharness/src/scripts/hooks/_hook_output.js +0 -6
- package/dist/bollharness/src/scripts/hooks/auto-python3.js +0 -6
- package/dist/bollharness/src/scripts/hooks/deploy-progress-on-session-end.js +0 -6
- package/dist/bollharness/src/scripts/hooks/failure-analyzer.js +0 -6
- package/dist/bollharness/src/scripts/hooks/gate-judgment-inject.js +0 -92
- package/dist/bollharness/src/scripts/hooks/gate-transition-judgment.js +0 -63
- package/dist/bollharness/src/scripts/hooks/inbox-ack.js +0 -6
- package/dist/bollharness/src/scripts/hooks/inbox-inject-on-start.js +0 -6
- package/dist/bollharness/src/scripts/hooks/inbox-validate.js +0 -6
- package/dist/bollharness/src/scripts/hooks/inbox-write-ledger.js +0 -6
- package/dist/bollharness/src/scripts/hooks/initializer-agent.js +0 -6
- package/dist/bollharness/src/scripts/hooks/loop-detection.js +0 -73
- package/dist/bollharness/src/scripts/hooks/owner-guard.js +0 -6
- package/dist/bollharness/src/scripts/hooks/precompact.js +0 -6
- package/dist/bollharness/src/scripts/hooks/review-agent-gatekeeper.js +0 -6
- package/dist/bollharness/src/scripts/hooks/risk-tracker.js +0 -108
- package/dist/bollharness/src/scripts/hooks/sanitize-on-read.js +0 -6
- package/dist/bollharness/src/scripts/hooks/session-reflection.js +0 -7
- package/dist/bollharness/src/scripts/hooks/session-start-magic-docs.js +0 -7
- package/dist/bollharness/src/scripts/hooks/session-start-reset-risk.js +0 -7
- package/dist/bollharness/src/scripts/hooks/session-start-toolkit-reminder.js +0 -7
- package/dist/bollharness/src/scripts/hooks/stop-evaluator.js +0 -157
- package/dist/bollharness/src/scripts/hooks/tool-call-counter.js +0 -6
- package/dist/bollharness/src/scripts/hooks/trace-analyzer.js +0 -10
- package/dist/bollharness/src/scripts/install/install-trust-token.js +0 -7
- package/dist/bollharness/src/scripts/install/multi_project_registry.js +0 -9
- package/dist/bollharness/src/scripts/install/phase2_auto.js +0 -21
- package/dist/bollharness/src/scripts/install/pre_commit_installer.js +0 -6
- package/dist/bollharness/src/scripts/install/tier_selector.js +0 -7
- package/dist/bollharness/src/scripts/install/transcript_miner.js +0 -7
- package/dist/bollharness/src/scripts/lib/claim_patterns.js +0 -10
- package/dist/bollharness/src/scripts/lib/sanitize_patterns.js +0 -12
- package/dist/bollharness/src/scripts/sanitize.js +0 -6
- package/dist/bollharness-integration/context-router-judgment.js.map +0 -1
- package/dist/bollharness-integration/context-router.js.map +0 -1
- package/dist/bollharness-integration/gate-state-machine.js.map +0 -1
- package/dist/bollharness-integration/gate-transition-hooks.js.map +0 -1
- package/dist/bollharness-integration/guard-checker.js.map +0 -1
- package/dist/bollharness-integration/index.js.map +0 -1
- package/dist/bollharness-integration/integration.js.map +0 -1
- package/dist/bollharness-integration/llm/pi-ai.d.ts +0 -60
- package/dist/bollharness-integration/pi-ecosystem-colony/index.d.ts +0 -153
- package/dist/bollharness-integration/pi-ecosystem-goals/index.d.ts +0 -136
- package/dist/bollharness-integration/pi-ecosystem-judgment/decision.d.ts +0 -117
- package/dist/bollharness-integration/pi-ecosystem-judgment/distillation.d.ts +0 -78
- package/dist/bollharness-integration/pi-ecosystem-judgment/index.d.ts +0 -139
- package/dist/bollharness-integration/pi-ecosystem-mcp/index.d.ts +0 -127
- package/dist/bollharness-integration/pi-ecosystem-subagents/index.d.ts +0 -95
- package/dist/bollharness-integration/skill-adapter.js.map +0 -1
- package/dist/constraint-runtime/src/_archive_helper.js +0 -9
- package/dist/constraint-runtime/src/agent/coordinator.js +0 -48
- package/dist/constraint-runtime/src/agent/index.js +0 -1
- package/dist/constraint-runtime/src/assistant/index.js +0 -12
- package/dist/constraint-runtime/src/bootstrap/index.js +0 -12
- package/dist/constraint-runtime/src/bootstrap_graph.js +0 -13
- package/dist/constraint-runtime/src/bridge/index.js +0 -12
- package/dist/constraint-runtime/src/buddy/index.js +0 -12
- package/dist/constraint-runtime/src/cli/index.js +0 -12
- package/dist/constraint-runtime/src/command_graph.js +0 -10
- package/dist/constraint-runtime/src/commands.js +0 -60
- package/dist/constraint-runtime/src/components/index.js +0 -12
- package/dist/constraint-runtime/src/constants/index.js +0 -12
- package/dist/constraint-runtime/src/constraint/budget.js +0 -22
- package/dist/constraint-runtime/src/constraint/budget.js.map +0 -1
- package/dist/constraint-runtime/src/constraint/index.js +0 -2
- package/dist/constraint-runtime/src/constraint/permission.js +0 -20
- package/dist/constraint-runtime/src/constraint/permission.js.map +0 -1
- package/dist/constraint-runtime/src/context.js +0 -30
- package/dist/constraint-runtime/src/coordinator/index.js +0 -12
- package/dist/constraint-runtime/src/cost_hook.js +0 -4
- package/dist/constraint-runtime/src/cost_tracker.js +0 -8
- package/dist/constraint-runtime/src/deferred_init.js +0 -10
- package/dist/constraint-runtime/src/direct_modes.js +0 -6
- package/dist/constraint-runtime/src/dynamic-tool-loader.js +0 -85
- package/dist/constraint-runtime/src/entrypoints/index.js +0 -12
- package/dist/constraint-runtime/src/execution_registry.js +0 -44
- package/dist/constraint-runtime/src/history.js +0 -9
- package/dist/constraint-runtime/src/hooks/index.js +0 -12
- package/dist/constraint-runtime/src/index.js +0 -26
- package/dist/constraint-runtime/src/ink.js +0 -4
- package/dist/constraint-runtime/src/keybindings/index.js +0 -12
- package/dist/constraint-runtime/src/memdir/index.js +0 -12
- package/dist/constraint-runtime/src/migrations/index.js +0 -12
- package/dist/constraint-runtime/src/models.js +0 -1
- package/dist/constraint-runtime/src/models.js.map +0 -1
- package/dist/constraint-runtime/src/moreright/index.js +0 -12
- package/dist/constraint-runtime/src/native_ts/index.js +0 -12
- package/dist/constraint-runtime/src/output_styles/index.js +0 -12
- package/dist/constraint-runtime/src/parity_audit.js +0 -12
- package/dist/constraint-runtime/src/plugins/index.js +0 -12
- package/dist/constraint-runtime/src/port_manifest.js +0 -11
- package/dist/constraint-runtime/src/prefetch.js +0 -9
- package/dist/constraint-runtime/src/query.js +0 -1
- package/dist/constraint-runtime/src/remote/index.js +0 -12
- package/dist/constraint-runtime/src/remote_runtime.js +0 -9
- package/dist/constraint-runtime/src/runtime/index.js +0 -1
- package/dist/constraint-runtime/src/runtime/session.js +0 -35
- package/dist/constraint-runtime/src/schemas/index.js +0 -12
- package/dist/constraint-runtime/src/screens/index.js +0 -12
- package/dist/constraint-runtime/src/server/index.js +0 -12
- package/dist/constraint-runtime/src/services/index.js +0 -12
- package/dist/constraint-runtime/src/session_store.js +0 -22
- package/dist/constraint-runtime/src/setup.js +0 -30
- package/dist/constraint-runtime/src/skills/index.js +0 -1
- package/dist/constraint-runtime/src/skills/skill-registry.js +0 -28
- package/dist/constraint-runtime/src/state/index.js +0 -12
- package/dist/constraint-runtime/src/system_init.js +0 -20
- package/dist/constraint-runtime/src/thinking/engine.js +0 -42
- package/dist/constraint-runtime/src/thinking/index.js +0 -1
- package/dist/constraint-runtime/src/tool_pool.js +0 -8
- package/dist/constraint-runtime/src/tools/OpenCLI/execAdapter.js +0 -7
- package/dist/constraint-runtime/src/tools/OpenCLI/listAdapters.js +0 -7
- package/dist/constraint-runtime/src/tools/OpenCLI/runCommand.js +0 -7
- package/dist/constraint-runtime/src/tools/PolymarketSDK/cancelOrder.js +0 -6
- package/dist/constraint-runtime/src/tools/PolymarketSDK/createOrder.js +0 -6
- package/dist/constraint-runtime/src/tools/PolymarketSDK/getMarket.js +0 -5
- package/dist/constraint-runtime/src/tools/PolymarketSDK/getOrders.js +0 -6
- package/dist/constraint-runtime/src/tools/PolymarketSDK/listMarkets.js +0 -4
- package/dist/constraint-runtime/src/tools/SafeSDK/confirmTransaction.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/createTransaction.js +0 -8
- package/dist/constraint-runtime/src/tools/SafeSDK/deploySafe.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/executeTransaction.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/getBalance.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/getPendingTransactions.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/proposeTransaction.js +0 -6
- package/dist/constraint-runtime/src/tools/WalletTools/autoPay.js +0 -29
- package/dist/constraint-runtime/src/tools/WalletTools/createWallet.js +0 -10
- package/dist/constraint-runtime/src/tools/WalletTools/getBalance.js +0 -13
- package/dist/constraint-runtime/src/tools/WalletTools/importWallet.js +0 -22
- package/dist/constraint-runtime/src/tools/WalletTools/sendTransaction.js +0 -25
- package/dist/constraint-runtime/src/tools/WalletTools/signMessage.js +0 -10
- package/dist/constraint-runtime/src/tools/WalletTools/transferToken.js +0 -25
- package/dist/constraint-runtime/src/tools.js +0 -80
- package/dist/constraint-runtime/src/transcript.js +0 -19
- package/dist/constraint-runtime/src/types/index.js +0 -12
- package/dist/constraint-runtime/src/upstream_proxy/index.js +0 -12
- package/dist/constraint-runtime/src/utils/index.js +0 -12
- package/dist/constraint-runtime/src/vim/index.js +0 -12
- package/dist/constraint-runtime/src/voice/index.js +0 -12
- package/dist/constraints/index.js.map +0 -1
- package/dist/documents/reader.js.map +0 -1
- package/dist/llm/config-store.js.map +0 -1
- package/dist/llm/pi-ai.js.map +0 -1
- package/dist/network/agent-network.js.map +0 -1
- package/dist/network/iroh-integration.js.map +0 -1
- package/dist/network/iroh-transport.js.map +0 -1
- package/dist/network/p2p.js.map +0 -1
- package/dist/network/storage/adapters/json-adapter.js.map +0 -1
- package/dist/pi-ecosystem-colony/index.js.map +0 -1
- package/dist/pi-ecosystem-goals/index.js.map +0 -1
- package/dist/pi-ecosystem-judgment/decision.js.map +0 -1
- package/dist/pi-ecosystem-judgment/distillation.js.map +0 -1
- package/dist/pi-ecosystem-judgment/human-value-store.js.map +0 -1
- package/dist/pi-ecosystem-judgment/index.js.map +0 -1
- package/dist/pi-ecosystem-judgment/value-injection.js.map +0 -1
- package/dist/pi-ecosystem-mcp/index.js.map +0 -1
- package/dist/pi-ecosystem-subagents/index.js.map +0 -1
- package/dist/social/ant-colony/AdaptiveHeartbeat.js.map +0 -1
- package/dist/social/ant-colony/PheromoneEngine.js.map +0 -1
- package/dist/social/ant-colony/types.js.map +0 -1
- package/dist/social/channels/ChannelManager.js.map +0 -1
- package/dist/social/channels/DiapChannelBridge.js.map +0 -1
- package/dist/social/channels/InterestMatcher.js.map +0 -1
- package/dist/social/channels/types.js.map +0 -1
- package/dist/social/global-shared-context.js.map +0 -1
- package/dist/social/heartbeat.js.map +0 -1
- package/lefthook.yml +0 -33
- package/scripts/auto-evolve-loop.ts +0 -481
- package/scripts/build-web.ts +0 -116
- package/scripts/diff-reviewer.ts +0 -159
- package/scripts/validate-system-prompt.ts +0 -142
- package/scripts/weekly-report.ts +0 -364
- package/src/agents/agent-manifest-protocol.ts +0 -117
- package/src/agents/constraint-layer.ts +0 -309
- package/src/agents/iroh-secret.ts +0 -32
- package/src/agents/p2p-chat-tools.ts +0 -383
- package/src/agents/p2p-document-tools.ts +0 -347
- package/src/agents/permission-mode.ts +0 -127
- package/src/agents/pi-sdk.ts +0 -2895
- package/src/agents/pre-tool-validator.ts +0 -213
- package/src/agents/protocol.ts +0 -398
- package/src/agents/shell-guard.ts +0 -417
- package/src/agents/shell-tool.ts +0 -103
- package/src/agents/skill-loader.ts +0 -202
- package/src/agents/subagent-manager.ts +0 -553
- package/src/agents/workflow-engine.ts +0 -332
- package/src/agents/workflow-pivot-loop.ts +0 -766
- package/src/bollharness/.sanitize-report.json +0 -13
- package/src/bollharness/CLAUDE.md +0 -73
- package/src/bollharness/LICENSE +0 -21
- package/src/bollharness/README.md +0 -143
- package/src/bollharness/README.zh-CN.md +0 -131
- package/src/bollharness/package.json +0 -20
- package/src/bollharness/reference/SOURCE-COMMIT.txt +0 -3
- package/src/bollharness/reference/boll-reference/scripts/hooks/.sanitize-report.json +0 -12
- package/src/bollharness/reference/boll-reference/scripts/hooks/find-boll-root.sh +0 -27
- package/src/bollharness/reference/boll-reference/scripts/hooks/precompact.sh +0 -57
- package/src/bollharness/reference/boll-reference/scripts/hooks/stop-evaluator.md +0 -57
- package/src/bollharness/schemas/metrics-jsonl-allowlist.json +0 -67
- package/src/bollharness/scripts/checks/next_decision_number.sh +0 -48
- package/src/bollharness/scripts/ci/count-components.sh +0 -65
- package/src/bollharness/scripts/context-fragments/artifact-linkage.md +0 -14
- package/src/bollharness/scripts/context-fragments/auth-consumers.md +0 -17
- package/src/bollharness/scripts/context-fragments/bridge-constitution.md +0 -13
- package/src/bollharness/scripts/context-fragments/catalyst-distributed.md +0 -18
- package/src/bollharness/scripts/context-fragments/closure-checklist.md +0 -13
- package/src/bollharness/scripts/context-fragments/contract-consumers.md +0 -15
- package/src/bollharness/scripts/context-fragments/db-shared-structures.md +0 -15
- package/src/bollharness/scripts/context-fragments/fixed-three-layers.md +0 -19
- package/src/bollharness/scripts/context-fragments/general-dev-principles.md +0 -11
- package/src/bollharness/scripts/context-fragments/issue-first.md +0 -8
- package/src/bollharness/scripts/context-fragments/mcp-parity.md +0 -16
- package/src/bollharness/scripts/context-fragments/pi-agent-operations.md +0 -108
- package/src/bollharness/scripts/context-fragments/protocol-consumers.md +0 -15
- package/src/bollharness/scripts/context-fragments/run-events-consumers.md +0 -15
- package/src/bollharness/scripts/context-fragments/scene-fidelity.md +0 -13
- package/src/bollharness/scripts/context-fragments/truth-source-hierarchy.md +0 -15
- package/src/bollharness/scripts/context-fragments/two-language.md +0 -15
- package/src/bollharness/scripts/context-fragments/version-sources.md +0 -14
- package/src/bollharness/scripts/hooks/find-project-root.sh +0 -47
- package/src/bollharness/scripts/hooks/inbox-poll.sh +0 -78
- package/src/bollharness/scripts/hooks/precompact.sh +0 -56
- package/src/bollharness/scripts/hooks/stop-evaluator.md +0 -83
- package/src/bollharness/scripts/sync-from-upstream.sh +0 -281
- package/src/bollharness/src/index.ts +0 -5
- package/src/bollharness/src/scripts/checks/check_adr_plan_numbering.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_api_types.ts +0 -52
- package/src/bollharness/src/scripts/checks/check_artifact_link.ts +0 -156
- package/src/bollharness/src/scripts/checks/check_bridge_deps.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_bugfix_binding.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_bugfix_binding_ci.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_doc_file_references.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_doc_freshness.ts +0 -141
- package/src/bollharness/src/scripts/checks/check_doc_links.ts +0 -36
- package/src/bollharness/src/scripts/checks/check_file_existence_claims.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_fragment_integrity.ts +0 -40
- package/src/bollharness/src/scripts/checks/check_hook_installed.ts +0 -70
- package/src/bollharness/src/scripts/checks/check_issue_closure.ts +0 -51
- package/src/bollharness/src/scripts/checks/check_mcp_parity.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_security.ts +0 -54
- package/src/bollharness/src/scripts/checks/check_skill_parity.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_versions.ts +0 -11
- package/src/bollharness/src/scripts/checks/finding.ts +0 -35
- package/src/bollharness/src/scripts/checks/next_decision_number.ts +0 -24
- package/src/bollharness/src/scripts/checks/regenerate_magic_docs.ts +0 -11
- package/src/bollharness/src/scripts/ci/detect_rebaseline_triggers.ts +0 -14
- package/src/bollharness/src/scripts/ci/scan_subprocess_cfg.ts +0 -14
- package/src/bollharness/src/scripts/ci/scan_verify_artifacts.ts +0 -14
- package/src/bollharness/src/scripts/ci/scan_yaml_schema.ts +0 -14
- package/src/bollharness/src/scripts/context_router.ts +0 -76
- package/src/bollharness/src/scripts/deploy-guard.ts +0 -182
- package/src/bollharness/src/scripts/guard-feedback.ts +0 -215
- package/src/bollharness/src/scripts/guard_router.ts +0 -194
- package/src/bollharness/src/scripts/hooks/_hook_output.js +0 -3
- package/src/bollharness/src/scripts/hooks/_hook_output.ts +0 -11
- package/src/bollharness/src/scripts/hooks/auto-python3.ts +0 -10
- package/src/bollharness/src/scripts/hooks/deploy-progress-on-session-end.ts +0 -10
- package/src/bollharness/src/scripts/hooks/failure-analyzer.ts +0 -10
- package/src/bollharness/src/scripts/hooks/gate-judgment-inject.ts +0 -111
- package/src/bollharness/src/scripts/hooks/gate-transition-judgment.ts +0 -74
- package/src/bollharness/src/scripts/hooks/inbox-ack.ts +0 -10
- package/src/bollharness/src/scripts/hooks/inbox-inject-on-start.ts +0 -10
- package/src/bollharness/src/scripts/hooks/inbox-validate.ts +0 -10
- package/src/bollharness/src/scripts/hooks/inbox-write-ledger.ts +0 -10
- package/src/bollharness/src/scripts/hooks/initializer-agent.ts +0 -10
- package/src/bollharness/src/scripts/hooks/loop-detection.ts +0 -83
- package/src/bollharness/src/scripts/hooks/owner-guard.ts +0 -10
- package/src/bollharness/src/scripts/hooks/precompact.ts +0 -10
- package/src/bollharness/src/scripts/hooks/review-agent-gatekeeper.ts +0 -10
- package/src/bollharness/src/scripts/hooks/risk-tracker.ts +0 -121
- package/src/bollharness/src/scripts/hooks/sanitize-on-read.ts +0 -10
- package/src/bollharness/src/scripts/hooks/session-reflection.ts +0 -12
- package/src/bollharness/src/scripts/hooks/session-start-magic-docs.ts +0 -12
- package/src/bollharness/src/scripts/hooks/session-start-reset-risk.ts +0 -12
- package/src/bollharness/src/scripts/hooks/session-start-toolkit-reminder.ts +0 -12
- package/src/bollharness/src/scripts/hooks/stop-evaluator.ts +0 -164
- package/src/bollharness/src/scripts/hooks/tool-call-counter.ts +0 -10
- package/src/bollharness/src/scripts/hooks/trace-analyzer.ts +0 -14
- package/src/bollharness/src/scripts/install/install-trust-token.ts +0 -13
- package/src/bollharness/src/scripts/install/multi_project_registry.ts +0 -13
- package/src/bollharness/src/scripts/install/phase2_auto.ts +0 -28
- package/src/bollharness/src/scripts/install/pre_commit_installer.ts +0 -10
- package/src/bollharness/src/scripts/install/tier_selector.ts +0 -10
- package/src/bollharness/src/scripts/install/transcript_miner.ts +0 -13
- package/src/bollharness/src/scripts/lib/claim_patterns.ts +0 -11
- package/src/bollharness/src/scripts/lib/sanitize_patterns.ts +0 -13
- package/src/bollharness/src/scripts/sanitize.ts +0 -9
- package/src/bollharness/templates/persona/default.json +0 -19
- package/src/bollharness/templates/scaffold/.gitignore.append +0 -16
- package/src/bollharness/templates/scaffold/CLAUDE.md +0 -89
- package/src/bollharness-integration/channel-judgment-engine.ts +0 -634
- package/src/bollharness-integration/context-chain-router.ts +0 -474
- package/src/bollharness-integration/context-router-judgment.ts +0 -339
- package/src/bollharness-integration/context-router.ts +0 -583
- package/src/bollharness-integration/gate-state-machine.ts +0 -444
- package/src/bollharness-integration/gate-transition-hooks.ts +0 -137
- package/src/bollharness-integration/guard-checker.ts +0 -451
- package/src/bollharness-integration/index.ts +0 -195
- package/src/bollharness-integration/integration.ts +0 -538
- package/src/bollharness-integration/judgment-prompts.yaml +0 -535
- package/src/bollharness-integration/llm-judgment-engine.ts +0 -712
- package/src/bollharness-integration/skill-adapter.ts +0 -646
- package/src/bootstrap/bootstrap.ts +0 -135
- package/src/bootstrap/context-collector.ts +0 -371
- package/src/bootstrap/context-hierarchy.ts +0 -283
- package/src/bootstrap/lifecycle-hooks.ts +0 -289
- package/src/bootstrap/project-context.ts +0 -171
- package/src/cli/interface.ts +0 -211
- package/src/cli-entry.ts +0 -304
- package/src/constraints/index.ts +0 -6
- package/src/context-compaction/auto-compact.ts +0 -153
- package/src/context-compaction/budget-gate.ts +0 -32
- package/src/context-compaction/budget-reduce.ts +0 -37
- package/src/context-compaction/context-collapse.ts +0 -72
- package/src/context-compaction/index.ts +0 -24
- package/src/context-compaction/microcompact.ts +0 -54
- package/src/context-compaction/pipeline.ts +0 -133
- package/src/context-compaction/snip.ts +0 -51
- package/src/context-compaction/token-estimator.ts +0 -36
- package/src/context-compaction/types.ts +0 -99
- package/src/documents/reader.ts +0 -85
- package/src/documents/store.ts +0 -252
- package/src/electron-preload.ts +0 -25
- package/src/electron.ts +0 -200
- package/src/heartbeat/DaemonManager.ts +0 -283
- package/src/heartbeat/HealthMonitor.ts +0 -317
- package/src/heartbeat/StartupVerifier.ts +0 -223
- package/src/heartbeat/Watchdog.ts +0 -208
- package/src/heartbeat/index.ts +0 -109
- package/src/heartbeat/self-improve-bus.ts +0 -110
- package/src/heartbeat/types.ts +0 -82
- package/src/index.ts +0 -1724
- package/src/llm/audio-config-store.ts +0 -246
- package/src/llm/config-store.ts +0 -400
- package/src/llm/llm-judgment-client.ts +0 -471
- package/src/llm/pi-ai.ts +0 -653
- package/src/llm/system-prompt/health.ts +0 -159
- package/src/llm/system-prompt/layers/channel/local.md +0 -14
- package/src/llm/system-prompt/layers/channel/p2p-agent.md +0 -18
- package/src/llm/system-prompt/layers/channel/p2p-visitor.md +0 -19
- package/src/llm/system-prompt/layers/core/artifacts_storage.md +0 -89
- package/src/llm/system-prompt/layers/core/evenhandedness.md +0 -21
- package/src/llm/system-prompt/layers/core/hibs_reminders.md +0 -15
- package/src/llm/system-prompt/layers/core/identity.md +0 -37
- package/src/llm/system-prompt/layers/core/knowledge.md +0 -17
- package/src/llm/system-prompt/layers/core/memory_system.md +0 -12
- package/src/llm/system-prompt/layers/core/network_filesystem.md +0 -28
- package/src/llm/system-prompt/layers/core/refusal.md +0 -37
- package/src/llm/system-prompt/layers/core/tone.md +0 -31
- package/src/llm/system-prompt/layers/core/tools.thin.md +0 -13
- package/src/llm/system-prompt/layers/core/wellbeing.md +0 -41
- package/src/llm/system-prompt/layers/role/architect.md +0 -20
- package/src/llm/system-prompt/layers/role/expert.md +0 -19
- package/src/llm/system-prompt/layers/role/implementer.md +0 -15
- package/src/llm/system-prompt/layers/role/security.md +0 -15
- package/src/llm/system-prompt/layers/tool/artifacts.md +0 -72
- package/src/llm/system-prompt/layers/tool/bash.md +0 -25
- package/src/llm/system-prompt/layers/tool/hibs_api.md +0 -171
- package/src/llm/system-prompt/layers/tool/image_search.md +0 -70
- package/src/llm/system-prompt/layers/tool/manifest.md +0 -89
- package/src/llm/system-prompt/layers/tool/mcp_apps.md +0 -53
- package/src/llm/system-prompt/layers/tool/web_search.md +0 -83
- package/src/llm/system-prompt/registry.ts +0 -325
- package/src/llm/system-prompt/strip-hibsml.ts +0 -52
- package/src/llm/tool-manifest/ask_user_input.ts +0 -37
- package/src/llm/tool-manifest/bash.ts +0 -25
- package/src/llm/tool-manifest/create_file.ts +0 -26
- package/src/llm/tool-manifest/fetch_sports_data.ts +0 -28
- package/src/llm/tool-manifest/image_search.ts +0 -26
- package/src/llm/tool-manifest/index.ts +0 -88
- package/src/llm/tool-manifest/mcp.ts +0 -46
- package/src/llm/tool-manifest/message_compose.ts +0 -33
- package/src/llm/tool-manifest/places.ts +0 -86
- package/src/llm/tool-manifest/present_files.ts +0 -23
- package/src/llm/tool-manifest/recipe.ts +0 -42
- package/src/llm/tool-manifest/recommend_apps.ts +0 -25
- package/src/llm/tool-manifest/str_replace.ts +0 -29
- package/src/llm/tool-manifest/types.ts +0 -52
- package/src/llm/tool-manifest/view.ts +0 -26
- package/src/llm/tool-manifest/weather.ts +0 -29
- package/src/llm/tool-manifest/web.ts +0 -54
- package/src/llm/video-config-store.ts +0 -257
- package/src/network/agent-network.ts +0 -800
- package/src/network/hybrid-messenger.ts +0 -199
- package/src/network/iroh-bootstrap.ts +0 -57
- package/src/network/iroh-discovery.ts +0 -208
- package/src/network/iroh-integration.ts +0 -158
- package/src/network/iroh-transport.ts +0 -637
- package/src/network/known-peers.ts +0 -102
- package/src/network/p2p-direct.ts +0 -262
- package/src/network/p2p-secret.ts +0 -153
- package/src/network/p2p.ts +0 -964
- package/src/network/source-intent-broadcaster.ts +0 -242
- package/src/network/source-intent.ts +0 -167
- package/src/network/storage/adapters/json-adapter.ts +0 -454
- package/src/network/storage/index.ts +0 -203
- package/src/network/storage/types.ts +0 -166
- package/src/security/builtin-guards.ts +0 -162
- package/src/security/context-router-tool.ts +0 -122
- package/src/security/input-scanner.ts +0 -287
- package/src/security/react-harness.ts +0 -177
- package/src/security/tool-gate.ts +0 -294
- package/src/social/ant-colony/index.js +0 -19
- package/src/social/channels/ChannelManager.ts +0 -485
- package/src/social/channels/DiapChannelBridge.ts +0 -501
- package/src/social/channels/InterestMatcher.ts +0 -189
- package/src/social/channels/agent-workflow-config.json +0 -214
- package/src/social/channels/agent-workflow-config.yaml +0 -334
- package/src/social/channels/channel-agent-session.ts +0 -407
- package/src/social/channels/channel-heartbeat-agent.ts +0 -622
- package/src/social/channels/diap-doc-parser.ts +0 -282
- package/src/social/channels/harness-workflow-integrator.ts +0 -594
- package/src/social/channels/index.ts +0 -22
- package/src/social/channels/types.ts +0 -115
- package/src/social/global-shared-context.ts +0 -506
- package/src/social/heartbeat.ts +0 -1057
- package/src/social/persona/enhanced-persona.ts +0 -359
- package/src/types.d.ts +0 -12
- package/src/utils/auto-evolve-policy.ts +0 -138
- package/src/utils/auto-update.ts +0 -482
- package/src/utils/clamp.ts +0 -5
- package/src/web/agent-delegate-server.ts +0 -148
- package/src/web/api-config.html +0 -520
- package/src/web/client.js +0 -2352
- package/src/web/client.ts +0 -4326
- package/src/web/components/p2p/P2PModal.tsx +0 -416
- package/src/web/components/p2p/index.ts +0 -566
- package/src/web/components/p2p/index.tsx +0 -297
- package/src/web/components/p2p/p2p-connection.ts +0 -338
- package/src/web/components/p2p/p2p-identity.ts +0 -92
- package/src/web/components/p2p/p2p-manager.ts +0 -147
- package/src/web/components/p2p/p2p-messages.ts +0 -219
- package/src/web/components/p2p/p2p-modal.ts +0 -685
- package/src/web/components/p2p/p2p-store-memory.ts +0 -162
- package/src/web/components/p2p/p2p-tools.ts +0 -315
- package/src/web/components/p2p/types.ts +0 -170
- package/src/web/components/wallet-viem.mjs +0 -118
- package/src/web/design.md +0 -99
- package/src/web/icons/apple-touch-icon.png +0 -0
- package/src/web/icons/favicon-16x16.png +0 -0
- package/src/web/icons/favicon-192x192.png +0 -0
- package/src/web/icons/favicon-32x32.png +0 -0
- package/src/web/icons/favicon-48x48.png +0 -0
- package/src/web/icons/favicon-512x512.png +0 -0
- package/src/web/icons/favicon.icns +0 -0
- package/src/web/icons/favicon.ico +0 -0
- package/src/web/icons/icon.png +0 -0
- package/src/web/icons/image.png +0 -0
- package/src/web/index.html +0 -373
- package/src/web/iroh-delegate-transport.ts +0 -139
- package/src/web/manifest.json +0 -21
- package/src/web/server.ts +0 -5731
- package/src/web/style.css +0 -4737
- package/src/web/ui/message-renderer.ts +0 -540
- package/src/web/ui/step-timeline.ts +0 -394
- package/staging/auto-evolve/clean-001/.review-verdict +0 -9
- package/staging/auto-evolve/clean-001/clean-001.patch +0 -14
- package/staging/auto-evolve/e2e-001/.patch-id +0 -1
- package/staging/auto-evolve/e2e-001/.review-verdict +0 -12
- package/staging/auto-evolve/e2e-001/e2e-001.patch +0 -11
- package/staging/auto-evolve/test-bad/.review-verdict +0 -12
- package/staging/auto-evolve/test-bad/test-bad.patch +0 -11
- package/test-results/.last-run.json +0 -6
- package/test-results/src-test-web-loop-status-b-5734c-atus-bar-/346/230/276/347/244/272-spinner-/344/270/215/346/230/276/347/244/272/345/276/252/347/216/257/350/256/241/346/225/260/error-context.md +0 -285
- package/tsconfig.cli.json +0 -16
- package/tsconfig.electron.json +0 -20
- package/tsconfig.json +0 -18
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Channel Types - 频道智能体社交系统类型定义
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { PersonaDoc } from '../heartbeat.js';
|
|
6
|
-
|
|
7
|
-
export enum ChannelType {
|
|
8
|
-
INTEREST = 'interest',
|
|
9
|
-
CAPABILITY = 'capability',
|
|
10
|
-
REGION = 'region',
|
|
11
|
-
AD_HOC = 'ad_hoc'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ChannelMember {
|
|
15
|
-
did: string;
|
|
16
|
-
name: string;
|
|
17
|
-
peerId?: string;
|
|
18
|
-
role: 'leader' | 'member';
|
|
19
|
-
joinTime: number;
|
|
20
|
-
lastActive: number;
|
|
21
|
-
capabilities: string[];
|
|
22
|
-
interests: string[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface SocialChannel {
|
|
26
|
-
id: string;
|
|
27
|
-
type: ChannelType;
|
|
28
|
-
name: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
topic: string;
|
|
31
|
-
requiredCapabilities: string[];
|
|
32
|
-
members: Map<string, ChannelMember>;
|
|
33
|
-
leaderDid: string;
|
|
34
|
-
createdAt: number;
|
|
35
|
-
lastActivity: number;
|
|
36
|
-
isPublic: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface ChannelPresence {
|
|
40
|
-
channelId: string;
|
|
41
|
-
channelName: string;
|
|
42
|
-
topic: string;
|
|
43
|
-
memberCount: number;
|
|
44
|
-
capabilities: string[];
|
|
45
|
-
leaderDid: string;
|
|
46
|
-
isPublic: boolean;
|
|
47
|
-
timestamp: number;
|
|
48
|
-
signature?: string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface ChannelAnnouncement {
|
|
52
|
-
type: 'channel_announce';
|
|
53
|
-
channelId: string;
|
|
54
|
-
channelName: string;
|
|
55
|
-
topic: string;
|
|
56
|
-
capabilities: string[];
|
|
57
|
-
memberCount: number;
|
|
58
|
-
leaderDid: string;
|
|
59
|
-
isPublic: boolean;
|
|
60
|
-
timestamp: number;
|
|
61
|
-
signature?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface ChannelMessage {
|
|
65
|
-
id: string;
|
|
66
|
-
channelId: string;
|
|
67
|
-
fromDid: string;
|
|
68
|
-
fromName: string;
|
|
69
|
-
type: string;
|
|
70
|
-
payload: string;
|
|
71
|
-
timestamp: number;
|
|
72
|
-
signature?: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface DiscoveredAgent {
|
|
76
|
-
did: string;
|
|
77
|
-
name: string;
|
|
78
|
-
capabilities?: string[];
|
|
79
|
-
interests?: string[];
|
|
80
|
-
lastSeen: number;
|
|
81
|
-
peerId?: string;
|
|
82
|
-
channelId?: string;
|
|
83
|
-
persona?: PersonaDoc;
|
|
84
|
-
// Legacy properties for backward compatibility
|
|
85
|
-
cid?: string;
|
|
86
|
-
ipnsName?: string;
|
|
87
|
-
lastMessage?: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface ChannelDiscoveryResult {
|
|
91
|
-
channel: ChannelPresence;
|
|
92
|
-
matchScore: number;
|
|
93
|
-
discoveredAt: number;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface ServiceRegistration {
|
|
97
|
-
serviceType: string;
|
|
98
|
-
endpoint: string;
|
|
99
|
-
metadata: {
|
|
100
|
-
topic: string;
|
|
101
|
-
capabilities: string[];
|
|
102
|
-
memberCount: number;
|
|
103
|
-
channelType: string;
|
|
104
|
-
name: string;
|
|
105
|
-
};
|
|
106
|
-
registeredAt: number;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export const DEFAULT_CHANNEL_CONFIG = {
|
|
110
|
-
broadcastInterval: 60 * 1000,
|
|
111
|
-
matchThreshold: 0.5,
|
|
112
|
-
maxChannels: 10,
|
|
113
|
-
maxMembersPerChannel: 50,
|
|
114
|
-
memberTimeout: 30 * 60 * 1000,
|
|
115
|
-
};
|
|
@@ -1,506 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs/promises';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
|
|
4
|
-
export interface ActionSummary {
|
|
5
|
-
id: string;
|
|
6
|
-
content: string;
|
|
7
|
-
timestamp: string;
|
|
8
|
-
agentId?: string;
|
|
9
|
-
channelId?: string;
|
|
10
|
-
importance: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ActiveTask {
|
|
14
|
-
id: string;
|
|
15
|
-
description: string;
|
|
16
|
-
status: 'in_progress' | 'completed' | 'failed';
|
|
17
|
-
createdAt: string;
|
|
18
|
-
completedAt?: string;
|
|
19
|
-
result?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface SharedMemory {
|
|
23
|
-
recentActions: ActionSummary[];
|
|
24
|
-
sharedKnowledge: string[];
|
|
25
|
-
currentTask?: ActiveTask;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface AgentInfo {
|
|
29
|
-
agentId: string;
|
|
30
|
-
did?: string;
|
|
31
|
-
sessionId: string;
|
|
32
|
-
channelId: string;
|
|
33
|
-
capabilities: string[];
|
|
34
|
-
status: 'active' | 'idle' | 'busy';
|
|
35
|
-
lastActive: string;
|
|
36
|
-
name?: string;
|
|
37
|
-
persona?: {
|
|
38
|
-
name: string;
|
|
39
|
-
description: string;
|
|
40
|
-
capabilities: string[];
|
|
41
|
-
};
|
|
42
|
-
peerId?: string;
|
|
43
|
-
p2pChannel?: string;
|
|
44
|
-
cid?: string;
|
|
45
|
-
ipnsName?: string;
|
|
46
|
-
walletAddress?: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface AgentRegistry {
|
|
50
|
-
[agentId: string]: AgentInfo;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type CooperationType = 'consult' | 'delegate' | 'collaborate';
|
|
54
|
-
export type CooperationStatus = 'pending' | 'in_progress' | 'done' | 'failed';
|
|
55
|
-
|
|
56
|
-
export interface CooperationTask {
|
|
57
|
-
id: string;
|
|
58
|
-
type: CooperationType;
|
|
59
|
-
fromAgentId: string;
|
|
60
|
-
toAgentId?: string;
|
|
61
|
-
task: string;
|
|
62
|
-
context?: string;
|
|
63
|
-
status: CooperationStatus;
|
|
64
|
-
createdAt: string;
|
|
65
|
-
updatedAt: string;
|
|
66
|
-
result?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface GlobalSharedContext {
|
|
70
|
-
memory: SharedMemory;
|
|
71
|
-
agentRegistry: AgentRegistry;
|
|
72
|
-
cooperationQueue: CooperationTask[];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const GLOBAL_CONTEXT_PATH = path.join(process.env.HOME || '/tmp', '.bolloon', 'sessions', 'global-context.json');
|
|
76
|
-
|
|
77
|
-
const MAX_RECENT_ACTIONS = 50;
|
|
78
|
-
const MAX_SHARED_KNOWLEDGE = 100;
|
|
79
|
-
|
|
80
|
-
export class GlobalSharedContextManager {
|
|
81
|
-
private memory: SharedMemory = {
|
|
82
|
-
recentActions: [],
|
|
83
|
-
sharedKnowledge: []
|
|
84
|
-
};
|
|
85
|
-
private agentRegistry: AgentRegistry = {};
|
|
86
|
-
private cooperationQueue: CooperationTask[] = [];
|
|
87
|
-
private contextPath: string;
|
|
88
|
-
private initialized: boolean = false;
|
|
89
|
-
|
|
90
|
-
constructor(contextPath?: string) {
|
|
91
|
-
this.contextPath = contextPath || GLOBAL_CONTEXT_PATH;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async initialize(): Promise<void> {
|
|
95
|
-
if (this.initialized) return;
|
|
96
|
-
await fs.mkdir(path.dirname(this.contextPath), { recursive: true });
|
|
97
|
-
await this.load();
|
|
98
|
-
this.initialized = true;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
private async load(): Promise<void> {
|
|
102
|
-
try {
|
|
103
|
-
const data = await fs.readFile(this.contextPath, 'utf-8');
|
|
104
|
-
const parsed = JSON.parse(data) as GlobalSharedContext;
|
|
105
|
-
this.memory = parsed.memory || { recentActions: [], sharedKnowledge: [] };
|
|
106
|
-
this.agentRegistry = parsed.agentRegistry || {};
|
|
107
|
-
this.cooperationQueue = parsed.cooperationQueue || [];
|
|
108
|
-
} catch {
|
|
109
|
-
this.memory = { recentActions: [], sharedKnowledge: [] };
|
|
110
|
-
this.agentRegistry = {};
|
|
111
|
-
this.cooperationQueue = [];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private async save(): Promise<void> {
|
|
116
|
-
const context: GlobalSharedContext = {
|
|
117
|
-
memory: this.memory,
|
|
118
|
-
agentRegistry: this.agentRegistry,
|
|
119
|
-
cooperationQueue: this.cooperationQueue
|
|
120
|
-
};
|
|
121
|
-
await fs.writeFile(this.contextPath, JSON.stringify(context, null, 2));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
async addUserAction(
|
|
125
|
-
content: string,
|
|
126
|
-
agentId?: string,
|
|
127
|
-
channelId?: string,
|
|
128
|
-
importance: number = 5
|
|
129
|
-
): Promise<void> {
|
|
130
|
-
await this.initialize();
|
|
131
|
-
|
|
132
|
-
const summary: ActionSummary = {
|
|
133
|
-
id: `action_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`,
|
|
134
|
-
content,
|
|
135
|
-
timestamp: new Date().toISOString(),
|
|
136
|
-
agentId,
|
|
137
|
-
channelId,
|
|
138
|
-
importance
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
this.memory.recentActions.push(summary);
|
|
142
|
-
|
|
143
|
-
if (this.memory.recentActions.length > MAX_RECENT_ACTIONS) {
|
|
144
|
-
this.memory.recentActions = this.memory.recentActions.slice(-MAX_RECENT_ACTIONS);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
await this.save();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
async getRecentActions(count: number = 10): Promise<ActionSummary[]> {
|
|
151
|
-
await this.initialize();
|
|
152
|
-
return this.memory.recentActions.slice(-count);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
async getRecentActionsSummary(count: number = 10): Promise<string> {
|
|
156
|
-
const actions = await this.getRecentActions(count);
|
|
157
|
-
if (actions.length === 0) return '暂无最近行动记录';
|
|
158
|
-
|
|
159
|
-
return actions.map((a, i) => {
|
|
160
|
-
const time = new Date(a.timestamp).toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' });
|
|
161
|
-
return `[${time}] ${a.content}`;
|
|
162
|
-
}).join('\n');
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
async addSharedKnowledge(knowledge: string): Promise<void> {
|
|
166
|
-
await this.initialize();
|
|
167
|
-
|
|
168
|
-
if (!this.memory.sharedKnowledge.includes(knowledge)) {
|
|
169
|
-
this.memory.sharedKnowledge.push(knowledge);
|
|
170
|
-
|
|
171
|
-
if (this.memory.sharedKnowledge.length > MAX_SHARED_KNOWLEDGE) {
|
|
172
|
-
this.memory.sharedKnowledge = this.memory.sharedKnowledge.slice(-MAX_SHARED_KNOWLEDGE);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
await this.save();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
async getSharedKnowledge(): Promise<string[]> {
|
|
180
|
-
await this.initialize();
|
|
181
|
-
return [...this.memory.sharedKnowledge];
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async setCurrentTask(task: Omit<ActiveTask, 'id' | 'createdAt'>): Promise<ActiveTask> {
|
|
185
|
-
await this.initialize();
|
|
186
|
-
|
|
187
|
-
const newTask: ActiveTask = {
|
|
188
|
-
id: `task_${Date.now()}`,
|
|
189
|
-
createdAt: new Date().toISOString(),
|
|
190
|
-
...task
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
this.memory.currentTask = newTask;
|
|
194
|
-
await this.save();
|
|
195
|
-
return newTask;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
async completeCurrentTask(result: string): Promise<void> {
|
|
199
|
-
await this.initialize();
|
|
200
|
-
|
|
201
|
-
if (this.memory.currentTask) {
|
|
202
|
-
this.memory.currentTask.status = 'completed';
|
|
203
|
-
this.memory.currentTask.completedAt = new Date().toISOString();
|
|
204
|
-
this.memory.currentTask.result = result;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
await this.save();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
async getCurrentTask(): Promise<ActiveTask | undefined> {
|
|
211
|
-
await this.initialize();
|
|
212
|
-
return this.memory.currentTask;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
async registerAgent(agentInfo: Omit<AgentInfo, 'lastActive'>): Promise<void> {
|
|
216
|
-
await this.initialize();
|
|
217
|
-
|
|
218
|
-
this.agentRegistry[agentInfo.agentId] = {
|
|
219
|
-
...agentInfo,
|
|
220
|
-
lastActive: new Date().toISOString()
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
await this.save();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
async updateAgentStatus(agentId: string, status: AgentInfo['status']): Promise<void> {
|
|
227
|
-
await this.initialize();
|
|
228
|
-
|
|
229
|
-
if (this.agentRegistry[agentId]) {
|
|
230
|
-
this.agentRegistry[agentId].status = status;
|
|
231
|
-
this.agentRegistry[agentId].lastActive = new Date().toISOString();
|
|
232
|
-
await this.save();
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
async getAgent(agentId: string): Promise<AgentInfo | undefined> {
|
|
237
|
-
await this.initialize();
|
|
238
|
-
return this.agentRegistry[agentId];
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
async getAllAgents(): Promise<AgentInfo[]> {
|
|
242
|
-
await this.initialize();
|
|
243
|
-
return Object.values(this.agentRegistry);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
async getActiveAgents(): Promise<AgentInfo[]> {
|
|
247
|
-
await this.initialize();
|
|
248
|
-
return Object.values(this.agentRegistry).filter(a => a.status === 'active');
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
async findAgentByCapability(capability: string): Promise<AgentInfo[]> {
|
|
252
|
-
await this.initialize();
|
|
253
|
-
return Object.values(this.agentRegistry).filter(
|
|
254
|
-
a => a.capabilities.some(c => c.toLowerCase().includes(capability.toLowerCase()))
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
async unregisterAgent(agentId: string): Promise<void> {
|
|
259
|
-
await this.initialize();
|
|
260
|
-
delete this.agentRegistry[agentId];
|
|
261
|
-
await this.save();
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
async createCooperation(
|
|
265
|
-
type: CooperationType,
|
|
266
|
-
fromAgentId: string,
|
|
267
|
-
task: string,
|
|
268
|
-
toAgentId?: string,
|
|
269
|
-
context?: string
|
|
270
|
-
): Promise<CooperationTask> {
|
|
271
|
-
await this.initialize();
|
|
272
|
-
|
|
273
|
-
const cooperation: CooperationTask = {
|
|
274
|
-
id: `coop_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`,
|
|
275
|
-
type,
|
|
276
|
-
fromAgentId,
|
|
277
|
-
toAgentId,
|
|
278
|
-
task,
|
|
279
|
-
context,
|
|
280
|
-
status: 'pending',
|
|
281
|
-
createdAt: new Date().toISOString(),
|
|
282
|
-
updatedAt: new Date().toISOString()
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
this.cooperationQueue.push(cooperation);
|
|
286
|
-
await this.save();
|
|
287
|
-
return cooperation;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
async updateCooperationStatus(
|
|
291
|
-
cooperationId: string,
|
|
292
|
-
status: CooperationStatus,
|
|
293
|
-
result?: string
|
|
294
|
-
): Promise<void> {
|
|
295
|
-
await this.initialize();
|
|
296
|
-
|
|
297
|
-
const cooperation = this.cooperationQueue.find(c => c.id === cooperationId);
|
|
298
|
-
if (cooperation) {
|
|
299
|
-
cooperation.status = status;
|
|
300
|
-
cooperation.updatedAt = new Date().toISOString();
|
|
301
|
-
if (result) {
|
|
302
|
-
cooperation.result = result;
|
|
303
|
-
}
|
|
304
|
-
await this.save();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
async getCooperation(cooperationId: string): Promise<CooperationTask | undefined> {
|
|
309
|
-
await this.initialize();
|
|
310
|
-
return this.cooperationQueue.find(c => c.id === cooperationId);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
async getPendingCooperations(forAgentId?: string): Promise<CooperationTask[]> {
|
|
314
|
-
await this.initialize();
|
|
315
|
-
return this.cooperationQueue.filter(c => {
|
|
316
|
-
if (c.status !== 'pending') return false;
|
|
317
|
-
if (forAgentId) return c.toAgentId === forAgentId || c.fromAgentId === forAgentId;
|
|
318
|
-
return true;
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
async getCooperationsForAgent(agentId: string): Promise<CooperationTask[]> {
|
|
323
|
-
await this.initialize();
|
|
324
|
-
return this.cooperationQueue.filter(
|
|
325
|
-
c => c.fromAgentId === agentId || c.toAgentId === agentId
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
async getFullContext(): Promise<GlobalSharedContext> {
|
|
330
|
-
await this.initialize();
|
|
331
|
-
return {
|
|
332
|
-
memory: { ...this.memory },
|
|
333
|
-
agentRegistry: { ...this.agentRegistry },
|
|
334
|
-
cooperationQueue: [...this.cooperationQueue]
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
async getContextSummary(): Promise<string> {
|
|
339
|
-
await this.initialize();
|
|
340
|
-
|
|
341
|
-
const agents = Object.values(this.agentRegistry);
|
|
342
|
-
const activeAgents = agents.filter(a => a.status === 'active');
|
|
343
|
-
const pendingCoops = this.cooperationQueue.filter(c => c.status === 'pending');
|
|
344
|
-
|
|
345
|
-
let summary = '=== 全局共享上下文 ===\n\n';
|
|
346
|
-
|
|
347
|
-
summary += '【最近行动】\n';
|
|
348
|
-
const recentActions = this.memory.recentActions.slice(-5);
|
|
349
|
-
if (recentActions.length === 0) {
|
|
350
|
-
summary += ' 暂无\n';
|
|
351
|
-
} else {
|
|
352
|
-
for (const action of recentActions) {
|
|
353
|
-
const time = new Date(action.timestamp).toLocaleTimeString('zh-CN');
|
|
354
|
-
summary += ` [${time}] ${action.content.substring(0, 50)}${action.content.length > 50 ? '...' : ''}\n`;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
summary += '\n【共享知识】\n';
|
|
359
|
-
if (this.memory.sharedKnowledge.length === 0) {
|
|
360
|
-
summary += ' 暂无\n';
|
|
361
|
-
} else {
|
|
362
|
-
for (const knowledge of this.memory.sharedKnowledge.slice(-5)) {
|
|
363
|
-
summary += ` - ${knowledge.substring(0, 60)}${knowledge.length > 60 ? '...' : ''}\n`;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
summary += '\n【当前任务】\n';
|
|
368
|
-
if (this.memory.currentTask) {
|
|
369
|
-
summary += ` ${this.memory.currentTask.description} (${this.memory.currentTask.status})\n`;
|
|
370
|
-
} else {
|
|
371
|
-
summary += ' 暂无\n';
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
summary += '\n【Agent 注册】\n';
|
|
375
|
-
summary += ` 总数: ${agents.length}, 活跃: ${activeAgents.length}\n`;
|
|
376
|
-
for (const agent of activeAgents.slice(0, 5)) {
|
|
377
|
-
summary += ` - ${agent.name || agent.agentId}: ${agent.capabilities.join(', ')}\n`;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
summary += '\n【待处理合作】\n';
|
|
381
|
-
if (pendingCoops.length === 0) {
|
|
382
|
-
summary += ' 暂无\n';
|
|
383
|
-
} else {
|
|
384
|
-
for (const coop of pendingCoops.slice(0, 3)) {
|
|
385
|
-
summary += ` [${coop.type}] ${coop.task.substring(0, 40)}... (${coop.fromAgentId} -> ${coop.toAgentId || 'broadcast'})\n`;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
return summary;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
async clear(): Promise<void> {
|
|
393
|
-
this.memory = { recentActions: [], sharedKnowledge: [] };
|
|
394
|
-
this.agentRegistry = {};
|
|
395
|
-
this.cooperationQueue = [];
|
|
396
|
-
await this.save();
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
async syncFromSubAgent(subAgent: {
|
|
400
|
-
id: string;
|
|
401
|
-
name?: string;
|
|
402
|
-
did?: string;
|
|
403
|
-
sessionId?: string;
|
|
404
|
-
channelId?: string;
|
|
405
|
-
peerId?: string;
|
|
406
|
-
p2pChannel?: string;
|
|
407
|
-
cid?: string;
|
|
408
|
-
ipnsName?: string;
|
|
409
|
-
walletAddress?: string;
|
|
410
|
-
capabilities: string[];
|
|
411
|
-
status: 'creating' | 'active' | 'idle' | 'busy' | 'terminated';
|
|
412
|
-
persona?: { name: string; description: string; capabilities: string[] };
|
|
413
|
-
}): Promise<void> {
|
|
414
|
-
await this.initialize();
|
|
415
|
-
|
|
416
|
-
const status = subAgent.status === 'creating' ? 'active' :
|
|
417
|
-
subAgent.status === 'terminated' ? 'idle' :
|
|
418
|
-
subAgent.status;
|
|
419
|
-
|
|
420
|
-
this.agentRegistry[subAgent.id] = {
|
|
421
|
-
agentId: subAgent.id,
|
|
422
|
-
did: subAgent.did,
|
|
423
|
-
sessionId: subAgent.sessionId || '',
|
|
424
|
-
channelId: subAgent.channelId || '',
|
|
425
|
-
capabilities: subAgent.capabilities,
|
|
426
|
-
status: status as AgentInfo['status'],
|
|
427
|
-
lastActive: new Date().toISOString(),
|
|
428
|
-
name: subAgent.name,
|
|
429
|
-
peerId: subAgent.peerId,
|
|
430
|
-
p2pChannel: subAgent.p2pChannel,
|
|
431
|
-
cid: subAgent.cid,
|
|
432
|
-
ipnsName: subAgent.ipnsName,
|
|
433
|
-
walletAddress: subAgent.walletAddress,
|
|
434
|
-
persona: subAgent.persona
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
await this.save();
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
async syncToSubAgents(subAgents: Map<string, {
|
|
441
|
-
id: string;
|
|
442
|
-
name?: string;
|
|
443
|
-
did?: string;
|
|
444
|
-
sessionId?: string;
|
|
445
|
-
channelId?: string;
|
|
446
|
-
peerId?: string;
|
|
447
|
-
p2pChannel?: string;
|
|
448
|
-
cid?: string;
|
|
449
|
-
ipnsName?: string;
|
|
450
|
-
walletAddress?: string;
|
|
451
|
-
capabilities: string[];
|
|
452
|
-
status: 'creating' | 'active' | 'idle' | 'busy' | 'terminated';
|
|
453
|
-
persona?: { name: string; description: string; capabilities: string[] };
|
|
454
|
-
}>): Promise<void> {
|
|
455
|
-
await this.initialize();
|
|
456
|
-
|
|
457
|
-
for (const [agentId, subAgent] of subAgents) {
|
|
458
|
-
const status = subAgent.status === 'creating' ? 'active' :
|
|
459
|
-
subAgent.status === 'terminated' ? 'idle' :
|
|
460
|
-
subAgent.status;
|
|
461
|
-
|
|
462
|
-
this.agentRegistry[agentId] = {
|
|
463
|
-
agentId: subAgent.id,
|
|
464
|
-
did: subAgent.did,
|
|
465
|
-
sessionId: subAgent.sessionId || '',
|
|
466
|
-
channelId: subAgent.channelId || '',
|
|
467
|
-
capabilities: subAgent.capabilities,
|
|
468
|
-
status: status as AgentInfo['status'],
|
|
469
|
-
lastActive: new Date().toISOString(),
|
|
470
|
-
name: subAgent.name,
|
|
471
|
-
peerId: subAgent.peerId,
|
|
472
|
-
p2pChannel: subAgent.p2pChannel,
|
|
473
|
-
cid: subAgent.cid,
|
|
474
|
-
ipnsName: subAgent.ipnsName,
|
|
475
|
-
walletAddress: subAgent.walletAddress,
|
|
476
|
-
persona: subAgent.persona
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
await this.save();
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
let globalContextInstance: GlobalSharedContextManager | null = null;
|
|
485
|
-
|
|
486
|
-
export function getGlobalSharedContext(): GlobalSharedContextManager {
|
|
487
|
-
if (!globalContextInstance) {
|
|
488
|
-
globalContextInstance = new GlobalSharedContextManager();
|
|
489
|
-
}
|
|
490
|
-
return globalContextInstance;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
export async function createGlobalSharedContext(
|
|
494
|
-
contextPath?: string
|
|
495
|
-
): Promise<GlobalSharedContextManager> {
|
|
496
|
-
if (globalContextInstance) {
|
|
497
|
-
return globalContextInstance;
|
|
498
|
-
}
|
|
499
|
-
globalContextInstance = new GlobalSharedContextManager(contextPath);
|
|
500
|
-
await globalContextInstance.initialize();
|
|
501
|
-
return globalContextInstance;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
export function resetGlobalSharedContext(): void {
|
|
505
|
-
globalContextInstance = null;
|
|
506
|
-
}
|