claude-code-session-manager 0.136.1 → 0.136.2

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 (28) hide show
  1. package/dist/assets/{AgentLibrary-DsJcjUSt.js → AgentLibrary-CbvVbzm2.js} +1 -1
  2. package/dist/assets/{AppSettings-DS_d4o5R.js → AppSettings-Blks3xh_.js} +1 -1
  3. package/dist/assets/{Button-CVbZqtPJ.js → Button-hPwe-y_4.js} +1 -1
  4. package/dist/assets/{DocumentEditorPane-C4G5oeng.js → DocumentEditorPane-C_fgkNoa.js} +1 -1
  5. package/dist/assets/{Extensions-ifcqZDuK.js → Extensions-CcDjNq7W.js} +2 -2
  6. package/dist/assets/{History-CBFAmFB7.js → History-D4s5ykcm.js} +1 -1
  7. package/dist/assets/{Library-DlUH_fFF.js → Library-BtJ7gnDM.js} +1 -1
  8. package/dist/assets/{ListDetail-DrzkqaSM.js → ListDetail-Bbwwd-HR.js} +1 -1
  9. package/dist/assets/{Panel-Bjr5sT2j.js → Panel-8xYPYH7R.js} +1 -1
  10. package/dist/assets/{ProjectClaudeConfig-BEJAWpS2.js → ProjectClaudeConfig-B9PlbaSV.js} +1 -1
  11. package/dist/assets/{ProvenanceBadge-Dlq0DSL2.js → ProvenanceBadge-COnyY49b.js} +1 -1
  12. package/dist/assets/{Scheduler-CdwNo2AT.js → Scheduler-CpmSitKx.js} +1 -1
  13. package/dist/assets/{Settings-BMy1KcDY.js → Settings-Blfjp8Bp.js} +1 -1
  14. package/dist/assets/{SkillReferenceGraph-CqngCjO5.js → SkillReferenceGraph-pYSyx841.js} +1 -1
  15. package/dist/assets/{Skills-DCoKjG_1.js → Skills-C4fV80-T.js} +1 -1
  16. package/dist/assets/{SourceChip-mjf4AO7V.js → SourceChip-Bx9marLv.js} +1 -1
  17. package/dist/assets/{SystemPrompt-BDv0OwoH.js → SystemPrompt-CBvedERn.js} +1 -1
  18. package/dist/assets/{TiptapBody-BdPKStNP.js → TiptapBody-BV7WhKYF.js} +1 -1
  19. package/dist/assets/{Toggle-CaLQyunk.js → Toggle-BUPbeHTj.js} +1 -1
  20. package/dist/assets/{ViewTabs-DVLIAjik.js → ViewTabs-oXSVRUrm.js} +1 -1
  21. package/dist/assets/{VoiceButton-CUXKeY0C.js → VoiceButton-Ca6X_WNA.js} +1 -1
  22. package/dist/assets/{historyTotals-07_oiLDE.js → historyTotals-BcJ7QH96.js} +1 -1
  23. package/dist/assets/{index-CgSMvkqr.js → index-h8BmSc_8.js} +3 -3
  24. package/dist/index.html +1 -1
  25. package/dist-web/app.js +1 -1
  26. package/package.json +1 -1
  27. package/src/main/build-info.json +4 -4
  28. package/src/main/lib/feedback-remote/crossProjectReply.cjs +23 -2
package/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Claude Session Manager</title>
7
- <script type="module" crossorigin src="./assets/index-CgSMvkqr.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-h8BmSc_8.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="./assets/monaco-editor-BsIlgG7c.js">
9
9
  <link rel="stylesheet" crossorigin href="./assets/monaco-editor-Cu5D__1H.css">
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-62tyjEQB.css">
package/dist-web/app.js CHANGED
@@ -76,7 +76,7 @@ ${i}`].join(`
76
76
 
