@runfusion/fusion 0.59.0 → 0.60.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 (118) hide show
  1. package/dist/bin.js +173 -16
  2. package/dist/client/.vite/manifest.json +239 -239
  3. package/dist/client/assets/{AgentDetailView-UmilJU0C.js → AgentDetailView-BBjuuYbU.js} +1 -1
  4. package/dist/client/assets/{AgentPermissionPolicyEditor-DqYOX1kN.js → AgentPermissionPolicyEditor-DOdy1ln0.js} +1 -1
  5. package/dist/client/assets/{AgentsView-Dt0nKyx7.js → AgentsView-DlyT08sc.js} +3 -3
  6. package/dist/client/assets/{ChatView-C7trV16u.js → ChatView-CJBnc6rJ.js} +1 -1
  7. package/dist/client/assets/{CommandCenter-Dsg16_mK.js → CommandCenter-BhRLZmOH.js} +1 -1
  8. package/dist/client/assets/{DevServerView-DnpnAU_g.js → DevServerView-DRpi8Xqz.js} +1 -1
  9. package/dist/client/assets/{DirectoryPicker-BzpWdpTC.js → DirectoryPicker-Bw_A-64N.js} +1 -1
  10. package/dist/client/assets/{DocumentsView-C2jRDIo6.js → DocumentsView-w0eDbpbG.js} +1 -1
  11. package/dist/client/assets/{EvalsView-M1nIXx-S.js → EvalsView-DxQALLwD.js} +1 -1
  12. package/dist/client/assets/{ExperimentalAgentOnboardingModal-5Kg2iQtB.js → ExperimentalAgentOnboardingModal-BuEWZrjl.js} +1 -1
  13. package/dist/client/assets/{GoalsView-7bFpy-lr.js → GoalsView-C3MGEtSt.js} +1 -1
  14. package/dist/client/assets/{InsightsView-D0HPy3RP.js → InsightsView-C0-BkE8_.js} +1 -1
  15. package/dist/client/assets/{MemoryView-CNzJcoPi.js → MemoryView-Dd8uiLHH.js} +1 -1
  16. package/dist/client/assets/{PiExtensionsManager-D0a8Q47c.js → PiExtensionsManager-DlsEVOjG.js} +1 -1
  17. package/dist/client/assets/{PluginManager-N2Ne57i_.js → PluginManager-Cf9AOCcC.js} +1 -1
  18. package/dist/client/assets/{PullRequestView-Be4GM2H5.js → PullRequestView-hm77QtHV.js} +1 -1
  19. package/dist/client/assets/{ResearchView-DYW9ViMl.js → ResearchView-BMQEnYH6.js} +1 -1
  20. package/dist/client/assets/{SecretsView-B3jEFeGp.js → SecretsView-Dc3sWf40.js} +1 -1
  21. package/dist/client/assets/{SessionTerminal-DGFADOH4.js → SessionTerminal-CEv1G-9-.js} +1 -1
  22. package/dist/client/assets/SettingsModal-DFrTDsBm.js +21 -0
  23. package/dist/client/assets/{SettingsModal-Lw0RmeRd.js → SettingsModal-TuphE_CP.js} +1 -1
  24. package/dist/client/assets/{SetupWizardModal-BifMmJIa.js → SetupWizardModal-CNGogJJp.js} +2 -2
  25. package/dist/client/assets/{ShadcnColorPicker-B1UClHqm.js → ShadcnColorPicker-1Z7JIWTE.js} +1 -1
  26. package/dist/client/assets/{SkillsView--U-5lH1V.js → SkillsView-CjPvmnz6.js} +1 -1
  27. package/dist/client/assets/{TodoView-BwxNdIXm.js → TodoView-DmJPSWOu.js} +1 -1
  28. package/dist/client/assets/{WorkflowNodeEditor-BmTZR0i8.js → WorkflowNodeEditor-BqO2yRXe.js} +1 -1
  29. package/dist/client/assets/{agentSkills-PqEK0Uf_.js → agentSkills-BNahUMFe.js} +1 -1
  30. package/dist/client/assets/{app-BlgX3hw4.js → app-BzgEwAOr.js} +1 -1
  31. package/dist/client/assets/{architectureDiagram-3BPJPVTR-DxAKryer.js → architectureDiagram-3BPJPVTR-Bb_ZGdtz.js} +1 -1
  32. package/dist/client/assets/{blockDiagram-GPEHLZMM-BfPC7WG4.js → blockDiagram-GPEHLZMM-CWfWJnIM.js} +1 -1
  33. package/dist/client/assets/{c4Diagram-AAUBKEIU-DnVJBAB1.js → c4Diagram-AAUBKEIU-Dufe_2hy.js} +1 -1
  34. package/dist/client/assets/channel-BYHFEnHT.js +1 -0
  35. package/dist/client/assets/{chunk-2J33WTMH-2LaGYtnx.js → chunk-2J33WTMH-BdKWX3Y7.js} +1 -1
  36. package/dist/client/assets/{chunk-4BX2VUAB-C7xxOb1T.js → chunk-4BX2VUAB-CQ9_zgu6.js} +1 -1
  37. package/dist/client/assets/{chunk-55IACEB6-CAxHAFXx.js → chunk-55IACEB6-DEFTCISD.js} +1 -1
  38. package/dist/client/assets/{chunk-727SXJPM-CnZuaU-I.js → chunk-727SXJPM-8RnJp1fx.js} +1 -1
  39. package/dist/client/assets/{chunk-AQP2D5EJ-DutKSMk1.js → chunk-AQP2D5EJ-DJg6awe1.js} +1 -1
  40. package/dist/client/assets/{chunk-FMBD7UC4-C7PQ58jc.js → chunk-FMBD7UC4-Bw-OImRT.js} +1 -1
  41. package/dist/client/assets/{chunk-ND2GUHAM-BQ0UHfJw.js → chunk-ND2GUHAM-BSx9p0RO.js} +1 -1
  42. package/dist/client/assets/{chunk-QZHKN3VN-BadmXu1v.js → chunk-QZHKN3VN-Dbdv72P6.js} +1 -1
  43. package/dist/client/assets/classDiagram-4FO5ZUOK-BLstvJ1W.js +1 -0
  44. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BLstvJ1W.js +1 -0
  45. package/dist/client/assets/{cose-bilkent-S5V4N54A-37z9Hx7d.js → cose-bilkent-S5V4N54A-CXtcC6U2.js} +1 -1
  46. package/dist/client/assets/{dagre-BM42HDAG-B70rt1ZW.js → dagre-BM42HDAG-BO0r4g14.js} +1 -1
  47. package/dist/client/assets/{dashboard-view-GT7dDNd7.js → dashboard-view-BTnVGch5.js} +1 -1
  48. package/dist/client/assets/{dashboard-view-DdAL0vfN.js → dashboard-view-CoDeYJbQ.js} +1 -1
  49. package/dist/client/assets/{diagram-2AECGRRQ-se4pabEk.js → diagram-2AECGRRQ-CLmeU2g6.js} +1 -1
  50. package/dist/client/assets/{diagram-5GNKFQAL-ijyxpVgX.js → diagram-5GNKFQAL-CKyM23Jy.js} +1 -1
  51. package/dist/client/assets/{diagram-KO2AKTUF-DUGQ8jXI.js → diagram-KO2AKTUF-ByeVRDs_.js} +1 -1
  52. package/dist/client/assets/{diagram-LMA3HP47-BYydC37K.js → diagram-LMA3HP47-r8qKTJDn.js} +1 -1
  53. package/dist/client/assets/{diagram-OG6HWLK6-DlUn5jkD.js → diagram-OG6HWLK6-D2ugPdm7.js} +1 -1
  54. package/dist/client/assets/{erDiagram-TEJ5UH35-ChYKGDIc.js → erDiagram-TEJ5UH35-dLzbDn0G.js} +1 -1
  55. package/dist/client/assets/{flowDiagram-I6XJVG4X-CoQKr6ba.js → flowDiagram-I6XJVG4X-et7EENd6.js} +1 -1
  56. package/dist/client/assets/{folder-open-YuIEuDwd.js → folder-open-BVtcjVIK.js} +1 -1
  57. package/dist/client/assets/{ganttDiagram-6RSMTGT7-Cff6URun.js → ganttDiagram-6RSMTGT7-DmiabChP.js} +1 -1
  58. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-CnlZVE6T.js → gitGraphDiagram-PVQCEYII-I1vbhqer.js} +1 -1
  59. package/dist/client/assets/index-inWk2g6R.js +2540 -0
  60. package/dist/client/assets/{infoDiagram-5YYISTIA-DYLBAKrj.js → infoDiagram-5YYISTIA-xd6L9Gq3.js} +1 -1
  61. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-7xSxQNhn.js → ishikawaDiagram-YF4QCWOH-fUeEYBvD.js} +1 -1
  62. package/dist/client/assets/{journeyDiagram-JHISSGLW-DREqJGeQ.js → journeyDiagram-JHISSGLW-B7xjU8Oh.js} +1 -1
  63. package/dist/client/assets/{kanban-definition-UN3LZRKU-_lzeYhpL.js → kanban-definition-UN3LZRKU-CJ8oRjFI.js} +1 -1
  64. package/dist/client/assets/{mermaid.core-DNTJMy0V.js → mermaid.core-2udKsaH3.js} +4 -4
  65. package/dist/client/assets/{mindmap-definition-RKZ34NQL-DR9UulDp.js → mindmap-definition-RKZ34NQL-CVywzN7Q.js} +1 -1
  66. package/dist/client/assets/{pieDiagram-4H26LBE5-DD1LCdSp.js → pieDiagram-4H26LBE5-8vzzC4Mg.js} +1 -1
  67. package/dist/client/assets/{puzzle-DaVSYDOd.js → puzzle-D60d3Nv1.js} +1 -1
  68. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-iLEGylFT.js → quadrantDiagram-W4KKPZXB-Cxyb4Mom.js} +1 -1
  69. package/dist/client/assets/{requirementDiagram-4Y6WPE33-D7IX9UbY.js → requirementDiagram-4Y6WPE33-Bs5RaG7r.js} +1 -1
  70. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-DC30taEV.js → sankeyDiagram-5OEKKPKP-Jf7Zq43D.js} +1 -1
  71. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-DjMKbjmL.js → sequenceDiagram-3UESZ5HK-CG0I780H.js} +1 -1
  72. package/dist/client/assets/{shield-alert-BcyPZs5t.js → shield-alert-B7JyuWPR.js} +1 -1
  73. package/dist/client/assets/{stateDiagram-AJRCARHV-DJSnSkUL.js → stateDiagram-AJRCARHV-C1c5XtKG.js} +1 -1
  74. package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-KC2rSU3J.js → stateDiagram-v2-BHNVJYJU-Cv7_pOt_.js} +1 -1
  75. package/dist/client/assets/{timeline-definition-PNZ67QCA-5DyrH8WZ.js → timeline-definition-PNZ67QCA-BWg-lsI0.js} +1 -1
  76. package/dist/client/assets/{upload-C_8IHSzk.js → upload-Dxv5FPaS.js} +1 -1
  77. package/dist/client/assets/{users-DfGiwmqG.js → users-DvKg3opr.js} +1 -1
  78. package/dist/client/assets/{vennDiagram-CIIHVFJN-Bh5X-uVf.js → vennDiagram-CIIHVFJN-gFjFmLlv.js} +1 -1
  79. package/dist/client/assets/{wardley-L42UT6IY-ZIwV-wIZ.js → wardley-L42UT6IY-BaCNX8ou.js} +1 -1
  80. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-DI92L1jA.js → wardleyDiagram-YWT4CUSO-BRR6aw0q.js} +1 -1
  81. package/dist/client/assets/{xychartDiagram-2RQKCTM6-B6RjJCM8.js → xychartDiagram-2RQKCTM6-D6Gwn1XW.js} +1 -1
  82. package/dist/client/index.html +1 -1
  83. package/dist/client/version.json +1 -1
  84. package/dist/droid-cli/package.json +1 -1
  85. package/dist/extension.js +173 -16
  86. package/dist/pi-claude-cli/package.json +1 -1
  87. package/dist/plugin-sdk/index.d.ts +7 -0
  88. package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +0 -6
  89. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  90. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  91. package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +0 -5
  92. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  93. package/dist/plugins/fusion-plugin-cursor-runtime/bundled.js +0 -5
  94. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  95. package/dist/plugins/fusion-plugin-dependency-graph/bundled.js +0 -5
  96. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  97. package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +0 -5
  98. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  99. package/dist/plugins/fusion-plugin-grok-runtime/bundled.js +0 -6
  100. package/dist/plugins/fusion-plugin-grok-runtime/package.json +1 -1
  101. package/dist/plugins/fusion-plugin-hermes-runtime/bundled.js +0 -5
  102. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  103. package/dist/plugins/fusion-plugin-linear-import/bundled.js +0 -5
  104. package/dist/plugins/fusion-plugin-linear-import/package.json +1 -1
  105. package/dist/plugins/fusion-plugin-openclaw-runtime/bundled.js +0 -5
  106. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  107. package/dist/plugins/fusion-plugin-paperclip-runtime/bundled.js +0 -5
  108. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  109. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  110. package/dist/plugins/fusion-plugin-roadmap/bundled.js +0 -5
  111. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  112. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  113. package/package.json +1 -1
  114. package/dist/client/assets/SettingsModal-CtOCCZEj.js +0 -21
  115. package/dist/client/assets/channel-D23u9xEh.js +0 -1
  116. package/dist/client/assets/classDiagram-4FO5ZUOK-BMIDIijD.js +0 -1
  117. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BMIDIijD.js +0 -1
  118. package/dist/client/assets/index-aBQwNV_I.js +0 -2540
