@runfusion/fusion 0.50.0 → 0.51.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 (122) hide show
  1. package/dist/bin.js +815 -352
  2. package/dist/client/.vite/manifest.json +242 -241
  3. package/dist/client/assets/{AgentDetailView-D2oYUApl.js → AgentDetailView-CjwOlcMI.js} +1 -1
  4. package/dist/client/assets/{AgentPermissionPolicyEditor-DGgx46f3.js → AgentPermissionPolicyEditor-CD8znNHS.js} +1 -1
  5. package/dist/client/assets/{AgentsView-Dhf5Vq_T.js → AgentsView-CTjNaKu-.js} +3 -3
  6. package/dist/client/assets/ChatView-DCWypaw3.js +19 -0
  7. package/dist/client/assets/{CommandCenter-DzQhGq_J.js → CommandCenter-C4v0FMxx.js} +9 -9
  8. package/dist/client/assets/{DevServerView-DjJYp6Jj.js → DevServerView-BE_o7v9j.js} +1 -1
  9. package/dist/client/assets/{DirectoryPicker-CYPYp9T4.js → DirectoryPicker-BpcPo65A.js} +1 -1
  10. package/dist/client/assets/{DocumentsView-CeQVRVdp.js → DocumentsView-Cpma23hu.js} +1 -1
  11. package/dist/client/assets/{EvalsView-D250mVR5.js → EvalsView-DYSobhb7.js} +1 -1
  12. package/dist/client/assets/{ExperimentalAgentOnboardingModal-B1EEY_bl.js → ExperimentalAgentOnboardingModal-D_iQqD-n.js} +1 -1
  13. package/dist/client/assets/{GoalsView-CUh8JBnJ.css → GoalsView-4-eEOeqw.css} +1 -1
  14. package/dist/client/assets/{GoalsView-MftVwE9g.js → GoalsView-B6Wfxk59.js} +1 -1
  15. package/dist/client/assets/{InsightsView-CbWItYe8.js → InsightsView-DZyMvYQ8.js} +1 -1
  16. package/dist/client/assets/{MemoryView-Ct0nOTES.js → MemoryView-B9Z6cRma.js} +1 -1
  17. package/dist/client/assets/{PiExtensionsManager-DSQwngX-.js → PiExtensionsManager-BQt3JU60.js} +1 -1
  18. package/dist/client/assets/{PluginManager-DqLxCiNg.js → PluginManager-DEsUstVo.js} +1 -1
  19. package/dist/client/assets/PullRequestView-B7k8ogy4.js +6 -0
  20. package/dist/client/assets/PullRequestView-NkeImY1n.css +1 -0
  21. package/dist/client/assets/{ResearchView-CJQL9XKC.js → ResearchView-BseF58_R.js} +1 -1
  22. package/dist/client/assets/{SecretsView-ChN9aTbi.js → SecretsView-bkNS5VBC.js} +1 -1
  23. package/dist/client/assets/{SessionTerminal-BVon9kbr.js → SessionTerminal-BSllyqgF.js} +1 -1
  24. package/dist/client/assets/{SettingsModal-CIC5jhgo.js → SettingsModal-DAH7LuLw.js} +1 -1
  25. package/dist/client/assets/SettingsModal-Dso0K76J.js +21 -0
  26. package/dist/client/assets/{SetupWizardModal-C6EGjmbd.js → SetupWizardModal-Bm6bG31V.js} +2 -2
  27. package/dist/client/assets/{ShadcnColorPicker-4e_aXoGX.js → ShadcnColorPicker-CLiOvo7W.js} +1 -1
  28. package/dist/client/assets/{SkillsView-Dz8dDwfP.js → SkillsView-D_UEJY_f.js} +1 -1
  29. package/dist/client/assets/{TodoView-DvJFzoOv.js → TodoView-CMCoPep1.js} +1 -1
  30. package/dist/client/assets/{WorkflowNodeEditor-DrdTCstS.js → WorkflowNodeEditor-BeQcn0Wa.js} +1 -1
  31. package/dist/client/assets/{agentSkills-B2dD5Nm5.js → agentSkills-BiipFw1z.js} +1 -1
  32. package/dist/client/assets/{app-D27ewSC0.js → app-A1yCJR4Q.js} +3 -3
  33. package/dist/client/assets/{app-BYq4S7Cb.js → app-Bfiafek7.js} +3 -3
  34. package/dist/client/assets/{app-OPrfgjjn.js → app-Bh-Xj32t.js} +3 -3
  35. package/dist/client/assets/{app-k1K9zAjp.js → app-DxJHfzxz.js} +3 -3
  36. package/dist/client/assets/{app-dATBczl3.js → app-T5iMjZpX.js} +2 -2
  37. package/dist/client/assets/{app-DFLDkeOE.js → app-zR_n4GL2.js} +3 -3
  38. package/dist/client/assets/{architectureDiagram-3BPJPVTR-ClO0MnzR.js → architectureDiagram-3BPJPVTR-glwWkaDt.js} +1 -1
  39. package/dist/client/assets/{blockDiagram-GPEHLZMM-C4cyy4WE.js → blockDiagram-GPEHLZMM-C8DhxwG4.js} +1 -1
  40. package/dist/client/assets/{c4Diagram-AAUBKEIU-NHPC9TJo.js → c4Diagram-AAUBKEIU-CQXf6PzI.js} +1 -1
  41. package/dist/client/assets/channel-BY6zFSV1.js +1 -0
  42. package/dist/client/assets/{chunk-2J33WTMH-CGYIKTVR.js → chunk-2J33WTMH-kak65s83.js} +1 -1
  43. package/dist/client/assets/{chunk-4BX2VUAB-BkCCD0tE.js → chunk-4BX2VUAB-B_yEpoxU.js} +1 -1
  44. package/dist/client/assets/{chunk-55IACEB6-Be3yOIDe.js → chunk-55IACEB6-C9lQVeH5.js} +1 -1
  45. package/dist/client/assets/{chunk-727SXJPM-DxjyMaQQ.js → chunk-727SXJPM-D4SVzqNs.js} +1 -1
  46. package/dist/client/assets/{chunk-AQP2D5EJ-BC0PjN0W.js → chunk-AQP2D5EJ-DBHuj4BH.js} +1 -1
  47. package/dist/client/assets/{chunk-FMBD7UC4-DoWxmM8k.js → chunk-FMBD7UC4-BJ3ghjau.js} +1 -1
  48. package/dist/client/assets/{chunk-ND2GUHAM-EOpuc9pP.js → chunk-ND2GUHAM-CE4tkh6e.js} +1 -1
  49. package/dist/client/assets/{chunk-QZHKN3VN-DiRyx9QZ.js → chunk-QZHKN3VN-DmVw_cEu.js} +1 -1
  50. package/dist/client/assets/classDiagram-4FO5ZUOK-CeX_WCiC.js +1 -0
  51. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CeX_WCiC.js +1 -0
  52. package/dist/client/assets/{cose-bilkent-S5V4N54A-CfVoUUxT.js → cose-bilkent-S5V4N54A-DI_-BOYE.js} +1 -1
  53. package/dist/client/assets/{dagre-BM42HDAG-BfILvxLb.js → dagre-BM42HDAG-ywUbHZxt.js} +1 -1
  54. package/dist/client/assets/{dashboard-view-wFC1pe4d.js → dashboard-view-DJvdban3.js} +1 -1
  55. package/dist/client/assets/{dashboard-view-C9YIcx-O.js → dashboard-view-r4NTTh_X.js} +1633 -1633
  56. package/dist/client/assets/{diagram-2AECGRRQ-6mdmbH-5.js → diagram-2AECGRRQ-CAGucHCe.js} +1 -1
  57. package/dist/client/assets/{diagram-5GNKFQAL-CY7MMwO1.js → diagram-5GNKFQAL-D_1uzVtW.js} +1 -1
  58. package/dist/client/assets/{diagram-KO2AKTUF-D05XnQqd.js → diagram-KO2AKTUF-D7zY4Nlm.js} +1 -1
  59. package/dist/client/assets/{diagram-LMA3HP47-B18FTOJG.js → diagram-LMA3HP47-C1T9eOzA.js} +1 -1
  60. package/dist/client/assets/{diagram-OG6HWLK6-xmXlYf5m.js → diagram-OG6HWLK6-sWxhPvzU.js} +1 -1
  61. package/dist/client/assets/{erDiagram-TEJ5UH35-4XlgVLCs.js → erDiagram-TEJ5UH35-DfHtnaNg.js} +1 -1
  62. package/dist/client/assets/{flowDiagram-I6XJVG4X-BYl3ps7f.js → flowDiagram-I6XJVG4X-Brbb_Jlh.js} +1 -1
  63. package/dist/client/assets/{folder-open-BH6FwmO7.js → folder-open-BLwukrE0.js} +1 -1
  64. package/dist/client/assets/{ganttDiagram-6RSMTGT7-4vxuH9Dx.js → ganttDiagram-6RSMTGT7-CLvZ7891.js} +1 -1
  65. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-BESmFgXT.js → gitGraphDiagram-PVQCEYII-DD56Jsa3.js} +1 -1
  66. package/dist/client/assets/index-DAv17W73.js +1317 -0
  67. package/dist/client/assets/index-DhBnj8YN.css +1 -0
  68. package/dist/client/assets/{infoDiagram-5YYISTIA-DvjdjtwB.js → infoDiagram-5YYISTIA-uXai801q.js} +1 -1
  69. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-Cis5IoEm.js → ishikawaDiagram-YF4QCWOH-C_bWlUP_.js} +1 -1
  70. package/dist/client/assets/{journeyDiagram-JHISSGLW-C20pB1W8.js → journeyDiagram-JHISSGLW-B2kB9niE.js} +1 -1
  71. package/dist/client/assets/{kanban-definition-UN3LZRKU-CiVfCeU3.js → kanban-definition-UN3LZRKU-BJwlpR9z.js} +1 -1
  72. package/dist/client/assets/{mermaid.core-CW0vCXA6.js → mermaid.core-0hUjZF5S.js} +4 -4
  73. package/dist/client/assets/{mindmap-definition-RKZ34NQL-E5rPHUdw.js → mindmap-definition-RKZ34NQL-DsTgTpX-.js} +1 -1
  74. package/dist/client/assets/{pieDiagram-4H26LBE5-DVIFbPjH.js → pieDiagram-4H26LBE5-BUQsNWHN.js} +1 -1
  75. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-C8qPRe_x.js → quadrantDiagram-W4KKPZXB-DOYWgfAz.js} +1 -1
  76. package/dist/client/assets/{requirementDiagram-4Y6WPE33-DQ-pwXh3.js → requirementDiagram-4Y6WPE33-DUnPKaMd.js} +1 -1
  77. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BnghLuUc.js → sankeyDiagram-5OEKKPKP-Btl4NRo-.js} +1 -1
  78. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-ChlGxGVk.js → sequenceDiagram-3UESZ5HK-b0hyJ_Wr.js} +1 -1
  79. package/dist/client/assets/{shield-alert-BfOnDO6O.js → shield-alert-yWvC7t2v.js} +1 -1
  80. package/dist/client/assets/{stateDiagram-AJRCARHV-ByUvNEch.js → stateDiagram-AJRCARHV-orREjkd9.js} +1 -1
  81. package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-Df38ITSP.js → stateDiagram-v2-BHNVJYJU-DYJRRNh-.js} +1 -1
  82. package/dist/client/assets/{timeline-definition-PNZ67QCA-bsAGc83D.js → timeline-definition-PNZ67QCA-DZga7lqO.js} +1 -1
  83. package/dist/client/assets/{upload-BK1crTqn.js → upload-BsYRkl_8.js} +1 -1
  84. package/dist/client/assets/{users-DW8jC2Z9.js → users-dyoJEvrM.js} +1 -1
  85. package/dist/client/assets/{vennDiagram-CIIHVFJN-BBIj6LFN.js → vennDiagram-CIIHVFJN-C2P26V71.js} +1 -1
  86. package/dist/client/assets/{wardley-L42UT6IY-De6JFroy.js → wardley-L42UT6IY-ckctH9bL.js} +1 -1
  87. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-P1LOLx0_.js → wardleyDiagram-YWT4CUSO-9It3QAYs.js} +1 -1
  88. package/dist/client/assets/{xychartDiagram-2RQKCTM6-v1G4ki6U.js → xychartDiagram-2RQKCTM6-Dj3sSBqg.js} +1 -1
  89. package/dist/client/index.html +2 -2
  90. package/dist/client/version.json +1 -1
  91. package/dist/droid-cli/package.json +1 -1
  92. package/dist/extension.js +584 -296
  93. package/dist/pi-claude-cli/package.json +1 -1
  94. package/dist/plugin-sdk/index.d.ts +6 -0
  95. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  96. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  97. package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +1 -1
  98. package/dist/plugins/fusion-plugin-compound-engineering/manifest.json +1 -1
  99. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  100. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  101. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  102. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  103. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  104. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  105. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  106. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  107. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  108. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  109. package/package.json +1 -1
  110. package/skill/fusion/references/best-practices.md +3 -3
  111. package/skill/fusion/references/extension-tools.md +1 -1
  112. package/skill/fusion/references/fusion-capabilities.md +1 -1
  113. package/skill/fusion/workflows/task-management.md +1 -1
  114. package/dist/client/assets/ChatView-DpgpxHva.js +0 -19
  115. package/dist/client/assets/PullRequestView-CpdE3Yo_.css +0 -1
  116. package/dist/client/assets/PullRequestView-D0WgwdAi.js +0 -6
  117. package/dist/client/assets/SettingsModal-B4WANQnu.js +0 -21
  118. package/dist/client/assets/channel-Q2WKocEP.js +0 -1
  119. package/dist/client/assets/classDiagram-4FO5ZUOK-CPFl2Aqd.js +0 -1
  120. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CPFl2Aqd.js +0 -1
  121. package/dist/client/assets/index-B9jtBwFy.css +0 -1
  122. package/dist/client/assets/index-DFeBJ3GM.js +0 -1302
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalAgentOnboardingModal-B1EEY_bl.js","assets/vendor-react-SZ_qB27O.js","assets/index-DFeBJ3GM.js","assets/vendor-i18n-GF3RlKbq.js","assets/vendor-reactflow-Bg-Qjzh8.js","assets/vendor-reactflow-C5ap-Sga.css","assets/vendor-xterm-BNq00GSj.js","assets/vendor-xterm-LZoznX6r.css","assets/vendor-codemirror-jBKmHyH0.js","assets/index-B9jtBwFy.css","assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css"])))=>i.map(i=>d[i]);
2
- import{A as g,g as b,m as R,u as te,d as ae,r as re,a as ne,b as ie,e as le,X as oe,L as v,C as de,f as E,S as ce,h as S,E as ue,_ as pe}from"./index-DFeBJ3GM.js";import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{D as me}from"./DirectoryPicker-CYPYp9T4.js";import{s as y}from"./projectDetection-G3XuxD2X.js";import{u as ge}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";import"./folder-open-BH6FwmO7.js";function C(c){const u=c.replace(/[^a-zA-Z]/g,"").toUpperCase();return u.length>=2&&u.length<=4?u:u.length>4?u.slice(0,4):"FN"}const he=l.lazy(()=>pe(()=>import("./ExperimentalAgentOnboardingModal-B1EEY_bl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(c=>({default:c.ExperimentalAgentOnboardingModal})));function Ce({onProjectRegistered:c,onClose:u,agentOnboardingEnabled:P=!1,includeAgentStep:z=!0}){const{t:a}=ge("app"),F="https://discord.gg/ksrfuy7WYR",x=l.useMemo(()=>b("ceo")??g[0],[]),[T,U]=l.useState(!0),[s,i]=l.useState(()=>({step:"manual",manualMode:"existing",manualPath:"",manualCloneUrl:"",manualName:"",manualIsolationMode:"in-process",manualNodeId:"",manualTaskPrefix:"",detectedRepos:[],workspaceMode:!1,isDetectingWorkspace:!1,registeredProject:null,selectedPresetId:x.id,agentDraft:R(x),isCreatingAgent:!1,isRegistering:!1,error:null,agentError:null,agentOutcome:null})),[A,W]=l.useState(!1),[I,j]=l.useState(!1),D=l.useRef(null),{nodes:M,loading:L}=te(),O=M.find(t=>t.type==="local")?.id,f=l.useCallback(()=>{U(!1),u?.()},[u]),_=l.useCallback(()=>{if(s.registeredProject){c(s.registeredProject);return}f()},[f,c,s.registeredProject]);l.useEffect(()=>{s.agentError&&D.current?.focus()},[s.agentError]);const N=l.useRef(0),H=l.useCallback(t=>{if(i(r=>{const n={manualPath:t,detectedRepos:[],workspaceMode:!1};t&&(!r.manualName||r.manualName===y(r.manualPath))&&(n.manualName=y(t));const o=n.manualName??r.manualName;return o&&(!r.manualTaskPrefix||r.manualTaskPrefix===C(y(r.manualPath)))&&(n.manualTaskPrefix=C(o)),{...r,...n}}),s.manualMode==="existing"&&t.trim()&&t.trim()!=="/"){const r=++N.current;i(n=>({...n,isDetectingWorkspace:!0})),ae(t.trim()).then(n=>{r===N.current&&i(o=>({...o,isDetectingWorkspace:!1,detectedRepos:n.repos,workspaceMode:n.isWorkspace}))}).catch(()=>{r===N.current&&i(n=>({...n,isDetectingWorkspace:!1}))})}},[s.manualMode]),B=l.useCallback(async()=>{const t=s.manualPath.trim(),r=s.manualName.trim(),n=s.manualCloneUrl.trim();if(!(!t||!r)&&!(s.manualMode==="clone"&&!n)){i(o=>({...o,isRegistering:!0,error:null}));try{const o={name:r,path:t,isolationMode:s.manualIsolationMode,nodeId:s.manualNodeId||void 0,cloneUrl:s.manualMode==="clone"?n:void 0,workspaceMode:s.workspaceMode,taskPrefix:s.manualTaskPrefix.trim()||void 0},d=await re(o);if(!z){i(m=>({...m,isRegistering:!1})),c(d);return}i(m=>({...m,step:"agent",registeredProject:d,isRegistering:!1}))}catch(o){i(d=>({...d,isRegistering:!1,error:o instanceof Error?o.message:"Failed to register project"}))}}},[z,c,s.manualPath,s.manualName,s.manualCloneUrl,s.manualMode,s.manualIsolationMode,s.manualNodeId,s.workspaceMode,s.manualTaskPrefix]),w=l.useCallback(t=>{const r=b(t);r&&i(n=>({...n,selectedPresetId:r.id,agentDraft:R(r),agentError:null}))},[]),$=l.useCallback((t,r)=>{const n=g.findIndex(se=>se.id===r);if(n<0)return;const o=g.length-1;let d=null;if(t.key==="ArrowDown"||t.key==="ArrowRight"?d=n===o?0:n+1:t.key==="ArrowUp"||t.key==="ArrowLeft"?d=n===0?o:n-1:t.key==="Home"?d=0:t.key==="End"&&(d=o),d===null)return;t.preventDefault();const m=g[d];w(m.id),requestAnimationFrame(()=>{document.querySelector(`[data-agent-preset-id="${m.id}"]`)?.focus()})},[w]),Y=l.useCallback(t=>{i(r=>({...r,selectedPresetId:"",agentDraft:ne(t),agentError:null}))},[]),G=l.useCallback(async()=>{if(!(!s.registeredProject||!s.agentDraft.name.trim())){i(t=>({...t,isCreatingAgent:!0,agentError:null}));try{await ie(le(s.agentDraft),s.registeredProject.id),i(t=>({...t,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}))}catch(t){i(r=>({...r,isCreatingAgent:!1,agentError:t instanceof Error?t.message:a("setup.firstAgentCreateError","Failed to create agent")}))}}},[s.agentDraft,s.registeredProject,a]),q=l.useCallback(()=>{i(t=>({...t,step:"complete",agentError:null,agentOutcome:"skipped"}))},[]);if(!T)return null;const k=s.manualMode==="existing",p=s.manualMode==="clone",K=s.manualPath.trim().length>0,Z=s.manualName.trim().length>0,V=s.manualCloneUrl.trim().length>0,X=s.isRegistering||!K||!Z||p&&!V,J=s.selectedPresetId?b(s.selectedPresetId):void 0,h=s.isCreatingAgent,Q=s.selectedPresetId||x.id,ee=`modal setup-wizard-modal${s.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:ee,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":a("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":a("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:a("setup.brandName","Fusion")})]}),e.jsxs("h2",{id:"wizard-title",className:"setup-wizard-title",children:[s.step==="manual"&&a("setup.welcomeToFusion","Welcome to Fusion"),s.step==="agent"&&a("setup.firstAgentTitle","Create your first agent"),s.step==="complete"&&a("setup.setupCompleteTitle","Setup Complete!")]})]}),s.step!=="complete"&&s.step!=="agent"&&e.jsx("button",{className:"modal-close",onClick:f,"aria-label":a("setup.closeWizard","Close wizard"),children:e.jsx(oe,{size:20})})]}),e.jsxs("div",{className:"setup-wizard-content",children:[s.step==="manual"&&e.jsxs("div",{className:"setup-wizard-manual",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-name",children:a("setup.projectName","Project Name")}),e.jsx("input",{id:"project-name",type:"text",value:s.manualName,onChange:t=>i(r=>({...r,manualName:t.target.value})),placeholder:a("setup.projectNamePlaceholder","my-project")}),e.jsx("p",{className:"form-hint",children:p?a("setup.projectNameHintClone","By default this follows the destination folder name unless you edit it."):a("setup.projectNameHintExisting","By default this follows the selected directory name unless you edit it.")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-path",children:p?a("setup.destinationDirectory","Destination Directory"):a("setup.projectDirectory","Project Directory")}),e.jsx(me,{value:s.manualPath,onChange:H,nodeId:s.manualNodeId||void 0,localNodeId:O,placeholder:p?a("setup.clonePathPlaceholder","/path/for/new-clone"):a("setup.projectPathPlaceholder","/path/to/your/project")}),e.jsx("p",{className:"form-hint",children:p?a("setup.clonePathHint","Select or type an absolute destination path. Fusion will clone into this directory."):a("setup.projectPathHint","Select or type the absolute path to your project")})]}),k&&s.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:s.workspaceMode,onChange:t=>i(r=>({...r,workspaceMode:t.target.checked}))}),a("setup.workspaceMode","Workspace mode (multi-repo)")]}),s.isDetectingWorkspace&&e.jsxs("p",{className:"form-hint",children:[e.jsx(v,{size:12,className:"animate-spin",style:{display:"inline-block",verticalAlign:"middle",marginRight:4}}),a("setup.detectingWorkspace","Detecting sub-repositories...")]}),!s.isDetectingWorkspace&&s.detectedRepos.length>0&&e.jsxs("p",{className:"form-hint",children:[a("setup.detectedRepos","Found {{count}} repositories:",{count:s.detectedRepos.length})," ",s.detectedRepos.join(", ")]}),!s.isDetectingWorkspace&&s.detectedRepos.length===0&&s.workspaceMode===!1&&s.manualPath.trim()&&e.jsx("p",{className:"form-hint",children:a("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:a("setup.taskPrefix","Task Prefix")}),e.jsx("input",{id:"task-prefix",type:"text",value:s.manualTaskPrefix,onChange:t=>i(r=>({...r,manualTaskPrefix:t.target.value.toUpperCase()})),placeholder:C(s.manualName||"FN"),maxLength:5}),e.jsx("p",{className:"form-hint",children:a("setup.taskPrefixHint",'Used for task IDs (e.g. "{{prefix}}-1"). Derived from project name.',{prefix:s.manualTaskPrefix||"FN"})})]}),e.jsxs("div",{className:"setup-wizard-advanced",children:[e.jsxs("button",{type:"button",className:"setup-wizard-advanced-toggle","aria-expanded":A,onClick:()=>W(t=>!t),children:[e.jsx(de,{size:16,className:"setup-wizard-advanced-chevron"}),e.jsx("span",{children:a("setup.advancedSettings","Advanced settings")})]}),A&&e.jsxs("div",{className:"setup-wizard-advanced-panel",children:[e.jsxs("fieldset",{className:"setup-wizard-mode-switch","aria-label":"Project setup mode",children:[e.jsx("legend",{children:a("setup.setupMode","Setup Mode")}),e.jsxs("label",{className:`setup-wizard-mode-option${k?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"existing",checked:k,onChange:()=>i(t=>({...t,manualMode:"existing",error:null}))}),e.jsx("span",{children:a("setup.useExistingDirectory","Use Existing Directory")})]}),e.jsxs("label",{className:`setup-wizard-mode-option${p?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"clone",checked:p,onChange:()=>i(t=>({...t,manualMode:"clone",error:null}))}),e.jsx("span",{children:a("setup.cloneGitRepository","Clone Git Repository")})]})]}),p&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-clone-url",children:a("setup.repositoryUrl","Repository URL")}),e.jsx("input",{id:"project-clone-url",type:"text",value:s.manualCloneUrl,onChange:t=>i(r=>({...r,manualCloneUrl:t.target.value})),placeholder:a("setup.repositoryUrlPlaceholder","https://github.com/owner/repo.git")}),e.jsx("p",{className:"form-hint",children:a("setup.cloneGitHint","Fusion will run git clone into the destination directory, then register that cloned folder.")})]}),e.jsx("div",{className:"form-group",children:e.jsxs("div",{className:"project-node-selector",children:[e.jsx("span",{className:"project-node-selector__label",children:a("setup.runtimeNode","Runtime Node")}),e.jsxs("select",{value:s.manualNodeId,onChange:t=>i(r=>({...r,manualNodeId:t.target.value})),disabled:L||s.isRegistering,children:[e.jsx("option",{value:"",children:a("setup.localNode","Local node")}),M.map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.type,")"]},t.id))]})]})}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("setup.isolationMode","Isolation Mode")}),e.jsxs("div",{className:"setup-wizard-isolation-options",children:[e.jsxs("label",{className:`setup-wizard-isolation-option${s.manualIsolationMode==="in-process"?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"isolation-mode",value:"in-process",checked:s.manualIsolationMode==="in-process",onChange:()=>i(t=>({...t,manualIsolationMode:"in-process"}))}),e.jsxs("div",{className:"setup-wizard-isolation-option-content",children:[e.jsx("strong",{children:a("setup.inProcess","In-Process")}),e.jsx("span",{children:a("setup.inProcessDesc","Lower overhead, shared memory. Best for most projects.")}),e.jsx("span",{className:"wizard-option-recommended",children:a("setup.recommended","Recommended")})]})]}),e.jsxs("label",{className:`setup-wizard-isolation-option${s.manualIsolationMode==="child-process"?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"isolation-mode",value:"child-process",checked:s.manualIsolationMode==="child-process",onChange:()=>i(t=>({...t,manualIsolationMode:"child-process"}))}),e.jsxs("div",{className:"setup-wizard-isolation-option-content",children:[e.jsx("strong",{children:a("setup.childProcess","Child-Process")}),e.jsx("span",{children:a("setup.childProcessDesc","Isolated execution with crash containment.")})]})]})]})]})]})]}),s.error&&e.jsx("div",{className:"wizard-error",role:"alert",children:s.error})]}),s.step==="agent"&&e.jsxs("div",{className:"setup-wizard-agent-step",children:[e.jsx("p",{className:"setup-wizard-agent-intro",children:a("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:a("setup.firstAgentTemplates","Templates")}),e.jsx("div",{className:"setup-wizard-agent-preset-list",role:"radiogroup","aria-label":a("setup.firstAgentTemplates","Templates"),children:g.map(t=>{const r=s.selectedPresetId===t.id;return e.jsxs("button",{type:"button",className:`setup-wizard-agent-preset${r?" selected":""}`,role:"radio","aria-checked":r,"aria-label":r?a("setup.selectedAgentTemplate","{{name}} selected",{name:t.name}):t.name,tabIndex:t.id===Q?0:-1,"data-agent-preset-id":t.id,disabled:h,onClick:()=>w(t.id),onKeyDown:n=>$(n,t.id),children:[e.jsx(E,{agent:{id:t.id,icon:t.icon,name:t.name},size:28}),e.jsxs("span",{className:"setup-wizard-agent-preset-copy",children:[e.jsxs("span",{className:"setup-wizard-agent-preset-name",children:[t.name,t.id==="ceo"&&e.jsx("span",{className:"wizard-option-recommended",children:a("setup.recommended","Recommended")})]}),e.jsx("span",{className:"setup-wizard-agent-preset-description",children:t.description})]})]},t.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:a("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(E,{agent:{id:s.selectedPresetId||"draft",icon:s.agentDraft.icon,name:s.agentDraft.name},size:36}),e.jsxs("div",{children:[e.jsx("h3",{children:s.agentDraft.name||a("setup.firstAgentDraftName","Draft agent")}),e.jsx("p",{children:s.agentDraft.title||J?.title||a("setup.firstAgentCustomDraft","Custom agent draft")})]})]}),e.jsxs("dl",{className:"setup-wizard-agent-preview-list",children:[e.jsxs("div",{children:[e.jsx("dt",{children:a("agents.fieldRole","Role")}),e.jsx("dd",{children:s.agentDraft.role})]}),e.jsxs("div",{children:[e.jsx("dt",{children:a("agents.fieldInstructionsText","Inline Instructions")}),e.jsx("dd",{children:s.agentDraft.instructionsText||a("setup.firstAgentNoInstructions","No inline instructions yet")})]})]}),P&&e.jsxs("button",{type:"button",className:"btn setup-wizard-agent-ai-btn",onClick:()=>j(!0),disabled:h,children:[e.jsx(ce,{size:16}),e.jsx("span",{children:a("agents.aiInterview","AI Interview")})]})]})]})]}),s.agentError&&e.jsx("div",{className:"wizard-error",role:"alert",tabIndex:-1,ref:D,children:s.agentError})]}),s.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(S,{size:64,className:"success-icon"}),e.jsx("h3",{children:a("setup.allSet","All Set!")}),e.jsx("p",{children:s.agentOutcome==="created"?a("setup.firstAgentCreatedSuccess","Your project is registered and your first agent is ready."):a("setup.projectRegisteredSuccess","Your project has been registered successfully.")}),e.jsx("p",{children:s.agentOutcome==="skipped"?a("setup.firstAgentSkippedHint","You can create agents later from the Agents view."):a("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:F,target:"_blank",rel:"noopener noreferrer",children:a("setup.needHelp","Need help?")}),s.step==="manual"&&e.jsx("button",{className:"btn btn-primary",onClick:B,disabled:X,children:s.isRegistering?e.jsxs(e.Fragment,{children:[e.jsx(v,{size:16,className:"animate-spin"}),e.jsx("span",{children:a("setup.registering","Registering...")})]}):e.jsx("span",{children:a("setup.registerProject","Register Project")})}),s.step==="agent"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:q,disabled:h,children:a("setup.skipFirstAgent","Skip for now")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void G(),disabled:h||!s.agentDraft.name.trim(),"aria-busy":s.isCreatingAgent,children:s.isCreatingAgent?e.jsxs(e.Fragment,{children:[e.jsx(v,{size:16,className:"animate-spin"}),e.jsx("span",{children:a("setup.creatingFirstAgent","Creating agent...")})]}):e.jsx("span",{children:a("setup.createFirstAgent","Create Agent")})})]}),s.step==="complete"&&e.jsxs("button",{className:"btn btn-primary",onClick:_,children:[e.jsx(S,{size:16}),e.jsx("span",{children:a("setup.getStarted","Get Started")})]})]})]}),P&&I&&e.jsx(ue,{level:"modal",fallback:e.jsxs("div",{className:"wizard-error setup-wizard-agent-interview-error",role:"alert",children:[e.jsx("span",{children:a("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:()=>j(!1),children:a("setup.firstAgentContinueWithTemplates","Continue with templates")})]}),children:e.jsx(l.Suspense,{fallback:e.jsx("div",{className:"wizard-error setup-wizard-agent-interview-error",role:"status",children:a("setup.firstAgentInterviewLoading","Loading AI Interview...")}),children:e.jsx(he,{isOpen:I,onClose:()=>j(!1),onUseDraft:Y,projectId:s.registeredProject?.id,existingAgents:[],mode:"create"})})})]})}export{Ce as SetupWizardModal};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalAgentOnboardingModal-D_iQqD-n.js","assets/vendor-react-SZ_qB27O.js","assets/index-DAv17W73.js","assets/vendor-i18n-GF3RlKbq.js","assets/vendor-reactflow-Bg-Qjzh8.js","assets/vendor-reactflow-C5ap-Sga.css","assets/vendor-xterm-BNq00GSj.js","assets/vendor-xterm-LZoznX6r.css","assets/vendor-codemirror-jBKmHyH0.js","assets/index-DhBnj8YN.css","assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css"])))=>i.map(i=>d[i]);
2
+ import{A as g,g as b,m as R,u as te,d as ae,r as re,a as ne,b as ie,e as le,X as oe,L as v,C as de,f as E,S as ce,h as S,E as ue,_ as pe}from"./index-DAv17W73.js";import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{D as me}from"./DirectoryPicker-BpcPo65A.js";import{s as y}from"./projectDetection-G3XuxD2X.js";import{u as ge}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";import"./folder-open-BLwukrE0.js";function C(c){const u=c.replace(/[^a-zA-Z]/g,"").toUpperCase();return u.length>=2&&u.length<=4?u:u.length>4?u.slice(0,4):"FN"}const he=l.lazy(()=>pe(()=>import("./ExperimentalAgentOnboardingModal-D_iQqD-n.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(c=>({default:c.ExperimentalAgentOnboardingModal})));function Ce({onProjectRegistered:c,onClose:u,agentOnboardingEnabled:P=!1,includeAgentStep:z=!0}){const{t:a}=ge("app"),F="https://discord.gg/ksrfuy7WYR",x=l.useMemo(()=>b("ceo")??g[0],[]),[T,U]=l.useState(!0),[s,i]=l.useState(()=>({step:"manual",manualMode:"existing",manualPath:"",manualCloneUrl:"",manualName:"",manualIsolationMode:"in-process",manualNodeId:"",manualTaskPrefix:"",detectedRepos:[],workspaceMode:!1,isDetectingWorkspace:!1,registeredProject:null,selectedPresetId:x.id,agentDraft:R(x),isCreatingAgent:!1,isRegistering:!1,error:null,agentError:null,agentOutcome:null})),[A,W]=l.useState(!1),[I,j]=l.useState(!1),D=l.useRef(null),{nodes:M,loading:L}=te(),O=M.find(t=>t.type==="local")?.id,f=l.useCallback(()=>{U(!1),u?.()},[u]),_=l.useCallback(()=>{if(s.registeredProject){c(s.registeredProject);return}f()},[f,c,s.registeredProject]);l.useEffect(()=>{s.agentError&&D.current?.focus()},[s.agentError]);const N=l.useRef(0),H=l.useCallback(t=>{if(i(r=>{const n={manualPath:t,detectedRepos:[],workspaceMode:!1};t&&(!r.manualName||r.manualName===y(r.manualPath))&&(n.manualName=y(t));const o=n.manualName??r.manualName;return o&&(!r.manualTaskPrefix||r.manualTaskPrefix===C(y(r.manualPath)))&&(n.manualTaskPrefix=C(o)),{...r,...n}}),s.manualMode==="existing"&&t.trim()&&t.trim()!=="/"){const r=++N.current;i(n=>({...n,isDetectingWorkspace:!0})),ae(t.trim()).then(n=>{r===N.current&&i(o=>({...o,isDetectingWorkspace:!1,detectedRepos:n.repos,workspaceMode:n.isWorkspace}))}).catch(()=>{r===N.current&&i(n=>({...n,isDetectingWorkspace:!1}))})}},[s.manualMode]),B=l.useCallback(async()=>{const t=s.manualPath.trim(),r=s.manualName.trim(),n=s.manualCloneUrl.trim();if(!(!t||!r)&&!(s.manualMode==="clone"&&!n)){i(o=>({...o,isRegistering:!0,error:null}));try{const o={name:r,path:t,isolationMode:s.manualIsolationMode,nodeId:s.manualNodeId||void 0,cloneUrl:s.manualMode==="clone"?n:void 0,workspaceMode:s.workspaceMode,taskPrefix:s.manualTaskPrefix.trim()||void 0},d=await re(o);if(!z){i(m=>({...m,isRegistering:!1})),c(d);return}i(m=>({...m,step:"agent",registeredProject:d,isRegistering:!1}))}catch(o){i(d=>({...d,isRegistering:!1,error:o instanceof Error?o.message:"Failed to register project"}))}}},[z,c,s.manualPath,s.manualName,s.manualCloneUrl,s.manualMode,s.manualIsolationMode,s.manualNodeId,s.workspaceMode,s.manualTaskPrefix]),w=l.useCallback(t=>{const r=b(t);r&&i(n=>({...n,selectedPresetId:r.id,agentDraft:R(r),agentError:null}))},[]),$=l.useCallback((t,r)=>{const n=g.findIndex(se=>se.id===r);if(n<0)return;const o=g.length-1;let d=null;if(t.key==="ArrowDown"||t.key==="ArrowRight"?d=n===o?0:n+1:t.key==="ArrowUp"||t.key==="ArrowLeft"?d=n===0?o:n-1:t.key==="Home"?d=0:t.key==="End"&&(d=o),d===null)return;t.preventDefault();const m=g[d];w(m.id),requestAnimationFrame(()=>{document.querySelector(`[data-agent-preset-id="${m.id}"]`)?.focus()})},[w]),Y=l.useCallback(t=>{i(r=>({...r,selectedPresetId:"",agentDraft:ne(t),agentError:null}))},[]),G=l.useCallback(async()=>{if(!(!s.registeredProject||!s.agentDraft.name.trim())){i(t=>({...t,isCreatingAgent:!0,agentError:null}));try{await ie(le(s.agentDraft),s.registeredProject.id),i(t=>({...t,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}))}catch(t){i(r=>({...r,isCreatingAgent:!1,agentError:t instanceof Error?t.message:a("setup.firstAgentCreateError","Failed to create agent")}))}}},[s.agentDraft,s.registeredProject,a]),q=l.useCallback(()=>{i(t=>({...t,step:"complete",agentError:null,agentOutcome:"skipped"}))},[]);if(!T)return null;const k=s.manualMode==="existing",p=s.manualMode==="clone",K=s.manualPath.trim().length>0,Z=s.manualName.trim().length>0,V=s.manualCloneUrl.trim().length>0,X=s.isRegistering||!K||!Z||p&&!V,J=s.selectedPresetId?b(s.selectedPresetId):void 0,h=s.isCreatingAgent,Q=s.selectedPresetId||x.id,ee=`modal setup-wizard-modal${s.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:ee,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":a("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":a("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:a("setup.brandName","Fusion")})]}),e.jsxs("h2",{id:"wizard-title",className:"setup-wizard-title",children:[s.step==="manual"&&a("setup.welcomeToFusion","Welcome to Fusion"),s.step==="agent"&&a("setup.firstAgentTitle","Create your first agent"),s.step==="complete"&&a("setup.setupCompleteTitle","Setup Complete!")]})]}),s.step!=="complete"&&s.step!=="agent"&&e.jsx("button",{className:"modal-close",onClick:f,"aria-label":a("setup.closeWizard","Close wizard"),children:e.jsx(oe,{size:20})})]}),e.jsxs("div",{className:"setup-wizard-content",children:[s.step==="manual"&&e.jsxs("div",{className:"setup-wizard-manual",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-name",children:a("setup.projectName","Project Name")}),e.jsx("input",{id:"project-name",type:"text",value:s.manualName,onChange:t=>i(r=>({...r,manualName:t.target.value})),placeholder:a("setup.projectNamePlaceholder","my-project")}),e.jsx("p",{className:"form-hint",children:p?a("setup.projectNameHintClone","By default this follows the destination folder name unless you edit it."):a("setup.projectNameHintExisting","By default this follows the selected directory name unless you edit it.")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-path",children:p?a("setup.destinationDirectory","Destination Directory"):a("setup.projectDirectory","Project Directory")}),e.jsx(me,{value:s.manualPath,onChange:H,nodeId:s.manualNodeId||void 0,localNodeId:O,placeholder:p?a("setup.clonePathPlaceholder","/path/for/new-clone"):a("setup.projectPathPlaceholder","/path/to/your/project")}),e.jsx("p",{className:"form-hint",children:p?a("setup.clonePathHint","Select or type an absolute destination path. Fusion will clone into this directory."):a("setup.projectPathHint","Select or type the absolute path to your project")})]}),k&&s.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:s.workspaceMode,onChange:t=>i(r=>({...r,workspaceMode:t.target.checked}))}),a("setup.workspaceMode","Workspace mode (multi-repo)")]}),s.isDetectingWorkspace&&e.jsxs("p",{className:"form-hint",children:[e.jsx(v,{size:12,className:"animate-spin",style:{display:"inline-block",verticalAlign:"middle",marginRight:4}}),a("setup.detectingWorkspace","Detecting sub-repositories...")]}),!s.isDetectingWorkspace&&s.detectedRepos.length>0&&e.jsxs("p",{className:"form-hint",children:[a("setup.detectedRepos","Found {{count}} repositories:",{count:s.detectedRepos.length})," ",s.detectedRepos.join(", ")]}),!s.isDetectingWorkspace&&s.detectedRepos.length===0&&s.workspaceMode===!1&&s.manualPath.trim()&&e.jsx("p",{className:"form-hint",children:a("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:a("setup.taskPrefix","Task Prefix")}),e.jsx("input",{id:"task-prefix",type:"text",value:s.manualTaskPrefix,onChange:t=>i(r=>({...r,manualTaskPrefix:t.target.value.toUpperCase()})),placeholder:C(s.manualName||"FN"),maxLength:5}),e.jsx("p",{className:"form-hint",children:a("setup.taskPrefixHint",'Used for task IDs (e.g. "{{prefix}}-1"). Derived from project name.',{prefix:s.manualTaskPrefix||"FN"})})]}),e.jsxs("div",{className:"setup-wizard-advanced",children:[e.jsxs("button",{type:"button",className:"setup-wizard-advanced-toggle","aria-expanded":A,onClick:()=>W(t=>!t),children:[e.jsx(de,{size:16,className:"setup-wizard-advanced-chevron"}),e.jsx("span",{children:a("setup.advancedSettings","Advanced settings")})]}),A&&e.jsxs("div",{className:"setup-wizard-advanced-panel",children:[e.jsxs("fieldset",{className:"setup-wizard-mode-switch","aria-label":"Project setup mode",children:[e.jsx("legend",{children:a("setup.setupMode","Setup Mode")}),e.jsxs("label",{className:`setup-wizard-mode-option${k?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"existing",checked:k,onChange:()=>i(t=>({...t,manualMode:"existing",error:null}))}),e.jsx("span",{children:a("setup.useExistingDirectory","Use Existing Directory")})]}),e.jsxs("label",{className:`setup-wizard-mode-option${p?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"clone",checked:p,onChange:()=>i(t=>({...t,manualMode:"clone",error:null}))}),e.jsx("span",{children:a("setup.cloneGitRepository","Clone Git Repository")})]})]}),p&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"project-clone-url",children:a("setup.repositoryUrl","Repository URL")}),e.jsx("input",{id:"project-clone-url",type:"text",value:s.manualCloneUrl,onChange:t=>i(r=>({...r,manualCloneUrl:t.target.value})),placeholder:a("setup.repositoryUrlPlaceholder","https://github.com/owner/repo.git")}),e.jsx("p",{className:"form-hint",children:a("setup.cloneGitHint","Fusion will run git clone into the destination directory, then register that cloned folder.")})]}),e.jsx("div",{className:"form-group",children:e.jsxs("div",{className:"project-node-selector",children:[e.jsx("span",{className:"project-node-selector__label",children:a("setup.runtimeNode","Runtime Node")}),e.jsxs("select",{value:s.manualNodeId,onChange:t=>i(r=>({...r,manualNodeId:t.target.value})),disabled:L||s.isRegistering,children:[e.jsx("option",{value:"",children:a("setup.localNode","Local node")}),M.map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.type,")"]},t.id))]})]})}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("setup.isolationMode","Isolation Mode")}),e.jsxs("div",{className:"setup-wizard-isolation-options",children:[e.jsxs("label",{className:`setup-wizard-isolation-option${s.manualIsolationMode==="in-process"?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"isolation-mode",value:"in-process",checked:s.manualIsolationMode==="in-process",onChange:()=>i(t=>({...t,manualIsolationMode:"in-process"}))}),e.jsxs("div",{className:"setup-wizard-isolation-option-content",children:[e.jsx("strong",{children:a("setup.inProcess","In-Process")}),e.jsx("span",{children:a("setup.inProcessDesc","Lower overhead, shared memory. Best for most projects.")}),e.jsx("span",{className:"wizard-option-recommended",children:a("setup.recommended","Recommended")})]})]}),e.jsxs("label",{className:`setup-wizard-isolation-option${s.manualIsolationMode==="child-process"?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"isolation-mode",value:"child-process",checked:s.manualIsolationMode==="child-process",onChange:()=>i(t=>({...t,manualIsolationMode:"child-process"}))}),e.jsxs("div",{className:"setup-wizard-isolation-option-content",children:[e.jsx("strong",{children:a("setup.childProcess","Child-Process")}),e.jsx("span",{children:a("setup.childProcessDesc","Isolated execution with crash containment.")})]})]})]})]})]})]}),s.error&&e.jsx("div",{className:"wizard-error",role:"alert",children:s.error})]}),s.step==="agent"&&e.jsxs("div",{className:"setup-wizard-agent-step",children:[e.jsx("p",{className:"setup-wizard-agent-intro",children:a("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:a("setup.firstAgentTemplates","Templates")}),e.jsx("div",{className:"setup-wizard-agent-preset-list",role:"radiogroup","aria-label":a("setup.firstAgentTemplates","Templates"),children:g.map(t=>{const r=s.selectedPresetId===t.id;return e.jsxs("button",{type:"button",className:`setup-wizard-agent-preset${r?" selected":""}`,role:"radio","aria-checked":r,"aria-label":r?a("setup.selectedAgentTemplate","{{name}} selected",{name:t.name}):t.name,tabIndex:t.id===Q?0:-1,"data-agent-preset-id":t.id,disabled:h,onClick:()=>w(t.id),onKeyDown:n=>$(n,t.id),children:[e.jsx(E,{agent:{id:t.id,icon:t.icon,name:t.name},size:28}),e.jsxs("span",{className:"setup-wizard-agent-preset-copy",children:[e.jsxs("span",{className:"setup-wizard-agent-preset-name",children:[t.name,t.id==="ceo"&&e.jsx("span",{className:"wizard-option-recommended",children:a("setup.recommended","Recommended")})]}),e.jsx("span",{className:"setup-wizard-agent-preset-description",children:t.description})]})]},t.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:a("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(E,{agent:{id:s.selectedPresetId||"draft",icon:s.agentDraft.icon,name:s.agentDraft.name},size:36}),e.jsxs("div",{children:[e.jsx("h3",{children:s.agentDraft.name||a("setup.firstAgentDraftName","Draft agent")}),e.jsx("p",{children:s.agentDraft.title||J?.title||a("setup.firstAgentCustomDraft","Custom agent draft")})]})]}),e.jsxs("dl",{className:"setup-wizard-agent-preview-list",children:[e.jsxs("div",{children:[e.jsx("dt",{children:a("agents.fieldRole","Role")}),e.jsx("dd",{children:s.agentDraft.role})]}),e.jsxs("div",{children:[e.jsx("dt",{children:a("agents.fieldInstructionsText","Inline Instructions")}),e.jsx("dd",{children:s.agentDraft.instructionsText||a("setup.firstAgentNoInstructions","No inline instructions yet")})]})]}),P&&e.jsxs("button",{type:"button",className:"btn setup-wizard-agent-ai-btn",onClick:()=>j(!0),disabled:h,children:[e.jsx(ce,{size:16}),e.jsx("span",{children:a("agents.aiInterview","AI Interview")})]})]})]})]}),s.agentError&&e.jsx("div",{className:"wizard-error",role:"alert",tabIndex:-1,ref:D,children:s.agentError})]}),s.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(S,{size:64,className:"success-icon"}),e.jsx("h3",{children:a("setup.allSet","All Set!")}),e.jsx("p",{children:s.agentOutcome==="created"?a("setup.firstAgentCreatedSuccess","Your project is registered and your first agent is ready."):a("setup.projectRegisteredSuccess","Your project has been registered successfully.")}),e.jsx("p",{children:s.agentOutcome==="skipped"?a("setup.firstAgentSkippedHint","You can create agents later from the Agents view."):a("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:F,target:"_blank",rel:"noopener noreferrer",children:a("setup.needHelp","Need help?")}),s.step==="manual"&&e.jsx("button",{className:"btn btn-primary",onClick:B,disabled:X,children:s.isRegistering?e.jsxs(e.Fragment,{children:[e.jsx(v,{size:16,className:"animate-spin"}),e.jsx("span",{children:a("setup.registering","Registering...")})]}):e.jsx("span",{children:a("setup.registerProject","Register Project")})}),s.step==="agent"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:q,disabled:h,children:a("setup.skipFirstAgent","Skip for now")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void G(),disabled:h||!s.agentDraft.name.trim(),"aria-busy":s.isCreatingAgent,children:s.isCreatingAgent?e.jsxs(e.Fragment,{children:[e.jsx(v,{size:16,className:"animate-spin"}),e.jsx("span",{children:a("setup.creatingFirstAgent","Creating agent...")})]}):e.jsx("span",{children:a("setup.createFirstAgent","Create Agent")})})]}),s.step==="complete"&&e.jsxs("button",{className:"btn btn-primary",onClick:_,children:[e.jsx(S,{size:16}),e.jsx("span",{children:a("setup.getStarted","Get Started")})]})]})]}),P&&I&&e.jsx(ue,{level:"modal",fallback:e.jsxs("div",{className:"wizard-error setup-wizard-agent-interview-error",role:"alert",children:[e.jsx("span",{children:a("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:()=>j(!1),children:a("setup.firstAgentContinueWithTemplates","Continue with templates")})]}),children:e.jsx(l.Suspense,{fallback:e.jsx("div",{className:"wizard-error setup-wizard-agent-interview-error",role:"status",children:a("setup.firstAgentInterviewLoading","Loading AI Interview...")}),children:e.jsx(he,{isOpen:I,onClose:()=>j(!1),onUseDraft:Y,projectId:s.registeredProject?.id,existingAgents:[],mode:"create"})})})]})}export{Ce as SetupWizardModal};
@@ -1,4 +1,4 @@
1
- import{c as i,c2 as b,c3 as d,c4 as v,c5 as p}from"./index-DFeBJ3GM.js";import{r as N,j as e}from"./vendor-react-SZ_qB27O.js";import{u as w}from"./vendor-i18n-GF3RlKbq.js";/**
1
+ import{c as i,c2 as b,c3 as d,c4 as v,c5 as p}from"./index-DAv17W73.js";import{r as N,j as e}from"./vendor-react-SZ_qB27O.js";import{u as w}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{i as ms,j as us,t as vs,k as hs,l as gs,n as bs,V as ws,Z as xs,X as q,R as fs,o as js,C as ps,L as A,p as H,q as G,M as J}from"./index-DFeBJ3GM.js";import{u as Ns}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.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(H,{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(q,{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(H,{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(q,{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{i as ms,j as us,t as vs,k as hs,l as gs,n as bs,V as ws,Z as xs,X as q,R as fs,o as js,C as ps,L as A,p as H,q as G,M as J}from"./index-DAv17W73.js";import{u as Ns}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.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(H,{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(q,{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(H,{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(q,{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 Rt,ay as ft,az as ht,aA as Ot,bg as _t,bh as Pt,bi as Ut,bj as Kt,bk as Bt,bl as Vt,bm as Xt,bn as zt,aD as Gt,ae as Wt,bo as qt,bp as Z,bq as xt,L as Ht,P as gt,G as tt,X as et,br as vt,I as Lt,J as yt,bs as Jt,ad as Yt,o as Qt,bt as Zt,bu as jt,al as te}from"./index-DFeBJ3GM.js";import{u as kt}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";/**
1
+ import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{c as Rt,ay as ft,az as ht,aA as Ot,bg as _t,bh as Pt,bi as Ut,bj as Kt,bk as Bt,bl as Vt,bm as Xt,bn as zt,aD as Gt,ae as Wt,bo as qt,bp as Z,bq as xt,L as Ht,P as gt,G as tt,X as et,br as vt,I as Lt,J as yt,bs as Jt,ad as Yt,o as Qt,bt as Zt,bu as jt,al as te}from"./index-DAv17W73.js";import{u as kt}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{r as a,j as e,b as Ra}from"./vendor-react-SZ_qB27O.js";import{R as Pa,u as Ma,d as Ia,e as Oa,f as Da,B as Ta,C as La,M as za}from"./vendor-reactflow-Bg-Qjzh8.js";import{c as Wa,ee as Nt,ef as ao,eg as we,eh as _s,ei as $a,ej as Ba,ek as Gs,bp as ne,bo as yt,P as Ee,b7 as Te,bu as _a,ad as Ga,o as Se,J as Ne,am as qs,el as qa,bL as Ct,em as Qo,bF as Hs,en as no,al as Ha,C as Pe,bP as lo,I as Va,eo as Ua,ep as Ka,cq as Zo,eq as Ya,er as Ja,es as Xa,dz as Qa,a3 as es,ae as Za,et as en,eu as tn,ev as on,ew as sn,ex as an,ey as nn,ez as ln,eA as rn,eB as ts,eC as os,eD as ss,eE as as,eF as ns,eG as dn,eH as cn,eI as un,eJ as fn,eK as pn,eL as mn,eM as wn,eN as hn,eO as gn,eP as ls,eQ as bn,eR as is,eS as rs,eT as kn,eU as ds,eV as cs,eW as xn,eX as Qt,eY as vn,eZ as Vs,e_ as jn,e$ as us,f0 as Nn,i as fs,dh as ps,f1 as ms,X as Us,bs as ws,L as Me,f2 as Zt,br as Ks,bb as yn,f3 as Ys,a1 as Cn,ak as Sn,ba as En,f4 as An,f5 as Fn,f6 as Rn,f7 as hs,f8 as Pn,f9 as Mn,fa as In,fb as On,fc as jt,S as He,fd as Dn,fe as Tn,ff as Ln,di as gs,fg as bs,fh as zn,fi as Wn,dk as $n,fj as Bn,fk as _n}from"./index-DFeBJ3GM.js";import{u as ye}from"./vendor-i18n-GF3RlKbq.js";import{U as Gn}from"./upload-BK1crTqn.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";/**
1
+ import{r as a,j as e,b as Ra}from"./vendor-react-SZ_qB27O.js";import{R as Pa,u as Ma,d as Ia,e as Oa,f as Da,B as Ta,C as La,M as za}from"./vendor-reactflow-Bg-Qjzh8.js";import{c as Wa,ee as Nt,ef as ao,eg as we,eh as _s,ei as $a,ej as Ba,ek as Gs,bp as ne,bo as yt,P as Ee,b8 as Te,bu as _a,ad as Ga,o as Se,J as Ne,am as qs,el as qa,bL as Ct,em as Qo,bF as Hs,en as no,al as Ha,C as Pe,bP as lo,I as Va,eo as Ua,ep as Ka,cq as Zo,eq as Ya,er as Ja,es as Xa,dz as Qa,a3 as es,ae as Za,et as en,eu as tn,ev as on,ew as sn,ex as an,ey as nn,ez as ln,eA as rn,eB as ts,eC as os,eD as ss,eE as as,eF as ns,eG as dn,eH as cn,eI as un,eJ as fn,eK as pn,eL as mn,eM as wn,eN as hn,eO as gn,eP as ls,eQ as bn,eR as is,eS as rs,eT as kn,eU as ds,eV as cs,eW as xn,eX as Qt,eY as vn,eZ as Vs,e_ as jn,e$ as us,f0 as Nn,i as fs,dh as ps,f1 as ms,X as Us,bs as ws,L as Me,f2 as Zt,br as Ks,bb as yn,f3 as Ys,a1 as Cn,ak as Sn,ba as En,f4 as An,f5 as Fn,f6 as Rn,f7 as hs,f8 as Pn,f9 as Mn,fa as In,fb as On,fc as jt,S as He,fd as Dn,fe as Tn,ff as Ln,di as gs,fg as bs,fh as zn,fi as Wn,dk as $n,fj as Bn,fk as _n}from"./index-DAv17W73.js";import{u as ye}from"./vendor-i18n-GF3RlKbq.js";import{U as Gn}from"./upload-BsYRkl_8.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as d,j as s}from"./vendor-react-SZ_qB27O.js";import{i as j,al as v}from"./index-DFeBJ3GM.js";import{u as N}from"./vendor-i18n-GF3RlKbq.js";function $({value:e,onChange:i,projectId:t,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(t).then(c=>{l||k(c)}).catch(()=>{l||k([])}).finally(()=>{l||u(!1)}),()=>{l=!0}},[t]);const S=l=>{e.includes(l)||i([...e,l])},x=l=>{i(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 i=e.trim();if(!i)return e;const t=i.match(L);return t?.[1]?t[1]:i}export{$ as S,y as f};
1
+ import{r as d,j as s}from"./vendor-react-SZ_qB27O.js";import{i as j,al as v}from"./index-DAv17W73.js";import{u as N}from"./vendor-i18n-GF3RlKbq.js";function $({value:e,onChange:i,projectId:t,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(t).then(c=>{l||k(c)}).catch(()=>{l||k([])}).finally(()=>{l||u(!1)}),()=>{l=!0}},[t]);const S=l=>{e.includes(l)||i([...e,l])},x=l=>{i(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 i=e.trim();if(!i)return e;const t=i.match(L);return t?.[1]?t[1]:i}export{$ as S,y as f};