@bolloon/bolloon-agent 0.1.36 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/.auto-evolve-calls +0 -1
- package/.last-auto-evolve-baseline +0 -1
- package/.playwright-mcp/page-2026-06-16T07-51-45-706Z.yml +0 -130
- package/.playwright-mcp/page-2026-06-16T07-56-44-116Z.yml +0 -131
- package/Bolloon.md +0 -144
- package/Dive-into/CITATION.cff +0 -17
- package/Dive-into/LICENSE +0 -25
- package/Dive-into/README.md +0 -598
- package/Dive-into/README_zh.md +0 -599
- package/Dive-into/assets/context.png +0 -0
- package/Dive-into/assets/extensibility.png +0 -0
- package/Dive-into/assets/iteration.png +0 -0
- package/Dive-into/assets/layered_architecture.png +0 -0
- package/Dive-into/assets/main_structure.png +0 -0
- package/Dive-into/assets/permission.png +0 -0
- package/Dive-into/assets/session_compact.png +0 -0
- package/Dive-into/assets/subagent.png +0 -0
- package/Dive-into/paper/Dive_into_Claude_Code.pdf +0 -0
- package/dist/agents/constraint-layer.js.map +0 -1
- package/dist/agents/pi-sdk.js.map +0 -1
- package/dist/agents/workflow-engine.js.map +0 -1
- package/dist/bollharness/src/index.js +0 -5
- package/dist/bollharness/src/scripts/checks/check_adr_plan_numbering.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_api_types.js +0 -45
- package/dist/bollharness/src/scripts/checks/check_artifact_link.js +0 -146
- package/dist/bollharness/src/scripts/checks/check_bridge_deps.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_bugfix_binding.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_bugfix_binding_ci.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_doc_file_references.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_doc_freshness.js +0 -135
- package/dist/bollharness/src/scripts/checks/check_doc_links.js +0 -31
- package/dist/bollharness/src/scripts/checks/check_file_existence_claims.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_fragment_integrity.js +0 -34
- package/dist/bollharness/src/scripts/checks/check_hook_installed.js +0 -63
- package/dist/bollharness/src/scripts/checks/check_issue_closure.js +0 -41
- package/dist/bollharness/src/scripts/checks/check_mcp_parity.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_security.js +0 -48
- package/dist/bollharness/src/scripts/checks/check_skill_parity.js +0 -6
- package/dist/bollharness/src/scripts/checks/check_versions.js +0 -6
- package/dist/bollharness/src/scripts/checks/finding.js +0 -13
- package/dist/bollharness/src/scripts/checks/next_decision_number.js +0 -20
- package/dist/bollharness/src/scripts/checks/regenerate_magic_docs.js +0 -6
- package/dist/bollharness/src/scripts/ci/detect_rebaseline_triggers.js +0 -8
- package/dist/bollharness/src/scripts/ci/scan_subprocess_cfg.js +0 -8
- package/dist/bollharness/src/scripts/ci/scan_verify_artifacts.js +0 -8
- package/dist/bollharness/src/scripts/ci/scan_yaml_schema.js +0 -8
- package/dist/bollharness/src/scripts/context_router.js +0 -67
- package/dist/bollharness/src/scripts/deploy-guard.js +0 -157
- package/dist/bollharness/src/scripts/guard-feedback.js +0 -192
- package/dist/bollharness/src/scripts/guard_router.js +0 -158
- package/dist/bollharness/src/scripts/hooks/_hook_output.js +0 -6
- package/dist/bollharness/src/scripts/hooks/auto-python3.js +0 -6
- package/dist/bollharness/src/scripts/hooks/deploy-progress-on-session-end.js +0 -6
- package/dist/bollharness/src/scripts/hooks/failure-analyzer.js +0 -6
- package/dist/bollharness/src/scripts/hooks/gate-judgment-inject.js +0 -92
- package/dist/bollharness/src/scripts/hooks/gate-transition-judgment.js +0 -63
- package/dist/bollharness/src/scripts/hooks/inbox-ack.js +0 -6
- package/dist/bollharness/src/scripts/hooks/inbox-inject-on-start.js +0 -6
- package/dist/bollharness/src/scripts/hooks/inbox-validate.js +0 -6
- package/dist/bollharness/src/scripts/hooks/inbox-write-ledger.js +0 -6
- package/dist/bollharness/src/scripts/hooks/initializer-agent.js +0 -6
- package/dist/bollharness/src/scripts/hooks/loop-detection.js +0 -73
- package/dist/bollharness/src/scripts/hooks/owner-guard.js +0 -6
- package/dist/bollharness/src/scripts/hooks/precompact.js +0 -6
- package/dist/bollharness/src/scripts/hooks/review-agent-gatekeeper.js +0 -6
- package/dist/bollharness/src/scripts/hooks/risk-tracker.js +0 -108
- package/dist/bollharness/src/scripts/hooks/sanitize-on-read.js +0 -6
- package/dist/bollharness/src/scripts/hooks/session-reflection.js +0 -7
- package/dist/bollharness/src/scripts/hooks/session-start-magic-docs.js +0 -7
- package/dist/bollharness/src/scripts/hooks/session-start-reset-risk.js +0 -7
- package/dist/bollharness/src/scripts/hooks/session-start-toolkit-reminder.js +0 -7
- package/dist/bollharness/src/scripts/hooks/stop-evaluator.js +0 -157
- package/dist/bollharness/src/scripts/hooks/tool-call-counter.js +0 -6
- package/dist/bollharness/src/scripts/hooks/trace-analyzer.js +0 -10
- package/dist/bollharness/src/scripts/install/install-trust-token.js +0 -7
- package/dist/bollharness/src/scripts/install/multi_project_registry.js +0 -9
- package/dist/bollharness/src/scripts/install/phase2_auto.js +0 -21
- package/dist/bollharness/src/scripts/install/pre_commit_installer.js +0 -6
- package/dist/bollharness/src/scripts/install/tier_selector.js +0 -7
- package/dist/bollharness/src/scripts/install/transcript_miner.js +0 -7
- package/dist/bollharness/src/scripts/lib/claim_patterns.js +0 -10
- package/dist/bollharness/src/scripts/lib/sanitize_patterns.js +0 -12
- package/dist/bollharness/src/scripts/sanitize.js +0 -6
- package/dist/bollharness-integration/context-router-judgment.js.map +0 -1
- package/dist/bollharness-integration/context-router.js.map +0 -1
- package/dist/bollharness-integration/gate-state-machine.js.map +0 -1
- package/dist/bollharness-integration/gate-transition-hooks.js.map +0 -1
- package/dist/bollharness-integration/guard-checker.js.map +0 -1
- package/dist/bollharness-integration/index.js.map +0 -1
- package/dist/bollharness-integration/integration.js.map +0 -1
- package/dist/bollharness-integration/llm/pi-ai.d.ts +0 -60
- package/dist/bollharness-integration/pi-ecosystem-colony/index.d.ts +0 -153
- package/dist/bollharness-integration/pi-ecosystem-goals/index.d.ts +0 -136
- package/dist/bollharness-integration/pi-ecosystem-judgment/decision.d.ts +0 -117
- package/dist/bollharness-integration/pi-ecosystem-judgment/distillation.d.ts +0 -78
- package/dist/bollharness-integration/pi-ecosystem-judgment/index.d.ts +0 -139
- package/dist/bollharness-integration/pi-ecosystem-mcp/index.d.ts +0 -127
- package/dist/bollharness-integration/pi-ecosystem-subagents/index.d.ts +0 -95
- package/dist/bollharness-integration/skill-adapter.js.map +0 -1
- package/dist/constraint-runtime/src/_archive_helper.js +0 -9
- package/dist/constraint-runtime/src/agent/coordinator.js +0 -48
- package/dist/constraint-runtime/src/agent/index.js +0 -1
- package/dist/constraint-runtime/src/assistant/index.js +0 -12
- package/dist/constraint-runtime/src/bootstrap/index.js +0 -12
- package/dist/constraint-runtime/src/bootstrap_graph.js +0 -13
- package/dist/constraint-runtime/src/bridge/index.js +0 -12
- package/dist/constraint-runtime/src/buddy/index.js +0 -12
- package/dist/constraint-runtime/src/cli/index.js +0 -12
- package/dist/constraint-runtime/src/command_graph.js +0 -10
- package/dist/constraint-runtime/src/commands.js +0 -60
- package/dist/constraint-runtime/src/components/index.js +0 -12
- package/dist/constraint-runtime/src/constants/index.js +0 -12
- package/dist/constraint-runtime/src/constraint/budget.js +0 -22
- package/dist/constraint-runtime/src/constraint/budget.js.map +0 -1
- package/dist/constraint-runtime/src/constraint/index.js +0 -2
- package/dist/constraint-runtime/src/constraint/permission.js +0 -20
- package/dist/constraint-runtime/src/constraint/permission.js.map +0 -1
- package/dist/constraint-runtime/src/context.js +0 -30
- package/dist/constraint-runtime/src/coordinator/index.js +0 -12
- package/dist/constraint-runtime/src/cost_hook.js +0 -4
- package/dist/constraint-runtime/src/cost_tracker.js +0 -8
- package/dist/constraint-runtime/src/deferred_init.js +0 -10
- package/dist/constraint-runtime/src/direct_modes.js +0 -6
- package/dist/constraint-runtime/src/dynamic-tool-loader.js +0 -85
- package/dist/constraint-runtime/src/entrypoints/index.js +0 -12
- package/dist/constraint-runtime/src/execution_registry.js +0 -44
- package/dist/constraint-runtime/src/history.js +0 -9
- package/dist/constraint-runtime/src/hooks/index.js +0 -12
- package/dist/constraint-runtime/src/index.js +0 -26
- package/dist/constraint-runtime/src/ink.js +0 -4
- package/dist/constraint-runtime/src/keybindings/index.js +0 -12
- package/dist/constraint-runtime/src/memdir/index.js +0 -12
- package/dist/constraint-runtime/src/migrations/index.js +0 -12
- package/dist/constraint-runtime/src/models.js +0 -1
- package/dist/constraint-runtime/src/models.js.map +0 -1
- package/dist/constraint-runtime/src/moreright/index.js +0 -12
- package/dist/constraint-runtime/src/native_ts/index.js +0 -12
- package/dist/constraint-runtime/src/output_styles/index.js +0 -12
- package/dist/constraint-runtime/src/parity_audit.js +0 -12
- package/dist/constraint-runtime/src/plugins/index.js +0 -12
- package/dist/constraint-runtime/src/port_manifest.js +0 -11
- package/dist/constraint-runtime/src/prefetch.js +0 -9
- package/dist/constraint-runtime/src/query.js +0 -1
- package/dist/constraint-runtime/src/remote/index.js +0 -12
- package/dist/constraint-runtime/src/remote_runtime.js +0 -9
- package/dist/constraint-runtime/src/runtime/index.js +0 -1
- package/dist/constraint-runtime/src/runtime/session.js +0 -35
- package/dist/constraint-runtime/src/schemas/index.js +0 -12
- package/dist/constraint-runtime/src/screens/index.js +0 -12
- package/dist/constraint-runtime/src/server/index.js +0 -12
- package/dist/constraint-runtime/src/services/index.js +0 -12
- package/dist/constraint-runtime/src/session_store.js +0 -22
- package/dist/constraint-runtime/src/setup.js +0 -30
- package/dist/constraint-runtime/src/skills/index.js +0 -1
- package/dist/constraint-runtime/src/skills/skill-registry.js +0 -28
- package/dist/constraint-runtime/src/state/index.js +0 -12
- package/dist/constraint-runtime/src/system_init.js +0 -20
- package/dist/constraint-runtime/src/thinking/engine.js +0 -42
- package/dist/constraint-runtime/src/thinking/index.js +0 -1
- package/dist/constraint-runtime/src/tool_pool.js +0 -8
- package/dist/constraint-runtime/src/tools/OpenCLI/execAdapter.js +0 -7
- package/dist/constraint-runtime/src/tools/OpenCLI/listAdapters.js +0 -7
- package/dist/constraint-runtime/src/tools/OpenCLI/runCommand.js +0 -7
- package/dist/constraint-runtime/src/tools/PolymarketSDK/cancelOrder.js +0 -6
- package/dist/constraint-runtime/src/tools/PolymarketSDK/createOrder.js +0 -6
- package/dist/constraint-runtime/src/tools/PolymarketSDK/getMarket.js +0 -5
- package/dist/constraint-runtime/src/tools/PolymarketSDK/getOrders.js +0 -6
- package/dist/constraint-runtime/src/tools/PolymarketSDK/listMarkets.js +0 -4
- package/dist/constraint-runtime/src/tools/SafeSDK/confirmTransaction.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/createTransaction.js +0 -8
- package/dist/constraint-runtime/src/tools/SafeSDK/deploySafe.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/executeTransaction.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/getBalance.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/getPendingTransactions.js +0 -6
- package/dist/constraint-runtime/src/tools/SafeSDK/proposeTransaction.js +0 -6
- package/dist/constraint-runtime/src/tools/WalletTools/autoPay.js +0 -29
- package/dist/constraint-runtime/src/tools/WalletTools/createWallet.js +0 -10
- package/dist/constraint-runtime/src/tools/WalletTools/getBalance.js +0 -13
- package/dist/constraint-runtime/src/tools/WalletTools/importWallet.js +0 -22
- package/dist/constraint-runtime/src/tools/WalletTools/sendTransaction.js +0 -25
- package/dist/constraint-runtime/src/tools/WalletTools/signMessage.js +0 -10
- package/dist/constraint-runtime/src/tools/WalletTools/transferToken.js +0 -25
- package/dist/constraint-runtime/src/tools.js +0 -80
- package/dist/constraint-runtime/src/transcript.js +0 -19
- package/dist/constraint-runtime/src/types/index.js +0 -12
- package/dist/constraint-runtime/src/upstream_proxy/index.js +0 -12
- package/dist/constraint-runtime/src/utils/index.js +0 -12
- package/dist/constraint-runtime/src/vim/index.js +0 -12
- package/dist/constraint-runtime/src/voice/index.js +0 -12
- package/dist/constraints/index.js.map +0 -1
- package/dist/documents/reader.js.map +0 -1
- package/dist/llm/config-store.js.map +0 -1
- package/dist/llm/pi-ai.js.map +0 -1
- package/dist/network/agent-network.js.map +0 -1
- package/dist/network/iroh-integration.js.map +0 -1
- package/dist/network/iroh-transport.js.map +0 -1
- package/dist/network/p2p.js.map +0 -1
- package/dist/network/storage/adapters/json-adapter.js.map +0 -1
- package/dist/pi-ecosystem-colony/index.js.map +0 -1
- package/dist/pi-ecosystem-goals/index.js.map +0 -1
- package/dist/pi-ecosystem-judgment/decision.js.map +0 -1
- package/dist/pi-ecosystem-judgment/distillation.js.map +0 -1
- package/dist/pi-ecosystem-judgment/human-value-store.js.map +0 -1
- package/dist/pi-ecosystem-judgment/index.js.map +0 -1
- package/dist/pi-ecosystem-judgment/value-injection.js.map +0 -1
- package/dist/pi-ecosystem-mcp/index.js.map +0 -1
- package/dist/pi-ecosystem-subagents/index.js.map +0 -1
- package/dist/social/ant-colony/AdaptiveHeartbeat.js.map +0 -1
- package/dist/social/ant-colony/PheromoneEngine.js.map +0 -1
- package/dist/social/ant-colony/types.js.map +0 -1
- package/dist/social/channels/ChannelManager.js.map +0 -1
- package/dist/social/channels/DiapChannelBridge.js.map +0 -1
- package/dist/social/channels/InterestMatcher.js.map +0 -1
- package/dist/social/channels/types.js.map +0 -1
- package/dist/social/global-shared-context.js.map +0 -1
- package/dist/social/heartbeat.js.map +0 -1
- package/lefthook.yml +0 -33
- package/scripts/auto-evolve-loop.ts +0 -481
- package/scripts/build-web.ts +0 -116
- package/scripts/diff-reviewer.ts +0 -159
- package/scripts/validate-system-prompt.ts +0 -142
- package/scripts/weekly-report.ts +0 -364
- package/src/agents/agent-manifest-protocol.ts +0 -117
- package/src/agents/constraint-layer.ts +0 -309
- package/src/agents/iroh-secret.ts +0 -32
- package/src/agents/p2p-chat-tools.ts +0 -383
- package/src/agents/p2p-document-tools.ts +0 -347
- package/src/agents/permission-mode.ts +0 -127
- package/src/agents/pi-sdk.ts +0 -2895
- package/src/agents/pre-tool-validator.ts +0 -213
- package/src/agents/protocol.ts +0 -398
- package/src/agents/shell-guard.ts +0 -417
- package/src/agents/shell-tool.ts +0 -103
- package/src/agents/skill-loader.ts +0 -202
- package/src/agents/subagent-manager.ts +0 -553
- package/src/agents/workflow-engine.ts +0 -332
- package/src/agents/workflow-pivot-loop.ts +0 -766
- package/src/bollharness/.sanitize-report.json +0 -13
- package/src/bollharness/CLAUDE.md +0 -73
- package/src/bollharness/LICENSE +0 -21
- package/src/bollharness/README.md +0 -143
- package/src/bollharness/README.zh-CN.md +0 -131
- package/src/bollharness/package.json +0 -20
- package/src/bollharness/reference/SOURCE-COMMIT.txt +0 -3
- package/src/bollharness/reference/boll-reference/scripts/hooks/.sanitize-report.json +0 -12
- package/src/bollharness/reference/boll-reference/scripts/hooks/find-boll-root.sh +0 -27
- package/src/bollharness/reference/boll-reference/scripts/hooks/precompact.sh +0 -57
- package/src/bollharness/reference/boll-reference/scripts/hooks/stop-evaluator.md +0 -57
- package/src/bollharness/schemas/metrics-jsonl-allowlist.json +0 -67
- package/src/bollharness/scripts/checks/next_decision_number.sh +0 -48
- package/src/bollharness/scripts/ci/count-components.sh +0 -65
- package/src/bollharness/scripts/context-fragments/artifact-linkage.md +0 -14
- package/src/bollharness/scripts/context-fragments/auth-consumers.md +0 -17
- package/src/bollharness/scripts/context-fragments/bridge-constitution.md +0 -13
- package/src/bollharness/scripts/context-fragments/catalyst-distributed.md +0 -18
- package/src/bollharness/scripts/context-fragments/closure-checklist.md +0 -13
- package/src/bollharness/scripts/context-fragments/contract-consumers.md +0 -15
- package/src/bollharness/scripts/context-fragments/db-shared-structures.md +0 -15
- package/src/bollharness/scripts/context-fragments/fixed-three-layers.md +0 -19
- package/src/bollharness/scripts/context-fragments/general-dev-principles.md +0 -11
- package/src/bollharness/scripts/context-fragments/issue-first.md +0 -8
- package/src/bollharness/scripts/context-fragments/mcp-parity.md +0 -16
- package/src/bollharness/scripts/context-fragments/pi-agent-operations.md +0 -108
- package/src/bollharness/scripts/context-fragments/protocol-consumers.md +0 -15
- package/src/bollharness/scripts/context-fragments/run-events-consumers.md +0 -15
- package/src/bollharness/scripts/context-fragments/scene-fidelity.md +0 -13
- package/src/bollharness/scripts/context-fragments/truth-source-hierarchy.md +0 -15
- package/src/bollharness/scripts/context-fragments/two-language.md +0 -15
- package/src/bollharness/scripts/context-fragments/version-sources.md +0 -14
- package/src/bollharness/scripts/hooks/find-project-root.sh +0 -47
- package/src/bollharness/scripts/hooks/inbox-poll.sh +0 -78
- package/src/bollharness/scripts/hooks/precompact.sh +0 -56
- package/src/bollharness/scripts/hooks/stop-evaluator.md +0 -83
- package/src/bollharness/scripts/sync-from-upstream.sh +0 -281
- package/src/bollharness/src/index.ts +0 -5
- package/src/bollharness/src/scripts/checks/check_adr_plan_numbering.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_api_types.ts +0 -52
- package/src/bollharness/src/scripts/checks/check_artifact_link.ts +0 -156
- package/src/bollharness/src/scripts/checks/check_bridge_deps.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_bugfix_binding.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_bugfix_binding_ci.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_doc_file_references.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_doc_freshness.ts +0 -141
- package/src/bollharness/src/scripts/checks/check_doc_links.ts +0 -36
- package/src/bollharness/src/scripts/checks/check_file_existence_claims.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_fragment_integrity.ts +0 -40
- package/src/bollharness/src/scripts/checks/check_hook_installed.ts +0 -70
- package/src/bollharness/src/scripts/checks/check_issue_closure.ts +0 -51
- package/src/bollharness/src/scripts/checks/check_mcp_parity.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_security.ts +0 -54
- package/src/bollharness/src/scripts/checks/check_skill_parity.ts +0 -11
- package/src/bollharness/src/scripts/checks/check_versions.ts +0 -11
- package/src/bollharness/src/scripts/checks/finding.ts +0 -35
- package/src/bollharness/src/scripts/checks/next_decision_number.ts +0 -24
- package/src/bollharness/src/scripts/checks/regenerate_magic_docs.ts +0 -11
- package/src/bollharness/src/scripts/ci/detect_rebaseline_triggers.ts +0 -14
- package/src/bollharness/src/scripts/ci/scan_subprocess_cfg.ts +0 -14
- package/src/bollharness/src/scripts/ci/scan_verify_artifacts.ts +0 -14
- package/src/bollharness/src/scripts/ci/scan_yaml_schema.ts +0 -14
- package/src/bollharness/src/scripts/context_router.ts +0 -76
- package/src/bollharness/src/scripts/deploy-guard.ts +0 -182
- package/src/bollharness/src/scripts/guard-feedback.ts +0 -215
- package/src/bollharness/src/scripts/guard_router.ts +0 -194
- package/src/bollharness/src/scripts/hooks/_hook_output.js +0 -3
- package/src/bollharness/src/scripts/hooks/_hook_output.ts +0 -11
- package/src/bollharness/src/scripts/hooks/auto-python3.ts +0 -10
- package/src/bollharness/src/scripts/hooks/deploy-progress-on-session-end.ts +0 -10
- package/src/bollharness/src/scripts/hooks/failure-analyzer.ts +0 -10
- package/src/bollharness/src/scripts/hooks/gate-judgment-inject.ts +0 -111
- package/src/bollharness/src/scripts/hooks/gate-transition-judgment.ts +0 -74
- package/src/bollharness/src/scripts/hooks/inbox-ack.ts +0 -10
- package/src/bollharness/src/scripts/hooks/inbox-inject-on-start.ts +0 -10
- package/src/bollharness/src/scripts/hooks/inbox-validate.ts +0 -10
- package/src/bollharness/src/scripts/hooks/inbox-write-ledger.ts +0 -10
- package/src/bollharness/src/scripts/hooks/initializer-agent.ts +0 -10
- package/src/bollharness/src/scripts/hooks/loop-detection.ts +0 -83
- package/src/bollharness/src/scripts/hooks/owner-guard.ts +0 -10
- package/src/bollharness/src/scripts/hooks/precompact.ts +0 -10
- package/src/bollharness/src/scripts/hooks/review-agent-gatekeeper.ts +0 -10
- package/src/bollharness/src/scripts/hooks/risk-tracker.ts +0 -121
- package/src/bollharness/src/scripts/hooks/sanitize-on-read.ts +0 -10
- package/src/bollharness/src/scripts/hooks/session-reflection.ts +0 -12
- package/src/bollharness/src/scripts/hooks/session-start-magic-docs.ts +0 -12
- package/src/bollharness/src/scripts/hooks/session-start-reset-risk.ts +0 -12
- package/src/bollharness/src/scripts/hooks/session-start-toolkit-reminder.ts +0 -12
- package/src/bollharness/src/scripts/hooks/stop-evaluator.ts +0 -164
- package/src/bollharness/src/scripts/hooks/tool-call-counter.ts +0 -10
- package/src/bollharness/src/scripts/hooks/trace-analyzer.ts +0 -14
- package/src/bollharness/src/scripts/install/install-trust-token.ts +0 -13
- package/src/bollharness/src/scripts/install/multi_project_registry.ts +0 -13
- package/src/bollharness/src/scripts/install/phase2_auto.ts +0 -28
- package/src/bollharness/src/scripts/install/pre_commit_installer.ts +0 -10
- package/src/bollharness/src/scripts/install/tier_selector.ts +0 -10
- package/src/bollharness/src/scripts/install/transcript_miner.ts +0 -13
- package/src/bollharness/src/scripts/lib/claim_patterns.ts +0 -11
- package/src/bollharness/src/scripts/lib/sanitize_patterns.ts +0 -13
- package/src/bollharness/src/scripts/sanitize.ts +0 -9
- package/src/bollharness/templates/persona/default.json +0 -19
- package/src/bollharness/templates/scaffold/.gitignore.append +0 -16
- package/src/bollharness/templates/scaffold/CLAUDE.md +0 -89
- package/src/bollharness-integration/channel-judgment-engine.ts +0 -634
- package/src/bollharness-integration/context-chain-router.ts +0 -474
- package/src/bollharness-integration/context-router-judgment.ts +0 -339
- package/src/bollharness-integration/context-router.ts +0 -583
- package/src/bollharness-integration/gate-state-machine.ts +0 -444
- package/src/bollharness-integration/gate-transition-hooks.ts +0 -137
- package/src/bollharness-integration/guard-checker.ts +0 -451
- package/src/bollharness-integration/index.ts +0 -195
- package/src/bollharness-integration/integration.ts +0 -538
- package/src/bollharness-integration/judgment-prompts.yaml +0 -535
- package/src/bollharness-integration/llm-judgment-engine.ts +0 -712
- package/src/bollharness-integration/skill-adapter.ts +0 -646
- package/src/bootstrap/bootstrap.ts +0 -135
- package/src/bootstrap/context-collector.ts +0 -371
- package/src/bootstrap/context-hierarchy.ts +0 -283
- package/src/bootstrap/lifecycle-hooks.ts +0 -289
- package/src/bootstrap/project-context.ts +0 -171
- package/src/cli/interface.ts +0 -211
- package/src/cli-entry.ts +0 -304
- package/src/constraints/index.ts +0 -6
- package/src/context-compaction/auto-compact.ts +0 -153
- package/src/context-compaction/budget-gate.ts +0 -32
- package/src/context-compaction/budget-reduce.ts +0 -37
- package/src/context-compaction/context-collapse.ts +0 -72
- package/src/context-compaction/index.ts +0 -24
- package/src/context-compaction/microcompact.ts +0 -54
- package/src/context-compaction/pipeline.ts +0 -133
- package/src/context-compaction/snip.ts +0 -51
- package/src/context-compaction/token-estimator.ts +0 -36
- package/src/context-compaction/types.ts +0 -99
- package/src/documents/reader.ts +0 -85
- package/src/documents/store.ts +0 -252
- package/src/electron-preload.ts +0 -25
- package/src/electron.ts +0 -200
- package/src/heartbeat/DaemonManager.ts +0 -283
- package/src/heartbeat/HealthMonitor.ts +0 -317
- package/src/heartbeat/StartupVerifier.ts +0 -223
- package/src/heartbeat/Watchdog.ts +0 -208
- package/src/heartbeat/index.ts +0 -109
- package/src/heartbeat/self-improve-bus.ts +0 -110
- package/src/heartbeat/types.ts +0 -82
- package/src/index.ts +0 -1724
- package/src/llm/audio-config-store.ts +0 -246
- package/src/llm/config-store.ts +0 -400
- package/src/llm/llm-judgment-client.ts +0 -471
- package/src/llm/pi-ai.ts +0 -653
- package/src/llm/system-prompt/health.ts +0 -159
- package/src/llm/system-prompt/layers/channel/local.md +0 -14
- package/src/llm/system-prompt/layers/channel/p2p-agent.md +0 -18
- package/src/llm/system-prompt/layers/channel/p2p-visitor.md +0 -19
- package/src/llm/system-prompt/layers/core/artifacts_storage.md +0 -89
- package/src/llm/system-prompt/layers/core/evenhandedness.md +0 -21
- package/src/llm/system-prompt/layers/core/hibs_reminders.md +0 -15
- package/src/llm/system-prompt/layers/core/identity.md +0 -37
- package/src/llm/system-prompt/layers/core/knowledge.md +0 -17
- package/src/llm/system-prompt/layers/core/memory_system.md +0 -12
- package/src/llm/system-prompt/layers/core/network_filesystem.md +0 -28
- package/src/llm/system-prompt/layers/core/refusal.md +0 -37
- package/src/llm/system-prompt/layers/core/tone.md +0 -31
- package/src/llm/system-prompt/layers/core/tools.thin.md +0 -13
- package/src/llm/system-prompt/layers/core/wellbeing.md +0 -41
- package/src/llm/system-prompt/layers/role/architect.md +0 -20
- package/src/llm/system-prompt/layers/role/expert.md +0 -19
- package/src/llm/system-prompt/layers/role/implementer.md +0 -15
- package/src/llm/system-prompt/layers/role/security.md +0 -15
- package/src/llm/system-prompt/layers/tool/artifacts.md +0 -72
- package/src/llm/system-prompt/layers/tool/bash.md +0 -25
- package/src/llm/system-prompt/layers/tool/hibs_api.md +0 -171
- package/src/llm/system-prompt/layers/tool/image_search.md +0 -70
- package/src/llm/system-prompt/layers/tool/manifest.md +0 -89
- package/src/llm/system-prompt/layers/tool/mcp_apps.md +0 -53
- package/src/llm/system-prompt/layers/tool/web_search.md +0 -83
- package/src/llm/system-prompt/registry.ts +0 -325
- package/src/llm/system-prompt/strip-hibsml.ts +0 -52
- package/src/llm/tool-manifest/ask_user_input.ts +0 -37
- package/src/llm/tool-manifest/bash.ts +0 -25
- package/src/llm/tool-manifest/create_file.ts +0 -26
- package/src/llm/tool-manifest/fetch_sports_data.ts +0 -28
- package/src/llm/tool-manifest/image_search.ts +0 -26
- package/src/llm/tool-manifest/index.ts +0 -88
- package/src/llm/tool-manifest/mcp.ts +0 -46
- package/src/llm/tool-manifest/message_compose.ts +0 -33
- package/src/llm/tool-manifest/places.ts +0 -86
- package/src/llm/tool-manifest/present_files.ts +0 -23
- package/src/llm/tool-manifest/recipe.ts +0 -42
- package/src/llm/tool-manifest/recommend_apps.ts +0 -25
- package/src/llm/tool-manifest/str_replace.ts +0 -29
- package/src/llm/tool-manifest/types.ts +0 -52
- package/src/llm/tool-manifest/view.ts +0 -26
- package/src/llm/tool-manifest/weather.ts +0 -29
- package/src/llm/tool-manifest/web.ts +0 -54
- package/src/llm/video-config-store.ts +0 -257
- package/src/network/agent-network.ts +0 -800
- package/src/network/hybrid-messenger.ts +0 -199
- package/src/network/iroh-bootstrap.ts +0 -57
- package/src/network/iroh-discovery.ts +0 -208
- package/src/network/iroh-integration.ts +0 -158
- package/src/network/iroh-transport.ts +0 -637
- package/src/network/known-peers.ts +0 -102
- package/src/network/p2p-direct.ts +0 -262
- package/src/network/p2p-secret.ts +0 -153
- package/src/network/p2p.ts +0 -964
- package/src/network/source-intent-broadcaster.ts +0 -242
- package/src/network/source-intent.ts +0 -167
- package/src/network/storage/adapters/json-adapter.ts +0 -454
- package/src/network/storage/index.ts +0 -203
- package/src/network/storage/types.ts +0 -166
- package/src/security/builtin-guards.ts +0 -162
- package/src/security/context-router-tool.ts +0 -122
- package/src/security/input-scanner.ts +0 -287
- package/src/security/react-harness.ts +0 -177
- package/src/security/tool-gate.ts +0 -294
- package/src/social/ant-colony/index.js +0 -19
- package/src/social/channels/ChannelManager.ts +0 -485
- package/src/social/channels/DiapChannelBridge.ts +0 -501
- package/src/social/channels/InterestMatcher.ts +0 -189
- package/src/social/channels/agent-workflow-config.json +0 -214
- package/src/social/channels/agent-workflow-config.yaml +0 -334
- package/src/social/channels/channel-agent-session.ts +0 -407
- package/src/social/channels/channel-heartbeat-agent.ts +0 -622
- package/src/social/channels/diap-doc-parser.ts +0 -282
- package/src/social/channels/harness-workflow-integrator.ts +0 -594
- package/src/social/channels/index.ts +0 -22
- package/src/social/channels/types.ts +0 -115
- package/src/social/global-shared-context.ts +0 -506
- package/src/social/heartbeat.ts +0 -1057
- package/src/social/persona/enhanced-persona.ts +0 -359
- package/src/types.d.ts +0 -12
- package/src/utils/auto-evolve-policy.ts +0 -138
- package/src/utils/auto-update.ts +0 -482
- package/src/utils/clamp.ts +0 -5
- package/src/web/agent-delegate-server.ts +0 -148
- package/src/web/api-config.html +0 -520
- package/src/web/client.js +0 -2352
- package/src/web/client.ts +0 -4326
- package/src/web/components/p2p/P2PModal.tsx +0 -416
- package/src/web/components/p2p/index.ts +0 -566
- package/src/web/components/p2p/index.tsx +0 -297
- package/src/web/components/p2p/p2p-connection.ts +0 -338
- package/src/web/components/p2p/p2p-identity.ts +0 -92
- package/src/web/components/p2p/p2p-manager.ts +0 -147
- package/src/web/components/p2p/p2p-messages.ts +0 -219
- package/src/web/components/p2p/p2p-modal.ts +0 -685
- package/src/web/components/p2p/p2p-store-memory.ts +0 -162
- package/src/web/components/p2p/p2p-tools.ts +0 -315
- package/src/web/components/p2p/types.ts +0 -170
- package/src/web/components/wallet-viem.mjs +0 -118
- package/src/web/design.md +0 -99
- package/src/web/icons/apple-touch-icon.png +0 -0
- package/src/web/icons/favicon-16x16.png +0 -0
- package/src/web/icons/favicon-192x192.png +0 -0
- package/src/web/icons/favicon-32x32.png +0 -0
- package/src/web/icons/favicon-48x48.png +0 -0
- package/src/web/icons/favicon-512x512.png +0 -0
- package/src/web/icons/favicon.icns +0 -0
- package/src/web/icons/favicon.ico +0 -0
- package/src/web/icons/icon.png +0 -0
- package/src/web/icons/image.png +0 -0
- package/src/web/index.html +0 -373
- package/src/web/iroh-delegate-transport.ts +0 -139
- package/src/web/manifest.json +0 -21
- package/src/web/server.ts +0 -5731
- package/src/web/style.css +0 -4737
- package/src/web/ui/message-renderer.ts +0 -540
- package/src/web/ui/step-timeline.ts +0 -394
- package/staging/auto-evolve/clean-001/.review-verdict +0 -9
- package/staging/auto-evolve/clean-001/clean-001.patch +0 -14
- package/staging/auto-evolve/e2e-001/.patch-id +0 -1
- package/staging/auto-evolve/e2e-001/.review-verdict +0 -12
- package/staging/auto-evolve/e2e-001/e2e-001.patch +0 -11
- package/staging/auto-evolve/test-bad/.review-verdict +0 -12
- package/staging/auto-evolve/test-bad/test-bad.patch +0 -11
- package/test-results/.last-run.json +0 -6
- package/test-results/src-test-web-loop-status-b-5734c-atus-bar-/346/230/276/347/244/272-spinner-/344/270/215/346/230/276/347/244/272/345/276/252/347/216/257/350/256/241/346/225/260/error-context.md +0 -285
- package/tsconfig.cli.json +0 -16
- package/tsconfig.electron.json +0 -20
- package/tsconfig.json +0 -18
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ToolManifest } from './types.js';
|
|
2
|
-
|
|
3
|
-
export const message_compose_v1: ToolManifest = {
|
|
4
|
-
id: 'message_compose_v1',
|
|
5
|
-
name: 'message_compose_v1',
|
|
6
|
-
oneLine: '起草目标导向的消息 (email/textMessage/other).',
|
|
7
|
-
description: '分析情境类型 (工作分歧、谈判、跟进、传达坏消息、请求某事、设定边界、道歉、拒绝、提供反馈、冷启动接触、回应反馈、澄清误解、委派、庆祝) 并识别竞争目标. 多种方法 (高风险/模糊) 生成 2-3 种策略.',
|
|
8
|
-
whenToUse: [
|
|
9
|
-
'用户要你起草一封邮件/消息',
|
|
10
|
-
'高风险沟通 (谈判、道歉、设定边界)',
|
|
11
|
-
'需要适配渠道 (邮件 vs Slack vs 短信)',
|
|
12
|
-
],
|
|
13
|
-
whenNotToUse: [
|
|
14
|
-
'用户只是要写笔记/便签',
|
|
15
|
-
'对话中直接回复',
|
|
16
|
-
],
|
|
17
|
-
parameters: [
|
|
18
|
-
{ name: 'kind', type: 'enum', required: true, description: 'email | textMessage | other', enumValues: ['email', 'textMessage', 'other'] },
|
|
19
|
-
{ name: 'summary_title', type: 'string', required: true, description: '消息的摘要标题' },
|
|
20
|
-
{ name: 'variants', type: 'array', required: true, description: '至少 1 个变体', minItems: 1, items: {
|
|
21
|
-
name: 'variant', type: 'object', required: true, description: '变体', properties: [
|
|
22
|
-
{ name: 'label', type: 'string', required: true, description: '变体标签' },
|
|
23
|
-
{ name: 'body', type: 'string', required: true, description: '消息内容' },
|
|
24
|
-
{ name: 'subject', type: 'string', required: false, description: '邮件主题 (仅 email)' },
|
|
25
|
-
],
|
|
26
|
-
} },
|
|
27
|
-
],
|
|
28
|
-
callExample: `[TOOL:message_compose_v1]
|
|
29
|
-
[P:kind]email
|
|
30
|
-
[P:summary_title]Follow-up on Q3 review
|
|
31
|
-
[P:variants]${'${'}JSON.stringify([{"label":"direct","subject":"Quick follow-up","body":"..."}])[ENDTOOL]`,
|
|
32
|
-
layerId: 'tool.manifest',
|
|
33
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { ToolManifest } from './types.js';
|
|
2
|
-
|
|
3
|
-
export const places_search: ToolManifest = {
|
|
4
|
-
id: 'places_search',
|
|
5
|
-
name: 'places_search',
|
|
6
|
-
oneLine: '使用 Google Places 搜索地点/商户/餐厅/景点 (多查询).',
|
|
7
|
-
description: '单次调用支持多个查询. 多个查询可用于: 高效的行程规划, 拆解广泛或抽象的请求. 包含更广泛的区域以避免同名地点冲突.',
|
|
8
|
-
whenToUse: [
|
|
9
|
-
'用户问某地有什么 (餐厅/景点/酒店)',
|
|
10
|
-
'行程规划 (多地点)',
|
|
11
|
-
'需要 place_id 以便后续在地图展示',
|
|
12
|
-
],
|
|
13
|
-
whenNotToUse: [
|
|
14
|
-
'需要地点坐标 (问 GPS)',
|
|
15
|
-
'只问天气 (用 weather_fetch)',
|
|
16
|
-
],
|
|
17
|
-
parameters: [
|
|
18
|
-
{ name: 'queries', type: 'array', required: true, description: '1-10 个查询', minItems: 1, maxItems: 10, items: {
|
|
19
|
-
name: 'q', type: 'object', required: true, description: '单查询', properties: [
|
|
20
|
-
{ name: 'query', type: 'string', required: true, description: '自然语言搜索' },
|
|
21
|
-
{ name: 'max_results', type: 'integer', required: false, description: '1-10, 默认 5', minimum: 1, maximum: 10, default: 5 }
|
|
22
|
-
],
|
|
23
|
-
} },
|
|
24
|
-
{ name: 'location_bias_lat', type: 'number', required: false, description: '可选纬度' },
|
|
25
|
-
{ name: 'location_bias_lng', type: 'number', required: false, description: '可选经度' },
|
|
26
|
-
{ name: 'location_bias_radius', type: 'number', required: false, description: '米 (默认 5000)', default: 5000 }
|
|
27
|
-
],
|
|
28
|
-
callExample: `[TOOL:places_search]
|
|
29
|
-
[P:queries]${'${'}JSON.stringify([{"query":"ramen restaurants Tokyo"}])[ENDTOOL]`,
|
|
30
|
-
layerId: 'tool.manifest',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const places_map_display_v0: ToolManifest = {
|
|
34
|
-
id: 'places_map_display_v0',
|
|
35
|
-
name: 'places_map_display_v0',
|
|
36
|
-
oneLine: '在地图上展示地点, 附上你的推荐和内行小贴士.',
|
|
37
|
-
description: '工作流: 先用 places_search 获取 place_id, 然后用 place_id 引用调用本工具. 两种模式: 简单标记 (locations) 或行程 (days).',
|
|
38
|
-
whenToUse: [
|
|
39
|
-
'用户需要看地点在地图上',
|
|
40
|
-
'行程规划, 需要可视化',
|
|
41
|
-
],
|
|
42
|
-
whenNotToUse: [
|
|
43
|
-
'只问地点信息 (用 places_search 文字回答)',
|
|
44
|
-
],
|
|
45
|
-
parameters: [
|
|
46
|
-
{ name: 'locations', type: 'array', required: false, description: '简单标记模式', minItems: 1, maxItems: 50, items: {
|
|
47
|
-
name: 'loc', type: 'object', required: true, description: '地点', properties: [
|
|
48
|
-
{ name: 'name', type: 'string', required: true, description: '地点名' },
|
|
49
|
-
{ name: 'latitude', type: 'number', required: true, description: '纬度' },
|
|
50
|
-
{ name: 'longitude', type: 'number', required: true, description: '经度' },
|
|
51
|
-
{ name: 'place_id', type: 'string', required: false, description: '从 places_search 复制' },
|
|
52
|
-
{ name: 'notes', type: 'string', required: false, description: '你的小贴士' },
|
|
53
|
-
{ name: 'address', type: 'string', required: false, description: '自定义地点的地址 (没有 place_id 时用)' },
|
|
54
|
-
{ name: 'arrival_time', type: 'string', required: false, description: '到达时间 (用于行程, e.g. "8:00 AM")' },
|
|
55
|
-
{ name: 'duration_minutes', type: 'integer', required: false, description: '停留时长 (分钟)' },
|
|
56
|
-
],
|
|
57
|
-
} },
|
|
58
|
-
{ name: 'days', type: 'array', required: false, description: '行程模式', minItems: 1, maxItems: 30, items: {
|
|
59
|
-
name: 'day', type: 'object', required: true, description: '单日', properties: [
|
|
60
|
-
{ name: 'day_number', type: 'integer', required: true, description: '天数 (从 1 开始)', minimum: 1 },
|
|
61
|
-
{ name: 'title', type: 'string', required: false, description: '日期标题' },
|
|
62
|
-
{ name: 'narrative', type: 'string', required: false, description: '该日叙述' },
|
|
63
|
-
{ name: 'locations', type: 'array', required: true, description: '该日地点', minItems: 1, maxItems: 50, items: {
|
|
64
|
-
name: 'loc', type: 'object', required: true, description: '地点', properties: [
|
|
65
|
-
{ name: 'name', type: 'string', required: true, description: '地点名' },
|
|
66
|
-
{ name: 'latitude', type: 'number', required: true, description: '纬度' },
|
|
67
|
-
{ name: 'longitude', type: 'number', required: true, description: '经度' },
|
|
68
|
-
{ name: 'place_id', type: 'string', required: false, description: '从 places_search 复制' },
|
|
69
|
-
{ name: 'notes', type: 'string', required: false, description: '你的小贴士' },
|
|
70
|
-
{ name: 'address', type: 'string', required: false, description: '自定义地点地址' },
|
|
71
|
-
{ name: 'arrival_time', type: 'string', required: false, description: '到达时间' },
|
|
72
|
-
{ name: 'duration_minutes', type: 'integer', required: false, description: '停留时长 (分钟)' },
|
|
73
|
-
],
|
|
74
|
-
} },
|
|
75
|
-
],
|
|
76
|
-
} },
|
|
77
|
-
{ name: 'mode', type: 'enum', required: false, description: 'markers | itinerary', enumValues: ['markers', 'itinerary'] },
|
|
78
|
-
{ name: 'travel_mode', type: 'enum', required: false, description: 'driving | walking | transit | bicycling', enumValues: ['driving', 'walking', 'transit', 'bicycling'] },
|
|
79
|
-
{ name: 'show_route', type: 'boolean', required: false, description: '是否显示路线' },
|
|
80
|
-
{ name: 'title', type: 'string', required: false, description: '行程标题' },
|
|
81
|
-
{ name: 'narrative', type: 'string', required: false, description: '行程叙述' },
|
|
82
|
-
],
|
|
83
|
-
callExample: `[TOOL:places_map_display_v0]
|
|
84
|
-
[P:locations]${'${'}JSON.stringify([{"name":"Senso-ji","latitude":35.7148,"longitude":139.7967,"place_id":"ChIJ..."}])[ENDTOOL]`,
|
|
85
|
-
layerId: 'tool.manifest',
|
|
86
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ToolManifest } from './types.js';
|
|
2
|
-
|
|
3
|
-
export const present_files: ToolManifest = {
|
|
4
|
-
id: 'present_files',
|
|
5
|
-
name: 'present_files',
|
|
6
|
-
oneLine: '让文件对用户可见, 客户端界面中查看和渲染.',
|
|
7
|
-
description: '接收来自容器文件系统的文件路径数组, 返回客户端可访问文件的输出路径. 输出路径按与输入路径相同的顺序返回. 多个文件可在单次调用中高效呈现. 如果文件不在输出目录中, 会自动复制到该目录.',
|
|
8
|
-
whenToUse: [
|
|
9
|
-
'让用户可以查看、下载或与文件交互',
|
|
10
|
-
'一次展示多个相关文件',
|
|
11
|
-
'创建了应向用户展示的文件之后',
|
|
12
|
-
],
|
|
13
|
-
whenNotToUse: [
|
|
14
|
-
'只是为了自己的处理而需要读取文件内容',
|
|
15
|
-
'临时或中间文件',
|
|
16
|
-
],
|
|
17
|
-
parameters: [
|
|
18
|
-
{ name: 'filepaths', type: 'array', required: true, description: '至少 1 个文件路径', minItems: 1, items: { name: 'path', type: 'string', required: true, description: '容器内路径' } },
|
|
19
|
-
],
|
|
20
|
-
callExample: `[TOOL:present_files]
|
|
21
|
-
[P:filepaths]${'${'}JSON.stringify(["/home/bolloon/report.md"])[ENDTOOL]`,
|
|
22
|
-
layerId: 'tool.manifest',
|
|
23
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ToolManifest } from './types.js';
|
|
2
|
-
|
|
3
|
-
export const recipe_display_v0: ToolManifest = {
|
|
4
|
-
id: 'recipe_display_v0',
|
|
5
|
-
name: 'recipe_display_v0',
|
|
6
|
-
oneLine: '显示带可调整份量的交互式食谱.',
|
|
7
|
-
description: '用户要求食谱、烹饪说明或食物准备指南时使用. 该组件允许用户通过调整份量控件按比例缩放所有食材的用量.',
|
|
8
|
-
whenToUse: [
|
|
9
|
-
'用户问食谱',
|
|
10
|
-
'需要比例缩放 (份量调整)',
|
|
11
|
-
],
|
|
12
|
-
whenNotToUse: [
|
|
13
|
-
'用户只要食材列表 (用文字)',
|
|
14
|
-
'用户问餐厅推荐 (用 places_search)',
|
|
15
|
-
],
|
|
16
|
-
parameters: [
|
|
17
|
-
{ name: 'title', type: 'string', required: true, description: '食谱名称' },
|
|
18
|
-
{ name: 'base_servings', type: 'integer', required: false, description: '基础份数 (默认 4)' },
|
|
19
|
-
{ name: 'description', type: 'string', required: false, description: '简短描述' },
|
|
20
|
-
{ name: 'ingredients', type: 'array', required: true, description: '食材', items: {
|
|
21
|
-
name: 'ing', type: 'object', required: true, description: '食材', properties: [
|
|
22
|
-
{ name: 'id', type: 'string', required: true, description: '唯一 ID' },
|
|
23
|
-
{ name: 'amount', type: 'number', required: true, description: '数量', minimum: 0 },
|
|
24
|
-
{ name: 'unit', type: 'enum', required: false, description: 'g/kg/ml/l/tsp/tbsp/cup/fl_oz/oz/lb/pinch', enumValues: ['g','kg','ml','l','tsp','tbsp','cup','fl_oz','oz','lb','pinch'] },
|
|
25
|
-
{ name: 'name', type: 'string', required: true, description: '显示名 (整体可数项, 把 counting noun 放在这里)' },
|
|
26
|
-
],
|
|
27
|
-
} },
|
|
28
|
-
{ name: 'steps', type: 'array', required: true, description: '步骤', items: {
|
|
29
|
-
name: 's', type: 'object', required: true, description: '步骤', properties: [
|
|
30
|
-
{ name: 'id', type: 'string', required: true, description: '唯一 ID' },
|
|
31
|
-
{ name: 'title', type: 'string', required: true, description: '步骤摘要' },
|
|
32
|
-
{ name: 'content', type: 'string', required: true, description: '完整指令 (用 {id} 引用食材)' },
|
|
33
|
-
{ name: 'timer_seconds', type: 'integer', required: false, description: '等待/烹饪计时秒数', minimum: 0 }
|
|
34
|
-
],
|
|
35
|
-
} },
|
|
36
|
-
{ name: 'notes', type: 'string', required: false, description: '附加说明' },
|
|
37
|
-
],
|
|
38
|
-
callExample: `[TOOL:recipe_display_v0]
|
|
39
|
-
[P:title]Pasta
|
|
40
|
-
[P:ingredients]${'${'}JSON.stringify([{"id":"a1","amount":500,"name":"pasta"}])[ENDTOOL]`,
|
|
41
|
-
layerId: 'tool.manifest',
|
|
42
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ToolManifest } from './types.js';
|
|
2
|
-
|
|
3
|
-
export const recommend_bolloon_apps: ToolManifest = {
|
|
4
|
-
id: 'recommend_bolloon_apps',
|
|
5
|
-
name: 'recommend_bolloon_apps',
|
|
6
|
-
oneLine: '推荐 1-3 个 Bolloon 应用或扩展.',
|
|
7
|
-
description: '当用户正在处理的事情可能更适合用 Bolloon 聊天以外的应用来完成时, 展示此建议. 仅推荐与用户当前用例相关的应用, 并按相关性排序.',
|
|
8
|
-
whenToUse: [
|
|
9
|
-
'编码任务 (Bolloon Code)',
|
|
10
|
-
'知识工作 (Cowork)',
|
|
11
|
-
'处理电子表格 (Excel) 或幻灯片 (PowerPoint)',
|
|
12
|
-
'浏览器自动化 (Chrome)',
|
|
13
|
-
],
|
|
14
|
-
whenNotToUse: [
|
|
15
|
-
'用户已明确不想离开对话',
|
|
16
|
-
'没有相关应用',
|
|
17
|
-
],
|
|
18
|
-
parameters: [
|
|
19
|
-
{ name: 'app_ids', type: 'array', required: true, description: '应用 ID 数组', items: {
|
|
20
|
-
name: 'id', type: 'string', required: true, description: '应用 ID (如 desktop/ios/android/code_terminal/code_vscode/code_jetbrains/code_slack/excel/powerpoint/chrome)',
|
|
21
|
-
} },
|
|
22
|
-
],
|
|
23
|
-
callExample: '[TOOL:recommend_bolloon_apps] [P:app_ids] ["code_vscode","excel"] [ENDTOOL]',
|
|
24
|
-
layerId: 'tool.manifest',
|
|
25
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ToolManifest } from './types.js';
|
|
2
|
-
|
|
3
|
-
export const str_replace: ToolManifest = {
|
|
4
|
-
id: 'str_replace',
|
|
5
|
-
name: 'str_replace',
|
|
6
|
-
oneLine: '将文件中的唯一字符串替换为另一个.',
|
|
7
|
-
description: 'old_str 必须与原始文件内容完全匹配且只出现一次. 从 view 输出复制时, 不要包含行号前缀(空格 + 行号 + 制表符). 在编辑前立即查看文件; 任何成功的 str_replace 之后, 该文件之前的 view 输出已失效 — 在对同一文件进行进一步编辑之前请重新查看. /mnt/* 路径只读, 需先复制到可写位置.',
|
|
8
|
-
whenToUse: [
|
|
9
|
-
'编辑已有文件的小改动',
|
|
10
|
-
'精确替换单段文本',
|
|
11
|
-
],
|
|
12
|
-
whenNotToUse: [
|
|
13
|
-
'创建新文件 (用 create_file)',
|
|
14
|
-
'完全重写文件 (用 create_file + 删除)',
|
|
15
|
-
],
|
|
16
|
-
parameters: [
|
|
17
|
-
{ name: 'description', type: 'string', required: true, description: '为什么我要做这个编辑' },
|
|
18
|
-
{ name: 'old_str', type: 'string', required: true, description: '要被替换的字符串 (必须唯一)' },
|
|
19
|
-
{ name: 'new_str', type: 'string', required: true, description: '新字符串 (空字符串 = 删除)', default: '' },
|
|
20
|
-
{ name: 'path', type: 'string', required: true, description: '文件路径' },
|
|
21
|
-
],
|
|
22
|
-
callExample: `[TOOL:str_replace]
|
|
23
|
-
[P:description]修复 typo
|
|
24
|
-
[P:old_str]recieve
|
|
25
|
-
[P:new_str]receive
|
|
26
|
-
[P:path]/home/bolloon/main.py
|
|
27
|
-
[ENDTOOL]`,
|
|
28
|
-
layerId: 'tool.manifest',
|
|
29
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tool-manifest/types.ts — 工具清单的类型
|
|
3
|
-
*
|
|
4
|
-
* 设计原则: schema 在代码侧(结构化数据), description/when-to-use 在代码侧,
|
|
5
|
-
* prompt 里只嵌"调用格式 + 名字 + 一句话描述" — 节省 LLM 注意力.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export interface ToolParameter {
|
|
9
|
-
name: string;
|
|
10
|
-
type: 'string' | 'integer' | 'number' | 'boolean' | 'array' | 'object' | 'enum';
|
|
11
|
-
required: boolean;
|
|
12
|
-
description: string;
|
|
13
|
-
/** 枚举值 (type='enum' 时) */
|
|
14
|
-
enumValues?: string[];
|
|
15
|
-
/** 默认值 (LLM 不传时用) */
|
|
16
|
-
default?: string | number | boolean;
|
|
17
|
-
/** 嵌套对象的字段 (type='object' 时) */
|
|
18
|
-
properties?: ToolParameter[];
|
|
19
|
-
/** 数组元素 (type='array' 时) */
|
|
20
|
-
items?: ToolParameter;
|
|
21
|
-
/** 数组最小项数 (type='array' 时) */
|
|
22
|
-
minItems?: number;
|
|
23
|
-
/** 数组最大项数 (type='array' 时) */
|
|
24
|
-
maxItems?: number;
|
|
25
|
-
/** 数字最小值 (type='integer'/'number' 时) */
|
|
26
|
-
minimum?: number;
|
|
27
|
-
/** 数字最大值 (type='integer'/'number' 时) */
|
|
28
|
-
maximum?: number;
|
|
29
|
-
/** 字符串格式约束 (e.g. 'uri', 'date-time') */
|
|
30
|
-
format?: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface ToolManifest {
|
|
34
|
-
/** 工具 ID, 跟 prompt 里调用的 {name} 一致 */
|
|
35
|
-
id: string;
|
|
36
|
-
/** 显示名 */
|
|
37
|
-
name: string;
|
|
38
|
-
/** 一句话描述 (进 prompt) */
|
|
39
|
-
oneLine: string;
|
|
40
|
-
/** 详细描述 (代码侧, 不进 prompt) */
|
|
41
|
-
description: string;
|
|
42
|
-
/** 何时使用 (进 prompt) */
|
|
43
|
-
whenToUse: string[];
|
|
44
|
-
/** 何时不使用 (进 prompt) */
|
|
45
|
-
whenNotToUse: string[];
|
|
46
|
-
/** 输入参数 schema (代码侧, 不进 prompt) */
|
|
47
|
-
parameters: ToolParameter[];
|
|
48
|
-
/** 一个调用示例 (进 prompt, 1-3 行) */
|
|
49
|
-
callExample: string;
|
|
50
|
-
/** 在 system-prompt 里对应的 layer ID (可选) */
|
|
51
|
-
layerId?: string;
|
|
52
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ToolManifest } from './types.js';
|
|
2
|
-
|
|
3
|
-
export const view: ToolManifest = {
|
|
4
|
-
id: 'view',
|
|
5
|
-
name: 'view',
|
|
6
|
-
oneLine: '查看文本、图像和目录列表.',
|
|
7
|
-
description: '支持的路径类型: 目录 (列出文件和目录, 最多 2 层深度, 忽略隐藏项和 node_modules); 图像文件 (.jpg, .jpeg, .png, .gif, .webp) 以可视方式显示; 文本文件显示带行号的内容 (前缀仅用于显示 — 不要在 str_replace 的 old_str 中包含它). 可以指定 view_range 来查看特定行.',
|
|
8
|
-
whenToUse: [
|
|
9
|
-
'读取已有文件的内容',
|
|
10
|
-
'看图像文件',
|
|
11
|
-
'列目录',
|
|
12
|
-
],
|
|
13
|
-
whenNotToUse: [
|
|
14
|
-
'创建新文件 (用 create_file)',
|
|
15
|
-
],
|
|
16
|
-
parameters: [
|
|
17
|
-
{ name: 'description', type: 'string', required: true, description: '为什么我要查看' },
|
|
18
|
-
{ name: 'path', type: 'string', required: true, description: '绝对路径' },
|
|
19
|
-
{ name: 'view_range', type: 'array', required: false, description: '[start, end] 1-indexed, end=-1 表示到末尾', minItems: 2, maxItems: 2, items: { name: 'r', type: 'integer', required: true, description: '行号' } }
|
|
20
|
-
],
|
|
21
|
-
callExample: `[TOOL:view]
|
|
22
|
-
[P:description]读 README
|
|
23
|
-
[P:path]/home/bolloon/README.md
|
|
24
|
-
[ENDTOOL]`,
|
|
25
|
-
layerId: 'tool.manifest',
|
|
26
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ToolManifest } from './types.js';
|
|
2
|
-
|
|
3
|
-
export const weather_fetch: ToolManifest = {
|
|
4
|
-
id: 'weather_fetch',
|
|
5
|
-
name: 'weather_fetch',
|
|
6
|
-
oneLine: '显示天气信息 (用用户家庭位置确定温度单位).',
|
|
7
|
-
description: '使用用户的家庭位置来确定温度单位: 美国用户使用华氏度, 其他用户使用摄氏度.',
|
|
8
|
-
whenToUse: [
|
|
9
|
-
'用户询问特定地点的天气',
|
|
10
|
-
'用户询问"我该带雨伞/外套吗"',
|
|
11
|
-
'用户在规划户外活动',
|
|
12
|
-
'用户询问"[城市]怎么样"(天气语境)',
|
|
13
|
-
],
|
|
14
|
-
whenNotToUse: [
|
|
15
|
-
'气候或历史天气问题',
|
|
16
|
-
'闲聊天气但未指定地点',
|
|
17
|
-
],
|
|
18
|
-
parameters: [
|
|
19
|
-
{ name: 'location_name', type: 'string', required: true, description: '人类可读地点名' },
|
|
20
|
-
{ name: 'latitude', type: 'number', required: true, description: '纬度' },
|
|
21
|
-
{ name: 'longitude', type: 'number', required: true, description: '经度' },
|
|
22
|
-
],
|
|
23
|
-
callExample: `[TOOL:weather_fetch]
|
|
24
|
-
[P:location_name]San Francisco, CA
|
|
25
|
-
[P:latitude]37.78
|
|
26
|
-
[P:longitude]-122.41
|
|
27
|
-
[ENDTOOL]`,
|
|
28
|
-
layerId: 'tool.manifest',
|
|
29
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { ToolManifest } from './types.js';
|
|
2
|
-
|
|
3
|
-
export const web_search: ToolManifest = {
|
|
4
|
-
id: 'web_search',
|
|
5
|
-
name: 'web_search',
|
|
6
|
-
oneLine: '搜索 Web (返回前 10 条结果).',
|
|
7
|
-
description: '当需要当前信息或信息可能自知识截止以来已发生变化时使用. 1-6 词查询最佳. 默认改写; 引用应是个罕见的例外.',
|
|
8
|
-
whenToUse: [
|
|
9
|
-
'当前状态 (谁担任某职位、什么政策生效)',
|
|
10
|
-
'时效性信息 (股价、新闻)',
|
|
11
|
-
'不识别的实体 (默认搜索)',
|
|
12
|
-
],
|
|
13
|
-
whenNotToUse: [
|
|
14
|
-
'永恒信息/成熟技术事实 (直接答)',
|
|
15
|
-
'已故人物 (不会变)',
|
|
16
|
-
],
|
|
17
|
-
parameters: [
|
|
18
|
-
{ name: 'query', type: 'string', required: true, description: '搜索查询 (1-6 词最佳)' },
|
|
19
|
-
],
|
|
20
|
-
callExample: `[TOOL:web_search]
|
|
21
|
-
[P:query]S&P 500 current price
|
|
22
|
-
[ENDTOOL]`,
|
|
23
|
-
layerId: 'tool.web_search',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const web_fetch: ToolManifest = {
|
|
27
|
-
id: 'web_fetch',
|
|
28
|
-
name: 'web_fetch',
|
|
29
|
-
oneLine: '获取指定 URL 网页的内容.',
|
|
30
|
-
description: '此函数只能获取用户直接提供的或由 web_search 和 web_fetch 工具的结果中返回的 EXACT URL. 此工具无法访问需要身份验证的内容, 例如私有 Google Docs 或登录墙后的页面. URL 必须包含协议.',
|
|
31
|
-
whenToUse: [
|
|
32
|
-
'web_search 摘要不够, 需要读完整文章',
|
|
33
|
-
'用户提供 URL 让你读',
|
|
34
|
-
],
|
|
35
|
-
whenNotToUse: [
|
|
36
|
-
'需要身份验证的页面',
|
|
37
|
-
'web_search 已经足够时',
|
|
38
|
-
],
|
|
39
|
-
parameters: [
|
|
40
|
-
{ name: 'url', type: 'string', required: true, description: '完整 URL (含协议, https://...)', format: 'uri' },
|
|
41
|
-
{ name: 'allowed_domains', type: 'array', required: false, description: '仅允许的域名白名单 (如 ["example.com","*.github.com"])', items: { name: 'd', type: 'string', required: true, description: '域名' } },
|
|
42
|
-
{ name: 'blocked_domains', type: 'array', required: false, description: '黑名单域名', items: { name: 'd', type: 'string', required: true, description: '域名' } },
|
|
43
|
-
{ name: 'html_extraction_method', type: 'string', required: false, description: 'HTML 提取方法 (e.g. "text"/"markdown")' },
|
|
44
|
-
{ name: 'is_zdr', type: 'boolean', required: false, description: '是否 Zero Data Retention 请求 (true 时不记录 URL)' },
|
|
45
|
-
{ name: 'text_content_token_limit', type: 'integer', required: false, description: 'token 限制', minimum: 0 },
|
|
46
|
-
{ name: 'web_fetch_pdf_extract_text', type: 'boolean', required: false, description: '是否提取 PDF 文本' },
|
|
47
|
-
{ name: 'web_fetch_rate_limit_key', type: 'string', required: false, description: '速率限制键' },
|
|
48
|
-
{ name: 'web_fetch_rate_limit_dark_launch', type: 'boolean', required: false, description: '速率限制暗启动模式' },
|
|
49
|
-
],
|
|
50
|
-
callExample: `[TOOL:web_fetch]
|
|
51
|
-
[P:url]https://example.com/article
|
|
52
|
-
[ENDTOOL]`,
|
|
53
|
-
layerId: 'tool.manifest',
|
|
54
|
-
};
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Video Generation API Configuration Store
|
|
3
|
-
*
|
|
4
|
-
* 视频生成模型配置(与 LLM 完全独立)。当前内置 Seedance(火山引擎 ARK)。
|
|
5
|
-
* Seedance 任务流: POST /contents/generations/tasks → 轮询 GET /contents/generations/tasks/{id}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as fs from 'fs/promises';
|
|
9
|
-
import * as path from 'path';
|
|
10
|
-
|
|
11
|
-
export type VideoProvider = 'seedance' | 'minimax-video';
|
|
12
|
-
|
|
13
|
-
export interface VideoProviderConfig {
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
apiKey: string;
|
|
16
|
-
baseUrl: string;
|
|
17
|
-
model: string;
|
|
18
|
-
/** 默认分辨率,如 720p / 1080p */
|
|
19
|
-
resolution?: string;
|
|
20
|
-
/** 默认时长(秒) */
|
|
21
|
-
duration?: number;
|
|
22
|
-
/** 默认宽高比,如 16:9 / 9:16 / 1:1 */
|
|
23
|
-
ratio?: string;
|
|
24
|
-
/** 是否需要 API Key(火山方舟需要) */
|
|
25
|
-
requiresApiKey?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface VideoConfig {
|
|
29
|
-
activeProvider: VideoProvider;
|
|
30
|
-
providers: Record<VideoProvider, VideoProviderConfig>;
|
|
31
|
-
updatedAt: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const CONFIG_DIR = path.join(process.env.HOME || '/tmp', '.bolloon');
|
|
35
|
-
const CONFIG_PATH = path.join(CONFIG_DIR, 'video-config.json');
|
|
36
|
-
|
|
37
|
-
export const DEFAULT_VIDEO_PROVIDER_CONFIGS: Record<VideoProvider, VideoProviderConfig> = {
|
|
38
|
-
seedance: {
|
|
39
|
-
enabled: false,
|
|
40
|
-
apiKey: '',
|
|
41
|
-
baseUrl: 'https://ark.cn-beijing.volces.com/api/v3',
|
|
42
|
-
// 文生视频 lite 版(也支持图生视频,加 --resolution 等参数)
|
|
43
|
-
model: 'doubao-seedance-1-0-lite-t2v-250428',
|
|
44
|
-
resolution: '720p',
|
|
45
|
-
duration: 5,
|
|
46
|
-
ratio: '16:9',
|
|
47
|
-
requiresApiKey: true
|
|
48
|
-
},
|
|
49
|
-
'minimax-video': {
|
|
50
|
-
enabled: false,
|
|
51
|
-
apiKey: '',
|
|
52
|
-
baseUrl: 'https://api.minimaxi.com/v1',
|
|
53
|
-
model: 'MiniMax-video-01',
|
|
54
|
-
resolution: '720p',
|
|
55
|
-
duration: 6,
|
|
56
|
-
ratio: '16:9',
|
|
57
|
-
requiresApiKey: true
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const VIDEO_PROVIDER_INFO: Record<VideoProvider, { name: string; description: string; requiresApiKey: boolean; docs?: string }> = {
|
|
62
|
-
seedance: {
|
|
63
|
-
name: 'Seedance (火山方舟)',
|
|
64
|
-
description: '字节跳动文生视频 / 图生视频模型',
|
|
65
|
-
requiresApiKey: true,
|
|
66
|
-
docs: 'https://www.volcengine.com/docs/82379'
|
|
67
|
-
},
|
|
68
|
-
'minimax-video': {
|
|
69
|
-
name: 'MiniMax Video',
|
|
70
|
-
description: 'MiniMax 文生视频 (Video-01)',
|
|
71
|
-
requiresApiKey: true,
|
|
72
|
-
docs: 'https://platform.minimaxi.com/document/Video%20Generation'
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
function getDefaultConfig(): VideoConfig {
|
|
77
|
-
const envConfigs: Partial<Record<VideoProvider, VideoProviderConfig>> = {};
|
|
78
|
-
|
|
79
|
-
if (process.env.SEEDANCE_API_KEY || process.env.ARK_API_KEY) {
|
|
80
|
-
envConfigs.seedance = {
|
|
81
|
-
...DEFAULT_VIDEO_PROVIDER_CONFIGS.seedance,
|
|
82
|
-
enabled: true,
|
|
83
|
-
apiKey: process.env.SEEDANCE_API_KEY || process.env.ARK_API_KEY || ''
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const sharedKey = process.env.MINIMAX_API_KEY || '';
|
|
88
|
-
if (sharedKey) {
|
|
89
|
-
envConfigs['minimax-video'] = {
|
|
90
|
-
...DEFAULT_VIDEO_PROVIDER_CONFIGS['minimax-video'],
|
|
91
|
-
enabled: true,
|
|
92
|
-
apiKey: sharedKey
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const activeProvider: VideoProvider = 'seedance';
|
|
97
|
-
|
|
98
|
-
const providers = { ...DEFAULT_VIDEO_PROVIDER_CONFIGS };
|
|
99
|
-
for (const [provider, config] of Object.entries(envConfigs)) {
|
|
100
|
-
if (config) {
|
|
101
|
-
providers[provider as VideoProvider] = config;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
activeProvider,
|
|
107
|
-
providers,
|
|
108
|
-
updatedAt: new Date().toISOString()
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
class VideoConfigStore {
|
|
113
|
-
private config: VideoConfig | null = null;
|
|
114
|
-
private initialized: boolean = false;
|
|
115
|
-
|
|
116
|
-
async initialize(): Promise<void> {
|
|
117
|
-
if (this.initialized) return;
|
|
118
|
-
|
|
119
|
-
try {
|
|
120
|
-
await fs.mkdir(CONFIG_DIR, { recursive: true });
|
|
121
|
-
const data = await fs.readFile(CONFIG_PATH, 'utf-8');
|
|
122
|
-
const loadedConfig = JSON.parse(data);
|
|
123
|
-
|
|
124
|
-
// 确保加载的配置包含所有默认供应商
|
|
125
|
-
const defaultProviders = Object.keys(DEFAULT_VIDEO_PROVIDER_CONFIGS) as VideoProvider[];
|
|
126
|
-
for (const provider of defaultProviders) {
|
|
127
|
-
if (!loadedConfig.providers[provider]) {
|
|
128
|
-
loadedConfig.providers[provider] = { ...DEFAULT_VIDEO_PROVIDER_CONFIGS[provider] };
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const activeProvider = loadedConfig.activeProvider as VideoProvider;
|
|
133
|
-
if (!activeProvider || !DEFAULT_VIDEO_PROVIDER_CONFIGS[activeProvider]) {
|
|
134
|
-
loadedConfig.activeProvider = 'seedance';
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
this.config = loadedConfig;
|
|
138
|
-
} catch {
|
|
139
|
-
this.config = getDefaultConfig();
|
|
140
|
-
await this.save();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
this.initialized = true;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
private async save(): Promise<void> {
|
|
147
|
-
if (!this.config) return;
|
|
148
|
-
this.config.updatedAt = new Date().toISOString();
|
|
149
|
-
await fs.writeFile(CONFIG_PATH, JSON.stringify(this.config, null, 2));
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
async getConfig(): Promise<VideoConfig> {
|
|
153
|
-
await this.initialize();
|
|
154
|
-
return { ...this.config! };
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
async getProvider(provider: VideoProvider): Promise<VideoProviderConfig | null> {
|
|
158
|
-
await this.initialize();
|
|
159
|
-
return this.config?.providers[provider] || null;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async getActiveProvider(): Promise<VideoProvider> {
|
|
163
|
-
await this.initialize();
|
|
164
|
-
return this.config?.activeProvider || 'seedance';
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async getActiveProviderConfig(): Promise<VideoProviderConfig | null> {
|
|
168
|
-
await this.initialize();
|
|
169
|
-
const provider = this.config?.activeProvider;
|
|
170
|
-
if (!provider) return null;
|
|
171
|
-
return this.config?.providers[provider] || null;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
async setActiveProvider(provider: VideoProvider): Promise<void> {
|
|
175
|
-
await this.initialize();
|
|
176
|
-
|
|
177
|
-
if (!this.config?.providers[provider]) {
|
|
178
|
-
throw new Error(`Unknown video provider: ${provider}`);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
this.config.activeProvider = provider;
|
|
182
|
-
await this.save();
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
async updateProvider(provider: VideoProvider, updates: Partial<VideoProviderConfig>): Promise<void> {
|
|
186
|
-
await this.initialize();
|
|
187
|
-
|
|
188
|
-
if (!this.config?.providers[provider]) {
|
|
189
|
-
throw new Error(`Unknown video provider: ${provider}`);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
this.config.providers[provider] = {
|
|
193
|
-
...this.config.providers[provider],
|
|
194
|
-
...updates
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
await this.save();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* 测试连接:只校验 API key 是否能被 ARK 接受(创建任务失败不算连接失败,
|
|
202
|
-
* 返回 401/403 才算失败)。
|
|
203
|
-
*/
|
|
204
|
-
async testProvider(provider: VideoProvider): Promise<{ success: boolean; error?: string; latency?: number }> {
|
|
205
|
-
await this.initialize();
|
|
206
|
-
|
|
207
|
-
const config = this.config?.providers[provider];
|
|
208
|
-
if (!config) {
|
|
209
|
-
return { success: false, error: 'Provider not configured' };
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (!config.enabled) {
|
|
213
|
-
return { success: false, error: 'Provider is not enabled' };
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (config.requiresApiKey && !config.apiKey) {
|
|
217
|
-
return { success: false, error: 'API key is required' };
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
const startTime = Date.now();
|
|
221
|
-
|
|
222
|
-
try {
|
|
223
|
-
// 列出可用模型(轻量级健康检查)。ARK 端点:GET /models
|
|
224
|
-
const response = await fetch(`${config.baseUrl.replace(/\/$/, '')}/models`, {
|
|
225
|
-
method: 'GET',
|
|
226
|
-
headers: { 'Authorization': `Bearer ${config.apiKey}` }
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
const latency = Date.now() - startTime;
|
|
230
|
-
|
|
231
|
-
if (response.ok) {
|
|
232
|
-
return { success: true, latency };
|
|
233
|
-
} else {
|
|
234
|
-
const errorText = await response.text().catch(() => 'Unknown error');
|
|
235
|
-
// 401 通常是 key 错误,给出针对性提示
|
|
236
|
-
const hint = response.status === 401
|
|
237
|
-
? '(请确认是火山方舟 ARK 的 API Key,不是 MiniMax / 其他平台)'
|
|
238
|
-
: response.status === 404
|
|
239
|
-
? '(端点不存在 — 火山方舟可能没有 /models,请检查 baseUrl)'
|
|
240
|
-
: '';
|
|
241
|
-
return {
|
|
242
|
-
success: false,
|
|
243
|
-
error: `HTTP ${response.status}: ${errorText.substring(0, 500)}${hint ? ' ' + hint : ''}`,
|
|
244
|
-
latency
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
} catch (error: any) {
|
|
248
|
-
return { success: false, error: error.message || 'Connection failed', latency: Date.now() - startTime };
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
getAllProviderInfo() {
|
|
253
|
-
return VIDEO_PROVIDER_INFO;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export const videoConfigStore = new VideoConfigStore();
|