@runfusion/fusion 0.44.0 → 0.46.0

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 (240) hide show
  1. package/README.md +2 -1
  2. package/dist/bin.js +7431 -2240
  3. package/dist/client/.vite/manifest.json +1118 -331
  4. package/dist/client/assets/AgentDetailView-CgbB51Iw.css +1 -0
  5. package/dist/client/assets/AgentDetailView-D1cA9Bfj.js +18 -0
  6. package/dist/client/assets/{AgentPermissionPolicyEditor--YS4iMUY.js → AgentPermissionPolicyEditor-DE0wv8-L.js} +2 -2
  7. package/dist/client/assets/AgentsView-Bm_FA_1w.js +29 -0
  8. package/dist/client/assets/AgentsView-CzMa5Olf.css +1 -0
  9. package/dist/client/assets/ChatView-BtjkE0V7.css +1 -0
  10. package/dist/client/assets/ChatView-CHEkov6q.js +19 -0
  11. package/dist/client/assets/CommandCenter-Cfgek-dC.js +71 -0
  12. package/dist/client/assets/CommandCenter-DDjpYkPe.css +1 -0
  13. package/dist/client/assets/DevServerView-DgDksVH2.css +1 -0
  14. package/dist/client/assets/DevServerView-_or2KLVw.js +1 -0
  15. package/dist/client/assets/DirectoryPicker-etVwa-6X.js +1 -0
  16. package/dist/client/assets/DocumentsView-e8ZTdPIZ.js +1 -0
  17. package/dist/client/assets/EvalsView-CTbgPUne.css +1 -0
  18. package/dist/client/assets/EvalsView-CjDRQFMQ.js +1 -0
  19. package/dist/client/assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css +1 -0
  20. package/dist/client/assets/ExperimentalAgentOnboardingModal-DXR0OAsR.js +1 -0
  21. package/dist/client/assets/GoalsView-CUh8JBnJ.css +1 -0
  22. package/dist/client/assets/GoalsView-WWDKVslN.js +2 -0
  23. package/dist/client/assets/InsightsView-C7yRTMPn.css +1 -0
  24. package/dist/client/assets/InsightsView-DxIfxOzx.js +11 -0
  25. package/dist/client/assets/MemoryView-BVW2hkWf.js +2 -0
  26. package/dist/client/assets/MemoryView-CBDUr2Jy.css +1 -0
  27. package/dist/client/assets/PiExtensionsManager-CpSfMok2.js +11 -0
  28. package/dist/client/assets/PluginManager-CpBCy656.js +1 -0
  29. package/dist/client/assets/PullRequestView-BMspX1ga.js +6 -0
  30. package/dist/client/assets/PullRequestView-CpdE3Yo_.css +1 -0
  31. package/dist/client/assets/ResearchView--YEtcv_s.js +1 -0
  32. package/dist/client/assets/ResearchView-DIVNQF4_.css +1 -0
  33. package/dist/client/assets/SecretsView-CC6QDMWN.js +1 -0
  34. package/dist/client/assets/SecretsView-CvFioX7R.css +1 -0
  35. package/dist/client/assets/SessionTerminal-D4R3ScvQ.css +1 -0
  36. package/dist/client/assets/SessionTerminal-DJGtgIls.js +2 -0
  37. package/dist/client/assets/SettingsModal-4d_p8D7W.js +1 -0
  38. package/dist/client/assets/SettingsModal-BESN59Ao.css +1 -0
  39. package/dist/client/assets/SettingsModal-ino68pI2.css +1 -0
  40. package/dist/client/assets/SettingsModal-wABa7xmZ.js +21 -0
  41. package/dist/client/assets/SetupWizardModal-DHe2tXzx.js +2 -0
  42. package/dist/client/assets/ShadcnColorPicker-HX3j1v66.js +11 -0
  43. package/dist/client/assets/ShadcnColorPicker-pqVWCC5-.css +1 -0
  44. package/dist/client/assets/SkillsView-CJ8snrma.css +1 -0
  45. package/dist/client/assets/SkillsView-mdFVTX-r.js +1 -0
  46. package/dist/client/assets/TodoView-CIsL_uvQ.css +1 -0
  47. package/dist/client/assets/TodoView-DQVugDpW.js +6 -0
  48. package/dist/client/assets/WorkflowNodeEditor-CeERQHHu.js +8 -0
  49. package/dist/client/assets/WorkflowNodeEditor-f_XPV5Jd.css +1 -0
  50. package/dist/client/assets/{addon-fit-SnYDEvGm.js → addon-fit-C1WQXRvu.js} +1 -1
  51. package/dist/client/assets/{addon-unicode11-s5GoZCpi.js → addon-unicode11-BVmNDUBM.js} +1 -1
  52. package/dist/client/assets/{addon-web-links-jjt2f_oV.js → addon-web-links-CkVew5xs.js} +1 -1
  53. package/dist/client/assets/{addon-webgl-Icn-RnEx.js → addon-webgl-uLc0RKcC.js} +1 -1
  54. package/dist/client/assets/agentSkills-C2v1wbxh.js +1 -0
  55. package/dist/client/assets/{ExperimentalAgentOnboardingModal-CZ_jbgep.css → agentSkills-bQJ4X1gH.css} +1 -1
  56. package/dist/client/assets/agentsOrgChartLayout-BMvyuaLA.js +1 -0
  57. package/dist/client/assets/app-BJGkp7Tt.js +13 -0
  58. package/dist/client/assets/app-BKLUvvm8.js +13 -0
  59. package/dist/client/assets/app-BaoNC9zg.js +13 -0
  60. package/dist/client/assets/app-CZQ_fFNf.js +13 -0
  61. package/dist/client/assets/app-DAu3AzsS.js +13 -0
  62. package/dist/client/assets/app-DgezOJub.js +13 -0
  63. package/dist/client/assets/arc-cxkkNsnK.js +1 -0
  64. package/dist/client/assets/architectureDiagram-3BPJPVTR-CGEhhgX_.js +36 -0
  65. package/dist/client/assets/band-CquvqAHh.js +1 -0
  66. package/dist/client/assets/blockDiagram-GPEHLZMM-D0DTo0HT.js +132 -0
  67. package/dist/client/assets/c4Diagram-AAUBKEIU-DNykNaRb.js +10 -0
  68. package/dist/client/assets/channel-Dwf1FoGU.js +1 -0
  69. package/dist/client/assets/chunk-2J33WTMH-5oQfAhmr.js +1 -0
  70. package/dist/client/assets/chunk-4BX2VUAB-BqLZXgFw.js +1 -0
  71. package/dist/client/assets/chunk-55IACEB6-C1oIjX3T.js +1 -0
  72. package/dist/client/assets/chunk-727SXJPM-BaovQTgk.js +206 -0
  73. package/dist/client/assets/chunk-AQP2D5EJ-B4ikBK42.js +231 -0
  74. package/dist/client/assets/chunk-FMBD7UC4-5zgtNnG2.js +15 -0
  75. package/dist/client/assets/chunk-ND2GUHAM-ByrypRna.js +1 -0
  76. package/dist/client/assets/chunk-QZHKN3VN-B7D1exsu.js +1 -0
  77. package/dist/client/assets/classDiagram-4FO5ZUOK-WqSUwcK_.js +1 -0
  78. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-WqSUwcK_.js +1 -0
  79. package/dist/client/assets/common-BDp2y6CF.js +1 -0
  80. package/dist/client/assets/common-BnEo5fLN.js +1 -0
  81. package/dist/client/assets/common-Bzr_Y8h4.js +1 -0
  82. package/dist/client/assets/common-CvwyFzfv.js +1 -0
  83. package/dist/client/assets/common-CztCXRkz.js +1 -0
  84. package/dist/client/assets/common-DPe2mbb7.js +1 -0
  85. package/dist/client/assets/cose-bilkent-S5V4N54A-CQmiNzGr.js +1 -0
  86. package/dist/client/assets/cytoscape.esm-OyMbaexL.js +331 -0
  87. package/dist/client/assets/dagre-BM42HDAG-BH8Uk0Up.js +4 -0
  88. package/dist/client/assets/{dashboard-view-B4LXCv5H.js → dashboard-view-CWJ-b59n.js} +1680 -1620
  89. package/dist/client/assets/dashboard-view-D3PWY2PH.js +1 -0
  90. package/dist/client/assets/dashboard-view-D_zsA-kz.css +1 -0
  91. package/dist/client/assets/defaultLocale-DX6XiGOO.js +1 -0
  92. package/dist/client/assets/diagram-2AECGRRQ-CDoHfkxY.js +43 -0
  93. package/dist/client/assets/diagram-5GNKFQAL-DARILCuD.js +10 -0
  94. package/dist/client/assets/diagram-KO2AKTUF-CNP-qi0y.js +3 -0
  95. package/dist/client/assets/diagram-LMA3HP47-SCiVmkcf.js +24 -0
  96. package/dist/client/assets/diagram-OG6HWLK6-iTJLXH61.js +24 -0
  97. package/dist/client/assets/erDiagram-TEJ5UH35-ByMpiPIa.js +85 -0
  98. package/dist/client/assets/flowDiagram-I6XJVG4X-DW3m3ZpM.js +162 -0
  99. package/dist/client/assets/{folder-open-33WGVnbp.js → folder-open-G-9vPAdv.js} +1 -1
  100. package/dist/client/assets/ganttDiagram-6RSMTGT7-BJeYH7Ol.js +292 -0
  101. package/dist/client/assets/gitGraphDiagram-PVQCEYII-CK_Chj4m.js +106 -0
  102. package/dist/client/assets/graph--OzhPTMs.js +1 -0
  103. package/dist/client/assets/index-BZBQ_KsL.css +1 -0
  104. package/dist/client/assets/index-ccFe_1av.js +1459 -0
  105. package/dist/client/assets/infoDiagram-5YYISTIA-D8Wg1IgN.js +2 -0
  106. package/dist/client/assets/init-Dmth1JHB.js +1 -0
  107. package/dist/client/assets/ishikawaDiagram-YF4QCWOH-DWROR2aX.js +70 -0
  108. package/dist/client/assets/journeyDiagram-JHISSGLW-Bns9774_.js +139 -0
  109. package/dist/client/assets/kanban-definition-UN3LZRKU-QtURfAoI.js +89 -0
  110. package/dist/client/assets/katex-HP8lGamR.js +257 -0
  111. package/dist/client/assets/layout-SsrduOYp.js +1 -0
  112. package/dist/client/assets/linear-dXivciGL.js +1 -0
  113. package/dist/client/assets/mermaid.core-DqgrgWWm.js +309 -0
  114. package/dist/client/assets/mindmap-definition-RKZ34NQL-jLaDb5_X.js +96 -0
  115. package/dist/client/assets/ordinal-DILIJJjt.js +1 -0
  116. package/dist/client/assets/pieDiagram-4H26LBE5-CjbHuIje.js +30 -0
  117. package/dist/client/assets/quadrantDiagram-W4KKPZXB-xgHbylQr.js +7 -0
  118. package/dist/client/assets/requirementDiagram-4Y6WPE33-CHdD7W41.js +84 -0
  119. package/dist/client/assets/sankeyDiagram-5OEKKPKP-C3me87g9.js +40 -0
  120. package/dist/client/assets/sequenceDiagram-3UESZ5HK-DSHfs1kU.js +162 -0
  121. package/dist/client/assets/{shield-alert-CqeGWBUK.js → shield-alert-DkGlhVjI.js} +1 -1
  122. package/dist/client/assets/stateDiagram-AJRCARHV-C08n7sMP.js +1 -0
  123. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BosoAbfO.js +1 -0
  124. package/dist/client/assets/step-yuy0qJer.js +1 -0
  125. package/dist/client/assets/time-DoDTxsna.js +1 -0
  126. package/dist/client/assets/timeline-definition-PNZ67QCA-C21h9Zqh.js +120 -0
  127. package/dist/client/assets/{upload-C11J2diI.js → upload-B9B-tYt9.js} +1 -1
  128. package/dist/client/assets/{users-a-ELbyyZ.js → users-C_BA3C7E.js} +1 -1
  129. package/dist/client/assets/{vendor-i18n-DYlSUfot.js → vendor-i18n-GF3RlKbq.js} +2 -2
  130. package/dist/client/assets/{vendor-react-BTgM5bbZ.js → vendor-react-SZ_qB27O.js} +1 -1
  131. package/dist/client/assets/vendor-reactflow-Bg-Qjzh8.js +15 -0
  132. package/dist/client/assets/{vendor-xterm-ea7-K05z.js → vendor-xterm-BNq00GSj.js} +1 -1
  133. package/dist/client/assets/vennDiagram-CIIHVFJN-Bv3G0dwI.js +34 -0
  134. package/dist/client/assets/wardley-L42UT6IY-WX0hHKcN.js +173 -0
  135. package/dist/client/assets/wardleyDiagram-YWT4CUSO-CMwIPWm7.js +78 -0
  136. package/dist/client/assets/xychartDiagram-2RQKCTM6-CZvFdt6j.js +7 -0
  137. package/dist/client/assets/zoom-out-NWbVkreR.js +41 -0
  138. package/dist/client/index.html +30 -10
  139. package/dist/client/sw.js +1 -1
  140. package/dist/client/theme-data.css +3082 -206
  141. package/dist/client/version.json +1 -1
  142. package/dist/droid-cli/index.ts +56 -40
  143. package/dist/droid-cli/package.json +1 -1
  144. package/dist/droid-cli/src/__tests__/index.test.ts +47 -21
  145. package/dist/droid-cli/src/__tests__/process-manager.test.ts +50 -33
  146. package/dist/extension.js +5405 -919
  147. package/dist/pi-claude-cli/package.json +1 -1
  148. package/dist/pi-claude-cli/src/__tests__/process-manager.test.ts +25 -0
  149. package/dist/pi-claude-cli/src/process-manager.ts +11 -1
  150. package/dist/plugin-sdk/index.d.ts +137 -4
  151. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  152. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  153. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  154. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  155. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  156. package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +68 -44
  157. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  158. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  159. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  160. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  161. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  162. package/dist/plugins/fusion-plugin-roadmap/bundled.js +5 -11
  163. package/dist/plugins/fusion-plugin-roadmap/manifest.json +1 -11
  164. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  165. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  166. package/package.json +3 -3
  167. package/skill/fusion/SKILL.md +1 -1
  168. package/skill/fusion/references/cli-commands.md +2 -1
  169. package/skill/fusion/references/extension-tools.md +10 -0
  170. package/skill/fusion/references/fusion-capabilities.md +3 -1
  171. package/dist/client/assets/AgentDetailView-CanIeYHg.css +0 -1
  172. package/dist/client/assets/AgentDetailView-DxV8pFHX.js +0 -18
  173. package/dist/client/assets/AgentsView-BVILQjdS.css +0 -1
  174. package/dist/client/assets/AgentsView-CTzbcvhK.js +0 -29
  175. package/dist/client/assets/ChatView-COygcnyk.js +0 -6
  176. package/dist/client/assets/ChatView-DwJAd5G1.css +0 -1
  177. package/dist/client/assets/CommandCenter-CTaopaC0.css +0 -1
  178. package/dist/client/assets/CommandCenter-DoKX2HWm.js +0 -56
  179. package/dist/client/assets/DevServerView-Cyevyvqx.js +0 -1
  180. package/dist/client/assets/DevServerView-VTQY28P7.css +0 -1
  181. package/dist/client/assets/DirectoryPicker-DBdyXEhR.js +0 -1
  182. package/dist/client/assets/DocumentsView-BzSMyrns.js +0 -1
  183. package/dist/client/assets/DocumentsView-WfVoTZt8.css +0 -1
  184. package/dist/client/assets/EvalsView-CUNJ1TLc.css +0 -1
  185. package/dist/client/assets/EvalsView-ikz00o9g.js +0 -1
  186. package/dist/client/assets/ExperimentalAgentOnboardingModal-D-rzCCET.js +0 -499
  187. package/dist/client/assets/GoalsView-Bfu1Oy2-.js +0 -2
  188. package/dist/client/assets/GoalsView-rg9VSIza.css +0 -1
  189. package/dist/client/assets/InsightsView-Cgmf5nES.js +0 -11
  190. package/dist/client/assets/InsightsView-LMv1M1dU.css +0 -1
  191. package/dist/client/assets/MemoryView-DkEuDKQs.js +0 -2
  192. package/dist/client/assets/MemoryView-zaXewZzi.css +0 -1
  193. package/dist/client/assets/NodesView-7VInxyf_.css +0 -1
  194. package/dist/client/assets/NodesView-B_KYfS4o.js +0 -14
  195. package/dist/client/assets/PiExtensionsManager-Dz69kkKs.js +0 -11
  196. package/dist/client/assets/PluginManager-LHCVcduP.js +0 -1
  197. package/dist/client/assets/PullRequestView-3AdbS2a1.css +0 -1
  198. package/dist/client/assets/PullRequestView-DBJutLLl.js +0 -6
  199. package/dist/client/assets/ResearchView-DTh8FLUm.css +0 -1
  200. package/dist/client/assets/ResearchView-gpn1XcVy.js +0 -1
  201. package/dist/client/assets/SecretsView-B7YqIowt.js +0 -1
  202. package/dist/client/assets/SecretsView-Djo1rahi.css +0 -1
  203. package/dist/client/assets/SessionTerminal-9l4bdKcn.js +0 -2
  204. package/dist/client/assets/SessionTerminal-BNgtmXb3.css +0 -1
  205. package/dist/client/assets/SettingsModal-BGEK9_9A.js +0 -31
  206. package/dist/client/assets/SettingsModal-CKv0TJfM.css +0 -1
  207. package/dist/client/assets/SettingsModal-CXogw-Er.css +0 -1
  208. package/dist/client/assets/SettingsModal-DIIoHGUH.js +0 -1
  209. package/dist/client/assets/SetupWizardModal-BcVeMxeX.js +0 -1
  210. package/dist/client/assets/SetupWizardModal-CIqFbkrD.css +0 -1
  211. package/dist/client/assets/SkillsView-3bhGyWs1.css +0 -1
  212. package/dist/client/assets/SkillsView-BxSJ4PHL.js +0 -1
  213. package/dist/client/assets/StashRecoveryView-B_8WIQEo.css +0 -1
  214. package/dist/client/assets/StashRecoveryView-BhFQ2FsP.js +0 -1
  215. package/dist/client/assets/TodoView-7xIh-Fmi.css +0 -1
  216. package/dist/client/assets/TodoView-BZpewjy0.js +0 -6
  217. package/dist/client/assets/WorkflowNodeEditor-Yn1FRF2v.css +0 -1
  218. package/dist/client/assets/WorkflowNodeEditor-tWsgCdVt.js +0 -8
  219. package/dist/client/assets/app-BmGA0Hiz.js +0 -13
  220. package/dist/client/assets/app-CEVYlVuJ.js +0 -13
  221. package/dist/client/assets/app-CbBFax2C.js +0 -13
  222. package/dist/client/assets/app-DORKrGAz.js +0 -13
  223. package/dist/client/assets/app-DQibuQ9z.js +0 -13
  224. package/dist/client/assets/app-k76GrQP0.js +0 -13
  225. package/dist/client/assets/common-BRyX4VxB.js +0 -1
  226. package/dist/client/assets/common-CN9QPI2d.js +0 -1
  227. package/dist/client/assets/common-CNbjPELi.js +0 -1
  228. package/dist/client/assets/common-DFDqu_n0.js +0 -1
  229. package/dist/client/assets/common-DgWWKG8Z.js +0 -1
  230. package/dist/client/assets/common-X6PzBnVA.js +0 -1
  231. package/dist/client/assets/createLucideIcon-DmVITl5d.js +0 -21
  232. package/dist/client/assets/dashboard-view-BFoyhTYF.js +0 -3
  233. package/dist/client/assets/dashboard-view-Cxzm_eqc.js +0 -1
  234. package/dist/client/assets/dashboard-view-DdGlfuu-.css +0 -1
  235. package/dist/client/assets/dashboard-view-_8yfNwju.css +0 -1
  236. package/dist/client/assets/index-Bglw05rM.js +0 -791
  237. package/dist/client/assets/index-FYgnflWD.css +0 -1
  238. package/dist/client/assets/vendor-reactflow-ZasuEfF9.js +0 -15
  239. package/dist/client/assets/x-PItWc-wQ.js +0 -61
  240. package/dist/client/assets/zoom-out-CzlHv0Kj.js +0 -21
