zen-gitsync 2.17.31 → 2.17.33

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 (55) hide show
  1. package/README.md +14 -6
  2. package/package.json +10 -1
  3. package/scripts/release.js +66 -29
  4. package/src/ui/public/assets/{AgentEngineSelector-bQmJlH1b.js → AgentEngineSelector-CGrUh2kD.js} +1 -1
  5. package/src/ui/public/assets/{AgentView-DpNj6VFj.js → AgentView-BRC3kn-3.js} +1 -1
  6. package/src/ui/public/assets/{AppVersionBadge-2etZBF2E.js → AppVersionBadge-BR_ZX6Oq.js} +2 -2
  7. package/src/ui/public/assets/{BranchSelector-BvbMlZW6.js → BranchSelector-C77-aizC.js} +1 -1
  8. package/src/ui/public/assets/{CommitForm-C-cL8_vz.css → CommitForm-BbgIoF4h.css} +1 -1
  9. package/src/ui/public/assets/CommitForm-C6qTIW0T.js +6 -0
  10. package/src/ui/public/assets/{CommonDialog-UrQUmb6G.js → CommonDialog-kDck8ITZ.js} +1 -1
  11. package/src/ui/public/assets/{EditorView-DIu2cIai.js → EditorView-DNZXnJnc.js} +1 -1
  12. package/src/ui/public/assets/{FileDiffViewer-BlDGBxKd.js → FileDiffViewer-BxFkqvIA.js} +1 -1
  13. package/src/ui/public/assets/{FlowExecutionViewer-MPq4Fh6G.js → FlowExecutionViewer-DDkb05TW.js} +1 -1
  14. package/src/ui/public/assets/{FlowOrchestrationWorkspace-ByBJ4B3G.js → FlowOrchestrationWorkspace-BiHGQE0o.js} +1 -1
  15. package/src/ui/public/assets/{IconButton-BvbRjQ_D.js → IconButton-BflzboUD.js} +1 -1
  16. package/src/ui/public/assets/{LogList-Xs52JPC1.js → LogList-DHfr-rPz.js} +1 -1
  17. package/src/ui/public/assets/{MindmapView-Br7Fj7Ga.js → MindmapView-7u02tj5n.js} +1 -1
  18. package/src/ui/public/assets/{MonitorView-DSV5_Q-6.js → MonitorView-cdUkh4VE.js} +1 -1
  19. package/src/ui/public/assets/{ProjectStartupButton-BCS2YQdX.js → ProjectStartupButton-B9KAavAO.js} +1 -1
  20. package/src/ui/public/assets/{RecentDirectoriesChat-Dv47YPKL.js → RecentDirectoriesChat-DQ9phSSJ.js} +1 -1
  21. package/src/ui/public/assets/{RemoteManagerDialog-CIHTYzr7.js → RemoteManagerDialog-CgnM1ndZ.js} +1 -1
  22. package/src/ui/public/assets/{RemoteRepoCard-DCYTEmuq.js → RemoteRepoCard-BDAvJcFk.js} +1 -1
  23. package/src/ui/public/assets/{SourceMapView-BANSmwrh.js → SourceMapView-BEAC-dHC.js} +1 -1
  24. package/src/ui/public/assets/{SvgIcon-b50XyCO5.js → SvgIcon-B-2iTLW-.js} +1 -1
  25. package/src/ui/public/assets/{TemplateManager-D5-gC33Z.js → TemplateManager-CYy3G7rH.js} +1 -1
  26. package/src/ui/public/assets/{UserInputNode-BFmTQYZP.js → UserInputNode-DIX4shBD.js} +1 -1
  27. package/src/ui/public/assets/WorkbenchView-BAko4SjJ.js +20 -0
  28. package/src/ui/public/assets/WorkbenchView-DWQChnqF.css +1 -0
  29. package/src/ui/public/assets/{_plugin-vue_export-helper-MIPci_U9.js → _plugin-vue_export-helper-D8rwCQpe.js} +6 -6
  30. package/src/ui/public/assets/{agentConversations-D8mdZaNY.js → agentConversations-C0WoSH0y.js} +1 -1
  31. package/src/ui/public/assets/{configStore-BMixvVAA.js → configStore-BFGSfIBp.js} +1 -1
  32. package/src/ui/public/assets/{gitStore-DriJnutC.js → gitStore-BcrFZogC.js} +1 -1
  33. package/src/ui/public/assets/index-BCTkDpQv.css +1 -0
  34. package/src/ui/public/assets/{index-CEEQaAF4.js → index-aNSr4k87.js} +10 -10
  35. package/src/ui/public/assets/{previewSandbox-D86LH88s.js → previewSandbox-C_ZzCEpS.js} +1 -1
  36. package/src/ui/public/assets/{toolsStore-B1Lx5gWu.js → toolsStore-B3LQrSEp.js} +1 -1
  37. package/src/ui/public/index.html +12 -12
  38. package/src/ui/server/routes/workbench/index.js +182 -18
  39. package/src/ui/server/routes/workbench/jobActivity.js +18 -6
  40. package/src/ui/server/routes/workbench/liveJobs.js +7 -1
  41. package/src/ui/server/routes/workbench/llmClient.js +37 -6
  42. package/src/ui/server/routes/workbench/progressReport.js +141 -50
  43. package/src/ui/server/routes/workbench/progressReport.test.js +101 -4
  44. package/src/ui/server/routes/workbench/projectRegistry.js +58 -2
  45. package/src/ui/server/routes/workbench/projectRegistry.test.js +51 -0
  46. package/src/ui/server/routes/workbench/stallWatchdog.js +330 -0
  47. package/src/ui/server/routes/workbench/stallWatchdog.test.js +356 -0
  48. package/src/ui/server/utils/directoryGitState.js +41 -1
  49. package/src/ui/server/utils/directoryGitState.test.js +91 -0
  50. package/src/utils/desktopNotify.js +199 -41
  51. package/src/utils/desktopNotify.test.js +84 -29
  52. package/src/ui/public/assets/CommitForm-Bp41Q0Oo.js +0 -6
  53. package/src/ui/public/assets/WorkbenchView-Dc7bMMfe.css +0 -1
  54. package/src/ui/public/assets/WorkbenchView-DsPII7uQ.js +0 -20
  55. package/src/ui/public/assets/index-BrIl1iaG.css +0 -1
package/README.md CHANGED
@@ -63,6 +63,7 @@ npm install -g zen-gitsync
63
63
  - **Skill / MCP marketplace** — install skills and MCP servers from the Agent view into the current project or the `g ai` agent
64
64
  - **Reset to remote** — One-click `git reset --hard origin/<branch>` from the Git panel (auto-refreshes branch info first to avoid wrong-target resets)
65
65
  - **AI commit message** — Generate commit message from staged diff automatically
66
+ - **AI commit & push** — One click does the whole loop: AI writes the commit message from the diff, then stages → commits → pushes (no need to type a message first)
66
67
  - **Selection-scoped diff** — AI commit message and quick commit/push use only the diff of currently selected files when the Git view is the active tab
67
68
  - **Commit templates** — Save type/scope/description/message templates
68
69
  - **Theme & language** — Light/dark theme and Chinese/English UI; one-click theme toggle in the header (no need to dig into settings)
@@ -151,6 +152,7 @@ The GUI runs as a local web server and opens in your default browser on the firs
151
152
  | AI commit message | Generate commit message from staged diff using an AI model |
152
153
  | Push | Push to remote with live progress modal |
153
154
  | Quick commit+push | One-click stage → commit → push |
155
+ | AI commit & push | One-click **AI writes the message → stage → commit → push** (form is filled in first, so you can see what was committed). When the branch is already committed and only needs pushing, AI is skipped and it pushes directly |
154
156
  | Pull / Fetch | Pull from or fetch the upstream branch |
155
157
  | Reset to remote | One-click `git reset --hard origin/<branch>`; auto-refreshes branch info first to avoid stale-branch targets; hidden when working tree is clean and no unpushed commits |
156
158
  | Merge | Merge another branch; detects and surfaces in-progress merge state |
@@ -378,10 +380,12 @@ A dedicated view for running coding agents across one or many projects. Every ta
378
380
  | Task list | Create, edit, delete tasks. Rows are grouped by project (current project first), each a single line — the title, or the first characters of the description (ellipsised) when the title is empty. Tasks with neither a title nor a description count as drafts that are never saved (switching away drops them) |
379
381
  | Multi-project board | Three resizable / collapsible panes: the project list with its run monitor, the kanban board, and the master-agent console. Drag a divider to resize (project list 180–420 px, console 260–560 px), double-click it to reset the responsive default, or fold a side away — the top-bar button folds the project list, the console folds into a 32 px rail that expands on click. The run monitor has its own divider (120 px up to half the viewport height) for when several jobs run at once. All widths / heights are remembered across sessions |
380
382
  | Kanban board | **Todo / Doing / Done** columns with the done column sorted newest-first; a filter checkbox narrows the board to tasks whose last run failed, and a table view is one click away for a denser listing. A **New task** entry sits at the end of the Todo column whether or not that column already holds cards (it doubles as the empty state, and opens the same create dialog as the top-right button) |
381
- | Card status while running | A running task is more than a blinking dot: the card itself carries its executor's brand icon (hover for the product name), the elapsed time, how many tool calls it has made (hover for the mix of types), its most recent tool call, what it is thinking right now, and its newest reply — plus a silence figure once the job has gone quiet for a while. A row with nothing in it is left out instead of being filled with "none yet", and a card that is not running has no such block at all. The facts come from the execution log, the same source the progress report reads, so they refresh with the board's 5-second poll and a task running in another `g ui` instance shows up here too; in table view the same summary sits under the task name |
383
+ | Card status while running | A running task is more than a blinking dot: the card itself carries its executor's brand icon (hover for the product name), the elapsed time, how many tool calls it has made (hover for the mix of types), its most recent tool call, what it is thinking right now, and its newest reply — plus a silence figure once the job has gone quiet for a while. A row with nothing in it is left out instead of being filled with "none yet", and a card that is not running has no such block at all. The facts come from the execution log, the same source the progress report reads, so they refresh with the board's 5-second poll and a task running in another `g ui` instance shows up here too; in table view the same summary sits under the task name. Hovering the card also reveals a **Stop** button in the very slot an idle card puts **Run** in (a running card does not show both — there is no second run to start), so killing a stuck run no longer means opening the editor and scrolling down to it; it goes through the same endpoint and the very same confirmation text as the editor's stop, and a job running inside another `g ui` instance cannot be stopped from this window — the server says exactly that instead of a flat "stop failed" |
382
384
  | Master-agent console | Give the master agent an instruction and it dispatches a new task, deciding the target project itself (or honouring the project you selected). Enter dispatches, Shift+Enter starts a new line. Dispatching can be paused and resumed — while paused, a dispatch creates the task without running it |
383
385
  | Card after a run | A card in Done no longer stops at its title and timestamp: it keeps a short excerpt of the last thing the agent said — the tail of the newest run's reply, flattened to one line and capped at 100 characters. This is the case it was built for: a run often ends by asking you something ("shall I push?"), so a task sitting in Done may still be waiting on your answer, and the only way to find out used to be opening the editor and reading the log. The executor's brand icon sits at the head of that excerpt — the line is what **it** said, so the icon that says which CLI said it belongs there rather than somewhere else on the card. A task that is still running keeps showing the live block instead (the two are mutually exclusive), a run that wrote no body text leaves this line out entirely rather than borrowing an earlier run's words, and the full excerpt is in the hover tooltip; the table view carries the same line under the task name. Executor icons are drawn only when the executor is actually known — a run recorded before the `agent` field existed, or one whose value this build does not recognise, gets no icon rather than a guessed brand (in the table view, icons appear on the status line for a running task and on the last-reply line for a finished one) |
384
386
  | Progress report | The console's **Instruction** pane reports where your running tasks actually stand instead of listing what was dispatched and what finished (the board already shows that). The master agent reads each running job — elapsed time, **its latest thinking**, **what mix of tools it has been calling**, **how long it has been silent**, and the latest output — and writes a short paragraph per report: what each task is doing, how far it has got, and whether it looks stuck. Each report also carries a **progress bar**: the model is asked for its own estimate of overall progress plus one figure per task, and those numbers are drawn as bars labelled **AI estimate** (hover says what the guess is based on). It is an estimate, not a measurement — and when the model declines to give a number, the bar is simply not drawn instead of defaulting to 0%. The thinking line is what makes this work for tasks that never write a line of prose (they are the common case — their output stays empty from start to finish); "looks stuck" now has to come with evidence — a silence figure, or a tool mix going in circles — instead of being inferred from a high call count. Reports appear on an interval you pick (5 / 10 / 15 / 30 / 60 minutes, or off) or whenever you hit **Report now**, and the newest one is shown with the facts behind it (project, elapsed, tool mix, latest thinking, last tool call, silence) while earlier ones stay browsable from the history list. Automatic reports are generated **server-side**, so the history keeps filling up while the tab is closed and is waiting for you when you come back. Nothing running means nothing filed: automatic reports are skipped outright, and **Report now** answers with a plain "no task is running right now" rather than filing an empty entry (no empty entries, no wasted model call), while two identical reports arriving seconds apart are collapsed into one so a double click leaves no duplicate. The paragraph is written in the UI language and, when a task's output is inconclusive, it says so rather than inventing progress |
387
+ | Silent wrap-up | When a run has been silent for more than **10 minutes** (no prose, no thinking, no tool call) the console asks the master agent to read the facts it has — latest thinking, the last thing it said, the tool mix — and decide whether it **has finished** or is still working / stuck. A "finished" verdict settles that run: the card moves from In progress to Done, with an **AI marked done** chip under the elapsed time whose tooltip carries the model's reasoning. When the evidence is thin it does nothing at all (it only books the check, waits another 10 minutes, and asks at most 3 times per run) — not acting beats marking a running task as done. It changes the record, never the process: killing a hung process stays the job of the **Stop** button on the card. Only runs owned by **this instance** are judged — a task started in another `g ui` window is settled by that window |
388
+ | Marking a task done by hand | The columns are derived from execution facts, which cannot express the two things only you know: a task sitting in **Todo** that was really finished somewhere else, and an **In progress** task whose model has gone quiet while you can see the work is done. Both cards now hover out a **Done** button next to **Run** / **Stop**, and a card that got into Done *by hand* trades it for **Undo**. A card that finished on its own keeps showing neither — undoing a mark it never had would do nothing at all. Marking a still-running task done asks first and stops that run as part of the same action (a card cannot be Done and running at once), which holds across windows too: if the job lives in another `g ui` instance the server refuses with that very reason instead of pretending. The mark is stored on the task rather than faked as a run record, and a later run of that task supersedes it, so the card goes back to following the facts. Undo is one click with no confirmation — it is the "I clicked the wrong one" path — and hands the card back to the execution facts, which is why it is offered only where the mark is what keeps the card in Done |
385
389
  | Dispatch default prompts | Give every dispatch a standing prompt: one **global** entry that applies to all projects, plus one **per project** that is appended after it whenever you dispatch to that project (it supplements the global one rather than replacing it). Both are edited from the gear button in the console's composer; the combined text is prepended to the instruction, a "Default prompt (global + this project)" checkbox appears next to **Run now** so a single dispatch can opt out, and the instruction log records which level was attached. The prompt is copied onto the task at dispatch time, so editing the setting later never rewrites tasks that already exist; it lands in the task's own prompt field, where you can still edit it per task |
386
390
  | Open-with menu per project | Hovering a project row in the board's project list reveals two buttons: **Open folder** (straight to your file manager) and **Open with**, a menu holding file manager / terminal / `g ui` in a new tab plus every editor and AI tool (VS Code, Codex, OpenCode, Kimi Code, ZCode, DeepSeek Harness, and Claude Code in default or fully-approved mode). Tools that are not installed are dimmed and labelled "Not installed" — clicking one opens the very same install guide the top bar uses. Every action applies to that row's project only; the board's selection is never touched |
387
391
  | Task editor overlay | Clicking a board card opens the editor as an overlay: a flat sidebar holding the task list and prompt presets, then the task header, preset selector, executor split-button, the copy-execution / execution-log / clear-execution actions, and a chat-style execution body. The description collapses into a one-line "Task description (optional)" summary until clicked, showing a "Filled" badge and the attachment count once there is content. Opening the overlay lands the conversation on its **newest** turn rather than its first: the flow keeps re-pinning to the bottom while markdown highlighting and tool-call folding are still growing it after mount, and lets go as soon as you scroll yourself |
