foxclaw 0.1.0 → 0.1.2
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 +11 -10
- package/package.json +46 -38
- package/python/.dockerignore +35 -0
- package/python/.env.example +165 -0
- package/python/.gitattributes +46 -0
- package/python/.github/workflows/ci.yml +122 -0
- package/python/.github/workflows/release.yml +183 -0
- package/python/Dockerfile +64 -0
- package/python/LICENSE +21 -0
- package/python/MANIFEST.in +14 -0
- package/python/README.md +192 -0
- package/python/README_CN.md +324 -0
- package/python/bench/bm25_audit.py +199 -0
- package/python/bench/bm25_regression.py +178 -0
- package/python/bench/bm25_stress.py +159 -0
- package/python/bench/cd_audit.py +238 -0
- package/python/bench/chaos.py +142 -0
- package/python/bench/concurrency.py +103 -0
- package/python/bench/e2e_real_models.py +95 -0
- package/python/bench/llm_retry_test.py +248 -0
- package/python/bench/load_test.py +196 -0
- package/python/bench/vector_ivf_upgrade.py +134 -0
- package/python/docs/CHANNELS.md +195 -0
- package/python/docs/GOVERNANCE.md +164 -0
- package/python/docs/RELEASE.md +109 -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 +152 -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 +400 -0
- package/python/examples/governance_middleware_demo.py +77 -0
- package/python/examples/langgraph_governance_demo.py +108 -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 +526 -0
- package/python/foxclaw/agents/__init__.py +12 -0
- package/python/foxclaw/agents/agents.py +35 -0
- package/python/foxclaw/agents/base.py +865 -0
- package/python/foxclaw/agents/impl/__init__.py +1 -0
- package/python/foxclaw/agents/impl/_helpers.py +78 -0
- package/python/foxclaw/agents/impl/finance.py +248 -0
- package/python/foxclaw/agents/impl/office.py +367 -0
- package/python/foxclaw/agents/impl/supervisor.py +659 -0
- package/python/foxclaw/agents/mixins/_context.py +151 -0
- package/python/foxclaw/agents/mixins/augment.py +149 -0
- package/python/foxclaw/agents/mixins/llm.py +66 -0
- package/python/foxclaw/agents/mixins/memory.py +35 -0
- package/python/foxclaw/agents/mixins/preference.py +81 -0
- package/python/foxclaw/agents/mixins/prompt.py +77 -0
- package/python/foxclaw/agents/mixins/skillbox.py +58 -0
- package/python/foxclaw/agents/mixins/tool_exec.py +443 -0
- package/python/foxclaw/api/__init__.py +283 -0
- package/python/foxclaw/api/app.py +123 -0
- package/python/foxclaw/api/middleware.py +317 -0
- package/python/foxclaw/api/routes/ahs.py +417 -0
- package/python/foxclaw/api/routes/attachments.py +117 -0
- package/python/foxclaw/api/routes/browser.py +39 -0
- package/python/foxclaw/api/routes/domain.py +314 -0
- package/python/foxclaw/api/routes/knowledge.py +163 -0
- package/python/foxclaw/api/routes/llm_admin.py +461 -0
- package/python/foxclaw/api/routes/memory.py +89 -0
- package/python/foxclaw/api/routes/orchestration.py +41 -0
- package/python/foxclaw/api/routes/recovery.py +43 -0
- package/python/foxclaw/api/routes/review.py +275 -0
- package/python/foxclaw/api/routes/search.py +37 -0
- package/python/foxclaw/api/routes/system.py +327 -0
- package/python/foxclaw/api/routes/task.py +281 -0
- package/python/foxclaw/api/routes/ws.py +68 -0
- package/python/foxclaw/api/spine.py +55 -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 +54 -0
- package/python/foxclaw/browser/action/action_types.py +45 -0
- package/python/foxclaw/browser/action/action_verifier.py +68 -0
- package/python/foxclaw/browser/action/url_policy.py +147 -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 +166 -0
- package/python/foxclaw/browser/perception/__init__.py +1 -0
- package/python/foxclaw/browser/perception/dom_extractor.py +43 -0
- package/python/foxclaw/browser/perception/element_indexer.py +57 -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 +148 -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 +67 -0
- package/python/foxclaw/channels/__init__.py +140 -0
- package/python/foxclaw/channels/discord.py +184 -0
- package/python/foxclaw/channels/dispatcher.py +204 -0
- package/python/foxclaw/channels/feishu.py +225 -0
- package/python/foxclaw/channels/openclaw_bridge.py +156 -0
- package/python/foxclaw/channels/signing.py +187 -0
- package/python/foxclaw/channels/telegram.py +121 -0
- package/python/foxclaw/channels/weixin.py +225 -0
- package/python/foxclaw/cli.py +154 -0
- package/python/foxclaw/cognitive/__init__.py +4 -0
- package/python/foxclaw/cognitive/reasoner.py +82 -0
- package/python/foxclaw/cognitive/state.py +147 -0
- package/python/foxclaw/core/__init__.py +9 -0
- package/python/foxclaw/core/audit_chain.py +133 -0
- package/python/foxclaw/core/audit_sink.py +100 -0
- package/python/foxclaw/core/compaction.py +283 -0
- package/python/foxclaw/core/config.py +65 -0
- package/python/foxclaw/core/confirm_nonce.py +157 -0
- package/python/foxclaw/core/dispatch.py +27 -0
- package/python/foxclaw/core/envfile.py +48 -0
- package/python/foxclaw/core/failure_policy.py +151 -0
- package/python/foxclaw/core/gateway.py +85 -0
- package/python/foxclaw/core/governance_audit.py +175 -0
- package/python/foxclaw/core/idempotency.py +289 -0
- package/python/foxclaw/core/injection_guard.py +221 -0
- package/python/foxclaw/core/memory_adapter.py +516 -0
- package/python/foxclaw/core/metrics.py +89 -0
- package/python/foxclaw/core/model_router.py +1097 -0
- package/python/foxclaw/core/paths.py +103 -0
- package/python/foxclaw/core/recovery.py +362 -0
- package/python/foxclaw/core/scheduler.py +144 -0
- package/python/foxclaw/core/secrets.py +134 -0
- package/python/foxclaw/core/sessions.py +157 -0
- package/python/foxclaw/core/settings.py +430 -0
- package/python/foxclaw/core/shared_write.py +198 -0
- package/python/foxclaw/core/steering_queue.py +153 -0
- package/python/foxclaw/core/system_bus.py +84 -0
- package/python/foxclaw/core/thought_chain.py +318 -0
- package/python/foxclaw/core/token_meter.py +235 -0
- package/python/foxclaw/core/tools.py +172 -0
- package/python/foxclaw/core/tracing.py +390 -0
- package/python/foxclaw/core/truth_pipeline.py +114 -0
- package/python/foxclaw/core/vec_recall_adapter.py +503 -0
- package/python/foxclaw/core/verify.py +181 -0
- package/python/foxclaw/core/web_search.py +242 -0
- package/python/foxclaw/finance/__init__.py +15 -0
- package/python/foxclaw/finance/evidence.py +153 -0
- package/python/foxclaw/finance/fx.py +100 -0
- package/python/foxclaw/finance/graph.py +188 -0
- package/python/foxclaw/finance/models.py +150 -0
- package/python/foxclaw/finance/nlparse.py +575 -0
- package/python/foxclaw/finance/policy.py +329 -0
- package/python/foxclaw/finance/reasoner.py +129 -0
- package/python/foxclaw/finance/reasoning.py +340 -0
- package/python/foxclaw/finance/reconcile.py +180 -0
- package/python/foxclaw/finance/runtime.py +527 -0
- package/python/foxclaw/governance/__init__.py +24 -0
- package/python/foxclaw/governance/middleware.py +184 -0
- package/python/foxclaw/harness/__init__.py +17 -0
- package/python/foxclaw/harness/_base.py +72 -0
- package/python/foxclaw/harness/_policy.py +359 -0
- package/python/foxclaw/harness/drift.py +89 -0
- package/python/foxclaw/harness/event_bus.py +31 -0
- package/python/foxclaw/harness/harness.py +446 -0
- package/python/foxclaw/harness/loop_detection.py +152 -0
- package/python/foxclaw/itinerary/__init__.py +10 -0
- package/python/foxclaw/itinerary/amap_client.py +117 -0
- package/python/foxclaw/itinerary/models.py +80 -0
- package/python/foxclaw/itinerary/reasoner.py +101 -0
- package/python/foxclaw/itinerary/reasoning.py +174 -0
- package/python/foxclaw/itinerary/runtime.py +148 -0
- package/python/foxclaw/kernel/__init__.py +13 -0
- package/python/foxclaw/kernel/capabilities.py +73 -0
- package/python/foxclaw/kernel/policy_gate.py +114 -0
- package/python/foxclaw/kernel/process_manager.py +205 -0
- package/python/foxclaw/kernel/scheduler.py +131 -0
- package/python/foxclaw/kernel/sentinel.py +453 -0
- package/python/foxclaw/kernel/sentinel_client.py +246 -0
- package/python/foxclaw/kernel/spine.py +97 -0
- package/python/foxclaw/knowledge/__init__.py +376 -0
- package/python/foxclaw/knowledge/truth_crystallizer.py +92 -0
- package/python/foxclaw/learning/__init__.py +12 -0
- package/python/foxclaw/learning/knowledge_graph.py +149 -0
- package/python/foxclaw/learning/models.py +93 -0
- package/python/foxclaw/learning/reasoner.py +70 -0
- package/python/foxclaw/learning/runtime.py +363 -0
- package/python/foxclaw/learning/spaced_repetition.py +96 -0
- package/python/foxclaw/mcp_server.py +189 -0
- package/python/foxclaw/orchestration/__init__.py +184 -0
- package/python/foxclaw/pipeline/__init__.py +23 -0
- package/python/foxclaw/pipeline/cognitive_pipeline.py +481 -0
- package/python/foxclaw/pipeline/supervisor_stages.py +230 -0
- package/python/foxclaw/planning/__init__.py +17 -0
- package/python/foxclaw/planning/llm_planner.py +232 -0
- package/python/foxclaw/planning/planner.py +99 -0
- package/python/foxclaw/search/__init__.py +24 -0
- package/python/foxclaw/search/agent_port.py +194 -0
- package/python/foxclaw/search/evidence.py +113 -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 +73 -0
- package/python/foxclaw/search/models.py +129 -0
- package/python/foxclaw/search/planner.py +44 -0
- package/python/foxclaw/search/retriever.py +39 -0
- package/python/foxclaw/search/runtime.py +134 -0
- package/python/foxclaw/search/strategy.py +44 -0
- package/python/foxclaw/skills/__init__.py +613 -0
- package/python/foxclaw/skills/hooks_spec.py +73 -0
- package/python/foxclaw/skills/lifecycle.py +278 -0
- package/python/foxclaw/skills/markdown_skill.py +174 -0
- package/python/foxclaw/skills/markdown_store.py +39 -0
- package/python/foxclaw/skills/mcp_client.py +190 -0
- package/python/foxclaw/skills/mcp_store.py +43 -0
- package/python/foxclaw/skills/permission.py +180 -0
- package/python/foxclaw/skills/pipeline.py +386 -0
- package/python/foxclaw/skills/policy.py +80 -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 +32 -0
- package/python/frontend/deck/chat_model_picker.js +537 -0
- package/python/frontend/deck/domain.js +296 -0
- package/python/frontend/deck/main.js +1950 -0
- package/python/frontend/deck/markdown.js +48 -0
- package/python/frontend/deck/settings.js +324 -0
- package/python/frontend/deck/state.js +6 -0
- package/python/frontend/deck/util.js +6 -0
- package/python/frontend/deck/visuals.js +212 -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 +1637 -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-BD7VPbMV.js +33 -0
- package/python/frontend/v3/assets/index-CAvnYWGH.css +1 -0
- package/python/frontend/v3/index.html +15 -0
- package/python/frontend/widget_runtime.js +295 -0
- package/python/frontend/widgets.js +696 -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 +62 -0
- package/python/frontend_src/src/api.js +89 -0
- package/python/frontend_src/src/components/ChatDock.vue +377 -0
- package/python/frontend_src/src/components/ComposerMenu.vue +75 -0
- package/python/frontend_src/src/components/DocViewer.vue +171 -0
- package/python/frontend_src/src/components/Inspector.vue +241 -0
- package/python/frontend_src/src/components/LeftRail.vue +394 -0
- package/python/frontend_src/src/components/MenuPopover.vue +130 -0
- package/python/frontend_src/src/components/MessageStream.vue +401 -0
- package/python/frontend_src/src/components/ModelPicker.vue +355 -0
- package/python/frontend_src/src/components/QuickIngest.vue +118 -0
- package/python/frontend_src/src/components/Stage.vue +226 -0
- package/python/frontend_src/src/components/ToolMenu.vue +144 -0
- package/python/frontend_src/src/components/TopBar.vue +90 -0
- package/python/frontend_src/src/components/panels/ActivityPanel.vue +84 -0
- package/python/frontend_src/src/components/panels/AgentsPanel.vue +86 -0
- package/python/frontend_src/src/components/panels/KnowledgePanel.vue +441 -0
- package/python/frontend_src/src/components/panels/MemoryPanel.vue +118 -0
- package/python/frontend_src/src/components/panels/PanelBox.vue +51 -0
- package/python/frontend_src/src/components/panels/ReviewPanel.vue +308 -0
- package/python/frontend_src/src/components/panels/SettingsPanel.vue +254 -0
- package/python/frontend_src/src/components/panels/TasksPanel.vue +74 -0
- package/python/frontend_src/src/components/panels/ToolsPanel.vue +640 -0
- package/python/frontend_src/src/components/panels/UsagePanel.vue +105 -0
- package/python/frontend_src/src/lib/fmt.js +48 -0
- package/python/frontend_src/src/lib/md.js +204 -0
- package/python/frontend_src/src/main.js +7 -0
- package/python/frontend_src/src/stores/app.js +106 -0
- package/python/frontend_src/src/stores/chat.js +484 -0
- package/python/frontend_src/src/stores/model.js +104 -0
- package/python/frontend_src/src/stores/panels.js +330 -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 +46 -0
- package/python/pyproject.toml +265 -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 +76 -0
- package/python/tests/run_all.py +263 -0
- package/python/tests/test_agent_lifecycle.py +360 -0
- package/python/tests/test_ahs_p2.py +414 -0
- package/python/tests/test_anthropic_tools.py +206 -0
- package/python/tests/test_api.py +87 -0
- package/python/tests/test_api_auth.py +83 -0
- package/python/tests/test_api_host_guard.py +69 -0
- package/python/tests/test_attachments.py +167 -0
- package/python/tests/test_audit_chain.py +121 -0
- package/python/tests/test_audit_sink.py +136 -0
- package/python/tests/test_browser.py +153 -0
- package/python/tests/test_browser_request_guard.py +184 -0
- package/python/tests/test_capabilities.py +158 -0
- package/python/tests/test_channel_signing.py +192 -0
- package/python/tests/test_channel_trust.py +109 -0
- package/python/tests/test_channels.py +184 -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 +65 -0
- package/python/tests/test_confirm_nonce.py +197 -0
- package/python/tests/test_context_compaction_wiring.py +130 -0
- package/python/tests/test_dispatch.py +95 -0
- package/python/tests/test_domain_evals.py +403 -0
- package/python/tests/test_domain_import.py +78 -0
- package/python/tests/test_domain_reasoners.py +148 -0
- package/python/tests/test_e2e.py +178 -0
- package/python/tests/test_emb_cache.py +107 -0
- package/python/tests/test_embedding_singleton.py +89 -0
- package/python/tests/test_envfile.py +83 -0
- package/python/tests/test_evals_smoke.py +114 -0
- package/python/tests/test_event_spine.py +182 -0
- package/python/tests/test_evidence_semantic.py +101 -0
- package/python/tests/test_evidence_sse.py +97 -0
- package/python/tests/test_file_ingest.py +146 -0
- package/python/tests/test_finance.py +153 -0
- package/python/tests/test_finance_ledger.py +252 -0
- package/python/tests/test_finance_persist.py +178 -0
- package/python/tests/test_gateway.py +144 -0
- package/python/tests/test_governance.py +468 -0
- package/python/tests/test_governance_audit.py +359 -0
- package/python/tests/test_governance_middleware.py +143 -0
- package/python/tests/test_hkc.py +286 -0
- package/python/tests/test_hkc_index_build_manager.py +339 -0
- package/python/tests/test_hkc_manifest_reuse.py +317 -0
- package/python/tests/test_hkc_search_event_sync.py +533 -0
- package/python/tests/test_import_path_guard.py +161 -0
- package/python/tests/test_injection_guard.py +211 -0
- package/python/tests/test_integration.py +141 -0
- package/python/tests/test_itinerary.py +103 -0
- package/python/tests/test_kee_semantic.py +89 -0
- package/python/tests/test_kernel.py +222 -0
- package/python/tests/test_learning.py +110 -0
- package/python/tests/test_llm_admin.py +160 -0
- package/python/tests/test_llm_planner.py +366 -0
- package/python/tests/test_markdown_skills.py +73 -0
- package/python/tests/test_markdown_skills_openclaw.py +71 -0
- package/python/tests/test_mcp_connectors.py +109 -0
- package/python/tests/test_mcp_guardian_discovery.py +91 -0
- package/python/tests/test_mcp_no_memory.py +43 -0
- package/python/tests/test_mcp_policy_gate.py +77 -0
- package/python/tests/test_mcp_server.py +95 -0
- package/python/tests/test_memory_recall.py +95 -0
- package/python/tests/test_metrics.py +66 -0
- package/python/tests/test_multi_chain.py +102 -0
- package/python/tests/test_multimodal.py +135 -0
- package/python/tests/test_negotiation.py +146 -0
- package/python/tests/test_orchestration.py +119 -0
- package/python/tests/test_orchestration_decoupled.py +109 -0
- package/python/tests/test_p3_p5_hardening.py +338 -0
- package/python/tests/test_parallel_dispatch.py +215 -0
- package/python/tests/test_pipeline.py +533 -0
- package/python/tests/test_plan_visible.py +86 -0
- package/python/tests/test_planner.py +95 -0
- package/python/tests/test_policy_gate.py +109 -0
- package/python/tests/test_reasoner.py +185 -0
- package/python/tests/test_release_check.py +263 -0
- package/python/tests/test_resume_checkpoint.py +156 -0
- package/python/tests/test_routing.py +95 -0
- package/python/tests/test_scheduler.py +141 -0
- package/python/tests/test_search.py +204 -0
- package/python/tests/test_secrets.py +159 -0
- package/python/tests/test_semantic.py +78 -0
- package/python/tests/test_sessions.py +91 -0
- package/python/tests/test_settings.py +281 -0
- package/python/tests/test_shadow_learning.py +330 -0
- package/python/tests/test_shared_write.py +207 -0
- package/python/tests/test_skill_taint_gate.py +154 -0
- package/python/tests/test_skills.py +133 -0
- package/python/tests/test_stats_and_events.py +165 -0
- package/python/tests/test_streaming.py +60 -0
- package/python/tests/test_supervisor_pipeline.py +177 -0
- package/python/tests/test_supervisor_triage.py +108 -0
- package/python/tests/test_taint.py +117 -0
- package/python/tests/test_task_stream.py +85 -0
- package/python/tests/test_thinking_sse.py +67 -0
- package/python/tests/test_thinking_stream.py +76 -0
- package/python/tests/test_tool_center.py +129 -0
- package/python/tests/test_tool_parallel.py +113 -0
- package/python/tests/test_tool_params.py +103 -0
- package/python/tests/test_tool_use.py +242 -0
- package/python/tests/test_toplevel_concurrency.py +117 -0
- package/python/tests/test_tracing.py +290 -0
- package/python/tests/test_truth_crystallizer.py +127 -0
- package/python/tests/test_truth_flow.py +93 -0
- package/python/tests/test_url_policy.py +53 -0
- package/python/tests/test_verify_evidence.py +225 -0
- package/python/tests/test_version_sync.py +71 -0
- package/python/tests/test_web_trigger.py +99 -0
- package/python/tools/check_faiss_type.py +31 -0
- package/python/tools/check_log.ps1 +46 -0
- package/python/tools/ivf_status.py +72 -0
- package/python/tools/mypy_baseline.txt +5 -0
- package/python/tools/mypy_ratchet.py +97 -0
- package/python/tools/pack.py +178 -0
- package/python/tools/release_check.py +349 -0
- package/python/tools/restart_foxclaw.ps1 +74 -0
- package/python/tools/shared_write_audit.py +204 -0
- package/python/tools/size_baseline.txt +28 -0
- package/python/tools/size_check.py +102 -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,394 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, nextTick, onMounted, ref } from 'vue'
|
|
3
|
+
import MenuPopover from './MenuPopover.vue'
|
|
4
|
+
import {
|
|
5
|
+
state, loadSessions, openSession, moduleLabel, setModule, railItems, RAIL,
|
|
6
|
+
} from '../stores/app.js'
|
|
7
|
+
import { deleteSession, loadSession, newSession, renameSession } from '../stores/chat.js'
|
|
8
|
+
|
|
9
|
+
const btnRef = ref(null)
|
|
10
|
+
const menuOpen = ref(false)
|
|
11
|
+
const anchor = ref(null)
|
|
12
|
+
|
|
13
|
+
const count = computed(() => state.sessions.length)
|
|
14
|
+
const rail = railItems()
|
|
15
|
+
|
|
16
|
+
/* 当前模块不属于常驻项 → 落在「更多」里。概览是默认落地页,不给它加后缀,否则
|
|
17
|
+
一进站就显示「更多 · 概览」,像是从一个隐藏入口进来的。 */
|
|
18
|
+
const isMore = computed(() => !RAIL.includes(state.module))
|
|
19
|
+
const moreCur = computed(() => (isMore.value && state.module !== 'overview' ? moduleLabel(state.module) : ''))
|
|
20
|
+
|
|
21
|
+
/* 线性图标:统一 24 视框 + 描边,和右栏 / 顶栏的图形语言一致。
|
|
22
|
+
只放 path 的 d,颜色与线宽交给 CSS,换肤时不用动 JS。 */
|
|
23
|
+
const ICONS = {
|
|
24
|
+
book: [
|
|
25
|
+
'M5 5.6A2.1 2.1 0 0 1 7.1 3.5H19v17H7.1A2.1 2.1 0 0 1 5 18.4z',
|
|
26
|
+
'M5 18.4a2.1 2.1 0 0 1 2.1-2.1H19',
|
|
27
|
+
'M9 8h6',
|
|
28
|
+
'M9 11.2h4',
|
|
29
|
+
],
|
|
30
|
+
clock: ['M12 3.2a8.8 8.8 0 1 0 0 17.6 8.8 8.8 0 0 0 0-17.6z', 'M12 7.4V12l3.3 1.9'],
|
|
31
|
+
plug: ['M9 3v4.2', 'M15 3v4.2', 'M6.8 7.2h10.4v4.6a5.2 5.2 0 0 1-10.4 0z', 'M12 17v4'],
|
|
32
|
+
bot: [
|
|
33
|
+
'M4.8 8.2h14.4A1.8 1.8 0 0 1 21 10v6.6a1.8 1.8 0 0 1-1.8 1.8H4.8A1.8 1.8 0 0 1 3 16.6V10a1.8 1.8 0 0 1 1.8-1.8z',
|
|
34
|
+
'M12 4.4v3.8',
|
|
35
|
+
'M8.6 12.8h.01',
|
|
36
|
+
'M15.4 12.8h.01',
|
|
37
|
+
],
|
|
38
|
+
more: ['M6 12h.01', 'M12 12h.01', 'M18 12h.01'],
|
|
39
|
+
review: [
|
|
40
|
+
'M20.4 12a8.4 8.4 0 0 1-14.3 5.9',
|
|
41
|
+
'M3.6 12a8.4 8.4 0 0 1 14.3-5.9',
|
|
42
|
+
'M17.9 2.6v3.6h-3.6',
|
|
43
|
+
'M6.1 21.4v-3.6h3.6',
|
|
44
|
+
],
|
|
45
|
+
memory: ['M7.2 3.4h9.6v17.2L12 17.2l-4.8 3.4z'],
|
|
46
|
+
dot: ['M12 10.6a1.4 1.4 0 1 0 0 2.8 1.4 1.4 0 0 0 0-2.8z'],
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const icon = (name) => ICONS[name] || ICONS.dot
|
|
50
|
+
const quickOf = (m) => (m.quick || []).map((id) => {
|
|
51
|
+
const q = { id, label: moduleLabel(id), icon: id }
|
|
52
|
+
return q
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
onMounted(loadSessions)
|
|
56
|
+
|
|
57
|
+
function toggleMenu() {
|
|
58
|
+
if (menuOpen.value) {
|
|
59
|
+
menuOpen.value = false
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
const r = btnRef.value?.getBoundingClientRect()
|
|
63
|
+
/* 入口现在在栏顶,浮层必须往下长(原来的实现是贴着栏底往上长) */
|
|
64
|
+
if (r) anchor.value = { left: r.left, bottom: r.bottom }
|
|
65
|
+
menuOpen.value = true
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function pick(id) {
|
|
69
|
+
setModule(id)
|
|
70
|
+
menuOpen.value = false
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* 切会话 = 切左侧高亮 + 拉后端历史消息 */
|
|
74
|
+
function pickSession(s) {
|
|
75
|
+
openSession(s)
|
|
76
|
+
loadSession(s.id)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* ── 会话重命名 / 删除 ── */
|
|
80
|
+
const editingId = ref('')
|
|
81
|
+
const draft = ref('')
|
|
82
|
+
let editEl = null
|
|
83
|
+
|
|
84
|
+
function beginRename(s) {
|
|
85
|
+
editingId.value = s.id
|
|
86
|
+
draft.value = s.title || ''
|
|
87
|
+
nextTick(() => {
|
|
88
|
+
editEl?.focus()
|
|
89
|
+
editEl?.select()
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function cancelRename() {
|
|
94
|
+
editingId.value = ''
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* enter / blur 都会走到这里:先清 editingId 再做守卫,重复提交自然变成空操作 */
|
|
98
|
+
async function commitRename(s) {
|
|
99
|
+
if (editingId.value !== s.id) return
|
|
100
|
+
editingId.value = ''
|
|
101
|
+
const t = draft.value.trim()
|
|
102
|
+
if (!t || t === (s.title || '')) return
|
|
103
|
+
await renameSession(s.id, t)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function removeSession(s) {
|
|
107
|
+
const name = s.title || '新会话'
|
|
108
|
+
/* 删除会连对话历史一起删掉,不能手滑 —— 用系统确认框,不引新组件 */
|
|
109
|
+
if (!confirm(`删除会话「${name}」?\n对话历史会一起删掉,不可恢复。`)) return
|
|
110
|
+
await deleteSession(s.id)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async function startNew() {
|
|
114
|
+
await newSession()
|
|
115
|
+
setModule('overview')
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function fmt(ts) {
|
|
119
|
+
if (!ts) return ''
|
|
120
|
+
return new Date(ts * 1000).toLocaleString('zh-CN', {
|
|
121
|
+
month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit', hour12: false,
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function meta(s) {
|
|
126
|
+
return [fmt(s.updated_at), s.message_count ? `${s.message_count} 条` : ''].filter(Boolean).join(' · ')
|
|
127
|
+
}
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<template>
|
|
131
|
+
<aside class="col col--left rail-left">
|
|
132
|
+
<button class="new-sess" title="开一个新会话" @click="startNew">+ 新会话</button>
|
|
133
|
+
|
|
134
|
+
<nav class="rail-nav">
|
|
135
|
+
<div
|
|
136
|
+
v-for="m in rail"
|
|
137
|
+
:key="m.id"
|
|
138
|
+
class="rail-row"
|
|
139
|
+
:class="{ on: state.module === m.id, sub: (m.quick || []).includes(state.module) }"
|
|
140
|
+
>
|
|
141
|
+
<button class="rail-item" @click="pick(m.id)">
|
|
142
|
+
<span class="ic">
|
|
143
|
+
<svg viewBox="0 0 24 24"><path v-for="(d, i) in icon(m.icon)" :key="i" :d="d" /></svg>
|
|
144
|
+
</span>
|
|
145
|
+
<b>{{ m.label }}</b>
|
|
146
|
+
<span v-if="m.beta" class="beta">BETA</span>
|
|
147
|
+
</button>
|
|
148
|
+
|
|
149
|
+
<span v-if="m.quick" class="rail-acts">
|
|
150
|
+
<button
|
|
151
|
+
v-for="q in quickOf(m)"
|
|
152
|
+
:key="q.id"
|
|
153
|
+
class="act"
|
|
154
|
+
:title="`打开${q.label}`"
|
|
155
|
+
:aria-label="q.label"
|
|
156
|
+
@click.stop="pick(q.id)"
|
|
157
|
+
>
|
|
158
|
+
<svg viewBox="0 0 24 24"><path v-for="(d, i) in icon(q.icon)" :key="i" :d="d" /></svg>
|
|
159
|
+
</button>
|
|
160
|
+
</span>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div class="rail-row" :class="{ on: isMore }">
|
|
164
|
+
<button
|
|
165
|
+
ref="btnRef"
|
|
166
|
+
class="rail-item rail-anchor"
|
|
167
|
+
:aria-expanded="menuOpen"
|
|
168
|
+
title="其它功能"
|
|
169
|
+
@click="toggleMenu"
|
|
170
|
+
>
|
|
171
|
+
<span class="ic">
|
|
172
|
+
<svg viewBox="0 0 24 24"><path v-for="(d, i) in icon('more')" :key="i" :d="d" /></svg>
|
|
173
|
+
</span>
|
|
174
|
+
<b>更多</b>
|
|
175
|
+
<span v-if="moreCur" class="cur">{{ moreCur }}</span>
|
|
176
|
+
<span class="caret" :class="{ open: menuOpen }">▾</span>
|
|
177
|
+
</button>
|
|
178
|
+
</div>
|
|
179
|
+
</nav>
|
|
180
|
+
|
|
181
|
+
<div class="sec-head">
|
|
182
|
+
会话历史 <em>{{ count }}</em>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<div class="ns-list scroll">
|
|
186
|
+
<div v-if="state.sessionsState === 'loading'" class="empty">加载中…</div>
|
|
187
|
+
<div v-else-if="state.sessionsState === 'error'" class="empty">后端未连接</div>
|
|
188
|
+
<div v-else-if="!count" class="empty">还没有会话 · 发一条消息即开始</div>
|
|
189
|
+
<template v-else>
|
|
190
|
+
<div
|
|
191
|
+
v-for="s in state.sessions"
|
|
192
|
+
:key="s.id"
|
|
193
|
+
class="ns-row"
|
|
194
|
+
:class="{ on: s.id === state.sessionId }"
|
|
195
|
+
>
|
|
196
|
+
<input
|
|
197
|
+
v-if="editingId === s.id"
|
|
198
|
+
:ref="(el) => (editEl = el)"
|
|
199
|
+
v-model="draft"
|
|
200
|
+
class="ns-edit"
|
|
201
|
+
maxlength="60"
|
|
202
|
+
aria-label="会话标题"
|
|
203
|
+
@keydown.enter.prevent="commitRename(s)"
|
|
204
|
+
@keydown.esc.prevent="cancelRename"
|
|
205
|
+
@blur="commitRename(s)"
|
|
206
|
+
/>
|
|
207
|
+
<template v-else>
|
|
208
|
+
<button class="ns-item" :title="s.title || '新会话'" @click="pickSession(s)">
|
|
209
|
+
<b>{{ s.title || '新会话' }}</b>
|
|
210
|
+
<span>{{ meta(s) }}</span>
|
|
211
|
+
</button>
|
|
212
|
+
<span class="ns-acts">
|
|
213
|
+
<button class="act" title="重命名会话" @click.stop="beginRename(s)">
|
|
214
|
+
<svg viewBox="0 0 24 24">
|
|
215
|
+
<path d="M4.4 19.6h4l10.8-10.8-4-4L4.4 15.6z" />
|
|
216
|
+
<path d="M14.4 5.6l3.8 3.8" />
|
|
217
|
+
</svg>
|
|
218
|
+
</button>
|
|
219
|
+
<button class="act del" title="删除会话" @click.stop="removeSession(s)">
|
|
220
|
+
<svg viewBox="0 0 24 24">
|
|
221
|
+
<path d="M5 7h14" />
|
|
222
|
+
<path d="M9.6 7V4.6h4.8V7" />
|
|
223
|
+
<path d="M6.8 7l.8 12.4h8.8L17.2 7" />
|
|
224
|
+
</svg>
|
|
225
|
+
</button>
|
|
226
|
+
</span>
|
|
227
|
+
</template>
|
|
228
|
+
</div>
|
|
229
|
+
</template>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<MenuPopover
|
|
233
|
+
v-if="menuOpen"
|
|
234
|
+
:anchor="anchor"
|
|
235
|
+
:active="state.module"
|
|
236
|
+
@pick="pick"
|
|
237
|
+
@close="menuOpen = false"
|
|
238
|
+
/>
|
|
239
|
+
</aside>
|
|
240
|
+
</template>
|
|
241
|
+
|
|
242
|
+
<style scoped>
|
|
243
|
+
.rail-left { padding: 12px; gap: 10px; }
|
|
244
|
+
|
|
245
|
+
.new-sess {
|
|
246
|
+
display: flex; align-items: center; justify-content: center; gap: 6px;
|
|
247
|
+
padding: 9px 12px; flex-shrink: 0;
|
|
248
|
+
font-size: 13px; font-weight: 600; color: var(--green);
|
|
249
|
+
background: rgba(26, 157, 95, 0.1);
|
|
250
|
+
border-radius: var(--r-sm);
|
|
251
|
+
transition: background 0.16s, transform 0.1s;
|
|
252
|
+
}
|
|
253
|
+
.new-sess:hover { background: rgba(26, 157, 95, 0.17); }
|
|
254
|
+
.new-sess:active { transform: scale(0.985); }
|
|
255
|
+
|
|
256
|
+
/* ── 常驻功能入口 ── */
|
|
257
|
+
.rail-nav { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
|
|
258
|
+
|
|
259
|
+
.rail-row { position: relative; display: flex; align-items: center; }
|
|
260
|
+
|
|
261
|
+
.rail-item {
|
|
262
|
+
flex: 1; min-width: 0;
|
|
263
|
+
display: flex; align-items: center; gap: 9px;
|
|
264
|
+
padding: 7px 9px; border-radius: var(--r-sm);
|
|
265
|
+
border: 1px solid transparent;
|
|
266
|
+
transition: background 0.14s, border-color 0.14s;
|
|
267
|
+
}
|
|
268
|
+
.rail-item .ic { width: 15px; height: 15px; display: grid; place-items: center; color: var(--dim); flex-shrink: 0; }
|
|
269
|
+
.rail-item .ic svg {
|
|
270
|
+
width: 15px; height: 15px;
|
|
271
|
+
fill: none; stroke: currentColor; stroke-width: 1.7;
|
|
272
|
+
stroke-linecap: round; stroke-linejoin: round;
|
|
273
|
+
}
|
|
274
|
+
.rail-item b {
|
|
275
|
+
flex: 1; min-width: 0; text-align: left;
|
|
276
|
+
font-size: 13px; font-weight: 600; color: var(--ink);
|
|
277
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
278
|
+
}
|
|
279
|
+
.rail-row:hover .rail-item { background: rgba(255, 255, 255, 0.6); }
|
|
280
|
+
.rail-row.on .rail-item {
|
|
281
|
+
background: rgba(255, 255, 255, 0.92);
|
|
282
|
+
border-color: var(--line);
|
|
283
|
+
box-shadow: 0 1px 2px rgba(23, 32, 26, 0.05);
|
|
284
|
+
}
|
|
285
|
+
.rail-row.on .rail-item .ic { color: var(--green); }
|
|
286
|
+
.rail-row.on .rail-item b { font-weight: 600; }
|
|
287
|
+
|
|
288
|
+
/* 停在子视图(复习 / 记忆中心)时,父项给一层更淡的高亮:既说明「你在这条线上」,
|
|
289
|
+
又不和真正选中的白卡混淆。 */
|
|
290
|
+
.rail-row.sub .rail-item { background: rgba(255, 255, 255, 0.5); }
|
|
291
|
+
.rail-row.sub .rail-item .ic { color: var(--green); }
|
|
292
|
+
|
|
293
|
+
/* 成熟度标签:比正式入口新,或者语义还在变 */
|
|
294
|
+
.beta {
|
|
295
|
+
flex-shrink: 0;
|
|
296
|
+
font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
|
|
297
|
+
color: var(--amber);
|
|
298
|
+
padding: 2px 5px; border-radius: 4px;
|
|
299
|
+
background: rgba(199, 116, 0, 0.12);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* 同源数据的另一视图:只在 hover / 聚焦时出现,不占常驻视觉 */
|
|
303
|
+
.rail-acts {
|
|
304
|
+
position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
|
|
305
|
+
display: flex; gap: 2px;
|
|
306
|
+
padding-left: 14px;
|
|
307
|
+
background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.94) 34%);
|
|
308
|
+
opacity: 0;
|
|
309
|
+
transition: opacity 0.13s;
|
|
310
|
+
pointer-events: none;
|
|
311
|
+
}
|
|
312
|
+
.rail-row:hover .rail-acts,
|
|
313
|
+
.rail-acts:focus-within { opacity: 1; pointer-events: auto; }
|
|
314
|
+
.act {
|
|
315
|
+
width: 21px; height: 21px; display: grid; place-items: center;
|
|
316
|
+
border-radius: 6px; color: var(--dim);
|
|
317
|
+
transition: background 0.13s, color 0.13s;
|
|
318
|
+
}
|
|
319
|
+
.act svg {
|
|
320
|
+
width: 13px; height: 13px;
|
|
321
|
+
fill: none; stroke: currentColor; stroke-width: 1.8;
|
|
322
|
+
stroke-linecap: round; stroke-linejoin: round;
|
|
323
|
+
}
|
|
324
|
+
.act:hover { background: rgba(26, 157, 95, 0.12); color: var(--green); }
|
|
325
|
+
|
|
326
|
+
.cur { font-size: 11.5px; color: var(--dim); flex-shrink: 0; }
|
|
327
|
+
.caret { font-size: 10.5px; color: var(--dim); transition: transform 0.18s; flex-shrink: 0; }
|
|
328
|
+
.caret.open { transform: rotate(180deg); }
|
|
329
|
+
|
|
330
|
+
.sec-head {
|
|
331
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
332
|
+
padding: 2px 4px 0;
|
|
333
|
+
font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
|
|
334
|
+
color: var(--dim); text-transform: uppercase;
|
|
335
|
+
flex-shrink: 0;
|
|
336
|
+
}
|
|
337
|
+
.sec-head em {
|
|
338
|
+
font-size: 11px; font-weight: 700; color: var(--ink);
|
|
339
|
+
padding: 2px 7px; border-radius: var(--r-pill);
|
|
340
|
+
background: rgba(255, 255, 255, 0.86); border: 1px solid var(--line);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.ns-list { display: flex; flex-direction: column; gap: 3px; flex: 1; margin: 0 -4px; padding: 0 4px; }
|
|
344
|
+
|
|
345
|
+
/* 行容器负责底色/边框,hover 时右侧才浮出改名与删除 —— 常驻两个图标会把
|
|
346
|
+
12 个字的标题挤成 6 个字。 */
|
|
347
|
+
.ns-row {
|
|
348
|
+
position: relative; display: flex; align-items: center;
|
|
349
|
+
border-radius: var(--r-sm);
|
|
350
|
+
border: 1px solid transparent;
|
|
351
|
+
transition: background 0.14s, border-color 0.14s;
|
|
352
|
+
}
|
|
353
|
+
.ns-row:hover { background: rgba(255, 255, 255, 0.66); }
|
|
354
|
+
.ns-row.on {
|
|
355
|
+
background: rgba(255, 255, 255, 0.92);
|
|
356
|
+
border-color: var(--line);
|
|
357
|
+
box-shadow: 0 1px 2px rgba(23, 32, 26, 0.05);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.ns-item {
|
|
361
|
+
flex: 1; min-width: 0;
|
|
362
|
+
text-align: left;
|
|
363
|
+
display: flex; flex-direction: column; gap: 2px;
|
|
364
|
+
padding: 8px 10px;
|
|
365
|
+
}
|
|
366
|
+
.ns-item b {
|
|
367
|
+
font-size: 13px; font-weight: 600; color: var(--ink);
|
|
368
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
369
|
+
}
|
|
370
|
+
.ns-item span { font-size: 11.5px; color: var(--dim); }
|
|
371
|
+
|
|
372
|
+
.ns-acts {
|
|
373
|
+
position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
|
|
374
|
+
display: flex; gap: 2px;
|
|
375
|
+
padding-left: 16px;
|
|
376
|
+
background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.96) 36%);
|
|
377
|
+
opacity: 0;
|
|
378
|
+
pointer-events: none;
|
|
379
|
+
transition: opacity 0.13s;
|
|
380
|
+
}
|
|
381
|
+
.ns-row:hover .ns-acts,
|
|
382
|
+
.ns-acts:focus-within { opacity: 1; pointer-events: auto; }
|
|
383
|
+
|
|
384
|
+
.act.del:hover { background: rgba(180, 68, 58, 0.12); color: #b4443a; }
|
|
385
|
+
|
|
386
|
+
.ns-edit {
|
|
387
|
+
width: 100%; padding: 7px 9px;
|
|
388
|
+
font-size: 12.5px; color: var(--ink);
|
|
389
|
+
background: #fff;
|
|
390
|
+
border: 1px solid var(--green);
|
|
391
|
+
border-radius: var(--r-sm);
|
|
392
|
+
outline: none;
|
|
393
|
+
}
|
|
394
|
+
</style>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onBeforeUnmount, onMounted } from 'vue'
|
|
3
|
+
import { moreItems } from '../stores/app.js'
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
anchor: { type: Object, default: null },
|
|
7
|
+
active: { type: String, default: 'overview' },
|
|
8
|
+
})
|
|
9
|
+
const emit = defineEmits(['pick', 'close'])
|
|
10
|
+
|
|
11
|
+
/* 只剩常驻入口之外的功能(概览 / 活动 / 使用情况 / 复习 / 记忆中心)。
|
|
12
|
+
常驻项不在这里重复出现 —— 「更多」的语义是「别处放不下的」,不是「全部重列一遍」。 */
|
|
13
|
+
const groups = computed(() => {
|
|
14
|
+
const out = []
|
|
15
|
+
let cur = null
|
|
16
|
+
for (const m of moreItems()) {
|
|
17
|
+
if (!m.group) {
|
|
18
|
+
out.push({ title: '', items: [m] })
|
|
19
|
+
continue
|
|
20
|
+
}
|
|
21
|
+
if (!cur || cur.title !== m.group) {
|
|
22
|
+
cur = { title: m.group, items: [] }
|
|
23
|
+
out.push(cur)
|
|
24
|
+
}
|
|
25
|
+
cur.items.push(m)
|
|
26
|
+
}
|
|
27
|
+
return out
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
/* 入口在栏顶 → 浮层向下展开。left 直接对齐按钮左沿;宽度固定,左栏只有 296px,不会溢出视口右侧。 */
|
|
31
|
+
const style = computed(() => {
|
|
32
|
+
const a = props.anchor
|
|
33
|
+
if (!a) return { left: '16px', top: '120px' }
|
|
34
|
+
const top = (a.bottom ?? 0) + 6
|
|
35
|
+
return { left: `${a.left}px`, top: `${top}px` }
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
function onDocDown(e) {
|
|
39
|
+
if (e.target.closest('.nav-pop') || e.target.closest('.rail-anchor')) return
|
|
40
|
+
emit('close')
|
|
41
|
+
}
|
|
42
|
+
function onKey(e) {
|
|
43
|
+
if (e.key === 'Escape') emit('close')
|
|
44
|
+
}
|
|
45
|
+
function onResize() {
|
|
46
|
+
emit('close')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
onMounted(() => {
|
|
50
|
+
document.addEventListener('mousedown', onDocDown, true)
|
|
51
|
+
document.addEventListener('keydown', onKey)
|
|
52
|
+
window.addEventListener('resize', onResize)
|
|
53
|
+
})
|
|
54
|
+
onBeforeUnmount(() => {
|
|
55
|
+
document.removeEventListener('mousedown', onDocDown, true)
|
|
56
|
+
document.removeEventListener('keydown', onKey)
|
|
57
|
+
window.removeEventListener('resize', onResize)
|
|
58
|
+
})
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<Teleport to="body">
|
|
63
|
+
<div class="nav-pop" :style="style">
|
|
64
|
+
<div class="pop-head">更多功能 <span class="x" title="关闭 (Esc)" @click="$emit('close')">✕</span></div>
|
|
65
|
+
<div class="pop-body">
|
|
66
|
+
<template v-for="(g, gi) in groups" :key="gi">
|
|
67
|
+
<div v-if="g.title" class="pop-sec">{{ g.title }}</div>
|
|
68
|
+
<button
|
|
69
|
+
v-for="m in g.items"
|
|
70
|
+
:key="m.id"
|
|
71
|
+
class="pop-item"
|
|
72
|
+
:class="{ on: m.id === active }"
|
|
73
|
+
@click="$emit('pick', m.id)"
|
|
74
|
+
>
|
|
75
|
+
<span class="lbl">{{ m.label }}</span>
|
|
76
|
+
<span class="tag">{{ m.tag }}</span>
|
|
77
|
+
</button>
|
|
78
|
+
</template>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</Teleport>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<style scoped>
|
|
85
|
+
.nav-pop {
|
|
86
|
+
position: fixed;
|
|
87
|
+
z-index: var(--z-menu);
|
|
88
|
+
width: 214px;
|
|
89
|
+
max-height: min(64vh, 420px);
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
border-radius: var(--r-mid);
|
|
93
|
+
background: rgba(255, 255, 255, 0.88);
|
|
94
|
+
-webkit-backdrop-filter: blur(24px) saturate(180%);
|
|
95
|
+
backdrop-filter: blur(24px) saturate(180%);
|
|
96
|
+
border: 1px solid rgba(255, 255, 255, 0.9);
|
|
97
|
+
box-shadow: var(--sh-pop);
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
animation: pop-in 0.16s ease;
|
|
100
|
+
}
|
|
101
|
+
@keyframes pop-in {
|
|
102
|
+
from { opacity: 0; transform: translateY(-6px) scale(0.985); }
|
|
103
|
+
}
|
|
104
|
+
.pop-head {
|
|
105
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
106
|
+
padding: 9px 11px; flex-shrink: 0;
|
|
107
|
+
font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
|
|
108
|
+
color: var(--faint); text-transform: uppercase;
|
|
109
|
+
border-bottom: 1px solid var(--line-soft);
|
|
110
|
+
}
|
|
111
|
+
.pop-head .x { cursor: pointer; font-size: 11px; color: var(--faint); padding: 2px 4px; }
|
|
112
|
+
.pop-head .x:hover { color: var(--ink); }
|
|
113
|
+
.pop-body { padding: 6px; overflow-y: auto; }
|
|
114
|
+
.pop-sec {
|
|
115
|
+
padding: 9px 6px 5px;
|
|
116
|
+
font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
|
|
117
|
+
color: var(--dim); text-transform: uppercase;
|
|
118
|
+
}
|
|
119
|
+
.pop-item {
|
|
120
|
+
width: 100%;
|
|
121
|
+
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
122
|
+
padding: 8px 9px; border-radius: var(--r-sm);
|
|
123
|
+
transition: background 0.14s;
|
|
124
|
+
}
|
|
125
|
+
.pop-item .lbl { font-size: 13px; font-weight: 600; color: var(--ink); }
|
|
126
|
+
.pop-item .tag { font-size: 11px; font-weight: 600; color: var(--dim); }
|
|
127
|
+
.pop-item:hover { background: var(--surface-2); }
|
|
128
|
+
.pop-item.on { background: var(--accent-soft); }
|
|
129
|
+
.pop-item.on .lbl { color: var(--accent); font-weight: 600; }
|
|
130
|
+
</style>
|