claude-code-session-manager 0.135.0 → 0.135.1

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 (47) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/assets/{AgentLibrary-DRlcF1YD.js → AgentLibrary-BBY7E1ag.js} +1 -1
  3. package/dist/assets/{AppSettings-CBhYHKGI.js → AppSettings-vMiIi0xn.js} +1 -1
  4. package/dist/assets/{Button-DtBUGvGI.js → Button-C0Z090Ui.js} +1 -1
  5. package/dist/assets/{DocumentEditorPane-C82c7Qtl.js → DocumentEditorPane-Ds10W8SZ.js} +1 -1
  6. package/dist/assets/{Extensions-Kn-oUD2_.js → Extensions-CjPiz2I5.js} +2 -2
  7. package/dist/assets/{History-B4c3Uz9u.js → History-Bm3KXXs1.js} +1 -1
  8. package/dist/assets/{Library-1RpLT-aH.js → Library-D-khizDg.js} +1 -1
  9. package/dist/assets/{ListDetail-xr0oxNkv.js → ListDetail-CJYpp8fW.js} +1 -1
  10. package/dist/assets/{Panel-O8XPrpJu.js → Panel-BHFGylfy.js} +1 -1
  11. package/dist/assets/{ProjectClaudeConfig-DBGhhzg2.js → ProjectClaudeConfig-DIzNAala.js} +1 -1
  12. package/dist/assets/{ProvenanceBadge-DSaizfZL.js → ProvenanceBadge-CYryeTYF.js} +1 -1
  13. package/dist/assets/{Scheduler-D2_5NyiR.js → Scheduler-BS82wfRP.js} +1 -1
  14. package/dist/assets/{Settings-Clgqb3Lq.js → Settings-DWPHJ94d.js} +1 -1
  15. package/dist/assets/{SkillReferenceGraph-D80RA7kR.js → SkillReferenceGraph-Cf2M7YNq.js} +1 -1
  16. package/dist/assets/{Skills-DNG7tHSf.js → Skills-DLq55Odf.js} +1 -1
  17. package/dist/assets/{SourceChip-D-Imzszd.js → SourceChip-CHxAzRlD.js} +1 -1
  18. package/dist/assets/{SystemPrompt-CGlOpUQA.js → SystemPrompt-BYtKMAr3.js} +1 -1
  19. package/dist/assets/{TiptapBody-CJFGfBdz.js → TiptapBody-O_Gfq0Ha.js} +1 -1
  20. package/dist/assets/{Toggle-0Ff0bPa_.js → Toggle-BJOUI5NY.js} +1 -1
  21. package/dist/assets/{ViewTabs-BCMYQwo_.js → ViewTabs-kkvNGu-S.js} +1 -1
  22. package/dist/assets/{VoiceButton-JzyC6DAB.js → VoiceButton-3i-6ju2L.js} +1 -1
  23. package/dist/assets/{historyTotals-B01WPBwh.js → historyTotals-CHrIptK1.js} +1 -1
  24. package/dist/assets/{index-rt7pTODX.js → index-D9qgN9_V.js} +3 -3
  25. package/dist/index.html +1 -1
  26. package/dist-web/app.js +1 -1
  27. package/package.json +1 -1
  28. package/plugins/CLAUDE.md +7 -8
  29. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  30. package/plugins/session-manager-dev/skills/builder/SKILL.md +113 -91
  31. package/plugins/session-manager-dev/skills/builder/manual.md +80 -0
  32. package/plugins/session-manager-dev/skills/develop/SKILL.md +29 -56
  33. package/plugins/session-manager-dev/skills/develop/standards.md +11 -19
  34. package/plugins/session-manager-dev/skills/send-feedback/SKILL.md +13 -18
  35. package/src/main/build-info.json +4 -4
  36. package/src/main/lib/CLAUDE.md +2 -0
  37. package/src/main/lib/epic/epicTranscriptPath.cjs +5 -4
  38. package/src/main/lib/epic/restorableSessions.cjs +16 -8
  39. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +23 -0
  40. package/src/seed/agents/demo-video-builder.md +25 -32
  41. package/src/seed/agents/dev-lead.md +3 -3
  42. package/plugins/session-manager-dev/skills/builder/0-diff/SKILL.md +0 -44
  43. package/plugins/session-manager-dev/skills/builder/1-classify-and-bump/SKILL.md +0 -37
  44. package/plugins/session-manager-dev/skills/builder/2-gate/SKILL.md +0 -37
  45. package/plugins/session-manager-dev/skills/builder/3-publish/SKILL.md +0 -137
  46. package/plugins/session-manager-dev/skills/builder/4-manual/SKILL.md +0 -124
  47. package/plugins/session-manager-dev/skills/builder/5-report/SKILL.md +0 -35
package/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Claude Session Manager</title>
7
- <script type="module" crossorigin src="./assets/index-rt7pTODX.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-D9qgN9_V.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="./assets/monaco-editor-BsIlgG7c.js">
9
9
  <link rel="stylesheet" crossorigin href="./assets/monaco-editor-Cu5D__1H.css">
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-CjQ_p5y7.css">
package/dist-web/app.js CHANGED
@@ -76,7 +76,7 @@ ${i}`].join(`
76
76
 
