foxclaw 0.1.0 → 0.1.3
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 +54 -29
- package/bin/foxclaw.cjs +51 -0
- package/index.js +4 -10
- package/package.json +46 -38
- package/python/.dockerignore +35 -0
- package/python/.env.example +173 -0
- package/python/.gitattributes +46 -0
- package/python/.github/workflows/ci.yml +167 -0
- package/python/.github/workflows/release.yml +183 -0
- package/python/CHANGELOG.md +57 -0
- package/python/CHANGELOG_CN.md +57 -0
- package/python/Dockerfile +64 -0
- package/python/LICENSE +21 -0
- package/python/MANIFEST.in +14 -0
- package/python/README.md +201 -0
- package/python/README_CN.md +336 -0
- package/python/bench/bm25_audit.py +186 -0
- package/python/bench/bm25_regression.py +177 -0
- package/python/bench/bm25_stress.py +155 -0
- package/python/bench/cd_audit.py +215 -0
- package/python/bench/chaos.py +140 -0
- package/python/bench/concurrency.py +103 -0
- package/python/bench/e2e_real_models.py +94 -0
- package/python/bench/llm_retry_test.py +241 -0
- package/python/bench/load_test.py +193 -0
- package/python/bench/vector_ivf_upgrade.py +128 -0
- package/python/docs/CHANNELS.md +195 -0
- package/python/docs/GOVERNANCE.md +164 -0
- package/python/docs/RELEASE.md +110 -0
- package/python/docs/RUN.md +75 -0
- package/python/docs/RUN_CN.md +121 -0
- package/python/docs//351/205/215/347/275/256/346/214/207/345/215/227.md +152 -0
- package/python/evals/__init__.py +0 -0
- package/python/evals/governance/README.md +61 -0
- package/python/evals/governance/__init__.py +0 -0
- package/python/evals/governance/cases.py +115 -0
- package/python/evals/governance/compare_embeddings.py +94 -0
- package/python/evals/governance/convergence.svg +11 -0
- package/python/evals/governance/report.json +371 -0
- package/python/evals/governance/run_evals.py +368 -0
- package/python/examples/governance_middleware_demo.py +72 -0
- package/python/examples/langgraph_governance_demo.py +104 -0
- package/python/examples/sample_itinerary.csv +6 -0
- package/python/examples/sample_knowledge.csv +9 -0
- package/python/examples/sample_transactions.csv +14 -0
- package/python/foxclaw/__init__.py +408 -0
- package/python/foxclaw/agents/__init__.py +12 -0
- package/python/foxclaw/agents/agents.py +35 -0
- package/python/foxclaw/agents/base.py +794 -0
- package/python/foxclaw/agents/impl/__init__.py +1 -0
- package/python/foxclaw/agents/impl/_helpers.py +70 -0
- package/python/foxclaw/agents/impl/finance.py +231 -0
- package/python/foxclaw/agents/impl/office.py +350 -0
- package/python/foxclaw/agents/impl/supervisor.py +592 -0
- package/python/foxclaw/agents/mixins/_context.py +128 -0
- package/python/foxclaw/agents/mixins/augment.py +143 -0
- package/python/foxclaw/agents/mixins/llm.py +67 -0
- package/python/foxclaw/agents/mixins/memory.py +41 -0
- package/python/foxclaw/agents/mixins/preference.py +131 -0
- package/python/foxclaw/agents/mixins/prompt.py +71 -0
- package/python/foxclaw/agents/mixins/skillbox.py +58 -0
- package/python/foxclaw/agents/mixins/tool_exec.py +417 -0
- package/python/foxclaw/api/__init__.py +224 -0
- package/python/foxclaw/api/_state.py +43 -0
- package/python/foxclaw/api/bootstrap.py +96 -0
- package/python/foxclaw/api/middleware.py +294 -0
- package/python/foxclaw/api/routes/ahs.py +404 -0
- package/python/foxclaw/api/routes/attachments.py +116 -0
- package/python/foxclaw/api/routes/browser.py +35 -0
- package/python/foxclaw/api/routes/domain.py +306 -0
- package/python/foxclaw/api/routes/knowledge.py +145 -0
- package/python/foxclaw/api/routes/llm_admin.py +449 -0
- package/python/foxclaw/api/routes/memory.py +105 -0
- package/python/foxclaw/api/routes/orchestration.py +39 -0
- package/python/foxclaw/api/routes/recovery.py +44 -0
- package/python/foxclaw/api/routes/review.py +266 -0
- package/python/foxclaw/api/routes/search.py +33 -0
- package/python/foxclaw/api/routes/system.py +311 -0
- package/python/foxclaw/api/routes/task.py +263 -0
- package/python/foxclaw/api/routes/ws.py +64 -0
- package/python/foxclaw/api/spine.py +52 -0
- package/python/foxclaw/browser/__init__.py +13 -0
- package/python/foxclaw/browser/action/__init__.py +1 -0
- package/python/foxclaw/browser/action/action_executor.py +50 -0
- package/python/foxclaw/browser/action/action_types.py +44 -0
- package/python/foxclaw/browser/action/action_verifier.py +68 -0
- package/python/foxclaw/browser/action/url_policy.py +143 -0
- package/python/foxclaw/browser/adapter/__init__.py +1 -0
- package/python/foxclaw/browser/adapter/base_adapter.py +23 -0
- package/python/foxclaw/browser/adapter/web_adapter.py +46 -0
- package/python/foxclaw/browser/driver/__init__.py +1 -0
- package/python/foxclaw/browser/driver/base_driver.py +61 -0
- package/python/foxclaw/browser/driver/playwright_driver.py +170 -0
- package/python/foxclaw/browser/perception/__init__.py +1 -0
- package/python/foxclaw/browser/perception/dom_extractor.py +42 -0
- package/python/foxclaw/browser/perception/element_indexer.py +56 -0
- package/python/foxclaw/browser/perception/semantic_reducer.py +33 -0
- package/python/foxclaw/browser/perception/snapshot.py +29 -0
- package/python/foxclaw/browser/service.py +144 -0
- package/python/foxclaw/browser/session/__init__.py +1 -0
- package/python/foxclaw/browser/session/session_manager.py +57 -0
- package/python/foxclaw/capability/__init__.py +12 -0
- package/python/foxclaw/capability/embedding_service.py +65 -0
- package/python/foxclaw/channels/__init__.py +138 -0
- package/python/foxclaw/channels/discord.py +175 -0
- package/python/foxclaw/channels/dispatcher.py +179 -0
- package/python/foxclaw/channels/feishu.py +215 -0
- package/python/foxclaw/channels/openclaw_bridge.py +151 -0
- package/python/foxclaw/channels/signing.py +187 -0
- package/python/foxclaw/channels/telegram.py +120 -0
- package/python/foxclaw/channels/weixin.py +215 -0
- package/python/foxclaw/cli.py +183 -0
- package/python/foxclaw/cognitive/__init__.py +4 -0
- package/python/foxclaw/cognitive/reasoner.py +81 -0
- package/python/foxclaw/cognitive/state.py +141 -0
- package/python/foxclaw/core/__init__.py +9 -0
- package/python/foxclaw/core/audit_chain.py +131 -0
- package/python/foxclaw/core/audit_sink.py +100 -0
- package/python/foxclaw/core/compaction.py +265 -0
- package/python/foxclaw/core/config.py +65 -0
- package/python/foxclaw/core/confirm_nonce.py +151 -0
- package/python/foxclaw/core/dispatch.py +27 -0
- package/python/foxclaw/core/envfile.py +48 -0
- package/python/foxclaw/core/failure_policy.py +142 -0
- package/python/foxclaw/core/gateway.py +81 -0
- package/python/foxclaw/core/governance_audit.py +171 -0
- package/python/foxclaw/core/idempotency.py +282 -0
- package/python/foxclaw/core/injection_guard.py +202 -0
- package/python/foxclaw/core/memory_adapter.py +489 -0
- package/python/foxclaw/core/metrics.py +88 -0
- package/python/foxclaw/core/model_router.py +985 -0
- package/python/foxclaw/core/paths.py +103 -0
- package/python/foxclaw/core/recovery.py +349 -0
- package/python/foxclaw/core/scheduler.py +141 -0
- package/python/foxclaw/core/secrets.py +131 -0
- package/python/foxclaw/core/sessions.py +155 -0
- package/python/foxclaw/core/settings.py +414 -0
- package/python/foxclaw/core/shared_write.py +186 -0
- package/python/foxclaw/core/steering_queue.py +154 -0
- package/python/foxclaw/core/system_bus.py +84 -0
- package/python/foxclaw/core/thought_chain.py +316 -0
- package/python/foxclaw/core/token_meter.py +231 -0
- package/python/foxclaw/core/tools.py +164 -0
- package/python/foxclaw/core/tracing.py +375 -0
- package/python/foxclaw/core/truth_pipeline.py +110 -0
- package/python/foxclaw/core/update_check.py +149 -0
- package/python/foxclaw/core/vec_recall_adapter.py +477 -0
- package/python/foxclaw/core/verify.py +173 -0
- package/python/foxclaw/core/web_search.py +218 -0
- package/python/foxclaw/finance/__init__.py +15 -0
- package/python/foxclaw/finance/evidence.py +149 -0
- package/python/foxclaw/finance/fx.py +98 -0
- package/python/foxclaw/finance/graph.py +179 -0
- package/python/foxclaw/finance/models.py +146 -0
- package/python/foxclaw/finance/nlparse.py +515 -0
- package/python/foxclaw/finance/policy.py +301 -0
- package/python/foxclaw/finance/reasoner.py +121 -0
- package/python/foxclaw/finance/reasoning.py +319 -0
- package/python/foxclaw/finance/reconcile.py +175 -0
- package/python/foxclaw/finance/runtime.py +500 -0
- package/python/foxclaw/governance/__init__.py +24 -0
- package/python/foxclaw/governance/middleware.py +176 -0
- package/python/foxclaw/harness/__init__.py +17 -0
- package/python/foxclaw/harness/_base.py +66 -0
- package/python/foxclaw/harness/_policy.py +340 -0
- package/python/foxclaw/harness/drift.py +77 -0
- package/python/foxclaw/harness/event_bus.py +28 -0
- package/python/foxclaw/harness/harness.py +358 -0
- package/python/foxclaw/harness/loop_detection.py +145 -0
- package/python/foxclaw/itinerary/__init__.py +10 -0
- package/python/foxclaw/itinerary/amap_client.py +114 -0
- package/python/foxclaw/itinerary/models.py +80 -0
- package/python/foxclaw/itinerary/reasoner.py +96 -0
- package/python/foxclaw/itinerary/reasoning.py +168 -0
- package/python/foxclaw/itinerary/runtime.py +144 -0
- package/python/foxclaw/kernel/__init__.py +13 -0
- package/python/foxclaw/kernel/capabilities.py +72 -0
- package/python/foxclaw/kernel/policy_gate.py +108 -0
- package/python/foxclaw/kernel/process_manager.py +186 -0
- package/python/foxclaw/kernel/scheduler.py +125 -0
- package/python/foxclaw/kernel/sentinel.py +443 -0
- package/python/foxclaw/kernel/sentinel_client.py +243 -0
- package/python/foxclaw/kernel/spine.py +97 -0
- package/python/foxclaw/knowledge/__init__.py +360 -0
- package/python/foxclaw/knowledge/truth_crystallizer.py +89 -0
- package/python/foxclaw/learning/__init__.py +12 -0
- package/python/foxclaw/learning/knowledge_graph.py +144 -0
- package/python/foxclaw/learning/models.py +93 -0
- package/python/foxclaw/learning/reasoner.py +67 -0
- package/python/foxclaw/learning/runtime.py +351 -0
- package/python/foxclaw/learning/spaced_repetition.py +91 -0
- package/python/foxclaw/mcp_server.py +188 -0
- package/python/foxclaw/orchestration/__init__.py +167 -0
- package/python/foxclaw/pipeline/__init__.py +23 -0
- package/python/foxclaw/pipeline/cognitive_pipeline.py +429 -0
- package/python/foxclaw/pipeline/stage_meta.py +21 -0
- package/python/foxclaw/pipeline/supervisor_stages.py +201 -0
- package/python/foxclaw/planning/__init__.py +17 -0
- package/python/foxclaw/planning/llm_planner.py +232 -0
- package/python/foxclaw/planning/planner.py +94 -0
- package/python/foxclaw/search/__init__.py +24 -0
- package/python/foxclaw/search/agent_port.py +190 -0
- package/python/foxclaw/search/evidence.py +109 -0
- package/python/foxclaw/search/external_search.py +50 -0
- package/python/foxclaw/search/hkc_read_port.py +60 -0
- package/python/foxclaw/search/internal_search.py +71 -0
- package/python/foxclaw/search/models.py +127 -0
- package/python/foxclaw/search/planner.py +44 -0
- package/python/foxclaw/search/retriever.py +39 -0
- package/python/foxclaw/search/runtime.py +127 -0
- package/python/foxclaw/search/strategy.py +44 -0
- package/python/foxclaw/skills/__init__.py +559 -0
- package/python/foxclaw/skills/archive.py +111 -0
- package/python/foxclaw/skills/fetch.py +226 -0
- package/python/foxclaw/skills/hooks_spec.py +69 -0
- package/python/foxclaw/skills/install_cmd.py +216 -0
- package/python/foxclaw/skills/lifecycle.py +252 -0
- package/python/foxclaw/skills/markdown_skill.py +175 -0
- package/python/foxclaw/skills/markdown_store.py +39 -0
- package/python/foxclaw/skills/mcp_client.py +184 -0
- package/python/foxclaw/skills/mcp_store.py +40 -0
- package/python/foxclaw/skills/permission.py +145 -0
- package/python/foxclaw/skills/pipeline.py +354 -0
- package/python/foxclaw/skills/policy.py +74 -0
- package/python/foxclaw/skills/review.py +72 -0
- package/python/foxclaw/skills/store.py +57 -0
- package/python/frontend/assets/core_bg.jpg +0 -0
- package/python/frontend/deck/auth.js +25 -0
- package/python/frontend/deck/chat_model_picker.js +483 -0
- package/python/frontend/deck/domain.js +276 -0
- package/python/frontend/deck/main.js +1806 -0
- package/python/frontend/deck/markdown.js +44 -0
- package/python/frontend/deck/settings.js +307 -0
- package/python/frontend/deck/state.js +5 -0
- package/python/frontend/deck/util.js +4 -0
- package/python/frontend/deck/visuals.js +190 -0
- package/python/frontend/deck.css +855 -0
- package/python/frontend/deck.html +686 -0
- package/python/frontend/deck_v2.html +341 -0
- package/python/frontend/planet/index.html +266 -0
- package/python/frontend/planet/planet.css +579 -0
- package/python/frontend/planet/planet.js +1436 -0
- package/python/frontend/planet/vendor/three.core.min.js +6 -0
- package/python/frontend/planet/vendor/three.module.min.js +6 -0
- package/python/frontend/v3/assets/index-CQSBdxk4.js +34 -0
- package/python/frontend/v3/assets/index-D5nIsjms.css +1 -0
- package/python/frontend/v3/index.html +15 -0
- package/python/frontend/widget_runtime.js +252 -0
- package/python/frontend/widgets.js +639 -0
- package/python/frontend_src/index.html +14 -0
- package/python/frontend_src/package-lock.json +1376 -0
- package/python/frontend_src/package.json +19 -0
- package/python/frontend_src/src/App.vue +58 -0
- package/python/frontend_src/src/api.js +82 -0
- package/python/frontend_src/src/components/ChatDock.vue +365 -0
- package/python/frontend_src/src/components/ComposerMenu.vue +75 -0
- package/python/frontend_src/src/components/DocViewer.vue +162 -0
- package/python/frontend_src/src/components/Inspector.vue +235 -0
- package/python/frontend_src/src/components/LeftRail.vue +415 -0
- package/python/frontend_src/src/components/MenuPopover.vue +128 -0
- package/python/frontend_src/src/components/MessageStream.vue +389 -0
- package/python/frontend_src/src/components/ModelPicker.vue +350 -0
- package/python/frontend_src/src/components/QuickIngest.vue +112 -0
- package/python/frontend_src/src/components/Stage.vue +272 -0
- package/python/frontend_src/src/components/ToolMenu.vue +141 -0
- package/python/frontend_src/src/components/TopBar.vue +118 -0
- package/python/frontend_src/src/components/panels/ActivityPanel.vue +82 -0
- package/python/frontend_src/src/components/panels/AgentsPanel.vue +83 -0
- package/python/frontend_src/src/components/panels/KnowledgePanel.vue +425 -0
- package/python/frontend_src/src/components/panels/MemoryPanel.vue +117 -0
- package/python/frontend_src/src/components/panels/PanelBox.vue +50 -0
- package/python/frontend_src/src/components/panels/ReviewPanel.vue +292 -0
- package/python/frontend_src/src/components/panels/SettingsPanel.vue +358 -0
- package/python/frontend_src/src/components/panels/TasksPanel.vue +73 -0
- package/python/frontend_src/src/components/panels/ToolsPanel.vue +746 -0
- package/python/frontend_src/src/components/panels/UsagePanel.vue +105 -0
- package/python/frontend_src/src/lib/fmt.js +44 -0
- package/python/frontend_src/src/lib/i18n.js +53 -0
- package/python/frontend_src/src/lib/locales/en.js +173 -0
- package/python/frontend_src/src/lib/locales/zh.js +174 -0
- package/python/frontend_src/src/lib/md.js +190 -0
- package/python/frontend_src/src/main.js +9 -0
- package/python/frontend_src/src/stores/app.js +91 -0
- package/python/frontend_src/src/stores/chat.js +450 -0
- package/python/frontend_src/src/stores/model.js +96 -0
- package/python/frontend_src/src/stores/panels.js +289 -0
- package/python/frontend_src/src/stores/profile.js +31 -0
- package/python/frontend_src/src/stores/system.js +25 -0
- package/python/frontend_src/src/styles/base.css +138 -0
- package/python/frontend_src/src/styles/panel.css +117 -0
- package/python/frontend_src/src/styles/tokens.css +78 -0
- package/python/frontend_src/vite.config.js +39 -0
- package/python/pyproject.toml +268 -0
- package/python/requirements.txt +311 -0
- package/python/skills/README.md +123 -0
- package/python/skills/execution-contract/SKILL.md +30 -0
- package/python/skills/general-assistant/SKILL.md +34 -0
- package/python/skills/planner/SKILL.md +33 -0
- package/python/skills/schedule-itinerary/SKILL.md +35 -0
- package/python/skills/skill-composition/SKILL.md +31 -0
- package/python/skills/skill-guard/SKILL.md +67 -0
- package/python/skills/skill-memory/SKILL.md +50 -0
- package/python/skills/skill-router/SKILL.md +35 -0
- package/python/tests/conftest.py +54 -0
- package/python/tests/run_all.py +200 -0
- package/python/tests/test_agent_lifecycle.py +326 -0
- package/python/tests/test_ahs_p2.py +393 -0
- package/python/tests/test_anthropic_tools.py +192 -0
- package/python/tests/test_api.py +97 -0
- package/python/tests/test_api_auth.py +79 -0
- package/python/tests/test_api_host_guard.py +69 -0
- package/python/tests/test_attachments.py +151 -0
- package/python/tests/test_audit_chain.py +116 -0
- package/python/tests/test_audit_sink.py +130 -0
- package/python/tests/test_browser.py +149 -0
- package/python/tests/test_browser_request_guard.py +180 -0
- package/python/tests/test_capabilities.py +152 -0
- package/python/tests/test_channel_signing.py +185 -0
- package/python/tests/test_channel_trust.py +109 -0
- package/python/tests/test_channels.py +174 -0
- package/python/tests/test_cli.py +46 -0
- package/python/tests/test_compaction_toolpair.py +119 -0
- package/python/tests/test_config_layering.py +61 -0
- package/python/tests/test_confirm_nonce.py +186 -0
- package/python/tests/test_context_compaction_wiring.py +124 -0
- package/python/tests/test_dispatch.py +89 -0
- package/python/tests/test_domain_evals.py +334 -0
- package/python/tests/test_domain_import.py +72 -0
- package/python/tests/test_domain_reasoners.py +134 -0
- package/python/tests/test_e2e.py +161 -0
- package/python/tests/test_emb_cache.py +97 -0
- package/python/tests/test_embedding_singleton.py +87 -0
- package/python/tests/test_envfile.py +83 -0
- package/python/tests/test_evals_smoke.py +90 -0
- package/python/tests/test_event_spine.py +174 -0
- package/python/tests/test_evidence_semantic.py +88 -0
- package/python/tests/test_evidence_sse.py +94 -0
- package/python/tests/test_file_ingest.py +135 -0
- package/python/tests/test_finance.py +144 -0
- package/python/tests/test_finance_ledger.py +245 -0
- package/python/tests/test_finance_persist.py +174 -0
- package/python/tests/test_gateway.py +125 -0
- package/python/tests/test_governance.py +421 -0
- package/python/tests/test_governance_audit.py +324 -0
- package/python/tests/test_governance_middleware.py +137 -0
- package/python/tests/test_hkc.py +268 -0
- package/python/tests/test_hkc_index_build_manager.py +306 -0
- package/python/tests/test_hkc_manifest_reuse.py +294 -0
- package/python/tests/test_hkc_search_event_sync.py +482 -0
- package/python/tests/test_import_path_guard.py +155 -0
- package/python/tests/test_injection_guard.py +193 -0
- package/python/tests/test_integration.py +117 -0
- package/python/tests/test_itinerary.py +100 -0
- package/python/tests/test_kee_semantic.py +84 -0
- package/python/tests/test_kernel.py +212 -0
- package/python/tests/test_learning.py +101 -0
- package/python/tests/test_llm_admin.py +145 -0
- package/python/tests/test_llm_planner.py +344 -0
- package/python/tests/test_markdown_skills.py +62 -0
- package/python/tests/test_markdown_skills_openclaw.py +66 -0
- package/python/tests/test_mcp_connectors.py +97 -0
- package/python/tests/test_mcp_guardian_discovery.py +87 -0
- package/python/tests/test_mcp_no_memory.py +43 -0
- package/python/tests/test_mcp_policy_gate.py +76 -0
- package/python/tests/test_mcp_server.py +92 -0
- package/python/tests/test_memory_recall.py +92 -0
- package/python/tests/test_metrics.py +58 -0
- package/python/tests/test_multi_chain.py +90 -0
- package/python/tests/test_multimodal.py +122 -0
- package/python/tests/test_negotiation.py +136 -0
- package/python/tests/test_orchestration.py +109 -0
- package/python/tests/test_orchestration_decoupled.py +103 -0
- package/python/tests/test_p3_p5_hardening.py +324 -0
- package/python/tests/test_parallel_dispatch.py +207 -0
- package/python/tests/test_pipeline.py +492 -0
- package/python/tests/test_plan_visible.py +86 -0
- package/python/tests/test_planner.py +88 -0
- package/python/tests/test_policy_gate.py +108 -0
- package/python/tests/test_profile.py +67 -0
- package/python/tests/test_readme_claims.py +163 -0
- package/python/tests/test_reasoner.py +170 -0
- package/python/tests/test_release_check.py +252 -0
- package/python/tests/test_resume_checkpoint.py +148 -0
- package/python/tests/test_routing.py +85 -0
- package/python/tests/test_scheduler.py +138 -0
- package/python/tests/test_search.py +194 -0
- package/python/tests/test_secrets.py +153 -0
- package/python/tests/test_semantic.py +69 -0
- package/python/tests/test_sessions.py +90 -0
- package/python/tests/test_settings.py +265 -0
- package/python/tests/test_shadow_learning.py +290 -0
- package/python/tests/test_shared_write.py +200 -0
- package/python/tests/test_skill_taint_gate.py +145 -0
- package/python/tests/test_skills.py +117 -0
- package/python/tests/test_skills_fetch.py +282 -0
- package/python/tests/test_stats_and_events.py +162 -0
- package/python/tests/test_streaming.py +55 -0
- package/python/tests/test_supervisor_pipeline.py +176 -0
- package/python/tests/test_supervisor_triage.py +102 -0
- package/python/tests/test_taint.py +112 -0
- package/python/tests/test_task_stream.py +74 -0
- package/python/tests/test_thinking_sse.py +66 -0
- package/python/tests/test_thinking_stream.py +76 -0
- package/python/tests/test_tool_center.py +113 -0
- package/python/tests/test_tool_parallel.py +113 -0
- package/python/tests/test_tool_params.py +99 -0
- package/python/tests/test_tool_use.py +229 -0
- package/python/tests/test_toplevel_concurrency.py +116 -0
- package/python/tests/test_tracing.py +256 -0
- package/python/tests/test_truth_crystallizer.py +125 -0
- package/python/tests/test_truth_flow.py +88 -0
- package/python/tests/test_update_check.py +95 -0
- package/python/tests/test_url_policy.py +53 -0
- package/python/tests/test_verify_evidence.py +212 -0
- package/python/tests/test_version_sync.py +100 -0
- package/python/tests/test_web_trigger.py +82 -0
- package/python/tools/check_faiss_type.py +30 -0
- package/python/tools/check_log.ps1 +38 -0
- package/python/tools/ivf_status.py +72 -0
- package/python/tools/mypy_baseline.txt +13 -0
- package/python/tools/mypy_ratchet.py +143 -0
- package/python/tools/pack.py +173 -0
- package/python/tools/release_check.py +349 -0
- package/python/tools/restart_foxclaw.ps1 +71 -0
- package/python/tools/shared_write_audit.py +190 -0
- package/python/tools/size_baseline.txt +28 -0
- package/python/tools/size_check.py +102 -0
- package/python/tools/strip_comments.py +228 -0
- package/python/tools/verify_env.bat +2 -0
- package/python/tools/verify_env.py +25 -0
- package/python/vendor/HMR_LICENSE +37 -0
- package/python/vendor/HMR_README.md +65 -0
- package/python/vendor/hkc/LICENSE +37 -0
- package/python/vendor/hkc/hkc_ace/__init__.py +0 -0
- package/python/vendor/hkc/hkc_ace/ace.py +457 -0
- package/python/vendor/hkc/hkc_ace/skill_taxonomy.json +465 -0
- package/python/vendor/hkc/hkc_api/__init__.py +0 -0
- package/python/vendor/hkc/hkc_api/container.py +416 -0
- package/python/vendor/hkc/hkc_api/ingest_jobs.py +103 -0
- package/python/vendor/hkc/hkc_api/main.py +157 -0
- package/python/vendor/hkc/hkc_api/routes/__init__.py +0 -0
- package/python/vendor/hkc/hkc_api/routes/ability.py +151 -0
- package/python/vendor/hkc/hkc_api/routes/config.py +51 -0
- package/python/vendor/hkc/hkc_api/routes/knowledge.py +630 -0
- package/python/vendor/hkc/hkc_api/routes/search.py +88 -0
- package/python/vendor/hkc/hkc_api/schemas.py +153 -0
- package/python/vendor/hkc/hkc_api/synthesis.py +179 -0
- package/python/vendor/hkc/hkc_core/__init__.py +0 -0
- package/python/vendor/hkc/hkc_core/graph/__init__.py +0 -0
- package/python/vendor/hkc/hkc_core/graph/base.py +188 -0
- package/python/vendor/hkc/hkc_core/graph/sqlite_store.py +789 -0
- package/python/vendor/hkc/hkc_core/models/__init__.py +0 -0
- package/python/vendor/hkc/hkc_core/models/enums.py +65 -0
- package/python/vendor/hkc/hkc_core/models/ku.py +307 -0
- package/python/vendor/hkc/hkc_core/utils/__init__.py +0 -0
- package/python/vendor/hkc/hkc_core/utils/id_gen.py +113 -0
- package/python/vendor/hkc/hkc_crystallizer/__init__.py +44 -0
- package/python/vendor/hkc/hkc_crystallizer/adapters.py +94 -0
- package/python/vendor/hkc/hkc_crystallizer/candidate.py +145 -0
- package/python/vendor/hkc/hkc_crystallizer/crystallizer.py +179 -0
- package/python/vendor/hkc/hkc_crystallizer/ingress.py +90 -0
- package/python/vendor/hkc/hkc_kde/__init__.py +0 -0
- package/python/vendor/hkc/hkc_kde/chunker.py +197 -0
- package/python/vendor/hkc/hkc_kde/extractor.py +623 -0
- package/python/vendor/hkc/hkc_kde/kde.py +298 -0
- package/python/vendor/hkc/hkc_kde/loaders/__init__.py +0 -0
- package/python/vendor/hkc/hkc_kde/loaders/ebook_loader.py +153 -0
- package/python/vendor/hkc/hkc_kde/loaders/office_loader.py +194 -0
- package/python/vendor/hkc/hkc_kde/loaders/pdf_loader.py +162 -0
- package/python/vendor/hkc/hkc_kde/loaders/text_loader.py +157 -0
- package/python/vendor/hkc/hkc_kde/loaders/web_loader.py +91 -0
- package/python/vendor/hkc/hkc_kde/models.py +74 -0
- package/python/vendor/hkc/hkc_kde/packager.py +329 -0
- package/python/vendor/hkc/hkc_kde/relation_disc.py +151 -0
- package/python/vendor/hkc/hkc_kee/__init__.py +0 -0
- package/python/vendor/hkc/hkc_kee/dedup.py +227 -0
- package/python/vendor/hkc/hkc_kee/fingerprint.py +106 -0
- package/python/vendor/hkc/hkc_kee/kee.py +541 -0
- package/python/vendor/hkc/hkc_kep/__init__.py +0 -0
- package/python/vendor/hkc/hkc_kep/event_bus.py +205 -0
- package/python/vendor/hkc/hkc_sdk/__init__.py +63 -0
- package/python/vendor/hkc/hkc_sdk/base.py +151 -0
- package/python/vendor/hkc/hkc_sdk/direct_client.py +153 -0
- package/python/vendor/hkc/hkc_sdk/exceptions.py +39 -0
- package/python/vendor/hkc/hkc_sdk/http_client.py +166 -0
- package/python/vendor/hkc/hkc_sdk/models.py +171 -0
- package/python/vendor/hkc/hkc_search/__init__.py +0 -0
- package/python/vendor/hkc/hkc_search/bm25.py +325 -0
- package/python/vendor/hkc/hkc_search/embedding_backends.py +374 -0
- package/python/vendor/hkc/hkc_search/graph_search.py +132 -0
- package/python/vendor/hkc/hkc_search/hybrid.py +331 -0
- package/python/vendor/hkc/hkc_search/index_build_manager.py +378 -0
- package/python/vendor/hkc/hkc_search/vector_search.py +484 -0
- package/python/vendor/hmr/__init__.py +0 -0
- package/python/vendor/hmr/core/__init__.py +0 -0
- package/python/vendor/hmr/core/hmr.py +684 -0
- package/python/vendor/hmr/core/models.py +310 -0
- package/python/vendor/hmr/engines/__init__.py +0 -0
- package/python/vendor/hmr/engines/evolution.py +710 -0
- package/python/vendor/hmr/engines/jit_compiler.py +472 -0
- package/python/vendor/hmr/engines/lifecycle.py +264 -0
- package/python/vendor/hmr/engines/policy.py +625 -0
- package/python/vendor/hmr/engines/recall.py +260 -0
- package/python/vendor/hmr/engines/runtime_state.py +158 -0
- package/python/vendor/hmr/engines/scheduler.py +323 -0
- package/python/vendor/hmr/engines/semantic.py +150 -0
- package/python/vendor/hmr/engines/temporal.py +261 -0
- package/python/vendor/hmr/engines/thought_chain.py +635 -0
- package/python/vendor/hmr/graph/__init__.py +0 -0
- package/python/vendor/hmr/graph/cwg.py +338 -0
- package/python/vendor/hmr/graph/memory_graph.py +530 -0
- package/python/vendor/hmr/storage/__init__.py +0 -0
- package/python/vendor/hmr/storage/memory_fs.py +300 -0
- package/python/vendor/hmr/storage/vector_store.py +520 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onMounted, ref } from 'vue'
|
|
3
|
+
import PanelBox from './PanelBox.vue'
|
|
4
|
+
import { panels, loadPanel, refreshPanel } from '../../stores/panels.js'
|
|
5
|
+
|
|
6
|
+
const p = panels.agents
|
|
7
|
+
const open = ref('')
|
|
8
|
+
onMounted(() => loadPanel('agents'))
|
|
9
|
+
|
|
10
|
+
const ready = computed(() => p.list.length > 0)
|
|
11
|
+
const shadowCount = computed(() => p.list.filter((a) => a.harness?.shadow_mode).length)
|
|
12
|
+
const nodes = computed(() => p.list.reduce((n, a) => n + (a.thought_chain?.total_nodes || 0), 0))
|
|
13
|
+
const blocked = computed(() => p.list.reduce((n, a) => n + (a.thought_chain?.blocked_nodes || 0), 0))
|
|
14
|
+
|
|
15
|
+
function toggle(id) { open.value = open.value === id ? '' : id }
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<PanelBox
|
|
20
|
+
title="代理"
|
|
21
|
+
tag="Agents"
|
|
22
|
+
:state="p.state"
|
|
23
|
+
:ready="ready"
|
|
24
|
+
@refresh="refreshPanel('agents')"
|
|
25
|
+
>
|
|
26
|
+
<div class="pn-kpi">
|
|
27
|
+
<div><b>{{ p.list.length }}</b><span>代理</span></div>
|
|
28
|
+
<div><b>{{ shadowCount }}</b><span>影子模式</span></div>
|
|
29
|
+
<div><b>{{ nodes }}</b><span>思考节点</span></div>
|
|
30
|
+
<div><b>{{ blocked }}</b><span>被拦截</span></div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="pn-sec">
|
|
34
|
+
<div class="pn-h">代理清单 <em>{{ p.list.length }}</em></div>
|
|
35
|
+
<div v-if="!p.list.length" class="pn-empty">后端没有返回任何 Agent。</div>
|
|
36
|
+
<div v-for="a in p.list" :key="a.agent_id" class="ag">
|
|
37
|
+
<div class="pn-row clickable" @click="toggle(a.agent_id)">
|
|
38
|
+
<span class="m">
|
|
39
|
+
<b>{{ a.agent_name }} <em class="id">{{ a.agent_id }}</em></b>
|
|
40
|
+
<span class="s">
|
|
41
|
+
{{ a.thought_chain?.total_nodes ?? 0 }} 节点 ·
|
|
42
|
+
置信度 {{ Math.round((a.thought_chain?.avg_confidence ?? 0) * 100) }}% ·
|
|
43
|
+
规则 {{ a.harness?.policy?.total_rules ?? 0 }} 条
|
|
44
|
+
</span>
|
|
45
|
+
</span>
|
|
46
|
+
<span class="pn-tag" :class="a.harness?.shadow_mode ? 'amber' : 'green'">
|
|
47
|
+
{{ a.harness?.shadow_mode ? '影子' : '在线' }}
|
|
48
|
+
</span>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div v-if="open === a.agent_id" class="det">
|
|
52
|
+
<div class="kv"><span>拦截阈值</span><b>
|
|
53
|
+
warn {{ a.harness?.thresholds?.warn ?? '—' }} / block {{ a.harness?.thresholds?.block ?? '—' }}
|
|
54
|
+
</b></div>
|
|
55
|
+
<div class="kv"><span>漂移检测</span><b>{{ a.harness?.thresholds?.embedding_mode || '—' }}</b></div>
|
|
56
|
+
<div class="kv"><span>语义维度</span><b>
|
|
57
|
+
{{ a.harness?.thresholds?.semantic_degraded ? '已降级(仅 tool/scope 两维)' : '正常' }}
|
|
58
|
+
</b></div>
|
|
59
|
+
<div class="kv"><span>阻塞 / 警告</span><b>
|
|
60
|
+
{{ a.thought_chain?.blocked_nodes ?? 0 }} / {{ a.thought_chain?.warned_nodes ?? 0 }}
|
|
61
|
+
</b></div>
|
|
62
|
+
<div class="kv"><span>影子轮次</span><b>
|
|
63
|
+
{{ a.harness?.thresholds?.run_count ?? 0 }} / {{ a.harness?.thresholds?.shadow_rounds ?? '—' }}
|
|
64
|
+
</b></div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div v-if="p.info" class="pn-note">
|
|
70
|
+
版本 <code>{{ p.info.version }}</code>
|
|
71
|
+
</div>
|
|
72
|
+
</PanelBox>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<style scoped>
|
|
76
|
+
.id { font-family: var(--mono); font-size: 11px; font-style: normal; color: var(--dim); margin-left: 4px; }
|
|
77
|
+
.det {
|
|
78
|
+
margin: 2px 0 8px 10px; padding: 8px 12px;
|
|
79
|
+
border-left: 2px solid var(--line);
|
|
80
|
+
}
|
|
81
|
+
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 12px; color: var(--dim); }
|
|
82
|
+
.kv b { font-weight: 600; color: var(--ink); font-family: var(--mono); font-size: 11.5px; text-align: right; }
|
|
83
|
+
</style>
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onMounted, ref, watch } from 'vue'
|
|
3
|
+
import PanelBox from './PanelBox.vue'
|
|
4
|
+
import { panels, loadPanel, refreshPanel, ingestKnowledge, openKu } from '../../stores/panels.js'
|
|
5
|
+
import { getJSON, postJSON } from '../../api.js'
|
|
6
|
+
import { fmtNum, fmtTime, clip } from '../../lib/fmt.js'
|
|
7
|
+
|
|
8
|
+
const p = panels.knowledge
|
|
9
|
+
onMounted(() => loadPanel('knowledge'))
|
|
10
|
+
|
|
11
|
+
const draft = ref('')
|
|
12
|
+
const title = ref('')
|
|
13
|
+
const domain = ref('')
|
|
14
|
+
|
|
15
|
+
const ready = computed(() => Object.keys(p.stats || {}).length > 0)
|
|
16
|
+
const idx = computed(() => p.index || {})
|
|
17
|
+
const kus = computed(() => Object.entries(p.stats?.ku_counts || {}))
|
|
18
|
+
const busy = computed(() => p.ingest === 'busy')
|
|
19
|
+
|
|
20
|
+
watch(draft, (v) => {
|
|
21
|
+
if (v && !busy.value) { p.ingest = 'idle'; p.ingestMsg = ''; p.ingestErr = '' }
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
async function submit() {
|
|
25
|
+
if (!draft.value.trim() || busy.value) return
|
|
26
|
+
try {
|
|
27
|
+
await ingestKnowledge({ text: draft.value, title: title.value, domain: domain.value })
|
|
28
|
+
draft.value = ''
|
|
29
|
+
title.value = ''
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const q = ref('')
|
|
35
|
+
const mode = ref('hybrid')
|
|
36
|
+
const MODES = [
|
|
37
|
+
{ v: 'hybrid', label: '混合' },
|
|
38
|
+
{ v: 'bm25', label: '关键词' },
|
|
39
|
+
{ v: 'vector', label: '语义' },
|
|
40
|
+
{ v: 'graph', label: '图谱' },
|
|
41
|
+
]
|
|
42
|
+
const sState = ref('idle') // idle | busy | ok | err
|
|
43
|
+
const sErr = ref('')
|
|
44
|
+
const hits = ref([])
|
|
45
|
+
|
|
46
|
+
async function doSearch() {
|
|
47
|
+
const text = q.value.trim()
|
|
48
|
+
if (!text || sState.value === 'busy') return
|
|
49
|
+
sState.value = 'busy'
|
|
50
|
+
sErr.value = ''
|
|
51
|
+
try {
|
|
52
|
+
const d = await postJSON('/knowledge/search', {
|
|
53
|
+
query: text,
|
|
54
|
+
mode: mode.value,
|
|
55
|
+
top_k: 12,
|
|
56
|
+
})
|
|
57
|
+
hits.value = d.hits || []
|
|
58
|
+
if (d.available === false) {
|
|
59
|
+
sState.value = 'err'
|
|
60
|
+
sErr.value = 'HKC 未启用(未 vendor 或缺依赖)'
|
|
61
|
+
} else if (d.error) {
|
|
62
|
+
sState.value = 'err'
|
|
63
|
+
sErr.value = d.error
|
|
64
|
+
} else {
|
|
65
|
+
sState.value = 'ok'
|
|
66
|
+
}
|
|
67
|
+
} catch (e) {
|
|
68
|
+
hits.value = []
|
|
69
|
+
sState.value = 'err'
|
|
70
|
+
sErr.value = e.message
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const abKey = ref('')
|
|
75
|
+
const abState = ref('idle') // idle | busy | ok | err
|
|
76
|
+
const abErr = ref('')
|
|
77
|
+
const ab = ref(null)
|
|
78
|
+
|
|
79
|
+
async function showAbility(k) {
|
|
80
|
+
if (abKey.value === k && ab.value) {
|
|
81
|
+
abKey.value = ''
|
|
82
|
+
ab.value = null
|
|
83
|
+
abState.value = 'idle'
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
abKey.value = k
|
|
87
|
+
abState.value = 'busy'
|
|
88
|
+
abErr.value = ''
|
|
89
|
+
ab.value = null
|
|
90
|
+
try {
|
|
91
|
+
ab.value = await getJSON(`/knowledge/ability/${encodeURIComponent(k)}`)
|
|
92
|
+
abState.value = 'ok'
|
|
93
|
+
} catch (e) {
|
|
94
|
+
abState.value = 'err'
|
|
95
|
+
abErr.value = e.message
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function covText(c) {
|
|
100
|
+
if (c == null) return ''
|
|
101
|
+
if (typeof c === 'number') return `${Math.round(c * 100)}%`
|
|
102
|
+
if (typeof c === 'object') {
|
|
103
|
+
const n = c.overall ?? c.score ?? c.value ?? c.ratio
|
|
104
|
+
if (typeof n === 'number') return `${Math.round(n * 100)}%`
|
|
105
|
+
}
|
|
106
|
+
return ''
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<template>
|
|
111
|
+
<PanelBox
|
|
112
|
+
title="学习库"
|
|
113
|
+
tag="Knowledge"
|
|
114
|
+
:state="p.state"
|
|
115
|
+
:ready="ready"
|
|
116
|
+
@refresh="refreshPanel('knowledge')"
|
|
117
|
+
>
|
|
118
|
+
<div class="kb-in">
|
|
119
|
+
<textarea
|
|
120
|
+
v-model="draft"
|
|
121
|
+
rows="3"
|
|
122
|
+
spellcheck="false"
|
|
123
|
+
placeholder="写一句或一小段知识 —— 一句话也算。长文档、整本书走知识星球。"
|
|
124
|
+
@keydown.ctrl.enter.prevent="submit"
|
|
125
|
+
/>
|
|
126
|
+
<div class="kb-bar">
|
|
127
|
+
<input v-model="title" class="f-title" placeholder="标题(可选)" />
|
|
128
|
+
<input v-model="domain" class="f-domain" placeholder="领域(可选)" />
|
|
129
|
+
<span v-if="busy" class="tip">抽取中,可能要几十秒…</span>
|
|
130
|
+
<span v-else-if="p.ingest === 'ok'" class="tip ok">{{ p.ingestMsg }}</span>
|
|
131
|
+
<span v-else-if="p.ingest === 'error'" class="tip bad">{{ p.ingestErr }}</span>
|
|
132
|
+
<span v-else class="tip dim">Ctrl + Enter 收录</span>
|
|
133
|
+
<button class="go" :disabled="!draft.trim() || busy" @click="submit">
|
|
134
|
+
{{ busy ? '收录中…' : '收录' }}
|
|
135
|
+
</button>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div class="pn-kpi">
|
|
140
|
+
<div><b>{{ fmtNum(p.stats.total_kus ?? 0) }}</b><span>知识单元</span></div>
|
|
141
|
+
<div><b>{{ fmtNum(p.stats.total_relations ?? 0) }}</b><span>关系</span></div>
|
|
142
|
+
<div><b>{{ fmtNum(p.stats.graph_nodes ?? 0) }}</b><span>图谱节点</span></div>
|
|
143
|
+
<div><b>{{ fmtNum(p.stats.open_conflicts ?? 0) }}</b><span>待裁决冲突</span></div>
|
|
144
|
+
<div><b>{{ fmtNum(p.stats.vector_size ?? 0) }}</b><span>向量条目</span></div>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<div class="pn-sec">
|
|
148
|
+
<div class="pn-h">检索 <em>{{ hits.length }}</em></div>
|
|
149
|
+
<div class="kb-find">
|
|
150
|
+
<input
|
|
151
|
+
v-model="q"
|
|
152
|
+
placeholder="按关键词 / 语义检索整个知识库…"
|
|
153
|
+
@keydown.enter="doSearch"
|
|
154
|
+
/>
|
|
155
|
+
<select v-model="mode" aria-label="检索模式">
|
|
156
|
+
<option v-for="m in MODES" :key="m.v" :value="m.v">{{ m.label }}</option>
|
|
157
|
+
</select>
|
|
158
|
+
<button class="go" :disabled="!q.trim() || sState === 'busy'" @click="doSearch">
|
|
159
|
+
{{ sState === 'busy' ? '检索中…' : '检索' }}
|
|
160
|
+
</button>
|
|
161
|
+
</div>
|
|
162
|
+
<div v-if="sState === 'err'" class="pn-note meta bad">{{ sErr }}</div>
|
|
163
|
+
<div v-else-if="hits.length" class="kb-hits">
|
|
164
|
+
<button
|
|
165
|
+
v-for="h in hits"
|
|
166
|
+
:key="h.ku_id"
|
|
167
|
+
class="kb-hit"
|
|
168
|
+
:title="h.summary || h.name"
|
|
169
|
+
@click="openKu(h.ku_id)"
|
|
170
|
+
>
|
|
171
|
+
<span class="m">
|
|
172
|
+
<b>{{ clip(h.name || h.ku_id, 52) }}</b>
|
|
173
|
+
<span class="s">{{ h.ku_type || 'KU' }} · {{ h.mode || mode }}</span>
|
|
174
|
+
</span>
|
|
175
|
+
<span class="r">{{ h.score != null ? Number(h.score).toFixed(2) : '' }}</span>
|
|
176
|
+
</button>
|
|
177
|
+
</div>
|
|
178
|
+
<div v-else-if="sState === 'ok'" class="pn-empty">没有命中,换个词或换模式试试。</div>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<div class="pn-sec">
|
|
182
|
+
<div class="pn-h">最近录入 <em>{{ p.recentTotal }}</em></div>
|
|
183
|
+
<div v-if="!p.recent.length" class="pn-empty">
|
|
184
|
+
还没有录入知识。上面写一句话就能收录 —— 长文档走知识星球。
|
|
185
|
+
</div>
|
|
186
|
+
<div
|
|
187
|
+
v-for="k in p.recent"
|
|
188
|
+
:key="k.ku_id"
|
|
189
|
+
class="pn-row clickable"
|
|
190
|
+
:title="k.summary || k.name"
|
|
191
|
+
@click="openKu(k.ku_id)"
|
|
192
|
+
>
|
|
193
|
+
<span class="m">
|
|
194
|
+
<b>{{ clip(k.name || k.ku_id, 46) }}</b>
|
|
195
|
+
<span class="s">{{ k.ku_type }} · {{ k.domain || '未分域' }}</span>
|
|
196
|
+
</span>
|
|
197
|
+
<span class="r">{{ fmtTime(k.created_at) }}</span>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
<div class="pn-cols">
|
|
202
|
+
<div class="pn-sec">
|
|
203
|
+
<div class="pn-h">索引状态 <em>{{ idx.index_state || '—' }}</em></div>
|
|
204
|
+
<div class="pn-row">
|
|
205
|
+
<span class="m">
|
|
206
|
+
<b>{{ idx.index_state === 'ready' ? '索引就绪' : '索引' + (idx.index_state || '未知') }}</b>
|
|
207
|
+
<span class="s">
|
|
208
|
+
扫描 {{ fmtNum(idx.scanned ?? 0) }} · 就绪 {{ fmtNum(idx.ready ?? 0) }} ·
|
|
209
|
+
待处理 {{ fmtNum(idx.pending ?? 0) }} · 失败 {{ fmtNum(idx.failed ?? 0) }}
|
|
210
|
+
</span>
|
|
211
|
+
</span>
|
|
212
|
+
<span class="pn-tag" :class="idx.index_state === 'ready' ? 'green' : 'amber'">
|
|
213
|
+
{{ idx.index_version || 'v—' }}
|
|
214
|
+
</span>
|
|
215
|
+
</div>
|
|
216
|
+
<div class="pn-note meta">
|
|
217
|
+
向量模型 <code>{{ p.stats.embedding || '未知' }}</code><br />
|
|
218
|
+
BM25 {{ fmtNum(p.stats.bm25_size ?? 0) }} · 向量 {{ fmtNum(p.stats.vector_size ?? 0) }}<br />
|
|
219
|
+
数据目录 <code>{{ p.stats.data_dir || '—' }}</code>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<div class="pn-sec">
|
|
224
|
+
<div class="pn-h">按知识域 <em>{{ kus.length }}</em></div>
|
|
225
|
+
<div v-if="!kus.length" class="pn-empty">摄入资料后,这里按知识域统计条目数。</div>
|
|
226
|
+
<div v-for="[k, n] in kus" :key="k" class="pn-row">
|
|
227
|
+
<span class="m"><b>{{ k }}</b></span>
|
|
228
|
+
<span class="r">{{ n }}</span>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div class="pn-h sec-gap">书籍来源 <em>{{ p.sources.length }}</em></div>
|
|
232
|
+
<div v-if="!p.sources.length" class="pn-empty">
|
|
233
|
+
还没有整本摄入的资料。PDF / EPUB 走知识星球导入。
|
|
234
|
+
</div>
|
|
235
|
+
<div v-for="(s, i) in p.sources.slice(0, 8)" :key="i" class="pn-row" :title="s.name || s.source">
|
|
236
|
+
<span class="m">
|
|
237
|
+
<b>{{ clip(s.name || s.source || '未命名资料', 34) }}</b>
|
|
238
|
+
<span class="s">{{ s.year || '年份未知' }}</span>
|
|
239
|
+
</span>
|
|
240
|
+
</div>
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
<div class="pn-sec">
|
|
245
|
+
<div class="pn-h">能力清单 <em>{{ p.abilities.length }}</em></div>
|
|
246
|
+
<div v-if="!p.abilities.length" class="pn-empty">后端没有返回能力清单。</div>
|
|
247
|
+
<div v-else class="pn-chips">
|
|
248
|
+
<button
|
|
249
|
+
v-for="a in p.abilities"
|
|
250
|
+
:key="a"
|
|
251
|
+
class="pn-chip"
|
|
252
|
+
:class="{ on: abKey === a }"
|
|
253
|
+
@click="showAbility(a)"
|
|
254
|
+
>
|
|
255
|
+
{{ a }}
|
|
256
|
+
</button>
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
<div v-if="abState === 'busy'" class="pn-note meta">编译中…</div>
|
|
260
|
+
<div v-else-if="abState === 'err'" class="pn-note meta bad">编译失败:{{ abErr }}</div>
|
|
261
|
+
<div v-else-if="ab" class="kb-ab">
|
|
262
|
+
<template v-if="ab.available === false">
|
|
263
|
+
<div class="pn-note meta">HKC 未启用,无法编译能力。</div>
|
|
264
|
+
</template>
|
|
265
|
+
|
|
266
|
+
<template v-else-if="ab.sufficient === false">
|
|
267
|
+
<div class="kb-ab-h">{{ abKey }}<span class="v">知识不足</span></div>
|
|
268
|
+
<div class="pn-note meta">{{ ab.reason || '覆盖不足,暂不授予该能力。' }}</div>
|
|
269
|
+
<div v-if="(ab.missing_skills || []).length" class="pn-chips gap">
|
|
270
|
+
<span v-for="m in ab.missing_skills" :key="m" class="pn-chip warn">{{ m }}</span>
|
|
271
|
+
</div>
|
|
272
|
+
</template>
|
|
273
|
+
|
|
274
|
+
<template v-else-if="ab.ability">
|
|
275
|
+
<div class="kb-ab-h">
|
|
276
|
+
{{ ab.ability.display_name || abKey }}
|
|
277
|
+
<span class="v">{{ ab.ability.version || '' }}</span>
|
|
278
|
+
</div>
|
|
279
|
+
<div class="pn-note meta">
|
|
280
|
+
{{ ab.ability.domain || '未分域' }} · 覆盖 {{ covText(ab.ability.coverage) || '—' }}
|
|
281
|
+
</div>
|
|
282
|
+
<div v-for="s in ab.ability.skills || []" :key="s.skill_key" class="pn-row">
|
|
283
|
+
<span class="m">
|
|
284
|
+
<b>{{ s.display_name || s.skill_key }}</b>
|
|
285
|
+
<span class="s">{{ s.concept_hits ?? 0 }} 个概念命中</span>
|
|
286
|
+
</span>
|
|
287
|
+
<span class="r">{{ covText(s.coverage) }}</span>
|
|
288
|
+
</div>
|
|
289
|
+
<div v-for="(w, i) in ab.ability.workflows || []" :key="'w' + i" class="pn-row">
|
|
290
|
+
<span class="m"><b>{{ w }}</b></span>
|
|
291
|
+
</div>
|
|
292
|
+
</template>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
|
|
296
|
+
<div class="pn-note">
|
|
297
|
+
录入走 <code>POST /api/knowledge/ingest</code>(KDE 抽取 → KEE 演化),
|
|
298
|
+
列表读 <code>/api/knowledge/recent</code>;书籍走知识星球。
|
|
299
|
+
</div>
|
|
300
|
+
</PanelBox>
|
|
301
|
+
</template>
|
|
302
|
+
|
|
303
|
+
<style scoped>
|
|
304
|
+
.kb-in {
|
|
305
|
+
margin-bottom: 14px;
|
|
306
|
+
border-radius: var(--r-mid);
|
|
307
|
+
background: rgba(255, 255, 255, 0.9);
|
|
308
|
+
border: 1px solid rgba(26, 157, 95, 0.16);
|
|
309
|
+
overflow: hidden;
|
|
310
|
+
transition: border-color 0.15s, box-shadow 0.15s;
|
|
311
|
+
}
|
|
312
|
+
.kb-in:focus-within {
|
|
313
|
+
border-color: rgba(26, 157, 95, 0.38);
|
|
314
|
+
box-shadow: 0 2px 12px rgba(26, 157, 95, 0.08);
|
|
315
|
+
}
|
|
316
|
+
.kb-in textarea {
|
|
317
|
+
display: block; width: 100%;
|
|
318
|
+
padding: 11px 12px 6px;
|
|
319
|
+
font-family: var(--sans);
|
|
320
|
+
font-size: 13px; line-height: 1.7; color: var(--ink);
|
|
321
|
+
background: transparent; border: 0; outline: none; resize: vertical;
|
|
322
|
+
min-height: 62px;
|
|
323
|
+
}
|
|
324
|
+
.kb-in textarea::placeholder { color: var(--dim); }
|
|
325
|
+
|
|
326
|
+
.kb-bar {
|
|
327
|
+
display: flex; align-items: center; gap: 6px;
|
|
328
|
+
padding: 6px 8px 8px 12px;
|
|
329
|
+
border-top: 1px solid var(--line-soft);
|
|
330
|
+
}
|
|
331
|
+
.kb-bar input {
|
|
332
|
+
padding: 4px 8px; border-radius: 6px;
|
|
333
|
+
font-size: 11.5px; color: var(--ink);
|
|
334
|
+
background: rgba(23, 32, 26, 0.04); border: 1px solid transparent;
|
|
335
|
+
outline: none;
|
|
336
|
+
}
|
|
337
|
+
.kb-bar input:focus { border-color: var(--line); background: #fff; }
|
|
338
|
+
.kb-bar input::placeholder { color: var(--dim); }
|
|
339
|
+
.f-title { flex: 1 1 110px; max-width: 190px; min-width: 0; }
|
|
340
|
+
.f-domain { flex: 0 1 96px; min-width: 60px; }
|
|
341
|
+
|
|
342
|
+
.tip {
|
|
343
|
+
flex: 1 1 auto; min-width: 0;
|
|
344
|
+
font-size: 11.5px; color: var(--dim);
|
|
345
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
346
|
+
}
|
|
347
|
+
.tip.dim { color: var(--faint); }
|
|
348
|
+
.tip.ok { color: var(--green); }
|
|
349
|
+
.tip.bad { color: var(--red); }
|
|
350
|
+
|
|
351
|
+
.go {
|
|
352
|
+
flex-shrink: 0;
|
|
353
|
+
padding: 6px 15px; border-radius: var(--r-pill);
|
|
354
|
+
font-size: 11.5px; font-weight: 600; color: #fff;
|
|
355
|
+
background: var(--green);
|
|
356
|
+
transition: opacity 0.15s, transform 0.12s;
|
|
357
|
+
}
|
|
358
|
+
.go:hover:not(:disabled) { opacity: 0.9; }
|
|
359
|
+
.go:active:not(:disabled) { transform: scale(0.97); }
|
|
360
|
+
.go:disabled {
|
|
361
|
+
background: rgba(23, 32, 26, 0.07); color: var(--dim);
|
|
362
|
+
border: 1px solid var(--line-soft);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.meta { margin-top: 8px; }
|
|
366
|
+
.sec-gap { margin-top: 14px; }
|
|
367
|
+
.pn-note.meta.bad { color: var(--red); }
|
|
368
|
+
|
|
369
|
+
.kb-find {
|
|
370
|
+
display: flex; align-items: center; gap: 6px;
|
|
371
|
+
margin-bottom: 8px;
|
|
372
|
+
}
|
|
373
|
+
.kb-find input {
|
|
374
|
+
flex: 1 1 auto; min-width: 0;
|
|
375
|
+
padding: 7px 10px; border-radius: var(--r-sm);
|
|
376
|
+
font-size: 12.5px; color: var(--ink);
|
|
377
|
+
background: rgba(255, 255, 255, 0.9);
|
|
378
|
+
border: 1px solid var(--line-soft);
|
|
379
|
+
outline: none;
|
|
380
|
+
transition: border-color 0.15s;
|
|
381
|
+
}
|
|
382
|
+
.kb-find input:focus { border-color: rgba(26, 157, 95, 0.45); }
|
|
383
|
+
.kb-find input::placeholder { color: var(--dim); }
|
|
384
|
+
.kb-find select {
|
|
385
|
+
padding: 6px 8px; border-radius: var(--r-sm);
|
|
386
|
+
font-size: 12px; font-weight: 600; color: var(--ink);
|
|
387
|
+
background: rgba(255, 255, 255, 0.9);
|
|
388
|
+
border: 1px solid var(--line);
|
|
389
|
+
outline: none;
|
|
390
|
+
}
|
|
391
|
+
.kb-find .go { padding: 6px 13px; }
|
|
392
|
+
|
|
393
|
+
.kb-hits { display: flex; flex-direction: column; gap: 2px; }
|
|
394
|
+
.kb-hit {
|
|
395
|
+
display: flex; align-items: center; gap: 8px; width: 100%;
|
|
396
|
+
padding: 7px 9px; border-radius: var(--r-sm);
|
|
397
|
+
text-align: left;
|
|
398
|
+
transition: background 0.13s;
|
|
399
|
+
}
|
|
400
|
+
.kb-hit:hover { background: rgba(255, 255, 255, 0.75); }
|
|
401
|
+
.kb-hit .m { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
|
|
402
|
+
.kb-hit .m b {
|
|
403
|
+
font-size: 13px; font-weight: 600; color: var(--ink);
|
|
404
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
405
|
+
}
|
|
406
|
+
.kb-hit .m .s { font-size: 11.5px; color: var(--dim); }
|
|
407
|
+
.kb-hit .r {
|
|
408
|
+
flex-shrink: 0; font-size: 11.5px; color: var(--dim);
|
|
409
|
+
font-variant-numeric: tabular-nums;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.pn-chips.gap { margin-top: 8px; }
|
|
413
|
+
.kb-ab {
|
|
414
|
+
margin-top: 10px; padding: 10px 12px;
|
|
415
|
+
border-radius: var(--r-mid);
|
|
416
|
+
background: rgba(255, 255, 255, 0.86);
|
|
417
|
+
border: 1px solid var(--line-soft);
|
|
418
|
+
}
|
|
419
|
+
.kb-ab-h {
|
|
420
|
+
display: flex; align-items: baseline; gap: 6px;
|
|
421
|
+
font-size: 13px; font-weight: 600; color: var(--ink);
|
|
422
|
+
margin-bottom: 5px;
|
|
423
|
+
}
|
|
424
|
+
.kb-ab-h .v { font-size: 11.5px; font-weight: 600; color: var(--dim); }
|
|
425
|
+
</style>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onMounted, ref } from 'vue'
|
|
3
|
+
import PanelBox from './PanelBox.vue'
|
|
4
|
+
import { panels, loadPanel, refreshPanel, dropPreference } from '../../stores/panels.js'
|
|
5
|
+
import { openDoc } from '../../stores/app.js'
|
|
6
|
+
import { fmtTime, fmtNum, clip } from '../../lib/fmt.js'
|
|
7
|
+
|
|
8
|
+
const p = panels.memory
|
|
9
|
+
const err = ref('')
|
|
10
|
+
const busy = ref('')
|
|
11
|
+
onMounted(() => loadPanel('memory'))
|
|
12
|
+
|
|
13
|
+
const ready = computed(() => !!p.stats.backend)
|
|
14
|
+
const byAgent = computed(() => Object.entries(p.stats.by_agent || {}))
|
|
15
|
+
|
|
16
|
+
function open(m) {
|
|
17
|
+
openDoc({
|
|
18
|
+
id: `mem:${m.id}`,
|
|
19
|
+
kind: 'text',
|
|
20
|
+
lang: 'markdown',
|
|
21
|
+
title: m.title || m.id,
|
|
22
|
+
path: `memory/${m.id}.md`,
|
|
23
|
+
meta: `${m.type || '记忆'} · ${m.agent || '—'} · ${fmtTime(m.created_at)}`,
|
|
24
|
+
content: m.summary || '(无摘要)',
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function drop(pref) {
|
|
29
|
+
busy.value = pref.id
|
|
30
|
+
err.value = ''
|
|
31
|
+
try { await dropPreference(pref.id) } catch (e) { err.value = String(e.message || e) }
|
|
32
|
+
busy.value = ''
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<PanelBox
|
|
38
|
+
title="记忆中心"
|
|
39
|
+
tag="Memory"
|
|
40
|
+
:state="p.state"
|
|
41
|
+
:ready="ready"
|
|
42
|
+
@refresh="refreshPanel('memory')"
|
|
43
|
+
>
|
|
44
|
+
<div class="pn-kpi">
|
|
45
|
+
<div><b>{{ fmtNum(p.stats.total_memories ?? 0) }}</b><span>记忆条目</span></div>
|
|
46
|
+
<div><b>{{ fmtNum(p.stats.relations ?? 0) }}</b><span>关联</span></div>
|
|
47
|
+
<div><b>{{ fmtNum(p.stats.shared ?? 0) }}</b><span>共享</span></div>
|
|
48
|
+
<div><b>{{ fmtNum(p.stats.private ?? 0) }}</b><span>私有</span></div>
|
|
49
|
+
<div><b>{{ fmtNum(p.prefs.length) }}</b><span>用户偏好</span></div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div v-if="err" class="pn-st err">{{ err }}</div>
|
|
53
|
+
|
|
54
|
+
<div class="pn-cols">
|
|
55
|
+
<div class="pn-sec">
|
|
56
|
+
<div class="pn-h">最近记忆 <em>{{ p.recent.length }}</em></div>
|
|
57
|
+
<div v-if="!p.recent.length" class="pn-empty">
|
|
58
|
+
还没有记忆。聊过的内容会被 HMR 提炼成记忆条目,这里能看到最新的几条。
|
|
59
|
+
</div>
|
|
60
|
+
<div
|
|
61
|
+
v-for="m in p.recent"
|
|
62
|
+
:key="m.id"
|
|
63
|
+
class="pn-row clickable"
|
|
64
|
+
:title="'点击看全文'"
|
|
65
|
+
@click="open(m)"
|
|
66
|
+
>
|
|
67
|
+
<span class="m">
|
|
68
|
+
<b>{{ clip(m.title || m.id, 40) }}</b>
|
|
69
|
+
<span class="s">{{ m.type || '记忆' }} · {{ m.agent || '—' }}</span>
|
|
70
|
+
</span>
|
|
71
|
+
<span v-if="m.shared" class="pn-tag">共享</span>
|
|
72
|
+
<span class="r">{{ fmtTime(m.created_at) }}</span>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div class="pn-sec">
|
|
77
|
+
<div class="pn-h">按 Agent <em>{{ byAgent.length }}</em></div>
|
|
78
|
+
<div v-if="!byAgent.length" class="pn-empty">没有按 Agent 的分布数据。</div>
|
|
79
|
+
<div v-for="[a, n] in byAgent" :key="a" class="pn-row">
|
|
80
|
+
<span class="m"><b>{{ a }}</b></span>
|
|
81
|
+
<span class="r">{{ n }}</span>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<div class="pn-h sec-gap">用户偏好 <em>{{ p.prefs.length }}</em></div>
|
|
85
|
+
<div v-if="!p.prefs.length" class="pn-empty">
|
|
86
|
+
还没有记录偏好。你对 Agent 说过的长期设定会落在这里,误存的可以就地删掉。
|
|
87
|
+
</div>
|
|
88
|
+
<div v-for="pref in p.prefs" :key="pref.id" class="pn-row">
|
|
89
|
+
<span class="m">
|
|
90
|
+
<b>{{ clip(pref.content || pref.id, 40) }}</b>
|
|
91
|
+
<span class="s">{{ pref.id }}</span>
|
|
92
|
+
</span>
|
|
93
|
+
<button class="del" :disabled="busy === pref.id" title="删除这条偏好" @click.stop="drop(pref)">
|
|
94
|
+
删除
|
|
95
|
+
</button>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div class="pn-note">
|
|
101
|
+
后端 <code>{{ p.stats.backend || '—' }}</code> v{{ p.stats.version || '—' }} ·
|
|
102
|
+
向量 <code>{{ p.stats.embedding || '—' }}</code>。
|
|
103
|
+
数据来自 <code>/api/memory/stats</code>、<code>/api/memory/recent</code>、<code>/api/preferences</code>。
|
|
104
|
+
</div>
|
|
105
|
+
</PanelBox>
|
|
106
|
+
</template>
|
|
107
|
+
|
|
108
|
+
<style scoped>
|
|
109
|
+
.sec-gap { margin-top: 14px; }
|
|
110
|
+
.del {
|
|
111
|
+
flex-shrink: 0; padding: 4px 10px; border-radius: var(--r-pill);
|
|
112
|
+
font-size: 11px; font-weight: 600; color: var(--dim);
|
|
113
|
+
background: var(--surface-2); border: 1px solid var(--line-soft);
|
|
114
|
+
}
|
|
115
|
+
.del:hover { color: var(--red); background: rgba(229, 72, 77, 0.1); }
|
|
116
|
+
.del:disabled { opacity: 0.5; }
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { t } from '../../lib/i18n.js'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
title: { type: String, default: '' },
|
|
6
|
+
tag: { type: String, default: '' },
|
|
7
|
+
state: { type: String, default: 'idle' },
|
|
8
|
+
ready: { type: Boolean, default: false },
|
|
9
|
+
})
|
|
10
|
+
defineEmits(['refresh'])
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<section class="panel">
|
|
15
|
+
<header class="ph">
|
|
16
|
+
<div class="tt">
|
|
17
|
+
<h2>{{ props.title }}</h2>
|
|
18
|
+
<span v-if="props.tag" class="pn-tag">{{ props.tag }}</span>
|
|
19
|
+
</div>
|
|
20
|
+
<button class="rf" :class="{ spin: props.state === 'loading' }" :title="t('common.refresh')" @click="$emit('refresh')">
|
|
21
|
+
{{ t('common.refresh') }}
|
|
22
|
+
</button>
|
|
23
|
+
</header>
|
|
24
|
+
<div class="pb scroll">
|
|
25
|
+
<div v-if="props.state === 'loading' && !props.ready" class="pn-st">{{ t('common.loading') }}</div>
|
|
26
|
+
<div v-else-if="props.state === 'error'" class="pn-st err">{{ t('common.offlinePanel') }}</div>
|
|
27
|
+
<slot v-else />
|
|
28
|
+
</div>
|
|
29
|
+
</section>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<style scoped>
|
|
33
|
+
.panel { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
|
|
34
|
+
.ph {
|
|
35
|
+
display: flex; align-items: center; gap: 10px; flex-shrink: 0;
|
|
36
|
+
padding: 11px 16px 10px; border-bottom: 1px solid var(--line-soft);
|
|
37
|
+
}
|
|
38
|
+
.tt { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
|
|
39
|
+
.tt h2 { font-size: 13.5px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
|
|
40
|
+
.rf {
|
|
41
|
+
margin-left: auto; flex-shrink: 0;
|
|
42
|
+
padding: 5px 11px; border-radius: var(--r-pill);
|
|
43
|
+
font-size: 11.5px; font-weight: 600; color: var(--ink);
|
|
44
|
+
background: rgba(255, 255, 255, 0.86); border: 1px solid var(--line);
|
|
45
|
+
transition: color 0.14s, background 0.14s, border-color 0.14s;
|
|
46
|
+
}
|
|
47
|
+
.rf:hover { color: var(--green); background: #fff; border-color: rgba(26, 157, 95, 0.35); }
|
|
48
|
+
.rf.spin { color: var(--dim); }
|
|
49
|
+
.pb { flex: 1; padding: 14px 16px 18px; }
|
|
50
|
+
</style>
|