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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/agent-browser.mjs +8 -0
  2. package/dist/bin.js +6700 -11124
  3. package/dist/child-process-worker.js +3661 -8222
  4. package/dist/client/.vite/manifest.json +260 -250
  5. package/dist/client/assets/{AgentDetailView-CUoHZPZr.js → AgentDetailView-lJqxsPOR.js} +3 -3
  6. package/dist/client/assets/{AgentPermissionPolicyEditor-DKoHJIlF.js → AgentPermissionPolicyEditor-De4wK_UT.js} +1 -1
  7. package/dist/client/assets/{AgentsView-CaBo-FHV.js → AgentsView-CwizRdcA.js} +4 -4
  8. package/dist/client/assets/ChatView-BeQXaz7_.js +8 -0
  9. package/dist/client/assets/{CommandCenter-wgiEIVuC.js → CommandCenter-BJZCaPLj.js} +9 -9
  10. package/dist/client/assets/DevServerView-DQgwQXKx.js +1 -0
  11. package/dist/client/assets/{DirectoryPicker-B7YwgF53.js → DirectoryPicker-B2UVwp6F.js} +1 -1
  12. package/dist/client/assets/DocumentsView-DOeYrhvg.js +1 -0
  13. package/dist/client/assets/{EvalsView-BjyqxMS_.js → EvalsView-LwepJ9Ud.js} +1 -1
  14. package/dist/client/assets/{ExperimentalAgentOnboardingModal-_PMSa_gN.js → ExperimentalAgentOnboardingModal-DVNSzflw.js} +1 -1
  15. package/dist/client/assets/{GoalsView-BzLA8GX9.js → GoalsView-__LpXw4S.js} +1 -1
  16. package/dist/client/assets/{InsightsView-Cb_tUr1V.js → InsightsView-Dv388uaO.js} +2 -2
  17. package/dist/client/assets/{MemoryView-CRxOPCQq.js → MemoryView-ChCbEfZT.js} +2 -2
  18. package/dist/client/assets/{PiExtensionsManager-XQ5rWJT3.js → PiExtensionsManager-DehAjrqN.js} +2 -2
  19. package/dist/client/assets/{PluginManager-CXPSlWxs.js → PluginManager-DBhJ1i27.js} +1 -1
  20. package/dist/client/assets/{PullRequestView-CX6fScVe.js → PullRequestView-BvmajsBq.js} +2 -2
  21. package/dist/client/assets/{ReportModal-BSCk5ER1.css → ReportModal-BuhhqtXJ.css} +1 -1
  22. package/dist/client/assets/ReportModal-DM9B_h_w.js +21 -0
  23. package/dist/client/assets/{ResearchView-DgKzxRUL.js → ResearchView-BzXSgUhp.js} +2 -2
  24. package/dist/client/assets/{SecretsView-C83SIrjR.js → SecretsView-COBqEdJj.js} +1 -1
  25. package/dist/client/assets/SessionTerminal-BUw_FTlh.js +2 -0
  26. package/dist/client/assets/SettingsModal-BDgH9XID.js +21 -0
  27. package/dist/client/assets/SettingsModal-BXDnzDkJ.css +1 -0
  28. package/dist/client/assets/SettingsModal-CsLaIrqt.js +1 -0
  29. package/dist/client/assets/{SettingsTextareaRow-BKGsmZ7C.js → SettingsTextareaRow-Bv3aZ9aU.js} +1 -1
  30. package/dist/client/assets/{SetupWizardModal-DIb4q-VT.js → SetupWizardModal-C-yMHTlW.js} +2 -2
  31. package/dist/client/assets/{SkillsView-D1Zxh1iX.js → SkillsView-kSHgkBar.js} +1 -1
  32. package/dist/client/assets/{TodoView-CGIcE6Yr.js → TodoView-DYoicJNY.js} +2 -2
  33. package/dist/client/assets/{WorkflowNodeEditor-BXUC0lim.js → WorkflowNodeEditor-DLno6bSJ.js} +1 -1
  34. package/dist/client/assets/agent-import-generation-D6P8OUuV.js +1 -0
  35. package/dist/client/assets/app-DegRNirF.js +13 -0
  36. package/dist/client/assets/{architectureDiagram-3BPJPVTR-Dv83GkUE.js → architectureDiagram-3BPJPVTR-DLqKCckA.js} +1 -1
  37. package/dist/client/assets/{blockDiagram-GPEHLZMM-B_j-RJOz.js → blockDiagram-GPEHLZMM-DRz6F8wZ.js} +1 -1
  38. package/dist/client/assets/{c4Diagram-AAUBKEIU-Cy3f-SD1.js → c4Diagram-AAUBKEIU-CJ9glQAp.js} +1 -1
  39. package/dist/client/assets/channel-Dj4nOgJO.js +1 -0
  40. package/dist/client/assets/{chunk-2J33WTMH-CPolddUJ.js → chunk-2J33WTMH-CjIBb3ln.js} +1 -1
  41. package/dist/client/assets/{chunk-4BX2VUAB-BAGPgwkc.js → chunk-4BX2VUAB-DrcoEr1E.js} +1 -1
  42. package/dist/client/assets/{chunk-55IACEB6-dzYFOH0q.js → chunk-55IACEB6-DU-WcuA9.js} +1 -1
  43. package/dist/client/assets/{chunk-727SXJPM-ul9hGhiR.js → chunk-727SXJPM-C5Lklr3l.js} +1 -1
  44. package/dist/client/assets/{chunk-AQP2D5EJ-C75yqe4-.js → chunk-AQP2D5EJ-DlyTTghY.js} +1 -1
  45. package/dist/client/assets/{chunk-FMBD7UC4-BwiLAyup.js → chunk-FMBD7UC4-D3C65m5Y.js} +1 -1
  46. package/dist/client/assets/{chunk-ND2GUHAM-CVv1sLhy.js → chunk-ND2GUHAM-BZY-4WZF.js} +1 -1
  47. package/dist/client/assets/{chunk-QZHKN3VN-D1c-k3xL.js → chunk-QZHKN3VN-CKUtTYy5.js} +1 -1
  48. package/dist/client/assets/classDiagram-4FO5ZUOK-DnkFo5Qy.js +1 -0
  49. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DnkFo5Qy.js +1 -0
  50. package/dist/client/assets/{cose-bilkent-S5V4N54A-DosMsFd6.js → cose-bilkent-S5V4N54A-DbpsF4N5.js} +1 -1
  51. package/dist/client/assets/{dagre-BM42HDAG-9os-QBXe.js → dagre-BM42HDAG-BwIo4me1.js} +1 -1
  52. package/dist/client/assets/{dashboard-view-iwAS1HTp.js → dashboard-view-BMQm7Lt_.js} +1 -1
  53. package/dist/client/assets/{dashboard-view-Bn7iL770.js → dashboard-view-BvAsW6UZ.js} +1 -1
  54. package/dist/client/assets/{dashboard-view-CNVTxyWE.js → dashboard-view-C94UCci5.js} +1 -1
  55. package/dist/client/assets/{diagram-2AECGRRQ-ChjuJgA6.js → diagram-2AECGRRQ-C-d8XY1c.js} +1 -1
  56. package/dist/client/assets/{diagram-5GNKFQAL-Cq10aB4z.js → diagram-5GNKFQAL-ByRrlL9w.js} +1 -1
  57. package/dist/client/assets/{diagram-KO2AKTUF-CKjyrzjg.js → diagram-KO2AKTUF-BK7jb_J-.js} +1 -1
  58. package/dist/client/assets/{diagram-LMA3HP47-DxCc1BsH.js → diagram-LMA3HP47-u2o4bYk6.js} +1 -1
  59. package/dist/client/assets/{diagram-OG6HWLK6-DJWEkDsR.js → diagram-OG6HWLK6-Dakk1V3D.js} +1 -1
  60. package/dist/client/assets/{erDiagram-TEJ5UH35-gVkDYC92.js → erDiagram-TEJ5UH35-Yp33v-Cf.js} +1 -1
  61. package/dist/client/assets/{flowDiagram-I6XJVG4X-1lw1mQRQ.js → flowDiagram-I6XJVG4X-C4-dR2TA.js} +1 -1
  62. package/dist/client/assets/{folder-open-Nmr7nRmN.js → folder-open-C9qq38qV.js} +1 -1
  63. package/dist/client/assets/{ganttDiagram-6RSMTGT7-Yzq4WZRo.js → ganttDiagram-6RSMTGT7-C0CTCkFN.js} +1 -1
  64. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-cFR9Gv8n.js → gitGraphDiagram-PVQCEYII-DK0Dd5mm.js} +1 -1
  65. package/dist/client/assets/index-6FBJPKkr.css +1 -0
  66. package/dist/client/assets/index-BqLVwYoA.js +2661 -0
  67. package/dist/client/assets/{infoDiagram-5YYISTIA-BbRiTnD3.js → infoDiagram-5YYISTIA-u5MwFb7j.js} +1 -1
  68. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-DD4i2Znk.js → ishikawaDiagram-YF4QCWOH-C7R6TziI.js} +1 -1
  69. package/dist/client/assets/{journeyDiagram-JHISSGLW-qHPO2M-C.js → journeyDiagram-JHISSGLW-Dom8W5Ab.js} +1 -1
  70. package/dist/client/assets/{kanban-definition-UN3LZRKU-EuFfgxUv.js → kanban-definition-UN3LZRKU-_47C02t3.js} +1 -1
  71. package/dist/client/assets/{mermaid.core-Cru9Vzsy.js → mermaid.core-Cd3LKosp.js} +4 -4
  72. package/dist/client/assets/{mindmap-definition-RKZ34NQL-mCvtfapj.js → mindmap-definition-RKZ34NQL-D-qVOEin.js} +1 -1
  73. package/dist/client/assets/{pieDiagram-4H26LBE5-BSc_a5Dz.js → pieDiagram-4H26LBE5-B0TXvVbM.js} +1 -1
  74. package/dist/client/assets/{puzzle-Cz66CEWW.js → puzzle-BBYTjDQK.js} +1 -1
  75. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-Um2SLb_d.js → quadrantDiagram-W4KKPZXB-KcFvcZPm.js} +1 -1
  76. package/dist/client/assets/{requirementDiagram-4Y6WPE33-B94evN7g.js → requirementDiagram-4Y6WPE33-DEObokVc.js} +1 -1
  77. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BH7NLX-K.js → sankeyDiagram-5OEKKPKP-BGYnEp22.js} +1 -1
  78. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-DusrBGQp.js → sequenceDiagram-3UESZ5HK-BcYgyJRU.js} +1 -1
  79. package/dist/client/assets/{shield-alert-CcQuaRHN.js → shield-alert-CZg8yaFA.js} +1 -1
  80. package/dist/client/assets/{standing-instructions-template-CVnY93Xy.js → standing-instructions-template-BsTtbEqp.js} +1 -1
  81. package/dist/client/assets/{stateDiagram-AJRCARHV-GRjL9YlX.js → stateDiagram-AJRCARHV-CfZQIqmX.js} +1 -1
  82. package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-BBsv6ppQ.js → stateDiagram-v2-BHNVJYJU-nBEPRSH7.js} +1 -1
  83. package/dist/client/assets/{timeline-definition-PNZ67QCA-DC6UeqjY.js → timeline-definition-PNZ67QCA-DySyabS_.js} +1 -1
  84. package/dist/client/assets/{upload-CjJp7lEX.js → upload-DMd3zMLx.js} +1 -1
  85. package/dist/client/assets/{users-DgimRYHz.js → users-9Pyvnn8K.js} +1 -1
  86. package/dist/client/assets/{vennDiagram-CIIHVFJN-C272zK9h.js → vennDiagram-CIIHVFJN-DPomfxp_.js} +1 -1
  87. package/dist/client/assets/{wardley-L42UT6IY-KkRF-2j9.js → wardley-L42UT6IY-BPfzngS8.js} +1 -1
  88. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-B4brtKRt.js → wardleyDiagram-YWT4CUSO-Yp4nidAP.js} +1 -1
  89. package/dist/client/assets/{xychartDiagram-2RQKCTM6--PFSKt1s.js → xychartDiagram-2RQKCTM6-REgng603.js} +1 -1
  90. package/dist/client/index.html +2 -2
  91. package/dist/client/version.json +1 -1
  92. package/dist/extension.js +3765 -8333
  93. package/dist/migrations/0026_bigint_counters.sql +85 -14
  94. package/package.json +6 -3
  95. package/skill/fusion/references/engine-tools.md +6 -2
  96. package/dist/client/assets/ChatView-Bv0J5p5U.js +0 -8
  97. package/dist/client/assets/DevServerView-Ue9XG_4H.js +0 -1
  98. package/dist/client/assets/DocumentsView-C1Ptwcv5.js +0 -1
  99. package/dist/client/assets/ReportModal-JhZZXZlj.js +0 -21
  100. package/dist/client/assets/SessionTerminal-BrK3psiC.js +0 -2
  101. package/dist/client/assets/SettingsModal-Bby9vLGx.js +0 -21
  102. package/dist/client/assets/SettingsModal-DVLqY1-7.js +0 -1
  103. package/dist/client/assets/SettingsModal-DXArgTTx.css +0 -1
  104. package/dist/client/assets/app-DUszvars.js +0 -13
  105. package/dist/client/assets/channel-BuhC8kaT.js +0 -1
  106. package/dist/client/assets/classDiagram-4FO5ZUOK-vpRR5WOg.js +0 -1
  107. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-vpRR5WOg.js +0 -1
  108. package/dist/client/assets/index-Cg9ahVtV.js +0 -2661
  109. package/dist/client/assets/index-uhXHk1ek.css +0 -1