@@ -478,13 +482,13 @@ All `package.json` scripts use **npm** (`npm install`, `npm run dev`, `npm run r
478
482
 
479
483
  The last step is the slow one: the registry can take anywhere from seconds to over 30 minutes to make a freshly published version installable, so the script polls on two readiness signals (packument has the version / tarball is fetchable) and force-installs every 4 rounds — the probes only save a doomed call, **`npm` itself is the judge**. Each failed attempt prints an `[E404]` / `[EPERM]` short code, and giving up prints the breakdown of what it kept hitting.
480
484
 
481
- **You don't have to watch it.** When the run ends you get a desktop notification plus a sound (success and failure use different sounds), and the terminal / taskbar title switches to the result. All of it is best-effort and can never fail the release itself; pass `--no-notify` (or set `ZEN_NO_NOTIFY=1`) to turn it off. The three outcomes are reported separately, because "published but the global install failed" is neither success nor failure:
485
+ **You don't have to watch it.** When the run ends you get a desktop notification, a click-to-dismiss always-on-top popup (green / amber / red depending on the outcome) and a sound, and the terminal / taskbar title switches to the result. The popup is the channel that matters: a Windows banner disappears after ~5 seconds and the notification-center entry gets buried under everything else, so an always-on-top window is the only one you can't sleep through. All of it is best-effort and can never fail the release itself; pass `--no-notify` (or set `ZEN_NO_NOTIFY=1`) to turn it off, and run `npm run release -- --notify-test` at any time to check whether notifications actually reach your desktop (no real release needed). The three outcomes are reported separately, because "published but the global install failed" is neither success nor failure:
482
486
 
483
487
  - **release complete** — published to npm and the global version was verified.
484
488
  - **published, global not updated** — the version is on npm but the global install didn't land. Re-running the release won't help (the version number is taken); just run `npm install -g zen-gitsync@<version>`.
485
489
  - **release failed** — an earlier step (type check / package self-check / git / `npm publish`) aborted the run.
486
490
 
487
- Other switches: `--dry-run` (print the plan only), `--skip-push`, `--skip-self-update`, `--keep-instances`, `--poll-timeout=<seconds>`.
491
+ Other switches: `--dry-run` (print the plan only), `--skip-push`, `--skip-self-update`, `--keep-instances`, `--poll-timeout=<seconds>`, `--no-notify`, `--notify-test`.
488
492
 
489
493
  ---
490
494
 
@@ -714,6 +718,7 @@ npm install -g zen-gitsync
714
718
  - **Skill / MCP 广场** — 在智能体页把 Skill 与 MCP 服务安装到当前项目或 `g ai` 智能体
715
719
  - **重置到远程** — 在 Git 面板一键执行 `git reset --hard origin/<branch>`(点击前会先自动刷新分支信息,避免重置到陈旧分支)
716
720
  - **AI 生成提交信息** — 基于 staged diff 自动生成提交消息
721
+ - **AI 提交并推送** — 一键跑完整条链路:AI 从 diff 写好提交信息 → 暂存 → 提交 → 推送(不必先自己敲一条提交信息)
717
722
  - **选择模式差异** — 当 Git 视图为当前激活标签时,AI 生成提交信息与一键提交/推送仅作用于当前勾选文件的 diff
718
723
  - **提交模板** — 保存类型/范围/描述/完整提交信息模板
719
724
  - **主题与语言** — 支持明/暗主题,中英文界面切换;header 一键切换主题(无需进入设置)
@@ -833,6 +838,7 @@ $ ZEN_ALLOWED_ORIGINS="https://zen.example.com,http://10.0.0.5:8080" g ui
833
838
  | AI 生成提交信息 | 基于 staged diff 自动生成提交消息 |
834
839
  | 推送 | 推送到远程,实时显示进度弹窗 |
835
840
  | 快速提交+推送 | 一键完成暂存 → 提交 → 推送 |
841
+ | AI 提交并推送 | 一键完成 **AI 写提交信息 → 暂存 → 提交 → 推送**(信息会先填进表单,能看见到底提了什么)。本地已提交、只差推送时跳过 AI 直接推 |
836
842
  | 拉取 / Fetch | 从上游拉取或仅获取远程信息 |
837
843
  | 重置到远程 | 一键执行 `git reset --hard origin/<branch>`;点击前会先刷新分支信息,避免重置到陈旧分支;当工作区干净且无未推送提交时按钮自动隐藏 |
838
844
  | 合并 | 合并其他分支,自动检测并引导处理合并中间状态 |
@@ -1060,10 +1066,12 @@ Activity Bar 第四个视图,在 GUI 内直接浏览并编辑项目文件:
1060
1066
  | 任务列表 | 新建、编辑、删除任务;按项目分组(当前项目排在最前),每条任务只占一行 —— 有标题显示标题,没标题则显示描述前若干字符(超出省略);标题和描述都没填的任务视为草稿,切走时直接丢弃、不落盘 |
1061
1067
  | 多项目看板 | 三栏均可拖动 / 可折叠:项目列表(含执行监控)、看板、主 Agent 控制台。拖动分隔条调整宽度(项目列表 180–420 px、控制台 260 px ~ `min(900, 视口 46%)`),双击恢复响应式默认值;两侧也都能收起 —— 顶栏按钮收项目列表,控制台自己的按钮把它收成 32px 收纳条、点一下展开。项目列表下方的执行监控有独立分隔条(120 px ~ 视口高度一半),并行跑多个任务时上下拖动即可加高。所有宽高跨会话记住 |
1062
1068
  | 看板视图 | **待处理 / 进行中 / 已完成** 三列,已完成列按完成时间倒序;顶部勾选可只看「最近一次执行报错」的任务;一键切换成表格视图,信息密度更高。待处理列末尾常驻一个「新建任务」入口 —— 列里已有卡片时它照样在(列空时它还兼任空状态),点开的是和右上角按钮同一个新建弹窗 |
1063
- | 进行中卡片 | 正在跑的任务不只是右上角一个圆点:卡片上直接带着**执行器的品牌图标**(悬停看是哪个产品)、已运行时长、调用了多少次工具(悬停看类型分布)、最近一次工具调用、最近在思考什么、最新的回复 —— 一段时间没有产出时再补一句静默多久。某一项没有内容就**整行不渲染**(不写"暂无"),没在跑的任务则完全没有这块。这些事实与右栏进度报告同源(都来自执行记录),所以跟随看板 5 秒轮询刷新,别的 `g ui` 实例里跑的任务在这里同样看得到;切到表格视图时同一行摘要压在任务名下方 |
1069
+ | 进行中卡片 | 正在跑的任务不只是右上角一个圆点:卡片上直接带着**执行器的品牌图标**(悬停看是哪个产品)、已运行时长、调用了多少次工具(悬停看类型分布)、最近一次工具调用、最近在思考什么、最新的回复 —— 一段时间没有产出时再补一句静默多久。某一项没有内容就**整行不渲染**(不写"暂无"),没在跑的任务则完全没有这块。这些事实与右栏进度报告同源(都来自执行记录),所以跟随看板 5 秒轮询刷新,别的 `g ui` 实例里跑的任务在这里同样看得到;切到表格视图时同一行摘要压在任务名下方。悬停时卡片右下角还会浮出 **停止** —— 位置正是空闲卡片摆「执行」的那一格(在跑时两者不并排:没有第二轮可跑),所以停掉一条卡住的任务不必再点进编辑器往下翻;它走的是与编辑器里那个「停止」**同一个接口、同一段确认文案**,而在**别的 g ui 实例**里跑的任务在这个窗口停不了 —— 服务端会直说这一句,而不是笼统回一句「停止失败」 |
1064
1070
  | 跑完卡片 | 「已完成」列的卡片不再只有标题和时间:它留下一小段**智能体最后说的话** —— 最近一轮执行的正文尾部,压平成一句话、最多 100 字。这条最有用的时候正是它被做出来的理由:一次执行常常以反问收尾(「要 push 吗?」),标着"已完成"的任务其实在等你回一句话,而以前只有点进编辑器翻日志才知道。**执行器的品牌图标就挂在这段摘录的开头** —— 这句话是"它"说的,图标说的是哪个 CLI 说的,放在这里比放在卡片别处更直接。正在跑的任务仍然走上面那块活动区(两者互斥);那次执行没写正文时这段整块不渲染,不拿上一轮的旧话顶;完整摘录在悬停提示里。表格视图的任务名下方同样有这一行。图标只在**执行器认得出来**时才画:加 `agent` 字段之前跑的记录、或值不在已知执行器里的,一律不画,而不是猜一个品牌显示(表格视图里,正在跑的任务图标在状态摘要行、跑完的在最后回复行) |
1065
1071
  | 主 Agent 控制台 | 两种工作方式,拨片切换、选择记在浏览器里:**对话** —— 直接跟内置 g ai 聊,由它按需把活派给某个项目(可多轮、可先问清再派);**指令** —— 你自己写一句话,落点由主 Agent 判断(或遵从此前选中的项目),Enter 派发、Shift+Enter 换行。两种方式落到**同一条派发链路与同一条指令流水**,差别只在"谁决定派什么"。调度可暂停 / 恢复,暂停期间派发只建任务不执行 |
1066
1072
  | 进度报告 | 「指令」模式下这块报的是**正在跑的任务现在到哪一步了**,而不是"谁派发了、谁完成了"(那些看板本身就能看出来)。主 Agent 会读一遍每个在跑的 job —— 已运行多久、**最近在想什么**、**最近 20 次都在调哪类工具**、**已经多久没动静**、最近一行输出 —— 写一段汇报:每个任务在做什么、走到哪一步、有没有卡住的迹象。每次汇报还带一条**进度条**:模型在正文之前先交它自己估的整体进度与每个任务各自的百分比,界面把它们画成条并标上「AI 估计」(悬停说明这个数字是怎么估出来的)。它是估计不是实测 —— 模型不肯给数字时不画那条,不会拿一个 0% 糊弄过去。**思考那一行是关键**:一句正文都不写的任务才是常态(它们的输出从头到尾是空的),只看输出就只能写"看不出来";而"是不是卡住了"现在必须给依据(静默时长、或工具分布是不是在原地打转),不许因为调用次数多就暗示卡住。报告按你设的间隔自动生成(5 / 10 / 15 / 30 / 60 分钟,也可以关掉),也能随时点「立即报告」;面板上展示最新那份及其依据(项目、已运行时长、工具分布、最近思考、最近一次工具调用、静默时长),更早的从下方历史列表里点开回看。自动报告由**服务端**定时产生,所以标签页关着也照样攒历史,回来就能看到;**没有任务在跑就不记条目** —— 自动报告直接跳过,「立即报告」改成回你一句"当前没有正在执行的任务"(都不白调一次模型);间隔内内容一样的两份也不重复落盘,连点两下只留一条。汇报按界面语言生成,输出看不出进度时会直说,而不是编一段像模像样的进展 |
1073
+ | 静默收尾 | 一条任务静默超过 **10 分钟**(没有正文、没有思考、也没有工具调用)时,编排台会让主 Agent 读一遍它手上的事实 —— 最近在想什么、最后说了什么、工具分布长什么样 —— 判断它是**已经做完了**,还是还在干活 / 卡住了。判成做完就把这一轮落成终态:卡片从「进行中」挪到「已完成」,并在用时下面标一枚 **AI 判定完成**,悬停看模型给的依据。判据不足时**什么都不做**(只记一笔,等下一个 10 分钟再问,同一条最多问 3 次)—— 不动手,好过把还在跑的任务标成完成。它只改记录、**不动进程**:真要把挂住的进程收掉,仍然是卡片上那个「停止」。只判**本实例**跑的任务 —— 别的 `g ui` 窗口里派出去的那条,由那个窗口自己收尾 |
1074
+ | 手动标记完成 | 列是执行事实推出来的,推不出两件只有你自己知道的事:一条躺在**待处理**里的任务其实早在别处干完了;一条**进行中**的任务模型已经不说话了,而你一眼能看出它做完了。这两种卡片现在 hover 会浮出一颗 **完成**(就在「执行 / 停止」旁边那一格),而**手动**收进已完成的卡片把那颗换成 **撤销**;自己跑完的卡片两颗都没有 —— 撤销一个它从来没有过的标记,点下去什么都不会发生。给正在跑的任务标完成会先问一句,并在同一次动作里把那一轮停掉(一张卡片不能既是「已完成」又在跑);跨窗口也一样:那个 job 活在别的 `g ui` 实例里时服务端直说原因,不假装标成功。标记记在任务身上,不补假的执行记录;这条任务之后再跑一轮,标记就作废,列重新跟着执行事实走。撤销是一键、不弹确认(它走的就是"点错了退回来"那条路),撤完回哪一列仍然由执行事实说了算 —— 所以那颗按钮只出现在"正是它把卡片留在已完成列"的卡上 |
1067
1075
  | 派发执行器 | 派出去的任务由哪个 CLI 跑:**对话模式**在输入框下方选,**指令模式**在派发栏选 —— 两处是同一个组件、同一份选择,与执行按钮的临时切换也共用。注意「引擎」和「执行器」不是一回事:只有**内置 g ai** 能在服务端跑工具循环、才有派发能力,所以对话模式下把引擎切成外部 CLI 时,执行器选择会换成一句「当前引擎只能对话,不能派发任务 —— 切到内置 g ai 才能派活」的说明,而不是让你点了个不会生效的下拉 |
1068
1076
  | 派发默认提示词 | 给每次派发配一段常驻提示词:一条**全局**的(所有项目都附加)+ 每个项目一条(派发到该项目时追加在全局之后,是补充而不是覆盖)。两者都在控制台输入区的齿轮按钮里设置;拼好的正文放在指令**之前**,「立即执行」旁边会多出一个「默认提示词(全局 + 本项目)」勾选,单次派发可以取消勾选,指令流水里也记下这条指令附带的是哪一级。提示词在派发那一刻就抄进任务自己的提示词字段,之后改设置不会回头改写已建任务,单条任务仍可再改 |
1069
1077
  | 项目行打开方式 | 编排台项目列表里 hover 任意一行会出现两个按钮:「打开文件夹」一键进资源管理器,以及「打开方式」菜单 —— 文件管理器 / 终端 / 新标签页跑 `g ui`,以及各编辑器与 AI 工具(VS Code、Codex、OpenCode、Kimi Code、ZCode、DeepSeek Harness,加上默认权限或完全批准的 Claude Code)。没安装的工具会置灰并标「未安装」,点它弹的是顶栏那套安装引导;菜单里的动作只作用于该行项目,不会改变看板选中态 |
@@ -1157,13 +1165,13 @@ git add --renormalize .
1157
1165
 
1158
1166
  最后一步最慢:registry 让刚发布的版本变得可安装,实测从几秒到 30 分钟以上都有,所以脚本用两个就绪信号(packument 里有没有该版本 / tarball 能否取到)轮询,并每 4 轮强制真装一次 —— 探针只负责省下一次注定失败的调用,**判据只有 npm 自己**。每次失败打 `[E404]` / `[EPERM]` 短码,放弃时汇总失败构成。
1159
1167
 
1160
- **不用盯着它。** 流程结束时你会收到一条系统通知 + 提示音(成功与失败是两种不同的音),终端 / 任务栏标题也会变成结果。这些都是尽力而为,**绝不会**影响发布本身的成败;加 `--no-notify`(或设 `ZEN_NO_NOTIFY=1`)可关掉。三种结局分开报,因为"包发出去了但全局没装上"既不是成功也不是失败:
1168
+ **不用盯着它。** 流程结束时你会收到一条系统通知、一个置顶弹窗(点一下即关,成功 / 部分成功 / 失败分别是绿 / 琥珀 / 红)和一声提示音,终端 / 任务栏标题也会变成结果。真正管用的是那个弹窗:Windows 的通知横幅挂 5 秒就没了、通知中心里那一条又会被别的东西淹掉,只有置顶窗口是"睡一觉回来也躲不掉"的信道。这些都是尽力而为,**绝不会**影响发布本身的成败;加 `--no-notify`(或设 `ZEN_NO_NOTIFY=1`)可关掉,想随时确认提醒能不能送到你的桌面就跑 `npm run release -- --notify-test`(不用真发一次版)。三种结局分开报,因为"包发出去了但全局没装上"既不是成功也不是失败:
1161
1169
 
1162
1170
  - **发布完成** —— 已发布到 npm,且全局版本已校验通过。
1163
1171
  - **已发布但全局没更新** —— 版本已经在 npm 上,只是没装到全局。重发没有意义(版本号已被占用),按提示手动装一次即可。
1164
1172
  - **发布失败** —— 更早的一步(类型检查 / 发布物自检 / git / `npm publish`)把流程中断了。
1165
1173
 
1166
- 其它开关:`--dry-run`(只打印计划)、`--skip-push`、`--skip-self-update`、`--keep-instances`、`--poll-timeout=<秒>`。
1174
+ 其它开关:`--dry-run`(只打印计划)、`--skip-push`、`--skip-self-update`、`--keep-instances`、`--poll-timeout=<秒>`、`--no-notify`、`--notify-test`。
1167
1175
 
1168
1176
  ---
1169
1177
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-gitsync",
3
- "version": "2.17.31",
3
+ "version": "2.17.33",
4
4
  "description": "Auto commit, scheduled sync, and visual GUI for Git. Run `g` in any repo for one-key commit & push, AI commit messages, scheduled background sync, and a drag-and-drop workflow builder.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -40,6 +40,7 @@
40
40
  "verify:wb-dispatch": "node scripts/verify-workbench-dispatch-attach.cjs",
41
41
  "verify:wb-env-context": "node scripts/verify-workbench-env-context.mjs",
42
42
  "verify:wb-live-jobs": "node scripts/verify-wb-live-jobs.mjs",
43
+ "verify:wb-manual-done": "node scripts/verify-wb-manual-done.mjs",
43
44
  "verify:wb-bubble-prompt": "node scripts/verify-wb-bubble-prompt.cjs",
44
45
  "verify:wb-copy-execution": "node scripts/verify-wb-copy-execution.cjs",
45
46
  "verify:wb-overview": "node scripts/verify-workbench-overview.cjs",
@@ -50,6 +51,14 @@
50
51
  "verify:wb-task-duration": "node scripts/verify-wb-task-duration.cjs",
51
52
  "verify:wb-card-executor-icon": "node scripts/verify-wb-card-executor-icon.cjs",
52
53
  "verify:wb-card-opened": "node scripts/verify-wb-card-opened.cjs",
54
+ "verify:wb-card-stop": "node scripts/verify-wb-card-stop.cjs",
55
+ "verify:wb-card-stop:reverse": "node scripts/verify-wb-card-stop.cjs --reverse",
56
+ "verify:wb-card-done": "node scripts/verify-wb-card-done.cjs",
57
+ "verify:wb-card-done:reverse": "node scripts/verify-wb-card-done.cjs --reverse",
58
+ "verify:wb-rerun-label": "node scripts/verify-wb-rerun-label.cjs",
59
+ "verify:wb-rerun-label:reverse": "node scripts/verify-wb-rerun-label.cjs --reverse",
60
+ "verify:wb-auto-done": "node scripts/verify-wb-auto-done.cjs",
61
+ "verify:wb-auto-done:reverse": "node scripts/verify-wb-auto-done.cjs --reverse",
53
62
  "verify:wb-list-view": "node scripts/verify-wb-list-view.cjs",
54
63
  "verify:wb-executor-models": "node scripts/verify-wb-executor-models.cjs",
55
64
  "verify:wb-task-sound": "node scripts/verify-wb-task-sound.cjs",
@@ -31,7 +31,8 @@
31
31
  * npm run release -- --poll-timeout=3600 # 窗口上限(秒,默认 1800 = 30 分钟)
32
32
  * npm run release -- --poll-fast-window=600 --poll-slow-interval=60 # 600s 后退避到 60s 一跳
33
33
  * npm run release -- --install-timeout=900 # 单次 npm install 上限(秒),0 = 不限时(默认)
34
- * npm run release -- --no-notify # 结束时不再弹系统通知 / 响提示音
34
+ * npm run release -- --no-notify # 结束时不再弹系统通知 / 弹窗 / 提示音
35
+ * npm run release -- --notify-test # 只发一次提醒就退出(验证提醒能不能用)
35
36
  *
36
37
  * 发布后自更新:每轮看两个就绪信号(packument 里有没有这个版本 / tarball 能不能取),
37
38
  * 任一为真就真调 npm,并两条路(`pkg@<版本>` / tarball URL 直连)都试,装上后校验全局版本;
@@ -39,10 +40,12 @@
39
40
  * 原因见 tarballUrl() / selfUpdateGlobal() 处注释 —— publish 成功不等于
40
41
  * packument 立即可见,也不等于 tarball 立即可取(两种先后顺序都实测出现过)。
41
42
  *
42
- * 结束时**离开终端也能收到**提醒(见 announceRelease):系统通知 + 提示音 + 终端标题。
43
- * 装全局那步实测能磨十几分钟,用户不可能一直盯着;终端里再醒目的一行字,对已经走去
44
- * 干别的事的人等于没打。三种结局(成功 / 已发布但全局没装上 / 失败)各有各的文案与音,
45
- * 用 `--no-notify`(或环境变量 ZEN_NO_NOTIFY=1)可关掉。
43
+ * 结束时**离开终端也能收到**提醒(见 announceRelease):系统通知 + 置顶弹窗 + 提示音
44
+ * + 终端标题。装全局那步实测能磨十几分钟,用户不可能一直盯着;终端里再醒目的一行字,
45
+ * 对已经走去干别的事的人等于没打。三种结局(成功 / 已发布但全局没装上 / 失败)各有各的
46
+ * 文案、配色与音,用 `--no-notify`(或环境变量 ZEN_NO_NOTIFY=1)可关掉。
47
+ * ⚠️ 提醒**必须 await**(子进程活不过父进程,fire-and-forget 会静默失效)——
48
+ * 细节与实测证据见 src/utils/desktopNotify.js 文件头。
46
49
  *
47
50
  * "这一轮要不要真调 npm"的判定抽在 src/utils/selfUpdatePolicy.js(有单测);
48
51
  * 动那里的阈值/分支请连带跑 `node --test src/utils/selfUpdatePolicy.test.js`。
@@ -375,7 +378,7 @@ async function checkEnvironment() {
375
378
  console.log(chalk.yellow('发布已取消'))
376
379
  process.exit(0)
377
380
  }
378
- abortRelease('环境检查失败:', err.message || err)
381
+ await abortRelease('环境检查失败:', err.message || err)
379
382
  }
380
383
  }
381
384
 
@@ -395,7 +398,7 @@ async function runTypeCheck() {
395
398
  execSync('npx vue-tsc -b --noEmit', { cwd: frontendDir, stdio: 'inherit' })
396
399
  console.log(chalk.green('vue-tsc 类型检查通过'))
397
400
  } catch (err) {
398
- abortRelease('vue-tsc 类型检查失败,请修复以上错误后重新发布')
401
+ await abortRelease('vue-tsc 类型检查失败,请修复以上错误后重新发布')
399
402
  }
400
403
  }
401
404
 
@@ -477,7 +480,7 @@ async function verifyPackageContents() {
477
480
  try {
478
481
  execSync(`"${process.execPath}" --test test/package-files.test.mjs`, { cwd: rootDir, stdio: 'inherit' })
479
482
  } catch {
480
- abortRelease(
483
+ await abortRelease(
481
484
  '发布物自检失败:package.json#files 覆盖不全(上面哪几条 not ok 就补哪几个文件)。\n'
482
485
  + '继续发布会打出缺文件的包 —— 用户装上就是 ERR_MODULE_NOT_FOUND。'
483
486
  )
@@ -491,13 +494,13 @@ async function verifyPackageContents() {
491
494
  // npm 可能在前/后混入提示行,这里取第一个 '[' 到最后一个 ']' 之间
492
495
  packJson = JSON.parse(out.slice(out.indexOf('['), out.lastIndexOf(']') + 1))
493
496
  } catch (err) {
494
- abortRelease('npm pack --dry-run 失败:', err.message || err)
497
+ await abortRelease('npm pack --dry-run 失败:', err.message || err)
495
498
  }
496
499
 
497
500
  const pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf8'))
498
501
  const packed = new Set((packJson[0]?.files || []).map((f) => f.path))
499
502
  if (packed.size === 0) {
500
- abortRelease('npm pack 打出了空包,绝对有问题')
503
+ await abortRelease('npm pack 打出了空包,绝对有问题')
501
504
  }
502
505
 
503
506
  const notPacked = (pkg.files || []).filter((entry) => {
@@ -509,7 +512,7 @@ async function verifyPackageContents() {
509
512
  })
510
513
 
511
514
  if (notPacked.length) {
512
- abortRelease(
515
+ await abortRelease(
513
516
  `npm pack 里有 ${notPacked.length} 条 files 白名单没真正进包(大概率是 .npmignore / .gitignore 排除了):\n`
514
517
  + notPacked.map((e) => ` - ${e}`).join('\n')
515
518
  )
@@ -518,7 +521,7 @@ async function verifyPackageContents() {
518
521
  }
519
522
 
520
523
  // 仅把显式白名单文件 stage,并 sanity check
521
- function stageReleaseFiles() {
524
+ async function stageReleaseFiles() {
522
525
  console.log(chalk.gray('stage 白名单文件(避免 `git add .` 误带脏文件)...'))
523
526
  for (const f of RELEASE_FILES) {
524
527
  const abs = path.join(rootDir, f)
@@ -540,7 +543,7 @@ function stageReleaseFiles() {
540
543
  .filter(Boolean)
541
544
  const unexpected = stagedOut.filter((f) => !RELEASE_FILES.includes(f))
542
545
  if (unexpected.length) {
543
- abortRelease(
546
+ await abortRelease(
544
547
  'staged 范围超出白名单,中止提交:\n' + unexpected.map((f) => ` - ${f}`).join('\n')
545
548
  )
546
549
  }
@@ -552,7 +555,7 @@ async function commitChanges(version) {
552
555
 
553
556
  try {
554
557
  await checkAndCleanGitLocks()
555
- stageReleaseFiles()
558
+ await stageReleaseFiles()
556
559
 
557
560
  const commitMessage = `chore: 发布版本 v${version}`
558
561
 
@@ -615,7 +618,7 @@ async function commitChanges(version) {
615
618
  }
616
619
  }
617
620
  } catch (err) {
618
- abortRelease('Git 提交失败:', err.message || err)
621
+ await abortRelease('Git 提交失败:', err.message || err)
619
622
  }
620
623
  }
621
624
 
@@ -892,8 +895,8 @@ async function selfUpdateGlobal(version) {
892
895
  ))
893
896
  console.log(chalk.gray(
894
897
  '这一步可能要等几分钟到半小时,**不用盯着** —— 装好或彻底失败时会弹一条系统通知'
895
- + ' + 响一声(成功失败两种音),终端标题也会变成结果。'
896
- + (NO_NOTIFY ? '(本次带了 --no-notify,提醒已关掉)' : '(想关掉用 --no-notify)')
898
+ + ' + 一个置顶弹窗 + 响一声,终端标题也会变成结果。'
899
+ + (NO_NOTIFY ? '(本次带了 --no-notify,提醒已关掉)' : '(想先确认提醒能不能用:npm run release -- --notify-test)')
897
900
  ))
898
901
 
899
902
  const startedAt = Date.now()
@@ -1111,7 +1114,7 @@ async function publishToNpm(version) {
1111
1114
  reason: selfUpdate.reason ?? '',
1112
1115
  }
1113
1116
  } catch (err) {
1114
- abortRelease('发布到 NPM 失败:', err.message || err)
1117
+ await abortRelease('发布到 NPM 失败:', err.message || err)
1115
1118
  }
1116
1119
  }
1117
1120
 
@@ -1147,11 +1150,13 @@ function oneLine(text, max = 160) {
1147
1150
 
1148
1151
  // 各结局的文案。集中在一处,是因为"通知里说什么"和"终端里说什么"必须是同一件事 ——
1149
1152
  // 尤其 partial:包已经发出去了,但全局没装上,报"发布完成"是误导,报"发布失败"也是误导。
1153
+ // `level` 决定置顶弹窗的配色(ok 绿 / warn 琥珀 / error 红)与提示音。
1150
1154
  function releaseOutcome({ status, version, durationMs, reason }) {
1151
1155
  const spent = humanDuration(durationMs)
1152
1156
  if (status === 'ok') {
1153
1157
  return {
1154
1158
  ok: true,
1159
+ level: 'ok',
1155
1160
  title: `发布完成 · zen-gitsync v${version}`,
1156
1161
  message: `已发布到 npm,全局版本已更新为 v${version}。耗时 ${spent}。`,
1157
1162
  }
@@ -1159,6 +1164,7 @@ function releaseOutcome({ status, version, durationMs, reason }) {
1159
1164
  if (status === 'ok-skipped') {
1160
1165
  return {
1161
1166
  ok: true,
1167
+ level: 'ok',
1162
1168
  title: `发布完成 · zen-gitsync v${version}`,
1163
1169
  message: `已发布到 npm。本次带 --skip-self-update,全局版本没动。耗时 ${spent}。`,
1164
1170
  }
@@ -1166,6 +1172,7 @@ function releaseOutcome({ status, version, durationMs, reason }) {
1166
1172
  if (status === 'partial') {
1167
1173
  return {
1168
1174
  ok: false,
1175
+ level: 'warn',
1169
1176
  title: `已发布但全局没更新 · zen-gitsync v${version}`,
1170
1177
  message: `npm 上已有 v${version},全局仍是旧版。${oneLine(reason)} `
1171
1178
  + `手动装:npm install -g ${PKG_NAME}@${version}`,
@@ -1173,29 +1180,41 @@ function releaseOutcome({ status, version, durationMs, reason }) {
1173
1180
  }
1174
1181
  return {
1175
1182
  ok: false,
1183
+ level: 'error',
1176
1184
  title: `发布失败 · zen-gitsync${version ? ` v${version}` : ''}`,
1177
1185
  message: oneLine(reason || '见终端输出'),
1178
1186
  }
1179
1187
  }
1180
1188
 
1181
- // 发提醒 + 把结果写上终端标题。DRY_RUN 一律不提醒:什么都没发生,响一声只会让人以为发成功了。
1182
- function announceRelease(outcome) {
1189
+ // 发提醒 + 把结果写上终端标题。DRY_RUN 一律不提醒:什么都没发生,弹窗只会让人以为发成功了。
1190
+ //
1191
+ // **必须 await**:提醒是靠子进程送出去的,而子进程活不过本进程(踩过的坑,见
1192
+ // src/utils/desktopNotify.js 文件头的坑①)。第一版 spawn 完就 unref 走人,结果是 cmd 里
1193
+ // 老老实实打着"已发送结束提醒"、系统里一条通知都没有。发布本来就跑了十几分钟,
1194
+ // 多等这一两秒换"提醒真的送出去"完全值得。
1195
+ async function announceRelease(outcome) {
1183
1196
  if (DRY_RUN) return
1184
1197
  setTerminalTitle(outcome.title)
1185
1198
  if (NO_NOTIFY) {
1186
- console.log(chalk.gray('--no-notify:跳过系统通知 / 提示音(终端标题已更新)'))
1199
+ console.log(chalk.gray('--no-notify:跳过系统通知 / 弹窗 / 提示音(终端标题已更新)'))
1187
1200
  return
1188
1201
  }
1189
- notifyDesktop({ title: outcome.title, message: outcome.message, ok: outcome.ok })
1190
- console.log(chalk.gray('已发送结束提醒(系统通知 + 提示音;发不出去也不影响发布结果)'))
1202
+ const { delivered } = await notifyDesktop({
1203
+ title: outcome.title,
1204
+ message: outcome.message,
1205
+ level: outcome.level,
1206
+ })
1207
+ console.log(delivered
1208
+ ? chalk.gray('已发出提醒:系统通知 + 置顶弹窗 + 提示音(弹窗点一下即可关掉)')
1209
+ : chalk.yellow('提醒没能确认送达(不影响发布结果;终端标题已更新)'))
1191
1210
  }
1192
1211
 
1193
- // 发布提前结束的统一出口:打日志 → 发提醒 → 退出 1。
1212
+ // 发布提前结束的统一出口:打日志 → 发提醒(等它送出去)→ 退出 1。
1194
1213
  // 原本这些地方各自写 `console.error(...)` + `process.exit(1)`,提醒没机会发(见上面注释)。
1195
- function abortRelease(message, detail) {
1214
+ async function abortRelease(message, detail) {
1196
1215
  if (detail === undefined) console.error(chalk.red(message))
1197
1216
  else console.error(chalk.red(message), detail)
1198
- announceRelease(releaseOutcome({
1217
+ await announceRelease(releaseOutcome({
1199
1218
  status: 'fail',
1200
1219
  version: currentVersion,
1201
1220
  durationMs: Date.now() - releaseStartedAt,
@@ -1243,7 +1262,7 @@ async function main() {
1243
1262
  if (selfUpdate === 'failed') {
1244
1263
  console.log(chalk.yellow(`\n⚠️ v${currentVersion} 已经发布到 npm,但全局版本没装上。`))
1245
1264
  console.log(chalk.yellow(' 重发没有意义(版本已经占掉了),按上面的命令手动装一次即可。'))
1246
- announceRelease(releaseOutcome({
1265
+ await announceRelease(releaseOutcome({
1247
1266
  status: 'partial',
1248
1267
  version: currentVersion,
1249
1268
  durationMs: Date.now() - releaseStartedAt,
@@ -1256,16 +1275,34 @@ async function main() {
1256
1275
  if (selfUpdate === 'skipped' && !DRY_RUN) {
1257
1276
  console.log(chalk.gray('(全局版本没动,见上面的 --skip-self-update)'))
1258
1277
  }
1259
- announceRelease(releaseOutcome({
1278
+ await announceRelease(releaseOutcome({
1260
1279
  status: selfUpdate === 'skipped' ? 'ok-skipped' : 'ok',
1261
1280
  version: currentVersion,
1262
1281
  durationMs: Date.now() - releaseStartedAt,
1263
1282
  }))
1264
1283
  } catch (err) {
1265
- abortRelease('\n❌ 发布失败:', err.message || err)
1284
+ await abortRelease('\n❌ 发布失败:', err.message || err)
1266
1285
  }
1267
1286
  }
1268
1287
 
1288
+ // `--notify-test`:只发一次提醒就退出,不跑发布流程。
1289
+ //
1290
+ // 为什么非要有这个口子:发一次版要十几分钟,拿它当"提醒到底能不能用"的验证手段成本太高 ——
1291
+ // 2026-09-30 就吃过这个亏:两次发版之后用户说"没收到提示",翻注册表才发现提醒压根没送出去
1292
+ // (见 src/utils/desktopNotify.js 文件头坑①)。要验提醒,就单独跑它。
1293
+ //
1294
+ // 用法:`npm run release -- --notify-test`
1295
+ if (argv.includes('--notify-test')) {
1296
+ console.log(chalk.cyan('\n🔔 只发一次提醒(--notify-test),不跑发布流程'))
1297
+ console.log(chalk.gray(
1298
+ '预期:一条系统通知 + 一个置顶弹窗(点一下关掉)+ 一声提示音,终端标题也会变。'
1299
+ ))
1300
+ console.log(chalk.gray(NO_NOTIFY ? '注意:同时带了 --no-notify,只会改终端标题。' : ''))
1301
+ await announceRelease(releaseOutcome({ status: 'ok', version: '0.0.0(测试)', durationMs: 0 }))
1302
+ console.log(chalk.gray('若没看到通知/弹窗:先查 Windows 设置 → 系统 → 通知(以及「专注助手」)。'))
1303
+ process.exit(0)
1304
+ }
1305
+
1269
1306
  main().catch((err) => {
1270
1307
  console.error(chalk.red('\n❌ 未捕获的错误:'), err)
1271
1308
  process.exit(1)
@@ -1 +1 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,C as n,Dn as r,En as i,Er as a,In as o,J as s,On as c,Pn as l,Pr as u,Qr as d,S as f,Tn as p,Wn as m,Y as h,Yn as g,Zn as _,br as v,cr as y,kn as b,pr as x,qn as S,qr as C,tt as w,w as T,xn as E}from"./element-plus-CgEuJBlB.js";import{n as D,t as O}from"./_plugin-vue_export-helper-MIPci_U9.js";import{t as k}from"./SvgIcon-b50XyCO5.js";import{t as A}from"./toolsStore-B1Lx5gWu.js";import{s as j,v as M}from"./index-CEEQaAF4.js";import{c as N,d as P,l as F,u as I}from"./agentConversations-D8mdZaNY.js";t(),x();function L(e,t=680){let n=v(0),r=null;function i(){let t=e.value;return t?(n.value=t.clientWidth,typeof ResizeObserver>`u`||(r=new ResizeObserver(e=>{let t=e[0]?.contentRect?.width;typeof t==`number`&&(n.value=t)}),r.observe(t),!0)):!1}return g(()=>{i()||m(()=>i())}),S(()=>{r?.disconnect(),r=null}),{width:n,narrow:p(()=>n.value>0&&n.value<t)}}t(),x(),u();var R={class:`agent-engine`},z=[`disabled`,`title`,`aria-label`],B={class:`agent-engine__name`},V={class:`agent-engine__item`},H={class:`agent-engine__item-name`},U={key:3,class:`agent-engine__item-missing`},W=O(o({__name:`AgentEngineSelector`,props:{engine:{},locked:{type:Boolean}},emits:[`select`],setup(t,{emit:o}){let u=t,m=o,g=A(),x=p(()=>I(u.engine)),S=p(()=>({gai:!0,claude:g.claudeAvailable,opencode:g.opencodeAvailable,codex:g.codexAvailable})),O=v(!1),L=v(null);function W(e){if(!u.locked){if(!S.value[e]){if(!P(e))return;L.value=e,O.value=!0;return}m(`select`,e)}}return(o,u)=>(_(),b(`div`,R,[l(a(f),{trigger:`click`,onCommand:W},{dropdown:y(()=>[l(a(T),null,{default:y(()=>[(_(!0),b(E,null,e(a(N),e=>(_(),r(a(n),{key:e.id,command:e.id},{default:y(()=>[i(`span`,V,[a(P)(e.id)?(_(),r(j,{key:0,executor:e.id,class:`agent-engine__item-icon`},null,8,[`executor`])):(_(),r(k,{key:1,"icon-class":a(F),class:`agent-engine__item-icon`},null,8,[`icon-class`])),i(`span`,H,d(e.name),1),t.engine===e.id?(_(),r(a(s),{key:2,class:`agent-engine__item-check`},{default:y(()=>[l(a(w))]),_:1})):S.value[e.id]?c(``,!0):(_(),b(`span`,U,d(a(D)(`@42BB9:未安装`)),1))])]),_:2},1032,[`command`]))),128))]),_:1})]),default:y(()=>[i(`button`,{type:`button`,class:C([`agent-engine__btn`,{"is-locked":t.locked}]),disabled:t.locked,title:t.locked?a(D)(`@AGENT:本会话的引擎已锁定;要换引擎请新建会话`):a(D)(`@AGENT:新建会话使用的引擎`),"aria-label":a(D)(`@AGENT:智能体引擎`)},[a(P)(t.engine)?(_(),r(j,{key:0,executor:t.engine,class:`agent-engine__icon`},null,8,[`executor`])):(_(),r(k,{key:1,"icon-class":a(F),class:`agent-engine__icon`},null,8,[`icon-class`])),i(`span`,B,d(x.value),1),l(a(s),{class:`agent-engine__caret`},{default:y(()=>[l(a(h))]),_:1})],10,z)]),_:1}),l(M,{modelValue:O.value,"onUpdate:modelValue":u[0]||=e=>O.value=e,tool:L.value},null,8,[`modelValue`,`tool`])]))}}),[[`__scopeId`,`data-v-81dfa007`]]);export{L as n,W as t};
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,C as n,Dn as r,En as i,Er as a,In as o,J as s,On as c,Pn as l,Pr as u,Qr as d,S as f,Tn as p,Wn as m,Y as h,Yn as g,Zn as _,br as v,cr as y,kn as b,pr as x,qn as S,qr as C,tt as w,w as T,xn as E}from"./element-plus-CgEuJBlB.js";import{n as D,t as O}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{t as k}from"./SvgIcon-B-2iTLW-.js";import{t as A}from"./toolsStore-B3LQrSEp.js";import{s as j,v as M}from"./index-aNSr4k87.js";import{c as N,d as P,l as F,u as I}from"./agentConversations-C0WoSH0y.js";t(),x();function L(e,t=680){let n=v(0),r=null;function i(){let t=e.value;return t?(n.value=t.clientWidth,typeof ResizeObserver>`u`||(r=new ResizeObserver(e=>{let t=e[0]?.contentRect?.width;typeof t==`number`&&(n.value=t)}),r.observe(t),!0)):!1}return g(()=>{i()||m(()=>i())}),S(()=>{r?.disconnect(),r=null}),{width:n,narrow:p(()=>n.value>0&&n.value<t)}}t(),x(),u();var R={class:`agent-engine`},z=[`disabled`,`title`,`aria-label`],B={class:`agent-engine__name`},V={class:`agent-engine__item`},H={class:`agent-engine__item-name`},U={key:3,class:`agent-engine__item-missing`},W=O(o({__name:`AgentEngineSelector`,props:{engine:{},locked:{type:Boolean}},emits:[`select`],setup(t,{emit:o}){let u=t,m=o,g=A(),x=p(()=>I(u.engine)),S=p(()=>({gai:!0,claude:g.claudeAvailable,opencode:g.opencodeAvailable,codex:g.codexAvailable})),O=v(!1),L=v(null);function W(e){if(!u.locked){if(!S.value[e]){if(!P(e))return;L.value=e,O.value=!0;return}m(`select`,e)}}return(o,u)=>(_(),b(`div`,R,[l(a(f),{trigger:`click`,onCommand:W},{dropdown:y(()=>[l(a(T),null,{default:y(()=>[(_(!0),b(E,null,e(a(N),e=>(_(),r(a(n),{key:e.id,command:e.id},{default:y(()=>[i(`span`,V,[a(P)(e.id)?(_(),r(j,{key:0,executor:e.id,class:`agent-engine__item-icon`},null,8,[`executor`])):(_(),r(k,{key:1,"icon-class":a(F),class:`agent-engine__item-icon`},null,8,[`icon-class`])),i(`span`,H,d(e.name),1),t.engine===e.id?(_(),r(a(s),{key:2,class:`agent-engine__item-check`},{default:y(()=>[l(a(w))]),_:1})):S.value[e.id]?c(``,!0):(_(),b(`span`,U,d(a(D)(`@42BB9:未安装`)),1))])]),_:2},1032,[`command`]))),128))]),_:1})]),default:y(()=>[i(`button`,{type:`button`,class:C([`agent-engine__btn`,{"is-locked":t.locked}]),disabled:t.locked,title:t.locked?a(D)(`@AGENT:本会话的引擎已锁定;要换引擎请新建会话`):a(D)(`@AGENT:新建会话使用的引擎`),"aria-label":a(D)(`@AGENT:智能体引擎`)},[a(P)(t.engine)?(_(),r(j,{key:0,executor:t.engine,class:`agent-engine__icon`},null,8,[`executor`])):(_(),r(k,{key:1,"icon-class":a(F),class:`agent-engine__icon`},null,8,[`icon-class`])),i(`span`,B,d(x.value),1),l(a(s),{class:`agent-engine__caret`},{default:y(()=>[l(a(h))]),_:1})],10,z)]),_:1}),l(M,{modelValue:O.value,"onUpdate:modelValue":u[0]||=e=>O.value=e,tool:L.value},null,8,[`modelValue`,`tool`])]))}}),[[`__scopeId`,`data-v-81dfa007`]]);export{L as n,W as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,At as t,Bn as n,Ct as r,Dn as i,En as a,Er as o,Gt as s,Ht as c,In as l,J as ee,M as u,Nn as d,On as f,Pn as p,Pr as m,Qr as h,Tn as g,Tt as _,W as te,Wn as v,Yr as y,Yt as ne,Zn as b,_n as x,a as S,an as C,br as w,cr as T,dn as E,et as D,i as O,j as re,kn as k,kt as A,lr as j,lt as M,mt as N,nr as P,o as ie,or as F,pr as I,qr as L,st as R,tt as ae,vr as oe,xn as z}from"./element-plus-CgEuJBlB.js";import{a as B,t as V}from"./vendor-CDZ64WVU.js";import{n as H,t as U}from"./_plugin-vue_export-helper-MIPci_U9.js";import{t as se}from"./configStore-BMixvVAA.js";import{t as ce}from"./CommonDialog-UrQUmb6G.js";import{a as W,i as le,n as ue,o as G,r as K,s as de,t as q}from"./agentConversations-D8mdZaNY.js";import{n as J,t as fe}from"./AgentEngineSelector-bQmJlH1b.js";n(),I(),E(),m();var Y={class:`marketplace-panel`},pe={class:`mp-toolbar`},me={class:`mp-search`},he=[`placeholder`],ge={class:`mp-toolbar-sub`},_e={class:`mp-target-hint`},X={class:`mp-source-filter`},ve=[`onClick`],ye={class:`mp-body`},be={class:`mp-group-header`},xe={class:`mp-group-title`},Se={key:0,class:`mp-group-count`},Ce={key:1,class:`mp-group-error`},we=[`href`,`title`],Te={key:0,class:`mp-grid`},Z={class:`mp-card-head`},Ee=[`title`],De={key:0,class:`mp-card-metric`},Q=[`title`],$={class:`mp-card-meta`},Oe=[`title`],ke=[`title`],Ae={key:2,class:`mp-tag remote`},je={class:`mp-card-foot`},Me=[`href`],Ne={key:1,class:`mp-installed-chip`},Pe=[`disabled`,`onClick`],Fe={key:3,class:`mp-not-installable`},Ie={key:1,class:`mp-empty`},Le={key:0,class:`mp-group installed`},Re={class:`mp-group-header`},ze={class:`mp-group-title`},Be={class:`mp-group-count`},Ve={key:0,class:`mp-installed-block`},He={class:`mp-installed-target`},Ue={class:`mp-installed-list`},We=[`title`],Ge=[`title`],Ke={key:1,class:`mp-meta-pkg`},qe={key:2,class:`mp-tag warn`},Je=[`disabled`,`title`,`onClick`],Ye=[`disabled`,`onClick`],Xe={key:1,class:`mp-empty all`},Ze={key:0,class:`mkt-form`},Qe={class:`mkt-form-name`},$e=[`onUpdate:modelValue`,`placeholder`],et={key:0,class:`mkt-field`},tt={class:`mkt-hint`},nt=U(l({__name:`MarketplacePanel`,props:{type:{}},setup(t){let n=t,l=se(),m=w([]),_=w([]),v=w(!1),y=w(``),E=w(``),D=w([]),P=w(`project`),I=w(new Set),R=w(new Set),B=w(new Set),V=g(()=>l.currentDirectory||``),U=null;async function W(){if(!v.value){v.value=!0;try{let e=new URLSearchParams({type:n.type,cwd:V.value});E.value&&e.set(`q`,E.value),D.value.length&&e.set(`sources`,D.value.join(`,`));let t=await(await fetch(`/api/agent/marketplace/catalog?${e}`)).json();t?.success?(m.value=t.groups||[],_.value=t.installed||[]):S.error(t?.error||H(`@MKT:加载失败`))}catch{S.error(H(`@MKT:加载失败`))}finally{v.value=!1}}}F(y,e=>{U&&clearTimeout(U),U=setTimeout(()=>{E.value=e.trim(),W()},400)}),F(D,()=>W()),F(()=>n.type,()=>{D.value=[],E.value=``,y.value=``,W()}),F(V,()=>W()),W();let le=g(()=>{let e=V.value?V.value.split(/[\\/]/).filter(Boolean).pop():``;return P.value===`project`?e||H(`@MKT:当前项目`):H(`@MKT:g ai 智能体`)});function ue(e){return e.stars?`${G(e.stars)} ★`:e.downloads?`${G(e.downloads)} ${H(`@MKT:周下载`)}`:e.uses?`${G(e.uses)} ${H(`@MKT:次使用`)}`:``}function G(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function K(e){return`${e.id}`}function de(e){return I.value.has(K(e))}let q=g(()=>{let e={project:[],global:[]};for(let t of _.value)(e[t.target]||=[]).push(t);return e}),J=oe({visible:!1,item:null,env:{},args:``});function fe(e){return n.type===`mcp`&&(!!e.envKeys?.length||!!e.args?.length)}function nt(e){J.item=e,J.env=Object.fromEntries((e.envKeys||[]).map(e=>[e,``])),J.args=(e.args||[]).join(` `),J.visible=!0}function rt(){let e=J.item;if(J.visible=!1,!e)return;let t=Object.fromEntries(Object.entries(J.env).filter(([,e])=>e.trim()!==``)),n=J.args.trim()?J.args.trim().match(/(?:[^\s"]+|"[^"]*")+/g)?.map(e=>e.replace(/^"|"$/g,``))??void 0:void 0;at(e,{env:t,...n?{args:n}:{}})}async function it(e){if(!e.installed||await ot(e)){if(fe(e)){nt(e);return}await at(e,{})}}async function at(e,t){let r=K(e);I.value.add(r);try{let r=await fetch(`/api/agent/marketplace/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:n.type,target:P.value,cwd:V.value,item:{...e,...t}})}),i=await r.json().catch(()=>null);if(!r.ok||!i?.success){S.error(i?.error||H(`@MKT:安装失败`));return}i.item?.warning&&S.warning(i.item.warning),i.item?.envKeys?.length?S.warning(`${H(`@MKT:还缺环境变量`)}: ${i.item.envKeys.join(`, `)}`):S.success(H(`@MKT:安装成功`)),await W()}catch{S.error(H(`@MKT:安装失败`))}finally{I.value.delete(r)}}async function ot(e){try{return await O.confirm(`${e.name} ${H(`@MKT:已安装,要重新安装吗?`)}`,H(`@MKT:重新安装`),{confirmButtonText:H(`@MKT:重装`),cancelButtonText:H(`@MKT:取消`),type:`warning`}),!0}catch{return!1}}async function st(e){let t=`${e.target}:${e.id}`;B.value.add(t);try{let t=await fetch(`/api/agent/marketplace/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:n.type,target:e.target,cwd:V.value,id:e.id})}),r=await t.json().catch(()=>null);(!t.ok||!r?.success)&&S.error(r?.error||H(`@MKT:打开失败`))}catch{S.error(H(`@MKT:打开失败`))}finally{B.value.delete(t)}}async function ct(e){try{await O.confirm(`${H(`@MKT:确定卸载`)} ${e.name}?`,H(`@MKT:卸载`),{confirmButtonText:H(`@MKT:卸载`),cancelButtonText:H(`@MKT:取消`),type:`warning`})}catch{return}let t=`${e.target}:${e.id}`;R.value.add(t);try{let t=new URLSearchParams({target:e.target,cwd:V.value}),r=await fetch(`/api/agent/marketplace/item/${n.type}/${encodeURIComponent(e.id)}?${t}`,{method:`DELETE`}),i=await r.json().catch(()=>null);if(!r.ok||!i?.success){S.error(i?.error||H(`@MKT:卸载失败`));return}S.success(H(`@MKT:已卸载`)),await W()}catch{S.error(H(`@MKT:卸载失败`))}finally{R.value.delete(t)}}return(n,l)=>{let g=ee,S=re,w=u,E=te,O=ie;return b(),k(`div`,Y,[a(`div`,pe,[a(`div`,me,[p(g,{class:`mp-search-icon`},{default:T(()=>[p(o(s))]),_:1}),j(a(`input`,{"onUpdate:modelValue":l[0]||=e=>y.value=e,class:`mp-search-input`,type:`text`,placeholder:t.type===`skill`?o(H)(`@MKT:搜索 Skill...`):o(H)(`@MKT:搜索 MCP 服务...`)},null,8,he),[[x,y.value]])]),p(w,{modelValue:P.value,"onUpdate:modelValue":l[1]||=e=>P.value=e,size:`small`,class:`mp-target`},{default:T(()=>[p(S,{value:`project`},{default:T(()=>[d(h(o(H)(`@MKT:当前项目`)),1)]),_:1}),p(S,{value:`global`},{default:T(()=>[d(h(o(H)(`@MKT:g ai 智能体`)),1)]),_:1})]),_:1},8,[`modelValue`]),p(E,{content:o(H)(`@MKT:刷新`),placement:`top`,"show-after":300},{default:T(()=>[a(`button`,{class:L([`mp-refresh`,{spinning:v.value}]),onClick:W},[p(g,null,{default:T(()=>[p(o(c))]),_:1})],2)]),_:1},8,[`content`])]),a(`div`,ge,[a(`span`,_e,[d(h(o(H)(`@MKT:安装到`))+` `,1),a(`b`,null,h(le.value),1)]),a(`div`,X,[(b(!0),k(z,null,e(m.value,e=>(b(),k(`button`,{key:e.id,class:L([`mp-chip`,{active:D.value.includes(e.id)}]),onClick:()=>{let t=D.value.indexOf(e.id);t>=0?D.value.splice(t,1):D.value.push(e.id)}},h(e.label),11,ve))),128)),D.value.length?(b(),k(`button`,{key:0,class:`mp-chip clear`,onClick:l[2]||=e=>D.value=[]},h(o(H)(`@MKT:全部来源`)),1)):f(``,!0)])]),j((b(),k(`div`,ye,[(b(!0),k(z,null,e(m.value,t=>(b(),k(`section`,{key:t.id,class:`mp-group`},[a(`header`,be,[a(`h3`,xe,h(t.label),1),t.status===`ok`?(b(),k(`span`,Se,h(t.items.length),1)):(b(),k(`span`,Ce,[p(g,null,{default:T(()=>[p(o(C))]),_:1}),d(` `+h(t.error||o(H)(`@MKT:来源不可用`)),1)])),t.homepage?(b(),k(`a`,{key:2,class:`mp-group-link`,href:t.homepage,target:`_blank`,rel:`noopener noreferrer`,title:t.homepage},[p(g,null,{default:T(()=>[p(o(A))]),_:1})],8,we)):f(``,!0)]),t.status===`ok`&&t.items.length?(b(),k(`div`,Te,[(b(!0),k(z,null,e(t.items,t=>(b(),k(`article`,{key:K(t),class:`mp-card`},[a(`div`,Z,[a(`span`,{class:`mp-card-name`,title:t.name},h(t.name),9,Ee),ue(t)?(b(),k(`span`,De,[p(g,null,{default:T(()=>[t.stars?(b(),i(o(ne),{key:0})):(b(),i(o(N),{key:1}))]),_:2},1024),d(` `+h(ue(t)),1)])):f(``,!0)]),a(`p`,{class:`mp-card-desc`,title:t.description},h(t.description||o(H)(`@MKT:暂无描述`)),9,Q),a(`div`,$,[t.package?(b(),k(`code`,{key:0,class:`mp-meta-pkg`,title:t.package},h(t.package),9,Oe)):t.repository?(b(),k(`span`,{key:1,class:`mp-meta-repo`,title:t.repository+(t.subpath?` · `+t.subpath:``)},[d(h(t.repository),1),t.subpath?(b(),k(z,{key:0},[d(` · `+h(t.subpath),1)],64)):f(``,!0)],8,ke)):f(``,!0),t.transport===`remote`?(b(),k(`span`,Ae,h(o(H)(`@MKT:远程服务`)),1)):f(``,!0),(b(!0),k(z,null,e((t.tags||[]).slice(0,2),e=>(b(),k(`span`,{key:e,class:`mp-tag`},h(e),1))),128))]),a(`div`,je,[t.upstream?(b(),k(`a`,{key:0,class:`mp-card-link`,href:t.upstream,target:`_blank`,rel:`noopener noreferrer`},h(o(H)(`@MKT:查看来源`)),9,Me)):f(``,!0),l[6]||=a(`span`,{class:`mp-foot-spacer`},null,-1),t.installed?(b(),k(`span`,Ne,[p(g,null,{default:T(()=>[p(o(ae))]),_:1}),d(h(o(H)(`@MKT:已安装`)),1)])):t.installable===!1?(b(),k(`span`,Fe,h(o(H)(`@MKT:暂不支持一键安装`)),1)):(b(),k(`button`,{key:2,class:`mp-install-btn`,disabled:de(t),onClick:e=>it(t)},h(de(t)?o(H)(`@MKT:安装中...`):o(H)(`@MKT:安装`)),9,Pe))])]))),128))])):t.status===`ok`?(b(),k(`div`,Ie,h(o(H)(`@MKT:该来源暂无结果`)),1)):f(``,!0)]))),128)),_.value.length?(b(),k(`section`,Le,[a(`header`,Re,[a(`h3`,ze,h(o(H)(`@MKT:已安装`)),1),a(`span`,Be,h(_.value.length),1)]),(b(),k(z,null,e([`project`,`global`],t=>a(`div`,{key:t},[q.value[t]?.length?(b(),k(`div`,Ve,[a(`div`,He,h(t===`project`?o(H)(`@MKT:当前项目`):o(H)(`@MKT:g ai 智能体`)),1),a(`div`,Ue,[(b(!0),k(z,null,e(q.value[t],e=>(b(),k(`div`,{key:t+e.id,class:`mp-installed-row`},[a(`span`,{class:`mp-installed-name`,title:e.name},h(e.name),9,We),e.id&&e.id!==e.name?(b(),k(`code`,{key:0,class:`mp-installed-id`,title:e.dir||e.file||e.id},h(e.id),9,Ge)):f(``,!0),e.package?(b(),k(`code`,Ke,h(e.package),1)):f(``,!0),e.requiredEnv?.length?(b(),k(`span`,qe,h(o(H)(`@MKT:待配置`))+`: `+h(e.requiredEnv.join(`, `)),1)):f(``,!0),l[7]||=a(`span`,{class:`mp-foot-spacer`},null,-1),a(`button`,{class:`mp-reveal-btn`,disabled:B.value.has(t+e.id),title:e.dir||e.file||``,onClick:t=>st(e)},[p(g,null,{default:T(()=>[p(o(r))]),_:1}),d(` `+h(o(H)(`@MKT:打开文件夹`)),1)],8,Je),a(`button`,{class:`mp-remove-btn`,disabled:R.value.has(t+e.id),onClick:t=>ct(e)},[p(g,null,{default:T(()=>[p(o(M))]),_:1}),d(` `+h(R.value.has(t+e.id)?o(H)(`@MKT:卸载中...`):o(H)(`@MKT:卸载`)),1)],8,Ye)]))),128))])])):f(``,!0)])),64))])):f(``,!0),!v.value&&!m.value.length?(b(),k(`div`,Xe,h(o(H)(`@MKT:加载失败`)),1)):f(``,!0)])),[[O,v.value]]),p(ce,{modelValue:J.visible,"onUpdate:modelValue":l[5]||=e=>J.visible=e,title:o(H)(`@MKT:配置 MCP`),width:`460px`,type:`flex`,"close-on-click-modal":!1,"append-to-body":``},{footer:T(()=>[a(`button`,{class:`mkt-cancel`,onClick:l[4]||=e=>J.visible=!1},h(o(H)(`@MKT:取消`)),1),a(`button`,{class:`mkt-confirm`,onClick:rt},h(o(H)(`@MKT:安装`)),1)]),default:T(()=>[J.item?(b(),k(`div`,Ze,[a(`p`,Qe,h(J.item.name),1),(b(!0),k(z,null,e(Object.keys(J.env),e=>(b(),k(`div`,{key:e,class:`mkt-field`},[a(`label`,null,h(e),1),j(a(`input`,{"onUpdate:modelValue":t=>J.env[e]=t,type:`text`,autocomplete:`off`,placeholder:o(H)(`@MKT:环境变量值`),spellcheck:`false`},null,8,$e),[[x,J.env[e]]])]))),128)),J.item.args?.length?(b(),k(`div`,et,[a(`label`,null,h(o(H)(`@MKT:启动参数`)),1),j(a(`input`,{"onUpdate:modelValue":l[3]||=e=>J.args=e,type:`text`,autocomplete:`off`,spellcheck:`false`},null,512),[[x,J.args]]),a(`p`,tt,h(o(H)(`@MKT:参数提示`)),1)])):f(``,!0)])):f(``,!0)]),_:1},8,[`modelValue`,`title`])])}}}),[[`__scopeId`,`data-v-79426bd0`]]);n(),I(),m();var rt={class:`agent-chat-area`},it={class:`agent-tabs`,role:`tablist`},at=[`aria-selected`,`onClick`],ot={class:`agent-tab-body`},st={key:0,class:`agent-chat-pane`},ct={key:0,class:`agent-list-page`},lt={key:0,class:`agent-page-bar`},ut=[`title`,`aria-label`],dt={class:`agent-page-title`},ft={key:0,class:`chat-loading`},pt=U(l({__name:`AgentView`,setup(n){let r=se(),s=w(null),{narrow:c}=J(s),l=w(`chat`),u=w(`chat`),d=g(()=>u.value===`mcp`?`mcp`:`skill`),m=g(()=>[{id:`chat`,label:H(`@AGENT:对话`),icon:D},{id:`skill`,label:H(`@AGENT:Skill 广场`),icon:_},{id:`mcp`,label:H(`@AGENT:MCP 广场`),icon:R}]),{sessions:te,sessionsLoading:ne,currentSessionId:x,messages:S,isStreaming:C,sessionLoading:E,loadSessions:O,loadSession:re,deleteSession:A,renameSession:j,newSession:M,sendMessage:N,pendingQuestion:ie,answeringQuestion:I,answerQuestion:ae,isSessionGenerating:oe,currentEngine:U,pendingEngine:ce,isEngineLocked:Y,pickEngine:pe,stop:me}=de(),he=g(()=>Y.value?U.value:ce.value);function ge(e){Y.value||pe(e)}let _e=g(()=>{let e=r.theme;return e===`dark`||e===`auto`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}),X=g(()=>W(te.value,oe)),ve=K(),ye=g(()=>X.value.find(e=>e.id===x.value)?.title||H(`@AGENT:对话`)),be={"--welcome-avatar":`url("${q}")`},xe=g(()=>[{id:`p1`,label:H(`@AGENT:查看项目结构`),prompt:H(`@AGENT:prompt_p1`)},{id:`p2`,label:H(`@AGENT:分析代码质量`),prompt:H(`@AGENT:prompt_p2`)},{id:`p3`,label:H(`@AGENT:帮我写测试`),prompt:H(`@AGENT:prompt_p3`)},{id:`p4`,label:H(`@AGENT:Git 状态检查`),prompt:H(`@AGENT:prompt_p4`)},{id:`p5`,label:H(`@AGENT:帮我启动项目`),prompt:H(`@AGENT:prompt_p5`)}]);async function Se(e){await N(e.text,e.files),await v(),Z()}async function Ce(e){await N(e.prompt),await v(),Z()}let we=le(),Te=w(null);function Z(e=!0){Te.value?.scrollToBottom(e)}F(()=>S.value.length,()=>{v(()=>Z(!1))});function Ee(e){re(e),l.value=`chat`}function De(){M(),l.value=`chat`}let Q=w(280),$=w(!1);function Oe(e){$.value=!0;let t=e.clientX,n=Q.value,r=e=>{let r=e.clientX-t,i=Math.max(200,Math.min(500,n+r));Q.value=i},i=()=>{$.value=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}return F(c,e=>{e||(l.value=`chat`)}),F(()=>[r.currentDirectory,C.value],async([e,t],n)=>{let r=!n||e!==n[0],i=!!n&&n[1]===!0&&!t;(r||i)&&await O(),x.value&&!C.value&&!te.value.some(e=>e.sessionId===x.value)&&M()},{immediate:!0}),(n,r)=>(b(),k(`div`,{ref_key:`rootRef`,ref:s,class:`agent-view`},[u.value===`chat`&&!o(c)?(b(),k(z,{key:0},[a(`aside`,{class:`agent-sidebar`,style:y({width:Q.value+`px`})},[p(o(V),{class:`agent-conversations`,items:X.value,"active-id":o(x),loading:o(ne),labels:o(ve),onSelect:Ee,onNew:De,onRename:o(j),onDelete:o(A)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],4),a(`div`,{class:L([`sidebar-resizer`,{active:$.value}]),onMousedown:Oe},null,34)],64)):f(``,!0),a(`main`,rt,[a(`nav`,it,[(b(!0),k(z,null,e(m.value,e=>(b(),k(`button`,{key:e.id,type:`button`,class:L([`agent-tab`,{active:u.value===e.id}]),role:`tab`,"aria-selected":u.value===e.id,onClick:t=>u.value=e.id},[p(o(ee),null,{default:T(()=>[(b(),i(P(e.icon)))]),_:2},1024),a(`span`,null,h(e.label),1)],10,at))),128)),u.value===`chat`?(b(),i(fe,{key:0,class:`agent-engine`,engine:he.value,locked:o(Y),onSelect:ge},null,8,[`engine`,`locked`])):f(``,!0)]),a(`div`,ot,[u.value===`chat`?(b(),k(`div`,st,[o(c)&&l.value===`list`?(b(),k(`div`,ct,[p(o(V),{class:`agent-conversations`,items:X.value,"active-id":o(x),loading:o(ne),labels:o(ve),onSelect:Ee,onNew:De,onRename:o(j),onDelete:o(A)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])])):(b(),k(z,{key:1},[o(c)?(b(),k(`div`,lt,[a(`button`,{type:`button`,class:`agent-page-back`,title:o(H)(`@AGENT:返回会话列表`),"aria-label":o(H)(`@AGENT:返回会话列表`),onClick:r[0]||=e=>l.value=`list`},[...r[1]||=[a(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[a(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),a(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,ut),a(`span`,dt,h(ye.value),1)])):f(``,!0),a(`div`,{class:`agent-chat-host`,style:be},[o(E)?(b(),k(`div`,ft,[p(o(ee),{class:`is-loading`,size:32},{default:T(()=>[p(o(t))]),_:1}),a(`span`,null,h(o(H)(`@AGENT:加载会话中...`)),1)])):(b(),i(o(B),{key:1,ref_key:`chatContainerRef`,ref:Te,messages:o(S),"preset-questions":xe.value,"welcome-title":o(H)(`@AGENT:智能体助手`),"welcome-description":o(H)(`@AGENT:我可以帮你阅读代码、执行命令、修改文件。选择下方话题或直接输入你的问题。`),"assistant-name":o(ue),"assistant-avatar":o(q),theme:_e.value,disabled:o(C),generating:o(C),"upload-config":{accept:o(G)},placeholder:o(C)?o(H)(`@AGENT:正在生成中...`):o(H)(`@AGENT:输入消息,Enter 发送`),question:o(ie),"question-submitting":o(I),"question-labels":o(we),"plan-config":{labels:{title:o(H)(`@AGENT:计划`),raw:o(H)(`@AGENT:原始参数`)}},onSend:Se,onSelect:Ce,onStop:o(me),onAnswer:o(ae)},null,8,[`messages`,`preset-questions`,`welcome-title`,`welcome-description`,`assistant-name`,`assistant-avatar`,`theme`,`disabled`,`generating`,`upload-config`,`placeholder`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onStop`,`onAnswer`]))])],64))])):(b(),i(nt,{key:1,type:d.value},null,8,[`type`]))])])],512))}}),[[`__scopeId`,`data-v-05972cec`]]);export{pt as default};
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,At as t,Bn as n,Ct as r,Dn as i,En as a,Er as o,Gt as s,Ht as c,In as l,J as ee,M as u,Nn as d,On as f,Pn as p,Pr as m,Qr as h,Tn as g,Tt as _,W as te,Wn as v,Yr as y,Yt as ne,Zn as b,_n as x,a as S,an as C,br as w,cr as T,dn as E,et as D,i as O,j as re,kn as k,kt as A,lr as j,lt as M,mt as N,nr as P,o as ie,or as F,pr as I,qr as L,st as R,tt as ae,vr as oe,xn as z}from"./element-plus-CgEuJBlB.js";import{a as B,t as V}from"./vendor-CDZ64WVU.js";import{n as H,t as U}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{t as se}from"./configStore-BFGSfIBp.js";import{t as ce}from"./CommonDialog-kDck8ITZ.js";import{a as W,i as le,n as ue,o as G,r as K,s as de,t as q}from"./agentConversations-C0WoSH0y.js";import{n as J,t as fe}from"./AgentEngineSelector-CGrUh2kD.js";n(),I(),E(),m();var Y={class:`marketplace-panel`},pe={class:`mp-toolbar`},me={class:`mp-search`},he=[`placeholder`],ge={class:`mp-toolbar-sub`},_e={class:`mp-target-hint`},X={class:`mp-source-filter`},ve=[`onClick`],ye={class:`mp-body`},be={class:`mp-group-header`},xe={class:`mp-group-title`},Se={key:0,class:`mp-group-count`},Ce={key:1,class:`mp-group-error`},we=[`href`,`title`],Te={key:0,class:`mp-grid`},Z={class:`mp-card-head`},Ee=[`title`],De={key:0,class:`mp-card-metric`},Q=[`title`],$={class:`mp-card-meta`},Oe=[`title`],ke=[`title`],Ae={key:2,class:`mp-tag remote`},je={class:`mp-card-foot`},Me=[`href`],Ne={key:1,class:`mp-installed-chip`},Pe=[`disabled`,`onClick`],Fe={key:3,class:`mp-not-installable`},Ie={key:1,class:`mp-empty`},Le={key:0,class:`mp-group installed`},Re={class:`mp-group-header`},ze={class:`mp-group-title`},Be={class:`mp-group-count`},Ve={key:0,class:`mp-installed-block`},He={class:`mp-installed-target`},Ue={class:`mp-installed-list`},We=[`title`],Ge=[`title`],Ke={key:1,class:`mp-meta-pkg`},qe={key:2,class:`mp-tag warn`},Je=[`disabled`,`title`,`onClick`],Ye=[`disabled`,`onClick`],Xe={key:1,class:`mp-empty all`},Ze={key:0,class:`mkt-form`},Qe={class:`mkt-form-name`},$e=[`onUpdate:modelValue`,`placeholder`],et={key:0,class:`mkt-field`},tt={class:`mkt-hint`},nt=U(l({__name:`MarketplacePanel`,props:{type:{}},setup(t){let n=t,l=se(),m=w([]),_=w([]),v=w(!1),y=w(``),E=w(``),D=w([]),P=w(`project`),I=w(new Set),R=w(new Set),B=w(new Set),V=g(()=>l.currentDirectory||``),U=null;async function W(){if(!v.value){v.value=!0;try{let e=new URLSearchParams({type:n.type,cwd:V.value});E.value&&e.set(`q`,E.value),D.value.length&&e.set(`sources`,D.value.join(`,`));let t=await(await fetch(`/api/agent/marketplace/catalog?${e}`)).json();t?.success?(m.value=t.groups||[],_.value=t.installed||[]):S.error(t?.error||H(`@MKT:加载失败`))}catch{S.error(H(`@MKT:加载失败`))}finally{v.value=!1}}}F(y,e=>{U&&clearTimeout(U),U=setTimeout(()=>{E.value=e.trim(),W()},400)}),F(D,()=>W()),F(()=>n.type,()=>{D.value=[],E.value=``,y.value=``,W()}),F(V,()=>W()),W();let le=g(()=>{let e=V.value?V.value.split(/[\\/]/).filter(Boolean).pop():``;return P.value===`project`?e||H(`@MKT:当前项目`):H(`@MKT:g ai 智能体`)});function ue(e){return e.stars?`${G(e.stars)} ★`:e.downloads?`${G(e.downloads)} ${H(`@MKT:周下载`)}`:e.uses?`${G(e.uses)} ${H(`@MKT:次使用`)}`:``}function G(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function K(e){return`${e.id}`}function de(e){return I.value.has(K(e))}let q=g(()=>{let e={project:[],global:[]};for(let t of _.value)(e[t.target]||=[]).push(t);return e}),J=oe({visible:!1,item:null,env:{},args:``});function fe(e){return n.type===`mcp`&&(!!e.envKeys?.length||!!e.args?.length)}function nt(e){J.item=e,J.env=Object.fromEntries((e.envKeys||[]).map(e=>[e,``])),J.args=(e.args||[]).join(` `),J.visible=!0}function rt(){let e=J.item;if(J.visible=!1,!e)return;let t=Object.fromEntries(Object.entries(J.env).filter(([,e])=>e.trim()!==``)),n=J.args.trim()?J.args.trim().match(/(?:[^\s"]+|"[^"]*")+/g)?.map(e=>e.replace(/^"|"$/g,``))??void 0:void 0;at(e,{env:t,...n?{args:n}:{}})}async function it(e){if(!e.installed||await ot(e)){if(fe(e)){nt(e);return}await at(e,{})}}async function at(e,t){let r=K(e);I.value.add(r);try{let r=await fetch(`/api/agent/marketplace/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:n.type,target:P.value,cwd:V.value,item:{...e,...t}})}),i=await r.json().catch(()=>null);if(!r.ok||!i?.success){S.error(i?.error||H(`@MKT:安装失败`));return}i.item?.warning&&S.warning(i.item.warning),i.item?.envKeys?.length?S.warning(`${H(`@MKT:还缺环境变量`)}: ${i.item.envKeys.join(`, `)}`):S.success(H(`@MKT:安装成功`)),await W()}catch{S.error(H(`@MKT:安装失败`))}finally{I.value.delete(r)}}async function ot(e){try{return await O.confirm(`${e.name} ${H(`@MKT:已安装,要重新安装吗?`)}`,H(`@MKT:重新安装`),{confirmButtonText:H(`@MKT:重装`),cancelButtonText:H(`@MKT:取消`),type:`warning`}),!0}catch{return!1}}async function st(e){let t=`${e.target}:${e.id}`;B.value.add(t);try{let t=await fetch(`/api/agent/marketplace/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:n.type,target:e.target,cwd:V.value,id:e.id})}),r=await t.json().catch(()=>null);(!t.ok||!r?.success)&&S.error(r?.error||H(`@MKT:打开失败`))}catch{S.error(H(`@MKT:打开失败`))}finally{B.value.delete(t)}}async function ct(e){try{await O.confirm(`${H(`@MKT:确定卸载`)} ${e.name}?`,H(`@MKT:卸载`),{confirmButtonText:H(`@MKT:卸载`),cancelButtonText:H(`@MKT:取消`),type:`warning`})}catch{return}let t=`${e.target}:${e.id}`;R.value.add(t);try{let t=new URLSearchParams({target:e.target,cwd:V.value}),r=await fetch(`/api/agent/marketplace/item/${n.type}/${encodeURIComponent(e.id)}?${t}`,{method:`DELETE`}),i=await r.json().catch(()=>null);if(!r.ok||!i?.success){S.error(i?.error||H(`@MKT:卸载失败`));return}S.success(H(`@MKT:已卸载`)),await W()}catch{S.error(H(`@MKT:卸载失败`))}finally{R.value.delete(t)}}return(n,l)=>{let g=ee,S=re,w=u,E=te,O=ie;return b(),k(`div`,Y,[a(`div`,pe,[a(`div`,me,[p(g,{class:`mp-search-icon`},{default:T(()=>[p(o(s))]),_:1}),j(a(`input`,{"onUpdate:modelValue":l[0]||=e=>y.value=e,class:`mp-search-input`,type:`text`,placeholder:t.type===`skill`?o(H)(`@MKT:搜索 Skill...`):o(H)(`@MKT:搜索 MCP 服务...`)},null,8,he),[[x,y.value]])]),p(w,{modelValue:P.value,"onUpdate:modelValue":l[1]||=e=>P.value=e,size:`small`,class:`mp-target`},{default:T(()=>[p(S,{value:`project`},{default:T(()=>[d(h(o(H)(`@MKT:当前项目`)),1)]),_:1}),p(S,{value:`global`},{default:T(()=>[d(h(o(H)(`@MKT:g ai 智能体`)),1)]),_:1})]),_:1},8,[`modelValue`]),p(E,{content:o(H)(`@MKT:刷新`),placement:`top`,"show-after":300},{default:T(()=>[a(`button`,{class:L([`mp-refresh`,{spinning:v.value}]),onClick:W},[p(g,null,{default:T(()=>[p(o(c))]),_:1})],2)]),_:1},8,[`content`])]),a(`div`,ge,[a(`span`,_e,[d(h(o(H)(`@MKT:安装到`))+` `,1),a(`b`,null,h(le.value),1)]),a(`div`,X,[(b(!0),k(z,null,e(m.value,e=>(b(),k(`button`,{key:e.id,class:L([`mp-chip`,{active:D.value.includes(e.id)}]),onClick:()=>{let t=D.value.indexOf(e.id);t>=0?D.value.splice(t,1):D.value.push(e.id)}},h(e.label),11,ve))),128)),D.value.length?(b(),k(`button`,{key:0,class:`mp-chip clear`,onClick:l[2]||=e=>D.value=[]},h(o(H)(`@MKT:全部来源`)),1)):f(``,!0)])]),j((b(),k(`div`,ye,[(b(!0),k(z,null,e(m.value,t=>(b(),k(`section`,{key:t.id,class:`mp-group`},[a(`header`,be,[a(`h3`,xe,h(t.label),1),t.status===`ok`?(b(),k(`span`,Se,h(t.items.length),1)):(b(),k(`span`,Ce,[p(g,null,{default:T(()=>[p(o(C))]),_:1}),d(` `+h(t.error||o(H)(`@MKT:来源不可用`)),1)])),t.homepage?(b(),k(`a`,{key:2,class:`mp-group-link`,href:t.homepage,target:`_blank`,rel:`noopener noreferrer`,title:t.homepage},[p(g,null,{default:T(()=>[p(o(A))]),_:1})],8,we)):f(``,!0)]),t.status===`ok`&&t.items.length?(b(),k(`div`,Te,[(b(!0),k(z,null,e(t.items,t=>(b(),k(`article`,{key:K(t),class:`mp-card`},[a(`div`,Z,[a(`span`,{class:`mp-card-name`,title:t.name},h(t.name),9,Ee),ue(t)?(b(),k(`span`,De,[p(g,null,{default:T(()=>[t.stars?(b(),i(o(ne),{key:0})):(b(),i(o(N),{key:1}))]),_:2},1024),d(` `+h(ue(t)),1)])):f(``,!0)]),a(`p`,{class:`mp-card-desc`,title:t.description},h(t.description||o(H)(`@MKT:暂无描述`)),9,Q),a(`div`,$,[t.package?(b(),k(`code`,{key:0,class:`mp-meta-pkg`,title:t.package},h(t.package),9,Oe)):t.repository?(b(),k(`span`,{key:1,class:`mp-meta-repo`,title:t.repository+(t.subpath?` · `+t.subpath:``)},[d(h(t.repository),1),t.subpath?(b(),k(z,{key:0},[d(` · `+h(t.subpath),1)],64)):f(``,!0)],8,ke)):f(``,!0),t.transport===`remote`?(b(),k(`span`,Ae,h(o(H)(`@MKT:远程服务`)),1)):f(``,!0),(b(!0),k(z,null,e((t.tags||[]).slice(0,2),e=>(b(),k(`span`,{key:e,class:`mp-tag`},h(e),1))),128))]),a(`div`,je,[t.upstream?(b(),k(`a`,{key:0,class:`mp-card-link`,href:t.upstream,target:`_blank`,rel:`noopener noreferrer`},h(o(H)(`@MKT:查看来源`)),9,Me)):f(``,!0),l[6]||=a(`span`,{class:`mp-foot-spacer`},null,-1),t.installed?(b(),k(`span`,Ne,[p(g,null,{default:T(()=>[p(o(ae))]),_:1}),d(h(o(H)(`@MKT:已安装`)),1)])):t.installable===!1?(b(),k(`span`,Fe,h(o(H)(`@MKT:暂不支持一键安装`)),1)):(b(),k(`button`,{key:2,class:`mp-install-btn`,disabled:de(t),onClick:e=>it(t)},h(de(t)?o(H)(`@MKT:安装中...`):o(H)(`@MKT:安装`)),9,Pe))])]))),128))])):t.status===`ok`?(b(),k(`div`,Ie,h(o(H)(`@MKT:该来源暂无结果`)),1)):f(``,!0)]))),128)),_.value.length?(b(),k(`section`,Le,[a(`header`,Re,[a(`h3`,ze,h(o(H)(`@MKT:已安装`)),1),a(`span`,Be,h(_.value.length),1)]),(b(),k(z,null,e([`project`,`global`],t=>a(`div`,{key:t},[q.value[t]?.length?(b(),k(`div`,Ve,[a(`div`,He,h(t===`project`?o(H)(`@MKT:当前项目`):o(H)(`@MKT:g ai 智能体`)),1),a(`div`,Ue,[(b(!0),k(z,null,e(q.value[t],e=>(b(),k(`div`,{key:t+e.id,class:`mp-installed-row`},[a(`span`,{class:`mp-installed-name`,title:e.name},h(e.name),9,We),e.id&&e.id!==e.name?(b(),k(`code`,{key:0,class:`mp-installed-id`,title:e.dir||e.file||e.id},h(e.id),9,Ge)):f(``,!0),e.package?(b(),k(`code`,Ke,h(e.package),1)):f(``,!0),e.requiredEnv?.length?(b(),k(`span`,qe,h(o(H)(`@MKT:待配置`))+`: `+h(e.requiredEnv.join(`, `)),1)):f(``,!0),l[7]||=a(`span`,{class:`mp-foot-spacer`},null,-1),a(`button`,{class:`mp-reveal-btn`,disabled:B.value.has(t+e.id),title:e.dir||e.file||``,onClick:t=>st(e)},[p(g,null,{default:T(()=>[p(o(r))]),_:1}),d(` `+h(o(H)(`@MKT:打开文件夹`)),1)],8,Je),a(`button`,{class:`mp-remove-btn`,disabled:R.value.has(t+e.id),onClick:t=>ct(e)},[p(g,null,{default:T(()=>[p(o(M))]),_:1}),d(` `+h(R.value.has(t+e.id)?o(H)(`@MKT:卸载中...`):o(H)(`@MKT:卸载`)),1)],8,Ye)]))),128))])])):f(``,!0)])),64))])):f(``,!0),!v.value&&!m.value.length?(b(),k(`div`,Xe,h(o(H)(`@MKT:加载失败`)),1)):f(``,!0)])),[[O,v.value]]),p(ce,{modelValue:J.visible,"onUpdate:modelValue":l[5]||=e=>J.visible=e,title:o(H)(`@MKT:配置 MCP`),width:`460px`,type:`flex`,"close-on-click-modal":!1,"append-to-body":``},{footer:T(()=>[a(`button`,{class:`mkt-cancel`,onClick:l[4]||=e=>J.visible=!1},h(o(H)(`@MKT:取消`)),1),a(`button`,{class:`mkt-confirm`,onClick:rt},h(o(H)(`@MKT:安装`)),1)]),default:T(()=>[J.item?(b(),k(`div`,Ze,[a(`p`,Qe,h(J.item.name),1),(b(!0),k(z,null,e(Object.keys(J.env),e=>(b(),k(`div`,{key:e,class:`mkt-field`},[a(`label`,null,h(e),1),j(a(`input`,{"onUpdate:modelValue":t=>J.env[e]=t,type:`text`,autocomplete:`off`,placeholder:o(H)(`@MKT:环境变量值`),spellcheck:`false`},null,8,$e),[[x,J.env[e]]])]))),128)),J.item.args?.length?(b(),k(`div`,et,[a(`label`,null,h(o(H)(`@MKT:启动参数`)),1),j(a(`input`,{"onUpdate:modelValue":l[3]||=e=>J.args=e,type:`text`,autocomplete:`off`,spellcheck:`false`},null,512),[[x,J.args]]),a(`p`,tt,h(o(H)(`@MKT:参数提示`)),1)])):f(``,!0)])):f(``,!0)]),_:1},8,[`modelValue`,`title`])])}}}),[[`__scopeId`,`data-v-79426bd0`]]);n(),I(),m();var rt={class:`agent-chat-area`},it={class:`agent-tabs`,role:`tablist`},at=[`aria-selected`,`onClick`],ot={class:`agent-tab-body`},st={key:0,class:`agent-chat-pane`},ct={key:0,class:`agent-list-page`},lt={key:0,class:`agent-page-bar`},ut=[`title`,`aria-label`],dt={class:`agent-page-title`},ft={key:0,class:`chat-loading`},pt=U(l({__name:`AgentView`,setup(n){let r=se(),s=w(null),{narrow:c}=J(s),l=w(`chat`),u=w(`chat`),d=g(()=>u.value===`mcp`?`mcp`:`skill`),m=g(()=>[{id:`chat`,label:H(`@AGENT:对话`),icon:D},{id:`skill`,label:H(`@AGENT:Skill 广场`),icon:_},{id:`mcp`,label:H(`@AGENT:MCP 广场`),icon:R}]),{sessions:te,sessionsLoading:ne,currentSessionId:x,messages:S,isStreaming:C,sessionLoading:E,loadSessions:O,loadSession:re,deleteSession:A,renameSession:j,newSession:M,sendMessage:N,pendingQuestion:ie,answeringQuestion:I,answerQuestion:ae,isSessionGenerating:oe,currentEngine:U,pendingEngine:ce,isEngineLocked:Y,pickEngine:pe,stop:me}=de(),he=g(()=>Y.value?U.value:ce.value);function ge(e){Y.value||pe(e)}let _e=g(()=>{let e=r.theme;return e===`dark`||e===`auto`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}),X=g(()=>W(te.value,oe)),ve=K(),ye=g(()=>X.value.find(e=>e.id===x.value)?.title||H(`@AGENT:对话`)),be={"--welcome-avatar":`url("${q}")`},xe=g(()=>[{id:`p1`,label:H(`@AGENT:查看项目结构`),prompt:H(`@AGENT:prompt_p1`)},{id:`p2`,label:H(`@AGENT:分析代码质量`),prompt:H(`@AGENT:prompt_p2`)},{id:`p3`,label:H(`@AGENT:帮我写测试`),prompt:H(`@AGENT:prompt_p3`)},{id:`p4`,label:H(`@AGENT:Git 状态检查`),prompt:H(`@AGENT:prompt_p4`)},{id:`p5`,label:H(`@AGENT:帮我启动项目`),prompt:H(`@AGENT:prompt_p5`)}]);async function Se(e){await N(e.text,e.files),await v(),Z()}async function Ce(e){await N(e.prompt),await v(),Z()}let we=le(),Te=w(null);function Z(e=!0){Te.value?.scrollToBottom(e)}F(()=>S.value.length,()=>{v(()=>Z(!1))});function Ee(e){re(e),l.value=`chat`}function De(){M(),l.value=`chat`}let Q=w(280),$=w(!1);function Oe(e){$.value=!0;let t=e.clientX,n=Q.value,r=e=>{let r=e.clientX-t,i=Math.max(200,Math.min(500,n+r));Q.value=i},i=()=>{$.value=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}return F(c,e=>{e||(l.value=`chat`)}),F(()=>[r.currentDirectory,C.value],async([e,t],n)=>{let r=!n||e!==n[0],i=!!n&&n[1]===!0&&!t;(r||i)&&await O(),x.value&&!C.value&&!te.value.some(e=>e.sessionId===x.value)&&M()},{immediate:!0}),(n,r)=>(b(),k(`div`,{ref_key:`rootRef`,ref:s,class:`agent-view`},[u.value===`chat`&&!o(c)?(b(),k(z,{key:0},[a(`aside`,{class:`agent-sidebar`,style:y({width:Q.value+`px`})},[p(o(V),{class:`agent-conversations`,items:X.value,"active-id":o(x),loading:o(ne),labels:o(ve),onSelect:Ee,onNew:De,onRename:o(j),onDelete:o(A)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],4),a(`div`,{class:L([`sidebar-resizer`,{active:$.value}]),onMousedown:Oe},null,34)],64)):f(``,!0),a(`main`,rt,[a(`nav`,it,[(b(!0),k(z,null,e(m.value,e=>(b(),k(`button`,{key:e.id,type:`button`,class:L([`agent-tab`,{active:u.value===e.id}]),role:`tab`,"aria-selected":u.value===e.id,onClick:t=>u.value=e.id},[p(o(ee),null,{default:T(()=>[(b(),i(P(e.icon)))]),_:2},1024),a(`span`,null,h(e.label),1)],10,at))),128)),u.value===`chat`?(b(),i(fe,{key:0,class:`agent-engine`,engine:he.value,locked:o(Y),onSelect:ge},null,8,[`engine`,`locked`])):f(``,!0)]),a(`div`,ot,[u.value===`chat`?(b(),k(`div`,st,[o(c)&&l.value===`list`?(b(),k(`div`,ct,[p(o(V),{class:`agent-conversations`,items:X.value,"active-id":o(x),loading:o(ne),labels:o(ve),onSelect:Ee,onNew:De,onRename:o(j),onDelete:o(A)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])])):(b(),k(z,{key:1},[o(c)?(b(),k(`div`,lt,[a(`button`,{type:`button`,class:`agent-page-back`,title:o(H)(`@AGENT:返回会话列表`),"aria-label":o(H)(`@AGENT:返回会话列表`),onClick:r[0]||=e=>l.value=`list`},[...r[1]||=[a(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[a(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),a(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,ut),a(`span`,dt,h(ye.value),1)])):f(``,!0),a(`div`,{class:`agent-chat-host`,style:be},[o(E)?(b(),k(`div`,ft,[p(o(ee),{class:`is-loading`,size:32},{default:T(()=>[p(o(t))]),_:1}),a(`span`,null,h(o(H)(`@AGENT:加载会话中...`)),1)])):(b(),i(o(B),{key:1,ref_key:`chatContainerRef`,ref:Te,messages:o(S),"preset-questions":xe.value,"welcome-title":o(H)(`@AGENT:智能体助手`),"welcome-description":o(H)(`@AGENT:我可以帮你阅读代码、执行命令、修改文件。选择下方话题或直接输入你的问题。`),"assistant-name":o(ue),"assistant-avatar":o(q),theme:_e.value,disabled:o(C),generating:o(C),"upload-config":{accept:o(G)},placeholder:o(C)?o(H)(`@AGENT:正在生成中...`):o(H)(`@AGENT:输入消息,Enter 发送`),question:o(ie),"question-submitting":o(I),"question-labels":o(we),"plan-config":{labels:{title:o(H)(`@AGENT:计划`),raw:o(H)(`@AGENT:原始参数`)}},onSend:Se,onSelect:Ce,onStop:o(me),onAnswer:o(ae)},null,8,[`messages`,`preset-questions`,`welcome-title`,`welcome-description`,`assistant-name`,`assistant-avatar`,`theme`,`disabled`,`generating`,`upload-config`,`placeholder`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onStop`,`onAnswer`]))])],64))])):(b(),i(nt,{key:1,type:d.value},null,8,[`type`]))])])],512))}}),[[`__scopeId`,`data-v-05972cec`]]);export{pt as default};
@@ -1,2 +1,2 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{At as e,Bn as t,Dn as n,En as r,Er as i,In as a,J as o,Nn as s,On as c,Pn as l,Pr as u,Qr as d,Tn as f,W as p,Wn as m,Yn as h,Zn as g,a as _,br as v,cr as y,i as b,kn as x,nt as S,or as C,pr as w,qn as T,qr as E,rt as D,z as O}from"./element-plus-CgEuJBlB.js";import{n as k,t as A}from"./_plugin-vue_export-helper-MIPci_U9.js";import{t as j}from"./CommonDialog-UrQUmb6G.js";async function M(e,t){let n=e.body.getReader(),r=new TextDecoder(`utf-8`),i=``;for(;;){let{done:e,value:a}=await n.read();if(e)break;i+=r.decode(a,{stream:!0});let o=i.split(`
2
- `);i=o.pop()??``;for(let e of o)e.trim()&&t(e)}i.trim()&&t(i)}async function N(){let e=await fetch(`/api/app-version`);return e.ok?e.json():{success:!1,current:``,latest:null,hasUpdate:!1,error:`HTTP ${e.status}`}}async function P(e){let t=await fetch(`/api/app-upgrade`,{method:`POST`});if(!t.ok){let n=`HTTP ${t.status}`;try{let e=await t.json();e?.error&&(n=e.error)}catch{}e({type:`error`,message:n}),e({type:`done`,code:t.status});return}if(!t.body){e({type:`error`,message:`响应无 body`}),e({type:`done`,code:-1});return}await M(t,t=>{try{e(JSON.parse(t))}catch{}})}async function F(){let e=await fetch(`/api/app-restart`,{method:`POST`});if(!e.ok){let t=`HTTP ${e.status}`;try{let n=await e.json();n?.error&&(t=n.error)}catch{}throw Error(t)}if(!e.body)throw Error(`响应无 body`);return new Promise((t,n)=>{let r=!1,i=e=>{r||(r=!0,e())};M(e,e=>{try{let r=JSON.parse(e);r.type===`ready`&&typeof r.port==`number`&&r.port>0?i(()=>t(r.port)):r.type===`timeout`?i(()=>n(Error(`restart.timeout`))):r.type===`error`&&i(()=>n(Error(r.message||`restart.failed`)))}catch{}}).then(()=>{i(()=>n(Error(`restart.stream-closed`)))}).catch(()=>{})})}t(),w(),u();var I={key:3},L={key:4},R={key:5},z={key:0,class:`upgrade-hint`},B={key:0,class:`upgrade-countdown`},V={key:1,class:`upgrade-manual`},H={class:`upgrade-manual__label`},U=`npm install -g zen-gitsync --registry https://registry.npmjs.org/`,W=A(a({__name:`UpgradeDialog`,props:{modelValue:{type:Boolean},logs:{},status:{},countdown:{default:0}},emits:[`update:modelValue`,`retry`,`restart`,`cancel`],setup(t,{emit:a}){let u=t,f=a,p=v(null);C(()=>u.logs,async()=>{await m(),p.value&&(p.value.scrollTop=p.value.scrollHeight)});function h(){u.status!==`running`&&(u.status===`success`&&u.countdown>0&&f(`cancel`),f(`update:modelValue`,!1))}function b(){f(`retry`)}function w(){f(`restart`)}function T(){f(`cancel`),f(`update:modelValue`,!1)}async function A(){try{await navigator.clipboard.writeText(U),_.success(k(`@F13B4:已复制升级命令`))}catch{_.warning(k(`@F13B4:复制失败,请手动复制`))}}return(a,u)=>{let m=o,_=O;return g(),n(j,{"model-value":t.modelValue,"onUpdate:modelValue":u[0]||=e=>f(`update:modelValue`,e),title:i(k)(`@F13B4:升级`),width:`680px`,type:`flex`,"close-on-click-modal":!1,"close-on-press-escape":!1,"show-close":t.status!==`running`,"append-to-body":``,onClose:h},{footer:y(()=>[t.status===`failed`?(g(),n(_,{key:0,type:`primary`,onClick:b},{default:y(()=>[s(d(i(k)(`@F13B4:重试`)),1)]),_:1})):c(``,!0),t.status===`failed`?(g(),n(_,{key:1,onClick:A},{default:y(()=>[s(d(i(k)(`@F13B4:复制升级命令`)),1)]),_:1})):c(``,!0),t.status===`success`?(g(),n(_,{key:2,type:`primary`,onClick:w},{default:y(()=>[s(d(i(k)(`@F13B4:立即重启并刷新`)),1)]),_:1})):c(``,!0),t.status===`success`?(g(),n(_,{key:3,onClick:T},{default:y(()=>[s(d(i(k)(`@F13B4:稍后手动重启`)),1)]),_:1})):c(``,!0),t.status===`running`?(g(),n(_,{key:4,disabled:``},{default:y(()=>[s(d(i(k)(`@F13B4:升级中`))+`... `,1)]),_:1})):c(``,!0)]),default:y(()=>[r(`div`,{class:E([`upgrade-status`,`is-${t.status}`])},[t.status===`running`?(g(),n(m,{key:0,class:`is-loading`},{default:y(()=>[l(i(e))]),_:1})):t.status===`success`?(g(),n(m,{key:1,color:`var(--color-success)`},{default:y(()=>[l(i(S))]),_:1})):(g(),n(m,{key:2,color:`var(--color-danger)`},{default:y(()=>[l(i(D))]),_:1})),t.status===`running`?(g(),x(`span`,I,d(i(k)(`@F13B4:升级中`)),1)):t.status===`success`?(g(),x(`span`,L,d(i(k)(`@F13B4:升级完成`)),1)):(g(),x(`span`,R,d(i(k)(`@F13B4:升级失败`)),1))],2),t.status===`success`?(g(),x(`p`,z,[s(d(i(k)(`@F13B4:新版本已全局安装,需要重启服务才能生效`))+` `,1),t.countdown>0?(g(),x(`span`,B,d(i(k)(`@F13B4:{seconds} 秒后自动刷新`,{seconds:t.countdown})),1)):c(``,!0)])):c(``,!0),t.status===`failed`?(g(),x(`p`,V,[r(`span`,H,d(i(k)(`@F13B4:手动升级命令`)),1),r(`code`,{class:`upgrade-manual__cmd`},d(U))])):c(``,!0),r(`pre`,{ref_key:`logEl`,ref:p,class:`upgrade-log`},d(t.logs||i(k)(`@F13B4:等待日志输出`)),513)]),_:1},8,[`model-value`,`title`,`show-close`])}}}),[[`__scopeId`,`data-v-5c9f402d`]]);t(),w(),u();var G={class:`app-version-badge`},K=[`aria-label`],q=[`aria-label`],J=[`title`,`aria-label`],Y={class:`upgrade-btn__label`},X={class:`upgrade-btn__version`},Z=`https://github.com/xz333221/zen-gitsync/releases`,Q=5,$=`app-version-check`,ee=36e5,te=A(a({__name:`AppVersionBadge`,setup(e){let t=`2.17.31`,n=v(t),a=f(()=>n.value||t),o=v(null),s=v(!1),u=v(``),m=v(`running`),S=v(0),C=null,w=v(!1);function E(){try{let e=sessionStorage.getItem($);if(!e)return null;let{at:t,data:n}=JSON.parse(e);return Date.now()-t>ee?null:n}catch{return null}}function D(e){try{sessionStorage.setItem($,JSON.stringify({at:Date.now(),data:e}))}catch{}}async function O(e=!1){let t=E();t&&(o.value=t);try{let t=await N();o.value=t,D(t),t.current&&(n.value=t.current),!e&&t.success&&t.hasUpdate&&_({type:`success`,message:k(`@F13B4:发现新版本 {version}`,{version:t.latest??``}),duration:4e3})}catch(t){e||_({type:`warning`,message:k(`@F13B4:检查更新失败 {error}`,{error:t?.message||``})})}}async function A(){if(o.value?.hasUpdate){try{await b.confirm(k(`@F13B4:确定要从 {current} 升级到 {latest} 吗?`,{current:o.value.current,latest:o.value.latest}),k(`@F13B4:升级`),{confirmButtonText:k(`@F13B4:确定升级`),cancelButtonText:k(`@F13B4:取消`),type:`info`})}catch{return}u.value=``,m.value=`running`,s.value=!0,await P(e=>{if(e.type===`done`){if(m.value=e.code===0?`success`:`failed`,e.code===0){try{sessionStorage.removeItem($)}catch{}o.value?.latest&&(n.value=o.value.latest),j()}}else e.message&&(u.value+=e.message)})}}function j(){M(),S.value=Q,C=setInterval(()=>{--S.value,S.value<=0&&(C&&=(clearInterval(C),null),L())},1e3)}function M(){C&&=(clearInterval(C),null),S.value=0}function I(){M()}async function L(){if(M(),!w.value){w.value=!0;try{let e=await F(),{pathname:t,search:n,hash:r}=window.location;window.location.href=`http://localhost:${e}${t}${n}${r}`}catch(e){let t=e?.message||``,n={"restart.timeout":`@F13B4:重启超时`,"restart.stream-closed":`@F13B4:重启失败,请刷新页面重试`,"restart.failed":`@F13B4:重启失败`}[t];_({type:`warning`,message:n?k(n):k(`@F13B4:重启失败 {error}`,{error:t})}),w.value=!1}}}return T(()=>{M()}),h(()=>{O(!0)}),(e,t)=>{let n=p;return g(),x(`div`,G,[l(n,{content:i(k)(`@F13B4:在 GitHub 上查看源码`),placement:`top`,effect:`dark`,"show-after":300},{default:y(()=>[r(`a`,{href:`https://github.com/xz333221/zen-gitsync`,target:`_blank`,rel:`noopener noreferrer`,class:`badge-icon-link`,"aria-label":i(k)(`@F13B4:在 GitHub 上查看源码`)},[...t[1]||=[r(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,"aria-hidden":`true`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{d:`M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.02 10.02 0 0 0 22 12.017C22 6.484 17.522 2 12 2z`})],-1)]],8,K)]),_:1},8,[`content`]),l(n,{content:i(k)(`@F13B4:在 npm 上查看包`),placement:`top`,effect:`dark`,"show-after":300},{default:y(()=>[r(`a`,{href:`https://www.npmjs.com/package/zen-gitsync`,target:`_blank`,rel:`noopener noreferrer`,class:`badge-icon-link badge-icon-link--npm`,"aria-label":i(k)(`@F13B4:在 npm 上查看包`)},[...t[2]||=[r(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,"aria-hidden":`true`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{d:`M2 2v20h20V2H2zm17.167 17.167H12.5v-10h-3.333v10H4.833V4.833h14.334v14.334z`})],-1)]],8,q)]),_:1},8,[`content`]),l(n,{content:i(k)(`@F13B4:查看更新`),placement:`top`,effect:`dark`,"show-after":300},{default:y(()=>[r(`a`,{href:Z,target:`_blank`,rel:`noopener noreferrer`,class:`version-link`},`v`+d(a.value),1)]),_:1},8,[`content`]),o.value?.hasUpdate?(g(),x(`button`,{key:0,type:`button`,class:`upgrade-btn`,title:i(k)(`@F13B4:发现新版本 {version},点击升级`,{version:o.value.latest??``}),"aria-label":i(k)(`@F13B4:发现新版本 {version},点击升级`,{version:o.value.latest??``}),onClick:A},[t[3]||=r(`span`,{class:`upgrade-btn__dot`,"aria-hidden":`true`},null,-1),r(`span`,Y,d(i(k)(`@F13B4:升级`)),1),r(`span`,X,`v`+d(o.value.latest),1)],8,J)):c(``,!0),l(W,{modelValue:s.value,"onUpdate:modelValue":t[0]||=e=>s.value=e,logs:u.value,status:m.value,countdown:S.value,onRetry:A,onRestart:L,onCancel:I},null,8,[`modelValue`,`logs`,`status`,`countdown`])])}}}),[[`__scopeId`,`data-v-4084e4be`]]);export{te as default};
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{At as e,Bn as t,Dn as n,En as r,Er as i,In as a,J as o,Nn as s,On as c,Pn as l,Pr as u,Qr as d,Tn as f,W as p,Wn as m,Yn as h,Zn as g,a as _,br as v,cr as y,i as b,kn as x,nt as S,or as C,pr as w,qn as T,qr as E,rt as D,z as O}from"./element-plus-CgEuJBlB.js";import{n as k,t as A}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{t as j}from"./CommonDialog-kDck8ITZ.js";async function M(e,t){let n=e.body.getReader(),r=new TextDecoder(`utf-8`),i=``;for(;;){let{done:e,value:a}=await n.read();if(e)break;i+=r.decode(a,{stream:!0});let o=i.split(`
2
+ `);i=o.pop()??``;for(let e of o)e.trim()&&t(e)}i.trim()&&t(i)}async function N(){let e=await fetch(`/api/app-version`);return e.ok?e.json():{success:!1,current:``,latest:null,hasUpdate:!1,error:`HTTP ${e.status}`}}async function P(e){let t=await fetch(`/api/app-upgrade`,{method:`POST`});if(!t.ok){let n=`HTTP ${t.status}`;try{let e=await t.json();e?.error&&(n=e.error)}catch{}e({type:`error`,message:n}),e({type:`done`,code:t.status});return}if(!t.body){e({type:`error`,message:`响应无 body`}),e({type:`done`,code:-1});return}await M(t,t=>{try{e(JSON.parse(t))}catch{}})}async function F(){let e=await fetch(`/api/app-restart`,{method:`POST`});if(!e.ok){let t=`HTTP ${e.status}`;try{let n=await e.json();n?.error&&(t=n.error)}catch{}throw Error(t)}if(!e.body)throw Error(`响应无 body`);return new Promise((t,n)=>{let r=!1,i=e=>{r||(r=!0,e())};M(e,e=>{try{let r=JSON.parse(e);r.type===`ready`&&typeof r.port==`number`&&r.port>0?i(()=>t(r.port)):r.type===`timeout`?i(()=>n(Error(`restart.timeout`))):r.type===`error`&&i(()=>n(Error(r.message||`restart.failed`)))}catch{}}).then(()=>{i(()=>n(Error(`restart.stream-closed`)))}).catch(()=>{})})}t(),w(),u();var I={key:3},L={key:4},R={key:5},z={key:0,class:`upgrade-hint`},B={key:0,class:`upgrade-countdown`},V={key:1,class:`upgrade-manual`},H={class:`upgrade-manual__label`},U=`npm install -g zen-gitsync --registry https://registry.npmjs.org/`,W=A(a({__name:`UpgradeDialog`,props:{modelValue:{type:Boolean},logs:{},status:{},countdown:{default:0}},emits:[`update:modelValue`,`retry`,`restart`,`cancel`],setup(t,{emit:a}){let u=t,f=a,p=v(null);C(()=>u.logs,async()=>{await m(),p.value&&(p.value.scrollTop=p.value.scrollHeight)});function h(){u.status!==`running`&&(u.status===`success`&&u.countdown>0&&f(`cancel`),f(`update:modelValue`,!1))}function b(){f(`retry`)}function w(){f(`restart`)}function T(){f(`cancel`),f(`update:modelValue`,!1)}async function A(){try{await navigator.clipboard.writeText(U),_.success(k(`@F13B4:已复制升级命令`))}catch{_.warning(k(`@F13B4:复制失败,请手动复制`))}}return(a,u)=>{let m=o,_=O;return g(),n(j,{"model-value":t.modelValue,"onUpdate:modelValue":u[0]||=e=>f(`update:modelValue`,e),title:i(k)(`@F13B4:升级`),width:`680px`,type:`flex`,"close-on-click-modal":!1,"close-on-press-escape":!1,"show-close":t.status!==`running`,"append-to-body":``,onClose:h},{footer:y(()=>[t.status===`failed`?(g(),n(_,{key:0,type:`primary`,onClick:b},{default:y(()=>[s(d(i(k)(`@F13B4:重试`)),1)]),_:1})):c(``,!0),t.status===`failed`?(g(),n(_,{key:1,onClick:A},{default:y(()=>[s(d(i(k)(`@F13B4:复制升级命令`)),1)]),_:1})):c(``,!0),t.status===`success`?(g(),n(_,{key:2,type:`primary`,onClick:w},{default:y(()=>[s(d(i(k)(`@F13B4:立即重启并刷新`)),1)]),_:1})):c(``,!0),t.status===`success`?(g(),n(_,{key:3,onClick:T},{default:y(()=>[s(d(i(k)(`@F13B4:稍后手动重启`)),1)]),_:1})):c(``,!0),t.status===`running`?(g(),n(_,{key:4,disabled:``},{default:y(()=>[s(d(i(k)(`@F13B4:升级中`))+`... `,1)]),_:1})):c(``,!0)]),default:y(()=>[r(`div`,{class:E([`upgrade-status`,`is-${t.status}`])},[t.status===`running`?(g(),n(m,{key:0,class:`is-loading`},{default:y(()=>[l(i(e))]),_:1})):t.status===`success`?(g(),n(m,{key:1,color:`var(--color-success)`},{default:y(()=>[l(i(S))]),_:1})):(g(),n(m,{key:2,color:`var(--color-danger)`},{default:y(()=>[l(i(D))]),_:1})),t.status===`running`?(g(),x(`span`,I,d(i(k)(`@F13B4:升级中`)),1)):t.status===`success`?(g(),x(`span`,L,d(i(k)(`@F13B4:升级完成`)),1)):(g(),x(`span`,R,d(i(k)(`@F13B4:升级失败`)),1))],2),t.status===`success`?(g(),x(`p`,z,[s(d(i(k)(`@F13B4:新版本已全局安装,需要重启服务才能生效`))+` `,1),t.countdown>0?(g(),x(`span`,B,d(i(k)(`@F13B4:{seconds} 秒后自动刷新`,{seconds:t.countdown})),1)):c(``,!0)])):c(``,!0),t.status===`failed`?(g(),x(`p`,V,[r(`span`,H,d(i(k)(`@F13B4:手动升级命令`)),1),r(`code`,{class:`upgrade-manual__cmd`},d(U))])):c(``,!0),r(`pre`,{ref_key:`logEl`,ref:p,class:`upgrade-log`},d(t.logs||i(k)(`@F13B4:等待日志输出`)),513)]),_:1},8,[`model-value`,`title`,`show-close`])}}}),[[`__scopeId`,`data-v-5c9f402d`]]);t(),w(),u();var G={class:`app-version-badge`},K=[`aria-label`],q=[`aria-label`],J=[`title`,`aria-label`],Y={class:`upgrade-btn__label`},X={class:`upgrade-btn__version`},Z=`https://github.com/xz333221/zen-gitsync/releases`,Q=5,$=`app-version-check`,ee=36e5,te=A(a({__name:`AppVersionBadge`,setup(e){let t=`2.17.33`,n=v(t),a=f(()=>n.value||t),o=v(null),s=v(!1),u=v(``),m=v(`running`),S=v(0),C=null,w=v(!1);function E(){try{let e=sessionStorage.getItem($);if(!e)return null;let{at:t,data:n}=JSON.parse(e);return Date.now()-t>ee?null:n}catch{return null}}function D(e){try{sessionStorage.setItem($,JSON.stringify({at:Date.now(),data:e}))}catch{}}async function O(e=!1){let t=E();t&&(o.value=t);try{let t=await N();o.value=t,D(t),t.current&&(n.value=t.current),!e&&t.success&&t.hasUpdate&&_({type:`success`,message:k(`@F13B4:发现新版本 {version}`,{version:t.latest??``}),duration:4e3})}catch(t){e||_({type:`warning`,message:k(`@F13B4:检查更新失败 {error}`,{error:t?.message||``})})}}async function A(){if(o.value?.hasUpdate){try{await b.confirm(k(`@F13B4:确定要从 {current} 升级到 {latest} 吗?`,{current:o.value.current,latest:o.value.latest}),k(`@F13B4:升级`),{confirmButtonText:k(`@F13B4:确定升级`),cancelButtonText:k(`@F13B4:取消`),type:`info`})}catch{return}u.value=``,m.value=`running`,s.value=!0,await P(e=>{if(e.type===`done`){if(m.value=e.code===0?`success`:`failed`,e.code===0){try{sessionStorage.removeItem($)}catch{}o.value?.latest&&(n.value=o.value.latest),j()}}else e.message&&(u.value+=e.message)})}}function j(){M(),S.value=Q,C=setInterval(()=>{--S.value,S.value<=0&&(C&&=(clearInterval(C),null),L())},1e3)}function M(){C&&=(clearInterval(C),null),S.value=0}function I(){M()}async function L(){if(M(),!w.value){w.value=!0;try{let e=await F(),{pathname:t,search:n,hash:r}=window.location;window.location.href=`http://localhost:${e}${t}${n}${r}`}catch(e){let t=e?.message||``,n={"restart.timeout":`@F13B4:重启超时`,"restart.stream-closed":`@F13B4:重启失败,请刷新页面重试`,"restart.failed":`@F13B4:重启失败`}[t];_({type:`warning`,message:n?k(n):k(`@F13B4:重启失败 {error}`,{error:t})}),w.value=!1}}}return T(()=>{M()}),h(()=>{O(!0)}),(e,t)=>{let n=p;return g(),x(`div`,G,[l(n,{content:i(k)(`@F13B4:在 GitHub 上查看源码`),placement:`top`,effect:`dark`,"show-after":300},{default:y(()=>[r(`a`,{href:`https://github.com/xz333221/zen-gitsync`,target:`_blank`,rel:`noopener noreferrer`,class:`badge-icon-link`,"aria-label":i(k)(`@F13B4:在 GitHub 上查看源码`)},[...t[1]||=[r(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,"aria-hidden":`true`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{d:`M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.02 10.02 0 0 0 22 12.017C22 6.484 17.522 2 12 2z`})],-1)]],8,K)]),_:1},8,[`content`]),l(n,{content:i(k)(`@F13B4:在 npm 上查看包`),placement:`top`,effect:`dark`,"show-after":300},{default:y(()=>[r(`a`,{href:`https://www.npmjs.com/package/zen-gitsync`,target:`_blank`,rel:`noopener noreferrer`,class:`badge-icon-link badge-icon-link--npm`,"aria-label":i(k)(`@F13B4:在 npm 上查看包`)},[...t[2]||=[r(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,"aria-hidden":`true`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{d:`M2 2v20h20V2H2zm17.167 17.167H12.5v-10h-3.333v10H4.833V4.833h14.334v14.334z`})],-1)]],8,q)]),_:1},8,[`content`]),l(n,{content:i(k)(`@F13B4:查看更新`),placement:`top`,effect:`dark`,"show-after":300},{default:y(()=>[r(`a`,{href:Z,target:`_blank`,rel:`noopener noreferrer`,class:`version-link`},`v`+d(a.value),1)]),_:1},8,[`content`]),o.value?.hasUpdate?(g(),x(`button`,{key:0,type:`button`,class:`upgrade-btn`,title:i(k)(`@F13B4:发现新版本 {version},点击升级`,{version:o.value.latest??``}),"aria-label":i(k)(`@F13B4:发现新版本 {version},点击升级`,{version:o.value.latest??``}),onClick:A},[t[3]||=r(`span`,{class:`upgrade-btn__dot`,"aria-hidden":`true`},null,-1),r(`span`,Y,d(i(k)(`@F13B4:升级`)),1),r(`span`,X,`v`+d(o.value.latest),1)],8,J)):c(``,!0),l(W,{modelValue:s.value,"onUpdate:modelValue":t[0]||=e=>s.value=e,logs:u.value,status:m.value,countdown:S.value,onRetry:A,onRestart:L,onCancel:I},null,8,[`modelValue`,`logs`,`status`,`countdown`])])}}}),[[`__scopeId`,`data-v-4084e4be`]]);export{te as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Dn as n,En as r,Er as i,F as ee,G as te,Ht as a,I as ne,In as o,J as re,K as s,Nt as c,On as l,Pn as u,Pr as d,Qr as f,Tn as p,U as ie,Zn as m,br as h,cr as g,dn as _,kn as v,pr as y,qr as b,r as ae,tt as x,xn as S,yn as C,zt as w}from"./element-plus-CgEuJBlB.js";import{n as T,t as E}from"./_plugin-vue_export-helper-MIPci_U9.js";import{t as D}from"./SvgIcon-b50XyCO5.js";import{t as O}from"./IconButton-BvbRjQ_D.js";import{r as k}from"./gitStore-DriJnutC.js";import{t as A}from"./CommonDialog-UrQUmb6G.js";t(),y(),d(),_();var j={key:0,class:`branch-info`},M={class:`branch-wrapper`},N={class:`branch-btn`},P={class:`branch-btn-name`},F={class:`branch-btn-caret`},I={class:`branch-popover-inner`},L={class:`branch-search`},R={class:`branch-list`},z=[`onClick`],B={key:1,class:`branch-item-check-placeholder`},V={class:`branch-item-name`},oe={key:0,class:`branch-empty`},H={class:`branch-popover-footer`},U={class:`create-branch-content`},W={class:`form-label`},G={class:`form-label`},K={class:`dialog-footer`},q={class:`footer-actions`},se=[`disabled`],J=E(o({__name:`BranchSelector`,emits:[`branchChanged`],setup(t,{emit:o}){let d=k(),_=o,y=h(!1),E=h(``),J=p(()=>{let e=E.value.trim().toLowerCase();return e?d.allBranches.filter(t=>t.toLowerCase().includes(e)):d.allBranches});async function ce(e){if(e===d.currentBranch){y.value=!1;return}y.value=!1,await d.changeBranch(e)&&(_(`branchChanged`),d.refreshLog())}let Y=h(!1),X=h(``),Z=h(``);function le(){y.value=!1,Z.value=d.currentBranch,Y.value=!0}async function Q(){await d.createBranch(X.value,Z.value)&&(Y.value=!1,X.value=``,_(`branchChanged`))}let $=h(!1);async function ue(){if(!$.value){$.value=!0;try{await Promise.all([d.getCurrentBranch(!0),d.getBranchStatus(!0),d.getAllBranches()]),_(`branchChanged`),d.refreshLog()}finally{$.value=!1}}}return(t,o)=>{let p=re,h=ie,_=ae,k=s,de=ee,fe=ne,pe=te;return i(d).currentBranch?(m(),v(`div`,j,[r(`div`,M,[u(_,{visible:y.value,"onUpdate:visible":o[1]||=e=>y.value=e,placement:`top-start`,width:260,trigger:`click`,"popper-class":`branch-popover`,"show-arrow":!1,onShow:o[2]||=e=>E.value=``},{reference:g(()=>[r(`button`,N,[u(D,{"icon-class":`git-branch`,"class-name":`branch-btn-icon`}),r(`span`,P,f(i(d).currentBranch),1),r(`span`,F,[u(p,null,{default:g(()=>[...o[7]||=[r(`svg`,{viewBox:`0 0 1024 1024`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{fill:`currentColor`,d:`M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.776a29.12 29.12 0 0 0 0-41.6 30.592 30.592 0 0 0-42.752 0z`})],-1)]]),_:1})])])]),default:g(()=>[r(`div`,I,[r(`div`,L,[u(h,{modelValue:E.value,"onUpdate:modelValue":o[0]||=e=>E.value=e,placeholder:i(T)(`@F13B4:搜索或签出分支`),size:`small`,clearable:``,autofocus:``},null,8,[`modelValue`,`placeholder`])]),r(`div`,R,[(m(!0),v(S,null,e(J.value,e=>(m(),v(`div`,{key:e,class:b([`branch-item`,{"is-active":e===i(d).currentBranch}]),onClick:t=>ce(e)},[e===i(d).currentBranch?(m(),n(p,{key:0,class:`branch-item-check`},{default:g(()=>[u(i(x))]),_:1})):(m(),v(`span`,B)),u(D,{"icon-class":`git-branch`,"class-name":`branch-item-icon`}),r(`span`,V,f(e),1)],10,z))),128)),J.value.length===0?(m(),v(`div`,oe,f(i(T)(`@F13B4:没有匹配的分支`)),1)):l(``,!0)]),r(`div`,H,[r(`button`,{class:`branch-create-btn`,onClick:le},[u(p,null,{default:g(()=>[u(i(w))]),_:1}),r(`span`,null,f(i(T)(`@F13B4:创建新分支`)),1)])])])]),_:1},8,[`visible`]),u(O,{tooltip:i(T)(`@CMDCON:刷新`),onClick:ue},{default:g(()=>[u(p,{class:b({"is-loading":$.value})},{default:g(()=>[u(i(a))]),_:1},8,[`class`])]),_:1},8,[`tooltip`])]),u(A,{modelValue:Y.value,"onUpdate:modelValue":o[6]||=e=>Y.value=e,title:i(T)(`@F13B4:创建新分支`),size:`small`,"destroy-on-close":!0,"append-to-body":!0,"custom-class":`create-branch-dialog`},{footer:g(()=>[r(`div`,K,[r(`div`,q,[r(`button`,{type:`button`,class:`dialog-cancel-btn`,onClick:o[5]||=e=>Y.value=!1},f(i(T)(`@F13B4:取消`)),1),r(`button`,{type:`button`,class:`dialog-confirm-btn`,onClick:Q,disabled:i(d).isCreatingBranch},[i(d).isCreatingBranch?(m(),n(p,{key:1,class:`is-loading`},{default:g(()=>[...o[8]||=[r(`svg`,{viewBox:`0 0 1024 1024`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{fill:`currentColor`,d:`M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32z`})],-1)]]),_:1})):(m(),n(p,{key:0},{default:g(()=>[u(i(x))]),_:1})),r(`span`,null,f(i(T)(`@F13B4:创建`)),1)],8,se)])])]),default:g(()=>[r(`div`,U,[u(pe,{model:{newBranchName:X.value,selectedBaseBranch:Z.value},"label-position":`top`},{default:g(()=>[u(k,null,{label:g(()=>[r(`div`,W,[u(p,{class:`label-icon`},{default:g(()=>[u(i(w))]),_:1}),r(`span`,null,f(i(T)(`@F13B4:新分支名称`)),1)])]),default:g(()=>[u(h,{modelValue:X.value,"onUpdate:modelValue":o[3]||=e=>X.value=e,placeholder:i(T)(`@F13B4:请输入新分支名称`),class:`modern-input`,size:`large`,onKeyup:C(Q,[`enter`])},null,8,[`modelValue`,`placeholder`])]),_:1}),u(k,null,{label:g(()=>[r(`div`,G,[u(p,{class:`label-icon`},{default:g(()=>[u(i(c))]),_:1}),r(`span`,null,f(i(T)(`@F13B4:基于分支`)),1)])]),default:g(()=>[u(fe,{modelValue:Z.value,"onUpdate:modelValue":o[4]||=e=>Z.value=e,placeholder:i(T)(`@F13B4:选择基础分支`),class:`modern-select`,size:`large`,style:{width:`100%`}},{default:g(()=>[(m(!0),v(S,null,e(i(d).allBranches,e=>(m(),n(de,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),_:1})]),_:1},8,[`model`])])]),_:1},8,[`modelValue`,`title`])])):l(``,!0)}}}),[[`__scopeId`,`data-v-407da320`]]);export{J as default};
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Dn as n,En as r,Er as i,F as ee,G as te,Ht as a,I as ne,In as o,J as re,K as s,Nt as c,On as l,Pn as u,Pr as d,Qr as f,Tn as p,U as ie,Zn as m,br as h,cr as g,dn as _,kn as v,pr as y,qr as b,r as ae,tt as x,xn as S,yn as C,zt as w}from"./element-plus-CgEuJBlB.js";import{n as T,t as E}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{t as D}from"./SvgIcon-B-2iTLW-.js";import{t as O}from"./IconButton-BflzboUD.js";import{r as k}from"./gitStore-BcrFZogC.js";import{t as A}from"./CommonDialog-kDck8ITZ.js";t(),y(),d(),_();var j={key:0,class:`branch-info`},M={class:`branch-wrapper`},N={class:`branch-btn`},P={class:`branch-btn-name`},F={class:`branch-btn-caret`},I={class:`branch-popover-inner`},L={class:`branch-search`},R={class:`branch-list`},z=[`onClick`],B={key:1,class:`branch-item-check-placeholder`},V={class:`branch-item-name`},oe={key:0,class:`branch-empty`},H={class:`branch-popover-footer`},U={class:`create-branch-content`},W={class:`form-label`},G={class:`form-label`},K={class:`dialog-footer`},q={class:`footer-actions`},se=[`disabled`],J=E(o({__name:`BranchSelector`,emits:[`branchChanged`],setup(t,{emit:o}){let d=k(),_=o,y=h(!1),E=h(``),J=p(()=>{let e=E.value.trim().toLowerCase();return e?d.allBranches.filter(t=>t.toLowerCase().includes(e)):d.allBranches});async function ce(e){if(e===d.currentBranch){y.value=!1;return}y.value=!1,await d.changeBranch(e)&&(_(`branchChanged`),d.refreshLog())}let Y=h(!1),X=h(``),Z=h(``);function le(){y.value=!1,Z.value=d.currentBranch,Y.value=!0}async function Q(){await d.createBranch(X.value,Z.value)&&(Y.value=!1,X.value=``,_(`branchChanged`))}let $=h(!1);async function ue(){if(!$.value){$.value=!0;try{await Promise.all([d.getCurrentBranch(!0),d.getBranchStatus(!0),d.getAllBranches()]),_(`branchChanged`),d.refreshLog()}finally{$.value=!1}}}return(t,o)=>{let p=re,h=ie,_=ae,k=s,de=ee,fe=ne,pe=te;return i(d).currentBranch?(m(),v(`div`,j,[r(`div`,M,[u(_,{visible:y.value,"onUpdate:visible":o[1]||=e=>y.value=e,placement:`top-start`,width:260,trigger:`click`,"popper-class":`branch-popover`,"show-arrow":!1,onShow:o[2]||=e=>E.value=``},{reference:g(()=>[r(`button`,N,[u(D,{"icon-class":`git-branch`,"class-name":`branch-btn-icon`}),r(`span`,P,f(i(d).currentBranch),1),r(`span`,F,[u(p,null,{default:g(()=>[...o[7]||=[r(`svg`,{viewBox:`0 0 1024 1024`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{fill:`currentColor`,d:`M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.776a29.12 29.12 0 0 0 0-41.6 30.592 30.592 0 0 0-42.752 0z`})],-1)]]),_:1})])])]),default:g(()=>[r(`div`,I,[r(`div`,L,[u(h,{modelValue:E.value,"onUpdate:modelValue":o[0]||=e=>E.value=e,placeholder:i(T)(`@F13B4:搜索或签出分支`),size:`small`,clearable:``,autofocus:``},null,8,[`modelValue`,`placeholder`])]),r(`div`,R,[(m(!0),v(S,null,e(J.value,e=>(m(),v(`div`,{key:e,class:b([`branch-item`,{"is-active":e===i(d).currentBranch}]),onClick:t=>ce(e)},[e===i(d).currentBranch?(m(),n(p,{key:0,class:`branch-item-check`},{default:g(()=>[u(i(x))]),_:1})):(m(),v(`span`,B)),u(D,{"icon-class":`git-branch`,"class-name":`branch-item-icon`}),r(`span`,V,f(e),1)],10,z))),128)),J.value.length===0?(m(),v(`div`,oe,f(i(T)(`@F13B4:没有匹配的分支`)),1)):l(``,!0)]),r(`div`,H,[r(`button`,{class:`branch-create-btn`,onClick:le},[u(p,null,{default:g(()=>[u(i(w))]),_:1}),r(`span`,null,f(i(T)(`@F13B4:创建新分支`)),1)])])])]),_:1},8,[`visible`]),u(O,{tooltip:i(T)(`@CMDCON:刷新`),onClick:ue},{default:g(()=>[u(p,{class:b({"is-loading":$.value})},{default:g(()=>[u(i(a))]),_:1},8,[`class`])]),_:1},8,[`tooltip`])]),u(A,{modelValue:Y.value,"onUpdate:modelValue":o[6]||=e=>Y.value=e,title:i(T)(`@F13B4:创建新分支`),size:`small`,"destroy-on-close":!0,"append-to-body":!0,"custom-class":`create-branch-dialog`},{footer:g(()=>[r(`div`,K,[r(`div`,q,[r(`button`,{type:`button`,class:`dialog-cancel-btn`,onClick:o[5]||=e=>Y.value=!1},f(i(T)(`@F13B4:取消`)),1),r(`button`,{type:`button`,class:`dialog-confirm-btn`,onClick:Q,disabled:i(d).isCreatingBranch},[i(d).isCreatingBranch?(m(),n(p,{key:1,class:`is-loading`},{default:g(()=>[...o[8]||=[r(`svg`,{viewBox:`0 0 1024 1024`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{fill:`currentColor`,d:`M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32z`})],-1)]]),_:1})):(m(),n(p,{key:0},{default:g(()=>[u(i(x))]),_:1})),r(`span`,null,f(i(T)(`@F13B4:创建`)),1)],8,se)])])]),default:g(()=>[r(`div`,U,[u(pe,{model:{newBranchName:X.value,selectedBaseBranch:Z.value},"label-position":`top`},{default:g(()=>[u(k,null,{label:g(()=>[r(`div`,W,[u(p,{class:`label-icon`},{default:g(()=>[u(i(w))]),_:1}),r(`span`,null,f(i(T)(`@F13B4:新分支名称`)),1)])]),default:g(()=>[u(h,{modelValue:X.value,"onUpdate:modelValue":o[3]||=e=>X.value=e,placeholder:i(T)(`@F13B4:请输入新分支名称`),class:`modern-input`,size:`large`,onKeyup:C(Q,[`enter`])},null,8,[`modelValue`,`placeholder`])]),_:1}),u(k,null,{label:g(()=>[r(`div`,G,[u(p,{class:`label-icon`},{default:g(()=>[u(i(c))]),_:1}),r(`span`,null,f(i(T)(`@F13B4:基于分支`)),1)])]),default:g(()=>[u(fe,{modelValue:Z.value,"onUpdate:modelValue":o[4]||=e=>Z.value=e,placeholder:i(T)(`@F13B4:选择基础分支`),class:`modern-select`,size:`large`,style:{width:`100%`}},{default:g(()=>[(m(!0),v(S,null,e(i(d).allBranches,e=>(m(),n(de,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),_:1})]),_:1},8,[`model`])])]),_:1},8,[`modelValue`,`title`])])):l(``,!0)}}}),[[`__scopeId`,`data-v-407da320`]]);export{J as default};