lantern-harness 0.1.22 → 0.1.23

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/500.html +4 -4
  3. package/dist/_astro/{Base.I--fR8aT.css → Base.GThhapKd.css} +1 -1
  4. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.CWRCetQl.js +2 -0
  5. package/dist/_astro/{CasesLibrary.DfuTkbJN.js → CasesLibrary.CDjuLV_E.js} +2 -2
  6. package/dist/_astro/ChatApp.Td2xCiQG.js +216 -0
  7. package/dist/_astro/{DashboardBoard.D8-oufgg.js → DashboardBoard.D-zHXRds.js} +1 -1
  8. package/dist/_astro/DocsFileBrowser.BM3nH4VD.js +1 -0
  9. package/dist/_astro/{KnowledgeLibrary.DGhU2p3S.js → KnowledgeLibrary.D9KnqXzr.js} +1 -1
  10. package/dist/_astro/{PluginsPage.DjeMQX3i.js → PluginsPage.DBRfSxtq.js} +2 -2
  11. package/dist/_astro/PluginsPage.DMDyUktn.js +1 -0
  12. package/dist/_astro/PromptMountDialog.CpTT6L0a.js +62 -0
  13. package/dist/_astro/{PromptsLibrary.CbGja6mq.js → PromptsLibrary.sz6MivVn.js} +1 -1
  14. package/dist/_astro/{ReqAnalysisBoard.By08xNFf.js → ReqAnalysisBoard.CazI9SU-.js} +1 -1
  15. package/dist/_astro/RequirementsLibrary.R4dNZa9y.js +1 -0
  16. package/dist/_astro/{SettingsDialog.DgpH_BVN.js → SettingsDialog.Bs1I8b27.js} +1 -1
  17. package/dist/_astro/{UiAutoBoard.nrtcQJDl.js → UiAutoBoard.B-7mL3ez.js} +1 -1
  18. package/dist/_astro/app-version.yT2l6J8H.js +1 -0
  19. package/dist/_astro/docs-format.BlGh-XA_.js +1 -0
  20. package/dist/_astro/{story-review.E_go1fvj.js → story-review.BbdIf5zg.js} +1 -1
  21. package/dist/case-exec/index.html +4 -4
  22. package/dist/cases/generate/index.html +4 -4
  23. package/dist/cases/library/index.html +5 -5
  24. package/dist/dashboard/index.html +5 -5
  25. package/dist/docs/changelog/index.html +23 -5
  26. package/dist/docs/install/index.html +4 -4
  27. package/dist/docs/manual/index.html +8 -7
  28. package/dist/knowledge/index.html +5 -5
  29. package/dist/plugins/index.html +5 -5
  30. package/dist/pm/bugs/index.html +4 -4
  31. package/dist/pm/iterations/index.html +4 -4
  32. package/dist/pm/projects/detail/index.html +4 -4
  33. package/dist/pm/projects/index.html +4 -4
  34. package/dist/pm/requirements/index.html +4 -4
  35. package/dist/prompts/index.html +5 -5
  36. package/dist/reports/index.html +4 -4
  37. package/dist/requirement-analysis/index.html +5 -5
  38. package/dist/requirements/index.html +5 -5
  39. package/dist/tasks/index.html +4 -4
  40. package/dist/templates/index.html +4 -4
  41. package/dist/test-automation/index.html +5 -5
  42. package/dist/test-stats/index.html +4 -4
  43. package/dist/todos/index.html +4 -4
  44. package/dist/workbench/index.html +5 -5
  45. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +4 -3
  46. package/lh-plugins/lh-reports.mjs +6 -5
  47. package/package.json +1 -1
  48. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.BQtZbum2.js +0 -1
  49. package/dist/_astro/ChatApp.CAgrwilW.js +0 -214
  50. package/dist/_astro/DocsFileBrowser.CTICuWFf.js +0 -1
  51. package/dist/_astro/PluginsPage.C9vaY-lo.js +0 -1
  52. package/dist/_astro/PromptMountDialog.YH2odDZx.js +0 -58
  53. package/dist/_astro/RequirementsLibrary.BSDgdppH.js +0 -1
  54. package/dist/_astro/app-version.5UudQEyk.js +0 -1