@@ -1 +0,0 @@
1
- import{r as s,j as e}from"./vendor-react-SZ_qB27O.js";import{an as Oe,ao as He,ap as Pt,aq as Et,ar as Dt,as as Ve,at as Lt,au as Mt,av as le,aw as Rt,ax as Ie,ay as zt,az as $t,aA as Ot,aB as ye,aC as Ht,aD as Be,V as It,aE as te,E as Bt,o as qt,aF as Ut,X as _t,R as Vt,aG as de,A as qe,u as Ue,aH as _e,h as Te,r as Fe,aI as Qt,aJ as Qe,aK as Wt,aL as Gt,aM as Kt,aN as Xt,x as Yt,aO as Jt,aP as Zt}from"./index-Cg9ahVtV.js";import{u as es}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";function ts(n){const{projectId:r,searchQuery:v,includeProjectFiles:T=!0}=n??{},x=r?`${Pt.DOCUMENTS_PREFIX}${r}`:null,[t,i]=s.useState(()=>{if(!x)return[];const N=Oe(x,{maxAgeMs:He});return Array.isArray(N)?N:[]}),[F,l]=s.useState([]),[k,w]=s.useState(()=>t.length===0),[d,C]=s.useState(null),m=s.useRef(null),f=s.useRef(t.length>0),p=s.useRef(null),{capture:A}=Et(r,"useDocuments"),S=s.useCallback(async()=>{const N=A();m.current&&m.current.abort();const K=new AbortController;m.current=K;const z=!f.current;z&&w(!0),C(null);const X=Dt(v?{q:v}:void 0,r),B=T?Ve(r):Promise.resolve({files:[]}),[b,ae]=await Promise.allSettled([X,B]);if(K.signal.aborted||N.isStale())return;let $=null;if(b.status==="fulfilled"){if(i(b.value),x){const q=b.value.length>500?b.value.slice(0,500):b.value;Lt(x,q,{maxBytes:5e5})}f.current=!0}else $=b.reason instanceof Error?b.reason.message:String(b.reason);if(ae.status==="fulfilled"){const q=ae.value.files,V=v?.trim().toLowerCase(),ne=V?q.filter(Y=>Y.name.toLowerCase().includes(V)||Y.path.toLowerCase().includes(V)):q;l(ne)}C($),z&&w(!1)},[x,A,T,r,v]);return s.useEffect(()=>{if(l([]),!x){f.current=!1,i([]),w(!0);return}const N=Oe(x,{maxAgeMs:He});Array.isArray(N)?(i(N),f.current=!0,w(!1)):(f.current=!1,i([]),w(!0))},[x]),s.useEffect(()=>(p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{S()},300),()=>{p.current&&clearTimeout(p.current)}),[S]),s.useEffect(()=>(S(),()=>{m.current&&m.current.abort()}),[]),{documents:t,projectFiles:F,loading:k,error:d,refresh:S}}function ss(n,r){const[v,T]=s.useState([]),[x,t]=s.useState(!0),[i,F]=s.useState(null),l=s.useRef(null),k=s.useRef(!1),w=r?.showHidden??!1,d=s.useCallback(async C=>{l.current&&l.current.abort();const m=new AbortController;l.current=m;const f=!k.current;f&&t(!0),F(null);try{const p=await Ve(n,{showHidden:C?.showHidden??w});if(m.signal.aborted)return;T(p.files),k.current=!0}catch(p){if(m.signal.aborted)return;F(p instanceof Error?p.message:String(p))}finally{!m.signal.aborted&&f&&t(!1)}},[n,w]);return s.useEffect(()=>(k.current=!1,d({showHidden:w}),()=>{l.current&&l.current.abort()}),[d,w]),{files:v,loading:x,error:i,refresh:d}}const as=768,ns={image:Xt,doc:te,pdf:Kt,video:Gt,audio:Wt,other:Qe};function se(n){return n?new Date(n).toLocaleString():""}function cs(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(n>=10*1024?0:1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function os(n){return n==="done"?"status-dot status-dot--online":n==="archived"?"status-dot status-dot--offline":n==="todo"||n==="triage"?"status-dot status-dot--pending":"status-dot status-dot--connecting"}function We(n,r){switch(r){case"image":return n("documents.artifactCategoryImage","Image");case"doc":return n("documents.artifactCategoryDoc","Document");case"pdf":return n("documents.artifactCategoryPdf","PDF");case"video":return n("documents.artifactCategoryVideo","Video");case"audio":return n("documents.artifactCategoryAudioSingle","Audio");case"other":return n("documents.artifactCategoryOtherSingle","Other")}}function rs(n,r){return r?[n.title,n.description,n.taskId,n.taskTitle,n.mimeType,n.authorId].some(v=>v?.toLowerCase().includes(r)):!0}function is(n){const r=n.mimeType?.toLowerCase().split(";",1)[0]??"";return!!n.content||n.type==="document"||r.startsWith("text/")||r==="application/json"||r==="application/xml"}function ls({artifact:n,projectId:r,content:v,loading:T,error:x,renderMarkdown:t,onToggleMarkdown:i,onOpenTask:F,t:l}){const[k,w]=s.useState(null),d=ye(n),C=We(l,d),m=n.title||l("documents.untitledArtifact","Untitled artifact"),f=Yt(n.id,r),p=d==="doc"&&is(n);s.useEffect(()=>{w(null)},[n.id]);const A=k?e.jsx("p",{className:"documents-content-state documents-content-state--error",children:k}):null,S=d==="image"?e.jsxs(e.Fragment,{children:[A,e.jsx("img",{className:"documents-task-artifact-media",src:f,alt:m,onError:()=>w(l("documents.artifactMediaFailed","Failed to load artifact preview."))})]}):d==="video"?e.jsxs(e.Fragment,{children:[A,e.jsx("video",{className:"documents-task-artifact-media",controls:!0,src:f,"aria-label":l("documents.videoArtifactLabel","Video artifact: {{title}}",{title:m}),onError:()=>w(l("documents.artifactMediaFailed","Failed to load artifact preview."))})]}):d==="audio"?e.jsxs(e.Fragment,{children:[A,e.jsx("audio",{className:"documents-task-artifact-audio",controls:!0,src:f,"aria-label":l("documents.audioArtifactLabel","Audio artifact: {{title}}",{title:m}),onError:()=>w(l("documents.artifactMediaFailed","Failed to load artifact preview."))})]}):d==="pdf"?e.jsxs("div",{className:"documents-task-artifact-pdf",children:[e.jsx("iframe",{title:l("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(Jt,{size:14,"aria-hidden":"true"}),l("documents.openInNewTab","Open in new tab")]})]}):d==="doc"&&p?T?e.jsx("p",{className:"documents-content-state",children:e.jsx(de,{label:l("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(Te,{remarkPlugins:[Fe],children:v??n.content??""})})}):e.jsx("pre",{className:"document-card-content-text documents-content-viewer-text documents-task-artifact-doc-content",children:v??n.content??""}):e.jsxs("div",{className:"documents-task-artifact-download",children:[e.jsx(Qe,{size:24,"aria-hidden":"true"}),e.jsx("p",{children:n.description||l("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(Zt,{size:14,"aria-hidden":"true"}),l("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:[n.taskId," / ",m]}),d==="doc"&&p?e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:i,"aria-label":t?l("documents.switchToPlainText","Switch to plain text"):l("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":t,title:t?l("documents.switchToPlainText","Switch to plain text"):l("documents.switchToMarkdown","Switch to markdown"),children:t?l("documents.markdown","Markdown"):l("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:n.authorId||l("documents.unknownAuthor","unknown")}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{children:se(n.updatedAt)}),n.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 F(n.taskId),children:l("documents.openTask","Open task")})]}):null]}),n.description?e.jsx("p",{className:"documents-task-artifact-description",children:n.description}):null,e.jsx("div",{className:`documents-task-artifact-preview documents-task-artifact-preview--${d}`,children:S})]})}function ps({projectId:n,addToast:r,onOpenDetail:v,onOpenArtifactTaskDetail:T,onSendSelectionToTask:x}){const{t}=es("app"),[i,F]=s.useState("artifacts"),l=Mt(),[k,w]=s.useState(""),[d,C]=s.useState(null),[m,f]=s.useState(null),[p,A]=s.useState(!1),[S,N]=s.useState(null),[K,z]=s.useState(!1),[X,B]=s.useState(null),[b,ae]=s.useState(!1),$=s.useRef(0),q=s.useRef(null),V=s.useRef(null),ne=s.useRef(null),Y=s.useRef(null),[Q,Ae]=s.useState(!1),[Ge,Pe]=s.useState(new Map),[Ke,P]=s.useState(null),[ue,y]=s.useState(""),[me,he]=s.useState(!1),[Xe,E]=s.useState(null),[Ye,O]=s.useState(!1),[Je,D]=s.useState(null),[Ze,fe]=s.useState(!0),J=s.useRef(0),[ke,U]=s.useState(!1),[ce,H]=s.useState(""),[pe,je]=s.useState(!1),[oe,Ee]=s.useState(!1),et=le(q,{locked:oe}),tt=le(V,{locked:oe}),st=le(ne,{locked:oe}),at=le(Y,{locked:oe}),xe=Q?et:tt,we=i==="tasks"?k.trim():"",nt=i==="artifacts"?k.trim():"",{documents:Z,loading:ct,error:ot,refresh:re}=ts({projectId:n,searchQuery:we||void 0,includeProjectFiles:!1}),{files:_,loading:rt,error:it,refresh:De}=ss(n,{showHidden:p}),{artifacts:L,loading:lt,error:dt,refresh:be}=Rt({projectId:n,searchQuery:nt||void 0});s.useEffect(()=>{const a=()=>{ae(window.innerWidth<=as)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),s.useEffect(()=>{F("artifacts"),C(null),f(null),A(!1),N(null),B(null),z(!1),Ae(!1),Pe(new Map),P(null),y(""),he(!1),E(null),O(!1),D(null),fe(!0),U(!1),H(""),je(!1)},[n]);const W=s.useMemo(()=>{const a=we.toLowerCase(),c=new Map;for(const o of Z){const j=c.get(o.taskId)??{documents:[],artifacts:[]};j.documents.push(o),c.set(o.taskId,j)}for(const o of L){if(!o.taskId||!rs(o,a))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 R=[...j.documents].sort((g,ee)=>ee.updatedAt.localeCompare(g.updatedAt)),I=[...j.artifacts].sort((g,ee)=>ee.updatedAt.localeCompare(g.updatedAt)),Ce=[R[0]?.updatedAt,I[0]?.updatedAt].filter(Boolean).sort().at(-1)??"",h=R.find(g=>g.taskTitle)?.taskTitle??I.find(g=>g.taskTitle)?.taskTitle;return{taskId:o,taskTitle:h,taskColumn:R.find(g=>g.taskColumn)?.taskColumn??I.find(g=>g.taskColumn)?.taskColumn,documents:R,artifacts:I,latestUpdated:Ce}}).filter(o=>o.documents.length>0||o.artifacts.length>0).sort((o,j)=>j.latestUpdated.localeCompare(o.latestUpdated))},[L,Z,we]),u=s.useMemo(()=>m?.kind!=="document"?null:Z.find(a=>a.id===m.id)??null,[Z,m]),M=s.useMemo(()=>m?.kind!=="artifact"?null:L.find(a=>a.id===m.id)??null,[L,m]),ie=u??M;s.useEffect(()=>{if(!m)return;W.some(c=>m.kind==="document"?c.documents.some(o=>o.id===m.id):c.artifacts.some(o=>o.id===m.id))||(f(null),P(null),y(""),E(null),O(!1),D(null))},[W,m]);const ge=s.useMemo(()=>{const a=k.trim().toLowerCase();return a?_.filter(c=>{const o=c.path.toLowerCase(),j=c.name.toLowerCase();return o.includes(a)||j.includes(a)}):_},[_,k]);s.useEffect(()=>{if(!d)return;_.some(c=>c.path===d.path)||(C(null),N(null),B(null),z(!1))},[_,d]);const ut=s.useCallback(a=>{w(a.target.value)},[]),mt=s.useCallback(()=>{w("")},[]),ve=s.useCallback(a=>{F(a),a!=="tasks"&&(f(null),P(null),y(""),E(null),O(!1),D(null)),a!=="project"&&(U(!1),H(""))},[]),ht=s.useCallback(async a=>{try{const c=await Ie(a,n);v(c)}catch{r(`Failed to open task ${a}`,"error")}},[n,v,r]),Le=s.useCallback(async a=>{try{const c=await Ie(a,n);(T??v)(c)}catch{r(`Failed to open task ${a}`,"error")}},[n,T,v,r]),ft=s.useCallback(async a=>{C(a),z(!0),B(null),N(null),U(!1),H("");const c=$.current+1;$.current=c;try{const o=await zt("project",a.path,n);if($.current!==c)return;N(o.content)}catch(o){if($.current!==c)return;const j=o instanceof Error?o.message:`Failed to open ${a.path}`;B(j),r(j,"error")}finally{$.current===c&&z(!1)}},[n,r]),kt=s.useCallback(()=>{C(null),N(null),B(null),z(!1),U(!1),H("")},[]),pt=s.useCallback(()=>{S!==null&&(H(S),U(!0))},[S]),jt=s.useCallback(()=>{U(!1),H("")},[]),xt=s.useCallback(async()=>{if(d){je(!0);try{await $t("project",d.path,ce,n),N(ce),U(!1),H(""),r(t("documents.projectFileSaved","File saved"),"success")}catch(a){r(a instanceof Error?a.message:String(a),"error")}finally{je(!1)}}},[d,ce,n,r,t]),wt=s.useCallback(a=>{f({kind:"document",id:a}),P(null),y(""),E(null),O(!1),D(null)},[]),bt=s.useCallback(a=>{f({kind:"artifact",id:a}),P(null),y(""),E(null),D(null),fe(!0)},[]),gt=s.useCallback(()=>{f(null),P(null),y(""),E(null),O(!1),D(null)},[]),vt=s.useCallback(a=>{Pe(c=>{const o=new Map(c),j=o.get(a)??!0;return o.set(a,!j),o})},[]),Nt=s.useCallback(()=>{u&&(y(u.content),P(u.id))},[u]),St=s.useCallback(()=>{P(null),y("")},[]),Ct=s.useCallback(async()=>{if(u){he(!0);try{await Ot(u.taskId,u.key,ue,{},n),await re(),P(null),y(""),r(t("documents.taskDocumentSaved","Document saved"),"success")}catch(a){r(a instanceof Error?a.message:String(a),"error")}finally{he(!1)}}},[u,ue,n,re,r,t]);s.useEffect(()=>{if(!M||ye(M)!=="doc"){E(null),O(!1),D(null);return}const a=J.current+1;J.current=a,O(!0),D(null),E(null),Ht(M.id,n).then(c=>{J.current===a&&E(c.content??M.content??"")}).catch(c=>{J.current===a&&D(c instanceof Error?c.message:String(c))}).finally(()=>{J.current===a&&O(!1)})},[n,M]);const Me=i==="project"?it:i==="tasks"?ot:dt,yt=s.useCallback(async()=>{if(i==="project"){await De();return}if(i==="tasks"){await re();return}await be()},[i,be,De,re]),Re=i==="project"?ge.length:i==="tasks"?W.length:L.length,G=u?Ge.get(u.id)??!0:!1,Ne=G?st:at,Se=u!==null&&Ke===u.id,Tt=i==="project"&&d&&!ke&&x&&xe?e.jsx(Be,{selectedText:xe.selectedText,anchorRect:xe.anchorRect,filePath:d.path,onSubmit:x,onOpenChange:Ee}):null,Ft=i==="tasks"&&u&&!Se&&x&&Ne?e.jsx(Be,{selectedText:Ne.selectedText,anchorRect:Ne.anchorRect,filePath:`${u.taskId}/${u.key}`,onSubmit:x,onOpenChange:Ee}):null,ze=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(It,{icon:te,title:t("documents.title","Artifacts"),actions:e.jsx("span",{className:"documents-view-count",children:t("documents.resultCount","{{count}} result{{plural}}",{count:Re,plural:Re!==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:()=>ve("artifacts"),children:[t("documents.artifactsTab","Artifacts"),e.jsx("span",{className:"documents-tab-count",children:L.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:()=>ve("project"),children:[t("documents.projectFilesTab","Project Files"),e.jsx("span",{className:"documents-tab-count",children:_.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:()=>ve("tasks"),children:[t("documents.taskDocumentsTab","Task Documents"),e.jsx("span",{className:"documents-tab-count",children:W.length})]})]}),i==="project"&&e.jsxs("button",{className:"btn btn-sm documents-hidden-toggle",onClick:()=>A(a=>!a),"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(Bt,{size:14}):e.jsx(qt,{size:14}),p?t("documents.hideHiddenLabel","Hide Hidden"):t("documents.showHiddenLabel","Show Hidden")]}),e.jsxs("div",{className:"documents-search",children:[e.jsx(Ut,{size:16,className:"documents-search-icon"}),e.jsx("input",{type:"text",className:"documents-search-input",placeholder:ze,value:k,onChange:ut,"aria-label":ze}),k&&e.jsx("button",{className:"documents-search-clear",onClick:mt,"aria-label":t("documents.clearSearch","Clear search"),children:e.jsx(_t,{size:16})})]})]})]}),e.jsx("div",{className:"documents-view-content",children:Me?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:Me})}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>void yt(),"aria-label":t("documents.retryLoading","Retry loading documents"),children:[e.jsx(Vt,{size:16}),t("documents.retry","Retry")]})]}):i==="project"?rt&&_.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:e.jsx(de,{label:t("documents.loadingProjectFiles","Loading project markdown files…")})})}):ge.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(te,{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${b?" documents-project-layout--mobile":""}`,children:[(!b||!d)&&e.jsx("aside",{className:"documents-view-sidebar","aria-label":t("documents.projectMarkdownFilesLabel","Project markdown files"),children:e.jsx("ul",{className:"markdown-file-list",children:ge.map(a=>{const c=d?.path===a.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 ft(a),"aria-label":`Open ${a.path}`,"aria-current":c?"true":void 0,children:[e.jsx("span",{className:"markdown-file-item-name",children:a.name}),e.jsx("span",{className:"markdown-file-item-path",children:a.path}),e.jsxs("span",{className:"markdown-file-item-meta",children:[cs(a.size)," · ",se(a.mtime)]})]})},a.path)})})}),(!b||d)&&e.jsxs("section",{className:"documents-view-main","aria-label":t("documents.projectFilePreviewLabel","Project file content preview"),children:[b&&d&&e.jsxs("button",{className:"btn btn-sm documents-mobile-back",onClick:kt,"aria-label":t("documents.backToFilesList","Back to project files list"),children:[e.jsx(qe,{size:14}),t("documents.backToFiles","Back to files")]}),d?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:d.path}),e.jsx("div",{className:"documents-task-document-actions",children:ke?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm",onClick:jt,disabled:pe,children:t("documents.cancelEdit","Cancel")}),e.jsx("button",{className:"btn btn-sm btn-primary",onClick:()=>void xt(),disabled:pe,children:pe?t("documents.saving","Saving…"):t("documents.saveProjectFile","Save")})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:()=>Ae(a=>!a),"aria-label":Q?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":Q,title:Q?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),children:Q?t("documents.markdown","Markdown"):t("documents.plain","Plain")}),e.jsxs("button",{className:"btn btn-sm",onClick:pt,disabled:K||X!==null||S===null,"aria-label":t("documents.editProjectFile","Edit project file"),children:[e.jsx(Ue,{size:14,"aria-hidden":"true"}),t("documents.edit","Edit")]})]})})]}),K?e.jsx("p",{className:"documents-content-state",children:e.jsx(de,{label:t("documents.loadingFileContent","Loading file content…")})}):X?e.jsx("p",{className:"documents-content-state documents-content-state--error",children:X}):ke?e.jsx("div",{className:"documents-task-document-editor","aria-label":t("documents.projectFileContentEditor","Project file content editor"),children:e.jsx(_e,{content:ce,onChange:H,filePath:d.path,forceToolbarActionsVisible:!0})}):Q?e.jsx("div",{ref:q,className:"documents-content-markdown",children:e.jsx("div",{className:"markdown-body",children:e.jsx(Te,{remarkPlugins:[Fe],children:S??""})})}):e.jsx("pre",{ref:V,className:"document-card-content-text documents-content-viewer-text",children:S??""}),Tt]}):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"?lt&&L.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:t("documents.loadingArtifacts","Loading artifacts…")})}):L.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(te,{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(Qt,{artifacts:L,projectId:n,isMobile:b,addToast:r,onOpenTask:Le,onArtifactUpdated:()=>void be()}):ct&&Z.length===0?e.jsx("div",{className:"documents-view-loading",children:e.jsx("p",{children:e.jsx(de,{label:t("documents.loadingTaskDocuments","Loading task documents…")})})}):W.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(te,{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${b?" documents-project-layout--mobile":""}`,children:[(!b||!ie)&&e.jsx("aside",{className:"documents-view-sidebar documents-task-documents-sidebar","aria-label":t("documents.taskDocumentsListLabel","Task documents"),children:W.map(({taskId:a,taskTitle:c,taskColumn:o,documents:j,artifacts:R})=>{const I=o?l(o):null,Ce=o?os(o):"status-dot";return e.jsxs("section",{className:"documents-task-sidebar-group","aria-labelledby":`documents-task-group-${a}`,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-${a}`,className:"documents-task-sidebar-title",children:[e.jsx("span",{className:"documents-group-task-id",children:a}),e.jsx("span",{className:"documents-group-task-title",children:c||t("documents.untitled","Untitled")})]}),I?e.jsxs("span",{className:"documents-group-status badge","aria-label":t("documents.taskStatusAria","Task status: {{status}}",{status:I}),children:[e.jsx("span",{className:Ce,"aria-hidden":"true"}),e.jsx("span",{children:I})]}):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:R.length,artifactPlural:R.length!==1?"s":""})}),e.jsx("button",{className:"documents-group-task-link",onClick:()=>void ht(a),"aria-label":t("documents.openTaskAria","Open task {{taskId}}: {{title}}",{taskId:a,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 g=u?.id===h.id;return e.jsx("li",{className:"markdown-file-list-item",children:e.jsxs("button",{className:`markdown-file-item documents-task-document-item${g?" markdown-file-item--selected":""}`,onClick:()=>wt(h.id),"aria-label":t("documents.openTaskDocument","Open {{taskId}} {{key}}",{taskId:h.taskId,key:h.key}),"aria-current":g?"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," · ",se(h.updatedAt)]})]})},`document-${h.id}`)}),R.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:R.map(h=>{const g=ye(h),ee=ns[g],At=We(t,g),$e=M?.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${$e?" markdown-file-item--selected":""}`,onClick:()=>bt(h.id),"aria-label":t("documents.openTaskArtifact","Open {{taskId}} artifact {{title}}",{taskId:a,title:h.title||t("documents.untitledArtifact","Untitled artifact")}),"aria-current":$e?"true":void 0,children:[e.jsxs("span",{className:"documents-task-artifact-title-row",children:[e.jsx(ee,{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:[At," · ",h.mimeType||h.type]}),e.jsxs("span",{className:"markdown-file-item-meta",children:[h.authorId||t("documents.unknownAuthor","unknown")," · ",se(h.updatedAt)]})]})},`artifact-${h.id}`)})})]}):null]})]},a)})}),(!b||ie)&&e.jsxs("section",{className:"documents-view-main","aria-label":t("documents.taskDocumentPreviewLabel","Task document content preview"),children:[b&&ie&&e.jsxs("button",{className:"btn btn-sm documents-mobile-back",onClick:gt,"aria-label":t("documents.backToTaskDocumentsList","Back to task documents list"),children:[e.jsx(qe,{size:14}),t("documents.backToTaskDocuments","Back to documents")]}),ie?M?e.jsx(ls,{artifact:M,projectId:n,content:Xe,loading:Ye,error:Je,renderMarkdown:Ze,onToggleMarkdown:()=>fe(a=>!a),onOpenTask:Le,t}):u?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:[u.taskId," / ",u.key]}),e.jsx("div",{className:"documents-task-document-actions",children:Se?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm",onClick:St,disabled:me,children:t("documents.cancelEdit","Cancel")}),e.jsx("button",{className:"btn btn-sm btn-primary",onClick:()=>void Ct(),disabled:me,children:me?t("documents.saving","Saving…"):t("documents.saveTaskDocument","Save")})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-sm document-mode-toggle",onClick:()=>vt(u.id),"aria-label":G?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),"aria-pressed":G,title:G?t("documents.switchToPlainText","Switch to plain text"):t("documents.switchToMarkdown","Switch to markdown"),children:G?t("documents.markdown","Markdown"):t("documents.plain","Plain")}),e.jsxs("button",{className:"btn btn-sm",onClick:Nt,"aria-label":t("documents.editTaskDocument","Edit task document"),children:[e.jsx(Ue,{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:u.author}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{children:t("documents.revisionShort","v{{revision}}",{revision:u.revision})}),e.jsx("span",{className:"document-card-separator",children:"·"}),e.jsx("span",{className:"document-card-date",children:se(u.updatedAt)})]}),Se?e.jsx("div",{className:"documents-task-document-editor","aria-label":t("documents.taskDocumentContentEditor","Task document content editor"),children:e.jsx(_e,{content:ue,onChange:y,filePath:u.key.includes(".")?u.key:`${u.key}.md`,forceToolbarActionsVisible:!0})}):G?e.jsx("div",{ref:ne,className:"documents-content-markdown",children:e.jsx("div",{className:"markdown-body",children:e.jsx(Te,{remarkPlugins:[Fe],children:u.content})})}):e.jsx("pre",{ref:Y,className:"document-card-content-text documents-content-viewer-text",children:u.content}),Ft]}):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{ps as DocumentsView};
@@ -1,21 +0,0 @@
1
- import{r as h,j as e,b as H}from"./vendor-react-SZ_qB27O.js";import{c as D,dc as V,df as O,a8 as U,C as B,dg as W,dh as q,p as K,a$ as Y,bt as J,di as z,dj as Z,dk as A}from"./index-Cg9ahVtV.js";import{u as P}from"./vendor-i18n-GF3RlKbq.js";/**
2
- * @license lucide-react v1.7.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Q=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],X=D("bug",Q);/**
7
- * @license lucide-react v1.7.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const ee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],ae=D("life-buoy",ee);/**
12
- * @license lucide-react v1.7.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const te=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],se=D("moon",te);/**
17
- * @license lucide-react v1.7.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const re=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],le=D("sun",re);async function T(s,c){const r=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!r.ok)throw new Error((await r.json().catch(()=>({error:r.statusText}))).error??r.statusText);return r.json()}function ne(s){return T("/api/report/draft",s)}function oe(s){return T("/api/report/file",s)}function ce(s){return T("/api/report/help",{question:s})}async function ie(s){const c=new FormData;c.append("screenshot",s,"report-screenshot.png");const r=await fetch("/api/report/attachment",{method:"POST",body:c});if(!r.ok)throw new Error((await r.json().catch(()=>({error:r.statusText}))).error??r.statusText);return r.json()}async function fe(){const s=await fetch("/api/report/discussion-categories");if(!s.ok)throw new Error((await s.json().catch(()=>({error:s.statusText}))).error??s.statusText);return s.json()}function ye(s){const c=new URLSearchParams(s.search),r=s.hash.match(/^#\/tasks\/([^/?#]+)/),i=r?.[1]?decodeURIComponent(r[1]):c.get("taskId")??void 0,d=c.get("agentId")??void 0;return i||d?{taskId:i,agentId:d}:void 0}const G=[{value:"light",label:"Light",icon:le},{value:"dark",label:"Dark",icon:se},{value:"system",label:"System",icon:V}],N=[{value:"default",label:"Fusion Legacy",className:"theme-swatch-default"},{value:"ocean",label:"Ocean",className:"theme-swatch-ocean"},{value:"forest",label:"Forest",className:"theme-swatch-forest"},{value:"sunset",label:"Sunset",className:"theme-swatch-sunset"},{value:"zen",label:"Zen",className:"theme-swatch-zen"},{value:"berry",label:"Berry",className:"theme-swatch-berry"},{value:"high-contrast",label:"High Contrast",className:"theme-swatch-high-contrast"},{value:"industrial",label:"Industrial",className:"theme-swatch-industrial"},{value:"monochrome",label:"Mono",className:"theme-swatch-monochrome"},{value:"slate",label:"Slate",className:"theme-swatch-slate"},{value:"ash",label:"Ash",className:"theme-swatch-ash"},{value:"air",label:"Air",className:"theme-swatch-air"},{value:"graphite",label:"Graphite",className:"theme-swatch-graphite"},{value:"silver",label:"Silver",className:"theme-swatch-silver"},{value:"solarized",label:"Solarized",className:"theme-swatch-solarized"},{value:"factory",label:"Factory",className:"theme-swatch-factory"},{value:"factory-mono",label:"Factory Mono",className:"theme-swatch-factory-mono"},{value:"ayu",label:"Ayu",className:"theme-swatch-ayu"},{value:"one-dark",label:"One Dark",className:"theme-swatch-one-dark"},{value:"nord",label:"Nord",className:"theme-swatch-nord"},{value:"dracula",label:"Dracula",className:"theme-swatch-dracula"},{value:"gruvbox",label:"Gruvbox",className:"theme-swatch-gruvbox"},{value:"tokyo-night",label:"Tokyo Night",className:"theme-swatch-tokyo-night"},{value:"catppuccin-mocha",label:"Catppuccin Mocha",className:"theme-swatch-catppuccin-mocha"},{value:"github-dark",label:"GitHub Dark",className:"theme-swatch-github-dark"},{value:"everforest",label:"Everforest",className:"theme-swatch-everforest"},{value:"rose-pine",label:"Rosé Pine",className:"theme-swatch-rose-pine"},{value:"kanagawa",label:"Kanagawa",className:"theme-swatch-kanagawa"},{value:"night-owl",label:"Night Owl",className:"theme-swatch-night-owl"},{value:"palenight",label:"Palenight",className:"theme-swatch-palenight"},{value:"monokai-pro",label:"Monokai Pro",className:"theme-swatch-monokai-pro"},{value:"slime",label:"Slime",className:"theme-swatch-slime"},{value:"brutalist",label:"Brutalist",className:"theme-swatch-brutalist"},{value:"neon-city",label:"Neon City",className:"theme-swatch-neon-city"},{value:"parchment",label:"Parchment",className:"theme-swatch-parchment"},{value:"terminal",label:"Terminal",className:"theme-swatch-terminal"},{value:"glass",label:"Glass",className:"theme-swatch-glass"},{value:"glass-silver",label:"Glass Silver",className:"theme-swatch-glass-silver"},{value:"horizon",label:"Horizon",className:"theme-swatch-horizon"},{value:"vitesse",label:"Vitesse",className:"theme-swatch-vitesse"},{value:"outrun",label:"Outrun",className:"theme-swatch-outrun"},{value:"snazzy",label:"Snazzy",className:"theme-swatch-snazzy"},{value:"porple",label:"Porple",className:"theme-swatch-porple"},{value:"espresso",label:"Espresso",className:"theme-swatch-espresso"},{value:"mars",label:"Mars",className:"theme-swatch-mars"},{value:"poimandres",label:"Poimandres",className:"theme-swatch-poimandres"},{value:"ember",label:"Ember",className:"theme-swatch-ember"},{value:"rust",label:"Rust",className:"theme-swatch-rust"},{value:"copper",label:"Copper",className:"theme-swatch-copper"},{value:"foundry",label:"Foundry",className:"theme-swatch-foundry"},{value:"carbon",label:"Carbon",className:"theme-swatch-carbon"},{value:"sandstone",label:"Sandstone",className:"theme-swatch-sandstone"},{value:"lagoon",label:"Lagoon",className:"theme-swatch-lagoon"},{value:"frost",label:"Frost",className:"theme-swatch-frost"},{value:"lavender",label:"Lavender",className:"theme-swatch-lavender"},{value:"neon-bloom",label:"Neon Bloom",className:"theme-swatch-neon-bloom"},{value:"sepia",label:"Sepia",className:"theme-swatch-sepia"},{value:"cobalt",label:"Cobalt",className:"theme-swatch-cobalt"},{value:"clay",label:"Clay",className:"theme-swatch-clay"},{value:"moss",label:"Moss",className:"theme-swatch-moss"},{value:"aurora",label:"Aurora",className:"theme-swatch-aurora"},{value:"calm",label:"Calm",className:"theme-swatch-calm"},{value:"dawn",label:"Dawn",className:"theme-swatch-dawn"},{value:"shadcn",label:"Shadcn",className:"theme-swatch-shadcn"},{value:"shadcn-ember",label:"Shadcn Ember (Default)",className:"theme-swatch-shadcn-ember"},{value:"shadcn-custom",label:"Shadcn Custom",className:"theme-swatch-shadcn-custom"},{value:"shadcn-blue",label:"Shadcn Blue",className:"theme-swatch-shadcn-blue"},{value:"shadcn-green",label:"Shadcn Green",className:"theme-swatch-shadcn-green"},{value:"shadcn-red",label:"Shadcn Red",className:"theme-swatch-shadcn-red"},{value:"shadcn-purple",label:"Shadcn Purple",className:"theme-swatch-shadcn-purple"},{value:"shadcn-pink",label:"Shadcn Pink",className:"theme-swatch-shadcn-pink"},{value:"shadcn-orange",label:"Shadcn Orange",className:"theme-swatch-shadcn-orange"},{value:"shadcn-yellow",label:"Shadcn Yellow",className:"theme-swatch-shadcn-yellow"},{value:"shadcn-mono",label:"Shadcn Mono",className:"theme-swatch-shadcn-mono"},{value:"shadcn-mono-red",label:"Shadcn Mono Red",className:"theme-swatch-shadcn-mono-red"},{value:"shadcn-mono-blue",label:"Shadcn Mono Blue",className:"theme-swatch-shadcn-mono-blue"},{value:"shadcn-mono-green",label:"Shadcn Mono Green",className:"theme-swatch-shadcn-mono-green"},{value:"shadcn-mono-purple",label:"Shadcn Mono Purple",className:"theme-swatch-shadcn-mono-purple"},{value:"shadcn-mono-pink",label:"Shadcn Mono Pink",className:"theme-swatch-shadcn-mono-pink"},{value:"shadcn-mono-orange",label:"Shadcn Mono Orange",className:"theme-swatch-shadcn-mono-orange"},{value:"shadcn-mono-yellow",label:"Shadcn Mono Yellow",className:"theme-swatch-shadcn-mono-yellow"},{value:"shadcn-black",label:"Shadcn Black",className:"theme-swatch-shadcn-black"},{value:"shadcn-gray",label:"Shadcn Gray",className:"theme-swatch-shadcn-gray"},{value:"shadcn-gray-blue",label:"Shadcn Gray Blue",className:"theme-swatch-shadcn-gray-blue"}];function he(s){const c=s.trim();if(/^#[\da-f]{6}$/i.test(c))return c;if(/^#[\da-f]{3}$/i.test(c)){const[,r,i,d]=c;return`#${r}${r}${i}${i}${d}${d}`}return"#000000"}function de({value:s={},onChange:c,resolvedThemeMode:r="dark"}){const{t:i}=P("app"),[d,v]=h.useState(!1),t=h.useId(),u=h.useMemo(()=>O(s),[s]),m=(n,p)=>{c(O({...u,[n]:p}))},l=d?i("theme.shadcnCustom.collapse","Collapse custom colors"):i("theme.shadcnCustom.show","Show custom colors"),w=d?U:B;return e.jsxs("section",{className:"shadcn-color-picker card","data-testid":"shadcn-color-picker","aria-labelledby":"shadcn-color-picker-title",children:[e.jsxs("div",{className:"shadcn-color-picker-header",children:[e.jsxs("div",{className:"shadcn-color-picker-heading",children:[e.jsx("h3",{id:"shadcn-color-picker-title",className:"shadcn-color-picker-title",children:i("theme.shadcnCustom.title","Custom shadcn colors")}),e.jsx("p",{className:"shadcn-color-picker-description",children:i("theme.shadcnCustom.description","Override shadcn design tokens with hex colors. Blank tokens use the theme defaults.")})]}),e.jsx("button",{type:"button",className:"btn btn-icon btn-sm shadcn-color-picker-toggle","aria-expanded":d,"aria-controls":t,"aria-label":l,title:l,onClick:()=>v(n=>!n),children:e.jsx(w,{size:16,"aria-hidden":"true"})})]}),d?e.jsxs("div",{id:t,className:"shadcn-color-picker-controls-panel","data-testid":"shadcn-color-picker-controls",children:[e.jsx("div",{className:"shadcn-color-picker-actions",children:e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>c({}),children:i("theme.shadcnCustom.reset","Reset custom colors")})}),e.jsx("div",{className:"shadcn-color-picker-grid",children:W.map(n=>{const p=q(n,r),y=u[n.cssVar]??p,x=`shadcn-color-${n.cssVar.replace(/^--/,"").replace(/[^a-z0-9]+/gi,"-")}`;return e.jsxs("div",{className:"shadcn-color-picker-row","data-testid":`shadcn-color-${n.cssVar}`,children:[e.jsxs("label",{className:"shadcn-color-picker-label",htmlFor:x,children:[e.jsx("span",{children:i(`theme.shadcnCustom.token.${n.cssVar}`,n.label)}),e.jsx("code",{children:n.cssVar})]}),e.jsxs("div",{className:"shadcn-color-picker-controls",children:[e.jsx("input",{"aria-label":i("theme.shadcnCustom.colorInput","Pick {{label}} color",{label:n.label}),className:"shadcn-color-picker-native",type:"color",value:he(y),onChange:f=>m(n.cssVar,f.currentTarget.value)}),e.jsx("input",{id:x,"aria-label":i("theme.shadcnCustom.hexInput","{{label}} hex color",{label:n.label}),className:"input shadcn-color-picker-hex",type:"text",inputMode:"text",spellCheck:!1,value:y,onChange:f=>m(n.cssVar,f.currentTarget.value)})]})]},n.cssVar)})})]}):null]})}function ue(s){return N.find(c=>c.value===s)??N[0]}function L({className:s}){return e.jsxs("span",{className:`theme-option-swatch ${s}`,"aria-hidden":"true",children:[e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-1"}),e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-2"}),e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-3"}),e.jsx("span",{className:"theme-option-swatch-sample theme-option-swatch-sample-4"})]})}function xe({colorTheme:s,onColorThemeChange:c,themeMode:r,shadcnCustomColors:i={},resolvedThemeMode:d=r==="light"?"light":"dark",onThemeModeChange:v,onShadcnCustomColorsChange:t=()=>{},triggerVariant:u="compact"}){const{t:m}=P("app"),[l,w]=h.useState(!1),[n,p]=h.useState(()=>Math.max(0,N.findIndex(a=>a.value===s))),y=h.useRef(null),x=h.useRef([]),f=h.useMemo(()=>ue(s),[s]),j=r==="system"?d:r,E=G.find(a=>a.value===j)?.icon,g=r==="system"?m("theme.system","System"):m(`theme.${r}`,r?`${r.charAt(0).toUpperCase()}${r.slice(1)}`:"Dark"),C=m(`theme.colorTheme.${f.value}`,f.label),S=`${m("theme.currentTheme","Current theme")} ${g} / ${C}`,R="theme-dropdown-listbox";h.useEffect(()=>{if(!l)return;const a=b=>{y.current&&!y.current.contains(b.target)&&w(!1)};return document.addEventListener("pointerdown",a),()=>document.removeEventListener("pointerdown",a)},[l]),h.useEffect(()=>{p(Math.max(0,N.findIndex(a=>a.value===s)))},[s]),h.useEffect(()=>{l&&x.current[n]?.focus()},[n,l]);const M=a=>{c(a),w(!1)},$=a=>{if(a.key==="ArrowDown"||a.key==="ArrowUp"||a.key==="Enter"||a.key===" "){a.preventDefault();const b=Math.max(0,N.findIndex(k=>k.value===s));p(a.key==="ArrowUp"?Math.max(0,b-1):b),w(!0)}},o=(a,b,k)=>{if(a.key==="Escape"){a.preventDefault(),w(!1);return}if(a.key==="ArrowDown"||a.key==="ArrowUp"){a.preventDefault();const I=a.key==="ArrowDown"?1:-1;p((b+I+N.length)%N.length);return}if(a.key==="Home"){a.preventDefault(),p(0);return}if(a.key==="End"){a.preventDefault(),p(N.length-1);return}(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),M(k))};return e.jsxs("div",{className:`theme-dropdown${u==="current-row"?" theme-dropdown--current-row":""}${l?" open":""}`,ref:y,children:[e.jsxs("button",{type:"button",className:`theme-dropdown-trigger btn${u==="current-row"?" theme-dropdown-trigger--current-row":""}`,"aria-label":u==="current-row"?S:void 0,"aria-haspopup":"listbox","aria-expanded":l,"aria-controls":R,onClick:()=>w(a=>!a),onKeyDown:$,children:[u==="current-row"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"theme-dropdown-current-row-icon","aria-hidden":"true",children:E?e.jsx(E,{size:20}):null}),e.jsxs("span",{className:"theme-dropdown-current-row-info",children:[e.jsx("span",{className:"theme-dropdown-current-row-label",children:m("theme.currentTheme","Current theme")}),e.jsxs("span",{className:"theme-dropdown-current-row-value",children:[g," / ",C]})]}),e.jsx(L,{className:f.className})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:f.className}),e.jsx("span",{className:"theme-dropdown-trigger-label",children:C})]}),e.jsx(B,{size:16,"aria-hidden":"true"})]}),r&&v?e.jsx("div",{className:"theme-dropdown-modes",role:"radiogroup","aria-label":m("theme.modeLabel","Theme mode"),children:G.map(({value:a,label:b,icon:k})=>e.jsxs("button",{type:"button",className:`theme-dropdown-mode-btn btn btn-sm${r===a?" active":""}`,"aria-pressed":r===a,onClick:()=>v(a),title:m(`theme.${a}Mode`,`${b} mode`),children:[e.jsx(k,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:m(`theme.${a}`,b)})]},a))}):null,s==="shadcn-custom"?e.jsx(de,{value:i,onChange:t,resolvedThemeMode:d}):null,l?e.jsx("div",{className:"theme-dropdown-popover",role:"presentation",children:e.jsx("div",{id:R,className:"theme-dropdown-list",role:"listbox","aria-label":m("theme.colorThemeLabel","Color theme"),children:N.map(({value:a,label:b,className:k},I)=>{const _=s===a;return e.jsxs("button",{ref:F=>{x.current[I]=F},type:"button",className:`theme-dropdown-option${_?" active":""}`,role:"option","aria-selected":_,tabIndex:I===n?0:-1,onClick:()=>M(a),onKeyDown:F=>o(F,I,a),children:[e.jsx(L,{className:k}),e.jsx("span",{className:"theme-dropdown-option-label",children:m(`theme.colorTheme.${a}`,b)}),_?e.jsx(K,{size:16,"aria-hidden":"true"}):null]},a)})})}):null]})}const me=[{type:"bug",label:"Report bug",Icon:X},{type:"feedback",label:"Send feedback",Icon:Y},{type:"idea",label:"Share idea",Icon:J},{type:"help",label:"Get help",Icon:ae}];function Ne({onSelect:s}){const[c,r]=h.useState(!1),[i,d]=h.useState(),v=h.useRef(null),t=h.useRef(null),u=h.useCallback(()=>{const l=v.current?.getBoundingClientRect();l&&d({top:l.bottom,left:l.left,right:window.innerWidth-l.right})},[]);h.useEffect(()=>{if(!c)return;u();const l=()=>u();return window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),()=>{window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[c,u]),h.useEffect(()=>{if(!c)return;const l=n=>{const p=n.target;v.current?.contains(p)||t.current?.contains(p)||r(!1)},w=n=>{n.key==="Escape"&&(r(!1),v.current?.focus())};return document.addEventListener("mousedown",l),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",w)}},[c]);const m=c&&i&&typeof document<"u"?H.createPortal(e.jsx("div",{ref:t,className:"report-action-menu__list report-action-menu__list--portal",role:"menu",style:{top:i.top,left:i.left,right:i.right},children:me.map(({type:l,label:w,Icon:n})=>e.jsxs("button",{className:"report-action-menu__item",type:"button",role:"menuitem",onClick:()=>{r(!1),s(l)},children:[e.jsx(n,{"aria-hidden":"true"}),w]},l))}),document.body):null;return e.jsxs("div",{className:"report-action-menu",children:[e.jsx("button",{ref:v,className:"btn btn-secondary",type:"button","aria-haspopup":"menu","aria-expanded":c,onClick:()=>r(l=>!l),children:"Report"}),m]})}const pe={bug:"What went wrong?",feedback:"What would you like to share?",idea:"What would you like Fusion to do?",help:"What would you like help with?"};function ge({actionType:s,onClose:c,contextRefs:r}){const{t:i}=P("app"),[d,v]=h.useState(""),[t,u]=h.useState(),[m,l]=h.useState(!1),[w,n]=h.useState(),[p,y]=h.useState(!1),[x,f]=h.useState(),[j,E]=h.useState(),[g,C]=h.useState(!1),S=h.useRef(0),R=async o=>{l(!0),n(void 0);try{const a=await Z();if(!a)throw new Error("Screen capture was unavailable or denied.");const{artifactId:b}=await ie(a);if(S.current!==o)return;E(b)}catch(a){if(S.current!==o)return;y(!1),n(a instanceof Error?a.message:"We could not capture the current screen.")}finally{S.current===o&&l(!1)}},M=async()=>{if(d.trim()){if(p&&(!j||!g)){n("Capture and confirm local screenshot retention before continuing, or turn attachment off.");return}l(!0),n(void 0);try{if(A("report"),s==="help"){const o=await ce(d);if(o.answered){u({kind:"help",answer:o.answer});return}}u(await ne({actionType:s,targetType:x,userPrompt:d,contextRefs:r,activityTrace:z(),screenshotArtifactId:p&&g?j:void 0}))}catch{n("We could not prepare your report. Check your connection and try again.")}finally{l(!1)}}},$=async(o,a,b)=>{if(t?.report){l(!0),n(void 0);try{A("report"),u(await oe({actionType:s,targetType:x,report:t.report,endorseIssueNumber:o,endorseDiscussionId:a,endorseRoadmapIssueNumber:b,activityTrace:z(),screenshotArtifactId:p&&g?j:void 0}))}catch{n("We could not send your report. Your draft is still here; try again.")}finally{l(!1)}}};return e.jsx("div",{className:"report-modal-backdrop",role:"presentation",children:e.jsxs("section",{className:"card report-modal",role:"dialog","aria-modal":"true","aria-label":`${s} report`,children:[e.jsx("button",{className:"btn-icon report-modal__close",type:"button","aria-label":"Close report",onClick:c,children:"×"}),w&&e.jsx("p",{className:"report-modal__error",role:"alert",children:w}),!t&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:s[0].toUpperCase()+s.slice(1)}),e.jsx("label",{htmlFor:"report-prompt",children:pe[s]}),e.jsx("textarea",{id:"report-prompt",className:"input",value:d,onChange:o=>v(o.target.value),maxLength:4e3}),e.jsxs("label",{className:"report-modal__screenshot-option",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:o=>{const a=o.target.checked,b=++S.current;y(a),E(void 0),C(!1),a?R(b):l(!1)}})," Store a screenshot locally"]}),p&&e.jsx("div",{className:"report-modal__screenshot-preview",children:j?e.jsxs("label",{className:"report-modal__screenshot-option",children:[e.jsx("input",{type:"checkbox",checked:g,onChange:o=>C(o.target.checked)})," I confirm Fusion may retain this screenshot locally for this report."]}):e.jsx("p",{children:"Capturing and storing locally…"})}),e.jsx("label",{htmlFor:"report-target",children:i("report.targetLabel","Filing target")}),e.jsxs("select",{id:"report-target",className:"input",value:x??"",onChange:o=>f(o.target.value||void 0),children:[e.jsx("option",{value:"",children:i("report.targetInherit","Use configured action target")}),e.jsx("option",{value:"issue",children:i("report.targetIssue","GitHub Issue")}),e.jsx("option",{value:"discussion",children:i("report.targetDiscussion","GitHub Discussion")})]}),e.jsxs("details",{className:"report-modal__activity-trace",children:[e.jsx("summary",{children:"Activity trace to send"}),e.jsx("ul",{children:z().map((o,a)=>e.jsx("li",{children:o},`${o}-${a}`))})]}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:!d.trim()||m,onClick:()=>void M(),children:w?"Retry":"Continue"})]}),t?.kind==="draft-ready"&&t.report&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Review your report"}),e.jsx("label",{htmlFor:"report-review-prompt",children:"Report summary"}),e.jsx("textarea",{id:"report-review-prompt",className:"input",value:t.report.userPrompt,onChange:o=>{const a=o.target.value;u({...t,report:{...t.report,userPrompt:a}})}}),e.jsx("label",{htmlFor:"report-review-body",children:"Structured report"}),e.jsx("textarea",{id:"report-review-body",className:"input",value:t.report.body??"",onChange:o=>u({...t,report:{...t.report,body:o.target.value}})}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:m,onClick:()=>void $(),children:"File report"})]}),t?.kind==="duplicate-found"&&t.issue&&t.report&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t.issue.roadmap?i("report.roadmapDuplicate.title","Already on the roadmap — add your data point?"):"Review data point for a similar open issue"}),e.jsx("a",{href:t.issue.url,target:"_blank",rel:"noreferrer",children:t.issue.title}),e.jsx("label",{htmlFor:"report-duplicate-prompt",children:"Report summary"}),e.jsx("textarea",{id:"report-duplicate-prompt",className:"input",value:t.report.userPrompt,onChange:o=>{const a=o.target.value;u({...t,report:{...t.report,userPrompt:a}})}}),e.jsx("label",{htmlFor:"report-duplicate-body",children:"Structured data point"}),e.jsx("textarea",{id:"report-duplicate-body",className:"input",value:t.report.body??"",onChange:o=>u({...t,report:{...t.report,body:o.target.value}})}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:m,onClick:()=>void $(t.issue.discussionId||t.issue.roadmap?void 0:t.issue.number,t.issue.discussionId,t.issue.roadmap?t.issue.number:void 0),children:"Confirm and add data point"})]}),(t?.kind==="filed"||t?.kind==="endorsed")&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t.kind==="filed"&&t.destination==="issue"?"Report filed as an Issue":"Report sent"}),e.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",children:"View on GitHub"}),t.report?.body&&e.jsxs(e.Fragment,{children:[e.jsx("label",{htmlFor:"filed-report",children:"Final report"}),e.jsx("textarea",{id:"filed-report",className:"input",value:t.report.body,readOnly:!0})]})]}),t?.kind==="help"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Suggested help"}),e.jsx("p",{children:t.answer?.summary??t.answer?.content})]}),t?.kind==="unavailable"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"alert",children:t.message}),e.jsx("button",{className:"btn btn-secondary",type:"button",onClick:()=>{u(void 0),n(void 0)},children:"Return to prompt"})]})]})})}export{X as B,Ne as R,G as T,xe as a,ge as b,fe as l,ye as r};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-xterm-BNq00GSj.js","assets/vendor-react-SZ_qB27O.js","assets/vendor-xterm-LZoznX6r.css","assets/addon-fit-C1WQXRvu.js","assets/addon-unicode11-BVmNDUBM.js","assets/addon-webgl-uLc0RKcC.js"])))=>i.map(i=>d[i]);
2
- import{H as ge,I as A,J as le,K as V,N as ce,O as B,Q as xe,U as Ne,o as Re,W as Pe,Y as J,_ as je,$ as Me,a0 as De,a1 as I,a2 as Le,a3 as Oe}from"./index-Cg9ahVtV.js";import{r as i,j as t}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as Ae}from"./vendor-i18n-GF3RlKbq.js";import{S as ze}from"./shield-alert-CcQuaRHN.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";const Fe=32*1024,Be=100,Ie="\x1B",Ke=" ",We="",$e="\x1B[A",Ue="\x1B[B",Qe="\x1B[C",Ve="\x1B[D",K={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function de(u){if(u.length!==1)return null;const o=u.toUpperCase().charCodeAt(0);return o>=64&&o<=95?String.fromCharCode(o&31):null}function Je(){const[u,f]=i.useState(()=>J());return i.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const o=window.matchMedia(je),a=window.visualViewport,y=()=>f(J());return y(),typeof a?.addEventListener=="function"&&a.addEventListener("resize",y),typeof o.addEventListener=="function"?(o.addEventListener("change",y),()=>{o.removeEventListener("change",y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)}):(o.addListener(y),()=>{o.removeListener(y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)})},[]),u}function Ye(u,f){if(typeof window>"u")return"";const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(u)}&ticket=${encodeURIComponent(f)}`;return Oe(a)}function He(){return/Mac|iPhone|iPad|iPod/i.test(navigator.platform)}function Ge(u){if(typeof window<"u"&&typeof window.atob=="function"){const f=window.atob(u),o=new Uint8Array(f.length);for(let a=0;a<f.length;a++)o[a]=f.charCodeAt(a);return new TextDecoder("utf-8").decode(o)}return Buffer.from(u,"base64").toString("utf8")}function at({sessionId:u,readOnly:f=!1,posture:o,mode:a="live",projectId:y,onConfirmAdvance:E,showConfirmAdvance:W=!1,onOpenAdapterSettings:Y}){const{t:r}=Ae("app"),C=i.useRef(null),T=i.useRef(null),j=i.useRef(null),S=i.useRef(null),[H,G]=i.useState(!1),[ue,$]=i.useState(!1),[q,Z]=i.useState(!1),g=Je(),{keyboardOpen:z,keyboardOverlap:me}=ge({enabled:g}),fe=i.useRef(null),[_,X]=i.useState(""),[x,M]=i.useState(!1),[pe,ye]=i.useState(()=>A().customShortcuts),[ee,te]=i.useState(null),ne=f||ee===!0,D=!f&&ee===!1&&a==="live",b=i.useCallback(e=>{if(!e||!D)return;const n=S.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:"input",data:e}))},[D]),N=i.useCallback(e=>{if(x){const n=de(e);if(M(!1),n){b(n);return}}b(e)},[x,b]),l=i.useCallback(e=>{e.preventDefault()},[]),be=i.useCallback(e=>{e?.preventDefault?.(),_&&b(_),b("\r"),X("")},[_,b]),he=i.useCallback(e=>{if(x&&e.length>_.length){const n=e.slice(_.length,_.length+1),d=de(n);if(M(!1),d){b(d);return}}X(e)},[x,_,b]);i.useEffect(()=>{W&&$(!1)},[W,u]);const L=i.useCallback((e,n)=>{const d=S.current;d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:e,rows:n}))},[]),ie=i.useCallback(()=>{const e=T.current;if(!e)return;const n=A(),d=le(n.fontFamily);e.options.fontFamily=d,C.current?.style.setProperty("--terminal-glyph-font-family",V(n.fontFamily)),e.options.fontSize=n.fontSize,e.options.cursorStyle=n.cursorStyle,e.options.cursorBlink=n.cursorBlink&&D;try{j.current?.fit?.(),L(e.cols,e.rows)}catch{}ce(n.fontSize,d).then(R=>{if(!(!R||T.current!==e||e.options.fontSize!==n.fontSize||e.options.fontFamily!==d)){B(e,d),e.options.fontSize=n.fontSize;try{j.current?.fit?.(),L(e.cols,e.rows),B(e,d),e.refresh(0,Math.max(0,e.rows-1))}catch{}}},()=>{})},[D,L]);i.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.key===Me&&(ie(),ye(A().customShortcuts))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[ie]),i.useEffect(()=>{if(!u||typeof window>"u")return;let e=!1,n=null,d=null,R=0;te(null);const U=L,ke=p=>{if(R+=p,R<Fe)return;const h=S.current;h?.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"ack",bytes:R})),R=0};return(async()=>{let p;try{p=await De(`/cli-sessions/${encodeURIComponent(u)}/attach-ticket`,{method:"POST",body:JSON.stringify(y?{projectId:y}:{})})}catch{return}if(e)return;te(p.readOnly);const h=!f&&!p.readOnly&&a==="live",[{Terminal:ve},{FitAddon:Ee},{Unicode11Addon:Ce}]=await Promise.all([I(()=>import("./vendor-xterm-BNq00GSj.js").then(c=>c.x),__vite__mapDeps([0,1,2])),I(()=>import("./addon-fit-C1WQXRvu.js").then(c=>c.a),__vite__mapDeps([3,1])),I(()=>import("./addon-unicode11-BVmNDUBM.js").then(c=>c.a),__vite__mapDeps([4,1]))]);if(e||!C.current)return;const w=A(),O=le(w.fontFamily);C.current.style.setProperty("--terminal-glyph-font-family",V(w.fontFamily));const s=new ve({convertEol:!1,cursorBlink:w.cursorBlink&&h,cursorStyle:w.cursorStyle,disableStdin:!h,scrollback:1e4,fontFamily:O,fontSize:w.fontSize}),P=new Ee;s.loadAddon(P);const Te=new Ce;if(s.loadAddon(Te),s.unicode.activeVersion="11",Le(()=>{s.open(C.current)}),T.current=s,j.current=P,w.renderer==="auto"&&!J())try{const{WebglAddon:c}=await I(async()=>{const{WebglAddon:m}=await import("./addon-webgl-uLc0RKcC.js").then(k=>k.a);return{WebglAddon:m}},__vite__mapDeps([5,1]));if(!e){const m=new c;m.onContextLoss(()=>{try{m.dispose()}catch{}}),s.loadAddon(m)}}catch{}try{P.fit()}catch{}(async()=>{if(!(!await ce(w.fontSize,O)||e||T.current!==s||j.current!==P||s.options.fontSize!==w.fontSize||s.options.fontFamily!==O))try{B(s,O),s.options.fontSize=w.fontSize,P.fit(),U(s.cols,s.rows),B(s,O),s.refresh(0,Math.max(0,s.rows-1))}catch{}})(),h&&(s.onData(c=>{const m=S.current;m?.readyState===WebSocket.OPEN&&m.send(JSON.stringify({type:"input",data:c}))}),s.attachCustomKeyEventHandler(c=>{if(c.type!=="keydown"||!(He()?c.metaKey:c.ctrlKey)||c.altKey||c.shiftKey)return!0;const k=c.key.toLowerCase();if(k==="c"){const v=s.hasSelection()?s.getSelection():"";return v?(navigator.clipboard?.writeText(v).catch(()=>{}),!1):!0}if(k==="v"){const v=navigator.clipboard?.readText;return v&&v.call(navigator.clipboard).then(ae=>{if(!ae)return;const re=S.current;re?.readyState===WebSocket.OPEN&&re.send(JSON.stringify({type:"input",data:ae}))}).catch(()=>{}),!1}return!0})),n=new ResizeObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{try{P.fit(),U(s.cols,s.rows)}catch{}},Be)}),n.observe(C.current);const Q=new WebSocket(Ye(u,p.ticket));S.current=Q,Q.onopen=()=>{U(s.cols,s.rows)},Q.onmessage=c=>{let m;try{m=JSON.parse(typeof c.data=="string"?c.data:"")}catch{return}switch(m.type){case"scrollback":case"data":{if(typeof m.data!="string")return;const k=Ge(m.data),v=k.length;s.write(k,()=>ke(v));break}}}})(),()=>{e=!0,d&&clearTimeout(d),n&&n.disconnect();const p=S.current;if(p){p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null;try{p.close()}catch{}S.current=null}const h=T.current;if(h){try{h.dispose()}catch{}T.current=null}j.current=null}},[u,f,a,y,L]);const se=i.useMemo(()=>a==="idle"?r("cliTerminal.replayIdle","Session idle"):a==="ended"?r("cliTerminal.replayEnded","Session ended"):null,[a,r]),we=i.useCallback(async()=>{if(E){Z(!0);try{await E("advance"),$(!0)}finally{Z(!1)}}},[E]),Se=i.useCallback(async()=>{E&&await E("not-yet"),$(!0)},[E]),F=!!o?.elevated,oe=o?.elevatedFlags?.join(", "),_e={"--terminal-glyph-font-family":V(A().fontFamily)};return t.jsxs("div",{className:`cli-session-terminal${g?" cli-session-terminal--mobile":""}${g&&z?" cli-session-terminal--keyboard-open":""}`,"data-mode":a,"data-read-only":ne,"data-mobile":g,"data-keyboard-open":g&&z,children:[t.jsxs("header",{className:"cli-session-terminal__header",children:[o&&t.jsxs("div",{className:"cli-session-terminal__posture-wrap",children:[t.jsxs("button",{type:"button",className:`cli-posture-chip${F?" cli-posture-chip--elevated":""}`,"data-elevated":F,"aria-expanded":H,onClick:()=>G(e=>!e),children:[F?t.jsx(ze,{size:13,"aria-hidden":"true"}):t.jsx(xe,{size:13,"aria-hidden":"true"}),t.jsx("span",{className:"cli-posture-chip__name",children:o.adapterName}),o.mode&&t.jsx("span",{className:"cli-posture-chip__mode",children:o.mode}),F&&oe&&t.jsx("span",{className:"cli-posture-chip__flag",children:oe})]}),H&&t.jsxs("div",{className:"cli-posture-tooltip",role:"tooltip",children:[t.jsx("p",{className:"cli-posture-tooltip__title",children:r("cliTerminal.postureResolved","Resolved posture")}),t.jsxs("ul",{className:"cli-posture-tooltip__list",children:[(o.resolved??[]).map((e,n)=>t.jsx("li",{children:e},n)),(o.resolved??[]).length===0&&t.jsx("li",{children:o.mode??r("cliTerminal.postureBaseline","Baseline")})]}),Y&&t.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{G(!1),Y()},children:[t.jsx(Ne,{size:12,"aria-hidden":"true"}),r("cliTerminal.adapterSettings","Adapter settings")]})]})]}),ne&&t.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[t.jsx(Re,{size:12,"aria-hidden":"true"}),r("cliTerminal.readOnly","Read-only")]}),se&&t.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":a,children:se})]}),t.jsx("div",{className:"cli-session-terminal__viewport",ref:C,"data-testid":"cli-terminal-viewport",style:_e}),W&&!ue&&t.jsxs("div",{className:"cli-session-terminal__advance-strip",role:"region",children:[t.jsx("span",{className:"cli-session-terminal__advance-copy",children:r("cliTerminal.advancePrompt","This session looks idle — advance to review?")}),t.jsxs("div",{className:"cli-session-terminal__advance-actions",children:[t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn",disabled:q,onClick:we,children:r("cliTerminal.advance","Advance")}),t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:q,onClick:Se,children:r("cliTerminal.notYet","Not yet")})]})]}),g&&D&&t.jsxs("div",{className:`cli-session-terminal__mobile-bar${z?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:z?{bottom:`${me}px`}:void 0,children:[t.jsxs("div",{className:"cli-session-terminal__key-row","data-testid":"cli-terminal-key-bar",children:[t.jsx("button",{type:"button",className:`cli-terminal-key cli-terminal-key--ctrl${x?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":r("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":x,onPointerDown:l,onMouseDown:l,onClick:()=>M(e=>!e),children:K.ctrl}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":r("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ie),children:K.escape}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":r("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ke),children:K.tab}),t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--ctrlc","data-testid":"cli-key-ctrl-c","aria-label":r("cliTerminal.mobileKeyCtrlC","Send Ctrl-C"),onPointerDown:l,onMouseDown:l,onClick:()=>{M(!1),b(We)},children:K.ctrlC}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":r("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:l,onMouseDown:l,onClick:()=>N($e),children:"↑"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":r("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ue),children:"↓"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":r("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Ve),children:"←"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":r("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:l,onMouseDown:l,onClick:()=>N(Qe),children:"→"}),pe.map(e=>t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--custom","data-testid":`cli-terminal-custom-shortcut-${e.id}`,title:e.label,"aria-label":e.label,onPointerDown:l,onMouseDown:l,onClick:()=>{M(!1),b(Pe(e.value))},children:e.label},e.id))]}),t.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:be,children:[t.jsx("input",{ref:fe,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:_,placeholder:r("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:e=>he(e.target.value)}),t.jsx("button",{type:"submit",className:"cli-session-terminal__mobile-send","data-testid":"cli-terminal-mobile-send","aria-label":r("cliTerminal.mobileSend","Send"),onPointerDown:l,onMouseDown:l,children:r("cliTerminal.mobileSend","Send")})]})]})]})}export{at as SessionTerminal};