@runfusion/fusion 0.76.0-beta.2 → 0.76.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.
- package/dist/bin.js +323 -59
- package/dist/child-process-worker.js +274 -42
- package/dist/client/.vite/manifest.json +273 -273
- package/dist/client/assets/{AgentDetailView-gak4EWTI.js → AgentDetailView-T767kKTg.js} +1 -1
- package/dist/client/assets/{AgentPermissionPolicyEditor-DP1QbZL-.js → AgentPermissionPolicyEditor--u9jyUf2.js} +1 -1
- package/dist/client/assets/{AgentsView-DAMRTKzI.js → AgentsView-6Ifu7qDr.js} +5 -5
- package/dist/client/assets/{ChatView-iE-2gf5P.js → ChatView-BV3lixQi.js} +1 -1
- package/dist/client/assets/{CommandCenter-B6RnkLYm.js → CommandCenter-CSRYoveB.js} +1 -1
- package/dist/client/assets/{DevServerView-DcFL_LzK.js → DevServerView-B9So_oYx.js} +1 -1
- package/dist/client/assets/{DirectoryPicker-CtjqrYoO.js → DirectoryPicker-BhyDL_2m.js} +1 -1
- package/dist/client/assets/{DocumentsView-BkAe2S4H.js → DocumentsView-pbERA7O-.js} +1 -1
- package/dist/client/assets/{EvalsView-CbGA9dMn.js → EvalsView-DJQ4ltCg.js} +1 -1
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-CMgO_S8T.js → ExperimentalAgentOnboardingModal-BwJuzkzB.js} +1 -1
- package/dist/client/assets/{GoalsView-_3P9J5sf.js → GoalsView-B6X5_0Ve.js} +1 -1
- package/dist/client/assets/InsightsView-CJgI0J7S.js +11 -0
- package/dist/client/assets/{InsightsView-Gn5lOBA0.css → InsightsView-DAAXuX4v.css} +1 -1
- package/dist/client/assets/{MemoryView-DwJas8vi.js → MemoryView-BHq1AHPu.js} +1 -1
- package/dist/client/assets/{PiExtensionsManager-B_LiW_e9.js → PiExtensionsManager-B8At6fO8.js} +1 -1
- package/dist/client/assets/{PluginManager-BkB6WLQc.js → PluginManager-k7hV7_9e.js} +1 -1
- package/dist/client/assets/{PullRequestView-DcH5tmYc.js → PullRequestView-B1hZFrWo.js} +1 -1
- package/dist/client/assets/{ReportModal-BOEbqtqG.js → ReportModal-C46V_zEa.js} +1 -1
- package/dist/client/assets/{ResearchView-Dp6V42pI.js → ResearchView-D8G85BYN.js} +2 -2
- package/dist/client/assets/{SecretsView-BCqXHB2L.js → SecretsView-CTri9LRK.js} +1 -1
- package/dist/client/assets/{SessionTerminal-CkdoQv4y.js → SessionTerminal-BRf6r4Vp.js} +1 -1
- package/dist/client/assets/SettingsModal-D0RBeZik.js +21 -0
- package/dist/client/assets/{SettingsModal-Dc7YG6KB.js → SettingsModal-rUQcSTJp.js} +1 -1
- package/dist/client/assets/{SettingsTextareaRow-WSkBoAOO.js → SettingsTextareaRow-BirlBcem.js} +1 -1
- package/dist/client/assets/{SetupWizardModal-VTrJAsKd.js → SetupWizardModal-xnCBM9EL.js} +2 -2
- package/dist/client/assets/{SkillsView-CXeXOxfF.js → SkillsView-O5U0ep50.js} +1 -1
- package/dist/client/assets/{WorkflowNodeEditor-DoxLGPRF.js → WorkflowNodeEditor-BX4d2qqF.js} +3 -3
- package/dist/client/assets/{agent-import-generation-upc0yw-M.js → agent-import-generation-DnqVkPkz.js} +1 -1
- package/dist/client/assets/{agentsOrgChartLayout-C3iumMrW.js → agentsOrgChartLayout-CKuzbhFf.js} +1 -1
- package/dist/client/assets/app-B2FwULu2.js +5 -0
- package/dist/client/assets/{app-BA9gw9hx.js → app-B6nJaqAl.js} +2 -2
- package/dist/client/assets/{app-B_lScKc1.js → app-CGXZeIRc.js} +2 -2
- package/dist/client/assets/{app-DG_vjDw5.js → app-CGtkeBF5.js} +3 -3
- package/dist/client/assets/{app-GBgoY-oh.js → app-CNzN1Plu.js} +2 -2
- package/dist/client/assets/{app-B0KFGP8D.js → app-DLs-f5yM.js} +3 -3
- package/dist/client/assets/{app-DeHIOCEP.js → app-DsvtcRUG.js} +2 -2
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-D6jqc3fJ.js → architectureDiagram-3BPJPVTR-gi467xY0.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-DY3AKuPD.js → blockDiagram-GPEHLZMM-B_gpcYiR.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-CpD52V4g.js → c4Diagram-AAUBKEIU-DeylEYsQ.js} +1 -1
- package/dist/client/assets/channel-BoE8DeM4.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-CPeIHyAX.js → chunk-2J33WTMH-BL2WY0HN.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-ivAwI4xM.js → chunk-4BX2VUAB-BkLExGMe.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-BtVQ5XaZ.js → chunk-55IACEB6-CSTvCF5T.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-1eap1vDU.js → chunk-727SXJPM-9J8pKk4x.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-B2NB3BW9.js → chunk-AQP2D5EJ-DXC1vPWr.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-Hk_smNYv.js → chunk-FMBD7UC4-CFRUb-zD.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-BmGCAojk.js → chunk-ND2GUHAM-B87HFYS8.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-D0aXZ8CV.js → chunk-QZHKN3VN-CTjHiGbd.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-qnbLX_9_.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-qnbLX_9_.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-DAbu_gnF.js → cose-bilkent-S5V4N54A-D3Edq3L9.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-BdmLlrDJ.js → dagre-BM42HDAG-CwwbeQfN.js} +1 -1
- package/dist/client/assets/{dashboard-view-CULL1yhL.js → dashboard-view-BLAoW3D4.js} +1 -1
- package/dist/client/assets/{dashboard-view-PRCWCSLm.js → dashboard-view-DAlJxqiJ.js} +1 -1
- package/dist/client/assets/{dashboard-view-BoFBSXUn.js → dashboard-view-QxQwJFLz.js} +1 -1
- package/dist/client/assets/{dashboard-view-CxXMDfNY.js → dashboard-view-aPzfv99T.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-PpqLbVUA.js → diagram-2AECGRRQ-koJWWXE4.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-9rkGmTwh.js → diagram-5GNKFQAL-Yob5cOKT.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-BT-efOMo.js → diagram-KO2AKTUF-DelvFSkK.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-w79OWFxg.js → diagram-LMA3HP47-CMput2h2.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-Bye9I5IO.js → diagram-OG6HWLK6-04VXDl79.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-aodREgDf.js → erDiagram-TEJ5UH35-C9iP8Uyp.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-D0DKItY3.js → flowDiagram-I6XJVG4X-DENQvu_t.js} +1 -1
- package/dist/client/assets/{folder-open-CqvaMJvx.js → folder-open-D-554oji.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-CZVApkvw.js → ganttDiagram-6RSMTGT7-BqOttZAT.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-D_ynwJ4p.js → gitGraphDiagram-PVQCEYII-CDcydi-5.js} +1 -1
- package/dist/client/assets/{index-BzAldNrK.css → index-CXTd3LAB.css} +1 -1
- package/dist/client/assets/{index-DWRJyaa3.js → index-CtYRoouR.js} +264 -264
- package/dist/client/assets/{infoDiagram-5YYISTIA-pJG6zxjk.js → infoDiagram-5YYISTIA-B5LQQnxt.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-nFZ5laUo.js → ishikawaDiagram-YF4QCWOH-DpFEt7D2.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-CWpCaAIe.js → journeyDiagram-JHISSGLW-MELtgu22.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-ATkPspKa.js → kanban-definition-UN3LZRKU-h33PLATd.js} +1 -1
- package/dist/client/assets/{mermaid.core-CDXPNs7a.js → mermaid.core-Dk2mUPOq.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-BkqS9tpe.js → mindmap-definition-RKZ34NQL-B_T4O2-B.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-DEUyVLs-.js → pieDiagram-4H26LBE5-B1YIFkRl.js} +1 -1
- package/dist/client/assets/{puzzle-DQ0y1-XK.js → puzzle-hvecxlpJ.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-ESBJNK5c.js → quadrantDiagram-W4KKPZXB-BoGQR_hO.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-CqPs7zcv.js → requirementDiagram-4Y6WPE33-BSDmUBIx.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-CkFN0m14.js → sankeyDiagram-5OEKKPKP-Dz_GqOa5.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-Dx2nDuMO.js → sequenceDiagram-3UESZ5HK-B6twjYUH.js} +1 -1
- package/dist/client/assets/{shield-alert-BS05s4RM.js → shield-alert-BX4WRJOv.js} +1 -1
- package/dist/client/assets/{standing-instructions-template-xprxYNHm.js → standing-instructions-template-BJY317CC.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-EUPmRFGd.js → stateDiagram-AJRCARHV-DuwqWLx-.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-DcQ2mhi5.js → stateDiagram-v2-BHNVJYJU-Bu8Sk187.js} +1 -1
- package/dist/client/assets/{timeline-definition-PNZ67QCA-D4YO_3V-.js → timeline-definition-PNZ67QCA-BS6VnqSI.js} +1 -1
- package/dist/client/assets/{upload-BjyBtxo7.js → upload-CaDoyaMW.js} +1 -1
- package/dist/client/assets/{users-D5ogZ7WQ.js → users-C5uCLwVM.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-BT5_XuQL.js → vennDiagram-CIIHVFJN-CUbzqT5Y.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-X_ZMW457.js → wardley-L42UT6IY-Mv-NotFS.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-GK9nONHU.js → wardleyDiagram-YWT4CUSO-DuYpvLZX.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-Dw3zXHAq.js → xychartDiagram-2RQKCTM6-24_7QXdw.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/client/version.json +1 -1
- package/dist/droid-cli/package.json +1 -1
- package/dist/extension.js +285 -47
- package/dist/pi-claude-cli/package.json +1 -1
- package/dist/plugin-sdk/index.d.ts +23 -0
- package/dist/plugin-sdk/index.js +2 -0
- package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-claude-runtime/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-claude-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-cli-printing-press/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
- package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
- package/dist/plugins/fusion-plugin-cursor-runtime/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-dependency-graph/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
- package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-grok-runtime/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-grok-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-hermes-runtime/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-linear-import/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-linear-import/package.json +1 -1
- package/dist/plugins/fusion-plugin-omp-runtime/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-omp-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-openclaw-runtime/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-paperclip-runtime/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-quality/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-quality/package.json +1 -1
- package/dist/plugins/fusion-plugin-reports/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-reports/package.json +1 -1
- package/dist/plugins/fusion-plugin-roadmap/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
- package/dist/plugins/fusion-plugin-todos/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-todos/package.json +1 -1
- package/dist/plugins/fusion-plugin-whatsapp-chat/bundled.js +2 -0
- package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
- package/package.json +1 -1
- package/dist/client/assets/InsightsView-DOhO7xH5.js +0 -11
- package/dist/client/assets/SettingsModal-D4Fn4GlS.js +0 -21
- package/dist/client/assets/app-DBCGrz-f.js +0 -5
- package/dist/client/assets/channel-CaxOu15c.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-DXIkGbsl.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DXIkGbsl.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r}from"./vendor-react-SZ_qB27O.js";import{a as n,w as s}from"./index-
|
|
1
|
+
import{r}from"./vendor-react-SZ_qB27O.js";import{a as n,w as s}from"./index-CtYRoouR.js";function x(e){return n(s("/memory/files",e))}function C(e,t){const c=`path=${encodeURIComponent(e)}`;return n(s(`/memory/file?${c}`,t))}function F(e,t,c){return n(s("/memory/file",c),{method:"PUT",body:JSON.stringify({path:e,content:t})})}function J(e,t){return n(s("/memory/compact",t),{method:"POST",body:JSON.stringify(e?{path:e}:{})})}function N(e){return n(s("/memory/dream",e),{method:"POST"})}function W(e){return n(s("/memory/insights",e))}function j(e,t){return n(s("/memory/insights",t),{method:"PUT",body:JSON.stringify({content:e})})}function q(e){return n(s("/memory/extract",e),{method:"POST"})}function D(e){return n(s("/memory/audit",e))}function B(e){return n(s("/memory/backend",e))}function L(e){return n(s("/memory/install-qmd",e),{method:"POST"})}function $(e,t){return n(s("/memory/test",t),{method:"POST",body:JSON.stringify({query:e})})}function Q(e={}){const{projectId:t,pollInterval:c=6e4,autoRefresh:p=!1,enabled:a=!0}=e,[S,y]=r.useState(null),[g,m]=r.useState(a),[M,d]=r.useState(null),[k,v]=r.useState(null),o=r.useRef(null),u=r.useRef(null),l=r.useRef(!0),i=r.useCallback(async()=>{if(!a){m(!1),d(null),y(null);return}o.current&&o.current.abort(),o.current=new AbortController,m(!0),d(null),y(null);try{const f=await B(t);if(!l.current)return;y(f),d(null),v(new Date),m(!1)}catch(f){if(f instanceof Error&&f.name==="AbortError"||!l.current)return;const w=f instanceof Error?f.message:"Failed to fetch memory backend status";d(w),m(!1)}},[a,t]);r.useEffect(()=>(l.current=!0,a?(i(),()=>{l.current=!1}):(o.current&&o.current.abort(),y(null),d(null),m(!1),()=>{l.current=!1})),[a,i]),r.useEffect(()=>{if(!(!a||!p))return u.current=setInterval(()=>{i()},c),()=>{u.current&&(clearInterval(u.current),u.current=null)}},[a,p,c,i]),r.useEffect(()=>()=>{l.current=!1,o.current&&o.current.abort(),u.current&&(clearInterval(u.current),u.current=null)},[]);const I=r.useCallback(()=>i(),[i]),b=g?null:S,R=b?.currentBackend??null,h=b?.capabilities??null,E=b?.availableBackends??[],O=h?.readable??!1,P=h?.writable??!1,T=h?.supportsAtomicWrite??!1;return{status:b,currentBackend:R,capabilities:h,availableBackends:E,isReadable:O,isWritable:P,supportsAtomicWrite:T,loading:g,error:M,lastUpdated:k,refresh:I}}export{x as a,D as b,W as c,j as d,q as e,C as f,N as g,J as h,L as i,F as s,$ as t,Q as u};
|
package/dist/client/assets/{SettingsTextareaRow-WSkBoAOO.js → SettingsTextareaRow-BirlBcem.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h,j as e}from"./vendor-react-SZ_qB27O.js";import{u as
|
|
1
|
+
import{r as h,j as e}from"./vendor-react-SZ_qB27O.js";import{u as j}from"./vendor-i18n-Duky4gdQ.js";import{dl as S,b1 as E}from"./index-CtYRoouR.js";const b="fusion:settings-help-open";function y({children:s,settingKey:l}){const{t:n}=j("app"),[c,o]=h.useState(!1),a=h.useRef(null),p=h.useId(),d=`settings-help-${l??p}`;h.useEffect(()=>{const t=i=>{i.detail!==d&&o(!1)};return document.addEventListener(b,t),()=>document.removeEventListener(b,t)},[d]);const u=()=>{o(t=>{const i=!t;return i&&document.dispatchEvent(new CustomEvent(b,{detail:d})),i})};return h.useEffect(()=>{if(!c)return;const t=r=>{a.current?.contains(r.target)||o(!1)},i=r=>{r.key==="Escape"&&(r.stopPropagation(),o(!1))};return document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",i,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",i,!0)}},[c]),e.jsxs("span",{className:"settings-help","data-open":c?"true":"false",ref:a,children:[e.jsx("button",{type:"button",className:"settings-help-trigger","aria-label":n("settings.help.show","Show help"),"aria-expanded":c,"aria-describedby":d,"data-testid":l?`settings-help-${l}`:void 0,onClick:u,children:e.jsx(S,{size:13,"aria-hidden":!0})}),e.jsx("span",{id:d,role:"note",className:"settings-help-bubble",children:s})]})}const N=h.createContext({highlightedKey:null});function L({highlightedKey:s,children:l}){const n=h.useMemo(()=>({highlightedKey:s}),[s]);return e.jsx(N.Provider,{value:n,children:l})}function k(s){const{highlightedKey:l}=h.useContext(N);return s!==void 0&&s===l}function m({htmlFor:s,label:l,help:n,error:c,scope:o,disabled:a,clearable:p,onClear:d,inlineControl:u,children:t}){const{t:i}=j("app"),r=k(s),g=e.jsxs("div",{className:"settings-field-row-control",children:[t,p&&e.jsx("button",{type:"button",className:"settings-field-row-clear","aria-label":i("settings.clearToDefault","Reset to default"),title:i("settings.clearToDefault","Reset to default"),disabled:a,onClick:d,children:e.jsx(E,{size:13,"aria-hidden":!0})})]}),f=e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"settings-field-row-label",htmlFor:s,children:l}),o&&e.jsx("span",{className:`settings-field-row-scope settings-field-row-scope--${o}`,"data-testid":"settings-field-row-scope",children:o}),n&&e.jsx(y,{settingKey:s,children:n})]});return e.jsxs("div",{className:`settings-field-row${u?" settings-field-row--inline":""}${a?" is-disabled":""}${r?" is-search-match":""}`,"data-settings-key":s,children:[e.jsxs("div",{className:"settings-field-row-head",children:[u&&g,e.jsx("div",{className:"settings-field-row-labelgroup",children:f})]}),!u&&g,c&&e.jsx("p",{className:"settings-field-row-error",role:"alert",children:c})]})}function P({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),inlineControl:!0,children:e.jsx("label",{className:"settings-toggle",children:e.jsx("input",{id:a,type:"checkbox",checked:l===!0,disabled:t,onChange:i=>n(i.target.checked)})})})}function $({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,options:i}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("select",{id:a,className:"select settings-select",value:l??"",disabled:t,onChange:r=>n(r.target.value),children:i.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})})}function H({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,min:i,max:r,step:g,placeholder:f}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("input",{id:a,className:"input settings-number",type:"number",value:l??"",min:i,max:r,step:g,placeholder:f,disabled:t,onChange:x=>{const v=x.target.value;if(v==="")return n(null);const w=Number(v);Number.isNaN(w)||n(w)}})})}function I({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,placeholder:i,type:r,autoComplete:g}=s,f=g??(r==="password"?"off":void 0);return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("input",{id:a,className:"input settings-text",type:r??"text",autoComplete:f,value:l??"",placeholder:i,disabled:t,onChange:x=>n(x.target.value)})})}function D({descriptor:s,value:l,onChange:n,error:c,clearable:o}){const{key:a,label:p,help:d,scope:u,disabled:t,placeholder:i}=s;return e.jsx(m,{htmlFor:a,label:p,help:d,error:c,scope:u,disabled:t,clearable:o,onClear:()=>n(null),children:e.jsx("textarea",{id:a,className:"input settings-textarea",value:l??"",placeholder:i,disabled:t,rows:3,onChange:r=>n(r.target.value)})})}export{m as S,I as a,D as b,$ as c,H as d,P as e,y as f,L as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExperimentalAgentOnboardingModal-
|
|
2
|
-
import{ab as de,B as x,ac as R,ad as G,ae as pe,af as ue,ag as me,ah as L,ai as ge,aj as he,ak as xe,al as fe,F as je,X as we,L as M,g as ye,am as W,S as Ne,an as O,ao as be,a3 as ke}from"./index-DWRJyaa3.js";import{r as o,j as e}from"./vendor-react-SZ_qB27O.js";import{D as Ce}from"./DirectoryPicker-CtjqrYoO.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-CqvaMJvx.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-CMgO_S8T.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-BwJuzkzB.js","assets/vendor-react-SZ_qB27O.js","assets/index-CtYRoouR.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-CXTd3LAB.css","assets/ExperimentalAgentOnboardingModal-3ZEFv8sr.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{ab as de,B as x,ac as R,ad as G,ae as pe,af as ue,ag as me,ah as L,ai as ge,aj as he,ak as xe,al as fe,F as je,X as we,L as M,g as ye,am as W,S as Ne,an as O,ao as be,a3 as ke}from"./index-CtYRoouR.js";import{r as o,j as e}from"./vendor-react-SZ_qB27O.js";import{D as Ce}from"./DirectoryPicker-BhyDL_2m.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-D-554oji.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-BwJuzkzB.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,b as us,t as vs,i as hs,d as gs,e as bs,V as ws,Z as xs,X as H,R as fs,C as js,g as ps,L as A,A as q,h as G,M as J}from"./index-DWRJyaa3.js";import{u as Ns}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";import"./vendor-xterm-BNq00GSj.js";const Ss=new Set([".md",".markdown",".mdx"]);function Cs(r){const d=r.toLowerCase(),j=d.lastIndexOf(".");return j<0?!1:Ss.has(d.slice(j))}function zs({projectId:r,addToast:d,onClose:j}){const{t:e}=Ns("app"),[k,p]=a.useState([]),[F,T]=a.useState(!0),[Y,V]=a.useState(!1),[I,D]=a.useState(null),[_,ss]=a.useState([]),[g,ls]=a.useState(""),[M,B]=a.useState(null),[c,N]=a.useState(null),[b,S]=a.useState(null),[es,K]=a.useState(!1),[Q,C]=a.useState(null),[y,w]=a.useState(null),[u,v]=a.useState(null),[is,z]=a.useState(!1),[$,h]=a.useState(null),m=a.useRef(null),[P,as]=a.useState(""),O=g.trim()?k.filter(l=>l.name.toLowerCase().includes(g.toLowerCase())||l.relativePath.toLowerCase().includes(g.toLowerCase())):k,x=a.useCallback(async()=>{T(!0);try{const l=await ms(r);p(l)}catch(l){const t=l instanceof Error?l.message:e("skills.loadDiscoveredError","Failed to load discovered skills");d(t,"error")}finally{T(!1)}},[r,d]),f=a.useCallback(async l=>{const t=i=>{if(!i||typeof i!="object")return!1;const n=i;if(typeof n.status=="number"&&n.status>=500)return!0;if(n.details&&typeof n.details=="object"){const L=n.details;if(typeof L.code=="string"&&L.code.startsWith("upstream_"))return!0}const o=i;return typeof o.error=="string"&&typeof o.code=="string"};V(!0),D(null);try{const i=await us(l,20,r);ss(i.entries)}catch(i){if(t(i))D(e("skills.catalogUnavailable","Catalog is temporarily unavailable. Please try again later."));else{const n=i instanceof Error?i.message:e("skills.loadCatalogError","Failed to load catalog");D(n)}}finally{V(!1)}},[r]);a.useEffect(()=>{x(),f("")},[x,f]);const ts=a.useCallback(l=>{ls(l),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{as(l),m.current=null},300)},[]);a.useEffect(()=>()=>{m.current&&(clearTimeout(m.current),m.current=null)},[]),a.useEffect(()=>{f(P)},[P,f]);const ns=a.useCallback(async(l,t)=>{const i=!t;p(n=>n.map(o=>o.id===l?{...o,toggling:!0}:o));try{await vs(l,i,r),p(n=>n.map(o=>o.id===l?{...o,enabled:i,toggling:!1}:o)),d(e(`skills.${i?"enabled":"disabled"}`,i?"Skill enabled":"Skill disabled"),"success")}catch(n){p(L=>L.map(R=>R.id===l?{...R,toggling:!1}:R));const o=n instanceof Error?n.message:e("skills.toggleError","Failed to toggle skill");d(e("skills.toggleFailed","Failed to toggle skill: {{message}}",{message:o}),"error")}},[r,d]),cs=a.useCallback(async l=>{const t=l.repo?.trim();if(!(!t||M===l.id)){B(l.id);try{await hs(t,l.slug||l.name,r),d(e("skills.installSuccess","Installed {{name}}",{name:l.name}),"success"),await x()}catch(i){const n=i instanceof Error?i.message:e("skills.installError","Failed to install skill");d(e("skills.installFailed","Failed to install {{name}}: {{message}}",{name:l.name,message:n}),"error")}finally{B(i=>i===l.id?null:i)}}},[d,M,x,r]),E=a.useCallback(async l=>{K(!0),C(null),S(null),w(null),v(null),h(null);try{const t=await gs(l,r);S(t)}catch(t){const i=t instanceof Error?t.message:e("skills.loadContentError","Failed to load skill content");C(i)}finally{K(!1)}},[r]),U=a.useCallback((l,t)=>{if(!(t&&t.target.closest(".skills-view-item-toggle"))){if(c===l){N(null),S(null),C(null),w(null),v(null),h(null);return}N(l),E(l)}},[c,E]),os=a.useCallback(l=>{c!==l&&N(l),E(l)},[E,c]),W=a.useCallback(async(l,t)=>{w(t),v(null),h(null),z(!0);try{const i=await bs(l,t,r);v(i)}catch(i){const n=i instanceof Error?i.message:e("skills.loadFileError","Failed to load file");h(n)}finally{z(!1)}},[r]),rs=a.useCallback(()=>{w(null),v(null),h(null),z(!1)},[]),X=a.useCallback(()=>{N(null),S(null),C(null),w(null),v(null),h(null)},[]),ds=a.useMemo(()=>k.find(l=>l.id===c)??null,[k,c]),Z=()=>!b||b.files.length===0?null:s.jsxs("div",{className:"skills-view-detail-files","data-testid":"skill-files",children:[s.jsxs("span",{className:"skills-view-detail-files-label",children:[e("skills.filesLabel","Files"),":"]}),b.files.map(l=>{if(l.type==="directory")return s.jsxs("span",{className:"badge badge--sm skills-view-detail-file--dir",children:[l.name,"/"]},l.relativePath);const t=y===l.relativePath;return s.jsx("button",{type:"button","data-testid":"skill-file-item",className:`badge badge--sm skills-view-detail-file${t?" skills-view-detail-file--active":""}`,onClick:()=>c&&void W(c,l.relativePath),"aria-pressed":t,"aria-label":e("skills.viewFile","View {{name}}",{name:l.name}),children:l.name},l.relativePath)})]}),ks=()=>c?es?s.jsxs("div",{className:"skills-view-detail-loading",children:[s.jsx(A,{size:16,className:"spin"}),e("skills.loadingContent","Loading skill content...")]}):Q?s.jsxs("div",{className:"skills-view-detail-error",children:[s.jsx(G,{size:14}),s.jsx("span",{children:Q}),s.jsx("button",{className:"btn btn-sm",onClick:()=>os(c),children:e("common.retry","Retry")})]}):b?y!==null?s.jsxs("div",{className:"skills-view-file-viewer","data-testid":"skill-file-viewer",children:[s.jsxs("div",{className:"skills-view-file-viewer-bar",children:[s.jsxs("button",{type:"button",className:"btn btn-sm skills-view-file-back",onClick:rs,"data-testid":"skill-file-back","aria-label":e("skills.backToSkillMd","Back to SKILL.md"),children:[s.jsx(q,{size:14}),e("skills.backToSkillMd","Back to SKILL.md")]}),s.jsx("span",{className:"skills-view-file-viewer-name",children:y})]}),is?s.jsxs("div",{className:"skills-view-detail-loading",children:[s.jsx(A,{size:16,className:"spin"}),e("skills.loadingFile","Loading file...")]}):$?s.jsxs("div",{className:"skills-view-detail-error",children:[s.jsx(G,{size:14}),s.jsx("span",{children:$}),s.jsx("button",{className:"btn btn-sm",onClick:()=>c&&void W(c,y),children:e("common.retry","Retry")})]}):u&&!u.isText?s.jsx("div",{className:"skills-view-detail-empty",children:e("skills.fileNotPreviewable","This file cannot be previewed.")}):u?Cs(u.relativePath)?s.jsx(J,{content:u.content||e("skills.emptyFile","(Empty file)"),className:"skills-view-detail-markdown",testId:"skills-view-detail-markdown"}):s.jsx("pre",{className:"skills-view-detail-content",children:u.content||e("skills.emptyFile","(Empty file)")}):null,Z()]}):s.jsxs(s.Fragment,{children:[s.jsx(J,{content:b.skillMd||e("skills.noSkillMd","(No SKILL.md found)"),className:"skills-view-detail-markdown",testId:"skills-view-detail-markdown"}),Z()]}):null:s.jsx("div",{className:"skills-view-detail-placeholder","data-testid":"skills-detail-empty",children:e("skills.selectASkill","Select a skill to view its details")});return s.jsxs("div",{className:"skills-view","data-testid":"skills-view","data-selected":c?"true":"false",children:[s.jsx(ws,{icon:xs,title:e("skills.title","Skills"),actions:s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"skills-view-count","aria-label":e("skills.discoveredCount","{{count}} discovered skills",{count:k.length}),children:[k.length," ",e("skills.discovered","discovered")]}),s.jsx("button",{className:"btn-icon skills-view-close touch-target",onClick:j,"aria-label":e("skills.closeView","Close skills view"),children:s.jsx(H,{size:16})}),s.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),disabled:F,children:[s.jsx(fs,{size:14,className:F?"spin":""}),e("common.refresh","Refresh")]})]})}),s.jsxs("div",{className:"skills-view-body",children:[s.jsx("div",{className:"skills-view__list","data-testid":"skills-list",children:s.jsxs("div",{className:"skills-view-content",children:[s.jsx("div",{className:"skills-view-search",children:s.jsx("input",{type:"text",className:"form-input",placeholder:e("skills.searchPlaceholder","Search skills..."),value:g,onChange:l=>ts(l.target.value),"aria-label":e("skills.searchLabel","Search skills")})}),s.jsxs("section",{className:"skills-view-section","aria-labelledby":"discovered-skills-title",children:[s.jsx("h3",{id:"discovered-skills-title",className:"skills-view-section-title",children:e("skills.discoveredSection","Discovered Skills")}),F?s.jsxs("div",{className:"skills-view-loading",children:[s.jsx("span",{className:"spinner"}),e("skills.loadingDiscovered","Loading discovered skills...")]}):k.length===0?s.jsx("div",{className:"skills-view-empty",children:s.jsx("p",{children:e("skills.noDiscovered","No skills discovered in this project.")})}):O.length===0?s.jsx("div",{className:"skills-view-empty",children:s.jsx("p",{children:e("skills.noMatchingDiscovered","No discovered skills match your search.")})}):s.jsx("div",{className:"skills-view-list",children:O.map(l=>{const t=c===l.id;return s.jsx("div",{children:s.jsxs("div",{className:`skills-view-item${t?" skills-view-item--selected":""}`,onClick:i=>U(l.id,i),role:"button",tabIndex:0,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),U(l.id))},"aria-expanded":t,"aria-label":e("skills.viewDetails","View details for {{name}}",{name:l.name}),children:[s.jsxs("div",{className:"skills-view-item-info",children:[s.jsxs("span",{className:"skills-view-item-name",children:[t?s.jsx(js,{size:14}):s.jsx(ps,{size:14}),s.jsx("span",{className:"skills-view-item-name-text",children:l.name})]}),s.jsx("span",{className:"skills-view-item-path",children:l.relativePath}),s.jsx("span",{className:"skills-view-item-source",children:l.metadata.source})]}),s.jsxs("label",{className:"skills-view-item-toggle",onClick:i=>i.stopPropagation(),children:[s.jsx("input",{type:"checkbox",checked:l.enabled,disabled:l.toggling,onChange:()=>void ns(l.id,l.enabled),"aria-label":e(`skills.${l.enabled?"disable":"enable"}Skill`,l.enabled?"Disable {{name}}":"Enable {{name}}",{name:l.name})}),s.jsx("span",{className:"skills-view-toggle-slider"})]})]})},l.id)})})]}),s.jsxs("section",{className:"skills-view-section","aria-labelledby":"catalog-title",children:[s.jsx("h3",{id:"catalog-title",className:"skills-view-section-title",children:e("skills.catalogSection","Skills Catalog")}),I?s.jsxs("div",{className:"skills-view-error",children:[s.jsx("p",{children:I}),s.jsx("button",{className:"btn btn-sm",onClick:()=>void f(P),children:e("common.tryAgain","Try Again")})]}):Y?s.jsxs("div",{className:"skills-view-loading",children:[s.jsx("span",{className:"spinner"}),e("skills.loadingCatalog","Loading catalog...")]}):_.length===0?s.jsx("div",{className:"skills-view-empty",children:g?s.jsx("p",{children:e("skills.noMatchingSearch","No skills match your search.")}):s.jsx("p",{children:e("skills.noCatalogAvailable","No skills available in the catalog.")})}):s.jsx("div",{className:"skills-view-grid",children:_.map(l=>{const i=!!l.repo?.trim(),n=M===l.id;return s.jsxs("div",{className:"skills-view-card",children:[s.jsxs("div",{className:"skills-view-card-header",children:[s.jsx("h4",{className:"skills-view-card-title",children:l.name}),i?s.jsxs("button",{type:"button",className:"btn btn-sm skills-view-card-install",onClick:()=>void cs(l),disabled:n,"aria-label":e("skills.installSkill","Install {{name}}",{name:l.name}),children:[n?s.jsx(A,{size:14,className:"spin"}):null,n?e("skills.installing","Installing…"):e("skills.install","Install")]}):null]}),l.description&&s.jsx("p",{className:"skills-view-card-description",children:l.description}),l.tags&&l.tags.length>0&&s.jsx("div",{className:"skills-view-card-tags",children:l.tags.map(o=>s.jsx("span",{className:"badge badge--sm",children:o},o))}),l.installs!==void 0&&s.jsx("span",{className:"skills-view-card-installs",children:e("skills.installsCount","{{value}} installs",{value:l.installs.toLocaleString()})})]},l.id)})})]})]})}),s.jsxs("div",{className:"skills-view__detail","data-testid":"skill-detail",children:[s.jsxs("div",{className:"skills-view-detail-header",children:[s.jsx("button",{type:"button",className:"btn btn-sm btn-icon skills-view-detail-back",onClick:X,"aria-label":e("skills.backToList","Back to skills"),title:e("skills.backToList","Back to skills"),"data-testid":"skills-detail-back",children:s.jsx(q,{size:14})}),s.jsx("span",{className:"skills-view-detail-title",children:ds?.name??e("skills.detailTitle","Skill")}),s.jsxs("button",{className:"btn btn-sm skills-view-detail-close",onClick:X,disabled:!c,"aria-label":e("skills.closeDetail","Close skill detail"),children:[s.jsx(H,{size:14}),e("common.close","Close")]})]}),s.jsx("div",{className:"skills-view-detail-body",children:ks()})]})]})]})}export{zs as SkillsView};
|
|
1
|
+
import{r as a,j as s}from"./vendor-react-SZ_qB27O.js";import{f as ms,b as us,t as vs,i as hs,d as gs,e as bs,V as ws,Z as xs,X as H,R as fs,C as js,g as ps,L as A,A as q,h as G,M as J}from"./index-CtYRoouR.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};
|