@runfusion/fusion 0.77.0-beta.7 → 0.77.0-beta.8

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 (136) hide show
  1. package/dist/bin.js +548 -86
  2. package/dist/child-process-worker.js +546 -86
  3. package/dist/client/.vite/manifest.json +249 -249
  4. package/dist/client/assets/{AgentDetailView-C1eh_vXv.js → AgentDetailView-DsMRc-aH.js} +1 -1
  5. package/dist/client/assets/{AgentPermissionPolicyEditor-CeKsO1LR.js → AgentPermissionPolicyEditor-BXJ52YpO.js} +1 -1
  6. package/dist/client/assets/{AgentsView-BNe2ABOc.js → AgentsView-DO-25nlB.js} +3 -3
  7. package/dist/client/assets/{CommandCenter-BuREM-G1.js → CommandCenter-BMXMg_I2.js} +1 -1
  8. package/dist/client/assets/{DevServerView-D0i1b-QO.js → DevServerView-DAeL5TYz.js} +1 -1
  9. package/dist/client/assets/{DirectoryPicker-VOx91hQt.js → DirectoryPicker-Cw-XRjAa.js} +1 -1
  10. package/dist/client/assets/{DocumentsView-CO5W_WVb.js → DocumentsView-CusClN9u.js} +1 -1
  11. package/dist/client/assets/{EvalsView-BqSINSrZ.js → EvalsView-gNdeUDww.js} +1 -1
  12. package/dist/client/assets/{ExperimentalAgentOnboardingModal-DEcFgONi.js → ExperimentalAgentOnboardingModal-Bmzbqzhs.js} +1 -1
  13. package/dist/client/assets/{GoalsView-DZ57wXmJ.js → GoalsView-J8JMsoLn.js} +1 -1
  14. package/dist/client/assets/{InsightsView-DSWfXG7Q.js → InsightsView-BVbv56K0.js} +1 -1
  15. package/dist/client/assets/{MemoryView-BEX10uhl.js → MemoryView-DNvJFoDu.js} +1 -1
  16. package/dist/client/assets/{PiExtensionsManager-DcAmXXoR.js → PiExtensionsManager-BPMexS34.js} +1 -1
  17. package/dist/client/assets/{PluginManager-BU0omQUv.js → PluginManager-DGEv-ptu.js} +1 -1
  18. package/dist/client/assets/{PullRequestView-B-JL_8Kk.js → PullRequestView-CF7fx-Uo.js} +1 -1
  19. package/dist/client/assets/ReportModal-B8S5BFgn.js +21 -0
  20. package/dist/client/assets/ReportModal-Dx3f2aj7.css +1 -0
  21. package/dist/client/assets/{ResearchView-CnwTXfQO.js → ResearchView-CBeXsevy.js} +1 -1
  22. package/dist/client/assets/{SecretsView-BDvzsLFz.js → SecretsView-Dmi9wZkv.js} +1 -1
  23. package/dist/client/assets/{SettingsModal-801eFQ9u.js → SettingsModal-D2kXP7Um.js} +3 -3
  24. package/dist/client/assets/{SettingsModal-BZHeQ3ED.js → SettingsModal-DSW3xnGk.js} +1 -1
  25. package/dist/client/assets/{SettingsTextareaRow-B0rTuelr.js → SettingsTextareaRow-CLab4Vcd.js} +1 -1
  26. package/dist/client/assets/{SetupWizardModal-CoExPwIn.js → SetupWizardModal-Ct6juX9x.js} +2 -2
  27. package/dist/client/assets/{SkillsView-WVP25LPj.js → SkillsView-Dn0bwT6i.js} +1 -1
  28. package/dist/client/assets/{WorkflowNodeEditor-pCMyKcnS.js → WorkflowNodeEditor-cvReMlG-.js} +1 -1
  29. package/dist/client/assets/{agent-import-generation-M_hKtjgN.js → agent-import-generation-C8_ewVzC.js} +1 -1
  30. package/dist/client/assets/{agentsOrgChartLayout-DjvIMhFD.js → agentsOrgChartLayout-p1i6XROQ.js} +1 -1
  31. package/dist/client/assets/{architectureDiagram-3BPJPVTR-CkzEm8i9.js → architectureDiagram-3BPJPVTR-CzCk1QdH.js} +1 -1
  32. package/dist/client/assets/{blockDiagram-GPEHLZMM-Dc-dUMjY.js → blockDiagram-GPEHLZMM-74Rj-5ov.js} +1 -1
  33. package/dist/client/assets/{c4Diagram-AAUBKEIU-DnYjsrR0.js → c4Diagram-AAUBKEIU-B570qYH-.js} +1 -1
  34. package/dist/client/assets/channel-DWAK5y-J.js +1 -0
  35. package/dist/client/assets/{chunk-2J33WTMH-0E1GEFEr.js → chunk-2J33WTMH-DejJkxt6.js} +1 -1
  36. package/dist/client/assets/{chunk-4BX2VUAB-Dj5oZd51.js → chunk-4BX2VUAB-DlgxkBuE.js} +1 -1
  37. package/dist/client/assets/{chunk-55IACEB6-DfNT0s8E.js → chunk-55IACEB6-XCfE8PwC.js} +1 -1
  38. package/dist/client/assets/{chunk-727SXJPM-BnFjhiIQ.js → chunk-727SXJPM-D-nDw0Bi.js} +1 -1
  39. package/dist/client/assets/{chunk-AQP2D5EJ-DR84wSqR.js → chunk-AQP2D5EJ-C4KySao0.js} +1 -1
  40. package/dist/client/assets/{chunk-FMBD7UC4-IjByNOrR.js → chunk-FMBD7UC4-CXKdLygA.js} +1 -1
  41. package/dist/client/assets/{chunk-ND2GUHAM-By0q_jZm.js → chunk-ND2GUHAM-bNYWWGVJ.js} +1 -1
  42. package/dist/client/assets/{chunk-QZHKN3VN-BELcl3N5.js → chunk-QZHKN3VN-cfBQJ-MX.js} +1 -1
  43. package/dist/client/assets/classDiagram-4FO5ZUOK-WTkXRkfm.js +1 -0
  44. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-WTkXRkfm.js +1 -0
  45. package/dist/client/assets/{cose-bilkent-S5V4N54A-D4cCw9-_.js → cose-bilkent-S5V4N54A-CiZrg3mQ.js} +1 -1
  46. package/dist/client/assets/{dagre-BM42HDAG-JJp5dVeY.js → dagre-BM42HDAG-Bckph2U4.js} +1 -1
  47. package/dist/client/assets/{dashboard-view-Bl9CPhxE.js → dashboard-view-CN_fkDM1.js} +1 -1
  48. package/dist/client/assets/{dashboard-view-C5Nt8cvY.js → dashboard-view-CVYHQZwx.js} +1 -1
  49. package/dist/client/assets/{dashboard-view-6zPJm9zC.js → dashboard-view-DDRKwfFs.js} +1 -1
  50. package/dist/client/assets/{dashboard-view-MAC_LHDX.js → dashboard-view-IuPjDVGa.js} +1 -1
  51. package/dist/client/assets/{diagram-2AECGRRQ-D4L7j_t_.js → diagram-2AECGRRQ-Bnaurex7.js} +1 -1
  52. package/dist/client/assets/{diagram-5GNKFQAL-VAGFaXqG.js → diagram-5GNKFQAL-BKz1omVN.js} +1 -1
  53. package/dist/client/assets/{diagram-KO2AKTUF-hqXSggfW.js → diagram-KO2AKTUF-C51lEZwo.js} +1 -1
  54. package/dist/client/assets/{diagram-LMA3HP47-B3eAIuy8.js → diagram-LMA3HP47-BYm5gql7.js} +1 -1
  55. package/dist/client/assets/{diagram-OG6HWLK6-BGufp0RK.js → diagram-OG6HWLK6-B9CFA4ha.js} +1 -1
  56. package/dist/client/assets/{erDiagram-TEJ5UH35-DplXdx8w.js → erDiagram-TEJ5UH35-BLyCSssl.js} +1 -1
  57. package/dist/client/assets/{flowDiagram-I6XJVG4X-C1Ms2bko.js → flowDiagram-I6XJVG4X-yDVmpkro.js} +1 -1
  58. package/dist/client/assets/{folder-open-nMraSDXu.js → folder-open-Cf2NA9nV.js} +1 -1
  59. package/dist/client/assets/{ganttDiagram-6RSMTGT7-DVgxMtXb.js → ganttDiagram-6RSMTGT7-mC9YPFcx.js} +1 -1
  60. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-DH2_n0J8.js → gitGraphDiagram-PVQCEYII-DS0bEccv.js} +1 -1
  61. package/dist/client/assets/index-BjM7LxzY.js +2805 -0
  62. package/dist/client/assets/index-DcKIzuMk.css +1 -0
  63. package/dist/client/assets/{infoDiagram-5YYISTIA-DmZdWVcU.js → infoDiagram-5YYISTIA-CuuNZITP.js} +1 -1
  64. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-DsEIHSXr.js → ishikawaDiagram-YF4QCWOH-MBSaC94m.js} +1 -1
  65. package/dist/client/assets/{journeyDiagram-JHISSGLW-CsfIWmu1.js → journeyDiagram-JHISSGLW-DkaAow9E.js} +1 -1
  66. package/dist/client/assets/{kanban-definition-UN3LZRKU-CQKqeZvc.js → kanban-definition-UN3LZRKU-DSf5OLtq.js} +1 -1
  67. package/dist/client/assets/{mermaid.core-DkC_dr4-.js → mermaid.core-HmTn21MF.js} +4 -4
  68. package/dist/client/assets/{mindmap-definition-RKZ34NQL-RnmE-NUe.js → mindmap-definition-RKZ34NQL-sv0Dl8aI.js} +1 -1
  69. package/dist/client/assets/{pieDiagram-4H26LBE5-DPu6FPc4.js → pieDiagram-4H26LBE5-BDK2IQNq.js} +1 -1
  70. package/dist/client/assets/{puzzle-DwhHOf32.js → puzzle-D00mP67o.js} +1 -1
  71. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-CYbypO2p.js → quadrantDiagram-W4KKPZXB-CiWAhwf1.js} +1 -1
  72. package/dist/client/assets/{requirementDiagram-4Y6WPE33-DFk1vK_N.js → requirementDiagram-4Y6WPE33-DwC99D35.js} +1 -1
  73. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-CkUY1Zzu.js → sankeyDiagram-5OEKKPKP-CQn8z721.js} +1 -1
  74. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-CFivaLOO.js → sequenceDiagram-3UESZ5HK-B0CT8-vw.js} +1 -1
  75. package/dist/client/assets/{standing-instructions-template-BbqKGAC1.js → standing-instructions-template-BIBO_Prr.js} +1 -1
  76. package/dist/client/assets/{stateDiagram-AJRCARHV-BPeD5PwG.js → stateDiagram-AJRCARHV-BYAB_dFF.js} +1 -1
  77. package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-DduiCPMb.js → stateDiagram-v2-BHNVJYJU-Cd19uJBk.js} +1 -1
  78. package/dist/client/assets/{timeline-definition-PNZ67QCA-CGUNNVro.js → timeline-definition-PNZ67QCA-DQLh8XkY.js} +1 -1
  79. package/dist/client/assets/{upload-BS96H1o7.js → upload-D4pkNOz2.js} +1 -1
  80. package/dist/client/assets/{users--irrWoyU.js → users-COgviS_S.js} +1 -1
  81. package/dist/client/assets/{vennDiagram-CIIHVFJN-CybTaJJH.js → vennDiagram-CIIHVFJN-BmwG1Wud.js} +1 -1
  82. package/dist/client/assets/{wardley-L42UT6IY-DSxaSCGi.js → wardley-L42UT6IY-BiO7jkmj.js} +1 -1
  83. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-YFb0AxNt.js → wardleyDiagram-YWT4CUSO-Dq0IPg5H.js} +1 -1
  84. package/dist/client/assets/{xychartDiagram-2RQKCTM6-Cv6zlMJC.js → xychartDiagram-2RQKCTM6-BlMOlSBc.js} +1 -1
  85. package/dist/client/index.html +13 -6
  86. package/dist/client/theme-data.css +85 -0
  87. package/dist/client/version.json +1 -1
  88. package/dist/droid-cli/package.json +1 -1
  89. package/dist/extension.js +548 -86
  90. package/dist/pi-claude-cli/package.json +1 -1
  91. package/dist/plugin-sdk/index.d.ts +5 -1
  92. package/dist/plugin-sdk/index.js +43 -19
  93. package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +43 -19
  94. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  95. package/dist/plugins/fusion-plugin-claude-runtime/bundled.js +43 -19
  96. package/dist/plugins/fusion-plugin-claude-runtime/package.json +1 -1
  97. package/dist/plugins/fusion-plugin-cli-printing-press/bundled.js +43 -19
  98. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  99. package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +43 -19
  100. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  101. package/dist/plugins/fusion-plugin-cursor-runtime/bundled.js +43 -19
  102. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  103. package/dist/plugins/fusion-plugin-dependency-graph/bundled.js +43 -19
  104. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  105. package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +43 -19
  106. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  107. package/dist/plugins/fusion-plugin-grok-runtime/bundled.js +43 -19
  108. package/dist/plugins/fusion-plugin-grok-runtime/package.json +1 -1
  109. package/dist/plugins/fusion-plugin-hermes-runtime/bundled.js +43 -19
  110. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  111. package/dist/plugins/fusion-plugin-linear-import/bundled.js +43 -19
  112. package/dist/plugins/fusion-plugin-linear-import/package.json +1 -1
  113. package/dist/plugins/fusion-plugin-omp-runtime/bundled.js +43 -19
  114. package/dist/plugins/fusion-plugin-omp-runtime/package.json +1 -1
  115. package/dist/plugins/fusion-plugin-openclaw-runtime/bundled.js +43 -19
  116. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  117. package/dist/plugins/fusion-plugin-paperclip-runtime/bundled.js +43 -19
  118. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  119. package/dist/plugins/fusion-plugin-quality/bundled.js +43 -19
  120. package/dist/plugins/fusion-plugin-quality/package.json +1 -1
  121. package/dist/plugins/fusion-plugin-reports/bundled.js +43 -19
  122. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  123. package/dist/plugins/fusion-plugin-roadmap/bundled.js +43 -19
  124. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  125. package/dist/plugins/fusion-plugin-todos/bundled.js +43 -19
  126. package/dist/plugins/fusion-plugin-todos/package.json +1 -1
  127. package/dist/plugins/fusion-plugin-whatsapp-chat/bundled.js +43 -19
  128. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  129. package/package.json +1 -1
  130. package/dist/client/assets/ReportModal-DxggF_RH.js +0 -21
  131. package/dist/client/assets/ReportModal-lzN_xrnM.css +0 -1
  132. package/dist/client/assets/channel-CxQ40s_U.js +0 -1
  133. package/dist/client/assets/classDiagram-4FO5ZUOK-C2ARdiRL.js +0 -1
  134. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-C2ARdiRL.js +0 -1
  135. package/dist/client/assets/index-BJc-A7eB.css +0 -1
  136. package/dist/client/assets/index-CBFPgFTp.js +0 -2787