77
77
  `);return hV({title:`[Customer ${s.tag}] ${s.title}`,goal:r,tag:ZMe[s.tag],agentName:"architect",agentDescription:zXe,...n?{agentBody:n.text,agentPath:n.path}:{}})}function GXe({it:s,projectCwd:e}){const n=eo(v=>v.setInboxStatus),i=eo(v=>v.linkEpic),r=mn(v=>v.createPromptSession),[o,a]=T.useState(!1),[l,c]=T.useState(""),[d,u]=T.useState(!1),h=s.body.length>l0e,f=h&&!o?`${s.body.slice(0,l0e)}…`:s.body,g=s.epicId!=null,m=d||g||!e,_=g?"An Epic is already linked to this feedback":e?"Create a proposed Epic from this feedback":"No owner project is configured for this inbox",b=async()=>{if(!(m||!e)){u(!0);try{const{goalText:v,openingPrompt:x,sections:w}=await UXe(s,e),y=await r(e,v,ZMe[s.tag],void 0,"architect",x,w);await i(s.id,y.id),await n(s.id,"in_progress")}catch(v){fe.error(v instanceof Error?v.message:String(v))}finally{u(!1)}}};return p.jsxs("div",{className:"rounded-lg border border-line bg-bg px-3 py-2 grid gap-1.5","data-testid":"customer-feedback-inbox-item",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsx("div",{className:"min-w-0 text-[13px] font-semibold text-fg break-words",children:s.title}),p.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[11px] font-semibold text-fg-dim",children:WXe[s.status]})]}),p.jsxs("div",{className:"font-mono text-[11px] text-fg-dim",children:[$Xe[s.tag]," · ",new Date(GJ(s.receivedAt)).toLocaleDateString()," · v",s.clientVersion??"?"," ·"," ",s.clientPlatform??"?"]}),p.jsx("div",{className:"text-[12.5px] text-fg whitespace-pre-wrap break-words",children:f}),h&&p.jsx("button",{type:"button",onClick:()=>a(v=>!v),className:"justify-self-start text-[11.5px] font-semibold text-accent",children:o?"Show less":"Show more"}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("select",{value:s.status,onChange:v=>void n(s.id,v.target.value,l.trim()||void 0),className:"rounded-md border border-line bg-bg px-2 py-1 text-[12px] text-fg","aria-label":"Status","data-testid":"customer-feedback-inbox-status",children:XMe.map(v=>p.jsx("option",{value:v.value,children:v.label},v.value))}),p.jsx("input",{type:"text",value:l,onChange:v=>c(v.target.value),placeholder:"Note (optional)",maxLength:500,className:"min-w-0 flex-1 rounded-md border border-line bg-bg px-2 py-1 text-[12px] text-fg","aria-label":"Status note"}),p.jsx("button",{type:"button",onClick:()=>void b(),disabled:m,title:_,className:"rounded-md bg-accent px-2.5 py-1 text-[12px] font-semibold text-white disabled:opacity-50","data-testid":"customer-feedback-inbox-open-epic",children:g?"Epic linked":"Open as Epic"})]})]})}function qXe(){const s=eo(a=>{var l;return((l=a.ownerInfo)==null?void 0:l.ownerMode)??!1}),e=eo(a=>{var l;return((l=a.ownerInfo)==null?void 0:l.projectCwd)??null}),n=eo(a=>a.inbox),i=eo(a=>a.inboxLoading),r=eo(a=>a.pullInbox),o=T.useMemo(()=>[...n].sort((a,l)=>GJ(l.receivedAt)-GJ(a.receivedAt)),[n]);return T.useEffect(()=>{s&&r()},[s,r]),s?p.jsxs("section",{className:"shrink-0 max-h-[50%] overflow-auto border-t border-line px-5 py-4 grid gap-2 content-start","data-testid":"customer-feedback-inbox",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("h3",{className:"m-0 font-mono text-[11px] uppercase tracking-[0.08em] text-fg-dim",children:"Customer inbox"}),p.jsx("button",{type:"button",onClick:()=>void r(),disabled:i,className:"rounded-md border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-fg-dim hover:bg-bg-elev disabled:opacity-50","data-testid":"customer-feedback-inbox-refresh",children:i?"Refreshing…":"Refresh"})]}),o.length===0?p.jsx("p",{className:"m-0 text-[12.5px] text-fg-dim",children:"No customer feedback yet."}):o.map(a=>p.jsx(GXe,{it:a,projectCwd:e},a.id))]}):null}const KXe={open:"Open",in_progress:"In progress",resolved:"Resolved",wontfix:"Won't fix"},YXe=[{tag:"bug",label:"Bug"},{tag:"feature",label:"Feature"},{tag:"discussion",label:"Discussion"}],XXe={bug:"Bug",feature:"Feature",discussion:"Discussion"},c0e="Send this to Session Manager as feedback.",d0e=120,ZXe=4e3;function JXe(){const s=eo(S=>S.panelOpen),e=eo(S=>S.draft),n=eo(S=>S.items),i=eo(S=>S.submitting),r=eo(S=>S.closePanel),o=eo(S=>S.setDraft),a=eo(S=>S.submit),l=eo(S=>S.load),c=eo(S=>S.loadOwnerInfo),d=eo(S=>S.refreshStatus),u=eo(S=>S.markSeen),h=eo(S=>{var E;return((E=S.ownerInfo)==null?void 0:E.ownerMode)===!0}),f=Xs(S=>S.show),[g,m]=T.useState(!1),[_,b]=T.useState(!1),v=T.useMemo(()=>[...n].sort((S,E)=>E.submittedAt-S.submittedAt),[n]);if(T.useEffect(()=>{if(!s){m(!1);return}const S=requestAnimationFrame(()=>m(!0));return()=>cancelAnimationFrame(S)},[s]),T.useEffect(()=>{if(!s)return;let S=!1;return(async()=>(await Promise.all([l(),c(),d()]),S||await u()))(),()=>{S=!0}},[s,l,c,d,u]),T.useEffect(()=>{if(b(!1),!s)return;let S=!1;return(async()=>{var E,L,D,I;try{const A=await((D=(L=(E=window.api)==null?void 0:E.app)==null?void 0:L.seedStatus)==null?void 0:D.call(L));S||b(((I=A==null?void 0:A["scheduler-mcp"])==null?void 0:I.status)==="done")}catch{}})(),()=>{S=!0}},[s]),T.useEffect(()=>{if(!s)return;const S=E=>{E.key==="Escape"&&(E.stopPropagation(),r())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[s,r]),!s)return null;const x=e.title.trim()===""||e.body.trim()==="",w=async()=>{await Wc(c0e)?f("info","Copied — paste it into your session."):f("error","Could not copy to the clipboard.")},y=p.jsxs("div",{className:`fixed inset-0 ${Ai.dialog}`,"data-testid":"customer-feedback-root",children:[p.jsx("div",{className:`absolute inset-0 bg-black/50 transition-opacity duration-[220ms] ${g?"opacity-100":"opacity-0"}`,onClick:S=>{S.target===S.currentTarget&&r()},"data-testid":"customer-feedback-backdrop"}),p.jsxs("aside",{role:"dialog","aria-modal":"true","aria-label":"Send feedback",className:`absolute left-0 top-0 h-full w-full max-w-[480px] border-r border-line bg-bg-elev text-fg shadow-xl flex flex-col transition-transform duration-[220ms] ${g?"translate-x-0":"-translate-x-full"}`,style:{transitionTimingFunction:"cubic-bezier(.32,.72,.28,1)"},"data-testid":"customer-feedback-panel",children:[p.jsxs("header",{className:"px-5 py-4 border-b border-line flex items-center justify-between gap-3 shrink-0",children:[p.jsx("h2",{className:"m-0 font-serif text-[18px] font-semibold text-fg",children:"Feedback"}),p.jsx("button",{onClick:r,className:"shrink-0 rounded-md border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-fg-dim hover:bg-bg-elev","aria-label":"Close","data-testid":"customer-feedback-close",children:"Close"})]}),p.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5 py-4 grid gap-5 content-start",children:[p.jsxs("form",{className:"grid gap-3",onSubmit:S=>{S.preventDefault(),!x&&!i&&a()},children:[_&&p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsxs("p",{className:"m-0 flex-1 text-[12.5px] text-fg-dim","data-testid":"customer-feedback-session-hint",children:['Already talking about this in a session? Ask it: "',c0e,`" It uses what the session already knows, so you don't retype it, and the item shows up here.`]}),p.jsx("button",{type:"button",className:"shrink-0 text-[12.5px] font-semibold text-accent hover:underline","aria-label":"Copy the phrase to ask your session","data-testid":"customer-feedback-session-hint-copy",onClick:()=>void w(),children:"Copy"})]}),p.jsxs("label",{className:"grid gap-1",children:[p.jsxs("span",{className:"flex justify-between font-mono text-[11px] uppercase tracking-[0.05em] text-fg-dim",children:[p.jsx("span",{children:"Header"}),p.jsxs("span",{children:[e.title.length,"/",d0e]})]}),p.jsx("input",{value:e.title,maxLength:d0e,onChange:S=>o({title:S.target.value}),className:"rounded-md border border-line bg-bg px-2.5 py-1.5 text-[13px] text-fg","data-testid":"customer-feedback-title"})]}),p.jsxs("label",{className:"grid gap-1",children:[p.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.05em] text-fg-dim",children:"Body"}),p.jsx("textarea",{value:e.body,maxLength:ZXe,rows:6,onChange:S=>o({body:S.target.value}),className:"rounded-md border border-line bg-bg px-2.5 py-1.5 text-[13px] text-fg resize-y","data-testid":"customer-feedback-body"})]}),p.jsx("div",{className:"flex gap-2",role:"group","aria-label":"Feedback type",children:YXe.map(({tag:S,label:E})=>p.jsx("button",{type:"button","aria-pressed":e.tag===S,onClick:()=>o({tag:S}),className:`rounded-md border border-line px-3 py-1 text-[12px] font-semibold ${e.tag===S?"bg-accent text-white":"bg-bg text-fg-dim hover:bg-bg-elev"}`,"data-testid":`customer-feedback-tag-${S}`,children:E},S))}),p.jsx("p",{className:"m-0 text-[11.5px] text-fg-dim",children:"Your feedback is sent to bilko.run. Please don't paste secrets, keys or passwords."}),p.jsx("button",{type:"submit",disabled:x||i,className:"rounded-md bg-accent px-3 py-1.5 text-[13px] font-semibold text-white disabled:opacity-50","data-testid":"customer-feedback-submit",children:i?"Sending…":"Submit"})]}),p.jsxs("p",{className:"m-0 text-[12.5px] text-fg-dim","data-testid":"customer-feedback-free-hour",children:["Rather talk it through?"," ",p.jsx("button",{type:"button",className:"font-semibold text-accent hover:underline","data-testid":"customer-feedback-free-hour-link",onClick:KMe,children:"Book a free hour with Bilko"})]}),p.jsxs("section",{className:"grid gap-2","data-testid":"customer-feedback-list",children:[p.jsx("h3",{className:"m-0 font-mono text-[11px] uppercase tracking-[0.08em] text-fg-dim",children:"Your feedback"}),v.length===0?p.jsx("p",{className:"m-0 text-[12.5px] text-fg-dim",children:"No feedback yet — what you send will show up here."}):v.map(S=>p.jsxs("div",{className:"rounded-lg border border-line bg-bg px-3 py-2 grid gap-1","data-testid":"customer-feedback-item",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsx("div",{className:"min-w-0 text-[13px] font-semibold text-fg break-words",children:S.title}),p.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[11px] font-semibold text-fg-dim","data-testid":"customer-feedback-status",children:KXe[S.status]})]}),p.jsxs("div",{className:"font-mono text-[11px] text-fg-dim",children:[XXe[S.tag]," · ",new Date(S.submittedAt).toLocaleDateString()]}),S.statusNote&&p.jsx("div",{className:"text-[12px] text-fg-dim break-words",children:S.statusNote})]},S.id))]})]}),h&&p.jsx(qXe,{})]})]});return typeof document<"u"&&document.body?Rx.createPortal(y,document.body):y}const QXe=3e4;function eZe(){const s=jt(L=>L.tabs),e=jt(L=>L.activeTabId),n=jt(L=>L.closeTab),i=jt(L=>L.setActive),r=jt(L=>L.reorderTab),o=Q2(L=>L.watchers),a=oi(L=>L.openPanel),l=oi(L=>L.openProjectPanel),c=oi(L=>L.setEpicsWorkspaceOpen),d=oi(L=>L.navFace==="home"),u=eo(L=>L.items),h=eo(L=>L.panelOpen),f=eo(L=>L.togglePanel),g=eo(L=>L.load),m=BXe(u)>0;T.useEffect(()=>{g()},[g]);const[_,b]=T.useState(()=>Date.now()),v=lde();T.useEffect(()=>{if(!v)return;b(Date.now());const L=window.setInterval(()=>b(Date.now()),1e3);return()=>window.clearInterval(L)},[v]);const x=L=>{for(const D of Object.values(o))if(D.tabId===L&&D.lastLineAt&&_-D.lastLineAt<QXe)return!0;return!1},{getTabDragProps:w,isDragging:y,containerRef:S}=FXe({tabCount:s.length,onReorder:r,onActivate:L=>{const D=s[L];D&&(i(D.id),c(!1),l("terminal"))}}),E=["#6f7d52","#b85c34","#a39079","#7a8466","#5b4a36"];return p.jsxs("div",{className:"h-12 bg-bg-elev border-b border-line flex items-end px-3 gap-0 shrink-0 relative","data-testid":"tour-tabbar",children:[p.jsxs("button",{onClick:()=>a("overview"),title:"This machine — home","aria-current":d?"true":void 0,"data-testid":"tabbar-machine-home",className:`flex items-center gap-2 px-3.5 py-1.5 mb-1 rounded-full text-[13px] shrink-0 transition-colors ${d?"bg-accent text-bg font-semibold shadow-sm":"text-fg-dim hover:text-fg hover:bg-bg-hi/40"}`,children:[p.jsx(Yi,{name:"home",className:"w-[15px] h-[15px]"}),p.jsx("span",{children:"Home"})]}),p.jsx("span",{className:"w-px self-stretch my-1.5 bg-line"}),p.jsx("div",{ref:S,className:`flex items-end gap-0.5 overflow-x-auto no-scrollbar min-w-0 flex-1 select-none ${y?"cursor-grabbing":""}`,children:s.map((L,D)=>{const I=L.id===e,A=w(D),j=E[D%E.length];return p.jsxs("div",{...A,style:A.style,className:`group flex items-center gap-2 px-3.5 pt-1.5 pb-2 rounded-t-[10px] text-[13px] shrink-0 transition-colors ${y?"":"cursor-grab"} ${I?"bg-bg text-fg font-medium relative z-10 -mb-px border border-accent shadow-[inset_0_2px_0_theme(colors.accent.DEFAULT)]":"text-fg-dim hover:text-fg hover:bg-bg-hi/40"}`,title:L.cwd,"aria-current":I?"true":void 0,children:[p.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:j,boxShadow:"inset 0 0 0 0.5px rgba(0,0,0,0.15)",opacity:L.status==="spawning"?.55:1}}),p.jsx("span",{className:"truncate max-w-[200px]",children:L.label}),L.status==="spawning"&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-butter animate-pulse",title:"spawning"}),x(L.id)&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse",title:"watcher emitted a line in the last 30s","data-testid":"tab-watcher-dot"}),p.jsx("button",{onClick:F=>{F.stopPropagation(),n(L.id)},className:"text-fg-faint opacity-0 group-hover:opacity-100 hover:text-fg ml-1 leading-none",title:"Close session","aria-label":`Close ${L.label}`,children:"×"})]},L.id)})}),p.jsx("span",{className:"w-px self-stretch my-1.5 bg-line"}),p.jsxs("button",{onClick:f,title:"Send feedback","aria-label":"Send feedback","aria-expanded":h,"data-testid":"tabbar-customer-feedback",className:"relative flex items-center px-3.5 py-1.5 mb-1 rounded-full text-[13px] font-mono shrink-0 transition-colors text-fg-dim hover:text-fg hover:bg-bg-hi/40",children:["{F}",m&&p.jsx("span",{className:"absolute top-1 right-1.5 w-1.5 h-1.5 rounded-full bg-accent","data-testid":"customer-feedback-unseen-dot"})]}),p.jsx(JXe,{})]})}function tZe(...s){}function nZe(s){return Promise.reject(new Error("Not available in the web version"))}const iZe=new Set,sZe=new Set;function rZe(){for(const s of iZe)try{s()}catch{}}function qJ(){for(const s of sZe)try{s()}catch{}}function oZe(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 aZe(s){if(!window.speechSynthesis)return;const e=oZe(s);if(!e)return;const n=new SpeechSynthesisUtterance(e);n.rate=1,n.pitch=1,n.onstart=()=>{performance.now(),rZe()},n.onend=()=>{!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&qJ()},n.onerror=i=>{i.error!=="canceled"&&!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&qJ()},window.speechSynthesis.speak(n)}function lZe(){window.speechSynthesis&&(window.speechSynthesis.cancel(),qJ())}function z3(s,e,n,i,r){var a,l;try{(l=(a=window.api)==null?void 0:a.logs)==null||l.write(s,e,n,i,r)}catch{}const o=e==="error"?console.error:e==="warn"?console.warn:console.log;i!==void 0?o(`[${s}]`,n,i):o(`[${s}]`,n)}const Zn={debug:(s,e,n)=>z3(s,"debug",e,n),info:(s,e,n)=>z3(s,"info",e,n),warn:(s,e,n)=>z3(s,"warn",e,n),error:(s,e,n,i)=>z3(s,"error",e,n,i)};function u0e(){en.getState().submitCountdownStartAt!==null&&en.setState({submitCountdownStartAt:null})}let h0e=null;const U3=1e4;let eR=null;function Eq(){eR&&(clearTimeout(eR),eR=null)}let AF=null,MF=null;function G3(){AF=null,MF&&(MF(),MF=null)}const cZe=1500,dZe=9e4;let KT=0,PF=null,KJ=-1;function YT(){PF&&(clearTimeout(PF),PF=null,KJ=-1)}const uZe=1800*1e3;let tR=null;function hZe(){tR&&(clearTimeout(tR),tR=null)}const en=lr((s,e)=>{function n(){hZe(),tR=setTimeout(()=>{if(tR=null,e().isRecording||h0e){n();return}Zn.info("voice","model idle timeout: releasing worker"),YT(),KT++,s({modelStatus:"idle",loadingProgress:0,error:null,errorKind:null})},uZe)}return{isRecording:!1,externalRecording:!1,ttsEnabled:!1,autoSubmit:!0,submitDelayMs:8e3,submitCountdownStartAt:null,lastTranscript:"",lastPartial:"",statusPill:"idle",partialsEnabled:!0,error:null,errorKind:null,modelStatus:"idle",loadingProgress:0,permissionState:"unknown",lastBargeInAt:null,hotkeyState:"idle",levelMeterEnabled:!0,turnDetectorState:"disabled",turnDetectorMode:"off",wizardArmed:!1,wizardOpen:!1,initModel:()=>{if(e().modelStatus!=="idle")return;Zn.info("voice","initModel: kicking off preload"),s({modelStatus:"loading",error:null,errorKind:null,loadingProgress:0});const i=++KT,r=()=>{i===KT&&(YT(),KJ=i,PF=setTimeout(()=>{KJ===i&&e().modelStatus==="loading"&&(Zn.warn("voice","mic.gate.timeout: no progress within 90s"),s({modelStatus:"error",error:"Model load timed out",errorKind:"timeout"}))},dZe))};r(),tZe((o,a)=>{i===KT&&(o==="ready"?(YT(),Zn.info("voice","modelStatus -> ready"),s({modelStatus:"ready",loadingProgress:100,errorKind:null}),!e().isRecording&&!h0e&&n()):o==="error"?(YT(),Zn.error("voice","modelStatus -> error",{msg:a}),s({modelStatus:"error",error:a,errorKind:"load"})):(r(),s({modelStatus:"loading"})))},o=>{i===KT&&(r(),s({loadingProgress:Math.round(o)}))})},resetAndRetryModel:()=>{Zn.info("voice","mic.gate.retry"),YT(),s({modelStatus:"idle",error:null,errorKind:null,loadingProgress:0}),e().initModel()},startRecording:(i,r)=>{if(!e().isRecording){s({error:"Microphone or Web Worker not available",errorKind:"recording"});return}},stopRecording:()=>{},restartWithDevice:async()=>{e().isRecording},setExternalRecording:i=>s({externalRecording:i}),toggleTTS:()=>{const i=!e().ttsEnabled;s({ttsEnabled:i}),Promise.resolve().then(()=>{var r,o,a;return(a=(o=(r=window.api)==null?void 0:r.voice)==null?void 0:o.setTtsEnabled)==null?void 0:a.call(o,i)}).catch(r=>{Zn.warn("voice","setTtsEnabled failed",{error:r instanceof Error?r.message:String(r)})})},setAutoSubmit:i=>s({autoSubmit:i}),setSubmitDelayMs:i=>s({submitDelayMs:Math.max(500,Math.min(13e3,Math.floor(i)))}),cancelSubmit:()=>u0e(),setPartialsEnabled:i=>{e().partialsEnabled!==i&&(s({partialsEnabled:i}),i||s({lastPartial:""}))},clearError:()=>s({error:null,errorKind:null}),setPermissionState:i=>{e().permissionState!==i&&(Zn.info("voice","mic.gate.permission_changed",{from:e().permissionState,to:i}),s({permissionState:i}))},setLevelMeterEnabled:i=>{e().levelMeterEnabled!==i&&s({levelMeterEnabled:i})},setTurnDetectorRuntimeState:i=>{e().turnDetectorState!==i&&(s({turnDetectorState:i}),i==="load_failed"?Zn.warn("voice-turn","voice-turn.load_failed"):i==="runtime_error"?Zn.warn("voice-turn","voice-turn.runtime_error"):i==="disabled"&&Zn.info("voice-turn","voice-turn.fallback_to_vad"))},setWizardArmed:i=>{e().wizardArmed!==i&&s({wizardArmed:i})},openWizard:()=>{e().wizardOpen||s({wizardOpen:!0})},closeWizard:()=>{e().wizardOpen&&s({wizardOpen:!1})},armHotkey:({phase:i,source:r,mode:o,tabId:a})=>{const l=e(),{canRecord:c,reason:d}=f8();if(i==="down"){if(d==="error"||d==="load-timeout"){l.resetAndRetryModel(),Zn.info("voice-hotkey","down.retry",{source:r,reason:d});return}if(!c&&d!=="loading"){Zn.warn("voice-hotkey","miss-model-loading",{modelStatus:l.modelStatus,reason:d});return}if(l.hotkeyState==="recording"||l.isRecording){(o==="toggle"||r==="global")&&(s({hotkeyState:"stopping"}),Eq(),eR=setTimeout(()=>{e().hotkeyState==="stopping"&&(Zn.warn("voice-hotkey","drain-timeout",{durationMs:U3}),s({hotkeyState:"aborted"}),setTimeout(()=>{e().hotkeyState==="aborted"&&s({hotkeyState:"idle"})},0))},U3),l.stopRecording());return}if(d==="loading"){l.hotkeyState!=="armed"&&(s({hotkeyState:"armed"}),Zn.info("voice-hotkey","armed",{source:r,modelStatus:l.modelStatus})),G3(),AF={tabId:a,source:r,mode:o},MF=en.subscribe((u,h)=>{if(AF&&u.modelStatus==="ready"&&h.modelStatus!=="ready"&&u.hotkeyState==="armed"){const f=AF;if(G3(),!f.tabId){Zn.warn("voice-hotkey","armed-promote-no-tab",{source:f.source}),s({hotkeyState:"idle"});return}Zn.info("voice-hotkey","armed-promote",f),s({hotkeyState:"recording"}),en.getState().startRecording(f.tabId)}});return}if(!a){Zn.warn("voice-hotkey","no-active-tab",{source:r});return}Zn.info("voice-hotkey","start",{source:r,mode:o,tabId:a}),l.startRecording(a),e().isRecording?s({hotkeyState:"recording"}):(Zn.warn("voice-hotkey","start: recording did not engage",{errorKind:e().errorKind}),s({hotkeyState:"idle"}));return}if(!(o!=="hold"||r==="global")){if(l.hotkeyState==="armed"){G3(),Zn.info("voice-hotkey","miss-model-loading-armed-up"),s({hotkeyState:"idle"});return}l.hotkeyState==="recording"&&(s({hotkeyState:"stopping"}),Eq(),eR=setTimeout(()=>{e().hotkeyState==="stopping"&&(Zn.warn("voice-hotkey","drain-timeout",{durationMs:U3}),s({hotkeyState:"aborted"}),setTimeout(()=>{e().hotkeyState==="aborted"&&s({hotkeyState:"idle"})},0))},U3),l.stopRecording())}},destroyHotkey:()=>{const i=e();if(G3(),u0e(),i.hotkeyState==="recording"){Zn.warn("voice-hotkey","destroyed-mid-recording"),s({hotkeyState:"destroyed"});try{i.stopRecording()}catch{}}else(i.hotkeyState==="armed"||i.hotkeyState==="stopping")&&(Eq(),s({hotkeyState:"destroyed"}))}}}),fZe=s=>({isRecording:s.isRecording,statusPill:s.statusPill,lastPartial:s.lastPartial,lastTranscript:s.lastTranscript,submitCountdownStartAt:s.submitCountdownStartAt}),f8=s=>({canRecord:!1,reason:"unsupported"});typeof window<"u"&&Promise.resolve().then(()=>{var s,e,n;return(n=(e=(s=window.api)==null?void 0:s.voice)==null?void 0:e.getTtsEnabled)==null?void 0:n.call(e)}).then(s=>{typeof s=="boolean"&&en.setState({ttsEnabled:s})}).catch(s=>{Zn.warn("voice","getTtsEnabled failed",{error:s instanceof Error?s.message:String(s)})});if(typeof window<"u"){const s=window;s.__voice=en,s.__transcripts=[]}const WA=6e4,pZe=3e5,gZe=.25,mZe=5e3,$A=lr(()=>({data:null,refreshing:!1}));let f0e=!1,OF=null,Lq=WA,q3=!1,Jm=null;function _Ze(s,e){if(s.kind==="ok")return{delayMs:WA,nextBackoffMs:WA};const n=Math.min(e*2,pZe),i=n*gZe;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 p0e(){return Qce(window.api.billing.fetch(),mZe,"billing.fetch")}function g0e(s){$A.setState({data:s,refreshing:!1})}async function cde(){$A.setState({refreshing:!0});let s=WA;try{const e=await p0e();Jm&&(Jm.cancel(),Jm=null),g0e(e);const{delayMs:n,nextBackoffMs:i}=_Ze(e,Lq);Lq=i,s=n}catch(e){Lq=WA,$A.setState({refreshing:!1});const n=DMe({error:e,retry:p0e,onRetrySuccess:i=>{Jm=null,g0e(i)},onStillFailing:i=>{Jm=null,q3||(q3=!0,fe.warn(`Billing usage fetch: ${i}`))}});if(n)Jm=n;else if(!q3){q3=!0;const i=e instanceof Error?e.message:String(e);fe.warn(`Billing usage fetch failed: ${i}`)}}OF=setTimeout(cde,s)}function bZe(){f0e||(f0e=!0,cde())}function JMe(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 vZe(){OF!==null&&(clearTimeout(OF),OF=null),Jm&&(Jm.cancel(),Jm=null),cde()}function dx(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 K3=new Map,xZe=3e4;function dde(s){const[e,n]=T.useState(()=>{var i;return s?((i=K3.get(s))==null?void 0:i.value)??null:null});return T.useEffect(()=>{if(!s){n(null);return}let i=!1;return(async()=>{const o=K3.get(s);if(o&&Date.now()-o.ts<xZe){i||n(o.value);return}try{const a=await window.api.app.gitBranch(s);if(i)return;K3.set(s,{value:a,ts:Date.now()}),n(a)}catch{if(i)return;K3.set(s,{value:null,ts:Date.now()}),n(null)}})(),()=>{i=!0}},[s]),e}const wZe="~/.claude/session-manager/ui-chrome-prefs.json",QMe=zg(wZe),yZe=180,CZe=480,YJ=252,hw={sidebarWidth:YJ,sidebarCollapsed:!1,collapsedGroups:[],learningPanelCollapsed:!1,tourCompletedAt:null,density:"roomy"};function XJ(s){return Math.min(CZe,Math.max(yZe,s))}let Uv=null,jF={};function SZe(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};QMe.patch(i).catch(()=>{})};s().hydrated||!Uv?e():Uv.then(e)}function Nk(s,e,n){s(n),!e().hydrated&&Uv&&Object.assign(jF,n),SZe(e)}const To=lr((s,e)=>({...hw,hydrated:!1,hydrate:()=>e().hydrated?Promise.resolve():Uv||(Uv=(async()=>{try{const n=await QMe.read();if(Object.keys(n).length>0){s({sidebarWidth:typeof n.sidebarWidth=="number"?XJ(n.sidebarWidth):hw.sidebarWidth,sidebarCollapsed:n.sidebarCollapsed??hw.sidebarCollapsed,collapsedGroups:Array.isArray(n.collapsedGroups)?n.collapsedGroups:hw.collapsedGroups,learningPanelCollapsed:n.learningPanelCollapsed??hw.learningPanelCollapsed,tourCompletedAt:typeof n.tourCompletedAt=="number"?n.tourCompletedAt:hw.tourCompletedAt,density:n.density==="compact"?"compact":hw.density,...jF,hydrated:!0});return}}catch{}s({...jF,hydrated:!0})})().finally(()=>{Uv=null,jF={}}),Uv),setSidebarWidth:n=>Nk(s,e,{sidebarWidth:XJ(n)}),setSidebarCollapsed:n=>Nk(s,e,{sidebarCollapsed:n}),setCollapsedGroups:n=>Nk(s,e,{collapsedGroups:n}),setLearningPanelCollapsed:n=>Nk(s,e,{learningPanelCollapsed:n}),setTourCompletedAt:n=>Nk(s,e,{tourCompletedAt:n}),setDensity:n=>Nk(s,e,{density:n})})),kZe=52;function EZe(s){return new Set(s.filter(e=>e==="Workspace"||e==="Claude Code"||e==="Session Manager"))}function LZe(){const s=jt(n=>{var i;return((i=n.tabs.find(r=>r.id===n.activeTabId))==null?void 0:i.cwd)??null});return{scheduler:El(n=>{var i;return(((i=n.snapshot)==null?void 0:i.jobs)??[]).some(r=>r.status==="running"&&(!s||r.cwd===s))})}}function NZe({active:s,onNavigate:e,onNewSession:n}){const i=To(O=>O.hydrated),r=To(O=>O.hydrate);T.useEffect(()=>{i||r()},[i,r]);const o=To(O=>O.collapsedGroups),a=To(O=>O.setCollapsedGroups),l=T.useMemo(()=>EZe(o),[o]),c=T.useCallback(O=>{const H=new Set(l);H.has(O)?H.delete(O):H.add(O),a(Array.from(H))},[l,a]),d=To(O=>O.sidebarCollapsed),u=To(O=>O.setSidebarCollapsed),h=T.useCallback(()=>{u(!d)},[d,u]),f=jt(O=>O.tabs),g=jt(O=>O.activeTabId),m=f.find(O=>O.id===g)??null,_=LZe(),b=oi(O=>O.navFace),v=EXe(b),x=v.filter(O=>O.group==="Workspace"),w=v.filter(O=>O.group==="Claude Code"),y=v.filter(O=>O.group==="Session Manager"),S=b==="home"&&!d,E=To(O=>O.sidebarWidth),L=To(O=>O.setSidebarWidth),[D,I]=T.useState(E),A=T.useRef(D);A.current=D,T.useEffect(()=>{I(E)},[E]);const j=T.useCallback(O=>{O.preventDefault();const H=O.clientX,B=A.current;let z=B;const J=M=>{z=XJ(B+(M.clientX-H)),I(z)},K=()=>{window.removeEventListener("pointermove",J),window.removeEventListener("pointerup",K),document.body.style.cursor="",document.body.style.userSelect="",L(z)};window.addEventListener("pointermove",J),window.addEventListener("pointerup",K),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[L]),F=T.useCallback(()=>{I(YJ),L(YJ)},[L]);return p.jsxs("aside",{className:"shrink-0 bg-bg-elev border-r border-line flex flex-col relative transition-[width] duration-150",style:{width:d?kZe:D},"data-testid":"tour-leftnav","aria-label":"Primary navigation",children:[p.jsx(DZe,{tab:m,navFace:b,onNewSession:n,rail:d,onToggleRail:h}),p.jsx("div",{className:"flex-1 min-h-0 overflow-auto pb-3",style:{paddingInline:d?"4px":"8px"},children:S?p.jsxs(p.Fragment,{children:[p.jsx(Nq,{label:"Workspace",desc:Sq.Workspace,collapsed:l.has("Workspace"),count:x.length,onToggle:()=>c("Workspace")}),!l.has("Workspace")&&x.map(O=>p.jsx(Y3,{item:O,active:s===O.key,live:O.liveKind?_[O.liveKind]:!1,onClick:()=>e(O.key),rail:!1},O.key)),p.jsx(Nq,{label:"Claude Code",desc:Sq["Claude Code"],collapsed:l.has("Claude Code"),count:w.length,onToggle:()=>c("Claude Code")}),!l.has("Claude Code")&&w.map(O=>p.jsx(Y3,{item:O,active:s===O.key,live:!1,onClick:()=>e(O.key),rail:!1},O.key)),p.jsx(Nq,{label:"Session Manager",desc:Sq["Session Manager"],collapsed:l.has("Session Manager"),count:y.length,onToggle:()=>c("Session Manager")}),!l.has("Session Manager")&&y.map(O=>p.jsx(Y3,{item:O,active:s===O.key,live:!1,onClick:()=>e(O.key),rail:!1},O.key))]}):p.jsx("div",{className:"pt-2",children:v.map(O=>p.jsx(Y3,{item:O,active:s===O.key,live:O.liveKind?_[O.liveKind]:!1,onClick:()=>e(O.key),rail:d},O.key))})}),p.jsx(TZe,{rail:d,navFace:b}),!d&&p.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize · double-click to reset",onPointerDown:j,onDoubleClick:F,className:"absolute top-0 right-0 h-full w-1.5 translate-x-1/2 z-10 cursor-col-resize hover:bg-accent/40 active:bg-accent/60 transition-colors"})]})}function DZe({tab:s,navFace:e,onNewSession:n,rail:i,onToggleRail:r}){const o=(s==null?void 0:s.label)??"no session",a=dde((s==null?void 0:s.cwd)??null);return i?p.jsxs("div",{className:"flex flex-col items-center gap-1.5 pt-2 pb-2 border-b border-rule",children:[p.jsx("button",{onClick:n,"data-testid":"tour-new-session",title:"Open / Start Project",className:"w-9 h-9 rounded-md bg-bg-hi border border-line text-fg hover:bg-bg-hi/80 hover:border-accent/40 transition-colors flex items-center justify-center",children:p.jsx(Yi,{name:"plus",size:15,stroke:1.8})}),p.jsx("button",{onClick:r,title:"Expand sidebar","data-testid":"sidebar-rail-toggle",className:"w-9 h-9 rounded-md text-fg-faint hover:text-fg hover:bg-bg-hi/50 transition-colors flex items-center justify-center",children:p.jsx("span",{style:{display:"inline-flex",transform:"rotate(0deg)"},children:p.jsx(Yi,{name:"chevron",size:15,stroke:1.8})})})]}):e==="home"?p.jsxs("div",{className:"px-[18px] pt-[14px] pb-[10px] border-b border-rule",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"text-[11px] font-semibold tracking-[0.06em] text-fg-faint uppercase",children:"Session Manager"}),p.jsx("button",{onClick:r,title:"Collapse sidebar","data-testid":"sidebar-rail-toggle",className:"w-6 h-6 rounded-md text-fg-faint hover:text-fg hover:bg-bg-hi/50 transition-colors flex items-center justify-center",children:p.jsx("span",{style:{display:"inline-flex",transform:"rotate(180deg)"},children:p.jsx(Yi,{name:"chevron",size:13,stroke:1.8})})})]}),p.jsx("div",{className:"mt-3 flex items-stretch gap-1.5",children:p.jsxs("button",{onClick:n,"data-testid":"tour-new-session",className:"flex-1 px-3 py-1.5 rounded-md bg-bg-hi border border-line text-fg text-[12.5px] font-medium hover:bg-bg-hi/80 hover:border-accent/40 transition-colors flex items-center justify-center gap-1.5",children:[p.jsx(Yi,{name:"plus",size:13,stroke:1.8}),"Open / Start Project"]})})]}):p.jsxs("div",{className:"px-[18px] pt-[14px] pb-[10px] border-b border-rule",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"text-[11px] font-semibold tracking-[0.06em] text-fg-faint uppercase",children:"Project"}),p.jsx("button",{onClick:r,title:"Collapse sidebar","data-testid":"sidebar-rail-toggle",className:"w-6 h-6 rounded-md text-fg-faint hover:text-fg hover:bg-bg-hi/50 transition-colors flex items-center justify-center",children:p.jsx("span",{style:{display:"inline-flex",transform:"rotate(180deg)"},children:p.jsx(Yi,{name:"chevron",size:13,stroke:1.8})})})]}),p.jsxs("div",{className:"flex items-baseline gap-2 mt-1",children:[p.jsx("span",{className:"self-center w-2 h-2 rounded-full bg-sage"}),p.jsx("span",{className:"font-serif text-[18px] font-medium text-fg truncate",title:(s==null?void 0:s.cwd)??"",children:o})]}),p.jsx("div",{className:"text-[12px] text-fg-faint font-mono mt-0.5 truncate",children:a?`⌥${a}`:s?s.cwd:"—"}),p.jsx("div",{className:"mt-3 flex items-stretch gap-1.5",children:p.jsxs("button",{onClick:n,"data-testid":"tour-new-session",className:"flex-1 px-3 py-1.5 rounded-md bg-bg-hi border border-line text-fg text-[12.5px] font-medium hover:bg-bg-hi/80 hover:border-accent/40 transition-colors flex items-center justify-center gap-1.5",children:[p.jsx(Yi,{name:"plus",size:13,stroke:1.8}),"Open / Start Project"]})})]})}function Nq({label:s,desc:e,collapsed:n,count:i,onToggle:r}){return p.jsxs("div",{className:"px-3 pt-3.5 pb-1.5",children:[p.jsxs("button",{onClick:r,"aria-expanded":!n,title:n?`Expand ${s}`:`Collapse ${s}`,className:"group w-full flex items-center gap-1.5 font-serif italic text-[11px] font-bold tracking-[0.07em] uppercase text-fg-faint hover:text-fg-dim transition-colors text-left",children:[p.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 text-[9px] not-italic transition-transform",style:{transform:n?"rotate(-90deg)":"rotate(0deg)"},children:"▾"}),p.jsx("span",{className:"flex-1",children:s}),n&&p.jsx("span",{className:"not-italic text-[10px] font-mono text-fg-faint/70 normal-case tracking-normal",children:i})]}),!n&&p.jsx("p",{className:"mt-0.5 pl-3.5 text-[11px] leading-[1.35] text-fg-faint/80 normal-case tracking-normal font-sans not-italic line-clamp-2",children:e})]})}function Y3({item:s,active:e,live:n,onClick:i,rail:r}){return p.jsxs("button",{onClick:i,title:s.hint,"data-testid":s.key==="scheduler"?"tour-scheduler":s.key==="terminal"?"tour-sessions":void 0,className:`relative w-full flex items-center rounded-[10px] text-left mb-0.5 transition-colors ${r?"justify-center px-0 py-[9px]":"gap-3 px-3.5 py-[9px] text-[14px]"} ${e?"bg-bg-hi text-fg font-semibold border border-line":"text-fg-dim hover:bg-bg-hi/50 hover:text-fg border border-transparent"}`,children:[e&&p.jsx("span",{"aria-hidden":!0,className:`absolute top-2 bottom-2 w-[3px] rounded-sm bg-accent ${r?"-left-[4px]":"-left-[10px]"}`}),p.jsx("span",{className:`inline-flex ${e?"text-accent":"text-fg-faint"}`,children:p.jsx(Yi,{name:s.icon,size:17,stroke:1.6})}),!r&&p.jsxs("span",{className:"flex-1 min-w-0",children:[p.jsx("span",{className:"block truncate",children:s.label}),s.hint&&p.jsx("span",{className:"block text-[11px] leading-[1.3] text-fg-faint/80 font-normal truncate",children:s.hint})]}),!r&&n&&p.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-accent animate-pulse",title:"live activity"}),r&&n&&p.jsx("span",{className:"absolute top-1.5 right-1.5 w-1.5 h-1.5 rounded-full bg-accent animate-pulse",title:"live activity"})]})}function TZe({rail:s,navFace:e}){const n=en(c=>c.isRecording),i=jt(c=>c.tabs),r=jt(c=>c.activeTabId),o=i.find(c=>c.id===r)??null,[a,l]=T.useState(null);return T.useEffect(()=>{let c=!1;if(!(o!=null&&o.presetId)){l(null);return}return kMe(o.presetId).then(d=>{c||l((d==null?void 0:d.model)??null)}).catch(()=>{c||l(null)}),()=>{c=!0}},[o==null?void 0:o.presetId]),s?p.jsx("div",{className:"py-2.5 border-t border-rule flex justify-center",children:p.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${n?"bg-red-500 animate-pulse":"bg-sage"}`,title:n?"recording":"idle"})}):p.jsxs("div",{className:"px-3.5 py-2.5 border-t border-rule flex items-center gap-2 text-[11.5px] text-fg-dim font-mono",children:[p.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${n?"bg-red-500 animate-pulse":"bg-sage"}`,title:n?"recording":"idle"}),(n||e==="project")&&p.jsx("span",{className:"truncate",title:a??"",children:n?"recording…":a?`Claude · ${dx(a)}`:"Claude Code"})]})}function IZe(s,e,n){return e?s.map(i=>i.id===e?{...i,lastActivityAt:n}:i):s}function RZe(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 AZe(s,e,n){const i=Date.now(),r={...s,lastEventAt:n!=null&&n.replay?s.lastEventAt:i},o=[],a=(l,c)=>l.length>c?l.slice(0,c-1)+"…":l;switch(e.kind){case"todo_write":{const l=Array.isArray(e.data)?e.data:[];r.todos=l,n!=null&&n.replay||o.push({id:0,kind:"todo-update",at:i,label:`Todos · ${l.length} item${l.length!==1?"s":""}`});break}case"tool_use":{const l=e.data,c=l.input,d={};for(const u of["command","file_path","pattern","url","query","subagent_type","description"])c&&u in c&&(d[u]=c[u]);if(r.lastToolUses=[{id:l.id,name:l.name,input:d,at:i},...s.lastToolUses].slice(0,50),!(n!=null&&n.replay)){const u=l.input,h=["Edit","Write","NotebookEdit"].includes(l.name),f=typeof(u==null?void 0:u.file_path)=="string"?u.file_path:void 0,g=typeof(u==null?void 0:u.command)=="string"?u.command:void 0,m=f?f.split("/").pop()??f:g?a(g,28):"";o.push({id:0,kind:"tool-use",at:i,label:m?`${l.name} · ${m}`:l.name,target:f??g,toolName:l.name}),h&&f&&o.push({id:0,kind:"file-edit",at:i,label:`${l.name} · ${a(f.split("/").pop()??f,34)}`,target:f,toolName:l.name})}break}case"plan":{const l=e.data,c=typeof l=="string"?l:(l==null?void 0:l.plan)??JSON.stringify(l);r.plans=[{at:i,content:c??""},...s.plans].slice(0,50),n!=null&&n.replay||o.push({id:0,kind:"plan-revision",at:i,label:"Plan revised"});break}case"agent_spawn":{const l=e.data;r.agents=[{id:l==null?void 0:l.toolUseId,at:i,subagentType:l==null?void 0:l.subagent_type,description:l==null?void 0:l.description,lastActivityAt:i},...s.agents].slice(0,50),n!=null&&n.replay||o.push({id:0,kind:"agent-spawn",at:i,label:l!=null&&l.subagent_type?`Agent: ${a(l.subagent_type,32)}`:"Agent spawned"});break}case"usage":{const l=e.data,c=(s.usage.inputTokens||0)+(s.usage.outputTokens||0),d=l.input_tokens??l.inputTokens??0,u=l.output_tokens??l.outputTokens??0,h=c+d+u;r.usage={inputTokens:(s.usage.inputTokens||0)+d,outputTokens:(s.usage.outputTokens||0)+u,cacheCreationInputTokens:(s.usage.cacheCreationInputTokens||0)+(l.cache_creation_input_tokens??l.cacheCreationInputTokens??0),cacheReadInputTokens:(s.usage.cacheReadInputTokens||0)+(l.cache_read_input_tokens??l.cacheReadInputTokens??0)},!(n!=null&&n.replay)&&Math.floor(h/1e3)>Math.floor(c/1e3)&&o.push({id:0,kind:"usage-tick",at:i,label:`${Math.floor(h/1e3)}k tokens`});break}case"tool_result":{const l=e.data;r.agents=IZe(s.agents,l==null?void 0:l.toolUseId,i);break}}return{next:r,newActivity:o}}const FF=lr((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]:RZe(n,i,r)}});const a=window.api.transcripts.onEvent(n,l=>e().ingestBatch(n,l));s({unsubs:{...e().unsubs,[n]:a}}),window.api.transcripts.subscribe({tabId:n,cwd:i,sessionUuid:r}).then(async l=>{const c=e().tabs[n];if(!c)return;if(!l.ok){const{toast:u}=await In(async()=>{const{toast:h}=await Promise.resolve().then(()=>LMe);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}=AZe(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 MZe(s){const e=FF(r=>r.subscribe),n=FF(r=>r.unsubscribe),i=FF(r=>s?r.tabs[s.id]:void 0);return T.useEffect(()=>{if(s)return e(s.id,s.cwd,s.sessionId),()=>n(s.id)},[s==null?void 0:s.id,s==null?void 0:s.cwd,s==null?void 0:s.sessionId,e,n]),i}function ePe(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 ZJ(s){return!s||typeof s.utilization!="number"||Number.isNaN(s.utilization)?null:Math.round(s.utilization)}function m0e(s,e){const n=ZJ(e);if(n==null)return`${s} — usage unavailable`;const i=ePe((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 PZe(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 tPe=T.createContext(null);function OZe({panelId:s,children:e}){return p.jsx(tPe.Provider,{value:s,children:e})}function kS(s){const e=T.useContext(tPe),n=s??e;return oi(i=>n==null||i.focusedPanelId===n)}function ude(s){const e=kS(s),n=T.useRef(e);return n.current=e,n}const jZe=5e3;let ny=null;const JJ=new Set;let Dq=0,nR=null;function FZe(){JJ.forEach(s=>s())}async function p8(){try{ny=await window.api.schedule.sessionSlots(),FZe()}catch{}}const BZe=0,HZe=10;async function WZe(s){ny||await p8();const e=ny?ny.min:BZe,n=ny?ny.max:HZe,i=Math.min(n,Math.max(e,Math.round(s)));await window.api.schedule.setSessionSlots(i),await p8()}function $Ze(){nR==null&&(p8(),nR=setInterval(()=>{p8()},jZe))}function VZe(){nR!=null&&(clearInterval(nR),nR=null)}function yO(s){const e=kS(s),[,n]=T.useState(0);return T.useEffect(()=>{const i=()=>n(r=>r+1);return JJ.add(i),()=>{JJ.delete(i)}},[]),T.useEffect(()=>{if(e)return Dq+=1,$Ze(),()=>{Dq-=1,Dq<=0&&VZe()}},[e]),ny}let mE=null;const QJ=new Set;let Tq=0,BF=null,eQ=!1;const zZe=360*60*1e3;let HF=null;function _0e(s){mE=s.check||!(mE!=null&&mE.check)?s:{...s,check:mE.check},QJ.forEach(e=>e())}function UZe(){if(eQ)return;eQ=!0,BF=window.api.updater.onStatus(_0e);const s=()=>{window.api.updater.status().then(_0e).catch(()=>{})};s(),HF=setInterval(s,zZe)}function GZe(){eQ=!1,HF!=null&&(clearInterval(HF),HF=null),BF&&(BF(),BF=null)}function nPe(){const[,s]=T.useState(0);return T.useEffect(()=>{const e=()=>s(n=>n+1);return QJ.add(e),Tq+=1,UZe(),()=>{QJ.delete(e),Tq-=1,Tq<=0&&GZe()}},[]),mE}function iPe({total:s,inUse:e,size:n}){const i=Math.min(Math.max(e,0),s),r=n==="md"?"w-3.5 h-3.5 rounded-full border":"w-2 h-2 rounded-full border";return p.jsx(p.Fragment,{children:Array.from({length:s},(o,a)=>p.jsx("span",{"data-testid":"slot-dot","data-filled":a<i?"true":"false",className:`${r} ${a<i?"bg-accent border-accent":"bg-bg border-line"}`},a))})}function qZe({onNavigate:s}){const e=jt(B=>B.tabs),n=jt(B=>B.activeTabId),i=e.find(B=>B.id===n)??null,r=MZe(i),o=(r==null?void 0:r.lastEventAt)??0,a=$A(B=>B.data),l=El(B=>{var z;return((z=B.snapshot)==null?void 0:z.paused)??null}),c=dde((i==null?void 0:i.cwd)??null),d=yO(),u=nPe(),h=(u==null?void 0:u.check)??null,f=Xs(B=>B.show),[,g]=T.useState(0);T.useEffect(()=>{const B=setInterval(()=>g(z=>z+1),6e4);return()=>clearInterval(B)},[]);const m=async()=>{const B=(u==null?void 0:u.latest)??"";try{const z=await window.api.updater.install(!1),J=(z==null?void 0:z.status)??await window.api.updater.status();(J==null?void 0:J.state)==="deferred"&&f("info",`Update v${B} will install when ${J.busyReason??"running jobs"} finish`)}catch(z){f("error",z instanceof Error?z.message:String(z))}},_=(r==null?void 0:r.todos)??[],[b,v]=T.useState(!1),x=T.useRef(null);T.useEffect(()=>{if(!b)return;const B=z=>{x.current&&!x.current.contains(z.target)&&v(!1)};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[b]),T.useEffect(()=>{_.length===0&&v(!1)},[_.length]);const w=JMe(a),y=(w==null?void 0:w.usage.five_hour)??null,S=(w==null?void 0:w.usage.seven_day)??null,E=ZJ(y),L=ZJ(S),D=(a==null?void 0:a.kind)==="ok"||(a==null?void 0:a.kind)==="ok-stale",I=o>0?XZe(Date.now()-o):"—",A=(d==null?void 0:d.total)??5,j=d?Math.min(Math.max(d.inUse,0),d.total):0,F=d?`${j} / ${A}`:`— / ${A}`,O=d&&d.holders.length>0?`
78
78
  `+d.holders.slice(0,5).map(B=>B.owner).join(`
79
- `):"",H=`${F} Claude sessions running${O}`;return p.jsxs("div",{className:"h-[30px] shrink-0 bg-bg-elev border-t border-line flex items-center gap-4 px-[18px] font-mono text-[11.5px] text-fg-dim","data-testid":"tour-statusbar",children:[p.jsxs("button",{onClick:()=>s==null?void 0:s("settings"),className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:D?"Connected to Anthropic":"Disconnected",children:[p.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${D?"bg-sage":"bg-fg-faint"}`}),p.jsx("span",{children:D?"connected":"offline"})]}),p.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:m0e("Session (5h window)",y),"data-testid":"footer-usage-session",children:["session ",p.jsx("span",{className:"text-fg",children:E!=null?`${E}%`:"—"})]}),p.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:m0e("Weekly window (all models)",S),"data-testid":"footer-usage-weekly",children:["weekly ",p.jsx("span",{className:"text-fg",children:L!=null?`${L}%`:"—"})]}),l&&p.jsxs("button",{onClick:()=>s==null?void 0:s("scheduler"),title:"Scheduler is paused — click to open Scheduler",className:`flex items-center gap-1 px-1.5 py-0.5 rounded border font-mono text-[10.5px] transition-colors ${l.reason==="auth"||l.reason==="network"?"border-red-700/60 text-red-300 hover:bg-red-900/20":"border-amber-700/60 text-amber-300 hover:bg-amber-900/20"}`,children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current opacity-80"}),"Scheduler paused · ",l.reason]}),i&&p.jsxs("span",{className:"text-fg-faint",title:i.cwd,children:[i.label,c&&p.jsxs("span",{className:"text-fg-dim",children:[" · ⌥",c]})]}),p.jsxs("span",{className:"text-fg-faint",children:["last activity: ",p.jsx("span",{className:"text-fg-dim",children:I})]}),_.length>0&&p.jsx(KZe,{ref:x,todos:_,open:b,onToggle:()=>v(B=>!B)}),p.jsx("span",{className:"flex-1"}),p.jsx("button",{onClick:()=>s==null?void 0:s("overview"),className:"flex items-center gap-1 hover:text-fg transition-colors",title:H,"data-testid":"footer-active-sessions",children:d&&d.total===0?p.jsx("span",{className:"text-fg-faint",children:"pool paused"}):p.jsx(iPe,{total:A,inUse:(d==null?void 0:d.inUse)??0,size:"sm"})}),(u==null?void 0:u.state)==="ready"?p.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:"A new version is downloaded. Click to restart and install — running jobs are waited for first.","data-testid":"footer-version",onClick:()=>{m()},children:["Update ready — restart to install v",u.latest]}):(u==null?void 0:u.state)==="deferred"?p.jsxs("span",{className:"text-amber-300",title:`Waiting for ${u.busyReason??"running jobs"} to finish before restarting`,"data-testid":"footer-version",children:["v",u.latest," installs when idle"]}):(u==null?void 0:u.state)==="downloading"?p.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["Downloading v",u.latest,"…"]}):h!=null&&h.behind&&h.latest&&h.channel==="installer"?p.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:`v${h.current} → v${h.latest}`,"data-testid":"footer-version",onClick:()=>{const B=h.downloadUrl;B&&window.api.shell.open({as:"external",url:B}).catch(()=>{f("error",`Couldn't open URL: ${B}`)})},children:["Download v",h.latest]}):h!=null&&h.behind&&h.latest?p.jsxs("span",{className:"text-amber-300",title:"A newer version is published — update the app. A stale npx cache can pin an old version.","data-testid":"footer-version",children:["v",h.current," → v",h.latest]}):p.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["v",(h==null?void 0:h.current)??"0.135.0"]})]})}const KZe=T.forwardRef(function({todos:e,open:n,onToggle:i},r){const o={completed:e.filter(a=>a.status==="completed").length,in_progress:e.filter(a=>a.status==="in_progress").length,pending:e.filter(a=>a.status==="pending").length};return p.jsxs("div",{ref:r,className:"relative",children:[p.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:"Live to-dos for this session","data-testid":"footer-todos",children:[p.jsxs("span",{className:"text-green-400",children:["✓",o.completed]}),p.jsxs("span",{className:"text-accent",children:["●",o.in_progress]}),p.jsxs("span",{className:"text-fg-dim",children:["○",o.pending]}),p.jsxs("span",{className:"text-fg-faint",children:["todos ",n?"▾":"▴"]})]}),n&&p.jsx("div",{className:`absolute bottom-full left-0 mb-1.5 w-80 max-h-72 overflow-auto bg-bg-elev border border-line rounded shadow-xl p-2 ${Ai.dialog}`,"data-testid":"footer-todos-popover",children:p.jsx("ul",{className:"space-y-0.5",children:e.map((a,l)=>p.jsxs("li",{className:`flex items-start gap-2 py-1 px-1.5 rounded ${a.status==="in_progress"?"bg-bg-hi":""}`,children:[p.jsx(YZe,{status:a.status}),p.jsx("span",{className:a.status==="completed"?"text-fg-faint line-through":a.status==="in_progress"?"text-fg":"text-fg-dim",children:a.status==="in_progress"&&a.activeForm?a.activeForm:a.content})]},l))})})]})});function YZe({status:s}){return s==="completed"?p.jsx("span",{className:"text-green-400 w-3 shrink-0",children:"✓"}):s==="in_progress"?p.jsx("span",{className:"w-3 shrink-0",children:p.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-accent animate-pulse"})}):p.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:"○"})}function XZe(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 ZZe({onClose:s,onSent:e}){const n=jt(L=>L.tabs),[i,r]=T.useState(""),[o,a]=T.useState(()=>Object.fromEntries(n.map(L=>[L.id,!0]))),[l,c]=T.useState(!1),[d,u]=T.useState({}),h=T.useRef(null),f=T.useRef(e);T.useEffect(()=>{f.current=e},[e]),T.useEffect(()=>{a(L=>{const D={};for(const I of n)D[I.id]=L[I.id]??!0;return D})},[n]),T.useEffect(()=>{var L;(L=h.current)==null||L.focus()},[]),T.useEffect(()=>window.api.pty.onWriteError(D=>{u(I=>D.tabId in I?{...I,[D.tabId]:"skipped"}:I)}),[]),T.useEffect(()=>{if(Object.keys(d).length===0)return;const L=Object.values(d).filter(I=>I==="sent").length,D=window.setTimeout(()=>f.current(L),1500);return()=>window.clearTimeout(D)},[d]);const g=n.filter(L=>o[L.id]).map(L=>L.id),m=g.length,_=Object.keys(d).length>0,b=i.length>0&&m>0&&!l&&!_,v=()=>{if(!b)return;c(!0);const L=jt.getState().tabs,D=new Set(L.map(A=>A.id)),I={};for(const A of g)D.has(A)?(window.api.pty.write({tabId:A,data:i+"\r"}),I[A]="sent"):I[A]="skipped";u(I),c(!1)},x=L=>{if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),s();return}L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),v())},w=n.length>0&&n.every(L=>o[L.id]),y=()=>{const L=!w;a(Object.fromEntries(n.map(D=>[D.id,L])))},S=Object.values(d).some(L=>L==="skipped"),E=_?S?"Sent (some skipped)":"Sent":`Send to ${m} tab${m===1?"":"s"}`;return p.jsxs("div",{className:"border-b border-line bg-bg-elev px-4 py-3 flex flex-col gap-2 shrink-0",onKeyDown:x,"data-testid":"broadcast-bar",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"text-xs text-fg-dim uppercase tracking-wider",children:"Broadcast"}),p.jsx("div",{className:"text-[10px] text-fg-faint",children:"Esc to close · Cmd/Ctrl+Enter to send"})]}),p.jsx("textarea",{ref:h,value:i,onChange:L=>r(L.target.value),rows:3,placeholder:"Prompt to broadcast…",className:"w-full bg-bg border border-line rounded px-2 py-1.5 text-xs text-fg font-mono resize-y focus:outline-none focus:border-fg-faint"}),p.jsxs("div",{className:"flex flex-col gap-1",children:[p.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-fg-dim cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:w,onChange:y,className:"accent-accent"}),p.jsxs("span",{children:["All tabs (",m,"/",n.length,")"]})]}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 max-h-24 overflow-y-auto pl-4",children:n.map(L=>p.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-fg-dim cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:!!o[L.id],onChange:D=>a(I=>({...I,[L.id]:D.target.checked})),className:"accent-accent"}),p.jsx("span",{className:"truncate max-w-[12rem]",children:L.label}),d[L.id]==="sent"&&p.jsx("span",{"data-testid":"broadcast-row-sent",className:"text-[10px] text-green-500",children:"✓"}),d[L.id]==="skipped"&&p.jsx("span",{"data-testid":"broadcast-row-skipped",className:"text-[10px] text-red-400",children:"×"})]},L.id))})]}),p.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[p.jsx("button",{onClick:s,className:"px-2 py-0.5 text-[10px] text-fg-faint hover:text-fg border border-line hover:border-fg-faint rounded transition-colors",children:"Cancel"}),p.jsx("button",{onClick:v,disabled:!b,className:"px-2 py-0.5 text-[10px] text-fg border border-accent-muted hover:border-accent rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:E})]})]})}function JZe({tabId:s,cwd:e,onClose:n}){const i=Q2(m=>m.watchersForTab(s)),r=Q2(m=>m.add),o=Q2(m=>m.remove),a=T.useRef(null),[l,c]=T.useState(""),[d,u]=T.useState(""),[h,f]=T.useState(!1);T.useEffect(()=>{const m=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),T.useEffect(()=>{const m=_=>{a.current&&!a.current.contains(_.target)&&n()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[n]);const g=async()=>{const m=d.trim();if(!m||h)return;f(!0);const _=await r({tabId:s,label:l.trim(),command:m,cwd:e});f(!1),_&&(c(""),u(""))};return p.jsxs("div",{ref:a,className:"absolute right-2 top-full mt-1 z-30 w-[420px] max-w-[calc(100vw-1rem)] bg-bg-elev border border-line rounded shadow-lg p-3 text-xs",role:"dialog","aria-label":"Watchers","data-testid":"watchers-popover",children:[p.jsxs("div",{className:"flex items-center mb-2",children:[p.jsx("span",{className:"text-fg-dim uppercase tracking-wider",children:"Watchers"}),p.jsxs("span",{className:"text-fg-faint ml-2",children:[i.length," active"]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:n,className:"text-fg-faint hover:text-fg",title:"Close",children:"×"})]}),p.jsxs("div",{className:"flex flex-col gap-1.5 mb-3",children:[p.jsx("input",{value:l,onChange:m=>c(m.target.value),placeholder:"label (optional)",className:"bg-bg border border-line rounded px-2 py-1 text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint"}),p.jsxs("div",{className:"flex gap-1.5",children:[p.jsx("input",{value:d,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&g()},placeholder:"shell command — e.g. npm test --watch",className:"flex-1 bg-bg border border-line rounded px-2 py-1 text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint font-mono","data-testid":"watcher-command-input"}),p.jsx("button",{onClick:g,disabled:!d.trim()||h,className:"px-2 py-1 border border-line rounded text-fg-dim hover:text-fg hover:border-fg-faint disabled:opacity-40 disabled:cursor-not-allowed","data-testid":"watcher-add",children:"Add"})]}),p.jsxs("span",{className:"text-fg-faint",children:["cwd: ",p.jsx("span",{className:"font-mono",children:e})]})]}),i.length===0?p.jsx("div",{className:"text-fg-faint italic py-2",children:"no watchers — add one above"}):p.jsx("ul",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto",children:i.map(m=>{const _=m.lines[m.lines.length-1];return p.jsxs("li",{className:"border border-line rounded p-2 bg-bg",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-medium text-fg truncate",children:m.label}),p.jsxs("span",{className:"text-fg-faint",children:[m.lineCount," line",m.lineCount===1?"":"s"]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:()=>o(m.watcherId),className:"text-fg-faint hover:text-red-400",title:"Stop watcher","data-testid":`watcher-remove-${m.watcherId}`,children:"stop"})]}),p.jsx("div",{className:"text-fg-faint font-mono text-[10px] truncate mt-0.5",title:m.command,children:m.command}),p.jsx("div",{className:"text-fg-dim font-mono text-[10px] truncate mt-1",title:(_==null?void 0:_.line)??"",children:_?_.line:p.jsx("span",{className:"italic text-fg-faint",children:"waiting for output…"})})]},m.watcherId)})})]})}/**
79
+ `):"",H=`${F} Claude sessions running${O}`;return p.jsxs("div",{className:"h-[30px] shrink-0 bg-bg-elev border-t border-line flex items-center gap-4 px-[18px] font-mono text-[11.5px] text-fg-dim","data-testid":"tour-statusbar",children:[p.jsxs("button",{onClick:()=>s==null?void 0:s("settings"),className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:D?"Connected to Anthropic":"Disconnected",children:[p.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${D?"bg-sage":"bg-fg-faint"}`}),p.jsx("span",{children:D?"connected":"offline"})]}),p.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:m0e("Session (5h window)",y),"data-testid":"footer-usage-session",children:["session ",p.jsx("span",{className:"text-fg",children:E!=null?`${E}%`:"—"})]}),p.jsxs("button",{onClick:()=>s==null?void 0:s("overview"),className:"hover:text-fg transition-colors",title:m0e("Weekly window (all models)",S),"data-testid":"footer-usage-weekly",children:["weekly ",p.jsx("span",{className:"text-fg",children:L!=null?`${L}%`:"—"})]}),l&&p.jsxs("button",{onClick:()=>s==null?void 0:s("scheduler"),title:"Scheduler is paused — click to open Scheduler",className:`flex items-center gap-1 px-1.5 py-0.5 rounded border font-mono text-[10.5px] transition-colors ${l.reason==="auth"||l.reason==="network"?"border-red-700/60 text-red-300 hover:bg-red-900/20":"border-amber-700/60 text-amber-300 hover:bg-amber-900/20"}`,children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current opacity-80"}),"Scheduler paused · ",l.reason]}),i&&p.jsxs("span",{className:"text-fg-faint",title:i.cwd,children:[i.label,c&&p.jsxs("span",{className:"text-fg-dim",children:[" · ⌥",c]})]}),p.jsxs("span",{className:"text-fg-faint",children:["last activity: ",p.jsx("span",{className:"text-fg-dim",children:I})]}),_.length>0&&p.jsx(KZe,{ref:x,todos:_,open:b,onToggle:()=>v(B=>!B)}),p.jsx("span",{className:"flex-1"}),p.jsx("button",{onClick:()=>s==null?void 0:s("overview"),className:"flex items-center gap-1 hover:text-fg transition-colors",title:H,"data-testid":"footer-active-sessions",children:d&&d.total===0?p.jsx("span",{className:"text-fg-faint",children:"pool paused"}):p.jsx(iPe,{total:A,inUse:(d==null?void 0:d.inUse)??0,size:"sm"})}),(u==null?void 0:u.state)==="ready"?p.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:"A new version is downloaded. Click to restart and install — running jobs are waited for first.","data-testid":"footer-version",onClick:()=>{m()},children:["Update ready — restart to install v",u.latest]}):(u==null?void 0:u.state)==="deferred"?p.jsxs("span",{className:"text-amber-300",title:`Waiting for ${u.busyReason??"running jobs"} to finish before restarting`,"data-testid":"footer-version",children:["v",u.latest," installs when idle"]}):(u==null?void 0:u.state)==="downloading"?p.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["Downloading v",u.latest,"…"]}):h!=null&&h.behind&&h.latest&&h.channel==="installer"?p.jsxs("button",{type:"button",className:"text-amber-300 hover:underline",title:`v${h.current} → v${h.latest}`,"data-testid":"footer-version",onClick:()=>{const B=h.downloadUrl;B&&window.api.shell.open({as:"external",url:B}).catch(()=>{f("error",`Couldn't open URL: ${B}`)})},children:["Download v",h.latest]}):h!=null&&h.behind&&h.latest?p.jsxs("span",{className:"text-amber-300",title:"A newer version is published — update the app. A stale npx cache can pin an old version.","data-testid":"footer-version",children:["v",h.current," → v",h.latest]}):p.jsxs("span",{className:"text-fg-dim","data-testid":"footer-version",children:["v",(h==null?void 0:h.current)??"0.135.1"]})]})}const KZe=T.forwardRef(function({todos:e,open:n,onToggle:i},r){const o={completed:e.filter(a=>a.status==="completed").length,in_progress:e.filter(a=>a.status==="in_progress").length,pending:e.filter(a=>a.status==="pending").length};return p.jsxs("div",{ref:r,className:"relative",children:[p.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 hover:text-fg transition-colors",title:"Live to-dos for this session","data-testid":"footer-todos",children:[p.jsxs("span",{className:"text-green-400",children:["✓",o.completed]}),p.jsxs("span",{className:"text-accent",children:["●",o.in_progress]}),p.jsxs("span",{className:"text-fg-dim",children:["○",o.pending]}),p.jsxs("span",{className:"text-fg-faint",children:["todos ",n?"▾":"▴"]})]}),n&&p.jsx("div",{className:`absolute bottom-full left-0 mb-1.5 w-80 max-h-72 overflow-auto bg-bg-elev border border-line rounded shadow-xl p-2 ${Ai.dialog}`,"data-testid":"footer-todos-popover",children:p.jsx("ul",{className:"space-y-0.5",children:e.map((a,l)=>p.jsxs("li",{className:`flex items-start gap-2 py-1 px-1.5 rounded ${a.status==="in_progress"?"bg-bg-hi":""}`,children:[p.jsx(YZe,{status:a.status}),p.jsx("span",{className:a.status==="completed"?"text-fg-faint line-through":a.status==="in_progress"?"text-fg":"text-fg-dim",children:a.status==="in_progress"&&a.activeForm?a.activeForm:a.content})]},l))})})]})});function YZe({status:s}){return s==="completed"?p.jsx("span",{className:"text-green-400 w-3 shrink-0",children:"✓"}):s==="in_progress"?p.jsx("span",{className:"w-3 shrink-0",children:p.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-accent animate-pulse"})}):p.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:"○"})}function XZe(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 ZZe({onClose:s,onSent:e}){const n=jt(L=>L.tabs),[i,r]=T.useState(""),[o,a]=T.useState(()=>Object.fromEntries(n.map(L=>[L.id,!0]))),[l,c]=T.useState(!1),[d,u]=T.useState({}),h=T.useRef(null),f=T.useRef(e);T.useEffect(()=>{f.current=e},[e]),T.useEffect(()=>{a(L=>{const D={};for(const I of n)D[I.id]=L[I.id]??!0;return D})},[n]),T.useEffect(()=>{var L;(L=h.current)==null||L.focus()},[]),T.useEffect(()=>window.api.pty.onWriteError(D=>{u(I=>D.tabId in I?{...I,[D.tabId]:"skipped"}:I)}),[]),T.useEffect(()=>{if(Object.keys(d).length===0)return;const L=Object.values(d).filter(I=>I==="sent").length,D=window.setTimeout(()=>f.current(L),1500);return()=>window.clearTimeout(D)},[d]);const g=n.filter(L=>o[L.id]).map(L=>L.id),m=g.length,_=Object.keys(d).length>0,b=i.length>0&&m>0&&!l&&!_,v=()=>{if(!b)return;c(!0);const L=jt.getState().tabs,D=new Set(L.map(A=>A.id)),I={};for(const A of g)D.has(A)?(window.api.pty.write({tabId:A,data:i+"\r"}),I[A]="sent"):I[A]="skipped";u(I),c(!1)},x=L=>{if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),s();return}L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),v())},w=n.length>0&&n.every(L=>o[L.id]),y=()=>{const L=!w;a(Object.fromEntries(n.map(D=>[D.id,L])))},S=Object.values(d).some(L=>L==="skipped"),E=_?S?"Sent (some skipped)":"Sent":`Send to ${m} tab${m===1?"":"s"}`;return p.jsxs("div",{className:"border-b border-line bg-bg-elev px-4 py-3 flex flex-col gap-2 shrink-0",onKeyDown:x,"data-testid":"broadcast-bar",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"text-xs text-fg-dim uppercase tracking-wider",children:"Broadcast"}),p.jsx("div",{className:"text-[10px] text-fg-faint",children:"Esc to close · Cmd/Ctrl+Enter to send"})]}),p.jsx("textarea",{ref:h,value:i,onChange:L=>r(L.target.value),rows:3,placeholder:"Prompt to broadcast…",className:"w-full bg-bg border border-line rounded px-2 py-1.5 text-xs text-fg font-mono resize-y focus:outline-none focus:border-fg-faint"}),p.jsxs("div",{className:"flex flex-col gap-1",children:[p.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-fg-dim cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:w,onChange:y,className:"accent-accent"}),p.jsxs("span",{children:["All tabs (",m,"/",n.length,")"]})]}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 max-h-24 overflow-y-auto pl-4",children:n.map(L=>p.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-fg-dim cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:!!o[L.id],onChange:D=>a(I=>({...I,[L.id]:D.target.checked})),className:"accent-accent"}),p.jsx("span",{className:"truncate max-w-[12rem]",children:L.label}),d[L.id]==="sent"&&p.jsx("span",{"data-testid":"broadcast-row-sent",className:"text-[10px] text-green-500",children:"✓"}),d[L.id]==="skipped"&&p.jsx("span",{"data-testid":"broadcast-row-skipped",className:"text-[10px] text-red-400",children:"×"})]},L.id))})]}),p.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[p.jsx("button",{onClick:s,className:"px-2 py-0.5 text-[10px] text-fg-faint hover:text-fg border border-line hover:border-fg-faint rounded transition-colors",children:"Cancel"}),p.jsx("button",{onClick:v,disabled:!b,className:"px-2 py-0.5 text-[10px] text-fg border border-accent-muted hover:border-accent rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:E})]})]})}function JZe({tabId:s,cwd:e,onClose:n}){const i=Q2(m=>m.watchersForTab(s)),r=Q2(m=>m.add),o=Q2(m=>m.remove),a=T.useRef(null),[l,c]=T.useState(""),[d,u]=T.useState(""),[h,f]=T.useState(!1);T.useEffect(()=>{const m=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),T.useEffect(()=>{const m=_=>{a.current&&!a.current.contains(_.target)&&n()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[n]);const g=async()=>{const m=d.trim();if(!m||h)return;f(!0);const _=await r({tabId:s,label:l.trim(),command:m,cwd:e});f(!1),_&&(c(""),u(""))};return p.jsxs("div",{ref:a,className:"absolute right-2 top-full mt-1 z-30 w-[420px] max-w-[calc(100vw-1rem)] bg-bg-elev border border-line rounded shadow-lg p-3 text-xs",role:"dialog","aria-label":"Watchers","data-testid":"watchers-popover",children:[p.jsxs("div",{className:"flex items-center mb-2",children:[p.jsx("span",{className:"text-fg-dim uppercase tracking-wider",children:"Watchers"}),p.jsxs("span",{className:"text-fg-faint ml-2",children:[i.length," active"]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:n,className:"text-fg-faint hover:text-fg",title:"Close",children:"×"})]}),p.jsxs("div",{className:"flex flex-col gap-1.5 mb-3",children:[p.jsx("input",{value:l,onChange:m=>c(m.target.value),placeholder:"label (optional)",className:"bg-bg border border-line rounded px-2 py-1 text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint"}),p.jsxs("div",{className:"flex gap-1.5",children:[p.jsx("input",{value:d,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&g()},placeholder:"shell command — e.g. npm test --watch",className:"flex-1 bg-bg border border-line rounded px-2 py-1 text-fg placeholder:text-fg-faint focus:outline-none focus:border-fg-faint font-mono","data-testid":"watcher-command-input"}),p.jsx("button",{onClick:g,disabled:!d.trim()||h,className:"px-2 py-1 border border-line rounded text-fg-dim hover:text-fg hover:border-fg-faint disabled:opacity-40 disabled:cursor-not-allowed","data-testid":"watcher-add",children:"Add"})]}),p.jsxs("span",{className:"text-fg-faint",children:["cwd: ",p.jsx("span",{className:"font-mono",children:e})]})]}),i.length===0?p.jsx("div",{className:"text-fg-faint italic py-2",children:"no watchers — add one above"}):p.jsx("ul",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto",children:i.map(m=>{const _=m.lines[m.lines.length-1];return p.jsxs("li",{className:"border border-line rounded p-2 bg-bg",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-medium text-fg truncate",children:m.label}),p.jsxs("span",{className:"text-fg-faint",children:[m.lineCount," line",m.lineCount===1?"":"s"]}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:()=>o(m.watcherId),className:"text-fg-faint hover:text-red-400",title:"Stop watcher","data-testid":`watcher-remove-${m.watcherId}`,children:"stop"})]}),p.jsx("div",{className:"text-fg-faint font-mono text-[10px] truncate mt-0.5",title:m.command,children:m.command}),p.jsx("div",{className:"text-fg-dim font-mono text-[10px] truncate mt-1",title:(_==null?void 0:_.line)??"",children:_?_.line:p.jsx("span",{className:"italic text-fg-faint",children:"waiting for output…"})})]},m.watcherId)})})]})}/**
80
80
  * dockview-core
81
81
  * @version 6.6.1
82
82
  * @link https://github.com/mathuo/dockview
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-session-manager",
3
- "version": "0.135.0",
3
+ "version": "0.135.1",
4
4
  "description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
5
5
  "type": "module",
6
6
  "main": "src/main/index.cjs",
package/plugins/CLAUDE.md CHANGED
@@ -26,8 +26,8 @@ breaks them all, undetectably from here.
26
26
  **Path literals inside shipped skills.** A skill runs in OTHER repos, so a
27
27
  session-manager-internal path (`src/main/...`, `src/renderer/...`, bare `scripts/...`) inside one
28
28
  is a portability defect unless `$SM_ROOT`-qualified (e.g. `node "$SM_ROOT/scripts/<x>.cjs"`, with `$SM_ROOT` resolved
29
- to the installed package root) or removed. Current offenders, not precedent: `builder/SKILL.md` +
30
- `builder/0-diff/SKILL.md`, `develop/standards.md`.
29
+ to the installed package root) or removed. `builder/manual.md` is session-manager-specific on
30
+ purpose and runs only when `session-manager-operations/manual/manual.json` exists.
31
31
 
32
32
  ## Who consumes this
33
33
 
@@ -46,12 +46,11 @@ for live sibling consumers.
46
46
  - Do not confuse this with `.claude/` at the repo root — this repo's own unshipped local dev
47
47
  config. `.claude/agents/*.md` are per-project OVERLAYS that win over
48
48
  `~/.claude/agents/*.md` (Claude Code's own precedence, per `src/main/agentLibrary.cjs`);
49
- `src/seed/agents/` is the shipped source for the four personas
50
- `src/main/seedAgentPersonas.cjs` copies into `~/.claude/agents/` on first boot (see its
51
- `PERSONAS` list); `builder` has no seed source
52
- and exists only as this repo's overlay. Tracked on purpose: `.claude/settings.json` (guard
53
- hooks) plus the `builder.md`/`project-home-builder.md` overlays (auditable edits) —
54
- nothing else under `.claude/` is.
49
+ `src/seed/agents/` is the shipped source for the personas
50
+ `src/main/seedAgentPersonas.cjs` copies into `~/.claude/agents/` (its `PERSONAS` list);
51
+ `builder` has no seed source — the generic `~/.claude/agents/builder.md` is machine-local
52
+ and this repo's `.claude/agents/builder.md` overlays it. Tracked under `.claude/`:
53
+ `settings.json` (guard hooks), `agents/builder.md`, and the `agents/page-*.md` stewards.
55
54
  - The scheduler MCP server (`session-manager-scheduler`) is registered at USER scope in
56
55
  `~/.claude.json`, not in this repo.
57
56
  - A skill may run headless via a scheduled PRD in another project — don't rely on
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "session-manager-dev",
3
3
  "description": "The default end-to-end development skillset for the Claude Code Session Manager: decompose work into scheduler PRDs and track them to a validated finish (/develop), publish releases to npm (/builder), hand a finding to another project on this machine (/send-feedback), and review or drift-check a project's CLAUDE.md/markdown network (/maintaining-md-network). Together with the session-manager scheduler these form a develop → queue → validate → release loop.",
4
- "version": "0.3.6",
4
+ "version": "0.4.0",
5
5
  "author": {
6
6
  "name": "Bilko Bibitkov",
7
7
  "email": "BilkoBibitkov2000@gmail.com",
@@ -1,95 +1,117 @@
1
1
  ---
2
2
  name: builder
3
- description: Watch the current project's git history against its published npm package and drive the next publish — diff HEAD against the last release, classify + bump the version from conventional-commit prefixes, gate on typecheck/tests, publish from an isolated git worktree (never the live working directory), keep the free Field Manual in step with what shipped, then report. Orchestrates 6 nested sub-skills (builder:diff, :classify-and-bump, :gate, :publish, :manual, :report). Use when the user says "/builder", "publish", "release", "cut a release", "bump the version", "ship to npm", "update the manual", or asks whether there's anything unpublished.
3
+ description: Release the current project's npm package — diff HEAD against the last published version, pick the semver bump from conventional-commit prefixes, run the project's gates, publish from an isolated git worktree (never the live working directory), keep a Field Manual in step when the project has one, then report. Use when the user says "/builder" or asks to publish, release, cut a release, bump the version, ship to npm, update the manual, or whether anything is unpublished.
4
4
  ---
5
5
 
6
- # builder (orchestrator)
7
-
8
- Global, project-agnostic release pipeline — works against whatever npm package the current
9
- project publishes (resolved via `src/main/lib/buildTarget.cjs`'s `resolveBuildTarget()`, or
10
- by reading `package.json` directly if that file isn't present yet). Codified from a real
11
- session that ran this exact sequence 4 times by hand, publishing session-manager
12
- v0.45.1 → v0.47.1 to npm — this skill turns that proven manual procedure into a reusable one.
13
-
14
- **Naming convention**: sub-skill directories
15
- are prefixed `0-`, `1-`, ... in execution order, so a plain directory listing sorts in DAG
16
- order without opening any file. The invocable `name:` field stays a clean colon-scoped
17
- identifier (`builder:diff`) without the numeric prefix.
18
-
19
- ## Pipeline DAG
20
-
21
- ```
22
- ┌───────────────────────┐
23
- │ 0. builder:diff │ HEAD vs. last published version (npm view, else last git tag)
24
- └───────────────────────┘
25
- │ commit list since last release (empty → stop, nothing to do)
26
- ▼
27
- ┌───────────────────────────┐
28
- │ 1. builder:classify-and-bump │ conventional-commit prefixes → patch/minor/major
29
- └───────────────────────────┘ (non-conventional history → ask, don't guess)
30
- │ bump kind decided
31
- ▼
32
- ┌───────────────────────┐
33
- │ 2. builder:gate │ npm run typecheck + npm run test:unit, both bounded
34
- └───────────────────────┘
35
- PASS │ │ FAIL
36
- ▼ ▼
37
- ┌───────────────────────┐ STOP — report failing gate, do not publish
38
- │ 3. builder:publish │ ISOLATED WORKTREE technique (see that step's own file)
39
- └───────────────────────┘
40
- │ version bumped, tagged, pushed, published, dist-tag verified
41
- ▼
42
- ┌───────────────────────┐
43
- │ 4. builder:manual │ does the Field Manual still describe reality?
44
- └───────────────────────┘ revise chapters → bump manual version → build bundle
45
- │ manual release (or an explicit "no content change")
46
- ▼
47
- ┌───────────────────────┐
48
- │ 5. builder:report │ version, commits covered, dist-tag, manual + push confirmation
49
- └───────────────────────┘
50
- ```
51
-
52
- | Step | Input | Output | On failure/empty |
53
- |---|---|---|---|
54
- | 0. `builder:diff` | current project cwd | commit list since last published version (or last git tag) | no commits since last release → stop, report "nothing to publish" |
55
- | 1. `builder:classify-and-bump` | commit list | bump kind (`patch`/`minor`/`major`) | commits don't follow conventional-commit style → say so, ask the user rather than guessing |
56
- | 2. `builder:gate` | working tree at HEAD | typecheck + unit test result | either fails → stop, report the failure, do not publish |
57
- | 3. `builder:publish` | bump kind, gate-passed HEAD | published npm package, pushed tag + main | any step fails → stop, report which step and the worktree's state (don't leave it behind uncleaned unless it's evidence of the failure) |
58
- | 4. `builder:manual` | commit list + published version | revised chapters + a built manual release bundle, or an explicit "no content change" | build refuses (missing chapter/asset, bad slug, no free chapter) → stop and report; the npm publish already landed and is unaffected |
59
- | 5. `builder:report` | publish + manual result | one summary: version bumped, commits covered, npm dist-tag verified, git push confirmed, manual edition shipped or explicitly unchanged | n/a |
60
-
61
- ## Hard rules — read before running any step
62
-
63
- - **A dirty working tree in the main repo is NOT a blocker.** The isolated-worktree
64
- technique in `builder:publish` sidesteps it entirely — `npm ci` + `vite build` +
65
- `npm publish` all run inside a clean worktree checked out from the just-created tag, never
66
- touching the live/dirty repo. Don't hold the pipeline waiting for a clean tree; that
67
- guidance is superseded by this skill.
68
- - **Once a diff is found and the gate passes, run the full sequence through to publish
69
- without pausing for reconfirmation.** This was confirmed by the user across 4 consecutive
70
- manual runs in the session that originated this skill — asking "should I publish now?"
71
- after the gate is green is exactly the friction this skill exists to remove.
72
- - **The gate is a hard stop.** A failing `typecheck` or `test:unit` run means step 3 never
73
- executes — no publish, no version bump, no tag. Report the failure and stop.
74
- - **The manual is a product, not a changelog.** `builder:manual` may only claim what it has
75
- verified against real code, and may never invent a screenshot. A wrong instruction in a
76
- guide readers follow step by step breaks their setup — hold it above the app's own docs.
77
- A manual bundle that isn't pushed to the Bilko repo is not shipped; say so plainly.
78
- - **Never guess a version bump from unconventional commit messages.** If the commit list
79
- doesn't cleanly map to `fix:`/`feat:`/`BREAKING CHANGE:` prefixes, `builder:classify-and-bump`
80
- asks the user which bump to apply rather than inferring one.
81
-
82
- ## Why nested skills instead of one inline sequence
83
-
84
- Each step is its own file so it shows up as its own invocation in whatever surface tracks
85
- skill/tool calls, and so a step can be changed (a different gate command, a new registry
86
- target) without touching the others.
87
-
88
- ## What this skill is not
89
-
90
- - Not a decision-maker on *whether* to release — it assumes the user (or an Epic) already
91
- wants the next diff shipped. If there's genuine ambiguity about scope, `builder:classify-and-bump`
92
- is the one step that pauses to ask.
93
- - Not a registry-agnostic tool — `builder:publish` is npm-specific (see `buildTarget.cjs`'s
94
- `registry` field for future non-npm targets; out of scope for this version).
95
- - Not wired to any UI button — invoking this skill is the only entry point today.
6
+ # builder
7
+
8
+ Release pipeline for whatever npm package the current project publishes. Configuration comes
9
+ from `session-manager-operations/architecture/build-target.json` (`packageName`, `registry`,
10
+ `versionBumpPolicy`, `gates`). When that file is absent, use `package.json`'s `name`,
11
+ conventional-commit bumps and no declared gates, and say in the report which source you used.
12
+
13
+ The decision to release was made when this skill was invoked. Once a diff exists and the gates
14
+ pass, run straight through to publish without asking again. Stop only where a step below says
15
+ stop.
16
+
17
+ ## 1. Diff — what is unpublished
18
+
19
+ 1. Last published point: `npm view <packageName> version` (the registry, not a local tag — a
20
+ tag can exist for a publish that failed). No network, or a 404 because the package was never
21
+ published: `git describe --tags --abbrev=0`.
22
+ 2. Resolve that version's tag (`git tag -l 'v<version>'`). If no local tag matches, compare
23
+ against `git describe --tags --abbrev=0` and note the discrepancy in the report.
24
+ 3. `git log <tag>..HEAD --oneline`. Empty → stop and report "nothing to publish".
25
+
26
+ ## 2. Classify and bump
27
+
28
+ Take the highest bump the whole commit list implies:
29
+
30
+ - `BREAKING CHANGE:` in a body, or `!:` after the type/scope (`feat(api)!:`) → **major**.
31
+ - Any `feat:` / `feat(scope):` → **minor**.
32
+ - Any `fix:` / `fix(scope):` → **patch**.
33
+ - Only `chore:`, `docs:`, `refactor:`, `test:`, `ci:` and the like → **patch** (a release was
34
+ requested; these still ship in it).
35
+
36
+ If a meaningful share of commits has no `type:` prefix at all (a bare "wip", "updates"), do not
37
+ guess: list the unclassifiable commits and ask which bump to apply. A wrong semver bump is hard
38
+ to walk back once published.
39
+
40
+ ## 3. Gate
41
+
42
+ Run each name in `build-target.json`'s `gates` as `timeout 300 npm run <gate>`, in order,
43
+ against `HEAD`, with no `--skip` flags. With no `gates` entry, run the pre-commit checks the
44
+ project's `CLAUDE.md` or README requires; with none documented, say so in the report. Any
45
+ failure → stop: report the command and its real output, and that no bump, tag or publish
46
+ happened.
47
+
48
+ ## 4. Publish from an isolated worktree
49
+
50
+ A dirty main working tree does not block this: the build and publish run in a clean worktree
51
+ checked out at the release tag, so nothing uncommitted in the main tree reaches the artifact.
52
+ Run in this order:
53
+
54
+ 1. `npm version <bump> --no-git-tag-version` — updates `package.json` / `package-lock.json`
55
+ without a tag, so the tag below carries the release commit.
56
+ 2. `git add package.json package-lock.json` — only these two, never `-A`.
57
+ 3. Commit, listing the release's commits:
58
+ ```
59
+ git commit -m "chore(release): bump to v<version>
60
+
61
+ - <commit subject>
62
+ - ..."
63
+ ```
64
+ 4. `git tag v<version>`
65
+ 5. `mkdir -p "$HOME/.cache/sm-publish" && git worktree add "$HOME/.cache/sm-publish/v<version>" v<version>`
66
+ — never under `/tmp` or `os.tmpdir()`: some test suites (this repo's included) treat those
67
+ paths as fixtures and fail there.
68
+ 6. In the worktree: `npm ci`, then the gates again (step 3), then the project's build. Check
69
+ every `files` entry in `package.json` exists before publishing; stop on any failure.
70
+ 7. `npm publish` from inside the worktree, so `prepublishOnly` builds there too.
71
+ A 403 saying two-factor authentication or a bypass-2FA granular token is required is not a
72
+ login problem (`npm whoami` can succeed). Don't retry `npm login` or `npm publish`: run
73
+ `npm profile get` and `npm token list`, stop, and report the exact 403 and both results so a
74
+ human can supply an OTP or a token (the CLI cannot mint a granular token). An E409 "staged"
75
+ response means the publish waits for a human to approve it on npmjs.com — report that.
76
+ 8. Back in the main repo: `git push origin main` and `git push origin v<version>`.
77
+ 9. `git worktree remove "$HOME/.cache/sm-publish/v<version>" --force`
78
+ 10. Verify the registry. `npm view` lags for minutes, so read a cache-busted packument and the
79
+ tarball first:
80
+ ```
81
+ curl -s "https://registry.npmjs.org/<packageName>?t=$(date +%s)"
82
+ curl -sI <versions["<version>"].dist.tarball>
83
+ npm view <packageName> version dist-tags
84
+ ```
85
+ `dist-tags.latest` is `<version>`, the version is listed, the tarball returns 200. A stale
86
+ `npm view` with a current packument is lag, not failure — never republish.
87
+ 11. If `.github/workflows/release.yml` exists, the tag push started it. Wait on that run with a
88
+ bounded blocking watcher, then read the assets once:
89
+ ```
90
+ timeout 1200 gh run watch "$(gh run list --workflow release.yml --branch v<version> --limit 1 --json databaseId --jq '.[0].databaseId')" --exit-status
91
+ gh release view v<version> --json assets --jq '.assets[].name'
92
+ ```
93
+ Report the installer assets found (here: `.dmg`, `.exe`, `.AppImage`) and any missing. If
94
+ no run is listed yet, say so instead of polling.
95
+
96
+ On any failing step: stop there and report the step and its output. Once the worktree exists,
97
+ leave it only when its state is evidence for the failure; otherwise remove it (step 9) so a
98
+ retry doesn't collide with a stale path.
99
+
100
+ ## 5. Manual (only when `session-manager-operations/manual/manual.json` exists)
101
+
102
+ Follow [`manual.md`](manual.md). The npm publish has already landed; a manual failure never
103
+ undoes it.
104
+
105
+ ## 6. Report
106
+
107
+ One plain-text report, whether the pipeline finished or stopped:
108
+
109
+ - **Version** previous → new, and the bump kind.
110
+ - **Commits covered**, grouped by the rule that classified each.
111
+ - **Gates** and their results.
112
+ - **Registry**: packument `dist-tags` / version and tarball status.
113
+ - **Git**: both pushes confirmed, worktree removed.
114
+ - **Installer release**: assets found and missing, or "no release workflow".
115
+ - **Manual**: `manual.md`'s report, "no content change", or "no manual".
116
+ - **Stopped early?** Which step, why, its output, and anything a retry must account for
117
+ (a leftover worktree or local tag).
@@ -0,0 +1,80 @@
1
+ # builder — Field Manual step
2
+
3
+ Runs as step 5 of `builder` when `session-manager-operations/manual/manual.json` exists, or on
4
+ its own ("update the manual", "does the manual need a revision"). Standalone, derive the commit
5
+ list and version the way step 1 does.
6
+
7
+ The manual is a **product we publish**, not generated documentation: it has its own version
8
+ line, and readers follow it step by step and are owed accuracy.
9
+
10
+ - **Source of truth:** `session-manager-operations/manual/` (its `README.md` has the on-disk
11
+ shape and release checklist).
12
+ - **Build:** `npm run manual:build` → `~/Projects/Bilko/data/manual/releases/<version>/`.
13
+ - **Price:** free — every chapter and both downloads (root `CLAUDE.md`, open-core law). The
14
+ legacy `session_manager` Stripe SKU stays wired only so late payments resolve; it sells nothing.
15
+
16
+ ## 1. Decide whether a revision is owed
17
+
18
+ Read `manual.json`; compare `documentsAppVersion` with the version just published. Map the
19
+ release's commits onto the chapters: a chapter is **affected** when a commit touched a surface
20
+ it describes (grep the diff for the file paths, tab names, flags and CLI invocations the chapter
21
+ names).
22
+
23
+ | Finding | Action |
24
+ | --- | --- |
25
+ | No commit touches a documented surface | Bump `documentsAppVersion` only, report "no content change", stop. No manual release for a version bump alone. |
26
+ | A commit changes behaviour a chapter describes | Revise that chapter (step 2). |
27
+ | A commit ships a surface no chapter covers | Report it as a **gap** with a proposed chapter; don't author a whole chapter unprompted. |
28
+
29
+ ## 2. Revise the affected chapters
30
+
31
+ Edit the chapter HTML in `session-manager-operations/manual/chapters/`.
32
+
33
+ - Follow `manual/STYLE.md` (voice, reading level, component vocabulary).
34
+ - Every claim must be checkable against real code now: read the file, run the command, confirm
35
+ the constant. A wrong instruction breaks every reader who follows it.
36
+ - Never invent a screenshot. A figure with no captured image stays a `manual-figure__frame`
37
+ placeholder saying what still needs capturing.
38
+ - Write an operator's guide — what a surface is for, the one thing people get wrong, the
39
+ workflow that pays off — not a restatement of the codebase.
40
+ - Every chapter carries `free: true`; `web/manual/build.mjs` refuses a release where one lacks it.
41
+
42
+ ## 3. Bump the manual's version
43
+
44
+ In `manual.json`: `documentsAppVersion` → the app version just published; `version` → patch for
45
+ corrections and figure fills, minor for a revised or added chapter, major for a restructure of
46
+ the chapter map (independent of the app's version); `releasedAt` → today in
47
+ America/Los_Angeles.
48
+
49
+ ## 4. Build and verify
50
+
51
+ ```bash
52
+ npm run manual:check # sources valid, nothing written
53
+ npm run manual:build # emits into ../Bilko/data/manual/releases/<version>/
54
+ ls ~/Projects/Bilko/data/manual/releases/<version>/
55
+ cd ~/Projects/Bilko && npx vitest run tests/manual.test.ts
56
+ ```
57
+
58
+ The build is the gate: it refuses a missing chapter, a malformed or duplicated slug, an asset
59
+ without a source, or a chapter without `free: true`. A refusal is a stop. The Bilko test checks
60
+ every chapter and asset the manifest advertises exists on disk.
61
+
62
+ ## 5. Commit both repos
63
+
64
+ The bundle is served from the Bilko repo, so an uncommitted bundle is an unpublished manual.
65
+ Commit locally once build and test pass: `session-manager` (chapter sources + `manual.json`)
66
+ and `~/Projects/Bilko` (`data/manual/releases/<version>/`). Pushing the Bilko side is what ships
67
+ it; treat that push with the same release trigger as the npm publish.
68
+
69
+ ## Report
70
+
71
+ 1. Manual version and `documentsAppVersion`, before → after.
72
+ 2. Chapters revised, one line each: what changed and why.
73
+ 3. Coverage gaps, as proposals.
74
+ 4. Figures still pending capture, by chapter.
75
+ 5. Whether the Bilko bundle is committed and pushed; if not pushed, say readers still see the
76
+ previous edition.
77
+
78
+ Not in scope: screenshot capture, the product page in the Bilko repo, and pricing — the legacy
79
+ SKU and `MANUAL_PRODUCT_KEY` mapping in `Bilko:shared/manual-catalog.ts` stay wired; removing
80
+ either is an explicit decision.