claude-code-session-manager 0.124.1 → 0.125.0

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 (43) hide show
  1. package/dist/assets/{AgentLibrary-qmAgadiS.js → AgentLibrary-CcnnJg8P.js} +1 -1
  2. package/dist/assets/{Button-CkuaU6cA.js → Button-sA4lqAao.js} +1 -1
  3. package/dist/assets/{DataModel-DEVHxW5I.js → DataModel-BSTejIBU.js} +1 -1
  4. package/dist/assets/{History-C-qw4Gx4.js → History-DuwlZsQ5.js} +1 -1
  5. package/dist/assets/{Hooks-DzAnCyjJ.js → Hooks-DHDSoDJ_.js} +1 -1
  6. package/dist/assets/{Library-DExZ29wM.js → Library-XA9osRfi.js} +1 -1
  7. package/dist/assets/{ListDetail-DiQk-Hf9.js → ListDetail-B3goE3Wc.js} +1 -1
  8. package/dist/assets/{McpServers-C0nqX36_.js → McpServers-cMZTsPS6.js} +1 -1
  9. package/dist/assets/{Memory-D4KAWPAC.js → Memory-D6qntpZ0.js} +1 -1
  10. package/dist/assets/{Panel-xv9ToSjl.js → Panel-DIyJXHfp.js} +1 -1
  11. package/dist/assets/{Permissions-0yEyqwZU.js → Permissions-DJda4Aii.js} +1 -1
  12. package/dist/assets/{Plugins-CB28SGGJ.js → Plugins-DcdRVBnU.js} +2 -2
  13. package/dist/assets/{ProvenanceBadge-9i4gXDvI.js → ProvenanceBadge-BSI_2wAv.js} +1 -1
  14. package/dist/assets/{SaveBar-mSVRXpml.js → SaveBar-CeL4vXRp.js} +1 -1
  15. package/dist/assets/{Scheduler-BoUetIC0.js → Scheduler-CTd19y5U.js} +1 -1
  16. package/dist/assets/{ScopeSwitcher-B8tdQIKs.js → ScopeSwitcher-BMiHySnz.js} +1 -1
  17. package/dist/assets/{Settings-D3jfKwaK.js → Settings-D-oIEKZy.js} +1 -1
  18. package/dist/assets/{SkillReferenceGraph-DJ4JJRt3.js → SkillReferenceGraph-B_7WfFjn.js} +1 -1
  19. package/dist/assets/{Skills-P9HHxDCR.js → Skills-CKpgxhSS.js} +1 -1
  20. package/dist/assets/{SystemPrompt-B_tnbBZ2.js → SystemPrompt-BjJPTx_a.js} +1 -1
  21. package/dist/assets/{TagLibrary-CI8NHRKi.js → TagLibrary-DJBB4gL0.js} +1 -1
  22. package/dist/assets/{TiptapBody-9LktXPiD.js → TiptapBody-C9Cu2GBL.js} +1 -1
  23. package/dist/assets/{Toggle-BwsUsAA7.js → Toggle-DbIRTOix.js} +1 -1
  24. package/dist/assets/{ViewTabs-CY5gMZ_N.js → ViewTabs-BDpHur6l.js} +1 -1
  25. package/dist/assets/{historyTotals-_dIaxmPX.js → historyTotals-WCJHsBMq.js} +1 -1
  26. package/dist/assets/{index-d4i3X1x3.js → index-BD0ufZqe.js} +3 -3
  27. package/dist/assets/{settingsSchema-Dg0Xa9RR.js → settingsSchema-DmjBj3q7.js} +1 -1
  28. package/dist/assets/{skillFrontmatter-CpoFkSyj.js → skillFrontmatter-Tn_XHajE.js} +1 -1
  29. package/dist/assets/{useAgentsDirWatch-CFPprfWG.js → useAgentsDirWatch-Vz2iXtsQ.js} +1 -1
  30. package/dist/index.html +1 -1
  31. package/dist-web/assets/app.js +1 -1
  32. package/package.json +1 -1
  33. package/src/main/build-info.json +4 -4
  34. package/src/main/chatRunner.cjs +11 -5
  35. package/src/main/docEdit.cjs +8 -4
  36. package/src/main/ipcSchemas.cjs +4 -1
  37. package/src/main/lib/classifyPromptTicket.cjs +9 -4
  38. package/src/main/lib/claude/runClaudeP.cjs +7 -4
  39. package/src/main/lib/process/childStdin.cjs +39 -0
  40. package/src/main/lib/process/childWithLog.cjs +15 -1
  41. package/src/main/lib/scheduler/launchFailure.cjs +37 -1
  42. package/src/main/scheduler.cjs +111 -30
  43. package/src/main/supervisor.cjs +6 -2
