claude-code-session-manager 0.130.1 → 0.130.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.
- package/dist/assets/{AgentLibrary-Dlhtc8Ty.js → AgentLibrary-Bfj862qf.js} +1 -1
- package/dist/assets/{AppSettings-A3KoPcmL.js → AppSettings-Bpwynea4.js} +1 -1
- package/dist/assets/{Button-DvTXa_-4.js → Button-DSoqrxCB.js} +1 -1
- package/dist/assets/{Extensions-Ddb4sQpO.js → Extensions-BziIutWV.js} +3 -3
- package/dist/assets/{History-DcnZxMoU.js → History-DzMo9Otn.js} +1 -1
- package/dist/assets/{Library-LftcMs6C.js → Library-C5wKMTSn.js} +1 -1
- package/dist/assets/{ListDetail-CnL1azR0.js → ListDetail-DDQ1S0yu.js} +1 -1
- package/dist/assets/{Memory-smN9-Yoo.js → Memory-Bq5T33d2.js} +1 -1
- package/dist/assets/{Panel-CA6TdCHv.js → Panel-B-3NWUlv.js} +1 -1
- package/dist/assets/{ProvenanceBadge-Y3DhyiJo.js → ProvenanceBadge-CUChwz4Z.js} +1 -1
- package/dist/assets/{Scheduler-Ca1qo_kp.js → Scheduler-CkGHMXvo.js} +1 -1
- package/dist/assets/{Settings-BFwlV-as.js → Settings-DGxvyajs.js} +1 -1
- package/dist/assets/{SkillReferenceGraph-2WMsKdmr.js → SkillReferenceGraph-C6JEdypC.js} +1 -1
- package/dist/assets/{SourceChip-CeprSxwb.js → SourceChip-DcBNYYhe.js} +1 -1
- package/dist/assets/{SystemPrompt-B8TXIGXo.js → SystemPrompt-CfozyVQx.js} +1 -1
- package/dist/assets/{TiptapBody-BvxcQ_tS.js → TiptapBody-DiVYC-_O.js} +1 -1
- package/dist/assets/{Toggle-keTV_HDb.js → Toggle-Cs3k6I96.js} +1 -1
- package/dist/assets/{ViewTabs-fupn9keJ.js → ViewTabs-DFXH03tb.js} +1 -1
- package/dist/assets/{VoiceButton-5ETBv9eI.js → VoiceButton-C3NLotUZ.js} +1 -1
- package/dist/assets/{historyTotals-NAZqiuzd.js → historyTotals-f-E0L9Xw.js} +1 -1
- package/dist/assets/{index-QJxszEhM.js → index-CuAfFXNd.js} +3 -3
- package/dist/index.html +1 -1
- package/dist-web/app.js +1 -1
- package/package.json +1 -1
- package/src/main/build-info.json +4 -4
package/dist/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400&family=Geist:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
10
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
+
<script type="module" crossorigin src="./assets/index-CuAfFXNd.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="./assets/monaco-editor-BsIlgG7c.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/monaco-editor-Cu5D__1H.css">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="./assets/index-Bp8XE9A6.css">
|
package/dist-web/app.js
CHANGED
|
@@ -74,7 +74,7 @@ ${i}`].join(`
|
|
|
74
74
|
|
|
75
75
|
`);return sV({title:`[Customer ${s.tag}] ${s.title}`,goal:r,tag:T2e[s.tag],agentName:"architect",agentDescription:CGe,...n?{agentBody:n.text,agentPath:n.path}:{}})}function kGe({it:s,projectCwd:e}){const n=Ur(v=>v.setInboxStatus),i=Ur(v=>v.linkEpic),r=un(v=>v.createPromptSession),[o,a]=I.useState(!1),[l,c]=I.useState(""),[d,u]=I.useState(!1),h=s.body.length>Q_e,f=h&&!o?`${s.body.slice(0,Q_e)}…`:s.body,p=s.epicId!=null,m=d||p||!e,_=p?"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:w,sections:y}=await SGe(s,e),x=await r(e,v,T2e[s.tag],void 0,"architect",w,y);await i(s.id,x.id),await n(s.id,"in_progress")}catch(v){me.error(v instanceof Error?v.message:String(v))}finally{u(!1)}}};return g.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:[g.jsxs("div",{className:"flex items-start justify-between gap-2",children:[g.jsx("div",{className:"min-w-0 text-[13px] font-semibold text-fg break-words",children:s.title}),g.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[11px] font-semibold text-fg-dim",children:wGe[s.status]})]}),g.jsxs("div",{className:"font-mono text-[11px] text-fg-dim",children:[yGe[s.tag]," · ",new Date(pZ(s.receivedAt)).toLocaleDateString()," · v",s.clientVersion??"?"," ·"," ",s.clientPlatform??"?"]}),g.jsx("div",{className:"text-[12.5px] text-fg whitespace-pre-wrap break-words",children:f}),h&&g.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"}),g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.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:D2e.map(v=>g.jsx("option",{value:v.value,children:v.label},v.value))}),g.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"}),g.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:p?"Epic linked":"Open as Epic"})]})]})}function EGe(){const s=Ur(a=>{var l;return((l=a.ownerInfo)==null?void 0:l.ownerMode)??!1}),e=Ur(a=>{var l;return((l=a.ownerInfo)==null?void 0:l.projectCwd)??null}),n=Ur(a=>a.inbox),i=Ur(a=>a.inboxLoading),r=Ur(a=>a.pullInbox),o=I.useMemo(()=>[...n].sort((a,l)=>pZ(l.receivedAt)-pZ(a.receivedAt)),[n]);return I.useEffect(()=>{s&&r()},[s,r]),s?g.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:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx("h3",{className:"m-0 font-mono text-[11px] uppercase tracking-[0.08em] text-fg-dim",children:"Customer inbox"}),g.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?g.jsx("p",{className:"m-0 text-[12.5px] text-fg-dim",children:"No customer feedback yet."}):o.map(a=>g.jsx(kGe,{it:a,projectCwd:e},a.id))]}):null}const LGe={open:"Open",in_progress:"In progress",resolved:"Resolved",wontfix:"Won't fix"},DGe=[{tag:"bug",label:"Bug"},{tag:"feature",label:"Feature"},{tag:"discussion",label:"Discussion"}],TGe={bug:"Bug",feature:"Feature",discussion:"Discussion"},ebe=120,NGe=4e3;function IGe(){const s=Ur(v=>v.panelOpen),e=Ur(v=>v.draft),n=Ur(v=>v.items),i=Ur(v=>v.submitting),r=Ur(v=>v.closePanel),o=Ur(v=>v.setDraft),a=Ur(v=>v.submit),l=Ur(v=>v.load),c=Ur(v=>v.loadOwnerInfo),d=Ur(v=>v.refreshStatus),u=Ur(v=>v.markSeen),h=Ur(v=>{var w;return((w=v.ownerInfo)==null?void 0:w.ownerMode)===!0}),[f,p]=I.useState(!1),m=I.useMemo(()=>[...n].sort((v,w)=>w.submittedAt-v.submittedAt),[n]);if(I.useEffect(()=>{if(!s){p(!1);return}const v=requestAnimationFrame(()=>p(!0));return()=>cancelAnimationFrame(v)},[s]),I.useEffect(()=>{if(!s)return;let v=!1;return(async()=>(await Promise.all([l(),c(),d()]),v||await u()))(),()=>{v=!0}},[s,l,c,d,u]),I.useEffect(()=>{if(!s)return;const v=w=>{w.key==="Escape"&&(w.stopPropagation(),r())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s,r]),!s)return null;const _=e.title.trim()===""||e.body.trim()==="",b=g.jsxs("div",{className:`fixed inset-0 ${ji.dialog}`,"data-testid":"customer-feedback-root",children:[g.jsx("div",{className:`absolute inset-0 bg-black/50 transition-opacity duration-[220ms] ${f?"opacity-100":"opacity-0"}`,onClick:v=>{v.target===v.currentTarget&&r()},"data-testid":"customer-feedback-backdrop"}),g.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] ${f?"translate-x-0":"-translate-x-full"}`,style:{transitionTimingFunction:"cubic-bezier(.32,.72,.28,1)"},"data-testid":"customer-feedback-panel",children:[g.jsxs("header",{className:"px-5 py-4 border-b border-line flex items-center justify-between gap-3 shrink-0",children:[g.jsx("h2",{className:"m-0 font-serif text-[18px] font-semibold text-fg",children:"Feedback"}),g.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"})]}),g.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5 py-4 grid gap-5 content-start",children:[g.jsxs("form",{className:"grid gap-3",onSubmit:v=>{v.preventDefault(),!_&&!i&&a()},children:[g.jsxs("label",{className:"grid gap-1",children:[g.jsxs("span",{className:"flex justify-between font-mono text-[11px] uppercase tracking-[0.05em] text-fg-dim",children:[g.jsx("span",{children:"Header"}),g.jsxs("span",{children:[e.title.length,"/",ebe]})]}),g.jsx("input",{value:e.title,maxLength:ebe,onChange:v=>o({title:v.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"})]}),g.jsxs("label",{className:"grid gap-1",children:[g.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.05em] text-fg-dim",children:"Body"}),g.jsx("textarea",{value:e.body,maxLength:NGe,rows:6,onChange:v=>o({body:v.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"})]}),g.jsx("div",{className:"flex gap-2",role:"group","aria-label":"Feedback type",children:DGe.map(({tag:v,label:w})=>g.jsx("button",{type:"button","aria-pressed":e.tag===v,onClick:()=>o({tag:v}),className:`rounded-md border border-line px-3 py-1 text-[12px] font-semibold ${e.tag===v?"bg-accent text-white":"bg-bg text-fg-dim hover:bg-bg-elev"}`,"data-testid":`customer-feedback-tag-${v}`,children:w},v))}),g.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."}),g.jsx("button",{type:"submit",disabled:_||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"})]}),g.jsxs("p",{className:"m-0 text-[12.5px] text-fg-dim","data-testid":"customer-feedback-free-hour",children:["Rather talk it through?"," ",g.jsx("button",{type:"button",className:"font-semibold text-accent hover:underline","data-testid":"customer-feedback-free-hour-link",onClick:E2e,children:"Book a free hour with Bilko"})]}),g.jsxs("section",{className:"grid gap-2","data-testid":"customer-feedback-list",children:[g.jsx("h3",{className:"m-0 font-mono text-[11px] uppercase tracking-[0.08em] text-fg-dim",children:"Your feedback"}),m.length===0?g.jsx("p",{className:"m-0 text-[12.5px] text-fg-dim",children:"No feedback yet — what you send will show up here."}):m.map(v=>g.jsxs("div",{className:"rounded-lg border border-line bg-bg px-3 py-2 grid gap-1","data-testid":"customer-feedback-item",children:[g.jsxs("div",{className:"flex items-start justify-between gap-2",children:[g.jsx("div",{className:"min-w-0 text-[13px] font-semibold text-fg break-words",children:v.title}),g.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:LGe[v.status]})]}),g.jsxs("div",{className:"font-mono text-[11px] text-fg-dim",children:[TGe[v.tag]," · ",new Date(v.submittedAt).toLocaleDateString()]}),v.statusNote&&g.jsx("div",{className:"text-[12px] text-fg-dim break-words",children:v.statusNote})]},v.id))]})]}),h&&g.jsx(EGe,{})]})]});return typeof document<"u"&&document.body?hS.createPortal(b,document.body):b}const RGe=3e4;function AGe(){const s=Dt(D=>D.tabs),e=Dt(D=>D.activeTabId),n=Dt(D=>D.closeTab),i=Dt(D=>D.setActive),r=Dt(D=>D.reorderTab),o=x2(D=>D.watchers),a=fi(D=>D.openPanel),l=fi(D=>D.openProjectPanel),c=fi(D=>D.setEpicsWorkspaceOpen),d=fi(D=>D.navFace==="home"),u=Ur(D=>D.items),h=Ur(D=>D.panelOpen),f=Ur(D=>D.togglePanel),p=Ur(D=>D.load),m=bGe(u)>0;I.useEffect(()=>{p()},[p]);const[_,b]=I.useState(()=>Date.now()),v=fle();I.useEffect(()=>{if(!v)return;b(Date.now());const D=window.setInterval(()=>b(Date.now()),1e3);return()=>window.clearInterval(D)},[v]);const w=D=>{for(const T of Object.values(o))if(T.tabId===D&&T.lastLineAt&&_-T.lastLineAt<RGe)return!0;return!1},{getTabDragProps:y,isDragging:x,containerRef:S}=_Ge({tabCount:s.length,onReorder:r,onActivate:D=>{const T=s[D];T&&(i(T.id),c(!1),l("terminal"))}}),E=["#6f7d52","#b85c34","#a39079","#7a8466","#5b4a36"];return g.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:[g.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:[g.jsx(ho,{name:"home",className:"w-[15px] h-[15px]"}),g.jsx("span",{children:"Home"})]}),g.jsx("span",{className:"w-px self-stretch my-1.5 bg-line"}),g.jsx("div",{ref:S,className:`flex items-end gap-0.5 overflow-x-auto no-scrollbar min-w-0 flex-1 select-none ${x?"cursor-grabbing":""}`,children:s.map((D,T)=>{const R=D.id===e,A=y(T),P=E[T%E.length];return g.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 ${x?"":"cursor-grab"} ${R?"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:D.cwd,"aria-current":R?"true":void 0,children:[g.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:P,boxShadow:"inset 0 0 0 0.5px rgba(0,0,0,0.15)",opacity:D.status==="spawning"?.55:1}}),g.jsx("span",{className:"truncate max-w-[200px]",children:D.label}),D.status==="spawning"&&g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-butter animate-pulse",title:"spawning"}),w(D.id)&&g.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"}),g.jsx("button",{onClick:j=>{j.stopPropagation(),n(D.id)},className:"text-fg-faint opacity-0 group-hover:opacity-100 hover:text-fg ml-1 leading-none",title:"Close session","aria-label":`Close ${D.label}`,children:"×"})]},D.id)})}),g.jsx("span",{className:"w-px self-stretch my-1.5 bg-line"}),g.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&&g.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"})]}),g.jsx(IGe,{})]})}function MGe(...s){}function PGe(s){return Promise.reject(new Error("Not available in the web version"))}const OGe=new Set,FGe=new Set;function jGe(){for(const s of OGe)try{s()}catch{}}function gZ(){for(const s of FGe)try{s()}catch{}}function BGe(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 HGe(s){if(!window.speechSynthesis)return;const e=BGe(s);if(!e)return;const n=new SpeechSynthesisUtterance(e);n.rate=1,n.pitch=1,n.onstart=()=>{performance.now(),jGe()},n.onend=()=>{!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&gZ()},n.onerror=i=>{i.error!=="canceled"&&!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&gZ()},window.speechSynthesis.speak(n)}function WGe(){window.speechSynthesis&&(window.speechSynthesis.cancel(),gZ())}function u3(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 Hn={debug:(s,e,n)=>u3(s,"debug",e,n),info:(s,e,n)=>u3(s,"info",e,n),warn:(s,e,n)=>u3(s,"warn",e,n),error:(s,e,n,i)=>u3(s,"error",e,n,i)};function tbe(){Ut.getState().submitCountdownStartAt!==null&&Ut.setState({submitCountdownStartAt:null})}let nbe=null;const h3=1e4;let C2=null;function gG(){C2&&(clearTimeout(C2),C2=null)}let UF=null,GF=null;function f3(){UF=null,GF&&(GF(),GF=null)}const VGe=1500,$Ge=9e4;let CN=0,qF=null,mZ=-1;function SN(){qF&&(clearTimeout(qF),qF=null,mZ=-1)}const zGe=1800*1e3;let S2=null;function UGe(){S2&&(clearTimeout(S2),S2=null)}const Ut=_o((s,e)=>{function n(){UGe(),S2=setTimeout(()=>{if(S2=null,e().isRecording||nbe){n();return}Hn.info("voice","model idle timeout: releasing worker"),SN(),CN++,s({modelStatus:"idle",loadingProgress:0,error:null,errorKind:null})},zGe)}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;Hn.info("voice","initModel: kicking off preload"),s({modelStatus:"loading",error:null,errorKind:null,loadingProgress:0});const i=++CN,r=()=>{i===CN&&(SN(),mZ=i,qF=setTimeout(()=>{mZ===i&&e().modelStatus==="loading"&&(Hn.warn("voice","mic.gate.timeout: no progress within 90s"),s({modelStatus:"error",error:"Model load timed out",errorKind:"timeout"}))},$Ge))};r(),MGe((o,a)=>{i===CN&&(o==="ready"?(SN(),Hn.info("voice","modelStatus -> ready"),s({modelStatus:"ready",loadingProgress:100,errorKind:null}),!e().isRecording&&!nbe&&n()):o==="error"?(SN(),Hn.error("voice","modelStatus -> error",{msg:a}),s({modelStatus:"error",error:a,errorKind:"load"})):(r(),s({modelStatus:"loading"})))},o=>{i===CN&&(r(),s({loadingProgress:Math.round(o)}))})},resetAndRetryModel:()=>{Hn.info("voice","mic.gate.retry"),SN(),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=>{Hn.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:()=>tbe(),setPartialsEnabled:i=>{e().partialsEnabled!==i&&(s({partialsEnabled:i}),i||s({lastPartial:""}))},clearError:()=>s({error:null,errorKind:null}),setPermissionState:i=>{e().permissionState!==i&&(Hn.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"?Hn.warn("voice-turn","voice-turn.load_failed"):i==="runtime_error"?Hn.warn("voice-turn","voice-turn.runtime_error"):i==="disabled"&&Hn.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}=f6();if(i==="down"){if(d==="error"||d==="load-timeout"){l.resetAndRetryModel(),Hn.info("voice-hotkey","down.retry",{source:r,reason:d});return}if(!c&&d!=="loading"){Hn.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"}),gG(),C2=setTimeout(()=>{e().hotkeyState==="stopping"&&(Hn.warn("voice-hotkey","drain-timeout",{durationMs:h3}),s({hotkeyState:"aborted"}),setTimeout(()=>{e().hotkeyState==="aborted"&&s({hotkeyState:"idle"})},0))},h3),l.stopRecording());return}if(d==="loading"){l.hotkeyState!=="armed"&&(s({hotkeyState:"armed"}),Hn.info("voice-hotkey","armed",{source:r,modelStatus:l.modelStatus})),f3(),UF={tabId:a,source:r,mode:o},GF=Ut.subscribe((u,h)=>{if(UF&&u.modelStatus==="ready"&&h.modelStatus!=="ready"&&u.hotkeyState==="armed"){const f=UF;if(f3(),!f.tabId){Hn.warn("voice-hotkey","armed-promote-no-tab",{source:f.source}),s({hotkeyState:"idle"});return}Hn.info("voice-hotkey","armed-promote",f),s({hotkeyState:"recording"}),Ut.getState().startRecording(f.tabId)}});return}if(!a){Hn.warn("voice-hotkey","no-active-tab",{source:r});return}Hn.info("voice-hotkey","start",{source:r,mode:o,tabId:a}),l.startRecording(a),e().isRecording?s({hotkeyState:"recording"}):(Hn.warn("voice-hotkey","start: recording did not engage",{errorKind:e().errorKind}),s({hotkeyState:"idle"}));return}if(!(o!=="hold"||r==="global")){if(l.hotkeyState==="armed"){f3(),Hn.info("voice-hotkey","miss-model-loading-armed-up"),s({hotkeyState:"idle"});return}l.hotkeyState==="recording"&&(s({hotkeyState:"stopping"}),gG(),C2=setTimeout(()=>{e().hotkeyState==="stopping"&&(Hn.warn("voice-hotkey","drain-timeout",{durationMs:h3}),s({hotkeyState:"aborted"}),setTimeout(()=>{e().hotkeyState==="aborted"&&s({hotkeyState:"idle"})},0))},h3),l.stopRecording())}},destroyHotkey:()=>{const i=e();if(f3(),tbe(),i.hotkeyState==="recording"){Hn.warn("voice-hotkey","destroyed-mid-recording"),s({hotkeyState:"destroyed"});try{i.stopRecording()}catch{}}else(i.hotkeyState==="armed"||i.hotkeyState==="stopping")&&(gG(),s({hotkeyState:"destroyed"}))}}}),GGe=s=>({isRecording:s.isRecording,statusPill:s.statusPill,lastPartial:s.lastPartial,lastTranscript:s.lastTranscript,submitCountdownStartAt:s.submitCountdownStartAt}),f6=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"&&Ut.setState({ttsEnabled:s})}).catch(s=>{Hn.warn("voice","getTtsEnabled failed",{error:s instanceof Error?s.message:String(s)})});if(typeof window<"u"){const s=window;s.__voice=Ut,s.__transcripts=[]}const lA=6e4,qGe=3e5,KGe=.25,YGe=5e3,cA=_o(()=>({data:null,refreshing:!1}));let ibe=!1,KF=null,mG=lA,p3=!1,Vm=null;function XGe(s,e){if(s.kind==="ok")return{delayMs:lA,nextBackoffMs:lA};const n=Math.min(e*2,qGe),i=n*KGe;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 sbe(){return nle(window.api.billing.fetch(),YGe,"billing.fetch")}function rbe(s){cA.setState({data:s,refreshing:!1})}async function ple(){cA.setState({refreshing:!0});let s=lA;try{const e=await sbe();Vm&&(Vm.cancel(),Vm=null),rbe(e);const{delayMs:n,nextBackoffMs:i}=XGe(e,mG);mG=i,s=n}catch(e){mG=lA,cA.setState({refreshing:!1});const n=a2e({error:e,retry:sbe,onRetrySuccess:i=>{Vm=null,rbe(i)},onStillFailing:i=>{Vm=null,p3||(p3=!0,me.warn(`Billing usage fetch: ${i}`))}});if(n)Vm=n;else if(!p3){p3=!0;const i=e instanceof Error?e.message:String(e);me.warn(`Billing usage fetch failed: ${i}`)}}KF=setTimeout(ple,s)}function ZGe(){ibe||(ibe=!0,ple())}function N2e(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 JGe(){KF!==null&&(clearTimeout(KF),KF=null),Vm&&(Vm.cancel(),Vm=null),ple()}function nw(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 vf(s){const e=/(opus|sonnet|haiku|fable)/i.exec(s);return e?e[1].toLowerCase():null}const g3=new Map,QGe=3e4;function gle(s){const[e,n]=I.useState(()=>{var i;return s?((i=g3.get(s))==null?void 0:i.value)??null:null});return I.useEffect(()=>{if(!s){n(null);return}let i=!1;return(async()=>{const o=g3.get(s);if(o&&Date.now()-o.ts<QGe){i||n(o.value);return}try{const a=await window.api.app.gitBranch(s);if(i)return;g3.set(s,{value:a,ts:Date.now()}),n(a)}catch{if(i)return;g3.set(s,{value:null,ts:Date.now()}),n(null)}})(),()=>{i=!0}},[s]),e}const eqe="~/.claude/session-manager/ui-chrome-prefs.json",I2e=Mg(eqe),tqe=180,nqe=480,_Z=252,sy={sidebarWidth:_Z,sidebarCollapsed:!1,collapsedGroups:[],learningPanelCollapsed:!1,tourCompletedAt:null,density:"roomy"};function bZ(s){return Math.min(nqe,Math.max(tqe,s))}let Ov=null,YF={};function iqe(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};I2e.patch(i).catch(()=>{})};s().hydrated||!Ov?e():Ov.then(e)}function _k(s,e,n){s(n),!e().hydrated&&Ov&&Object.assign(YF,n),iqe(e)}const So=_o((s,e)=>({...sy,hydrated:!1,hydrate:()=>e().hydrated?Promise.resolve():Ov||(Ov=(async()=>{try{const n=await I2e.read();if(Object.keys(n).length>0){s({sidebarWidth:typeof n.sidebarWidth=="number"?bZ(n.sidebarWidth):sy.sidebarWidth,sidebarCollapsed:n.sidebarCollapsed??sy.sidebarCollapsed,collapsedGroups:Array.isArray(n.collapsedGroups)?n.collapsedGroups:sy.collapsedGroups,learningPanelCollapsed:n.learningPanelCollapsed??sy.learningPanelCollapsed,tourCompletedAt:typeof n.tourCompletedAt=="number"?n.tourCompletedAt:sy.tourCompletedAt,density:n.density==="compact"?"compact":sy.density,...YF,hydrated:!0});return}}catch{}s({...YF,hydrated:!0})})().finally(()=>{Ov=null,YF={}}),Ov),setSidebarWidth:n=>_k(s,e,{sidebarWidth:bZ(n)}),setSidebarCollapsed:n=>_k(s,e,{sidebarCollapsed:n}),setCollapsedGroups:n=>_k(s,e,{collapsedGroups:n}),setLearningPanelCollapsed:n=>_k(s,e,{learningPanelCollapsed:n}),setTourCompletedAt:n=>_k(s,e,{tourCompletedAt:n}),setDensity:n=>_k(s,e,{density:n})})),sqe=52;function rqe(s){return new Set(s.filter(e=>e==="Workspace"||e==="Claude Code"||e==="Session Manager"))}function oqe(){const s=Dt(n=>{var i;return((i=n.tabs.find(r=>r.id===n.activeTabId))==null?void 0:i.cwd)??null});return{scheduler:wl(n=>{var i;return(((i=n.snapshot)==null?void 0:i.jobs)??[]).some(r=>r.status==="running"&&(!s||r.cwd===s))})}}function aqe({active:s,onNavigate:e,onNewSession:n}){const i=So(F=>F.hydrated),r=So(F=>F.hydrate);I.useEffect(()=>{i||r()},[i,r]);const o=So(F=>F.collapsedGroups),a=So(F=>F.setCollapsedGroups),l=I.useMemo(()=>rqe(o),[o]),c=I.useCallback(F=>{const W=new Set(l);W.has(F)?W.delete(F):W.add(F),a(Array.from(W))},[l,a]),d=So(F=>F.sidebarCollapsed),u=So(F=>F.setSidebarCollapsed),h=I.useCallback(()=>{u(!d)},[d,u]),f=Dt(F=>F.tabs),p=Dt(F=>F.activeTabId),m=f.find(F=>F.id===p)??null,_=oqe(),b=fi(F=>F.navFace),v=rGe(b),w=v.filter(F=>F.group==="Workspace"),y=v.filter(F=>F.group==="Claude Code"),x=v.filter(F=>F.group==="Session Manager"),S=b==="home"&&!d,E=So(F=>F.sidebarWidth),D=So(F=>F.setSidebarWidth),[T,R]=I.useState(E),A=I.useRef(T);A.current=T,I.useEffect(()=>{R(E)},[E]);const P=I.useCallback(F=>{F.preventDefault();const W=F.clientX,V=A.current;let U=V;const Q=O=>{U=bZ(V+(O.clientX-W)),R(U)},Y=()=>{window.removeEventListener("pointermove",Q),window.removeEventListener("pointerup",Y),document.body.style.cursor="",document.body.style.userSelect="",D(U)};window.addEventListener("pointermove",Q),window.addEventListener("pointerup",Y),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[D]),j=I.useCallback(()=>{R(_Z),D(_Z)},[D]);return g.jsxs("aside",{className:"shrink-0 bg-bg-elev border-r border-line flex flex-col relative transition-[width] duration-150",style:{width:d?sqe:T},"data-testid":"tour-leftnav","aria-label":"Primary navigation",children:[g.jsx(lqe,{tab:m,navFace:b,onNewSession:n,rail:d,onToggleRail:h}),g.jsx("div",{className:"flex-1 min-h-0 overflow-auto pb-3",style:{paddingInline:d?"4px":"8px"},children:S?g.jsxs(g.Fragment,{children:[g.jsx(_G,{label:"Workspace",desc:fG.Workspace,collapsed:l.has("Workspace"),count:w.length,onToggle:()=>c("Workspace")}),!l.has("Workspace")&&w.map(F=>g.jsx(m3,{item:F,active:s===F.key,live:F.liveKind?_[F.liveKind]:!1,onClick:()=>e(F.key),rail:!1},F.key)),g.jsx(_G,{label:"Claude Code",desc:fG["Claude Code"],collapsed:l.has("Claude Code"),count:y.length,onToggle:()=>c("Claude Code")}),!l.has("Claude Code")&&y.map(F=>g.jsx(m3,{item:F,active:s===F.key,live:!1,onClick:()=>e(F.key),rail:!1},F.key)),g.jsx(_G,{label:"Session Manager",desc:fG["Session Manager"],collapsed:l.has("Session Manager"),count:x.length,onToggle:()=>c("Session Manager")}),!l.has("Session Manager")&&x.map(F=>g.jsx(m3,{item:F,active:s===F.key,live:!1,onClick:()=>e(F.key),rail:!1},F.key))]}):g.jsx("div",{className:"pt-2",children:v.map(F=>g.jsx(m3,{item:F,active:s===F.key,live:F.liveKind?_[F.liveKind]:!1,onClick:()=>e(F.key),rail:d},F.key))})}),g.jsx(cqe,{rail:d,navFace:b}),!d&&g.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize · double-click to reset",onPointerDown:P,onDoubleClick:j,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 lqe({tab:s,navFace:e,onNewSession:n,rail:i,onToggleRail:r}){const o=(s==null?void 0:s.label)??"no session",a=gle((s==null?void 0:s.cwd)??null);return i?g.jsxs("div",{className:"flex flex-col items-center gap-1.5 pt-2 pb-2 border-b border-rule",children:[g.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:g.jsx(ho,{name:"plus",size:15,stroke:1.8})}),g.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:g.jsx("span",{style:{display:"inline-flex",transform:"rotate(0deg)"},children:g.jsx(ho,{name:"chevron",size:15,stroke:1.8})})})]}):e==="home"?g.jsxs("div",{className:"px-[18px] pt-[14px] pb-[10px] border-b border-rule",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("div",{className:"text-[11px] font-semibold tracking-[0.06em] text-fg-faint uppercase",children:"Session Manager"}),g.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:g.jsx("span",{style:{display:"inline-flex",transform:"rotate(180deg)"},children:g.jsx(ho,{name:"chevron",size:13,stroke:1.8})})})]}),g.jsx("div",{className:"mt-3 flex items-stretch gap-1.5",children:g.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:[g.jsx(ho,{name:"plus",size:13,stroke:1.8}),"Open / Start Project"]})})]}):g.jsxs("div",{className:"px-[18px] pt-[14px] pb-[10px] border-b border-rule",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("div",{className:"text-[11px] font-semibold tracking-[0.06em] text-fg-faint uppercase",children:"Project"}),g.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:g.jsx("span",{style:{display:"inline-flex",transform:"rotate(180deg)"},children:g.jsx(ho,{name:"chevron",size:13,stroke:1.8})})})]}),g.jsxs("div",{className:"flex items-baseline gap-2 mt-1",children:[g.jsx("span",{className:"self-center w-2 h-2 rounded-full bg-sage"}),g.jsx("span",{className:"font-serif text-[18px] font-medium text-fg truncate",title:(s==null?void 0:s.cwd)??"",children:o})]}),g.jsx("div",{className:"text-[12px] text-fg-faint font-mono mt-0.5 truncate",children:a?`⌥${a}`:s?s.cwd:"—"}),g.jsx("div",{className:"mt-3 flex items-stretch gap-1.5",children:g.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:[g.jsx(ho,{name:"plus",size:13,stroke:1.8}),"Open / Start Project"]})})]})}function _G({label:s,desc:e,collapsed:n,count:i,onToggle:r}){return g.jsxs("div",{className:"px-3 pt-3.5 pb-1.5",children:[g.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:[g.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 text-[9px] not-italic transition-transform",style:{transform:n?"rotate(-90deg)":"rotate(0deg)"},children:"▾"}),g.jsx("span",{className:"flex-1",children:s}),n&&g.jsx("span",{className:"not-italic text-[10px] font-mono text-fg-faint/70 normal-case tracking-normal",children:i})]}),!n&&g.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 m3({item:s,active:e,live:n,onClick:i,rail:r}){return g.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&&g.jsx("span",{"aria-hidden":!0,className:`absolute top-2 bottom-2 w-[3px] rounded-sm bg-accent ${r?"-left-[4px]":"-left-[10px]"}`}),g.jsx("span",{className:`inline-flex ${e?"text-accent":"text-fg-faint"}`,children:g.jsx(ho,{name:s.icon,size:17,stroke:1.6})}),!r&&g.jsxs("span",{className:"flex-1 min-w-0",children:[g.jsx("span",{className:"block truncate",children:s.label}),s.hint&&g.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 font-normal truncate",children:s.hint})]}),!r&&n&&g.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-accent animate-pulse",title:"live activity"}),r&&n&&g.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 cqe({rail:s,navFace:e}){const n=Ut(c=>c.isRecording),i=Dt(c=>c.tabs),r=Dt(c=>c.activeTabId),o=i.find(c=>c.id===r)??null,[a,l]=I.useState(null);return I.useEffect(()=>{let c=!1;if(!(o!=null&&o.presetId)){l(null);return}return i2e(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?g.jsx("div",{className:"py-2.5 border-t border-rule flex justify-center",children:g.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${n?"bg-red-500 animate-pulse":"bg-sage"}`,title:n?"recording":"idle"})}):g.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:[g.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")&&g.jsx("span",{className:"truncate",title:a??"",children:n?"recording…":a?`Claude · ${nw(a)}`:"Claude Code"})]})}function dqe(s,e,n){return e?s.map(i=>i.id===e?{...i,lastActivityAt:n}:i):s}function uqe(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 hqe(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,p=typeof(u==null?void 0:u.command)=="string"?u.command:void 0,m=f?f.split("/").pop()??f:p?a(p,28):"";o.push({id:0,kind:"tool-use",at:i,label:m?`${l.name} · ${m}`:l.name,target:f??p,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=dqe(s.agents,l==null?void 0:l.toolUseId,i);break}}return{next:r,newActivity:o}}const XF=_o((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]:uqe(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 xn(async()=>{const{toast:h}=await Promise.resolve().then(()=>r2e);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}=hqe(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 fqe(s){const e=XF(r=>r.subscribe),n=XF(r=>r.unsubscribe),i=XF(r=>s?r.tabs[s.id]:void 0);return I.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 R2e(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 vZ(s){return!s||typeof s.utilization!="number"||Number.isNaN(s.utilization)?null:Math.round(s.utilization)}function obe(s,e){const n=vZ(e);if(n==null)return`${s} — usage unavailable`;const i=R2e((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 pqe(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 A2e=I.createContext(null);function gqe({panelId:s,children:e}){return g.jsx(A2e.Provider,{value:s,children:e})}function fS(s){const e=I.useContext(A2e),n=s??e;return fi(i=>n==null||i.focusedPanelId===n)}function mle(s){const e=fS(s),n=I.useRef(e);return n.current=e,n}const mqe=5e3;let Uy=null;const wZ=new Set;let bG=0,k2=null;function _qe(){wZ.forEach(s=>s())}async function p6(){try{Uy=await window.api.schedule.sessionSlots(),_qe()}catch{}}const bqe=0,vqe=10;async function wqe(s){Uy||await p6();const e=Uy?Uy.min:bqe,n=Uy?Uy.max:vqe,i=Math.min(n,Math.max(e,Math.round(s)));await window.api.schedule.setSessionSlots(i),await p6()}function yqe(){k2==null&&(p6(),k2=setInterval(()=>{p6()},mqe))}function xqe(){k2!=null&&(clearInterval(k2),k2=null)}function VP(s){const e=fS(s),[,n]=I.useState(0);return I.useEffect(()=>{const i=()=>n(r=>r+1);return wZ.add(i),()=>{wZ.delete(i)}},[]),I.useEffect(()=>{if(e)return bG+=1,yqe(),()=>{bG-=1,bG<=0&&xqe()}},[e]),Uy}let iE=null;const yZ=new Set;let vG=0,ZF=null,xZ=!1;const Cqe=360*60*1e3;let JF=null;function abe(s){iE=s.check||!(iE!=null&&iE.check)?s:{...s,check:iE.check},yZ.forEach(e=>e())}function Sqe(){if(xZ)return;xZ=!0,ZF=window.api.updater.onStatus(abe);const s=()=>{window.api.updater.status().then(abe).catch(()=>{})};s(),JF=setInterval(s,Cqe)}function kqe(){xZ=!1,JF!=null&&(clearInterval(JF),JF=null),ZF&&(ZF(),ZF=null)}function M2e(){const[,s]=I.useState(0);return I.useEffect(()=>{const e=()=>s(n=>n+1);return yZ.add(e),vG+=1,Sqe(),()=>{yZ.delete(e),vG-=1,vG<=0&&kqe()}},[]),iE}function P2e({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 g.jsx(g.Fragment,{children:Array.from({length:s},(o,a)=>g.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 Eqe({onNavigate:s}){const e=Dt(V=>V.tabs),n=Dt(V=>V.activeTabId),i=e.find(V=>V.id===n)??null,r=fqe(i),o=(r==null?void 0:r.lastEventAt)??0,a=cA(V=>V.data),l=wl(V=>{var U;return((U=V.snapshot)==null?void 0:U.paused)??null}),c=gle((i==null?void 0:i.cwd)??null),d=VP(),u=M2e(),h=(u==null?void 0:u.check)??null,f=vr(V=>V.show),[,p]=I.useState(0);I.useEffect(()=>{const V=setInterval(()=>p(U=>U+1),6e4);return()=>clearInterval(V)},[]);const m=async()=>{const V=(u==null?void 0:u.latest)??"";try{const U=await window.api.updater.install(!1),Q=(U==null?void 0:U.status)??await window.api.updater.status();(Q==null?void 0:Q.state)==="deferred"&&f("info",`Update v${V} will install when ${Q.busyReason??"running jobs"} finish`)}catch(U){f("error",U instanceof Error?U.message:String(U))}},_=(r==null?void 0:r.todos)??[],[b,v]=I.useState(!1),w=I.useRef(null);I.useEffect(()=>{if(!b)return;const V=U=>{w.current&&!w.current.contains(U.target)&&v(!1)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[b]),I.useEffect(()=>{_.length===0&&v(!1)},[_.length]);const y=N2e(a),x=(y==null?void 0:y.usage.five_hour)??null,S=(y==null?void 0:y.usage.seven_day)??null,E=vZ(x),D=vZ(S),T=(a==null?void 0:a.kind)==="ok"||(a==null?void 0:a.kind)==="ok-stale",R=o>0?Tqe(Date.now()-o):"—",A=(d==null?void 0:d.total)??5,P=d?Math.min(Math.max(d.inUse,0),d.total):0,j=d?`${P} / ${A}`:`— / ${A}`,F=d&&d.holders.length>0?`
|
|
76
76
|
`+d.holders.slice(0,5).map(V=>V.owner).join(`
|
|
77
|
-
`):"",W=`${j} Claude sessions running${F}`;return g.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:[g.jsxs("button",{onClick:()=>s==null?void 0:s("settings"),className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:T?"Connected to Anthropic":"Disconnected",children:[g.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${T?"bg-sage":"bg-fg-faint"}`}),g.jsx("span",{children:T?"connected":"offline"})]}),g.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:obe("Session (5h window)",x),"data-testid":"footer-usage-session",children:["session ",g.jsx("span",{className:"text-fg",children:E!=null?`${E}%`:"—"})]}),g.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:obe("Weekly window (all models)",S),"data-testid":"footer-usage-weekly",children:["weekly ",g.jsx("span",{className:"text-fg",children:D!=null?`${D}%`:"—"})]}),l&&g.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:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current opacity-80"}),"Scheduler paused · ",l.reason]}),i&&g.jsxs("span",{className:"text-fg-faint",title:i.cwd,children:[i.label,c&&g.jsxs("span",{className:"text-fg-dim",children:[" · ⌥",c]})]}),g.jsxs("span",{className:"text-fg-faint",children:["last activity: ",g.jsx("span",{className:"text-fg-dim",children:R})]}),_.length>0&&g.jsx(Lqe,{ref:w,todos:_,open:b,onToggle:()=>v(V=>!V)}),g.jsx("span",{className:"flex-1"}),g.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?g.jsx("span",{className:"text-fg-faint",children:"pool paused"}):g.jsx(P2e,{total:A,inUse:(d==null?void 0:d.inUse)??0,size:"sm"})}),(u==null?void 0:u.state)==="ready"?g.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"?g.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"?g.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["Downloading v",u.latest,"…"]}):h!=null&&h.behind&&h.latest&&h.channel==="installer"?g.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:`v${h.current} → v${h.latest}`,"data-testid":"footer-version",onClick:()=>{const V=h.downloadUrl;V&&window.api.shell.open({as:"external",url:V}).catch(()=>{f("error",`Couldn't open URL: ${V}`)})},children:["Download v",h.latest]}):h!=null&&h.behind&&h.latest?g.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]}):g.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["v",(h==null?void 0:h.current)??"0.130.1"]})]})}const Lqe=I.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 g.jsxs("div",{ref:r,className:"relative",children:[g.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:[g.jsxs("span",{className:"text-green-400",children:["✓",o.completed]}),g.jsxs("span",{className:"text-accent",children:["●",o.in_progress]}),g.jsxs("span",{className:"text-fg-dim",children:["○",o.pending]}),g.jsxs("span",{className:"text-fg-faint",children:["todos ",n?"▾":"▴"]})]}),n&&g.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 ${ji.dialog}`,"data-testid":"footer-todos-popover",children:g.jsx("ul",{className:"space-y-0.5",children:e.map((a,l)=>g.jsxs("li",{className:`flex items-start gap-2 py-1 px-1.5 rounded ${a.status==="in_progress"?"bg-bg-hi":""}`,children:[g.jsx(Dqe,{status:a.status}),g.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 Dqe({status:s}){return s==="completed"?g.jsx("span",{className:"text-green-400 w-3 shrink-0",children:"✓"}):s==="in_progress"?g.jsx("span",{className:"w-3 shrink-0",children:g.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-accent animate-pulse"})}):g.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:"○"})}function Tqe(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 Nqe({onClose:s,onSent:e}){const n=Dt(D=>D.tabs),[i,r]=I.useState(""),[o,a]=I.useState(()=>Object.fromEntries(n.map(D=>[D.id,!0]))),[l,c]=I.useState(!1),[d,u]=I.useState({}),h=I.useRef(null),f=I.useRef(e);I.useEffect(()=>{f.current=e},[e]),I.useEffect(()=>{a(D=>{const T={};for(const R of n)T[R.id]=D[R.id]??!0;return T})},[n]),I.useEffect(()=>{var D;(D=h.current)==null||D.focus()},[]),I.useEffect(()=>window.api.pty.onWriteError(T=>{u(R=>T.tabId in R?{...R,[T.tabId]:"skipped"}:R)}),[]),I.useEffect(()=>{if(Object.keys(d).length===0)return;const D=Object.values(d).filter(R=>R==="sent").length,T=window.setTimeout(()=>f.current(D),1500);return()=>window.clearTimeout(T)},[d]);const p=n.filter(D=>o[D.id]).map(D=>D.id),m=p.length,_=Object.keys(d).length>0,b=i.length>0&&m>0&&!l&&!_,v=()=>{if(!b)return;c(!0);const D=Dt.getState().tabs,T=new Set(D.map(A=>A.id)),R={};for(const A of p)T.has(A)?(window.api.pty.write({tabId:A,data:i+"\r"}),R[A]="sent"):R[A]="skipped";u(R),c(!1)},w=D=>{if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),s();return}D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&(D.preventDefault(),v())},y=n.length>0&&n.every(D=>o[D.id]),x=()=>{const D=!y;a(Object.fromEntries(n.map(T=>[T.id,D])))},S=Object.values(d).some(D=>D==="skipped"),E=_?S?"Sent (some skipped)":"Sent":`Send to ${m} tab${m===1?"":"s"}`;return g.jsxs("div",{className:"border-b border-line bg-bg-elev px-4 py-3 flex flex-col gap-2 shrink-0",onKeyDown:w,"data-testid":"broadcast-bar",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("div",{className:"text-xs text-fg-dim uppercase tracking-wider",children:"Broadcast"}),g.jsx("div",{className:"text-[10px] text-fg-faint",children:"Esc to close · Cmd/Ctrl+Enter to send"})]}),g.jsx("textarea",{ref:h,value:i,onChange:D=>r(D.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"}),g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-fg-dim cursor-pointer select-none",children:[g.jsx("input",{type:"checkbox",checked:y,onChange:x,className:"accent-accent"}),g.jsxs("span",{children:["All tabs (",m,"/",n.length,")"]})]}),g.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 max-h-24 overflow-y-auto pl-4",children:n.map(D=>g.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-fg-dim cursor-pointer select-none",children:[g.jsx("input",{type:"checkbox",checked:!!o[D.id],onChange:T=>a(R=>({...R,[D.id]:T.target.checked})),className:"accent-accent"}),g.jsx("span",{className:"truncate max-w-[12rem]",children:D.label}),d[D.id]==="sent"&&g.jsx("span",{"data-testid":"broadcast-row-sent",className:"text-[10px] text-green-500",children:"✓"}),d[D.id]==="skipped"&&g.jsx("span",{"data-testid":"broadcast-row-skipped",className:"text-[10px] text-red-400",children:"×"})]},D.id))})]}),g.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[g.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"}),g.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 Iqe({tabId:s,cwd:e,onClose:n}){const i=x2(m=>m.watchersForTab(s)),r=x2(m=>m.add),o=x2(m=>m.remove),a=I.useRef(null),[l,c]=I.useState(""),[d,u]=I.useState(""),[h,f]=I.useState(!1);I.useEffect(()=>{const m=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),I.useEffect(()=>{const m=_=>{a.current&&!a.current.contains(_.target)&&n()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[n]);const p=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 g.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:[g.jsxs("div",{className:"flex items-center mb-2",children:[g.jsx("span",{className:"text-fg-dim uppercase tracking-wider",children:"Watchers"}),g.jsxs("span",{className:"text-fg-faint ml-2",children:[i.length," active"]}),g.jsx("div",{className:"flex-1"}),g.jsx("button",{onClick:n,className:"text-fg-faint hover:text-fg",title:"Close",children:"×"})]}),g.jsxs("div",{className:"flex flex-col gap-1.5 mb-3",children:[g.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"}),g.jsxs("div",{className:"flex gap-1.5",children:[g.jsx("input",{value:d,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&p()},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"}),g.jsx("button",{onClick:p,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"})]}),g.jsxs("span",{className:"text-fg-faint",children:["cwd: ",g.jsx("span",{className:"font-mono",children:e})]})]}),i.length===0?g.jsx("div",{className:"text-fg-faint italic py-2",children:"no watchers — add one above"}):g.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 g.jsxs("li",{className:"border border-line rounded p-2 bg-bg",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"font-medium text-fg truncate",children:m.label}),g.jsxs("span",{className:"text-fg-faint",children:[m.lineCount," line",m.lineCount===1?"":"s"]}),g.jsx("div",{className:"flex-1"}),g.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"})]}),g.jsx("div",{className:"text-fg-faint font-mono text-[10px] truncate mt-0.5",title:m.command,children:m.command}),g.jsx("div",{className:"text-fg-dim font-mono text-[10px] truncate mt-1",title:(_==null?void 0:_.line)??"",children:_?_.line:g.jsx("span",{className:"italic text-fg-faint",children:"waiting for output…"})})]},m.watcherId)})})]})}/**
|
|
77
|
+
`):"",W=`${j} Claude sessions running${F}`;return g.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:[g.jsxs("button",{onClick:()=>s==null?void 0:s("settings"),className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:T?"Connected to Anthropic":"Disconnected",children:[g.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${T?"bg-sage":"bg-fg-faint"}`}),g.jsx("span",{children:T?"connected":"offline"})]}),g.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:obe("Session (5h window)",x),"data-testid":"footer-usage-session",children:["session ",g.jsx("span",{className:"text-fg",children:E!=null?`${E}%`:"—"})]}),g.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:obe("Weekly window (all models)",S),"data-testid":"footer-usage-weekly",children:["weekly ",g.jsx("span",{className:"text-fg",children:D!=null?`${D}%`:"—"})]}),l&&g.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:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current opacity-80"}),"Scheduler paused · ",l.reason]}),i&&g.jsxs("span",{className:"text-fg-faint",title:i.cwd,children:[i.label,c&&g.jsxs("span",{className:"text-fg-dim",children:[" · ⌥",c]})]}),g.jsxs("span",{className:"text-fg-faint",children:["last activity: ",g.jsx("span",{className:"text-fg-dim",children:R})]}),_.length>0&&g.jsx(Lqe,{ref:w,todos:_,open:b,onToggle:()=>v(V=>!V)}),g.jsx("span",{className:"flex-1"}),g.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?g.jsx("span",{className:"text-fg-faint",children:"pool paused"}):g.jsx(P2e,{total:A,inUse:(d==null?void 0:d.inUse)??0,size:"sm"})}),(u==null?void 0:u.state)==="ready"?g.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"?g.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"?g.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["Downloading v",u.latest,"…"]}):h!=null&&h.behind&&h.latest&&h.channel==="installer"?g.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:`v${h.current} → v${h.latest}`,"data-testid":"footer-version",onClick:()=>{const V=h.downloadUrl;V&&window.api.shell.open({as:"external",url:V}).catch(()=>{f("error",`Couldn't open URL: ${V}`)})},children:["Download v",h.latest]}):h!=null&&h.behind&&h.latest?g.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]}):g.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["v",(h==null?void 0:h.current)??"0.130.2"]})]})}const Lqe=I.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 g.jsxs("div",{ref:r,className:"relative",children:[g.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:[g.jsxs("span",{className:"text-green-400",children:["✓",o.completed]}),g.jsxs("span",{className:"text-accent",children:["●",o.in_progress]}),g.jsxs("span",{className:"text-fg-dim",children:["○",o.pending]}),g.jsxs("span",{className:"text-fg-faint",children:["todos ",n?"▾":"▴"]})]}),n&&g.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 ${ji.dialog}`,"data-testid":"footer-todos-popover",children:g.jsx("ul",{className:"space-y-0.5",children:e.map((a,l)=>g.jsxs("li",{className:`flex items-start gap-2 py-1 px-1.5 rounded ${a.status==="in_progress"?"bg-bg-hi":""}`,children:[g.jsx(Dqe,{status:a.status}),g.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 Dqe({status:s}){return s==="completed"?g.jsx("span",{className:"text-green-400 w-3 shrink-0",children:"✓"}):s==="in_progress"?g.jsx("span",{className:"w-3 shrink-0",children:g.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-accent animate-pulse"})}):g.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:"○"})}function Tqe(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 Nqe({onClose:s,onSent:e}){const n=Dt(D=>D.tabs),[i,r]=I.useState(""),[o,a]=I.useState(()=>Object.fromEntries(n.map(D=>[D.id,!0]))),[l,c]=I.useState(!1),[d,u]=I.useState({}),h=I.useRef(null),f=I.useRef(e);I.useEffect(()=>{f.current=e},[e]),I.useEffect(()=>{a(D=>{const T={};for(const R of n)T[R.id]=D[R.id]??!0;return T})},[n]),I.useEffect(()=>{var D;(D=h.current)==null||D.focus()},[]),I.useEffect(()=>window.api.pty.onWriteError(T=>{u(R=>T.tabId in R?{...R,[T.tabId]:"skipped"}:R)}),[]),I.useEffect(()=>{if(Object.keys(d).length===0)return;const D=Object.values(d).filter(R=>R==="sent").length,T=window.setTimeout(()=>f.current(D),1500);return()=>window.clearTimeout(T)},[d]);const p=n.filter(D=>o[D.id]).map(D=>D.id),m=p.length,_=Object.keys(d).length>0,b=i.length>0&&m>0&&!l&&!_,v=()=>{if(!b)return;c(!0);const D=Dt.getState().tabs,T=new Set(D.map(A=>A.id)),R={};for(const A of p)T.has(A)?(window.api.pty.write({tabId:A,data:i+"\r"}),R[A]="sent"):R[A]="skipped";u(R),c(!1)},w=D=>{if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),s();return}D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&(D.preventDefault(),v())},y=n.length>0&&n.every(D=>o[D.id]),x=()=>{const D=!y;a(Object.fromEntries(n.map(T=>[T.id,D])))},S=Object.values(d).some(D=>D==="skipped"),E=_?S?"Sent (some skipped)":"Sent":`Send to ${m} tab${m===1?"":"s"}`;return g.jsxs("div",{className:"border-b border-line bg-bg-elev px-4 py-3 flex flex-col gap-2 shrink-0",onKeyDown:w,"data-testid":"broadcast-bar",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("div",{className:"text-xs text-fg-dim uppercase tracking-wider",children:"Broadcast"}),g.jsx("div",{className:"text-[10px] text-fg-faint",children:"Esc to close · Cmd/Ctrl+Enter to send"})]}),g.jsx("textarea",{ref:h,value:i,onChange:D=>r(D.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"}),g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-fg-dim cursor-pointer select-none",children:[g.jsx("input",{type:"checkbox",checked:y,onChange:x,className:"accent-accent"}),g.jsxs("span",{children:["All tabs (",m,"/",n.length,")"]})]}),g.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 max-h-24 overflow-y-auto pl-4",children:n.map(D=>g.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-fg-dim cursor-pointer select-none",children:[g.jsx("input",{type:"checkbox",checked:!!o[D.id],onChange:T=>a(R=>({...R,[D.id]:T.target.checked})),className:"accent-accent"}),g.jsx("span",{className:"truncate max-w-[12rem]",children:D.label}),d[D.id]==="sent"&&g.jsx("span",{"data-testid":"broadcast-row-sent",className:"text-[10px] text-green-500",children:"✓"}),d[D.id]==="skipped"&&g.jsx("span",{"data-testid":"broadcast-row-skipped",className:"text-[10px] text-red-400",children:"×"})]},D.id))})]}),g.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[g.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"}),g.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 Iqe({tabId:s,cwd:e,onClose:n}){const i=x2(m=>m.watchersForTab(s)),r=x2(m=>m.add),o=x2(m=>m.remove),a=I.useRef(null),[l,c]=I.useState(""),[d,u]=I.useState(""),[h,f]=I.useState(!1);I.useEffect(()=>{const m=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),I.useEffect(()=>{const m=_=>{a.current&&!a.current.contains(_.target)&&n()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[n]);const p=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 g.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:[g.jsxs("div",{className:"flex items-center mb-2",children:[g.jsx("span",{className:"text-fg-dim uppercase tracking-wider",children:"Watchers"}),g.jsxs("span",{className:"text-fg-faint ml-2",children:[i.length," active"]}),g.jsx("div",{className:"flex-1"}),g.jsx("button",{onClick:n,className:"text-fg-faint hover:text-fg",title:"Close",children:"×"})]}),g.jsxs("div",{className:"flex flex-col gap-1.5 mb-3",children:[g.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"}),g.jsxs("div",{className:"flex gap-1.5",children:[g.jsx("input",{value:d,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&p()},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"}),g.jsx("button",{onClick:p,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"})]}),g.jsxs("span",{className:"text-fg-faint",children:["cwd: ",g.jsx("span",{className:"font-mono",children:e})]})]}),i.length===0?g.jsx("div",{className:"text-fg-faint italic py-2",children:"no watchers — add one above"}):g.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 g.jsxs("li",{className:"border border-line rounded p-2 bg-bg",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"font-medium text-fg truncate",children:m.label}),g.jsxs("span",{className:"text-fg-faint",children:[m.lineCount," line",m.lineCount===1?"":"s"]}),g.jsx("div",{className:"flex-1"}),g.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"})]}),g.jsx("div",{className:"text-fg-faint font-mono text-[10px] truncate mt-0.5",title:m.command,children:m.command}),g.jsx("div",{className:"text-fg-dim font-mono text-[10px] truncate mt-1",title:(_==null?void 0:_.line)??"",children:_?_.line:g.jsx("span",{className:"italic text-fg-faint",children:"waiting for output…"})})]},m.watcherId)})})]})}/**
|
|
78
78
|
* dockview-core
|
|
79
79
|
* @version 6.6.1
|
|
80
80
|
* @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.130.
|
|
3
|
+
"version": "0.130.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",
|
package/src/main/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.130.
|
|
3
|
-
"gitSha": "
|
|
4
|
-
"gitShortSha": "
|
|
2
|
+
"version": "0.130.2",
|
|
3
|
+
"gitSha": "664aefcb5f51fbfb3e4c341ead029cce9da06edd",
|
|
4
|
+
"gitShortSha": "664aefcb",
|
|
5
5
|
"gitBranch": "HEAD",
|
|
6
|
-
"builtAt": "2026-11-
|
|
6
|
+
"builtAt": "2026-11-07T09:03:19.022Z",
|
|
7
7
|
"dirty": false
|
|
8
8
|
}
|