@runfusion/fusion 0.58.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +2 -3
  2. package/dist/bin.js +16894 -14563
  3. package/dist/client/.vite/manifest.json +247 -244
  4. package/dist/client/assets/AgentDetailView-UmilJU0C.js +18 -0
  5. package/dist/client/assets/{AgentPermissionPolicyEditor-3x5cc2cp.js → AgentPermissionPolicyEditor-DqYOX1kN.js} +1 -1
  6. package/dist/client/assets/{AgentsView-B77vHi_7.js → AgentsView-Dt0nKyx7.js} +4 -4
  7. package/dist/client/assets/ChatView-C7trV16u.js +6 -0
  8. package/dist/client/assets/CommandCenter-DSrIaOro.css +1 -0
  9. package/dist/client/assets/CommandCenter-Dsg16_mK.js +99 -0
  10. package/dist/client/assets/{DevServerView-BXmkO05R.js → DevServerView-DnpnAU_g.js} +1 -1
  11. package/dist/client/assets/{DirectoryPicker-CZ3EXSE5.js → DirectoryPicker-BzpWdpTC.js} +1 -1
  12. package/dist/client/assets/{DocumentsView-BSWFgTsC.css → DocumentsView-BSC7wh2B.css} +1 -1
  13. package/dist/client/assets/{DocumentsView-GlAyW64J.js → DocumentsView-C2jRDIo6.js} +2 -2
  14. package/dist/client/assets/{EvalsView-BLmcsNNf.js → EvalsView-M1nIXx-S.js} +1 -1
  15. package/dist/client/assets/ExperimentalAgentOnboardingModal-5Kg2iQtB.js +1 -0
  16. package/dist/client/assets/{GoalsView-BRfZ4qGe.js → GoalsView-7bFpy-lr.js} +1 -1
  17. package/dist/client/assets/InsightsView-D0HPy3RP.js +11 -0
  18. package/dist/client/assets/{MemoryView-ChkuBpUf.js → MemoryView-CNzJcoPi.js} +2 -2
  19. package/dist/client/assets/{PiExtensionsManager-DXwQdB7b.js → PiExtensionsManager-D0a8Q47c.js} +1 -1
  20. package/dist/client/assets/{PluginManager-B8zAjhqf.js → PluginManager-N2Ne57i_.js} +1 -1
  21. package/dist/client/assets/{PullRequestView-DL1E1ixh.js → PullRequestView-Be4GM2H5.js} +2 -2
  22. package/dist/client/assets/{ResearchView-BCYCHiyQ.js → ResearchView-DYW9ViMl.js} +1 -1
  23. package/dist/client/assets/SecretsView-B3jEFeGp.js +1 -0
  24. package/dist/client/assets/{SessionTerminal-BvK8A98c.css → SessionTerminal-CDTiqrd7.css} +1 -1
  25. package/dist/client/assets/SessionTerminal-DGFADOH4.js +2 -0
  26. package/dist/client/assets/SettingsModal-CtOCCZEj.js +21 -0
  27. package/dist/client/assets/{SettingsModal-U7ma-5OU.js → SettingsModal-Lw0RmeRd.js} +1 -1
  28. package/dist/client/assets/{SetupWizardModal-BCDoA33s.js → SetupWizardModal-BifMmJIa.js} +2 -2
  29. package/dist/client/assets/{ShadcnColorPicker-EVU2cXpo.js → ShadcnColorPicker-B1UClHqm.js} +2 -2
  30. package/dist/client/assets/{SkillsView-V48VsthB.js → SkillsView--U-5lH1V.js} +1 -1
  31. package/dist/client/assets/TodoView-BwxNdIXm.js +6 -0
  32. package/dist/client/assets/TodoView-CUD4xw3T.css +1 -0
  33. package/dist/client/assets/WorkflowNodeEditor-BmTZR0i8.js +8 -0
  34. package/dist/client/assets/{agentSkills-B-QDeW2q.js → agentSkills-PqEK0Uf_.js} +1 -1
  35. package/dist/client/assets/{app-SucmTDhV.js → app-BlgX3hw4.js} +3 -3
  36. package/dist/client/assets/{app-RIK4I745.js → app-C7eDKtXM.js} +3 -3
  37. package/dist/client/assets/{app-SHNioZxk.js → app-CL1Ik1qS.js} +3 -3
  38. package/dist/client/assets/{app-De_pkbYi.js → app-Ckb9wA3K.js} +3 -3
  39. package/dist/client/assets/{app-cZgmPvs6.js → app-Den3D7oy.js} +3 -3
  40. package/dist/client/assets/{app--U62_ZWS.js → app-nAsTBQMW.js} +3 -3
  41. package/dist/client/assets/{architectureDiagram-3BPJPVTR-DvR35aCH.js → architectureDiagram-3BPJPVTR-DxAKryer.js} +1 -1
  42. package/dist/client/assets/{blockDiagram-GPEHLZMM-ciQdpSqc.js → blockDiagram-GPEHLZMM-BfPC7WG4.js} +1 -1
  43. package/dist/client/assets/{c4Diagram-AAUBKEIU-CV0Z6UEL.js → c4Diagram-AAUBKEIU-DnVJBAB1.js} +1 -1
  44. package/dist/client/assets/channel-D23u9xEh.js +1 -0
  45. package/dist/client/assets/{chunk-2J33WTMH-CkAQRX3g.js → chunk-2J33WTMH-2LaGYtnx.js} +1 -1
  46. package/dist/client/assets/{chunk-4BX2VUAB-CJXvYVcN.js → chunk-4BX2VUAB-C7xxOb1T.js} +1 -1
  47. package/dist/client/assets/{chunk-55IACEB6-DOv0lN1u.js → chunk-55IACEB6-CAxHAFXx.js} +1 -1
  48. package/dist/client/assets/{chunk-727SXJPM-tRsHXz7i.js → chunk-727SXJPM-CnZuaU-I.js} +1 -1
  49. package/dist/client/assets/{chunk-AQP2D5EJ-CfzOMXn9.js → chunk-AQP2D5EJ-DutKSMk1.js} +1 -1
  50. package/dist/client/assets/{chunk-FMBD7UC4-BKvUZ2cn.js → chunk-FMBD7UC4-C7PQ58jc.js} +1 -1
  51. package/dist/client/assets/{chunk-ND2GUHAM-FqiVnW7u.js → chunk-ND2GUHAM-BQ0UHfJw.js} +1 -1
  52. package/dist/client/assets/{chunk-QZHKN3VN-BAJDyCpZ.js → chunk-QZHKN3VN-BadmXu1v.js} +1 -1
  53. package/dist/client/assets/classDiagram-4FO5ZUOK-BMIDIijD.js +1 -0
  54. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BMIDIijD.js +1 -0
  55. package/dist/client/assets/{cose-bilkent-S5V4N54A-DYizdcNp.js → cose-bilkent-S5V4N54A-37z9Hx7d.js} +1 -1
  56. package/dist/client/assets/{dagre-BM42HDAG-BDWwvXJx.js → dagre-BM42HDAG-B70rt1ZW.js} +1 -1
  57. package/dist/client/assets/{dashboard-view-BYn_jRw9.js → dashboard-view-DdAL0vfN.js} +1 -1
  58. package/dist/client/assets/{dashboard-view-DmfIFCV-.js → dashboard-view-GT7dDNd7.js} +1 -1
  59. package/dist/client/assets/{diagram-2AECGRRQ-C8ic2E9q.js → diagram-2AECGRRQ-se4pabEk.js} +1 -1
  60. package/dist/client/assets/{diagram-5GNKFQAL-H5IDcv9E.js → diagram-5GNKFQAL-ijyxpVgX.js} +1 -1
  61. package/dist/client/assets/{diagram-KO2AKTUF-DkczJXd6.js → diagram-KO2AKTUF-DUGQ8jXI.js} +1 -1
  62. package/dist/client/assets/{diagram-LMA3HP47-P1vh7RIU.js → diagram-LMA3HP47-BYydC37K.js} +1 -1
  63. package/dist/client/assets/{diagram-OG6HWLK6-CgeybA5t.js → diagram-OG6HWLK6-DlUn5jkD.js} +1 -1
  64. package/dist/client/assets/{erDiagram-TEJ5UH35-DSJa4zRQ.js → erDiagram-TEJ5UH35-ChYKGDIc.js} +1 -1
  65. package/dist/client/assets/{flowDiagram-I6XJVG4X-DG91ZWS9.js → flowDiagram-I6XJVG4X-CoQKr6ba.js} +1 -1
  66. package/dist/client/assets/{folder-open-iGyAYoN-.js → folder-open-YuIEuDwd.js} +1 -1
  67. package/dist/client/assets/{ganttDiagram-6RSMTGT7-dkOQjOK8.js → ganttDiagram-6RSMTGT7-Cff6URun.js} +1 -1
  68. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-GqrJtmDT.js → gitGraphDiagram-PVQCEYII-CnlZVE6T.js} +1 -1
  69. package/dist/client/assets/index-C2HFa2A-.css +1 -0
  70. package/dist/client/assets/index-aBQwNV_I.js +2540 -0
  71. package/dist/client/assets/{infoDiagram-5YYISTIA-BfFhhqbU.js → infoDiagram-5YYISTIA-DYLBAKrj.js} +1 -1
  72. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-DBBV-PIS.js → ishikawaDiagram-YF4QCWOH-7xSxQNhn.js} +1 -1
  73. package/dist/client/assets/{journeyDiagram-JHISSGLW-xZisXOgZ.js → journeyDiagram-JHISSGLW-DREqJGeQ.js} +1 -1
  74. package/dist/client/assets/{kanban-definition-UN3LZRKU-CbOJloOw.js → kanban-definition-UN3LZRKU-_lzeYhpL.js} +1 -1
  75. package/dist/client/assets/{mermaid.core-DKBiVV3q.js → mermaid.core-DNTJMy0V.js} +4 -4
  76. package/dist/client/assets/{mindmap-definition-RKZ34NQL-Bf9V63ac.js → mindmap-definition-RKZ34NQL-DR9UulDp.js} +1 -1
  77. package/dist/client/assets/{pieDiagram-4H26LBE5-0ukMaTVl.js → pieDiagram-4H26LBE5-DD1LCdSp.js} +1 -1
  78. package/dist/client/assets/{puzzle-BvEf9PLH.js → puzzle-DaVSYDOd.js} +1 -1
  79. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-CwXZAtYI.js → quadrantDiagram-W4KKPZXB-iLEGylFT.js} +1 -1
  80. package/dist/client/assets/{requirementDiagram-4Y6WPE33-DVsu9t-w.js → requirementDiagram-4Y6WPE33-D7IX9UbY.js} +1 -1
  81. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-DOJUnv7J.js → sankeyDiagram-5OEKKPKP-DC30taEV.js} +1 -1
  82. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-B67g0g9m.js → sequenceDiagram-3UESZ5HK-DjMKbjmL.js} +1 -1
  83. package/dist/client/assets/{shield-alert-4FPCIFZ2.js → shield-alert-BcyPZs5t.js} +1 -1
  84. package/dist/client/assets/{stateDiagram-AJRCARHV-CPPa0bHh.js → stateDiagram-AJRCARHV-DJSnSkUL.js} +1 -1
  85. package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-Dyj14elw.js → stateDiagram-v2-BHNVJYJU-KC2rSU3J.js} +1 -1
  86. package/dist/client/assets/{timeline-definition-PNZ67QCA-UVWf2E8M.js → timeline-definition-PNZ67QCA-5DyrH8WZ.js} +1 -1
  87. package/dist/client/assets/{upload-BkgVjwwc.js → upload-C_8IHSzk.js} +1 -1
  88. package/dist/client/assets/{users-9nCT4liw.js → users-DfGiwmqG.js} +1 -1
  89. package/dist/client/assets/{vennDiagram-CIIHVFJN-CqGrv1wQ.js → vennDiagram-CIIHVFJN-Bh5X-uVf.js} +1 -1
  90. package/dist/client/assets/{wardley-L42UT6IY-aA0pos_F.js → wardley-L42UT6IY-ZIwV-wIZ.js} +1 -1
  91. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-C-O5tD1L.js → wardleyDiagram-YWT4CUSO-DI92L1jA.js} +1 -1
  92. package/dist/client/assets/{xychartDiagram-2RQKCTM6-qoIF674C.js → xychartDiagram-2RQKCTM6-B6RjJCM8.js} +1 -1
  93. package/dist/client/index.html +2 -2
  94. package/dist/client/version.json +1 -1
  95. package/dist/droid-cli/package.json +1 -1
  96. package/dist/extension.js +12961 -11668
  97. package/dist/pi-claude-cli/package.json +1 -1
  98. package/dist/plugin-sdk/index.d.ts +20 -1
  99. package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +4 -1
  100. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  101. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  102. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  103. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  104. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  105. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  106. package/dist/plugins/fusion-plugin-grok-runtime/bundled.js +4 -1
  107. package/dist/plugins/fusion-plugin-grok-runtime/package.json +1 -1
  108. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  109. package/dist/plugins/fusion-plugin-linear-import/package.json +1 -1
  110. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  111. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  112. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  113. package/dist/plugins/fusion-plugin-reports/src/dashboard/components/ShareBlocksPanel.tsx +4 -1
  114. package/dist/plugins/fusion-plugin-reports/src/dashboard/components/__tests__/ShareBlocksPanel.test.tsx +41 -2
  115. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  116. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  117. package/package.json +1 -1
  118. package/skill/fusion/SKILL.md +1 -1
  119. package/skill/fusion/references/engine-tools.md +1 -0
  120. package/skill/fusion/references/extension-tools.md +10 -0
  121. package/skill/fusion/references/fusion-capabilities.md +1 -0
  122. package/dist/client/assets/AgentDetailView-whCXABbu.js +0 -18
  123. package/dist/client/assets/ChatView-CninsTIm.js +0 -6
  124. package/dist/client/assets/CommandCenter-B9q-zM9p.css +0 -1
  125. package/dist/client/assets/CommandCenter-C6LmdUin.js +0 -71
  126. package/dist/client/assets/ExperimentalAgentOnboardingModal-DvDix9pH.js +0 -1
  127. package/dist/client/assets/InsightsView-X4RlcgrU.js +0 -11
  128. package/dist/client/assets/SecretsView-B48BIZKw.js +0 -1
  129. package/dist/client/assets/SessionTerminal-CUyYlq16.js +0 -2
  130. package/dist/client/assets/SettingsModal-DbjBoUYD.js +0 -21
  131. package/dist/client/assets/TodoView-DmpJmxu7.css +0 -1
  132. package/dist/client/assets/TodoView-MZ9Pfl65.js +0 -6
  133. package/dist/client/assets/WorkflowNodeEditor-B95Dvf-O.js +0 -8
  134. package/dist/client/assets/channel-Y_Uhrtqx.js +0 -1
  135. package/dist/client/assets/classDiagram-4FO5ZUOK-DhicwSPE.js +0 -1
  136. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DhicwSPE.js +0 -1
  137. package/dist/client/assets/index-Bg8SMXUs.css +0 -1
  138. package/dist/client/assets/index-DO9Ch72Y.js +0 -2544
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-SZ_qB27O.js";import{m as C}from"./index-DO9Ch72Y.js";function L(k={}){const{projectId:d,pollInterval:b=6e4,autoRefresh:m=!1,enabled:t=!0}=k,[S,o]=e.useState(null),[p,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||!m))return n.current=setInterval(()=>{s()},b),()=>{n.current&&(clearInterval(n.current),n.current=null)}},[t,m,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=p?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:p,error:E,lastUpdated:R,refresh:h}}export{L as u};
1
+ import{r as e}from"./vendor-react-SZ_qB27O.js";import{m as C}from"./index-aBQwNV_I.js";function L(k={}){const{projectId:d,pollInterval:b=6e4,autoRefresh:m=!1,enabled:t=!0}=k,[S,o]=e.useState(null),[p,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||!m))return n.current=setInterval(()=>{s()},b),()=>{n.current&&(clearInterval(n.current),n.current=null)}},[t,m,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=p?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:p,error:E,lastUpdated:R,refresh:h}}export{L as u};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalAgentOnboardingModal-DvDix9pH.js","assets/vendor-react-SZ_qB27O.js","assets/index-DO9Ch72Y.js","assets/vendor-i18n-GF3RlKbq.js","assets/vendor-reactflow-9C3XTE7_.js","assets/vendor-reactflow-C5ap-Sga.css","assets/vendor-codemirror-jBKmHyH0.js","assets/vendor-xterm-BNq00GSj.js","assets/vendor-xterm-LZoznX6r.css","assets/index-Bg8SMXUs.css","assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css"])))=>i.map(i=>d[i]);
2
- import{v as h,a0 as P,a1 as E,a2 as ie,a3 as oe,a4 as le,a5 as de,a6 as ce,a7 as pe,X as ue,L as z,e as me,a8 as F,S as ge,a9 as T,aa as he,_ as xe}from"./index-DO9Ch72Y.js";import{r as o,j as e}from"./vendor-react-SZ_qB27O.js";import{D as je}from"./DirectoryPicker-CZ3EXSE5.js";import{s as I}from"./projectDetection-G3XuxD2X.js";import{u as fe}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-xterm-BNq00GSj.js";import"./folder-open-iGyAYoN-.js";function U(d){return d.filter(p=>p.type!=="local")}function we(d){return U(d).length>0}function A(d){const p=d.replace(/[^a-zA-Z]/g,"").toUpperCase();return p.length>=2&&p.length<=4?p:p.length>4?p.slice(0,4):"FN"}const Ne=o.lazy(()=>xe(()=>import("./ExperimentalAgentOnboardingModal-DvDix9pH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(d=>({default:d.ExperimentalAgentOnboardingModal})));function Re({onProjectRegistered:d,onClose:p,agentOnboardingEnabled:R=!1,includeAgentStep:x=!0}){const{t:s}=fe("app"),W="https://discord.gg/ksrfuy7WYR",w=o.useMemo(()=>P("ceo")??h[0],[]),[H,L]=o.useState(!0),[t,i]=o.useState(()=>({step:"manual",manualMode:"existing",manualPath:"",manualCloneUrl:"",manualName:"",manualIsolationMode:"in-process",manualNodeId:"",manualTaskPrefix:"",detectedRepos:[],workspaceMode:!1,isDetectingWorkspace:!1,registeredProject:null,selectedPresetId:w.id,agentDraft:E(w),isCreatingAgent:!1,isRegistering:!1,error:null,agentError:null,agentOutcome:null})),[D,O]=o.useState(!1),[M,N]=o.useState(!1),S=o.useRef(null),{nodes:y,loading:_}=ie(),B=y.find(a=>a.type==="local")?.id,b=o.useCallback(()=>{L(!1),p?.()},[p]),G=o.useCallback(()=>{if(t.registeredProject){d(t.registeredProject);return}b()},[b,d,t.registeredProject]);o.useEffect(()=>{t.agentError&&S.current?.focus()},[t.agentError]);const j=o.useRef(0),$=o.useCallback(a=>{if(i(r=>{const n={manualPath:a,detectedRepos:[],workspaceMode:!1,error:null};a&&(!r.manualName||r.manualName===I(r.manualPath))&&(n.manualName=I(a));const l=n.manualName??r.manualName;return l&&(!r.manualTaskPrefix||r.manualTaskPrefix===A(I(r.manualPath)))&&(n.manualTaskPrefix=A(l)),{...r,...n}}),t.manualMode==="existing"&&a.trim()&&a.trim()!=="/"){const r=++j.current;i(n=>({...n,isDetectingWorkspace:!0})),oe(a.trim()).then(n=>{r===j.current&&i(l=>({...l,isDetectingWorkspace:!1,detectedRepos:n.repos,workspaceMode:n.isWorkspace}))}).catch(()=>{r===j.current&&i(n=>({...n,isDetectingWorkspace:!1}))})}},[t.manualMode]),k=o.useCallback(a=>{i(r=>({...r,manualMode:a,manualCloneUrl:a==="clone"?r.manualCloneUrl:"",detectedRepos:a==="existing"?r.detectedRepos:[],workspaceMode:a==="existing"?r.workspaceMode:!1,isDetectingWorkspace:!1,error:null})),j.current+=1},[]),Y=o.useCallback(async()=>{const a=t.manualPath.trim(),r=t.manualName.trim(),n=t.manualCloneUrl.trim();if(!(!a||!r)&&!(t.manualMode==="clone"&&!n)){i(l=>({...l,isRegistering:!0,error:null}));try{const l={name:r,path:a,isolationMode:t.manualIsolationMode,nodeId:t.manualNodeId||void 0,gitSetupMode:t.manualMode,cloneUrl:t.manualMode==="clone"?n:void 0,workspaceMode:t.manualMode==="existing"?t.workspaceMode:!1,taskPrefix:t.manualTaskPrefix.trim()||void 0},c=await le(l);if(!x){i(g=>({...g,isRegistering:!1})),d(c);return}i(g=>({...g,step:"agent",registeredProject:c,isRegistering:!1}))}catch(l){i(c=>({...c,isRegistering:!1,error:l instanceof Error?l.message:"Failed to register project"}))}}},[x,d,t.manualPath,t.manualName,t.manualCloneUrl,t.manualMode,t.manualIsolationMode,t.manualNodeId,t.workspaceMode,t.manualTaskPrefix]),v=o.useCallback(a=>{const r=P(a);r&&i(n=>({...n,selectedPresetId:r.id,agentDraft:E(r),agentError:null}))},[]),q=o.useCallback((a,r)=>{const n=h.findIndex(ne=>ne.id===r);if(n<0)return;const l=h.length-1;let c=null;if(a.key==="ArrowDown"||a.key==="ArrowRight"?c=n===l?0:n+1:a.key==="ArrowUp"||a.key==="ArrowLeft"?c=n===0?l:n-1:a.key==="Home"?c=0:a.key==="End"&&(c=l),c===null)return;a.preventDefault();const g=h[c];v(g.id),requestAnimationFrame(()=>{document.querySelector(`[data-agent-preset-id="${g.id}"]`)?.focus()})},[v]),K=o.useCallback(a=>{i(r=>({...r,selectedPresetId:"",agentDraft:de(a),agentError:null}))},[]),Z=o.useCallback(async()=>{if(!(!t.registeredProject||!t.agentDraft.name.trim())){i(a=>({...a,isCreatingAgent:!0,agentError:null}));try{await ce(pe(t.agentDraft),t.registeredProject.id),i(a=>({...a,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}))}catch(a){if(a instanceof Error&&/already exists/i.test(a.message)){i(r=>({...r,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}));return}i(r=>({...r,isCreatingAgent:!1,agentError:a instanceof Error?a.message:s("setup.firstAgentCreateError","Failed to create agent")}))}}},[t.agentDraft,t.registeredProject,s]),V=o.useCallback(()=>{i(a=>({...a,step:"complete",agentError:null,agentOutcome:"skipped"}))},[]);if(!H)return null;const C=t.manualMode==="existing",m=t.manualMode==="init",u=t.manualMode==="clone",X=u?s("setup.cloneAndRegisterProject","Clone and Register Project"):m?s("setup.initializeAndRegisterProject","Initialize and Register Project"):s("setup.registerProject","Register Project"),J=t.manualPath.trim().length>0,Q=t.manualName.trim().length>0,ee=t.manualCloneUrl.trim().length>0,te=t.isRegistering||!J||!Q||u&&!ee,se=t.selectedPresetId?P(t.selectedPresetId):void 0,f=t.isCreatingAgent,ae=t.selectedPresetId||w.id,re=`modal setup-wizard-modal${t.step==="agent"?" setup-wizard-modal--agent":""}`;return e.jsxs("div",{className:"modal-overlay open setup-wizard-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"wizard-title",children:[e.jsxs("div",{className:re,children:[e.jsxs("div",{className:"setup-wizard-header",children:[e.jsxs("div",{className:"setup-wizard-heading",children:[e.jsxs("div",{className:"setup-wizard-brand","aria-label":s("setup.brandName","Fusion"),children:[e.jsxs("svg",{className:"setup-wizard-brand-logo",width:28,height:28,viewBox:"0 0 128 128",fill:"none","aria-label":s("setup.brandLogo","Fusion logo"),role:"img",children:[e.jsx("circle",{cx:"64",cy:"64",r:"52",stroke:"currentColor",strokeWidth:"8"}),e.jsx("path",{d:"M26 101C44 82 62 64 82 45C90 37 98 30 104 24C96 35 89 47 81 60C70 79 57 95 43 108C38 112 32 108 26 101Z",fill:"currentColor"})]}),e.jsx("span",{className:"setup-wizard-brand-name",children:s("setup.brandName","Fusion")})]}),!x&&t.step==="manual"&&e.jsx("span",{className:"setup-wizard-step-context",children:s("setup.projectStepContext","Step 3 of 5 — Project · Fusion setup")}),e.jsxs("h2",{id:"wizard-title",className:"setup-wizard-title",children:[t.step==="manual"&&(x?s("setup.welcomeToFusion","Welcome to Fusion"):s("setup.titleSetUpProject","Set Up Your Project")),t.step==="agent"&&s("setup.firstAgentTitle","Create your first agent"),t.step==="complete"&&s("setup.setupCompleteTitle","Setup Complete!")]})]}),t.step!=="complete"&&t.step!=="agent"&&e.jsx("button",{className:"modal-close",onClick:b,"aria-label":s("setup.closeWizard","Close wizard"),children:e.jsx(ue,{size:20})})]}),e.jsxs("div",{className:"setup-wizard-content",children:[t.step==="manual"&&e.jsxs("div",{className:"setup-wizard-manual",children:[e.jsxs("section",{className:"setup-wizard-repository-section","aria-labelledby":"setup-repository-mode-title",children:[e.jsxs("div",{className:"setup-wizard-section-heading",children:[e.jsx("h3",{id:"setup-repository-mode-title",children:s("setup.repositorySetupTitle","Repository setup")}),e.jsx("p",{children:s("setup.repositorySetupDescription","Choose how Fusion should prepare the project directory before registration.")})]}),e.jsxs("fieldset",{className:"setup-wizard-mode-switch","aria-label":s("setup.projectSetupModeAriaLabel","Project setup mode"),children:[e.jsx("legend",{children:s("setup.setupMode","Setup Mode")}),e.jsxs("label",{className:`setup-wizard-mode-option${C?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"existing","aria-label":s("setup.useExistingDirectory","Use Existing Directory"),checked:C,onChange:()=>k("existing")}),e.jsxs("span",{className:"setup-wizard-mode-option-copy",children:[e.jsx("strong",{children:s("setup.useExistingDirectory","Use Existing Directory")}),e.jsx("span",{children:s("setup.useExistingDirectoryHint","Register a folder that is already a git repository or workspace root.")})]})]}),e.jsxs("label",{className:`setup-wizard-mode-option${m?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"init","aria-label":s("setup.initializeNewRepository","Initialize New Repository"),checked:m,onChange:()=>k("init")}),e.jsxs("span",{className:"setup-wizard-mode-option-copy",children:[e.jsx("strong",{children:s("setup.initializeNewRepository","Initialize New Repository")}),e.jsx("span",{children:s("setup.initializeNewRepositoryHint","Register a selected non-git folder and let Fusion run git init on the server.")})]})]}),e.jsxs("label",{className:`setup-wizard-mode-option${u?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"clone","aria-label":s("setup.cloneGitRepository","Clone Git Repository"),checked:u,onChange:()=>k("clone")}),e.jsxs("span",{className:"setup-wizard-mode-option-copy",children:[e.jsx("strong",{children:s("setup.cloneGitRepository","Clone Git Repository")}),e.jsx("span",{children:s("setup.cloneGitRepositoryHint","Clone a remote repository into an empty or absent destination folder.")})]})]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-path",children:u?s("setup.destinationDirectory","Destination Directory"):m?s("setup.newRepositoryDirectory","New Repository Directory"):s("setup.projectDirectory","Project Directory")}),e.jsx(je,{value:t.manualPath,onChange:$,nodeId:t.manualNodeId||void 0,localNodeId:B,selectCreatedDirectory:!0,placeholder:u?s("setup.clonePathPlaceholder","/path/for/new-clone"):m?s("setup.initPathPlaceholder","/path/to/new-project"):s("setup.projectPathPlaceholder","/path/to/your/project")}),e.jsx("p",{className:"form-hint",children:u?s("setup.clonePathHint","Select or type an absolute destination path. Fusion will clone into this directory. The destination must be empty or absent."):m?s("setup.initPathHint","Select or type an absolute path to an empty or non-git folder. Fusion will run git init during registration."):s("setup.projectPathHint","Select or type the absolute path to an existing git repository or workspace root.")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-name",children:s("setup.projectName","Project Name")}),e.jsx("input",{id:"project-name",type:"text",value:t.manualName,onChange:a=>i(r=>({...r,manualName:a.target.value})),placeholder:s("setup.projectNamePlaceholder","my-project")}),e.jsx("p",{className:"form-hint",children:u?s("setup.projectNameHintClone","By default this follows the destination folder name unless you edit it."):m?s("setup.projectNameHintInit","By default this follows the folder name Fusion will initialize unless you edit it."):s("setup.projectNameHintExisting","By default this follows the selected directory name unless you edit it.")})]}),u&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-clone-url",children:s("setup.repositoryUrl","Repository URL")}),e.jsx("input",{id:"project-clone-url",type:"text",value:t.manualCloneUrl,onChange:a=>i(r=>({...r,manualCloneUrl:a.target.value,error:null})),placeholder:s("setup.repositoryUrlPlaceholder","https://github.com/owner/repo.git")}),e.jsx("p",{className:"form-hint",children:s("setup.cloneGitHint","Fusion will run git clone into the destination directory, then register that cloned folder.")})]}),C&&t.manualPath.trim()&&e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"workspace-mode",className:"checkbox-label",children:[e.jsx("input",{id:"workspace-mode",type:"checkbox",checked:t.workspaceMode,onChange:a=>i(r=>({...r,workspaceMode:a.target.checked}))}),s("setup.workspaceMode","Workspace mode (multi-repo)")]}),t.isDetectingWorkspace&&e.jsxs("p",{className:"form-hint",children:[e.jsx(z,{size:12,className:"animate-spin setup-wizard-inline-spinner"}),s("setup.detectingWorkspace","Detecting sub-repositories...")]}),!t.isDetectingWorkspace&&t.detectedRepos.length>0&&e.jsxs("p",{className:"form-hint",children:[s("setup.detectedRepos","Found {{count}} repositories:",{count:t.detectedRepos.length})," ",t.detectedRepos.join(", ")]}),!t.isDetectingWorkspace&&t.detectedRepos.length===0&&t.workspaceMode===!1&&t.manualPath.trim()&&e.jsx("p",{className:"form-hint",children:s("setup.noSubReposDetected","No sub-repositories detected. Enable if this is a multi-repo workspace.")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"task-prefix",children:s("setup.taskPrefix","Task Prefix")}),e.jsx("input",{id:"task-prefix",type:"text",value:t.manualTaskPrefix,onChange:a=>i(r=>({...r,manualTaskPrefix:a.target.value.toUpperCase()})),placeholder:A(t.manualName||"FN"),maxLength:5}),e.jsx("p",{className:"form-hint",children:s("setup.taskPrefixHint",'Used for task IDs (e.g. "{{prefix}}-1"). Derived from project name.',{prefix:t.manualTaskPrefix||"FN"})})]}),e.jsxs("div",{className:"setup-wizard-advanced",children:[e.jsxs("button",{type:"button",className:"setup-wizard-advanced-toggle","aria-expanded":D,onClick:()=>O(a=>!a),children:[e.jsx(me,{size:16,className:"setup-wizard-advanced-chevron"}),e.jsx("span",{children:s("setup.advancedSettings","Advanced settings")})]}),D&&e.jsxs("div",{className:"setup-wizard-advanced-panel",children:[we(y)&&e.jsxs("div",{className:"form-group",children:[e.jsxs("div",{className:"project-node-selector",children:[e.jsx("span",{className:"project-node-selector__label",children:s("setup.runtimeNode","Runtime Node")}),e.jsxs("select",{value:t.manualNodeId,onChange:a=>i(r=>({...r,manualNodeId:a.target.value})),disabled:_||t.isRegistering,children:[e.jsx("option",{value:"",children:s("setup.localNode","Local node")}),U(y).map(a=>e.jsxs("option",{value:a.id,children:[a.name," (",a.type,")"]},a.id))]})]}),e.jsx("p",{className:"form-hint",children:s("setup.runtimeNodeHint",`A runtime node is the machine where this project's tasks run. "Local node" is this computer; pick a remote node to run tasks elsewhere.`)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:s("setup.isolationMode","Isolation Mode")}),e.jsxs("div",{className:"setup-wizard-isolation-options",children:[e.jsxs("label",{className:`setup-wizard-isolation-option${t.manualIsolationMode==="in-process"?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"isolation-mode",value:"in-process",checked:t.manualIsolationMode==="in-process",onChange:()=>i(a=>({...a,manualIsolationMode:"in-process"}))}),e.jsxs("div",{className:"setup-wizard-isolation-option-content",children:[e.jsx("strong",{children:s("setup.inProcess","In-Process")}),e.jsx("span",{children:s("setup.inProcessDesc","Lower overhead, shared memory. Best for most projects.")}),e.jsx("span",{className:"wizard-option-recommended",children:s("setup.recommended","Recommended")})]})]}),e.jsxs("label",{className:`setup-wizard-isolation-option${t.manualIsolationMode==="child-process"?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"isolation-mode",value:"child-process",checked:t.manualIsolationMode==="child-process",onChange:()=>i(a=>({...a,manualIsolationMode:"child-process"}))}),e.jsxs("div",{className:"setup-wizard-isolation-option-content",children:[e.jsx("strong",{children:s("setup.childProcess","Child-Process")}),e.jsx("span",{children:s("setup.childProcessDesc","Isolated execution with crash containment.")})]})]})]})]})]})]}),t.error&&e.jsx("div",{className:"wizard-error",role:"alert",children:t.error})]}),t.step==="agent"&&e.jsxs("div",{className:"setup-wizard-agent-step",children:[e.jsx("p",{className:"setup-wizard-agent-intro",children:s("setup.firstAgentIntro","Agents are optional. Fusion can build tasks without one by starting temporary agents for planning, coding, review, and merge. Create an agent only if you want help coordinating tasks and direction.")}),e.jsxs("div",{className:"setup-wizard-agent-layout",children:[e.jsxs("section",{className:"setup-wizard-agent-presets","aria-labelledby":"setup-first-agent-presets-heading",children:[e.jsx("div",{className:"setup-wizard-agent-section-heading",id:"setup-first-agent-presets-heading",children:s("setup.firstAgentTemplates","Templates")}),e.jsx("div",{className:"setup-wizard-agent-preset-list",role:"radiogroup","aria-label":s("setup.firstAgentTemplates","Templates"),children:h.map(a=>{const r=t.selectedPresetId===a.id;return e.jsxs("button",{type:"button",className:`setup-wizard-agent-preset${r?" selected":""}`,role:"radio","aria-checked":r,"aria-label":r?s("setup.selectedAgentTemplate","{{name}} selected",{name:a.name}):a.name,tabIndex:a.id===ae?0:-1,"data-agent-preset-id":a.id,disabled:f,onClick:()=>v(a.id),onKeyDown:n=>q(n,a.id),children:[e.jsx(F,{agent:{id:a.id,icon:a.icon,name:a.name},size:28}),e.jsxs("span",{className:"setup-wizard-agent-preset-copy",children:[e.jsxs("span",{className:"setup-wizard-agent-preset-name",children:[a.name,a.id==="ceo"&&e.jsx("span",{className:"wizard-option-recommended",children:s("setup.recommended","Recommended")})]}),e.jsx("span",{className:"setup-wizard-agent-preset-description",children:a.description})]})]},a.id)})})]}),e.jsxs("section",{className:"setup-wizard-agent-preview","aria-labelledby":"setup-first-agent-preview-heading",children:[e.jsx("div",{className:"setup-wizard-agent-section-heading",id:"setup-first-agent-preview-heading",children:s("setup.firstAgentPreview","Preview")}),e.jsxs("div",{className:"setup-wizard-agent-preview-card",children:[e.jsxs("div",{className:"setup-wizard-agent-preview-title-row",children:[e.jsx(F,{agent:{id:t.selectedPresetId||"draft",icon:t.agentDraft.icon,name:t.agentDraft.name},size:36}),e.jsxs("div",{children:[e.jsx("h3",{children:t.agentDraft.name||s("setup.firstAgentDraftName","Draft agent")}),e.jsx("p",{children:t.agentDraft.title||se?.title||s("setup.firstAgentCustomDraft","Custom agent draft")})]})]}),e.jsxs("dl",{className:"setup-wizard-agent-preview-list",children:[e.jsxs("div",{children:[e.jsx("dt",{children:s("agents.fieldRole","Role")}),e.jsx("dd",{children:t.agentDraft.role})]}),e.jsxs("div",{children:[e.jsx("dt",{children:s("agents.fieldInstructionsText","Inline Instructions")}),e.jsx("dd",{children:t.agentDraft.instructionsText||s("setup.firstAgentNoInstructions","No inline instructions yet")})]})]}),R&&e.jsxs("button",{type:"button",className:"btn setup-wizard-agent-ai-btn",onClick:()=>N(!0),disabled:f,children:[e.jsx(ge,{size:16}),e.jsx("span",{children:s("agents.aiInterview","AI Interview")})]})]})]})]}),t.agentError&&e.jsx("div",{className:"wizard-error",role:"alert",tabIndex:-1,ref:S,children:t.agentError})]}),t.step==="complete"&&e.jsxs("div",{className:"setup-wizard-complete",children:[e.jsxs("div",{className:"setup-wizard-success-streak","aria-hidden":"true",children:[e.jsx("div",{className:"setup-wizard-success-streak-core"}),e.jsx("div",{className:"setup-wizard-success-streak-glow"})]}),e.jsx(T,{size:64,className:"success-icon"}),e.jsx("h3",{children:s("setup.allSet","All Set!")}),e.jsx("p",{children:t.agentOutcome==="created"?s("setup.firstAgentCreatedSuccess","Your project is registered and your first agent is ready."):s("setup.projectRegisteredSuccess","Your project has been registered successfully.")}),e.jsx("p",{children:t.agentOutcome==="skipped"?s("setup.firstAgentSkippedHint","You can create agents later from the Agents view."):s("setup.addMoreProjectsHint","You can add more projects anytime from the project overview.")})]})]}),e.jsxs("div",{className:"setup-wizard-footer",children:[e.jsx("a",{className:"btn setup-wizard-help-link",href:W,target:"_blank",rel:"noopener noreferrer",children:s("setup.needHelp","Need help?")}),t.step==="manual"&&e.jsx("button",{className:"btn btn-primary",onClick:Y,disabled:te,children:t.isRegistering?e.jsxs(e.Fragment,{children:[e.jsx(z,{size:16,className:"animate-spin"}),e.jsx("span",{children:s("setup.registering","Registering...")})]}):e.jsx("span",{children:X})}),t.step==="agent"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:V,disabled:f,children:s("setup.skipFirstAgent","Skip for now")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void Z(),disabled:f||!t.agentDraft.name.trim(),"aria-busy":t.isCreatingAgent,children:t.isCreatingAgent?e.jsxs(e.Fragment,{children:[e.jsx(z,{size:16,className:"animate-spin"}),e.jsx("span",{children:s("setup.creatingFirstAgent","Creating agent...")})]}):e.jsx("span",{children:s("setup.createFirstAgent","Create Agent")})})]}),t.step==="complete"&&e.jsxs("button",{className:"btn btn-primary",onClick:G,children:[e.jsx(T,{size:16}),e.jsx("span",{children:s("setup.getStarted","Get Started")})]})]})]}),R&&M&&e.jsx(he,{level:"modal",fallback:e.jsxs("div",{className:"wizard-error setup-wizard-agent-interview-error",role:"alert",children:[e.jsx("span",{children:s("setup.firstAgentInterviewLoadError","AI interview could not load. You can still create an agent from a template or skip this step.")}),e.jsx("button",{type:"button",className:"btn",onClick:()=>N(!1),children:s("setup.firstAgentContinueWithTemplates","Continue with templates")})]}),children:e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"wizard-error setup-wizard-agent-interview-error",role:"status",children:s("setup.firstAgentInterviewLoading","Loading AI Interview...")}),children:e.jsx(Ne,{isOpen:M,onClose:()=>N(!1),onUseDraft:K,projectId:t.registeredProject?.id,existingAgents:[],mode:"create"})})})]})}export{Re as SetupWizardModal};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalAgentOnboardingModal-5Kg2iQtB.js","assets/vendor-react-SZ_qB27O.js","assets/index-aBQwNV_I.js","assets/vendor-i18n-GF3RlKbq.js","assets/vendor-reactflow-9C3XTE7_.js","assets/vendor-reactflow-C5ap-Sga.css","assets/vendor-codemirror-jBKmHyH0.js","assets/vendor-xterm-BNq00GSj.js","assets/vendor-xterm-LZoznX6r.css","assets/index-C2HFa2A-.css","assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css"])))=>i.map(i=>d[i]);
2
+ import{w as h,ar as P,as as E,at as ie,au as oe,av as le,aw as de,ax as ce,ay as pe,X as ue,L as z,e as me,az as F,S as ge,aA as T,aB as he,$ as xe}from"./index-aBQwNV_I.js";import{r as o,j as e}from"./vendor-react-SZ_qB27O.js";import{D as je}from"./DirectoryPicker-BzpWdpTC.js";import{s as I}from"./projectDetection-G3XuxD2X.js";import{u as fe}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-xterm-BNq00GSj.js";import"./folder-open-YuIEuDwd.js";function U(d){return d.filter(p=>p.type!=="local")}function we(d){return U(d).length>0}function A(d){const p=d.replace(/[^a-zA-Z]/g,"").toUpperCase();return p.length>=2&&p.length<=4?p:p.length>4?p.slice(0,4):"FN"}const Ne=o.lazy(()=>xe(()=>import("./ExperimentalAgentOnboardingModal-5Kg2iQtB.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(d=>({default:d.ExperimentalAgentOnboardingModal})));function Re({onProjectRegistered:d,onClose:p,agentOnboardingEnabled:R=!1,includeAgentStep:x=!0}){const{t:s}=fe("app"),W="https://discord.gg/ksrfuy7WYR",w=o.useMemo(()=>P("ceo")??h[0],[]),[H,L]=o.useState(!0),[t,i]=o.useState(()=>({step:"manual",manualMode:"existing",manualPath:"",manualCloneUrl:"",manualName:"",manualIsolationMode:"in-process",manualNodeId:"",manualTaskPrefix:"",detectedRepos:[],workspaceMode:!1,isDetectingWorkspace:!1,registeredProject:null,selectedPresetId:w.id,agentDraft:E(w),isCreatingAgent:!1,isRegistering:!1,error:null,agentError:null,agentOutcome:null})),[D,O]=o.useState(!1),[M,N]=o.useState(!1),S=o.useRef(null),{nodes:y,loading:_}=ie(),B=y.find(a=>a.type==="local")?.id,b=o.useCallback(()=>{L(!1),p?.()},[p]),$=o.useCallback(()=>{if(t.registeredProject){d(t.registeredProject);return}b()},[b,d,t.registeredProject]);o.useEffect(()=>{t.agentError&&S.current?.focus()},[t.agentError]);const j=o.useRef(0),G=o.useCallback(a=>{if(i(r=>{const n={manualPath:a,detectedRepos:[],workspaceMode:!1,error:null};a&&(!r.manualName||r.manualName===I(r.manualPath))&&(n.manualName=I(a));const l=n.manualName??r.manualName;return l&&(!r.manualTaskPrefix||r.manualTaskPrefix===A(I(r.manualPath)))&&(n.manualTaskPrefix=A(l)),{...r,...n}}),t.manualMode==="existing"&&a.trim()&&a.trim()!=="/"){const r=++j.current;i(n=>({...n,isDetectingWorkspace:!0})),oe(a.trim()).then(n=>{r===j.current&&i(l=>({...l,isDetectingWorkspace:!1,detectedRepos:n.repos,workspaceMode:n.isWorkspace}))}).catch(()=>{r===j.current&&i(n=>({...n,isDetectingWorkspace:!1}))})}},[t.manualMode]),k=o.useCallback(a=>{i(r=>({...r,manualMode:a,manualCloneUrl:a==="clone"?r.manualCloneUrl:"",detectedRepos:a==="existing"?r.detectedRepos:[],workspaceMode:a==="existing"?r.workspaceMode:!1,isDetectingWorkspace:!1,error:null})),j.current+=1},[]),Y=o.useCallback(async()=>{const a=t.manualPath.trim(),r=t.manualName.trim(),n=t.manualCloneUrl.trim();if(!(!a||!r)&&!(t.manualMode==="clone"&&!n)){i(l=>({...l,isRegistering:!0,error:null}));try{const l={name:r,path:a,isolationMode:t.manualIsolationMode,nodeId:t.manualNodeId||void 0,gitSetupMode:t.manualMode,cloneUrl:t.manualMode==="clone"?n:void 0,workspaceMode:t.manualMode==="existing"?t.workspaceMode:!1,taskPrefix:t.manualTaskPrefix.trim()||void 0},c=await le(l);if(!x){i(g=>({...g,isRegistering:!1})),d(c);return}i(g=>({...g,step:"agent",registeredProject:c,isRegistering:!1}))}catch(l){i(c=>({...c,isRegistering:!1,error:l instanceof Error?l.message:"Failed to register project"}))}}},[x,d,t.manualPath,t.manualName,t.manualCloneUrl,t.manualMode,t.manualIsolationMode,t.manualNodeId,t.workspaceMode,t.manualTaskPrefix]),v=o.useCallback(a=>{const r=P(a);r&&i(n=>({...n,selectedPresetId:r.id,agentDraft:E(r),agentError:null}))},[]),q=o.useCallback((a,r)=>{const n=h.findIndex(ne=>ne.id===r);if(n<0)return;const l=h.length-1;let c=null;if(a.key==="ArrowDown"||a.key==="ArrowRight"?c=n===l?0:n+1:a.key==="ArrowUp"||a.key==="ArrowLeft"?c=n===0?l:n-1:a.key==="Home"?c=0:a.key==="End"&&(c=l),c===null)return;a.preventDefault();const g=h[c];v(g.id),requestAnimationFrame(()=>{document.querySelector(`[data-agent-preset-id="${g.id}"]`)?.focus()})},[v]),K=o.useCallback(a=>{i(r=>({...r,selectedPresetId:"",agentDraft:de(a),agentError:null}))},[]),Z=o.useCallback(async()=>{if(!(!t.registeredProject||!t.agentDraft.name.trim())){i(a=>({...a,isCreatingAgent:!0,agentError:null}));try{await ce(pe(t.agentDraft),t.registeredProject.id),i(a=>({...a,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}))}catch(a){if(a instanceof Error&&/already exists/i.test(a.message)){i(r=>({...r,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}));return}i(r=>({...r,isCreatingAgent:!1,agentError:a instanceof Error?a.message:s("setup.firstAgentCreateError","Failed to create agent")}))}}},[t.agentDraft,t.registeredProject,s]),V=o.useCallback(()=>{i(a=>({...a,step:"complete",agentError:null,agentOutcome:"skipped"}))},[]);if(!H)return null;const C=t.manualMode==="existing",m=t.manualMode==="init",u=t.manualMode==="clone",X=u?s("setup.cloneAndRegisterProject","Clone and Register Project"):m?s("setup.initializeAndRegisterProject","Initialize and Register Project"):s("setup.registerProject","Register Project"),J=t.manualPath.trim().length>0,Q=t.manualName.trim().length>0,ee=t.manualCloneUrl.trim().length>0,te=t.isRegistering||!J||!Q||u&&!ee,se=t.selectedPresetId?P(t.selectedPresetId):void 0,f=t.isCreatingAgent,ae=t.selectedPresetId||w.id,re=`modal setup-wizard-modal${t.step==="agent"?" setup-wizard-modal--agent":""}`;return e.jsxs("div",{className:"modal-overlay open setup-wizard-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"wizard-title",children:[e.jsxs("div",{className:re,children:[e.jsxs("div",{className:"setup-wizard-header",children:[e.jsxs("div",{className:"setup-wizard-heading",children:[e.jsxs("div",{className:"setup-wizard-brand","aria-label":s("setup.brandName","Fusion"),children:[e.jsxs("svg",{className:"setup-wizard-brand-logo",width:28,height:28,viewBox:"0 0 128 128",fill:"none","aria-label":s("setup.brandLogo","Fusion logo"),role:"img",children:[e.jsx("circle",{cx:"64",cy:"64",r:"52",stroke:"currentColor",strokeWidth:"8"}),e.jsx("path",{d:"M26 101C44 82 62 64 82 45C90 37 98 30 104 24C96 35 89 47 81 60C70 79 57 95 43 108C38 112 32 108 26 101Z",fill:"currentColor"})]}),e.jsx("span",{className:"setup-wizard-brand-name",children:s("setup.brandName","Fusion")})]}),!x&&t.step==="manual"&&e.jsx("span",{className:"setup-wizard-step-context",children:s("setup.projectStepContext","Step 3 of 5 — Project · Fusion setup")}),e.jsxs("h2",{id:"wizard-title",className:"setup-wizard-title",children:[t.step==="manual"&&(x?s("setup.welcomeToFusion","Welcome to Fusion"):s("setup.titleSetUpProject","Set Up Your Project")),t.step==="agent"&&s("setup.firstAgentTitle","Create your first agent"),t.step==="complete"&&s("setup.setupCompleteTitle","Setup Complete!")]})]}),t.step!=="complete"&&t.step!=="agent"&&e.jsx("button",{className:"modal-close",onClick:b,"aria-label":s("setup.closeWizard","Close wizard"),children:e.jsx(ue,{size:20})})]}),e.jsxs("div",{className:"setup-wizard-content",children:[t.step==="manual"&&e.jsxs("div",{className:"setup-wizard-manual",children:[e.jsxs("section",{className:"setup-wizard-repository-section","aria-labelledby":"setup-repository-mode-title",children:[e.jsxs("div",{className:"setup-wizard-section-heading",children:[e.jsx("h3",{id:"setup-repository-mode-title",children:s("setup.repositorySetupTitle","Repository setup")}),e.jsx("p",{children:s("setup.repositorySetupDescription","Choose how Fusion should prepare the project directory before registration.")})]}),e.jsxs("fieldset",{className:"setup-wizard-mode-switch","aria-label":s("setup.projectSetupModeAriaLabel","Project setup mode"),children:[e.jsx("legend",{children:s("setup.setupMode","Setup Mode")}),e.jsxs("label",{className:`setup-wizard-mode-option${C?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"existing","aria-label":s("setup.useExistingDirectory","Use Existing Directory"),checked:C,onChange:()=>k("existing")}),e.jsxs("span",{className:"setup-wizard-mode-option-copy",children:[e.jsx("strong",{children:s("setup.useExistingDirectory","Use Existing Directory")}),e.jsx("span",{children:s("setup.useExistingDirectoryHint","Register a folder that is already a git repository or workspace root.")})]})]}),e.jsxs("label",{className:`setup-wizard-mode-option${m?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"init","aria-label":s("setup.initializeNewRepository","Initialize New Repository"),checked:m,onChange:()=>k("init")}),e.jsxs("span",{className:"setup-wizard-mode-option-copy",children:[e.jsx("strong",{children:s("setup.initializeNewRepository","Initialize New Repository")}),e.jsx("span",{children:s("setup.initializeNewRepositoryHint","Register a selected non-git folder and let Fusion run git init on the server.")})]})]}),e.jsxs("label",{className:`setup-wizard-mode-option${u?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"clone","aria-label":s("setup.cloneGitRepository","Clone Git Repository"),checked:u,onChange:()=>k("clone")}),e.jsxs("span",{className:"setup-wizard-mode-option-copy",children:[e.jsx("strong",{children:s("setup.cloneGitRepository","Clone Git Repository")}),e.jsx("span",{children:s("setup.cloneGitRepositoryHint","Clone a remote repository into an empty or absent destination folder.")})]})]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-path",children:u?s("setup.destinationDirectory","Destination Directory"):m?s("setup.newRepositoryDirectory","New Repository Directory"):s("setup.projectDirectory","Project Directory")}),e.jsx(je,{value:t.manualPath,onChange:G,nodeId:t.manualNodeId||void 0,localNodeId:B,selectCreatedDirectory:!0,placeholder:u?s("setup.clonePathPlaceholder","/path/for/new-clone"):m?s("setup.initPathPlaceholder","/path/to/new-project"):s("setup.projectPathPlaceholder","/path/to/your/project")}),e.jsx("p",{className:"form-hint",children:u?s("setup.clonePathHint","Select or type an absolute destination path. Fusion will clone into this directory. The destination must be empty or absent."):m?s("setup.initPathHint","Select or type an absolute path to an empty or non-git folder. Fusion will run git init during registration."):s("setup.projectPathHint","Select or type the absolute path to an existing git repository or workspace root.")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-name",children:s("setup.projectName","Project Name")}),e.jsx("input",{id:"project-name",type:"text",value:t.manualName,onChange:a=>i(r=>({...r,manualName:a.target.value})),placeholder:s("setup.projectNamePlaceholder","my-project")}),e.jsx("p",{className:"form-hint",children:u?s("setup.projectNameHintClone","By default this follows the destination folder name unless you edit it."):m?s("setup.projectNameHintInit","By default this follows the folder name Fusion will initialize unless you edit it."):s("setup.projectNameHintExisting","By default this follows the selected directory name unless you edit it.")})]}),u&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-clone-url",children:s("setup.repositoryUrl","Repository URL")}),e.jsx("input",{id:"project-clone-url",type:"text",value:t.manualCloneUrl,onChange:a=>i(r=>({...r,manualCloneUrl:a.target.value,error:null})),placeholder:s("setup.repositoryUrlPlaceholder","https://github.com/owner/repo.git")}),e.jsx("p",{className:"form-hint",children:s("setup.cloneGitHint","Fusion will run git clone into the destination directory, then register that cloned folder.")})]}),C&&t.manualPath.trim()&&e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"workspace-mode",className:"checkbox-label",children:[e.jsx("input",{id:"workspace-mode",type:"checkbox",checked:t.workspaceMode,onChange:a=>i(r=>({...r,workspaceMode:a.target.checked}))}),s("setup.workspaceMode","Workspace mode (multi-repo)")]}),t.isDetectingWorkspace&&e.jsxs("p",{className:"form-hint",children:[e.jsx(z,{size:12,className:"animate-spin setup-wizard-inline-spinner"}),s("setup.detectingWorkspace","Detecting sub-repositories...")]}),!t.isDetectingWorkspace&&t.detectedRepos.length>0&&e.jsxs("p",{className:"form-hint",children:[s("setup.detectedRepos","Found {{count}} repositories:",{count:t.detectedRepos.length})," ",t.detectedRepos.join(", ")]}),!t.isDetectingWorkspace&&t.detectedRepos.length===0&&t.workspaceMode===!1&&t.manualPath.trim()&&e.jsx("p",{className:"form-hint",children:s("setup.noSubReposDetected","No sub-repositories detected. Enable if this is a multi-repo workspace.")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"task-prefix",children:s("setup.taskPrefix","Task Prefix")}),e.jsx("input",{id:"task-prefix",type:"text",value:t.manualTaskPrefix,onChange:a=>i(r=>({...r,manualTaskPrefix:a.target.value.toUpperCase()})),placeholder:A(t.manualName||"FN"),maxLength:5}),e.jsx("p",{className:"form-hint",children:s("setup.taskPrefixHint",'Used for task IDs (e.g. "{{prefix}}-1"). Derived from project name.',{prefix:t.manualTaskPrefix||"FN"})})]}),e.jsxs("div",{className:"setup-wizard-advanced",children:[e.jsxs("button",{type:"button",className:"setup-wizard-advanced-toggle","aria-expanded":D,onClick:()=>O(a=>!a),children:[e.jsx(me,{size:16,className:"setup-wizard-advanced-chevron"}),e.jsx("span",{children:s("setup.advancedSettings","Advanced settings")})]}),D&&e.jsxs("div",{className:"setup-wizard-advanced-panel",children:[we(y)&&e.jsxs("div",{className:"form-group",children:[e.jsxs("div",{className:"project-node-selector",children:[e.jsx("span",{className:"project-node-selector__label",children:s("setup.runtimeNode","Runtime Node")}),e.jsxs("select",{value:t.manualNodeId,onChange:a=>i(r=>({...r,manualNodeId:a.target.value})),disabled:_||t.isRegistering,children:[e.jsx("option",{value:"",children:s("setup.localNode","Local node")}),U(y).map(a=>e.jsxs("option",{value:a.id,children:[a.name," (",a.type,")"]},a.id))]})]}),e.jsx("p",{className:"form-hint",children:s("setup.runtimeNodeHint",`A runtime node is the machine where this project's tasks run. "Local node" is this computer; pick a remote node to run tasks elsewhere.`)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:s("setup.isolationMode","Isolation Mode")}),e.jsxs("div",{className:"setup-wizard-isolation-options",children:[e.jsxs("label",{className:`setup-wizard-isolation-option${t.manualIsolationMode==="in-process"?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"isolation-mode",value:"in-process",checked:t.manualIsolationMode==="in-process",onChange:()=>i(a=>({...a,manualIsolationMode:"in-process"}))}),e.jsxs("div",{className:"setup-wizard-isolation-option-content",children:[e.jsx("strong",{children:s("setup.inProcess","In-Process")}),e.jsx("span",{children:s("setup.inProcessDesc","Lower overhead, shared memory. Best for most projects.")}),e.jsx("span",{className:"wizard-option-recommended",children:s("setup.recommended","Recommended")})]})]}),e.jsxs("label",{className:`setup-wizard-isolation-option${t.manualIsolationMode==="child-process"?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"isolation-mode",value:"child-process",checked:t.manualIsolationMode==="child-process",onChange:()=>i(a=>({...a,manualIsolationMode:"child-process"}))}),e.jsxs("div",{className:"setup-wizard-isolation-option-content",children:[e.jsx("strong",{children:s("setup.childProcess","Child-Process")}),e.jsx("span",{children:s("setup.childProcessDesc","Isolated execution with crash containment.")})]})]})]})]})]})]}),t.error&&e.jsx("div",{className:"wizard-error",role:"alert",children:t.error})]}),t.step==="agent"&&e.jsxs("div",{className:"setup-wizard-agent-step",children:[e.jsx("p",{className:"setup-wizard-agent-intro",children:s("setup.firstAgentIntro","Agents are optional. Fusion can build tasks without one by starting temporary agents for planning, coding, review, and merge. Create an agent only if you want help coordinating tasks and direction.")}),e.jsxs("div",{className:"setup-wizard-agent-layout",children:[e.jsxs("section",{className:"setup-wizard-agent-presets","aria-labelledby":"setup-first-agent-presets-heading",children:[e.jsx("div",{className:"setup-wizard-agent-section-heading",id:"setup-first-agent-presets-heading",children:s("setup.firstAgentTemplates","Templates")}),e.jsx("div",{className:"setup-wizard-agent-preset-list",role:"radiogroup","aria-label":s("setup.firstAgentTemplates","Templates"),children:h.map(a=>{const r=t.selectedPresetId===a.id;return e.jsxs("button",{type:"button",className:`setup-wizard-agent-preset${r?" selected":""}`,role:"radio","aria-checked":r,"aria-label":r?s("setup.selectedAgentTemplate","{{name}} selected",{name:a.name}):a.name,tabIndex:a.id===ae?0:-1,"data-agent-preset-id":a.id,disabled:f,onClick:()=>v(a.id),onKeyDown:n=>q(n,a.id),children:[e.jsx(F,{agent:{id:a.id,icon:a.icon,name:a.name},size:28}),e.jsxs("span",{className:"setup-wizard-agent-preset-copy",children:[e.jsxs("span",{className:"setup-wizard-agent-preset-name",children:[a.name,a.id==="ceo"&&e.jsx("span",{className:"wizard-option-recommended",children:s("setup.recommended","Recommended")})]}),e.jsx("span",{className:"setup-wizard-agent-preset-description",children:a.description})]})]},a.id)})})]}),e.jsxs("section",{className:"setup-wizard-agent-preview","aria-labelledby":"setup-first-agent-preview-heading",children:[e.jsx("div",{className:"setup-wizard-agent-section-heading",id:"setup-first-agent-preview-heading",children:s("setup.firstAgentPreview","Preview")}),e.jsxs("div",{className:"setup-wizard-agent-preview-card",children:[e.jsxs("div",{className:"setup-wizard-agent-preview-title-row",children:[e.jsx(F,{agent:{id:t.selectedPresetId||"draft",icon:t.agentDraft.icon,name:t.agentDraft.name},size:36}),e.jsxs("div",{children:[e.jsx("h3",{children:t.agentDraft.name||s("setup.firstAgentDraftName","Draft agent")}),e.jsx("p",{children:t.agentDraft.title||se?.title||s("setup.firstAgentCustomDraft","Custom agent draft")})]})]}),e.jsxs("dl",{className:"setup-wizard-agent-preview-list",children:[e.jsxs("div",{children:[e.jsx("dt",{children:s("agents.fieldRole","Role")}),e.jsx("dd",{children:t.agentDraft.role})]}),e.jsxs("div",{children:[e.jsx("dt",{children:s("agents.fieldInstructionsText","Inline Instructions")}),e.jsx("dd",{children:t.agentDraft.instructionsText||s("setup.firstAgentNoInstructions","No inline instructions yet")})]})]}),R&&e.jsxs("button",{type:"button",className:"btn setup-wizard-agent-ai-btn",onClick:()=>N(!0),disabled:f,children:[e.jsx(ge,{size:16}),e.jsx("span",{children:s("agents.aiInterview","AI Interview")})]})]})]})]}),t.agentError&&e.jsx("div",{className:"wizard-error",role:"alert",tabIndex:-1,ref:S,children:t.agentError})]}),t.step==="complete"&&e.jsxs("div",{className:"setup-wizard-complete",children:[e.jsxs("div",{className:"setup-wizard-success-streak","aria-hidden":"true",children:[e.jsx("div",{className:"setup-wizard-success-streak-core"}),e.jsx("div",{className:"setup-wizard-success-streak-glow"})]}),e.jsx(T,{size:64,className:"success-icon"}),e.jsx("h3",{children:s("setup.allSet","All Set!")}),e.jsx("p",{children:t.agentOutcome==="created"?s("setup.firstAgentCreatedSuccess","Your project is registered and your first agent is ready."):s("setup.projectRegisteredSuccess","Your project has been registered successfully.")}),e.jsx("p",{children:t.agentOutcome==="skipped"?s("setup.firstAgentSkippedHint","You can create agents later from the Agents view."):s("setup.addMoreProjectsHint","You can add more projects anytime from the project overview.")})]})]}),e.jsxs("div",{className:"setup-wizard-footer",children:[e.jsx("a",{className:"btn setup-wizard-help-link",href:W,target:"_blank",rel:"noopener noreferrer",children:s("setup.needHelp","Need help?")}),t.step==="manual"&&e.jsx("button",{className:"btn btn-primary",onClick:Y,disabled:te,children:t.isRegistering?e.jsxs(e.Fragment,{children:[e.jsx(z,{size:16,className:"animate-spin"}),e.jsx("span",{children:s("setup.registering","Registering...")})]}):e.jsx("span",{children:X})}),t.step==="agent"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:V,disabled:f,children:s("setup.skipFirstAgent","Skip for now")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void Z(),disabled:f||!t.agentDraft.name.trim(),"aria-busy":t.isCreatingAgent,children:t.isCreatingAgent?e.jsxs(e.Fragment,{children:[e.jsx(z,{size:16,className:"animate-spin"}),e.jsx("span",{children:s("setup.creatingFirstAgent","Creating agent...")})]}):e.jsx("span",{children:s("setup.createFirstAgent","Create Agent")})})]}),t.step==="complete"&&e.jsxs("button",{className:"btn btn-primary",onClick:$,children:[e.jsx(T,{size:16}),e.jsx("span",{children:s("setup.getStarted","Get Started")})]})]})]}),R&&M&&e.jsx(he,{level:"modal",fallback:e.jsxs("div",{className:"wizard-error setup-wizard-agent-interview-error",role:"alert",children:[e.jsx("span",{children:s("setup.firstAgentInterviewLoadError","AI interview could not load. You can still create an agent from a template or skip this step.")}),e.jsx("button",{type:"button",className:"btn",onClick:()=>N(!1),children:s("setup.firstAgentContinueWithTemplates","Continue with templates")})]}),children:e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"wizard-error setup-wizard-agent-interview-error",role:"status",children:s("setup.firstAgentInterviewLoading","Loading AI Interview...")}),children:e.jsx(Ne,{isOpen:M,onClose:()=>N(!1),onUseDraft:K,projectId:t.registeredProject?.id,existingAgents:[],mode:"create"})})})]})}export{Re as SetupWizardModal};
@@ -1,4 +1,4 @@
1
- import{c as N,bT as k,bU as v,af as y,C as S,bV as x,bW as f}from"./index-DO9Ch72Y.js";import{r,j as a}from"./vendor-react-SZ_qB27O.js";import{u as C}from"./vendor-i18n-GF3RlKbq.js";/**
1
+ import{c as N,bX as k,bY as v,aq as y,C as S,bZ as x,b_ as C}from"./index-aBQwNV_I.js";import{r,j as a}from"./vendor-react-SZ_qB27O.js";import{u as f}from"./vendor-i18n-GF3RlKbq.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{c as N,bT as k,bU as v,af as y,C as S,bV as x,bW as f}from"./index-DO9Ch7
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const z=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],O=N("sun",z),$=[{value:"light",label:"Light",icon:O},{value:"dark",label:"Dark",icon:j},{value:"system",label:"System",icon:k}],D=[{value:"default",label:"Fusion Legacy",className:"theme-swatch-default"},{value:"ocean",label:"Ocean",className:"theme-swatch-ocean"},{value:"forest",label:"Forest",className:"theme-swatch-forest"},{value:"sunset",label:"Sunset",className:"theme-swatch-sunset"},{value:"zen",label:"Zen",className:"theme-swatch-zen"},{value:"berry",label:"Berry",className:"theme-swatch-berry"},{value:"high-contrast",label:"High Contrast",className:"theme-swatch-high-contrast"},{value:"industrial",label:"Industrial",className:"theme-swatch-industrial"},{value:"monochrome",label:"Mono",className:"theme-swatch-monochrome"},{value:"slate",label:"Slate",className:"theme-swatch-slate"},{value:"ash",label:"Ash",className:"theme-swatch-ash"},{value:"air",label:"Air",className:"theme-swatch-air"},{value:"graphite",label:"Graphite",className:"theme-swatch-graphite"},{value:"silver",label:"Silver",className:"theme-swatch-silver"},{value:"solarized",label:"Solarized",className:"theme-swatch-solarized"},{value:"factory",label:"Factory",className:"theme-swatch-factory"},{value:"factory-mono",label:"Factory Mono",className:"theme-swatch-factory-mono"},{value:"ayu",label:"Ayu",className:"theme-swatch-ayu"},{value:"one-dark",label:"One Dark",className:"theme-swatch-one-dark"},{value:"nord",label:"Nord",className:"theme-swatch-nord"},{value:"dracula",label:"Dracula",className:"theme-swatch-dracula"},{value:"gruvbox",label:"Gruvbox",className:"theme-swatch-gruvbox"},{value:"tokyo-night",label:"Tokyo Night",className:"theme-swatch-tokyo-night"},{value:"catppuccin-mocha",label:"Catppuccin Mocha",className:"theme-swatch-catppuccin-mocha"},{value:"github-dark",label:"GitHub Dark",className:"theme-swatch-github-dark"},{value:"everforest",label:"Everforest",className:"theme-swatch-everforest"},{value:"rose-pine",label:"Rosé Pine",className:"theme-swatch-rose-pine"},{value:"kanagawa",label:"Kanagawa",className:"theme-swatch-kanagawa"},{value:"night-owl",label:"Night Owl",className:"theme-swatch-night-owl"},{value:"palenight",label:"Palenight",className:"theme-swatch-palenight"},{value:"monokai-pro",label:"Monokai Pro",className:"theme-swatch-monokai-pro"},{value:"slime",label:"Slime",className:"theme-swatch-slime"},{value:"brutalist",label:"Brutalist",className:"theme-swatch-brutalist"},{value:"neon-city",label:"Neon City",className:"theme-swatch-neon-city"},{value:"parchment",label:"Parchment",className:"theme-swatch-parchment"},{value:"terminal",label:"Terminal",className:"theme-swatch-terminal"},{value:"glass",label:"Glass",className:"theme-swatch-glass"},{value:"glass-silver",label:"Glass Silver",className:"theme-swatch-glass-silver"},{value:"horizon",label:"Horizon",className:"theme-swatch-horizon"},{value:"vitesse",label:"Vitesse",className:"theme-swatch-vitesse"},{value:"outrun",label:"Outrun",className:"theme-swatch-outrun"},{value:"snazzy",label:"Snazzy",className:"theme-swatch-snazzy"},{value:"porple",label:"Porple",className:"theme-swatch-porple"},{value:"espresso",label:"Espresso",className:"theme-swatch-espresso"},{value:"mars",label:"Mars",className:"theme-swatch-mars"},{value:"poimandres",label:"Poimandres",className:"theme-swatch-poimandres"},{value:"ember",label:"Ember",className:"theme-swatch-ember"},{value:"rust",label:"Rust",className:"theme-swatch-rust"},{value:"copper",label:"Copper",className:"theme-swatch-copper"},{value:"foundry",label:"Foundry",className:"theme-swatch-foundry"},{value:"carbon",label:"Carbon",className:"theme-swatch-carbon"},{value:"sandstone",label:"Sandstone",className:"theme-swatch-sandstone"},{value:"lagoon",label:"Lagoon",className:"theme-swatch-lagoon"},{value:"frost",label:"Frost",className:"theme-swatch-frost"},{value:"lavender",label:"Lavender",className:"theme-swatch-lavender"},{value:"neon-bloom",label:"Neon Bloom",className:"theme-swatch-neon-bloom"},{value:"sepia",label:"Sepia",className:"theme-swatch-sepia"},{value:"shadcn",label:"Shadcn",className:"theme-swatch-shadcn"},{value:"shadcn-ember",label:"Shadcn Ember (Default)",className:"theme-swatch-shadcn-ember"},{value:"shadcn-custom",label:"Shadcn Custom",className:"theme-swatch-shadcn-custom"},{value:"shadcn-blue",label:"Shadcn Blue",className:"theme-swatch-shadcn-blue"},{value:"shadcn-green",label:"Shadcn Green",className:"theme-swatch-shadcn-green"},{value:"shadcn-red",label:"Shadcn Red",className:"theme-swatch-shadcn-red"},{value:"shadcn-purple",label:"Shadcn Purple",className:"theme-swatch-shadcn-purple"},{value:"shadcn-pink",label:"Shadcn Pink",className:"theme-swatch-shadcn-pink"},{value:"shadcn-orange",label:"Shadcn Orange",className:"theme-swatch-shadcn-orange"},{value:"shadcn-yellow",label:"Shadcn Yellow",className:"theme-swatch-shadcn-yellow"},{value:"shadcn-mono-red",label:"Shadcn Mono Red",className:"theme-swatch-shadcn-mono-red"},{value:"shadcn-mono-blue",label:"Shadcn Mono Blue",className:"theme-swatch-shadcn-mono-blue"},{value:"shadcn-mono-green",label:"Shadcn Mono Green",className:"theme-swatch-shadcn-mono-green"},{value:"shadcn-mono-purple",label:"Shadcn Mono Purple",className:"theme-swatch-shadcn-mono-purple"},{value:"shadcn-mono-pink",label:"Shadcn Mono Pink",className:"theme-swatch-shadcn-mono-pink"},{value:"shadcn-mono-orange",label:"Shadcn Mono Orange",className:"theme-swatch-shadcn-mono-orange"},{value:"shadcn-mono-yellow",label:"Shadcn Mono Yellow",className:"theme-swatch-shadcn-mono-yellow"},{value:"shadcn-black",label:"Shadcn Black",className:"theme-swatch-shadcn-black"},{value:"shadcn-gray",label:"Shadcn Gray",className:"theme-swatch-shadcn-gray"},{value:"shadcn-gray-blue",label:"Shadcn Gray Blue",className:"theme-swatch-shadcn-gray-blue"}];function V(t){const l=t.trim();if(/^#[\da-f]{6}$/i.test(l))return l;if(/^#[\da-f]{3}$/i.test(l)){const[,h,s,c]=l;return`#${h}${h}${s}${s}${c}${c}`}return"#000000"}function G({value:t={},onChange:l,resolvedThemeMode:h="dark"}){const{t:s}=C("app"),[c,w]=r.useState(!1),m=r.useId(),d=r.useMemo(()=>v(t),[t]),u=(e,n)=>{l(v({...d,[e]:n}))},i=c?s("theme.shadcnCustom.collapse","Collapse custom colors"):s("theme.shadcnCustom.show","Show custom colors"),g=c?y:S;return a.jsxs("section",{className:"shadcn-color-picker card","data-testid":"shadcn-color-picker","aria-labelledby":"shadcn-color-picker-title",children:[a.jsxs("div",{className:"shadcn-color-picker-header",children:[a.jsxs("div",{className:"shadcn-color-picker-heading",children:[a.jsx("h3",{id:"shadcn-color-picker-title",className:"shadcn-color-picker-title",children:s("theme.shadcnCustom.title","Custom shadcn colors")}),a.jsx("p",{className:"shadcn-color-picker-description",children:s("theme.shadcnCustom.description","Override shadcn design tokens with hex colors. Blank tokens use the theme defaults.")})]}),a.jsx("button",{type:"button",className:"btn btn-icon btn-sm shadcn-color-picker-toggle","aria-expanded":c,"aria-controls":m,"aria-label":i,title:i,onClick:()=>w(e=>!e),children:a.jsx(g,{size:16,"aria-hidden":"true"})})]}),c?a.jsxs("div",{id:m,className:"shadcn-color-picker-controls-panel","data-testid":"shadcn-color-picker-controls",children:[a.jsx("div",{className:"shadcn-color-picker-actions",children:a.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>l({}),children:s("theme.shadcnCustom.reset","Reset custom colors")})}),a.jsx("div",{className:"shadcn-color-picker-grid",children:x.map(e=>{const n=f(e,h),b=d[e.cssVar]??n,p=`shadcn-color-${e.cssVar.replace(/^--/,"").replace(/[^a-z0-9]+/gi,"-")}`;return a.jsxs("div",{className:"shadcn-color-picker-row","data-testid":`shadcn-color-${e.cssVar}`,children:[a.jsxs("label",{className:"shadcn-color-picker-label",htmlFor:p,children:[a.jsx("span",{children:s(`theme.shadcnCustom.token.${e.cssVar}`,e.label)}),a.jsx("code",{children:e.cssVar})]}),a.jsxs("div",{className:"shadcn-color-picker-controls",children:[a.jsx("input",{"aria-label":s("theme.shadcnCustom.colorInput","Pick {{label}} color",{label:e.label}),className:"shadcn-color-picker-native",type:"color",value:V(b),onChange:o=>u(e.cssVar,o.currentTarget.value)}),a.jsx("input",{id:p,"aria-label":s("theme.shadcnCustom.hexInput","{{label}} hex color",{label:e.label}),className:"input shadcn-color-picker-hex",type:"text",inputMode:"text",spellCheck:!1,value:b,onChange:o=>u(e.cssVar,o.currentTarget.value)})]})]},e.cssVar)})})]}):null]})}export{D as C,j as M,O as S,$ as T,G as a};
11
+ */const z=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],O=N("sun",z),$=[{value:"light",label:"Light",icon:O},{value:"dark",label:"Dark",icon:j},{value:"system",label:"System",icon:k}],_=[{value:"default",label:"Fusion Legacy",className:"theme-swatch-default"},{value:"ocean",label:"Ocean",className:"theme-swatch-ocean"},{value:"forest",label:"Forest",className:"theme-swatch-forest"},{value:"sunset",label:"Sunset",className:"theme-swatch-sunset"},{value:"zen",label:"Zen",className:"theme-swatch-zen"},{value:"berry",label:"Berry",className:"theme-swatch-berry"},{value:"high-contrast",label:"High Contrast",className:"theme-swatch-high-contrast"},{value:"industrial",label:"Industrial",className:"theme-swatch-industrial"},{value:"monochrome",label:"Mono",className:"theme-swatch-monochrome"},{value:"slate",label:"Slate",className:"theme-swatch-slate"},{value:"ash",label:"Ash",className:"theme-swatch-ash"},{value:"air",label:"Air",className:"theme-swatch-air"},{value:"graphite",label:"Graphite",className:"theme-swatch-graphite"},{value:"silver",label:"Silver",className:"theme-swatch-silver"},{value:"solarized",label:"Solarized",className:"theme-swatch-solarized"},{value:"factory",label:"Factory",className:"theme-swatch-factory"},{value:"factory-mono",label:"Factory Mono",className:"theme-swatch-factory-mono"},{value:"ayu",label:"Ayu",className:"theme-swatch-ayu"},{value:"one-dark",label:"One Dark",className:"theme-swatch-one-dark"},{value:"nord",label:"Nord",className:"theme-swatch-nord"},{value:"dracula",label:"Dracula",className:"theme-swatch-dracula"},{value:"gruvbox",label:"Gruvbox",className:"theme-swatch-gruvbox"},{value:"tokyo-night",label:"Tokyo Night",className:"theme-swatch-tokyo-night"},{value:"catppuccin-mocha",label:"Catppuccin Mocha",className:"theme-swatch-catppuccin-mocha"},{value:"github-dark",label:"GitHub Dark",className:"theme-swatch-github-dark"},{value:"everforest",label:"Everforest",className:"theme-swatch-everforest"},{value:"rose-pine",label:"Rosé Pine",className:"theme-swatch-rose-pine"},{value:"kanagawa",label:"Kanagawa",className:"theme-swatch-kanagawa"},{value:"night-owl",label:"Night Owl",className:"theme-swatch-night-owl"},{value:"palenight",label:"Palenight",className:"theme-swatch-palenight"},{value:"monokai-pro",label:"Monokai Pro",className:"theme-swatch-monokai-pro"},{value:"slime",label:"Slime",className:"theme-swatch-slime"},{value:"brutalist",label:"Brutalist",className:"theme-swatch-brutalist"},{value:"neon-city",label:"Neon City",className:"theme-swatch-neon-city"},{value:"parchment",label:"Parchment",className:"theme-swatch-parchment"},{value:"terminal",label:"Terminal",className:"theme-swatch-terminal"},{value:"glass",label:"Glass",className:"theme-swatch-glass"},{value:"glass-silver",label:"Glass Silver",className:"theme-swatch-glass-silver"},{value:"horizon",label:"Horizon",className:"theme-swatch-horizon"},{value:"vitesse",label:"Vitesse",className:"theme-swatch-vitesse"},{value:"outrun",label:"Outrun",className:"theme-swatch-outrun"},{value:"snazzy",label:"Snazzy",className:"theme-swatch-snazzy"},{value:"porple",label:"Porple",className:"theme-swatch-porple"},{value:"espresso",label:"Espresso",className:"theme-swatch-espresso"},{value:"mars",label:"Mars",className:"theme-swatch-mars"},{value:"poimandres",label:"Poimandres",className:"theme-swatch-poimandres"},{value:"ember",label:"Ember",className:"theme-swatch-ember"},{value:"rust",label:"Rust",className:"theme-swatch-rust"},{value:"copper",label:"Copper",className:"theme-swatch-copper"},{value:"foundry",label:"Foundry",className:"theme-swatch-foundry"},{value:"carbon",label:"Carbon",className:"theme-swatch-carbon"},{value:"sandstone",label:"Sandstone",className:"theme-swatch-sandstone"},{value:"lagoon",label:"Lagoon",className:"theme-swatch-lagoon"},{value:"frost",label:"Frost",className:"theme-swatch-frost"},{value:"lavender",label:"Lavender",className:"theme-swatch-lavender"},{value:"neon-bloom",label:"Neon Bloom",className:"theme-swatch-neon-bloom"},{value:"sepia",label:"Sepia",className:"theme-swatch-sepia"},{value:"shadcn",label:"Shadcn",className:"theme-swatch-shadcn"},{value:"shadcn-ember",label:"Shadcn Ember (Default)",className:"theme-swatch-shadcn-ember"},{value:"shadcn-custom",label:"Shadcn Custom",className:"theme-swatch-shadcn-custom"},{value:"shadcn-blue",label:"Shadcn Blue",className:"theme-swatch-shadcn-blue"},{value:"shadcn-green",label:"Shadcn Green",className:"theme-swatch-shadcn-green"},{value:"shadcn-red",label:"Shadcn Red",className:"theme-swatch-shadcn-red"},{value:"shadcn-purple",label:"Shadcn Purple",className:"theme-swatch-shadcn-purple"},{value:"shadcn-pink",label:"Shadcn Pink",className:"theme-swatch-shadcn-pink"},{value:"shadcn-orange",label:"Shadcn Orange",className:"theme-swatch-shadcn-orange"},{value:"shadcn-yellow",label:"Shadcn Yellow",className:"theme-swatch-shadcn-yellow"},{value:"shadcn-mono-red",label:"Shadcn Mono Red",className:"theme-swatch-shadcn-mono-red"},{value:"shadcn-mono-blue",label:"Shadcn Mono Blue",className:"theme-swatch-shadcn-mono-blue"},{value:"shadcn-mono-green",label:"Shadcn Mono Green",className:"theme-swatch-shadcn-mono-green"},{value:"shadcn-mono-purple",label:"Shadcn Mono Purple",className:"theme-swatch-shadcn-mono-purple"},{value:"shadcn-mono-pink",label:"Shadcn Mono Pink",className:"theme-swatch-shadcn-mono-pink"},{value:"shadcn-mono-orange",label:"Shadcn Mono Orange",className:"theme-swatch-shadcn-mono-orange"},{value:"shadcn-mono-yellow",label:"Shadcn Mono Yellow",className:"theme-swatch-shadcn-mono-yellow"},{value:"shadcn-black",label:"Shadcn Black",className:"theme-swatch-shadcn-black"},{value:"shadcn-gray",label:"Shadcn Gray",className:"theme-swatch-shadcn-gray"},{value:"shadcn-gray-blue",label:"Shadcn Gray Blue",className:"theme-swatch-shadcn-gray-blue"}];function E(t){const l=t.trim();if(/^#[\da-f]{6}$/i.test(l))return l;if(/^#[\da-f]{3}$/i.test(l)){const[,h,s,c]=l;return`#${h}${h}${s}${s}${c}${c}`}return"#000000"}function D({value:t={},onChange:l,resolvedThemeMode:h="dark"}){const{t:s}=f("app"),[c,w]=r.useState(!1),m=r.useId(),d=r.useMemo(()=>v(t),[t]),u=(e,n)=>{l(v({...d,[e]:n}))},i=c?s("theme.shadcnCustom.collapse","Collapse custom colors"):s("theme.shadcnCustom.show","Show custom colors"),g=c?y:S;return a.jsxs("section",{className:"shadcn-color-picker card","data-testid":"shadcn-color-picker","aria-labelledby":"shadcn-color-picker-title",children:[a.jsxs("div",{className:"shadcn-color-picker-header",children:[a.jsxs("div",{className:"shadcn-color-picker-heading",children:[a.jsx("h3",{id:"shadcn-color-picker-title",className:"shadcn-color-picker-title",children:s("theme.shadcnCustom.title","Custom shadcn colors")}),a.jsx("p",{className:"shadcn-color-picker-description",children:s("theme.shadcnCustom.description","Override shadcn design tokens with hex colors. Blank tokens use the theme defaults.")})]}),a.jsx("button",{type:"button",className:"btn btn-icon btn-sm shadcn-color-picker-toggle","aria-expanded":c,"aria-controls":m,"aria-label":i,title:i,onClick:()=>w(e=>!e),children:a.jsx(g,{size:16,"aria-hidden":"true"})})]}),c?a.jsxs("div",{id:m,className:"shadcn-color-picker-controls-panel","data-testid":"shadcn-color-picker-controls",children:[a.jsx("div",{className:"shadcn-color-picker-actions",children:a.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>l({}),children:s("theme.shadcnCustom.reset","Reset custom colors")})}),a.jsx("div",{className:"shadcn-color-picker-grid",children:x.map(e=>{const n=C(e,h),b=d[e.cssVar]??n,p=`shadcn-color-${e.cssVar.replace(/^--/,"").replace(/[^a-z0-9]+/gi,"-")}`;return a.jsxs("div",{className:"shadcn-color-picker-row","data-testid":`shadcn-color-${e.cssVar}`,children:[a.jsxs("label",{className:"shadcn-color-picker-label",htmlFor:p,children:[a.jsx("span",{children:s(`theme.shadcnCustom.token.${e.cssVar}`,e.label)}),a.jsx("code",{children:e.cssVar})]}),a.jsxs("div",{className:"shadcn-color-picker-controls",children:[a.jsx("input",{"aria-label":s("theme.shadcnCustom.colorInput","Pick {{label}} color",{label:e.label}),className:"shadcn-color-picker-native",type:"color",value:E(b),onChange:o=>u(e.cssVar,o.currentTarget.value)}),a.jsx("input",{id:p,"aria-label":s("theme.shadcnCustom.hexInput","{{label}} hex color",{label:e.label}),className:"input shadcn-color-picker-hex",type:"text",inputMode:"text",spellCheck:!1,value:b,onChange:o=>u(e.cssVar,o.currentTarget.value)})]})]},e.cssVar)})})]}):null]})}export{_ as C,j as M,O as S,$ as T,D as a};
@@ -1 +1 @@
1
- import{r as a,j as s}from"./vendor-react-SZ_qB27O.js";import{f as ms,a as us,t as vs,i as hs,b as gs,d as bs,V as ws,Z as xs,X as H,R as fs,C as js,e as ps,L as A,A as q,g as G,M as J}from"./index-DO9Ch72Y.js";import{u as Ns}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-xterm-BNq00GSj.js";const Ss=new Set([".md",".markdown",".mdx"]);function Cs(r){const d=r.toLowerCase(),j=d.lastIndexOf(".");return j<0?!1:Ss.has(d.slice(j))}function zs({projectId:r,addToast:d,onClose:j}){const{t:e}=Ns("app"),[k,p]=a.useState([]),[F,T]=a.useState(!0),[Y,V]=a.useState(!1),[I,D]=a.useState(null),[_,ss]=a.useState([]),[g,ls]=a.useState(""),[M,B]=a.useState(null),[c,N]=a.useState(null),[b,S]=a.useState(null),[es,K]=a.useState(!1),[Q,C]=a.useState(null),[y,w]=a.useState(null),[u,v]=a.useState(null),[is,z]=a.useState(!1),[$,h]=a.useState(null),m=a.useRef(null),[P,as]=a.useState(""),O=g.trim()?k.filter(l=>l.name.toLowerCase().includes(g.toLowerCase())||l.relativePath.toLowerCase().includes(g.toLowerCase())):k,x=a.useCallback(async()=>{T(!0);try{const l=await ms(r);p(l)}catch(l){const t=l instanceof Error?l.message:e("skills.loadDiscoveredError","Failed to load discovered skills");d(t,"error")}finally{T(!1)}},[r,d]),f=a.useCallback(async l=>{const t=i=>{if(!i||typeof i!="object")return!1;const n=i;if(typeof n.status=="number"&&n.status>=500)return!0;if(n.details&&typeof n.details=="object"){const L=n.details;if(typeof L.code=="string"&&L.code.startsWith("upstream_"))return!0}const o=i;return typeof o.error=="string"&&typeof o.code=="string"};V(!0),D(null);try{const i=await us(l,20,r);ss(i.entries)}catch(i){if(t(i))D(e("skills.catalogUnavailable","Catalog is temporarily unavailable. Please try again later."));else{const n=i instanceof Error?i.message:e("skills.loadCatalogError","Failed to load catalog");D(n)}}finally{V(!1)}},[r]);a.useEffect(()=>{x(),f("")},[x,f]);const ts=a.useCallback(l=>{ls(l),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{as(l),m.current=null},300)},[]);a.useEffect(()=>()=>{m.current&&(clearTimeout(m.current),m.current=null)},[]),a.useEffect(()=>{f(P)},[P,f]);const ns=a.useCallback(async(l,t)=>{const i=!t;p(n=>n.map(o=>o.id===l?{...o,toggling:!0}:o));try{await vs(l,i,r),p(n=>n.map(o=>o.id===l?{...o,enabled:i,toggling:!1}:o)),d(e(`skills.${i?"enabled":"disabled"}`,i?"Skill enabled":"Skill disabled"),"success")}catch(n){p(L=>L.map(R=>R.id===l?{...R,toggling:!1}:R));const o=n instanceof Error?n.message:e("skills.toggleError","Failed to toggle skill");d(e("skills.toggleFailed","Failed to toggle skill: {{message}}",{message:o}),"error")}},[r,d]),cs=a.useCallback(async l=>{const t=l.repo?.trim();if(!(!t||M===l.id)){B(l.id);try{await hs(t,l.slug||l.name,r),d(e("skills.installSuccess","Installed {{name}}",{name:l.name}),"success"),await x()}catch(i){const n=i instanceof Error?i.message:e("skills.installError","Failed to install skill");d(e("skills.installFailed","Failed to install {{name}}: {{message}}",{name:l.name,message:n}),"error")}finally{B(i=>i===l.id?null:i)}}},[d,M,x,r]),E=a.useCallback(async l=>{K(!0),C(null),S(null),w(null),v(null),h(null);try{const t=await gs(l,r);S(t)}catch(t){const i=t instanceof Error?t.message:e("skills.loadContentError","Failed to load skill content");C(i)}finally{K(!1)}},[r]),U=a.useCallback((l,t)=>{if(!(t&&t.target.closest(".skills-view-item-toggle"))){if(c===l){N(null),S(null),C(null),w(null),v(null),h(null);return}N(l),E(l)}},[c,E]),os=a.useCallback(l=>{c!==l&&N(l),E(l)},[E,c]),W=a.useCallback(async(l,t)=>{w(t),v(null),h(null),z(!0);try{const i=await bs(l,t,r);v(i)}catch(i){const n=i instanceof Error?i.message:e("skills.loadFileError","Failed to load file");h(n)}finally{z(!1)}},[r]),rs=a.useCallback(()=>{w(null),v(null),h(null),z(!1)},[]),X=a.useCallback(()=>{N(null),S(null),C(null),w(null),v(null),h(null)},[]),ds=a.useMemo(()=>k.find(l=>l.id===c)??null,[k,c]),Z=()=>!b||b.files.length===0?null:s.jsxs("div",{className:"skills-view-detail-files","data-testid":"skill-files",children:[s.jsxs("span",{className:"skills-view-detail-files-label",children:[e("skills.filesLabel","Files"),":"]}),b.files.map(l=>{if(l.type==="directory")return s.jsxs("span",{className:"badge badge--sm skills-view-detail-file--dir",children:[l.name,"/"]},l.relativePath);const t=y===l.relativePath;return s.jsx("button",{type:"button","data-testid":"skill-file-item",className:`badge badge--sm skills-view-detail-file${t?" skills-view-detail-file--active":""}`,onClick:()=>c&&void W(c,l.relativePath),"aria-pressed":t,"aria-label":e("skills.viewFile","View {{name}}",{name:l.name}),children:l.name},l.relativePath)})]}),ks=()=>c?es?s.jsxs("div",{className:"skills-view-detail-loading",children:[s.jsx(A,{size:16,className:"spin"}),e("skills.loadingContent","Loading skill content...")]}):Q?s.jsxs("div",{className:"skills-view-detail-error",children:[s.jsx(G,{size:14}),s.jsx("span",{children:Q}),s.jsx("button",{className:"btn btn-sm",onClick:()=>os(c),children:e("common.retry","Retry")})]}):b?y!==null?s.jsxs("div",{className:"skills-view-file-viewer","data-testid":"skill-file-viewer",children:[s.jsxs("div",{className:"skills-view-file-viewer-bar",children:[s.jsxs("button",{type:"button",className:"btn btn-sm skills-view-file-back",onClick:rs,"data-testid":"skill-file-back","aria-label":e("skills.backToSkillMd","Back to SKILL.md"),children:[s.jsx(q,{size:14}),e("skills.backToSkillMd","Back to SKILL.md")]}),s.jsx("span",{className:"skills-view-file-viewer-name",children:y})]}),is?s.jsxs("div",{className:"skills-view-detail-loading",children:[s.jsx(A,{size:16,className:"spin"}),e("skills.loadingFile","Loading file...")]}):$?s.jsxs("div",{className:"skills-view-detail-error",children:[s.jsx(G,{size:14}),s.jsx("span",{children:$}),s.jsx("button",{className:"btn btn-sm",onClick:()=>c&&void W(c,y),children:e("common.retry","Retry")})]}):u&&!u.isText?s.jsx("div",{className:"skills-view-detail-empty",children:e("skills.fileNotPreviewable","This file cannot be previewed.")}):u?Cs(u.relativePath)?s.jsx(J,{content:u.content||e("skills.emptyFile","(Empty file)"),className:"skills-view-detail-markdown",testId:"skills-view-detail-markdown"}):s.jsx("pre",{className:"skills-view-detail-content",children:u.content||e("skills.emptyFile","(Empty file)")}):null,Z()]}):s.jsxs(s.Fragment,{children:[s.jsx(J,{content:b.skillMd||e("skills.noSkillMd","(No SKILL.md found)"),className:"skills-view-detail-markdown",testId:"skills-view-detail-markdown"}),Z()]}):null:s.jsx("div",{className:"skills-view-detail-placeholder","data-testid":"skills-detail-empty",children:e("skills.selectASkill","Select a skill to view its details")});return s.jsxs("div",{className:"skills-view","data-testid":"skills-view","data-selected":c?"true":"false",children:[s.jsx(ws,{icon:xs,title:e("skills.title","Skills"),actions:s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"skills-view-count","aria-label":e("skills.discoveredCount","{{count}} discovered skills",{count:k.length}),children:[k.length," ",e("skills.discovered","discovered")]}),s.jsx("button",{className:"btn-icon skills-view-close touch-target",onClick:j,"aria-label":e("skills.closeView","Close skills view"),children:s.jsx(H,{size:16})}),s.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),disabled:F,children:[s.jsx(fs,{size:14,className:F?"spin":""}),e("common.refresh","Refresh")]})]})}),s.jsxs("div",{className:"skills-view-body",children:[s.jsx("div",{className:"skills-view__list","data-testid":"skills-list",children:s.jsxs("div",{className:"skills-view-content",children:[s.jsx("div",{className:"skills-view-search",children:s.jsx("input",{type:"text",className:"form-input",placeholder:e("skills.searchPlaceholder","Search skills..."),value:g,onChange:l=>ts(l.target.value),"aria-label":e("skills.searchLabel","Search skills")})}),s.jsxs("section",{className:"skills-view-section","aria-labelledby":"discovered-skills-title",children:[s.jsx("h3",{id:"discovered-skills-title",className:"skills-view-section-title",children:e("skills.discoveredSection","Discovered Skills")}),F?s.jsxs("div",{className:"skills-view-loading",children:[s.jsx("span",{className:"spinner"}),e("skills.loadingDiscovered","Loading discovered skills...")]}):k.length===0?s.jsx("div",{className:"skills-view-empty",children:s.jsx("p",{children:e("skills.noDiscovered","No skills discovered in this project.")})}):O.length===0?s.jsx("div",{className:"skills-view-empty",children:s.jsx("p",{children:e("skills.noMatchingDiscovered","No discovered skills match your search.")})}):s.jsx("div",{className:"skills-view-list",children:O.map(l=>{const t=c===l.id;return s.jsx("div",{children:s.jsxs("div",{className:`skills-view-item${t?" skills-view-item--selected":""}`,onClick:i=>U(l.id,i),role:"button",tabIndex:0,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),U(l.id))},"aria-expanded":t,"aria-label":e("skills.viewDetails","View details for {{name}}",{name:l.name}),children:[s.jsxs("div",{className:"skills-view-item-info",children:[s.jsxs("span",{className:"skills-view-item-name",children:[t?s.jsx(js,{size:14}):s.jsx(ps,{size:14}),s.jsx("span",{className:"skills-view-item-name-text",children:l.name})]}),s.jsx("span",{className:"skills-view-item-path",children:l.relativePath}),s.jsx("span",{className:"skills-view-item-source",children:l.metadata.source})]}),s.jsxs("label",{className:"skills-view-item-toggle",onClick:i=>i.stopPropagation(),children:[s.jsx("input",{type:"checkbox",checked:l.enabled,disabled:l.toggling,onChange:()=>void ns(l.id,l.enabled),"aria-label":e(`skills.${l.enabled?"disable":"enable"}Skill`,l.enabled?"Disable {{name}}":"Enable {{name}}",{name:l.name})}),s.jsx("span",{className:"skills-view-toggle-slider"})]})]})},l.id)})})]}),s.jsxs("section",{className:"skills-view-section","aria-labelledby":"catalog-title",children:[s.jsx("h3",{id:"catalog-title",className:"skills-view-section-title",children:e("skills.catalogSection","Skills Catalog")}),I?s.jsxs("div",{className:"skills-view-error",children:[s.jsx("p",{children:I}),s.jsx("button",{className:"btn btn-sm",onClick:()=>void f(P),children:e("common.tryAgain","Try Again")})]}):Y?s.jsxs("div",{className:"skills-view-loading",children:[s.jsx("span",{className:"spinner"}),e("skills.loadingCatalog","Loading catalog...")]}):_.length===0?s.jsx("div",{className:"skills-view-empty",children:g?s.jsx("p",{children:e("skills.noMatchingSearch","No skills match your search.")}):s.jsx("p",{children:e("skills.noCatalogAvailable","No skills available in the catalog.")})}):s.jsx("div",{className:"skills-view-grid",children:_.map(l=>{const i=!!l.repo?.trim(),n=M===l.id;return s.jsxs("div",{className:"skills-view-card",children:[s.jsxs("div",{className:"skills-view-card-header",children:[s.jsx("h4",{className:"skills-view-card-title",children:l.name}),i?s.jsxs("button",{type:"button",className:"btn btn-sm skills-view-card-install",onClick:()=>void cs(l),disabled:n,"aria-label":e("skills.installSkill","Install {{name}}",{name:l.name}),children:[n?s.jsx(A,{size:14,className:"spin"}):null,n?e("skills.installing","Installing…"):e("skills.install","Install")]}):null]}),l.description&&s.jsx("p",{className:"skills-view-card-description",children:l.description}),l.tags&&l.tags.length>0&&s.jsx("div",{className:"skills-view-card-tags",children:l.tags.map(o=>s.jsx("span",{className:"badge badge--sm",children:o},o))}),l.installs!==void 0&&s.jsx("span",{className:"skills-view-card-installs",children:e("skills.installsCount","{{value}} installs",{value:l.installs.toLocaleString()})})]},l.id)})})]})]})}),s.jsxs("div",{className:"skills-view__detail","data-testid":"skill-detail",children:[s.jsxs("div",{className:"skills-view-detail-header",children:[s.jsx("button",{type:"button",className:"btn btn-sm btn-icon skills-view-detail-back",onClick:X,"aria-label":e("skills.backToList","Back to skills"),title:e("skills.backToList","Back to skills"),"data-testid":"skills-detail-back",children:s.jsx(q,{size:14})}),s.jsx("span",{className:"skills-view-detail-title",children:ds?.name??e("skills.detailTitle","Skill")}),s.jsxs("button",{className:"btn btn-sm skills-view-detail-close",onClick:X,disabled:!c,"aria-label":e("skills.closeDetail","Close skill detail"),children:[s.jsx(H,{size:14}),e("common.close","Close")]})]}),s.jsx("div",{className:"skills-view-detail-body",children:ks()})]})]})]})}export{zs as SkillsView};
1
+ import{r as a,j as s}from"./vendor-react-SZ_qB27O.js";import{f as ms,a as us,t as vs,i as hs,b as gs,d as bs,V as ws,Z as xs,X as H,R as fs,C as js,e as ps,L as A,A as q,g as G,M as J}from"./index-aBQwNV_I.js";import{u as Ns}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-xterm-BNq00GSj.js";const Ss=new Set([".md",".markdown",".mdx"]);function Cs(r){const d=r.toLowerCase(),j=d.lastIndexOf(".");return j<0?!1:Ss.has(d.slice(j))}function zs({projectId:r,addToast:d,onClose:j}){const{t:e}=Ns("app"),[k,p]=a.useState([]),[F,T]=a.useState(!0),[Y,V]=a.useState(!1),[I,D]=a.useState(null),[_,ss]=a.useState([]),[g,ls]=a.useState(""),[M,B]=a.useState(null),[c,N]=a.useState(null),[b,S]=a.useState(null),[es,K]=a.useState(!1),[Q,C]=a.useState(null),[y,w]=a.useState(null),[u,v]=a.useState(null),[is,z]=a.useState(!1),[$,h]=a.useState(null),m=a.useRef(null),[P,as]=a.useState(""),O=g.trim()?k.filter(l=>l.name.toLowerCase().includes(g.toLowerCase())||l.relativePath.toLowerCase().includes(g.toLowerCase())):k,x=a.useCallback(async()=>{T(!0);try{const l=await ms(r);p(l)}catch(l){const t=l instanceof Error?l.message:e("skills.loadDiscoveredError","Failed to load discovered skills");d(t,"error")}finally{T(!1)}},[r,d]),f=a.useCallback(async l=>{const t=i=>{if(!i||typeof i!="object")return!1;const n=i;if(typeof n.status=="number"&&n.status>=500)return!0;if(n.details&&typeof n.details=="object"){const L=n.details;if(typeof L.code=="string"&&L.code.startsWith("upstream_"))return!0}const o=i;return typeof o.error=="string"&&typeof o.code=="string"};V(!0),D(null);try{const i=await us(l,20,r);ss(i.entries)}catch(i){if(t(i))D(e("skills.catalogUnavailable","Catalog is temporarily unavailable. Please try again later."));else{const n=i instanceof Error?i.message:e("skills.loadCatalogError","Failed to load catalog");D(n)}}finally{V(!1)}},[r]);a.useEffect(()=>{x(),f("")},[x,f]);const ts=a.useCallback(l=>{ls(l),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{as(l),m.current=null},300)},[]);a.useEffect(()=>()=>{m.current&&(clearTimeout(m.current),m.current=null)},[]),a.useEffect(()=>{f(P)},[P,f]);const ns=a.useCallback(async(l,t)=>{const i=!t;p(n=>n.map(o=>o.id===l?{...o,toggling:!0}:o));try{await vs(l,i,r),p(n=>n.map(o=>o.id===l?{...o,enabled:i,toggling:!1}:o)),d(e(`skills.${i?"enabled":"disabled"}`,i?"Skill enabled":"Skill disabled"),"success")}catch(n){p(L=>L.map(R=>R.id===l?{...R,toggling:!1}:R));const o=n instanceof Error?n.message:e("skills.toggleError","Failed to toggle skill");d(e("skills.toggleFailed","Failed to toggle skill: {{message}}",{message:o}),"error")}},[r,d]),cs=a.useCallback(async l=>{const t=l.repo?.trim();if(!(!t||M===l.id)){B(l.id);try{await hs(t,l.slug||l.name,r),d(e("skills.installSuccess","Installed {{name}}",{name:l.name}),"success"),await x()}catch(i){const n=i instanceof Error?i.message:e("skills.installError","Failed to install skill");d(e("skills.installFailed","Failed to install {{name}}: {{message}}",{name:l.name,message:n}),"error")}finally{B(i=>i===l.id?null:i)}}},[d,M,x,r]),E=a.useCallback(async l=>{K(!0),C(null),S(null),w(null),v(null),h(null);try{const t=await gs(l,r);S(t)}catch(t){const i=t instanceof Error?t.message:e("skills.loadContentError","Failed to load skill content");C(i)}finally{K(!1)}},[r]),U=a.useCallback((l,t)=>{if(!(t&&t.target.closest(".skills-view-item-toggle"))){if(c===l){N(null),S(null),C(null),w(null),v(null),h(null);return}N(l),E(l)}},[c,E]),os=a.useCallback(l=>{c!==l&&N(l),E(l)},[E,c]),W=a.useCallback(async(l,t)=>{w(t),v(null),h(null),z(!0);try{const i=await bs(l,t,r);v(i)}catch(i){const n=i instanceof Error?i.message:e("skills.loadFileError","Failed to load file");h(n)}finally{z(!1)}},[r]),rs=a.useCallback(()=>{w(null),v(null),h(null),z(!1)},[]),X=a.useCallback(()=>{N(null),S(null),C(null),w(null),v(null),h(null)},[]),ds=a.useMemo(()=>k.find(l=>l.id===c)??null,[k,c]),Z=()=>!b||b.files.length===0?null:s.jsxs("div",{className:"skills-view-detail-files","data-testid":"skill-files",children:[s.jsxs("span",{className:"skills-view-detail-files-label",children:[e("skills.filesLabel","Files"),":"]}),b.files.map(l=>{if(l.type==="directory")return s.jsxs("span",{className:"badge badge--sm skills-view-detail-file--dir",children:[l.name,"/"]},l.relativePath);const t=y===l.relativePath;return s.jsx("button",{type:"button","data-testid":"skill-file-item",className:`badge badge--sm skills-view-detail-file${t?" skills-view-detail-file--active":""}`,onClick:()=>c&&void W(c,l.relativePath),"aria-pressed":t,"aria-label":e("skills.viewFile","View {{name}}",{name:l.name}),children:l.name},l.relativePath)})]}),ks=()=>c?es?s.jsxs("div",{className:"skills-view-detail-loading",children:[s.jsx(A,{size:16,className:"spin"}),e("skills.loadingContent","Loading skill content...")]}):Q?s.jsxs("div",{className:"skills-view-detail-error",children:[s.jsx(G,{size:14}),s.jsx("span",{children:Q}),s.jsx("button",{className:"btn btn-sm",onClick:()=>os(c),children:e("common.retry","Retry")})]}):b?y!==null?s.jsxs("div",{className:"skills-view-file-viewer","data-testid":"skill-file-viewer",children:[s.jsxs("div",{className:"skills-view-file-viewer-bar",children:[s.jsxs("button",{type:"button",className:"btn btn-sm skills-view-file-back",onClick:rs,"data-testid":"skill-file-back","aria-label":e("skills.backToSkillMd","Back to SKILL.md"),children:[s.jsx(q,{size:14}),e("skills.backToSkillMd","Back to SKILL.md")]}),s.jsx("span",{className:"skills-view-file-viewer-name",children:y})]}),is?s.jsxs("div",{className:"skills-view-detail-loading",children:[s.jsx(A,{size:16,className:"spin"}),e("skills.loadingFile","Loading file...")]}):$?s.jsxs("div",{className:"skills-view-detail-error",children:[s.jsx(G,{size:14}),s.jsx("span",{children:$}),s.jsx("button",{className:"btn btn-sm",onClick:()=>c&&void W(c,y),children:e("common.retry","Retry")})]}):u&&!u.isText?s.jsx("div",{className:"skills-view-detail-empty",children:e("skills.fileNotPreviewable","This file cannot be previewed.")}):u?Cs(u.relativePath)?s.jsx(J,{content:u.content||e("skills.emptyFile","(Empty file)"),className:"skills-view-detail-markdown",testId:"skills-view-detail-markdown"}):s.jsx("pre",{className:"skills-view-detail-content",children:u.content||e("skills.emptyFile","(Empty file)")}):null,Z()]}):s.jsxs(s.Fragment,{children:[s.jsx(J,{content:b.skillMd||e("skills.noSkillMd","(No SKILL.md found)"),className:"skills-view-detail-markdown",testId:"skills-view-detail-markdown"}),Z()]}):null:s.jsx("div",{className:"skills-view-detail-placeholder","data-testid":"skills-detail-empty",children:e("skills.selectASkill","Select a skill to view its details")});return s.jsxs("div",{className:"skills-view","data-testid":"skills-view","data-selected":c?"true":"false",children:[s.jsx(ws,{icon:xs,title:e("skills.title","Skills"),actions:s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"skills-view-count","aria-label":e("skills.discoveredCount","{{count}} discovered skills",{count:k.length}),children:[k.length," ",e("skills.discovered","discovered")]}),s.jsx("button",{className:"btn-icon skills-view-close touch-target",onClick:j,"aria-label":e("skills.closeView","Close skills view"),children:s.jsx(H,{size:16})}),s.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),disabled:F,children:[s.jsx(fs,{size:14,className:F?"spin":""}),e("common.refresh","Refresh")]})]})}),s.jsxs("div",{className:"skills-view-body",children:[s.jsx("div",{className:"skills-view__list","data-testid":"skills-list",children:s.jsxs("div",{className:"skills-view-content",children:[s.jsx("div",{className:"skills-view-search",children:s.jsx("input",{type:"text",className:"form-input",placeholder:e("skills.searchPlaceholder","Search skills..."),value:g,onChange:l=>ts(l.target.value),"aria-label":e("skills.searchLabel","Search skills")})}),s.jsxs("section",{className:"skills-view-section","aria-labelledby":"discovered-skills-title",children:[s.jsx("h3",{id:"discovered-skills-title",className:"skills-view-section-title",children:e("skills.discoveredSection","Discovered Skills")}),F?s.jsxs("div",{className:"skills-view-loading",children:[s.jsx("span",{className:"spinner"}),e("skills.loadingDiscovered","Loading discovered skills...")]}):k.length===0?s.jsx("div",{className:"skills-view-empty",children:s.jsx("p",{children:e("skills.noDiscovered","No skills discovered in this project.")})}):O.length===0?s.jsx("div",{className:"skills-view-empty",children:s.jsx("p",{children:e("skills.noMatchingDiscovered","No discovered skills match your search.")})}):s.jsx("div",{className:"skills-view-list",children:O.map(l=>{const t=c===l.id;return s.jsx("div",{children:s.jsxs("div",{className:`skills-view-item${t?" skills-view-item--selected":""}`,onClick:i=>U(l.id,i),role:"button",tabIndex:0,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),U(l.id))},"aria-expanded":t,"aria-label":e("skills.viewDetails","View details for {{name}}",{name:l.name}),children:[s.jsxs("div",{className:"skills-view-item-info",children:[s.jsxs("span",{className:"skills-view-item-name",children:[t?s.jsx(js,{size:14}):s.jsx(ps,{size:14}),s.jsx("span",{className:"skills-view-item-name-text",children:l.name})]}),s.jsx("span",{className:"skills-view-item-path",children:l.relativePath}),s.jsx("span",{className:"skills-view-item-source",children:l.metadata.source})]}),s.jsxs("label",{className:"skills-view-item-toggle",onClick:i=>i.stopPropagation(),children:[s.jsx("input",{type:"checkbox",checked:l.enabled,disabled:l.toggling,onChange:()=>void ns(l.id,l.enabled),"aria-label":e(`skills.${l.enabled?"disable":"enable"}Skill`,l.enabled?"Disable {{name}}":"Enable {{name}}",{name:l.name})}),s.jsx("span",{className:"skills-view-toggle-slider"})]})]})},l.id)})})]}),s.jsxs("section",{className:"skills-view-section","aria-labelledby":"catalog-title",children:[s.jsx("h3",{id:"catalog-title",className:"skills-view-section-title",children:e("skills.catalogSection","Skills Catalog")}),I?s.jsxs("div",{className:"skills-view-error",children:[s.jsx("p",{children:I}),s.jsx("button",{className:"btn btn-sm",onClick:()=>void f(P),children:e("common.tryAgain","Try Again")})]}):Y?s.jsxs("div",{className:"skills-view-loading",children:[s.jsx("span",{className:"spinner"}),e("skills.loadingCatalog","Loading catalog...")]}):_.length===0?s.jsx("div",{className:"skills-view-empty",children:g?s.jsx("p",{children:e("skills.noMatchingSearch","No skills match your search.")}):s.jsx("p",{children:e("skills.noCatalogAvailable","No skills available in the catalog.")})}):s.jsx("div",{className:"skills-view-grid",children:_.map(l=>{const i=!!l.repo?.trim(),n=M===l.id;return s.jsxs("div",{className:"skills-view-card",children:[s.jsxs("div",{className:"skills-view-card-header",children:[s.jsx("h4",{className:"skills-view-card-title",children:l.name}),i?s.jsxs("button",{type:"button",className:"btn btn-sm skills-view-card-install",onClick:()=>void cs(l),disabled:n,"aria-label":e("skills.installSkill","Install {{name}}",{name:l.name}),children:[n?s.jsx(A,{size:14,className:"spin"}):null,n?e("skills.installing","Installing…"):e("skills.install","Install")]}):null]}),l.description&&s.jsx("p",{className:"skills-view-card-description",children:l.description}),l.tags&&l.tags.length>0&&s.jsx("div",{className:"skills-view-card-tags",children:l.tags.map(o=>s.jsx("span",{className:"badge badge--sm",children:o},o))}),l.installs!==void 0&&s.jsx("span",{className:"skills-view-card-installs",children:e("skills.installsCount","{{value}} installs",{value:l.installs.toLocaleString()})})]},l.id)})})]})]})}),s.jsxs("div",{className:"skills-view__detail","data-testid":"skill-detail",children:[s.jsxs("div",{className:"skills-view-detail-header",children:[s.jsx("button",{type:"button",className:"btn btn-sm btn-icon skills-view-detail-back",onClick:X,"aria-label":e("skills.backToList","Back to skills"),title:e("skills.backToList","Back to skills"),"data-testid":"skills-detail-back",children:s.jsx(q,{size:14})}),s.jsx("span",{className:"skills-view-detail-title",children:ds?.name??e("skills.detailTitle","Skill")}),s.jsxs("button",{className:"btn btn-sm skills-view-detail-close",onClick:X,disabled:!c,"aria-label":e("skills.closeDetail","Close skill detail"),children:[s.jsx(H,{size:14}),e("common.close","Close")]})]}),s.jsx("div",{className:"skills-view-detail-body",children:ks()})]})]})]})}export{zs as SkillsView};
@@ -0,0 +1,6 @@
1
+ import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{c as Ht,aC as Lt,aD as yt,aE as Kt,bc as Bt,bd as Vt,be as Xt,bf as qt,bg as Wt,bh as zt,bi as Gt,bj as Yt,aH as Jt,a2 as Qt,bk as Zt,bl as nt,bm as te,bn as jt,L as ee,P as It,p as at,X as it,bo as kt,s as Ct,u as wt,bp as se,o as oe,E as ne,aq as ae,C as ie,bq as de,br as Nt,a9 as le,bs as re}from"./index-aBQwNV_I.js";import{u as At}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-xterm-BNq00GSj.js";/**
2
+ * @license lucide-react v1.7.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ce=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],me=Ht("circle-plus",ce);function ue(x){const{items:r,...f}=x;return f}function St(x){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${x}-${crypto.randomUUID()}`:`${x}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function be(x={}){const{t:r}=At("app"),{projectId:f,addToast:L}=x,o=`${Kt.TODO_LISTS_PREFIX}${f??"global"}`,[w,k]=l.useState(()=>{const s=Lt(o,{maxAgeMs:yt});return Array.isArray(s)?s:[]}),[N,C]=l.useState([]),[E,H]=l.useState(()=>w.length===0),[Q,j]=l.useState(null),[M,R]=l.useState(null),[I,h]=l.useState([]),A=l.useRef(M);A.current=M,l.useEffect(()=>{let s=!1;const c=Lt(o,{maxAgeMs:yt}),u=Array.isArray(c)&&c.length>0;u?(k(c),H(!1)):(k([]),H(!0));async function b(){u||H(!0),j(null);try{const a=await Yt(f);if(s)return;h(a);const n=a.map(ue);k(n),Jt(o,n,{maxBytes:5e5});const i=A.current&&a.some(d=>d.id===A.current)?A.current:a[0]?.id??null;R(i),C(i?a.find(d=>d.id===i)?.items??[]:[])}catch(a){if(s)return;h([]),k([]),C([]),R(null),j(a instanceof Error?a.message:r("todo.failedLoadLists","Failed to load todo lists"))}finally{s||H(!1)}}return b(),()=>{s=!0}},[o,f]),l.useEffect(()=>{if(!M){C([]);return}const s=I.find(c=>c.id===M);C(s?.items??[])},[I,M]);const Z=l.useCallback(async s=>{const c=w,u=I,b=new Date().toISOString(),a={id:St("temp-list"),projectId:f??"",title:s,createdAt:b,updatedAt:b};j(null),k(n=>[...n,a]),h(n=>[...n,{...a,items:[]}]);try{const n=await Bt(s,f);k(i=>i.map(d=>d.id===a.id?n:d)),h(i=>i.map(d=>d.id===a.id?{...n,items:[]}:d)),A.current||R(n.id)}catch(n){k(c),h(u),j(n instanceof Error?n.message:r("todo.failedCreateList","Failed to create list")),L?.(r("todo.failedCreateListToast","Failed to create todo list"),"error")}},[L,I,w,f,r]),K=l.useCallback(async(s,c)=>{const u=w,b=I;j(null),k(a=>a.map(n=>n.id===s?{...n,title:c}:n)),h(a=>a.map(n=>n.id===s?{...n,title:c}:n));try{const a=await Vt(s,c,f);k(n=>n.map(i=>i.id===s?a:i)),h(n=>n.map(i=>i.id===s?{...a,items:i.items}:i))}catch(a){k(u),h(b),j(a instanceof Error?a.message:r("todo.failedRenameList","Failed to rename list")),L?.(r("todo.failedRenameListToast","Failed to rename todo list"),"error")}},[L,I,w,f,r]),D=l.useCallback(async s=>{const c=w,u=I,b=A.current,a=b===s?w.find(n=>n.id!==s)?.id??null:b;j(null),k(n=>n.filter(i=>i.id!==s)),h(n=>n.filter(i=>i.id!==s)),b===s&&R(a);try{await Xt(s,f)}catch(n){k(c),h(u),R(b),j(n instanceof Error?n.message:r("todo.failedDeleteList","Failed to delete list")),L?.(r("todo.failedDeleteListToast","Failed to delete todo list"),"error")}},[L,I,w,f,r]),W=l.useCallback(async s=>{const c=A.current;if(!c)return;const u=N,b=I,a=new Date().toISOString(),n=N.reduce((d,p)=>Math.max(d,p.sortOrder),-1),i={id:St("temp-item"),listId:c,text:s,completed:!1,completedAt:null,createdAt:a,updatedAt:a,sortOrder:n+1};j(null),C(d=>[...d,i]),h(d=>d.map(p=>p.id===c?{...p,items:[...p.items,i]}:p));try{const d=await qt(c,s,f);C(p=>p.map(v=>v.id===i.id?d:v)),h(p=>p.map(v=>v.id===c?{...v,items:v.items.map(_=>_.id===i.id?d:_)}:v))}catch(d){C(u),h(b),j(d instanceof Error?d.message:r("todo.failedCreateItem","Failed to create item")),L?.(r("todo.failedCreateItemToast","Failed to create todo item"),"error")}},[L,N,I,f,r]),S=l.useCallback(async(s,c)=>{const u=N.find(d=>d.id===s);if(!u)return;const b=N,a=I,n=c.completed??u.completed,i={...u,...c,completed:n,completedAt:n?u.completedAt??new Date().toISOString():null,updatedAt:new Date().toISOString()};j(null),C(d=>d.map(p=>p.id===s?i:p)),h(d=>d.map(p=>p.id===i.listId?{...p,items:p.items.map(v=>v.id===s?i:v)}:p));try{const d=await Wt(s,c,f);C(p=>p.map(v=>v.id===s?d:v)),h(p=>p.map(v=>v.id===d.listId?{...v,items:v.items.map(_=>_.id===s?d:_)}:v))}catch(d){C(b),h(a),j(d instanceof Error?d.message:r("todo.failedUpdateItem","Failed to update item")),L?.(r("todo.failedUpdateItemToast","Failed to update todo item"),"error")}},[L,N,I,f,r]),B=l.useCallback(async s=>{const c=N.find(u=>u.id===s);c&&await S(s,{completed:!c.completed})},[N,S]),O=l.useCallback(async s=>{const c=N,u=I;j(null),C(b=>b.filter(a=>a.id!==s)),h(b=>b.map(a=>({...a,items:a.items.filter(n=>n.id!==s)})));try{await zt(s,f)}catch(b){C(c),h(u),j(b instanceof Error?b.message:r("todo.failedDeleteItem","Failed to delete item")),L?.(r("todo.failedDeleteItemToast","Failed to delete todo item"),"error")}},[L,N,I,f,r]),z=l.useCallback(async s=>{const c=A.current;if(!c)return;const u=N,b=I,a=new Map(N.map(i=>[i.id,i])),n=s.map((i,d)=>{const p=a.get(i);return p?{...p,sortOrder:d}:null}).filter(i=>i!==null);j(null),C(n),h(i=>i.map(d=>d.id===c?{...d,items:n}:d));try{await Gt(c,s,f)}catch(i){C(u),h(b),j(i instanceof Error?i.message:r("todo.failedReorderItems","Failed to reorder items")),L?.(r("todo.failedReorderItemsToast","Failed to reorder todo items"),"error")}},[L,N,I,f,r]);return{lists:w,items:N,loading:E,error:Q,selectedListId:M,setSelectedListId:R,createList:Z,renameList:K,deleteList:D,createItem:W,updateItem:S,toggleItem:B,deleteItem:O,reorderItems:z}}function pe(x){return[...x].sort((r,f)=>r.sortOrder-f.sortOrder)}function fe(x){try{const r=re("kb-dashboard-todo-hide-done",x);if(r!==null)return r==="true"}catch{}return!1}function je({projectId:x,addToast:r,onPlanningMode:f,onTaskCreated:L}){const{t:o}=At("app"),{lists:w,items:k,loading:N,error:C,selectedListId:E,setSelectedListId:H,createList:Q,renameList:j,deleteList:M,createItem:R,updateItem:I,toggleItem:h,deleteItem:A,reorderItems:Z}=be({projectId:x,addToast:(t,m)=>{if(m==="success"||m==="error"||m==="info"||m===void 0){r(t,m);return}r(t,"info")}}),[K,D]=l.useState(null),[W,S]=l.useState(""),[B,O]=l.useState(null),[z,s]=l.useState(""),[c,u]=l.useState(""),[b,a]=l.useState(!1),[n,i]=l.useState(""),[d,p]=l.useState([]),[v,_]=l.useState(!1),[tt,V]=l.useState(!1),[dt,X]=l.useState(null),[P,Et]=l.useState(()=>fe(x)),et=l.useRef(null),{confirm:Dt}=Qt(),[Tt,lt]=l.useState("list"),G=l.useMemo(()=>w.find(t=>t.id===E)??null,[w,E]),U=l.useMemo(()=>pe(k.filter(t=>t.listId===E)),[k,E]),Y=l.useMemo(()=>P?U.filter(t=>!t.completed):U,[P,U]),rt=l.useMemo(()=>{const t=new Map;for(const m of w)t.set(m.id,{total:0,completed:0});for(const m of k){const y=t.get(m.listId)??{total:0,completed:0};y.total+=1,m.completed&&(y.completed+=1),t.set(m.listId,y)}return t},[k,w]),st=G?rt.get(G.id)??{total:U.length,completed:U.filter(t=>t.completed).length}:null;function ct(){D(null),S(""),u(""),a(!1)}function J(){O(null),s(""),i("")}function Ft(t){ct(),J(),H(t),lt("detail")}function $t(){lt("list")}const Mt=l.useCallback(async()=>{_(!0);try{const t=await Zt(void 0,x);p(t),V(!0)}catch(t){r(o("todo.failedToLoadAgents","Failed to load agents: {{error}}",{error:nt(t)}),"error"),V(!1),X(null)}finally{_(!1)}},[x,r,o]);l.useEffect(()=>{D(null),S(""),u(""),a(!1),O(null),s(""),i(""),V(!1),X(null)},[E]),l.useEffect(()=>{typeof window<"u"&&te("kb-dashboard-todo-hide-done",P.toString(),x)},[P,x]),l.useEffect(()=>{if(!tt)return;const t=m=>{et.current&&!et.current.contains(m.target)&&(V(!1),X(null))};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[tt]);function Rt(t){J(),D(t.id),S(t.title),a(!1)}async function mt(){if(!K)return;const t=W.trim();if(!t){D(null),S("");return}await j(K,t),D(null),S("")}function ut(){D(null),S("")}function bt(t){ct(),O(t.id),s(t.text)}async function pt(){if(!B)return;const t=z.trim();if(!t){O(null),s("");return}await I(B,{text:t}),O(null),s("")}function ft(){O(null),s("")}async function ht(){const t=c.trim();t&&(await Q(t),u(""),a(!1))}async function xt(){if(!E)return;const t=n.trim();t&&(await R(t),i(""))}async function Ot(t){await Dt({title:o("todo.deleteListTitle","Delete List"),message:o("todo.deleteListConfirm","Delete this list and all its items?"),danger:!0})&&await M(t)}async function _t(t){await A(t)}async function gt(t,m){const y=Y.map($=>$.id),g=y.findIndex($=>$===t);if(g<0)return;const T=m==="up"?g-1:g+1;if(T<0||T>=y.length)return;const F=U.map($=>$.id),q=F.findIndex($=>$===t),ot=F.findIndex($=>$===y[T]);q<0||ot<0||([F[q],F[ot]]=[F[ot],F[q]],await Z(F))}const Pt=l.useCallback(async t=>{try{const m={description:t.text,source:{sourceType:"dashboard_ui"}},y=await jt(m,x);L?.(y),r(o("todo.taskCreatedFromTodo","Created {{id}} from todo",{id:y.id}),"success")}catch(m){r(o("todo.failedToCreateTask","Failed to create task: {{error}}",{error:nt(m)}),"error")}},[x,r,L,o]),Ut=l.useCallback(async(t,m)=>{try{const y={description:t.text,assignedAgentId:m,source:{sourceType:"dashboard_ui"}},g=await jt(y,x);L?.(g);const F=d.find(q=>q.id===m)?.name??m;r(o("todo.taskCreatedAndAssigned","Created {{id}} and assigned to {{agent}}",{id:g.id,agent:F}),"success"),V(!1),X(null)}catch(y){r(o("todo.failedToCreateAndAssign","Failed to create and assign task: {{error}}",{error:nt(y)}),"error")}},[x,r,d,L,o]),vt=null;return N?e.jsxs("div",{className:"todo-view","data-testid":"todo-view-root",children:[vt,e.jsxs("div",{className:"todo-loading",children:[e.jsx(ee,{className:"todo-loading-icon","aria-hidden":"true"}),e.jsx("p",{children:o("todo.loading","Loading todos...")})]})]}):e.jsxs("div",{className:"todo-view","data-testid":"todo-view-root",children:[vt,e.jsxs("div",{className:"todo-view-layout","data-mobile-stack-view":Tt,children:[e.jsxs("aside",{className:"todo-view-sidebar","aria-label":o("todo.listsLabel","Todo lists sidebar"),children:[e.jsxs("div",{className:"todo-sidebar-header",children:[e.jsx("h3",{className:"todo-sidebar-title",children:o("todo.lists","Lists")}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-add-list-btn",onClick:()=>{J(),a(!0),D(null)},"aria-label":o("todo.addList","Add list"),"data-testid":"add-list-button",children:e.jsx(It,{})})]}),b&&e.jsxs("div",{className:"todo-list-item",children:[e.jsx("input",{className:"input todo-inline-edit-input",placeholder:o("todo.newListTitle","New list title"),value:c,onChange:t=>u(t.target.value),onKeyDown:t=>{t.key==="Enter"&&ht(),t.key==="Escape"&&(u(""),a(!1))},autoFocus:!0,"data-testid":"new-list-input"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{ht()},"aria-label":o("todo.saveList","Save list"),children:e.jsx(at,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{u(""),a(!1)},"aria-label":o("todo.cancelList","Cancel list"),children:e.jsx(it,{})})]}),w.length===0&&!b?e.jsxs("div",{className:"todo-empty-state",children:[e.jsx(kt,{"aria-hidden":"true"}),e.jsx("p",{children:o("todo.noListsEmpty","No todo lists yet. Create one to get started.")}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>{J(),a(!0)},children:o("todo.createList","Create List")})]}):e.jsx("div",{className:"todo-list-items",role:"list","aria-label":o("todo.todoListsLabel","Todo lists"),children:w.map(t=>{const m=t.id===E,y=t.id===K,g=rt.get(t.id)??{total:0,completed:0};return e.jsx("div",{className:`todo-list-item${m?" todo-list-item--active":""}`,role:"listitem",children:y?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"input todo-inline-edit-input",value:W,onChange:T=>S(T.target.value),onKeyDown:T=>{T.key==="Enter"&&mt(),T.key==="Escape"&&ut()},autoFocus:!0,"data-testid":`rename-list-input-${t.id}`}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{mt()},"aria-label":o("todo.saveListRename","Save list rename"),children:e.jsx(at,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:ut,"aria-label":o("todo.cancelListRename","Cancel list rename"),children:e.jsx(it,{})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"todo-list-select-btn",onClick:()=>Ft(t.id),"aria-label":o("todo.selectList","Select list {{title}}",{title:t.title}),"aria-current":m?"true":void 0,"data-testid":`todo-list-${t.id}`,children:[e.jsx("span",{className:"todo-list-item-name",children:t.title}),e.jsxs("span",{className:"todo-list-item-count",children:[g.completed,"/",g.total]})]}),e.jsxs("div",{className:"todo-list-item-actions",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{Rt(t)},"aria-label":o("todo.renameList","Rename {{title}}",{title:t.title}),"data-testid":`rename-list-button-${t.id}`,children:e.jsx(Ct,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon btn-danger todo-icon-btn",onClick:()=>{Ot(t.id)},"aria-label":o("todo.deleteList","Delete {{title}}",{title:t.title}),"data-testid":`delete-list-button-${t.id}`,children:e.jsx(wt,{})})]})]})},t.id)})})]}),e.jsxs("section",{className:"todo-view-main","aria-label":o("todo.itemsLabel","Todo items"),children:[C&&e.jsxs("div",{className:"todo-error-banner",role:"alert",children:[e.jsx("span",{className:"todo-error-message",children:C}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>window.location.reload(),children:o("actions.retry","Retry")})]}),G?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"todo-items-header",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn todo-mobile-back-btn",onClick:$t,"aria-label":o("todo.backToLists","Back to lists"),"data-testid":"todo-mobile-back-button",children:e.jsx(se,{})}),e.jsxs("div",{className:"todo-items-heading",children:[e.jsx("h3",{children:G.title}),st&&e.jsx("span",{className:"todo-items-progress",children:o("todo.completedCount","{{completed}}/{{total}} complete",{completed:st.completed,total:st.total})})]}),e.jsxs("button",{type:"button",className:"btn btn-sm todo-hide-done-toggle","aria-pressed":P,onClick:()=>Et(t=>!t),"data-testid":"todo-hide-done-toggle",children:[P?e.jsx(oe,{"aria-hidden":"true"}):e.jsx(ne,{"aria-hidden":"true"}),P?o("todo.showDone","Show done"):o("todo.hideDone","Hide done")]})]}),e.jsxs("div",{className:"todo-add-item-row",children:[e.jsx("input",{className:"input",placeholder:o("todo.addItemPlaceholder","Add a todo item"),value:n,onChange:t=>i(t.target.value),onKeyDown:t=>{t.key==="Enter"&&xt(),t.key==="Escape"&&i("")},"data-testid":"new-item-input"}),e.jsxs("button",{type:"button",className:"btn btn-primary",onClick:()=>{xt()},children:[e.jsx(It,{size:14}),o("actions.add","Add")]})]}),U.length===0?e.jsx("div",{className:"todo-empty-state",children:e.jsx("p",{children:o("todo.noItemsEmpty","No items in this list. Add one above.")})}):Y.length===0?e.jsx("div",{className:"todo-empty-state","data-testid":"todo-all-done-hidden-empty",children:e.jsx("p",{children:o("todo.allDoneHidden","All items are complete. Choose Show done to view them.")})}):e.jsx("div",{className:"todo-items-list",children:Y.map((t,m)=>{const y=t.id===B;return e.jsxs("div",{className:"todo-item","data-testid":`todo-item-${t.id}`,children:[e.jsxs("div",{className:"todo-item-main-row",children:[e.jsx("input",{type:"checkbox",checked:t.completed,onChange:()=>{h(t.id)},className:"todo-item-checkbox","aria-label":`Toggle ${t.text}`,"data-testid":`toggle-item-${t.id}`}),y?e.jsx("input",{className:"input todo-inline-edit-input",value:z,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&pt(),g.key==="Escape"&&ft()},autoFocus:!0,"data-testid":`edit-item-input-${t.id}`}):e.jsx("button",{type:"button",className:`todo-item-text${t.completed?" todo-item-text--completed":""}`,onClick:()=>bt(t),children:t.text})]}),e.jsx("div",{className:"todo-item-actions","data-testid":`todo-item-actions-${t.id}`,children:y?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{pt()},"aria-label":o("todo.saveItemEdit","Save item edit"),children:e.jsx(at,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:ft,"aria-label":o("todo.cancelItemEdit","Cancel item edit"),children:e.jsx(it,{})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"todo-item-reorder-btns",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-item-reorder-btn",onClick:()=>{gt(t.id,"up")},disabled:m===0,"aria-label":o("todo.moveItemUp","Move {{text}} up",{text:t.text}),"data-testid":`move-up-${t.id}`,children:e.jsx(ae,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-item-reorder-btn",onClick:()=>{gt(t.id,"down")},disabled:m===Y.length-1,"aria-label":o("todo.moveItemDown","Move {{text}} down",{text:t.text}),"data-testid":`move-down-${t.id}`,children:e.jsx(ie,{})})]}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{f?.(t.text)},"aria-label":o("todo.startPlanning","Start planning from {{text}}",{text:t.text}),"data-testid":`planning-from-${t.id}`,children:e.jsx(de,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{Pt(t)},"aria-label":o("todo.createTaskFrom","Create task from {{text}}",{text:t.text}),"data-testid":`create-task-from-${t.id}`,children:e.jsx(me,{})}),e.jsxs("div",{className:"todo-agent-picker-trigger",ref:dt===t.id?et:void 0,children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{X(t.id),Mt()},"aria-label":o("todo.assignAgent","Assign {{text}} to agent",{text:t.text}),"data-testid":`assign-agent-for-${t.id}`,children:e.jsx(Nt,{})}),tt&&dt===t.id&&e.jsx("div",{className:"todo-agent-picker-dropdown",onMouseDown:g=>{g.preventDefault()},children:v?e.jsx("div",{className:"todo-agent-picker-loading",children:e.jsx(le,{label:o("todo.loadingAgents","Loading agents...")})}):d.length>0?d.map(g=>e.jsxs("button",{type:"button",className:"todo-agent-picker-item",onClick:()=>{Ut(t,g.id)},children:[e.jsx(Nt,{}),e.jsx("span",{children:g.name}),e.jsx("span",{className:"todo-agent-picker-role",children:g.role})]},g.id)):e.jsx("div",{className:"todo-agent-picker-empty",children:o("todo.noAgentsAvailable","No agents available")})})]}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>bt(t),"aria-label":o("todo.editItem","Edit {{text}}",{text:t.text}),"data-testid":`edit-item-${t.id}`,children:e.jsx(Ct,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon btn-danger todo-icon-btn",onClick:()=>{_t(t.id)},"aria-label":o("todo.deleteItem","Delete {{text}}",{text:t.text}),"data-testid":`delete-item-${t.id}`,children:e.jsx(wt,{})})]})})]},t.id)})})]}):e.jsxs("div",{className:"todo-empty-state",children:[e.jsx(kt,{"aria-hidden":"true"}),e.jsx("p",{children:o("todo.selectListEmpty","Select a list from the sidebar")})]})]})]})]})}export{je as TodoView};
@@ -0,0 +1 @@
1
+ .todo-view{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--space-lg);height:100%;min-height:0;min-width:0;width:100%;overflow:hidden;padding:0 var(--space-lg) var(--space-lg);container-type:inline-size;container-name:todo-view}.todo-mobile-back-btn{display:none}.todo-view-subtitle{margin:0;color:var(--text-muted)}.todo-view-layout{display:flex;flex-direction:row;flex:1 1 auto;min-height:0;min-width:0;overflow:hidden;gap:var(--space-lg)}.todo-view-sidebar{width:calc(var(--space-2xl) * 7 + var(--space-sm));border-right:calc(var(--space-xs) / 4) solid var(--border);padding-right:var(--space-lg);overflow-y:auto;flex-shrink:0;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--text-muted) 45%,transparent) transparent}.todo-view-main{flex:1;overflow-y:auto;display:flex;flex-direction:column;min-width:0;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--text-muted) 45%,transparent) transparent}.todo-view-sidebar::-webkit-scrollbar,.todo-view-main::-webkit-scrollbar{width:var(--space-sm);height:var(--space-sm)}.todo-view-sidebar::-webkit-scrollbar-thumb,.todo-view-main::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--text-muted) 45%,transparent);border-radius:var(--radius-pill)}.todo-view-sidebar::-webkit-scrollbar-track,.todo-view-main::-webkit-scrollbar-track{background:transparent}.todo-sidebar-header{display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:var(--space-md)}.todo-sidebar-title{font-size:calc(var(--space-md) + (var(--space-xs) / 4));color:var(--text-muted);text-transform:uppercase;letter-spacing:calc(var(--space-xs) / 8);margin:0}.todo-add-list-btn{min-height:calc(var(--space-2xl) + var(--space-xs));min-width:calc(var(--space-2xl) + var(--space-xs))}.todo-list-items{display:flex;flex-direction:column;gap:var(--space-xs)}.todo-list-item{display:flex;flex-direction:row;align-items:center;padding:var(--space-sm) var(--space-md);border-radius:var(--radius-sm);gap:var(--space-sm);color:var(--text-muted);transition:background var(--transition-fast),color var(--transition-fast)}.todo-list-select-btn{flex:1;min-width:0;border:0;background:none;color:inherit;text-align:left;cursor:pointer;padding:0}.todo-list-select-btn:focus-visible{outline:none;border-radius:var(--radius-sm);box-shadow:var(--focus-ring)}.todo-list-item--active{background:var(--surface);color:var(--text);font-weight:500}.todo-list-item-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:calc(var(--space-md) + (var(--space-xs) / 4))}.todo-list-item-actions{display:flex;flex-direction:row;gap:var(--space-xs);opacity:0;transition:opacity var(--transition-fast)}.todo-list-item:hover .todo-list-item-actions,.todo-list-item:focus-within .todo-list-item-actions,.todo-list-item--active .todo-list-item-actions{opacity:1}.todo-icon-btn{min-height:calc(var(--space-lg) + var(--space-sm));min-width:calc(var(--space-lg) + var(--space-sm))}.todo-inline-edit-input{flex:1;font-size:calc(var(--space-md) + (var(--space-xs) / 4))}.todo-items-header{display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:var(--space-md);gap:var(--space-sm)}.todo-items-header h3{margin:0;font-size:calc(var(--space-md) + (var(--space-xs) / 2));font-weight:500;color:var(--text)}.todo-add-item-row{display:flex;flex-direction:row;gap:var(--space-sm);margin-bottom:var(--space-lg)}.todo-add-item-row .input{flex:1}.todo-items-list{display:flex;flex-direction:column}.todo-item{position:relative;display:flex;flex-direction:column;align-items:stretch;padding:var(--space-sm) var(--space-md);border-radius:var(--radius-sm);gap:var(--space-sm);border-bottom:calc(var(--space-xs) / 4) solid var(--border);transition:background var(--transition-fast)}.todo-item:hover{background:var(--card-hover)}.todo-item-main-row{display:flex;align-items:flex-start;gap:var(--space-sm);min-width:0}.todo-item-checkbox{margin:0;width:var(--space-lg);height:var(--space-lg);accent-color:var(--todo);cursor:pointer;flex-shrink:0}.todo-item-text{flex:1;font-size:calc(var(--space-md) + (var(--space-xs) / 4));color:var(--text);cursor:pointer;word-break:break-word;background:none;border:0;padding:0;text-align:left}.todo-item-text:focus-visible{outline:none;border-radius:var(--radius-sm);box-shadow:var(--focus-ring-strong)}.todo-item-text--completed{text-decoration:line-through;color:var(--text-muted)}.todo-item-actions{display:flex;flex-wrap:wrap;flex-direction:row;align-items:center;gap:var(--space-xs);opacity:1;transition:opacity var(--transition-fast);margin-left:calc(var(--space-lg) + var(--space-sm))}.todo-item-reorder-btns{display:flex;flex-direction:row;gap:0}.todo-item-reorder-btn{min-height:var(--space-xl);min-width:var(--space-xl)}.todo-agent-picker-trigger{position:relative}.todo-agent-picker-dropdown{position:absolute;right:0;top:100%;z-index:50;display:flex;flex-direction:column;gap:var(--space-xs);margin-top:var(--space-xs);min-width:calc(var(--space-2xl) * 6 + var(--space-md));max-height:calc(var(--space-2xl) * 7 + var(--space-md));overflow-y:auto;padding:var(--space-xs);border:calc(var(--space-xs) / 4) solid var(--border);border-radius:var(--radius-md);background:var(--surface);box-shadow:var(--shadow-lg)}.todo-agent-picker-item{width:100%;border:0;border-radius:var(--radius-sm);background:transparent;color:var(--text);padding:var(--space-sm);display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--space-sm);text-align:left;cursor:pointer;transition:background var(--transition-fast)}.todo-agent-picker-item:hover{background:var(--card-hover)}.todo-agent-picker-item:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.todo-agent-picker-role{color:var(--text-muted);font-size:calc(var(--space-md) - (var(--space-xs) / 4));text-transform:uppercase;letter-spacing:calc(var(--space-xs) / 8)}.todo-agent-picker-loading,.todo-agent-picker-empty{color:var(--text-muted);padding:var(--space-sm);font-size:calc(var(--space-md) + (var(--space-xs) / 8))}.todo-error-banner{border:calc(var(--space-xs) / 4) solid color-mix(in srgb,var(--color-error) 35%,transparent);background:color-mix(in srgb,var(--color-error) 10%,transparent);color:var(--color-error);border-radius:var(--radius-md);padding:var(--space-md);margin-bottom:var(--space-md);display:flex;align-items:center;justify-content:space-between;gap:var(--space-sm)}.todo-error-message{font-size:calc(var(--space-md) + (var(--space-xs) / 4))}.todo-empty-state,.todo-loading{color:var(--text-muted);padding:var(--space-2xl);text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-sm);flex:1}.todo-loading-icon{animation:todo-loading-spinner-spin calc(var(--duration-slow) * 4) linear infinite}@keyframes todo-loading-spinner-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.todo-view{gap:var(--space-md);padding:var(--space-lg);background:var(--bg)}.todo-view-layout{gap:var(--space-md);padding:0}.todo-view-sidebar,.todo-view-main{min-height:0;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-sm)}.todo-view-sidebar{width:min(32%,320px);min-width:240px;padding:var(--space-md);border-right:1px solid var(--border)}.todo-view-main{padding:var(--space-md)}.todo-sidebar-header{margin-bottom:var(--space-sm);padding-bottom:var(--space-sm)}.todo-sidebar-title{color:var(--text);font-size:.75rem;font-weight:700;letter-spacing:.08em}.todo-add-list-btn,.todo-icon-btn,.todo-item-reorder-btn{border-color:transparent;background:transparent}.todo-list-items{gap:var(--space-sm)}.todo-list-item{min-height:42px;padding:var(--space-sm);border-radius:var(--radius-md);color:var(--text-muted)}.todo-list-item:hover{background:var(--card-hover);color:var(--text)}.todo-list-item--active{background:color-mix(in srgb,var(--todo) 10%,var(--surface));color:var(--text)}.todo-list-select-btn{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:var(--space-sm)}.todo-list-item-name{font-weight:600}.todo-list-item-count{padding:2px var(--space-xs);border:1px solid var(--border);border-radius:var(--radius-pill);background:var(--bg);color:var(--text-muted);font-family:var(--font-mono);font-size:.6875rem;line-height:1.2}.todo-list-item--active .todo-list-item-count{border-color:color-mix(in srgb,var(--todo) 36%,var(--border));color:var(--todo)}.todo-items-header{align-items:flex-start;margin-bottom:var(--space-md);padding-bottom:var(--space-sm);border-bottom:1px solid var(--border)}.todo-items-heading{display:flex;flex:1;min-width:0;flex-direction:column;gap:var(--space-xs)}.todo-items-heading h3{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1.05rem;font-weight:650}.todo-items-progress{color:var(--text-muted);font-size:.8125rem}.todo-hide-done-toggle{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-xs);flex-shrink:0;white-space:nowrap;color:var(--text-muted);border-color:var(--border);background:var(--surface)}.todo-hide-done-toggle[aria-pressed=true]{color:var(--todo);border-color:color-mix(in srgb,var(--todo) 36%,var(--border));background:color-mix(in srgb,var(--todo) 8%,var(--surface))}.todo-hide-done-toggle svg{width:var(--space-md);height:var(--space-md)}.todo-add-item-row{margin-bottom:var(--space-md);padding:var(--space-sm);border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--bg)}.todo-add-item-row .input{min-height:34px;border-color:transparent;background:transparent}.todo-add-item-row .input:focus{border-color:var(--border);background:var(--surface)}.todo-add-item-row .btn{display:inline-flex;align-items:center;gap:var(--space-xs);white-space:nowrap}.todo-items-list{gap:var(--space-sm)}.todo-item{flex-direction:row;align-items:center;padding:var(--space-xs) var(--space-sm) var(--space-xs) var(--space-md);border:1px solid var(--border);border-radius:var(--radius-md);background:var(--card);min-height:44px;transition:background var(--transition-fast),border-color var(--transition-fast)}.todo-item:hover{background:var(--surface);border-color:color-mix(in srgb,var(--todo) 28%,var(--border))}.todo-item-main-row{flex:1 1 auto;align-items:center;min-width:0}.todo-item-checkbox{width:16px;height:16px;margin-top:0}.todo-item-text{line-height:1.45;font-weight:500}.todo-item-text--completed{color:var(--text-muted)}.todo-item-actions{align-items:center;flex-wrap:nowrap;flex-shrink:0;margin-left:auto;padding-top:0;border-top:none;color:var(--text-muted);opacity:.6;transition:opacity var(--transition-fast)}.todo-item:hover .todo-item-actions,.todo-item:focus-within .todo-item-actions{opacity:1}.todo-item-actions .todo-icon-btn svg,.todo-item-reorder-btn svg{width:15px;height:15px}.todo-item-reorder-btns{padding-right:var(--space-xs);border-right:1px solid var(--border)}.todo-empty-state,.todo-loading{border:1px dashed var(--border);border-radius:var(--radius-lg);background:color-mix(in srgb,var(--surface) 70%,transparent)}@container todo-view (max-width: 520px){.todo-view-layout{flex-direction:column;min-height:0;overflow:hidden;gap:0}.todo-view-layout .todo-view-sidebar,.todo-view-layout .todo-view-main{width:100%;min-width:0;height:100%;max-height:none;flex:1 1 auto;border-right:none;padding-right:0;overflow-x:hidden;overflow-y:auto}.todo-view-sidebar{border-bottom:none}.todo-view-layout[data-mobile-stack-view=list] .todo-view-main,.todo-view-layout[data-mobile-stack-view=detail] .todo-view-sidebar{display:none}.todo-mobile-back-btn{display:inline-flex}.todo-list-item,.todo-list-select-btn,.todo-add-list-btn,.todo-icon-btn,.todo-item,.todo-item-reorder-btn,.todo-add-item-row .btn{min-height:calc(var(--space-2xl) + var(--space-xs))}.todo-list-item-actions,.todo-item-actions{opacity:1}.todo-items-header{align-items:stretch;flex-wrap:wrap}.todo-hide-done-toggle{min-height:calc(var(--space-2xl) + var(--space-xs))}.todo-item{flex-direction:column;align-items:stretch;gap:var(--space-sm);padding:var(--space-sm) var(--space-md)}.todo-item-actions{margin-left:0;flex-wrap:wrap;justify-content:flex-end}.todo-add-item-row{flex-wrap:wrap}.todo-add-item-row .btn{width:100%}.todo-agent-picker-trigger{position:static}.todo-agent-picker-dropdown{left:0;right:0;min-width:100%;max-height:calc(var(--space-2xl) * 8)}.todo-agent-picker-item{min-height:calc(var(--space-2xl) + var(--space-xs))}}@media(max-width:768px){.todo-view{padding:0 var(--space-md) var(--space-md);min-height:0}.todo-view-layout{flex-direction:column;min-height:0;overflow:hidden;padding:0}.todo-view-sidebar{width:100%;border-right:none;border-bottom:calc(var(--space-xs) / 4) solid var(--border);padding-right:0;padding-bottom:var(--space-md);max-height:calc(var(--space-2xl) * 6 + var(--space-sm))}.todo-view-main{width:100%;flex:1;min-height:0}.todo-list-item,.todo-list-select-btn,.todo-add-list-btn,.todo-icon-btn,.todo-item,.todo-item-reorder-btn,.todo-add-item-row .btn{min-height:calc(var(--space-2xl) + var(--space-xs))}.todo-add-item-row{flex-wrap:wrap}.todo-add-item-row .btn{width:100%}.todo-list-item-actions,.todo-item-actions{opacity:1}.todo-item-main-row{align-items:center}.todo-items-header{align-items:stretch;flex-wrap:wrap}.todo-hide-done-toggle{min-height:calc(var(--space-2xl) + var(--space-xs))}.todo-item{flex-direction:column;align-items:stretch;gap:var(--space-sm);padding:var(--space-sm) var(--space-md)}.todo-item-actions{margin-left:0;flex-wrap:wrap;justify-content:flex-end}.todo-item-checkbox{width:calc(var(--space-2xl) + var(--space-xs));height:calc(var(--space-2xl) + var(--space-xs))}.todo-agent-picker-trigger{position:static}.todo-agent-picker-dropdown{left:0;right:0;min-width:100%;max-height:calc(var(--space-2xl) * 8)}.todo-agent-picker-item{min-height:calc(var(--space-2xl) + var(--space-xs))}}