@@ -1 +1 @@
1
- import{aB as b,al as n,S as N,aW as O}from"./index-d4i3X1x3.js";import{r as K}from"./claude-settings-schema-COigsajx.js";function G({node:e,targetScope:r,onOverride:s,schema:a,rootLabel:m}){const[f,x]=b.useState(""),[u,o]=b.useState(!0),g=[],d=e.kind==="object"&&Object.keys(e.children).length===0,y=((a==null?void 0:a.rootKeys())??[]).length>0;return n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:[n.jsxs("span",{className:"text-fg-faint",children:["merged · overrides → ",n.jsx("span",{className:"text-fg-dim",children:N[r].label})]}),y&&n.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:u,onChange:t=>o(t.target.checked),className:"accent-accent"}),"show unset keys"]}),n.jsx("div",{className:"flex-1"}),n.jsx("input",{value:f,onChange:t=>x(t.target.value),placeholder:"filter keys or descriptions…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-56"})]}),n.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 font-mono text-xs",children:d&&!u?n.jsx("div",{className:"text-fg-faint italic px-2 py-4",children:"no settings resolved — all scope files empty or missing"}):n.jsx(E,{node:e,path:g,label:m??"(root)",targetScope:r,onOverride:s,filter:f,depth:0,schema:a,showGhosts:u,defaultOpen:!0})})]})}function E(e){return e.node.kind==="object"?n.jsx(P,{...e,node:e.node}):e.node.kind==="array"?n.jsx(J,{...e,node:e.node}):n.jsx(R,{...e,node:e.node})}function A(e,r){return r.trim()?e.toLowerCase().includes(r.toLowerCase()):!0}function w(e,r,s){return!!(!s.trim()||e.some(a=>A(a,s))||r!=null&&r.description&&A(r.description,s))}function P({node:e,path:r,label:s,targetScope:a,onOverride:m,filter:f,depth:x,schema:u,showGhosts:o,defaultOpen:g}){const[d,h]=b.useState(g??x<2),y=(u==null?void 0:u.at(r))??null,t=new Set(Object.keys(e.children)),i=o?(y==null?void 0:y.knownChildren)??[]:[],c=Array.from(new Set([...t,...i])).sort(),l=b.useMemo(()=>f.trim()?c.filter(p=>{const v=(u==null?void 0:u.at([...r,p]))??null;return w([...r,p],v,f)?!0:t.has(p)?L(e.children[p],[...r,p],f,u):!1}):c,[c.join(","),f,e,r.join("."),u]);if(f.trim()&&l.length===0&&!w(r,y,f))return null;if(r.length===0)return n.jsx("div",{children:l.map(p=>j(p))});return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:x*14},onClick:()=>h(!d),children:[n.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:d?"▾":"▸"}),n.jsx("span",{className:"text-fg",children:s}),n.jsxs("span",{className:"text-fg-faint",children:[" {",t.size,i.length>t.size?`/${new Set([...t,...i]).size}`:"","}"]}),(y==null?void 0:y.description)&&n.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:y.description,children:["— ",y.description]})]}),d&&l.map(p=>j(p))]});function j(p){if(t.has(p))return n.jsx(E,{node:e.children[p],path:[...r,p],label:p,targetScope:a,onOverride:m,filter:f,depth:x+1,schema:u,showGhosts:o},p);const v=(u==null?void 0:u.at([...r,p]))??null;return v?n.jsx(I,{path:[...r,p],label:p,info:v,targetScope:a,onSet:m,depth:x+1,filter:f},p):null}}function L(e,r,s,a){const m=(a==null?void 0:a.at(r))??null;if(w(r,m,s))return!0;if(e.kind!=="object")return!1;for(const f of Object.keys(e.children))if(L(e.children[f],[...r,f],s,a))return!0;return!1}function J({node:e,path:r,label:s,filter:a,depth:m,schema:f}){const[x,u]=b.useState(!0),o=(f==null?void 0:f.at(r))??null;return w(r,o,a)?n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:m*14},onClick:()=>u(!x),children:[n.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:x?"▾":"▸"}),n.jsx("span",{className:"text-fg",children:s}),n.jsxs("span",{className:"text-fg-faint",children:[" [",e.items.length,"]"]}),n.jsx(S,{tone:"warn",children:"accumulated"}),(o==null?void 0:o.description)&&n.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:o.description,children:["— ",o.description]})]}),x&&e.items.map((g,d)=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",style:{paddingLeft:(m+1)*14},children:[n.jsx("span",{className:"text-fg-faint w-3 shrink-0"}),n.jsxs("span",{className:"text-fg-faint",children:[d,":"]}),n.jsx("span",{className:"text-fg-dim truncate max-w-xl",children:k(g.value)}),n.jsx(C,{scope:g.fromScope})]},d))]}):null}function R({node:e,path:r,label:s,targetScope:a,onOverride:m,filter:f,depth:x,schema:u}){const[o,g]=b.useState(!1),d=(u==null?void 0:u.at(r))??null;if(!w(r,d,f))return null;const h=e.winner!==a,y=e.shadowed.length>0;return n.jsxs("div",{children:[n.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded",style:{paddingLeft:x*14},children:[n.jsx("span",{className:`w-3 shrink-0 ${y?"text-fg-faint cursor-pointer":""}`,onClick:()=>y&&g(!o),children:y?o?"▾":"▸":""}),n.jsxs("span",{className:"text-fg",children:[s,":"]}),n.jsx("span",{className:"text-fg-dim truncate max-w-md",children:k(e.value)}),n.jsx(C,{scope:e.winner}),(d==null?void 0:d.deprecated)&&n.jsx(S,{tone:"warn",children:"deprecated"}),(d==null?void 0:d.default)!==void 0&&_(e.value,d.default)&&n.jsx(S,{tone:"dim",children:"= default"}),e.typeMismatch&&n.jsx("span",{className:"text-yellow-500/80",title:"shadowed scopes have a different value type",children:"⚠"}),(d==null?void 0:d.description)&&n.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:d.description,children:["— ",d.description]}),n.jsx("div",{className:"flex-1"}),(d==null?void 0:d.enum)&&n.jsx(F,{values:d.enum}),n.jsx("button",{disabled:!h,onClick:()=>m(r,e.value),className:`opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border rounded transition-opacity ${h?"border-accent/50 text-accent hover:bg-accent hover:text-bg":"border-line text-fg-faint cursor-not-allowed"}`,title:h?`copy into ${N[a].label} draft`:`already winning in ${N[a].label}`,children:"override"})]}),o&&e.shadowed.map((t,i)=>n.jsxs("div",{className:"flex items-center gap-2 py-0.5 text-fg-faint line-through",style:{paddingLeft:(x+1)*14+12},children:[n.jsx("span",{children:"shadowed:"}),n.jsx("span",{className:"truncate max-w-xl",children:k(t.value)}),n.jsx(C,{scope:t.scope,dim:!0})]},i))]})}function I({path:e,label:r,info:s,targetScope:a,onSet:m,depth:f,filter:x}){if(!w(e,s,x))return null;const u=s.default!==void 0?s.default:B(s.type),o=Array.isArray(s.type)?s.type.join("|"):s.type??"?";return n.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded opacity-60",style:{paddingLeft:f*14},children:[n.jsx("span",{className:"w-3 shrink-0"}),n.jsx("span",{className:"text-fg-dim",children:r}),n.jsx(S,{tone:"dim",children:o}),s.required&&n.jsx(S,{tone:"warn",children:"required"}),s.default!==void 0&&n.jsxs("span",{className:"text-fg-faint",children:["default: ",k(s.default)]}),s.description&&n.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:s.description,children:["— ",s.description]}),n.jsx("div",{className:"flex-1"}),s.enum&&n.jsx(F,{values:s.enum}),n.jsx("button",{onClick:()=>m(e,u),className:"opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg transition-opacity",title:`write to ${N[a].label} draft`,children:"set"})]})}function _(e,r){return e===r?!0:typeof e!=typeof r?!1:e&&r&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(r):!1}function B(e){switch(Array.isArray(e)?e[0]:e){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};case"null":return null;default:return null}}function k(e){if(typeof e=="string")return JSON.stringify(e);if(e===null)return"null";if(typeof e=="object"){const r=JSON.stringify(e);return r.length>100?r.slice(0,100)+"…":r}return String(e)}function C({scope:e,dim:r}){const s=e==="user"?"bg-bg-hi text-fg-dim border-line":e==="project"?"bg-blue-950/30 text-blue-400/80 border-blue-900/40":"bg-purple-950/30 text-purple-400/80 border-purple-900/40";return n.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${s} ${r?"opacity-60":""}`,children:N[e].label})}function S({children:e,tone:r="default"}){const s={default:"bg-bg-hi text-fg-dim border-line",warn:"bg-yellow-950/30 text-yellow-500/80 border-yellow-900/40",dim:"bg-bg-elev text-fg-faint border-line"}[r];return n.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${s}`,children:e})}function F({values:e}){const r=e.map(s=>String(s)).join(" | ");return n.jsxs("span",{className:"text-[10px] text-fg-faint truncate max-w-xs",title:`allowed: ${r}`,children:["∈ ",r.length>30?r.slice(0,30)+"…":r]})}function V(e,r,s){const a=O(o=>o.files),m=O(o=>o.loadJson),f=O(o=>o.watchFile),x=O(o=>o.unwatchFile),u=b.useMemo(()=>{const o={};for(const g of e.scopes){const d=e.resolve(g,r??"",s);d&&(o[g]=d)}return o},[e,r,s]);return b.useEffect(()=>{const o=Object.values(u).filter(Boolean);return o.forEach(g=>{a[g]||m(g),f(g)}),()=>{o.forEach(g=>x(g))}},[JSON.stringify(u)]),u}function M(e){const r=e??{},s={...r.$defs??{},...r.definitions??{}},a=t=>{if(!t)return{};if(!t.$ref)return x(t);const i=/^#\/(\$defs|definitions)\/(.+)$/.exec(t.$ref);if(!i)return x(t);const c=s[i[2]];return c?a({...c,...u(t)}):x(t)},m=new Set(["__proto__","constructor","prototype"]),f=t=>{if(!t)return{};const i={};for(const[c,l]of Object.entries(t))m.has(c)||(i[c]=l);return i},x=t=>{if(!t.allOf||t.allOf.length===0)return t;const i={...t};delete i.allOf;for(const c of t.allOf){const l=a(c);Object.assign(i,{properties:{...f(i.properties),...f(l.properties)},required:q([...i.required??[],...l.required??[]])}),!i.description&&l.description&&(i.description=l.description),i.default===void 0&&l.default!==void 0&&(i.default=l.default),!i.type&&l.type&&(i.type=l.type)}return i},u=t=>{const{$ref:i,...c}=t;return c},o=(t,i)=>{let c=a(t);for(const l of i){if(!c)return null;if(/^\d+$/.test(l)){const v=Array.isArray(c.items)?c.items[Number(l)]:c.items;c=v?a(v):null;continue}const j=c.properties;if(j&&!m.has(l)&&l in j){c=a(j[l]);continue}const p=c.additionalProperties;if(p&&typeof p=="object"){c=a(p);continue}return null}return c},g=(t,i,c)=>{if(!t)return null;const l={};if(t.description&&(l.description=t.description),t.type&&(l.type=t.type),t.default!==void 0&&(l.default=t.default),t.enum&&(l.enum=t.enum),t.const!==void 0&&(l.const=t.const),t.deprecated&&(l.deprecated=!0),t.examples&&(l.examples=t.examples),t.properties&&(l.knownChildren=Object.keys(t.properties)),c&&(i!=null&&i.includes(c))&&(l.required=!0),t.items&&!Array.isArray(t.items)){const j=a(t.items),p=g(j,void 0,null);p&&(l.itemsInfo=p)}return(t.additionalProperties===!0||typeof t.additionalProperties=="object")&&(l.open=!0),l},d=t=>i=>{if(i.length===0)return g(a(t),void 0,null);const c=o(t,i.slice(0,-1));if(!c)return null;const l=i[i.length-1],j=o(c,[l]);return g(j,c.required,l)},h=t=>{const i=a(t);return Object.keys(i.properties??{})},y=t=>({at:d(t),rootKeys:()=>h(t),rootedAt:i=>{const c=o(t,i);return y(c??{})}});return y(r)}function q(e){return Array.from(new Set(e))}let $=null;function D(){return $||($=M(K)),$}export{G as E,D as s,V as u};
1
+ import{aB as b,al as n,S as N,aW as O}from"./index-BD0ufZqe.js";import{r as K}from"./claude-settings-schema-COigsajx.js";function G({node:e,targetScope:r,onOverride:s,schema:a,rootLabel:m}){const[f,x]=b.useState(""),[u,o]=b.useState(!0),g=[],d=e.kind==="object"&&Object.keys(e.children).length===0,y=((a==null?void 0:a.rootKeys())??[]).length>0;return n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:[n.jsxs("span",{className:"text-fg-faint",children:["merged · overrides → ",n.jsx("span",{className:"text-fg-dim",children:N[r].label})]}),y&&n.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:u,onChange:t=>o(t.target.checked),className:"accent-accent"}),"show unset keys"]}),n.jsx("div",{className:"flex-1"}),n.jsx("input",{value:f,onChange:t=>x(t.target.value),placeholder:"filter keys or descriptions…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-56"})]}),n.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 font-mono text-xs",children:d&&!u?n.jsx("div",{className:"text-fg-faint italic px-2 py-4",children:"no settings resolved — all scope files empty or missing"}):n.jsx(E,{node:e,path:g,label:m??"(root)",targetScope:r,onOverride:s,filter:f,depth:0,schema:a,showGhosts:u,defaultOpen:!0})})]})}function E(e){return e.node.kind==="object"?n.jsx(P,{...e,node:e.node}):e.node.kind==="array"?n.jsx(J,{...e,node:e.node}):n.jsx(R,{...e,node:e.node})}function A(e,r){return r.trim()?e.toLowerCase().includes(r.toLowerCase()):!0}function w(e,r,s){return!!(!s.trim()||e.some(a=>A(a,s))||r!=null&&r.description&&A(r.description,s))}function P({node:e,path:r,label:s,targetScope:a,onOverride:m,filter:f,depth:x,schema:u,showGhosts:o,defaultOpen:g}){const[d,h]=b.useState(g??x<2),y=(u==null?void 0:u.at(r))??null,t=new Set(Object.keys(e.children)),i=o?(y==null?void 0:y.knownChildren)??[]:[],c=Array.from(new Set([...t,...i])).sort(),l=b.useMemo(()=>f.trim()?c.filter(p=>{const v=(u==null?void 0:u.at([...r,p]))??null;return w([...r,p],v,f)?!0:t.has(p)?L(e.children[p],[...r,p],f,u):!1}):c,[c.join(","),f,e,r.join("."),u]);if(f.trim()&&l.length===0&&!w(r,y,f))return null;if(r.length===0)return n.jsx("div",{children:l.map(p=>j(p))});return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:x*14},onClick:()=>h(!d),children:[n.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:d?"▾":"▸"}),n.jsx("span",{className:"text-fg",children:s}),n.jsxs("span",{className:"text-fg-faint",children:[" {",t.size,i.length>t.size?`/${new Set([...t,...i]).size}`:"","}"]}),(y==null?void 0:y.description)&&n.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:y.description,children:["— ",y.description]})]}),d&&l.map(p=>j(p))]});function j(p){if(t.has(p))return n.jsx(E,{node:e.children[p],path:[...r,p],label:p,targetScope:a,onOverride:m,filter:f,depth:x+1,schema:u,showGhosts:o},p);const v=(u==null?void 0:u.at([...r,p]))??null;return v?n.jsx(I,{path:[...r,p],label:p,info:v,targetScope:a,onSet:m,depth:x+1,filter:f},p):null}}function L(e,r,s,a){const m=(a==null?void 0:a.at(r))??null;if(w(r,m,s))return!0;if(e.kind!=="object")return!1;for(const f of Object.keys(e.children))if(L(e.children[f],[...r,f],s,a))return!0;return!1}function J({node:e,path:r,label:s,filter:a,depth:m,schema:f}){const[x,u]=b.useState(!0),o=(f==null?void 0:f.at(r))??null;return w(r,o,a)?n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:m*14},onClick:()=>u(!x),children:[n.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:x?"▾":"▸"}),n.jsx("span",{className:"text-fg",children:s}),n.jsxs("span",{className:"text-fg-faint",children:[" [",e.items.length,"]"]}),n.jsx(S,{tone:"warn",children:"accumulated"}),(o==null?void 0:o.description)&&n.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:o.description,children:["— ",o.description]})]}),x&&e.items.map((g,d)=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",style:{paddingLeft:(m+1)*14},children:[n.jsx("span",{className:"text-fg-faint w-3 shrink-0"}),n.jsxs("span",{className:"text-fg-faint",children:[d,":"]}),n.jsx("span",{className:"text-fg-dim truncate max-w-xl",children:k(g.value)}),n.jsx(C,{scope:g.fromScope})]},d))]}):null}function R({node:e,path:r,label:s,targetScope:a,onOverride:m,filter:f,depth:x,schema:u}){const[o,g]=b.useState(!1),d=(u==null?void 0:u.at(r))??null;if(!w(r,d,f))return null;const h=e.winner!==a,y=e.shadowed.length>0;return n.jsxs("div",{children:[n.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded",style:{paddingLeft:x*14},children:[n.jsx("span",{className:`w-3 shrink-0 ${y?"text-fg-faint cursor-pointer":""}`,onClick:()=>y&&g(!o),children:y?o?"▾":"▸":""}),n.jsxs("span",{className:"text-fg",children:[s,":"]}),n.jsx("span",{className:"text-fg-dim truncate max-w-md",children:k(e.value)}),n.jsx(C,{scope:e.winner}),(d==null?void 0:d.deprecated)&&n.jsx(S,{tone:"warn",children:"deprecated"}),(d==null?void 0:d.default)!==void 0&&_(e.value,d.default)&&n.jsx(S,{tone:"dim",children:"= default"}),e.typeMismatch&&n.jsx("span",{className:"text-yellow-500/80",title:"shadowed scopes have a different value type",children:"⚠"}),(d==null?void 0:d.description)&&n.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:d.description,children:["— ",d.description]}),n.jsx("div",{className:"flex-1"}),(d==null?void 0:d.enum)&&n.jsx(F,{values:d.enum}),n.jsx("button",{disabled:!h,onClick:()=>m(r,e.value),className:`opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border rounded transition-opacity ${h?"border-accent/50 text-accent hover:bg-accent hover:text-bg":"border-line text-fg-faint cursor-not-allowed"}`,title:h?`copy into ${N[a].label} draft`:`already winning in ${N[a].label}`,children:"override"})]}),o&&e.shadowed.map((t,i)=>n.jsxs("div",{className:"flex items-center gap-2 py-0.5 text-fg-faint line-through",style:{paddingLeft:(x+1)*14+12},children:[n.jsx("span",{children:"shadowed:"}),n.jsx("span",{className:"truncate max-w-xl",children:k(t.value)}),n.jsx(C,{scope:t.scope,dim:!0})]},i))]})}function I({path:e,label:r,info:s,targetScope:a,onSet:m,depth:f,filter:x}){if(!w(e,s,x))return null;const u=s.default!==void 0?s.default:B(s.type),o=Array.isArray(s.type)?s.type.join("|"):s.type??"?";return n.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded opacity-60",style:{paddingLeft:f*14},children:[n.jsx("span",{className:"w-3 shrink-0"}),n.jsx("span",{className:"text-fg-dim",children:r}),n.jsx(S,{tone:"dim",children:o}),s.required&&n.jsx(S,{tone:"warn",children:"required"}),s.default!==void 0&&n.jsxs("span",{className:"text-fg-faint",children:["default: ",k(s.default)]}),s.description&&n.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:s.description,children:["— ",s.description]}),n.jsx("div",{className:"flex-1"}),s.enum&&n.jsx(F,{values:s.enum}),n.jsx("button",{onClick:()=>m(e,u),className:"opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg transition-opacity",title:`write to ${N[a].label} draft`,children:"set"})]})}function _(e,r){return e===r?!0:typeof e!=typeof r?!1:e&&r&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(r):!1}function B(e){switch(Array.isArray(e)?e[0]:e){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};case"null":return null;default:return null}}function k(e){if(typeof e=="string")return JSON.stringify(e);if(e===null)return"null";if(typeof e=="object"){const r=JSON.stringify(e);return r.length>100?r.slice(0,100)+"…":r}return String(e)}function C({scope:e,dim:r}){const s=e==="user"?"bg-bg-hi text-fg-dim border-line":e==="project"?"bg-blue-950/30 text-blue-400/80 border-blue-900/40":"bg-purple-950/30 text-purple-400/80 border-purple-900/40";return n.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${s} ${r?"opacity-60":""}`,children:N[e].label})}function S({children:e,tone:r="default"}){const s={default:"bg-bg-hi text-fg-dim border-line",warn:"bg-yellow-950/30 text-yellow-500/80 border-yellow-900/40",dim:"bg-bg-elev text-fg-faint border-line"}[r];return n.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${s}`,children:e})}function F({values:e}){const r=e.map(s=>String(s)).join(" | ");return n.jsxs("span",{className:"text-[10px] text-fg-faint truncate max-w-xs",title:`allowed: ${r}`,children:["∈ ",r.length>30?r.slice(0,30)+"…":r]})}function V(e,r,s){const a=O(o=>o.files),m=O(o=>o.loadJson),f=O(o=>o.watchFile),x=O(o=>o.unwatchFile),u=b.useMemo(()=>{const o={};for(const g of e.scopes){const d=e.resolve(g,r??"",s);d&&(o[g]=d)}return o},[e,r,s]);return b.useEffect(()=>{const o=Object.values(u).filter(Boolean);return o.forEach(g=>{a[g]||m(g),f(g)}),()=>{o.forEach(g=>x(g))}},[JSON.stringify(u)]),u}function M(e){const r=e??{},s={...r.$defs??{},...r.definitions??{}},a=t=>{if(!t)return{};if(!t.$ref)return x(t);const i=/^#\/(\$defs|definitions)\/(.+)$/.exec(t.$ref);if(!i)return x(t);const c=s[i[2]];return c?a({...c,...u(t)}):x(t)},m=new Set(["__proto__","constructor","prototype"]),f=t=>{if(!t)return{};const i={};for(const[c,l]of Object.entries(t))m.has(c)||(i[c]=l);return i},x=t=>{if(!t.allOf||t.allOf.length===0)return t;const i={...t};delete i.allOf;for(const c of t.allOf){const l=a(c);Object.assign(i,{properties:{...f(i.properties),...f(l.properties)},required:q([...i.required??[],...l.required??[]])}),!i.description&&l.description&&(i.description=l.description),i.default===void 0&&l.default!==void 0&&(i.default=l.default),!i.type&&l.type&&(i.type=l.type)}return i},u=t=>{const{$ref:i,...c}=t;return c},o=(t,i)=>{let c=a(t);for(const l of i){if(!c)return null;if(/^\d+$/.test(l)){const v=Array.isArray(c.items)?c.items[Number(l)]:c.items;c=v?a(v):null;continue}const j=c.properties;if(j&&!m.has(l)&&l in j){c=a(j[l]);continue}const p=c.additionalProperties;if(p&&typeof p=="object"){c=a(p);continue}return null}return c},g=(t,i,c)=>{if(!t)return null;const l={};if(t.description&&(l.description=t.description),t.type&&(l.type=t.type),t.default!==void 0&&(l.default=t.default),t.enum&&(l.enum=t.enum),t.const!==void 0&&(l.const=t.const),t.deprecated&&(l.deprecated=!0),t.examples&&(l.examples=t.examples),t.properties&&(l.knownChildren=Object.keys(t.properties)),c&&(i!=null&&i.includes(c))&&(l.required=!0),t.items&&!Array.isArray(t.items)){const j=a(t.items),p=g(j,void 0,null);p&&(l.itemsInfo=p)}return(t.additionalProperties===!0||typeof t.additionalProperties=="object")&&(l.open=!0),l},d=t=>i=>{if(i.length===0)return g(a(t),void 0,null);const c=o(t,i.slice(0,-1));if(!c)return null;const l=i[i.length-1],j=o(c,[l]);return g(j,c.required,l)},h=t=>{const i=a(t);return Object.keys(i.properties??{})},y=t=>({at:d(t),rootKeys:()=>h(t),rootedAt:i=>{const c=o(t,i);return y(c??{})}});return y(r)}function q(e){return Array.from(new Set(e))}let $=null;function D(){return $||($=M(K)),$}export{G as E,D as s,V as u};
@@ -1,4 +1,4 @@
1
- import{al as k,F as E}from"./index-d4i3X1x3.js";function M({value:t,onChange:n,path:e,readOnly:i}){return k.jsx(E,{path:`file://${e}`,defaultLanguage:"markdown",value:t,onChange:s=>n(s??""),theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:13,fontFamily:"JetBrains Mono, ui-monospace, Menlo, monospace",lineNumbers:"on",renderLineHighlight:"line",scrollBeyondLastLine:!1,tabSize:2,wordWrap:"on",readOnly:i,automaticLayout:!0}})}const f=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,u="disable-model-invocation",g=/^\s*disable-model-invocation\s*:/;function j(t){const n=t.match(f);if(!n)return!1;for(const e of n[1].split(/\r?\n/)){if(!g.test(e))continue;const i=e.slice(e.indexOf(":")+1).trim().toLowerCase();return i==="true"||i==="yes"}return!1}function S(t){const n=t.trim();return n.length>=2&&(n[0]==='"'&&n[n.length-1]==='"'||n[0]==="'"&&n[n.length-1]==="'")?n.slice(1,-1):n}function h(t){return t.length-t.trimStart().length}function v(t){const n=t.match(f);if(!n)return{name:null,description:null,body:t};const e=n[1].split(/\r?\n/),i=n[2]??"";let s=null,r=null;for(let o=0;o<e.length;o++){const m=e[o],d=m.match(/^(\s*)(name|description)\s*:(.*)$/);if(!d)continue;const[,,y,$]=d,l=$.trim(),b=h(m);let c;if(l===""||l===">-"||l===">"||l==="|-"||l==="|"){const p=[];let a=o+1;for(;a<e.length&&e[a].trim()!==""&&h(e[a])>b;)p.push(e[a].trim()),a++;c=p.join(" ")}else c=S(l);y==="name"?s=c:r=c}return{name:s,description:r,body:i}}function w(t,n){const e=t.match(f);if(!e){if(!n)return t;const o=t.startsWith(`
1
+ import{al as k,F as E}from"./index-BD0ufZqe.js";function M({value:t,onChange:n,path:e,readOnly:i}){return k.jsx(E,{path:`file://${e}`,defaultLanguage:"markdown",value:t,onChange:s=>n(s??""),theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:13,fontFamily:"JetBrains Mono, ui-monospace, Menlo, monospace",lineNumbers:"on",renderLineHighlight:"line",scrollBeyondLastLine:!1,tabSize:2,wordWrap:"on",readOnly:i,automaticLayout:!0}})}const f=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,u="disable-model-invocation",g=/^\s*disable-model-invocation\s*:/;function j(t){const n=t.match(f);if(!n)return!1;for(const e of n[1].split(/\r?\n/)){if(!g.test(e))continue;const i=e.slice(e.indexOf(":")+1).trim().toLowerCase();return i==="true"||i==="yes"}return!1}function S(t){const n=t.trim();return n.length>=2&&(n[0]==='"'&&n[n.length-1]==='"'||n[0]==="'"&&n[n.length-1]==="'")?n.slice(1,-1):n}function h(t){return t.length-t.trimStart().length}function v(t){const n=t.match(f);if(!n)return{name:null,description:null,body:t};const e=n[1].split(/\r?\n/),i=n[2]??"";let s=null,r=null;for(let o=0;o<e.length;o++){const m=e[o],d=m.match(/^(\s*)(name|description)\s*:(.*)$/);if(!d)continue;const[,,y,$]=d,l=$.trim(),b=h(m);let c;if(l===""||l===">-"||l===">"||l==="|-"||l==="|"){const p=[];let a=o+1;for(;a<e.length&&e[a].trim()!==""&&h(e[a])>b;)p.push(e[a].trim()),a++;c=p.join(" ")}else c=S(l);y==="name"?s=c:r=c}return{name:s,description:r,body:i}}function w(t,n){const e=t.match(f);if(!e){if(!n)return t;const o=t.startsWith(`
2
2
  `)?"":`
3
3
  `;return`---
4
4
  ${u}: true
@@ -1 +1 @@
1
- import{V as e,b0 as a,aX as n}from"./index-d4i3X1x3.js";const c=new Set(e.map(t=>t.tag));function l(t){return t.filter(o=>c.has(o))}function s(t,o={}){return{name:t.name,originalName:t.name,description:t.description??"",tools:t.tools,model:t.model??"inherit",effort:t.effort??void 0,color:t.color??"",tags:l(t.tags),projects:t.projects,action:t.action??void 0,actionLabel:t.actionLabel??void 0,title:t.title??void 0,body:t.body,...o}}function d(t,o){const i=a();n([i?`${i}/.claude/agents`:null,t?`${t}/.claude/agents`:null],o)}export{s as a,l as t,d as u};
1
+ import{V as e,b0 as a,aX as n}from"./index-BD0ufZqe.js";const c=new Set(e.map(t=>t.tag));function l(t){return t.filter(o=>c.has(o))}function s(t,o={}){return{name:t.name,originalName:t.name,description:t.description??"",tools:t.tools,model:t.model??"inherit",effort:t.effort??void 0,color:t.color??"",tags:l(t.tags),projects:t.projects,action:t.action??void 0,actionLabel:t.actionLabel??void 0,title:t.title??void 0,body:t.body,...o}}function d(t,o){const i=a();n([i?`${i}/.claude/agents`:null,t?`${t}/.claude/agents`:null],o)}export{s as a,l as t,d as u};
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-d4i3X1x3.js"></script>
10
+ <script type="module" crossorigin src="./assets/index-BD0ufZqe.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-BnKaYERU.css">
@@ -72,7 +72,7 @@ ${i}`].join(`
72
72
 
73
73
  `);return hle({title:`[Customer ${s.tag}] ${s.title}`,goal:r,tag:f2e[s.tag],agentName:"architect",agentDescription:rGe,...n?{agentBody:n.text,agentPath:n.path}:{}})}function aGe({it:s,projectCwd:e}){const n=Pr(v=>v.setInboxStatus),i=Pr(v=>v.linkEpic),r=wn(v=>v.createPromptSession),[o,a]=R.useState(!1),[l,c]=R.useState(""),[d,u]=R.useState(!1),h=s.body.length>z_e,f=h&&!o?`${s.body.slice(0,z_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 oGe(s,e),x=await r(e,v,f2e[s.tag],void 0,"architect",w,y);await i(s.id,x.id),await n(s.id,"in_progress")}catch(v){ve.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:nGe[s.status]})]}),g.jsxs("div",{className:"font-mono text-[11px] text-fg-dim",children:[iGe[s.tag]," · ",new Date(gZ(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:h2e.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 lGe(){const s=Pr(a=>{var l;return((l=a.ownerInfo)==null?void 0:l.ownerMode)??!1}),e=Pr(a=>{var l;return((l=a.ownerInfo)==null?void 0:l.projectCwd)??null}),n=Pr(a=>a.inbox),i=Pr(a=>a.inboxLoading),r=Pr(a=>a.pullInbox),o=R.useMemo(()=>[...n].sort((a,l)=>gZ(l.receivedAt)-gZ(a.receivedAt)),[n]);return R.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(aGe,{it:a,projectCwd:e},a.id))]}):null}const cGe={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"}],uGe={bug:"Bug",feature:"Feature",discussion:"Discussion"},U_e=120,hGe=4e3;function fGe(){const s=Pr(v=>v.panelOpen),e=Pr(v=>v.draft),n=Pr(v=>v.items),i=Pr(v=>v.submitting),r=Pr(v=>v.closePanel),o=Pr(v=>v.setDraft),a=Pr(v=>v.submit),l=Pr(v=>v.load),c=Pr(v=>v.loadOwnerInfo),d=Pr(v=>v.refreshStatus),u=Pr(v=>v.markSeen),h=Pr(v=>{var w;return((w=v.ownerInfo)==null?void 0:w.ownerMode)===!0}),[f,p]=R.useState(!1),m=R.useMemo(()=>[...n].sort((v,w)=>w.submittedAt-v.submittedAt),[n]);if(R.useEffect(()=>{if(!s){p(!1);return}const v=requestAnimationFrame(()=>p(!0));return()=>cancelAnimationFrame(v)},[s]),R.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]),R.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 ${Vi.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,"/",U_e]})]}),g.jsx("input",{value:e.title,maxLength:U_e,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:hGe,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("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:cGe[v.status]})]}),g.jsxs("div",{className:"font-mono text-[11px] text-fg-dim",children:[uGe[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(lGe,{})]})]});return typeof document<"u"&&document.body?uS.createPortal(b,document.body):b}const pGe=3e4;function gGe(){const s=Tt(L=>L.tabs),e=Tt(L=>L.activeTabId),n=Tt(L=>L.closeTab),i=Tt(L=>L.setActive),r=Tt(L=>L.reorderTab),o=C2(L=>L.watchers),a=yi(L=>L.openPanel),l=yi(L=>L.openProjectPanel),c=yi(L=>L.setEpicsWorkspaceOpen),d=yi(L=>L.navFace==="home"),u=Pr(L=>L.items),h=Pr(L=>L.panelOpen),f=Pr(L=>L.togglePanel),p=Pr(L=>L.load),m=KUe(u)>0;R.useEffect(()=>{p()},[p]);const[_,b]=R.useState(()=>Date.now()),v=cle();R.useEffect(()=>{if(!v)return;b(Date.now());const L=window.setInterval(()=>b(Date.now()),1e3);return()=>window.clearInterval(L)},[v]);const w=L=>{for(const T of Object.values(o))if(T.tabId===L&&T.lastLineAt&&_-T.lastLineAt<pGe)return!0;return!1},{getTabDragProps:y,isDragging:x,containerRef:S}=qUe({tabCount:s.length,onReorder:r,onActivate:L=>{const T=s[L];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(jr,{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((L,T)=>{const I=L.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"} ${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:[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:L.status==="spawning"?.55:1}}),g.jsx("span",{className:"truncate max-w-[200px]",children:L.label}),L.status==="spawning"&&g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-butter animate-pulse",title:"spawning"}),w(L.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:B=>{B.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)})}),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(fGe,{})]})}function mGe(...s){}function _Ge(s){return Promise.reject(new Error("Not available in the web version"))}const bGe=new Set,vGe=new Set;function wGe(){for(const s of bGe)try{s()}catch{}}function mZ(){for(const s of vGe)try{s()}catch{}}function yGe(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 xGe(s){if(!window.speechSynthesis)return;const e=yGe(s);if(!e)return;const n=new SpeechSynthesisUtterance(e);n.rate=1,n.pitch=1,n.onstart=()=>{performance.now(),wGe()},n.onend=()=>{!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&mZ()},n.onerror=i=>{i.error!=="canceled"&&!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&mZ()},window.speechSynthesis.speak(n)}function CGe(){window.speechSynthesis&&(window.speechSynthesis.cancel(),mZ())}function a3(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 $n={debug:(s,e,n)=>a3(s,"debug",e,n),info:(s,e,n)=>a3(s,"info",e,n),warn:(s,e,n)=>a3(s,"warn",e,n),error:(s,e,n,i)=>a3(s,"error",e,n,i)};function G_e(){$t.getState().submitCountdownStartAt!==null&&$t.setState({submitCountdownStartAt:null})}let q_e=null;const l3=1e4;let S2=null;function bG(){S2&&(clearTimeout(S2),S2=null)}let HF=null,WF=null;function c3(){HF=null,WF&&(WF(),WF=null)}const SGe=1500,kGe=9e4;let SN=0,VF=null,_Z=-1;function kN(){VF&&(clearTimeout(VF),VF=null,_Z=-1)}const EGe=1800*1e3;let k2=null;function LGe(){k2&&(clearTimeout(k2),k2=null)}const $t=lo((s,e)=>{function n(){LGe(),k2=setTimeout(()=>{if(k2=null,e().isRecording||q_e){n();return}$n.info("voice","model idle timeout: releasing worker"),kN(),SN++,s({modelStatus:"idle",loadingProgress:0,error:null,errorKind:null})},EGe)}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;$n.info("voice","initModel: kicking off preload"),s({modelStatus:"loading",error:null,errorKind:null,loadingProgress:0});const i=++SN,r=()=>{i===SN&&(kN(),_Z=i,VF=setTimeout(()=>{_Z===i&&e().modelStatus==="loading"&&($n.warn("voice","mic.gate.timeout: no progress within 90s"),s({modelStatus:"error",error:"Model load timed out",errorKind:"timeout"}))},kGe))};r(),mGe((o,a)=>{i===SN&&(o==="ready"?(kN(),$n.info("voice","modelStatus -> ready"),s({modelStatus:"ready",loadingProgress:100,errorKind:null}),!e().isRecording&&!q_e&&n()):o==="error"?(kN(),$n.error("voice","modelStatus -> error",{msg:a}),s({modelStatus:"error",error:a,errorKind:"load"})):(r(),s({modelStatus:"loading"})))},o=>{i===SN&&(r(),s({loadingProgress:Math.round(o)}))})},resetAndRetryModel:()=>{$n.info("voice","mic.gate.retry"),kN(),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:()=>s(i=>({ttsEnabled:!i.ttsEnabled})),setAutoSubmit:i=>s({autoSubmit:i}),setSubmitDelayMs:i=>s({submitDelayMs:Math.max(500,Math.min(13e3,Math.floor(i)))}),cancelSubmit:()=>G_e(),setPartialsEnabled:i=>{e().partialsEnabled!==i&&(s({partialsEnabled:i}),i||s({lastPartial:""}))},clearError:()=>s({error:null,errorKind:null}),setPermissionState:i=>{e().permissionState!==i&&($n.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"?$n.warn("voice-turn","voice-turn.load_failed"):i==="runtime_error"?$n.warn("voice-turn","voice-turn.runtime_error"):i==="disabled"&&$n.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}=c6();if(i==="down"){if(d==="error"||d==="load-timeout"){l.resetAndRetryModel(),$n.info("voice-hotkey","down.retry",{source:r,reason:d});return}if(!c&&d!=="loading"){$n.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"}),bG(),S2=setTimeout(()=>{e().hotkeyState==="stopping"&&($n.warn("voice-hotkey","drain-timeout",{durationMs:l3}),s({hotkeyState:"aborted"}),setTimeout(()=>{e().hotkeyState==="aborted"&&s({hotkeyState:"idle"})},0))},l3),l.stopRecording());return}if(d==="loading"){l.hotkeyState!=="armed"&&(s({hotkeyState:"armed"}),$n.info("voice-hotkey","armed",{source:r,modelStatus:l.modelStatus})),c3(),HF={tabId:a,source:r,mode:o},WF=$t.subscribe((u,h)=>{if(HF&&u.modelStatus==="ready"&&h.modelStatus!=="ready"&&u.hotkeyState==="armed"){const f=HF;if(c3(),!f.tabId){$n.warn("voice-hotkey","armed-promote-no-tab",{source:f.source}),s({hotkeyState:"idle"});return}$n.info("voice-hotkey","armed-promote",f),s({hotkeyState:"recording"}),$t.getState().startRecording(f.tabId)}});return}if(!a){$n.warn("voice-hotkey","no-active-tab",{source:r});return}$n.info("voice-hotkey","start",{source:r,mode:o,tabId:a}),l.startRecording(a),e().isRecording?s({hotkeyState:"recording"}):($n.warn("voice-hotkey","start: recording did not engage",{errorKind:e().errorKind}),s({hotkeyState:"idle"}));return}if(!(o!=="hold"||r==="global")){if(l.hotkeyState==="armed"){c3(),$n.info("voice-hotkey","miss-model-loading-armed-up"),s({hotkeyState:"idle"});return}l.hotkeyState==="recording"&&(s({hotkeyState:"stopping"}),bG(),S2=setTimeout(()=>{e().hotkeyState==="stopping"&&($n.warn("voice-hotkey","drain-timeout",{durationMs:l3}),s({hotkeyState:"aborted"}),setTimeout(()=>{e().hotkeyState==="aborted"&&s({hotkeyState:"idle"})},0))},l3),l.stopRecording())}},destroyHotkey:()=>{const i=e();if(c3(),G_e(),i.hotkeyState==="recording"){$n.warn("voice-hotkey","destroyed-mid-recording"),s({hotkeyState:"destroyed"});try{i.stopRecording()}catch{}}else(i.hotkeyState==="armed"||i.hotkeyState==="stopping")&&(bG(),s({hotkeyState:"destroyed"}))}}}),DGe=s=>({isRecording:s.isRecording,statusPill:s.statusPill,lastPartial:s.lastPartial,lastTranscript:s.lastTranscript,submitCountdownStartAt:s.submitCountdownStartAt}),c6=s=>({canRecord:!1,reason:"unsupported"});if(typeof window<"u"){const s=window;s.__voice=$t,s.__transcripts=[]}const dA=6e4,TGe=3e5,NGe=.25,IGe=5e3,uA=lo(()=>({data:null,refreshing:!1}));let K_e=!1,$F=null,vG=dA,d3=!1,Vm=null;function RGe(s,e){if(s.kind==="ok")return{delayMs:dA,nextBackoffMs:dA};const n=Math.min(e*2,TGe),i=n*NGe;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 Y_e(){return ile(window.api.billing.fetch(),IGe,"billing.fetch")}function X_e(s){uA.setState({data:s,refreshing:!1})}async function fle(){uA.setState({refreshing:!0});let s=dA;try{const e=await Y_e();Vm&&(Vm.cancel(),Vm=null),X_e(e);const{delayMs:n,nextBackoffMs:i}=RGe(e,vG);vG=i,s=n}catch(e){vG=dA,uA.setState({refreshing:!1});const n=KIe({error:e,retry:Y_e,onRetrySuccess:i=>{Vm=null,X_e(i)},onStillFailing:i=>{Vm=null,d3||(d3=!0,ve.warn(`Billing usage fetch: ${i}`))}});if(n)Vm=n;else if(!d3){d3=!0;const i=e instanceof Error?e.message:String(e);ve.warn(`Billing usage fetch failed: ${i}`)}}$F=setTimeout(fle,s)}function AGe(){K_e||(K_e=!0,fle())}function p2e(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 MGe(){$F!==null&&(clearTimeout($F),$F=null),Vm&&(Vm.cancel(),Vm=null),fle()}function sw(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 yf(s){const e=/(opus|sonnet|haiku|fable)/i.exec(s);return e?e[1].toLowerCase():null}const u3=new Map,PGe=3e4;function ple(s){const[e,n]=R.useState(()=>{var i;return s?((i=u3.get(s))==null?void 0:i.value)??null:null});return R.useEffect(()=>{if(!s){n(null);return}let i=!1;return(async()=>{const o=u3.get(s);if(o&&Date.now()-o.ts<PGe){i||n(o.value);return}try{const a=await window.api.app.gitBranch(s);if(i)return;u3.set(s,{value:a,ts:Date.now()}),n(a)}catch{if(i)return;u3.set(s,{value:null,ts:Date.now()}),n(null)}})(),()=>{i=!0}},[s]),e}const g2e="~/.claude/session-manager/ui-chrome-prefs.json",OGe=180,FGe=480,bZ=252,ry={sidebarWidth:bZ,sidebarCollapsed:!1,collapsedGroups:[],learningPanelCollapsed:!1,tourCompletedAt:null,density:"roomy"};function vZ(s){return Math.min(FGe,Math.max(OGe,s))}let Pv=null,zF={};function jGe(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};window.api.config.writeJson(g2e,i).catch(()=>{})};s().hydrated||!Pv?e():Pv.then(e)}function bk(s,e,n){s(n),!e().hydrated&&Pv&&Object.assign(zF,n),jGe(e)}const _o=lo((s,e)=>({...ry,hydrated:!1,hydrate:()=>e().hydrated?Promise.resolve():Pv||(Pv=(async()=>{try{const n=await window.api.config.readJson(g2e);if(n.exists&&n.data&&typeof n.data=="object"){const i=n.data;s({sidebarWidth:typeof i.sidebarWidth=="number"?vZ(i.sidebarWidth):ry.sidebarWidth,sidebarCollapsed:i.sidebarCollapsed??ry.sidebarCollapsed,collapsedGroups:Array.isArray(i.collapsedGroups)?i.collapsedGroups:ry.collapsedGroups,learningPanelCollapsed:i.learningPanelCollapsed??ry.learningPanelCollapsed,tourCompletedAt:typeof i.tourCompletedAt=="number"?i.tourCompletedAt:ry.tourCompletedAt,density:i.density==="compact"?"compact":ry.density,...zF,hydrated:!0});return}}catch{}s({...zF,hydrated:!0})})().finally(()=>{Pv=null,zF={}}),Pv),setSidebarWidth:n=>bk(s,e,{sidebarWidth:vZ(n)}),setSidebarCollapsed:n=>bk(s,e,{sidebarCollapsed:n}),setCollapsedGroups:n=>bk(s,e,{collapsedGroups:n}),setLearningPanelCollapsed:n=>bk(s,e,{learningPanelCollapsed:n}),setTourCompletedAt:n=>bk(s,e,{tourCompletedAt:n}),setDensity:n=>bk(s,e,{density:n})}));function BGe(s){return s.filter(e=>e.group==="Tools").map(({key:e,label:n,icon:i,hint:r})=>({key:e,label:n,icon:i,hint:r}))}const HGe=52;function WGe(s){return new Set(s.filter(e=>e==="Workspace"||e==="Configure"||e==="Tools"))}function VGe(){const s=Tt(n=>{var i;return((i=n.tabs.find(r=>r.id===n.activeTabId))==null?void 0:i.cwd)??null});return{scheduler:ml(n=>{var i;return(((i=n.snapshot)==null?void 0:i.jobs)??[]).some(r=>r.status==="running"&&(!s||r.cwd===s))})}}function $Ge({active:s,onNavigate:e,onNewSession:n}){const i=_o(F=>F.hydrated),r=_o(F=>F.hydrate);R.useEffect(()=>{i||r()},[i,r]);const o=_o(F=>F.collapsedGroups),a=_o(F=>F.setCollapsedGroups),l=R.useMemo(()=>WGe(o),[o]),c=R.useCallback(F=>{const H=new Set(l);H.has(F)?H.delete(F):H.add(F),a(Array.from(H))},[l,a]),d=_o(F=>F.sidebarCollapsed),u=_o(F=>F.setSidebarCollapsed),h=R.useCallback(()=>{u(!d)},[d,u]),f=Tt(F=>F.tabs),p=Tt(F=>F.activeTabId),m=f.find(F=>F.id===p)??null,_=VGe(),b=yi(F=>F.navFace),v=OUe(b),w=v.filter(F=>F.group==="Workspace"),y=v.filter(F=>F.group==="Configure"),x=BGe(v),S=b==="home"&&!d,E=_o(F=>F.sidebarWidth),L=_o(F=>F.setSidebarWidth),[T,I]=R.useState(E),A=R.useRef(T);A.current=T,R.useEffect(()=>{I(E)},[E]);const P=R.useCallback(F=>{F.preventDefault();const H=F.clientX,W=A.current;let G=W;const J=O=>{G=vZ(W+(O.clientX-H)),I(G)},Y=()=>{window.removeEventListener("pointermove",J),window.removeEventListener("pointerup",Y),document.body.style.cursor="",document.body.style.userSelect="",L(G)};window.addEventListener("pointermove",J),window.addEventListener("pointerup",Y),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[L]),B=R.useCallback(()=>{I(bZ),L(bZ)},[L]);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?HGe:T},"data-testid":"tour-leftnav","aria-label":"Primary navigation",children:[g.jsx(zGe,{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(wG,{label:"Workspace",desc:mG.Workspace,collapsed:l.has("Workspace"),count:w.length,onToggle:()=>c("Workspace")}),!l.has("Workspace")&&w.map(F=>g.jsx(yG,{item:F,active:s===F.key,live:F.liveKind?_[F.liveKind]:!1,onClick:()=>e(F.key),rail:!1},F.key)),g.jsx(wG,{label:"Configure",desc:mG.Configure,collapsed:l.has("Configure"),count:y.length,onToggle:()=>c("Configure")}),!l.has("Configure")&&y.map(F=>g.jsx(yG,{item:F,active:s===F.key,live:!1,onClick:()=>e(F.key),rail:!1},F.key)),x.length>0&&g.jsx(wG,{label:"Tools",desc:mG.Tools,collapsed:l.has("Tools"),count:x.length,onToggle:()=>c("Tools")}),x.length>0&&!l.has("Tools")&&x.map(F=>g.jsx(Z_e,{tool:F,active:s===F.key,onClick:()=>e(F.key),rail:!1},F.key))]}):g.jsx("div",{className:"pt-2",children:v.map(F=>F.group==="Tools"?g.jsx(Z_e,{tool:{key:F.key,label:F.label,icon:F.icon,hint:F.hint},active:s===F.key,onClick:()=>e(F.key),rail:d},F.key):g.jsx(yG,{item:F,active:s===F.key,live:F.liveKind?_[F.liveKind]:!1,onClick:()=>e(F.key),rail:d},F.key))})}),g.jsx(UGe,{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:B,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 zGe({tab:s,navFace:e,onNewSession:n,rail:i,onToggleRail:r}){const o=(s==null?void 0:s.label)??"no session",a=ple((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(jr,{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(jr,{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(jr,{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(jr,{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(jr,{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(jr,{name:"plus",size:13,stroke:1.8}),"Open / Start Project"]})})]})}function wG({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 yG({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(jr,{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 Z_e({tool:s,active:e,onClick:n,rail:i}){return g.jsxs("button",{onClick:n,title:s.hint,className:`relative w-full flex items-center rounded-[10px] text-left mb-0.5 transition-colors ${i?"justify-center px-0 py-[7px]":"gap-3 px-3.5 py-[7px] text-[13px]"} ${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-1.5 bottom-1.5 w-[3px] rounded-sm bg-accent ${i?"-left-[4px]":"-left-[10px]"}`}),g.jsx("span",{className:`inline-flex ${e?"text-accent":"text-fg-faint"}`,children:g.jsx(jr,{name:s.icon,size:15,stroke:1.6})}),!i&&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})]})]})}function UGe({rail:s,navFace:e}){const n=$t(c=>c.isRecording),i=Tt(c=>c.tabs),r=Tt(c=>c.activeTabId),o=i.find(c=>c.id===r)??null,[a,l]=R.useState(null);return R.useEffect(()=>{let c=!1;if(!(o!=null&&o.presetId)){l(null);return}return WIe(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 · ${sw(a)}`:"Claude Code"})]})}function GGe(s,e,n){return e?s.map(i=>i.id===e?{...i,lastActivityAt:n}:i):s}function qGe(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 KGe(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=GGe(s.agents,l==null?void 0:l.toolUseId,i);break}}return{next:r,newActivity:o}}const UF=lo((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]:qGe(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 on(async()=>{const{toast:h}=await Promise.resolve().then(()=>zIe);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}=KGe(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 YGe(s){const e=UF(r=>r.subscribe),n=UF(r=>r.unsubscribe),i=UF(r=>s?r.tabs[s.id]:void 0);return R.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 m2e(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 wZ(s){return!s||typeof s.utilization!="number"||Number.isNaN(s.utilization)?null:Math.round(s.utilization)}function J_e(s,e){const n=wZ(e);if(n==null)return`${s} — usage unavailable`;const i=m2e((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 XGe(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 _2e=R.createContext(null);function ZGe({panelId:s,children:e}){return g.jsx(_2e.Provider,{value:s,children:e})}function hS(s){const e=R.useContext(_2e),n=s??e;return yi(i=>n==null||i.focusedPanelId===n)}function gle(s){const e=hS(s),n=R.useRef(e);return n.current=e,n}const JGe=5e3;let Uy=null;const yZ=new Set;let xG=0,E2=null;function QGe(){yZ.forEach(s=>s())}async function d6(){try{Uy=await window.api.schedule.sessionSlots(),QGe()}catch{}}const eqe=0,tqe=10;async function b2e(s){Uy||await d6();const e=Uy?Uy.min:eqe,n=Uy?Uy.max:tqe,i=Math.min(n,Math.max(e,Math.round(s)));await window.api.schedule.setSessionSlots(i),await d6()}function nqe(){E2==null&&(d6(),E2=setInterval(()=>{d6()},JGe))}function iqe(){E2!=null&&(clearInterval(E2),E2=null)}function zP(s){const e=hS(s),[,n]=R.useState(0);return R.useEffect(()=>{const i=()=>n(r=>r+1);return yZ.add(i),()=>{yZ.delete(i)}},[]),R.useEffect(()=>{if(e)return xG+=1,nqe(),()=>{xG-=1,xG<=0&&iqe()}},[e]),Uy}const sqe=360*60*1e3;let v2e=null;const xZ=new Set;let CG=0,L2=null;async function Q_e(){try{v2e=await window.api.app.updateStatus(),xZ.forEach(s=>s())}catch{}}function rqe(){L2==null&&(Q_e(),L2=setInterval(()=>{Q_e()},sqe))}function oqe(){L2!=null&&(clearInterval(L2),L2=null)}function aqe(){const[,s]=R.useState(0);return R.useEffect(()=>{const e=()=>s(n=>n+1);return xZ.add(e),CG+=1,rqe(),()=>{xZ.delete(e),CG-=1,CG<=0&&oqe()}},[]),v2e}let w2e=null;const CZ=new Set;let SG=0,GF=null,SZ=!1;function ebe(s){w2e=s,CZ.forEach(e=>e())}function lqe(){SZ||(SZ=!0,GF=window.api.updater.onStatus(ebe),window.api.updater.status().then(ebe).catch(()=>{}))}function cqe(){SZ=!1,GF&&(GF(),GF=null)}function y2e(){const[,s]=R.useState(0);return R.useEffect(()=>{const e=()=>s(n=>n+1);return CZ.add(e),SG+=1,lqe(),()=>{CZ.delete(e),SG-=1,SG<=0&&cqe()}},[]),w2e}function x2e({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 dqe({onNavigate:s}){const e=Tt(W=>W.tabs),n=Tt(W=>W.activeTabId),i=e.find(W=>W.id===n)??null,r=YGe(i),o=(r==null?void 0:r.lastEventAt)??0,a=uA(W=>W.data),l=ml(W=>{var G;return((G=W.snapshot)==null?void 0:G.paused)??null}),c=ple((i==null?void 0:i.cwd)??null),d=zP(),u=aqe(),h=y2e(),f=so(W=>W.show),[,p]=R.useState(0);R.useEffect(()=>{const W=setInterval(()=>p(G=>G+1),6e4);return()=>clearInterval(W)},[]);const m=async()=>{const W=(h==null?void 0:h.latest)??"";try{const G=await window.api.updater.install(!1),J=(G==null?void 0:G.status)??await window.api.updater.status();(J==null?void 0:J.state)==="deferred"&&f("info",`Update v${W} will install when ${J.busyReason??"running jobs"} finish`)}catch(G){f("error",G instanceof Error?G.message:String(G))}},_=(r==null?void 0:r.todos)??[],[b,v]=R.useState(!1),w=R.useRef(null);R.useEffect(()=>{if(!b)return;const W=G=>{w.current&&!w.current.contains(G.target)&&v(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[b]),R.useEffect(()=>{_.length===0&&v(!1)},[_.length]);const y=p2e(a),x=(y==null?void 0:y.usage.five_hour)??null,S=(y==null?void 0:y.usage.seven_day)??null,E=wZ(x),L=wZ(S),T=(a==null?void 0:a.kind)==="ok"||(a==null?void 0:a.kind)==="ok-stale",I=o>0?fqe(Date.now()-o):"—",A=(d==null?void 0:d.total)??5,P=d?Math.min(Math.max(d.inUse,0),d.total):0,B=d?`${P} / ${A}`:`— / ${A}`,F=d&&d.holders.length>0?`
74
74
  `+d.holders.slice(0,5).map(W=>W.owner).join(`
75
- `):"",H=`${B} 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:J_e("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:J_e("Weekly window (all models)",S),"data-testid":"footer-usage-weekly",children:["weekly ",g.jsx("span",{className:"text-fg",children:L!=null?`${L}%`:"—"})]}),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:I})]}),_.length>0&&g.jsx(uqe,{ref:w,todos:_,open:b,onToggle:()=>v(W=>!W)}),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:H,"data-testid":"footer-active-sessions",children:d&&d.total===0?g.jsx("span",{className:"text-fg-faint",children:"pool paused"}):g.jsx(x2e,{total:A,inUse:(d==null?void 0:d.inUse)??0,size:"sm"})}),(h==null?void 0:h.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",h.latest]}):(h==null?void 0:h.state)==="deferred"?g.jsxs("span",{className:"text-amber-300",title:`Waiting for ${h.busyReason??"running jobs"} to finish before restarting`,"data-testid":"footer-version",children:["v",h.latest," installs when idle"]}):(h==null?void 0:h.state)==="downloading"?g.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["Downloading v",h.latest,"…"]}):u!=null&&u.behind&&u.latest&&u.channel==="installer"?g.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:`v${u.current} → v${u.latest}`,"data-testid":"footer-version",onClick:()=>{const W=u.downloadUrl;W&&window.api.shell.open({as:"external",url:W}).catch(()=>{f("error",`Couldn't open URL: ${W}`)})},children:["Download v",u.latest]}):u!=null&&u.behind&&u.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",u.current," → v",u.latest]}):g.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["v",(u==null?void 0:u.current)??"0.124.1"]})]})}const uqe=R.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 ${Vi.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(hqe,{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 hqe({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 fqe(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 pqe({onClose:s,onSent:e}){const n=Tt(L=>L.tabs),[i,r]=R.useState(""),[o,a]=R.useState(()=>Object.fromEntries(n.map(L=>[L.id,!0]))),[l,c]=R.useState(!1),[d,u]=R.useState({}),h=R.useRef(null),f=R.useRef(e);R.useEffect(()=>{f.current=e},[e]),R.useEffect(()=>{a(L=>{const T={};for(const I of n)T[I.id]=L[I.id]??!0;return T})},[n]),R.useEffect(()=>{var L;(L=h.current)==null||L.focus()},[]),R.useEffect(()=>window.api.pty.onWriteError(T=>{u(I=>T.tabId in I?{...I,[T.tabId]:"skipped"}:I)}),[]),R.useEffect(()=>{if(Object.keys(d).length===0)return;const L=Object.values(d).filter(I=>I==="sent").length,T=window.setTimeout(()=>f.current(L),1500);return()=>window.clearTimeout(T)},[d]);const p=n.filter(L=>o[L.id]).map(L=>L.id),m=p.length,_=Object.keys(d).length>0,b=i.length>0&&m>0&&!l&&!_,v=()=>{if(!b)return;c(!0);const L=Tt.getState().tabs,T=new Set(L.map(A=>A.id)),I={};for(const A of p)T.has(A)?(window.api.pty.write({tabId:A,data:i+"\r"}),I[A]="sent"):I[A]="skipped";u(I),c(!1)},w=L=>{if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),s();return}L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),v())},y=n.length>0&&n.every(L=>o[L.id]),x=()=>{const L=!y;a(Object.fromEntries(n.map(T=>[T.id,L])))},S=Object.values(d).some(L=>L==="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: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"}),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(L=>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[L.id],onChange:T=>a(I=>({...I,[L.id]:T.target.checked})),className:"accent-accent"}),g.jsx("span",{className:"truncate max-w-[12rem]",children:L.label}),d[L.id]==="sent"&&g.jsx("span",{"data-testid":"broadcast-row-sent",className:"text-[10px] text-green-500",children:"✓"}),d[L.id]==="skipped"&&g.jsx("span",{"data-testid":"broadcast-row-skipped",className:"text-[10px] text-red-400",children:"×"})]},L.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 gqe({tabId:s,cwd:e,onClose:n}){const i=C2(m=>m.watchersForTab(s)),r=C2(m=>m.add),o=C2(m=>m.remove),a=R.useRef(null),[l,c]=R.useState(""),[d,u]=R.useState(""),[h,f]=R.useState(!1);R.useEffect(()=>{const m=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),R.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)})})]})}/**
75
+ `):"",H=`${B} 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:J_e("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:J_e("Weekly window (all models)",S),"data-testid":"footer-usage-weekly",children:["weekly ",g.jsx("span",{className:"text-fg",children:L!=null?`${L}%`:"—"})]}),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:I})]}),_.length>0&&g.jsx(uqe,{ref:w,todos:_,open:b,onToggle:()=>v(W=>!W)}),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:H,"data-testid":"footer-active-sessions",children:d&&d.total===0?g.jsx("span",{className:"text-fg-faint",children:"pool paused"}):g.jsx(x2e,{total:A,inUse:(d==null?void 0:d.inUse)??0,size:"sm"})}),(h==null?void 0:h.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",h.latest]}):(h==null?void 0:h.state)==="deferred"?g.jsxs("span",{className:"text-amber-300",title:`Waiting for ${h.busyReason??"running jobs"} to finish before restarting`,"data-testid":"footer-version",children:["v",h.latest," installs when idle"]}):(h==null?void 0:h.state)==="downloading"?g.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["Downloading v",h.latest,"…"]}):u!=null&&u.behind&&u.latest&&u.channel==="installer"?g.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:`v${u.current} → v${u.latest}`,"data-testid":"footer-version",onClick:()=>{const W=u.downloadUrl;W&&window.api.shell.open({as:"external",url:W}).catch(()=>{f("error",`Couldn't open URL: ${W}`)})},children:["Download v",u.latest]}):u!=null&&u.behind&&u.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",u.current," → v",u.latest]}):g.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["v",(u==null?void 0:u.current)??"0.125.0"]})]})}const uqe=R.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 ${Vi.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(hqe,{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 hqe({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 fqe(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 pqe({onClose:s,onSent:e}){const n=Tt(L=>L.tabs),[i,r]=R.useState(""),[o,a]=R.useState(()=>Object.fromEntries(n.map(L=>[L.id,!0]))),[l,c]=R.useState(!1),[d,u]=R.useState({}),h=R.useRef(null),f=R.useRef(e);R.useEffect(()=>{f.current=e},[e]),R.useEffect(()=>{a(L=>{const T={};for(const I of n)T[I.id]=L[I.id]??!0;return T})},[n]),R.useEffect(()=>{var L;(L=h.current)==null||L.focus()},[]),R.useEffect(()=>window.api.pty.onWriteError(T=>{u(I=>T.tabId in I?{...I,[T.tabId]:"skipped"}:I)}),[]),R.useEffect(()=>{if(Object.keys(d).length===0)return;const L=Object.values(d).filter(I=>I==="sent").length,T=window.setTimeout(()=>f.current(L),1500);return()=>window.clearTimeout(T)},[d]);const p=n.filter(L=>o[L.id]).map(L=>L.id),m=p.length,_=Object.keys(d).length>0,b=i.length>0&&m>0&&!l&&!_,v=()=>{if(!b)return;c(!0);const L=Tt.getState().tabs,T=new Set(L.map(A=>A.id)),I={};for(const A of p)T.has(A)?(window.api.pty.write({tabId:A,data:i+"\r"}),I[A]="sent"):I[A]="skipped";u(I),c(!1)},w=L=>{if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),s();return}L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),v())},y=n.length>0&&n.every(L=>o[L.id]),x=()=>{const L=!y;a(Object.fromEntries(n.map(T=>[T.id,L])))},S=Object.values(d).some(L=>L==="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: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"}),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(L=>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[L.id],onChange:T=>a(I=>({...I,[L.id]:T.target.checked})),className:"accent-accent"}),g.jsx("span",{className:"truncate max-w-[12rem]",children:L.label}),d[L.id]==="sent"&&g.jsx("span",{"data-testid":"broadcast-row-sent",className:"text-[10px] text-green-500",children:"✓"}),d[L.id]==="skipped"&&g.jsx("span",{"data-testid":"broadcast-row-skipped",className:"text-[10px] text-red-400",children:"×"})]},L.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 gqe({tabId:s,cwd:e,onClose:n}){const i=C2(m=>m.watchersForTab(s)),r=C2(m=>m.add),o=C2(m=>m.remove),a=R.useRef(null),[l,c]=R.useState(""),[d,u]=R.useState(""),[h,f]=R.useState(!1);R.useEffect(()=>{const m=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),R.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)})})]})}/**
76
76
  * dockview-core