@@ -1,11 +0,0 @@
1
- import{r as l,j as e}from"./vendor-react-BTgM5bbZ.js";import{c as G,gw as V,gx as Y,gy as Z,R as L,gn as y,J as T,a as ee,b as se,U as ae,F as B,gz as ie,gA as ne,gB as D,X as te}from"./index-Bglw05rM.js";import{u as re}from"./vendor-i18n-DYlSUfot.js";import{B as _}from"./AgentPermissionPolicyEditor--YS4iMUY.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";/**
2
- * @license lucide-react v1.7.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const le=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],$=G("palette",le);/**
7
- * @license lucide-react v1.7.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const ce=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],A=G("puzzle",ce);function oe(n){return n.replace(/-/g,"-")}function de(n){return{"fusion-global":"Fusion Global","pi-global":"Pi Global","fusion-project":"Fusion Project","pi-project":"Pi Project",package:"Package"}[n]??n}function pe(n){return n.startsWith("npm:")?"npm":n.startsWith("git:")?"git":"local"}function xe(n){return n.replace(/^(npm:|git:)/,"")}function ve({addToast:n,projectId:x}){const{t:a}=re("app"),[c,I]=l.useState(null),[N,P]=l.useState(!0),[v,E]=l.useState(!1),[S,F]=l.useState(!1),[u,w]=l.useState(""),[O,U]=l.useState(new Set),[m,W]=l.useState([]),[b,R]=l.useState(!0),[q,z]=l.useState(!1),o=l.useCallback(async()=>{try{P(!0);const s=await V();I(s)}catch(s){n(a("piManager.loadSettingsFailed","Failed to load Pi settings: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{P(!1)}},[n,a]),g=l.useCallback(async()=>{try{R(!0);const s=await Y(x);W(s.extensions)}catch(s){n(a("piManager.loadExtensionsFailed","Failed to load extensions: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{R(!1)}},[n,x,a]),H=l.useCallback(async s=>{try{z(!0);const t=s.enabled?[...m.filter(i=>i.enabled&&i.id!==s.id).map(i=>i.id),s.id]:m.filter(i=>i.enabled&&i.id!==s.id).map(i=>i.id);await Z(t,x),await g(),n(s.enabled?a("piManager.extensionDisabled","Extension disabled"):a("piManager.extensionEnabled","Extension enabled"),"success")}catch(t){n(a("piManager.updateFailed","Failed to update extension: {{error}}",{error:t instanceof Error?t.message:String(t)}),"error")}finally{z(!1)}},[m,x,g,n,a]);l.useEffect(()=>{o()},[o]),l.useEffect(()=>{g()},[g]);const J=s=>{U(t=>{const i=new Set(t);return i.has(s)?i.delete(s):i.add(s),i})},C=async()=>{if(!u.trim()){n(a("piManager.enterSource","Please enter a package source"),"error");return}try{E(!0),await ie(u.trim()),n(a("piManager.installSuccess","Package installed successfully"),"success"),w(""),await o()}catch(s){n(a("piManager.installFailed","Failed to install package: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{E(!1)}},K=async()=>{try{F(!0),await ne(x),await Promise.all([o(),g()]),n(a("piManager.reinstallSuccess","Fusion skill reinstalled successfully"),"success")}catch(s){n(a("piManager.reinstallFailed","Failed to reinstall Fusion skill: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{F(!1)}},X=async s=>{if(!c)return;const t=c.packages.filter(i=>(typeof i=="string"?i:i.source)!==s);try{await D({packages:t}),n(a("piManager.packageRemoved","Package removed"),"success"),await o()}catch(i){n(a("piManager.removeFailed","Failed to remove package: {{error}}",{error:i instanceof Error?i.message:String(i)}),"error")}},Q=async(s,t)=>{if(!c)return;const i=c[s].filter(r=>r!==t);try{await D({[s]:i});const r=a(`piManager.resourceType.${s.slice(0,-1)}`,s.slice(0,-1));n(a("piManager.resourceRemoved","{{resource}} removed",{resource:r}),"success"),await o()}catch(r){n(a("piManager.updateSettingsFailed","Failed to update settings: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},h=(s,t,i)=>!c||c[i].length===0?null:e.jsxs("div",{className:"pi-ext-section",children:[e.jsxs("div",{className:"pi-ext-section-header",children:[e.jsx(t,{size:14}),e.jsx("span",{children:s}),e.jsx("span",{className:"pi-ext-count",children:c[i].length})]}),e.jsx("div",{className:"pi-ext-resource-list",children:c[i].map((r,f)=>e.jsxs("span",{className:"pi-ext-resource-tag",children:[e.jsx("span",{className:"pi-ext-resource-path",children:r}),e.jsx("button",{className:"btn-icon touch-target pi-ext-resource-remove",onClick:()=>Q(i,r),title:a("piManager.removeResource","Remove {{path}}",{path:r}),"aria-label":a("piManager.removeResource","Remove {{path}}",{path:r}),children:e.jsx(te,{})})]},f))})]});return e.jsxs("div",{className:"pi-ext-manager",children:[e.jsxs("div",{className:"pi-ext-manager-header",children:[e.jsx("h4",{className:"pi-ext-manager-title",children:a("piManager.title","Pi Extensions")}),e.jsx("div",{className:"pi-ext-manager-actions",children:e.jsx("button",{className:"btn-icon",onClick:o,title:a("piManager.refreshButton","Refresh"),disabled:N,children:e.jsx(L,{size:16,className:N?"spin":""})})})]}),N?e.jsx("div",{className:"loading-state",children:a("piManager.loading","Loading Pi settings…")}):c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pi-ext-add-form",children:[e.jsxs("div",{className:"pi-ext-add-form-row",children:[e.jsx("input",{type:"text",className:"input",placeholder:a("piManager.packagePlaceholder","npm:pi-extension-name or git:https://github.com/..."),value:u,onChange:s=>w(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),C())},disabled:v}),e.jsxs("button",{className:"btn btn-primary",onClick:C,disabled:v||!u.trim(),children:[e.jsx(T,{size:14}),v?a("piManager.installing","Installing…"):a("piManager.addButton","Add")]})]}),e.jsx("div",{className:"pi-ext-add-form-row",children:e.jsx("button",{className:"btn",onClick:K,disabled:S,children:S?a("piManager.reinstalling","Reinstalling Fusion…"):a("piManager.reinstallButton","Reinstall Fusion skill")})})]}),c.packages.length>0?e.jsx("div",{className:"pi-ext-package-list",children:c.packages.map((s,t)=>{const i=typeof s=="string"?s:s.source,r=pe(i),f=xe(i),j=typeof s=="object"&&s!==null,k=j&&(s.extensions?.length??0)>0||(s.skills?.length??0)>0||(s.prompts?.length??0)>0||(s.themes?.length??0)>0,M=O.has(t);return e.jsxs("div",{className:"pi-ext-package-card",children:[e.jsxs("div",{className:"pi-ext-package-header",children:[j&&k?e.jsx("button",{className:"pi-ext-expand-btn",onClick:()=>J(t),"aria-expanded":M,children:M?e.jsx(ee,{size:14}):e.jsx(se,{size:14})}):e.jsx("span",{className:"pi-ext-expand-placeholder"}),e.jsx("span",{className:`pi-ext-source-badge pi-ext-source-badge--${r}`,children:r}),e.jsx("span",{className:"pi-ext-package-source",children:f}),e.jsxs("div",{className:"pi-ext-package-actions",children:[j&&k&&e.jsxs("span",{className:"pi-ext-filter-hint",children:[s.extensions?.length??0," ext,"," ",s.skills?.length??0," skill,"," ",s.prompts?.length??0," prompt,"," ",s.themes?.length??0," theme"]}),e.jsx("button",{className:"btn-icon touch-target pi-ext-remove-btn",onClick:()=>X(i),title:a("piManager.removePackage","Remove package"),"aria-label":a("piManager.removePackageLabel","Remove package {{label}}",{label:f}),children:e.jsx(ae,{size:14})})]})]}),j&&k&&M&&e.jsxs("div",{className:"pi-ext-filter-list",children:[s.extensions?.length?e.jsxs("div",{className:"pi-ext-filter-section",children:[e.jsx(A,{size:12}),e.jsxs("span",{className:"pi-ext-filter-label",children:[a("piManager.filterExtensions","Extensions:")," "]}),s.extensions.map((d,p)=>e.jsx("span",{className:"pi-ext-filter-tag",children:d},p))]}):null,s.skills?.length?e.jsxs("div",{className:"pi-ext-filter-section",children:[e.jsx(_,{size:12}),e.jsxs("span",{className:"pi-ext-filter-label",children:[a("piManager.filterSkills","Skills:")," "]}),s.skills.map((d,p)=>e.jsx("span",{className:"pi-ext-filter-tag",children:d},p))]}):null,s.prompts?.length?e.jsxs("div",{className:"pi-ext-filter-section",children:[e.jsx(B,{size:12}),e.jsxs("span",{className:"pi-ext-filter-label",children:[a("piManager.filterPrompts","Prompts:")," "]}),s.prompts.map((d,p)=>e.jsx("span",{className:"pi-ext-filter-tag",children:d},p))]}):null,s.themes?.length?e.jsxs("div",{className:"pi-ext-filter-section",children:[e.jsx($,{size:12}),e.jsxs("span",{className:"pi-ext-filter-label",children:[a("piManager.filterThemes","Themes:")," "]}),s.themes.map((d,p)=>e.jsx("span",{className:"pi-ext-filter-tag",children:d},p))]}):null]})]},t)})}):e.jsxs("div",{className:"empty-state",children:[e.jsx(y,{size:32,className:"text-muted"}),e.jsx("p",{children:a("piManager.noPackages","No packages configured.")}),e.jsx("p",{className:"text-muted",children:a("piManager.noPackagesHelp","Add a package source above to get started.")})]}),e.jsxs("div",{className:"pi-ext-top-level",children:[h(a("piManager.sectionExtensions","Extensions"),A,"extensions"),h(a("piManager.sectionSkills","Skills"),_,"skills"),h(a("piManager.sectionPrompts","Prompts"),B,"prompts"),h(a("piManager.sectionThemes","Themes"),$,"themes")]})]}):e.jsxs("div",{className:"empty-state",children:[e.jsx(y,{size:32,className:"text-muted"}),e.jsx("p",{children:a("piManager.loadingFailed","Failed to load Pi settings.")})]}),e.jsxs("div",{className:"pi-ext-discovered-section",children:[e.jsxs("div",{className:"pi-ext-discovered-header",children:[e.jsx("h4",{children:a("piManager.discoveredTitle","Discovered Extensions")}),e.jsx("button",{className:"btn-icon",onClick:g,disabled:b,title:a("piManager.refreshExtensions","Refresh extensions"),children:e.jsx(L,{className:b?"spin":""})})]}),e.jsx("p",{className:"pi-ext-description",children:a("piManager.discoveredDescription","Installed extensions resolved from packages and configured paths.")}),b?e.jsx("div",{className:"loading-state",children:a("piManager.loadingExtensions","Loading extensions…")}):m.length===0?e.jsxs("div",{className:"empty-state",children:[e.jsx(y,{size:32,className:"text-muted"}),e.jsx("p",{children:a("piManager.noExtensions","No extensions discovered.")})]}):e.jsx("div",{className:"pi-ext-list",children:m.map(s=>e.jsxs("div",{className:"pi-ext-item",children:[e.jsxs("div",{className:"pi-ext-item-content",children:[e.jsxs("div",{className:"pi-ext-info",children:[e.jsx("span",{className:"pi-ext-name",children:s.name}),e.jsx("span",{className:`pi-ext-source-badge pi-ext-source-badge--${oe(s.source)}`,children:de(s.source)})]}),e.jsx("span",{className:"pi-ext-path",children:s.path})]}),e.jsx("div",{className:"pi-ext-actions",children:e.jsxs("label",{className:"toggle-switch",children:[e.jsx("input",{type:"checkbox",checked:s.enabled,onChange:()=>void H(s),disabled:q,"aria-label":a("piManager.toggleExtension","Toggle {{name}}",{name:s.name})}),e.jsx("span",{className:"toggle-slider"})]})})]},s.id))})]})]})}export{ve as PiExtensionsManager};
@@ -1 +0,0 @@
1
- import{r as d,j as e}from"./vendor-react-BTgM5bbZ.js";import{v as _e,gk as He,gl as Me,gm as ce,s as $e,X as ge,aD as qe,b2 as Ve,J as de,ba as pe,U as me,R as he,gn as Te,az as We,go as Ke,gp as Qe,dS as Je,gq as Ye,gr as Xe,gs as Ze,gt as es,gu as O,dP as ss,gv as ns}from"./index-Bglw05rM.js";import{D as is}from"./DirectoryPicker-DBdyXEhR.js";import{u as ts}from"./vendor-i18n-DYlSUfot.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";import"./folder-open-33WGVnbp.js";const je="fusion-plugin-agent-browser",be={enabled:{type:"boolean",label:"Enable Agent Browser",group:"General"},installChannel:{type:"enum",label:"Install Channel",enumValues:["stable","beta","nightly"],defaultValue:"stable",group:"General"},commandTimeoutMs:{type:"number",label:"Command Timeout (ms)",defaultValue:12e4,group:"General"},headlessMode:{type:"boolean",label:"Headless Mode",defaultValue:!0,group:"Browser"},allowedDomains:{type:"array",label:"Allowed Domains",itemType:"string",group:"Browser"},promptExecutorSystem:{type:"string",label:"Executor System Prompt",multiline:!0,group:"Prompt Contributions"},promptExecutorTask:{type:"string",label:"Executor Task Prompt",multiline:!0,group:"Prompt Contributions"},promptTriage:{type:"string",label:"Triage Prompt",multiline:!0,group:"Prompt Contributions"},promptReviewer:{type:"string",label:"Reviewer Prompt",multiline:!0,group:"Prompt Contributions"},promptHeartbeat:{type:"string",label:"Heartbeat Prompt",multiline:!0,group:"Prompt Contributions"},skillExposure:{type:"enum",label:"Skill Exposure",enumValues:["none","selected","all"],defaultValue:"selected",group:"Skills"}},ye={General:"plugins.agentBrowser.groupGeneral",Browser:"plugins.agentBrowser.groupBrowser","Prompt Contributions":"plugins.agentBrowser.groupPromptContributions",Skills:"plugins.agentBrowser.groupSkills"},xe={"Enable Agent Browser":"plugins.agentBrowser.labelEnabled","Install Channel":"plugins.agentBrowser.labelInstallChannel","Command Timeout (ms)":"plugins.agentBrowser.labelCommandTimeoutMs","Headless Mode":"plugins.agentBrowser.labelHeadlessMode","Allowed Domains":"plugins.agentBrowser.labelAllowedDomains","Executor System Prompt":"plugins.agentBrowser.labelPromptExecutorSystem","Executor Task Prompt":"plugins.agentBrowser.labelPromptExecutorTask","Triage Prompt":"plugins.agentBrowser.labelPromptTriage","Reviewer Prompt":"plugins.agentBrowser.labelPromptReviewer","Heartbeat Prompt":"plugins.agentBrowser.labelPromptHeartbeat","Skill Exposure":"plugins.agentBrowser.labelSkillExposure"},fe=[{id:"fusion-plugin-hermes-runtime",name:"Hermes Runtime",description:"Runtime provider for Hermes CLI-backed execution.",category:"runtime",path:"./plugins/fusion-plugin-hermes-runtime",experimental:!0},{id:"fusion-plugin-paperclip-runtime",name:"Paperclip Runtime",description:"Runtime provider for Paperclip agent connections.",category:"runtime",path:"./plugins/fusion-plugin-paperclip-runtime"},{id:"fusion-plugin-openclaw-runtime",name:"OpenClaw Runtime",description:"Runtime provider for OpenClaw execution.",category:"runtime",path:"./plugins/fusion-plugin-openclaw-runtime",experimental:!0},{id:"fusion-plugin-droid-runtime",name:"Droid Runtime",description:"Runtime provider for Droid CLI execution.",category:"runtime",path:"./plugins/fusion-plugin-droid-runtime",experimental:!0},{id:"fusion-plugin-dependency-graph",name:"Dependency Graph",description:"Dashboard plugin for task dependency graph visualization.",category:"integration",path:"./plugins/fusion-plugin-dependency-graph"},{id:"fusion-plugin-reports",name:"Reports",description:"View report history, compare runs side-by-side, and export standalone HTML summaries.",category:"integration",path:"./plugins/fusion-plugin-reports"},{id:"fusion-plugin-whatsapp-chat",name:"WhatsApp Chat",description:"Pairs to WhatsApp Web (multi-device) with QR or pairing code, then bridges direct chats to a Fusion agent.",category:"integration",path:"./plugins/fusion-plugin-whatsapp-chat"},{id:"fusion-plugin-cli-printing-press",name:"CLI Printing Press",description:"Guided wizard for drafting external service CLI definitions.",category:"integration",path:"./plugins/fusion-plugin-cli-printing-press"},{id:"fusion-plugin-compound-engineering",name:"Compound Engineering",description:"A dedicated dashboard surface for compound-engineering artifacts and interactive ce-* sessions.",category:"integration",path:"./plugins/fusion-plugin-compound-engineering"},{id:"fusion-plugin-roadmap",name:"Roadmaps",description:"Standalone roadmap planning plugin.",category:"integration",path:"./plugins/fusion-plugin-roadmap"},{id:je,name:"Agent Browser",description:"Built-in integration metadata. Package install support lands in FN-3101.",category:"integration",hasSetup:!0}],F={started:"var(--color-success)",loaded:"var(--color-warning)",error:"var(--color-error)",stopped:"var(--color-muted)",installed:"var(--color-info)"};function as(r){const o=r.settingsSchema,n=o&&Object.keys(o).length>0;return r.id!==je?n?o:void 0:n?{...be,...o}:be}function ls(r){const o=new Map,n=[];for(const[S,y]of Object.entries(r))if(y.group){const v=o.get(y.group)??[];v.push([S,y]),o.set(y.group,v)}else n.push([S,y]);return{grouped:o,ungrouped:n}}function Se(r,o="plugin-error-text"){return r.state!=="error"||!r.error?null:e.jsx("p",{className:o,title:r.error,children:r.error})}function bs({addToast:r,projectId:o}){const{t:n}=ts("app"),[S,y]=d.useState([]),[v,z]=d.useState(!0),[Ne,A]=d.useState(!1),[E,L]=d.useState(""),[U,_]=d.useState(!1),[H,M]=d.useState(!1),[w,$]=d.useState(null),[c,D]=d.useState(null),[m,x]=d.useState({}),[ve,q]=d.useState(!1),[V,T]=d.useState(null),[W,we]=d.useState([]),[Pe,K]=d.useState(!0),[Q,J]=d.useState(null),[b,Ce]=d.useState(""),[f,Re]=d.useState(""),[Ie,Y]=d.useState(null),P=d.useRef(null),[Ee,G]=d.useState({}),[Be,X]=d.useState(null),[B,Z]=d.useState(null),{confirm:ke}=_e(),h=d.useCallback(async()=>{try{z(!0);const s=await He(o);y(s)}catch(s){r(n("plugins.loadFailed","Failed to load plugins: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{z(!1)}},[o,r]),j=d.useCallback(async(s=b,i=f)=>{try{K(!0),J(null);const l=await Me(s,i||void 0,o);we(l)}catch(l){const u=l instanceof Error?l.message:String(l);J(u)}finally{K(!1)}},[o,f,b]);d.useEffect(()=>{h()},[h]),d.useEffect(()=>(P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{j(b,f)},300),()=>{P.current&&clearTimeout(P.current)}),[j,f,b]),d.useEffect(()=>{const s=fe.filter(l=>l.hasSetup&&S.some(u=>u.id===l.id));if(s.length===0)return;let i=!1;return Promise.all(s.map(async l=>{try{const u=await ce(l.id,o);if(i)return;G(g=>({...g,[l.id]:u}))}catch{if(i)return;G(u=>({...u,[l.id]:{hasSetup:!0,setupCheckDeferred:!0,deferredReason:"plugin-not-started",pluginState:"installed"}}))}})),()=>{i=!0}},[S,o]);const Fe=d.useRef([]);Fe.current=S,d.useEffect(()=>{const s=o?`?projectId=${encodeURIComponent(o)}`:"",i=l=>{try{const u=JSON.parse(l.data);if(u.scope==="project"&&(u.projectId??o)!==o)return;switch(u.transition){case"installing":case"enabled":case"disabled":case"settings-updated":j(b,f),y(g=>{const a=g.findIndex(t=>t.id===u.pluginId);if(a>=0){const t=[...g];return t[a]={...t[a],enabled:u.enabled,state:u.state,settings:u.settings,error:u.error},t}else return h(),g});break;case"state-changed":y(g=>{const a=g.findIndex(t=>t.id===u.pluginId);if(a>=0){const t=[...g];return t[a]={...t[a],state:u.state,error:u.error},t}return g});break;case"uninstalled":y(g=>g.filter(a=>a.id!==u.pluginId)),j(b,f);break;case"error":y(g=>{const a=g.findIndex(t=>t.id===u.pluginId);if(a>=0){const t=[...g];return t[a]={...t[a],state:u.state,error:u.error},t}return g});break}}catch{}};return $e(`/api/events${s}`,{events:{"plugin:lifecycle":i},onReconnect:()=>{h(),j(b,f)}})},[o,h,j,f,b]);const ee=async()=>{if(!E.trim()){r(n("plugins.installPathRequired","Please enter a plugin path"),"error");return}try{_(!0),await O({path:E,...H?{aiScanOnLoad:!0}:{}},o),r(n("plugins.installedGlobally","Plugin installed globally"),"success"),A(!1),L(""),M(!1),await h()}catch(s){r(n("plugins.installFailed","Failed to install plugin: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{_(!1)}},Ae=async s=>{if(!s.path){r(n("plugins.builtinNoPackage","{{name}} is built in and does not have an installable package yet",{name:s.name}),"warning");return}try{T(s.id),await O({path:s.path},o),r(n("plugins.builtinInstalledGlobally","{{name}} installed globally",{name:s.name}),"success"),await h()}catch(i){r(n("plugins.builtinInstallFailed","Failed to install {{name}}: {{error}}",{name:s.name,error:i instanceof Error?i.message:String(i)}),"error")}finally{T(null)}},Le=async s=>{if(!s.path){r(n("plugins.registryNotInstallable","{{name}} is not available for one-click install yet",{name:s.name}),"warning");return}try{Y(s.id),await O({path:s.path},o),r(n("plugins.registryInstalled","{{name}} installed and enabled",{name:s.name}),"success"),await h(),await j(b,f)}catch(i){r(n("plugins.registryInstallFailed","Failed to install {{name}}: {{error}}",{name:s.name,error:i instanceof Error?i.message:String(i)}),"error")}finally{Y(null)}},se=async s=>{try{Z(s.id);const i=await ns(s.id,o);if(!i.success){r(n("plugins.setupInstallFailed","Failed to install {{name}} setup: {{error}}",{name:s.name,error:i.error??n("plugins.unknownError","unknown error")}),"error");return}r(n("plugins.setupInstalled","{{name}} setup installed",{name:s.name}),"success"),X(s.id);const l=await ce(s.id,o);G(u=>({...u,[s.id]:l}))}catch(i){r(n("plugins.setupInstallFailed","Failed to install {{name}} setup: {{error}}",{name:s.name,error:i instanceof Error?i.message:String(i)}),"error")}finally{Z(null),X(null)}},ne=async s=>{try{const i=await Ze(s.id,o);if(i.state==="error"){r(n("plugins.enableFailed","Failed to enable {{name}}: {{error}}",{name:s.name,error:i.error??n("plugins.unknownError","unknown error")}),"error"),await h();return}r(n("plugins.enabledForProject","{{name}} enabled for this project",{name:s.name}),"success"),await h()}catch(i){r(n("plugins.enablePluginFailed","Failed to enable plugin: {{error}}",{error:i instanceof Error?i.message:String(i)}),"error")}},ie=async s=>{try{await Xe(s.id,o),r(n("plugins.disabledForProject","{{name}} disabled for this project",{name:s.name}),"success"),await h()}catch(i){r(n("plugins.disablePluginFailed","Failed to disable plugin: {{error}}",{error:i instanceof Error?i.message:String(i)}),"error")}},te=async s=>{try{$(s.id),await Ye(s.id,o),r(n("plugins.reloaded","{{name}} reloaded",{name:s.name}),"success"),await h()}catch(i){r(n("plugins.reloadFailed","Failed to reload plugin: {{error}}",{error:i instanceof Error?i.message:String(i)}),"error")}finally{$(null)}},ae=async s=>{if(await ke({title:n("plugins.uninstallTitle","Uninstall Plugin Globally"),message:n("plugins.uninstallConfirm",'Are you sure you want to uninstall "{{name}}" globally (all projects)?',{name:s.name}),danger:!0}))try{await es(s.id,o),r(n("plugins.uninstalledGlobally","{{name}} uninstalled globally",{name:s.name}),"success"),await h(),D(null)}catch(l){r(n("plugins.uninstallFailed","Failed to uninstall plugin: {{error}}",{error:l instanceof Error?l.message:String(l)}),"error")}},De=async(s,i)=>{try{await Ke(s.id,{aiScanOnLoad:i},o),r(i?n("plugins.aiScanEnabled","AI scan on load enabled"):n("plugins.aiScanDisabled","AI scan on load disabled"),"success"),await h()}catch(l){r(n("plugins.updateFailed","Failed to update plugin: {{error}}",{error:l instanceof Error?l.message:String(l)}),"error")}},Ge=async s=>{try{await Qe(s.id,o),r(n("plugins.rescanned","{{name}} rescanned",{name:s.name}),"success"),await h()}catch(i){r(n("plugins.rescanFailed","Failed to rescan plugin: {{error}}",{error:i instanceof Error?i.message:String(i)}),"error")}},k=async s=>{D(s);try{q(!0);const i=await ss(s.id,o);x(i)}catch{x({})}finally{q(!1)}},Oe=async()=>{if(c)try{await Je(c.id,m,o),r(n("plugins.settingsSaved","Settings saved"),"success")}catch(s){r(n("plugins.saveSettingsFailed","Failed to save settings: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}};if(c)return e.jsxs("div",{className:"plugin-manager-detail","data-testid":"plugin-manager-detail",children:[e.jsxs("div",{className:"plugin-manager-detail-header",children:[e.jsx("button",{className:"btn-icon",onClick:()=>D(null),"aria-label":n("plugins.backToList","Back to plugin list"),children:e.jsx(ge,{size:16})}),e.jsxs("div",{className:"plugin-detail-title",children:[e.jsxs("div",{className:"plugin-detail-title-copy",children:[e.jsx("h4",{className:"plugin-detail-name",children:c.name}),Se(c,"plugin-error-text plugin-error-text--detail")]}),e.jsx("span",{className:"plugin-state-badge",style:{color:F[c.state]||F.installed},children:c.state})]})]}),e.jsxs("div",{className:"plugin-detail-content",children:[e.jsxs("div",{className:"plugin-detail-card",children:[c.description&&e.jsx("p",{className:"plugin-description",children:c.description}),c.author&&e.jsxs("p",{className:"plugin-detail-meta-row",children:[e.jsx("span",{className:"text-muted",children:n("plugins.author","Author:")}),c.author]}),c.homepage&&e.jsxs("p",{className:"plugin-detail-meta-row plugin-homepage",children:[e.jsx("span",{className:"text-muted",children:n("plugins.homepage","Homepage:")}),e.jsxs("a",{href:c.homepage,target:"_blank",rel:"noopener noreferrer",children:[c.homepage,e.jsx(qe,{size:12})]})]}),e.jsxs("p",{className:"plugin-detail-meta-row",children:[e.jsx("span",{className:"text-muted",children:n("plugins.version","Version:")}),c.version]})]}),e.jsxs("div",{className:"plugin-detail-card",children:[e.jsx("h5",{className:"plugin-detail-section-heading",children:n("plugins.securityScan","Security Scan")}),e.jsxs("div",{className:"plugin-security-row",children:[e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:!!c.aiScanOnLoad,onChange:s=>void De(c,s.target.checked)}),n("plugins.enableAiScanBeforeLoad","Enable AI scan before load/reload")]}),e.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>void Ge(c),children:[e.jsx(Ve,{size:14})," ",n("plugins.rescanAndReload","Rescan and Reload")]})]}),e.jsx("p",{className:"text-muted",children:n("plugins.aiScanHint","Turning this on only updates configuration. Use Rescan and Reload to run it now.")}),c.lastSecurityScan?e.jsxs("div",{className:"plugin-security-results",children:[e.jsxs("div",{className:"plugin-security-header",children:[e.jsx("span",{className:`plugin-state-badge plugin-security-badge plugin-security-badge--${c.lastSecurityScan.verdict}`,children:c.lastSecurityScan.verdict}),e.jsx("span",{className:"text-muted",children:c.lastSecurityScan.scannedAt})]}),e.jsx("p",{className:"plugin-security-summary",children:c.lastSecurityScan.summary}),e.jsxs("details",{children:[e.jsx("summary",{children:n("plugins.findings","Findings ({{count}})",{count:c.lastSecurityScan.findings.length})}),e.jsx("ul",{className:"plugin-security-findings",children:c.lastSecurityScan.findings.map((s,i)=>e.jsxs("li",{children:[e.jsx("strong",{children:s.severity})," ",s.category," — ",s.file,": ",s.reason]},`${s.file}-${i}`))})]})]}):e.jsx("p",{className:"text-muted",children:n("plugins.noSecurityScan","No security scan has been run yet.")})]}),e.jsxs("div",{className:"plugin-detail-card",children:[e.jsx("h5",{className:"plugin-detail-section-heading",children:n("plugins.settings","Settings")}),ve?e.jsx("p",{className:"text-muted",children:n("plugins.loading","Loading...")}):(()=>{const s=as(c);return s&&Object.keys(s).length>0?e.jsxs("div",{className:"plugin-settings-form",children:[(()=>{const{grouped:i,ungrouped:l}=ls(s),u=[];l.length>0&&u.push({title:null,entries:l});for(const[g,a]of i.entries())u.push({title:g,entries:a});return u.map(g=>e.jsxs("div",{className:g.title?"plugin-settings-group":void 0,children:[g.title&&e.jsx("h6",{className:"plugin-settings-group-heading",children:ye[g.title]?n(ye[g.title],g.title):g.title}),g.entries.map(([a,t])=>{const N=`setting-${a}-help`,C=t.label?xe[t.label]?n(xe[t.label],t.label):t.label:a;return e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:`setting-${a}`,children:[C,t.required&&" *"]}),t.type==="string"&&!t.multiline&&e.jsx("input",{className:"input",type:"text",id:`setting-${a}`,value:m[a]??"",onChange:p=>x({...m,[a]:p.target.value}),placeholder:t.description,"aria-describedby":t.description&&!t.required?N:void 0}),t.type==="string"&&t.multiline&&e.jsx("textarea",{className:"input",id:`setting-${a}`,rows:4,value:m[a]??"",onChange:p=>x({...m,[a]:p.target.value}),placeholder:t.description,"aria-describedby":t.description&&!t.required?N:void 0}),t.type==="password"&&e.jsx("input",{className:"input",type:"password",id:`setting-${a}`,value:m[a]??"",onChange:p=>x({...m,[a]:p.target.value}),placeholder:t.description,"aria-describedby":t.description&&!t.required?N:void 0}),t.type==="number"&&e.jsx("input",{className:"input",type:"number",id:`setting-${a}`,value:m[a]??"",onChange:p=>x({...m,[a]:Number(p.target.value)}),"aria-describedby":t.description&&!t.required?N:void 0}),t.type==="boolean"&&e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:m[a]??!1,onChange:p=>x({...m,[a]:p.target.checked})}),t.description]}),t.type==="enum"&&e.jsxs("select",{className:"select",id:`setting-${a}`,value:m[a]??"",onChange:p=>x({...m,[a]:p.target.value}),"aria-describedby":t.description&&!t.required?N:void 0,children:[e.jsx("option",{value:"",children:n("plugins.selectOption","Select...")}),t.enumValues?.map(p=>e.jsx("option",{value:p,children:p},p))]}),t.type==="array"&&e.jsxs("div",{className:"plugin-settings-array",children:[m[a]?.map((p,R)=>e.jsxs("div",{className:"plugin-settings-array-item",children:[e.jsx("input",{className:"input",type:t.itemType==="number"?"number":"text",value:p??"",onChange:ue=>{const I=ue.target.value,oe=[...m[a]||[]];oe[R]=t.itemType==="number"?Number(I):I,x({...m,[a]:oe})}}),e.jsx("button",{className:"btn-icon",onClick:()=>{const I=[...m[a]||[]];I.splice(R,1),x({...m,[a]:I})},"aria-label":n("plugins.removeItem","Remove item"),children:e.jsx(ge,{size:14})})]},R)),e.jsxs("button",{className:"btn btn-secondary",onClick:()=>{const p=m[a]||[],R=t.itemType==="number"?0:"";x({...m,[a]:[...p,R]})},children:[e.jsx(de,{size:14})," ",n("plugins.addItem","Add Item")]})]}),t.description&&!t.required&&!t.multiline&&e.jsx("span",{id:N,className:"form-help",children:t.description})]},a)})]},g.title??"ungrouped"))})(),e.jsx("button",{className:"btn btn-primary",onClick:Oe,children:n("plugins.saveSettings","Save Settings")})]}):e.jsx("p",{className:"text-muted",children:n("plugins.noConfigurableSettings","No configurable settings.")})})()]}),e.jsxs("div",{className:"plugin-detail-actions",children:[c.state==="started"&&e.jsxs("button",{className:"btn btn-secondary",onClick:()=>te(c),disabled:w===c.id,children:[e.jsx(pe,{size:14,className:w===c.id?"spin":""}),w===c.id?n("plugins.reloading","Reloading..."):n("plugins.reload","Reload")]}),c.enabled?e.jsx("button",{className:"btn btn-secondary",onClick:()=>ie(c),children:n("plugins.disableInProject","Disable in Project")}):e.jsx("button",{className:"btn btn-primary",onClick:()=>ne(c),children:n("plugins.enableInProject","Enable in Project")}),e.jsxs("button",{className:"btn btn-danger",onClick:()=>ae(c),children:[e.jsx(me,{size:14})," ",n("plugins.uninstallGlobally","Uninstall Globally")]})]})]})]});const le=new Map(S.map(s=>[s.id,s])),re=S,ze=()=>e.jsxs("section",{className:"plugin-registry-section","aria-label":n("plugins.browseRegistry","Browse Registry"),children:[e.jsxs("div",{className:"plugin-registry-header",children:[e.jsxs("div",{className:"plugin-registry-heading-copy",children:[e.jsx("h4",{className:"plugin-registry-heading",children:n("plugins.browseRegistry","Browse Registry")}),e.jsx("p",{className:"plugin-registry-description",children:n("plugins.registryDescription","Discover curated runtimes and integrations that can be added to this Fusion workspace.")})]}),e.jsxs("div",{className:"plugin-registry-controls",children:[e.jsxs("label",{className:"plugin-registry-category-label",children:[e.jsx("span",{className:"sr-only",children:n("plugins.registryCategory","Registry category")}),e.jsxs("select",{className:"select plugin-registry-category-select",value:f,onChange:s=>Re(s.target.value),"aria-label":n("plugins.registryCategory","Registry category"),children:[e.jsx("option",{value:"",children:n("plugins.registryCategoryAll","All Categories")}),e.jsx("option",{value:"runtime",children:n("plugins.registryCategoryRuntime","Runtime")}),e.jsx("option",{value:"integration",children:n("plugins.registryCategoryIntegration","Integration")})]})]}),e.jsxs("label",{className:"plugin-registry-search-label",children:[e.jsx("span",{className:"sr-only",children:n("plugins.searchRegistry","Search registry")}),e.jsx("input",{className:"input plugin-registry-search-input",type:"search",value:b,onChange:s=>Ce(s.target.value),placeholder:n("plugins.searchRegistryPlaceholder","Search registry plugins")})]})]})]}),Pe?e.jsxs("div",{className:"plugin-registry-state",role:"status",children:[e.jsx(he,{size:14,className:"spin"}),n("plugins.registryLoading","Loading registry...")]}):Q?e.jsxs("div",{className:"plugin-registry-state plugin-registry-state--error",role:"alert",children:[e.jsx("span",{children:n("plugins.registryLoadFailed","Failed to load registry: {{error}}",{error:Q})}),e.jsx("button",{className:"btn btn-secondary btn-sm plugin-registry-retry",onClick:()=>void j(b,f),children:n("plugins.retry","Retry")})]}):W.length===0?e.jsx("div",{className:"plugin-registry-state",children:b.trim()?n("plugins.registryEmptySearch","No registry plugins match your search."):n("plugins.registryEmpty","No registry plugins are available.")}):e.jsx("div",{className:"plugin-registry-list","aria-label":n("plugins.registryPluginResults","Registry plugin results"),children:W.map(s=>{const i=le.get(s.id),l=Ie===s.id;return e.jsxs("div",{className:"plugin-registry-item",children:[e.jsxs("div",{className:"plugin-registry-meta",children:[e.jsxs("div",{className:"plugin-registry-title-row",children:[e.jsx("span",{className:"plugin-registry-name",children:s.name}),e.jsxs("span",{className:"plugin-registry-version",children:["v",s.version]}),e.jsx("span",{className:"plugin-registry-badge",children:s.category}),s.installed&&e.jsxs("span",{className:"plugin-registry-status plugin-registry-status--installed",children:[n("plugins.statusInstalled","Installed"),s.installedVersion&&s.installedVersion!==s.version?` · v${s.installedVersion}`:""]})]}),e.jsx("span",{className:"plugin-registry-description-text",children:s.description}),e.jsx("span",{className:"plugin-registry-author",children:n("plugins.registryByAuthor","By {{author}}",{author:s.author})})]}),e.jsx("div",{className:"plugin-registry-actions",children:s.installed?e.jsx("button",{className:"btn btn-secondary btn-sm plugin-registry-action",onClick:()=>{i?k(i):h()},children:n("plugins.manage","Manage")}):s.canInstall?e.jsx("button",{className:"btn btn-primary btn-sm plugin-registry-action",onClick:()=>void Le(s),disabled:l,children:l?n("plugins.installing","Installing..."):n("plugins.installFromRegistry","Install")}):e.jsx("span",{className:"plugin-registry-coming-soon",children:n("plugins.registryComingSoon","Coming Soon")})})]},s.id)})})]}),Ue=()=>e.jsxs("section",{className:"plugin-builtins-section","aria-label":n("plugins.builtinPlugins","Built-in Plugins"),children:[e.jsxs("div",{className:"plugin-builtins-header",children:[e.jsx("h4",{className:"plugin-builtins-heading",children:n("plugins.builtinPlugins","Built-in Plugins")}),e.jsx("p",{className:"plugin-builtins-description",children:n("plugins.builtinPluginsCatalog","Built-in plugin catalog for runtimes and integrations.")})]}),e.jsx("div",{className:"plugin-builtins-list","aria-label":n("plugins.builtinPluginRecommendations","Built-in plugin recommendations"),children:fe.map(s=>{const i=le.get(s.id),l=!!i,u=Ee[s.id],g=!!(u&&"setupCheckDeferred"in u&&u.setupCheckDeferred),a=u&&"status"in u?u.status:void 0,t=l&&s.hasSetup&&u?.hasSetup&&!g&&i?.state==="started"&&(a==="not-installed"||a==="error"),N=l&&u?.hasSetup&&a==="installed",C=Be===s.id,p=!s.path;return e.jsxs("div",{className:"plugin-builtins-item",children:[e.jsxs("div",{className:"plugin-builtins-meta",children:[e.jsx("span",{className:"plugin-builtins-name",children:s.name}),s.experimental&&e.jsx("span",{className:"plugin-builtins-runtime-badge",children:n("plugins.experimental","Experimental")}),e.jsx("span",{className:"plugin-builtins-runtime-badge",children:s.category}),e.jsx("span",{className:`plugin-builtins-status ${l?"plugin-builtins-status--installed":"plugin-builtins-status--available"}`,children:l?n("plugins.statusInstalled","Installed"):p?n("plugins.statusBuiltIn","Built in"):n("plugins.statusNotInstalled","Not installed")}),t&&e.jsx("span",{className:"plugin-builtins-setup-status plugin-builtins-setup-status--warning",children:n("plugins.setupRequired","Setup required")}),N&&e.jsx("span",{className:"plugin-builtins-setup-status plugin-builtins-setup-status--ready",children:n("plugins.setupReady","Setup ready")}),C&&e.jsx("span",{className:"plugin-builtins-setup-status plugin-builtins-setup-status--pending",children:n("plugins.checkingSetup","Checking setup...")}),g&&e.jsx("span",{className:"plugin-builtins-setup-status plugin-builtins-setup-status--deferred",children:n("plugins.startPluginToCheckSetup","Start plugin to check setup")}),e.jsx("span",{className:"plugin-builtins-description-text",children:s.description})]}),p?l&&t?e.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>void se(s),disabled:B===s.id||C,children:B===s.id?n("plugins.settingUp","Setting up..."):n("plugins.installSetup","Install Setup")}):l&&i?e.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>void k(i),children:n("plugins.manage","Manage")}):e.jsx("span",{className:"plugin-builtins-metadata-only",children:n("plugins.builtinMetadataOnly","Built-in metadata only")}):e.jsx("button",{className:`btn ${l&&!t?"btn-secondary":"btn-primary"} btn-sm`,onClick:()=>{if(!l){Ae(s);return}if(t){se(s);return}i&&k(i)},disabled:V===s.id||B===s.id||C,children:l?t?B===s.id?n("plugins.settingUp","Setting up..."):n("plugins.installSetup","Install Setup"):n("plugins.manage","Manage"):V===s.id?n("plugins.installing","Installing..."):n("plugins.installNamed","Install {{name}}",{name:s.name})})]},s.id)})})]});return e.jsxs("div",{className:"plugin-manager","data-testid":"plugin-manager",children:[e.jsxs("div",{className:"plugin-manager-header",children:[e.jsx("span",{className:"plugin-manager-header-title",children:n("plugins.installedPlugins","Installed Plugins")}),e.jsxs("div",{className:"plugin-manager-actions",children:[e.jsxs("button",{className:"btn btn-sm",onClick:h,title:n("plugins.refresh","Refresh"),"aria-label":n("plugins.refreshPluginList","Refresh plugin list"),children:[e.jsx(he,{size:14,className:v?"spin":""}),n("plugins.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>A(!0),children:[e.jsx(de,{size:14})," ",n("plugins.install","Install")]})]})]}),Ne&&e.jsxs("div",{className:"plugin-install-form",children:[e.jsx("p",{className:"plugin-install-hint",children:n("plugins.installHint","Browse to a plugin package root (contains manifest.json) or a built dist directory.")}),e.jsx(is,{value:E,onChange:L,placeholder:n("plugins.installPathPlaceholder","Absolute path to plugin directory or dist folder"),onInputKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),ee())}}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:H,onChange:s=>M(s.target.checked)}),n("plugins.enableAiSecurityScan","Enable AI security scan on load")]}),e.jsxs("div",{className:"plugin-install-actions",children:[e.jsx("button",{className:"btn btn-primary",onClick:ee,disabled:U||!E.trim(),children:U?n("plugins.installing","Installing..."):n("plugins.installPluginGlobally","Install Plugin Globally")}),e.jsx("button",{className:"btn btn-secondary",onClick:()=>{A(!1),L("")},children:n("plugins.cancel","Cancel")})]})]}),v?e.jsx("div",{className:"settings-empty-state",children:n("plugins.loadingPlugins","Loading plugins...")}):e.jsxs(e.Fragment,{children:[re.length===0?e.jsxs("div",{className:"settings-empty-state",children:[e.jsx(Te,{size:32,className:"text-muted"}),e.jsx("p",{children:n("plugins.noPluginsInstalled","No plugins installed.")}),e.jsx("p",{className:"text-muted",children:n("plugins.noPluginsHint","Install a plugin to get started, or use the built-in catalog below.")})]}):e.jsx("div",{className:"plugin-list",children:re.map(s=>e.jsxs("div",{className:"plugin-item",children:[e.jsx("div",{className:"plugin-info",children:e.jsxs("div",{className:"plugin-copy",children:[e.jsxs("div",{className:"plugin-copy-header",children:[e.jsx("span",{className:"plugin-name",children:s.name}),e.jsxs("span",{className:"plugin-version text-muted",children:["v",s.version]}),e.jsx("span",{className:"plugin-state-badge",style:{color:F[s.state]||F.installed},children:s.state})]}),Se(s)]})}),e.jsxs("div",{className:"plugin-actions",children:[s.state==="started"&&e.jsx("button",{className:"btn-icon",onClick:()=>te(s),disabled:w===s.id,title:n("plugins.reload","Reload"),children:e.jsx(pe,{size:14,className:w===s.id?"spin":""})}),e.jsxs("label",{className:"toggle-switch",children:[e.jsx("input",{type:"checkbox",checked:s.enabled,onChange:()=>s.enabled?ie(s):ne(s),"aria-label":s.enabled?n("plugins.disablePlugin","Disable {{name}}",{name:s.name}):n("plugins.enablePlugin","Enable {{name}}",{name:s.name})}),e.jsx("span",{className:"toggle-slider"})]}),e.jsx("button",{className:"btn-icon",onClick:()=>k(s),title:n("plugins.settings","Settings"),children:e.jsx(We,{size:14})}),e.jsx("button",{className:"btn-icon",onClick:()=>ae(s),title:n("plugins.uninstallGloballyTitle","Uninstall globally"),children:e.jsx(me,{size:14})})]})]},s.id))}),Ue(),ze()]})]})}export{be as AGENT_BROWSER_SETTINGS_SCHEMA,je as BUILTIN_AGENT_BROWSER_PLUGIN_ID,fe as BUILTIN_PLUGINS,bs as PluginManager,F as STATE_COLORS};
@@ -1 +0,0 @@
1
- .pr-view{display:flex;flex-direction:column;gap:var(--space-md);height:100%;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:var(--space-lg);color:var(--text)}.pr-view--loading,.pr-view--error{display:flex;align-items:center;gap:var(--space-xs);color:var(--text-muted)}.pr-view--error{color:var(--color-error)}.pr-identity{display:flex;align-items:center;gap:var(--space-sm);flex-wrap:wrap;padding-bottom:var(--space-sm);border-bottom:1px solid var(--border)}.pr-identity-repo{font-weight:600}.pr-identity-number{color:var(--accent, var(--text));text-decoration:none;display:inline-flex;align-items:center;gap:2px}.pr-identity-branch{color:var(--text-muted);font-family:var(--font-mono, monospace);font-size:.85em}.pr-identity-state{margin-left:auto;text-transform:uppercase;font-size:.7em;letter-spacing:.04em;padding:2px 6px;border-radius:4px;background:var(--surface-2, color-mix(in srgb, #7f7f7f 15%, transparent));color:var(--text-muted)}.pr-identity-state--failed{background:color-mix(in srgb,var(--color-error) 12%,transparent);color:var(--color-error)}.pr-identity-state--merged{background:color-mix(in srgb,var(--color-success) 12%,transparent)}.pr-placeholder,.pr-notice,.pr-banner,.pr-error-reason{display:flex;align-items:center;gap:var(--space-xs);padding:var(--space-sm) var(--space-md);border-radius:6px;background:var(--surface-2, color-mix(in srgb, #7f7f7f 10%, transparent))}.pr-banner--responding{background:color-mix(in srgb,var(--color-info) 12%,transparent)}.pr-notice--unverified{background:color-mix(in srgb,var(--color-warning) 12%,transparent)}.pr-error-reason{background:color-mix(in srgb,var(--color-error) 12%,transparent);color:var(--color-error)}.pr-action-bar{display:flex;align-items:center;gap:var(--space-sm);flex-wrap:wrap}.pr-action{display:inline-flex;align-items:center;gap:4px;padding:4px 10px;border:1px solid var(--border);border-radius:6px;background:var(--surface, transparent);color:var(--text);cursor:pointer;font-size:.85em}.pr-action:disabled{opacity:.5;cursor:not-allowed}.pr-action--merge,.pr-action--merge-confirm{border-color:var(--accent, var(--border))}.pr-action--merge-confirm{background:var(--accent, #2f81f7);color:var(--cta-text)}.pr-action--close{border-color:color-mix(in srgb,var(--color-error) 45%,transparent)}.pr-automerge-toggle{display:inline-flex;align-items:center;gap:6px;margin-left:auto;font-size:.82em;color:var(--text-muted)}.pr-automerge-gate{padding:1px 6px;border-radius:4px;background:var(--surface-2, color-mix(in srgb, #7f7f7f 15%, transparent))}.pr-conflict-link{display:inline-flex;align-items:center;gap:4px;color:var(--color-error);text-decoration:none;font-size:.85em}.pr-summary{display:flex;gap:var(--space-md);flex-wrap:wrap;padding:var(--space-sm) 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}.pr-summary-item{display:inline-flex;align-items:center;gap:4px;font-size:.85em;color:var(--text-muted)}.pr-icon-success{color:var(--color-success)}.pr-icon-failure{color:var(--color-error)}.pr-icon-pending{color:var(--color-warning)}.pr-threads{display:flex;flex-direction:column;gap:var(--space-sm)}.pr-threads-empty{color:var(--text-muted);font-size:.85em}.pr-thread{border:1px solid var(--border);border-radius:6px;padding:var(--space-sm)}.pr-thread--agent-disagreement{border-left:3px solid var(--color-warning);background:color-mix(in srgb,var(--color-warning) 12%,transparent)}.pr-thread--pending{border-left:3px solid var(--text-muted)}.pr-thread-head{display:flex;align-items:center;gap:var(--space-sm);font-size:.82em}.pr-thread-pending,.pr-thread-disagreed,.pr-thread-fixed{display:inline-flex;align-items:center;gap:4px}.pr-thread-id{color:var(--text-muted);font-family:var(--font-mono, monospace);font-size:.85em;margin-left:auto}.pr-thread-reply{margin-top:6px;margin-left:var(--space-md);padding:var(--space-xs) var(--space-sm);border-left:2px solid var(--border);color:var(--text-muted);font-size:.82em}.pr-inline-error{color:var(--color-error);font-size:.85em}
@@ -1,6 +0,0 @@
1
- import{r as d,j as e}from"./vendor-react-BTgM5bbZ.js";import{c as I,T as b,aE as j,ba as q,cT as y,bz as L,cU as M,aD as P,C as $,cV as U,ci as E}from"./index-Bglw05rM.js";import"./vendor-i18n-DYlSUfot.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";/**
2
- * @license lucide-react v1.7.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const G=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],H=I("thumbs-up",G);function T(r){return async a=>{const i=r?`?projectId=${encodeURIComponent(r)}`:"";return(await E(`/pull-requests/${a}${i}`)).pullRequest}}function _(r){return async(a,i,u)=>(await E(`/pull-requests/${i}/${a==="automerge"?"automerge":a}`,{method:"POST",body:JSON.stringify({...u??{},...r?{projectId:r}:{}}),headers:{"content-type":"application/json"}})).pullRequest}function B({rollup:r}){return r==="success"?e.jsx($,{size:14,className:"pr-icon-success"}):r==="failure"?e.jsx(M,{size:14,className:"pr-icon-failure"}):r==="pending"?e.jsx(j,{size:14,className:"pr-icon-pending"}):e.jsx("span",{className:"pr-icon-none",children:"—"})}function Z(r){const{detail:a,pullRequestId:i,projectId:u,onAction:N,loadPullRequest:w}=r,[t,f]=d.useState(a??null),[l,m]=d.useState(null),[c,R]=d.useState(null),[A,C]=d.useState(!1),z=w??T(u),k=N??_(u),h=d.useCallback(async()=>{if(a){f(a);return}if(i)try{m(null),f(await z(i))}catch(s){m(s instanceof Error?s.message:"Failed to load PR")}},[a,i,z]);d.useEffect(()=>{h()},[h]),d.useEffect(()=>{if(a||!i)return;const s=()=>void h();return window.addEventListener("fusion:store-changed",s),()=>window.removeEventListener("fusion:store-changed",s)},[a,i,h]);const p=d.useCallback(async(s,S)=>{if(t)try{R(s),m(null);const g=await k(s,t.id,S);f(g)}catch(g){m(g instanceof Error?g.message:`Action ${s} failed`)}finally{R(null),C(!1)}},[t,k]);if(l&&!t)return e.jsxs("div",{className:"pr-view pr-view--error","data-testid":"pr-view-error",children:[e.jsx(b,{size:16})," ",l]});if(!t)return e.jsx("div",{className:"pr-view pr-view--loading","data-testid":"pr-view-loading",children:"Loading PR…"});const{state:n,summary:o}=t;if(n==="creating")return e.jsxs("div",{className:"pr-view","data-testid":"pr-view","data-state":"creating",children:[e.jsx(x,{detail:t}),e.jsxs("div",{className:"pr-placeholder","data-testid":"pr-creating",children:[e.jsx(j,{size:16})," Creating PR…"]})]});if(n==="failed")return e.jsxs("div",{className:"pr-view","data-testid":"pr-view","data-state":"failed",children:[e.jsx(x,{detail:t}),e.jsxs("div",{className:"pr-error-reason","data-testid":"pr-failed",children:[e.jsx(b,{size:16,className:"pr-icon-failure"}),e.jsx("span",{children:t.failureReason??"PR creation failed"})]}),e.jsx("div",{className:"pr-action-bar",children:e.jsxs("button",{type:"button",className:"pr-action pr-action--retry","data-testid":"pr-retry-create",disabled:c==="retry-create",onClick:()=>void p("retry-create"),children:[e.jsx(q,{size:14})," Retry PR creation"]})}),l&&e.jsx("div",{className:"pr-inline-error",children:l})]});if(t.unverified)return e.jsxs("div",{className:"pr-view","data-testid":"pr-view","data-state":"unverified",children:[e.jsx(x,{detail:t}),e.jsxs("div",{className:"pr-notice pr-notice--unverified","data-testid":"pr-unverified",children:[e.jsx(j,{size:16})," Verifying with GitHub…"]}),e.jsx("div",{className:"pr-action-bar",children:e.jsxs("button",{type:"button",className:"pr-action","data-testid":"pr-merge",disabled:!0,title:"Merge is disabled until GitHub verifies this PR",children:[e.jsx(y,{size:14})," Merge"]})})]});const v=o.conflicting;return e.jsxs("div",{className:"pr-view","data-testid":"pr-view","data-state":n,children:[e.jsx(x,{detail:t}),n==="responding"&&e.jsxs("div",{className:"pr-banner pr-banner--responding","data-testid":"pr-responding",children:[e.jsx(L,{size:16})," Response run in progress — ",o.pendingThreads," threads pending"]}),e.jsxs("div",{className:"pr-action-bar","data-testid":"pr-action-bar",children:[e.jsxs("button",{type:"button",className:"pr-action pr-action--approve","data-testid":"pr-approve",disabled:n==="responding"||c==="approve",onClick:()=>void p("approve"),children:[e.jsx(H,{size:14})," Approve"]}),e.jsxs("button",{type:"button",className:"pr-action pr-action--retry","data-testid":"pr-retry",disabled:n==="responding"||c==="retry",title:n==="responding"?"A response run is already in progress":void 0,onClick:()=>void p("retry"),children:[e.jsx(q,{size:14})," Request retry"]}),A?e.jsxs("button",{type:"button",className:"pr-action pr-action--merge-confirm","data-testid":"pr-merge-confirm",disabled:c==="merge",onClick:()=>void p("merge"),children:[e.jsx(y,{size:14})," Confirm merge"]}):e.jsxs("button",{type:"button",className:"pr-action pr-action--merge","data-testid":"pr-merge",disabled:v||n==="responding"||c==="merge",title:v?"Resolve conflicts on GitHub before merging":void 0,onClick:()=>C(!0),children:[e.jsx(y,{size:14})," Merge"]}),e.jsxs("button",{type:"button",className:"pr-action pr-action--close","data-testid":"pr-close",disabled:c==="close",onClick:()=>void p("close"),children:[e.jsx(M,{size:14})," Close"]}),e.jsxs("label",{className:"pr-automerge-toggle","data-testid":"pr-automerge",children:[e.jsx("input",{type:"checkbox",checked:t.autoMerge,disabled:c==="automerge",onChange:s=>void p("automerge",{enabled:s.target.checked})}),e.jsx("span",{children:"Auto-merge"}),e.jsx("span",{className:"pr-automerge-gate","data-testid":"pr-automerge-gate",children:o.autoMergeReason})]})]}),v&&t.prUrl&&e.jsxs("a",{className:"pr-conflict-link","data-testid":"pr-conflict-link",href:t.prUrl,target:"_blank",rel:"noopener noreferrer",children:["Resolve conflicts on GitHub ",e.jsx(P,{size:12})]}),e.jsxs("div",{className:"pr-summary","data-testid":"pr-summary",children:[e.jsxs("span",{className:"pr-summary-item","data-testid":"pr-summary-mergeable",children:["Mergeable: ",o.mergeable]}),e.jsxs("span",{className:"pr-summary-item","data-testid":"pr-summary-review",children:["Review: ",o.reviewDecision??"none"]}),e.jsxs("span",{className:"pr-summary-item","data-testid":"pr-summary-checks",children:[e.jsx(B,{rollup:o.checksRollup})," ",o.checksRollup]})]}),e.jsx("div",{className:"pr-threads","data-testid":"pr-threads",children:t.threads.length===0?e.jsx("div",{className:"pr-threads-empty",children:"No review threads."}):t.threads.map(s=>e.jsxs("div",{className:`pr-thread pr-thread--${s.outcome} ${s.outcome==="disagreed"?"pr-thread--agent-disagreement":""}`,"data-testid":`pr-thread-${s.outcome}`,"data-agent-disagreement":s.outcome==="disagreed"?"true":"false",children:[e.jsxs("div",{className:"pr-thread-head",children:[s.outcome==="pending"&&e.jsxs("span",{className:"pr-thread-pending",children:[e.jsx(j,{size:12})," pending"]}),s.outcome==="disagreed"&&e.jsxs("span",{className:"pr-thread-disagreed",children:[e.jsx(b,{size:12})," agent disagreed"]}),s.outcome==="fixed"&&e.jsxs("span",{className:"pr-thread-fixed",children:[e.jsx($,{size:12})," fixed"]}),e.jsx("span",{className:"pr-thread-id",children:s.threadId})]}),s.fixCommitSha&&e.jsxs("div",{className:"pr-thread-reply","data-testid":"pr-thread-reply",children:["Agent reply — fix ",s.fixCommitSha.slice(0,8)]})]},`${s.threadId}:${s.headOid}`))}),l&&e.jsx("div",{className:"pr-inline-error",children:l})]})}function x({detail:r}){return e.jsxs("div",{className:"pr-identity","data-testid":"pr-identity",children:[e.jsx(U,{size:16}),e.jsx("span",{className:"pr-identity-repo",children:r.repo}),r.prNumber!=null?r.prUrl?e.jsxs("a",{className:"pr-identity-number",href:r.prUrl,target:"_blank",rel:"noopener noreferrer",children:["#",r.prNumber," ",e.jsx(P,{size:12})]}):e.jsxs("span",{className:"pr-identity-number",children:["#",r.prNumber]}):null,e.jsx("span",{className:"pr-identity-branch",children:r.headBranch}),e.jsx("span",{className:`pr-identity-state pr-identity-state--${r.state}`,children:r.state})]})}export{Z as PullRequestView};
@@ -1 +0,0 @@
1
- .research-task-action-modal__body{display:flex;flex-direction:column;gap:var(--space-md)}.research-task-action-modal__preview{display:flex;flex-direction:column;gap:var(--space-xs);padding:var(--space-md)}.research-task-action-modal__preview p{margin:0}.research-task-action-modal__field{display:flex;flex-direction:column;gap:var(--space-xs);color:var(--text-muted);text-transform:uppercase}.research-task-action-modal__textarea{min-height:calc(var(--space-2xl) * 2);resize:vertical}@media(max-width:768px){.research-task-action-modal{width:min(100%,calc(100vw - (var(--space-md) * 2)))}.research-task-action-modal__body{gap:var(--space-lg)}.research-task-action-modal__preview{padding:var(--space-lg)}.research-task-action-modal .modal-actions{flex-direction:column;align-items:stretch;gap:var(--space-sm)}.research-task-action-modal .modal-actions .btn{min-height:calc(var(--space-lg) * 2 + var(--space-xs))}}.research-view{display:flex;flex-direction:column;gap:var(--space-md);height:100%;min-height:0;overflow:hidden;padding:var(--space-lg);padding-bottom:var(--space-lg)}.research-view__header{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--space-md);min-width:0}.research-view__header-actions{flex-shrink:0}.research-view__title{margin:0}.research-view__subtitle{margin:var(--space-xs) 0 0;color:var(--text-muted)}.research-view__layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:var(--space-md);min-height:0;flex:1;overflow:hidden}.research-view__sidebar,.research-view__reader{padding:var(--space-md);display:flex;flex-direction:column;gap:var(--space-md);min-height:0;min-width:0;overflow:hidden}.research-view__sidebar-content{display:flex;flex:1;flex-direction:column;gap:var(--space-md);min-height:0}.research-view__reader{overflow:auto}.research-view__reader-content,.research-view__run-detail{display:flex;flex-direction:column;gap:var(--space-md);min-height:0}.research-view__form{display:flex;flex-direction:column;gap:var(--space-sm);flex-shrink:0}.research-view__form .form-group,.research-view__history-header.form-group,.research-view__actions .form-group{margin:0;padding:0}.research-view__textarea{min-height:calc(var(--space-2xl) * 3);resize:vertical}.research-view__providers{display:grid;gap:var(--space-xs)}.research-view__provider-lock{margin-left:var(--space-xs);color:var(--text-muted)}.research-view__history-header{display:flex;flex-direction:column;align-items:stretch;gap:var(--space-xs);flex-shrink:0}.research-view__history-search-row{display:flex;align-items:center;gap:var(--space-xs);min-width:0}.research-view__history-search-row .input{flex:1;min-width:0}.research-view__history{display:flex;flex-direction:column;gap:var(--space-xs);flex:1;min-height:0;overflow:auto}.research-view__history-item{text-align:left;padding:var(--space-sm);min-height:calc(var(--space-lg) * 2 + var(--space-xs));display:flex;flex-direction:column;justify-content:center;gap:var(--space-xs);cursor:pointer}.research-view__history-item--active{border-color:var(--todo);box-shadow:var(--focus-ring)}.research-view__status-row{display:flex;align-items:center;gap:var(--space-xs);text-transform:capitalize}.research-view__run-title,.research-view__run-query,.research-view__run-summary{margin:0}.research-view__run-query{color:var(--text-muted)}.research-view__actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-xs);margin-top:var(--space-sm)}.research-view__citations{margin:var(--space-sm) 0 0;padding-left:var(--space-lg);display:flex;flex-direction:column;gap:var(--space-xs)}.research-view__citations a{color:var(--text)}.research-view__error{color:var(--color-error)}.research-view__findings{display:flex;flex-direction:column;gap:var(--space-sm)}.research-view__finding{padding:var(--space-sm)}.research-view__finding h4,.research-view__finding p{margin:0}.research-view__finding-actions{margin-top:var(--space-sm)}.research-view__events{margin:var(--space-sm) 0 0;padding-left:var(--space-lg)}.research-view__stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-sm);margin-top:var(--space-sm);padding-top:var(--space-sm);border-top:var(--btn-border-width) solid var(--border)}.research-view__stat-card{border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-sm);padding:var(--space-sm);background:var(--surface)}.research-view__stat-label{color:var(--text-muted);text-transform:uppercase}.research-view__stat-value{font-family:var(--font-mono)}.research-view__state--error{border-color:var(--color-error)}@media(max-width:768px){.research-view{overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;padding:var(--space-md);padding-bottom:calc(var(--space-md) + var(--mobile-nav-height) + env(safe-area-inset-bottom,0px) + var(--standalone-bottom-gap))}.research-view__layout{display:flex;flex-direction:column;grid-template-columns:minmax(0,1fr);gap:var(--space-md);flex:initial;min-height:auto;overflow:visible}.research-view__sidebar,.research-view__reader,.research-view__sidebar-content,.research-view__reader-content{min-height:auto;overflow:visible}.research-view__history{flex:initial;min-height:auto;overflow:visible}.research-view__header{flex-direction:column}.research-view__header-actions{align-self:flex-start}.research-view__stats{grid-template-columns:minmax(0,1fr)}.research-view__history-item{min-height:calc(var(--space-lg) * 2 + var(--space-sm))}}
@@ -1 +0,0 @@
1
- import{r as c,j as e}from"./vendor-react-BTgM5bbZ.js";import{a7 as W,a8 as de,a9 as ue,am as he,aG as ve,ac as te,aH as xe,s as ye,aI as X,aJ as ge,aK as Re,aL as _e,aM as je,aN as Se,aO as we,aq as Ne,u as ke,aP as Ee,x as Ce,aQ as Ae,L as Te,S as Le}from"./index-Bglw05rM.js";import{u as me}from"./vendor-i18n-DYlSUfot.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";const Pe="builtin",z={pageFetch:!0,github:!1,localDocs:!0,llmSynthesis:!0};function ne(n){const t=n?.researchGlobalDefaults,i=n?.researchSettings;return{enabled:i?.enabled??n?.researchEnabled??n?.researchGlobalEnabled??!0,searchProvider:i?.searchProvider??t?.searchProvider??n?.researchGlobalWebSearchProvider??Pe,synthesisProvider:i?.synthesisProvider??t?.synthesisProvider,synthesisModelId:i?.synthesisModelId??t?.synthesisModelId,enabledSources:{webSearch:!0,pageFetch:i?.enabledSources?.pageFetch??t?.enabledSources?.pageFetch??z.pageFetch,github:i?.enabledSources?.github??t?.enabledSources?.github??z.github,localDocs:i?.enabledSources?.localDocs??t?.enabledSources?.localDocs??z.localDocs,llmSynthesis:i?.enabledSources?.llmSynthesis??t?.enabledSources?.llmSynthesis??z.llmSynthesis},limits:{maxConcurrentRuns:i?.limits?.maxConcurrentRuns??n?.researchMaxConcurrentRuns??n?.researchGlobalMaxConcurrentRuns??3,maxSourcesPerRun:i?.limits?.maxSourcesPerRun??t?.maxSourcesPerRun??n?.researchMaxSourcesPerRun??n?.researchGlobalMaxSourcesPerRun??20,maxDurationMs:i?.limits?.maxDurationMs??n?.researchDefaultTimeout??n?.researchGlobalDefaultTimeout??3e5,requestTimeoutMs:i?.limits?.requestTimeoutMs??n?.researchGlobalFetchTimeoutMs??3e4},defaultExportFormat:t?.defaultExportFormat??"markdown"}}const Ie=300,Fe=4e3,Me=["queued","running","cancelling","retry_waiting"];function ce(n,t){if(n instanceof Ne){const i=n;return{message:n.message,status:n.status,code:i.researchCode??"INTERNAL_ERROR",setupHint:i.setupHint,retryable:i.retryable}}return n instanceof Error?{message:n.message,code:"INTERNAL_ERROR"}:{message:t,code:"INTERNAL_ERROR"}}function De(n){if(!n)return{cancelable:!1,retryable:!1,isTransitioning:!1,blockingReason:"No run selected"};const t=Me.includes(n.status),i=n.status==="queued"||n.status==="running",v=n.lifecycle?.retryable,a=n.status==="failed"||n.status==="timed_out",_=!!(a&&v);let g;return!i&&t?g="Run is already transitioning":!i&&n.status==="completed"?g="Completed runs cannot be cancelled":!i&&n.status==="cancelled"?g="Run is already cancelled":!i&&n.status==="retry_exhausted"?g="Retry attempts exhausted":!i&&n.status==="failed"?g="Failed runs cannot be cancelled":!i&&n.status==="timed_out"&&(g="Timed out runs cannot be cancelled"),!_&&a&&v===!1&&(g=n.lifecycle?.errorCode==="RETRY_EXHAUSTED"?"Retry attempts exhausted":"Run is not retryable"),{cancelable:i,retryable:_,isTransitioning:t,blockingReason:g}}function qe(n){const t=n?.projectId,i=t??"",v=`${ue.RESEARCH_RUNS_PREFIX}${i}`,a=`${ue.RESEARCH_SELECTED_ID_PREFIX}${i}`,_=W(v,{maxAgeMs:de}),g=W(a,{maxAgeMs:he}),s=c.useRef(Array.isArray(_)&&_.length>0),[I,P]=c.useState(()=>Array.isArray(_)?_:[]),[h,E]=c.useState(g??null),[A,N]=c.useState(null),[H,F]=c.useState({available:!0}),[M,T]=c.useState(!(Array.isArray(_)&&_.length>0)),[G,O]=c.useState(null),[$,j]=c.useState(null),[w,k]=c.useState(""),x=c.useRef(0),d=c.useRef(0),D=c.useRef(t);c.useEffect(()=>{D.current!==t&&(D.current=t,d.current++);const l=W(v,{maxAgeMs:de}),o=W(a,{maxAgeMs:he}),p=Array.isArray(l)&&l.length>0;P(Array.isArray(l)?l:[]),E(o??null),N(null),T(!p),s.current=p},[t,v,a]);const b=c.useCallback(async(l=w)=>{const o=++x.current,p=t;s.current||T(!0),O(null),j(null);try{const R=await ve({q:l||void 0,limit:100},p);if(o!==x.current||p!==t)return;P(R.runs),te(v,R.runs,{maxBytes:5e5}),s.current=!0,F(R.availability),h&&!R.runs.some(y=>y.id===h)&&(E(null),te(a,null,{maxBytes:5e5}),N(null))}catch(R){if(o!==x.current||p!==t)return;const y=ce(R,"Failed to load research runs");O(y.message),j(y)}finally{o===x.current&&T(!1)}},[t,v,w,a,h]),q=c.useCallback(async l=>{const o=await xe(l,t);return N(o.run),F(o.availability),o.run},[t]);c.useEffect(()=>{s.current||T(!0);const l=window.setTimeout(()=>{b(w)},Ie);return()=>window.clearTimeout(l)},[b,w]),c.useEffect(()=>{if(!h){N(null);return}q(h)},[q,h]),c.useEffect(()=>{const l=d.current,o=()=>d.current!==l,p=t?`?projectId=${encodeURIComponent(t)}`:"";let R=!0;const y=()=>{!R||o()||(b(),h&&q(h))},S=`/api/events${p}`,U=ye(S,{events:{"research:run:created":y,"research:run:updated":y,"research:run:completed":y,"research:run:failed":y,"research:run:cancelled":y},onReconnect:()=>{X({view:"useResearch",trigger:"sse-reconnect",projectId:t,replayAttempted:!1,sseChannel:S}),y()}});X({view:"useResearch",trigger:"sse-open",projectId:t,replayAttempted:!1,sseChannel:S});const L=window.setInterval(y,Fe);return()=>{R=!1,U(),window.clearInterval(L)}},[t,b,h,q]);const B=c.useCallback(l=>{E(l),te(a,l,{maxBytes:5e5})},[a]);return{runs:I,selectedRun:A,selectedRunId:h,setSelectedRunId:B,availability:H,loading:M,error:G,searchQuery:w,setSearchQuery:k,refresh:b,createRun:l=>we(l,t),cancelRun:async l=>{try{j(null);const o=await Se(l,t);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to cancel run");throw j(p),p}},retryRun:async l=>{try{j(null);const o=await je(l,t);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to retry run");throw j(p),p}},exportRun:(l,o)=>_e(l,o,t),createTaskFromRun:(l,o,p,R,y,S)=>Re(l,{title:o,findingId:p,description:R,priority:y,attachExport:S},t),attachRunToTask:(l,o,p,R)=>ge(l,{taskId:o,findingId:p,attachExport:R},t),uiError:$,runActionState:De(A),statusCounts:I.reduce((l,o)=>(l[o.status]+=1,l),{queued:0,running:0,cancelling:0,retry_waiting:0,completed:0,failed:0,cancelled:0,timed_out:0,retry_exhausted:0})}}function He({open:n,mode:t,run:i,finding:v,projectId:a,onClose:_,onConfirm:g}){const{t:s}=me("app");ke(n);const[I,P]=c.useState(!1),[h,E]=c.useState(""),[A,N]=c.useState(""),[H,F]=c.useState("normal"),[M,T]=c.useState(""),[G,O]=c.useState([]),[$,j]=c.useState(!1),[w,k]=c.useState(!1),x=c.useMemo(()=>{const d=(v.content??"").split(/(?<=[.!?])\s+/)[0]??"";return`${v.heading||s("research.defaultFindingHeading","Research finding")} — ${d}`.trim()},[v.content,v.heading,s]);return c.useEffect(()=>{n&&(P(!1),E(`Research: ${v.heading||i.title}`),N(x),F("normal"),T(""),t==="enrich"&&(j(!0),Ee(50,0,a).then(d=>O(d.filter(D=>D.column!=="archived"))).finally(()=>j(!1))))},[n,t,a,v.heading,x,i.title]),n?e.jsx("div",{className:"modal-overlay open",role:"presentation",onClick:_,children:e.jsxs("div",{className:"modal modal-lg research-task-action-modal",role:"dialog","aria-modal":"true",onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:t==="create"?s("research.createTaskTitle","Create task from finding"):s("research.enrichTaskTitle","Enrich existing task")}),e.jsx("button",{className:"modal-close",type:"button","aria-label":s("actions.close","Close"),onClick:_,children:"×"})]}),e.jsxs("div",{className:"research-task-action-modal__body",children:[e.jsxs("div",{className:"card research-task-action-modal__preview",children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[s("research.runLabel","Run:")," "]})," ",i.id]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[s("research.findingLabel","Finding:")," "]})," ",v.id,v.heading?` — ${v.heading}`:""]}),e.jsx("p",{children:x||s("research.noPreview","No preview available.")})]}),t==="create"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"research-task-action-modal__field",children:[s("research.titleLabel","Title"),e.jsx("input",{className:"input",value:h,onChange:d=>E(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[s("research.descriptionLabel","Description"),e.jsx("textarea",{className:"input research-task-action-modal__textarea",value:A,onChange:d=>N(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[s("research.priorityLabel","Priority"),e.jsxs("select",{className:"select",value:H,onChange:d=>F(d.target.value),children:[e.jsx("option",{value:"low",children:s("research.priorityLow","Low")}),e.jsx("option",{value:"normal",children:s("research.priorityNormal","Normal")}),e.jsx("option",{value:"high",children:s("research.priorityHigh","High")}),e.jsx("option",{value:"urgent",children:s("research.priorityUrgent","Urgent")})]})]})]}):e.jsxs("label",{className:"research-task-action-modal__field",children:[s("research.targetTaskLabel","Target task"),e.jsx("input",{className:"input",list:"research-task-action-task-list",value:M,placeholder:$?s("research.loadingTasks","Loading tasks…"):s("research.enterTaskId","Enter task ID"),onChange:d=>T(d.target.value)}),e.jsx("datalist",{id:"research-task-action-task-list",children:G.map(d=>e.jsx("option",{value:d.id,children:d.title},d.id))})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:I,onChange:d=>P(d.target.checked)}),e.jsx("span",{children:s("research.attachExport","Attach markdown export artifact")})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:_,children:s("actions.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:w||t==="enrich"&&!M,onClick:()=>{k(!0),g({taskId:t==="enrich"?M:void 0,title:t==="create"?h.trim():void 0,description:t==="create"?A.trim():void 0,priority:t==="create"?H:void 0,attachExport:I}).finally(()=>k(!1))},children:t==="create"?s("research.createTaskButton","Create Task"):s("research.enrichTaskButton","Enrich Task")})]})]})}):null}const Oe=["web-search","page-fetch","github","local-docs","llm-synthesis"],Ue={"web-search":"webSearch","page-fetch":"pageFetch",github:"github","local-docs":"localDocs","llm-synthesis":"llmSynthesis"};function Ge(n){return{"web-search":n("research.providerWebSearch","Web Search"),"page-fetch":n("research.providerPageFetch","Page Fetch"),github:n("research.providerGitHub","GitHub"),"local-docs":n("research.providerLocalDocs","Local Docs"),"llm-synthesis":n("research.providerLlmSynthesis","LLM Synthesis")}}let ie=!1;function Xe({projectId:n,addToast:t,onOpenSettings:i,readinessVersion:v=0}){const{t:a}=me("app"),_=Ge(a);c.useEffect(()=>(X({view:"ResearchView",trigger:ie?"route-active":"remount",projectId:n,replayAttempted:!1}),ie=!1,()=>{ie=!0,X({view:"ResearchView",trigger:"route-inactive",projectId:n,replayAttempted:!1})}),[n]);const{runs:g,selectedRun:s,selectedRunId:I,setSelectedRunId:P,availability:h,loading:E,error:A,searchQuery:N,setSearchQuery:H,createRun:F,cancelRun:M,retryRun:T,exportRun:G,createTaskFromRun:O,attachRunToTask:$,statusCounts:j,refresh:w,uiError:k,runActionState:x}=qe({projectId:n}),[d,D]=c.useState(""),[b,q]=c.useState(()=>ne(void 0)),[B,l]=c.useState([]),[o,p]=c.useState(!1),[R,y]=c.useState([]),[S,U]=c.useState(null),[L,K]=c.useState(null),Y=h.supportedProviders??Oe,J=b.searchProvider,Z=r=>r==="web-search"?!0:b.enabledSources[Ue[r]];c.useEffect(()=>{const r=Y.filter(u=>Z(u));y(u=>{const f=u.filter(m=>r.includes(m));return f.length>0?f:r})},[b.enabledSources,Y]),c.useEffect(()=>{let r=!1;return Promise.all([Ce(n),Ae().catch(()=>({providers:[]}))]).then(([u,f])=>{r||(q(ne(u)),l(f.providers.filter(m=>m.type==="api_key").map(m=>({id:m.id,authenticated:m.authenticated}))))}).catch(()=>{r||q(ne(void 0))}),()=>{r=!0}},[n,v]);const be=c.useMemo(()=>s?s.status:a("research.noRunSelected","No run selected"),[s,a]),pe=c.useMemo(()=>s?s.status==="queued"||s.status==="retry_waiting"?"status-dot status-dot--pending":s.status==="running"?"status-dot status-dot--connecting":s.status==="completed"?"status-dot status-dot--online":s.status==="failed"||s.status==="cancelled"?"status-dot status-dot--error":"status-dot":"status-dot",[s]),ee=h.supportedExportFormats??["markdown","json","html"],se=c.useMemo(()=>new Map(B.map(r=>[r.id,r.authenticated])),[B]),re=c.useMemo(()=>{const r=new Set;return b.enabledSources.webSearch&&J&&r.add(J),b.enabledSources.llmSynthesis&&b.synthesisProvider&&r.add(b.synthesisProvider),[...r].filter(u=>se.has(u))},[b.enabledSources.llmSynthesis,b.enabledSources.webSearch,b.synthesisProvider,J,se]).find(r=>se.get(r)!==!0),V=c.useMemo(()=>h.available?b.enabled?re?{reason:a("research.missingApiKey","Missing API key for {{provider}}.",{provider:re}),details:a("research.addCredentialsHint","Add provider credentials in Authentication settings."),settingsSection:"authentication"}:null:{reason:a("research.disabled","Research is disabled for this project."),details:a("research.enableResearchHint","Enable project research settings to create runs."),settingsSection:"research-project"}:{reason:h.reason??a("research.unavailable","Research is unavailable for this project."),details:h.setupInstructions,settingsSection:"research-project"},[h.available,h.reason,h.setupInstructions,b.enabled,re,a]),Q=async(r,u,f)=>{U(r);try{await u(),t?.(f,"success"),await w()}catch(m){t?.(m instanceof Error?m.message:a("research.actionFailed","Action failed"),"error")}finally{U(null)}},ae=async r=>{if(s){U(`export-${r}`);try{const u=await G(s.id,r),f=new Blob([u.content],{type:"text/plain;charset=utf-8"}),m=URL.createObjectURL(f),C=document.createElement("a");C.href=m,C.download=u.filename,document.body.appendChild(C),C.click(),C.remove(),URL.revokeObjectURL(m),t?.(a("research.exportedFile","Exported {{filename}}",{filename:u.filename}),"success")}catch(u){t?.(u instanceof Error?u.message:a("research.exportFailed","Export failed"),"error")}finally{U(null)}}},fe=async()=>{if(d.trim()){p(!0);try{const r=R.filter(f=>Z(f));if(r.length===0){p(!1),t?.(a("research.noSourcesAvailable","No enabled research sources are available for this project."),"error");return}const u=await F({query:d.trim(),providers:r});P(u.run.id),D(""),t?.(a("research.runCreated","Research run created"),"success"),await w()}catch(r){t?.(r instanceof Error?r.message:a("research.createRunFailed","Failed to create run"),"error")}finally{p(!1)}}};return e.jsxs("section",{className:"research-view","aria-label":a("research.viewLabel","Research view"),children:[e.jsxs("header",{className:"research-view__header",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"research-view__title",children:a("research.title","Research")}),e.jsx("p",{className:"research-view__subtitle",children:a("research.subtitle","Cited search and synthesis runs: gather sources, fetch content, and synthesize findings.")})]}),e.jsx("div",{className:"research-view__header-actions",children:e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:a("actions.refresh","Refresh")})})]}),V?e.jsxs("div",{className:"research-view__state research-view__state--error card","data-testid":"research-state-unavailable",children:[e.jsx("p",{children:V.reason}),V.details&&e.jsx("p",{children:V.details}),e.jsxs("p",{children:["Current defaults: provider ",b.searchProvider??"(not set)",", max sources ",b.limits.maxSourcesPerRun]}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:a("actions.refresh","Refresh")}),e.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>i?.(V.settingsSection),children:a("actions.openSettings","Open Settings")})]})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"research-view__layout",children:[e.jsx("aside",{className:"research-view__sidebar card",children:e.jsxs("div",{className:"research-view__sidebar-content",children:[e.jsxs("div",{className:"research-view__form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"research-query",children:a("research.queryLabel","Query")}),e.jsx("textarea",{id:"research-query",className:"input research-view__textarea",value:d,onChange:r=>D(r.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("research.providersLabel","Providers")}),e.jsx("div",{className:"research-view__providers",children:Y.map(r=>{const u=Z(r),f=r==="web-search";return e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:f||R.includes(r),disabled:f||!u,onChange:()=>{f||!u||y(m=>m.includes(r)?m.filter(C=>C!==r):[...m,r])}}),e.jsxs("span",{children:[_[r]??r,f?e.jsx("span",{className:"research-view__provider-lock",children:a("research.alwaysOn","Always on")}):null]})]},r)})})]}),e.jsxs("button",{className:"btn btn-primary",type:"button",disabled:!d.trim()||o,onClick:()=>void fe(),children:[o?e.jsx(Te,{className:"animate-spin",size:14}):null,a("research.createRun","Create Run")]})]}),e.jsxs("div",{className:"research-view__history-header form-group",children:[e.jsx("label",{htmlFor:"research-run-search",children:a("actions.search","Search")}),e.jsxs("div",{className:"research-view__history-search-row",children:[e.jsx(Le,{size:14}),e.jsx("input",{id:"research-run-search",className:"input",placeholder:a("research.searchRunsPlaceholder","Search runs"),value:N,onChange:r=>H(r.target.value)})]})]}),e.jsx("div",{className:"research-view__history","data-testid":"research-state-running",children:g.map(r=>e.jsxs("button",{type:"button",className:`research-view__history-item card${I===r.id?" research-view__history-item--active":""}`,onClick:()=>P(r.id),children:[e.jsx("span",{className:"card-id",children:r.id}),e.jsx("span",{children:r.title})]},r.id))})]})}),e.jsxs("div",{className:"research-view__reader card",children:[E&&e.jsx("p",{"data-testid":"research-state-loading",children:a("research.loadingRuns","Loading research runs…")}),!E&&A&&e.jsx("p",{"data-testid":"research-state-error",children:A}),!E&&!A&&g.length===0&&e.jsx("p",{"data-testid":"research-state-empty",children:a("research.noRunsYet","No research runs yet")}),e.jsxs("div",{className:"research-view__reader-content",children:[s&&e.jsxs("div",{className:"research-view__run-detail",children:[e.jsxs("div",{className:"research-view__status-row",children:[e.jsx("span",{className:pe}),e.jsx("strong",{children:be})]}),e.jsx("h3",{className:"research-view__run-title",children:s.title}),e.jsx("p",{className:"research-view__run-query",children:s.query}),e.jsx("p",{className:"research-view__run-summary","data-testid":"research-state-results",children:s.results?.summary??a("research.noSummaryYet","No summary yet.")}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",title:x.cancelable?void 0:x.blockingReason,disabled:S==="cancel"||S==="retry"||!x.cancelable,onClick:()=>void Q("cancel",()=>M(s.id),a("research.runCancelled","Run cancelled")),children:a("actions.cancel","Cancel")}),e.jsx("button",{className:"btn",type:"button",title:x.retryable?void 0:x.blockingReason,disabled:S==="cancel"||S==="retry"||!x.retryable,onClick:()=>void Q("retry",()=>T(s.id),a("research.runRetried","Run retried")),children:a("actions.retry","Retry")}),ee.includes("markdown")&&e.jsx("button",{className:"btn",type:"button",disabled:S==="export-markdown",onClick:()=>void ae("markdown"),children:a("research.exportMd","Export MD")}),ee.includes("json")&&e.jsx("button",{className:"btn",type:"button",disabled:S==="export-json",onClick:()=>void ae("json"),children:a("research.exportJson","Export JSON")}),ee.includes("html")&&e.jsx("button",{className:"btn",type:"button",disabled:S==="export-html",onClick:()=>void ae("html"),children:a("research.exportHtml","Export HTML")})]}),s.error&&e.jsx("p",{className:"research-view__error",children:s.error}),k&&e.jsxs("div",{className:"form-error",role:"alert",children:[e.jsx("p",{children:k.message}),k.setupHint&&e.jsx("p",{children:k.setupHint}),k.code==="MISSING_CREDENTIALS"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("authentication"),children:a("research.openAuthSettings","Open Authentication Settings")}),k.code==="FEATURE_DISABLED"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("research-project"),children:a("research.openResearchSettings","Open Research Settings")})]}),x.blockingReason&&e.jsx("p",{className:"research-view__run-query",children:x.blockingReason}),Array.isArray(s.results?.findings)&&s.results.findings.length>0&&e.jsx("div",{className:"research-view__findings",children:s.results.findings.map((r,u)=>{const m=r.id?.trim()||`finding-${u+1}`;return e.jsxs("article",{className:"research-view__finding card",children:[e.jsx("h4",{children:r.heading}),e.jsx("p",{children:r.content}),e.jsxs("div",{className:"research-view__actions research-view__finding-actions",children:[e.jsx("button",{className:"btn btn-primary btn-sm",type:"button",onClick:()=>K({mode:"create",findingId:m}),children:a("research.createTask","Create Task")}),e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>K({mode:"enrich",findingId:m}),children:a("research.enrichTask","Enrich Task")})]})]},m)})}),Array.isArray(s.results?.citations)&&s.results.citations.length>0&&e.jsx("ul",{className:"research-view__citations",children:s.results.citations.map(r=>e.jsx("li",{children:e.jsx("a",{href:r,target:"_blank",rel:"noreferrer",children:r})},r))}),s.events.length>0&&e.jsxs("details",{children:[e.jsx("summary",{children:a("research.runHistory","Run history")}),e.jsx("ul",{className:"research-view__events",children:s.events.map(r=>e.jsx("li",{children:r.message},r.id))})]})]}),!s&&g.length>0&&e.jsx("p",{children:a("research.selectRunToViewDetails","Select a run to view details.")}),e.jsxs("div",{className:"research-view__stats",children:[e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:a("research.statRunning","Running")}),e.jsx("div",{className:"research-view__stat-value",children:j.running})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:a("research.statCompleted","Completed")}),e.jsx("div",{className:"research-view__stat-value",children:j.completed})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:a("research.statFailed","Failed")}),e.jsx("div",{className:"research-view__stat-value",children:j.failed})]})]})]})]})]})}),s&&L&&(()=>{const r=s.results?.findings?.findIndex((f,m)=>(f.id?.trim()||`finding-${m+1}`)===L.findingId)??-1,u=r>=0?s.results.findings[r]:null;return u?e.jsx(He,{open:!0,mode:L.mode,run:s,finding:{id:L.findingId,heading:u.heading,content:u.content},projectId:n,onClose:()=>K(null),onConfirm:async({taskId:f,title:m,description:C,priority:le,attachExport:oe})=>{L.mode==="create"?await Q("create-task",()=>O(s.id,m,L.findingId,C,le,oe),a("research.taskCreatedFromResearch","Task created from research")):f&&await Q("attach-task",()=>$(s.id,f,L.findingId,oe),a("research.taskEnrichedFromResearch","Task enriched from research")),K(null)}}):null})()]})}export{Xe as ResearchView};
@@ -1 +0,0 @@
1
- import{r as c,j as e}from"./vendor-react-BTgM5bbZ.js";import{u as de}from"./vendor-i18n-DYlSUfot.js";import{R as J,J as pe,ag as q,ah as Y,bL as he,bM as ue,b8 as me,U as ye}from"./index-Bglw05rM.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-xterm-ea7-K05z.js";import"./vendor-codemirror-jBKmHyH0.js";const xe="__sync_passphrase__",k={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},n={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},ve={...n,className:"secrets-action-icon spin"},Ce=({addToast:d})=>{const{t:a}=de("app"),[L,G]=c.useState([]),[R,T]=c.useState(!0),[M,A]=c.useState(null),[D,b]=c.useState(null),[p,K]=c.useState(null),[U,y]=c.useState(!1),[z,g]=c.useState(null),[t,l]=c.useState(k),[N,C]=c.useState(!1),[O,j]=c.useState({}),[Q,V]=c.useState(null),[h,W]=c.useState(!1),[X,_]=c.useState(!1),[f,B]=c.useState(""),[P,$]=c.useState(""),[Z,F]=c.useState(!1),m=c.useRef(new Map),E=c.useRef(new Map),o=c.useCallback(async(s,r)=>{const i=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!i.ok){const u=await i.json().catch(()=>({error:"Request failed"}));throw new Error(String(u?.error??"Request failed"))}if(i.status!==204)return i.json()},[]),x=c.useCallback(async()=>{T(!0),A(null);try{const s=await o("/api/secrets");G(s.secrets)}catch(s){A(s instanceof Error?s.message:String(s))}finally{T(!1)}},[o]),S=c.useCallback(async()=>{try{const s=await o("/api/secrets/sync-passphrase");W(!!s.configured)}catch(s){d?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}},[d,o]);c.useEffect(()=>(x(),S(),()=>{m.current.forEach(s=>clearTimeout(s)),E.current.forEach(s=>clearTimeout(s))}),[x,S]);const w=()=>{_(!1),B(""),$("")},ee=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},se=async()=>{F(!0);try{await ee(f),d?.(h?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),w(),await S()}catch(s){d?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{F(!1)}},ae=async()=>{if(window.confirm(a("secrets.confirmClearSyncPassphrase","Clear the cross-node sync passphrase? Existing sync pairs will stop working until you set a new passphrase.")))try{await o("/api/secrets/sync-passphrase",{method:"DELETE"}),d?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await S()}catch(r){d?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},re=()=>{K(null),l(k),y(!0),C(!1),b(null)},te=s=>{K(s),l({key:s.key,value:"",description:s.description??"",scope:s.scope,accessPolicy:s.accessPolicy,envExportable:s.envExportable,envExportKey:s.envExportKey??""}),y(!0),C(!1),b(null)},ce=async()=>{b(null);try{if(p){const s={key:t.key,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null};t.value&&(s.value=t.value),await o(`/api/secrets/${p.scope}/${p.id}`,{method:"PATCH",body:JSON.stringify(s)})}else await o("/api/secrets",{method:"POST",body:JSON.stringify({scope:t.scope,key:t.key,value:t.value,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null})});y(!1),l(k),await x()}catch(s){b(s instanceof Error?s.message:String(s))}},le=s=>{const r=m.current.get(s.id);r&&(clearTimeout(r),m.current.delete(s.id)),j(i=>({...i,[s.id]:null}))},ne=async s=>{const r=await o(`/api/secrets/${s.scope}/${s.id}/reveal`,{method:"POST"});j(v=>({...v,[s.id]:r.value})),d?.(a("secrets.revealed","Revealed"),"success");const i=setTimeout(()=>{j(v=>({...v,[s.id]:null})),m.current.delete(s.id)},3e4),u=m.current.get(s.id);u&&clearTimeout(u),m.current.set(s.id,i)},oe=async s=>{const r=O[s.id];if(!r)return;await navigator.clipboard.writeText(r),V(s.id),d?.(a("secrets.copied","Copied"),"success");const i=setTimeout(()=>{V(null),j(v=>({...v,[s.id]:null}))},1500),u=E.current.get(s.id);u&&clearTimeout(u),E.current.set(s.id,i)},ie=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await x()},I=c.useMemo(()=>[...L].filter(s=>!(s.scope==="global"&&s.key===xe)).sort((s,r)=>s.key.localeCompare(r.key)),[L]),H=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsxs("div",{className:"secrets-header",children:[e.jsx("h2",{children:a("secrets.title","Secrets")}),e.jsxs("div",{className:"secrets-header-actions",children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),children:[e.jsx(J,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:re,children:[e.jsx(pe,{...n})," ",a("secrets.addSecret","Add Secret")]})]})]}),e.jsxs("article",{className:"card secrets-sync-card",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")}),e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${h?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",h?a("secrets.syncConfigured","Configured"):a("secrets.syncNotConfigured","Not configured")]})]}),e.jsxs("div",{className:"secrets-sync-actions",children:[e.jsx("button",{className:"btn",onClick:()=>_(!0),children:h?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),h?e.jsx("button",{className:"btn btn-danger",onClick:()=>void ae(),children:a("secrets.clearSyncPassphrase","Clear")}):null]})]}),e.jsx("p",{className:"secrets-sync-copy",children:a("secrets.syncPassphraseDescription","Shared passphrase used to wrap cross-node secret bundles. Both nodes in a sync pair must share the same value. Stored locally only; never transmitted.")})]}),M?e.jsx("div",{className:"form-error",children:M}):null,R?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(J,{...ve})," ",a("secrets.loading","Loading…")]}):null,!R&&I.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:I.map(s=>{const r=O[s.id];return e.jsxs("article",{className:"card secrets-row",children:[e.jsxs("div",{className:"secrets-row-main",children:[e.jsx("div",{className:"secrets-row-key",children:s.key}),e.jsxs("div",{className:"secrets-row-meta",children:[e.jsx("span",{className:"secrets-chip",children:s.scope}),e.jsx("span",{className:"secrets-chip",children:s.accessPolicy}),s.envExportable?e.jsx("span",{className:"secrets-chip",children:a("secrets.envExportableChip","env exportable")}):null]}),r?e.jsx("pre",{className:"secrets-revealed",children:r}):null]}),e.jsxs("div",{className:"secrets-row-side",children:[e.jsx("span",{className:"secrets-row-read",children:s.lastReadAt?new Date(s.lastReadAt).toLocaleString():a("secrets.neverRead","Never read")}),e.jsxs("div",{className:"secrets-row-actions",children:[e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>{if(r){le(s);return}ne(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(q,{...n}):e.jsx(Y,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void oe(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:Q===s.id?e.jsx(he,{...n}):e.jsx(ue,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>te(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(me,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(ye,{...n})})]}),z===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void ie(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>g(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),X?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":h?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:h?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:w,"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.passphraseLabel","Passphrase")}),e.jsx("input",{"aria-label":a("secrets.passphraseLabel","Passphrase"),className:"input",type:"password",autoComplete:"new-password",value:f,onChange:s=>B(s.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.confirmPassphraseLabel","Confirm passphrase")}),e.jsx("input",{"aria-label":a("secrets.confirmPassphraseLabel","Confirm passphrase"),className:"input",type:"password",autoComplete:"new-password",value:P,onChange:s=>$(s.target.value)})]}),!H&&P.length>0?e.jsx("div",{className:"form-error",children:a("secrets.passphraseMustMatch","Passphrases must match.")}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:w,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void se(),disabled:!H||Z,children:h?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")})]})})]})}):null,U?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret")}),e.jsx("button",{className:"modal-close",onClick:()=>y(!1),"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.keyLabel","Key")}),e.jsx("input",{className:"input",value:t.key,onChange:s=>l(r=>({...r,key:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.valueLabel","Value")}),e.jsxs("div",{className:"secrets-value-row",children:[e.jsx("input",{className:"input",type:N?"text":"password",autoComplete:"off",spellCheck:!1,value:t.value,onChange:s=>l(r=>({...r,value:s.target.value}))}),e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>C(s=>!s),"aria-label":N?a("secrets.hideValueAriaLabel","Hide value"):a("secrets.showValueAriaLabel","Show value"),children:N?e.jsx(q,{...n}):e.jsx(Y,{...n})})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.descriptionLabel","Description")}),e.jsx("textarea",{className:"input",value:t.description,onChange:s=>l(r=>({...r,description:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.scopeLabel","Scope")}),e.jsxs("div",{className:"secrets-radio-row",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="project",onChange:()=>l(s=>({...s,scope:"project"})),disabled:!!p})," ",a("secrets.scopeProject","Project")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="global",onChange:()=>l(s=>({...s,scope:"global"})),disabled:!!p})," ",a("secrets.scopeGlobal","Global")]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.accessPolicyLabel","Access policy")}),e.jsxs("select",{className:"select",value:t.accessPolicy,onChange:s=>l(r=>({...r,accessPolicy:s.target.value})),children:[e.jsx("option",{value:"auto",children:a("secrets.accessPolicyAuto","auto")}),e.jsx("option",{value:"prompt",children:a("secrets.accessPolicyPrompt","prompt")}),e.jsx("option",{value:"deny",children:a("secrets.accessPolicyDeny","deny")})]})]}),e.jsx("div",{className:"form-group",children:e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.envExportable,onChange:s=>l(r=>({...r,envExportable:s.target.checked}))})," ",a("secrets.exportToEnvLabel","Export to env")]})}),t.envExportable?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.envKeyLabel","Env key")}),e.jsx("input",{className:"input",value:t.envExportKey,onChange:s=>l(r=>({...r,envExportKey:s.target.value}))})]}):null,D?e.jsx("div",{className:"form-error",children:D}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:()=>y(!1),children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ce(),children:p?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Ce as SecretsView};
@@ -1 +0,0 @@
1
- .secrets-view{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--space-lg);min-width:0;width:100%;padding-block:var(--space-md);padding-inline:var(--space-xl)}.secrets-header{display:flex;align-items:center;justify-content:space-between;gap:var(--space-md)}.secrets-header h2{margin:0}.secrets-header-actions{display:flex;gap:var(--space-sm)}.secrets-loading,.secrets-empty{color:var(--text-muted);display:flex;align-items:center;gap:var(--space-sm);padding-block:var(--space-sm)}.secrets-sync-card{display:flex;flex-direction:column;gap:var(--space-md)}.secrets-sync-header{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:var(--space-md)}.secrets-sync-status{display:inline-flex;align-items:center;gap:var(--space-xs);margin:0;color:var(--text-muted)}.secrets-sync-copy{margin:0;max-width:60ch;color:var(--text-muted);line-height:1.5}.secrets-sync-actions{display:flex;gap:var(--space-sm)}.secrets-list{display:flex;flex-direction:column;gap:var(--space-md)}.secrets-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:var(--space-md);align-items:start}.secrets-row-main{display:flex;flex-direction:column;gap:var(--space-sm)}.secrets-row-key{font-family:var(--font-mono);font-size:1em;overflow-wrap:anywhere}.secrets-row-meta{display:flex;flex-wrap:wrap;gap:var(--space-sm);row-gap:var(--space-xs)}.secrets-chip{border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-pill);padding:var(--space-xs) var(--space-sm);color:var(--text-muted)}.secrets-revealed{margin:0;max-width:100%;overflow-x:auto;white-space:pre-wrap;word-break:break-all;font-family:var(--font-mono);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-sm);padding:var(--space-sm);background:var(--surface)}.secrets-row-side{display:flex;flex-direction:column;gap:var(--space-sm);align-items:flex-end}.secrets-row-read{color:var(--text-muted);font-size:.95em;font-weight:400}.secrets-row-actions,.secrets-confirm,.secrets-value-row,.secrets-radio-row{display:flex;gap:var(--space-sm);align-items:center}.secrets-radio-row{flex-wrap:wrap;row-gap:var(--space-xs)}.secrets-modal-body{display:flex;flex-direction:column;gap:var(--space-md);padding:0 var(--space-xl) var(--space-lg)}.secrets-modal-body .form-group{margin:0;padding:0}.secrets-value-row .input{flex:1}.secrets-action-icon{width:1em;height:1em;min-width:1em;min-height:1em;flex-shrink:0;display:block;stroke:currentColor;font-size:var(--icon-size-sm)}.secrets-header-actions .btn,.secrets-row-actions .btn,.secrets-value-row .btn-icon{color:var(--text)}.secrets-header-actions .btn-primary,.secrets-row-actions .btn-danger{color:var(--cta-text)}.secrets-row-actions .btn:disabled{color:var(--text-muted)}@media(max-width:768px){.secrets-view{padding-inline:var(--space-md);padding-bottom:calc(var(--space-md) + var(--mobile-nav-height) + env(safe-area-inset-bottom,0px) + var(--standalone-bottom-gap, 0px))}.secrets-header,.secrets-row,.secrets-sync-header{grid-template-columns:minmax(0,1fr);display:flex;flex-direction:column;align-items:stretch;gap:var(--space-sm)}.secrets-sync-header{flex-wrap:wrap}.secrets-sync-copy{max-width:none}.secrets-sync-actions{flex-direction:column}.secrets-row-key{font-size:.95em}.secrets-row-side{width:100%;align-items:flex-start;gap:var(--space-sm)}}
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-xterm-ea7-K05z.js","assets/vendor-react-BTgM5bbZ.js","assets/vendor-xterm-LZoznX6r.css","assets/addon-fit-SnYDEvGm.js","assets/addon-unicode11-s5GoZCpi.js","assets/addon-webgl-Icn-RnEx.js"])))=>i.map(i=>d[i]);
2
- import{bH as pe,d1 as W,d2 as ee,d3 as K,bA as fe,az as ye,ah as be,d4 as U,d5 as he,d6 as we,ci as _e,a0 as A,d7 as ke,d8 as Se}from"./index-Bglw05rM.js";import{r as n,j as e}from"./vendor-react-BTgM5bbZ.js";import"./vendor-xterm-ea7-K05z.js";import{u as ve}from"./vendor-i18n-DYlSUfot.js";import{S as Te}from"./shield-alert-CqeGWBUK.js";import"./vendor-reactflow-ZasuEfF9.js";import"./vendor-codemirror-jBKmHyH0.js";const xe=32*1024,ge=100,Ee="\x1B",Ce=" ",Ne="",Re="\x1B[A",je="\x1B[B",De="\x1B[C",Pe="\x1B[D";function te(d){if(d.length!==1)return null;const i=d.toUpperCase().charCodeAt(0);return i>=64&&i<=95?String.fromCharCode(i&31):null}function Me(){const[d,r]=n.useState(()=>U());return n.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const i=window.matchMedia(he),s=()=>r(U());return s(),typeof i.addEventListener=="function"?(i.addEventListener("change",s),()=>i.removeEventListener("change",s)):(i.addListener(s),()=>i.removeListener(s))},[]),d}function Ae(d,r){if(typeof window>"u")return"";const s=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(d)}&ticket=${encodeURIComponent(r)}`;return Se(s)}function Le(d){if(typeof window<"u"&&typeof window.atob=="function"){const r=window.atob(d),i=new Uint8Array(r.length);for(let s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return new TextDecoder("utf-8").decode(i)}return Buffer.from(d,"base64").toString("utf8")}function Qe({sessionId:d,readOnly:r=!1,posture:i,mode:s="live",projectId:L,onConfirmAdvance:k,showConfirmAdvance:B=!1,onOpenAdapterSettings:$}){const{t:l}=ve("app"),S=n.useRef(null),E=n.useRef(null),C=n.useRef(null),_=n.useRef(null),[Q,V]=n.useState(!1),[ne,F]=n.useState(!1),[J,Y]=n.useState(!1),v=Me(),{keyboardOpen:N,keyboardOverlap:ie}=pe({enabled:v}),se=n.useRef(null),[b,H]=n.useState(""),[T,R]=n.useState(!1),f=n.useCallback(t=>{if(!t)return;const o=_.current;o?.readyState===WebSocket.OPEN&&o.send(JSON.stringify({type:"input",data:t}))},[]),x=n.useCallback(t=>{if(T){const o=te(t);if(R(!1),o){f(o);return}}f(t)},[T,f]),c=n.useCallback(t=>{t.preventDefault()},[]),G=n.useCallback(t=>{t?.preventDefault?.(),b&&f(b),f("\r"),H("")},[b,f]),oe=n.useCallback(t=>{if(T&&t.length>b.length){const o=t.slice(b.length,b.length+1),h=te(o);if(R(!1),h){f(h);return}}H(t)},[T,b,f]);n.useEffect(()=>{B&&F(!1)},[B,d]);const Z=n.useCallback(()=>{const t=E.current;if(!t)return;const o=W();t.options.fontFamily=ee(o.fontFamily),S.current?.style.setProperty("--terminal-glyph-font-family",K(o.fontFamily)),t.options.fontSize=o.fontSize,t.options.cursorStyle=o.cursorStyle,t.options.cursorBlink=o.cursorBlink&&!r&&s==="live";try{C.current?.fit?.()}catch{}},[s,r]);n.useEffect(()=>{if(typeof window>"u")return;const t=o=>{o.key===we&&Z()};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[Z]),n.useEffect(()=>{if(!d||typeof window>"u")return;let t=!1,o=null,h=null,D=0;const O=(u,y)=>{const P=_.current;P?.readyState===WebSocket.OPEN&&P.send(JSON.stringify({type:"resize",cols:u,rows:y}))},ce=u=>{if(D+=u,D<xe)return;const y=_.current;y?.readyState===WebSocket.OPEN&&y.send(JSON.stringify({type:"ack",bytes:D})),D=0};return(async()=>{let u;try{u=await _e(`/cli-sessions/${encodeURIComponent(d)}/attach-ticket`,{method:"POST",body:JSON.stringify(L?{projectId:L}:{})})}catch{return}if(t)return;const[{Terminal:y},{FitAddon:P},{Unicode11Addon:de}]=await Promise.all([A(()=>import("./vendor-xterm-ea7-K05z.js").then(m=>m.x),__vite__mapDeps([0,1,2])),A(()=>import("./addon-fit-SnYDEvGm.js").then(m=>m.a),__vite__mapDeps([3,1])),A(()=>import("./addon-unicode11-s5GoZCpi.js").then(m=>m.a),__vite__mapDeps([4,1]))]);if(t||!S.current)return;const w=W(),z=ee(w.fontFamily);S.current.style.setProperty("--terminal-glyph-font-family",K(w.fontFamily));const a=new y({convertEol:!1,cursorBlink:w.cursorBlink&&!r&&s==="live",cursorStyle:w.cursorStyle,disableStdin:r,scrollback:1e4,fontFamily:z,fontSize:w.fontSize}),g=new P;a.loadAddon(g);const ue=new de;if(a.loadAddon(ue),a.unicode.activeVersion="11",a.open(S.current),E.current=a,C.current=g,w.renderer==="auto"&&!U())try{const{WebglAddon:m}=await A(async()=>{const{WebglAddon:p}=await import("./addon-webgl-Icn-RnEx.js").then(M=>M.a);return{WebglAddon:p}},__vite__mapDeps([5,1]));if(!t){const p=new m;p.onContextLoss(()=>{try{p.dispose()}catch{}}),a.loadAddon(p)}}catch{}try{g.fit()}catch{}(async()=>{if(!(!await ke(w.fontSize,z)||t||E.current!==a||C.current!==g))try{a.options.fontFamily=z,a.options.fontSize=w.fontSize,g.fit(),O(a.cols,a.rows),a.refresh(0,Math.max(0,a.rows-1))}catch{}})(),r||a.onData(m=>{const p=_.current;p?.readyState===WebSocket.OPEN&&p.send(JSON.stringify({type:"input",data:m}))}),o=new ResizeObserver(()=>{h&&clearTimeout(h),h=setTimeout(()=>{try{g.fit(),O(a.cols,a.rows)}catch{}},ge)}),o.observe(S.current);const I=new WebSocket(Ae(d,u.ticket));_.current=I,I.onopen=()=>{O(a.cols,a.rows)},I.onmessage=m=>{let p;try{p=JSON.parse(typeof m.data=="string"?m.data:"")}catch{return}switch(p.type){case"scrollback":case"data":{if(typeof p.data!="string")return;const M=Le(p.data),me=M.length;a.write(M,()=>ce(me));break}}}})(),()=>{t=!0,h&&clearTimeout(h),o&&o.disconnect();const u=_.current;if(u){u.onopen=null,u.onmessage=null,u.onclose=null,u.onerror=null;try{u.close()}catch{}_.current=null}const y=E.current;if(y){try{y.dispose()}catch{}E.current=null}C.current=null}},[d,r,s,L]);const q=n.useMemo(()=>s==="idle"?l("cliTerminal.replayIdle","Session idle"):s==="ended"?l("cliTerminal.replayEnded","Session ended"):null,[s,l]),le=n.useCallback(async()=>{if(k){Y(!0);try{await k("advance"),F(!0)}finally{Y(!1)}}},[k]),ae=n.useCallback(async()=>{k&&await k("not-yet"),F(!0)},[k]),j=!!i?.elevated,X=i?.elevatedFlags?.join(", "),re={"--terminal-glyph-font-family":K(W().fontFamily)};return e.jsxs("div",{className:`cli-session-terminal${v?" cli-session-terminal--mobile":""}${v&&N?" cli-session-terminal--keyboard-open":""}`,"data-mode":s,"data-read-only":r,"data-mobile":v,"data-keyboard-open":v&&N,children:[e.jsxs("header",{className:"cli-session-terminal__header",children:[i&&e.jsxs("div",{className:"cli-session-terminal__posture-wrap",children:[e.jsxs("button",{type:"button",className:`cli-posture-chip${j?" cli-posture-chip--elevated":""}`,"data-elevated":j,"aria-expanded":Q,onClick:()=>V(t=>!t),children:[j?e.jsx(Te,{size:13,"aria-hidden":"true"}):e.jsx(fe,{size:13,"aria-hidden":"true"}),e.jsx("span",{className:"cli-posture-chip__name",children:i.adapterName}),i.mode&&e.jsx("span",{className:"cli-posture-chip__mode",children:i.mode}),j&&X&&e.jsx("span",{className:"cli-posture-chip__flag",children:X})]}),Q&&e.jsxs("div",{className:"cli-posture-tooltip",role:"tooltip",children:[e.jsx("p",{className:"cli-posture-tooltip__title",children:l("cliTerminal.postureResolved","Resolved posture")}),e.jsxs("ul",{className:"cli-posture-tooltip__list",children:[(i.resolved??[]).map((t,o)=>e.jsx("li",{children:t},o)),(i.resolved??[]).length===0&&e.jsx("li",{children:i.mode??l("cliTerminal.postureBaseline","Baseline")})]}),$&&e.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{V(!1),$()},children:[e.jsx(ye,{size:12,"aria-hidden":"true"}),l("cliTerminal.adapterSettings","Adapter settings")]})]})]}),r&&e.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[e.jsx(be,{size:12,"aria-hidden":"true"}),l("cliTerminal.readOnly","Read-only")]}),q&&e.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":s,children:q})]}),e.jsx("div",{className:"cli-session-terminal__viewport",ref:S,"data-testid":"cli-terminal-viewport",style:re}),B&&!ne&&e.jsxs("div",{className:"cli-session-terminal__advance-strip",role:"region",children:[e.jsx("span",{className:"cli-session-terminal__advance-copy",children:l("cliTerminal.advancePrompt","This session looks idle — advance to review?")}),e.jsxs("div",{className:"cli-session-terminal__advance-actions",children:[e.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn",disabled:J,onClick:le,children:l("cliTerminal.advance","Advance")}),e.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:J,onClick:ae,children:l("cliTerminal.notYet","Not yet")})]})]}),v&&!r&&e.jsxs("div",{className:`cli-session-terminal__mobile-bar${N?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:N?{bottom:`${ie}px`}:void 0,children:[e.jsxs("div",{className:"cli-session-terminal__key-row","data-testid":"cli-terminal-key-bar",children:[e.jsx("button",{type:"button",className:`cli-terminal-key cli-terminal-key--ctrl${T?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":l("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":T,onPointerDown:c,onMouseDown:c,onClick:()=>R(t=>!t),children:"Ctrl"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":l("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:c,onMouseDown:c,onClick:()=>x(Ee),children:"Esc"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":l("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:c,onMouseDown:c,onClick:()=>x(Ce),children:"Tab"}),e.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--ctrlc","data-testid":"cli-key-ctrl-c","aria-label":l("cliTerminal.mobileKeyCtrlC","Send Ctrl-C"),onPointerDown:c,onMouseDown:c,onClick:()=>{R(!1),f(Ne)},children:"^C"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":l("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:c,onMouseDown:c,onClick:()=>x(Re),children:"↑"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":l("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:c,onMouseDown:c,onClick:()=>x(je),children:"↓"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":l("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:c,onMouseDown:c,onClick:()=>x(Pe),children:"←"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":l("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:c,onMouseDown:c,onClick:()=>x(De),children:"→"})]}),e.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:G,children:[e.jsx("input",{ref:se,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:b,placeholder:l("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:t=>oe(t.target.value)}),e.jsx("button",{type:"submit",className:"cli-session-terminal__mobile-send","data-testid":"cli-terminal-mobile-send","aria-label":l("cliTerminal.mobileSend","Send"),onPointerDown:c,onMouseDown:c,onClick:()=>G(),children:l("cliTerminal.mobileSend","Send")})]})]})]})}export{Qe as SessionTerminal};
@@ -1 +0,0 @@
1
- .cli-session-terminal{display:flex;flex-direction:column;min-height:0;height:100%;background:var(--terminal-bg, var(--bg));border:1px solid var(--border);border-radius:var(--radius-md);overflow:hidden}.cli-session-terminal__header{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-xs) var(--space-sm);background:var(--surface);border-bottom:1px solid var(--border);flex-wrap:wrap}.cli-session-terminal__posture-wrap{position:relative}.cli-posture-chip{display:inline-flex;align-items:center;gap:var(--space-xs);padding:2px var(--space-sm);font-size:.75rem;line-height:1.4;color:var(--text);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer;transition:background var(--transition-fast, .12s) ease}.cli-posture-chip:hover{background:var(--card-hover)}.cli-posture-chip--elevated{color:var(--color-warning);border-color:var(--color-warning)}.cli-posture-chip__mode{color:var(--text-muted)}.cli-posture-chip__flag{font-weight:600}.cli-posture-tooltip{position:absolute;top:calc(100% + var(--space-xs));left:0;z-index:10;min-width:220px;padding:var(--space-sm);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md)}.cli-posture-tooltip__title{margin:0 0 var(--space-xs);font-size:.75rem;font-weight:600;color:var(--text)}.cli-posture-tooltip__list{margin:0;padding-left:var(--space-md);font-size:.75rem;color:var(--text-muted)}.cli-posture-tooltip__settings{display:inline-flex;align-items:center;gap:var(--space-xs);margin-top:var(--space-sm);padding:2px var(--space-sm);font-size:.75rem;color:var(--accent);background:transparent;border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer}.cli-session-terminal__readonly-badge,.cli-session-terminal__replay-badge{display:inline-flex;align-items:center;gap:var(--space-xs);padding:2px var(--space-sm);font-size:.7rem;color:var(--text-muted);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-sm)}.cli-session-terminal__replay-badge[data-replay-mode=ended]{color:var(--text-muted)}.cli-session-terminal__viewport{flex:1 1 auto;min-height:0;padding:var(--space-xs);background:var(--terminal-bg, var(--bg))}.cli-session-terminal__viewport,.cli-session-terminal__viewport *{-webkit-text-size-adjust:100%;text-size-adjust:100%}.cli-session-terminal__viewport .xterm-rows span{font-family:var(--terminal-glyph-font-family, inherit)!important}.cli-session-terminal__advance-strip{display:flex;align-items:center;justify-content:space-between;gap:var(--space-sm);padding:var(--space-sm);background:var(--surface);border-top:1px solid var(--border);flex-wrap:wrap}.cli-session-terminal__advance-copy{font-size:.8125rem;color:var(--text)}.cli-session-terminal__advance-actions{display:flex;gap:var(--space-xs)}.cli-session-terminal__advance-btn{padding:4px var(--space-md);font-size:.8125rem;color:var(--accent-text);background:var(--accent);border:1px solid transparent;border-radius:var(--radius-sm);cursor:pointer}.cli-session-terminal__advance-btn:disabled{opacity:.6;cursor:default}.cli-session-terminal__advance-btn--secondary{color:var(--text);background:var(--card);border-color:var(--border)}.cli-session-terminal__mobile-bar{position:sticky;bottom:0;z-index:5;display:flex;flex-direction:column;gap:var(--space-xs);padding:var(--space-xs) var(--space-sm) calc(var(--space-sm) + env(safe-area-inset-bottom,0px));background:var(--surface);border-top:1px solid var(--border)}.cli-session-terminal__mobile-bar--keyboard-open{position:fixed;left:0;right:0;padding-bottom:var(--space-sm)}.cli-session-terminal__key-row{display:flex;gap:var(--space-xs);overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}.cli-session-terminal__key-row::-webkit-scrollbar{display:none}.cli-terminal-key{flex:0 0 auto;min-width:40px;min-height:36px;padding:var(--space-xs) var(--space-sm);font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,monospace;font-size:.8125rem;color:var(--text);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer;touch-action:manipulation}.cli-terminal-key:active{background:var(--card-hover)}.cli-terminal-key--ctrl.cli-terminal-key--active{color:var(--accent-text);background:var(--accent);border-color:var(--accent)}.cli-terminal-key--ctrlc{color:var(--color-warning);border-color:var(--color-warning)}.cli-session-terminal__input-row{display:flex;gap:var(--space-xs)}.cli-session-terminal__mobile-input{flex:1 1 auto;min-width:0;min-height:38px;padding:var(--space-xs) var(--space-sm);font-size:16px;color:var(--text);background:var(--surface-1);border:1px solid var(--border);border-radius:var(--radius-sm)}.cli-session-terminal__mobile-input:focus{outline:none;border-color:var(--accent)}.cli-session-terminal__mobile-send{flex:0 0 auto;min-height:38px;padding:var(--space-xs) var(--space-md);font-size:.8125rem;color:var(--accent-text);background:var(--accent);border:1px solid transparent;border-radius:var(--radius-sm);cursor:pointer;touch-action:manipulation}@media(max-width:768px),(max-height:480px){.cli-session-terminal__viewport{-webkit-overflow-scrolling:touch}}