@runfusion/fusion 0.73.0-beta.4 → 0.73.0-beta.6
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 +3558 -1630
- package/dist/child-process-worker.js +2037 -795
- package/dist/client/.vite/manifest.json +265 -265
- package/dist/client/assets/AgentDetailView-CoeSgMXS.css +1 -0
- package/dist/client/assets/{AgentDetailView-BBOL6AgZ.js → AgentDetailView-jg-430Wv.js} +4 -4
- package/dist/client/assets/{AgentPermissionPolicyEditor-DV7OPUhR.js → AgentPermissionPolicyEditor-0iybC0Dg.js} +1 -1
- package/dist/client/assets/AgentPermissionPolicyEditor-CXib-igK.css +1 -0
- package/dist/client/assets/AgentsView-DeVI7IJy.js +24 -0
- package/dist/client/assets/ChatView-BWosYwf6.js +8 -0
- package/dist/client/assets/{CommandCenter-DYWaoYFD.js → CommandCenter-CPpYSmxm.js} +1 -1
- package/dist/client/assets/{DevServerView-BY5up-NA.js → DevServerView-C7Uib0ck.js} +1 -1
- package/dist/client/assets/{DirectoryPicker-fM8MJa2r.js → DirectoryPicker-Ba9x3E72.js} +1 -1
- package/dist/client/assets/{DocumentsView-D2KxsPG_.js → DocumentsView-DkuxxEAC.js} +1 -1
- package/dist/client/assets/{EvalsView-U8dOvTRM.js → EvalsView-DwRsXihY.js} +1 -1
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-C27y8Y-1.js → ExperimentalAgentOnboardingModal-C2g8TiAY.js} +1 -1
- package/dist/client/assets/{GoalsView-D-2wmy-O.js → GoalsView-hQSajINq.js} +1 -1
- package/dist/client/assets/{InsightsView-zLyuQL_l.js → InsightsView-p7j5T5a8.js} +1 -1
- package/dist/client/assets/{MemoryView-D-tSn48u.js → MemoryView-DoVBk38U.js} +1 -1
- package/dist/client/assets/{PiExtensionsManager-DvwmvGEY.js → PiExtensionsManager-DzT94cPg.js} +1 -1
- package/dist/client/assets/{PluginManager-BACOwQAN.js → PluginManager-5DK-HUkf.js} +1 -1
- package/dist/client/assets/{PullRequestView-DULyv21u.js → PullRequestView-c8_Nl91A.js} +1 -1
- package/dist/client/assets/{ReportModal-CUlKMFWa.js → ReportModal-BfNu73zb.js} +5 -5
- package/dist/client/assets/{ResearchView-DM_O3IFc.js → ResearchView-Cc_DZq5v.js} +2 -2
- package/dist/client/assets/{SecretsView-Bq3u_nAf.js → SecretsView-DMETxbnI.js} +1 -1
- package/dist/client/assets/{SessionTerminal-D00ByR6U.js → SessionTerminal-B4c2w5zb.js} +1 -1
- package/dist/client/assets/{SettingsModal-QRaBE1ds.js → SettingsModal-oTMDyzjF.js} +1 -1
- package/dist/client/assets/SettingsModal-vpkxpahA.js +21 -0
- package/dist/client/assets/{SettingsTextareaRow-CHOJ-qHz.js → SettingsTextareaRow-B63cJNsI.js} +1 -1
- package/dist/client/assets/{SetupWizardModal-DriQyd81.js → SetupWizardModal-BZnyRPT7.js} +2 -2
- package/dist/client/assets/{SkillsView-BtDyujiZ.js → SkillsView-DGwWIOqX.js} +1 -1
- package/dist/client/assets/{TodoView-BNHUnz50.js → TodoView-BoLH6qHP.js} +1 -1
- package/dist/client/assets/{WorkflowNodeEditor-BXikFpra.js → WorkflowNodeEditor-DHqpPcSv.js} +1 -1
- package/dist/client/assets/{WorkflowNodeEditor-BNgkFJ_P.css → WorkflowNodeEditor-nCx4nqoL.css} +1 -1
- package/dist/client/assets/{agent-import-generation-B2kYEm1O.js → agent-import-generation-Dl3UAfFr.js} +1 -1
- package/dist/client/assets/app-B4dURBVF.js +13 -0
- package/dist/client/assets/{app-B_HrdDXZ.js → app-DLG7AA6O.js} +3 -3
- package/dist/client/assets/app-DfQxLcCr.js +13 -0
- package/dist/client/assets/app-DxbSLeuH.js +13 -0
- package/dist/client/assets/app-JOLkwq4O.js +13 -0
- package/dist/client/assets/app-R0cG-sq5.js +13 -0
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-B-Efjj4Z.js → architectureDiagram-3BPJPVTR-DRSMeXsR.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-CaOVxrlM.js → blockDiagram-GPEHLZMM-xBxQf_Gy.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-D8aYt5F1.js → c4Diagram-AAUBKEIU-CememwlP.js} +1 -1
- package/dist/client/assets/channel-DwxxVJWv.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-VSDT0J0r.js → chunk-2J33WTMH-B62t8Ow1.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-Chx1wQgD.js → chunk-4BX2VUAB-CHzxnH6A.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-MlqjhIJg.js → chunk-55IACEB6-BXJotoWf.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-BheQNUi8.js → chunk-727SXJPM-DGFhyp03.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-C5EoJhfJ.js → chunk-AQP2D5EJ-C-nRZZBE.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-B8_8qP3j.js → chunk-FMBD7UC4-CFS2iW51.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-BuglCGRx.js → chunk-ND2GUHAM-DFleK3tP.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-B7_06dxp.js → chunk-QZHKN3VN-E7rqTspj.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-CU_MxE3u.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CU_MxE3u.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-Cm-ZOycx.js → cose-bilkent-S5V4N54A-VYcUIreA.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-Dj_Gwjpv.js → dagre-BM42HDAG-B4VeH0Nz.js} +1 -1
- package/dist/client/assets/{dashboard-view-B4CRL5Fy.js → dashboard-view-BpeWPcmh.js} +1 -1
- package/dist/client/assets/{dashboard-view-noD9p0Zs.js → dashboard-view-DGcOsOey.js} +1 -1
- package/dist/client/assets/{dashboard-view-pXXSUxG9.js → dashboard-view-DoNpCbHQ.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-C_9BfShy.js → diagram-2AECGRRQ-BM8FU7fY.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-Cmg2qpCj.js → diagram-5GNKFQAL-Do8IJG5T.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-2FNo2HXb.js → diagram-KO2AKTUF-C_-zygdh.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-DgnVeCp-.js → diagram-LMA3HP47-CSPiBke9.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-iAIR50HH.js → diagram-OG6HWLK6-BVuoiZg-.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-Da4I04eN.js → erDiagram-TEJ5UH35-CIY48OYH.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-Bv9r2T0m.js → flowDiagram-I6XJVG4X-B6zav8SR.js} +1 -1
- package/dist/client/assets/{folder-open-CwWtrDh6.js → folder-open-Dc23V8n6.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-BMeO84U_.js → ganttDiagram-6RSMTGT7-_F49rUcG.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-CWDh_RIb.js → gitGraphDiagram-PVQCEYII-Fk-V-buo.js} +1 -1
- package/dist/client/assets/index-C77ORgtm.css +1 -0
- package/dist/client/assets/index-D8TQBkB7.js +2661 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-BAE4KtCL.js → infoDiagram-5YYISTIA-DvnBGHv4.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-C_iXAuOy.js → ishikawaDiagram-YF4QCWOH-Df7TrITT.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-BnxSHwDo.js → journeyDiagram-JHISSGLW-CieUO8Cz.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-DYNRm3Nu.js → kanban-definition-UN3LZRKU-BBR_Cj7I.js} +1 -1
- package/dist/client/assets/{mermaid.core-B3hvDDep.js → mermaid.core-whEVIkYk.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-s7KBEuPD.js → mindmap-definition-RKZ34NQL-utsoG884.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-Cy1_IPUD.js → pieDiagram-4H26LBE5-B6_-ma_S.js} +1 -1
- package/dist/client/assets/{puzzle-DWc6gFQ7.js → puzzle-CY7o6u4N.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-DqgVGp41.js → quadrantDiagram-W4KKPZXB-CCAEPNEU.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-CA5-TDeF.js → requirementDiagram-4Y6WPE33-C0rKKe1e.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-Cuvi3RgE.js → sankeyDiagram-5OEKKPKP-DpeRsnkc.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-Da3GfmGP.js → sequenceDiagram-3UESZ5HK-DWYg86A1.js} +1 -1
- package/dist/client/assets/{shield-alert-_iY63ED4.js → shield-alert-j_jHfoeI.js} +1 -1
- package/dist/client/assets/{standing-instructions-template-CCd2YY9c.js → standing-instructions-template-CCI99V8d.js} +1 -1
- package/dist/client/assets/standing-instructions-template-Ddi_4TIk.css +1 -0
- package/dist/client/assets/{stateDiagram-AJRCARHV-CZ_I9ENR.js → stateDiagram-AJRCARHV-CalOQ-6v.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-BomoRVhY.js → stateDiagram-v2-BHNVJYJU-Dd8RLebl.js} +1 -1
- package/dist/client/assets/{timeline-definition-PNZ67QCA-C3CYvIuR.js → timeline-definition-PNZ67QCA-D1PZw-aB.js} +1 -1
- package/dist/client/assets/{upload-D0RrO65v.js → upload-CFL3ZlNN.js} +1 -1
- package/dist/client/assets/{users-CGszBY2v.js → users-DGOPLxzy.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-By9fi8NW.js → vennDiagram-CIIHVFJN-DKQAihMR.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-DErnXPkI.js → wardley-L42UT6IY-B_XzYoGe.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-DFfXZVPk.js → wardleyDiagram-YWT4CUSO-DBu7IvQK.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-9Y5oZ5mi.js → xychartDiagram-2RQKCTM6-CKrqMXvh.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/client/version.json +1 -1
- package/dist/extension.js +3188 -1079
- package/dist/migrations/0000_initial.sql +2 -0
- package/dist/migrations/0034_milestone_assertion_provenance.sql +30 -0
- package/dist/migrations/0035_fn_8543_mission_lineage_stop.sql +31 -0
- package/dist/plugin-sdk/index.js +16 -0
- package/package.json +1 -1
- package/skill/fusion/references/extension-tools.md +1 -1
- package/skill/fusion/references/fusion-capabilities.md +1 -1
- package/dist/client/assets/AgentDetailView-C4vItBCo.css +0 -1
- package/dist/client/assets/AgentPermissionPolicyEditor-TpdlOWZW.css +0 -1
- package/dist/client/assets/AgentsView-B6xoAHyV.js +0 -24
- package/dist/client/assets/ChatView-DwVjnxM8.js +0 -8
- package/dist/client/assets/SettingsModal-Bb3pIxiX.js +0 -21
- package/dist/client/assets/app-C6yo-M_n.js +0 -13
- package/dist/client/assets/app-CH8ZgPm4.js +0 -13
- package/dist/client/assets/app-D4DpgDss.js +0 -13
- package/dist/client/assets/app-Qv0blCyY.js +0 -13
- package/dist/client/assets/app-kFdtajPy.js +0 -13
- package/dist/client/assets/channel-5bPK6pTS.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-Dv9RQDqG.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Dv9RQDqG.js +0 -1
- package/dist/client/assets/index-CB3mYxAB.css +0 -1
- package/dist/client/assets/index-CE7C_XsS.js +0 -2661
- package/dist/client/assets/standing-instructions-template-bQJ4X1gH.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as r}from"./vendor-react-SZ_qB27O.js";import{a5 as z,a6 as D,a7 as S,a8 as f,g as j,a9 as T,E as B,p as A,P as L,L as K,h as N}from"./index-
|
|
1
|
+
import{r as n,j as r}from"./vendor-react-SZ_qB27O.js";import{a5 as z,a6 as D,a7 as S,a8 as f,g as j,a9 as T,E as B,p as A,P as L,L as K,h as N}from"./index-D8TQBkB7.js";import{u as R}from"./vendor-i18n-GF3RlKbq.js";import{F as U}from"./folder-open-Dc23V8n6.js";function M({value:b,onChange:h,placeholder:F,onInputKeyDown:g,nodeId:k,localNodeId:m,selectCreatedDirectory:x=!1}){const{t:i}=R("app"),[e,s]=n.useState({isOpen:!1,loading:!1,error:null,currentPath:"",parentPath:null,entries:[],showHidden:!1,createFolderOpen:!1,createFolderError:null}),[p,u]=n.useState(""),d=n.useCallback(async(t,c=!1)=>{s(o=>({...o,loading:!0,error:null}));try{const o=await z(t,c,k,m);s(a=>({...a,loading:!1,currentPath:o.currentPath,parentPath:o.parentPath,entries:o.entries}))}catch(o){s(a=>({...a,loading:!1,error:o instanceof Error?o.message:"Failed to browse directory"}))}},[k,m]),C=n.useCallback(()=>{s(t=>t.isOpen?{...t,isOpen:!1}:{...t,isOpen:!0})},[]);n.useEffect(()=>{e.isOpen&&!e.loading&&!e.currentPath&&!e.error&&d(b||void 0,e.showHidden)},[e.isOpen,e.loading,e.currentPath,e.error,b,e.showHidden,d,k,m]);const y=n.useCallback(t=>{d(t,e.showHidden)},[d,e.showHidden]),H=n.useCallback(()=>{h(e.currentPath),s(t=>({...t,isOpen:!1}))},[e.currentPath,h]),E=n.useCallback(()=>{s(t=>{const c=!t.showHidden;return{...t,showHidden:c}})},[]);n.useEffect(()=>{e.isOpen&&e.currentPath&&d(e.currentPath,e.showHidden)},[e.showHidden,d]);const w=n.useCallback(()=>{s(t=>({...t,createFolderOpen:!t.createFolderOpen,createFolderError:null})),u("")},[]),P=n.useCallback(async()=>{if(!p.trim()||!e.currentPath)return;const t=p.trim();if(t.includes("/")||t.includes("\\")||t.includes("..")){s(a=>({...a,createFolderError:i("dirPicker.createFolderError","Folder name cannot contain path separators or '..'")}));return}const c=e.currentPath.includes("\\")?"\\":"/",o=e.currentPath.endsWith(c)?e.currentPath+t:e.currentPath+c+t;s(a=>({...a,loading:!0,createFolderError:null}));try{const a=await D(o);u(""),s(l=>({...l,createFolderOpen:!1})),x?(h(a.path),await d(a.path,e.showHidden),s(l=>l.error?{...l,isOpen:!1,error:null}:l)):await d(e.currentPath,e.showHidden)}catch(a){s(l=>({...l,loading:!1,createFolderError:a instanceof Error?a.message:"Failed to create folder"}))}},[p,e.currentPath,e.showHidden,d,h,x]),O=n.useCallback(t=>{t.key==="Enter"?(t.preventDefault(),P()):t.key==="Escape"&&(s(c=>({...c,createFolderOpen:!1,createFolderError:null})),u(""))},[P]),v=e.currentPath?S(e.currentPath):[];return r.jsxs("div",{className:"directory-picker",children:[r.jsxs("div",{className:"directory-picker-input-row",children:[r.jsx("input",{type:"text",className:"input directory-picker-input",value:b,onChange:t=>h(t.target.value),onKeyDown:g,placeholder:F||i("dirPicker.defaultPlaceholder","/path/to/your/project")}),r.jsxs("button",{type:"button",className:"btn btn-secondary btn-sm directory-picker-browse-btn",onClick:C,"aria-label":e.isOpen?i("dirPicker.closeBrowser","Close directory browser"):i("dirPicker.openBrowser","Browse directories"),children:[e.isOpen?r.jsx(U,{size:16}):r.jsx(f,{size:16}),r.jsx("span",{children:i("dirPicker.browse","Browse")})]})]}),e.isOpen&&r.jsxs("div",{className:"directory-picker-browser",role:"tree","aria-label":i("dirPicker.ariaLabel","Directory browser"),children:[r.jsx("div",{className:"directory-picker-breadcrumbs",children:v.map((t,c)=>r.jsxs("span",{className:"directory-picker-breadcrumb-item",children:[c>0&&r.jsx(j,{size:12,className:"directory-picker-breadcrumb-sep"}),r.jsx("button",{type:"button",className:"directory-picker-breadcrumb",onClick:()=>y(t.path),title:t.path,children:t.label})]},t.path))}),r.jsxs("div",{className:"directory-picker-toolbar",children:[e.parentPath&&r.jsxs("button",{type:"button",className:"btn btn-sm btn-secondary directory-picker-up-btn",onClick:()=>y(e.parentPath),"aria-label":i("dirPicker.parentDir","Go to parent directory"),title:i("dirPicker.parentDirTitle","Parent directory"),children:[r.jsx(T,{size:14}),r.jsx("span",{children:i("dirPicker.up","Up")})]}),r.jsxs("button",{type:"button",className:"btn btn-sm btn-secondary directory-picker-hidden-toggle",onClick:E,"aria-label":e.showHidden?i("dirPicker.hideHiddenAria","Hide hidden directories"):i("dirPicker.showHiddenAria","Show hidden directories"),title:e.showHidden?i("dirPicker.hideHiddenTitle","Hide hidden"):i("dirPicker.showHiddenTitle","Show hidden"),children:[e.showHidden?r.jsx(B,{size:14}):r.jsx(A,{size:14}),r.jsx("span",{children:e.showHidden?i("dirPicker.hideHidden","Hide hidden"):i("dirPicker.showHidden","Show hidden")})]}),r.jsxs("button",{type:"button",className:"btn btn-sm btn-secondary directory-picker-create-folder-toggle",onClick:w,"aria-label":i("dirPicker.createFolderAria","Create new folder"),title:i("dirPicker.createFolderTitle","Create folder"),children:[r.jsx(L,{size:14}),r.jsx("span",{children:i("dirPicker.createFolder","New folder")})]})]}),e.loading?r.jsxs("div",{className:"directory-picker-loading",children:[r.jsx(K,{size:20,className:"animate-spin"}),r.jsx("span",{children:i("dirPicker.loading","Loading…")})]}):e.error?r.jsxs("div",{className:"directory-picker-error",children:[r.jsx(N,{size:16}),r.jsx("span",{children:e.error})]}):r.jsx("div",{className:"directory-picker-entries",children:e.entries.length===0?r.jsx("div",{className:"directory-picker-empty",children:i("dirPicker.noSubdirs","No subdirectories")}):e.entries.map(t=>r.jsxs("button",{type:"button",className:"directory-picker-entry",onClick:()=>y(t.path),role:"treeitem",title:t.path,children:[r.jsx(f,{size:16,className:"directory-picker-entry-icon"}),r.jsx("span",{className:"directory-picker-entry-name",children:t.name}),t.hasChildren&&r.jsx(j,{size:14,className:"directory-picker-entry-arrow"})]},t.path))}),e.createFolderOpen&&r.jsxs("div",{className:"directory-picker-create-folder",children:[r.jsx("input",{type:"text",className:"input directory-picker-create-folder-input",value:p,onChange:t=>u(t.target.value),onKeyDown:O,placeholder:i("dirPicker.newFolderPlaceholder","Folder name"),autoFocus:!0}),r.jsxs("div",{className:"directory-picker-create-folder-actions",children:[r.jsx("button",{type:"button",className:"btn btn-sm btn-primary",onClick:P,disabled:!p.trim()||e.loading||!e.currentPath,children:i("dirPicker.createFolderConfirm","Create")}),r.jsx("button",{type:"button",className:"btn btn-sm btn-secondary",onClick:w,children:i("dirPicker.cancel","Cancel")})]}),e.createFolderError&&r.jsxs("div",{className:"directory-picker-create-folder-error",children:[r.jsx(N,{size:14}),r.jsx("span",{children:e.createFolderError})]})]}),r.jsxs("div",{className:"directory-picker-actions",children:[r.jsx("span",{className:"directory-picker-selected-path",title:e.currentPath,children:e.currentPath}),r.jsx("button",{type:"button",className:"btn btn-primary directory-picker-select-btn",onClick:H,children:i("dirPicker.select","Select")})]})]})]})}export{M as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as e}from"./vendor-react-SZ_qB27O.js";import{ao as qe,ap as Ue,aq as Rt,ar as Ht,as as zt,at as Ke,au as $t,av as Ot,aw as fe,ax as It,ay as _e,az as Bt,aA as qt,aB as Ut,aC as _t,aD as Ae,aE as Vt,aF as Ve,V as Qt,aG as ce,E as Wt,p as Gt,aH as Kt,X as Xt,R as Yt,aI as ke,A as Qe,v as We,aJ as Ge,j as De,r as Ee,aK as Jt,aL as Xe,aM as Zt,aN as es,aO as ts,aP as ss,z as ns,aQ as as,aR as cs}from"./index-CE7C_XsS.js";import{u as os}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";function rs(a){const{projectId:r,searchQuery:g,includeProjectFiles:P=!0}=a??{},x=r?`${Rt.DOCUMENTS_PREFIX}${r}`:null,[t,i]=n.useState(()=>{if(!x)return[];const N=qe(x,{maxAgeMs:Ue});return Array.isArray(N)?N:[]}),[A,d]=n.useState([]),[k,b]=n.useState(()=>t.length===0),[u,C]=n.useState(null),m=n.useRef(null),f=n.useRef(t.length>0),p=n.useRef(null),{capture:D}=Ht(r,"useDocuments"),S=n.useCallback(async()=>{const N=D();m.current&&m.current.abort();const J=new AbortController;m.current=J;const $=!f.current;$&&b(!0),C(null);const Z=zt(g?{q:g}:void 0,r),U=P?Ke(r):Promise.resolve({files:[]}),[w,re]=await Promise.allSettled([Z,U]);if(J.signal.aborted||N.isStale())return;let O=null;if(w.status==="fulfilled"){if(i(w.value),x){const _=w.value.length>500?w.value.slice(0,500):w.value;$t(x,_,{maxBytes:5e5})}f.current=!0}else O=w.reason instanceof Error?w.reason.message:String(w.reason);if(re.status==="fulfilled"){const _=re.value.files,G=g?.trim().toLowerCase(),ie=G?_.filter(ee=>ee.name.toLowerCase().includes(G)||ee.path.toLowerCase().includes(G)):_;d(ie)}C(O),$&&b(!1)},[x,D,P,r,g]);return n.useEffect(()=>{if(d([]),!x){f.current=!1,i([]),b(!0);return}const N=qe(x,{maxAgeMs:Ue});Array.isArray(N)?(i(N),f.current=!0,b(!1)):(f.current=!1,i([]),b(!0))},[x]),n.useEffect(()=>(p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{S()},300),()=>{p.current&&clearTimeout(p.current)}),[S]),n.useEffect(()=>(S(),()=>{m.current&&m.current.abort()}),[]),{documents:t,projectFiles:A,loading:k,error:u,refresh:S}}function is(a,r){const[g,P]=n.useState([]),[x,t]=n.useState(!0),[i,A]=n.useState(null),d=n.useRef(null),k=n.useRef(!1),b=r?.showHidden??!1,u=n.useCallback(async C=>{d.current&&d.current.abort();const m=new AbortController;d.current=m;const f=!k.current;f&&t(!0),A(null);try{const p=await Ke(a,{showHidden:C?.showHidden??b});if(m.signal.aborted)return;P(p.files),k.current=!0}catch(p){if(m.signal.aborted)return;A(p instanceof Error?p.message:String(p))}finally{!m.signal.aborted&&f&&t(!1)}},[a,b]);return n.useEffect(()=>(k.current=!1,u({showHidden:b}),()=>{d.current&&d.current.abort()}),[u,b]),{files:g,loading:x,error:i,refresh:u}}const ls=768,ds={image:ss,doc:ce,pdf:ts,video:es,audio:Zt,other:Xe};function oe(a){return a?new Date(a).toLocaleString():""}function us(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(a>=10*1024?0:1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function ms(a){return a==="done"?"status-dot status-dot--online":a==="archived"?"status-dot status-dot--offline":a==="todo"||a==="triage"?"status-dot status-dot--pending":"status-dot status-dot--connecting"}function Ye(a,r){switch(r){case"image":return a("documents.artifactCategoryImage","Image");case"doc":return a("documents.artifactCategoryDoc","Document");case"pdf":return a("documents.artifactCategoryPdf","PDF");case"video":return a("documents.artifactCategoryVideo","Video");case"audio":return a("documents.artifactCategoryAudioSingle","Audio");case"other":return a("documents.artifactCategoryOtherSingle","Other")}}function hs(a,r){return r?[a.title,a.description,a.taskId,a.taskTitle,a.mimeType,a.authorId].some(g=>g?.toLowerCase().includes(r)):!0}function fs(a){const r=a.mimeType?.toLowerCase().split(";",1)[0]??"";return!!a.content||a.type==="document"||r.startsWith("text/")||r==="application/json"||r==="application/xml"}function ks({artifact:a,projectId:r,content:g,loading:P,error:x,renderMarkdown:t,onToggleMarkdown:i,onOpenTask:A,t:d}){const[k,b]=n.useState(null),u=Ae(a),C=Ye(d,u),m=a.title||d("documents.untitledArtifact","Untitled artifact"),f=ns(a.id,r),p=u==="doc"&&fs(a);n.useEffect(()=>{b(null)},[a.id]);const D=k?e.jsx("p",{className:"documents-content-state documents-content-state--error",children:k}):null,S=u==="image"?e.jsxs(e.Fragment,{children:[D,e.jsx("img",{className:"documents-task-artifact-media",src:f,alt:m,onError:()=>b(d("documents.artifactMediaFailed","Failed to load artifact preview."))})]}):u==="video"?e.jsxs(e.Fragment,{children:[D,e.jsx("video",{className:"documents-task-artifact-media",controls:!0,src:f,"aria-label":d("documents.videoArtifactLabel","Video artifact: {{title}}",{title:m}),onError:()=>b(d("documents.artifactMediaFailed","Failed to load artifact preview."))})]}):u==="audio"?e.jsxs(e.Fragment,{children:[D,e.jsx("audio",{className:"documents-task-artifact-audio",controls:!0,src:f,"aria-label":d("documents.audioArtifactLabel","Audio artifact: {{title}}",{title:m}),onError:()=>b(d("documents.artifactMediaFailed","Failed to load artifact preview."))})]}):u==="pdf"?e.jsxs("div",{className:"documents-task-artifact-pdf",children:[e.jsx("iframe",{title:d("documents.pdfArtifactTitle","PDF artifact: {{title}}",{title:m}),src:f}),e.jsxs("a",{className:"btn btn-sm",href:f,target:"_blank",rel:"noreferrer",children:[e.jsx(as,{size:14,"aria-hidden":"true"}),d("documents.openInNewTab","Open in new tab")]})]}):u==="doc"&&p?P?e.jsx("p",{className:"documents-content-state",children:e.jsx(ke,{label:d("documents.loadingArtifactContent","Loading artifact content…")})}):x?e.jsx("p",{className:"documents-content-state documents-content-state--error",children:x}):t?e.jsx("div",{className:"documents-content-markdown documents-task-artifact-doc-content",children:e.jsx("div",{className:"markdown-body",children:e.jsx(De,{remarkPlugins:[Ee],children:g??a.content??""})})}):e.jsx("pre",{className:"document-card-content-text documents-content-viewer-text documents-task-artifact-doc-content",children:g??a.content??""}):e.jsxs("div",{className:"documents-task-artifact-download",children:[e.jsx(Xe,{size:24,"aria-hidden":"true"}),e.jsx("p",{children:a.description||d("documents.binaryArtifactFallback","This artifact cannot be previewed inline.")}),e.jsxs("a",{className:"btn btn-sm",href:f,target:"_blank",rel:"noreferrer","data-testid":"task-artifact-open-link",children:[e.jsx(cs,{size:14,"aria-hidden":"true"}),d("documents.openArtifact","Open artifact")]})]});return e.jsxs("div",{className:"documents-content-viewer documents-task-artifact-viewer",children:[e.jsxs("div",{className:"documents-content-header documents-task-document-header",children:[e.jsxs("p",{className:"documents-file-path-header",children:[a.taskId," / ",m]}),u==="doc"&&p?e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:i,"aria-label":t?d("documents.switchToPlainText","Switch to plain text"):d("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":t,title:t?d("documents.switchToPlainText","Switch to plain text"):d("documents.switchToMarkdown","Switch to markdown"),children:t?d("documents.markdown","Markdown"):d("documents.plain","Plain")}):null]}),e.jsxs("div",{className:"document-card-meta documents-task-document-meta documents-task-artifact-meta",children:[e.jsx("span",{children:C}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{children:a.authorId||d("documents.unknownAuthor","unknown")}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{children:oe(a.updatedAt)}),a.taskId?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("button",{className:"documents-task-artifact-open-task",onClick:()=>void A(a.taskId),children:d("documents.openTask","Open task")})]}):null]}),a.description?e.jsx("p",{className:"documents-task-artifact-description",children:a.description}):null,e.jsx("div",{className:`documents-task-artifact-preview documents-task-artifact-preview--${u}`,children:S})]})}function gs({projectId:a,addToast:r,onOpenDetail:g,onOpenArtifactTaskDetail:P,onSendSelectionToTask:x}){const{t}=os("app"),[i,A]=n.useState("artifacts"),d=Ot(),[k,b]=n.useState(""),[u,C]=n.useState(null),[m,f]=n.useState(null),[p,D]=n.useState(!1),[S,N]=n.useState(null),[J,$]=n.useState(!1),[Z,U]=n.useState(null),[w,re]=n.useState(!1),O=n.useRef(0),_=n.useRef(null),G=n.useRef(null),ie=n.useRef(null),ee=n.useRef(null),[K,Le]=n.useState(!1),[Je,Me]=n.useState(new Map),[Ze,E]=n.useState(null),[pe,T]=n.useState(""),[le,F]=n.useState(null),[V,y]=n.useState(null),[de,je]=n.useState(!1),[et,L]=n.useState(null),[tt,I]=n.useState(!1),[st,M]=n.useState(null),[nt,xe]=n.useState(!0),te=n.useRef(0),[be,Q]=n.useState(!1),[ue,B]=n.useState(""),[we,ve]=n.useState(!1),[me,Re]=n.useState(!1),at=fe(_,{locked:me}),ct=fe(G,{locked:me}),ot=fe(ie,{locked:me}),rt=fe(ee,{locked:me}),ge=K?at:ct,Ne=i==="tasks"?k.trim():"",it=i==="artifacts"?k.trim():"",{documents:se,loading:lt,error:dt,refresh:ne}=rs({projectId:a,searchQuery:Ne||void 0,includeProjectFiles:!1}),{files:W,loading:ut,error:mt,refresh:He}=is(a,{showHidden:p}),{artifacts:R,loading:ht,error:ft,refresh:Se}=It({projectId:a,searchQuery:it||void 0});n.useEffect(()=>{const s=()=>{re(window.innerWidth<=ls)};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[]),n.useEffect(()=>{A("artifacts"),C(null),f(null),D(!1),N(null),U(null),$(!1),Le(!1),Me(new Map),E(null),T(""),F(null),y(null),je(!1),L(null),I(!1),M(null),xe(!0),Q(!1),B(""),ve(!1)},[a]);const X=n.useMemo(()=>{const s=Ne.toLowerCase(),c=new Map;for(const o of se){const j=c.get(o.taskId)??{documents:[],artifacts:[]};j.documents.push(o),c.set(o.taskId,j)}for(const o of R){if(!o.taskId||!hs(o,s))continue;const j=c.get(o.taskId)??{documents:[],artifacts:[]};j.artifacts.push(o),c.set(o.taskId,j)}return Array.from(c.entries()).map(([o,j])=>{const z=[...j.documents].sort((v,ae)=>ae.updatedAt.localeCompare(v.updatedAt)),q=[...j.artifacts].sort((v,ae)=>ae.updatedAt.localeCompare(v.updatedAt)),Pe=[z[0]?.updatedAt,q[0]?.updatedAt].filter(Boolean).sort().at(-1)??"",h=z.find(v=>v.taskTitle)?.taskTitle??q.find(v=>v.taskTitle)?.taskTitle;return{taskId:o,taskTitle:h,taskColumn:z.find(v=>v.taskColumn)?.taskColumn??q.find(v=>v.taskColumn)?.taskColumn,documents:z,artifacts:q,latestUpdated:Pe}}).filter(o=>o.documents.length>0||o.artifacts.length>0).sort((o,j)=>j.latestUpdated.localeCompare(o.latestUpdated))},[R,se,Ne]),l=n.useMemo(()=>m?.kind!=="document"?null:se.find(s=>s.id===m.id)??null,[se,m]),H=n.useMemo(()=>m?.kind!=="artifact"?null:R.find(s=>s.id===m.id)??null,[R,m]),he=l??H;n.useEffect(()=>{if(!m)return;X.some(c=>m.kind==="document"?c.documents.some(o=>o.id===m.id):c.artifacts.some(o=>o.id===m.id))||(f(null),E(null),T(""),F(null),y(null),L(null),I(!1),M(null))},[X,m]);const Ce=n.useMemo(()=>{const s=k.trim().toLowerCase();return s?W.filter(c=>{const o=c.path.toLowerCase(),j=c.name.toLowerCase();return o.includes(s)||j.includes(s)}):W},[W,k]);n.useEffect(()=>{if(!u)return;W.some(c=>c.path===u.path)||(C(null),N(null),U(null),$(!1))},[W,u]);const kt=n.useCallback(s=>{b(s.target.value)},[]),pt=n.useCallback(()=>{b("")},[]),ye=n.useCallback(s=>{A(s),s!=="tasks"&&(f(null),E(null),T(""),F(null),y(null),L(null),I(!1),M(null)),s!=="project"&&(Q(!1),B(""))},[]),jt=n.useCallback(async s=>{try{const c=await _e(s,a);g(c)}catch{r(`Failed to open task ${s}`,"error")}},[a,g,r]),ze=n.useCallback(async s=>{try{const c=await _e(s,a);(P??g)(c)}catch{r(`Failed to open task ${s}`,"error")}},[a,P,g,r]),xt=n.useCallback(async s=>{C(s),$(!0),U(null),N(null),Q(!1),B("");const c=O.current+1;O.current=c;try{const o=await Bt("project",s.path,a);if(O.current!==c)return;N(o.content)}catch(o){if(O.current!==c)return;const j=o instanceof Error?o.message:`Failed to open ${s.path}`;U(j),r(j,"error")}finally{O.current===c&&$(!1)}},[a,r]),bt=n.useCallback(()=>{C(null),N(null),U(null),$(!1),Q(!1),B("")},[]),wt=n.useCallback(()=>{S!==null&&(B(S),Q(!0))},[S]),vt=n.useCallback(()=>{Q(!1),B("")},[]),gt=n.useCallback(async()=>{if(u){ve(!0);try{await qt("project",u.path,ue,a),N(ue),Q(!1),B(""),r(t("documents.projectFileSaved","File saved"),"success")}catch(s){r(s instanceof Error?s.message:String(s),"error")}finally{ve(!1)}}},[u,ue,a,r,t]),Nt=n.useCallback(s=>{f({kind:"document",id:s}),E(null),T(""),F(null),y(null),L(null),I(!1),M(null)},[]),St=n.useCallback(s=>{f({kind:"artifact",id:s}),E(null),T(""),F(null),y(null),L(null),M(null),xe(!0)},[]),Ct=n.useCallback(()=>{f(null),E(null),T(""),F(null),y(null),L(null),I(!1),M(null)},[]),yt=n.useCallback(s=>{Me(c=>{const o=new Map(c),j=o.get(s)??!0;return o.set(s,!j),o})},[]),Tt=n.useCallback(()=>{l&&(T(l.content),E(l.id),F({revision:l.revision,contentHash:l.contentHash}),y(null))},[l]),Ft=n.useCallback(()=>{E(null),T(""),F(null),y(null)},[]),Pt=n.useCallback(()=>{V&&(F(V),y(null))},[V]),At=n.useCallback(async()=>{if(!(!l||!le||V)){je(!0);try{await Ut(l.taskId,l.key,pe,{expectedRevision:le.revision,expectedContentHash:le.contentHash},a),await ne(),E(null),T(""),F(null),y(null),r(t("documents.taskDocumentSaved","Document saved"),"success")}catch(s){if(typeof s=="object"&&s!==null&&"status"in s&&s.status===409)try{const c=await _t(l.taskId,l.key,a);await ne(),y({revision:c.revision,contentHash:c.contentHash}),r(t("documents.taskDocumentStale","This document changed since you opened it. Your draft is preserved; review the latest revision, then choose Rebase draft before saving."),"error")}catch(c){r(c instanceof Error?c.message:String(c),"error")}else r(s instanceof Error?s.message:String(s),"error")}finally{je(!1)}}},[l,pe,le,V,a,ne,r,t]);n.useEffect(()=>{if(!H||Ae(H)!=="doc"){L(null),I(!1),M(null);return}const s=te.current+1;te.current=s,I(!0),M(null),L(null),Vt(H.id,a).then(c=>{te.current===s&&L(c.content??H.content??"")}).catch(c=>{te.current===s&&M(c instanceof Error?c.message:String(c))}).finally(()=>{te.current===s&&I(!1)})},[a,H]);const $e=i==="project"?mt:i==="tasks"?dt:ft,Dt=n.useCallback(async()=>{if(i==="project"){await He();return}if(i==="tasks"){await ne();return}await Se()},[i,Se,He,ne]),Oe=i==="project"?Ce.length:i==="tasks"?X.length:R.length,Y=l?Je.get(l.id)??!0:!1,Te=Y?ot:rt,Fe=l!==null&&Ze===l.id,Et=i==="project"&&u&&!be&&x&&ge?e.jsx(Ve,{selectedText:ge.selectedText,anchorRect:ge.anchorRect,filePath:u.path,onSubmit:x,onOpenChange:Re}):null,Lt=i==="tasks"&&l&&!Fe&&x&&Te?e.jsx(Ve,{selectedText:Te.selectedText,anchorRect:Te.anchorRect,filePath:`${l.taskId}/${l.key}`,onSubmit:x,onOpenChange:Re}):null,Ie=i==="project"?t("documents.searchProjectFiles","Search project markdown files…"):i==="tasks"?t("documents.searchTaskDocuments","Search task documents…"):t("documents.searchArtifacts","Search artifacts…");return e.jsxs("div",{className:"documents-view",children:[e.jsxs("div",{className:"documents-view-header",children:[e.jsx(Qt,{icon:ce,title:t("documents.title","Artifacts"),actions:e.jsx("span",{className:"documents-view-count",children:t("documents.resultCount","{{count}} result{{plural}}",{count:Oe,plural:Oe!==1?"s":""})})}),e.jsxs("div",{className:"documents-controls-row",children:[e.jsxs("div",{className:"documents-tab-bar",role:"tablist","aria-label":t("documents.sectionsLabel","Documents sections"),children:[e.jsxs("button",{className:`btn documents-tab${i==="artifacts"?" active":""}`,role:"tab","aria-selected":i==="artifacts","aria-label":t("documents.showArtifacts","Show artifacts"),onClick:()=>ye("artifacts"),children:[t("documents.artifactsTab","Artifacts"),e.jsx("span",{className:"documents-tab-count",children:R.length})]}),e.jsxs("button",{className:`btn documents-tab${i==="project"?" active":""}`,role:"tab","aria-selected":i==="project","aria-label":t("documents.showProjectFiles","Show project markdown files"),onClick:()=>ye("project"),children:[t("documents.projectFilesTab","Project Files"),e.jsx("span",{className:"documents-tab-count",children:W.length})]}),e.jsxs("button",{className:`btn documents-tab${i==="tasks"?" active":""}`,role:"tab","aria-selected":i==="tasks","aria-label":t("documents.showTaskDocuments","Show task documents"),onClick:()=>ye("tasks"),children:[t("documents.taskDocumentsTab","Task Documents"),e.jsx("span",{className:"documents-tab-count",children:X.length})]})]}),i==="project"&&e.jsxs("button",{className:"btn btn-sm documents-hidden-toggle",onClick:()=>D(s=>!s),"aria-pressed":p,"aria-label":p?t("documents.hideHidden","Hide hidden project files"):t("documents.showHidden","Show hidden project files"),title:p?t("documents.hideHiddenFiles","Hide hidden files"):t("documents.showHiddenFiles","Show hidden files"),children:[p?e.jsx(Wt,{size:14}):e.jsx(Gt,{size:14}),p?t("documents.hideHiddenLabel","Hide Hidden"):t("documents.showHiddenLabel","Show Hidden")]}),e.jsxs("div",{className:"documents-search",children:[e.jsx(Kt,{size:16,className:"documents-search-icon"}),e.jsx("input",{type:"text",className:"documents-search-input",placeholder:Ie,value:k,onChange:kt,"aria-label":Ie}),k&&e.jsx("button",{className:"documents-search-clear",onClick:pt,"aria-label":t("documents.clearSearch","Clear search"),children:e.jsx(Xt,{size:16})})]})]})]}),e.jsx("div",{className:"documents-view-content",children:$e?e.jsxs("div",{className:"documents-view-error",children:[e.jsx("p",{children:t("documents.failedToLoad","Failed to load {{type}}: {{error}}",{type:i==="project"?t("documents.projectFiles","project files"):i==="tasks"?t("documents.taskDocuments","task documents"):t("documents.artifacts","artifacts"),error:$e})}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>void Dt(),"aria-label":t("documents.retryLoading","Retry loading documents"),children:[e.jsx(Yt,{size:16}),t("documents.retry","Retry")]})]}):i==="project"?ut&&W.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:e.jsx(ke,{label:t("documents.loadingProjectFiles","Loading project markdown files…")})})}):Ce.length===0?e.jsx("div",{className:"documents-view-empty",children:k.trim()?e.jsx("p",{children:t("documents.noMatchProject",'No project markdown files match "{{query}}".',{query:k.trim()})}):e.jsxs(e.Fragment,{children:[e.jsx(ce,{size:48,className:"documents-view-empty-icon"}),e.jsx("p",{children:t("documents.noMarkdownFiles","No Markdown files found in this project.")})]})}):e.jsxs("div",{className:`documents-project-layout${w?" documents-project-layout--mobile":""}`,children:[(!w||!u)&&e.jsx("aside",{className:"documents-view-sidebar","aria-label":t("documents.projectMarkdownFilesLabel","Project markdown files"),children:e.jsx("ul",{className:"markdown-file-list",children:Ce.map(s=>{const c=u?.path===s.path;return e.jsx("li",{className:"markdown-file-list-item",children:e.jsxs("button",{className:`markdown-file-item${c?" markdown-file-item--selected":""}`,onClick:()=>void xt(s),"aria-label":`Open ${s.path}`,"aria-current":c?"true":void 0,children:[e.jsx("span",{className:"markdown-file-item-name",children:s.name}),e.jsx("span",{className:"markdown-file-item-path",children:s.path}),e.jsxs("span",{className:"markdown-file-item-meta",children:[us(s.size)," · ",oe(s.mtime)]})]})},s.path)})})}),(!w||u)&&e.jsxs("section",{className:"documents-view-main","aria-label":t("documents.projectFilePreviewLabel","Project file content preview"),children:[w&&u&&e.jsxs("button",{className:"btn btn-sm documents-mobile-back",onClick:bt,"aria-label":t("documents.backToFilesList","Back to project files list"),children:[e.jsx(Qe,{size:14}),t("documents.backToFiles","Back to files")]}),u?e.jsxs("div",{className:"documents-content-viewer",children:[e.jsxs("div",{className:"documents-content-header",children:[e.jsx("p",{className:"documents-file-path-header",children:u.path}),e.jsx("div",{className:"documents-task-document-actions",children:be?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm",onClick:vt,disabled:we,children:t("documents.cancelEdit","Cancel")}),e.jsx("button",{className:"btn btn-sm btn-primary",onClick:()=>void gt(),disabled:we,children:we?t("documents.saving","Saving…"):t("documents.saveProjectFile","Save")})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:()=>Le(s=>!s),"aria-label":K?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":K,title:K?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),children:K?t("documents.markdown","Markdown"):t("documents.plain","Plain")}),e.jsxs("button",{className:"btn btn-sm",onClick:wt,disabled:J||Z!==null||S===null,"aria-label":t("documents.editProjectFile","Edit project file"),children:[e.jsx(We,{size:14,"aria-hidden":"true"}),t("documents.edit","Edit")]})]})})]}),J?e.jsx("p",{className:"documents-content-state",children:e.jsx(ke,{label:t("documents.loadingFileContent","Loading file content…")})}):Z?e.jsx("p",{className:"documents-content-state documents-content-state--error",children:Z}):be?e.jsx("div",{className:"documents-task-document-editor","aria-label":t("documents.projectFileContentEditor","Project file content editor"),children:e.jsx(Ge,{content:ue,onChange:B,filePath:u.path,forceToolbarActionsVisible:!0})}):K?e.jsx("div",{ref:_,className:"documents-content-markdown",children:e.jsx("div",{className:"markdown-body",children:e.jsx(De,{remarkPlugins:[Ee],children:S??""})})}):e.jsx("pre",{ref:G,className:"document-card-content-text documents-content-viewer-text",children:S??""}),Et]}):e.jsx("div",{className:"documents-view-empty",children:e.jsx("p",{children:t("documents.selectFile","Select a Markdown file to view its content.")})})]})]}):i==="artifacts"?ht&&R.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:t("documents.loadingArtifacts","Loading artifacts…")})}):R.length===0?e.jsx("div",{className:"documents-view-empty",children:k.trim()?e.jsx("p",{children:t("documents.noMatchArtifacts",'No artifacts match "{{query}}".',{query:k.trim()})}):e.jsxs(e.Fragment,{children:[e.jsx(ce,{size:48,className:"documents-view-empty-icon"}),e.jsx("p",{children:t("documents.noArtifacts","No artifacts yet.")}),e.jsx("p",{className:"documents-view-empty-hint",children:t("documents.artifactsCreatedBy","Agents register screenshots, wireframes, mockups, recordings, and documents here as they work on tasks.")})]})}):e.jsx(Jt,{artifacts:R,projectId:a,isMobile:w,addToast:r,onOpenTask:ze,onArtifactUpdated:()=>void Se()}):lt&&se.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:e.jsx(ke,{label:t("documents.loadingTaskDocuments","Loading task documents…")})})}):X.length===0?e.jsx("div",{className:"documents-view-empty",children:k.trim()?e.jsx("p",{children:t("documents.noMatchTask",'No task documents match "{{query}}".',{query:k.trim()})}):e.jsxs(e.Fragment,{children:[e.jsx(ce,{size:48,className:"documents-view-empty-icon"}),e.jsx("p",{children:t("documents.noTaskDocuments","No task documents yet.")}),e.jsx("p",{className:"documents-view-empty-hint",children:t("documents.documentsCreatedIn","Documents are created in task detail tabs.")})]})}):e.jsxs("div",{className:`documents-project-layout documents-task-documents-layout${w?" documents-project-layout--mobile":""}`,children:[(!w||!he)&&e.jsx("aside",{className:"documents-view-sidebar documents-task-documents-sidebar","aria-label":t("documents.taskDocumentsListLabel","Task documents"),children:X.map(({taskId:s,taskTitle:c,taskColumn:o,documents:j,artifacts:z})=>{const q=o?d(o):null,Pe=o?ms(o):"status-dot";return e.jsxs("section",{className:"documents-task-sidebar-group","aria-labelledby":`documents-task-group-${s}`,children:[e.jsxs("div",{className:"documents-task-sidebar-group-header",children:[e.jsxs("div",{className:"documents-task-sidebar-title-wrap",children:[e.jsxs("h3",{id:`documents-task-group-${s}`,className:"documents-task-sidebar-title",children:[e.jsx("span",{className:"documents-group-task-id",children:s}),e.jsx("span",{className:"documents-group-task-title",children:c||t("documents.untitled","Untitled")})]}),q?e.jsxs("span",{className:"documents-group-status badge","aria-label":t("documents.taskStatusAria","Task status: {{status}}",{status:q}),children:[e.jsx("span",{className:Pe,"aria-hidden":"true"}),e.jsx("span",{children:q})]}):null]}),e.jsxs("div",{className:"documents-task-sidebar-actions",children:[e.jsx("span",{className:"documents-group-count",children:t("documents.taskOutputCount","{{docCount}} doc{{docPlural}} · {{artifactCount}} artifact{{artifactPlural}}",{docCount:j.length,docPlural:j.length!==1?"s":"",artifactCount:z.length,artifactPlural:z.length!==1?"s":""})}),e.jsx("button",{className:"documents-group-task-link",onClick:()=>void jt(s),"aria-label":t("documents.openTaskAria","Open task {{taskId}}: {{title}}",{taskId:s,title:c||t("documents.untitled","Untitled")}),children:t("documents.openTask","Open task")})]})]}),e.jsxs("ul",{className:"markdown-file-list documents-task-document-list",children:[j.map(h=>{const v=l?.id===h.id;return e.jsx("li",{className:"markdown-file-list-item",children:e.jsxs("button",{className:`markdown-file-item documents-task-document-item${v?" markdown-file-item--selected":""}`,onClick:()=>Nt(h.id),"aria-label":t("documents.openTaskDocument","Open {{taskId}} {{key}}",{taskId:h.taskId,key:h.key}),"aria-current":v?"true":void 0,children:[e.jsx("span",{className:"markdown-file-item-name",children:h.key}),e.jsxs("span",{className:"markdown-file-item-path",children:[h.taskId," · ",h.taskTitle||t("documents.untitled","Untitled")]}),e.jsxs("span",{className:"markdown-file-item-meta",children:[t("documents.revisionShort","v{{revision}}",{revision:h.revision})," · ",h.author," · ",oe(h.updatedAt)]})]})},`document-${h.id}`)}),z.length>0?e.jsxs("li",{className:"documents-task-artifacts-subsection","aria-label":t("documents.taskArtifactsSubsection","Task artifacts"),children:[e.jsx("div",{className:"documents-task-artifacts-label",children:t("documents.taskArtifactsLabel","Artifacts")}),e.jsx("ul",{className:"markdown-file-list documents-task-artifact-list",children:z.map(h=>{const v=Ae(h),ae=ds[v],Mt=Ye(t,v),Be=H?.id===h.id;return e.jsx("li",{className:"markdown-file-list-item",children:e.jsxs("button",{className:`markdown-file-item documents-task-document-item documents-task-artifact-item${Be?" markdown-file-item--selected":""}`,onClick:()=>St(h.id),"aria-label":t("documents.openTaskArtifact","Open {{taskId}} artifact {{title}}",{taskId:s,title:h.title||t("documents.untitledArtifact","Untitled artifact")}),"aria-current":Be?"true":void 0,children:[e.jsxs("span",{className:"documents-task-artifact-title-row",children:[e.jsx(ae,{size:14,"aria-hidden":"true"}),e.jsx("span",{className:"markdown-file-item-name",children:h.title||t("documents.untitledArtifact","Untitled artifact")})]}),e.jsxs("span",{className:"markdown-file-item-path",children:[Mt," · ",h.mimeType||h.type]}),e.jsxs("span",{className:"markdown-file-item-meta",children:[h.authorId||t("documents.unknownAuthor","unknown")," · ",oe(h.updatedAt)]})]})},`artifact-${h.id}`)})})]}):null]})]},s)})}),(!w||he)&&e.jsxs("section",{className:"documents-view-main","aria-label":t("documents.taskDocumentPreviewLabel","Task document content preview"),children:[w&&he&&e.jsxs("button",{className:"btn btn-sm documents-mobile-back",onClick:Ct,"aria-label":t("documents.backToTaskDocumentsList","Back to task documents list"),children:[e.jsx(Qe,{size:14}),t("documents.backToTaskDocuments","Back to documents")]}),he?H?e.jsx(ks,{artifact:H,projectId:a,content:et,loading:tt,error:st,renderMarkdown:nt,onToggleMarkdown:()=>xe(s=>!s),onOpenTask:ze,t}):l?e.jsxs("div",{className:"documents-content-viewer documents-task-document-viewer",children:[e.jsxs("div",{className:"documents-content-header documents-task-document-header",children:[e.jsxs("p",{className:"documents-file-path-header",children:[l.taskId," / ",l.key]}),e.jsx("div",{className:"documents-task-document-actions",children:Fe?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm",onClick:Ft,disabled:de,children:t("documents.cancelEdit","Cancel")}),V&&e.jsx("button",{className:"btn btn-sm",onClick:Pt,disabled:de,children:t("documents.rebaseTaskDocument","Rebase draft")}),e.jsx("button",{className:"btn btn-sm btn-primary",onClick:()=>void At(),disabled:de||V!==null,children:de?t("documents.saving","Saving…"):t("documents.saveTaskDocument","Save")})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:()=>yt(l.id),"aria-label":Y?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":Y,title:Y?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),children:Y?t("documents.markdown","Markdown"):t("documents.plain","Plain")}),e.jsxs("button",{className:"btn btn-sm",onClick:Tt,"aria-label":t("documents.editTaskDocument","Edit task document"),children:[e.jsx(We,{size:14,"aria-hidden":"true"}),t("documents.edit","Edit")]})]})})]}),e.jsxs("div",{className:"document-card-meta documents-task-document-meta",children:[e.jsx("span",{className:"document-card-author",children:l.author}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{children:t("documents.revisionShort","v{{revision}}",{revision:l.revision})}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{className:"document-card-date",children:oe(l.updatedAt)})]}),Fe?e.jsx("div",{className:"documents-task-document-editor","aria-label":t("documents.taskDocumentContentEditor","Task document content editor"),children:e.jsx(Ge,{content:pe,onChange:T,filePath:l.key.includes(".")?l.key:`${l.key}.md`,forceToolbarActionsVisible:!0})}):Y?e.jsx("div",{ref:ie,className:"documents-content-markdown",children:e.jsx("div",{className:"markdown-body",children:e.jsx(De,{remarkPlugins:[Ee],children:l.content})})}):e.jsx("pre",{ref:ee,className:"document-card-content-text documents-content-viewer-text",children:l.content}),Lt]}):null:e.jsx("div",{className:"documents-view-empty",children:e.jsx("p",{children:t("documents.selectTaskDocument","Select a task document or artifact to view its content.")})})]})]})})]})}export{gs as DocumentsView};
|
|
1
|
+
import{r as n,j as e}from"./vendor-react-SZ_qB27O.js";import{ao as qe,ap as Ue,aq as Rt,ar as Ht,as as zt,at as Ke,au as $t,av as Ot,aw as fe,ax as It,ay as _e,az as Bt,aA as qt,aB as Ut,aC as _t,aD as Ae,aE as Vt,aF as Ve,V as Qt,aG as ce,E as Wt,p as Gt,aH as Kt,X as Xt,R as Yt,aI as ke,A as Qe,v as We,aJ as Ge,j as De,r as Ee,aK as Jt,aL as Xe,aM as Zt,aN as es,aO as ts,aP as ss,z as ns,aQ as as,aR as cs}from"./index-D8TQBkB7.js";import{u as os}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";function rs(a){const{projectId:r,searchQuery:g,includeProjectFiles:P=!0}=a??{},x=r?`${Rt.DOCUMENTS_PREFIX}${r}`:null,[t,i]=n.useState(()=>{if(!x)return[];const N=qe(x,{maxAgeMs:Ue});return Array.isArray(N)?N:[]}),[A,d]=n.useState([]),[k,b]=n.useState(()=>t.length===0),[u,C]=n.useState(null),m=n.useRef(null),f=n.useRef(t.length>0),p=n.useRef(null),{capture:D}=Ht(r,"useDocuments"),S=n.useCallback(async()=>{const N=D();m.current&&m.current.abort();const J=new AbortController;m.current=J;const $=!f.current;$&&b(!0),C(null);const Z=zt(g?{q:g}:void 0,r),U=P?Ke(r):Promise.resolve({files:[]}),[w,re]=await Promise.allSettled([Z,U]);if(J.signal.aborted||N.isStale())return;let O=null;if(w.status==="fulfilled"){if(i(w.value),x){const _=w.value.length>500?w.value.slice(0,500):w.value;$t(x,_,{maxBytes:5e5})}f.current=!0}else O=w.reason instanceof Error?w.reason.message:String(w.reason);if(re.status==="fulfilled"){const _=re.value.files,G=g?.trim().toLowerCase(),ie=G?_.filter(ee=>ee.name.toLowerCase().includes(G)||ee.path.toLowerCase().includes(G)):_;d(ie)}C(O),$&&b(!1)},[x,D,P,r,g]);return n.useEffect(()=>{if(d([]),!x){f.current=!1,i([]),b(!0);return}const N=qe(x,{maxAgeMs:Ue});Array.isArray(N)?(i(N),f.current=!0,b(!1)):(f.current=!1,i([]),b(!0))},[x]),n.useEffect(()=>(p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{S()},300),()=>{p.current&&clearTimeout(p.current)}),[S]),n.useEffect(()=>(S(),()=>{m.current&&m.current.abort()}),[]),{documents:t,projectFiles:A,loading:k,error:u,refresh:S}}function is(a,r){const[g,P]=n.useState([]),[x,t]=n.useState(!0),[i,A]=n.useState(null),d=n.useRef(null),k=n.useRef(!1),b=r?.showHidden??!1,u=n.useCallback(async C=>{d.current&&d.current.abort();const m=new AbortController;d.current=m;const f=!k.current;f&&t(!0),A(null);try{const p=await Ke(a,{showHidden:C?.showHidden??b});if(m.signal.aborted)return;P(p.files),k.current=!0}catch(p){if(m.signal.aborted)return;A(p instanceof Error?p.message:String(p))}finally{!m.signal.aborted&&f&&t(!1)}},[a,b]);return n.useEffect(()=>(k.current=!1,u({showHidden:b}),()=>{d.current&&d.current.abort()}),[u,b]),{files:g,loading:x,error:i,refresh:u}}const ls=768,ds={image:ss,doc:ce,pdf:ts,video:es,audio:Zt,other:Xe};function oe(a){return a?new Date(a).toLocaleString():""}function us(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(a>=10*1024?0:1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function ms(a){return a==="done"?"status-dot status-dot--online":a==="archived"?"status-dot status-dot--offline":a==="todo"||a==="triage"?"status-dot status-dot--pending":"status-dot status-dot--connecting"}function Ye(a,r){switch(r){case"image":return a("documents.artifactCategoryImage","Image");case"doc":return a("documents.artifactCategoryDoc","Document");case"pdf":return a("documents.artifactCategoryPdf","PDF");case"video":return a("documents.artifactCategoryVideo","Video");case"audio":return a("documents.artifactCategoryAudioSingle","Audio");case"other":return a("documents.artifactCategoryOtherSingle","Other")}}function hs(a,r){return r?[a.title,a.description,a.taskId,a.taskTitle,a.mimeType,a.authorId].some(g=>g?.toLowerCase().includes(r)):!0}function fs(a){const r=a.mimeType?.toLowerCase().split(";",1)[0]??"";return!!a.content||a.type==="document"||r.startsWith("text/")||r==="application/json"||r==="application/xml"}function ks({artifact:a,projectId:r,content:g,loading:P,error:x,renderMarkdown:t,onToggleMarkdown:i,onOpenTask:A,t:d}){const[k,b]=n.useState(null),u=Ae(a),C=Ye(d,u),m=a.title||d("documents.untitledArtifact","Untitled artifact"),f=ns(a.id,r),p=u==="doc"&&fs(a);n.useEffect(()=>{b(null)},[a.id]);const D=k?e.jsx("p",{className:"documents-content-state documents-content-state--error",children:k}):null,S=u==="image"?e.jsxs(e.Fragment,{children:[D,e.jsx("img",{className:"documents-task-artifact-media",src:f,alt:m,onError:()=>b(d("documents.artifactMediaFailed","Failed to load artifact preview."))})]}):u==="video"?e.jsxs(e.Fragment,{children:[D,e.jsx("video",{className:"documents-task-artifact-media",controls:!0,src:f,"aria-label":d("documents.videoArtifactLabel","Video artifact: {{title}}",{title:m}),onError:()=>b(d("documents.artifactMediaFailed","Failed to load artifact preview."))})]}):u==="audio"?e.jsxs(e.Fragment,{children:[D,e.jsx("audio",{className:"documents-task-artifact-audio",controls:!0,src:f,"aria-label":d("documents.audioArtifactLabel","Audio artifact: {{title}}",{title:m}),onError:()=>b(d("documents.artifactMediaFailed","Failed to load artifact preview."))})]}):u==="pdf"?e.jsxs("div",{className:"documents-task-artifact-pdf",children:[e.jsx("iframe",{title:d("documents.pdfArtifactTitle","PDF artifact: {{title}}",{title:m}),src:f}),e.jsxs("a",{className:"btn btn-sm",href:f,target:"_blank",rel:"noreferrer",children:[e.jsx(as,{size:14,"aria-hidden":"true"}),d("documents.openInNewTab","Open in new tab")]})]}):u==="doc"&&p?P?e.jsx("p",{className:"documents-content-state",children:e.jsx(ke,{label:d("documents.loadingArtifactContent","Loading artifact content…")})}):x?e.jsx("p",{className:"documents-content-state documents-content-state--error",children:x}):t?e.jsx("div",{className:"documents-content-markdown documents-task-artifact-doc-content",children:e.jsx("div",{className:"markdown-body",children:e.jsx(De,{remarkPlugins:[Ee],children:g??a.content??""})})}):e.jsx("pre",{className:"document-card-content-text documents-content-viewer-text documents-task-artifact-doc-content",children:g??a.content??""}):e.jsxs("div",{className:"documents-task-artifact-download",children:[e.jsx(Xe,{size:24,"aria-hidden":"true"}),e.jsx("p",{children:a.description||d("documents.binaryArtifactFallback","This artifact cannot be previewed inline.")}),e.jsxs("a",{className:"btn btn-sm",href:f,target:"_blank",rel:"noreferrer","data-testid":"task-artifact-open-link",children:[e.jsx(cs,{size:14,"aria-hidden":"true"}),d("documents.openArtifact","Open artifact")]})]});return e.jsxs("div",{className:"documents-content-viewer documents-task-artifact-viewer",children:[e.jsxs("div",{className:"documents-content-header documents-task-document-header",children:[e.jsxs("p",{className:"documents-file-path-header",children:[a.taskId," / ",m]}),u==="doc"&&p?e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:i,"aria-label":t?d("documents.switchToPlainText","Switch to plain text"):d("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":t,title:t?d("documents.switchToPlainText","Switch to plain text"):d("documents.switchToMarkdown","Switch to markdown"),children:t?d("documents.markdown","Markdown"):d("documents.plain","Plain")}):null]}),e.jsxs("div",{className:"document-card-meta documents-task-document-meta documents-task-artifact-meta",children:[e.jsx("span",{children:C}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{children:a.authorId||d("documents.unknownAuthor","unknown")}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{children:oe(a.updatedAt)}),a.taskId?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("button",{className:"documents-task-artifact-open-task",onClick:()=>void A(a.taskId),children:d("documents.openTask","Open task")})]}):null]}),a.description?e.jsx("p",{className:"documents-task-artifact-description",children:a.description}):null,e.jsx("div",{className:`documents-task-artifact-preview documents-task-artifact-preview--${u}`,children:S})]})}function gs({projectId:a,addToast:r,onOpenDetail:g,onOpenArtifactTaskDetail:P,onSendSelectionToTask:x}){const{t}=os("app"),[i,A]=n.useState("artifacts"),d=Ot(),[k,b]=n.useState(""),[u,C]=n.useState(null),[m,f]=n.useState(null),[p,D]=n.useState(!1),[S,N]=n.useState(null),[J,$]=n.useState(!1),[Z,U]=n.useState(null),[w,re]=n.useState(!1),O=n.useRef(0),_=n.useRef(null),G=n.useRef(null),ie=n.useRef(null),ee=n.useRef(null),[K,Le]=n.useState(!1),[Je,Me]=n.useState(new Map),[Ze,E]=n.useState(null),[pe,T]=n.useState(""),[le,F]=n.useState(null),[V,y]=n.useState(null),[de,je]=n.useState(!1),[et,L]=n.useState(null),[tt,I]=n.useState(!1),[st,M]=n.useState(null),[nt,xe]=n.useState(!0),te=n.useRef(0),[be,Q]=n.useState(!1),[ue,B]=n.useState(""),[we,ve]=n.useState(!1),[me,Re]=n.useState(!1),at=fe(_,{locked:me}),ct=fe(G,{locked:me}),ot=fe(ie,{locked:me}),rt=fe(ee,{locked:me}),ge=K?at:ct,Ne=i==="tasks"?k.trim():"",it=i==="artifacts"?k.trim():"",{documents:se,loading:lt,error:dt,refresh:ne}=rs({projectId:a,searchQuery:Ne||void 0,includeProjectFiles:!1}),{files:W,loading:ut,error:mt,refresh:He}=is(a,{showHidden:p}),{artifacts:R,loading:ht,error:ft,refresh:Se}=It({projectId:a,searchQuery:it||void 0});n.useEffect(()=>{const s=()=>{re(window.innerWidth<=ls)};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[]),n.useEffect(()=>{A("artifacts"),C(null),f(null),D(!1),N(null),U(null),$(!1),Le(!1),Me(new Map),E(null),T(""),F(null),y(null),je(!1),L(null),I(!1),M(null),xe(!0),Q(!1),B(""),ve(!1)},[a]);const X=n.useMemo(()=>{const s=Ne.toLowerCase(),c=new Map;for(const o of se){const j=c.get(o.taskId)??{documents:[],artifacts:[]};j.documents.push(o),c.set(o.taskId,j)}for(const o of R){if(!o.taskId||!hs(o,s))continue;const j=c.get(o.taskId)??{documents:[],artifacts:[]};j.artifacts.push(o),c.set(o.taskId,j)}return Array.from(c.entries()).map(([o,j])=>{const z=[...j.documents].sort((v,ae)=>ae.updatedAt.localeCompare(v.updatedAt)),q=[...j.artifacts].sort((v,ae)=>ae.updatedAt.localeCompare(v.updatedAt)),Pe=[z[0]?.updatedAt,q[0]?.updatedAt].filter(Boolean).sort().at(-1)??"",h=z.find(v=>v.taskTitle)?.taskTitle??q.find(v=>v.taskTitle)?.taskTitle;return{taskId:o,taskTitle:h,taskColumn:z.find(v=>v.taskColumn)?.taskColumn??q.find(v=>v.taskColumn)?.taskColumn,documents:z,artifacts:q,latestUpdated:Pe}}).filter(o=>o.documents.length>0||o.artifacts.length>0).sort((o,j)=>j.latestUpdated.localeCompare(o.latestUpdated))},[R,se,Ne]),l=n.useMemo(()=>m?.kind!=="document"?null:se.find(s=>s.id===m.id)??null,[se,m]),H=n.useMemo(()=>m?.kind!=="artifact"?null:R.find(s=>s.id===m.id)??null,[R,m]),he=l??H;n.useEffect(()=>{if(!m)return;X.some(c=>m.kind==="document"?c.documents.some(o=>o.id===m.id):c.artifacts.some(o=>o.id===m.id))||(f(null),E(null),T(""),F(null),y(null),L(null),I(!1),M(null))},[X,m]);const Ce=n.useMemo(()=>{const s=k.trim().toLowerCase();return s?W.filter(c=>{const o=c.path.toLowerCase(),j=c.name.toLowerCase();return o.includes(s)||j.includes(s)}):W},[W,k]);n.useEffect(()=>{if(!u)return;W.some(c=>c.path===u.path)||(C(null),N(null),U(null),$(!1))},[W,u]);const kt=n.useCallback(s=>{b(s.target.value)},[]),pt=n.useCallback(()=>{b("")},[]),ye=n.useCallback(s=>{A(s),s!=="tasks"&&(f(null),E(null),T(""),F(null),y(null),L(null),I(!1),M(null)),s!=="project"&&(Q(!1),B(""))},[]),jt=n.useCallback(async s=>{try{const c=await _e(s,a);g(c)}catch{r(`Failed to open task ${s}`,"error")}},[a,g,r]),ze=n.useCallback(async s=>{try{const c=await _e(s,a);(P??g)(c)}catch{r(`Failed to open task ${s}`,"error")}},[a,P,g,r]),xt=n.useCallback(async s=>{C(s),$(!0),U(null),N(null),Q(!1),B("");const c=O.current+1;O.current=c;try{const o=await Bt("project",s.path,a);if(O.current!==c)return;N(o.content)}catch(o){if(O.current!==c)return;const j=o instanceof Error?o.message:`Failed to open ${s.path}`;U(j),r(j,"error")}finally{O.current===c&&$(!1)}},[a,r]),bt=n.useCallback(()=>{C(null),N(null),U(null),$(!1),Q(!1),B("")},[]),wt=n.useCallback(()=>{S!==null&&(B(S),Q(!0))},[S]),vt=n.useCallback(()=>{Q(!1),B("")},[]),gt=n.useCallback(async()=>{if(u){ve(!0);try{await qt("project",u.path,ue,a),N(ue),Q(!1),B(""),r(t("documents.projectFileSaved","File saved"),"success")}catch(s){r(s instanceof Error?s.message:String(s),"error")}finally{ve(!1)}}},[u,ue,a,r,t]),Nt=n.useCallback(s=>{f({kind:"document",id:s}),E(null),T(""),F(null),y(null),L(null),I(!1),M(null)},[]),St=n.useCallback(s=>{f({kind:"artifact",id:s}),E(null),T(""),F(null),y(null),L(null),M(null),xe(!0)},[]),Ct=n.useCallback(()=>{f(null),E(null),T(""),F(null),y(null),L(null),I(!1),M(null)},[]),yt=n.useCallback(s=>{Me(c=>{const o=new Map(c),j=o.get(s)??!0;return o.set(s,!j),o})},[]),Tt=n.useCallback(()=>{l&&(T(l.content),E(l.id),F({revision:l.revision,contentHash:l.contentHash}),y(null))},[l]),Ft=n.useCallback(()=>{E(null),T(""),F(null),y(null)},[]),Pt=n.useCallback(()=>{V&&(F(V),y(null))},[V]),At=n.useCallback(async()=>{if(!(!l||!le||V)){je(!0);try{await Ut(l.taskId,l.key,pe,{expectedRevision:le.revision,expectedContentHash:le.contentHash},a),await ne(),E(null),T(""),F(null),y(null),r(t("documents.taskDocumentSaved","Document saved"),"success")}catch(s){if(typeof s=="object"&&s!==null&&"status"in s&&s.status===409)try{const c=await _t(l.taskId,l.key,a);await ne(),y({revision:c.revision,contentHash:c.contentHash}),r(t("documents.taskDocumentStale","This document changed since you opened it. Your draft is preserved; review the latest revision, then choose Rebase draft before saving."),"error")}catch(c){r(c instanceof Error?c.message:String(c),"error")}else r(s instanceof Error?s.message:String(s),"error")}finally{je(!1)}}},[l,pe,le,V,a,ne,r,t]);n.useEffect(()=>{if(!H||Ae(H)!=="doc"){L(null),I(!1),M(null);return}const s=te.current+1;te.current=s,I(!0),M(null),L(null),Vt(H.id,a).then(c=>{te.current===s&&L(c.content??H.content??"")}).catch(c=>{te.current===s&&M(c instanceof Error?c.message:String(c))}).finally(()=>{te.current===s&&I(!1)})},[a,H]);const $e=i==="project"?mt:i==="tasks"?dt:ft,Dt=n.useCallback(async()=>{if(i==="project"){await He();return}if(i==="tasks"){await ne();return}await Se()},[i,Se,He,ne]),Oe=i==="project"?Ce.length:i==="tasks"?X.length:R.length,Y=l?Je.get(l.id)??!0:!1,Te=Y?ot:rt,Fe=l!==null&&Ze===l.id,Et=i==="project"&&u&&!be&&x&&ge?e.jsx(Ve,{selectedText:ge.selectedText,anchorRect:ge.anchorRect,filePath:u.path,onSubmit:x,onOpenChange:Re}):null,Lt=i==="tasks"&&l&&!Fe&&x&&Te?e.jsx(Ve,{selectedText:Te.selectedText,anchorRect:Te.anchorRect,filePath:`${l.taskId}/${l.key}`,onSubmit:x,onOpenChange:Re}):null,Ie=i==="project"?t("documents.searchProjectFiles","Search project markdown files…"):i==="tasks"?t("documents.searchTaskDocuments","Search task documents…"):t("documents.searchArtifacts","Search artifacts…");return e.jsxs("div",{className:"documents-view",children:[e.jsxs("div",{className:"documents-view-header",children:[e.jsx(Qt,{icon:ce,title:t("documents.title","Artifacts"),actions:e.jsx("span",{className:"documents-view-count",children:t("documents.resultCount","{{count}} result{{plural}}",{count:Oe,plural:Oe!==1?"s":""})})}),e.jsxs("div",{className:"documents-controls-row",children:[e.jsxs("div",{className:"documents-tab-bar",role:"tablist","aria-label":t("documents.sectionsLabel","Documents sections"),children:[e.jsxs("button",{className:`btn documents-tab${i==="artifacts"?" active":""}`,role:"tab","aria-selected":i==="artifacts","aria-label":t("documents.showArtifacts","Show artifacts"),onClick:()=>ye("artifacts"),children:[t("documents.artifactsTab","Artifacts"),e.jsx("span",{className:"documents-tab-count",children:R.length})]}),e.jsxs("button",{className:`btn documents-tab${i==="project"?" active":""}`,role:"tab","aria-selected":i==="project","aria-label":t("documents.showProjectFiles","Show project markdown files"),onClick:()=>ye("project"),children:[t("documents.projectFilesTab","Project Files"),e.jsx("span",{className:"documents-tab-count",children:W.length})]}),e.jsxs("button",{className:`btn documents-tab${i==="tasks"?" active":""}`,role:"tab","aria-selected":i==="tasks","aria-label":t("documents.showTaskDocuments","Show task documents"),onClick:()=>ye("tasks"),children:[t("documents.taskDocumentsTab","Task Documents"),e.jsx("span",{className:"documents-tab-count",children:X.length})]})]}),i==="project"&&e.jsxs("button",{className:"btn btn-sm documents-hidden-toggle",onClick:()=>D(s=>!s),"aria-pressed":p,"aria-label":p?t("documents.hideHidden","Hide hidden project files"):t("documents.showHidden","Show hidden project files"),title:p?t("documents.hideHiddenFiles","Hide hidden files"):t("documents.showHiddenFiles","Show hidden files"),children:[p?e.jsx(Wt,{size:14}):e.jsx(Gt,{size:14}),p?t("documents.hideHiddenLabel","Hide Hidden"):t("documents.showHiddenLabel","Show Hidden")]}),e.jsxs("div",{className:"documents-search",children:[e.jsx(Kt,{size:16,className:"documents-search-icon"}),e.jsx("input",{type:"text",className:"documents-search-input",placeholder:Ie,value:k,onChange:kt,"aria-label":Ie}),k&&e.jsx("button",{className:"documents-search-clear",onClick:pt,"aria-label":t("documents.clearSearch","Clear search"),children:e.jsx(Xt,{size:16})})]})]})]}),e.jsx("div",{className:"documents-view-content",children:$e?e.jsxs("div",{className:"documents-view-error",children:[e.jsx("p",{children:t("documents.failedToLoad","Failed to load {{type}}: {{error}}",{type:i==="project"?t("documents.projectFiles","project files"):i==="tasks"?t("documents.taskDocuments","task documents"):t("documents.artifacts","artifacts"),error:$e})}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>void Dt(),"aria-label":t("documents.retryLoading","Retry loading documents"),children:[e.jsx(Yt,{size:16}),t("documents.retry","Retry")]})]}):i==="project"?ut&&W.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:e.jsx(ke,{label:t("documents.loadingProjectFiles","Loading project markdown files…")})})}):Ce.length===0?e.jsx("div",{className:"documents-view-empty",children:k.trim()?e.jsx("p",{children:t("documents.noMatchProject",'No project markdown files match "{{query}}".',{query:k.trim()})}):e.jsxs(e.Fragment,{children:[e.jsx(ce,{size:48,className:"documents-view-empty-icon"}),e.jsx("p",{children:t("documents.noMarkdownFiles","No Markdown files found in this project.")})]})}):e.jsxs("div",{className:`documents-project-layout${w?" documents-project-layout--mobile":""}`,children:[(!w||!u)&&e.jsx("aside",{className:"documents-view-sidebar","aria-label":t("documents.projectMarkdownFilesLabel","Project markdown files"),children:e.jsx("ul",{className:"markdown-file-list",children:Ce.map(s=>{const c=u?.path===s.path;return e.jsx("li",{className:"markdown-file-list-item",children:e.jsxs("button",{className:`markdown-file-item${c?" markdown-file-item--selected":""}`,onClick:()=>void xt(s),"aria-label":`Open ${s.path}`,"aria-current":c?"true":void 0,children:[e.jsx("span",{className:"markdown-file-item-name",children:s.name}),e.jsx("span",{className:"markdown-file-item-path",children:s.path}),e.jsxs("span",{className:"markdown-file-item-meta",children:[us(s.size)," · ",oe(s.mtime)]})]})},s.path)})})}),(!w||u)&&e.jsxs("section",{className:"documents-view-main","aria-label":t("documents.projectFilePreviewLabel","Project file content preview"),children:[w&&u&&e.jsxs("button",{className:"btn btn-sm documents-mobile-back",onClick:bt,"aria-label":t("documents.backToFilesList","Back to project files list"),children:[e.jsx(Qe,{size:14}),t("documents.backToFiles","Back to files")]}),u?e.jsxs("div",{className:"documents-content-viewer",children:[e.jsxs("div",{className:"documents-content-header",children:[e.jsx("p",{className:"documents-file-path-header",children:u.path}),e.jsx("div",{className:"documents-task-document-actions",children:be?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm",onClick:vt,disabled:we,children:t("documents.cancelEdit","Cancel")}),e.jsx("button",{className:"btn btn-sm btn-primary",onClick:()=>void gt(),disabled:we,children:we?t("documents.saving","Saving…"):t("documents.saveProjectFile","Save")})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:()=>Le(s=>!s),"aria-label":K?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":K,title:K?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),children:K?t("documents.markdown","Markdown"):t("documents.plain","Plain")}),e.jsxs("button",{className:"btn btn-sm",onClick:wt,disabled:J||Z!==null||S===null,"aria-label":t("documents.editProjectFile","Edit project file"),children:[e.jsx(We,{size:14,"aria-hidden":"true"}),t("documents.edit","Edit")]})]})})]}),J?e.jsx("p",{className:"documents-content-state",children:e.jsx(ke,{label:t("documents.loadingFileContent","Loading file content…")})}):Z?e.jsx("p",{className:"documents-content-state documents-content-state--error",children:Z}):be?e.jsx("div",{className:"documents-task-document-editor","aria-label":t("documents.projectFileContentEditor","Project file content editor"),children:e.jsx(Ge,{content:ue,onChange:B,filePath:u.path,forceToolbarActionsVisible:!0})}):K?e.jsx("div",{ref:_,className:"documents-content-markdown",children:e.jsx("div",{className:"markdown-body",children:e.jsx(De,{remarkPlugins:[Ee],children:S??""})})}):e.jsx("pre",{ref:G,className:"document-card-content-text documents-content-viewer-text",children:S??""}),Et]}):e.jsx("div",{className:"documents-view-empty",children:e.jsx("p",{children:t("documents.selectFile","Select a Markdown file to view its content.")})})]})]}):i==="artifacts"?ht&&R.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:t("documents.loadingArtifacts","Loading artifacts…")})}):R.length===0?e.jsx("div",{className:"documents-view-empty",children:k.trim()?e.jsx("p",{children:t("documents.noMatchArtifacts",'No artifacts match "{{query}}".',{query:k.trim()})}):e.jsxs(e.Fragment,{children:[e.jsx(ce,{size:48,className:"documents-view-empty-icon"}),e.jsx("p",{children:t("documents.noArtifacts","No artifacts yet.")}),e.jsx("p",{className:"documents-view-empty-hint",children:t("documents.artifactsCreatedBy","Agents register screenshots, wireframes, mockups, recordings, and documents here as they work on tasks.")})]})}):e.jsx(Jt,{artifacts:R,projectId:a,isMobile:w,addToast:r,onOpenTask:ze,onArtifactUpdated:()=>void Se()}):lt&&se.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:e.jsx(ke,{label:t("documents.loadingTaskDocuments","Loading task documents…")})})}):X.length===0?e.jsx("div",{className:"documents-view-empty",children:k.trim()?e.jsx("p",{children:t("documents.noMatchTask",'No task documents match "{{query}}".',{query:k.trim()})}):e.jsxs(e.Fragment,{children:[e.jsx(ce,{size:48,className:"documents-view-empty-icon"}),e.jsx("p",{children:t("documents.noTaskDocuments","No task documents yet.")}),e.jsx("p",{className:"documents-view-empty-hint",children:t("documents.documentsCreatedIn","Documents are created in task detail tabs.")})]})}):e.jsxs("div",{className:`documents-project-layout documents-task-documents-layout${w?" documents-project-layout--mobile":""}`,children:[(!w||!he)&&e.jsx("aside",{className:"documents-view-sidebar documents-task-documents-sidebar","aria-label":t("documents.taskDocumentsListLabel","Task documents"),children:X.map(({taskId:s,taskTitle:c,taskColumn:o,documents:j,artifacts:z})=>{const q=o?d(o):null,Pe=o?ms(o):"status-dot";return e.jsxs("section",{className:"documents-task-sidebar-group","aria-labelledby":`documents-task-group-${s}`,children:[e.jsxs("div",{className:"documents-task-sidebar-group-header",children:[e.jsxs("div",{className:"documents-task-sidebar-title-wrap",children:[e.jsxs("h3",{id:`documents-task-group-${s}`,className:"documents-task-sidebar-title",children:[e.jsx("span",{className:"documents-group-task-id",children:s}),e.jsx("span",{className:"documents-group-task-title",children:c||t("documents.untitled","Untitled")})]}),q?e.jsxs("span",{className:"documents-group-status badge","aria-label":t("documents.taskStatusAria","Task status: {{status}}",{status:q}),children:[e.jsx("span",{className:Pe,"aria-hidden":"true"}),e.jsx("span",{children:q})]}):null]}),e.jsxs("div",{className:"documents-task-sidebar-actions",children:[e.jsx("span",{className:"documents-group-count",children:t("documents.taskOutputCount","{{docCount}} doc{{docPlural}} · {{artifactCount}} artifact{{artifactPlural}}",{docCount:j.length,docPlural:j.length!==1?"s":"",artifactCount:z.length,artifactPlural:z.length!==1?"s":""})}),e.jsx("button",{className:"documents-group-task-link",onClick:()=>void jt(s),"aria-label":t("documents.openTaskAria","Open task {{taskId}}: {{title}}",{taskId:s,title:c||t("documents.untitled","Untitled")}),children:t("documents.openTask","Open task")})]})]}),e.jsxs("ul",{className:"markdown-file-list documents-task-document-list",children:[j.map(h=>{const v=l?.id===h.id;return e.jsx("li",{className:"markdown-file-list-item",children:e.jsxs("button",{className:`markdown-file-item documents-task-document-item${v?" markdown-file-item--selected":""}`,onClick:()=>Nt(h.id),"aria-label":t("documents.openTaskDocument","Open {{taskId}} {{key}}",{taskId:h.taskId,key:h.key}),"aria-current":v?"true":void 0,children:[e.jsx("span",{className:"markdown-file-item-name",children:h.key}),e.jsxs("span",{className:"markdown-file-item-path",children:[h.taskId," · ",h.taskTitle||t("documents.untitled","Untitled")]}),e.jsxs("span",{className:"markdown-file-item-meta",children:[t("documents.revisionShort","v{{revision}}",{revision:h.revision})," · ",h.author," · ",oe(h.updatedAt)]})]})},`document-${h.id}`)}),z.length>0?e.jsxs("li",{className:"documents-task-artifacts-subsection","aria-label":t("documents.taskArtifactsSubsection","Task artifacts"),children:[e.jsx("div",{className:"documents-task-artifacts-label",children:t("documents.taskArtifactsLabel","Artifacts")}),e.jsx("ul",{className:"markdown-file-list documents-task-artifact-list",children:z.map(h=>{const v=Ae(h),ae=ds[v],Mt=Ye(t,v),Be=H?.id===h.id;return e.jsx("li",{className:"markdown-file-list-item",children:e.jsxs("button",{className:`markdown-file-item documents-task-document-item documents-task-artifact-item${Be?" markdown-file-item--selected":""}`,onClick:()=>St(h.id),"aria-label":t("documents.openTaskArtifact","Open {{taskId}} artifact {{title}}",{taskId:s,title:h.title||t("documents.untitledArtifact","Untitled artifact")}),"aria-current":Be?"true":void 0,children:[e.jsxs("span",{className:"documents-task-artifact-title-row",children:[e.jsx(ae,{size:14,"aria-hidden":"true"}),e.jsx("span",{className:"markdown-file-item-name",children:h.title||t("documents.untitledArtifact","Untitled artifact")})]}),e.jsxs("span",{className:"markdown-file-item-path",children:[Mt," · ",h.mimeType||h.type]}),e.jsxs("span",{className:"markdown-file-item-meta",children:[h.authorId||t("documents.unknownAuthor","unknown")," · ",oe(h.updatedAt)]})]})},`artifact-${h.id}`)})})]}):null]})]},s)})}),(!w||he)&&e.jsxs("section",{className:"documents-view-main","aria-label":t("documents.taskDocumentPreviewLabel","Task document content preview"),children:[w&&he&&e.jsxs("button",{className:"btn btn-sm documents-mobile-back",onClick:Ct,"aria-label":t("documents.backToTaskDocumentsList","Back to task documents list"),children:[e.jsx(Qe,{size:14}),t("documents.backToTaskDocuments","Back to documents")]}),he?H?e.jsx(ks,{artifact:H,projectId:a,content:et,loading:tt,error:st,renderMarkdown:nt,onToggleMarkdown:()=>xe(s=>!s),onOpenTask:ze,t}):l?e.jsxs("div",{className:"documents-content-viewer documents-task-document-viewer",children:[e.jsxs("div",{className:"documents-content-header documents-task-document-header",children:[e.jsxs("p",{className:"documents-file-path-header",children:[l.taskId," / ",l.key]}),e.jsx("div",{className:"documents-task-document-actions",children:Fe?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm",onClick:Ft,disabled:de,children:t("documents.cancelEdit","Cancel")}),V&&e.jsx("button",{className:"btn btn-sm",onClick:Pt,disabled:de,children:t("documents.rebaseTaskDocument","Rebase draft")}),e.jsx("button",{className:"btn btn-sm btn-primary",onClick:()=>void At(),disabled:de||V!==null,children:de?t("documents.saving","Saving…"):t("documents.saveTaskDocument","Save")})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:()=>yt(l.id),"aria-label":Y?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":Y,title:Y?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),children:Y?t("documents.markdown","Markdown"):t("documents.plain","Plain")}),e.jsxs("button",{className:"btn btn-sm",onClick:Tt,"aria-label":t("documents.editTaskDocument","Edit task document"),children:[e.jsx(We,{size:14,"aria-hidden":"true"}),t("documents.edit","Edit")]})]})})]}),e.jsxs("div",{className:"document-card-meta documents-task-document-meta",children:[e.jsx("span",{className:"document-card-author",children:l.author}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{children:t("documents.revisionShort","v{{revision}}",{revision:l.revision})}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{className:"document-card-date",children:oe(l.updatedAt)})]}),Fe?e.jsx("div",{className:"documents-task-document-editor","aria-label":t("documents.taskDocumentContentEditor","Task document content editor"),children:e.jsx(Ge,{content:pe,onChange:T,filePath:l.key.includes(".")?l.key:`${l.key}.md`,forceToolbarActionsVisible:!0})}):Y?e.jsx("div",{ref:ie,className:"documents-content-markdown",children:e.jsx("div",{className:"markdown-body",children:e.jsx(De,{remarkPlugins:[Ee],children:l.content})})}):e.jsx("pre",{ref:ee,className:"document-card-content-text documents-content-viewer-text",children:l.content}),Lt]}):null:e.jsx("div",{className:"documents-view-empty",children:e.jsx("p",{children:t("documents.selectTaskDocument","Select a task document or artifact to view its content.")})})]})]})})]})}export{gs as DocumentsView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{ao as L,ap as P,aq as $,aS as G,aT as Q,au as O,aU as J,aV as Z,V as H,T as B,Y as ee,R as se,aI as ae,s as te,l as le,aQ as re}from"./index-
|
|
1
|
+
import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{ao as L,ap as P,aq as $,aS as G,aT as Q,au as O,aU as J,aV as Z,V as H,T as B,Y as ee,R as se,aI as ae,s as te,l as le,aQ as re}from"./index-D8TQBkB7.js";import{u as ne}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";const ie=300,ce=15e3;function K(r){if(!r.trim())return;const a=Number(r);return Number.isFinite(a)?a:void 0}function k(...r){for(const a of r)if(Array.isArray(a))return a;return[]}function p(r){return typeof r=="object"&&r!==null?r:{}}function X(r){const a=p(r),m=p(a.taskSnapshot);return{id:String(a.id??a.evalId??""),runId:String(a.runId??a.batchId??""),taskId:String(a.taskId??m.taskId??""),taskTitle:String(m.title??a.taskTitle??a.title??"Untitled task"),createdAt:String(a.createdAt??a.timestamp??a.updatedAt??new Date(0).toISOString()),overallScore:typeof a.overallScore=="number"?a.overallScore:null,maxScore:typeof a.maxScore=="number"?a.maxScore:null,categoryScores:k(a.categoryScores,p(a.scores).categories)}}function oe(r){const a=p(r);return{...X(a),rationale:String(a.rationale??a.summary??""),evidence:k(a.evidence,p(a.details).evidence),followUps:k(a.followUps,p(a.recommendations).followUps)}}function de(r){const a=r?.projectId,m=a??"",t=`${$.EVALS_RUNS_PREFIX}${m}`,h=`${$.EVALS_RESULTS_PREFIX}${m}`,f=L(t,{maxAgeMs:P}),v=L(h,{maxAgeMs:P}),S=l.useRef(Array.isArray(f)&&f.length>0||Array.isArray(v)&&v.length>0),[o,g]=l.useState({q:"",runId:"",scoreMin:"",scoreMax:""}),[b,w]=l.useState(()=>Array.isArray(f)?f:[]),[d,M]=l.useState(()=>Array.isArray(v)?v:[]),[u,R]=l.useState(null),[F,A]=l.useState(null),[s,c]=l.useState(0),[y,j]=l.useState(!S.current),[W,q]=l.useState(null),C=l.useRef(0),z=l.useRef(a),T=l.useRef(u);T.current=u;const I=l.useCallback(async()=>{const n=++C.current;S.current||j(!0),q(null);try{const[i,x]=await Promise.all([G({q:o.q||void 0,runId:o.runId||void 0,scoreMin:K(o.scoreMin),scoreMax:K(o.scoreMax),limit:100,offset:0},a),Q(a)]);if(n!==C.current)return;const E=k(i.results,i.evals,i.items).map(X);M(E),O(h,E.length>500?E.slice(0,500):E,{maxBytes:5e5}),c(typeof i.count=="number"?i.count:E.length);const V=k(x.runs,x.items).map(U=>{const N=p(U),D=p(N.counts);return{id:String(N.id??""),createdAt:String(N.createdAt??""),completedAt:typeof N.completedAt=="string"?N.completedAt:void 0,status:String(N.status??"pending"),evaluatedTaskCount:typeof D.totalTasks=="number"?D.totalTasks:0}});w(V),O(t,V,{maxBytes:5e5}),S.current=!0,T.current&&!E.some(U=>U.id===T.current)&&(R(null),A(null))}catch(i){if(n!==C.current)return;q(i instanceof Error?i.message:"Failed to load evals")}finally{n===C.current&&j(!1)}},[o.q,o.runId,o.scoreMax,o.scoreMin,a,h,t]),_=l.useCallback(async n=>{const i=await J(n,a),x=i.result??i;A(oe(x))},[a]);l.useEffect(()=>{if(z.current===a)return;z.current=a;const n=L(t,{maxAgeMs:P}),i=L(h,{maxAgeMs:P}),x=Array.isArray(n)&&n.length>0||Array.isArray(i)&&i.length>0;w(Array.isArray(n)?n:[]),M(Array.isArray(i)?i:[]),j(!x),S.current=x},[a,h,t]),l.useEffect(()=>{const n=window.setTimeout(()=>{I()},ie);return()=>window.clearTimeout(n)},[I]),l.useEffect(()=>{if(!u){A(null);return}_(u)},[_,u]),l.useEffect(()=>{const n=window.setInterval(()=>{I(),u&&_(u)},ce);return()=>window.clearInterval(n)},[_,I,u]);const Y=l.useCallback(n=>{T.current=n,R(n)},[]);return{loading:y,error:W,results:d,count:s,runs:b,filters:o,setFilters:g,refresh:I,selectedEvalId:u,setSelectedEvalId:Y,selectedEval:F}}function ge({projectId:r,onOpenSettings:a,onOpenTaskDetail:m}){const{t}=ne("app"),{loading:h,error:f,results:v,runs:S,filters:o,setFilters:g,selectedEvalId:b,setSelectedEvalId:w,selectedEval:d,refresh:M}=de({projectId:r}),[u,R]=l.useState(!0);l.useEffect(()=>{let s=!1;return Z(r).then(c=>{if(s)return;const y=c.evalSettings?.enabled;R(y??!1)}).catch(()=>{s||R(!1)}),()=>{s=!0}},[r]);const F=v.length>0,A=l.useMemo(()=>v.find(s=>s.id===b)??null,[v,b]);return u?e.jsxs("section",{className:"evals-view","data-testid":"evals-view",children:[e.jsx(H,{icon:B,title:t("evals.title","Evals")}),e.jsxs("div",{className:"evals-view__body",children:[e.jsxs("div",{className:"evals-list card",children:[e.jsxs("div",{className:"evals-toolbar",children:[e.jsx("input",{className:"input",placeholder:t("evals.searchPlaceholder","Search task or rationale"),value:o.q,onChange:s=>g(c=>({...c,q:s.target.value}))}),e.jsxs("select",{className:"select",value:o.runId,onChange:s=>g(c=>({...c,runId:s.target.value})),children:[e.jsx("option",{value:"",children:t("evals.allRuns","All runs")}),S.map(s=>e.jsx("option",{value:s.id,children:s.id},s.id))]}),e.jsx("input",{className:"input",placeholder:t("evals.minScorePlaceholder","Min score"),value:o.scoreMin,onChange:s=>g(c=>({...c,scoreMin:s.target.value}))}),e.jsx("input",{className:"input",placeholder:t("evals.maxScorePlaceholder","Max score"),value:o.scoreMax,onChange:s=>g(c=>({...c,scoreMax:s.target.value}))}),e.jsx("button",{className:"btn btn-icon",type:"button",onClick:()=>void M(),"aria-label":t("evals.refreshAria","Refresh evals"),children:e.jsx(se,{size:16})})]}),h&&e.jsx("p",{className:"evals-state","data-testid":"evals-loading",children:e.jsx(ae,{label:t("evals.loading","Loading evals…")})}),f&&e.jsx("p",{className:"evals-state evals-state--error",children:f}),!h&&!f&&!F&&e.jsx("p",{className:"evals-state",children:t("evals.empty","No evals yet. Scheduled evals review tasks completed since the last run.")}),e.jsx("ul",{className:"evals-results","data-testid":"evals-results",children:v.map(s=>e.jsx("li",{children:e.jsxs("button",{className:`evals-result ${s.id===b?"evals-result--active":""}`,type:"button",onClick:()=>w(s.id),draggable:le(),onDragStart:c=>{te(c.dataTransfer,{kind:"eval-result",id:s.id,projectId:r})},children:[e.jsx("span",{className:"evals-result-title",children:s.taskTitle}),e.jsxs("span",{className:"evals-result-meta",children:[s.taskId," · ",s.runId," · ",s.overallScore??t("evals.naPlaceholder","n/a")]})]})},s.id))})]}),e.jsxs("div",{className:"evals-detail card","data-testid":"evals-detail",children:[!d&&e.jsx("p",{className:"evals-state",children:t("evals.selectPrompt","Select an evaluation to inspect scores, rationale, and evidence.")}),d&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"evals-detail-title",children:A?.taskTitle??d.taskTitle}),e.jsxs("p",{className:"evals-result-meta",children:[d.taskId," · ",d.runId]}),e.jsx("p",{className:"evals-score",children:t("evals.overallScore","Overall score: {{score}}",{score:d.overallScore??t("evals.naPlaceholder","n/a")})}),e.jsx("ul",{className:"evals-categories",children:d.categoryScores.map(s=>e.jsxs("li",{children:[s.category,": ",s.finalScore]},s.category))}),e.jsx("p",{className:"evals-rationale",children:d.rationale||t("evals.noRationale","No rationale recorded.")}),e.jsxs("div",{children:[e.jsx("h4",{children:t("evals.evidenceHeading","Evidence")}),e.jsx("ul",{className:"evals-links",children:d.evidence.map((s,c)=>{const y=typeof s.metadata?.taskId=="string"?s.metadata.taskId:void 0,j=typeof s.metadata?.url=="string"?s.metadata.url:void 0;return e.jsx("li",{children:y?e.jsx("button",{type:"button",className:"btn",onClick:()=>m?.(y),children:s.ref}):j?e.jsxs("a",{href:j,target:"_blank",rel:"noreferrer",className:"evals-external-link",children:[s.ref,e.jsx(re,{size:14})]}):e.jsx("span",{children:s.ref})},`${s.ref}-${c}`)})})]}),e.jsxs("div",{children:[e.jsx("h4",{children:t("evals.suggestedFollowupsHeading","Suggested follow-up tasks")}),e.jsxs("ul",{className:"evals-follow-ups",children:[d.followUps.length===0&&e.jsx("li",{children:t("evals.noFollowups","None")}),d.followUps.map(s=>e.jsxs("li",{children:[e.jsx("strong",{children:s.title}),e.jsx("p",{children:s.rationale})]},s.suggestionId))]})]})]})]})]})]}):e.jsxs("section",{className:"evals-view","data-testid":"evals-disabled",children:[e.jsx(H,{icon:B,title:t("evals.title","Evals")}),e.jsxs("div",{className:"evals-view__empty",children:[e.jsx("h2",{className:"evals-title",children:t("evals.disabledTitle","Scheduled evals are disabled")}),e.jsx("p",{className:"evals-empty-copy",children:t("evals.enablePrompt","Enable Scheduled Evals to review scored tasks, evidence, and follow-up recommendations.")}),e.jsxs("button",{className:"btn btn-primary",type:"button",onClick:()=>a?.("scheduled-evals"),children:[e.jsx(ee,{size:16}),t("evals.openSettings","Open Scheduled Evals Settings")]})]})]})}export{ge as EvalsView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as n}from"./vendor-react-SZ_qB27O.js";import{B as $,D as G,F as V,G as W,H as B,I as U}from"./index-
|
|
1
|
+
import{r as s,j as n}from"./vendor-react-SZ_qB27O.js";import{B as $,D as G,F as V,G as W,H as B,I as U}from"./index-D8TQBkB7.js";import{u as z}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";function en({isOpen:l,onClose:R,onUseDraft:M,projectId:x,existingAgents:P,mode:_="create",existingAgentConfig:L}){const{t:e}=z("app"),[m,d]=s.useState("initial"),[f,S]=s.useState(""),[c,k]=s.useState(null),[C,I]=s.useState(""),[w,A]=s.useState("answer"),[v,p]=s.useState(""),[t,H]=s.useState(null),[T,g]=s.useState(null),[E,y]=s.useState([]),b=_==="edit",o=s.useRef(l),N=s.useCallback(()=>{d("initial"),S(""),k(null),I(""),A("answer"),p(""),H(null),g(null),y([])},[]),D=s.useMemo(()=>$.map(a=>({id:a.id,label:a.name,description:a.description})),[]);s.useEffect(()=>{if(o.current=l,!c)return;const a=G(c,x,{onThinking:i=>{o.current&&y(F=>{const h=[...F],j=h[h.length-1];return j&&!j.question?(h[h.length-1]={...j,thinkingOutput:`${j.thinkingOutput??""}${i}`},h):[...h,{response:{},thinkingOutput:i}]})},onQuestion:i=>{o.current&&(I(i.question),A(i.id),d("question"))},onSummary:i=>{o.current&&(H(i),d("summary"))},onError:i=>{o.current&&(g(i),d("error"))}});return()=>{o.current=!1,a.close()}},[l,c,x]);const u=async()=>{o.current=!1;try{c&&await W(c,x)}catch{}finally{N(),R()}};if(s.useEffect(()=>{o.current=l,l||N()},[l,N]),!l)return null;const r=a=>a==null||a===""?n.jsx("em",{className:"experimental-agent-onboarding-modal__summary-empty",children:e("agents.onboarding.notSet","Not set")}):n.jsx("span",{children:a}),q=async()=>{d("loading"),g(null);try{const a=await B(f,{mode:_,existingAgentConfig:L,existingAgents:P.map(i=>({id:i.id,name:i.name,role:i.role})),templates:D},x);if(!o.current)return;k(a.sessionId)}catch(a){if(!o.current)return;g(a.message),d("error")}},Q=async()=>{if(c){d("loading"),g(null);try{const a={[w]:v};if(y(i=>[...i,{question:{id:w,type:"text",question:C},response:a}]),await U(c,a,x),!o.current)return;p("")}catch(a){if(!o.current)return;g(a.message),d("error")}}},O=async()=>{t&&(M(t),await u())};return n.jsx("div",{className:"modal-overlay open",role:"presentation",children:n.jsxs("div",{className:"modal modal-lg experimental-agent-onboarding-modal",role:"dialog","aria-modal":"true","aria-label":e("agents.onboarding.dialogLabel","AI Interview"),children:[n.jsxs("div",{className:"modal-header",children:[n.jsx("h3",{children:e("agents.onboarding.title","AI Interview")}),n.jsx("button",{className:"modal-close",onClick:()=>void u(),"aria-label":e("common.closeAriaLabel","Close"),children:"×"})]}),E.length>0&&n.jsx(V,{entries:E}),m==="initial"&&n.jsxs("div",{className:"form-group",children:[n.jsx("label",{htmlFor:"agent-onboarding-intent",children:b?e("agents.onboarding.intentLabelEdit","What should this agent change or improve?"):e("agents.onboarding.intentLabelCreate","What should this new agent own?")}),n.jsx("textarea",{id:"agent-onboarding-intent",className:"input experimental-agent-onboarding-modal__textarea",value:f,onChange:a=>S(a.target.value)}),n.jsxs("div",{className:"modal-actions",children:[n.jsx("button",{className:"btn",onClick:()=>void u(),children:e("common.cancel","Cancel")}),n.jsx("button",{className:"btn btn-primary",disabled:!f.trim(),onClick:()=>void q(),children:b?e("agents.onboarding.startInterview","Start interview"):e("agents.onboarding.startOnboarding","Start onboarding")})]})]}),(m==="loading"||m==="question")&&n.jsxs("div",{className:"form-group",children:[n.jsx("label",{htmlFor:"agent-onboarding-answer",children:C||e("agents.onboarding.thinking","Thinking...")}),n.jsx("textarea",{id:"agent-onboarding-answer",className:"input experimental-agent-onboarding-modal__textarea",value:v,onChange:a=>p(a.target.value)}),n.jsxs("div",{className:"modal-actions",children:[n.jsx("button",{className:"btn",onClick:()=>void u(),children:e("common.cancel","Cancel")}),n.jsx("button",{className:"btn btn-primary",disabled:m==="loading"||!v.trim(),onClick:()=>void Q(),children:e("agents.onboarding.continue","Continue")})]})]}),m==="summary"&&t&&n.jsxs("div",{className:"form-group",children:[n.jsx("label",{children:b?e("agents.onboarding.updatedDraftReady","Updated draft ready for review"):e("agents.onboarding.draftReady","Draft ready for review")}),n.jsx("p",{className:"experimental-agent-onboarding-modal__summary-intro",children:e("agents.onboarding.draftIntro","Review this generated draft. Nothing is applied until you confirm.")}),n.jsxs("div",{className:"experimental-agent-onboarding-modal__summary card",children:[n.jsxs("div",{className:"experimental-agent-onboarding-modal__summary-section",children:[n.jsx("h4",{children:e("agents.onboarding.sectionIdentity","Identity")}),n.jsxs("dl",{className:"experimental-agent-onboarding-modal__summary-list",children:[n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldName","Name")}),n.jsx("dd",{children:r(t.name)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldRole","Role")}),n.jsx("dd",{children:r(t.role)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldTitle","Title")}),n.jsx("dd",{children:r(t.title)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldIcon","Icon")}),n.jsx("dd",{children:r(t.icon)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldReportsTo","Reports To")}),n.jsx("dd",{children:r(t.reportsTo)})]})]})]}),n.jsxs("div",{className:"experimental-agent-onboarding-modal__summary-section",children:[n.jsx("h4",{children:e("agents.onboarding.sectionConfiguration","Configuration")}),n.jsxs("dl",{className:"experimental-agent-onboarding-modal__summary-list",children:[n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldInlineInstructions","Inline Instructions")}),n.jsx("dd",{className:"experimental-agent-onboarding-modal__summary-block",children:r(t.instructionsText)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldSoul","Soul")}),n.jsx("dd",{className:"experimental-agent-onboarding-modal__summary-block",children:r(t.soul)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldAgentMemory","Agent Memory")}),n.jsx("dd",{className:"experimental-agent-onboarding-modal__summary-block",children:r(t.memory)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldSkills","Skills")}),n.jsx("dd",{children:r(t.skills?.join(", "))})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldThinkingLevel","Thinking Level")}),n.jsx("dd",{children:r(t.thinkingLevel)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldMaxTurns","Max Turns")}),n.jsx("dd",{children:r(t.maxTurns)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldTemplate","Template")}),n.jsx("dd",{children:r(t.templateId)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldPatternAgent","Pattern Agent")}),n.jsx("dd",{children:r(t.patternAgentId)})]})]})]}),(t.heartbeatProcedurePath||t.heartbeatIntervalMs||t.heartbeatEnabled!==void 0||t.modelHint||t.runtimeHint)&&n.jsxs("div",{className:"experimental-agent-onboarding-modal__summary-section",children:[n.jsx("h4",{children:e("agents.onboarding.sectionRuntimeHints","Runtime Hints")}),n.jsxs("dl",{className:"experimental-agent-onboarding-modal__summary-list",children:[n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldHeartbeatPath","Heartbeat Procedure Path")}),n.jsx("dd",{children:r(t.heartbeatProcedurePath)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldHeartbeatInterval","Heartbeat Interval")}),n.jsx("dd",{children:r(t.heartbeatIntervalMs?`${t.heartbeatIntervalMs}ms`:void 0)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldHeartbeatEnabled","Heartbeat Enabled")}),n.jsx("dd",{children:r(t.heartbeatEnabled===void 0?void 0:t.heartbeatEnabled?e("agents.onboarding.yes","yes"):e("agents.onboarding.no","no"))})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldModelHint","Model Hint")}),n.jsx("dd",{children:r(t.modelHint)})]}),n.jsxs("div",{children:[n.jsx("dt",{children:e("agents.onboarding.fieldRuntimeHint","Runtime Hint")}),n.jsx("dd",{children:r(t.runtimeHint)})]})]})]}),t.rationale&&n.jsxs("div",{className:"experimental-agent-onboarding-modal__summary-section",children:[n.jsx("h4",{children:e("agents.onboarding.sectionRationale","Rationale")}),n.jsx("p",{className:"experimental-agent-onboarding-modal__summary-block",children:t.rationale})]})]}),n.jsxs("div",{className:"modal-actions",children:[n.jsx("button",{className:"btn",onClick:()=>void u(),children:e("common.cancel","Cancel")}),n.jsx("button",{className:"btn btn-primary",onClick:()=>void O(),children:b?e("agents.onboarding.applyDraftSettings","Apply draft to settings form"):e("agents.onboarding.applyDraftAgent","Apply draft to agent form")})]})]}),m==="error"&&T&&n.jsxs("div",{className:"form-group",children:[n.jsx("div",{className:"form-error",children:T}),n.jsx("div",{className:"modal-actions",children:n.jsx("button",{className:"btn",onClick:()=>void u(),children:e("common.close","Close")})})]})]})})}export{en as ExperimentalAgentOnboardingModal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as n,j as t}from"./vendor-react-SZ_qB27O.js";import{V as js,T as ws,P as Ns,S as Es,j as Ss,r as $s,k as Ms,X as Cs,s as Ts,l as As,m as Gs,n as Ls}from"./index-
|
|
1
|
+
import{r as n,j as t}from"./vendor-react-SZ_qB27O.js";import{V as js,T as ws,P as Ns,S as Es,j as Ss,r as $s,k as Ms,X as Cs,s as Ts,l as As,m as Gs,n as Ls}from"./index-D8TQBkB7.js";import{u as Ds}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";const Ps=5,Fs=3,Rs=280;function h(d,m){if(!m)return d;const r=d.includes("?")?"&":"?";return`${d}${r}projectId=${encodeURIComponent(m)}`}function is(d){return!!(d&&typeof d=="object"&&"code"in d&&d.code==="ACTIVE_GOAL_LIMIT_EXCEEDED")}function Hs({initialGoals:d,anchorGoalId:m,projectId:r,onNavigateToMission:as}){const{t:a}=Ds("app"),[c,k]=n.useState(()=>d??[]),[ns,j]=n.useState(null),p=n.useRef(null),[w,L]=n.useState(d===void 0),[D,l]=n.useState(null),[os,P]=n.useState(!1),[v,F]=n.useState(""),[R,N]=n.useState(""),[U,u]=n.useState(null),[O,_]=n.useState(!1),[y,E]=n.useState(!1),[S,V]=n.useState(null),[q,$]=n.useState(""),[B,M]=n.useState(""),[H,f]=n.useState(null),[I,z]=n.useState(!1),[ls,rs]=n.useState(()=>new Set),[ds,cs]=n.useState([]),[x,C]=n.useState({}),[T,W]=n.useState({}),[A,K]=n.useState(null),[us,X]=n.useState(null);n.useEffect(()=>{if(d!==void 0)return;let s=!0;return(async()=>{try{L(!0),l(null);const i=await fetch(h("/api/goals",r));if(!i.ok)throw new Error(`Failed to load goals (${i.status})`);const o=await i.json();if(!s)return;k(Array.isArray(o.goals)?o.goals:[])}catch{if(!s)return;l(a("goals.loadError","Unable to load goals right now. Please try again."))}finally{s&&L(!1)}})(),()=>{s=!1}},[d,r]),n.useEffect(()=>{let s=!0;return(async()=>{try{const i=await fetch(h("/api/missions",r));if(!i.ok)throw new Error(`Failed to load missions (${i.status})`);const o=await i.json(),g=Array.isArray(o)?o:Array.isArray(o.missions)?o.missions:[];s&&cs(g.map(b=>({id:b.id,title:b.title,status:b.status})))}catch{s&&l(a("goals.missionsLoadError","Unable to load missions right now. Please try again."))}})(),()=>{s=!1}},[r,a]);const J=async s=>{const e=await fetch(h(`/api/goals/${encodeURIComponent(s)}/missions`,r));if(!e.ok)throw new Error(`Failed to load linked missions (${e.status})`);const i=await e.json();return Array.isArray(i.missions)?i.missions:[]};n.useEffect(()=>{let s=!0;return(async()=>{if(c.length===0){C({});return}try{const i=await Promise.all(c.map(async o=>[o.id,await J(o.id)]));s&&C(Object.fromEntries(i))}catch{s&&l(a("goals.linkedMissionsLoadError","Unable to load linked missions right now. Please try again."))}})(),()=>{s=!1}},[c,a]);const G=n.useMemo(()=>c.filter(s=>s.status==="active").length,[c]),gs=G>=Fs&&G<=Ps;n.useEffect(()=>{if(!m){j(null);return}const s=document.getElementById(`goal-card-${m}`);if(s)return j(m),typeof s.scrollIntoView=="function"&&s.scrollIntoView({behavior:"smooth",block:"center"}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{j(e=>e===m?null:e),p.current=null},1600),()=>{p.current&&(clearTimeout(p.current),p.current=null)}},[m,c]);function ms(){l(null),u(null),P(!0)}function hs(s){V(s.id),$(s.title),M(s.description??""),f(null)}function Q(){V(null),$(""),M(""),f(null)}function Y(){P(!1),F(""),N(""),u(null),E(!1)}async function ps(){const s=v.trim();if(!s){u(a("goals.titleRequired","Title is required."));return}try{E(!0),u(null);const e=await Gs(s,r);N(e)}catch(e){u(Ls(e))}finally{E(!1)}}async function fs(){const s=v.trim();if(!s){u(a("goals.titleRequired","Title is required."));return}try{_(!0),u(null),l(null);const e=await fetch(h("/api/goals",r),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({title:s,description:R})});if(e.ok){const o=await e.json();k(g=>[...g,o]),Y();return}let i=null;try{i=await e.json()}catch{i=null}if(e.status===409&&is(i)){l(a("goals.capError","Cannot activate more than 5 goals. Resolve an active goal before activating another."));return}u(a("goals.createError","Unable to create goal right now. Please try again."))}catch{u(a("goals.createError","Unable to create goal right now. Please try again."))}finally{_(!1)}}async function bs(){if(!S)return;const s=q.trim();if(!s){f(a("goals.titleRequired","Title is required."));return}try{z(!0),f(null);const e=await fetch(h(`/api/goals/${S}`,r),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({title:s,description:B})});if(!e.ok)throw new Error(`Failed to update goal (${e.status})`);const i=await e.json();k(o=>o.map(g=>g.id===i.id?i:g)),Q()}catch{f(a("goals.saveError","Unable to save goal right now. Please try again."))}finally{z(!1)}}function ks(s){return s.length>Rs||s.includes(`
|
|
2
2
|
`)}function vs(s){rs(e=>{const i=new Set(e);return i.has(s)?i.delete(s):i.add(s),i})}function Z(s){const e=new Set((x[s]??[]).map(i=>i.id));return ds.filter(i=>!e.has(i.id))}async function ss(s){const e=await J(s);C(i=>({...i,[s]:e})),W(i=>({...i,[s]:""}))}async function ys(s){const e=T[s];if(e)try{K(s),l(null);const i=await fetch(h(`/api/missions/${encodeURIComponent(e)}/goals/${encodeURIComponent(s)}`,r),{method:"POST"});if(!i.ok)throw new Error(`Failed to link mission (${i.status})`);await ss(s)}catch{l(a("goals.linkMissionError","Unable to link mission right now. Please try again."))}finally{K(null)}}async function xs(s,e){try{X(`${s}:${e}`),l(null);const i=await fetch(h(`/api/missions/${encodeURIComponent(e)}/goals/${encodeURIComponent(s)}`,r),{method:"DELETE"});if(!i.ok)throw new Error(`Failed to unlink mission (${i.status})`);await ss(s)}catch{l(a("goals.unlinkMissionError","Unable to unlink mission right now. Please try again."))}finally{X(null)}}async function ts(s){const e=s.status==="active"?`/api/goals/${s.id}/archive`:`/api/goals/${s.id}/unarchive`;try{l(null);const i=await fetch(h(e,r),{method:"POST"});if(i.ok){const g=await i.json();k(b=>b.map(es=>es.id===g.id?g:es));return}let o=null;try{o=await i.json()}catch{o=null}if(i.status===409&&is(o)){l(a("goals.capError","Cannot activate more than 5 goals. Resolve an active goal before activating another."));return}l(a("goals.updateError","Unable to update goal status right now. Please try again."))}catch{l(a("goals.updateError","Unable to update goal status right now. Please try again."))}}return t.jsxs("section",{className:"goals-view","data-testid":"goals-view",children:[t.jsx(js,{icon:ws,title:a("goals.title","Goals"),actions:t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"goals-count","data-testid":"goals-active-count",children:a("goals.activeCount","{{count}} active goals",{count:G})}),t.jsxs("button",{type:"button",className:"btn btn-primary goals-add-button",onClick:ms,"data-testid":"goals-add-button",children:[t.jsx(Ns,{size:18,"aria-hidden":"true"}),a("goals.addGoal","Add Goal")]})]})}),t.jsxs("div",{className:"goals-view__content",children:[os?t.jsxs("div",{className:"card goals-form","data-testid":"goals-form",children:[t.jsx("label",{className:"goals-form-label",htmlFor:"goals-form-title",children:a("goals.labelTitle","Title")}),t.jsx("input",{id:"goals-form-title",className:"input",type:"text",value:v,maxLength:200,onChange:s=>F(s.target.value),"data-testid":"goals-form-title"}),t.jsxs("div",{className:"goals-form-label-row",children:[t.jsx("label",{className:"goals-form-label",htmlFor:"goals-form-description",children:a("goals.labelDescription","Description")}),t.jsxs("button",{type:"button",className:"btn goals-form-draft-button",onClick:()=>void ps(),disabled:!v.trim()||y,"data-testid":"goals-form-draft-ai",children:[t.jsx(Es,{"aria-hidden":"true"}),y?a("goals.drafting","Drafting…"):a("goals.draftWithAi","Draft with AI")]})]}),t.jsx("textarea",{id:"goals-form-description",className:"input",value:R,maxLength:5e3,onChange:s=>N(s.target.value),"data-testid":"goals-form-description"}),U?t.jsx("p",{className:"form-error goals-error",role:"alert",children:U}):null,t.jsxs("div",{className:"goals-form-actions",children:[t.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>void fs(),disabled:O||y,"data-testid":"goals-form-submit",children:a("actions.save","Save")}),t.jsx("button",{type:"button",className:"btn",onClick:Y,disabled:O||y,"data-testid":"goals-form-cancel",children:a("actions.cancel","Cancel")})]})]}):null,gs?t.jsx("p",{className:"goals-warning",role:"status",children:a("goals.capWarning","Approaching the 5-active goal cap. Keep active goals focused.")}):null,D?t.jsx("p",{className:"form-error goals-error",role:"alert","data-testid":"goals-error",children:D}):null,w?t.jsx("p",{className:"goals-loading",role:"status","data-testid":"goals-loading",children:a("goals.loading","Loading goals…")}):null,!w&&c.length===0?t.jsx("div",{className:"goals-empty card","data-testid":"goals-empty-state",children:a("goals.emptyState","No goals yet. Add one to begin tracking strategic outcomes.")}):null,!w&&c.length>0?t.jsx("div",{className:"goals-list","data-testid":"goals-list",children:c.map(s=>t.jsxs("article",{id:`goal-card-${s.id}`,className:`card goals-card ${s.status==="archived"?"goals-card-archived":""} ${ns===s.id?"goals-card--anchored":""}`.trim(),"data-testid":`goal-card-${s.id}`,draggable:As(),onDragStart:e=>{Ts(e.dataTransfer,{kind:"goal",id:s.id,projectId:r})},children:[S===s.id?t.jsxs("div",{className:"goals-card-main goals-card-edit",children:[t.jsx("label",{className:"goals-form-label",htmlFor:`goal-edit-title-${s.id}`,children:a("goals.labelTitle","Title")}),t.jsx("input",{id:`goal-edit-title-${s.id}`,className:"input",type:"text",value:q,maxLength:200,onChange:e=>$(e.target.value),"data-testid":`goal-edit-title-${s.id}`}),t.jsx("label",{className:"goals-form-label",htmlFor:`goal-edit-description-${s.id}`,children:a("goals.labelDescription","Description")}),t.jsx("textarea",{id:`goal-edit-description-${s.id}`,className:"input",value:B,maxLength:5e3,onChange:e=>M(e.target.value),"data-testid":`goal-edit-description-${s.id}`}),H?t.jsx("p",{className:"form-error goals-error",role:"alert",children:H}):null,t.jsxs("div",{className:"goals-card-actions",children:[t.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>void bs(),disabled:I,"data-testid":`goal-edit-save-${s.id}`,children:a("actions.save","Save")}),t.jsx("button",{type:"button",className:"btn",onClick:Q,disabled:I,"data-testid":`goal-edit-cancel-${s.id}`,children:a("actions.cancel","Cancel")})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"goals-card-main",children:[t.jsx("h3",{className:"goals-card-title",children:s.title}),s.description?(()=>{const e=ks(s.description),i=ls.has(s.id);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`markdown-body goals-card-description ${e&&!i?"goals-card-description-collapsed":""}`.trim(),children:t.jsx(Ss,{remarkPlugins:[$s],children:s.description})}),e?t.jsx("button",{type:"button",className:"btn goals-card-description-toggle","aria-expanded":i,"data-testid":`goal-description-toggle-${s.id}`,onClick:()=>vs(s.id),children:i?a("actions.showLess","Show less"):a("actions.showMore","Show more")}):null]})})():null,t.jsxs("p",{className:"goals-card-status",children:[a("goals.status","Status"),": ",s.status]})]}),t.jsxs("div",{className:"goals-card-actions",children:[t.jsx("button",{type:"button",className:"btn",onClick:()=>hs(s),"data-testid":`goal-edit-${s.id}`,children:a("actions.edit","Edit")}),s.status==="active"?t.jsx("button",{type:"button",className:"btn goals-activate-button",onClick:()=>void ts(s),"data-testid":`goal-archive-${s.id}`,children:a("goals.archive","Archive")}):t.jsx("button",{type:"button",className:"btn goals-activate-button",onClick:()=>void ts(s),"data-testid":`goal-unarchive-${s.id}`,children:a("goals.unarchive","Unarchive")})]})]}),t.jsxs("section",{className:"goals-linked-missions","aria-label":a("goals.linkedMissions","Linked missions"),children:[t.jsxs("div",{className:"goals-linked-missions-header",children:[t.jsx("h4",{className:"goals-linked-missions-title",children:a("goals.linkedMissionsTitle","Linked Missions")}),t.jsx("span",{className:"goals-linked-missions-count",children:a("goals.linkedMissionsCount",{count:x[s.id]?.length??0,defaultValue_one:"{{count}} linked",defaultValue_other:"{{count}} linked"})})]}),t.jsxs("div",{className:"goals-linked-missions-controls",children:[t.jsxs("select",{className:"input goals-linked-missions-picker","data-testid":`goal-mission-picker-${s.id}`,value:T[s.id]??"",onChange:e=>W(i=>({...i,[s.id]:e.target.value})),"aria-label":a("goals.missionPicker","Mission to link"),disabled:A===s.id||Z(s.id).length===0,children:[t.jsx("option",{value:"",children:a("goals.selectMission","Select a mission")}),Z(s.id).map(e=>t.jsx("option",{value:e.id,children:e.title},e.id))]}),t.jsxs("button",{type:"button",className:"btn btn-primary goals-linked-missions-link-button","data-testid":`goal-mission-link-button-${s.id}`,disabled:!T[s.id]||A===s.id,onClick:()=>void ys(s.id),children:[t.jsx(Ms,{size:16,"aria-hidden":"true"}),A===s.id?a("goals.linkingMission","Linking…"):a("goals.linkMission","Link mission")]})]}),(x[s.id]?.length??0)>0?t.jsx("div",{className:"goals-linked-missions-list",children:(x[s.id]??[]).map(e=>t.jsxs("div",{className:"goals-linked-mission-chip","data-testid":`goal-linked-mission-chip-${e.id}`,children:[t.jsx("button",{type:"button",className:"btn goals-linked-mission-link",onClick:()=>as?.(e.id),children:e.title}),t.jsx("span",{className:"goals-linked-mission-status",children:e.status}),t.jsx("button",{type:"button",className:"btn-icon goals-linked-mission-unlink","data-testid":`goal-linked-mission-unlink-${e.id}`,"aria-label":a("goals.unlinkMission","Unlink mission"),disabled:us===`${s.id}:${e.id}`,onClick:()=>void xs(s.id,e.id),children:t.jsx(Cs,{size:16,"aria-hidden":"true"})})]},e.id))}):t.jsx("p",{className:"goals-linked-missions-empty",children:a("goals.noLinkedMissions","No linked missions.")})]})]},s.id))}):null]})]})}export{Hs as GoalsView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{c as ze,ao as ce,ap as we,aq as Ce,bx as je,by as Ye,au as Me,bz as Qe,bA as Je,bB as Ze,bC as es,bD as ss,bE as ts,bF as Ie,bG as is,bH as ns,bI as Ae,V as as,S as A,bJ as rs,X as Ne,bK as fe,R as N,Y as cs,bL as ls,am as _e,h as le,bM as Ee,bu as os,P as De,aQ as hs,a_ as Pe,bN as gs,s as ds,l as us}from"./index-
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{c as ze,ao as ce,ap as we,aq as Ce,bx as je,by as Ye,au as Me,bz as Qe,bA as Je,bB as Ze,bC as es,bD as ss,bE as ts,bF as Ie,bG as is,bH as ns,bI as Ae,V as as,S as A,bJ as rs,X as Ne,bK as fe,R as N,Y as cs,bL as ls,am as _e,h as le,bM as Ee,bu as os,P as De,aQ as hs,a_ as Pe,bN as gs,s as ds,l as us}from"./index-D8TQBkB7.js";import{u as $e}from"./vendor-i18n-GF3RlKbq.js";import{U as Fe}from"./users-DGOPLxzy.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r,j as e}from"./vendor-react-SZ_qB27O.js";import{u as Le,f as fe,a as Se,s as Re,i as qe,t as Te,b as je,c as ve,d as Pe,e as He,g as _e,h as Oe}from"./SettingsModal-
|
|
1
|
+
import{r,j as e}from"./vendor-react-SZ_qB27O.js";import{u as Le,f as fe,a as Se,s as Re,i as qe,t as Te,b as je,c as ve,d as Pe,e as He,g as _e,h as Oe}from"./SettingsModal-oTMDyzjF.js";import{aW as Ue,aV as $e,V as Qe,aX as We,L as D,aJ as Ne}from"./index-D8TQBkB7.js";import{u as Be}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";const O=".fusion/memory/MEMORY.md",Ve=5e4,Ye="0 3 * * *",Ge="0 4 * * *";function de(i){return{memoryEnabled:i.memoryEnabled!==!1,memoryAutoSummarizeEnabled:i.memoryAutoSummarizeEnabled??!1,memoryAutoSummarizeThresholdChars:i.memoryAutoSummarizeThresholdChars??Ve,memoryAutoSummarizeSchedule:i.memoryAutoSummarizeSchedule??Ye,memoryDreamsEnabled:i.memoryDreamsEnabled??!1,memoryDreamsSchedule:i.memoryDreamsSchedule??Ge}}function Ce(i,t){return i.some(h=>h.path===t)?t:i.find(h=>h.path===O)?.path??i[0]?.path??O}function Xe(i={}){const{projectId:t}=i,[h,s]=r.useState(null),[d,v]=r.useState(!0),[L,z]=r.useState(!1),[I,S]=r.useState(()=>de({})),[x,j]=r.useState(!0),[n,k]=r.useState(!1),[U,$]=r.useState([]),[J,R]=r.useState(!0),[y,M]=r.useState(O),[N,w]=r.useState(""),[ye,Q]=r.useState(!1),[l,u]=r.useState(!1),[K,W]=r.useState(!1),[g,B]=r.useState(!1),[ee,q]=r.useState(!1),[c,P]=r.useState(null),[he,V]=r.useState(!0),[se,Y]=r.useState(!1),[te,G]=r.useState(!1),{status:X,loading:ue,refresh:A}=Le({projectId:t}),Z=r.useCallback(m=>{w(m),u(!0)},[]),H=r.useCallback(async m=>{Q(!0);try{const{content:o}=await fe(m,t);M(m),w(o),u(!1)}finally{Q(!1)}},[t]),C=r.useCallback(async()=>{R(!0);try{const{files:m}=await Se(t);if($(m),m.length===0){M(O),w(""),u(!1);return}const o=Ce(m,y);o!==y&&await H(o)}finally{R(!1)}},[t,y,H]);r.useEffect(()=>{let m=!1;async function o(){try{const p=await ve(t);m||(s(p.content),z(p.exists),v(!1))}catch{m||(s(null),z(!1),v(!1))}}return o(),()=>{m=!0}},[t]),r.useEffect(()=>{let m=!1;async function o(){j(!0);try{const p=await $e(t);m||S(de(p))}catch{m||S(de({}))}finally{m||j(!1)}}return o(),()=>{m=!0}},[t]);const ae=r.useRef(y);r.useEffect(()=>{ae.current=y},[y]),r.useEffect(()=>{let m=!1;async function o(){R(!0);try{const{files:p}=await Se(t);if(m)return;if($(p),p.length===0){M(O),w(""),u(!1);return}const oe=Ce(p,ae.current),{content:xe}=await fe(oe,t);if(m)return;M(oe),w(xe),u(!1)}catch{m||($([]),M(O),w(""),u(!1))}finally{m||R(!1)}}return o(),()=>{m=!0}},[t]),r.useEffect(()=>{let m=!1;async function o(){try{const p=await je(t);m||(P(p),V(!1))}catch{m||(P(null),V(!1))}}return o(),()=>{m=!0}},[t]);const re=r.useCallback(async m=>{k(!0);try{const o=await Ue(m,t);S(de(o))}finally{k(!1)}},[t]),me=r.useCallback(async m=>{await H(m)},[H]),ne=r.useCallback(async()=>{if(l){W(!0);try{await Re(y,N,t),u(!1),await C()}finally{W(!1)}}},[N,l,y,t,C]),ie=r.useCallback(async()=>{G(!0);try{const m=await qe(t);return await A(),m}finally{G(!1)}},[t,A]),le=r.useCallback(async m=>Te(m,t),[t]),_=r.useCallback(async()=>{try{const m=await je(t);P(m)}catch{P(null)}},[t]),F=r.useCallback(async()=>{try{const m=await ve(t);s(m.content),z(m.exists)}catch{s(null),z(!1)}},[t]),f=r.useCallback(async m=>{await Pe(m,t),await F()},[t,F]),ge=r.useCallback(async()=>{B(!0);try{const m=await He(t);return await Promise.all([F(),_()]),{success:m.success,summary:m.summary}}finally{B(!1)}},[t,F,_]),T=r.useCallback(async()=>{q(!0);try{return await _e(t)}finally{q(!1)}},[t]),be=r.useCallback(async m=>{Y(!0);try{const o=await Oe(m,t),p=o.path??m;M(p),w(o.content),u(!1),await C()}finally{Y(!1)}},[t,C]);return{insightsContent:h,insightsLoading:d,insightsExists:L,refreshInsights:F,saveInsights:f,memorySettings:I,settingsLoading:x,savingMemorySettings:n,saveMemorySettings:re,memoryFiles:U,memoryFilesLoading:J,selectedFilePath:y,selectedFileContent:N,selectedFileLoading:ye,selectedFileDirty:l,setSelectedFileContent:Z,selectFile:me,saveSelectedFile:ne,savingSelectedFile:K,reloadMemoryFiles:C,backendStatus:X,backendLoading:ue,extractInsights:ge,extracting:g,triggerDreamNow:T,dreamRunning:ee,auditReport:c,auditLoading:he,refreshAudit:_,compactMemory:be,compacting:se,installQmdAction:ie,installingQmd:te,testRetrieval:le}}const Ze={Patterns:"pattern",Principles:"principle",Conventions:"convention",Pitfalls:"pitfall",Context:"context"},Je=72;function Ke(i,t){if(i.length<=t)return i;const h=Math.max(1,t-1),s=Math.ceil(h/2),d=Math.floor(h/2);return`${i.slice(0,s)}…${i.slice(i.length-d)}`}function es(i){const t=`${i.label} — ${i.path}`;return Ke(t,Je)}function ss(i){if(!i)return[];const t=[],h=i.split(/(?=^## )/m);for(const s of h){const d=s.trim();if(!d)continue;const v=d.match(/^##\s+(.+?)(\n|$)/);if(v){const L=v[1].trim(),z=Ze[L]??L.toLowerCase(),I=d.slice(v[0].length).replace(/<!--[\s\S]*?-->/g,"").trim(),S=I.split(`
|
|
2
2
|
`).reduce((x,j)=>{const n=j.trim();return/^[-*]\s+/.test(j)?x.push(n.replace(/^[-*]\s+/,"")):n.length>0&&x.length>0&&(x[x.length-1]=`${x[x.length-1]}
|
|
3
3
|
${j.trimEnd()}`),x},[]);(S.length>0||I.length>0)&&t.push({name:L,key:z,items:S.length>0?S:I.length>0?[I]:[],expanded:!0})}}return t}function ts(i){if(!i)return null;const t=i.match(/##\s+Last\s+Updated:\s*(\d{4}-\d{2}-\d{2})/i);return t?t[1]:null}function as(i){return i.reduce((t,h)=>t+h.items.length,0)}function ds({projectId:i,addToast:t,onSendSelectionToTask:h}){const{t:s}=Be("app"),[d,v]=r.useState("working"),[L,z]=r.useState(new Set),[I,S]=r.useState(!1),[x,j]=r.useState(null),[n,k]=r.useState({memoryEnabled:!0,memoryAutoSummarizeEnabled:!1,memoryAutoSummarizeThresholdChars:5e4,memoryAutoSummarizeSchedule:"0 3 * * *",memoryDreamsEnabled:!1,memoryDreamsSchedule:"0 4 * * *"}),[U,$]=r.useState(""),[J,R]=r.useState(!1),[y,M]=r.useState(null),{insightsContent:N,insightsLoading:w,insightsExists:ye,saveInsights:Q,memorySettings:l,settingsLoading:u,saveMemorySettings:K,savingMemorySettings:W,backendStatus:g,backendLoading:B,extractInsights:ee,extracting:q,auditReport:c,auditLoading:P,refreshAudit:he,compactMemory:V,compacting:se,installQmdAction:Y,installingQmd:te,testRetrieval:G,memoryFiles:X,memoryFilesLoading:ue,selectedFilePath:A,selectedFileContent:Z,selectedFileLoading:H,selectedFileDirty:C,setSelectedFileContent:ae,selectFile:re,saveSelectedFile:me,savingSelectedFile:ne,reloadMemoryFiles:ie,triggerDreamNow:le,dreamRunning:_}=Xe({projectId:i});r.useEffect(()=>{k(l)},[l]);const F=r.useMemo(()=>n.memoryEnabled!==l.memoryEnabled||n.memoryAutoSummarizeEnabled!==l.memoryAutoSummarizeEnabled||n.memoryAutoSummarizeThresholdChars!==l.memoryAutoSummarizeThresholdChars||n.memoryAutoSummarizeSchedule!==l.memoryAutoSummarizeSchedule||n.memoryDreamsEnabled!==l.memoryDreamsEnabled||n.memoryDreamsSchedule!==l.memoryDreamsSchedule,[n,l]),f=r.useMemo(()=>X.find(a=>a.path===A),[X,A]),ge=f?f.layer==="long-term"?s("memory.layerDescLongTerm","Curated durable decisions, conventions, constraints, and pitfalls promoted from dreams."):f.layer==="daily"?s("memory.layerDescDaily","Raw daily observations, open loops, and running context for dream processing."):s("memory.layerDescDreams","Synthesized patterns and open loops promoted from daily memory."):s("memory.editorDefaultDescription","Edits the selected memory file."),T=r.useMemo(()=>ss(N),[N]),be=r.useMemo(()=>as(T),[T]),m=r.useMemo(()=>ts(N),[N]),o=r.useCallback(a=>{z(b=>{const E=new Set(b);return E.has(a)?E.delete(a):E.add(a),E})},[]),p=r.useCallback(async a=>{try{await re(a)}catch{t(s("memory.loadFileFailed","Failed to load memory file"),"error")}},[re,t]),oe=r.useCallback(async()=>{try{await me(),t(s("memory.memorySaved","Memory saved"),"success")}catch{t(s("memory.saveMemoryFailed","Failed to save memory"),"error")}},[me,t]),xe=r.useCallback(async()=>{if(!F)return;const a={};n.memoryEnabled!==l.memoryEnabled&&(a.memoryEnabled=n.memoryEnabled),n.memoryAutoSummarizeEnabled!==l.memoryAutoSummarizeEnabled&&(a.memoryAutoSummarizeEnabled=n.memoryAutoSummarizeEnabled),n.memoryAutoSummarizeThresholdChars!==l.memoryAutoSummarizeThresholdChars&&(a.memoryAutoSummarizeThresholdChars=n.memoryAutoSummarizeThresholdChars),n.memoryAutoSummarizeSchedule!==l.memoryAutoSummarizeSchedule&&(a.memoryAutoSummarizeSchedule=n.memoryAutoSummarizeSchedule),n.memoryDreamsEnabled!==l.memoryDreamsEnabled&&(a.memoryDreamsEnabled=n.memoryDreamsEnabled),n.memoryDreamsSchedule!==l.memoryDreamsSchedule&&(a.memoryDreamsSchedule=n.memoryDreamsSchedule);try{await K(a),t(s("memory.settingsSaved","Memory settings saved"),"success")}catch{t(s("memory.saveSettingsFailed","Failed to save memory settings"),"error")}},[F,n,l,K,t]),Ee=r.useCallback(async()=>{try{const a=await Y();t(a.qmdAvailable?s("memory.qmdInstallSuccess","qmd installed successfully"):s("memory.qmdInstallUnavailable","qmd install finished, but qmd is still unavailable"),a.qmdAvailable?"success":"info")}catch{t(s("memory.installQmdFailed","Failed to install qmd"),"error")}},[Y,t]),ke=r.useCallback(async()=>{R(!0),M(null);try{const a=await G(U);M(a),t(a.qmdAvailable?s("memory.retrievalTestComplete","Memory retrieval test complete"):s("memory.retrievalTestFallback","qmd is not installed; local fallback was used"),a.qmdAvailable?"success":"info")}catch{t(s("memory.retrievalTestFailed","Failed to test memory retrieval"),"error")}finally{R(!1)}},[U,G,t]),Me=r.useCallback(async()=>{try{await le(),t(s("memory.dreamProcessingComplete","Dream processing completed"),"success"),await ie()}catch(a){t(a instanceof Error?a.message:s("memory.dreamProcessingFailed","Failed to run dream processing"),"error")}},[le,ie,t]),we=r.useCallback(async()=>{try{await V(A),t(s("memory.fileCompacted","Memory file compacted"),"success")}catch{t(s("memory.compactFailed","Failed to compact memory"),"error")}},[V,A,t]),pe=r.useCallback(async()=>{try{const a=await ee();t(a.summary,"success")}catch(a){t(a instanceof Error?a.message:s("memory.extractInsightsFailed","Failed to extract insights"),"error")}},[ee,t]),Ae=r.useCallback(async()=>{if(x!==null)try{await Q(x),S(!1),j(null),t(s("memory.insightsSaved","Insights saved"),"success")}catch{t(s("memory.saveInsightsFailed","Failed to save insights"),"error")}},[x,Q,t]),Fe=r.useCallback(()=>{j(N??""),S(!0)},[N]),De=r.useCallback(()=>{S(!1),j(null)},[]),ze=!B&&g!==null,ce=g?.capabilities?.writable??!1;return e.jsxs("div",{className:"memory-view",children:[e.jsx(Qe,{icon:We,title:s("memory.title","Memory")}),e.jsxs("div",{className:"memory-view-tabs",role:"tablist",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":d==="working",className:`memory-view-tab${d==="working"?" memory-view-tab--active":""}`,onClick:()=>v("working"),"data-testid":"memory-tab-working",children:s("memory.tabWorking","Working Memory")}),e.jsx("button",{type:"button",role:"tab","aria-selected":d==="insights",className:`memory-view-tab${d==="insights"?" memory-view-tab--active":""}`,onClick:()=>v("insights"),"data-testid":"memory-tab-insights",children:s("memory.tabInsights","Insights")}),e.jsx("button",{type:"button",role:"tab","aria-selected":d==="engines",className:`memory-view-tab${d==="engines"?" memory-view-tab--active":""}`,onClick:()=>v("engines"),"data-testid":"memory-tab-engines",children:s("memory.tabEngines","Engines")})]}),e.jsxs("div",{className:"memory-view-content",children:[d==="working"&&e.jsxs("div",{className:"memory-working-tab",children:[ze&&!ce&&e.jsx("div",{className:"memory-readonly-banner",children:s("memory.readOnlyBanner","This memory backend is read-only. Changes cannot be saved.")}),ue||H?e.jsxs("div",{className:"memory-empty-state",children:[e.jsx(D,{size:20,className:"animate-spin"}),e.jsx("span",{children:s("memory.loadingFile","Loading memory file…")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"memory-editor-section",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryViewFilePath",children:s("memory.fileLabel","Memory File")}),e.jsx("select",{id:"memoryViewFilePath",className:"select",value:A,onChange:a=>{p(a.target.value)},disabled:C,children:X.map(a=>e.jsx("option",{value:a.path,title:`${a.label} — ${a.path}`,children:es(a)},a.path))}),e.jsx("small",{children:C?s("memory.fileSwitchDirtyHint","Save or discard the current edits before switching files."):s("memory.fileSwitchHint","Choose any project memory file to view or edit.")})]}),f&&e.jsxs("div",{className:"memory-file-summary",children:[e.jsx("span",{children:f.layer==="long-term"?s("memory.layerLongTerm","Long-term"):f.layer==="daily"?s("memory.layerDaily","Daily"):s("memory.layerDreams","Dreams")}),e.jsx("strong",{children:f.path}),e.jsx("small",{children:s("memory.fileSummary","{{size}} bytes · updated {{updatedAt}}",{size:f.size.toLocaleString(),updatedAt:new Date(f.updatedAt).toLocaleString()})})]}),e.jsxs("div",{className:"form-group memory-editor-form-group",children:[e.jsx("label",{children:f?.label||s("memory.editorLabel","Memory Editor")}),e.jsx("small",{children:ge}),e.jsx("div",{className:"memory-editor-container",children:e.jsx(Ne,{content:Z,onChange:ae,readOnly:!ce,filePath:A,forceToolbarActionsVisible:!0,onSendSelectionToTask:h})})]})]}),e.jsxs("div",{className:"memory-action-bar",children:[e.jsx("span",{className:"memory-char-count",children:s("memory.charCount","{{count}} characters",{count:Z.length})}),e.jsx("div",{className:"memory-flex-spacer"}),ce&&Z.length>0&&e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:we,disabled:se||C,children:se?e.jsxs(e.Fragment,{children:[e.jsx(D,{size:14,className:"animate-spin"}),s("memory.compacting","Compacting…")]}):s("memory.compactSelectedFile","Compact Selected File")}),C&&ce&&e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:oe,disabled:ne,children:ne?e.jsxs(e.Fragment,{children:[e.jsx(D,{size:14,className:"animate-spin"}),s("memory.saving","Saving…")]}):s("memory.save","Save")})]}),e.jsxs("div",{className:"memory-config-section",children:[e.jsxs("div",{className:"memory-settings-group",children:[e.jsxs("div",{className:"form-group memory-toggle-row",children:[e.jsxs("label",{htmlFor:"memoryDreamsEnabled",className:"checkbox-label",title:s("memory.dreamsEnabledTooltip","Daily notes are distilled into DREAMS.md and reusable lessons are promoted into MEMORY.md."),children:[e.jsx("input",{id:"memoryDreamsEnabled",type:"checkbox",checked:n.memoryDreamsEnabled,onChange:a=>{k(b=>({...b,memoryDreamsEnabled:a.target.checked}))},disabled:!n.memoryEnabled||u}),s("memory.dreamsEnabledLabel","Process dreams from daily memory")]}),e.jsx("small",{children:s("memory.dreamsEnabledHint","Turns daily notes into DREAMS.md and promotes reusable lessons into MEMORY.md.")})]}),n.memoryEnabled&&n.memoryDreamsEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryDreamsSchedule",children:s("memory.dreamsScheduleLabel","Dream Schedule")}),e.jsx("input",{id:"memoryDreamsSchedule",type:"text",className:"input",value:n.memoryDreamsSchedule,onChange:a=>{k(b=>({...b,memoryDreamsSchedule:a.target.value}))},placeholder:"0 4 * * *",disabled:u}),e.jsx("small",{children:s("memory.dreamsScheduleHint","Cron expression for dream processing.")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:Me,disabled:_||!n.memoryDreamsEnabled,children:_?e.jsxs(e.Fragment,{children:[e.jsx(D,{size:14,className:"animate-spin"}),s("memory.dreaming","Dreaming…")]}):s("memory.dreamNow","Dream Now")}),e.jsx("small",{children:s("memory.dreamNowHint","Manually trigger dream processing now.")})]})]})]}),e.jsxs("div",{className:"memory-settings-group",children:[e.jsxs("div",{className:"form-group memory-toggle-row",children:[e.jsxs("label",{htmlFor:"memoryAutoSummarizeEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"memoryAutoSummarizeEnabled",type:"checkbox",checked:n.memoryAutoSummarizeEnabled,onChange:a=>{k(b=>({...b,memoryAutoSummarizeEnabled:a.target.checked}))},disabled:!n.memoryEnabled||u}),s("memory.autoSummarizeLabel","Auto-summarize memory")]}),e.jsx("small",{children:s("memory.autoSummarizeHint","Automatically compacts memory when it exceeds the threshold on a schedule.")})]}),n.memoryEnabled&&n.memoryAutoSummarizeEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryAutoSummarizeThresholdChars",children:s("memory.compactionThresholdLabel","Compaction Threshold (chars)")}),e.jsx("input",{id:"memoryAutoSummarizeThresholdChars",type:"number",className:"input",value:n.memoryAutoSummarizeThresholdChars,onChange:a=>{k(b=>({...b,memoryAutoSummarizeThresholdChars:parseInt(a.target.value,10)||5e4}))},min:1e3,disabled:u}),e.jsx("small",{children:s("memory.compactionThresholdHint","Memory will be compacted when it exceeds this character count")})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryAutoSummarizeSchedule",children:s("memory.autoSummarizeScheduleLabel","Schedule (cron)")}),e.jsx("input",{id:"memoryAutoSummarizeSchedule",type:"text",className:"input",value:n.memoryAutoSummarizeSchedule,onChange:a=>{k(b=>({...b,memoryAutoSummarizeSchedule:a.target.value}))},placeholder:"0 3 * * *",disabled:u}),e.jsx("small",{children:s("memory.autoSummarizeScheduleHint","Cron expression for auto-summarize schedule (default: daily at 3 AM)")})]})]})]}),!n.memoryEnabled&&e.jsx("div",{className:"settings-empty-state memory-status-message",children:s("memory.disabledMessage","Memory is currently disabled. Enable memory tools in Settings to edit these automations.")}),F&&e.jsx("div",{className:"memory-action-bar",children:e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:xe,disabled:W||u,children:W?e.jsxs(e.Fragment,{children:[e.jsx(D,{size:14,className:"animate-spin"}),s("memory.saving","Saving…")]}):s("memory.saveSettings","Save Settings")})})]})]})]}),d==="insights"&&e.jsx("div",{className:"memory-insights-tab",children:w?e.jsxs("div",{className:"memory-empty-state",children:[e.jsx(D,{size:20,className:"animate-spin"}),e.jsx("span",{children:s("memory.loadingInsights","Loading insights…")})]}):I?e.jsxs("div",{className:"memory-insights-editor-layout",children:[e.jsx("div",{className:"memory-editor-container",children:e.jsx(Ne,{content:x??"",onChange:j,readOnly:!1,filePath:".fusion/memory/memory-insights.md",forceToolbarActionsVisible:!0,onSendSelectionToTask:h})}),e.jsxs("div",{className:"memory-action-bar",children:[e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:De,children:s("memory.cancel","Cancel")}),e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:Ae,children:s("memory.saveInsights","Save Insights")})]})]}):!ye||T.length===0?e.jsxs("div",{className:"memory-empty-state",children:[e.jsx("p",{children:s("memory.noInsights","No insights extracted yet.")}),e.jsx("p",{children:s("memory.noInsightsHint",'Insights are automatically extracted from working memory. Click "Extract Now" to trigger extraction manually.')}),e.jsx("button",{type:"button",className:"btn btn-primary btn-sm memory-empty-extract-button",onClick:pe,disabled:q,children:q?e.jsxs(e.Fragment,{children:[e.jsx(D,{size:14,className:"animate-spin"}),s("memory.extracting","Extracting…")]}):s("memory.extractNow","Extract Now")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"memory-stats-row",children:[e.jsxs("div",{className:"memory-stat-card",children:[e.jsx("div",{className:"memory-stat-value",children:be}),e.jsx("div",{className:"memory-stat-label",children:s("memory.totalInsights","Total Insights")})]}),e.jsxs("div",{className:"memory-stat-card",children:[e.jsx("div",{className:"memory-stat-value",children:T.length}),e.jsx("div",{className:"memory-stat-label",children:s("memory.categories","Categories")})]}),m&&e.jsxs("div",{className:"memory-stat-card",children:[e.jsx("div",{className:"memory-stat-value memory-stat-value--updated",children:m}),e.jsx("div",{className:"memory-stat-label",children:s("memory.lastUpdated","Last Updated")})]})]}),e.jsxs("div",{className:"memory-action-bar",children:[e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:pe,disabled:q,children:q?e.jsxs(e.Fragment,{children:[e.jsx(D,{size:14,className:"animate-spin"}),s("memory.extracting","Extracting…")]}):s("memory.extractNow","Extract Now")}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:Fe,children:s("memory.editRaw","Edit Raw")})]}),e.jsx("div",{className:"memory-categories-list",children:T.map(a=>{const b=!L.has(a.key);return e.jsxs("div",{className:"memory-category-section",children:[e.jsxs("div",{className:"memory-category-header",onClick:()=>o(a.key),role:"button",tabIndex:0,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),o(a.key))},children:[e.jsx("h4",{children:a.name}),e.jsx("span",{className:"memory-category-count",children:a.items.length})]}),b&&e.jsx("div",{className:"memory-category-items",children:a.items.map((E,Ie)=>e.jsx("div",{className:"memory-insight-item",children:E.replace(/^-\s+/,"").replace(/^\*\s+/,"")},Ie))})]},a.key)})})]})}),d==="engines"&&e.jsx("div",{className:"memory-engines-tab",children:B||P?e.jsxs("div",{className:"memory-empty-state",children:[e.jsx(D,{size:20,className:"animate-spin"}),e.jsx("span",{children:s("memory.loadingEngineStatus","Loading engine status…")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"memory-engine-card memory-qmd-card",children:[e.jsx("h3",{children:s("memory.qmdIntegrationTitle","QMD Integration")}),g?.qmdAvailable===!0?e.jsxs("div",{className:"memory-engine-status",children:[e.jsx("span",{className:"memory-health-badge memory-health-badge--healthy",children:s("memory.qmdInstalled","Installed")}),e.jsx("span",{className:"memory-char-count",children:s("memory.qmdAvailableOnPath","qmd is available on PATH.")})]}):g?.qmdAvailable===!1?e.jsxs("div",{className:"settings-empty-state memory-status-message",children:[e.jsxs("span",{children:[s("memory.qmdNotInstalled","qmd is not installed. Search will use local files. Install indexed retrieval:")," ",e.jsx("code",{children:g.qmdInstallCommand||"bun install -g @tobilu/qmd"})]}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:Ee,disabled:te,children:te?s("memory.installing","Installing…"):s("memory.installQmd","Install qmd")})]}):e.jsxs("div",{className:"memory-engine-status",children:[e.jsx("span",{className:"memory-health-badge",children:s("memory.qmdChecking","Checking")}),e.jsx("span",{className:"memory-char-count",children:s("memory.qmdCheckingAvailability","Checking qmd availability…")})]})]}),e.jsxs("div",{className:"memory-engine-card memory-retrieval-card",children:[e.jsx("h3",{children:s("memory.testMemorySearchTitle","Test Memory Search")}),e.jsxs("div",{className:"memory-retrieval-input-row",children:[e.jsx("input",{type:"text",className:"input",value:U,onChange:a=>$(a.target.value),placeholder:s("memory.searchPlaceholder","Search memory with qmd")}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:ke,disabled:J,children:J?s("memory.testing","Testing…"):s("memory.testRetrieval","Test Retrieval")})]}),e.jsx("small",{className:"settings-muted",children:s("memory.testSearchHint","Runs the same qmd-backed memory_search path agents use.")}),y&&e.jsxs("div",{className:"memory-test-result",children:[e.jsx("strong",{children:s("memory.testResultCount",'{{count}} result for "{{query}}"',{count:y.results.length,query:y.query,defaultValue_one:'{{count}} result for "{{query}}"',defaultValue_other:'{{count}} results for "{{query}}"'})}),e.jsx("small",{children:s("memory.testResultStatus","qmd {{qmdStatus}} · {{fallbackStatus}}",{qmdStatus:y.qmdAvailable?s("memory.qmdStatusAvailable","available"):s("memory.qmdStatusMissing","missing"),fallbackStatus:y.usedFallback?s("memory.localFallbackUsed","local fallback used"):s("memory.qmdPathUsed","qmd path used")})}),y.results.length>0?e.jsx("ul",{children:y.results.map((a,b)=>e.jsxs("li",{children:[e.jsxs("span",{children:[a.path,":",a.lineStart]}),e.jsx("p",{children:a.snippet})]},`${a.path}-${a.lineStart}-${b}`))}):e.jsx("small",{children:s("memory.noMatchingMemory","No matching memory found.")})]})]}),e.jsxs("div",{className:"memory-engine-card",children:[e.jsx("h3",{children:s("memory.currentBackendTitle","Current Backend")}),e.jsx("div",{className:"memory-engine-status",children:e.jsx("span",{className:"memory-emphasis-text",children:g?.currentBackend==="file"?s("memory.backendFile","File (.fusion/memory/, agent/<agent-name>/memory/)"):g?.currentBackend==="readonly"?s("memory.backendReadonly","Read-Only"):g?.currentBackend==="qmd"?s("memory.backendQmd","QMD (Quantized Memory Distillation)"):g?.currentBackend??"unknown"})}),e.jsxs("div",{className:"memory-capability-row",children:[g?.capabilities?.readable&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capReadable","Readable")}),g?.capabilities?.writable&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capWritable","Writable")}),g?.capabilities?.supportsAtomicWrite&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capAtomicWrites","Atomic Writes")}),g?.capabilities?.persistent&&e.jsx("span",{className:"memory-capability-badge",children:s("memory.capPersistent","Persistent")})]})]}),c&&e.jsxs("div",{className:"memory-engine-card",children:[e.jsxs("div",{className:"memory-health-header",children:[e.jsx("h3",{children:s("memory.healthStatusTitle","Health Status")}),e.jsx("span",{className:`memory-health-badge memory-health-badge--${c.health}`,children:c.health==="healthy"?s("memory.healthHealthy","Healthy"):c.health==="warning"?s("memory.healthWarning","Warning"):s("memory.healthIssues","Issues Found")})]}),e.jsxs("div",{className:"memory-health-grid",children:[e.jsxs("div",{children:[e.jsx("div",{className:"memory-health-label",children:s("memory.workingMemoryLabel","Working Memory")}),e.jsx("div",{className:"memory-emphasis-text",children:s("memory.sizeChars","{{size}} chars",{size:c.workingMemory.size})}),e.jsx("div",{className:"memory-health-detail",children:s("memory.sectionCount","{{count}} sections",{count:c.workingMemory.sectionCount})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"memory-health-label",children:s("memory.insightsMemoryLabel","Insights Memory")}),e.jsx("div",{className:"memory-emphasis-text",children:s("memory.sizeChars","{{size}} chars",{size:c.insightsMemory.size})}),e.jsx("div",{className:"memory-health-detail",children:s("memory.insightCount","{{count}} insights",{count:c.insightsMemory.insightCount})})]})]}),e.jsxs("div",{className:"memory-health-section",children:[e.jsx("div",{className:"memory-health-label",children:s("memory.lastExtractionLabel","Last Extraction")}),e.jsx("div",{className:"memory-emphasis-text",children:c.extraction.success?e.jsx("span",{className:"memory-status-text memory-status-text--success",children:s("memory.extractionSuccess","Success")}):e.jsx("span",{className:"memory-status-text memory-status-text--error",children:s("memory.extractionFailed","Failed")})}),e.jsx("div",{className:"memory-health-detail",children:c.extraction.summary||s("memory.insightsExtracted","{{count}} insights extracted",{count:c.extraction.insightCount})})]}),e.jsxs("div",{className:"memory-health-section",children:[e.jsx("div",{className:"memory-health-label",children:s("memory.pruningLabel","Pruning")}),e.jsx("div",{className:"memory-emphasis-text",children:c.pruning.applied?e.jsx("span",{className:"memory-status-text memory-status-text--warning",children:s("memory.pruningApplied","Applied")}):e.jsx("span",{className:"memory-status-text memory-status-text--muted",children:s("memory.pruningNotNeeded","Not needed")})}),c.pruning.applied&&e.jsx("div",{className:"memory-health-detail",children:c.pruning.reason})]})]}),c&&c.checks.length>0&&e.jsxs("div",{className:"memory-engine-card",children:[e.jsx("h3",{children:s("memory.auditChecksTitle","Audit Checks")}),e.jsx("div",{children:c.checks.map(a=>e.jsxs("div",{className:"memory-audit-check",children:[e.jsx("span",{className:a.passed?"memory-audit-check-passed":"memory-audit-check-failed",children:a.passed?"✓":"✗"}),e.jsxs("div",{className:"memory-audit-check-content",children:[e.jsx("div",{className:"memory-emphasis-text",children:a.name}),e.jsx("div",{className:"memory-health-detail",children:a.details})]})]},a.id))})]}),e.jsx("div",{className:"memory-action-bar",children:e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:()=>he(),children:s("memory.runAudit","Run Audit")})}),e.jsxs("div",{className:"memory-settings-note",children:[e.jsx("span",{children:s("memory.settingsNote","Note: Change backend type in")}),e.jsx("button",{type:"button",className:"memory-settings-note-button",onClick:()=>{t(s("memory.settingsNoteToast","Open Settings → Memory to change backend type"),"info")},children:s("memory.settingsNoteLink","Settings → Memory")})]})]})})]})]})}export{ds as MemoryView};
|
package/dist/client/assets/{PiExtensionsManager-DvwmvGEY.js → PiExtensionsManager-DzT94cPg.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{c as V,b3 as Y,b4 as Z,b5 as T,R as L,aI as D,aL as P,P as ee,C as se,g as ae,x as ie,aG as B,b6 as ne,b7 as te,b8 as G,X as re}from"./index-
|
|
1
|
+
import{r as l,j as e}from"./vendor-react-SZ_qB27O.js";import{c as V,b3 as Y,b4 as Z,b5 as T,R as L,aI as D,aL as P,P as ee,C as se,g as ae,x as ie,aG as B,b6 as ne,b7 as te,b8 as G,X as re}from"./index-D8TQBkB7.js";import{u as le}from"./vendor-i18n-GF3RlKbq.js";import{P as I}from"./puzzle-CY7o6u4N.js";import{B as $}from"./AgentPermissionPolicyEditor-0iybC0Dg.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|