@@ -1 +1 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{a as n,i as r,n as i,r as ee,s as a}from"./app-config.CF1xVPmo.js";import{i as te,n as o,r as ne,t as s}from"./listbox.DNxAJmEo.js";import{a as re,o as ie}from"./dialog.DZHZCe_T.js";import{t as c}from"./jsx-runtime.DUg_B_vD.js";import{t as ae}from"./ConfirmDialog.CsMwWevK.js";import{showToast as oe}from"./Toast.BO2NFckG.js";import{i as se}from"./llm.BuR7z55C.js";import{_ as ce,a as l,c as u,d as le,g as ue,h as de,i as fe,l as d,n as f,o as pe,r as me,s as he,t as ge,u as _e,v as ve}from"./settings.B1yetppp.js";import{n as p}from"./i18n.CjqQGCAI.js";import{s as m}from"./fs-tools.3F9MFrLf.js";import{_ as h,c as g,l as ye}from"./bash-tools.CPS0ZiKi.js";import{t as be}from"./app-version.5UudQEyk.js";import{n as xe,t as Se}from"./update.Fq2CGmCX.js";var _=e(t(),1);function v(e){return e===`time-context`||e===`tool-todo`||e===`tool-ask-user`||e===`user-questions`||e===`plan-mode`||e===`tool-result-pruner`||e===`compaction-basic`||e===`command-compact`||e===`tool-goal`||e===`command-goal`||e===`goal`||e===`tool-schedule`||e===`schedule`||e===`goal-round-driver`||e===`session-log-download`||e===`llm-retry`||e===`session-title-llm`||e===`session-stats`||e===`locale`||e===`config-editor`||e===`subagent`||e===`subagent-fork-in-process`||e===`spill-local`||e===`spill-policy`||e===`session-turn-outline`||e===`image-offload`||e===`session-persistence-jsonl`||e===`session-checkpoint-policy`||e===`session-query-sqlite`||e===`session-projection-cache`||e===`storage-domain`||e===`workspace-changes`||e===`workspace-dependencies`||e===`skill-office`||e===`fs-observation-policy`||e===`deepseek-llm-api-extensions`||e===`session-log-deepseek`||e===`subagent-model-selection-settings`||e===`authorization`||e===`modules`||e===`resources`||e===`mcp-resources`||e===`ptc-runtime`||e===`headless-runner`||e===`headless-startup`||e===`sdk-jsonrpc-server`||e===`sdk-app-startup`||e===`acp`||e===`acp-app-startup`||e===`subagent-spawn-in-process`||e===`llm-pi-ai`||e===`session-reference`||e===`tool-subagent`||e===`tool-subagent-control`||e===`tool-subagent-list-agents`||e===`tool-subagent-fork`||e===`tool-workflow`||e===`workflow-ptc`||e===`session-title`||e===`attachment-local`||e===`file-upload`||e===`file-reference-local`||e===`credentials`||e===`connection`||e===`token-meter`||e===`llm`||e===`llm-deepseek`||e===`agent-default-model`||e===`session`||e===`sessions`||e===`session-projection`||e===`storage`||e===`storage-json`||e===`settings`||e===`commands`||e===`shortcuts`||e===`timeout-policy`||e===`shell-env`||e===`approval`||e===`agent`||e===`system-prompt`||e===`tools`||e===`repeat-tool-reminder`?`ready`:e===`tool-web`||e===`web`||e===`web-fetch-http`||e===`web-search-deepseek`?`web`:e===`tool-bash`||e===`tool-jobs`||e===`jobs`||e===`sandbox-policy`||e===`bash-sandbox`||e===`sandbox`||e===`pty`||e===`terminal-bash`||e===`persistent-bash`||e===`subprocess`?`bash`:e===`tool-pwsh`||e===`persistent-pwsh`||e===`terminal-pwsh`||e===`pwsh-sandbox`?`pwsh`:e===`tool-fs`||e===`tool-fs-search`||e===`tool-skill`||e===`skill`||e===`agent-instructions`||e===`present`||e===`office-to-pdf`||e===`filesystem`||e===`fs-sandbox`||e===`permission`||e===`working-directory`||e===`tool-working-directory`||e===`workspace`?`fs`:`none`}var y=[{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`会话能力`},{id:`time-context`,packageName:`@deepseek-ai/dsh-time-context`,roleZh:`注入当前时间与耗时。`,category:`会话能力`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`会话能力`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`会话能力`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`会话能力`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`会话能力`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`会话能力`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载工作区 SKILL.md。`,category:`会话能力`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`会话能力`},{id:`tool-schedule`,packageName:`@deepseek-ai/dsh-tool-schedule`,roleZh:`模型可创建/查询/更新/删除定时提醒,到点投递回原会话。`,category:`会话能力`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`会话能力`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`会话能力`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`planning`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`compaction`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`compaction`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`compaction`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`delegation`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`delegation`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`delegation`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`delegation`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`delegation`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`delegation`},{id:`tool-ask-user`,packageName:`@deepseek-ai/dsh-tool-ask-user`,roleZh:`模型可向用户提出结构化问题并等待回答。`,category:`会话能力`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`会话能力`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`会话能力`},{id:`present`,packageName:`@deepseek-ai/dsh-tool-present`,roleZh:`模型可声明「交付了哪些工作区文件」,便于 UI 展示/打开。`,category:`会话能力`}],b=[{id:`attachment-local`,packageName:`@deepseek-ai/dsh-attachment-local`,roleZh:`本机附件存储与读取。`,category:`会话 / 存储`},{id:`session`,packageName:`@deepseek-ai/dsh-session`,roleZh:`事件溯源的会话存储(会话真相源)。`,category:`会话 / 存储`},{id:`session-checkpoint-policy`,packageName:`@deepseek-ai/dsh-session-checkpoint-policy`,roleZh:`会话检查点策略。`,category:`会话 / 存储`},{id:`session-log-deepseek`,packageName:`@deepseek-ai/dsh-session-log-deepseek`,roleZh:`DeepSeek 侧增量无损会话日志请求扩展。`,category:`会话 / 存储`},{id:`session-log-download`,packageName:`@deepseek-ai/dsh-session-log-export`,roleZh:`导出会话日志。`,category:`会话 / 存储`},{id:`session-persistence-jsonl`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话以 JSONL 持久化。`,category:`会话 / 存储`},{id:`session-projection`,packageName:`@deepseek-ai/dsh-session-projection`,roleZh:`会话投影视图(给 UI/查询用)。`,category:`会话 / 存储`},{id:`session-projection-cache`,packageName:`@deepseek-ai/dsh-session-projection-cache`,roleZh:`会话投影缓存。`,category:`会话 / 存储`},{id:`session-query-sqlite`,packageName:`@deepseek-ai/dsh-session-query-sqlite`,roleZh:`会话全文/结构化查询(sqlite)。`,category:`会话 / 存储`},{id:`session-reference`,packageName:`@deepseek-ai/dsh-session-reference`,roleZh:`会话内引用(消息/文件等)。`,category:`会话 / 存储`},{id:`session-stats`,packageName:`@deepseek-ai/dsh-session-stats`,roleZh:`会话统计信息。`,category:`会话 / 存储`},{id:`session-title`,packageName:`@deepseek-ai/dsh-session-title`,roleZh:`会话标题能力。`,category:`会话 / 存储`},{id:`session-turn-outline`,packageName:`@deepseek-ai/dsh-session-turn-outline`,roleZh:`对话回合摘要。`,category:`会话 / 存储`},{id:`sessions`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话 JSONL 持久化后端(与 session-persistence 同类)。`,category:`会话 / 存储`},{id:`storage`,packageName:`@deepseek-ai/dsh-storage`,roleZh:`通用存储服务。`,category:`会话 / 存储`},{id:`storage-domain`,packageName:`@deepseek-ai/dsh-storage-domain`,roleZh:`按域划分的存储。`,category:`会话 / 存储`},{id:`storage-json`,packageName:`@deepseek-ai/dsh-storage-json`,roleZh:`JSON 文件存储后端。`,category:`会话 / 存储`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`模型面工具/命令`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`模型面工具/命令`},{id:`skill-office`,packageName:`@deepseek-ai/dsh-skill-office`,roleZh:`Office(Word/PPT/Excel)相关工作流 Skill。`,category:`模型面工具/命令`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`模型面工具/命令`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`模型面工具/命令`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`模型面工具/命令`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`模型面工具/命令`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`模型面工具/命令`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`模型面工具/命令`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`模型面工具/命令`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载某个 Skill,把技能说明拉进上下文。`,category:`模型面工具/命令`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`模型面工具/命令`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`模型面工具/命令`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`模型面工具/命令`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`模型面工具/命令`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`模型面工具/命令`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`模型面工具/命令`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`模型面工具/命令`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`模型面工具/命令`},{id:`acp`,packageName:`@deepseek-ai/dsh-acp`,roleZh:`通过 JSON-RPC stdio 驱动 Harness Agent 的自动化协议服务(给外部编排用)。`,category:`其它`},{id:`acp-app-startup`,packageName:`@deepseek-ai/dsh-acp-app`,roleZh:`ACP 配置包启动:在 base 之上挂 JSON-RPC stdio 与进程生命周期。`,category:`其它`},{id:`authorization`,packageName:`@deepseek-ai/dsh-authorization`,roleZh:`授权/鉴权服务。`,category:`其它`},{id:`commands`,packageName:`@deepseek-ai/dsh-commands`,roleZh:`人类 slash 命令注册底座。`,category:`其它`},{id:`config-editor`,packageName:`@deepseek-ai/dsh-config-editor`,roleZh:`配置编辑能力。`,category:`其它`},{id:`connection`,packageName:`@deepseek-ai/dsh-client-connection`,roleZh:`客户端与 Host 连接。`,category:`其它`},{id:`credentials`,packageName:`@deepseek-ai/dsh-credentials-local`,roleZh:`本机凭证存储。`,category:`其它`},{id:`file-reference-local`,packageName:`@deepseek-ai/dsh-file-reference-local`,roleZh:`本机文件引用解析。`,category:`其它`},{id:`file-upload`,packageName:`@deepseek-ai/dsh-client-file-upload`,roleZh:`客户端上传文件。`,category:`其它`},{id:`filesystem`,packageName:`@deepseek-ai/dsh-fs-local`,roleZh:`本机文件系统实现(ctx.fs),供 tool-fs 等读写。`,category:`其它`},{id:`fs-observation-policy`,packageName:`@deepseek-ai/dsh-fs-observation-policy`,roleZh:`文件系统观察/上报策略。`,category:`其它`},{id:`headless-runner`,packageName:`@deepseek-ai/dsh-headless`,roleZh:`无 Host/HTTP/浏览器的一键 Agent/Session 运行器(纯 headless)。`,category:`其它`},{id:`headless-startup`,packageName:`@deepseek-ai/dsh-headless/startup`,roleZh:`Headless 配置包的启动插件。`,category:`其它`},{id:`image-offload`,packageName:`@deepseek-ai/dsh-compaction-image-offload`,roleZh:`超预算图片卸载为占位符并重试。`,category:`其它`},{id:`locale`,packageName:`@deepseek-ai/dsh-client-locale`,roleZh:`界面语言。`,category:`其它`},{id:`mcp-resources`,packageName:`@deepseek-ai/dsh-mcp-resources`,roleZh:`MCP 资源对接。`,category:`其它`},{id:`modules`,packageName:`@deepseek-ai/dsh-client-modules`,roleZh:`客户端模块加载。`,category:`其它`},{id:`office-to-pdf`,packageName:`@deepseek-ai/dsh-office-to-pdf`,roleZh:`Office 转 PDF。`,category:`其它`},{id:`pty`,packageName:`@deepseek-ai/dsh-terminal`,roleZh:`持久 PTY 会话能力缝:会话 id、后端注册、交互读写与信号。`,category:`其它`},{id:`repeat-tool-reminder`,packageName:`@deepseek-ai/dsh-repeat-tool-reminder`,roleZh:`重复工具调用时提醒模型。`,category:`其它`},{id:`resources`,packageName:`@deepseek-ai/dsh-client-resources`,roleZh:`客户端资源。`,category:`其它`},{id:`sdk-app-startup`,packageName:`@deepseek-ai/dsh-sdk-app`,roleZh:`SDK 配置包启动:stdio JSON-RPC 服务与进程生命周期。`,category:`其它`},{id:`sdk-jsonrpc-server`,packageName:`@deepseek-ai/dsh-sdk-jsonrpc-server`,roleZh:`给进程外 SDK 客户端用的 stdio JSON-RPC 服务端。`,category:`其它`},{id:`settings`,packageName:`@deepseek-ai/dsh-settings`,roleZh:`设置读写与校验。`,category:`其它`},{id:`shell-env`,packageName:`@deepseek-ai/dsh-shell-env`,roleZh:`注入/管理 shell 环境变量。`,category:`其它`},{id:`shortcuts`,packageName:`@deepseek-ai/dsh-client-shortcuts`,roleZh:`快捷键注册。`,category:`其它`},{id:`timeout-policy`,packageName:`@deepseek-ai/dsh-tool-call-timeout-policy`,roleZh:`单次工具调用超时策略。`,category:`其它`},{id:`user-questions`,packageName:`@deepseek-ai/dsh-user-questions`,roleZh:`用户提问通道(供 ask_user 等使用)。`,category:`其它`},{id:`working-directory`,packageName:`@deepseek-ai/dsh-working-directory`,roleZh:`会话工作目录状态。`,category:`其它`},{id:`workspace`,packageName:`@deepseek-ai/dsh-workspace`,roleZh:`工作区抽象(根目录、切换等)。`,category:`其它`},{id:`workspace-changes`,packageName:`@deepseek-ai/dsh-workspace-changes`,roleZh:`工作区变更追踪。`,category:`其它`},{id:`workspace-dependencies`,packageName:`@deepseek-ai/dsh-tool-workspace-dependencies`,roleZh:`向模型提供捆绑的 Python/Node/pnpm 依赖绝对路径(load_workspace_dependencies)。`,category:`其它`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`上下文压缩`},{id:`spill-local`,packageName:`@deepseek-ai/dsh-spill-local`,roleZh:`过大内容溢出到本机文件。`,category:`上下文压缩`},{id:`spill-policy`,packageName:`@deepseek-ai/dsh-spill-policy`,roleZh:`何时溢出、溢出策略。`,category:`上下文压缩`},{id:`token-meter`,packageName:`@deepseek-ai/dsh-token-meter`,roleZh:`统计上下文 token 用量。`,category:`上下文压缩`},{id:`web`,packageName:`@deepseek-ai/dsh-web`,roleZh:`网页能力缝(ctx.web):注册 search/fetch provider。`,category:`网页能力`},{id:`web-fetch-http`,packageName:`@deepseek-ai/dsh-web-fetch-http`,roleZh:`通用 HTTP 抓取网页正文 provider。`,category:`网页能力`},{id:`goal`,packageName:`@deepseek-ai/dsh-goal`,roleZh:`本会话目标状态机服务。`,category:`预设 / 能力服务`},{id:`goal-round-driver`,packageName:`@deepseek-ai/dsh-goal-round-driver`,roleZh:`按目标驱动多轮执行。`,category:`预设 / 能力服务`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`预设 / 能力服务`},{id:`schedule`,packageName:`@deepseek-ai/dsh-schedule`,roleZh:`主机级持久提醒,到点投递原会话。`,category:`预设 / 能力服务`},{id:`skill`,packageName:`@deepseek-ai/dsh-skill`,roleZh:`Skill 能力注册底座。`,category:`预设 / 能力服务`},{id:`approval`,packageName:`@deepseek-ai/dsh-user-approval`,roleZh:`敏感操作需用户批准。`,category:`执行 / 权限`},{id:`bash-sandbox`,packageName:`@deepseek-ai/dsh-bash-sandbox`,roleZh:`bash 专用沙箱绑定。`,category:`执行 / 权限`},{id:`fs-sandbox`,packageName:`@deepseek-ai/dsh-fs-sandbox`,roleZh:`文件系统沙箱。`,category:`执行 / 权限`},{id:`jobs`,packageName:`@deepseek-ai/dsh-jobs-local`,roleZh:`后台任务注册表(id、归属、轮询、取消)。`,category:`执行 / 权限`},{id:`permission`,packageName:`@deepseek-ai/dsh-permission-presets`,roleZh:`权限预设(只读/读写等档位)。`,category:`执行 / 权限`},{id:`persistent-bash`,packageName:`@deepseek-ai/dsh-tool-bash-persistent`,roleZh:`带 PTY 的持久 Bash 工具(跨调用保持 shell 状态)。`,category:`执行 / 权限`},{id:`persistent-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh-persistent`,roleZh:`带 PTY 的持久 PowerShell 工具。`,category:`执行 / 权限`},{id:`pwsh-sandbox`,packageName:`@deepseek-ai/dsh-pwsh-sandbox`,roleZh:`pwsh 专用沙箱绑定。`,category:`执行 / 权限`},{id:`sandbox`,packageName:`@deepseek-ai/dsh-sandbox-local`,roleZh:`本机沙箱执行环境。`,category:`执行 / 权限`},{id:`sandbox-policy`,packageName:`@deepseek-ai/dsh-sandbox-policy`,roleZh:`沙箱策略(能跑什么、不能跑什么)。`,category:`执行 / 权限`},{id:`subprocess`,packageName:`@deepseek-ai/dsh-subprocess-local`,roleZh:`本机子进程执行器。`,category:`执行 / 权限`},{id:`terminal-bash`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 bash PTY 后端。`,category:`执行 / 权限`},{id:`terminal-pwsh`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 pwsh PTY 后端。`,category:`执行 / 权限`},{id:`ptc-runtime`,packageName:`@deepseek-ai/dsh-ptc-runtime-node`,roleZh:`PTC(工具调用呈现)Node 运行时。`,category:`子代理 / 工作流`},{id:`subagent`,packageName:`@deepseek-ai/dsh-subagent`,roleZh:`子代理能力底座。`,category:`子代理 / 工作流`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`子代理 / 工作流`},{id:`agent`,packageName:`@deepseek-ai/dsh-agent`,roleZh:`Agent 主体:把会话、工具、模型串起来。`,category:`LLM / Agent 核心`},{id:`agent-default-model`,packageName:`@deepseek-ai/dsh-agent-default-model`,roleZh:`解析/提供默认模型配置。`,category:`LLM / Agent 核心`},{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`LLM / Agent 核心`},{id:`deepseek-llm-api-extensions`,packageName:`@deepseek-ai/dsh-deepseek-llm-api-extensions`,roleZh:`给官方 DeepSeek API 适配器登记额外请求字段。`,category:`LLM / Agent 核心`},{id:`llm`,packageName:`@deepseek-ai/dsh-llm`,roleZh:`厂商无关的 LLM 服务接口(发请求、流式、工具调用等)。`,category:`LLM / Agent 核心`},{id:`llm-deepseek`,packageName:`@deepseek-ai/dsh-llm-deepseek-api-key`,roleZh:`DeepSeek API Key 模型适配。`,category:`LLM / Agent 核心`},{id:`llm-pi-ai`,packageName:`@deepseek-ai/dsh-llm-pi-ai`,roleZh:`Pi AI 等 LLM 适配。`,category:`LLM / Agent 核心`},{id:`llm-retry`,packageName:`@deepseek-ai/dsh-llm-retry`,roleZh:`LLM 调用失败重试策略。`,category:`LLM / Agent 核心`},{id:`session-title-llm`,packageName:`@deepseek-ai/dsh-session-title-first-prompt-llm`,roleZh:`用首条用户消息经 LLM 自动起会话标题。`,category:`LLM / Agent 核心`},{id:`subagent-fork-in-process`,packageName:`@deepseek-ai/dsh-subagent-fork-in-process`,roleZh:`进程内 fork 子代理实现。`,category:`LLM / Agent 核心`},{id:`subagent-model-selection-settings`,packageName:`@deepseek-ai/dsh-tool-subagent/model-selection-settings`,roleZh:`子代理可选模型的设置项。`,category:`LLM / Agent 核心`},{id:`subagent-spawn-in-process`,packageName:`@deepseek-ai/dsh-subagent-spawn-in-process`,roleZh:`进程内 spawn 子代理实现。`,category:`LLM / Agent 核心`},{id:`system-prompt`,packageName:`@deepseek-ai/dsh-system-prompt`,roleZh:`系统提示词拼装服务。`,category:`LLM / Agent 核心`},{id:`tools`,packageName:`@deepseek-ai/dsh-tools`,roleZh:`工具注册与执行总闸。`,category:`LLM / Agent 核心`}],x=c();function S(e){return String(e??``).replace(/(\s*dsh[^)]*)/gi,``).replace(/\(\s*dsh[^)]*\)/gi,``).replace(/\bdsh\b/gi,``).replace(/\s{2,}/g,` `).replace(/(\s*)/g,``).trim()}function C({status:e}){let t=e.tone===`ready`?`bg-emerald-50 text-emerald-700 border-emerald-100`:e.tone===`warn`?`bg-amber-50 text-amber-800 border-amber-100`:`bg-stone-100 text-stone-500 border-stone-200`;return(0,x.jsx)(`span`,{className:`shrink-0 rounded border px-1.5 py-0.5 text-[11px] ${t}`,children:e.label})}function Ce({tone:e}){return(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full ${e===`ready`?`bg-emerald-500`:e===`warn`?`bg-amber-500`:`bg-stone-300`}`})}function w({open:e}){return(0,x.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform duration-150 ${e?`rotate-90`:``}`,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,x.jsx)(`path`,{fillRule:`evenodd`,d:`M7.21 14.77a.75.75 0 01.02-1.06L11.17 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z`,clipRule:`evenodd`})})}function we(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,ee]=(0,_.useState)(null),[a,te]=(0,_.useState)(null),[o,ne]=(0,_.useState)(!0),[s,re]=(0,_.useState)(``),[ie,c]=(0,_.useState)({}),[ae,oe]=(0,_.useState)({});function se(e){c(t=>({...t,[e]:!t[e]}))}function ce(e){oe(t=>({...t,[e]:!t[e]}))}(0,_.useEffect)(()=>{let e=!0;return(async()=>{try{let[n,i,a,o]=await Promise.all([h(),m(),g(),ye()]);if(!e)return;t(n),r(i),ee(a),te(o)}finally{e&&ne(!1)}})(),()=>{e=!1}},[]);function l(t){let r=v(t.id);return r===`none`?{label:`规划中`,tone:`plan`}:r===`ready`?{label:`已就绪`,tone:`ready`}:o?{label:`探测中…`,tone:`plan`}:r===`web`?e?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`fs`?n?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`bash`?i?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`pwsh`?a?.ok&&a.available?{label:`已就绪`,tone:`ready`}:a?.ok?{label:`未装 PowerShell`,tone:`warn`}:{label:`需本地服务`,tone:`warn`}:{label:`规划中`,tone:`plan`}}let u=s.trim().toLowerCase(),le=e=>!u||e.id.toLowerCase().includes(u)||S(e.roleZh).toLowerCase().includes(u),ue=y.filter(le),de=b.filter(le),fe=[{id:`session`,title:`会话插件`,hint:`每个会话各自加载,随会话结束释放`,items:ue,total:y.length},{id:`global`,title:`全局插件`,hint:`由系统与所有会话共享,常驻运行`,items:de,total:b.length}];return(0,x.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,x.jsx)(`div`,{className:`shrink-0 px-6 pt-5 pb-3`,children:(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`h3`,{className:`text-[15px] font-semibold text-stone-900`,children:`内置插件`}),(0,x.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-stone-500`,children:`由平台按会话或全局提供,默认常开,不需要开关;状态取决于本机服务是否就绪。`})]}),(0,x.jsxs)(`label`,{className:`relative block w-44 shrink-0`,children:[(0,x.jsxs)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,x.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,x.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),(0,x.jsx)(`input`,{value:s,onChange:e=>re(e.target.value),placeholder:`搜索插件名 / 作用`,className:`h-8 w-full rounded-lg border border-stone-200 bg-white pl-8 pr-2.5 text-xs text-stone-800 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]})]})}),(0,x.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 pb-6`,children:(0,x.jsx)(`div`,{className:`space-y-3`,children:fe.map(e=>{let t=!ie[e.id];return(0,x.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>se(e.id),"aria-expanded":t,className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left transition-colors hover:bg-stone-50/70`,children:[(0,x.jsx)(w,{open:t}),(0,x.jsx)(`h4`,{className:`text-[13px] font-medium text-stone-700`,children:e.title}),(0,x.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:u?`${e.items.length}/${e.total}`:e.total}),(0,x.jsx)(`span`,{className:`ml-auto truncate text-[11px] text-stone-400`,children:e.hint})]}),t?e.items.length?(0,x.jsx)(`div`,{className:`grid grid-cols-2 items-start gap-2 border-t border-stone-100 p-2.5`,children:e.items.map(t=>{let n=l(t),r=`${e.id}:${t.id}`,i=!!ae[r];return(0,x.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":i,onClick:()=>ce(r),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ce(r))},className:`flex cursor-pointer flex-col rounded-lg border p-2.5 text-left transition-colors ${i?`border-[#4176e6]/40 bg-[#f6f9ff]`:`border-stone-200 bg-white hover:border-stone-300 hover:bg-stone-50/60`}`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,x.jsx)(`span`,{className:`mt-1.5`,children:(0,x.jsx)(Ce,{tone:n.tone})}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`p`,{className:`truncate font-mono text-[12.5px] text-stone-800`,children:t.id}),(0,x.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-5 text-stone-500 ${i?``:`line-clamp-2`}`,children:S(t.roleZh)})]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1.5`,children:[(0,x.jsx)(C,{status:n}),(0,x.jsx)(w,{open:i})]})]}),i?(0,x.jsxs)(`dl`,{className:`mt-2 grid w-full grid-cols-[auto_1fr] gap-x-2 gap-y-1 border-t border-stone-200/70 pt-2 text-[11px]`,children:[(0,x.jsx)(`dt`,{className:`shrink-0 text-stone-400`,children:`分类`}),(0,x.jsx)(`dd`,{className:`truncate text-stone-600`,children:t.category}),(0,x.jsx)(`dt`,{className:`shrink-0 text-stone-400`,children:`npm 包`}),(0,x.jsx)(`dd`,{className:`truncate font-mono text-stone-600`,children:t.packageName||`—`})]}):null]},r)})}):(0,x.jsx)(`p`,{className:`border-t border-stone-100 px-3.5 py-4 text-center text-xs text-stone-400`,children:`没有匹配的内置插件`}):null]},e.id)})})})]})}function Te(e){try{return new URL(e).host}catch{return``}}var Ee=[{value:`zh-CN`,label:`中文`},{value:`en`,label:`English`}],T=`w-full px-3 py-2 text-sm border border-stone-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-[#4176e6]/35 focus:border-[#4176e6] transition-colors`,E=`inline-flex items-center gap-1.5 h-9 min-w-30 px-3 rounded-lg bg-stone-100 text-sm text-stone-700 hover:bg-stone-200/80 transition-colors outline-none focus:outline-none`;function De({className:e=`w-4 h-4`}){return(0,x.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,x.jsx)(`path`,{d:`M5 10.5l3.5 3.5L15 6.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Oe({className:e=`w-4 h-4`}){return(0,x.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,x.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,x.jsx)(`path`,{d:`M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4`})]})}function ke({className:e=`w-4 h-4`}){return(0,x.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,x.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,x.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,x.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}function Ae({className:e=`w-4 h-4`}){return(0,x.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,x.jsx)(`path`,{d:`M10 4a2 2 0 0 1 4 0v1h3a1 1 0 0 1 1 1v3h1a2 2 0 0 1 0 4h-1v3a1 1 0 0 1-1 1h-3v1a2 2 0 0 1-4 0v-1H7a1 1 0 0 1-1-1v-3H5a2 2 0 0 1 0-4h1V6a1 1 0 0 1 1-1h3V4z`})})}function je({kind:e}){let t=`w-5 h-5`;return e===`sun`?(0,x.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,x.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,x.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}):e===`moon`?(0,x.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,x.jsx)(`path`,{d:`M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z`})}):(0,x.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,x.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,x.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function D({title:e,description:t,control:n}){return(0,x.jsxs)(`div`,{className:`flex items-center gap-4 py-4 border-b border-stone-100 last:border-b-0`,children:[(0,x.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,x.jsx)(`div`,{className:`text-sm font-medium text-stone-800`,children:e}),t?(0,x.jsx)(`div`,{className:`mt-0.5 text-xs text-stone-400 leading-5`,children:t}):null]}),(0,x.jsx)(`div`,{className:`shrink-0`,children:n})]})}function O({value:e,options:t,onChange:n}){let r=t.find(t=>t.value===e)?.label??e;return(0,x.jsxs)(ne,{value:e,onChange:n,children:[(0,x.jsx)(te,{className:E,children:(0,x.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r})}),(0,x.jsx)(s,{transition:!0,anchor:{to:`bottom end`,gap:6},className:`tw-select-menu tw-menu-anim z-60 min-w-40 rounded-xl py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:t.map(e=>(0,x.jsxs)(o,{value:e.value,className:`group cursor-pointer select-none flex items-center justify-between gap-3 px-3 py-2 text-sm text-stone-700 data-[focus]:bg-stone-50 data-[selected]:text-stone-900`,children:[(0,x.jsx)(`span`,{children:e.label}),(0,x.jsx)(De,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0`})]},e.value))})]})}function k(){let[e,t]=(0,_.useState)(!1),[c,m]=(0,_.useState)(`general`),[h,g]=(0,_.useState)(()=>ee().model.providers),[ye,v]=(0,_.useState)(()=>ee().model.activeId),[y,b]=(0,_.useState)(null),[S,C]=(0,_.useState)(``),[Ce,w]=(0,_.useState)(`DeepSeek`),[E,k]=(0,_.useState)(``),[A,Me]=(0,_.useState)(``),[j,M]=(0,_.useState)(``),[N,Ne]=(0,_.useState)([]),[P,F]=(0,_.useState)(`idle`),[Pe,Fe]=(0,_.useState)(!1),[Ie,Le]=(0,_.useState)(`readonly`),[Re,ze]=(0,_.useState)(!1),[Be,I]=(0,_.useState)(!1),[Ve,He]=(0,_.useState)(null),[L,R]=(0,_.useState)({language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``}),[Ue,z]=(0,_.useState)(`14`),We=(0,_.useRef)(0),[B,Ge]=(0,_.useState)(null),[Ke,qe]=(0,_.useState)(!1),[Je,Ye]=(0,_.useState)(!1),[Xe,V]=(0,_.useState)(!1),[Ze,H]=(0,_.useState)(``),U=(0,_.useRef)(null),Qe=(0,_.useRef)(!1),W=y!==null,G=L.language,K=h.find(e=>e.id===ye),q=(K?.name||``).trim(),J=B?.status??null,$e=J?.phase===`done`&&!!J.to&&J.to===B?.current&&be!==B?.current&&Date.now()-Date.parse(J.finishedAt||``)<864e5,et=J?.phase===`failed`?J.error:``,Y=Xe||J?.phase===`installing`||J?.phase===`restarting`,tt=(J?.to||B?.latest||``).replace(/^v/,``),X=et||Ze,nt=B?.checkedAt&&!Y?new Date(B.checkedAt).toLocaleTimeString():``,rt=Ke?``:Y?J?.phase===`restarting`?p(`settings.updateRestarting`,void 0,G):p(`settings.updateInstalling`,{v:tt},G):X?`${p(`settings.updateFailed`,void 0,G)}:${X}`:$e?p(`settings.updateDone`,{v:J?.to||``},G):B?.mode===`dev`&&B?.hasUpdate?p(`settings.updateDevMode`,void 0,G):B?.error?`${p(`settings.updateUnavailable`,void 0,G)}:${B.error}`:B?.hasUpdate?B.mode===`npx`?p(`settings.updateNpxHint`,void 0,G):``:B?`${p(`settings.updateLatest`,void 0,G)}${nt?` · ${p(`settings.updateCheckedAt`,{time:nt},G)}`:``}`:Je?p(`settings.updateUnavailable`,void 0,G):``,it=q||(G===`en`?`No model`:`未配置`),at=q?K?.model?.trim()?`${q} · ${K.model.trim()}`:q:G===`en`?`No model configured`:`未配置模型`;function ot(e=`general`){m(e),r().then(()=>{st(),t(!0)})}function st(){ze(n()),g(u()),v(l()),I(!!d()),R(he()),me(he()),Le(pe()),b(null)}function Z(){U.current!==null&&(window.clearInterval(U.current),U.current=null)}async function ct(e=!0){qe(!0);try{let t=await Se(e);t&&(Ge(t),H(``))}finally{qe(!1),Ye(!0)}}function lt(e){Z();let t=Date.now()+18e4;U.current=window.setInterval(async()=>{if(!Qe.current){Qe.current=!0;try{let n=await Se(!0);if(n){Ge(n);let t=n.status;if(t?.phase===`failed`){Z(),V(!1),H(t.error||p(`settings.updateFailed`,void 0,G));return}if(t?.phase===`done`||e&&n.current!==e){Z(),V(!1);return}}Date.now()>t&&(Z(),V(!1),H(p(`settings.updateTimeout`,void 0,G)))}finally{Qe.current=!1}}},1500)}async function ut(){let e=B?.latest||``;H(``),V(!0);let t=B?.current||be,n=await xe(e||void 0);n.ok?lt(t):(V(!1),H(n.error||p(`settings.updateFailed`,void 0,G)))}function dt(e){if(!e){let e=a();b(e),C(`DeepSeek`),w(`DeepSeek`),k(`https://api.deepseek.com/v1`),Me(``),M(``),Ne([]),F(`idle`),Fe(!1);return}b(e.id),C(e.name),k(e.baseURL);let t=e.apiKey?.trim()||(e.id===l()?i().trim():``)||``;Me(t),M(e.model),Ne(e.availableModels??[]),F(e.availableModels?.length?`ok`:`idle`),w(f.find(t=>t.baseURL===e.baseURL)?.label??`自定义`),Fe(!1)}(0,_.useEffect)(()=>{r().then(()=>st());let e=e=>{let n=e.detail;m(n?.tab===`model`?`model`:n?.tab===`builtin`?`builtin`:`general`),r().then(()=>{st(),t(!0)})};window.addEventListener(ge,e);let n=le(e=>R(e)),i=_e(e=>Le(e));return()=>{window.removeEventListener(ge,e),n(),i()}},[]),(0,_.useEffect)(()=>{if(e)return(async()=>{let e=await Se(!1);if(Ye(!0),!e)return;Ge(e);let t=e.status;(t?.phase===`installing`||t?.phase===`restarting`)&&(V(!0),lt(t.from||e.current))})(),Z},[e]),(0,_.useEffect)(()=>{if(!e||c!==`model`||!W)return;let t=E.trim(),n=A.trim();if(!t||!n){F(e=>e===`ok`?`ok`:`idle`);return}F(`loading`);let r=++We.current,i=setTimeout(()=>{se(t,n).then(e=>{r===We.current&&(Ne(e),F(`ok`))}).catch(()=>{r===We.current&&F(`fail`)})},800);return()=>clearTimeout(i)},[e,c,W,E,A]);function ft(e){w(e);let t=f.find(t=>t.label===e);t&&(t.baseURL&&k(t.baseURL),(!S.trim()||f.some(e=>e.label===S))&&C(t.label)),M(``)}function Q(e){R(ue(e))}(0,_.useEffect)(()=>{z(String(L.sessionFontSize))},[L.sessionFontSize]);function pt(){let e=Number(Ue);if(!Ue.trim()||!Number.isFinite(e)){z(String(L.sessionFontSize));return}let t=ue({sessionFontSize:Math.round(e)});R(t),z(String(t.sessionFontSize))}let mt=!!(S.trim()&&E.trim()&&A.trim()&&j.trim()),$=N.length>0;function ht(){if(!mt||!y)return;let e=!h.some(e=>e.id===y),t=ve({id:y,name:S.trim(),baseURL:E.trim(),apiKey:A.trim(),model:j.trim(),availableModels:$?N:void 0},{activate:!0});g(t),v(y),b(null),I(!!d()),oe(e?`已新增模型服务`:`已保存模型服务`,`success`)}function gt(e){He(e)}function _t(){let e=Ve;if(!e)return;let t=h.find(t=>t.id===e)?.name??`该服务`;He(null);let n=fe(e);g(n),v(l()),y===e&&b(null),I(!!d()),oe(`已删除模型服务「${t}」`,`success`)}function vt(e){ce(e),v(e),I(!!d())}let yt=[{value:`readonly`,label:p(`settings.access.readonly`,void 0,G)},{value:`readwrite`,label:p(`settings.access.readwrite`,void 0,G)},{value:`full`,label:p(`settings.access.full`,void 0,G)}],bt=[{value:`concise`,label:p(`settings.step.concise`,void 0,G)},{value:`standard`,label:p(`settings.step.standard`,void 0,G)},{value:`detailed`,label:p(`settings.step.detailed`,void 0,G)},{value:`full`,label:p(`settings.step.full`,void 0,G)}],xt=[{value:`queue`,label:p(`settings.busySend.queue`,void 0,G)},{value:`interrupt`,label:p(`settings.busySend.interrupt`,void 0,G)}],St=[{value:`light`,label:p(`settings.appear.light`,void 0,G),icon:`sun`},{value:`dark`,label:p(`settings.appear.dark`,void 0,G),icon:`moon`},{value:`system`,label:p(`settings.appear.system`,void 0,G),icon:`monitor`}],Ct=[{id:`general`,label:p(`settings.general`,void 0,G),icon:(0,x.jsx)(Oe,{})},{id:`model`,label:p(`settings.model`,void 0,G),icon:(0,x.jsx)(ke,{})},{id:`builtin`,label:p(`settings.builtin`,void 0,G),icon:(0,x.jsx)(Ae,{})}],wt=c===`general`||c===`builtin`?p(c===`general`?`settings.general`:`settings.builtin`,void 0,G):W?h.some(e=>e.id===y)?p(`settings.editProvider`,void 0,G):p(`settings.addProviderTitle`,void 0,G):p(`settings.model`,void 0,G);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`tw-nav-foot-row`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>ot(`general`),className:`tw-nav-settings-btn`,"data-hint":Be?`设置(已配置模型)`:`设置`,children:[(0,x.jsxs)(`svg`,{className:`tw-nav-ico w-4.5 h-4.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":`true`,children:[(0,x.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,x.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z`})]}),(0,x.jsx)(`span`,{"data-i18n":`nav.settings`,children:p(`nav.settings`,void 0,G)})]}),(0,x.jsxs)(`button`,{type:`button`,className:`tw-nav-provider-chip${q?``:` is-empty`}`,"data-hint":at,onClick:()=>ot(`model`),children:[(0,x.jsx)(`span`,{className:`tw-nav-provider-dot`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`tw-nav-provider-name`,children:it})]})]}),(0,x.jsx)(re,{show:e,children:(0,x.jsxs)(`div`,{className:`fixed inset-0 z-110 flex items-center justify-center p-4`,children:[(0,x.jsx)(ie,{children:(0,x.jsx)(`div`,{className:`tw-dialog-backdrop-anim absolute inset-0 bg-stone-950/45`,onClick:()=>t(!1),"aria-hidden":`true`})}),(0,x.jsx)(ie,{children:(0,x.jsxs)(`div`,{className:`tw-settings-dialog tw-dialog-panel-anim relative bg-white rounded-2xl shadow-2xl w-full max-w-3xl h-[min(92vh,720px)] overflow-hidden flex flex-col`,children:[(0,x.jsxs)(`div`,{className:`shrink-0 h-12 px-4 flex items-center justify-between border-b border-stone-100 bg-white`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-stone-800 truncate pr-3`,children:wt}),(0,x.jsx)(`button`,{type:`button`,"aria-label":p(`settings.close`,void 0,G),onClick:()=>t(!1),className:`w-8 h-8 inline-flex items-center justify-center rounded-lg text-stone-400 hover:text-stone-700 hover:bg-stone-100 transition-colors`,children:(0,x.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,x.jsx)(`path`,{d:`M5 5l10 10M15 5L5 15`,strokeLinecap:`round`})})})]}),(0,x.jsxs)(`div`,{className:`flex-1 min-h-0 flex`,children:[(0,x.jsx)(`aside`,{className:`w-38 shrink-0 border-r border-stone-100 bg-[#f4f5f7] py-3 px-2 space-y-0.5`,children:Ct.map(e=>{let t=c===e.id;return(0,x.jsxs)(`button`,{type:`button`,onClick:()=>{m(e.id),e.id===`model`&&b(null)},className:`w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-sm transition-colors ${t?`bg-[#e8f0fe] text-[#4176e6] font-medium`:`text-stone-600 hover:bg-white/70 hover:text-stone-800`}`,children:[(0,x.jsx)(`span`,{className:t?`text-[#4176e6]`:`text-stone-400`,children:e.icon}),e.label]},e.id)})}),(0,x.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0 bg-white`,children:c===`general`?(0,x.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-1`,children:[(0,x.jsx)(D,{title:p(`settings.access`,void 0,G),description:p(`settings.accessDesc`,void 0,G),control:(0,x.jsx)(O,{value:Ie,options:yt,onChange:e=>{Le(e),de(e)}})}),(0,x.jsx)(D,{title:p(`settings.language`,void 0,G),control:(0,x.jsx)(O,{value:L.language,options:Ee,onChange:e=>Q({language:e})})}),(0,x.jsxs)(`div`,{className:`py-4 border-b border-stone-100`,children:[(0,x.jsx)(`div`,{className:`text-sm font-medium text-stone-800 mb-3`,children:p(`settings.appearance`,void 0,G)}),(0,x.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5`,children:St.map(e=>{let t=L.appearance===e.value;return(0,x.jsxs)(`button`,{type:`button`,onClick:()=>Q({appearance:e.value}),className:`flex flex-col items-center justify-center gap-2 h-19 rounded-xl border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] text-[#4176e6] ring-1 ring-[#4176e6]/30`:`border-stone-200 text-stone-500 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,x.jsx)(je,{kind:e.icon}),(0,x.jsx)(`span`,{className:`text-xs font-medium`,children:e.label})]},e.value)})})]}),(0,x.jsx)(D,{title:p(`settings.fontSize`,void 0,G),description:p(`settings.fontSizeDesc`,void 0,G),control:(0,x.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,x.jsx)(`input`,{type:`number`,min:12,max:22,value:Ue,onChange:e=>z(e.target.value),onBlur:pt,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 h-9 px-2 text-sm text-center rounded-lg bg-stone-100 border-0 outline-none focus:ring-2 focus:ring-[#4176e6]/30`}),(0,x.jsx)(`span`,{className:`text-sm text-stone-400`,children:`px`})]})}),(0,x.jsx)(D,{title:p(`settings.toolSteps`,void 0,G),description:p(`settings.toolStepsDesc`,void 0,G),control:(0,x.jsx)(O,{value:L.toolStepDetail,options:bt,onChange:e=>Q({toolStepDetail:e})})}),(0,x.jsx)(D,{title:p(`settings.busySend`,void 0,G),description:p(`settings.busySendDesc`,void 0,G),control:(0,x.jsx)(O,{value:L.busySendBehavior,options:xt,onChange:e=>Q({busySendBehavior:e})})}),(0,x.jsx)(D,{title:p(`settings.subagentModel`,void 0,G),description:p(`settings.subagentModelDesc`,void 0,G),control:(0,x.jsx)(O,{value:L.subagentModel?.trim()?L.subagentModel:`inherit`,options:[{value:`inherit`,label:p(`settings.subagentModel.inherit`,void 0,G)},...Array.from(new Set([...K?.availableModels??[],...K?.model?[K.model]:[]])).filter(Boolean).map(e=>({value:e,label:e}))],onChange:e=>Q({subagentModel:e===`inherit`?``:e})})})]}),(0,x.jsxs)(`div`,{className:`shrink-0 px-6 py-3 border-t border-stone-100`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0 flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`text-sm text-stone-700 whitespace-nowrap`,children:p(`settings.platformVersion`,void 0,G)}),(0,x.jsxs)(`span`,{className:`text-sm tabular-nums text-stone-500`,children:[`v`,be]}),B?.hasUpdate&&!Y&&!$e?(0,x.jsx)(`span`,{className:`inline-flex items-center h-[18px] px-1.5 rounded-full bg-[#edf3fe] text-[11px] font-medium text-[#4176e6] tabular-nums whitespace-nowrap`,children:`${p(`settings.updateAvailable`,void 0,G)} v${(B.latest||``).replace(/^v/,``)}`}):null]}),(0,x.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:Y?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 h-8 px-3 rounded-lg text-xs text-stone-500 bg-stone-100 whitespace-nowrap`,children:[(0,x.jsx)(`span`,{className:`w-3 h-3 rounded-full border-2 border-stone-300 border-t-[#4176e6] animate-spin`}),p(`settings.updateWorking`,void 0,G)]}):$e?(0,x.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`h-8 px-3 rounded-lg text-xs font-medium text-[#4176e6] bg-[#edf3fe] hover:bg-[#e2ecfd] whitespace-nowrap`,children:p(`settings.updateReload`,void 0,G)}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,disabled:Ke,onClick:()=>void ct(!0),className:`inline-flex items-center justify-center min-w-[76px] h-8 px-3 rounded-lg text-xs font-medium text-stone-600 bg-stone-100 hover:bg-stone-200 disabled:opacity-70 disabled:cursor-default whitespace-nowrap`,children:Ke?(0,x.jsxs)(x.Fragment,{children:[p(`settings.updateChecking`,void 0,G),(0,x.jsxs)(`span`,{className:`tw-dots`,"aria-hidden":`true`,children:[(0,x.jsx)(`i`,{}),(0,x.jsx)(`i`,{}),(0,x.jsx)(`i`,{})]})]}):p(`settings.updateCheck`,void 0,G)}),B?.hasUpdate?(0,x.jsx)(`button`,{type:`button`,disabled:B.mode===`dev`,onClick:()=>void ut(),className:`h-8 px-3 rounded-lg text-xs font-semibold text-white bg-[#4176e6] hover:bg-[#3566d6] disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:p(`settings.updateNow`,void 0,G)}):null]})})]}),rt?(0,x.jsx)(`div`,{className:`mt-1 text-[11px] leading-relaxed ${X?`text-red-500`:`text-stone-400`}`,children:rt}):null,X&&B?.logPath?(0,x.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-relaxed text-stone-400 break-all`,children:p(`settings.updateLog`,{path:B.logPath},G)}):null]})]}):W?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`shrink-0 px-5 pt-3 pb-2 flex items-center gap-2 border-b border-stone-100`,children:(0,x.jsx)(`button`,{type:`button`,onClick:()=>b(null),className:`text-sm text-stone-500 hover:text-stone-800`,children:p(`settings.back`,void 0,G)})}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:p(`settings.displayName`,void 0,G)}),(0,x.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:`DeepSeek`,className:T})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:p(`settings.preset`,void 0,G)}),(0,x.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:f.map(e=>{let t=Ce===e.label;return(0,x.jsxs)(`button`,{type:`button`,onClick:()=>ft(e.label),className:`text-left px-3 py-2 rounded-lg border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] ring-1 ring-[#4176e6]/30`:`border-stone-200 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,x.jsx)(`div`,{className:`text-sm ${t?`text-[#3565c7] font-medium`:`text-stone-700`}`,children:e.label}),(0,x.jsx)(`div`,{className:`text-[11px] text-stone-400 truncate`,children:e.baseURL?Te(e.baseURL):`OpenAI compatible`})]},e.label)})})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:p(`settings.baseUrl`,void 0,G)}),(0,x.jsx)(`input`,{type:`text`,value:E,onChange:e=>k(e.target.value),placeholder:`https://api.deepseek.com/v1`,className:T})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:p(`settings.apiKey`,void 0,G)}),(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`input`,{type:Pe?`text`:`password`,value:A,onChange:e=>Me(e.target.value),placeholder:`sk-...`,className:`${T} pr-14`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>Fe(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-stone-400 hover:text-stone-600 px-1.5 py-1`,children:Pe?G===`en`?`Hide`:`隐藏`:G===`en`?`Show`:`显示`})]}),Re?(0,x.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:p(`settings.keyHint`,void 0,G)}):null]}),(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,x.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:p(`settings.modelField`,void 0,G)}),P===`loading`&&(0,x.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:p(`settings.recognizing`,void 0,G)}),$&&P===`ok`&&(0,x.jsx)(`span`,{className:`text-[11px] text-emerald-600`,children:p(`settings.recognized`,{n:N.length},G)}),P===`fail`&&!$&&(0,x.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:p(`settings.recognizeFail`,void 0,G)}),P===`fail`&&$&&(0,x.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:p(`settings.recognizeKeep`,void 0,G)})]}),$?(0,x.jsxs)(ne,{value:j,onChange:M,children:[(0,x.jsx)(te,{className:`${T} flex items-center justify-start text-left hover:border-stone-400 cursor-pointer`,children:(0,x.jsx)(`span`,{className:`min-w-0 truncate text-stone-800`,children:j||(G===`en`?`Select a model`:`请选择模型`)})}),(0,x.jsx)(s,{transition:!0,anchor:{to:`bottom start`,gap:6},className:`tw-select-menu tw-menu-anim z-60 w-(--button-width) max-h-60 overflow-auto rounded-lg py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:N.map(e=>(0,x.jsxs)(o,{value:e,className:`group cursor-pointer select-none flex items-center justify-between px-3 py-2 text-sm text-stone-700 data-[focus]:bg-[#edf3fe] data-[selected]:text-[#3565c7] data-[selected]:font-medium`,children:[(0,x.jsx)(`span`,{className:`truncate`,children:e}),(0,x.jsx)(De,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0 ml-2`})]},e))})]}):(0,x.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:p(`settings.modelPlaceholder`,void 0,G),className:T})]})]}),(0,x.jsxs)(`div`,{className:`shrink-0 px-5 py-3.5 bg-stone-50 border-t border-stone-100 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>b(null),className:`px-3.5 py-1.5 text-sm text-stone-600 hover:bg-stone-200/60 rounded-lg`,children:p(`settings.cancel`,void 0,G)}),(0,x.jsx)(`button`,{type:`button`,onClick:ht,disabled:!mt,className:`px-3.5 py-1.5 text-sm font-medium text-white bg-[#4176e6] hover:bg-[#3565c7] rounded-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:p(`settings.save`,void 0,G)})]})]}):c===`builtin`?(0,x.jsx)(we,{}):(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5 bg-[#f4f5f7]`,children:[(0,x.jsx)(`p`,{className:`text-sm text-stone-500`,children:p(`settings.modelIntro`,void 0,G)}),(0,x.jsxs)(`div`,{className:`mt-5 space-y-2.5`,children:[h.map(e=>{let t=!!(e.apiKey?.trim()&&e.baseURL.trim()&&e.model.trim()),n=e.id===ye;return(0,x.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-stone-200/90 bg-white px-4 py-3.5 shadow-[0_1px_0_rgba(15,23,42,0.02)]`,children:[(0,x.jsxs)(`button`,{type:`button`,"data-hint":n?G===`en`?`Active`:`当前使用`:G===`en`?`Set active`:`设为当前`,onClick:()=>vt(e.id),className:`flex-1 min-w-0 flex items-center gap-2 text-left`,children:[(0,x.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:e.name}),t?(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-emerald-500`}):null]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>dt(e),className:`h-8 px-3 text-sm text-stone-700 rounded-lg border border-stone-200 bg-white hover:bg-stone-50`,children:p(`settings.edit`,void 0,G)}),h.length>1?(0,x.jsx)(`button`,{type:`button`,onClick:()=>gt(e.id),className:`h-8 px-3 text-sm text-red-600 rounded-lg hover:bg-red-50`,children:p(`settings.delete`,void 0,G)}):null]})]},e.id)}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>dt(null),className:`w-full h-12 rounded-xl border border-dashed border-stone-300 bg-white/60 text-sm text-stone-600 hover:border-[#4176e6] hover:text-[#4176e6] hover:bg-[#edf3fe]/50 transition-colors`,children:p(`settings.addProvider`,void 0,G)})]})]})})]})]})})]})}),(0,x.jsx)(ae,{open:Ve!=null,title:p(`settings.delete`,void 0,G),message:p(`settings.deleteConfirm`,void 0,G),confirmLabel:p(`settings.delete`,void 0,G),cancelLabel:G===`en`?`Cancel`:`取消`,danger:!0,onClose:()=>He(null),onConfirm:_t})]})}export{k as default};
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{a as n,i as r,n as i,r as ee,s as a}from"./app-config.CF1xVPmo.js";import{i as te,n as o,r as ne,t as s}from"./listbox.DNxAJmEo.js";import{a as re,o as ie}from"./dialog.DZHZCe_T.js";import{t as c}from"./jsx-runtime.DUg_B_vD.js";import{t as ae}from"./ConfirmDialog.CsMwWevK.js";import{showToast as oe}from"./Toast.BO2NFckG.js";import{i as se}from"./llm.BuR7z55C.js";import{_ as ce,a as l,c as u,d as le,g as ue,h as de,i as fe,l as d,n as f,o as pe,r as me,s as he,t as ge,u as _e,v as ve}from"./settings.B1yetppp.js";import{n as p}from"./i18n.CjqQGCAI.js";import{s as m}from"./fs-tools.3F9MFrLf.js";import{_ as h,c as g,l as ye}from"./bash-tools.CPS0ZiKi.js";import{t as be}from"./app-version.yT2l6J8H.js";import{n as xe,t as Se}from"./update.Fq2CGmCX.js";var _=e(t(),1);function v(e){return e===`time-context`||e===`tool-todo`||e===`tool-ask-user`||e===`user-questions`||e===`plan-mode`||e===`tool-result-pruner`||e===`compaction-basic`||e===`command-compact`||e===`tool-goal`||e===`command-goal`||e===`goal`||e===`tool-schedule`||e===`schedule`||e===`goal-round-driver`||e===`session-log-download`||e===`llm-retry`||e===`session-title-llm`||e===`session-stats`||e===`locale`||e===`config-editor`||e===`subagent`||e===`subagent-fork-in-process`||e===`spill-local`||e===`spill-policy`||e===`session-turn-outline`||e===`image-offload`||e===`session-persistence-jsonl`||e===`session-checkpoint-policy`||e===`session-query-sqlite`||e===`session-projection-cache`||e===`storage-domain`||e===`workspace-changes`||e===`workspace-dependencies`||e===`skill-office`||e===`fs-observation-policy`||e===`deepseek-llm-api-extensions`||e===`session-log-deepseek`||e===`subagent-model-selection-settings`||e===`authorization`||e===`modules`||e===`resources`||e===`mcp-resources`||e===`ptc-runtime`||e===`headless-runner`||e===`headless-startup`||e===`sdk-jsonrpc-server`||e===`sdk-app-startup`||e===`acp`||e===`acp-app-startup`||e===`subagent-spawn-in-process`||e===`llm-pi-ai`||e===`session-reference`||e===`tool-subagent`||e===`tool-subagent-control`||e===`tool-subagent-list-agents`||e===`tool-subagent-fork`||e===`tool-workflow`||e===`workflow-ptc`||e===`session-title`||e===`attachment-local`||e===`file-upload`||e===`file-reference-local`||e===`credentials`||e===`connection`||e===`token-meter`||e===`llm`||e===`llm-deepseek`||e===`agent-default-model`||e===`session`||e===`sessions`||e===`session-projection`||e===`storage`||e===`storage-json`||e===`settings`||e===`commands`||e===`shortcuts`||e===`timeout-policy`||e===`shell-env`||e===`approval`||e===`agent`||e===`system-prompt`||e===`tools`||e===`repeat-tool-reminder`?`ready`:e===`tool-web`||e===`web`||e===`web-fetch-http`||e===`web-search-deepseek`?`web`:e===`tool-bash`||e===`tool-jobs`||e===`jobs`||e===`sandbox-policy`||e===`bash-sandbox`||e===`sandbox`||e===`pty`||e===`terminal-bash`||e===`persistent-bash`||e===`subprocess`?`bash`:e===`tool-pwsh`||e===`persistent-pwsh`||e===`terminal-pwsh`||e===`pwsh-sandbox`?`pwsh`:e===`tool-fs`||e===`tool-fs-search`||e===`tool-skill`||e===`skill`||e===`agent-instructions`||e===`present`||e===`office-to-pdf`||e===`filesystem`||e===`fs-sandbox`||e===`permission`||e===`working-directory`||e===`tool-working-directory`||e===`workspace`?`fs`:`none`}var y=[{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`会话能力`},{id:`time-context`,packageName:`@deepseek-ai/dsh-time-context`,roleZh:`注入当前时间与耗时。`,category:`会话能力`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`会话能力`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`会话能力`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`会话能力`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`会话能力`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`会话能力`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载工作区 SKILL.md。`,category:`会话能力`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`会话能力`},{id:`tool-schedule`,packageName:`@deepseek-ai/dsh-tool-schedule`,roleZh:`模型可创建/查询/更新/删除定时提醒,到点投递回原会话。`,category:`会话能力`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`会话能力`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`会话能力`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`planning`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`compaction`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`compaction`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`compaction`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`delegation`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`delegation`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`delegation`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`delegation`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`delegation`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`delegation`},{id:`tool-ask-user`,packageName:`@deepseek-ai/dsh-tool-ask-user`,roleZh:`模型可向用户提出结构化问题并等待回答。`,category:`会话能力`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`会话能力`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`会话能力`},{id:`present`,packageName:`@deepseek-ai/dsh-tool-present`,roleZh:`模型可声明「交付了哪些工作区文件」,便于 UI 展示/打开。`,category:`会话能力`}],b=[{id:`attachment-local`,packageName:`@deepseek-ai/dsh-attachment-local`,roleZh:`本机附件存储与读取。`,category:`会话 / 存储`},{id:`session`,packageName:`@deepseek-ai/dsh-session`,roleZh:`事件溯源的会话存储(会话真相源)。`,category:`会话 / 存储`},{id:`session-checkpoint-policy`,packageName:`@deepseek-ai/dsh-session-checkpoint-policy`,roleZh:`会话检查点策略。`,category:`会话 / 存储`},{id:`session-log-deepseek`,packageName:`@deepseek-ai/dsh-session-log-deepseek`,roleZh:`DeepSeek 侧增量无损会话日志请求扩展。`,category:`会话 / 存储`},{id:`session-log-download`,packageName:`@deepseek-ai/dsh-session-log-export`,roleZh:`导出会话日志。`,category:`会话 / 存储`},{id:`session-persistence-jsonl`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话以 JSONL 持久化。`,category:`会话 / 存储`},{id:`session-projection`,packageName:`@deepseek-ai/dsh-session-projection`,roleZh:`会话投影视图(给 UI/查询用)。`,category:`会话 / 存储`},{id:`session-projection-cache`,packageName:`@deepseek-ai/dsh-session-projection-cache`,roleZh:`会话投影缓存。`,category:`会话 / 存储`},{id:`session-query-sqlite`,packageName:`@deepseek-ai/dsh-session-query-sqlite`,roleZh:`会话全文/结构化查询(sqlite)。`,category:`会话 / 存储`},{id:`session-reference`,packageName:`@deepseek-ai/dsh-session-reference`,roleZh:`会话内引用(消息/文件等)。`,category:`会话 / 存储`},{id:`session-stats`,packageName:`@deepseek-ai/dsh-session-stats`,roleZh:`会话统计信息。`,category:`会话 / 存储`},{id:`session-title`,packageName:`@deepseek-ai/dsh-session-title`,roleZh:`会话标题能力。`,category:`会话 / 存储`},{id:`session-turn-outline`,packageName:`@deepseek-ai/dsh-session-turn-outline`,roleZh:`对话回合摘要。`,category:`会话 / 存储`},{id:`sessions`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话 JSONL 持久化后端(与 session-persistence 同类)。`,category:`会话 / 存储`},{id:`storage`,packageName:`@deepseek-ai/dsh-storage`,roleZh:`通用存储服务。`,category:`会话 / 存储`},{id:`storage-domain`,packageName:`@deepseek-ai/dsh-storage-domain`,roleZh:`按域划分的存储。`,category:`会话 / 存储`},{id:`storage-json`,packageName:`@deepseek-ai/dsh-storage-json`,roleZh:`JSON 文件存储后端。`,category:`会话 / 存储`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`模型面工具/命令`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`模型面工具/命令`},{id:`skill-office`,packageName:`@deepseek-ai/dsh-skill-office`,roleZh:`Office(Word/PPT/Excel)相关工作流 Skill。`,category:`模型面工具/命令`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`模型面工具/命令`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`模型面工具/命令`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`模型面工具/命令`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`模型面工具/命令`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`模型面工具/命令`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`模型面工具/命令`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`模型面工具/命令`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载某个 Skill,把技能说明拉进上下文。`,category:`模型面工具/命令`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`模型面工具/命令`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`模型面工具/命令`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`模型面工具/命令`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`模型面工具/命令`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`模型面工具/命令`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`模型面工具/命令`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`模型面工具/命令`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`模型面工具/命令`},{id:`acp`,packageName:`@deepseek-ai/dsh-acp`,roleZh:`通过 JSON-RPC stdio 驱动 Harness Agent 的自动化协议服务(给外部编排用)。`,category:`其它`},{id:`acp-app-startup`,packageName:`@deepseek-ai/dsh-acp-app`,roleZh:`ACP 配置包启动:在 base 之上挂 JSON-RPC stdio 与进程生命周期。`,category:`其它`},{id:`authorization`,packageName:`@deepseek-ai/dsh-authorization`,roleZh:`授权/鉴权服务。`,category:`其它`},{id:`commands`,packageName:`@deepseek-ai/dsh-commands`,roleZh:`人类 slash 命令注册底座。`,category:`其它`},{id:`config-editor`,packageName:`@deepseek-ai/dsh-config-editor`,roleZh:`配置编辑能力。`,category:`其它`},{id:`connection`,packageName:`@deepseek-ai/dsh-client-connection`,roleZh:`客户端与 Host 连接。`,category:`其它`},{id:`credentials`,packageName:`@deepseek-ai/dsh-credentials-local`,roleZh:`本机凭证存储。`,category:`其它`},{id:`file-reference-local`,packageName:`@deepseek-ai/dsh-file-reference-local`,roleZh:`本机文件引用解析。`,category:`其它`},{id:`file-upload`,packageName:`@deepseek-ai/dsh-client-file-upload`,roleZh:`客户端上传文件。`,category:`其它`},{id:`filesystem`,packageName:`@deepseek-ai/dsh-fs-local`,roleZh:`本机文件系统实现(ctx.fs),供 tool-fs 等读写。`,category:`其它`},{id:`fs-observation-policy`,packageName:`@deepseek-ai/dsh-fs-observation-policy`,roleZh:`文件系统观察/上报策略。`,category:`其它`},{id:`headless-runner`,packageName:`@deepseek-ai/dsh-headless`,roleZh:`无 Host/HTTP/浏览器的一键 Agent/Session 运行器(纯 headless)。`,category:`其它`},{id:`headless-startup`,packageName:`@deepseek-ai/dsh-headless/startup`,roleZh:`Headless 配置包的启动插件。`,category:`其它`},{id:`image-offload`,packageName:`@deepseek-ai/dsh-compaction-image-offload`,roleZh:`超预算图片卸载为占位符并重试。`,category:`其它`},{id:`locale`,packageName:`@deepseek-ai/dsh-client-locale`,roleZh:`界面语言。`,category:`其它`},{id:`mcp-resources`,packageName:`@deepseek-ai/dsh-mcp-resources`,roleZh:`MCP 资源对接。`,category:`其它`},{id:`modules`,packageName:`@deepseek-ai/dsh-client-modules`,roleZh:`客户端模块加载。`,category:`其它`},{id:`office-to-pdf`,packageName:`@deepseek-ai/dsh-office-to-pdf`,roleZh:`Office 转 PDF。`,category:`其它`},{id:`pty`,packageName:`@deepseek-ai/dsh-terminal`,roleZh:`持久 PTY 会话能力缝:会话 id、后端注册、交互读写与信号。`,category:`其它`},{id:`repeat-tool-reminder`,packageName:`@deepseek-ai/dsh-repeat-tool-reminder`,roleZh:`重复工具调用时提醒模型。`,category:`其它`},{id:`resources`,packageName:`@deepseek-ai/dsh-client-resources`,roleZh:`客户端资源。`,category:`其它`},{id:`sdk-app-startup`,packageName:`@deepseek-ai/dsh-sdk-app`,roleZh:`SDK 配置包启动:stdio JSON-RPC 服务与进程生命周期。`,category:`其它`},{id:`sdk-jsonrpc-server`,packageName:`@deepseek-ai/dsh-sdk-jsonrpc-server`,roleZh:`给进程外 SDK 客户端用的 stdio JSON-RPC 服务端。`,category:`其它`},{id:`settings`,packageName:`@deepseek-ai/dsh-settings`,roleZh:`设置读写与校验。`,category:`其它`},{id:`shell-env`,packageName:`@deepseek-ai/dsh-shell-env`,roleZh:`注入/管理 shell 环境变量。`,category:`其它`},{id:`shortcuts`,packageName:`@deepseek-ai/dsh-client-shortcuts`,roleZh:`快捷键注册。`,category:`其它`},{id:`timeout-policy`,packageName:`@deepseek-ai/dsh-tool-call-timeout-policy`,roleZh:`单次工具调用超时策略。`,category:`其它`},{id:`user-questions`,packageName:`@deepseek-ai/dsh-user-questions`,roleZh:`用户提问通道(供 ask_user 等使用)。`,category:`其它`},{id:`working-directory`,packageName:`@deepseek-ai/dsh-working-directory`,roleZh:`会话工作目录状态。`,category:`其它`},{id:`workspace`,packageName:`@deepseek-ai/dsh-workspace`,roleZh:`工作区抽象(根目录、切换等)。`,category:`其它`},{id:`workspace-changes`,packageName:`@deepseek-ai/dsh-workspace-changes`,roleZh:`工作区变更追踪。`,category:`其它`},{id:`workspace-dependencies`,packageName:`@deepseek-ai/dsh-tool-workspace-dependencies`,roleZh:`向模型提供捆绑的 Python/Node/pnpm 依赖绝对路径(load_workspace_dependencies)。`,category:`其它`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`上下文压缩`},{id:`spill-local`,packageName:`@deepseek-ai/dsh-spill-local`,roleZh:`过大内容溢出到本机文件。`,category:`上下文压缩`},{id:`spill-policy`,packageName:`@deepseek-ai/dsh-spill-policy`,roleZh:`何时溢出、溢出策略。`,category:`上下文压缩`},{id:`token-meter`,packageName:`@deepseek-ai/dsh-token-meter`,roleZh:`统计上下文 token 用量。`,category:`上下文压缩`},{id:`web`,packageName:`@deepseek-ai/dsh-web`,roleZh:`网页能力缝(ctx.web):注册 search/fetch provider。`,category:`网页能力`},{id:`web-fetch-http`,packageName:`@deepseek-ai/dsh-web-fetch-http`,roleZh:`通用 HTTP 抓取网页正文 provider。`,category:`网页能力`},{id:`goal`,packageName:`@deepseek-ai/dsh-goal`,roleZh:`本会话目标状态机服务。`,category:`预设 / 能力服务`},{id:`goal-round-driver`,packageName:`@deepseek-ai/dsh-goal-round-driver`,roleZh:`按目标驱动多轮执行。`,category:`预设 / 能力服务`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`预设 / 能力服务`},{id:`schedule`,packageName:`@deepseek-ai/dsh-schedule`,roleZh:`主机级持久提醒,到点投递原会话。`,category:`预设 / 能力服务`},{id:`skill`,packageName:`@deepseek-ai/dsh-skill`,roleZh:`Skill 能力注册底座。`,category:`预设 / 能力服务`},{id:`approval`,packageName:`@deepseek-ai/dsh-user-approval`,roleZh:`敏感操作需用户批准。`,category:`执行 / 权限`},{id:`bash-sandbox`,packageName:`@deepseek-ai/dsh-bash-sandbox`,roleZh:`bash 专用沙箱绑定。`,category:`执行 / 权限`},{id:`fs-sandbox`,packageName:`@deepseek-ai/dsh-fs-sandbox`,roleZh:`文件系统沙箱。`,category:`执行 / 权限`},{id:`jobs`,packageName:`@deepseek-ai/dsh-jobs-local`,roleZh:`后台任务注册表(id、归属、轮询、取消)。`,category:`执行 / 权限`},{id:`permission`,packageName:`@deepseek-ai/dsh-permission-presets`,roleZh:`权限预设(只读/读写等档位)。`,category:`执行 / 权限`},{id:`persistent-bash`,packageName:`@deepseek-ai/dsh-tool-bash-persistent`,roleZh:`带 PTY 的持久 Bash 工具(跨调用保持 shell 状态)。`,category:`执行 / 权限`},{id:`persistent-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh-persistent`,roleZh:`带 PTY 的持久 PowerShell 工具。`,category:`执行 / 权限`},{id:`pwsh-sandbox`,packageName:`@deepseek-ai/dsh-pwsh-sandbox`,roleZh:`pwsh 专用沙箱绑定。`,category:`执行 / 权限`},{id:`sandbox`,packageName:`@deepseek-ai/dsh-sandbox-local`,roleZh:`本机沙箱执行环境。`,category:`执行 / 权限`},{id:`sandbox-policy`,packageName:`@deepseek-ai/dsh-sandbox-policy`,roleZh:`沙箱策略(能跑什么、不能跑什么)。`,category:`执行 / 权限`},{id:`subprocess`,packageName:`@deepseek-ai/dsh-subprocess-local`,roleZh:`本机子进程执行器。`,category:`执行 / 权限`},{id:`terminal-bash`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 bash PTY 后端。`,category:`执行 / 权限`},{id:`terminal-pwsh`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 pwsh PTY 后端。`,category:`执行 / 权限`},{id:`ptc-runtime`,packageName:`@deepseek-ai/dsh-ptc-runtime-node`,roleZh:`PTC(工具调用呈现)Node 运行时。`,category:`子代理 / 工作流`},{id:`subagent`,packageName:`@deepseek-ai/dsh-subagent`,roleZh:`子代理能力底座。`,category:`子代理 / 工作流`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`子代理 / 工作流`},{id:`agent`,packageName:`@deepseek-ai/dsh-agent`,roleZh:`Agent 主体:把会话、工具、模型串起来。`,category:`LLM / Agent 核心`},{id:`agent-default-model`,packageName:`@deepseek-ai/dsh-agent-default-model`,roleZh:`解析/提供默认模型配置。`,category:`LLM / Agent 核心`},{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`LLM / Agent 核心`},{id:`deepseek-llm-api-extensions`,packageName:`@deepseek-ai/dsh-deepseek-llm-api-extensions`,roleZh:`给官方 DeepSeek API 适配器登记额外请求字段。`,category:`LLM / Agent 核心`},{id:`llm`,packageName:`@deepseek-ai/dsh-llm`,roleZh:`厂商无关的 LLM 服务接口(发请求、流式、工具调用等)。`,category:`LLM / Agent 核心`},{id:`llm-deepseek`,packageName:`@deepseek-ai/dsh-llm-deepseek-api-key`,roleZh:`DeepSeek API Key 模型适配。`,category:`LLM / Agent 核心`},{id:`llm-pi-ai`,packageName:`@deepseek-ai/dsh-llm-pi-ai`,roleZh:`Pi AI 等 LLM 适配。`,category:`LLM / Agent 核心`},{id:`llm-retry`,packageName:`@deepseek-ai/dsh-llm-retry`,roleZh:`LLM 调用失败重试策略。`,category:`LLM / Agent 核心`},{id:`session-title-llm`,packageName:`@deepseek-ai/dsh-session-title-first-prompt-llm`,roleZh:`用首条用户消息经 LLM 自动起会话标题。`,category:`LLM / Agent 核心`},{id:`subagent-fork-in-process`,packageName:`@deepseek-ai/dsh-subagent-fork-in-process`,roleZh:`进程内 fork 子代理实现。`,category:`LLM / Agent 核心`},{id:`subagent-model-selection-settings`,packageName:`@deepseek-ai/dsh-tool-subagent/model-selection-settings`,roleZh:`子代理可选模型的设置项。`,category:`LLM / Agent 核心`},{id:`subagent-spawn-in-process`,packageName:`@deepseek-ai/dsh-subagent-spawn-in-process`,roleZh:`进程内 spawn 子代理实现。`,category:`LLM / Agent 核心`},{id:`system-prompt`,packageName:`@deepseek-ai/dsh-system-prompt`,roleZh:`系统提示词拼装服务。`,category:`LLM / Agent 核心`},{id:`tools`,packageName:`@deepseek-ai/dsh-tools`,roleZh:`工具注册与执行总闸。`,category:`LLM / Agent 核心`}],x=c();function S(e){return String(e??``).replace(/(\s*dsh[^)]*)/gi,``).replace(/\(\s*dsh[^)]*\)/gi,``).replace(/\bdsh\b/gi,``).replace(/\s{2,}/g,` `).replace(/(\s*)/g,``).trim()}function C({status:e}){let t=e.tone===`ready`?`bg-emerald-50 text-emerald-700 border-emerald-100`:e.tone===`warn`?`bg-amber-50 text-amber-800 border-amber-100`:`bg-stone-100 text-stone-500 border-stone-200`;return(0,x.jsx)(`span`,{className:`shrink-0 rounded border px-1.5 py-0.5 text-[11px] ${t}`,children:e.label})}function Ce({tone:e}){return(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full ${e===`ready`?`bg-emerald-500`:e===`warn`?`bg-amber-500`:`bg-stone-300`}`})}function w({open:e}){return(0,x.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform duration-150 ${e?`rotate-90`:``}`,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,x.jsx)(`path`,{fillRule:`evenodd`,d:`M7.21 14.77a.75.75 0 01.02-1.06L11.17 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z`,clipRule:`evenodd`})})}function we(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,ee]=(0,_.useState)(null),[a,te]=(0,_.useState)(null),[o,ne]=(0,_.useState)(!0),[s,re]=(0,_.useState)(``),[ie,c]=(0,_.useState)({}),[ae,oe]=(0,_.useState)({});function se(e){c(t=>({...t,[e]:!t[e]}))}function ce(e){oe(t=>({...t,[e]:!t[e]}))}(0,_.useEffect)(()=>{let e=!0;return(async()=>{try{let[n,i,a,o]=await Promise.all([h(),m(),g(),ye()]);if(!e)return;t(n),r(i),ee(a),te(o)}finally{e&&ne(!1)}})(),()=>{e=!1}},[]);function l(t){let r=v(t.id);return r===`none`?{label:`规划中`,tone:`plan`}:r===`ready`?{label:`已就绪`,tone:`ready`}:o?{label:`探测中…`,tone:`plan`}:r===`web`?e?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`fs`?n?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`bash`?i?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`pwsh`?a?.ok&&a.available?{label:`已就绪`,tone:`ready`}:a?.ok?{label:`未装 PowerShell`,tone:`warn`}:{label:`需本地服务`,tone:`warn`}:{label:`规划中`,tone:`plan`}}let u=s.trim().toLowerCase(),le=e=>!u||e.id.toLowerCase().includes(u)||S(e.roleZh).toLowerCase().includes(u),ue=y.filter(le),de=b.filter(le),fe=[{id:`session`,title:`会话插件`,hint:`每个会话各自加载,随会话结束释放`,items:ue,total:y.length},{id:`global`,title:`全局插件`,hint:`由系统与所有会话共享,常驻运行`,items:de,total:b.length}];return(0,x.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,x.jsx)(`div`,{className:`shrink-0 px-6 pt-5 pb-3`,children:(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`h3`,{className:`text-[15px] font-semibold text-stone-900`,children:`内置插件`}),(0,x.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-stone-500`,children:`由平台按会话或全局提供,默认常开,不需要开关;状态取决于本机服务是否就绪。`})]}),(0,x.jsxs)(`label`,{className:`relative block w-44 shrink-0`,children:[(0,x.jsxs)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,x.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,x.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),(0,x.jsx)(`input`,{value:s,onChange:e=>re(e.target.value),placeholder:`搜索插件名 / 作用`,className:`h-8 w-full rounded-lg border border-stone-200 bg-white pl-8 pr-2.5 text-xs text-stone-800 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]})]})}),(0,x.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 pb-6`,children:(0,x.jsx)(`div`,{className:`space-y-3`,children:fe.map(e=>{let t=!ie[e.id];return(0,x.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>se(e.id),"aria-expanded":t,className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left transition-colors hover:bg-stone-50/70`,children:[(0,x.jsx)(w,{open:t}),(0,x.jsx)(`h4`,{className:`text-[13px] font-medium text-stone-700`,children:e.title}),(0,x.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:u?`${e.items.length}/${e.total}`:e.total}),(0,x.jsx)(`span`,{className:`ml-auto truncate text-[11px] text-stone-400`,children:e.hint})]}),t?e.items.length?(0,x.jsx)(`div`,{className:`grid grid-cols-2 items-start gap-2 border-t border-stone-100 p-2.5`,children:e.items.map(t=>{let n=l(t),r=`${e.id}:${t.id}`,i=!!ae[r];return(0,x.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":i,onClick:()=>ce(r),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ce(r))},className:`flex cursor-pointer flex-col rounded-lg border p-2.5 text-left transition-colors ${i?`border-[#4176e6]/40 bg-[#f6f9ff]`:`border-stone-200 bg-white hover:border-stone-300 hover:bg-stone-50/60`}`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,x.jsx)(`span`,{className:`mt-1.5`,children:(0,x.jsx)(Ce,{tone:n.tone})}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`p`,{className:`truncate font-mono text-[12.5px] text-stone-800`,children:t.id}),(0,x.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-5 text-stone-500 ${i?``:`line-clamp-2`}`,children:S(t.roleZh)})]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1.5`,children:[(0,x.jsx)(C,{status:n}),(0,x.jsx)(w,{open:i})]})]}),i?(0,x.jsxs)(`dl`,{className:`mt-2 grid w-full grid-cols-[auto_1fr] gap-x-2 gap-y-1 border-t border-stone-200/70 pt-2 text-[11px]`,children:[(0,x.jsx)(`dt`,{className:`shrink-0 text-stone-400`,children:`分类`}),(0,x.jsx)(`dd`,{className:`truncate text-stone-600`,children:t.category}),(0,x.jsx)(`dt`,{className:`shrink-0 text-stone-400`,children:`npm 包`}),(0,x.jsx)(`dd`,{className:`truncate font-mono text-stone-600`,children:t.packageName||`—`})]}):null]},r)})}):(0,x.jsx)(`p`,{className:`border-t border-stone-100 px-3.5 py-4 text-center text-xs text-stone-400`,children:`没有匹配的内置插件`}):null]},e.id)})})})]})}function Te(e){try{return new URL(e).host}catch{return``}}var Ee=[{value:`zh-CN`,label:`中文`},{value:`en`,label:`English`}],T=`w-full px-3 py-2 text-sm border border-stone-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-[#4176e6]/35 focus:border-[#4176e6] transition-colors`,E=`inline-flex items-center gap-1.5 h-9 min-w-30 px-3 rounded-lg bg-stone-100 text-sm text-stone-700 hover:bg-stone-200/80 transition-colors outline-none focus:outline-none`;function De({className:e=`w-4 h-4`}){return(0,x.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,x.jsx)(`path`,{d:`M5 10.5l3.5 3.5L15 6.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Oe({className:e=`w-4 h-4`}){return(0,x.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,x.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,x.jsx)(`path`,{d:`M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4`})]})}function ke({className:e=`w-4 h-4`}){return(0,x.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,x.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,x.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,x.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}function Ae({className:e=`w-4 h-4`}){return(0,x.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,x.jsx)(`path`,{d:`M10 4a2 2 0 0 1 4 0v1h3a1 1 0 0 1 1 1v3h1a2 2 0 0 1 0 4h-1v3a1 1 0 0 1-1 1h-3v1a2 2 0 0 1-4 0v-1H7a1 1 0 0 1-1-1v-3H5a2 2 0 0 1 0-4h1V6a1 1 0 0 1 1-1h3V4z`})})}function je({kind:e}){let t=`w-5 h-5`;return e===`sun`?(0,x.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,x.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,x.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}):e===`moon`?(0,x.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,x.jsx)(`path`,{d:`M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z`})}):(0,x.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,x.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,x.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function D({title:e,description:t,control:n}){return(0,x.jsxs)(`div`,{className:`flex items-center gap-4 py-4 border-b border-stone-100 last:border-b-0`,children:[(0,x.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,x.jsx)(`div`,{className:`text-sm font-medium text-stone-800`,children:e}),t?(0,x.jsx)(`div`,{className:`mt-0.5 text-xs text-stone-400 leading-5`,children:t}):null]}),(0,x.jsx)(`div`,{className:`shrink-0`,children:n})]})}function O({value:e,options:t,onChange:n}){let r=t.find(t=>t.value===e)?.label??e;return(0,x.jsxs)(ne,{value:e,onChange:n,children:[(0,x.jsx)(te,{className:E,children:(0,x.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r})}),(0,x.jsx)(s,{transition:!0,anchor:{to:`bottom end`,gap:6},className:`tw-select-menu tw-menu-anim z-60 min-w-40 rounded-xl py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:t.map(e=>(0,x.jsxs)(o,{value:e.value,className:`group cursor-pointer select-none flex items-center justify-between gap-3 px-3 py-2 text-sm text-stone-700 data-[focus]:bg-stone-50 data-[selected]:text-stone-900`,children:[(0,x.jsx)(`span`,{children:e.label}),(0,x.jsx)(De,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0`})]},e.value))})]})}function k(){let[e,t]=(0,_.useState)(!1),[c,m]=(0,_.useState)(`general`),[h,g]=(0,_.useState)(()=>ee().model.providers),[ye,v]=(0,_.useState)(()=>ee().model.activeId),[y,b]=(0,_.useState)(null),[S,C]=(0,_.useState)(``),[Ce,w]=(0,_.useState)(`DeepSeek`),[E,k]=(0,_.useState)(``),[A,Me]=(0,_.useState)(``),[j,M]=(0,_.useState)(``),[N,Ne]=(0,_.useState)([]),[P,F]=(0,_.useState)(`idle`),[Pe,Fe]=(0,_.useState)(!1),[Ie,Le]=(0,_.useState)(`readonly`),[Re,ze]=(0,_.useState)(!1),[Be,I]=(0,_.useState)(!1),[Ve,He]=(0,_.useState)(null),[L,R]=(0,_.useState)({language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``}),[Ue,z]=(0,_.useState)(`14`),We=(0,_.useRef)(0),[B,Ge]=(0,_.useState)(null),[Ke,qe]=(0,_.useState)(!1),[Je,Ye]=(0,_.useState)(!1),[Xe,V]=(0,_.useState)(!1),[Ze,H]=(0,_.useState)(``),U=(0,_.useRef)(null),Qe=(0,_.useRef)(!1),W=y!==null,G=L.language,K=h.find(e=>e.id===ye),q=(K?.name||``).trim(),J=B?.status??null,$e=J?.phase===`done`&&!!J.to&&J.to===B?.current&&be!==B?.current&&Date.now()-Date.parse(J.finishedAt||``)<864e5,et=J?.phase===`failed`?J.error:``,Y=Xe||J?.phase===`installing`||J?.phase===`restarting`,tt=(J?.to||B?.latest||``).replace(/^v/,``),X=et||Ze,nt=B?.checkedAt&&!Y?new Date(B.checkedAt).toLocaleTimeString():``,rt=Ke?``:Y?J?.phase===`restarting`?p(`settings.updateRestarting`,void 0,G):p(`settings.updateInstalling`,{v:tt},G):X?`${p(`settings.updateFailed`,void 0,G)}:${X}`:$e?p(`settings.updateDone`,{v:J?.to||``},G):B?.mode===`dev`&&B?.hasUpdate?p(`settings.updateDevMode`,void 0,G):B?.error?`${p(`settings.updateUnavailable`,void 0,G)}:${B.error}`:B?.hasUpdate?B.mode===`npx`?p(`settings.updateNpxHint`,void 0,G):``:B?`${p(`settings.updateLatest`,void 0,G)}${nt?` · ${p(`settings.updateCheckedAt`,{time:nt},G)}`:``}`:Je?p(`settings.updateUnavailable`,void 0,G):``,it=q||(G===`en`?`No model`:`未配置`),at=q?K?.model?.trim()?`${q} · ${K.model.trim()}`:q:G===`en`?`No model configured`:`未配置模型`;function ot(e=`general`){m(e),r().then(()=>{st(),t(!0)})}function st(){ze(n()),g(u()),v(l()),I(!!d()),R(he()),me(he()),Le(pe()),b(null)}function Z(){U.current!==null&&(window.clearInterval(U.current),U.current=null)}async function ct(e=!0){qe(!0);try{let t=await Se(e);t&&(Ge(t),H(``))}finally{qe(!1),Ye(!0)}}function lt(e){Z();let t=Date.now()+18e4;U.current=window.setInterval(async()=>{if(!Qe.current){Qe.current=!0;try{let n=await Se(!0);if(n){Ge(n);let t=n.status;if(t?.phase===`failed`){Z(),V(!1),H(t.error||p(`settings.updateFailed`,void 0,G));return}if(t?.phase===`done`||e&&n.current!==e){Z(),V(!1);return}}Date.now()>t&&(Z(),V(!1),H(p(`settings.updateTimeout`,void 0,G)))}finally{Qe.current=!1}}},1500)}async function ut(){let e=B?.latest||``;H(``),V(!0);let t=B?.current||be,n=await xe(e||void 0);n.ok?lt(t):(V(!1),H(n.error||p(`settings.updateFailed`,void 0,G)))}function dt(e){if(!e){let e=a();b(e),C(`DeepSeek`),w(`DeepSeek`),k(`https://api.deepseek.com/v1`),Me(``),M(``),Ne([]),F(`idle`),Fe(!1);return}b(e.id),C(e.name),k(e.baseURL);let t=e.apiKey?.trim()||(e.id===l()?i().trim():``)||``;Me(t),M(e.model),Ne(e.availableModels??[]),F(e.availableModels?.length?`ok`:`idle`),w(f.find(t=>t.baseURL===e.baseURL)?.label??`自定义`),Fe(!1)}(0,_.useEffect)(()=>{r().then(()=>st());let e=e=>{let n=e.detail;m(n?.tab===`model`?`model`:n?.tab===`builtin`?`builtin`:`general`),r().then(()=>{st(),t(!0)})};window.addEventListener(ge,e);let n=le(e=>R(e)),i=_e(e=>Le(e));return()=>{window.removeEventListener(ge,e),n(),i()}},[]),(0,_.useEffect)(()=>{if(e)return(async()=>{let e=await Se(!1);if(Ye(!0),!e)return;Ge(e);let t=e.status;(t?.phase===`installing`||t?.phase===`restarting`)&&(V(!0),lt(t.from||e.current))})(),Z},[e]),(0,_.useEffect)(()=>{if(!e||c!==`model`||!W)return;let t=E.trim(),n=A.trim();if(!t||!n){F(e=>e===`ok`?`ok`:`idle`);return}F(`loading`);let r=++We.current,i=setTimeout(()=>{se(t,n).then(e=>{r===We.current&&(Ne(e),F(`ok`))}).catch(()=>{r===We.current&&F(`fail`)})},800);return()=>clearTimeout(i)},[e,c,W,E,A]);function ft(e){w(e);let t=f.find(t=>t.label===e);t&&(t.baseURL&&k(t.baseURL),(!S.trim()||f.some(e=>e.label===S))&&C(t.label)),M(``)}function Q(e){R(ue(e))}(0,_.useEffect)(()=>{z(String(L.sessionFontSize))},[L.sessionFontSize]);function pt(){let e=Number(Ue);if(!Ue.trim()||!Number.isFinite(e)){z(String(L.sessionFontSize));return}let t=ue({sessionFontSize:Math.round(e)});R(t),z(String(t.sessionFontSize))}let mt=!!(S.trim()&&E.trim()&&A.trim()&&j.trim()),$=N.length>0;function ht(){if(!mt||!y)return;let e=!h.some(e=>e.id===y),t=ve({id:y,name:S.trim(),baseURL:E.trim(),apiKey:A.trim(),model:j.trim(),availableModels:$?N:void 0},{activate:!0});g(t),v(y),b(null),I(!!d()),oe(e?`已新增模型服务`:`已保存模型服务`,`success`)}function gt(e){He(e)}function _t(){let e=Ve;if(!e)return;let t=h.find(t=>t.id===e)?.name??`该服务`;He(null);let n=fe(e);g(n),v(l()),y===e&&b(null),I(!!d()),oe(`已删除模型服务「${t}」`,`success`)}function vt(e){ce(e),v(e),I(!!d())}let yt=[{value:`readonly`,label:p(`settings.access.readonly`,void 0,G)},{value:`readwrite`,label:p(`settings.access.readwrite`,void 0,G)},{value:`full`,label:p(`settings.access.full`,void 0,G)}],bt=[{value:`concise`,label:p(`settings.step.concise`,void 0,G)},{value:`standard`,label:p(`settings.step.standard`,void 0,G)},{value:`detailed`,label:p(`settings.step.detailed`,void 0,G)},{value:`full`,label:p(`settings.step.full`,void 0,G)}],xt=[{value:`queue`,label:p(`settings.busySend.queue`,void 0,G)},{value:`interrupt`,label:p(`settings.busySend.interrupt`,void 0,G)}],St=[{value:`light`,label:p(`settings.appear.light`,void 0,G),icon:`sun`},{value:`dark`,label:p(`settings.appear.dark`,void 0,G),icon:`moon`},{value:`system`,label:p(`settings.appear.system`,void 0,G),icon:`monitor`}],Ct=[{id:`general`,label:p(`settings.general`,void 0,G),icon:(0,x.jsx)(Oe,{})},{id:`model`,label:p(`settings.model`,void 0,G),icon:(0,x.jsx)(ke,{})},{id:`builtin`,label:p(`settings.builtin`,void 0,G),icon:(0,x.jsx)(Ae,{})}],wt=c===`general`||c===`builtin`?p(c===`general`?`settings.general`:`settings.builtin`,void 0,G):W?h.some(e=>e.id===y)?p(`settings.editProvider`,void 0,G):p(`settings.addProviderTitle`,void 0,G):p(`settings.model`,void 0,G);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`tw-nav-foot-row`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>ot(`general`),className:`tw-nav-settings-btn`,"data-hint":Be?`设置(已配置模型)`:`设置`,children:[(0,x.jsxs)(`svg`,{className:`tw-nav-ico w-4.5 h-4.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":`true`,children:[(0,x.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,x.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z`})]}),(0,x.jsx)(`span`,{"data-i18n":`nav.settings`,children:p(`nav.settings`,void 0,G)})]}),(0,x.jsxs)(`button`,{type:`button`,className:`tw-nav-provider-chip${q?``:` is-empty`}`,"data-hint":at,onClick:()=>ot(`model`),children:[(0,x.jsx)(`span`,{className:`tw-nav-provider-dot`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`tw-nav-provider-name`,children:it})]})]}),(0,x.jsx)(re,{show:e,children:(0,x.jsxs)(`div`,{className:`fixed inset-0 z-110 flex items-center justify-center p-4`,children:[(0,x.jsx)(ie,{children:(0,x.jsx)(`div`,{className:`tw-dialog-backdrop-anim absolute inset-0 bg-stone-950/45`,onClick:()=>t(!1),"aria-hidden":`true`})}),(0,x.jsx)(ie,{children:(0,x.jsxs)(`div`,{className:`tw-settings-dialog tw-dialog-panel-anim relative bg-white rounded-2xl shadow-2xl w-full max-w-3xl h-[min(92vh,720px)] overflow-hidden flex flex-col`,children:[(0,x.jsxs)(`div`,{className:`shrink-0 h-12 px-4 flex items-center justify-between border-b border-stone-100 bg-white`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-stone-800 truncate pr-3`,children:wt}),(0,x.jsx)(`button`,{type:`button`,"aria-label":p(`settings.close`,void 0,G),onClick:()=>t(!1),className:`w-8 h-8 inline-flex items-center justify-center rounded-lg text-stone-400 hover:text-stone-700 hover:bg-stone-100 transition-colors`,children:(0,x.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,x.jsx)(`path`,{d:`M5 5l10 10M15 5L5 15`,strokeLinecap:`round`})})})]}),(0,x.jsxs)(`div`,{className:`flex-1 min-h-0 flex`,children:[(0,x.jsx)(`aside`,{className:`w-38 shrink-0 border-r border-stone-100 bg-[#f4f5f7] py-3 px-2 space-y-0.5`,children:Ct.map(e=>{let t=c===e.id;return(0,x.jsxs)(`button`,{type:`button`,onClick:()=>{m(e.id),e.id===`model`&&b(null)},className:`w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-sm transition-colors ${t?`bg-[#e8f0fe] text-[#4176e6] font-medium`:`text-stone-600 hover:bg-white/70 hover:text-stone-800`}`,children:[(0,x.jsx)(`span`,{className:t?`text-[#4176e6]`:`text-stone-400`,children:e.icon}),e.label]},e.id)})}),(0,x.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0 bg-white`,children:c===`general`?(0,x.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-1`,children:[(0,x.jsx)(D,{title:p(`settings.access`,void 0,G),description:p(`settings.accessDesc`,void 0,G),control:(0,x.jsx)(O,{value:Ie,options:yt,onChange:e=>{Le(e),de(e)}})}),(0,x.jsx)(D,{title:p(`settings.language`,void 0,G),control:(0,x.jsx)(O,{value:L.language,options:Ee,onChange:e=>Q({language:e})})}),(0,x.jsxs)(`div`,{className:`py-4 border-b border-stone-100`,children:[(0,x.jsx)(`div`,{className:`text-sm font-medium text-stone-800 mb-3`,children:p(`settings.appearance`,void 0,G)}),(0,x.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5`,children:St.map(e=>{let t=L.appearance===e.value;return(0,x.jsxs)(`button`,{type:`button`,onClick:()=>Q({appearance:e.value}),className:`flex flex-col items-center justify-center gap-2 h-19 rounded-xl border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] text-[#4176e6] ring-1 ring-[#4176e6]/30`:`border-stone-200 text-stone-500 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,x.jsx)(je,{kind:e.icon}),(0,x.jsx)(`span`,{className:`text-xs font-medium`,children:e.label})]},e.value)})})]}),(0,x.jsx)(D,{title:p(`settings.fontSize`,void 0,G),description:p(`settings.fontSizeDesc`,void 0,G),control:(0,x.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,x.jsx)(`input`,{type:`number`,min:12,max:22,value:Ue,onChange:e=>z(e.target.value),onBlur:pt,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 h-9 px-2 text-sm text-center rounded-lg bg-stone-100 border-0 outline-none focus:ring-2 focus:ring-[#4176e6]/30`}),(0,x.jsx)(`span`,{className:`text-sm text-stone-400`,children:`px`})]})}),(0,x.jsx)(D,{title:p(`settings.toolSteps`,void 0,G),description:p(`settings.toolStepsDesc`,void 0,G),control:(0,x.jsx)(O,{value:L.toolStepDetail,options:bt,onChange:e=>Q({toolStepDetail:e})})}),(0,x.jsx)(D,{title:p(`settings.busySend`,void 0,G),description:p(`settings.busySendDesc`,void 0,G),control:(0,x.jsx)(O,{value:L.busySendBehavior,options:xt,onChange:e=>Q({busySendBehavior:e})})}),(0,x.jsx)(D,{title:p(`settings.subagentModel`,void 0,G),description:p(`settings.subagentModelDesc`,void 0,G),control:(0,x.jsx)(O,{value:L.subagentModel?.trim()?L.subagentModel:`inherit`,options:[{value:`inherit`,label:p(`settings.subagentModel.inherit`,void 0,G)},...Array.from(new Set([...K?.availableModels??[],...K?.model?[K.model]:[]])).filter(Boolean).map(e=>({value:e,label:e}))],onChange:e=>Q({subagentModel:e===`inherit`?``:e})})})]}),(0,x.jsxs)(`div`,{className:`shrink-0 px-6 py-3 border-t border-stone-100`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0 flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`text-sm text-stone-700 whitespace-nowrap`,children:p(`settings.platformVersion`,void 0,G)}),(0,x.jsxs)(`span`,{className:`text-sm tabular-nums text-stone-500`,children:[`v`,be]}),B?.hasUpdate&&!Y&&!$e?(0,x.jsx)(`span`,{className:`inline-flex items-center h-[18px] px-1.5 rounded-full bg-[#edf3fe] text-[11px] font-medium text-[#4176e6] tabular-nums whitespace-nowrap`,children:`${p(`settings.updateAvailable`,void 0,G)} v${(B.latest||``).replace(/^v/,``)}`}):null]}),(0,x.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:Y?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 h-8 px-3 rounded-lg text-xs text-stone-500 bg-stone-100 whitespace-nowrap`,children:[(0,x.jsx)(`span`,{className:`w-3 h-3 rounded-full border-2 border-stone-300 border-t-[#4176e6] animate-spin`}),p(`settings.updateWorking`,void 0,G)]}):$e?(0,x.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`h-8 px-3 rounded-lg text-xs font-medium text-[#4176e6] bg-[#edf3fe] hover:bg-[#e2ecfd] whitespace-nowrap`,children:p(`settings.updateReload`,void 0,G)}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,disabled:Ke,onClick:()=>void ct(!0),className:`inline-flex items-center justify-center min-w-[76px] h-8 px-3 rounded-lg text-xs font-medium text-stone-600 bg-stone-100 hover:bg-stone-200 disabled:opacity-70 disabled:cursor-default whitespace-nowrap`,children:Ke?(0,x.jsxs)(x.Fragment,{children:[p(`settings.updateChecking`,void 0,G),(0,x.jsxs)(`span`,{className:`tw-dots`,"aria-hidden":`true`,children:[(0,x.jsx)(`i`,{}),(0,x.jsx)(`i`,{}),(0,x.jsx)(`i`,{})]})]}):p(`settings.updateCheck`,void 0,G)}),B?.hasUpdate?(0,x.jsx)(`button`,{type:`button`,disabled:B.mode===`dev`,onClick:()=>void ut(),className:`h-8 px-3 rounded-lg text-xs font-semibold text-white bg-[#4176e6] hover:bg-[#3566d6] disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:p(`settings.updateNow`,void 0,G)}):null]})})]}),rt?(0,x.jsx)(`div`,{className:`mt-1 text-[11px] leading-relaxed ${X?`text-red-500`:`text-stone-400`}`,children:rt}):null,X&&B?.logPath?(0,x.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-relaxed text-stone-400 break-all`,children:p(`settings.updateLog`,{path:B.logPath},G)}):null]})]}):W?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`shrink-0 px-5 pt-3 pb-2 flex items-center gap-2 border-b border-stone-100`,children:(0,x.jsx)(`button`,{type:`button`,onClick:()=>b(null),className:`text-sm text-stone-500 hover:text-stone-800`,children:p(`settings.back`,void 0,G)})}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:p(`settings.displayName`,void 0,G)}),(0,x.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:`DeepSeek`,className:T})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:p(`settings.preset`,void 0,G)}),(0,x.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:f.map(e=>{let t=Ce===e.label;return(0,x.jsxs)(`button`,{type:`button`,onClick:()=>ft(e.label),className:`text-left px-3 py-2 rounded-lg border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] ring-1 ring-[#4176e6]/30`:`border-stone-200 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,x.jsx)(`div`,{className:`text-sm ${t?`text-[#3565c7] font-medium`:`text-stone-700`}`,children:e.label}),(0,x.jsx)(`div`,{className:`text-[11px] text-stone-400 truncate`,children:e.baseURL?Te(e.baseURL):`OpenAI compatible`})]},e.label)})})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:p(`settings.baseUrl`,void 0,G)}),(0,x.jsx)(`input`,{type:`text`,value:E,onChange:e=>k(e.target.value),placeholder:`https://api.deepseek.com/v1`,className:T})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:p(`settings.apiKey`,void 0,G)}),(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`input`,{type:Pe?`text`:`password`,value:A,onChange:e=>Me(e.target.value),placeholder:`sk-...`,className:`${T} pr-14`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>Fe(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-stone-400 hover:text-stone-600 px-1.5 py-1`,children:Pe?G===`en`?`Hide`:`隐藏`:G===`en`?`Show`:`显示`})]}),Re?(0,x.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:p(`settings.keyHint`,void 0,G)}):null]}),(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,x.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:p(`settings.modelField`,void 0,G)}),P===`loading`&&(0,x.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:p(`settings.recognizing`,void 0,G)}),$&&P===`ok`&&(0,x.jsx)(`span`,{className:`text-[11px] text-emerald-600`,children:p(`settings.recognized`,{n:N.length},G)}),P===`fail`&&!$&&(0,x.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:p(`settings.recognizeFail`,void 0,G)}),P===`fail`&&$&&(0,x.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:p(`settings.recognizeKeep`,void 0,G)})]}),$?(0,x.jsxs)(ne,{value:j,onChange:M,children:[(0,x.jsx)(te,{className:`${T} flex items-center justify-start text-left hover:border-stone-400 cursor-pointer`,children:(0,x.jsx)(`span`,{className:`min-w-0 truncate text-stone-800`,children:j||(G===`en`?`Select a model`:`请选择模型`)})}),(0,x.jsx)(s,{transition:!0,anchor:{to:`bottom start`,gap:6},className:`tw-select-menu tw-menu-anim z-60 w-(--button-width) max-h-60 overflow-auto rounded-lg py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:N.map(e=>(0,x.jsxs)(o,{value:e,className:`group cursor-pointer select-none flex items-center justify-between px-3 py-2 text-sm text-stone-700 data-[focus]:bg-[#edf3fe] data-[selected]:text-[#3565c7] data-[selected]:font-medium`,children:[(0,x.jsx)(`span`,{className:`truncate`,children:e}),(0,x.jsx)(De,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0 ml-2`})]},e))})]}):(0,x.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:p(`settings.modelPlaceholder`,void 0,G),className:T})]})]}),(0,x.jsxs)(`div`,{className:`shrink-0 px-5 py-3.5 bg-stone-50 border-t border-stone-100 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>b(null),className:`px-3.5 py-1.5 text-sm text-stone-600 hover:bg-stone-200/60 rounded-lg`,children:p(`settings.cancel`,void 0,G)}),(0,x.jsx)(`button`,{type:`button`,onClick:ht,disabled:!mt,className:`px-3.5 py-1.5 text-sm font-medium text-white bg-[#4176e6] hover:bg-[#3565c7] rounded-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:p(`settings.save`,void 0,G)})]})]}):c===`builtin`?(0,x.jsx)(we,{}):(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5 bg-[#f4f5f7]`,children:[(0,x.jsx)(`p`,{className:`text-sm text-stone-500`,children:p(`settings.modelIntro`,void 0,G)}),(0,x.jsxs)(`div`,{className:`mt-5 space-y-2.5`,children:[h.map(e=>{let t=!!(e.apiKey?.trim()&&e.baseURL.trim()&&e.model.trim()),n=e.id===ye;return(0,x.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-stone-200/90 bg-white px-4 py-3.5 shadow-[0_1px_0_rgba(15,23,42,0.02)]`,children:[(0,x.jsxs)(`button`,{type:`button`,"data-hint":n?G===`en`?`Active`:`当前使用`:G===`en`?`Set active`:`设为当前`,onClick:()=>vt(e.id),className:`flex-1 min-w-0 flex items-center gap-2 text-left`,children:[(0,x.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:e.name}),t?(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-emerald-500`}):null]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>dt(e),className:`h-8 px-3 text-sm text-stone-700 rounded-lg border border-stone-200 bg-white hover:bg-stone-50`,children:p(`settings.edit`,void 0,G)}),h.length>1?(0,x.jsx)(`button`,{type:`button`,onClick:()=>gt(e.id),className:`h-8 px-3 text-sm text-red-600 rounded-lg hover:bg-red-50`,children:p(`settings.delete`,void 0,G)}):null]})]},e.id)}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>dt(null),className:`w-full h-12 rounded-xl border border-dashed border-stone-300 bg-white/60 text-sm text-stone-600 hover:border-[#4176e6] hover:text-[#4176e6] hover:bg-[#edf3fe]/50 transition-colors`,children:p(`settings.addProvider`,void 0,G)})]})]})})]})]})})]})}),(0,x.jsx)(ae,{open:Ve!=null,title:p(`settings.delete`,void 0,G),message:p(`settings.deleteConfirm`,void 0,G),confirmLabel:p(`settings.delete`,void 0,G),cancelLabel:G===`en`?`Cancel`:`取消`,danger:!0,onClose:()=>He(null),onConfirm:_t})]})}export{k as default};
@@ -1,4 +1,4 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{i as r,o as i,r as a,t as o}from"./view-prefs.D1snIG5o.js";import{i as s,n as c,r as l,t as u}from"./dialog.DZHZCe_T.js";import{i as ee,n as d,r as te,t as f}from"./menu.Dnrpz489.js";import{t as ne}from"./jsx-runtime.DUg_B_vD.js";import{t as re}from"./ConfirmDialog.CsMwWevK.js";import{t as p}from"./OverflowHint.pvo2Xc8R.js";import{t as ie}from"./SelectDropdown.apWlFGbA.js";import{showToast as ae}from"./Toast.BO2NFckG.js";import{c as oe}from"./project-docs.DAw9bzgk.js";import{s as se}from"./llm.BuR7z55C.js";import{u as ce}from"./prompts-meta.C_MeYq8G.js";import{f as le,l as ue,p as de}from"./settings.B1yetppp.js";import{n as fe,t as pe}from"./PromptMountDialog.YH2odDZx.js";import{a as me,n as m,r as h,t as he}from"./ui-auto-prompt.l_EXfDs5.js";import{S as ge,_ as _e,a as ve,b as g,c as ye,d as be,f as xe,h as Se,i as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,t as Ae,u as _,v,x as je,y as Me}from"./ui-auto.BmC9JJ_X.js";import{t as Ne}from"./hydrate-cache.CmC22o_H.js";import{S as y,d as Pe,g as b,k as Fe,l as Ie,m as Le}from"./PmShared.BrBicDMN.js";var x=e(t(),1),Re=`${Ee}/agent`;async function S(e,t){let n=await fetch(`${Re}${e}`,{...t,headers:{"Content-Type":`application/json`,...t?.headers??{}}}),r=await n.text(),i=null;try{i=r?JSON.parse(r):null}catch{i=null}if(!n.ok){let e=(i&&typeof i==`object`&&`error`in i?String(i.error):``)||r.slice(0,300)||`请求失败(${n.status})`;throw Error(e)}return i??{}}async function ze(e){return S(`/prepare`,{method:`POST`,body:JSON.stringify(e)})}async function Be(e,t){return S(`/open`,{method:`POST`,body:JSON.stringify({sessionId:e,url:t})})}async function C(e,t={}){return S(`/snapshot`,{method:`POST`,body:JSON.stringify({sessionId:e,...t})})}async function w(e,t){return S(`/action`,{method:`POST`,body:JSON.stringify({sessionId:e,...t})})}async function T(e,t={}){return S(`/wait`,{method:`POST`,body:JSON.stringify({sessionId:e,...t})})}async function Ve(e){return S(`/console`,{method:`POST`,body:JSON.stringify({sessionId:e})})}async function He(e){return S(`/network`,{method:`POST`,body:JSON.stringify({sessionId:e})})}async function Ue(e,t,n){return S(`/probe`,{method:`POST`,body:JSON.stringify({sessionId:e,ref:t,stepId:n})})}async function We(e,t){return S(`/screenshot`,{method:`POST`,body:JSON.stringify({sessionId:e,label:t})})}async function Ge(e){await S(`/close`,{method:`POST`,body:JSON.stringify({sessionId:e})})}async function E(e){return S(`/save`,{method:`POST`,body:JSON.stringify(e)})}async function Ke(e,t,n={}){return S(`/emit`,{method:`POST`,body:JSON.stringify({ir:e,target:t,...n})})}async function D(e,t,n){return S(`/verify`,{method:`POST`,body:JSON.stringify({sessionId:e,ir:t,target:n,timeoutMs:18e4})})}async function qe(e){return S(`/write`,{method:`POST`,body:JSON.stringify(e)})}async function Je(e){return S(`/sessions?projectId=${encodeURIComponent(e)}`)}async function O(e){return S(`/session?id=${encodeURIComponent(e)}`)}async function Ye(e,t){return S(`/debug`,{method:`POST`,body:JSON.stringify({sessionId:e,mode:t})})}async function Xe(e){return S(`/debug/stop`,{method:`POST`,body:JSON.stringify({sessionId:e})})}async function Ze(e){return S(`/changes?sessionId=${encodeURIComponent(e)}`)}async function Qe(e){return S(`/reveal`,{method:`POST`,body:JSON.stringify(e)})}var k=null;async function $e(e=!1){return(!k||e)&&(k=S(`/apps`).then(e=>({apps:e.apps??[],defaultId:e.defaultId??``})).catch(e=>{throw k=null,e})),k}async function et(e,t){return S(`/run-file`,{method:`POST`,body:JSON.stringify({sessionId:e,path:t,timeoutMs:18e4})})}async function tt(e){return S(`/draft/clean`,{method:`POST`,body:JSON.stringify({sessionId:e})})}var A={type:`string`,description:`快照里的 ref,例如 d1-e12。页面导航后会失效。`},nt={type:`function`,function:{name:`ui_plan_steps`,description:`提交整份步骤计划(人可读的动作 + 目标描述,不含定位器)。这一步只做测试设计,不会打开浏览器。`,parameters:{type:`object`,properties:{title:{type:`string`,description:`用例标题,中文即可`},steps:{type:`array`,description:`按执行顺序排列的计划步骤`,items:{type:`object`,properties:{action:{type:`string`,enum:[`goto`,`click`,`fill`,`select`,`press`,`hover`,`expect`,`expectUrl`,`wait`],description:`测试动作;不要写「截图」——截图是探索时给人看的,不是测试步骤`},target:{type:`string`,description:`给人看的目标描述,例如「右上角的登录按钮」「用户名输入框」`},value:{type:`string`,description:"输入内容 / 选项;账号密码等占位数据写成 ${ENV_NAME}"},url:{type:`string`,description:`goto / expectUrl 的地址,相对路径即可`},note:{type:`string`,description:`补充说明,例如断言什么结果`}},required:[`action`,`target`]}}},required:[`steps`]}}},rt=[nt],it=[nt,{type:`function`,function:{name:`ui_browser_open`,description:`在浏览器里打开一个地址(相对地址会用 baseURL 拼接),返回页面快照。`,parameters:{type:`object`,properties:{url:{type:`string`,description:`绝对地址或 / 开头的相对地址`}},required:[`url`]}}},{type:`function`,function:{name:`ui_browser_snapshot`,description:`重新获取当前页面快照。页面变化较大、或 ref 不确定时用。`,parameters:{type:`object`,properties:{depth:{type:`number`,description:`快照深度,默认 6,越大越啰嗦`},targetRef:{type:`string`,description:`只看某个元素的子树`}}}}},{type:`function`,function:{name:`ui_browser_click`,description:`点击一个元素。成功后会自动返回新快照。`,parameters:{type:`object`,properties:{ref:A,note:{type:`string`,description:`这一步在做什么`}},required:[`ref`]}}},{type:`function`,function:{name:`ui_browser_fill`,description:`填写输入框(会先清空已有内容)。`,parameters:{type:`object`,properties:{ref:A,text:{type:`string`,description:"要填入的内容;占位数据用 ${ENV_NAME} 表示环境变量"},note:{type:`string`}},required:[`ref`,`text`]}}},{type:`function`,function:{name:`ui_browser_select`,description:`选择下拉框选项(按 value 或可见文本)。`,parameters:{type:`object`,properties:{ref:A,value:{type:`string`},note:{type:`string`}},required:[`ref`,`value`]}}},{type:`function`,function:{name:`ui_browser_press`,description:`按一个键,例如 Enter / Tab / Escape。`,parameters:{type:`object`,properties:{key:{type:`string`},ref:{type:`string`}},required:[`key`]}}},{type:`function`,function:{name:`ui_browser_hover`,description:`悬停到元素上(用于展开菜单)。`,parameters:{type:`object`,properties:{ref:A,note:{type:`string`}},required:[`ref`]}}},{type:`function`,function:{name:`ui_browser_back`,description:`浏览器后退一步。`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`ui_browser_wait`,description:`等待:给 text 时等到页面出现该文案(比死等毫秒可靠),否则等待指定毫秒。返回等待后的快照。`,parameters:{type:`object`,properties:{text:{type:`string`,description:`要等待出现的可见文案`},ms:{type:`number`,description:`没有 text 时等待的毫秒数`},timeout:{type:`number`,description:`等待 text 的超时毫秒数,默认 15000`}}}}},{type:`function`,function:{name:`ui_browser_screenshot`,description:`截一张当前页面图,给用户看(模型看不到图片内容)。`,parameters:{type:`object`,properties:{label:{type:`string`,description:`截图标签,例如 after-login`}}}}},{type:`function`,function:{name:`ui_browser_console`,description:`读取浏览器控制台里的 error / warning / pageerror(排查偶发失败用)。`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`ui_browser_network`,description:`读取最近的失败请求(状态码 ≥ 400 或请求失败),用来判断是不是接口挂了。`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`ui_locator_probe`,description:`把一个 ref 转成可写进脚本的定位器,并校验唯一性。写步骤之前,对每个要操作的元素都调用一次。`,parameters:{type:`object`,properties:{ref:A,stepId:{type:`string`,description:`可选:左侧计划里的步骤 id(如 p2)。传了会把定位器回填到该步骤。`}},required:[`ref`]}}},{type:`function`,function:{name:`ui_test_set_steps`,description:`提交 / 替换整份测试步骤(IR)。每次提交都会刷新右侧代码预览。先探索、再提交,不要凭想象写定位器。`,parameters:{type:`object`,properties:{title:{type:`string`,description:`用例标题,中文即可`},steps:{type:`array`,description:`按执行顺序排列的步骤`,items:{type:`object`,properties:{action:{type:`string`,enum:[`goto`,`click`,`fill`,`select`,`press`,`hover`,`expect`,`expectUrl`,`wait`,`screenshot`]},locator:{type:`object`,description:`定位器。首选 ui_locator_probe 给出的 recommended,不要自己拼长 CSS`,properties:{kind:{type:`string`,enum:[`testid`,`role`,`label`,`placeholder`,`text`,`attr`,`css`]},role:{type:`string`},name:{type:`string`},value:{type:`string`},attr:{type:`string`},exact:{type:`boolean`},nth:{type:`number`,description:`同名元素有多个时取第几个(0 = 第一个)。用 ui_locator_probe 返回的 nth,不要自己猜`}},required:[`kind`]},url:{type:`string`},value:{type:`string`,description:`输入内容 / 选项值 / 截图名`},key:{type:`string`},text:{type:`string`,description:`expect 时要断言的文本`},state:{type:`string`,enum:[`visible`,`hidden`]},ms:{type:`number`},note:{type:`string`},planStepId:{type:`string`,description:`可选:对应左侧计划步骤 id,便于逐条勾掉计划`}},required:[`action`]}}},required:[`steps`]}}},{type:`function`,function:{name:`ui_test_get_steps`,description:`读取当前已提交的步骤,改之前先看一眼。`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`ui_test_verify`,description:`在临时目录试跑当前步骤对应的脚本,返回是否通过和日志尾部。`,parameters:{type:`object`,properties:{}}}}],at=`浏览器已被关闭,这一轮探索已结束`;function ot(e){if(!e||!e.includes(`error`))return!1;let t;try{t=JSON.parse(e)}catch{return!1}if(!t||typeof t!=`object`)return!1;let n=String(t.error??``);return n.includes(`浏览器已被关闭`)||n.includes(`浏览器进程已退出`)||n.includes(`Target page, context or browser has been closed`)}var j=(e,t)=>e.length>t?`${e.slice(0,t)}…(已截断)`:e;async function st(e,t,n){let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({error:`工具参数不是合法 JSON`})}let i=n.sessionId,a=e=>typeof r[e]==`string`?String(r[e]):``;try{if(e===`ui_plan_steps`){let e=Array.isArray(r.steps)?r.steps:[];if(!e.length){let e=await O(i).then(e=>e.session.plan??[]).catch(()=>[]);return JSON.stringify({ok:!0,stepCount:e.length,plan:e.map(e=>({id:e.id,action:e.action,target:e.target})),note:`没有提交新步骤,计划保持不变。`})}let t=(await E({sessionId:i,title:a(`title`)||void 0,plan:e,mergePlan:!0})).session.plan??[];return n.onPlan?.(t),JSON.stringify({ok:!0,stepCount:t.length,plan:t.map(e=>({id:e.id,action:e.action,target:e.target})),note:`计划已保存,用户可以在左侧调整。接下来开始探索:逐个 probe 并回填定位器。`})}if(e===`ui_browser_open`){let e=await Be(i,a(`url`));return JSON.stringify({url:e.url,title:e.title,elements:e.count,truncated:e.truncated,snapshot:j(e.snapshot,12e3)})}if(e===`ui_browser_snapshot`){let e=await C(i,{depth:Number(r.depth)||void 0,targetRef:a(`targetRef`)||void 0});return JSON.stringify({url:e.url,title:e.title,elements:e.count,truncated:e.truncated,snapshot:j(e.snapshot,12e3)})}if(e===`ui_browser_click`||e===`ui_browser_fill`||e===`ui_browser_select`||e===`ui_browser_hover`){let t=await w(i,{action:e.replace(`ui_browser_`,``),ref:a(`ref`),text:a(`text`),value:a(`value`),note:a(`note`)});return JSON.stringify({ok:!0,action:t.action,url:t.url,snapshot:j(t.snapshot,9e3)})}if(e===`ui_browser_press`){let e=await w(i,{action:`press`,ref:a(`ref`),key:a(`key`)});return JSON.stringify({ok:!0,url:e.url,snapshot:j(e.snapshot,9e3)})}if(e===`ui_browser_back`){let e=await w(i,{action:`back`});return JSON.stringify({ok:!0,url:e.url,snapshot:j(e.snapshot,9e3)})}if(e===`ui_browser_wait`){let e=await T(i,{text:a(`text`)||void 0,ms:Number(r.ms)||void 0,timeout:Number(r.timeout)||void 0});return JSON.stringify({ok:!0,action:e.action,url:e.url,snapshot:j(e.snapshot,9e3)})}if(e===`ui_browser_screenshot`){let e=await We(i,a(`label`)||`snapshot`);return n.onShot?.(e.url),JSON.stringify({ok:!0,url:e.url,note:`截图已显示在面板里;你看不到图片内容,需要判断结构请用快照。`})}if(e===`ui_browser_console`){let e=(await Ve(i)).messages??[];return JSON.stringify(e.length?{count:e.length,messages:e.slice(-20)}:{count:0})}if(e===`ui_browser_network`){let e=(await He(i)).requests??[];return JSON.stringify(e.length?{count:e.length,requests:e.slice(-20)}:{count:0})}if(e===`ui_locator_probe`){let e=a(`ref`);if(!e)return JSON.stringify({error:`缺少 ref`});let t=a(`stepId`),r=await Ue(i,e,t||void 0);return t&&r.plan&&n.onPlan?.(r.plan),JSON.stringify({ref:r.ref,element:r.element,confidence:r.confidence,recommended:r.recommended,fragile:!!r.fragile,warning:r.warning??``,candidates:r.candidates.slice(0,3),boundStep:r.planStep?{id:r.planStep.id,status:r.planStep.status}:void 0,note:r.confidence===`high`?`定位器唯一且指向同一元素,可以写进步骤`:r.recommended?`能用但不稳:${r.warning||`同名元素较多`}。照抄 recommended(含 nth),并补一条结果断言`:`没有唯一候选:换一个更具体的元素,或改成对结果文案的 expect`})}if(e===`ui_test_set_steps`){let e=Array.isArray(r.steps)?r.steps:[],t={title:a(`title`)||`未命名流程`,target:n.target,steps:e},o=await E({sessionId:i,title:t.title,ir:t}),s=o.session.ir??t,c=t.steps.length-s.steps.length;return n.onIr?.(s),n.onCode?.(o.code,o.suggestedPath),JSON.stringify({ok:!0,title:s.title,stepCount:s.steps.length,previewPath:o.suggestedPath,note:c?`步骤已保存,但有 ${c} 步被丢掉(动作不支持或没带 locator)。用 ui_test_get_steps 核对后重新提交;不要自己试跑,试跑由用户确认代码后手动发起。`:`步骤已保存,右侧代码预览已刷新。不要自己试跑:试跑由用户确认代码后手动发起。`})}if(e===`ui_test_get_steps`){let e=await O(i);return JSON.stringify({title:e.session.ir?.title??``,steps:e.session.ir?.steps??[],suggestedPath:e.suggestedPath})}if(e===`ui_test_verify`){let e=await D(i),t=String(e.log??``);return typeof e.code==`string`&&n.onCode?.(e.code,e.suggestedPath??``),JSON.stringify({passed:!!e.passed,exitCode:e.exitCode??null,timedOut:!!e.timedOut,durationMs:e.durationMs??0,draftPath:e.draftPath??``,tracePath:e.tracePath??``,log:j(t.slice(-4e3),4e3),note:e.passed?`试跑通过。草稿留在 .lantern-ai 里,用户可以直接看 trace / 用 Playwright UI 调试,确认后再写入项目。`:`试跑失败:只改步骤 IR(定位器 / 等待 / 断言)。草稿和 trace 会保留,用户能打开看现场;如果是功能本身不符合预期,不要为了跑绿改断言。`})}return JSON.stringify({error:`未知工具:${e}`})}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}function ct(e){return e?.length?e.map((e,t)=>{let n=[`${t+1}. [${e.id}] ${e.action}`];return e.target&&n.push(`目标:${e.target}`),e.url&&n.push(`url=${e.url}`),e.value&&n.push(`值=${e.value}`),e.locator&&n.push(`已绑定 ${M(e.locator)}`),n.join(` · `)}).join(`
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{i as r,o as i,r as a,t as o}from"./view-prefs.D1snIG5o.js";import{i as s,n as c,r as l,t as u}from"./dialog.DZHZCe_T.js";import{i as ee,n as d,r as te,t as f}from"./menu.Dnrpz489.js";import{t as ne}from"./jsx-runtime.DUg_B_vD.js";import{t as re}from"./ConfirmDialog.CsMwWevK.js";import{t as p}from"./OverflowHint.pvo2Xc8R.js";import{t as ie}from"./SelectDropdown.apWlFGbA.js";import{showToast as ae}from"./Toast.BO2NFckG.js";import{c as oe}from"./project-docs.DAw9bzgk.js";import{s as se}from"./llm.BuR7z55C.js";import{u as ce}from"./prompts-meta.C_MeYq8G.js";import{f as le,l as ue,p as de}from"./settings.B1yetppp.js";import{n as fe,t as pe}from"./PromptMountDialog.CpTT6L0a.js";import{a as me,n as m,r as h,t as he}from"./ui-auto-prompt.l_EXfDs5.js";import{S as ge,_ as _e,a as ve,b as g,c as ye,d as be,f as xe,h as Se,i as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,t as Ae,u as _,v,x as je,y as Me}from"./ui-auto.BmC9JJ_X.js";import{t as Ne}from"./hydrate-cache.CmC22o_H.js";import{S as y,d as Pe,g as b,k as Fe,l as Ie,m as Le}from"./PmShared.BrBicDMN.js";var x=e(t(),1),Re=`${Ee}/agent`;async function S(e,t){let n=await fetch(`${Re}${e}`,{...t,headers:{"Content-Type":`application/json`,...t?.headers??{}}}),r=await n.text(),i=null;try{i=r?JSON.parse(r):null}catch{i=null}if(!n.ok){let e=(i&&typeof i==`object`&&`error`in i?String(i.error):``)||r.slice(0,300)||`请求失败(${n.status})`;throw Error(e)}return i??{}}async function ze(e){return S(`/prepare`,{method:`POST`,body:JSON.stringify(e)})}async function Be(e,t){return S(`/open`,{method:`POST`,body:JSON.stringify({sessionId:e,url:t})})}async function C(e,t={}){return S(`/snapshot`,{method:`POST`,body:JSON.stringify({sessionId:e,...t})})}async function w(e,t){return S(`/action`,{method:`POST`,body:JSON.stringify({sessionId:e,...t})})}async function T(e,t={}){return S(`/wait`,{method:`POST`,body:JSON.stringify({sessionId:e,...t})})}async function Ve(e){return S(`/console`,{method:`POST`,body:JSON.stringify({sessionId:e})})}async function He(e){return S(`/network`,{method:`POST`,body:JSON.stringify({sessionId:e})})}async function Ue(e,t,n){return S(`/probe`,{method:`POST`,body:JSON.stringify({sessionId:e,ref:t,stepId:n})})}async function We(e,t){return S(`/screenshot`,{method:`POST`,body:JSON.stringify({sessionId:e,label:t})})}async function Ge(e){await S(`/close`,{method:`POST`,body:JSON.stringify({sessionId:e})})}async function E(e){return S(`/save`,{method:`POST`,body:JSON.stringify(e)})}async function Ke(e,t,n={}){return S(`/emit`,{method:`POST`,body:JSON.stringify({ir:e,target:t,...n})})}async function D(e,t,n){return S(`/verify`,{method:`POST`,body:JSON.stringify({sessionId:e,ir:t,target:n,timeoutMs:18e4})})}async function qe(e){return S(`/write`,{method:`POST`,body:JSON.stringify(e)})}async function Je(e){return S(`/sessions?projectId=${encodeURIComponent(e)}`)}async function O(e){return S(`/session?id=${encodeURIComponent(e)}`)}async function Ye(e,t){return S(`/debug`,{method:`POST`,body:JSON.stringify({sessionId:e,mode:t})})}async function Xe(e){return S(`/debug/stop`,{method:`POST`,body:JSON.stringify({sessionId:e})})}async function Ze(e){return S(`/changes?sessionId=${encodeURIComponent(e)}`)}async function Qe(e){return S(`/reveal`,{method:`POST`,body:JSON.stringify(e)})}var k=null;async function $e(e=!1){return(!k||e)&&(k=S(`/apps`).then(e=>({apps:e.apps??[],defaultId:e.defaultId??``})).catch(e=>{throw k=null,e})),k}async function et(e,t){return S(`/run-file`,{method:`POST`,body:JSON.stringify({sessionId:e,path:t,timeoutMs:18e4})})}async function tt(e){return S(`/draft/clean`,{method:`POST`,body:JSON.stringify({sessionId:e})})}var A={type:`string`,description:`快照里的 ref,例如 d1-e12。页面导航后会失效。`},nt={type:`function`,function:{name:`ui_plan_steps`,description:`提交整份步骤计划(人可读的动作 + 目标描述,不含定位器)。这一步只做测试设计,不会打开浏览器。`,parameters:{type:`object`,properties:{title:{type:`string`,description:`用例标题,中文即可`},steps:{type:`array`,description:`按执行顺序排列的计划步骤`,items:{type:`object`,properties:{action:{type:`string`,enum:[`goto`,`click`,`fill`,`select`,`press`,`hover`,`expect`,`expectUrl`,`wait`],description:`测试动作;不要写「截图」——截图是探索时给人看的,不是测试步骤`},target:{type:`string`,description:`给人看的目标描述,例如「右上角的登录按钮」「用户名输入框」`},value:{type:`string`,description:"输入内容 / 选项;账号密码等占位数据写成 ${ENV_NAME}"},url:{type:`string`,description:`goto / expectUrl 的地址,相对路径即可`},note:{type:`string`,description:`补充说明,例如断言什么结果`}},required:[`action`,`target`]}}},required:[`steps`]}}},rt=[nt],it=[nt,{type:`function`,function:{name:`ui_browser_open`,description:`在浏览器里打开一个地址(相对地址会用 baseURL 拼接),返回页面快照。`,parameters:{type:`object`,properties:{url:{type:`string`,description:`绝对地址或 / 开头的相对地址`}},required:[`url`]}}},{type:`function`,function:{name:`ui_browser_snapshot`,description:`重新获取当前页面快照。页面变化较大、或 ref 不确定时用。`,parameters:{type:`object`,properties:{depth:{type:`number`,description:`快照深度,默认 6,越大越啰嗦`},targetRef:{type:`string`,description:`只看某个元素的子树`}}}}},{type:`function`,function:{name:`ui_browser_click`,description:`点击一个元素。成功后会自动返回新快照。`,parameters:{type:`object`,properties:{ref:A,note:{type:`string`,description:`这一步在做什么`}},required:[`ref`]}}},{type:`function`,function:{name:`ui_browser_fill`,description:`填写输入框(会先清空已有内容)。`,parameters:{type:`object`,properties:{ref:A,text:{type:`string`,description:"要填入的内容;占位数据用 ${ENV_NAME} 表示环境变量"},note:{type:`string`}},required:[`ref`,`text`]}}},{type:`function`,function:{name:`ui_browser_select`,description:`选择下拉框选项(按 value 或可见文本)。`,parameters:{type:`object`,properties:{ref:A,value:{type:`string`},note:{type:`string`}},required:[`ref`,`value`]}}},{type:`function`,function:{name:`ui_browser_press`,description:`按一个键,例如 Enter / Tab / Escape。`,parameters:{type:`object`,properties:{key:{type:`string`},ref:{type:`string`}},required:[`key`]}}},{type:`function`,function:{name:`ui_browser_hover`,description:`悬停到元素上(用于展开菜单)。`,parameters:{type:`object`,properties:{ref:A,note:{type:`string`}},required:[`ref`]}}},{type:`function`,function:{name:`ui_browser_back`,description:`浏览器后退一步。`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`ui_browser_wait`,description:`等待:给 text 时等到页面出现该文案(比死等毫秒可靠),否则等待指定毫秒。返回等待后的快照。`,parameters:{type:`object`,properties:{text:{type:`string`,description:`要等待出现的可见文案`},ms:{type:`number`,description:`没有 text 时等待的毫秒数`},timeout:{type:`number`,description:`等待 text 的超时毫秒数,默认 15000`}}}}},{type:`function`,function:{name:`ui_browser_screenshot`,description:`截一张当前页面图,给用户看(模型看不到图片内容)。`,parameters:{type:`object`,properties:{label:{type:`string`,description:`截图标签,例如 after-login`}}}}},{type:`function`,function:{name:`ui_browser_console`,description:`读取浏览器控制台里的 error / warning / pageerror(排查偶发失败用)。`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`ui_browser_network`,description:`读取最近的失败请求(状态码 ≥ 400 或请求失败),用来判断是不是接口挂了。`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`ui_locator_probe`,description:`把一个 ref 转成可写进脚本的定位器,并校验唯一性。写步骤之前,对每个要操作的元素都调用一次。`,parameters:{type:`object`,properties:{ref:A,stepId:{type:`string`,description:`可选:左侧计划里的步骤 id(如 p2)。传了会把定位器回填到该步骤。`}},required:[`ref`]}}},{type:`function`,function:{name:`ui_test_set_steps`,description:`提交 / 替换整份测试步骤(IR)。每次提交都会刷新右侧代码预览。先探索、再提交,不要凭想象写定位器。`,parameters:{type:`object`,properties:{title:{type:`string`,description:`用例标题,中文即可`},steps:{type:`array`,description:`按执行顺序排列的步骤`,items:{type:`object`,properties:{action:{type:`string`,enum:[`goto`,`click`,`fill`,`select`,`press`,`hover`,`expect`,`expectUrl`,`wait`,`screenshot`]},locator:{type:`object`,description:`定位器。首选 ui_locator_probe 给出的 recommended,不要自己拼长 CSS`,properties:{kind:{type:`string`,enum:[`testid`,`role`,`label`,`placeholder`,`text`,`attr`,`css`]},role:{type:`string`},name:{type:`string`},value:{type:`string`},attr:{type:`string`},exact:{type:`boolean`},nth:{type:`number`,description:`同名元素有多个时取第几个(0 = 第一个)。用 ui_locator_probe 返回的 nth,不要自己猜`}},required:[`kind`]},url:{type:`string`},value:{type:`string`,description:`输入内容 / 选项值 / 截图名`},key:{type:`string`},text:{type:`string`,description:`expect 时要断言的文本`},state:{type:`string`,enum:[`visible`,`hidden`]},ms:{type:`number`},note:{type:`string`},planStepId:{type:`string`,description:`可选:对应左侧计划步骤 id,便于逐条勾掉计划`}},required:[`action`]}}},required:[`steps`]}}},{type:`function`,function:{name:`ui_test_get_steps`,description:`读取当前已提交的步骤,改之前先看一眼。`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`ui_test_verify`,description:`在临时目录试跑当前步骤对应的脚本,返回是否通过和日志尾部。`,parameters:{type:`object`,properties:{}}}}],at=`浏览器已被关闭,这一轮探索已结束`;function ot(e){if(!e||!e.includes(`error`))return!1;let t;try{t=JSON.parse(e)}catch{return!1}if(!t||typeof t!=`object`)return!1;let n=String(t.error??``);return n.includes(`浏览器已被关闭`)||n.includes(`浏览器进程已退出`)||n.includes(`Target page, context or browser has been closed`)}var j=(e,t)=>e.length>t?`${e.slice(0,t)}…(已截断)`:e;async function st(e,t,n){let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({error:`工具参数不是合法 JSON`})}let i=n.sessionId,a=e=>typeof r[e]==`string`?String(r[e]):``;try{if(e===`ui_plan_steps`){let e=Array.isArray(r.steps)?r.steps:[];if(!e.length){let e=await O(i).then(e=>e.session.plan??[]).catch(()=>[]);return JSON.stringify({ok:!0,stepCount:e.length,plan:e.map(e=>({id:e.id,action:e.action,target:e.target})),note:`没有提交新步骤,计划保持不变。`})}let t=(await E({sessionId:i,title:a(`title`)||void 0,plan:e,mergePlan:!0})).session.plan??[];return n.onPlan?.(t),JSON.stringify({ok:!0,stepCount:t.length,plan:t.map(e=>({id:e.id,action:e.action,target:e.target})),note:`计划已保存,用户可以在左侧调整。接下来开始探索:逐个 probe 并回填定位器。`})}if(e===`ui_browser_open`){let e=await Be(i,a(`url`));return JSON.stringify({url:e.url,title:e.title,elements:e.count,truncated:e.truncated,snapshot:j(e.snapshot,12e3)})}if(e===`ui_browser_snapshot`){let e=await C(i,{depth:Number(r.depth)||void 0,targetRef:a(`targetRef`)||void 0});return JSON.stringify({url:e.url,title:e.title,elements:e.count,truncated:e.truncated,snapshot:j(e.snapshot,12e3)})}if(e===`ui_browser_click`||e===`ui_browser_fill`||e===`ui_browser_select`||e===`ui_browser_hover`){let t=await w(i,{action:e.replace(`ui_browser_`,``),ref:a(`ref`),text:a(`text`),value:a(`value`),note:a(`note`)});return JSON.stringify({ok:!0,action:t.action,url:t.url,snapshot:j(t.snapshot,9e3)})}if(e===`ui_browser_press`){let e=await w(i,{action:`press`,ref:a(`ref`),key:a(`key`)});return JSON.stringify({ok:!0,url:e.url,snapshot:j(e.snapshot,9e3)})}if(e===`ui_browser_back`){let e=await w(i,{action:`back`});return JSON.stringify({ok:!0,url:e.url,snapshot:j(e.snapshot,9e3)})}if(e===`ui_browser_wait`){let e=await T(i,{text:a(`text`)||void 0,ms:Number(r.ms)||void 0,timeout:Number(r.timeout)||void 0});return JSON.stringify({ok:!0,action:e.action,url:e.url,snapshot:j(e.snapshot,9e3)})}if(e===`ui_browser_screenshot`){let e=await We(i,a(`label`)||`snapshot`);return n.onShot?.(e.url),JSON.stringify({ok:!0,url:e.url,note:`截图已显示在面板里;你看不到图片内容,需要判断结构请用快照。`})}if(e===`ui_browser_console`){let e=(await Ve(i)).messages??[];return JSON.stringify(e.length?{count:e.length,messages:e.slice(-20)}:{count:0})}if(e===`ui_browser_network`){let e=(await He(i)).requests??[];return JSON.stringify(e.length?{count:e.length,requests:e.slice(-20)}:{count:0})}if(e===`ui_locator_probe`){let e=a(`ref`);if(!e)return JSON.stringify({error:`缺少 ref`});let t=a(`stepId`),r=await Ue(i,e,t||void 0);return t&&r.plan&&n.onPlan?.(r.plan),JSON.stringify({ref:r.ref,element:r.element,confidence:r.confidence,recommended:r.recommended,fragile:!!r.fragile,warning:r.warning??``,candidates:r.candidates.slice(0,3),boundStep:r.planStep?{id:r.planStep.id,status:r.planStep.status}:void 0,note:r.confidence===`high`?`定位器唯一且指向同一元素,可以写进步骤`:r.recommended?`能用但不稳:${r.warning||`同名元素较多`}。照抄 recommended(含 nth),并补一条结果断言`:`没有唯一候选:换一个更具体的元素,或改成对结果文案的 expect`})}if(e===`ui_test_set_steps`){let e=Array.isArray(r.steps)?r.steps:[],t={title:a(`title`)||`未命名流程`,target:n.target,steps:e},o=await E({sessionId:i,title:t.title,ir:t}),s=o.session.ir??t,c=t.steps.length-s.steps.length;return n.onIr?.(s),n.onCode?.(o.code,o.suggestedPath),JSON.stringify({ok:!0,title:s.title,stepCount:s.steps.length,previewPath:o.suggestedPath,note:c?`步骤已保存,但有 ${c} 步被丢掉(动作不支持或没带 locator)。用 ui_test_get_steps 核对后重新提交;不要自己试跑,试跑由用户确认代码后手动发起。`:`步骤已保存,右侧代码预览已刷新。不要自己试跑:试跑由用户确认代码后手动发起。`})}if(e===`ui_test_get_steps`){let e=await O(i);return JSON.stringify({title:e.session.ir?.title??``,steps:e.session.ir?.steps??[],suggestedPath:e.suggestedPath})}if(e===`ui_test_verify`){let e=await D(i),t=String(e.log??``);return typeof e.code==`string`&&n.onCode?.(e.code,e.suggestedPath??``),JSON.stringify({passed:!!e.passed,exitCode:e.exitCode??null,timedOut:!!e.timedOut,durationMs:e.durationMs??0,draftPath:e.draftPath??``,tracePath:e.tracePath??``,log:j(t.slice(-4e3),4e3),note:e.passed?`试跑通过。草稿留在 .lantern-ai 里,用户可以直接看 trace / 用 Playwright UI 调试,确认后再写入项目。`:`试跑失败:只改步骤 IR(定位器 / 等待 / 断言)。草稿和 trace 会保留,用户能打开看现场;如果是功能本身不符合预期,不要为了跑绿改断言。`})}return JSON.stringify({error:`未知工具:${e}`})}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}function ct(e){return e?.length?e.map((e,t)=>{let n=[`${t+1}. [${e.id}] ${e.action}`];return e.target&&n.push(`目标:${e.target}`),e.url&&n.push(`url=${e.url}`),e.value&&n.push(`值=${e.value}`),e.locator&&n.push(`已绑定 ${M(e.locator)}`),n.join(` · `)}).join(`
2
2
  `):``}function M(e){if(!e)return``;let t=Number.isInteger(e.nth)?` nth=${e.nth}`:``;return e.kind===`role`?`role=${e.role??``}${e.name?` name="${e.name}"`:``}${t}`:e.kind===`attr`?`[${e.attr}="${e.value??``}"]${t}`:e.kind===`testid`?`testid=${e.value??``}${t}`:`${e.kind}="${e.value??e.name??``}"${t}`}function lt(e){return e===`python`?`Python + pytest + playwright.sync_api`:`TypeScript + @playwright/test`}function ut(e,t){return e.replaceAll(`{{project}}`,t.project).replaceAll(`{{dir}}`,t.dir).replaceAll(`{{language}}`,t.language).replaceAll(`{{plan}}`,t.plan)}function dt(e,t,n,r,i){let a=ct(n);if(r?.trim()){let n=ut(r.trim(),{project:e.name,dir:e.dir,language:lt(t),plan:a||`如果还没有计划:先调用 ui_plan_steps 列出计划,再开始探索。`}),o=String(i??``).trim();return o?`${n}\n\n${o}`:n}return[`你是 UI 自动化测试工程师:用浏览器把流程点一遍,确认元素能唯一定位,再提交步骤。`,`项目:${e.name}(${e.dir}),目标语言:${lt(t)}。`,`ref 导航后失效要重新 snapshot;每个元素先用 ui_locator_probe 拿唯一定位器,再用 ui_test_set_steps 提交。`,"探索阶段不要自己试跑;至少一条 expect 断言用户可见的结果;账号等占位值写成 ${ENV_NAME}。",a?`\n${a}`:``,`最后用中文简短汇报。`].filter(Boolean).join(`
3
3
  `)}function ft(e,t,n){return n?.trim()?ut(n.trim(),{project:e.name,dir:e.dir,language:lt(t),plan:``}):[`你是测试设计师:只把需求拆成「动作 + 目标描述」的步骤计划,不打开浏览器、不写定位器。`,`项目:${e.name}(${e.dir}),目标语言:${lt(t)}。`,`只调用一次 ui_plan_steps;4~12 步,覆盖打开页面、前置、核心操作与至少一条结果断言。`,"账号密码等写成 ${ENV_NAME}。"].join(`
4
4
  `)}function pt(e,t,n){return[`需求 / 流程:`,e.trim(),``,t?`起始地址(baseURL):${t}`:`起始地址:从需求里判断,用相对路径。`,`目标语言:${n===`python`?`Python (pytest)`:`TypeScript`}`,``,`请给出步骤计划。`].join(`
@@ -0,0 +1 @@
1
+ var e=`0.1.23`;export{e as t};
@@ -0,0 +1 @@
1
+ function e(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function t(e){if(!e)return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return`—`}}export{t as n,e as t};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/jszip.min.Bh2Mgo40.js","_astro/react.Blvh0GOs.js"])))=>i.map(i=>d[i]);
2
- import{s as e}from"./react.Blvh0GOs.js";import{T as t,r as n,s as r,t as i}from"./req-analysis.dhgy4p2f.js";import{y as a}from"./settings.B1yetppp.js";import{t as o}from"./app-version.5UudQEyk.js";function s(e){return t(e)}var c=`/__tb_testpoints`,l=`测试点生成提示词.md`,u=[`functional`,`boundary`,`exception`,`business`,`nonfunctional`],d=[`P0`,`P1`,`P2`,`P3`],f={functional:{label:`功能`,hint:`主流程 / 替代流程 / 每个功能点`,tone:`blue`,accent:`bg-[#3370ff]`},boundary:{label:`边界值`,hint:`为空 / 上下限 / 刚好越界`,tone:`purple`,accent:`bg-[#7b5bd6]`},exception:{label:`异常`,hint:`失败路径 / 非法输入 / 并发`,tone:`red`,accent:`bg-[#e5484d]`},business:{label:`业务规则`,hint:`状态流转 / 权限 / 唯一性`,tone:`amber`,accent:`bg-[#d9820b]`},nonfunctional:{label:`非功能`,hint:`性能 / 安全 / 兼容 / 时区`,tone:`green`,accent:`bg-[#2f9e44]`}},p={P0:{label:`P0`,tone:`red`,markerId:`priority-1`},P1:{label:`P1`,tone:`amber`,markerId:`priority-2`},P2:{label:`P2`,tone:`blue`,markerId:`priority-3`},P3:{label:`P3`,tone:`gray`,markerId:`priority-4`}},m=Object.fromEntries(u.map(e=>[e,f[e].label]));async function h(e,t){let n=await fetch(`${c}${e}`,{...t,headers:t?.body===void 0?void 0:{"Content-Type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok||r.ok===!1)throw Error(r.error||`HTTP ${n.status}`);return r}async function g(){try{let e=await h(`/prompt`);return{file:l,exists:e.exists===!0,generate:e.generate??``}}catch(e){return{file:l,exists:!1,generate:``,error:e instanceof Error?e.message:String(e)}}}async function _(e){return h(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var v={P0:0,P1:1,P2:2,P3:3};function y(e){let t=e?.points??[],n={P0:0,P1:0,P2:0,P3:0};for(let e of t)e.priority in n&&(n[e.priority]+=1);return{total:t.length,byPriority:n,coveredDimensions:u.filter(e=>t.some(t=>t.dimension===e)).length}}function b(e){return[...e].sort((e,t)=>u.indexOf(e.dimension)-u.indexOf(t.dimension)||v[e.priority]-v[t.priority]||e.title.localeCompare(t.title,`zh`))}function x(e,t=[]){if(!e.length)return``;let n=S(e,t),r=[],i=`\0`;for(let e of n){let t=e.storyId||``;t!==i&&(i=t,r.push(t?`#### ${t}`:`#### 全局测试点`)),r.push(`- **[${e.priority}]** ${e.title}(${e.id})`),e.storyId&&r.push(` - 来源故事:${e.storyId}`),r.push(` - 维度:${f[e.dimension].label}`),e.precondition&&r.push(` - 前置:${e.precondition}`),e.steps.length&&r.push(` - 步骤:${e.steps.join(`;`)}`),e.expected&&r.push(` - 预期:${e.expected}`)}return r.join(`
2
+ import{s as e}from"./react.Blvh0GOs.js";import{T as t,r as n,s as r,t as i}from"./req-analysis.dhgy4p2f.js";import{y as a}from"./settings.B1yetppp.js";import{t as o}from"./app-version.yT2l6J8H.js";function s(e){return t(e)}var c=`/__tb_testpoints`,l=`测试点生成提示词.md`,u=[`functional`,`boundary`,`exception`,`business`,`nonfunctional`],d=[`P0`,`P1`,`P2`,`P3`],f={functional:{label:`功能`,hint:`主流程 / 替代流程 / 每个功能点`,tone:`blue`,accent:`bg-[#3370ff]`},boundary:{label:`边界值`,hint:`为空 / 上下限 / 刚好越界`,tone:`purple`,accent:`bg-[#7b5bd6]`},exception:{label:`异常`,hint:`失败路径 / 非法输入 / 并发`,tone:`red`,accent:`bg-[#e5484d]`},business:{label:`业务规则`,hint:`状态流转 / 权限 / 唯一性`,tone:`amber`,accent:`bg-[#d9820b]`},nonfunctional:{label:`非功能`,hint:`性能 / 安全 / 兼容 / 时区`,tone:`green`,accent:`bg-[#2f9e44]`}},p={P0:{label:`P0`,tone:`red`,markerId:`priority-1`},P1:{label:`P1`,tone:`amber`,markerId:`priority-2`},P2:{label:`P2`,tone:`blue`,markerId:`priority-3`},P3:{label:`P3`,tone:`gray`,markerId:`priority-4`}},m=Object.fromEntries(u.map(e=>[e,f[e].label]));async function h(e,t){let n=await fetch(`${c}${e}`,{...t,headers:t?.body===void 0?void 0:{"Content-Type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok||r.ok===!1)throw Error(r.error||`HTTP ${n.status}`);return r}async function g(){try{let e=await h(`/prompt`);return{file:l,exists:e.exists===!0,generate:e.generate??``}}catch(e){return{file:l,exists:!1,generate:``,error:e instanceof Error?e.message:String(e)}}}async function _(e){return h(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var v={P0:0,P1:1,P2:2,P3:3};function y(e){let t=e?.points??[],n={P0:0,P1:0,P2:0,P3:0};for(let e of t)e.priority in n&&(n[e.priority]+=1);return{total:t.length,byPriority:n,coveredDimensions:u.filter(e=>t.some(t=>t.dimension===e)).length}}function b(e){return[...e].sort((e,t)=>u.indexOf(e.dimension)-u.indexOf(t.dimension)||v[e.priority]-v[t.priority]||e.title.localeCompare(t.title,`zh`))}function x(e,t=[]){if(!e.length)return``;let n=S(e,t),r=[],i=`\0`;for(let e of n){let t=e.storyId||``;t!==i&&(i=t,r.push(t?`#### ${t}`:`#### 全局测试点`)),r.push(`- **[${e.priority}]** ${e.title}(${e.id})`),e.storyId&&r.push(` - 来源故事:${e.storyId}`),r.push(` - 维度:${f[e.dimension].label}`),e.precondition&&r.push(` - 前置:${e.precondition}`),e.steps.length&&r.push(` - 步骤:${e.steps.join(`;`)}`),e.expected&&r.push(` - 预期:${e.expected}`)}return r.join(`
3
3
  `)}function S(e,t=[]){if(!e.length)return[];if(!t.length)return[...e];let n=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({point:e,index:t})).sort((e,r)=>(e.point.storyId?n.get(e.point.storyId)??t.length+1:t.length)-(r.point.storyId?n.get(r.point.storyId)??t.length+1:t.length)||e.index-r.index).map(e=>e.point)}function C(e){return(e||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}function w(e){let t=[];return e.precondition&&t.push(`前置条件:${e.precondition}`),e.steps.length&&(t.push(`步骤:`),e.steps.forEach((e,n)=>t.push(`${n+1}. ${e}`))),e.expected&&t.push(`预期:${e.expected}`),t.join(`
4
4
  `)}function T(e,t){let n=2166136261;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=Math.imul(n,16777619);let r=(n>>>0).toString(36),i=t.replace(/[^A-Za-z0-9_-]/g,``).slice(0,24);return i?`${e}-${i}-${r}`:`${e}-${r}`}function E(e){return{id:T(`tp`,e.id),title:`[${e.priority}] ${e.title}`,labels:[f[e.dimension].label],markers:[{markerId:p[e.priority].markerId}],notes:{plain:{content:w(e)}}}}var D=[{re:/ai\s*拆解|推送ai|回写拆解/i,title:`ai拆解`},{re:/ai自动同步|知识信息列表.*开关|知识信息管理/i,title:`知识信息管理`},{re:/信息审核|审核倒计时|出具审核结论|待审核信息/i,title:`政企通信息审核`},{re:/信息确认|确认无误|待确认信息/i,title:`政企通信息确认`},{re:/开通确认|确认开通/i,title:`政企通开通确认`},{re:/信息管理列表|承办单位修改|查看详情|政企通路径|关联信息标题/i,title:`政企通信息管理`},{re:/页面管理|页面树|节点|前台预览|本级节点布局|暂存|发给承办|信息列表|展示类型/i,title:`政企通页面管理`},{re:/菜单|子菜单|文案本地化|时间展示/i,title:`政企通`}];function O(e,t){return t.find(t=>t===e)||t.find(t=>e.length>=t.length&&e.includes(t))||t.find(t=>t.length>e.length&&t.includes(e))||null}function k(e,t,n){if(!n.length)return e.title||e.id;let r=e.title||``,i=`${r} ${e.sourceRefs.map(e=>t.get(e)||e).join(` `)}`,a=[...n].sort((e,t)=>t.length-e.length||e.localeCompare(t,`zh`));for(let e of D){if(!e.re.test(i))continue;let t=O(e.title,a);if(t)return t}for(let e of a)if(e&&r.includes(e))return e;for(let e of a)if(e&&i.includes(e))return e;return e.title||e.id}function A(e){let t=b(e);return u.map(e=>({key:e,label:f[e].label,hint:f[e].hint,points:t.filter(t=>t.dimension===e)}))}function j(e,t=[]){let n=e.testPoints?.points??[];if(!n.length)return[];let r=new Map(e.outline.map(e=>[e.id,e.title])),i=new Map(e.stories.map(e=>[e.id,e])),a=t.filter(Boolean),o=new Map,s=e=>{let t=o.get(e);return t||(t={title:e,storyIds:new Set,points:[]},o.set(e,t)),t};for(let e of a)s(e);for(let e of n){let t=e.storyId?i.get(e.storyId):void 0,n;n=t&&a.length?k(t,r,a):t?t.title||t.id:`全局测试点`;let o=s(n);o.points.push(e),e.storyId&&o.storyIds.add(e.storyId)}let c=[...a,...[...o.keys()].filter(e=>!a.includes(e)&&e!==`全局测试点`),...o.has(`全局测试点`)?[`全局测试点`]:[]],l=new Set,u=[];for(let e of c){if(l.has(e))continue;l.add(e);let t=o.get(e);t&&(t.points.length||a.includes(e))&&u.push({key:e,title:e,storyIds:[...t.storyIds],points:b(t.points),dimensions:A(t.points)})}return u}var M=`org.xmind.ui.logic.right`;function N(e,t){return t.map(t=>({id:T(`dim`,`${e}:${t.key}`),title:`${t.label}(${t.points.length})`,notes:{plain:{content:`${f[t.key].hint}\n测试点 ${t.points.length} 条`}},children:{attached:t.points.map(E)}}))}function P(e){return{id:T(`req`,e.key),title:`${e.title}(${e.points.length})`,notes:{plain:{content:[e.storyIds.length?`来源故事:${e.storyIds.join(`、`)}`:``,`测试点 ${e.points.length} 条`].filter(Boolean).join(`
5
5
  `)}},children:{attached:N(e.key,e.dimensions)}}}function F(e,t=[]){let n=e.testPoints,r=j(e,t).filter(e=>e.points.length>0),i=s(e);if(!r.length)return[{id:`sheet-1`,class:`sheet`,title:i,rootTopic:{id:`root-topic`,title:`${i}(0)`,structureClass:M,notes:{plain:{content:n?.summary||`还没有测试点。`}},children:{attached:u.map(e=>({id:T(`dim`,e),title:`${f[e].label}(0)`,notes:{plain:{content:`${f[e].hint}\n测试点 0 条`}},children:{attached:[]}}))}}}];if(r.length===1){let e=r[0];return[{id:`sheet-1`,class:`sheet`,title:e.title,rootTopic:{id:T(`root`,e.key),title:`${e.title}(${e.points.length})`,structureClass:M,notes:{plain:{content:[n?.summary||``,e.storyIds.length?`来源故事:${e.storyIds.join(`、`)}`:``,`测试点 ${e.points.length} 条`].filter(Boolean).join(`
@@ -3,7 +3,7 @@
3
3
  try {
4
4
  if ('scrollRestoration' in history) history.scrollRestoration = 'manual';
5
5
  } catch (e) {}
6
- </script><script type="module" src="/_astro/Base.astro_astro_type_script_index_0_lang.BQtZbum2.js"></script><meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback" content="animate"><script type="module" src="/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CO1cjG9V.js"></script><script>
6
+ </script><script type="module" src="/_astro/Base.astro_astro_type_script_index_0_lang.CWRCetQl.js"></script><meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback" content="animate"><script type="module" src="/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CO1cjG9V.js"></script><script>
7
7
  (function () {
8
8
  try {
9
9
  // 配置按空间分键(`tw.app.config.v1::<spaceId>`),主题必须从同一个键读,
@@ -98,7 +98,7 @@
98
98
  }
99
99
  } catch (e) {}
100
100
  })();
101
- </script><link rel="stylesheet" href="/_astro/Base.I--fR8aT.css"><script type="module" src="/_astro/page.Bx2KSkeL.js"></script><style>[data-astro-transition-scope="astro-bbhp3f5g-3"] { view-transition-name: astro-bbhp3f5g-3; }@layer astro { ::view-transition-old(astro-bbhp3f5g-3) {
101
+ </script><link rel="stylesheet" href="/_astro/Base.GThhapKd.css"><script type="module" src="/_astro/page.Bx2KSkeL.js"></script><style>[data-astro-transition-scope="astro-bbhp3f5g-3"] { view-transition-name: astro-bbhp3f5g-3; }@layer astro { ::view-transition-old(astro-bbhp3f5g-3) {
102
102
  animation-duration: 180ms;
103
103
  animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
104
104
  animation-fill-mode: both;
@@ -134,7 +134,7 @@
134
134
  animation-duration: 180ms;
135
135
  animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
136
136
  animation-fill-mode: both;
137
- animation-name: astroFadeIn; }</style></head><body class="tw-body antialiased"><div class="tw-shell min-h-screen"><aside class="tw-nav-aside fixed inset-y-0 left-0 flex flex-col z-45" id="tw-nav-aside"><div class="tw-nav-brand"><div class="tw-nav-brand-row"><a href="/" class="tw-nav-brand-link min-w-0 flex-1" data-astro-reload><span class="tw-nav-brand-mark" aria-hidden="true"><img class="tw-nav-brand-mark-img" src="/brand/brand-mark.png" alt="" width="36" height="36"></span><span class="tw-nav-brand-text"><span class="tw-nav-brand-title-row"><span class="tw-nav-brand-title" data-i18n="nav.brand">Lantern Harness</span><span class="tw-nav-brand-ver" data-hint="平台版本 v0.1.22">v0.1.22<span class="tw-nav-brand-dot" id="tw-update-dot" role="button" tabindex="-1" aria-label="有新版本可更新" hidden></span></span></span></span></a></div></div><div class="tw-nav-space-slot"><div class="tw-nav-space tw-nav-space-ph" id="tw-nav-space-ph" aria-hidden="true"><div class="tw-nav-space-ph-box"><span class="tw-nav-space-ph-ico"></span><span class="tw-nav-space-ph-lines"><span class="tw-nav-space-ph-bar is-cap"></span><span class="tw-nav-space-ph-bar is-name"></span></span></div></div><style>astro-island,astro-slot,astro-static-slot{display:contents}</style><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).only=e,window.dispatchEvent(new Event(`astro:only`))})();</script><script>(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);{let e={0:e=>a(e),1:e=>n(e),2:e=>new RegExp(e),3:e=>new Date(e),4:e=>new Map(n(e)),5:e=>new Set(n(e)),6:e=>BigInt(e),7:e=>new URL(e),8:e=>new Uint8Array(e),9:e=>new Uint16Array(e),10:e=>new Uint32Array(e),11:e=>1/0*e},t=t=>{let[n,r]=t;return n in e?e[n](r):void 0},n=e=>e.map(t),a=e=>typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]));class o extends HTMLElement{constructor(...e){super(...e),r(this,`Component`,void 0),r(this,`hydrator`,void 0),r(this,`hydrate`,async()=>{var e;if(!this.hydrator||!this.isConnected)return;let t=(e=this.parentElement)==null?void 0:e.closest(`astro-island[ssr]`);if(t){t.addEventListener(`astro:hydrate`,this.hydrate,{once:!0});return}let n=this.querySelectorAll(`astro-slot`),r={},i=this.querySelectorAll(`template[data-astro-template]`);for(let e of i){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`data-astro-template`)||`default`]=e.innerHTML,e.remove())}for(let e of n){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`name`)||`default`]=e.innerHTML)}let o;try{o=this.hasAttribute(`props`)?a(JSON.parse(this.getAttribute(`props`))):{}}catch(e){let t=this.getAttribute(`component-url`)||`<unknown>`,n=this.getAttribute(`component-export`);throw n&&(t+=` (export ${n})`),console.error(`[hydrate] Error parsing props for component ${t}`,this.getAttribute(`props`),e),e}await this.hydrator(this)(this.Component,o,r,{client:this.getAttribute(`client`)}),this.removeAttribute(`ssr`),this.dispatchEvent(new CustomEvent(`astro:hydrate`))}),r(this,`unmount`,()=>{this.isConnected||this.dispatchEvent(new CustomEvent(`astro:unmount`))})}disconnectedCallback(){document.removeEventListener(`astro:after-swap`,this.unmount),document.addEventListener(`astro:after-swap`,this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(`await-children`)||document.readyState===`interactive`||document.readyState===`complete`)this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(`DOMContentLoaded`,e),t.disconnect(),this.childrenConnectedCallback()},t=new MutationObserver(()=>{var t;((t=this.lastChild)==null?void 0:t.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===`astro:end`&&(this.lastChild.remove(),e())});t.observe(this,{childList:!0}),document.addEventListener(`DOMContentLoaded`,e)}}async childrenConnectedCallback(){let e=this.getAttribute(`before-hydration-url`);e&&await import(e),this.start()}getRetryImportUrl(e){let t=new URL(e,document.baseURI);return t.searchParams.set(`astro-retry`,Date.now().toString()),t.toString()}async importWithRetry(e){try{return await import(e)}catch(t){return await new Promise(e=>setTimeout(e,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let t=this.getAttribute(`component-url`),n=new CustomEvent(`astro:hydration-error`,{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:t}});this.dispatchEvent(n)&&console.error(`[astro-island] Error hydrating ${t}`,e)}async start(){let e=JSON.parse(this.getAttribute(`opts`)),t=this.getAttribute(`client`);if(Astro[t]===void 0)window.addEventListener(`astro:${t}`,()=>this.start(),{once:!0});else try{await Astro[t](async()=>{let e=this.getAttribute(`renderer-url`);try{let[t,{default:n}]=await Promise.all([this.importWithRetry(this.getAttribute(`component-url`)),e?this.importWithRetry(e):Promise.resolve({default:()=>()=>{}})]),r=this.getAttribute(`component-export`)||`default`;if(r.includes(`.`)){this.Component=t;for(let e of r.split(`.`)){if(i.has(e)||!this.Component||typeof this.Component!=`object`&&typeof this.Component!=`function`||!Object.hasOwn(this.Component,e))throw Error(`Invalid component export path: ${r}`);this.Component=this.Component[e]}}else{if(i.has(r))throw Error(`Invalid component export path: ${r}`);this.Component=t[r]}return this.hydrator=n,this.hydrate}catch(e){return this.handleHydrationError(e),()=>{}}},e,this)}catch(e){this.handleHydrationError(e)}}attributeChangedCallback(){this.hydrate()}}r(o,`observedAttributes`,[`props`]),customElements.get(`astro-island`)||customElements.define(`astro-island`,o)}})();</script><astro-island uid="2wH2Dz" component-url="/_astro/SpaceSwitcher.Dw9LjKiJ.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-gyrtbwwo-1&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;SpaceSwitcher&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-gyrtbwwo-1"></astro-island></div><button type="button" id="tw-nav-toggle" class="tw-nav-toggle" aria-label="收起或展开左侧导航" aria-expanded="true" aria-controls="tw-nav-aside"><svg class="tw-nav-toggle-icon is-collapse" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"></path></svg><svg class="tw-nav-toggle-icon is-expand" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"></path></svg></button><nav class="tw-nav-list flex-1 overflow-y-auto"><a href="/workbench/" class="tw-nav-item" data-i18n-hint="nav.home" data-hint="我的工作台"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 10.5 12 3l9 7.5"></path><path d="M5 9.5V20h14V9.5"></path></svg><span class="tw-nav-label" data-i18n="nav.home">我的工作台</span></a><div class="tw-nav-libraries"><div class="tw-nav-libraries-ph"><a href="/dashboard/" class="tw-nav-item" data-plugin-nav="dashboard"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"></rect><rect x="14" y="3" width="7" height="7" rx="1.5"></rect><rect x="3" y="14" width="7" height="7" rx="1.5"></rect><rect x="14" y="14" width="7" height="7" rx="1.5"></rect></svg><span class="tw-nav-label" data-i18n="nav.dashboard">仪表盘</span></a><a href="/tasks/" class="tw-nav-item" data-plugin-nav="tasks"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 5h10"></path><path d="M9 12h10"></path><path d="M9 19h10"></path><path d="M4 5h.01"></path><path d="M4 12h.01"></path><path d="M4 19h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.tasks">任务管理</span></a><a href="/todos/" class="tw-nav-item" data-plugin-nav="todos"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M8 6h13"></path><path d="M8 12h13"></path><path d="M8 18h13"></path><path d="M3 6h.01"></path><path d="M3 12h.01"></path><path d="M3 18h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.todos">待办事项</span></a><a href="/pm/projects/" class="tw-nav-item" data-plugin-nav="projects"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"></path></svg><span class="tw-nav-label" data-i18n="nav.projects">项目列表</span></a><a href="/pm/iterations/" class="tw-nav-item" data-plugin-nav="iterations"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2"></rect><path d="M8 3v4"></path><path d="M16 3v4"></path><path d="M3 10h18"></path></svg><span class="tw-nav-label" data-i18n="nav.iterations">迭代管理</span></a><a href="/pm/requirements/" class="tw-nav-item" data-plugin-nav="pmRequirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.requirementsMgmt">需求管理</span></a><a href="/pm/bugs/" class="tw-nav-item" data-plugin-nav="bugs"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="14" r="5"></circle><path d="M9 6l2 2"></path><path d="M15 6l-2 2"></path><path d="M7 11H4"></path><path d="M20 11h-3"></path><path d="M7 17H4"></path><path d="M20 17h-3"></path></svg><span class="tw-nav-label" data-i18n="nav.bugs">缺陷管理</span></a><a href="/reports/" class="tw-nav-item" data-plugin-nav="reports"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.reports">工作汇报</span></a><a href="/test-stats/" class="tw-nav-item" data-plugin-nav="testStats"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 20V10"></path><path d="M10 20V4"></path><path d="M16 20v-7"></path><path d="M22 20H2"></path></svg><span class="tw-nav-label" data-i18n="nav.testStats">测试统计</span></a><a href="/case-exec/" class="tw-nav-item is-active font-medium" data-plugin-nav="caseExec"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="9"></circle><circle cx="12" cy="12" r="5"></circle><circle cx="12" cy="12" r="1.4"></circle></svg><span class="tw-nav-label" data-i18n="nav.caseExec">用例执行统计</span></a><a href="/cases/library/" class="tw-nav-item" data-plugin-nav="cases"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 11l3 3L22 4"></path><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg><span class="tw-nav-label" data-i18n="nav.caseManage">用例管理</span></a><a href="/knowledge/" class="tw-nav-item" data-plugin-nav="knowledgeLib"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg><span class="tw-nav-label" data-i18n="nav.knowledge">知识库管理</span></a><a href="/requirements/" class="tw-nav-item" data-plugin-nav="requirements" data-i18n-hint="nav.requirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h6"></path></svg><span class="tw-nav-label" data-i18n="nav.requirements">需求文档库</span></a><a href="/templates/" class="tw-nav-item" data-plugin-nav="templates" data-i18n-hint="nav.templates"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 3 3 8l9 5 9-5-9-5z"></path><path d="m3 13 9 5 9-5"></path></svg><span class="tw-nav-label" data-i18n="nav.templates">测试模板库</span></a></div><astro-island uid="Z1lgSd4" component-url="/_astro/NavLibraries.RH3Sinuh.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-iywf7oe7-2&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;NavLibraries&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-iywf7oe7-2"></astro-island><script>(function(){const host = ".tw-nav-libraries";
137
+ animation-name: astroFadeIn; }</style></head><body class="tw-body antialiased"><div class="tw-shell min-h-screen"><aside class="tw-nav-aside fixed inset-y-0 left-0 flex flex-col z-45" id="tw-nav-aside"><div class="tw-nav-brand"><div class="tw-nav-brand-row"><a href="/" class="tw-nav-brand-link min-w-0 flex-1" data-astro-reload><span class="tw-nav-brand-mark" aria-hidden="true"><img class="tw-nav-brand-mark-img" src="/brand/brand-mark.png" alt="" width="36" height="36"></span><span class="tw-nav-brand-text"><span class="tw-nav-brand-title-row"><span class="tw-nav-brand-title" data-i18n="nav.brand">Lantern Harness</span><span class="tw-nav-brand-ver" data-hint="平台版本 v0.1.23">v0.1.23<span class="tw-nav-brand-dot" id="tw-update-dot" role="button" tabindex="-1" aria-label="有新版本可更新" hidden></span></span></span></span></a></div></div><div class="tw-nav-space-slot"><div class="tw-nav-space tw-nav-space-ph" id="tw-nav-space-ph" aria-hidden="true"><div class="tw-nav-space-ph-box"><span class="tw-nav-space-ph-ico"></span><span class="tw-nav-space-ph-lines"><span class="tw-nav-space-ph-bar is-cap"></span><span class="tw-nav-space-ph-bar is-name"></span></span></div></div><style>astro-island,astro-slot,astro-static-slot{display:contents}</style><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).only=e,window.dispatchEvent(new Event(`astro:only`))})();</script><script>(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);{let e={0:e=>a(e),1:e=>n(e),2:e=>new RegExp(e),3:e=>new Date(e),4:e=>new Map(n(e)),5:e=>new Set(n(e)),6:e=>BigInt(e),7:e=>new URL(e),8:e=>new Uint8Array(e),9:e=>new Uint16Array(e),10:e=>new Uint32Array(e),11:e=>1/0*e},t=t=>{let[n,r]=t;return n in e?e[n](r):void 0},n=e=>e.map(t),a=e=>typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]));class o extends HTMLElement{constructor(...e){super(...e),r(this,`Component`,void 0),r(this,`hydrator`,void 0),r(this,`hydrate`,async()=>{var e;if(!this.hydrator||!this.isConnected)return;let t=(e=this.parentElement)==null?void 0:e.closest(`astro-island[ssr]`);if(t){t.addEventListener(`astro:hydrate`,this.hydrate,{once:!0});return}let n=this.querySelectorAll(`astro-slot`),r={},i=this.querySelectorAll(`template[data-astro-template]`);for(let e of i){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`data-astro-template`)||`default`]=e.innerHTML,e.remove())}for(let e of n){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`name`)||`default`]=e.innerHTML)}let o;try{o=this.hasAttribute(`props`)?a(JSON.parse(this.getAttribute(`props`))):{}}catch(e){let t=this.getAttribute(`component-url`)||`<unknown>`,n=this.getAttribute(`component-export`);throw n&&(t+=` (export ${n})`),console.error(`[hydrate] Error parsing props for component ${t}`,this.getAttribute(`props`),e),e}await this.hydrator(this)(this.Component,o,r,{client:this.getAttribute(`client`)}),this.removeAttribute(`ssr`),this.dispatchEvent(new CustomEvent(`astro:hydrate`))}),r(this,`unmount`,()=>{this.isConnected||this.dispatchEvent(new CustomEvent(`astro:unmount`))})}disconnectedCallback(){document.removeEventListener(`astro:after-swap`,this.unmount),document.addEventListener(`astro:after-swap`,this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(`await-children`)||document.readyState===`interactive`||document.readyState===`complete`)this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(`DOMContentLoaded`,e),t.disconnect(),this.childrenConnectedCallback()},t=new MutationObserver(()=>{var t;((t=this.lastChild)==null?void 0:t.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===`astro:end`&&(this.lastChild.remove(),e())});t.observe(this,{childList:!0}),document.addEventListener(`DOMContentLoaded`,e)}}async childrenConnectedCallback(){let e=this.getAttribute(`before-hydration-url`);e&&await import(e),this.start()}getRetryImportUrl(e){let t=new URL(e,document.baseURI);return t.searchParams.set(`astro-retry`,Date.now().toString()),t.toString()}async importWithRetry(e){try{return await import(e)}catch(t){return await new Promise(e=>setTimeout(e,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let t=this.getAttribute(`component-url`),n=new CustomEvent(`astro:hydration-error`,{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:t}});this.dispatchEvent(n)&&console.error(`[astro-island] Error hydrating ${t}`,e)}async start(){let e=JSON.parse(this.getAttribute(`opts`)),t=this.getAttribute(`client`);if(Astro[t]===void 0)window.addEventListener(`astro:${t}`,()=>this.start(),{once:!0});else try{await Astro[t](async()=>{let e=this.getAttribute(`renderer-url`);try{let[t,{default:n}]=await Promise.all([this.importWithRetry(this.getAttribute(`component-url`)),e?this.importWithRetry(e):Promise.resolve({default:()=>()=>{}})]),r=this.getAttribute(`component-export`)||`default`;if(r.includes(`.`)){this.Component=t;for(let e of r.split(`.`)){if(i.has(e)||!this.Component||typeof this.Component!=`object`&&typeof this.Component!=`function`||!Object.hasOwn(this.Component,e))throw Error(`Invalid component export path: ${r}`);this.Component=this.Component[e]}}else{if(i.has(r))throw Error(`Invalid component export path: ${r}`);this.Component=t[r]}return this.hydrator=n,this.hydrate}catch(e){return this.handleHydrationError(e),()=>{}}},e,this)}catch(e){this.handleHydrationError(e)}}attributeChangedCallback(){this.hydrate()}}r(o,`observedAttributes`,[`props`]),customElements.get(`astro-island`)||customElements.define(`astro-island`,o)}})();</script><astro-island uid="2wH2Dz" component-url="/_astro/SpaceSwitcher.Dw9LjKiJ.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-gyrtbwwo-1&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;SpaceSwitcher&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-gyrtbwwo-1"></astro-island></div><button type="button" id="tw-nav-toggle" class="tw-nav-toggle" aria-label="收起或展开左侧导航" aria-expanded="true" aria-controls="tw-nav-aside"><svg class="tw-nav-toggle-icon is-collapse" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"></path></svg><svg class="tw-nav-toggle-icon is-expand" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"></path></svg></button><nav class="tw-nav-list flex-1 overflow-y-auto"><a href="/workbench/" class="tw-nav-item" data-i18n-hint="nav.home" data-hint="我的工作台"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 10.5 12 3l9 7.5"></path><path d="M5 9.5V20h14V9.5"></path></svg><span class="tw-nav-label" data-i18n="nav.home">我的工作台</span></a><div class="tw-nav-libraries"><div class="tw-nav-libraries-ph"><a href="/dashboard/" class="tw-nav-item" data-plugin-nav="dashboard"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"></rect><rect x="14" y="3" width="7" height="7" rx="1.5"></rect><rect x="3" y="14" width="7" height="7" rx="1.5"></rect><rect x="14" y="14" width="7" height="7" rx="1.5"></rect></svg><span class="tw-nav-label" data-i18n="nav.dashboard">仪表盘</span></a><a href="/tasks/" class="tw-nav-item" data-plugin-nav="tasks"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 5h10"></path><path d="M9 12h10"></path><path d="M9 19h10"></path><path d="M4 5h.01"></path><path d="M4 12h.01"></path><path d="M4 19h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.tasks">任务管理</span></a><a href="/todos/" class="tw-nav-item" data-plugin-nav="todos"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M8 6h13"></path><path d="M8 12h13"></path><path d="M8 18h13"></path><path d="M3 6h.01"></path><path d="M3 12h.01"></path><path d="M3 18h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.todos">待办事项</span></a><a href="/pm/projects/" class="tw-nav-item" data-plugin-nav="projects"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"></path></svg><span class="tw-nav-label" data-i18n="nav.projects">项目列表</span></a><a href="/pm/iterations/" class="tw-nav-item" data-plugin-nav="iterations"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2"></rect><path d="M8 3v4"></path><path d="M16 3v4"></path><path d="M3 10h18"></path></svg><span class="tw-nav-label" data-i18n="nav.iterations">迭代管理</span></a><a href="/pm/requirements/" class="tw-nav-item" data-plugin-nav="pmRequirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.requirementsMgmt">需求管理</span></a><a href="/pm/bugs/" class="tw-nav-item" data-plugin-nav="bugs"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="14" r="5"></circle><path d="M9 6l2 2"></path><path d="M15 6l-2 2"></path><path d="M7 11H4"></path><path d="M20 11h-3"></path><path d="M7 17H4"></path><path d="M20 17h-3"></path></svg><span class="tw-nav-label" data-i18n="nav.bugs">缺陷管理</span></a><a href="/reports/" class="tw-nav-item" data-plugin-nav="reports"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.reports">工作汇报</span></a><a href="/test-stats/" class="tw-nav-item" data-plugin-nav="testStats"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 20V10"></path><path d="M10 20V4"></path><path d="M16 20v-7"></path><path d="M22 20H2"></path></svg><span class="tw-nav-label" data-i18n="nav.testStats">测试统计</span></a><a href="/case-exec/" class="tw-nav-item is-active font-medium" data-plugin-nav="caseExec"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="9"></circle><circle cx="12" cy="12" r="5"></circle><circle cx="12" cy="12" r="1.4"></circle></svg><span class="tw-nav-label" data-i18n="nav.caseExec">用例执行统计</span></a><a href="/cases/library/" class="tw-nav-item" data-plugin-nav="cases"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 11l3 3L22 4"></path><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg><span class="tw-nav-label" data-i18n="nav.caseManage">用例管理</span></a><a href="/knowledge/" class="tw-nav-item" data-plugin-nav="knowledgeLib"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg><span class="tw-nav-label" data-i18n="nav.knowledge">知识库管理</span></a><a href="/requirements/" class="tw-nav-item" data-plugin-nav="requirements" data-i18n-hint="nav.requirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h6"></path></svg><span class="tw-nav-label" data-i18n="nav.requirements">需求文档库</span></a><a href="/templates/" class="tw-nav-item" data-plugin-nav="templates" data-i18n-hint="nav.templates"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 3 3 8l9 5 9-5-9-5z"></path><path d="m3 13 9 5 9-5"></path></svg><span class="tw-nav-label" data-i18n="nav.templates">测试模板库</span></a></div><astro-island uid="Z1lgSd4" component-url="/_astro/NavLibraries.RH3Sinuh.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-iywf7oe7-2&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;NavLibraries&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-iywf7oe7-2"></astro-island><script>(function(){const host = ".tw-nav-libraries";
138
138
  const cacheKey = "tw.hydrate.nav";
139
139
  const fixActive = true;
140
140
  const capture = false;
@@ -364,7 +364,7 @@ const syncNavGroups = true;
364
364
  // 缓存坏了就当没有
365
365
  }
366
366
  })();
