@runfusion/fusion 0.52.0 → 0.53.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.
- package/dist/bin.js +2918 -2185
- package/dist/client/.vite/manifest.json +248 -248
- package/dist/client/assets/AgentDetailView-CHSaiBNh.js +18 -0
- package/dist/client/assets/AgentPermissionPolicyEditor-Bfy55DIO.js +6 -0
- package/dist/client/assets/AgentPermissionPolicyEditor-TpdlOWZW.css +1 -0
- package/dist/client/assets/{AgentsView-DJJO0laF.js → AgentsView-CMB_7xly.js} +3 -3
- package/dist/client/assets/ChatView-IwWaNSeS.js +6 -0
- package/dist/client/assets/{CommandCenter-CKvo0MuO.js → CommandCenter-B84TXfg6.js} +2 -2
- package/dist/client/assets/{DevServerView-BHLG4Mxg.js → DevServerView-B9QEJETp.js} +1 -1
- package/dist/client/assets/{DirectoryPicker-CRY-rpnj.js → DirectoryPicker-BnaH1pb_.js} +1 -1
- package/dist/client/assets/{DocumentsView-DhC4dnXD.js → DocumentsView-Cvm4OBRl.js} +1 -1
- package/dist/client/assets/{EvalsView-DsnLOVZB.js → EvalsView-BpgA1nvW.js} +1 -1
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-B4iFX60E.js → ExperimentalAgentOnboardingModal-D4Z1IAW2.js} +1 -1
- package/dist/client/assets/{GoalsView-D5bzq6W9.js → GoalsView-ui2CM549.js} +1 -1
- package/dist/client/assets/{InsightsView-Drpu72M4.js → InsightsView-qdJ5GhE_.js} +1 -1
- package/dist/client/assets/{MemoryView-auLBP3UW.js → MemoryView-Csc-90G0.js} +1 -1
- package/dist/client/assets/{PiExtensionsManager-RlbkXf_t.js → PiExtensionsManager-Dbm3IpQW.js} +1 -1
- package/dist/client/assets/{PluginManager-BJMUacpG.js → PluginManager-B_zgRoI8.js} +1 -1
- package/dist/client/assets/{PullRequestView-344B9WF-.js → PullRequestView-CB6L4vJw.js} +1 -1
- package/dist/client/assets/{ResearchView-BNqt-f53.js → ResearchView-CRtoNtCn.js} +1 -1
- package/dist/client/assets/{SecretsView-Be8Tm8It.js → SecretsView-JB0lfuzZ.js} +1 -1
- package/dist/client/assets/SessionTerminal-CnxWsHxS.js +2 -0
- package/dist/client/assets/{SettingsModal-B28DuhaN.js → SettingsModal-CS1-kUSO.js} +1 -1
- package/dist/client/assets/SettingsModal-D7ArHi7z.js +21 -0
- package/dist/client/assets/{SetupWizardModal-y2j9aZoi.js → SetupWizardModal-PYaS5VB9.js} +2 -2
- package/dist/client/assets/ShadcnColorPicker-3OgfenMo.css +1 -0
- package/dist/client/assets/ShadcnColorPicker-Tl1Xu-G4.js +11 -0
- package/dist/client/assets/{SkillsView-HQp7UTdA.js → SkillsView-CWVVQ3y_.js} +1 -1
- package/dist/client/assets/{TodoView-DF7_qWGH.js → TodoView-CCloQhKG.js} +1 -1
- package/dist/client/assets/WorkflowNodeEditor-Dz8TU3is.js +8 -0
- package/dist/client/assets/{agentSkills-Cy_HrYHd.js → agentSkills-CFiw3LtX.js} +1 -1
- package/dist/client/assets/app-5S4z84u5.js +13 -0
- package/dist/client/assets/app-B1VYocx2.js +13 -0
- package/dist/client/assets/app-BhtYYxin.js +13 -0
- package/dist/client/assets/app-Cts0__Vx.js +13 -0
- package/dist/client/assets/app-DczBmsP4.js +13 -0
- package/dist/client/assets/app-_GFUqcMK.js +13 -0
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-4ur4sxlr.js → architectureDiagram-3BPJPVTR-DGp4hfr1.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-BgZeqq_q.js → blockDiagram-GPEHLZMM-CRyxRdCJ.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-BQtdOIrm.js → c4Diagram-AAUBKEIU-CFjMzS7o.js} +1 -1
- package/dist/client/assets/channel-C9LQN4ee.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-C1k1PBy1.js → chunk-2J33WTMH-BMvR_yYt.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-hNujwvSn.js → chunk-4BX2VUAB-BUPHOpQy.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-CnXV9LyI.js → chunk-55IACEB6-C1paNu5q.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-B-ocMdYN.js → chunk-727SXJPM-CG4hnjZD.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-CWNRUL6C.js → chunk-AQP2D5EJ-Dm2nZ5Sz.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-DerrCiYe.js → chunk-FMBD7UC4-CY6d36wo.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-BfcSPlX-.js → chunk-ND2GUHAM-cbKdnrGz.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-BaWScAds.js → chunk-QZHKN3VN-BPenWytO.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-C5TeEr7c.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-C5TeEr7c.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-n0Oeinz2.js → cose-bilkent-S5V4N54A-BCFGTolm.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-CUtehSt2.js → dagre-BM42HDAG-yVhB-t2h.js} +1 -1
- package/dist/client/assets/{dashboard-view-DWKCxtr5.js → dashboard-view-C9dPtr0u.js} +1 -1
- package/dist/client/assets/{dashboard-view-BW3GHqgb.js → dashboard-view-DHb5D1Hc.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-Bz4aOzhR.js → diagram-2AECGRRQ-DtV2x39G.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-UoxIMwPf.js → diagram-5GNKFQAL-DwwRRghJ.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-BYR7hloS.js → diagram-KO2AKTUF-JLrDx8k8.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-BR9MaP8U.js → diagram-LMA3HP47-C_AszN6R.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-BOfldYHv.js → diagram-OG6HWLK6-C-n05SOC.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-B8x9mfOs.js → erDiagram-TEJ5UH35-B-9edACX.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-DBnTroCV.js → flowDiagram-I6XJVG4X-D5ThlzTR.js} +1 -1
- package/dist/client/assets/{folder-open-CFze34Eq.js → folder-open-DLACu19m.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-BfzFy7iz.js → ganttDiagram-6RSMTGT7-DaqvxM8Q.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-CNTFu6IY.js → gitGraphDiagram-PVQCEYII-CfWhxq7Y.js} +1 -1
- package/dist/client/assets/index-D1IHwGhg.css +1 -0
- package/dist/client/assets/index-JlBzf2ck.js +1336 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-DJiBRaAl.js → infoDiagram-5YYISTIA-BjDZFy9D.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-CIY9t4cc.js → ishikawaDiagram-YF4QCWOH-BoMTizU1.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-HLMZmcjY.js → journeyDiagram-JHISSGLW-BozwtvCa.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-x9nKoxCI.js → kanban-definition-UN3LZRKU-CvrpmIXn.js} +1 -1
- package/dist/client/assets/{mermaid.core-pHkdB6fb.js → mermaid.core-KeGuTimD.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-Bs_4Tofu.js → mindmap-definition-RKZ34NQL-DMjY04EF.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-BGHz9JGZ.js → pieDiagram-4H26LBE5-r_9L-pQr.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-xHSR7cAR.js → quadrantDiagram-W4KKPZXB-CcZKANsw.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-D7YMNM44.js → requirementDiagram-4Y6WPE33-kqu_zuS5.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-OAXuab3Y.js → sankeyDiagram-5OEKKPKP-BLbamdKk.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-BZCjKFVL.js → sequenceDiagram-3UESZ5HK-DAKxqBlR.js} +1 -1
- package/dist/client/assets/{shield-alert-BBK8Risa.js → shield-alert-BdoEg9Yo.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-COnJQqA4.js → stateDiagram-AJRCARHV-RJ2xY2-p.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-Diml4Nhm.js → stateDiagram-v2-BHNVJYJU-BzhgwjfG.js} +1 -1
- package/dist/client/assets/{timeline-definition-PNZ67QCA-DHIKvV9L.js → timeline-definition-PNZ67QCA-CT9ZQc6n.js} +1 -1
- package/dist/client/assets/{upload-CqUJUdZW.js → upload-B4v89B2G.js} +1 -1
- package/dist/client/assets/{users-CAE-FEzI.js → users-vuVXnTg0.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-o9AxLDoL.js → vennDiagram-CIIHVFJN-DCcEEtaE.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-B7MIazje.js → wardley-L42UT6IY-_KOTjC_D.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-B6qUJx0N.js → wardleyDiagram-YWT4CUSO-D16g9VQZ.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-13mSXuCA.js → xychartDiagram-2RQKCTM6-CMIdike8.js} +1 -1
- package/dist/client/index.html +3 -3
- package/dist/client/theme-data.css +156 -0
- package/dist/client/version.json +1 -1
- package/dist/desktop/client/.vite/manifest.json +1650 -0
- package/dist/{client/assets/AgentDetailView-C-PM8cwG.js → desktop/client/assets/AgentDetailView-CVv4BoTE.js} +5 -5
- package/dist/desktop/client/assets/AgentDetailView-CgbB51Iw.css +1 -0
- package/dist/{client/assets/AgentPermissionPolicyEditor-DrVW4VPc.js → desktop/client/assets/AgentPermissionPolicyEditor-CQLNC_-O.js} +1 -1
- package/dist/desktop/client/assets/AgentsView-CzMa5Olf.css +1 -0
- package/dist/desktop/client/assets/AgentsView-DybRxzuI.js +29 -0
- package/dist/desktop/client/assets/ChatView-BtjkE0V7.css +1 -0
- package/dist/desktop/client/assets/ChatView-D_byETJX.js +19 -0
- package/dist/desktop/client/assets/CommandCenter-DDjpYkPe.css +1 -0
- package/dist/desktop/client/assets/CommandCenter-DEXoC2F7.js +71 -0
- package/dist/desktop/client/assets/DevServerView-CnEZI8Ax.js +1 -0
- package/dist/desktop/client/assets/DevServerView-iBondC7z.css +1 -0
- package/dist/desktop/client/assets/DirectoryPicker-0rspvcMz.css +1 -0
- package/dist/desktop/client/assets/DirectoryPicker-BUIZKLgl.js +1 -0
- package/dist/desktop/client/assets/DocumentsView-BFq47DE7.js +1 -0
- package/dist/desktop/client/assets/EvalsView-BEiGrFFa.js +1 -0
- package/dist/desktop/client/assets/EvalsView-CTbgPUne.css +1 -0
- package/dist/desktop/client/assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css +1 -0
- package/dist/desktop/client/assets/ExperimentalAgentOnboardingModal-WzGxsxku.js +1 -0
- package/dist/desktop/client/assets/GoalsView-C6Qsc-VS.js +2 -0
- package/dist/desktop/client/assets/GoalsView-CUh8JBnJ.css +1 -0
- package/dist/desktop/client/assets/InsightsView-C14VGuty.js +11 -0
- package/dist/desktop/client/assets/InsightsView-C7yRTMPn.css +1 -0
- package/dist/desktop/client/assets/MemoryView--XlaBNzQ.js +2 -0
- package/dist/desktop/client/assets/MemoryView-CBDUr2Jy.css +1 -0
- package/dist/desktop/client/assets/PiExtensionsManager-BaQnu6IY.js +11 -0
- package/dist/desktop/client/assets/PiExtensionsManager-kgTOHPE9.css +1 -0
- package/dist/desktop/client/assets/PluginManager-DSiHizRD.css +1 -0
- package/dist/desktop/client/assets/PluginManager-DqnMI_Zm.js +1 -0
- package/dist/desktop/client/assets/PullRequestView-C8kBQljB.js +6 -0
- package/dist/desktop/client/assets/PullRequestView-CpdE3Yo_.css +1 -0
- package/dist/desktop/client/assets/ResearchView-DIVNQF4_.css +1 -0
- package/dist/desktop/client/assets/ResearchView-OlGNDmqI.js +1 -0
- package/dist/desktop/client/assets/SecretsView-CvFioX7R.css +1 -0
- package/dist/desktop/client/assets/SecretsView-vHezddkt.js +1 -0
- package/dist/desktop/client/assets/SessionTerminal-CPbzm5Oi.css +1 -0
- package/dist/desktop/client/assets/SessionTerminal-ClbvT_Fb.js +2 -0
- package/dist/desktop/client/assets/SettingsModal-CL4GS1q-.js +21 -0
- package/dist/desktop/client/assets/SettingsModal-CvbiSIHS.css +1 -0
- package/dist/desktop/client/assets/SettingsModal-EWTm15Fk.js +1 -0
- package/dist/desktop/client/assets/SettingsModal-ino68pI2.css +1 -0
- package/dist/desktop/client/assets/SetupWizardModal-DsBTXY7k.js +2 -0
- package/dist/desktop/client/assets/ShadcnColorPicker-BciIe8Ls.js +11 -0
- package/dist/desktop/client/assets/ShadcnColorPicker-pqVWCC5-.css +1 -0
- package/dist/desktop/client/assets/SkillsView-CJ8snrma.css +1 -0
- package/dist/desktop/client/assets/SkillsView-UyhBA4_r.js +1 -0
- package/dist/desktop/client/assets/TodoView-CIsL_uvQ.css +1 -0
- package/dist/desktop/client/assets/TodoView-CV7ma8AL.js +6 -0
- package/dist/desktop/client/assets/WorkflowNodeEditor-BOouksjw.css +1 -0
- package/dist/desktop/client/assets/WorkflowNodeEditor-ThUL4msx.js +8 -0
- package/dist/desktop/client/assets/addon-fit-C1WQXRvu.js +1 -0
- package/dist/desktop/client/assets/addon-unicode11-BVmNDUBM.js +1 -0
- package/dist/desktop/client/assets/addon-web-links-CkVew5xs.js +1 -0
- package/dist/desktop/client/assets/addon-webgl-uLc0RKcC.js +58 -0
- package/dist/desktop/client/assets/agentSkills-BQzMaofj.js +1 -0
- package/dist/desktop/client/assets/agentSkills-bQJ4X1gH.css +1 -0
- package/dist/desktop/client/assets/agentsOrgChartLayout-BMvyuaLA.js +1 -0
- package/dist/desktop/client/assets/app-BJGkp7Tt.js +13 -0
- package/dist/desktop/client/assets/app-BKLUvvm8.js +13 -0
- package/dist/desktop/client/assets/app-BaoNC9zg.js +13 -0
- package/dist/desktop/client/assets/app-CZQ_fFNf.js +13 -0
- package/dist/{client/assets/app-nvVayIeU.js → desktop/client/assets/app-DAu3AzsS.js} +3 -3
- package/dist/desktop/client/assets/app-DgezOJub.js +13 -0
- package/dist/desktop/client/assets/arc-cxkkNsnK.js +1 -0
- package/dist/desktop/client/assets/architectureDiagram-3BPJPVTR-MtAzQYUn.js +36 -0
- package/dist/desktop/client/assets/band-CquvqAHh.js +1 -0
- package/dist/desktop/client/assets/blockDiagram-GPEHLZMM-zelYfqn3.js +132 -0
- package/dist/desktop/client/assets/c4Diagram-AAUBKEIU-D3hNx0Hv.js +10 -0
- package/dist/desktop/client/assets/channel-Dj1-27Yg.js +1 -0
- package/dist/desktop/client/assets/chunk-2J33WTMH-B9IKEZ0p.js +1 -0
- package/dist/desktop/client/assets/chunk-4BX2VUAB-Dd7FeAwm.js +1 -0
- package/dist/desktop/client/assets/chunk-55IACEB6-DbzB46sJ.js +1 -0
- package/dist/desktop/client/assets/chunk-727SXJPM-CDmlBZKV.js +206 -0
- package/dist/desktop/client/assets/chunk-AQP2D5EJ-whMl1uk-.js +231 -0
- package/dist/desktop/client/assets/chunk-FMBD7UC4-E1WzORFR.js +15 -0
- package/dist/desktop/client/assets/chunk-ND2GUHAM-e0FuVXk6.js +1 -0
- package/dist/desktop/client/assets/chunk-QZHKN3VN-B6q2GrbB.js +1 -0
- package/dist/desktop/client/assets/classDiagram-4FO5ZUOK-36LCOV5F.js +1 -0
- package/dist/desktop/client/assets/classDiagram-v2-Q7XG4LA2-36LCOV5F.js +1 -0
- package/dist/desktop/client/assets/common-BDp2y6CF.js +1 -0
- package/dist/desktop/client/assets/common-BnEo5fLN.js +1 -0
- package/dist/desktop/client/assets/common-Bzr_Y8h4.js +1 -0
- package/dist/desktop/client/assets/common-CvwyFzfv.js +1 -0
- package/dist/desktop/client/assets/common-CztCXRkz.js +1 -0
- package/dist/desktop/client/assets/common-DPe2mbb7.js +1 -0
- package/dist/desktop/client/assets/cose-bilkent-S5V4N54A-BjSZ5UKD.js +1 -0
- package/dist/desktop/client/assets/cytoscape.esm-OyMbaexL.js +331 -0
- package/dist/desktop/client/assets/dagre-BM42HDAG-DxMH6moD.js +4 -0
- package/dist/desktop/client/assets/dashboard-view-BW8tRppT.js +1 -0
- package/dist/desktop/client/assets/dashboard-view-CuUPQZzi.css +1 -0
- package/dist/desktop/client/assets/dashboard-view-D_zsA-kz.css +1 -0
- package/dist/desktop/client/assets/dashboard-view-L_H47lEp.js +8161 -0
- package/dist/desktop/client/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/desktop/client/assets/diagram-2AECGRRQ-DDUjym9F.js +43 -0
- package/dist/desktop/client/assets/diagram-5GNKFQAL-nEqF7CSb.js +10 -0
- package/dist/desktop/client/assets/diagram-KO2AKTUF-CFABtl0k.js +3 -0
- package/dist/desktop/client/assets/diagram-LMA3HP47-ButXw1gy.js +24 -0
- package/dist/desktop/client/assets/diagram-OG6HWLK6-CA17ZRZI.js +24 -0
- package/dist/desktop/client/assets/erDiagram-TEJ5UH35-DmROZaa0.js +85 -0
- package/dist/desktop/client/assets/errors-07IrmOYM.js +1 -0
- package/dist/desktop/client/assets/errors-BPsCufin.js +1 -0
- package/dist/desktop/client/assets/errors-CcVDgqlA.js +1 -0
- package/dist/desktop/client/assets/errors-D-i_Bxc6.js +1 -0
- package/dist/desktop/client/assets/errors-DDdWAK-U.js +1 -0
- package/dist/desktop/client/assets/errors-DOF5Td3F.js +1 -0
- package/dist/desktop/client/assets/flowDiagram-I6XJVG4X-BCa7HuJ3.js +162 -0
- package/dist/desktop/client/assets/folder-open-G_6UGFyI.js +6 -0
- package/dist/desktop/client/assets/ganttDiagram-6RSMTGT7-BeAYpPxh.js +292 -0
- package/dist/desktop/client/assets/gitGraphDiagram-PVQCEYII-BLwp2lCj.js +106 -0
- package/dist/desktop/client/assets/graph--OzhPTMs.js +1 -0
- package/dist/desktop/client/assets/index-CSVe-MIA.css +1 -0
- package/dist/desktop/client/assets/index-DIURDjTF.js +1301 -0
- package/dist/desktop/client/assets/infoDiagram-5YYISTIA-DF-q3NMx.js +2 -0
- package/dist/desktop/client/assets/init-Dmth1JHB.js +1 -0
- package/dist/desktop/client/assets/ishikawaDiagram-YF4QCWOH-CKYDbUiH.js +70 -0
- package/dist/desktop/client/assets/journeyDiagram-JHISSGLW-BgkdCr6Q.js +139 -0
- package/dist/desktop/client/assets/kanban-definition-UN3LZRKU-B9V97j0D.js +89 -0
- package/dist/desktop/client/assets/katex-HP8lGamR.js +257 -0
- package/dist/desktop/client/assets/layout-SsrduOYp.js +1 -0
- package/dist/desktop/client/assets/linear-dXivciGL.js +1 -0
- package/dist/desktop/client/assets/mermaid.core-BBN7poU5.js +309 -0
- package/dist/desktop/client/assets/mindmap-definition-RKZ34NQL-C2_Jhjnr.js +96 -0
- package/dist/desktop/client/assets/ordinal-DILIJJjt.js +1 -0
- package/dist/desktop/client/assets/pieDiagram-4H26LBE5-DOrO8u2b.js +30 -0
- package/dist/desktop/client/assets/projectDetection-G3XuxD2X.js +1 -0
- package/dist/desktop/client/assets/quadrantDiagram-W4KKPZXB-D4xxkMPR.js +7 -0
- package/dist/desktop/client/assets/requirementDiagram-4Y6WPE33-BuyUaAlW.js +84 -0
- package/dist/desktop/client/assets/sankeyDiagram-5OEKKPKP-DLGaZ5Gy.js +40 -0
- package/dist/desktop/client/assets/sequenceDiagram-3UESZ5HK-B3xhIZnf.js +162 -0
- package/dist/desktop/client/assets/shield-alert-D-Fxd0Va.js +6 -0
- package/dist/desktop/client/assets/stateDiagram-AJRCARHV-3C2cVTwx.js +1 -0
- package/dist/desktop/client/assets/stateDiagram-v2-BHNVJYJU-uyCHbCJn.js +1 -0
- package/dist/desktop/client/assets/step-yuy0qJer.js +1 -0
- package/dist/desktop/client/assets/time-DoDTxsna.js +1 -0
- package/dist/desktop/client/assets/timeline-definition-PNZ67QCA-DHzoutyf.js +120 -0
- package/dist/desktop/client/assets/upload-Cv9kGgTr.js +6 -0
- package/dist/desktop/client/assets/users-DuxdQK9U.js +6 -0
- package/dist/desktop/client/assets/vendor-codemirror-jBKmHyH0.js +27 -0
- package/dist/desktop/client/assets/vendor-i18n-GF3RlKbq.js +9 -0
- package/dist/desktop/client/assets/vendor-react-SZ_qB27O.js +49 -0
- package/dist/desktop/client/assets/vendor-reactflow-Bg-Qjzh8.js +15 -0
- package/dist/desktop/client/assets/vendor-reactflow-C5ap-Sga.css +1 -0
- package/dist/desktop/client/assets/vendor-xterm-BNq00GSj.js +9 -0
- package/dist/desktop/client/assets/vendor-xterm-LZoznX6r.css +32 -0
- package/dist/desktop/client/assets/vennDiagram-CIIHVFJN-CKB5IBNU.js +34 -0
- package/dist/desktop/client/assets/wardley-L42UT6IY-DUw_nnW7.js +173 -0
- package/dist/desktop/client/assets/wardleyDiagram-YWT4CUSO-CgWLugtp.js +78 -0
- package/dist/desktop/client/assets/xychartDiagram-2RQKCTM6-BWpeCtlX.js +7 -0
- package/dist/desktop/client/assets/zoom-out-NWbVkreR.js +41 -0
- package/dist/desktop/client/brands/hermes-logo.svg +1 -0
- package/dist/desktop/client/fonts/SymbolsNerdFontMono-Regular.ttf +0 -0
- package/dist/desktop/client/icons/icon-192.png +0 -0
- package/dist/desktop/client/icons/icon-512.png +0 -0
- package/dist/desktop/client/index.html +244 -0
- package/dist/desktop/client/logo.svg +6 -0
- package/dist/desktop/client/manifest.json +23 -0
- package/dist/desktop/client/sw.js +175 -0
- package/dist/desktop/client/theme-data.css +6858 -0
- package/dist/desktop/client/version.json +1 -0
- package/dist/desktop/main.js +17159 -0
- package/dist/desktop/main.js.map +7 -0
- package/dist/desktop/preload.js +110 -0
- package/dist/desktop/preload.js.map +7 -0
- package/dist/droid-cli/package.json +1 -1
- package/dist/extension.js +1569 -1295
- package/dist/pi-claude-cli/index.ts +40 -8
- package/dist/pi-claude-cli/package.json +5 -3
- package/dist/pi-claude-cli/src/__tests__/process-manager.test.ts +2 -2
- package/dist/pi-claude-cli/src/__tests__/provider.test.ts +39 -23
- package/dist/plugin-sdk/index.d.ts +9 -2
- package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
- package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +15 -3
- package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
- package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
- package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-reports/package.json +1 -1
- package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
- package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
- package/package.json +4 -3
- package/dist/client/assets/ChatView-C7uTm5hO.js +0 -16
- package/dist/client/assets/SessionTerminal-CumHUelZ.js +0 -2
- package/dist/client/assets/SettingsModal-AJfer-ve.js +0 -21
- package/dist/client/assets/ShadcnColorPicker-Cc72uPKJ.js +0 -11
- package/dist/client/assets/ShadcnColorPicker-CyeAnJUU.css +0 -1
- package/dist/client/assets/WorkflowNodeEditor-BjpqTIYE.js +0 -8
- package/dist/client/assets/app-CGubyqAW.js +0 -13
- package/dist/client/assets/app-CrQpHbIs.js +0 -13
- package/dist/client/assets/app-DboK-0Ty.js +0 -13
- package/dist/client/assets/app-DjnYET2y.js +0 -13
- package/dist/client/assets/app-MacS555z.js +0 -13
- package/dist/client/assets/channel-Dn5XowfJ.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-zSOW-KNk.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-zSOW-KNk.js +0 -1
- package/dist/client/assets/index-QnHUwSjw.css +0 -1
- package/dist/client/assets/index-Y-vyXPPN.js +0 -1331
- /package/dist/{client → desktop/client}/assets/AgentPermissionPolicyEditor-CGxjOr6G.css +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r,j as e}from"./vendor-react-SZ_qB27O.js";import{u as Re}from"./SettingsModal-
|
|
1
|
+
import{r,j as e}from"./vendor-react-SZ_qB27O.js";import{u as Re}from"./SettingsModal-CS1-kUSO.js";import{aS as Me,aT as we,aU as qe,aV as Te,aW as Pe,aX as We,aY as He,aZ as Ae,a_ as Fe,a$ as _e,b0 as Ue,b1 as Oe,b2 as De,b3 as Qe,aR as $e,b4 as Be,V as Ve,b5 as Ye,L as F,b6 as ze}from"./index-JlBzf2ck.js";import{u as Ge}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";const B=".fusion/memory/MEMORY.md",Ze=5e4,Xe="0 3 * * *",Ke="0 4 * * *";function ge(i){return{memoryEnabled:i.memoryEnabled!==!1,memoryAutoSummarizeEnabled:i.memoryAutoSummarizeEnabled??!1,memoryAutoSummarizeThresholdChars:i.memoryAutoSummarizeThresholdChars??Ze,memoryAutoSummarizeSchedule:i.memoryAutoSummarizeSchedule??Xe,memoryDreamsEnabled:i.memoryDreamsEnabled??!1,memoryDreamsSchedule:i.memoryDreamsSchedule??Ke}}function Le(i,t){return i.some(h=>h.path===t)?t:i.find(h=>h.path===B)?.path??i[0]?.path??B}function Je(i={}){const{projectId:t}=i,[h,s]=r.useState(""),[u,S]=r.useState(!0),[k,I]=r.useState(!1),[D,j]=r.useState(!1),[p,E]=r.useState(null),[n,M]=r.useState(!0),[V,_]=r.useState(!1),[re,U]=r.useState(()=>ge({})),[w,Y]=r.useState(!0),[z,me]=r.useState(!1),[be,O]=r.useState([]),[d,x]=r.useState(!0),[f,A]=r.useState(B),[o,v]=r.useState(""),[ne,R]=r.useState(!1),[c,N]=r.useState(!1),[pe,G]=r.useState(!1),[ie,Z]=r.useState(!1),[le,X]=r.useState(!1),[K,Q]=r.useState(null),[L,$]=r.useState(!0),[xe,q]=r.useState(!1),[fe,J]=r.useState(!1),[oe,ee]=r.useState(null),{status:ce,loading:de,refresh:se}=Re({projectId:t}),te=r.useCallback(m=>{v(m),N(!0)},[]),g=r.useCallback(async m=>{R(!0);try{const{content:l}=await Me(m,t);A(m),v(l),N(!1)}finally{R(!1)}},[t]),T=r.useCallback(async()=>{x(!0);try{const{files:m}=await we(t);if(O(m),m.length===0){A(B),v(""),N(!1);return}const l=Le(m,f);l!==f&&await g(l)}finally{x(!1)}},[t,f,g]);r.useEffect(()=>{let m=!1;async function l(){try{const y=await Qe(t);m||(s(y.content),S(!1))}catch{m||(s(""),S(!1))}}return l(),()=>{m=!0}},[t]),r.useEffect(()=>{let m=!1;async function l(){try{const y=await Fe(t);m||(E(y.content),_(y.exists),M(!1))}catch{m||(E(null),_(!1),M(!1))}}return l(),()=>{m=!0}},[t]),r.useEffect(()=>{let m=!1;async function l(){Y(!0);try{const y=await $e(t);m||U(ge(y))}catch{m||U(ge({}))}finally{m||Y(!1)}}return l(),()=>{m=!0}},[t]),r.useEffect(()=>{let m=!1;async function l(){x(!0);try{const{files:y}=await we(t);if(m)return;if(O(y),y.length===0){A(B),v(""),N(!1);return}const H=Le(y,f),{content:a}=await Me(H,t);if(m)return;A(H),v(a),N(!1)}catch{m||(O([]),A(B),v(""),N(!1))}finally{m||x(!1)}}return l(),()=>{m=!0}},[t,f]),r.useEffect(()=>{let m=!1;async function l(){try{const y=await Ae(t);m||(Q(y),$(!1))}catch{m||(Q(null),$(!1))}}return l(),()=>{m=!0}},[t]),r.useEffect(()=>{let m=!1;async function l(){try{const y=await Be(t);m||ee(y)}catch{m||ee(null)}}return l(),()=>{m=!0}},[t]);const P=r.useCallback(m=>{s(m),I(!0)},[]),Se=r.useCallback(async()=>{if(k){j(!0);try{await qe(h,t),I(!1)}finally{j(!1)}}},[h,k,t]),ye=r.useCallback(async m=>{me(!0);try{const l=await Te(m,t);U(ge(l))}finally{me(!1)}},[t]),he=r.useCallback(async m=>{await g(m)},[g]),je=r.useCallback(async()=>{if(c){G(!0);try{await Pe(f,o,t),N(!1),await T()}finally{G(!1)}}},[o,c,f,t,T]),ve=r.useCallback(async()=>{J(!0);try{const m=await We(t);return await se(),m}finally{J(!1)}},[t,se]),Ne=r.useCallback(async m=>He(m,t),[t]),ae=r.useCallback(async()=>{try{const m=await Ae(t);Q(m)}catch{Q(null)}},[t]),W=r.useCallback(async()=>{try{const m=await Fe(t);E(m.content),_(m.exists)}catch{E(null),_(!1)}},[t]),Ce=r.useCallback(async m=>{await _e(m,t),await W()},[t,W]),ke=r.useCallback(async()=>{Z(!0);try{const m=await Ue(t);return await Promise.all([W(),ae()]),{success:m.success,summary:m.summary}}finally{Z(!1)}},[t,W,ae]),ue=r.useCallback(async()=>{X(!0);try{return await Oe(t)}finally{X(!1)}},[t]),Ee=r.useCallback(async m=>{q(!0);try{const l=m?await De(m,t):await De(t);if(m){const y=l.path??m;A(y),v(l.content),N(!1),await T();return}s(l.content),I(!0)}finally{q(!1)}},[t,T]);return{workingMemory:h,workingMemoryLoading:u,workingMemoryDirty:k,setWorkingMemory:P,saveWorkingMemory:Se,savingWorkingMemory:D,insightsContent:p,insightsLoading:n,insightsExists:V,refreshInsights:W,saveInsights:Ce,memorySettings:re,settingsLoading:w,savingMemorySettings:z,saveMemorySettings:ye,memoryFiles:be,memoryFilesLoading:d,selectedFilePath:f,selectedFileContent:o,selectedFileLoading:ne,selectedFileDirty:c,setSelectedFileContent:te,selectFile:he,saveSelectedFile:je,savingSelectedFile:pe,reloadMemoryFiles:T,backendStatus:ce,backendLoading:de,extractInsights:ke,extracting:ie,triggerDreamNow:ue,dreamRunning:le,auditReport:K,auditLoading:L,refreshAudit:ae,compactMemory:Ee,compacting:xe,installQmdAction:ve,installingQmd:fe,testRetrieval:Ne,stats:oe}}const es={Patterns:"pattern",Principles:"principle",Conventions:"convention",Pitfalls:"pitfall",Context:"context"},ss=72;function ts(i,t){if(i.length<=t)return i;const h=Math.max(1,t-1),s=Math.ceil(h/2),u=Math.floor(h/2);return`${i.slice(0,s)}…${i.slice(i.length-u)}`}function as(i){const t=`${i.label} — ${i.path}`;return ts(t,ss)}function rs(i){if(!i)return[];const t=[],h=i.split(/(?=^## )/m);for(const s of h){const u=s.trim();if(!u)continue;const S=u.match(/^##\s+(.+?)(\n|$)/);if(S){const k=S[1].trim(),I=es[k]??k.toLowerCase(),D=u.slice(S[0].length).trim(),j=D.split(`
|
|
2
2
|
`).map(p=>p.replace(/^-\s+/,"").trim()).filter(p=>p.length>0&&(p.startsWith("- ")||p.startsWith("* ")));(j.length>0||D.length>0)&&t.push({name:k,key:I,items:j.length>0?j:D.length>0?[D]:[],expanded:!0})}}return t}function ms(i){if(!i)return null;const t=i.match(/##\s+Last\s+Updated:\s*(\d{4}-\d{2}-\d{2})/i);return t?t[1]:null}function ns(i){return i.reduce((t,h)=>t+h.items.length,0)}function us({projectId:i,addToast:t,onSendSelectionToTask:h}){const{t:s}=Ge("app"),[u,S]=r.useState("working"),[k,I]=r.useState(new Set),[D,j]=r.useState(!1),[p,E]=r.useState(null),[n,M]=r.useState({memoryEnabled:!0,memoryAutoSummarizeEnabled:!1,memoryAutoSummarizeThresholdChars:5e4,memoryAutoSummarizeSchedule:"0 3 * * *",memoryDreamsEnabled:!1,memoryDreamsSchedule:"0 4 * * *"}),[V,_]=r.useState(""),[re,U]=r.useState(!1),[w,Y]=r.useState(null),{insightsContent:z,insightsLoading:me,insightsExists:be,saveInsights:O,memorySettings:d,settingsLoading:x,saveMemorySettings:f,savingMemorySettings:A,backendStatus:o,backendLoading:v,extractInsights:ne,extracting:R,auditReport:c,auditLoading:N,refreshAudit:pe,compactMemory:G,compacting:ie,installQmdAction:Z,installingQmd:le,testRetrieval:X,memoryFiles:K,memoryFilesLoading:Q,selectedFilePath:L,selectedFileContent:$,selectedFileLoading:xe,selectedFileDirty:q,setSelectedFileContent:fe,selectFile:J,saveSelectedFile:oe,savingSelectedFile:ee,reloadMemoryFiles:ce,triggerDreamNow:de,dreamRunning:se}=Je({projectId:i});r.useEffect(()=>{M(d)},[d]);const te=r.useMemo(()=>n.memoryEnabled!==d.memoryEnabled||n.memoryAutoSummarizeEnabled!==d.memoryAutoSummarizeEnabled||n.memoryAutoSummarizeThresholdChars!==d.memoryAutoSummarizeThresholdChars||n.memoryAutoSummarizeSchedule!==d.memoryAutoSummarizeSchedule||n.memoryDreamsEnabled!==d.memoryDreamsEnabled||n.memoryDreamsSchedule!==d.memoryDreamsSchedule,[n,d]),g=r.useMemo(()=>K.find(a=>a.path===L),[K,L]),T=g?g.layer==="long-term"?s("memory.layerDescLongTerm","Curated durable decisions, conventions, constraints, and pitfalls promoted from dreams."):g.layer==="daily"?s("memory.layerDescDaily","Raw daily observations, open loops, and running context for dream processing."):s("memory.layerDescDreams","Synthesized patterns and open loops promoted from daily memory."):s("memory.editorDefaultDescription","Edits the selected memory file."),P=r.useMemo(()=>rs(z),[z]),Se=r.useMemo(()=>ns(P),[P]),ye=r.useMemo(()=>ms(z),[z]),he=r.useCallback(a=>{I(b=>{const C=new Set(b);return C.has(a)?C.delete(a):C.add(a),C})},[]),je=r.useCallback(async a=>{try{await J(a)}catch{t(s("memory.loadFileFailed","Failed to load memory file"),"error")}},[J,t]),ve=r.useCallback(async()=>{try{await oe(),t(s("memory.memorySaved","Memory saved"),"success")}catch{t(s("memory.saveMemoryFailed","Failed to save memory"),"error")}},[oe,t]),Ne=r.useCallback(async()=>{if(!te)return;const a={};n.memoryEnabled!==d.memoryEnabled&&(a.memoryEnabled=n.memoryEnabled),n.memoryAutoSummarizeEnabled!==d.memoryAutoSummarizeEnabled&&(a.memoryAutoSummarizeEnabled=n.memoryAutoSummarizeEnabled),n.memoryAutoSummarizeThresholdChars!==d.memoryAutoSummarizeThresholdChars&&(a.memoryAutoSummarizeThresholdChars=n.memoryAutoSummarizeThresholdChars),n.memoryAutoSummarizeSchedule!==d.memoryAutoSummarizeSchedule&&(a.memoryAutoSummarizeSchedule=n.memoryAutoSummarizeSchedule),n.memoryDreamsEnabled!==d.memoryDreamsEnabled&&(a.memoryDreamsEnabled=n.memoryDreamsEnabled),n.memoryDreamsSchedule!==d.memoryDreamsSchedule&&(a.memoryDreamsSchedule=n.memoryDreamsSchedule);try{await f(a),t(s("memory.settingsSaved","Memory settings saved"),"success")}catch{t(s("memory.saveSettingsFailed","Failed to save memory settings"),"error")}},[te,n,d,f,t]),ae=r.useCallback(async()=>{try{const a=await Z();t(a.qmdAvailable?s("memory.qmdInstallSuccess","qmd installed successfully"):s("memory.qmdInstallUnavailable","qmd install finished, but qmd is still unavailable"),a.qmdAvailable?"success":"info")}catch{t(s("memory.installQmdFailed","Failed to install qmd"),"error")}},[Z,t]),W=r.useCallback(async()=>{U(!0),Y(null);try{const a=await X(V);Y(a),t(a.qmdAvailable?s("memory.retrievalTestComplete","Memory retrieval test complete"):s("memory.retrievalTestFallback","qmd is not installed; local fallback was used"),a.qmdAvailable?"success":"info")}catch{t(s("memory.retrievalTestFailed","Failed to test memory retrieval"),"error")}finally{U(!1)}},[V,X,t]),Ce=r.useCallback(async()=>{try{await de(),t(s("memory.dreamProcessingComplete","Dream processing completed"),"success"),await ce()}catch(a){t(a instanceof Error?a.message:s("memory.dreamProcessingFailed","Failed to run dream processing"),"error")}},[de,ce,t]),ke=r.useCallback(async()=>{try{await G(L),t(s("memory.fileCompacted","Memory file compacted"),"success")}catch{t(s("memory.compactFailed","Failed to compact memory"),"error")}},[G,L,t]),ue=r.useCallback(async()=>{try{const a=await ne();t(a.summary,"success")}catch(a){t(a instanceof Error?a.message:s("memory.extractInsightsFailed","Failed to extract insights"),"error")}},[ne,t]),Ee=r.useCallback(async()=>{if(p!==null)try{await O(p),j(!1),E(null),t(s("memory.insightsSaved","Insights saved"),"success")}catch{t(s("memory.saveInsightsFailed","Failed to save insights"),"error")}},[p,O,t]),m=r.useCallback(()=>{E(z??""),j(!0)},[z]),l=r.useCallback(()=>{j(!1),E(null)},[]),y=!v&&o!==null,H=o?.capabilities?.writable??!1;return e.jsxs("div",{className:"memory-view",children:[e.jsx(Ve,{icon:Ye,title:s("memory.title","Memory")}),e.jsxs("div",{className:"memory-view-tabs",role:"tablist",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":u==="working",className:`memory-view-tab${u==="working"?" memory-view-tab--active":""}`,onClick:()=>S("working"),"data-testid":"memory-tab-working",children:s("memory.tabWorking","Working Memory")}),e.jsx("button",{type:"button",role:"tab","aria-selected":u==="insights",className:`memory-view-tab${u==="insights"?" memory-view-tab--active":""}`,onClick:()=>S("insights"),"data-testid":"memory-tab-insights",children:s("memory.tabInsights","Insights")}),e.jsx("button",{type:"button",role:"tab","aria-selected":u==="engines",className:`memory-view-tab${u==="engines"?" memory-view-tab--active":""}`,onClick:()=>S("engines"),"data-testid":"memory-tab-engines",children:s("memory.tabEngines","Engines")})]}),e.jsxs("div",{className:"memory-view-content",children:[u==="working"&&e.jsxs("div",{className:"memory-working-tab",children:[y&&!H&&e.jsx("div",{className:"memory-readonly-banner",children:s("memory.readOnlyBanner","This memory backend is read-only. Changes cannot be saved.")}),Q||xe?e.jsxs("div",{className:"memory-empty-state",children:[e.jsx(F,{size:20,className:"animate-spin"}),e.jsx("span",{children:s("memory.loadingFile","Loading memory file…")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"memory-editor-section",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryViewFilePath",children:s("memory.fileLabel","Memory File")}),e.jsx("select",{id:"memoryViewFilePath",className:"select",value:L,onChange:a=>{je(a.target.value)},disabled:q,children:K.map(a=>e.jsx("option",{value:a.path,title:`${a.label} — ${a.path}`,children:as(a)},a.path))}),e.jsx("small",{children:q?s("memory.fileSwitchDirtyHint","Save or discard the current edits before switching files."):s("memory.fileSwitchHint","Choose any project memory file to view or edit.")})]}),g&&e.jsxs("div",{className:"memory-file-summary",children:[e.jsx("span",{children:g.layer==="long-term"?s("memory.layerLongTerm","Long-term"):g.layer==="daily"?s("memory.layerDaily","Daily"):s("memory.layerDreams","Dreams")}),e.jsx("strong",{children:g.path}),e.jsx("small",{children:s("memory.fileSummary","{{size}} bytes · updated {{updatedAt}}",{size:g.size.toLocaleString(),updatedAt:new Date(g.updatedAt).toLocaleString()})})]}),e.jsxs("div",{className:"form-group memory-editor-form-group",children:[e.jsx("label",{children:g?.label||s("memory.editorLabel","Memory Editor")}),e.jsx("small",{children:T}),e.jsx("div",{className:"memory-editor-container",children:e.jsx(ze,{content:$,onChange:fe,readOnly:!H,filePath:L,onSendSelectionToTask:h})})]})]}),e.jsxs("div",{className:"memory-action-bar",children:[e.jsx("span",{className:"memory-char-count",children:s("memory.charCount","{{count}} characters",{count:$.length})}),e.jsx("div",{className:"memory-flex-spacer"}),H&&$.length>0&&e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:ke,disabled:ie||q,children:ie?e.jsxs(e.Fragment,{children:[e.jsx(F,{size:14,className:"animate-spin"}),s("memory.compacting","Compacting…")]}):s("memory.compactSelectedFile","Compact Selected File")}),q&&H&&e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:ve,disabled:ee,children:ee?e.jsxs(e.Fragment,{children:[e.jsx(F,{size:14,className:"animate-spin"}),s("memory.saving","Saving…")]}):s("memory.save","Save")})]}),e.jsxs("div",{className:"memory-config-section",children:[e.jsxs("div",{className:"memory-settings-group",children:[e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"memoryDreamsEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"memoryDreamsEnabled",type:"checkbox",checked:n.memoryDreamsEnabled,onChange:a=>{M(b=>({...b,memoryDreamsEnabled:a.target.checked}))},disabled:!n.memoryEnabled||x}),s("memory.dreamsEnabledLabel","Process dreams from daily memory")]}),e.jsx("small",{children:s("memory.dreamsEnabledHint","Turns daily notes into DREAMS.md and promotes reusable lessons into MEMORY.md.")})]}),n.memoryEnabled&&n.memoryDreamsEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryDreamsSchedule",children:s("memory.dreamsScheduleLabel","Dream Schedule")}),e.jsx("input",{id:"memoryDreamsSchedule",type:"text",className:"input",value:n.memoryDreamsSchedule,onChange:a=>{M(b=>({...b,memoryDreamsSchedule:a.target.value}))},placeholder:"0 4 * * *",disabled:x}),e.jsx("small",{children:s("memory.dreamsScheduleHint","Cron expression for dream processing.")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:Ce,disabled:se||!n.memoryDreamsEnabled,children:se?e.jsxs(e.Fragment,{children:[e.jsx(F,{size:14,className:"animate-spin"}),s("memory.dreaming","Dreaming…")]}):s("memory.dreamNow","Dream Now")}),e.jsx("small",{children:s("memory.dreamNowHint","Manually trigger dream processing now.")})]})]})]}),e.jsxs("div",{className:"memory-settings-group",children:[e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"memoryAutoSummarizeEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"memoryAutoSummarizeEnabled",type:"checkbox",checked:n.memoryAutoSummarizeEnabled,onChange:a=>{M(b=>({...b,memoryAutoSummarizeEnabled:a.target.checked}))},disabled:!n.memoryEnabled||x}),s("memory.autoSummarizeLabel","Auto-Summarize Memory")]}),e.jsx("small",{children:s("memory.autoSummarizeHint","Automatically compact memory when it exceeds the threshold on a schedule")})]}),n.memoryEnabled&&n.memoryAutoSummarizeEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryAutoSummarizeThresholdChars",children:s("memory.compactionThresholdLabel","Compaction Threshold (chars)")}),e.jsx("input",{id:"memoryAutoSummarizeThresholdChars",type:"number",className:"input",value:n.memoryAutoSummarizeThresholdChars,onChange:a=>{M(b=>({...b,memoryAutoSummarizeThresholdChars:parseInt(a.target.value,10)||5e4}))},min:1e3,disabled:x}),e.jsx("small",{children:s("memory.compactionThresholdHint","Memory will be compacted when it exceeds this character count")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryAutoSummarizeSchedule",children:s("memory.autoSummarizeScheduleLabel","Schedule (cron)")}),e.jsx("input",{id:"memoryAutoSummarizeSchedule",type:"text",className:"input",value:n.memoryAutoSummarizeSchedule,onChange:a=>{M(b=>({...b,memoryAutoSummarizeSchedule:a.target.value}))},placeholder:"0 3 * * *",disabled:x}),e.jsx("small",{children:s("memory.autoSummarizeScheduleHint","Cron expression for auto-summarize schedule (default: daily at 3 AM)")})]})]})]}),!n.memoryEnabled&&e.jsx("div",{className:"settings-empty-state memory-status-message",children:s("memory.disabledMessage","Memory is currently disabled. Enable memory tools in Settings to edit these automations.")}),te&&e.jsx("div",{className:"memory-action-bar",children:e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:Ne,disabled:A||x,children:A?e.jsxs(e.Fragment,{children:[e.jsx(F,{size:14,className:"animate-spin"}),s("memory.saving","Saving…")]}):s("memory.saveSettings","Save Settings")})})]})]})]}),u==="insights"&&e.jsx("div",{className:"memory-insights-tab",children:me?e.jsxs("div",{className:"memory-empty-state",children:[e.jsx(F,{size:20,className:"animate-spin"}),e.jsx("span",{children:s("memory.loadingInsights","Loading insights…")})]}):D?e.jsxs("div",{className:"memory-insights-editor-layout",children:[e.jsx("div",{className:"memory-editor-container",children:e.jsx(ze,{content:p??"",onChange:E,readOnly:!1,filePath:".fusion/memory/INSIGHTS.md",onSendSelectionToTask:h})}),e.jsxs("div",{className:"memory-action-bar",children:[e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:l,children:s("memory.cancel","Cancel")}),e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:Ee,children:s("memory.saveInsights","Save Insights")})]})]}):!be||P.length===0?e.jsxs("div",{className:"memory-empty-state",children:[e.jsx("p",{children:s("memory.noInsights","No insights extracted yet.")}),e.jsx("p",{children:s("memory.noInsightsHint",'Insights are automatically extracted from working memory. Click "Extract Now" to trigger extraction manually.')}),e.jsx("button",{type:"button",className:"btn btn-primary btn-sm memory-empty-extract-button",onClick:ue,disabled:R,children:R?e.jsxs(e.Fragment,{children:[e.jsx(F,{size:14,className:"animate-spin"}),s("memory.extracting","Extracting…")]}):s("memory.extractNow","Extract Now")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"memory-stats-row",children:[e.jsxs("div",{className:"memory-stat-card",children:[e.jsx("div",{className:"memory-stat-value",children:Se}),e.jsx("div",{className:"memory-stat-label",children:s("memory.totalInsights","Total Insights")})]}),e.jsxs("div",{className:"memory-stat-card",children:[e.jsx("div",{className:"memory-stat-value",children:P.length}),e.jsx("div",{className:"memory-stat-label",children:s("memory.categories","Categories")})]}),ye&&e.jsxs("div",{className:"memory-stat-card",children:[e.jsx("div",{className:"memory-stat-value memory-stat-value--updated",children:ye}),e.jsx("div",{className:"memory-stat-label",children:s("memory.lastUpdated","Last Updated")})]})]}),e.jsxs("div",{className:"memory-action-bar",children:[e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:ue,disabled:R,children:R?e.jsxs(e.Fragment,{children:[e.jsx(F,{size:14,className:"animate-spin"}),s("memory.extracting","Extracting…")]}):s("memory.extractNow","Extract Now")}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:m,children:s("memory.editRaw","Edit Raw")})]}),e.jsx("div",{className:"memory-categories-list",children:P.map(a=>{const b=!k.has(a.key);return e.jsxs("div",{className:"memory-category-section",children:[e.jsxs("div",{className:"memory-category-header",onClick:()=>he(a.key),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),he(a.key))},children:[e.jsx("h4",{children:a.name}),e.jsx("span",{className:"memory-category-count",children:a.items.length})]}),b&&e.jsx("div",{className:"memory-category-items",children:a.items.map((C,Ie)=>e.jsx("div",{className:"memory-insight-item",children:C.replace(/^-\s+/,"").replace(/^\*\s+/,"")},Ie))})]},a.key)})})]})}),u==="engines"&&e.jsx("div",{className:"memory-engines-tab",children:v||N?e.jsxs("div",{className:"memory-empty-state",children:[e.jsx(F,{size:20,className:"animate-spin"}),e.jsx("span",{children:s("memory.loadingEngineStatus","Loading engine status…")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"memory-engine-card memory-qmd-card",children:[e.jsx("h3",{children:s("memory.qmdIntegrationTitle","QMD Integration")}),o?.qmdAvailable===!0?e.jsxs("div",{className:"memory-engine-status",children:[e.jsx("span",{className:"memory-health-badge memory-health-badge--healthy",children:s("memory.qmdInstalled","Installed")}),e.jsx("span",{className:"memory-char-count",children:s("memory.qmdAvailableOnPath","qmd is available on PATH.")})]}):o?.qmdAvailable===!1?e.jsxs("div",{className:"settings-empty-state memory-status-message",children:[e.jsxs("span",{children:[s("memory.qmdNotInstalled","qmd is not installed. Search will use local files. Install indexed retrieval:")," ",e.jsx("code",{children:o.qmdInstallCommand||"bun install -g @tobilu/qmd"})]}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:ae,disabled:le,children:le?s("memory.installing","Installing…"):s("memory.installQmd","Install qmd")})]}):e.jsxs("div",{className:"memory-engine-status",children:[e.jsx("span",{className:"memory-health-badge",children:s("memory.qmdChecking","Checking")}),e.jsx("span",{className:"memory-char-count",children:s("memory.qmdCheckingAvailability","Checking qmd availability…")})]}),e.jsxs("div",{className:"memory-capability-row",children:[o?.capabilities?.readable&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capReadable","Readable")}),o?.capabilities?.writable&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capWritable","Writable")}),o?.capabilities?.supportsAtomicWrite&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capAtomicWrites","Atomic Writes")}),o?.capabilities?.persistent&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capPersistent","Persistent")})]})]}),e.jsxs("div",{className:"memory-engine-card memory-retrieval-card",children:[e.jsx("h3",{children:s("memory.testMemorySearchTitle","Test Memory Search")}),e.jsxs("div",{className:"memory-retrieval-input-row",children:[e.jsx("input",{type:"text",className:"input",value:V,onChange:a=>_(a.target.value),placeholder:s("memory.searchPlaceholder","Search memory with qmd")}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:W,disabled:re,children:re?s("memory.testing","Testing…"):s("memory.testRetrieval","Test Retrieval")})]}),e.jsx("small",{className:"settings-muted",children:s("memory.testSearchHint","Runs the same qmd-backed memory_search path agents use.")}),w&&e.jsxs("div",{className:"memory-test-result",children:[e.jsx("strong",{children:s("memory.testResultCount",'{{count}} result for "{{query}}"',{count:w.results.length,query:w.query,defaultValue_one:'{{count}} result for "{{query}}"',defaultValue_other:'{{count}} results for "{{query}}"'})}),e.jsx("small",{children:s("memory.testResultStatus","qmd {{qmdStatus}} · {{fallbackStatus}}",{qmdStatus:w.qmdAvailable?s("memory.qmdStatusAvailable","available"):s("memory.qmdStatusMissing","missing"),fallbackStatus:w.usedFallback?s("memory.localFallbackUsed","local fallback used"):s("memory.qmdPathUsed","qmd path used")})}),w.results.length>0?e.jsx("ul",{children:w.results.map((a,b)=>e.jsxs("li",{children:[e.jsxs("span",{children:[a.path,":",a.lineStart]}),e.jsx("p",{children:a.snippet})]},`${a.path}-${a.lineStart}-${b}`))}):e.jsx("small",{children:s("memory.noMatchingMemory","No matching memory found.")})]})]}),e.jsxs("div",{className:"memory-engine-card",children:[e.jsx("h3",{children:s("memory.currentBackendTitle","Current Backend")}),e.jsx("div",{className:"memory-engine-status",children:e.jsx("span",{className:"memory-emphasis-text",children:o?.currentBackend==="file"?s("memory.backendFile","File (.fusion/memory/, agent/<agent-name>/memory/)"):o?.currentBackend==="readonly"?s("memory.backendReadonly","Read-Only"):o?.currentBackend==="qmd"?s("memory.backendQmd","QMD (Quantized Memory Distillation)"):o?.currentBackend??"unknown"})}),e.jsxs("div",{className:"memory-capability-row",children:[o?.capabilities?.readable&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capReadable","Readable")}),o?.capabilities?.writable&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capWritable","Writable")}),o?.capabilities?.supportsAtomicWrite&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capAtomicWrites","Atomic Writes")}),o?.capabilities?.persistent&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capPersistent","Persistent")})]})]}),c&&e.jsxs("div",{className:"memory-engine-card",children:[e.jsxs("div",{className:"memory-health-header",children:[e.jsx("h3",{children:s("memory.healthStatusTitle","Health Status")}),e.jsx("span",{className:`memory-health-badge memory-health-badge--${c.health}`,children:c.health==="healthy"?s("memory.healthHealthy","Healthy"):c.health==="warning"?s("memory.healthWarning","Warning"):s("memory.healthIssues","Issues Found")})]}),e.jsxs("div",{className:"memory-health-grid",children:[e.jsxs("div",{children:[e.jsx("div",{className:"memory-health-label",children:s("memory.workingMemoryLabel","Working Memory")}),e.jsx("div",{className:"memory-emphasis-text",children:s("memory.sizeChars","{{size}} chars",{size:c.workingMemory.size})}),e.jsx("div",{className:"memory-health-detail",children:s("memory.sectionCount","{{count}} sections",{count:c.workingMemory.sectionCount})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"memory-health-label",children:s("memory.insightsMemoryLabel","Insights Memory")}),e.jsx("div",{className:"memory-emphasis-text",children:s("memory.sizeChars","{{size}} chars",{size:c.insightsMemory.size})}),e.jsx("div",{className:"memory-health-detail",children:s("memory.insightCount","{{count}} insights",{count:c.insightsMemory.insightCount})})]})]}),e.jsxs("div",{className:"memory-health-section",children:[e.jsx("div",{className:"memory-health-label",children:s("memory.lastExtractionLabel","Last Extraction")}),e.jsx("div",{className:"memory-emphasis-text",children:c.extraction.success?e.jsx("span",{className:"memory-status-text memory-status-text--success",children:s("memory.extractionSuccess","Success")}):e.jsx("span",{className:"memory-status-text memory-status-text--error",children:s("memory.extractionFailed","Failed")})}),e.jsx("div",{className:"memory-health-detail",children:c.extraction.summary||s("memory.insightsExtracted","{{count}} insights extracted",{count:c.extraction.insightCount})})]}),e.jsxs("div",{className:"memory-health-section",children:[e.jsx("div",{className:"memory-health-label",children:s("memory.pruningLabel","Pruning")}),e.jsx("div",{className:"memory-emphasis-text",children:c.pruning.applied?e.jsx("span",{className:"memory-status-text memory-status-text--warning",children:s("memory.pruningApplied","Applied")}):e.jsx("span",{className:"memory-status-text memory-status-text--muted",children:s("memory.pruningNotNeeded","Not needed")})}),c.pruning.applied&&e.jsx("div",{className:"memory-health-detail",children:c.pruning.reason})]})]}),c&&c.checks.length>0&&e.jsxs("div",{className:"memory-engine-card",children:[e.jsx("h3",{children:s("memory.auditChecksTitle","Audit Checks")}),e.jsx("div",{children:c.checks.map(a=>e.jsxs("div",{className:"memory-audit-check",children:[e.jsx("span",{className:a.passed?"memory-audit-check-passed":"memory-audit-check-failed",children:a.passed?"✓":"✗"}),e.jsxs("div",{className:"memory-audit-check-content",children:[e.jsx("div",{className:"memory-emphasis-text",children:a.name}),e.jsx("div",{className:"memory-health-detail",children:a.details})]})]},a.id))})]}),e.jsx("div",{className:"memory-action-bar",children:e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:()=>pe(),children:s("memory.runAudit","Run Audit")})}),e.jsxs("div",{className:"memory-settings-note",children:[e.jsx("span",{children:s("memory.settingsNote","Note: Change backend type in")}),e.jsx("button",{type:"button",className:"memory-settings-note-button",onClick:()=>{t(s("memory.settingsNoteToast","Open Settings → Memory to change backend type"),"info")},children:s("memory.settingsNoteLink","Settings → Memory")})]})]})})]})]})}export{us as MemoryView};
|
package/dist/client/assets/{PiExtensionsManager-RlbkXf_t.js → PiExtensionsManager-Dbm3IpQW.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{c as H,bv as Y,bw as Z,bx as T,R as L,al as D,an as y,P as ee,o as se,C as ae,J as ie,aJ as B,by as ne,bz as te,bA as _,X as re}from"./index-
|
|
1
|
+
import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{c as H,bv as Y,bw as Z,bx as T,R as L,al as D,an as y,P as ee,o as se,C as ae,J as ie,aJ as B,by as ne,bz as te,bA as _,X as re}from"./index-JlBzf2ck.js";import{u as le}from"./vendor-i18n-GF3RlKbq.js";import{B as $}from"./AgentPermissionPolicyEditor-Bfy55DIO.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,j as e}from"./vendor-react-SZ_qB27O.js";import{ae as Me,af as Ue,ag as $e,ah as ce,ai as qe,X as ge,aj as Ve,ak as Te,al as de,P as pe,am as me,J as he,R as be,an as We,a3 as Ke,ao as Qe,ap as Je,aq as Ye,ar as Xe,as as Ze,at as es,au as ss,av as O,aw as ns,ax as is}from"./index-Y-vyXPPN.js";import{D as ts}from"./DirectoryPicker-CRY-rpnj.js";import{u as as}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";import"./folder-open-CFze34Eq.js";const Ne="fusion-plugin-agent-browser",ye={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"}},xe={General:"plugins.agentBrowser.groupGeneral",Browser:"plugins.agentBrowser.groupBrowser","Prompt Contributions":"plugins.agentBrowser.groupPromptContributions",Skills:"plugins.agentBrowser.groupSkills"},fe={"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"},je=[{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:Ne,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 ls(r){const o=r.settingsSchema,n=o&&Object.keys(o).length>0;return r.id!==Ne?n?o:void 0:n?{...ye,...o}:ye}function rs(r){const o=new Map,n=[];for(const[j,y]of Object.entries(r))if(y.group){const v=o.get(y.group)??[];v.push([j,y]),o.set(y.group,v)}else n.push([j,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 ys({addToast:r,projectId:o}){const{t:n}=as("app"),[j,y]=d.useState([]),[v,z]=d.useState(!0),[ve,A]=d.useState(!1),[E,L]=d.useState(""),[_,H]=d.useState(!1),[M,U]=d.useState(!1),[w,$]=d.useState(null),[c,G]=d.useState(null),[m,x]=d.useState({}),[we,q]=d.useState(!1),[V,T]=d.useState(null),[W,Pe]=d.useState([]),[Ce,K]=d.useState(!0),[Q,J]=d.useState(null),[b,Re]=d.useState(""),[f,Ie]=d.useState(""),[Ee,Y]=d.useState(null),P=d.useRef(null),[Be,D]=d.useState({}),[ke,X]=d.useState(null),[B,Z]=d.useState(null),{confirm:Fe}=Me(),h=d.useCallback(async()=>{try{z(!0);const s=await Ue(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]),S=d.useCallback(async(s=b,i=f)=>{try{K(!0),J(null);const l=await $e(s,i||void 0,o);Pe(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(()=>{S(b,f)},300),()=>{P.current&&clearTimeout(P.current)}),[S,f,b]),d.useEffect(()=>{const s=je.filter(l=>l.hasSetup&&j.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;D(g=>({...g,[l.id]:u}))}catch{if(i)return;D(u=>({...u,[l.id]:{hasSetup:!0,setupCheckDeferred:!0,deferredReason:"plugin-not-started",pluginState:"installed"}}))}})),()=>{i=!0}},[j,o]);const Ae=d.useRef([]);Ae.current=j,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":S(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)),S(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 qe(`/api/events${s}`,{events:{"plugin:lifecycle":i},onReconnect:()=>{h(),S(b,f)}})},[o,h,S,f,b]);const ee=async()=>{if(!E.trim()){r(n("plugins.installPathRequired","Please enter a plugin path"),"error");return}try{H(!0),await O({path:E,...M?{aiScanOnLoad:!0}:{}},o),r(n("plugins.installedGlobally","Plugin installed globally"),"success"),A(!1),L(""),U(!1),await h()}catch(s){r(n("plugins.installFailed","Failed to install plugin: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{H(!1)}},Le=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)}},Ge=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 S(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 is(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);D(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 es(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 Ze(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 Xe(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 Fe({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 ss(s.id,o),r(n("plugins.uninstalledGlobally","{{name}} uninstalled globally",{name:s.name}),"success"),await h(),G(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 Qe(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")}},Oe=async s=>{try{await Je(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=>{G(s);try{q(!0);const i=await ns(s.id,o);x(i)}catch{x({})}finally{q(!1)}},ze=async()=>{if(c)try{await Ye(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:()=>G(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(Ve,{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 Oe(c),children:[e.jsx(Te,{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")}),we?e.jsx("p",{className:"text-muted",children:e.jsx(de,{label:n("plugins.loading","Loading...")})}):(()=>{const s=ls(c);return s&&Object.keys(s).length>0?e.jsxs("div",{className:"plugin-settings-form",children:[(()=>{const{grouped:i,ungrouped:l}=rs(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:xe[g.title]?n(xe[g.title],g.title):g.title}),g.entries.map(([a,t])=>{const N=`setting-${a}-help`,C=t.label?fe[t.label]?n(fe[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(pe,{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:ze,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(me,{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(he,{size:14})," ",n("plugins.uninstallGlobally","Uninstall Globally")]})]})]})]});const le=new Map(j.map(s=>[s.id,s])),re=j,_e=()=>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=>Ie(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=>Re(s.target.value),placeholder:n("plugins.searchRegistryPlaceholder","Search registry plugins")})]})]})]}),Ce?e.jsxs("div",{className:"plugin-registry-state",role:"status",children:[e.jsx(be,{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 S(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=Ee===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 Ge(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)})})]}),He=()=>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:je.map(s=>{const i=le.get(s.id),l=!!i,u=Be[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=ke===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){Le(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(be,{size:14,className:v?"spin":""}),n("plugins.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>A(!0),children:[e.jsx(pe,{size:14})," ",n("plugins.install","Install")]})]})]}),ve&&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(ts,{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:M,onChange:s=>U(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:_||!E.trim(),children:_?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:e.jsx(de,{label:n("plugins.loadingPlugins","Loading plugins...")})}):e.jsxs(e.Fragment,{children:[re.length===0?e.jsxs("div",{className:"settings-empty-state",children:[e.jsx(We,{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(me,{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(Ke,{size:14})}),e.jsx("button",{className:"btn-icon",onClick:()=>ae(s),title:n("plugins.uninstallGloballyTitle","Uninstall globally"),children:e.jsx(he,{size:14})})]})]},s.id))}),He(),_e()]})]})}export{ye as AGENT_BROWSER_SETTINGS_SCHEMA,Ne as BUILTIN_AGENT_BROWSER_PLUGIN_ID,je as BUILTIN_PLUGINS,ys as PluginManager,F as STATE_COLORS};
|
|
1
|
+
import{r as d,j as e}from"./vendor-react-SZ_qB27O.js";import{ae as Me,af as Ue,ag as $e,ah as ce,ai as qe,X as ge,aj as Ve,ak as Te,al as de,P as pe,am as me,J as he,R as be,an as We,a3 as Ke,ao as Qe,ap as Je,aq as Ye,ar as Xe,as as Ze,at as es,au as ss,av as O,aw as ns,ax as is}from"./index-JlBzf2ck.js";import{D as ts}from"./DirectoryPicker-BnaH1pb_.js";import{u as as}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";import"./folder-open-DLACu19m.js";const Ne="fusion-plugin-agent-browser",ye={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"}},xe={General:"plugins.agentBrowser.groupGeneral",Browser:"plugins.agentBrowser.groupBrowser","Prompt Contributions":"plugins.agentBrowser.groupPromptContributions",Skills:"plugins.agentBrowser.groupSkills"},fe={"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"},je=[{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:Ne,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 ls(r){const o=r.settingsSchema,n=o&&Object.keys(o).length>0;return r.id!==Ne?n?o:void 0:n?{...ye,...o}:ye}function rs(r){const o=new Map,n=[];for(const[j,y]of Object.entries(r))if(y.group){const v=o.get(y.group)??[];v.push([j,y]),o.set(y.group,v)}else n.push([j,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 ys({addToast:r,projectId:o}){const{t:n}=as("app"),[j,y]=d.useState([]),[v,z]=d.useState(!0),[ve,A]=d.useState(!1),[E,L]=d.useState(""),[_,H]=d.useState(!1),[M,U]=d.useState(!1),[w,$]=d.useState(null),[c,G]=d.useState(null),[m,x]=d.useState({}),[we,q]=d.useState(!1),[V,T]=d.useState(null),[W,Pe]=d.useState([]),[Ce,K]=d.useState(!0),[Q,J]=d.useState(null),[b,Re]=d.useState(""),[f,Ie]=d.useState(""),[Ee,Y]=d.useState(null),P=d.useRef(null),[Be,D]=d.useState({}),[ke,X]=d.useState(null),[B,Z]=d.useState(null),{confirm:Fe}=Me(),h=d.useCallback(async()=>{try{z(!0);const s=await Ue(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]),S=d.useCallback(async(s=b,i=f)=>{try{K(!0),J(null);const l=await $e(s,i||void 0,o);Pe(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(()=>{S(b,f)},300),()=>{P.current&&clearTimeout(P.current)}),[S,f,b]),d.useEffect(()=>{const s=je.filter(l=>l.hasSetup&&j.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;D(g=>({...g,[l.id]:u}))}catch{if(i)return;D(u=>({...u,[l.id]:{hasSetup:!0,setupCheckDeferred:!0,deferredReason:"plugin-not-started",pluginState:"installed"}}))}})),()=>{i=!0}},[j,o]);const Ae=d.useRef([]);Ae.current=j,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":S(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)),S(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 qe(`/api/events${s}`,{events:{"plugin:lifecycle":i},onReconnect:()=>{h(),S(b,f)}})},[o,h,S,f,b]);const ee=async()=>{if(!E.trim()){r(n("plugins.installPathRequired","Please enter a plugin path"),"error");return}try{H(!0),await O({path:E,...M?{aiScanOnLoad:!0}:{}},o),r(n("plugins.installedGlobally","Plugin installed globally"),"success"),A(!1),L(""),U(!1),await h()}catch(s){r(n("plugins.installFailed","Failed to install plugin: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{H(!1)}},Le=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)}},Ge=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 S(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 is(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);D(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 es(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 Ze(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 Xe(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 Fe({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 ss(s.id,o),r(n("plugins.uninstalledGlobally","{{name}} uninstalled globally",{name:s.name}),"success"),await h(),G(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 Qe(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")}},Oe=async s=>{try{await Je(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=>{G(s);try{q(!0);const i=await ns(s.id,o);x(i)}catch{x({})}finally{q(!1)}},ze=async()=>{if(c)try{await Ye(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:()=>G(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(Ve,{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 Oe(c),children:[e.jsx(Te,{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")}),we?e.jsx("p",{className:"text-muted",children:e.jsx(de,{label:n("plugins.loading","Loading...")})}):(()=>{const s=ls(c);return s&&Object.keys(s).length>0?e.jsxs("div",{className:"plugin-settings-form",children:[(()=>{const{grouped:i,ungrouped:l}=rs(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:xe[g.title]?n(xe[g.title],g.title):g.title}),g.entries.map(([a,t])=>{const N=`setting-${a}-help`,C=t.label?fe[t.label]?n(fe[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(pe,{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:ze,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(me,{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(he,{size:14})," ",n("plugins.uninstallGlobally","Uninstall Globally")]})]})]})]});const le=new Map(j.map(s=>[s.id,s])),re=j,_e=()=>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=>Ie(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=>Re(s.target.value),placeholder:n("plugins.searchRegistryPlaceholder","Search registry plugins")})]})]})]}),Ce?e.jsxs("div",{className:"plugin-registry-state",role:"status",children:[e.jsx(be,{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 S(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=Ee===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 Ge(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)})})]}),He=()=>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:je.map(s=>{const i=le.get(s.id),l=!!i,u=Be[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=ke===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){Le(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(be,{size:14,className:v?"spin":""}),n("plugins.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>A(!0),children:[e.jsx(pe,{size:14})," ",n("plugins.install","Install")]})]})]}),ve&&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(ts,{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:M,onChange:s=>U(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:_||!E.trim(),children:_?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:e.jsx(de,{label:n("plugins.loadingPlugins","Loading plugins...")})}):e.jsxs(e.Fragment,{children:[re.length===0?e.jsxs("div",{className:"settings-empty-state",children:[e.jsx(We,{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(me,{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(Ke,{size:14})}),e.jsx("button",{className:"btn-icon",onClick:()=>ae(s),title:n("plugins.uninstallGloballyTitle","Uninstall globally"),children:e.jsx(he,{size:14})})]})]},s.id))}),He(),_e()]})]})}export{ye as AGENT_BROWSER_SETTINGS_SCHEMA,Ne as BUILTIN_AGENT_BROWSER_PLUGIN_ID,je as BUILTIN_PLUGINS,ys as PluginManager,F as STATE_COLORS};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,j as e}from"./vendor-react-SZ_qB27O.js";import{c as te,V as ie,b7 as k,b8 as N,b9 as C,am as F,ba as M,bb as ae,bc as X,aj as Z,h as K,a7 as E}from"./index-
|
|
1
|
+
import{r as a,j as e}from"./vendor-react-SZ_qB27O.js";import{c as te,V as ie,b7 as k,b8 as N,b9 as C,am as F,ba as M,bb as ae,bc as X,aj as Z,h as K,a7 as E}from"./index-JlBzf2ck.js";import{u as ne}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{ay as z,az as de,aA as ue,bB as he,bS as xe,aD as ae,bT as ye,ai as ge,bU as X,bV as Re,bW as _e,bX as Se,bY as je,bZ as we,b_ as Ne,bF as ke,b$ as Ee,c0 as Ce,aR as Ae,c1 as Te,V as Le,aK as me,L as Pe,al as Fe}from"./index-Y-vyXPPN.js";import{u as be}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";const Ie="builtin",Q={pageFetch:!0,github:!1,localDocs:!0,llmSynthesis:!0};function ne(n){const a=n?.researchGlobalDefaults,i=n?.researchSettings;return{enabled:i?.enabled??n?.researchEnabled??n?.researchGlobalEnabled??!0,searchProvider:i?.searchProvider??a?.searchProvider??n?.researchGlobalWebSearchProvider??Ie,synthesisProvider:i?.synthesisProvider??a?.synthesisProvider,synthesisModelId:i?.synthesisModelId??a?.synthesisModelId,enabledSources:{webSearch:!0,pageFetch:i?.enabledSources?.pageFetch??a?.enabledSources?.pageFetch??Q.pageFetch,github:i?.enabledSources?.github??a?.enabledSources?.github??Q.github,localDocs:i?.enabledSources?.localDocs??a?.enabledSources?.localDocs??Q.localDocs,llmSynthesis:i?.enabledSources?.llmSynthesis??a?.enabledSources?.llmSynthesis??Q.llmSynthesis},limits:{maxConcurrentRuns:i?.limits?.maxConcurrentRuns??n?.researchMaxConcurrentRuns??n?.researchGlobalMaxConcurrentRuns??3,maxSourcesPerRun:i?.limits?.maxSourcesPerRun??a?.maxSourcesPerRun??n?.researchMaxSourcesPerRun??n?.researchGlobalMaxSourcesPerRun??20,maxDurationMs:i?.limits?.maxDurationMs??n?.researchDefaultTimeout??n?.researchGlobalDefaultTimeout??3e5,requestTimeoutMs:i?.limits?.requestTimeoutMs??n?.researchGlobalFetchTimeoutMs??3e4},defaultExportFormat:a?.defaultExportFormat??"markdown"}}const Me=300,De=4e3,He=["queued","running","cancelling","retry_waiting"];function ce(n,a){if(n instanceof ke){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:a,code:"INTERNAL_ERROR"}}function qe(n){if(!n)return{cancelable:!1,retryable:!1,isTransitioning:!1,blockingReason:"No run selected"};const a=He.includes(n.status),i=n.status==="queued"||n.status==="running",v=n.lifecycle?.retryable,s=n.status==="failed"||n.status==="timed_out",_=!!(s&&v);let g;return!i&&a?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"),!_&&s&&v===!1&&(g=n.lifecycle?.errorCode==="RETRY_EXHAUSTED"?"Retry attempts exhausted":"Run is not retryable"),{cancelable:i,retryable:_,isTransitioning:a,blockingReason:g}}function Ue(n){const a=n?.projectId,i=a??"",v=`${ue.RESEARCH_RUNS_PREFIX}${i}`,s=`${ue.RESEARCH_SELECTED_ID_PREFIX}${i}`,_=z(v,{maxAgeMs:de}),g=z(s,{maxAgeMs:he}),r=c.useRef(Array.isArray(_)&&_.length>0),[F,P]=c.useState(()=>Array.isArray(_)?_:[]),[h,E]=c.useState(g??null),[A,N]=c.useState(null),[q,I]=c.useState({available:!0}),[M,T]=c.useState(!(Array.isArray(_)&&_.length>0)),[V,U]=c.useState(null),[$,S]=c.useState(null),[w,k]=c.useState(""),x=c.useRef(0),d=c.useRef(0),D=c.useRef(a);c.useEffect(()=>{D.current!==a&&(D.current=a,d.current++);const l=z(v,{maxAgeMs:de}),o=z(s,{maxAgeMs:he}),p=Array.isArray(l)&&l.length>0;P(Array.isArray(l)?l:[]),E(o??null),N(null),T(!p),r.current=p},[a,v,s]);const b=c.useCallback(async(l=w)=>{const o=++x.current,p=a;r.current||T(!0),U(null),S(null);try{const R=await xe({q:l||void 0,limit:100},p);if(o!==x.current||p!==a)return;P(R.runs),ae(v,R.runs,{maxBytes:5e5}),r.current=!0,I(R.availability),h&&!R.runs.some(y=>y.id===h)&&(E(null),ae(s,null,{maxBytes:5e5}),N(null))}catch(R){if(o!==x.current||p!==a)return;const y=ce(R,"Failed to load research runs");U(y.message),S(y)}finally{o===x.current&&T(!1)}},[a,v,w,s,h]),H=c.useCallback(async l=>{const o=await ye(l,a);return N(o.run),I(o.availability),o.run},[a]);c.useEffect(()=>{r.current||T(!0);const l=window.setTimeout(()=>{b(w)},Me);return()=>window.clearTimeout(l)},[b,w]),c.useEffect(()=>{if(!h){N(null);return}H(h)},[H,h]),c.useEffect(()=>{const l=d.current,o=()=>d.current!==l,p=a?`?projectId=${encodeURIComponent(a)}`:"";let R=!0;const y=()=>{!R||o()||(b(),h&&H(h))},j=`/api/events${p}`,O=ge(j,{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:a,replayAttempted:!1,sseChannel:j}),y()}});X({view:"useResearch",trigger:"sse-open",projectId:a,replayAttempted:!1,sseChannel:j});const L=window.setInterval(y,De);return()=>{R=!1,O(),window.clearInterval(L)}},[a,b,h,H]);const B=c.useCallback(l=>{E(l),ae(s,l,{maxBytes:5e5})},[s]);return{runs:F,selectedRun:A,selectedRunId:h,setSelectedRunId:B,availability:q,loading:M,error:V,searchQuery:w,setSearchQuery:k,refresh:b,createRun:l=>Ne(l,a),cancelRun:async l=>{try{S(null);const o=await we(l,a);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to cancel run");throw S(p),p}},retryRun:async l=>{try{S(null);const o=await je(l,a);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to retry run");throw S(p),p}},exportRun:(l,o)=>Se(l,o,a),createTaskFromRun:(l,o,p,R,y,j)=>_e(l,{title:o,findingId:p,description:R,priority:y,attachExport:j},a),attachRunToTask:(l,o,p,R)=>Re(l,{taskId:o,findingId:p,attachExport:R},a),uiError:$,runActionState:qe(A),statusCounts:F.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 Oe({open:n,mode:a,run:i,finding:v,projectId:s,onClose:_,onConfirm:g}){const{t:r}=be("app");Ee(n);const[F,P]=c.useState(!1),[h,E]=c.useState(""),[A,N]=c.useState(""),[q,I]=c.useState("normal"),[M,T]=c.useState(""),[V,U]=c.useState([]),[$,S]=c.useState(!1),[w,k]=c.useState(!1),x=c.useMemo(()=>{const d=(v.content??"").split(/(?<=[.!?])\s+/)[0]??"";return`${v.heading||r("research.defaultFindingHeading","Research finding")} — ${d}`.trim()},[v.content,v.heading,r]);return c.useEffect(()=>{n&&(P(!1),E(`Research: ${v.heading||i.title}`),N(x),I("normal"),T(""),a==="enrich"&&(S(!0),Ce(50,0,s).then(d=>U(d.filter(D=>D.column!=="archived"))).finally(()=>S(!1))))},[n,a,s,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:a==="create"?r("research.createTaskTitle","Create task from finding"):r("research.enrichTaskTitle","Enrich existing task")}),e.jsx("button",{className:"modal-close",type:"button","aria-label":r("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:[r("research.runLabel","Run:")," "]})," ",i.id]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.findingLabel","Finding:")," "]})," ",v.id,v.heading?` — ${v.heading}`:""]}),e.jsx("p",{children:x||r("research.noPreview","No preview available.")})]}),a==="create"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"research-task-action-modal__field",children:[r("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:[r("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:[r("research.priorityLabel","Priority"),e.jsxs("select",{className:"select",value:q,onChange:d=>I(d.target.value),children:[e.jsx("option",{value:"low",children:r("research.priorityLow","Low")}),e.jsx("option",{value:"normal",children:r("research.priorityNormal","Normal")}),e.jsx("option",{value:"high",children:r("research.priorityHigh","High")}),e.jsx("option",{value:"urgent",children:r("research.priorityUrgent","Urgent")})]})]})]}):e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.targetTaskLabel","Target task"),e.jsx("input",{className:"input",list:"research-task-action-task-list",value:M,placeholder:$?r("research.loadingTasks","Loading tasks…"):r("research.enterTaskId","Enter task ID"),onChange:d=>T(d.target.value)}),e.jsx("datalist",{id:"research-task-action-task-list",children:V.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:F,onChange:d=>P(d.target.checked)}),e.jsx("span",{children:r("research.attachExport","Attach markdown export artifact")})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:_,children:r("actions.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:w||a==="enrich"&&!M,onClick:()=>{k(!0),g({taskId:a==="enrich"?M:void 0,title:a==="create"?h.trim():void 0,description:a==="create"?A.trim():void 0,priority:a==="create"?q:void 0,attachExport:F}).finally(()=>k(!1))},children:a==="create"?r("research.createTaskButton","Create Task"):r("research.enrichTaskButton","Enrich Task")})]})]})}):null}const Ve=["web-search","page-fetch","github","local-docs","llm-synthesis"],$e={"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 Je({projectId:n,addToast:a,onOpenSettings:i,readinessVersion:v=0}){const{t:s}=be("app"),_=Ge(s);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:r,selectedRunId:F,setSelectedRunId:P,availability:h,loading:E,error:A,searchQuery:N,setSearchQuery:q,createRun:I,cancelRun:M,retryRun:T,exportRun:V,createTaskFromRun:U,attachRunToTask:$,statusCounts:S,refresh:w,uiError:k,runActionState:x}=Ue({projectId:n}),[d,D]=c.useState(""),[b,H]=c.useState(()=>ne(void 0)),[B,l]=c.useState([]),[o,p]=c.useState(!1),[R,y]=c.useState([]),[j,O]=c.useState(null),[L,K]=c.useState(null),Y=h.supportedProviders??Ve,J=b.searchProvider,Z=t=>t==="web-search"?!0:b.enabledSources[$e[t]];c.useEffect(()=>{const t=Y.filter(u=>Z(u));y(u=>{const f=u.filter(m=>t.includes(m));return f.length>0?f:t})},[b.enabledSources,Y]),c.useEffect(()=>{let t=!1;return Promise.all([Ae(n),Te().catch(()=>({providers:[]}))]).then(([u,f])=>{t||(H(ne(u)),l(f.providers.filter(m=>m.type==="api_key").map(m=>({id:m.id,authenticated:m.authenticated}))))}).catch(()=>{t||H(ne(void 0))}),()=>{t=!0}},[n,v]);const pe=c.useMemo(()=>r?r.status:s("research.noRunSelected","No run selected"),[r,s]),fe=c.useMemo(()=>r?r.status==="queued"||r.status==="retry_waiting"?"status-dot status-dot--pending":r.status==="running"?"status-dot status-dot--connecting":r.status==="completed"?"status-dot status-dot--online":r.status==="failed"||r.status==="cancelled"?"status-dot status-dot--error":"status-dot":"status-dot",[r]),ee=h.supportedExportFormats??["markdown","json","html"],se=c.useMemo(()=>new Map(B.map(t=>[t.id,t.authenticated])),[B]),re=c.useMemo(()=>{const t=new Set;return b.enabledSources.webSearch&&J&&t.add(J),b.enabledSources.llmSynthesis&&b.synthesisProvider&&t.add(b.synthesisProvider),[...t].filter(u=>se.has(u))},[b.enabledSources.llmSynthesis,b.enabledSources.webSearch,b.synthesisProvider,J,se]).find(t=>se.get(t)!==!0),G=c.useMemo(()=>h.available?b.enabled?re?{reason:s("research.missingApiKey","Missing API key for {{provider}}.",{provider:re}),details:s("research.addCredentialsHint","Add provider credentials in Authentication settings."),settingsSection:"authentication"}:null:{reason:s("research.disabled","Research is disabled for this project."),details:s("research.enableResearchHint","Enable project research settings to create runs."),settingsSection:"research-project"}:{reason:h.reason??s("research.unavailable","Research is unavailable for this project."),details:h.setupInstructions,settingsSection:"research-project"},[h.available,h.reason,h.setupInstructions,b.enabled,re,s]),W=async(t,u,f)=>{O(t);try{await u(),a?.(f,"success"),await w()}catch(m){a?.(m instanceof Error?m.message:s("research.actionFailed","Action failed"),"error")}finally{O(null)}},te=async t=>{if(r){O(`export-${t}`);try{const u=await V(r.id,t),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),a?.(s("research.exportedFile","Exported {{filename}}",{filename:u.filename}),"success")}catch(u){a?.(u instanceof Error?u.message:s("research.exportFailed","Export failed"),"error")}finally{O(null)}}},ve=async()=>{if(d.trim()){p(!0);try{const t=R.filter(f=>Z(f));if(t.length===0){p(!1),a?.(s("research.noSourcesAvailable","No enabled research sources are available for this project."),"error");return}const u=await I({query:d.trim(),providers:t});P(u.run.id),D(""),a?.(s("research.runCreated","Research run created"),"success"),await w()}catch(t){a?.(t instanceof Error?t.message:s("research.createRunFailed","Failed to create run"),"error")}finally{p(!1)}}};return e.jsxs("section",{className:"research-view","aria-label":s("research.viewLabel","Research view"),children:[e.jsx(Le,{icon:me,title:s("research.title","Research"),actions:e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:s("actions.refresh","Refresh")})}),e.jsx("p",{className:"research-view__subtitle",children:s("research.subtitle","Cited search and synthesis runs: gather sources, fetch content, and synthesize findings.")}),G?e.jsxs("div",{className:"research-view__state research-view__state--error card","data-testid":"research-state-unavailable",children:[e.jsx("p",{children:G.reason}),G.details&&e.jsx("p",{children:G.details}),e.jsx("p",{children:s("research.currentDefaults","Current defaults: provider {{provider}}, max sources {{maxSources}}",{provider:b.searchProvider??s("research.notSet","(not set)"),maxSources:b.limits.maxSourcesPerRun})}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:s("actions.refresh","Refresh")}),e.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>i?.(G.settingsSection),children:s("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:s("research.queryLabel","Query")}),e.jsx("textarea",{id:"research-query",className:"input research-view__textarea",value:d,onChange:t=>D(t.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:s("research.providersLabel","Providers")}),e.jsx("div",{className:"research-view__providers",children:Y.map(t=>{const u=Z(t),f=t==="web-search";return e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:f||R.includes(t),disabled:f||!u,onChange:()=>{f||!u||y(m=>m.includes(t)?m.filter(C=>C!==t):[...m,t])}}),e.jsxs("span",{children:[_[t]??t,f?e.jsx("span",{className:"research-view__provider-lock",children:s("research.alwaysOn","Always on")}):null]})]},t)})})]}),e.jsxs("button",{className:"btn btn-primary",type:"button",disabled:!d.trim()||o,onClick:()=>void ve(),children:[o?e.jsx(Pe,{className:"animate-spin",size:14}):null,s("research.createRun","Create Run")]})]}),e.jsxs("div",{className:"research-view__history-header form-group",children:[e.jsx("label",{htmlFor:"research-run-search",children:s("actions.search","Search")}),e.jsxs("div",{className:"research-view__history-search-row",children:[e.jsx(me,{size:14}),e.jsx("input",{id:"research-run-search",className:"input",placeholder:s("research.searchRunsPlaceholder","Search runs"),value:N,onChange:t=>q(t.target.value)})]})]}),e.jsx("div",{className:"research-view__history","data-testid":"research-state-running",children:g.map(t=>e.jsxs("button",{type:"button",className:`research-view__history-item card${F===t.id?" research-view__history-item--active":""}`,onClick:()=>P(t.id),children:[e.jsx("span",{className:"card-id",children:t.id}),e.jsx("span",{children:t.title})]},t.id))})]})}),e.jsxs("div",{className:"research-view__reader card",children:[E&&e.jsx("p",{"data-testid":"research-state-loading",children:e.jsx(Fe,{label:s("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:s("research.noRunsYet","No research runs yet")}),e.jsxs("div",{className:"research-view__reader-content",children:[r&&e.jsxs("div",{className:"research-view__run-detail",children:[e.jsxs("div",{className:"research-view__status-row",children:[e.jsx("span",{className:fe}),e.jsx("strong",{children:pe})]}),e.jsx("h3",{className:"research-view__run-title",children:r.title}),e.jsx("p",{className:"research-view__run-query",children:r.query}),e.jsx("p",{className:"research-view__run-summary","data-testid":"research-state-results",children:r.results?.summary??s("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:j==="cancel"||j==="retry"||!x.cancelable,onClick:()=>void W("cancel",()=>M(r.id),s("research.runCancelled","Run cancelled")),children:s("actions.cancel","Cancel")}),e.jsx("button",{className:"btn",type:"button",title:x.retryable?void 0:x.blockingReason,disabled:j==="cancel"||j==="retry"||!x.retryable,onClick:()=>void W("retry",()=>T(r.id),s("research.runRetried","Run retried")),children:s("actions.retry","Retry")}),ee.includes("markdown")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-markdown",onClick:()=>void te("markdown"),children:s("research.exportMd","Export MD")}),ee.includes("json")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-json",onClick:()=>void te("json"),children:s("research.exportJson","Export JSON")}),ee.includes("html")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-html",onClick:()=>void te("html"),children:s("research.exportHtml","Export HTML")})]}),r.error&&e.jsx("p",{className:"research-view__error",children:r.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:s("research.openAuthSettings","Open Authentication Settings")}),k.code==="FEATURE_DISABLED"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("research-project"),children:s("research.openResearchSettings","Open Research Settings")})]}),x.blockingReason&&e.jsx("p",{className:"research-view__run-query",children:x.blockingReason}),Array.isArray(r.results?.findings)&&r.results.findings.length>0&&e.jsx("div",{className:"research-view__findings",children:r.results.findings.map((t,u)=>{const m=t.id?.trim()||`finding-${u+1}`;return e.jsxs("article",{className:"research-view__finding card",children:[e.jsx("h4",{children:t.heading}),e.jsx("p",{children:t.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:s("research.createTask","Create Task")}),e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>K({mode:"enrich",findingId:m}),children:s("research.enrichTask","Enrich Task")})]})]},m)})}),Array.isArray(r.results?.citations)&&r.results.citations.length>0&&e.jsx("ul",{className:"research-view__citations",children:r.results.citations.map(t=>e.jsx("li",{children:e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",children:t})},t))}),r.events.length>0&&e.jsxs("details",{children:[e.jsx("summary",{children:s("research.runHistory","Run history")}),e.jsx("ul",{className:"research-view__events",children:r.events.map(t=>e.jsx("li",{children:t.message},t.id))})]})]}),!r&&g.length>0&&e.jsx("p",{children:s("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:s("research.statRunning","Running")}),e.jsx("div",{className:"research-view__stat-value",children:S.running})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statCompleted","Completed")}),e.jsx("div",{className:"research-view__stat-value",children:S.completed})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statFailed","Failed")}),e.jsx("div",{className:"research-view__stat-value",children:S.failed})]})]})]})]})]})}),r&&L&&(()=>{const t=r.results?.findings?.findIndex((f,m)=>(f.id?.trim()||`finding-${m+1}`)===L.findingId)??-1,u=t>=0?r.results.findings[t]:null;return u?e.jsx(Oe,{open:!0,mode:L.mode,run:r,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 W("create-task",()=>U(r.id,m,L.findingId,C,le,oe),s("research.taskCreatedFromResearch","Task created from research")):f&&await W("attach-task",()=>$(r.id,f,L.findingId,oe),s("research.taskEnrichedFromResearch","Task enriched from research")),K(null)}}):null})()]})}export{Je as ResearchView};
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{ay as z,az as de,aA as ue,bB as he,bS as xe,aD as ae,bT as ye,ai as ge,bU as X,bV as Re,bW as _e,bX as Se,bY as je,bZ as we,b_ as Ne,bF as ke,b$ as Ee,c0 as Ce,aR as Ae,c1 as Te,V as Le,aK as me,L as Pe,al as Fe}from"./index-JlBzf2ck.js";import{u as be}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";const Ie="builtin",Q={pageFetch:!0,github:!1,localDocs:!0,llmSynthesis:!0};function ne(n){const a=n?.researchGlobalDefaults,i=n?.researchSettings;return{enabled:i?.enabled??n?.researchEnabled??n?.researchGlobalEnabled??!0,searchProvider:i?.searchProvider??a?.searchProvider??n?.researchGlobalWebSearchProvider??Ie,synthesisProvider:i?.synthesisProvider??a?.synthesisProvider,synthesisModelId:i?.synthesisModelId??a?.synthesisModelId,enabledSources:{webSearch:!0,pageFetch:i?.enabledSources?.pageFetch??a?.enabledSources?.pageFetch??Q.pageFetch,github:i?.enabledSources?.github??a?.enabledSources?.github??Q.github,localDocs:i?.enabledSources?.localDocs??a?.enabledSources?.localDocs??Q.localDocs,llmSynthesis:i?.enabledSources?.llmSynthesis??a?.enabledSources?.llmSynthesis??Q.llmSynthesis},limits:{maxConcurrentRuns:i?.limits?.maxConcurrentRuns??n?.researchMaxConcurrentRuns??n?.researchGlobalMaxConcurrentRuns??3,maxSourcesPerRun:i?.limits?.maxSourcesPerRun??a?.maxSourcesPerRun??n?.researchMaxSourcesPerRun??n?.researchGlobalMaxSourcesPerRun??20,maxDurationMs:i?.limits?.maxDurationMs??n?.researchDefaultTimeout??n?.researchGlobalDefaultTimeout??3e5,requestTimeoutMs:i?.limits?.requestTimeoutMs??n?.researchGlobalFetchTimeoutMs??3e4},defaultExportFormat:a?.defaultExportFormat??"markdown"}}const Me=300,De=4e3,He=["queued","running","cancelling","retry_waiting"];function ce(n,a){if(n instanceof ke){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:a,code:"INTERNAL_ERROR"}}function qe(n){if(!n)return{cancelable:!1,retryable:!1,isTransitioning:!1,blockingReason:"No run selected"};const a=He.includes(n.status),i=n.status==="queued"||n.status==="running",v=n.lifecycle?.retryable,s=n.status==="failed"||n.status==="timed_out",_=!!(s&&v);let g;return!i&&a?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"),!_&&s&&v===!1&&(g=n.lifecycle?.errorCode==="RETRY_EXHAUSTED"?"Retry attempts exhausted":"Run is not retryable"),{cancelable:i,retryable:_,isTransitioning:a,blockingReason:g}}function Ue(n){const a=n?.projectId,i=a??"",v=`${ue.RESEARCH_RUNS_PREFIX}${i}`,s=`${ue.RESEARCH_SELECTED_ID_PREFIX}${i}`,_=z(v,{maxAgeMs:de}),g=z(s,{maxAgeMs:he}),r=c.useRef(Array.isArray(_)&&_.length>0),[F,P]=c.useState(()=>Array.isArray(_)?_:[]),[h,E]=c.useState(g??null),[A,N]=c.useState(null),[q,I]=c.useState({available:!0}),[M,T]=c.useState(!(Array.isArray(_)&&_.length>0)),[V,U]=c.useState(null),[$,S]=c.useState(null),[w,k]=c.useState(""),x=c.useRef(0),d=c.useRef(0),D=c.useRef(a);c.useEffect(()=>{D.current!==a&&(D.current=a,d.current++);const l=z(v,{maxAgeMs:de}),o=z(s,{maxAgeMs:he}),p=Array.isArray(l)&&l.length>0;P(Array.isArray(l)?l:[]),E(o??null),N(null),T(!p),r.current=p},[a,v,s]);const b=c.useCallback(async(l=w)=>{const o=++x.current,p=a;r.current||T(!0),U(null),S(null);try{const R=await xe({q:l||void 0,limit:100},p);if(o!==x.current||p!==a)return;P(R.runs),ae(v,R.runs,{maxBytes:5e5}),r.current=!0,I(R.availability),h&&!R.runs.some(y=>y.id===h)&&(E(null),ae(s,null,{maxBytes:5e5}),N(null))}catch(R){if(o!==x.current||p!==a)return;const y=ce(R,"Failed to load research runs");U(y.message),S(y)}finally{o===x.current&&T(!1)}},[a,v,w,s,h]),H=c.useCallback(async l=>{const o=await ye(l,a);return N(o.run),I(o.availability),o.run},[a]);c.useEffect(()=>{r.current||T(!0);const l=window.setTimeout(()=>{b(w)},Me);return()=>window.clearTimeout(l)},[b,w]),c.useEffect(()=>{if(!h){N(null);return}H(h)},[H,h]),c.useEffect(()=>{const l=d.current,o=()=>d.current!==l,p=a?`?projectId=${encodeURIComponent(a)}`:"";let R=!0;const y=()=>{!R||o()||(b(),h&&H(h))},j=`/api/events${p}`,O=ge(j,{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:a,replayAttempted:!1,sseChannel:j}),y()}});X({view:"useResearch",trigger:"sse-open",projectId:a,replayAttempted:!1,sseChannel:j});const L=window.setInterval(y,De);return()=>{R=!1,O(),window.clearInterval(L)}},[a,b,h,H]);const B=c.useCallback(l=>{E(l),ae(s,l,{maxBytes:5e5})},[s]);return{runs:F,selectedRun:A,selectedRunId:h,setSelectedRunId:B,availability:q,loading:M,error:V,searchQuery:w,setSearchQuery:k,refresh:b,createRun:l=>Ne(l,a),cancelRun:async l=>{try{S(null);const o=await we(l,a);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to cancel run");throw S(p),p}},retryRun:async l=>{try{S(null);const o=await je(l,a);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to retry run");throw S(p),p}},exportRun:(l,o)=>Se(l,o,a),createTaskFromRun:(l,o,p,R,y,j)=>_e(l,{title:o,findingId:p,description:R,priority:y,attachExport:j},a),attachRunToTask:(l,o,p,R)=>Re(l,{taskId:o,findingId:p,attachExport:R},a),uiError:$,runActionState:qe(A),statusCounts:F.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 Oe({open:n,mode:a,run:i,finding:v,projectId:s,onClose:_,onConfirm:g}){const{t:r}=be("app");Ee(n);const[F,P]=c.useState(!1),[h,E]=c.useState(""),[A,N]=c.useState(""),[q,I]=c.useState("normal"),[M,T]=c.useState(""),[V,U]=c.useState([]),[$,S]=c.useState(!1),[w,k]=c.useState(!1),x=c.useMemo(()=>{const d=(v.content??"").split(/(?<=[.!?])\s+/)[0]??"";return`${v.heading||r("research.defaultFindingHeading","Research finding")} — ${d}`.trim()},[v.content,v.heading,r]);return c.useEffect(()=>{n&&(P(!1),E(`Research: ${v.heading||i.title}`),N(x),I("normal"),T(""),a==="enrich"&&(S(!0),Ce(50,0,s).then(d=>U(d.filter(D=>D.column!=="archived"))).finally(()=>S(!1))))},[n,a,s,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:a==="create"?r("research.createTaskTitle","Create task from finding"):r("research.enrichTaskTitle","Enrich existing task")}),e.jsx("button",{className:"modal-close",type:"button","aria-label":r("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:[r("research.runLabel","Run:")," "]})," ",i.id]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.findingLabel","Finding:")," "]})," ",v.id,v.heading?` — ${v.heading}`:""]}),e.jsx("p",{children:x||r("research.noPreview","No preview available.")})]}),a==="create"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"research-task-action-modal__field",children:[r("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:[r("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:[r("research.priorityLabel","Priority"),e.jsxs("select",{className:"select",value:q,onChange:d=>I(d.target.value),children:[e.jsx("option",{value:"low",children:r("research.priorityLow","Low")}),e.jsx("option",{value:"normal",children:r("research.priorityNormal","Normal")}),e.jsx("option",{value:"high",children:r("research.priorityHigh","High")}),e.jsx("option",{value:"urgent",children:r("research.priorityUrgent","Urgent")})]})]})]}):e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.targetTaskLabel","Target task"),e.jsx("input",{className:"input",list:"research-task-action-task-list",value:M,placeholder:$?r("research.loadingTasks","Loading tasks…"):r("research.enterTaskId","Enter task ID"),onChange:d=>T(d.target.value)}),e.jsx("datalist",{id:"research-task-action-task-list",children:V.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:F,onChange:d=>P(d.target.checked)}),e.jsx("span",{children:r("research.attachExport","Attach markdown export artifact")})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:_,children:r("actions.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:w||a==="enrich"&&!M,onClick:()=>{k(!0),g({taskId:a==="enrich"?M:void 0,title:a==="create"?h.trim():void 0,description:a==="create"?A.trim():void 0,priority:a==="create"?q:void 0,attachExport:F}).finally(()=>k(!1))},children:a==="create"?r("research.createTaskButton","Create Task"):r("research.enrichTaskButton","Enrich Task")})]})]})}):null}const Ve=["web-search","page-fetch","github","local-docs","llm-synthesis"],$e={"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 Je({projectId:n,addToast:a,onOpenSettings:i,readinessVersion:v=0}){const{t:s}=be("app"),_=Ge(s);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:r,selectedRunId:F,setSelectedRunId:P,availability:h,loading:E,error:A,searchQuery:N,setSearchQuery:q,createRun:I,cancelRun:M,retryRun:T,exportRun:V,createTaskFromRun:U,attachRunToTask:$,statusCounts:S,refresh:w,uiError:k,runActionState:x}=Ue({projectId:n}),[d,D]=c.useState(""),[b,H]=c.useState(()=>ne(void 0)),[B,l]=c.useState([]),[o,p]=c.useState(!1),[R,y]=c.useState([]),[j,O]=c.useState(null),[L,K]=c.useState(null),Y=h.supportedProviders??Ve,J=b.searchProvider,Z=t=>t==="web-search"?!0:b.enabledSources[$e[t]];c.useEffect(()=>{const t=Y.filter(u=>Z(u));y(u=>{const f=u.filter(m=>t.includes(m));return f.length>0?f:t})},[b.enabledSources,Y]),c.useEffect(()=>{let t=!1;return Promise.all([Ae(n),Te().catch(()=>({providers:[]}))]).then(([u,f])=>{t||(H(ne(u)),l(f.providers.filter(m=>m.type==="api_key").map(m=>({id:m.id,authenticated:m.authenticated}))))}).catch(()=>{t||H(ne(void 0))}),()=>{t=!0}},[n,v]);const pe=c.useMemo(()=>r?r.status:s("research.noRunSelected","No run selected"),[r,s]),fe=c.useMemo(()=>r?r.status==="queued"||r.status==="retry_waiting"?"status-dot status-dot--pending":r.status==="running"?"status-dot status-dot--connecting":r.status==="completed"?"status-dot status-dot--online":r.status==="failed"||r.status==="cancelled"?"status-dot status-dot--error":"status-dot":"status-dot",[r]),ee=h.supportedExportFormats??["markdown","json","html"],se=c.useMemo(()=>new Map(B.map(t=>[t.id,t.authenticated])),[B]),re=c.useMemo(()=>{const t=new Set;return b.enabledSources.webSearch&&J&&t.add(J),b.enabledSources.llmSynthesis&&b.synthesisProvider&&t.add(b.synthesisProvider),[...t].filter(u=>se.has(u))},[b.enabledSources.llmSynthesis,b.enabledSources.webSearch,b.synthesisProvider,J,se]).find(t=>se.get(t)!==!0),G=c.useMemo(()=>h.available?b.enabled?re?{reason:s("research.missingApiKey","Missing API key for {{provider}}.",{provider:re}),details:s("research.addCredentialsHint","Add provider credentials in Authentication settings."),settingsSection:"authentication"}:null:{reason:s("research.disabled","Research is disabled for this project."),details:s("research.enableResearchHint","Enable project research settings to create runs."),settingsSection:"research-project"}:{reason:h.reason??s("research.unavailable","Research is unavailable for this project."),details:h.setupInstructions,settingsSection:"research-project"},[h.available,h.reason,h.setupInstructions,b.enabled,re,s]),W=async(t,u,f)=>{O(t);try{await u(),a?.(f,"success"),await w()}catch(m){a?.(m instanceof Error?m.message:s("research.actionFailed","Action failed"),"error")}finally{O(null)}},te=async t=>{if(r){O(`export-${t}`);try{const u=await V(r.id,t),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),a?.(s("research.exportedFile","Exported {{filename}}",{filename:u.filename}),"success")}catch(u){a?.(u instanceof Error?u.message:s("research.exportFailed","Export failed"),"error")}finally{O(null)}}},ve=async()=>{if(d.trim()){p(!0);try{const t=R.filter(f=>Z(f));if(t.length===0){p(!1),a?.(s("research.noSourcesAvailable","No enabled research sources are available for this project."),"error");return}const u=await I({query:d.trim(),providers:t});P(u.run.id),D(""),a?.(s("research.runCreated","Research run created"),"success"),await w()}catch(t){a?.(t instanceof Error?t.message:s("research.createRunFailed","Failed to create run"),"error")}finally{p(!1)}}};return e.jsxs("section",{className:"research-view","aria-label":s("research.viewLabel","Research view"),children:[e.jsx(Le,{icon:me,title:s("research.title","Research"),actions:e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:s("actions.refresh","Refresh")})}),e.jsx("p",{className:"research-view__subtitle",children:s("research.subtitle","Cited search and synthesis runs: gather sources, fetch content, and synthesize findings.")}),G?e.jsxs("div",{className:"research-view__state research-view__state--error card","data-testid":"research-state-unavailable",children:[e.jsx("p",{children:G.reason}),G.details&&e.jsx("p",{children:G.details}),e.jsx("p",{children:s("research.currentDefaults","Current defaults: provider {{provider}}, max sources {{maxSources}}",{provider:b.searchProvider??s("research.notSet","(not set)"),maxSources:b.limits.maxSourcesPerRun})}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:s("actions.refresh","Refresh")}),e.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>i?.(G.settingsSection),children:s("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:s("research.queryLabel","Query")}),e.jsx("textarea",{id:"research-query",className:"input research-view__textarea",value:d,onChange:t=>D(t.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:s("research.providersLabel","Providers")}),e.jsx("div",{className:"research-view__providers",children:Y.map(t=>{const u=Z(t),f=t==="web-search";return e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:f||R.includes(t),disabled:f||!u,onChange:()=>{f||!u||y(m=>m.includes(t)?m.filter(C=>C!==t):[...m,t])}}),e.jsxs("span",{children:[_[t]??t,f?e.jsx("span",{className:"research-view__provider-lock",children:s("research.alwaysOn","Always on")}):null]})]},t)})})]}),e.jsxs("button",{className:"btn btn-primary",type:"button",disabled:!d.trim()||o,onClick:()=>void ve(),children:[o?e.jsx(Pe,{className:"animate-spin",size:14}):null,s("research.createRun","Create Run")]})]}),e.jsxs("div",{className:"research-view__history-header form-group",children:[e.jsx("label",{htmlFor:"research-run-search",children:s("actions.search","Search")}),e.jsxs("div",{className:"research-view__history-search-row",children:[e.jsx(me,{size:14}),e.jsx("input",{id:"research-run-search",className:"input",placeholder:s("research.searchRunsPlaceholder","Search runs"),value:N,onChange:t=>q(t.target.value)})]})]}),e.jsx("div",{className:"research-view__history","data-testid":"research-state-running",children:g.map(t=>e.jsxs("button",{type:"button",className:`research-view__history-item card${F===t.id?" research-view__history-item--active":""}`,onClick:()=>P(t.id),children:[e.jsx("span",{className:"card-id",children:t.id}),e.jsx("span",{children:t.title})]},t.id))})]})}),e.jsxs("div",{className:"research-view__reader card",children:[E&&e.jsx("p",{"data-testid":"research-state-loading",children:e.jsx(Fe,{label:s("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:s("research.noRunsYet","No research runs yet")}),e.jsxs("div",{className:"research-view__reader-content",children:[r&&e.jsxs("div",{className:"research-view__run-detail",children:[e.jsxs("div",{className:"research-view__status-row",children:[e.jsx("span",{className:fe}),e.jsx("strong",{children:pe})]}),e.jsx("h3",{className:"research-view__run-title",children:r.title}),e.jsx("p",{className:"research-view__run-query",children:r.query}),e.jsx("p",{className:"research-view__run-summary","data-testid":"research-state-results",children:r.results?.summary??s("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:j==="cancel"||j==="retry"||!x.cancelable,onClick:()=>void W("cancel",()=>M(r.id),s("research.runCancelled","Run cancelled")),children:s("actions.cancel","Cancel")}),e.jsx("button",{className:"btn",type:"button",title:x.retryable?void 0:x.blockingReason,disabled:j==="cancel"||j==="retry"||!x.retryable,onClick:()=>void W("retry",()=>T(r.id),s("research.runRetried","Run retried")),children:s("actions.retry","Retry")}),ee.includes("markdown")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-markdown",onClick:()=>void te("markdown"),children:s("research.exportMd","Export MD")}),ee.includes("json")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-json",onClick:()=>void te("json"),children:s("research.exportJson","Export JSON")}),ee.includes("html")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-html",onClick:()=>void te("html"),children:s("research.exportHtml","Export HTML")})]}),r.error&&e.jsx("p",{className:"research-view__error",children:r.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:s("research.openAuthSettings","Open Authentication Settings")}),k.code==="FEATURE_DISABLED"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("research-project"),children:s("research.openResearchSettings","Open Research Settings")})]}),x.blockingReason&&e.jsx("p",{className:"research-view__run-query",children:x.blockingReason}),Array.isArray(r.results?.findings)&&r.results.findings.length>0&&e.jsx("div",{className:"research-view__findings",children:r.results.findings.map((t,u)=>{const m=t.id?.trim()||`finding-${u+1}`;return e.jsxs("article",{className:"research-view__finding card",children:[e.jsx("h4",{children:t.heading}),e.jsx("p",{children:t.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:s("research.createTask","Create Task")}),e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>K({mode:"enrich",findingId:m}),children:s("research.enrichTask","Enrich Task")})]})]},m)})}),Array.isArray(r.results?.citations)&&r.results.citations.length>0&&e.jsx("ul",{className:"research-view__citations",children:r.results.citations.map(t=>e.jsx("li",{children:e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",children:t})},t))}),r.events.length>0&&e.jsxs("details",{children:[e.jsx("summary",{children:s("research.runHistory","Run history")}),e.jsx("ul",{className:"research-view__events",children:r.events.map(t=>e.jsx("li",{children:t.message},t.id))})]})]}),!r&&g.length>0&&e.jsx("p",{children:s("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:s("research.statRunning","Running")}),e.jsx("div",{className:"research-view__stat-value",children:S.running})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statCompleted","Completed")}),e.jsx("div",{className:"research-view__stat-value",children:S.completed})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statFailed","Failed")}),e.jsx("div",{className:"research-view__stat-value",children:S.failed})]})]})]})]})]})}),r&&L&&(()=>{const t=r.results?.findings?.findIndex((f,m)=>(f.id?.trim()||`finding-${m+1}`)===L.findingId)??-1,u=t>=0?r.results.findings[t]:null;return u?e.jsx(Oe,{open:!0,mode:L.mode,run:r,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 W("create-task",()=>U(r.id,m,L.findingId,C,le,oe),s("research.taskCreatedFromResearch","Task created from research")):f&&await W("attach-task",()=>$(r.id,f,L.findingId,oe),s("research.taskEnrichedFromResearch","Task enriched from research")),K(null)}}):null})()]})}export{Je as ResearchView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as ue,B as he,R as q,P as me,D as G,F as Y,G as ye,H as xe,I as ve,J as be,o as je,C as fe}from"./index-Y-vyXPPN.js";import{u as Se}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";const ge="__sync_passphrase__",L={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},n={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Ne={...n,className:"secrets-action-icon spin"},Re=({addToast:d})=>{const{t:a}=Se("app"),[R,z]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,y]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,B]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,F]=c.useState(""),[P,H]=c.useState(""),[ee,I]=c.useState(!1),[E,se]=c.useState(!1),m=c.useRef(new Map),w=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 h=await i.json().catch(()=>({error:"Request failed"}));throw new Error(String(h?.error??"Request failed"))}if(i.status!==204)return i.json()},[]),x=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");z(s.secrets)}catch(s){D(s instanceof Error?s.message:String(s))}finally{M(!1)}},[o]),S=c.useCallback(async()=>{try{const s=await o("/api/secrets/sync-passphrase");X(!!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)),w.current.forEach(s=>clearTimeout(s))}),[x,S]);const k=()=>{_(!1),F(""),H("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{I(!0);try{await ae(f),d?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){d?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{I(!1)}},te=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")}},ce=()=>{O(null),l(L),y(!0),C(!1),b(null)},le=s=>{O(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)},ne=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(L),await x()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=m.current.get(s.id);r&&(clearTimeout(r),m.current.delete(s.id)),j(i=>({...i,[s.id]:null}))},ie=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),h=m.current.get(s.id);h&&clearTimeout(h),m.current.set(s.id,i)},de=async s=>{const r=V[s.id];if(!r)return;await navigator.clipboard.writeText(r),B(s.id),d?.(a("secrets.copied","Copied"),"success");const i=setTimeout(()=>{B(null),j(v=>({...v,[s.id]:null}))},1500),h=w.current.get(s.id);h&&clearTimeout(h),w.current.set(s.id,i)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await x()},$=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===ge)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),J=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(ue,{icon:he,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),children:[e.jsx(q,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(me,{...n})," ",a("secrets.addSecret","Add Secret")]})]})}),A?e.jsx("div",{className:"form-error",children:A}):null,T?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(q,{...Ne})," ",a("secrets.loading","Loading…")]}):null,!T&&$.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:$.map(s=>{const r=V[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){oe(s);return}ie(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(G,{...n}):e.jsx(Y,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void de(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:W===s.id?e.jsx(ye,{...n}):e.jsx(xe,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(be,{...n})})]}),Q===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void pe(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>g(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":E,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>se(s=>!s),children:[E?e.jsx(je,{size:16,"aria-hidden":"true"}):e.jsx(fe,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),E?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${u?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",u?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:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),u?e.jsx("button",{className:"btn btn-danger",onClick:()=>void te(),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.")})]}):null]}),Z?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:k,"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=>F(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=>H(s.target.value)})]}),!J&&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:k,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void re(),disabled:!J||ee,children:u?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(G,{...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,K?e.jsx("div",{className:"form-error",children:K}):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 ne(),children:p?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Re as SecretsView};
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as ue,B as he,R as q,P as me,D as G,F as Y,G as ye,H as xe,I as ve,J as be,o as je,C as fe}from"./index-JlBzf2ck.js";import{u as Se}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";const ge="__sync_passphrase__",L={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},n={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Ne={...n,className:"secrets-action-icon spin"},Re=({addToast:d})=>{const{t:a}=Se("app"),[R,z]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,y]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,B]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,F]=c.useState(""),[P,H]=c.useState(""),[ee,I]=c.useState(!1),[E,se]=c.useState(!1),m=c.useRef(new Map),w=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 h=await i.json().catch(()=>({error:"Request failed"}));throw new Error(String(h?.error??"Request failed"))}if(i.status!==204)return i.json()},[]),x=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");z(s.secrets)}catch(s){D(s instanceof Error?s.message:String(s))}finally{M(!1)}},[o]),S=c.useCallback(async()=>{try{const s=await o("/api/secrets/sync-passphrase");X(!!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)),w.current.forEach(s=>clearTimeout(s))}),[x,S]);const k=()=>{_(!1),F(""),H("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{I(!0);try{await ae(f),d?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){d?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{I(!1)}},te=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")}},ce=()=>{O(null),l(L),y(!0),C(!1),b(null)},le=s=>{O(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)},ne=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(L),await x()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=m.current.get(s.id);r&&(clearTimeout(r),m.current.delete(s.id)),j(i=>({...i,[s.id]:null}))},ie=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),h=m.current.get(s.id);h&&clearTimeout(h),m.current.set(s.id,i)},de=async s=>{const r=V[s.id];if(!r)return;await navigator.clipboard.writeText(r),B(s.id),d?.(a("secrets.copied","Copied"),"success");const i=setTimeout(()=>{B(null),j(v=>({...v,[s.id]:null}))},1500),h=w.current.get(s.id);h&&clearTimeout(h),w.current.set(s.id,i)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await x()},$=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===ge)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),J=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(ue,{icon:he,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),children:[e.jsx(q,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(me,{...n})," ",a("secrets.addSecret","Add Secret")]})]})}),A?e.jsx("div",{className:"form-error",children:A}):null,T?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(q,{...Ne})," ",a("secrets.loading","Loading…")]}):null,!T&&$.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:$.map(s=>{const r=V[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){oe(s);return}ie(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(G,{...n}):e.jsx(Y,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void de(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:W===s.id?e.jsx(ye,{...n}):e.jsx(xe,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(be,{...n})})]}),Q===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void pe(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>g(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":E,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>se(s=>!s),children:[E?e.jsx(je,{size:16,"aria-hidden":"true"}):e.jsx(fe,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),E?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${u?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",u?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:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),u?e.jsx("button",{className:"btn btn-danger",onClick:()=>void te(),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.")})]}):null]}),Z?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:k,"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=>F(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=>H(s.target.value)})]}),!J&&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:k,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void re(),disabled:!J||ee,children:u?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(G,{...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,K?e.jsx("div",{className:"form-error",children:K}):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 ne(),children:p?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Re as SecretsView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-xterm-BNq00GSj.js","assets/vendor-react-SZ_qB27O.js","assets/vendor-xterm-LZoznX6r.css","assets/addon-fit-C1WQXRvu.js","assets/addon-unicode11-BVmNDUBM.js","assets/addon-webgl-uLc0RKcC.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{W as ke,Y as U,$ as oe,a0 as Q,a1 as ae,a2 as ve,a3 as Ee,F as Ce,a4 as V,a5 as Te,a6 as ge,a7 as xe,_ as F,a8 as Ne}from"./index-JlBzf2ck.js";import{r as i,j as t}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as Re}from"./vendor-i18n-GF3RlKbq.js";import{S as je}from"./shield-alert-BdoEg9Yo.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-codemirror-jBKmHyH0.js";const Pe=32*1024,Me=100,De="\x1B",Le=" ",Ae="",Oe="\x1B[A",ze="\x1B[B",Fe="\x1B[C",Be="\x1B[D",B={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function re(u){if(u.length!==1)return null;const o=u.toUpperCase().charCodeAt(0);return o>=64&&o<=95?String.fromCharCode(o&31):null}function Ie(){const[u,f]=i.useState(()=>V());return i.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const o=window.matchMedia(Te),a=window.visualViewport,y=()=>f(V());return y(),typeof a?.addEventListener=="function"&&a.addEventListener("resize",y),typeof o.addEventListener=="function"?(o.addEventListener("change",y),()=>{o.removeEventListener("change",y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)}):(o.addListener(y),()=>{o.removeListener(y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)})},[]),u}function Ke(u,f){if(typeof window>"u")return"";const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(u)}&ticket=${encodeURIComponent(f)}`;return Ne(a)}function We(){return/Mac|iPhone|iPad|iPod/i.test(navigator.platform)}function $e(u){if(typeof window<"u"&&typeof window.atob=="function"){const f=window.atob(u),o=new Uint8Array(f.length);for(let a=0;a<f.length;a++)o[a]=f.charCodeAt(a);return new TextDecoder("utf-8").decode(o)}return Buffer.from(u,"base64").toString("utf8")}function Xe({sessionId:u,readOnly:f=!1,posture:o,mode:a="live",projectId:y,onConfirmAdvance:v,showConfirmAdvance:I=!1,onOpenAdapterSettings:Y}){const{t:r}=Re("app"),E=i.useRef(null),C=i.useRef(null),j=i.useRef(null),S=i.useRef(null),[J,H]=i.useState(!1),[le,K]=i.useState(!1),[G,Z]=i.useState(!1),T=Ie(),{keyboardOpen:D,keyboardOverlap:ce}=ke({enabled:T}),de=i.useRef(null),[_,q]=i.useState(""),[g,L]=i.useState(!1),[X,ee]=i.useState(null),te=f||X===!0,P=!f&&X===!1&&a==="live",b=i.useCallback(e=>{if(!e||!P)return;const n=S.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:"input",data:e}))},[P]),x=i.useCallback(e=>{if(g){const n=re(e);if(L(!1),n){b(n);return}}b(e)},[g,b]),c=i.useCallback(e=>{e.preventDefault()},[]),ue=i.useCallback(e=>{e?.preventDefault?.(),_&&b(_),b("\r"),q("")},[_,b]),me=i.useCallback(e=>{if(g&&e.length>_.length){const n=e.slice(_.length,_.length+1),d=re(n);if(L(!1),d){b(d);return}}q(e)},[g,_,b]);i.useEffect(()=>{I&&K(!1)},[I,u]);const M=i.useCallback((e,n)=>{const d=S.current;d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:e,rows:n}))},[]),ne=i.useCallback(()=>{const e=C.current;if(!e)return;const n=U(),d=oe(n.fontFamily);e.options.fontFamily=d,E.current?.style.setProperty("--terminal-glyph-font-family",Q(n.fontFamily)),e.options.fontSize=n.fontSize,e.options.cursorStyle=n.cursorStyle,e.options.cursorBlink=n.cursorBlink&&P;try{j.current?.fit?.(),M(e.cols,e.rows)}catch{}ae(n.fontSize,d).then(N=>{if(!(!N||C.current!==e||e.options.fontSize!==n.fontSize||e.options.fontFamily!==d)){e.options.fontFamily=d,e.options.fontSize=n.fontSize;try{j.current?.fit?.(),M(e.cols,e.rows),e.refresh(0,Math.max(0,e.rows-1))}catch{}}},()=>{})},[P,M]);i.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.key===ge&&ne()};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[ne]),i.useEffect(()=>{if(!u||typeof window>"u")return;let e=!1,n=null,d=null,N=0;ee(null);const W=M,be=p=>{if(N+=p,N<Pe)return;const h=S.current;h?.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"ack",bytes:N})),N=0};return(async()=>{let p;try{p=await xe(`/cli-sessions/${encodeURIComponent(u)}/attach-ticket`,{method:"POST",body:JSON.stringify(y?{projectId:y}:{})})}catch{return}if(e)return;ee(p.readOnly);const h=!f&&!p.readOnly&&a==="live",[{Terminal:he},{FitAddon:we},{Unicode11Addon:_e}]=await Promise.all([F(()=>import("./vendor-xterm-BNq00GSj.js").then(l=>l.x),__vite__mapDeps([0,1,2])),F(()=>import("./addon-fit-C1WQXRvu.js").then(l=>l.a),__vite__mapDeps([3,1])),F(()=>import("./addon-unicode11-BVmNDUBM.js").then(l=>l.a),__vite__mapDeps([4,1]))]);if(e||!E.current)return;const w=U(),O=oe(w.fontFamily);E.current.style.setProperty("--terminal-glyph-font-family",Q(w.fontFamily));const s=new he({convertEol:!1,cursorBlink:w.cursorBlink&&h,cursorStyle:w.cursorStyle,disableStdin:!h,scrollback:1e4,fontFamily:O,fontSize:w.fontSize}),R=new we;s.loadAddon(R);const Se=new _e;if(s.loadAddon(Se),s.unicode.activeVersion="11",s.open(E.current),C.current=s,j.current=R,w.renderer==="auto"&&!V())try{const{WebglAddon:l}=await F(async()=>{const{WebglAddon:m}=await import("./addon-webgl-uLc0RKcC.js").then(k=>k.a);return{WebglAddon:m}},__vite__mapDeps([5,1]));if(!e){const m=new l;m.onContextLoss(()=>{try{m.dispose()}catch{}}),s.loadAddon(m)}}catch{}try{R.fit()}catch{}(async()=>{if(!(!await ae(w.fontSize,O)||e||C.current!==s||j.current!==R||s.options.fontSize!==w.fontSize||s.options.fontFamily!==O))try{s.options.fontFamily=O,s.options.fontSize=w.fontSize,R.fit(),W(s.cols,s.rows),s.refresh(0,Math.max(0,s.rows-1))}catch{}})(),h&&(s.onData(l=>{const m=S.current;m?.readyState===WebSocket.OPEN&&m.send(JSON.stringify({type:"input",data:l}))}),s.attachCustomKeyEventHandler(l=>{if(l.type!=="keydown"||!(We()?l.metaKey:l.ctrlKey)||l.altKey||l.shiftKey)return!0;const k=l.key.toLowerCase();if(k==="c"){const z=s.hasSelection()?s.getSelection():"";return z?(navigator.clipboard?.writeText(z).catch(()=>{}),!1):!0}return!0})),n=new ResizeObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{try{R.fit(),W(s.cols,s.rows)}catch{}},Me)}),n.observe(E.current);const $=new WebSocket(Ke(u,p.ticket));S.current=$,$.onopen=()=>{W(s.cols,s.rows)},$.onmessage=l=>{let m;try{m=JSON.parse(typeof l.data=="string"?l.data:"")}catch{return}switch(m.type){case"scrollback":case"data":{if(typeof m.data!="string")return;const k=$e(m.data),z=k.length;s.write(k,()=>be(z));break}}}})(),()=>{e=!0,d&&clearTimeout(d),n&&n.disconnect();const p=S.current;if(p){p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null;try{p.close()}catch{}S.current=null}const h=C.current;if(h){try{h.dispose()}catch{}C.current=null}j.current=null}},[u,f,a,y,M]);const ie=i.useMemo(()=>a==="idle"?r("cliTerminal.replayIdle","Session idle"):a==="ended"?r("cliTerminal.replayEnded","Session ended"):null,[a,r]),fe=i.useCallback(async()=>{if(v){Z(!0);try{await v("advance"),K(!0)}finally{Z(!1)}}},[v]),pe=i.useCallback(async()=>{v&&await v("not-yet"),K(!0)},[v]),A=!!o?.elevated,se=o?.elevatedFlags?.join(", "),ye={"--terminal-glyph-font-family":Q(U().fontFamily)};return t.jsxs("div",{className:`cli-session-terminal${T?" cli-session-terminal--mobile":""}${T&&D?" cli-session-terminal--keyboard-open":""}`,"data-mode":a,"data-read-only":te,"data-mobile":T,"data-keyboard-open":T&&D,children:[t.jsxs("header",{className:"cli-session-terminal__header",children:[o&&t.jsxs("div",{className:"cli-session-terminal__posture-wrap",children:[t.jsxs("button",{type:"button",className:`cli-posture-chip${A?" cli-posture-chip--elevated":""}`,"data-elevated":A,"aria-expanded":J,onClick:()=>H(e=>!e),children:[A?t.jsx(je,{size:13,"aria-hidden":"true"}):t.jsx(ve,{size:13,"aria-hidden":"true"}),t.jsx("span",{className:"cli-posture-chip__name",children:o.adapterName}),o.mode&&t.jsx("span",{className:"cli-posture-chip__mode",children:o.mode}),A&&se&&t.jsx("span",{className:"cli-posture-chip__flag",children:se})]}),J&&t.jsxs("div",{className:"cli-posture-tooltip",role:"tooltip",children:[t.jsx("p",{className:"cli-posture-tooltip__title",children:r("cliTerminal.postureResolved","Resolved posture")}),t.jsxs("ul",{className:"cli-posture-tooltip__list",children:[(o.resolved??[]).map((e,n)=>t.jsx("li",{children:e},n)),(o.resolved??[]).length===0&&t.jsx("li",{children:o.mode??r("cliTerminal.postureBaseline","Baseline")})]}),Y&&t.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{H(!1),Y()},children:[t.jsx(Ee,{size:12,"aria-hidden":"true"}),r("cliTerminal.adapterSettings","Adapter settings")]})]})]}),te&&t.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[t.jsx(Ce,{size:12,"aria-hidden":"true"}),r("cliTerminal.readOnly","Read-only")]}),ie&&t.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":a,children:ie})]}),t.jsx("div",{className:"cli-session-terminal__viewport",ref:E,"data-testid":"cli-terminal-viewport",style:ye}),I&&!le&&t.jsxs("div",{className:"cli-session-terminal__advance-strip",role:"region",children:[t.jsx("span",{className:"cli-session-terminal__advance-copy",children:r("cliTerminal.advancePrompt","This session looks idle — advance to review?")}),t.jsxs("div",{className:"cli-session-terminal__advance-actions",children:[t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn",disabled:G,onClick:fe,children:r("cliTerminal.advance","Advance")}),t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:G,onClick:pe,children:r("cliTerminal.notYet","Not yet")})]})]}),T&&P&&t.jsxs("div",{className:`cli-session-terminal__mobile-bar${D?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:D?{bottom:`${ce}px`}:void 0,children:[t.jsxs("div",{className:"cli-session-terminal__key-row","data-testid":"cli-terminal-key-bar",children:[t.jsx("button",{type:"button",className:`cli-terminal-key cli-terminal-key--ctrl${g?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":r("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":g,onPointerDown:c,onMouseDown:c,onClick:()=>L(e=>!e),children:B.ctrl}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":r("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:c,onMouseDown:c,onClick:()=>x(De),children:B.escape}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":r("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:c,onMouseDown:c,onClick:()=>x(Le),children:B.tab}),t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--ctrlc","data-testid":"cli-key-ctrl-c","aria-label":r("cliTerminal.mobileKeyCtrlC","Send Ctrl-C"),onPointerDown:c,onMouseDown:c,onClick:()=>{L(!1),b(Ae)},children:B.ctrlC}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":r("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:c,onMouseDown:c,onClick:()=>x(Oe),children:"↑"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":r("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:c,onMouseDown:c,onClick:()=>x(ze),children:"↓"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":r("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:c,onMouseDown:c,onClick:()=>x(Be),children:"←"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":r("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:c,onMouseDown:c,onClick:()=>x(Fe),children:"→"})]}),t.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:ue,children:[t.jsx("input",{ref:de,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:_,placeholder:r("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:e=>me(e.target.value)}),t.jsx("button",{type:"submit",className:"cli-session-terminal__mobile-send","data-testid":"cli-terminal-mobile-send","aria-label":r("cliTerminal.mobileSend","Send"),onPointerDown:c,onMouseDown:c,children:r("cliTerminal.mobileSend","Send")})]})]})]})}export{Xe as SessionTerminal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-SZ_qB27O.js";import{z as C}from"./index-
|
|
1
|
+
import{r as e}from"./vendor-react-SZ_qB27O.js";import{z as C}from"./index-JlBzf2ck.js";function L(k={}){const{projectId:d,pollInterval:b=6e4,autoRefresh:p=!1,enabled:t=!0}=k,[S,o]=e.useState(null),[m,l]=e.useState(t),[E,c]=e.useState(null),[R,v]=e.useState(null),r=e.useRef(null),n=e.useRef(null),a=e.useRef(!0),s=e.useCallback(async()=>{if(!t){l(!1),c(null),o(null);return}r.current&&r.current.abort(),r.current=new AbortController,l(!0),c(null),o(null);try{const u=await C(d);if(!a.current)return;o(u),c(null),v(new Date),l(!1)}catch(u){if(u instanceof Error&&u.name==="AbortError"||!a.current)return;const A=u instanceof Error?u.message:"Failed to fetch memory backend status";c(A),l(!1)}},[t,d]);e.useEffect(()=>(a.current=!0,t?(s(),()=>{a.current=!1}):(r.current&&r.current.abort(),o(null),c(null),l(!1),()=>{a.current=!1})),[t,s]),e.useEffect(()=>{if(!(!t||!p))return n.current=setInterval(()=>{s()},b),()=>{n.current&&(clearInterval(n.current),n.current=null)}},[t,p,b,s]),e.useEffect(()=>()=>{a.current=!1,r.current&&r.current.abort(),n.current&&(clearInterval(n.current),n.current=null)},[]);const h=e.useCallback(()=>s(),[s]),f=m?null:S,B=f?.currentBackend??null,i=f?.capabilities??null,y=f?.availableBackends??[],I=i?.readable??!1,g=i?.writable??!1,w=i?.supportsAtomicWrite??!1;return{status:f,currentBackend:B,capabilities:i,availableBackends:y,isReadable:I,isWritable:g,supportsAtomicWrite:w,loading:m,error:E,lastUpdated:R,refresh:h}}export{L as u};
|