@runfusion/fusion 0.77.0-beta.2 → 0.77.0-beta.3

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 (116) hide show
  1. package/dist/bin.js +2912 -1774
  2. package/dist/child-process-worker.js +1458 -1311
  3. package/dist/client/.vite/manifest.json +266 -266
  4. package/dist/client/assets/{AgentDetailView-Dew3af1O.js → AgentDetailView-D-mPbGXe.js} +1 -1
  5. package/dist/client/assets/{AgentPermissionPolicyEditor-CxPQffiY.js → AgentPermissionPolicyEditor-Bq3z2QY0.js} +1 -1
  6. package/dist/client/assets/{AgentsView-Cr4LDGdt.js → AgentsView-CYg6b9n0.js} +3 -3
  7. package/dist/client/assets/{ChatView-cNYtYx05.js → ChatView-qnlDeWDu.js} +1 -1
  8. package/dist/client/assets/{CommandCenter-DCC90LOP.js → CommandCenter-DDCbSURT.js} +1 -1
  9. package/dist/client/assets/{DevServerView-B5b520w6.js → DevServerView-DJ459OYL.js} +1 -1
  10. package/dist/client/assets/{DirectoryPicker-1JvRd5mC.js → DirectoryPicker-ClOKp7d1.js} +1 -1
  11. package/dist/client/assets/{DocumentsView-ksK9f7xt.js → DocumentsView-D3Yb4WqD.js} +1 -1
  12. package/dist/client/assets/{EvalsView-a3LhgRSo.js → EvalsView-DGJFQc1W.js} +1 -1
  13. package/dist/client/assets/{ExperimentalAgentOnboardingModal-vdVa8h7F.js → ExperimentalAgentOnboardingModal-CMy3zvnk.js} +1 -1
  14. package/dist/client/assets/{GoalsView-Dz2o91fd.js → GoalsView-D-z3Rf4g.js} +1 -1
  15. package/dist/client/assets/{InsightsView-De3R_46d.js → InsightsView-By1AFGbM.js} +1 -1
  16. package/dist/client/assets/{MemoryView-Cagk2wZG.js → MemoryView-Dhe8ydZR.js} +1 -1
  17. package/dist/client/assets/{PiExtensionsManager-C9JABO_4.js → PiExtensionsManager-_8u94B1u.js} +1 -1
  18. package/dist/client/assets/{PluginManager-D2csmdQa.js → PluginManager-ByNlw3zN.js} +1 -1
  19. package/dist/client/assets/{PullRequestView-DT8vTeVi.js → PullRequestView-NkCEKKpG.js} +1 -1
  20. package/dist/client/assets/{ReportModal-YMP6V4vu.js → ReportModal-DovuZwdY.js} +1 -1
  21. package/dist/client/assets/{ResearchView-cNsjYu8F.js → ResearchView-BCxXqB8F.js} +1 -1
  22. package/dist/client/assets/{SecretsView-BAmf7KyS.js → SecretsView-CxK0XDc2.js} +1 -1
  23. package/dist/client/assets/SessionTerminal-CuVsOYc8.js +2 -0
  24. package/dist/client/assets/{SettingsModal-C_9RiEI7.js → SettingsModal-BtV1tIIf.js} +1 -1
  25. package/dist/client/assets/{SettingsModal-DLfy2e_5.js → SettingsModal-C-tiAvqQ.js} +3 -3
  26. package/dist/client/assets/{SettingsTextareaRow-D8RHSj8b.js → SettingsTextareaRow-YR4pGawU.js} +1 -1
  27. package/dist/client/assets/{SetupWizardModal-DRJ96pHQ.js → SetupWizardModal-DrbeWku9.js} +2 -2
  28. package/dist/client/assets/{SkillsView-DyeCwYit.js → SkillsView-B4Jc91WM.js} +1 -1
  29. package/dist/client/assets/{WorkflowNodeEditor-C5Jc9w_A.js → WorkflowNodeEditor-DGtYlSHs.js} +1 -1
  30. package/dist/client/assets/{agent-import-generation-SCPNeF25.js → agent-import-generation-CHAXFtOA.js} +1 -1
  31. package/dist/client/assets/{agentsOrgChartLayout-CqKtNCjy.js → agentsOrgChartLayout-DsahEyq7.js} +1 -1
  32. package/dist/client/assets/{architectureDiagram-3BPJPVTR-Cz2HYn0b.js → architectureDiagram-3BPJPVTR-BKJBR8ob.js} +1 -1
  33. package/dist/client/assets/{blockDiagram-GPEHLZMM-IimJVscG.js → blockDiagram-GPEHLZMM-CqpNEYwI.js} +1 -1
  34. package/dist/client/assets/{c4Diagram-AAUBKEIU-C-xii7zn.js → c4Diagram-AAUBKEIU-CouyKoYs.js} +1 -1
  35. package/dist/client/assets/channel-D7yWYIo9.js +1 -0
  36. package/dist/client/assets/{chunk-2J33WTMH-DQ-9Xccu.js → chunk-2J33WTMH-WHWSsNaC.js} +1 -1
  37. package/dist/client/assets/{chunk-4BX2VUAB-DmdAX9Bx.js → chunk-4BX2VUAB-B-EVACQc.js} +1 -1
  38. package/dist/client/assets/{chunk-55IACEB6-IF2bk5IL.js → chunk-55IACEB6-CVvNjEpv.js} +1 -1
  39. package/dist/client/assets/{chunk-727SXJPM-AeYpIzVu.js → chunk-727SXJPM-CV4EKLRh.js} +1 -1
  40. package/dist/client/assets/{chunk-AQP2D5EJ-DV942DD9.js → chunk-AQP2D5EJ-DtDpuURf.js} +1 -1
  41. package/dist/client/assets/{chunk-FMBD7UC4-Bt_riVlZ.js → chunk-FMBD7UC4-DPejtS21.js} +1 -1
  42. package/dist/client/assets/{chunk-ND2GUHAM-CbyjNbXR.js → chunk-ND2GUHAM-DGDxBRA_.js} +1 -1
  43. package/dist/client/assets/{chunk-QZHKN3VN-DqiRniYQ.js → chunk-QZHKN3VN-D2k1MIuX.js} +1 -1
  44. package/dist/client/assets/classDiagram-4FO5ZUOK-cuSqS34E.js +1 -0
  45. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-cuSqS34E.js +1 -0
  46. package/dist/client/assets/{cose-bilkent-S5V4N54A-UCvthviL.js → cose-bilkent-S5V4N54A-Cr6PW7Dk.js} +1 -1
  47. package/dist/client/assets/{dagre-BM42HDAG-DnMlT1Oi.js → dagre-BM42HDAG-QKrqYGWy.js} +1 -1
  48. package/dist/client/assets/{dashboard-view-myjM9tr8.js → dashboard-view-BQRwsBoj.js} +1 -1
  49. package/dist/client/assets/{dashboard-view-Cz0sp2Wl.js → dashboard-view-BcNU4vFB.js} +1 -1
  50. package/dist/client/assets/{dashboard-view-JysoyDRX.js → dashboard-view-BksOkReD.js} +1 -1
  51. package/dist/client/assets/{dashboard-view-C9D0aoRW.js → dashboard-view-CkPDyljq.js} +1 -1
  52. package/dist/client/assets/{diagram-2AECGRRQ-BYFiqXGw.js → diagram-2AECGRRQ-BBFXrRQl.js} +1 -1
  53. package/dist/client/assets/{diagram-5GNKFQAL-DZU3pSYq.js → diagram-5GNKFQAL-_T4nM0jp.js} +1 -1
  54. package/dist/client/assets/{diagram-KO2AKTUF-0ybdKuMm.js → diagram-KO2AKTUF-BAKmsx_j.js} +1 -1
  55. package/dist/client/assets/{diagram-LMA3HP47-Rxbgnbsp.js → diagram-LMA3HP47-Xdsdd6Gx.js} +1 -1
  56. package/dist/client/assets/{diagram-OG6HWLK6-BAU_hTeV.js → diagram-OG6HWLK6-tIHxhnE8.js} +1 -1
  57. package/dist/client/assets/{erDiagram-TEJ5UH35-zr8HrwTt.js → erDiagram-TEJ5UH35-HZSbfe0g.js} +1 -1
  58. package/dist/client/assets/{flowDiagram-I6XJVG4X-CrTw0iFw.js → flowDiagram-I6XJVG4X-C4O3r0DX.js} +1 -1
  59. package/dist/client/assets/{folder-open-DnAlsXXn.js → folder-open-15UiPjYb.js} +1 -1
  60. package/dist/client/assets/{ganttDiagram-6RSMTGT7-CCORsxxz.js → ganttDiagram-6RSMTGT7-DGsKKMEu.js} +1 -1
  61. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-C07wWSjj.js → gitGraphDiagram-PVQCEYII-BY4kgtHp.js} +1 -1
  62. package/dist/client/assets/index-4c8KmZSa.js +2818 -0
  63. package/dist/client/assets/{index-DPo-IAb2.css → index-Bg6JQgJj.css} +1 -1
  64. package/dist/client/assets/{infoDiagram-5YYISTIA-hAeccD_4.js → infoDiagram-5YYISTIA-lJBWxF8I.js} +1 -1
  65. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-WLCzv-NH.js → ishikawaDiagram-YF4QCWOH-CrE_q16o.js} +1 -1
  66. package/dist/client/assets/{journeyDiagram-JHISSGLW-ClnasNhy.js → journeyDiagram-JHISSGLW-9V42jgFW.js} +1 -1
  67. package/dist/client/assets/{kanban-definition-UN3LZRKU-CAuARhUz.js → kanban-definition-UN3LZRKU-B_T-7Vyf.js} +1 -1
  68. package/dist/client/assets/{mermaid.core-Bh02RvfX.js → mermaid.core-CwJ7S3PS.js} +4 -4
  69. package/dist/client/assets/{mindmap-definition-RKZ34NQL-KNTlbW4V.js → mindmap-definition-RKZ34NQL-MYNSgM6G.js} +1 -1
  70. package/dist/client/assets/{pieDiagram-4H26LBE5-BouAfBEw.js → pieDiagram-4H26LBE5-CtT-wbYj.js} +1 -1
  71. package/dist/client/assets/{puzzle-CC8Ur3Cy.js → puzzle-CXdFNN8H.js} +1 -1
  72. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-wTdkCUJU.js → quadrantDiagram-W4KKPZXB-3klC5x4k.js} +1 -1
  73. package/dist/client/assets/{requirementDiagram-4Y6WPE33-BnjY4Tc_.js → requirementDiagram-4Y6WPE33-CHfFrsBL.js} +1 -1
  74. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-C-QsS08u.js → sankeyDiagram-5OEKKPKP-Dtktw7Dy.js} +1 -1
  75. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-DD36MILE.js → sequenceDiagram-3UESZ5HK-CuXPMjTU.js} +1 -1
  76. package/dist/client/assets/{shield-alert-DcXc56Fy.js → shield-alert-D9xqzJwR.js} +1 -1
  77. package/dist/client/assets/{standing-instructions-template-BF5y1BLz.js → standing-instructions-template-CcpV_LRP.js} +1 -1
  78. package/dist/client/assets/{stateDiagram-AJRCARHV-WTq1wQr1.js → stateDiagram-AJRCARHV-Bj_rDJwQ.js} +1 -1
  79. package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-eILJdjII.js → stateDiagram-v2-BHNVJYJU-D-YYF-kX.js} +1 -1
  80. package/dist/client/assets/{timeline-definition-PNZ67QCA-PRNwI0NR.js → timeline-definition-PNZ67QCA-DXalwFMD.js} +1 -1
  81. package/dist/client/assets/{upload-qH_64O-B.js → upload-CWVc30BQ.js} +1 -1
  82. package/dist/client/assets/{useDiscoveredSkillsCache-C-GPCNaO.js → useDiscoveredSkillsCache-D2M95Nn0.js} +1 -1
  83. package/dist/client/assets/{users-D2UesRE4.js → users-q_-iLqv9.js} +1 -1
  84. package/dist/client/assets/{vennDiagram-CIIHVFJN-CG2Z4T4O.js → vennDiagram-CIIHVFJN-0-aTlrbe.js} +1 -1
  85. package/dist/client/assets/{wardley-L42UT6IY-gO_fGvF9.js → wardley-L42UT6IY-Bz_e_5wx.js} +1 -1
  86. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-BkyNpjUb.js → wardleyDiagram-YWT4CUSO-DsQu4YnA.js} +1 -1
  87. package/dist/client/assets/{xychartDiagram-2RQKCTM6-CMlZsiPq.js → xychartDiagram-2RQKCTM6-K6GQdwVG.js} +1 -1
  88. package/dist/client/index.html +2 -2
  89. package/dist/client/version.json +1 -1
  90. package/dist/droid-cli/package.json +1 -1
  91. package/dist/extension.js +1587 -1355
  92. package/dist/pi-claude-cli/package.json +1 -1
  93. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  94. package/dist/plugins/fusion-plugin-claude-runtime/package.json +1 -1
  95. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  96. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  97. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  98. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  99. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  100. package/dist/plugins/fusion-plugin-grok-runtime/package.json +1 -1
  101. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  102. package/dist/plugins/fusion-plugin-linear-import/package.json +1 -1
  103. package/dist/plugins/fusion-plugin-omp-runtime/package.json +1 -1
  104. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  105. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  106. package/dist/plugins/fusion-plugin-quality/package.json +1 -1
  107. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  108. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  109. package/dist/plugins/fusion-plugin-todos/package.json +1 -1
  110. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  111. package/package.json +1 -1
  112. package/dist/client/assets/SessionTerminal-BjGcxq22.js +0 -2
  113. package/dist/client/assets/channel-D-UHgx8G.js +0 -1
  114. package/dist/client/assets/classDiagram-4FO5ZUOK-Do-8MdAc.js +0 -1
  115. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Do-8MdAc.js +0 -1
  116. package/dist/client/assets/index-B_z7OKl4.js +0 -2818