@@ -1 +1 @@
1
- import{r}from"./vendor-react-SZ_qB27O.js";import{a as n,w as s}from"./index-CBFPgFTp.js";function x(e){return n(s("/memory/files",e))}function C(e,t){const c=`path=${encodeURIComponent(e)}`;return n(s(`/memory/file?${c}`,t))}function F(e,t,c){return n(s("/memory/file",c),{method:"PUT",body:JSON.stringify({path:e,content:t})})}function J(e,t){return n(s("/memory/compact",t),{method:"POST",body:JSON.stringify(e?{path:e}:{})})}function N(e){return n(s("/memory/dream",e),{method:"POST"})}function W(e){return n(s("/memory/insights",e))}function j(e,t){return n(s("/memory/insights",t),{method:"PUT",body:JSON.stringify({content:e})})}function q(e){return n(s("/memory/extract",e),{method:"POST"})}function D(e){return n(s("/memory/audit",e))}function B(e){return n(s("/memory/backend",e))}function L(e){return n(s("/memory/install-qmd",e),{method:"POST"})}function $(e,t){return n(s("/memory/test",t),{method:"POST",body:JSON.stringify({query:e})})}function Q(e={}){const{projectId:t,pollInterval:c=6e4,autoRefresh:p=!1,enabled:a=!0}=e,[S,y]=r.useState(null),[g,m]=r.useState(a),[M,d]=r.useState(null),[k,v]=r.useState(null),o=r.useRef(null),u=r.useRef(null),l=r.useRef(!0),i=r.useCallback(async()=>{if(!a){m(!1),d(null),y(null);return}o.current&&o.current.abort(),o.current=new AbortController,m(!0),d(null),y(null);try{const f=await B(t);if(!l.current)return;y(f),d(null),v(new Date),m(!1)}catch(f){if(f instanceof Error&&f.name==="AbortError"||!l.current)return;const w=f instanceof Error?f.message:"Failed to fetch memory backend status";d(w),m(!1)}},[a,t]);r.useEffect(()=>(l.current=!0,a?(i(),()=>{l.current=!1}):(o.current&&o.current.abort(),y(null),d(null),m(!1),()=>{l.current=!1})),[a,i]),r.useEffect(()=>{if(!(!a||!p))return u.current=setInterval(()=>{i()},c),()=>{u.current&&(clearInterval(u.current),u.current=null)}},[a,p,c,i]),r.useEffect(()=>()=>{l.current=!1,o.current&&o.current.abort(),u.current&&(clearInterval(u.current),u.current=null)},[]);const I=r.useCallback(()=>i(),[i]),b=g?null:S,R=b?.currentBackend??null,h=b?.capabilities??null,E=b?.availableBackends??[],O=h?.readable??!1,P=h?.writable??!1,T=h?.supportsAtomicWrite??!1;return{status:b,currentBackend:R,capabilities:h,availableBackends:E,isReadable:O,isWritable:P,supportsAtomicWrite:T,loading:g,error:M,lastUpdated:k,refresh:I}}export{x as a,D as b,W as c,j as d,q as e,C as f,N as g,J as h,L as i,F as s,$ as t,Q as u};
1
+ import{r}from"./vendor-react-SZ_qB27O.js";import{a as n,w as s}from"./index-BjM7LxzY.js";function x(e){return n(s("/memory/files",e))}function C(e,t){const c=`path=${encodeURIComponent(e)}`;return n(s(`/memory/file?${c}`,t))}function F(e,t,c){return n(s("/memory/file",c),{method:"PUT",body:JSON.stringify({path:e,content:t})})}function J(e,t){return n(s("/memory/compact",t),{method:"POST",body:JSON.stringify(e?{path:e}:{})})}function N(e){return n(s("/memory/dream",e),{method:"POST"})}function W(e){return n(s("/memory/insights",e))}function j(e,t){return n(s("/memory/insights",t),{method:"PUT",body:JSON.stringify({content:e})})}function q(e){return n(s("/memory/extract",e),{method:"POST"})}function D(e){return n(s("/memory/audit",e))}function B(e){return n(s("/memory/backend",e))}function L(e){return n(s("/memory/install-qmd",e),{method:"POST"})}function $(e,t){return n(s("/memory/test",t),{method:"POST",body:JSON.stringify({query:e})})}function Q(e={}){const{projectId:t,pollInterval:c=6e4,autoRefresh:p=!1,enabled:a=!0}=e,[S,y]=r.useState(null),[g,m]=r.useState(a),[M,d]=r.useState(null),[k,v]=r.useState(null),o=r.useRef(null),u=r.useRef(null),l=r.useRef(!0),i=r.useCallback(async()=>{if(!a){m(!1),d(null),y(null);return}o.current&&o.current.abort(),o.current=new AbortController,m(!0),d(null),y(null);try{const f=await B(t);if(!l.current)return;y(f),d(null),v(new Date),m(!1)}catch(f){if(f instanceof Error&&f.name==="AbortError"||!l.current)return;const w=f instanceof Error?f.message:"Failed to fetch memory backend status";d(w),m(!1)}},[a,t]);r.useEffect(()=>(l.current=!0,a?(i(),()=>{l.current=!1}):(o.current&&o.current.abort(),y(null),d(null),m(!1),()=>{l.current=!1})),[a,i]),r.useEffect(()=>{if(!(!a||!p))return u.current=setInterval(()=>{i()},c),()=>{u.current&&(clearInterval(u.current),u.current=null)}},[a,p,c,i]),r.useEffect(()=>()=>{l.current=!1,o.current&&o.current.abort(),u.current&&(clearInterval(u.current),u.current=null)},[]);const I=r.useCallback(()=>i(),[i]),b=g?null:S,R=b?.currentBackend??null,h=b?.capabilities??null,E=b?.availableBackends??[],O=h?.readable??!1,P=h?.writable??!1,T=h?.supportsAtomicWrite??!1;return{status:b,currentBackend:R,capabilities:h,availableBackends:E,isReadable:O,isWritable:P,supportsAtomicWrite:T,loading:g,error:M,lastUpdated:k,refresh:I}}export{x as a,D as b,W as c,j as d,q as e,C as f,N as g,J as h,L as i,F as s,$ as t,Q as u};
@@ -1 +1 @@
1
- import{r as h,j as e}from"./vendor-react-SZ_qB27O.js";import{u as j}from"./vendor-i18n-Duky4gdQ.js";import{dc as S,aR as E}from"./index-CBFPgFTp.js";const b="fusion:settings-help-open";function y({children:s,settingKey:l}){const{t:n}=j("app"),[c,o]=h.useState(!1),a=h.useRef(null),p=h.useId(),d=`settings-help-${l??p}`;h.useEffect(()=>{const t=i=>{i.detail!==d&&o(!1)};return document.addEventListener(b,t),()=>document.removeEventListener(b,t)},[d]);const u=()=>{o(t=>{const i=!t;return i&&document.dispatchEvent(new CustomEvent(b,{detail:d})),i})};return h.useEffect(()=>{if(!c)return;const t=r=>{a.current?.contains(r.target)||o(!1)},i=r=>{r.key==="Escape"&&(r.stopPropagation(),o(!1))};return document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",i,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",i,!0)}},[c]),e.jsxs("span",{className:"settings-help","data-open":c?"true":"false",ref:a,children:[e.jsx("button",{type:"button",className:"settings-help-trigger","aria-label":n("settings.help.show","Show help"),"aria-expanded":c,"aria-describedby":d,"data-testid":l?`settings-help-${l}`:void 0,onClick:u,children:e.jsx(S,{size:13,"aria-hidden":!0})}),e.jsx("span",{id:d,role:"note",className:"settings-help-bubble",children:s})]})}const N=h.createContext({highlightedKey:null});function L({highlightedKey:s,children:l}){const n=h.useMemo(()=>({highlightedKey:s}),[s]);return e.jsx(N.Provider,{value:n,children:l})}function k(s){const{highlightedKey:l}=h.useContext(N);return s!==void 0&&s===l}function m({htmlFor:s,label:l,help:n,error:c,scope:o,disabled:a,clearable:p,onClear:d,inlineControl:u,children:t}){const{t:i}=j("app"),r=k(s),g=e.jsxs("div",{className:"settings-field-row-control",children:[t,p&&e.jsx("button",{type:"button",className:"settings-field-row-clear","aria-label":i("settings.clearToDefault","Reset to default"),title:i("settings.clearToDefault","Reset to default"),disabled:a,onClick:d,children:e.jsx(E,{size:13,"aria-hidden":!0})})]}),f=e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"settings-field-row-label",htmlFor:s,children:l}),o&&e.jsx("span",{className:`settings-field-row-scope settings-field-row-scope--${o}`,"data-testid":"settings-field-row-scope",children:o}),n&&e.jsx(y,{settingKey:s,children:n})]});return e.jsxs("div",{className:`settings-field-row${u?" settings-field-row--inline":""}${a?" is-disabled":""}${r?" is-search-match":""}`,"data-settings-key":s,children:[e.jsxs("div",{className:"settings-field-row-head",children:[u&&g,e.jsx("div",{className:"settings-field-row-labelgroup",children:f})]}),!u&&g,c&&e.jsx("p",{className:"settings-field-row-error",role:"alert",children:c})]})}function P({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),inlineControl:!0,children:e.jsx("label",{className:"settings-toggle",children:e.jsx("input",{id:a,type:"checkbox",checked:l===!0,disabled:t,onChange:i=>n(i.target.checked)})})})}function $({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,options:i}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("select",{id:a,className:"select settings-select",value:l??"",disabled:t,onChange:r=>n(r.target.value),children:i.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})})}function H({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,min:i,max:r,step:g,placeholder:f}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("input",{id:a,className:"input settings-number",type:"number",value:l??"",min:i,max:r,step:g,placeholder:f,disabled:t,onChange:x=>{const v=x.target.value;if(v==="")return n(null);const w=Number(v);Number.isNaN(w)||n(w)}})})}function I({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,placeholder:i,type:r,autoComplete:g}=s,f=g??(r==="password"?"off":void 0);return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("input",{id:a,className:"input settings-text",type:r??"text",autoComplete:f,value:l??"",placeholder:i,disabled:t,onChange:x=>n(x.target.value)})})}function D({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,placeholder:i}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("textarea",{id:a,className:"input settings-textarea",value:l??"",placeholder:i,disabled:t,rows:3,onChange:r=>n(r.target.value)})})}export{m as S,I as a,D as b,$ as c,H as d,P as e,y as f,L as g};
1
+ import{r as h,j as e}from"./vendor-react-SZ_qB27O.js";import{u as j}from"./vendor-i18n-Duky4gdQ.js";import{dc as S,aR as E}from"./index-BjM7LxzY.js";const b="fusion:settings-help-open";function y({children:s,settingKey:l}){const{t:n}=j("app"),[c,o]=h.useState(!1),a=h.useRef(null),p=h.useId(),d=`settings-help-${l??p}`;h.useEffect(()=>{const t=i=>{i.detail!==d&&o(!1)};return document.addEventListener(b,t),()=>document.removeEventListener(b,t)},[d]);const u=()=>{o(t=>{const i=!t;return i&&document.dispatchEvent(new CustomEvent(b,{detail:d})),i})};return h.useEffect(()=>{if(!c)return;const t=r=>{a.current?.contains(r.target)||o(!1)},i=r=>{r.key==="Escape"&&(r.stopPropagation(),o(!1))};return document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",i,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",i,!0)}},[c]),e.jsxs("span",{className:"settings-help","data-open":c?"true":"false",ref:a,children:[e.jsx("button",{type:"button",className:"settings-help-trigger","aria-label":n("settings.help.show","Show help"),"aria-expanded":c,"aria-describedby":d,"data-testid":l?`settings-help-${l}`:void 0,onClick:u,children:e.jsx(S,{size:13,"aria-hidden":!0})}),e.jsx("span",{id:d,role:"note",className:"settings-help-bubble",children:s})]})}const N=h.createContext({highlightedKey:null});function L({highlightedKey:s,children:l}){const n=h.useMemo(()=>({highlightedKey:s}),[s]);return e.jsx(N.Provider,{value:n,children:l})}function k(s){const{highlightedKey:l}=h.useContext(N);return s!==void 0&&s===l}function m({htmlFor:s,label:l,help:n,error:c,scope:o,disabled:a,clearable:p,onClear:d,inlineControl:u,children:t}){const{t:i}=j("app"),r=k(s),g=e.jsxs("div",{className:"settings-field-row-control",children:[t,p&&e.jsx("button",{type:"button",className:"settings-field-row-clear","aria-label":i("settings.clearToDefault","Reset to default"),title:i("settings.clearToDefault","Reset to default"),disabled:a,onClick:d,children:e.jsx(E,{size:13,"aria-hidden":!0})})]}),f=e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"settings-field-row-label",htmlFor:s,children:l}),o&&e.jsx("span",{className:`settings-field-row-scope settings-field-row-scope--${o}`,"data-testid":"settings-field-row-scope",children:o}),n&&e.jsx(y,{settingKey:s,children:n})]});return e.jsxs("div",{className:`settings-field-row${u?" settings-field-row--inline":""}${a?" is-disabled":""}${r?" is-search-match":""}`,"data-settings-key":s,children:[e.jsxs("div",{className:"settings-field-row-head",children:[u&&g,e.jsx("div",{className:"settings-field-row-labelgroup",children:f})]}),!u&&g,c&&e.jsx("p",{className:"settings-field-row-error",role:"alert",children:c})]})}function P({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),inlineControl:!0,children:e.jsx("label",{className:"settings-toggle",children:e.jsx("input",{id:a,type:"checkbox",checked:l===!0,disabled:t,onChange:i=>n(i.target.checked)})})})}function $({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,options:i}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("select",{id:a,className:"select settings-select",value:l??"",disabled:t,onChange:r=>n(r.target.value),children:i.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})})}function H({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,min:i,max:r,step:g,placeholder:f}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("input",{id:a,className:"input settings-number",type:"number",value:l??"",min:i,max:r,step:g,placeholder:f,disabled:t,onChange:x=>{const v=x.target.value;if(v==="")return n(null);const w=Number(v);Number.isNaN(w)||n(w)}})})}function I({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,placeholder:i,type:r,autoComplete:g}=s,f=g??(r==="password"?"off":void 0);return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("input",{id:a,className:"input settings-text",type:r??"text",autoComplete:f,value:l??"",placeholder:i,disabled:t,onChange:x=>n(x.target.value)})})}function D({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,placeholder:i}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("textarea",{id:a,className:"input settings-textarea",value:l??"",placeholder:i,disabled:t,rows:3,onChange:r=>n(r.target.value)})})}export{m as S,I as a,D as b,$ as c,H as d,P as e,y as f,L as g};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalAgentOnboardingModal-DEcFgONi.js","assets/vendor-react-SZ_qB27O.js","assets/index-CBFPgFTp.js","assets/vendor-i18n-Duky4gdQ.js","assets/vendor-codemirror-CcrtqoCy.js","assets/vendor-reactflow-BlIeoTu4.js","assets/vendor-reactflow-BnuhLJ6X.css","assets/vendor-xterm-BNq00GSj.js","assets/vendor-xterm-LZoznX6r.css","assets/index-BJc-A7eB.css","assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css"])))=>i.map(i=>d[i]);
2
- import{W as le,B as x,Y as I,_ as U,$ as ce,a0 as de,a1 as pe,a2 as ue,a3 as me,a4 as ge,a5 as he,a6 as xe,F as je,X as fe,L as R,g as we,a7 as W,S as Ne,a8 as L,a9 as ye,aa as be}from"./index-CBFPgFTp.js";import{r as o,j as e}from"./vendor-react-SZ_qB27O.js";import{D as ke}from"./DirectoryPicker-VOx91hQt.js";import{s as A}from"./projectDetection-G3XuxD2X.js";import{u as Ce}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";import"./vendor-xterm-BNq00GSj.js";import"./folder-open-nMraSDXu.js";function H(c){return c.filter(d=>d.type!=="local")}function ze(c){return H(c).length>0}function D(c){const d=c.replace(/[^a-zA-Z]/g,"").toUpperCase();return d.length>=2&&d.length<=4?d:d.length>4?d.slice(0,4):"FN"}const Pe=o.lazy(()=>be(()=>import("./ExperimentalAgentOnboardingModal-DEcFgONi.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(c=>({default:c.ExperimentalAgentOnboardingModal})));function Te({onProjectRegistered:c,onClose:d,agentOnboardingEnabled:M=!1,includeAgentStep:j=!0}){const{t:s}=Ce("app"),{confirmWithChoice:S}=le(),O="https://discord.gg/ksrfuy7WYR",y=o.useMemo(()=>I("ceo")??x[0],[]),[G,_]=o.useState(!0),[t,r]=o.useState(()=>({step:"manual",manualMode:"existing",manualPath:"",manualCloneUrl:"",manualName:"",manualIsolationMode:"in-process",manualNodeId:"",manualTaskPrefix:"",detectedRepos:[],workspaceMode:!1,isDetectingWorkspace:!1,registeredProject:null,selectedPresetId:y.id,agentDraft:U(y),isCreatingAgent:!1,isRegistering:!1,error:null,agentError:null,agentOutcome:null})),[F,B]=o.useState(!1),[E,b]=o.useState(!1),T=o.useRef(null),{nodes:k,loading:$}=ce(),Y=k.find(a=>a.type==="local")?.id,C=o.useCallback(()=>{_(!1),d?.()},[d]),q=o.useCallback(()=>{if(t.registeredProject){c(t.registeredProject);return}C()},[C,c,t.registeredProject]);o.useEffect(()=>{t.agentError&&T.current?.focus()},[t.agentError]);const f=o.useRef(0),w=o.useRef(!1),K=o.useCallback(a=>{if(r(i=>{const n={manualPath:a,detectedRepos:[],workspaceMode:!1,error:null};a&&(!i.manualName||i.manualName===A(i.manualPath))&&(n.manualName=A(a));const p=n.manualName??i.manualName;return p&&(!i.manualTaskPrefix||i.manualTaskPrefix===D(A(i.manualPath)))&&(n.manualTaskPrefix=D(p)),{...i,...n}}),t.manualMode==="existing"&&a.trim()&&a.trim()!=="/"){const i=++f.current;r(n=>({...n,isDetectingWorkspace:!0})),de(a.trim()).then(n=>{i===f.current&&r(p=>({...p,isDetectingWorkspace:!1,detectedRepos:n.repos,workspaceMode:n.isWorkspace}))}).catch(()=>{i===f.current&&r(n=>({...n,isDetectingWorkspace:!1}))})}},[t.manualMode]),z=o.useCallback(a=>{r(i=>({...i,manualMode:a,manualCloneUrl:a==="clone"?i.manualCloneUrl:"",detectedRepos:a==="existing"?i.detectedRepos:[],workspaceMode:a==="existing"?i.workspaceMode:!1,isDetectingWorkspace:!1,error:null})),f.current+=1},[]),V=o.useCallback(async()=>{const a=t.manualPath.trim(),i=t.manualName.trim(),n=t.manualCloneUrl.trim();if(!a||!i||t.manualMode==="clone"&&!n||w.current||t.isRegistering)return;w.current=!0,r(l=>({...l,isRegistering:!0,error:null}));const p=()=>{w.current=!1,r(l=>({...l,isRegistering:!1}))};try{const{gitCli:l}=await pe();if(l&&!l.available){await S({title:s("setup.gitMissingTitle","Git is not installed"),message:s("setup.gitMissingMessage","Git was not found on the Fusion host. Install Git, then try again — Fusion projects need Git so agents can create task worktrees."),confirmLabel:s("setup.gitMissingOpenDownloads","Open Git downloads"),cancelLabel:s("setup.cancel","Cancel"),alwaysAsk:!0})==="primary"&&ue(l.installUrl??"https://git-scm.com/downloads"),p();return}}catch{}try{const l={name:i,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},m=await me(l);if(!j){r(h=>({...h,isRegistering:!1})),c(m);return}r(h=>({...h,step:"agent",registeredProject:m,isRegistering:!1}))}catch(l){r(m=>({...m,isRegistering:!1,error:l instanceof Error?l.message:"Failed to register project"}))}finally{w.current=!1}},[j,c,t.manualPath,t.manualName,t.manualCloneUrl,t.manualMode,t.manualIsolationMode,t.manualNodeId,t.workspaceMode,t.manualTaskPrefix,S,s]),P=o.useCallback(a=>{const i=I(a);i&&r(n=>({...n,selectedPresetId:i.id,agentDraft:U(i),agentError:null}))},[]),Z=o.useCallback((a,i)=>{const n=x.findIndex(h=>h.id===i);if(n<0)return;const p=x.length-1;let l=null;if(a.key==="ArrowDown"||a.key==="ArrowRight"?l=n===p?0:n+1:a.key==="ArrowUp"||a.key==="ArrowLeft"?l=n===0?p:n-1:a.key==="Home"?l=0:a.key==="End"&&(l=p),l===null)return;a.preventDefault();const m=x[l];P(m.id),requestAnimationFrame(()=>{document.querySelector(`[data-agent-preset-id="${m.id}"]`)?.focus()})},[P]),X=o.useCallback(a=>{r(i=>({...i,selectedPresetId:"",agentDraft:ge(a),agentError:null}))},[]),J=o.useCallback(async()=>{if(!(!t.registeredProject||!t.agentDraft.name.trim())){r(a=>({...a,isCreatingAgent:!0,agentError:null}));try{await he(xe(t.agentDraft),t.registeredProject.id),r(a=>({...a,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}))}catch(a){if(a instanceof Error&&/already exists/i.test(a.message)){r(i=>({...i,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}));return}r(i=>({...i,isCreatingAgent:!1,agentError:a instanceof Error?a.message:s("setup.firstAgentCreateError","Failed to create agent")}))}}},[t.agentDraft,t.registeredProject,s]),Q=o.useCallback(()=>{r(a=>({...a,step:"complete",agentError:null,agentOutcome:"skipped"}))},[]);if(!G)return null;const v=t.manualMode==="existing",g=t.manualMode==="init",u=t.manualMode==="clone",ee=u?s("setup.cloneAndRegisterProject","Clone and Register Project"):g?s("setup.initializeAndRegisterProject","Initialize and Register Project"):s("setup.registerProject","Register Project"),te=t.manualPath.trim().length>0,se=t.manualName.trim().length>0,ae=t.manualCloneUrl.trim().length>0,ie=t.isRegistering||!te||!se||u&&!ae,re=t.selectedPresetId?I(t.selectedPresetId):void 0,N=t.isCreatingAgent,ne=t.selectedPresetId||y.id,oe=`modal setup-wizard-modal${t.step==="agent"?" setup-wizard-modal--agent":""}`;return e.jsxs(je,{windowKey:"setup-wizard",modal:!0,title:s("setup.welcomeToFusion","Welcome to Fusion"),ariaLabelledBy:"wizard-title",onClose:()=>{},hideHeader:!0,dragHandleSelector:".setup-wizard-modal .setup-wizard-header",className:"floating-window--setup-wizard",defaultSize:{width:760,height:680},minSize:{width:480,height:360},persistGeometryKey:"floating-window:setup-wizard",suspendGeometryPersistenceOnMobile:!0,suspendGeometryPersistenceOnShortViewport:!0,children:[e.jsxs("div",{className:oe,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")})]}),!j&&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"&&(j?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:C,"aria-label":s("setup.closeWizard","Close wizard"),children:e.jsx(fe,{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${v?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"existing","aria-label":s("setup.useExistingDirectory","Use Existing Directory"),checked:v,onChange:()=>z("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${g?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"init","aria-label":s("setup.initializeNewRepository","Initialize New Repository"),checked:g,onChange:()=>z("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:()=>z("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"):g?s("setup.newRepositoryDirectory","New Repository Directory"):s("setup.projectDirectory","Project Directory")}),e.jsx(ke,{value:t.manualPath,onChange:K,nodeId:t.manualNodeId||void 0,localNodeId:Y,selectCreatedDirectory:!0,placeholder:u?s("setup.clonePathPlaceholder","/path/for/new-clone"):g?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."):g?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=>r(i=>({...i,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."):g?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=>r(i=>({...i,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.")})]}),v&&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=>r(i=>({...i,workspaceMode:a.target.checked}))}),s("setup.workspaceMode","Workspace mode (multi-repo)")]}),t.isDetectingWorkspace&&e.jsxs("p",{className:"form-hint",children:[e.jsx(R,{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=>r(i=>({...i,manualTaskPrefix:a.target.value.toUpperCase()})),placeholder:D(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":F,onClick:()=>B(a=>!a),children:[e.jsx(we,{size:16,className:"setup-wizard-advanced-chevron"}),e.jsx("span",{children:s("setup.advancedSettings","Advanced settings")})]}),F&&e.jsxs("div",{className:"setup-wizard-advanced-panel",children:[ze(k)&&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=>r(i=>({...i,manualNodeId:a.target.value})),disabled:$||t.isRegistering,children:[e.jsx("option",{value:"",children:s("setup.localNode","Local node")}),H(k).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:()=>r(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:()=>r(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:x.map(a=>{const i=t.selectedPresetId===a.id;return e.jsxs("button",{type:"button",className:`setup-wizard-agent-preset${i?" selected":""}`,role:"radio","aria-checked":i,"aria-label":i?s("setup.selectedAgentTemplate","{{name}} selected",{name:a.name}):a.name,tabIndex:a.id===ne?0:-1,"data-agent-preset-id":a.id,disabled:N,onClick:()=>P(a.id),onKeyDown:n=>Z(n,a.id),children:[e.jsx(W,{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(W,{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||re?.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")})]})]}),M&&e.jsxs("button",{type:"button",className:"btn setup-wizard-agent-ai-btn",onClick:()=>b(!0),disabled:N,children:[e.jsx(Ne,{size:16}),e.jsx("span",{children:s("agents.aiInterview","AI Interview")})]})]})]})]}),t.agentError&&e.jsx("div",{className:"wizard-error",role:"alert",tabIndex:-1,ref:T,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(L,{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:O,target:"_blank",rel:"noopener noreferrer",children:s("setup.needHelp","Need help?")}),t.step==="manual"&&e.jsx("button",{className:"btn btn-primary",onClick:V,disabled:ie,children:t.isRegistering?e.jsxs(e.Fragment,{children:[e.jsx(R,{size:16,className:"animate-spin"}),e.jsx("span",{children:s("setup.registering","Registering...")})]}):e.jsx("span",{children:ee})}),t.step==="agent"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:Q,disabled:N,children:s("setup.skipFirstAgent","Skip for now")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void J(),disabled:N||!t.agentDraft.name.trim(),"aria-busy":t.isCreatingAgent,children:t.isCreatingAgent?e.jsxs(e.Fragment,{children:[e.jsx(R,{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:q,children:[e.jsx(L,{size:16}),e.jsx("span",{children:s("setup.getStarted","Get Started")})]})]})]}),M&&E&&e.jsx(ye,{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:()=>b(!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(Pe,{isOpen:E,onClose:()=>b(!1),onUseDraft:X,projectId:t.registeredProject?.id,existingAgents:[],mode:"create"})})})]})}export{Te as SetupWizardModal};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalAgentOnboardingModal-Bmzbqzhs.js","assets/vendor-react-SZ_qB27O.js","assets/index-BjM7LxzY.js","assets/vendor-i18n-Duky4gdQ.js","assets/vendor-codemirror-CcrtqoCy.js","assets/vendor-reactflow-BlIeoTu4.js","assets/vendor-reactflow-BnuhLJ6X.css","assets/vendor-xterm-BNq00GSj.js","assets/vendor-xterm-LZoznX6r.css","assets/index-DcKIzuMk.css","assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css"])))=>i.map(i=>d[i]);
2
+ import{W as le,B as x,Y as I,_ as U,$ as ce,a0 as de,a1 as pe,a2 as ue,a3 as me,a4 as ge,a5 as he,a6 as xe,F as je,X as fe,L as R,g as we,a7 as W,S as Ne,a8 as L,a9 as ye,aa as be}from"./index-BjM7LxzY.js";import{r as o,j as e}from"./vendor-react-SZ_qB27O.js";import{D as ke}from"./DirectoryPicker-Cw-XRjAa.js";import{s as A}from"./projectDetection-G3XuxD2X.js";import{u as Ce}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";import"./vendor-xterm-BNq00GSj.js";import"./folder-open-Cf2NA9nV.js";function H(c){return c.filter(d=>d.type!=="local")}function ze(c){return H(c).length>0}function D(c){const d=c.replace(/[^a-zA-Z]/g,"").toUpperCase();return d.length>=2&&d.length<=4?d:d.length>4?d.slice(0,4):"FN"}const Pe=o.lazy(()=>be(()=>import("./ExperimentalAgentOnboardingModal-Bmzbqzhs.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(c=>({default:c.ExperimentalAgentOnboardingModal})));function Te({onProjectRegistered:c,onClose:d,agentOnboardingEnabled:M=!1,includeAgentStep:j=!0}){const{t:s}=Ce("app"),{confirmWithChoice:S}=le(),O="https://discord.gg/ksrfuy7WYR",y=o.useMemo(()=>I("ceo")??x[0],[]),[G,_]=o.useState(!0),[t,r]=o.useState(()=>({step:"manual",manualMode:"existing",manualPath:"",manualCloneUrl:"",manualName:"",manualIsolationMode:"in-process",manualNodeId:"",manualTaskPrefix:"",detectedRepos:[],workspaceMode:!1,isDetectingWorkspace:!1,registeredProject:null,selectedPresetId:y.id,agentDraft:U(y),isCreatingAgent:!1,isRegistering:!1,error:null,agentError:null,agentOutcome:null})),[F,B]=o.useState(!1),[E,b]=o.useState(!1),T=o.useRef(null),{nodes:k,loading:$}=ce(),Y=k.find(a=>a.type==="local")?.id,C=o.useCallback(()=>{_(!1),d?.()},[d]),q=o.useCallback(()=>{if(t.registeredProject){c(t.registeredProject);return}C()},[C,c,t.registeredProject]);o.useEffect(()=>{t.agentError&&T.current?.focus()},[t.agentError]);const f=o.useRef(0),w=o.useRef(!1),K=o.useCallback(a=>{if(r(i=>{const n={manualPath:a,detectedRepos:[],workspaceMode:!1,error:null};a&&(!i.manualName||i.manualName===A(i.manualPath))&&(n.manualName=A(a));const p=n.manualName??i.manualName;return p&&(!i.manualTaskPrefix||i.manualTaskPrefix===D(A(i.manualPath)))&&(n.manualTaskPrefix=D(p)),{...i,...n}}),t.manualMode==="existing"&&a.trim()&&a.trim()!=="/"){const i=++f.current;r(n=>({...n,isDetectingWorkspace:!0})),de(a.trim()).then(n=>{i===f.current&&r(p=>({...p,isDetectingWorkspace:!1,detectedRepos:n.repos,workspaceMode:n.isWorkspace}))}).catch(()=>{i===f.current&&r(n=>({...n,isDetectingWorkspace:!1}))})}},[t.manualMode]),z=o.useCallback(a=>{r(i=>({...i,manualMode:a,manualCloneUrl:a==="clone"?i.manualCloneUrl:"",detectedRepos:a==="existing"?i.detectedRepos:[],workspaceMode:a==="existing"?i.workspaceMode:!1,isDetectingWorkspace:!1,error:null})),f.current+=1},[]),V=o.useCallback(async()=>{const a=t.manualPath.trim(),i=t.manualName.trim(),n=t.manualCloneUrl.trim();if(!a||!i||t.manualMode==="clone"&&!n||w.current||t.isRegistering)return;w.current=!0,r(l=>({...l,isRegistering:!0,error:null}));const p=()=>{w.current=!1,r(l=>({...l,isRegistering:!1}))};try{const{gitCli:l}=await pe();if(l&&!l.available){await S({title:s("setup.gitMissingTitle","Git is not installed"),message:s("setup.gitMissingMessage","Git was not found on the Fusion host. Install Git, then try again — Fusion projects need Git so agents can create task worktrees."),confirmLabel:s("setup.gitMissingOpenDownloads","Open Git downloads"),cancelLabel:s("setup.cancel","Cancel"),alwaysAsk:!0})==="primary"&&ue(l.installUrl??"https://git-scm.com/downloads"),p();return}}catch{}try{const l={name:i,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},m=await me(l);if(!j){r(h=>({...h,isRegistering:!1})),c(m);return}r(h=>({...h,step:"agent",registeredProject:m,isRegistering:!1}))}catch(l){r(m=>({...m,isRegistering:!1,error:l instanceof Error?l.message:"Failed to register project"}))}finally{w.current=!1}},[j,c,t.manualPath,t.manualName,t.manualCloneUrl,t.manualMode,t.manualIsolationMode,t.manualNodeId,t.workspaceMode,t.manualTaskPrefix,S,s]),P=o.useCallback(a=>{const i=I(a);i&&r(n=>({...n,selectedPresetId:i.id,agentDraft:U(i),agentError:null}))},[]),Z=o.useCallback((a,i)=>{const n=x.findIndex(h=>h.id===i);if(n<0)return;const p=x.length-1;let l=null;if(a.key==="ArrowDown"||a.key==="ArrowRight"?l=n===p?0:n+1:a.key==="ArrowUp"||a.key==="ArrowLeft"?l=n===0?p:n-1:a.key==="Home"?l=0:a.key==="End"&&(l=p),l===null)return;a.preventDefault();const m=x[l];P(m.id),requestAnimationFrame(()=>{document.querySelector(`[data-agent-preset-id="${m.id}"]`)?.focus()})},[P]),X=o.useCallback(a=>{r(i=>({...i,selectedPresetId:"",agentDraft:ge(a),agentError:null}))},[]),J=o.useCallback(async()=>{if(!(!t.registeredProject||!t.agentDraft.name.trim())){r(a=>({...a,isCreatingAgent:!0,agentError:null}));try{await he(xe(t.agentDraft),t.registeredProject.id),r(a=>({...a,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}))}catch(a){if(a instanceof Error&&/already exists/i.test(a.message)){r(i=>({...i,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}));return}r(i=>({...i,isCreatingAgent:!1,agentError:a instanceof Error?a.message:s("setup.firstAgentCreateError","Failed to create agent")}))}}},[t.agentDraft,t.registeredProject,s]),Q=o.useCallback(()=>{r(a=>({...a,step:"complete",agentError:null,agentOutcome:"skipped"}))},[]);if(!G)return null;const v=t.manualMode==="existing",g=t.manualMode==="init",u=t.manualMode==="clone",ee=u?s("setup.cloneAndRegisterProject","Clone and Register Project"):g?s("setup.initializeAndRegisterProject","Initialize and Register Project"):s("setup.registerProject","Register Project"),te=t.manualPath.trim().length>0,se=t.manualName.trim().length>0,ae=t.manualCloneUrl.trim().length>0,ie=t.isRegistering||!te||!se||u&&!ae,re=t.selectedPresetId?I(t.selectedPresetId):void 0,N=t.isCreatingAgent,ne=t.selectedPresetId||y.id,oe=`modal setup-wizard-modal${t.step==="agent"?" setup-wizard-modal--agent":""}`;return e.jsxs(je,{windowKey:"setup-wizard",modal:!0,title:s("setup.welcomeToFusion","Welcome to Fusion"),ariaLabelledBy:"wizard-title",onClose:()=>{},hideHeader:!0,dragHandleSelector:".setup-wizard-modal .setup-wizard-header",className:"floating-window--setup-wizard",defaultSize:{width:760,height:680},minSize:{width:480,height:360},persistGeometryKey:"floating-window:setup-wizard",suspendGeometryPersistenceOnMobile:!0,suspendGeometryPersistenceOnShortViewport:!0,children:[e.jsxs("div",{className:oe,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")})]}),!j&&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"&&(j?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:C,"aria-label":s("setup.closeWizard","Close wizard"),children:e.jsx(fe,{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${v?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"existing","aria-label":s("setup.useExistingDirectory","Use Existing Directory"),checked:v,onChange:()=>z("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${g?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"init","aria-label":s("setup.initializeNewRepository","Initialize New Repository"),checked:g,onChange:()=>z("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:()=>z("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"):g?s("setup.newRepositoryDirectory","New Repository Directory"):s("setup.projectDirectory","Project Directory")}),e.jsx(ke,{value:t.manualPath,onChange:K,nodeId:t.manualNodeId||void 0,localNodeId:Y,selectCreatedDirectory:!0,placeholder:u?s("setup.clonePathPlaceholder","/path/for/new-clone"):g?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."):g?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=>r(i=>({...i,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."):g?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=>r(i=>({...i,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.")})]}),v&&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=>r(i=>({...i,workspaceMode:a.target.checked}))}),s("setup.workspaceMode","Workspace mode (multi-repo)")]}),t.isDetectingWorkspace&&e.jsxs("p",{className:"form-hint",children:[e.jsx(R,{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=>r(i=>({...i,manualTaskPrefix:a.target.value.toUpperCase()})),placeholder:D(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":F,onClick:()=>B(a=>!a),children:[e.jsx(we,{size:16,className:"setup-wizard-advanced-chevron"}),e.jsx("span",{children:s("setup.advancedSettings","Advanced settings")})]}),F&&e.jsxs("div",{className:"setup-wizard-advanced-panel",children:[ze(k)&&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=>r(i=>({...i,manualNodeId:a.target.value})),disabled:$||t.isRegistering,children:[e.jsx("option",{value:"",children:s("setup.localNode","Local node")}),H(k).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:()=>r(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:()=>r(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:x.map(a=>{const i=t.selectedPresetId===a.id;return e.jsxs("button",{type:"button",className:`setup-wizard-agent-preset${i?" selected":""}`,role:"radio","aria-checked":i,"aria-label":i?s("setup.selectedAgentTemplate","{{name}} selected",{name:a.name}):a.name,tabIndex:a.id===ne?0:-1,"data-agent-preset-id":a.id,disabled:N,onClick:()=>P(a.id),onKeyDown:n=>Z(n,a.id),children:[e.jsx(W,{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(W,{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||re?.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")})]})]}),M&&e.jsxs("button",{type:"button",className:"btn setup-wizard-agent-ai-btn",onClick:()=>b(!0),disabled:N,children:[e.jsx(Ne,{size:16}),e.jsx("span",{children:s("agents.aiInterview","AI Interview")})]})]})]})]}),t.agentError&&e.jsx("div",{className:"wizard-error",role:"alert",tabIndex:-1,ref:T,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(L,{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:O,target:"_blank",rel:"noopener noreferrer",children:s("setup.needHelp","Need help?")}),t.step==="manual"&&e.jsx("button",{className:"btn btn-primary",onClick:V,disabled:ie,children:t.isRegistering?e.jsxs(e.Fragment,{children:[e.jsx(R,{size:16,className:"animate-spin"}),e.jsx("span",{children:s("setup.registering","Registering...")})]}):e.jsx("span",{children:ee})}),t.step==="agent"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:Q,disabled:N,children:s("setup.skipFirstAgent","Skip for now")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void J(),disabled:N||!t.agentDraft.name.trim(),"aria-busy":t.isCreatingAgent,children:t.isCreatingAgent?e.jsxs(e.Fragment,{children:[e.jsx(R,{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:q,children:[e.jsx(L,{size:16}),e.jsx("span",{children:s("setup.getStarted","Get Started")})]})]})]}),M&&E&&e.jsx(ye,{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:()=>b(!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(Pe,{isOpen:E,onClose:()=>b(!1),onUseDraft:X,projectId:t.registeredProject?.id,existingAgents:[],mode:"create"})})})]})}export{Te as SetupWizardModal};
@@ -1 +1 @@
1
- import{r as a,j as s}from"./vendor-react-SZ_qB27O.js";import{f as ms,b as us,t as vs,i as hs,d as gs,e as bs,V as ws,Z as xs,X as H,R as fs,C as js,g as ps,L as A,A as q,h as G,M as J}from"./index-CBFPgFTp.js";import{u as Ns}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.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,b as us,t as vs,i as hs,d as gs,e as bs,V as ws,Z as xs,X as H,R as fs,C as js,g as ps,L as A,A as q,h as G,M as J}from"./index-BjM7LxzY.js";import{u as Ns}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.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 a,j as e,b as ei}from"./vendor-react-SZ_qB27O.js";import{R as Bn,d as Gn,B as qn,e as ti,C as Vn,P as oi,g as si,f as ni,E as ai,H as it,h as lt,u as Hn,j as ii,k as li,l as ri,m as di,M as ci}from"./vendor-reactflow-BlIeoTu4.js";import{c as ui,dI as pi,dJ as Xt,dK as Vo,dL as ke,dM as Kn,dN as fi,dO as mi,dP as oo,dQ as Et,dR as At,dS as rt,dT as Pt,dU as Ye,dV as Un,dW as Yn,dX as Jn,dY as Xn,dZ as Qn,d_ as wi,P as je,d$ as Zn,dc as Xo,e0 as ea,e1 as ta,bP as Qo,e2 as oa,e3 as Zo,e4 as Ft,e5 as sa,e6 as na,e7 as aa,aS as ia,b6 as es,e8 as la,aT as ts,e9 as hi,bJ as gi,aP as Te,ea as ki,eb as ra,F as da,X as os,au as bi,ec as ca,bz as le,bG as Qt,bT as xi,U as vi,C as Me,x as Se,ed as Ni,cf as Zt,ee as Vs,cC as ua,ef as eo,av as ji,g as We,aR as yi,ck as Ho,v as Ci,eg as Si,eh as Ii,bQ as Hs,ei as Ei,ej as Ai,dw as Pi,ek as Ks,W as Fi,el as Ko,em as Mi,en as Ri,eo as Oi,ep as Li,eq as Ti,er as Di,b5 as zi,es as $i,et as Wi,eu as Us,ev as Ys,ew as Js,ex as Xs,ey as Qs,ez as _i,eA as Bi,eB as Gi,eC as qi,eD as Zs,eE as Vi,eF as en,eG as tn,eH as on,eI as Hi,eJ as Mo,eK as Ki,eL as sn,eM as nn,eN as Ui,f as an,aL as Yi,d2 as ln,eO as Ro,bI as rn,L as Fe,eP as Je,eQ as Oo,eR as Lo,aG as Jt,S as _e,eS as Ji,d3 as dn,eT as cn,eU as Xi,d9 as Qi,eV as Zi,eW as el}from"./index-CBFPgFTp.js";import{u as be}from"./vendor-i18n-Duky4gdQ.js";import{P as To}from"./puzzle-DwhHOf32.js";import{S as tl,a as ol,b as sl,c as un,d as nl,e as al}from"./SettingsTextareaRow-B0rTuelr.js";import{U as il}from"./upload-BS96H1o7.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-xterm-BNq00GSj.js";/**
1
+ import{r as a,j as e,b as ei}from"./vendor-react-SZ_qB27O.js";import{R as Bn,d as Gn,B as qn,e as ti,C as Vn,P as oi,g as si,f as ni,E as ai,H as it,h as lt,u as Hn,j as ii,k as li,l as ri,m as di,M as ci}from"./vendor-reactflow-BlIeoTu4.js";import{c as ui,dI as pi,dJ as Xt,dK as Vo,dL as ke,dM as Kn,dN as fi,dO as mi,dP as oo,dQ as Et,dR as At,dS as rt,dT as Pt,dU as Ye,dV as Un,dW as Yn,dX as Jn,dY as Xn,dZ as Qn,d_ as wi,P as je,d$ as Zn,dc as Xo,e0 as ea,e1 as ta,bP as Qo,e2 as oa,e3 as Zo,e4 as Ft,e5 as sa,e6 as na,e7 as aa,aS as ia,b6 as es,e8 as la,aT as ts,e9 as hi,bJ as gi,aP as Te,ea as ki,eb as ra,F as da,X as os,au as bi,ec as ca,bz as le,bG as Qt,bT as xi,U as vi,C as Me,x as Se,ed as Ni,cf as Zt,ee as Vs,cC as ua,ef as eo,av as ji,g as We,aR as yi,ck as Ho,v as Ci,eg as Si,eh as Ii,bQ as Hs,ei as Ei,ej as Ai,dw as Pi,ek as Ks,W as Fi,el as Ko,em as Mi,en as Ri,eo as Oi,ep as Li,eq as Ti,er as Di,b5 as zi,es as $i,et as Wi,eu as Us,ev as Ys,ew as Js,ex as Xs,ey as Qs,ez as _i,eA as Bi,eB as Gi,eC as qi,eD as Zs,eE as Vi,eF as en,eG as tn,eH as on,eI as Hi,eJ as Mo,eK as Ki,eL as sn,eM as nn,eN as Ui,f as an,aL as Yi,d2 as ln,eO as Ro,bI as rn,L as Fe,eP as Je,eQ as Oo,eR as Lo,aG as Jt,S as _e,eS as Ji,d3 as dn,eT as cn,eU as Xi,d9 as Qi,eV as Zi,eW as el}from"./index-BjM7LxzY.js";import{u as be}from"./vendor-i18n-Duky4gdQ.js";import{P as To}from"./puzzle-D00mP67o.js";import{S as tl,a as ol,b as sl,c as un,d as nl,e as al}from"./SettingsTextareaRow-CLab4Vcd.js";import{U as il}from"./upload-D4pkNOz2.js";import"./vendor-codemirror-CcrtqoCy.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{a as n,w as o}from"./index-CBFPgFTp.js";function c(){return n("/agents/companies")}function i(e,t){return n(o("/agents/generate/start",t),{method:"POST",body:JSON.stringify({role:e})})}function u(e,t){return n(o("/agents/generate/spec",t),{method:"POST",body:JSON.stringify({sessionId:e})})}function g(e,t){return n(o(`/agents/generate/${encodeURIComponent(e)}`,t),{method:"DELETE"})}function p(e){return n(o("/backups",e))}function f(e){return n(o("/backups",e),{method:"POST"})}function m(e,t){const r=o("/settings/export",t),s=`${r}${r.includes("?")?"&":"?"}scope=${encodeURIComponent(e)}`;return n(s)}function d(e,t,r){return n(o("/settings/import",r),{method:"POST",body:JSON.stringify({data:e,scope:t?.scope??"both",merge:t?.merge??!0})})}export{p as a,f as b,g as c,m as e,c as f,u as g,d as i,i as s};
1
+ import{a as n,w as o}from"./index-BjM7LxzY.js";function c(){return n("/agents/companies")}function i(e,t){return n(o("/agents/generate/start",t),{method:"POST",body:JSON.stringify({role:e})})}function u(e,t){return n(o("/agents/generate/spec",t),{method:"POST",body:JSON.stringify({sessionId:e})})}function g(e,t){return n(o(`/agents/generate/${encodeURIComponent(e)}`,t),{method:"DELETE"})}function p(e){return n(o("/backups",e))}function f(e){return n(o("/backups",e),{method:"POST"})}function m(e,t){const r=o("/settings/export",t),s=`${r}${r.includes("?")?"&":"?"}scope=${encodeURIComponent(e)}`;return n(s)}function d(e,t,r){return n(o("/settings/import",r),{method:"POST",body:JSON.stringify({data:e,scope:t?.scope??"both",merge:t?.merge??!0})})}export{p as a,f as b,g as c,m as e,c as f,u as g,d as i,i as s};
@@ -1 +1 @@
1
- import{a as p,aN as m}from"./index-CBFPgFTp.js";async function M(t={},e){const n=new URLSearchParams(Object.entries(t).filter(r=>r[1]!==void 0).map(([r,o])=>[r,String(o)]));return p(`/agent-activity${n.size?`?${n}`:""}`,e)}const l=3e4,v=1e4,g={"task:started":"in-flight","task:handed-off":"delegation","task:completed":"terminal","agent:state-changed":"ignored","workflow:gate-passed":"terminal","workflow:gate-failed":"terminal","approval:requested":"in-flight"},O=new Set(["agent:state-changed"]);function L(t){return O.has(t)}function s(t){if(typeof t!="string")return null;const e=Date.parse(t);return Number.isFinite(e)?e:null}function y(t,e){const n=s(t.occurredAt),r=s(e.occurredAt);return n!==null&&r!==null&&n!==r?r-n:n===null&&r!==null?1:n!==null&&r===null?-1:t.eventId<e.eventId?1:t.eventId>e.eventId?-1:0}function f(t,e){return`${t}\0${e}`}function D(t,e){const n=s(t.occurredAt);return{...t,activityWindowOccurredAt:n===null?void 0:Math.min(n,e)}}function A(t,e){const n=s(t.occurredAt);if(n===null)return null;const r=typeof t.activityWindowOccurredAt=="number"?t.activityWindowOccurredAt:Math.min(n,e);return Math.max(0,e-r)}function T(t,e){return m(t,1,e).label==="Unresponsive"}function G(t,e,n,r){if(t.state==="error"||(r?.label??(T(t,n)?"Unresponsive":""))==="Unresponsive")return"error";if(t.state==="running")return"active";if(!e)return"unknown";const o=g[e.type],i=A(e,n);return i===null?"unknown":o==="terminal"?"idle":o==="in-flight"?i<l?"active":"idle":i>=l?"idle":"unknown"}function h(t,e){return e.fromAgentId===t.parentId&&e.toAgentId===t.childId?"down":e.fromAgentId===t.childId&&e.toAgentId===t.parentId?"up":null}function C(t,e,n){const r=new Map,o=new Map;for(const i of e){if(g[i.type]!=="delegation")continue;const a=A(i,n);if(!(a===null||a>=v))for(const c of t){if(!h(c,i))continue;const u=f(c.parentId,c.childId),d=o.get(u);(!d||y(i,d)<0)&&o.set(u,i)}}for(const i of t){const a=f(i.parentId,i.childId),c=o.get(a);r.set(a,c?h(i,c):null)}return r}const k="fn-agent-org-chart-layout";function P(t){return t==="auto"||t==="horizontal"||t==="vertical"}const W=768,_={nodeWidth:220,siblingGap:24,rootGap:24,chartPadding:24},E={nodeWidth:160,siblingGap:8,rootGap:8,chartPadding:8};function I(t){return t.children.length===0?1:t.children.reduce((e,n)=>e+I(n),0)}function w(t){return t<=W?E:_}function S(t,e){const n=I(t);return n*e.nodeWidth+Math.max(0,n-1)*e.siblingGap}function N(t,e=Number.POSITIVE_INFINITY){const n=w(e);if(t.length===0)return n.nodeWidth;const o=t.map(a=>S(a,n)).reduce((a,c)=>a+c,0),i=Math.max(0,t.length-1)*n.rootGap;return o+i+n.chartPadding*2}function F(t){const e=t.preference??"auto";if(e!=="auto")return e;const n=Number.isFinite(t.availableWidth)&&t.availableWidth>0?t.availableWidth:0;return n===0||t.tree.length<=1?"horizontal":N(t.tree,n)>n?"vertical":"horizontal"}export{l as A,v as F,k as O,A as a,P as b,y as c,G as d,C as e,M as g,L as i,f as o,s as p,F as r,D as w};
1
+ import{a as p,aN as m}from"./index-BjM7LxzY.js";async function M(t={},e){const n=new URLSearchParams(Object.entries(t).filter(r=>r[1]!==void 0).map(([r,o])=>[r,String(o)]));return p(`/agent-activity${n.size?`?${n}`:""}`,e)}const l=3e4,v=1e4,g={"task:started":"in-flight","task:handed-off":"delegation","task:completed":"terminal","agent:state-changed":"ignored","workflow:gate-passed":"terminal","workflow:gate-failed":"terminal","approval:requested":"in-flight"},O=new Set(["agent:state-changed"]);function L(t){return O.has(t)}function s(t){if(typeof t!="string")return null;const e=Date.parse(t);return Number.isFinite(e)?e:null}function y(t,e){const n=s(t.occurredAt),r=s(e.occurredAt);return n!==null&&r!==null&&n!==r?r-n:n===null&&r!==null?1:n!==null&&r===null?-1:t.eventId<e.eventId?1:t.eventId>e.eventId?-1:0}function f(t,e){return`${t}\0${e}`}function D(t,e){const n=s(t.occurredAt);return{...t,activityWindowOccurredAt:n===null?void 0:Math.min(n,e)}}function A(t,e){const n=s(t.occurredAt);if(n===null)return null;const r=typeof t.activityWindowOccurredAt=="number"?t.activityWindowOccurredAt:Math.min(n,e);return Math.max(0,e-r)}function T(t,e){return m(t,1,e).label==="Unresponsive"}function G(t,e,n,r){if(t.state==="error"||(r?.label??(T(t,n)?"Unresponsive":""))==="Unresponsive")return"error";if(t.state==="running")return"active";if(!e)return"unknown";const o=g[e.type],i=A(e,n);return i===null?"unknown":o==="terminal"?"idle":o==="in-flight"?i<l?"active":"idle":i>=l?"idle":"unknown"}function h(t,e){return e.fromAgentId===t.parentId&&e.toAgentId===t.childId?"down":e.fromAgentId===t.childId&&e.toAgentId===t.parentId?"up":null}function C(t,e,n){const r=new Map,o=new Map;for(const i of e){if(g[i.type]!=="delegation")continue;const a=A(i,n);if(!(a===null||a>=v))for(const c of t){if(!h(c,i))continue;const u=f(c.parentId,c.childId),d=o.get(u);(!d||y(i,d)<0)&&o.set(u,i)}}for(const i of t){const a=f(i.parentId,i.childId),c=o.get(a);r.set(a,c?h(i,c):null)}return r}const k="fn-agent-org-chart-layout";function P(t){return t==="auto"||t==="horizontal"||t==="vertical"}const W=768,_={nodeWidth:220,siblingGap:24,rootGap:24,chartPadding:24},E={nodeWidth:160,siblingGap:8,rootGap:8,chartPadding:8};function I(t){return t.children.length===0?1:t.children.reduce((e,n)=>e+I(n),0)}function w(t){return t<=W?E:_}function S(t,e){const n=I(t);return n*e.nodeWidth+Math.max(0,n-1)*e.siblingGap}function N(t,e=Number.POSITIVE_INFINITY){const n=w(e);if(t.length===0)return n.nodeWidth;const o=t.map(a=>S(a,n)).reduce((a,c)=>a+c,0),i=Math.max(0,t.length-1)*n.rootGap;return o+i+n.chartPadding*2}function F(t){const e=t.preference??"auto";if(e!=="auto")return e;const n=Number.isFinite(t.availableWidth)&&t.availableWidth>0?t.availableWidth:0;return n===0||t.tree.length<=1?"horizontal":N(t.tree,n)>n?"vertical":"horizontal"}export{l as A,v as F,k as O,A as a,P as b,y as c,G as d,C as e,M as g,L as i,f as o,s as p,F as r,D as w};