blade-code 0.10.138 → 0.10.140

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 (130) hide show
  1. package/dist/blade.js +2 -2
  2. package/dist/{chunk-6qhbdcse.js → chunk-08z32sky.js} +2 -2
  3. package/dist/{chunk-egadh3e9.js → chunk-0c2y17xy.js} +1 -1
  4. package/dist/{chunk-mjnkxem3.js → chunk-0kghtvxj.js} +2 -2
  5. package/dist/{chunk-3eskgvpy.js → chunk-0sx7ak0b.js} +1 -1
  6. package/dist/{chunk-d11mqbqk.js → chunk-15fpc0qg.js} +1 -1
  7. package/dist/{chunk-2t0wp7gm.js → chunk-19zsecpx.js} +2 -2
  8. package/dist/{chunk-byeq45rv.js → chunk-1myft5nb.js} +1 -1
  9. package/dist/chunk-1nreg14s.js +1 -0
  10. package/dist/{chunk-z9qv0d6k.js → chunk-2d3zksr0.js} +1 -1
  11. package/dist/{chunk-ec7ykyqz.js → chunk-2ff55pvt.js} +3 -3
  12. package/dist/{chunk-65c3vjwm.js → chunk-2g8avyq6.js} +1 -1
  13. package/dist/chunk-3kvt23m3.js +1 -0
  14. package/dist/chunk-4rh40xhc.js +1 -0
  15. package/dist/chunk-4xr4hz19.js +2 -0
  16. package/dist/{chunk-fndqbf45.js → chunk-50m1czz9.js} +1 -1
  17. package/dist/{chunk-earhezc8.js → chunk-5cw3bevx.js} +1 -1
  18. package/dist/{chunk-9m7d3ajv.js → chunk-5jq1mrqd.js} +1 -1
  19. package/dist/chunk-61yd46c0.js +1 -0
  20. package/dist/{chunk-8py443a5.js → chunk-6zxm9pen.js} +1 -1
  21. package/dist/{chunk-7vdf66jp.js → chunk-7eepxhcp.js} +34 -34
  22. package/dist/{chunk-jy7k2dwm.js → chunk-85b3kacc.js} +2 -2
  23. package/dist/chunk-8774agqd.js +1 -0
  24. package/dist/chunk-8brb7c6j.js +6 -0
  25. package/dist/{chunk-hrcz179j.js → chunk-8fx20am1.js} +2 -2
  26. package/dist/{chunk-16648v5c.js → chunk-8vqhcx3s.js} +1 -1
  27. package/dist/{chunk-6ezffjq1.js → chunk-9ced7jf0.js} +1 -1
  28. package/dist/chunk-abpmpyqa.js +1 -0
  29. package/dist/{chunk-yvmexv2c.js → chunk-ascjys4e.js} +1 -1
  30. package/dist/chunk-bb0z7c3g.js +1 -0
  31. package/dist/{chunk-5j68055h.js → chunk-c562kd2m.js} +1 -1
  32. package/dist/{chunk-he0f6h5q.js → chunk-cf3dvysj.js} +1 -1
  33. package/dist/{chunk-bq6d0v5b.js → chunk-cww9pp1q.js} +2 -2
  34. package/dist/{chunk-7j4s1nrc.js → chunk-d1qe06f0.js} +1 -1
  35. package/dist/{chunk-atdq9btn.js → chunk-e6j4vzta.js} +2 -2
  36. package/dist/{chunk-92n2p24j.js → chunk-eh901zhx.js} +2 -2
  37. package/dist/{chunk-14j2dbd6.js → chunk-eqe3smcg.js} +2 -2
  38. package/dist/{chunk-a5hkv8er.js → chunk-es0cbtx1.js} +2 -2
  39. package/dist/{chunk-r7bv1hmq.js → chunk-ffkzessq.js} +1 -1
  40. package/dist/{chunk-dv2m2xe5.js → chunk-g38d2ezm.js} +1 -1
  41. package/dist/{chunk-v2fewxvw.js → chunk-g4kydkyz.js} +2 -2
  42. package/dist/{chunk-5bfvdy62.js → chunk-g5scqxq3.js} +2 -2
  43. package/dist/{chunk-8rccn1y2.js → chunk-gq727fet.js} +1 -1
  44. package/dist/{chunk-56py3ryh.js → chunk-hj1yrssp.js} +1 -1
  45. package/dist/{chunk-d64b7wta.js → chunk-hvmrcd84.js} +1 -1
  46. package/dist/{chunk-zx78c1an.js → chunk-kmg8ad2j.js} +1 -1
  47. package/dist/{chunk-5v1pjexj.js → chunk-kxwc5wrx.js} +1 -1
  48. package/dist/chunk-m9dv5177.js +10 -0
  49. package/dist/{chunk-az08pq83.js → chunk-ma1mn6hn.js} +1 -1
  50. package/dist/{chunk-t88sfhjj.js → chunk-mnk0b4nz.js} +1 -1
  51. package/dist/chunk-mwgx87vw.js +1 -0
  52. package/dist/{chunk-nqts5by0.js → chunk-n6tvswa8.js} +2 -2
  53. package/dist/{chunk-fbrdcveb.js → chunk-n8qg68y2.js} +1 -1
  54. package/dist/chunk-ntq4h4jh.js +1 -0
  55. package/dist/{chunk-1bqatrxs.js → chunk-nxsarfy6.js} +1 -1
  56. package/dist/{chunk-ft1bdqbs.js → chunk-pg7cgvs8.js} +2 -2
  57. package/dist/{chunk-y66f1t18.js → chunk-ppmy3n74.js} +219 -218
  58. package/dist/chunk-pw9axk0e.js +5 -0
  59. package/dist/{chunk-2m79vd9p.js → chunk-pwct7cj7.js} +1 -1
  60. package/dist/{chunk-23c4pys6.js → chunk-q9qts6bq.js} +2 -2
  61. package/dist/chunk-r324qme7.js +1 -0
  62. package/dist/{chunk-rhwkvx96.js → chunk-r4q06wbs.js} +1 -1
  63. package/dist/chunk-ra6ksfdy.js +1 -0
  64. package/dist/{chunk-gcg56vaw.js → chunk-rrtptbzv.js} +2 -2
  65. package/dist/{chunk-jb4hmk56.js → chunk-svsgtj41.js} +2 -2
  66. package/dist/{chunk-j21hez8g.js → chunk-tagzy876.js} +6 -6
  67. package/dist/{chunk-516adpx6.js → chunk-tecbx0ek.js} +1 -1
  68. package/dist/chunk-tnts2de5.js +1 -0
  69. package/dist/chunk-w0710yj4.js +1 -0
  70. package/dist/{chunk-npc7jt96.js → chunk-w2m4yczv.js} +1 -1
  71. package/dist/{chunk-nyw686sf.js → chunk-w5057h27.js} +2 -2
  72. package/dist/chunk-we13xwds.js +180 -0
  73. package/dist/{chunk-nnas8tdt.js → chunk-xagh2qb6.js} +2 -2
  74. package/dist/{chunk-k10d8t4f.js → chunk-y5bqd8gh.js} +1 -1
  75. package/dist/{chunk-awheqy52.js → chunk-zfaenqqx.js} +2 -2
  76. package/dist/chunk-zp5097qk.js +2 -0
  77. package/dist/web/assets/ChatView-BlAGPVC-.js +63 -0
  78. package/dist/web/assets/{CodeBlockHighlighter-6-iPmomS.js → CodeBlockHighlighter-BM1MZv6w.js} +1 -1
  79. package/dist/web/assets/{FilePreview-D0aSwNF3.js → FilePreview-P77KS9tr.js} +1 -1
  80. package/dist/web/assets/{KanbanBoard-xPziptbY.js → KanbanBoard-B0c7sE2y.js} +1 -1
  81. package/dist/web/assets/{MarkdownRenderer-TWNqhwrr.js → MarkdownRenderer-DHa0FqU0.js} +3 -3
  82. package/dist/web/assets/{ScrollArea-CSQyGeWr.js → ScrollArea-C6yf2fqq.js} +1 -1
  83. package/dist/web/assets/{SessionHistorySurface-PRpOrUav.js → SessionHistorySurface-CXYBWqlN.js} +1 -1
  84. package/dist/web/assets/{SettingsModal-Ds-Uf-3r.js → SettingsModal-BVjVlENY.js} +1 -1
  85. package/dist/web/assets/{Sidebar-D6VyjkRY.js → Sidebar-DDW9Xs6e.js} +1 -1
  86. package/dist/web/assets/{TaskSwitcher-BEsAgt0k.js → TaskSwitcher-D74_5q1F.js} +1 -1
  87. package/dist/web/assets/{TerminalPanel-C_2lnmKH.js → TerminalPanel-DNEKapEi.js} +1 -1
  88. package/dist/web/assets/{archive-CPBIxP8f.js → archive-Ao0WD7pU.js} +1 -1
  89. package/dist/web/assets/{arrow-left-z3DhPgf-.js → arrow-left-a5_iLemp.js} +1 -1
  90. package/dist/web/assets/{calendar-clock-tYt1E6zR.js → calendar-clock-BKbdz6Cu.js} +1 -1
  91. package/dist/web/assets/{chevron-right-BGTvSaVS.js → chevron-right-8qYRfCj4.js} +1 -1
  92. package/dist/web/assets/{chevrons-up-down-Jw3ElnjQ.js → chevrons-up-down-BXNG4GvK.js} +1 -1
  93. package/dist/web/assets/{clock-3-v0h4RrLK.js → clock-3-DEL1ixyh.js} +1 -1
  94. package/dist/web/assets/{copy-CF3TUa0u.js → copy-Bd5v-KkM.js} +1 -1
  95. package/dist/web/assets/{download-ZG8PfhmH.js → download-CIKvpDBW.js} +1 -1
  96. package/dist/web/assets/{external-link-BKCjDDt-.js → external-link-B33h3DQN.js} +1 -1
  97. package/dist/web/assets/{folder-M-NM2bQG.js → folder-lOczceoh.js} +1 -1
  98. package/dist/web/assets/index-hZ37pkxs.js +203 -0
  99. package/dist/web/assets/{pause-CP_wlUro.js → pause-nnvVbgsj.js} +1 -1
  100. package/dist/web/assets/{pencil-U3n9D8ed.js → pencil-_yfoOmUq.js} +1 -1
  101. package/dist/web/assets/{play-NBWnc2gU.js → play-BilJ7SDs.js} +1 -1
  102. package/dist/web/assets/{plus-CmPqJgff.js → plus-BqqpYKaK.js} +1 -1
  103. package/dist/web/assets/{session-events-DKjIMNKI.js → session-events-FPOvcMBw.js} +19 -19
  104. package/dist/web/assets/{settings-CVFpbh_y.js → settings-CmJXtYTH.js} +1 -1
  105. package/dist/web/assets/{team-B9Na0Ocd.js → team-Bb04o2Tb.js} +1 -1
  106. package/dist/web/assets/{teamService-ZQZLqsjy.js → teamService-B5w9cpsa.js} +1 -1
  107. package/dist/web/assets/{terminal-BdmigqIS.js → terminal-DOjdChj0.js} +1 -1
  108. package/dist/web/index.html +1 -1
  109. package/package.json +1 -1
  110. package/dist/chunk-03zfvfen.js +0 -10
  111. package/dist/chunk-303b3x5q.js +0 -1
  112. package/dist/chunk-3g2z6hae.js +0 -1
  113. package/dist/chunk-3t5r41yh.js +0 -1
  114. package/dist/chunk-59980a8h.js +0 -1
  115. package/dist/chunk-5gy3x011.js +0 -1
  116. package/dist/chunk-5xgyx25z.js +0 -2
  117. package/dist/chunk-8cnxy251.js +0 -1
  118. package/dist/chunk-8cqm87j5.js +0 -1
  119. package/dist/chunk-ar85hxx2.js +0 -5
  120. package/dist/chunk-ddcz0nwv.js +0 -1
  121. package/dist/chunk-e71y87zg.js +0 -1
  122. package/dist/chunk-h2gp7smy.js +0 -1
  123. package/dist/chunk-j58wrt5n.js +0 -171
  124. package/dist/chunk-mc2mr1kn.js +0 -2
  125. package/dist/chunk-n2tfj82m.js +0 -1
  126. package/dist/chunk-pty1ncam.js +0 -6
  127. package/dist/chunk-qdjqbgts.js +0 -1
  128. package/dist/chunk-wv1mnf2m.js +0 -1
  129. package/dist/web/assets/ChatView-CZLmEMBO.js +0 -63
  130. package/dist/web/assets/index-VQVOzFZT.js +0 -203