367
- })();</script></div><a href="/prompts/" class="tw-nav-item" data-plugin-nav="prompts" data-pinned-nav="prompts"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 20h9"></path><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg><span class="tw-nav-label" data-i18n="nav.prompts">提示词管理</span></a><a href="/docs/manual/" class="tw-nav-item" data-hint="帮助中心" data-i18n-hint="nav.helpCenter"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M5 4.5h9.5L19 9v10.5H5V4.5Z" stroke-linejoin="round"></path><path d="M14.5 4.5V9H19" stroke-linejoin="round"></path><path d="M8 13h8M8 16.5h6" stroke-linecap="round"></path></svg><span class="tw-nav-label" data-i18n="nav.helpCenter">帮助中心</span></a></nav><div class="tw-nav-foot"><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).load=e,window.dispatchEvent(new Event(`astro:load`))})();</script><astro-island uid="Z12jkyC" prefix="r1" component-url="/_astro/SettingsDialog.DgpH_BVN.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{}" ssr client="load" opts="{&quot;name&quot;:&quot;SettingsDialog&quot;,&quot;value&quot;:true}" await-children><div class="tw-nav-foot-row"><button type="button" class="tw-nav-settings-btn" data-hint="设置"><svg class="tw-nav-ico w-4.5 h-4.5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"></path></svg><span data-i18n="nav.settings">设置</span></button><button type="button" class="tw-nav-provider-chip is-empty" data-hint="未配置模型"><span class="tw-nav-provider-dot" aria-hidden="true"></span><span class="tw-nav-provider-name">未配置</span></button></div><span hidden="" style="position:fixed;top:1px;left:1px;width:1px;height:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;display:none"></span><!--astro:end--></astro-island></div></aside><script data-astro-rerun>
367
+ })();</script></div><a href="/prompts/" class="tw-nav-item" data-plugin-nav="prompts" data-pinned-nav="prompts"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 20h9"></path><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg><span class="tw-nav-label" data-i18n="nav.prompts">提示词管理</span></a><a href="/docs/manual/" class="tw-nav-item" data-hint="帮助中心" data-i18n-hint="nav.helpCenter"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M5 4.5h9.5L19 9v10.5H5V4.5Z" stroke-linejoin="round"></path><path d="M14.5 4.5V9H19" stroke-linejoin="round"></path><path d="M8 13h8M8 16.5h6" stroke-linecap="round"></path></svg><span class="tw-nav-label" data-i18n="nav.helpCenter">帮助中心</span></a></nav><div class="tw-nav-foot"><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).load=e,window.dispatchEvent(new Event(`astro:load`))})();</script><astro-island uid="Z12jkyC" prefix="r1" component-url="/_astro/SettingsDialog.Bs1I8b27.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{}" ssr client="load" opts="{&quot;name&quot;:&quot;SettingsDialog&quot;,&quot;value&quot;:true}" await-children><div class="tw-nav-foot-row"><button type="button" class="tw-nav-settings-btn" data-hint="设置"><svg class="tw-nav-ico w-4.5 h-4.5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"></path></svg><span data-i18n="nav.settings">设置</span></button><button type="button" class="tw-nav-provider-chip is-empty" data-hint="未配置模型"><span class="tw-nav-provider-dot" aria-hidden="true"></span><span class="tw-nav-provider-name">未配置</span></button></div><span hidden="" style="position:fixed;top:1px;left:1px;width:1px;height:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;display:none"></span><!--astro:end--></astro-island></div></aside><script data-astro-rerun>
368
368
  (function () {
369
369
  try {
370
370
  var raw = localStorage.getItem('tw.app.model.v1');