77
77
  * @version 6.6.1
78
78
  * @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.124.1",
3
+ "version": "0.125.0",
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.124.1",
3
- "gitSha": "604bae39a0da6417ec4f1ba2f92c81f4661c2dfd",
4
- "gitShortSha": "604bae39",
2
+ "version": "0.125.0",
3
+ "gitSha": "3b39163b6942d4b5b636b06dc2d737366b1d78e2",
4
+ "gitShortSha": "3b39163b",
5
5
  "gitBranch": "HEAD",
6
- "builtAt": "2026-10-26T07:38:06.859Z",
6
+ "builtAt": "2026-10-27T02:44:41.942Z",
7
7
  "dirty": false
8
8
  }
@@ -52,6 +52,7 @@ const { resolveEpicEffort, effortArgs } = require('./lib/claude/agentEffortResol
52
52
  const { planEpicSpawn } = require('./lib/epic/epicSpawnPlan.cjs');
53
53
  const epicWorktreeMint = require('./lib/epic/epicWorktreeMint.cjs');
54
54
  const logs = require('./logs.cjs');
55
+ const { feedChildStdin } = require('./lib/process/childStdin.cjs');
55
56
  const { createHeadTailBuffer } = require('./lib/util/headTailBuffer.cjs');
56
57
 
57
58
  // Caps on per-run stream buffers (a run can last hours).
@@ -627,7 +628,7 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
627
628
  // used for the flag-swap retry so both attempts share one construction path.
628
629
  const buildArgs = (resumeFlag) => {
629
630
  const a = [
630
- '-p', fullPrompt,
631
+ '-p',
631
632
  '--model', model,
632
633
  ...effortFlags,
633
634
  '--dangerously-skip-permissions',
@@ -712,9 +713,11 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
712
713
  // One spawn of the CLI. Per-attempt state (buffers, child) lives in here;
713
714
  // everything turn-level (timers, latch, lane) is in the enclosing scope.
714
715
  const startAttempt = (resumeFlag, attemptNo) => {
715
- // Spawn with stdin closed (mirrors scheduler's 'ignore' — prevents the
716
- // "claude -p stdin must be closed" gotcha from kg.cjs). stdout is piped for
717
- // real-time NDJSON streaming; stderr piped for error-message capture.
716
+ // Spawn with a stdin pipe: the prompt is fed on stdin (never argv — E2BIG
717
+ // above 128 KB per argument on Linux, 8191 chars on Windows cmd.exe) and
718
+ // feedChildStdin closes it, satisfying "claude -p stdin must be closed".
719
+ // stdout is piped for real-time NDJSON streaming; stderr piped for
720
+ // error-message capture.
718
721
  let thisChild;
719
722
  try {
720
723
  const chatArgs = buildArgs(resumeFlag);
@@ -724,7 +727,7 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
724
727
  ...(target.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}),
725
728
  cwd: execCwd,
726
729
  env: childEnv,
727
- stdio: ['ignore', 'pipe', 'pipe'],
730
+ stdio: ['pipe', 'pipe', 'pipe'],
728
731
  ...detachedSpawnOpts(), // own process group so killTree can SIGTERM descendants
729
732
  });
730
733
  } catch (err) {
@@ -739,6 +742,9 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
739
742
  return;
740
743
  }
741
744
  child = thisChild;
745
+ feedChildStdin(thisChild, fullPrompt, {
746
+ log: (m) => logs.writeLine({ scope: 'chatRunner', level: 'warn', message: m }),
747
+ });
742
748
 
743
749
  // ─── Stream parsing ────────────────────────────────────────────────────
744
750
  // stdout is newline-delimited JSON (stream-json format). We buffer partial
@@ -20,6 +20,7 @@ const { spawn } = require('node:child_process');
20
20
  const crypto = require('node:crypto');
21
21
  const { resolveClaudeBin, claudeSpawnTarget } = require('./lib/claude/claudeBin.cjs');
22
22
  const { headlessPermissionArgs, ensureCliCapsProbed } = require('./lib/claude/claudeCliCaps.cjs');
23
+ const { feedChildStdin } = require('./lib/process/childStdin.cjs');
23
24
  const { withProcRole } = require('./lib/process/cleanEnv.cjs');
24
25
  const { extractJson } = require('./lib/util/extractJson.cjs');
25
26
  const { assertInsideHome } = require('./lib/insideHome.cjs');
@@ -94,7 +95,7 @@ async function runClaude(prompt, { model = 'sonnet', timeoutMs = 90_000, systemP
94
95
  let bin;
95
96
  try { bin = resolveClaudeBin(); } catch (e) { resolve({ ok: false, error: `claude not found: ${e?.message}` }); return; }
96
97
  const args = [
97
- '-p', prompt,
98
+ '-p',
98
99
  '--model', model,
99
100
  '--dangerously-skip-permissions',
100
101
  ...headlessPermissionArgs(),
@@ -102,11 +103,13 @@ async function runClaude(prompt, { model = 'sonnet', timeoutMs = 90_000, systemP
102
103
  '--output-format', 'text',
103
104
  ];
104
105
  if (systemPrompt) args.push('--append-system-prompt', systemPrompt);
105
- // stdin MUST be closed ('ignore') — `claude -p` otherwise blocks waiting
106
- // for piped stdin and returns empty. SM_KG_INTERNAL=1 tells the
106
+ // The prompt goes on stdin (argv caps one argument at 128 KB -> E2BIG) and
107
+ // stdin is closed right after the write, never left open — `claude -p`
108
+ // otherwise blocks waiting on it and returns empty. SM_KG_INTERNAL=1 tells the
107
109
  // prompt-logging hook to skip this invocation.
108
110
  const target = claudeSpawnTarget('aux', 'docedit', bin);
109
- const child = spawn(target.command, args, { env: withProcRole({ ...process.env, SM_KG_INTERNAL: '1' }, 'aux'), stdio: ['ignore', 'pipe', 'pipe'], ...(target.argv0 ? { argv0: target.argv0 } : {}) });
111
+ const child = spawn(target.command, args, { env: withProcRole({ ...process.env, SM_KG_INTERNAL: '1' }, 'aux'), stdio: ['pipe', 'pipe', 'pipe'], ...(target.argv0 ? { argv0: target.argv0 } : {}) });
112
+ feedChildStdin(child, prompt);
110
113
  let out = '';
111
114
  let err = '';
112
115
  // Cap accumulated stdout — the model output shouldn't grow `out` without
@@ -250,6 +253,7 @@ module.exports = {
250
253
  parseDocEdit,
251
254
  editPrompt,
252
255
  runDocEdit,
256
+ runClaude,
253
257
  docEditViaSession,
254
258
  MAX_DOC_CONTEXT,
255
259
  truncateDocumentText,
@@ -252,7 +252,10 @@ const promptSessionsMergeToMain = z.object({
252
252
  // integrateEpicBranch can apply the same carried-wip-only skip the job
253
253
  // path already gets. Absent on a worktree created before this field
254
254
  // existed, or one whose base tree was clean at creation.
255
- carriedPaths: z.array(z.string().min(1).max(4096)).max(2000).optional(),
255
+ // The renderer sends the Epic's full carried diff (`git diff HEAD --name-only`),
256
+ // which is uncapped; 3,306 paths were seen on 2026-10-26. A tight cap rejects
257
+ // every merge for such an Epic.
258
+ carriedPaths: z.array(z.string().min(1).max(4096)).max(100000).optional(),
256
259
  });
257
260
 
258
261
  // Renderer entry points for the per-project "disable Epic worktree
@@ -18,6 +18,7 @@
18
18
  const { spawn } = require('node:child_process');
19
19
  const { resolveClaudeBin, claudeSpawnTarget } = require('./claude/claudeBin.cjs');
20
20
  const { cleanChildEnv, pathWithUserBins } = require('./process/cleanEnv.cjs');
21
+ const { feedChildStdin } = require('./process/childStdin.cjs');
21
22
 
22
23
  const CLASSIFY_TIMEOUT_MS = 30_000;
23
24
  const CLASSIFY_MODEL = 'sonnet';
@@ -61,8 +62,10 @@ function classifyPromptTicket(text) {
61
62
  return;
62
63
  }
63
64
  const childEnv = cleanChildEnv({ PATH: pathWithUserBins() });
65
+ // The prompt goes on stdin, never argv: a >128 KB argv element fails spawn with E2BIG.
66
+ const prompt = `${CLASSIFY_PROMPT_PREFIX}${text}`;
64
67
  const args = [
65
- '-p', `${CLASSIFY_PROMPT_PREFIX}${text}`,
68
+ '-p',
66
69
  '--model', CLASSIFY_MODEL,
67
70
  '--strict-mcp-config',
68
71
  '--output-format', 'text',
@@ -78,9 +81,11 @@ function classifyPromptTicket(text) {
78
81
  };
79
82
 
80
83
  try {
81
- // stdin closed — `claude -p` otherwise blocks waiting for piped stdin.
84
+ // stdin is a pipe fed with the prompt and then ended (feedChildStdin), so
85
+ // `claude -p` neither blocks on stdin nor sees an oversized argv element.
82
86
  const target = claudeSpawnTarget('aux', 'classify', claudeBin);
83
- child = spawnImpl(target.command, args, { env: childEnv, stdio: ['ignore', 'pipe', 'pipe'], ...(target.argv0 ? { argv0: target.argv0 } : {}) });
87
+ child = spawnImpl(target.command, args, { env: childEnv, stdio: ['pipe', 'pipe', 'pipe'], ...(target.argv0 ? { argv0: target.argv0 } : {}) });
88
+ feedChildStdin(child, prompt);
84
89
  } catch {
85
90
  finish('inline');
86
91
  return;
@@ -115,4 +120,4 @@ function classifyPromptTicket(text) {
115
120
  });
116
121
  }
117
122
 
118
- module.exports = { classifyPromptTicket, parseVerdict, CLASSIFY_TIMEOUT_MS, __setSpawnForTest };
123
+ module.exports = { classifyPromptTicket, CLASSIFY_PROMPT_PREFIX, parseVerdict, CLASSIFY_TIMEOUT_MS, __setSpawnForTest };
@@ -7,8 +7,9 @@
7
7
  * cost-gated synthesis caller (Memory Clusters, the Project Brief) shares one
8
8
  * spawn/timeout/output-cap implementation instead of forking it per feature.
9
9
  *
10
- * Pattern: stdin closed ('ignore' — `claude -p` blocks forever waiting for
11
- * piped stdin otherwise), model pinned explicitly by the caller, hard
10
+ * Pattern: the prompt is written to stdin (never argv — Linux caps one
11
+ * argument at 128 KB, E2BIG) and stdin is closed right after the write, never
12
+ * left open (`claude -p` blocks forever waiting on an open pipe), model pinned explicitly by the caller, hard
12
13
  * timeout that resolves {ok:false} rather than hanging, SM_KG_INTERNAL=1 so
13
14
  * the prompt-logging hook skips these internal calls, and an output-size cap
14
15
  * so a runaway response can't grow `out` unbounded.
@@ -17,6 +18,7 @@
17
18
  const { spawn } = require('node:child_process');
18
19
  const { resolveClaudeBin, claudeSpawnTarget } = require('./claudeBin.cjs');
19
20
  const { headlessPermissionArgs, ensureCliCapsProbed } = require('./claudeCliCaps.cjs');
21
+ const { feedChildStdin } = require('../process/childStdin.cjs');
20
22
  const { withProcRole } = require('../process/cleanEnv.cjs');
21
23
 
22
24
  const MAX_OUT_BYTES = 8 * 1024 * 1024;
@@ -28,7 +30,7 @@ async function runClaudeP(prompt, { model = 'sonnet', timeoutMs = 180_000, syste
28
30
  let bin;
29
31
  try { bin = resolveClaudeBin(); } catch (e) { resolve({ ok: false, error: `claude not found: ${e?.message}` }); return; }
30
32
  const args = [
31
- '-p', prompt,
33
+ '-p',
32
34
  '--model', model,
33
35
  '--dangerously-skip-permissions',
34
36
  ...headlessPermissionArgs(),
@@ -37,7 +39,8 @@ async function runClaudeP(prompt, { model = 'sonnet', timeoutMs = 180_000, syste
37
39
  ];
38
40
  if (systemPrompt) args.push('--append-system-prompt', systemPrompt);
39
41
  const target = claudeSpawnTarget('aux', 'runclaudep', bin);
40
- const child = spawn(target.command, args, { env: withProcRole({ ...process.env, SM_KG_INTERNAL: '1' }, 'aux'), stdio: ['ignore', 'pipe', 'pipe'], ...(target.argv0 ? { argv0: target.argv0 } : {}) });
42
+ const child = spawn(target.command, args, { env: withProcRole({ ...process.env, SM_KG_INTERNAL: '1' }, 'aux'), stdio: ['pipe', 'pipe', 'pipe'], ...(target.argv0 ? { argv0: target.argv0 } : {}) });
43
+ feedChildStdin(child, prompt);
41
44
  let out = '';
42
45
  let err = '';
43
46
  let killedForSize = false;
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * childStdin.cjs — write a prompt/text to a child's stdin and close it.
5
+ *
6
+ * Why prompts go on stdin, not argv: Linux caps a single argument at
7
+ * MAX_ARG_STRLEN (131072 bytes) and Windows cmd.exe caps a command line at
8
+ * 8191 characters; a larger argv element fails the spawn with E2BIG
9
+ * (incident 2026-10-26, spawn E2BIG). Ending the pipe also satisfies the rule
10
+ * that `claude -p`'s stdin must be closed (claude CLI 2.1.302 read a 204 KB
11
+ * prompt from stdin and exited 0).
12
+ *
13
+ * The EPIPE handling lives here, in one place: a child that exits without
14
+ * reading raises an 'error' on the pipe; it is logged once and swallowed.
15
+ */
16
+
17
+ /**
18
+ * @param {{ stdin?: any } | null | undefined} child
19
+ * @param {string} text
20
+ * @param {{ log?: (msg: string) => void }} [opts]
21
+ * @returns {boolean} true when the text was handed to child.stdin
22
+ */
23
+ function feedChildStdin(child, text, { log } = {}) {
24
+ if (!child || !child.stdin) return false;
25
+ let logged = false;
26
+ // Listener FIRST: the write can fail asynchronously with EPIPE.
27
+ child.stdin.on('error', (err) => {
28
+ if (logged) return;
29
+ logged = true;
30
+ if (typeof log !== 'function') return;
31
+ try {
32
+ log(`[childStdin] stdin write failed (${(err && (err.code || err.message)) || 'unknown'}): the child exited before reading its input\n`);
33
+ } catch { /* logging must never throw */ }
34
+ });
35
+ child.stdin.end(text, 'utf8');
36
+ return true;
37
+ }
38
+
39
+ module.exports = { feedChildStdin };
@@ -53,6 +53,7 @@
53
53
  const fs = require('node:fs');
54
54
  const { spawn, execFile } = require('node:child_process');
55
55
  const { killTree } = require('./killTree.cjs');
56
+ const { feedChildStdin } = require('./childStdin.cjs');
56
57
 
57
58
  // Injectable for tests (enumeration-failure coverage).
58
59
  const deps = { execFile };
@@ -205,6 +206,16 @@ function sweepChildProcessGroup(child, detached, safeLog) {
205
206
  .then((leaked) => { kill(); return leaked; });
206
207
  }
207
208
 
209
+ /**
210
+ * Spawn a child with its stdout/stderr on the log fd and supervise it.
211
+ *
212
+ * `spawn.stdinText` (optional string): when given, the child's stdin is a pipe
213
+ * that receives the text (UTF-8) and is then closed; otherwise stdin is
214
+ * 'ignore'. It exists because argv is a poor channel for large input: Linux
215
+ * caps a single argument at MAX_ARG_STRLEN (131072 bytes, spawn E2BIG) and
216
+ * Windows cmd.exe caps a command line at 8191 characters. A stdin error
217
+ * (EPIPE when the child never reads) is logged once and otherwise ignored.
218
+ */
208
219
  function withChildAndLog({ fd, logPath, safeLog, closeFd, spawn: spawnSpec, watchdogs = [], onExit }) {
209
220
  const startedAt = Date.now();
210
221
 
@@ -296,11 +307,12 @@ function withChildAndLog({ fd, logPath, safeLog, closeFd, spawn: spawnSpec, watc
296
307
 
297
308
  // Attempt synchronous spawn. On failure, call handleDone immediately so the
298
309
  // caller's onExit can resolve any pending Promise before we return null.
310
+ const stdinText = typeof spawnSpec.stdinText === 'string' ? spawnSpec.stdinText : null;
299
311
  let child;
300
312
  try {
301
313
  child = spawn(spawnSpec.command, spawnSpec.args, {
302
314
  ...spawnSpec.options,
303
- stdio: ['ignore', fd, fd],
315
+ stdio: [stdinText !== null ? 'pipe' : 'ignore', fd, fd],
304
316
  });
305
317
  } catch (e) {
306
318
  handleDone(-1, null, e, /* spawnFailed */ true);
@@ -309,6 +321,8 @@ function withChildAndLog({ fd, logPath, safeLog, closeFd, spawn: spawnSpec, watc
309
321
 
310
322
  ctx.child = child;
311
323
 
324
+ if (stdinText !== null) feedChildStdin(child, stdinText, { log: safeLog });
325
+
312
326
  child.on('error', (err) => handleDone(-1, null, err, false));
313
327
  child.on('exit', (code, signal) => handleDone(code, signal, undefined, false));
314
328