@@ -1,4 +1,4 @@
1
- import{Yg as A1,Zg as L0,_g as M1,dh as v0}from"./chunk-yvmexv2c.js";import{kh as SO,lh as F1}from"./chunk-rhwkvx96.js";import{oh as x1}from"./chunk-az08pq83.js";import{ph as A0,rh as J0}from"./chunk-ec7ykyqz.js";import{Ei as z0,Fi as WO,Ji as b0}from"./chunk-atdq9btn.js";import{Vi as M}from"./chunk-dv2m2xe5.js";import{Cj as l1,vj as P,wj as S,xj as u,zj as L}from"./chunk-ft1bdqbs.js";import{Pj as c0}from"./chunk-2t0wp7gm.js";import{Wj as N}from"./chunk-jy7k2dwm.js";import{rk as qO}from"./chunk-t88sfhjj.js";import N0 from"node:path";import YO from"node:path";import y0 from"node:fs";import W0 from"node:os";import E from"node:path";import pO from"yaml";var V1=2000,j1=50,B1=1000,X4={type:"object",properties:{verdict:{type:"string",enum:["pass","fail","partial"]},summary:{type:"string",minLength:1,maxLength:V1},findings:{type:"array",maxItems:j1,items:{type:"string",minLength:1,maxLength:B1}}},required:["verdict","summary","findings"],additionalProperties:!1};function U1(O,$){let Q=O.trim().replaceAll(/\s+/g," ");if($)Q=Q.replaceAll($,".");return Q.replace(/\bBearer\s+[^\s"'`]+/gi,"Bearer [redacted]").replace(/\bsk-[A-Za-z0-9_-]{8,}\b/g,"[redacted-key]").replace(/\b(api(?:[_-]?|\s+)key|access(?:[_-]?|\s+)token|authorization|cookie|password|passwd|refresh(?:[_-]?|\s+)token|secret|session(?:[_-]?|\s+)token)\b(\s*[:=]\s*)([^\s,;]+)/gi,"$1$2[redacted]")}function kO(O){if(O.length<=v0)return O;let $=" [verification feedback truncated]",Q=O.slice(0,v0-$.length);if(/[\uD800-\uDBFF]$/.test(Q))Q=Q.slice(0,-1);return Q.trimEnd()+$}function S1(O){if(!O||typeof O!=="object"||Array.isArray(O))return;let $=O;if($.verdict!=="pass"&&$.verdict!=="fail"&&$.verdict!=="partial"||typeof $.summary!=="string"||!$.summary.trim()||$.summary.length>V1||!Array.isArray($.findings)||$.findings.length>j1||!$.findings.every((Q)=>typeof Q==="string"&&Q.trim().length>0&&Q.length<=B1))return;return{verdict:$.verdict,summary:$.summary.trim(),findings:$.findings.map((Q)=>Q.trim())}}function H4(O,$){let Q=S1(O);if(!Q)return;let Z=U1(Q.summary,$),J=Q.findings.map((K)=>U1(K,$));return kO([Z,J.length>0?`Findings:
1
+ import{$g as A1,ah as L0,bh as M1,gh as v0}from"./chunk-ascjys4e.js";import{nh as SO,oh as F1}from"./chunk-r4q06wbs.js";import{rh as x1}from"./chunk-ma1mn6hn.js";import{sh as A0,uh as J0}from"./chunk-2ff55pvt.js";import{Hi as z0,Ii as WO,Mi as b0}from"./chunk-e6j4vzta.js";import{Yi as M}from"./chunk-g38d2ezm.js";import{Aj as u,Cj as L,Fj as l1,yj as P,zj as S}from"./chunk-pg7cgvs8.js";import{Sj as c0}from"./chunk-19zsecpx.js";import{Zj as N}from"./chunk-85b3kacc.js";import{uk as qO}from"./chunk-mnk0b4nz.js";import N0 from"node:path";import YO from"node:path";import y0 from"node:fs";import W0 from"node:os";import E from"node:path";import pO from"yaml";var V1=2000,j1=50,B1=1000,X4={type:"object",properties:{verdict:{type:"string",enum:["pass","fail","partial"]},summary:{type:"string",minLength:1,maxLength:V1},findings:{type:"array",maxItems:j1,items:{type:"string",minLength:1,maxLength:B1}}},required:["verdict","summary","findings"],additionalProperties:!1};function U1(O,$){let Q=O.trim().replaceAll(/\s+/g," ");if($)Q=Q.replaceAll($,".");return Q.replace(/\bBearer\s+[^\s"'`]+/gi,"Bearer [redacted]").replace(/\bsk-[A-Za-z0-9_-]{8,}\b/g,"[redacted-key]").replace(/\b(api(?:[_-]?|\s+)key|access(?:[_-]?|\s+)token|authorization|cookie|password|passwd|refresh(?:[_-]?|\s+)token|secret|session(?:[_-]?|\s+)token)\b(\s*[:=]\s*)([^\s,;]+)/gi,"$1$2[redacted]")}function kO(O){if(O.length<=v0)return O;let $=" [verification feedback truncated]",Q=O.slice(0,v0-$.length);if(/[\uD800-\uDBFF]$/.test(Q))Q=Q.slice(0,-1);return Q.trimEnd()+$}function S1(O){if(!O||typeof O!=="object"||Array.isArray(O))return;let $=O;if($.verdict!=="pass"&&$.verdict!=="fail"&&$.verdict!=="partial"||typeof $.summary!=="string"||!$.summary.trim()||$.summary.length>V1||!Array.isArray($.findings)||$.findings.length>j1||!$.findings.every((Q)=>typeof Q==="string"&&Q.trim().length>0&&Q.length<=B1))return;return{verdict:$.verdict,summary:$.summary.trim(),findings:$.findings.map((Q)=>Q.trim())}}function H4(O,$){let Q=S1(O);if(!Q)return;let Z=U1(Q.summary,$),J=Q.findings.map((K)=>U1(K,$));return kO([Z,J.length>0?`Findings:
2
2
  ${J.map((K)=>`- ${K}`).join(`
3
3
  `)}`:""].filter(Boolean).join(`
4
4
 
@@ -730,4 +730,4 @@ ${Z.join(`
730
730
  </${Q}>`:"";return{content:K,files:[...O],references:O.map($4),triggerPaths:[...$],contentBytes:Buffer.byteLength(K,"utf8"),provenanceSha256:D0(O.map((q)=>`${q.id}:${q.contentSha256}`).join(`
731
731
  `))}}function TO(O,$){let Q=$,Z=[];for(let J=O.length-1;J>=0;J-=1){let K=O[J];if(!K)continue;let q=Buffer.byteLength(K.content,"utf8");if(q>Q)continue;Z.push(K),Q-=q}return Z.reverse()}class m{projectRoot;catalogSha256;definitions;byId;constructor(O,$=[]){this.projectRoot=O;this.projectRoot=G1(O),this.definitions=Object.freeze([...$].sort(W1).map((Q)=>Object.freeze({...Q}))),this.byId=new Map(this.definitions.map((Q)=>[Q.id,Q])),this.catalogSha256=D0(this.definitions.map((Q)=>`${Q.id}:${Q.contentSha256}`).join(`
732
732
  `))}static empty(O){return new m(O)}list(){return this.definitions.map((O)=>({id:O.id,relativePath:O.relativePath,source:O.source,kind:O.kind,conditional:O.conditional,contentSha256:O.contentSha256}))}snapshot(){return new m(this.projectRoot,this.definitions.map((O)=>({...O,patterns:O.patterns?[...O.patterns]:void 0})))}staticRules(O,$=l$){if(this.definitions.length===0)return q0([],[],"project-instructions");let Q=this.relativeSourcePath(O),Z=this.definitions.filter((J)=>!J.conditional&&L1(J.scopeDirectory,Q));return q0(TO(Z,$),[],"project-instructions")}contextualRules(O,$,Q,Z=s$){if(this.definitions.length===0)return q0([],[],"contextual-project-instructions");let J=this.relativeSourcePath(O),K=[...new Set($.map((G)=>Y1(z.relative(this.projectRoot,G1(G)))).filter(X1))].sort(),q=new Map;for(let G of K)for(let Y of this.definitions){if(Q.has(Y.id))continue;if(!L1(Y.scopeDirectory,G))continue;if(Y.conditional){let X=z.posix.relative(Y.scopeDirectory||".",G);if(!Y.patterns?.some((U)=>_O(U,{dot:!0})(X)))continue}else if(L1(Y.scopeDirectory,J))continue;q.set(Y.id,Y)}let W=TO([...q.values()].sort(W1),Z);return q0(W,K,"contextual-project-instructions")}hydrate(O){let $=O.map((Q)=>{let Z=this.byId.get(Q.id);if(!Z||Z.contentSha256!==Q.contentSha256||Z.relativePath!==Q.relativePath||Z.source!==Q.source)throw Error(`Project rule provenance mismatch: ${Q.relativePath}`);return Z});return q0([...new Map($.map((Q)=>[Q.id,Q])).values()].sort(W1),[],"contextual-project-instructions")}relativeSourcePath(O){let $=Y1(z.relative(this.projectRoot,G1(O)));if($&&!X1($))throw Error("Project instruction source is outside the catalog root");return $}}async function Q4(O,$){let Q=await d.lstat($);if(!Q.isFile()||Q.isSymbolicLink())throw Error("Project rule must be a regular file");if(Q.size>IO)throw Error(`Project rule exceeds ${IO} bytes`);let Z=await d.realpath($),J=Y1(z.relative(O,Z));if(!X1(J))throw Error("Project rule escapes its repository root");let K=await d.readFile(Z,"utf8");if(wO(K))throw Error("Project rule contains hidden control characters");let q=c$(K),W=q.content.trim();if(!W)throw Error("Project rule content must not be empty");let G=e$(q.data.paths),Y=O4(J),X=D0(JSON.stringify({relativePath:J,patterns:G??[],content:W}));return{id:`${Y.source}:${D0(J).slice(0,20)}`,relativePath:J,source:Y.source,kind:Y.kind,scopeDirectory:Y.scopeDirectory,priority:Y.priority,conditional:Boolean(G),...G?{patterns:G}:{},content:W,contentSha256:X}}async function DO(O,$){let Q=r$(O);if(!$.projectTrusted)return m.empty(Q);let Z=await d.realpath(Q),J=u$.stream([...a$],{cwd:Z,absolute:!0,dot:!0,deep:n$,onlyFiles:!0,followSymbolicLinks:!1,unique:!0,ignore:[...t$]}),K=[];for await(let Y of J)if(K.push(Y.toString()),K.length>MO)throw Error(`Project rule catalog exceeds ${MO} files`);K.sort();let q=new Set(K.filter((Y)=>z.basename(Y)==="AGENTS.override.md").map((Y)=>z.dirname(Y))),W=[],G=0;for(let Y of K){if(z.basename(Y)==="AGENTS.md"&&q.has(z.dirname(Y)))continue;try{let X=await Q4(Z,Y);if(G+=Buffer.byteLength(X.content,"utf8"),G>bO)throw Error(`Project rule catalog exceeds ${bO} bytes`);W.push(X)}catch(X){o$.warn(`[ProjectRules] Ignoring rule: ${X instanceof Error?X.message:String(X)}`)}}return new m(Z,W)}var CO=32,C0=64;class NO extends Error{capacity=C0;constructor(){super(`Workspace agent resource capacity is full (${C0})`);this.name="WorkspaceAgentResourceCapacityError"}}var T=new Map,H1=0,EO=[];async function Z4(O){let $=await N.getInstance().getStatus(O.workspaceRoot);O.communicationStyles=await K1(O.workspaceRoot,{projectTrusted:$.state==="trusted",plugins:O.plugins.getActive()})}function J4(O){let $={...O};for(let Q of Object.values(A0))$[Q]=(O[Q]??[]).map((Z)=>({...Z,matcher:Z.matcher?{...Z.matcher}:void 0,hooks:Z.hooks.map((J)=>({...J}))}));return $}function K5(O){EO=[...new Set(O.map(($)=>N0.resolve($)))]}function vO(O,$){HO(O,$.plugins),w.releaseInstance(O,$.subagents),h.releaseInstance({cwd:O},$.skills),x.releaseInstance(O,$.commands),C.releaseInstance(O,$.plugins)}function RO(O){vO(O.workspaceRoot,O)}function K0(){while(T.size>CO){let O=!1;for(let[$,Q]of T){if(!Q.resources||Q.users>0)continue;if(T.get($)!==Q)continue;T.delete($),RO(Q.resources),O=!0;break}if(!O)return}}function q4(O){setImmediate(()=>{O.users=Math.max(0,O.users-1),K0()}).unref?.()}async function K4(O,$){let Q=await N.getInstance().getStatus(O),Z=o(O),J=g({cwd:O}),K=x.getInstance(O),q=Q0(O);try{if(Z.getAllNames().length===0)Z.loadFromStandardLocations(Q.state==="trusted");await Promise.all([J.initialize(),K.isInitialized()?void 0:K.initialize(O),q.isInitialized()?void 0:q.initialize(O,[...$.cliPluginDirs??EO])]),x0(O),await J1(O);let W=await K1(O,{projectTrusted:Q.state==="trusted",plugins:q.getActive()}),G=await DO(O,{projectTrusted:Q.state==="trusted"});return{workspaceRoot:O,subagents:Z,skills:J,commands:K,plugins:q,communicationStyles:W,projectRules:G}}catch(W){throw vO(O,{subagents:Z,skills:J,commands:K,plugins:q}),W}}function G4(O,$){let Q={generation:H1,users:0};return Q.promise=K4(O,$).then((Z)=>{if(Q.generation!==H1||T.get(O)!==Q)return RO(Z),Z;return Q.resources=Z,K0(),Z},(Z)=>{if(T.get(O)===Q)T.delete(O);throw Z}),T.set(O,Q),Q}async function yO(O,$){let Q=N0.resolve(O),Z=T.get(Q);if(!Z){if(K0(),T.size>=C0)throw new NO;Z=G4(Q,$)}else T.delete(Q),T.set(Q,Z);Z.users++;let J;try{J=await Z.promise}catch(K){throw Z.users=Math.max(0,Z.users-1),K0(),K}return{entry:Z,resources:J}}async function fO(O,$){if(!$)return;x0(O.workspaceRoot),await J1(O.workspaceRoot),await Z4(O)}async function G5(O,$={}){let Q=await yO(O,$);try{return await fO(Q.resources,$.reconcilePlugins),Q.resources}finally{q4(Q.entry)}}async function L5(O,$,Q={}){let Z=await yO(O,Q);try{return await fO(Z.resources,Q.reconcilePlugins),await $(Z.resources)}finally{Z.entry.users=Math.max(0,Z.entry.users-1),K0()}}function W5(){let O=0,$=0;for(let Q of T.values()){if(Q.resources)O++;$+=Q.users}return{capacity:CO,activeCapacity:C0,entries:T.size,initialized:O,inFlight:T.size-O,activeUsers:$}}function Y5(O){let $="projectRoot"in O?O.projectRoot:O.workspaceRoot;return{projectRoot:N0.resolve($),subagents:O.subagents.snapshot(),skills:O.skills.snapshot(),commands:O.commands.snapshot(),communicationStyles:O.communicationStyles?.snapshot()??F1.snapshot(),projectRules:O.projectRules?.snapshot()??m.empty($),hooks:J4("hooks"in O&&O.hooks?O.hooks:J0.getInstance().getConfig($))}}function X5(O){let $=N0.resolve(O);return{projectRoot:$,subagents:new w,skills:new h,commands:x.empty($),hooks:{enabled:!1},communicationStyles:F1.snapshot(),projectRules:m.empty($)}}function H5(){H1++;for(let[O,$]of T)if($.resources)x0(O);T.clear(),w.resetInstances(),h.resetInstance(),x.resetInstance(),C.resetInstance()}
733
- export{X4 as vg,H4 as wg,F4 as xg,I1 as yg,S4 as zg,z4 as Ag,o as Bg,f4 as Cg,D1 as Dg,g as Eg,x as Fg,e0 as Gg,I0 as Hg,C as Ig,Q0 as Jg,J1 as Kg,x0 as Lg,m as Mg,CO as Ng,C0 as Og,NO as Pg,Z4 as Qg,K5 as Rg,G5 as Sg,L5 as Tg,W5 as Ug,Y5 as Vg,X5 as Wg,H5 as Xg};
733
+ export{X4 as yg,H4 as zg,F4 as Ag,I1 as Bg,S4 as Cg,z4 as Dg,o as Eg,f4 as Fg,D1 as Gg,g as Hg,x as Ig,e0 as Jg,I0 as Kg,C as Lg,Q0 as Mg,J1 as Ng,x0 as Og,m as Pg,CO as Qg,C0 as Rg,NO as Sg,Z4 as Tg,K5 as Ug,G5 as Vg,L5 as Wg,W5 as Xg,Y5 as Yg,X5 as Zg,H5 as _g};
@@ -1,4 +1,4 @@
1
- import{Ba as L,za as F}from"./chunk-y66f1t18.js";import{Td as $,Vd as B,be as Q}from"./chunk-nqts5by0.js";import{Sg as y}from"./chunk-nnas8tdt.js";import{Vi as V}from"./chunk-dv2m2xe5.js";async function j(){await y(V())}async function I(b){let q=b.message||b._?.[0];if(typeof q==="string"&&q.trim())return q;let z=b.stdin??process.stdin;if(!z.isTTY){let G=[];for await(let K of z)G.push(K);return Buffer.concat(G).toString("utf-8").trim()}if(b.defaultMessage!==void 0)return b.defaultMessage;throw Error("No input provided")}async function M(b){let q=b.message||b._?.[0];if(typeof q==="string"&&q.trim())return q;let z=b.stdin??process.stdin;if(z.isTTY)return;let G=[];for await(let Z of z)G.push(Buffer.isBuffer(Z)?Z:Buffer.from(Z));return Buffer.concat(G).toString("utf-8").trim()||void 0}async function R(b){if(!F(b))return{mode:"agent",content:b};let q=await L(b,{cwd:V(),surface:"headless",workspaceRoot:V()});if(!q.success)return{mode:"output",content:`Error: ${q.error||"未知错误"}`,exitCode:1};let z=q.data;if(z?.action==="invoke_skill"){let{skillName:G,skillArgs:K}=z;return{mode:"agent",content:K?`Please use the "${G}" skill to help me with: ${K}`:`Please use the "${G}" skill.`}}if(z?.action==="invoke_custom_command"||z?.action==="invoke_plugin_command"){let G=z.processedContent;return{mode:"agent",content:`# Custom Command: /${z.commandName}
1
+ import{Ba as L,za as F}from"./chunk-ppmy3n74.js";import{Wd as $,Yd as B,ee as Q}from"./chunk-n6tvswa8.js";import{Vg as y}from"./chunk-xagh2qb6.js";import{Yi as V}from"./chunk-g38d2ezm.js";async function j(){await y(V())}async function I(b){let q=b.message||b._?.[0];if(typeof q==="string"&&q.trim())return q;let z=b.stdin??process.stdin;if(!z.isTTY){let G=[];for await(let K of z)G.push(K);return Buffer.concat(G).toString("utf-8").trim()}if(b.defaultMessage!==void 0)return b.defaultMessage;throw Error("No input provided")}async function M(b){let q=b.message||b._?.[0];if(typeof q==="string"&&q.trim())return q;let z=b.stdin??process.stdin;if(z.isTTY)return;let G=[];for await(let Z of z)G.push(Buffer.isBuffer(Z)?Z:Buffer.from(Z));return Buffer.concat(G).toString("utf-8").trim()||void 0}async function R(b){if(!F(b))return{mode:"agent",content:b};let q=await L(b,{cwd:V(),surface:"headless",workspaceRoot:V()});if(!q.success)return{mode:"output",content:`Error: ${q.error||"未知错误"}`,exitCode:1};let z=q.data;if(z?.action==="invoke_skill"){let{skillName:G,skillArgs:K}=z;return{mode:"agent",content:K?`Please use the "${G}" skill to help me with: ${K}`:`Please use the "${G}" skill.`}}if(z?.action==="invoke_custom_command"||z?.action==="invoke_plugin_command"){let G=z.processedContent;return{mode:"agent",content:`# Custom Command: /${z.commandName}
2
2
 
3
3
  ${G}`}}return{mode:"output",content:q.content||q.message||"",exitCode:0}}import{readFile as D,stat as H}from"node:fs/promises";import J from"node:path";function x(b,q){let z;try{z=JSON.parse(b)}catch(G){throw Error(`Invalid JSON output schema from ${q}`,{cause:G})}return B(z).schema}async function _(b){if(b.jsonSchema!==void 0&&b.outputSchema!==void 0)throw Error("--json-schema cannot be combined with --output-schema");if(b.jsonSchema!==void 0)return x(b.jsonSchema,"--json-schema");if(b.outputSchema===void 0)return;let q=J.resolve(b.outputSchema),z=await H(q);if(!z.isFile())throw Error(`Output schema path is not a regular file: ${q}`);if(z.size>$)throw Error(`Output schema exceeds ${$} bytes: ${q}`);return x(await D(q,"utf8"),q)}function N(b){if(!(b instanceof Error))return!1;return b.message.includes("未找到会话")||b.message.includes("ENOENT")||b.message.includes("no such file")}async function W(b){try{return await Q.loadSessionModelContext(b,V())}catch(q){if(N(q))return null;throw q}}async function C(b){if(b.resume===!0||b.resume==="true")throw Error("--resume without a session ID is only supported in interactive UI mode");if(typeof b.resume==="string"&&b.resume.length>0){if(b.forkSession){let G=V(),K=await Q.forkSession(b.resume,{newSessionId:b.sessionId,sourceProjectPath:G,targetProjectPath:G});return{...K,messages:await Q.loadSessionModelContext(K.sessionId,G)}}let[q,z]=await Promise.all([Q.loadSessionModelContext(b.resume),Q.findSessionMetadata(b.resume)]);return{sessionId:b.resume,messages:q,metadata:z}}if(b.continue){let q=b.forkSession?await Q.listSessions({cwd:V()}):await Q.listSessions();if(q.length>0){let z=q[0].sessionId;if(b.forkSession){let G=V(),K=await Q.forkSession(z,{newSessionId:b.sessionId,sourceProjectPath:G,targetProjectPath:G});return{...K,messages:await Q.loadSessionModelContext(K.sessionId,G)}}return{sessionId:z,messages:await Q.loadSessionModelContext(z),metadata:q[0]}}if(b.forkSession)throw Error("Cannot fork: no sessions are available to continue")}if(b.sessionId){let q=await W(b.sessionId);return{sessionId:b.sessionId,messages:q??[],...q?{metadata:await Q.findSessionMetadata(b.sessionId,V())}:{}}}return{sessionId:`${b.fallbackSessionPrefix}-${Date.now()}`,messages:[]}}
4
4
  export{j as p,I as q,M as r,R as s,_ as t,C as u};
@@ -1,2 +1,2 @@
1
- import{Aj as k,Cj as w,zj as b}from"./chunk-ft1bdqbs.js";function g(j){return b.Object(j,{additionalProperties:!1})}var W=b.String({pattern:"^acp-remote-workspace:[A-Za-z0-9_-]{43}$"}),I=b.Optional(b.Integer({minimum:1,maximum:100})),x=b.String({minLength:1,maxLength:200,pattern:"^[A-Za-z0-9_-][A-Za-z0-9._-]{0,199}$"}),A=k(b.Union([g({version:b.Literal(2),sessionId:x,workspace:g({kind:b.Literal("local"),projectPath:b.String({minLength:1})})}),g({version:b.Literal(2),sessionId:x,workspace:g({kind:b.Literal("acp-remote"),workspaceRef:W})})])),C=k(w(["history-only","owner-offline","owner-mismatch","archived","surface-not-supported","capability-not-advertised"])),X=k(g({connection:w(["local","online","offline"]),history:g({read:b.Boolean(),fork:b.Boolean()}),turn:g({start:b.Boolean(),reason:b.Optional(C)}),files:g({readText:b.Boolean(),writeText:b.Boolean(),browse:w(["none","known-files","tree"]),reason:b.Optional(C)}),terminal:g({mode:w(["none","command","interactive"]),owner:w(["none","local","acp-remote"]),reason:b.Optional(C)})})),Y=k(g({id:b.String({pattern:"^surface-message:[0-9]+:.+$"}),role:w(["user","assistant"]),content:b.String(),timestamp:b.String({minLength:1}),truncated:b.Optional(b.Boolean())})),Z=w(["queued","running","completed","failed","cancelled","interrupted"]),_=w(["posix","win32"]),$=w(["subagent","fork"]),D=b.String({minLength:1}),J=b.String({minLength:1}),z=40,H=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?(Z|[+-](\d{2}):(\d{2}))$/,M="^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}Z$";function T(j){return j%4===0&&(j%100!==0||j%400===0)}function R(j,q){if(q===2)return T(j)?29:28;return[4,6,9,11].includes(q)?30:31}function d(j){if(j===void 0||j.length<20||j.length>z)return;let q=H.exec(j);if(!q)return;let L=Number(q[1]),B=Number(q[2]),E=Number(q[3]),N=Number(q[4]),O=Number(q[5]),P=Number(q[6]),Q=q[8],U=Number(q[9]),V=Number(q[10]);if(B<1||B>12||E<1||E>R(L,B)||N>23||O>59||P>59||Q!=="Z"&&(U>23||V>59))return;let F=Date.parse(j);if(!Number.isFinite(F))return;let G=new Date(F).toISOString();return G.length===24?G:void 0}var S=b.Refine(b.String({minLength:24,maxLength:24,pattern:M}),(j)=>d(j)===j,()=>"must be a canonical ISO instant"),K=k(g({locator:A,displayCwd:b.String({minLength:1}),pathStyle:b.Optional(_),title:b.Optional(b.String()),rootId:x,parentId:b.Optional(x),relationType:b.Optional($),taskStatus:Z,taskCompletedAt:b.Optional(S),messageCount:b.Integer({minimum:0}),firstMessageTime:b.String({minLength:1}),lastMessageTime:b.String({minLength:1}),hasErrors:b.Boolean(),archivedAt:b.Optional(b.String({minLength:1})),selectedModelId:b.Optional(b.String({minLength:1})),capabilities:X})),p=k(w(["invalid_session_surface_request","invalid_session_locator","session_surface_not_found","workspace_binding_mismatch","session_surface_cursor_invalid","session_surface_snapshot_changed","session_surface_read_only","session_surface_capability_unavailable","session_surface_capacity","session_surface_unavailable","session_surface_state_invalid"])),i=k(g({error:g({code:p,message:b.String({minLength:1}),retryable:b.Boolean()})})),s=k(g({sessions:b.Array(K),nextCursor:b.Optional(D)})),f=k(g({messages:b.Array(Y),olderCursor:b.Optional(D),snapshot:J,truncated:b.Boolean()})),v=k(g({locator:A,limit:I})),l=k(g({session:K,history:f})),r=k(g({locator:A,cursor:D,expectedSnapshot:J,limit:I})),n=k(g({locator:A}));
2
- export{A as af,Y as bf,d as cf,K as df,i as ef,s as ff,f as gf,v as hf,l as if,r as jf,n as kf};
1
+ import{Cj as b,Dj as k,Fj as w}from"./chunk-pg7cgvs8.js";function g(j){return b.Object(j,{additionalProperties:!1})}var W=b.String({pattern:"^acp-remote-workspace:[A-Za-z0-9_-]{43}$"}),I=b.Optional(b.Integer({minimum:1,maximum:100})),x=b.String({minLength:1,maxLength:200,pattern:"^[A-Za-z0-9_-][A-Za-z0-9._-]{0,199}$"}),A=k(b.Union([g({version:b.Literal(2),sessionId:x,workspace:g({kind:b.Literal("local"),projectPath:b.String({minLength:1})})}),g({version:b.Literal(2),sessionId:x,workspace:g({kind:b.Literal("acp-remote"),workspaceRef:W})})])),C=k(w(["history-only","owner-offline","owner-mismatch","archived","surface-not-supported","capability-not-advertised"])),X=k(g({connection:w(["local","online","offline"]),history:g({read:b.Boolean(),fork:b.Boolean()}),turn:g({start:b.Boolean(),reason:b.Optional(C)}),files:g({readText:b.Boolean(),writeText:b.Boolean(),browse:w(["none","known-files","tree"]),reason:b.Optional(C)}),terminal:g({mode:w(["none","command","interactive"]),owner:w(["none","local","acp-remote"]),reason:b.Optional(C)})})),Y=k(g({id:b.String({pattern:"^surface-message:[0-9]+:.+$"}),role:w(["user","assistant"]),content:b.String(),timestamp:b.String({minLength:1}),truncated:b.Optional(b.Boolean())})),Z=w(["queued","running","completed","failed","cancelled","interrupted"]),_=w(["posix","win32"]),$=w(["subagent","fork"]),D=b.String({minLength:1}),J=b.String({minLength:1}),z=40,H=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?(Z|[+-](\d{2}):(\d{2}))$/,M="^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}Z$";function T(j){return j%4===0&&(j%100!==0||j%400===0)}function R(j,q){if(q===2)return T(j)?29:28;return[4,6,9,11].includes(q)?30:31}function d(j){if(j===void 0||j.length<20||j.length>z)return;let q=H.exec(j);if(!q)return;let L=Number(q[1]),B=Number(q[2]),E=Number(q[3]),N=Number(q[4]),O=Number(q[5]),P=Number(q[6]),Q=q[8],U=Number(q[9]),V=Number(q[10]);if(B<1||B>12||E<1||E>R(L,B)||N>23||O>59||P>59||Q!=="Z"&&(U>23||V>59))return;let F=Date.parse(j);if(!Number.isFinite(F))return;let G=new Date(F).toISOString();return G.length===24?G:void 0}var S=b.Refine(b.String({minLength:24,maxLength:24,pattern:M}),(j)=>d(j)===j,()=>"must be a canonical ISO instant"),K=k(g({locator:A,displayCwd:b.String({minLength:1}),pathStyle:b.Optional(_),title:b.Optional(b.String()),rootId:x,parentId:b.Optional(x),relationType:b.Optional($),taskStatus:Z,taskCompletedAt:b.Optional(S),messageCount:b.Integer({minimum:0}),firstMessageTime:b.String({minLength:1}),lastMessageTime:b.String({minLength:1}),hasErrors:b.Boolean(),archivedAt:b.Optional(b.String({minLength:1})),selectedModelId:b.Optional(b.String({minLength:1})),capabilities:X})),p=k(w(["invalid_session_surface_request","invalid_session_locator","session_surface_not_found","workspace_binding_mismatch","session_surface_cursor_invalid","session_surface_snapshot_changed","session_surface_read_only","session_surface_capability_unavailable","session_surface_capacity","session_surface_unavailable","session_surface_state_invalid"])),i=k(g({error:g({code:p,message:b.String({minLength:1}),retryable:b.Boolean()})})),s=k(g({sessions:b.Array(K),nextCursor:b.Optional(D)})),f=k(g({messages:b.Array(Y),olderCursor:b.Optional(D),snapshot:J,truncated:b.Boolean()})),v=k(g({locator:A,limit:I})),l=k(g({session:K,history:f})),r=k(g({locator:A,cursor:D,expectedSnapshot:J,limit:I})),n=k(g({locator:A}));
2
+ export{A as df,Y as ef,d as ff,K as gf,i as hf,s as if,f as jf,v as kf,l as lf,r as mf,n as nf};
@@ -0,0 +1,2 @@
1
+ var _=20,E=5242880,T=32768,A=1e6,S=4194304;
2
+ export{_ as Qi,E as Ri,T as Si,A as Ti,S as Ui};
@@ -0,0 +1,63 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownRenderer-DHa0FqU0.js","assets/index-hZ37pkxs.js","assets/vendor-react-DofNRwfy.js","assets/vendor-radix-D6QrtXqd.js","assets/session-events-FPOvcMBw.js","assets/index-DC2p1vGD.css","assets/copy-Bd5v-KkM.js"])))=>i.map(i=>d[i]);
2
+ import{r as h,j as e}from"./vendor-react-DofNRwfy.js";import{c as J,u as _,a as f,s as Qe,b as mt,d as ce,H as Ie,P as ht,G as ze,L as $,S as qe,T as re,C as fe,D as Ge,e as We,f as xt,g as Je,h as Ye,i as Xe,j as I,k as pt,l as te,B as ft,m as we,n as de,R as he,F as bt,_ as Ze,o as vt,p as et,q as gt,r as tt,t as kt,X as st,v as yt,A as Te,w as jt,x as wt,W as Nt,y as St,z as Ct}from"./index-hZ37pkxs.js";import{_ as Ee,M as ne,Z as O,a2 as Tt,A as Et,a3 as Mt,Q as At,X as Rt,Y as Dt}from"./session-events-FPOvcMBw.js";import{A as Ft,E as It}from"./external-link-B33h3DQN.js";import{S as $t}from"./ScrollArea-C6yf2fqq.js";import{C as at}from"./copy-Bd5v-KkM.js";import{C as ie}from"./chevron-right-8qYRfCj4.js";import{A as Me,a as _t,C as Bt}from"./chevrons-up-down-BXNG4GvK.js";import{f as Pt,g as Lt,h as Ut,i as rt}from"./vendor-radix-D6QrtXqd.js";import{P as Ot}from"./pause-nnvVbgsj.js";import{P as Kt}from"./play-BilJ7SDs.js";import{P as nt}from"./pencil-_yfoOmUq.js";import{C as Vt}from"./clock-3-DEL1ixyh.js";import{t as L,A as $e}from"./team-Bb04o2Tb.js";import{teamService as _e}from"./teamService-B5w9cpsa.js";/**
3
+ * @license lucide-react v0.300.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const Ht=J("Files",[["path",{d:"M15.5 2H8.6c-.4 0-.8.2-1.1.5-.3.3-.5.7-.5 1.1v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8c.4 0 .8-.2 1.1-.5.3-.3.5-.7.5-1.1V6.5L15.5 2z",key:"cennsq"}],["path",{d:"M3 7.6v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8",key:"ms809a"}],["path",{d:"M15 2v5h5",key:"qq6kwv"}]]);/**
8
+ * @license lucide-react v0.300.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const Qt=J("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
13
+ * @license lucide-react v0.300.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const zt=J("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
18
+ * @license lucide-react v0.300.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const qt=J("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
23
+ * @license lucide-react v0.300.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const Gt=J("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/**
28
+ * @license lucide-react v0.300.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const Wt=J("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
33
+ * @license lucide-react v0.300.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const Jt=J("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
38
+ * @license lucide-react v0.300.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const Yt=J("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
43
+ * @license lucide-react v0.300.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const Xt=J("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);function Be(t){return t.split("/").filter(Boolean).at(-1)||t}function Zt(){const t=_(),s=f(j=>j.sessions),a=f(j=>j.currentSessionRef),r=f(j=>j.historySurfaceSelection),o=f(j=>j.taskDeliveryActions),i=f(j=>j.deliverTask),l=Ee(j=>j.openFilePreview),[u,x]=h.useState(!1),c=s.find(j=>Qe({sessionId:j.sessionId,projectPath:j.projectPath},a));if(ne(r)||!(c!=null&&c.taskIsolation))return null;const v=c.taskDiffStat,b=c.taskIsolation==="worktree",d=mt(c),y=o[ce(d)],p=c.taskDelivery,N=(p==null?void 0:p.status)==="conflicted",m=!!(v&&(v.changedFiles>0||v.commits>0)),S=!["queued","running"].includes(c.taskStatus),g=(p==null?void 0:p.status)==="applied"||(p==null?void 0:p.status)==="discarded",w=b&&m&&S&&!g,n=v?v.additions+v.deletions:0,M=n>0&&v?v.additions/n*100:0,F=j=>{O(f.getState())||i(d,j).catch(()=>{})},D=()=>{O(f.getState())||l({tab:"diff"})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex min-h-10 flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]/60 px-3 py-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))] backdrop-blur-sm sm:px-5",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[e.jsx(Ie,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"truncate text-[hsl(var(--deck-ink))]",children:Be(c.taskSourceProjectPath||c.projectPath)})]}),e.jsx("span",{className:"text-[hsl(var(--deck-ink-faint))]/60",children:"/"}),e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[b?e.jsx(ht,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-accent))]"}):e.jsx(Ie,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:b?"text-[hsl(var(--deck-accent))]":void 0,children:t(b?"artifact.env.isolated":"artifact.env.local")})]}),c.taskWorktreeBranch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[hsl(var(--deck-ink-faint))]/60",children:"/"}),e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 truncate",title:c.taskWorktreeBranch,children:[e.jsx(ze,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"truncate",children:c.taskWorktreeBranch})]})]})]}),v&&e.jsxs("div",{className:"ml-auto flex max-w-full items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(Ht,{className:"h-3 w-3 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"tabular-nums",children:v.changedFiles})]}),n>0&&e.jsxs("span",{className:"relative hidden h-1.5 w-14 overflow-hidden rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] sm:inline-flex","aria-hidden":"true",children:[e.jsx("span",{className:"h-full bg-[hsl(var(--deck-accent))]",style:{width:`${M}%`}}),e.jsx("span",{className:"h-full bg-red-500/80",style:{width:`${100-M}%`}})]}),e.jsxs("span",{className:"tabular-nums text-[hsl(var(--deck-accent))]",children:["+",v.additions]}),e.jsxs("span",{className:"tabular-nums text-red-600 dark:text-red-400",children:["-",v.deletions]}),v.commits>0&&e.jsx("span",{className:"hidden tabular-nums text-[hsl(var(--deck-ink-faint))] sm:inline",children:t("artifact.commits",{count:v.commits})}),m&&(p==null?void 0:p.status)!=="discarded"&&e.jsx("button",{type:"button",onClick:D,className:"inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-1 text-[hsl(var(--deck-ink))] transition hover:border-[hsl(var(--deck-accent)/0.55)] hover:text-[hsl(var(--deck-accent))]",children:t("artifact.review")}),w&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",disabled:!!y,onClick:()=>F("apply"),className:"inline-flex items-center gap-1 rounded-md bg-[hsl(var(--deck-accent))] px-2 py-1 font-semibold text-white transition hover:brightness-95 disabled:cursor-wait disabled:opacity-65",children:[y==="apply"?e.jsx($,{className:"h-3 w-3 animate-spin"}):e.jsx(qe,{className:"h-3 w-3"}),t(y==="apply"?"artifact.applying":N?"artifact.retryApply":"artifact.apply")]}),e.jsx("button",{type:"button",disabled:!!y,onClick:()=>x(!0),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[hsl(var(--deck-ink-faint))] transition hover:bg-red-500/10 hover:text-red-600 disabled:cursor-wait disabled:opacity-50 dark:hover:text-red-400","aria-label":t("artifact.discard"),title:t("artifact.discard"),children:y==="discard"?e.jsx($,{className:"h-3 w-3 animate-spin"}):e.jsx(re,{className:"h-3 w-3"})})]}),(p==null?void 0:p.status)==="applied"&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-emerald-500/10 px-2 py-1 font-semibold text-emerald-700 dark:text-emerald-300",children:[e.jsx(fe,{className:"h-3 w-3"}),t("artifact.applied")]}),(p==null?void 0:p.status)==="discarded"&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-[hsl(var(--deck-surface-2))] px-2 py-1 text-[hsl(var(--deck-ink-faint))]",children:[e.jsx(re,{className:"h-3 w-3"}),t("artifact.discarded")]})]}),(p==null?void 0:p.status)==="conflicted"&&e.jsxs("div",{className:"flex w-full items-start gap-1.5 border-t border-amber-500/20 pt-1.5 text-amber-700 dark:text-amber-300",role:"alert",children:[e.jsx(Ft,{className:"mt-0.5 h-3 w-3 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 space-y-0.5",children:[e.jsx("span",{className:"block",children:p.message||t("artifact.conflict")}),e.jsx("span",{className:"block text-[hsl(var(--deck-ink-faint))]",children:t("artifact.conflictHint")})]})]})]}),e.jsx(Ge,{open:u,onOpenChange:x,children:e.jsxs(We,{className:"w-[calc(100%_-_2rem)] max-w-md border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink))]",children:[e.jsxs(xt,{children:[e.jsx(Je,{children:t("artifact.discardDialog.title")}),e.jsx(Ye,{className:"text-[hsl(var(--deck-ink-muted))]",children:t("artifact.discardDialog.description",{project:Be(c.taskSourceProjectPath||c.projectPath),count:(v==null?void 0:v.changedFiles)??0})})]}),e.jsx("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-2 text-xs leading-relaxed text-red-700 dark:text-red-300",children:t("artifact.discardDialog.warning")}),e.jsxs(Xe,{className:"gap-2 sm:space-x-0",children:[e.jsx("button",{type:"button",onClick:()=>x(!1),className:"rounded-md border border-[hsl(var(--deck-border))] px-3 py-2 text-sm hover:bg-[hsl(var(--deck-surface-2))]",children:t("artifact.discardDialog.cancel")}),e.jsxs("button",{type:"button",onClick:()=>{x(!1),F("discard")},className:"inline-flex items-center justify-center gap-1.5 rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white hover:bg-red-700",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),t("artifact.discardDialog.confirm")]})]})]})})]})}const es=new Set(["completed","stale","failed","aborted","interrupted"]),ts={completed:"chat.review.status.completed",stale:"chat.review.status.stale",failed:"chat.review.status.failed",aborted:"chat.review.status.aborted",interrupted:"chat.review.status.interrupted"},ss={completed:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300 border-emerald-500/20",stale:"bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-500/20",failed:"bg-red-500/10 text-red-700 dark:text-red-300 border-red-500/20",aborted:"bg-zinc-500/10 text-zinc-700 dark:text-zinc-300 border-zinc-500/20",interrupted:"bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-500/20"};function xe(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}function as(t){const s=xe(t),a=xe(s==null?void 0:s.codeLocation),r=s==null?void 0:s.priority,o=s==null?void 0:s.confidenceScore,i=a==null?void 0:a.lineStart,l=a==null?void 0:a.lineEnd;if(!(typeof(s==null?void 0:s.title)!="string"||typeof s.body!="string"||r!==0&&r!==1&&r!==2&&r!==3||typeof o!="number"||!Number.isFinite(o)||typeof(a==null?void 0:a.path)!="string"||!Number.isInteger(i)||!Number.isInteger(l)))return{title:s.title,body:s.body,priority:r,confidenceScore:o,codeLocation:{path:a.path,lineStart:i,lineEnd:l}}}function rs(t){const s=xe(t),a=xe(s==null?void 0:s.target);if((s==null?void 0:s.phase)!=="completed"||typeof s.status!="string"||!es.has(s.status)||typeof(a==null?void 0:a.label)!="string"||a.kind!=="uncommitted"&&a.kind!=="base"&&a.kind!=="commit"||typeof s.overallExplanation!="string"||!Array.isArray(s.findings))return;const r=s.findings.map(as);if(!r.some(o=>o===void 0))return{status:s.status,target:{kind:a.kind,label:a.label,...typeof a.reference=="string"?{reference:a.reference}:{}},overallExplanation:s.overallExplanation,findings:r,...typeof s.error=="string"?{error:s.error}:{}}}function ns(t){const{path:s,lineStart:a,lineEnd:r}=t.codeLocation;return a===r?`${s}:L${a}`:`${s}:L${a}-${r}`}function is({report:t}){const s=_(),a=t.target.kind==="uncommitted"?s("chat.review.target.uncommitted"):t.target.kind==="base"?s("chat.review.target.base",{ref:t.target.reference??t.target.label}):s("chat.review.target.commit",{ref:t.target.reference??t.target.label});return e.jsxs("section",{"data-code-review-report":!0,className:"overflow-hidden rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/60 px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-[hsl(var(--deck-ink))]",children:s("chat.review.title")}),e.jsxs("p",{className:"mt-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[s("chat.review.target"),": ",a]})]}),e.jsxs("span",{className:I("rounded-full border px-2.5 py-1 font-mono text-[10.5px] font-medium",ss[t.status]),children:[s("chat.review.status"),": ",s(ts[t.status])]})]}),e.jsxs("div",{className:"space-y-4 px-4 py-3.5",children:[e.jsx("p",{className:"whitespace-pre-wrap text-[13px] leading-6 text-[hsl(var(--deck-ink-muted))]",children:t.overallExplanation}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("h4",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:s("chat.review.findings")}),e.jsx("span",{className:"font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:t.findings.length})]}),t.findings.length===0?e.jsx("div",{className:"rounded-lg bg-[hsl(var(--deck-surface-2))] px-3 py-2.5 text-[12px] text-[hsl(var(--deck-ink-muted))]",children:s("chat.review.noFindings")}):e.jsx("ol",{className:"space-y-2",children:t.findings.map((r,o)=>e.jsxs("li",{className:"rounded-lg border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-2.5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsx("h5",{className:"text-[12.5px] font-medium leading-5 text-[hsl(var(--deck-ink))]",children:r.title}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:s("chat.review.confidence",{value:r.confidenceScore.toFixed(2)})})]}),e.jsx("code",{className:"mt-1 block text-[10.5px] text-[hsl(var(--deck-accent))]",children:ns(r)}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-[12px] leading-5 text-[hsl(var(--deck-ink-muted))]",children:r.body})]},`${r.codeLocation.path}:${r.codeLocation.lineStart}:${o}`))})]}),t.error&&e.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-2 text-[11px] text-red-700 dark:text-red-300",children:[e.jsxs("span",{className:"font-medium",children:[s("chat.review.error"),":"]})," ",t.error]})]})]})}function os({elicitation:t,messageId:s}){const a=_(),r=f(g=>g.currentSessionRef),o=f(g=>g.setElicitation),[i,l]=h.useState(()=>ls(t.details.fields??[])),[u,x]=h.useState(()=>ds(t.details.fields??[])),[c,v]=h.useState(!1),[b,d]=h.useState(),y=t.details.fields??[],p=h.useMemo(()=>y.every(g=>{var n;if(!g.required)return!0;if(be(g))return!!((n=u[g.name])!=null&&n.trim()||g.defaultValue!==void 0);const w=i[g.name]??g.defaultValue;return Array.isArray(w)?w.length>0:w!==void 0}),[y,u,i]);if(t.status!=="pending")return e.jsx("div",{className:"rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:a(t.status==="cancelled"?"interaction.elicitation.cancelled":"interaction.elicitation.responded")});const N=async(g,w)=>{if(!O(f.getState())&&!(!r||c)){v(!0),d(void 0);try{await te.respondToElicitation(r,t.toolCallId,{action:g,...w?{content:w}:{}}),o(s,{...t,status:"responded"})}catch(n){d(n instanceof Error?n.message:a("interaction.elicitation.failed"))}finally{v(!1)}}},m=async()=>{try{await N("accept",us(y,i,u))}catch(g){d(g instanceof Error?g.message:String(g))}},S=()=>{if(O(f.getState()))return;const g=t.details.url;if(!g){d("MCP URL is unavailable");return}if(!window.open(g,"_blank","noopener,noreferrer")){d("The browser blocked the external window");return}N("accept")};return e.jsxs("div",{"data-pending-interaction":"elicitation",tabIndex:-1,role:"alert",className:"space-y-4 rounded-lg border border-amber-300/70 bg-amber-50/70 p-4 outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800/70 dark:bg-amber-950/25",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(pt,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{className:"font-mono text-[12px] font-semibold text-[hsl(var(--deck-ink))]",children:[a("interaction.elicitation.title")," · ",t.details.serverName]}),e.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:t.details.message}),e.jsx("div",{className:"font-mono text-[11px] text-amber-700 dark:text-amber-300",children:a("interaction.elicitation.warning")})]})]}),t.details.mode==="url"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] p-3 font-mono text-[11px]",children:[e.jsx("div",{className:"text-[hsl(var(--deck-ink-muted))]",children:t.details.domain}),e.jsx("div",{className:"mt-1 break-all text-[hsl(var(--deck-ink))]",children:t.details.url})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ae,{onClick:S,disabled:c,primary:!0,label:a("interaction.elicitation.open"),icon:e.jsx(It,{className:"h-3.5 w-3.5"})}),e.jsx(ae,{onClick:()=>void N("decline"),disabled:c,label:a("interaction.elicitation.decline")}),e.jsx(ae,{onClick:()=>void N("cancel"),disabled:c,label:a("interaction.elicitation.cancel")})]})]}):e.jsxs("div",{className:"space-y-4",children:[y.map(g=>e.jsx(cs,{field:g,value:i[g.name],rawValue:u[g.name]??"",onValueChange:w=>l(n=>({...n,[g.name]:w})),onRawChange:w=>x(n=>({...n,[g.name]:w}))},g.name)),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ae,{onClick:()=>void m(),disabled:c||!p,primary:!0,label:a("interaction.elicitation.submit"),icon:c?e.jsx($,{className:"h-3.5 w-3.5 animate-spin"}):null}),e.jsx(ae,{onClick:()=>void N("decline"),disabled:c,label:a("interaction.elicitation.decline")}),e.jsx(ae,{onClick:()=>void N("cancel"),disabled:c,label:a("interaction.elicitation.cancel")})]})]}),b&&e.jsx("div",{className:"rounded-md border border-red-300/70 bg-red-50 px-2.5 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:b})]})}function cs({field:t,value:s,rawValue:a,onValueChange:r,onRawChange:o}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:`mcp-elicitation-${t.name}`,className:"block font-mono text-[12px] font-medium text-[hsl(var(--deck-ink))]",children:[t.title,t.required?" *":""]}),t.description&&e.jsx("div",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:t.description}),t.type==="select"||t.type==="multi-select"||t.type==="boolean"?e.jsx("div",{id:`mcp-elicitation-${t.name}`,className:"flex flex-wrap gap-2",children:ms(t).map(i=>{const l=Array.isArray(s)?s.includes(i.value):s===i.typedValue;return e.jsx("button",{type:"button","aria-pressed":l,onClick:()=>{if(t.type==="multi-select"){const u=Array.isArray(s)?s:[];r(u.includes(i.value)?u.filter(x=>x!==i.value):[...u,i.value])}else r(i.typedValue)},className:I("rounded-md border px-3 py-2 font-mono text-[12px] transition-colors",l?"border-emerald-500 bg-emerald-50 text-emerald-800 dark:bg-emerald-950/40 dark:text-emerald-200":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:i.label},i.value)})}):e.jsx("input",{id:`mcp-elicitation-${t.name}`,type:hs(t),value:a,onChange:i=>o(i.target.value),min:t.minimum,max:t.maximum,minLength:t.minLength,maxLength:t.maxLength,required:t.required,placeholder:t.defaultValue===void 0?t.required?"Required":"Optional":String(t.defaultValue),className:"w-full rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2 font-mono text-[12px] text-[hsl(var(--deck-ink))] outline-none transition-colors focus:border-amber-500 focus:ring-1 focus:ring-amber-500"})]})}function ae({onClick:t,disabled:s,primary:a=!1,label:r,icon:o}){return e.jsxs("button",{type:"button",onClick:t,disabled:s,className:I("inline-flex min-h-8 items-center gap-1.5 rounded-md px-3 py-1.5 font-mono text-[12px] transition-colors disabled:cursor-wait disabled:opacity-50",a?"bg-amber-600 text-white hover:bg-amber-700":"border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:[o,r]})}function ls(t){return Object.fromEntries(t.filter(s=>!be(s)&&s.defaultValue!==void 0).map(s=>[s.name,Array.isArray(s.defaultValue)?[...s.defaultValue]:s.defaultValue]))}function ds(t){return Object.fromEntries(t.filter(s=>be(s)&&s.defaultValue!==void 0).map(s=>[s.name,String(s.defaultValue)]))}function us(t,s,a){var o;const r={};for(const i of t){if(be(i)){const u=((o=a[i.name])==null?void 0:o.trim())??"";if(!u){if(i.defaultValue!==void 0)r[i.name]=i.defaultValue;else if(i.required)throw new Error(`${i.title} is required`);continue}if(i.type==="number"||i.type==="integer"){const x=Number(u);if(!Number.isFinite(x))throw new Error(`${i.title} must be a finite number`);if(i.type==="integer"&&!Number.isSafeInteger(x))throw new Error(`${i.title} must be a safe integer`);r[i.name]=x}else r[i.name]=u;continue}const l=s[i.name]??i.defaultValue;if(l===void 0){if(i.required)throw new Error(`${i.title} is required`);continue}if(Array.isArray(l)){if(i.minItems!==void 0&&l.length<i.minItems)throw new Error(`${i.title} requires at least ${i.minItems} choices`);if(i.maxItems!==void 0&&l.length>i.maxItems)throw new Error(`${i.title} allows at most ${i.maxItems} choices`)}r[i.name]=l}return r}function ms(t){return t.type==="boolean"?[{value:"true",label:"Yes",typedValue:!0},{value:"false",label:"No",typedValue:!1}]:(t.options??[]).map(s=>({...s,typedValue:s.value}))}function be(t){return t.type==="string"||t.type==="number"||t.type==="integer"}function hs(t){return t.type==="number"||t.type==="integer"?"number":t.format==="email"?"email":t.format==="uri"?"url":t.format==="date"?"date":t.format==="date-time"?"datetime-local":"text"}function xs(t){if(!t||typeof t!="object"||Array.isArray(t))return;const s=t;if(!(!s.output||typeof s.output!="object"||Array.isArray(s.output)))return{output:s.output,...typeof s.schemaDigest=="string"?{schemaDigest:s.schemaDigest}:{}}}function ps({report:t}){const s=_(),[a,r]=h.useState(!1),o=JSON.stringify(t.output,null,2),i=async()=>{try{await navigator.clipboard.writeText(o),r(!0),window.setTimeout(()=>r(!1),1400)}catch{}};return e.jsxs("section",{"data-structured-output":!0,className:"overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("header",{className:"flex min-h-9 items-center justify-between gap-3 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(ft,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),e.jsx("span",{className:"font-mono text-[11px] font-semibold text-[hsl(var(--deck-ink))]",children:s("chat.structuredOutput.title")}),t.schemaDigest&&e.jsxs("span",{title:t.schemaDigest,className:"truncate font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:["sha256:",t.schemaDigest.slice(0,10)]})]}),e.jsx("button",{type:"button",onClick:i,"aria-label":s("chat.structuredOutput.copy"),title:s("chat.structuredOutput.copy"),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:a?e.jsx(fe,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-accent))]"}):e.jsx(at,{className:"h-3.5 w-3.5"})})]}),e.jsx("pre",{className:"max-h-[440px] overflow-auto whitespace-pre p-3 font-mono text-[11px] leading-5 text-[hsl(var(--deck-ink))]",children:o})]})}const fs=h.lazy(()=>Ze(()=>import("./MarkdownRenderer-DHa0FqU0.js").then(t=>t.M),__vite__mapDeps([0,1,2,3,4,5,6])).then(t=>({default:t.MarkdownRenderer})));function Pe({text:t,label:s}){const[a,r]=h.useState(!1);if(!t.trim())return null;const o=async()=>{try{await navigator.clipboard.writeText(t),r(!0),window.setTimeout(()=>r(!1),1400)}catch{}};return e.jsx("button",{type:"button","aria-label":s,title:s,onClick:o,className:"flex h-6 w-6 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:a?e.jsx(fe,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-accent))]"}):e.jsx(at,{className:"h-3.5 w-3.5"})})}function bs(){return e.jsx("div",{className:"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_1px_0_hsl(var(--deck-hairline))]",children:e.jsx(we,{size:20,pulse:!1})})}function vs(){return e.jsx("div",{className:"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-full border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas-veil))]",children:e.jsx("span",{className:"font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:"U"})})}function Le(t){let s=t;return s=s.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g,""),s=s.replace(/<file path="[^"]*">[\s\S]*?<\/file>/g,""),s=s.replace(/<attached_files>[\s\S]*?<\/attached_files>/g,""),s=s.trim(),s}function gs(t){if(typeof t=="string")return{text:Le(t),images:[]};const s=t.filter(r=>r.type==="text").map(r=>r.text).join(`
48
+ `),a=t.filter(r=>r.type==="image_url").map(r=>r.image_url.url);return{text:Le(s),images:a}}function Ae(t){return typeof t=="string"?t:t.filter(s=>s.type==="text").map(s=>s.text).join(`
49
+ `)}function ks(t){const s=t.agentContent;return s?Tt(s):Ae(t.content)}function Ue({content:t,syntaxHighlight:s=!0}){return e.jsx(h.Suspense,{fallback:e.jsx("pre",{className:"text-[14px] text-[hsl(var(--deck-ink))] font-mono whitespace-pre-wrap",children:t}),children:e.jsx(fs,{content:t,syntaxHighlight:s})})}function Re({status:t}){if(!t)return null;const s={running:"bg-[#FEF3C7] text-[#92400E] dark:bg-[#F59E0B]/20 dark:text-[#FBBF24]",success:"bg-[#DCFCE7] text-[#15803D] dark:bg-[#22C55E]/20 dark:text-[#22C55E]",error:"bg-[#FEE2E2] text-[#b91c1c] dark:bg-[#EF4444]/20 dark:text-[#fca5a5]",pending:"bg-[#E5E7EB] text-[#6B7280] dark:bg-[#27272a] dark:text-[#a1a1aa]",info:"bg-[#DBEAFE] text-[#1D4ED8] dark:bg-[#3B82F6]/20 dark:text-[#60A5FA]"},a={running:"Running",success:"Success",error:"Error",pending:"Pending",info:"Info"};return e.jsx("span",{className:I("text-[11px] px-2 py-0.5 rounded-full font-mono",s[t]),children:a[t]})}function ys(t){if(!t)return"";if(typeof t=="string")try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return JSON.stringify(t,null,2)}const Oe=500;function it(t,s){if(t.length<=s)return t;let a=Math.max(0,s);return a>0&&/[\uD800-\uDBFF]/.test(t.charAt(a-1))&&(a-=1),t.slice(0,a)}function Ke(t,s){if(t.length<=s)return t;let a=Math.max(0,t.length-s);return/[\uDC00-\uDFFF]/.test(t.charAt(a))&&(a+=1),t.slice(a)}function ge(t,s){if(t.length<=s)return t;if(s<=0)return"";const a=`
50
+ ... (display clipped) ...
51
+ `,r=s-a.length;if(r<=0)return Ke(t,s);const o=Math.floor(r/3);return`${it(t,o)}${a}${Ke(t,r-o)}`}function js(t){const s=t.split(`
52
+ `),a=s.at(-1),r=a!=null&&a.startsWith("Output truncated")?a:void 0,o=r?s.slice(0,-1).join(`
53
+ `):t,i=r?`
54
+ ${r}`:"",l=Math.max(0,Oe-i.length),x=o.indexOf(`
55
+ stderr:
56
+ `);let c;if(x>=0&&o.includes(`
57
+ stdout:
58
+ `)){const v=o.slice(0,x),b=o.slice(x+1),d=Math.max(0,l-1),y=Math.floor(d/2);c=`${ge(v,y)}
59
+ ${ge(b,d-y)}`}else c=ge(o,l);return{body:it(c,l),...r?{notice:r}:{},truncated:!!r||t.length>Oe}}function ws({tool:t}){const[s,a]=h.useState(!1),r=ys(t.arguments),o=t.output?js(t.output):void 0;return e.jsxs("div",{"data-tool-name":t.toolName,"data-tool-status":t.status,"data-tool-truncated":o!=null&&o.truncated?"true":"false",className:"bg-white dark:bg-[#18181b] border border-[hsl(var(--deck-border))] rounded-lg overflow-hidden",children:[e.jsxs("button",{type:"button","aria-expanded":s,"data-tool-call-id":t.toolCallId,onClick:()=>a(i=>!i),className:"w-full flex items-center justify-between px-3 py-2 bg-[hsl(var(--deck-surface-2))] hover:bg-[hsl(var(--deck-surface))] transition-colors",children:[e.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[s?e.jsx(de,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))] shrink-0"}):e.jsx(ie,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))] shrink-0"}),e.jsx("span",{className:"text-[12px] text-[hsl(var(--deck-ink))] font-mono shrink-0",children:t.toolName}),t.summary&&e.jsx("span",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono truncate",children:t.summary})]}),e.jsx(Re,{status:t.status})]}),t.status==="running"&&t.progressMessage&&e.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))] px-3 py-2 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsx("span",{className:"truncate",children:t.progressMessage}),t.progressTotal!==void 0&&t.progress!==void 0&&e.jsxs("span",{className:"shrink-0",children:[Math.max(0,Math.min(100,Math.round(t.progress/t.progressTotal*100))),"%"]})]}),t.progressTotal!==void 0&&t.progress!==void 0&&e.jsx("div",{role:"progressbar","aria-label":`${t.toolName} progress`,"aria-valuemin":0,"aria-valuemax":t.progressTotal,"aria-valuenow":Math.min(t.progress,t.progressTotal),className:"h-1 overflow-hidden rounded-full bg-[hsl(var(--deck-border))]",children:e.jsx("div",{className:"h-full rounded-full bg-amber-500 transition-[width] duration-150",style:{width:`${Math.max(0,Math.min(100,t.progress/t.progressTotal*100))}%`}})})]}),s&&e.jsxs("div",{className:"px-3 py-2 space-y-2 border-t border-[hsl(var(--deck-border))]",children:[r&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono",children:"Arguments"}),e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[120px] overflow-y-auto",children:r})]}),o&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono",children:"Output"}),e.jsxs("pre",{"data-tool-output":!0,className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[120px] overflow-y-auto",children:[o.body,o.notice&&e.jsxs(e.Fragment,{children:[`
60
+ `,e.jsx("span",{"data-tool-truncation-notice":!0,children:o.notice})]})]})]})]})]})}function ot({toolCalls:t}){return t.length===0?null:e.jsx("div",{className:"space-y-2",children:t.map(s=>e.jsx(ws,{tool:s},s.toolCallId))})}function Ns({toolCalls:t,toolCallIds:s}){const a=_(),[r,o]=h.useState(!1),i=h.useMemo(()=>new Map(t.map(b=>[b.toolCallId,b])),[t]),l=s.flatMap(b=>{const d=i.get(b);return d?[d]:[]});if(l.length===0)return null;const u=l.filter(b=>b.status==="running").length,x=l.filter(b=>b.status==="error").length,c=[...l].reverse().find(b=>b.status==="running"&&!!b.progressMessage),v=u>0?a(l.length===1?"chat.timeline.tools.runningOne":"chat.timeline.tools.running",{count:l.length}):x>0?a(l.length===1?"chat.timeline.tools.completedOneWithError":"chat.timeline.tools.completedWithErrors",{count:l.length,errors:x}):a(l.length===1?"chat.timeline.tools.completedOne":"chat.timeline.tools.completed",{count:l.length});return e.jsxs("div",{"data-agent-tool-group":!0,className:"py-0.5",children:[e.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>o(b=>!b),className:"group flex min-h-7 w-full items-center gap-1.5 rounded-md px-1.5 text-left font-mono text-[11.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))]/65 hover:text-[hsl(var(--deck-ink-muted))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[r?e.jsx(de,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0"}),u>0&&e.jsx($,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}),e.jsx("span",{children:v}),(c==null?void 0:c.progressMessage)&&e.jsxs("span",{className:"min-w-0 truncate text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:[c.progressMessage,c.progress!==void 0&&c.progressTotal!==void 0&&` · ${Math.max(0,Math.min(100,Math.round(c.progress/c.progressTotal*100)))}%`]})]}),(c==null?void 0:c.progress)!==void 0&&c.progressTotal!==void 0&&e.jsx("div",{role:"progressbar","aria-label":`${c.toolName} progress`,"aria-valuemin":0,"aria-valuemax":c.progressTotal,"aria-valuenow":Math.min(c.progress,c.progressTotal),className:"mx-1.5 h-0.5 overflow-hidden rounded-full bg-[hsl(var(--deck-border))]",children:e.jsx("div",{className:"h-full rounded-full bg-amber-500 transition-[width] duration-150",style:{width:`${Math.max(0,Math.min(100,c.progress/c.progressTotal*100))}%`}})}),r&&e.jsx("div",{"data-agent-tool-group-details":!0,className:"mt-2 space-y-2 pl-1",children:e.jsx(ot,{toolCalls:l})})]})}function Ss({content:t}){const s=_(),[a,r]=h.useState(!1);return t?e.jsxs("div",{"data-agent-thinking":!0,className:"py-0.5",children:[e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(o=>!o),className:"flex min-h-7 w-full items-center gap-1.5 rounded-md px-1.5 text-left font-mono text-[11.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))]/65 hover:text-[hsl(var(--deck-ink-muted))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[a?e.jsx(de,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))]"}):e.jsx(ie,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{children:s("chat.timeline.thinking")})]}),a&&e.jsx("div",{className:"ml-1 mt-1 border-l border-[hsl(var(--deck-border))] py-1 pl-3",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] leading-5 text-[hsl(var(--deck-ink-muted))]",children:t})})]}):null}function Cs({tasks:t}){if(t.length===0)return null;const s=t.filter(r=>r.status==="completed").length,a=s===t.length;return e.jsx("div",{className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:e.jsx("div",{className:"flex gap-2 items-center",children:e.jsx("span",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:a?"✓ All tasks done":`Tasks: ${s}/${t.length}`})})})}function Ts({toolCalls:t}){const s=Ee(i=>i.openFilePreview),a=f(i=>ne(i.historySurfaceSelection)),r=h.useMemo(()=>{const i=new Map,l=["Write","SearchReplace","Edit","ApplyPatch"];for(const u of t){if(u.status!=="success")continue;const x=u.metadata;if(u.toolName==="ApplyPatch"&&Array.isArray(x==null?void 0:x.changes)){for(const v of x.changes)v&&typeof v=="object"&&"path"in v&&typeof v.path=="string"&&i.set(v.path,{path:v.path,toolName:u.toolName});continue}const c=x==null?void 0:x.file_path;c&&l.includes(u.toolName)&&i.set(c,{path:c,toolName:u.toolName})}return Array.from(i.values())},[t]);if(a||r.length===0)return null;const o=i=>{O(f.getState())||s({tab:"diff",targetPath:i})};return e.jsxs("div",{className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:[e.jsxs("div",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono mb-1.5",children:["Changed files (",r.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.map(({path:i})=>{const l=i.split("/").pop()||i;return e.jsxs("button",{onClick:()=>o(i),className:"flex items-center gap-1 px-2 py-1 text-[11px] font-mono bg-[#E5E7EB] dark:bg-[#27272a] text-[hsl(var(--deck-ink))] rounded hover:bg-[#D1D5DB] dark:hover:bg-[#3f3f46] transition-colors",title:i,children:[e.jsx(bt,{className:"w-3 h-3"}),l]},i)})})]})}function Es({subagent:t}){var H,Y,W,Z;const s=_(),[a,r]=h.useState(null),[o,i]=h.useState(!1),[l,u]=h.useState(null),[x,c]=h.useState(!1),[v,b]=h.useState(""),[d,y]=h.useState(!1),[p,N]=h.useState(null),[m,S]=h.useState(null),[g,w]=h.useState(null),n=f(R=>R.currentSessionRef),M=f(R=>R.isStreaming),F=f(R=>R.isTemporarySession),D=f(R=>ne(R.historySurfaceSelection));if(!t)return null;const j=t.status==="running",U=a!==null?a:j,G=t.toolCalls||l||[],C=t.output||t.thinking||G.length>0||t.sessionId,T=m&&m.status!=="running"?m:g,A=(T==null?void 0:T.id)??t.sessionId,B=((H=T==null?void 0:T.restartRecovery)==null?void 0:H.outcome)==="failed",P=!j&&!M&&!F&&!D&&!B&&(m==null?void 0:m.status)!=="running"&&!!(A&&n);h.useEffect(()=>{if(D||!U||j||!t.sessionId||!(n!=null&&n.projectPath)||l!==null||t.toolCalls&&t.toolCalls.length>0)return;let R=!0;return i(!0),te.getMessages({sessionId:t.sessionId,projectPath:n.projectPath}).then(z=>{var V,E;if(!R)return;const q=At(z),K=new Map;for(const Q of q)if((E=(V=Q.agentContent)==null?void 0:V.toolCalls)!=null&&E.length)for(const se of Q.agentContent.toolCalls)K.has(se.toolCallId)||K.set(se.toolCallId,se);u(Array.from(K.values()))}).finally(()=>{R&&i(!1)}),()=>{R=!1}},[U,D,j,t.sessionId,t.toolCalls,l,n==null?void 0:n.projectPath]),h.useEffect(()=>{if(D||!t.sessionId||!n)return;let R=!0;const z=t.rootAgentId??t.sessionId,q=t.resumeDepth??0;return te.listSubagents(n).then(K=>{if(!R)return;w(K.find(E=>E.id===t.sessionId)??null);const V=K.filter(E=>E.id!==t.sessionId&&E.rootAgentId===z&&E.resumeDepth>q).sort((E,Q)=>Q.resumeDepth-E.resumeDepth||Q.lastActiveAt-E.lastActiveAt)[0];V&&S(V)}).catch(()=>{}),()=>{R=!1}},[n==null?void 0:n.sessionId,n==null?void 0:n.projectPath,D,t.sessionId,t.rootAgentId,t.resumeDepth]),h.useEffect(()=>{if(D||!m||m.status!=="running"||!n)return;let R=!0;const z=async()=>{try{const V=(await te.listSubagents(n)).find(E=>E.id===m.id);R&&V&&S(V)}catch{}},q=window.setInterval(()=>{z()},1e3);return()=>{R=!1,window.clearInterval(q)}},[n,D,m==null?void 0:m.id,m==null?void 0:m.status]);const X=async()=>{if(!O(f.getState())&&!(!n||!A||!v.trim()||d)){y(!0),N(null);try{const R=await te.resumeSubagent(n,A,v.trim());S(R.session),b(""),c(!1),r(!0)}catch(R){N(R instanceof Error?R.message:s("chat.subagent.resumeFailed"))}finally{y(!1)}}};return e.jsxs("div",{"data-subagent-id":t.id,"data-subagent-session-id":t.sessionId,className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:[e.jsxs("button",{type:"button",onClick:()=>r(!U),className:"flex gap-2 justify-between items-center w-full transition-opacity cursor-pointer hover:opacity-80",children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[j&&e.jsx($,{className:"h-3 w-3 animate-spin text-[hsl(var(--deck-ink-muted))]"}),e.jsxs("span",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:[t.type,": ",t.description]}),e.jsx(Re,{status:t.status==="completed"?"success":t.status==="failed"?"error":"running"}),t.type==="verification"&&t.verificationVerdict&&e.jsx("span",{"data-verification-verdict":t.verificationVerdict,className:I("rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",t.verificationVerdict==="pass"?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":t.verificationVerdict==="fail"?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-amber-500/10 text-amber-600 dark:text-amber-400"),children:t.verificationVerdict}),t.resumedFrom&&e.jsx("span",{className:"rounded bg-[#EDE9FE] px-1.5 py-0.5 text-[10px] font-mono text-[#6D28D9] dark:bg-[#2E1065] dark:text-[#C4B5FD]",title:s("chat.subagent.resumedFromTitle",{id:t.resumedFrom}),children:s("chat.subagent.resumedDepth",{depth:t.resumeDepth??1})})]}),C&&e.jsx(de,{className:I("h-3.5 w-3.5 text-[hsl(var(--deck-ink-muted))] transition-transform",U&&"rotate-180")})]}),!U&&!j&&t.output&&e.jsx("div",{"data-subagent-output-summary":!0,className:"mt-2 max-h-10 overflow-hidden whitespace-pre-wrap break-words font-mono text-[11px] text-[hsl(var(--deck-ink))]",children:t.output}),U&&e.jsxs("div",{className:"mt-2 space-y-2",children:[(t.output||t.thinking)&&e.jsxs(e.Fragment,{children:[t.output&&e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[160px] overflow-y-auto",children:t.output}),t.thinking&&e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[120px] overflow-y-auto",children:t.thinking})]}),o&&e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono",children:[e.jsx($,{className:"w-3 h-3 animate-spin"}),s("chat.subagent.loadingLogs")]}),!o&&G.length>0&&e.jsx(ot,{toolCalls:G}),m&&e.jsxs("div",{className:"rounded-md border border-[#DDD6FE] bg-[#F5F3FF] p-2 text-[11px] font-mono text-[#5B21B6] dark:border-[#4C1D95] dark:bg-[#1E1B4B] dark:text-[#C4B5FD]",children:[e.jsx("div",{children:s("chat.subagent.resumedAs",{id:m.id,status:m.status,depth:m.resumeDepth??1})}),(((Y=m.result)==null?void 0:Y.message)||((W=m.result)==null?void 0:W.error))&&e.jsx("div",{className:"mt-1 whitespace-pre-wrap text-[hsl(var(--deck-ink))]",children:m.result.message||m.result.error})]}),B&&((Z=T==null?void 0:T.result)==null?void 0:Z.error)&&e.jsx("div",{role:"alert",className:"text-[11px] text-red-600",children:T.result.error}),P&&e.jsxs("div",{className:"space-y-2",children:[x?e.jsxs("div",{className:"space-y-2 rounded-md border border-[#E5E7EB] bg-white p-2 dark:border-[#27272a] dark:bg-[#111113]",children:[e.jsx("textarea",{"aria-label":s("chat.subagent.followUpAria"),value:v,onChange:R=>b(R.target.value),placeholder:s("chat.subagent.followUpPlaceholder"),rows:3,className:"w-full resize-y rounded border border-[#D1D5DB] bg-white p-2 text-[11px] text-[#111827] outline-none focus:border-[#8B5CF6] dark:border-[#3f3f46] dark:bg-[#18181b] dark:text-[#f4f4f5]"}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{type:"button",onClick:()=>{c(!1),N(null)},className:"rounded px-2 py-1 text-[11px] text-[#6B7280] hover:bg-[#F3F4F6] dark:hover:bg-[#27272a]",children:s("chat.subagent.cancel")}),e.jsxs("button",{type:"button",onClick:()=>void X(),disabled:!v.trim()||d,className:"flex items-center gap-1 rounded bg-[#7C3AED] px-2 py-1 text-[11px] font-medium text-white disabled:opacity-50",children:[d&&e.jsx($,{className:"w-3 h-3 animate-spin"}),s("chat.subagent.resumeAgent")]})]})]}):e.jsxs("button",{type:"button","aria-label":s("chat.subagent.resumeAria"),onClick:()=>c(!0),className:"flex items-center gap-1.5 rounded-md border border-[#D1D5DB] px-2 py-1 text-[11px] font-medium text-[#374151] transition-colors hover:bg-[#F3F4F6] dark:border-[#3f3f46] dark:text-[#d4d4d8] dark:hover:bg-[#27272a]",children:[e.jsx(he,{className:"w-3 h-3"}),s("chat.subagent.resume")]}),p&&e.jsx("div",{role:"alert",className:"text-[11px] text-red-600",children:p})]})]})]})}function Ms({confirmation:t,messageId:s}){const a=_(),[r,o]=h.useState(!1),[i,l]=h.useState(null),u=f(v=>v.currentSessionRef),x=f(v=>v.setConfirmation);if(!t)return null;const c=async(v,b)=>{if(!O(f.getState())&&!(!u||r)){o(!0),l(null);try{await te.respondPermission(u,t.toolCallId,{approved:v,scope:b}),x(s,{...t,status:v?"approved":"denied"})}catch(d){l(d instanceof Error?d.message:a("interaction.permission.failed"))}finally{o(!1)}}};return t.status!=="pending"?null:e.jsxs("div",{"data-pending-interaction":"permission",tabIndex:-1,role:"alert",className:"space-y-3 rounded-lg border border-amber-300/70 bg-amber-50/70 p-4 outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800/70 dark:bg-amber-950/25",children:[e.jsx("div",{className:"text-[13px] text-[hsl(var(--deck-ink))] font-mono",children:a("interaction.permission.title",{tool:t.toolName})}),e.jsx("div",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:t.description}),t.diff&&e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[200px] overflow-y-auto",children:t.diff}),i&&e.jsx("div",{role:"alert",className:"rounded-md border border-red-300/70 bg-red-50 px-2.5 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:i}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void c(!0,"once"),disabled:r,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#22C55E] text-white rounded-md hover:bg-[#16A34A] disabled:cursor-wait disabled:opacity-50",children:r?e.jsx($,{className:"h-3.5 w-3.5 animate-spin"}):a("interaction.permission.once")}),t.allowRemember!==!1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>void c(!0,"session"),disabled:r,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#3B82F6] text-white rounded-md hover:bg-[#2563EB] disabled:cursor-wait disabled:opacity-50",children:a("interaction.permission.session")}),e.jsx("button",{type:"button",onClick:()=>void c(!0,"project"),disabled:r,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#6366F1] text-white rounded-md hover:bg-[#4F46E5] disabled:cursor-wait disabled:opacity-50",children:a("interaction.permission.project")})]}),e.jsx("button",{type:"button",onClick:()=>void c(!1),disabled:r,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#EF4444] text-white rounded-md hover:bg-[#DC2626] disabled:cursor-wait disabled:opacity-50",children:a("interaction.permission.deny")})]})]})}function As({question:t,messageId:s}){const a=_(),[r,o]=h.useState({}),[i,l]=h.useState({}),[u,x]=h.useState(!1),[c,v]=h.useState(null),b=f(m=>m.currentSessionRef),d=f(m=>m.setQuestion),y=h.useMemo(()=>t?t.questions.reduce((m,S)=>{var M;const g=(M=i[S.header])==null?void 0:M.trim(),w=r[S.header];if(S.multiSelect){const F=Array.isArray(w)?[...w]:[];return g&&F.push(g),F.length>0&&(m[S.header]=F),m}const n=g||(typeof w=="string"?w:"");return n&&(m[S.header]=n),m},{}):{},[r,i,t]),p=(t==null?void 0:t.questions.every(m=>m.header in y))??!1;if(!t)return null;const N=async()=>{if(!O(f.getState())&&!(!b||u||!p)){x(!0),v(null);try{await te.respondToQuestion(b,t.toolCallId,y),d(s,{...t,status:"answered",answers:y})}catch(m){v(m instanceof Error?m.message:a("interaction.question.failed"))}finally{x(!1)}}};return t.status!=="pending"?e.jsx("div",{className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:e.jsx("div",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:a("interaction.question.answered")})}):e.jsxs("div",{"data-pending-interaction":"question",tabIndex:-1,role:"alert",className:"space-y-4 rounded-lg border border-amber-300/70 bg-amber-50/70 p-4 outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800/70 dark:bg-amber-950/25",children:[t.questions.map((m,S)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[13px] text-[hsl(var(--deck-ink))] font-mono",children:m.question}),e.jsxs("div",{className:"space-y-1",children:[m.options.map((g,w)=>e.jsxs("button",{type:"button",onClick:()=>{if(m.multiSelect){const n=r[m.header]||[],M=n.includes(g.label)?n.filter(F=>F!==g.label):[...n,g.label];o({...r,[m.header]:M})}else o({...r,[m.header]:g.label}),l({...i,[m.header]:""})},className:I("w-full text-left px-3 py-2 rounded-md border text-[12px] font-mono transition-colors","border-[hsl(var(--deck-border))]",(m.multiSelect?(r[m.header]||[]).includes(g.label):r[m.header]===g.label)?"bg-[#DCFCE7] text-[#166534] dark:bg-[#22C55E]/20 dark:text-[#E5E5E5]":"bg-[hsl(var(--deck-surface-2))] text-[hsl(var(--deck-ink-muted))]"),children:[e.jsx("div",{children:g.label}),e.jsx("div",{className:"text-[11px] text-[hsl(var(--deck-ink-faint))] mt-1",children:g.description})]},w)),e.jsx("input",{"aria-label":`${m.header} other response`,value:i[m.header]??"",onChange:g=>l({...i,[m.header]:g.target.value}),placeholder:a("interaction.question.other"),className:"w-full rounded-md border border-[#E5E7EB] bg-white px-3 py-2 text-[12px] text-[#111827] outline-none focus:border-[#22C55E] dark:border-[#27272a] dark:bg-[#111113] dark:text-[#E5E5E5]"})]})]},S)),c&&e.jsx("div",{role:"alert",className:"rounded-md border border-red-300/70 bg-red-50 px-2.5 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:c}),e.jsxs("button",{type:"button",onClick:()=>void N(),disabled:u||!p,className:"inline-flex min-h-8 items-center gap-1.5 px-3 py-1.5 text-[12px] font-mono bg-[#22C55E] text-white rounded-md hover:bg-[#16A34A] disabled:cursor-wait disabled:opacity-50",children:[u&&e.jsx($,{className:"h-3.5 w-3.5 animate-spin"}),a("interaction.question.submit")]})]})}function Rs({message:t}){const s=t.agentContent,a=f(p=>p.isStreaming&&p.currentAssistantMessageId===t.id);if(!s){const p=Ae(t.content);return p?e.jsx(Ue,{content:p}):null}const{toolCalls:r,tasks:o,confirmation:i,question:l,elicitation:u}=s,x=Et(s),c=Mt(s);if(!(c.length>0||o.length>0||x.length>0||i||l||u)&&a)return e.jsxs("div",{className:"flex items-center gap-2 text-[hsl(var(--deck-ink-muted))]",children:[e.jsx($,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"text-[12px] font-mono",children:"Thinking..."})]});const d=r.length>0&&r.every(p=>p.status==="success"||p.status==="error")&&!a,y=!a;return e.jsxs("div",{className:"space-y-3",children:[c.map(p=>p.type==="thinking"?e.jsx("div",{"data-agent-timeline-block":"thinking",children:e.jsx(Ss,{content:p.content})},p.id):p.type==="text"?e.jsx("div",{"data-agent-timeline-block":"text",children:e.jsx(Ue,{content:p.content,syntaxHighlight:y})},p.id):e.jsx("div",{"data-agent-timeline-block":"tool_group",children:e.jsx(Ns,{toolCalls:r,toolCallIds:p.toolCallIds})},p.id)),o.length>0&&e.jsx(Cs,{tasks:o}),x.map(p=>e.jsx(Es,{subagent:p},p.id)),i&&e.jsx(Ms,{confirmation:i,messageId:t.id}),l&&e.jsx(As,{question:l,messageId:t.id}),u&&e.jsx(os,{elicitation:u,messageId:t.id}),d&&e.jsx(Ts,{toolCalls:r})]})}function Ds({message:t,showAvatar:s=!0}){var u,x,c,v;const a=t.role==="user";if(t.role==="system"){const b=Ae(t.content);return e.jsx("div",{"data-chat-message-id":t.id,"data-chat-role":"system",className:"flex justify-center p-2 w-full",children:e.jsx("div",{className:"text-xs text-[hsl(var(--deck-ink-muted))] bg-[#F3F4F6] dark:bg-[#18181b] px-3 py-1 rounded-full font-mono",children:b})})}if(a){const b=(u=t.metadata)!=null&&u.userShellCommand&&typeof t.metadata.userShellCommand=="object"?t.metadata.userShellCommand:(x=t.metadata)!=null&&x.userShellExecution&&typeof t.metadata.userShellExecution=="object"?t.metadata.userShellExecution:void 0;if(b){const p=typeof b.command=="string"?b.command:"",N=b.status==="running"?"running":b.status==="completed"?"success":"error",m=typeof b.output=="string"?b.output:[typeof b.stdout=="string"?b.stdout:"",typeof b.stderr=="string"&&b.stderr?`stderr:
61
+ ${b.stderr}`:""].filter(Boolean).join(`
62
+ `);return e.jsx("div",{"data-chat-message-id":t.id,"data-chat-role":"user","data-user-shell-command":!0,className:"flex w-full justify-end p-4",children:e.jsxs("div",{className:"w-full max-w-[85%] overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:[e.jsx("span",{className:"mr-2 text-amber-600 dark:text-amber-400",children:"$"}),p]}),e.jsx(Re,{status:N})]}),e.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:m||"(no output)"}),typeof b.exitCode=="number"&&e.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))] px-3 py-1.5 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:["exit ",b.exitCode,typeof b.durationMs=="number"?` · ${(b.durationMs/1e3).toFixed(3)}s`:"",b.truncated===!0?" · truncated":""]})]})})}const{text:d,images:y}=gs(t.content);return e.jsxs("div",{"data-chat-message-id":t.id,"data-chat-role":"user",className:"group flex gap-2 justify-end p-4 w-full items-start",children:[e.jsx("div",{className:"mt-1 flex shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:e.jsx(Pe,{text:d,label:"Copy message"})}),e.jsxs("div",{className:"bg-[hsl(var(--deck-surface-2))] rounded-lg px-4 py-3 max-w-[85%]",children:[d&&e.jsx("p",{className:"text-[14px] text-[hsl(var(--deck-ink))] font-mono leading-relaxed whitespace-pre-wrap",children:d}),y.length>0&&e.jsx("div",{className:I("grid gap-2",y.length===1?"grid-cols-1 mt-0":"grid-cols-2 mt-3"),children:y.map((p,N)=>e.jsx("img",{src:p,alt:`attachment-${N+1}`,className:"object-cover w-full max-h-64 rounded-md"},`${p}-${N}`))})]}),e.jsx(vs,{})]})}const o=ks(t),i=rs((c=t.metadata)==null?void 0:c.codeReview),l=xs((v=t.metadata)==null?void 0:v.structuredOutput);return e.jsxs("div",{"data-chat-message-id":t.id,"data-chat-role":"assistant",className:I("group flex gap-4 justify-start w-full",s?"p-4":"px-4 pt-0 pb-3"),children:[s?e.jsx(bs,{}):e.jsx("div",{className:"w-8 shrink-0"}),e.jsxs("div",{className:"overflow-hidden flex-1 min-w-0",children:[i?e.jsx(is,{report:i}):l?e.jsx(ps,{report:l}):e.jsx(Rs,{message:t}),!l&&o.trim()&&e.jsx("div",{className:"mt-1.5 flex opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:e.jsx(Pe,{text:o,label:"Copy response"})})]})]})}const Fs=h.memo(Ds);function Is(t,s,a){return Math.max(0,t+(a-s))}function $s(t,s,a){return Math.min(s,Math.max(0,t)+Math.max(0,a))}function _s(t,s,a,r){const o=new Map(t.filter(l=>!!l.id).map(l=>[l.id,l])),i=new Set(a);for(const l of s){if(!l.id)continue;const u=o.get(l.id);u!==l&&(!u||!r||r(u)!==r(l))&&i.add(l.id)}return i}function Ve(t,s){return t?t.querySelector(`[data-chat-message-id="${CSS.escape(s)}"]`):null}function Bs({turns:t,viewportRef:s,containerRef:a,onRevealTurn:r}){const o=_(),[i,l]=h.useState(null),[u,x]=h.useState(!1),c=h.useRef(null),v=h.useCallback(()=>{var m;const d=s.current,y=a.current;if(!d||!y||t.length===0)return;const p=d.getBoundingClientRect().top;let N=((m=t[0])==null?void 0:m.id)??null;for(const S of t){const g=Ve(y,S.id);if(g)if(g.getBoundingClientRect().top-p<=24)N=S.id;else break}l(N)},[t,s,a]);h.useEffect(()=>{const d=s.current;if(!d)return;const y=()=>{c.current===null&&(c.current=window.requestAnimationFrame(()=>{c.current=null,v()}))};return v(),d.addEventListener("scroll",y,{passive:!0}),()=>{d.removeEventListener("scroll",y),c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null)}},[v,s]);const b=h.useCallback(d=>{const y=()=>{const N=Ve(a.current,d.id);N&&(N.scrollIntoView({behavior:"smooth",block:"start"}),l(d.id))};r(d.index)?y():window.requestAnimationFrame(()=>window.requestAnimationFrame(y))},[a,r]);return t.length<2?null:e.jsx("nav",{"aria-label":o("chat.turns.aria"),className:"absolute right-1 top-1/2 z-20 hidden -translate-y-1/2 sm:block",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),onFocusCapture:()=>x(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||x(!1)},children:e.jsxs("div",{className:"relative flex items-center justify-end",children:[e.jsx("ul",{className:I("flex flex-col items-center gap-2 py-2 transition-opacity",u?"opacity-0":"opacity-100"),"aria-hidden":u,children:t.map(d=>e.jsx("li",{children:e.jsx("span",{className:I("block rounded-full transition-all",d.id===i?"h-2 w-2 bg-[hsl(var(--deck-accent))]":"h-1.5 w-1.5 bg-[hsl(var(--deck-ink-faint))]/40")})},d.id))}),e.jsx("div",{className:I("absolute right-0 max-h-[min(70vh,520px)] w-[280px] overflow-y-auto rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]/95 p-1 shadow-xl backdrop-blur transition-all",u?"pointer-events-auto translate-x-0 opacity-100":"pointer-events-none translate-x-2 opacity-0"),children:t.map((d,y)=>e.jsxs("button",{type:"button",onClick:()=>b(d),className:I("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors",d.id===i?"bg-[hsl(var(--deck-hairline))]/70 text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-hairline))]/50 hover:text-[hsl(var(--deck-ink))]"),children:[e.jsx("span",{className:I("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",d.id===i?"bg-[hsl(var(--deck-accent))]":"bg-[hsl(var(--deck-ink-faint))]/40")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block font-mono text-[9.5px] uppercase tracking-[0.12em] text-[hsl(var(--deck-ink-faint))]",children:o("chat.turns.label",{n:y+1})}),e.jsx("span",{className:"line-clamp-2 text-[12px] leading-4",children:d.preview})]})]},d.id))})]})})}const He=80;function Ps(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(s=>s.type==="text").map(s=>s.text).join(" "):""}function Ls(t){const s=Ps(t).replace(/\s+/g," ").trim();return s?s.length>He?`${s.slice(0,He-1)}…`:s:""}function Us(t){const s=[];for(let a=0;a<t.length;a+=1){const r=t[a];if(r.role!=="user"||!r.id)continue;const o=Ls(r.content);o&&s.push({id:r.id,index:a,preview:o})}return s}const ke=120,ye=80,Os=96;function oe(t){return(t==null?void 0:t.querySelector("[data-radix-scroll-area-viewport]"))??null}function Ks(t){return JSON.stringify([t.role,t.content,t.metadata,t.agentContent])}function Vs({messages:t,isLoading:s}){const a=_(),r=h.useRef(null),o=h.useRef(null),i=h.useRef(!0),l=h.useRef(!1),u=h.useRef(t),x=h.useRef(t),c=h.useRef(new Set),v=h.useRef(t.length),b=h.useRef(null),[d,y]=h.useState(ke),[p,N]=h.useState(!1),[m,S]=h.useState(0),g=t.length>0;u.current=t,h.useEffect(()=>{const C=oe(r.current);if(!C||l.current&&!i.current)return;const T=window.requestAnimationFrame(()=>{C.scrollTop=C.scrollHeight,l.current=!0,i.current=!0,c.current=new Set,S(0),N(!1)});return()=>window.cancelAnimationFrame(T)},[t]),h.useEffect(()=>{const C=oe(r.current);if(!C)return;o.current=C;const T=()=>{if(!l.current)return;const B=C.scrollHeight-C.scrollTop-C.clientHeight<=Os,P=i.current;i.current=B,N(!B),B?(c.current=new Set,S(0)):P&&(x.current=u.current,c.current=new Set,S(0))};return T(),C.addEventListener("scroll",T,{passive:!0}),()=>C.removeEventListener("scroll",T)},[g,s]),h.useEffect(()=>{const C=x.current;if(x.current=t,i.current){c.current.size>0&&(c.current=new Set,S(0));return}const T=_s(C,t,c.current,Ks);c.current=T,S(T.size)},[t]),h.useEffect(()=>{const C=v.current;v.current=t.length,y(T=>T>=C&&t.length>C?t.length:Math.min(Math.max(T,ke),t.length||ke))},[t.length]);const w=Math.max(t.length-d,0),n=w,M=h.useMemo(()=>t.slice(n),[t,n]),F=h.useMemo(()=>Us(t),[t]);if(h.useLayoutEffect(()=>{var A;const C=b.current;if(!C)return;const T=oe(r.current);if(b.current=null,!!T){if((A=C.element)!=null&&A.isConnected){const B=C.element.getBoundingClientRect().top-C.viewportTop;T.scrollTop+=B;return}T.scrollTop=Is(C.scrollTop,C.scrollHeight,T.scrollHeight)}},[d]),s)return e.jsx("div",{role:"status","aria-live":"polite","aria-busy":"true",className:"flex overflow-hidden flex-1 justify-center items-center px-5 py-8 min-h-0",children:e.jsxs("div",{className:"w-full max-w-[560px]",children:[e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 animate-pulse rounded-full bg-[hsl(var(--deck-accent-soft))] blur-xl"}),e.jsx(we,{size:42,className:"relative"})]}),e.jsxs("div",{className:"mt-4 inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--deck-accent))]",children:[e.jsx(vt,{className:"w-3 h-3"}),a("chat.list.loading.eyebrow")]}),e.jsx("h2",{className:"mt-2 text-[15px] font-medium text-[hsl(var(--deck-ink))]",children:a("chat.list.loading.title")}),e.jsx("p",{className:"mt-1 max-w-sm text-[11.5px] leading-5 text-[hsl(var(--deck-ink-faint))]",children:a("chat.list.loading.hint")})]}),e.jsx("div",{"aria-hidden":"true",className:"mt-7 space-y-4 rounded-xl border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/45 px-4 py-5",children:[72,88,64].map((C,T)=>e.jsxs("div",{className:I("flex gap-3",T%2===1&&"flex-row-reverse"),children:[e.jsx("span",{className:"h-7 w-7 shrink-0 animate-pulse rounded-md bg-[hsl(var(--deck-surface-2))]"}),e.jsx("span",{className:"h-10 animate-pulse rounded-lg bg-[hsl(var(--deck-surface-2))]",style:{width:`${C}%`,animationDelay:`${T*120}ms`}})]},C))})]})});if(t.length===0&&!s)return e.jsx("div",{className:"flex flex-1 justify-center items-center",children:e.jsxs("div",{className:"flex flex-col gap-4 items-center text-center",children:[e.jsx(we,{size:44}),e.jsxs("div",{children:[e.jsx("div",{className:"deck-eyebrow text-[hsl(var(--deck-accent))]",children:a("chat.list.empty.eyebrow")}),e.jsx("div",{className:"mt-2 text-[15px] font-medium text-[hsl(var(--deck-ink))]",children:a("chat.list.empty.title")}),e.jsx("div",{className:"mt-1 max-w-xs text-[12px] text-[hsl(var(--deck-ink-muted))]",children:a("chat.list.empty.hint")})]})]})});const D=()=>{const C=oe(r.current);C&&(C.scrollTop=C.scrollHeight,i.current=!0,l.current=!0,c.current=new Set,S(0),N(!1))},j=()=>{var T;const C=oe(r.current);if(C){const A=((T=r.current)==null?void 0:T.querySelector("[data-chat-message-id]"))??null;b.current={element:A,viewportTop:(A==null?void 0:A.getBoundingClientRect().top)??0,scrollHeight:C.scrollHeight,scrollTop:C.scrollTop}}y(A=>$s(A,t.length,ye))},U=C=>C>=n?!0:(y(t.length),!1),G=m===1?a("chat.list.unreadMessage"):a("chat.list.unreadMessages",{count:m});return e.jsxs("div",{ref:r,className:"relative flex-1 min-h-0",children:[e.jsx($t,{className:"h-full",children:e.jsxs("div",{className:"flex flex-col px-4 pb-4 w-full md:px-6",children:[w>0&&e.jsx("div",{className:"flex justify-center py-3",children:e.jsx("button",{type:"button",onClick:j,"aria-label":a("chat.list.showEarlierWithRemaining",{count:Math.min(w,ye),remaining:w}),className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-1.5 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:a("chat.list.showEarlier",{count:Math.min(w,ye)})})}),M.map((C,T)=>{const A=n+T,B=A>0?t[A-1]:null,P=!B||B.role!==C.role||B.role==="user";return e.jsx(Fs,{message:C,showAvatar:P},C.id||`msg-${A}`)})]})}),e.jsx(Bs,{turns:F,viewportRef:o,containerRef:r,onRevealTurn:U}),p&&e.jsxs("button",{type:"button",onClick:D,"aria-live":"polite","aria-label":m>0?G:a("chat.list.jumpLatest"),className:"absolute bottom-4 left-1/2 z-10 inline-flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-[hsl(var(--deck-border-strong))] bg-[hsl(var(--deck-surface))]/95 px-3 py-1.5 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] shadow-lg backdrop-blur transition-colors hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[e.jsx(Me,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-accent))]"}),m>0?G:a("chat.list.jumpLatest")]})]})}const ct=h.memo(Vs);function Hs({queue:t,mutation:s,onMutate:a,onRefresh:r}){const o=_(),[i,l]=h.useState(!1),u=h.useRef(null),x=h.useRef(null),c=h.useRef(null);h.useLayoutEffect(()=>{var p,N,m;if(s.pending||!u.current)return;const d=u.current;u.current=null,(m=Array.from(((p=x.current)==null?void 0:p.querySelectorAll("[data-follow-up-focus-id]"))??[]).find(S=>S.dataset.followUpFocusId===d)??((N=x.current)==null?void 0:N.querySelector("button")))==null||m.focus()},[s.pending,t==null?void 0:t.version]);const v=h.useCallback(async d=>{u.current=d.messageId,await a(d)},[a]),b=h.useCallback((d,y)=>{v({type:"move",messageId:d,toPosition:y})},[v]);return!t||t.pending===0&&!s.errorMessage?null:e.jsxs("section",{ref:x,"data-blade-follow-up-queue":!0,className:"mx-4 mb-2 overflow-hidden rounded-lg border border-amber-300/70 bg-amber-50/70 shadow-sm dark:border-amber-900/60 dark:bg-amber-950/25 md:mx-6","aria-label":o("chat.followUpQueue.title"),children:[e.jsxs("button",{type:"button","aria-label":o(i?"chat.followUpQueue.hide":"chat.followUpQueue.show"),"aria-expanded":i,onClick:()=>l(d=>!d),className:"flex min-h-10 w-full items-center gap-2 px-3 text-left font-mono text-[11px] text-amber-950 transition-colors hover:bg-amber-100/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-amber-500 dark:text-amber-100 dark:hover:bg-amber-900/35",children:[e.jsx(qt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"font-semibold",children:o("chat.followUpQueue.count",{count:t.pending})}),t.locked>0&&e.jsx("span",{className:"text-amber-700/80 dark:text-amber-300/75",children:o("chat.followUpQueue.lockedCount",{count:t.locked})}),e.jsx(ie,{className:`ml-auto h-3.5 w-3.5 transition-transform ${i?"rotate-90":""}`,"aria-hidden":!0})]}),i&&e.jsxs("div",{className:"border-t border-amber-300/60 px-2 py-2 dark:border-amber-900/50",children:[s.errorMessage&&e.jsxs("div",{role:"alert",className:"mb-2 flex items-center gap-2 rounded-md border border-red-200 bg-red-50 px-2.5 py-2 text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/35 dark:text-red-300",children:[e.jsx("span",{className:"min-w-0 flex-1",children:s.errorCode==="revision_conflict"?o("chat.followUpQueue.stale"):s.errorMessage}),r&&e.jsx("button",{type:"button","aria-label":o("chat.followUpQueue.refresh"),onClick:()=>void r(),className:"rounded p-1 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 dark:hover:bg-red-900/60",children:e.jsx(et,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("ol",{className:"space-y-1.5",children:t.items.map((d,y)=>{const p=t.items[y-1],N=t.items[y+1],m=d.mutable&&(p==null?void 0:p.mutable)===!0,S=d.mutable&&(N==null?void 0:N.mutable)===!0,g=s.pending;return e.jsxs("li",{"data-follow-up-id":d.id,"data-follow-up-state":d.state,"data-follow-up-focus-id":d.id,tabIndex:-1,draggable:d.mutable&&!s.pending,onDragStart:()=>{c.current=d.mutable?d.id:null},onDragOver:w=>{const n=c.current,M=t.items.find(F=>F.id===n);M!=null&&M.mutable&&d.mutable&&w.preventDefault()},onDrop:w=>{w.preventDefault();const n=c.current;c.current=null;const M=t.items.find(j=>j.id===n);if(!(M!=null&&M.mutable)||!d.mutable||M.id===d.id)return;const F=Math.min(M.position,d.position),D=Math.max(M.position,d.position);t.items.slice(F,D+1).some(j=>!j.mutable)||b(M.id,d.position)},onDragEnd:()=>{c.current=null},className:"flex min-w-0 items-center gap-2 rounded-md border border-amber-200/70 bg-white/75 px-2.5 py-2 dark:border-amber-900/50 dark:bg-zinc-950/45",children:[e.jsx("span",{className:"w-5 shrink-0 text-center font-mono text-[10px] text-amber-700 dark:text-amber-400",children:y+1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-xs text-[hsl(var(--deck-ink))]",children:d.kind==="internal"?o("chat.followUpQueue.internal"):d.preview||o("chat.followUpQueue.attachmentOnly")}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 font-mono text-[9px] uppercase tracking-[0.08em] text-[hsl(var(--deck-ink-faint))]",children:[e.jsx("span",{children:o(`chat.followUpQueue.delivery.${d.delivery}`)}),!d.mutable&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Gt,{className:"h-2.5 w-2.5","aria-hidden":!0}),o("chat.followUpQueue.locked")]}),d.attachmentCount>0&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(gt,{className:"h-2.5 w-2.5","aria-hidden":!0}),d.attachmentCount]})]})]}),g&&s.messageId===d.id?e.jsx($,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-amber-600"}):e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx("button",{type:"button","aria-label":o("chat.followUpQueue.moveUp",{id:d.id}),disabled:g||!m,onClick:()=>b(d.id,y-1),className:"rounded p-1 text-amber-800 transition-colors hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-500 disabled:opacity-30 dark:text-amber-300 dark:hover:bg-amber-900/50",children:e.jsx(_t,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx("button",{type:"button","aria-label":o("chat.followUpQueue.moveDown",{id:d.id}),disabled:g||!S,onClick:()=>b(d.id,y+1),className:"rounded p-1 text-amber-800 transition-colors hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-500 disabled:opacity-30 dark:text-amber-300 dark:hover:bg-amber-900/50",children:e.jsx(Me,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx("button",{type:"button","aria-label":o("chat.followUpQueue.remove",{id:d.id}),disabled:g||!d.mutable,onClick:()=>void v({type:"remove",messageId:d.id}),className:"rounded p-1 text-red-600 transition-colors hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:opacity-30 dark:text-red-400 dark:hover:bg-red-950/60",children:e.jsx(re,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]},d.id)})})]})]})}const Ne=Pt,Se=Lt,Ce=Ut,pe=h.forwardRef(({className:t,sideOffset:s=4,...a},r)=>e.jsx(rt,{ref:r,sideOffset:s,className:I("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...a}));pe.displayName=rt.displayName;const Qs={active:{labelKey:"goal.status.active",dot:"bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.5)]",accent:"text-[hsl(var(--deck-accent))]"},verifying:{labelKey:"goal.status.active",dot:"animate-pulse bg-sky-400",accent:"text-sky-600 dark:text-sky-300"},paused:{labelKey:"goal.status.paused",dot:"bg-amber-400",accent:"text-amber-600 dark:text-amber-300"},blocked:{labelKey:"goal.status.blocked",dot:"bg-rose-500",accent:"text-rose-600 dark:text-rose-300"},usage_limited:{labelKey:"goal.status.usageLimited",dot:"bg-orange-500",accent:"text-orange-600 dark:text-orange-300"},budget_limited:{labelKey:"goal.status.budgetLimited",dot:"bg-orange-500",accent:"text-orange-600 dark:text-orange-300"},complete:{labelKey:"goal.status.complete",dot:"bg-emerald-500",accent:"text-emerald-600 dark:text-emerald-300"}};function ue(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}function zs(t){if(t<60)return`${t}s`;const s=Math.floor(t/60),a=t%60;return a===0?`${s}m`:`${s}m ${a}s`}function qs(){var C,T,A,B,P,X,H,Y,W,Z,R,z,q,K,V;const t=_(),{locale:s}=tt(),a=f(E=>E.goal),r=f(E=>E.pauseGoal),o=f(E=>E.resumeGoal),i=f(E=>E.editGoal),l=f(E=>E.clearGoal),u=f(E=>ne(E.historySurfaceSelection)),[x,c]=h.useState(!1),[v,b]=h.useState(!1),[d,y]=h.useState(""),[p,N]=h.useState(null),[m,S]=h.useState(!1);if(h.useEffect(()=>{c(!1),b(!1),y((a==null?void 0:a.objective)??""),S(!1)},[a==null?void 0:a.goalId]),u||!a)return null;const g=Qs[a.status],w=["active","verifying","paused","blocked"].includes(a.status),n=a.status==="active"||a.status==="verifying",M=a.status==="paused"||a.status==="blocked",F=p!==null,D=async(E,Q)=>{if(!O(f.getState())){N(E);try{await Q()}finally{N(null)}}},j=()=>{y(a.objective),b(!0),c(!0)},U=async E=>{E.preventDefault();const Q=d.trim();if(!Q||Q===a.objective){b(!1);return}await D("edit",()=>i(Q)),b(!1)},G=async()=>{await D("delete",l),S(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(Ne,{delayDuration:250,children:e.jsxs("section",{"aria-label":t("goal.aria.section"),className:"mx-3 mb-1 shrink-0","data-blade-goal-status":a.status,"data-blade-goal-recovery":(C=a.prematureStop)==null?void 0:C.consecutiveCount,"data-blade-goal-recovery-pattern":(T=a.prematureStop)==null?void 0:T.pattern,"data-blade-goal-verification-stall":(A=a.verificationStall)==null?void 0:A.consecutiveCount,"data-blade-goal-frontier-task-list":(B=a.executionFrontier)==null?void 0:B.taskListId,"data-blade-goal-frontier-total":(P=a.executionFrontier)==null?void 0:P.total,"data-blade-goal-frontier-completed":(X=a.executionFrontier)==null?void 0:X.completed,"data-blade-goal-frontier-in-progress":(H=a.executionFrontier)==null?void 0:H.inProgress,"data-blade-goal-frontier-pending":(Y=a.executionFrontier)==null?void 0:Y.pending,"data-blade-goal-frontier-blocked":(W=a.executionFrontier)==null?void 0:W.blocked,"data-blade-goal-frontier-next-task":(R=(Z=a.executionFrontier)==null?void 0:Z.nextTask)==null?void 0:R.id,"data-blade-goal-frontier-digest":(z=a.executionFrontier)==null?void 0:z.digestSha256.slice(0,16),"data-blade-goal-frontier-stall":(q=a.frontierStall)==null?void 0:q.category,"data-blade-goal-frontier-stall-count":(K=a.frontierStall)==null?void 0:K.consecutiveCount,children:[e.jsxs("div",{className:I("flex h-9 items-center gap-2 rounded-lg border px-3 transition-colors","border-[hsl(var(--deck-border))]/60 bg-[hsl(var(--deck-surface))]/80 backdrop-blur-sm",x&&"rounded-b-none border-b-0"),children:[a.status==="complete"?e.jsx(kt,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500"}):e.jsx(Jt,{className:I("h-3.5 w-3.5 shrink-0",g.accent)}),e.jsx("span",{className:I("h-1.5 w-1.5 shrink-0 rounded-full",g.dot)}),e.jsx("span",{className:I("shrink-0 text-[10px] font-medium leading-none",g.accent),children:a.status==="verifying"?s==="zh"?"验证中":"Verifying":t(g.labelKey)}),e.jsx("span",{className:"h-3 w-px shrink-0 bg-[hsl(var(--deck-hairline))]"}),e.jsx("button",{type:"button","aria-label":t(x?"goal.action.collapse":"goal.action.expand"),className:"min-w-0 flex-1 truncate text-left text-[12px] leading-5 text-[hsl(var(--deck-ink))]/85 outline-none transition-colors hover:text-[hsl(var(--deck-ink))]",onClick:()=>c(E=>!E),"aria-expanded":x,title:a.objective,children:a.objective}),a.tokensUsed>0&&e.jsxs("span",{className:"hidden shrink-0 text-[10px] tabular-nums text-[hsl(var(--deck-ink-muted))] sm:inline",children:[ue(a.tokensUsed),a.tokenBudget!==void 0&&`/${ue(a.tokenBudget)}`]}),e.jsxs("div",{className:"flex shrink-0 items-center",children:[n&&e.jsx(me,{label:t("goal.action.pause"),disabled:F,onClick:()=>void D("pause",r),children:p==="pause"?e.jsx($,{className:"animate-spin"}):e.jsx(Ot,{})}),M&&e.jsx(me,{label:t("goal.action.resume"),disabled:F,onClick:()=>void D("resume",o),children:p==="resume"?e.jsx($,{className:"animate-spin"}):e.jsx(Kt,{})}),e.jsx(me,{label:t(w?"goal.action.edit":"goal.action.expand"),disabled:!w&&!x,onClick:w?j:()=>c(E=>!E),children:w?e.jsx(nt,{}):e.jsx(Bt,{})}),e.jsx(me,{label:t("goal.action.delete"),disabled:F,destructive:!0,onClick:()=>S(!0),children:e.jsx(re,{})})]})]}),x&&e.jsx("div",{className:"rounded-b-lg border border-t-0 border-[hsl(var(--deck-border))]/60 bg-[hsl(var(--deck-surface))]/80 px-4 py-3 backdrop-blur-sm",children:v?e.jsxs("form",{onSubmit:U,children:[e.jsx("textarea",{id:"goal-objective",value:d,onChange:E=>y(E.target.value),onKeyDown:E=>{E.key==="Escape"&&b(!1)},rows:3,autoFocus:!0,className:"w-full resize-none rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-3 py-2 text-[12px] leading-5 text-[hsl(var(--deck-ink))] outline-none transition-shadow focus:border-[hsl(var(--deck-accent))] focus:ring-1 focus:ring-[hsl(var(--deck-accent-glow))]"}),e.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>b(!1),className:"inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-hairline))]/60",children:[e.jsx(st,{className:"h-3 w-3"}),t("goal.action.cancel")]}),e.jsxs("button",{type:"submit",disabled:!d.trim()||p==="edit",className:"inline-flex h-7 items-center gap-1 rounded-md bg-[hsl(var(--deck-accent))] px-2.5 text-[11px] font-medium text-white transition-colors hover:bg-[hsl(var(--deck-accent))]/90 disabled:cursor-not-allowed disabled:opacity-50",children:[p==="edit"?e.jsx($,{className:"h-3 w-3 animate-spin"}):e.jsx(fe,{className:"h-3 w-3"}),t("goal.action.save")]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"whitespace-pre-wrap text-[12px] leading-5 text-[hsl(var(--deck-ink))]/90",children:a.objective}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[10px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Qt,{className:"h-3 w-3"}),ue(a.tokensUsed),a.tokenBudget!==void 0&&` / ${ue(a.tokenBudget)}`," ",t("goal.metrics.tokens")]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Yt,{className:"h-3 w-3"}),zs(a.timeUsedSeconds)]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(he,{className:"h-3 w-3"}),a.continuationCount===1?t("goal.metrics.continuationOne",{n:a.continuationCount}):t("goal.metrics.continuationMany",{n:a.continuationCount})]})]}),a.prematureStop&&e.jsxs("div",{className:"mt-2 inline-flex items-center gap-1.5 font-mono text-[10px] text-amber-700 dark:text-amber-300",children:[e.jsx(he,{className:"h-3 w-3"}),s==="zh"?"恢复提示":"Recovery nudge"," ",a.prematureStop.consecutiveCount," ·"," ",a.prematureStop.pattern.replaceAll("_"," ")]}),a.completionVerification&&e.jsxs("div",{"data-goal-verification":a.completionVerification.status,className:"mt-2 rounded-md border border-sky-200/50 bg-sky-50/60 px-2.5 py-2 text-[11px] text-sky-900 dark:border-sky-400/15 dark:bg-sky-400/[0.05] dark:text-sky-100",children:[e.jsxs("p",{className:"font-mono font-medium",children:["#",a.completionVerification.attempt," ·"," ",a.completionVerification.status.toUpperCase()," ·"," ",((V=a.completionVerification.verifierSessionId)==null?void 0:V.slice(0,12))??"-",a.verificationStall?s==="zh"?` · 重复 ${a.verificationStall.consecutiveCount}/3`:` · repeat ${a.verificationStall.consecutiveCount}/3`:""]}),a.completionVerification.summary&&e.jsx("p",{className:"mt-1 line-clamp-3 whitespace-pre-wrap opacity-80",children:a.completionVerification.summary}),a.completionVerification.evidenceSha256&&e.jsxs("p",{className:"mt-1 font-mono text-[10px] opacity-60",children:["sha256:",a.completionVerification.evidenceSha256.slice(0,12)]})]}),a.statusReason&&e.jsx("div",{className:"mt-2 rounded-md border border-amber-200/50 bg-amber-50/60 px-2.5 py-1.5 text-[11px] text-amber-800 dark:border-amber-400/15 dark:bg-amber-400/[0.05] dark:text-amber-200",children:a.statusReason})]})})]})}),e.jsx(Ge,{open:m,onOpenChange:S,children:e.jsxs(We,{className:"max-w-[400px] border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsx(Je,{children:t("goal.dialog.title")}),e.jsx(Ye,{children:t("goal.dialog.description")}),e.jsxs(Xe,{className:"mt-2",children:[e.jsx("button",{type:"button",onClick:()=>S(!1),className:"inline-flex h-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] px-3 text-[12px] text-[hsl(var(--deck-ink))] hover:bg-[hsl(var(--deck-hairline))]/60",children:t("goal.action.cancel")}),e.jsxs("button",{type:"button",disabled:p==="delete",onClick:()=>void G(),className:"inline-flex gap-1.5 justify-center items-center px-3 h-8 text-[12px] font-medium text-white bg-rose-600 rounded-md hover:bg-rose-500 disabled:opacity-50",children:[p==="delete"&&e.jsx($,{className:"w-3.5 h-3.5 animate-spin"}),t("goal.action.delete")]})]})]})})]})}function me({label:t,children:s,disabled:a,destructive:r,onClick:o}){return e.jsxs(Se,{children:[e.jsx(Ce,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":t,disabled:a,onClick:o,className:I("flex h-6 w-6 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] outline-none transition-colors focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent-glow))]/50 disabled:cursor-not-allowed disabled:opacity-35 [&_svg]:h-3.5 [&_svg]:w-3.5",r?"hover:bg-rose-500/10 hover:text-rose-500":"hover:bg-[hsl(var(--deck-hairline))]/60 hover:text-[hsl(var(--deck-ink))]"),children:s})}),e.jsx(pe,{side:"top",className:"text-[10px]",children:t})]})}function Gs(){const t=_(),s=f(c=>c.currentSessionRef),a=f(c=>c.sessions),r=f(c=>c.messages),o=f(c=>ne(c.historySurfaceSelection)),i=h.useMemo(()=>{var v,b,d,y,p;const c=s?(v=yt(a,s))==null?void 0:v.pendingInteraction:void 0;if(c)return c.type;for(let N=r.length-1;N>=0;N-=1){const m=(b=r[N])==null?void 0:b.agentContent;if(((d=m==null?void 0:m.confirmation)==null?void 0:d.status)==="pending")return"permission";if(((y=m==null?void 0:m.question)==null?void 0:y.status)==="pending")return"question";if(((p=m==null?void 0:m.elicitation)==null?void 0:p.status)==="pending")return"elicitation"}return null},[s,r,a]);if(o||!i)return null;const l=()=>{const c=document.querySelector(`[data-pending-interaction="${i}"]`);c==null||c.scrollIntoView({block:"center",behavior:"smooth"}),window.setTimeout(()=>c==null?void 0:c.focus(),250)},u=i==="question",x=i==="elicitation";return e.jsxs("div",{role:"alert",className:"mx-3 mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-amber-300/80 bg-amber-50/95 px-3 py-2 font-mono text-amber-950 shadow-sm backdrop-blur dark:border-amber-800/80 dark:bg-amber-950/90 dark:text-amber-100 sm:mx-5",children:[e.jsx(Te,{className:"h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"min-w-[180px] flex-1",children:[e.jsx("div",{className:"text-[11.5px] font-semibold",children:t(u?"interaction.bar.questionTitle":x?"interaction.bar.elicitationTitle":"interaction.bar.permissionTitle")}),e.jsx("div",{className:"mt-0.5 text-[10px] leading-4 text-amber-800 dark:text-amber-300",children:t(u?"interaction.bar.questionHint":x?"interaction.bar.elicitationHint":"interaction.bar.permissionHint")})]}),e.jsxs("button",{type:"button",onClick:l,className:"inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-md border border-amber-400/80 bg-white/80 px-2.5 text-[10.5px] font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/70 dark:hover:bg-amber-900",children:[e.jsx(Me,{className:"h-3 w-3"}),t("interaction.bar.review")]})]})}function le(t){return Math.max(0,Math.ceil((t??0)/1e3))}function Ws(t,s=Date.now()){var r;const a=(r=t.snapshot)==null?void 0:r.nextActionAt;return a===void 0?void 0:le(a-s)}function lt(t,s=Date.now()){const a=t==null?void 0:t.snapshot;if(!a)return null;const r=Ws(t,s)??0,o=a.retry,i=a.admission,l=a.stall,u=a.fallback,x={seconds:r,attempt:(o==null?void 0:o.attempt)??0,maxRetries:(o==null?void 0:o.maxRetries)??0,budgetSeconds:le(o==null?void 0:o.recoveryRemainingMs),position:(i==null?void 0:i.queuePosition)??0,depth:i?Math.max(i.queueDepth,i.queuePosition):0,scope:(i==null?void 0:i.scope)??"",waitSeconds:le(i==null?void 0:i.waitMs),stallSeconds:le(l==null?void 0:l.durationMs),timeoutSeconds:le(l==null?void 0:l.timeoutMs),from:(u==null?void 0:u.from.model)??"",to:(u==null?void 0:u.to.model)??"",candidate:(u==null?void 0:u.candidate)??0,candidateCount:(u==null?void 0:u.candidateCount)??0};switch(a.activity){case"admission_wait":return{titleKey:"chat.providerRecovery.admission",detailKey:"chat.providerRecovery.admissionDetail",compactKey:"chat.providerRecovery.admissionCompact",params:x};case"retry_wait":return{titleKey:a.reason==="rate_limit"?"chat.providerRecovery.rateLimit":"chat.providerRecovery.retryWait",detailKey:"chat.providerRecovery.retryDetail",compactKey:"chat.providerRecovery.retryCompact",params:x};case"retry_attempt":return{titleKey:"chat.providerRecovery.retryAttempt",detailKey:"chat.providerRecovery.retryDetail",compactKey:"chat.providerRecovery.retryCompact",params:x};case"circuit_open":return{titleKey:a.reason==="rate_limit"?"chat.providerRecovery.rateLimitCircuit":"chat.providerRecovery.circuit",detailKey:"chat.providerRecovery.circuitDetail",compactKey:a.reason==="rate_limit"?"chat.providerRecovery.rateLimitCircuitCompact":"chat.providerRecovery.circuitCompact",params:x};case"circuit_probe":return{titleKey:"chat.providerRecovery.probe",detailKey:"chat.providerRecovery.probeDetail",compactKey:"chat.providerRecovery.probeCompact",params:x};case"stream_stall":return{titleKey:l!=null&&l.outputStarted?"chat.providerRecovery.stallAfterOutput":"chat.providerRecovery.stall",detailKey:"chat.providerRecovery.stallDetail",compactKey:"chat.providerRecovery.stallCompact",params:x};case"fallback":return{titleKey:"chat.providerRecovery.fallback",detailKey:"chat.providerRecovery.fallbackDetail",compactKey:"chat.providerRecovery.fallbackCompact",params:x}}}function Js({recovery:t,stopping:s,onStop:a}){var x;const r=_(),[o,i]=h.useState(Date.now()),l=(x=t==null?void 0:t.snapshot)==null?void 0:x.nextActionAt;h.useEffect(()=>{if(l===void 0)return;i(Date.now());const c=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(c)},[l]);const u=lt(t,o);return u?e.jsxs("section",{role:"status","aria-live":"polite","data-provider-recovery-banner":!0,className:"mx-4 mb-2 flex min-h-12 items-center gap-3 rounded-lg border border-amber-300/70 bg-amber-50/80 px-3 py-2 text-amber-950 shadow-sm dark:border-amber-800/60 dark:bg-amber-950/35 dark:text-amber-100 md:mx-6",children:[e.jsx($,{className:"h-4 w-4 shrink-0 animate-spin","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-semibold",children:r(u.titleKey,u.params)}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-[10px] opacity-80",children:r(u.detailKey,u.params)})]}),e.jsxs("button",{type:"button","data-provider-recovery-stop":!0,onClick:a,disabled:s,className:"inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/70 px-2.5 text-xs font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 disabled:cursor-wait disabled:opacity-60 dark:border-amber-700 dark:bg-amber-950/50 dark:hover:bg-amber-900/50",children:[s?e.jsx($,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(jt,{className:"h-3 w-3 fill-current","aria-hidden":!0}),r(s?"chat.input.action.stopping":"chat.providerRecovery.stop")]})]}):null}const Ys=h.lazy(()=>Ze(()=>import("./MarkdownRenderer-DHa0FqU0.js").then(t=>t.M),__vite__mapDeps([0,1,2,3,4,5,6])).then(t=>({default:t.MarkdownRenderer})));function Xs(t){return t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function Zs(){const t=_(),s=f(r=>r.sideConversation),a=f(r=>r.dismissSideConversation);return s?e.jsx("section",{"aria-label":t("chat.side.title"),"data-blade-side-conversation":!0,"data-status":s.status,className:"shrink-0 border-y border-[hsl(var(--deck-accent)/0.28)] bg-[hsl(var(--deck-accent-soft)/0.42)]",children:e.jsxs("div",{className:"px-4 py-3 md:px-6",children:[e.jsxs("header",{className:"flex min-h-7 items-start gap-2",children:[e.jsx(Wt,{"aria-hidden":!0,className:"mt-0.5 h-4 w-4 shrink-0 text-[hsl(var(--deck-accent))]"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[e.jsx("h2",{className:"font-mono text-[11px] font-semibold uppercase text-[hsl(var(--deck-accent))]",children:t("chat.side.title")}),s.durationMs!==void 0&&e.jsxs("span",{className:"inline-flex items-center gap-1 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[e.jsx(Vt,{"aria-hidden":!0,className:"h-3 w-3"}),Xs(s.durationMs)]})]}),e.jsx("p",{className:"mt-0.5 break-words font-mono text-[11px] leading-4 text-[hsl(var(--deck-ink-muted))]",children:s.question})]}),e.jsx("button",{type:"button",onClick:a,"aria-label":t("chat.side.dismiss"),title:t("chat.side.dismiss"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:e.jsx(st,{"aria-hidden":!0,className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{"aria-live":"polite","aria-busy":s.status==="loading",className:"mt-2 max-h-[min(36vh,320px)] overflow-y-auto border-l-2 border-[hsl(var(--deck-accent)/0.42)] pl-3 pr-1",children:[s.status==="loading"&&e.jsxs("div",{role:"status",className:"flex min-h-9 items-center gap-2 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsx($,{"aria-hidden":!0,className:"h-3.5 w-3.5 animate-spin text-[hsl(var(--deck-accent))]"}),t("chat.side.loading")]}),s.status==="error"&&e.jsxs("div",{role:"alert",className:"flex min-h-9 items-start gap-2 font-mono text-[11px] leading-5 text-red-700 dark:text-red-300",children:[e.jsx(Te,{"aria-hidden":!0,className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"break-words",children:s.error??t("chat.side.failed")})]}),s.status==="completed"&&s.response&&e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"whitespace-pre-wrap break-words font-mono text-[12px] leading-5 text-[hsl(var(--deck-ink))]",children:s.response}),children:e.jsx(Ys,{content:s.response,className:"text-[12px] leading-5 [&_h1]:text-[14px] [&_h2]:text-[13px] [&_h3]:text-[12px]"})})]})]})}):null}function je(t){return Number.isFinite(t)?Math.max(0,t):0}function ea(t){const s=je(t.totalInputTokens),a=je(t.cacheReadTokens),r=je(t.cacheWriteTokens),o=Math.min(a,s),i=Math.min(r,Math.max(0,s-o)),l=Math.max(0,s-o-i),u=s>0&&(a>0||r>0);return{totalInputTokens:s,cacheReadTokens:o,cacheWriteTokens:i,uncachedInputTokens:l,...u?{hitRate:o/s}:{}}}function ta(t){return t===void 0||!Number.isFinite(t)?"—":`${Math.round(Math.max(0,Math.min(1,t))*100)}%`}const sa={running:"status.phase.running",compacting:"status.phase.compacting",recovering_context:"status.phase.recoveringContext",switching_model:"status.phase.switchingModel",waiting_permission:"status.phase.waitingPermission",error:"status.phase.error",idle:""},aa={model_changed:"status.cacheBreak.model",system_prompt_changed:"status.cacheBreak.system",tools_changed:"status.cacheBreak.tools",request_policy_changed:"status.cacheBreak.policy",ttl_expired:"status.cacheBreak.ttl",server_side:"status.cacheBreak.server"},ee=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString(),ra=t=>{const s=Math.max(0,Math.ceil(t/1e3)),a=Math.floor(s/60),r=s%60;return a>0?`${a}m ${r}s`:`${r}s`};function dt(){const t=_(),s=f(n=>n.tokenUsage),a=f(n=>n.isStreaming),r=f(n=>n.agentPhase),o=f(n=>n.providerRecovery),i=f(n=>n.turnActivity),l=f(n=>n.pendingResume),u=f(n=>n.actionStationarity),x=f(n=>n.turnRecovery),c=sa[r]??"",v=lt(o),b=(l==null?void 0:l.delayMs)!==void 0?` · retry in ${ra(l.delayMs)}`:"",d=(x==null?void 0:x.state)==="requires_attention"?t("status.recovery.review"):"",y=(x==null?void 0:x.state)==="requires_attention"?t(x.reason==="interrupted_tool_call"?"status.recovery.interruptedTool":"status.recovery.successfulTool"):"",p=d||(u?`${t(u.phase==="halted"?"status.phase.actionStationarityStopped":"status.phase.actionStationarityRecovering")} · ${u.toolName} · ${u.runLength}/${u.haltThreshold}`:v?t(v.compactKey,v.params):l?`Recovery attempt ${l.attempt}/${l.maxAttempts}${b}`:c?t(c):""),N=s.maxContextTokens>0?Math.round(s.totalTokens/s.maxContextTokens*100):0,m=ea(s),S=ta(m.hitRate),g=Math.min(N,100),w=N>95?"danger":N>80?"warn":"safe";return e.jsxs("div",{"data-chat-status-bar":!0,className:"flex items-center gap-2 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]/70 px-3 py-2 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] backdrop-blur-sm sm:gap-4 sm:px-5",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:t("status.context")}),e.jsxs("span",{className:"flex gap-1 items-baseline tabular-nums",children:[e.jsx("span",{className:I("text-[12px] font-medium",w==="safe"&&"text-[hsl(var(--deck-ink))]",w==="warn"&&"text-amber-600 dark:text-amber-400",w==="danger"&&"text-red-600 dark:text-red-400"),children:ee(s.totalTokens)}),e.jsxs("span",{className:"text-[hsl(var(--deck-ink-faint))]",children:["/ ",ee(s.maxContextTokens)]})]}),s.isDefaultMaxTokens&&e.jsx(Ne,{children:e.jsxs(Se,{children:[e.jsx(Ce,{asChild:!0,children:e.jsx(zt,{className:"h-3 w-3 cursor-help text-[hsl(var(--deck-ink-faint))]"})}),e.jsx(pe,{side:"top",className:"max-w-[220px]",children:e.jsx("p",{className:"text-xs",children:t("status.tokenLimitTooltip")})})]})}),e.jsxs("div",{className:"relative hidden h-2 w-32 overflow-hidden rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] sm:block","aria-hidden":"true",children:[e.jsx("div",{className:I("absolute inset-y-0 left-0 transition-[width] duration-300",w==="safe"&&"bg-[hsl(var(--deck-accent))]",w==="warn"&&"bg-amber-500",w==="danger"&&"bg-red-500"),style:{width:`${g}%`}}),e.jsx("div",{className:"flex absolute inset-0 pointer-events-none",children:[25,50,75].map(n=>e.jsx("span",{className:"absolute inset-y-0 w-px bg-[hsl(var(--deck-canvas-veil))]/60",style:{left:`${n}%`}},n))})]}),e.jsxs("span",{className:I("w-10 text-right tabular-nums text-[hsl(var(--deck-ink-faint))]",w==="warn"&&"text-amber-600 dark:text-amber-400",w==="danger"&&"text-red-600 dark:text-red-400"),children:[N,"%"]})]}),e.jsx(Ne,{children:e.jsxs(Se,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs("div",{className:"flex shrink-0 cursor-help items-baseline gap-2 border-l border-[hsl(var(--deck-hairline))] pl-2 sm:pl-4","data-testid":"prompt-cache-hit-rate","aria-label":`${t("status.cache")} ${S}`,children:[e.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:t("status.cache")}),e.jsx("span",{className:I("tabular-nums",m.hitRate===void 0?"text-[hsl(var(--deck-ink-faint))]":"font-medium text-[hsl(var(--deck-accent))]"),children:S})]})}),e.jsx(pe,{side:"top",className:"max-w-[280px]",children:m.hitRate===void 0?e.jsx("p",{className:"text-xs",children:t("status.cacheUnavailable")}):e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("p",{children:t("status.cacheTooltip")}),e.jsx("p",{className:"font-mono tabular-nums",children:t("status.cacheDetails",{read:ee(m.cacheReadTokens),write:ee(m.cacheWriteTokens),uncached:ee(m.uncachedInputTokens)})}),s.cacheBreak&&e.jsx("p",{className:"text-[hsl(var(--deck-accent))]",children:t("status.cacheBreak",{reason:t(aa[s.cacheBreak.reason]??"status.cacheBreak.server"),previous:ee(s.cacheBreak.previousCacheReadTokens),current:ee(s.cacheBreak.cacheReadTokens)})})]})})]})}),e.jsx("div",{className:"flex-1"}),(d||a&&p&&(!(i!=null&&i.snapshot)||u))&&e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:I("shrink-0",d?"h-2 w-2 rounded-sm bg-amber-500":"deck-pulse-dot")}),e.jsxs("span",{className:I("truncate",d?"text-amber-600 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[p,y?e.jsxs("span",{className:"hidden sm:inline",children:[" · ",y]}):null]})]})]})}function na(){const{locale:t}=tt(),s=wt(n=>n.agentTeamsEnabled),a=f(n=>n.teams),r=f(n=>n.currentSessionRef),o=f(n=>ne(n.historySurfaceSelection)),i=f(n=>n.loadTeams),[l,u]=h.useState({}),[x,c]=h.useState({}),[v,b]=h.useState({}),[d,y]=h.useState(null),[p,N]=h.useState(null),[m,S]=h.useState(null);if(h.useEffect(()=>{o||i(r??void 0)},[s,r,o,i]),o||!s||!r||a.length===0)return null;const g=async n=>{var F;if(O(f.getState()))return;const M=(F=v[n])==null?void 0:F.trim();if(!(!M||d)){y(n),S(null);try{await _e.sendMessage(r,n,x[n]??"*",M),b(D=>({...D,[n]:""})),await i(r)}catch(D){S(D instanceof Error?D.message:L(t,"actionFailed"))}finally{y(null)}}},w=async n=>{if(!O(f.getState())&&!p){N(n),S(null);try{await _e.delete(r,n),await i(r)}catch(M){S(M instanceof Error?M.message:L(t,"actionFailed"))}finally{N(null)}}};return e.jsxs("section",{"aria-label":L(t,"title"),"data-blade-team-panel":!0,className:"shrink-0 border-y border-emerald-300/50 bg-emerald-50/55 dark:border-emerald-800/55 dark:bg-emerald-950/20",children:[m&&e.jsx("div",{role:"alert",className:"border-b border-red-200 bg-red-50 px-4 py-2 font-mono text-[10px] text-red-700 dark:border-red-900 dark:bg-red-950/30 dark:text-red-300 md:px-6",children:m}),a.filter(n=>n.status!=="deleted").map(n=>{var D;const M=l[n.name]??n.status==="running",F=n.tasks.filter(j=>j.status==="completed").length;return e.jsxs("div",{className:"border-b border-emerald-200/40 last:border-0 dark:border-emerald-900/40",children:[e.jsxs("div",{className:"flex min-h-11 items-center gap-2 px-4 py-2 md:px-6",children:[e.jsx("button",{type:"button",onClick:()=>u(j=>({...j,[n.name]:!M})),"aria-label":M?L(t,"collapse"):L(t,"expand"),className:"flex h-7 w-7 items-center justify-center rounded-md text-emerald-700 hover:bg-emerald-100 dark:text-emerald-300 dark:hover:bg-emerald-900/50",children:M?e.jsx(de,{className:"h-4 w-4"}):e.jsx(ie,{className:"h-4 w-4"})}),e.jsx(Xt,{className:"h-4 w-4 shrink-0 text-emerald-700 dark:text-emerald-300"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[e.jsx("h2",{className:"truncate font-mono text-[11px] font-semibold uppercase text-emerald-800 dark:text-emerald-200",children:n.name}),e.jsxs("span",{className:"font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[n.status," · ",n.members.length-1," ",L(t,"members")," · ",F,"/",n.tasks.length," ",L(t,"tasks")]})]}),n.description&&e.jsx("p",{className:"truncate font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:n.description})]}),e.jsx("button",{type:"button",onClick:()=>void w(n.name),disabled:p===n.name,"aria-label":L(t,"delete"),title:L(t,"delete"),className:"flex h-7 w-7 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-red-50 hover:text-red-600 disabled:opacity-40 dark:hover:bg-red-950/40",children:e.jsx(re,{className:"h-3.5 w-3.5"})})]}),M&&e.jsxs("div",{className:"max-h-[min(40vh,360px)] overflow-y-auto border-t border-emerald-200/40 px-4 py-3 md:px-6 dark:border-emerald-900/40",children:[e.jsxs("div",{className:"grid gap-x-6 gap-y-2 lg:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 font-mono text-[9.5px] font-semibold uppercase text-[hsl(var(--deck-ink-faint))]",children:L(t,"members")}),n.members.map(j=>e.jsxs("div",{className:"flex min-h-7 items-center gap-2 border-b border-[hsl(var(--deck-hairline)/0.55)] py-1 last:border-0",children:[e.jsx("span",{"aria-label":j.status,className:`h-1.5 w-1.5 shrink-0 rounded-full ${j.status==="running"?"bg-emerald-500":j.status==="completed"||j.status==="leader"?"bg-sky-500":j.status==="failed"?"bg-red-500":"bg-zinc-400"}`}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink))]",children:j.name}),e.jsx("span",{className:"font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:j.subagentType}),j.worktreePath&&e.jsx(ze,{className:"h-3 w-3 text-[hsl(var(--deck-ink-faint))]","aria-label":L(t,"worktree")})]},j.id))]}),e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 font-mono text-[9.5px] font-semibold uppercase text-[hsl(var(--deck-ink-faint))]",children:L(t,"tasks")}),n.tasks.length===0?e.jsx("p",{className:"font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:L(t,"noTasks")}):n.tasks.map(j=>e.jsxs("div",{className:"flex min-h-7 items-center gap-2 border-b border-[hsl(var(--deck-hairline)/0.55)] py-1 last:border-0",children:[e.jsxs("span",{className:"w-5 shrink-0 font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:["#",j.id]}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink))]",children:j.subject}),e.jsx("span",{className:"font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:j.status})]},j.id))]})]}),n.peerMessagingEnabled&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-emerald-200/40 pt-3 dark:border-emerald-900/40",children:[e.jsxs("select",{"aria-label":L(t,"recipient"),value:x[n.name]??"*",onChange:j=>c(U=>({...U,[n.name]:j.target.value})),className:"h-8 max-w-32 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))] px-2 font-mono text-[10px]",children:[e.jsx("option",{value:"*",children:L(t,"broadcast")}),n.members.filter(j=>j.status!=="leader").map(j=>e.jsx("option",{value:j.name,children:j.name},j.id))]}),e.jsx("input",{value:v[n.name]??"",onChange:j=>b(U=>({...U,[n.name]:j.target.value})),onKeyDown:j=>{j.key==="Enter"&&g(n.name)},placeholder:L(t,"messagePlaceholder"),className:"h-8 min-w-0 flex-1 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))] px-2 font-mono text-[10.5px] outline-none focus:border-emerald-500"}),e.jsx("button",{type:"button",onClick:()=>void g(n.name),disabled:!((D=v[n.name])!=null&&D.trim())||d===n.name,"aria-label":L(t,"send"),title:L(t,"send"),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-emerald-700 text-white hover:bg-emerald-800 disabled:opacity-40 dark:bg-emerald-600",children:e.jsx(qe,{className:"h-3.5 w-3.5"})})]})]})]},n.name)})]})}const ia={starting:"chat.turnActivity.starting",thinking:"chat.turnActivity.thinking",responding:"chat.turnActivity.responding",executing_tools:"chat.turnActivity.executingTools",compacting:"chat.turnActivity.compacting",continuing:"chat.turnActivity.continuing"};function oa(t){const s=Math.max(0,Math.floor(t/1e3));if(s<60)return`${s}s`;const a=Math.floor(s/60),r=s%60;return a<60?`${a}m ${r}s`:`${Math.floor(a/60)}h ${a%60}m ${r}s`}function ca(t,s=Date.now()){const a=t==null?void 0:t.snapshot;if(!a)return null;const r=a.activeTools.length+a.activeToolOverflow,o=a.activeTools.slice(0,2).map(l=>l.progress!==void 0&&l.total!==void 0?`${l.name} ${l.progress}/${l.total}`:l.name),i=Math.max(0,a.activeTools.length-o.length+a.activeToolOverflow);return{phaseKey:ia[a.phase],phaseParams:{count:r},tools:o,hiddenTools:i,completedTools:a.toolCallsCompleted,startedTools:a.toolCallsStarted,turn:a.turn,maxTurns:a.maxTurns,elapsed:oa(s-a.startedAt)}}function la({activity:t,memory:s=null}){var x;const a=_(),[r,o]=h.useState(Date.now()),i=(x=t==null?void 0:t.snapshot)==null?void 0:x.startedAt;h.useEffect(()=>{if(i===void 0)return;o(Date.now());const c=window.setInterval(()=>o(Date.now()),1e3);return()=>window.clearInterval(c)},[i]);const l=ca(t,r);if(!l)return(s==null?void 0:s.outcome)!=="written"?null:e.jsxs("section",{role:"status","aria-live":"polite","data-memory-consolidation-notice":!0,className:"mx-4 mb-2 flex min-h-10 items-center gap-3 rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]/80 px-3 py-2 text-[hsl(var(--deck-ink))] shadow-sm md:mx-6",children:[e.jsx($e,{className:"h-4 w-4 shrink-0 text-[hsl(var(--deck-accent))]","aria-hidden":!0}),e.jsx("span",{className:"text-xs font-semibold",children:a("chat.memoryConsolidation.saved",{count:s.entries})})]});const u=[(s==null?void 0:s.outcome)==="written"?a("chat.memoryConsolidation.saved",{count:s.entries}):void 0,...l.tools,l.hiddenTools>0?`+${l.hiddenTools}`:void 0,l.startedTools>0?a("chat.turnActivity.toolCount",{completed:l.completedTools,started:l.startedTools}):void 0,l.turn>0?l.maxTurns===null?a("chat.turnActivity.turn",{turn:l.turn}):a("chat.turnActivity.turnBounded",{turn:l.turn,maxTurns:l.maxTurns}):void 0].filter(c=>c!==void 0);return e.jsxs("section",{role:"status","aria-live":"polite","data-turn-activity-strip":!0,className:"mx-4 mb-2 flex min-h-10 items-center gap-3 rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]/80 px-3 py-2 text-[hsl(var(--deck-ink))] shadow-sm md:mx-6",children:[e.jsx($e,{className:"h-4 w-4 shrink-0 text-[hsl(var(--deck-accent))] motion-safe:animate-pulse","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-semibold",children:a(l.phaseKey,l.phaseParams)}),u.length>0&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:u.join(" · ")})]}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-[hsl(var(--deck-ink-muted))]",children:l.elapsed})]})}function da(t){const s=[...t].reverse().find(o=>o.role==="user");if(!s)return null;if(typeof s.content=="string")return{content:s.content,attachments:[]};const a=s.content.filter(o=>o.type==="text").map(o=>o.text).join(`
63
+ `),r=s.content.filter(o=>o.type==="image_url").map((o,i)=>{var u;const l=((u=o.image_url.url.match(/^data:([^;,]+)[;,]/))==null?void 0:u[1])??"application/octet-stream";return{id:`recovery-${s.id}-${i}`,name:`attachment-${i+1}`,mimeType:l,dataUrl:o.image_url.url}});return{content:a,attachments:r}}function ua({messages:t,isLoading:s,isStreaming:a,isStopping:r,errorMessage:o}){const i=_(),[l,u]=h.useState(!1),x=i(o?"status.phase.error":r?"chat.input.action.stopping":a?"status.phase.running":"preview.files.status.ready");return e.jsxs("details",{"data-preview-status-disclosure":!0,open:l,onToggle:c=>u(c.currentTarget.open),className:"group hidden",children:[e.jsxs("summary",{className:"flex h-9 cursor-pointer list-none items-center gap-2 px-3 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))]",children:[a&&e.jsx("span",{className:"deck-pulse-dot"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:x}),e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-90"})]}),l&&e.jsxs("div",{"data-preview-activity-details":!0,className:"flex h-[min(44vh,420px)] min-h-0 flex-col border-t border-[hsl(var(--deck-hairline))]",children:[o&&e.jsx("div",{role:"alert",className:"border-b border-red-200/60 bg-red-50/80 px-3 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300",children:o}),e.jsx(ct,{messages:t,isLoading:s}),e.jsx(dt,{})]})]})}function Ta(){var Fe;const t=_(),s=f(k=>k.messages),a=f(k=>k.currentSessionRef),r=f(k=>k.isStreaming),o=f(k=>k.isStopping),i=f(k=>k.providerRecovery),l=f(k=>k.turnActivity),u=f(k=>k.memoryConsolidation),x=f(k=>k.actionStationarity),c=f(k=>k.sessionEventConnectionState),v=f(k=>k.pendingSteeringCount),b=f(k=>k.pendingInputDelivery),d=f(k=>k.recoveredSteeringCount),y=f(k=>k.followUpQueue),p=f(k=>k.followUpQueueMutation),N=f(k=>k.mutateFollowUpQueue),m=f(k=>k.refreshFollowUpQueue),S=f(k=>!!k.historySurfaceSelection),g=f(k=>k.isLoading),w=f(k=>k.error),n=f(k=>k.errorContext),M=f(k=>k.sessions),F=f(k=>k.sendMessage),D=f(k=>k.abortSession),j=f(k=>k.retryTask),U=f(k=>k.retryingTaskKeys),G=Ee(k=>k.openSettings),C=f(k=>k.reconnectSessionEvents),T=f(k=>k.clearError),[A,B]=h.useState(null),P=a?M.find(k=>k.sessionId===a.sessionId&&k.projectPath===a.projectPath):void 0,X=!!w&&((n==null?void 0:n.kind)==="navigation"||!(n!=null&&n.sessionRef)||Qe(n.sessionRef,a)),H=(n==null?void 0:n.failureCode)??((Fe=P==null?void 0:P.taskFailure)==null?void 0:Fe.code),Y=((n==null?void 0:n.kind)==="execution"||n!=null&&n.failureCode)&&H?t(Rt(H)):w==="queue_full"?t("chat.error.queueFull"):w==="turn_unavailable"||w==="turn_active"?t("chat.error.turnChanged"):w,W=c==="connecting"||c==="reconnecting",Z=r&&c!=="connected",R=a?`session:${ce(a)}`:"session:temporary",z=h.useMemo(()=>da(s),[s]),q=a?ce(a):"temporary-session",K=!!(a&&(P!=null&&P.taskRetryAvailable)&&(!H||Dt(H)))&&((n==null?void 0:n.kind)==="execution"||(n==null?void 0:n.kind)==="task_action"),V=(n==null?void 0:n.kind)==="execution"&&(H==="authentication"||H==="permission"||H==="model_unavailable"),E=a?U.includes(ce(a)):!1;h.useEffect(()=>{B(null)},[q]);const Q=async k=>O(f.getState())?!1:F({content:k.content,modelId:k.modelId,reasoningEffort:k.reasoningEffort,serviceTier:k.serviceTier,responseVerbosity:k.responseVerbosity,communicationStyle:k.communicationStyle,...k.outputSchema?{outputSchema:k.outputSchema}:{},attachments:k.attachments.map(ve=>({type:"image",content:ve.dataUrl,mimeType:ve.mimeType,name:ve.name}))}),se=()=>{if(!O(f.getState()))return D()},ut=async()=>{if(!O(f.getState())){if(V){T(),G("models");return}if(K&&a){T(),await j(a).catch(()=>{});return}if((n==null?void 0:n.kind)==="execution"&&z){B({...z,revision:Date.now()}),T();return}T(),requestAnimationFrame(()=>Ct())}},De=K?t(E?"chat.error.action.retryingTask":"chat.error.action.retryTask"):V?t("chat.error.action.checkModels"):(n==null?void 0:n.kind)==="execution"&&z?t("chat.error.action.editResend"):(n==null?void 0:n.kind)==="submission"?t("chat.error.action.returnDraft"):null;return e.jsxs("div",{"data-chat-view":!0,className:"flex h-full flex-col bg-[hsl(var(--deck-canvas))]",children:[e.jsxs("div",{"data-chat-history":!0,className:"contents",children:[X&&e.jsxs("div",{role:"alert","data-blade-session-error":!0,className:"flex min-h-11 flex-wrap items-center gap-2 border-b border-red-200/60 bg-red-50/80 px-4 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300 sm:px-5",children:[e.jsx(Te,{className:"h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 break-words",children:[e.jsx("span",{className:"font-semibold",children:t((n==null?void 0:n.kind)==="submission"?"chat.error.title.submission":(n==null?void 0:n.kind)==="execution"?"chat.error.title.execution":(n==null?void 0:n.kind)==="navigation"?"chat.error.title.navigation":"chat.error.title.generic")})," ",Y]}),De&&e.jsxs("button",{type:"button",onClick:()=>void ut(),disabled:E,className:"inline-flex min-h-7 shrink-0 items-center gap-1.5 rounded-md border border-red-300/70 bg-white/65 px-2.5 font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60 dark:border-red-800 dark:bg-red-950/45 dark:hover:bg-red-900/60",children:[K?E?e.jsx($,{className:"h-3 w-3 animate-spin"}):e.jsx(he,{className:"h-3 w-3"}):e.jsx(nt,{className:"h-3 w-3"}),De]}),e.jsx("button",{type:"button",onClick:T,"aria-label":t("chat.error.dismiss"),className:"p-1 text-red-500 rounded transition-colors hover:bg-red-100/60 hover:text-red-700 dark:hover:bg-red-950/60 dark:hover:text-red-100",children:"✕"})]}),(W||c==="offline")&&e.jsxs("div",{role:c==="offline"?"alert":"status","aria-live":"polite",className:"flex min-h-10 flex-wrap items-center gap-2 border-b border-amber-300/60 bg-amber-50/80 px-4 py-2 font-mono text-[11px] text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/35 dark:text-amber-200 sm:px-5",children:[W?e.jsx($,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}):e.jsx(Nt,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1",children:t(W?"chat.connection.reconnecting":"chat.connection.offline")}),c==="offline"&&e.jsxs("button",{type:"button",onClick:()=>{O(f.getState())||C().catch(()=>{})},className:"inline-flex min-h-7 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/50 dark:hover:bg-amber-900/50",children:[e.jsx(et,{className:"h-3 w-3"}),t("chat.connection.retry")]})]}),e.jsx(Zt,{}),e.jsx(ct,{messages:s,isLoading:g},a?ce(a):"temporary-session"),e.jsx(na,{}),e.jsx(Zs,{})]}),e.jsxs("div",{"data-chat-composer-dock":!0,className:"contents",children:[e.jsx(ua,{messages:s,isLoading:g,isStreaming:r,isStopping:o,errorMessage:X?Y:null},q),e.jsx(Gs,{}),e.jsx(qs,{}),e.jsx(Hs,{queue:S?null:y,mutation:p,onMutate:N,onRefresh:m}),e.jsx(Js,{recovery:S?null:i,stopping:o,onStop:se}),e.jsx(la,{activity:S||i!=null&&i.snapshot||x||P!=null&&P.pendingInteraction?null:l,memory:S?null:u}),e.jsx(St,{draftKey:R,draft:A==null?void 0:A.content,draftAttachments:A==null?void 0:A.attachments,draftRevision:A==null?void 0:A.revision,onSend:Q,onAbort:se,disabled:g||Z,isStreaming:r,isStopping:o,pendingSteeringCount:v,pendingInputDelivery:b,recoveredSteeringCount:d,workspacePath:a==null?void 0:a.projectPath},R),e.jsx("div",{"data-chat-primary-status":!0,className:"contents",children:e.jsx(dt,{})})]})]})}export{Ta as ChatView};
@@ -1,4 +1,4 @@
1
- import{R as I,j as Ke}from"./vendor-react-DofNRwfy.js";import{f as Ve,p as Se,a as xe,n as Ae,h as Je,s as Qe,d as Ne}from"./MarkdownRenderer-TWNqhwrr.js";import"./index-VQVOzFZT.js";import"./vendor-radix-D6QrtXqd.js";import"./session-events-DKjIMNKI.js";import"./copy-CF3TUa0u.js";function Pe(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;n[a]=e[a]}return n}function et(e,t){if(e==null)return{};var n,a,o=Pe(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function tt(e){if(Array.isArray(e))return se(e)}function nt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function at(e,t){if(e){if(typeof e=="string")return se(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?se(e,t):void 0}}function ot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{R as I,j as Ke}from"./vendor-react-DofNRwfy.js";import{f as Ve,p as Se,a as xe,n as Ae,h as Je,s as Qe,d as Ne}from"./MarkdownRenderer-DHa0FqU0.js";import"./index-hZ37pkxs.js";import"./vendor-radix-D6QrtXqd.js";import"./session-events-FPOvcMBw.js";import"./copy-Bd5v-KkM.js";function Pe(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;n[a]=e[a]}return n}function et(e,t){if(e==null)return{};var n,a,o=Pe(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function tt(e){if(Array.isArray(e))return se(e)}function nt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function at(e,t){if(e){if(typeof e=="string")return se(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?se(e,t):void 0}}function ot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function le(e){return tt(e)||nt(e)||at(e)||ot()}function Z(e){"@babel/helpers - typeof";return Z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(e)}function rt(e,t){if(Z(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(Z(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function it(e){var t=rt(e,"string");return Z(t)=="symbol"?t:t+""}function Te(e,t,n){return(t=it(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ce.apply(null,arguments)}function Ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ee(Object(n),!0).forEach(function(a){Te(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function st(e){var t=e.length;if(t===0||t===1)return e;if(t===2)return[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])];if(t===3)return[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])];if(t>=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var ie={};function lt(e){if(e.length===0||e.length===1)return e;var t=e.join(".");return ie[t]||(ie[t]=st(e)),ie[t]}function ct(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,a=e.filter(function(r){return r!=="token"}),o=lt(a);return o.reduce(function(r,s){return H(H({},r),n[s])},t)}function Fe(e){return e.join(" ")}function ut(e,t){var n=0;return function(a){return n+=1,a.map(function(o,r){return Ie({node:o,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(r)})})}}function Ie(e){var t=e.node,n=e.stylesheet,a=e.style,o=a===void 0?{}:a,r=e.useInlineStyles,s=e.key,i=t.properties,c=t.type,l=t.tagName,u=t.value;if(c==="text")return u;if(l){var g=ut(n,r),d;if(!r)d=H(H({},i),{},{className:Fe(i.className)});else{var p=Object.keys(n).reduce(function(b,w){return w.split(".").forEach(function(N){b.includes(N)||b.push(N)}),b},[]),f=i.className&&i.className.includes("token")?["token"]:[],v=i.className&&f.concat(i.className.filter(function(b){return!p.includes(b)}));d=H(H({},i),{},{className:Fe(v)||void 0,style:ct(i.className,Object.assign({},i.style,o),n)})}var y=g(t.children);return I.createElement(l,ce({key:s},d),y)}}const dt=function(e,t){var n=e.listLanguages();return n.indexOf(t)!==-1};var gt=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function $e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$e(Object(n),!0).forEach(function(a){Te(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}var pt=/\n/g;function ft(e){return e.match(pt)}function ht(e){var t=e.lines,n=e.startingLineNumber,a=e.style;return t.map(function(o,r){var s=r+n;return I.createElement("span",{key:"line-".concat(r),className:"react-syntax-highlighter-line-number",style:typeof a=="function"?a(s):a},"".concat(s,`
3
3
  `))})}function bt(e){var t=e.codeString,n=e.codeStyle,a=e.containerStyle,o=a===void 0?{float:"left",paddingRight:"10px"}:a,r=e.numberStyle,s=r===void 0?{}:r,i=e.startingLineNumber;return I.createElement("code",{style:Object.assign({},n,o)},ht({lines:t.replace(/\n$/,"").split(`
4
4
  `),style:s,startingLineNumber:i}))}function mt(e){return"".concat(e.toString().length,".25em")}function Re(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function De(e,t,n){var a={display:"inline-block",minWidth:mt(n),paddingRight:"1em",textAlign:"right",userSelect:"none"},o=typeof e=="function"?e(t):e,r=R(R({},a),o);return r}function J(e){var t=e.children,n=e.lineNumber,a=e.lineNumberStyle,o=e.largestLineNumber,r=e.showInlineLineNumbers,s=e.lineProps,i=s===void 0?{}:s,c=e.className,l=c===void 0?[]:c,u=e.showLineNumbers,g=e.wrapLongLines,d=e.wrapLines,p=d===void 0?!1:d,f=p?R({},typeof i=="function"?i(n):i):{};if(f.className=f.className?[].concat(le(f.className.trim().split(/\s+/)),le(l)):l,n&&r){var v=De(a,n,o);t.unshift(Re(n,v))}return g&u&&(f.style=R({display:"flex"},f.style)),{type:"element",tagName:"span",properties:f,children:t}}function ze(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var a=0;a<e.length;a++){var o=e[a];if(o.type==="text")n.push(J({children:[o],className:le(new Set(t))}));else if(o.children){var r,s=t.concat(((r=o.properties)===null||r===void 0?void 0:r.className)||[]);ze(o.children,s).forEach(function(i){return n.push(i)})}}return n}function yt(e,t,n,a,o,r,s,i,c){var l,u=ze(e.value),g=[],d=-1,p=0;function f(S,k){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return J({children:S,lineNumber:k,lineNumberStyle:i,largestLineNumber:s,showInlineLineNumbers:o,lineProps:n,className:x,showLineNumbers:a,wrapLongLines:c,wrapLines:t})}function v(S,k){if(a&&k&&o){var x=De(i,k,s);S.unshift(Re(k,x))}return S}function y(S,k){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||x.length>0?f(S,k,x):v(S,k)}for(var b=function(){var k=u[p],x=k.children[0].value,E=ft(x);if(E){var j=x.split(`
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B5mUEr6D.js","assets/vendor-react-DofNRwfy.js"])))=>i.map(i=>d[i]);
2
- import{c as le,j as _,Z as Ke,r as at,L as Be,N as q,af as gr,ag as kr,S as wr,p as Vt,R as Kt,B as yr,a as W,J as Jt,d as jr,ah as Nr,z as Sr,u as je,U as mt,n as Qt,F as Xt,ai as Cr,s as Je,aj as dt,l as Er,X as Tr,x as Rr,_ as Lr}from"./index-VQVOzFZT.js";import{r as i,j as e}from"./vendor-react-DofNRwfy.js";import{x as Pr,a4 as Ct,M as Qe,Z,_ as Et}from"./session-events-DKjIMNKI.js";import{a as Ir,A as Dr,C as Fr}from"./chevrons-up-down-Jw3ElnjQ.js";import{A as $r,E as Tt}from"./external-link-BKCjDDt-.js";import{A as Mr}from"./arrow-left-z3DhPgf-.js";import{A as Ar,F as _r}from"./folder-M-NM2bQG.js";import{C as Yt}from"./chevron-right-BGTvSaVS.js";import"./vendor-radix-D6QrtXqd.js";/**
2
+ import{c as le,j as _,Z as Ke,r as at,L as Be,N as q,af as gr,ag as kr,S as wr,p as Vt,R as Kt,B as yr,a as W,J as Jt,d as jr,ah as Nr,z as Sr,u as je,U as mt,n as Qt,F as Xt,ai as Cr,s as Je,aj as dt,l as Er,X as Tr,x as Rr,_ as Lr}from"./index-hZ37pkxs.js";import{r as i,j as e}from"./vendor-react-DofNRwfy.js";import{x as Pr,a4 as Ct,M as Qe,Z,_ as Et}from"./session-events-FPOvcMBw.js";import{a as Ir,A as Dr,C as Fr}from"./chevrons-up-down-BXNG4GvK.js";import{A as $r,E as Tt}from"./external-link-B33h3DQN.js";import{A as Mr}from"./arrow-left-a5_iLemp.js";import{A as Ar,F as _r}from"./folder-lOczceoh.js";import{C as Yt}from"./chevron-right-8qYRfCj4.js";import"./vendor-radix-D6QrtXqd.js";/**
3
3
  * @license lucide-react v0.300.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{j as e,r as b}from"./vendor-react-DofNRwfy.js";import{c as J,u as U,b as j,d as z,E as ce,I as ve,j as P,L as E,R as ge,w as je,J as Ne,K as ye,t as we,A as Se,D as Pe,e as Te,f as Ce,g as De,h as Ie,M as ie,i as Ae,N as ne,a as s,O as _e,Q as Ke,U as Ee,V as Me,W as Fe,p as Oe,Y as Re}from"./index-VQVOzFZT.js";import{M as Le,_ as Q,Z as O}from"./session-events-DKjIMNKI.js";import{C as le}from"./calendar-clock-tYt1E6zR.js";import{P as qe}from"./pencil-U3n9D8ed.js";import{A as ze}from"./archive-CPBIxP8f.js";import{C as Be}from"./clock-3-v0h4RrLK.js";import{P as Ve}from"./play-NBWnc2gU.js";import{P as Qe}from"./pause-CP_wlUro.js";import{P as Ue}from"./plus-CmPqJgff.js";import"./vendor-radix-D6QrtXqd.js";/**
1
+ import{j as e,r as b}from"./vendor-react-DofNRwfy.js";import{c as J,u as U,b as j,d as z,E as ce,I as ve,j as P,L as E,R as ge,w as je,J as Ne,K as ye,t as we,A as Se,D as Pe,e as Te,f as Ce,g as De,h as Ie,M as ie,i as Ae,N as ne,a as s,O as _e,Q as Ke,U as Ee,V as Me,W as Fe,p as Oe,Y as Re}from"./index-hZ37pkxs.js";import{M as Le,_ as Q,Z as O}from"./session-events-FPOvcMBw.js";import{C as le}from"./calendar-clock-BKbdz6Cu.js";import{P as qe}from"./pencil-_yfoOmUq.js";import{A as ze}from"./archive-Ao0WD7pU.js";import{C as Be}from"./clock-3-DEL1ixyh.js";import{P as Ve}from"./play-BilJ7SDs.js";import{P as Qe}from"./pause-nnvVbgsj.js";import{P as Ue}from"./plus-BqqpYKaK.js";import"./vendor-radix-D6QrtXqd.js";/**
2
2
  * @license lucide-react v0.300.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.