@bolloon/bolloon-agent 0.1.35 → 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/README.md +1 -1
- package/dist/agents/p2p-chat-tools.js +6 -6
- package/dist/agents/permission-mode.js +115 -0
- package/dist/agents/pi-sdk.js +435 -25
- package/dist/agents/pre-tool-validator.js +194 -0
- package/dist/agents/workflow-pivot-loop.js +113 -12
- package/dist/bollharness-integration/context-router.js +2 -2
- package/dist/bollharness-integration/guard-checker.js +1 -1
- package/dist/bootstrap/bootstrap.js +3 -0
- package/dist/bootstrap/context-collector.js +17 -1
- package/dist/bootstrap/context-hierarchy.js +218 -0
- package/dist/bootstrap/lifecycle-hooks.js +86 -24
- package/dist/bootstrap/project-context.js +10 -3
- package/dist/context-compaction/auto-compact.js +144 -0
- package/dist/context-compaction/budget-gate.js +28 -0
- package/dist/context-compaction/budget-reduce.js +35 -0
- package/dist/context-compaction/context-collapse.js +66 -0
- package/dist/context-compaction/index.js +21 -0
- package/dist/context-compaction/microcompact.js +51 -0
- package/dist/context-compaction/pipeline.js +123 -0
- package/dist/context-compaction/snip.js +45 -0
- package/dist/context-compaction/token-estimator.js +35 -0
- package/dist/context-compaction/types.js +19 -0
- package/dist/heartbeat/HealthMonitor.js +3 -2
- package/dist/index.js +38 -2
- package/dist/llm/llm-judgment-client.js +32 -30
- package/dist/llm/pi-ai.js +103 -16
- package/dist/llm/system-prompt/health.js +129 -0
- package/dist/llm/system-prompt/registry.js +246 -0
- package/dist/llm/system-prompt/strip-hibsml.js +51 -0
- package/dist/llm/tool-manifest/ask_user_input.js +35 -0
- package/dist/llm/tool-manifest/bash.js +23 -0
- package/dist/llm/tool-manifest/create_file.js +24 -0
- package/dist/llm/tool-manifest/fetch_sports_data.js +26 -0
- package/dist/llm/tool-manifest/image_search.js +24 -0
- package/dist/llm/tool-manifest/index.js +69 -0
- package/dist/llm/tool-manifest/mcp.js +43 -0
- package/dist/llm/tool-manifest/message_compose.js +31 -0
- package/dist/llm/tool-manifest/places.js +83 -0
- package/dist/llm/tool-manifest/present_files.js +21 -0
- package/dist/llm/tool-manifest/recipe.js +40 -0
- package/dist/llm/tool-manifest/recommend_apps.js +23 -0
- package/dist/llm/tool-manifest/str_replace.js +27 -0
- package/dist/llm/tool-manifest/types.js +7 -0
- package/dist/llm/tool-manifest/view.js +24 -0
- package/dist/llm/tool-manifest/weather.js +27 -0
- package/dist/llm/tool-manifest/web.js +51 -0
- package/dist/network/p2p-direct.js +23 -0
- package/dist/network/source-intent-broadcaster.js +203 -0
- package/dist/network/source-intent.js +100 -0
- package/dist/pi-ecosystem-judgment/adaptive-scan.js +48 -0
- package/dist/pi-ecosystem-judgment/injection-gate.js +54 -12
- package/dist/pi-ecosystem-judgment/value-injection.js +8 -2
- package/dist/security/context-router-tool.js +1 -1
- package/dist/security/input-scanner.js +223 -0
- package/dist/web/client.js +3089 -4458
- package/dist/web/index.html +58 -67
- package/dist/web/server.js +299 -117
- package/dist/web/style.css +531 -249
- package/dist/web/ui/message-renderer.js +352 -0
- package/dist/web/ui/step-timeline.js +279 -0
- package/package.json +2 -2
- package/.auto-evolve-calls +0 -1
- package/.last-auto-evolve-baseline +0 -1
- package/Bolloon.md +0 -103
- 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 -29
- package/scripts/auto-evolve-loop.ts +0 -376
- 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 -82
- package/scripts/detect-schema-changes.sh +0 -48
- package/scripts/diff-reviewer.ts +0 -159
- package/scripts/postinstall.js +0 -153
- 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/pi-sdk.ts +0 -2462
- 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 -675
- 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 -132
- package/src/bootstrap/context-collector.ts +0 -342
- package/src/bootstrap/lifecycle-hooks.ts +0 -176
- package/src/bootstrap/project-context.ts +0 -163
- package/src/cli/interface.ts +0 -211
- package/src/cli-entry.ts +0 -304
- package/src/constraints/index.ts +0 -6
- 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 -316
- 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 -1690
- 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 -470
- package/src/llm/pi-ai.ts +0 -558
- 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 -240
- package/src/network/p2p-secret.ts +0 -153
- package/src/network/p2p.ts +0 -964
- 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/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 -4898
- 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 -382
- package/src/web/iroh-delegate-transport.ts +0 -139
- package/src/web/manifest.json +0 -21
- package/src/web/server.ts +0 -5571
- package/src/web/style.css +0 -4455
- 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/tsconfig.cli.json +0 -16
- package/tsconfig.electron.json +0 -20
- package/tsconfig.json +0 -18
package/scripts/postinstall.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Postinstall 脚本
|
|
3
|
-
* npm 安装后自动执行
|
|
4
|
-
*
|
|
5
|
-
* 主要任务:
|
|
6
|
-
* 1. 确保 bin 目录存在且可执行
|
|
7
|
-
* 2. 初始化本地配置
|
|
8
|
-
* 3. 检查依赖完整性
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import * as fs from 'fs';
|
|
12
|
-
import * as path from 'path';
|
|
13
|
-
import { fileURLToPath } from 'url';
|
|
14
|
-
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
const __dirname = path.dirname(__filename);
|
|
17
|
-
const rootDir = path.join(__dirname, '..');
|
|
18
|
-
|
|
19
|
-
const RESET = '\x1b[0m';
|
|
20
|
-
const GREEN = '\x1b[32m';
|
|
21
|
-
const YELLOW = '\x1b[33m';
|
|
22
|
-
const CYAN = '\x1b[36m';
|
|
23
|
-
|
|
24
|
-
function log(msg, color = RESET) {
|
|
25
|
-
console.log(color + msg + RESET);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function initUserDirs() {
|
|
29
|
-
// 创建用户数据目录
|
|
30
|
-
const home = process.env.HOME || process.env.USERPROFILE || '/tmp';
|
|
31
|
-
const bolloonDir = path.join(home, '.bolloon');
|
|
32
|
-
|
|
33
|
-
const dirs = [
|
|
34
|
-
bolloonDir,
|
|
35
|
-
path.join(bolloonDir, 'sessions'),
|
|
36
|
-
path.join(bolloonDir, 'peer-store'),
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
for (const dir of dirs) {
|
|
40
|
-
if (!fs.existsSync(dir)) {
|
|
41
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
42
|
-
log(` ✓ 创建目录: ${dir}`, GREEN);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// 初始化配置文件
|
|
47
|
-
const configPath = path.join(bolloonDir, 'config.json');
|
|
48
|
-
if (!fs.existsSync(configPath)) {
|
|
49
|
-
const defaultConfig = {
|
|
50
|
-
version: '0.1.12',
|
|
51
|
-
initializedAt: new Date().toISOString(),
|
|
52
|
-
defaults: {
|
|
53
|
-
port: 54188,
|
|
54
|
-
theme: 'dark',
|
|
55
|
-
autoConnect: true,
|
|
56
|
-
},
|
|
57
|
-
providers: {
|
|
58
|
-
minimax: { enabled: false },
|
|
59
|
-
openai: { enabled: false },
|
|
60
|
-
anthropic: { enabled: false },
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2));
|
|
64
|
-
log(` ✓ 创建配置: ${configPath}`, GREEN);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return bolloonDir;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function checkNativeDeps() {
|
|
71
|
-
// 检查必要的原生依赖
|
|
72
|
-
const nativeDeps = [
|
|
73
|
-
'libp2p',
|
|
74
|
-
'@diap/sdk',
|
|
75
|
-
];
|
|
76
|
-
|
|
77
|
-
let allOk = true;
|
|
78
|
-
|
|
79
|
-
for (const dep of nativeDeps) {
|
|
80
|
-
const depPath = path.join(rootDir, 'node_modules', dep);
|
|
81
|
-
if (!fs.existsSync(depPath)) {
|
|
82
|
-
log(` ⚠ 缺少依赖: ${dep}`, YELLOW);
|
|
83
|
-
allOk = false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return allOk;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function setupPlatform() {
|
|
91
|
-
const platform = process.platform;
|
|
92
|
-
|
|
93
|
-
log(`\n 平台: ${platform}`, CYAN);
|
|
94
|
-
|
|
95
|
-
if (platform === 'win32') {
|
|
96
|
-
// Windows: 确保 .cmd 文件存在
|
|
97
|
-
const binDir = path.join(rootDir, 'bin');
|
|
98
|
-
const cmdPath = path.join(binDir, 'bolloon.cmd');
|
|
99
|
-
|
|
100
|
-
if (fs.existsSync(binDir) && !fs.existsSync(cmdPath)) {
|
|
101
|
-
const cmdContent = `@echo off
|
|
102
|
-
node "%~dp0..\\dist\\cli.js" %*
|
|
103
|
-
`;
|
|
104
|
-
fs.writeFileSync(cmdPath, cmdContent);
|
|
105
|
-
log(' ✓ Windows 入口已创建', GREEN);
|
|
106
|
-
}
|
|
107
|
-
} else {
|
|
108
|
-
// Unix/Linux/Mac: 确保 bin 文件可执行
|
|
109
|
-
const binDir = path.join(rootDir, 'bin');
|
|
110
|
-
const binPath = path.join(binDir, 'bolloon.js');
|
|
111
|
-
|
|
112
|
-
if (fs.existsSync(binPath)) {
|
|
113
|
-
try {
|
|
114
|
-
fs.chmodSync(binPath, 0o755);
|
|
115
|
-
log(' ✓ bin/bolloon.js 已设为可执行', GREEN);
|
|
116
|
-
} catch (err) {
|
|
117
|
-
log(` ⚠ 无法设置执行权限: ${err.message}`, YELLOW);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function main() {
|
|
124
|
-
console.log('\n📦 Bolloon 安装后处理...\n');
|
|
125
|
-
|
|
126
|
-
try {
|
|
127
|
-
// 1. 初始化用户目录
|
|
128
|
-
const bolloonDir = initUserDirs();
|
|
129
|
-
log(` ✓ 用户数据目录: ${bolloonDir}`, GREEN);
|
|
130
|
-
|
|
131
|
-
// 2. 检查依赖
|
|
132
|
-
const depsOk = checkNativeDeps();
|
|
133
|
-
if (!depsOk) {
|
|
134
|
-
log('\n ⚠ 部分依赖缺失,建议运行: npm install', YELLOW);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// 3. 平台特定设置
|
|
138
|
-
setupPlatform();
|
|
139
|
-
|
|
140
|
-
console.log('\n✅ 安装完成!\n');
|
|
141
|
-
console.log(' 使用方式:');
|
|
142
|
-
console.log(' bolloon # 启动 GUI');
|
|
143
|
-
console.log(' bolloon --web # 启动 Web UI');
|
|
144
|
-
console.log(' bolloon --cli # 命令行模式');
|
|
145
|
-
console.log(' bolloon --help # 显示帮助\n');
|
|
146
|
-
console.log(` 配置文件: ${path.join(bolloonDir, 'config.json')}\n`);
|
|
147
|
-
} catch (err) {
|
|
148
|
-
console.error('\n❌ 安装后处理失败:', err.message);
|
|
149
|
-
console.error(' 这通常不影响基本功能,继续安装...\n');
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
main();
|
package/scripts/weekly-report.ts
DELETED
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env tsx
|
|
2
|
-
/**
|
|
3
|
-
* weekly-report.ts — Bolloon 每周表现报告 (阶段 B)
|
|
4
|
-
*
|
|
5
|
-
* 输入:
|
|
6
|
-
* ~/.bolloon/human-values/evolution.jsonl (接受/拒绝/回滚事件)
|
|
7
|
-
* ~/.bolloon/human-values/usage.jsonl (judgment 使用记录)
|
|
8
|
-
* ~/.bolloon/human-values/counterfactual-audit.jsonl (反事实审计)
|
|
9
|
-
* ~/.bolloon/human-values/judgments.json (当前 judgment 库)
|
|
10
|
-
* ~/.bolloon/self-improve-audit.log (改源码尝试的审计, 即使被拒)
|
|
11
|
-
*
|
|
12
|
-
* 输出:
|
|
13
|
-
* ~/.bolloon/reports/2026-W24.md (markdown 报告)
|
|
14
|
-
*
|
|
15
|
-
* 设计原则:
|
|
16
|
-
* - 纯本地计算 + 纯函数式分析 (不调 LLM, 避免幻觉)
|
|
17
|
-
* - 周范围默认 ISO 周(周一为起点), 可 --week 2026-W24 指定
|
|
18
|
-
* - 不写 judgments.json, 不动 persona, 仅追加 reports/*.md
|
|
19
|
-
* - 失败静默 + 退出码 != 0 让 cron 知道坏了
|
|
20
|
-
*
|
|
21
|
-
* 用法:
|
|
22
|
-
* tsx scripts/weekly-report.ts # 生成上周
|
|
23
|
-
* tsx scripts/weekly-report.ts --week 2026-W24 # 指定周
|
|
24
|
-
* tsx scripts/weekly-report.ts --week 2026-W24 --dry-run
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
import * as fs from 'fs/promises';
|
|
28
|
-
import * as os from 'os';
|
|
29
|
-
import * as path from 'path';
|
|
30
|
-
|
|
31
|
-
const HOME = () => os.homedir() || process.env.HOME || '/tmp';
|
|
32
|
-
const ROOT = () => HOME() + '/.bolloon';
|
|
33
|
-
const REPORTS_DIR = () => ROOT() + '/reports';
|
|
34
|
-
|
|
35
|
-
const FILES = {
|
|
36
|
-
evolution: () => ROOT() + '/human-values/evolution.jsonl',
|
|
37
|
-
usage: () => ROOT() + '/human-values/usage.jsonl',
|
|
38
|
-
counterfactual: () => ROOT() + '/human-values/counterfactual-audit.jsonl',
|
|
39
|
-
judgments: () => ROOT() + '/human-values/judgments.json',
|
|
40
|
-
selfImproveAudit: () => ROOT() + '/self-improve-audit.log',
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
interface EvolutionEntry {
|
|
44
|
-
ts: string;
|
|
45
|
-
action: 'accept' | 'reject' | 'revert';
|
|
46
|
-
suggestion: { kind: string; judgmentId: string; action: string };
|
|
47
|
-
appliedPatch?: Record<string, unknown>;
|
|
48
|
-
}
|
|
49
|
-
interface UsageEntry {
|
|
50
|
-
ts: string;
|
|
51
|
-
channelId: string | null;
|
|
52
|
-
userInputPreview: string;
|
|
53
|
-
usedIds: string[];
|
|
54
|
-
}
|
|
55
|
-
interface CounterfactualEntry {
|
|
56
|
-
ts: string;
|
|
57
|
-
trigger: { userInput: string; aiReply: string; violatedPrinciples: unknown[] };
|
|
58
|
-
verdict: string;
|
|
59
|
-
recomendaciones?: string[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function readJsonl<T>(p: string): Promise<T[]> {
|
|
63
|
-
try {
|
|
64
|
-
const content = await fs.readFile(p, 'utf-8');
|
|
65
|
-
return content
|
|
66
|
-
.trim()
|
|
67
|
-
.split('\n')
|
|
68
|
-
.filter(Boolean)
|
|
69
|
-
.map((l) => {
|
|
70
|
-
try {
|
|
71
|
-
return JSON.parse(l) as T;
|
|
72
|
-
} catch {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
.filter((e): e is T => Boolean(e));
|
|
77
|
-
} catch {
|
|
78
|
-
return [];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async function readJson<T>(p: string): Promise<T | null> {
|
|
83
|
-
try {
|
|
84
|
-
return JSON.parse(await fs.readFile(p, 'utf-8')) as T;
|
|
85
|
-
} catch {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function isoWeekString(d: Date): string {
|
|
91
|
-
// ISO week: 1 = 包含 1 月 4 日的那周
|
|
92
|
-
const target = new Date(d.valueOf());
|
|
93
|
-
const dayNr = (d.getUTCDay() + 6) % 7; // 周一=0
|
|
94
|
-
target.setUTCDate(target.getUTCDate() - dayNr + 3);
|
|
95
|
-
const firstThursday = new Date(Date.UTC(target.getUTCFullYear(), 0, 4));
|
|
96
|
-
const week =
|
|
97
|
-
1 +
|
|
98
|
-
Math.round(
|
|
99
|
-
((target.valueOf() - firstThursday.valueOf()) / 86400000 - 3 + ((firstThursday.getUTCDay() + 6) % 7)) / 7
|
|
100
|
-
);
|
|
101
|
-
return `${target.getUTCFullYear()}-W${String(week).padStart(2, '0')}`;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function weekRange(iso: string): { start: Date; end: Date } {
|
|
105
|
-
const m = /^(\d{4})-W(\d{1,2})$/.exec(iso);
|
|
106
|
-
if (!m) throw new Error(`bad ISO week: ${iso}`);
|
|
107
|
-
const year = Number(m[1]);
|
|
108
|
-
const week = Number(m[2]);
|
|
109
|
-
// ISO 周 1 是包含 1 月 4 日的那周
|
|
110
|
-
const jan4 = new Date(Date.UTC(year, 0, 4));
|
|
111
|
-
const jan4Day = (jan4.getUTCDay() + 6) % 7; // 周一=0
|
|
112
|
-
const week1Mon = new Date(jan4);
|
|
113
|
-
week1Mon.setUTCDate(jan4.getUTCDate() - jan4Day);
|
|
114
|
-
const start = new Date(week1Mon);
|
|
115
|
-
start.setUTCDate(week1Mon.getUTCDate() + (week - 1) * 7);
|
|
116
|
-
const end = new Date(start);
|
|
117
|
-
end.setUTCDate(start.getUTCDate() + 7);
|
|
118
|
-
return { start, end };
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function inWeek(ts: string, start: Date, end: Date): boolean {
|
|
122
|
-
const t = new Date(ts).getTime();
|
|
123
|
-
return t >= start.getTime() && t < end.getTime();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function pct(n: number, d: number): string {
|
|
127
|
-
if (d === 0) return 'n/a';
|
|
128
|
-
return `${((n / d) * 100).toFixed(1)}%`;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function topN<T>(arr: T[], key: (x: T) => string, n: number): Array<[string, number]> {
|
|
132
|
-
const m = new Map<string, number>();
|
|
133
|
-
for (const x of arr) {
|
|
134
|
-
const k = key(x);
|
|
135
|
-
m.set(k, (m.get(k) || 0) + 1);
|
|
136
|
-
}
|
|
137
|
-
return Array.from(m.entries())
|
|
138
|
-
.sort((a, b) => b[1] - a[1])
|
|
139
|
-
.slice(0, n);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
interface Report {
|
|
143
|
-
week: string;
|
|
144
|
-
range: { start: string; end: string };
|
|
145
|
-
generatedAt: string;
|
|
146
|
-
summary: {
|
|
147
|
-
totalUsage: number;
|
|
148
|
-
uniqueChannels: number;
|
|
149
|
-
uniqueJudgments: number;
|
|
150
|
-
evolutionEvents: number;
|
|
151
|
-
acceptRate: number;
|
|
152
|
-
rejected: number;
|
|
153
|
-
reverted: number;
|
|
154
|
-
counterfactualScans: number;
|
|
155
|
-
};
|
|
156
|
-
topJudgments: Array<[string, number]>;
|
|
157
|
-
topKinds: Array<[string, number]>;
|
|
158
|
-
policyAudit: {
|
|
159
|
-
selfImproveAttempts: number;
|
|
160
|
-
blockedByPolicy: number;
|
|
161
|
-
note: string;
|
|
162
|
-
};
|
|
163
|
-
openQuestions: string[];
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
async function buildReport(weekIso: string): Promise<Report> {
|
|
167
|
-
const { start, end } = weekRange(weekIso);
|
|
168
|
-
|
|
169
|
-
const [evolution, usage, counterfactual, judgments, audit] = await Promise.all([
|
|
170
|
-
readJsonl<EvolutionEntry>(FILES.evolution()),
|
|
171
|
-
readJsonl<UsageEntry>(FILES.usage()),
|
|
172
|
-
readJsonl<CounterfactualEntry>(FILES.counterfactual()),
|
|
173
|
-
readJson<unknown[]>(FILES.judgments()),
|
|
174
|
-
(async () => {
|
|
175
|
-
try {
|
|
176
|
-
const txt = await fs.readFile(FILES.selfImproveAudit(), 'utf-8');
|
|
177
|
-
return txt.split('\n').filter(Boolean);
|
|
178
|
-
} catch {
|
|
179
|
-
return [];
|
|
180
|
-
}
|
|
181
|
-
})(),
|
|
182
|
-
]);
|
|
183
|
-
|
|
184
|
-
const evoInWeek = evolution.filter((e) => inWeek(e.ts, start, end));
|
|
185
|
-
const useInWeek = usage.filter((u) => inWeek(u.ts, start, end));
|
|
186
|
-
const cfInWeek = counterfactual.filter((c) => inWeek(c.ts, start, end));
|
|
187
|
-
const auditInWeek = audit.filter((line) => {
|
|
188
|
-
// audit 是日志行, 格式不一定, 简单按日期前缀过滤
|
|
189
|
-
const d = line.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
190
|
-
if (!d) return false;
|
|
191
|
-
const ts = new Date(d[1] + 'T00:00:00Z').getTime();
|
|
192
|
-
return ts >= start.getTime() && ts < end.getTime();
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
const totalUsage = useInWeek.length;
|
|
196
|
-
const channels = new Set(useInWeek.map((u) => u.channelId || 'null'));
|
|
197
|
-
const ids = new Set<string>();
|
|
198
|
-
for (const u of useInWeek) for (const id of u.usedIds) ids.add(id);
|
|
199
|
-
|
|
200
|
-
const accepts = evoInWeek.filter((e) => e.action === 'accept').length;
|
|
201
|
-
const rejects = evoInWeek.filter((e) => e.action === 'reject').length;
|
|
202
|
-
const reverts = evoInWeek.filter((e) => e.action === 'revert').length;
|
|
203
|
-
const acceptRate = accepts + rejects === 0 ? 0 : accepts / (accepts + rejects);
|
|
204
|
-
|
|
205
|
-
// 自改审计 (路径白/黑名单拦截)
|
|
206
|
-
const selfImproveAttempts = auditInWeek.filter((l) => /attempt|尝试/i.test(l)).length;
|
|
207
|
-
const blockedByPolicy = auditInWeek.filter((l) => /block|deny|拒绝|denylist/i.test(l)).length;
|
|
208
|
-
|
|
209
|
-
return {
|
|
210
|
-
week: weekIso,
|
|
211
|
-
range: { start: start.toISOString().slice(0, 10), end: end.toISOString().slice(0, 10) },
|
|
212
|
-
generatedAt: new Date().toISOString(),
|
|
213
|
-
summary: {
|
|
214
|
-
totalUsage,
|
|
215
|
-
uniqueChannels: channels.size,
|
|
216
|
-
uniqueJudgments: ids.size,
|
|
217
|
-
evolutionEvents: evoInWeek.length,
|
|
218
|
-
acceptRate,
|
|
219
|
-
rejected: rejects,
|
|
220
|
-
reverted: reverts,
|
|
221
|
-
counterfactualScans: cfInWeek.length,
|
|
222
|
-
},
|
|
223
|
-
topJudgments: topN(useInWeek.flatMap((u) => u.usedIds.map((id) => ({ id }))), (x) => x.id, 10),
|
|
224
|
-
topKinds: topN(evoInWeek, (e) => e.suggestion.kind, 5),
|
|
225
|
-
policyAudit: {
|
|
226
|
-
selfImproveAttempts,
|
|
227
|
-
blockedByPolicy,
|
|
228
|
-
note: selfImproveAttempts === 0 ? '本周无源码自改尝试(护栏未触发)' : '见 self-improve-audit.log',
|
|
229
|
-
},
|
|
230
|
-
openQuestions: openQuestions(evoInWeek, cfInWeek, useInWeek),
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function openQuestions(evo: EvolutionEntry[], cf: CounterfactualEntry[], use: UsageEntry[]): string[] {
|
|
235
|
-
const out: string[] = [];
|
|
236
|
-
if (evo.length === 0 && use.length > 0) {
|
|
237
|
-
out.push('本周有使用但无自适应建议 → 可能 judgment 库太稳定, 或扫描器未触发');
|
|
238
|
-
}
|
|
239
|
-
if (use.length === 0) {
|
|
240
|
-
out.push('本周无 judgment 使用记录 → 检查 usage.jsonl 是否在写, 或渠道是否活跃');
|
|
241
|
-
}
|
|
242
|
-
if (cf.length > 0) {
|
|
243
|
-
const conflictCount = cf.filter((c) => /冲突|conflict|不合理/i.test(c.verdict)).length;
|
|
244
|
-
if (conflictCount > 0) {
|
|
245
|
-
out.push(`反事实审计发现 ${conflictCount} 条潜在冲突 → 看 counterfactual-audit.jsonl`);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
const reverts = evo.filter((e) => e.action === 'revert').length;
|
|
249
|
-
if (reverts >= 2) {
|
|
250
|
-
out.push(`本周回滚 ${reverts} 次 → 类 B 建议可能过激, 考虑收紧阈值`);
|
|
251
|
-
}
|
|
252
|
-
return out;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function toMarkdown(r: Report, totalJudgments: number): string {
|
|
256
|
-
const lines: string[] = [];
|
|
257
|
-
lines.push(`# 📊 Bolloon 周报 — ${r.week}`);
|
|
258
|
-
lines.push('');
|
|
259
|
-
lines.push(`> 范围: ${r.range.start} → ${r.range.end} · 生成于 ${r.generatedAt}`);
|
|
260
|
-
lines.push('');
|
|
261
|
-
lines.push('## 核心数字');
|
|
262
|
-
lines.push('');
|
|
263
|
-
lines.push('| 指标 | 本周 |');
|
|
264
|
-
lines.push('|------|------|');
|
|
265
|
-
lines.push(`| judgment 调用次数 | ${r.summary.totalUsage} |`);
|
|
266
|
-
lines.push(`| 触达渠道数 | ${r.summary.uniqueChannels} |`);
|
|
267
|
-
lines.push(`| 用到的不同 judgment 数 | ${r.summary.uniqueJudgments} |`);
|
|
268
|
-
lines.push(`| 自适应事件数 | ${r.summary.evolutionEvents} |`);
|
|
269
|
-
lines.push(`| 接受率 | ${pct(r.summary.acceptRate * 100, 100)} (${Math.round(r.summary.acceptRate * 100)}%) |`);
|
|
270
|
-
lines.push(`| 拒绝数 | ${r.summary.rejected} |`);
|
|
271
|
-
lines.push(`| 回滚数 | ${r.summary.reverted} |`);
|
|
272
|
-
lines.push(`| 反事实审计次数 | ${r.summary.counterfactualScans} |`);
|
|
273
|
-
lines.push(`| 当前 judgment 库总条数 | ${totalJudgments} |`);
|
|
274
|
-
lines.push('');
|
|
275
|
-
lines.push('## 最常被引用的 judgment');
|
|
276
|
-
lines.push('');
|
|
277
|
-
if (r.topJudgments.length === 0) {
|
|
278
|
-
lines.push('_(本周无引用)_');
|
|
279
|
-
} else {
|
|
280
|
-
for (const [id, n] of r.topJudgments) {
|
|
281
|
-
lines.push(`- \`${id}\` × ${n}`);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
lines.push('');
|
|
285
|
-
lines.push('## 自适应建议类型分布');
|
|
286
|
-
lines.push('');
|
|
287
|
-
if (r.topKinds.length === 0) {
|
|
288
|
-
lines.push('_(本周无自适应事件)_');
|
|
289
|
-
} else {
|
|
290
|
-
for (const [kind, n] of r.topKinds) {
|
|
291
|
-
lines.push(`- **${kind}** × ${n}`);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
lines.push('');
|
|
295
|
-
lines.push('## 护栏审计');
|
|
296
|
-
lines.push('');
|
|
297
|
-
lines.push(`- 源码自改尝试: **${r.policyAudit.selfImproveAttempts}**`);
|
|
298
|
-
lines.push(`- 被策略拦截: **${r.policyAudit.blockedByPolicy}**`);
|
|
299
|
-
lines.push(`- ${r.policyAudit.note}`);
|
|
300
|
-
lines.push('');
|
|
301
|
-
lines.push('## 关注事项');
|
|
302
|
-
lines.push('');
|
|
303
|
-
if (r.openQuestions.length === 0) {
|
|
304
|
-
lines.push('_(本周一切正常, 无特别关注)_');
|
|
305
|
-
} else {
|
|
306
|
-
for (const q of r.openQuestions) {
|
|
307
|
-
lines.push(`- ${q}`);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
lines.push('');
|
|
311
|
-
lines.push('---');
|
|
312
|
-
lines.push('');
|
|
313
|
-
lines.push('> 本报告由 `scripts/weekly-report.ts` 纯本地生成, 不调 LLM. 数据源见 ~/.bolloon/human-values/');
|
|
314
|
-
lines.push('');
|
|
315
|
-
return lines.join('\n');
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function parseArgs(argv: string[]): { week?: string; dryRun: boolean } {
|
|
319
|
-
const out: { week?: string; dryRun: boolean } = { dryRun: false };
|
|
320
|
-
for (let i = 0; i < argv.length; i++) {
|
|
321
|
-
if (argv[i] === '--week' && argv[i + 1]) {
|
|
322
|
-
out.week = argv[++i];
|
|
323
|
-
} else if (argv[i] === '--dry-run') {
|
|
324
|
-
out.dryRun = true;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return out;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
async function main() {
|
|
331
|
-
const args = parseArgs(process.argv.slice(2));
|
|
332
|
-
// 默认: 上周(更合理 — 周末才回顾)
|
|
333
|
-
const now = new Date();
|
|
334
|
-
const lastWeek = new Date(now);
|
|
335
|
-
lastWeek.setUTCDate(now.getUTCDate() - 7);
|
|
336
|
-
const week = args.week || isoWeekString(lastWeek);
|
|
337
|
-
const { start, end } = weekRange(week);
|
|
338
|
-
|
|
339
|
-
console.log(`[weekly-report] 生成 ${week} (${start.toISOString().slice(0, 10)} → ${end.toISOString().slice(0, 10)})`);
|
|
340
|
-
|
|
341
|
-
const r = await buildReport(week);
|
|
342
|
-
const judgments = (await readJson<unknown[]>(FILES.judgments())) || [];
|
|
343
|
-
const md = toMarkdown(r, judgments.length);
|
|
344
|
-
|
|
345
|
-
const outDir = REPORTS_DIR();
|
|
346
|
-
const outPath = path.join(outDir, `${week}.md`);
|
|
347
|
-
|
|
348
|
-
if (args.dryRun) {
|
|
349
|
-
console.log(`[weekly-report] DRY-RUN, 不会写盘. 输出预览:`);
|
|
350
|
-
console.log('---');
|
|
351
|
-
console.log(md);
|
|
352
|
-
console.log('---');
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
await fs.mkdir(outDir, { recursive: true });
|
|
357
|
-
await fs.writeFile(outPath, md, 'utf-8');
|
|
358
|
-
console.log(`[weekly-report] ✅ 写入 ${outPath} (${md.length} bytes)`);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
main().catch((err) => {
|
|
362
|
-
console.error('[weekly-report] ❌ 失败:', err);
|
|
363
|
-
process.exit(1);
|
|
364
|
-
});
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* agent-manifest-protocol - 节点握手后立刻互换"我有哪些 agent + capabilities"
|
|
3
|
-
*
|
|
4
|
-
* 核心目的:实现 "建联一次,访问对方所有智能体"。
|
|
5
|
-
* - 节点连上 (Hyperswarm 主题 / iroh) 后立刻发 'manifest_request'
|
|
6
|
-
* - 对端回 'manifest_payload',写入本地 agentRegistry
|
|
7
|
-
* - 之后任何指令可以 pickAgent(capability, ownerDid) → 直接委派
|
|
8
|
-
*
|
|
9
|
-
* 协议消息 (Hyperswarm 字符串帧):
|
|
10
|
-
* manifest_request: { }
|
|
11
|
-
* manifest_payload: { ownerName, ownerPublicKey, agents:[{id,name,capabilities,status}], publishedAt }
|
|
12
|
-
*
|
|
13
|
-
* 本文件不绑定 transport — 只提供 build/parse/dispatch 帮助函数。
|
|
14
|
-
* 调用方在自己 transport 上挂 onMessage('manifest_request', ...) 和 onMessage('manifest_payload', ...)。
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export interface AgentManifestEntry {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
capabilities: string[];
|
|
21
|
-
status: 'active' | 'idle' | 'busy' | 'creating' | 'terminated';
|
|
22
|
-
// 可选 — 若对方把这个 agent 关联到具体子 P2P 端点
|
|
23
|
-
peerId?: string;
|
|
24
|
-
irohNodeId?: string;
|
|
25
|
-
sessionId?: string;
|
|
26
|
-
cid?: string;
|
|
27
|
-
ipnsName?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface AgentManifest {
|
|
31
|
-
ownerName: string;
|
|
32
|
-
ownerPublicKey: string;
|
|
33
|
-
agents: AgentManifestEntry[];
|
|
34
|
-
publishedAt: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ============== 帧构造 ==============
|
|
38
|
-
export function buildManifestRequest(): string {
|
|
39
|
-
return JSON.stringify({ type: 'manifest_request', payload: {}, ts: Date.now(), fromDid: '' });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function buildManifestPayload(manifest: AgentManifest): string {
|
|
43
|
-
return JSON.stringify({ type: 'manifest_payload', payload: manifest, ts: Date.now(), fromDid: '' });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function buildAgentDelegateRequest(opts: {
|
|
47
|
-
capability: string;
|
|
48
|
-
docPath?: string;
|
|
49
|
-
docContent?: string;
|
|
50
|
-
instruction: string;
|
|
51
|
-
fromAgentId: string;
|
|
52
|
-
}): string {
|
|
53
|
-
return JSON.stringify({ type: 'agent_delegate', payload: opts, ts: Date.now(), fromDid: '' });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function buildAgentResponse(opts: {
|
|
57
|
-
ok: boolean;
|
|
58
|
-
delegatedTo: string;
|
|
59
|
-
resultCid?: string;
|
|
60
|
-
summary: string;
|
|
61
|
-
error?: string;
|
|
62
|
-
}): string {
|
|
63
|
-
return JSON.stringify({ type: 'agent_response', payload: opts, ts: Date.now(), fromDid: '' });
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ============== 帧解析 ==============
|
|
67
|
-
export function parseFrame(text: string): { type: string; payload: any; ts: number; fromDid: string } | null {
|
|
68
|
-
try { return JSON.parse(text); } catch { return null; }
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// ============== 本地 manifest registry ==============
|
|
72
|
-
const localManifest: AgentManifest = {
|
|
73
|
-
ownerName: '',
|
|
74
|
-
ownerPublicKey: '',
|
|
75
|
-
agents: [],
|
|
76
|
-
publishedAt: 0,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export function setLocalManifest(m: Partial<AgentManifest>) {
|
|
80
|
-
Object.assign(localManifest, m, { publishedAt: Date.now() });
|
|
81
|
-
return localManifest;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function getLocalManifest(): AgentManifest {
|
|
85
|
-
return localManifest;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function addLocalAgent(agent: AgentManifestEntry) {
|
|
89
|
-
const idx = localManifest.agents.findIndex((a) => a.id === agent.id);
|
|
90
|
-
if (idx >= 0) localManifest.agents[idx] = agent;
|
|
91
|
-
else localManifest.agents.push(agent);
|
|
92
|
-
localManifest.publishedAt = Date.now();
|
|
93
|
-
return localManifest;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// ============== 远端 manifest 缓存 ==============
|
|
97
|
-
const remoteManifests: Map<string, AgentManifest> = new Map(); // key = ownerPublicKey
|
|
98
|
-
|
|
99
|
-
export function cacheRemoteManifest(m: AgentManifest) {
|
|
100
|
-
if (m.ownerPublicKey) remoteManifests.set(m.ownerPublicKey, m);
|
|
101
|
-
return m;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function getRemoteManifests(): AgentManifest[] {
|
|
105
|
-
return Array.from(remoteManifests.values());
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function pickAgent(capability: string, ownerPublicKey?: string): { agent: AgentManifestEntry; owner: AgentManifest } | null {
|
|
109
|
-
const owners = ownerPublicKey
|
|
110
|
-
? [remoteManifests.get(ownerPublicKey)].filter(Boolean) as AgentManifest[]
|
|
111
|
-
: getRemoteManifests();
|
|
112
|
-
for (const owner of owners) {
|
|
113
|
-
const a = owner.agents.find((x) => x.capabilities.includes(capability) && x.status === 'active');
|
|
114
|
-
if (a) return { agent: a, owner };
|
|
115
|
-
}
|
|
116
|
-
return null;
|
|
117
|
-
}
|