@@ -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{dm as S,b1 as E}from"./index-B_z7OKl4.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 f({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})})]}),m=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:m})]}),!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(f,{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(f,{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:m}=s;return e.jsx(f,{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:m,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,m=g??(r==="password"?"off":void 0);return e.jsx(f,{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:m,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(f,{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{f 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{dm as S,b1 as E}from"./index-4c8KmZSa.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 f({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})})]}),m=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:m})]}),!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(f,{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(f,{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:m}=s;return e.jsx(f,{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:m,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,m=g??(r==="password"?"off":void 0);return e.jsx(f,{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:m,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(f,{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{f 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-vdVa8h7F.js","assets/vendor-react-SZ_qB27O.js","assets/index-B_z7OKl4.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-DPo-IAb2.css","assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css"])))=>i.map(i=>d[i]);
2
- import{ag as de,I as x,ah as R,ai as G,aj as pe,ak as ue,al as me,am as L,an as ge,ao as he,ap as xe,aq as fe,K as je,X as we,L as M,k as ye,ar as W,m as Ne,as as O,at as be,a8 as ke}from"./index-B_z7OKl4.js";import{r as o,j as e}from"./vendor-react-SZ_qB27O.js";import{D as Ce}from"./DirectoryPicker-1JvRd5mC.js";import{s as D}from"./projectDetection-G3XuxD2X.js";import{u as ze}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";import"./vendor-xterm-BNq00GSj.js";import"./folder-open-DnAlsXXn.js";function H(c){return c.filter(p=>p.type!=="local")}function ve(c){return H(c).length>0}function S(c){const p=c.replace(/[^a-zA-Z]/g,"").toUpperCase();return p.length>=2&&p.length<=4?p:p.length>4?p.slice(0,4):"FN"}const Pe=o.lazy(()=>ke(()=>import("./ExperimentalAgentOnboardingModal-vdVa8h7F.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(c=>({default:c.ExperimentalAgentOnboardingModal})));function Ue({onProjectRegistered:c,onClose:p,agentOnboardingEnabled:F=!1,includeAgentStep:f=!0}){const{t:s}=ze("app"),{confirmWithChoice:b}=de(),_="https://discord.gg/ksrfuy7WYR",k=o.useMemo(()=>R("ceo")??x[0],[]),[B,Y]=o.useState(!0),[t,n]=o.useState(()=>({step:"manual",manualMode:"existing",manualPath:"",manualCloneUrl:"",manualName:"",manualIsolationMode:"in-process",manualNodeId:"",manualTaskPrefix:"",detectedRepos:[],workspaceMode:!1,isDetectingWorkspace:!1,registeredProject:null,selectedPresetId:k.id,agentDraft:G(k),isCreatingAgent:!1,isRegistering:!1,error:null,agentError:null,agentOutcome:null})),[E,$]=o.useState(!1),[T,C]=o.useState(!1),U=o.useRef(null),{nodes:z,loading:q}=pe(),K=z.find(a=>a.type==="local")?.id,v=o.useCallback(()=>{Y(!1),p?.()},[p]),V=o.useCallback(()=>{if(t.registeredProject){c(t.registeredProject);return}v()},[v,c,t.registeredProject]);o.useEffect(()=>{t.agentError&&U.current?.focus()},[t.agentError]);const j=o.useRef(0),w=o.useRef(!1),Z=o.useCallback(a=>{if(n(i=>{const r={manualPath:a,detectedRepos:[],workspaceMode:!1,error:null};a&&(!i.manualName||i.manualName===D(i.manualPath))&&(r.manualName=D(a));const d=r.manualName??i.manualName;return d&&(!i.manualTaskPrefix||i.manualTaskPrefix===S(D(i.manualPath)))&&(r.manualTaskPrefix=S(d)),{...i,...r}}),t.manualMode==="existing"&&a.trim()&&a.trim()!=="/"){const i=++j.current;n(r=>({...r,isDetectingWorkspace:!0})),ue(a.trim()).then(r=>{i===j.current&&n(d=>({...d,isDetectingWorkspace:!1,detectedRepos:r.repos,workspaceMode:r.isWorkspace}))}).catch(()=>{i===j.current&&n(r=>({...r,isDetectingWorkspace:!1}))})}},[t.manualMode]),P=o.useCallback(a=>{n(i=>({...i,manualMode:a,manualCloneUrl:a==="clone"?i.manualCloneUrl:"",detectedRepos:a==="existing"?i.detectedRepos:[],workspaceMode:a==="existing"?i.workspaceMode:!1,isDetectingWorkspace:!1,error:null})),j.current+=1},[]),X=o.useCallback(async()=>{const a=t.manualPath.trim(),i=t.manualName.trim(),r=t.manualCloneUrl.trim();if(!a||!i||t.manualMode==="clone"&&!r||w.current||t.isRegistering)return;w.current=!0,n(l=>({...l,isRegistering:!0,error:null}));const d=()=>{w.current=!1,n(l=>({...l,isRegistering:!1}))};let m=!1;try{const{gitCli:l}=await me();if(l&&!l.available){if(t.manualMode==="clone"){await b({title:s("setup.gitMissingTitle","Git is not installed"),message:s("setup.gitMissingCloneMessage","Cloning a repository requires Git on the Fusion host, and Git was not found. Install Git, then try again — Fusion picks it up without a restart."),confirmLabel:s("setup.gitMissingOpenDownloads","Open Git downloads"),cancelLabel:s("setup.cancel","Cancel"),alwaysAsk:!0})==="primary"&&L(l.installUrl??"https://git-scm.com/downloads"),d();return}const g=await b({title:s("setup.gitMissingTitle","Git is not installed"),message:s("setup.gitMissingMessage","Git was not found on the Fusion host. Fusion projects normally live in a git repository so agents can branch, commit, and merge work. You can install Git first (Fusion picks it up without a restart), or create the project anyway without a git repository."),confirmLabel:s("setup.gitMissingCreateAnyway","Create anyway without Git"),tertiaryLabel:s("setup.gitMissingOpenDownloads","Open Git downloads"),cancelLabel:s("setup.cancel","Cancel"),alwaysAsk:!0});if(g==="tertiary"){L(l.installUrl??"https://git-scm.com/downloads"),d();return}if(g!=="primary"){d();return}m=!0}}catch{}try{const l={name:i,path:a,isolationMode:t.manualIsolationMode,nodeId:t.manualNodeId||void 0,gitSetupMode:t.manualMode,cloneUrl:t.manualMode==="clone"?r:void 0,workspaceMode:t.manualMode==="existing"?t.workspaceMode:!1,taskPrefix:t.manualTaskPrefix.trim()||void 0,skipGitInit:m||void 0},g=await ge(l);if(!f){n(N=>({...N,isRegistering:!1})),c(g);return}n(N=>({...N,step:"agent",registeredProject:g,isRegistering:!1}))}catch(l){n(g=>({...g,isRegistering:!1,error:l instanceof Error?l.message:"Failed to register project"}))}finally{w.current=!1}},[f,c,t.manualPath,t.manualName,t.manualCloneUrl,t.manualMode,t.manualIsolationMode,t.manualNodeId,t.workspaceMode,t.manualTaskPrefix,b,s]),I=o.useCallback(a=>{const i=R(a);i&&n(r=>({...r,selectedPresetId:i.id,agentDraft:G(i),agentError:null}))},[]),J=o.useCallback((a,i)=>{const r=x.findIndex(g=>g.id===i);if(r<0)return;const d=x.length-1;let m=null;if(a.key==="ArrowDown"||a.key==="ArrowRight"?m=r===d?0:r+1:a.key==="ArrowUp"||a.key==="ArrowLeft"?m=r===0?d:r-1:a.key==="Home"?m=0:a.key==="End"&&(m=d),m===null)return;a.preventDefault();const l=x[m];I(l.id),requestAnimationFrame(()=>{document.querySelector(`[data-agent-preset-id="${l.id}"]`)?.focus()})},[I]),Q=o.useCallback(a=>{n(i=>({...i,selectedPresetId:"",agentDraft:he(a),agentError:null}))},[]),ee=o.useCallback(async()=>{if(!(!t.registeredProject||!t.agentDraft.name.trim())){n(a=>({...a,isCreatingAgent:!0,agentError:null}));try{await xe(fe(t.agentDraft),t.registeredProject.id),n(a=>({...a,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}))}catch(a){if(a instanceof Error&&/already exists/i.test(a.message)){n(i=>({...i,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}));return}n(i=>({...i,isCreatingAgent:!1,agentError:a instanceof Error?a.message:s("setup.firstAgentCreateError","Failed to create agent")}))}}},[t.agentDraft,t.registeredProject,s]),te=o.useCallback(()=>{n(a=>({...a,step:"complete",agentError:null,agentOutcome:"skipped"}))},[]);if(!B)return null;const A=t.manualMode==="existing",h=t.manualMode==="init",u=t.manualMode==="clone",se=u?s("setup.cloneAndRegisterProject","Clone and Register Project"):h?s("setup.initializeAndRegisterProject","Initialize and Register Project"):s("setup.registerProject","Register Project"),ae=t.manualPath.trim().length>0,ie=t.manualName.trim().length>0,ne=t.manualCloneUrl.trim().length>0,re=t.isRegistering||!ae||!ie||u&&!ne,oe=t.selectedPresetId?R(t.selectedPresetId):void 0,y=t.isCreatingAgent,le=t.selectedPresetId||k.id,ce=`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:ce,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")})]}),!f&&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"&&(f?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:v,"aria-label":s("setup.closeWizard","Close wizard"),children:e.jsx(we,{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${A?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"existing","aria-label":s("setup.useExistingDirectory","Use Existing Directory"),checked:A,onChange:()=>P("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${h?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"init","aria-label":s("setup.initializeNewRepository","Initialize New Repository"),checked:h,onChange:()=>P("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:()=>P("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"):h?s("setup.newRepositoryDirectory","New Repository Directory"):s("setup.projectDirectory","Project Directory")}),e.jsx(Ce,{value:t.manualPath,onChange:Z,nodeId:t.manualNodeId||void 0,localNodeId:K,selectCreatedDirectory:!0,placeholder:u?s("setup.clonePathPlaceholder","/path/for/new-clone"):h?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."):h?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=>n(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."):h?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=>n(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.")})]}),A&&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=>n(i=>({...i,workspaceMode:a.target.checked}))}),s("setup.workspaceMode","Workspace mode (multi-repo)")]}),t.isDetectingWorkspace&&e.jsxs("p",{className:"form-hint",children:[e.jsx(M,{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=>n(i=>({...i,manualTaskPrefix:a.target.value.toUpperCase()})),placeholder:S(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":E,onClick:()=>$(a=>!a),children:[e.jsx(ye,{size:16,className:"setup-wizard-advanced-chevron"}),e.jsx("span",{children:s("setup.advancedSettings","Advanced settings")})]}),E&&e.jsxs("div",{className:"setup-wizard-advanced-panel",children:[ve(z)&&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=>n(i=>({...i,manualNodeId:a.target.value})),disabled:q||t.isRegistering,children:[e.jsx("option",{value:"",children:s("setup.localNode","Local node")}),H(z).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:()=>n(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:()=>n(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===le?0:-1,"data-agent-preset-id":a.id,disabled:y,onClick:()=>I(a.id),onKeyDown:r=>J(r,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||oe?.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")})]})]}),F&&e.jsxs("button",{type:"button",className:"btn setup-wizard-agent-ai-btn",onClick:()=>C(!0),disabled:y,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:U,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(O,{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:_,target:"_blank",rel:"noopener noreferrer",children:s("setup.needHelp","Need help?")}),t.step==="manual"&&e.jsx("button",{className:"btn btn-primary",onClick:X,disabled:re,children:t.isRegistering?e.jsxs(e.Fragment,{children:[e.jsx(M,{size:16,className:"animate-spin"}),e.jsx("span",{children:s("setup.registering","Registering...")})]}):e.jsx("span",{children:se})}),t.step==="agent"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:te,disabled:y,children:s("setup.skipFirstAgent","Skip for now")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ee(),disabled:y||!t.agentDraft.name.trim(),"aria-busy":t.isCreatingAgent,children:t.isCreatingAgent?e.jsxs(e.Fragment,{children:[e.jsx(M,{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:V,children:[e.jsx(O,{size:16}),e.jsx("span",{children:s("setup.getStarted","Get Started")})]})]})]}),F&&T&&e.jsx(be,{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:()=>C(!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:T,onClose:()=>C(!1),onUseDraft:Q,projectId:t.registeredProject?.id,existingAgents:[],mode:"create"})})})]})}export{Ue as SetupWizardModal};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalAgentOnboardingModal-CMy3zvnk.js","assets/vendor-react-SZ_qB27O.js","assets/index-4c8KmZSa.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-Bg6JQgJj.css","assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css"])))=>i.map(i=>d[i]);
2
+ import{ag as de,I as x,ah as R,ai as G,aj as pe,ak as ue,al as me,am as L,an as ge,ao as he,ap as xe,aq as fe,K as je,X as we,L as M,k as ye,ar as W,m as Ne,as as O,at as be,a8 as ke}from"./index-4c8KmZSa.js";import{r as o,j as e}from"./vendor-react-SZ_qB27O.js";import{D as Ce}from"./DirectoryPicker-ClOKp7d1.js";import{s as D}from"./projectDetection-G3XuxD2X.js";import{u as ze}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";import"./vendor-xterm-BNq00GSj.js";import"./folder-open-15UiPjYb.js";function H(c){return c.filter(p=>p.type!=="local")}function ve(c){return H(c).length>0}function S(c){const p=c.replace(/[^a-zA-Z]/g,"").toUpperCase();return p.length>=2&&p.length<=4?p:p.length>4?p.slice(0,4):"FN"}const Pe=o.lazy(()=>ke(()=>import("./ExperimentalAgentOnboardingModal-CMy3zvnk.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(c=>({default:c.ExperimentalAgentOnboardingModal})));function Ue({onProjectRegistered:c,onClose:p,agentOnboardingEnabled:F=!1,includeAgentStep:f=!0}){const{t:s}=ze("app"),{confirmWithChoice:b}=de(),_="https://discord.gg/ksrfuy7WYR",k=o.useMemo(()=>R("ceo")??x[0],[]),[B,Y]=o.useState(!0),[t,n]=o.useState(()=>({step:"manual",manualMode:"existing",manualPath:"",manualCloneUrl:"",manualName:"",manualIsolationMode:"in-process",manualNodeId:"",manualTaskPrefix:"",detectedRepos:[],workspaceMode:!1,isDetectingWorkspace:!1,registeredProject:null,selectedPresetId:k.id,agentDraft:G(k),isCreatingAgent:!1,isRegistering:!1,error:null,agentError:null,agentOutcome:null})),[E,$]=o.useState(!1),[T,C]=o.useState(!1),U=o.useRef(null),{nodes:z,loading:q}=pe(),K=z.find(a=>a.type==="local")?.id,v=o.useCallback(()=>{Y(!1),p?.()},[p]),V=o.useCallback(()=>{if(t.registeredProject){c(t.registeredProject);return}v()},[v,c,t.registeredProject]);o.useEffect(()=>{t.agentError&&U.current?.focus()},[t.agentError]);const j=o.useRef(0),w=o.useRef(!1),Z=o.useCallback(a=>{if(n(i=>{const r={manualPath:a,detectedRepos:[],workspaceMode:!1,error:null};a&&(!i.manualName||i.manualName===D(i.manualPath))&&(r.manualName=D(a));const d=r.manualName??i.manualName;return d&&(!i.manualTaskPrefix||i.manualTaskPrefix===S(D(i.manualPath)))&&(r.manualTaskPrefix=S(d)),{...i,...r}}),t.manualMode==="existing"&&a.trim()&&a.trim()!=="/"){const i=++j.current;n(r=>({...r,isDetectingWorkspace:!0})),ue(a.trim()).then(r=>{i===j.current&&n(d=>({...d,isDetectingWorkspace:!1,detectedRepos:r.repos,workspaceMode:r.isWorkspace}))}).catch(()=>{i===j.current&&n(r=>({...r,isDetectingWorkspace:!1}))})}},[t.manualMode]),P=o.useCallback(a=>{n(i=>({...i,manualMode:a,manualCloneUrl:a==="clone"?i.manualCloneUrl:"",detectedRepos:a==="existing"?i.detectedRepos:[],workspaceMode:a==="existing"?i.workspaceMode:!1,isDetectingWorkspace:!1,error:null})),j.current+=1},[]),X=o.useCallback(async()=>{const a=t.manualPath.trim(),i=t.manualName.trim(),r=t.manualCloneUrl.trim();if(!a||!i||t.manualMode==="clone"&&!r||w.current||t.isRegistering)return;w.current=!0,n(l=>({...l,isRegistering:!0,error:null}));const d=()=>{w.current=!1,n(l=>({...l,isRegistering:!1}))};let m=!1;try{const{gitCli:l}=await me();if(l&&!l.available){if(t.manualMode==="clone"){await b({title:s("setup.gitMissingTitle","Git is not installed"),message:s("setup.gitMissingCloneMessage","Cloning a repository requires Git on the Fusion host, and Git was not found. Install Git, then try again — Fusion picks it up without a restart."),confirmLabel:s("setup.gitMissingOpenDownloads","Open Git downloads"),cancelLabel:s("setup.cancel","Cancel"),alwaysAsk:!0})==="primary"&&L(l.installUrl??"https://git-scm.com/downloads"),d();return}const g=await b({title:s("setup.gitMissingTitle","Git is not installed"),message:s("setup.gitMissingMessage","Git was not found on the Fusion host. Fusion projects normally live in a git repository so agents can branch, commit, and merge work. You can install Git first (Fusion picks it up without a restart), or create the project anyway without a git repository."),confirmLabel:s("setup.gitMissingCreateAnyway","Create anyway without Git"),tertiaryLabel:s("setup.gitMissingOpenDownloads","Open Git downloads"),cancelLabel:s("setup.cancel","Cancel"),alwaysAsk:!0});if(g==="tertiary"){L(l.installUrl??"https://git-scm.com/downloads"),d();return}if(g!=="primary"){d();return}m=!0}}catch{}try{const l={name:i,path:a,isolationMode:t.manualIsolationMode,nodeId:t.manualNodeId||void 0,gitSetupMode:t.manualMode,cloneUrl:t.manualMode==="clone"?r:void 0,workspaceMode:t.manualMode==="existing"?t.workspaceMode:!1,taskPrefix:t.manualTaskPrefix.trim()||void 0,skipGitInit:m||void 0},g=await ge(l);if(!f){n(N=>({...N,isRegistering:!1})),c(g);return}n(N=>({...N,step:"agent",registeredProject:g,isRegistering:!1}))}catch(l){n(g=>({...g,isRegistering:!1,error:l instanceof Error?l.message:"Failed to register project"}))}finally{w.current=!1}},[f,c,t.manualPath,t.manualName,t.manualCloneUrl,t.manualMode,t.manualIsolationMode,t.manualNodeId,t.workspaceMode,t.manualTaskPrefix,b,s]),I=o.useCallback(a=>{const i=R(a);i&&n(r=>({...r,selectedPresetId:i.id,agentDraft:G(i),agentError:null}))},[]),J=o.useCallback((a,i)=>{const r=x.findIndex(g=>g.id===i);if(r<0)return;const d=x.length-1;let m=null;if(a.key==="ArrowDown"||a.key==="ArrowRight"?m=r===d?0:r+1:a.key==="ArrowUp"||a.key==="ArrowLeft"?m=r===0?d:r-1:a.key==="Home"?m=0:a.key==="End"&&(m=d),m===null)return;a.preventDefault();const l=x[m];I(l.id),requestAnimationFrame(()=>{document.querySelector(`[data-agent-preset-id="${l.id}"]`)?.focus()})},[I]),Q=o.useCallback(a=>{n(i=>({...i,selectedPresetId:"",agentDraft:he(a),agentError:null}))},[]),ee=o.useCallback(async()=>{if(!(!t.registeredProject||!t.agentDraft.name.trim())){n(a=>({...a,isCreatingAgent:!0,agentError:null}));try{await xe(fe(t.agentDraft),t.registeredProject.id),n(a=>({...a,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}))}catch(a){if(a instanceof Error&&/already exists/i.test(a.message)){n(i=>({...i,step:"complete",isCreatingAgent:!1,agentOutcome:"created"}));return}n(i=>({...i,isCreatingAgent:!1,agentError:a instanceof Error?a.message:s("setup.firstAgentCreateError","Failed to create agent")}))}}},[t.agentDraft,t.registeredProject,s]),te=o.useCallback(()=>{n(a=>({...a,step:"complete",agentError:null,agentOutcome:"skipped"}))},[]);if(!B)return null;const A=t.manualMode==="existing",h=t.manualMode==="init",u=t.manualMode==="clone",se=u?s("setup.cloneAndRegisterProject","Clone and Register Project"):h?s("setup.initializeAndRegisterProject","Initialize and Register Project"):s("setup.registerProject","Register Project"),ae=t.manualPath.trim().length>0,ie=t.manualName.trim().length>0,ne=t.manualCloneUrl.trim().length>0,re=t.isRegistering||!ae||!ie||u&&!ne,oe=t.selectedPresetId?R(t.selectedPresetId):void 0,y=t.isCreatingAgent,le=t.selectedPresetId||k.id,ce=`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:ce,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")})]}),!f&&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"&&(f?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:v,"aria-label":s("setup.closeWizard","Close wizard"),children:e.jsx(we,{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${A?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"existing","aria-label":s("setup.useExistingDirectory","Use Existing Directory"),checked:A,onChange:()=>P("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${h?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"setup-mode",value:"init","aria-label":s("setup.initializeNewRepository","Initialize New Repository"),checked:h,onChange:()=>P("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:()=>P("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"):h?s("setup.newRepositoryDirectory","New Repository Directory"):s("setup.projectDirectory","Project Directory")}),e.jsx(Ce,{value:t.manualPath,onChange:Z,nodeId:t.manualNodeId||void 0,localNodeId:K,selectCreatedDirectory:!0,placeholder:u?s("setup.clonePathPlaceholder","/path/for/new-clone"):h?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."):h?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=>n(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."):h?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=>n(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.")})]}),A&&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=>n(i=>({...i,workspaceMode:a.target.checked}))}),s("setup.workspaceMode","Workspace mode (multi-repo)")]}),t.isDetectingWorkspace&&e.jsxs("p",{className:"form-hint",children:[e.jsx(M,{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=>n(i=>({...i,manualTaskPrefix:a.target.value.toUpperCase()})),placeholder:S(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":E,onClick:()=>$(a=>!a),children:[e.jsx(ye,{size:16,className:"setup-wizard-advanced-chevron"}),e.jsx("span",{children:s("setup.advancedSettings","Advanced settings")})]}),E&&e.jsxs("div",{className:"setup-wizard-advanced-panel",children:[ve(z)&&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=>n(i=>({...i,manualNodeId:a.target.value})),disabled:q||t.isRegistering,children:[e.jsx("option",{value:"",children:s("setup.localNode","Local node")}),H(z).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:()=>n(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:()=>n(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===le?0:-1,"data-agent-preset-id":a.id,disabled:y,onClick:()=>I(a.id),onKeyDown:r=>J(r,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||oe?.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")})]})]}),F&&e.jsxs("button",{type:"button",className:"btn setup-wizard-agent-ai-btn",onClick:()=>C(!0),disabled:y,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:U,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(O,{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:_,target:"_blank",rel:"noopener noreferrer",children:s("setup.needHelp","Need help?")}),t.step==="manual"&&e.jsx("button",{className:"btn btn-primary",onClick:X,disabled:re,children:t.isRegistering?e.jsxs(e.Fragment,{children:[e.jsx(M,{size:16,className:"animate-spin"}),e.jsx("span",{children:s("setup.registering","Registering...")})]}):e.jsx("span",{children:se})}),t.step==="agent"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:te,disabled:y,children:s("setup.skipFirstAgent","Skip for now")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ee(),disabled:y||!t.agentDraft.name.trim(),"aria-busy":t.isCreatingAgent,children:t.isCreatingAgent?e.jsxs(e.Fragment,{children:[e.jsx(M,{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:V,children:[e.jsx(O,{size:16}),e.jsx("span",{children:s("setup.getStarted","Get Started")})]})]})]}),F&&T&&e.jsx(be,{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:()=>C(!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:T,onClose:()=>C(!1),onUseDraft:Q,projectId:t.registeredProject?.id,existingAgents:[],mode:"create"})})})]})}export{Ue as SetupWizardModal};
@@ -1 +1 @@
1
- import{r as a,j as s}from"./vendor-react-SZ_qB27O.js";import{f as ms,g as us,t as vs,i as hs,h as gs,j as bs,V as ws,Z as xs,X as H,R as fs,C as js,k as ps,L as A,A as q,l as G,M as J}from"./index-B_z7OKl4.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,g as us,t as vs,i as hs,h as gs,j as bs,V as ws,Z as xs,X as H,R as fs,C as js,k as ps,L as A,A as q,l as G,M as J}from"./index-4c8KmZSa.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,er as pi,es as Xt,et as qo,eu as ke,ev as Kn,ew as fi,ex as mi,ey as oo,ez as Et,eA as At,eB as rt,eC as Pt,eD as Ye,eE as Un,eF as Yn,eG as Jn,eH as Xn,eI as Qn,eJ as wi,P as je,eK as Zn,dm as Jo,eL as ea,eM as ta,b$ as Xo,eN as oa,eO as Qo,eP as Ft,eQ as sa,eR as na,eS as aa,b2 as ia,bi as Zo,a2 as la,b3 as es,eT as hi,bV as gi,a$ as Te,eU as ki,eV as ra,K as da,X as ts,aJ as bi,eW as ca,bL as le,bS as Qt,c3 as xi,af as vi,C as Me,F as Se,eX as Ni,cq as Zt,eY as qs,cN as ua,eZ as eo,aK as ji,k as We,b1 as yi,cv as Vo,D as Ci,e_ as Si,e$ as Ii,c0 as Vs,f0 as Ei,f1 as Ai,dR as Pi,a5 as Hs,ag as Fi,f2 as Ho,f3 as Mi,f4 as Ri,f5 as Oi,f6 as Li,f7 as Ti,f8 as Di,bh as zi,f9 as $i,fa as Wi,fb as Ks,fc as Us,fd as Ys,fe as Js,ff as Xs,fg as _i,fh as Bi,fi as Gi,fj as qi,fk as Qs,fl as Vi,fm as Zs,fn as en,fo as tn,fp as Hi,fq as Mo,fr as Ki,fs as on,ft as sn,fu as Ui,f as nn,aY as Yi,dd as an,fv as Ro,bU as ln,L as Fe,fw as Je,fx as Oo,fy as Lo,aT as Jt,m as _e,fz as Ji,de as rn,fA as dn,fB as Xi,dj as Qi,fC as Zi,fD as el}from"./index-B_z7OKl4.js";import{u as be}from"./vendor-i18n-Duky4gdQ.js";import{P as To}from"./puzzle-CC8Ur3Cy.js";import{S as tl,a as ol,b as sl,c as cn,d as nl,e as al}from"./SettingsTextareaRow-D8RHSj8b.js";import{U as il}from"./upload-qH_64O-B.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,er as pi,es as Xt,et as qo,eu as ke,ev as Kn,ew as fi,ex as mi,ey as oo,ez as Et,eA as At,eB as rt,eC as Pt,eD as Ye,eE as Un,eF as Yn,eG as Jn,eH as Xn,eI as Qn,eJ as wi,P as je,eK as Zn,dm as Jo,eL as ea,eM as ta,b$ as Xo,eN as oa,eO as Qo,eP as Ft,eQ as sa,eR as na,eS as aa,b2 as ia,bi as Zo,a2 as la,b3 as es,eT as hi,bV as gi,a$ as Te,eU as ki,eV as ra,K as da,X as ts,aJ as bi,eW as ca,bL as le,bS as Qt,c3 as xi,af as vi,C as Me,F as Se,eX as Ni,cq as Zt,eY as qs,cN as ua,eZ as eo,aK as ji,k as We,b1 as yi,cv as Vo,D as Ci,e_ as Si,e$ as Ii,c0 as Vs,f0 as Ei,f1 as Ai,dR as Pi,a5 as Hs,ag as Fi,f2 as Ho,f3 as Mi,f4 as Ri,f5 as Oi,f6 as Li,f7 as Ti,f8 as Di,bh as zi,f9 as $i,fa as Wi,fb as Ks,fc as Us,fd as Ys,fe as Js,ff as Xs,fg as _i,fh as Bi,fi as Gi,fj as qi,fk as Qs,fl as Vi,fm as Zs,fn as en,fo as tn,fp as Hi,fq as Mo,fr as Ki,fs as on,ft as sn,fu as Ui,f as nn,aY as Yi,dd as an,fv as Ro,bU as ln,L as Fe,fw as Je,fx as Oo,fy as Lo,aT as Jt,m as _e,fz as Ji,de as rn,fA as dn,fB as Xi,dj as Qi,fC as Zi,fD as el}from"./index-4c8KmZSa.js";import{u as be}from"./vendor-i18n-Duky4gdQ.js";import{P as To}from"./puzzle-CXdFNN8H.js";import{S as tl,a as ol,b as sl,c as cn,d as nl,e as al}from"./SettingsTextareaRow-YR4pGawU.js";import{U as il}from"./upload-CWVc30BQ.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-B_z7OKl4.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-4c8KmZSa.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,aZ as m}from"./index-B_z7OKl4.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,aZ as m}from"./index-4c8KmZSa.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};