foxclaw 0.1.2 → 0.1.4
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/index.js +1 -8
- package/package.json +1 -1
- package/python/.env.example +8 -0
- package/python/.github/workflows/ci.yml +47 -2
- package/python/.github/workflows/release.yml +5 -0
- package/python/CHANGELOG.md +100 -0
- package/python/CHANGELOG_CN.md +100 -0
- package/python/README.md +17 -2
- package/python/README_CN.md +38 -20
- package/python/bench/bm25_audit.py +1 -14
- package/python/bench/bm25_regression.py +0 -1
- package/python/bench/bm25_stress.py +0 -4
- package/python/bench/cd_audit.py +0 -23
- package/python/bench/chaos.py +6 -8
- package/python/bench/e2e_real_models.py +0 -1
- package/python/bench/llm_retry_test.py +2 -9
- package/python/bench/load_test.py +5 -8
- package/python/bench/vector_ivf_upgrade.py +1 -7
- package/python/docs/CONTENT_GUARD.md +189 -0
- package/python/docs/CONTENT_GUARD_CN.md +189 -0
- package/python/docs/RELEASE.md +78 -37
- package/python/docs/RUN_CN.md +2 -2
- package/python/evals/governance/cases.py +0 -37
- package/python/evals/governance/run_evals.py +5 -37
- package/python/examples/governance_middleware_demo.py +1 -6
- package/python/examples/langgraph_governance_demo.py +7 -11
- package/python/foxclaw/__init__.py +74 -152
- package/python/foxclaw/agents/base.py +82 -136
- package/python/foxclaw/agents/impl/_helpers.py +2 -10
- package/python/foxclaw/agents/impl/finance.py +4 -21
- package/python/foxclaw/agents/impl/office.py +7 -24
- package/python/foxclaw/agents/impl/supervisor.py +12 -79
- package/python/foxclaw/agents/mixins/_context.py +0 -23
- package/python/foxclaw/agents/mixins/augment.py +10 -16
- package/python/foxclaw/agents/mixins/llm.py +7 -6
- package/python/foxclaw/agents/mixins/memory.py +23 -3
- package/python/foxclaw/agents/mixins/preference.py +58 -8
- package/python/foxclaw/agents/mixins/prompt.py +59 -12
- package/python/foxclaw/agents/mixins/skillbox.py +6 -6
- package/python/foxclaw/agents/mixins/tool_exec.py +16 -42
- package/python/foxclaw/agents/rules/finance/RULES.md +131 -0
- package/python/foxclaw/api/__init__.py +18 -77
- package/python/foxclaw/api/_state.py +43 -0
- package/python/foxclaw/api/bootstrap.py +114 -0
- package/python/foxclaw/api/middleware.py +5 -28
- package/python/foxclaw/api/routes/ahs.py +60 -73
- package/python/foxclaw/api/routes/attachments.py +5 -6
- package/python/foxclaw/api/routes/browser.py +7 -11
- package/python/foxclaw/api/routes/domain.py +18 -26
- package/python/foxclaw/api/routes/knowledge.py +3 -21
- package/python/foxclaw/api/routes/llm_admin.py +21 -33
- package/python/foxclaw/api/routes/memory.py +50 -12
- package/python/foxclaw/api/routes/orchestration.py +3 -5
- package/python/foxclaw/api/routes/recovery.py +4 -3
- package/python/foxclaw/api/routes/review.py +2 -11
- package/python/foxclaw/api/routes/search.py +3 -7
- package/python/foxclaw/api/routes/system.py +33 -49
- package/python/foxclaw/api/routes/task.py +31 -49
- package/python/foxclaw/api/routes/ws.py +2 -6
- package/python/foxclaw/api/spine.py +1 -4
- package/python/foxclaw/behavior/__init__.py +20 -0
- package/python/foxclaw/behavior/behavior.yaml +62 -0
- package/python/foxclaw/behavior/spec.py +287 -0
- package/python/foxclaw/browser/action/action_executor.py +1 -5
- package/python/foxclaw/browser/action/action_types.py +0 -1
- package/python/foxclaw/browser/action/url_policy.py +1 -5
- package/python/foxclaw/browser/adapter/web_adapter.py +1 -1
- package/python/foxclaw/browser/driver/playwright_driver.py +20 -16
- package/python/foxclaw/browser/perception/dom_extractor.py +0 -1
- package/python/foxclaw/browser/perception/element_indexer.py +1 -2
- package/python/foxclaw/browser/service.py +7 -11
- package/python/foxclaw/capability/embedding_service.py +4 -6
- package/python/foxclaw/channels/__init__.py +9 -11
- package/python/foxclaw/channels/discord.py +4 -13
- package/python/foxclaw/channels/dispatcher.py +2 -27
- package/python/foxclaw/channels/feishu.py +10 -20
- package/python/foxclaw/channels/openclaw_bridge.py +4 -9
- package/python/foxclaw/channels/signing.py +9 -9
- package/python/foxclaw/channels/telegram.py +3 -4
- package/python/foxclaw/channels/weixin.py +7 -17
- package/python/foxclaw/cli.py +42 -13
- package/python/foxclaw/cognitive/reasoner.py +9 -10
- package/python/foxclaw/cognitive/state.py +18 -24
- package/python/foxclaw/core/audit_chain.py +1 -3
- package/python/foxclaw/core/audit_sink.py +3 -3
- package/python/foxclaw/core/compaction.py +8 -26
- package/python/foxclaw/core/config.py +2 -2
- package/python/foxclaw/core/confirm_nonce.py +6 -12
- package/python/foxclaw/core/content_guard.py +341 -0
- package/python/foxclaw/core/envfile.py +2 -2
- package/python/foxclaw/core/failure_policy.py +17 -26
- package/python/foxclaw/core/gateway.py +6 -10
- package/python/foxclaw/core/governance_audit.py +3 -7
- package/python/foxclaw/core/idempotency.py +15 -22
- package/python/foxclaw/core/injection_guard.py +10 -29
- package/python/foxclaw/core/memory_adapter.py +53 -60
- package/python/foxclaw/core/metrics.py +4 -5
- package/python/foxclaw/core/model_router.py +74 -150
- package/python/foxclaw/core/paths.py +1 -1
- package/python/foxclaw/core/recovery.py +21 -34
- package/python/foxclaw/core/scheduler.py +23 -26
- package/python/foxclaw/core/secrets.py +0 -3
- package/python/foxclaw/core/sensitive_write.py +283 -0
- package/python/foxclaw/core/sessions.py +4 -6
- package/python/foxclaw/core/settings.py +16 -32
- package/python/foxclaw/core/shared_write.py +11 -23
- package/python/foxclaw/core/steering_queue.py +12 -11
- package/python/foxclaw/core/system_bus.py +1 -1
- package/python/foxclaw/core/thought_chain.py +30 -32
- package/python/foxclaw/core/token_meter.py +9 -13
- package/python/foxclaw/core/tools.py +4 -12
- package/python/foxclaw/core/tracing.py +25 -40
- package/python/foxclaw/core/truth_pipeline.py +5 -9
- package/python/foxclaw/core/update_check.py +149 -0
- package/python/foxclaw/core/vec_recall_adapter.py +11 -37
- package/python/foxclaw/core/verify.py +6 -14
- package/python/foxclaw/core/web_search.py +4 -28
- package/python/foxclaw/finance/evidence.py +14 -18
- package/python/foxclaw/finance/fx.py +1 -3
- package/python/foxclaw/finance/graph.py +9 -18
- package/python/foxclaw/finance/models.py +20 -24
- package/python/foxclaw/finance/nlparse.py +12 -72
- package/python/foxclaw/finance/policy.py +8 -36
- package/python/foxclaw/finance/reasoner.py +3 -11
- package/python/foxclaw/finance/reasoning.py +13 -34
- package/python/foxclaw/finance/reconcile.py +5 -10
- package/python/foxclaw/finance/runtime.py +19 -46
- package/python/foxclaw/governance/middleware.py +13 -21
- package/python/foxclaw/harness/_base.py +2 -8
- package/python/foxclaw/harness/_policy.py +19 -38
- package/python/foxclaw/harness/drift.py +1 -13
- package/python/foxclaw/harness/event_bus.py +2 -5
- package/python/foxclaw/harness/harness.py +9 -97
- package/python/foxclaw/harness/loop_detection.py +11 -18
- package/python/foxclaw/itinerary/amap_client.py +2 -5
- package/python/foxclaw/itinerary/models.py +7 -7
- package/python/foxclaw/itinerary/reasoner.py +1 -6
- package/python/foxclaw/itinerary/reasoning.py +15 -21
- package/python/foxclaw/itinerary/runtime.py +8 -12
- package/python/foxclaw/kernel/capabilities.py +5 -6
- package/python/foxclaw/kernel/policy_gate.py +4 -10
- package/python/foxclaw/kernel/process_manager.py +17 -36
- package/python/foxclaw/kernel/scheduler.py +3 -9
- package/python/foxclaw/kernel/sentinel.py +13 -23
- package/python/foxclaw/kernel/sentinel_client.py +12 -15
- package/python/foxclaw/kernel/spine.py +9 -9
- package/python/foxclaw/knowledge/__init__.py +4 -20
- package/python/foxclaw/knowledge/truth_crystallizer.py +5 -8
- package/python/foxclaw/learning/knowledge_graph.py +4 -9
- package/python/foxclaw/learning/models.py +13 -13
- package/python/foxclaw/learning/reasoner.py +1 -4
- package/python/foxclaw/learning/runtime.py +19 -31
- package/python/foxclaw/learning/spaced_repetition.py +2 -7
- package/python/foxclaw/mcp_server.py +2 -3
- package/python/foxclaw/orchestration/__init__.py +16 -33
- package/python/foxclaw/pipeline/cognitive_pipeline.py +45 -97
- package/python/foxclaw/pipeline/stage_meta.py +21 -0
- package/python/foxclaw/pipeline/supervisor_stages.py +13 -42
- package/python/foxclaw/planning/llm_planner.py +3 -3
- package/python/foxclaw/planning/planner.py +6 -11
- package/python/foxclaw/search/agent_port.py +7 -11
- package/python/foxclaw/search/evidence.py +0 -4
- package/python/foxclaw/search/internal_search.py +3 -5
- package/python/foxclaw/search/models.py +11 -13
- package/python/foxclaw/search/planner.py +3 -3
- package/python/foxclaw/search/retriever.py +1 -1
- package/python/foxclaw/search/runtime.py +1 -8
- package/python/foxclaw/skills/__init__.py +46 -100
- package/python/foxclaw/skills/archive.py +111 -0
- package/python/foxclaw/skills/fetch.py +226 -0
- package/python/foxclaw/skills/hooks_spec.py +21 -25
- package/python/foxclaw/skills/install_cmd.py +216 -0
- package/python/foxclaw/skills/lifecycle.py +16 -42
- package/python/foxclaw/skills/markdown_skill.py +10 -9
- package/python/foxclaw/skills/mcp_client.py +5 -11
- package/python/foxclaw/skills/mcp_store.py +0 -3
- package/python/foxclaw/skills/permission.py +13 -48
- package/python/foxclaw/skills/pipeline.py +21 -53
- package/python/foxclaw/skills/policy.py +4 -10
- package/python/foxclaw/skills/review.py +3 -3
- package/python/frontend/deck/auth.js +0 -7
- package/python/frontend/deck/chat_model_picker.js +0 -54
- package/python/frontend/deck/domain.js +0 -20
- package/python/frontend/deck/main.js +0 -144
- package/python/frontend/deck/markdown.js +0 -4
- package/python/frontend/deck/settings.js +1 -18
- package/python/frontend/deck/state.js +0 -1
- package/python/frontend/deck/util.js +0 -2
- package/python/frontend/deck/visuals.js +0 -22
- package/python/frontend/planet/planet.js +18 -201
- package/python/frontend/v3/assets/index-JKfHlb-a.css +1 -0
- package/python/frontend/v3/assets/index-tN90dpUH.js +34 -0
- package/python/frontend/v3/index.html +3 -3
- package/python/frontend/widget_runtime.js +0 -43
- package/python/frontend/widgets.js +0 -57
- package/python/frontend_src/index.html +1 -1
- package/python/frontend_src/package-lock.json +2 -2
- package/python/frontend_src/package.json +1 -1
- package/python/frontend_src/src/App.vue +3 -7
- package/python/frontend_src/src/api.js +0 -7
- package/python/frontend_src/src/components/ChatDock.vue +27 -39
- package/python/frontend_src/src/components/DocViewer.vue +0 -9
- package/python/frontend_src/src/components/Inspector.vue +0 -6
- package/python/frontend_src/src/components/LeftRail.vue +60 -39
- package/python/frontend_src/src/components/MenuPopover.vue +9 -11
- package/python/frontend_src/src/components/MessageStream.vue +18 -30
- package/python/frontend_src/src/components/ModelPicker.vue +0 -5
- package/python/frontend_src/src/components/QuickIngest.vue +0 -6
- package/python/frontend_src/src/components/Stage.vue +71 -25
- package/python/frontend_src/src/components/ToolMenu.vue +0 -3
- package/python/frontend_src/src/components/TopBar.vue +38 -10
- package/python/frontend_src/src/components/panels/ActivityPanel.vue +0 -2
- package/python/frontend_src/src/components/panels/AgentsPanel.vue +2 -5
- package/python/frontend_src/src/components/panels/KnowledgePanel.vue +0 -16
- package/python/frontend_src/src/components/panels/MemoryPanel.vue +42 -3
- package/python/frontend_src/src/components/panels/PanelBox.vue +6 -7
- package/python/frontend_src/src/components/panels/ReviewPanel.vue +0 -16
- package/python/frontend_src/src/components/panels/SettingsPanel.vue +142 -38
- package/python/frontend_src/src/components/panels/TasksPanel.vue +0 -1
- package/python/frontend_src/src/components/panels/ToolsPanel.vue +125 -19
- package/python/frontend_src/src/lib/fmt.js +0 -4
- 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 +0 -14
- package/python/frontend_src/src/main.js +2 -0
- package/python/frontend_src/src/stores/app.js +17 -32
- package/python/frontend_src/src/stores/chat.js +0 -34
- package/python/frontend_src/src/stores/model.js +0 -8
- package/python/frontend_src/src/stores/panels.js +16 -44
- package/python/frontend_src/src/stores/profile.js +31 -0
- package/python/frontend_src/src/stores/system.js +25 -0
- package/python/frontend_src/vite.config.js +0 -7
- package/python/pyproject.toml +17 -3
- package/python/requirements.txt +311 -0
- package/python/tests/conftest.py +0 -22
- package/python/tests/run_all.py +4 -66
- package/python/tests/test_agent_lifecycle.py +4 -38
- package/python/tests/test_agent_rules.py +81 -0
- package/python/tests/test_ahs_p2.py +4 -25
- package/python/tests/test_anthropic_tools.py +1 -15
- package/python/tests/test_api.py +19 -9
- package/python/tests/test_api_auth.py +1 -5
- package/python/tests/test_attachments.py +9 -25
- package/python/tests/test_audit_chain.py +2 -7
- package/python/tests/test_audit_sink.py +0 -6
- package/python/tests/test_behavior_spec.py +198 -0
- package/python/tests/test_browser.py +2 -6
- package/python/tests/test_browser_request_guard.py +0 -4
- package/python/tests/test_capabilities.py +0 -6
- package/python/tests/test_channel_signing.py +2 -9
- package/python/tests/test_channels.py +1 -11
- package/python/tests/test_config_layering.py +0 -4
- package/python/tests/test_confirm_nonce.py +1 -12
- package/python/tests/test_conflict_dismiss.py +143 -0
- package/python/tests/test_content_guard.py +177 -0
- package/python/tests/test_context_compaction_wiring.py +1 -7
- package/python/tests/test_dispatch.py +0 -6
- package/python/tests/test_domain_evals.py +11 -80
- package/python/tests/test_domain_import.py +0 -6
- package/python/tests/test_domain_reasoners.py +0 -14
- package/python/tests/test_e2e.py +0 -17
- package/python/tests/test_emb_cache.py +7 -17
- package/python/tests/test_embedding_singleton.py +1 -3
- package/python/tests/test_evals_smoke.py +0 -24
- package/python/tests/test_event_spine.py +10 -18
- package/python/tests/test_evidence_semantic.py +1 -14
- package/python/tests/test_evidence_sse.py +3 -6
- package/python/tests/test_file_ingest.py +0 -11
- package/python/tests/test_finance.py +0 -9
- package/python/tests/test_finance_ledger.py +5 -12
- package/python/tests/test_finance_persist.py +8 -12
- package/python/tests/test_gateway.py +3 -22
- package/python/tests/test_governance.py +5 -52
- package/python/tests/test_governance_audit.py +4 -39
- package/python/tests/test_governance_middleware.py +1 -7
- package/python/tests/test_hkc.py +6 -24
- package/python/tests/test_hkc_index_build_manager.py +0 -33
- package/python/tests/test_hkc_manifest_reuse.py +4 -27
- package/python/tests/test_hkc_search_event_sync.py +3 -54
- package/python/tests/test_import_path_guard.py +0 -6
- package/python/tests/test_injection_guard.py +18 -36
- package/python/tests/test_integration.py +5 -29
- package/python/tests/test_itinerary.py +0 -3
- package/python/tests/test_kee_semantic.py +0 -5
- package/python/tests/test_kernel.py +1 -11
- package/python/tests/test_learning.py +3 -12
- package/python/tests/test_llm_admin.py +4 -19
- package/python/tests/test_llm_planner.py +1 -23
- package/python/tests/test_markdown_skills.py +3 -14
- package/python/tests/test_markdown_skills_openclaw.py +4 -9
- package/python/tests/test_mcp_connectors.py +3 -15
- package/python/tests/test_mcp_guardian_discovery.py +2 -6
- package/python/tests/test_mcp_no_memory.py +3 -3
- package/python/tests/test_mcp_policy_gate.py +0 -1
- package/python/tests/test_mcp_server.py +6 -9
- package/python/tests/test_memory_recall.py +1 -4
- package/python/tests/test_metrics.py +0 -8
- package/python/tests/test_multi_chain.py +1 -13
- package/python/tests/test_multimodal.py +5 -18
- package/python/tests/test_negotiation.py +3 -13
- package/python/tests/test_orchestration.py +1 -11
- package/python/tests/test_orchestration_decoupled.py +0 -6
- package/python/tests/test_p3_p5_hardening.py +3 -17
- package/python/tests/test_parallel_dispatch.py +4 -12
- package/python/tests/test_pipeline.py +17 -58
- package/python/tests/test_plan_visible.py +4 -4
- package/python/tests/test_planner.py +0 -7
- package/python/tests/test_policy_gate.py +2 -3
- package/python/tests/test_profile.py +67 -0
- package/python/tests/test_readme_claims.py +163 -0
- package/python/tests/test_reasoner.py +2 -17
- package/python/tests/test_release_check.py +2 -13
- package/python/tests/test_resume_checkpoint.py +7 -15
- package/python/tests/test_routing.py +2 -12
- package/python/tests/test_scheduler.py +7 -10
- package/python/tests/test_search.py +1 -11
- package/python/tests/test_secrets.py +4 -10
- package/python/tests/test_semantic.py +1 -10
- package/python/tests/test_sensitive_write.py +181 -0
- package/python/tests/test_sessions.py +3 -4
- package/python/tests/test_settings.py +2 -18
- package/python/tests/test_shadow_learning.py +3 -43
- package/python/tests/test_shared_write.py +0 -7
- package/python/tests/test_skill_taint_gate.py +1 -10
- package/python/tests/test_skills.py +2 -18
- package/python/tests/test_skills_fetch.py +282 -0
- package/python/tests/test_stats_and_events.py +2 -5
- package/python/tests/test_streaming.py +2 -7
- package/python/tests/test_supervisor_pipeline.py +4 -5
- package/python/tests/test_supervisor_triage.py +4 -10
- package/python/tests/test_taint.py +2 -7
- package/python/tests/test_task_stream.py +1 -12
- package/python/tests/test_thinking_sse.py +0 -1
- package/python/tests/test_tool_center.py +1 -17
- package/python/tests/test_tool_parallel.py +2 -2
- package/python/tests/test_tool_params.py +1 -5
- package/python/tests/test_tool_use.py +0 -13
- package/python/tests/test_toplevel_concurrency.py +3 -4
- package/python/tests/test_tracing.py +7 -41
- package/python/tests/test_truth_crystallizer.py +4 -6
- package/python/tests/test_truth_flow.py +2 -7
- package/python/tests/test_update_check.py +95 -0
- package/python/tests/test_verify_evidence.py +8 -21
- package/python/tests/test_version_sync.py +35 -6
- package/python/tests/test_web_trigger.py +0 -17
- package/python/tools/build_content_lexicon.py +218 -0
- package/python/tools/bundle_web.py +98 -0
- package/python/tools/check_faiss_type.py +0 -1
- package/python/tools/check_log.ps1 +0 -8
- package/python/tools/mypy_baseline.txt +12 -4
- package/python/tools/mypy_ratchet.py +52 -6
- package/python/tools/pack.py +0 -5
- package/python/tools/recheck_conflicts.py +156 -0
- package/python/tools/release_check.py +24 -15
- package/python/tools/restart_foxclaw.ps1 +5 -8
- package/python/tools/shared_write_audit.py +1 -15
- package/python/tools/size_check.py +1 -1
- package/python/tools/strip_comments.py +228 -0
- package/python/vendor/hkc/hkc_api/routes/ability.py +31 -0
- package/python/vendor/hkc/hkc_api/schemas.py +11 -0
- package/python/vendor/hkc/hkc_kee/kee.py +124 -3
- package/python/vendor/hkc/hkc_sdk/base.py +22 -0
- package/python/vendor/hkc/hkc_sdk/direct_client.py +10 -0
- package/python/vendor/hkc/hkc_sdk/http_client.py +19 -0
- package/python/foxclaw/api/app.py +0 -123
- package/python/frontend/v3/assets/index-BD7VPbMV.js +0 -33
- package/python/frontend/v3/assets/index-CAvnYWGH.css +0 -1
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { escapeHtml } from './util.js';
|
|
2
2
|
|
|
3
|
-
/* ===== 安全 Markdown 渲染(模型输出不可信 → 先整体转义,再只发白名单标签;URL 校验 scheme)=====
|
|
4
|
-
支持:标题/粗斜体/行内码/代码块/列表/引用/分割线/链接/图片,以及裸图/音/视频 URL 内嵌。
|
|
5
|
-
代码块占位哨兵用私用区字符 (源码里是 ASCII 转义、运行时是该字符,模型文本不会出现 → 无碰撞)。*/
|
|
6
3
|
function _safeUrl(u){ u=(u||'').trim(); return (/^https?:\/\//i.test(u)||/^mailto:/i.test(u))?u:''; }
|
|
7
4
|
function _safeImgUrl(u){ u=(u||'').trim(); return (/^https?:\/\//i.test(u)||/^data:image\/(png|jpe?g|gif|webp);base64,/i.test(u))?u:''; }
|
|
8
5
|
function _mdInline(s){
|
|
9
|
-
// s 已在 renderMarkdown 里被 escapeHtml,故 <>&" 均为文本;这里只做 markdown 内联生成白名单标签
|
|
10
6
|
s=s.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g,(m,alt,url)=>{ const u=_safeImgUrl(url); return u?`<img class="cc-img" src="${u}" alt="${alt}" loading="lazy">`:m; });
|
|
11
7
|
s=s.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(m,txt,url)=>{ const u=_safeUrl(url); return u?`<a href="${u}" target="_blank" rel="noopener noreferrer">${txt}</a>`:m; });
|
|
12
8
|
s=s.replace(/(^|\s)(https?:\/\/[^\s<]+?\.(?:png|jpe?g|gif|webp))(?=\s|$)/gi,(m,pre,url)=>`${pre}<img class="cc-img" src="${url}" alt="" loading="lazy">`);
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { API } from './state.js';
|
|
2
2
|
|
|
3
|
-
/* ===== 设置面板 ===== */
|
|
4
3
|
const SETTINGS_TITLE={
|
|
5
4
|
model:'模型路由',runtime:'运行参数',ui:'界面偏好',data:'数据管理',auth:'访问密钥',about:'关于',
|
|
6
5
|
'ag-supervisor':'主管 Agent','ag-finance':'财务 Agent','ag-admin':'行政 Agent',
|
|
7
6
|
'ag-office':'办公 Agent','ag-assistant':'助手 Agent',
|
|
8
7
|
'mem-backend':'记忆后端','mem-layer':'双层记忆','mem-recall':'召回参数','mem-manage':'记忆管理',
|
|
9
8
|
};
|
|
10
|
-
// 界面偏好(纯前端,存内存)
|
|
11
9
|
export const uiPref={ autoChat:true, ballAnim:false, mapStyle:'light' }; // ballAnim 默认 false(球体特效默认关,省 GPU;需要时手动勾)
|
|
12
10
|
let _sysInfo=null;
|
|
13
11
|
async function fetchSysInfo(){ try{ _sysInfo=await(await fetch(`${API}/system/info`)).json(); }catch(e){ _sysInfo=null; } return _sysInfo; }
|
|
@@ -15,7 +13,6 @@ async function fetchSysInfo(){ try{ _sysInfo=await(await fetch(`${API}/system/in
|
|
|
15
13
|
async function renderSettingDetail(key){
|
|
16
14
|
const body=document.getElementById('sdBody');
|
|
17
15
|
body.innerHTML='<div class="sd-ph">加载中…</div>';
|
|
18
|
-
// ── Foxclaw 主系统 ──
|
|
19
16
|
if(key==='model'){
|
|
20
17
|
const d=await fetchSysInfo(); const m=d?.model||{};
|
|
21
18
|
let h=`<div class="sd-card"><div class="sd-k">当前模型</div>
|
|
@@ -91,7 +88,7 @@ async function renderSettingDetail(key){
|
|
|
91
88
|
<div class="sd-kv"><span>办公 Office</span><b>学习 · 知识图谱</b></div>
|
|
92
89
|
<div class="sd-kv"><span>助手 Assistant</span><b>通用 · Skill 接入</b></div>
|
|
93
90
|
<div class="sd-sec">三大模块</div>
|
|
94
|
-
<div class="sd-desc">Foxclaw(主系统) · Agents(
|
|
91
|
+
<div class="sd-desc">Foxclaw(主系统) · Agents(三智能体) · HMR(记忆系统)</div>
|
|
95
92
|
<div class="sd-note">配置说明见项目 <code>docs/配置指南.md</code></div>`;
|
|
96
93
|
}else if(key && key.startsWith('mem-')){
|
|
97
94
|
const s=await(await fetch(`${API}/memory/stats`)).json().catch(()=>({}));
|
|
@@ -138,7 +135,6 @@ async function renderSettingDetail(key){
|
|
|
138
135
|
}
|
|
139
136
|
}
|
|
140
137
|
|
|
141
|
-
/* 单个 Agent 设置详情(5 个共用 + 领域特定块)*/
|
|
142
138
|
const AGENT_META={
|
|
143
139
|
supervisor:{cn:'主管',en:'Supervisor',ac:'#ffc24b',role:'分诊调度 · 全局态势编排'},
|
|
144
140
|
finance:{cn:'财务',en:'Finance',ac:'#00ffb2',role:'理财 · 预算 · 风控守门'},
|
|
@@ -159,7 +155,6 @@ async function renderAgentDetail(aid, body){
|
|
|
159
155
|
<div class="sd-big" style="color:${meta.ac}">${meta.cn} <span>${meta.en}</span></div>
|
|
160
156
|
<div class="sd-desc">${meta.role}</div></div>`;
|
|
161
157
|
|
|
162
|
-
// Harness 漂移检测
|
|
163
158
|
h+='<div class="sd-sec">Harness 漂移检测<span class="badge ro">只读</span></div>';
|
|
164
159
|
h+=`<div class="sd-kv"><span>运行模式</span><b style="color:${shadow?'var(--amber)':'var(--green)'}">${shadow?'影子校准中':'已激活拦截'}</b></div>`;
|
|
165
160
|
h+=`<div class="sd-kv"><span>校准进度</span><b>${run} / ${rounds} 轮</b></div>`;
|
|
@@ -171,7 +166,6 @@ async function renderAgentDetail(aid, body){
|
|
|
171
166
|
h+=`<div class="sd-kv"><span>三维权重</span><b>语义 ${fmt(w.semantic)} · 工具 ${fmt(w.tool)} · 范围 ${fmt(w.scope)}</b></div>`;
|
|
172
167
|
}
|
|
173
168
|
|
|
174
|
-
// 守门人 Policy
|
|
175
169
|
h+='<div class="sd-sec">守门人 Policy<span class="badge ro">只读</span></div>';
|
|
176
170
|
if(pol.version!=null||pol.total_rules!=null){
|
|
177
171
|
h+=`<div class="sd-kv"><span>Policy 版本</span><b>v${pol.version??'—'}</b></div>`;
|
|
@@ -181,7 +175,6 @@ async function renderAgentDetail(aid, body){
|
|
|
181
175
|
h+='<div class="sd-desc">策略随运行自学习更新,当前无自定义规则覆盖。</div>';
|
|
182
176
|
}
|
|
183
177
|
|
|
184
|
-
// 领域特定块
|
|
185
178
|
if(aid==='admin'){
|
|
186
179
|
h+='<div class="sd-sec">高德地图(行政专属)<span class="badge ro">只读</span></div>';
|
|
187
180
|
const a=sys?.amap||{};
|
|
@@ -207,7 +200,6 @@ async function renderAgentDetail(aid, body){
|
|
|
207
200
|
h+='<div class="sd-note">Agent 行为参数大多在后端 policy 与代码中定义,此处为只读状态展示。漂移阈值由影子校准期自动学习得出。</div>';
|
|
208
201
|
body.innerHTML=h;
|
|
209
202
|
|
|
210
|
-
// 行政地图暗色开关联动
|
|
211
203
|
const md=document.getElementById('pf-mapDark2');
|
|
212
204
|
if(md) md.onchange=e=>{ uiPref.mapStyle=e.target.checked?'dark':'light'; };
|
|
213
205
|
}
|
|
@@ -218,17 +210,12 @@ export async function switchProvider(prov){
|
|
|
218
210
|
}
|
|
219
211
|
function toggleBallAnim(on){
|
|
220
212
|
const c=document.getElementById('coreCanvas'); if(c)c.style.display=on?'block':'none';
|
|
221
|
-
// 仅 display:none 不够(loop 还在 60fps 跑,吃 GPU)→ 同步设置 localStorage 标志,
|
|
222
|
-
// 引导用户硬刷一次(自动 reload)。visuals.js 顶部 _lowpower 检查,刷新后即生效。
|
|
223
213
|
try{ localStorage.setItem('foxclaw_lowpower', on ? '0' : '1'); }catch{}
|
|
224
|
-
// 仅当「关」才 reload(开不影响,因为持久态 = 0 时不阻止)
|
|
225
214
|
if (!on) {
|
|
226
|
-
// 提示一下,避免用户疑惑
|
|
227
215
|
console.info('[foxclaw] 关掉球动画后需刷新一次才停止 GPU 占用');
|
|
228
216
|
}
|
|
229
217
|
}
|
|
230
218
|
|
|
231
|
-
/* 二级子项定义 */
|
|
232
219
|
const SETTINGS_SUBS={
|
|
233
220
|
foxclaw:[['model','模型路由'],['runtime','运行参数'],['ui','界面偏好'],['data','数据管理'],['auth','访问密钥'],['about','关于']],
|
|
234
221
|
agents:[['ag-supervisor','主管 Agent'],['ag-finance','财务 Agent'],['ag-admin','行政 Agent'],['ag-office','办公 Agent'],['ag-assistant','助手 Agent']],
|
|
@@ -240,13 +227,11 @@ const _sdPop=document.getElementById('sdPop');
|
|
|
240
227
|
let _setHideTimer=null;
|
|
241
228
|
|
|
242
229
|
export function openSetMenu(){ clearTimeout(_setHideTimer); _setMenu.classList.add('show'); }
|
|
243
|
-
/* 直接打开「访问密钥」设置详情(供 main.js 的鉴权提示条调用) */
|
|
244
230
|
export function openAuthSetting(){ _setMenu.classList.add('show'); openDetailPop('auth'); }
|
|
245
231
|
function closeSetMenu(){
|
|
246
232
|
clearTimeout(_setHideTimer);
|
|
247
233
|
_setHideTimer=setTimeout(()=>{ _setMenu.classList.remove('show'); _smL2.innerHTML=''; document.querySelectorAll('.sm-l1 .sm-btn').forEach(b=>b.classList.remove('active')); }, 400);
|
|
248
234
|
}
|
|
249
|
-
// 一级悬停 → 展开二级
|
|
250
235
|
function showL2(group, l1btn){
|
|
251
236
|
document.querySelectorAll('.sm-l1 .sm-btn').forEach(b=>b.classList.remove('active'));
|
|
252
237
|
l1btn.classList.add('active');
|
|
@@ -279,8 +264,6 @@ document.querySelectorAll('.nav-mini, .feed-item').forEach(it=>{
|
|
|
279
264
|
it.addEventListener('click',()=>{ it.classList.add('pressed'); setTimeout(()=>it.classList.remove('pressed'),180); });
|
|
280
265
|
});
|
|
281
266
|
|
|
282
|
-
|
|
283
|
-
/* ===== 模型选择器 ===== */
|
|
284
267
|
const PROVIDER_LABEL=
|
|
285
268
|
{anthropic:{n:'Claude',c:'#ff9d00'},openai:{n:'GPT',c:'#00ffb2'},
|
|
286
269
|
google:{n:'Gemini',c:'#38bdf8'},qwen:{n:'通义千问',c:'#ffc24b'},
|
|
@@ -1,28 +1,15 @@
|
|
|
1
|
-
/* ═══════ 球体特效开关:默认关,需要时手动开 ═══════
|
|
2
|
-
─ 手动开(任一即生效):
|
|
3
|
-
1) URL 加 ?visual=1 临时(本次会话)
|
|
4
|
-
2) localStorage.foxclaw_visual = "1" 永久
|
|
5
|
-
3) 设置 → 界面偏好 → 背景全息球动画 勾选 永久(写 localStorage.foxclaw_lowpower=0,兼容旧 toggle)
|
|
6
|
-
─ 系统级默认关(无需操作):
|
|
7
|
-
4) matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
8
|
-
5) navigator.connection.saveData === true
|
|
9
|
-
─ 默认:true(不启动 4 个 canvas 动画 + 粒子 emit,省 GPU/CPU,启动秒开) */
|
|
10
1
|
const _lowpower = (() => {
|
|
11
2
|
try {
|
|
12
|
-
// 显式开:URL / localStorage / 旧版 toggleBallAnim
|
|
13
3
|
if (new URLSearchParams(location.search).get('visual') === '1') return false;
|
|
14
4
|
if (localStorage.getItem('foxclaw_visual') === '1') return false;
|
|
15
5
|
if (localStorage.getItem('foxclaw_lowpower') === '0') return false; // 兼容旧版开关
|
|
16
|
-
// 显式关:URL ?low=1 仍生效(应急)
|
|
17
6
|
if (new URLSearchParams(location.search).get('low') === '1') return true;
|
|
18
|
-
// 系统级 → 关
|
|
19
7
|
if (matchMedia('(prefers-reduced-motion: reduce)').matches) return true;
|
|
20
8
|
if (navigator.connection && navigator.connection.saveData) return true;
|
|
21
9
|
} catch {}
|
|
22
10
|
return true; // ← 默认:不启动(保护 GPU + 启动秒开)
|
|
23
11
|
})();
|
|
24
12
|
window._foxclawLowpower = _lowpower; // 暴露给其他模块读
|
|
25
|
-
// 暴露切换 API(控制台手动开: foxclawVisual.on() / 永久关: foxclawVisual.off() / 状态: foxclawVisual.isOn())
|
|
26
13
|
window.foxclawVisual = {
|
|
27
14
|
isOn: () => !_lowpower,
|
|
28
15
|
on() { try { localStorage.setItem('foxclaw_visual', '1'); } catch{} location.reload(); },
|
|
@@ -36,7 +23,6 @@ function _lpThrottle(fn, fps) { // 30fps 节流(不关,但降频)— 关
|
|
|
36
23
|
return function(t) { if (t - last >= gap) { last = t; fn(t); } };
|
|
37
24
|
}
|
|
38
25
|
|
|
39
|
-
/* ====== 中央全息核心 ====== */
|
|
40
26
|
(function(){
|
|
41
27
|
if (_lowpower) return; // 省电:不开中央全息核心(520 球面点 + 经纬弧 + 渐变 60fps)
|
|
42
28
|
const c=document.getElementById('coreCanvas'), x=c.getContext('2d');
|
|
@@ -50,13 +36,11 @@ function _lpThrottle(fn, fps) { // 30fps 节流(不关,但降频)— 关
|
|
|
50
36
|
x.clearRect(0,0,c.width,c.height);
|
|
51
37
|
const cx=c.width/2, cy=c.height/2, R=Math.min(cx,cy)*0.62;
|
|
52
38
|
rot+=0.0024;
|
|
53
|
-
// 光环底座
|
|
54
39
|
for(let k=0;k<3;k++){
|
|
55
40
|
x.beginPath();
|
|
56
41
|
x.ellipse(cx,cy+R*0.92,R*(1.05+k*0.18),R*(0.26+k*0.05),0,0,Math.PI*2);
|
|
57
42
|
x.strokeStyle=`rgba(0,217,255,${0.18-k*0.04})`; x.lineWidth=2; x.stroke();
|
|
58
43
|
}
|
|
59
|
-
// 球面点
|
|
60
44
|
for(const pt of pts){
|
|
61
45
|
const t=pt.t, p=pt.p+rot;
|
|
62
46
|
const xx=Math.sin(t)*Math.cos(p), yy=Math.cos(t), zz=Math.sin(t)*Math.sin(p);
|
|
@@ -66,7 +50,6 @@ function _lpThrottle(fn, fps) { // 30fps 节流(不关,但降频)— 关
|
|
|
66
50
|
const hue=depth>0.5?'0,217,255':'255,194,75';
|
|
67
51
|
x.fillStyle=`rgba(${hue},${depth*0.85+0.1})`; x.fill();
|
|
68
52
|
}
|
|
69
|
-
// 经纬弧
|
|
70
53
|
x.strokeStyle='rgba(41,243,255,.12)';x.lineWidth=1;
|
|
71
54
|
for(let m=0;m<6;m++){
|
|
72
55
|
x.beginPath();
|
|
@@ -75,7 +58,6 @@ function _lpThrottle(fn, fps) { // 30fps 节流(不关,但降频)— 关
|
|
|
75
58
|
const sx=cx+xx*R,sy=cy+yy*R; a?x.lineTo(sx,sy):x.moveTo(sx,sy);}
|
|
76
59
|
x.stroke();
|
|
77
60
|
}
|
|
78
|
-
// 中央辉光
|
|
79
61
|
const g=x.createRadialGradient(cx,cy,0,cx,cy,R*0.5);
|
|
80
62
|
g.addColorStop(0,'rgba(0,217,255,.28)');g.addColorStop(1,'transparent');
|
|
81
63
|
x.fillStyle=g;x.beginPath();x.arc(cx,cy,R*0.5,0,Math.PI*2);x.fill();
|
|
@@ -84,7 +66,6 @@ function _lpThrottle(fn, fps) { // 30fps 节流(不关,但降频)— 关
|
|
|
84
66
|
loop();
|
|
85
67
|
})();
|
|
86
68
|
|
|
87
|
-
/* ====== 记忆向量空间 ====== */
|
|
88
69
|
(function(){
|
|
89
70
|
if (_lowpower) return; // 省电:不开记忆向量空间动画
|
|
90
71
|
const c=document.getElementById('memCanvas'); if(!c) return; // 右栏改版后无此装饰画布 → 静默跳过
|
|
@@ -113,7 +94,6 @@ function _lpThrottle(fn, fps) { // 30fps 节流(不关,但降频)— 关
|
|
|
113
94
|
loop();
|
|
114
95
|
})();
|
|
115
96
|
|
|
116
|
-
/* ====== 中枢数据流:核心球↔Agent 信息流动 ====== */
|
|
117
97
|
(function(){
|
|
118
98
|
if (_lowpower) return; // 省电:不开中枢数据流 + 2.2s 粒子 emit
|
|
119
99
|
const cv=document.getElementById('streamCanvas'); if(!cv)return;
|
|
@@ -139,7 +119,6 @@ function _lpThrottle(fn, fps) { // 30fps 节流(不关,但降频)— 关
|
|
|
139
119
|
if(!targets.length)return;
|
|
140
120
|
let t;
|
|
141
121
|
if(targetAgent){
|
|
142
|
-
// 定向:射向指定 Agent(发任务时用)
|
|
143
122
|
const cards=[...document.querySelectorAll('.acard')];
|
|
144
123
|
const idx=cards.findIndex(c=>c.dataset.agent===targetAgent);
|
|
145
124
|
t=idx>=0?targets[idx]:targets[Math.floor(Math.random()*targets.length)];
|
|
@@ -185,7 +164,6 @@ function _lpThrottle(fn, fps) { // 30fps 节流(不关,但降频)— 关
|
|
|
185
164
|
setTimeout(emit, 800);
|
|
186
165
|
})();
|
|
187
166
|
|
|
188
|
-
/* ====== 系统活动波形(已移除,保留空值保护)====== */
|
|
189
167
|
(function(){
|
|
190
168
|
if (_lowpower) return; // 省电:不开系统活动波形
|
|
191
169
|
const c=document.getElementById('actCanvas'); if(!c)return;
|