keel-agent 0.130.0 → 0.130.1

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 (100) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/packages/keel/src/app/subagent-model-choice.js +3 -4
  3. package/package.json +1 -1
  4. package/web/dist/.build-assets.json +1 -1
  5. package/web/dist/assets/{ApprovalRulesTab-QmzsJItk.js → ApprovalRulesTab-3vnhAT9R.js} +1 -1
  6. package/web/dist/assets/{BgTasksModal-COLmy-4E.js → BgTasksModal-R-6kYREx.js} +1 -1
  7. package/web/dist/assets/BgTasksModal-Wah1orF5.js +1 -0
  8. package/web/dist/assets/{BotDraftSettings-nP4g1fge.js → BotDraftSettings-B1wTl7Vg.js} +1 -1
  9. package/web/dist/assets/{BottomDock-BZXSlOom.js → BottomDock-BPFSRZ0X.js} +1 -1
  10. package/web/dist/assets/BottomDock-CFcL5DzG.js +1 -0
  11. package/web/dist/assets/{CanvasStudio-BL1BWXpp.js → CanvasStudio-B1oKuguJ.js} +1 -1
  12. package/web/dist/assets/CanvasStudio-DcrNIsHF.js +1579 -0
  13. package/web/dist/assets/{CommunityThemesSection-BLd_oox1.js → CommunityThemesSection-BfG3dkJM.js} +1 -1
  14. package/web/dist/assets/CommunityThemesSection-DtNTStEl.js +1 -0
  15. package/web/dist/assets/{DesktopAppSettings-Dn18vrLK.js → DesktopAppSettings-CmfaTYVg.js} +1 -1
  16. package/web/dist/assets/{DeviceCenter-DxoAwlTt.js → DeviceCenter-Cu9nMKdi.js} +1 -1
  17. package/web/dist/assets/DeviceCenter-krZV_FU1.js +3 -0
  18. package/web/dist/assets/{DeviceExecutionSettings-B1mya5TJ.js → DeviceExecutionSettings-Y-8BfmMH.js} +1 -1
  19. package/web/dist/assets/{DeviceGroups-C-xwewog.js → DeviceGroups-4KimHqYi.js} +1 -1
  20. package/web/dist/assets/DeviceGroups-CYtzpFAF.js +1 -0
  21. package/web/dist/assets/{DisplayTab-DRGFt78v.js → DisplayTab-D8wjw1NI.js} +1 -1
  22. package/web/dist/assets/DisplayTab-RANS7wHY.js +1 -0
  23. package/web/dist/assets/{FieldRow-DHxAXFtL.js → FieldRow-BQ43ENLa.js} +1 -1
  24. package/web/dist/assets/{FilePreview-DcyP9paf.js → FilePreview-BpE884NY.js} +1 -1
  25. package/web/dist/assets/FilePreview-GOqWbXIs.js +2 -0
  26. package/web/dist/assets/{GlobalSearchModal-Cs6hB5KO.js → GlobalSearchModal-CSKa4c7w.js} +1 -1
  27. package/web/dist/assets/GlobalSearchModal-DS62VEMS.js +1 -0
  28. package/web/dist/assets/{GroupConversation-B7NfTB89.js → GroupConversation-BlCwRDpi.js} +1 -1
  29. package/web/dist/assets/GroupConversation-C_qNSQDP.js +9 -0
  30. package/web/dist/assets/{GroupWorkItems-CSUjIxDT.js → GroupWorkItems-dc5bk7A7.js} +1 -1
  31. package/web/dist/assets/{HintTip-CKxIx9CD.js → HintTip-DUbCHF8G.js} +1 -1
  32. package/web/dist/assets/{LayoutTab-9popvCLQ.js → LayoutTab-BFNlEaCX.js} +1 -1
  33. package/web/dist/assets/LayoutTab-BjM3-ZvB.js +1 -0
  34. package/web/dist/assets/{McpServersPanel-dRwq7Wjq.js → McpServersPanel-BqpKRLOw.js} +1 -1
  35. package/web/dist/assets/McpServersPanel-CNyxnBff.js +1 -0
  36. package/web/dist/assets/{ModelConfigModal-C0CXhSl0.js → ModelConfigModal-ChJpmTlc.js} +1 -1
  37. package/web/dist/assets/ModelConfigModal-vYO-afkI.js +2 -0
  38. package/web/dist/assets/{ModelsTab-CyG2rYeY.js → ModelsTab-D21I7rkR.js} +1 -1
  39. package/web/dist/assets/ModelsTab-P7LvG27r.js +1 -0
  40. package/web/dist/assets/{NativeCliPanel-mlB4dw42.js → NativeCliPanel-Br-5ljqs.js} +1 -1
  41. package/web/dist/assets/NativeCliPanel-Clt94Fpy.js +5 -0
  42. package/web/dist/assets/{PiSetupModal-D7PjlTVx.js → PiSetupModal-CUb5Q8-5.js} +1 -1
  43. package/web/dist/assets/{PluginsTab-0s0qClcC.js → PluginsTab-BAm_QAzW.js} +1 -1
  44. package/web/dist/assets/PluginsTab-BRKvuS0O.js +2 -0
  45. package/web/dist/assets/{PresetShareModal-Dw4t6p6s.js → PresetShareModal-4KRKutrA.js} +1 -1
  46. package/web/dist/assets/PresetShareModal-Dqx8JUn3.js +11 -0
  47. package/web/dist/assets/{PresetsTab-DdXvpc2d.js → PresetsTab-BxO9GfpC.js} +1 -1
  48. package/web/dist/assets/{PromptHistoryTab-DirJHaH6.js → PromptHistoryTab-TG4YmTrg.js} +1 -1
  49. package/web/dist/assets/PromptHistoryTab-bKIwfcAQ.js +1 -0
  50. package/web/dist/assets/{PromptOverrideEditor-ldLRCp0e.js → PromptOverrideEditor-CygHvhOa.js} +1 -1
  51. package/web/dist/assets/{PromptTab-SV01BMC0.js → PromptTab-B2_Qxr7A.js} +1 -1
  52. package/web/dist/assets/PromptTab-DPqfCdxT.js +11 -0
  53. package/web/dist/assets/{ProviderOAuthControls-Clyn3fnw.js → ProviderOAuthControls-CQSqMeR1.js} +1 -1
  54. package/web/dist/assets/{QuestionTab-Bi1NYK5U.js → QuestionTab-0v0n7S8O.js} +1 -1
  55. package/web/dist/assets/{QuickAskSettings-dzG95DYl.js → QuickAskSettings-BdDgXcxT.js} +1 -1
  56. package/web/dist/assets/QuickAskSettings-CKFJ0aCk.js +2 -0
  57. package/web/dist/assets/{QuickTab-C8bknYDU.js → QuickTab-Dh18DG66.js} +1 -1
  58. package/web/dist/assets/QuickTab-Vynq8Q9i.js +5 -0
  59. package/web/dist/assets/{ReviewTab-D9lbphZe.js → ReviewTab-BiuGWsmU.js} +1 -1
  60. package/web/dist/assets/{SCMPanel-BfrlvHxI.js → SCMPanel-B0w96H9p.js} +1 -1
  61. package/web/dist/assets/SCMPanel-FKoXWQ_H.js +7 -0
  62. package/web/dist/assets/{SchedulerPanel-DDDWOSsw.js → SchedulerPanel-DUgt0Fu6.js} +1 -1
  63. package/web/dist/assets/SchedulerPanel-cQdRucUx.js +2 -0
  64. package/web/dist/assets/{SettingsModal-BqzfvDlI.js → SettingsModal-BliX6Boj.js} +2 -2
  65. package/web/dist/assets/SettingsModal-CDYhDB1i.js +2 -0
  66. package/web/dist/assets/{SkillsTab-D8C-kghN.js → SkillsTab-BGhnuZmu.js} +1 -1
  67. package/web/dist/assets/SkillsTab-BTin11c-.js +1 -0
  68. package/web/dist/assets/{SoundTab-CXcWmvkX.js → SoundTab-16yTVZkV.js} +1 -1
  69. package/web/dist/assets/SoundTab-gF8ZYfRH.js +1 -0
  70. package/web/dist/assets/{SubagentTemplatesTab-KjPMnYN4.js → SubagentTemplatesTab-CiFYV-ZI.js} +1 -1
  71. package/web/dist/assets/SubagentTemplatesTab-DMOqN0mW.js +1 -0
  72. package/web/dist/assets/{TermXterm-B7klZwgq.js → TermXterm-BrPs_sPf.js} +1 -1
  73. package/web/dist/assets/TermXterm-JjcHbfzg.js +8 -0
  74. package/web/dist/assets/{TerminalDockControls-lbPY2V5U.js → TerminalDockControls-D7jwYEpa.js} +1 -1
  75. package/web/dist/assets/TerminalDockControls-vkeqMz6q.js +1 -0
  76. package/web/dist/assets/{TerminalPanel-ERotdy8I.js → TerminalPanel-_4n1f4--.js} +1 -1
  77. package/web/dist/assets/TerminalPanel-_vroAPhm.js +1 -0
  78. package/web/dist/assets/{ThemeMarketModal-BZJZ7doZ.js → ThemeMarketModal-CBKF2E8L.js} +1 -1
  79. package/web/dist/assets/ThemeMarketModal-K7A327ZQ.js +1 -0
  80. package/web/dist/assets/{ToggleRow-irywH1NJ.js → ToggleRow-clnL39s8.js} +1 -1
  81. package/web/dist/assets/{ToolBridgeSettings-CG1HleEp.js → ToolBridgeSettings-BsJNlw-5.js} +1 -1
  82. package/web/dist/assets/ToolBridgeSettings-Bu2h16ZE.js +1 -0
  83. package/web/dist/assets/{ToolsTab-_OJA76Sw.js → ToolsTab-BQxVX0Ye.js} +1 -1
  84. package/web/dist/assets/ToolsTab-CeKb8Kip.js +4 -0
  85. package/web/dist/assets/{TuiOverlayModal-CDqXNwW-.js → TuiOverlayModal-BuE2FKDQ.js} +1 -1
  86. package/web/dist/assets/TuiOverlayModal-CLzoXrSM.js +1 -0
  87. package/web/dist/assets/{VisionTab-B580SGpU.js → VisionTab-C4U4LxUk.js} +1 -1
  88. package/web/dist/assets/{api-client-B2iSv9kK.js → api-client--1WOIe68.js} +1 -1
  89. package/web/dist/assets/{canvas-client-DRiwRbfy.js → canvas-client-Bhhkh6T0.js} +1 -1
  90. package/web/dist/assets/{desktop-DRyQQXnx.js → desktop-IxZhNpni.js} +1 -1
  91. package/web/dist/assets/{host-icon-DMg5PU4C.js → host-icon-B-zxP_r-.js} +1 -1
  92. package/web/dist/assets/{i18n-D2DJ-AHq.js → i18n-N1glykLZ.js} +4 -4
  93. package/web/dist/assets/{index-CP0EEOA0.js → index-4VhQrBDx.js} +7 -7
  94. package/web/dist/assets/index-CS3HmHb2.js +423 -0
  95. package/web/dist/assets/{plugin-host-VU6JOOPu.js → plugin-host-DMoSTlfw.js} +1 -1
  96. package/web/dist/assets/{theme-ZteIcUdF.js → theme-CGrlgGnK.js} +1 -1
  97. package/web/dist/assets/{tool-inventory-DnzKVLYq.js → tool-inventory-BoeketvT.js} +1 -1
  98. package/web/dist/assets/tool-inventory-C1RzlPP0.js +1 -0
  99. package/web/dist/index.html +9 -9
  100. package/web/dist/sw.js +1 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,25 @@
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.130.1] - 2026-12-04
14
+
15
+ ### Changed
16
+
17
+ - **对话右键菜单文案精简**:精简侧栏及搜索对话右键菜单项文字(重命名、钉住、子代理清理、强行关闭、复制 ID/文件路径/链接、引用到输入框等),减少菜单宽度占用。
18
+
19
+ ### Fixed
20
+
21
+ - **子代理模型设置保留 `this` 绑定**:修复 `createSubagentModelChoice` 解构 `session.setModel` 导致类实例会话丢失 `this` 上下文的问题。
22
+
23
+ <!-- auto-i18n:start -->
24
+
25
+ ### i18n
26
+
27
+ - 前端中文变更(11):`renameSession`、`pinConversation`、`dismissFinishedSubagents`、`dismissFinishedSubagentsScoped`、`forceDismissConversation`、`forceDismissConfirm`、`noFinishedSubagents`、`copyConversationId`、`copyConversationPath`、`copyConversationLink`、`quoteConversation`
28
+ - 前端英文变更(10):`renameSession`、`pinConversation`、`dismissFinishedSubagentsScoped`、`forceDismissConversation`、`forceDismissConfirm`、`noFinishedSubagents`、`copyConversationId`、`copyConversationPath`、`copyConversationLink`、`quoteConversation`
29
+
30
+ <!-- auto-i18n:end -->
31
+
13
32
  ## [0.130.0] - 2026-12-04
14
33
 
15
34
  ### Added