77
77
  `);return _V({title:`[Customer ${s.tag}] ${s.title}`,goal:r,tag:oPe[s.tag],agentName:"architect",agentDescription:nZe,...n?{agentBody:n.text,agentPath:n.path}:{}})}function sZe({it:s,projectCwd:e}){const n=no(v=>v.setInboxStatus),i=no(v=>v.linkEpic),r=dn(v=>v.createPromptSession),[o,a]=T.useState(!1),[l,c]=T.useState(""),[d,u]=T.useState(!1),h=s.body.length>f0e,f=h&&!o?`${s.body.slice(0,f0e)}…`:s.body,g=s.epicId!=null,m=d||g||!e,_=g?"An Epic is already linked to this feedback":e?"Create a proposed Epic from this feedback":"No owner project is configured for this inbox",b=async()=>{if(!(m||!e)){u(!0);try{const{goalText:v,openingPrompt:x,sections:w}=await iZe(s,e),y=await r(e,v,oPe[s.tag],void 0,"architect",x,w);await i(s.id,y.id),await n(s.id,"in_progress")}catch(v){he.error(v instanceof Error?v.message:String(v))}finally{u(!1)}}};return p.jsxs("div",{className:"rounded-lg border border-line bg-bg px-3 py-2 grid gap-1.5","data-testid":"customer-feedback-inbox-item",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsx("div",{className:"min-w-0 text-[13px] font-semibold text-fg break-words",children:s.title}),p.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[11px] font-semibold text-fg-dim",children:QXe[s.status]})]}),p.jsxs("div",{className:"font-mono text-[11px] text-fg-dim",children:[eZe[s.tag]," · ",new Date(JJ(s.receivedAt)).toLocaleDateString()," · v",s.clientVersion??"?"," ·"," ",s.clientPlatform??"?"]}),p.jsx("div",{className:"text-[12.5px] text-fg whitespace-pre-wrap break-words",children:f}),h&&p.jsx("button",{type:"button",onClick:()=>a(v=>!v),className:"justify-self-start text-[11.5px] font-semibold text-accent",children:o?"Show less":"Show more"}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("select",{value:s.status,onChange:v=>void n(s.id,v.target.value,l.trim()||void 0),className:"rounded-md border border-line bg-bg px-2 py-1 text-[12px] text-fg","aria-label":"Status","data-testid":"customer-feedback-inbox-status",children:rPe.map(v=>p.jsx("option",{value:v.value,children:v.label},v.value))}),p.jsx("input",{type:"text",value:l,onChange:v=>c(v.target.value),placeholder:"Note (optional)",maxLength:500,className:"min-w-0 flex-1 rounded-md border border-line bg-bg px-2 py-1 text-[12px] text-fg","aria-label":"Status note"}),p.jsx("button",{type:"button",onClick:()=>void b(),disabled:m,title:_,className:"rounded-md bg-accent px-2.5 py-1 text-[12px] font-semibold text-white disabled:opacity-50","data-testid":"customer-feedback-inbox-open-epic",children:g?"Epic linked":"Open as Epic"})]})]})}function rZe(){const s=no(a=>{var l;return((l=a.ownerInfo)==null?void 0:l.ownerMode)??!1}),e=no(a=>{var l;return((l=a.ownerInfo)==null?void 0:l.projectCwd)??null}),n=no(a=>a.inbox),i=no(a=>a.inboxLoading),r=no(a=>a.pullInbox),o=T.useMemo(()=>[...n].sort((a,l)=>JJ(l.receivedAt)-JJ(a.receivedAt)),[n]);return T.useEffect(()=>{s&&r()},[s,r]),s?p.jsxs("section",{className:"shrink-0 max-h-[50%] overflow-auto border-t border-line px-5 py-4 grid gap-2 content-start","data-testid":"customer-feedback-inbox",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("h3",{className:"m-0 font-mono text-[11px] uppercase tracking-[0.08em] text-fg-dim",children:"Customer inbox"}),p.jsx("button",{type:"button",onClick:()=>void r(),disabled:i,className:"rounded-md border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-fg-dim hover:bg-bg-elev disabled:opacity-50","data-testid":"customer-feedback-inbox-refresh",children:i?"Refreshing…":"Refresh"})]}),o.length===0?p.jsx("p",{className:"m-0 text-[12.5px] text-fg-dim",children:"No customer feedback yet."}):o.map(a=>p.jsx(sZe,{it:a,projectCwd:e},a.id))]}):null}const oZe={open:"Open",in_progress:"In progress",resolved:"Resolved",wontfix:"Won't fix"},aZe=[{tag:"bug",label:"Bug"},{tag:"feature",label:"Feature"},{tag:"discussion",label:"Discussion"}],lZe={bug:"Bug",feature:"Feature",discussion:"Discussion"},p0e="Send this to Session Manager as feedback.",g0e=120,cZe=4e3;function dZe(){const s=no(S=>S.panelOpen),e=no(S=>S.draft),n=no(S=>S.items),i=no(S=>S.submitting),r=no(S=>S.closePanel),o=no(S=>S.setDraft),a=no(S=>S.submit),l=no(S=>S.load),c=no(S=>S.loadOwnerInfo),d=no(S=>S.refreshStatus),u=no(S=>S.markSeen),h=no(S=>{var E;return((E=S.ownerInfo)==null?void 0:E.ownerMode)===!0}),f=Bs(S=>S.show),[g,m]=T.useState(!1),[_,b]=T.useState(!1),v=T.useMemo(()=>[...n].sort((S,E)=>E.submittedAt-S.submittedAt),[n]);if(T.useEffect(()=>{if(!s){m(!1);return}const S=requestAnimationFrame(()=>m(!0));return()=>cancelAnimationFrame(S)},[s]),T.useEffect(()=>{if(!s)return;let S=!1;return(async()=>(await Promise.all([l(),c(),d()]),S||await u()))(),()=>{S=!0}},[s,l,c,d,u]),T.useEffect(()=>{if(b(!1),!s)return;let S=!1;return(async()=>{var E,L,D,I;try{const A=await((D=(L=(E=window.api)==null?void 0:E.app)==null?void 0:L.seedStatus)==null?void 0:D.call(L));S||b(((I=A==null?void 0:A["scheduler-mcp"])==null?void 0:I.status)==="done")}catch{}})(),()=>{S=!0}},[s]),T.useEffect(()=>{if(!s)return;const S=E=>{E.key==="Escape"&&(E.stopPropagation(),r())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[s,r]),!s)return null;const x=e.title.trim()===""||e.body.trim()==="",w=async()=>{await Uc(p0e)?f("info","Copied — paste it into your session."):f("error","Could not copy to the clipboard.")},y=p.jsxs("div",{className:`fixed inset-0 ${Mi.dialog}`,"data-testid":"customer-feedback-root",children:[p.jsx("div",{className:`absolute inset-0 bg-black/50 transition-opacity duration-[220ms] ${g?"opacity-100":"opacity-0"}`,onClick:S=>{S.target===S.currentTarget&&r()},"data-testid":"customer-feedback-backdrop"}),p.jsxs("aside",{role:"dialog","aria-modal":"true","aria-label":"Send feedback",className:`absolute left-0 top-0 h-full w-full max-w-[480px] border-r border-line bg-bg-elev text-fg shadow-xl flex flex-col transition-transform duration-[220ms] ${g?"translate-x-0":"-translate-x-full"}`,style:{transitionTimingFunction:"cubic-bezier(.32,.72,.28,1)"},"data-testid":"customer-feedback-panel",children:[p.jsxs("header",{className:"px-5 py-4 border-b border-line flex items-center justify-between gap-3 shrink-0",children:[p.jsx("h2",{className:"m-0 font-serif text-[18px] font-semibold text-fg",children:"Feedback"}),p.jsx("button",{onClick:r,className:"shrink-0 rounded-md border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-fg-dim hover:bg-bg-elev","aria-label":"Close","data-testid":"customer-feedback-close",children:"Close"})]}),p.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5 py-4 grid gap-5 content-start",children:[p.jsxs("form",{className:"grid gap-3",onSubmit:S=>{S.preventDefault(),!x&&!i&&a()},children:[_&&p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsxs("p",{className:"m-0 flex-1 text-[12.5px] text-fg-dim","data-testid":"customer-feedback-session-hint",children:['Already talking about this in a session? Ask it: "',p0e,`" It uses what the session already knows, so you don't retype it, and the item shows up here.`]}),p.jsx("button",{type:"button",className:"shrink-0 text-[12.5px] font-semibold text-accent hover:underline","aria-label":"Copy the phrase to ask your session","data-testid":"customer-feedback-session-hint-copy",onClick:()=>void w(),children:"Copy"})]}),p.jsxs("label",{className:"grid gap-1",children:[p.jsxs("span",{className:"flex justify-between font-mono text-[11px] uppercase tracking-[0.05em] text-fg-dim",children:[p.jsx("span",{children:"Header"}),p.jsxs("span",{children:[e.title.length,"/",g0e]})]}),p.jsx("input",{value:e.title,maxLength:g0e,onChange:S=>o({title:S.target.value}),className:"rounded-md border border-line bg-bg px-2.5 py-1.5 text-[13px] text-fg","data-testid":"customer-feedback-title"})]}),p.jsxs("label",{className:"grid gap-1",children:[p.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.05em] text-fg-dim",children:"Body"}),p.jsx("textarea",{value:e.body,maxLength:cZe,rows:6,onChange:S=>o({body:S.target.value}),className:"rounded-md border border-line bg-bg px-2.5 py-1.5 text-[13px] text-fg resize-y","data-testid":"customer-feedback-body"})]}),p.jsx("div",{className:"flex gap-2",role:"group","aria-label":"Feedback type",children:aZe.map(({tag:S,label:E})=>p.jsx("button",{type:"button","aria-pressed":e.tag===S,onClick:()=>o({tag:S}),className:`rounded-md border border-line px-3 py-1 text-[12px] font-semibold ${e.tag===S?"bg-accent text-white":"bg-bg text-fg-dim hover:bg-bg-elev"}`,"data-testid":`customer-feedback-tag-${S}`,children:E},S))}),p.jsx("p",{className:"m-0 text-[11.5px] text-fg-dim",children:"Your feedback is sent to bilko.run. Please don't paste secrets, keys or passwords."}),p.jsx("button",{type:"submit",disabled:x||i,className:"rounded-md bg-accent px-3 py-1.5 text-[13px] font-semibold text-white disabled:opacity-50","data-testid":"customer-feedback-submit",children:i?"Sending…":"Submit"})]}),p.jsxs("p",{className:"m-0 text-[12.5px] text-fg-dim","data-testid":"customer-feedback-free-hour",children:["Rather talk it through?"," ",p.jsx("button",{type:"button",className:"font-semibold text-accent hover:underline","data-testid":"customer-feedback-free-hour-link",onClick:iPe,children:"Book a free hour with Bilko"})]}),p.jsxs("section",{className:"grid gap-2","data-testid":"customer-feedback-list",children:[p.jsx("h3",{className:"m-0 font-mono text-[11px] uppercase tracking-[0.08em] text-fg-dim",children:"Your feedback"}),v.length===0?p.jsx("p",{className:"m-0 text-[12.5px] text-fg-dim",children:"No feedback yet — what you send will show up here."}):v.map(S=>p.jsxs("div",{className:"rounded-lg border border-line bg-bg px-3 py-2 grid gap-1","data-testid":"customer-feedback-item",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsx("div",{className:"min-w-0 text-[13px] font-semibold text-fg break-words",children:S.title}),p.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[11px] font-semibold text-fg-dim","data-testid":"customer-feedback-status",children:oZe[S.status]})]}),p.jsxs("div",{className:"font-mono text-[11px] text-fg-dim",children:[lZe[S.tag]," · ",new Date(S.submittedAt).toLocaleDateString()]}),S.statusNote&&p.jsx("div",{className:"text-[12px] text-fg-dim break-words",children:S.statusNote})]},S.id))]})]}),h&&p.jsx(rZe,{})]})]});return typeof document<"u"&&document.body?Wx.createPortal(y,document.body):y}const uZe=3e4;function hZe(){const s=Ot(L=>L.tabs),e=Ot(L=>L.activeTabId),n=Ot(L=>L.closeTab),i=Ot(L=>L.setActive),r=Ot(L=>L.reorderTab),o=iR(L=>L.watchers),a=ri(L=>L.openPanel),l=ri(L=>L.openProjectPanel),c=ri(L=>L.setEpicsWorkspaceOpen),d=ri(L=>L.navFace==="home"),u=no(L=>L.items),h=no(L=>L.panelOpen),f=no(L=>L.togglePanel),g=no(L=>L.load),m=ZXe(u)>0;T.useEffect(()=>{g()},[g]);const[_,b]=T.useState(()=>Date.now()),v=pde();T.useEffect(()=>{if(!v)return;b(Date.now());const L=window.setInterval(()=>b(Date.now()),1e3);return()=>window.clearInterval(L)},[v]);const x=L=>{for(const D of Object.values(o))if(D.tabId===L&&D.lastLineAt&&_-D.lastLineAt<uZe)return!0;return!1},{getTabDragProps:w,isDragging:y,containerRef:S}=XXe({tabCount:s.length,onReorder:r,onActivate:L=>{const D=s[L];D&&(i(D.id),c(!1),l("terminal"))}}),E=["#6f7d52","#b85c34","#a39079","#7a8466","#5b4a36"];return p.jsxs("div",{className:"h-12 bg-bg-elev border-b border-line flex items-end px-3 gap-0 shrink-0 relative","data-testid":"tour-tabbar",children:[p.jsxs("button",{onClick:()=>a("overview"),title:"This machine — home","aria-current":d?"true":void 0,"data-testid":"tabbar-machine-home",className:`flex items-center gap-2 px-3.5 py-1.5 mb-1 rounded-full text-[13px] shrink-0 transition-colors ${d?"bg-accent text-bg font-semibold shadow-sm":"text-fg-dim hover:text-fg hover:bg-bg-hi/40"}`,children:[p.jsx(Ki,{name:"home",className:"w-[15px] h-[15px]"}),p.jsx("span",{children:"Home"})]}),p.jsx("span",{className:"w-px self-stretch my-1.5 bg-line"}),p.jsx("div",{ref:S,className:`flex items-end gap-0.5 overflow-x-auto no-scrollbar min-w-0 flex-1 select-none ${y?"cursor-grabbing":""}`,children:s.map((L,D)=>{const I=L.id===e,A=w(D),j=E[D%E.length];return p.jsxs("div",{...A,style:A.style,className:`group flex items-center gap-2 px-3.5 pt-1.5 pb-2 rounded-t-[10px] text-[13px] shrink-0 transition-colors ${y?"":"cursor-grab"} ${I?"bg-bg text-fg font-medium relative z-10 -mb-px border border-accent shadow-[inset_0_2px_0_theme(colors.accent.DEFAULT)]":"text-fg-dim hover:text-fg hover:bg-bg-hi/40"}`,title:L.cwd,"aria-current":I?"true":void 0,children:[p.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:j,boxShadow:"inset 0 0 0 0.5px rgba(0,0,0,0.15)",opacity:L.status==="spawning"?.55:1}}),p.jsx("span",{className:"truncate max-w-[200px]",children:L.label}),L.status==="spawning"&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-butter animate-pulse",title:"spawning"}),x(L.id)&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse",title:"watcher emitted a line in the last 30s","data-testid":"tab-watcher-dot"}),p.jsx("button",{onClick:F=>{F.stopPropagation(),n(L.id)},className:"text-fg-faint opacity-0 group-hover:opacity-100 hover:text-fg ml-1 leading-none",title:"Close session","aria-label":`Close ${L.label}`,children:"×"})]},L.id)})}),p.jsx("span",{className:"w-px self-stretch my-1.5 bg-line"}),p.jsxs("button",{onClick:f,title:"Send feedback","aria-label":"Send feedback","aria-expanded":h,"data-testid":"tabbar-customer-feedback",className:"relative flex items-center px-3.5 py-1.5 mb-1 rounded-full text-[13px] font-mono shrink-0 transition-colors text-fg-dim hover:text-fg hover:bg-bg-hi/40",children:["{F}",m&&p.jsx("span",{className:"absolute top-1 right-1.5 w-1.5 h-1.5 rounded-full bg-accent","data-testid":"customer-feedback-unseen-dot"})]}),p.jsx(dZe,{})]})}function fZe(...s){}function pZe(s){return Promise.reject(new Error("Not available in the web version"))}const gZe=new Set,mZe=new Set;function _Ze(){for(const s of gZe)try{s()}catch{}}function QJ(){for(const s of mZe)try{s()}catch{}}function bZe(s){return s.replace(/```[\s\S]*?```/g,"").replace(/`([^`]+)`/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/\*{1,3}([^*]+)\*{1,3}/g,"$1").replace(/_{1,3}([^_]+)_{1,3}/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/^[-*_]{3,}\s*$/gm,"").replace(/^>\s?/gm,"").replace(/^[\s]*[-*+]\s/gm,"").replace(/^[\s]*\d+\.\s/gm,"").trim()}function vZe(s){if(!window.speechSynthesis)return;const e=bZe(s);if(!e)return;const n=new SpeechSynthesisUtterance(e);n.rate=1,n.pitch=1,n.onstart=()=>{performance.now(),_Ze()},n.onend=()=>{!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&QJ()},n.onerror=i=>{i.error!=="canceled"&&!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&QJ()},window.speechSynthesis.speak(n)}function xZe(){window.speechSynthesis&&(window.speechSynthesis.cancel(),QJ())}function Y3(s,e,n,i,r){var a,l;try{(l=(a=window.api)==null?void 0:a.logs)==null||l.write(s,e,n,i,r)}catch{}const o=e==="error"?console.error:e==="warn"?console.warn:console.log;i!==void 0?o(`[${s}]`,n,i):o(`[${s}]`,n)}const Zn={debug:(s,e,n)=>Y3(s,"debug",e,n),info:(s,e,n)=>Y3(s,"info",e,n),warn:(s,e,n)=>Y3(s,"warn",e,n),error:(s,e,n,i)=>Y3(s,"error",e,n,i)};function m0e(){Jt.getState().submitCountdownStartAt!==null&&Jt.setState({submitCountdownStartAt:null})}let _0e=null;const X3=1e4;let sR=null;function Iq(){sR&&(clearTimeout(sR),sR=null)}let FF=null,BF=null;function Z3(){FF=null,BF&&(BF(),BF=null)}const wZe=1500,yZe=9e4;let ZT=0,HF=null,eQ=-1;function JT(){HF&&(clearTimeout(HF),HF=null,eQ=-1)}const CZe=1800*1e3;let rR=null;function SZe(){rR&&(clearTimeout(rR),rR=null)}const Jt=or((s,e)=>{function n(){SZe(),rR=setTimeout(()=>{if(rR=null,e().isRecording||_0e){n();return}Zn.info("voice","model idle timeout: releasing worker"),JT(),ZT++,s({modelStatus:"idle",loadingProgress:0,error:null,errorKind:null})},CZe)}return{isRecording:!1,externalRecording:!1,ttsEnabled:!1,autoSubmit:!0,submitDelayMs:8e3,submitCountdownStartAt:null,lastTranscript:"",lastPartial:"",statusPill:"idle",partialsEnabled:!0,error:null,errorKind:null,modelStatus:"idle",loadingProgress:0,permissionState:"unknown",lastBargeInAt:null,hotkeyState:"idle",levelMeterEnabled:!0,turnDetectorState:"disabled",turnDetectorMode:"off",wizardArmed:!1,wizardOpen:!1,initModel:()=>{if(e().modelStatus!=="idle")return;Zn.info("voice","initModel: kicking off preload"),s({modelStatus:"loading",error:null,errorKind:null,loadingProgress:0});const i=++ZT,r=()=>{i===ZT&&(JT(),eQ=i,HF=setTimeout(()=>{eQ===i&&e().modelStatus==="loading"&&(Zn.warn("voice","mic.gate.timeout: no progress within 90s"),s({modelStatus:"error",error:"Model load timed out",errorKind:"timeout"}))},yZe))};r(),fZe((o,a)=>{i===ZT&&(o==="ready"?(JT(),Zn.info("voice","modelStatus -> ready"),s({modelStatus:"ready",loadingProgress:100,errorKind:null}),!e().isRecording&&!_0e&&n()):o==="error"?(JT(),Zn.error("voice","modelStatus -> error",{msg:a}),s({modelStatus:"error",error:a,errorKind:"load"})):(r(),s({modelStatus:"loading"})))},o=>{i===ZT&&(r(),s({loadingProgress:Math.round(o)}))})},resetAndRetryModel:()=>{Zn.info("voice","mic.gate.retry"),JT(),s({modelStatus:"idle",error:null,errorKind:null,loadingProgress:0}),e().initModel()},startRecording:(i,r)=>{if(!e().isRecording){s({error:"Microphone or Web Worker not available",errorKind:"recording"});return}},stopRecording:()=>{},restartWithDevice:async()=>{e().isRecording},setExternalRecording:i=>s({externalRecording:i}),toggleTTS:()=>{const i=!e().ttsEnabled;s({ttsEnabled:i}),Promise.resolve().then(()=>{var r,o,a;return(a=(o=(r=window.api)==null?void 0:r.voice)==null?void 0:o.setTtsEnabled)==null?void 0:a.call(o,i)}).catch(r=>{Zn.warn("voice","setTtsEnabled failed",{error:r instanceof Error?r.message:String(r)})})},setAutoSubmit:i=>s({autoSubmit:i}),setSubmitDelayMs:i=>s({submitDelayMs:Math.max(500,Math.min(13e3,Math.floor(i)))}),cancelSubmit:()=>m0e(),setPartialsEnabled:i=>{e().partialsEnabled!==i&&(s({partialsEnabled:i}),i||s({lastPartial:""}))},clearError:()=>s({error:null,errorKind:null}),setPermissionState:i=>{e().permissionState!==i&&(Zn.info("voice","mic.gate.permission_changed",{from:e().permissionState,to:i}),s({permissionState:i}))},setLevelMeterEnabled:i=>{e().levelMeterEnabled!==i&&s({levelMeterEnabled:i})},setTurnDetectorRuntimeState:i=>{e().turnDetectorState!==i&&(s({turnDetectorState:i}),i==="load_failed"?Zn.warn("voice-turn","voice-turn.load_failed"):i==="runtime_error"?Zn.warn("voice-turn","voice-turn.runtime_error"):i==="disabled"&&Zn.info("voice-turn","voice-turn.fallback_to_vad"))},setWizardArmed:i=>{e().wizardArmed!==i&&s({wizardArmed:i})},openWizard:()=>{e().wizardOpen||s({wizardOpen:!0})},closeWizard:()=>{e().wizardOpen&&s({wizardOpen:!1})},armHotkey:({phase:i,source:r,mode:o,tabId:a})=>{const l=e(),{canRecord:c,reason:d}=b8();if(i==="down"){if(d==="error"||d==="load-timeout"){l.resetAndRetryModel(),Zn.info("voice-hotkey","down.retry",{source:r,reason:d});return}if(!c&&d!=="loading"){Zn.warn("voice-hotkey","miss-model-loading",{modelStatus:l.modelStatus,reason:d});return}if(l.hotkeyState==="recording"||l.isRecording){(o==="toggle"||r==="global")&&(s({hotkeyState:"stopping"}),Iq(),sR=setTimeout(()=>{e().hotkeyState==="stopping"&&(Zn.warn("voice-hotkey","drain-timeout",{durationMs:X3}),s({hotkeyState:"aborted"}),setTimeout(()=>{e().hotkeyState==="aborted"&&s({hotkeyState:"idle"})},0))},X3),l.stopRecording());return}if(d==="loading"){l.hotkeyState!=="armed"&&(s({hotkeyState:"armed"}),Zn.info("voice-hotkey","armed",{source:r,modelStatus:l.modelStatus})),Z3(),FF={tabId:a,source:r,mode:o},BF=Jt.subscribe((u,h)=>{if(FF&&u.modelStatus==="ready"&&h.modelStatus!=="ready"&&u.hotkeyState==="armed"){const f=FF;if(Z3(),!f.tabId){Zn.warn("voice-hotkey","armed-promote-no-tab",{source:f.source}),s({hotkeyState:"idle"});return}Zn.info("voice-hotkey","armed-promote",f),s({hotkeyState:"recording"}),Jt.getState().startRecording(f.tabId)}});return}if(!a){Zn.warn("voice-hotkey","no-active-tab",{source:r});return}Zn.info("voice-hotkey","start",{source:r,mode:o,tabId:a}),l.startRecording(a),e().isRecording?s({hotkeyState:"recording"}):(Zn.warn("voice-hotkey","start: recording did not engage",{errorKind:e().errorKind}),s({hotkeyState:"idle"}));return}if(!(o!=="hold"||r==="global")){if(l.hotkeyState==="armed"){Z3(),Zn.info("voice-hotkey","miss-model-loading-armed-up"),s({hotkeyState:"idle"});return}l.hotkeyState==="recording"&&(s({hotkeyState:"stopping"}),Iq(),sR=setTimeout(()=>{e().hotkeyState==="stopping"&&(Zn.warn("voice-hotkey","drain-timeout",{durationMs:X3}),s({hotkeyState:"aborted"}),setTimeout(()=>{e().hotkeyState==="aborted"&&s({hotkeyState:"idle"})},0))},X3),l.stopRecording())}},destroyHotkey:()=>{const i=e();if(Z3(),m0e(),i.hotkeyState==="recording"){Zn.warn("voice-hotkey","destroyed-mid-recording"),s({hotkeyState:"destroyed"});try{i.stopRecording()}catch{}}else(i.hotkeyState==="armed"||i.hotkeyState==="stopping")&&(Iq(),s({hotkeyState:"destroyed"}))}}}),kZe=s=>({isRecording:s.isRecording,statusPill:s.statusPill,lastPartial:s.lastPartial,lastTranscript:s.lastTranscript,submitCountdownStartAt:s.submitCountdownStartAt}),b8=s=>({canRecord:!1,reason:"unsupported"});typeof window<"u"&&Promise.resolve().then(()=>{var s,e,n;return(n=(e=(s=window.api)==null?void 0:s.voice)==null?void 0:e.getTtsEnabled)==null?void 0:n.call(e)}).then(s=>{typeof s=="boolean"&&Jt.setState({ttsEnabled:s})}).catch(s=>{Zn.warn("voice","getTtsEnabled failed",{error:s instanceof Error?s.message:String(s)})});if(typeof window<"u"){const s=window;s.__voice=Jt,s.__transcripts=[]}const GA=6e4,EZe=3e5,LZe=.25,NZe=5e3,qA=or(()=>({data:null,refreshing:!1}));let b0e=!1,WF=null,Rq=GA,J3=!1,r_=null;function DZe(s,e){if(s.kind==="ok")return{delayMs:GA,nextBackoffMs:GA};const n=Math.min(e*2,EZe),i=n*LZe;let r=n+(Math.random()*2-1)*i;const o=s.kind==="meter_rate_limited"?s.retryAfterMs:void 0;return typeof o=="number"&&Number.isFinite(o)&&o>r&&(r=o),{delayMs:r,nextBackoffMs:n}}function v0e(){return rde(window.api.billing.fetch(),NZe,"billing.fetch")}function x0e(s){qA.setState({data:s,refreshing:!1})}async function gde(){qA.setState({refreshing:!0});let s=GA;try{const e=await v0e();r_&&(r_.cancel(),r_=null),x0e(e);const{delayMs:n,nextBackoffMs:i}=DZe(e,Rq);Rq=i,s=n}catch(e){Rq=GA,qA.setState({refreshing:!1});const n=FMe({error:e,retry:v0e,onRetrySuccess:i=>{r_=null,x0e(i)},onStillFailing:i=>{r_=null,J3||(J3=!0,he.warn(`Billing usage fetch: ${i}`))}});if(n)r_=n;else if(!J3){J3=!0;const i=e instanceof Error?e.message:String(e);he.warn(`Billing usage fetch failed: ${i}`)}}WF=setTimeout(gde,s)}function TZe(){b0e||(b0e=!0,gde())}function aPe(s){return s?s.kind==="ok"||s.kind==="ok-stale"?s.data:(s.kind==="auth"||s.kind==="meter_rate_limited")&&s.cached?s.cached:null:null}function IZe(){WF!==null&&(clearTimeout(WF),WF=null),r_&&(r_.cancel(),r_=null),gde()}function bx(s){if(!s||s==="—"||s==="unknown")return s;const e=/\[(\dm)\]/.exec(s),n=/(opus|sonnet|haiku|fable)[-_](\d+)[-_.]?(\d+)?/i.exec(s);if(!n)return s;const i=n[1].charAt(0).toUpperCase()+n[1].slice(1).toLowerCase(),r=n[3]?`${n[2]}.${n[3]}`:n[2];return e?`${i} ${r} ${e[1]}`:`${i} ${r}`}function Lf(s){const e=/(opus|sonnet|haiku|fable)/i.exec(s);return e?e[1].toLowerCase():null}const Q3=new Map,RZe=3e4;function mde(s){const[e,n]=T.useState(()=>{var i;return s?((i=Q3.get(s))==null?void 0:i.value)??null:null});return T.useEffect(()=>{if(!s){n(null);return}let i=!1;return(async()=>{const o=Q3.get(s);if(o&&Date.now()-o.ts<RZe){i||n(o.value);return}try{const a=await window.api.app.gitBranch(s);if(i)return;Q3.set(s,{value:a,ts:Date.now()}),n(a)}catch{if(i)return;Q3.set(s,{value:null,ts:Date.now()}),n(null)}})(),()=>{i=!0}},[s]),e}const AZe="~/.claude/session-manager/ui-chrome-prefs.json",lPe=Yg(AZe),MZe=180,PZe=480,tQ=252,vw={sidebarWidth:tQ,sidebarCollapsed:!1,collapsedGroups:[],learningPanelCollapsed:!1,tourCompletedAt:null,density:"roomy"};function nQ(s){return Math.min(PZe,Math.max(MZe,s))}let Jv=null,$F={};function OZe(s){const e=()=>{const n=s(),i={sidebarWidth:n.sidebarWidth,sidebarCollapsed:n.sidebarCollapsed,collapsedGroups:n.collapsedGroups,learningPanelCollapsed:n.learningPanelCollapsed,tourCompletedAt:n.tourCompletedAt,density:n.density};lPe.patch(i).catch(()=>{})};s().hydrated||!Jv?e():Jv.then(e)}function Ik(s,e,n){s(n),!e().hydrated&&Jv&&Object.assign($F,n),OZe(e)}const Ro=or((s,e)=>({...vw,hydrated:!1,hydrate:()=>e().hydrated?Promise.resolve():Jv||(Jv=(async()=>{try{const n=await lPe.read();if(Object.keys(n).length>0){s({sidebarWidth:typeof n.sidebarWidth=="number"?nQ(n.sidebarWidth):vw.sidebarWidth,sidebarCollapsed:n.sidebarCollapsed??vw.sidebarCollapsed,collapsedGroups:Array.isArray(n.collapsedGroups)?n.collapsedGroups:vw.collapsedGroups,learningPanelCollapsed:n.learningPanelCollapsed??vw.learningPanelCollapsed,tourCompletedAt:typeof n.tourCompletedAt=="number"?n.tourCompletedAt:vw.tourCompletedAt,density:n.density==="compact"?"compact":vw.density,...$F,hydrated:!0});return}}catch{}s({...$F,hydrated:!0})})().finally(()=>{Jv=null,$F={}}),Jv),setSidebarWidth:n=>Ik(s,e,{sidebarWidth:nQ(n)}),setSidebarCollapsed:n=>Ik(s,e,{sidebarCollapsed:n}),setCollapsedGroups:n=>Ik(s,e,{collapsedGroups:n}),setLearningPanelCollapsed:n=>Ik(s,e,{learningPanelCollapsed:n}),setTourCompletedAt:n=>Ik(s,e,{tourCompletedAt:n}),setDensity:n=>Ik(s,e,{density:n})})),jZe=52;function FZe(s){return new Set(s.filter(e=>e==="Workspace"||e==="Claude Code"||e==="Session Manager"))}function BZe(){const s=Ot(n=>{var i;return((i=n.tabs.find(r=>r.id===n.activeTabId))==null?void 0:i.cwd)??null});return{scheduler:tl(n=>{var i;return(((i=n.snapshot)==null?void 0:i.jobs)??[]).some(r=>r.status==="running"&&(!s||r.cwd===s))})}}function HZe({active:s,onNavigate:e,onNewSession:n}){const i=Ro(O=>O.hydrated),r=Ro(O=>O.hydrate);T.useEffect(()=>{i||r()},[i,r]);const o=Ro(O=>O.collapsedGroups),a=Ro(O=>O.setCollapsedGroups),l=T.useMemo(()=>FZe(o),[o]),c=T.useCallback(O=>{const W=new Set(l);W.has(O)?W.delete(O):W.add(O),a(Array.from(W))},[l,a]),d=Ro(O=>O.sidebarCollapsed),u=Ro(O=>O.setSidebarCollapsed),h=T.useCallback(()=>{u(!d)},[d,u]),f=Ot(O=>O.tabs),g=Ot(O=>O.activeTabId),m=f.find(O=>O.id===g)??null,_=BZe(),b=ri(O=>O.navFace),v=FXe(b),x=v.filter(O=>O.group==="Workspace"),w=v.filter(O=>O.group==="Claude Code"),y=v.filter(O=>O.group==="Session Manager"),S=b==="home"&&!d,E=Ro(O=>O.sidebarWidth),L=Ro(O=>O.setSidebarWidth),[D,I]=T.useState(E),A=T.useRef(D);A.current=D,T.useEffect(()=>{I(E)},[E]);const j=T.useCallback(O=>{O.preventDefault();const W=O.clientX,H=A.current;let z=H;const J=M=>{z=nQ(H+(M.clientX-W)),I(z)},q=()=>{window.removeEventListener("pointermove",J),window.removeEventListener("pointerup",q),document.body.style.cursor="",document.body.style.userSelect="",L(z)};window.addEventListener("pointermove",J),window.addEventListener("pointerup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[L]),F=T.useCallback(()=>{I(tQ),L(tQ)},[L]);return p.jsxs("aside",{className:"shrink-0 bg-bg-elev border-r border-line flex flex-col relative transition-[width] duration-150",style:{width:d?jZe:D},"data-testid":"tour-leftnav","aria-label":"Primary navigation",children:[p.jsx(WZe,{tab:m,navFace:b,onNewSession:n,rail:d,onToggleRail:h}),p.jsx("div",{className:"flex-1 min-h-0 overflow-auto pb-3",style:{paddingInline:d?"4px":"8px"},children:S?p.jsxs(p.Fragment,{children:[p.jsx(Aq,{label:"Workspace",desc:Dq.Workspace,collapsed:l.has("Workspace"),count:x.length,onToggle:()=>c("Workspace")}),!l.has("Workspace")&&x.map(O=>p.jsx(e4,{item:O,active:s===O.key,live:O.liveKind?_[O.liveKind]:!1,onClick:()=>e(O.key),rail:!1},O.key)),p.jsx(Aq,{label:"Claude Code",desc:Dq["Claude Code"],collapsed:l.has("Claude Code"),count:w.length,onToggle:()=>c("Claude Code")}),!l.has("Claude Code")&&w.map(O=>p.jsx(e4,{item:O,active:s===O.key,live:!1,onClick:()=>e(O.key),rail:!1},O.key)),p.jsx(Aq,{label:"Session Manager",desc:Dq["Session Manager"],collapsed:l.has("Session Manager"),count:y.length,onToggle:()=>c("Session Manager")}),!l.has("Session Manager")&&y.map(O=>p.jsx(e4,{item:O,active:s===O.key,live:!1,onClick:()=>e(O.key),rail:!1},O.key))]}):p.jsx("div",{className:"pt-2",children:v.map(O=>p.jsx(e4,{item:O,active:s===O.key,live:O.liveKind?_[O.liveKind]:!1,onClick:()=>e(O.key),rail:d},O.key))})}),p.jsx($Ze,{rail:d,navFace:b}),!d&&p.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize · double-click to reset",onPointerDown:j,onDoubleClick:F,className:"absolute top-0 right-0 h-full w-1.5 translate-x-1/2 z-10 cursor-col-resize hover:bg-accent/40 active:bg-accent/60 transition-colors"})]})}function WZe({tab:s,navFace:e,onNewSession:n,rail:i,onToggleRail:r}){const o=(s==null?void 0:s.label)??"no session",a=mde((s==null?void 0:s.cwd)??null);return i?p.jsxs("div",{className:"flex flex-col items-center gap-1.5 pt-2 pb-2 border-b border-rule",children:[p.jsx("button",{onClick:n,"data-testid":"tour-new-session",title:"Open / Start Project",className:"w-9 h-9 rounded-md bg-bg-hi border border-line text-fg hover:bg-bg-hi/80 hover:border-accent/40 transition-colors flex items-center justify-center",children:p.jsx(Ki,{name:"plus",size:15,stroke:1.8})}),p.jsx("button",{onClick:r,title:"Expand sidebar","data-testid":"sidebar-rail-toggle",className:"w-9 h-9 rounded-md text-fg-faint hover:text-fg hover:bg-bg-hi/50 transition-colors flex items-center justify-center",children:p.jsx("span",{style:{display:"inline-flex",transform:"rotate(0deg)"},children:p.jsx(Ki,{name:"chevron",size:15,stroke:1.8})})})]}):e==="home"?p.jsxs("div",{className:"px-[18px] pt-[14px] pb-[10px] border-b border-rule",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"text-[11px] font-semibold tracking-[0.06em] text-fg-faint uppercase",children:"Session Manager"}),p.jsx("button",{onClick:r,title:"Collapse sidebar","data-testid":"sidebar-rail-toggle",className:"w-6 h-6 rounded-md text-fg-faint hover:text-fg hover:bg-bg-hi/50 transition-colors flex items-center justify-center",children:p.jsx("span",{style:{display:"inline-flex",transform:"rotate(180deg)"},children:p.jsx(Ki,{name:"chevron",size:13,stroke:1.8})})})]}),p.jsx("div",{className:"mt-3 flex items-stretch gap-1.5",children:p.jsxs("button",{onClick:n,"data-testid":"tour-new-session",className:"flex-1 px-3 py-1.5 rounded-md bg-bg-hi border border-line text-fg text-[12.5px] font-medium hover:bg-bg-hi/80 hover:border-accent/40 transition-colors flex items-center justify-center gap-1.5",children:[p.jsx(Ki,{name:"plus",size:13,stroke:1.8}),"Open / Start Project"]})})]}):p.jsxs("div",{className:"px-[18px] pt-[14px] pb-[10px] border-b border-rule",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"text-[11px] font-semibold tracking-[0.06em] text-fg-faint uppercase",children:"Project"}),p.jsx("button",{onClick:r,title:"Collapse sidebar","data-testid":"sidebar-rail-toggle",className:"w-6 h-6 rounded-md text-fg-faint hover:text-fg hover:bg-bg-hi/50 transition-colors flex items-center justify-center",children:p.jsx("span",{style:{display:"inline-flex",transform:"rotate(180deg)"},children:p.jsx(Ki,{name:"chevron",size:13,stroke:1.8})})})]}),p.jsxs("div",{className:"flex items-baseline gap-2 mt-1",children:[p.jsx("span",{className:"self-center w-2 h-2 rounded-full bg-sage"}),p.jsx("span",{className:"font-serif text-[18px] font-medium text-fg truncate",title:(s==null?void 0:s.cwd)??"",children:o})]}),p.jsx("div",{className:"text-[12px] text-fg-faint font-mono mt-0.5 truncate",children:a?`⌥${a}`:s?s.cwd:"—"}),p.jsx("div",{className:"mt-3 flex items-stretch gap-1.5",children:p.jsxs("button",{onClick:n,"data-testid":"tour-new-session",className:"flex-1 px-3 py-1.5 rounded-md bg-bg-hi border border-line text-fg text-[12.5px] font-medium hover:bg-bg-hi/80 hover:border-accent/40 transition-colors flex items-center justify-center gap-1.5",children:[p.jsx(Ki,{name:"plus",size:13,stroke:1.8}),"Open / Start Project"]})})]})}function Aq({label:s,desc:e,collapsed:n,count:i,onToggle:r}){return p.jsxs("div",{className:"px-3 pt-3.5 pb-1.5",children:[p.jsxs("button",{onClick:r,"aria-expanded":!n,title:n?`Expand ${s}`:`Collapse ${s}`,className:"group w-full flex items-center gap-1.5 font-serif italic text-[11px] font-bold tracking-[0.07em] uppercase text-fg-faint hover:text-fg-dim transition-colors text-left",children:[p.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 text-[9px] not-italic transition-transform",style:{transform:n?"rotate(-90deg)":"rotate(0deg)"},children:"▾"}),p.jsx("span",{className:"flex-1",children:s}),n&&p.jsx("span",{className:"not-italic text-[10px] font-mono text-fg-faint/70 normal-case tracking-normal",children:i})]}),!n&&p.jsx("p",{className:"mt-0.5 pl-3.5 text-[11px] leading-[1.35] text-fg-faint/80 normal-case tracking-normal font-sans not-italic line-clamp-2",children:e})]})}function e4({item:s,active:e,live:n,onClick:i,rail:r}){return p.jsxs("button",{onClick:i,title:s.hint,"data-testid":s.key==="scheduler"?"tour-scheduler":s.key==="terminal"?"tour-sessions":void 0,className:`relative w-full flex items-center rounded-[10px] text-left mb-0.5 transition-colors ${r?"justify-center px-0 py-[9px]":"gap-3 px-3.5 py-[9px] text-[14px]"} ${e?"bg-bg-hi text-fg font-semibold border border-line":"text-fg-dim hover:bg-bg-hi/50 hover:text-fg border border-transparent"}`,children:[e&&p.jsx("span",{"aria-hidden":!0,className:`absolute top-2 bottom-2 w-[3px] rounded-sm bg-accent ${r?"-left-[4px]":"-left-[10px]"}`}),p.jsx("span",{className:`inline-flex ${e?"text-accent":"text-fg-faint"}`,children:p.jsx(Ki,{name:s.icon,size:17,stroke:1.6})}),!r&&p.jsxs("span",{className:"flex-1 min-w-0",children:[p.jsx("span",{className:"block truncate",children:s.label}),s.hint&&p.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 font-normal truncate",children:s.hint})]}),!r&&n&&p.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-accent animate-pulse",title:"live activity"}),r&&n&&p.jsx("span",{className:"absolute top-1.5 right-1.5 w-1.5 h-1.5 rounded-full bg-accent animate-pulse",title:"live activity"})]})}function $Ze({rail:s,navFace:e}){const n=Jt(c=>c.isRecording),i=Ot(c=>c.tabs),r=Ot(c=>c.activeTabId),o=i.find(c=>c.id===r)??null,[a,l]=T.useState(null);return T.useEffect(()=>{let c=!1;if(!(o!=null&&o.presetId)){l(null);return}return MMe(o.presetId).then(d=>{c||l((d==null?void 0:d.model)??null)}).catch(()=>{c||l(null)}),()=>{c=!0}},[o==null?void 0:o.presetId]),s?p.jsx("div",{className:"py-2.5 border-t border-rule flex justify-center",children:p.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${n?"bg-red-500 animate-pulse":"bg-sage"}`,title:n?"recording":"idle"})}):p.jsxs("div",{className:"px-3.5 py-2.5 border-t border-rule flex items-center gap-2 text-[11.5px] text-fg-dim font-mono",children:[p.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${n?"bg-red-500 animate-pulse":"bg-sage"}`,title:n?"recording":"idle"}),(n||e==="project")&&p.jsx("span",{className:"truncate",title:a??"",children:n?"recording…":a?`Claude · ${bx(a)}`:"Claude Code"})]})}function VZe(s,e,n){return e?s.map(i=>i.id===e?{...i,lastActivityAt:n}:i):s}function zZe(s,e,n){return{tabId:s,sessionUuid:n,cwd:e,path:null,todos:[],lastToolUses:[],plans:[],agents:[],usage:{inputTokens:0,outputTokens:0},lastEventAt:0,activityRing:[],activitySeq:0}}function UZe(s,e,n){const i=Date.now(),r={...s,lastEventAt:n!=null&&n.replay?s.lastEventAt:i},o=[],a=(l,c)=>l.length>c?l.slice(0,c-1)+"…":l;switch(e.kind){case"todo_write":{const l=Array.isArray(e.data)?e.data:[];r.todos=l,n!=null&&n.replay||o.push({id:0,kind:"todo-update",at:i,label:`Todos · ${l.length} item${l.length!==1?"s":""}`});break}case"tool_use":{const l=e.data,c=l.input,d={};for(const u of["command","file_path","pattern","url","query","subagent_type","description"])c&&u in c&&(d[u]=c[u]);if(r.lastToolUses=[{id:l.id,name:l.name,input:d,at:i},...s.lastToolUses].slice(0,50),!(n!=null&&n.replay)){const u=l.input,h=["Edit","Write","NotebookEdit"].includes(l.name),f=typeof(u==null?void 0:u.file_path)=="string"?u.file_path:void 0,g=typeof(u==null?void 0:u.command)=="string"?u.command:void 0,m=f?f.split("/").pop()??f:g?a(g,28):"";o.push({id:0,kind:"tool-use",at:i,label:m?`${l.name} · ${m}`:l.name,target:f??g,toolName:l.name}),h&&f&&o.push({id:0,kind:"file-edit",at:i,label:`${l.name} · ${a(f.split("/").pop()??f,34)}`,target:f,toolName:l.name})}break}case"plan":{const l=e.data,c=typeof l=="string"?l:(l==null?void 0:l.plan)??JSON.stringify(l);r.plans=[{at:i,content:c??""},...s.plans].slice(0,50),n!=null&&n.replay||o.push({id:0,kind:"plan-revision",at:i,label:"Plan revised"});break}case"agent_spawn":{const l=e.data;r.agents=[{id:l==null?void 0:l.toolUseId,at:i,subagentType:l==null?void 0:l.subagent_type,description:l==null?void 0:l.description,lastActivityAt:i},...s.agents].slice(0,50),n!=null&&n.replay||o.push({id:0,kind:"agent-spawn",at:i,label:l!=null&&l.subagent_type?`Agent: ${a(l.subagent_type,32)}`:"Agent spawned"});break}case"usage":{const l=e.data,c=(s.usage.inputTokens||0)+(s.usage.outputTokens||0),d=l.input_tokens??l.inputTokens??0,u=l.output_tokens??l.outputTokens??0,h=c+d+u;r.usage={inputTokens:(s.usage.inputTokens||0)+d,outputTokens:(s.usage.outputTokens||0)+u,cacheCreationInputTokens:(s.usage.cacheCreationInputTokens||0)+(l.cache_creation_input_tokens??l.cacheCreationInputTokens??0),cacheReadInputTokens:(s.usage.cacheReadInputTokens||0)+(l.cache_read_input_tokens??l.cacheReadInputTokens??0)},!(n!=null&&n.replay)&&Math.floor(h/1e3)>Math.floor(c/1e3)&&o.push({id:0,kind:"usage-tick",at:i,label:`${Math.floor(h/1e3)}k tokens`});break}case"tool_result":{const l=e.data;r.agents=VZe(s.agents,l==null?void 0:l.toolUseId,i);break}}return{next:r,newActivity:o}}const VF=or((s,e)=>({tabs:{},refs:{},unsubs:{},subscribe:(n,i,r)=>{const o={...e().refs};if(o[n]=(o[n]??0)+1,s({refs:o}),o[n]>1)return;s({tabs:{...e().tabs,[n]:zZe(n,i,r)}});const a=window.api.transcripts.onEvent(n,l=>e().ingestBatch(n,l));s({unsubs:{...e().unsubs,[n]:a}}),window.api.transcripts.subscribe({tabId:n,cwd:i,sessionUuid:r}).then(async l=>{const c=e().tabs[n];if(!c)return;if(!l.ok){const{toast:u}=await In(async()=>{const{toast:h}=await Promise.resolve().then(()=>OMe);return{toast:h}},void 0,import.meta.url);u.error(`Live view unavailable: ${l.error??"subscribe failed"}`),s({tabs:{...e().tabs,[n]:{...c,path:null}}});return}s({tabs:{...e().tabs,[n]:{...c,path:l.path}}});const d=await window.api.transcripts.buffer(n);e().ingestBatch(n,d,{replay:!0})}).catch(l=>console.error("[live] transcripts.subscribe failed:",n,l))},unsubscribe:n=>{const i={...e().refs};if(!i[n])return;if(i[n]--,i[n]>0){s({refs:i});return}delete i[n];const r=e().unsubs[n];r==null||r();const o={...e().unsubs};delete o[n];const a={...e().tabs};delete a[n],window.api.transcripts.unsubscribe(n),s({refs:i,unsubs:o,tabs:a})},ingest:(n,i,r)=>{e().ingestBatch(n,[i],r)},ingestBatch:(n,i,r)=>{const o=e().tabs[n];if(!o||i.length===0)return;let a=o,l=[];for(const c of i){const{next:d,newActivity:u}=UZe(a,c,r);a=d,l=l.concat(u)}if(l.length>0){let c=o.activitySeq;const d=l.map(u=>({...u,id:++c}));a={...a,activitySeq:c,activityRing:[...o.activityRing,...d].slice(-32)}}s({tabs:{...e().tabs,[n]:a}})}}));function GZe(s){const e=VF(r=>r.subscribe),n=VF(r=>r.unsubscribe),i=VF(r=>s?r.tabs[s.id]:void 0);return T.useEffect(()=>{if(s)return e(s.id,s.cwd,s.sessionId),()=>n(s.id)},[s==null?void 0:s.id,s==null?void 0:s.cwd,s==null?void 0:s.sessionId,e,n]),i}function cPe(s){if(!s)return null;const e=new Date(s);if(Number.isNaN(e.getTime()))return null;const n=e.getTime()-Date.now();if(n<=0)return{rel:"now",abs:""};const i=Math.floor(n/864e5),r=Math.floor(n%864e5/36e5),o=Math.floor(n%36e5/6e4),a=i>0?`${i}d ${r}h`:r>0?`${r}h ${o}m`:`${o}m`,l=i>=1?e.toLocaleString("en-US",{timeZone:"America/Los_Angeles",weekday:"short",hour:"numeric",minute:"2-digit"}):e.toLocaleTimeString("en-US",{timeZone:"America/Los_Angeles",hour:"numeric",minute:"2-digit"});return{rel:a,abs:`${l} PT`}}function iQ(s){return!s||typeof s.utilization!="number"||Number.isNaN(s.utilization)?null:Math.round(s.utilization)}function w0e(s,e){const n=iQ(e);if(n==null)return`${s} — usage unavailable`;const i=cPe((e==null?void 0:e.resets_at)??null),r=i?` · resets in ${i.rel}${i.abs?` (${i.abs})`:""}`:"";return`${s} · ${n}% used${r} — click to open Home`}function qZe(s,e){return s?s==="session"||s==="five_hour"?"Session · 5h":s==="weekly_all"?"Weekly · all models":s==="weekly_scoped"?"Weekly · scoped":s:null}const dPe=T.createContext(null);function KZe({panelId:s,children:e}){return p.jsx(dPe.Provider,{value:s,children:e})}function IS(s){const e=T.useContext(dPe),n=s??e;return ri(i=>n==null||i.focusedPanelId===n)}function _de(s){const e=IS(s),n=T.useRef(e);return n.current=e,n}const YZe=5e3;let cy=null;const sQ=new Set;let Mq=0,oR=null;function XZe(){sQ.forEach(s=>s())}async function v8(){try{cy=await window.api.schedule.sessionSlots(),XZe()}catch{}}const ZZe=0,JZe=10;async function QZe(s){cy||await v8();const e=cy?cy.min:ZZe,n=cy?cy.max:JZe,i=Math.min(n,Math.max(e,Math.round(s)));await window.api.schedule.setSessionSlots(i),await v8()}function eJe(){oR==null&&(v8(),oR=setInterval(()=>{v8()},YZe))}function tJe(){oR!=null&&(clearInterval(oR),oR=null)}function LO(s){const e=IS(s),[,n]=T.useState(0);return T.useEffect(()=>{const i=()=>n(r=>r+1);return sQ.add(i),()=>{sQ.delete(i)}},[]),T.useEffect(()=>{if(e)return Mq+=1,eJe(),()=>{Mq-=1,Mq<=0&&tJe()}},[e]),cy}let vE=null;const rQ=new Set;let Pq=0,zF=null,oQ=!1;const nJe=360*60*1e3;let UF=null;function y0e(s){vE=s.check||!(vE!=null&&vE.check)?s:{...s,check:vE.check},rQ.forEach(e=>e())}function iJe(){if(oQ)return;oQ=!0,zF=window.api.updater.onStatus(y0e);const s=()=>{window.api.updater.status().then(y0e).catch(()=>{})};s(),UF=setInterval(s,nJe)}function sJe(){oQ=!1,UF!=null&&(clearInterval(UF),UF=null),zF&&(zF(),zF=null)}function uPe(){const[,s]=T.useState(0);return T.useEffect(()=>{const e=()=>s(n=>n+1);return rQ.add(e),Pq+=1,iJe(),()=>{rQ.delete(e),Pq-=1,Pq<=0&&sJe()}},[]),vE}function hPe({total:s,inUse:e,size:n}){const i=Math.min(Math.max(e,0),s),r=n==="md"?"w-3.5 h-3.5 rounded-full border":"w-2 h-2 rounded-full border";return p.jsx(p.Fragment,{children:Array.from({length:s},(o,a)=>p.jsx("span",{"data-testid":"slot-dot","data-filled":a<i?"true":"false",className:`${r} ${a<i?"bg-accent border-accent":"bg-bg border-line"}`},a))})}function rJe({onNavigate:s}){const e=Ot(H=>H.tabs),n=Ot(H=>H.activeTabId),i=e.find(H=>H.id===n)??null,r=GZe(i),o=(r==null?void 0:r.lastEventAt)??0,a=qA(H=>H.data),l=tl(H=>{var z;return((z=H.snapshot)==null?void 0:z.paused)??null}),c=mde((i==null?void 0:i.cwd)??null),d=LO(),u=uPe(),h=(u==null?void 0:u.check)??null,f=Bs(H=>H.show),[,g]=T.useState(0);T.useEffect(()=>{const H=setInterval(()=>g(z=>z+1),6e4);return()=>clearInterval(H)},[]);const m=async()=>{const H=(u==null?void 0:u.latest)??"";try{const z=await window.api.updater.install(!1),J=(z==null?void 0:z.status)??await window.api.updater.status();(J==null?void 0:J.state)==="deferred"&&f("info",`Update v${H} will install when ${J.busyReason??"running jobs"} finish`)}catch(z){f("error",z instanceof Error?z.message:String(z))}},_=(r==null?void 0:r.todos)??[],[b,v]=T.useState(!1),x=T.useRef(null);T.useEffect(()=>{if(!b)return;const H=z=>{x.current&&!x.current.contains(z.target)&&v(!1)};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[b]),T.useEffect(()=>{_.length===0&&v(!1)},[_.length]);const w=aPe(a),y=(w==null?void 0:w.usage.five_hour)??null,S=(w==null?void 0:w.usage.seven_day)??null,E=iQ(y),L=iQ(S),D=(a==null?void 0:a.kind)==="ok"||(a==null?void 0:a.kind)==="ok-stale",I=o>0?lJe(Date.now()-o):"—",A=(d==null?void 0:d.total)??5,j=d?Math.min(Math.max(d.inUse,0),d.total):0,F=d?`${j} / ${A}`:`— / ${A}`,O=d&&d.holders.length>0?`
78
78
  `+d.holders.slice(0,5).map(H=>H.owner).join(`
79
- `):"",W=`${F} Claude sessions running${O}`;return p.jsxs("div",{className:"h-[30px] shrink-0 bg-bg-elev border-t border-line flex items-center gap-4 px-[18px] font-mono text-[11.5px] text-fg-dim","data-testid":"tour-statusbar",children:[p.jsxs("button",{onClick:()=>s==null?void 0:s("settings"),className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:D?"Connected to Anthropic":"Disconnected",children:[p.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${D?"bg-sage":"bg-fg-faint"}`}),p.jsx("span",{children:D?"connected":"offline"})]}),p.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:w0e("Session (5h window)",y),"data-testid":"footer-usage-session",children:["session ",p.jsx("span",{className:"text-fg",children:E!=null?`${E}%`:"—"})]}),p.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:w0e("Weekly window (all models)",S),"data-testid":"footer-usage-weekly",children:["weekly ",p.jsx("span",{className:"text-fg",children:L!=null?`${L}%`:"—"})]}),l&&p.jsxs("button",{onClick:()=>s==null?void 0:s("scheduler"),title:"Scheduler is paused — click to open Scheduler",className:`flex items-center gap-1 px-1.5 py-0.5 rounded border font-mono text-[10.5px] transition-colors ${l.reason==="auth"||l.reason==="network"?"border-red-700/60 text-red-300 hover:bg-red-900/20":"border-amber-700/60 text-amber-300 hover:bg-amber-900/20"}`,children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current opacity-80"}),"Scheduler paused · ",l.reason]}),i&&p.jsxs("span",{className:"text-fg-faint",title:i.cwd,children:[i.label,c&&p.jsxs("span",{className:"text-fg-dim",children:[" · ⌥",c]})]}),p.jsxs("span",{className:"text-fg-faint",children:["last activity: ",p.jsx("span",{className:"text-fg-dim",children:I})]}),_.length>0&&p.jsx(oJe,{ref:x,todos:_,open:b,onToggle:()=>v(H=>!H)}),p.jsx("span",{className:"flex-1"}),p.jsx("button",{onClick:()=>s==null?void 0:s("overview"),className:"flex items-center gap-1 hover:text-fg transition-colors",title:W,"data-testid":"footer-active-sessions",children:d&&d.total===0?p.jsx("span",{className:"text-fg-faint",children:"pool paused"}):p.jsx(hPe,{total:A,inUse:(d==null?void 0:d.inUse)??0,size:"sm"})}),(u==null?void 0:u.state)==="ready"?p.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:"A new version is downloaded. Click to restart and install — running jobs are waited for first.","data-testid":"footer-version",onClick:()=>{m()},children:["Update ready — restart to install v",u.latest]}):(u==null?void 0:u.state)==="deferred"?p.jsxs("span",{className:"text-amber-300",title:`Waiting for ${u.busyReason??"running jobs"} to finish before restarting`,"data-testid":"footer-version",children:["v",u.latest," installs when idle"]}):(u==null?void 0:u.state)==="downloading"?p.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["Downloading v",u.latest,"…"]}):h!=null&&h.behind&&h.latest&&h.channel==="installer"?p.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:`v${h.current} → v${h.latest}`,"data-testid":"footer-version",onClick:()=>{const H=h.downloadUrl;H&&window.api.shell.open({as:"external",url:H}).catch(()=>{f("error",`Couldn't open URL: ${H}`)})},children:["Download v",h.latest]}):h!=null&&h.behind&&h.latest?p.jsxs("span",{className:"text-amber-300",title:"A newer version is published — update the app. A stale npx cache can pin an old version.","data-testid":"footer-version",children:["v",h.current," → v",h.latest]}):p.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["v",(h==null?void 0:h.current)??"0.136.1"]})]})}const oJe=T.forwardRef(function({todos:e,open:n,onToggle:i},r){const o={completed:e.filter(a=>a.status==="completed").length,in_progress:e.filter(a=>a.status==="in_progress").length,pending:e.filter(a=>a.status==="pending").length};return p.jsxs("div",{ref:r,className:"relative",children:[p.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:"Live to-dos for this session","data-testid":"footer-todos",children:[p.jsxs("span",{className:"text-green-400",children:["✓",o.completed]}),p.jsxs("span",{className:"text-accent",children:["●",o.in_progress]}),p.jsxs("span",{className:"text-fg-dim",children:["○",o.pending]}),p.jsxs("span",{className:"text-fg-faint",children:["todos ",n?"▾":"▴"]})]}),n&&p.jsx("div",{className:`absolute bottom-full left-0 mb-1.5 w-80 max-h-72 overflow-auto bg-bg-elev border border-line rounded shadow-xl p-2 ${Mi.dialog}`,"data-testid":"footer-todos-popover",children:p.jsx("ul",{className:"space-y-0.5",children:e.map((a,l)=>p.jsxs("li",{className:`flex items-start gap-2 py-1 px-1.5 rounded ${a.status==="in_progress"?"bg-bg-hi":""}`,children:[p.jsx(aJe,{status:a.status}),p.jsx("span",{className:a.status==="completed"?"text-fg-faint line-through":a.status==="in_progress"?"text-fg":"text-fg-dim",children:a.status==="in_progress"&&a.activeForm?a.activeForm:a.content})]},l))})})]})});function aJe({status:s}){return s==="completed"?p.jsx("span",{className:"text-green-400 w-3 shrink-0",children:"✓"}):s==="in_progress"?p.jsx("span",{className:"w-3 shrink-0",children:p.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-accent animate-pulse"})}):p.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:"○"})}function lJe(s){const e=Math.max(0,Math.floor(s/1e3));if(e<60)return`${e}s ago`;const n=Math.floor(e/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}function cJe({onClose:s,onSent:e}){const n=Ot(L=>L.tabs),[i,r]=T.useState(""),[o,a]=T.useState(()=>Object.fromEntries(n.map(L=>[L.id,!0]))),[l,c]=T.useState(!1),[d,u]=T.useState({}),h=T.useRef(null),f=T.useRef(e);T.useEffect(()=>{f.current=e},[e]),T.useEffect(()=>{a(L=>{const D={};for(const I of n)D[I.id]=L[I.id]??!0;return D})},[n]),T.useEffect(()=>{var L;(L=h.current)==null||L.focus()},[]),T.useEffect(()=>window.api.pty.onWriteError(D=>{u(I=>D.tabId in I?{...I,[D.tabId]:"skipped"}:I)}),[]),T.useEffect(()=>{if(Object.keys(d).length===0)return;const L=Object.values(d).filter(I=>I==="sent").length,D=window.setTimeout(()=>f.current(L),1500);return()=>window.clearTimeout(D)},[d]);const g=n.filter(L=>o[L.id]).map(L=>L.id),m=g.length,_=Object.keys(d).length>0,b=i.length>0&&m>0&&!l&&!_,v=()=>{if(!b)return;c(!0);const L=Ot.getState().tabs,D=new Set(L.map(A=>A.id)),I={};for(const A of g)D.has(A)?(window.api.pty.write({tabId:A,data:i+"\r"}),I[A]="sent"):I[A]="skipped";u(I),c(!1)},x=L=>{if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),s();return}L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),v())},w=n.length>0&&n.every(L=>o[L.id]),y=()=>{const L=!w;a(Object.fromEntries(n.map(D=>[D.id,L])))},S=Object.values(d).some(L=>L==="skipped"),E=_?S?"Sent (some skipped)":"Sent":`Send to ${m} tab${m===1?"":"s"}`;return p.jsxs("div",{className:"border-b border-line bg-bg-elev px-4 py-3 flex flex-col gap-2 shrink-0",onKeyDown:x,"data-testid":"broadcast-bar",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"text-xs text-fg-dim uppercase tracking-wider",children:"Broadcast"}),p.jsx("div",{className:"text-[10px] text-fg-faint",children:"Esc to close · Cmd/Ctrl+Enter to send"})]}),p.jsx("textarea",{ref:h,value:i,onChange:L=>r(L.target.value),rows:3,placeholder:"Prompt to broadcast…",className:"w-full bg-bg border border-line rounded px-2 py-1.5 text-xs text-fg font-mono resize-y focus:outline-none focus:border-fg-faint"}),p.jsxs("div",{className:"flex flex-col gap-1",children:[p.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-fg-dim cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:w,onChange:y,className:"accent-accent"}),p.jsxs("span",{children:["All tabs (",m,"/",n.length,")"]})]}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 max-h-24 overflow-y-auto pl-4",children:n.map(L=>p.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-fg-dim cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:!!o[L.id],onChange:D=>a(I=>({...I,[L.id]:D.target.checked})),className:"accent-accent"}),p.jsx("span",{className:"truncate max-w-[12rem]",children:L.label}),d[L.id]==="sent"&&p.jsx("span",{"data-testid":"broadcast-row-sent",className:"text-[10px] text-green-500",children:"✓"}),d[L.id]==="skipped"&&p.jsx("span",{"data-testid":"broadcast-row-skipped",className:"text-[10px] text-red-400",children:"×"})]},L.id))})]}),p.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[p.jsx("button",{onClick:s,className:"px-2 py-0.5 text-[10px] text-fg-faint hover:text-fg border border-line hover:border-fg-faint rounded transition-colors",children:"Cancel"}),p.jsx("button",{onClick:v,disabled:!b,className:"px-2 py-0.5 text-[10px] text-fg border border-accent-muted hover:border-accent rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:E})]})]})}function dJe({tabId:s,cwd:e,onClose:n}){const i=iR(m=>m.watchersForTab(s)),r=iR(m=>m.add),o=iR(m=>m.remove),a=T.useRef(null),[l,c]=T.useState(""),[d,u]=T.useState(""),[h,f]=T.useState(!1);T.useEffect(()=>{const m=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),T.useEffect(()=>{const m=_=>{a.current&&!a.current.contains(_.target)&&n()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[n]);const g=async()=>{const m=d.trim();if(!m||h)return;f(!0);const _=await r({tabId:s,label:l.trim(),command:m,cwd:e});f(!1),_&&(c(""),u(""))};return p.jsxs("div",{ref:a,className:"absolute right-2 top-full mt-1 z-30 w-[420px] max-w-[calc(100vw-1rem)] bg-bg-elev border border-line rounded shadow-lg p-3 text-xs",role:"dialog","aria-label":"Watchers","data-testid":"watchers-popover",children:[p.jsxs("div",{className:"flex items-center mb-2",children:[p.jsx("span",{className:"text-fg-dim uppercase tracking-wider",children:"Watchers"}),p.jsxs("span",{className:"text-fg-faint ml-2",children:[i.length," active"]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:n,className:"text-fg-faint hover:text-fg",title:"Close",children:"×"})]}),p.jsxs("div",{className:"flex flex-col gap-1.5 mb-3",children:[p.jsx("input",{value:l,onChange:m=>c(m.target.value),placeholder:"label (optional)",className:"bg-bg border border-line rounded px-2 py-1 text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint"}),p.jsxs("div",{className:"flex gap-1.5",children:[p.jsx("input",{value:d,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&g()},placeholder:"shell command — e.g. npm test --watch",className:"flex-1 bg-bg border border-line rounded px-2 py-1 text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint font-mono","data-testid":"watcher-command-input"}),p.jsx("button",{onClick:g,disabled:!d.trim()||h,className:"px-2 py-1 border border-line rounded text-fg-dim hover:text-fg hover:border-fg-faint disabled:opacity-40 disabled:cursor-not-allowed","data-testid":"watcher-add",children:"Add"})]}),p.jsxs("span",{className:"text-fg-faint",children:["cwd: ",p.jsx("span",{className:"font-mono",children:e})]})]}),i.length===0?p.jsx("div",{className:"text-fg-faint italic py-2",children:"no watchers — add one above"}):p.jsx("ul",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto",children:i.map(m=>{const _=m.lines[m.lines.length-1];return p.jsxs("li",{className:"border border-line rounded p-2 bg-bg",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-medium text-fg truncate",children:m.label}),p.jsxs("span",{className:"text-fg-faint",children:[m.lineCount," line",m.lineCount===1?"":"s"]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:()=>o(m.watcherId),className:"text-fg-faint hover:text-red-400",title:"Stop watcher","data-testid":`watcher-remove-${m.watcherId}`,children:"stop"})]}),p.jsx("div",{className:"text-fg-faint font-mono text-[10px] truncate mt-0.5",title:m.command,children:m.command}),p.jsx("div",{className:"text-fg-dim font-mono text-[10px] truncate mt-1",title:(_==null?void 0:_.line)??"",children:_?_.line:p.jsx("span",{className:"italic text-fg-faint",children:"waiting for output…"})})]},m.watcherId)})})]})}/**
79
+ `):"",W=`${F} Claude sessions running${O}`;return p.jsxs("div",{className:"h-[30px] shrink-0 bg-bg-elev border-t border-line flex items-center gap-4 px-[18px] font-mono text-[11.5px] text-fg-dim","data-testid":"tour-statusbar",children:[p.jsxs("button",{onClick:()=>s==null?void 0:s("settings"),className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:D?"Connected to Anthropic":"Disconnected",children:[p.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${D?"bg-sage":"bg-fg-faint"}`}),p.jsx("span",{children:D?"connected":"offline"})]}),p.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:w0e("Session (5h window)",y),"data-testid":"footer-usage-session",children:["session ",p.jsx("span",{className:"text-fg",children:E!=null?`${E}%`:"—"})]}),p.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:w0e("Weekly window (all models)",S),"data-testid":"footer-usage-weekly",children:["weekly ",p.jsx("span",{className:"text-fg",children:L!=null?`${L}%`:"—"})]}),l&&p.jsxs("button",{onClick:()=>s==null?void 0:s("scheduler"),title:"Scheduler is paused — click to open Scheduler",className:`flex items-center gap-1 px-1.5 py-0.5 rounded border font-mono text-[10.5px] transition-colors ${l.reason==="auth"||l.reason==="network"?"border-red-700/60 text-red-300 hover:bg-red-900/20":"border-amber-700/60 text-amber-300 hover:bg-amber-900/20"}`,children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current opacity-80"}),"Scheduler paused · ",l.reason]}),i&&p.jsxs("span",{className:"text-fg-faint",title:i.cwd,children:[i.label,c&&p.jsxs("span",{className:"text-fg-dim",children:[" · ⌥",c]})]}),p.jsxs("span",{className:"text-fg-faint",children:["last activity: ",p.jsx("span",{className:"text-fg-dim",children:I})]}),_.length>0&&p.jsx(oJe,{ref:x,todos:_,open:b,onToggle:()=>v(H=>!H)}),p.jsx("span",{className:"flex-1"}),p.jsx("button",{onClick:()=>s==null?void 0:s("overview"),className:"flex items-center gap-1 hover:text-fg transition-colors",title:W,"data-testid":"footer-active-sessions",children:d&&d.total===0?p.jsx("span",{className:"text-fg-faint",children:"pool paused"}):p.jsx(hPe,{total:A,inUse:(d==null?void 0:d.inUse)??0,size:"sm"})}),(u==null?void 0:u.state)==="ready"?p.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:"A new version is downloaded. Click to restart and install — running jobs are waited for first.","data-testid":"footer-version",onClick:()=>{m()},children:["Update ready — restart to install v",u.latest]}):(u==null?void 0:u.state)==="deferred"?p.jsxs("span",{className:"text-amber-300",title:`Waiting for ${u.busyReason??"running jobs"} to finish before restarting`,"data-testid":"footer-version",children:["v",u.latest," installs when idle"]}):(u==null?void 0:u.state)==="downloading"?p.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["Downloading v",u.latest,"…"]}):h!=null&&h.behind&&h.latest&&h.channel==="installer"?p.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:`v${h.current} → v${h.latest}`,"data-testid":"footer-version",onClick:()=>{const H=h.downloadUrl;H&&window.api.shell.open({as:"external",url:H}).catch(()=>{f("error",`Couldn't open URL: ${H}`)})},children:["Download v",h.latest]}):h!=null&&h.behind&&h.latest?p.jsxs("span",{className:"text-amber-300",title:"A newer version is published — update the app. A stale npx cache can pin an old version.","data-testid":"footer-version",children:["v",h.current," → v",h.latest]}):p.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["v",(h==null?void 0:h.current)??"0.136.2"]})]})}const oJe=T.forwardRef(function({todos:e,open:n,onToggle:i},r){const o={completed:e.filter(a=>a.status==="completed").length,in_progress:e.filter(a=>a.status==="in_progress").length,pending:e.filter(a=>a.status==="pending").length};return p.jsxs("div",{ref:r,className:"relative",children:[p.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:"Live to-dos for this session","data-testid":"footer-todos",children:[p.jsxs("span",{className:"text-green-400",children:["✓",o.completed]}),p.jsxs("span",{className:"text-accent",children:["●",o.in_progress]}),p.jsxs("span",{className:"text-fg-dim",children:["○",o.pending]}),p.jsxs("span",{className:"text-fg-faint",children:["todos ",n?"▾":"▴"]})]}),n&&p.jsx("div",{className:`absolute bottom-full left-0 mb-1.5 w-80 max-h-72 overflow-auto bg-bg-elev border border-line rounded shadow-xl p-2 ${Mi.dialog}`,"data-testid":"footer-todos-popover",children:p.jsx("ul",{className:"space-y-0.5",children:e.map((a,l)=>p.jsxs("li",{className:`flex items-start gap-2 py-1 px-1.5 rounded ${a.status==="in_progress"?"bg-bg-hi":""}`,children:[p.jsx(aJe,{status:a.status}),p.jsx("span",{className:a.status==="completed"?"text-fg-faint line-through":a.status==="in_progress"?"text-fg":"text-fg-dim",children:a.status==="in_progress"&&a.activeForm?a.activeForm:a.content})]},l))})})]})});function aJe({status:s}){return s==="completed"?p.jsx("span",{className:"text-green-400 w-3 shrink-0",children:"✓"}):s==="in_progress"?p.jsx("span",{className:"w-3 shrink-0",children:p.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-accent animate-pulse"})}):p.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:"○"})}function lJe(s){const e=Math.max(0,Math.floor(s/1e3));if(e<60)return`${e}s ago`;const n=Math.floor(e/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}function cJe({onClose:s,onSent:e}){const n=Ot(L=>L.tabs),[i,r]=T.useState(""),[o,a]=T.useState(()=>Object.fromEntries(n.map(L=>[L.id,!0]))),[l,c]=T.useState(!1),[d,u]=T.useState({}),h=T.useRef(null),f=T.useRef(e);T.useEffect(()=>{f.current=e},[e]),T.useEffect(()=>{a(L=>{const D={};for(const I of n)D[I.id]=L[I.id]??!0;return D})},[n]),T.useEffect(()=>{var L;(L=h.current)==null||L.focus()},[]),T.useEffect(()=>window.api.pty.onWriteError(D=>{u(I=>D.tabId in I?{...I,[D.tabId]:"skipped"}:I)}),[]),T.useEffect(()=>{if(Object.keys(d).length===0)return;const L=Object.values(d).filter(I=>I==="sent").length,D=window.setTimeout(()=>f.current(L),1500);return()=>window.clearTimeout(D)},[d]);const g=n.filter(L=>o[L.id]).map(L=>L.id),m=g.length,_=Object.keys(d).length>0,b=i.length>0&&m>0&&!l&&!_,v=()=>{if(!b)return;c(!0);const L=Ot.getState().tabs,D=new Set(L.map(A=>A.id)),I={};for(const A of g)D.has(A)?(window.api.pty.write({tabId:A,data:i+"\r"}),I[A]="sent"):I[A]="skipped";u(I),c(!1)},x=L=>{if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),s();return}L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),v())},w=n.length>0&&n.every(L=>o[L.id]),y=()=>{const L=!w;a(Object.fromEntries(n.map(D=>[D.id,L])))},S=Object.values(d).some(L=>L==="skipped"),E=_?S?"Sent (some skipped)":"Sent":`Send to ${m} tab${m===1?"":"s"}`;return p.jsxs("div",{className:"border-b border-line bg-bg-elev px-4 py-3 flex flex-col gap-2 shrink-0",onKeyDown:x,"data-testid":"broadcast-bar",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"text-xs text-fg-dim uppercase tracking-wider",children:"Broadcast"}),p.jsx("div",{className:"text-[10px] text-fg-faint",children:"Esc to close · Cmd/Ctrl+Enter to send"})]}),p.jsx("textarea",{ref:h,value:i,onChange:L=>r(L.target.value),rows:3,placeholder:"Prompt to broadcast…",className:"w-full bg-bg border border-line rounded px-2 py-1.5 text-xs text-fg font-mono resize-y focus:outline-none focus:border-fg-faint"}),p.jsxs("div",{className:"flex flex-col gap-1",children:[p.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-fg-dim cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:w,onChange:y,className:"accent-accent"}),p.jsxs("span",{children:["All tabs (",m,"/",n.length,")"]})]}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 max-h-24 overflow-y-auto pl-4",children:n.map(L=>p.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-fg-dim cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:!!o[L.id],onChange:D=>a(I=>({...I,[L.id]:D.target.checked})),className:"accent-accent"}),p.jsx("span",{className:"truncate max-w-[12rem]",children:L.label}),d[L.id]==="sent"&&p.jsx("span",{"data-testid":"broadcast-row-sent",className:"text-[10px] text-green-500",children:"✓"}),d[L.id]==="skipped"&&p.jsx("span",{"data-testid":"broadcast-row-skipped",className:"text-[10px] text-red-400",children:"×"})]},L.id))})]}),p.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[p.jsx("button",{onClick:s,className:"px-2 py-0.5 text-[10px] text-fg-faint hover:text-fg border border-line hover:border-fg-faint rounded transition-colors",children:"Cancel"}),p.jsx("button",{onClick:v,disabled:!b,className:"px-2 py-0.5 text-[10px] text-fg border border-accent-muted hover:border-accent rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:E})]})]})}function dJe({tabId:s,cwd:e,onClose:n}){const i=iR(m=>m.watchersForTab(s)),r=iR(m=>m.add),o=iR(m=>m.remove),a=T.useRef(null),[l,c]=T.useState(""),[d,u]=T.useState(""),[h,f]=T.useState(!1);T.useEffect(()=>{const m=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),T.useEffect(()=>{const m=_=>{a.current&&!a.current.contains(_.target)&&n()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[n]);const g=async()=>{const m=d.trim();if(!m||h)return;f(!0);const _=await r({tabId:s,label:l.trim(),command:m,cwd:e});f(!1),_&&(c(""),u(""))};return p.jsxs("div",{ref:a,className:"absolute right-2 top-full mt-1 z-30 w-[420px] max-w-[calc(100vw-1rem)] bg-bg-elev border border-line rounded shadow-lg p-3 text-xs",role:"dialog","aria-label":"Watchers","data-testid":"watchers-popover",children:[p.jsxs("div",{className:"flex items-center mb-2",children:[p.jsx("span",{className:"text-fg-dim uppercase tracking-wider",children:"Watchers"}),p.jsxs("span",{className:"text-fg-faint ml-2",children:[i.length," active"]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:n,className:"text-fg-faint hover:text-fg",title:"Close",children:"×"})]}),p.jsxs("div",{className:"flex flex-col gap-1.5 mb-3",children:[p.jsx("input",{value:l,onChange:m=>c(m.target.value),placeholder:"label (optional)",className:"bg-bg border border-line rounded px-2 py-1 text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint"}),p.jsxs("div",{className:"flex gap-1.5",children:[p.jsx("input",{value:d,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&g()},placeholder:"shell command — e.g. npm test --watch",className:"flex-1 bg-bg border border-line rounded px-2 py-1 text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint font-mono","data-testid":"watcher-command-input"}),p.jsx("button",{onClick:g,disabled:!d.trim()||h,className:"px-2 py-1 border border-line rounded text-fg-dim hover:text-fg hover:border-fg-faint disabled:opacity-40 disabled:cursor-not-allowed","data-testid":"watcher-add",children:"Add"})]}),p.jsxs("span",{className:"text-fg-faint",children:["cwd: ",p.jsx("span",{className:"font-mono",children:e})]})]}),i.length===0?p.jsx("div",{className:"text-fg-faint italic py-2",children:"no watchers — add one above"}):p.jsx("ul",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto",children:i.map(m=>{const _=m.lines[m.lines.length-1];return p.jsxs("li",{className:"border border-line rounded p-2 bg-bg",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-medium text-fg truncate",children:m.label}),p.jsxs("span",{className:"text-fg-faint",children:[m.lineCount," line",m.lineCount===1?"":"s"]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:()=>o(m.watcherId),className:"text-fg-faint hover:text-red-400",title:"Stop watcher","data-testid":`watcher-remove-${m.watcherId}`,children:"stop"})]}),p.jsx("div",{className:"text-fg-faint font-mono text-[10px] truncate mt-0.5",title:m.command,children:m.command}),p.jsx("div",{className:"text-fg-dim font-mono text-[10px] truncate mt-1",title:(_==null?void 0:_.line)??"",children:_?_.line:p.jsx("span",{className:"italic text-fg-faint",children:"waiting for output…"})})]},m.watcherId)})})]})}/**
80
80
  * dockview-core
81
81
  * @version 6.6.1
82
82
  * @link https://github.com/mathuo/dockview
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-session-manager",
3
- "version": "0.136.1",
3
+ "version": "0.136.2",
4
4
  "description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
5
5
  "type": "module",
6
6
  "main": "src/main/index.cjs",
@@ -1,8 +1,8 @@
1
1
  {
2
- "version": "0.136.1",
3
- "gitSha": "0683b14d07cfe7761d63e05cc739b078f28d6b46",
4
- "gitShortSha": "0683b14d",
2
+ "version": "0.136.2",
3
+ "gitSha": "72952588d5ecbaa87f1436faf6af6363a3daf8f2",
4
+ "gitShortSha": "72952588",
5
5
  "gitBranch": "HEAD",
6
- "builtAt": "2026-11-16T20:15:06.330Z",
6
+ "builtAt": "2026-11-16T21:21:13.145Z",
7
7
  "dirty": false
8
8
  }
@@ -149,6 +149,25 @@ function originalRequest(y) {
149
149
  };
150
150
  }
151
151
 
152
+ /**
153
+ * receiptFields(appendResult) → { receiptOnReplyingEpic, receiptError? }
154
+ *
155
+ * The receipt on Y is the per-thread cap's only record, and
156
+ * appendResponseEventWithReason never throws — a failed write (a transient
157
+ * read mapped to 'no-index', a write 'error') comes back as { ok: false }.
158
+ * Discarding that result let a reply resolve ok with no receipt on disk, so
159
+ * the caller and the cap both believed a write had landed that had not.
160
+ * The reply itself already happened, so the result stays ok (a resend would
161
+ * duplicate it), but it says the receipt is missing and why.
162
+ */
163
+ function receiptFields(appendResult) {
164
+ if (appendResult && appendResult.ok) return { receiptOnReplyingEpic: true };
165
+ return {
166
+ receiptOnReplyingEpic: false,
167
+ receiptError: (appendResult && appendResult.reason) || 'append-failed',
168
+ };
169
+ }
170
+
152
171
  function countReceipts(cwd, epicId) {
153
172
  const events = readActiveIndex(cwd).events[epicId];
154
173
  return Array.isArray(events) ? events.filter((e) => e && e.notice === RECEIPT_NOTICE).length : 0;
@@ -251,7 +270,7 @@ async function sendFeedbackReply(input, deps = {}) {
251
270
  if (!opened || !opened.ok || typeof opened.epicId !== 'string') return opened;
252
271
  const project = path.basename(targetCwd);
253
272
  // Receipt on Y — counts toward the per-thread cap like a delivered reply.
254
- await appendEvent(replierCwd, yId,
273
+ const receipt = await appendEvent(replierCwd, yId,
255
274
  `Reply to ${rt.epicId} in ${project} fell back to a new proposed session ${opened.epicId} in ${project} (${reason}).`,
256
275
  {
257
276
  notice: RECEIPT_NOTICE,
@@ -277,6 +296,7 @@ async function sendFeedbackReply(input, deps = {}) {
277
296
  toEpicId: rt.epicId,
278
297
  fallbackEpicId: opened.epicId,
279
298
  receiptOnAskingEpic,
299
+ ...receiptFields(receipt),
280
300
  repliesUsed: sent + 1,
281
301
  repliesLeft: MAX_REPLIES_PER_THREAD - sent - 1,
282
302
  };
@@ -313,7 +333,7 @@ async function sendFeedbackReply(input, deps = {}) {
313
333
  const delivery = disposition === 'sent' || disposition === 'queued' ? 'delivered' : 'event-only';
314
334
 
315
335
  // 6. Receipt on Y (counts toward the cap).
316
- await appendEvent(replierCwd, yId,
336
+ const receipt = await appendEvent(replierCwd, yId,
317
337
  `Reply sent to ${x.id} in ${path.basename(targetCwd)} (${outcome}, ${delivery}).`,
318
338
  {
319
339
  notice: RECEIPT_NOTICE,
@@ -336,6 +356,7 @@ async function sendFeedbackReply(input, deps = {}) {
336
356
  delivery,
337
357
  toCwd: targetCwd,
338
358
  toEpicId: x.id,
359
+ ...receiptFields(receipt),
339
360
  repliesUsed: sent + 1,
340
361
  repliesLeft: MAX_REPLIES_PER_THREAD - sent - 1,
341
362
  ...(delivery === 'event-only' && sendResult && sendResult.reason ? { reason: sendResult.reason } : {}),