blade-code 0.10.148 → 0.10.150

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 (74) hide show
  1. package/dist/blade.js +2 -2
  2. package/dist/{chunk-zm1ppb3t.js → chunk-01framym.js} +1 -1
  3. package/dist/{chunk-6b235jg2.js → chunk-0ktd3vpk.js} +1 -1
  4. package/dist/chunk-25zrctsh.js +1 -0
  5. package/dist/{chunk-1apnz70d.js → chunk-2zzsyaf4.js} +1 -1
  6. package/dist/{chunk-8rkcx7ga.js → chunk-3hgb942q.js} +1 -1
  7. package/dist/{chunk-d5k93y0j.js → chunk-3rv3fnwr.js} +1 -1
  8. package/dist/{chunk-hdz9bg7e.js → chunk-3tvkp2yd.js} +1 -1
  9. package/dist/{chunk-z8523xr8.js → chunk-6hb0pjmk.js} +1 -1
  10. package/dist/{chunk-mb3x1d61.js → chunk-8gg7zddg.js} +1 -1
  11. package/dist/{chunk-87x4fq6h.js → chunk-8s93p05b.js} +1 -1
  12. package/dist/{chunk-qbby8w8b.js → chunk-9a0cy4z7.js} +1 -1
  13. package/dist/{chunk-1q1dq54w.js → chunk-ahz3sskk.js} +1 -1
  14. package/dist/{chunk-zfmqftw9.js → chunk-cxenrejk.js} +1 -1
  15. package/dist/chunk-cz77x04v.js +2 -0
  16. package/dist/{chunk-4132qtve.js → chunk-d1navt68.js} +3 -3
  17. package/dist/{chunk-k47zd5za.js → chunk-d9q5dn00.js} +1 -1
  18. package/dist/{chunk-yd99p4dk.js → chunk-ddxpgrcv.js} +1 -1
  19. package/dist/{chunk-zt4jpb5h.js → chunk-dxtbv0v7.js} +1 -1
  20. package/dist/{chunk-vev6rw5y.js → chunk-f71j03pq.js} +1 -1
  21. package/dist/{chunk-jea21v7c.js → chunk-fkbnsn0a.js} +1 -1
  22. package/dist/{chunk-vbjrq4fy.js → chunk-ghqvews8.js} +1 -1
  23. package/dist/{chunk-4af014dz.js → chunk-h8s11k0r.js} +1 -1
  24. package/dist/{chunk-sa96vzds.js → chunk-k5m9yj9n.js} +1 -1
  25. package/dist/{chunk-d0gn7wa2.js → chunk-mhb3gg9s.js} +1 -1
  26. package/dist/{chunk-nrm76z16.js → chunk-mmcjckwx.js} +1 -1
  27. package/dist/{chunk-wzx53qsq.js → chunk-mpexy01a.js} +1 -1
  28. package/dist/{chunk-sedvapwx.js → chunk-q5gcqckt.js} +1 -1
  29. package/dist/{chunk-tc6r0y59.js → chunk-q8erftv7.js} +1 -1
  30. package/dist/{chunk-wjh181x1.js → chunk-qf6vf457.js} +1 -1
  31. package/dist/chunk-qypjj8rk.js +1 -0
  32. package/dist/{chunk-n7fb464q.js → chunk-rxc6mazk.js} +1 -1
  33. package/dist/{chunk-5wree2jj.js → chunk-s1cs5ga0.js} +1 -1
  34. package/dist/{chunk-98bbsgq1.js → chunk-sxvhv62s.js} +1 -1
  35. package/dist/{chunk-wc6mqf0a.js → chunk-vj50xf5c.js} +1 -1
  36. package/dist/{chunk-6rnne052.js → chunk-wkjdgbnx.js} +1 -1
  37. package/dist/{chunk-zqea7tw1.js → chunk-wv8dy886.js} +1 -1
  38. package/dist/{chunk-e17xwnga.js → chunk-xtbcwn9q.js} +1 -1
  39. package/dist/{chunk-2jx0drfw.js → chunk-zyxfdewk.js} +2 -2
  40. package/dist/web/assets/{ChatView-BG50NCML.js → ChatView-DhjLZ2OR.js} +4 -4
  41. package/dist/web/assets/{CodeBlockHighlighter-BvVwhf5a.js → CodeBlockHighlighter-CYGqk6nC.js} +1 -1
  42. package/dist/web/assets/{FilePreview-BtIVcR0F.js → FilePreview-Cti4_C5N.js} +1 -1
  43. package/dist/web/assets/{KanbanBoard-q43tsrHI.js → KanbanBoard-Ct16zVW3.js} +1 -1
  44. package/dist/web/assets/{MarkdownRenderer-SmFUuERM.js → MarkdownRenderer-RfULWJEE.js} +3 -3
  45. package/dist/web/assets/{ScrollArea-Hynncv8Z.js → ScrollArea-DzblNpCd.js} +1 -1
  46. package/dist/web/assets/{SessionHistorySurface-Cm_p5HNt.js → SessionHistorySurface-D3-0PA12.js} +1 -1
  47. package/dist/web/assets/{SettingsModal-BCr6eHa7.js → SettingsModal-j0PEfToT.js} +1 -1
  48. package/dist/web/assets/{Sidebar-DqrX6W8C.js → Sidebar-DgTGp3BO.js} +1 -1
  49. package/dist/web/assets/{TaskSwitcher-IKy99xxv.js → TaskSwitcher-BVau39Em.js} +1 -1
  50. package/dist/web/assets/{TerminalPanel-BKXU8wN9.js → TerminalPanel-N2fFhXPj.js} +1 -1
  51. package/dist/web/assets/{archive-B7JRGB39.js → archive-DYlK7NlT.js} +1 -1
  52. package/dist/web/assets/{arrow-left-DBD7MFJm.js → arrow-left-DaRjPuTX.js} +1 -1
  53. package/dist/web/assets/{calendar-clock-CWuzyTO_.js → calendar-clock-UTpg6J58.js} +1 -1
  54. package/dist/web/assets/{chevron-right-DvNXYXi1.js → chevron-right-DW6hcYoH.js} +1 -1
  55. package/dist/web/assets/{chevrons-up-down-BLF_tprt.js → chevrons-up-down-D0BwYbw9.js} +1 -1
  56. package/dist/web/assets/{clock-3-Drk3JgZo.js → clock-3-DTmdPhfW.js} +1 -1
  57. package/dist/web/assets/{copy-DmPK2xKY.js → copy-3oxA5Cc-.js} +1 -1
  58. package/dist/web/assets/{download-Cic4550v.js → download-D1w7sCBV.js} +1 -1
  59. package/dist/web/assets/{external-link-BE207ycq.js → external-link-BHWE2Q9K.js} +1 -1
  60. package/dist/web/assets/{folder-jmSOAps0.js → folder-y0Ib4FZ2.js} +1 -1
  61. package/dist/web/assets/{index-E3Br6_JT.js → index-D4bsP__r.js} +3 -3
  62. package/dist/web/assets/{pause-C5TUg_hD.js → pause-dr9-0ZX_.js} +1 -1
  63. package/dist/web/assets/{pencil-Cd2Iz31W.js → pencil-BtXBcDA8.js} +1 -1
  64. package/dist/web/assets/{play-CWdIxxWS.js → play-CGxptupd.js} +1 -1
  65. package/dist/web/assets/{plus-CFE558mS.js → plus-DUJ7l4H3.js} +1 -1
  66. package/dist/web/assets/{settings-CbRw313K.js → settings-DFt3q7ma.js} +1 -1
  67. package/dist/web/assets/{team-CDhOSyV0.js → team-C6IcokCI.js} +1 -1
  68. package/dist/web/assets/{teamService-CTWoTNVQ.js → teamService-T8g5BXdN.js} +1 -1
  69. package/dist/web/assets/{terminal-BLRsjz3P.js → terminal-DLip4ER9.js} +1 -1
  70. package/dist/web/index.html +1 -1
  71. package/package.json +1 -1
  72. package/dist/chunk-0bsdwenb.js +0 -1
  73. package/dist/chunk-c738ej4c.js +0 -2
  74. package/dist/chunk-dstcmhzb.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/teamService-CTWoTNVQ.js","assets/session-events-CGQa6VXb.js","assets/vendor-react-DofNRwfy.js","assets/vendor-radix-D6QrtXqd.js","assets/SettingsModal-BCr6eHa7.js","assets/plus-CFE558mS.js","assets/external-link-BE207ycq.js","assets/download-Cic4550v.js","assets/ScrollArea-Hynncv8Z.js","assets/calendar-clock-CWuzyTO_.js","assets/play-CWdIxxWS.js","assets/pencil-Cd2Iz31W.js","assets/team-CDhOSyV0.js","assets/arrow-left-DBD7MFJm.js","assets/TaskSwitcher-IKy99xxv.js","assets/folder-jmSOAps0.js","assets/terminal-BLRsjz3P.js","assets/settings-CbRw313K.js","assets/clock-3-Drk3JgZo.js","assets/FilePreview-BtIVcR0F.js","assets/chevrons-up-down-BLF_tprt.js","assets/chevron-right-DvNXYXi1.js","assets/TerminalPanel-BKXU8wN9.js","assets/vendor-xterm-DuYZoU4T.js","assets/vendor-xterm-9CEnUXvW.css","assets/Sidebar-DqrX6W8C.js","assets/archive-B7JRGB39.js","assets/ChatView-BG50NCML.js","assets/copy-DmPK2xKY.js","assets/pause-C5TUg_hD.js","assets/KanbanBoard-q43tsrHI.js","assets/SessionHistorySurface-Cm_p5HNt.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/teamService-T8g5BXdN.js","assets/session-events-CGQa6VXb.js","assets/vendor-react-DofNRwfy.js","assets/vendor-radix-D6QrtXqd.js","assets/SettingsModal-j0PEfToT.js","assets/plus-DUJ7l4H3.js","assets/external-link-BHWE2Q9K.js","assets/download-D1w7sCBV.js","assets/ScrollArea-DzblNpCd.js","assets/calendar-clock-UTpg6J58.js","assets/play-CGxptupd.js","assets/pencil-BtXBcDA8.js","assets/team-C6IcokCI.js","assets/arrow-left-DaRjPuTX.js","assets/TaskSwitcher-BVau39Em.js","assets/folder-y0Ib4FZ2.js","assets/terminal-DLip4ER9.js","assets/settings-DFt3q7ma.js","assets/clock-3-DTmdPhfW.js","assets/FilePreview-Cti4_C5N.js","assets/chevrons-up-down-D0BwYbw9.js","assets/chevron-right-DW6hcYoH.js","assets/TerminalPanel-N2fFhXPj.js","assets/vendor-xterm-DuYZoU4T.js","assets/vendor-xterm-9CEnUXvW.css","assets/Sidebar-DgTGp3BO.js","assets/archive-DYlK7NlT.js","assets/ChatView-DhjLZ2OR.js","assets/copy-3oxA5Cc-.js","assets/pause-dr9-0ZX_.js","assets/KanbanBoard-Ct16zVW3.js","assets/SessionHistorySurface-D3-0PA12.js"])))=>i.map(i=>d[i]);
2
2
  var Ar=Object.defineProperty;var Rr=(e,t,s)=>t in e?Ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var _t=(e,t,s)=>Rr(e,typeof t!="symbol"?t+"":t,s);import{r as b,j as a,d as Er,R as Nr}from"./vendor-react-DofNRwfy.js";import{S as Mr,O as pa,P as Ir,C as ha,a as Fr,T as ma,D as ga,R as Or,b as Hr,c as Lr,d as Dr,e as fa}from"./vendor-radix-D6QrtXqd.js";import{T as oe,F as ka,S as At,B as ya,a as Ur,b as qr,c as zr,d as An,e as _r,f as St,g as Br,h as Rn,i as $r,R as Kr,p as ze,j as Vr,U as Qr,k as Wr,l as va,m as Gr,n as Jr,o as Yr,q as Xr,C as En,r as Zr,s as eo,t as to,u as so,v as no,w as ao,P as ro,x as ba,y as oo,z as Ue,A as io,D as Nn,E as co,G as lo,H as uo,I as Mn,J as ps,K as Ze,L as sn,M as W,N as re,O as po,Q as Bt,V as In,W as As,X as wa,Y as ho,Z as qe,_ as De,$ as Rt,a0 as Jt,a1 as mo}from"./session-events-CGQa6VXb.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function s(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(r){if(r.ep)return;r.ep=!0;const o=s(r);fetch(r.href,o)}})();const go="modulepreload",fo=function(e){return"/"+e},Fn={},Be=function(t,s,n){let r=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),m=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));r=Promise.allSettled(s.map(k=>{if(k=fo(k),k in Fn)return;Fn[k]=!0;const v=k.endsWith(".css"),c=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${k}"]${c}`))return;const u=document.createElement("link");if(u.rel=v?"stylesheet":go,v||(u.as="script"),u.crossOrigin="",u.href=k,m&&u.setAttribute("nonce",m),document.head.appendChild(u),v)return new Promise((i,d)=>{u.addEventListener("load",i),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${k}`)))})}))}function o(l){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=l,window.dispatchEvent(m),!m.defaultPrevented)throw l}return r.then(l=>{for(const m of l||[])m.status==="rejected"&&o(m.reason);return t().catch(o)})};/**
3
3
  * @license lucide-react v0.300.0 - ISC
4
4
  *
@@ -194,10 +194,10 @@ var Ar=Object.defineProperty;var Rr=(e,t,s)=>t in e?Ar(e,t,{enumerable:!0,config
194
194
  *
195
195
  * This source code is licensed under the ISC license.
196
196
  * See the LICENSE file in the root directory of this source tree.
197
- */const Xt=X("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ja(e){var t,s,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(s=ja(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Ta(){for(var e,t,s=0,n="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=ja(e))&&(n&&(n+=" "),n+=t);return n}const zn=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,_n=Ta,Do=(e,t)=>s=>{var n;if((t==null?void 0:t.variants)==null)return _n(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:r,defaultVariants:o}=t,l=Object.keys(r).map(v=>{const c=s==null?void 0:s[v],u=o==null?void 0:o[v];if(c===null)return null;const i=zn(c)||zn(u);return r[v][i]}),m=s&&Object.entries(s).reduce((v,c)=>{let[u,i]=c;return i===void 0||(v[u]=i),v},{}),k=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((v,c)=>{let{class:u,className:i,...d}=c;return Object.entries(d).every(p=>{let[g,f]=p;return Array.isArray(f)?f.includes({...o,...m}[g]):{...o,...m}[g]===f})?[...v,u,i]:v},[]);return _n(e,l,k,s==null?void 0:s.class,s==null?void 0:s.className)},rn="-",Uo=e=>{const t=zo(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{const m=l.split(rn);return m[0]===""&&m.length!==1&&m.shift(),Pa(m,t)||qo(l)},getConflictingClassGroupIds:(l,m)=>{const k=s[l]||[];return m&&n[l]?[...k,...n[l]]:k}}},Pa=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const s=e[0],n=t.nextPart.get(s),r=n?Pa(e.slice(1),n):void 0;if(r)return r;if(t.validators.length===0)return;const o=e.join(rn);return(l=t.validators.find(({validator:m})=>m(o)))==null?void 0:l.classGroupId},Bn=/^\[(.+)\]$/,qo=e=>{if(Bn.test(e)){const t=Bn.exec(e)[1],s=t==null?void 0:t.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},zo=e=>{const{theme:t,prefix:s}=e,n={nextPart:new Map,validators:[]};return Bo(Object.entries(e.classGroups),s).forEach(([o,l])=>{Qs(l,n,o,t)}),n},Qs=(e,t,s,n)=>{e.forEach(r=>{if(typeof r=="string"){const o=r===""?t:$n(t,r);o.classGroupId=s;return}if(typeof r=="function"){if(_o(r)){Qs(r(n),t,s,n);return}t.validators.push({validator:r,classGroupId:s});return}Object.entries(r).forEach(([o,l])=>{Qs(l,$n(t,o),s,n)})})},$n=(e,t)=>{let s=e;return t.split(rn).forEach(n=>{s.nextPart.has(n)||s.nextPart.set(n,{nextPart:new Map,validators:[]}),s=s.nextPart.get(n)}),s},_o=e=>e.isThemeGetter,Bo=(e,t)=>t?e.map(([s,n])=>{const r=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,m])=>[t+l,m])):o);return[s,r]}):e,$o=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,n=new Map;const r=(o,l)=>{s.set(o,l),t++,t>e&&(t=0,n=s,s=new Map)};return{get(o){let l=s.get(o);if(l!==void 0)return l;if((l=n.get(o))!==void 0)return r(o,l),l},set(o,l){s.has(o)?s.set(o,l):r(o,l)}}},Aa="!",Ko=e=>{const{separator:t,experimentalParseClassName:s}=e,n=t.length===1,r=t[0],o=t.length,l=m=>{const k=[];let v=0,c=0,u;for(let f=0;f<m.length;f++){let h=m[f];if(v===0){if(h===r&&(n||m.slice(f,f+o)===t)){k.push(m.slice(c,f)),c=f+o;continue}if(h==="/"){u=f;continue}}h==="["?v++:h==="]"&&v--}const i=k.length===0?m:m.substring(c),d=i.startsWith(Aa),p=d?i.substring(1):i,g=u&&u>c?u-c:void 0;return{modifiers:k,hasImportantModifier:d,baseClassName:p,maybePostfixModifierPosition:g}};return s?m=>s({className:m,parseClassName:l}):l},Vo=e=>{if(e.length<=1)return e;const t=[];let s=[];return e.forEach(n=>{n[0]==="["?(t.push(...s.sort(),n),s=[]):s.push(n)}),t.push(...s.sort()),t},Qo=e=>({cache:$o(e.cacheSize),parseClassName:Ko(e),...Uo(e)}),Wo=/\s+/,Go=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:r}=t,o=[],l=e.trim().split(Wo);let m="";for(let k=l.length-1;k>=0;k-=1){const v=l[k],{modifiers:c,hasImportantModifier:u,baseClassName:i,maybePostfixModifierPosition:d}=s(v);let p=!!d,g=n(p?i.substring(0,d):i);if(!g){if(!p){m=v+(m.length>0?" "+m:m);continue}if(g=n(i),!g){m=v+(m.length>0?" "+m:m);continue}p=!1}const f=Vo(c).join(":"),h=u?f+Aa:f,C=h+g;if(o.includes(C))continue;o.push(C);const S=r(g,p);for(let T=0;T<S.length;++T){const j=S[T];o.push(h+j)}m=v+(m.length>0?" "+m:m)}return m};function Jo(){let e=0,t,s,n="";for(;e<arguments.length;)(t=arguments[e++])&&(s=Ra(t))&&(n&&(n+=" "),n+=s);return n}const Ra=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=Ra(e[n]))&&(s&&(s+=" "),s+=t);return s};function Yo(e,...t){let s,n,r,o=l;function l(k){const v=t.reduce((c,u)=>u(c),e());return s=Qo(v),n=s.cache.get,r=s.cache.set,o=m,m(k)}function m(k){const v=n(k);if(v)return v;const c=Go(k,s);return r(k,c),c}return function(){return o(Jo.apply(null,arguments))}}const me=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},Ea=/^\[(?:([a-z-]+):)?(.+)\]$/i,Xo=/^\d+\/\d+$/,Zo=new Set(["px","full","screen"]),ei=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ti=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,si=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,ni=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ai=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_e=e=>kt(e)||Zo.has(e)||Xo.test(e),We=e=>vt(e,"length",pi),kt=e=>!!e&&!Number.isNaN(Number(e)),Es=e=>vt(e,"number",kt),Ct=e=>!!e&&Number.isInteger(Number(e)),ri=e=>e.endsWith("%")&&kt(e.slice(0,-1)),G=e=>Ea.test(e),Ge=e=>ei.test(e),oi=new Set(["length","size","percentage"]),ii=e=>vt(e,oi,Na),ci=e=>vt(e,"position",Na),li=new Set(["image","url"]),di=e=>vt(e,li,mi),ui=e=>vt(e,"",hi),jt=()=>!0,vt=(e,t,s)=>{const n=Ea.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):s(n[2]):!1},pi=e=>ti.test(e)&&!si.test(e),Na=()=>!1,hi=e=>ni.test(e),mi=e=>ai.test(e),gi=()=>{const e=me("colors"),t=me("spacing"),s=me("blur"),n=me("brightness"),r=me("borderColor"),o=me("borderRadius"),l=me("borderSpacing"),m=me("borderWidth"),k=me("contrast"),v=me("grayscale"),c=me("hueRotate"),u=me("invert"),i=me("gap"),d=me("gradientColorStops"),p=me("gradientColorStopPositions"),g=me("inset"),f=me("margin"),h=me("opacity"),C=me("padding"),S=me("saturate"),T=me("scale"),j=me("sepia"),A=me("skew"),w=me("space"),E=me("translate"),F=()=>["auto","contain","none"],x=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",G,t],P=()=>[G,t],B=()=>["",_e,We],U=()=>["auto",kt,G],_=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Q=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>["start","end","center","between","around","evenly","stretch"],K=()=>["","0",G],$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>[kt,G];return{cacheSize:500,separator:":",theme:{colors:[jt],spacing:[_e,We],blur:["none","",Ge,G],brightness:R(),borderColor:[e],borderRadius:["none","","full",Ge,G],borderSpacing:P(),borderWidth:B(),contrast:R(),grayscale:K(),hueRotate:R(),invert:K(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[ri,We],inset:N(),margin:N(),opacity:R(),padding:P(),saturate:R(),scale:R(),sepia:K(),skew:R(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",G]}],container:["container"],columns:[{columns:[Ge]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[..._(),G]}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ct,G]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",G]}],grow:[{grow:K()}],shrink:[{shrink:K()}],order:[{order:["first","last","none",Ct,G]}],"grid-cols":[{"grid-cols":[jt]}],"col-start-end":[{col:["auto",{span:["full",Ct,G]},G]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[jt]}],"row-start-end":[{row:["auto",{span:[Ct,G]},G]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",G]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",G]}],gap:[{gap:[i]}],"gap-x":[{"gap-x":[i]}],"gap-y":[{"gap-y":[i]}],"justify-content":[{justify:["normal",...ne()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ne(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ne(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[f]}],mx:[{mx:[f]}],my:[{my:[f]}],ms:[{ms:[f]}],me:[{me:[f]}],mt:[{mt:[f]}],mr:[{mr:[f]}],mb:[{mb:[f]}],ml:[{ml:[f]}],"space-x":[{"space-x":[w]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[w]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",G,t]}],"min-w":[{"min-w":[G,t,"min","max","fit"]}],"max-w":[{"max-w":[G,t,"none","full","min","max","fit","prose",{screen:[Ge]},Ge]}],h:[{h:[G,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[G,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[G,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[G,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ge,We]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Es]}],"font-family":[{font:[jt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",G]}],"line-clamp":[{"line-clamp":["none",kt,Es]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_e,G]}],"list-image":[{"list-image":["none",G]}],"list-style-type":[{list:["none","disc","decimal",G]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[h]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_e,We]}],"underline-offset":[{"underline-offset":["auto",_e,G]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",G]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",G]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[..._(),ci]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ii]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},di]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[d]}],"gradient-via":[{via:[d]}],"gradient-to":[{to:[d]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[m]}],"border-w-x":[{"border-x":[m]}],"border-w-y":[{"border-y":[m]}],"border-w-s":[{"border-s":[m]}],"border-w-e":[{"border-e":[m]}],"border-w-t":[{"border-t":[m]}],"border-w-r":[{"border-r":[m]}],"border-w-b":[{"border-b":[m]}],"border-w-l":[{"border-l":[m]}],"border-opacity":[{"border-opacity":[h]}],"border-style":[{border:[...Q(),"hidden"]}],"divide-x":[{"divide-x":[m]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[m]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[h]}],"divide-style":[{divide:Q()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...Q()]}],"outline-offset":[{"outline-offset":[_e,G]}],"outline-w":[{outline:[_e,We]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[_e,We]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ge,ui]}],"shadow-color":[{shadow:[jt]}],opacity:[{opacity:[h]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[n]}],contrast:[{contrast:[k]}],"drop-shadow":[{"drop-shadow":["","none",Ge,G]}],grayscale:[{grayscale:[v]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[u]}],saturate:[{saturate:[S]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[k]}],"backdrop-grayscale":[{"backdrop-grayscale":[v]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[h]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",G]}],duration:[{duration:R()}],ease:[{ease:["linear","in","out","in-out",G]}],delay:[{delay:R()}],animate:[{animate:["none","spin","ping","pulse","bounce",G]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Ct,G]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",G]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",G]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",G]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[_e,We,Es]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},fi=Yo(gi);function te(...e){return fi(Ta(e))}const ki=Do("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),lt=b.forwardRef(({className:e,variant:t,size:s,asChild:n=!1,...r},o)=>{const l=n?Mr:"button";return a.jsx(l,{className:te(ki({variant:t,size:s,className:e})),ref:o,...r})});lt.displayName="Button";const on=Or,yi=Ir,Ma=b.forwardRef(({className:e,...t},s)=>a.jsx(pa,{ref:s,className:te("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Ma.displayName=pa.displayName;const hs=b.forwardRef(({className:e,children:t,hideCloseButton:s,...n},r)=>a.jsxs(yi,{children:[a.jsx(Ma,{}),a.jsxs(ha,{ref:r,"aria-modal":"true",className:te("fixed left-[50%] top-[50%] z-50 grid max-h-[calc(100dvh-24px)] w-[calc(100vw-24px)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,!s&&a.jsxs(Fr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(Xt,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));hs.displayName=ha.displayName;const cn=({className:e,...t})=>a.jsx("div",{className:te("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});cn.displayName="DialogHeader";const Ia=({className:e,...t})=>a.jsx("div",{className:te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ia.displayName="DialogFooter";const ms=b.forwardRef(({className:e,...t},s)=>a.jsx(ma,{ref:s,className:te("text-lg font-semibold leading-none tracking-tight",e),...t}));ms.displayName=ma.displayName;const gs=b.forwardRef(({className:e,...t},s)=>a.jsx(ga,{ref:s,className:te("text-sm text-muted-foreground",e),...t}));gs.displayName=ga.displayName;const vi={"app.restoring":"Restoring workspace…","layout.workspace.pathAria":"Workspace path","layout.workspace.empty":"No workspace","layout.action.rewind":"Rewind session","layout.action.openNavigation":"Open navigation","layout.action.previewRestore":"Restore preview","layout.action.previewMaximize":"Maximize preview","terminal.title":"Terminal","terminal.status.connected":"Terminal connected","terminal.status.disconnected":"Terminal disconnected","terminal.action.minimize":"Minimize terminal","terminal.action.restore":"Restore terminal","terminal.action.close":"Close terminal","history.surface.aria":"Session history surface","history.banner.aria":"History surface banner","history.badge.remote":"Remote","history.badge.historyOnly":"History only","history.connection.local":"Local","history.connection.online":"Online","history.connection.offline":"Offline","history.location.label":"Canonical location","history.unavailable.prompt":"Open this Session from its ACP owner to continue. Prompt unavailable in history-only mode.","history.unavailable.files":"Files unavailable in history-only mode","history.unavailable.terminal":"Terminal unavailable in history-only mode","history.loading":"Loading history surface…","history.recovery.cursor":"History was refreshed after the cursor became invalid.","history.recovery.snapshot":"History was refreshed after the snapshot changed.","history.bounded":"Showing a bounded history window.","history.action.loadOlder":"Load older messages","history.action.loadingOlder":"Loading older messages…","history.action.fork":"Fork history branch","history.action.forking":"Forking history branch…","history.action.close":"Close history","history.action.copy":"Copy message {id}","history.search.aria":"Search loaded messages","history.search.placeholder":"Search loaded messages","history.search.scope":"Search filters only the messages loaded here.","history.search.empty":"No loaded messages match this search.","history.messages.empty":"No history messages loaded.","history.error.unavailable":"This Session history is unavailable.","history.error.invalid":"This Session history response was invalid.","history.error.generic":"Session history could not be loaded.","history.role.user":"User","history.role.assistant":"Assistant","sidebar.project.remoteSessions":"Remote sessions","sidebar.brand.badge":"WEB","sidebar.action.collapse":"Collapse sidebar","sidebar.action.expand":"Expand sidebar","sidebar.navigationAria":"Task navigation","sidebar.action.newTask":"New Task","sidebar.action.newTaskShort":"New task","sidebar.action.taskBoard":"Task board","sidebar.action.terminal":"Terminal","sidebar.action.terminalToggle":"Toggle terminal","sidebar.action.searchTasks":"Search tasks","sidebar.unreadTasks":"{count} unread tasks","sidebar.section.skills":"Skills","sidebar.section.mcp":"MCP","sidebar.section.settings":"Settings","sidebar.status.user":"User","sidebar.status.feedLive":"Task feed live","sidebar.status.feedOffline":"Task feed offline","sidebar.empty.title":"No tasks yet","sidebar.empty.hint":"Dispatch one from the home view","sidebar.group.running":"RUNNING","sidebar.group.queued":"QUEUED","sidebar.group.interrupted":"INTERRUPTED","sidebar.group.failed":"FAILED","sidebar.group.cancelled":"CANCELLED","sidebar.group.done":"DONE","sidebar.group.showMore":"Show {count} more","sidebar.group.showLess":"Show less","sidebar.view.project":"Projects","sidebar.view.status":"Status","sidebar.view.projectAria":"Group sessions by project","sidebar.view.statusAria":"Group sessions by status","sidebar.project.active":"active","sidebar.project.expand":"Expand {name}","sidebar.project.collapse":"Collapse {name}","sidebar.project.newTask":"New task in {name}","sidebar.project.reorder":"Reorder {name}, position {position} of {count}","sidebar.project.reorderHint":"Drag to reorder, or use Up and Down arrow keys","sidebar.project.reordered":"Moved {name} to position {position}","sidebar.project.projects":"Projects","sidebar.catalog.syncing":"Syncing task history…","sidebar.catalog.loaded":"{count} loaded","sidebar.catalog.incomplete":"Task history is incomplete","sidebar.catalog.retry":"Retry","projects.dialog.title":"Projects","projects.dialog.description":"Bind local folders to switch task context without restarting Blade.","projects.bind.placeholder":"/absolute/path/to/project","projects.bind.pathLabel":"Project path","projects.bind.action":"Bind","projects.bind.failed":"Failed to bind project","projects.pick.action":"Choose project folder","projects.pick.actionShort":"Choose","projects.pick.picking":"Choosing…","projects.pick.failed":"Failed to choose a project folder","projects.unbind.action":"Unbind project","projects.unavailable":"unavailable","sidebar.language.label":"Language","sidebar.language.aria":"Switch language","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"worktree","session.env.local":"local","session.action.select":"Select {title}","session.action.save":"Save {title}","session.action.cancel":"Cancel {title}","session.action.more":"More actions for {title}","session.action.fork":"Fork {title}","session.action.forkShort":"Fork","session.action.rename":"Rename {title}","session.action.renameShort":"Rename","session.action.archive":"Archive {title}","session.action.archiveShort":"Archive","session.action.export":"Export {title} as Markdown","session.action.exportShort":"Export Markdown","session.action.exportingShort":"Exporting…","session.action.delete":"Delete {title}","session.action.deleteShort":"Delete","session.action.stop":"Stop {title}","session.action.stopping":"Stopping {title}","session.action.retry":"Retry {title}","session.action.retrying":"Retrying {title}","session.reason.cancelledByUser":"Cancelled by user","session.title.codeReview":"Code Review","session.forkedFrom":"Forked from","session.retriedFrom":"Retried from","session.retryShort":"retry","session.queued":"#{position}/{depth} queued","archive.title":"Archive","archive.subtitle":"Stored safely outside the active task list","archive.open":"Open session archive","archive.refresh":"Refresh archived sessions","archive.retry":"Retry","archive.loading":"Loading archive…","archive.empty":"No archived sessions","archive.restore":"Restore {title}","archive.restoreShort":"Restore","archive.restoreAncestor":"Restore the archive root first","archive.inherited":"Archived with {id}","taskSwitcher.title":"Task switcher","taskSwitcher.description":"Search and open tasks across every project.","taskSwitcher.searchAria":"Search tasks","taskSwitcher.placeholder":"Search title, project, branch, status, or session ID…","taskSwitcher.results":"{count} results","taskSwitcher.recent":"Recent tasks","taskSwitcher.scope":"{count} tasks indexed","taskSwitcher.indexing":"Indexing tasks…","taskSwitcher.resultsAria":"Task search results","taskSwitcher.current":"Current","taskSwitcher.unread":"{count} unread","taskSwitcher.needsAction":"{count} need action","taskSwitcher.new":"New","taskSwitcher.empty":"No matching tasks","taskSwitcher.emptyHint":"Try a project, branch, status, or shorter phrase.","taskSwitcher.hint.navigate":"navigate","taskSwitcher.hint.open":"open","taskSwitcher.hint.toggle":"toggle","taskSwitcher.action.failed":"Task action failed","commandCenter.title":"Command center","commandCenter.description":"Search tasks or run workspace and application actions.","commandCenter.searchAria":"Search actions","commandCenter.placeholder":"Search actions, settings, or tools…","commandCenter.modeAria":"Command center mode","commandCenter.mode.tasks":"Tasks","commandCenter.mode.commands":"Actions","commandCenter.actions":"{count} actions","commandCenter.resultsAria":"Action search results","commandCenter.empty":"No matching actions","commandCenter.emptyHint":"Try a tool, panel, or setting name.","commandCenter.action.newTask":"New task","commandCenter.action.newTaskDescription":"Open a clean task composer","commandCenter.action.preview":"Toggle preview","commandCenter.action.previewDescription":"Review files, diffs, run logs, and web pages","commandCenter.action.terminal":"Toggle terminal","commandCenter.action.terminalDescription":"Open or close the workspace shell","commandCenter.action.settings":"Open settings","commandCenter.action.settingsDescription":"Configure appearance and behavior","commandCenter.action.models":"Configure models","commandCenter.action.modelsDescription":"Select providers and task models","commandCenter.action.shortcuts":"View keyboard shortcuts","commandCenter.action.shortcutsDescription":"Browse global and contextual keys","commandCenter.action.skills":"Manage skills","commandCenter.action.skillsDescription":"Discover and configure agent capabilities","commandCenter.action.mcp":"Manage MCP servers","commandCenter.action.mcpDescription":"Configure connected tools and servers","commandCenter.action.sidebar":"Toggle sidebar","commandCenter.action.sidebarDescription":"Show or hide project navigation","taskHome.eyebrow":"Task dispatcher · Ready","taskHome.feed.connecting":"Task dispatcher · Connecting","taskHome.feed.reconnecting":"Task dispatcher · Reconnecting","taskHome.feed.offline":"Task dispatcher · Offline","taskHome.feed.offlineDescription":"Live task updates are paused. Running tasks continue on the server.","taskHome.feed.retry":"Reconnect","taskHome.hero.prefix":"What should Blade build in","taskHome.hero.projectFallback":"current workspace","taskHome.hero.subtitle":"Dispatch a task and keep moving. Each task runs in its own worktree, persists state, and returns with a reviewable workspace when it's done.","taskHome.templates.title":"Templates","taskHome.templates.hint":"1–4 to prefill","taskHome.template.explore.title":"Explore","taskHome.template.explore.description":"Trace behavior and explain the system","taskHome.template.explore.hint":"Trace a call · map a module","taskHome.template.build.title":"Build","taskHome.template.build.description":"Implement a production-ready feature","taskHome.template.build.hint":"Ship a feature end-to-end","taskHome.template.review.title":"Review","taskHome.template.review.description":"Find correctness and regression risks","taskHome.template.review.hint":"Audit current changes","taskHome.review.attachmentsUnsupported":"Code review does not accept attachments","taskHome.review.outputSchemaUnsupported":"Code review uses its own structured report schema","taskHome.review.usage":"Usage: /review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"Read-only code review in progress","taskHome.review.stale":"Review target changed while the reviewer was running","taskHome.review.aborted":"Code review aborted","taskHome.review.interrupted":"Code review interrupted by process restart","taskHome.review.failed":"Code review failed","taskHome.review.startFailed":"Failed to start code review","taskHome.review.invalidTarget":"The selected review target is invalid or has no changes","taskHome.review.conflict":"This session already has active work","taskHome.template.fix.title":"Fix","taskHome.template.fix.description":"Diagnose and repair a concrete failure","taskHome.template.fix.hint":"Bisect · reproduce · patch","taskHome.context.isolationToggleTitle":"Toggle task isolation","taskHome.context.projectSelect":"Select target project","taskHome.context.isolation.worktree":"Isolated worktree","taskHome.context.isolation.local":"Local workspace","taskHome.context.branchFallback":"no branch","taskHome.context.preparing":"Preparing worktree","taskHome.setup.aria":"Task setup status","taskHome.setup.title":"Finish setup","taskHome.setup.description":"Keep drafting while Blade verifies the workspace and model.","taskHome.setup.workspace.title":"Workspace","taskHome.setup.workspace.loading":"Checking available workspaces…","taskHome.setup.workspace.ready":"{project} selected","taskHome.setup.workspace.required":"Choose an available project","taskHome.setup.workspace.empty":"No project","taskHome.setup.workspace.action":"Choose","taskHome.setup.workspace.retry":"Reload workspaces","taskHome.setup.model.title":"Model","taskHome.setup.model.loading":"Checking configuration…","taskHome.setup.model.ready":"Ready for this task","taskHome.setup.model.required":"Configure or select a model","taskHome.setup.model.action":"Configure","taskHome.setup.model.retry":"Retry","taskHome.composer.placeholder":"Describe the outcome, constraints, and verification you expect...","taskHome.error.dismiss":"Dismiss","taskHome.recent.title":"Recent tasks","taskHome.recent.total":"{count} total","taskHome.recent.partial":"{count} loaded · syncing","taskHome.recent.incomplete":"{count} loaded · history incomplete","taskSwitcher.indexingLoaded":"{count} loaded · syncing history","taskHome.footer.note":"Worktree isolation keeps parallel tasks from touching your active checkout","kanban.title":"Task board","kanban.subtitle":"Dispatch work across bound projects and focus on tasks that need intervention.","kanban.taskCount":"{count} tasks","kanban.searchAria":"Search task board","kanban.searchPlaceholder":"Search tasks...","kanban.projectFilterAria":"Filter task board by project","kanban.projectAll":"All projects","kanban.feed.offline":"Live updates are offline. Running tasks continue.","kanban.autoClaim.running":"Auto-claiming","kanban.autoClaim.paused":"Auto-claim paused","kanban.column.waiting":"Waiting","kanban.column.waitingDescription":"Queued for an execution slot","kanban.column.active":"In progress","kanban.column.activeDescription":"Agents currently working","kanban.column.blocked":"Blocked","kanban.column.blockedDescription":"Needs input, retry, or attention","kanban.column.review":"Ready for review","kanban.column.reviewDescription":"Completed work awaiting acceptance","kanban.column.empty":"No tasks in this stage","kanban.priority.high":"High","kanban.priority.medium":"Medium","kanban.priority.low":"Low","kanban.kind.feature":"Feature","kanban.kind.bug":"Bug","kanban.kind.maintenance":"Maintenance","kanban.kind.research":"Research","kanban.card.unread":"New task update","kanban.card.queuePosition":"Queue #{position} of {depth}","kanban.card.diff":"{files} files · +{additions} −{deletions}","kanban.action.newTask":"New task","kanban.action.open":"Open task","kanban.action.respond":"Respond to blocker","kanban.action.inspect":"Inspect changes","kanban.action.edit":"Edit task details","kanban.action.cancel":"Cancel task","kanban.action.retry":"Retry task","kanban.action.archive":"Accept and archive","kanban.dialog.createTitle":"Dispatch task","kanban.dialog.createDescription":"The task runs directly in the selected project workspace.","kanban.dialog.editTitle":"Edit task","kanban.dialog.editDescription":"Update planning metadata without interrupting the running agent.","kanban.dialog.localExecution":"Local workspace · no worktree isolation","kanban.dialog.cancel":"Cancel","kanban.dialog.dispatch":"Dispatch","kanban.dialog.save":"Save","kanban.dialog.submitFailed":"Task operation failed","kanban.field.title":"Title","kanban.field.titlePlaceholder":"Optional concise task title","kanban.field.prompt":"Task brief","kanban.field.promptPlaceholder":"Describe the outcome, constraints, and verification expected...","kanban.field.project":"Project","kanban.field.kind":"Type","kanban.field.priority":"Priority","kanban.field.dueAt":"Due","capacity.title":"{inFlight} running · {queued} queued · max {max}","capacity.suffix.running":" running","capacity.queued":"{queued} queued","recent.status.running":"running","recent.status.queued":"queued","recent.status.paused":"paused","recent.status.failed":"failed","recent.status.cancelled":"cancelled","recent.status.done":"done","recent.time.justNow":"just now","recent.time.minutes":"{n}m ago","recent.time.hours":"{n}h ago","recent.time.days":"{n}d ago","recent.session.fallbackShort":"Session {id}","recent.session.fallbackDated":"Session {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} unread task updates","attention.notification.completed":"Task completed","attention.notification.failed":"Task failed","attention.notification.interrupted":"Task interrupted","attention.notification.permission":"Approval required","attention.notification.question":"Answer required","attention.notification.elicitation":"MCP input required","interaction.permission.title":"Permission required: {tool}","interaction.permission.once":"Allow once","interaction.permission.session":"Allow for session","interaction.permission.project":"Allow for project","interaction.permission.deny":"Deny","interaction.permission.failed":"Failed to respond to permission","interaction.question.answered":"Questions answered","interaction.question.other":"Other","interaction.question.submit":"Submit answers","interaction.question.failed":"Failed to submit answers","interaction.elicitation.title":"MCP input requested","interaction.elicitation.submit":"Submit to MCP","interaction.elicitation.open":"Open external URL","interaction.elicitation.decline":"Decline","interaction.elicitation.cancel":"Cancel","interaction.elicitation.responded":"MCP request answered","interaction.elicitation.cancelled":"MCP request cancelled","interaction.elicitation.failed":"Failed to respond to MCP request","interaction.elicitation.warning":"Only continue if you trust this MCP server and understand the request.","interaction.bar.permissionTitle":"Agent needs approval","interaction.bar.permissionHint":"Review the pending tool request before this task can continue.","interaction.bar.questionTitle":"Agent needs your answer","interaction.bar.questionHint":"Answer the pending question before this task can continue.","interaction.bar.elicitationTitle":"MCP server needs your input","interaction.bar.elicitationHint":"Review the MCP request before this task can continue.","interaction.bar.review":"Review request","interaction.badge.permission":"Needs approval","interaction.badge.question":"Needs answer","interaction.badge.elicitation":"MCP input","artifact.env.isolated":"isolated","artifact.env.local":"local","artifact.review":"Review changes","artifact.commits":"{count} commits","artifact.apply":"Apply","artifact.retryApply":"Retry apply","artifact.applying":"Applying","artifact.applied":"Applied","artifact.discard":"Discard task changes","artifact.discarded":"Discarded","artifact.conflict":"The task changes could not be applied safely.","artifact.conflictHint":"The isolated changes are preserved. Review them, resolve the source project, then retry or discard.","artifact.discardDialog.title":"Discard isolated changes?","artifact.discardDialog.description":"Remove {count} changed files from the isolated task workspace for {project}.","artifact.discardDialog.warning":"This permanently removes the task worktree and branch. Your source project is not modified.","artifact.discardDialog.cancel":"Keep changes","artifact.discardDialog.confirm":"Discard changes","chat.list.empty.eyebrow":"Blade · Ready","chat.list.empty.title":"Start a conversation to begin","chat.list.empty.hint":"Ask a question, describe a change, or paste a stack trace.","chat.list.loading.eyebrow":"Conversation history","chat.list.loading.title":"Restoring conversation…","chat.list.loading.hint":"Loading messages, task state, and live updates. Larger conversations may take a moment.","chat.list.showEarlier":"Show {count} earlier messages","chat.list.showEarlierWithRemaining":"Show {count} earlier messages, {remaining} hidden","chat.list.jumpLatest":"Jump to latest","chat.list.unreadMessage":"1 new message","chat.list.unreadMessages":"{count} new messages","chat.turns.aria":"Jump to a previous message","chat.turns.label":"Turn {n}","chat.timeline.thinking":"Thought process","chat.timeline.tools.runningOne":"Running 1 command","chat.timeline.tools.running":"Running {count} commands","chat.timeline.tools.completedOne":"Executed 1 command","chat.timeline.tools.completed":"Executed {count} commands","chat.timeline.tools.completedOneWithError":"Executed 1 command · failed","chat.timeline.tools.completedWithErrors":"Executed {count} commands · {errors} failed","chat.error.dismiss":"Dismiss error","chat.error.queueFull":"The guidance queue is full. Wait for pending instructions to start, then retry.","chat.error.turnChanged":"The active turn changed before this message was accepted. Review and retry it.","chat.error.title.submission":"Message not sent.","chat.error.title.execution":"Run stopped.","chat.error.title.navigation":"Task not opened.","chat.error.title.generic":"Action failed.","chat.error.action.returnDraft":"Return to draft","chat.error.action.editResend":"Edit and resend","chat.error.action.retryTask":"Retry task","chat.error.action.retryingTask":"Retrying…","chat.error.action.checkModels":"Check model settings","task.failure.authentication":"Provider authentication failed. Check model credentials.","task.failure.permission":"Provider rejected this request. Check account and model permissions.","task.failure.rateLimit":"Provider rate limit or quota exceeded.","task.failure.timeout":"Provider request timed out.","task.failure.network":"Provider connection failed.","task.failure.modelUnavailable":"The selected model is unavailable.","task.failure.contextLimit":"The request exceeded the model context limit.","task.failure.unsupportedInput":"The selected model does not support this input.","task.failure.workspaceUnavailable":"This Session workspace is no longer available.","task.failure.capacity":"Task admission capacity is full. Retry after running tasks complete.","task.failure.runtime":"Agent execution failed.","chat.connection.reconnecting":"Reconnecting live updates. The active run continues in the background.","chat.connection.offline":"Live updates are offline. Progress shown here may be stale.","chat.connection.retry":"Reconnect","chat.side.title":"Side conversation","chat.side.loading":"Answering side question...","chat.side.failed":"Side conversation failed.","chat.side.dismiss":"Dismiss side conversation","chat.footer.disclaimer":"Blade can make mistakes. Please check important information.","chat.input.placeholder.default":"Type @ for files, / for commands...","chat.input.placeholder.steering":"Add guidance to steer the active turn...","chat.input.steering.status":"Active turn is steerable","chat.input.steering.queued":"Guidance accepted · {count} pending","chat.input.steering.enterHint":" · Enter sends guidance","chat.input.followUp.queued":"Follow-up accepted · {count} queued for the next turn","chat.followUpQueue.title":"Follow-up queue","chat.followUpQueue.show":"Show follow-up queue","chat.followUpQueue.hide":"Hide follow-up queue","chat.followUpQueue.count":"{count} queued","chat.followUpQueue.lockedCount":"{count} locked","chat.followUpQueue.internal":"Internal runtime item","chat.followUpQueue.attachmentOnly":"Attachment-only follow-up","chat.followUpQueue.locked":"Locked","chat.followUpQueue.delivery.current_turn":"Current turn","chat.followUpQueue.delivery.next_turn":"Next turn","chat.followUpQueue.delivery.recovery":"Recovery","chat.followUpQueue.moveUp":"Move {id} up","chat.followUpQueue.moveDown":"Move {id} down","chat.followUpQueue.remove":"Remove follow-up {id}","chat.followUpQueue.refresh":"Refresh follow-up queue","chat.followUpQueue.stale":"Queue changed elsewhere. The latest order is shown; review it before retrying.","chat.input.steering.recoveredOne":"Recovered {count} queued instruction after restart","chat.input.steering.recoveredMany":"Recovered {count} queued instructions after restart","chat.input.attachment.add":"Attach images","chat.input.attachment.remove":"Remove","chat.input.attachment.countLimit":"You can attach up to {count} images.","chat.input.attachment.sizeLimit":"Images must stay under {size} total. Remove an image or choose smaller files.","chat.input.attachment.readFailed":"Blade could not read one of these images.","chat.input.attachment.usage":"{count}/{limit} images · {used} of {budget}","chat.input.attachment.modelUnsupported":"{model} does not support images. Choose a vision model or remove the images.","chat.input.attachment.modelRequired":"Choose a vision-capable model before attaching images.","chat.input.model.placeholder":"Select Model","chat.input.model.empty":"No models configured","chat.input.model.vision":"Vision","chat.input.model.change":"Change model","chat.input.model.locked":"Wait for the active turn to finish before switching models","chat.input.effort.label":"Effort {effort}","chat.input.effort.heading":"Reasoning effort","chat.input.effort.change":"Change reasoning effort","chat.input.effort.locked":"Wait for the active turn to finish before changing reasoning effort","chat.input.effort.option":"Use {effort} reasoning effort","chat.input.serviceTier.label":"Speed {tier}","chat.input.serviceTier.heading":"Provider service tier","chat.input.serviceTier.change":"Change provider service tier","chat.input.serviceTier.locked":"Wait for the current turn to finish before changing service tier","chat.input.serviceTier.option":"Use {tier} service tier","chat.input.serviceTier.fastHint":"priority","chat.input.serviceTier.flexHint":"lower cost","chat.input.responseVerbosity.label":"Output {verbosity}","chat.input.responseVerbosity.heading":"Response verbosity","chat.input.responseVerbosity.change":"Change response verbosity","chat.input.responseVerbosity.locked":"Wait for the current turn to finish before changing response verbosity","chat.input.responseVerbosity.option":"Use {verbosity} response verbosity","chat.input.responseVerbosity.autoHint":"model default","chat.input.outputSchema.title":"Structured output","chat.input.outputSchema.description":"Require this turn to finish with an object that matches the JSON Schema.","chat.input.outputSchema.change":"Set structured output schema","chat.input.outputSchema.locked":"Wait for the current turn to finish before changing the output schema","chat.input.outputSchema.editor":"JSON Schema editor","chat.input.outputSchema.placeholder":"Paste a JSON Schema object","chat.input.outputSchema.example":"Use example","chat.input.outputSchema.clear":"Clear","chat.input.outputSchema.invalid":"Enter a valid JSON object. The server validates the complete schema.","chat.input.outputSchema.shellUnsupported":"Structured output cannot be combined with a shell command.","chat.structuredOutput.title":"Structured output","chat.structuredOutput.copy":"Copy structured output","chat.input.communicationStyle.label":"Style {style}","chat.input.communicationStyle.heading":"Communication style","chat.input.communicationStyle.change":"Change communication style","chat.input.communicationStyle.locked":"Wait for the current turn to finish before changing communication style","chat.input.communicationStyle.option":"Use {style} communication style","chat.input.communicationStyle.autoHint":"Blade default","chat.input.communicationStyle.pragmaticHint":"direct","chat.input.communicationStyle.friendlyHint":"warm","chat.input.communicationStyle.explanatoryHint":"explain choices","chat.notice.dismiss":"Dismiss notice","chat.input.mode.default":"Manual approval","chat.input.mode.default.desc":"Every important action needs your approval","chat.input.mode.autoEdit":"Auto approval","chat.input.mode.autoEdit.desc":"Let the AI review and approve important actions","chat.input.mode.yolo":"Full access","chat.input.mode.yolo.desc":"Run directly on your machine without asking","chat.input.mode.yolo.confirm.title":"Enable full access mode?","chat.input.mode.yolo.confirm.desc":"In this mode the agent will execute all actions — including file writes, shell commands, and network requests — without asking for permission. Only enable this if you trust the current context.","chat.input.mode.yolo.confirm.cancel":"Cancel","chat.input.mode.yolo.confirm.accept":"Enable","chat.input.mode.plan":"Plan","chat.input.mode.plan.desc":"Draft a plan first without making changes","chat.input.mode.aria":"Agent action approval","chat.input.action.stop":"Stop active turn","chat.input.action.stopping":"Stopping active turn","chat.input.action.steer":"Steer active turn","chat.input.action.send":"Send message","chat.input.action.submitting":"Submitting message","chat.providerRecovery.admission":"Waiting for Provider capacity","chat.providerRecovery.admissionDetail":"Queue {position}/{depth} · {scope} · waiting {waitSeconds}s","chat.providerRecovery.admissionCompact":"Provider queue · {position}/{depth}","chat.providerRecovery.rateLimit":"Provider rate limited · retry in {seconds}s","chat.providerRecovery.retryWait":"Provider temporarily unavailable · retry in {seconds}s","chat.providerRecovery.retryAttempt":"Retrying Provider","chat.providerRecovery.retryDetail":"Attempt {attempt}/{maxRetries} · recovery budget {budgetSeconds}s","chat.providerRecovery.retryCompact":"Provider recovery · {seconds}s · {attempt}/{maxRetries}","chat.providerRecovery.circuit":"Provider isolated · waiting for recovery probe","chat.providerRecovery.rateLimitCircuit":"Provider rate limited · waiting for recovery probe","chat.providerRecovery.circuitDetail":"Probe in {seconds}s","chat.providerRecovery.circuitCompact":"Provider circuit · {seconds}s","chat.providerRecovery.rateLimitCircuitCompact":"Provider rate limited · {seconds}s","chat.providerRecovery.probe":"Probing Provider recovery","chat.providerRecovery.probeDetail":"One recovery probe is in progress","chat.providerRecovery.probeCompact":"Provider recovery probe","chat.providerRecovery.stall":"Provider has not returned stream data","chat.providerRecovery.stallAfterOutput":"Provider stream is temporarily paused","chat.providerRecovery.stallDetail":"Waiting {stallSeconds}s · timeout {timeoutSeconds}s","chat.providerRecovery.stallCompact":"Provider waiting · {stallSeconds}s","chat.providerRecovery.fallback":"Switching to {to}","chat.providerRecovery.fallbackDetail":"Candidate {candidate}/{candidateCount} · from {from}","chat.providerRecovery.fallbackCompact":"Provider switch · {to}","chat.providerRecovery.stop":"Stop","chat.turnActivity.starting":"Starting task","chat.turnActivity.thinking":"Thinking","chat.turnActivity.responding":"Writing response","chat.turnActivity.executingTools":"Running {count} tools","chat.turnActivity.compacting":"Compacting context","chat.turnActivity.continuing":"Advancing to the next step","chat.turnActivity.toolCount":"{completed}/{started} tools","chat.turnActivity.turn":"turn {turn}","chat.turnActivity.turnBounded":"turn {turn}/{maxTurns}","chat.memoryConsolidation.saved":"Saved {count} project memories","chat.review.title":"Code Review","chat.review.target":"Target","chat.review.target.uncommitted":"Uncommitted changes","chat.review.target.base":"Changes against {ref}","chat.review.target.commit":"Commit {ref}","chat.review.status":"Status","chat.review.status.completed":"Completed","chat.review.status.stale":"Stale","chat.review.status.failed":"Failed","chat.review.status.aborted":"Aborted","chat.review.status.interrupted":"Interrupted","chat.review.findings":"Findings","chat.review.noFindings":"No actionable findings","chat.review.confidence":"confidence {value}","chat.review.error":"Error","chat.subagent.resumedFromTitle":"Resumed from {id}","chat.subagent.resumedDepth":"resumed · depth {depth}","chat.subagent.loadingLogs":"Loading subagent logs...","chat.subagent.resumedAs":"Resumed as {id} · {status} · depth {depth}","chat.subagent.resume":"Resume","chat.subagent.resumeAria":"Resume subagent","chat.subagent.followUpAria":"Subagent follow-up","chat.subagent.followUpPlaceholder":"Describe the follow-up work","chat.subagent.cancel":"Cancel","chat.subagent.resumeAgent":"Resume agent","chat.subagent.resumeFailed":"Failed to resume subagent","chat.markdown.copyCode":"Copy code","chat.rewind.title":"Rewind session","chat.rewind.description":"Return to the point before a user message.","chat.rewind.loading":"Loading checkpoints","chat.rewind.empty":"Nothing to rewind to yet","chat.rewind.checkpointAria":"Rewind checkpoint","chat.rewind.userMessage":"User message","chat.rewind.fileCountOne":"{count} file","chat.rewind.fileCountMany":"{count} files","chat.rewind.restoreCode":"Restore code changes","chat.rewind.restoreCodeHint":"Revert files changed at and after this checkpoint.","chat.rewind.cancel":"Cancel","chat.rewind.confirm":"Rewind","chat.rewind.loadFailed":"Failed to load rewind checkpoints","chat.rewind.failed":"Rewind failed. Review the session error and try again.","status.context":"Context","status.tokenLimitTooltip":"Token limit is estimated. It updates when the model reports its context size.","status.cache":"Cache","status.cacheTooltip":"Cached input divided by total model input for this session.","status.cacheDetails":"Read {read} · Written {write} · Uncached {uncached}","status.cacheUnavailable":"The Provider has not reported prompt-cache usage for this session.","status.cacheBreak":"Last cache break: {reason} · cache read {previous} → {current}","status.cacheBreak.model":"model changed","status.cacheBreak.system":"system prompt changed","status.cacheBreak.tools":"tool definitions changed","status.cacheBreak.policy":"request policy changed","status.cacheBreak.ttl":"cache TTL expired","status.cacheBreak.server":"likely Provider routing or eviction","status.phase.running":"Generating...","status.phase.providerStall":"Provider stream paused","status.phase.actionStationarityRecovering":"Recovering","status.phase.actionStationarityStopped":"Stopped","status.phase.compacting":"Compacting context...","status.phase.recoveringContext":"Recovering context limit...","status.phase.switchingModel":"Switching model...","status.phase.waitingPermission":"Waiting for permission...","status.phase.error":"Run failed","status.recovery.review":"Recovery needs review","status.recovery.interruptedTool":"Interrupted tool state is uncertain","status.recovery.successfulTool":"A tool may already have changed state","preview.title":"Preview","preview.action.resize":"Resize preview","preview.action.close":"Close preview","preview.action.retry":"Retry","preview.tab.diff":"Diff","preview.tab.files":"Files","preview.tab.logs":"Logs","preview.tab.browser":"Browser","preview.diff.loadingTitle":"Loading task diff…","preview.diff.loadingHint":"Reading the durable worktree artifact.","preview.diff.failedTitle":"Failed to load task diff","preview.diff.discardedTitle":"Changes discarded","preview.diff.discardedHint":"The isolated workspace was removed. The source project was not changed.","preview.diff.emptyTitle":"No patch yet","preview.diff.emptyHint":"Run a tool that changes files to see diffs here.","preview.diff.searchAria":"Search changed files","preview.diff.searchPlaceholder":"Filter changed files…","preview.diff.changedFiles":"{count} changed files","preview.diff.expandAll":"Expand all","preview.diff.collapseAll":"Collapse all","preview.diff.showMoreFiles":"Show {count} more files","preview.diff.showMoreLines":"Show {count} more lines","preview.diff.noMatches":"No matching changed files","preview.diff.patch":"Patch","preview.diff.line":"Line {line}","preview.files.loadingTitle":"Loading files…","preview.files.loadingHint":"Fetching workspace tree.","preview.files.failedTitle":"Failed to load files","preview.files.emptyTitle":"No files yet","preview.files.emptyHint":"Select a project to load its workspace tree.","preview.files.treeFailed":"Failed to load workspace tree","preview.files.searchAria":"Search workspace files","preview.files.searchPlaceholder":"Find a file…","preview.files.searchResultsAria":"File search results","preview.files.searchFailed":"Failed to search workspace files","preview.files.noMatches":"No matching files","preview.files.directoryLoading":"Loading folder…","preview.files.directoryEmpty":"Empty folder","preview.files.selectTitle":"Select a file to preview","preview.files.status.loading":"Loading…","preview.files.status.truncated":"Truncated","preview.files.status.ready":"Ready","preview.files.truncatedNotice":"Preview truncated to 200k characters.","preview.files.pickHint":"Pick a file from the tree to preview.","preview.files.contentFailed":"Failed to load file","preview.files.editorLoading":"Loading editor…","preview.logs.searchAria":"Search tool logs","preview.logs.searchPlaceholder":"Search tool, summary, or output…","preview.logs.filterAria":"Filter logs by status","preview.logs.filter.all":"All","preview.logs.filter.running":"Running","preview.logs.filter.error":"Failed","preview.logs.filter.success":"Success","preview.logs.noMatches":"No matching logs","preview.logs.noMatchesHint":"Try another phrase or status.","preview.logs.emptyTitle":"No logs yet","preview.logs.emptyHint":"Tool runs will appear here.","preview.logs.expand":"Expand","preview.logs.collapse":"Collapse","preview.logs.showMore":"Show {count} more logs","preview.logs.status.running":"Running","preview.logs.status.error":"Failed","preview.logs.status.success":"Success","goal.aria.section":"Goal controls","goal.status.active":"Goal running","goal.status.paused":"Goal paused","goal.status.blocked":"Goal blocked","goal.status.usageLimited":"Usage limited","goal.status.budgetLimited":"Budget reached","goal.status.complete":"Goal complete","goal.field.objective":"Goal objective","goal.action.edit":"Edit goal","goal.action.pause":"Pause goal","goal.action.resume":"Resume goal","goal.action.delete":"Delete goal","goal.action.expand":"Expand goal details","goal.action.collapse":"Collapse goal details","goal.action.cancel":"Cancel","goal.action.save":"Save","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"{n} continuation","goal.metrics.continuationMany":"{n} continuations","goal.lineage.origin":"Origin","goal.lineage.current":"Current","goal.lineage.parent":"Parent","goal.executionHostFailure.title":"Execution host recovery","goal.executionHostFailure.category.timeout":"Timeout","goal.executionHostFailure.category.admission":"Admission","goal.executionHostFailure.category.spawn":"Spawn","goal.executionHostFailure.category.finalization":"Finalization","goal.executionHostFailure.category.sandbox_start":"Sandbox startup","goal.executionHostFailure.category.terminal":"Terminal","goal.dialog.title":"Delete this goal?","goal.dialog.description":"The goal state will be removed. Session history and workspace files are not affected.","settings.title":"Settings","settings.nav.aria":"Settings sections","settings.action.back":"Back","settings.category.settings":"Settings","settings.category.integrations":"Integrations","settings.tab.general":"General","settings.tab.trust":"Security","settings.tab.models":"Models","settings.tab.shortcuts":"Shortcuts","settings.tab.mcp":"MCP","settings.tab.skills":"Skills","settings.tab.plugins":"Plugins","settings.tab.hooks":"Hooks","settings.tab.schedules":"Scheduled Tasks","settings.common.retry":"Retry","settings.common.dismiss":"Dismiss","settings.common.cancel":"Cancel","settings.common.enable":"Enable","settings.general.loading":"Loading settings...","settings.general.loadError":"Failed to load settings","settings.general.saveError":"Failed to save settings","settings.general.responseLanguage":"Response Language","settings.general.responseLanguageHint":"AI will respond in this language","settings.general.autoSave":"Auto-save sessions","settings.general.communicationStyle":"Communication Style","settings.general.communicationStyleHint":"How the agent phrases its replies across every session","settings.appearance.heading":"Appearance","settings.appearance.theme":"Theme Preference","settings.appearance.theme.dark":"Dark","settings.appearance.theme.light":"Light","settings.appearance.theme.system":"System","settings.appearance.compactSidebar":"Compact sidebar","settings.appearance.codeTheme":"Code theme","settings.appearance.codeThemeHint":"Syntax highlighting colors","settings.notifications.heading":"Notifications","settings.notifications.buildFinished":"Build finished","settings.notifications.errorsOnly":"Errors only","settings.notifications.systemSounds":"System sounds","settings.notifications.blocked":"Browser notifications are blocked","settings.notifications.unavailable":"Browser notifications are unavailable","settings.notifications.enablePrompt":"Enable alerts while this tab is in the background","settings.privacy.heading":"Privacy","settings.privacy.telemetry":"Telemetry","settings.privacy.crash":"Crash reports","settings.models.description":"Configure API keys and model settings for different providers.","settings.models.loading":"Loading models...","settings.models.loadChannelsFailed":"Failed to load provider channels","settings.models.saveFailed":"Failed to save model","settings.models.deleteFailed":"Failed to delete model","settings.models.updateFailed":"Failed to update model","settings.models.updateChannelFailed":"Failed to update provider channel","settings.models.probeFailed":"Provider probe failed","settings.models.deleteChannelFailed":"Failed to delete provider channel","settings.models.empty":"No models configured yet","settings.models.add":"+ Add New Model","settings.models.missingCredential":"Missing credential","settings.models.configured":"Configured","settings.models.deleting":"Deleting...","settings.models.deleteModel":"Delete model","settings.models.deleteChannel":"Delete channel","settings.models.deleteModelAria":"Delete {name}","settings.models.deleteModelPrompt":"Delete {name} and its saved configuration?","settings.models.deleteChannelAria":"Delete channel {name}","settings.models.deleteChannelPrompt":"Delete channel {name}, its credential, and {count} configured model(s)? Fallback references will also be removed.","settings.models.editModelAria":"Edit {name}","settings.models.editChannelAria":"Edit channel {name}","settings.models.testChannelAria":"Test {name}","settings.models.deleteChannelActionAria":"Delete channel {name}","settings.models.modelCountOne":"{count} model","settings.models.modelCountMany":"{count} models","settings.models.defaultEndpoint":"default endpoint","settings.shortcuts.searchPlaceholder":"Search actions...","settings.shortcuts.scope.all":"All scopes","settings.shortcuts.scope.global":"Global","settings.shortcuts.scope.chat":"Chat","settings.shortcuts.scope.layout":"Layout","settings.shortcuts.reset":"Reset","settings.shortcuts.col.action":"Action","settings.shortcuts.col.shortcut":"Shortcut","settings.shortcuts.col.scope":"Scope","settings.shortcuts.empty":"No shortcuts found.","settings.shortcuts.action.searchTasks":"Search tasks","settings.shortcuts.action.openCommands":"Open command center","settings.shortcuts.action.newTask":"New task","settings.shortcuts.action.focusComposer":"Focus composer","settings.shortcuts.action.toggleSidebar":"Toggle sidebar","settings.common.reload":"Reload","settings.trust.state.notRequired":"No trust required","settings.trust.state.trusted":"Workspace trusted","settings.trust.state.review":"Review required","settings.trust.state.error":"Trust store error","settings.trust.selectSession":"Select a project session to review folder trust.","settings.trust.heading":"Workspace trust","settings.trust.inheritedFrom":" · inherited from {source}","settings.trust.reloadAria":"Reload workspace trust","settings.trust.revoke":"Revoke","settings.trust.trustWorkspace":"Trust workspace","settings.trust.restartNotice":"Restart Blade to reload project models, MCP, LSP, permissions, and plugins.","settings.trust.revokeAria":"Revoke workspace trust","settings.trust.confirmTrust":"Allow {count} project source(s) to configure models, MCP, LSP, permissions, environment, instructions, commands, skills, agents, or plugins?","settings.trust.confirmRevoke":"Block project-controlled executable configuration after restart?","settings.trust.saving":"Saving...","settings.trust.trustReviewed":"Trust reviewed workspace","settings.trust.revokeTrust":"Revoke trust","settings.trust.empty":"No project-controlled executable configuration was found.","settings.trust.loadFailed":"Failed to load workspace trust","settings.trust.updateFailed":"Failed to update workspace trust","settings.hooks.state.disabled":"Hooks disabled","settings.hooks.state.notRequired":"No external hooks","settings.hooks.state.review":"Review required","settings.hooks.state.trusted":"Trusted","settings.hooks.state.modified":"Changed since approval","settings.hooks.state.error":"Trust store error","settings.hooks.selectSession":"Select a project session to review its hooks.","settings.hooks.heading":"Hook trust","settings.hooks.reloadAria":"Reload hook trust","settings.hooks.revoke":"Revoke","settings.hooks.trustDigest":"Trust digest","settings.hooks.currentSession":"Current session execution","settings.hooks.session.open":"Open a session to control its hooks.","settings.hooks.session.loading":"Loading session state...","settings.hooks.session.disabled":"Disabled by workspace configuration.","settings.hooks.session.paused":"Paused only for this session.","settings.hooks.session.active":"Hooks may run for this session after trust checks.","settings.hooks.session.unavailable":"Disabled by this session runtime or host policy.","settings.hooks.session.enableAria":"Enable hooks for current session","settings.hooks.session.pauseAria":"Pause hooks for current session","settings.hooks.session.unavailableAria":"Hooks unavailable for current session","settings.hooks.confirmTrustAria":"Trust project hooks","settings.hooks.confirmRevokeAria":"Revoke project hook trust","settings.hooks.confirmTrust":"Run these {count} hooks with your user permissions until their configuration changes?","settings.hooks.confirmRevoke":"Stop all configured hooks for this project until explicitly trusted again?","settings.hooks.saving":"Saving...","settings.hooks.trustReviewed":"Trust reviewed hooks","settings.hooks.revokeTrust":"Revoke trust","settings.hooks.empty":"No configured command, HTTP, or prompt hooks.","settings.hooks.loadFailed":"Failed to load hook trust","settings.hooks.updateFailed":"Failed to update hook trust","settings.hooks.sessionUpdateFailed":"Failed to update session hooks","settings.plugins.selectProject":"Select a project to manage its plugins.","settings.plugins.heading":"Workspace plugins","settings.plugins.changesNote":"Changes apply to future session snapshots and persist in the selected scope.","settings.plugins.reloadAria":"Reload plugins","settings.plugins.sourcePolicy":"Source policy","settings.plugins.savePolicyAria":"Save plugin source policy","settings.plugins.saving":"Saving…","settings.plugins.saveForProject":"Save for project","settings.plugins.restrictAria":"Restrict plugin sources","settings.plugins.restrictAllowlists":"Restrict to allowlists","settings.plugins.requireShaAria":"Require full Git commit SHA","settings.plugins.requireSha":"Require full Git SHA","settings.plugins.environmentLocked":" · environment locked","settings.plugins.gitHostsAria":"Allowed plugin Git hosts","settings.plugins.marketplacesAria":"Allowed plugin Marketplaces","settings.plugins.localRootsAria":"Allowed local plugin roots","settings.plugins.emptyAllowlists":"Empty allowlists deny every plugin source.","settings.plugins.installHeading":"Install trusted plugin","settings.plugins.sourceAria":"Plugin source","settings.plugins.install":"Install","settings.plugins.trustSource":"I trust this source to activate Hooks, MCP servers, skills, and commands.","settings.plugins.activationScope":"Activation write scope","settings.plugins.activationScopeHint":"Higher-priority layers continue to determine the effective state.","settings.plugins.scopeAria":"Plugin activation scope","settings.plugins.scope.local":"Local","settings.plugins.scope.project":"Project","settings.plugins.scope.global":"Global","settings.plugins.scope.localDesc":"Only this checkout","settings.plugins.scope.projectDesc":"Shared project settings","settings.plugins.scope.globalDesc":"All projects","settings.plugins.scope.invocation":"Invocation","settings.plugins.scope.default":"Default","settings.plugins.layer.on":"on","settings.plugins.layer.off":"off","settings.plugins.capability.commands":"{count} commands","settings.plugins.capability.skills":"{count} skills","settings.plugins.capability.agents":"{count} agents","settings.plugins.capability.hooks":"{count} hooks","settings.plugins.capability.mcp":"{count} MCP","settings.plugins.noResources":"No declared resources","settings.plugins.effective":"effective: {scope}","settings.plugins.managed":"managed","settings.plugins.invocationScoped":"Invocation-scoped via --plugin-dir","settings.plugins.enableAria":"Enable {name}","settings.plugins.disableAria":"Disable {name}","settings.plugins.unavailableAria":"Unavailable {name}","settings.plugins.updateAria":"Update {name}","settings.plugins.uninstallAria":"Uninstall {name}","settings.plugins.confirmUpdate":"Confirm update","settings.plugins.update":"Update","settings.plugins.confirmRemove":"Confirm remove","settings.plugins.empty":"No plugins discovered for this project.","settings.plugins.marketplaces":"Marketplaces","settings.plugins.configuredCount":"{count} configured","settings.plugins.marketplaceSourceAria":"Marketplace source","settings.plugins.addMarketplaceAria":"Add marketplace","settings.plugins.add":"Add","settings.plugins.noDescription":"No description","settings.plugins.refreshMarketplaceAria":"Refresh marketplace {name}","settings.plugins.removeMarketplaceAria":"Remove marketplace {name}","settings.plugins.confirm":"Confirm","settings.plugins.installedSuffix":" · installed","settings.plugins.marketplaceEmpty":"Add a Marketplace to discover installable plugins.","settings.plugins.loadFailed":"Failed to load plugins","settings.plugins.actionFailed":"Plugin action failed","settings.plugins.updateFailed":"Failed to update plugin","settings.models.addModal.title":"Add Model","settings.models.addModal.close":"Close add model","settings.models.addModal.loadProvidersError":"Failed to load providers","settings.models.addModal.loadModelsError":"Failed to load models","settings.models.addModal.provider":"Provider","settings.models.addModal.loadingProviders":"Loading providers...","settings.models.addModal.selectProvider":"Select provider","settings.models.addModal.configuredSuffix":" - configured","settings.models.addModal.customOpenAI":"Custom OpenAI Endpoint","settings.models.addModal.customAnthropic":"Custom Anthropic Endpoint","settings.models.addModal.channelId":"Channel ID","settings.models.addModal.channelIdHint":"Stable config and credential identifier.","settings.models.addModal.channelName":"Channel name","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"Uses the Anthropic Messages protocol.","settings.models.addModal.openaiProtocol":"Uses the OpenAI Chat Completions protocol.","settings.models.addModal.modelId":"Model ID","settings.models.addModal.model":"Model","settings.models.addModal.loadingModels":"Loading models...","settings.models.addModal.selectModel":"Select model","settings.models.addModal.reasoningSuffix":" - reasoning","settings.models.addModal.visionSuffix":" - vision","settings.models.addModal.displayName":"Display name","settings.models.addModal.displayNamePlaceholder":"Optional alias","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API key","settings.models.addModal.apiKeyPlaceholder":"Stored separately in auth.json","settings.models.addModal.showApiKey":"Show API key","settings.models.addModal.hideApiKey":"Hide API key","settings.models.addModal.oauthNote":"This provider requires OAuth or ambient credentials. Configure it externally before selecting the model.","settings.models.addModal.saveModel":"Save Model","settings.models.addModal.saving":"Saving...","settings.models.addModal.channelIdError":'Channel ID must start with a lowercase letter and contain only lowercase letters, numbers, ".", "_" or "-"',"settings.models.addModal.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editModal.srTitle":"Edit Model","settings.models.editModal.title":"Edit Model Overrides","settings.models.editModal.close":"Close edit model","settings.models.editModal.displayName":"Display name","settings.models.editModal.replaceApiKey":"Replace provider API key","settings.models.editModal.replaceApiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editModal.baseUrlOverride":"Base URL override","settings.models.editModal.baseUrlPlaceholder":"Leave empty to use default endpoint","settings.models.editModal.streamIdleTimeout":"Stream idle timeout (ms)","settings.models.editModal.save":"Save","settings.models.editModal.saving":"Saving...","settings.models.editModal.streamIdleTimeoutError":"Stream idle timeout must be at least 1000ms","settings.models.editModal.credentialError":"Failed to update provider credential","settings.models.editProvider.title":"Edit Provider Channel","settings.models.editProvider.close":"Close edit provider","settings.models.editProvider.channelName":"Channel name","settings.models.editProvider.channelNameRequired":"Channel name is required","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"Provider Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editProvider.apiKeyEnv":"API key environment variable","settings.models.editProvider.apiKeyEnvPlaceholder":"Optional, for example TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"Replace API key","settings.models.editProvider.apiKeyAria":"Provider API key","settings.models.editProvider.apiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editProvider.save":"Save channel","settings.models.editProvider.saving":"Saving...","settings.style.auto":"Auto","settings.style.pragmatic":"Pragmatic","settings.style.friendly":"Friendly","settings.style.explanatory":"Explanatory","mcp.status.connected":"Connected","mcp.status.connecting":"Connecting...","mcp.status.reconnecting":"Recovering...","mcp.status.offline":"Offline","mcp.status.error":"Error","mcp.status.recoveringAttempt":"Recovering {attempt}/{max}","mcp.oauth.status.disabled":"Not configured","mcp.oauth.status.unavailable":"Unavailable in this runtime","mcp.oauth.status.unauthenticated":"Authorization required","mcp.oauth.status.authorizing":"Waiting for authorization...","mcp.oauth.status.authenticated":"Authorized","mcp.oauth.status.error":"Authorization failed","mcp.catalog.tag.official":"Official","mcp.catalog.tag.popular":"Popular","mcp.catalog.tag.community":"Community","mcp.action.refreshServers":"Refresh MCP servers","mcp.action.addServer":"Add server","mcp.action.close":"Close MCP","mcp.action.dismiss":"Dismiss","mcp.action.retry":"Retry","mcp.action.disconnect":"Disconnect","mcp.action.disconnecting":"Disconnecting...","mcp.action.stopRecovery":"Stop recovery","mcp.action.connect":"Connect","mcp.action.connecting":"Connecting...","mcp.action.authorizeFirst":"Authorize first","mcp.action.delete":"Delete","mcp.action.cancel":"Cancel","mcp.action.deleting":"Deleting...","mcp.action.deleteServer":"Delete server","mcp.tab.installed":"Installed ({count})","mcp.tab.catalog":"Catalog","mcp.servers.title":"Servers","mcp.servers.searchAria":"Search installed MCP servers","mcp.servers.searchPlaceholder":"Search servers...","mcp.servers.loading":"Loading servers...","mcp.servers.noMatch":"No servers match your search","mcp.servers.none":"No MCP servers configured","mcp.server.errorLabel":"Error: {error}","mcp.server.deleteAria":"Delete {name}","mcp.server.selectPrompt":"Select a server to view details","mcp.instructions.title":"Server instructions","mcp.instructions.detailsOmittedByPolicy":"[details omitted by runtime policy]","mcp.instructions.detailsOmitted":"Details omitted","mcp.instructions.truncated":"Truncated to the safe display budget","mcp.tasks.title":"Experimental MCP Tasks","mcp.tasks.summary":"{count} per Session · {interval}ms poll","mcp.tasks.disabledByDefault":"Disabled by default","mcp.tasks.enabled":"Enabled","mcp.tasks.disabled":"Disabled","mcp.oauth.signingOut":"Signing out...","mcp.oauth.signOut":"Sign out","mcp.oauth.continueAuthorization":"Continue authorization","mcp.oauth.resumeAuthorization":"Resume authorization","mcp.oauth.opening":"Opening...","mcp.oauth.authorize":"Authorize","mcp.delete.confirm":"Remove this server and its saved configuration?","mcp.tools.title":"Tools ({count})","mcp.tools.none":"No tools available","mcp.completion.title":"Argument completion","mcp.completion.connectPrompt":"Connect the server to request suggestions","mcp.completion.unsupported":"Server does not advertise MCP completions","mcp.completion.noTargets":"No completable prompt arguments or template variables","mcp.completion.targetAria":"MCP completion target","mcp.completion.partialAria":"MCP completion partial value","mcp.completion.partialPlaceholder":"Partial value","mcp.completion.completing":"Completing...","mcp.completion.complete":"Complete","mcp.completion.suggestionsAria":"MCP completion suggestions","mcp.completion.empty":"[empty]","mcp.completion.noSuggestions":"No suggestions","mcp.meta.truncatedSuffix":" · truncated","mcp.meta.detailsOmittedSuffix":" · details omitted","mcp.diagnostics.title":"Diagnostics","mcp.diagnostics.refreshAria":"Refresh {name} MCP logs","mcp.diagnostics.logsAria":"{name} MCP logs","mcp.log.levelAria":"MCP logging level","mcp.log.setting":"Setting...","mcp.log.loading":"Loading logs...","mcp.log.none":"No logs captured","mcp.catalog.searchAria":"Search MCP server catalog","mcp.catalog.searchPlaceholder":"Search MCP servers on npm (min 3 chars)...","mcp.catalog.retry":"Retry catalog","mcp.catalog.noDescription":"No description","mcp.catalog.byAuthor":"by {author}","mcp.catalog.installed":"Installed","mcp.catalog.installing":"Installing...","mcp.catalog.install":"Install","mcp.catalog.noPackages":"No packages found","mcp.catalog.noMore":"No more packages","mcp.catalog.packagesFound":"{count} packages found","mcp.catalog.browseGlama":"Browse more on Glama","mcp.error.connectFailed":"Failed to connect server","mcp.error.disconnectFailed":"Failed to disconnect server","mcp.error.deleteFailed":"Failed to delete server","mcp.error.loginFailed":"Failed to login MCP OAuth","mcp.error.logoutFailed":"Failed to logout MCP OAuth","mcp.error.loggingLevelFailed":"Failed to set MCP logging level","mcp.error.completionFailed":"MCP completion failed","mcp.add.title":"Add MCP Server","mcp.add.closeAria":"Close add MCP server","mcp.add.modeForm":"Form","mcp.add.jsonConfig":"JSON config","mcp.add.jsonConfigAria":"JSON configuration","mcp.add.serverName":"Server name","mcp.add.command":"Command","mcp.add.commandAria":"Server command","mcp.add.argsLabel":"Arguments (space separated)","mcp.add.argsAria":"Server arguments","mcp.add.invalidJson":"Enter valid JSON with a server name and transport.","mcp.add.nameCommandRequired":"Name and command are required.","mcp.add.adding":"Adding...","mcp.add.submit":"Add Server","mcp.install.title":"Install MCP Server","mcp.install.titleWithName":"Install {name}","mcp.install.closeAria":"Close MCP installation","mcp.install.args":"Arguments","mcp.install.commandPreview":"Command: npx {args}","mcp.install.nameRequired":"Server name is required.","skills.title":"Skills","skills.action.install":"Install skill","skills.action.installShort":"Install","skills.action.refreshAria":"Refresh skills","skills.action.closeAria":"Close skills","skills.action.dismiss":"Dismiss","skills.action.retry":"Retry","skills.action.cancel":"Cancel","skills.action.close":"Close","skills.action.hide":"Hide","skills.action.enable":"Enable","skills.action.disable":"Disable","skills.action.saving":"Saving...","skills.status.enabled":"Enabled","skills.status.disabled":"Disabled","skills.status.installed":"Installed","skills.noDescriptionShort":"No description","skills.noDescription":"No description available","skills.installed.title":"Installed","skills.installed.searchAria":"Search installed skills","skills.installed.searchPlaceholder":"Search skills...","skills.installed.loading":"Loading skills...","skills.installed.noMatch":"No skills match your search","skills.installed.empty":"No skills installed","skills.uninstall.managedHint":"Only Blade user skills can be uninstalled","skills.uninstall.managed":"Managed","skills.uninstall.action":"Uninstall","skills.uninstall.confirmAria":"Uninstall {name}","skills.uninstall.confirmPrompt":"Remove this skill from ~/.blade/skills?","skills.uninstall.inProgress":"Uninstalling...","skills.uninstall.confirm":"Uninstall skill","skills.details.title":"Details","skills.details.provider":"Provider","skills.details.location":"Location","skills.details.capabilities":"Capabilities","skills.details.allowedTools":"Allowed Tools ({count})","skills.detail.emptyState":"Select a skill to view details","skills.install.title":"Install Skill","skills.install.closeAria":"Close skill installation","skills.install.tab.catalog":"Catalog","skills.install.tab.repo":"Repo","skills.install.tab.local":"Local","skills.install.catalog.searchAria":"Search skill catalog","skills.install.catalog.searchPlaceholder":"Search catalog...","skills.install.catalog.loading":"Loading catalog...","skills.install.catalog.empty":"No skills found","skills.install.catalog.byAuthor":"by {author}","skills.install.catalog.tag.official":"Official","skills.install.catalog.tag.popular":"Popular","skills.install.catalog.tag.community":"Community","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"Skill repository URL","skills.install.repo.credentialsHint":"Uses Git credentials available to the Blade process","skills.install.local.label":"Local path","skills.install.local.inputAria":"Local skill path","skills.status.dialogTitle":"Install Status","skills.status.confirm.title":"Confirm Install","skills.status.confirm.prompt":"Install selected skill?","skills.status.installing.title":"Installing","skills.status.installing.description":"Downloading and verifying…","skills.status.failed.title":"Install Failed","skills.status.failed.fallback":"Installation failed.","skills.status.failed.hint":"Check access and try again.","skills.error.deleteFailed":"Failed to delete skill","skills.error.toggleFailed":"Failed to toggle skill","skills.error.installFailed":"Failed to install skill","schedule.title":"Scheduled Tasks","schedule.description":"Run headless task prompts automatically on a cron, interval, or one-time trigger.","schedule.new":"New schedule","schedule.newAria":"Create a new schedule","schedule.refresh":"Refresh","schedule.reloadAria":"Reload schedules","schedule.create":"Create","schedule.save":"Save","schedule.cancel":"Cancel","schedule.confirmDelete":"Confirm?","schedule.empty":"No schedules yet","schedule.enabled":"Enabled","schedule.disabled":"Disabled","schedule.never":"never","schedule.nextRun":"Next run","schedule.lastRun":"Last run","schedule.runCount":"{count} runs","schedule.trigger.kindAria":"Trigger type","schedule.trigger.cron":"Cron","schedule.trigger.interval":"Interval","schedule.trigger.once":"Once","schedule.field.title":"Title (optional)","schedule.field.cron":"Cron expression","schedule.field.interval":"Interval","schedule.field.runAt":"Run at","schedule.field.prompt":"Prompt","schedule.field.project":"Project path","schedule.field.model":"Model (optional)","schedule.field.permissionMode":"Permission mode","schedule.field.isolation":"Isolation","schedule.placeholder.title":"Nightly dependency audit","schedule.placeholder.cron":"0 9 * * 1 (min hour dom mon dow)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"Describe the task to run…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"e.g. anthropic/claude-sonnet","schedule.model.current":"Use current model","schedule.permission.default":"Default","schedule.permission.autoEdit":"Auto edit","schedule.permission.yolo":"Yolo","schedule.permission.plan":"Plan","schedule.isolation.local":"Local","schedule.isolation.worktree":"Worktree","schedule.cadence.cron":"cron: {expr}","schedule.cadence.interval":"every {interval}","schedule.cadence.once":"once at {time}","schedule.status.queued":"queued","schedule.status.running":"running","schedule.status.completed":"completed","schedule.status.failed":"failed","schedule.status.cancelled":"cancelled","schedule.status.interrupted":"interrupted","schedule.status.error":"error","schedule.status.never":"no runs yet","schedule.runNowAria":'Run "{title}" now',"schedule.editAria":'Edit "{title}"',"schedule.deleteAria":'Delete "{title}"',"schedule.enableAria":'Enable "{title}"',"schedule.disableAria":'Disable "{title}"',"schedule.error.promptRequired":"A prompt is required.","schedule.error.projectRequired":"A project path is required.","schedule.error.cronRequired":"A cron expression is required.","schedule.error.invalidInterval":"Enter an interval like 30m, 2h, or 1d.","schedule.error.runAtRequired":"Pick a valid run time.","schedule.error.loadFailed":"Failed to load scheduled tasks.","schedule.error.createFailed":"Failed to create scheduled task.","schedule.error.updateFailed":"Failed to update scheduled task.","schedule.error.deleteFailed":"Failed to delete scheduled task.","schedule.error.toggleFailed":"Failed to change scheduled task status.","schedule.error.runFailed":"Failed to run scheduled task."},bi={"app.restoring":"正在恢复工作区…","layout.workspace.pathAria":"工作区路径","layout.workspace.empty":"未选择工作区","layout.action.rewind":"回溯会话","layout.action.openNavigation":"打开导航","layout.action.previewRestore":"还原预览","layout.action.previewMaximize":"最大化预览","terminal.title":"终端","terminal.status.connected":"终端已连接","terminal.status.disconnected":"终端未连接","terminal.action.minimize":"最小化终端","terminal.action.restore":"恢复终端","terminal.action.close":"关闭终端","history.surface.aria":"会话历史查看器","history.banner.aria":"历史状态栏","history.badge.remote":"远端","history.badge.historyOnly":"仅历史","history.connection.local":"本地","history.connection.online":"在线","history.connection.offline":"离线","history.location.label":"规范位置","history.unavailable.prompt":"若要继续,请从所属 ACP 打开此会话。仅历史模式下不能发送提示词。","history.unavailable.files":"仅历史模式下不能访问文件","history.unavailable.terminal":"仅历史模式下不能使用终端","history.loading":"正在加载会话历史…","history.recovery.cursor":"历史游标失效,已刷新为最新快照。","history.recovery.snapshot":"历史快照已变化,已刷新为最新内容。","history.bounded":"当前仅显示有界历史窗口。","history.action.loadOlder":"加载更早消息","history.action.loadingOlder":"正在加载更早消息…","history.action.fork":"派生历史分支","history.action.forking":"正在派生历史分支…","history.action.close":"关闭历史","history.action.copy":"复制消息 {id}","history.search.aria":"搜索已加载消息","history.search.placeholder":"搜索已加载消息","history.search.scope":"搜索范围仅限当前已加载的消息。","history.search.empty":"已加载消息中没有匹配项。","history.messages.empty":"尚未加载历史消息。","history.error.unavailable":"此 Session 历史记录不可用。","history.error.invalid":"此 Session 历史响应无效。","history.error.generic":"无法加载 Session 历史记录。","history.role.user":"用户","history.role.assistant":"助手","sidebar.project.remoteSessions":"远程会话","sidebar.brand.badge":"网页版","sidebar.action.collapse":"收起侧边栏","sidebar.action.expand":"展开侧边栏","sidebar.navigationAria":"任务导航","sidebar.action.newTask":"新建任务","sidebar.action.newTaskShort":"新建任务","sidebar.action.taskBoard":"任务看板","sidebar.action.terminal":"终端","sidebar.action.terminalToggle":"切换终端","sidebar.action.searchTasks":"搜索任务","sidebar.unreadTasks":"{count} 个未读任务","sidebar.section.skills":"技能","sidebar.section.mcp":"MCP","sidebar.section.settings":"设置","sidebar.status.user":"用户","sidebar.status.feedLive":"任务通道已连接","sidebar.status.feedOffline":"任务通道未连接","sidebar.empty.title":"暂无任务","sidebar.empty.hint":"在主页派发新任务","sidebar.group.running":"进行中","sidebar.group.queued":"排队中","sidebar.group.interrupted":"已暂停","sidebar.group.failed":"已失败","sidebar.group.cancelled":"已取消","sidebar.group.done":"已完成","sidebar.group.showMore":"再显示 {count} 条","sidebar.group.showLess":"收起","sidebar.view.project":"项目","sidebar.view.status":"状态","sidebar.view.projectAria":"按项目分组会话","sidebar.view.statusAria":"按状态分组会话","sidebar.project.active":"当前","sidebar.project.expand":"展开 {name}","sidebar.project.collapse":"收起 {name}","sidebar.project.newTask":"在 {name} 中新建任务","sidebar.project.reorder":"调整 {name} 的顺序,当前位置 {position}/{count}","sidebar.project.reorderHint":"拖拽调整顺序,或使用上下方向键移动","sidebar.project.reordered":"已将 {name} 移到第 {position} 位","sidebar.project.projects":"项目","sidebar.catalog.syncing":"正在同步任务历史…","sidebar.catalog.loaded":"已载入 {count} 条","sidebar.catalog.incomplete":"任务历史未完整加载","sidebar.catalog.retry":"重试","projects.dialog.title":"项目","projects.dialog.description":"绑定本地目录,无需重启 Blade 即可切换任务上下文。","projects.bind.placeholder":"/项目的绝对路径","projects.bind.pathLabel":"项目路径","projects.bind.action":"绑定","projects.bind.failed":"项目绑定失败","projects.pick.action":"选择项目文件夹","projects.pick.actionShort":"选择","projects.pick.picking":"选择中…","projects.pick.failed":"无法选择项目文件夹","projects.unbind.action":"解除项目绑定","projects.unavailable":"目录不可用","sidebar.language.label":"语言","sidebar.language.aria":"切换语言","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"独立分支","session.env.local":"本地","session.action.select":"选择「{title}」","session.action.save":"保存「{title}」","session.action.cancel":"取消「{title}」","session.action.more":"「{title}」的更多操作","session.action.fork":"派生「{title}」","session.action.forkShort":"派生","session.action.rename":"重命名「{title}」","session.action.renameShort":"重命名","session.action.archive":"归档「{title}」","session.action.archiveShort":"归档","session.action.export":"将「{title}」导出为 Markdown","session.action.exportShort":"导出 Markdown","session.action.exportingShort":"正在导出…","session.action.delete":"删除「{title}」","session.action.deleteShort":"删除","session.action.stop":"停止「{title}」","session.action.stopping":"正在停止「{title}」","session.action.retry":"重试「{title}」","session.action.retrying":"正在重试「{title}」","session.reason.cancelledByUser":"已由用户取消","session.title.codeReview":"代码评审","session.forkedFrom":"派生自","session.retriedFrom":"重试自","session.retryShort":"重试","session.queued":"排队 #{position}/{depth}","archive.title":"归档","archive.subtitle":"安全保留,不占用当前任务列表","archive.open":"打开会话归档","archive.refresh":"刷新归档会话","archive.retry":"重试","archive.loading":"正在载入归档…","archive.empty":"暂无归档会话","archive.restore":"恢复「{title}」","archive.restoreShort":"恢复","archive.restoreAncestor":"请先恢复归档根会话","archive.inherited":"随 {id} 一同归档","taskSwitcher.title":"任务切换器","taskSwitcher.description":"跨项目搜索并打开任务。","taskSwitcher.searchAria":"搜索任务","taskSwitcher.placeholder":"搜索标题、项目、分支、状态或 Session ID…","taskSwitcher.results":"{count} 个结果","taskSwitcher.recent":"最近任务","taskSwitcher.scope":"已索引 {count} 个任务","taskSwitcher.indexing":"正在索引任务…","taskSwitcher.resultsAria":"任务搜索结果","taskSwitcher.current":"当前","taskSwitcher.unread":"{count} 个未读","taskSwitcher.needsAction":"{count} 个需要操作","taskSwitcher.new":"新","taskSwitcher.empty":"没有匹配的任务","taskSwitcher.emptyHint":"尝试项目、分支、状态或更短的关键词。","taskSwitcher.hint.navigate":"选择","taskSwitcher.hint.open":"打开","taskSwitcher.hint.toggle":"切换","taskSwitcher.action.failed":"任务操作失败","commandCenter.title":"命令中心","commandCenter.description":"搜索任务,或执行工作区与应用操作。","commandCenter.searchAria":"搜索操作","commandCenter.placeholder":"搜索操作、设置或工具…","commandCenter.modeAria":"命令中心模式","commandCenter.mode.tasks":"任务","commandCenter.mode.commands":"操作","commandCenter.actions":"{count} 个操作","commandCenter.resultsAria":"操作搜索结果","commandCenter.empty":"没有匹配的操作","commandCenter.emptyHint":"尝试工具、面板或设置名称。","commandCenter.action.newTask":"新建任务","commandCenter.action.newTaskDescription":"打开一个干净的任务编辑器","commandCenter.action.preview":"切换预览区","commandCenter.action.previewDescription":"审查文件、Diff、运行日志与网页","commandCenter.action.terminal":"切换终端","commandCenter.action.terminalDescription":"打开或关闭工作区 Shell","commandCenter.action.settings":"打开设置","commandCenter.action.settingsDescription":"配置外观与行为","commandCenter.action.models":"配置模型","commandCenter.action.modelsDescription":"选择 Provider 与任务模型","commandCenter.action.shortcuts":"查看键盘快捷键","commandCenter.action.shortcutsDescription":"浏览全局与上下文按键","commandCenter.action.skills":"管理 Skills","commandCenter.action.skillsDescription":"发现并配置 Agent 能力","commandCenter.action.mcp":"管理 MCP Server","commandCenter.action.mcpDescription":"配置已连接的工具与服务","commandCenter.action.sidebar":"切换侧边栏","commandCenter.action.sidebarDescription":"显示或隐藏项目导航","taskHome.eyebrow":"任务调度台 · 就绪","taskHome.feed.connecting":"任务调度台 · 正在连接","taskHome.feed.reconnecting":"任务调度台 · 正在重连","taskHome.feed.offline":"任务调度台 · 已离线","taskHome.feed.offlineDescription":"实时任务更新已暂停,服务端正在运行的任务不会停止。","taskHome.feed.retry":"重新连接","taskHome.hero.prefix":"要在这里让 Blade 做点什么:","taskHome.hero.projectFallback":"当前工作区","taskHome.hero.subtitle":"派发一个任务后即可继续手头的工作。每个任务在独立的 worktree 中运行、状态持久保存,完成时会以可复核的工作区形式返回。","taskHome.templates.title":"模板","taskHome.templates.hint":"按 1–4 快速填充","taskHome.template.explore.title":"探索","taskHome.template.explore.description":"追踪行为,梳理系统全貌","taskHome.template.explore.hint":"调用链 · 模块结构","taskHome.template.build.title":"开发","taskHome.template.build.description":"实现一个可上线的功能","taskHome.template.build.hint":"端到端交付特性","taskHome.template.review.title":"评审","taskHome.template.review.description":"找出正确性与回归风险","taskHome.template.review.hint":"审查当前改动","taskHome.review.attachmentsUnsupported":"代码评审不支持附件","taskHome.review.outputSchemaUnsupported":"代码评审使用内置结构化报告 Schema","taskHome.review.usage":"用法:/review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"只读代码评审正在进行","taskHome.review.stale":"评审期间目标已发生变化","taskHome.review.aborted":"代码评审已中止","taskHome.review.interrupted":"代码评审因进程重启而中断","taskHome.review.failed":"代码评审失败","taskHome.review.startFailed":"启动代码评审失败","taskHome.review.invalidTarget":"评审目标无效或没有可评审的改动","taskHome.review.conflict":"当前会话已有任务正在运行","taskHome.template.fix.title":"修复","taskHome.template.fix.description":"定位并修好一个具体故障","taskHome.template.fix.hint":"二分 · 复现 · 打补丁","taskHome.context.isolationToggleTitle":"切换任务隔离方式","taskHome.context.projectSelect":"选择目标项目","taskHome.context.isolation.worktree":"独立 worktree","taskHome.context.isolation.local":"本地工作区","taskHome.context.branchFallback":"无分支","taskHome.context.preparing":"正在准备 worktree","taskHome.setup.aria":"任务准备状态","taskHome.setup.title":"完成准备","taskHome.setup.description":"你可以继续编辑草稿,Blade 正在核对工作区和模型。","taskHome.setup.workspace.title":"工作区","taskHome.setup.workspace.loading":"正在检查可用工作区…","taskHome.setup.workspace.ready":"已选择 {project}","taskHome.setup.workspace.required":"选择一个可用项目","taskHome.setup.workspace.empty":"无项目","taskHome.setup.workspace.action":"选择","taskHome.setup.workspace.retry":"重新加载工作区","taskHome.setup.model.title":"模型","taskHome.setup.model.loading":"正在检查配置…","taskHome.setup.model.ready":"可用于当前任务","taskHome.setup.model.required":"配置或选择一个模型","taskHome.setup.model.action":"配置","taskHome.setup.model.retry":"重试","taskHome.composer.placeholder":"描述目标、约束以及你期望的验收方式……","taskHome.error.dismiss":"关闭","taskHome.recent.title":"最近任务","taskHome.recent.total":"共 {count} 条","taskHome.recent.partial":"已载入 {count} 条 · 继续同步","taskHome.recent.incomplete":"已载入 {count} 条 · 历史不完整","taskSwitcher.indexingLoaded":"已载入 {count} 条 · 正在同步历史","taskHome.footer.note":"独立 worktree 让并行任务不会干扰你当前的工作副本","kanban.title":"任务看板","kanban.subtitle":"跨项目派发任务,优先处理需要人工介入的工作。","kanban.taskCount":"{count} 个任务","kanban.searchAria":"搜索任务看板","kanban.searchPlaceholder":"搜索任务…","kanban.projectFilterAria":"按项目筛选任务看板","kanban.projectAll":"全部项目","kanban.feed.offline":"实时更新已离线,服务端运行中的任务不会停止。","kanban.autoClaim.running":"自动认领中","kanban.autoClaim.paused":"自动认领已暂停","kanban.column.waiting":"等待认领","kanban.column.waitingDescription":"等待可用的执行槽位","kanban.column.active":"处理中","kanban.column.activeDescription":"Agent 正在执行任务","kanban.column.blocked":"遇到阻碍","kanban.column.blockedDescription":"需要输入、重试或人工处理","kanban.column.review":"等你确认","kanban.column.reviewDescription":"已完成,等待验收归档","kanban.column.empty":"此阶段暂无任务","kanban.priority.high":"高优先级","kanban.priority.medium":"中优先级","kanban.priority.low":"低优先级","kanban.kind.feature":"新功能","kanban.kind.bug":"缺陷","kanban.kind.maintenance":"维护","kanban.kind.research":"调研","kanban.card.unread":"有新的任务更新","kanban.card.queuePosition":"队列第 {position}/{depth} 位","kanban.card.diff":"{files} 个文件 · +{additions} −{deletions}","kanban.action.newTask":"新建任务","kanban.action.open":"打开任务","kanban.action.respond":"处理阻碍","kanban.action.inspect":"验收变更","kanban.action.edit":"编辑任务信息","kanban.action.cancel":"取消任务","kanban.action.retry":"重试任务","kanban.action.archive":"验收并归档","kanban.dialog.createTitle":"派发任务","kanban.dialog.createDescription":"任务会直接在选定项目的本地工作区中执行。","kanban.dialog.editTitle":"编辑任务","kanban.dialog.editDescription":"更新计划信息,不会中断正在执行的 Agent。","kanban.dialog.localExecution":"本地工作区 · 不使用 worktree 隔离","kanban.dialog.cancel":"取消","kanban.dialog.dispatch":"派发","kanban.dialog.save":"保存","kanban.dialog.submitFailed":"任务操作失败","kanban.field.title":"标题","kanban.field.titlePlaceholder":"可选的简短任务标题","kanban.field.prompt":"任务说明","kanban.field.promptPlaceholder":"描述目标、约束以及预期的验收方式…","kanban.field.project":"项目","kanban.field.kind":"类型","kanban.field.priority":"优先级","kanban.field.dueAt":"截止时间","capacity.title":"{inFlight} 进行中 · {queued} 排队 · 上限 {max}","capacity.suffix.running":" 进行中","capacity.queued":"排队 {queued}","recent.status.running":"进行中","recent.status.queued":"排队中","recent.status.paused":"已暂停","recent.status.failed":"已失败","recent.status.cancelled":"已取消","recent.status.done":"已完成","recent.time.justNow":"刚刚","recent.time.minutes":"{n} 分钟前","recent.time.hours":"{n} 小时前","recent.time.days":"{n} 天前","recent.session.fallbackShort":"会话 {id}","recent.session.fallbackDated":"会话 {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} 个未读任务更新","attention.notification.completed":"任务已完成","attention.notification.failed":"任务失败","attention.notification.interrupted":"任务已中断","attention.notification.permission":"需要审批","attention.notification.question":"需要回答","attention.notification.elicitation":"MCP 需要输入","interaction.permission.title":"需要授权:{tool}","interaction.permission.once":"仅本次允许","interaction.permission.session":"本会话允许","interaction.permission.project":"本项目允许","interaction.permission.deny":"拒绝","interaction.permission.failed":"授权响应失败","interaction.question.answered":"问题已回答","interaction.question.other":"其他","interaction.question.submit":"提交回答","interaction.question.failed":"回答提交失败","interaction.elicitation.title":"MCP 请求输入","interaction.elicitation.submit":"提交给 MCP","interaction.elicitation.open":"打开外部链接","interaction.elicitation.decline":"拒绝","interaction.elicitation.cancel":"取消","interaction.elicitation.responded":"已响应 MCP 请求","interaction.elicitation.cancelled":"MCP 请求已取消","interaction.elicitation.failed":"响应 MCP 请求失败","interaction.elicitation.warning":"仅在信任该 MCP 服务器并理解请求用途时继续。","interaction.bar.permissionTitle":"Agent 正在等待审批","interaction.bar.permissionHint":"请检查待处理的工具请求,审批后任务才会继续。","interaction.bar.questionTitle":"Agent 正在等待回答","interaction.bar.questionHint":"请回答待处理的问题,任务才能继续。","interaction.bar.elicitationTitle":"MCP 服务器正在等待输入","interaction.bar.elicitationHint":"请检查 MCP 请求,响应后任务才会继续。","interaction.bar.review":"查看请求","interaction.badge.permission":"需要审批","interaction.badge.question":"需要回答","interaction.badge.elicitation":"MCP 输入","artifact.env.isolated":"独立分支","artifact.env.local":"本地","artifact.review":"查看变更","artifact.commits":"{count} 次提交","artifact.apply":"应用","artifact.retryApply":"重新应用","artifact.applying":"应用中","artifact.applied":"已应用","artifact.discard":"丢弃任务变更","artifact.discarded":"已丢弃","artifact.conflict":"任务变更无法安全应用。","artifact.conflictHint":"隔离变更已保留。请查看变更、处理源项目状态,然后重试或丢弃。","artifact.discardDialog.title":"丢弃隔离变更?","artifact.discardDialog.description":"将删除 {project} 隔离任务工作区中的 {count} 个变更文件。","artifact.discardDialog.warning":"此操作会永久删除任务 worktree 和分支,不会修改源项目。","artifact.discardDialog.cancel":"保留变更","artifact.discardDialog.confirm":"丢弃变更","chat.list.empty.eyebrow":"Blade · 就绪","chat.list.empty.title":"发送一条消息开始对话","chat.list.empty.hint":"提问、描述改动,或者粘贴一段错误堆栈。","chat.list.loading.eyebrow":"历史对话","chat.list.loading.title":"正在恢复对话…","chat.list.loading.hint":"正在加载消息、任务状态和实时更新。对话较长时可能需要一点时间。","chat.list.showEarlier":"显示更早的 {count} 条消息","chat.list.showEarlierWithRemaining":"显示更早的 {count} 条消息,当前隐藏 {remaining} 条","chat.list.jumpLatest":"回到最新消息","chat.list.unreadMessage":"1 条新消息","chat.list.unreadMessages":"{count} 条新消息","chat.turns.aria":"跳转到之前的消息","chat.turns.label":"第 {n} 轮","chat.timeline.thinking":"思考过程","chat.timeline.tools.runningOne":"正在执行 1 条命令","chat.timeline.tools.running":"正在执行 {count} 条命令","chat.timeline.tools.completedOne":"已执行 1 条命令","chat.timeline.tools.completed":"已执行 {count} 条命令","chat.timeline.tools.completedOneWithError":"已执行 1 条命令 · 执行失败","chat.timeline.tools.completedWithErrors":"已执行 {count} 条命令 · {errors} 条失败","chat.error.dismiss":"关闭错误","chat.error.queueFull":"指令队列已满。请等待已有指令开始执行后重试。","chat.error.turnChanged":"当前轮次已发生变化,此消息尚未接收。请确认内容后重试。","chat.error.title.submission":"消息未发送。","chat.error.title.execution":"本轮运行已停止。","chat.error.title.navigation":"未能打开任务。","chat.error.title.generic":"操作失败。","chat.error.action.returnDraft":"返回草稿","chat.error.action.editResend":"编辑后重发","chat.error.action.retryTask":"重试任务","chat.error.action.retryingTask":"正在重试…","chat.error.action.checkModels":"检查模型设置","task.failure.authentication":"模型服务认证失败,请检查模型凭据。","task.failure.permission":"模型服务拒绝了请求,请检查账号和模型权限。","task.failure.rateLimit":"模型服务达到速率或额度限制。","task.failure.timeout":"模型服务请求超时。","task.failure.network":"无法连接模型服务。","task.failure.modelUnavailable":"当前选择的模型不可用。","task.failure.contextLimit":"请求超出模型上下文限制。","task.failure.unsupportedInput":"当前模型不支持此类输入。","task.failure.workspaceUnavailable":"此会话的工作区已不可用。","task.failure.capacity":"任务准入容量已满,请在运行中的任务完成后重试。","task.failure.runtime":"Agent 运行失败。","chat.connection.reconnecting":"正在恢复实时更新,当前任务仍在后台继续运行。","chat.connection.offline":"实时更新已离线,当前显示的进度可能已经过期。","chat.connection.retry":"重新连接","chat.side.title":"旁路对话","chat.side.loading":"正在回答旁路问题……","chat.side.failed":"旁路对话失败。","chat.side.dismiss":"关闭旁路对话","chat.footer.disclaimer":"Blade 可能会出错,请核对重要信息。","chat.input.placeholder.default":"输入 @ 提及文件,/ 触发命令……","chat.input.placeholder.steering":"添加指令来引导当前轮次……","chat.input.steering.status":"当前轮次可被引导","chat.input.steering.queued":"引导指令已接收 · 待处理 {count} 条","chat.input.steering.enterHint":" · 回车下发指令","chat.input.followUp.queued":"后续指令已接收 · 下一轮排队 {count} 条","chat.followUpQueue.title":"后续指令队列","chat.followUpQueue.show":"展开后续指令队列","chat.followUpQueue.hide":"收起后续指令队列","chat.followUpQueue.count":"排队中 {count} 条","chat.followUpQueue.lockedCount":"已锁定 {count} 条","chat.followUpQueue.internal":"内部运行项","chat.followUpQueue.attachmentOnly":"仅附件的后续指令","chat.followUpQueue.locked":"已锁定","chat.followUpQueue.delivery.current_turn":"当前轮次","chat.followUpQueue.delivery.next_turn":"下一轮","chat.followUpQueue.delivery.recovery":"恢复队列","chat.followUpQueue.moveUp":"上移 {id}","chat.followUpQueue.moveDown":"下移 {id}","chat.followUpQueue.remove":"移除后续指令 {id}","chat.followUpQueue.refresh":"刷新后续指令队列","chat.followUpQueue.stale":"队列已在其他位置变更。当前显示最新顺序,请确认后重试。","chat.input.steering.recoveredOne":"重启后已恢复 {count} 条排队指令","chat.input.steering.recoveredMany":"重启后已恢复 {count} 条排队指令","chat.input.attachment.add":"添加图片","chat.input.attachment.remove":"移除","chat.input.attachment.countLimit":"最多可添加 {count} 张图片。","chat.input.attachment.sizeLimit":"图片编码后总大小不能超过 {size},请移除图片或选择更小的文件。","chat.input.attachment.readFailed":"Blade 无法读取其中一张图片。","chat.input.attachment.usage":"{count}/{limit} 张图片 · 已用 {used} / {budget}","chat.input.attachment.modelUnsupported":"{model} 不支持图片输入,请选择视觉模型或移除图片。","chat.input.attachment.modelRequired":"请先选择支持图片输入的视觉模型。","chat.input.model.placeholder":"选择模型","chat.input.model.empty":"未配置模型","chat.input.model.vision":"视觉","chat.input.model.change":"切换模型","chat.input.model.locked":"请等待当前轮次结束后再切换模型","chat.input.effort.label":"推理 {effort}","chat.input.effort.heading":"推理强度","chat.input.effort.change":"切换推理强度","chat.input.effort.locked":"请等待当前轮次结束后再切换推理强度","chat.input.effort.option":"使用 {effort} 推理强度","chat.input.serviceTier.label":"速度 {tier}","chat.input.serviceTier.heading":"Provider 服务等级","chat.input.serviceTier.change":"切换 Provider 服务等级","chat.input.serviceTier.locked":"请等待当前轮次结束后再切换服务等级","chat.input.serviceTier.option":"使用 {tier} 服务等级","chat.input.serviceTier.fastHint":"优先通道","chat.input.serviceTier.flexHint":"低成本","chat.input.responseVerbosity.label":"输出 {verbosity}","chat.input.responseVerbosity.heading":"响应详略","chat.input.responseVerbosity.change":"切换响应详略","chat.input.responseVerbosity.locked":"请等待当前轮次结束后再切换响应详略","chat.input.responseVerbosity.option":"使用 {verbosity} 响应详略","chat.input.responseVerbosity.autoHint":"模型默认","chat.input.outputSchema.title":"结构化输出","chat.input.outputSchema.description":"要求本轮最终返回符合该 JSON Schema 的对象。","chat.input.outputSchema.change":"设置结构化输出 Schema","chat.input.outputSchema.locked":"请等待当前轮次结束后再修改输出 Schema","chat.input.outputSchema.editor":"JSON Schema 编辑器","chat.input.outputSchema.placeholder":"粘贴 JSON Schema 对象","chat.input.outputSchema.example":"使用示例","chat.input.outputSchema.clear":"清除","chat.input.outputSchema.invalid":"请输入有效的 JSON 对象;完整 Schema 将由服务端校验。","chat.input.outputSchema.shellUnsupported":"结构化输出不能与 Shell 命令同时使用。","chat.structuredOutput.title":"结构化输出","chat.structuredOutput.copy":"复制结构化输出","chat.input.communicationStyle.label":"风格 {style}","chat.input.communicationStyle.heading":"沟通风格","chat.input.communicationStyle.change":"切换沟通风格","chat.input.communicationStyle.locked":"请等待当前轮次结束后再切换沟通风格","chat.input.communicationStyle.option":"使用 {style} 沟通风格","chat.input.communicationStyle.autoHint":"Blade 默认","chat.input.communicationStyle.pragmaticHint":"直接","chat.input.communicationStyle.friendlyHint":"协作","chat.input.communicationStyle.explanatoryHint":"解释取舍","chat.notice.dismiss":"关闭提示","chat.input.mode.default":"手动审批","chat.input.mode.default.desc":"每个重要操作都需要你的批准","chat.input.mode.autoEdit":"自动审批","chat.input.mode.autoEdit.desc":"让 AI 审核并批准重要操作","chat.input.mode.yolo":"完全访问","chat.input.mode.yolo.desc":"无需询问,直接在你的电脑上运行","chat.input.mode.yolo.confirm.title":"启用完全访问模式?","chat.input.mode.yolo.confirm.desc":"在此模式下,Agent 将直接执行所有操作(包括文件写入、Shell 命令和网络请求)而不请求许可。仅在你信任当前上下文时启用。","chat.input.mode.yolo.confirm.cancel":"取消","chat.input.mode.yolo.confirm.accept":"启用","chat.input.mode.plan":"计划","chat.input.mode.plan.desc":"先拟定计划,暂不做任何改动","chat.input.mode.aria":"Agent 操作审批","chat.input.action.stop":"停止当前轮次","chat.input.action.stopping":"正在停止当前轮次","chat.input.action.steer":"引导当前轮次","chat.input.action.send":"发送消息","chat.input.action.submitting":"正在提交消息","chat.providerRecovery.admission":"等待 Provider 容量","chat.providerRecovery.admissionDetail":"队列 {position}/{depth} · {scope} · 已等待 {waitSeconds}s","chat.providerRecovery.admissionCompact":"Provider 排队 · {position}/{depth}","chat.providerRecovery.rateLimit":"Provider 请求受限,{seconds}s 后重试","chat.providerRecovery.retryWait":"Provider 暂时不可用,{seconds}s 后重试","chat.providerRecovery.retryAttempt":"正在重试 Provider","chat.providerRecovery.retryDetail":"尝试 {attempt}/{maxRetries} · 剩余预算 {budgetSeconds}s","chat.providerRecovery.retryCompact":"Provider 恢复 · {seconds}s · {attempt}/{maxRetries}","chat.providerRecovery.circuit":"Provider 故障已隔离,等待恢复探测","chat.providerRecovery.rateLimitCircuit":"Provider 请求受限,等待恢复探测","chat.providerRecovery.circuitDetail":"{seconds}s 后探测","chat.providerRecovery.circuitCompact":"Provider 熔断 · {seconds}s","chat.providerRecovery.rateLimitCircuitCompact":"Provider 限流 · {seconds}s","chat.providerRecovery.probe":"Provider 正在执行恢复探测","chat.providerRecovery.probeDetail":"一个恢复探测正在进行","chat.providerRecovery.probeCompact":"Provider 恢复探测","chat.providerRecovery.stall":"Provider 尚未返回流数据","chat.providerRecovery.stallAfterOutput":"Provider 流暂时停滞","chat.providerRecovery.stallDetail":"已等待 {stallSeconds}s · 超时上限 {timeoutSeconds}s","chat.providerRecovery.stallCompact":"Provider 等待 · {stallSeconds}s","chat.providerRecovery.fallback":"正在切换到 {to}","chat.providerRecovery.fallbackDetail":"候选 {candidate}/{candidateCount} · 来源 {from}","chat.providerRecovery.fallbackCompact":"Provider 切换 · {to}","chat.providerRecovery.stop":"停止","chat.turnActivity.starting":"正在启动任务","chat.turnActivity.thinking":"正在思考","chat.turnActivity.responding":"正在生成回复","chat.turnActivity.executingTools":"正在执行 {count} 个工具","chat.turnActivity.compacting":"正在压缩上下文","chat.turnActivity.continuing":"正在推进下一步","chat.turnActivity.toolCount":"工具 {completed}/{started}","chat.turnActivity.turn":"回合 {turn}","chat.turnActivity.turnBounded":"回合 {turn}/{maxTurns}","chat.memoryConsolidation.saved":"已保存 {count} 条项目记忆","chat.review.title":"代码评审","chat.review.target":"目标","chat.review.target.uncommitted":"未提交改动","chat.review.target.base":"相对 {ref} 的改动","chat.review.target.commit":"提交 {ref}","chat.review.status":"状态","chat.review.status.completed":"已完成","chat.review.status.stale":"已过期","chat.review.status.failed":"失败","chat.review.status.aborted":"已中止","chat.review.status.interrupted":"已中断","chat.review.findings":"问题","chat.review.noFindings":"未发现可执行问题","chat.review.confidence":"置信度 {value}","chat.review.error":"错误","chat.subagent.resumedFromTitle":"从 {id} 恢复","chat.subagent.resumedDepth":"已恢复 · 层级 {depth}","chat.subagent.loadingLogs":"正在加载子智能体日志…","chat.subagent.resumedAs":"已恢复为 {id} · {status} · 层级 {depth}","chat.subagent.resume":"恢复","chat.subagent.resumeAria":"恢复子智能体","chat.subagent.followUpAria":"子智能体后续指令","chat.subagent.followUpPlaceholder":"描述需要继续处理的工作","chat.subagent.cancel":"取消","chat.subagent.resumeAgent":"恢复智能体","chat.subagent.resumeFailed":"恢复子智能体失败","chat.markdown.copyCode":"复制代码","chat.rewind.title":"回溯会话","chat.rewind.description":"返回到某条用户消息之前的节点。","chat.rewind.loading":"正在加载检查点","chat.rewind.empty":"暂无可回溯的检查点","chat.rewind.checkpointAria":"回溯检查点","chat.rewind.userMessage":"用户消息","chat.rewind.fileCountOne":"{count} 个文件","chat.rewind.fileCountMany":"{count} 个文件","chat.rewind.restoreCode":"恢复代码变更","chat.rewind.restoreCodeHint":"回滚此检查点及之后更改的文件。","chat.rewind.cancel":"取消","chat.rewind.confirm":"回溯","chat.rewind.loadFailed":"加载回溯检查点失败","chat.rewind.failed":"回溯失败。请检查会话错误后重试。","status.context":"上下文","status.tokenLimitTooltip":"此为估算的 token 上限,模型回报上下文尺寸后会自动更新。","status.cache":"缓存","status.cacheTooltip":"本会话缓存读取输入占模型总输入的比例。","status.cacheDetails":"读取 {read} · 写入 {write} · 未缓存 {uncached}","status.cacheUnavailable":"Provider 尚未回报本会话的提示词缓存用量。","status.cacheBreak":"最近一次缓存中断:{reason} · 缓存读取 {previous} → {current}","status.cacheBreak.model":"模型发生变化","status.cacheBreak.system":"系统提示词发生变化","status.cacheBreak.tools":"工具定义发生变化","status.cacheBreak.policy":"请求策略发生变化","status.cacheBreak.ttl":"缓存 TTL 已过期","status.cacheBreak.server":"可能是 Provider 路由或缓存淘汰","status.phase.running":"生成中…","status.phase.providerStall":"Provider 流暂无数据","status.phase.actionStationarityRecovering":"正在纠正空转","status.phase.actionStationarityStopped":"已停止空转","status.phase.compacting":"正在压缩上下文…","status.phase.recoveringContext":"上下文超限,正在恢复…","status.phase.switchingModel":"正在切换模型…","status.phase.waitingPermission":"等待授权…","status.phase.error":"运行失败","status.recovery.review":"恢复前需要检查","status.recovery.interruptedTool":"中断工具的执行状态不确定","status.recovery.successfulTool":"工具可能已经改变了外部状态","preview.title":"预览","preview.action.resize":"调整预览区宽度","preview.action.close":"关闭预览区","preview.action.retry":"重试","preview.tab.diff":"变更","preview.tab.files":"文件","preview.tab.logs":"日志","preview.tab.browser":"浏览器","preview.diff.loadingTitle":"正在加载任务变更…","preview.diff.loadingHint":"正在读取持久化的 worktree 产物。","preview.diff.failedTitle":"任务变更加载失败","preview.diff.discardedTitle":"变更已丢弃","preview.diff.discardedHint":"隔离工作区已删除,源项目没有被修改。","preview.diff.emptyTitle":"暂无变更","preview.diff.emptyHint":"工具修改文件后,变更会显示在这里。","preview.diff.searchAria":"搜索变更文件","preview.diff.searchPlaceholder":"筛选变更文件…","preview.diff.changedFiles":"{count} 个变更文件","preview.diff.expandAll":"全部展开","preview.diff.collapseAll":"全部收起","preview.diff.showMoreFiles":"再显示 {count} 个文件","preview.diff.showMoreLines":"再显示 {count} 行","preview.diff.noMatches":"没有匹配的变更文件","preview.diff.patch":"补丁","preview.diff.line":"第 {line} 行","preview.files.loadingTitle":"正在加载文件…","preview.files.loadingHint":"正在获取工作区文件树。","preview.files.failedTitle":"文件加载失败","preview.files.emptyTitle":"暂无文件","preview.files.emptyHint":"选择项目后即可加载工作区文件树。","preview.files.treeFailed":"工作区文件树加载失败","preview.files.searchAria":"搜索工作区文件","preview.files.searchPlaceholder":"查找文件…","preview.files.searchResultsAria":"文件搜索结果","preview.files.searchFailed":"工作区文件搜索失败","preview.files.noMatches":"没有匹配的文件","preview.files.directoryLoading":"正在加载目录…","preview.files.directoryEmpty":"空目录","preview.files.selectTitle":"选择要预览的文件","preview.files.status.loading":"加载中…","preview.files.status.truncated":"已截断","preview.files.status.ready":"就绪","preview.files.truncatedNotice":"预览内容已截断至 20 万字符。","preview.files.pickHint":"从文件树中选择一个文件进行预览。","preview.files.contentFailed":"文件加载失败","preview.files.editorLoading":"正在加载编辑器…","preview.logs.searchAria":"搜索工具日志","preview.logs.searchPlaceholder":"搜索工具、摘要或输出…","preview.logs.filterAria":"按状态筛选日志","preview.logs.filter.all":"全部","preview.logs.filter.running":"进行中","preview.logs.filter.error":"失败","preview.logs.filter.success":"成功","preview.logs.noMatches":"没有匹配的日志","preview.logs.noMatchesHint":"尝试其他关键词或状态。","preview.logs.emptyTitle":"暂无日志","preview.logs.emptyHint":"工具运行记录会显示在这里。","preview.logs.expand":"展开","preview.logs.collapse":"收起","preview.logs.showMore":"再显示 {count} 条日志","preview.logs.status.running":"进行中","preview.logs.status.error":"失败","preview.logs.status.success":"成功","goal.aria.section":"目标控制条","goal.status.active":"目标进行中","goal.status.paused":"目标已暂停","goal.status.blocked":"目标已阻塞","goal.status.usageLimited":"用量受限","goal.status.budgetLimited":"预算已达上限","goal.status.complete":"目标已完成","goal.field.objective":"目标描述","goal.action.edit":"编辑目标","goal.action.pause":"暂停目标","goal.action.resume":"恢复目标","goal.action.delete":"删除目标","goal.action.expand":"展开目标详情","goal.action.collapse":"收起目标详情","goal.action.cancel":"取消","goal.action.save":"保存","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"续跑 {n} 次","goal.metrics.continuationMany":"续跑 {n} 次","goal.lineage.origin":"起点","goal.lineage.current":"当前","goal.lineage.parent":"上一步","goal.executionHostFailure.title":"执行宿主恢复","goal.executionHostFailure.category.timeout":"执行超时","goal.executionHostFailure.category.admission":"执行准入","goal.executionHostFailure.category.spawn":"进程启动","goal.executionHostFailure.category.finalization":"进程收尾","goal.executionHostFailure.category.sandbox_start":"沙箱启动","goal.executionHostFailure.category.terminal":"终端连接","goal.dialog.title":"删除此目标?","goal.dialog.description":"仅移除目标状态,会话历史与工作区文件不会受影响。","settings.title":"设置","settings.nav.aria":"设置分区","settings.action.back":"返回","settings.category.settings":"设置","settings.category.integrations":"集成","settings.tab.general":"通用","settings.tab.trust":"安全","settings.tab.models":"模型","settings.tab.shortcuts":"快捷键","settings.tab.mcp":"MCP","settings.tab.skills":"技能","settings.tab.plugins":"插件","settings.tab.hooks":"钩子","settings.tab.schedules":"定时任务","settings.common.retry":"重试","settings.common.dismiss":"忽略","settings.common.cancel":"取消","settings.common.enable":"启用","settings.general.loading":"正在加载设置…","settings.general.loadError":"加载设置失败","settings.general.saveError":"保存设置失败","settings.general.responseLanguage":"回复语言","settings.general.responseLanguageHint":"AI 将使用该语言回复","settings.general.autoSave":"自动保存会话","settings.general.communicationStyle":"沟通风格","settings.general.communicationStyleHint":"决定 Agent 在所有会话中的回复措辞","settings.appearance.heading":"外观","settings.appearance.theme":"主题偏好","settings.appearance.theme.dark":"深色","settings.appearance.theme.light":"浅色","settings.appearance.theme.system":"跟随系统","settings.appearance.compactSidebar":"紧凑侧边栏","settings.appearance.codeTheme":"代码主题","settings.appearance.codeThemeHint":"语法高亮配色","settings.notifications.heading":"通知","settings.notifications.buildFinished":"构建完成","settings.notifications.errorsOnly":"仅错误","settings.notifications.systemSounds":"系统提示音","settings.notifications.blocked":"浏览器通知已被拦截","settings.notifications.unavailable":"当前浏览器不支持通知","settings.notifications.enablePrompt":"在此标签页处于后台时接收提醒","settings.privacy.heading":"隐私","settings.privacy.telemetry":"遥测","settings.privacy.crash":"崩溃报告","settings.models.description":"为不同的服务商配置 API Key 与模型设置。","settings.models.loading":"正在加载模型…","settings.models.loadChannelsFailed":"加载服务商渠道失败","settings.models.saveFailed":"保存模型失败","settings.models.deleteFailed":"删除模型失败","settings.models.updateFailed":"更新模型失败","settings.models.updateChannelFailed":"更新服务商渠道失败","settings.models.probeFailed":"服务商渠道探测失败","settings.models.deleteChannelFailed":"删除服务商渠道失败","settings.models.empty":"尚未配置任何模型","settings.models.add":"+ 添加新模型","settings.models.missingCredential":"缺少凭据","settings.models.configured":"已配置","settings.models.deleting":"正在删除…","settings.models.deleteModel":"删除模型","settings.models.deleteChannel":"删除渠道","settings.models.deleteModelAria":"删除 {name}","settings.models.deleteModelPrompt":"删除 {name} 及其保存的配置?","settings.models.deleteChannelAria":"删除渠道 {name}","settings.models.deleteChannelPrompt":"删除渠道 {name}、其凭据以及 {count} 个已配置模型?相关的兜底引用也会一并移除。","settings.models.editModelAria":"编辑 {name}","settings.models.editChannelAria":"编辑渠道 {name}","settings.models.testChannelAria":"测试 {name}","settings.models.deleteChannelActionAria":"删除渠道 {name}","settings.models.modelCountOne":"{count} 个模型","settings.models.modelCountMany":"{count} 个模型","settings.models.defaultEndpoint":"默认端点","settings.shortcuts.searchPlaceholder":"搜索操作…","settings.shortcuts.scope.all":"全部范围","settings.shortcuts.scope.global":"全局","settings.shortcuts.scope.chat":"聊天","settings.shortcuts.scope.layout":"布局","settings.shortcuts.reset":"重置","settings.shortcuts.col.action":"操作","settings.shortcuts.col.shortcut":"快捷键","settings.shortcuts.col.scope":"范围","settings.shortcuts.empty":"未找到快捷键。","settings.shortcuts.action.searchTasks":"搜索任务","settings.shortcuts.action.openCommands":"打开命令中心","settings.shortcuts.action.newTask":"新建任务","settings.shortcuts.action.focusComposer":"聚焦输入框","settings.shortcuts.action.toggleSidebar":"切换侧边栏","settings.common.reload":"重新加载","settings.trust.state.notRequired":"无需信任","settings.trust.state.trusted":"工作区已信任","settings.trust.state.review":"需要审查","settings.trust.state.error":"信任存储错误","settings.trust.selectSession":"选择一个项目会话以查看文件夹信任。","settings.trust.heading":"工作区信任","settings.trust.inheritedFrom":" · 继承自 {source}","settings.trust.reloadAria":"重新加载工作区信任","settings.trust.revoke":"撤销","settings.trust.trustWorkspace":"信任工作区","settings.trust.restartNotice":"重启 Blade 以重新加载项目模型、MCP、LSP、权限和插件。","settings.trust.revokeAria":"撤销工作区信任","settings.trust.confirmTrust":"允许 {count} 个项目来源配置模型、MCP、LSP、权限、环境、指令、命令、技能、Agent 或插件?","settings.trust.confirmRevoke":"重启后阻止项目控制的可执行配置?","settings.trust.saving":"正在保存…","settings.trust.trustReviewed":"信任已审查的工作区","settings.trust.revokeTrust":"撤销信任","settings.trust.empty":"未找到项目控制的可执行配置。","settings.trust.loadFailed":"加载工作区信任失败","settings.trust.updateFailed":"更新工作区信任失败","settings.hooks.state.disabled":"钩子已禁用","settings.hooks.state.notRequired":"无外部钩子","settings.hooks.state.review":"需要审查","settings.hooks.state.trusted":"已信任","settings.hooks.state.modified":"批准后已变更","settings.hooks.state.error":"信任存储错误","settings.hooks.selectSession":"选择一个项目会话以查看其钩子。","settings.hooks.heading":"钩子信任","settings.hooks.reloadAria":"重新加载钩子信任","settings.hooks.revoke":"撤销","settings.hooks.trustDigest":"信任摘要","settings.hooks.currentSession":"当前会话执行","settings.hooks.session.open":"打开一个会话以控制其钩子。","settings.hooks.session.loading":"正在加载会话状态…","settings.hooks.session.disabled":"已被工作区配置禁用。","settings.hooks.session.paused":"仅在此会话中暂停。","settings.hooks.session.active":"通过信任检查后,钩子可在此会话运行。","settings.hooks.session.unavailable":"已被当前会话 runtime 或宿主策略禁用。","settings.hooks.session.enableAria":"为当前会话启用钩子","settings.hooks.session.pauseAria":"为当前会话暂停钩子","settings.hooks.session.unavailableAria":"当前会话无法使用钩子","settings.hooks.confirmTrustAria":"信任项目钩子","settings.hooks.confirmRevokeAria":"撤销项目钩子信任","settings.hooks.confirmTrust":"以你的用户权限运行这 {count} 个钩子,直到它们的配置发生变更?","settings.hooks.confirmRevoke":"停止此项目所有已配置的钩子,直到再次显式信任?","settings.hooks.saving":"正在保存…","settings.hooks.trustReviewed":"信任已审查的钩子","settings.hooks.revokeTrust":"撤销信任","settings.hooks.empty":"没有已配置的命令、HTTP 或提示词钩子。","settings.hooks.loadFailed":"加载钩子信任失败","settings.hooks.updateFailed":"更新钩子信任失败","settings.hooks.sessionUpdateFailed":"更新会话钩子失败","settings.plugins.selectProject":"选择一个项目以管理其插件。","settings.plugins.heading":"工作区插件","settings.plugins.changesNote":"更改将在后续会话快照生效并持久化到所选层级。","settings.plugins.reloadAria":"重新加载插件","settings.plugins.sourcePolicy":"来源策略","settings.plugins.savePolicyAria":"保存插件来源策略","settings.plugins.saving":"正在保存…","settings.plugins.saveForProject":"保存到项目","settings.plugins.restrictAria":"限制插件来源","settings.plugins.restrictAllowlists":"限制为允许列表","settings.plugins.requireShaAria":"要求完整 Git commit SHA","settings.plugins.requireSha":"要求完整 Git SHA","settings.plugins.environmentLocked":" · 环境已锁定","settings.plugins.gitHostsAria":"允许的插件 Git 主机","settings.plugins.marketplacesAria":"允许的插件市场","settings.plugins.localRootsAria":"允许的本地插件根目录","settings.plugins.emptyAllowlists":"空的允许列表将拒绝所有插件来源。","settings.plugins.installHeading":"安装可信插件","settings.plugins.sourceAria":"插件来源","settings.plugins.install":"安装","settings.plugins.trustSource":"我信任此来源可激活钩子、MCP 服务器、技能和命令。","settings.plugins.activationScope":"激活写入范围","settings.plugins.activationScopeHint":"更高优先级的层级仍将决定最终生效状态。","settings.plugins.scopeAria":"插件激活范围","settings.plugins.scope.local":"本地","settings.plugins.scope.project":"项目","settings.plugins.scope.global":"全局","settings.plugins.scope.localDesc":"仅当前检出","settings.plugins.scope.projectDesc":"共享的项目设置","settings.plugins.scope.globalDesc":"所有项目","settings.plugins.scope.invocation":"本次调用","settings.plugins.scope.default":"默认","settings.plugins.layer.on":"开","settings.plugins.layer.off":"关","settings.plugins.capability.commands":"{count} 个命令","settings.plugins.capability.skills":"{count} 个技能","settings.plugins.capability.agents":"{count} 个 Agent","settings.plugins.capability.hooks":"{count} 个钩子","settings.plugins.capability.mcp":"{count} 个 MCP","settings.plugins.noResources":"未声明任何资源","settings.plugins.effective":"生效范围:{scope}","settings.plugins.managed":"托管","settings.plugins.invocationScoped":"通过 --plugin-dir 限定为调用级","settings.plugins.enableAria":"启用 {name}","settings.plugins.disableAria":"停用 {name}","settings.plugins.unavailableAria":"{name} 不可用","settings.plugins.updateAria":"更新 {name}","settings.plugins.uninstallAria":"卸载 {name}","settings.plugins.confirmUpdate":"确认更新","settings.plugins.update":"更新","settings.plugins.confirmRemove":"确认移除","settings.plugins.empty":"未发现此项目的任何插件。","settings.plugins.marketplaces":"市场","settings.plugins.configuredCount":"{count} 个已配置","settings.plugins.marketplaceSourceAria":"市场来源","settings.plugins.addMarketplaceAria":"添加市场","settings.plugins.add":"添加","settings.plugins.noDescription":"无描述","settings.plugins.refreshMarketplaceAria":"刷新市场 {name}","settings.plugins.removeMarketplaceAria":"移除市场 {name}","settings.plugins.confirm":"确认","settings.plugins.installedSuffix":" · 已安装","settings.plugins.marketplaceEmpty":"添加市场以发现可安装的插件。","settings.plugins.loadFailed":"加载插件失败","settings.plugins.actionFailed":"插件操作失败","settings.plugins.updateFailed":"更新插件失败","settings.models.addModal.title":"添加模型","settings.models.addModal.close":"关闭添加模型","settings.models.addModal.loadProvidersError":"加载服务商失败","settings.models.addModal.loadModelsError":"加载模型失败","settings.models.addModal.provider":"服务商","settings.models.addModal.loadingProviders":"正在加载服务商…","settings.models.addModal.selectProvider":"选择服务商","settings.models.addModal.configuredSuffix":" - 已配置","settings.models.addModal.customOpenAI":"自定义 OpenAI 端点","settings.models.addModal.customAnthropic":"自定义 Anthropic 端点","settings.models.addModal.channelId":"渠道 ID","settings.models.addModal.channelIdHint":"稳定的配置与凭据标识符。","settings.models.addModal.channelName":"渠道名称","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"使用 Anthropic Messages 协议。","settings.models.addModal.openaiProtocol":"使用 OpenAI Chat Completions 协议。","settings.models.addModal.modelId":"模型 ID","settings.models.addModal.model":"模型","settings.models.addModal.loadingModels":"正在加载模型…","settings.models.addModal.selectModel":"选择模型","settings.models.addModal.reasoningSuffix":" - 推理","settings.models.addModal.visionSuffix":" - 视觉","settings.models.addModal.displayName":"显示名称","settings.models.addModal.displayNamePlaceholder":"可选别名","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API Key","settings.models.addModal.apiKeyPlaceholder":"单独存储在 auth.json 中","settings.models.addModal.showApiKey":"显示 API Key","settings.models.addModal.hideApiKey":"隐藏 API Key","settings.models.addModal.oauthNote":"该服务商需要 OAuth 或环境凭据,请在选择模型前在外部完成配置。","settings.models.addModal.saveModel":"保存模型","settings.models.addModal.saving":"正在保存…","settings.models.addModal.channelIdError":'渠道 ID 必须以小写字母开头,且只能包含小写字母、数字、"."、"_" 或 "-"。',"settings.models.addModal.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editModal.srTitle":"编辑模型","settings.models.editModal.title":"编辑模型覆盖项","settings.models.editModal.close":"关闭编辑模型","settings.models.editModal.displayName":"显示名称","settings.models.editModal.replaceApiKey":"替换服务商 API Key","settings.models.editModal.replaceApiKeyPlaceholder":"留空则保留当前凭据","settings.models.editModal.baseUrlOverride":"Base URL 覆盖","settings.models.editModal.baseUrlPlaceholder":"留空则使用默认端点","settings.models.editModal.streamIdleTimeout":"流空闲超时(ms)","settings.models.editModal.save":"保存","settings.models.editModal.saving":"正在保存…","settings.models.editModal.streamIdleTimeoutError":"流空闲超时必须至少为 1000ms。","settings.models.editModal.credentialError":"更新服务商凭据失败","settings.models.editProvider.title":"编辑服务商渠道","settings.models.editProvider.close":"关闭编辑服务商","settings.models.editProvider.channelName":"渠道名称","settings.models.editProvider.channelNameRequired":"渠道名称不能为空","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"服务商 Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editProvider.apiKeyEnv":"API Key 环境变量","settings.models.editProvider.apiKeyEnvPlaceholder":"可选,例如 TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"替换 API Key","settings.models.editProvider.apiKeyAria":"服务商 API Key","settings.models.editProvider.apiKeyPlaceholder":"留空则保留当前凭据","settings.models.editProvider.save":"保存渠道","settings.models.editProvider.saving":"正在保存…","settings.style.auto":"自动","settings.style.pragmatic":"务实","settings.style.friendly":"友好","settings.style.explanatory":"解释型","mcp.status.connected":"已连接","mcp.status.connecting":"连接中...","mcp.status.reconnecting":"恢复中...","mcp.status.offline":"离线","mcp.status.error":"错误","mcp.status.recoveringAttempt":"恢复中 {attempt}/{max}","mcp.oauth.status.disabled":"未配置","mcp.oauth.status.unavailable":"当前运行时不可用","mcp.oauth.status.unauthenticated":"需要授权","mcp.oauth.status.authorizing":"等待授权...","mcp.oauth.status.authenticated":"已授权","mcp.oauth.status.error":"授权失败","mcp.catalog.tag.official":"官方","mcp.catalog.tag.popular":"热门","mcp.catalog.tag.community":"社区","mcp.action.refreshServers":"刷新 MCP 服务器","mcp.action.addServer":"添加服务器","mcp.action.close":"关闭 MCP","mcp.action.dismiss":"忽略","mcp.action.retry":"重试","mcp.action.disconnect":"断开连接","mcp.action.disconnecting":"断开中...","mcp.action.stopRecovery":"停止恢复","mcp.action.connect":"连接","mcp.action.connecting":"连接中...","mcp.action.authorizeFirst":"请先授权","mcp.action.delete":"删除","mcp.action.cancel":"取消","mcp.action.deleting":"删除中...","mcp.action.deleteServer":"删除服务器","mcp.tab.installed":"已安装 ({count})","mcp.tab.catalog":"目录","mcp.servers.title":"服务器","mcp.servers.searchAria":"搜索已安装的 MCP 服务器","mcp.servers.searchPlaceholder":"搜索服务器...","mcp.servers.loading":"正在加载服务器...","mcp.servers.noMatch":"没有匹配的服务器","mcp.servers.none":"尚未配置 MCP 服务器","mcp.server.errorLabel":"错误:{error}","mcp.server.deleteAria":"删除 {name}","mcp.server.selectPrompt":"选择一个服务器以查看详情","mcp.instructions.title":"服务器说明","mcp.instructions.detailsOmittedByPolicy":"[详情已根据运行时策略省略]","mcp.instructions.detailsOmitted":"详情已省略","mcp.instructions.truncated":"已截断至安全显示上限","mcp.tasks.title":"实验性 MCP 任务","mcp.tasks.summary":"每会话 {count} 个 · {interval}ms 轮询","mcp.tasks.disabledByDefault":"默认禁用","mcp.tasks.enabled":"已启用","mcp.tasks.disabled":"已禁用","mcp.oauth.signingOut":"登出中...","mcp.oauth.signOut":"登出","mcp.oauth.continueAuthorization":"继续授权","mcp.oauth.resumeAuthorization":"恢复授权","mcp.oauth.opening":"打开中...","mcp.oauth.authorize":"授权","mcp.delete.confirm":"移除此服务器及其已保存的配置?","mcp.tools.title":"工具 ({count})","mcp.tools.none":"暂无可用工具","mcp.completion.title":"参数补全","mcp.completion.connectPrompt":"连接服务器后即可请求补全建议","mcp.completion.unsupported":"该服务器未声明支持 MCP 补全","mcp.completion.noTargets":"没有可补全的提示词参数或模板变量","mcp.completion.targetAria":"MCP 补全目标","mcp.completion.partialAria":"MCP 补全的部分值","mcp.completion.partialPlaceholder":"部分值","mcp.completion.completing":"补全中...","mcp.completion.complete":"补全","mcp.completion.suggestionsAria":"MCP 补全建议","mcp.completion.empty":"[空]","mcp.completion.noSuggestions":"暂无建议","mcp.meta.truncatedSuffix":" · 已截断","mcp.meta.detailsOmittedSuffix":" · 详情已省略","mcp.diagnostics.title":"诊断","mcp.diagnostics.refreshAria":"刷新 {name} 的 MCP 日志","mcp.diagnostics.logsAria":"{name} 的 MCP 日志","mcp.log.levelAria":"MCP 日志级别","mcp.log.setting":"设置中...","mcp.log.loading":"正在加载日志...","mcp.log.none":"未捕获到日志","mcp.catalog.searchAria":"搜索 MCP 服务器目录","mcp.catalog.searchPlaceholder":"在 npm 上搜索 MCP 服务器(至少 3 个字符)...","mcp.catalog.retry":"重试加载目录","mcp.catalog.noDescription":"暂无描述","mcp.catalog.byAuthor":"作者 {author}","mcp.catalog.installed":"已安装","mcp.catalog.installing":"安装中...","mcp.catalog.install":"安装","mcp.catalog.noPackages":"未找到任何包","mcp.catalog.noMore":"没有更多包了","mcp.catalog.packagesFound":"找到 {count} 个包","mcp.catalog.browseGlama":"在 Glama 上浏览更多","mcp.error.connectFailed":"连接服务器失败","mcp.error.disconnectFailed":"断开服务器失败","mcp.error.deleteFailed":"删除服务器失败","mcp.error.loginFailed":"MCP OAuth 登录失败","mcp.error.logoutFailed":"MCP OAuth 登出失败","mcp.error.loggingLevelFailed":"设置 MCP 日志级别失败","mcp.error.completionFailed":"MCP 补全失败","mcp.add.title":"添加 MCP 服务器","mcp.add.closeAria":"关闭添加 MCP 服务器","mcp.add.modeForm":"表单","mcp.add.jsonConfig":"JSON 配置","mcp.add.jsonConfigAria":"JSON 配置","mcp.add.serverName":"服务器名称","mcp.add.command":"命令","mcp.add.commandAria":"服务器命令","mcp.add.argsLabel":"参数(空格分隔)","mcp.add.argsAria":"服务器参数","mcp.add.invalidJson":"请输入包含服务器名称和传输方式的有效 JSON。","mcp.add.nameCommandRequired":"名称和命令为必填项。","mcp.add.adding":"添加中...","mcp.add.submit":"添加服务器","mcp.install.title":"安装 MCP 服务器","mcp.install.titleWithName":"安装 {name}","mcp.install.closeAria":"关闭 MCP 安装","mcp.install.args":"参数","mcp.install.commandPreview":"命令:npx {args}","mcp.install.nameRequired":"服务器名称为必填项。","skills.title":"技能","skills.action.install":"安装技能","skills.action.installShort":"安装","skills.action.refreshAria":"刷新技能","skills.action.closeAria":"关闭技能","skills.action.dismiss":"忽略","skills.action.retry":"重试","skills.action.cancel":"取消","skills.action.close":"关闭","skills.action.hide":"隐藏","skills.action.enable":"启用","skills.action.disable":"禁用","skills.action.saving":"保存中…","skills.status.enabled":"已启用","skills.status.disabled":"已禁用","skills.status.installed":"已安装","skills.noDescriptionShort":"暂无描述","skills.noDescription":"暂无可用描述","skills.installed.title":"已安装","skills.installed.searchAria":"搜索已安装的技能","skills.installed.searchPlaceholder":"搜索技能…","skills.installed.loading":"正在加载技能…","skills.installed.noMatch":"没有匹配的技能","skills.installed.empty":"尚未安装任何技能","skills.uninstall.managedHint":"仅可卸载 Blade 用户技能","skills.uninstall.managed":"受管理","skills.uninstall.action":"卸载","skills.uninstall.confirmAria":"卸载 {name}","skills.uninstall.confirmPrompt":"从 ~/.blade/skills 中移除此技能?","skills.uninstall.inProgress":"正在卸载…","skills.uninstall.confirm":"卸载技能","skills.details.title":"详情","skills.details.provider":"提供方","skills.details.location":"位置","skills.details.capabilities":"能力","skills.details.allowedTools":"允许的工具({count})","skills.detail.emptyState":"选择一个技能以查看详情","skills.install.title":"安装技能","skills.install.closeAria":"关闭技能安装","skills.install.tab.catalog":"目录","skills.install.tab.repo":"仓库","skills.install.tab.local":"本地","skills.install.catalog.searchAria":"搜索技能目录","skills.install.catalog.searchPlaceholder":"搜索目录…","skills.install.catalog.loading":"正在加载目录…","skills.install.catalog.empty":"未找到技能","skills.install.catalog.byAuthor":"作者:{author}","skills.install.catalog.tag.official":"官方","skills.install.catalog.tag.popular":"热门","skills.install.catalog.tag.community":"社区","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"技能仓库地址","skills.install.repo.credentialsHint":"使用 Blade 进程可用的 Git 凭据","skills.install.local.label":"本地路径","skills.install.local.inputAria":"本地技能路径","skills.status.dialogTitle":"安装状态","skills.status.confirm.title":"确认安装","skills.status.confirm.prompt":"安装所选技能?","skills.status.installing.title":"正在安装","skills.status.installing.description":"正在下载并校验…","skills.status.failed.title":"安装失败","skills.status.failed.fallback":"安装失败。","skills.status.failed.hint":"请检查访问权限后重试。","skills.error.deleteFailed":"删除技能失败","skills.error.toggleFailed":"切换技能状态失败","skills.error.installFailed":"安装技能失败","schedule.title":"定时任务","schedule.description":"按 cron、间隔或一次性触发器自动运行无界面任务提示词。","schedule.new":"新建定时任务","schedule.newAria":"创建新的定时任务","schedule.refresh":"刷新","schedule.reloadAria":"重新加载定时任务","schedule.create":"创建","schedule.save":"保存","schedule.cancel":"取消","schedule.confirmDelete":"确认?","schedule.empty":"暂无定时任务","schedule.enabled":"已启用","schedule.disabled":"已禁用","schedule.never":"从未","schedule.nextRun":"下次运行","schedule.lastRun":"上次运行","schedule.runCount":"已运行 {count} 次","schedule.trigger.kindAria":"触发器类型","schedule.trigger.cron":"Cron","schedule.trigger.interval":"间隔","schedule.trigger.once":"一次性","schedule.field.title":"标题(可选)","schedule.field.cron":"Cron 表达式","schedule.field.interval":"间隔","schedule.field.runAt":"运行时间","schedule.field.prompt":"提示词","schedule.field.project":"项目路径","schedule.field.model":"模型(可选)","schedule.field.permissionMode":"权限模式","schedule.field.isolation":"隔离方式","schedule.placeholder.title":"每晚依赖审查","schedule.placeholder.cron":"0 9 * * 1 (分 时 日 月 周)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"描述要运行的任务…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"例如 anthropic/claude-sonnet","schedule.model.current":"使用当前模型","schedule.permission.default":"默认","schedule.permission.autoEdit":"自动编辑","schedule.permission.yolo":"Yolo","schedule.permission.plan":"规划","schedule.isolation.local":"本地","schedule.isolation.worktree":"工作树","schedule.cadence.cron":"cron:{expr}","schedule.cadence.interval":"每 {interval}","schedule.cadence.once":"于 {time} 运行一次","schedule.status.queued":"排队中","schedule.status.running":"运行中","schedule.status.completed":"已完成","schedule.status.failed":"失败","schedule.status.cancelled":"已取消","schedule.status.interrupted":"已中断","schedule.status.error":"出错","schedule.status.never":"尚未运行","schedule.runNowAria":"立即运行“{title}”","schedule.editAria":"编辑“{title}”","schedule.deleteAria":"删除“{title}”","schedule.enableAria":"启用“{title}”","schedule.disableAria":"禁用“{title}”","schedule.error.promptRequired":"提示词不能为空。","schedule.error.projectRequired":"项目路径不能为空。","schedule.error.cronRequired":"Cron 表达式不能为空。","schedule.error.invalidInterval":"请输入类似 30m、2h 或 1d 的间隔。","schedule.error.runAtRequired":"请选择有效的运行时间。","schedule.error.loadFailed":"加载定时任务失败。","schedule.error.createFailed":"创建定时任务失败。","schedule.error.updateFailed":"更新定时任务失败。","schedule.error.deleteFailed":"删除定时任务失败。","schedule.error.toggleFailed":"切换定时任务状态失败。","schedule.error.runFailed":"运行定时任务失败。"},ql=["en","zh"],Ns={en:vi,zh:bi},Fa="blade-ui-locale",ln=typeof window<"u"&&typeof document<"u";function wi(){var e,t;if(ln){try{const n=(e=window.localStorage)==null?void 0:e.getItem(Fa);if(n==="en"||n==="zh")return n}catch{}return(typeof navigator<"u"&&(navigator.language||((t=navigator.languages)==null?void 0:t[0]))||"").toLowerCase().startsWith("zh")?"zh":"en"}return"en"}let dt=wi();const Ws=new Set;function xi(){for(const e of Ws)e()}function zl(){return dt}function Si(e){var t;if(e!==dt){if(dt=e,ln){try{(t=window.localStorage)==null||t.setItem(Fa,e)}catch{}document!=null&&document.documentElement&&(document.documentElement.lang=e==="zh"?"zh-CN":"en")}xi()}}function Oa(e){return Ws.add(e),()=>Ws.delete(e)}function Ci(e,t){return t?e.replace(/\{(\w+)\}/g,(s,n)=>{const r=t[n];return r==null?s:String(r)}):e}function pe(e,t){const n=(Ns[dt]??Ns.en)[e]??Ns.en[e];return Ci(n,t)}function $e(){return b.useSyncExternalStore(Oa,()=>dt,()=>"en"),pe}function _l(){return{locale:b.useSyncExternalStore(Oa,()=>dt,()=>"en"),setLocale:Si}}ln&&(document!=null&&document.documentElement)&&(document.documentElement.lang=dt==="zh"?"zh-CN":"en");class ns extends Error{constructor(t,s,n){super(t),this.status=s,this.code=n,this.name="HttpResponseError"}}function Gs(e){return e instanceof ns}async function Pe(e,t){const s=await fetch(e,t),n=await s.json().catch(()=>{});if(!s.ok){const r=n,o=r!=null&&r.error&&typeof r.error=="object"&&!Array.isArray(r.error)?r.error:void 0,l=typeof(r==null?void 0:r.error)=="string"?r.error:typeof(o==null?void 0:o.message)=="string"?o.message:typeof(r==null?void 0:r.message)=="string"?r.message:s.statusText||`Request failed (${s.status})`;throw new ns(l,s.status,typeof(o==null?void 0:o.code)=="string"?o.code:typeof(r==null?void 0:r.code)=="string"?r.code:void 0)}return n}const ji=oe.Object({runId:oe.String(),status:oe.String(),messageId:oe.Optional(oe.String()),queued:oe.Optional(oe.Integer({minimum:0})),followUpQueue:oe.Optional(ka),queuePosition:oe.Optional(oe.Integer({minimum:0})),queueDepth:oe.Optional(oe.Integer({minimum:0})),maxConcurrentTasks:oe.Optional(oe.Integer({minimum:1}))},{additionalProperties:!1});class Ti extends Error{constructor(s,n,r,o){super(s);_t(this,"name","FollowUpQueueMutationHttpError");this.status=n,this.code=r,this.snapshot=o}}function Pi(e){if(!(e instanceof Error)||e.name!=="FollowUpQueueMutationHttpError"||!("code"in e)||!("snapshot"in e))return!1;const t=e;return typeof t.code=="string"&&va.safeParse({error:{code:t.code,message:t.message},snapshot:t.snapshot}).success}const z="",Kn=1e4,Ai=oe.Array(At),Ri=oe.Array(ya),Ei=oe.Array(Ur),Ni=oe.Array(qr),Mi=oe.Array(zr),Vn=oe.Object({cwd:oe.String(),gitBranch:oe.Optional(oe.String()),taskAdmission:oe.Optional(oe.Object({inFlight:oe.Integer({minimum:0}),queued:oe.Integer({minimum:0}),maxConcurrent:oe.Integer({minimum:1}),maxQueued:oe.Integer({minimum:1}),paused:oe.Optional(oe.Boolean())}))}),Ii=e=>Array.isArray(e)?e:e==null?"":typeof e=="string"?e:JSON.stringify(e),Fi=()=>{const e=new Date,t=String(e.getFullYear()).slice(-2),s=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0"),r=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`Session ${t}-${s}-${n} ${r}:${o}`};function Oi(e){const t=ba.parse(e);return`projectPath=${encodeURIComponent(t.projectPath)}`}function ye(e,t){const s=Oi(t);return`${e}${e.includes("?")?"&":"?"}${s}`}function Qn(e){return{"x-blade-directory":ba.parse(e).projectPath}}const Ms=(e,t,s)=>({id:`history-${t}-${s}`,role:e.role,content:Ii(e.content),timestamp:s,metadata:e.metadata&&typeof e.metadata=="object"?e.metadata:void 0,tool_call_id:e.tool_call_id,name:e.name,tool_calls:e.tool_calls,thinkingContent:e.thinkingContent??e.reasoningContent}),D={listProjects:async()=>{const e=await fetch(`${z}/projects`);if(!e.ok)throw new Error("Failed to load projects");return ze(Ri,await e.json())},bindProject:async e=>{var s;const t=await fetch(`${z}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to bind project")}return ya.parse(await t.json())},pickProjectDirectory:async()=>ze(ro,await Pe(`${z}/projects/pick`,{method:"POST"})),unbindProject:async e=>{if(!(await fetch(`${z}/projects?path=${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to unbind project")},listSessions:async()=>{const e=await fetch(`${z}/sessions`);if(!e.ok)throw new Error("Failed to load sessions");return ze(Ai,await e.json())},listSessionPage:async(e,t=50,s=!1)=>{const n=new URLSearchParams({limit:String(t)});e&&n.set("cursor",e),s&&n.set("archived","true");const r=await fetch(`${z}/sessions/catalog?${n.toString()}`);if(!r.ok)throw new Error("Failed to load session catalog");return ao.parse(await r.json())},listSurfaceCatalog:async(e={})=>{const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit!==void 0&&t.set("limit",String(e.limit)),e.archived!==void 0&&t.set("archived",String(e.archived)),e.workspaceKind&&t.set("workspaceKind",e.workspaceKind);const s=t.toString();return no.parse(await Pe(`${z}/sessions/v2/catalog${s?`?${s}`:""}`))},openSurface:async(e,t,s)=>An.parse(await Pe(`${z}/sessions/v2/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(so.parse({locator:e,...t===void 0?{}:{limit:t}})),signal:s})),loadSurfaceHistoryPage:async(e,t,s,n,r)=>_r.parse(await Pe(`${z}/sessions/v2/history`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(to.parse({locator:e,cursor:t,expectedSnapshot:s,...n===void 0?{}:{limit:n}})),signal:r})),forkSurface:async(e,t)=>An.parse(await Pe(`${z}/sessions/v2/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(eo.parse({locator:e})),signal:t})),getSession:async e=>At.parse(await Pe(ye(`${z}/sessions/${e.sessionId}`,e))),createSession:async(e,t)=>{const s=await fetch(`${z}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e,title:t||Fi()})});if(!s.ok)throw new Error("Failed to create session");return At.parse(await s.json())},startCodeReview:async(e,t)=>{var n,r;const s=await fetch(`${z}/sessions/${e.sessionId}/review`,{method:"POST",headers:{"Content-Type":"application/json",...Qn(e)},body:JSON.stringify({projectPath:e.projectPath,...t})});if(!s.ok){const o=await s.json().catch(()=>{}),l=((n=o==null?void 0:o.error)==null?void 0:n.code)==="CONFLICT"?pe("taskHome.review.conflict"):((r=o==null?void 0:o.error)==null?void 0:r.code)==="BAD_REQUEST"?pe("taskHome.review.invalidTarget"):pe("taskHome.review.startFailed");throw new Error(l)}return Zr.parse(await s.json())},getWorkspaceInfo:async()=>ze(Vn,await Pe(`${z}/global/info`)),createTask:async e=>{var s;const t=await fetch(`${z}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to dispatch task")}return En.parse(await t.json())},updateTask:async(e,t)=>{var n;const s=await fetch(ye(`${z}/tasks/${e.sessionId}`,e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok){const r=await s.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to update task")}return At.parse(await s.json())},setTaskAdmissionPaused:async e=>ze(Vn.properties.taskAdmission,await Pe(`${z}/global/task-admission`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:e})})),retryTask:async e=>{var s;const t=await fetch(ye(`${z}/tasks/${e.sessionId}/retry`,e),{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to retry task")}return En.parse(await t.json())},deliverTask:async(e,t)=>{var n;const s=await fetch(ye(`${z}/tasks/${e.sessionId}/delivery`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t})});if(!s.ok){const r=await s.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to deliver task changes")}return At.parse(await s.json())},getTaskDiff:async e=>{var s;const t=await fetch(ye(`${z}/tasks/${e.sessionId}/diff`,e));if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to load task diff")}return Xr.parse(await t.json())},deleteSession:async e=>{if(!(await fetch(ye(`${z}/sessions/${e.sessionId}`,e),{method:"DELETE"})).ok)throw new Error("Failed to delete session")},archiveSession:async e=>Yr.parse(await Pe(ye(`${z}/sessions/${e.sessionId}/archive`,e),{method:"POST"})),unarchiveSession:async e=>Jr.parse(await Pe(ye(`${z}/sessions/${e.sessionId}/unarchive`,e),{method:"POST"})),exportSessionMarkdown:async(e,t=!1)=>{var v,c;const s=ye(`${z}/sessions/${e.sessionId}/export`,e),n=t?`${s}&includeReasoning=true`:s,r=await fetch(n);if(!r.ok){const u=await r.json().catch(()=>{});throw new Error(((v=u==null?void 0:u.error)==null?void 0:v.message)||"Failed to export session")}const o=r.headers.get("content-disposition")??"",l=((c=/filename="([A-Za-z0-9._-]+)"/.exec(o))==null?void 0:c[1])??`blade-session-${e.sessionId.slice(0,12)}.md`,m=r.headers.get("x-blade-content-sha256")??"";if(!/^[a-f0-9]{64}$/.test(m))throw new Error("Session export is missing its integrity hash");const k=u=>{const i=r.headers.get(u);if(i===null)throw new Error(`Session export is missing its ${u} header`);const d=Number(i);if(!Number.isInteger(d)||d<0)throw new Error(`Session export has an invalid ${u} header`);return d};return{filename:l,markdown:await r.text(),contentSha256:m,messageCount:k("x-blade-export-messages"),activityCount:k("x-blade-export-activities"),redactionCount:k("x-blade-export-redactions")}},updateSession:async(e,t)=>{if(!(await fetch(`${z}/sessions/${e.sessionId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,projectPath:e.projectPath})})).ok)throw new Error("Failed to update session")},getMessages:async e=>{const t=await fetch(ye(`${z}/sessions/${e.sessionId}/message`,e));if(!t.ok)throw new Error("Failed to load messages");const s=ze(Ei,await t.json()),n=Date.now();return s.map((r,o)=>Ms(r,o,n))},sendMessage:async(e,t,s)=>{var r,o;const n=await fetch(`${z}/sessions/${e.sessionId}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,permissionMode:s,projectPath:e.projectPath})});if(!n.ok){const l=await n.json().catch(()=>{}),m=((r=l==null?void 0:l.error)==null?void 0:r.message)??(l==null?void 0:l.reason);throw new ns(m||"Failed to send message",n.status,(o=l==null?void 0:l.error)==null?void 0:o.code)}return ze(ji,await n.json())},getFollowUpQueue:async e=>ka.parse(await Pe(ye(`${z}/sessions/${e.sessionId}/follow-ups`,e))),mutateFollowUpQueue:async(e,t)=>{const s=await fetch(ye(`${z}/sessions/${e.sessionId}/follow-ups/mutate`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await s.json().catch(()=>{});if(!s.ok){const r=va.safeParse(n);throw r.success?new Ti(r.data.error.message,s.status,r.data.error.code,r.data.snapshot):new ns("Failed to mutate follow-up queue",s.status)}return Gr.parse(n).snapshot},askSideQuestion:async(e,t,s)=>Wr.parse(await Pe(`${z}/sessions/${e.sessionId}/side-question`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:t,projectPath:e.projectPath}),signal:s})),executeUserShellCommand:async(e,t)=>Qr.parse(await Pe(`${z}/sessions/${e.sessionId}/shell`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:t,projectPath:e.projectPath})})),abortSession:async e=>{var s;const t=await fetch(ye(`${z}/sessions/${e.sessionId}/abort`,e),{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to stop task")}},getGoal:async e=>{const t=await fetch(ye(`${z}/sessions/${e.sessionId}/goal`,e));if(!t.ok)throw new Error("Failed to load goal");return(await t.json()).goal},createGoal:async(e,t,s,n)=>{const r=await fetch(ye(`${z}/sessions/${e.sessionId}/goal`,e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({objective:t,tokenBudget:s,permissionMode:n})});if(!r.ok)throw new Error("Failed to create goal");return r.json()},updateGoal:async(e,t)=>{const s=await fetch(ye(`${z}/sessions/${e.sessionId}/goal`,e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error("Failed to update goal");return s.json()},clearGoal:async e=>{if(!(await fetch(ye(`${z}/sessions/${e.sessionId}/goal`,e),{method:"DELETE"})).ok)throw new Error("Failed to clear goal")},listRewindCheckpoints:async e=>{const t=await fetch(ye(`${z}/sessions/${e.sessionId}/rewind`,e));if(!t.ok)throw new Error("Failed to load rewind checkpoints");const s=await t.json();return ze(Ni,s.checkpoints)},rewindSession:async(e,t,s)=>{const n=await fetch(ye(`${z}/sessions/${e.sessionId}/rewind`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetMessageId:t,mode:s})});if(!n.ok)throw new Error("Failed to rewind session");const r=Vr.parse(await n.json()),o=Date.now();return{...r,messages:r.messages.map((l,m)=>Ms(l,m,o))}},listSubagents:async e=>{const t=await fetch(ye(`${z}/sessions/${e.sessionId}/subagents`,e));if(!t.ok)throw new Error("Failed to load subagents");const s=await t.json();return ze(Mi,s.subagents)},resumeSubagent:async(e,t,s)=>{const n=await fetch(ye(`${z}/sessions/${e.sessionId}/subagents/${encodeURIComponent(t)}/resume`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:s})});if(!n.ok){const r=await n.json().catch(()=>{});throw new Error((r==null?void 0:r.message)||"Failed to resume subagent")}return Kr.parse(await n.json())},forkSession:async e=>{const t=await fetch(`${z}/sessions/${e.sessionId}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath})});if(!t.ok)throw new Error("Failed to fork session");const s=$r.parse(await t.json()),n=Date.now();return{session:s.session,messages:s.messages.map((r,o)=>Ms(r,o,n))}},openEventSubscription:async(e,t,s)=>{const n=(s==null?void 0:s.maxRetries)??5,r=s==null?void 0:s.onConnectionChange,o=s==null?void 0:s.onConnectionStateChange;let l=null,m=0,k=null,v=Date.now(),c=null,u=null,i=!1,d=!1,p=0,g,f,h=!1;const C=new Promise((P,B)=>{g=P,f=B}),S=()=>{c&&(clearInterval(c),c=null)},T=()=>{u&&(clearTimeout(u),u=null)},j=()=>{l==null||l.close(),l=null},A=()=>{k&&(clearTimeout(k),k=null),S(),T(),j()},w=()=>{h||(h=!0,T(),g())},E=P=>{h||(h=!0,A(),f(P))},F=()=>{if(i||m>=n){m>=n&&(console.error(`SSE max retries (${n}) reached, giving up`),o==null||o("offline"));return}m++,o==null||o("reconnecting");const P=Math.min(1e3*Math.pow(2,m-1),3e4);console.log(`SSE reconnecting in ${P}ms (attempt ${m}/${n})`),k=setTimeout(()=>{N().catch(B=>{console.error("SSE reconnect failed",B),r==null||r(!1),F()})},P)},x=()=>{m=0,v=Date.now(),r==null||r(!0),o==null||o("connected"),S(),c=setInterval(()=>{Date.now()-v>45e3&&(console.warn("SSE heartbeat timeout, reconnecting..."),S(),j(),r==null||r(!1),o==null||o("reconnecting"),F())},15e3),d||(d=!0,w())},N=async()=>{if(i)return;j();const P=ye(`${z}/sessions/${e.sessionId}/events`,e),B=p>0?`${P}${P.includes("?")?"&":"?"}lastEventId=${p}`:P;l=new EventSource(B),d||(T(),u=setTimeout(()=>{o==null||o("offline"),E(new Error("Timed out waiting for event subscription readiness"))},Kn)),l.onmessage=U=>{try{const _=JSON.parse(U.data);typeof _.seq=="number"&&_.seq>p&&(p=_.seq);const Q=Rn.parse(_);if(v=Date.now(),Q.type==="connected"){Q.properties.sessionId===e.sessionId&&Q.properties.projectPath===e.projectPath&&(typeof Q.properties.status=="string"&&t({type:"session.status",properties:Q.properties}),Q.properties.followUpQueue!==void 0&&t({type:"follow_up.queue.changed",properties:{sessionId:e.sessionId,projectPath:e.projectPath,queue:Q.properties.followUpQueue}}),t({type:"provider.recovery",properties:{sessionId:e.sessionId,projectPath:e.projectPath,recovery:Q.properties.providerRecovery??null,authoritative:!0}}),t({type:"turn.activity",properties:{sessionId:e.sessionId,projectPath:e.projectPath,activity:Q.properties.turnActivity??null,authoritative:!0}}),x());return}if(Q.type==="heartbeat")return;t(Q)}catch(_){console.error("Failed to parse SSE event:",U.data,_)}},l.onerror=()=>{if(i)return;const U=(l==null?void 0:l.readyState)===EventSource.CLOSED;if(S(),j(),U){r==null||r(!1),o==null||o("offline"),d||E(new Error("Event subscription closed before it was ready"));return}if(!d){o==null||o("offline"),E(new Error("Failed to open event subscription"));return}r==null||r(!1),F()}};return o==null||o("connecting"),N().catch(P=>{o==null||o("offline"),E(P instanceof Error?P:new Error("Failed to open event subscription"))}),await C,()=>{i=!0,k&&(clearTimeout(k),k=null),A(),r==null||r(!1)}},openTaskEventSubscription:async(e,t)=>{const s=t==null?void 0:t.onConnectionChange,n=t==null?void 0:t.onConnectionStateChange,r=new EventSource(`${z}/events`);let o=!1,l=!1,m,k,v;const c=new Promise((i,d)=>{k=i,v=d}),u=()=>{o||(o=!0,m!==void 0&&(clearTimeout(m),m=void 0),r.close(),s==null||s(!1),n==null||n("offline"))};return n==null||n("connecting"),m=setTimeout(()=>{l||o||(u(),v(new Error("Timed out waiting for global task events")))},Kn),r.onmessage=i=>{try{const d=Rn.parse(JSON.parse(i.data));if(d.type==="connected"){l||(l=!0,m!==void 0&&(clearTimeout(m),m=void 0),k()),s==null||s(!0),n==null||n("connected");return}if(d.type==="heartbeat")return;e(d)}catch(d){console.error("Failed to parse global task event:",i.data,d)}},r.onerror=()=>{s==null||s(!1),n==null||n(l?"reconnecting":"offline"),!l&&!o&&(u(),v(new Error("Failed to open global task events")))},await c,u},respondPermission:async(e,t,s)=>{var o;const n=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),r=await fetch(`${z}/permissions/${t}?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok){const l=await r.json().catch(()=>{});throw new Error(((o=l==null?void 0:l.error)==null?void 0:o.message)||"Failed to respond to permission")}},respondToConfirmation:async(e,t,s)=>{if(!(await fetch(ye(`${z}/sessions/${e.sessionId}/confirmation/${t}`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:s})})).ok)throw new Error("Failed to respond to confirmation")},respondToQuestion:async(e,t,s)=>{var o;const n=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),r=await fetch(`${z}/permissions/${t}?${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:!0,answers:s})});if(!r.ok){const l=await r.json().catch(()=>{});throw new Error(((o=l==null?void 0:l.error)==null?void 0:o.message)||"Failed to respond to question")}},respondToElicitation:async(e,t,s)=>{var o;const n=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),r=await fetch(`${z}/permissions/${t}?${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:s.action==="accept",elicitation:s})});if(!r.ok){const l=await r.json().catch(()=>{});throw new Error(((o=l==null?void 0:l.error)==null?void 0:o.message)||"Failed to respond to MCP elicitation")}},getGitInfo:async e=>{const t=await fetch(`${z}/suggestions/git-info`,{headers:Qn(e)});if(!t.ok)throw new Error("Failed to get git info");return t.json()},listSchedules:async()=>{var s;const e=await fetch(`${z}/schedules`);if(!e.ok){const n=await e.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.loadFailed"))}return Br.parse(await e.json()).schedules},createSchedule:async e=>{var s;const t=await fetch(`${z}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.createFailed"))}return St.parse(await t.json())},updateSchedule:async(e,t)=>{var n;const s=await fetch(`${z}/schedules/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok){const r=await s.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||pe("schedule.error.updateFailed"))}return St.parse(await s.json())},deleteSchedule:async e=>{var s;const t=await fetch(`${z}/schedules/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.deleteFailed"))}},enableSchedule:async e=>{var s;const t=await fetch(`${z}/schedules/${encodeURIComponent(e)}/enable`,{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.toggleFailed"))}return St.parse(await t.json())},disableSchedule:async e=>{var s;const t=await fetch(`${z}/schedules/${encodeURIComponent(e)}/disable`,{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.toggleFailed"))}return St.parse(await t.json())},runSchedule:async e=>{var s;const t=await fetch(`${z}/schedules/${encodeURIComponent(e)}/run`,{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.runFailed"))}return St.parse(await t.json())}};function ee(e){return{sessionId:e.sessionId,projectPath:e.projectPath}}function ce(e){return JSON.stringify([e.projectPath,e.sessionId])}function Ha(e){return JSON.stringify([e.version,e.sessionId,e.workspace.kind,e.workspace.kind==="local"?e.workspace.projectPath:e.workspace.workspaceRef])}function V(e,t){return!e||!t?e===t:e.sessionId===t.sessionId&&e.projectPath===t.projectPath}function Zt(e,t){return!e||!t?e===t:e.version!==t.version||e.sessionId!==t.sessionId||e.workspace.kind!==t.workspace.kind?!1:e.workspace.kind==="local"&&t.workspace.kind==="local"?e.workspace.projectPath===t.workspace.projectPath:e.workspace.kind==="acp-remote"&&t.workspace.kind==="acp-remote"?e.workspace.workspaceRef===t.workspace.workspaceRef:!1}function as(e,t){return e.find(s=>V(ee(s),t))}function Ae(e,t){const s=ee(t),n=e.findIndex(o=>V(ee(o),s));if(n===-1)return[...e,t];const r=[...e];return r[n]=t,r}function Wn(e,t){return e.filter(s=>!V(ee(s),t))}const Hi=4;function Is(){const e=new Error("Aborted");return e.name="AbortError",e}class Li{constructor(){_t(this,"active",0);_t(this,"waiters",[])}async run(t,s){await this.acquire(t);try{return t.throwIfAborted(),await s()}finally{this.release()}}acquire(t){return t.aborted?Promise.reject(Is()):this.active<Hi?(this.active+=1,Promise.resolve()):new Promise((s,n)=>{const r=()=>{const l=this.waiters.indexOf(o);l>=0&&this.waiters.splice(l,1),n(Is())},o={signal:t,resolve:s,reject:n,removeAbortListener:()=>t.removeEventListener("abort",r)};t.addEventListener("abort",r,{once:!0}),this.waiters.push(o)})}release(){for(;this.waiters.length>0;){const t=this.waiters.shift();if(!t)break;if(t.removeAbortListener(),t.signal.aborted){t.reject(Is());continue}t.resolve();return}this.active-=1}}const Di=new Li,ot=new Map;function Ui(e,t){return Di.run(e,t)}function qi(e){const t=Ha(e),s=ot.get(t);if(s!=null&&s.signal.aborted){ot.delete(t);return}return s==null?void 0:s.promise}function zi(e,t,s){const n=Ha(e),r=ot.get(n);if(r&&!r.signal.aborted)return r.promise;r&&ot.delete(n);const o=Symbol(n),l=s().finally(()=>{var m;((m=ot.get(n))==null?void 0:m.token)===o&&ot.delete(n)});return ot.set(n,{signal:t,token:o,promise:l}),l}const Fs=50,Js=500,_i=new Set(["session_surface_cursor_invalid","session_surface_snapshot_changed"]);function Tt(e){let t=null;if(Gs(e)&&e.code!==void 0)try{t=oo.parse(e.code)}catch{t=null}return{code:t,message:e instanceof Error?e.message:"Session history request failed"}}function $t(e){return e instanceof Error&&e.name==="AbortError"}function Bi(e){return{locator:e.session.locator,displayCwd:e.session.displayCwd,capabilities:e.session.capabilities,mode:"history-only"}}function $i(e){return e.length<=Js?e:e.slice(-Js)}function Ki(e,t){const s=new Set(t.map(n=>n.id));return[...e.filter(n=>!s.has(n.id)),...t].slice(0,Js).map(n=>({...n}))}function Vi(e,t){return e.workspace.kind!==t.workspace.kind?!1:e.workspace.kind==="local"&&t.workspace.kind==="local"?e.workspace.projectPath===t.workspace.projectPath:e.workspace.kind==="acp-remote"&&t.workspace.kind==="acp-remote"?e.workspace.workspaceRef===t.workspace.workspaceRef:!1}const Qi=(e,t)=>{let s=0,n=null,r={},o=0,l=null;const m=(u,i)=>{var d;return u===o&&Zt((d=t().historySurfaceSelection)==null?void 0:d.locator,i)},k=()=>(l==null||l.abort(),l=new AbortController,o+=1,{generation:o,controller:l}),v=()=>{o+=1,l==null||l.abort(),l=null},c=(u,i,d,p=null)=>{if(i===o){if(!Zt(d,u.session.locator))throw new Error("Session history response locator mismatch");e({historySurfaceSelection:Bi(u),historySurfaceMessages:$i(u.history.messages),historySurfaceOlderCursor:u.history.olderCursor??null,historySurfaceSnapshot:u.history.snapshot,historySurfaceGeneration:i,historySurfaceLoadState:"ready",historySurfaceError:null,historySurfaceRecoveryCode:p,historySurfaceTruncated:u.history.truncated})}};return{surfaceCatalog:[],surfaceCatalogLoadState:"idle",surfaceCatalogError:null,historySurfaceSelection:null,historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceGeneration:0,historySurfaceLoadState:"idle",historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:!1,loadSurfaceCatalog:(u={})=>(s++,r={...u},n||(n=Promise.resolve().then(async()=>{try{let i;do{i=s;const d=r,p=t().catalogOverlayRevision??0;e({surfaceCatalogLoadState:"loading",surfaceCatalogError:null});try{const g=[];let f;do{const h=await D.listSurfaceCatalog({...d,cursor:f,limit:Fs});if(i!==s)break;for(const C of h.sessions){const S=g.findIndex(T=>Zt(T.locator,C.locator));S<0?g.push(C):g[S]=C}f=h.nextCursor}while(f);if(i!==s)continue;if((t().catalogOverlayRevision??0)!==p){s++;continue}e({surfaceCatalog:g,surfaceCatalogLoadState:"ready",surfaceCatalogError:null})}catch(g){if(i!==s)continue;e({surfaceCatalogLoadState:"error",surfaceCatalogError:Tt(g)})}}while(i!==s)}finally{n=null}}),n)),openHistorySurface:async(u,i=Fs)=>{if(u.workspace.kind==="local"){await t().selectSession({sessionId:u.sessionId,projectPath:u.workspace.projectPath});return}const{generation:d,controller:p}=k(),g=t().claimViewSelection();e({historySurfaceSelection:null,historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceGeneration:d,historySurfaceLoadState:"loading",historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:!1});try{const f=await D.openSurface(u,i,p.signal);if(g!==t().getViewSelectionVersion())return;c(f,d,u)}catch(f){if(d!==o||$t(f))return;e({historySurfaceLoadState:"error",historySurfaceError:Tt(f)})}},loadOlderSurfaceHistory:async(u=Fs)=>{var T;const i=t();if(i.historySurfaceSelection&&!i.historySurfaceSelection.capabilities.history.read){e({historySurfaceError:{code:"session_surface_capability_unavailable",message:"Session history read is unavailable"}});return}const d=(T=i.historySurfaceSelection)==null?void 0:T.locator,p=i.historySurfaceOlderCursor,g=i.historySurfaceSnapshot;if(!d||!p||!g)return;const f=qi(d);if(f)return f;const h=o,C=l;return C?zi(d,C.signal,async()=>{e({historySurfaceLoadState:"loading-older",historySurfaceError:null});try{const j=await Ui(C.signal,()=>D.loadSurfaceHistoryPage(d,p,g,u,C.signal));if(!m(h,d))return;if(j.snapshot!==g)throw new Error("Session history response snapshot mismatch");e(A=>({historySurfaceMessages:Ki(j.messages,A.historySurfaceMessages),historySurfaceOlderCursor:j.olderCursor??null,historySurfaceSnapshot:j.snapshot,historySurfaceLoadState:"ready",historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:A.historySurfaceTruncated||j.truncated}))}catch(j){if(!m(h,d)||$t(j))return;const A=Tt(j);if(A.code&&_i.has(A.code)){const w=A.code;e({historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceLoadState:"loading",historySurfaceError:null,historySurfaceRecoveryCode:w,historySurfaceTruncated:!1});try{const E=await D.openSurface(d,u,C.signal);c(E,h,d,w)}catch(E){if(!m(h,d)||$t(E))return;e({historySurfaceLoadState:"error",historySurfaceError:Tt(E)})}return}e({historySurfaceLoadState:"error",historySurfaceError:A})}}):void 0},forkHistorySurface:async()=>{const u=t().historySurfaceSelection,i=u==null?void 0:u.locator;if(!i)return;if(!u.capabilities.history.fork){e({historySurfaceError:{code:"session_surface_capability_unavailable",message:"Session history fork is unavailable"}});return}const{generation:d,controller:p}=k();e({historySurfaceGeneration:d,historySurfaceLoadState:"forking",historySurfaceError:null,historySurfaceRecoveryCode:null});try{const g=await D.forkSurface(i,p.signal);if(!Vi(i,g.session.locator))throw new Error("Forked Session workspace mismatch");c(g,d,g.session.locator),t().loadSurfaceCatalog()}catch(g){if(d!==o||$t(g))return;e({historySurfaceLoadState:"error",historySurfaceError:Tt(g)})}},closeHistorySurface:()=>{v(),e({historySurfaceSelection:null,historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceGeneration:o,historySurfaceLoadState:"idle",historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:!1})}}},Wi=(e,t)=>({messages:[],setMessages:s=>e({messages:s}),addMessage:s=>e(n=>({messages:[...n.messages,s]})),updateMessage:(s,n)=>e(r=>({messages:r.messages.map(o=>o.id===s?{...o,...n}:o)})),appendDelta:(s,n,r)=>e(o=>({messages:o.messages.map(l=>{if(l.id!==s)return l;const m=l.agentContent||Ue();return r==="before"?{...l,agentContent:{...Mn(m,n),textBefore:m.textBefore+n}}:{...l,agentContent:{...Mn(m,n),textAfter:m.textAfter+n}}})})),appendToolCall:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:uo(l,n)}})})),updateToolCall:(s,n,r)=>e(o=>({messages:o.messages.map(l=>{if(l.id!==s)return l;const m=l.agentContent;return m?{...l,agentContent:{...m,toolCalls:m.toolCalls.map(k=>k.toolCallId===n?{...k,...r}:k)}}:l})})),appendThinking:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...lo(l,n),thinkingContent:l.thinkingContent+n}}})})),setConfirmation:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...l,confirmation:n}}})})),setQuestion:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...l,question:n}}})})),setElicitation:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...l,elicitation:n}}})})),setSubagent:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:n?co(l,n):Nn(l,[])}})})),updateSubagent:(s,n,r)=>e(o=>({messages:o.messages.map(l=>{if(l.id!==s)return l;const m=l.agentContent||Ue(),k=[...io(m)],v=k.findIndex(i=>i.id===n||i.sessionId===n);if(v===-1)return l;const c=k[v],u=typeof r=="function"?r(c):r;return k[v]={...c,...u,id:c.id},{...l,agentContent:Nn(m,k,k[v].id)}})})),setTasks:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...l,tasks:n}}})})),replaceTemp:(s,n)=>e(r=>{const o=r.messages.findIndex(m=>m.content===s&&m.role==="user");if(o===-1)return r;const l=[...r.messages];return l[o]=n,{messages:l}})}),Os=60,Gi=[/<system-reminder>[\s\S]*?<\/system-reminder>/gi,/<file[^>]*>[\s\S]*?<\/file>/gi,/<hooks_context>[\s\S]*?<\/hooks_context>/gi,/<[^>]+>/g];function Ji(e){let t=e;for(const k of Gi)t=t.replace(k," ");t=t.replace(/^\s*\/[a-zA-Z][\w-]*\s+/,"");const s=t.replace(/\s+/g," ").trim();if(!s)return"";const n=s.match(/^(.+?)(?:[.!?]\s|[。!?](?=\S|$)|$)/);let r=n&&n[1].length>=6?n[1]:s;if(r=r.trim().replace(/[\s.。!!??,,;;::-]+$/,""),r.length<=Os)return r;const o=r.slice(0,Os),l=o.lastIndexOf(" ");return`${(l>Os*.6?o.slice(0,l):o).trimEnd()}…`}const es="/.blade/worktrees/",Yi=/-[a-f0-9]{8,}$/i,Xi=/^(.+?(?:test|config))-[a-z0-9]{6,}$/i;function Zi(e){const t=e.indexOf(es);if(t<0)return null;const s=e.slice(t+es.length).split("/")[0];return s?`${e.slice(0,t+es.length)}${s}`:null}function ec(e){if(!e.includes("/tmp/")&&!e.includes("/T/"))return null;const t=e.split("/"),s=t.at(-1),n=s==null?void 0:s.match(Xi);return n!=null&&n[1]?(t[t.length-1]=n[1],t.join("/")):null}function Gn(e){const t=e.split("/").filter(Boolean).at(-1)||e;return e.includes(es)?t.replace(Yi,""):t}function fs(e,t=null){const s=e.taskSourceProjectPath,n=ec(s||e.projectPath);if(n)return n;if(s)return s;const r=Zi(e.projectPath);if(!r)return e.projectPath;const o=Gn(r);return t&&o===Gn(t)?t:r}function tc(e,t,s=null){return t?e.filter(n=>fs(n,s)===t):e}const Ys=Ze.AUTO_EDIT;let Hs=0;const Te=ps((e,t)=>({currentModelId:null,currentMode:Ys,configuredModels:[],availableModels:[],isLoading:!1,hasLoaded:!1,loadedWorkspacePath:null,error:null,loadModels:async s=>{const n=s??null;if(t().isLoading&&t().loadedWorkspacePath===n)return;const r=++Hs;e({isLoading:!0,hasLoaded:!1,loadedWorkspacePath:n,error:null});try{const o=await Pe("/models",s?{headers:{"x-blade-directory":s}}:void 0);if(r!==Hs||t().loadedWorkspacePath!==n)return;const l=o.current;e({currentModelId:(l==null?void 0:l.id)||null,configuredModels:o.configured||[],availableModels:o.available||[],isLoading:!1,hasLoaded:!0})}catch(o){if(r!==Hs||t().loadedWorkspacePath!==n)return;e({error:o instanceof Error?o.message:"Failed to load models",isLoading:!1,hasLoaded:!0})}},setCurrentModel:async(s,n)=>{if(e({error:null}),n){e({currentModelId:s});return}try{await Pe("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:{currentModelId:s},options:{scope:"global"}})}),e({currentModelId:s})}catch(r){throw e({error:r instanceof Error?r.message:"Failed to set model"}),r}},setMode:s=>e({currentMode:s}),resetMode:()=>e({currentMode:Ys})})),sc=e=>e==="system"?typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",ts=e=>{if(typeof document>"u")return;const t=document.documentElement;if(t.classList.remove("light","dark"),e==="system"){const n=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";t.classList.add(n)}else t.classList.add(e)},Fe={language:"zh-CN",codeTheme:"dracula",uiTheme:"system",autoSaveSessions:!0,notifyBuild:!0,notifyErrors:!1,notifySounds:!1,privacyTelemetry:!1,privacyCrash:!0,agentTeamsEnabled:!1,communicationStyle:"auto"},ut=ps((e,t)=>({...Fe,isLoading:!1,error:null,loadSettings:async()=>{e({isLoading:!0,error:null});try{const s=await fetch("/configs");if(!s.ok)throw new Error(pe("settings.general.loadError"));const n=await s.json(),r=n.uiTheme??Fe.uiTheme;e({language:n.language??Fe.language,codeTheme:n.codeTheme??Fe.codeTheme,uiTheme:r,autoSaveSessions:n.autoSaveSessions??Fe.autoSaveSessions,notifyBuild:n.notifyBuild??Fe.notifyBuild,notifyErrors:n.notifyErrors??Fe.notifyErrors,notifySounds:n.notifySounds??Fe.notifySounds,privacyTelemetry:n.privacyTelemetry??Fe.privacyTelemetry,privacyCrash:n.privacyCrash??Fe.privacyCrash,agentTeamsEnabled:n.agentTeamsEnabled??Fe.agentTeamsEnabled,communicationStyle:n.communicationStyle??Fe.communicationStyle,isLoading:!1}),ts(r)}catch(s){e({error:s.message,isLoading:!1})}},updateSettings:async s=>{const n=t();e({...s,error:null}),s.uiTheme&&ts(s.uiTheme);try{if(!(await fetch("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:s,options:{scope:"global"}})})).ok)throw new Error(pe("settings.general.saveError"))}catch(r){e({language:n.language,codeTheme:n.codeTheme,uiTheme:n.uiTheme,autoSaveSessions:n.autoSaveSessions,notifyBuild:n.notifyBuild,notifyErrors:n.notifyErrors,notifySounds:n.notifySounds,privacyTelemetry:n.privacyTelemetry,privacyCrash:n.privacyCrash,agentTeamsEnabled:n.agentTeamsEnabled,communicationStyle:n.communicationStyle,error:r.message}),s.uiTheme&&ts(n.uiTheme)}}}));ts(Fe.uiTheme);const Bl=()=>ut(e=>sc(e.uiTheme)),Ls="__temp__",Et={inputTokens:0,outputTokens:0,totalTokens:0,maxContextTokens:0,isDefaultMaxTokens:!0,totalInputTokens:0,totalOutputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0},La="blade.tasks.unread",Da="blade.tasks.terminal-read-ledger.v1",nc=16384,ac=1024,rs="blade:open-session";function dn(e){return e==="completed"||e==="failed"||e==="interrupted"}function Kt(){return{version:1,entries:[]}}function Ua(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}function os(e){var t;return dn(e.taskStatus)?JSON.stringify([e.taskStatus,Ua(e.taskCompletedAt),sn((t=e.taskFailure)==null?void 0:t.code)??null]):null}function qa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rc(e){if(e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e))return!0;if(!e.startsWith("\\\\"))return!1;const[t,s]=e.slice(2).split(/[\\/]/);return!!(t&&s)}function oc(e){if(e.length===0||e.length>nc)return!1;try{const t=JSON.parse(e);return!Array.isArray(t)||t.length!==2||typeof t[0]!="string"||typeof t[1]!="string"||!rc(t[0])||t[1].length===0?!1:ce({projectPath:t[0],sessionId:t[1]})===e}catch{return!1}}function ic(e){try{const t=JSON.parse(e);if(!Array.isArray(t)||t.length!==3||!dn(t[0]))return!1;const s=t[1];if(s!==null&&(typeof s!="string"||Ua(s)!==s))return!1;const n=t[2]===null?null:sn(t[2])??void 0;return n===void 0?!1:JSON.stringify([t[0],s,n])===e}catch{return!1}}function cc(e){return!qa(e)||typeof e.key!="string"||!oc(e.key)||e.signature!==null&&(typeof e.signature!="string"||!ic(e.signature))?null:{key:e.key,signature:e.signature}}function lc(e=typeof localStorage>"u"?null:localStorage){if(!e)return Kt();try{const t=e.getItem(Da);if(t===null)return Kt();const s=JSON.parse(t);if(!qa(s)||s.version!==1||!Array.isArray(s.entries))return Kt();const n=new Map;for(const r of s.entries){const o=cc(r);o&&(n.delete(o.key),n.set(o.key,o))}return{version:1,entries:[...n.values()]}}catch{return Kt()}}function it(e,t=typeof localStorage>"u"?null:localStorage){if(t)try{t.setItem(Da,JSON.stringify(e))}catch{}}function gt(e,t,s){const n=ce(t);return{version:1,entries:[...e.entries.filter(r=>r.key!==n),{key:n,signature:os(s)}]}}function dc(e){const t=new Set(e.sessions.map(l=>ce({sessionId:l.sessionId,projectPath:l.projectPath}))),s=new Set(e.unreadTaskKeys),n=e.ledger.entries.filter(l=>t.has(l.key)),r=n.filter(l=>l.signature!==null&&!s.has(l.key)),o=new Set(r.slice(0,Math.max(0,r.length-ac)));return{version:1,entries:n.filter(l=>!o.has(l))}}function uc(e){var k;const t=new Map;for(const v of e.ledger.entries)t.delete(v.key),t.set(v.key,v);const s=new Set(e.unreadTaskKeys),n=e.documentVisible&&e.currentSessionRef?ce(e.currentSessionRef):null,r=(v,c)=>{t.delete(v),t.set(v,{key:v,signature:c})};for(const v of e.sessions){const c=ce({sessionId:v.sessionId,projectPath:v.projectPath}),u=os(v);if(!t.has(c)){r(c,u),n===c&&s.delete(c);continue}if(n===c){r(c,u),s.delete(c);continue}if(u===null){r(c,null);continue}((k=t.get(c))==null?void 0:k.signature)!==u&&s.add(c)}const o=new Set(e.sessions.map(v=>ce({sessionId:v.sessionId,projectPath:v.projectPath}))),l=[...s].filter(v=>o.has(v));return{ledger:dc({ledger:{version:1,entries:[...t.values()]},sessions:e.sessions,unreadTaskKeys:l}),unreadTaskKeys:l}}function pc(e=typeof localStorage>"u"?null:localStorage){if(!e)return[];try{const t=JSON.parse(e.getItem(La)??"[]");return Array.isArray(t)?[...new Set(t.filter(s=>typeof s=="string"))]:[]}catch{return[]}}function ct(e,t=typeof localStorage>"u"?null:localStorage){if(t)try{t.setItem(La,JSON.stringify([...new Set(e)]))}catch{}}function Jn(e){if(typeof document>"u"||document.visibilityState!=="hidden"||typeof Notification>"u"||Notification.permission!=="granted")return!1;const t=new Notification(e.title,{body:e.body,icon:"/favicon.svg",tag:`blade-task-${ce(e.ref)}`});return t.onclick=()=>e.onOpen(e.ref),!0}function hc(e){if(typeof window>"u")return!1;const t=window.AudioContext??window.webkitAudioContext;if(!t)return!1;try{const s=new t,n=s.createOscillator(),r=s.createGain();return n.type="sine",n.frequency.value=e==="completed"?660:330,r.gain.setValueAtTime(1e-4,s.currentTime),r.gain.exponentialRampToValueAtTime(.045,s.currentTime+.015),r.gain.exponentialRampToValueAtTime(1e-4,s.currentTime+.18),n.connect(r),r.connect(s.destination),n.start(),n.stop(s.currentTime+.2),n.onended=()=>void s.close(),!0}catch{return!1}}const mc=e=>{var s;const t=[];e.content.trim()&&t.push({type:"text",text:e.content});for(const n of e.attachments??[])n.type==="image"&&t.push({type:"image_url",image_url:{url:n.content}});return t.length===0?e.content:t.length===1&&((s=t[0])==null?void 0:s.type)==="text"?t[0].text:t},gc=(e,t,s)=>{if(!s)return e;const n=t.find(v=>{var u,i,d;const c=v.agentContent;if(!c)return!1;switch(s.type){case"permission":return((u=c.confirmation)==null?void 0:u.toolCallId)===s.requestId&&c.confirmation.status==="pending";case"question":return((i=c.question)==null?void 0:i.toolCallId)===s.requestId&&c.question.status==="pending";case"elicitation":return((d=c.elicitation)==null?void 0:d.toolCallId)===s.requestId&&c.elicitation.status==="pending"}});if(!(n!=null&&n.agentContent))return e;const r=e.findIndex(v=>v.id===n.id),l=e[r]??{id:n.id,role:"assistant",content:"",timestamp:n.timestamp};let m=l.agentContent??Ue();switch(s.type){case"permission":m={...m,confirmation:n.agentContent.confirmation};break;case"question":m={...m,question:n.agentContent.question};break;case"elicitation":m={...m,elicitation:n.agentContent.elicitation};break}const k={...l,agentContent:m};return r<0?[...e,k]:e.map((v,c)=>c===r?k:v)},Vt=()=>({eventUnsubscribe:null,sessionEventConnectionState:"idle",isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1}),Je=()=>({followUpQueue:null,followUpQueueMutation:{pending:!1,supersededVersions:[]}}),Yn=()=>new Promise(e=>{globalThis.setTimeout(()=>{if(typeof window<"u"&&typeof window.requestIdleCallback=="function"){window.requestIdleCallback(()=>e(),{timeout:750});return}e()},350)});function Ye(e){return e??{version:1,entries:[]}}function Xn(e,t,s){let n=[...e];for(const[r,o]of Object.entries(t))o.revision<=s||(o.kind==="remove"?n=n.filter(l=>ce(ee(l))!==r):n=Ae(n,o.session));return n}function fc(e,t){return Object.fromEntries(Object.entries(e).filter(([,s])=>s.revision>t))}const Zn=async e=>(await Be(async()=>{const{teamService:t}=await import("./teamService-CTWoTNVQ.js");return{teamService:t}},__vite__mapDeps([0,1,2,3]))).teamService.list(e),kc=(e,t)=>{let s=0,n=0,r=0,o=0;const l=new Map,m=new Map;let k=null;const v=()=>(k==null||k.abort("session-navigation"),k=null,s+=1,s),c=i=>i===s,u=i=>{try{i()}catch(d){console.warn("Failed to clean up stale event subscription",d)}};return{sessions:[],archivedSessions:[],currentSessionId:null,currentSessionRef:null,forkingSessionRef:null,isTemporarySession:!1,isLoading:!1,catalogLoadState:"idle",catalogError:null,archivedCatalogLoadState:"idle",archivedCatalogError:null,error:null,errorContext:null,goal:null,sideConversation:null,...Je(),teams:[],setSessions:i=>e({sessions:i}),addSession:i=>{e(d=>({sessions:Ae(d.sessions,i)})),t().loadSurfaceCatalog()},removeSession:i=>{const d=t(),p=ce(i),g=V(d.currentSessionRef,i),f=V(d.forkingSessionRef,i);(g||f)&&v(),g&&d.unsubscribeFromEvents();let h=d.unreadTaskKeys,C=Ye(d.taskTerminalReadLedger);e(S=>{const T={...S.sessionCatalogOverlays};return delete T[p],h=S.unreadTaskKeys.filter(j=>j!==p),C={version:1,entries:Ye(S.taskTerminalReadLedger).entries.filter(j=>j.key!==p)},{sessions:Wn(S.sessions,i),surfaceCatalog:S.surfaceCatalog.filter(j=>j.locator.workspace.kind!=="local"||j.locator.workspace.projectPath!==i.projectPath||j.locator.sessionId!==i.sessionId),unreadTaskKeys:h,taskTerminalReadLedger:C,sessionCatalogOverlays:T,currentSessionId:g?null:S.currentSessionId,currentSessionRef:g?null:S.currentSessionRef,messages:g?[]:S.messages,goal:g?null:S.goal,sideConversation:g?null:S.sideConversation,teams:g?[]:S.teams,forkingSessionRef:f?null:S.forkingSessionRef,...g?Je():{},...g?Vt():{}}}),it(C),ct(h)},setCurrentSession:i=>{v(),t().claimViewSelection(),t().closeHistorySurface(),e({currentSessionId:(i==null?void 0:i.sessionId)??null,currentSessionRef:i,isTemporarySession:!1,sideConversation:null,teams:[],pendingResume:null,...Je()})},setTemporarySession:i=>e({isTemporarySession:i}),setLoading:i=>e({isLoading:i}),setError:i=>e({error:i,errorContext:null}),getNavigationVersion:()=>s,getViewSelectionVersion:()=>n,claimViewSelection:()=>(n+=1,n),clearError:()=>e({error:null,errorContext:null}),setGoal:i=>e({goal:i}),startTemporarySession:i=>{v(),t().claimViewSelection(),t().closeHistorySurface(),t().unsubscribeFromEvents(),Te.getState().resetMode(),i&&t().selectProject(i),e({currentSessionId:Ls,currentSessionRef:null,isTemporarySession:!0,forkingSessionRef:null,isLoading:!1,messages:[],goal:null,sideConversation:null,teams:[],tokenUsage:{...Et},error:null,errorContext:null,...Je(),...Vt()})},loadSessions:async()=>{const i=++r,d=t().sessions,p=t().catalogOverlayRevision??0;let g=[];e({catalogLoadState:"loading",catalogError:null});try{let f;do{const S=await D.listSessionPage(f);if(i!==r)return;for(const T of S.sessions)g=Ae(g,T);if(e(T=>{const j=new Set(g.map(w=>ce(ee(w)))),A=[...g,...d.filter(w=>!j.has(ce(ee(w))))];return{sessions:Xn(A,T.sessionCatalogOverlays??{},p),catalogLoadState:"hydrating"}}),f=S.nextCursor,f&&(await Yn(),i!==r))return}while(f);if(i!==r)return;let h=t().unreadTaskKeys,C=Ye(t().taskTerminalReadLedger);e(S=>{const T=Xn(g,S.sessionCatalogOverlays??{},p),j=uc({ledger:Ye(S.taskTerminalReadLedger),unreadTaskKeys:S.unreadTaskKeys,sessions:T,currentSessionRef:S.currentSessionRef,documentVisible:typeof document<"u"&&document.visibilityState==="visible"});return h=j.unreadTaskKeys,C=j.ledger,{sessions:T,unreadTaskKeys:h,taskTerminalReadLedger:C,sessionCatalogOverlays:fc(S.sessionCatalogOverlays??{},p),catalogLoadState:"ready",catalogError:null}}),it(C),ct(h)}catch(f){if(i!==r)return;e({catalogLoadState:"error",catalogError:f.message})}},loadArchivedSessions:async()=>{const i=++o;e({archivedCatalogLoadState:"loading",archivedCatalogError:null});try{let d;const p=[];do{const g=await D.listSessionPage(d,50,!0);if(i!==o)return;for(const f of g.sessions){const h=p.findIndex(C=>V(ee(C),ee(f)));h===-1?p.push(f):p[h]=f}d=g.nextCursor,d&&(e({archivedCatalogLoadState:"hydrating"}),await Yn())}while(d);if(i!==o)return;e({archivedSessions:p,archivedCatalogLoadState:"ready",archivedCatalogError:null})}catch(d){if(i!==o)return;e({archivedCatalogLoadState:"error",archivedCatalogError:d.message})}},selectSession:async i=>{var f;const d=v(),p=t().claimViewSelection();t().closeHistorySurface(),e({isLoading:!0,error:null,errorContext:null,forkingSessionRef:null});let g=null;try{const h=as(t().sessions,i),C=[];let S=!1;if(g=await t().prepareEventSubscription(i,x=>{S?t().handleEvent(x):C.push(x)}),!c(d)||p!==t().getViewSelectionVersion()){u(g),g=null;return}const[T,j,A,w]=await Promise.all([D.getMessages(i),D.getGoal(i).catch(()=>null),h?Promise.resolve(h):D.getSession(i),ut.getState().agentTeamsEnabled?Zn(i).catch(()=>[]):Promise.resolve([])]);if(!c(d)||p!==t().getViewSelectionVersion()){u(g),g=null;return}const E=Bt(T),F=fs(A,t().selectedProjectPath??((f=t().taskWorkspaceInfo)==null?void 0:f.cwd)??null);t().boundProjects.some(x=>x.available&&x.path===F)&&t().selectProject(F),Te.getState().setMode(A.permissionMode??Ys),e(x=>{var N;return{currentSessionId:i.sessionId,currentSessionRef:i,isTemporarySession:!1,messages:E,goal:j,teams:w,...Je(),isLoading:!1,tokenUsage:{...Et},isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1,error:A.taskStatus==="failed"?((N=A.taskFailure)==null?void 0:N.message)??null:null,errorContext:A.taskStatus==="failed"&&A.taskFailure?{kind:"execution",sessionRef:i,failureCode:A.taskFailure.code}:null,sessions:Ae(x.sessions,A)}}),t().markTaskRead(i),S=!0,t().replaceEventSubscription(g),g=null;for(const x of C)t().handleEvent(x)}catch(h){if(g&&u(g),!c(d)||p!==t().getViewSelectionVersion())return;e({error:h.message,errorContext:{kind:"navigation",sessionRef:i},isLoading:!1})}},resyncSessionMessages:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const d=ce(i),p=l.get(d);if(p)return p;const g=s,f=Promise.resolve().then(async()=>{try{const h=await D.getMessages(i);if(!c(g)||!V(t().currentSessionRef,i))return;const C=Bt(h);e(S=>{var T;return{messages:gc(C,S.messages,(T=as(S.sessions,i))==null?void 0:T.pendingInteraction),sessions:S.sessions.map(j=>V(ee(j),i)?{...j,messageCount:C.length}:j)}})}catch(h){console.warn("Failed to resync terminal session messages",h)}finally{l.get(d)===f&&l.delete(d)}});return l.set(d,f),f},archiveSession:async i=>{var d;if(W(t().historySurfaceSelection)){e({error:re});return}try{const p=await D.archiveSession(i),g=new Set(p.archivedSessionIds),f=t(),h=((d=f.currentSessionRef)==null?void 0:d.projectPath)===i.projectPath&&g.has(f.currentSessionRef.sessionId);h&&(v(),f.unsubscribeFromEvents());let C=f.unreadTaskKeys,S=Ye(f.taskTerminalReadLedger);if(e(T=>{const j=new Set(p.archivedSessionIds.map(F=>ce({sessionId:F,projectPath:i.projectPath}))),A=T.sessions.filter(F=>F.projectPath!==i.projectPath||!g.has(F.sessionId));C=T.unreadTaskKeys.filter(F=>!j.has(F)),S={version:1,entries:Ye(T.taskTerminalReadLedger).entries.filter(F=>!j.has(F.key))};const w=(T.catalogOverlayRevision??0)+1,E={...T.sessionCatalogOverlays};for(const F of j)E[F]={revision:w,kind:"remove"};return{sessions:A,surfaceCatalog:T.surfaceCatalog.filter(F=>F.locator.workspace.kind!=="local"||F.locator.workspace.projectPath!==i.projectPath||!g.has(F.locator.sessionId)),archivedSessions:Ae(T.archivedSessions,p.session),unreadTaskKeys:C,taskTerminalReadLedger:S,catalogOverlayRevision:w,sessionCatalogOverlays:E,currentSessionId:h?null:T.currentSessionId,currentSessionRef:h?null:T.currentSessionRef,messages:h?[]:T.messages,goal:h?null:T.goal,...h?Je():{},...h?Vt():{}}}),it(S),ct(C),W(t().historySurfaceSelection))return;await t().loadArchivedSessions()}catch(p){e({error:p.message,errorContext:{kind:"task_action",sessionRef:i}})}},unarchiveSession:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}try{const d=await D.unarchiveSession(i),p=new Set(d.restoredSessionIds);if(e(g=>{const f=(g.catalogOverlayRevision??0)+1,h=ce(ee(d.session));return{archivedSessions:g.archivedSessions.filter(C=>C.projectPath!==i.projectPath||!p.has(C.sessionId)),sessions:Ae(g.sessions,d.session),catalogOverlayRevision:f,sessionCatalogOverlays:{...g.sessionCatalogOverlays,[h]:{revision:f,kind:"upsert",session:d.session}}}}),W(t().historySurfaceSelection))return;await Promise.all([t().loadSessions(),t().loadArchivedSessions(),t().loadSurfaceCatalog()])}catch(d){e({error:d.message,errorContext:{kind:"task_action",sessionRef:i}})}},deleteSession:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const d=t(),p=V(d.currentSessionRef,i),g=V(d.forkingSessionRef,i),f=p||g?v():null,h=p?f:null;g&&e({forkingSessionRef:null});try{await D.deleteSession(i);const C=t(),S=V(C.currentSessionRef,i)&&(h===null||c(h));S&&(v(),C.unsubscribeFromEvents());const T=ce(i);let j=C.unreadTaskKeys,A=Ye(C.taskTerminalReadLedger);e(w=>{const E=(w.catalogOverlayRevision??0)+1;return j=w.unreadTaskKeys.filter(F=>F!==T),A={version:1,entries:Ye(w.taskTerminalReadLedger).entries.filter(F=>F.key!==T)},{sessions:Wn(w.sessions,i),surfaceCatalog:w.surfaceCatalog.filter(F=>F.locator.workspace.kind!=="local"||F.locator.workspace.projectPath!==i.projectPath||F.locator.sessionId!==i.sessionId),unreadTaskKeys:j,taskTerminalReadLedger:A,catalogOverlayRevision:E,sessionCatalogOverlays:{...w.sessionCatalogOverlays,[T]:{revision:E,kind:"remove"}},currentSessionId:S?null:w.currentSessionId,currentSessionRef:S?null:w.currentSessionRef,messages:S?[]:w.messages,goal:S?null:w.goal,...S?Je():{},...S?Vt():{}}}),it(A),ct(j)}catch(C){if(h!==null&&(!c(h)||!V(t().currentSessionRef,i)))return;e({error:C.message})}},updateSession:async(i,d)=>{if(W(t().historySurfaceSelection)){e({error:re});return}try{await D.updateSession(i,d),e(p=>({sessions:p.sessions.map(g=>g.sessionId===i.sessionId&&g.projectPath===i.projectPath?{...g,title:d}:g)}))}catch(p){e({error:p.message})}},forkSession:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const d=v(),p=t().claimViewSelection();t().closeHistorySurface();const g=ee(i);e({forkingSessionRef:g,isLoading:!1,error:null});let f=null;try{const h=await D.forkSession(i),C=ee(h.session),S=Bt(h.messages);if(e(T=>({sessions:Ae(T.sessions,h.session)})),t().loadSurfaceCatalog(),!c(d)||p!==t().getViewSelectionVersion())return;if(f=await t().prepareEventSubscription(C),!c(d)||p!==t().getViewSelectionVersion()){u(f),f=null;return}e({currentSessionId:C.sessionId,currentSessionRef:C,isTemporarySession:!1,messages:S,goal:null,...Je(),tokenUsage:{...Et},error:null,forkingSessionRef:null}),t().replaceEventSubscription(f),f=null}catch(h){if(f&&u(f),!c(d)||p!==t().getViewSelectionVersion())return;e({error:h.message,forkingSessionRef:null})}},rewindSession:async(i,d)=>{if(W(t().historySurfaceSelection))return e({error:re}),!1;const{currentSessionRef:p,isTemporarySession:g,isStreaming:f}=t();if(!p||g)return e({error:"No persisted session is available for rewind"}),!1;if(f)return e({error:"Stop the active run before rewinding"}),!1;const h=s;try{const C=await D.rewindSession(p,i,d);if(!c(h)||!V(t().currentSessionRef,p))return!1;const S=Bt(C.messages);return e(T=>({messages:S,tokenUsage:{...Et},error:null,currentRunId:null,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1,sessions:T.sessions.map(j=>j.sessionId===p.sessionId&&j.projectPath===p.projectPath?{...j,messageCount:S.length}:j)})),!0}catch(C){return!c(h)||!V(t().currentSessionRef,p)||e({error:C.message}),!1}},sendMessage:async i=>{var B,U,_,Q,Z,ne;if(W(t().historySurfaceSelection))return e({error:re}),!1;const{currentSessionId:d,currentSessionRef:p,isTemporarySession:g,isStreaming:f,addSession:h,addMessage:C}=t(),S=s,T=p,j={isStreaming:f,agentPhase:t().agentPhase,currentRunId:t().currentRunId};let A=p,w=d,E=T,F=null,x=null;const N=()=>c(S)&&V(t().currentSessionRef,E)&&!W(t().historySurfaceSelection),P=po(i.content);if(P){if((((B=i.attachments)==null?void 0:B.length)??0)>0)return e({error:"Side conversations do not accept image attachments"}),!1;if(!P.question)return e({error:"Usage: /btw <question>"}),!1;if(g||!A||!w)return e({error:"Start or select a Session before using /btw"}),!1;k==null||k.abort("side-conversation-replaced");const K=new AbortController;k=K;const $=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;e({sideConversation:{requestId:$,sessionRef:A,question:P.question,status:"loading"},error:null,errorContext:null});try{const R=await D.askSideQuestion(A,P.question,K.signal);return K.signal.aborted||!N()||((U=t().sideConversation)==null?void 0:U.requestId)!==$?!1:(e({sideConversation:{requestId:$,sessionRef:A,question:P.question,status:"completed",response:R.response,durationMs:R.durationMs,modelId:R.modelId}}),R.usage&&t().updateTokenUsage({inputTokens:R.usage.promptTokens,outputTokens:R.usage.completionTokens,totalTokens:R.usage.totalTokens,cacheReadTokens:R.usage.cacheReadInputTokens??0,cacheWriteTokens:R.usage.cacheCreationInputTokens??0,costUsd:R.usage.costUsd}),!0)}catch(R){return K.signal.aborted||!N()||e({sideConversation:{requestId:$,sessionRef:A,question:P.question,status:"error",error:R instanceof Error?R.message:String(R)}}),!1}finally{k===K&&(k=null)}}if(k==null||k.abort("main-conversation-submitted"),k=null,e({sideConversation:null,pendingResume:null}),g||!w||w===Ls)try{const K=Ji(i.content),$=await D.createSession(t().selectedProjectPath??((_=t().taskWorkspaceInfo)==null?void 0:_.cwd)??void 0,K||void 0);if(h($),!N())return!1;A=ee($),w=$.sessionId,e({currentSessionId:$.sessionId,currentSessionRef:A,isTemporarySession:!1}),E=A}catch(K){return N()&&e({error:K.message}),!1}if(!A||!w||w===Ls)return N()&&e({error:"Failed to create session"}),!1;try{if(!f){if(F=await t().prepareEventSubscription(A),!N())return u(F),F=null,!1;t().replaceEventSubscription(F),F=null}if(!N())return!1;const K=i.content.trim();if(K.startsWith("!")){if((((Q=i.attachments)==null?void 0:Q.length)??0)>0)throw new Error("User shell commands do not accept image attachments");const Y=K.slice(1).trim();if(!Y)throw new Error("User shell command cannot be empty");f||e({isStreaming:!0,agentPhase:"running",error:null,errorContext:null});const ue=await D.executeUserShellCommand(A,Y);return N()?(ue.auxiliary||e({isStreaming:!1,agentPhase:"idle",pendingResume:null}),ue.delivery&&e({pendingSteeringCount:ue.queued??0,pendingInputDelivery:ue.delivery==="current_turn"?"current_turn":"next_turn"}),!0):!1}if((((Z=i.attachments)==null?void 0:Z.length)??0)===0&&(K==="/goal"||K.startsWith("/goal "))){x=`goal-command-${Date.now()}`,C({id:x,role:"user",content:K,timestamp:Date.now()});const Y=K.slice(5).trim().split(/\s+/).filter(Boolean),ue=(ne=Y[0])==null?void 0:ne.toLowerCase();if(!ue||ue==="status"){const I=await D.getGoal(A);return N()&&e({goal:I}),N()}if(ue==="clear")return await D.clearGoal(A),N()&&e({goal:null}),N();let he;if(ue==="pause")he=await D.updateGoal(A,{action:"pause"});else if(ue==="resume")he=await D.updateGoal(A,{action:"resume"});else if(ue==="edit"){const I=Y.slice(1).join(" ").trim();if(!I)throw new Error("Usage: /goal edit <objective>");he=await D.updateGoal(A,{action:"edit",objective:I})}else{const I=Y.lastIndexOf("--budget");let q;if(I>=0){const fe=Y[I+1];if(!fe||!/^[1-9]\d*$/.test(fe))throw new Error("--budget requires a positive integer");q=Number(fe),Y.splice(I,2)}const ie=Y.join(" ").trim();if(!ie)throw new Error("Usage: /goal <objective>");const{currentMode:Ce}=Te.getState();he=await D.createGoal(A,ie,q,Ce)}return N()?(e({goal:he.goal,...he.runId?{currentRunId:he.runId,isStreaming:!0,agentPhase:"running"}:{}}),!0):!1}f||(x=`temp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,C({id:x,role:"user",content:mc(i),timestamp:Date.now()})),e({isStreaming:!0,error:null,errorContext:null,recoveredSteeringCount:f?t().recoveredSteeringCount:0});const{currentMode:$,currentModelId:R}=Te.getState(),{modelId:le,...ge}=i,ve=le??R??void 0,xe=i.reasoningEffort,Re=i.serviceTier,Se=i.responseVerbosity,Le=i.communicationStyle,de=ve&&!f?{...ge,modelId:ve}:ge,J=await D.sendMessage(A,de,$);return N()?(e(Y=>({currentRunId:J.runId,pendingSteeringCount:J.followUpQueue?J.followUpQueue.pending:J.status==="steering_queued"||J.status==="follow_up_queued"?Math.max(0,J.queued??1):Y.pendingSteeringCount,pendingInputDelivery:J.status==="steering_queued"?"current_turn":J.status==="follow_up_queued"?"next_turn":Y.pendingInputDelivery,...J.followUpQueue?{followUpQueue:J.followUpQueue}:{},...J.followUpQueue?{followUpQueueMutation:{pending:!1,supersededVersions:Y.followUpQueue?[...Y.followUpQueueMutation.supersededVersions,Y.followUpQueue.version].slice(-16):Y.followUpQueueMutation.supersededVersions}}:{},sessions:(ve||xe||Re||Se||Le)&&!f?Y.sessions.map(ue=>ue.sessionId===A.sessionId&&ue.projectPath===A.projectPath?{...ue,...ve?{selectedModelId:ve}:{},...xe?{reasoningEffort:xe}:{},...Re?{serviceTier:Re}:{},...Se?{responseVerbosity:Se}:{},...Le?{communicationStyle:Le}:{}}:ue):Y.sessions})),!0):!1}catch(K){if(F&&u(F),!N())return!1;if(x&&!t().messages.some(R=>R.id===x)&&!Gs(K))return!0;const $=Gs(K)&&K.code==="SESSION_WORKSPACE_UNAVAILABLE"?"workspace_unavailable":void 0;return e(R=>({error:K.message,errorContext:{kind:"submission",sessionRef:A,...$?{failureCode:$}:{}},messages:x?R.messages.filter(le=>le.id!==x):R.messages,...j})),!1}},refreshFollowUpQueue:async()=>{var g,f;const i=t().currentSessionRef;if(!i||W(t().historySurfaceSelection))return;const d=s,p=(g=t().followUpQueue)==null?void 0:g.version;try{const h=await D.getFollowUpQueue(i),C=t();c(d)&&V(C.currentSessionRef,i)&&((f=C.followUpQueue)==null?void 0:f.version)===p&&e(S=>({followUpQueue:h,followUpQueueMutation:{pending:S.followUpQueueMutation.pending,supersededVersions:S.followUpQueue?[...S.followUpQueueMutation.supersededVersions,S.followUpQueue.version].slice(-16):S.followUpQueueMutation.supersededVersions}}))}catch(h){c(d)&&V(t().currentSessionRef,i)&&e(C=>({followUpQueueMutation:{pending:C.followUpQueueMutation.pending,errorMessage:h instanceof Error?h.message:String(h),supersededVersions:C.followUpQueueMutation.supersededVersions}}))}},mutateFollowUpQueue:async i=>{const d=t(),p=d.currentSessionRef,g=d.followUpQueue;if(!p||!g||d.followUpQueueMutation.pending||W(d.historySurfaceSelection))return!1;const f=s;e({followUpQueueMutation:{pending:!0,messageId:i.messageId,supersededVersions:d.followUpQueueMutation.supersededVersions}});try{const h=await D.mutateFollowUpQueue(p,{expectedVersion:g.version,operation:i});return!c(f)||!V(t().currentSessionRef,p)?!1:(e(C=>{var j;const S=(j=C.followUpQueue)==null?void 0:j.version,T=S===g.version||S===h.version;return{...T?{followUpQueue:h}:{},followUpQueueMutation:{pending:!1,supersededVersions:[...C.followUpQueueMutation.supersededVersions,g.version,...T?[]:[h.version]].slice(-16)}}}),!0)}catch(h){return!c(f)||!V(t().currentSessionRef,p)?!1:Pi(h)?(e(C=>{var j;const S=(j=C.followUpQueue)==null?void 0:j.version,T=S===g.version||S===h.snapshot.version;return{...T?{followUpQueue:h.snapshot}:{},followUpQueueMutation:{pending:!1,errorCode:h.code,errorMessage:h.message,supersededVersions:[...C.followUpQueueMutation.supersededVersions,g.version,...T?[]:[h.snapshot.version]].slice(-16)}}}),!1):(e({followUpQueueMutation:{pending:!1,errorMessage:h instanceof Error?h.message:String(h),supersededVersions:d.followUpQueueMutation.supersededVersions}}),!1)}},dismissSideConversation:()=>{k==null||k.abort("side-conversation-dismissed"),k=null,e({sideConversation:null})},loadTeams:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const d=i??t().currentSessionRef;if(!d||!ut.getState().agentTeamsEnabled){e({teams:[]});return}const p=ce(d),g=m.get(p);if(g)return g;let f;f=(async()=>{try{const h=await Zn(d);if(!V(t().currentSessionRef,d))return;e({teams:h})}catch{V(t().currentSessionRef,d)&&e({teams:[]})}finally{m.get(p)===f&&m.delete(p)}})(),m.set(p,f),await f},abortSession:async()=>{if(W(t().historySurfaceSelection))return e({error:re}),!1;const{currentSessionRef:i,isStopping:d}=t();if(!i||d)return!1;e({isStopping:!0,error:null,errorContext:null});try{return await D.abortSession(i),!V(t().currentSessionRef,i)||(await t().resyncSessionMessages(i),!V(t().currentSessionRef,i))?!1:(t().unsubscribeFromEvents(),e({isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1}),!0)}catch(p){return V(t().currentSessionRef,i)&&e({isStopping:!1,error:p instanceof Error?p.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:i}}),!1}},pauseGoal:async()=>{if(W(t().historySurfaceSelection)){e({error:re});return}const{currentSessionRef:i,isTemporarySession:d}=t();if(!i||d){e({error:"No persisted session is available for this goal"});return}try{const p=await D.updateGoal(i,{action:"pause"});if(!V(t().currentSessionRef,i))return;e({goal:p.goal,error:null})}catch(p){if(!V(t().currentSessionRef,i))return;e({error:p.message})}},resumeGoal:async()=>{if(W(t().historySurfaceSelection)){e({error:re});return}const{currentSessionRef:i,isTemporarySession:d}=t();if(!i||d){e({error:"No persisted session is available for this goal"});return}try{const p=await D.updateGoal(i,{action:"resume"});if(!V(t().currentSessionRef,i))return;e({goal:p.goal,error:null,...p.runId?{currentRunId:p.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(p){if(!V(t().currentSessionRef,i))return;e({error:p.message})}},editGoal:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const{currentSessionRef:d,isTemporarySession:p}=t();if(!d||p){e({error:"No persisted session is available for this goal"});return}try{const g=await D.updateGoal(d,{action:"edit",objective:i});if(!V(t().currentSessionRef,d))return;e({goal:g.goal,error:null,...g.runId?{currentRunId:g.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(g){if(!V(t().currentSessionRef,d))return;e({error:g.message})}},clearGoal:async()=>{if(W(t().historySurfaceSelection)){e({error:re});return}const{currentSessionRef:i,isTemporarySession:d}=t();if(!i||d){e({error:"No persisted session is available for this goal"});return}try{if(await D.clearGoal(i),!V(t().currentSessionRef,i))return;e({goal:null,error:null})}catch(p){if(!V(t().currentSessionRef,i))return;e({error:p.message})}}}},yc=(e,t)=>{const s=new WeakMap;let n=null;return{isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,sessionEventConnectionState:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},eventUnsubscribe:null,currentAssistantMessageId:null,hasToolCalls:!1,setStreaming:r=>e({isStreaming:r}),setAgentPhase:r=>e({agentPhase:r}),setRunId:r=>e({currentRunId:r}),prepareEventSubscription:async(r,o)=>{if(W(t().historySurfaceSelection))throw e({error:re}),new Error(re);const l=o??In(t,e);let m=null,k="connecting";if(m=await D.openEventSubscription(r,l,{onConnectionStateChange:v=>{k=v,m&&n===m&&e({sessionEventConnectionState:v})}}),W(t().historySurfaceSelection))throw m(),e({error:re}),new Error(re);return s.set(m,k),m},replaceEventSubscription:r=>{const o=t().eventUnsubscribe;if(n=r,e({eventUnsubscribe:r,sessionEventConnectionState:r?s.get(r)??"connected":"idle"}),As.reset(),o&&o!==r)try{o()}catch(l){console.warn("Failed to clean up previous event subscription",l)}},setCurrentAssistantMessageId:r=>e({currentAssistantMessageId:r}),setHasToolCalls:r=>e({hasToolCalls:r}),startAgentResponse:r=>{e({currentAssistantMessageId:r,hasToolCalls:!1,isStreaming:!0,agentPhase:"running",providerAdmission:null,providerCircuit:null,providerRetry:null,providerStall:null,providerRecovery:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null})},endAgentResponse:()=>{As.drainAll(),e({currentAssistantMessageId:null,hasToolCalls:!1,isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},subscribeToEvents:async r=>{if(W(t().historySurfaceSelection))throw e({error:re}),new Error(re);const o=await t().prepareEventSubscription(r);if(W(t().historySurfaceSelection))throw o(),e({error:re}),new Error(re);t().replaceEventSubscription(o)},reconnectSessionEvents:async()=>{if(W(t().historySurfaceSelection)){e({error:re});return}const r=t().currentSessionRef;if(r){t().unsubscribeFromEvents(),e({sessionEventConnectionState:"connecting"});try{await t().subscribeToEvents(r)}catch(o){throw e({sessionEventConnectionState:"offline"}),o}}},unsubscribeFromEvents:()=>{const{eventUnsubscribe:r}=t();n=null,e({eventUnsubscribe:null,sessionEventConnectionState:"idle"});try{r==null||r()}catch(o){console.warn("Failed to clean up event subscription",o)}finally{As.reset()}},handleEvent:r=>{In(t,e)(r)}}};function vc(e){var t;return((t=e.taskPromptSummary)==null?void 0:t.trimStart().startsWith("/review"))===!0}function za(e,t){var n;const s=(n=e.taskStatusReason)==null?void 0:n.trim();if(vc(e)){if(e.taskStatus==="running")return t("taskHome.review.running");if(s!=null&&s.startsWith("Code review stale:"))return t("taskHome.review.stale");if(s==="Code review aborted")return t("taskHome.review.aborted");if(s==="Code review interrupted by process restart")return t("taskHome.review.interrupted");if(e.taskStatus==="failed")return t("taskHome.review.failed")}return e.taskFailure?t(wa(e.taskFailure.code)):s==="user-cancel"?t("session.reason.cancelledByUser"):s||void 0}let Ds=0;function Qt(e,t){const s=e.findIndex(r=>r.id===t.id);if(s===-1)return[...e,t];const n=e.slice();return n[s]=t,n}const bc=ps(e=>({schedules:[],isLoading:!1,hasLoaded:!1,error:null,loadSchedules:async()=>{const t=++Ds;e({isLoading:!0,error:null});try{const s=await D.listSchedules();if(t!==Ds)return;e({schedules:s,isLoading:!1,hasLoaded:!0})}catch(s){if(t!==Ds)return;e({error:s instanceof Error?s.message:pe("schedule.error.loadFailed"),isLoading:!1,hasLoaded:!0})}},createSchedule:async t=>{e({error:null});try{const s=await D.createSchedule(t);return e(n=>({schedules:Qt(n.schedules,s)})),s}catch(s){throw e({error:s instanceof Error?s.message:pe("schedule.error.createFailed")}),s}},updateSchedule:async(t,s)=>{e({error:null});try{const n=await D.updateSchedule(t,s);return e(r=>({schedules:Qt(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:pe("schedule.error.updateFailed")}),n}},deleteSchedule:async t=>{e({error:null});try{await D.deleteSchedule(t),e(s=>({schedules:s.schedules.filter(n=>n.id!==t)}))}catch(s){throw e({error:s instanceof Error?s.message:pe("schedule.error.deleteFailed")}),s}},toggleSchedule:async(t,s)=>{e({error:null});try{const n=s?await D.enableSchedule(t):await D.disableSchedule(t);return e(r=>({schedules:Qt(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:pe("schedule.error.toggleFailed")}),n}},runSchedule:async t=>{e({error:null});try{const s=await D.runSchedule(t);return e(n=>({schedules:Qt(n.schedules,s)})),s}catch(s){throw e({error:s instanceof Error?s.message:pe("schedule.error.runFailed")}),s}}})),_a="blade.projects.selected";function ea(){return typeof localStorage>"u"?null:localStorage.getItem(_a)}function Wt(e){typeof localStorage<"u"&&localStorage.setItem(_a,e)}const wc=new Set(["queued","running","completed","failed","cancelled","interrupted"]),Us=new Set(["default","autoEdit","yolo","plan"]),ta=new Set(["auto","off","minimal","low","medium","high","xhigh","max"]),sa=new Set(["auto","standard","fast","flex"]),na=new Set(["auto","low","medium","high"]),aa=new Set(["auto","pragmatic","friendly","explanatory"]),ra=new Set(["high","medium","low"]),oa=new Set(["feature","bug","maintenance","research"]);function xc(e){return typeof e=="string"&&wc.has(e)}function Sc(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!["changedFiles","additions","deletions","commits"].some(n=>typeof t[n]!="number"||!Number.isInteger(t[n])||t[n]<0))return{changedFiles:t.changedFiles,additions:t.additions,deletions:t.deletions,commits:t.commits}}function Cc(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,s=sn(t.code);if(!(!s||typeof t.message!="string"||typeof t.retryable!="boolean"))return{code:s,message:pe(wa(s)),retryable:ho(s)}}function jc(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!(!["applied","discarded","conflicted"].includes(String(t.status))||typeof t.updatedAt!="string"))return{status:t.status,updatedAt:t.updatedAt,...typeof t.sourceCommit=="string"?{sourceCommit:t.sourceCommit}:{},...typeof t.changedFiles=="number"&&Number.isInteger(t.changedFiles)&&t.changedFiles>=0?{changedFiles:t.changedFiles}:{},...typeof t.message=="string"?{message:t.message}:{}}}function Pt(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:void 0}function Tc(e,t){return{...e,taskStatus:t.taskStatus,taskStatusReason:t.taskStatusReason,taskFailure:t.taskStatus==="failed"?t.taskFailure??e.taskFailure:void 0,taskPromptSummary:t.taskPromptSummary??e.taskPromptSummary,taskStartedAt:t.taskStartedAt??(t.taskStatus==="queued"?void 0:e.taskStartedAt),taskCompletedAt:t.taskCompletedAt??(t.taskStatus==="queued"||t.taskStatus==="running"?void 0:e.taskCompletedAt),taskDiffStat:t.taskDiffStat??e.taskDiffStat,taskQueuePosition:t.taskStatus==="queued"?t.taskQueuePosition??e.taskQueuePosition:void 0,taskQueueDepth:t.taskStatus==="queued"?t.taskQueueDepth??e.taskQueueDepth:void 0,taskConcurrencyLimit:t.taskConcurrencyLimit??e.taskConcurrencyLimit,lastMessageTime:t.updatedAt??e.lastMessageTime}}function qs(e,t,s,n){return{...e,[t]:{revision:s,kind:"upsert",session:n}}}function nt(e){return e??{version:1,entries:[]}}const Pc=(e,t)=>{let s=null,n=!1,r=!1,o=0;const l=new Map,m=c=>{const u=ce(c),i=++o,d=t().catalogOverlayRevision??0;l.set(u,i),D.getSession(c).then(p=>{l.get(u)===i&&e(g=>{var C;const f=(C=g.sessionCatalogOverlays)==null?void 0:C[u];if(f&&f.revision>d)return{};const h=(g.catalogOverlayRevision??0)+1;return{sessions:Ae(g.sessions,p),catalogOverlayRevision:h,sessionCatalogOverlays:qs(g.sessionCatalogOverlays??{},u,h,p)}})}).catch(()=>{l.get(u)===i&&t().loadSessions()}).finally(()=>{l.get(u)===i&&l.delete(u)})},k=c=>{const u=ce(c);e(i=>{const d=(i.catalogOverlayRevision??0)+1;return{catalogOverlayRevision:d,sessionCatalogOverlays:{...i.sessionCatalogOverlays,[u]:{revision:d,kind:"remove"}}}})},v=c=>{const u=ce(c),i=++o;l.set(u,i),queueMicrotask(()=>{l.get(u)===i&&l.delete(u)})};return{taskEventsConnected:!1,taskEventConnectionState:"connecting",taskEventUnsubscribe:null,taskWorkspaceInfo:null,isTaskWorkspaceLoading:!1,taskWorkspaceError:null,boundProjects:[],selectedProjectPath:ea(),isDispatchingTask:!1,isUpdatingTaskAdmission:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],updatingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:pc(),taskTerminalReadLedger:lc(),catalogOverlayRevision:0,sessionCatalogOverlays:{},handleTaskEvent:c=>{if(c.type==="session.created"){const x=c.properties.sessionId,N=c.properties.projectPath;if(typeof x!="string"||typeof N!="string")return;m({sessionId:x,projectPath:N}),t().loadSurfaceCatalog();return}if(c.type==="session.deleted"){const x=c.properties.sessionId,N=c.properties.projectPath;if(typeof x!="string"||typeof N!="string")return;const P={sessionId:x,projectPath:N};v(P),t().removeSession(P),k(P);return}if(c.type==="session.archived"){const x=c.properties.sessionId,N=c.properties.projectPath;if(typeof x!="string"||typeof N!="string")return;const P={sessionId:x,projectPath:N};v(P),t().removeSession(P),k(P),t().loadArchivedSessions();return}if(c.type==="session.unarchived"){const x=c.properties.sessionId,N=c.properties.projectPath;if(typeof x!="string"||typeof N!="string")return;m({sessionId:x,projectPath:N}),t().loadSurfaceCatalog(),t().loadArchivedSessions();return}if(c.type==="session.updated"){const x=c.properties.sessionId,N=c.properties.projectPath,P=c.properties.title,B=c.properties.selectedModelId,U=c.properties.permissionMode,_=c.properties.reasoningEffort,Q=c.properties.serviceTier,Z=c.properties.responseVerbosity,ne=c.properties.communicationStyle,K=c.properties.taskPriority,$=c.properties.taskKind,R=c.properties.taskDueAt;if(typeof x!="string"||typeof N!="string"||!(typeof P=="string"&&P.trim()||typeof B=="string"&&B.trim()||Us.has(U)||ta.has(_)||sa.has(Q)||na.has(Z)||aa.has(ne)||ra.has(K)||oa.has($)||R===null||typeof R=="string"&&Number.isFinite(Date.parse(R))))return;const le={sessionId:x,projectPath:N};if(V(t().currentSessionRef,le)&&Us.has(U)&&Te.getState().setMode(U),!t().sessions.some(ve=>V(ee(ve),le))){m(le);return}e(ve=>{const xe=ve.sessions.find(Le=>V(ee(Le),le));if(!xe)return{};const Re={...xe,...typeof P=="string"&&P.trim()?{title:P}:{},...typeof B=="string"&&B.trim()?{selectedModelId:B}:{},...Us.has(U)?{permissionMode:U}:{},...ta.has(_)?{reasoningEffort:_}:{},...sa.has(Q)?{serviceTier:Q}:{},...na.has(Z)?{responseVerbosity:Z}:{},...aa.has(ne)?{communicationStyle:ne}:{},...ra.has(K)?{taskPriority:K}:{},...oa.has($)?{taskKind:$}:{},...R===null?{taskDueAt:void 0}:typeof R=="string"&&Number.isFinite(Date.parse(R))?{taskDueAt:R}:{}},Se=(ve.catalogOverlayRevision??0)+1;return{sessions:Ae(ve.sessions,Re),catalogOverlayRevision:Se,sessionCatalogOverlays:qs(ve.sessionCatalogOverlays??{},ce(le),Se,Re)}});return}if(c.type==="task.delivery"){const x=c.properties.sessionId,N=c.properties.projectPath,P=jc(c.properties.taskDelivery);if(typeof x!="string"||typeof N!="string"||!P)return;const B={sessionId:x,projectPath:N},U=c.properties.taskWorktreeRemoved===!0;e(_=>({sessions:_.sessions.map(Q=>V(ee(Q),B)?{...Q,taskDelivery:P,...U?{taskWorktreePath:void 0,taskWorktreeBranch:void 0}:{},lastMessageTime:typeof c.properties.updatedAt=="string"?c.properties.updatedAt:Q.lastMessageTime}:Q)}));return}if(c.type==="interaction.pending"){const x=c.properties.sessionId,N=c.properties.projectPath,P=c.properties.interactionType,B=c.properties.requestId;if(typeof x!="string"||typeof N!="string"||P!=="permission"&&P!=="question"&&P!=="elicitation"||typeof B!="string"||!B)return;const U={sessionId:x,projectPath:N},_=t().sessions.find(Z=>V(ee(Z),U));if(!_){t().loadSessions();return}if(e(Z=>({sessions:Z.sessions.map(ne=>V(ee(ne),U)?{...ne,pendingInteraction:{type:P,requestId:B}}:ne)})),!(typeof document<"u"&&document.visibilityState==="visible"&&V(t().currentSessionRef,U))&&ut.getState().notifyErrors){const ne=_.title??_.sessionId??x;Jn({ref:U,title:`Blade · ${pe(P==="question"?"attention.notification.question":P==="elicitation"?"attention.notification.elicitation":"attention.notification.permission")}`,body:ne,onOpen:K=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(rs,{detail:K})))}})}return}if(c.type==="interaction.resolved"){const x=c.properties.sessionId,N=c.properties.projectPath,P=c.properties.requestId;if(typeof x!="string"||typeof N!="string"||typeof P!="string")return;const B={sessionId:x,projectPath:N};e(U=>({sessions:U.sessions.map(_=>{var Q;return V(ee(_),B)&&((Q=_.pendingInteraction)==null?void 0:Q.requestId)===P?{..._,pendingInteraction:void 0}:_})}));return}if(c.type==="schedule.fired"){bc.getState().loadSchedules();return}if(c.type!=="task.status")return;const u=c.properties.sessionId,i=c.properties.projectPath,d=c.properties.taskStatus;if(typeof u!="string"||typeof i!="string"||!xc(d))return;const p={sessionId:u,projectPath:i},g=Pt(c.properties.taskInFlight,0),f=Pt(c.properties.taskQueueDepth,0),h=Pt(c.properties.taskConcurrencyLimit,1),C=typeof c.properties.taskAdmissionPaused=="boolean"?c.properties.taskAdmissionPaused:void 0;g!==void 0&&f!==void 0&&h!==void 0&&e(x=>{var N,P;return{taskWorkspaceInfo:x.taskWorkspaceInfo?{...x.taskWorkspaceInfo,taskAdmission:{inFlight:g,queued:f,maxConcurrent:h,maxQueued:((N=x.taskWorkspaceInfo.taskAdmission)==null?void 0:N.maxQueued)??100,paused:C??((P=x.taskWorkspaceInfo.taskAdmission)==null?void 0:P.paused)??!1}}:null}});const S=ce(p),T=Cc(c.properties.taskFailure);let j=!1,A=null,w=null,E=!1;e(x=>{const N=x.sessions.find(le=>V(ee(le),p));if(!N)return E=!0,w=gt(nt(x.taskTerminalReadLedger),p,{taskStatus:d,taskCompletedAt:typeof c.properties.taskCompletedAt=="string"?c.properties.taskCompletedAt:void 0,taskFailure:T}),{taskTerminalReadLedger:w};const P=(x.catalogOverlayRevision??0)+1,B={taskStatus:d,taskStatusReason:typeof c.properties.taskStatusReason=="string"?c.properties.taskStatusReason:void 0,taskFailure:T,taskPromptSummary:typeof c.properties.taskPromptSummary=="string"?c.properties.taskPromptSummary:void 0,taskStartedAt:typeof c.properties.taskStartedAt=="string"?c.properties.taskStartedAt:void 0,taskCompletedAt:typeof c.properties.taskCompletedAt=="string"?c.properties.taskCompletedAt:void 0,taskDiffStat:Sc(c.properties.taskDiffStat),taskQueuePosition:Pt(c.properties.taskQueuePosition,1),taskQueueDepth:Pt(c.properties.taskQueueDepth,0),taskConcurrencyLimit:h,updatedAt:typeof c.properties.updatedAt=="string"?c.properties.updatedAt:void 0},U=Tc(N,B),_=typeof document<"u"&&document.visibilityState==="visible"&&V(x.currentSessionRef,p),Q=os(N),Z=os(U),ne=nt(x.taskTerminalReadLedger),K=ne.entries.find(le=>le.key===S);let $=ne,R=x.unreadTaskKeys;return _||Z===null?($=gt($,p,U),_&&(R=R.filter(le=>le!==S))):K?K.signature!==Z&&(R.includes(S)||(R=[...R,S],Q!==Z&&(j=!0))):Q===null?($=gt($,p,N),R.includes(S)||(R=[...R,S],j=!0)):$=gt($,p,U),w=$,A=R,{sessions:Ae(x.sessions,U),unreadTaskKeys:R,taskTerminalReadLedger:$,catalogOverlayRevision:P,sessionCatalogOverlays:qs(x.sessionCatalogOverlays??{},S,P,U)}}),w&&it(w),A&&ct(A);const F=j?t().sessions.find(x=>V(ee(x),p)):void 0;if(F&&dn(d)){const x=ut.getState();if(x.notifySounds&&hc(d),d==="completed"?x.notifyBuild:x.notifyErrors){const P=pe(d==="completed"?"attention.notification.completed":d==="failed"?"attention.notification.failed":"attention.notification.interrupted"),B=za(F,pe),U=F.title??u;Jn({ref:p,title:`Blade · ${P}`,body:B?`${U} · ${B}`:U,onOpen:_=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(rs,{detail:_})))}})}}E&&(m(p),t().loadSurfaceCatalog())},subscribeToTaskEvents:async()=>{if(n=!0,!t().taskEventUnsubscribe){if(s)return s;e({taskEventsConnected:!1,taskEventConnectionState:"connecting"}),s=(async()=>{try{const c=await D.openTaskEventSubscription(u=>t().handleTaskEvent(u),{onConnectionChange:u=>{e({taskEventsConnected:u})},onConnectionStateChange:u=>{n&&(u==="reconnecting"||u==="offline")&&(r=!0),e({taskEventsConnected:u==="connected",taskEventConnectionState:u}),u==="connected"&&r&&(r=!1,Promise.all([t().loadSessions(),t().loadSurfaceCatalog(),t().loadTaskWorkspaceInfo(),t().loadBoundProjects(),Te.getState().loadModels()]))}});if(!n||t().taskEventUnsubscribe){c();return}e({taskEventUnsubscribe:c})}catch(c){throw r=!0,e({taskEventsConnected:!1,taskEventConnectionState:"offline"}),c}})();try{await s}finally{s=null}}},reconnectTaskEvents:async()=>{r=!0,t().unsubscribeFromTaskEvents(),await t().subscribeToTaskEvents()},unsubscribeFromTaskEvents:()=>{var c,u;n=!1,(u=(c=t()).taskEventUnsubscribe)==null||u.call(c),e({taskEventUnsubscribe:null,taskEventsConnected:!1,taskEventConnectionState:"offline"})},loadTaskWorkspaceInfo:async()=>{e({isTaskWorkspaceLoading:!0,taskWorkspaceError:null});try{const c=await D.getWorkspaceInfo();e({taskWorkspaceInfo:c,isTaskWorkspaceLoading:!1})}catch(c){e({isTaskWorkspaceLoading:!1,taskWorkspaceError:c instanceof Error?c.message:"Failed to load task workspace"})}},loadBoundProjects:async()=>{try{const c=await D.listProjects(),u=ea(),i=c.find(d=>d.available&&d.path===u)??c.find(d=>d.isCurrent)??c.find(d=>d.available);i&&Wt(i.path),e({boundProjects:c,selectedProjectPath:(i==null?void 0:i.path)??null})}catch(c){e({error:c instanceof Error?c.message:"Failed to load projects"})}},bindProject:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}e({isBindingProject:!0,error:null});try{const u=await D.bindProject(c);Wt(u.path),e(i=>({boundProjects:[...i.boundProjects.filter(d=>d.path!==u.path),u].sort((d,p)=>d.isCurrent!==p.isCurrent?d.isCurrent?-1:1:d.name.localeCompare(p.name)),selectedProjectPath:u.path,isBindingProject:!1}))}catch(u){throw e({isBindingProject:!1,error:u instanceof Error?u.message:"Failed to bind project"}),u}},unbindProject:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}try{await D.unbindProject(c),e(u=>{const i=u.boundProjects.filter(p=>p.path!==c||p.isCurrent),d=u.selectedProjectPath===c?i.find(p=>p.isCurrent)??i.find(p=>p.available):void 0;return d&&Wt(d.path),{boundProjects:i,...d?{selectedProjectPath:d.path}:{}}})}catch(u){throw e({error:u instanceof Error?u.message:"Failed to unbind project"}),u}},selectProject:c=>{Wt(c),e({selectedProjectPath:c})},markTaskRead:c=>{const u=ce(c);let i=nt(t().taskTerminalReadLedger),d=t().unreadTaskKeys;e(p=>{const g=p.sessions.find(f=>V(ee(f),c));return i=g?gt(nt(p.taskTerminalReadLedger),c,g):nt(p.taskTerminalReadLedger),d=p.unreadTaskKeys.filter(f=>f!==u),{taskTerminalReadLedger:i,unreadTaskKeys:d}}),it(i),ct(d)},clearUnreadTasks:()=>{if(t().catalogLoadState!=="ready")return;let c=nt(t().taskTerminalReadLedger);e(u=>{const i=new Map(u.sessions.map(g=>[ce(ee(g)),g])),d=new Set(u.unreadTaskKeys);let p={version:1,entries:nt(u.taskTerminalReadLedger).entries.filter(g=>!d.has(g.key)||i.has(g.key))};for(const g of u.unreadTaskKeys){const f=i.get(g);f&&(p=gt(p,ee(f),f))}return c=p,{unreadTaskKeys:[],taskTerminalReadLedger:p}}),it(c),ct([])},setTaskAdmissionPaused:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}if(!t().isUpdatingTaskAdmission){e({isUpdatingTaskAdmission:!0,error:null,errorContext:null});try{const u=await D.setTaskAdmissionPaused(c);e(i=>({taskWorkspaceInfo:i.taskWorkspaceInfo?{...i.taskWorkspaceInfo,taskAdmission:u}:i.taskWorkspaceInfo}))}catch(u){throw e({error:u instanceof Error?u.message:"Failed to update task admission",errorContext:{kind:"task_action"}}),u}finally{e({isUpdatingTaskAdmission:!1})}}},updateTask:async(c,u)=>{if(W(t().historySurfaceSelection)){e({error:re});return}const i=ce(c);if(!t().updatingTaskKeys.includes(i)){e(d=>({updatingTaskKeys:[...d.updatingTaskKeys,i],error:null,errorContext:null}));try{const d=await D.updateTask(c,u);e(p=>({sessions:Ae(p.sessions,d)}))}catch(d){throw e({error:d instanceof Error?d.message:"Failed to update task",errorContext:{kind:"task_action",sessionRef:c}}),d}finally{e(d=>({updatingTaskKeys:d.updatingTaskKeys.filter(p=>p!==i)}))}}},cancelTask:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}const u=ce(c);if(!t().cancellingTaskKeys.includes(u)){e(i=>({cancellingTaskKeys:[...i.cancellingTaskKeys,u],error:null,errorContext:null}));try{await D.abortSession(c);const i=V(t().currentSessionRef,c);i&&(await t().resyncSessionMessages(c),V(t().currentSessionRef,c)&&t().unsubscribeFromEvents()),e(d=>({sessions:d.sessions.map(p=>V(ee(p),c)?{...p,taskStatus:"cancelled",taskQueuePosition:void 0,taskQueueDepth:void 0,taskCompletedAt:p.taskCompletedAt??new Date().toISOString()}:p),...i?{isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,eventUnsubscribe:null}:{}}))}catch(i){throw e({error:i instanceof Error?i.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:c}}),i}finally{e(i=>({cancellingTaskKeys:i.cancellingTaskKeys.filter(d=>d!==u)}))}}},retryTask:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}const u=ce(c);if(t().retryingTaskKeys.includes(u))return;const i=t().getNavigationVersion(),d=t().selectedProjectPath,p=()=>t().getNavigationVersion()===i&&t().selectedProjectPath===d&&!W(t().historySurfaceSelection);e(g=>({retryingTaskKeys:[...g.retryingTaskKeys,u],error:null,errorContext:null}));try{const g=await D.retryTask(c);e(f=>({sessions:Ae(f.sessions,g.session)})),t().loadSurfaceCatalog(),t().markTaskRead(c),p()&&await t().selectSession(ee(g.session))}catch(g){throw p()&&e({error:g instanceof Error?g.message:"Failed to retry task",errorContext:{kind:"task_action",sessionRef:c}}),g}finally{e(g=>({retryingTaskKeys:g.retryingTaskKeys.filter(f=>f!==u)}))}},deliverTask:async(c,u)=>{if(W(t().historySurfaceSelection)){e({error:re});return}const i=ce(c);if(!t().taskDeliveryActions[i]){e(d=>({taskDeliveryActions:{...d.taskDeliveryActions,[i]:u},error:null,errorContext:null}));try{const d=await D.deliverTask(c,u);e(p=>({sessions:Ae(p.sessions,d)})),t().markTaskRead(c)}catch(d){throw e({error:d instanceof Error?d.message:"Failed to deliver task changes",errorContext:{kind:"task_action",sessionRef:c}}),d}finally{e(d=>{const{[i]:p,...g}=d.taskDeliveryActions;return{taskDeliveryActions:g}})}}},dispatchTask:async(c,u)=>{if(W(t().historySurfaceSelection)){e({error:re});return}const i=t().getNavigationVersion(),d=t().selectedProjectPath,p=c.projectPath??d??void 0,g=()=>t().getNavigationVersion()===i&&t().selectedProjectPath===d&&!W(t().historySurfaceSelection);e({isDispatchingTask:!0,error:null,errorContext:null});try{const f=await D.createTask({...c,projectPath:p});e(h=>({sessions:Ae(h.sessions,f.session),isDispatchingTask:!1})),t().loadSurfaceCatalog(),(u==null?void 0:u.selectSession)!==!1&&g()&&await t().selectSession(ee(f.session))}catch(f){throw e({isDispatchingTask:!1,...g()?{error:f instanceof Error?f.message:"Failed to dispatch task"}:{}}),f}},startCodeReview:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}const u=t().getNavigationVersion(),i=t().selectedProjectPath,d=c.projectPath??i??void 0,p=()=>t().getNavigationVersion()===u&&t().selectedProjectPath===i&&!W(t().historySurfaceSelection);e({isDispatchingTask:!0,error:null,errorContext:null});let g,f=!1;try{g=await D.createSession(d,"Code Review");const h=ee(g);if(W(t().historySurfaceSelection)){await D.deleteSession(h).catch(()=>{}),e({isDispatchingTask:!1});return}await D.startCodeReview(h,{kind:c.kind,...c.ref?{ref:c.ref}:{},...c.instructions?{instructions:c.instructions}:{},...c.modelId?{modelId:c.modelId}:{}}),f=!0;const C={...g,taskStatus:"running",taskStatusReason:pe("taskHome.review.running"),taskPromptSummary:`/review ${c.kind}${c.ref?` ${c.ref}`:""}`};e(S=>({sessions:Ae(S.sessions,C),isDispatchingTask:!1})),t().loadSurfaceCatalog(),p()&&await t().selectSession(h)}catch(h){throw g&&!f&&await D.deleteSession(ee(g)).catch(()=>{}),e({isDispatchingTask:!1,...p()?{error:h instanceof Error?h.message:pe("taskHome.review.startFailed")}:{}}),h}}}},Ac=e=>({tokenUsage:Et,updateTokenUsage:t=>e(s=>{const{costUsd:n,...r}=t;return{tokenUsage:{...s.tokenUsage,...r,totalInputTokens:s.tokenUsage.totalInputTokens+Math.max(0,t.inputTokens??0),totalOutputTokens:s.tokenUsage.totalOutputTokens+Math.max(0,t.outputTokens??0),cacheReadTokens:s.tokenUsage.cacheReadTokens+Math.max(0,t.cacheReadTokens??0),cacheWriteTokens:s.tokenUsage.cacheWriteTokens+Math.max(0,t.cacheWriteTokens??0),estimatedCostUsd:s.tokenUsage.estimatedCostUsd+Math.max(0,n??0)}}}),resetContextUsage:()=>e(t=>({tokenUsage:{...t.tokenUsage,inputTokens:0,outputTokens:0,totalTokens:0}})),setMaxContextTokens:(t,s=!1)=>e(n=>({tokenUsage:{...n.tokenUsage,maxContextTokens:t,isDefaultMaxTokens:s}}))}),L=ps()((...e)=>({...kc(...e),...Qi(...e),...Pc(...e),...Wi(...e),...yc(...e),...Ac(...e)}));function Rc(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ec({open:e,onOpenChange:t}){const s=$e(),n=L(w=>w.currentSessionRef),r=L(w=>W(w.historySurfaceSelection)),o=L(w=>w.isStreaming),l=L(w=>w.isTemporarySession),m=L(w=>w.rewindSession),[k,v]=b.useState([]),[c,u]=b.useState(null),[i,d]=b.useState(!1),[p,g]=b.useState(!1),[f,h]=b.useState(!1),[C,S]=b.useState(null);b.useEffect(()=>{if(r||!e||!n)return;let w=!1;return g(!0),S(null),v([]),u(null),d(!1),D.listRewindCheckpoints(n).then(E=>{var F;w||(v(E),u(((F=E[0])==null?void 0:F.messageId)??null))}).catch(E=>{w||S(E instanceof Error?E.message:s("chat.rewind.loadFailed"))}).finally(()=>{w||g(!1)}),()=>{w=!0}},[n,r,e]);const T=b.useMemo(()=>k.find(w=>w.messageId===c)??null,[k,c]),j=!!T&&!r&&!p&&!f&&!o&&!l,A=async()=>{if(qe(L.getState())||!T||!j)return;h(!0),S(null);const w=await m(T.messageId,i?"both":"conversation");h(!1),w?t(!1):S(s("chat.rewind.failed"))};return a.jsx(on,{open:e,onOpenChange:t,children:a.jsxs(hs,{className:"max-w-[620px] gap-0 overflow-hidden border-[#E5E7EB] bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b]",children:[a.jsx(cn,{className:"border-b border-[#E5E7EB] px-6 py-5 dark:border-zinc-800",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-[#F3F4F6] text-[#4B5563] dark:bg-zinc-800 dark:text-zinc-300",children:a.jsx(Dn,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx(ms,{className:"text-[15px] font-semibold text-[#111827] dark:text-zinc-100",children:s("chat.rewind.title")}),a.jsx(gs,{className:"mt-1 text-[12px] text-[#6B7280] dark:text-zinc-400",children:s("chat.rewind.description")})]})]})}),a.jsxs("div",{className:"min-h-[260px] px-6 py-4",children:[p&&a.jsxs("div",{className:"flex h-[220px] items-center justify-center text-[#6B7280] dark:text-zinc-400",children:[a.jsx(He,{className:"mr-2 h-4 w-4 animate-spin"}),a.jsx("span",{className:"text-xs font-mono",children:s("chat.rewind.loading")})]}),!p&&C&&a.jsx("div",{role:"alert",className:"rounded-md border border-rose-200 bg-rose-50 px-4 py-3 text-xs text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300",children:C}),!p&&!C&&k.length===0&&a.jsxs("div",{className:"flex h-[220px] flex-col items-center justify-center text-center",children:[a.jsx(Dn,{className:"mb-3 h-5 w-5 text-[#9CA3AF] dark:text-zinc-600"}),a.jsx("p",{className:"text-sm text-[#4B5563] dark:text-zinc-300",children:s("chat.rewind.empty")})]}),!p&&k.length>0&&a.jsx("div",{role:"radiogroup","aria-label":s("chat.rewind.checkpointAria"),className:"max-h-[310px] space-y-1 overflow-y-auto",children:k.map(w=>{const E=w.messageId===c;return a.jsxs("button",{type:"button",role:"radio","aria-checked":E,onClick:()=>u(w.messageId),className:te("w-full rounded-md border px-4 py-3 text-left transition-colors",E?"border-[#22C55E] bg-[#F0FDF4] dark:border-[#22C55E] dark:bg-[#052E16]/50":"border-transparent hover:bg-[#F9FAFB] dark:hover:bg-zinc-900"),children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsx("p",{className:"line-clamp-2 text-[13px] leading-5 text-[#111827] dark:text-zinc-100",children:w.preview||s("chat.rewind.userMessage")}),a.jsx("span",{className:"shrink-0 text-[10px] font-mono text-[#9CA3AF] dark:text-zinc-500",children:Rc(w.createdAt)})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] font-mono text-[#6B7280] dark:text-zinc-500",children:[a.jsx("span",{children:w.messageId.slice(0,10)}),w.fileCount>0&&a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(So,{className:"h-3 w-3"}),w.fileCount===1?s("chat.rewind.fileCountOne",{count:w.fileCount}):s("chat.rewind.fileCountMany",{count:w.fileCount})]})]})]},w.messageId)})})]}),a.jsx("div",{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:a.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[a.jsx("input",{type:"checkbox",checked:i,disabled:!T||T.fileCount===0,onChange:w=>d(w.target.checked),className:"mt-0.5 h-4 w-4 accent-[#16A34A] disabled:opacity-40"}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-[12px] font-medium text-[#374151] dark:text-zinc-200",children:s("chat.rewind.restoreCode")}),a.jsx("span",{className:"mt-0.5 block text-[11px] text-[#6B7280] dark:text-zinc-500",children:s("chat.rewind.restoreCodeHint")})]})]})}),a.jsxs(Ia,{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:[a.jsx(lt,{variant:"ghost",onClick:()=>t(!1),disabled:f,children:s("chat.rewind.cancel")}),a.jsxs(lt,{onClick:()=>void A(),disabled:!j,className:"bg-[#16A34A] text-white hover:bg-[#15803D]",children:[f?a.jsx(He,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(an,{className:"mr-2 h-4 w-4"}),s("chat.rewind.confirm")]})]})]})})}function Ba({inFlight:e,queued:t,maxConcurrent:s,compact:n=!1,className:r}){const o=$e(),l=Math.max(1,s),m=Array.from({length:Math.min(l,12)}),k=Math.min(e,l);return a.jsxs("div",{className:te("inline-flex items-center gap-2 font-mono",n?"text-[10.5px]":"text-[11px]",r),title:o("capacity.title",{inFlight:e,queued:t,max:s}),children:[a.jsx("span",{className:te("inline-flex items-center gap-[3px] rounded-sm",n?"px-0":"px-0.5"),children:m.map((v,c)=>{const u=c<k;return a.jsx("span",{className:te("block",n?"h-2.5 w-[3px] rounded-[1px]":"h-3 w-[3px] rounded-[1px]",u?"bg-[hsl(var(--deck-accent))] shadow-[0_0_4px_hsl(var(--deck-accent)/0.65)]":"bg-[hsl(var(--deck-border-strong))]/60")},c)})}),a.jsxs("span",{className:"tabular-nums text-[hsl(var(--deck-ink-muted))]",children:[a.jsx("span",{className:"text-[hsl(var(--deck-ink))]",children:e}),a.jsx("span",{className:"mx-[2px] opacity-40",children:"/"}),a.jsx("span",{children:s}),a.jsx("span",{className:"opacity-60",children:o("capacity.suffix.running")})]}),t>0&&a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm border border-amber-300/60 bg-amber-50 px-1.5 py-[1px] text-[10px] text-amber-800 dark:border-amber-800/60 dark:bg-amber-950/40 dark:text-amber-300",children:[a.jsx("span",{className:"h-1 w-1 rounded-full bg-amber-500"}),o("capacity.queued",{queued:t})]})]})}function ia(){const e=document.querySelector("textarea[data-blade-composer]:not(:disabled)");if(!e)return!1;e.focus();const t=e.value.length;return e.setSelectionRange(t,t),!0}const $a=[{id:"searchTasks",key:"k",primaryModifier:!0,scope:"Global"},{id:"openCommands",key:"p",primaryModifier:!0,shiftKey:!0,scope:"Global"},{id:"newTask",key:"n",primaryModifier:!1,scope:"Global"},{id:"focusComposer",key:"/",primaryModifier:!1,scope:"Chat"},{id:"toggleSidebar",key:"b",primaryModifier:!0,scope:"Layout"}];function Nc(e){const t=e.key.toLocaleLowerCase();return $a.find(s=>{if(s.key!==t||e.altKey||e.shiftKey!==!!s.shiftKey)return!1;const n=e.metaKey||e.ctrlKey;return s.primaryModifier?n:!n})??null}function Mc(e){return e instanceof Element?!!e.closest('input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]'):!1}function Ic(e){var n;const t=typeof navigator>"u"?null:navigator,s=((n=t==null?void 0:t.userAgentData)==null?void 0:n.platform)??(t==null?void 0:t.platform)??"";return/mac|iphone|ipad|ipod/i.test(s)}function Fc(e,t){const s=e.key==="/"?"/":e.key.toLocaleUpperCase(),n=Ic();return[...e.primaryModifier?[n?"⌘":"Ctrl"]:[],...e.shiftKey?[n?"⇧":"Shift"]:[],s]}function $l(e,t){const s=$a.find(n=>n.id===e);return s?Fc(s).join(""):""}function Oc(){const e=De(r=>r.setTaskSwitcherOpen),t=De(r=>r.setMainView),s=De(r=>r.toggleSidebar),n=L(r=>r.startTemporarySession);b.useEffect(()=>{const r=o=>{if(o.repeat)return;const l=Nc(o);if(!l)return;const m=De.getState(),k=m.isTaskSwitcherOpen,v=Mc(o.target),c=!!document.querySelector('[role="dialog"]');if(l.id==="searchTasks"||l.id==="openCommands"){if(c&&!k)return;o.preventDefault();const u=l.id==="searchTasks"?"tasks":"commands",i=k&&m.taskSwitcherMode===u;e(!i,u);return}if(!(v||c)){if(l.id==="newTask"){o.preventDefault(),t("workspace"),n(),requestAnimationFrame(()=>ia());return}if(l.id==="focusComposer"){ia()&&o.preventDefault();return}l.id==="toggleSidebar"&&(o.preventDefault(),s())}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t,e,n,s])}const Hc=b.lazy(()=>Be(()=>import("./SettingsModal-BCr6eHa7.js"),__vite__mapDeps([4,2,3,5,6,7,8,9,10,11,12,1,13])).then(e=>({default:e.SettingsModal}))),Ka=()=>Be(()=>import("./TaskSwitcher-IKy99xxv.js"),__vite__mapDeps([14,2,1,15,5,16,17,18,3])).then(e=>({default:e.TaskSwitcher})),Lc=b.lazy(Ka),Va=()=>Be(()=>import("./FilePreview-BtIVcR0F.js"),__vite__mapDeps([19,2,1,20,6,13,15,21,3])),Dc=b.lazy(()=>Va().then(e=>({default:e.FilePreview}))),Uc=b.lazy(()=>Va().then(e=>({default:e.PreviewControls}))),qc=b.lazy(()=>Be(()=>import("./TerminalPanel-BKXU8wN9.js"),__vite__mapDeps([22,2,23,24,1,16,3])).then(e=>({default:e.TerminalPanel}))),zc=b.lazy(()=>Be(()=>import("./Sidebar-DqrX6W8C.js"),__vite__mapDeps([25,2,8,3,1,26,7,11,17,5,16,21])).then(e=>({default:e.Sidebar}))),zs=e=>{if(e.startsWith("/Users/")){const t=e.split("/");if(t.length>=3)return"~/"+t.slice(3).join("/")}return e},_c=e=>e.replace(/^~\//,"~/§").split("/").filter(Boolean).map((t,s,n)=>{var r;return s===0&&((r=n[0])!=null&&r.startsWith("~"))?"~":t.replace(/^§/,"")});function Bc({children:e}){var ue,he;const t=$e();Oc();const{isSidebarOpen:s,isFilePreviewOpen:n,isSettingsOpen:r,isTerminalOpen:o,isTaskSwitcherOpen:l,toggleFilePreview:m,toggleTerminal:k,openFilePreview:v,setFilePreviewOpen:c,setTaskSwitcherOpen:u,previewRequestId:i,setSidebarOpen:d,mainView:p}=De();b.useEffect(()=>{const I=window.setTimeout(()=>{Ka()},1500);return()=>window.clearTimeout(I)},[]);const g=L(I=>I.currentSessionId),f=L(I=>I.currentSessionRef),h=L(I=>I.historySurfaceSelection),C=L(I=>I.sessions),S=L(I=>I.isStreaming),T=L(I=>I.isTemporarySession),j=L(I=>I.taskWorkspaceInfo),A=L(I=>I.boundProjects),w=L(I=>I.selectedProjectPath),[E,F]=b.useState(null),[x,N]=b.useState(!1),[P,B]=b.useState(),[U,_]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches),[Q,Z]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),ne=b.useRef(null),K=b.useRef(null),$=b.useRef(null),R=b.useMemo(()=>C.find(I=>V({sessionId:I.sessionId,projectPath:I.projectPath},f)),[f,C]),le=(R==null?void 0:R.taskIsolation)==="worktree"&&R.taskSourceProjectPath&&(((ue=R.taskDelivery)==null?void 0:ue.status)==="applied"||((he=R.taskDelivery)==null?void 0:he.status)==="discarded")?R.taskSourceProjectPath:f==null?void 0:f.projectPath,ge=W(h);b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const I=window.matchMedia("(max-width: 900px)"),q=()=>{I.matches&&d(!1)};return q(),I.addEventListener("change",q),()=>I.removeEventListener("change",q)},[d]),b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const I=window.matchMedia("(max-width: 639px)"),q=()=>_(I.matches);return q(),I.addEventListener("change",q),()=>I.removeEventListener("change",q)},[]),b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const I=window.matchMedia("(max-width: 1023px)"),q=()=>Z(I.matches);return q(),I.addEventListener("change",q),()=>I.removeEventListener("change",q)},[]),b.useEffect(()=>{if(!U||!s)return;const I=requestAnimationFrame(()=>{var q,ie;(ie=(q=ne.current)==null?void 0:q.querySelector("button"))==null||ie.focus()});return()=>{var q;cancelAnimationFrame(I),(q=K.current)==null||q.focus({preventScroll:!0})}},[U,s]);const ve=I=>{var fe;if(!U||!s)return;if(I.key==="Escape"){I.preventDefault(),d(!1);return}if(I.key!=="Tab")return;const q=Array.from(((fe=ne.current)==null?void 0:fe.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]);if(q.length===0)return;const ie=q[0],Ce=q[q.length-1];I.shiftKey&&document.activeElement===ie?(I.preventDefault(),Ce==null||Ce.focus()):!I.shiftKey&&document.activeElement===Ce&&(I.preventDefault(),ie==null||ie.focus())},xe=b.useMemo(()=>ge?null:p==="board"||!g||T?w?zs(w):null:R!=null&&R.projectPath?zs(R.taskSourceProjectPath||R.projectPath):null,[g,R,ge,T,p,w]),Re=b.useMemo(()=>xe?_c(xe):[],[xe]);b.useEffect(()=>{var q;if(ge){F(null);return}if(!f){F(((q=A.find(ie=>ie.path===w))==null?void 0:q.gitBranch)??null);return}(async()=>{try{const ie=await D.getGitInfo({sessionId:f.sessionId,projectPath:le??f.projectPath});F(ie.branch)}catch{F(null)}})()},[A,f,le,ge,w]);const Se=j==null?void 0:j.taskAdmission,Le=p==="board"?w??(j==null?void 0:j.cwd)??null:le??w??(j==null?void 0:j.cwd)??null,de=f&&p==="workspace"?ce(f):`project:${w??"none"}`,J=n&&Q,Y=n&&P;return b.useEffect(()=>{ge&&(n&&c(!1),o&&k(),l&&u(!1))},[ge,n,o,l,c,u,k]),a.jsxs("div",{className:"flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]",children:[U&&s&&!J&&a.jsx("button",{type:"button","aria-label":t("sidebar.action.collapse"),onClick:()=>d(!1),className:"fixed inset-0 z-40 bg-black/25 backdrop-blur-[1px]"}),a.jsx("div",{ref:ne,role:U&&s&&!J?"dialog":void 0,"aria-modal":U&&s&&!J?!0:void 0,"aria-label":U&&s&&!J?t("sidebar.navigationAria"):void 0,inert:J||U&&!s?!0:void 0,onKeyDown:ve,className:te("overflow-hidden",s?"w-[260px]":"w-[64px]",U?"fixed inset-y-0 left-0 z-50 shadow-2xl transition-none":"shrink-0 transition-[width] duration-300 ease-in-out",U&&!s&&"-translate-x-full"),children:a.jsx("div",{className:te("transition-all duration-300 ease-in-out",s?"w-[260px]":"w-[64px]"),children:a.jsx(b.Suspense,{fallback:null,children:a.jsx(zc,{onNavigate:()=>{U&&d(!1)}})})})}),a.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[a.jsxs("header",{inert:J,className:"relative z-10 flex h-14 items-center gap-2 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]/90 px-3 backdrop-blur-md sm:gap-4 sm:px-6",children:[U&&a.jsx(lt,{ref:K,"data-mobile-navigation-trigger":!0,variant:"ghost",size:"icon",onClick:()=>d(!0),"aria-label":t("layout.action.openNavigation"),title:t("layout.action.openNavigation"),className:"h-9 w-9 shrink-0 rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:a.jsx(Ro,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[ge?a.jsxs("span",{className:"font-mono text-[12px] font-medium text-[hsl(var(--deck-ink))]",children:[t("history.badge.remote")," · ",t("history.badge.historyOnly")]}):Re.length>0?a.jsx("nav",{"aria-label":t("layout.workspace.pathAria"),title:xe??void 0,className:"flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:Re.map((I,q)=>{const ie=q===Re.length-1,Ce=q===0&&I==="~";return a.jsxs("span",{className:"flex items-center min-w-0",children:[q>0&&a.jsx("span",{className:"mx-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),q===0&&!Ce&&a.jsx("span",{className:"mr-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),a.jsx("span",{className:te("truncate",ie?"font-medium text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:I})]},q)})}):a.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:j!=null&&j.cwd?zs(j.cwd):t("layout.workspace.empty")}),E&&a.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:[a.jsx(nn,{className:"h-3 w-3 text-[hsl(var(--deck-accent))]"}),E]})]}),a.jsxs("div",{className:"flex gap-3 items-center ml-auto",children:[Se&&a.jsx("span",{className:"hidden items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1 md:inline-flex",children:a.jsx(Ba,{inFlight:Se.inFlight,queued:Se.queued,maxConcurrent:Se.maxConcurrent,compact:!0})}),a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx(lt,{variant:"ghost",size:"icon","aria-label":t("layout.action.rewind"),title:t("layout.action.rewind"),disabled:ge||p==="board"||!f||T||S,onClick:()=>N(!0),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] disabled:opacity-35",children:a.jsx(an,{className:"w-4 h-4"})}),a.jsx(b.Suspense,{fallback:null,children:a.jsx(Uc,{ref:$,open:n,maximized:P,disabled:ge||p==="board",onToggleMaximized:()=>B(I=>!I),onTogglePreview:()=>{if(n){B(!1),m();return}v((!f||T)&&i===0?{tab:"files"}:void 0)}})})]})]})]}),a.jsxs("main",{className:"flex-1 overflow-hidden relative flex bg-[hsl(var(--deck-canvas))]",children:[a.jsx("div",{"data-preview-background":"content","data-preview-maximized":Y,inert:J,className:"relative flex min-w-0 flex-1 flex-col",children:r?a.jsx(b.Suspense,{fallback:null,children:a.jsx(Hc,{})}):e}),n&&!ge&&a.jsx(b.Suspense,{fallback:null,children:a.jsx(Dc,{returnFocusElement:$.current,maximized:Y},de)})]})]}),o&&!ge&&a.jsx(b.Suspense,{fallback:null,children:a.jsx(qc,{workspacePath:Le},Le??"default-workspace")}),l&&!ge&&a.jsx(b.Suspense,{fallback:null,children:a.jsx(Lc,{})}),a.jsx(Ec,{open:!ge&&x,onOpenChange:N})]})}const _s="BladeCode";function $c(){const e=$e(),t=L(l=>l.unreadTaskKeys),s=L(l=>l.sessions),n=L(l=>l.selectSession),r=L(l=>l.selectProject),o=b.useMemo(()=>{const l=new Set(t);for(const m of s)m.pendingInteraction&&l.add(ce(ee(m)));return l.size},[s,t]);return b.useEffect(()=>(document.title=o>0?`(${o}) ${_s}`:_s,()=>{document.title=_s}),[o]),b.useEffect(()=>{const l=m=>{var i;const k=m.detail;if(!(k!=null&&k.sessionId)||!k.projectPath)return;const v=L.getState(),c=as(v.sessions,k),u=c?fs(c,v.selectedProjectPath??((i=v.taskWorkspaceInfo)==null?void 0:i.cwd)??null):k.projectPath;v.boundProjects.some(d=>d.available&&d.path===u)&&r(u),n(k)};return window.addEventListener(rs,l),()=>window.removeEventListener(rs,l)},[r,n]),a.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:o>0?e("attention.unreadAnnouncement",{count:o}):""})}const at=Hr,rt=Lr,Xe=b.forwardRef(({className:e,align:t="center",sideOffset:s=4,...n},r)=>a.jsx(Dr,{children:a.jsx(fa,{ref:r,align:t,sideOffset:s,className:te("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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-popover-content-transform-origin]",e),...n})}));Xe.displayName=fa.displayName;const Xs=b.forwardRef(({className:e,...t},s)=>a.jsx("textarea",{className:te("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...t}));Xs.displayName="Textarea";const Kc=(e,t)=>{const s=[...e.matchAll(/(?:^|\s)(@(?:"[^"]*"|(?:[^\\ ]|\\ )*))/g)];for(const n of s){const r=n[1],o=n.index+(n[0].length-r.length),l=o+r.length;if(t>=o&&t<=l){let m=r.slice(1),k=!1;return m.startsWith('"')&&(k=!0,m=m.slice(1),m.endsWith('"')&&(m=m.slice(0,-1))),{hasQuery:!0,query:m,startIndex:o,endIndex:l,quoted:k}}}return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}},Vc=(e,t,s={})=>{const{debounceDelay:n=200,maxSuggestions:r=15,workspacePath:o,disabled:l=!1,canRequest:m}=s,[k,v]=b.useState([]),[c,u]=b.useState(0),[i,d]=b.useState(!1),p=b.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}:Kc(e,t),[e,t]);b.useEffect(()=>{if(l||!p.hasQuery){v([]),d(!1);return}let h=!1;d(!0);const S=setTimeout(async()=>{if(!(l||(m==null?void 0:m())===!1))try{const T=await fetch(`/suggestions/files?q=${encodeURIComponent(p.query)}&limit=${r}`,o?{headers:{"x-blade-directory":o}}:void 0);if(!T.ok)throw new Error("Failed to fetch suggestions");const j=await T.json();h||v(j)}catch(T){console.error("Failed to fetch file suggestions:",T),h||v([])}finally{h||d(!1)}},n);return()=>{h=!0,clearTimeout(S)}},[l,p.hasQuery,p.query,n,r,o,m]),b.useEffect(()=>{u(0)},[k]);const g=b.useCallback(()=>{u(h=>(h+1)%Math.max(k.length,1))},[k.length]),f=b.useCallback(()=>{u(h=>(h-1+k.length)%Math.max(k.length,1))},[k.length]);return{...p,suggestions:k,selectedIndex:c,loading:i,setSelectedIndex:u,selectNext:g,selectPrevious:f}},Qc=(e,t=!1)=>e.includes(" ")||t?`@"${e}"`:`@${e}`,Wc=(e,t,s)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const n=Qc(s,t.quoted),r=e.slice(0,t.startIndex),o=e.slice(t.endIndex),l=r+n+" "+o,m=t.startIndex+n.length+1;return{newInput:l,newCursorPos:m}};function Gc(){const[e,t]=b.useState([]),[s,n]=b.useState(-1),r=b.useRef(""),o=b.useCallback(v=>{v.trim()&&(t(c=>c[c.length-1]===v?c:[...c,v]),n(-1),r.current="")},[]),l=b.useCallback(v=>{if(e.length===0)return null;s===-1&&(r.current=v);const c=s===-1?e.length-1:Math.max(0,s-1);return n(c),e[c]??null},[e,s]),m=b.useCallback(()=>{if(s===-1)return null;const v=s+1;return v>=e.length?(n(-1),r.current):(n(v),e[v]??null)},[e,s]),k=b.useCallback(()=>{n(-1),r.current=""},[]);return{addToHistory:o,getPrevious:l,getNext:m,reset:k,historyIndex:s}}const Jc=(e,t)=>{if(!e.startsWith("/"))return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1};const s=e.indexOf(" "),n=s===-1?e.length:s;return t<=n?{hasQuery:!0,query:e.slice(1,t),startIndex:0,endIndex:t}:{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}},Yc=(e,t,s={})=>{const{debounceDelay:n=150,workspacePath:r}=s,[o,l]=b.useState([]),[m,k]=b.useState(0),[v,c]=b.useState(!1),u=b.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}:Jc(e,t),[e,t]);b.useEffect(()=>{if(!u.hasQuery){l([]),c(!1);return}let p=!1;c(!0);const f=setTimeout(async()=>{try{const h=await fetch(`/suggestions/commands?q=${encodeURIComponent(u.query)}`,r?{headers:{"x-blade-directory":r}}:void 0);if(!h.ok)throw new Error("Failed to fetch suggestions");const C=await h.json();p||l(C)}catch(h){console.error("Failed to fetch command suggestions:",h),p||l([])}finally{p||c(!1)}},n);return()=>{p=!0,clearTimeout(f)}},[u.hasQuery,u.query,n,r]),b.useEffect(()=>{k(0)},[o]);const i=b.useCallback(()=>{k(p=>(p+1)%Math.max(o.length,1))},[o.length]),d=b.useCallback(()=>{k(p=>(p-1+o.length)%Math.max(o.length,1))},[o.length]);return{...u,suggestions:o,selectedIndex:m,loading:v,setSelectedIndex:k,selectNext:i,selectPrevious:d}},Xc=(e,t,s)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const n=e.slice(t.endIndex),r=s.command+" "+n.trimStart(),o=s.command.length+1;return{newInput:r,newCursorPos:o}},Zc="blade.composer.draft.",is=new Map,Zs=new Set,Qa=1;function cs(){return typeof sessionStorage>"u"?null:sessionStorage}function ls(e){return`${Zc}${e}`}function Wa(e){var s;if(!e)return{content:"",attachments:[],outputSchema:void 0};const t=is.get(e);if(t)return{content:t.content,attachments:[...t.attachments],outputSchema:t.outputSchema};try{const n=((s=cs())==null?void 0:s.getItem(ls(e)))??"";if(!n)return{content:"",attachments:[],outputSchema:void 0};try{const r=JSON.parse(n);if(r.version===Qa&&typeof r.content=="string"&&(r.outputSchema===void 0||typeof r.outputSchema=="string"))return{content:r.content,attachments:[],outputSchema:r.outputSchema}}catch{}return{content:n,attachments:[],outputSchema:void 0}}catch{return{content:"",attachments:[],outputSchema:void 0}}}function Oe(e,t){var r,o;if(!e)return;const s=is.get(e),n=t.outputSchema??(s==null?void 0:s.outputSchema);if(!t.content&&t.attachments.length===0&&!n){Ga(e);return}is.set(e,{content:t.content,attachments:[...t.attachments],outputSchema:n});try{t.content||n?(r=cs())==null||r.setItem(ls(e),JSON.stringify({version:Qa,content:t.content,...n?{outputSchema:n}:{}})):(o=cs())==null||o.removeItem(ls(e))}catch{}}function Ga(e){var t;if(e){is.delete(e);try{(t=cs())==null||t.removeItem(ls(e))}catch{}}}function Kl(e,t){const s=t.trim();if(!e||!s)return!1;const n=Wa(e),r=n.content.length===0?"":n.content.endsWith(`
197
+ */const Xt=X("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ja(e){var t,s,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(s=ja(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Ta(){for(var e,t,s=0,n="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=ja(e))&&(n&&(n+=" "),n+=t);return n}const zn=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,_n=Ta,Do=(e,t)=>s=>{var n;if((t==null?void 0:t.variants)==null)return _n(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:r,defaultVariants:o}=t,l=Object.keys(r).map(v=>{const c=s==null?void 0:s[v],u=o==null?void 0:o[v];if(c===null)return null;const i=zn(c)||zn(u);return r[v][i]}),m=s&&Object.entries(s).reduce((v,c)=>{let[u,i]=c;return i===void 0||(v[u]=i),v},{}),k=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((v,c)=>{let{class:u,className:i,...d}=c;return Object.entries(d).every(p=>{let[g,f]=p;return Array.isArray(f)?f.includes({...o,...m}[g]):{...o,...m}[g]===f})?[...v,u,i]:v},[]);return _n(e,l,k,s==null?void 0:s.class,s==null?void 0:s.className)},rn="-",Uo=e=>{const t=zo(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{const m=l.split(rn);return m[0]===""&&m.length!==1&&m.shift(),Pa(m,t)||qo(l)},getConflictingClassGroupIds:(l,m)=>{const k=s[l]||[];return m&&n[l]?[...k,...n[l]]:k}}},Pa=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const s=e[0],n=t.nextPart.get(s),r=n?Pa(e.slice(1),n):void 0;if(r)return r;if(t.validators.length===0)return;const o=e.join(rn);return(l=t.validators.find(({validator:m})=>m(o)))==null?void 0:l.classGroupId},Bn=/^\[(.+)\]$/,qo=e=>{if(Bn.test(e)){const t=Bn.exec(e)[1],s=t==null?void 0:t.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},zo=e=>{const{theme:t,prefix:s}=e,n={nextPart:new Map,validators:[]};return Bo(Object.entries(e.classGroups),s).forEach(([o,l])=>{Qs(l,n,o,t)}),n},Qs=(e,t,s,n)=>{e.forEach(r=>{if(typeof r=="string"){const o=r===""?t:$n(t,r);o.classGroupId=s;return}if(typeof r=="function"){if(_o(r)){Qs(r(n),t,s,n);return}t.validators.push({validator:r,classGroupId:s});return}Object.entries(r).forEach(([o,l])=>{Qs(l,$n(t,o),s,n)})})},$n=(e,t)=>{let s=e;return t.split(rn).forEach(n=>{s.nextPart.has(n)||s.nextPart.set(n,{nextPart:new Map,validators:[]}),s=s.nextPart.get(n)}),s},_o=e=>e.isThemeGetter,Bo=(e,t)=>t?e.map(([s,n])=>{const r=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,m])=>[t+l,m])):o);return[s,r]}):e,$o=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,n=new Map;const r=(o,l)=>{s.set(o,l),t++,t>e&&(t=0,n=s,s=new Map)};return{get(o){let l=s.get(o);if(l!==void 0)return l;if((l=n.get(o))!==void 0)return r(o,l),l},set(o,l){s.has(o)?s.set(o,l):r(o,l)}}},Aa="!",Ko=e=>{const{separator:t,experimentalParseClassName:s}=e,n=t.length===1,r=t[0],o=t.length,l=m=>{const k=[];let v=0,c=0,u;for(let f=0;f<m.length;f++){let h=m[f];if(v===0){if(h===r&&(n||m.slice(f,f+o)===t)){k.push(m.slice(c,f)),c=f+o;continue}if(h==="/"){u=f;continue}}h==="["?v++:h==="]"&&v--}const i=k.length===0?m:m.substring(c),d=i.startsWith(Aa),p=d?i.substring(1):i,g=u&&u>c?u-c:void 0;return{modifiers:k,hasImportantModifier:d,baseClassName:p,maybePostfixModifierPosition:g}};return s?m=>s({className:m,parseClassName:l}):l},Vo=e=>{if(e.length<=1)return e;const t=[];let s=[];return e.forEach(n=>{n[0]==="["?(t.push(...s.sort(),n),s=[]):s.push(n)}),t.push(...s.sort()),t},Qo=e=>({cache:$o(e.cacheSize),parseClassName:Ko(e),...Uo(e)}),Wo=/\s+/,Go=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:r}=t,o=[],l=e.trim().split(Wo);let m="";for(let k=l.length-1;k>=0;k-=1){const v=l[k],{modifiers:c,hasImportantModifier:u,baseClassName:i,maybePostfixModifierPosition:d}=s(v);let p=!!d,g=n(p?i.substring(0,d):i);if(!g){if(!p){m=v+(m.length>0?" "+m:m);continue}if(g=n(i),!g){m=v+(m.length>0?" "+m:m);continue}p=!1}const f=Vo(c).join(":"),h=u?f+Aa:f,C=h+g;if(o.includes(C))continue;o.push(C);const S=r(g,p);for(let T=0;T<S.length;++T){const j=S[T];o.push(h+j)}m=v+(m.length>0?" "+m:m)}return m};function Jo(){let e=0,t,s,n="";for(;e<arguments.length;)(t=arguments[e++])&&(s=Ra(t))&&(n&&(n+=" "),n+=s);return n}const Ra=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=Ra(e[n]))&&(s&&(s+=" "),s+=t);return s};function Yo(e,...t){let s,n,r,o=l;function l(k){const v=t.reduce((c,u)=>u(c),e());return s=Qo(v),n=s.cache.get,r=s.cache.set,o=m,m(k)}function m(k){const v=n(k);if(v)return v;const c=Go(k,s);return r(k,c),c}return function(){return o(Jo.apply(null,arguments))}}const me=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},Ea=/^\[(?:([a-z-]+):)?(.+)\]$/i,Xo=/^\d+\/\d+$/,Zo=new Set(["px","full","screen"]),ei=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ti=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,si=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,ni=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ai=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_e=e=>kt(e)||Zo.has(e)||Xo.test(e),We=e=>vt(e,"length",pi),kt=e=>!!e&&!Number.isNaN(Number(e)),Es=e=>vt(e,"number",kt),Ct=e=>!!e&&Number.isInteger(Number(e)),ri=e=>e.endsWith("%")&&kt(e.slice(0,-1)),G=e=>Ea.test(e),Ge=e=>ei.test(e),oi=new Set(["length","size","percentage"]),ii=e=>vt(e,oi,Na),ci=e=>vt(e,"position",Na),li=new Set(["image","url"]),di=e=>vt(e,li,mi),ui=e=>vt(e,"",hi),jt=()=>!0,vt=(e,t,s)=>{const n=Ea.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):s(n[2]):!1},pi=e=>ti.test(e)&&!si.test(e),Na=()=>!1,hi=e=>ni.test(e),mi=e=>ai.test(e),gi=()=>{const e=me("colors"),t=me("spacing"),s=me("blur"),n=me("brightness"),r=me("borderColor"),o=me("borderRadius"),l=me("borderSpacing"),m=me("borderWidth"),k=me("contrast"),v=me("grayscale"),c=me("hueRotate"),u=me("invert"),i=me("gap"),d=me("gradientColorStops"),p=me("gradientColorStopPositions"),g=me("inset"),f=me("margin"),h=me("opacity"),C=me("padding"),S=me("saturate"),T=me("scale"),j=me("sepia"),A=me("skew"),w=me("space"),E=me("translate"),F=()=>["auto","contain","none"],x=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",G,t],P=()=>[G,t],B=()=>["",_e,We],U=()=>["auto",kt,G],_=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Q=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>["start","end","center","between","around","evenly","stretch"],K=()=>["","0",G],$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>[kt,G];return{cacheSize:500,separator:":",theme:{colors:[jt],spacing:[_e,We],blur:["none","",Ge,G],brightness:R(),borderColor:[e],borderRadius:["none","","full",Ge,G],borderSpacing:P(),borderWidth:B(),contrast:R(),grayscale:K(),hueRotate:R(),invert:K(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[ri,We],inset:N(),margin:N(),opacity:R(),padding:P(),saturate:R(),scale:R(),sepia:K(),skew:R(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",G]}],container:["container"],columns:[{columns:[Ge]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[..._(),G]}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ct,G]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",G]}],grow:[{grow:K()}],shrink:[{shrink:K()}],order:[{order:["first","last","none",Ct,G]}],"grid-cols":[{"grid-cols":[jt]}],"col-start-end":[{col:["auto",{span:["full",Ct,G]},G]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[jt]}],"row-start-end":[{row:["auto",{span:[Ct,G]},G]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",G]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",G]}],gap:[{gap:[i]}],"gap-x":[{"gap-x":[i]}],"gap-y":[{"gap-y":[i]}],"justify-content":[{justify:["normal",...ne()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ne(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ne(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[f]}],mx:[{mx:[f]}],my:[{my:[f]}],ms:[{ms:[f]}],me:[{me:[f]}],mt:[{mt:[f]}],mr:[{mr:[f]}],mb:[{mb:[f]}],ml:[{ml:[f]}],"space-x":[{"space-x":[w]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[w]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",G,t]}],"min-w":[{"min-w":[G,t,"min","max","fit"]}],"max-w":[{"max-w":[G,t,"none","full","min","max","fit","prose",{screen:[Ge]},Ge]}],h:[{h:[G,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[G,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[G,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[G,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ge,We]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Es]}],"font-family":[{font:[jt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",G]}],"line-clamp":[{"line-clamp":["none",kt,Es]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_e,G]}],"list-image":[{"list-image":["none",G]}],"list-style-type":[{list:["none","disc","decimal",G]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[h]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_e,We]}],"underline-offset":[{"underline-offset":["auto",_e,G]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",G]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",G]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[..._(),ci]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ii]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},di]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[d]}],"gradient-via":[{via:[d]}],"gradient-to":[{to:[d]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[m]}],"border-w-x":[{"border-x":[m]}],"border-w-y":[{"border-y":[m]}],"border-w-s":[{"border-s":[m]}],"border-w-e":[{"border-e":[m]}],"border-w-t":[{"border-t":[m]}],"border-w-r":[{"border-r":[m]}],"border-w-b":[{"border-b":[m]}],"border-w-l":[{"border-l":[m]}],"border-opacity":[{"border-opacity":[h]}],"border-style":[{border:[...Q(),"hidden"]}],"divide-x":[{"divide-x":[m]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[m]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[h]}],"divide-style":[{divide:Q()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...Q()]}],"outline-offset":[{"outline-offset":[_e,G]}],"outline-w":[{outline:[_e,We]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[_e,We]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ge,ui]}],"shadow-color":[{shadow:[jt]}],opacity:[{opacity:[h]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[n]}],contrast:[{contrast:[k]}],"drop-shadow":[{"drop-shadow":["","none",Ge,G]}],grayscale:[{grayscale:[v]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[u]}],saturate:[{saturate:[S]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[k]}],"backdrop-grayscale":[{"backdrop-grayscale":[v]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[h]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",G]}],duration:[{duration:R()}],ease:[{ease:["linear","in","out","in-out",G]}],delay:[{delay:R()}],animate:[{animate:["none","spin","ping","pulse","bounce",G]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Ct,G]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",G]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",G]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",G]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[_e,We,Es]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},fi=Yo(gi);function te(...e){return fi(Ta(e))}const ki=Do("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),lt=b.forwardRef(({className:e,variant:t,size:s,asChild:n=!1,...r},o)=>{const l=n?Mr:"button";return a.jsx(l,{className:te(ki({variant:t,size:s,className:e})),ref:o,...r})});lt.displayName="Button";const on=Or,yi=Ir,Ma=b.forwardRef(({className:e,...t},s)=>a.jsx(pa,{ref:s,className:te("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Ma.displayName=pa.displayName;const hs=b.forwardRef(({className:e,children:t,hideCloseButton:s,...n},r)=>a.jsxs(yi,{children:[a.jsx(Ma,{}),a.jsxs(ha,{ref:r,"aria-modal":"true",className:te("fixed left-[50%] top-[50%] z-50 grid max-h-[calc(100dvh-24px)] w-[calc(100vw-24px)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,!s&&a.jsxs(Fr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(Xt,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));hs.displayName=ha.displayName;const cn=({className:e,...t})=>a.jsx("div",{className:te("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});cn.displayName="DialogHeader";const Ia=({className:e,...t})=>a.jsx("div",{className:te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ia.displayName="DialogFooter";const ms=b.forwardRef(({className:e,...t},s)=>a.jsx(ma,{ref:s,className:te("text-lg font-semibold leading-none tracking-tight",e),...t}));ms.displayName=ma.displayName;const gs=b.forwardRef(({className:e,...t},s)=>a.jsx(ga,{ref:s,className:te("text-sm text-muted-foreground",e),...t}));gs.displayName=ga.displayName;const vi={"app.restoring":"Restoring workspace…","layout.workspace.pathAria":"Workspace path","layout.workspace.empty":"No workspace","layout.action.rewind":"Rewind session","layout.action.openNavigation":"Open navigation","layout.action.previewRestore":"Restore preview","layout.action.previewMaximize":"Maximize preview","terminal.title":"Terminal","terminal.status.connected":"Terminal connected","terminal.status.disconnected":"Terminal disconnected","terminal.action.minimize":"Minimize terminal","terminal.action.restore":"Restore terminal","terminal.action.close":"Close terminal","history.surface.aria":"Session history surface","history.banner.aria":"History surface banner","history.badge.remote":"Remote","history.badge.historyOnly":"History only","history.connection.local":"Local","history.connection.online":"Online","history.connection.offline":"Offline","history.location.label":"Canonical location","history.unavailable.prompt":"Open this Session from its ACP owner to continue. Prompt unavailable in history-only mode.","history.unavailable.files":"Files unavailable in history-only mode","history.unavailable.terminal":"Terminal unavailable in history-only mode","history.loading":"Loading history surface…","history.recovery.cursor":"History was refreshed after the cursor became invalid.","history.recovery.snapshot":"History was refreshed after the snapshot changed.","history.bounded":"Showing a bounded history window.","history.action.loadOlder":"Load older messages","history.action.loadingOlder":"Loading older messages…","history.action.fork":"Fork history branch","history.action.forking":"Forking history branch…","history.action.close":"Close history","history.action.copy":"Copy message {id}","history.search.aria":"Search loaded messages","history.search.placeholder":"Search loaded messages","history.search.scope":"Search filters only the messages loaded here.","history.search.empty":"No loaded messages match this search.","history.messages.empty":"No history messages loaded.","history.error.unavailable":"This Session history is unavailable.","history.error.invalid":"This Session history response was invalid.","history.error.generic":"Session history could not be loaded.","history.role.user":"User","history.role.assistant":"Assistant","sidebar.project.remoteSessions":"Remote sessions","sidebar.brand.badge":"WEB","sidebar.action.collapse":"Collapse sidebar","sidebar.action.expand":"Expand sidebar","sidebar.navigationAria":"Task navigation","sidebar.action.newTask":"New Task","sidebar.action.newTaskShort":"New task","sidebar.action.taskBoard":"Task board","sidebar.action.terminal":"Terminal","sidebar.action.terminalToggle":"Toggle terminal","sidebar.action.searchTasks":"Search tasks","sidebar.unreadTasks":"{count} unread tasks","sidebar.section.skills":"Skills","sidebar.section.mcp":"MCP","sidebar.section.settings":"Settings","sidebar.status.user":"User","sidebar.status.feedLive":"Task feed live","sidebar.status.feedOffline":"Task feed offline","sidebar.empty.title":"No tasks yet","sidebar.empty.hint":"Dispatch one from the home view","sidebar.group.running":"RUNNING","sidebar.group.queued":"QUEUED","sidebar.group.interrupted":"INTERRUPTED","sidebar.group.failed":"FAILED","sidebar.group.cancelled":"CANCELLED","sidebar.group.done":"DONE","sidebar.group.showMore":"Show {count} more","sidebar.group.showLess":"Show less","sidebar.view.project":"Projects","sidebar.view.status":"Status","sidebar.view.projectAria":"Group sessions by project","sidebar.view.statusAria":"Group sessions by status","sidebar.project.active":"active","sidebar.project.expand":"Expand {name}","sidebar.project.collapse":"Collapse {name}","sidebar.project.newTask":"New task in {name}","sidebar.project.reorder":"Reorder {name}, position {position} of {count}","sidebar.project.reorderHint":"Drag to reorder, or use Up and Down arrow keys","sidebar.project.reordered":"Moved {name} to position {position}","sidebar.project.projects":"Projects","sidebar.catalog.syncing":"Syncing task history…","sidebar.catalog.loaded":"{count} loaded","sidebar.catalog.incomplete":"Task history is incomplete","sidebar.catalog.retry":"Retry","projects.dialog.title":"Projects","projects.dialog.description":"Bind local folders to switch task context without restarting Blade.","projects.bind.placeholder":"/absolute/path/to/project","projects.bind.pathLabel":"Project path","projects.bind.action":"Bind","projects.bind.failed":"Failed to bind project","projects.pick.action":"Choose project folder","projects.pick.actionShort":"Choose","projects.pick.picking":"Choosing…","projects.pick.failed":"Failed to choose a project folder","projects.unbind.action":"Unbind project","projects.unavailable":"unavailable","sidebar.language.label":"Language","sidebar.language.aria":"Switch language","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"worktree","session.env.local":"local","session.action.select":"Select {title}","session.action.save":"Save {title}","session.action.cancel":"Cancel {title}","session.action.more":"More actions for {title}","session.action.fork":"Fork {title}","session.action.forkShort":"Fork","session.action.rename":"Rename {title}","session.action.renameShort":"Rename","session.action.archive":"Archive {title}","session.action.archiveShort":"Archive","session.action.export":"Export {title} as Markdown","session.action.exportShort":"Export Markdown","session.action.exportingShort":"Exporting…","session.action.delete":"Delete {title}","session.action.deleteShort":"Delete","session.action.stop":"Stop {title}","session.action.stopping":"Stopping {title}","session.action.retry":"Retry {title}","session.action.retrying":"Retrying {title}","session.reason.cancelledByUser":"Cancelled by user","session.title.codeReview":"Code Review","session.forkedFrom":"Forked from","session.retriedFrom":"Retried from","session.retryShort":"retry","session.queued":"#{position}/{depth} queued","archive.title":"Archive","archive.subtitle":"Stored safely outside the active task list","archive.open":"Open session archive","archive.refresh":"Refresh archived sessions","archive.retry":"Retry","archive.loading":"Loading archive…","archive.empty":"No archived sessions","archive.restore":"Restore {title}","archive.restoreShort":"Restore","archive.restoreAncestor":"Restore the archive root first","archive.inherited":"Archived with {id}","taskSwitcher.title":"Task switcher","taskSwitcher.description":"Search and open tasks across every project.","taskSwitcher.searchAria":"Search tasks","taskSwitcher.placeholder":"Search title, project, branch, status, or session ID…","taskSwitcher.results":"{count} results","taskSwitcher.recent":"Recent tasks","taskSwitcher.scope":"{count} tasks indexed","taskSwitcher.indexing":"Indexing tasks…","taskSwitcher.resultsAria":"Task search results","taskSwitcher.current":"Current","taskSwitcher.unread":"{count} unread","taskSwitcher.needsAction":"{count} need action","taskSwitcher.new":"New","taskSwitcher.empty":"No matching tasks","taskSwitcher.emptyHint":"Try a project, branch, status, or shorter phrase.","taskSwitcher.hint.navigate":"navigate","taskSwitcher.hint.open":"open","taskSwitcher.hint.toggle":"toggle","taskSwitcher.action.failed":"Task action failed","commandCenter.title":"Command center","commandCenter.description":"Search tasks or run workspace and application actions.","commandCenter.searchAria":"Search actions","commandCenter.placeholder":"Search actions, settings, or tools…","commandCenter.modeAria":"Command center mode","commandCenter.mode.tasks":"Tasks","commandCenter.mode.commands":"Actions","commandCenter.actions":"{count} actions","commandCenter.resultsAria":"Action search results","commandCenter.empty":"No matching actions","commandCenter.emptyHint":"Try a tool, panel, or setting name.","commandCenter.action.newTask":"New task","commandCenter.action.newTaskDescription":"Open a clean task composer","commandCenter.action.preview":"Toggle preview","commandCenter.action.previewDescription":"Review files, diffs, run logs, and web pages","commandCenter.action.terminal":"Toggle terminal","commandCenter.action.terminalDescription":"Open or close the workspace shell","commandCenter.action.settings":"Open settings","commandCenter.action.settingsDescription":"Configure appearance and behavior","commandCenter.action.models":"Configure models","commandCenter.action.modelsDescription":"Select providers and task models","commandCenter.action.shortcuts":"View keyboard shortcuts","commandCenter.action.shortcutsDescription":"Browse global and contextual keys","commandCenter.action.skills":"Manage skills","commandCenter.action.skillsDescription":"Discover and configure agent capabilities","commandCenter.action.mcp":"Manage MCP servers","commandCenter.action.mcpDescription":"Configure connected tools and servers","commandCenter.action.sidebar":"Toggle sidebar","commandCenter.action.sidebarDescription":"Show or hide project navigation","taskHome.eyebrow":"Task dispatcher · Ready","taskHome.feed.connecting":"Task dispatcher · Connecting","taskHome.feed.reconnecting":"Task dispatcher · Reconnecting","taskHome.feed.offline":"Task dispatcher · Offline","taskHome.feed.offlineDescription":"Live task updates are paused. Running tasks continue on the server.","taskHome.feed.retry":"Reconnect","taskHome.hero.prefix":"What should Blade build in","taskHome.hero.projectFallback":"current workspace","taskHome.hero.subtitle":"Dispatch a task and keep moving. Each task runs in its own worktree, persists state, and returns with a reviewable workspace when it's done.","taskHome.templates.title":"Templates","taskHome.templates.hint":"1–4 to prefill","taskHome.template.explore.title":"Explore","taskHome.template.explore.description":"Trace behavior and explain the system","taskHome.template.explore.hint":"Trace a call · map a module","taskHome.template.build.title":"Build","taskHome.template.build.description":"Implement a production-ready feature","taskHome.template.build.hint":"Ship a feature end-to-end","taskHome.template.review.title":"Review","taskHome.template.review.description":"Find correctness and regression risks","taskHome.template.review.hint":"Audit current changes","taskHome.review.attachmentsUnsupported":"Code review does not accept attachments","taskHome.review.outputSchemaUnsupported":"Code review uses its own structured report schema","taskHome.review.usage":"Usage: /review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"Read-only code review in progress","taskHome.review.stale":"Review target changed while the reviewer was running","taskHome.review.aborted":"Code review aborted","taskHome.review.interrupted":"Code review interrupted by process restart","taskHome.review.failed":"Code review failed","taskHome.review.startFailed":"Failed to start code review","taskHome.review.invalidTarget":"The selected review target is invalid or has no changes","taskHome.review.conflict":"This session already has active work","taskHome.template.fix.title":"Fix","taskHome.template.fix.description":"Diagnose and repair a concrete failure","taskHome.template.fix.hint":"Bisect · reproduce · patch","taskHome.context.isolationToggleTitle":"Toggle task isolation","taskHome.context.projectSelect":"Select target project","taskHome.context.isolation.worktree":"Isolated worktree","taskHome.context.isolation.local":"Local workspace","taskHome.context.branchFallback":"no branch","taskHome.context.preparing":"Preparing worktree","taskHome.setup.aria":"Task setup status","taskHome.setup.title":"Finish setup","taskHome.setup.description":"Keep drafting while Blade verifies the workspace and model.","taskHome.setup.workspace.title":"Workspace","taskHome.setup.workspace.loading":"Checking available workspaces…","taskHome.setup.workspace.ready":"{project} selected","taskHome.setup.workspace.required":"Choose an available project","taskHome.setup.workspace.empty":"No project","taskHome.setup.workspace.action":"Choose","taskHome.setup.workspace.retry":"Reload workspaces","taskHome.setup.model.title":"Model","taskHome.setup.model.loading":"Checking configuration…","taskHome.setup.model.ready":"Ready for this task","taskHome.setup.model.required":"Configure or select a model","taskHome.setup.model.action":"Configure","taskHome.setup.model.retry":"Retry","taskHome.composer.placeholder":"Describe the outcome, constraints, and verification you expect...","taskHome.error.dismiss":"Dismiss","taskHome.recent.title":"Recent tasks","taskHome.recent.total":"{count} total","taskHome.recent.partial":"{count} loaded · syncing","taskHome.recent.incomplete":"{count} loaded · history incomplete","taskSwitcher.indexingLoaded":"{count} loaded · syncing history","taskHome.footer.note":"Worktree isolation keeps parallel tasks from touching your active checkout","kanban.title":"Task board","kanban.subtitle":"Dispatch work across bound projects and focus on tasks that need intervention.","kanban.taskCount":"{count} tasks","kanban.searchAria":"Search task board","kanban.searchPlaceholder":"Search tasks...","kanban.projectFilterAria":"Filter task board by project","kanban.projectAll":"All projects","kanban.feed.offline":"Live updates are offline. Running tasks continue.","kanban.autoClaim.running":"Auto-claiming","kanban.autoClaim.paused":"Auto-claim paused","kanban.column.waiting":"Waiting","kanban.column.waitingDescription":"Queued for an execution slot","kanban.column.active":"In progress","kanban.column.activeDescription":"Agents currently working","kanban.column.blocked":"Blocked","kanban.column.blockedDescription":"Needs input, retry, or attention","kanban.column.review":"Ready for review","kanban.column.reviewDescription":"Completed work awaiting acceptance","kanban.column.empty":"No tasks in this stage","kanban.priority.high":"High","kanban.priority.medium":"Medium","kanban.priority.low":"Low","kanban.kind.feature":"Feature","kanban.kind.bug":"Bug","kanban.kind.maintenance":"Maintenance","kanban.kind.research":"Research","kanban.card.unread":"New task update","kanban.card.queuePosition":"Queue #{position} of {depth}","kanban.card.diff":"{files} files · +{additions} −{deletions}","kanban.action.newTask":"New task","kanban.action.open":"Open task","kanban.action.respond":"Respond to blocker","kanban.action.inspect":"Inspect changes","kanban.action.edit":"Edit task details","kanban.action.cancel":"Cancel task","kanban.action.retry":"Retry task","kanban.action.archive":"Accept and archive","kanban.dialog.createTitle":"Dispatch task","kanban.dialog.createDescription":"The task runs directly in the selected project workspace.","kanban.dialog.editTitle":"Edit task","kanban.dialog.editDescription":"Update planning metadata without interrupting the running agent.","kanban.dialog.localExecution":"Local workspace · no worktree isolation","kanban.dialog.cancel":"Cancel","kanban.dialog.dispatch":"Dispatch","kanban.dialog.save":"Save","kanban.dialog.submitFailed":"Task operation failed","kanban.field.title":"Title","kanban.field.titlePlaceholder":"Optional concise task title","kanban.field.prompt":"Task brief","kanban.field.promptPlaceholder":"Describe the outcome, constraints, and verification expected...","kanban.field.project":"Project","kanban.field.kind":"Type","kanban.field.priority":"Priority","kanban.field.dueAt":"Due","capacity.title":"{inFlight} running · {queued} queued · max {max}","capacity.suffix.running":" running","capacity.queued":"{queued} queued","recent.status.running":"running","recent.status.queued":"queued","recent.status.paused":"paused","recent.status.failed":"failed","recent.status.cancelled":"cancelled","recent.status.done":"done","recent.time.justNow":"just now","recent.time.minutes":"{n}m ago","recent.time.hours":"{n}h ago","recent.time.days":"{n}d ago","recent.session.fallbackShort":"Session {id}","recent.session.fallbackDated":"Session {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} unread task updates","attention.notification.completed":"Task completed","attention.notification.failed":"Task failed","attention.notification.interrupted":"Task interrupted","attention.notification.permission":"Approval required","attention.notification.question":"Answer required","attention.notification.elicitation":"MCP input required","interaction.permission.title":"Permission required: {tool}","interaction.permission.once":"Allow once","interaction.permission.session":"Allow for session","interaction.permission.project":"Allow for project","interaction.permission.deny":"Deny","interaction.permission.failed":"Failed to respond to permission","interaction.question.answered":"Questions answered","interaction.question.other":"Other","interaction.question.submit":"Submit answers","interaction.question.failed":"Failed to submit answers","interaction.elicitation.title":"MCP input requested","interaction.elicitation.submit":"Submit to MCP","interaction.elicitation.open":"Open external URL","interaction.elicitation.decline":"Decline","interaction.elicitation.cancel":"Cancel","interaction.elicitation.responded":"MCP request answered","interaction.elicitation.cancelled":"MCP request cancelled","interaction.elicitation.failed":"Failed to respond to MCP request","interaction.elicitation.warning":"Only continue if you trust this MCP server and understand the request.","interaction.bar.permissionTitle":"Agent needs approval","interaction.bar.permissionHint":"Review the pending tool request before this task can continue.","interaction.bar.questionTitle":"Agent needs your answer","interaction.bar.questionHint":"Answer the pending question before this task can continue.","interaction.bar.elicitationTitle":"MCP server needs your input","interaction.bar.elicitationHint":"Review the MCP request before this task can continue.","interaction.bar.review":"Review request","interaction.badge.permission":"Needs approval","interaction.badge.question":"Needs answer","interaction.badge.elicitation":"MCP input","artifact.env.isolated":"isolated","artifact.env.local":"local","artifact.review":"Review changes","artifact.commits":"{count} commits","artifact.apply":"Apply","artifact.retryApply":"Retry apply","artifact.applying":"Applying","artifact.applied":"Applied","artifact.discard":"Discard task changes","artifact.discarded":"Discarded","artifact.conflict":"The task changes could not be applied safely.","artifact.conflictHint":"The isolated changes are preserved. Review them, resolve the source project, then retry or discard.","artifact.discardDialog.title":"Discard isolated changes?","artifact.discardDialog.description":"Remove {count} changed files from the isolated task workspace for {project}.","artifact.discardDialog.warning":"This permanently removes the task worktree and branch. Your source project is not modified.","artifact.discardDialog.cancel":"Keep changes","artifact.discardDialog.confirm":"Discard changes","chat.list.empty.eyebrow":"Blade · Ready","chat.list.empty.title":"Start a conversation to begin","chat.list.empty.hint":"Ask a question, describe a change, or paste a stack trace.","chat.list.loading.eyebrow":"Conversation history","chat.list.loading.title":"Restoring conversation…","chat.list.loading.hint":"Loading messages, task state, and live updates. Larger conversations may take a moment.","chat.list.showEarlier":"Show {count} earlier messages","chat.list.showEarlierWithRemaining":"Show {count} earlier messages, {remaining} hidden","chat.list.jumpLatest":"Jump to latest","chat.list.unreadMessage":"1 new message","chat.list.unreadMessages":"{count} new messages","chat.turns.aria":"Jump to a previous message","chat.turns.label":"Turn {n}","chat.timeline.thinking":"Thought process","chat.timeline.tools.runningOne":"Running 1 command","chat.timeline.tools.running":"Running {count} commands","chat.timeline.tools.completedOne":"Executed 1 command","chat.timeline.tools.completed":"Executed {count} commands","chat.timeline.tools.completedOneWithError":"Executed 1 command · failed","chat.timeline.tools.completedWithErrors":"Executed {count} commands · {errors} failed","chat.error.dismiss":"Dismiss error","chat.error.queueFull":"The guidance queue is full. Wait for pending instructions to start, then retry.","chat.error.turnChanged":"The active turn changed before this message was accepted. Review and retry it.","chat.error.title.submission":"Message not sent.","chat.error.title.execution":"Run stopped.","chat.error.title.navigation":"Task not opened.","chat.error.title.generic":"Action failed.","chat.error.action.returnDraft":"Return to draft","chat.error.action.editResend":"Edit and resend","chat.error.action.retryTask":"Retry task","chat.error.action.retryingTask":"Retrying…","chat.error.action.checkModels":"Check model settings","task.failure.authentication":"Provider authentication failed. Check model credentials.","task.failure.permission":"Provider rejected this request. Check account and model permissions.","task.failure.rateLimit":"Provider rate limit or quota exceeded.","task.failure.timeout":"Provider request timed out.","task.failure.network":"Provider connection failed.","task.failure.modelUnavailable":"The selected model is unavailable.","task.failure.contextLimit":"The request exceeded the model context limit.","task.failure.unsupportedInput":"The selected model does not support this input.","task.failure.workspaceUnavailable":"This Session workspace is no longer available.","task.failure.capacity":"Task admission capacity is full. Retry after running tasks complete.","task.failure.runtime":"Agent execution failed.","chat.connection.reconnecting":"Reconnecting live updates. The active run continues in the background.","chat.connection.offline":"Live updates are offline. Progress shown here may be stale.","chat.connection.retry":"Reconnect","chat.side.title":"Side conversation","chat.side.loading":"Answering side question...","chat.side.failed":"Side conversation failed.","chat.side.dismiss":"Dismiss side conversation","chat.footer.disclaimer":"Blade can make mistakes. Please check important information.","chat.input.placeholder.default":"Type @ for files, / for commands...","chat.input.placeholder.steering":"Add guidance to steer the active turn...","chat.input.steering.status":"Active turn is steerable","chat.input.steering.queued":"Guidance accepted · {count} pending","chat.input.steering.enterHint":" · Enter sends guidance","chat.input.followUp.queued":"Follow-up accepted · {count} queued for the next turn","chat.followUpQueue.title":"Follow-up queue","chat.followUpQueue.show":"Show follow-up queue","chat.followUpQueue.hide":"Hide follow-up queue","chat.followUpQueue.count":"{count} queued","chat.followUpQueue.lockedCount":"{count} locked","chat.followUpQueue.internal":"Internal runtime item","chat.followUpQueue.attachmentOnly":"Attachment-only follow-up","chat.followUpQueue.locked":"Locked","chat.followUpQueue.delivery.current_turn":"Current turn","chat.followUpQueue.delivery.next_turn":"Next turn","chat.followUpQueue.delivery.recovery":"Recovery","chat.followUpQueue.moveUp":"Move {id} up","chat.followUpQueue.moveDown":"Move {id} down","chat.followUpQueue.remove":"Remove follow-up {id}","chat.followUpQueue.refresh":"Refresh follow-up queue","chat.followUpQueue.stale":"Queue changed elsewhere. The latest order is shown; review it before retrying.","chat.input.steering.recoveredOne":"Recovered {count} queued instruction after restart","chat.input.steering.recoveredMany":"Recovered {count} queued instructions after restart","chat.input.attachment.add":"Attach images","chat.input.attachment.remove":"Remove","chat.input.attachment.countLimit":"You can attach up to {count} images.","chat.input.attachment.sizeLimit":"Images must stay under {size} total. Remove an image or choose smaller files.","chat.input.attachment.readFailed":"Blade could not read one of these images.","chat.input.attachment.usage":"{count}/{limit} images · {used} of {budget}","chat.input.attachment.modelUnsupported":"{model} does not support images. Choose a vision model or remove the images.","chat.input.attachment.modelRequired":"Choose a vision-capable model before attaching images.","chat.input.model.placeholder":"Select Model","chat.input.model.empty":"No models configured","chat.input.model.vision":"Vision","chat.input.model.change":"Change model","chat.input.model.locked":"Wait for the active turn to finish before switching models","chat.input.effort.label":"Effort {effort}","chat.input.effort.heading":"Reasoning effort","chat.input.effort.change":"Change reasoning effort","chat.input.effort.locked":"Wait for the active turn to finish before changing reasoning effort","chat.input.effort.option":"Use {effort} reasoning effort","chat.input.serviceTier.label":"Speed {tier}","chat.input.serviceTier.heading":"Provider service tier","chat.input.serviceTier.change":"Change provider service tier","chat.input.serviceTier.locked":"Wait for the current turn to finish before changing service tier","chat.input.serviceTier.option":"Use {tier} service tier","chat.input.serviceTier.fastHint":"priority","chat.input.serviceTier.flexHint":"lower cost","chat.input.responseVerbosity.label":"Output {verbosity}","chat.input.responseVerbosity.heading":"Response verbosity","chat.input.responseVerbosity.change":"Change response verbosity","chat.input.responseVerbosity.locked":"Wait for the current turn to finish before changing response verbosity","chat.input.responseVerbosity.option":"Use {verbosity} response verbosity","chat.input.responseVerbosity.autoHint":"model default","chat.input.outputSchema.title":"Structured output","chat.input.outputSchema.description":"Require this turn to finish with an object that matches the JSON Schema.","chat.input.outputSchema.change":"Set structured output schema","chat.input.outputSchema.locked":"Wait for the current turn to finish before changing the output schema","chat.input.outputSchema.editor":"JSON Schema editor","chat.input.outputSchema.placeholder":"Paste a JSON Schema object","chat.input.outputSchema.example":"Use example","chat.input.outputSchema.clear":"Clear","chat.input.outputSchema.invalid":"Enter a valid JSON object. The server validates the complete schema.","chat.input.outputSchema.shellUnsupported":"Structured output cannot be combined with a shell command.","chat.structuredOutput.title":"Structured output","chat.structuredOutput.copy":"Copy structured output","chat.input.communicationStyle.label":"Style {style}","chat.input.communicationStyle.heading":"Communication style","chat.input.communicationStyle.change":"Change communication style","chat.input.communicationStyle.locked":"Wait for the current turn to finish before changing communication style","chat.input.communicationStyle.option":"Use {style} communication style","chat.input.communicationStyle.autoHint":"Blade default","chat.input.communicationStyle.pragmaticHint":"direct","chat.input.communicationStyle.friendlyHint":"warm","chat.input.communicationStyle.explanatoryHint":"explain choices","chat.notice.dismiss":"Dismiss notice","chat.input.mode.default":"Manual approval","chat.input.mode.default.desc":"Every important action needs your approval","chat.input.mode.autoEdit":"Auto approval","chat.input.mode.autoEdit.desc":"Let the AI review and approve important actions","chat.input.mode.yolo":"Full access","chat.input.mode.yolo.desc":"Run directly on your machine without asking","chat.input.mode.yolo.confirm.title":"Enable full access mode?","chat.input.mode.yolo.confirm.desc":"In this mode the agent will execute all actions — including file writes, shell commands, and network requests — without asking for permission. Only enable this if you trust the current context.","chat.input.mode.yolo.confirm.cancel":"Cancel","chat.input.mode.yolo.confirm.accept":"Enable","chat.input.mode.plan":"Plan","chat.input.mode.plan.desc":"Draft a plan first without making changes","chat.input.mode.aria":"Agent action approval","chat.input.action.stop":"Stop active turn","chat.input.action.stopping":"Stopping active turn","chat.input.action.steer":"Steer active turn","chat.input.action.send":"Send message","chat.input.action.submitting":"Submitting message","chat.providerRecovery.admission":"Waiting for Provider capacity","chat.providerRecovery.admissionDetail":"Queue {position}/{depth} · {scope} · waiting {waitSeconds}s","chat.providerRecovery.admissionCompact":"Provider queue · {position}/{depth}","chat.providerRecovery.rateLimit":"Provider rate limited · retry in {seconds}s","chat.providerRecovery.retryWait":"Provider temporarily unavailable · retry in {seconds}s","chat.providerRecovery.retryAttempt":"Retrying Provider","chat.providerRecovery.retryDetail":"Attempt {attempt}/{maxRetries} · recovery budget {budgetSeconds}s","chat.providerRecovery.retryCompact":"Provider recovery · {seconds}s · {attempt}/{maxRetries}","chat.providerRecovery.circuit":"Provider isolated · waiting for recovery probe","chat.providerRecovery.rateLimitCircuit":"Provider rate limited · waiting for recovery probe","chat.providerRecovery.circuitDetail":"Probe in {seconds}s","chat.providerRecovery.circuitCompact":"Provider circuit · {seconds}s","chat.providerRecovery.rateLimitCircuitCompact":"Provider rate limited · {seconds}s","chat.providerRecovery.probe":"Probing Provider recovery","chat.providerRecovery.probeDetail":"One recovery probe is in progress","chat.providerRecovery.probeCompact":"Provider recovery probe","chat.providerRecovery.stall":"Provider has not returned stream data","chat.providerRecovery.stallAfterOutput":"Provider stream is temporarily paused","chat.providerRecovery.stallDetail":"Waiting {stallSeconds}s · timeout {timeoutSeconds}s","chat.providerRecovery.stallCompact":"Provider waiting · {stallSeconds}s","chat.providerRecovery.fallback":"Switching to {to}","chat.providerRecovery.fallbackDetail":"Candidate {candidate}/{candidateCount} · from {from}","chat.providerRecovery.fallbackCompact":"Provider switch · {to}","chat.providerRecovery.stop":"Stop","chat.turnActivity.starting":"Starting task","chat.turnActivity.thinking":"Thinking","chat.turnActivity.responding":"Writing response","chat.turnActivity.executingTools":"Running {count} tools","chat.turnActivity.compacting":"Compacting context","chat.turnActivity.continuing":"Advancing to the next step","chat.turnActivity.toolCount":"{completed}/{started} tools","chat.turnActivity.turn":"turn {turn}","chat.turnActivity.turnBounded":"turn {turn}/{maxTurns}","chat.memoryConsolidation.saved":"Saved {count} project memories","chat.review.title":"Code Review","chat.review.target":"Target","chat.review.target.uncommitted":"Uncommitted changes","chat.review.target.base":"Changes against {ref}","chat.review.target.commit":"Commit {ref}","chat.review.status":"Status","chat.review.status.completed":"Completed","chat.review.status.stale":"Stale","chat.review.status.failed":"Failed","chat.review.status.aborted":"Aborted","chat.review.status.interrupted":"Interrupted","chat.review.findings":"Findings","chat.review.noFindings":"No actionable findings","chat.review.confidence":"confidence {value}","chat.review.error":"Error","chat.subagent.resumedFromTitle":"Resumed from {id}","chat.subagent.resumedDepth":"resumed · depth {depth}","chat.subagent.loadingLogs":"Loading subagent logs...","chat.subagent.resumedAs":"Resumed as {id} · {status} · depth {depth}","chat.subagent.resume":"Resume","chat.subagent.resumeAria":"Resume subagent","chat.subagent.followUpAria":"Subagent follow-up","chat.subagent.followUpPlaceholder":"Describe the follow-up work","chat.subagent.cancel":"Cancel","chat.subagent.resumeAgent":"Resume agent","chat.subagent.resumeFailed":"Failed to resume subagent","chat.markdown.copyCode":"Copy code","chat.rewind.title":"Rewind session","chat.rewind.description":"Return to the point before a user message.","chat.rewind.loading":"Loading checkpoints","chat.rewind.empty":"Nothing to rewind to yet","chat.rewind.checkpointAria":"Rewind checkpoint","chat.rewind.userMessage":"User message","chat.rewind.fileCountOne":"{count} file","chat.rewind.fileCountMany":"{count} files","chat.rewind.restoreCode":"Restore code changes","chat.rewind.restoreCodeHint":"Revert files changed at and after this checkpoint.","chat.rewind.cancel":"Cancel","chat.rewind.confirm":"Rewind","chat.rewind.loadFailed":"Failed to load rewind checkpoints","chat.rewind.failed":"Rewind failed. Review the session error and try again.","status.context":"Context","status.tokenLimitTooltip":"Token limit is estimated. It updates when the model reports its context size.","status.cache":"Cache","status.cacheTooltip":"Cached input divided by total model input for this session.","status.cacheDetails":"Read {read} · Written {write} · Uncached {uncached}","status.cacheUnavailable":"The Provider has not reported prompt-cache usage for this session.","status.cacheBreak":"Last cache break: {reason} · cache read {previous} → {current}","status.cacheBreak.model":"model changed","status.cacheBreak.system":"system prompt changed","status.cacheBreak.tools":"tool definitions changed","status.cacheBreak.policy":"request policy changed","status.cacheBreak.ttl":"cache TTL expired","status.cacheBreak.server":"likely Provider routing or eviction","status.phase.running":"Generating...","status.phase.providerStall":"Provider stream paused","status.phase.actionStationarityRecovering":"Recovering","status.phase.actionStationarityStopped":"Stopped","status.phase.compacting":"Compacting context...","status.phase.recoveringContext":"Recovering context limit...","status.phase.switchingModel":"Switching model...","status.phase.waitingPermission":"Waiting for permission...","status.phase.error":"Run failed","status.recovery.review":"Recovery needs review","status.recovery.interruptedTool":"Interrupted tool state is uncertain","status.recovery.successfulTool":"A tool may already have changed state","preview.title":"Preview","preview.action.resize":"Resize preview","preview.action.close":"Close preview","preview.action.retry":"Retry","preview.tab.diff":"Diff","preview.tab.files":"Files","preview.tab.logs":"Logs","preview.tab.browser":"Browser","preview.diff.loadingTitle":"Loading task diff…","preview.diff.loadingHint":"Reading the durable worktree artifact.","preview.diff.failedTitle":"Failed to load task diff","preview.diff.discardedTitle":"Changes discarded","preview.diff.discardedHint":"The isolated workspace was removed. The source project was not changed.","preview.diff.emptyTitle":"No patch yet","preview.diff.emptyHint":"Run a tool that changes files to see diffs here.","preview.diff.searchAria":"Search changed files","preview.diff.searchPlaceholder":"Filter changed files…","preview.diff.changedFiles":"{count} changed files","preview.diff.expandAll":"Expand all","preview.diff.collapseAll":"Collapse all","preview.diff.showMoreFiles":"Show {count} more files","preview.diff.showMoreLines":"Show {count} more lines","preview.diff.noMatches":"No matching changed files","preview.diff.patch":"Patch","preview.diff.line":"Line {line}","preview.files.loadingTitle":"Loading files…","preview.files.loadingHint":"Fetching workspace tree.","preview.files.failedTitle":"Failed to load files","preview.files.emptyTitle":"No files yet","preview.files.emptyHint":"Select a project to load its workspace tree.","preview.files.treeFailed":"Failed to load workspace tree","preview.files.searchAria":"Search workspace files","preview.files.searchPlaceholder":"Find a file…","preview.files.searchResultsAria":"File search results","preview.files.searchFailed":"Failed to search workspace files","preview.files.noMatches":"No matching files","preview.files.directoryLoading":"Loading folder…","preview.files.directoryEmpty":"Empty folder","preview.files.selectTitle":"Select a file to preview","preview.files.status.loading":"Loading…","preview.files.status.truncated":"Truncated","preview.files.status.ready":"Ready","preview.files.truncatedNotice":"Preview truncated to 200k characters.","preview.files.pickHint":"Pick a file from the tree to preview.","preview.files.contentFailed":"Failed to load file","preview.files.editorLoading":"Loading editor…","preview.logs.searchAria":"Search tool logs","preview.logs.searchPlaceholder":"Search tool, summary, or output…","preview.logs.filterAria":"Filter logs by status","preview.logs.filter.all":"All","preview.logs.filter.running":"Running","preview.logs.filter.error":"Failed","preview.logs.filter.success":"Success","preview.logs.noMatches":"No matching logs","preview.logs.noMatchesHint":"Try another phrase or status.","preview.logs.emptyTitle":"No logs yet","preview.logs.emptyHint":"Tool runs will appear here.","preview.logs.expand":"Expand","preview.logs.collapse":"Collapse","preview.logs.showMore":"Show {count} more logs","preview.logs.status.running":"Running","preview.logs.status.error":"Failed","preview.logs.status.success":"Success","goal.aria.section":"Goal controls","goal.status.active":"Goal running","goal.status.paused":"Goal paused","goal.status.blocked":"Goal blocked","goal.status.usageLimited":"Usage limited","goal.status.budgetLimited":"Budget reached","goal.status.complete":"Goal complete","goal.field.objective":"Goal objective","goal.action.edit":"Edit goal","goal.action.pause":"Pause goal","goal.action.resume":"Resume goal","goal.action.delete":"Delete goal","goal.action.expand":"Expand goal details","goal.action.collapse":"Collapse goal details","goal.action.cancel":"Cancel","goal.action.save":"Save","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"{n} continuation","goal.metrics.continuationMany":"{n} continuations","goal.lineage.origin":"Origin","goal.lineage.current":"Current","goal.lineage.parent":"Parent","goal.executionHostFailure.title":"Execution host recovery","goal.executionHostFailure.category.timeout":"Timeout","goal.executionHostFailure.category.admission":"Admission","goal.executionHostFailure.category.spawn":"Spawn","goal.executionHostFailure.category.finalization":"Finalization","goal.executionHostFailure.category.sandbox_start":"Sandbox startup","goal.executionHostFailure.category.terminal":"Terminal","goal.dialog.title":"Delete this goal?","goal.dialog.description":"The goal state will be removed. Session history and workspace files are not affected.","settings.title":"Settings","settings.nav.aria":"Settings sections","settings.action.back":"Back","settings.category.settings":"Settings","settings.category.integrations":"Integrations","settings.tab.general":"General","settings.tab.trust":"Security","settings.tab.models":"Models","settings.tab.shortcuts":"Shortcuts","settings.tab.mcp":"MCP","settings.tab.skills":"Skills","settings.tab.plugins":"Plugins","settings.tab.hooks":"Hooks","settings.tab.schedules":"Scheduled Tasks","settings.common.retry":"Retry","settings.common.dismiss":"Dismiss","settings.common.cancel":"Cancel","settings.common.enable":"Enable","settings.general.loading":"Loading settings...","settings.general.loadError":"Failed to load settings","settings.general.saveError":"Failed to save settings","settings.general.responseLanguage":"Response Language","settings.general.responseLanguageHint":"AI will respond in this language","settings.general.autoSave":"Auto-save sessions","settings.general.communicationStyle":"Communication Style","settings.general.communicationStyleHint":"How the agent phrases its replies across every session","settings.appearance.heading":"Appearance","settings.appearance.theme":"Theme Preference","settings.appearance.theme.dark":"Dark","settings.appearance.theme.light":"Light","settings.appearance.theme.system":"System","settings.appearance.compactSidebar":"Compact sidebar","settings.appearance.codeTheme":"Code theme","settings.appearance.codeThemeHint":"Syntax highlighting colors","settings.notifications.heading":"Notifications","settings.notifications.buildFinished":"Build finished","settings.notifications.errorsOnly":"Errors only","settings.notifications.systemSounds":"System sounds","settings.notifications.blocked":"Browser notifications are blocked","settings.notifications.unavailable":"Browser notifications are unavailable","settings.notifications.enablePrompt":"Enable alerts while this tab is in the background","settings.privacy.heading":"Privacy","settings.privacy.telemetry":"Telemetry","settings.privacy.crash":"Crash reports","settings.models.description":"Configure API keys and model settings for different providers.","settings.models.loading":"Loading models...","settings.models.loadChannelsFailed":"Failed to load provider channels","settings.models.saveFailed":"Failed to save model","settings.models.deleteFailed":"Failed to delete model","settings.models.updateFailed":"Failed to update model","settings.models.updateChannelFailed":"Failed to update provider channel","settings.models.probeFailed":"Provider probe failed","settings.models.deleteChannelFailed":"Failed to delete provider channel","settings.models.empty":"No models configured yet","settings.models.add":"+ Add New Model","settings.models.missingCredential":"Missing credential","settings.models.configured":"Configured","settings.models.deleting":"Deleting...","settings.models.deleteModel":"Delete model","settings.models.deleteChannel":"Delete channel","settings.models.deleteModelAria":"Delete {name}","settings.models.deleteModelPrompt":"Delete {name} and its saved configuration?","settings.models.deleteChannelAria":"Delete channel {name}","settings.models.deleteChannelPrompt":"Delete channel {name}, its credential, and {count} configured model(s)? Fallback references will also be removed.","settings.models.editModelAria":"Edit {name}","settings.models.editChannelAria":"Edit channel {name}","settings.models.testChannelAria":"Test {name}","settings.models.deleteChannelActionAria":"Delete channel {name}","settings.models.modelCountOne":"{count} model","settings.models.modelCountMany":"{count} models","settings.models.defaultEndpoint":"default endpoint","settings.shortcuts.searchPlaceholder":"Search actions...","settings.shortcuts.scope.all":"All scopes","settings.shortcuts.scope.global":"Global","settings.shortcuts.scope.chat":"Chat","settings.shortcuts.scope.layout":"Layout","settings.shortcuts.reset":"Reset","settings.shortcuts.col.action":"Action","settings.shortcuts.col.shortcut":"Shortcut","settings.shortcuts.col.scope":"Scope","settings.shortcuts.empty":"No shortcuts found.","settings.shortcuts.action.searchTasks":"Search tasks","settings.shortcuts.action.openCommands":"Open command center","settings.shortcuts.action.newTask":"New task","settings.shortcuts.action.focusComposer":"Focus composer","settings.shortcuts.action.toggleSidebar":"Toggle sidebar","settings.common.reload":"Reload","settings.trust.state.notRequired":"No trust required","settings.trust.state.trusted":"Workspace trusted","settings.trust.state.review":"Review required","settings.trust.state.error":"Trust store error","settings.trust.selectSession":"Select a project session to review folder trust.","settings.trust.heading":"Workspace trust","settings.trust.inheritedFrom":" · inherited from {source}","settings.trust.reloadAria":"Reload workspace trust","settings.trust.revoke":"Revoke","settings.trust.trustWorkspace":"Trust workspace","settings.trust.restartNotice":"Restart Blade to reload project models, MCP, LSP, permissions, and plugins.","settings.trust.revokeAria":"Revoke workspace trust","settings.trust.confirmTrust":"Allow {count} project source(s) to configure models, MCP, LSP, permissions, environment, instructions, commands, skills, agents, or plugins?","settings.trust.confirmRevoke":"Block project-controlled executable configuration after restart?","settings.trust.saving":"Saving...","settings.trust.trustReviewed":"Trust reviewed workspace","settings.trust.revokeTrust":"Revoke trust","settings.trust.empty":"No project-controlled executable configuration was found.","settings.trust.loadFailed":"Failed to load workspace trust","settings.trust.updateFailed":"Failed to update workspace trust","settings.hooks.state.disabled":"Hooks disabled","settings.hooks.state.notRequired":"No external hooks","settings.hooks.state.review":"Review required","settings.hooks.state.trusted":"Trusted","settings.hooks.state.modified":"Changed since approval","settings.hooks.state.error":"Trust store error","settings.hooks.selectSession":"Select a project session to review its hooks.","settings.hooks.heading":"Hook trust","settings.hooks.reloadAria":"Reload hook trust","settings.hooks.revoke":"Revoke","settings.hooks.trustDigest":"Trust digest","settings.hooks.currentSession":"Current session execution","settings.hooks.session.open":"Open a session to control its hooks.","settings.hooks.session.loading":"Loading session state...","settings.hooks.session.disabled":"Disabled by workspace configuration.","settings.hooks.session.paused":"Paused only for this session.","settings.hooks.session.active":"Hooks may run for this session after trust checks.","settings.hooks.session.unavailable":"Disabled by this session runtime or host policy.","settings.hooks.session.enableAria":"Enable hooks for current session","settings.hooks.session.pauseAria":"Pause hooks for current session","settings.hooks.session.unavailableAria":"Hooks unavailable for current session","settings.hooks.confirmTrustAria":"Trust project hooks","settings.hooks.confirmRevokeAria":"Revoke project hook trust","settings.hooks.confirmTrust":"Run these {count} hooks with your user permissions until their configuration changes?","settings.hooks.confirmRevoke":"Stop all configured hooks for this project until explicitly trusted again?","settings.hooks.saving":"Saving...","settings.hooks.trustReviewed":"Trust reviewed hooks","settings.hooks.revokeTrust":"Revoke trust","settings.hooks.empty":"No configured command, HTTP, or prompt hooks.","settings.hooks.loadFailed":"Failed to load hook trust","settings.hooks.updateFailed":"Failed to update hook trust","settings.hooks.sessionUpdateFailed":"Failed to update session hooks","settings.plugins.selectProject":"Select a project to manage its plugins.","settings.plugins.heading":"Workspace plugins","settings.plugins.changesNote":"Changes apply to future session snapshots and persist in the selected scope.","settings.plugins.reloadAria":"Reload plugins","settings.plugins.sourcePolicy":"Source policy","settings.plugins.savePolicyAria":"Save plugin source policy","settings.plugins.saving":"Saving…","settings.plugins.saveForProject":"Save for project","settings.plugins.restrictAria":"Restrict plugin sources","settings.plugins.restrictAllowlists":"Restrict to allowlists","settings.plugins.requireShaAria":"Require full Git commit SHA","settings.plugins.requireSha":"Require full Git SHA","settings.plugins.environmentLocked":" · environment locked","settings.plugins.gitHostsAria":"Allowed plugin Git hosts","settings.plugins.marketplacesAria":"Allowed plugin Marketplaces","settings.plugins.localRootsAria":"Allowed local plugin roots","settings.plugins.emptyAllowlists":"Empty allowlists deny every plugin source.","settings.plugins.installHeading":"Install trusted plugin","settings.plugins.sourceAria":"Plugin source","settings.plugins.install":"Install","settings.plugins.trustSource":"I trust this source to activate Hooks, MCP servers, skills, and commands.","settings.plugins.activationScope":"Activation write scope","settings.plugins.activationScopeHint":"Higher-priority layers continue to determine the effective state.","settings.plugins.scopeAria":"Plugin activation scope","settings.plugins.scope.local":"Local","settings.plugins.scope.project":"Project","settings.plugins.scope.global":"Global","settings.plugins.scope.localDesc":"Only this checkout","settings.plugins.scope.projectDesc":"Shared project settings","settings.plugins.scope.globalDesc":"All projects","settings.plugins.scope.invocation":"Invocation","settings.plugins.scope.default":"Default","settings.plugins.layer.on":"on","settings.plugins.layer.off":"off","settings.plugins.capability.commands":"{count} commands","settings.plugins.capability.skills":"{count} skills","settings.plugins.capability.agents":"{count} agents","settings.plugins.capability.hooks":"{count} hooks","settings.plugins.capability.mcp":"{count} MCP","settings.plugins.noResources":"No declared resources","settings.plugins.effective":"effective: {scope}","settings.plugins.managed":"managed","settings.plugins.invocationScoped":"Invocation-scoped via --plugin-dir","settings.plugins.enableAria":"Enable {name}","settings.plugins.disableAria":"Disable {name}","settings.plugins.unavailableAria":"Unavailable {name}","settings.plugins.updateAria":"Update {name}","settings.plugins.uninstallAria":"Uninstall {name}","settings.plugins.confirmUpdate":"Confirm update","settings.plugins.update":"Update","settings.plugins.confirmRemove":"Confirm remove","settings.plugins.empty":"No plugins discovered for this project.","settings.plugins.marketplaces":"Marketplaces","settings.plugins.configuredCount":"{count} configured","settings.plugins.marketplaceSourceAria":"Marketplace source","settings.plugins.addMarketplaceAria":"Add marketplace","settings.plugins.add":"Add","settings.plugins.noDescription":"No description","settings.plugins.refreshMarketplaceAria":"Refresh marketplace {name}","settings.plugins.removeMarketplaceAria":"Remove marketplace {name}","settings.plugins.confirm":"Confirm","settings.plugins.installedSuffix":" · installed","settings.plugins.marketplaceEmpty":"Add a Marketplace to discover installable plugins.","settings.plugins.loadFailed":"Failed to load plugins","settings.plugins.actionFailed":"Plugin action failed","settings.plugins.updateFailed":"Failed to update plugin","settings.models.addModal.title":"Add Model","settings.models.addModal.close":"Close add model","settings.models.addModal.loadProvidersError":"Failed to load providers","settings.models.addModal.loadModelsError":"Failed to load models","settings.models.addModal.provider":"Provider","settings.models.addModal.loadingProviders":"Loading providers...","settings.models.addModal.selectProvider":"Select provider","settings.models.addModal.configuredSuffix":" - configured","settings.models.addModal.customOpenAI":"Custom OpenAI Endpoint","settings.models.addModal.customAnthropic":"Custom Anthropic Endpoint","settings.models.addModal.channelId":"Channel ID","settings.models.addModal.channelIdHint":"Stable config and credential identifier.","settings.models.addModal.channelName":"Channel name","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"Uses the Anthropic Messages protocol.","settings.models.addModal.openaiProtocol":"Uses the OpenAI Chat Completions protocol.","settings.models.addModal.modelId":"Model ID","settings.models.addModal.model":"Model","settings.models.addModal.loadingModels":"Loading models...","settings.models.addModal.selectModel":"Select model","settings.models.addModal.reasoningSuffix":" - reasoning","settings.models.addModal.visionSuffix":" - vision","settings.models.addModal.displayName":"Display name","settings.models.addModal.displayNamePlaceholder":"Optional alias","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API key","settings.models.addModal.apiKeyPlaceholder":"Stored separately in auth.json","settings.models.addModal.showApiKey":"Show API key","settings.models.addModal.hideApiKey":"Hide API key","settings.models.addModal.oauthNote":"This provider requires OAuth or ambient credentials. Configure it externally before selecting the model.","settings.models.addModal.saveModel":"Save Model","settings.models.addModal.saving":"Saving...","settings.models.addModal.channelIdError":'Channel ID must start with a lowercase letter and contain only lowercase letters, numbers, ".", "_" or "-"',"settings.models.addModal.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editModal.srTitle":"Edit Model","settings.models.editModal.title":"Edit Model Overrides","settings.models.editModal.close":"Close edit model","settings.models.editModal.displayName":"Display name","settings.models.editModal.replaceApiKey":"Replace provider API key","settings.models.editModal.replaceApiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editModal.baseUrlOverride":"Base URL override","settings.models.editModal.baseUrlPlaceholder":"Leave empty to use default endpoint","settings.models.editModal.streamIdleTimeout":"Stream idle timeout (ms)","settings.models.editModal.save":"Save","settings.models.editModal.saving":"Saving...","settings.models.editModal.streamIdleTimeoutError":"Stream idle timeout must be at least 1000ms","settings.models.editModal.credentialError":"Failed to update provider credential","settings.models.editProvider.title":"Edit Provider Channel","settings.models.editProvider.close":"Close edit provider","settings.models.editProvider.channelName":"Channel name","settings.models.editProvider.channelNameRequired":"Channel name is required","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"Provider Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editProvider.apiKeyEnv":"API key environment variable","settings.models.editProvider.apiKeyEnvPlaceholder":"Optional, for example TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"Replace API key","settings.models.editProvider.apiKeyAria":"Provider API key","settings.models.editProvider.apiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editProvider.save":"Save channel","settings.models.editProvider.saving":"Saving...","settings.style.auto":"Auto","settings.style.pragmatic":"Pragmatic","settings.style.friendly":"Friendly","settings.style.explanatory":"Explanatory","mcp.status.connected":"Connected","mcp.status.connecting":"Connecting...","mcp.status.reconnecting":"Recovering...","mcp.status.offline":"Offline","mcp.status.error":"Error","mcp.status.recoveringAttempt":"Recovering {attempt}/{max}","mcp.oauth.status.disabled":"Not configured","mcp.oauth.status.unavailable":"Unavailable in this runtime","mcp.oauth.status.unauthenticated":"Authorization required","mcp.oauth.status.authorizing":"Waiting for authorization...","mcp.oauth.status.authenticated":"Authorized","mcp.oauth.status.error":"Authorization failed","mcp.catalog.tag.official":"Official","mcp.catalog.tag.popular":"Popular","mcp.catalog.tag.community":"Community","mcp.action.refreshServers":"Refresh MCP servers","mcp.action.addServer":"Add server","mcp.action.close":"Close MCP","mcp.action.dismiss":"Dismiss","mcp.action.retry":"Retry","mcp.action.disconnect":"Disconnect","mcp.action.disconnecting":"Disconnecting...","mcp.action.stopRecovery":"Stop recovery","mcp.action.connect":"Connect","mcp.action.connecting":"Connecting...","mcp.action.authorizeFirst":"Authorize first","mcp.action.delete":"Delete","mcp.action.cancel":"Cancel","mcp.action.deleting":"Deleting...","mcp.action.deleteServer":"Delete server","mcp.tab.installed":"Installed ({count})","mcp.tab.catalog":"Catalog","mcp.servers.title":"Servers","mcp.servers.searchAria":"Search installed MCP servers","mcp.servers.searchPlaceholder":"Search servers...","mcp.servers.loading":"Loading servers...","mcp.servers.noMatch":"No servers match your search","mcp.servers.none":"No MCP servers configured","mcp.server.errorLabel":"Error: {error}","mcp.server.deleteAria":"Delete {name}","mcp.server.selectPrompt":"Select a server to view details","mcp.instructions.title":"Server instructions","mcp.instructions.detailsOmittedByPolicy":"[details omitted by runtime policy]","mcp.instructions.detailsOmitted":"Details omitted","mcp.instructions.truncated":"Truncated to the safe display budget","mcp.tasks.title":"Experimental MCP Tasks","mcp.tasks.summary":"{count} per Session · {interval}ms poll","mcp.tasks.disabledByDefault":"Disabled by default","mcp.tasks.enabled":"Enabled","mcp.tasks.disabled":"Disabled","mcp.oauth.signingOut":"Signing out...","mcp.oauth.signOut":"Sign out","mcp.oauth.continueAuthorization":"Continue authorization","mcp.oauth.resumeAuthorization":"Resume authorization","mcp.oauth.opening":"Opening...","mcp.oauth.authorize":"Authorize","mcp.delete.confirm":"Remove this server and its saved configuration?","mcp.tools.title":"Tools ({count})","mcp.tools.none":"No tools available","mcp.completion.title":"Argument completion","mcp.completion.connectPrompt":"Connect the server to request suggestions","mcp.completion.unsupported":"Server does not advertise MCP completions","mcp.completion.noTargets":"No completable prompt arguments or template variables","mcp.completion.targetAria":"MCP completion target","mcp.completion.partialAria":"MCP completion partial value","mcp.completion.partialPlaceholder":"Partial value","mcp.completion.completing":"Completing...","mcp.completion.complete":"Complete","mcp.completion.suggestionsAria":"MCP completion suggestions","mcp.completion.empty":"[empty]","mcp.completion.noSuggestions":"No suggestions","mcp.meta.truncatedSuffix":" · truncated","mcp.meta.detailsOmittedSuffix":" · details omitted","mcp.diagnostics.title":"Diagnostics","mcp.diagnostics.refreshAria":"Refresh {name} MCP logs","mcp.diagnostics.logsAria":"{name} MCP logs","mcp.log.levelAria":"MCP logging level","mcp.log.setting":"Setting...","mcp.log.loading":"Loading logs...","mcp.log.none":"No logs captured","mcp.catalog.searchAria":"Search MCP server catalog","mcp.catalog.searchPlaceholder":"Search MCP servers on npm (min 3 chars)...","mcp.catalog.retry":"Retry catalog","mcp.catalog.noDescription":"No description","mcp.catalog.byAuthor":"by {author}","mcp.catalog.installed":"Installed","mcp.catalog.installing":"Installing...","mcp.catalog.install":"Install","mcp.catalog.noPackages":"No packages found","mcp.catalog.noMore":"No more packages","mcp.catalog.packagesFound":"{count} packages found","mcp.catalog.browseGlama":"Browse more on Glama","mcp.error.connectFailed":"Failed to connect server","mcp.error.disconnectFailed":"Failed to disconnect server","mcp.error.deleteFailed":"Failed to delete server","mcp.error.loginFailed":"Failed to login MCP OAuth","mcp.error.logoutFailed":"Failed to logout MCP OAuth","mcp.error.loggingLevelFailed":"Failed to set MCP logging level","mcp.error.completionFailed":"MCP completion failed","mcp.add.title":"Add MCP Server","mcp.add.closeAria":"Close add MCP server","mcp.add.modeForm":"Form","mcp.add.jsonConfig":"JSON config","mcp.add.jsonConfigAria":"JSON configuration","mcp.add.serverName":"Server name","mcp.add.command":"Command","mcp.add.commandAria":"Server command","mcp.add.argsLabel":"Arguments (space separated)","mcp.add.argsAria":"Server arguments","mcp.add.invalidJson":"Enter valid JSON with a server name and transport.","mcp.add.nameCommandRequired":"Name and command are required.","mcp.add.adding":"Adding...","mcp.add.submit":"Add Server","mcp.install.title":"Install MCP Server","mcp.install.titleWithName":"Install {name}","mcp.install.closeAria":"Close MCP installation","mcp.install.args":"Arguments","mcp.install.commandPreview":"Command: npx {args}","mcp.install.nameRequired":"Server name is required.","skills.title":"Skills","skills.action.install":"Install skill","skills.action.installShort":"Install","skills.action.refreshAria":"Refresh skills","skills.action.closeAria":"Close skills","skills.action.dismiss":"Dismiss","skills.action.retry":"Retry","skills.action.cancel":"Cancel","skills.action.close":"Close","skills.action.hide":"Hide","skills.action.enable":"Enable","skills.action.disable":"Disable","skills.action.saving":"Saving...","skills.status.enabled":"Enabled","skills.status.disabled":"Disabled","skills.status.installed":"Installed","skills.noDescriptionShort":"No description","skills.noDescription":"No description available","skills.installed.title":"Installed","skills.installed.searchAria":"Search installed skills","skills.installed.searchPlaceholder":"Search skills...","skills.installed.loading":"Loading skills...","skills.installed.noMatch":"No skills match your search","skills.installed.empty":"No skills installed","skills.uninstall.managedHint":"Only Blade user skills can be uninstalled","skills.uninstall.managed":"Managed","skills.uninstall.action":"Uninstall","skills.uninstall.confirmAria":"Uninstall {name}","skills.uninstall.confirmPrompt":"Remove this skill from ~/.blade/skills?","skills.uninstall.inProgress":"Uninstalling...","skills.uninstall.confirm":"Uninstall skill","skills.details.title":"Details","skills.details.provider":"Provider","skills.details.location":"Location","skills.details.capabilities":"Capabilities","skills.details.allowedTools":"Allowed Tools ({count})","skills.detail.emptyState":"Select a skill to view details","skills.install.title":"Install Skill","skills.install.closeAria":"Close skill installation","skills.install.tab.catalog":"Catalog","skills.install.tab.repo":"Repo","skills.install.tab.local":"Local","skills.install.catalog.searchAria":"Search skill catalog","skills.install.catalog.searchPlaceholder":"Search catalog...","skills.install.catalog.loading":"Loading catalog...","skills.install.catalog.empty":"No skills found","skills.install.catalog.byAuthor":"by {author}","skills.install.catalog.tag.official":"Official","skills.install.catalog.tag.popular":"Popular","skills.install.catalog.tag.community":"Community","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"Skill repository URL","skills.install.repo.credentialsHint":"Uses Git credentials available to the Blade process","skills.install.local.label":"Local path","skills.install.local.inputAria":"Local skill path","skills.status.dialogTitle":"Install Status","skills.status.confirm.title":"Confirm Install","skills.status.confirm.prompt":"Install selected skill?","skills.status.installing.title":"Installing","skills.status.installing.description":"Downloading and verifying…","skills.status.failed.title":"Install Failed","skills.status.failed.fallback":"Installation failed.","skills.status.failed.hint":"Check access and try again.","skills.error.deleteFailed":"Failed to delete skill","skills.error.toggleFailed":"Failed to toggle skill","skills.error.installFailed":"Failed to install skill","schedule.title":"Scheduled Tasks","schedule.description":"Run headless task prompts automatically on a cron, interval, or one-time trigger.","schedule.new":"New schedule","schedule.newAria":"Create a new schedule","schedule.refresh":"Refresh","schedule.reloadAria":"Reload schedules","schedule.create":"Create","schedule.save":"Save","schedule.cancel":"Cancel","schedule.confirmDelete":"Confirm?","schedule.empty":"No schedules yet","schedule.enabled":"Enabled","schedule.disabled":"Disabled","schedule.never":"never","schedule.nextRun":"Next run","schedule.lastRun":"Last run","schedule.runCount":"{count} runs","schedule.trigger.kindAria":"Trigger type","schedule.trigger.cron":"Cron","schedule.trigger.interval":"Interval","schedule.trigger.once":"Once","schedule.field.title":"Title (optional)","schedule.field.cron":"Cron expression","schedule.field.interval":"Interval","schedule.field.runAt":"Run at","schedule.field.prompt":"Prompt","schedule.field.project":"Project path","schedule.field.model":"Model (optional)","schedule.field.permissionMode":"Permission mode","schedule.field.isolation":"Isolation","schedule.placeholder.title":"Nightly dependency audit","schedule.placeholder.cron":"0 9 * * 1 (min hour dom mon dow)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"Describe the task to run…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"e.g. anthropic/claude-sonnet","schedule.model.current":"Use current model","schedule.permission.default":"Default","schedule.permission.autoEdit":"Auto edit","schedule.permission.yolo":"Yolo","schedule.permission.plan":"Plan","schedule.isolation.local":"Local","schedule.isolation.worktree":"Worktree","schedule.cadence.cron":"cron: {expr}","schedule.cadence.interval":"every {interval}","schedule.cadence.once":"once at {time}","schedule.status.queued":"queued","schedule.status.running":"running","schedule.status.completed":"completed","schedule.status.failed":"failed","schedule.status.cancelled":"cancelled","schedule.status.interrupted":"interrupted","schedule.status.error":"error","schedule.status.never":"no runs yet","schedule.runNowAria":'Run "{title}" now',"schedule.editAria":'Edit "{title}"',"schedule.deleteAria":'Delete "{title}"',"schedule.enableAria":'Enable "{title}"',"schedule.disableAria":'Disable "{title}"',"schedule.error.promptRequired":"A prompt is required.","schedule.error.projectRequired":"A project path is required.","schedule.error.cronRequired":"A cron expression is required.","schedule.error.invalidInterval":"Enter an interval like 30m, 2h, or 1d.","schedule.error.runAtRequired":"Pick a valid run time.","schedule.error.loadFailed":"Failed to load scheduled tasks.","schedule.error.createFailed":"Failed to create scheduled task.","schedule.error.updateFailed":"Failed to update scheduled task.","schedule.error.deleteFailed":"Failed to delete scheduled task.","schedule.error.toggleFailed":"Failed to change scheduled task status.","schedule.error.runFailed":"Failed to run scheduled task."},bi={"app.restoring":"正在恢复工作区…","layout.workspace.pathAria":"工作区路径","layout.workspace.empty":"未选择工作区","layout.action.rewind":"回溯会话","layout.action.openNavigation":"打开导航","layout.action.previewRestore":"还原预览","layout.action.previewMaximize":"最大化预览","terminal.title":"终端","terminal.status.connected":"终端已连接","terminal.status.disconnected":"终端未连接","terminal.action.minimize":"最小化终端","terminal.action.restore":"恢复终端","terminal.action.close":"关闭终端","history.surface.aria":"会话历史查看器","history.banner.aria":"历史状态栏","history.badge.remote":"远端","history.badge.historyOnly":"仅历史","history.connection.local":"本地","history.connection.online":"在线","history.connection.offline":"离线","history.location.label":"规范位置","history.unavailable.prompt":"若要继续,请从所属 ACP 打开此会话。仅历史模式下不能发送提示词。","history.unavailable.files":"仅历史模式下不能访问文件","history.unavailable.terminal":"仅历史模式下不能使用终端","history.loading":"正在加载会话历史…","history.recovery.cursor":"历史游标失效,已刷新为最新快照。","history.recovery.snapshot":"历史快照已变化,已刷新为最新内容。","history.bounded":"当前仅显示有界历史窗口。","history.action.loadOlder":"加载更早消息","history.action.loadingOlder":"正在加载更早消息…","history.action.fork":"派生历史分支","history.action.forking":"正在派生历史分支…","history.action.close":"关闭历史","history.action.copy":"复制消息 {id}","history.search.aria":"搜索已加载消息","history.search.placeholder":"搜索已加载消息","history.search.scope":"搜索范围仅限当前已加载的消息。","history.search.empty":"已加载消息中没有匹配项。","history.messages.empty":"尚未加载历史消息。","history.error.unavailable":"此 Session 历史记录不可用。","history.error.invalid":"此 Session 历史响应无效。","history.error.generic":"无法加载 Session 历史记录。","history.role.user":"用户","history.role.assistant":"助手","sidebar.project.remoteSessions":"远程会话","sidebar.brand.badge":"网页版","sidebar.action.collapse":"收起侧边栏","sidebar.action.expand":"展开侧边栏","sidebar.navigationAria":"任务导航","sidebar.action.newTask":"新建任务","sidebar.action.newTaskShort":"新建任务","sidebar.action.taskBoard":"任务看板","sidebar.action.terminal":"终端","sidebar.action.terminalToggle":"切换终端","sidebar.action.searchTasks":"搜索任务","sidebar.unreadTasks":"{count} 个未读任务","sidebar.section.skills":"技能","sidebar.section.mcp":"MCP","sidebar.section.settings":"设置","sidebar.status.user":"用户","sidebar.status.feedLive":"任务通道已连接","sidebar.status.feedOffline":"任务通道未连接","sidebar.empty.title":"暂无任务","sidebar.empty.hint":"在主页派发新任务","sidebar.group.running":"进行中","sidebar.group.queued":"排队中","sidebar.group.interrupted":"已暂停","sidebar.group.failed":"已失败","sidebar.group.cancelled":"已取消","sidebar.group.done":"已完成","sidebar.group.showMore":"再显示 {count} 条","sidebar.group.showLess":"收起","sidebar.view.project":"项目","sidebar.view.status":"状态","sidebar.view.projectAria":"按项目分组会话","sidebar.view.statusAria":"按状态分组会话","sidebar.project.active":"当前","sidebar.project.expand":"展开 {name}","sidebar.project.collapse":"收起 {name}","sidebar.project.newTask":"在 {name} 中新建任务","sidebar.project.reorder":"调整 {name} 的顺序,当前位置 {position}/{count}","sidebar.project.reorderHint":"拖拽调整顺序,或使用上下方向键移动","sidebar.project.reordered":"已将 {name} 移到第 {position} 位","sidebar.project.projects":"项目","sidebar.catalog.syncing":"正在同步任务历史…","sidebar.catalog.loaded":"已载入 {count} 条","sidebar.catalog.incomplete":"任务历史未完整加载","sidebar.catalog.retry":"重试","projects.dialog.title":"项目","projects.dialog.description":"绑定本地目录,无需重启 Blade 即可切换任务上下文。","projects.bind.placeholder":"/项目的绝对路径","projects.bind.pathLabel":"项目路径","projects.bind.action":"绑定","projects.bind.failed":"项目绑定失败","projects.pick.action":"选择项目文件夹","projects.pick.actionShort":"选择","projects.pick.picking":"选择中…","projects.pick.failed":"无法选择项目文件夹","projects.unbind.action":"解除项目绑定","projects.unavailable":"目录不可用","sidebar.language.label":"语言","sidebar.language.aria":"切换语言","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"独立分支","session.env.local":"本地","session.action.select":"选择「{title}」","session.action.save":"保存「{title}」","session.action.cancel":"取消「{title}」","session.action.more":"「{title}」的更多操作","session.action.fork":"派生「{title}」","session.action.forkShort":"派生","session.action.rename":"重命名「{title}」","session.action.renameShort":"重命名","session.action.archive":"归档「{title}」","session.action.archiveShort":"归档","session.action.export":"将「{title}」导出为 Markdown","session.action.exportShort":"导出 Markdown","session.action.exportingShort":"正在导出…","session.action.delete":"删除「{title}」","session.action.deleteShort":"删除","session.action.stop":"停止「{title}」","session.action.stopping":"正在停止「{title}」","session.action.retry":"重试「{title}」","session.action.retrying":"正在重试「{title}」","session.reason.cancelledByUser":"已由用户取消","session.title.codeReview":"代码评审","session.forkedFrom":"派生自","session.retriedFrom":"重试自","session.retryShort":"重试","session.queued":"排队 #{position}/{depth}","archive.title":"归档","archive.subtitle":"安全保留,不占用当前任务列表","archive.open":"打开会话归档","archive.refresh":"刷新归档会话","archive.retry":"重试","archive.loading":"正在载入归档…","archive.empty":"暂无归档会话","archive.restore":"恢复「{title}」","archive.restoreShort":"恢复","archive.restoreAncestor":"请先恢复归档根会话","archive.inherited":"随 {id} 一同归档","taskSwitcher.title":"任务切换器","taskSwitcher.description":"跨项目搜索并打开任务。","taskSwitcher.searchAria":"搜索任务","taskSwitcher.placeholder":"搜索标题、项目、分支、状态或 Session ID…","taskSwitcher.results":"{count} 个结果","taskSwitcher.recent":"最近任务","taskSwitcher.scope":"已索引 {count} 个任务","taskSwitcher.indexing":"正在索引任务…","taskSwitcher.resultsAria":"任务搜索结果","taskSwitcher.current":"当前","taskSwitcher.unread":"{count} 个未读","taskSwitcher.needsAction":"{count} 个需要操作","taskSwitcher.new":"新","taskSwitcher.empty":"没有匹配的任务","taskSwitcher.emptyHint":"尝试项目、分支、状态或更短的关键词。","taskSwitcher.hint.navigate":"选择","taskSwitcher.hint.open":"打开","taskSwitcher.hint.toggle":"切换","taskSwitcher.action.failed":"任务操作失败","commandCenter.title":"命令中心","commandCenter.description":"搜索任务,或执行工作区与应用操作。","commandCenter.searchAria":"搜索操作","commandCenter.placeholder":"搜索操作、设置或工具…","commandCenter.modeAria":"命令中心模式","commandCenter.mode.tasks":"任务","commandCenter.mode.commands":"操作","commandCenter.actions":"{count} 个操作","commandCenter.resultsAria":"操作搜索结果","commandCenter.empty":"没有匹配的操作","commandCenter.emptyHint":"尝试工具、面板或设置名称。","commandCenter.action.newTask":"新建任务","commandCenter.action.newTaskDescription":"打开一个干净的任务编辑器","commandCenter.action.preview":"切换预览区","commandCenter.action.previewDescription":"审查文件、Diff、运行日志与网页","commandCenter.action.terminal":"切换终端","commandCenter.action.terminalDescription":"打开或关闭工作区 Shell","commandCenter.action.settings":"打开设置","commandCenter.action.settingsDescription":"配置外观与行为","commandCenter.action.models":"配置模型","commandCenter.action.modelsDescription":"选择 Provider 与任务模型","commandCenter.action.shortcuts":"查看键盘快捷键","commandCenter.action.shortcutsDescription":"浏览全局与上下文按键","commandCenter.action.skills":"管理 Skills","commandCenter.action.skillsDescription":"发现并配置 Agent 能力","commandCenter.action.mcp":"管理 MCP Server","commandCenter.action.mcpDescription":"配置已连接的工具与服务","commandCenter.action.sidebar":"切换侧边栏","commandCenter.action.sidebarDescription":"显示或隐藏项目导航","taskHome.eyebrow":"任务调度台 · 就绪","taskHome.feed.connecting":"任务调度台 · 正在连接","taskHome.feed.reconnecting":"任务调度台 · 正在重连","taskHome.feed.offline":"任务调度台 · 已离线","taskHome.feed.offlineDescription":"实时任务更新已暂停,服务端正在运行的任务不会停止。","taskHome.feed.retry":"重新连接","taskHome.hero.prefix":"要在这里让 Blade 做点什么:","taskHome.hero.projectFallback":"当前工作区","taskHome.hero.subtitle":"派发一个任务后即可继续手头的工作。每个任务在独立的 worktree 中运行、状态持久保存,完成时会以可复核的工作区形式返回。","taskHome.templates.title":"模板","taskHome.templates.hint":"按 1–4 快速填充","taskHome.template.explore.title":"探索","taskHome.template.explore.description":"追踪行为,梳理系统全貌","taskHome.template.explore.hint":"调用链 · 模块结构","taskHome.template.build.title":"开发","taskHome.template.build.description":"实现一个可上线的功能","taskHome.template.build.hint":"端到端交付特性","taskHome.template.review.title":"评审","taskHome.template.review.description":"找出正确性与回归风险","taskHome.template.review.hint":"审查当前改动","taskHome.review.attachmentsUnsupported":"代码评审不支持附件","taskHome.review.outputSchemaUnsupported":"代码评审使用内置结构化报告 Schema","taskHome.review.usage":"用法:/review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"只读代码评审正在进行","taskHome.review.stale":"评审期间目标已发生变化","taskHome.review.aborted":"代码评审已中止","taskHome.review.interrupted":"代码评审因进程重启而中断","taskHome.review.failed":"代码评审失败","taskHome.review.startFailed":"启动代码评审失败","taskHome.review.invalidTarget":"评审目标无效或没有可评审的改动","taskHome.review.conflict":"当前会话已有任务正在运行","taskHome.template.fix.title":"修复","taskHome.template.fix.description":"定位并修好一个具体故障","taskHome.template.fix.hint":"二分 · 复现 · 打补丁","taskHome.context.isolationToggleTitle":"切换任务隔离方式","taskHome.context.projectSelect":"选择目标项目","taskHome.context.isolation.worktree":"独立 worktree","taskHome.context.isolation.local":"本地工作区","taskHome.context.branchFallback":"无分支","taskHome.context.preparing":"正在准备 worktree","taskHome.setup.aria":"任务准备状态","taskHome.setup.title":"完成准备","taskHome.setup.description":"你可以继续编辑草稿,Blade 正在核对工作区和模型。","taskHome.setup.workspace.title":"工作区","taskHome.setup.workspace.loading":"正在检查可用工作区…","taskHome.setup.workspace.ready":"已选择 {project}","taskHome.setup.workspace.required":"选择一个可用项目","taskHome.setup.workspace.empty":"无项目","taskHome.setup.workspace.action":"选择","taskHome.setup.workspace.retry":"重新加载工作区","taskHome.setup.model.title":"模型","taskHome.setup.model.loading":"正在检查配置…","taskHome.setup.model.ready":"可用于当前任务","taskHome.setup.model.required":"配置或选择一个模型","taskHome.setup.model.action":"配置","taskHome.setup.model.retry":"重试","taskHome.composer.placeholder":"描述目标、约束以及你期望的验收方式……","taskHome.error.dismiss":"关闭","taskHome.recent.title":"最近任务","taskHome.recent.total":"共 {count} 条","taskHome.recent.partial":"已载入 {count} 条 · 继续同步","taskHome.recent.incomplete":"已载入 {count} 条 · 历史不完整","taskSwitcher.indexingLoaded":"已载入 {count} 条 · 正在同步历史","taskHome.footer.note":"独立 worktree 让并行任务不会干扰你当前的工作副本","kanban.title":"任务看板","kanban.subtitle":"跨项目派发任务,优先处理需要人工介入的工作。","kanban.taskCount":"{count} 个任务","kanban.searchAria":"搜索任务看板","kanban.searchPlaceholder":"搜索任务…","kanban.projectFilterAria":"按项目筛选任务看板","kanban.projectAll":"全部项目","kanban.feed.offline":"实时更新已离线,服务端运行中的任务不会停止。","kanban.autoClaim.running":"自动认领中","kanban.autoClaim.paused":"自动认领已暂停","kanban.column.waiting":"等待认领","kanban.column.waitingDescription":"等待可用的执行槽位","kanban.column.active":"处理中","kanban.column.activeDescription":"Agent 正在执行任务","kanban.column.blocked":"遇到阻碍","kanban.column.blockedDescription":"需要输入、重试或人工处理","kanban.column.review":"等你确认","kanban.column.reviewDescription":"已完成,等待验收归档","kanban.column.empty":"此阶段暂无任务","kanban.priority.high":"高优先级","kanban.priority.medium":"中优先级","kanban.priority.low":"低优先级","kanban.kind.feature":"新功能","kanban.kind.bug":"缺陷","kanban.kind.maintenance":"维护","kanban.kind.research":"调研","kanban.card.unread":"有新的任务更新","kanban.card.queuePosition":"队列第 {position}/{depth} 位","kanban.card.diff":"{files} 个文件 · +{additions} −{deletions}","kanban.action.newTask":"新建任务","kanban.action.open":"打开任务","kanban.action.respond":"处理阻碍","kanban.action.inspect":"验收变更","kanban.action.edit":"编辑任务信息","kanban.action.cancel":"取消任务","kanban.action.retry":"重试任务","kanban.action.archive":"验收并归档","kanban.dialog.createTitle":"派发任务","kanban.dialog.createDescription":"任务会直接在选定项目的本地工作区中执行。","kanban.dialog.editTitle":"编辑任务","kanban.dialog.editDescription":"更新计划信息,不会中断正在执行的 Agent。","kanban.dialog.localExecution":"本地工作区 · 不使用 worktree 隔离","kanban.dialog.cancel":"取消","kanban.dialog.dispatch":"派发","kanban.dialog.save":"保存","kanban.dialog.submitFailed":"任务操作失败","kanban.field.title":"标题","kanban.field.titlePlaceholder":"可选的简短任务标题","kanban.field.prompt":"任务说明","kanban.field.promptPlaceholder":"描述目标、约束以及预期的验收方式…","kanban.field.project":"项目","kanban.field.kind":"类型","kanban.field.priority":"优先级","kanban.field.dueAt":"截止时间","capacity.title":"{inFlight} 进行中 · {queued} 排队 · 上限 {max}","capacity.suffix.running":" 进行中","capacity.queued":"排队 {queued}","recent.status.running":"进行中","recent.status.queued":"排队中","recent.status.paused":"已暂停","recent.status.failed":"已失败","recent.status.cancelled":"已取消","recent.status.done":"已完成","recent.time.justNow":"刚刚","recent.time.minutes":"{n} 分钟前","recent.time.hours":"{n} 小时前","recent.time.days":"{n} 天前","recent.session.fallbackShort":"会话 {id}","recent.session.fallbackDated":"会话 {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} 个未读任务更新","attention.notification.completed":"任务已完成","attention.notification.failed":"任务失败","attention.notification.interrupted":"任务已中断","attention.notification.permission":"需要审批","attention.notification.question":"需要回答","attention.notification.elicitation":"MCP 需要输入","interaction.permission.title":"需要授权:{tool}","interaction.permission.once":"仅本次允许","interaction.permission.session":"本会话允许","interaction.permission.project":"本项目允许","interaction.permission.deny":"拒绝","interaction.permission.failed":"授权响应失败","interaction.question.answered":"问题已回答","interaction.question.other":"其他","interaction.question.submit":"提交回答","interaction.question.failed":"回答提交失败","interaction.elicitation.title":"MCP 请求输入","interaction.elicitation.submit":"提交给 MCP","interaction.elicitation.open":"打开外部链接","interaction.elicitation.decline":"拒绝","interaction.elicitation.cancel":"取消","interaction.elicitation.responded":"已响应 MCP 请求","interaction.elicitation.cancelled":"MCP 请求已取消","interaction.elicitation.failed":"响应 MCP 请求失败","interaction.elicitation.warning":"仅在信任该 MCP 服务器并理解请求用途时继续。","interaction.bar.permissionTitle":"Agent 正在等待审批","interaction.bar.permissionHint":"请检查待处理的工具请求,审批后任务才会继续。","interaction.bar.questionTitle":"Agent 正在等待回答","interaction.bar.questionHint":"请回答待处理的问题,任务才能继续。","interaction.bar.elicitationTitle":"MCP 服务器正在等待输入","interaction.bar.elicitationHint":"请检查 MCP 请求,响应后任务才会继续。","interaction.bar.review":"查看请求","interaction.badge.permission":"需要审批","interaction.badge.question":"需要回答","interaction.badge.elicitation":"MCP 输入","artifact.env.isolated":"独立分支","artifact.env.local":"本地","artifact.review":"查看变更","artifact.commits":"{count} 次提交","artifact.apply":"应用","artifact.retryApply":"重新应用","artifact.applying":"应用中","artifact.applied":"已应用","artifact.discard":"丢弃任务变更","artifact.discarded":"已丢弃","artifact.conflict":"任务变更无法安全应用。","artifact.conflictHint":"隔离变更已保留。请查看变更、处理源项目状态,然后重试或丢弃。","artifact.discardDialog.title":"丢弃隔离变更?","artifact.discardDialog.description":"将删除 {project} 隔离任务工作区中的 {count} 个变更文件。","artifact.discardDialog.warning":"此操作会永久删除任务 worktree 和分支,不会修改源项目。","artifact.discardDialog.cancel":"保留变更","artifact.discardDialog.confirm":"丢弃变更","chat.list.empty.eyebrow":"Blade · 就绪","chat.list.empty.title":"发送一条消息开始对话","chat.list.empty.hint":"提问、描述改动,或者粘贴一段错误堆栈。","chat.list.loading.eyebrow":"历史对话","chat.list.loading.title":"正在恢复对话…","chat.list.loading.hint":"正在加载消息、任务状态和实时更新。对话较长时可能需要一点时间。","chat.list.showEarlier":"显示更早的 {count} 条消息","chat.list.showEarlierWithRemaining":"显示更早的 {count} 条消息,当前隐藏 {remaining} 条","chat.list.jumpLatest":"回到最新消息","chat.list.unreadMessage":"1 条新消息","chat.list.unreadMessages":"{count} 条新消息","chat.turns.aria":"跳转到之前的消息","chat.turns.label":"第 {n} 轮","chat.timeline.thinking":"思考过程","chat.timeline.tools.runningOne":"正在执行 1 条命令","chat.timeline.tools.running":"正在执行 {count} 条命令","chat.timeline.tools.completedOne":"已执行 1 条命令","chat.timeline.tools.completed":"已执行 {count} 条命令","chat.timeline.tools.completedOneWithError":"已执行 1 条命令 · 执行失败","chat.timeline.tools.completedWithErrors":"已执行 {count} 条命令 · {errors} 条失败","chat.error.dismiss":"关闭错误","chat.error.queueFull":"指令队列已满。请等待已有指令开始执行后重试。","chat.error.turnChanged":"当前轮次已发生变化,此消息尚未接收。请确认内容后重试。","chat.error.title.submission":"消息未发送。","chat.error.title.execution":"本轮运行已停止。","chat.error.title.navigation":"未能打开任务。","chat.error.title.generic":"操作失败。","chat.error.action.returnDraft":"返回草稿","chat.error.action.editResend":"编辑后重发","chat.error.action.retryTask":"重试任务","chat.error.action.retryingTask":"正在重试…","chat.error.action.checkModels":"检查模型设置","task.failure.authentication":"模型服务认证失败,请检查模型凭据。","task.failure.permission":"模型服务拒绝了请求,请检查账号和模型权限。","task.failure.rateLimit":"模型服务达到速率或额度限制。","task.failure.timeout":"模型服务请求超时。","task.failure.network":"无法连接模型服务。","task.failure.modelUnavailable":"当前选择的模型不可用。","task.failure.contextLimit":"请求超出模型上下文限制。","task.failure.unsupportedInput":"当前模型不支持此类输入。","task.failure.workspaceUnavailable":"此会话的工作区已不可用。","task.failure.capacity":"任务准入容量已满,请在运行中的任务完成后重试。","task.failure.runtime":"Agent 运行失败。","chat.connection.reconnecting":"正在恢复实时更新,当前任务仍在后台继续运行。","chat.connection.offline":"实时更新已离线,当前显示的进度可能已经过期。","chat.connection.retry":"重新连接","chat.side.title":"旁路对话","chat.side.loading":"正在回答旁路问题……","chat.side.failed":"旁路对话失败。","chat.side.dismiss":"关闭旁路对话","chat.footer.disclaimer":"Blade 可能会出错,请核对重要信息。","chat.input.placeholder.default":"输入 @ 提及文件,/ 触发命令……","chat.input.placeholder.steering":"添加指令来引导当前轮次……","chat.input.steering.status":"当前轮次可被引导","chat.input.steering.queued":"引导指令已接收 · 待处理 {count} 条","chat.input.steering.enterHint":" · 回车下发指令","chat.input.followUp.queued":"后续指令已接收 · 下一轮排队 {count} 条","chat.followUpQueue.title":"后续指令队列","chat.followUpQueue.show":"展开后续指令队列","chat.followUpQueue.hide":"收起后续指令队列","chat.followUpQueue.count":"排队中 {count} 条","chat.followUpQueue.lockedCount":"已锁定 {count} 条","chat.followUpQueue.internal":"内部运行项","chat.followUpQueue.attachmentOnly":"仅附件的后续指令","chat.followUpQueue.locked":"已锁定","chat.followUpQueue.delivery.current_turn":"当前轮次","chat.followUpQueue.delivery.next_turn":"下一轮","chat.followUpQueue.delivery.recovery":"恢复队列","chat.followUpQueue.moveUp":"上移 {id}","chat.followUpQueue.moveDown":"下移 {id}","chat.followUpQueue.remove":"移除后续指令 {id}","chat.followUpQueue.refresh":"刷新后续指令队列","chat.followUpQueue.stale":"队列已在其他位置变更。当前显示最新顺序,请确认后重试。","chat.input.steering.recoveredOne":"重启后已恢复 {count} 条排队指令","chat.input.steering.recoveredMany":"重启后已恢复 {count} 条排队指令","chat.input.attachment.add":"添加图片","chat.input.attachment.remove":"移除","chat.input.attachment.countLimit":"最多可添加 {count} 张图片。","chat.input.attachment.sizeLimit":"图片编码后总大小不能超过 {size},请移除图片或选择更小的文件。","chat.input.attachment.readFailed":"Blade 无法读取其中一张图片。","chat.input.attachment.usage":"{count}/{limit} 张图片 · 已用 {used} / {budget}","chat.input.attachment.modelUnsupported":"{model} 不支持图片输入,请选择视觉模型或移除图片。","chat.input.attachment.modelRequired":"请先选择支持图片输入的视觉模型。","chat.input.model.placeholder":"选择模型","chat.input.model.empty":"未配置模型","chat.input.model.vision":"视觉","chat.input.model.change":"切换模型","chat.input.model.locked":"请等待当前轮次结束后再切换模型","chat.input.effort.label":"推理 {effort}","chat.input.effort.heading":"推理强度","chat.input.effort.change":"切换推理强度","chat.input.effort.locked":"请等待当前轮次结束后再切换推理强度","chat.input.effort.option":"使用 {effort} 推理强度","chat.input.serviceTier.label":"速度 {tier}","chat.input.serviceTier.heading":"Provider 服务等级","chat.input.serviceTier.change":"切换 Provider 服务等级","chat.input.serviceTier.locked":"请等待当前轮次结束后再切换服务等级","chat.input.serviceTier.option":"使用 {tier} 服务等级","chat.input.serviceTier.fastHint":"优先通道","chat.input.serviceTier.flexHint":"低成本","chat.input.responseVerbosity.label":"输出 {verbosity}","chat.input.responseVerbosity.heading":"响应详略","chat.input.responseVerbosity.change":"切换响应详略","chat.input.responseVerbosity.locked":"请等待当前轮次结束后再切换响应详略","chat.input.responseVerbosity.option":"使用 {verbosity} 响应详略","chat.input.responseVerbosity.autoHint":"模型默认","chat.input.outputSchema.title":"结构化输出","chat.input.outputSchema.description":"要求本轮最终返回符合该 JSON Schema 的对象。","chat.input.outputSchema.change":"设置结构化输出 Schema","chat.input.outputSchema.locked":"请等待当前轮次结束后再修改输出 Schema","chat.input.outputSchema.editor":"JSON Schema 编辑器","chat.input.outputSchema.placeholder":"粘贴 JSON Schema 对象","chat.input.outputSchema.example":"使用示例","chat.input.outputSchema.clear":"清除","chat.input.outputSchema.invalid":"请输入有效的 JSON 对象;完整 Schema 将由服务端校验。","chat.input.outputSchema.shellUnsupported":"结构化输出不能与 Shell 命令同时使用。","chat.structuredOutput.title":"结构化输出","chat.structuredOutput.copy":"复制结构化输出","chat.input.communicationStyle.label":"风格 {style}","chat.input.communicationStyle.heading":"沟通风格","chat.input.communicationStyle.change":"切换沟通风格","chat.input.communicationStyle.locked":"请等待当前轮次结束后再切换沟通风格","chat.input.communicationStyle.option":"使用 {style} 沟通风格","chat.input.communicationStyle.autoHint":"Blade 默认","chat.input.communicationStyle.pragmaticHint":"直接","chat.input.communicationStyle.friendlyHint":"协作","chat.input.communicationStyle.explanatoryHint":"解释取舍","chat.notice.dismiss":"关闭提示","chat.input.mode.default":"手动审批","chat.input.mode.default.desc":"每个重要操作都需要你的批准","chat.input.mode.autoEdit":"自动审批","chat.input.mode.autoEdit.desc":"让 AI 审核并批准重要操作","chat.input.mode.yolo":"完全访问","chat.input.mode.yolo.desc":"无需询问,直接在你的电脑上运行","chat.input.mode.yolo.confirm.title":"启用完全访问模式?","chat.input.mode.yolo.confirm.desc":"在此模式下,Agent 将直接执行所有操作(包括文件写入、Shell 命令和网络请求)而不请求许可。仅在你信任当前上下文时启用。","chat.input.mode.yolo.confirm.cancel":"取消","chat.input.mode.yolo.confirm.accept":"启用","chat.input.mode.plan":"计划","chat.input.mode.plan.desc":"先拟定计划,暂不做任何改动","chat.input.mode.aria":"Agent 操作审批","chat.input.action.stop":"停止当前轮次","chat.input.action.stopping":"正在停止当前轮次","chat.input.action.steer":"引导当前轮次","chat.input.action.send":"发送消息","chat.input.action.submitting":"正在提交消息","chat.providerRecovery.admission":"等待 Provider 容量","chat.providerRecovery.admissionDetail":"队列 {position}/{depth} · {scope} · 已等待 {waitSeconds}s","chat.providerRecovery.admissionCompact":"Provider 排队 · {position}/{depth}","chat.providerRecovery.rateLimit":"Provider 请求受限,{seconds}s 后重试","chat.providerRecovery.retryWait":"Provider 暂时不可用,{seconds}s 后重试","chat.providerRecovery.retryAttempt":"正在重试 Provider","chat.providerRecovery.retryDetail":"尝试 {attempt}/{maxRetries} · 剩余预算 {budgetSeconds}s","chat.providerRecovery.retryCompact":"Provider 恢复 · {seconds}s · {attempt}/{maxRetries}","chat.providerRecovery.circuit":"Provider 故障已隔离,等待恢复探测","chat.providerRecovery.rateLimitCircuit":"Provider 请求受限,等待恢复探测","chat.providerRecovery.circuitDetail":"{seconds}s 后探测","chat.providerRecovery.circuitCompact":"Provider 熔断 · {seconds}s","chat.providerRecovery.rateLimitCircuitCompact":"Provider 限流 · {seconds}s","chat.providerRecovery.probe":"Provider 正在执行恢复探测","chat.providerRecovery.probeDetail":"一个恢复探测正在进行","chat.providerRecovery.probeCompact":"Provider 恢复探测","chat.providerRecovery.stall":"Provider 尚未返回流数据","chat.providerRecovery.stallAfterOutput":"Provider 流暂时停滞","chat.providerRecovery.stallDetail":"已等待 {stallSeconds}s · 超时上限 {timeoutSeconds}s","chat.providerRecovery.stallCompact":"Provider 等待 · {stallSeconds}s","chat.providerRecovery.fallback":"正在切换到 {to}","chat.providerRecovery.fallbackDetail":"候选 {candidate}/{candidateCount} · 来源 {from}","chat.providerRecovery.fallbackCompact":"Provider 切换 · {to}","chat.providerRecovery.stop":"停止","chat.turnActivity.starting":"正在启动任务","chat.turnActivity.thinking":"正在思考","chat.turnActivity.responding":"正在生成回复","chat.turnActivity.executingTools":"正在执行 {count} 个工具","chat.turnActivity.compacting":"正在压缩上下文","chat.turnActivity.continuing":"正在推进下一步","chat.turnActivity.toolCount":"工具 {completed}/{started}","chat.turnActivity.turn":"回合 {turn}","chat.turnActivity.turnBounded":"回合 {turn}/{maxTurns}","chat.memoryConsolidation.saved":"已保存 {count} 条项目记忆","chat.review.title":"代码评审","chat.review.target":"目标","chat.review.target.uncommitted":"未提交改动","chat.review.target.base":"相对 {ref} 的改动","chat.review.target.commit":"提交 {ref}","chat.review.status":"状态","chat.review.status.completed":"已完成","chat.review.status.stale":"已过期","chat.review.status.failed":"失败","chat.review.status.aborted":"已中止","chat.review.status.interrupted":"已中断","chat.review.findings":"问题","chat.review.noFindings":"未发现可执行问题","chat.review.confidence":"置信度 {value}","chat.review.error":"错误","chat.subagent.resumedFromTitle":"从 {id} 恢复","chat.subagent.resumedDepth":"已恢复 · 层级 {depth}","chat.subagent.loadingLogs":"正在加载子智能体日志…","chat.subagent.resumedAs":"已恢复为 {id} · {status} · 层级 {depth}","chat.subagent.resume":"恢复","chat.subagent.resumeAria":"恢复子智能体","chat.subagent.followUpAria":"子智能体后续指令","chat.subagent.followUpPlaceholder":"描述需要继续处理的工作","chat.subagent.cancel":"取消","chat.subagent.resumeAgent":"恢复智能体","chat.subagent.resumeFailed":"恢复子智能体失败","chat.markdown.copyCode":"复制代码","chat.rewind.title":"回溯会话","chat.rewind.description":"返回到某条用户消息之前的节点。","chat.rewind.loading":"正在加载检查点","chat.rewind.empty":"暂无可回溯的检查点","chat.rewind.checkpointAria":"回溯检查点","chat.rewind.userMessage":"用户消息","chat.rewind.fileCountOne":"{count} 个文件","chat.rewind.fileCountMany":"{count} 个文件","chat.rewind.restoreCode":"恢复代码变更","chat.rewind.restoreCodeHint":"回滚此检查点及之后更改的文件。","chat.rewind.cancel":"取消","chat.rewind.confirm":"回溯","chat.rewind.loadFailed":"加载回溯检查点失败","chat.rewind.failed":"回溯失败。请检查会话错误后重试。","status.context":"上下文","status.tokenLimitTooltip":"此为估算的 token 上限,模型回报上下文尺寸后会自动更新。","status.cache":"缓存","status.cacheTooltip":"本会话缓存读取输入占模型总输入的比例。","status.cacheDetails":"读取 {read} · 写入 {write} · 未缓存 {uncached}","status.cacheUnavailable":"Provider 尚未回报本会话的提示词缓存用量。","status.cacheBreak":"最近一次缓存中断:{reason} · 缓存读取 {previous} → {current}","status.cacheBreak.model":"模型发生变化","status.cacheBreak.system":"系统提示词发生变化","status.cacheBreak.tools":"工具定义发生变化","status.cacheBreak.policy":"请求策略发生变化","status.cacheBreak.ttl":"缓存 TTL 已过期","status.cacheBreak.server":"可能是 Provider 路由或缓存淘汰","status.phase.running":"生成中…","status.phase.providerStall":"Provider 流暂无数据","status.phase.actionStationarityRecovering":"正在纠正空转","status.phase.actionStationarityStopped":"已停止空转","status.phase.compacting":"正在压缩上下文…","status.phase.recoveringContext":"上下文超限,正在恢复…","status.phase.switchingModel":"正在切换模型…","status.phase.waitingPermission":"等待授权…","status.phase.error":"运行失败","status.recovery.review":"恢复前需要检查","status.recovery.interruptedTool":"中断工具的执行状态不确定","status.recovery.successfulTool":"工具可能已经改变了外部状态","preview.title":"预览","preview.action.resize":"调整预览区宽度","preview.action.close":"关闭预览区","preview.action.retry":"重试","preview.tab.diff":"变更","preview.tab.files":"文件","preview.tab.logs":"日志","preview.tab.browser":"浏览器","preview.diff.loadingTitle":"正在加载任务变更…","preview.diff.loadingHint":"正在读取持久化的 worktree 产物。","preview.diff.failedTitle":"任务变更加载失败","preview.diff.discardedTitle":"变更已丢弃","preview.diff.discardedHint":"隔离工作区已删除,源项目没有被修改。","preview.diff.emptyTitle":"暂无变更","preview.diff.emptyHint":"工具修改文件后,变更会显示在这里。","preview.diff.searchAria":"搜索变更文件","preview.diff.searchPlaceholder":"筛选变更文件…","preview.diff.changedFiles":"{count} 个变更文件","preview.diff.expandAll":"全部展开","preview.diff.collapseAll":"全部收起","preview.diff.showMoreFiles":"再显示 {count} 个文件","preview.diff.showMoreLines":"再显示 {count} 行","preview.diff.noMatches":"没有匹配的变更文件","preview.diff.patch":"补丁","preview.diff.line":"第 {line} 行","preview.files.loadingTitle":"正在加载文件…","preview.files.loadingHint":"正在获取工作区文件树。","preview.files.failedTitle":"文件加载失败","preview.files.emptyTitle":"暂无文件","preview.files.emptyHint":"选择项目后即可加载工作区文件树。","preview.files.treeFailed":"工作区文件树加载失败","preview.files.searchAria":"搜索工作区文件","preview.files.searchPlaceholder":"查找文件…","preview.files.searchResultsAria":"文件搜索结果","preview.files.searchFailed":"工作区文件搜索失败","preview.files.noMatches":"没有匹配的文件","preview.files.directoryLoading":"正在加载目录…","preview.files.directoryEmpty":"空目录","preview.files.selectTitle":"选择要预览的文件","preview.files.status.loading":"加载中…","preview.files.status.truncated":"已截断","preview.files.status.ready":"就绪","preview.files.truncatedNotice":"预览内容已截断至 20 万字符。","preview.files.pickHint":"从文件树中选择一个文件进行预览。","preview.files.contentFailed":"文件加载失败","preview.files.editorLoading":"正在加载编辑器…","preview.logs.searchAria":"搜索工具日志","preview.logs.searchPlaceholder":"搜索工具、摘要或输出…","preview.logs.filterAria":"按状态筛选日志","preview.logs.filter.all":"全部","preview.logs.filter.running":"进行中","preview.logs.filter.error":"失败","preview.logs.filter.success":"成功","preview.logs.noMatches":"没有匹配的日志","preview.logs.noMatchesHint":"尝试其他关键词或状态。","preview.logs.emptyTitle":"暂无日志","preview.logs.emptyHint":"工具运行记录会显示在这里。","preview.logs.expand":"展开","preview.logs.collapse":"收起","preview.logs.showMore":"再显示 {count} 条日志","preview.logs.status.running":"进行中","preview.logs.status.error":"失败","preview.logs.status.success":"成功","goal.aria.section":"目标控制条","goal.status.active":"目标进行中","goal.status.paused":"目标已暂停","goal.status.blocked":"目标已阻塞","goal.status.usageLimited":"用量受限","goal.status.budgetLimited":"预算已达上限","goal.status.complete":"目标已完成","goal.field.objective":"目标描述","goal.action.edit":"编辑目标","goal.action.pause":"暂停目标","goal.action.resume":"恢复目标","goal.action.delete":"删除目标","goal.action.expand":"展开目标详情","goal.action.collapse":"收起目标详情","goal.action.cancel":"取消","goal.action.save":"保存","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"续跑 {n} 次","goal.metrics.continuationMany":"续跑 {n} 次","goal.lineage.origin":"起点","goal.lineage.current":"当前","goal.lineage.parent":"上一步","goal.executionHostFailure.title":"执行宿主恢复","goal.executionHostFailure.category.timeout":"执行超时","goal.executionHostFailure.category.admission":"执行准入","goal.executionHostFailure.category.spawn":"进程启动","goal.executionHostFailure.category.finalization":"进程收尾","goal.executionHostFailure.category.sandbox_start":"沙箱启动","goal.executionHostFailure.category.terminal":"终端连接","goal.dialog.title":"删除此目标?","goal.dialog.description":"仅移除目标状态,会话历史与工作区文件不会受影响。","settings.title":"设置","settings.nav.aria":"设置分区","settings.action.back":"返回","settings.category.settings":"设置","settings.category.integrations":"集成","settings.tab.general":"通用","settings.tab.trust":"安全","settings.tab.models":"模型","settings.tab.shortcuts":"快捷键","settings.tab.mcp":"MCP","settings.tab.skills":"技能","settings.tab.plugins":"插件","settings.tab.hooks":"钩子","settings.tab.schedules":"定时任务","settings.common.retry":"重试","settings.common.dismiss":"忽略","settings.common.cancel":"取消","settings.common.enable":"启用","settings.general.loading":"正在加载设置…","settings.general.loadError":"加载设置失败","settings.general.saveError":"保存设置失败","settings.general.responseLanguage":"回复语言","settings.general.responseLanguageHint":"AI 将使用该语言回复","settings.general.autoSave":"自动保存会话","settings.general.communicationStyle":"沟通风格","settings.general.communicationStyleHint":"决定 Agent 在所有会话中的回复措辞","settings.appearance.heading":"外观","settings.appearance.theme":"主题偏好","settings.appearance.theme.dark":"深色","settings.appearance.theme.light":"浅色","settings.appearance.theme.system":"跟随系统","settings.appearance.compactSidebar":"紧凑侧边栏","settings.appearance.codeTheme":"代码主题","settings.appearance.codeThemeHint":"语法高亮配色","settings.notifications.heading":"通知","settings.notifications.buildFinished":"构建完成","settings.notifications.errorsOnly":"仅错误","settings.notifications.systemSounds":"系统提示音","settings.notifications.blocked":"浏览器通知已被拦截","settings.notifications.unavailable":"当前浏览器不支持通知","settings.notifications.enablePrompt":"在此标签页处于后台时接收提醒","settings.privacy.heading":"隐私","settings.privacy.telemetry":"遥测","settings.privacy.crash":"崩溃报告","settings.models.description":"为不同的服务商配置 API Key 与模型设置。","settings.models.loading":"正在加载模型…","settings.models.loadChannelsFailed":"加载服务商渠道失败","settings.models.saveFailed":"保存模型失败","settings.models.deleteFailed":"删除模型失败","settings.models.updateFailed":"更新模型失败","settings.models.updateChannelFailed":"更新服务商渠道失败","settings.models.probeFailed":"服务商渠道探测失败","settings.models.deleteChannelFailed":"删除服务商渠道失败","settings.models.empty":"尚未配置任何模型","settings.models.add":"+ 添加新模型","settings.models.missingCredential":"缺少凭据","settings.models.configured":"已配置","settings.models.deleting":"正在删除…","settings.models.deleteModel":"删除模型","settings.models.deleteChannel":"删除渠道","settings.models.deleteModelAria":"删除 {name}","settings.models.deleteModelPrompt":"删除 {name} 及其保存的配置?","settings.models.deleteChannelAria":"删除渠道 {name}","settings.models.deleteChannelPrompt":"删除渠道 {name}、其凭据以及 {count} 个已配置模型?相关的兜底引用也会一并移除。","settings.models.editModelAria":"编辑 {name}","settings.models.editChannelAria":"编辑渠道 {name}","settings.models.testChannelAria":"测试 {name}","settings.models.deleteChannelActionAria":"删除渠道 {name}","settings.models.modelCountOne":"{count} 个模型","settings.models.modelCountMany":"{count} 个模型","settings.models.defaultEndpoint":"默认端点","settings.shortcuts.searchPlaceholder":"搜索操作…","settings.shortcuts.scope.all":"全部范围","settings.shortcuts.scope.global":"全局","settings.shortcuts.scope.chat":"聊天","settings.shortcuts.scope.layout":"布局","settings.shortcuts.reset":"重置","settings.shortcuts.col.action":"操作","settings.shortcuts.col.shortcut":"快捷键","settings.shortcuts.col.scope":"范围","settings.shortcuts.empty":"未找到快捷键。","settings.shortcuts.action.searchTasks":"搜索任务","settings.shortcuts.action.openCommands":"打开命令中心","settings.shortcuts.action.newTask":"新建任务","settings.shortcuts.action.focusComposer":"聚焦输入框","settings.shortcuts.action.toggleSidebar":"切换侧边栏","settings.common.reload":"重新加载","settings.trust.state.notRequired":"无需信任","settings.trust.state.trusted":"工作区已信任","settings.trust.state.review":"需要审查","settings.trust.state.error":"信任存储错误","settings.trust.selectSession":"选择一个项目会话以查看文件夹信任。","settings.trust.heading":"工作区信任","settings.trust.inheritedFrom":" · 继承自 {source}","settings.trust.reloadAria":"重新加载工作区信任","settings.trust.revoke":"撤销","settings.trust.trustWorkspace":"信任工作区","settings.trust.restartNotice":"重启 Blade 以重新加载项目模型、MCP、LSP、权限和插件。","settings.trust.revokeAria":"撤销工作区信任","settings.trust.confirmTrust":"允许 {count} 个项目来源配置模型、MCP、LSP、权限、环境、指令、命令、技能、Agent 或插件?","settings.trust.confirmRevoke":"重启后阻止项目控制的可执行配置?","settings.trust.saving":"正在保存…","settings.trust.trustReviewed":"信任已审查的工作区","settings.trust.revokeTrust":"撤销信任","settings.trust.empty":"未找到项目控制的可执行配置。","settings.trust.loadFailed":"加载工作区信任失败","settings.trust.updateFailed":"更新工作区信任失败","settings.hooks.state.disabled":"钩子已禁用","settings.hooks.state.notRequired":"无外部钩子","settings.hooks.state.review":"需要审查","settings.hooks.state.trusted":"已信任","settings.hooks.state.modified":"批准后已变更","settings.hooks.state.error":"信任存储错误","settings.hooks.selectSession":"选择一个项目会话以查看其钩子。","settings.hooks.heading":"钩子信任","settings.hooks.reloadAria":"重新加载钩子信任","settings.hooks.revoke":"撤销","settings.hooks.trustDigest":"信任摘要","settings.hooks.currentSession":"当前会话执行","settings.hooks.session.open":"打开一个会话以控制其钩子。","settings.hooks.session.loading":"正在加载会话状态…","settings.hooks.session.disabled":"已被工作区配置禁用。","settings.hooks.session.paused":"仅在此会话中暂停。","settings.hooks.session.active":"通过信任检查后,钩子可在此会话运行。","settings.hooks.session.unavailable":"已被当前会话 runtime 或宿主策略禁用。","settings.hooks.session.enableAria":"为当前会话启用钩子","settings.hooks.session.pauseAria":"为当前会话暂停钩子","settings.hooks.session.unavailableAria":"当前会话无法使用钩子","settings.hooks.confirmTrustAria":"信任项目钩子","settings.hooks.confirmRevokeAria":"撤销项目钩子信任","settings.hooks.confirmTrust":"以你的用户权限运行这 {count} 个钩子,直到它们的配置发生变更?","settings.hooks.confirmRevoke":"停止此项目所有已配置的钩子,直到再次显式信任?","settings.hooks.saving":"正在保存…","settings.hooks.trustReviewed":"信任已审查的钩子","settings.hooks.revokeTrust":"撤销信任","settings.hooks.empty":"没有已配置的命令、HTTP 或提示词钩子。","settings.hooks.loadFailed":"加载钩子信任失败","settings.hooks.updateFailed":"更新钩子信任失败","settings.hooks.sessionUpdateFailed":"更新会话钩子失败","settings.plugins.selectProject":"选择一个项目以管理其插件。","settings.plugins.heading":"工作区插件","settings.plugins.changesNote":"更改将在后续会话快照生效并持久化到所选层级。","settings.plugins.reloadAria":"重新加载插件","settings.plugins.sourcePolicy":"来源策略","settings.plugins.savePolicyAria":"保存插件来源策略","settings.plugins.saving":"正在保存…","settings.plugins.saveForProject":"保存到项目","settings.plugins.restrictAria":"限制插件来源","settings.plugins.restrictAllowlists":"限制为允许列表","settings.plugins.requireShaAria":"要求完整 Git commit SHA","settings.plugins.requireSha":"要求完整 Git SHA","settings.plugins.environmentLocked":" · 环境已锁定","settings.plugins.gitHostsAria":"允许的插件 Git 主机","settings.plugins.marketplacesAria":"允许的插件市场","settings.plugins.localRootsAria":"允许的本地插件根目录","settings.plugins.emptyAllowlists":"空的允许列表将拒绝所有插件来源。","settings.plugins.installHeading":"安装可信插件","settings.plugins.sourceAria":"插件来源","settings.plugins.install":"安装","settings.plugins.trustSource":"我信任此来源可激活钩子、MCP 服务器、技能和命令。","settings.plugins.activationScope":"激活写入范围","settings.plugins.activationScopeHint":"更高优先级的层级仍将决定最终生效状态。","settings.plugins.scopeAria":"插件激活范围","settings.plugins.scope.local":"本地","settings.plugins.scope.project":"项目","settings.plugins.scope.global":"全局","settings.plugins.scope.localDesc":"仅当前检出","settings.plugins.scope.projectDesc":"共享的项目设置","settings.plugins.scope.globalDesc":"所有项目","settings.plugins.scope.invocation":"本次调用","settings.plugins.scope.default":"默认","settings.plugins.layer.on":"开","settings.plugins.layer.off":"关","settings.plugins.capability.commands":"{count} 个命令","settings.plugins.capability.skills":"{count} 个技能","settings.plugins.capability.agents":"{count} 个 Agent","settings.plugins.capability.hooks":"{count} 个钩子","settings.plugins.capability.mcp":"{count} 个 MCP","settings.plugins.noResources":"未声明任何资源","settings.plugins.effective":"生效范围:{scope}","settings.plugins.managed":"托管","settings.plugins.invocationScoped":"通过 --plugin-dir 限定为调用级","settings.plugins.enableAria":"启用 {name}","settings.plugins.disableAria":"停用 {name}","settings.plugins.unavailableAria":"{name} 不可用","settings.plugins.updateAria":"更新 {name}","settings.plugins.uninstallAria":"卸载 {name}","settings.plugins.confirmUpdate":"确认更新","settings.plugins.update":"更新","settings.plugins.confirmRemove":"确认移除","settings.plugins.empty":"未发现此项目的任何插件。","settings.plugins.marketplaces":"市场","settings.plugins.configuredCount":"{count} 个已配置","settings.plugins.marketplaceSourceAria":"市场来源","settings.plugins.addMarketplaceAria":"添加市场","settings.plugins.add":"添加","settings.plugins.noDescription":"无描述","settings.plugins.refreshMarketplaceAria":"刷新市场 {name}","settings.plugins.removeMarketplaceAria":"移除市场 {name}","settings.plugins.confirm":"确认","settings.plugins.installedSuffix":" · 已安装","settings.plugins.marketplaceEmpty":"添加市场以发现可安装的插件。","settings.plugins.loadFailed":"加载插件失败","settings.plugins.actionFailed":"插件操作失败","settings.plugins.updateFailed":"更新插件失败","settings.models.addModal.title":"添加模型","settings.models.addModal.close":"关闭添加模型","settings.models.addModal.loadProvidersError":"加载服务商失败","settings.models.addModal.loadModelsError":"加载模型失败","settings.models.addModal.provider":"服务商","settings.models.addModal.loadingProviders":"正在加载服务商…","settings.models.addModal.selectProvider":"选择服务商","settings.models.addModal.configuredSuffix":" - 已配置","settings.models.addModal.customOpenAI":"自定义 OpenAI 端点","settings.models.addModal.customAnthropic":"自定义 Anthropic 端点","settings.models.addModal.channelId":"渠道 ID","settings.models.addModal.channelIdHint":"稳定的配置与凭据标识符。","settings.models.addModal.channelName":"渠道名称","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"使用 Anthropic Messages 协议。","settings.models.addModal.openaiProtocol":"使用 OpenAI Chat Completions 协议。","settings.models.addModal.modelId":"模型 ID","settings.models.addModal.model":"模型","settings.models.addModal.loadingModels":"正在加载模型…","settings.models.addModal.selectModel":"选择模型","settings.models.addModal.reasoningSuffix":" - 推理","settings.models.addModal.visionSuffix":" - 视觉","settings.models.addModal.displayName":"显示名称","settings.models.addModal.displayNamePlaceholder":"可选别名","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API Key","settings.models.addModal.apiKeyPlaceholder":"单独存储在 auth.json 中","settings.models.addModal.showApiKey":"显示 API Key","settings.models.addModal.hideApiKey":"隐藏 API Key","settings.models.addModal.oauthNote":"该服务商需要 OAuth 或环境凭据,请在选择模型前在外部完成配置。","settings.models.addModal.saveModel":"保存模型","settings.models.addModal.saving":"正在保存…","settings.models.addModal.channelIdError":'渠道 ID 必须以小写字母开头,且只能包含小写字母、数字、"."、"_" 或 "-"。',"settings.models.addModal.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editModal.srTitle":"编辑模型","settings.models.editModal.title":"编辑模型覆盖项","settings.models.editModal.close":"关闭编辑模型","settings.models.editModal.displayName":"显示名称","settings.models.editModal.replaceApiKey":"替换服务商 API Key","settings.models.editModal.replaceApiKeyPlaceholder":"留空则保留当前凭据","settings.models.editModal.baseUrlOverride":"Base URL 覆盖","settings.models.editModal.baseUrlPlaceholder":"留空则使用默认端点","settings.models.editModal.streamIdleTimeout":"流空闲超时(ms)","settings.models.editModal.save":"保存","settings.models.editModal.saving":"正在保存…","settings.models.editModal.streamIdleTimeoutError":"流空闲超时必须至少为 1000ms。","settings.models.editModal.credentialError":"更新服务商凭据失败","settings.models.editProvider.title":"编辑服务商渠道","settings.models.editProvider.close":"关闭编辑服务商","settings.models.editProvider.channelName":"渠道名称","settings.models.editProvider.channelNameRequired":"渠道名称不能为空","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"服务商 Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editProvider.apiKeyEnv":"API Key 环境变量","settings.models.editProvider.apiKeyEnvPlaceholder":"可选,例如 TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"替换 API Key","settings.models.editProvider.apiKeyAria":"服务商 API Key","settings.models.editProvider.apiKeyPlaceholder":"留空则保留当前凭据","settings.models.editProvider.save":"保存渠道","settings.models.editProvider.saving":"正在保存…","settings.style.auto":"自动","settings.style.pragmatic":"务实","settings.style.friendly":"友好","settings.style.explanatory":"解释型","mcp.status.connected":"已连接","mcp.status.connecting":"连接中...","mcp.status.reconnecting":"恢复中...","mcp.status.offline":"离线","mcp.status.error":"错误","mcp.status.recoveringAttempt":"恢复中 {attempt}/{max}","mcp.oauth.status.disabled":"未配置","mcp.oauth.status.unavailable":"当前运行时不可用","mcp.oauth.status.unauthenticated":"需要授权","mcp.oauth.status.authorizing":"等待授权...","mcp.oauth.status.authenticated":"已授权","mcp.oauth.status.error":"授权失败","mcp.catalog.tag.official":"官方","mcp.catalog.tag.popular":"热门","mcp.catalog.tag.community":"社区","mcp.action.refreshServers":"刷新 MCP 服务器","mcp.action.addServer":"添加服务器","mcp.action.close":"关闭 MCP","mcp.action.dismiss":"忽略","mcp.action.retry":"重试","mcp.action.disconnect":"断开连接","mcp.action.disconnecting":"断开中...","mcp.action.stopRecovery":"停止恢复","mcp.action.connect":"连接","mcp.action.connecting":"连接中...","mcp.action.authorizeFirst":"请先授权","mcp.action.delete":"删除","mcp.action.cancel":"取消","mcp.action.deleting":"删除中...","mcp.action.deleteServer":"删除服务器","mcp.tab.installed":"已安装 ({count})","mcp.tab.catalog":"目录","mcp.servers.title":"服务器","mcp.servers.searchAria":"搜索已安装的 MCP 服务器","mcp.servers.searchPlaceholder":"搜索服务器...","mcp.servers.loading":"正在加载服务器...","mcp.servers.noMatch":"没有匹配的服务器","mcp.servers.none":"尚未配置 MCP 服务器","mcp.server.errorLabel":"错误:{error}","mcp.server.deleteAria":"删除 {name}","mcp.server.selectPrompt":"选择一个服务器以查看详情","mcp.instructions.title":"服务器说明","mcp.instructions.detailsOmittedByPolicy":"[详情已根据运行时策略省略]","mcp.instructions.detailsOmitted":"详情已省略","mcp.instructions.truncated":"已截断至安全显示上限","mcp.tasks.title":"实验性 MCP 任务","mcp.tasks.summary":"每会话 {count} 个 · {interval}ms 轮询","mcp.tasks.disabledByDefault":"默认禁用","mcp.tasks.enabled":"已启用","mcp.tasks.disabled":"已禁用","mcp.oauth.signingOut":"登出中...","mcp.oauth.signOut":"登出","mcp.oauth.continueAuthorization":"继续授权","mcp.oauth.resumeAuthorization":"恢复授权","mcp.oauth.opening":"打开中...","mcp.oauth.authorize":"授权","mcp.delete.confirm":"移除此服务器及其已保存的配置?","mcp.tools.title":"工具 ({count})","mcp.tools.none":"暂无可用工具","mcp.completion.title":"参数补全","mcp.completion.connectPrompt":"连接服务器后即可请求补全建议","mcp.completion.unsupported":"该服务器未声明支持 MCP 补全","mcp.completion.noTargets":"没有可补全的提示词参数或模板变量","mcp.completion.targetAria":"MCP 补全目标","mcp.completion.partialAria":"MCP 补全的部分值","mcp.completion.partialPlaceholder":"部分值","mcp.completion.completing":"补全中...","mcp.completion.complete":"补全","mcp.completion.suggestionsAria":"MCP 补全建议","mcp.completion.empty":"[空]","mcp.completion.noSuggestions":"暂无建议","mcp.meta.truncatedSuffix":" · 已截断","mcp.meta.detailsOmittedSuffix":" · 详情已省略","mcp.diagnostics.title":"诊断","mcp.diagnostics.refreshAria":"刷新 {name} 的 MCP 日志","mcp.diagnostics.logsAria":"{name} 的 MCP 日志","mcp.log.levelAria":"MCP 日志级别","mcp.log.setting":"设置中...","mcp.log.loading":"正在加载日志...","mcp.log.none":"未捕获到日志","mcp.catalog.searchAria":"搜索 MCP 服务器目录","mcp.catalog.searchPlaceholder":"在 npm 上搜索 MCP 服务器(至少 3 个字符)...","mcp.catalog.retry":"重试加载目录","mcp.catalog.noDescription":"暂无描述","mcp.catalog.byAuthor":"作者 {author}","mcp.catalog.installed":"已安装","mcp.catalog.installing":"安装中...","mcp.catalog.install":"安装","mcp.catalog.noPackages":"未找到任何包","mcp.catalog.noMore":"没有更多包了","mcp.catalog.packagesFound":"找到 {count} 个包","mcp.catalog.browseGlama":"在 Glama 上浏览更多","mcp.error.connectFailed":"连接服务器失败","mcp.error.disconnectFailed":"断开服务器失败","mcp.error.deleteFailed":"删除服务器失败","mcp.error.loginFailed":"MCP OAuth 登录失败","mcp.error.logoutFailed":"MCP OAuth 登出失败","mcp.error.loggingLevelFailed":"设置 MCP 日志级别失败","mcp.error.completionFailed":"MCP 补全失败","mcp.add.title":"添加 MCP 服务器","mcp.add.closeAria":"关闭添加 MCP 服务器","mcp.add.modeForm":"表单","mcp.add.jsonConfig":"JSON 配置","mcp.add.jsonConfigAria":"JSON 配置","mcp.add.serverName":"服务器名称","mcp.add.command":"命令","mcp.add.commandAria":"服务器命令","mcp.add.argsLabel":"参数(空格分隔)","mcp.add.argsAria":"服务器参数","mcp.add.invalidJson":"请输入包含服务器名称和传输方式的有效 JSON。","mcp.add.nameCommandRequired":"名称和命令为必填项。","mcp.add.adding":"添加中...","mcp.add.submit":"添加服务器","mcp.install.title":"安装 MCP 服务器","mcp.install.titleWithName":"安装 {name}","mcp.install.closeAria":"关闭 MCP 安装","mcp.install.args":"参数","mcp.install.commandPreview":"命令:npx {args}","mcp.install.nameRequired":"服务器名称为必填项。","skills.title":"技能","skills.action.install":"安装技能","skills.action.installShort":"安装","skills.action.refreshAria":"刷新技能","skills.action.closeAria":"关闭技能","skills.action.dismiss":"忽略","skills.action.retry":"重试","skills.action.cancel":"取消","skills.action.close":"关闭","skills.action.hide":"隐藏","skills.action.enable":"启用","skills.action.disable":"禁用","skills.action.saving":"保存中…","skills.status.enabled":"已启用","skills.status.disabled":"已禁用","skills.status.installed":"已安装","skills.noDescriptionShort":"暂无描述","skills.noDescription":"暂无可用描述","skills.installed.title":"已安装","skills.installed.searchAria":"搜索已安装的技能","skills.installed.searchPlaceholder":"搜索技能…","skills.installed.loading":"正在加载技能…","skills.installed.noMatch":"没有匹配的技能","skills.installed.empty":"尚未安装任何技能","skills.uninstall.managedHint":"仅可卸载 Blade 用户技能","skills.uninstall.managed":"受管理","skills.uninstall.action":"卸载","skills.uninstall.confirmAria":"卸载 {name}","skills.uninstall.confirmPrompt":"从 ~/.blade/skills 中移除此技能?","skills.uninstall.inProgress":"正在卸载…","skills.uninstall.confirm":"卸载技能","skills.details.title":"详情","skills.details.provider":"提供方","skills.details.location":"位置","skills.details.capabilities":"能力","skills.details.allowedTools":"允许的工具({count})","skills.detail.emptyState":"选择一个技能以查看详情","skills.install.title":"安装技能","skills.install.closeAria":"关闭技能安装","skills.install.tab.catalog":"目录","skills.install.tab.repo":"仓库","skills.install.tab.local":"本地","skills.install.catalog.searchAria":"搜索技能目录","skills.install.catalog.searchPlaceholder":"搜索目录…","skills.install.catalog.loading":"正在加载目录…","skills.install.catalog.empty":"未找到技能","skills.install.catalog.byAuthor":"作者:{author}","skills.install.catalog.tag.official":"官方","skills.install.catalog.tag.popular":"热门","skills.install.catalog.tag.community":"社区","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"技能仓库地址","skills.install.repo.credentialsHint":"使用 Blade 进程可用的 Git 凭据","skills.install.local.label":"本地路径","skills.install.local.inputAria":"本地技能路径","skills.status.dialogTitle":"安装状态","skills.status.confirm.title":"确认安装","skills.status.confirm.prompt":"安装所选技能?","skills.status.installing.title":"正在安装","skills.status.installing.description":"正在下载并校验…","skills.status.failed.title":"安装失败","skills.status.failed.fallback":"安装失败。","skills.status.failed.hint":"请检查访问权限后重试。","skills.error.deleteFailed":"删除技能失败","skills.error.toggleFailed":"切换技能状态失败","skills.error.installFailed":"安装技能失败","schedule.title":"定时任务","schedule.description":"按 cron、间隔或一次性触发器自动运行无界面任务提示词。","schedule.new":"新建定时任务","schedule.newAria":"创建新的定时任务","schedule.refresh":"刷新","schedule.reloadAria":"重新加载定时任务","schedule.create":"创建","schedule.save":"保存","schedule.cancel":"取消","schedule.confirmDelete":"确认?","schedule.empty":"暂无定时任务","schedule.enabled":"已启用","schedule.disabled":"已禁用","schedule.never":"从未","schedule.nextRun":"下次运行","schedule.lastRun":"上次运行","schedule.runCount":"已运行 {count} 次","schedule.trigger.kindAria":"触发器类型","schedule.trigger.cron":"Cron","schedule.trigger.interval":"间隔","schedule.trigger.once":"一次性","schedule.field.title":"标题(可选)","schedule.field.cron":"Cron 表达式","schedule.field.interval":"间隔","schedule.field.runAt":"运行时间","schedule.field.prompt":"提示词","schedule.field.project":"项目路径","schedule.field.model":"模型(可选)","schedule.field.permissionMode":"权限模式","schedule.field.isolation":"隔离方式","schedule.placeholder.title":"每晚依赖审查","schedule.placeholder.cron":"0 9 * * 1 (分 时 日 月 周)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"描述要运行的任务…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"例如 anthropic/claude-sonnet","schedule.model.current":"使用当前模型","schedule.permission.default":"默认","schedule.permission.autoEdit":"自动编辑","schedule.permission.yolo":"Yolo","schedule.permission.plan":"规划","schedule.isolation.local":"本地","schedule.isolation.worktree":"工作树","schedule.cadence.cron":"cron:{expr}","schedule.cadence.interval":"每 {interval}","schedule.cadence.once":"于 {time} 运行一次","schedule.status.queued":"排队中","schedule.status.running":"运行中","schedule.status.completed":"已完成","schedule.status.failed":"失败","schedule.status.cancelled":"已取消","schedule.status.interrupted":"已中断","schedule.status.error":"出错","schedule.status.never":"尚未运行","schedule.runNowAria":"立即运行“{title}”","schedule.editAria":"编辑“{title}”","schedule.deleteAria":"删除“{title}”","schedule.enableAria":"启用“{title}”","schedule.disableAria":"禁用“{title}”","schedule.error.promptRequired":"提示词不能为空。","schedule.error.projectRequired":"项目路径不能为空。","schedule.error.cronRequired":"Cron 表达式不能为空。","schedule.error.invalidInterval":"请输入类似 30m、2h 或 1d 的间隔。","schedule.error.runAtRequired":"请选择有效的运行时间。","schedule.error.loadFailed":"加载定时任务失败。","schedule.error.createFailed":"创建定时任务失败。","schedule.error.updateFailed":"更新定时任务失败。","schedule.error.deleteFailed":"删除定时任务失败。","schedule.error.toggleFailed":"切换定时任务状态失败。","schedule.error.runFailed":"运行定时任务失败。"},ql=["en","zh"],Ns={en:vi,zh:bi},Fa="blade-ui-locale",ln=typeof window<"u"&&typeof document<"u";function wi(){var e,t;if(ln){try{const n=(e=window.localStorage)==null?void 0:e.getItem(Fa);if(n==="en"||n==="zh")return n}catch{}return(typeof navigator<"u"&&(navigator.language||((t=navigator.languages)==null?void 0:t[0]))||"").toLowerCase().startsWith("zh")?"zh":"en"}return"en"}let dt=wi();const Ws=new Set;function xi(){for(const e of Ws)e()}function zl(){return dt}function Si(e){var t;if(e!==dt){if(dt=e,ln){try{(t=window.localStorage)==null||t.setItem(Fa,e)}catch{}document!=null&&document.documentElement&&(document.documentElement.lang=e==="zh"?"zh-CN":"en")}xi()}}function Oa(e){return Ws.add(e),()=>Ws.delete(e)}function Ci(e,t){return t?e.replace(/\{(\w+)\}/g,(s,n)=>{const r=t[n];return r==null?s:String(r)}):e}function pe(e,t){const n=(Ns[dt]??Ns.en)[e]??Ns.en[e];return Ci(n,t)}function $e(){return b.useSyncExternalStore(Oa,()=>dt,()=>"en"),pe}function _l(){return{locale:b.useSyncExternalStore(Oa,()=>dt,()=>"en"),setLocale:Si}}ln&&(document!=null&&document.documentElement)&&(document.documentElement.lang=dt==="zh"?"zh-CN":"en");class ns extends Error{constructor(t,s,n){super(t),this.status=s,this.code=n,this.name="HttpResponseError"}}function Gs(e){return e instanceof ns}async function Pe(e,t){const s=await fetch(e,t),n=await s.json().catch(()=>{});if(!s.ok){const r=n,o=r!=null&&r.error&&typeof r.error=="object"&&!Array.isArray(r.error)?r.error:void 0,l=typeof(r==null?void 0:r.error)=="string"?r.error:typeof(o==null?void 0:o.message)=="string"?o.message:typeof(r==null?void 0:r.message)=="string"?r.message:s.statusText||`Request failed (${s.status})`;throw new ns(l,s.status,typeof(o==null?void 0:o.code)=="string"?o.code:typeof(r==null?void 0:r.code)=="string"?r.code:void 0)}return n}const ji=oe.Object({runId:oe.String(),status:oe.String(),messageId:oe.Optional(oe.String()),queued:oe.Optional(oe.Integer({minimum:0})),followUpQueue:oe.Optional(ka),queuePosition:oe.Optional(oe.Integer({minimum:0})),queueDepth:oe.Optional(oe.Integer({minimum:0})),maxConcurrentTasks:oe.Optional(oe.Integer({minimum:1}))},{additionalProperties:!1});class Ti extends Error{constructor(s,n,r,o){super(s);_t(this,"name","FollowUpQueueMutationHttpError");this.status=n,this.code=r,this.snapshot=o}}function Pi(e){if(!(e instanceof Error)||e.name!=="FollowUpQueueMutationHttpError"||!("code"in e)||!("snapshot"in e))return!1;const t=e;return typeof t.code=="string"&&va.safeParse({error:{code:t.code,message:t.message},snapshot:t.snapshot}).success}const z="",Kn=1e4,Ai=oe.Array(At),Ri=oe.Array(ya),Ei=oe.Array(Ur),Ni=oe.Array(qr),Mi=oe.Array(zr),Vn=oe.Object({cwd:oe.String(),gitBranch:oe.Optional(oe.String()),taskAdmission:oe.Optional(oe.Object({inFlight:oe.Integer({minimum:0}),queued:oe.Integer({minimum:0}),maxConcurrent:oe.Integer({minimum:1}),maxQueued:oe.Integer({minimum:1}),paused:oe.Optional(oe.Boolean())}))}),Ii=e=>Array.isArray(e)?e:e==null?"":typeof e=="string"?e:JSON.stringify(e),Fi=()=>{const e=new Date,t=String(e.getFullYear()).slice(-2),s=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0"),r=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`Session ${t}-${s}-${n} ${r}:${o}`};function Oi(e){const t=ba.parse(e);return`projectPath=${encodeURIComponent(t.projectPath)}`}function ye(e,t){const s=Oi(t);return`${e}${e.includes("?")?"&":"?"}${s}`}function Qn(e){return{"x-blade-directory":ba.parse(e).projectPath}}const Ms=(e,t,s)=>({id:`history-${t}-${s}`,role:e.role,content:Ii(e.content),timestamp:s,metadata:e.metadata&&typeof e.metadata=="object"?e.metadata:void 0,tool_call_id:e.tool_call_id,name:e.name,tool_calls:e.tool_calls,thinkingContent:e.thinkingContent??e.reasoningContent}),D={listProjects:async()=>{const e=await fetch(`${z}/projects`);if(!e.ok)throw new Error("Failed to load projects");return ze(Ri,await e.json())},bindProject:async e=>{var s;const t=await fetch(`${z}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to bind project")}return ya.parse(await t.json())},pickProjectDirectory:async()=>ze(ro,await Pe(`${z}/projects/pick`,{method:"POST"})),unbindProject:async e=>{if(!(await fetch(`${z}/projects?path=${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to unbind project")},listSessions:async()=>{const e=await fetch(`${z}/sessions`);if(!e.ok)throw new Error("Failed to load sessions");return ze(Ai,await e.json())},listSessionPage:async(e,t=50,s=!1)=>{const n=new URLSearchParams({limit:String(t)});e&&n.set("cursor",e),s&&n.set("archived","true");const r=await fetch(`${z}/sessions/catalog?${n.toString()}`);if(!r.ok)throw new Error("Failed to load session catalog");return ao.parse(await r.json())},listSurfaceCatalog:async(e={})=>{const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit!==void 0&&t.set("limit",String(e.limit)),e.archived!==void 0&&t.set("archived",String(e.archived)),e.workspaceKind&&t.set("workspaceKind",e.workspaceKind);const s=t.toString();return no.parse(await Pe(`${z}/sessions/v2/catalog${s?`?${s}`:""}`))},openSurface:async(e,t,s)=>An.parse(await Pe(`${z}/sessions/v2/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(so.parse({locator:e,...t===void 0?{}:{limit:t}})),signal:s})),loadSurfaceHistoryPage:async(e,t,s,n,r)=>_r.parse(await Pe(`${z}/sessions/v2/history`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(to.parse({locator:e,cursor:t,expectedSnapshot:s,...n===void 0?{}:{limit:n}})),signal:r})),forkSurface:async(e,t)=>An.parse(await Pe(`${z}/sessions/v2/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(eo.parse({locator:e})),signal:t})),getSession:async e=>At.parse(await Pe(ye(`${z}/sessions/${e.sessionId}`,e))),createSession:async(e,t)=>{const s=await fetch(`${z}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e,title:t||Fi()})});if(!s.ok)throw new Error("Failed to create session");return At.parse(await s.json())},startCodeReview:async(e,t)=>{var n,r;const s=await fetch(`${z}/sessions/${e.sessionId}/review`,{method:"POST",headers:{"Content-Type":"application/json",...Qn(e)},body:JSON.stringify({projectPath:e.projectPath,...t})});if(!s.ok){const o=await s.json().catch(()=>{}),l=((n=o==null?void 0:o.error)==null?void 0:n.code)==="CONFLICT"?pe("taskHome.review.conflict"):((r=o==null?void 0:o.error)==null?void 0:r.code)==="BAD_REQUEST"?pe("taskHome.review.invalidTarget"):pe("taskHome.review.startFailed");throw new Error(l)}return Zr.parse(await s.json())},getWorkspaceInfo:async()=>ze(Vn,await Pe(`${z}/global/info`)),createTask:async e=>{var s;const t=await fetch(`${z}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to dispatch task")}return En.parse(await t.json())},updateTask:async(e,t)=>{var n;const s=await fetch(ye(`${z}/tasks/${e.sessionId}`,e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok){const r=await s.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to update task")}return At.parse(await s.json())},setTaskAdmissionPaused:async e=>ze(Vn.properties.taskAdmission,await Pe(`${z}/global/task-admission`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:e})})),retryTask:async e=>{var s;const t=await fetch(ye(`${z}/tasks/${e.sessionId}/retry`,e),{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to retry task")}return En.parse(await t.json())},deliverTask:async(e,t)=>{var n;const s=await fetch(ye(`${z}/tasks/${e.sessionId}/delivery`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t})});if(!s.ok){const r=await s.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to deliver task changes")}return At.parse(await s.json())},getTaskDiff:async e=>{var s;const t=await fetch(ye(`${z}/tasks/${e.sessionId}/diff`,e));if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to load task diff")}return Xr.parse(await t.json())},deleteSession:async e=>{if(!(await fetch(ye(`${z}/sessions/${e.sessionId}`,e),{method:"DELETE"})).ok)throw new Error("Failed to delete session")},archiveSession:async e=>Yr.parse(await Pe(ye(`${z}/sessions/${e.sessionId}/archive`,e),{method:"POST"})),unarchiveSession:async e=>Jr.parse(await Pe(ye(`${z}/sessions/${e.sessionId}/unarchive`,e),{method:"POST"})),exportSessionMarkdown:async(e,t=!1)=>{var v,c;const s=ye(`${z}/sessions/${e.sessionId}/export`,e),n=t?`${s}&includeReasoning=true`:s,r=await fetch(n);if(!r.ok){const u=await r.json().catch(()=>{});throw new Error(((v=u==null?void 0:u.error)==null?void 0:v.message)||"Failed to export session")}const o=r.headers.get("content-disposition")??"",l=((c=/filename="([A-Za-z0-9._-]+)"/.exec(o))==null?void 0:c[1])??`blade-session-${e.sessionId.slice(0,12)}.md`,m=r.headers.get("x-blade-content-sha256")??"";if(!/^[a-f0-9]{64}$/.test(m))throw new Error("Session export is missing its integrity hash");const k=u=>{const i=r.headers.get(u);if(i===null)throw new Error(`Session export is missing its ${u} header`);const d=Number(i);if(!Number.isInteger(d)||d<0)throw new Error(`Session export has an invalid ${u} header`);return d};return{filename:l,markdown:await r.text(),contentSha256:m,messageCount:k("x-blade-export-messages"),activityCount:k("x-blade-export-activities"),redactionCount:k("x-blade-export-redactions")}},updateSession:async(e,t)=>{if(!(await fetch(`${z}/sessions/${e.sessionId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,projectPath:e.projectPath})})).ok)throw new Error("Failed to update session")},getMessages:async e=>{const t=await fetch(ye(`${z}/sessions/${e.sessionId}/message`,e));if(!t.ok)throw new Error("Failed to load messages");const s=ze(Ei,await t.json()),n=Date.now();return s.map((r,o)=>Ms(r,o,n))},sendMessage:async(e,t,s)=>{var r,o;const n=await fetch(`${z}/sessions/${e.sessionId}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,permissionMode:s,projectPath:e.projectPath})});if(!n.ok){const l=await n.json().catch(()=>{}),m=((r=l==null?void 0:l.error)==null?void 0:r.message)??(l==null?void 0:l.reason);throw new ns(m||"Failed to send message",n.status,(o=l==null?void 0:l.error)==null?void 0:o.code)}return ze(ji,await n.json())},getFollowUpQueue:async e=>ka.parse(await Pe(ye(`${z}/sessions/${e.sessionId}/follow-ups`,e))),mutateFollowUpQueue:async(e,t)=>{const s=await fetch(ye(`${z}/sessions/${e.sessionId}/follow-ups/mutate`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await s.json().catch(()=>{});if(!s.ok){const r=va.safeParse(n);throw r.success?new Ti(r.data.error.message,s.status,r.data.error.code,r.data.snapshot):new ns("Failed to mutate follow-up queue",s.status)}return Gr.parse(n).snapshot},askSideQuestion:async(e,t,s)=>Wr.parse(await Pe(`${z}/sessions/${e.sessionId}/side-question`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:t,projectPath:e.projectPath}),signal:s})),executeUserShellCommand:async(e,t)=>Qr.parse(await Pe(`${z}/sessions/${e.sessionId}/shell`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:t,projectPath:e.projectPath})})),abortSession:async e=>{var s;const t=await fetch(ye(`${z}/sessions/${e.sessionId}/abort`,e),{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||"Failed to stop task")}},getGoal:async e=>{const t=await fetch(ye(`${z}/sessions/${e.sessionId}/goal`,e));if(!t.ok)throw new Error("Failed to load goal");return(await t.json()).goal},createGoal:async(e,t,s,n)=>{const r=await fetch(ye(`${z}/sessions/${e.sessionId}/goal`,e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({objective:t,tokenBudget:s,permissionMode:n})});if(!r.ok)throw new Error("Failed to create goal");return r.json()},updateGoal:async(e,t)=>{const s=await fetch(ye(`${z}/sessions/${e.sessionId}/goal`,e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error("Failed to update goal");return s.json()},clearGoal:async e=>{if(!(await fetch(ye(`${z}/sessions/${e.sessionId}/goal`,e),{method:"DELETE"})).ok)throw new Error("Failed to clear goal")},listRewindCheckpoints:async e=>{const t=await fetch(ye(`${z}/sessions/${e.sessionId}/rewind`,e));if(!t.ok)throw new Error("Failed to load rewind checkpoints");const s=await t.json();return ze(Ni,s.checkpoints)},rewindSession:async(e,t,s)=>{const n=await fetch(ye(`${z}/sessions/${e.sessionId}/rewind`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetMessageId:t,mode:s})});if(!n.ok)throw new Error("Failed to rewind session");const r=Vr.parse(await n.json()),o=Date.now();return{...r,messages:r.messages.map((l,m)=>Ms(l,m,o))}},listSubagents:async e=>{const t=await fetch(ye(`${z}/sessions/${e.sessionId}/subagents`,e));if(!t.ok)throw new Error("Failed to load subagents");const s=await t.json();return ze(Mi,s.subagents)},resumeSubagent:async(e,t,s)=>{const n=await fetch(ye(`${z}/sessions/${e.sessionId}/subagents/${encodeURIComponent(t)}/resume`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:s})});if(!n.ok){const r=await n.json().catch(()=>{});throw new Error((r==null?void 0:r.message)||"Failed to resume subagent")}return Kr.parse(await n.json())},forkSession:async e=>{const t=await fetch(`${z}/sessions/${e.sessionId}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath})});if(!t.ok)throw new Error("Failed to fork session");const s=$r.parse(await t.json()),n=Date.now();return{session:s.session,messages:s.messages.map((r,o)=>Ms(r,o,n))}},openEventSubscription:async(e,t,s)=>{const n=(s==null?void 0:s.maxRetries)??5,r=s==null?void 0:s.onConnectionChange,o=s==null?void 0:s.onConnectionStateChange;let l=null,m=0,k=null,v=Date.now(),c=null,u=null,i=!1,d=!1,p=0,g,f,h=!1;const C=new Promise((P,B)=>{g=P,f=B}),S=()=>{c&&(clearInterval(c),c=null)},T=()=>{u&&(clearTimeout(u),u=null)},j=()=>{l==null||l.close(),l=null},A=()=>{k&&(clearTimeout(k),k=null),S(),T(),j()},w=()=>{h||(h=!0,T(),g())},E=P=>{h||(h=!0,A(),f(P))},F=()=>{if(i||m>=n){m>=n&&(console.error(`SSE max retries (${n}) reached, giving up`),o==null||o("offline"));return}m++,o==null||o("reconnecting");const P=Math.min(1e3*Math.pow(2,m-1),3e4);console.log(`SSE reconnecting in ${P}ms (attempt ${m}/${n})`),k=setTimeout(()=>{N().catch(B=>{console.error("SSE reconnect failed",B),r==null||r(!1),F()})},P)},x=()=>{m=0,v=Date.now(),r==null||r(!0),o==null||o("connected"),S(),c=setInterval(()=>{Date.now()-v>45e3&&(console.warn("SSE heartbeat timeout, reconnecting..."),S(),j(),r==null||r(!1),o==null||o("reconnecting"),F())},15e3),d||(d=!0,w())},N=async()=>{if(i)return;j();const P=ye(`${z}/sessions/${e.sessionId}/events`,e),B=p>0?`${P}${P.includes("?")?"&":"?"}lastEventId=${p}`:P;l=new EventSource(B),d||(T(),u=setTimeout(()=>{o==null||o("offline"),E(new Error("Timed out waiting for event subscription readiness"))},Kn)),l.onmessage=U=>{try{const _=JSON.parse(U.data);typeof _.seq=="number"&&_.seq>p&&(p=_.seq);const Q=Rn.parse(_);if(v=Date.now(),Q.type==="connected"){Q.properties.sessionId===e.sessionId&&Q.properties.projectPath===e.projectPath&&(typeof Q.properties.status=="string"&&t({type:"session.status",properties:Q.properties}),Q.properties.followUpQueue!==void 0&&t({type:"follow_up.queue.changed",properties:{sessionId:e.sessionId,projectPath:e.projectPath,queue:Q.properties.followUpQueue}}),t({type:"provider.recovery",properties:{sessionId:e.sessionId,projectPath:e.projectPath,recovery:Q.properties.providerRecovery??null,authoritative:!0}}),t({type:"turn.activity",properties:{sessionId:e.sessionId,projectPath:e.projectPath,activity:Q.properties.turnActivity??null,authoritative:!0}}),x());return}if(Q.type==="heartbeat")return;t(Q)}catch(_){console.error("Failed to parse SSE event:",U.data,_)}},l.onerror=()=>{if(i)return;const U=(l==null?void 0:l.readyState)===EventSource.CLOSED;if(S(),j(),U){r==null||r(!1),o==null||o("offline"),d||E(new Error("Event subscription closed before it was ready"));return}if(!d){o==null||o("offline"),E(new Error("Failed to open event subscription"));return}r==null||r(!1),F()}};return o==null||o("connecting"),N().catch(P=>{o==null||o("offline"),E(P instanceof Error?P:new Error("Failed to open event subscription"))}),await C,()=>{i=!0,k&&(clearTimeout(k),k=null),A(),r==null||r(!1)}},openTaskEventSubscription:async(e,t)=>{const s=t==null?void 0:t.onConnectionChange,n=t==null?void 0:t.onConnectionStateChange,r=new EventSource(`${z}/events`);let o=!1,l=!1,m,k,v;const c=new Promise((i,d)=>{k=i,v=d}),u=()=>{o||(o=!0,m!==void 0&&(clearTimeout(m),m=void 0),r.close(),s==null||s(!1),n==null||n("offline"))};return n==null||n("connecting"),m=setTimeout(()=>{l||o||(u(),v(new Error("Timed out waiting for global task events")))},Kn),r.onmessage=i=>{try{const d=Rn.parse(JSON.parse(i.data));if(d.type==="connected"){l||(l=!0,m!==void 0&&(clearTimeout(m),m=void 0),k()),s==null||s(!0),n==null||n("connected");return}if(d.type==="heartbeat")return;e(d)}catch(d){console.error("Failed to parse global task event:",i.data,d)}},r.onerror=()=>{s==null||s(!1),n==null||n(l?"reconnecting":"offline"),!l&&!o&&(u(),v(new Error("Failed to open global task events")))},await c,u},respondPermission:async(e,t,s)=>{var o;const n=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),r=await fetch(`${z}/permissions/${t}?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok){const l=await r.json().catch(()=>{});throw new Error(((o=l==null?void 0:l.error)==null?void 0:o.message)||"Failed to respond to permission")}},respondToConfirmation:async(e,t,s)=>{if(!(await fetch(ye(`${z}/sessions/${e.sessionId}/confirmation/${t}`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:s})})).ok)throw new Error("Failed to respond to confirmation")},respondToQuestion:async(e,t,s)=>{var o;const n=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),r=await fetch(`${z}/permissions/${t}?${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:!0,answers:s})});if(!r.ok){const l=await r.json().catch(()=>{});throw new Error(((o=l==null?void 0:l.error)==null?void 0:o.message)||"Failed to respond to question")}},respondToElicitation:async(e,t,s)=>{var o;const n=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),r=await fetch(`${z}/permissions/${t}?${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:s.action==="accept",elicitation:s})});if(!r.ok){const l=await r.json().catch(()=>{});throw new Error(((o=l==null?void 0:l.error)==null?void 0:o.message)||"Failed to respond to MCP elicitation")}},getGitInfo:async e=>{const t=await fetch(`${z}/suggestions/git-info`,{headers:Qn(e)});if(!t.ok)throw new Error("Failed to get git info");return t.json()},listSchedules:async()=>{var s;const e=await fetch(`${z}/schedules`);if(!e.ok){const n=await e.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.loadFailed"))}return Br.parse(await e.json()).schedules},createSchedule:async e=>{var s;const t=await fetch(`${z}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.createFailed"))}return St.parse(await t.json())},updateSchedule:async(e,t)=>{var n;const s=await fetch(`${z}/schedules/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok){const r=await s.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||pe("schedule.error.updateFailed"))}return St.parse(await s.json())},deleteSchedule:async e=>{var s;const t=await fetch(`${z}/schedules/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.deleteFailed"))}},enableSchedule:async e=>{var s;const t=await fetch(`${z}/schedules/${encodeURIComponent(e)}/enable`,{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.toggleFailed"))}return St.parse(await t.json())},disableSchedule:async e=>{var s;const t=await fetch(`${z}/schedules/${encodeURIComponent(e)}/disable`,{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.toggleFailed"))}return St.parse(await t.json())},runSchedule:async e=>{var s;const t=await fetch(`${z}/schedules/${encodeURIComponent(e)}/run`,{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>{});throw new Error(((s=n==null?void 0:n.error)==null?void 0:s.message)||pe("schedule.error.runFailed"))}return St.parse(await t.json())}};function ee(e){return{sessionId:e.sessionId,projectPath:e.projectPath}}function ce(e){return JSON.stringify([e.projectPath,e.sessionId])}function Ha(e){return JSON.stringify([e.version,e.sessionId,e.workspace.kind,e.workspace.kind==="local"?e.workspace.projectPath:e.workspace.workspaceRef])}function V(e,t){return!e||!t?e===t:e.sessionId===t.sessionId&&e.projectPath===t.projectPath}function Zt(e,t){return!e||!t?e===t:e.version!==t.version||e.sessionId!==t.sessionId||e.workspace.kind!==t.workspace.kind?!1:e.workspace.kind==="local"&&t.workspace.kind==="local"?e.workspace.projectPath===t.workspace.projectPath:e.workspace.kind==="acp-remote"&&t.workspace.kind==="acp-remote"?e.workspace.workspaceRef===t.workspace.workspaceRef:!1}function as(e,t){return e.find(s=>V(ee(s),t))}function Ae(e,t){const s=ee(t),n=e.findIndex(o=>V(ee(o),s));if(n===-1)return[...e,t];const r=[...e];return r[n]=t,r}function Wn(e,t){return e.filter(s=>!V(ee(s),t))}const Hi=4;function Is(){const e=new Error("Aborted");return e.name="AbortError",e}class Li{constructor(){_t(this,"active",0);_t(this,"waiters",[])}async run(t,s){await this.acquire(t);try{return t.throwIfAborted(),await s()}finally{this.release()}}acquire(t){return t.aborted?Promise.reject(Is()):this.active<Hi?(this.active+=1,Promise.resolve()):new Promise((s,n)=>{const r=()=>{const l=this.waiters.indexOf(o);l>=0&&this.waiters.splice(l,1),n(Is())},o={signal:t,resolve:s,reject:n,removeAbortListener:()=>t.removeEventListener("abort",r)};t.addEventListener("abort",r,{once:!0}),this.waiters.push(o)})}release(){for(;this.waiters.length>0;){const t=this.waiters.shift();if(!t)break;if(t.removeAbortListener(),t.signal.aborted){t.reject(Is());continue}t.resolve();return}this.active-=1}}const Di=new Li,ot=new Map;function Ui(e,t){return Di.run(e,t)}function qi(e){const t=Ha(e),s=ot.get(t);if(s!=null&&s.signal.aborted){ot.delete(t);return}return s==null?void 0:s.promise}function zi(e,t,s){const n=Ha(e),r=ot.get(n);if(r&&!r.signal.aborted)return r.promise;r&&ot.delete(n);const o=Symbol(n),l=s().finally(()=>{var m;((m=ot.get(n))==null?void 0:m.token)===o&&ot.delete(n)});return ot.set(n,{signal:t,token:o,promise:l}),l}const Fs=50,Js=500,_i=new Set(["session_surface_cursor_invalid","session_surface_snapshot_changed"]);function Tt(e){let t=null;if(Gs(e)&&e.code!==void 0)try{t=oo.parse(e.code)}catch{t=null}return{code:t,message:e instanceof Error?e.message:"Session history request failed"}}function $t(e){return e instanceof Error&&e.name==="AbortError"}function Bi(e){return{locator:e.session.locator,displayCwd:e.session.displayCwd,capabilities:e.session.capabilities,mode:"history-only"}}function $i(e){return e.length<=Js?e:e.slice(-Js)}function Ki(e,t){const s=new Set(t.map(n=>n.id));return[...e.filter(n=>!s.has(n.id)),...t].slice(0,Js).map(n=>({...n}))}function Vi(e,t){return e.workspace.kind!==t.workspace.kind?!1:e.workspace.kind==="local"&&t.workspace.kind==="local"?e.workspace.projectPath===t.workspace.projectPath:e.workspace.kind==="acp-remote"&&t.workspace.kind==="acp-remote"?e.workspace.workspaceRef===t.workspace.workspaceRef:!1}const Qi=(e,t)=>{let s=0,n=null,r={},o=0,l=null;const m=(u,i)=>{var d;return u===o&&Zt((d=t().historySurfaceSelection)==null?void 0:d.locator,i)},k=()=>(l==null||l.abort(),l=new AbortController,o+=1,{generation:o,controller:l}),v=()=>{o+=1,l==null||l.abort(),l=null},c=(u,i,d,p=null)=>{if(i===o){if(!Zt(d,u.session.locator))throw new Error("Session history response locator mismatch");e({historySurfaceSelection:Bi(u),historySurfaceMessages:$i(u.history.messages),historySurfaceOlderCursor:u.history.olderCursor??null,historySurfaceSnapshot:u.history.snapshot,historySurfaceGeneration:i,historySurfaceLoadState:"ready",historySurfaceError:null,historySurfaceRecoveryCode:p,historySurfaceTruncated:u.history.truncated})}};return{surfaceCatalog:[],surfaceCatalogLoadState:"idle",surfaceCatalogError:null,historySurfaceSelection:null,historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceGeneration:0,historySurfaceLoadState:"idle",historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:!1,loadSurfaceCatalog:(u={})=>(s++,r={...u},n||(n=Promise.resolve().then(async()=>{try{let i;do{i=s;const d=r,p=t().catalogOverlayRevision??0;e({surfaceCatalogLoadState:"loading",surfaceCatalogError:null});try{const g=[];let f;do{const h=await D.listSurfaceCatalog({...d,cursor:f,limit:Fs});if(i!==s)break;for(const C of h.sessions){const S=g.findIndex(T=>Zt(T.locator,C.locator));S<0?g.push(C):g[S]=C}f=h.nextCursor}while(f);if(i!==s)continue;if((t().catalogOverlayRevision??0)!==p){s++;continue}e({surfaceCatalog:g,surfaceCatalogLoadState:"ready",surfaceCatalogError:null})}catch(g){if(i!==s)continue;e({surfaceCatalogLoadState:"error",surfaceCatalogError:Tt(g)})}}while(i!==s)}finally{n=null}}),n)),openHistorySurface:async(u,i=Fs)=>{if(u.workspace.kind==="local"){await t().selectSession({sessionId:u.sessionId,projectPath:u.workspace.projectPath});return}const{generation:d,controller:p}=k(),g=t().claimViewSelection();e({historySurfaceSelection:null,historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceGeneration:d,historySurfaceLoadState:"loading",historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:!1});try{const f=await D.openSurface(u,i,p.signal);if(g!==t().getViewSelectionVersion())return;c(f,d,u)}catch(f){if(d!==o||$t(f))return;e({historySurfaceLoadState:"error",historySurfaceError:Tt(f)})}},loadOlderSurfaceHistory:async(u=Fs)=>{var T;const i=t();if(i.historySurfaceSelection&&!i.historySurfaceSelection.capabilities.history.read){e({historySurfaceError:{code:"session_surface_capability_unavailable",message:"Session history read is unavailable"}});return}const d=(T=i.historySurfaceSelection)==null?void 0:T.locator,p=i.historySurfaceOlderCursor,g=i.historySurfaceSnapshot;if(!d||!p||!g)return;const f=qi(d);if(f)return f;const h=o,C=l;return C?zi(d,C.signal,async()=>{e({historySurfaceLoadState:"loading-older",historySurfaceError:null});try{const j=await Ui(C.signal,()=>D.loadSurfaceHistoryPage(d,p,g,u,C.signal));if(!m(h,d))return;if(j.snapshot!==g)throw new Error("Session history response snapshot mismatch");e(A=>({historySurfaceMessages:Ki(j.messages,A.historySurfaceMessages),historySurfaceOlderCursor:j.olderCursor??null,historySurfaceSnapshot:j.snapshot,historySurfaceLoadState:"ready",historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:A.historySurfaceTruncated||j.truncated}))}catch(j){if(!m(h,d)||$t(j))return;const A=Tt(j);if(A.code&&_i.has(A.code)){const w=A.code;e({historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceLoadState:"loading",historySurfaceError:null,historySurfaceRecoveryCode:w,historySurfaceTruncated:!1});try{const E=await D.openSurface(d,u,C.signal);c(E,h,d,w)}catch(E){if(!m(h,d)||$t(E))return;e({historySurfaceLoadState:"error",historySurfaceError:Tt(E)})}return}e({historySurfaceLoadState:"error",historySurfaceError:A})}}):void 0},forkHistorySurface:async()=>{const u=t().historySurfaceSelection,i=u==null?void 0:u.locator;if(!i)return;if(!u.capabilities.history.fork){e({historySurfaceError:{code:"session_surface_capability_unavailable",message:"Session history fork is unavailable"}});return}const{generation:d,controller:p}=k();e({historySurfaceGeneration:d,historySurfaceLoadState:"forking",historySurfaceError:null,historySurfaceRecoveryCode:null});try{const g=await D.forkSurface(i,p.signal);if(!Vi(i,g.session.locator))throw new Error("Forked Session workspace mismatch");c(g,d,g.session.locator),t().loadSurfaceCatalog()}catch(g){if(d!==o||$t(g))return;e({historySurfaceLoadState:"error",historySurfaceError:Tt(g)})}},closeHistorySurface:()=>{v(),e({historySurfaceSelection:null,historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceGeneration:o,historySurfaceLoadState:"idle",historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:!1})}}},Wi=(e,t)=>({messages:[],setMessages:s=>e({messages:s}),addMessage:s=>e(n=>({messages:[...n.messages,s]})),updateMessage:(s,n)=>e(r=>({messages:r.messages.map(o=>o.id===s?{...o,...n}:o)})),appendDelta:(s,n,r)=>e(o=>({messages:o.messages.map(l=>{if(l.id!==s)return l;const m=l.agentContent||Ue();return r==="before"?{...l,agentContent:{...Mn(m,n),textBefore:m.textBefore+n}}:{...l,agentContent:{...Mn(m,n),textAfter:m.textAfter+n}}})})),appendToolCall:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:uo(l,n)}})})),updateToolCall:(s,n,r)=>e(o=>({messages:o.messages.map(l=>{if(l.id!==s)return l;const m=l.agentContent;return m?{...l,agentContent:{...m,toolCalls:m.toolCalls.map(k=>k.toolCallId===n?{...k,...r}:k)}}:l})})),appendThinking:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...lo(l,n),thinkingContent:l.thinkingContent+n}}})})),setConfirmation:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...l,confirmation:n}}})})),setQuestion:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...l,question:n}}})})),setElicitation:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...l,elicitation:n}}})})),setSubagent:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:n?co(l,n):Nn(l,[])}})})),updateSubagent:(s,n,r)=>e(o=>({messages:o.messages.map(l=>{if(l.id!==s)return l;const m=l.agentContent||Ue(),k=[...io(m)],v=k.findIndex(i=>i.id===n||i.sessionId===n);if(v===-1)return l;const c=k[v],u=typeof r=="function"?r(c):r;return k[v]={...c,...u,id:c.id},{...l,agentContent:Nn(m,k,k[v].id)}})})),setTasks:(s,n)=>e(r=>({messages:r.messages.map(o=>{if(o.id!==s)return o;const l=o.agentContent||Ue();return{...o,agentContent:{...l,tasks:n}}})})),replaceTemp:(s,n)=>e(r=>{const o=r.messages.findIndex(m=>m.content===s&&m.role==="user");if(o===-1)return r;const l=[...r.messages];return l[o]=n,{messages:l}})}),Os=60,Gi=[/<system-reminder>[\s\S]*?<\/system-reminder>/gi,/<file[^>]*>[\s\S]*?<\/file>/gi,/<hooks_context>[\s\S]*?<\/hooks_context>/gi,/<[^>]+>/g];function Ji(e){let t=e;for(const k of Gi)t=t.replace(k," ");t=t.replace(/^\s*\/[a-zA-Z][\w-]*\s+/,"");const s=t.replace(/\s+/g," ").trim();if(!s)return"";const n=s.match(/^(.+?)(?:[.!?]\s|[。!?](?=\S|$)|$)/);let r=n&&n[1].length>=6?n[1]:s;if(r=r.trim().replace(/[\s.。!!??,,;;::-]+$/,""),r.length<=Os)return r;const o=r.slice(0,Os),l=o.lastIndexOf(" ");return`${(l>Os*.6?o.slice(0,l):o).trimEnd()}…`}const es="/.blade/worktrees/",Yi=/-[a-f0-9]{8,}$/i,Xi=/^(.+?(?:test|config))-[a-z0-9]{6,}$/i;function Zi(e){const t=e.indexOf(es);if(t<0)return null;const s=e.slice(t+es.length).split("/")[0];return s?`${e.slice(0,t+es.length)}${s}`:null}function ec(e){if(!e.includes("/tmp/")&&!e.includes("/T/"))return null;const t=e.split("/"),s=t.at(-1),n=s==null?void 0:s.match(Xi);return n!=null&&n[1]?(t[t.length-1]=n[1],t.join("/")):null}function Gn(e){const t=e.split("/").filter(Boolean).at(-1)||e;return e.includes(es)?t.replace(Yi,""):t}function fs(e,t=null){const s=e.taskSourceProjectPath,n=ec(s||e.projectPath);if(n)return n;if(s)return s;const r=Zi(e.projectPath);if(!r)return e.projectPath;const o=Gn(r);return t&&o===Gn(t)?t:r}function tc(e,t,s=null){return t?e.filter(n=>fs(n,s)===t):e}const Ys=Ze.AUTO_EDIT;let Hs=0;const Te=ps((e,t)=>({currentModelId:null,currentMode:Ys,configuredModels:[],availableModels:[],isLoading:!1,hasLoaded:!1,loadedWorkspacePath:null,error:null,loadModels:async s=>{const n=s??null;if(t().isLoading&&t().loadedWorkspacePath===n)return;const r=++Hs;e({isLoading:!0,hasLoaded:!1,loadedWorkspacePath:n,error:null});try{const o=await Pe("/models",s?{headers:{"x-blade-directory":s}}:void 0);if(r!==Hs||t().loadedWorkspacePath!==n)return;const l=o.current;e({currentModelId:(l==null?void 0:l.id)||null,configuredModels:o.configured||[],availableModels:o.available||[],isLoading:!1,hasLoaded:!0})}catch(o){if(r!==Hs||t().loadedWorkspacePath!==n)return;e({error:o instanceof Error?o.message:"Failed to load models",isLoading:!1,hasLoaded:!0})}},setCurrentModel:async(s,n)=>{if(e({error:null}),n){e({currentModelId:s});return}try{await Pe("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:{currentModelId:s},options:{scope:"global"}})}),e({currentModelId:s})}catch(r){throw e({error:r instanceof Error?r.message:"Failed to set model"}),r}},setMode:s=>e({currentMode:s}),resetMode:()=>e({currentMode:Ys})})),sc=e=>e==="system"?typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",ts=e=>{if(typeof document>"u")return;const t=document.documentElement;if(t.classList.remove("light","dark"),e==="system"){const n=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";t.classList.add(n)}else t.classList.add(e)},Fe={language:"zh-CN",codeTheme:"dracula",uiTheme:"system",autoSaveSessions:!0,notifyBuild:!0,notifyErrors:!1,notifySounds:!1,privacyTelemetry:!1,privacyCrash:!0,agentTeamsEnabled:!1,communicationStyle:"auto"},ut=ps((e,t)=>({...Fe,isLoading:!1,error:null,loadSettings:async()=>{e({isLoading:!0,error:null});try{const s=await fetch("/configs");if(!s.ok)throw new Error(pe("settings.general.loadError"));const n=await s.json(),r=n.uiTheme??Fe.uiTheme;e({language:n.language??Fe.language,codeTheme:n.codeTheme??Fe.codeTheme,uiTheme:r,autoSaveSessions:n.autoSaveSessions??Fe.autoSaveSessions,notifyBuild:n.notifyBuild??Fe.notifyBuild,notifyErrors:n.notifyErrors??Fe.notifyErrors,notifySounds:n.notifySounds??Fe.notifySounds,privacyTelemetry:n.privacyTelemetry??Fe.privacyTelemetry,privacyCrash:n.privacyCrash??Fe.privacyCrash,agentTeamsEnabled:n.agentTeamsEnabled??Fe.agentTeamsEnabled,communicationStyle:n.communicationStyle??Fe.communicationStyle,isLoading:!1}),ts(r)}catch(s){e({error:s.message,isLoading:!1})}},updateSettings:async s=>{const n=t();e({...s,error:null}),s.uiTheme&&ts(s.uiTheme);try{if(!(await fetch("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:s,options:{scope:"global"}})})).ok)throw new Error(pe("settings.general.saveError"))}catch(r){e({language:n.language,codeTheme:n.codeTheme,uiTheme:n.uiTheme,autoSaveSessions:n.autoSaveSessions,notifyBuild:n.notifyBuild,notifyErrors:n.notifyErrors,notifySounds:n.notifySounds,privacyTelemetry:n.privacyTelemetry,privacyCrash:n.privacyCrash,agentTeamsEnabled:n.agentTeamsEnabled,communicationStyle:n.communicationStyle,error:r.message}),s.uiTheme&&ts(n.uiTheme)}}}));ts(Fe.uiTheme);const Bl=()=>ut(e=>sc(e.uiTheme)),Ls="__temp__",Et={inputTokens:0,outputTokens:0,totalTokens:0,maxContextTokens:0,isDefaultMaxTokens:!0,totalInputTokens:0,totalOutputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0},La="blade.tasks.unread",Da="blade.tasks.terminal-read-ledger.v1",nc=16384,ac=1024,rs="blade:open-session";function dn(e){return e==="completed"||e==="failed"||e==="interrupted"}function Kt(){return{version:1,entries:[]}}function Ua(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}function os(e){var t;return dn(e.taskStatus)?JSON.stringify([e.taskStatus,Ua(e.taskCompletedAt),sn((t=e.taskFailure)==null?void 0:t.code)??null]):null}function qa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rc(e){if(e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e))return!0;if(!e.startsWith("\\\\"))return!1;const[t,s]=e.slice(2).split(/[\\/]/);return!!(t&&s)}function oc(e){if(e.length===0||e.length>nc)return!1;try{const t=JSON.parse(e);return!Array.isArray(t)||t.length!==2||typeof t[0]!="string"||typeof t[1]!="string"||!rc(t[0])||t[1].length===0?!1:ce({projectPath:t[0],sessionId:t[1]})===e}catch{return!1}}function ic(e){try{const t=JSON.parse(e);if(!Array.isArray(t)||t.length!==3||!dn(t[0]))return!1;const s=t[1];if(s!==null&&(typeof s!="string"||Ua(s)!==s))return!1;const n=t[2]===null?null:sn(t[2])??void 0;return n===void 0?!1:JSON.stringify([t[0],s,n])===e}catch{return!1}}function cc(e){return!qa(e)||typeof e.key!="string"||!oc(e.key)||e.signature!==null&&(typeof e.signature!="string"||!ic(e.signature))?null:{key:e.key,signature:e.signature}}function lc(e=typeof localStorage>"u"?null:localStorage){if(!e)return Kt();try{const t=e.getItem(Da);if(t===null)return Kt();const s=JSON.parse(t);if(!qa(s)||s.version!==1||!Array.isArray(s.entries))return Kt();const n=new Map;for(const r of s.entries){const o=cc(r);o&&(n.delete(o.key),n.set(o.key,o))}return{version:1,entries:[...n.values()]}}catch{return Kt()}}function it(e,t=typeof localStorage>"u"?null:localStorage){if(t)try{t.setItem(Da,JSON.stringify(e))}catch{}}function gt(e,t,s){const n=ce(t);return{version:1,entries:[...e.entries.filter(r=>r.key!==n),{key:n,signature:os(s)}]}}function dc(e){const t=new Set(e.sessions.map(l=>ce({sessionId:l.sessionId,projectPath:l.projectPath}))),s=new Set(e.unreadTaskKeys),n=e.ledger.entries.filter(l=>t.has(l.key)),r=n.filter(l=>l.signature!==null&&!s.has(l.key)),o=new Set(r.slice(0,Math.max(0,r.length-ac)));return{version:1,entries:n.filter(l=>!o.has(l))}}function uc(e){var k;const t=new Map;for(const v of e.ledger.entries)t.delete(v.key),t.set(v.key,v);const s=new Set(e.unreadTaskKeys),n=e.documentVisible&&e.currentSessionRef?ce(e.currentSessionRef):null,r=(v,c)=>{t.delete(v),t.set(v,{key:v,signature:c})};for(const v of e.sessions){const c=ce({sessionId:v.sessionId,projectPath:v.projectPath}),u=os(v);if(!t.has(c)){r(c,u),n===c&&s.delete(c);continue}if(n===c){r(c,u),s.delete(c);continue}if(u===null){r(c,null);continue}((k=t.get(c))==null?void 0:k.signature)!==u&&s.add(c)}const o=new Set(e.sessions.map(v=>ce({sessionId:v.sessionId,projectPath:v.projectPath}))),l=[...s].filter(v=>o.has(v));return{ledger:dc({ledger:{version:1,entries:[...t.values()]},sessions:e.sessions,unreadTaskKeys:l}),unreadTaskKeys:l}}function pc(e=typeof localStorage>"u"?null:localStorage){if(!e)return[];try{const t=JSON.parse(e.getItem(La)??"[]");return Array.isArray(t)?[...new Set(t.filter(s=>typeof s=="string"))]:[]}catch{return[]}}function ct(e,t=typeof localStorage>"u"?null:localStorage){if(t)try{t.setItem(La,JSON.stringify([...new Set(e)]))}catch{}}function Jn(e){if(typeof document>"u"||document.visibilityState!=="hidden"||typeof Notification>"u"||Notification.permission!=="granted")return!1;const t=new Notification(e.title,{body:e.body,icon:"/favicon.svg",tag:`blade-task-${ce(e.ref)}`});return t.onclick=()=>e.onOpen(e.ref),!0}function hc(e){if(typeof window>"u")return!1;const t=window.AudioContext??window.webkitAudioContext;if(!t)return!1;try{const s=new t,n=s.createOscillator(),r=s.createGain();return n.type="sine",n.frequency.value=e==="completed"?660:330,r.gain.setValueAtTime(1e-4,s.currentTime),r.gain.exponentialRampToValueAtTime(.045,s.currentTime+.015),r.gain.exponentialRampToValueAtTime(1e-4,s.currentTime+.18),n.connect(r),r.connect(s.destination),n.start(),n.stop(s.currentTime+.2),n.onended=()=>void s.close(),!0}catch{return!1}}const mc=e=>{var s;const t=[];e.content.trim()&&t.push({type:"text",text:e.content});for(const n of e.attachments??[])n.type==="image"&&t.push({type:"image_url",image_url:{url:n.content}});return t.length===0?e.content:t.length===1&&((s=t[0])==null?void 0:s.type)==="text"?t[0].text:t},gc=(e,t,s)=>{if(!s)return e;const n=t.find(v=>{var u,i,d;const c=v.agentContent;if(!c)return!1;switch(s.type){case"permission":return((u=c.confirmation)==null?void 0:u.toolCallId)===s.requestId&&c.confirmation.status==="pending";case"question":return((i=c.question)==null?void 0:i.toolCallId)===s.requestId&&c.question.status==="pending";case"elicitation":return((d=c.elicitation)==null?void 0:d.toolCallId)===s.requestId&&c.elicitation.status==="pending"}});if(!(n!=null&&n.agentContent))return e;const r=e.findIndex(v=>v.id===n.id),l=e[r]??{id:n.id,role:"assistant",content:"",timestamp:n.timestamp};let m=l.agentContent??Ue();switch(s.type){case"permission":m={...m,confirmation:n.agentContent.confirmation};break;case"question":m={...m,question:n.agentContent.question};break;case"elicitation":m={...m,elicitation:n.agentContent.elicitation};break}const k={...l,agentContent:m};return r<0?[...e,k]:e.map((v,c)=>c===r?k:v)},Vt=()=>({eventUnsubscribe:null,sessionEventConnectionState:"idle",isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1}),Je=()=>({followUpQueue:null,followUpQueueMutation:{pending:!1,supersededVersions:[]}}),Yn=()=>new Promise(e=>{globalThis.setTimeout(()=>{if(typeof window<"u"&&typeof window.requestIdleCallback=="function"){window.requestIdleCallback(()=>e(),{timeout:750});return}e()},350)});function Ye(e){return e??{version:1,entries:[]}}function Xn(e,t,s){let n=[...e];for(const[r,o]of Object.entries(t))o.revision<=s||(o.kind==="remove"?n=n.filter(l=>ce(ee(l))!==r):n=Ae(n,o.session));return n}function fc(e,t){return Object.fromEntries(Object.entries(e).filter(([,s])=>s.revision>t))}const Zn=async e=>(await Be(async()=>{const{teamService:t}=await import("./teamService-T8g5BXdN.js");return{teamService:t}},__vite__mapDeps([0,1,2,3]))).teamService.list(e),kc=(e,t)=>{let s=0,n=0,r=0,o=0;const l=new Map,m=new Map;let k=null;const v=()=>(k==null||k.abort("session-navigation"),k=null,s+=1,s),c=i=>i===s,u=i=>{try{i()}catch(d){console.warn("Failed to clean up stale event subscription",d)}};return{sessions:[],archivedSessions:[],currentSessionId:null,currentSessionRef:null,forkingSessionRef:null,isTemporarySession:!1,isLoading:!1,catalogLoadState:"idle",catalogError:null,archivedCatalogLoadState:"idle",archivedCatalogError:null,error:null,errorContext:null,goal:null,sideConversation:null,...Je(),teams:[],setSessions:i=>e({sessions:i}),addSession:i=>{e(d=>({sessions:Ae(d.sessions,i)})),t().loadSurfaceCatalog()},removeSession:i=>{const d=t(),p=ce(i),g=V(d.currentSessionRef,i),f=V(d.forkingSessionRef,i);(g||f)&&v(),g&&d.unsubscribeFromEvents();let h=d.unreadTaskKeys,C=Ye(d.taskTerminalReadLedger);e(S=>{const T={...S.sessionCatalogOverlays};return delete T[p],h=S.unreadTaskKeys.filter(j=>j!==p),C={version:1,entries:Ye(S.taskTerminalReadLedger).entries.filter(j=>j.key!==p)},{sessions:Wn(S.sessions,i),surfaceCatalog:S.surfaceCatalog.filter(j=>j.locator.workspace.kind!=="local"||j.locator.workspace.projectPath!==i.projectPath||j.locator.sessionId!==i.sessionId),unreadTaskKeys:h,taskTerminalReadLedger:C,sessionCatalogOverlays:T,currentSessionId:g?null:S.currentSessionId,currentSessionRef:g?null:S.currentSessionRef,messages:g?[]:S.messages,goal:g?null:S.goal,sideConversation:g?null:S.sideConversation,teams:g?[]:S.teams,forkingSessionRef:f?null:S.forkingSessionRef,...g?Je():{},...g?Vt():{}}}),it(C),ct(h)},setCurrentSession:i=>{v(),t().claimViewSelection(),t().closeHistorySurface(),e({currentSessionId:(i==null?void 0:i.sessionId)??null,currentSessionRef:i,isTemporarySession:!1,sideConversation:null,teams:[],pendingResume:null,...Je()})},setTemporarySession:i=>e({isTemporarySession:i}),setLoading:i=>e({isLoading:i}),setError:i=>e({error:i,errorContext:null}),getNavigationVersion:()=>s,getViewSelectionVersion:()=>n,claimViewSelection:()=>(n+=1,n),clearError:()=>e({error:null,errorContext:null}),setGoal:i=>e({goal:i}),startTemporarySession:i=>{v(),t().claimViewSelection(),t().closeHistorySurface(),t().unsubscribeFromEvents(),Te.getState().resetMode(),i&&t().selectProject(i),e({currentSessionId:Ls,currentSessionRef:null,isTemporarySession:!0,forkingSessionRef:null,isLoading:!1,messages:[],goal:null,sideConversation:null,teams:[],tokenUsage:{...Et},error:null,errorContext:null,...Je(),...Vt()})},loadSessions:async()=>{const i=++r,d=t().sessions,p=t().catalogOverlayRevision??0;let g=[];e({catalogLoadState:"loading",catalogError:null});try{let f;do{const S=await D.listSessionPage(f);if(i!==r)return;for(const T of S.sessions)g=Ae(g,T);if(e(T=>{const j=new Set(g.map(w=>ce(ee(w)))),A=[...g,...d.filter(w=>!j.has(ce(ee(w))))];return{sessions:Xn(A,T.sessionCatalogOverlays??{},p),catalogLoadState:"hydrating"}}),f=S.nextCursor,f&&(await Yn(),i!==r))return}while(f);if(i!==r)return;let h=t().unreadTaskKeys,C=Ye(t().taskTerminalReadLedger);e(S=>{const T=Xn(g,S.sessionCatalogOverlays??{},p),j=uc({ledger:Ye(S.taskTerminalReadLedger),unreadTaskKeys:S.unreadTaskKeys,sessions:T,currentSessionRef:S.currentSessionRef,documentVisible:typeof document<"u"&&document.visibilityState==="visible"});return h=j.unreadTaskKeys,C=j.ledger,{sessions:T,unreadTaskKeys:h,taskTerminalReadLedger:C,sessionCatalogOverlays:fc(S.sessionCatalogOverlays??{},p),catalogLoadState:"ready",catalogError:null}}),it(C),ct(h)}catch(f){if(i!==r)return;e({catalogLoadState:"error",catalogError:f.message})}},loadArchivedSessions:async()=>{const i=++o;e({archivedCatalogLoadState:"loading",archivedCatalogError:null});try{let d;const p=[];do{const g=await D.listSessionPage(d,50,!0);if(i!==o)return;for(const f of g.sessions){const h=p.findIndex(C=>V(ee(C),ee(f)));h===-1?p.push(f):p[h]=f}d=g.nextCursor,d&&(e({archivedCatalogLoadState:"hydrating"}),await Yn())}while(d);if(i!==o)return;e({archivedSessions:p,archivedCatalogLoadState:"ready",archivedCatalogError:null})}catch(d){if(i!==o)return;e({archivedCatalogLoadState:"error",archivedCatalogError:d.message})}},selectSession:async i=>{var f;const d=v(),p=t().claimViewSelection();t().closeHistorySurface(),e({isLoading:!0,error:null,errorContext:null,forkingSessionRef:null});let g=null;try{const h=as(t().sessions,i),C=[];let S=!1;if(g=await t().prepareEventSubscription(i,x=>{S?t().handleEvent(x):C.push(x)}),!c(d)||p!==t().getViewSelectionVersion()){u(g),g=null;return}const[T,j,A,w]=await Promise.all([D.getMessages(i),D.getGoal(i).catch(()=>null),h?Promise.resolve(h):D.getSession(i),ut.getState().agentTeamsEnabled?Zn(i).catch(()=>[]):Promise.resolve([])]);if(!c(d)||p!==t().getViewSelectionVersion()){u(g),g=null;return}const E=Bt(T),F=fs(A,t().selectedProjectPath??((f=t().taskWorkspaceInfo)==null?void 0:f.cwd)??null);t().boundProjects.some(x=>x.available&&x.path===F)&&t().selectProject(F),Te.getState().setMode(A.permissionMode??Ys),e(x=>{var N;return{currentSessionId:i.sessionId,currentSessionRef:i,isTemporarySession:!1,messages:E,goal:j,teams:w,...Je(),isLoading:!1,tokenUsage:{...Et},isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1,error:A.taskStatus==="failed"?((N=A.taskFailure)==null?void 0:N.message)??null:null,errorContext:A.taskStatus==="failed"&&A.taskFailure?{kind:"execution",sessionRef:i,failureCode:A.taskFailure.code}:null,sessions:Ae(x.sessions,A)}}),t().markTaskRead(i),S=!0,t().replaceEventSubscription(g),g=null;for(const x of C)t().handleEvent(x)}catch(h){if(g&&u(g),!c(d)||p!==t().getViewSelectionVersion())return;e({error:h.message,errorContext:{kind:"navigation",sessionRef:i},isLoading:!1})}},resyncSessionMessages:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const d=ce(i),p=l.get(d);if(p)return p;const g=s,f=Promise.resolve().then(async()=>{try{const h=await D.getMessages(i);if(!c(g)||!V(t().currentSessionRef,i))return;const C=Bt(h);e(S=>{var T;return{messages:gc(C,S.messages,(T=as(S.sessions,i))==null?void 0:T.pendingInteraction),sessions:S.sessions.map(j=>V(ee(j),i)?{...j,messageCount:C.length}:j)}})}catch(h){console.warn("Failed to resync terminal session messages",h)}finally{l.get(d)===f&&l.delete(d)}});return l.set(d,f),f},archiveSession:async i=>{var d;if(W(t().historySurfaceSelection)){e({error:re});return}try{const p=await D.archiveSession(i),g=new Set(p.archivedSessionIds),f=t(),h=((d=f.currentSessionRef)==null?void 0:d.projectPath)===i.projectPath&&g.has(f.currentSessionRef.sessionId);h&&(v(),f.unsubscribeFromEvents());let C=f.unreadTaskKeys,S=Ye(f.taskTerminalReadLedger);if(e(T=>{const j=new Set(p.archivedSessionIds.map(F=>ce({sessionId:F,projectPath:i.projectPath}))),A=T.sessions.filter(F=>F.projectPath!==i.projectPath||!g.has(F.sessionId));C=T.unreadTaskKeys.filter(F=>!j.has(F)),S={version:1,entries:Ye(T.taskTerminalReadLedger).entries.filter(F=>!j.has(F.key))};const w=(T.catalogOverlayRevision??0)+1,E={...T.sessionCatalogOverlays};for(const F of j)E[F]={revision:w,kind:"remove"};return{sessions:A,surfaceCatalog:T.surfaceCatalog.filter(F=>F.locator.workspace.kind!=="local"||F.locator.workspace.projectPath!==i.projectPath||!g.has(F.locator.sessionId)),archivedSessions:Ae(T.archivedSessions,p.session),unreadTaskKeys:C,taskTerminalReadLedger:S,catalogOverlayRevision:w,sessionCatalogOverlays:E,currentSessionId:h?null:T.currentSessionId,currentSessionRef:h?null:T.currentSessionRef,messages:h?[]:T.messages,goal:h?null:T.goal,...h?Je():{},...h?Vt():{}}}),it(S),ct(C),W(t().historySurfaceSelection))return;await t().loadArchivedSessions()}catch(p){e({error:p.message,errorContext:{kind:"task_action",sessionRef:i}})}},unarchiveSession:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}try{const d=await D.unarchiveSession(i),p=new Set(d.restoredSessionIds);if(e(g=>{const f=(g.catalogOverlayRevision??0)+1,h=ce(ee(d.session));return{archivedSessions:g.archivedSessions.filter(C=>C.projectPath!==i.projectPath||!p.has(C.sessionId)),sessions:Ae(g.sessions,d.session),catalogOverlayRevision:f,sessionCatalogOverlays:{...g.sessionCatalogOverlays,[h]:{revision:f,kind:"upsert",session:d.session}}}}),W(t().historySurfaceSelection))return;await Promise.all([t().loadSessions(),t().loadArchivedSessions(),t().loadSurfaceCatalog()])}catch(d){e({error:d.message,errorContext:{kind:"task_action",sessionRef:i}})}},deleteSession:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const d=t(),p=V(d.currentSessionRef,i),g=V(d.forkingSessionRef,i),f=p||g?v():null,h=p?f:null;g&&e({forkingSessionRef:null});try{await D.deleteSession(i);const C=t(),S=V(C.currentSessionRef,i)&&(h===null||c(h));S&&(v(),C.unsubscribeFromEvents());const T=ce(i);let j=C.unreadTaskKeys,A=Ye(C.taskTerminalReadLedger);e(w=>{const E=(w.catalogOverlayRevision??0)+1;return j=w.unreadTaskKeys.filter(F=>F!==T),A={version:1,entries:Ye(w.taskTerminalReadLedger).entries.filter(F=>F.key!==T)},{sessions:Wn(w.sessions,i),surfaceCatalog:w.surfaceCatalog.filter(F=>F.locator.workspace.kind!=="local"||F.locator.workspace.projectPath!==i.projectPath||F.locator.sessionId!==i.sessionId),unreadTaskKeys:j,taskTerminalReadLedger:A,catalogOverlayRevision:E,sessionCatalogOverlays:{...w.sessionCatalogOverlays,[T]:{revision:E,kind:"remove"}},currentSessionId:S?null:w.currentSessionId,currentSessionRef:S?null:w.currentSessionRef,messages:S?[]:w.messages,goal:S?null:w.goal,...S?Je():{},...S?Vt():{}}}),it(A),ct(j)}catch(C){if(h!==null&&(!c(h)||!V(t().currentSessionRef,i)))return;e({error:C.message})}},updateSession:async(i,d)=>{if(W(t().historySurfaceSelection)){e({error:re});return}try{await D.updateSession(i,d),e(p=>({sessions:p.sessions.map(g=>g.sessionId===i.sessionId&&g.projectPath===i.projectPath?{...g,title:d}:g)}))}catch(p){e({error:p.message})}},forkSession:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const d=v(),p=t().claimViewSelection();t().closeHistorySurface();const g=ee(i);e({forkingSessionRef:g,isLoading:!1,error:null});let f=null;try{const h=await D.forkSession(i),C=ee(h.session),S=Bt(h.messages);if(e(T=>({sessions:Ae(T.sessions,h.session)})),t().loadSurfaceCatalog(),!c(d)||p!==t().getViewSelectionVersion())return;if(f=await t().prepareEventSubscription(C),!c(d)||p!==t().getViewSelectionVersion()){u(f),f=null;return}e({currentSessionId:C.sessionId,currentSessionRef:C,isTemporarySession:!1,messages:S,goal:null,...Je(),tokenUsage:{...Et},error:null,forkingSessionRef:null}),t().replaceEventSubscription(f),f=null}catch(h){if(f&&u(f),!c(d)||p!==t().getViewSelectionVersion())return;e({error:h.message,forkingSessionRef:null})}},rewindSession:async(i,d)=>{if(W(t().historySurfaceSelection))return e({error:re}),!1;const{currentSessionRef:p,isTemporarySession:g,isStreaming:f}=t();if(!p||g)return e({error:"No persisted session is available for rewind"}),!1;if(f)return e({error:"Stop the active run before rewinding"}),!1;const h=s;try{const C=await D.rewindSession(p,i,d);if(!c(h)||!V(t().currentSessionRef,p))return!1;const S=Bt(C.messages);return e(T=>({messages:S,tokenUsage:{...Et},error:null,currentRunId:null,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1,sessions:T.sessions.map(j=>j.sessionId===p.sessionId&&j.projectPath===p.projectPath?{...j,messageCount:S.length}:j)})),!0}catch(C){return!c(h)||!V(t().currentSessionRef,p)||e({error:C.message}),!1}},sendMessage:async i=>{var B,U,_,Q,Z,ne;if(W(t().historySurfaceSelection))return e({error:re}),!1;const{currentSessionId:d,currentSessionRef:p,isTemporarySession:g,isStreaming:f,addSession:h,addMessage:C}=t(),S=s,T=p,j={isStreaming:f,agentPhase:t().agentPhase,currentRunId:t().currentRunId};let A=p,w=d,E=T,F=null,x=null;const N=()=>c(S)&&V(t().currentSessionRef,E)&&!W(t().historySurfaceSelection),P=po(i.content);if(P){if((((B=i.attachments)==null?void 0:B.length)??0)>0)return e({error:"Side conversations do not accept image attachments"}),!1;if(!P.question)return e({error:"Usage: /btw <question>"}),!1;if(g||!A||!w)return e({error:"Start or select a Session before using /btw"}),!1;k==null||k.abort("side-conversation-replaced");const K=new AbortController;k=K;const $=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;e({sideConversation:{requestId:$,sessionRef:A,question:P.question,status:"loading"},error:null,errorContext:null});try{const R=await D.askSideQuestion(A,P.question,K.signal);return K.signal.aborted||!N()||((U=t().sideConversation)==null?void 0:U.requestId)!==$?!1:(e({sideConversation:{requestId:$,sessionRef:A,question:P.question,status:"completed",response:R.response,durationMs:R.durationMs,modelId:R.modelId}}),R.usage&&t().updateTokenUsage({inputTokens:R.usage.promptTokens,outputTokens:R.usage.completionTokens,totalTokens:R.usage.totalTokens,cacheReadTokens:R.usage.cacheReadInputTokens??0,cacheWriteTokens:R.usage.cacheCreationInputTokens??0,costUsd:R.usage.costUsd}),!0)}catch(R){return K.signal.aborted||!N()||e({sideConversation:{requestId:$,sessionRef:A,question:P.question,status:"error",error:R instanceof Error?R.message:String(R)}}),!1}finally{k===K&&(k=null)}}if(k==null||k.abort("main-conversation-submitted"),k=null,e({sideConversation:null,pendingResume:null}),g||!w||w===Ls)try{const K=Ji(i.content),$=await D.createSession(t().selectedProjectPath??((_=t().taskWorkspaceInfo)==null?void 0:_.cwd)??void 0,K||void 0);if(h($),!N())return!1;A=ee($),w=$.sessionId,e({currentSessionId:$.sessionId,currentSessionRef:A,isTemporarySession:!1}),E=A}catch(K){return N()&&e({error:K.message}),!1}if(!A||!w||w===Ls)return N()&&e({error:"Failed to create session"}),!1;try{if(!f){if(F=await t().prepareEventSubscription(A),!N())return u(F),F=null,!1;t().replaceEventSubscription(F),F=null}if(!N())return!1;const K=i.content.trim();if(K.startsWith("!")){if((((Q=i.attachments)==null?void 0:Q.length)??0)>0)throw new Error("User shell commands do not accept image attachments");const Y=K.slice(1).trim();if(!Y)throw new Error("User shell command cannot be empty");f||e({isStreaming:!0,agentPhase:"running",error:null,errorContext:null});const ue=await D.executeUserShellCommand(A,Y);return N()?(ue.auxiliary||e({isStreaming:!1,agentPhase:"idle",pendingResume:null}),ue.delivery&&e({pendingSteeringCount:ue.queued??0,pendingInputDelivery:ue.delivery==="current_turn"?"current_turn":"next_turn"}),!0):!1}if((((Z=i.attachments)==null?void 0:Z.length)??0)===0&&(K==="/goal"||K.startsWith("/goal "))){x=`goal-command-${Date.now()}`,C({id:x,role:"user",content:K,timestamp:Date.now()});const Y=K.slice(5).trim().split(/\s+/).filter(Boolean),ue=(ne=Y[0])==null?void 0:ne.toLowerCase();if(!ue||ue==="status"){const I=await D.getGoal(A);return N()&&e({goal:I}),N()}if(ue==="clear")return await D.clearGoal(A),N()&&e({goal:null}),N();let he;if(ue==="pause")he=await D.updateGoal(A,{action:"pause"});else if(ue==="resume")he=await D.updateGoal(A,{action:"resume"});else if(ue==="edit"){const I=Y.slice(1).join(" ").trim();if(!I)throw new Error("Usage: /goal edit <objective>");he=await D.updateGoal(A,{action:"edit",objective:I})}else{const I=Y.lastIndexOf("--budget");let q;if(I>=0){const fe=Y[I+1];if(!fe||!/^[1-9]\d*$/.test(fe))throw new Error("--budget requires a positive integer");q=Number(fe),Y.splice(I,2)}const ie=Y.join(" ").trim();if(!ie)throw new Error("Usage: /goal <objective>");const{currentMode:Ce}=Te.getState();he=await D.createGoal(A,ie,q,Ce)}return N()?(e({goal:he.goal,...he.runId?{currentRunId:he.runId,isStreaming:!0,agentPhase:"running"}:{}}),!0):!1}f||(x=`temp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,C({id:x,role:"user",content:mc(i),timestamp:Date.now()})),e({isStreaming:!0,error:null,errorContext:null,recoveredSteeringCount:f?t().recoveredSteeringCount:0});const{currentMode:$,currentModelId:R}=Te.getState(),{modelId:le,...ge}=i,ve=le??R??void 0,xe=i.reasoningEffort,Re=i.serviceTier,Se=i.responseVerbosity,Le=i.communicationStyle,de=ve&&!f?{...ge,modelId:ve}:ge,J=await D.sendMessage(A,de,$);return N()?(e(Y=>({currentRunId:J.runId,pendingSteeringCount:J.followUpQueue?J.followUpQueue.pending:J.status==="steering_queued"||J.status==="follow_up_queued"?Math.max(0,J.queued??1):Y.pendingSteeringCount,pendingInputDelivery:J.status==="steering_queued"?"current_turn":J.status==="follow_up_queued"?"next_turn":Y.pendingInputDelivery,...J.followUpQueue?{followUpQueue:J.followUpQueue}:{},...J.followUpQueue?{followUpQueueMutation:{pending:!1,supersededVersions:Y.followUpQueue?[...Y.followUpQueueMutation.supersededVersions,Y.followUpQueue.version].slice(-16):Y.followUpQueueMutation.supersededVersions}}:{},sessions:(ve||xe||Re||Se||Le)&&!f?Y.sessions.map(ue=>ue.sessionId===A.sessionId&&ue.projectPath===A.projectPath?{...ue,...ve?{selectedModelId:ve}:{},...xe?{reasoningEffort:xe}:{},...Re?{serviceTier:Re}:{},...Se?{responseVerbosity:Se}:{},...Le?{communicationStyle:Le}:{}}:ue):Y.sessions})),!0):!1}catch(K){if(F&&u(F),!N())return!1;if(x&&!t().messages.some(R=>R.id===x)&&!Gs(K))return!0;const $=Gs(K)&&K.code==="SESSION_WORKSPACE_UNAVAILABLE"?"workspace_unavailable":void 0;return e(R=>({error:K.message,errorContext:{kind:"submission",sessionRef:A,...$?{failureCode:$}:{}},messages:x?R.messages.filter(le=>le.id!==x):R.messages,...j})),!1}},refreshFollowUpQueue:async()=>{var g,f;const i=t().currentSessionRef;if(!i||W(t().historySurfaceSelection))return;const d=s,p=(g=t().followUpQueue)==null?void 0:g.version;try{const h=await D.getFollowUpQueue(i),C=t();c(d)&&V(C.currentSessionRef,i)&&((f=C.followUpQueue)==null?void 0:f.version)===p&&e(S=>({followUpQueue:h,followUpQueueMutation:{pending:S.followUpQueueMutation.pending,supersededVersions:S.followUpQueue?[...S.followUpQueueMutation.supersededVersions,S.followUpQueue.version].slice(-16):S.followUpQueueMutation.supersededVersions}}))}catch(h){c(d)&&V(t().currentSessionRef,i)&&e(C=>({followUpQueueMutation:{pending:C.followUpQueueMutation.pending,errorMessage:h instanceof Error?h.message:String(h),supersededVersions:C.followUpQueueMutation.supersededVersions}}))}},mutateFollowUpQueue:async i=>{const d=t(),p=d.currentSessionRef,g=d.followUpQueue;if(!p||!g||d.followUpQueueMutation.pending||W(d.historySurfaceSelection))return!1;const f=s;e({followUpQueueMutation:{pending:!0,messageId:i.messageId,supersededVersions:d.followUpQueueMutation.supersededVersions}});try{const h=await D.mutateFollowUpQueue(p,{expectedVersion:g.version,operation:i});return!c(f)||!V(t().currentSessionRef,p)?!1:(e(C=>{var j;const S=(j=C.followUpQueue)==null?void 0:j.version,T=S===g.version||S===h.version;return{...T?{followUpQueue:h}:{},followUpQueueMutation:{pending:!1,supersededVersions:[...C.followUpQueueMutation.supersededVersions,g.version,...T?[]:[h.version]].slice(-16)}}}),!0)}catch(h){return!c(f)||!V(t().currentSessionRef,p)?!1:Pi(h)?(e(C=>{var j;const S=(j=C.followUpQueue)==null?void 0:j.version,T=S===g.version||S===h.snapshot.version;return{...T?{followUpQueue:h.snapshot}:{},followUpQueueMutation:{pending:!1,errorCode:h.code,errorMessage:h.message,supersededVersions:[...C.followUpQueueMutation.supersededVersions,g.version,...T?[]:[h.snapshot.version]].slice(-16)}}}),!1):(e({followUpQueueMutation:{pending:!1,errorMessage:h instanceof Error?h.message:String(h),supersededVersions:d.followUpQueueMutation.supersededVersions}}),!1)}},dismissSideConversation:()=>{k==null||k.abort("side-conversation-dismissed"),k=null,e({sideConversation:null})},loadTeams:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const d=i??t().currentSessionRef;if(!d||!ut.getState().agentTeamsEnabled){e({teams:[]});return}const p=ce(d),g=m.get(p);if(g)return g;let f;f=(async()=>{try{const h=await Zn(d);if(!V(t().currentSessionRef,d))return;e({teams:h})}catch{V(t().currentSessionRef,d)&&e({teams:[]})}finally{m.get(p)===f&&m.delete(p)}})(),m.set(p,f),await f},abortSession:async()=>{if(W(t().historySurfaceSelection))return e({error:re}),!1;const{currentSessionRef:i,isStopping:d}=t();if(!i||d)return!1;e({isStopping:!0,error:null,errorContext:null});try{return await D.abortSession(i),!V(t().currentSessionRef,i)||(await t().resyncSessionMessages(i),!V(t().currentSessionRef,i))?!1:(t().unsubscribeFromEvents(),e({isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1}),!0)}catch(p){return V(t().currentSessionRef,i)&&e({isStopping:!1,error:p instanceof Error?p.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:i}}),!1}},pauseGoal:async()=>{if(W(t().historySurfaceSelection)){e({error:re});return}const{currentSessionRef:i,isTemporarySession:d}=t();if(!i||d){e({error:"No persisted session is available for this goal"});return}try{const p=await D.updateGoal(i,{action:"pause"});if(!V(t().currentSessionRef,i))return;e({goal:p.goal,error:null})}catch(p){if(!V(t().currentSessionRef,i))return;e({error:p.message})}},resumeGoal:async()=>{if(W(t().historySurfaceSelection)){e({error:re});return}const{currentSessionRef:i,isTemporarySession:d}=t();if(!i||d){e({error:"No persisted session is available for this goal"});return}try{const p=await D.updateGoal(i,{action:"resume"});if(!V(t().currentSessionRef,i))return;e({goal:p.goal,error:null,...p.runId?{currentRunId:p.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(p){if(!V(t().currentSessionRef,i))return;e({error:p.message})}},editGoal:async i=>{if(W(t().historySurfaceSelection)){e({error:re});return}const{currentSessionRef:d,isTemporarySession:p}=t();if(!d||p){e({error:"No persisted session is available for this goal"});return}try{const g=await D.updateGoal(d,{action:"edit",objective:i});if(!V(t().currentSessionRef,d))return;e({goal:g.goal,error:null,...g.runId?{currentRunId:g.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(g){if(!V(t().currentSessionRef,d))return;e({error:g.message})}},clearGoal:async()=>{if(W(t().historySurfaceSelection)){e({error:re});return}const{currentSessionRef:i,isTemporarySession:d}=t();if(!i||d){e({error:"No persisted session is available for this goal"});return}try{if(await D.clearGoal(i),!V(t().currentSessionRef,i))return;e({goal:null,error:null})}catch(p){if(!V(t().currentSessionRef,i))return;e({error:p.message})}}}},yc=(e,t)=>{const s=new WeakMap;let n=null;return{isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,sessionEventConnectionState:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},eventUnsubscribe:null,currentAssistantMessageId:null,hasToolCalls:!1,setStreaming:r=>e({isStreaming:r}),setAgentPhase:r=>e({agentPhase:r}),setRunId:r=>e({currentRunId:r}),prepareEventSubscription:async(r,o)=>{if(W(t().historySurfaceSelection))throw e({error:re}),new Error(re);const l=o??In(t,e);let m=null,k="connecting";if(m=await D.openEventSubscription(r,l,{onConnectionStateChange:v=>{k=v,m&&n===m&&e({sessionEventConnectionState:v})}}),W(t().historySurfaceSelection))throw m(),e({error:re}),new Error(re);return s.set(m,k),m},replaceEventSubscription:r=>{const o=t().eventUnsubscribe;if(n=r,e({eventUnsubscribe:r,sessionEventConnectionState:r?s.get(r)??"connected":"idle"}),As.reset(),o&&o!==r)try{o()}catch(l){console.warn("Failed to clean up previous event subscription",l)}},setCurrentAssistantMessageId:r=>e({currentAssistantMessageId:r}),setHasToolCalls:r=>e({hasToolCalls:r}),startAgentResponse:r=>{e({currentAssistantMessageId:r,hasToolCalls:!1,isStreaming:!0,agentPhase:"running",providerAdmission:null,providerCircuit:null,providerRetry:null,providerStall:null,providerRecovery:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null})},endAgentResponse:()=>{As.drainAll(),e({currentAssistantMessageId:null,hasToolCalls:!1,isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},subscribeToEvents:async r=>{if(W(t().historySurfaceSelection))throw e({error:re}),new Error(re);const o=await t().prepareEventSubscription(r);if(W(t().historySurfaceSelection))throw o(),e({error:re}),new Error(re);t().replaceEventSubscription(o)},reconnectSessionEvents:async()=>{if(W(t().historySurfaceSelection)){e({error:re});return}const r=t().currentSessionRef;if(r){t().unsubscribeFromEvents(),e({sessionEventConnectionState:"connecting"});try{await t().subscribeToEvents(r)}catch(o){throw e({sessionEventConnectionState:"offline"}),o}}},unsubscribeFromEvents:()=>{const{eventUnsubscribe:r}=t();n=null,e({eventUnsubscribe:null,sessionEventConnectionState:"idle"});try{r==null||r()}catch(o){console.warn("Failed to clean up event subscription",o)}finally{As.reset()}},handleEvent:r=>{In(t,e)(r)}}};function vc(e){var t;return((t=e.taskPromptSummary)==null?void 0:t.trimStart().startsWith("/review"))===!0}function za(e,t){var n;const s=(n=e.taskStatusReason)==null?void 0:n.trim();if(vc(e)){if(e.taskStatus==="running")return t("taskHome.review.running");if(s!=null&&s.startsWith("Code review stale:"))return t("taskHome.review.stale");if(s==="Code review aborted")return t("taskHome.review.aborted");if(s==="Code review interrupted by process restart")return t("taskHome.review.interrupted");if(e.taskStatus==="failed")return t("taskHome.review.failed")}return e.taskFailure?t(wa(e.taskFailure.code)):s==="user-cancel"?t("session.reason.cancelledByUser"):s||void 0}let Ds=0;function Qt(e,t){const s=e.findIndex(r=>r.id===t.id);if(s===-1)return[...e,t];const n=e.slice();return n[s]=t,n}const bc=ps(e=>({schedules:[],isLoading:!1,hasLoaded:!1,error:null,loadSchedules:async()=>{const t=++Ds;e({isLoading:!0,error:null});try{const s=await D.listSchedules();if(t!==Ds)return;e({schedules:s,isLoading:!1,hasLoaded:!0})}catch(s){if(t!==Ds)return;e({error:s instanceof Error?s.message:pe("schedule.error.loadFailed"),isLoading:!1,hasLoaded:!0})}},createSchedule:async t=>{e({error:null});try{const s=await D.createSchedule(t);return e(n=>({schedules:Qt(n.schedules,s)})),s}catch(s){throw e({error:s instanceof Error?s.message:pe("schedule.error.createFailed")}),s}},updateSchedule:async(t,s)=>{e({error:null});try{const n=await D.updateSchedule(t,s);return e(r=>({schedules:Qt(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:pe("schedule.error.updateFailed")}),n}},deleteSchedule:async t=>{e({error:null});try{await D.deleteSchedule(t),e(s=>({schedules:s.schedules.filter(n=>n.id!==t)}))}catch(s){throw e({error:s instanceof Error?s.message:pe("schedule.error.deleteFailed")}),s}},toggleSchedule:async(t,s)=>{e({error:null});try{const n=s?await D.enableSchedule(t):await D.disableSchedule(t);return e(r=>({schedules:Qt(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:pe("schedule.error.toggleFailed")}),n}},runSchedule:async t=>{e({error:null});try{const s=await D.runSchedule(t);return e(n=>({schedules:Qt(n.schedules,s)})),s}catch(s){throw e({error:s instanceof Error?s.message:pe("schedule.error.runFailed")}),s}}})),_a="blade.projects.selected";function ea(){return typeof localStorage>"u"?null:localStorage.getItem(_a)}function Wt(e){typeof localStorage<"u"&&localStorage.setItem(_a,e)}const wc=new Set(["queued","running","completed","failed","cancelled","interrupted"]),Us=new Set(["default","autoEdit","yolo","plan"]),ta=new Set(["auto","off","minimal","low","medium","high","xhigh","max"]),sa=new Set(["auto","standard","fast","flex"]),na=new Set(["auto","low","medium","high"]),aa=new Set(["auto","pragmatic","friendly","explanatory"]),ra=new Set(["high","medium","low"]),oa=new Set(["feature","bug","maintenance","research"]);function xc(e){return typeof e=="string"&&wc.has(e)}function Sc(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!["changedFiles","additions","deletions","commits"].some(n=>typeof t[n]!="number"||!Number.isInteger(t[n])||t[n]<0))return{changedFiles:t.changedFiles,additions:t.additions,deletions:t.deletions,commits:t.commits}}function Cc(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,s=sn(t.code);if(!(!s||typeof t.message!="string"||typeof t.retryable!="boolean"))return{code:s,message:pe(wa(s)),retryable:ho(s)}}function jc(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!(!["applied","discarded","conflicted"].includes(String(t.status))||typeof t.updatedAt!="string"))return{status:t.status,updatedAt:t.updatedAt,...typeof t.sourceCommit=="string"?{sourceCommit:t.sourceCommit}:{},...typeof t.changedFiles=="number"&&Number.isInteger(t.changedFiles)&&t.changedFiles>=0?{changedFiles:t.changedFiles}:{},...typeof t.message=="string"?{message:t.message}:{}}}function Pt(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:void 0}function Tc(e,t){return{...e,taskStatus:t.taskStatus,taskStatusReason:t.taskStatusReason,taskFailure:t.taskStatus==="failed"?t.taskFailure??e.taskFailure:void 0,taskPromptSummary:t.taskPromptSummary??e.taskPromptSummary,taskStartedAt:t.taskStartedAt??(t.taskStatus==="queued"?void 0:e.taskStartedAt),taskCompletedAt:t.taskCompletedAt??(t.taskStatus==="queued"||t.taskStatus==="running"?void 0:e.taskCompletedAt),taskDiffStat:t.taskDiffStat??e.taskDiffStat,taskQueuePosition:t.taskStatus==="queued"?t.taskQueuePosition??e.taskQueuePosition:void 0,taskQueueDepth:t.taskStatus==="queued"?t.taskQueueDepth??e.taskQueueDepth:void 0,taskConcurrencyLimit:t.taskConcurrencyLimit??e.taskConcurrencyLimit,lastMessageTime:t.updatedAt??e.lastMessageTime}}function qs(e,t,s,n){return{...e,[t]:{revision:s,kind:"upsert",session:n}}}function nt(e){return e??{version:1,entries:[]}}const Pc=(e,t)=>{let s=null,n=!1,r=!1,o=0;const l=new Map,m=c=>{const u=ce(c),i=++o,d=t().catalogOverlayRevision??0;l.set(u,i),D.getSession(c).then(p=>{l.get(u)===i&&e(g=>{var C;const f=(C=g.sessionCatalogOverlays)==null?void 0:C[u];if(f&&f.revision>d)return{};const h=(g.catalogOverlayRevision??0)+1;return{sessions:Ae(g.sessions,p),catalogOverlayRevision:h,sessionCatalogOverlays:qs(g.sessionCatalogOverlays??{},u,h,p)}})}).catch(()=>{l.get(u)===i&&t().loadSessions()}).finally(()=>{l.get(u)===i&&l.delete(u)})},k=c=>{const u=ce(c);e(i=>{const d=(i.catalogOverlayRevision??0)+1;return{catalogOverlayRevision:d,sessionCatalogOverlays:{...i.sessionCatalogOverlays,[u]:{revision:d,kind:"remove"}}}})},v=c=>{const u=ce(c),i=++o;l.set(u,i),queueMicrotask(()=>{l.get(u)===i&&l.delete(u)})};return{taskEventsConnected:!1,taskEventConnectionState:"connecting",taskEventUnsubscribe:null,taskWorkspaceInfo:null,isTaskWorkspaceLoading:!1,taskWorkspaceError:null,boundProjects:[],selectedProjectPath:ea(),isDispatchingTask:!1,isUpdatingTaskAdmission:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],updatingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:pc(),taskTerminalReadLedger:lc(),catalogOverlayRevision:0,sessionCatalogOverlays:{},handleTaskEvent:c=>{if(c.type==="session.created"){const x=c.properties.sessionId,N=c.properties.projectPath;if(typeof x!="string"||typeof N!="string")return;m({sessionId:x,projectPath:N}),t().loadSurfaceCatalog();return}if(c.type==="session.deleted"){const x=c.properties.sessionId,N=c.properties.projectPath;if(typeof x!="string"||typeof N!="string")return;const P={sessionId:x,projectPath:N};v(P),t().removeSession(P),k(P);return}if(c.type==="session.archived"){const x=c.properties.sessionId,N=c.properties.projectPath;if(typeof x!="string"||typeof N!="string")return;const P={sessionId:x,projectPath:N};v(P),t().removeSession(P),k(P),t().loadArchivedSessions();return}if(c.type==="session.unarchived"){const x=c.properties.sessionId,N=c.properties.projectPath;if(typeof x!="string"||typeof N!="string")return;m({sessionId:x,projectPath:N}),t().loadSurfaceCatalog(),t().loadArchivedSessions();return}if(c.type==="session.updated"){const x=c.properties.sessionId,N=c.properties.projectPath,P=c.properties.title,B=c.properties.selectedModelId,U=c.properties.permissionMode,_=c.properties.reasoningEffort,Q=c.properties.serviceTier,Z=c.properties.responseVerbosity,ne=c.properties.communicationStyle,K=c.properties.taskPriority,$=c.properties.taskKind,R=c.properties.taskDueAt;if(typeof x!="string"||typeof N!="string"||!(typeof P=="string"&&P.trim()||typeof B=="string"&&B.trim()||Us.has(U)||ta.has(_)||sa.has(Q)||na.has(Z)||aa.has(ne)||ra.has(K)||oa.has($)||R===null||typeof R=="string"&&Number.isFinite(Date.parse(R))))return;const le={sessionId:x,projectPath:N};if(V(t().currentSessionRef,le)&&Us.has(U)&&Te.getState().setMode(U),!t().sessions.some(ve=>V(ee(ve),le))){m(le);return}e(ve=>{const xe=ve.sessions.find(Le=>V(ee(Le),le));if(!xe)return{};const Re={...xe,...typeof P=="string"&&P.trim()?{title:P}:{},...typeof B=="string"&&B.trim()?{selectedModelId:B}:{},...Us.has(U)?{permissionMode:U}:{},...ta.has(_)?{reasoningEffort:_}:{},...sa.has(Q)?{serviceTier:Q}:{},...na.has(Z)?{responseVerbosity:Z}:{},...aa.has(ne)?{communicationStyle:ne}:{},...ra.has(K)?{taskPriority:K}:{},...oa.has($)?{taskKind:$}:{},...R===null?{taskDueAt:void 0}:typeof R=="string"&&Number.isFinite(Date.parse(R))?{taskDueAt:R}:{}},Se=(ve.catalogOverlayRevision??0)+1;return{sessions:Ae(ve.sessions,Re),catalogOverlayRevision:Se,sessionCatalogOverlays:qs(ve.sessionCatalogOverlays??{},ce(le),Se,Re)}});return}if(c.type==="task.delivery"){const x=c.properties.sessionId,N=c.properties.projectPath,P=jc(c.properties.taskDelivery);if(typeof x!="string"||typeof N!="string"||!P)return;const B={sessionId:x,projectPath:N},U=c.properties.taskWorktreeRemoved===!0;e(_=>({sessions:_.sessions.map(Q=>V(ee(Q),B)?{...Q,taskDelivery:P,...U?{taskWorktreePath:void 0,taskWorktreeBranch:void 0}:{},lastMessageTime:typeof c.properties.updatedAt=="string"?c.properties.updatedAt:Q.lastMessageTime}:Q)}));return}if(c.type==="interaction.pending"){const x=c.properties.sessionId,N=c.properties.projectPath,P=c.properties.interactionType,B=c.properties.requestId;if(typeof x!="string"||typeof N!="string"||P!=="permission"&&P!=="question"&&P!=="elicitation"||typeof B!="string"||!B)return;const U={sessionId:x,projectPath:N},_=t().sessions.find(Z=>V(ee(Z),U));if(!_){t().loadSessions();return}if(e(Z=>({sessions:Z.sessions.map(ne=>V(ee(ne),U)?{...ne,pendingInteraction:{type:P,requestId:B}}:ne)})),!(typeof document<"u"&&document.visibilityState==="visible"&&V(t().currentSessionRef,U))&&ut.getState().notifyErrors){const ne=_.title??_.sessionId??x;Jn({ref:U,title:`Blade · ${pe(P==="question"?"attention.notification.question":P==="elicitation"?"attention.notification.elicitation":"attention.notification.permission")}`,body:ne,onOpen:K=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(rs,{detail:K})))}})}return}if(c.type==="interaction.resolved"){const x=c.properties.sessionId,N=c.properties.projectPath,P=c.properties.requestId;if(typeof x!="string"||typeof N!="string"||typeof P!="string")return;const B={sessionId:x,projectPath:N};e(U=>({sessions:U.sessions.map(_=>{var Q;return V(ee(_),B)&&((Q=_.pendingInteraction)==null?void 0:Q.requestId)===P?{..._,pendingInteraction:void 0}:_})}));return}if(c.type==="schedule.fired"){bc.getState().loadSchedules();return}if(c.type!=="task.status")return;const u=c.properties.sessionId,i=c.properties.projectPath,d=c.properties.taskStatus;if(typeof u!="string"||typeof i!="string"||!xc(d))return;const p={sessionId:u,projectPath:i},g=Pt(c.properties.taskInFlight,0),f=Pt(c.properties.taskQueueDepth,0),h=Pt(c.properties.taskConcurrencyLimit,1),C=typeof c.properties.taskAdmissionPaused=="boolean"?c.properties.taskAdmissionPaused:void 0;g!==void 0&&f!==void 0&&h!==void 0&&e(x=>{var N,P;return{taskWorkspaceInfo:x.taskWorkspaceInfo?{...x.taskWorkspaceInfo,taskAdmission:{inFlight:g,queued:f,maxConcurrent:h,maxQueued:((N=x.taskWorkspaceInfo.taskAdmission)==null?void 0:N.maxQueued)??100,paused:C??((P=x.taskWorkspaceInfo.taskAdmission)==null?void 0:P.paused)??!1}}:null}});const S=ce(p),T=Cc(c.properties.taskFailure);let j=!1,A=null,w=null,E=!1;e(x=>{const N=x.sessions.find(le=>V(ee(le),p));if(!N)return E=!0,w=gt(nt(x.taskTerminalReadLedger),p,{taskStatus:d,taskCompletedAt:typeof c.properties.taskCompletedAt=="string"?c.properties.taskCompletedAt:void 0,taskFailure:T}),{taskTerminalReadLedger:w};const P=(x.catalogOverlayRevision??0)+1,B={taskStatus:d,taskStatusReason:typeof c.properties.taskStatusReason=="string"?c.properties.taskStatusReason:void 0,taskFailure:T,taskPromptSummary:typeof c.properties.taskPromptSummary=="string"?c.properties.taskPromptSummary:void 0,taskStartedAt:typeof c.properties.taskStartedAt=="string"?c.properties.taskStartedAt:void 0,taskCompletedAt:typeof c.properties.taskCompletedAt=="string"?c.properties.taskCompletedAt:void 0,taskDiffStat:Sc(c.properties.taskDiffStat),taskQueuePosition:Pt(c.properties.taskQueuePosition,1),taskQueueDepth:Pt(c.properties.taskQueueDepth,0),taskConcurrencyLimit:h,updatedAt:typeof c.properties.updatedAt=="string"?c.properties.updatedAt:void 0},U=Tc(N,B),_=typeof document<"u"&&document.visibilityState==="visible"&&V(x.currentSessionRef,p),Q=os(N),Z=os(U),ne=nt(x.taskTerminalReadLedger),K=ne.entries.find(le=>le.key===S);let $=ne,R=x.unreadTaskKeys;return _||Z===null?($=gt($,p,U),_&&(R=R.filter(le=>le!==S))):K?K.signature!==Z&&(R.includes(S)||(R=[...R,S],Q!==Z&&(j=!0))):Q===null?($=gt($,p,N),R.includes(S)||(R=[...R,S],j=!0)):$=gt($,p,U),w=$,A=R,{sessions:Ae(x.sessions,U),unreadTaskKeys:R,taskTerminalReadLedger:$,catalogOverlayRevision:P,sessionCatalogOverlays:qs(x.sessionCatalogOverlays??{},S,P,U)}}),w&&it(w),A&&ct(A);const F=j?t().sessions.find(x=>V(ee(x),p)):void 0;if(F&&dn(d)){const x=ut.getState();if(x.notifySounds&&hc(d),d==="completed"?x.notifyBuild:x.notifyErrors){const P=pe(d==="completed"?"attention.notification.completed":d==="failed"?"attention.notification.failed":"attention.notification.interrupted"),B=za(F,pe),U=F.title??u;Jn({ref:p,title:`Blade · ${P}`,body:B?`${U} · ${B}`:U,onOpen:_=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(rs,{detail:_})))}})}}E&&(m(p),t().loadSurfaceCatalog())},subscribeToTaskEvents:async()=>{if(n=!0,!t().taskEventUnsubscribe){if(s)return s;r=!0,e({taskEventsConnected:!1,taskEventConnectionState:"connecting"}),s=(async()=>{try{const c=await D.openTaskEventSubscription(u=>t().handleTaskEvent(u),{onConnectionChange:u=>{n&&e({taskEventsConnected:u})},onConnectionStateChange:u=>{n&&((u==="reconnecting"||u==="offline")&&(r=!0),e({taskEventsConnected:u==="connected",taskEventConnectionState:u}),u==="connected"&&r&&(r=!1,Promise.all([t().loadSessions(),t().loadSurfaceCatalog(),t().loadTaskWorkspaceInfo(),t().loadBoundProjects(),Te.getState().loadModels()])))}});if(!n||t().taskEventUnsubscribe){c();return}e({taskEventUnsubscribe:c})}catch(c){throw r=!0,e({taskEventsConnected:!1,taskEventConnectionState:"offline"}),c}})();try{await s}finally{s=null}}},reconnectTaskEvents:async()=>{r=!0,t().unsubscribeFromTaskEvents(),await t().subscribeToTaskEvents()},unsubscribeFromTaskEvents:()=>{var c,u;n=!1,(u=(c=t()).taskEventUnsubscribe)==null||u.call(c),e({taskEventUnsubscribe:null,taskEventsConnected:!1,taskEventConnectionState:"offline"})},loadTaskWorkspaceInfo:async()=>{e({isTaskWorkspaceLoading:!0,taskWorkspaceError:null});try{const c=await D.getWorkspaceInfo();e({taskWorkspaceInfo:c,isTaskWorkspaceLoading:!1})}catch(c){e({isTaskWorkspaceLoading:!1,taskWorkspaceError:c instanceof Error?c.message:"Failed to load task workspace"})}},loadBoundProjects:async()=>{try{const c=await D.listProjects(),u=ea(),i=c.find(d=>d.available&&d.path===u)??c.find(d=>d.isCurrent)??c.find(d=>d.available);i&&Wt(i.path),e({boundProjects:c,selectedProjectPath:(i==null?void 0:i.path)??null})}catch(c){e({error:c instanceof Error?c.message:"Failed to load projects"})}},bindProject:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}e({isBindingProject:!0,error:null});try{const u=await D.bindProject(c);Wt(u.path),e(i=>({boundProjects:[...i.boundProjects.filter(d=>d.path!==u.path),u].sort((d,p)=>d.isCurrent!==p.isCurrent?d.isCurrent?-1:1:d.name.localeCompare(p.name)),selectedProjectPath:u.path,isBindingProject:!1}))}catch(u){throw e({isBindingProject:!1,error:u instanceof Error?u.message:"Failed to bind project"}),u}},unbindProject:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}try{await D.unbindProject(c),e(u=>{const i=u.boundProjects.filter(p=>p.path!==c||p.isCurrent),d=u.selectedProjectPath===c?i.find(p=>p.isCurrent)??i.find(p=>p.available):void 0;return d&&Wt(d.path),{boundProjects:i,...d?{selectedProjectPath:d.path}:{}}})}catch(u){throw e({error:u instanceof Error?u.message:"Failed to unbind project"}),u}},selectProject:c=>{Wt(c),e({selectedProjectPath:c})},markTaskRead:c=>{const u=ce(c);let i=nt(t().taskTerminalReadLedger),d=t().unreadTaskKeys;e(p=>{const g=p.sessions.find(f=>V(ee(f),c));return i=g?gt(nt(p.taskTerminalReadLedger),c,g):nt(p.taskTerminalReadLedger),d=p.unreadTaskKeys.filter(f=>f!==u),{taskTerminalReadLedger:i,unreadTaskKeys:d}}),it(i),ct(d)},clearUnreadTasks:()=>{if(t().catalogLoadState!=="ready")return;let c=nt(t().taskTerminalReadLedger);e(u=>{const i=new Map(u.sessions.map(g=>[ce(ee(g)),g])),d=new Set(u.unreadTaskKeys);let p={version:1,entries:nt(u.taskTerminalReadLedger).entries.filter(g=>!d.has(g.key)||i.has(g.key))};for(const g of u.unreadTaskKeys){const f=i.get(g);f&&(p=gt(p,ee(f),f))}return c=p,{unreadTaskKeys:[],taskTerminalReadLedger:p}}),it(c),ct([])},setTaskAdmissionPaused:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}if(!t().isUpdatingTaskAdmission){e({isUpdatingTaskAdmission:!0,error:null,errorContext:null});try{const u=await D.setTaskAdmissionPaused(c);e(i=>({taskWorkspaceInfo:i.taskWorkspaceInfo?{...i.taskWorkspaceInfo,taskAdmission:u}:i.taskWorkspaceInfo}))}catch(u){throw e({error:u instanceof Error?u.message:"Failed to update task admission",errorContext:{kind:"task_action"}}),u}finally{e({isUpdatingTaskAdmission:!1})}}},updateTask:async(c,u)=>{if(W(t().historySurfaceSelection)){e({error:re});return}const i=ce(c);if(!t().updatingTaskKeys.includes(i)){e(d=>({updatingTaskKeys:[...d.updatingTaskKeys,i],error:null,errorContext:null}));try{const d=await D.updateTask(c,u);e(p=>({sessions:Ae(p.sessions,d)}))}catch(d){throw e({error:d instanceof Error?d.message:"Failed to update task",errorContext:{kind:"task_action",sessionRef:c}}),d}finally{e(d=>({updatingTaskKeys:d.updatingTaskKeys.filter(p=>p!==i)}))}}},cancelTask:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}const u=ce(c);if(!t().cancellingTaskKeys.includes(u)){e(i=>({cancellingTaskKeys:[...i.cancellingTaskKeys,u],error:null,errorContext:null}));try{await D.abortSession(c);const i=V(t().currentSessionRef,c);i&&(await t().resyncSessionMessages(c),V(t().currentSessionRef,c)&&t().unsubscribeFromEvents()),e(d=>({sessions:d.sessions.map(p=>V(ee(p),c)?{...p,taskStatus:"cancelled",taskQueuePosition:void 0,taskQueueDepth:void 0,taskCompletedAt:p.taskCompletedAt??new Date().toISOString()}:p),...i?{isStreaming:!1,isStopping:!1,agentPhase:"idle",providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,eventUnsubscribe:null}:{}}))}catch(i){throw e({error:i instanceof Error?i.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:c}}),i}finally{e(i=>({cancellingTaskKeys:i.cancellingTaskKeys.filter(d=>d!==u)}))}}},retryTask:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}const u=ce(c);if(t().retryingTaskKeys.includes(u))return;const i=t().getNavigationVersion(),d=t().selectedProjectPath,p=()=>t().getNavigationVersion()===i&&t().selectedProjectPath===d&&!W(t().historySurfaceSelection);e(g=>({retryingTaskKeys:[...g.retryingTaskKeys,u],error:null,errorContext:null}));try{const g=await D.retryTask(c);e(f=>({sessions:Ae(f.sessions,g.session)})),t().loadSurfaceCatalog(),t().markTaskRead(c),p()&&await t().selectSession(ee(g.session))}catch(g){throw p()&&e({error:g instanceof Error?g.message:"Failed to retry task",errorContext:{kind:"task_action",sessionRef:c}}),g}finally{e(g=>({retryingTaskKeys:g.retryingTaskKeys.filter(f=>f!==u)}))}},deliverTask:async(c,u)=>{if(W(t().historySurfaceSelection)){e({error:re});return}const i=ce(c);if(!t().taskDeliveryActions[i]){e(d=>({taskDeliveryActions:{...d.taskDeliveryActions,[i]:u},error:null,errorContext:null}));try{const d=await D.deliverTask(c,u);e(p=>({sessions:Ae(p.sessions,d)})),t().markTaskRead(c)}catch(d){throw e({error:d instanceof Error?d.message:"Failed to deliver task changes",errorContext:{kind:"task_action",sessionRef:c}}),d}finally{e(d=>{const{[i]:p,...g}=d.taskDeliveryActions;return{taskDeliveryActions:g}})}}},dispatchTask:async(c,u)=>{if(W(t().historySurfaceSelection)){e({error:re});return}const i=t().getNavigationVersion(),d=t().selectedProjectPath,p=c.projectPath??d??void 0,g=()=>t().getNavigationVersion()===i&&t().selectedProjectPath===d&&!W(t().historySurfaceSelection);e({isDispatchingTask:!0,error:null,errorContext:null});try{const f=await D.createTask({...c,projectPath:p});e(h=>({sessions:Ae(h.sessions,f.session),isDispatchingTask:!1})),t().loadSurfaceCatalog(),(u==null?void 0:u.selectSession)!==!1&&g()&&await t().selectSession(ee(f.session))}catch(f){throw e({isDispatchingTask:!1,...g()?{error:f instanceof Error?f.message:"Failed to dispatch task"}:{}}),f}},startCodeReview:async c=>{if(W(t().historySurfaceSelection)){e({error:re});return}const u=t().getNavigationVersion(),i=t().selectedProjectPath,d=c.projectPath??i??void 0,p=()=>t().getNavigationVersion()===u&&t().selectedProjectPath===i&&!W(t().historySurfaceSelection);e({isDispatchingTask:!0,error:null,errorContext:null});let g,f=!1;try{g=await D.createSession(d,"Code Review");const h=ee(g);if(W(t().historySurfaceSelection)){await D.deleteSession(h).catch(()=>{}),e({isDispatchingTask:!1});return}await D.startCodeReview(h,{kind:c.kind,...c.ref?{ref:c.ref}:{},...c.instructions?{instructions:c.instructions}:{},...c.modelId?{modelId:c.modelId}:{}}),f=!0;const C={...g,taskStatus:"running",taskStatusReason:pe("taskHome.review.running"),taskPromptSummary:`/review ${c.kind}${c.ref?` ${c.ref}`:""}`};e(S=>({sessions:Ae(S.sessions,C),isDispatchingTask:!1})),t().loadSurfaceCatalog(),p()&&await t().selectSession(h)}catch(h){throw g&&!f&&await D.deleteSession(ee(g)).catch(()=>{}),e({isDispatchingTask:!1,...p()?{error:h instanceof Error?h.message:pe("taskHome.review.startFailed")}:{}}),h}}}},Ac=e=>({tokenUsage:Et,updateTokenUsage:t=>e(s=>{const{costUsd:n,...r}=t;return{tokenUsage:{...s.tokenUsage,...r,totalInputTokens:s.tokenUsage.totalInputTokens+Math.max(0,t.inputTokens??0),totalOutputTokens:s.tokenUsage.totalOutputTokens+Math.max(0,t.outputTokens??0),cacheReadTokens:s.tokenUsage.cacheReadTokens+Math.max(0,t.cacheReadTokens??0),cacheWriteTokens:s.tokenUsage.cacheWriteTokens+Math.max(0,t.cacheWriteTokens??0),estimatedCostUsd:s.tokenUsage.estimatedCostUsd+Math.max(0,n??0)}}}),resetContextUsage:()=>e(t=>({tokenUsage:{...t.tokenUsage,inputTokens:0,outputTokens:0,totalTokens:0}})),setMaxContextTokens:(t,s=!1)=>e(n=>({tokenUsage:{...n.tokenUsage,maxContextTokens:t,isDefaultMaxTokens:s}}))}),L=ps()((...e)=>({...kc(...e),...Qi(...e),...Pc(...e),...Wi(...e),...yc(...e),...Ac(...e)}));function Rc(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ec({open:e,onOpenChange:t}){const s=$e(),n=L(w=>w.currentSessionRef),r=L(w=>W(w.historySurfaceSelection)),o=L(w=>w.isStreaming),l=L(w=>w.isTemporarySession),m=L(w=>w.rewindSession),[k,v]=b.useState([]),[c,u]=b.useState(null),[i,d]=b.useState(!1),[p,g]=b.useState(!1),[f,h]=b.useState(!1),[C,S]=b.useState(null);b.useEffect(()=>{if(r||!e||!n)return;let w=!1;return g(!0),S(null),v([]),u(null),d(!1),D.listRewindCheckpoints(n).then(E=>{var F;w||(v(E),u(((F=E[0])==null?void 0:F.messageId)??null))}).catch(E=>{w||S(E instanceof Error?E.message:s("chat.rewind.loadFailed"))}).finally(()=>{w||g(!1)}),()=>{w=!0}},[n,r,e]);const T=b.useMemo(()=>k.find(w=>w.messageId===c)??null,[k,c]),j=!!T&&!r&&!p&&!f&&!o&&!l,A=async()=>{if(qe(L.getState())||!T||!j)return;h(!0),S(null);const w=await m(T.messageId,i?"both":"conversation");h(!1),w?t(!1):S(s("chat.rewind.failed"))};return a.jsx(on,{open:e,onOpenChange:t,children:a.jsxs(hs,{className:"max-w-[620px] gap-0 overflow-hidden border-[#E5E7EB] bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b]",children:[a.jsx(cn,{className:"border-b border-[#E5E7EB] px-6 py-5 dark:border-zinc-800",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-[#F3F4F6] text-[#4B5563] dark:bg-zinc-800 dark:text-zinc-300",children:a.jsx(Dn,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx(ms,{className:"text-[15px] font-semibold text-[#111827] dark:text-zinc-100",children:s("chat.rewind.title")}),a.jsx(gs,{className:"mt-1 text-[12px] text-[#6B7280] dark:text-zinc-400",children:s("chat.rewind.description")})]})]})}),a.jsxs("div",{className:"min-h-[260px] px-6 py-4",children:[p&&a.jsxs("div",{className:"flex h-[220px] items-center justify-center text-[#6B7280] dark:text-zinc-400",children:[a.jsx(He,{className:"mr-2 h-4 w-4 animate-spin"}),a.jsx("span",{className:"text-xs font-mono",children:s("chat.rewind.loading")})]}),!p&&C&&a.jsx("div",{role:"alert",className:"rounded-md border border-rose-200 bg-rose-50 px-4 py-3 text-xs text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300",children:C}),!p&&!C&&k.length===0&&a.jsxs("div",{className:"flex h-[220px] flex-col items-center justify-center text-center",children:[a.jsx(Dn,{className:"mb-3 h-5 w-5 text-[#9CA3AF] dark:text-zinc-600"}),a.jsx("p",{className:"text-sm text-[#4B5563] dark:text-zinc-300",children:s("chat.rewind.empty")})]}),!p&&k.length>0&&a.jsx("div",{role:"radiogroup","aria-label":s("chat.rewind.checkpointAria"),className:"max-h-[310px] space-y-1 overflow-y-auto",children:k.map(w=>{const E=w.messageId===c;return a.jsxs("button",{type:"button",role:"radio","aria-checked":E,onClick:()=>u(w.messageId),className:te("w-full rounded-md border px-4 py-3 text-left transition-colors",E?"border-[#22C55E] bg-[#F0FDF4] dark:border-[#22C55E] dark:bg-[#052E16]/50":"border-transparent hover:bg-[#F9FAFB] dark:hover:bg-zinc-900"),children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsx("p",{className:"line-clamp-2 text-[13px] leading-5 text-[#111827] dark:text-zinc-100",children:w.preview||s("chat.rewind.userMessage")}),a.jsx("span",{className:"shrink-0 text-[10px] font-mono text-[#9CA3AF] dark:text-zinc-500",children:Rc(w.createdAt)})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] font-mono text-[#6B7280] dark:text-zinc-500",children:[a.jsx("span",{children:w.messageId.slice(0,10)}),w.fileCount>0&&a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(So,{className:"h-3 w-3"}),w.fileCount===1?s("chat.rewind.fileCountOne",{count:w.fileCount}):s("chat.rewind.fileCountMany",{count:w.fileCount})]})]})]},w.messageId)})})]}),a.jsx("div",{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:a.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[a.jsx("input",{type:"checkbox",checked:i,disabled:!T||T.fileCount===0,onChange:w=>d(w.target.checked),className:"mt-0.5 h-4 w-4 accent-[#16A34A] disabled:opacity-40"}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-[12px] font-medium text-[#374151] dark:text-zinc-200",children:s("chat.rewind.restoreCode")}),a.jsx("span",{className:"mt-0.5 block text-[11px] text-[#6B7280] dark:text-zinc-500",children:s("chat.rewind.restoreCodeHint")})]})]})}),a.jsxs(Ia,{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:[a.jsx(lt,{variant:"ghost",onClick:()=>t(!1),disabled:f,children:s("chat.rewind.cancel")}),a.jsxs(lt,{onClick:()=>void A(),disabled:!j,className:"bg-[#16A34A] text-white hover:bg-[#15803D]",children:[f?a.jsx(He,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(an,{className:"mr-2 h-4 w-4"}),s("chat.rewind.confirm")]})]})]})})}function Ba({inFlight:e,queued:t,maxConcurrent:s,compact:n=!1,className:r}){const o=$e(),l=Math.max(1,s),m=Array.from({length:Math.min(l,12)}),k=Math.min(e,l);return a.jsxs("div",{className:te("inline-flex items-center gap-2 font-mono",n?"text-[10.5px]":"text-[11px]",r),title:o("capacity.title",{inFlight:e,queued:t,max:s}),children:[a.jsx("span",{className:te("inline-flex items-center gap-[3px] rounded-sm",n?"px-0":"px-0.5"),children:m.map((v,c)=>{const u=c<k;return a.jsx("span",{className:te("block",n?"h-2.5 w-[3px] rounded-[1px]":"h-3 w-[3px] rounded-[1px]",u?"bg-[hsl(var(--deck-accent))] shadow-[0_0_4px_hsl(var(--deck-accent)/0.65)]":"bg-[hsl(var(--deck-border-strong))]/60")},c)})}),a.jsxs("span",{className:"tabular-nums text-[hsl(var(--deck-ink-muted))]",children:[a.jsx("span",{className:"text-[hsl(var(--deck-ink))]",children:e}),a.jsx("span",{className:"mx-[2px] opacity-40",children:"/"}),a.jsx("span",{children:s}),a.jsx("span",{className:"opacity-60",children:o("capacity.suffix.running")})]}),t>0&&a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm border border-amber-300/60 bg-amber-50 px-1.5 py-[1px] text-[10px] text-amber-800 dark:border-amber-800/60 dark:bg-amber-950/40 dark:text-amber-300",children:[a.jsx("span",{className:"h-1 w-1 rounded-full bg-amber-500"}),o("capacity.queued",{queued:t})]})]})}function ia(){const e=document.querySelector("textarea[data-blade-composer]:not(:disabled)");if(!e)return!1;e.focus();const t=e.value.length;return e.setSelectionRange(t,t),!0}const $a=[{id:"searchTasks",key:"k",primaryModifier:!0,scope:"Global"},{id:"openCommands",key:"p",primaryModifier:!0,shiftKey:!0,scope:"Global"},{id:"newTask",key:"n",primaryModifier:!1,scope:"Global"},{id:"focusComposer",key:"/",primaryModifier:!1,scope:"Chat"},{id:"toggleSidebar",key:"b",primaryModifier:!0,scope:"Layout"}];function Nc(e){const t=e.key.toLocaleLowerCase();return $a.find(s=>{if(s.key!==t||e.altKey||e.shiftKey!==!!s.shiftKey)return!1;const n=e.metaKey||e.ctrlKey;return s.primaryModifier?n:!n})??null}function Mc(e){return e instanceof Element?!!e.closest('input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]'):!1}function Ic(e){var n;const t=typeof navigator>"u"?null:navigator,s=((n=t==null?void 0:t.userAgentData)==null?void 0:n.platform)??(t==null?void 0:t.platform)??"";return/mac|iphone|ipad|ipod/i.test(s)}function Fc(e,t){const s=e.key==="/"?"/":e.key.toLocaleUpperCase(),n=Ic();return[...e.primaryModifier?[n?"⌘":"Ctrl"]:[],...e.shiftKey?[n?"⇧":"Shift"]:[],s]}function $l(e,t){const s=$a.find(n=>n.id===e);return s?Fc(s).join(""):""}function Oc(){const e=De(r=>r.setTaskSwitcherOpen),t=De(r=>r.setMainView),s=De(r=>r.toggleSidebar),n=L(r=>r.startTemporarySession);b.useEffect(()=>{const r=o=>{if(o.repeat)return;const l=Nc(o);if(!l)return;const m=De.getState(),k=m.isTaskSwitcherOpen,v=Mc(o.target),c=!!document.querySelector('[role="dialog"]');if(l.id==="searchTasks"||l.id==="openCommands"){if(c&&!k)return;o.preventDefault();const u=l.id==="searchTasks"?"tasks":"commands",i=k&&m.taskSwitcherMode===u;e(!i,u);return}if(!(v||c)){if(l.id==="newTask"){o.preventDefault(),t("workspace"),n(),requestAnimationFrame(()=>ia());return}if(l.id==="focusComposer"){ia()&&o.preventDefault();return}l.id==="toggleSidebar"&&(o.preventDefault(),s())}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t,e,n,s])}const Hc=b.lazy(()=>Be(()=>import("./SettingsModal-j0PEfToT.js"),__vite__mapDeps([4,2,3,5,6,7,8,9,10,11,12,1,13])).then(e=>({default:e.SettingsModal}))),Ka=()=>Be(()=>import("./TaskSwitcher-BVau39Em.js"),__vite__mapDeps([14,2,1,15,5,16,17,18,3])).then(e=>({default:e.TaskSwitcher})),Lc=b.lazy(Ka),Va=()=>Be(()=>import("./FilePreview-Cti4_C5N.js"),__vite__mapDeps([19,2,1,20,6,13,15,21,3])),Dc=b.lazy(()=>Va().then(e=>({default:e.FilePreview}))),Uc=b.lazy(()=>Va().then(e=>({default:e.PreviewControls}))),qc=b.lazy(()=>Be(()=>import("./TerminalPanel-N2fFhXPj.js"),__vite__mapDeps([22,2,23,24,1,16,3])).then(e=>({default:e.TerminalPanel}))),zc=b.lazy(()=>Be(()=>import("./Sidebar-DgTGp3BO.js"),__vite__mapDeps([25,2,8,3,1,26,7,11,17,5,16,21])).then(e=>({default:e.Sidebar}))),zs=e=>{if(e.startsWith("/Users/")){const t=e.split("/");if(t.length>=3)return"~/"+t.slice(3).join("/")}return e},_c=e=>e.replace(/^~\//,"~/§").split("/").filter(Boolean).map((t,s,n)=>{var r;return s===0&&((r=n[0])!=null&&r.startsWith("~"))?"~":t.replace(/^§/,"")});function Bc({children:e}){var ue,he;const t=$e();Oc();const{isSidebarOpen:s,isFilePreviewOpen:n,isSettingsOpen:r,isTerminalOpen:o,isTaskSwitcherOpen:l,toggleFilePreview:m,toggleTerminal:k,openFilePreview:v,setFilePreviewOpen:c,setTaskSwitcherOpen:u,previewRequestId:i,setSidebarOpen:d,mainView:p}=De();b.useEffect(()=>{const I=window.setTimeout(()=>{Ka()},1500);return()=>window.clearTimeout(I)},[]);const g=L(I=>I.currentSessionId),f=L(I=>I.currentSessionRef),h=L(I=>I.historySurfaceSelection),C=L(I=>I.sessions),S=L(I=>I.isStreaming),T=L(I=>I.isTemporarySession),j=L(I=>I.taskWorkspaceInfo),A=L(I=>I.boundProjects),w=L(I=>I.selectedProjectPath),[E,F]=b.useState(null),[x,N]=b.useState(!1),[P,B]=b.useState(),[U,_]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches),[Q,Z]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),ne=b.useRef(null),K=b.useRef(null),$=b.useRef(null),R=b.useMemo(()=>C.find(I=>V({sessionId:I.sessionId,projectPath:I.projectPath},f)),[f,C]),le=(R==null?void 0:R.taskIsolation)==="worktree"&&R.taskSourceProjectPath&&(((ue=R.taskDelivery)==null?void 0:ue.status)==="applied"||((he=R.taskDelivery)==null?void 0:he.status)==="discarded")?R.taskSourceProjectPath:f==null?void 0:f.projectPath,ge=W(h);b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const I=window.matchMedia("(max-width: 900px)"),q=()=>{I.matches&&d(!1)};return q(),I.addEventListener("change",q),()=>I.removeEventListener("change",q)},[d]),b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const I=window.matchMedia("(max-width: 639px)"),q=()=>_(I.matches);return q(),I.addEventListener("change",q),()=>I.removeEventListener("change",q)},[]),b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const I=window.matchMedia("(max-width: 1023px)"),q=()=>Z(I.matches);return q(),I.addEventListener("change",q),()=>I.removeEventListener("change",q)},[]),b.useEffect(()=>{if(!U||!s)return;const I=requestAnimationFrame(()=>{var q,ie;(ie=(q=ne.current)==null?void 0:q.querySelector("button"))==null||ie.focus()});return()=>{var q;cancelAnimationFrame(I),(q=K.current)==null||q.focus({preventScroll:!0})}},[U,s]);const ve=I=>{var fe;if(!U||!s)return;if(I.key==="Escape"){I.preventDefault(),d(!1);return}if(I.key!=="Tab")return;const q=Array.from(((fe=ne.current)==null?void 0:fe.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]);if(q.length===0)return;const ie=q[0],Ce=q[q.length-1];I.shiftKey&&document.activeElement===ie?(I.preventDefault(),Ce==null||Ce.focus()):!I.shiftKey&&document.activeElement===Ce&&(I.preventDefault(),ie==null||ie.focus())},xe=b.useMemo(()=>ge?null:p==="board"||!g||T?w?zs(w):null:R!=null&&R.projectPath?zs(R.taskSourceProjectPath||R.projectPath):null,[g,R,ge,T,p,w]),Re=b.useMemo(()=>xe?_c(xe):[],[xe]);b.useEffect(()=>{var q;if(ge){F(null);return}if(!f){F(((q=A.find(ie=>ie.path===w))==null?void 0:q.gitBranch)??null);return}(async()=>{try{const ie=await D.getGitInfo({sessionId:f.sessionId,projectPath:le??f.projectPath});F(ie.branch)}catch{F(null)}})()},[A,f,le,ge,w]);const Se=j==null?void 0:j.taskAdmission,Le=p==="board"?w??(j==null?void 0:j.cwd)??null:le??w??(j==null?void 0:j.cwd)??null,de=f&&p==="workspace"?ce(f):`project:${w??"none"}`,J=n&&Q,Y=n&&P;return b.useEffect(()=>{ge&&(n&&c(!1),o&&k(),l&&u(!1))},[ge,n,o,l,c,u,k]),a.jsxs("div",{className:"flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]",children:[U&&s&&!J&&a.jsx("button",{type:"button","aria-label":t("sidebar.action.collapse"),onClick:()=>d(!1),className:"fixed inset-0 z-40 bg-black/25 backdrop-blur-[1px]"}),a.jsx("div",{ref:ne,role:U&&s&&!J?"dialog":void 0,"aria-modal":U&&s&&!J?!0:void 0,"aria-label":U&&s&&!J?t("sidebar.navigationAria"):void 0,inert:J||U&&!s?!0:void 0,onKeyDown:ve,className:te("overflow-hidden",s?"w-[260px]":"w-[64px]",U?"fixed inset-y-0 left-0 z-50 shadow-2xl transition-none":"shrink-0 transition-[width] duration-300 ease-in-out",U&&!s&&"-translate-x-full"),children:a.jsx("div",{className:te("transition-all duration-300 ease-in-out",s?"w-[260px]":"w-[64px]"),children:a.jsx(b.Suspense,{fallback:null,children:a.jsx(zc,{onNavigate:()=>{U&&d(!1)}})})})}),a.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[a.jsxs("header",{inert:J,className:"relative z-10 flex h-14 items-center gap-2 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]/90 px-3 backdrop-blur-md sm:gap-4 sm:px-6",children:[U&&a.jsx(lt,{ref:K,"data-mobile-navigation-trigger":!0,variant:"ghost",size:"icon",onClick:()=>d(!0),"aria-label":t("layout.action.openNavigation"),title:t("layout.action.openNavigation"),className:"h-9 w-9 shrink-0 rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:a.jsx(Ro,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[ge?a.jsxs("span",{className:"font-mono text-[12px] font-medium text-[hsl(var(--deck-ink))]",children:[t("history.badge.remote")," · ",t("history.badge.historyOnly")]}):Re.length>0?a.jsx("nav",{"aria-label":t("layout.workspace.pathAria"),title:xe??void 0,className:"flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:Re.map((I,q)=>{const ie=q===Re.length-1,Ce=q===0&&I==="~";return a.jsxs("span",{className:"flex items-center min-w-0",children:[q>0&&a.jsx("span",{className:"mx-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),q===0&&!Ce&&a.jsx("span",{className:"mr-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),a.jsx("span",{className:te("truncate",ie?"font-medium text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:I})]},q)})}):a.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:j!=null&&j.cwd?zs(j.cwd):t("layout.workspace.empty")}),E&&a.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:[a.jsx(nn,{className:"h-3 w-3 text-[hsl(var(--deck-accent))]"}),E]})]}),a.jsxs("div",{className:"flex gap-3 items-center ml-auto",children:[Se&&a.jsx("span",{className:"hidden items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1 md:inline-flex",children:a.jsx(Ba,{inFlight:Se.inFlight,queued:Se.queued,maxConcurrent:Se.maxConcurrent,compact:!0})}),a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx(lt,{variant:"ghost",size:"icon","aria-label":t("layout.action.rewind"),title:t("layout.action.rewind"),disabled:ge||p==="board"||!f||T||S,onClick:()=>N(!0),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] disabled:opacity-35",children:a.jsx(an,{className:"w-4 h-4"})}),a.jsx(b.Suspense,{fallback:null,children:a.jsx(Uc,{ref:$,open:n,maximized:P,disabled:ge||p==="board",onToggleMaximized:()=>B(I=>!I),onTogglePreview:()=>{if(n){B(!1),m();return}v((!f||T)&&i===0?{tab:"files"}:void 0)}})})]})]})]}),a.jsxs("main",{className:"flex-1 overflow-hidden relative flex bg-[hsl(var(--deck-canvas))]",children:[a.jsx("div",{"data-preview-background":"content","data-preview-maximized":Y,inert:J,className:"relative flex min-w-0 flex-1 flex-col",children:r?a.jsx(b.Suspense,{fallback:null,children:a.jsx(Hc,{})}):e}),n&&!ge&&a.jsx(b.Suspense,{fallback:null,children:a.jsx(Dc,{returnFocusElement:$.current,maximized:Y},de)})]})]}),o&&!ge&&a.jsx(b.Suspense,{fallback:null,children:a.jsx(qc,{workspacePath:Le},Le??"default-workspace")}),l&&!ge&&a.jsx(b.Suspense,{fallback:null,children:a.jsx(Lc,{})}),a.jsx(Ec,{open:!ge&&x,onOpenChange:N})]})}const _s="BladeCode";function $c(){const e=$e(),t=L(l=>l.unreadTaskKeys),s=L(l=>l.sessions),n=L(l=>l.selectSession),r=L(l=>l.selectProject),o=b.useMemo(()=>{const l=new Set(t);for(const m of s)m.pendingInteraction&&l.add(ce(ee(m)));return l.size},[s,t]);return b.useEffect(()=>(document.title=o>0?`(${o}) ${_s}`:_s,()=>{document.title=_s}),[o]),b.useEffect(()=>{const l=m=>{var i;const k=m.detail;if(!(k!=null&&k.sessionId)||!k.projectPath)return;const v=L.getState(),c=as(v.sessions,k),u=c?fs(c,v.selectedProjectPath??((i=v.taskWorkspaceInfo)==null?void 0:i.cwd)??null):k.projectPath;v.boundProjects.some(d=>d.available&&d.path===u)&&r(u),n(k)};return window.addEventListener(rs,l),()=>window.removeEventListener(rs,l)},[r,n]),a.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:o>0?e("attention.unreadAnnouncement",{count:o}):""})}const at=Hr,rt=Lr,Xe=b.forwardRef(({className:e,align:t="center",sideOffset:s=4,...n},r)=>a.jsx(Dr,{children:a.jsx(fa,{ref:r,align:t,sideOffset:s,className:te("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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-popover-content-transform-origin]",e),...n})}));Xe.displayName=fa.displayName;const Xs=b.forwardRef(({className:e,...t},s)=>a.jsx("textarea",{className:te("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...t}));Xs.displayName="Textarea";const Kc=(e,t)=>{const s=[...e.matchAll(/(?:^|\s)(@(?:"[^"]*"|(?:[^\\ ]|\\ )*))/g)];for(const n of s){const r=n[1],o=n.index+(n[0].length-r.length),l=o+r.length;if(t>=o&&t<=l){let m=r.slice(1),k=!1;return m.startsWith('"')&&(k=!0,m=m.slice(1),m.endsWith('"')&&(m=m.slice(0,-1))),{hasQuery:!0,query:m,startIndex:o,endIndex:l,quoted:k}}}return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}},Vc=(e,t,s={})=>{const{debounceDelay:n=200,maxSuggestions:r=15,workspacePath:o,disabled:l=!1,canRequest:m}=s,[k,v]=b.useState([]),[c,u]=b.useState(0),[i,d]=b.useState(!1),p=b.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}:Kc(e,t),[e,t]);b.useEffect(()=>{if(l||!p.hasQuery){v([]),d(!1);return}let h=!1;d(!0);const S=setTimeout(async()=>{if(!(l||(m==null?void 0:m())===!1))try{const T=await fetch(`/suggestions/files?q=${encodeURIComponent(p.query)}&limit=${r}`,o?{headers:{"x-blade-directory":o}}:void 0);if(!T.ok)throw new Error("Failed to fetch suggestions");const j=await T.json();h||v(j)}catch(T){console.error("Failed to fetch file suggestions:",T),h||v([])}finally{h||d(!1)}},n);return()=>{h=!0,clearTimeout(S)}},[l,p.hasQuery,p.query,n,r,o,m]),b.useEffect(()=>{u(0)},[k]);const g=b.useCallback(()=>{u(h=>(h+1)%Math.max(k.length,1))},[k.length]),f=b.useCallback(()=>{u(h=>(h-1+k.length)%Math.max(k.length,1))},[k.length]);return{...p,suggestions:k,selectedIndex:c,loading:i,setSelectedIndex:u,selectNext:g,selectPrevious:f}},Qc=(e,t=!1)=>e.includes(" ")||t?`@"${e}"`:`@${e}`,Wc=(e,t,s)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const n=Qc(s,t.quoted),r=e.slice(0,t.startIndex),o=e.slice(t.endIndex),l=r+n+" "+o,m=t.startIndex+n.length+1;return{newInput:l,newCursorPos:m}};function Gc(){const[e,t]=b.useState([]),[s,n]=b.useState(-1),r=b.useRef(""),o=b.useCallback(v=>{v.trim()&&(t(c=>c[c.length-1]===v?c:[...c,v]),n(-1),r.current="")},[]),l=b.useCallback(v=>{if(e.length===0)return null;s===-1&&(r.current=v);const c=s===-1?e.length-1:Math.max(0,s-1);return n(c),e[c]??null},[e,s]),m=b.useCallback(()=>{if(s===-1)return null;const v=s+1;return v>=e.length?(n(-1),r.current):(n(v),e[v]??null)},[e,s]),k=b.useCallback(()=>{n(-1),r.current=""},[]);return{addToHistory:o,getPrevious:l,getNext:m,reset:k,historyIndex:s}}const Jc=(e,t)=>{if(!e.startsWith("/"))return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1};const s=e.indexOf(" "),n=s===-1?e.length:s;return t<=n?{hasQuery:!0,query:e.slice(1,t),startIndex:0,endIndex:t}:{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}},Yc=(e,t,s={})=>{const{debounceDelay:n=150,workspacePath:r}=s,[o,l]=b.useState([]),[m,k]=b.useState(0),[v,c]=b.useState(!1),u=b.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}:Jc(e,t),[e,t]);b.useEffect(()=>{if(!u.hasQuery){l([]),c(!1);return}let p=!1;c(!0);const f=setTimeout(async()=>{try{const h=await fetch(`/suggestions/commands?q=${encodeURIComponent(u.query)}`,r?{headers:{"x-blade-directory":r}}:void 0);if(!h.ok)throw new Error("Failed to fetch suggestions");const C=await h.json();p||l(C)}catch(h){console.error("Failed to fetch command suggestions:",h),p||l([])}finally{p||c(!1)}},n);return()=>{p=!0,clearTimeout(f)}},[u.hasQuery,u.query,n,r]),b.useEffect(()=>{k(0)},[o]);const i=b.useCallback(()=>{k(p=>(p+1)%Math.max(o.length,1))},[o.length]),d=b.useCallback(()=>{k(p=>(p-1+o.length)%Math.max(o.length,1))},[o.length]);return{...u,suggestions:o,selectedIndex:m,loading:v,setSelectedIndex:k,selectNext:i,selectPrevious:d}},Xc=(e,t,s)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const n=e.slice(t.endIndex),r=s.command+" "+n.trimStart(),o=s.command.length+1;return{newInput:r,newCursorPos:o}},Zc="blade.composer.draft.",is=new Map,Zs=new Set,Qa=1;function cs(){return typeof sessionStorage>"u"?null:sessionStorage}function ls(e){return`${Zc}${e}`}function Wa(e){var s;if(!e)return{content:"",attachments:[],outputSchema:void 0};const t=is.get(e);if(t)return{content:t.content,attachments:[...t.attachments],outputSchema:t.outputSchema};try{const n=((s=cs())==null?void 0:s.getItem(ls(e)))??"";if(!n)return{content:"",attachments:[],outputSchema:void 0};try{const r=JSON.parse(n);if(r.version===Qa&&typeof r.content=="string"&&(r.outputSchema===void 0||typeof r.outputSchema=="string"))return{content:r.content,attachments:[],outputSchema:r.outputSchema}}catch{}return{content:n,attachments:[],outputSchema:void 0}}catch{return{content:"",attachments:[],outputSchema:void 0}}}function Oe(e,t){var r,o;if(!e)return;const s=is.get(e),n=t.outputSchema??(s==null?void 0:s.outputSchema);if(!t.content&&t.attachments.length===0&&!n){Ga(e);return}is.set(e,{content:t.content,attachments:[...t.attachments],outputSchema:n});try{t.content||n?(r=cs())==null||r.setItem(ls(e),JSON.stringify({version:Qa,content:t.content,...n?{outputSchema:n}:{}})):(o=cs())==null||o.removeItem(ls(e))}catch{}}function Ga(e){var t;if(e){is.delete(e);try{(t=cs())==null||t.removeItem(ls(e))}catch{}}}function Kl(e,t){const s=t.trim();if(!e||!s)return!1;const n=Wa(e),r=n.content.length===0?"":n.content.endsWith(`
198
198
  `)?`
199
199
  `:`
200
200
 
201
201
  `,o={...n,content:`${n.content}${r}${s}`};Oe(e,o);const l={key:e,draft:{...o,attachments:[...o.attachments]}};for(const m of Zs)m(l);return!0}function el(e){return Zs.add(e),()=>Zs.delete(e)}function en(e){return e.reduce((t,s)=>t+s.dataUrl.length,0)}function tl(e){return`data:${e.type||"application/octet-stream"};base64,`.length+4*Math.ceil(e.size/3)}function sl(e,t){const n=en(e)+t.reduce((r,o)=>r+tl(o),0);return e.length+t.length>Rt?{accepted:!1,reason:"count",estimatedBytes:n}:n>Jt?{accepted:!1,reason:"bytes",estimatedBytes:n}:{accepted:!0,estimatedBytes:n}}const nl=e=>typeof e=="object"&&"command"in e,ca=({type:e,suggestions:t,selectedIndex:s,loading:n,onSelect:r,onHover:o,visible:l})=>{const m=b.useRef(null),k=b.useRef(null);if(b.useEffect(()=>{if(k.current&&m.current){const c=m.current,u=k.current,i=c.getBoundingClientRect(),d=u.getBoundingClientRect();d.bottom>i.bottom?c.scrollTop+=d.bottom-i.bottom+4:d.top<i.top&&(c.scrollTop-=i.top-d.top+4)}},[s]),!l||t.length===0&&!n)return null;const v=e==="command"?xa:Ln;return a.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50",children:a.jsxs("div",{className:"mx-4 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700 rounded-lg shadow-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#6B7280] dark:text-zinc-400",children:[a.jsx(v,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:e==="command"?"Commands":"Files"}),n&&a.jsx(He,{className:"h-3 w-3 animate-spin ml-auto"})]}),a.jsx("div",{ref:m,className:"max-h-64 overflow-y-auto py-1",children:t.length===0&&n?a.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"Loading..."}):t.length===0?a.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"No matches found"}):t.map((c,u)=>{const i=u===s,d=nl(c);return a.jsx("button",{ref:i?k:null,className:te("w-full text-left px-3 py-2 flex items-start gap-3 transition-colors",i?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] hover:bg-[#F3F4F6] hover:text-[#111827] dark:text-zinc-400 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300"),onClick:()=>r(u),onMouseEnter:()=>o(u),children:d?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-sm text-blue-600 dark:text-blue-400",children:c.command}),c.argumentHint&&a.jsx("span",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 font-mono",children:c.argumentHint})]}),a.jsx("p",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 mt-0.5 truncate",children:c.description})]})}):a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(Ln,{className:"h-4 w-4 flex-shrink-0 text-[#9CA3AF] dark:text-zinc-500"}),a.jsx("span",{className:"font-mono text-sm truncate",children:c})]})},d?c.command:c)})}),a.jsxs("div",{className:"px-3 py-1.5 border-t border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#9CA3AF] dark:text-zinc-500 flex items-center gap-4",children:[a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"↑↓"})," ","Navigate"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Tab"})," ","Select"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Esc"})," ","Close"]})]})]})})},al=()=>!W(L.getState().historySurfaceSelection),Bs=[{value:Ze.DEFAULT,labelKey:"chat.input.mode.default",descriptionKey:"chat.input.mode.default.desc",icon:To},{value:Ze.AUTO_EDIT,labelKey:"chat.input.mode.autoEdit",descriptionKey:"chat.input.mode.autoEdit.desc",icon:Fo},{value:Ze.YOLO,labelKey:"chat.input.mode.yolo",descriptionKey:"chat.input.mode.yolo.desc",icon:Sa,tone:"danger"},{value:Ze.PLAN,labelKey:"chat.input.mode.plan",descriptionKey:"chat.input.mode.plan.desc",icon:xo}],rl=["off"],ol=["high","xhigh","medium","max","low","minimal","off"],il=["standard"],cl=[];function ll(e){return ol.find(t=>e.includes(t))??"off"}function $s(e){return e<1024*1024?`${Math.max(1,Math.ceil(e/1024))} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function dl({onSend:e,onAbort:t,disabled:s,submitDisabled:n=!1,shellSubmitDisabled:r=!1,isStreaming:o,isStopping:l=!1,pendingSteeringCount:m=0,pendingInputDelivery:k=null,recoveredSteeringCount:v=0,variant:c="chat",draft:u,draftAttachments:i,draftRevision:d,draftKey:p,placeholder:g,workspacePath:f}){var Tn;const h=$e(),C=b.useRef(Wa(p)),[S,T]=b.useState(C.current.content),[j,A]=b.useState(C.current.attachments),w=b.useRef(S),E=b.useRef(j),[F,x]=b.useState(C.current.outputSchema??""),N=b.useRef(F),[P,B]=b.useState(!1),[U,_]=b.useState(null),[Q,Z]=b.useState(void 0),[ne,K]=b.useState(!1),[$,R]=b.useState(!1),[le,ge]=b.useState(!1),[ve,xe]=b.useState(!1),[Re,Se]=b.useState(!1),[Le,de]=b.useState(!1),[J,Y]=b.useState(!1),[ue,he]=b.useState(null),[I,q]=b.useState(null),ie=S.trimStart().startsWith("!"),Ce=ie?r:n,fe=b.useRef(null),Ke=b.useRef(!1),we=b.useRef(null),M=b.useRef(null),{currentModelId:Ee,configuredModels:be,hasLoaded:Ne,loadedWorkspacePath:pn,loadModels:hn,setCurrentModel:Za,currentMode:Mt,setMode:mn}=Te(),gn=De(y=>y.isSettingsOpen),er=ut(y=>y.communicationStyle),fn=L(y=>y.setMaxContextTokens),vs=L(y=>W(y.historySurfaceSelection)),ae=L(y=>y.currentSessionRef),kn=L(y=>{var H;return(H=y.sessions.find(O=>O.sessionId===(ae==null?void 0:ae.sessionId)&&O.projectPath===(ae==null?void 0:ae.projectPath)))==null?void 0:H.selectedModelId}),tr=L(y=>{var H;return(H=y.sessions.find(O=>O.sessionId===(ae==null?void 0:ae.sessionId)&&O.projectPath===(ae==null?void 0:ae.projectPath)))==null?void 0:H.reasoningEffort}),sr=L(y=>{var H;return(H=y.sessions.find(O=>O.sessionId===(ae==null?void 0:ae.sessionId)&&O.projectPath===(ae==null?void 0:ae.projectPath)))==null?void 0:H.serviceTier}),nr=L(y=>{var H;return(H=y.sessions.find(O=>O.sessionId===(ae==null?void 0:ae.sessionId)&&O.projectPath===(ae==null?void 0:ae.projectPath)))==null?void 0:H.responseVerbosity}),[ar,yn]=b.useState(null),[rr,vn]=b.useState(null),[or,bs]=b.useState(null),[ir,ws]=b.useState(null),cr=be.some(y=>y.id===kn),pt=ae?ar??(cr?kn:Ee):Ee,ke=be.find(y=>y.id===pt),It=((ke==null?void 0:ke.supportedReasoningEfforts)??rl).filter(y=>y!=="auto"),Ft=rr??tr,lr=ll(It),Ot=Ft!==void 0&&Ft!=="auto"&&It.includes(Ft)?Ft:lr,Ht=(ke==null?void 0:ke.supportedServiceTiers)??il,dr=["auto",...Ht],tt=or??sr??"auto",Lt=(ke==null?void 0:ke.supportedResponseVerbosities)??cl,ur=["auto",...Lt],st=ir??nr??"auto",bn=er??"auto",pr=It.length>1,hr=Ht.some(y=>y!=="standard"),mr=Lt.length>0,wn=(ke==null?void 0:ke.displayName)||(ke==null?void 0:ke.model)||pt||h("chat.input.model.placeholder"),Ve=((Tn=ke==null?void 0:ke.input)==null?void 0:Tn.includes("image"))===!0,bt=ke?h("chat.input.attachment.modelUnsupported",{model:wn}):h("chat.input.attachment.modelRequired"),Dt=j.length>0&&!Ve,Me=Yc(S,Q,{workspacePath:f}),Ie=Vc(S,Q,{workspacePath:f,disabled:vs,canRequest:al}),ht=Gc(),wt=Me.hasQuery&&Me.suggestions.length>0,Ut=Ie.hasQuery&&Ie.suggestions.length>0,gr=wt||Ut;b.useEffect(()=>{!gn&&(!Ne||pn!==(f??null))&&hn(f??void 0)},[gn,hn,pn,Ne,f]),b.useEffect(()=>{o&&(K(!1),R(!1),ge(!1),xe(!1),B(!1))},[o]),b.useEffect(()=>{yn(null),vn(null),bs(null),ws(null)},[ae==null?void 0:ae.projectPath,ae==null?void 0:ae.sessionId]),b.useEffect(()=>{tt!=="auto"&&!Ht.includes(tt)&&bs("auto")},[tt,Ht]),b.useEffect(()=>{st!=="auto"&&!Lt.includes(st)&&ws("auto")},[st,Lt]),b.useEffect(()=>{q(null)},[pt]),b.useEffect(()=>{if(u!==void 0){const y=i??E.current;w.current=u,E.current=y,T(u),A(y),he(null),q(null),Z(u.length),Oe(p,{content:u,attachments:y}),requestAnimationFrame(()=>{var H;return(H=we.current)==null?void 0:H.focus()})}},[u,i,p,d]),b.useEffect(()=>()=>{Oe(p,{content:w.current,attachments:E.current,outputSchema:N.current})},[p]),b.useEffect(()=>el(y=>{if(y.key!==p)return;const H=y.draft.attachments;w.current=y.draft.content,E.current=H,T(y.draft.content),A(H),Z(y.draft.content.length),requestAnimationFrame(()=>{var O,se;(O=we.current)==null||O.focus(),(se=we.current)==null||se.setSelectionRange(y.draft.content.length,y.draft.content.length)})}),[p]),b.useEffect(()=>{if(!ke)return;const y=!!ke.contextWindow;fn(ke.contextWindow||0,!y)},[ke,fn]),b.useEffect(()=>{Ve&&he(y=>y!==fe.current?y:(fe.current=null,null))},[Ve]);const xs=b.useCallback(async()=>{if(qe(L.getState())||!S.trim()&&j.length===0||s||Ce||Dt||Ke.current)return;let y;if(F.trim()){if(ie){_(h("chat.input.outputSchema.shellUnsupported")),B(!0);return}try{const O=JSON.parse(F);if(!O||typeof O!="object"||Array.isArray(O))throw new Error("schema root must be an object");y=O}catch{_(h("chat.input.outputSchema.invalid")),B(!0);return}}S.trim()&&ht.addToHistory(S),Ke.current=!0,Y(!0);const H=p;try{if(await e({content:S,modelId:pt??void 0,reasoningEffort:Ot,serviceTier:tt,responseVerbosity:st,communicationStyle:bn,attachments:j,...y?{outputSchema:y}:{}})===!1)return;Ga(H),w.current="",E.current=[],N.current="",T(""),A([]),x(""),_(null),he(null),q(null),fe.current=null,Z(void 0)}catch{}finally{Ke.current=!1,Y(!1)}},[j,Dt,p,S,ie,s,pt,Ot,st,bn,tt,Ce,e,F,ht,h]),fr=b.useCallback(()=>{qe(L.getState())||t==null||t()},[t]),kr=b.useCallback(y=>{he(null),q(null),fe.current=null,A(H=>{const O=H.filter(se=>se.id!==y);return E.current=O,Oe(p,{content:w.current,attachments:O}),O})},[p]),xn=b.useCallback(y=>new Promise((H,O)=>{const se=new FileReader;se.onload=()=>{if(typeof se.result!="string"){O(new Error("Failed to read image"));return}H({id:typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:y.name,mimeType:y.type,dataUrl:se.result})},se.onerror=()=>O(se.error??new Error("Failed to read image")),se.readAsDataURL(y)}),[]),qt=b.useCallback(async y=>{if(y.length===0)return;if(!Ve){fe.current=bt,q(null),he(bt);return}const H=sl(E.current,y),O=se=>se==="count"?h("chat.input.attachment.countLimit",{count:Rt}):h("chat.input.attachment.sizeLimit",{size:$s(Jt)});if(!H.accepted){fe.current=null,q(null),he(O(H.reason??"bytes"));return}try{const se=await Promise.all(y.map(mt=>xn(mt))),je=new Set(E.current.map(mt=>mt.dataUrl)),Pn=se.filter(mt=>je.has(mt.dataUrl)?!1:(je.add(mt.dataUrl),!0));if(Pn.length===0){he(null),q(null),fe.current=null;return}const zt=[...E.current,...Pn];if(en(zt)>Jt){fe.current=null,q(null),he(O("bytes"));return}E.current=zt,A(zt),he(null),q(null),fe.current=null,Oe(p,{content:w.current,attachments:zt})}catch{fe.current=null,q(null),he(h("chat.input.attachment.readFailed"))}},[p,bt,Ve,xn,h]),yr=b.useCallback(async y=>{const H=Array.from(y.target.files??[]).filter(O=>O.type.startsWith("image/"));await qt(H),y.target.value=""},[qt]),vr=b.useCallback(async y=>{const H=Array.from(y.clipboardData.items).filter(O=>O.type.startsWith("image/")).map(O=>O.getAsFile()).filter(O=>O!==null);H.length!==0&&(y.preventDefault(),await qt(H))},[qt]),Ss=b.useCallback(y=>{const H=Me.suggestions[y];if(!H)return;const{newInput:O,newCursorPos:se}=Xc(S,Me,H);w.current=O,T(O),Z(se),Oe(p,{content:O,attachments:E.current}),requestAnimationFrame(()=>{we.current&&(we.current.focus(),we.current.setSelectionRange(se,se))})},[p,S,Me]),Cs=b.useCallback(y=>{const H=Ie.suggestions[y];if(!H)return;const{newInput:O,newCursorPos:se}=Wc(S,Ie,H);w.current=O,T(O),Z(se),Oe(p,{content:O,attachments:E.current}),requestAnimationFrame(()=>{we.current&&(we.current.focus(),we.current.setSelectionRange(se,se))})},[Ie,p,S]),br=b.useCallback(y=>{if(wt){if(y.key==="ArrowDown"){y.preventDefault(),Me.selectNext();return}if(y.key==="ArrowUp"){y.preventDefault(),Me.selectPrevious();return}if(y.key==="Tab"||y.key==="Enter"&&!y.shiftKey){y.preventDefault(),Ss(Me.selectedIndex);return}if(y.key==="Escape"){y.preventDefault(),Z(void 0);return}}if(Ut){if(y.key==="ArrowDown"){y.preventDefault(),Ie.selectNext();return}if(y.key==="ArrowUp"){y.preventDefault(),Ie.selectPrevious();return}if(y.key==="Tab"||y.key==="Enter"&&!y.shiftKey){y.preventDefault(),Cs(Ie.selectedIndex);return}if(y.key==="Escape"){y.preventDefault(),Z(void 0);return}}if(y.key==="Enter"&&!y.shiftKey){y.preventDefault(),xs();return}if(y.key==="ArrowUp"&&!y.shiftKey){const H=y.target,O=H.selectionStart===0&&H.selectionEnd===0,se=!S.includes(`
202
202
  `);if(O||se){const je=ht.getPrevious(S);je!==null&&(y.preventDefault(),w.current=je,T(je),Oe(p,{content:je,attachments:E.current}),requestAnimationFrame(()=>{we.current&&we.current.setSelectionRange(je.length,je.length)}))}return}if(y.key==="ArrowDown"&&!y.shiftKey){const H=y.target,O=H.selectionStart===S.length&&H.selectionEnd===S.length,se=!S.includes(`
203
- `);if((O||se)&&ht.historyIndex!==-1){const je=ht.getNext();je!==null&&(y.preventDefault(),w.current=je,T(je),Oe(p,{content:je,attachments:E.current}),requestAnimationFrame(()=>{we.current&&we.current.setSelectionRange(je.length,je.length)}))}}},[wt,Ut,Me,Ie,Ss,Cs,xs,p,S,ht]),wr=b.useCallback(y=>{const H=y.target.value;w.current=H,T(H),Z(y.target.selectionStart),Oe(p,{content:H,attachments:E.current})},[p]),Sn=b.useCallback(y=>{const H=y.target;Z(H.selectionStart)},[]);b.useEffect(()=>{we.current&&(we.current.style.height="inherit",we.current.style.height=`${Math.min(we.current.scrollHeight,200)}px`)},[S]);const js=Bs.find(y=>y.value===Mt)??Bs[1],xr=h(js.labelKey),Sr=js.icon,Cr=!!S.trim()||j.length>0,Cn=j.length>=Rt,jr=en(j),Ts=ue||(Dt?bt:null),jn=Ts?null:I,Qe=!!s||vs,Ps=Qe||J,Tr=Ps||Cn||!Ve,xt=Ve?Cn?h("chat.input.attachment.countLimit",{count:Rt}):h("chat.input.attachment.add"):bt,Pr=()=>{Ps||(q(xt),!Ve&&!o&&be.some(y=>{var H;return(H=y.input)==null?void 0:H.includes("image")})&&K(!0))};return a.jsxs("div",{"data-chat-input-shell":!0,className:c==="task"?"bg-transparent":"py-2.5 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]",children:[a.jsxs("div",{"data-chat-input-inner":!0,className:c==="task"?"w-full":"px-4 w-full md:px-6",children:[a.jsxs("div",{className:`relative border rounded-lg bg-[hsl(var(--deck-surface))] transition-all duration-200 flex flex-col ${c==="task"?`min-h-[148px] shadow-[0_18px_60px_-24px_hsl(var(--deck-accent)/0.4)] focus-within:ring-1 ${ie?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-accent)/0.6)] focus-within:ring-[hsl(var(--deck-accent)/0.25)]"}`:`min-h-[56px] shadow-sm focus-within:ring-1 ${ie?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-border-strong))] focus-within:ring-[hsl(var(--deck-border-strong))]"}`}`,children:[a.jsx(ca,{type:"command",suggestions:Me.suggestions,selectedIndex:Me.selectedIndex,loading:Me.loading,onSelect:Ss,onHover:Me.setSelectedIndex,visible:wt}),a.jsx(ca,{type:"file",suggestions:Ie.suggestions,selectedIndex:Ie.selectedIndex,loading:Ie.loading,onSelect:Cs,onHover:Ie.setSelectedIndex,visible:Ut&&!wt}),a.jsx(Xs,{ref:we,"data-blade-composer":!0,value:S,onChange:wr,onKeyDown:br,onPaste:vr,onSelect:Sn,onClick:Sn,placeholder:g??h(o?"chat.input.placeholder.steering":"chat.input.placeholder.default"),className:`flex-1 w-full resize-none border-0 bg-transparent px-4 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none text-[#111827] dark:text-zinc-300 placeholder:text-[#9CA3AF] dark:placeholder:text-zinc-600 ${c==="task"?"min-h-[84px] py-4 text-[15px]":"py-2.5 text-[14px]"}`,disabled:Qe||J,"aria-busy":J}),ie&&a.jsx("div",{className:"px-4 pb-2 font-mono text-[11px] text-amber-600 dark:text-amber-400",children:"$ user shell · runs in this Session workspace"}),o&&a.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-amber-600 dark:text-amber-400",children:m>0&&k==="next_turn"?h("chat.input.followUp.queued",{count:m}):m>0?h("chat.input.steering.queued",{count:m}):a.jsxs(a.Fragment,{children:[h("chat.input.steering.status"),h("chat.input.steering.enterHint")]})}),v>0&&a.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-cyan-600 dark:text-cyan-400",children:v===1?h("chat.input.steering.recoveredOne",{count:v}):h("chat.input.steering.recoveredMany",{count:v})}),Ts&&a.jsxs("div",{role:"alert",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[a.jsx(ss,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"flex-1 min-w-0",children:Ts}),ue&&a.jsx("button",{type:"button","aria-label":h("chat.error.dismiss"),onClick:()=>{he(null),fe.current=null},className:"flex justify-center items-center w-6 h-6 text-red-500 rounded shrink-0 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 dark:hover:bg-red-950",children:a.jsx(Xt,{className:"w-3 h-3"})})]}),jn&&a.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2.5 py-1.5 text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[a.jsx(Ao,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),a.jsx("span",{className:"flex-1 min-w-0",children:jn}),a.jsx("button",{type:"button","aria-label":h("chat.notice.dismiss"),onClick:()=>q(null),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))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:a.jsx(Xt,{className:"w-3 h-3"})})]}),j.length>0&&a.jsxs("div",{className:"px-4 pb-2",children:[a.jsx("div",{className:"mb-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:h("chat.input.attachment.usage",{count:j.length,limit:Rt,used:$s(jr),budget:$s(Jt)})}),a.jsx("div",{className:"flex flex-wrap gap-2",children:j.map(y=>a.jsxs("div",{title:y.name,className:"relative overflow-hidden rounded-md border border-[#E5E7EB] bg-[#F9FAFB] dark:border-zinc-800 dark:bg-zinc-900",children:[a.jsx("img",{src:y.dataUrl,alt:y.name,className:"object-cover w-20 h-20"}),a.jsx("button",{type:"button","aria-label":`${h("chat.input.attachment.remove")} ${y.name}`,title:`${h("chat.input.attachment.remove")} ${y.name}`,onClick:()=>kr(y.id),className:"flex absolute top-1 right-1 justify-center items-center w-6 h-6 text-white rounded transition-colors bg-black/75 hover:bg-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:a.jsx(Xt,{className:"w-3 h-3"})})]},y.id))})]}),a.jsxs("div",{className:"flex justify-between items-center px-3 py-2 mt-auto",children:[a.jsxs("div",{className:"flex gap-2 items-center",children:[Tr?a.jsx("button",{type:"button",disabled:Ps,"aria-disabled":"true","aria-label":xt,title:xt,onClick:Pr,className:"flex h-8 w-8 cursor-help items-center justify-center rounded-md text-[#9CA3AF] opacity-55 transition-colors hover:bg-[hsl(var(--deck-surface-2))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed dark:text-zinc-500",children:a.jsx(Un,{className:"w-4 h-4"})}):a.jsxs("label",{title:xt,className:"relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[#9CA3AF] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-within:ring-1 focus-within:ring-[hsl(var(--deck-accent))] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300",children:[a.jsx("input",{ref:M,type:"file",accept:"image/*",multiple:!0,"aria-label":xt,className:"absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer",onChange:yr}),a.jsx(Un,{className:"w-4 h-4"})]}),a.jsxs(at,{open:ne,onOpenChange:y=>{!o&&!J&&K(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,title:h(o?"chat.input.model.locked":"chat.input.model.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 text-xs text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[wn,a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsx(Xe,{className:"w-64 p-2 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:a.jsx("div",{className:"overflow-y-auto max-h-72",children:be.length===0?a.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-2",children:h("chat.input.model.empty")}):Object.entries(be.reduce((y,H)=>{const O=H.provider||"unknown";return y[O]||(y[O]=[]),y[O].push(H),y},{})).map(([y,H])=>a.jsxs("div",{className:"mb-2",children:[a.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-1 capitalize",children:y.replace(/-/g," ")}),H.map(O=>{var se;return a.jsx("button",{className:`w-full text-left px-2 py-1.5 text-sm rounded hover:bg-[#E5E7EB] dark:hover:bg-zinc-800 transition-colors ${O.id===pt?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,onClick:()=>{if(q(null),ae){yn(O.id),K(!1);return}Za(O.id,f??void 0).then(()=>K(!1)).catch(()=>{})},children:a.jsxs("span",{className:"flex gap-2 items-center min-w-0",children:[a.jsx("span",{className:"flex-1 min-w-0 truncate",children:O.displayName||O.model}),((se=O.input)==null?void 0:se.includes("image"))&&a.jsx("span",{className:"shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.08em] text-[hsl(var(--deck-accent))]",children:h("chat.input.model.vision")})]})},O.id)})]},y))})})]}),pr&&a.jsxs(at,{open:$,onOpenChange:y=>{!o&&!J&&R(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,"aria-label":h("chat.input.effort.change"),title:h(o?"chat.input.effort.locked":"chat.input.effort.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[h("chat.input.effort.label",{effort:Ot}),a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsxs(Xe,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[a.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.effort.heading")}),a.jsx("div",{className:"flex flex-col gap-0.5",children:It.map(y=>a.jsx("button",{type:"button","aria-label":h("chat.input.effort.option",{effort:y}),onClick:()=>{vn(y),R(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Ot===y?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:a.jsx("span",{className:"capitalize",children:y})},y))})]})]}),hr&&a.jsxs(at,{open:le,onOpenChange:y=>{!o&&!J&&ge(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,"aria-label":h("chat.input.serviceTier.change"),title:h(o?"chat.input.serviceTier.locked":"chat.input.serviceTier.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[h("chat.input.serviceTier.label",{tier:tt}),a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsxs(Xe,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[a.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.serviceTier.heading")}),a.jsx("div",{className:"flex flex-col gap-0.5",children:dr.map(y=>a.jsxs("button",{type:"button","aria-label":h("chat.input.serviceTier.option",{tier:y}),onClick:()=>{bs(y),ge(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${tt===y?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[a.jsx("span",{className:"capitalize",children:y}),y==="fast"&&a.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.serviceTier.fastHint")}),y==="flex"&&a.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.serviceTier.flexHint")})]},y))})]})]}),mr&&a.jsxs(at,{open:ve,onOpenChange:y=>{!o&&!J&&xe(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,"aria-label":h("chat.input.responseVerbosity.change"),title:h(o?"chat.input.responseVerbosity.locked":"chat.input.responseVerbosity.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[h("chat.input.responseVerbosity.label",{verbosity:st}),a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsxs(Xe,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[a.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.responseVerbosity.heading")}),a.jsx("div",{className:"flex flex-col gap-0.5",children:ur.map(y=>a.jsxs("button",{type:"button","aria-label":h("chat.input.responseVerbosity.option",{verbosity:y}),onClick:()=>{ws(y),xe(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${st===y?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[a.jsx("span",{className:"capitalize",children:y}),y==="auto"&&a.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.responseVerbosity.autoHint")})]},y))})]})]}),a.jsxs(at,{open:P,onOpenChange:y=>{!o&&!J&&B(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,"aria-label":h("chat.input.outputSchema.change"),title:h(o?"chat.input.outputSchema.locked":"chat.input.outputSchema.change"),className:`flex h-7 items-center gap-1 rounded px-1.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 ${F.trim()?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[a.jsx(bo,{className:"h-3.5 w-3.5"}),F.trim()&&"JSON"]})}),a.jsxs(Xe,{className:"w-[min(440px,calc(100vw-24px))] border border-[#E5E7EB] bg-white p-0 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[a.jsxs("div",{className:"border-b border-[#E5E7EB] px-3 py-2.5 dark:border-zinc-800",children:[a.jsx("div",{className:"font-mono text-[11px] font-semibold text-[#111827] dark:text-zinc-100",children:h("chat.input.outputSchema.title")}),a.jsx("div",{className:"mt-0.5 text-[10.5px] leading-4 text-[#6B7280] dark:text-zinc-500",children:h("chat.input.outputSchema.description")})]}),a.jsxs("div",{className:"p-3",children:[a.jsx(Xs,{value:F,onChange:y=>{const H=y.target.value;N.current=H,x(H),_(null),Oe(p,{content:w.current,attachments:E.current,outputSchema:H})},spellCheck:!1,"aria-label":h("chat.input.outputSchema.editor"),"aria-invalid":!!U,placeholder:h("chat.input.outputSchema.placeholder"),className:"min-h-[180px] resize-y border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] font-mono text-[11px] leading-5 focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]"}),U&&a.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-[10.5px] text-red-600 dark:text-red-400",children:[a.jsx(ss,{className:"h-3.5 w-3.5"}),U]}),a.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{const y=JSON.stringify({type:"object",properties:{summary:{type:"string"}},required:["summary"],additionalProperties:!1},null,2);N.current=y,x(y),_(null),Oe(p,{content:w.current,attachments:E.current,outputSchema:y})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))]",children:h("chat.input.outputSchema.example")}),a.jsx("button",{type:"button",onClick:()=>{N.current="",x(""),_(null),Oe(p,{content:w.current,attachments:E.current,outputSchema:""})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[#6B7280] hover:bg-[#F3F4F6] dark:text-zinc-400 dark:hover:bg-zinc-800",children:h("chat.input.outputSchema.clear")})]})]})]})]}),a.jsxs(at,{open:Re,onOpenChange:Se,children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{"data-blade-permission-mode":Mt,className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs transition-colors ${js.tone==="danger"?"text-amber-600 hover:bg-amber-500/10 dark:text-amber-400":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[a.jsx(Sr,{className:"h-3.5 w-3.5"}),xr,a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsxs(Xe,{className:"w-72 p-1.5 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:[a.jsx("div",{className:"px-2 pb-1.5 pt-1 text-[11px] font-medium text-[#9CA3AF] dark:text-zinc-500",children:h("chat.input.mode.aria")}),a.jsx("div",{className:"flex flex-col gap-0.5",children:Bs.map(y=>{const H=y.icon,O=Mt===y.value,se=y.tone==="danger";return a.jsxs("button",{type:"button","data-blade-permission-option":y.value,"aria-pressed":O,className:`flex w-full items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${O?"bg-[#F3F4F6] dark:bg-zinc-800/70":"hover:bg-[#F3F4F6] dark:hover:bg-zinc-800/50"}`,onClick:()=>{y.value===Ze.YOLO&&Mt!==Ze.YOLO?(Se(!1),de(!0)):(mn(y.value),Se(!1))},children:[a.jsx(H,{className:`mt-0.5 h-4 w-4 shrink-0 ${se?"text-amber-500":O?"text-[#111827] dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`}),a.jsxs("span",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:`block text-[13px] font-medium leading-tight ${se?"text-amber-600 dark:text-amber-400":"text-[#111827] dark:text-zinc-100"}`,children:h(y.labelKey)}),a.jsx("span",{className:"mt-0.5 block text-[11px] leading-snug text-[#6B7280] dark:text-zinc-500",children:h(y.descriptionKey)})]}),O&&a.jsx(wo,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"})]},y.value)})})]})]})]}),a.jsxs("div",{className:"flex gap-2 items-center",children:[o&&a.jsx(lt,{size:"icon",onClick:fr,disabled:vs||l,title:h(l?"chat.input.action.stopping":"chat.input.action.stop"),"aria-label":h(l?"chat.input.action.stopping":"chat.input.action.stop"),className:"w-8 h-8 text-white bg-red-500 hover:bg-red-600",children:l?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Ca,{className:"w-3 h-3"})}),a.jsx(lt,{size:"icon","data-blade-submit":!0,onClick:xs,disabled:!Cr||Qe||Ce||Dt||J||gr,title:h(J?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),"aria-label":h(J?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),className:"h-8 w-8 bg-[#111827] text-white hover:bg-[#0F172A] disabled:bg-[#E5E7EB] disabled:text-[#9CA3AF] dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white dark:disabled:bg-zinc-800 dark:disabled:text-zinc-600",children:J?a.jsx(He,{className:"w-4 h-4 animate-spin"}):a.jsx(Io,{className:"w-4 h-4"})})]})]})]}),c==="chat"&&a.jsx("div",{className:"text-center text-xs text-[#6B7280] dark:text-zinc-600 mt-3 font-mono",children:h("chat.footer.disclaimer")})]}),a.jsx(on,{open:Le,onOpenChange:de,children:a.jsx(hs,{className:"gap-0 rounded-xl border border-zinc-200 bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b] sm:max-w-[400px]","aria-describedby":"yolo-confirm-desc",hideCloseButton:!0,children:a.jsxs("div",{className:"flex flex-col gap-4 p-5",children:[a.jsxs("div",{className:"flex gap-3 items-center",children:[a.jsx("div",{className:"flex justify-center items-center w-9 h-9 bg-amber-100 rounded-full dark:bg-amber-950/40",children:a.jsx(Sa,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"})}),a.jsx(ms,{className:"font-mono text-sm font-semibold",children:h("chat.input.mode.yolo.confirm.title")})]}),a.jsx(gs,{id:"yolo-confirm-desc",className:"text-[13px] leading-relaxed text-zinc-600 dark:text-zinc-400",children:h("chat.input.mode.yolo.confirm.desc")}),a.jsxs("div",{className:"flex gap-2 justify-end items-center pt-1",children:[a.jsx("button",{type:"button",onClick:()=>de(!1),className:"h-8 rounded-md px-3 font-mono text-[12px] font-medium text-zinc-600 transition-colors hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:h("chat.input.mode.yolo.confirm.cancel")}),a.jsx("button",{type:"button","data-blade-yolo-confirm":!0,onClick:()=>{mn(Ze.YOLO),de(!1)},className:"h-8 rounded-md bg-amber-600 px-3 font-mono text-[12px] font-semibold text-white transition-colors hover:bg-amber-700",children:h("chat.input.mode.yolo.confirm.accept")})]})]})})})]})}function ul({className:e,size:t=28,pulse:s=!0}){return a.jsxs("span",{className:te("inline-flex relative justify-center items-center","text-[hsl(var(--deck-ink))]",e),style:{width:t,height:t},"aria-hidden":"true",children:[a.jsxs("svg",{viewBox:"0 0 32 32",width:t,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M16 3 L28 16 L16 29 L4 16 Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),a.jsx("path",{d:"M16 8 L24 16 L16 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.55"}),a.jsx("path",{d:"M16 3 L20 7",stroke:"hsl(var(--deck-accent))",strokeWidth:"2",strokeLinecap:"round"})]}),s&&a.jsx("span",{className:"absolute top-[3px] right-[3px] h-1.5 w-1.5 rounded-full",style:{background:"hsl(var(--deck-accent-glow))",boxShadow:"0 0 6px hsl(var(--deck-accent-glow) / 0.9)"}})]})}const pl="[data-mobile-navigation-trigger]";function Vl(e){return Ja(pl,e)}function Ja(e,t){const s=document.querySelector(e);return!s||s.getClientRects().length===0?!1:(t.preventDefault(),s.focus({preventScroll:!0}),!0)}function hl({open:e,onOpenChange:t}){const s=$e(),{boundProjects:n,selectedProjectPath:r,isBindingProject:o,loadBoundProjects:l,bindProject:m,unbindProject:k,selectProject:v,startTemporarySession:c}=L(),u=L(w=>W(w.historySurfaceSelection)),[i,d]=b.useState(""),[p,g]=b.useState(null),[f,h]=b.useState(!1),C=b.useRef(0);b.useEffect(()=>{if(e&&!u){l();return}C.current+=1,h(!1)},[u,l,e]);const S=async w=>{qe(L.getState())||(await m(w),d(""),c(),t(!1))},T=async w=>{if(w.preventDefault(),!(!i.trim()||o||f)){g(null);try{await S(i.trim())}catch(E){g(E instanceof Error?E.message:s("projects.bind.failed"))}}},j=async()=>{if(qe(L.getState())||f||o)return;const w=++C.current;g(null),h(!0);try{const E=await D.pickProjectDirectory();if(w!==C.current||E.cancelled)return;d(E.path),await S(E.path)}catch(E){if(w!==C.current)return;g(E instanceof Error?E.message:s("projects.pick.failed"))}finally{w===C.current&&h(!1)}},A=w=>{qe(L.getState())||(v(w),c(),t(!1))};return!e||u?null:a.jsx(on,{open:e,onOpenChange:t,children:a.jsxs(hs,{onCloseAutoFocus:w=>Ja("[data-project-setup-trigger]",w),className:"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] sm:max-w-xl",children:[a.jsxs(cn,{children:[a.jsxs(ms,{className:"flex items-center gap-2 font-mono text-[16px]",children:[a.jsx(Vs,{className:"h-4 w-4 text-[hsl(var(--deck-accent))]"}),s("projects.dialog.title")]}),a.jsx(gs,{className:"text-[12px] text-[hsl(var(--deck-ink-muted))]",children:s("projects.dialog.description")})]}),a.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[a.jsx("input",{value:i,onChange:w=>d(w.target.value),disabled:o,placeholder:s("projects.bind.placeholder"),"aria-label":s("projects.bind.pathLabel"),className:"h-9 min-w-0 flex-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12px] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.65)]"}),a.jsxs("button",{type:"button",onClick:()=>void j(),disabled:f||o,title:s("projects.pick.action"),"aria-label":s("projects.pick.action"),className:"inline-flex h-9 shrink-0 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.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))] disabled:cursor-wait disabled:opacity-50",children:[f?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Co,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"hidden sm:inline",children:s(f?"projects.pick.picking":"projects.pick.actionShort")})]}),a.jsxs("button",{type:"submit",disabled:!i.trim()||o||f,className:"inline-flex h-9 items-center gap-2 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[12px] text-[hsl(var(--deck-canvas))] transition-opacity disabled:opacity-40",children:[o?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Vs,{className:"h-3.5 w-3.5"}),s("projects.bind.action")]})]}),p&&a.jsx("div",{role:"alert",className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:p}),a.jsx("div",{className:"max-h-72 space-y-1 overflow-y-auto",children:n.map(w=>{const E=w.path===r;return a.jsxs("div",{className:te("group flex items-center gap-3 rounded-md border px-3 py-2",E?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))]":"border-transparent hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[a.jsx(Yt,{className:te("h-4 w-4 shrink-0",E?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),a.jsxs("button",{type:"button",disabled:!w.available,onClick:()=>A(w.path),className:"min-w-0 flex-1 text-left disabled:cursor-not-allowed disabled:opacity-50",children:[a.jsx("span",{className:"block truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:w.name}),a.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[w.gitBranch&&a.jsxs(a.Fragment,{children:[a.jsx(nn,{className:"h-2.5 w-2.5"}),a.jsx("span",{children:w.gitBranch}),a.jsx("span",{children:"·"})]}),a.jsx("span",{className:"truncate",children:w.path}),!w.available&&a.jsxs("span",{className:"shrink-0 text-red-500",children:["· ",s("projects.unavailable")]})]})]}),!w.isCurrent&&a.jsx("button",{type:"button",onClick:()=>qe(L.getState())?void 0:void k(w.path).catch(()=>{}),title:s("projects.unbind.action"),"aria-label":s("projects.unbind.action"),className:"rounded p-1.5 text-[hsl(var(--deck-ink-faint))] opacity-0 transition group-hover:opacity-100 hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 dark:hover:bg-red-950/30",children:a.jsx(Ho,{className:"h-3.5 w-3.5"})})]},w.path)})})]})})}function ml(e,t){var r;const s=(r=e.title)==null?void 0:r.trim();if(s==="Code Review")return t("session.title.codeReview");if(s)return s;const n=e.firstMessageTime||e.lastMessageTime;if(n){const o=new Date(n);if(!Number.isNaN(o.getTime()))return t("recent.session.fallbackDated",{y:String(o.getFullYear()).slice(-2),m:String(o.getMonth()+1).padStart(2,"0"),d:String(o.getDate()).padStart(2,"0"),hh:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0")})}return t("recent.session.fallbackShort",{id:e.sessionId.slice(0,6)})}function la(e){const t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;const s=new Date(t).getTime();return Number.isNaN(s)?0:s}function da(e){return e.pendingInteraction?0:e.taskStatus==="running"?1:e.taskStatus==="queued"?2:3}function gl(e,t){return da(e)-da(t)||la(t)-la(e)}const fl={running:{dot:"bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",labelKey:"recent.status.running",text:"text-blue-700 dark:text-blue-400"},queued:{dot:"bg-amber-400",labelKey:"recent.status.queued",text:"text-amber-700 dark:text-amber-400"},interrupted:{dot:"bg-orange-500",labelKey:"recent.status.paused",text:"text-orange-700 dark:text-orange-400"},failed:{dot:"bg-red-500",labelKey:"recent.status.failed",text:"text-red-700 dark:text-red-400"},cancelled:{dot:"bg-zinc-400",labelKey:"recent.status.cancelled",text:"text-zinc-500"},completed:{dot:"bg-[hsl(var(--deck-accent))]",labelKey:"recent.status.done",text:"text-[hsl(var(--deck-accent))]"}};function kl(e,t){if(!e)return"";const s=new Date(e);if(Number.isNaN(s.getTime()))return"";const n=Date.now()-s.getTime(),r=Math.floor(n/6e4);if(r<1)return t("recent.time.justNow");if(r<60)return t("recent.time.minutes",{n:r});const o=Math.floor(r/60);if(o<24)return t("recent.time.hours",{n:o});const l=Math.floor(o/24);return t("recent.time.days",{n:l})}function yl(e){return e.split("/").filter(Boolean).at(-1)||e}function vl({sessions:e,onSelect:t,cancellingTaskKeys:s,retryingTaskKeys:n,unreadTaskKeys:r,onCancel:o,onRetry:l,catalogLoadState:m="ready",className:k}){const v=$e(),c=[...e].sort(gl).slice(0,4),u=m==="loading"||m==="hydrating";return c.length===0?!u&&m!=="error"?null:a.jsxs("div",{role:m==="error"?"alert":"status",className:te("mt-7 flex items-center gap-2 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/50 px-3 py-2 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",k),children:[u?a.jsx(He,{className:"h-3 w-3 animate-spin text-[hsl(var(--deck-accent))]"}):a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500"}),v(u?"sidebar.catalog.syncing":"sidebar.catalog.incomplete")]}):a.jsxs("div",{className:te("mt-7",k),children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:v("taskHome.recent.title")}),a.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:v(u?"taskHome.recent.partial":m==="error"?"taskHome.recent.incomplete":"taskHome.recent.total",{count:e.length})})]}),a.jsx("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:c.map(i=>{const d=fl[i.taskStatus],p=i.pendingInteraction?i.pendingInteraction.type==="question"?"interaction.badge.question":i.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission":null,g=yl(i.taskSourceProjectPath||i.projectPath),f=ml(i,v),h=ce(ee(i)),C=i.taskStatus==="running"||i.taskStatus==="queued",S=s.includes(h),T=n.includes(h),j=!!i.taskRetryAvailable&&(i.taskStatus==="failed"||i.taskStatus==="interrupted"||i.taskStatus==="cancelled"),A=r.includes(h),w=za(i,v);return a.jsxs("div",{className:te("group flex items-center gap-3 rounded-md border border-transparent px-3 py-1.5 text-left transition-colors","hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[a.jsxs("button",{type:"button",onClick:()=>t(i),className:"flex min-w-0 flex-1 items-center gap-3 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[a.jsx("span",{className:te("h-1.5 w-1.5 shrink-0 rounded-full",p?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":d.dot)}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-[12.5px] text-[hsl(var(--deck-ink))]",children:[a.jsx("span",{className:"truncate",children:f}),A&&a.jsx("span",{title:v("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),i.taskRetriedFrom&&a.jsx("span",{title:`${v("session.retriedFrom")} ${i.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]",children:v("session.retryShort")})]}),a.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[a.jsx("span",{className:"truncate",children:g}),a.jsx("span",{className:"opacity-40",children:"·"}),a.jsx("span",{className:te("shrink-0",p?"text-amber-700 dark:text-amber-400":d.text),children:v(p??d.labelKey)}),a.jsx("span",{className:"opacity-40",children:"·"}),a.jsx("span",{className:"shrink-0",children:kl(i.lastMessageTime||i.firstMessageTime,v)})]}),w&&a.jsx("span",{title:w,className:"mt-0.5 block truncate font-mono text-[9.5px] text-red-600 dark:text-red-400",children:w})]}),a.jsx(vo,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100"})]}),C&&a.jsx("button",{type:"button","aria-label":v(S?"session.action.stopping":"session.action.stop",{title:f}),disabled:S,onClick:()=>o(i),className:"rounded p-1.5 text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:S?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Ca,{className:"h-3.5 w-3.5"})}),j&&a.jsx("button",{type:"button","aria-label":v(T?"session.action.retrying":"session.action.retry",{title:f}),disabled:T,onClick:()=>l(i),className:"rounded p-1.5 text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:T?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(an,{className:"h-3.5 w-3.5"})})]},h)})})]})}function bl({index:e,title:t,description:s,icon:n,hint:r,onClick:o}){const l=String(e+1).padStart(2,"0"),m=`⌘${e+1}`;return a.jsxs("button",{type:"button",onClick:o,className:te("group relative flex min-h-[100px] flex-col justify-between overflow-hidden rounded-lg border p-3.5 text-left transition","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]","hover:-translate-y-[1px] hover:border-[hsl(var(--deck-accent)/0.55)] hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.35)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))] focus-visible:ring-offset-2 focus-visible:ring-offset-[hsl(var(--deck-canvas))]","dark:bg-[hsl(var(--deck-surface))] dark:hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.55)]"),children:[a.jsx("span",{"aria-hidden":"true",className:te("pointer-events-none absolute right-3 top-3 h-2 w-2","border-r border-t border-[hsl(var(--deck-border-strong))]","transition-colors group-hover:border-[hsl(var(--deck-accent))]")}),a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("span",{className:te("inline-flex h-8 w-8 items-center justify-center rounded-md border transition-colors","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))]","group-hover:border-[hsl(var(--deck-accent)/0.5)] group-hover:bg-[hsl(var(--deck-accent-soft))]"),children:a.jsx(n,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))] transition-colors group-hover:text-[hsl(var(--deck-accent))]"})}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:l})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[13px] font-semibold text-[hsl(var(--deck-ink))]",children:t}),a.jsx("div",{className:"mt-1 line-clamp-2 text-[11.5px] leading-[1.45] text-[hsl(var(--deck-ink-muted))]",children:s}),a.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[a.jsx("span",{className:"truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100",children:r}),a.jsx("span",{className:"deck-kbd shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:m})]})]})]})}const Ks=[{key:"explore",titleKey:"taskHome.template.explore.title",descriptionKey:"taskHome.template.explore.description",icon:Mo,prompt:"Explore this codebase and explain ",hintKey:"taskHome.template.explore.hint"},{key:"build",titleKey:"taskHome.template.build.title",descriptionKey:"taskHome.template.build.description",icon:jo,prompt:"Build a production-ready ",hintKey:"taskHome.template.build.hint"},{key:"review",titleKey:"taskHome.template.review.title",descriptionKey:"taskHome.template.review.description",icon:No,prompt:"/review uncommitted",hintKey:"taskHome.template.review.hint"},{key:"fix",titleKey:"taskHome.template.fix.title",descriptionKey:"taskHome.template.fix.description",icon:Lo,prompt:"Investigate and fix ",hintKey:"taskHome.template.fix.hint"}];function wl(e,t){return t?t.split("/").filter(Boolean).at(-1)||t:e("taskHome.hero.projectFallback")}function xl(){const e=$e(),{taskWorkspaceInfo:t,historySurfaceSelection:s,isTaskWorkspaceLoading:n,taskWorkspaceError:r,isDispatchingTask:o,sessions:l,boundProjects:m,selectedProjectPath:k,error:v,selectProject:c,dispatchTask:u,startCodeReview:i,sendMessage:d,startTemporarySession:p,selectSession:g,cancelTask:f,cancellingTaskKeys:h,retryTask:C,retryingTaskKeys:S,unreadTaskKeys:T,taskEventConnectionState:j,catalogLoadState:A,reconnectTaskEvents:w,clearError:E,loadTaskWorkspaceInfo:F,loadBoundProjects:x}=L(),N=W(s),P=De(M=>M.openSettings),B=De(M=>M.isSettingsOpen),U=Te(M=>M.currentMode),_=Te(M=>M.currentModelId),Q=Te(M=>M.configuredModels),Z=Te(M=>M.isLoading),ne=Te(M=>M.hasLoaded),K=Te(M=>M.loadedWorkspacePath),$=Te(M=>M.error),R=Te(M=>M.loadModels),[le,ge]=b.useState("worktree"),[ve,xe]=b.useState(),[Re,Se]=b.useState(!1),Le=e(j==="connected"?"taskHome.eyebrow":j==="reconnecting"?"taskHome.feed.reconnecting":j==="offline"?"taskHome.feed.offline":"taskHome.feed.connecting"),de=b.useMemo(()=>m.find(M=>M.path===k)??m.find(M=>M.isCurrent),[m,k]),J=b.useMemo(()=>tc(l,k,(t==null?void 0:t.cwd)??null),[k,l,t==null?void 0:t.cwd]),Y=(de!=null&&de.available?de.path:void 0)??(t==null?void 0:t.cwd),ue=`task:${Y??"unavailable"}`;b.useEffect(()=>{!B&&Y&&(!ne||K!==Y)&&R(Y)},[B,R,K,ne,Y]);const he=!(de!=null&&de.available)&&n,I=de!=null&&de.available?null:r,q=!!(Y&&!he&&!I),ie=!!(_&&Q.some(M=>M.id===_)),Ce=!ne||Z,fe=q&&ie&&!Ce&&$===null,Ke=b.useMemo(()=>({project:wl(e,(de==null?void 0:de.path)??(t==null?void 0:t.cwd)),branch:(de==null?void 0:de.gitBranch)??(t==null?void 0:t.gitBranch)??e("taskHome.context.branchFallback")}),[de,t,e]),we=b.useCallback(async M=>{if(qe(L.getState()))return;const Ee=M.content.trim();if(Ee==="/review"||Ee.startsWith("/review ")){if(M.attachments.length>0)throw new Error(e("taskHome.review.attachmentsUnsupported"));if(M.outputSchema)throw new Error(e("taskHome.review.outputSchemaUnsupported"));const be=Ee.split(/\s+/),Ne=be[1]||"uncommitted";if(Ne!=="uncommitted"&&Ne!=="base"&&Ne!=="commit"||Ne==="uncommitted"&&be.length!==2&&be.length!==1||(Ne==="base"||Ne==="commit")&&be.length!==3)throw new Error(e("taskHome.review.usage"));await i({projectPath:Y,kind:Ne,...be[2]?{ref:be[2]}:{},modelId:M.modelId??_??void 0});return}if(M.content.trimStart().startsWith("!")){p(Y),await d({content:M.content,attachments:[]});return}await u({prompt:M.content,projectPath:Y,isolation:le,permissionMode:U,modelId:M.modelId??_??void 0,reasoningEffort:M.reasoningEffort,serviceTier:M.serviceTier,responseVerbosity:M.responseVerbosity,communicationStyle:M.communicationStyle,...M.outputSchema?{outputSchema:M.outputSchema}:{},attachments:M.attachments.map(be=>({type:"image",content:be.dataUrl,mimeType:be.mimeType,name:be.name}))})},[U,_,u,le,d,i,p,Y,e]);return b.useEffect(()=>{const M=Ee=>{if(!(Ee.metaKey||Ee.ctrlKey))return;const be=Number.parseInt(Ee.key,10);if(Number.isNaN(be)||be<1||be>Ks.length)return;const Ne=Ks[be-1];Ne&&(Ee.preventDefault(),xe({key:ue,content:Ne.prompt}))};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[ue]),a.jsx("main",{className:"deck-canvas relative flex-1 overflow-y-auto text-[hsl(var(--deck-ink))]",children:a.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-[960px] flex-col px-6 py-8 md:px-8 md:py-10",children:[a.jsxs("div",{className:"flex gap-4 items-start mb-6",children:[a.jsx(ul,{size:36,className:"hidden mt-1 sm:inline-flex"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:te("deck-eyebrow flex items-center gap-2",j==="offline"?"text-amber-700 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[j==="offline"?a.jsx(qn,{className:"w-3 h-3"}):a.jsx("span",{className:"deck-pulse-dot"}),Le]}),a.jsxs("h1",{className:"mt-2.5 max-w-3xl text-balance text-[clamp(28px,3vw,34px)] font-medium leading-[1.12] tracking-[-0.028em] text-[hsl(var(--deck-ink))]",children:[e("taskHome.hero.prefix")," ",a.jsx("span",{className:"whitespace-nowrap font-mono text-[0.82em] text-[hsl(var(--deck-accent))]",children:Ke.project}),a.jsx("span",{className:"text-[hsl(var(--deck-ink-muted))]",children:"?"})]}),a.jsx("p",{className:"mt-2 max-w-[46rem] text-[13px] leading-[1.55] text-[hsl(var(--deck-ink-muted))]",children:e("taskHome.hero.subtitle")})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.templates.title")}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[a.jsx(xa,{className:"w-3 h-3"}),a.jsx("span",{children:e("taskHome.templates.hint")})]})]}),a.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:Ks.map((M,Ee)=>a.jsx(bl,{index:Ee,title:e(M.titleKey),description:e(M.descriptionKey),icon:M.icon,hint:e(M.hintKey),onClick:()=>xe({key:ue,content:M.prompt})},M.key))})]}),a.jsxs("div",{"data-blade-task-dispatch-ready":fe?"true":"false","data-blade-task-workspace-ready":q?"true":"false","data-blade-task-model-ready":ie?"true":"false","data-blade-task-model-loaded":ne?"true":"false","data-blade-task-model-loading":Z?"true":"false",className:"rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_28px_80px_-32px_hsl(var(--deck-accent)/0.28),0_2px_0_hsl(var(--deck-hairline))]",children:[a.jsxs("div",{className:"flex items-center gap-0 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/50",children:[a.jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[a.jsxs(at,{children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button","aria-label":e("taskHome.context.projectSelect"),disabled:m.length===0,className:"group flex h-9 min-w-0 items-center gap-2 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11.5px] text-[hsl(var(--deck-ink))] transition-colors hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-50",children:[a.jsx(Yt,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),a.jsx("span",{className:"font-medium truncate",children:(de==null?void 0:de.name)??Ke.project}),a.jsx(ft,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))] transition-transform group-data-[state=open]:rotate-180"})]})}),a.jsx(Xe,{align:"start",sideOffset:4,className:"w-56 rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-1 shadow-xl",children:a.jsxs("div",{className:"flex flex-col",children:[m.map(M=>a.jsxs("button",{type:"button",disabled:!M.available,onClick:()=>{c(M.path)},className:te("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-left font-mono text-[12px] transition-colors",M.path===k?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))]",!M.available&&"opacity-40"),children:[a.jsx(Yt,{className:"w-3 h-3 shrink-0"}),a.jsx("span",{className:"flex-1 min-w-0 truncate",children:M.name}),M.path===k&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))]"})]},M.path)),m.length===0&&a.jsx("span",{className:"px-2.5 py-2 text-center font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.workspace.empty")})]})})]}),a.jsxs("button",{type:"button","data-blade-task-isolation":le,"aria-pressed":le==="worktree",onClick:()=>ge(M=>M==="worktree"?"local":"worktree"),className:te("flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] transition-colors",le==="worktree"?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),title:e("taskHome.context.isolationToggleTitle"),children:[le==="worktree"?a.jsx(Eo,{className:"w-3 h-3"}):a.jsx(Po,{className:"w-3 h-3"}),a.jsx("span",{className:"hidden sm:inline",children:e(le==="worktree"?"taskHome.context.isolation.worktree":"taskHome.context.isolation.local")})]}),a.jsxs("span",{className:"flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[a.jsx(nn,{className:"w-3 h-3"}),a.jsx("span",{className:"hidden sm:inline",children:Ke.branch})]})]}),a.jsxs("div",{className:"flex gap-2 items-center px-3 shrink-0",children:[(t==null?void 0:t.taskAdmission)&&a.jsx(Ba,{inFlight:t.taskAdmission.inFlight,queued:t.taskAdmission.queued,maxConcurrent:t.taskAdmission.maxConcurrent,compact:!0}),o&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-accent))]",children:[a.jsx(He,{className:"w-3 h-3 animate-spin"}),a.jsx("span",{className:"hidden sm:inline",children:e("taskHome.context.preparing")})]})]})]}),!fe&&a.jsxs("section",{"aria-label":e("taskHome.setup.aria"),className:"border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-3",children:[a.jsxs("div",{className:"mb-2.5",children:[a.jsx("h2",{className:"font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.title")}),a.jsx("p",{className:"mt-0.5 text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.description")})]}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[a.jsx("span",{className:te("flex justify-center items-center w-7 h-7 rounded-md border shrink-0",q?"text-emerald-700 bg-emerald-50 border-emerald-300/70 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":I?"text-red-700 bg-red-50 border-red-300/70 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"text-amber-700 bg-amber-50 border-amber-300/70 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:he?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):q?a.jsx(Hn,{className:"h-3.5 w-3.5"}):I?a.jsx(ss,{className:"h-3.5 w-3.5"}):a.jsx(Yt,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.workspace.title")}),a.jsx("span",{className:"mt-0.5 block truncate text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:he?e("taskHome.setup.workspace.loading"):I||(q?e("taskHome.setup.workspace.ready",{project:Ke.project}):e("taskHome.setup.workspace.required"))})]}),!q&&a.jsxs("div",{className:"flex gap-1 items-center shrink-0",children:[I&&a.jsx("button",{type:"button",onClick:()=>{Promise.all([F(),x()])},"aria-label":e("taskHome.setup.workspace.retry"),title:e("taskHome.setup.workspace.retry"),className:"flex h-8 w-8 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-canvas))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:a.jsx(Rs,{className:"h-3.5 w-3.5"})}),a.jsxs("button",{type:"button","data-project-setup-trigger":!0,onClick:()=>Se(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[a.jsx(Vs,{className:"w-3 h-3"}),e("taskHome.setup.workspace.action")]})]})]}),a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[a.jsx("span",{className:te("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",ie&&!$?"border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":$?"border-red-300/70 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"border-amber-300/70 bg-amber-50 text-amber-700 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:Ce?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):ie&&!$?a.jsx(Hn,{className:"h-3.5 w-3.5"}):$?a.jsx(ss,{className:"h-3.5 w-3.5"}):a.jsx(On,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.model.title")}),a.jsx("span",{title:$??void 0,className:te("mt-0.5 block truncate text-[10.5px]",$?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:Ce?e("taskHome.setup.model.loading"):$||e(ie?"taskHome.setup.model.ready":"taskHome.setup.model.required")})]}),!Ce&&(!ie||$)&&a.jsxs("button",{type:"button","data-model-setup-trigger":!0,onClick:()=>{$?R(Y):P("models")},className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[$?a.jsx(Rs,{className:"w-3 h-3"}):a.jsx(On,{className:"w-3 h-3"}),e($?"taskHome.setup.model.retry":"taskHome.setup.model.action")]})]})]})]}),a.jsx("div",{className:"px-3 pt-3 pb-3",children:a.jsx(dl,{variant:"task",draft:(ve==null?void 0:ve.key)===ue?ve.content:void 0,draftKey:ue,placeholder:e("taskHome.composer.placeholder"),onSend:async M=>{try{return await we(M),xe(void 0),!0}catch{return!1}},disabled:N||o,submitDisabled:!fe,shellSubmitDisabled:!fe,workspacePath:Y},ue)})]}),j==="offline"&&a.jsxs("div",{role:"alert",className:"flex flex-wrap gap-3 items-center px-3 py-2 mt-4 text-amber-900 rounded-md border border-amber-300/70 bg-amber-50/80 dark:border-amber-800/70 dark:bg-amber-950/35 dark:text-amber-200",children:[a.jsx(qn,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 text-[12px]",children:e("taskHome.feed.offlineDescription")}),a.jsxs("button",{type:"button",onClick:()=>void w().catch(()=>{}),className:"inline-flex min-h-8 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-mono 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/50 dark:hover:bg-amber-900/50",children:[a.jsx(Rs,{className:"w-3 h-3"}),e("taskHome.feed.retry")]})]}),v&&a.jsxs("div",{role:"alert","data-blade-task-error":!0,className:"flex justify-between items-center px-3 py-2 mt-4 font-mono text-xs text-red-700 rounded-md border border-red-200 bg-red-50/80 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[a.jsx("span",{children:v}),a.jsx("button",{type:"button",onClick:E,className:"underline",children:e("taskHome.error.dismiss")})]}),a.jsx(vl,{sessions:J,catalogLoadState:A,cancellingTaskKeys:h,retryingTaskKeys:S,unreadTaskKeys:T,onSelect:M=>{g(ee(M))},onCancel:M=>{qe(L.getState())||f(ee(M)).catch(()=>{})},onRetry:M=>{qe(L.getState())||C(ee(M)).catch(()=>{})}}),a.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[a.jsx(Oo,{className:"w-3 h-3"}),a.jsx("span",{className:"font-mono uppercase tracking-[0.14em]",children:e("taskHome.footer.note")})]}),a.jsx(hl,{open:Re,onOpenChange:Se})]})})}const tn="blade.sessions.last",et="session",ds="project",Nt="workspace",yt="view",ks="workspaceKind",ys="workspaceRef",Ya="history",us="bladeSessionSurfaceLocator",Xa=[yt,et,ks,ys],Sl=[ds,Nt,"cwd","displayCwd"];function un(e){try{return mo.parse(e)}catch{return null}}function Cl(e){return!e||typeof e!="object"||Array.isArray(e)?null:un(e[us])}function jl(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.hasOwn(e,us)}function Tl(e){const t=e.get(et),s=e.get(ks),n=e.get(ys);return!t||s!=="acp-remote"||!n?null:un({version:2,sessionId:t,workspace:{kind:"acp-remote",workspaceRef:n}})}function ua(e,t){const s=new URLSearchParams(e),n=s.get(yt)===Ya,r=s.has(ks)||s.has(ys),o=Cl(t),l=jl(t);if(!n)return{locator:null,shouldCleanup:r||l};const m=new Set;for(const[v]of s){if(!Xa.includes(v)||m.has(v))return{locator:null,shouldCleanup:!0};m.add(v)}const k=Tl(s);return k?l&&!o?{locator:null,shouldCleanup:!0}:o&&!Zt(o,k)?{locator:null,shouldCleanup:!0}:{locator:k,shouldCleanup:!1}:{locator:null,shouldCleanup:!0}}function Gt(e,t={}){const s=t.href??(typeof window>"u"?"http://localhost/":window.location.href),n=new URL(s),r=e?un(e):null,o=(r==null?void 0:r.workspace.kind)==="acp-remote"?r:null;if(o)n.search="";else for(const u of[...Xa,...Sl])n.searchParams.delete(u);const l=t.historyState&&typeof t.historyState=="object"&&!Array.isArray(t.historyState)?{...t.historyState}:{};delete l[us];const m=o?{...l,[us]:o}:Object.keys(l).length>0?l:null;(o==null?void 0:o.workspace.kind)==="acp-remote"&&(n.searchParams.set(yt,Ya),n.searchParams.set(et,o.sessionId),n.searchParams.set(ks,o.workspace.kind),n.searchParams.set(ys,o.workspace.workspaceRef));const k=`${n.pathname}${n.search}${n.hash}`,v=t.replaceState??(typeof window>"u"?void 0:(u,i)=>window.history.replaceState(u,"",i)),c=t.pushState??(typeof window>"u"?void 0:(u,i)=>window.history.pushState(u,"",i));return m&&t.push?c==null||c(m,k):v==null||v(m,k),k}function Pl(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.sessionId=="string"&&t.sessionId.trim()&&typeof t.projectPath=="string"&&t.projectPath.trim()?{sessionId:t.sessionId,projectPath:t.projectPath}:null}function Al(e){var l,m,k;const t=new URLSearchParams(e),s=((l=t.get(et))==null?void 0:l.trim())||null,n=((m=t.get(ds))==null?void 0:m.trim())||null,r=((k=t.get(Nt))==null?void 0:k.trim())||null,o=t.get(yt)==="board"?"board":"workspace";return{sessionRef:s&&(r||n)?{sessionId:s,projectPath:r||n}:null,projectPath:n,hasSessionParam:t.has(et),view:o}}function Rl(e=typeof localStorage>"u"?null:localStorage){if(!e)return null;try{const t=e.getItem(tn);return t?Pl(JSON.parse(t)):null}catch{return null}}function El(e,t,s={}){const n=s.href??(typeof window>"u"?"http://localhost/":window.location.href),r=new URL(n),o=s.view??"workspace",l=s.displayProjectPath??(o==="board"?t:e==null?void 0:e.projectPath)??t,m=(e==null?void 0:e.projectPath)??null;e&&o==="workspace"?r.searchParams.set(et,e.sessionId):r.searchParams.delete(et),l?r.searchParams.set(ds,l):r.searchParams.delete(ds),m&&l&&m!==l?r.searchParams.set(Nt,m):r.searchParams.delete(Nt),o==="board"?(r.searchParams.set(yt,"board"),r.searchParams.delete(et),r.searchParams.delete(Nt)):r.searchParams.delete(yt);const k=s.storage===void 0?typeof localStorage>"u"?null:localStorage:s.storage;try{e&&o==="workspace"?k==null||k.setItem(tn,JSON.stringify(e)):o==="workspace"&&(k==null||k.removeItem(tn))}catch{}const v=`${r.pathname}${r.search}${r.hash}`,c=s.replaceState??(typeof window>"u"?void 0:u=>window.history.replaceState(null,"",u));return c==null||c(v),v}const Nl=b.lazy(()=>Be(()=>import("./ChatView-BG50NCML.js"),__vite__mapDeps([27,2,1,6,8,3,28,21,20,29,10,11,18,12,0])).then(e=>({default:e.ChatView}))),Ml=b.lazy(()=>Be(()=>import("./KanbanBoard-q43tsrHI.js"),__vite__mapDeps([30,2,1,9,11,26,18,10,29,5,3])).then(e=>({default:e.KanbanBoard}))),Il=b.lazy(()=>Be(()=>import("./SessionHistorySurface-Cm_p5HNt.js"),__vite__mapDeps([31,2,28,3,1])).then(e=>({default:e.SessionHistorySurface})));function Fl(){const e=$e(),[t,s]=b.useState(!1),n=L(x=>x.subscribeToTaskEvents),r=L(x=>x.unsubscribeFromTaskEvents),o=L(x=>x.currentSessionRef),l=L(x=>x.historySurfaceSelection),m=L(x=>x.isTemporarySession),k=L(x=>x.loadTaskWorkspaceInfo),v=L(x=>x.loadBoundProjects),c=L(x=>x.loadSessions),u=L(x=>x.loadSurfaceCatalog),i=L(x=>x.openHistorySurface),d=L(x=>x.closeHistorySurface),p=L(x=>x.selectSession),g=L(x=>x.selectProject),f=L(x=>x.startTemporarySession),h=L(x=>x.setError),C=L(x=>x.sessions),S=L(x=>x.selectedProjectPath),T=Te(x=>x.loadModels),j=ut(x=>x.loadSettings),A=De(x=>x.mainView),w=De(x=>x.setMainView),E=De(x=>x.boardProjectPath),F=De(x=>x.setBoardProjectPath);return b.useEffect(()=>(n().catch(x=>{console.error("Failed to subscribe to task events",x)}),r),[n,r]),b.useEffect(()=>d,[d]),b.useEffect(()=>{let x=!1;return(async()=>{var $;c(),u(),j(),T();const P=ua(window.location.search,window.history.state);if(P.shouldCleanup&&Gt(null,{href:window.location.href,historyState:window.history.state}),P.locator){if(await i(P.locator),x)return;L.getState().historySurfaceSelection||(Gt(null,{href:window.location.href,historyState:window.history.state}),L.getState().currentSessionRef||f()),w("workspace"),F(null),s(!0);return}const B=Al(window.location.search);w(B.view),F(B.view==="board"?B.projectPath:null);const U=Rl(),_=B.view==="board"?null:B.hasSessionParam?B.sessionRef:B.projectPath?null:U,Q=Promise.all([k(),v()]),Z=!_&&!B.projectPath;if(Z&&(f(),s(!0)),await Q,x)return;const ne=L.getState(),K=B.projectPath?($=ne.boundProjects.find(R=>R.path===B.projectPath&&R.available))==null?void 0:$.path:null;if(K&&g(K),!(_&&(await p(_),x))){if(!_||!V(L.getState().currentSessionRef,_)){const R=_?L.getState().error:null;f(),R&&h(R)}Z||s(!0)}})(),()=>{x=!0}},[v,T,c,u,j,k,i,g,p,h,F,w,f]),b.useEffect(()=>{if(!t)return;if(l){Gt(l.locator,{href:window.location.href,historyState:window.history.state});return}const x=ua(window.location.search,window.history.state);(x.locator||x.shouldCleanup)&&Gt(null,{href:window.location.href,historyState:window.history.state});const N=o?as(C,o):void 0;El(A==="workspace"?o:null,A==="board"?E:S,{displayProjectPath:A==="board"?E:N?fs(N,S):S,view:A})},[E,o,l,t,A,S,C]),a.jsxs(a.Fragment,{children:[a.jsx($c,{}),a.jsx(Bc,{children:t?l?a.jsx(b.Suspense,{fallback:a.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:a.jsx(Il,{})}):A==="board"?a.jsx(b.Suspense,{fallback:a.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:a.jsx(Ml,{})}):!o||m?a.jsx(xl,{}):a.jsx(b.Suspense,{fallback:a.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:a.jsx(Nl,{})}):a.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")})})]})}Er.createRoot(document.getElementById("root")).render(a.jsx(Nr.StrictMode,{children:a.jsx(Fl,{})}));export{Ja as $,ss as A,bo as B,wo as C,on as D,ml as E,Ln as F,nn as G,Po as H,za as I,vo as J,zl as K,He as L,Yt as M,lt as N,Te as O,Eo as P,Ba as Q,an as R,Io as S,Ho as T,Mo as U,Vs as V,qn as W,Xt as X,hl as Y,Pe as Z,Be as _,L as a,at as a0,rt as a1,Xe as a2,bc as a3,Fo as a4,$a as a5,Fc as a6,gl as a7,pe as a8,fs as a9,Gn as aa,$l as ab,So as ac,Oo as ad,Vl as ae,On as af,No as ag,Kl as ah,Co as ai,Qn as aj,Bl as ak,ql as al,la as am,Zt as an,Ha as ao,ee as b,X as c,ce as d,hs as e,cn as f,ms as g,gs as h,Ia as i,te as j,Sa as k,D as l,ul as m,ft as n,Dn as o,Rs as p,Un as q,_l as r,V as s,Hn as t,$e as u,as as v,Ca as w,ut as x,dl as y,ia as z};
203
+ `);if((O||se)&&ht.historyIndex!==-1){const je=ht.getNext();je!==null&&(y.preventDefault(),w.current=je,T(je),Oe(p,{content:je,attachments:E.current}),requestAnimationFrame(()=>{we.current&&we.current.setSelectionRange(je.length,je.length)}))}}},[wt,Ut,Me,Ie,Ss,Cs,xs,p,S,ht]),wr=b.useCallback(y=>{const H=y.target.value;w.current=H,T(H),Z(y.target.selectionStart),Oe(p,{content:H,attachments:E.current})},[p]),Sn=b.useCallback(y=>{const H=y.target;Z(H.selectionStart)},[]);b.useEffect(()=>{we.current&&(we.current.style.height="inherit",we.current.style.height=`${Math.min(we.current.scrollHeight,200)}px`)},[S]);const js=Bs.find(y=>y.value===Mt)??Bs[1],xr=h(js.labelKey),Sr=js.icon,Cr=!!S.trim()||j.length>0,Cn=j.length>=Rt,jr=en(j),Ts=ue||(Dt?bt:null),jn=Ts?null:I,Qe=!!s||vs,Ps=Qe||J,Tr=Ps||Cn||!Ve,xt=Ve?Cn?h("chat.input.attachment.countLimit",{count:Rt}):h("chat.input.attachment.add"):bt,Pr=()=>{Ps||(q(xt),!Ve&&!o&&be.some(y=>{var H;return(H=y.input)==null?void 0:H.includes("image")})&&K(!0))};return a.jsxs("div",{"data-chat-input-shell":!0,className:c==="task"?"bg-transparent":"py-2.5 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]",children:[a.jsxs("div",{"data-chat-input-inner":!0,className:c==="task"?"w-full":"px-4 w-full md:px-6",children:[a.jsxs("div",{className:`relative border rounded-lg bg-[hsl(var(--deck-surface))] transition-all duration-200 flex flex-col ${c==="task"?`min-h-[148px] shadow-[0_18px_60px_-24px_hsl(var(--deck-accent)/0.4)] focus-within:ring-1 ${ie?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-accent)/0.6)] focus-within:ring-[hsl(var(--deck-accent)/0.25)]"}`:`min-h-[56px] shadow-sm focus-within:ring-1 ${ie?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-border-strong))] focus-within:ring-[hsl(var(--deck-border-strong))]"}`}`,children:[a.jsx(ca,{type:"command",suggestions:Me.suggestions,selectedIndex:Me.selectedIndex,loading:Me.loading,onSelect:Ss,onHover:Me.setSelectedIndex,visible:wt}),a.jsx(ca,{type:"file",suggestions:Ie.suggestions,selectedIndex:Ie.selectedIndex,loading:Ie.loading,onSelect:Cs,onHover:Ie.setSelectedIndex,visible:Ut&&!wt}),a.jsx(Xs,{ref:we,"data-blade-composer":!0,value:S,onChange:wr,onKeyDown:br,onPaste:vr,onSelect:Sn,onClick:Sn,placeholder:g??h(o?"chat.input.placeholder.steering":"chat.input.placeholder.default"),className:`flex-1 w-full resize-none border-0 bg-transparent px-4 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none text-[#111827] dark:text-zinc-300 placeholder:text-[#9CA3AF] dark:placeholder:text-zinc-600 ${c==="task"?"min-h-[84px] py-4 text-[15px]":"py-2.5 text-[14px]"}`,disabled:Qe||J,"aria-busy":J}),ie&&a.jsx("div",{className:"px-4 pb-2 font-mono text-[11px] text-amber-600 dark:text-amber-400",children:"$ user shell · runs in this Session workspace"}),o&&a.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-amber-600 dark:text-amber-400",children:m>0&&k==="next_turn"?h("chat.input.followUp.queued",{count:m}):m>0?h("chat.input.steering.queued",{count:m}):a.jsxs(a.Fragment,{children:[h("chat.input.steering.status"),h("chat.input.steering.enterHint")]})}),v>0&&a.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-cyan-600 dark:text-cyan-400",children:v===1?h("chat.input.steering.recoveredOne",{count:v}):h("chat.input.steering.recoveredMany",{count:v})}),Ts&&a.jsxs("div",{role:"alert",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[a.jsx(ss,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"flex-1 min-w-0",children:Ts}),ue&&a.jsx("button",{type:"button","aria-label":h("chat.error.dismiss"),onClick:()=>{he(null),fe.current=null},className:"flex justify-center items-center w-6 h-6 text-red-500 rounded shrink-0 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 dark:hover:bg-red-950",children:a.jsx(Xt,{className:"w-3 h-3"})})]}),jn&&a.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2.5 py-1.5 text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[a.jsx(Ao,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),a.jsx("span",{className:"flex-1 min-w-0",children:jn}),a.jsx("button",{type:"button","aria-label":h("chat.notice.dismiss"),onClick:()=>q(null),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))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:a.jsx(Xt,{className:"w-3 h-3"})})]}),j.length>0&&a.jsxs("div",{className:"px-4 pb-2",children:[a.jsx("div",{className:"mb-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:h("chat.input.attachment.usage",{count:j.length,limit:Rt,used:$s(jr),budget:$s(Jt)})}),a.jsx("div",{className:"flex flex-wrap gap-2",children:j.map(y=>a.jsxs("div",{title:y.name,className:"relative overflow-hidden rounded-md border border-[#E5E7EB] bg-[#F9FAFB] dark:border-zinc-800 dark:bg-zinc-900",children:[a.jsx("img",{src:y.dataUrl,alt:y.name,className:"object-cover w-20 h-20"}),a.jsx("button",{type:"button","aria-label":`${h("chat.input.attachment.remove")} ${y.name}`,title:`${h("chat.input.attachment.remove")} ${y.name}`,onClick:()=>kr(y.id),className:"flex absolute top-1 right-1 justify-center items-center w-6 h-6 text-white rounded transition-colors bg-black/75 hover:bg-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:a.jsx(Xt,{className:"w-3 h-3"})})]},y.id))})]}),a.jsxs("div",{className:"flex justify-between items-center px-3 py-2 mt-auto",children:[a.jsxs("div",{className:"flex gap-2 items-center",children:[Tr?a.jsx("button",{type:"button",disabled:Ps,"aria-disabled":"true","aria-label":xt,title:xt,onClick:Pr,className:"flex h-8 w-8 cursor-help items-center justify-center rounded-md text-[#9CA3AF] opacity-55 transition-colors hover:bg-[hsl(var(--deck-surface-2))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed dark:text-zinc-500",children:a.jsx(Un,{className:"w-4 h-4"})}):a.jsxs("label",{title:xt,className:"relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[#9CA3AF] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-within:ring-1 focus-within:ring-[hsl(var(--deck-accent))] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300",children:[a.jsx("input",{ref:M,type:"file",accept:"image/*",multiple:!0,"aria-label":xt,className:"absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer",onChange:yr}),a.jsx(Un,{className:"w-4 h-4"})]}),a.jsxs(at,{open:ne,onOpenChange:y=>{!o&&!J&&K(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,title:h(o?"chat.input.model.locked":"chat.input.model.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 text-xs text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[wn,a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsx(Xe,{className:"w-64 p-2 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:a.jsx("div",{className:"overflow-y-auto max-h-72",children:be.length===0?a.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-2",children:h("chat.input.model.empty")}):Object.entries(be.reduce((y,H)=>{const O=H.provider||"unknown";return y[O]||(y[O]=[]),y[O].push(H),y},{})).map(([y,H])=>a.jsxs("div",{className:"mb-2",children:[a.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-1 capitalize",children:y.replace(/-/g," ")}),H.map(O=>{var se;return a.jsx("button",{className:`w-full text-left px-2 py-1.5 text-sm rounded hover:bg-[#E5E7EB] dark:hover:bg-zinc-800 transition-colors ${O.id===pt?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,onClick:()=>{if(q(null),ae){yn(O.id),K(!1);return}Za(O.id,f??void 0).then(()=>K(!1)).catch(()=>{})},children:a.jsxs("span",{className:"flex gap-2 items-center min-w-0",children:[a.jsx("span",{className:"flex-1 min-w-0 truncate",children:O.displayName||O.model}),((se=O.input)==null?void 0:se.includes("image"))&&a.jsx("span",{className:"shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.08em] text-[hsl(var(--deck-accent))]",children:h("chat.input.model.vision")})]})},O.id)})]},y))})})]}),pr&&a.jsxs(at,{open:$,onOpenChange:y=>{!o&&!J&&R(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,"aria-label":h("chat.input.effort.change"),title:h(o?"chat.input.effort.locked":"chat.input.effort.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[h("chat.input.effort.label",{effort:Ot}),a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsxs(Xe,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[a.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.effort.heading")}),a.jsx("div",{className:"flex flex-col gap-0.5",children:It.map(y=>a.jsx("button",{type:"button","aria-label":h("chat.input.effort.option",{effort:y}),onClick:()=>{vn(y),R(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Ot===y?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:a.jsx("span",{className:"capitalize",children:y})},y))})]})]}),hr&&a.jsxs(at,{open:le,onOpenChange:y=>{!o&&!J&&ge(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,"aria-label":h("chat.input.serviceTier.change"),title:h(o?"chat.input.serviceTier.locked":"chat.input.serviceTier.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[h("chat.input.serviceTier.label",{tier:tt}),a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsxs(Xe,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[a.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.serviceTier.heading")}),a.jsx("div",{className:"flex flex-col gap-0.5",children:dr.map(y=>a.jsxs("button",{type:"button","aria-label":h("chat.input.serviceTier.option",{tier:y}),onClick:()=>{bs(y),ge(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${tt===y?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[a.jsx("span",{className:"capitalize",children:y}),y==="fast"&&a.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.serviceTier.fastHint")}),y==="flex"&&a.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.serviceTier.flexHint")})]},y))})]})]}),mr&&a.jsxs(at,{open:ve,onOpenChange:y=>{!o&&!J&&xe(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,"aria-label":h("chat.input.responseVerbosity.change"),title:h(o?"chat.input.responseVerbosity.locked":"chat.input.responseVerbosity.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[h("chat.input.responseVerbosity.label",{verbosity:st}),a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsxs(Xe,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[a.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.responseVerbosity.heading")}),a.jsx("div",{className:"flex flex-col gap-0.5",children:ur.map(y=>a.jsxs("button",{type:"button","aria-label":h("chat.input.responseVerbosity.option",{verbosity:y}),onClick:()=>{ws(y),xe(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${st===y?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[a.jsx("span",{className:"capitalize",children:y}),y==="auto"&&a.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:h("chat.input.responseVerbosity.autoHint")})]},y))})]})]}),a.jsxs(at,{open:P,onOpenChange:y=>{!o&&!J&&B(y)},children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:Qe||o||J,"aria-label":h("chat.input.outputSchema.change"),title:h(o?"chat.input.outputSchema.locked":"chat.input.outputSchema.change"),className:`flex h-7 items-center gap-1 rounded px-1.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 ${F.trim()?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[a.jsx(bo,{className:"h-3.5 w-3.5"}),F.trim()&&"JSON"]})}),a.jsxs(Xe,{className:"w-[min(440px,calc(100vw-24px))] border border-[#E5E7EB] bg-white p-0 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[a.jsxs("div",{className:"border-b border-[#E5E7EB] px-3 py-2.5 dark:border-zinc-800",children:[a.jsx("div",{className:"font-mono text-[11px] font-semibold text-[#111827] dark:text-zinc-100",children:h("chat.input.outputSchema.title")}),a.jsx("div",{className:"mt-0.5 text-[10.5px] leading-4 text-[#6B7280] dark:text-zinc-500",children:h("chat.input.outputSchema.description")})]}),a.jsxs("div",{className:"p-3",children:[a.jsx(Xs,{value:F,onChange:y=>{const H=y.target.value;N.current=H,x(H),_(null),Oe(p,{content:w.current,attachments:E.current,outputSchema:H})},spellCheck:!1,"aria-label":h("chat.input.outputSchema.editor"),"aria-invalid":!!U,placeholder:h("chat.input.outputSchema.placeholder"),className:"min-h-[180px] resize-y border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] font-mono text-[11px] leading-5 focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]"}),U&&a.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-[10.5px] text-red-600 dark:text-red-400",children:[a.jsx(ss,{className:"h-3.5 w-3.5"}),U]}),a.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{const y=JSON.stringify({type:"object",properties:{summary:{type:"string"}},required:["summary"],additionalProperties:!1},null,2);N.current=y,x(y),_(null),Oe(p,{content:w.current,attachments:E.current,outputSchema:y})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))]",children:h("chat.input.outputSchema.example")}),a.jsx("button",{type:"button",onClick:()=>{N.current="",x(""),_(null),Oe(p,{content:w.current,attachments:E.current,outputSchema:""})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[#6B7280] hover:bg-[#F3F4F6] dark:text-zinc-400 dark:hover:bg-zinc-800",children:h("chat.input.outputSchema.clear")})]})]})]})]}),a.jsxs(at,{open:Re,onOpenChange:Se,children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{"data-blade-permission-mode":Mt,className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs transition-colors ${js.tone==="danger"?"text-amber-600 hover:bg-amber-500/10 dark:text-amber-400":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[a.jsx(Sr,{className:"h-3.5 w-3.5"}),xr,a.jsx(ft,{className:"w-3 h-3"})]})}),a.jsxs(Xe,{className:"w-72 p-1.5 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:[a.jsx("div",{className:"px-2 pb-1.5 pt-1 text-[11px] font-medium text-[#9CA3AF] dark:text-zinc-500",children:h("chat.input.mode.aria")}),a.jsx("div",{className:"flex flex-col gap-0.5",children:Bs.map(y=>{const H=y.icon,O=Mt===y.value,se=y.tone==="danger";return a.jsxs("button",{type:"button","data-blade-permission-option":y.value,"aria-pressed":O,className:`flex w-full items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${O?"bg-[#F3F4F6] dark:bg-zinc-800/70":"hover:bg-[#F3F4F6] dark:hover:bg-zinc-800/50"}`,onClick:()=>{y.value===Ze.YOLO&&Mt!==Ze.YOLO?(Se(!1),de(!0)):(mn(y.value),Se(!1))},children:[a.jsx(H,{className:`mt-0.5 h-4 w-4 shrink-0 ${se?"text-amber-500":O?"text-[#111827] dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`}),a.jsxs("span",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:`block text-[13px] font-medium leading-tight ${se?"text-amber-600 dark:text-amber-400":"text-[#111827] dark:text-zinc-100"}`,children:h(y.labelKey)}),a.jsx("span",{className:"mt-0.5 block text-[11px] leading-snug text-[#6B7280] dark:text-zinc-500",children:h(y.descriptionKey)})]}),O&&a.jsx(wo,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"})]},y.value)})})]})]})]}),a.jsxs("div",{className:"flex gap-2 items-center",children:[o&&a.jsx(lt,{size:"icon",onClick:fr,disabled:vs||l,title:h(l?"chat.input.action.stopping":"chat.input.action.stop"),"aria-label":h(l?"chat.input.action.stopping":"chat.input.action.stop"),className:"w-8 h-8 text-white bg-red-500 hover:bg-red-600",children:l?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Ca,{className:"w-3 h-3"})}),a.jsx(lt,{size:"icon","data-blade-submit":!0,onClick:xs,disabled:!Cr||Qe||Ce||Dt||J||gr,title:h(J?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),"aria-label":h(J?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),className:"h-8 w-8 bg-[#111827] text-white hover:bg-[#0F172A] disabled:bg-[#E5E7EB] disabled:text-[#9CA3AF] dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white dark:disabled:bg-zinc-800 dark:disabled:text-zinc-600",children:J?a.jsx(He,{className:"w-4 h-4 animate-spin"}):a.jsx(Io,{className:"w-4 h-4"})})]})]})]}),c==="chat"&&a.jsx("div",{className:"text-center text-xs text-[#6B7280] dark:text-zinc-600 mt-3 font-mono",children:h("chat.footer.disclaimer")})]}),a.jsx(on,{open:Le,onOpenChange:de,children:a.jsx(hs,{className:"gap-0 rounded-xl border border-zinc-200 bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b] sm:max-w-[400px]","aria-describedby":"yolo-confirm-desc",hideCloseButton:!0,children:a.jsxs("div",{className:"flex flex-col gap-4 p-5",children:[a.jsxs("div",{className:"flex gap-3 items-center",children:[a.jsx("div",{className:"flex justify-center items-center w-9 h-9 bg-amber-100 rounded-full dark:bg-amber-950/40",children:a.jsx(Sa,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"})}),a.jsx(ms,{className:"font-mono text-sm font-semibold",children:h("chat.input.mode.yolo.confirm.title")})]}),a.jsx(gs,{id:"yolo-confirm-desc",className:"text-[13px] leading-relaxed text-zinc-600 dark:text-zinc-400",children:h("chat.input.mode.yolo.confirm.desc")}),a.jsxs("div",{className:"flex gap-2 justify-end items-center pt-1",children:[a.jsx("button",{type:"button",onClick:()=>de(!1),className:"h-8 rounded-md px-3 font-mono text-[12px] font-medium text-zinc-600 transition-colors hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:h("chat.input.mode.yolo.confirm.cancel")}),a.jsx("button",{type:"button","data-blade-yolo-confirm":!0,onClick:()=>{mn(Ze.YOLO),de(!1)},className:"h-8 rounded-md bg-amber-600 px-3 font-mono text-[12px] font-semibold text-white transition-colors hover:bg-amber-700",children:h("chat.input.mode.yolo.confirm.accept")})]})]})})})]})}function ul({className:e,size:t=28,pulse:s=!0}){return a.jsxs("span",{className:te("inline-flex relative justify-center items-center","text-[hsl(var(--deck-ink))]",e),style:{width:t,height:t},"aria-hidden":"true",children:[a.jsxs("svg",{viewBox:"0 0 32 32",width:t,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M16 3 L28 16 L16 29 L4 16 Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),a.jsx("path",{d:"M16 8 L24 16 L16 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.55"}),a.jsx("path",{d:"M16 3 L20 7",stroke:"hsl(var(--deck-accent))",strokeWidth:"2",strokeLinecap:"round"})]}),s&&a.jsx("span",{className:"absolute top-[3px] right-[3px] h-1.5 w-1.5 rounded-full",style:{background:"hsl(var(--deck-accent-glow))",boxShadow:"0 0 6px hsl(var(--deck-accent-glow) / 0.9)"}})]})}const pl="[data-mobile-navigation-trigger]";function Vl(e){return Ja(pl,e)}function Ja(e,t){const s=document.querySelector(e);return!s||s.getClientRects().length===0?!1:(t.preventDefault(),s.focus({preventScroll:!0}),!0)}function hl({open:e,onOpenChange:t}){const s=$e(),{boundProjects:n,selectedProjectPath:r,isBindingProject:o,loadBoundProjects:l,bindProject:m,unbindProject:k,selectProject:v,startTemporarySession:c}=L(),u=L(w=>W(w.historySurfaceSelection)),[i,d]=b.useState(""),[p,g]=b.useState(null),[f,h]=b.useState(!1),C=b.useRef(0);b.useEffect(()=>{if(e&&!u){l();return}C.current+=1,h(!1)},[u,l,e]);const S=async w=>{qe(L.getState())||(await m(w),d(""),c(),t(!1))},T=async w=>{if(w.preventDefault(),!(!i.trim()||o||f)){g(null);try{await S(i.trim())}catch(E){g(E instanceof Error?E.message:s("projects.bind.failed"))}}},j=async()=>{if(qe(L.getState())||f||o)return;const w=++C.current;g(null),h(!0);try{const E=await D.pickProjectDirectory();if(w!==C.current||E.cancelled)return;d(E.path),await S(E.path)}catch(E){if(w!==C.current)return;g(E instanceof Error?E.message:s("projects.pick.failed"))}finally{w===C.current&&h(!1)}},A=w=>{qe(L.getState())||(v(w),c(),t(!1))};return!e||u?null:a.jsx(on,{open:e,onOpenChange:t,children:a.jsxs(hs,{onCloseAutoFocus:w=>Ja("[data-project-setup-trigger]",w),className:"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] sm:max-w-xl",children:[a.jsxs(cn,{children:[a.jsxs(ms,{className:"flex items-center gap-2 font-mono text-[16px]",children:[a.jsx(Vs,{className:"h-4 w-4 text-[hsl(var(--deck-accent))]"}),s("projects.dialog.title")]}),a.jsx(gs,{className:"text-[12px] text-[hsl(var(--deck-ink-muted))]",children:s("projects.dialog.description")})]}),a.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[a.jsx("input",{value:i,onChange:w=>d(w.target.value),disabled:o,placeholder:s("projects.bind.placeholder"),"aria-label":s("projects.bind.pathLabel"),className:"h-9 min-w-0 flex-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12px] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.65)]"}),a.jsxs("button",{type:"button",onClick:()=>void j(),disabled:f||o,title:s("projects.pick.action"),"aria-label":s("projects.pick.action"),className:"inline-flex h-9 shrink-0 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.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))] disabled:cursor-wait disabled:opacity-50",children:[f?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Co,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"hidden sm:inline",children:s(f?"projects.pick.picking":"projects.pick.actionShort")})]}),a.jsxs("button",{type:"submit",disabled:!i.trim()||o||f,className:"inline-flex h-9 items-center gap-2 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[12px] text-[hsl(var(--deck-canvas))] transition-opacity disabled:opacity-40",children:[o?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Vs,{className:"h-3.5 w-3.5"}),s("projects.bind.action")]})]}),p&&a.jsx("div",{role:"alert",className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:p}),a.jsx("div",{className:"max-h-72 space-y-1 overflow-y-auto",children:n.map(w=>{const E=w.path===r;return a.jsxs("div",{className:te("group flex items-center gap-3 rounded-md border px-3 py-2",E?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))]":"border-transparent hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[a.jsx(Yt,{className:te("h-4 w-4 shrink-0",E?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),a.jsxs("button",{type:"button",disabled:!w.available,onClick:()=>A(w.path),className:"min-w-0 flex-1 text-left disabled:cursor-not-allowed disabled:opacity-50",children:[a.jsx("span",{className:"block truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:w.name}),a.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[w.gitBranch&&a.jsxs(a.Fragment,{children:[a.jsx(nn,{className:"h-2.5 w-2.5"}),a.jsx("span",{children:w.gitBranch}),a.jsx("span",{children:"·"})]}),a.jsx("span",{className:"truncate",children:w.path}),!w.available&&a.jsxs("span",{className:"shrink-0 text-red-500",children:["· ",s("projects.unavailable")]})]})]}),!w.isCurrent&&a.jsx("button",{type:"button",onClick:()=>qe(L.getState())?void 0:void k(w.path).catch(()=>{}),title:s("projects.unbind.action"),"aria-label":s("projects.unbind.action"),className:"rounded p-1.5 text-[hsl(var(--deck-ink-faint))] opacity-0 transition group-hover:opacity-100 hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 dark:hover:bg-red-950/30",children:a.jsx(Ho,{className:"h-3.5 w-3.5"})})]},w.path)})})]})})}function ml(e,t){var r;const s=(r=e.title)==null?void 0:r.trim();if(s==="Code Review")return t("session.title.codeReview");if(s)return s;const n=e.firstMessageTime||e.lastMessageTime;if(n){const o=new Date(n);if(!Number.isNaN(o.getTime()))return t("recent.session.fallbackDated",{y:String(o.getFullYear()).slice(-2),m:String(o.getMonth()+1).padStart(2,"0"),d:String(o.getDate()).padStart(2,"0"),hh:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0")})}return t("recent.session.fallbackShort",{id:e.sessionId.slice(0,6)})}function la(e){const t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;const s=new Date(t).getTime();return Number.isNaN(s)?0:s}function da(e){return e.pendingInteraction?0:e.taskStatus==="running"?1:e.taskStatus==="queued"?2:3}function gl(e,t){return da(e)-da(t)||la(t)-la(e)}const fl={running:{dot:"bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",labelKey:"recent.status.running",text:"text-blue-700 dark:text-blue-400"},queued:{dot:"bg-amber-400",labelKey:"recent.status.queued",text:"text-amber-700 dark:text-amber-400"},interrupted:{dot:"bg-orange-500",labelKey:"recent.status.paused",text:"text-orange-700 dark:text-orange-400"},failed:{dot:"bg-red-500",labelKey:"recent.status.failed",text:"text-red-700 dark:text-red-400"},cancelled:{dot:"bg-zinc-400",labelKey:"recent.status.cancelled",text:"text-zinc-500"},completed:{dot:"bg-[hsl(var(--deck-accent))]",labelKey:"recent.status.done",text:"text-[hsl(var(--deck-accent))]"}};function kl(e,t){if(!e)return"";const s=new Date(e);if(Number.isNaN(s.getTime()))return"";const n=Date.now()-s.getTime(),r=Math.floor(n/6e4);if(r<1)return t("recent.time.justNow");if(r<60)return t("recent.time.minutes",{n:r});const o=Math.floor(r/60);if(o<24)return t("recent.time.hours",{n:o});const l=Math.floor(o/24);return t("recent.time.days",{n:l})}function yl(e){return e.split("/").filter(Boolean).at(-1)||e}function vl({sessions:e,onSelect:t,cancellingTaskKeys:s,retryingTaskKeys:n,unreadTaskKeys:r,onCancel:o,onRetry:l,catalogLoadState:m="ready",className:k}){const v=$e(),c=[...e].sort(gl).slice(0,4),u=m==="loading"||m==="hydrating";return c.length===0?!u&&m!=="error"?null:a.jsxs("div",{role:m==="error"?"alert":"status",className:te("mt-7 flex items-center gap-2 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/50 px-3 py-2 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",k),children:[u?a.jsx(He,{className:"h-3 w-3 animate-spin text-[hsl(var(--deck-accent))]"}):a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500"}),v(u?"sidebar.catalog.syncing":"sidebar.catalog.incomplete")]}):a.jsxs("div",{className:te("mt-7",k),children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:v("taskHome.recent.title")}),a.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:v(u?"taskHome.recent.partial":m==="error"?"taskHome.recent.incomplete":"taskHome.recent.total",{count:e.length})})]}),a.jsx("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:c.map(i=>{const d=fl[i.taskStatus],p=i.pendingInteraction?i.pendingInteraction.type==="question"?"interaction.badge.question":i.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission":null,g=yl(i.taskSourceProjectPath||i.projectPath),f=ml(i,v),h=ce(ee(i)),C=i.taskStatus==="running"||i.taskStatus==="queued",S=s.includes(h),T=n.includes(h),j=!!i.taskRetryAvailable&&(i.taskStatus==="failed"||i.taskStatus==="interrupted"||i.taskStatus==="cancelled"),A=r.includes(h),w=za(i,v);return a.jsxs("div",{className:te("group flex items-center gap-3 rounded-md border border-transparent px-3 py-1.5 text-left transition-colors","hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[a.jsxs("button",{type:"button",onClick:()=>t(i),className:"flex min-w-0 flex-1 items-center gap-3 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[a.jsx("span",{className:te("h-1.5 w-1.5 shrink-0 rounded-full",p?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":d.dot)}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-[12.5px] text-[hsl(var(--deck-ink))]",children:[a.jsx("span",{className:"truncate",children:f}),A&&a.jsx("span",{title:v("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),i.taskRetriedFrom&&a.jsx("span",{title:`${v("session.retriedFrom")} ${i.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]",children:v("session.retryShort")})]}),a.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[a.jsx("span",{className:"truncate",children:g}),a.jsx("span",{className:"opacity-40",children:"·"}),a.jsx("span",{className:te("shrink-0",p?"text-amber-700 dark:text-amber-400":d.text),children:v(p??d.labelKey)}),a.jsx("span",{className:"opacity-40",children:"·"}),a.jsx("span",{className:"shrink-0",children:kl(i.lastMessageTime||i.firstMessageTime,v)})]}),w&&a.jsx("span",{title:w,className:"mt-0.5 block truncate font-mono text-[9.5px] text-red-600 dark:text-red-400",children:w})]}),a.jsx(vo,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100"})]}),C&&a.jsx("button",{type:"button","aria-label":v(S?"session.action.stopping":"session.action.stop",{title:f}),disabled:S,onClick:()=>o(i),className:"rounded p-1.5 text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:S?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Ca,{className:"h-3.5 w-3.5"})}),j&&a.jsx("button",{type:"button","aria-label":v(T?"session.action.retrying":"session.action.retry",{title:f}),disabled:T,onClick:()=>l(i),className:"rounded p-1.5 text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:T?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(an,{className:"h-3.5 w-3.5"})})]},h)})})]})}function bl({index:e,title:t,description:s,icon:n,hint:r,onClick:o}){const l=String(e+1).padStart(2,"0"),m=`⌘${e+1}`;return a.jsxs("button",{type:"button",onClick:o,className:te("group relative flex min-h-[100px] flex-col justify-between overflow-hidden rounded-lg border p-3.5 text-left transition","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]","hover:-translate-y-[1px] hover:border-[hsl(var(--deck-accent)/0.55)] hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.35)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))] focus-visible:ring-offset-2 focus-visible:ring-offset-[hsl(var(--deck-canvas))]","dark:bg-[hsl(var(--deck-surface))] dark:hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.55)]"),children:[a.jsx("span",{"aria-hidden":"true",className:te("pointer-events-none absolute right-3 top-3 h-2 w-2","border-r border-t border-[hsl(var(--deck-border-strong))]","transition-colors group-hover:border-[hsl(var(--deck-accent))]")}),a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("span",{className:te("inline-flex h-8 w-8 items-center justify-center rounded-md border transition-colors","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))]","group-hover:border-[hsl(var(--deck-accent)/0.5)] group-hover:bg-[hsl(var(--deck-accent-soft))]"),children:a.jsx(n,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))] transition-colors group-hover:text-[hsl(var(--deck-accent))]"})}),a.jsx("span",{className:"font-mono text-[10px] tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:l})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[13px] font-semibold text-[hsl(var(--deck-ink))]",children:t}),a.jsx("div",{className:"mt-1 line-clamp-2 text-[11.5px] leading-[1.45] text-[hsl(var(--deck-ink-muted))]",children:s}),a.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[a.jsx("span",{className:"truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100",children:r}),a.jsx("span",{className:"deck-kbd shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:m})]})]})]})}const Ks=[{key:"explore",titleKey:"taskHome.template.explore.title",descriptionKey:"taskHome.template.explore.description",icon:Mo,prompt:"Explore this codebase and explain ",hintKey:"taskHome.template.explore.hint"},{key:"build",titleKey:"taskHome.template.build.title",descriptionKey:"taskHome.template.build.description",icon:jo,prompt:"Build a production-ready ",hintKey:"taskHome.template.build.hint"},{key:"review",titleKey:"taskHome.template.review.title",descriptionKey:"taskHome.template.review.description",icon:No,prompt:"/review uncommitted",hintKey:"taskHome.template.review.hint"},{key:"fix",titleKey:"taskHome.template.fix.title",descriptionKey:"taskHome.template.fix.description",icon:Lo,prompt:"Investigate and fix ",hintKey:"taskHome.template.fix.hint"}];function wl(e,t){return t?t.split("/").filter(Boolean).at(-1)||t:e("taskHome.hero.projectFallback")}function xl(){const e=$e(),{taskWorkspaceInfo:t,historySurfaceSelection:s,isTaskWorkspaceLoading:n,taskWorkspaceError:r,isDispatchingTask:o,sessions:l,boundProjects:m,selectedProjectPath:k,error:v,selectProject:c,dispatchTask:u,startCodeReview:i,sendMessage:d,startTemporarySession:p,selectSession:g,cancelTask:f,cancellingTaskKeys:h,retryTask:C,retryingTaskKeys:S,unreadTaskKeys:T,taskEventConnectionState:j,catalogLoadState:A,reconnectTaskEvents:w,clearError:E,loadTaskWorkspaceInfo:F,loadBoundProjects:x}=L(),N=W(s),P=De(M=>M.openSettings),B=De(M=>M.isSettingsOpen),U=Te(M=>M.currentMode),_=Te(M=>M.currentModelId),Q=Te(M=>M.configuredModels),Z=Te(M=>M.isLoading),ne=Te(M=>M.hasLoaded),K=Te(M=>M.loadedWorkspacePath),$=Te(M=>M.error),R=Te(M=>M.loadModels),[le,ge]=b.useState("worktree"),[ve,xe]=b.useState(),[Re,Se]=b.useState(!1),Le=e(j==="connected"?"taskHome.eyebrow":j==="reconnecting"?"taskHome.feed.reconnecting":j==="offline"?"taskHome.feed.offline":"taskHome.feed.connecting"),de=b.useMemo(()=>m.find(M=>M.path===k)??m.find(M=>M.isCurrent),[m,k]),J=b.useMemo(()=>tc(l,k,(t==null?void 0:t.cwd)??null),[k,l,t==null?void 0:t.cwd]),Y=(de!=null&&de.available?de.path:void 0)??(t==null?void 0:t.cwd),ue=`task:${Y??"unavailable"}`;b.useEffect(()=>{!B&&Y&&(!ne||K!==Y)&&R(Y)},[B,R,K,ne,Y]);const he=!(de!=null&&de.available)&&n,I=de!=null&&de.available?null:r,q=!!(Y&&!he&&!I),ie=!!(_&&Q.some(M=>M.id===_)),Ce=!ne||Z,fe=q&&ie&&!Ce&&$===null,Ke=b.useMemo(()=>({project:wl(e,(de==null?void 0:de.path)??(t==null?void 0:t.cwd)),branch:(de==null?void 0:de.gitBranch)??(t==null?void 0:t.gitBranch)??e("taskHome.context.branchFallback")}),[de,t,e]),we=b.useCallback(async M=>{if(qe(L.getState()))return;const Ee=M.content.trim();if(Ee==="/review"||Ee.startsWith("/review ")){if(M.attachments.length>0)throw new Error(e("taskHome.review.attachmentsUnsupported"));if(M.outputSchema)throw new Error(e("taskHome.review.outputSchemaUnsupported"));const be=Ee.split(/\s+/),Ne=be[1]||"uncommitted";if(Ne!=="uncommitted"&&Ne!=="base"&&Ne!=="commit"||Ne==="uncommitted"&&be.length!==2&&be.length!==1||(Ne==="base"||Ne==="commit")&&be.length!==3)throw new Error(e("taskHome.review.usage"));await i({projectPath:Y,kind:Ne,...be[2]?{ref:be[2]}:{},modelId:M.modelId??_??void 0});return}if(M.content.trimStart().startsWith("!")){p(Y),await d({content:M.content,attachments:[]});return}await u({prompt:M.content,projectPath:Y,isolation:le,permissionMode:U,modelId:M.modelId??_??void 0,reasoningEffort:M.reasoningEffort,serviceTier:M.serviceTier,responseVerbosity:M.responseVerbosity,communicationStyle:M.communicationStyle,...M.outputSchema?{outputSchema:M.outputSchema}:{},attachments:M.attachments.map(be=>({type:"image",content:be.dataUrl,mimeType:be.mimeType,name:be.name}))})},[U,_,u,le,d,i,p,Y,e]);return b.useEffect(()=>{const M=Ee=>{if(!(Ee.metaKey||Ee.ctrlKey))return;const be=Number.parseInt(Ee.key,10);if(Number.isNaN(be)||be<1||be>Ks.length)return;const Ne=Ks[be-1];Ne&&(Ee.preventDefault(),xe({key:ue,content:Ne.prompt}))};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[ue]),a.jsx("main",{className:"deck-canvas relative flex-1 overflow-y-auto text-[hsl(var(--deck-ink))]",children:a.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-[960px] flex-col px-6 py-8 md:px-8 md:py-10",children:[a.jsxs("div",{className:"flex gap-4 items-start mb-6",children:[a.jsx(ul,{size:36,className:"hidden mt-1 sm:inline-flex"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:te("deck-eyebrow flex items-center gap-2",j==="offline"?"text-amber-700 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[j==="offline"?a.jsx(qn,{className:"w-3 h-3"}):a.jsx("span",{className:"deck-pulse-dot"}),Le]}),a.jsxs("h1",{className:"mt-2.5 max-w-3xl text-balance text-[clamp(28px,3vw,34px)] font-medium leading-[1.12] tracking-[-0.028em] text-[hsl(var(--deck-ink))]",children:[e("taskHome.hero.prefix")," ",a.jsx("span",{className:"whitespace-nowrap font-mono text-[0.82em] text-[hsl(var(--deck-accent))]",children:Ke.project}),a.jsx("span",{className:"text-[hsl(var(--deck-ink-muted))]",children:"?"})]}),a.jsx("p",{className:"mt-2 max-w-[46rem] text-[13px] leading-[1.55] text-[hsl(var(--deck-ink-muted))]",children:e("taskHome.hero.subtitle")})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.templates.title")}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[a.jsx(xa,{className:"w-3 h-3"}),a.jsx("span",{children:e("taskHome.templates.hint")})]})]}),a.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:Ks.map((M,Ee)=>a.jsx(bl,{index:Ee,title:e(M.titleKey),description:e(M.descriptionKey),icon:M.icon,hint:e(M.hintKey),onClick:()=>xe({key:ue,content:M.prompt})},M.key))})]}),a.jsxs("div",{"data-blade-task-dispatch-ready":fe?"true":"false","data-blade-task-workspace-ready":q?"true":"false","data-blade-task-model-ready":ie?"true":"false","data-blade-task-model-loaded":ne?"true":"false","data-blade-task-model-loading":Z?"true":"false",className:"rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_28px_80px_-32px_hsl(var(--deck-accent)/0.28),0_2px_0_hsl(var(--deck-hairline))]",children:[a.jsxs("div",{className:"flex items-center gap-0 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/50",children:[a.jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[a.jsxs(at,{children:[a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button","aria-label":e("taskHome.context.projectSelect"),disabled:m.length===0,className:"group flex h-9 min-w-0 items-center gap-2 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11.5px] text-[hsl(var(--deck-ink))] transition-colors hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-50",children:[a.jsx(Yt,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),a.jsx("span",{className:"font-medium truncate",children:(de==null?void 0:de.name)??Ke.project}),a.jsx(ft,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))] transition-transform group-data-[state=open]:rotate-180"})]})}),a.jsx(Xe,{align:"start",sideOffset:4,className:"w-56 rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-1 shadow-xl",children:a.jsxs("div",{className:"flex flex-col",children:[m.map(M=>a.jsxs("button",{type:"button",disabled:!M.available,onClick:()=>{c(M.path)},className:te("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-left font-mono text-[12px] transition-colors",M.path===k?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))]",!M.available&&"opacity-40"),children:[a.jsx(Yt,{className:"w-3 h-3 shrink-0"}),a.jsx("span",{className:"flex-1 min-w-0 truncate",children:M.name}),M.path===k&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))]"})]},M.path)),m.length===0&&a.jsx("span",{className:"px-2.5 py-2 text-center font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.workspace.empty")})]})})]}),a.jsxs("button",{type:"button","data-blade-task-isolation":le,"aria-pressed":le==="worktree",onClick:()=>ge(M=>M==="worktree"?"local":"worktree"),className:te("flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] transition-colors",le==="worktree"?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),title:e("taskHome.context.isolationToggleTitle"),children:[le==="worktree"?a.jsx(Eo,{className:"w-3 h-3"}):a.jsx(Po,{className:"w-3 h-3"}),a.jsx("span",{className:"hidden sm:inline",children:e(le==="worktree"?"taskHome.context.isolation.worktree":"taskHome.context.isolation.local")})]}),a.jsxs("span",{className:"flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[a.jsx(nn,{className:"w-3 h-3"}),a.jsx("span",{className:"hidden sm:inline",children:Ke.branch})]})]}),a.jsxs("div",{className:"flex gap-2 items-center px-3 shrink-0",children:[(t==null?void 0:t.taskAdmission)&&a.jsx(Ba,{inFlight:t.taskAdmission.inFlight,queued:t.taskAdmission.queued,maxConcurrent:t.taskAdmission.maxConcurrent,compact:!0}),o&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-accent))]",children:[a.jsx(He,{className:"w-3 h-3 animate-spin"}),a.jsx("span",{className:"hidden sm:inline",children:e("taskHome.context.preparing")})]})]})]}),!fe&&a.jsxs("section",{"aria-label":e("taskHome.setup.aria"),className:"border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-3",children:[a.jsxs("div",{className:"mb-2.5",children:[a.jsx("h2",{className:"font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.title")}),a.jsx("p",{className:"mt-0.5 text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.description")})]}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[a.jsx("span",{className:te("flex justify-center items-center w-7 h-7 rounded-md border shrink-0",q?"text-emerald-700 bg-emerald-50 border-emerald-300/70 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":I?"text-red-700 bg-red-50 border-red-300/70 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"text-amber-700 bg-amber-50 border-amber-300/70 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:he?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):q?a.jsx(Hn,{className:"h-3.5 w-3.5"}):I?a.jsx(ss,{className:"h-3.5 w-3.5"}):a.jsx(Yt,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.workspace.title")}),a.jsx("span",{className:"mt-0.5 block truncate text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:he?e("taskHome.setup.workspace.loading"):I||(q?e("taskHome.setup.workspace.ready",{project:Ke.project}):e("taskHome.setup.workspace.required"))})]}),!q&&a.jsxs("div",{className:"flex gap-1 items-center shrink-0",children:[I&&a.jsx("button",{type:"button",onClick:()=>{Promise.all([F(),x()])},"aria-label":e("taskHome.setup.workspace.retry"),title:e("taskHome.setup.workspace.retry"),className:"flex h-8 w-8 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-canvas))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:a.jsx(Rs,{className:"h-3.5 w-3.5"})}),a.jsxs("button",{type:"button","data-project-setup-trigger":!0,onClick:()=>Se(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[a.jsx(Vs,{className:"w-3 h-3"}),e("taskHome.setup.workspace.action")]})]})]}),a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[a.jsx("span",{className:te("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",ie&&!$?"border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":$?"border-red-300/70 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"border-amber-300/70 bg-amber-50 text-amber-700 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:Ce?a.jsx(He,{className:"h-3.5 w-3.5 animate-spin"}):ie&&!$?a.jsx(Hn,{className:"h-3.5 w-3.5"}):$?a.jsx(ss,{className:"h-3.5 w-3.5"}):a.jsx(On,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.model.title")}),a.jsx("span",{title:$??void 0,className:te("mt-0.5 block truncate text-[10.5px]",$?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:Ce?e("taskHome.setup.model.loading"):$||e(ie?"taskHome.setup.model.ready":"taskHome.setup.model.required")})]}),!Ce&&(!ie||$)&&a.jsxs("button",{type:"button","data-model-setup-trigger":!0,onClick:()=>{$?R(Y):P("models")},className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[$?a.jsx(Rs,{className:"w-3 h-3"}):a.jsx(On,{className:"w-3 h-3"}),e($?"taskHome.setup.model.retry":"taskHome.setup.model.action")]})]})]})]}),a.jsx("div",{className:"px-3 pt-3 pb-3",children:a.jsx(dl,{variant:"task",draft:(ve==null?void 0:ve.key)===ue?ve.content:void 0,draftKey:ue,placeholder:e("taskHome.composer.placeholder"),onSend:async M=>{try{return await we(M),xe(void 0),!0}catch{return!1}},disabled:N||o,submitDisabled:!fe,shellSubmitDisabled:!fe,workspacePath:Y},ue)})]}),j==="offline"&&a.jsxs("div",{role:"alert",className:"flex flex-wrap gap-3 items-center px-3 py-2 mt-4 text-amber-900 rounded-md border border-amber-300/70 bg-amber-50/80 dark:border-amber-800/70 dark:bg-amber-950/35 dark:text-amber-200",children:[a.jsx(qn,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 text-[12px]",children:e("taskHome.feed.offlineDescription")}),a.jsxs("button",{type:"button",onClick:()=>void w().catch(()=>{}),className:"inline-flex min-h-8 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-mono 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/50 dark:hover:bg-amber-900/50",children:[a.jsx(Rs,{className:"w-3 h-3"}),e("taskHome.feed.retry")]})]}),v&&a.jsxs("div",{role:"alert","data-blade-task-error":!0,className:"flex justify-between items-center px-3 py-2 mt-4 font-mono text-xs text-red-700 rounded-md border border-red-200 bg-red-50/80 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[a.jsx("span",{children:v}),a.jsx("button",{type:"button",onClick:E,className:"underline",children:e("taskHome.error.dismiss")})]}),a.jsx(vl,{sessions:J,catalogLoadState:A,cancellingTaskKeys:h,retryingTaskKeys:S,unreadTaskKeys:T,onSelect:M=>{g(ee(M))},onCancel:M=>{qe(L.getState())||f(ee(M)).catch(()=>{})},onRetry:M=>{qe(L.getState())||C(ee(M)).catch(()=>{})}}),a.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[a.jsx(Oo,{className:"w-3 h-3"}),a.jsx("span",{className:"font-mono uppercase tracking-[0.14em]",children:e("taskHome.footer.note")})]}),a.jsx(hl,{open:Re,onOpenChange:Se})]})})}const tn="blade.sessions.last",et="session",ds="project",Nt="workspace",yt="view",ks="workspaceKind",ys="workspaceRef",Ya="history",us="bladeSessionSurfaceLocator",Xa=[yt,et,ks,ys],Sl=[ds,Nt,"cwd","displayCwd"];function un(e){try{return mo.parse(e)}catch{return null}}function Cl(e){return!e||typeof e!="object"||Array.isArray(e)?null:un(e[us])}function jl(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.hasOwn(e,us)}function Tl(e){const t=e.get(et),s=e.get(ks),n=e.get(ys);return!t||s!=="acp-remote"||!n?null:un({version:2,sessionId:t,workspace:{kind:"acp-remote",workspaceRef:n}})}function ua(e,t){const s=new URLSearchParams(e),n=s.get(yt)===Ya,r=s.has(ks)||s.has(ys),o=Cl(t),l=jl(t);if(!n)return{locator:null,shouldCleanup:r||l};const m=new Set;for(const[v]of s){if(!Xa.includes(v)||m.has(v))return{locator:null,shouldCleanup:!0};m.add(v)}const k=Tl(s);return k?l&&!o?{locator:null,shouldCleanup:!0}:o&&!Zt(o,k)?{locator:null,shouldCleanup:!0}:{locator:k,shouldCleanup:!1}:{locator:null,shouldCleanup:!0}}function Gt(e,t={}){const s=t.href??(typeof window>"u"?"http://localhost/":window.location.href),n=new URL(s),r=e?un(e):null,o=(r==null?void 0:r.workspace.kind)==="acp-remote"?r:null;if(o)n.search="";else for(const u of[...Xa,...Sl])n.searchParams.delete(u);const l=t.historyState&&typeof t.historyState=="object"&&!Array.isArray(t.historyState)?{...t.historyState}:{};delete l[us];const m=o?{...l,[us]:o}:Object.keys(l).length>0?l:null;(o==null?void 0:o.workspace.kind)==="acp-remote"&&(n.searchParams.set(yt,Ya),n.searchParams.set(et,o.sessionId),n.searchParams.set(ks,o.workspace.kind),n.searchParams.set(ys,o.workspace.workspaceRef));const k=`${n.pathname}${n.search}${n.hash}`,v=t.replaceState??(typeof window>"u"?void 0:(u,i)=>window.history.replaceState(u,"",i)),c=t.pushState??(typeof window>"u"?void 0:(u,i)=>window.history.pushState(u,"",i));return m&&t.push?c==null||c(m,k):v==null||v(m,k),k}function Pl(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.sessionId=="string"&&t.sessionId.trim()&&typeof t.projectPath=="string"&&t.projectPath.trim()?{sessionId:t.sessionId,projectPath:t.projectPath}:null}function Al(e){var l,m,k;const t=new URLSearchParams(e),s=((l=t.get(et))==null?void 0:l.trim())||null,n=((m=t.get(ds))==null?void 0:m.trim())||null,r=((k=t.get(Nt))==null?void 0:k.trim())||null,o=t.get(yt)==="board"?"board":"workspace";return{sessionRef:s&&(r||n)?{sessionId:s,projectPath:r||n}:null,projectPath:n,hasSessionParam:t.has(et),view:o}}function Rl(e=typeof localStorage>"u"?null:localStorage){if(!e)return null;try{const t=e.getItem(tn);return t?Pl(JSON.parse(t)):null}catch{return null}}function El(e,t,s={}){const n=s.href??(typeof window>"u"?"http://localhost/":window.location.href),r=new URL(n),o=s.view??"workspace",l=s.displayProjectPath??(o==="board"?t:e==null?void 0:e.projectPath)??t,m=(e==null?void 0:e.projectPath)??null;e&&o==="workspace"?r.searchParams.set(et,e.sessionId):r.searchParams.delete(et),l?r.searchParams.set(ds,l):r.searchParams.delete(ds),m&&l&&m!==l?r.searchParams.set(Nt,m):r.searchParams.delete(Nt),o==="board"?(r.searchParams.set(yt,"board"),r.searchParams.delete(et),r.searchParams.delete(Nt)):r.searchParams.delete(yt);const k=s.storage===void 0?typeof localStorage>"u"?null:localStorage:s.storage;try{e&&o==="workspace"?k==null||k.setItem(tn,JSON.stringify(e)):o==="workspace"&&(k==null||k.removeItem(tn))}catch{}const v=`${r.pathname}${r.search}${r.hash}`,c=s.replaceState??(typeof window>"u"?void 0:u=>window.history.replaceState(null,"",u));return c==null||c(v),v}const Nl=b.lazy(()=>Be(()=>import("./ChatView-DhjLZ2OR.js"),__vite__mapDeps([27,2,1,6,8,3,28,21,20,29,10,11,18,12,0])).then(e=>({default:e.ChatView}))),Ml=b.lazy(()=>Be(()=>import("./KanbanBoard-Ct16zVW3.js"),__vite__mapDeps([30,2,1,9,11,26,18,10,29,5,3])).then(e=>({default:e.KanbanBoard}))),Il=b.lazy(()=>Be(()=>import("./SessionHistorySurface-D3-0PA12.js"),__vite__mapDeps([31,2,28,3,1])).then(e=>({default:e.SessionHistorySurface})));function Fl(){const e=$e(),[t,s]=b.useState(!1),n=L(x=>x.subscribeToTaskEvents),r=L(x=>x.unsubscribeFromTaskEvents),o=L(x=>x.currentSessionRef),l=L(x=>x.historySurfaceSelection),m=L(x=>x.isTemporarySession),k=L(x=>x.loadTaskWorkspaceInfo),v=L(x=>x.loadBoundProjects),c=L(x=>x.loadSessions),u=L(x=>x.loadSurfaceCatalog),i=L(x=>x.openHistorySurface),d=L(x=>x.closeHistorySurface),p=L(x=>x.selectSession),g=L(x=>x.selectProject),f=L(x=>x.startTemporarySession),h=L(x=>x.setError),C=L(x=>x.sessions),S=L(x=>x.selectedProjectPath),T=Te(x=>x.loadModels),j=ut(x=>x.loadSettings),A=De(x=>x.mainView),w=De(x=>x.setMainView),E=De(x=>x.boardProjectPath),F=De(x=>x.setBoardProjectPath);return b.useEffect(()=>(n().catch(x=>{console.error("Failed to subscribe to task events",x)}),r),[n,r]),b.useEffect(()=>d,[d]),b.useEffect(()=>{let x=!1;return(async()=>{var $;c(),u(),j(),T();const P=ua(window.location.search,window.history.state);if(P.shouldCleanup&&Gt(null,{href:window.location.href,historyState:window.history.state}),P.locator){if(await i(P.locator),x)return;L.getState().historySurfaceSelection||(Gt(null,{href:window.location.href,historyState:window.history.state}),L.getState().currentSessionRef||f()),w("workspace"),F(null),s(!0);return}const B=Al(window.location.search);w(B.view),F(B.view==="board"?B.projectPath:null);const U=Rl(),_=B.view==="board"?null:B.hasSessionParam?B.sessionRef:B.projectPath?null:U,Q=Promise.all([k(),v()]),Z=!_&&!B.projectPath;if(Z&&(f(),s(!0)),await Q,x)return;const ne=L.getState(),K=B.projectPath?($=ne.boundProjects.find(R=>R.path===B.projectPath&&R.available))==null?void 0:$.path:null;if(K&&g(K),!(_&&(await p(_),x))){if(!_||!V(L.getState().currentSessionRef,_)){const R=_?L.getState().error:null;f(),R&&h(R)}Z||s(!0)}})(),()=>{x=!0}},[v,T,c,u,j,k,i,g,p,h,F,w,f]),b.useEffect(()=>{if(!t)return;if(l){Gt(l.locator,{href:window.location.href,historyState:window.history.state});return}const x=ua(window.location.search,window.history.state);(x.locator||x.shouldCleanup)&&Gt(null,{href:window.location.href,historyState:window.history.state});const N=o?as(C,o):void 0;El(A==="workspace"?o:null,A==="board"?E:S,{displayProjectPath:A==="board"?E:N?fs(N,S):S,view:A})},[E,o,l,t,A,S,C]),a.jsxs(a.Fragment,{children:[a.jsx($c,{}),a.jsx(Bc,{children:t?l?a.jsx(b.Suspense,{fallback:a.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:a.jsx(Il,{})}):A==="board"?a.jsx(b.Suspense,{fallback:a.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:a.jsx(Ml,{})}):!o||m?a.jsx(xl,{}):a.jsx(b.Suspense,{fallback:a.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:a.jsx(Nl,{})}):a.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")})})]})}Er.createRoot(document.getElementById("root")).render(a.jsx(Nr.StrictMode,{children:a.jsx(Fl,{})}));export{Ja as $,ss as A,bo as B,wo as C,on as D,ml as E,Ln as F,nn as G,Po as H,za as I,vo as J,zl as K,He as L,Yt as M,lt as N,Te as O,Eo as P,Ba as Q,an as R,Io as S,Ho as T,Mo as U,Vs as V,qn as W,Xt as X,hl as Y,Pe as Z,Be as _,L as a,at as a0,rt as a1,Xe as a2,bc as a3,Fo as a4,$a as a5,Fc as a6,gl as a7,pe as a8,fs as a9,Gn as aa,$l as ab,So as ac,Oo as ad,Vl as ae,On as af,No as ag,Kl as ah,Co as ai,Qn as aj,Bl as ak,ql as al,la as am,Zt as an,Ha as ao,ee as b,X as c,ce as d,hs as e,cn as f,ms as g,gs as h,Ia as i,te as j,Sa as k,D as l,ul as m,ft as n,Dn as o,Rs as p,Un as q,_l as r,V as s,Hn as t,$e as u,as as v,Ca as w,ut as x,dl as y,ia as z};