@@ -1 +1 @@
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
+ import{r as e}from"./vendor-react-SZ_qB27O.js";import{m as C}from"./index-inWk2g6R.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-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
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalAgentOnboardingModal-BuEWZrjl.js","assets/vendor-react-SZ_qB27O.js","assets/index-inWk2g6R.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-inWk2g6R.js";import{r as o,j as e}from"./vendor-react-SZ_qB27O.js";import{D as je}from"./DirectoryPicker-Bw_A-64N.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-BVtcjVIK.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-BuEWZrjl.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,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";/**
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-inWk2g6R.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.
@@ -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-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};
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-inWk2g6R.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,4 +1,4 @@
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";/**
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-inWk2g6R.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
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{r as i,j as e,b as ti}from"./vendor-react-SZ_qB27O.js";import{R as Gn,d as qn,B as Vn,e as si,C as Hn,P as oi,g as ni,f as ai,E as ii,H as nt,h as at,u as Un,j as li,k as ri,l as di,m as ci,M as ui}from"./vendor-reactflow-9C3XTE7_.js";import{c as pi,ey as fi,ez as Qt,eA as qs,eB as we,eC as Kn,eD as mi,eE as wi,eF as os,eG as At,eH as Pt,eI as it,eJ as Ft,eK as Ke,eL as Yn,eM as Jn,eN as Xn,eO as Qn,eP as Zn,eQ as hi,P as ye,eR as ea,eS as Js,eT as ta,eU as sa,bo as Xs,eV as oa,eW as Qs,eX as Mt,eY as na,eZ as aa,e_ as ia,a$ as la,a8 as Zs,N as ra,b0 as eo,e$ as gi,ce as bi,aZ as Le,f0 as ki,f1 as da,X as to,bW as xi,f2 as ca,bl as le,bk as Zt,br as vi,aq as Ni,C as Fe,u as Ce,aa as ua,f3 as ji,bD as es,f4 as Vo,bx as pa,f5 as ts,a9 as yi,e as $e,bH as Vs,s as Ci,f6 as Si,f7 as Ei,cj as Ho,f8 as Ii,f9 as Ai,dG as Pi,U as Uo,a2 as Fi,fa as Hs,fb as Mi,fc as Ri,fd as Oi,fe as Li,ff as Ti,fg as Di,a6 as zi,fh as $i,fi as Wi,fj as Ko,fk as Yo,fl as Jo,fm as Xo,fn as Qo,fo as _i,fp as Bi,fq as Gi,fr as qi,fs as Zo,ft as Vi,fu as en,fv as tn,fw as sn,fx as Hi,fy as Ms,fz as Ui,fA as on,fB as nn,fC as Ki,f as an,aJ as Yi,dr as ln,fD as Rs,bp as rn,L as Pe,fE as Ye,fF as Os,fG as Ls,d1 as Xt,S as We,fH as Ji,ds as dn,fI as cn,d2 as Xi,fJ as Qi,du as Zi,fK as el,fL as tl}from"./index-aBQwNV_I.js";import{u as he}from"./vendor-i18n-GF3RlKbq.js";import{P as Ts}from"./puzzle-DaVSYDOd.js";import{U as sl}from"./upload-C_8IHSzk.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-xterm-BNq00GSj.js";/**
1
+ import{r as i,j as e,b as ti}from"./vendor-react-SZ_qB27O.js";import{R as Gn,d as qn,B as Vn,e as si,C as Hn,P as oi,g as ni,f as ai,E as ii,H as nt,h as at,u as Un,j as li,k as ri,l as di,m as ci,M as ui}from"./vendor-reactflow-9C3XTE7_.js";import{c as pi,ey as fi,ez as Qt,eA as qs,eB as we,eC as Kn,eD as mi,eE as wi,eF as os,eG as At,eH as Pt,eI as it,eJ as Ft,eK as Ke,eL as Yn,eM as Jn,eN as Xn,eO as Qn,eP as Zn,eQ as hi,P as ye,eR as ea,eS as Js,eT as ta,eU as sa,bo as Xs,eV as oa,eW as Qs,eX as Mt,eY as na,eZ as aa,e_ as ia,a$ as la,a8 as Zs,N as ra,b0 as eo,e$ as gi,ce as bi,aZ as Le,f0 as ki,f1 as da,X as to,bW as xi,f2 as ca,bl as le,bk as Zt,br as vi,aq as Ni,C as Fe,u as Ce,aa as ua,f3 as ji,bD as es,f4 as Vo,bx as pa,f5 as ts,a9 as yi,e as $e,bH as Vs,s as Ci,f6 as Si,f7 as Ei,cj as Ho,f8 as Ii,f9 as Ai,dG as Pi,U as Uo,a2 as Fi,fa as Hs,fb as Mi,fc as Ri,fd as Oi,fe as Li,ff as Ti,fg as Di,a6 as zi,fh as $i,fi as Wi,fj as Ko,fk as Yo,fl as Jo,fm as Xo,fn as Qo,fo as _i,fp as Bi,fq as Gi,fr as qi,fs as Zo,ft as Vi,fu as en,fv as tn,fw as sn,fx as Hi,fy as Ms,fz as Ui,fA as on,fB as nn,fC as Ki,f as an,aJ as Yi,dr as ln,fD as Rs,bp as rn,L as Pe,fE as Ye,fF as Os,fG as Ls,d1 as Xt,S as We,fH as Ji,ds as dn,fI as cn,d2 as Xi,fJ as Qi,du as Zi,fK as el,fL as tl}from"./index-inWk2g6R.js";import{u as he}from"./vendor-i18n-GF3RlKbq.js";import{P as Ts}from"./puzzle-D60d3Nv1.js";import{U as sl}from"./upload-Dxv5FPaS.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-xterm-BNq00GSj.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as d,j as s}from"./vendor-react-SZ_qB27O.js";import{f as j,a9 as v}from"./index-aBQwNV_I.js";import{u as N}from"./vendor-i18n-GF3RlKbq.js";function $({value:e,onChange:t,projectId:i,disabled:r=!1,id:n,label:o="Skills"}){const{t:a}=N("app"),[m,k]=d.useState([]),[f,u]=d.useState(!0);d.useEffect(()=>{let l=!1;return u(!0),j(i).then(c=>{l||k(c)}).catch(()=>{l||k([])}).finally(()=>{l||u(!1)}),()=>{l=!0}},[i]);const S=l=>{e.includes(l)||t([...e,l])},x=l=>{t(e.filter(c=>c!==l))},h=l=>m.find(g=>g.id===l)?.name??l,p=m.filter(l=>!e.includes(l.id));return s.jsxs("div",{className:"skill-multiselect","data-testid":"skill-multiselect",children:[o&&s.jsx("label",{htmlFor:n?`${n}-select`:void 0,className:"skill-multiselect-label",children:o}),e.length>0&&s.jsx("div",{className:"skill-multiselect-chips","data-testid":"skill-chips",children:e.map(l=>s.jsxs("span",{className:"skill-chip","data-testid":`skill-chip-${l}`,children:[s.jsx("span",{className:"skill-chip-name",children:h(l)}),s.jsx("button",{type:"button",className:"skill-chip-remove",onClick:()=>x(l),disabled:r,"aria-label":a("skills.removeSkill","Remove {{name}}",{name:h(l)}),"data-testid":`remove-skill-${l}`,children:"×"})]},l))}),s.jsx("div",{className:"skill-multiselect-add",children:f?s.jsx("span",{className:"skill-multiselect-loading","data-testid":"skills-loading",children:s.jsx(v,{label:a("skills.loading","Loading skills…")})}):p.length===0?s.jsx("span",{className:"skill-multiselect-empty","data-testid":"skills-empty",children:e.length===0?a("skills.noSkillsDiscovered","No skills discovered"):a("skills.allSkillsSelected","All skills selected")}):s.jsxs("select",{id:n?`${n}-select`:void 0,className:"select skill-multiselect-dropdown",value:"",onChange:l=>{l.target.value&&(S(l.target.value),l.target.value="")},disabled:r,"data-testid":"skill-dropdown",children:[s.jsx("option",{value:"",children:a("skills.addSkill","Add a skill…")}),p.map(l=>s.jsx("option",{value:l.id,children:l.name},l.id))]})})]})}const L=/(?:^|\/)skills\/([^/]+)\/SKILL\.md$/i;function y(e){const t=e.trim();if(!t)return e;const i=t.match(L);return i?.[1]?i[1]:t}export{$ as S,y as f};
1
+ import{r as d,j as s}from"./vendor-react-SZ_qB27O.js";import{f as j,a9 as v}from"./index-inWk2g6R.js";import{u as N}from"./vendor-i18n-GF3RlKbq.js";function $({value:e,onChange:t,projectId:i,disabled:r=!1,id:n,label:o="Skills"}){const{t:a}=N("app"),[m,k]=d.useState([]),[f,u]=d.useState(!0);d.useEffect(()=>{let l=!1;return u(!0),j(i).then(c=>{l||k(c)}).catch(()=>{l||k([])}).finally(()=>{l||u(!1)}),()=>{l=!0}},[i]);const S=l=>{e.includes(l)||t([...e,l])},x=l=>{t(e.filter(c=>c!==l))},h=l=>m.find(g=>g.id===l)?.name??l,p=m.filter(l=>!e.includes(l.id));return s.jsxs("div",{className:"skill-multiselect","data-testid":"skill-multiselect",children:[o&&s.jsx("label",{htmlFor:n?`${n}-select`:void 0,className:"skill-multiselect-label",children:o}),e.length>0&&s.jsx("div",{className:"skill-multiselect-chips","data-testid":"skill-chips",children:e.map(l=>s.jsxs("span",{className:"skill-chip","data-testid":`skill-chip-${l}`,children:[s.jsx("span",{className:"skill-chip-name",children:h(l)}),s.jsx("button",{type:"button",className:"skill-chip-remove",onClick:()=>x(l),disabled:r,"aria-label":a("skills.removeSkill","Remove {{name}}",{name:h(l)}),"data-testid":`remove-skill-${l}`,children:"×"})]},l))}),s.jsx("div",{className:"skill-multiselect-add",children:f?s.jsx("span",{className:"skill-multiselect-loading","data-testid":"skills-loading",children:s.jsx(v,{label:a("skills.loading","Loading skills…")})}):p.length===0?s.jsx("span",{className:"skill-multiselect-empty","data-testid":"skills-empty",children:e.length===0?a("skills.noSkillsDiscovered","No skills discovered"):a("skills.allSkillsSelected","All skills selected")}):s.jsxs("select",{id:n?`${n}-select`:void 0,className:"select skill-multiselect-dropdown",value:"",onChange:l=>{l.target.value&&(S(l.target.value),l.target.value="")},disabled:r,"data-testid":"skill-dropdown",children:[s.jsx("option",{value:"",children:a("skills.addSkill","Add a skill…")}),p.map(l=>s.jsx("option",{value:l.id,children:l.name},l.id))]})})]})}const L=/(?:^|\/)skills\/([^/]+)\/SKILL\.md$/i;function y(e){const t=e.trim();if(!t)return e;const i=t.match(L);return i?.[1]?i[1]:t}export{$ as S,y as f};