@@ -2819,7 +2838,8 @@ when?, children?}`,也收 `topbar` / `settings` 这类简写别名);宿主
2819
2838
  [0.90.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.90.1
2820
2839
  [0.90.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.90.0
2821
2840
  [0.89.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.89.0
2822
- [Unreleased]: https://github.com/xing-shuyin/keel/compare/v0.128.0...main
2841
+ [Unreleased]: https://github.com/xing-shuyin/keel/compare/v0.130.1...main
2842
+ [0.130.1]: https://github.com/xing-shuyin/keel/releases/tag/v0.130.1
2823
2843
  [0.130.0]: https://github.com/xing-shuyin/keel/releases/tag/v0.130.0
2824
2844
  [0.129.0]: https://github.com/xing-shuyin/keel/releases/tag/v0.129.0
2825
2845
  [0.128.0]: https://github.com/xing-shuyin/keel/releases/tag/v0.128.0
@@ -12,8 +12,7 @@ export function createSubagentModelChoice(deps) {
12
12
  * - **继承来的默认值**(全局默认模型或派发者模型)解析不到 → warning + 跟随派发者模型(非退化)。
13
13
  */
14
14
  const applyModel = async (session, ownerRuntime, parentId, spec) => {
15
- const setModel = session.setModel;
16
- if (!setModel)
15
+ if (!session.setModel)
17
16
  return;
18
17
  const parentSession = (ownerRuntime.options.sessions ?? sessions).get(parentId)?.session;
19
18
  const resolve = ownerRuntime.options.resolveModel ?? runtime.options.resolveModel;
@@ -34,7 +33,7 @@ export function createSubagentModelChoice(deps) {
34
33
  throw err;
35
34
  }
36
35
  try {
37
- await setModel(resolved);
36
+ await session.setModel(resolved);
38
37
  }
39
38
  catch (error) {
40
39
  if (isExplicit) {
@@ -66,7 +65,7 @@ export function createSubagentModelChoice(deps) {
66
65
  if (!parentSession?.model)
67
66
  return;
68
67
  try {
69
- await setModel(parentSession.model);
68
+ await session.setModel(parentSession.model);
70
69
  }
71
70
  catch (error) {
72
71
  const reason = error instanceof Error ? error.message : String(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel-agent",
3
- "version": "0.130.0",
3
+ "version": "0.130.1",
4
4
  "description": "Just open your browser to get all your work done — browser cockpit for AI coding agents (chat, code, files, terminal, Git in one tab)",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1 +1 @@
1
- ["index-CP0EEOA0.js","ApprovalRulesTab-QmzsJItk.js","BgTasksModal-COLmy-4E.js","BotDraftSettings-nP4g1fge.js","BottomDock-BZXSlOom.js","CanvasStudio-BL1BWXpp.js","CommunityThemesSection-BLd_oox1.js","DesktopAppSettings-Dn18vrLK.js","DeviceCenter-DxoAwlTt.js","DeviceExecutionSettings-B1mya5TJ.js","DeviceGroups-C-xwewog.js","DisplayTab-DRGFt78v.js","FieldRow-DHxAXFtL.js","FilePreview-DcyP9paf.js","GlobalSearchModal-Cs6hB5KO.js","GroupConversation-B7NfTB89.js","GroupWorkItems-CSUjIxDT.js","HintTip-CKxIx9CD.js","LayoutTab-9popvCLQ.js","McpServersPanel-dRwq7Wjq.js","ModelConfigModal-C0CXhSl0.js","ModelsTab-CyG2rYeY.js","NativeCliPanel-mlB4dw42.js","PiSetupModal-D7PjlTVx.js","PluginsTab-0s0qClcC.js","PresetShareModal-Dw4t6p6s.js","PresetsTab-DdXvpc2d.js","PromptHistoryTab-DirJHaH6.js","PromptOverrideEditor-ldLRCp0e.js","PromptTab-SV01BMC0.js","ProviderOAuthControls-Clyn3fnw.js","QuestionTab-Bi1NYK5U.js","QuickAskSettings-dzG95DYl.js","QuickTab-C8bknYDU.js","ReviewTab-D9lbphZe.js","SCMPanel-BfrlvHxI.js","SchedulerPanel-DDDWOSsw.js","SettingsModal-BqzfvDlI.js","SkillsTab-D8C-kghN.js","SoundTab-CXcWmvkX.js","SubagentTemplatesTab-KjPMnYN4.js","TermXterm-B7klZwgq.js","TerminalDockControls-lbPY2V5U.js","TerminalPanel-ERotdy8I.js","ThemeMarketModal-BZJZ7doZ.js","ToggleRow-irywH1NJ.js","ToolBridgeSettings-CG1HleEp.js","ToolsTab-_OJA76Sw.js","TuiOverlayModal-CDqXNwW-.js","VisionTab-B580SGpU.js","api-client-B2iSv9kK.js","app-globals-D2ZB_kzX.js","canvas-client-DRiwRbfy.js","composer-bridge-CImnjDHq.js","desktop-DRyQQXnx.js","es-C5BHljgM.js","file-preview-bridge-F9LjmrJs.js","group-view-state-CGCzYF8k.js","host-icon-DMg5PU4C.js","i18n-D2DJ-AHq.js","markdown-BA0rplmj.js","math-DKgf_YcR.js","overlay-stack-rkpi4Wf5.js","plugin-host-VU6JOOPu.js","plugin-links-8dfevFjx.js","react-D0RUMPTR.js","rolldown-runtime-BLXQ4ufn.js","shortcut-stack-D0d3XzNw.js","theme-ZteIcUdF.js","tool-inventory-DnzKVLYq.js","use-click-outside-DZ7f2Ktv.js","use-copy-feedback-UoOlBc20.js","uuid-BzDIGCwP.js","xterm-Cqm0K84T.js","GroupConversation-wV-lmZkz.css","KaTeX_AMS-Regular-BQhdFMY1.woff2","KaTeX_AMS-Regular-DMm9YOAa.woff","KaTeX_AMS-Regular-DRggAlZN.ttf","KaTeX_Caligraphic-Bold-ATXxdsX0.ttf","KaTeX_Caligraphic-Bold-BEiXGLvX.woff","KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2","KaTeX_Caligraphic-Regular-CTRA-rTL.woff","KaTeX_Caligraphic-Regular-Di6jR-x-.woff2","KaTeX_Caligraphic-Regular-wX97UBjC.ttf","KaTeX_Fraktur-Bold-BdnERNNW.ttf","KaTeX_Fraktur-Bold-BsDP51OF.woff","KaTeX_Fraktur-Bold-CL6g_b3V.woff2","KaTeX_Fraktur-Regular-CB_wures.ttf","KaTeX_Fraktur-Regular-CTYiF6lA.woff2","KaTeX_Fraktur-Regular-Dxdc4cR9.woff","KaTeX_Main-Bold-Cx986IdX.woff2","KaTeX_Main-Bold-Jm3AIy58.woff","KaTeX_Main-Bold-waoOVXN0.ttf","KaTeX_Main-BoldItalic-DxDJ3AOS.woff2","KaTeX_Main-BoldItalic-DzxPMmG6.ttf","KaTeX_Main-BoldItalic-SpSLRI95.woff","KaTeX_Main-Italic-3WenGoN9.ttf","KaTeX_Main-Italic-BMLOBm91.woff","KaTeX_Main-Italic-NWA7e6Wa.woff2","KaTeX_Main-Regular-B22Nviop.woff2","KaTeX_Main-Regular-Dr94JaBh.woff","KaTeX_Main-Regular-ypZvNtVU.ttf","KaTeX_Math-BoldItalic-B3XSjfu4.ttf","KaTeX_Math-BoldItalic-CZnvNsCZ.woff2","KaTeX_Math-BoldItalic-iY-2wyZ7.woff","KaTeX_Math-Italic-DA0__PXp.woff","KaTeX_Math-Italic-flOr_0UB.ttf","KaTeX_Math-Italic-t53AETM-.woff2","KaTeX_SansSerif-Bold-CFMepnvq.ttf","KaTeX_SansSerif-Bold-D1sUS0GD.woff2","KaTeX_SansSerif-Bold-DbIhKOiC.woff","KaTeX_SansSerif-Italic-C3H0VqGB.woff2","KaTeX_SansSerif-Italic-DN2j7dab.woff","KaTeX_SansSerif-Italic-YYjJ1zSn.ttf","KaTeX_SansSerif-Regular-BNo7hRIc.ttf","KaTeX_SansSerif-Regular-CS6fqUqJ.woff","KaTeX_SansSerif-Regular-DDBCnlJ7.woff2","KaTeX_Script-Regular-C5JkGWo-.ttf","KaTeX_Script-Regular-D3wIWfF6.woff2","KaTeX_Script-Regular-D5yQViql.woff","KaTeX_Size1-Regular-C195tn64.woff","KaTeX_Size1-Regular-Dbsnue_I.ttf","KaTeX_Size1-Regular-mCD8mA8B.woff2","KaTeX_Size2-Regular-B7gKUWhC.ttf","KaTeX_Size2-Regular-Dy4dx90m.woff2","KaTeX_Size2-Regular-oD1tc_U0.woff","KaTeX_Size3-Regular-CTq5MqoE.woff","KaTeX_Size3-Regular-DgpXs0kz.ttf","KaTeX_Size4-Regular-BF-4gkZK.woff","KaTeX_Size4-Regular-DWFBv043.ttf","KaTeX_Size4-Regular-Dl5lxZxV.woff2","KaTeX_Typewriter-Regular-C0xS9mPB.woff","KaTeX_Typewriter-Regular-CO6r4hn1.woff2","KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf","SCMPanel-BVYmayDJ.css","SettingsModal-Cy5lRC97.css","index-Ds_pheLF.css","markdown-C8LL_u4z.css","math-DMZ4qLFT.css","xterm-B1njb2Cr.css"]
1
+ ["index-CS3HmHb2.js","ApprovalRulesTab-3vnhAT9R.js","BgTasksModal-R-6kYREx.js","BotDraftSettings-B1wTl7Vg.js","BottomDock-CFcL5DzG.js","CanvasStudio-B1oKuguJ.js","CommunityThemesSection-BfG3dkJM.js","DesktopAppSettings-CmfaTYVg.js","DeviceCenter-krZV_FU1.js","DeviceExecutionSettings-Y-8BfmMH.js","DeviceGroups-4KimHqYi.js","DisplayTab-RANS7wHY.js","FieldRow-BQ43ENLa.js","FilePreview-GOqWbXIs.js","GlobalSearchModal-CSKa4c7w.js","GroupConversation-BlCwRDpi.js","GroupWorkItems-dc5bk7A7.js","HintTip-DUbCHF8G.js","LayoutTab-BjM3-ZvB.js","McpServersPanel-BqpKRLOw.js","ModelConfigModal-vYO-afkI.js","ModelsTab-P7LvG27r.js","NativeCliPanel-Clt94Fpy.js","PiSetupModal-CUb5Q8-5.js","PluginsTab-BRKvuS0O.js","PresetShareModal-4KRKutrA.js","PresetsTab-BxO9GfpC.js","PromptHistoryTab-bKIwfcAQ.js","PromptOverrideEditor-CygHvhOa.js","PromptTab-B2_Qxr7A.js","ProviderOAuthControls-CQSqMeR1.js","QuestionTab-0v0n7S8O.js","QuickAskSettings-CKFJ0aCk.js","QuickTab-Dh18DG66.js","ReviewTab-BiuGWsmU.js","SCMPanel-B0w96H9p.js","SchedulerPanel-DUgt0Fu6.js","SettingsModal-BliX6Boj.js","SkillsTab-BGhnuZmu.js","SoundTab-gF8ZYfRH.js","SubagentTemplatesTab-DMOqN0mW.js","TermXterm-BrPs_sPf.js","TerminalDockControls-D7jwYEpa.js","TerminalPanel-_4n1f4--.js","ThemeMarketModal-CBKF2E8L.js","ToggleRow-clnL39s8.js","ToolBridgeSettings-Bu2h16ZE.js","ToolsTab-CeKb8Kip.js","TuiOverlayModal-BuE2FKDQ.js","VisionTab-C4U4LxUk.js","api-client--1WOIe68.js","app-globals-D2ZB_kzX.js","canvas-client-Bhhkh6T0.js","composer-bridge-CImnjDHq.js","desktop-IxZhNpni.js","es-C5BHljgM.js","file-preview-bridge-F9LjmrJs.js","group-view-state-CGCzYF8k.js","host-icon-B-zxP_r-.js","i18n-N1glykLZ.js","markdown-BA0rplmj.js","math-DKgf_YcR.js","overlay-stack-rkpi4Wf5.js","plugin-host-DMoSTlfw.js","plugin-links-8dfevFjx.js","react-D0RUMPTR.js","rolldown-runtime-BLXQ4ufn.js","shortcut-stack-D0d3XzNw.js","theme-CGrlgGnK.js","tool-inventory-BoeketvT.js","use-click-outside-DZ7f2Ktv.js","use-copy-feedback-UoOlBc20.js","uuid-BzDIGCwP.js","xterm-Cqm0K84T.js","GroupConversation-wV-lmZkz.css","KaTeX_AMS-Regular-BQhdFMY1.woff2","KaTeX_AMS-Regular-DMm9YOAa.woff","KaTeX_AMS-Regular-DRggAlZN.ttf","KaTeX_Caligraphic-Bold-ATXxdsX0.ttf","KaTeX_Caligraphic-Bold-BEiXGLvX.woff","KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2","KaTeX_Caligraphic-Regular-CTRA-rTL.woff","KaTeX_Caligraphic-Regular-Di6jR-x-.woff2","KaTeX_Caligraphic-Regular-wX97UBjC.ttf","KaTeX_Fraktur-Bold-BdnERNNW.ttf","KaTeX_Fraktur-Bold-BsDP51OF.woff","KaTeX_Fraktur-Bold-CL6g_b3V.woff2","KaTeX_Fraktur-Regular-CB_wures.ttf","KaTeX_Fraktur-Regular-CTYiF6lA.woff2","KaTeX_Fraktur-Regular-Dxdc4cR9.woff","KaTeX_Main-Bold-Cx986IdX.woff2","KaTeX_Main-Bold-Jm3AIy58.woff","KaTeX_Main-Bold-waoOVXN0.ttf","KaTeX_Main-BoldItalic-DxDJ3AOS.woff2","KaTeX_Main-BoldItalic-DzxPMmG6.ttf","KaTeX_Main-BoldItalic-SpSLRI95.woff","KaTeX_Main-Italic-3WenGoN9.ttf","KaTeX_Main-Italic-BMLOBm91.woff","KaTeX_Main-Italic-NWA7e6Wa.woff2","KaTeX_Main-Regular-B22Nviop.woff2","KaTeX_Main-Regular-Dr94JaBh.woff","KaTeX_Main-Regular-ypZvNtVU.ttf","KaTeX_Math-BoldItalic-B3XSjfu4.ttf","KaTeX_Math-BoldItalic-CZnvNsCZ.woff2","KaTeX_Math-BoldItalic-iY-2wyZ7.woff","KaTeX_Math-Italic-DA0__PXp.woff","KaTeX_Math-Italic-flOr_0UB.ttf","KaTeX_Math-Italic-t53AETM-.woff2","KaTeX_SansSerif-Bold-CFMepnvq.ttf","KaTeX_SansSerif-Bold-D1sUS0GD.woff2","KaTeX_SansSerif-Bold-DbIhKOiC.woff","KaTeX_SansSerif-Italic-C3H0VqGB.woff2","KaTeX_SansSerif-Italic-DN2j7dab.woff","KaTeX_SansSerif-Italic-YYjJ1zSn.ttf","KaTeX_SansSerif-Regular-BNo7hRIc.ttf","KaTeX_SansSerif-Regular-CS6fqUqJ.woff","KaTeX_SansSerif-Regular-DDBCnlJ7.woff2","KaTeX_Script-Regular-C5JkGWo-.ttf","KaTeX_Script-Regular-D3wIWfF6.woff2","KaTeX_Script-Regular-D5yQViql.woff","KaTeX_Size1-Regular-C195tn64.woff","KaTeX_Size1-Regular-Dbsnue_I.ttf","KaTeX_Size1-Regular-mCD8mA8B.woff2","KaTeX_Size2-Regular-B7gKUWhC.ttf","KaTeX_Size2-Regular-Dy4dx90m.woff2","KaTeX_Size2-Regular-oD1tc_U0.woff","KaTeX_Size3-Regular-CTq5MqoE.woff","KaTeX_Size3-Regular-DgpXs0kz.ttf","KaTeX_Size4-Regular-BF-4gkZK.woff","KaTeX_Size4-Regular-DWFBv043.ttf","KaTeX_Size4-Regular-Dl5lxZxV.woff2","KaTeX_Typewriter-Regular-C0xS9mPB.woff","KaTeX_Typewriter-Regular-CO6r4hn1.woff2","KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf","SCMPanel-BVYmayDJ.css","SettingsModal-Cy5lRC97.css","index-Ds_pheLF.css","markdown-C8LL_u4z.css","math-DMZ4qLFT.css","xterm-B1njb2Cr.css"]
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{I as r,Kt as i,a,et as o,fn as s,m as c,nn as l,qt as u,s as d,z as f}from"./i18n-D2DJ-AHq.js";import{t as p}from"./app-globals-D2ZB_kzX.js";import{t as m}from"./shortcut-stack-D0d3XzNw.js";import{t as h}from"./uuid-BzDIGCwP.js";import{t as g}from"./HintTip-CKxIx9CD.js";import{t as _}from"./FieldRow-DHxAXFtL.js";var v=e(t(),1),y=n();function b({approvalRules:e}){let t=d(),{locale:n}=a(),b=e??[],[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(null);return m(()=>{S(null),O(null)},!!x),(0,y.jsxs)(`div`,{className:`set-section`,children:[(0,y.jsxs)(`div`,{className:`set-section-title`,children:[(0,y.jsx)(l,{className:`set-section-icon`}),t(`settingsApprovalRules`),(0,y.jsx)(g,{text:t(`settingsApprovalRulesDesc`)}),(0,y.jsx)(`span`,{className:`set-count`,children:b.length}),(0,y.jsxs)(`button`,{type:`button`,className:`set-save-btn`,title:t(`approvalRuleNew`),onClick:()=>{S({id:`custom.${h().slice(0,8)}`,enabled:!0,tools:[`bash`],field:`command`,match:`regex`,value:``,action:`ask`,label:``,labelEn:``,reason:``,reasonEn:``}),E(`bash`),w(!0),O(null)},children:[(0,y.jsx)(i,{}),` `,t(`approvalRuleNew`)]})]}),x&&(0,y.jsxs)(`div`,{className:`rule-editor`,children:[(0,y.jsx)(`div`,{className:`set-section-title`,style:{fontSize:13,marginBottom:4},children:C?t(`approvalRuleNew`):`${t(`approvalRuleEdit`)} · ${x.label}`}),(0,y.jsx)(_,{label:t(`approvalRuleLabel`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.label,placeholder:t(`approvalRuleLabelPlaceholder`),onChange:e=>S({...x,label:e.target.value})})}),(0,y.jsx)(_,{label:t(`approvalRuleLabelEn`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.labelEn??``,placeholder:`e.g. Block dangerous Docker commands`,onChange:e=>S({...x,labelEn:e.target.value})})}),(0,y.jsx)(_,{label:t(`approvalRuleTools`),tip:t(`approvalRuleToolsTip`),children:(0,y.jsx)(`input`,{className:`set-input`,value:T,placeholder:t(`approvalRuleToolsPlaceholder`),onChange:e=>{E(e.target.value);let t=e.target.value.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean);S({...x,tools:t.length>0?t:[`*`]})}})}),(0,y.jsxs)(`div`,{style:{display:`flex`,gap:10,flexWrap:`wrap`},children:[(0,y.jsx)(`div`,{style:{flex:1,minWidth:160},children:(0,y.jsx)(_,{label:t(`approvalRuleField`),children:(0,y.jsxs)(`select`,{className:`set-select`,value:x.field,onChange:e=>S({...x,field:e.target.value}),children:[(0,y.jsx)(`option`,{value:`command`,children:t(`approvalRuleFieldCommand`)}),(0,y.jsx)(`option`,{value:`path`,children:t(`approvalRuleFieldPath`)}),(0,y.jsx)(`option`,{value:`params`,children:t(`approvalRuleFieldParams`)})]})})}),(0,y.jsx)(`div`,{style:{flex:1,minWidth:160},children:(0,y.jsx)(_,{label:t(`approvalRuleMatch`),children:(0,y.jsxs)(`select`,{className:`set-select`,value:x.match,onChange:e=>S({...x,match:e.target.value}),children:[(0,y.jsx)(`option`,{value:`regex`,children:t(`approvalRuleMatchRegex`)}),(0,y.jsx)(`option`,{value:`glob`,children:t(`approvalRuleMatchGlob`)}),(0,y.jsx)(`option`,{value:`contains`,children:t(`approvalRuleMatchContains`)}),(0,y.jsx)(`option`,{value:`prefix`,children:t(`approvalRuleMatchPrefix`)}),(0,y.jsx)(`option`,{value:`outside_workspace`,children:t(`approvalRuleMatchOutsideWs`)})]})})}),(0,y.jsx)(`div`,{style:{flex:1,minWidth:160},children:(0,y.jsx)(_,{label:t(`approvalRuleActionLabel`),children:(0,y.jsxs)(`select`,{className:`set-select`,value:x.action,onChange:e=>S({...x,action:e.target.value}),children:[(0,y.jsx)(`option`,{value:`ask`,children:t(`approvalRuleActionAsk`)}),(0,y.jsx)(`option`,{value:`deny`,children:t(`approvalRuleActionDeny`)}),(0,y.jsx)(`option`,{value:`allow`,children:t(`approvalRuleActionAllow`)})]})})})]}),x.match!==`outside_workspace`&&(0,y.jsx)(_,{label:t(`approvalRuleValue`),tip:t(`approvalRuleValueTip`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.value,placeholder:t(`approvalRuleValuePlaceholder`),onChange:e=>S({...x,value:e.target.value})})}),(0,y.jsx)(_,{label:t(`approvalRuleReason`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.reason??``,placeholder:t(`approvalRuleReasonPlaceholder`),onChange:e=>S({...x,reason:e.target.value})})}),(0,y.jsx)(_,{label:t(`approvalRuleReasonEn`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.reasonEn??``,placeholder:`e.g. Detected docker image/container removal`,onChange:e=>S({...x,reasonEn:e.target.value})})}),(0,y.jsx)(`div`,{className:`set-row`,children:(0,y.jsxs)(`label`,{className:`set-checkbox-label`,style:{display:`inline-flex`,alignItems:`center`,gap:6},children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:x.enabled,onChange:e=>S({...x,enabled:e.target.checked})}),t(`approvalRuleEnabled`)]})}),D&&(0,y.jsx)(`div`,{style:{color:`var(--red, #ef4444)`,fontSize:12},children:D}),(0,y.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:4},children:[(0,y.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{S(null),O(null)},children:t(`cancel`)}),(0,y.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>{if(!x.label.trim())O(t(`approvalRuleLabelRequired`));else{if(x.match===`regex`)try{new RegExp(x.value)}catch(e){O(t(`approvalRuleRegexInvalid`,{msg:e.message}));return}p({type:`save_approval_rule`,rule:x}),S(null),O(null)}},children:t(`save`)})]})]}),b.length===0?(0,y.jsx)(`p`,{className:`set-hint`,children:t(`approvalRuleEmpty`)}):(0,y.jsx)(`div`,{className:`set-list set-list-flat`,children:b.map((e,i)=>{let a=e.builtin===!0;return(0,y.jsxs)(`div`,{className:`set-row${e.enabled?``:` rule-row-disabled`}`,style:{alignItems:`flex-start`,padding:`12px 0`},children:[(0,y.jsxs)(`div`,{className:`set-row-info`,children:[(0,y.jsxs)(`div`,{className:`set-row-name`,style:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:6},children:[(0,y.jsx)(`span`,{className:`rule-badge ${e.action}`,children:e.action===`deny`?t(`approvalRuleActionDeny`):e.action===`allow`?t(`approvalRuleActionAllow`):t(`approvalRuleActionAsk`)}),(0,y.jsx)(`strong`,{style:{fontSize:13},children:c(n)?e.label:e.labelEn||e.label}),a&&(0,y.jsx)(`span`,{className:`tpl-badge`,children:t(`approvalRuleBuiltin`)}),(0,y.jsx)(`span`,{className:`rule-meta-code`,children:e.tools.join(`, `)})]}),(0,y.jsxs)(`div`,{className:`set-hint`,style:{marginTop:6,display:`flex`,flexDirection:`column`,gap:3},children:[(0,y.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6,flexWrap:`wrap`},children:[(0,y.jsxs)(`span`,{style:{opacity:.85,fontSize:11,fontFamily:`var(--mono)`},children:[`[`,e.field,` · `,e.match,`]`]}),e.match!==`outside_workspace`&&(0,y.jsx)(`code`,{className:`rule-pattern-code`,children:e.value})]}),(e.reason||e.reasonEn)&&(0,y.jsx)(`div`,{style:{opacity:.75,fontSize:11},children:c(n)?e.reason:e.reasonEn||e.reason})]})]}),(0,y.jsxs)(`div`,{className:`set-row-actions`,style:{marginLeft:12,flexShrink:0},children:[(0,y.jsx)(`button`,{type:`button`,className:`set-switch${e.enabled?` on`:``}`,role:`switch`,"aria-checked":e.enabled,title:e.enabled?t(`settingsEnabled`):t(`settingsDisabled`),onClick:()=>p({type:`save_approval_rule`,rule:{...e,enabled:!e.enabled}}),children:(0,y.jsx)(`span`,{className:`set-switch-knob`})}),!a&&i>0&&(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn`,title:t(`approvalRuleMoveUp`),onClick:()=>{let e=[...b],t=e[i-1];e[i-1]=e[i],e[i]=t,p({type:`save_approval_rules`,rules:e})},children:(0,y.jsx)(f,{})}),!a&&i<b.length-1&&(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn`,title:t(`approvalRuleMoveDown`),onClick:()=>{let e=[...b],t=e[i+1];e[i+1]=e[i],e[i]=t,p({type:`save_approval_rules`,rules:e})},children:(0,y.jsx)(r,{})}),a&&(j===e.id?(0,y.jsx)(`button`,{type:`button`,className:`set-uninstall confirm`,onClick:()=>{p({type:`reset_builtin_approval_rule`,id:e.id}),M(null)},children:t(`uninstallConfirm`)}):(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn`,title:t(`approvalRuleReset`),onClick:()=>M(e.id),children:(0,y.jsx)(u,{})})),(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn`,title:t(`approvalRuleEdit`),onClick:()=>{S({...e}),E(e.tools.join(`, `)),w(!1),O(null)},children:(0,y.jsx)(o,{})}),!a&&(k===e.id?(0,y.jsx)(`button`,{type:`button`,className:`set-uninstall confirm`,onClick:()=>{p({type:`delete_approval_rule`,id:e.id}),A(null)},children:t(`uninstallConfirm`)}):(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn danger`,title:t(`approvalRuleDelete`),onClick:()=>A(e.id),children:(0,y.jsx)(s,{})}))]})]},e.id)})})]})}export{b as ApprovalRulesTab};
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{I as r,Kt as i,a,et as o,fn as s,m as c,nn as l,qt as u,s as d,z as f}from"./i18n-N1glykLZ.js";import{t as p}from"./app-globals-D2ZB_kzX.js";import{t as m}from"./shortcut-stack-D0d3XzNw.js";import{t as h}from"./uuid-BzDIGCwP.js";import{t as g}from"./HintTip-DUbCHF8G.js";import{t as _}from"./FieldRow-BQ43ENLa.js";var v=e(t(),1),y=n();function b({approvalRules:e}){let t=d(),{locale:n}=a(),b=e??[],[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(null);return m(()=>{S(null),O(null)},!!x),(0,y.jsxs)(`div`,{className:`set-section`,children:[(0,y.jsxs)(`div`,{className:`set-section-title`,children:[(0,y.jsx)(l,{className:`set-section-icon`}),t(`settingsApprovalRules`),(0,y.jsx)(g,{text:t(`settingsApprovalRulesDesc`)}),(0,y.jsx)(`span`,{className:`set-count`,children:b.length}),(0,y.jsxs)(`button`,{type:`button`,className:`set-save-btn`,title:t(`approvalRuleNew`),onClick:()=>{S({id:`custom.${h().slice(0,8)}`,enabled:!0,tools:[`bash`],field:`command`,match:`regex`,value:``,action:`ask`,label:``,labelEn:``,reason:``,reasonEn:``}),E(`bash`),w(!0),O(null)},children:[(0,y.jsx)(i,{}),` `,t(`approvalRuleNew`)]})]}),x&&(0,y.jsxs)(`div`,{className:`rule-editor`,children:[(0,y.jsx)(`div`,{className:`set-section-title`,style:{fontSize:13,marginBottom:4},children:C?t(`approvalRuleNew`):`${t(`approvalRuleEdit`)} · ${x.label}`}),(0,y.jsx)(_,{label:t(`approvalRuleLabel`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.label,placeholder:t(`approvalRuleLabelPlaceholder`),onChange:e=>S({...x,label:e.target.value})})}),(0,y.jsx)(_,{label:t(`approvalRuleLabelEn`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.labelEn??``,placeholder:`e.g. Block dangerous Docker commands`,onChange:e=>S({...x,labelEn:e.target.value})})}),(0,y.jsx)(_,{label:t(`approvalRuleTools`),tip:t(`approvalRuleToolsTip`),children:(0,y.jsx)(`input`,{className:`set-input`,value:T,placeholder:t(`approvalRuleToolsPlaceholder`),onChange:e=>{E(e.target.value);let t=e.target.value.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean);S({...x,tools:t.length>0?t:[`*`]})}})}),(0,y.jsxs)(`div`,{style:{display:`flex`,gap:10,flexWrap:`wrap`},children:[(0,y.jsx)(`div`,{style:{flex:1,minWidth:160},children:(0,y.jsx)(_,{label:t(`approvalRuleField`),children:(0,y.jsxs)(`select`,{className:`set-select`,value:x.field,onChange:e=>S({...x,field:e.target.value}),children:[(0,y.jsx)(`option`,{value:`command`,children:t(`approvalRuleFieldCommand`)}),(0,y.jsx)(`option`,{value:`path`,children:t(`approvalRuleFieldPath`)}),(0,y.jsx)(`option`,{value:`params`,children:t(`approvalRuleFieldParams`)})]})})}),(0,y.jsx)(`div`,{style:{flex:1,minWidth:160},children:(0,y.jsx)(_,{label:t(`approvalRuleMatch`),children:(0,y.jsxs)(`select`,{className:`set-select`,value:x.match,onChange:e=>S({...x,match:e.target.value}),children:[(0,y.jsx)(`option`,{value:`regex`,children:t(`approvalRuleMatchRegex`)}),(0,y.jsx)(`option`,{value:`glob`,children:t(`approvalRuleMatchGlob`)}),(0,y.jsx)(`option`,{value:`contains`,children:t(`approvalRuleMatchContains`)}),(0,y.jsx)(`option`,{value:`prefix`,children:t(`approvalRuleMatchPrefix`)}),(0,y.jsx)(`option`,{value:`outside_workspace`,children:t(`approvalRuleMatchOutsideWs`)})]})})}),(0,y.jsx)(`div`,{style:{flex:1,minWidth:160},children:(0,y.jsx)(_,{label:t(`approvalRuleActionLabel`),children:(0,y.jsxs)(`select`,{className:`set-select`,value:x.action,onChange:e=>S({...x,action:e.target.value}),children:[(0,y.jsx)(`option`,{value:`ask`,children:t(`approvalRuleActionAsk`)}),(0,y.jsx)(`option`,{value:`deny`,children:t(`approvalRuleActionDeny`)}),(0,y.jsx)(`option`,{value:`allow`,children:t(`approvalRuleActionAllow`)})]})})})]}),x.match!==`outside_workspace`&&(0,y.jsx)(_,{label:t(`approvalRuleValue`),tip:t(`approvalRuleValueTip`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.value,placeholder:t(`approvalRuleValuePlaceholder`),onChange:e=>S({...x,value:e.target.value})})}),(0,y.jsx)(_,{label:t(`approvalRuleReason`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.reason??``,placeholder:t(`approvalRuleReasonPlaceholder`),onChange:e=>S({...x,reason:e.target.value})})}),(0,y.jsx)(_,{label:t(`approvalRuleReasonEn`),children:(0,y.jsx)(`input`,{className:`set-input`,value:x.reasonEn??``,placeholder:`e.g. Detected docker image/container removal`,onChange:e=>S({...x,reasonEn:e.target.value})})}),(0,y.jsx)(`div`,{className:`set-row`,children:(0,y.jsxs)(`label`,{className:`set-checkbox-label`,style:{display:`inline-flex`,alignItems:`center`,gap:6},children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:x.enabled,onChange:e=>S({...x,enabled:e.target.checked})}),t(`approvalRuleEnabled`)]})}),D&&(0,y.jsx)(`div`,{style:{color:`var(--red, #ef4444)`,fontSize:12},children:D}),(0,y.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:4},children:[(0,y.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{S(null),O(null)},children:t(`cancel`)}),(0,y.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>{if(!x.label.trim())O(t(`approvalRuleLabelRequired`));else{if(x.match===`regex`)try{new RegExp(x.value)}catch(e){O(t(`approvalRuleRegexInvalid`,{msg:e.message}));return}p({type:`save_approval_rule`,rule:x}),S(null),O(null)}},children:t(`save`)})]})]}),b.length===0?(0,y.jsx)(`p`,{className:`set-hint`,children:t(`approvalRuleEmpty`)}):(0,y.jsx)(`div`,{className:`set-list set-list-flat`,children:b.map((e,i)=>{let a=e.builtin===!0;return(0,y.jsxs)(`div`,{className:`set-row${e.enabled?``:` rule-row-disabled`}`,style:{alignItems:`flex-start`,padding:`12px 0`},children:[(0,y.jsxs)(`div`,{className:`set-row-info`,children:[(0,y.jsxs)(`div`,{className:`set-row-name`,style:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:6},children:[(0,y.jsx)(`span`,{className:`rule-badge ${e.action}`,children:e.action===`deny`?t(`approvalRuleActionDeny`):e.action===`allow`?t(`approvalRuleActionAllow`):t(`approvalRuleActionAsk`)}),(0,y.jsx)(`strong`,{style:{fontSize:13},children:c(n)?e.label:e.labelEn||e.label}),a&&(0,y.jsx)(`span`,{className:`tpl-badge`,children:t(`approvalRuleBuiltin`)}),(0,y.jsx)(`span`,{className:`rule-meta-code`,children:e.tools.join(`, `)})]}),(0,y.jsxs)(`div`,{className:`set-hint`,style:{marginTop:6,display:`flex`,flexDirection:`column`,gap:3},children:[(0,y.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6,flexWrap:`wrap`},children:[(0,y.jsxs)(`span`,{style:{opacity:.85,fontSize:11,fontFamily:`var(--mono)`},children:[`[`,e.field,` · `,e.match,`]`]}),e.match!==`outside_workspace`&&(0,y.jsx)(`code`,{className:`rule-pattern-code`,children:e.value})]}),(e.reason||e.reasonEn)&&(0,y.jsx)(`div`,{style:{opacity:.75,fontSize:11},children:c(n)?e.reason:e.reasonEn||e.reason})]})]}),(0,y.jsxs)(`div`,{className:`set-row-actions`,style:{marginLeft:12,flexShrink:0},children:[(0,y.jsx)(`button`,{type:`button`,className:`set-switch${e.enabled?` on`:``}`,role:`switch`,"aria-checked":e.enabled,title:e.enabled?t(`settingsEnabled`):t(`settingsDisabled`),onClick:()=>p({type:`save_approval_rule`,rule:{...e,enabled:!e.enabled}}),children:(0,y.jsx)(`span`,{className:`set-switch-knob`})}),!a&&i>0&&(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn`,title:t(`approvalRuleMoveUp`),onClick:()=>{let e=[...b],t=e[i-1];e[i-1]=e[i],e[i]=t,p({type:`save_approval_rules`,rules:e})},children:(0,y.jsx)(f,{})}),!a&&i<b.length-1&&(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn`,title:t(`approvalRuleMoveDown`),onClick:()=>{let e=[...b],t=e[i+1];e[i+1]=e[i],e[i]=t,p({type:`save_approval_rules`,rules:e})},children:(0,y.jsx)(r,{})}),a&&(j===e.id?(0,y.jsx)(`button`,{type:`button`,className:`set-uninstall confirm`,onClick:()=>{p({type:`reset_builtin_approval_rule`,id:e.id}),M(null)},children:t(`uninstallConfirm`)}):(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn`,title:t(`approvalRuleReset`),onClick:()=>M(e.id),children:(0,y.jsx)(u,{})})),(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn`,title:t(`approvalRuleEdit`),onClick:()=>{S({...e}),E(e.tools.join(`, `)),w(!1),O(null)},children:(0,y.jsx)(o,{})}),!a&&(k===e.id?(0,y.jsx)(`button`,{type:`button`,className:`set-uninstall confirm`,onClick:()=>{p({type:`delete_approval_rule`,id:e.id}),A(null)},children:t(`uninstallConfirm`)}):(0,y.jsx)(`button`,{type:`button`,className:`set-icon-btn danger`,title:t(`approvalRuleDelete`),onClick:()=>A(e.id),children:(0,y.jsx)(s,{})}))]})]},e.id)})})]})}export{b as ApprovalRulesTab};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{I as r,R as i,a,bn as o,bt as s,on as c,qt as l,s as u}from"./i18n-D2DJ-AHq.js";import{f as d,h as f,m as p,n as m}from"./file-preview-bridge-F9LjmrJs.js";import{a as h}from"./api-client-B2iSv9kK.js";import{t as g}from"./app-globals-D2ZB_kzX.js";import{t as _}from"./host-icon-DMg5PU4C.js";import{En as v,Kt as y,Ut as b,b as ee}from"./index-CP0EEOA0.js";var x=e(t(),1),S=n();function C(e,t){let n=Math.max(0,Date.now()-e),r=Math.floor(n/6e4);if(r<1)return t(`bgTaskJustNow`);if(r<60)return t(`bgTaskMinutes`,{n:r});let i=Math.floor(r/60);return i<24?t(`bgTaskHours`,{n:i}):t(`bgTaskDays`,{n:Math.floor(i/24)})}function w(e){return e.kind??(e.taskId?`plugin`:`port`)}function T({servers:e,tasks:t=[],onClearFinished:n,onClearTask:T,onClose:E,plugins:D=[],epoch:O=0,send:k,onUiAction:te,autoCleanupMin:A=0}){let j=u(),{locale:M}=a();(0,x.useEffect)(()=>{g({type:`list_bg_servers`})},[]),(0,x.useMemo)(()=>e.filter(e=>w(e)===`job`),[e]);let N=e=>w(e)===`job`?d(e.status)??`running`:`running`,P=(0,x.useMemo)(()=>e.filter(e=>w(e)!==`job`||N(e)===`running`).length,[e]),ne=(0,x.useMemo)(()=>(b(y(D),{locale:M,t:e=>j(e)})[`tasks.panel`]??[]).filter(e=>!e.hidden&&e.source!==`host`&&e.kind!==`divider`),[D,M,j]),[F,I]=(0,x.useState)(new Set),[L,R]=(0,x.useState)(!1),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)(``),[re,U]=(0,x.useState)(`running`),[W,G]=(0,x.useState)(null),[K,q]=(0,x.useState)(``),J=(0,x.useRef)(null),Y=(0,x.useRef)(null),X=(e,t,n)=>{B(r=>r?.rowKey===e?null:{rowKey:e,id:t,label:n})},Z=e=>!z||z.rowKey!==e?null:(0,S.jsxs)(`div`,{className:`bg-task-live-log`,onClick:e=>e.stopPropagation(),children:[W?(0,S.jsx)(`div`,{className:`bg-task-run-error`,children:W}):(0,S.jsx)(`pre`,{ref:Y,className:`bg-task-live-pre mono`,children:V||`...`}),re===`running`&&(0,S.jsxs)(`form`,{className:`bg-task-live-input`,onSubmit:e=>{e.preventDefault(),ie()},children:[(0,S.jsx)(`input`,{type:`text`,className:`bg-task-stdin-field mono`,placeholder:`stdin...`,value:K,onChange:e=>q(e.target.value)}),(0,S.jsx)(`button`,{type:`submit`,className:`btn bg-task-btn sm`,disabled:!K,children:`Send`})]})]});(0,x.useEffect)(()=>{if(!z)return;let e=!1;J.current=null,H(``),U(`running`),G(null);let t=async()=>{try{let t=J.current,r=t===null?`/api/bg-tasks/${encodeURIComponent(z.id)}/log`:`/api/bg-tasks/${encodeURIComponent(z.id)}/log?offset=${t}`,i=await h(r);if(e)return;J.current=i.next,U(i.status),i.text&&H(e=>{let n=t===null?i.text:e+i.text;return n.length>1e5?n.slice(-1e5):n}),i.status!==`running`&&clearInterval(n)}catch(t){e||(G(t instanceof Error?t.message:String(t)),clearInterval(n))}};t();let n=setInterval(()=>void t(),800);return()=>{e=!0,clearInterval(n)}},[z]),(0,x.useEffect)(()=>{let e=Y.current;e&&(e.scrollTop=e.scrollHeight)},[V]);let ie=async()=>{if(!z||!K)return;let e=`${K}\n`;q(``);try{await h(`/api/bg-tasks/${encodeURIComponent(z.id)}/input`,{body:{input:e}})}catch(e){G(e instanceof Error?e.message:String(e))}},Q=(e,t)=>{I(t=>new Set(t).add(e)),t(),e.startsWith(`job:`)||(g({type:`list_bg_servers`}),setTimeout(()=>g({type:`list_bg_servers`}),1500),setTimeout(()=>g({type:`list_bg_servers`}),4e3)),setTimeout(()=>{I(t=>{let n=new Set(t);return n.delete(e),n})},8e3)},ae=e=>{let t=e.taskId??String(e.port),n=w(e);Q(t,()=>{g(n===`plugin`||n===`job`?{type:`kill_background_server`,taskId:e.taskId}:{type:`kill_background_server`,port:e.port})})},$=e=>{e.taskId&&g({type:`forget_bg_job`,taskId:e.taskId})},oe=e=>{$(e),g({type:`list_bg_servers`})};return(0,S.jsxs)(v,{className:`bg-task-modal bg-task-modal-a`,onClose:E,showCloseButton:!1,children:[(0,S.jsxs)(`div`,{className:`bg-task-head`,children:[(0,S.jsxs)(`div`,{className:`bg-task-title`,children:[(0,S.jsx)(s,{"aria-hidden":!0}),(0,S.jsx)(`span`,{children:j(`bgTasks`)}),e.length>0&&(0,S.jsx)(`em`,{className:`bg-task-count`,children:e.length===P?`${e.length} ${j(`bgTaskRunning`)}`:`${P} ${j(`bgTaskRunning`)} · ${e.length}`})]}),(0,S.jsxs)(`div`,{className:`bg-task-head-actions`,children:[(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`bgTaskRefresh`),onClick:()=>g({type:`list_bg_servers`}),children:(0,S.jsx)(l,{})}),(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`close`),onClick:E,children:(0,S.jsx)(o,{})})]})]}),(0,S.jsxs)(`div`,{className:`bg-task-body`,children:[e.length===0&&t.length===0?(0,S.jsxs)(`div`,{className:`bg-task-empty`,children:[(0,S.jsx)(s,{}),(0,S.jsx)(`span`,{children:j(`bgTasksEmpty`)}),(0,S.jsx)(`small`,{children:j(`bgTasksDesc`)})]}):null,t.length>0&&(0,S.jsxs)(`div`,{className:`bg-task-chat`,children:[(0,S.jsxs)(`div`,{className:`bg-task-kicker`,children:[(0,S.jsx)(`span`,{children:j(`bgTaskChatTitle`)}),(0,S.jsx)(`span`,{className:`sp`}),(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn ghost sm`,disabled:t.every(e=>e.status===`running`),title:j(`bgTaskClearFinished`),onClick:n,children:j(`bgTaskClearFinished`)})]}),(0,S.jsx)(`div`,{className:`bg-task-running`,children:t.map(e=>{let t=e.taskId??e.id,n=`chat:${e.id}`,a=z?.rowKey===n;return(0,S.jsxs)(`div`,{className:`bg-task-run-card ${t?`expandable`:``} ${a?`expanded`:``}`,title:e.command||void 0,onClick:()=>{t&&X(n,t,e.name)},children:[(0,S.jsxs)(`div`,{className:`bg-task-run-row`,children:[(0,S.jsx)(`span`,{className:p(e.status),"aria-hidden":!0}),(0,S.jsxs)(`div`,{className:`bg-task-run-main`,children:[(0,S.jsx)(`div`,{className:`bg-task-run-name`,children:e.name}),(0,S.jsxs)(`div`,{className:`bg-task-run-sub`,children:[(0,S.jsx)(`span`,{className:`bgn-status ${e.status}`,children:j(f(e.status))}),(0,S.jsx)(`span`,{className:`bg-task-cwd mono`,children:e.id}),e.exitCode!==void 0&&e.status!==`completed`?(0,S.jsx)(`span`,{children:j(`exitCode`,{code:e.exitCode})}):null]}),e.outputPath?(0,S.jsx)(`button`,{type:`button`,className:`bg-task-run-path mono`,title:`${j(`bgTaskOpenOutput`)}\n${e.outputPath}`,onClick:t=>{t.stopPropagation(),m({path:e.outputPath,name:e.outputPath.split(/[\\/]/).pop()||e.name})},children:e.outputPath}):null,e.error?(0,S.jsx)(`div`,{className:`bg-task-run-error`,children:e.error}):null]}),(0,S.jsxs)(`div`,{className:`bg-task-run-actions`,onClick:e=>e.stopPropagation(),children:[t&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-live-btn`,"aria-expanded":a,title:j(`bgTaskOpenOutput`),onClick:()=>X(n,t,e.name),children:a?(0,S.jsx)(r,{}):(0,S.jsx)(i,{})}),e.status===`running`?e.taskId?(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn danger sm`,disabled:F.has(e.taskId),onClick:()=>Q(e.taskId,()=>g({type:`kill_background_server`,taskId:e.taskId})),children:F.has(e.taskId)?j(`bgTaskStopping`):j(`bgTaskStop`)}):null:(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`bgTaskClearOne`),"aria-label":j(`bgTaskClearOne`),onClick:()=>T?.(e.id),children:(0,S.jsx)(o,{})})]})]}),Z(n)]},e.id)})})]}),e.length>0&&(0,S.jsx)(`div`,{className:`bg-task-running`,children:e.map(e=>{let t=w(e),n=t===`plugin`,a=t===`job`,o=N(e),s=a&&o!==`running`,c=e.taskId??String(e.port),u=n?e.plugin:a?e.name||j(`bgTaskJobKind`):`:${e.port}`,d=[e.name&&!a?e.name:null,n&&e.status?e.status:null,s?j(f(o)):null,s&&e.exitCode!==void 0&&e.exitCode!==null?`exit=${e.exitCode}`:null,s?null:j(`bgTaskSince`)+` `+C(e.since,j),!n&&e.pid?`${j(`bgTaskPid`)} ${e.pid}`:null].filter(Boolean).join(` · `),m=`srv:${c}`,h=a?e.taskId:void 0,v=!!(h&&z?.rowKey===m);return(0,S.jsxs)(`div`,{className:`bg-task-run-card ${h?`expandable`:``} ${v?`expanded`:``}`,title:e.command||void 0,onClick:()=>{h&&X(m,h,u??h)},children:[(0,S.jsxs)(`div`,{className:`bg-task-run-row`,children:[(0,S.jsx)(`span`,{className:a?p(o):`bg-task-dot`,"aria-hidden":!0}),(0,S.jsxs)(`div`,{className:`bg-task-run-main`,children:[(0,S.jsx)(`div`,{className:`bg-task-run-name`,children:u}),(0,S.jsx)(`div`,{className:`bg-task-run-sub`,children:d})]}),(0,S.jsxs)(`div`,{className:`bg-task-run-actions`,onClick:e=>e.stopPropagation(),children:[h&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-live-btn`,"aria-expanded":v,title:j(`bgTaskOpenOutput`),onClick:()=>X(m,h,u??h),children:v?(0,S.jsx)(r,{}):(0,S.jsx)(i,{})}),t===`port`&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn ${e.keep?`active`:``}`,title:e.keep?j(`bgTaskKeepOn`):j(`bgTaskKeep`),"aria-pressed":!!e.keep,onClick:()=>g({type:`set_bg_keep`,port:e.port??0,keep:!e.keep}),children:(0,S.jsx)(_,{name:`pin`})}),a&&!s&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`bgTaskRestart`),onClick:()=>g({type:`restart_bg_job`,taskId:e.taskId??``}),children:(0,S.jsx)(l,{})}),s?(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn sm`,title:j(`bgTaskClearOne`),onClick:()=>oe(e),children:j(`bgTaskClearOne`)}):(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn danger sm`,disabled:F.has(e.taskId??String(e.port)),onClick:()=>ae(e),children:F.has(e.taskId??String(e.port))?j(`bgTaskStopping`):j(`bgTaskStop`)})]})]}),Z(m)]},c)})}),ne.map(e=>{let t=D.find(t=>t.id===e.source.slice(7));return e.kind===`view`?t?(0,S.jsx)(`div`,{className:`bg-task-plugin-panel`,children:(0,S.jsx)(ee,{plugin:t,epoch:O,send:k??(()=>{})})},e.id):null:(0,S.jsx)(`button`,{type:`button`,className:`btn`,title:e.hint??e.label,onClick:()=>te?.(e),children:e.label},e.id)})]}),(0,S.jsxs)(`div`,{className:`bg-task-foot`,children:[(0,S.jsxs)(`label`,{className:`bg-task-cleanup`,title:j(`bgTaskCleanupHint`),children:[(0,S.jsx)(`span`,{children:j(`bgTaskCleanup`)}),(0,S.jsxs)(`select`,{className:`bg-task-select`,value:String(A),onChange:e=>g({type:`set_settings`,bgAutoCleanupMin:Number(e.target.value)}),children:[(0,S.jsx)(`option`,{value:`0`,children:j(`bgTaskCleanupOff`)}),[15,30,60,120].map(e=>(0,S.jsx)(`option`,{value:String(e),children:j(`bgTaskCleanupMinutes`,{n:e})},e))]})]}),(0,S.jsx)(`span`,{className:`sp`}),(0,S.jsxs)(`button`,{type:`button`,className:`btn bg-task-btn ghost danger sm`,disabled:L||e.length===0&&t.length===0,title:j(`bgTaskStopAll`),onClick:()=>{R(!0),g({type:`kill_background_servers`});for(let t of e)w(t)===`job`&&N(t)!==`running`&&$(t);n?.(),g({type:`list_bg_servers`}),setTimeout(()=>g({type:`list_bg_servers`}),1500),setTimeout(()=>g({type:`list_bg_servers`}),4e3),setTimeout(()=>R(!1),8e3)},children:[(0,S.jsx)(c,{"aria-hidden":!0}),` `,j(L?`bgTaskStopping`:`bgTaskStopAll`)]})]})]})}export{T as BgTasksModal};
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{I as r,R as i,a,bn as o,bt as s,on as c,qt as l,s as u}from"./i18n-N1glykLZ.js";import{f as d,h as f,m as p,n as m}from"./file-preview-bridge-F9LjmrJs.js";import{a as h}from"./api-client--1WOIe68.js";import{t as g}from"./app-globals-D2ZB_kzX.js";import{t as _}from"./host-icon-B-zxP_r-.js";import{En as v,Kt as y,Ut as b,b as ee}from"./index-CS3HmHb2.js";var x=e(t(),1),S=n();function C(e,t){let n=Math.max(0,Date.now()-e),r=Math.floor(n/6e4);if(r<1)return t(`bgTaskJustNow`);if(r<60)return t(`bgTaskMinutes`,{n:r});let i=Math.floor(r/60);return i<24?t(`bgTaskHours`,{n:i}):t(`bgTaskDays`,{n:Math.floor(i/24)})}function w(e){return e.kind??(e.taskId?`plugin`:`port`)}function T({servers:e,tasks:t=[],onClearFinished:n,onClearTask:T,onClose:E,plugins:D=[],epoch:O=0,send:k,onUiAction:te,autoCleanupMin:A=0}){let j=u(),{locale:M}=a();(0,x.useEffect)(()=>{g({type:`list_bg_servers`})},[]),(0,x.useMemo)(()=>e.filter(e=>w(e)===`job`),[e]);let N=e=>w(e)===`job`?d(e.status)??`running`:`running`,P=(0,x.useMemo)(()=>e.filter(e=>w(e)!==`job`||N(e)===`running`).length,[e]),ne=(0,x.useMemo)(()=>(b(y(D),{locale:M,t:e=>j(e)})[`tasks.panel`]??[]).filter(e=>!e.hidden&&e.source!==`host`&&e.kind!==`divider`),[D,M,j]),[F,I]=(0,x.useState)(new Set),[L,R]=(0,x.useState)(!1),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)(``),[re,U]=(0,x.useState)(`running`),[W,G]=(0,x.useState)(null),[K,q]=(0,x.useState)(``),J=(0,x.useRef)(null),Y=(0,x.useRef)(null),X=(e,t,n)=>{B(r=>r?.rowKey===e?null:{rowKey:e,id:t,label:n})},Z=e=>!z||z.rowKey!==e?null:(0,S.jsxs)(`div`,{className:`bg-task-live-log`,onClick:e=>e.stopPropagation(),children:[W?(0,S.jsx)(`div`,{className:`bg-task-run-error`,children:W}):(0,S.jsx)(`pre`,{ref:Y,className:`bg-task-live-pre mono`,children:V||`...`}),re===`running`&&(0,S.jsxs)(`form`,{className:`bg-task-live-input`,onSubmit:e=>{e.preventDefault(),ie()},children:[(0,S.jsx)(`input`,{type:`text`,className:`bg-task-stdin-field mono`,placeholder:`stdin...`,value:K,onChange:e=>q(e.target.value)}),(0,S.jsx)(`button`,{type:`submit`,className:`btn bg-task-btn sm`,disabled:!K,children:`Send`})]})]});(0,x.useEffect)(()=>{if(!z)return;let e=!1;J.current=null,H(``),U(`running`),G(null);let t=async()=>{try{let t=J.current,r=t===null?`/api/bg-tasks/${encodeURIComponent(z.id)}/log`:`/api/bg-tasks/${encodeURIComponent(z.id)}/log?offset=${t}`,i=await h(r);if(e)return;J.current=i.next,U(i.status),i.text&&H(e=>{let n=t===null?i.text:e+i.text;return n.length>1e5?n.slice(-1e5):n}),i.status!==`running`&&clearInterval(n)}catch(t){e||(G(t instanceof Error?t.message:String(t)),clearInterval(n))}};t();let n=setInterval(()=>void t(),800);return()=>{e=!0,clearInterval(n)}},[z]),(0,x.useEffect)(()=>{let e=Y.current;e&&(e.scrollTop=e.scrollHeight)},[V]);let ie=async()=>{if(!z||!K)return;let e=`${K}\n`;q(``);try{await h(`/api/bg-tasks/${encodeURIComponent(z.id)}/input`,{body:{input:e}})}catch(e){G(e instanceof Error?e.message:String(e))}},Q=(e,t)=>{I(t=>new Set(t).add(e)),t(),e.startsWith(`job:`)||(g({type:`list_bg_servers`}),setTimeout(()=>g({type:`list_bg_servers`}),1500),setTimeout(()=>g({type:`list_bg_servers`}),4e3)),setTimeout(()=>{I(t=>{let n=new Set(t);return n.delete(e),n})},8e3)},ae=e=>{let t=e.taskId??String(e.port),n=w(e);Q(t,()=>{g(n===`plugin`||n===`job`?{type:`kill_background_server`,taskId:e.taskId}:{type:`kill_background_server`,port:e.port})})},$=e=>{e.taskId&&g({type:`forget_bg_job`,taskId:e.taskId})},oe=e=>{$(e),g({type:`list_bg_servers`})};return(0,S.jsxs)(v,{className:`bg-task-modal bg-task-modal-a`,onClose:E,showCloseButton:!1,children:[(0,S.jsxs)(`div`,{className:`bg-task-head`,children:[(0,S.jsxs)(`div`,{className:`bg-task-title`,children:[(0,S.jsx)(s,{"aria-hidden":!0}),(0,S.jsx)(`span`,{children:j(`bgTasks`)}),e.length>0&&(0,S.jsx)(`em`,{className:`bg-task-count`,children:e.length===P?`${e.length} ${j(`bgTaskRunning`)}`:`${P} ${j(`bgTaskRunning`)} · ${e.length}`})]}),(0,S.jsxs)(`div`,{className:`bg-task-head-actions`,children:[(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`bgTaskRefresh`),onClick:()=>g({type:`list_bg_servers`}),children:(0,S.jsx)(l,{})}),(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`close`),onClick:E,children:(0,S.jsx)(o,{})})]})]}),(0,S.jsxs)(`div`,{className:`bg-task-body`,children:[e.length===0&&t.length===0?(0,S.jsxs)(`div`,{className:`bg-task-empty`,children:[(0,S.jsx)(s,{}),(0,S.jsx)(`span`,{children:j(`bgTasksEmpty`)}),(0,S.jsx)(`small`,{children:j(`bgTasksDesc`)})]}):null,t.length>0&&(0,S.jsxs)(`div`,{className:`bg-task-chat`,children:[(0,S.jsxs)(`div`,{className:`bg-task-kicker`,children:[(0,S.jsx)(`span`,{children:j(`bgTaskChatTitle`)}),(0,S.jsx)(`span`,{className:`sp`}),(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn ghost sm`,disabled:t.every(e=>e.status===`running`),title:j(`bgTaskClearFinished`),onClick:n,children:j(`bgTaskClearFinished`)})]}),(0,S.jsx)(`div`,{className:`bg-task-running`,children:t.map(e=>{let t=e.taskId??e.id,n=`chat:${e.id}`,a=z?.rowKey===n;return(0,S.jsxs)(`div`,{className:`bg-task-run-card ${t?`expandable`:``} ${a?`expanded`:``}`,title:e.command||void 0,onClick:()=>{t&&X(n,t,e.name)},children:[(0,S.jsxs)(`div`,{className:`bg-task-run-row`,children:[(0,S.jsx)(`span`,{className:p(e.status),"aria-hidden":!0}),(0,S.jsxs)(`div`,{className:`bg-task-run-main`,children:[(0,S.jsx)(`div`,{className:`bg-task-run-name`,children:e.name}),(0,S.jsxs)(`div`,{className:`bg-task-run-sub`,children:[(0,S.jsx)(`span`,{className:`bgn-status ${e.status}`,children:j(f(e.status))}),(0,S.jsx)(`span`,{className:`bg-task-cwd mono`,children:e.id}),e.exitCode!==void 0&&e.status!==`completed`?(0,S.jsx)(`span`,{children:j(`exitCode`,{code:e.exitCode})}):null]}),e.outputPath?(0,S.jsx)(`button`,{type:`button`,className:`bg-task-run-path mono`,title:`${j(`bgTaskOpenOutput`)}\n${e.outputPath}`,onClick:t=>{t.stopPropagation(),m({path:e.outputPath,name:e.outputPath.split(/[\\/]/).pop()||e.name})},children:e.outputPath}):null,e.error?(0,S.jsx)(`div`,{className:`bg-task-run-error`,children:e.error}):null]}),(0,S.jsxs)(`div`,{className:`bg-task-run-actions`,onClick:e=>e.stopPropagation(),children:[t&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-live-btn`,"aria-expanded":a,title:j(`bgTaskOpenOutput`),onClick:()=>X(n,t,e.name),children:a?(0,S.jsx)(r,{}):(0,S.jsx)(i,{})}),e.status===`running`?e.taskId?(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn danger sm`,disabled:F.has(e.taskId),onClick:()=>Q(e.taskId,()=>g({type:`kill_background_server`,taskId:e.taskId})),children:F.has(e.taskId)?j(`bgTaskStopping`):j(`bgTaskStop`)}):null:(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`bgTaskClearOne`),"aria-label":j(`bgTaskClearOne`),onClick:()=>T?.(e.id),children:(0,S.jsx)(o,{})})]})]}),Z(n)]},e.id)})})]}),e.length>0&&(0,S.jsx)(`div`,{className:`bg-task-running`,children:e.map(e=>{let t=w(e),n=t===`plugin`,a=t===`job`,o=N(e),s=a&&o!==`running`,c=e.taskId??String(e.port),u=n?e.plugin:a?e.name||j(`bgTaskJobKind`):`:${e.port}`,d=[e.name&&!a?e.name:null,n&&e.status?e.status:null,s?j(f(o)):null,s&&e.exitCode!==void 0&&e.exitCode!==null?`exit=${e.exitCode}`:null,s?null:j(`bgTaskSince`)+` `+C(e.since,j),!n&&e.pid?`${j(`bgTaskPid`)} ${e.pid}`:null].filter(Boolean).join(` · `),m=`srv:${c}`,h=a?e.taskId:void 0,v=!!(h&&z?.rowKey===m);return(0,S.jsxs)(`div`,{className:`bg-task-run-card ${h?`expandable`:``} ${v?`expanded`:``}`,title:e.command||void 0,onClick:()=>{h&&X(m,h,u??h)},children:[(0,S.jsxs)(`div`,{className:`bg-task-run-row`,children:[(0,S.jsx)(`span`,{className:a?p(o):`bg-task-dot`,"aria-hidden":!0}),(0,S.jsxs)(`div`,{className:`bg-task-run-main`,children:[(0,S.jsx)(`div`,{className:`bg-task-run-name`,children:u}),(0,S.jsx)(`div`,{className:`bg-task-run-sub`,children:d})]}),(0,S.jsxs)(`div`,{className:`bg-task-run-actions`,onClick:e=>e.stopPropagation(),children:[h&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-live-btn`,"aria-expanded":v,title:j(`bgTaskOpenOutput`),onClick:()=>X(m,h,u??h),children:v?(0,S.jsx)(r,{}):(0,S.jsx)(i,{})}),t===`port`&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn ${e.keep?`active`:``}`,title:e.keep?j(`bgTaskKeepOn`):j(`bgTaskKeep`),"aria-pressed":!!e.keep,onClick:()=>g({type:`set_bg_keep`,port:e.port??0,keep:!e.keep}),children:(0,S.jsx)(_,{name:`pin`})}),a&&!s&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`bgTaskRestart`),onClick:()=>g({type:`restart_bg_job`,taskId:e.taskId??``}),children:(0,S.jsx)(l,{})}),s?(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn sm`,title:j(`bgTaskClearOne`),onClick:()=>oe(e),children:j(`bgTaskClearOne`)}):(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn danger sm`,disabled:F.has(e.taskId??String(e.port)),onClick:()=>ae(e),children:F.has(e.taskId??String(e.port))?j(`bgTaskStopping`):j(`bgTaskStop`)})]})]}),Z(m)]},c)})}),ne.map(e=>{let t=D.find(t=>t.id===e.source.slice(7));return e.kind===`view`?t?(0,S.jsx)(`div`,{className:`bg-task-plugin-panel`,children:(0,S.jsx)(ee,{plugin:t,epoch:O,send:k??(()=>{})})},e.id):null:(0,S.jsx)(`button`,{type:`button`,className:`btn`,title:e.hint??e.label,onClick:()=>te?.(e),children:e.label},e.id)})]}),(0,S.jsxs)(`div`,{className:`bg-task-foot`,children:[(0,S.jsxs)(`label`,{className:`bg-task-cleanup`,title:j(`bgTaskCleanupHint`),children:[(0,S.jsx)(`span`,{children:j(`bgTaskCleanup`)}),(0,S.jsxs)(`select`,{className:`bg-task-select`,value:String(A),onChange:e=>g({type:`set_settings`,bgAutoCleanupMin:Number(e.target.value)}),children:[(0,S.jsx)(`option`,{value:`0`,children:j(`bgTaskCleanupOff`)}),[15,30,60,120].map(e=>(0,S.jsx)(`option`,{value:String(e),children:j(`bgTaskCleanupMinutes`,{n:e})},e))]})]}),(0,S.jsx)(`span`,{className:`sp`}),(0,S.jsxs)(`button`,{type:`button`,className:`btn bg-task-btn ghost danger sm`,disabled:L||e.length===0&&t.length===0,title:j(`bgTaskStopAll`),onClick:()=>{R(!0),g({type:`kill_background_servers`});for(let t of e)w(t)===`job`&&N(t)!==`running`&&$(t);n?.(),g({type:`list_bg_servers`}),setTimeout(()=>g({type:`list_bg_servers`}),1500),setTimeout(()=>g({type:`list_bg_servers`}),4e3),setTimeout(()=>R(!1),8e3)},children:[(0,S.jsx)(c,{"aria-hidden":!0}),` `,j(L?`bgTaskStopping`:`bgTaskStopAll`)]})]})]})}export{T as BgTasksModal};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{I as r,R as i,a,bn as o,bt as s,on as c,qt as l,s as u}from"./i18n-N1glykLZ.js";import{f as d,h as f,m as p,n as m}from"./file-preview-bridge-F9LjmrJs.js";import{a as h}from"./api-client--1WOIe68.js";import{t as g}from"./app-globals-D2ZB_kzX.js";import{t as _}from"./host-icon-B-zxP_r-.js";import{En as v,Kt as y,Ut as b,b as ee}from"./index-4VhQrBDx.js";var x=e(t(),1),S=n();function C(e,t){let n=Math.max(0,Date.now()-e),r=Math.floor(n/6e4);if(r<1)return t(`bgTaskJustNow`);if(r<60)return t(`bgTaskMinutes`,{n:r});let i=Math.floor(r/60);return i<24?t(`bgTaskHours`,{n:i}):t(`bgTaskDays`,{n:Math.floor(i/24)})}function w(e){return e.kind??(e.taskId?`plugin`:`port`)}function T({servers:e,tasks:t=[],onClearFinished:n,onClearTask:T,onClose:E,plugins:D=[],epoch:O=0,send:k,onUiAction:te,autoCleanupMin:A=0}){let j=u(),{locale:M}=a();(0,x.useEffect)(()=>{g({type:`list_bg_servers`})},[]),(0,x.useMemo)(()=>e.filter(e=>w(e)===`job`),[e]);let N=e=>w(e)===`job`?d(e.status)??`running`:`running`,P=(0,x.useMemo)(()=>e.filter(e=>w(e)!==`job`||N(e)===`running`).length,[e]),ne=(0,x.useMemo)(()=>(b(y(D),{locale:M,t:e=>j(e)})[`tasks.panel`]??[]).filter(e=>!e.hidden&&e.source!==`host`&&e.kind!==`divider`),[D,M,j]),[F,I]=(0,x.useState)(new Set),[L,R]=(0,x.useState)(!1),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)(``),[re,U]=(0,x.useState)(`running`),[W,G]=(0,x.useState)(null),[K,q]=(0,x.useState)(``),J=(0,x.useRef)(null),Y=(0,x.useRef)(null),X=(e,t,n)=>{B(r=>r?.rowKey===e?null:{rowKey:e,id:t,label:n})},Z=e=>!z||z.rowKey!==e?null:(0,S.jsxs)(`div`,{className:`bg-task-live-log`,onClick:e=>e.stopPropagation(),children:[W?(0,S.jsx)(`div`,{className:`bg-task-run-error`,children:W}):(0,S.jsx)(`pre`,{ref:Y,className:`bg-task-live-pre mono`,children:V||`...`}),re===`running`&&(0,S.jsxs)(`form`,{className:`bg-task-live-input`,onSubmit:e=>{e.preventDefault(),ie()},children:[(0,S.jsx)(`input`,{type:`text`,className:`bg-task-stdin-field mono`,placeholder:`stdin...`,value:K,onChange:e=>q(e.target.value)}),(0,S.jsx)(`button`,{type:`submit`,className:`btn bg-task-btn sm`,disabled:!K,children:`Send`})]})]});(0,x.useEffect)(()=>{if(!z)return;let e=!1;J.current=null,H(``),U(`running`),G(null);let t=async()=>{try{let t=J.current,r=t===null?`/api/bg-tasks/${encodeURIComponent(z.id)}/log`:`/api/bg-tasks/${encodeURIComponent(z.id)}/log?offset=${t}`,i=await h(r);if(e)return;J.current=i.next,U(i.status),i.text&&H(e=>{let n=t===null?i.text:e+i.text;return n.length>1e5?n.slice(-1e5):n}),i.status!==`running`&&clearInterval(n)}catch(t){e||(G(t instanceof Error?t.message:String(t)),clearInterval(n))}};t();let n=setInterval(()=>void t(),800);return()=>{e=!0,clearInterval(n)}},[z]),(0,x.useEffect)(()=>{let e=Y.current;e&&(e.scrollTop=e.scrollHeight)},[V]);let ie=async()=>{if(!z||!K)return;let e=`${K}\n`;q(``);try{await h(`/api/bg-tasks/${encodeURIComponent(z.id)}/input`,{body:{input:e}})}catch(e){G(e instanceof Error?e.message:String(e))}},Q=(e,t)=>{I(t=>new Set(t).add(e)),t(),e.startsWith(`job:`)||(g({type:`list_bg_servers`}),setTimeout(()=>g({type:`list_bg_servers`}),1500),setTimeout(()=>g({type:`list_bg_servers`}),4e3)),setTimeout(()=>{I(t=>{let n=new Set(t);return n.delete(e),n})},8e3)},ae=e=>{let t=e.taskId??String(e.port),n=w(e);Q(t,()=>{g(n===`plugin`||n===`job`?{type:`kill_background_server`,taskId:e.taskId}:{type:`kill_background_server`,port:e.port})})},$=e=>{e.taskId&&g({type:`forget_bg_job`,taskId:e.taskId})},oe=e=>{$(e),g({type:`list_bg_servers`})};return(0,S.jsxs)(v,{className:`bg-task-modal bg-task-modal-a`,onClose:E,showCloseButton:!1,children:[(0,S.jsxs)(`div`,{className:`bg-task-head`,children:[(0,S.jsxs)(`div`,{className:`bg-task-title`,children:[(0,S.jsx)(s,{"aria-hidden":!0}),(0,S.jsx)(`span`,{children:j(`bgTasks`)}),e.length>0&&(0,S.jsx)(`em`,{className:`bg-task-count`,children:e.length===P?`${e.length} ${j(`bgTaskRunning`)}`:`${P} ${j(`bgTaskRunning`)} · ${e.length}`})]}),(0,S.jsxs)(`div`,{className:`bg-task-head-actions`,children:[(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`bgTaskRefresh`),onClick:()=>g({type:`list_bg_servers`}),children:(0,S.jsx)(l,{})}),(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`close`),onClick:E,children:(0,S.jsx)(o,{})})]})]}),(0,S.jsxs)(`div`,{className:`bg-task-body`,children:[e.length===0&&t.length===0?(0,S.jsxs)(`div`,{className:`bg-task-empty`,children:[(0,S.jsx)(s,{}),(0,S.jsx)(`span`,{children:j(`bgTasksEmpty`)}),(0,S.jsx)(`small`,{children:j(`bgTasksDesc`)})]}):null,t.length>0&&(0,S.jsxs)(`div`,{className:`bg-task-chat`,children:[(0,S.jsxs)(`div`,{className:`bg-task-kicker`,children:[(0,S.jsx)(`span`,{children:j(`bgTaskChatTitle`)}),(0,S.jsx)(`span`,{className:`sp`}),(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn ghost sm`,disabled:t.every(e=>e.status===`running`),title:j(`bgTaskClearFinished`),onClick:n,children:j(`bgTaskClearFinished`)})]}),(0,S.jsx)(`div`,{className:`bg-task-running`,children:t.map(e=>{let t=e.taskId??e.id,n=`chat:${e.id}`,a=z?.rowKey===n;return(0,S.jsxs)(`div`,{className:`bg-task-run-card ${t?`expandable`:``} ${a?`expanded`:``}`,title:e.command||void 0,onClick:()=>{t&&X(n,t,e.name)},children:[(0,S.jsxs)(`div`,{className:`bg-task-run-row`,children:[(0,S.jsx)(`span`,{className:p(e.status),"aria-hidden":!0}),(0,S.jsxs)(`div`,{className:`bg-task-run-main`,children:[(0,S.jsx)(`div`,{className:`bg-task-run-name`,children:e.name}),(0,S.jsxs)(`div`,{className:`bg-task-run-sub`,children:[(0,S.jsx)(`span`,{className:`bgn-status ${e.status}`,children:j(f(e.status))}),(0,S.jsx)(`span`,{className:`bg-task-cwd mono`,children:e.id}),e.exitCode!==void 0&&e.status!==`completed`?(0,S.jsx)(`span`,{children:j(`exitCode`,{code:e.exitCode})}):null]}),e.outputPath?(0,S.jsx)(`button`,{type:`button`,className:`bg-task-run-path mono`,title:`${j(`bgTaskOpenOutput`)}\n${e.outputPath}`,onClick:t=>{t.stopPropagation(),m({path:e.outputPath,name:e.outputPath.split(/[\\/]/).pop()||e.name})},children:e.outputPath}):null,e.error?(0,S.jsx)(`div`,{className:`bg-task-run-error`,children:e.error}):null]}),(0,S.jsxs)(`div`,{className:`bg-task-run-actions`,onClick:e=>e.stopPropagation(),children:[t&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-live-btn`,"aria-expanded":a,title:j(`bgTaskOpenOutput`),onClick:()=>X(n,t,e.name),children:a?(0,S.jsx)(r,{}):(0,S.jsx)(i,{})}),e.status===`running`?e.taskId?(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn danger sm`,disabled:F.has(e.taskId),onClick:()=>Q(e.taskId,()=>g({type:`kill_background_server`,taskId:e.taskId})),children:F.has(e.taskId)?j(`bgTaskStopping`):j(`bgTaskStop`)}):null:(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`bgTaskClearOne`),"aria-label":j(`bgTaskClearOne`),onClick:()=>T?.(e.id),children:(0,S.jsx)(o,{})})]})]}),Z(n)]},e.id)})})]}),e.length>0&&(0,S.jsx)(`div`,{className:`bg-task-running`,children:e.map(e=>{let t=w(e),n=t===`plugin`,a=t===`job`,o=N(e),s=a&&o!==`running`,c=e.taskId??String(e.port),u=n?e.plugin:a?e.name||j(`bgTaskJobKind`):`:${e.port}`,d=[e.name&&!a?e.name:null,n&&e.status?e.status:null,s?j(f(o)):null,s&&e.exitCode!==void 0&&e.exitCode!==null?`exit=${e.exitCode}`:null,s?null:j(`bgTaskSince`)+` `+C(e.since,j),!n&&e.pid?`${j(`bgTaskPid`)} ${e.pid}`:null].filter(Boolean).join(` · `),m=`srv:${c}`,h=a?e.taskId:void 0,v=!!(h&&z?.rowKey===m);return(0,S.jsxs)(`div`,{className:`bg-task-run-card ${h?`expandable`:``} ${v?`expanded`:``}`,title:e.command||void 0,onClick:()=>{h&&X(m,h,u??h)},children:[(0,S.jsxs)(`div`,{className:`bg-task-run-row`,children:[(0,S.jsx)(`span`,{className:a?p(o):`bg-task-dot`,"aria-hidden":!0}),(0,S.jsxs)(`div`,{className:`bg-task-run-main`,children:[(0,S.jsx)(`div`,{className:`bg-task-run-name`,children:u}),(0,S.jsx)(`div`,{className:`bg-task-run-sub`,children:d})]}),(0,S.jsxs)(`div`,{className:`bg-task-run-actions`,onClick:e=>e.stopPropagation(),children:[h&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-live-btn`,"aria-expanded":v,title:j(`bgTaskOpenOutput`),onClick:()=>X(m,h,u??h),children:v?(0,S.jsx)(r,{}):(0,S.jsx)(i,{})}),t===`port`&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn ${e.keep?`active`:``}`,title:e.keep?j(`bgTaskKeepOn`):j(`bgTaskKeep`),"aria-pressed":!!e.keep,onClick:()=>g({type:`set_bg_keep`,port:e.port??0,keep:!e.keep}),children:(0,S.jsx)(_,{name:`pin`})}),a&&!s&&(0,S.jsx)(`button`,{type:`button`,className:`bg-task-icon-btn`,title:j(`bgTaskRestart`),onClick:()=>g({type:`restart_bg_job`,taskId:e.taskId??``}),children:(0,S.jsx)(l,{})}),s?(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn sm`,title:j(`bgTaskClearOne`),onClick:()=>oe(e),children:j(`bgTaskClearOne`)}):(0,S.jsx)(`button`,{type:`button`,className:`btn bg-task-btn danger sm`,disabled:F.has(e.taskId??String(e.port)),onClick:()=>ae(e),children:F.has(e.taskId??String(e.port))?j(`bgTaskStopping`):j(`bgTaskStop`)})]})]}),Z(m)]},c)})}),ne.map(e=>{let t=D.find(t=>t.id===e.source.slice(7));return e.kind===`view`?t?(0,S.jsx)(`div`,{className:`bg-task-plugin-panel`,children:(0,S.jsx)(ee,{plugin:t,epoch:O,send:k??(()=>{})})},e.id):null:(0,S.jsx)(`button`,{type:`button`,className:`btn`,title:e.hint??e.label,onClick:()=>te?.(e),children:e.label},e.id)})]}),(0,S.jsxs)(`div`,{className:`bg-task-foot`,children:[(0,S.jsxs)(`label`,{className:`bg-task-cleanup`,title:j(`bgTaskCleanupHint`),children:[(0,S.jsx)(`span`,{children:j(`bgTaskCleanup`)}),(0,S.jsxs)(`select`,{className:`bg-task-select`,value:String(A),onChange:e=>g({type:`set_settings`,bgAutoCleanupMin:Number(e.target.value)}),children:[(0,S.jsx)(`option`,{value:`0`,children:j(`bgTaskCleanupOff`)}),[15,30,60,120].map(e=>(0,S.jsx)(`option`,{value:String(e),children:j(`bgTaskCleanupMinutes`,{n:e})},e))]})]}),(0,S.jsx)(`span`,{className:`sp`}),(0,S.jsxs)(`button`,{type:`button`,className:`btn bg-task-btn ghost danger sm`,disabled:L||e.length===0&&t.length===0,title:j(`bgTaskStopAll`),onClick:()=>{R(!0),g({type:`kill_background_servers`});for(let t of e)w(t)===`job`&&N(t)!==`running`&&$(t);n?.(),g({type:`list_bg_servers`}),setTimeout(()=>g({type:`list_bg_servers`}),1500),setTimeout(()=>g({type:`list_bg_servers`}),4e3),setTimeout(()=>R(!1),8e3)},children:[(0,S.jsx)(c,{"aria-hidden":!0}),` `,j(L?`bgTaskStopping`:`bgTaskStopAll`)]})]})]})}export{T as BgTasksModal};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{Jt as r,X as i,s as a}from"./i18n-D2DJ-AHq.js";var o=e(t(),1),s=n();function c({settings:e,onChange:t}){let n=a(),c=(0,o.useId)(),l=e.botDraftPrompt??``,u=e.botDraftDefaultPrompt??``,[d,f]=(0,o.useState)(l),p=(0,o.useRef)(!1);(0,o.useEffect)(()=>{p.current||f(l)},[l]);let m=e=>{e!==l&&t({botDraftPrompt:e})},h=!d.trim()&&!l.trim();return(0,s.jsxs)(`div`,{className:`set-section`,children:[(0,s.jsxs)(`div`,{className:`set-section-title`,children:[(0,s.jsx)(i,{className:`set-section-icon`}),n(`settingsBotsTitle`)]}),(0,s.jsx)(`p`,{className:`set-hint`,children:n(`botDraftSettingsDesc`)}),(0,s.jsx)(`label`,{className:`set-row-name`,htmlFor:c+`-prompt`,children:n(`botDraftPrompt`)}),(0,s.jsx)(`textarea`,{id:c+`-prompt`,className:`set-prompt-input`,rows:6,value:d,placeholder:u||n(`botDraftPromptPlaceholder`),"aria-describedby":c+`-prompt-hint`,onFocus:()=>{p.current=!0},onChange:e=>f(e.target.value),onBlur:()=>{p.current=!1,m(d)}}),(0,s.jsxs)(`div`,{className:`quick-ask-settings-editor-footer`,children:[(0,s.jsx)(`p`,{className:`set-hint`,id:c+`-prompt-hint`,children:n(`botDraftPromptHint`)}),(0,s.jsxs)(`button`,{type:`button`,className:`quick-ask-settings-reset`,disabled:h,onClick:()=>{f(``),l!==``&&t({botDraftPrompt:``})},children:[(0,s.jsx)(r,{"aria-hidden":`true`}),n(`botDraftPromptReset`)]})]})]})}export{c as BotDraftSettings};
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{Jt as r,X as i,s as a}from"./i18n-N1glykLZ.js";var o=e(t(),1),s=n();function c({settings:e,onChange:t}){let n=a(),c=(0,o.useId)(),l=e.botDraftPrompt??``,u=e.botDraftDefaultPrompt??``,[d,f]=(0,o.useState)(l),p=(0,o.useRef)(!1);(0,o.useEffect)(()=>{p.current||f(l)},[l]);let m=e=>{e!==l&&t({botDraftPrompt:e})},h=!d.trim()&&!l.trim();return(0,s.jsxs)(`div`,{className:`set-section`,children:[(0,s.jsxs)(`div`,{className:`set-section-title`,children:[(0,s.jsx)(i,{className:`set-section-icon`}),n(`settingsBotsTitle`)]}),(0,s.jsx)(`p`,{className:`set-hint`,children:n(`botDraftSettingsDesc`)}),(0,s.jsx)(`label`,{className:`set-row-name`,htmlFor:c+`-prompt`,children:n(`botDraftPrompt`)}),(0,s.jsx)(`textarea`,{id:c+`-prompt`,className:`set-prompt-input`,rows:6,value:d,placeholder:u||n(`botDraftPromptPlaceholder`),"aria-describedby":c+`-prompt-hint`,onFocus:()=>{p.current=!0},onChange:e=>f(e.target.value),onBlur:()=>{p.current=!1,m(d)}}),(0,s.jsxs)(`div`,{className:`quick-ask-settings-editor-footer`,children:[(0,s.jsx)(`p`,{className:`set-hint`,id:c+`-prompt-hint`,children:n(`botDraftPromptHint`)}),(0,s.jsxs)(`button`,{type:`button`,className:`quick-ask-settings-reset`,disabled:h,onClick:()=>{f(``),l!==``&&t({botDraftPrompt:``})},children:[(0,s.jsx)(r,{"aria-hidden":`true`}),n(`botDraftPromptReset`)]})]})]})}export{c as BotDraftSettings};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{I as r,L as i,R as a,bn as o,s,z as c}from"./i18n-D2DJ-AHq.js";import{Bt as l,g as u,v as d}from"./index-CP0EEOA0.js";import{t as f}from"./TerminalDockControls-lbPY2V5U.js";var p=e(t(),1),m=n(),h=180,g=318,_=240,v=360;function y({open:e,collapsed:t,onToggleCollapse:n,onHide:y,tabs:b,activeId:x,onSelectTab:S,side:C,onSideChange:w}){let T=s(),E=l(),D=d(),O=C??D.side,k=D.sizes[O],A=(0,p.useRef)(null),[j,M]=(0,p.useState)(!1),N=b.length>1,P=b.find(e=>e.id===x)??b[0];(0,p.useEffect)(()=>{b.length>0&&!b.some(e=>e.id===x)&&S(b[0].id)},[b,x,S]);let F=(0,p.useCallback)(()=>{if(O===`bottom`){let e=A.current?.parentElement?.clientHeight??window.innerHeight;return Math.max(220,Math.round(e*.7))}let e=A.current?.closest(`.terminal-workspace`)?.clientWidth??A.current?.parentElement?.parentElement?.clientWidth??window.innerWidth;return Math.max(320,Math.round(e*.7))},[O]),I=(0,p.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=O===`bottom`,r=e.clientX,i=e.clientY,a=k,o=F(),s=O===`bottom`?h:_,c=a;t.setPointerCapture(e.pointerId),M(!0),document.body.classList.add(n?`td-resizing`:`td-resizing-x`);let l=e=>{let t=n?i-e.clientY:O===`left`?e.clientX-r:r-e.clientX;c=Math.min(o,Math.max(s,Math.round(a+t))),u({sizes:{[O]:c}})},d=()=>{t.removeEventListener(`pointermove`,l),t.removeEventListener(`pointerup`,d),t.removeEventListener(`pointercancel`,d),document.body.classList.remove(`td-resizing`),document.body.classList.remove(`td-resizing-x`),M(!1),u({sizes:{[O]:c}})};t.addEventListener(`pointermove`,l),t.addEventListener(`pointerup`,d),t.addEventListener(`pointercancel`,d)},[F,O,k]),L=(0,p.useCallback)(()=>{let e=O===`bottom`?g:v;u({sizes:{[O]:k>e+40?e:Math.round(F()*.82)}})},[F,O,k]);return b.length===0?null:(0,m.jsxs)(`section`,{ref:A,className:`term-drawer bottom-dock dock-${O}${e?``:` closed`}${e&&t?` collapsed`:``}${j?` dragging`:``}`,style:{"--td-h":`${Math.round(k)}px`},"aria-label":P?.label??T(`terminal`),"aria-expanded":e,children:[(0,m.jsx)(`div`,{className:`td-grip`,role:`separator`,"aria-orientation":O===`bottom`?`horizontal`:`vertical`,title:T(`termDrawerResizeTip`),onPointerDown:I,onDoubleClick:L}),e&&t&&O!==`bottom`&&(0,m.jsx)(`button`,{type:`button`,className:`icon-btn terminal-side-expand`,title:T(`termDrawerExpand`),"aria-label":T(`termDrawerExpand`),onClick:n,children:O===`left`?(0,m.jsx)(a,{}):(0,m.jsx)(i,{})}),N&&(0,m.jsxs)(`div`,{className:`bd-head`,children:[(0,m.jsx)(`div`,{className:`bd-tabs`,role:`tablist`,children:b.map(e=>{let t=e.entry;return(0,m.jsx)(`button`,{type:`button`,role:`tab`,className:`bd-tab${e.id===P?.id?` on`:``}`,"aria-selected":e.id===P?.id,title:e.hint??e.label,onClick:()=>S(e.id),onContextMenu:t?e=>E(e,t):void 0,children:e.label},e.id)})}),(0,m.jsxs)(`div`,{className:`bd-acts`,children:[w&&P?.id!==`host:bottom-terminal`&&(0,m.jsx)(f,{side:O,onSideChange:w}),(0,m.jsx)(`button`,{type:`button`,className:`icon-btn`,title:T(t?`termDrawerExpand`:`termDrawerCollapse`),onClick:n,children:t?(0,m.jsx)(c,{}):(0,m.jsx)(r,{})}),(0,m.jsx)(`button`,{type:`button`,className:`icon-btn`,title:T(`termDrawerHide`),onClick:y,children:(0,m.jsx)(o,{})})]})]}),N?(0,m.jsx)(`div`,{className:`bd-panes`,children:b.map(e=>(0,m.jsx)(`div`,{className:`bd-pane${e.id===P?.id?``:` hidden`}`,children:e.element},e.id))}):P.element]})}export{y as BottomDock};
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{I as r,L as i,R as a,bn as o,s,z as c}from"./i18n-N1glykLZ.js";import{Bt as l,g as u,v as d}from"./index-4VhQrBDx.js";import{t as f}from"./TerminalDockControls-vkeqMz6q.js";var p=e(t(),1),m=n(),h=180,g=318,_=240,v=360;function y({open:e,collapsed:t,onToggleCollapse:n,onHide:y,tabs:b,activeId:x,onSelectTab:S,side:C,onSideChange:w}){let T=s(),E=l(),D=d(),O=C??D.side,k=D.sizes[O],A=(0,p.useRef)(null),[j,M]=(0,p.useState)(!1),N=b.length>1,P=b.find(e=>e.id===x)??b[0];(0,p.useEffect)(()=>{b.length>0&&!b.some(e=>e.id===x)&&S(b[0].id)},[b,x,S]);let F=(0,p.useCallback)(()=>{if(O===`bottom`){let e=A.current?.parentElement?.clientHeight??window.innerHeight;return Math.max(220,Math.round(e*.7))}let e=A.current?.closest(`.terminal-workspace`)?.clientWidth??A.current?.parentElement?.parentElement?.clientWidth??window.innerWidth;return Math.max(320,Math.round(e*.7))},[O]),I=(0,p.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=O===`bottom`,r=e.clientX,i=e.clientY,a=k,o=F(),s=O===`bottom`?h:_,c=a;t.setPointerCapture(e.pointerId),M(!0),document.body.classList.add(n?`td-resizing`:`td-resizing-x`);let l=e=>{let t=n?i-e.clientY:O===`left`?e.clientX-r:r-e.clientX;c=Math.min(o,Math.max(s,Math.round(a+t))),u({sizes:{[O]:c}})},d=()=>{t.removeEventListener(`pointermove`,l),t.removeEventListener(`pointerup`,d),t.removeEventListener(`pointercancel`,d),document.body.classList.remove(`td-resizing`),document.body.classList.remove(`td-resizing-x`),M(!1),u({sizes:{[O]:c}})};t.addEventListener(`pointermove`,l),t.addEventListener(`pointerup`,d),t.addEventListener(`pointercancel`,d)},[F,O,k]),L=(0,p.useCallback)(()=>{let e=O===`bottom`?g:v;u({sizes:{[O]:k>e+40?e:Math.round(F()*.82)}})},[F,O,k]);return b.length===0?null:(0,m.jsxs)(`section`,{ref:A,className:`term-drawer bottom-dock dock-${O}${e?``:` closed`}${e&&t?` collapsed`:``}${j?` dragging`:``}`,style:{"--td-h":`${Math.round(k)}px`},"aria-label":P?.label??T(`terminal`),"aria-expanded":e,children:[(0,m.jsx)(`div`,{className:`td-grip`,role:`separator`,"aria-orientation":O===`bottom`?`horizontal`:`vertical`,title:T(`termDrawerResizeTip`),onPointerDown:I,onDoubleClick:L}),e&&t&&O!==`bottom`&&(0,m.jsx)(`button`,{type:`button`,className:`icon-btn terminal-side-expand`,title:T(`termDrawerExpand`),"aria-label":T(`termDrawerExpand`),onClick:n,children:O===`left`?(0,m.jsx)(a,{}):(0,m.jsx)(i,{})}),N&&(0,m.jsxs)(`div`,{className:`bd-head`,children:[(0,m.jsx)(`div`,{className:`bd-tabs`,role:`tablist`,children:b.map(e=>{let t=e.entry;return(0,m.jsx)(`button`,{type:`button`,role:`tab`,className:`bd-tab${e.id===P?.id?` on`:``}`,"aria-selected":e.id===P?.id,title:e.hint??e.label,onClick:()=>S(e.id),onContextMenu:t?e=>E(e,t):void 0,children:e.label},e.id)})}),(0,m.jsxs)(`div`,{className:`bd-acts`,children:[w&&P?.id!==`host:bottom-terminal`&&(0,m.jsx)(f,{side:O,onSideChange:w}),(0,m.jsx)(`button`,{type:`button`,className:`icon-btn`,title:T(t?`termDrawerExpand`:`termDrawerCollapse`),onClick:n,children:t?(0,m.jsx)(c,{}):(0,m.jsx)(r,{})}),(0,m.jsx)(`button`,{type:`button`,className:`icon-btn`,title:T(`termDrawerHide`),onClick:y,children:(0,m.jsx)(o,{})})]})]}),N?(0,m.jsx)(`div`,{className:`bd-panes`,children:b.map(e=>(0,m.jsx)(`div`,{className:`bd-pane${e.id===P?.id?``:` hidden`}`,children:e.element},e.id))}):P.element]})}export{y as BottomDock};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{i as t,t as n}from"./react-D0RUMPTR.js";import{I as r,L as i,R as a,bn as o,s,z as c}from"./i18n-N1glykLZ.js";import{Bt as l,g as u,v as d}from"./index-CS3HmHb2.js";import{t as f}from"./TerminalDockControls-D7jwYEpa.js";var p=e(t(),1),m=n(),h=180,g=318,_=240,v=360;function y({open:e,collapsed:t,onToggleCollapse:n,onHide:y,tabs:b,activeId:x,onSelectTab:S,side:C,onSideChange:w}){let T=s(),E=l(),D=d(),O=C??D.side,k=D.sizes[O],A=(0,p.useRef)(null),[j,M]=(0,p.useState)(!1),N=b.length>1,P=b.find(e=>e.id===x)??b[0];(0,p.useEffect)(()=>{b.length>0&&!b.some(e=>e.id===x)&&S(b[0].id)},[b,x,S]);let F=(0,p.useCallback)(()=>{if(O===`bottom`){let e=A.current?.parentElement?.clientHeight??window.innerHeight;return Math.max(220,Math.round(e*.7))}let e=A.current?.closest(`.terminal-workspace`)?.clientWidth??A.current?.parentElement?.parentElement?.clientWidth??window.innerWidth;return Math.max(320,Math.round(e*.7))},[O]),I=(0,p.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=O===`bottom`,r=e.clientX,i=e.clientY,a=k,o=F(),s=O===`bottom`?h:_,c=a;t.setPointerCapture(e.pointerId),M(!0),document.body.classList.add(n?`td-resizing`:`td-resizing-x`);let l=e=>{let t=n?i-e.clientY:O===`left`?e.clientX-r:r-e.clientX;c=Math.min(o,Math.max(s,Math.round(a+t))),u({sizes:{[O]:c}})},d=()=>{t.removeEventListener(`pointermove`,l),t.removeEventListener(`pointerup`,d),t.removeEventListener(`pointercancel`,d),document.body.classList.remove(`td-resizing`),document.body.classList.remove(`td-resizing-x`),M(!1),u({sizes:{[O]:c}})};t.addEventListener(`pointermove`,l),t.addEventListener(`pointerup`,d),t.addEventListener(`pointercancel`,d)},[F,O,k]),L=(0,p.useCallback)(()=>{let e=O===`bottom`?g:v;u({sizes:{[O]:k>e+40?e:Math.round(F()*.82)}})},[F,O,k]);return b.length===0?null:(0,m.jsxs)(`section`,{ref:A,className:`term-drawer bottom-dock dock-${O}${e?``:` closed`}${e&&t?` collapsed`:``}${j?` dragging`:``}`,style:{"--td-h":`${Math.round(k)}px`},"aria-label":P?.label??T(`terminal`),"aria-expanded":e,children:[(0,m.jsx)(`div`,{className:`td-grip`,role:`separator`,"aria-orientation":O===`bottom`?`horizontal`:`vertical`,title:T(`termDrawerResizeTip`),onPointerDown:I,onDoubleClick:L}),e&&t&&O!==`bottom`&&(0,m.jsx)(`button`,{type:`button`,className:`icon-btn terminal-side-expand`,title:T(`termDrawerExpand`),"aria-label":T(`termDrawerExpand`),onClick:n,children:O===`left`?(0,m.jsx)(a,{}):(0,m.jsx)(i,{})}),N&&(0,m.jsxs)(`div`,{className:`bd-head`,children:[(0,m.jsx)(`div`,{className:`bd-tabs`,role:`tablist`,children:b.map(e=>{let t=e.entry;return(0,m.jsx)(`button`,{type:`button`,role:`tab`,className:`bd-tab${e.id===P?.id?` on`:``}`,"aria-selected":e.id===P?.id,title:e.hint??e.label,onClick:()=>S(e.id),onContextMenu:t?e=>E(e,t):void 0,children:e.label},e.id)})}),(0,m.jsxs)(`div`,{className:`bd-acts`,children:[w&&P?.id!==`host:bottom-terminal`&&(0,m.jsx)(f,{side:O,onSideChange:w}),(0,m.jsx)(`button`,{type:`button`,className:`icon-btn`,title:T(t?`termDrawerExpand`:`termDrawerCollapse`),onClick:n,children:t?(0,m.jsx)(c,{}):(0,m.jsx)(r,{})}),(0,m.jsx)(`button`,{type:`button`,className:`icon-btn`,title:T(`termDrawerHide`),onClick:y,children:(0,m.jsx)(o,{})})]})]}),N?(0,m.jsx)(`div`,{className:`bd-panes`,children:b.map(e=>(0,m.jsx)(`div`,{className:`bd-pane${e.id===P?.id?``:` hidden`}`,children:e.element},e.id))}):P.element]})}export{y as BottomDock};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{Cn as t,Dn as n,Ft as r,H as i,Jt as a,K as o,Kt as s,Mt as c,N as l,On as u,P as d,Qt as f,Sn as p,Wt as ee,X as m,Yt as h,an as g,bn as _,ct as v,et as y,fn as b,g as x,h as te,kt as ne,l as S,ln as C,o as w,on as T,ot as E,qt as D,s as re,st as ie,ut as ae,vn as oe,xn as se}from"./i18n-D2DJ-AHq.js";import{t as O}from"./host-icon-DMg5PU4C.js";import{i as ce,r as k,t as A}from"./react-D0RUMPTR.js";import{toPng as le}from"./es-C5BHljgM.js";import{t as j}from"./uuid-BzDIGCwP.js";import{n as M,t as N}from"./composer-bridge-CImnjDHq.js";import{G as P,It as F,Nt as ue,in as de}from"./index-CP0EEOA0.js";import{n as fe}from"./use-copy-feedback-UoOlBc20.js";import{t as pe}from"./overlay-stack-rkpi4Wf5.js";import{n as me,r as he,t as I}from"./canvas-client-DRiwRbfy.js";import{t as ge}from"./app-globals-D2ZB_kzX.js";import{t as _e}from"./shortcut-stack-D0d3XzNw.js";import{CanvasScheduleEditor as ve,canvasScheduleDraft as ye}from"./SchedulerPanel-DDDWOSsw.js";function be(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let{key:t,vars:n}=e;return typeof t==`string`&&t.length>0&&(n===void 0||typeof n==`object`&&!!n&&!Array.isArray(n)&&Object.values(n).every(e=>typeof e==`string`||typeof e==`number`&&Number.isFinite(e)))}function xe(e,t,n){return be(e)&&Object.hasOwn(S,e.key)?n(e.key,e.vars):t??``}function L(e){return{handoff:e(`canvas.edges.type.handoff`),review:e(`canvas.edges.type.review`),parallel:e(`canvas.edges.type.parallel`),loop_back:e(`canvas.edges.type.loop_back`),condition_true:e(`canvas.edges.type.condition_true`),condition_false:e(`canvas.edges.type.condition_false`),approve:e(`canvas.edges.type.approve`),reject:e(`canvas.edges.type.reject`)}}var R=e(ce(),1),Se=[{id:`architect`,category:`architecture`,icon:`🏛️`,description:`Sketch types, signatures, and module structure before code, then stay in the loop while implementation fills in. Use for /architect, 'architect this', 'design this', or non-trivial work where jumping to code would lock in the wrong shape.`,content:`# Architect
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{Cn as t,Dn as n,Ft as r,H as i,Jt as a,K as o,Kt as s,Mt as c,N as l,On as u,P as d,Qt as f,Sn as p,Wt as ee,X as m,Yt as h,an as g,bn as _,ct as v,et as y,fn as b,g as x,h as te,kt as ne,l as S,ln as C,o as w,on as T,ot as E,qt as D,s as re,st as ie,ut as ae,vn as oe,xn as se}from"./i18n-N1glykLZ.js";import{t as O}from"./host-icon-B-zxP_r-.js";import{i as ce,r as k,t as A}from"./react-D0RUMPTR.js";import{toPng as le}from"./es-C5BHljgM.js";import{t as j}from"./uuid-BzDIGCwP.js";import{n as M,t as N}from"./composer-bridge-CImnjDHq.js";import{G as P,It as F,Nt as ue,in as de}from"./index-CS3HmHb2.js";import{n as fe}from"./use-copy-feedback-UoOlBc20.js";import{t as pe}from"./overlay-stack-rkpi4Wf5.js";import{n as me,r as he,t as I}from"./canvas-client-Bhhkh6T0.js";import{t as ge}from"./app-globals-D2ZB_kzX.js";import{t as _e}from"./shortcut-stack-D0d3XzNw.js";import{CanvasScheduleEditor as ve,canvasScheduleDraft as ye}from"./SchedulerPanel-DUgt0Fu6.js";function be(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let{key:t,vars:n}=e;return typeof t==`string`&&t.length>0&&(n===void 0||typeof n==`object`&&!!n&&!Array.isArray(n)&&Object.values(n).every(e=>typeof e==`string`||typeof e==`number`&&Number.isFinite(e)))}function xe(e,t,n){return be(e)&&Object.hasOwn(S,e.key)?n(e.key,e.vars):t??``}function L(e){return{handoff:e(`canvas.edges.type.handoff`),review:e(`canvas.edges.type.review`),parallel:e(`canvas.edges.type.parallel`),loop_back:e(`canvas.edges.type.loop_back`),condition_true:e(`canvas.edges.type.condition_true`),condition_false:e(`canvas.edges.type.condition_false`),approve:e(`canvas.edges.type.approve`),reject:e(`canvas.edges.type.reject`)}}var R=e(ce(),1),Se=[{id:`architect`,category:`architecture`,icon:`🏛️`,description:`Sketch types, signatures, and module structure before code, then stay in the loop while implementation fills in. Use for /architect, 'architect this', 'design this', or non-trivial work where jumping to code would lock in the wrong shape.`,content:`# Architect
2
2
 
3
3
  Sketch types, function signatures, class shapes, and module boundaries with \`not implemented\` bodies and pseudocode. Synthesize across multiple model perspectives, then fill in code against the chosen sketch.
4
4