@bolloon/bolloon-agent 0.1.36 → 0.1.37
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/dist/web/client.js +2861 -3746
- package/dist/web/components/p2p/index.js +226 -264
- package/dist/web/ui/message-renderer.js +323 -434
- package/dist/web/ui/step-timeline.js +255 -351
- 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/dist/web/components/p2p/P2PModal.js +0 -188
- package/dist/web/components/p2p/p2p-modal.js +0 -657
- package/dist/web/components/p2p/p2p-tools.js +0 -248
- package/lefthook.yml +0 -33
- package/scripts/auto-evolve-loop.ts +0 -481
- package/scripts/auto-evolve-oneshot.sh +0 -155
- package/scripts/auto-evolve-snapshot.sh +0 -136
- package/scripts/build-cli.js +0 -216
- package/scripts/build-web.ts +0 -116
- package/scripts/detect-schema-changes.sh +0 -48
- package/scripts/diff-reviewer.ts +0 -159
- package/scripts/postinstall.js +0 -153
- 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
package/src/utils/auto-update.ts
DELETED
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* npm 自动更新检查器
|
|
3
|
-
*
|
|
4
|
-
* 功能:
|
|
5
|
-
* - 启动时检查 npm 注册表是否有新版本
|
|
6
|
-
* - 自动下载并安装最新版本
|
|
7
|
-
* - 支持增量更新(只更新新增的包)
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { execSync } from 'child_process';
|
|
11
|
-
import * as fs from 'fs';
|
|
12
|
-
import * as path from 'path';
|
|
13
|
-
import * as https from 'https';
|
|
14
|
-
import * as http from 'http';
|
|
15
|
-
|
|
16
|
-
// ANSI 颜色
|
|
17
|
-
const RESET = '\x1b[0m';
|
|
18
|
-
const BOLD = '\x1b[1m';
|
|
19
|
-
const CYAN = '\x1b[36m';
|
|
20
|
-
const GREEN = '\x1b[32m';
|
|
21
|
-
const YELLOW = '\x1b[33m';
|
|
22
|
-
const MAGENTA = '\x1b[35m';
|
|
23
|
-
|
|
24
|
-
interface PackageInfo {
|
|
25
|
-
name: string;
|
|
26
|
-
version: string;
|
|
27
|
-
latest: string;
|
|
28
|
-
outdated: boolean;
|
|
29
|
-
packages: OutdatedPackage[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface OutdatedPackage {
|
|
33
|
-
name: string;
|
|
34
|
-
current: string;
|
|
35
|
-
wanted: string;
|
|
36
|
-
latest: string;
|
|
37
|
-
location: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface UpdateResult {
|
|
41
|
-
success: boolean;
|
|
42
|
-
updated: boolean;
|
|
43
|
-
message: string;
|
|
44
|
-
updatedPackages?: string[];
|
|
45
|
-
error?: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function log(msg: string, color: string = RESET) {
|
|
49
|
-
process.stdout.write(`${color}${msg}${RESET}`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function httpGet(url: string): Promise<string> {
|
|
53
|
-
return new Promise((resolve, reject) => {
|
|
54
|
-
const client = url.startsWith('https') ? https : http;
|
|
55
|
-
const req = client.get(url, { timeout: 10000 }, (res: any) => {
|
|
56
|
-
let data = '';
|
|
57
|
-
res.on('data', (chunk: string) => data += chunk);
|
|
58
|
-
res.on('end', () => resolve(data));
|
|
59
|
-
});
|
|
60
|
-
req.on('error', reject);
|
|
61
|
-
req.on('timeout', () => {
|
|
62
|
-
req.destroy();
|
|
63
|
-
reject(new Error('请求超时'));
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 获取 bolloon 全局安装目录
|
|
70
|
-
*/
|
|
71
|
-
function getGlobalBolloonDir(): string | null {
|
|
72
|
-
const possiblePaths = [
|
|
73
|
-
path.join(process.env.HOME || '', '.npm-global/lib/node_modules/@bolloon/bolloon-agent'),
|
|
74
|
-
path.join(process.env.PREFIX || '/usr/local', 'lib/node_modules/@bolloon/bolloon-agent'),
|
|
75
|
-
];
|
|
76
|
-
for (const p of possiblePaths) {
|
|
77
|
-
if (fs.existsSync(path.join(p, 'package.json'))) {
|
|
78
|
-
return p;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* 获取当前安装的包版本
|
|
86
|
-
* 优先使用全局安装的版本(更准确反映实际运行的版本)
|
|
87
|
-
*/
|
|
88
|
-
function getInstalledVersion(packageName: string): string | null {
|
|
89
|
-
// 调试:打印 cwd
|
|
90
|
-
console.error(`[DEBUG] getInstalledVersion called, cwd=${process.cwd()}, package=${packageName}`);
|
|
91
|
-
|
|
92
|
-
// 对于 @bolloon/bolloon-agent,始终优先从全局安装位置读取版本
|
|
93
|
-
// 这样可以准确检测实际安装的版本,而不受 cwd 影响
|
|
94
|
-
if (packageName === '@bolloon/bolloon-agent') {
|
|
95
|
-
const globalDir = getGlobalBolloonDir();
|
|
96
|
-
console.error(`[DEBUG] globalDir=${globalDir}`);
|
|
97
|
-
if (globalDir) {
|
|
98
|
-
const pkgPath = path.join(globalDir, 'package.json');
|
|
99
|
-
console.error(`[DEBUG] pkgPath=${pkgPath}, exists=${fs.existsSync(pkgPath)}`);
|
|
100
|
-
try {
|
|
101
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
102
|
-
console.error(`[DEBUG] pkg.version=${pkg.version}`);
|
|
103
|
-
return pkg.version || null;
|
|
104
|
-
} catch (e) {
|
|
105
|
-
// 忽略
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// 回退到本地 package.json
|
|
110
|
-
const localPkgPath = path.join(process.cwd(), 'package.json');
|
|
111
|
-
console.error(`[DEBUG] localPkgPath=${localPkgPath}, exists=${fs.existsSync(localPkgPath)}`);
|
|
112
|
-
if (fs.existsSync(localPkgPath)) {
|
|
113
|
-
try {
|
|
114
|
-
const pkg = JSON.parse(fs.readFileSync(localPkgPath, 'utf-8'));
|
|
115
|
-
console.error(`[DEBUG] local pkg.version=${pkg.version}`);
|
|
116
|
-
return pkg.version || null;
|
|
117
|
-
} catch (e) {
|
|
118
|
-
// 忽略
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// 检查本地 node_modules
|
|
124
|
-
const packageJsonPath = findPackageJson(packageName);
|
|
125
|
-
console.error(`[DEBUG] findPackageJson=${packageJsonPath}`);
|
|
126
|
-
if (packageJsonPath) {
|
|
127
|
-
try {
|
|
128
|
-
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
129
|
-
console.error(`[DEBUG] node_modules pkg.version=${pkg.version}`);
|
|
130
|
-
return pkg.version || null;
|
|
131
|
-
} catch (e) {
|
|
132
|
-
// 忽略错误
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* 查找包的 package.json 路径
|
|
140
|
-
*/
|
|
141
|
-
function findPackageJson(packageName: string): string | null {
|
|
142
|
-
// 检查当前项目的 node_modules
|
|
143
|
-
const checkPaths = [
|
|
144
|
-
path.join(process.cwd(), 'node_modules', packageName, 'package.json'),
|
|
145
|
-
path.join(process.cwd(), 'node_modules', '@' + packageName.split('/')[0], packageName.split('/')[1] || '', 'package.json'),
|
|
146
|
-
];
|
|
147
|
-
|
|
148
|
-
for (const p of checkPaths) {
|
|
149
|
-
if (fs.existsSync(p)) return p;
|
|
150
|
-
}
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* 检查 npm 注册表获取最新版本
|
|
156
|
-
*/
|
|
157
|
-
async function getLatestVersion(packageName: string): Promise<string | null> {
|
|
158
|
-
try {
|
|
159
|
-
const encodedName = encodeURIComponent(packageName);
|
|
160
|
-
const url = `https://registry.npmjs.org/${encodedName}`;
|
|
161
|
-
const response = await httpGet(url);
|
|
162
|
-
const data = JSON.parse(response);
|
|
163
|
-
return data['dist-tags']?.latest || null;
|
|
164
|
-
} catch (e) {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* 比较版本号
|
|
171
|
-
*/
|
|
172
|
-
function compareVersions(current: string, latest: string): -1 | 0 | 1 {
|
|
173
|
-
const currentParts = current.split('.').map(Number);
|
|
174
|
-
const latestParts = latest.split('.').map(Number);
|
|
175
|
-
|
|
176
|
-
for (let i = 0; i < Math.max(currentParts.length, latestParts.length); i++) {
|
|
177
|
-
const c = currentParts[i] || 0;
|
|
178
|
-
const l = latestParts[i] || 0;
|
|
179
|
-
if (c < l) return -1;
|
|
180
|
-
if (c > l) return 1;
|
|
181
|
-
}
|
|
182
|
-
return 0;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* 检查 @bolloon 相关的包是否有更新
|
|
187
|
-
*/
|
|
188
|
-
async function checkBolloonUpdates(): Promise<PackageInfo | null> {
|
|
189
|
-
const packagesToCheck = [
|
|
190
|
-
'@bolloon/bolloon-agent',
|
|
191
|
-
'@bolloon/constraint-runtime',
|
|
192
|
-
];
|
|
193
|
-
|
|
194
|
-
const outdatedPackages: OutdatedPackage[] = [];
|
|
195
|
-
let hasUpdate = false;
|
|
196
|
-
let currentVersion = '';
|
|
197
|
-
let latestVersion = '';
|
|
198
|
-
|
|
199
|
-
for (const pkg of packagesToCheck) {
|
|
200
|
-
const installed = getInstalledVersion(pkg);
|
|
201
|
-
console.error(`[DEBUG] getInstalledVersion(${pkg}) = ${installed}`);
|
|
202
|
-
if (!installed) continue;
|
|
203
|
-
|
|
204
|
-
// 只记录 @bolloon/bolloon-agent 的版本作为当前版本
|
|
205
|
-
if (pkg === '@bolloon/bolloon-agent') {
|
|
206
|
-
currentVersion = installed;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const latest = await getLatestVersion(pkg);
|
|
210
|
-
console.error(`[DEBUG] getLatestVersion(${pkg}) = ${latest}`);
|
|
211
|
-
|
|
212
|
-
if (latest && compareVersions(installed, latest) < 0) {
|
|
213
|
-
hasUpdate = true;
|
|
214
|
-
latestVersion = latest;
|
|
215
|
-
outdatedPackages.push({
|
|
216
|
-
name: pkg,
|
|
217
|
-
current: installed,
|
|
218
|
-
wanted: latest,
|
|
219
|
-
latest,
|
|
220
|
-
location: pkg
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (outdatedPackages.length === 0) {
|
|
226
|
-
return {
|
|
227
|
-
name: '@bolloon/bolloon-agent',
|
|
228
|
-
version: currentVersion,
|
|
229
|
-
latest: currentVersion,
|
|
230
|
-
outdated: false,
|
|
231
|
-
packages: []
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return {
|
|
236
|
-
name: '@bolloon/bolloon-agent',
|
|
237
|
-
version: currentVersion,
|
|
238
|
-
latest: latestVersion,
|
|
239
|
-
outdated: hasUpdate,
|
|
240
|
-
packages: outdatedPackages
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* 使用 npm outdated 检查所有包的更新
|
|
246
|
-
*/
|
|
247
|
-
function checkNpmOutdated(): OutdatedPackage[] {
|
|
248
|
-
try {
|
|
249
|
-
const output = execSync('npm outdated --json', {
|
|
250
|
-
encoding: 'utf-8',
|
|
251
|
-
timeout: 30000,
|
|
252
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
253
|
-
cwd: process.cwd()
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
if (!output.trim()) return [];
|
|
257
|
-
|
|
258
|
-
const data = JSON.parse(output);
|
|
259
|
-
const packages: OutdatedPackage[] = [];
|
|
260
|
-
|
|
261
|
-
for (const [name, info] of Object.entries(data)) {
|
|
262
|
-
const pkg = info as any;
|
|
263
|
-
packages.push({
|
|
264
|
-
name,
|
|
265
|
-
current: pkg.current || '0.0.0',
|
|
266
|
-
wanted: pkg.wanted || '0.0.0',
|
|
267
|
-
latest: pkg.latest || '0.0.0',
|
|
268
|
-
location: pkg.location || name
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
return packages;
|
|
273
|
-
} catch (e: any) {
|
|
274
|
-
// npm outdated 在没有过时包时会返回非零退出码
|
|
275
|
-
if (e.status !== 0 && !e.message?.includes('npm outdated')) {
|
|
276
|
-
return [];
|
|
277
|
-
}
|
|
278
|
-
return [];
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* 自动更新 npm 包 (legacy: 只传包名, 让 npm 按本地 semver 约束判断 — 不可靠)
|
|
284
|
-
* 新代码应使用 updatePackagesWithVersion 并传 name@version
|
|
285
|
-
*/
|
|
286
|
-
async function updatePackages(packages?: string[]): Promise<UpdateResult> {
|
|
287
|
-
const targets = packages && packages.length > 0 ? packages : ['@bolloon/bolloon-agent'];
|
|
288
|
-
// 旧 API 没有 version, 加一个空 placeholder 走相同路径
|
|
289
|
-
return updatePackagesWithVersion(targets);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* 自动更新 npm 包, 传 `name@version` 形式的目标让 npm install 不被本地
|
|
294
|
-
* package.json 的 semver 约束卡住 (旧版只传 name 时, npm 看到本地
|
|
295
|
-
* package.json 里 "^0.1.17" 已经满足就判 up to date, 永远升不上去)
|
|
296
|
-
*/
|
|
297
|
-
async function updatePackagesWithVersion(packagesWithVersion: string[]): Promise<UpdateResult> {
|
|
298
|
-
// 解析 `name@version` 形式, 提取 name 用于 before/after 校验
|
|
299
|
-
const parsed = packagesWithVersion.map(spec => {
|
|
300
|
-
const at = spec.lastIndexOf('@');
|
|
301
|
-
if (at <= 0) return { name: spec, version: '' };
|
|
302
|
-
return { name: spec.slice(0, at), version: spec.slice(at + 1) };
|
|
303
|
-
});
|
|
304
|
-
const targets = parsed.map(p => p.name);
|
|
305
|
-
const before = new Map<string, string | null>();
|
|
306
|
-
for (const p of targets) before.set(p, getInstalledVersion(p));
|
|
307
|
-
|
|
308
|
-
// 用 targetsWithVersion 直接拼命令 - 包含具体版本号, 不会被本地约束拦截
|
|
309
|
-
const args = ['npm', 'install', '-g', ...packagesWithVersion];
|
|
310
|
-
|
|
311
|
-
log(`\n${CYAN}📦 正在更新包...${RESET}\n`, RESET);
|
|
312
|
-
|
|
313
|
-
try {
|
|
314
|
-
execSync(args.join(' '), {
|
|
315
|
-
encoding: 'utf-8',
|
|
316
|
-
timeout: 300000,
|
|
317
|
-
stdio: 'inherit',
|
|
318
|
-
cwd: process.cwd()
|
|
319
|
-
});
|
|
320
|
-
} catch (e: any) {
|
|
321
|
-
return {
|
|
322
|
-
success: false,
|
|
323
|
-
updated: false,
|
|
324
|
-
message: '更新失败',
|
|
325
|
-
error: e.message
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// install 退出码 0 并不等于"真的升上去了" ("up to date" 也是 0)。
|
|
330
|
-
// 重新读取磁盘版本, 只有真的达到 latest 之一才算 updated。
|
|
331
|
-
const upgraded: string[] = [];
|
|
332
|
-
for (const p of parsed) {
|
|
333
|
-
const after = getInstalledVersion(p.name);
|
|
334
|
-
const was = before.get(p.name);
|
|
335
|
-
if (after && was && compareVersions(was, after) < 0) {
|
|
336
|
-
upgraded.push(p.name);
|
|
337
|
-
}
|
|
338
|
-
// 版本没变 = npm 仍判 up to date; 不当成功
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
if (upgraded.length > 0) {
|
|
342
|
-
return {
|
|
343
|
-
success: true,
|
|
344
|
-
updated: true,
|
|
345
|
-
message: `已更新: ${upgraded.join(', ')}`,
|
|
346
|
-
updatedPackages: upgraded
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
return {
|
|
350
|
-
success: true,
|
|
351
|
-
updated: false,
|
|
352
|
-
message: '已是最新版本,无需重启',
|
|
353
|
-
updatedPackages: []
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* 检查并自动更新(启动时调用)
|
|
359
|
-
*/
|
|
360
|
-
export async function checkAndUpdate(): Promise<{
|
|
361
|
-
hasUpdate: boolean;
|
|
362
|
-
info: PackageInfo | null;
|
|
363
|
-
updated: boolean;
|
|
364
|
-
message: string;
|
|
365
|
-
}> {
|
|
366
|
-
// opt-in: 默认跳过更新检查. 想允许必须显式提供以下任一标志:
|
|
367
|
-
// --update-check, --update-now, --allow-update
|
|
368
|
-
// BOLLOON_AUTO_UPDATE=1
|
|
369
|
-
const allowFlag = process.argv.includes('--update-check')
|
|
370
|
-
|| process.argv.includes('--update-now')
|
|
371
|
-
|| process.argv.includes('--allow-update');
|
|
372
|
-
const allowEnv = process.env.BOLLOON_AUTO_UPDATE === '1';
|
|
373
|
-
if (!allowFlag && !allowEnv) {
|
|
374
|
-
return { hasUpdate: false, info: null, updated: false, message: '跳过更新检查 (默认关闭, 用 --update-check 显式触发)' };
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// 显式屏蔽仍然优先
|
|
378
|
-
if (process.argv.includes('--no-update') || process.argv.includes('--skip-update')) {
|
|
379
|
-
return { hasUpdate: false, info: null, updated: false, message: '跳过更新检查' };
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
if (process.env.BOLLOON_SKIP_UPDATE === 'true') {
|
|
383
|
-
return { hasUpdate: false, info: null, updated: false, message: '跳过更新检查(环境变量)' };
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
log(`\n${CYAN}🔍 检查更新...${RESET}`, RESET);
|
|
387
|
-
|
|
388
|
-
try {
|
|
389
|
-
// 检查 @bolloon 包的更新
|
|
390
|
-
const bolloonInfo = await checkBolloonUpdates();
|
|
391
|
-
|
|
392
|
-
if (bolloonInfo && bolloonInfo.outdated) {
|
|
393
|
-
log(`\n${YELLOW}⚠️ 发现新版本: ${bolloonInfo.latest}${RESET}\n`, RESET);
|
|
394
|
-
log(` 当前版本: ${bolloonInfo.version}\n`, RESET);
|
|
395
|
-
log(` 最新版本: ${bolloonInfo.latest}\n\n`, RESET);
|
|
396
|
-
|
|
397
|
-
// 自动更新
|
|
398
|
-
// 关键: 把目标版本号也传过去, 否则 `npm install -g @bolloon/bolloon-agent`
|
|
399
|
-
// 会按本地 package.json 的 "^0.1.17" 约束去判断, 永远装不上去
|
|
400
|
-
const targetsWithVersion = bolloonInfo.packages.map(p => `${p.name}@${p.latest}`);
|
|
401
|
-
const result = await updatePackagesWithVersion(targetsWithVersion);
|
|
402
|
-
|
|
403
|
-
if (result.success) {
|
|
404
|
-
log(`\n${GREEN}✅ 更新成功!请重新启动应用${RESET}\n`, RESET);
|
|
405
|
-
|
|
406
|
-
// 提示用户重启
|
|
407
|
-
log(`${YELLOW}💡 请重新运行 bolloon 以使用新版本${RESET}\n\n`, RESET);
|
|
408
|
-
|
|
409
|
-
// 通知主进程更新完成
|
|
410
|
-
process.emit('bolloon-update-complete', result);
|
|
411
|
-
|
|
412
|
-
return {
|
|
413
|
-
hasUpdate: true,
|
|
414
|
-
info: bolloonInfo,
|
|
415
|
-
updated: true,
|
|
416
|
-
message: `已更新到 ${bolloonInfo.latest}`
|
|
417
|
-
};
|
|
418
|
-
} else {
|
|
419
|
-
return {
|
|
420
|
-
hasUpdate: true,
|
|
421
|
-
info: bolloonInfo,
|
|
422
|
-
updated: false,
|
|
423
|
-
message: `更新失败: ${result.error}`
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
} else {
|
|
427
|
-
log(` ${GREEN}✓${RESET} 已是最新版本 (${bolloonInfo?.version || 'unknown'})\n`, RESET);
|
|
428
|
-
return {
|
|
429
|
-
hasUpdate: false,
|
|
430
|
-
info: bolloonInfo,
|
|
431
|
-
updated: false,
|
|
432
|
-
message: '已是最新版本'
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
} catch (e: any) {
|
|
436
|
-
log(` ${YELLOW}⚠${RESET} 更新检查失败: ${e.message}\n`, RESET);
|
|
437
|
-
return {
|
|
438
|
-
hasUpdate: false,
|
|
439
|
-
info: null,
|
|
440
|
-
updated: false,
|
|
441
|
-
message: `检查失败: ${e.message}`
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* 仅检查更新,不自动安装
|
|
448
|
-
*/
|
|
449
|
-
export async function checkForUpdates(): Promise<PackageInfo | null> {
|
|
450
|
-
return await checkBolloonUpdates();
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* 手动触发更新
|
|
455
|
-
*/
|
|
456
|
-
export async function performUpdate(packages?: string[]): Promise<UpdateResult> {
|
|
457
|
-
return await updatePackages(packages);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
// CLI 入口
|
|
461
|
-
if (process.argv[1]?.includes('auto-update')) {
|
|
462
|
-
(async () => {
|
|
463
|
-
const command = process.argv[2];
|
|
464
|
-
|
|
465
|
-
switch (command) {
|
|
466
|
-
case 'check':
|
|
467
|
-
const info = await checkForUpdates();
|
|
468
|
-
if (info) {
|
|
469
|
-
console.log(JSON.stringify(info, null, 2));
|
|
470
|
-
}
|
|
471
|
-
break;
|
|
472
|
-
|
|
473
|
-
case 'update':
|
|
474
|
-
const result = await performUpdate(process.argv.slice(3));
|
|
475
|
-
console.log(JSON.stringify(result, null, 2));
|
|
476
|
-
break;
|
|
477
|
-
|
|
478
|
-
default:
|
|
479
|
-
await checkAndUpdate();
|
|
480
|
-
}
|
|
481
|
-
})();
|
|
482
|
-
}
|
package/src/utils/clamp.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* agent-delegate-server - 把 manifest + agent_delegate 协议挂到 Web API
|
|
3
|
-
*
|
|
4
|
-
* 启动: PORT=54189 npx tsx src/web/agent-delegate-server.ts
|
|
5
|
-
*
|
|
6
|
-
* 提供:
|
|
7
|
-
* GET /api/agent/local-manifest — 本节点智能体清单
|
|
8
|
-
* POST /api/agent/register — 注册/更新本节点智能体
|
|
9
|
-
* GET /api/agent/remote-manifests — 缓存的远端 manifest 列表
|
|
10
|
-
* POST /api/agent/pick — 按 capability + 可选 ownerPublicKey 选 agent
|
|
11
|
-
* POST /api/agent/delegate — DOC 驱动委派 (转发到对端 agent)
|
|
12
|
-
*
|
|
13
|
-
* 该模块不直接绑 Hyperswarm — 通过注入的 transport 抽象:
|
|
14
|
-
* - sendToNode(nodeId, frame) -> Promise<responseFrame>
|
|
15
|
-
*
|
|
16
|
-
* 主进程接入时把 Hyperswarm 拨号逻辑包成 transport 注入。
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import express from 'express';
|
|
20
|
-
import {
|
|
21
|
-
buildAgentDelegateRequest, buildAgentResponse, buildManifestPayload, buildManifestRequest,
|
|
22
|
-
parseFrame, setLocalManifest, addLocalAgent, getLocalManifest, getRemoteManifests,
|
|
23
|
-
cacheRemoteManifest, pickAgent, type AgentManifestEntry, type AgentManifest,
|
|
24
|
-
} from '../agents/agent-manifest-protocol.js';
|
|
25
|
-
|
|
26
|
-
export interface DelegateTransport {
|
|
27
|
-
/** 发送 frame 到指定节点公钥, 等待回包. null 表示不实现 (同步返回占位) */
|
|
28
|
-
sendToNode(publicKey: string, frame: string, timeoutMs?: number): Promise<string | null>;
|
|
29
|
-
/** 注册 onMessage: 对方 manifest_request 来了, 我方要回 manifest_payload */
|
|
30
|
-
onIncomingFrame(handler: (fromPublicKey: string, frame: string) => Promise<string | null>): void;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function createAgentDelegateApp(transport: DelegateTransport): express.Express {
|
|
34
|
-
const app = express();
|
|
35
|
-
app.use(express.json({ limit: '2mb' }));
|
|
36
|
-
|
|
37
|
-
// ---- 本地 manifest ----
|
|
38
|
-
app.get('/api/agent/local-manifest', (_req, res) => {
|
|
39
|
-
res.json(getLocalManifest());
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
app.post('/api/agent/register', (req, res) => {
|
|
43
|
-
const body = req.body as { agents: AgentManifestEntry[]; ownerName?: string; ownerPublicKey?: string };
|
|
44
|
-
if (!body.agents || !Array.isArray(body.agents)) {
|
|
45
|
-
return res.status(400).json({ error: 'agents array required' });
|
|
46
|
-
}
|
|
47
|
-
setLocalManifest({
|
|
48
|
-
ownerName: body.ownerName || getLocalManifest().ownerName || 'unknown',
|
|
49
|
-
ownerPublicKey: body.ownerPublicKey || getLocalManifest().ownerPublicKey || '',
|
|
50
|
-
agents: body.agents,
|
|
51
|
-
});
|
|
52
|
-
res.json({ ok: true, manifest: getLocalManifest() });
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// ---- 远端 manifest 列表 ----
|
|
56
|
-
app.get('/api/agent/remote-manifests', (_req, res) => {
|
|
57
|
-
res.json({ count: getRemoteManifests().length, manifests: getRemoteManifests() });
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// ---- 按 capability 选 agent ----
|
|
61
|
-
app.post('/api/agent/pick', (req, res) => {
|
|
62
|
-
const { capability, ownerPublicKey } = req.body as { capability: string; ownerPublicKey?: string };
|
|
63
|
-
if (!capability) return res.status(400).json({ error: 'capability required' });
|
|
64
|
-
const picked = pickAgent(capability, ownerPublicKey);
|
|
65
|
-
if (!picked) return res.status(404).json({ error: 'no matching agent', capability });
|
|
66
|
-
res.json({ ok: true, agent: picked.agent, owner: { name: picked.owner.ownerName, publicKey: picked.owner.ownerPublicKey } });
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// ---- DOC 驱动委派 ----
|
|
70
|
-
app.post('/api/agent/delegate', async (req, res) => {
|
|
71
|
-
try {
|
|
72
|
-
const { toPublicKey, capability, docPath, docContent, instruction, fromAgentId } = req.body as {
|
|
73
|
-
toPublicKey: string;
|
|
74
|
-
capability: string;
|
|
75
|
-
docPath?: string;
|
|
76
|
-
docContent?: string;
|
|
77
|
-
instruction: string;
|
|
78
|
-
fromAgentId?: string;
|
|
79
|
-
};
|
|
80
|
-
if (!toPublicKey || !capability || !instruction) {
|
|
81
|
-
return res.status(400).json({ error: 'toPublicKey, capability, instruction required' });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// 1) 优先从已缓存的远端 manifest 里选 agent
|
|
85
|
-
let targetAgent: AgentManifestEntry | null = null;
|
|
86
|
-
const remote = getRemoteManifests().find((m) => m.ownerPublicKey === toPublicKey || m.ownerPublicKey.startsWith(toPublicKey.substring(0, 16)));
|
|
87
|
-
if (remote) {
|
|
88
|
-
targetAgent = remote.agents.find((a) => a.capabilities.includes(capability) && a.status === 'active') || null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// 2) 构造 frame, 通过 transport 发送
|
|
92
|
-
const frame = buildAgentDelegateRequest({
|
|
93
|
-
capability,
|
|
94
|
-
docPath,
|
|
95
|
-
docContent,
|
|
96
|
-
instruction,
|
|
97
|
-
fromAgentId: fromAgentId || 'local-user',
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const replyFrame = await transport.sendToNode(toPublicKey, frame, 30000);
|
|
101
|
-
if (!replyFrame) {
|
|
102
|
-
return res.status(504).json({ error: 'no response from peer (timeout or transport not wired)' });
|
|
103
|
-
}
|
|
104
|
-
const f = parseFrame(replyFrame);
|
|
105
|
-
if (!f || f.type !== 'agent_response') {
|
|
106
|
-
return res.status(502).json({ error: 'bad response', frame: replyFrame });
|
|
107
|
-
}
|
|
108
|
-
res.json({
|
|
109
|
-
ok: true,
|
|
110
|
-
targetAgent: targetAgent || { id: f.payload.delegatedTo, capabilities: [capability], status: 'active', name: f.payload.delegatedTo },
|
|
111
|
-
response: f.payload,
|
|
112
|
-
});
|
|
113
|
-
} catch (e: any) {
|
|
114
|
-
res.status(500).json({ error: e.message });
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// ---- 接收对方 manifest_request / agent_delegate 处理 ----
|
|
119
|
-
// 业务端需要把对端来的入站 frame 转给本 handler
|
|
120
|
-
// 简化: 把 handler 挂到 transport.onIncomingFrame
|
|
121
|
-
transport.onIncomingFrame(async (fromPublicKey, frame) => {
|
|
122
|
-
const f = parseFrame(frame);
|
|
123
|
-
if (!f) return null;
|
|
124
|
-
if (f.type === 'manifest_request') {
|
|
125
|
-
return buildManifestPayload(getLocalManifest());
|
|
126
|
-
}
|
|
127
|
-
if (f.type === 'manifest_payload') {
|
|
128
|
-
cacheRemoteManifest(f.payload as AgentManifest);
|
|
129
|
-
return null; // 不需要回包
|
|
130
|
-
}
|
|
131
|
-
if (f.type === 'agent_delegate') {
|
|
132
|
-
// 路由到本地匹配 agent
|
|
133
|
-
const req = f.payload as any;
|
|
134
|
-
const local = getLocalManifest();
|
|
135
|
-
const target = local.agents.find((a) => a.capabilities.includes(req.capability) && a.status === 'active') || local.agents[0];
|
|
136
|
-
if (!target) return buildAgentResponse({ ok: false, delegatedTo: 'none', summary: 'no local agent available' });
|
|
137
|
-
return buildAgentResponse({
|
|
138
|
-
ok: true,
|
|
139
|
-
delegatedTo: target.id,
|
|
140
|
-
resultCid: `mock-${Date.now()}`,
|
|
141
|
-
summary: `[${target.name}] 已处理任务: ${req.instruction?.substring(0, 30)}`,
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
return null;
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
return app;
|
|
148
|
-
}
|