ccdeck 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +12 -12
  2. package/dist/web/assets/AccountBridge-BWSoT0Lr.js +1 -0
  3. package/dist/web/assets/{AccountSection-BpIHPhF3.js → AccountSection-crq1VjX0.js} +1 -1
  4. package/dist/web/assets/BrowserWatchModal-CoXeeb2o.js +1 -0
  5. package/dist/web/assets/{FeedbackConversations-BJjgXI0-.js → FeedbackConversations-BDjrxpxf.js} +1 -1
  6. package/dist/web/assets/{IntegrationModal-DQ0vEz4X.js → IntegrationModal-4Z8_QVBa.js} +1 -1
  7. package/dist/web/assets/{IntegrationSkeleton-JCPbqp96.js → IntegrationSkeleton-DHuH_POu.js} +1 -1
  8. package/dist/web/assets/{RadioPanel-Be6AkrKl.js → RadioPanel-Dw3zruRE.js} +1 -1
  9. package/dist/web/assets/{StageShell-Dq0JOQhd.js → StageShell-Dn1RGcsF.js} +3 -3
  10. package/dist/web/assets/{TrafficRadar-7jqJbhaK.js → TrafficRadar--OAIaujE.js} +1 -1
  11. package/dist/web/assets/{UsageHistoryModal-ckawZGoe.js → UsageHistoryModal-D1hw3AaJ.js} +1 -1
  12. package/dist/web/assets/app-82JtqhPe.css +1 -0
  13. package/dist/web/assets/{app-40gNTTfq.js → app-DiIDGQPy.js} +94 -94
  14. package/dist/web/assets/{index-XIY3yFiN.js → index-BXBkLnYy.js} +1 -1
  15. package/dist/web/assets/{inspector-status-pane-BV_m7eBv.js → inspector-status-pane-DP7kOBus.js} +1 -1
  16. package/dist/web/assets/{screens-9_ivqfcF.js → screens-CqpMhDCL.js} +1 -1
  17. package/dist/web/assets/{stage-board-NF_wgGRA.js → stage-board-0PYMffFC.js} +1 -1
  18. package/dist/web/assets/{use-account-BUmI-A8e.js → use-account-DskceWF8.js} +1 -1
  19. package/dist/web/index.html +3 -3
  20. package/package.json +6 -6
  21. package/release-notes.json +30 -2
  22. package/src/server/command-panel-engine.mjs +2 -2
  23. package/src/server/command-panel-platform.mjs +2 -2
  24. package/src/server/engine-package.mjs +2 -1
  25. package/src/server/pro-engine-install.mjs +2 -1
  26. package/src/server/pro-engine-terminal.mjs +3 -2
  27. package/src/server/terminal-js-routes.mjs +16 -3
  28. package/src/server/terminal-routes.mjs +45 -3
  29. package/src/server/terminal-sessions.mjs +2 -1
  30. package/src/server/tmux-download.mjs +21 -1
  31. package/src/server/tmux.mjs +144 -27
  32. package/dist/web/assets/AccountBridge-OQHT5qmS.js +0 -1
  33. package/dist/web/assets/BrowserWatchModal-DBdt52v7.js +0 -1
  34. package/dist/web/assets/app-BRjYF6oD.css +0 -1
@@ -1 +1 @@
1
- import"./app-40gNTTfq.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function s(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=s(e);fetch(e.href,r)}})();
1
+ import"./app-DiIDGQPy.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function s(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=s(e);fetch(e.href,r)}})();
@@ -1 +1 @@
1
- import{J as l,K as p}from"./stage-board-NF_wgGRA.js";import{bL as g,aB as u}from"./app-40gNTTfq.js";function h(a,o,e){const t=g(o,a.sessionId)??a,i=[...o.values()].filter(n=>n.sessionId===t.sessionId&&n.kind==="subagent"),s=l(p(t,i),e),d=[s.phrase,s.emphasis].filter(Boolean).join(" ")+(s.arg?` · ${s.arg}`:""),r=u(t);return{glyph:r==="partial"?"partial":r==="err"?"error":s.state==="working"?"working":s.state==="waiting"?"waiting":s.state==="ready"?"idle":s.state==="ended"||t.lastTurnEndAt!=null?"done":"idle",phrase:d}}export{h as paneStatus};
1
+ import{J as l,K as p}from"./stage-board-0PYMffFC.js";import{bL as g,aB as u}from"./app-DiIDGQPy.js";function h(a,o,e){const t=g(o,a.sessionId)??a,i=[...o.values()].filter(n=>n.sessionId===t.sessionId&&n.kind==="subagent"),s=l(p(t,i),e),d=[s.phrase,s.emphasis].filter(Boolean).join(" ")+(s.arg?` · ${s.arg}`:""),r=u(t);return{glyph:r==="partial"?"partial":r==="err"?"error":s.state==="working"?"working":s.state==="waiting"?"waiting":s.state==="ready"?"idle":s.state==="ended"||t.lastTurnEndAt!=null?"done":"idle",phrase:d}}export{h as paneStatus};
@@ -1,4 +1,4 @@
1
- import{cc as ee,j as t,B as v,bh as Y,E as ne,r as u,aA as ke,bg as ye,cd as ge,t as je,u as C,b2 as be,y as Ne}from"./app-40gNTTfq.js";import{I as we}from"./IntegrationSkeleton-JCPbqp96.js";import{S as A,C as Ee}from"./StageShell-Dq0JOQhd.js";import"./stage-board-NF_wgGRA.js";const te="Only in the terminal",Te="Could not read the prompt again, so nothing was sent";function se(e){return{mode:e.origin==="outside"?"readOnly":e.multi?"multi":"choose",outcome:{kind:"none"},focus:null,checked:[],text:"",closed:!1,token:0}}const l=(e,n=[])=>({state:e,effects:n});function G(e){return e.outcome.kind==="none"||e.outcome.kind==="held"}function oe(e,n){const o=n.model.options,s=c=>Number.isInteger(c)&&!!o[c]&&!o[c].locked;switch(e.kind){case"option":return s(e.index);case"text":return s(e.index)&&!!o[e.index].free&&e.text.trim()!=="";case"many":return e.indexes.length>0&&e.indexes.every(s)}}function M(e,n,o){return!o.canRecheck||!oe(n,o)?l(e):l({...e,token:e.token+1,outcome:{kind:"checking",answer:n}},[{type:"recheck",answer:n}])}function Q(e){return e.outcome.kind==="checking"?{...e,token:e.token+1,outcome:{kind:"none"}}:e}function J(e,n,o){const s=o.model.options[n];if(!s||!G(e))return l(e);const c={...e,focus:n};return s.locked?l(c,[{type:"announce",text:te}]):s.free?l({...c,mode:"free"}):M(c,{kind:"option",index:n},o)}function ce(e,n,o){var c;const s=o.model.options.length;switch(n.type){case"focus":return n.index==null?l({...e,focus:null}):e.mode==="readOnly"||n.index<0||n.index>=s?l(e):e.mode==="free"&&!((c=o.model.options[n.index])!=null&&c.free)?l({...e,mode:"choose",focus:n.index}):l({...e,focus:n.index});case"move":{if(e.mode==="readOnly"||e.mode==="free"||s===0)return l(e);const d=e.focus==null?n.by===1?0:s-1:Math.min(s-1,Math.max(0,e.focus+n.by));return l({...e,focus:d})}case"pick":return e.mode==="readOnly"||e.mode==="free"?l(e):e.mode==="multi"?ce(e,{type:"toggle",index:n.index},o):J(e,n.index,o);case"toggle":{if(e.mode!=="multi"||!G(e)||n.index<0||n.index>=s)return l(e);if(o.model.options[n.index].locked)return l({...e,focus:n.index},[{type:"announce",text:te}]);const h=e.checked.includes(n.index)?e.checked.filter(x=>x!==n.index):[...e.checked,n.index].sort((x,m)=>x-m);return l({...e,focus:n.index,checked:h})}case"submit":{if(!G(e))return l(e);if(e.mode==="choose")return e.focus==null?l(e):J(e,e.focus,o);if(e.mode==="free"){const d=e.text.trim(),h=e.focus==null?void 0:o.model.options[e.focus];return!d||e.focus==null||!(h!=null&&h.free)||h.locked?l(e):M(e,{kind:"text",index:e.focus,text:d},o)}return e.mode==="multi"&&e.checked.length?M(e,{kind:"many",indexes:e.checked},o):l(e)}case"openFree":{if(e.mode!=="choose"||!G(e))return l(e);const d=o.model.options.findIndex(h=>h.free&&!h.locked);return d<0?l(e):l({...e,mode:"free",focus:d})}case"typeFree":return e.mode==="free"?l({...e,text:n.text}):l(e);case"escape":return e.mode==="free"?l({...Q(e),mode:"choose"}):l({...Q(e),closed:!0},[{type:"close"}]);case"result":{if(e.closed||e.outcome.kind!=="checking"||n.token!==void 0&&n.token!==e.token)return l(e);const{answer:d}=e.outcome,h=n.result;return h==="ok"&&!oe(d,o)?l({...e,outcome:{kind:"none"}}):h==="ok"?l({...e,outcome:{kind:"sent",answer:d}},[{type:"send",answer:d},{type:"record",answer:d}]):l({...e,outcome:h})}case"checkFailed":return e.closed||e.outcome.kind!=="checking"||n.token!==void 0&&n.token!==e.token?l(e):l({...e,outcome:{kind:"none"}},[{type:"announce",text:Te}]);case"reset":return l({...se(o.model),token:e.token+1});case"elsewhere":return l({...e,outcome:{kind:"elsewhere",at:n.at}});case"outcome":return l({...e,outcome:n.input});case"dismissOutcome":return l({...e,outcome:{kind:"none"},closed:e.outcome.kind==="sent"||e.outcome.kind==="elsewhere"?!0:e.closed});case"showTerm":return l(e,[{type:"showTerm"}]);case"showNew":return l(e,[{type:"showNew"}]);default:return l(e)}}const Se="Decision",ve="Keys on the question",X={id:"decision",rows:[{cap:"1 – 3",action:"Pick an answer and send it, after the prompt is read again",binds:["1","2","3"]},{cap:"↑ ↓ Tab",action:"Move the ring along the answers",binds:["ArrowUp","ArrowDown","Tab"]},{cap:"↵",action:"Send the answer the ring is on",binds:["Enter"]},{cap:"Esc",action:"Close the question. It never answers",binds:["Escape"]}]},S=(e,n)=>({text:e,spoken:n}),Ce=[{caps:[S("1–3","1 to 3")],word:"pick and send",binds:["1","2","3"]},{caps:[S("↑"),S("↓"),S("Tab")],word:"move",binds:["ArrowUp","ArrowDown","Tab"]},{caps:[S("↵","Enter")],word:"send",binds:["Enter"]},{caps:[S("Esc","Escape")],word:"close",binds:["Escape"]}];function wn(e){return{layer:"decision",label:ve,hints:Ce.filter(n=>e||!n.binds.some(ee))}}function En(e){return{id:X.id,title:Se,rows:X.rows.filter(n=>e||!n.binds.some(ee))}}function Oe(e){return!e||typeof e.closest!="function"?"other":e.closest(".dc-input")?"field":e.closest(".dc-opt")?"row":"other"}function Re(e,n,o,s,c){return n==="other"||n==="field"&&e.key!=="Enter"&&e.key!=="Escape"?null:Ie(e,o,s,c)}function Ie(e,n,o,s){if(e.ctrlKey||e.metaKey||e.altKey)return null;switch(e.key){case" ":return s!=null&&s.multi&&s.focus!=null&&s.focus<o?{type:"toggle",index:s.focus}:null;case"ArrowDown":return{type:"move",by:1};case"ArrowUp":return{type:"move",by:-1};case"Tab":return{type:"move",by:e.shiftKey?-1:1};case"Enter":return{type:"submit"};case"Escape":return{type:"escape"};default:{if(!n||!/^[1-3]$/.test(e.key))return null;const c=Number(e.key)-1;return c<o?{type:"pick",index:c}:null}}}const re=()=>t.jsx(v,{name:"lock"}),Ke=()=>t.jsx(v,{name:"changed"}),ie=()=>t.jsx(v,{name:"chevron-right"}),De=()=>t.jsx(v,{name:"file"}),$e=()=>t.jsx(v,{name:"search"}),Fe=()=>t.jsx(v,{name:"terminal"}),_e="Sent only when you pick, after re-reading the prompt",Ae="↵ sends the highlighted answer, after re-reading the prompt",Le="↵ sends what you wrote · Esc goes back to the choices",Ge="Started outside ccdeck, so it is answered in its own terminal",Ue="See it in Term";function Be(e){return`Send ${e} ${e===1?"answer":"answers"} ↵`}function He(e,n,o){return e==="readOnly"?{text:Ge,lock:!1}:e==="free"?{text:Le,lock:!1}:e==="multi"?{text:o>0?Be(o):"",lock:!1}:n?{text:Ae,lock:!1}:{text:_e,lock:!0}}function Me(e){const n=He(e.mode,e.focused,e.checked),o=e.mode==="readOnly";return t.jsxs("div",{className:"dc-foot",children:[!o&&e.mode!=="multi"&&e.singleKeys!==!1&&t.jsxs("span",{className:"dc-foot-pick",children:["Pick ",t.jsx(Y,{children:"1"}),e.rows>1&&t.jsxs(t.Fragment,{children:[" ","–"," ",t.jsx(Y,{children:String(e.rows)})]})]}),t.jsxs("span",{className:"dc-foot-note","data-muted":e.mode==="multi"||void 0,children:[n.lock&&t.jsx(re,{}),n.text]}),!o&&t.jsxs("button",{type:"button",className:"dc-link",onClick:e.onShowTerm,children:[Ue,t.jsx(ne,{})]})]})}const Pe="Claude’s pick",qe="Send";function ze(e){const{option:n}=e,o=u.useId(),s=n.locked?`${o}-lock-${e.index}`:void 0;return t.jsxs("div",{className:"dc-row","data-typing":e.typing||void 0,children:[t.jsxs("div",{ref:e.rowRef,className:"dc-opt",role:e.selection==="radio"?"radio":"checkbox","aria-checked":e.checked,"aria-disabled":n.locked||e.readOnly||void 0,"aria-describedby":s,"aria-keyshortcuts":e.readOnly||e.singleKeys===!1?void 0:String(e.index+1),tabIndex:e.readOnly?void 0:e.tabStop?0:-1,"data-focus":e.focused||void 0,"data-locked":n.locked||void 0,"data-checked":e.checked||void 0,"data-typing":e.typing||void 0,onClick:e.readOnly?void 0:e.onPick,onFocus:e.readOnly?void 0:e.onFocus,children:[t.jsx("span",{className:"dc-chip","aria-hidden":"true",children:e.index+1}),t.jsxs("span",{className:"dc-opt-text",children:[t.jsx("span",{className:"dc-opt-label",children:n.label}),n.locked?t.jsxs("span",{className:"dc-opt-sub dc-lock",id:s,children:[t.jsx(re,{}),n.lockNote]}):t.jsx("span",{className:"dc-opt-sub",children:n.sub})]}),n.pick&&t.jsx("span",{className:"dc-pick",children:Pe}),e.selection==="checkbox"&&t.jsx("span",{className:"dc-box","aria-hidden":"true","data-on":e.checked||void 0})]}),e.typing&&t.jsxs("div",{className:"dc-field",children:[t.jsx("input",{ref:e.inputRef,className:"dc-input",type:"text",value:e.text,"aria-label":n.label,onChange:c=>e.onText(c.target.value),onKeyDown:e.onFieldKey}),t.jsxs("span",{className:"dc-send","aria-hidden":"true",children:[qe," ","↵"]})]})]})}const We="Checking the prompt is still on screen",Ve="Nothing is sent if it changed.",Ye="The question changed, so nothing was sent",Qe="Nothing was sent.",Je="Held: you have unsent text in the terminal",Xe="Send it or clear it there, then pick again.",Ze="Nothing to send from here.";function en(e,n,o){switch(e.kind){case"none":return null;case"checking":return{glyph:t.jsx(A,{kind:"working"}),title:We,sub:Ve};case"sent":return{glyph:t.jsx(A,{kind:"done"}),title:`Sent to ${n.session}`,tone:"ok",sub:n.command?t.jsxs(t.Fragment,{children:["Running ",t.jsx("code",{className:"dc-mono",children:n.command}),"."]}):"Claude has your answer."};case"changed":return{glyph:t.jsx(Ke,{}),title:Ye,sub:t.jsxs(t.Fragment,{children:["Claude now asks about ",t.jsx("code",{className:"dc-mono",children:e.now})]}),link:{label:"Show it",run:o.onShowNew}};case"ended":return{glyph:t.jsx("span",{className:"dc-err",children:t.jsx(ke,{kind:"err",size:14})}),title:`${n.session} ended before the answer went out`,sub:Qe,link:{label:"Open the transcript",run:o.onOpenTranscript}};case"held":return{glyph:t.jsx(A,{kind:"idle"}),title:Je,sub:Xe,link:{label:"Open Term",run:o.onShowTerm}};case"elsewhere":return{glyph:t.jsx(A,{kind:"done"}),title:`Answered in the terminal at ${e.at}`,sub:Ze}}}function nn({outcome:e,model:n,...o}){const s=en(e,n,o);return s?t.jsxs("div",{className:"dc-out",role:"status","aria-atomic":"true","data-kind":e.kind,children:[t.jsx("span",{className:"dc-out-glyph","aria-hidden":"true",children:s.glyph}),t.jsxs("span",{className:"dc-out-text",children:[t.jsx("span",{className:"dc-out-title","data-tone":s.tone,children:s.title}),t.jsx("span",{className:"dc-out-sub",children:s.sub})]}),s.link&&t.jsxs("button",{type:"button",className:"dc-link",onClick:s.link.run,children:[s.link.label,s.link.external&&t.jsx(ne,{})]})]}):t.jsx("div",{className:"dc-out-empty",role:"status","aria-atomic":"true"})}let tn=0;function sn(e){const{model:n}=e,o=ye(),[s]=u.useState(()=>`dc-${++tn}`),[c,d]=u.useState(()=>({...se(n),...e.outcome?{outcome:e.outcome}:null,...e.initial})),[h,x]=u.useState(""),m=u.useRef(c),p=u.useRef(e);p.current=e;const a=u.useRef([]),k=u.useRef(null),j=u.useRef(!1),g=u.useRef(!0);u.useEffect(()=>()=>{g.current=!1},[]);const O=typeof e.recheck=="function",$=u.useMemo(()=>({model:n,canRecheck:O}),[n,O]),F=u.useRef($);F.current=$;const i=u.useCallback(f=>{const r=ce(m.current,f,F.current);m.current=r.state,d(r.state);for(const y of r.effects)w(y)},[]);function w(f){var y,E,T,_,z,W;const r=p.current;switch(f.type){case"recheck":{const V=m.current.token;(y=r.recheck)==null||y.call(r,f.answer).then(xe=>{g.current&&i({type:"result",result:xe,token:V})},()=>{g.current&&i({type:"checkFailed",token:V})})}break;case"send":(E=r.onAnswer)==null||E.call(r,f.answer);break;case"record":(T=r.onRecord)==null||T.call(r,f.answer);break;case"close":(_=r.onClose)==null||_.call(r);break;case"showTerm":(z=r.onShowTerm)==null||z.call(r);break;case"showNew":(W=r.onShowNew)==null||W.call(r);break;case"announce":x(f.text);break}}const R=u.useRef(!0);u.useEffect(()=>{if(R.current){R.current=!1;return}e.outcome&&i({type:"outcome",input:e.outcome})},[e.outcome,i]);const I=u.useRef(n.id);u.useEffect(()=>{I.current!==n.id&&(I.current=n.id,x(""),i({type:"reset"}),p.current.outcome&&i({type:"outcome",input:p.current.outcome}))},[n.id,i]),u.useEffect(()=>{var f;c.focus!=null&&j.current&&((f=a.current[c.focus])==null||f.focus())},[c.focus]);const N=u.useRef(c.mode),K=u.useRef(!1);u.useEffect(()=>{var r,y;const f=N.current;N.current=c.mode,c.mode==="free"&&f!=="free"?(r=k.current)==null||r.focus():f==="free"&&c.mode!=="free"&&K.current&&(K.current=!1,c.focus!=null&&((y=a.current[c.focus])==null||y.focus()))},[c.mode,c.focus]);const D=f=>{const r=m.current;if(r.mode==="readOnly")return;const y=Oe(f.target),E=Re(f,y,o,n.options.length,{multi:r.mode==="multi",focus:r.focus});if(E){if(E.type==="move"&&f.key==="Tab"){const T=r.focus,_=E.by===1?T===n.options.length-1:T===0;if(T!=null&&_)return}f.preventDefault(),f.stopPropagation(),j.current=!0,i(E)}},b=c.outcome,U=b.kind==="checking"||b.kind==="sent"?b.answer:null,fe=U&&U.kind!=="many"?U.index:-1,B=`${s}-title`,H=c.mode==="multi",pe=c.focus??0;return c.closed?null:t.jsxs("div",{className:"dc-dock","data-size":e.size==="phone"?"phone":void 0,"data-mode":c.mode,"data-outcome":b.kind,"data-kind":n.kind,children:[t.jsxs("div",{className:"dc-decision",role:"group","aria-labelledby":B,onKeyDown:D,onBlur:f=>{f.currentTarget.contains(f.relatedTarget)||(j.current=!1,m.current.focus!=null&&m.current.mode!=="free"&&i({type:"focus",index:null}))},children:[t.jsxs("div",{className:"dc-dq","data-outcome":b.kind,children:[t.jsx("h3",{className:"dc-title",id:B,children:n.title}),n.plan?t.jsx("ol",{className:"dc-plan",children:n.plan.map((f,r)=>t.jsxs("li",{children:[t.jsx("span",{className:"dc-plan-n",children:r+1}),f]},r))}):n.command?t.jsx("code",{className:"dc-cmd",children:n.command}):null,t.jsx("p",{className:"dc-caption",children:n.caption})]}),t.jsxs("div",{className:"dc-tree","aria-hidden":"true",children:[t.jsx("i",{className:"dc-stub"}),n.options.map((f,r)=>t.jsx("i",{className:"dc-tick","data-typing":c.mode==="free"&&c.focus===r||void 0},r))]}),t.jsx("div",{className:"dc-opts",role:H?"group":"radiogroup","aria-labelledby":B,children:n.options.map((f,r)=>t.jsx(ze,{index:r,option:f,selection:H?"checkbox":"radio",focused:c.focus===r,checked:H?c.checked.includes(r):fe===r,typing:c.mode==="free"&&c.focus===r,text:c.text,readOnly:c.mode==="readOnly",singleKeys:o,tabStop:pe===r,rowRef:y=>{a.current[r]=y},inputRef:k,onPick:()=>{j.current=!0,i({type:"pick",index:r})},onFocus:()=>i({type:"focus",index:r}),onText:y=>i({type:"typeFree",text:y}),onFieldKey:y=>{y.key==="Enter"?(y.preventDefault(),y.stopPropagation(),i({type:"submit"})):y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),K.current=!0,i({type:"escape"}))}},r))}),t.jsx(nn,{outcome:b,model:n,onShowNew:()=>i({type:"showNew"}),onShowTerm:()=>i({type:"showTerm"}),onOpenTranscript:()=>{var f,r;return(r=(f=p.current).onOpenTranscript)==null?void 0:r.call(f)}})]}),t.jsx(Me,{mode:c.mode,focused:c.focus!=null,checked:c.checked.length,rows:n.options.length,singleKeys:o,onShowTerm:()=>i({type:"showTerm"})}),t.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:h})]})}function on(e){const n=[];return e.forEach((o,s)=>{if(o.kind==="user"||o.kind==="record"){n.push({kind:o.kind,text:o.text,index:s});return}const c=n.at(-1);(c==null?void 0:c.kind)==="assistant"?c.turns.push(o):n.push({kind:"assistant",turns:[o],index:s})}),n}const cn=/^ {0,3}(`{3,}|~{3,})(.*)$/,ae=/^ {0,3}(#{1,6})[\t ]+(.+)$/,P=/^ {0,3}(?:([-+*])|([0-9]{1,9})[.)])[\t ]+(.*)$/,q=/^ {0,3}>[\t ]?(.*)$/;function le(e){const n=cn.exec(e);return n&&!(n[1][0]==="`"&&n[2].includes("`"))?n:null}function de(e){return e.map((n,o)=>n.kind==="code"?t.jsx("code",{children:n.text},o):n.kind==="bold"?t.jsx("strong",{children:de(n.kids)},o):t.jsx(u.Fragment,{children:n.text.split(`
1
+ import{cc as ee,j as t,B as v,bh as Y,E as ne,r as u,aA as ke,bg as ye,cd as ge,t as je,u as C,b2 as be,y as Ne}from"./app-DiIDGQPy.js";import{I as we}from"./IntegrationSkeleton-DHuH_POu.js";import{S as A,C as Ee}from"./StageShell-Dn1RGcsF.js";import"./stage-board-0PYMffFC.js";const te="Only in the terminal",Te="Could not read the prompt again, so nothing was sent";function se(e){return{mode:e.origin==="outside"?"readOnly":e.multi?"multi":"choose",outcome:{kind:"none"},focus:null,checked:[],text:"",closed:!1,token:0}}const l=(e,n=[])=>({state:e,effects:n});function G(e){return e.outcome.kind==="none"||e.outcome.kind==="held"}function oe(e,n){const o=n.model.options,s=c=>Number.isInteger(c)&&!!o[c]&&!o[c].locked;switch(e.kind){case"option":return s(e.index);case"text":return s(e.index)&&!!o[e.index].free&&e.text.trim()!=="";case"many":return e.indexes.length>0&&e.indexes.every(s)}}function M(e,n,o){return!o.canRecheck||!oe(n,o)?l(e):l({...e,token:e.token+1,outcome:{kind:"checking",answer:n}},[{type:"recheck",answer:n}])}function Q(e){return e.outcome.kind==="checking"?{...e,token:e.token+1,outcome:{kind:"none"}}:e}function J(e,n,o){const s=o.model.options[n];if(!s||!G(e))return l(e);const c={...e,focus:n};return s.locked?l(c,[{type:"announce",text:te}]):s.free?l({...c,mode:"free"}):M(c,{kind:"option",index:n},o)}function ce(e,n,o){var c;const s=o.model.options.length;switch(n.type){case"focus":return n.index==null?l({...e,focus:null}):e.mode==="readOnly"||n.index<0||n.index>=s?l(e):e.mode==="free"&&!((c=o.model.options[n.index])!=null&&c.free)?l({...e,mode:"choose",focus:n.index}):l({...e,focus:n.index});case"move":{if(e.mode==="readOnly"||e.mode==="free"||s===0)return l(e);const d=e.focus==null?n.by===1?0:s-1:Math.min(s-1,Math.max(0,e.focus+n.by));return l({...e,focus:d})}case"pick":return e.mode==="readOnly"||e.mode==="free"?l(e):e.mode==="multi"?ce(e,{type:"toggle",index:n.index},o):J(e,n.index,o);case"toggle":{if(e.mode!=="multi"||!G(e)||n.index<0||n.index>=s)return l(e);if(o.model.options[n.index].locked)return l({...e,focus:n.index},[{type:"announce",text:te}]);const h=e.checked.includes(n.index)?e.checked.filter(x=>x!==n.index):[...e.checked,n.index].sort((x,m)=>x-m);return l({...e,focus:n.index,checked:h})}case"submit":{if(!G(e))return l(e);if(e.mode==="choose")return e.focus==null?l(e):J(e,e.focus,o);if(e.mode==="free"){const d=e.text.trim(),h=e.focus==null?void 0:o.model.options[e.focus];return!d||e.focus==null||!(h!=null&&h.free)||h.locked?l(e):M(e,{kind:"text",index:e.focus,text:d},o)}return e.mode==="multi"&&e.checked.length?M(e,{kind:"many",indexes:e.checked},o):l(e)}case"openFree":{if(e.mode!=="choose"||!G(e))return l(e);const d=o.model.options.findIndex(h=>h.free&&!h.locked);return d<0?l(e):l({...e,mode:"free",focus:d})}case"typeFree":return e.mode==="free"?l({...e,text:n.text}):l(e);case"escape":return e.mode==="free"?l({...Q(e),mode:"choose"}):l({...Q(e),closed:!0},[{type:"close"}]);case"result":{if(e.closed||e.outcome.kind!=="checking"||n.token!==void 0&&n.token!==e.token)return l(e);const{answer:d}=e.outcome,h=n.result;return h==="ok"&&!oe(d,o)?l({...e,outcome:{kind:"none"}}):h==="ok"?l({...e,outcome:{kind:"sent",answer:d}},[{type:"send",answer:d},{type:"record",answer:d}]):l({...e,outcome:h})}case"checkFailed":return e.closed||e.outcome.kind!=="checking"||n.token!==void 0&&n.token!==e.token?l(e):l({...e,outcome:{kind:"none"}},[{type:"announce",text:Te}]);case"reset":return l({...se(o.model),token:e.token+1});case"elsewhere":return l({...e,outcome:{kind:"elsewhere",at:n.at}});case"outcome":return l({...e,outcome:n.input});case"dismissOutcome":return l({...e,outcome:{kind:"none"},closed:e.outcome.kind==="sent"||e.outcome.kind==="elsewhere"?!0:e.closed});case"showTerm":return l(e,[{type:"showTerm"}]);case"showNew":return l(e,[{type:"showNew"}]);default:return l(e)}}const Se="Decision",ve="Keys on the question",X={id:"decision",rows:[{cap:"1 – 3",action:"Pick an answer and send it, after the prompt is read again",binds:["1","2","3"]},{cap:"↑ ↓ Tab",action:"Move the ring along the answers",binds:["ArrowUp","ArrowDown","Tab"]},{cap:"↵",action:"Send the answer the ring is on",binds:["Enter"]},{cap:"Esc",action:"Close the question. It never answers",binds:["Escape"]}]},S=(e,n)=>({text:e,spoken:n}),Ce=[{caps:[S("1–3","1 to 3")],word:"pick and send",binds:["1","2","3"]},{caps:[S("↑"),S("↓"),S("Tab")],word:"move",binds:["ArrowUp","ArrowDown","Tab"]},{caps:[S("↵","Enter")],word:"send",binds:["Enter"]},{caps:[S("Esc","Escape")],word:"close",binds:["Escape"]}];function wn(e){return{layer:"decision",label:ve,hints:Ce.filter(n=>e||!n.binds.some(ee))}}function En(e){return{id:X.id,title:Se,rows:X.rows.filter(n=>e||!n.binds.some(ee))}}function Oe(e){return!e||typeof e.closest!="function"?"other":e.closest(".dc-input")?"field":e.closest(".dc-opt")?"row":"other"}function Re(e,n,o,s,c){return n==="other"||n==="field"&&e.key!=="Enter"&&e.key!=="Escape"?null:Ie(e,o,s,c)}function Ie(e,n,o,s){if(e.ctrlKey||e.metaKey||e.altKey)return null;switch(e.key){case" ":return s!=null&&s.multi&&s.focus!=null&&s.focus<o?{type:"toggle",index:s.focus}:null;case"ArrowDown":return{type:"move",by:1};case"ArrowUp":return{type:"move",by:-1};case"Tab":return{type:"move",by:e.shiftKey?-1:1};case"Enter":return{type:"submit"};case"Escape":return{type:"escape"};default:{if(!n||!/^[1-3]$/.test(e.key))return null;const c=Number(e.key)-1;return c<o?{type:"pick",index:c}:null}}}const re=()=>t.jsx(v,{name:"lock"}),Ke=()=>t.jsx(v,{name:"changed"}),ie=()=>t.jsx(v,{name:"chevron-right"}),De=()=>t.jsx(v,{name:"file"}),$e=()=>t.jsx(v,{name:"search"}),Fe=()=>t.jsx(v,{name:"terminal"}),_e="Sent only when you pick, after re-reading the prompt",Ae="↵ sends the highlighted answer, after re-reading the prompt",Le="↵ sends what you wrote · Esc goes back to the choices",Ge="Started outside ccdeck, so it is answered in its own terminal",Ue="See it in Term";function Be(e){return`Send ${e} ${e===1?"answer":"answers"} ↵`}function He(e,n,o){return e==="readOnly"?{text:Ge,lock:!1}:e==="free"?{text:Le,lock:!1}:e==="multi"?{text:o>0?Be(o):"",lock:!1}:n?{text:Ae,lock:!1}:{text:_e,lock:!0}}function Me(e){const n=He(e.mode,e.focused,e.checked),o=e.mode==="readOnly";return t.jsxs("div",{className:"dc-foot",children:[!o&&e.mode!=="multi"&&e.singleKeys!==!1&&t.jsxs("span",{className:"dc-foot-pick",children:["Pick ",t.jsx(Y,{children:"1"}),e.rows>1&&t.jsxs(t.Fragment,{children:[" ","–"," ",t.jsx(Y,{children:String(e.rows)})]})]}),t.jsxs("span",{className:"dc-foot-note","data-muted":e.mode==="multi"||void 0,children:[n.lock&&t.jsx(re,{}),n.text]}),!o&&t.jsxs("button",{type:"button",className:"dc-link",onClick:e.onShowTerm,children:[Ue,t.jsx(ne,{})]})]})}const Pe="Claude’s pick",qe="Send";function ze(e){const{option:n}=e,o=u.useId(),s=n.locked?`${o}-lock-${e.index}`:void 0;return t.jsxs("div",{className:"dc-row","data-typing":e.typing||void 0,children:[t.jsxs("div",{ref:e.rowRef,className:"dc-opt",role:e.selection==="radio"?"radio":"checkbox","aria-checked":e.checked,"aria-disabled":n.locked||e.readOnly||void 0,"aria-describedby":s,"aria-keyshortcuts":e.readOnly||e.singleKeys===!1?void 0:String(e.index+1),tabIndex:e.readOnly?void 0:e.tabStop?0:-1,"data-focus":e.focused||void 0,"data-locked":n.locked||void 0,"data-checked":e.checked||void 0,"data-typing":e.typing||void 0,onClick:e.readOnly?void 0:e.onPick,onFocus:e.readOnly?void 0:e.onFocus,children:[t.jsx("span",{className:"dc-chip","aria-hidden":"true",children:e.index+1}),t.jsxs("span",{className:"dc-opt-text",children:[t.jsx("span",{className:"dc-opt-label",children:n.label}),n.locked?t.jsxs("span",{className:"dc-opt-sub dc-lock",id:s,children:[t.jsx(re,{}),n.lockNote]}):t.jsx("span",{className:"dc-opt-sub",children:n.sub})]}),n.pick&&t.jsx("span",{className:"dc-pick",children:Pe}),e.selection==="checkbox"&&t.jsx("span",{className:"dc-box","aria-hidden":"true","data-on":e.checked||void 0})]}),e.typing&&t.jsxs("div",{className:"dc-field",children:[t.jsx("input",{ref:e.inputRef,className:"dc-input",type:"text",value:e.text,"aria-label":n.label,onChange:c=>e.onText(c.target.value),onKeyDown:e.onFieldKey}),t.jsxs("span",{className:"dc-send","aria-hidden":"true",children:[qe," ","↵"]})]})]})}const We="Checking the prompt is still on screen",Ve="Nothing is sent if it changed.",Ye="The question changed, so nothing was sent",Qe="Nothing was sent.",Je="Held: you have unsent text in the terminal",Xe="Send it or clear it there, then pick again.",Ze="Nothing to send from here.";function en(e,n,o){switch(e.kind){case"none":return null;case"checking":return{glyph:t.jsx(A,{kind:"working"}),title:We,sub:Ve};case"sent":return{glyph:t.jsx(A,{kind:"done"}),title:`Sent to ${n.session}`,tone:"ok",sub:n.command?t.jsxs(t.Fragment,{children:["Running ",t.jsx("code",{className:"dc-mono",children:n.command}),"."]}):"Claude has your answer."};case"changed":return{glyph:t.jsx(Ke,{}),title:Ye,sub:t.jsxs(t.Fragment,{children:["Claude now asks about ",t.jsx("code",{className:"dc-mono",children:e.now})]}),link:{label:"Show it",run:o.onShowNew}};case"ended":return{glyph:t.jsx("span",{className:"dc-err",children:t.jsx(ke,{kind:"err",size:14})}),title:`${n.session} ended before the answer went out`,sub:Qe,link:{label:"Open the transcript",run:o.onOpenTranscript}};case"held":return{glyph:t.jsx(A,{kind:"idle"}),title:Je,sub:Xe,link:{label:"Open Term",run:o.onShowTerm}};case"elsewhere":return{glyph:t.jsx(A,{kind:"done"}),title:`Answered in the terminal at ${e.at}`,sub:Ze}}}function nn({outcome:e,model:n,...o}){const s=en(e,n,o);return s?t.jsxs("div",{className:"dc-out",role:"status","aria-atomic":"true","data-kind":e.kind,children:[t.jsx("span",{className:"dc-out-glyph","aria-hidden":"true",children:s.glyph}),t.jsxs("span",{className:"dc-out-text",children:[t.jsx("span",{className:"dc-out-title","data-tone":s.tone,children:s.title}),t.jsx("span",{className:"dc-out-sub",children:s.sub})]}),s.link&&t.jsxs("button",{type:"button",className:"dc-link",onClick:s.link.run,children:[s.link.label,s.link.external&&t.jsx(ne,{})]})]}):t.jsx("div",{className:"dc-out-empty",role:"status","aria-atomic":"true"})}let tn=0;function sn(e){const{model:n}=e,o=ye(),[s]=u.useState(()=>`dc-${++tn}`),[c,d]=u.useState(()=>({...se(n),...e.outcome?{outcome:e.outcome}:null,...e.initial})),[h,x]=u.useState(""),m=u.useRef(c),p=u.useRef(e);p.current=e;const a=u.useRef([]),k=u.useRef(null),j=u.useRef(!1),g=u.useRef(!0);u.useEffect(()=>()=>{g.current=!1},[]);const O=typeof e.recheck=="function",$=u.useMemo(()=>({model:n,canRecheck:O}),[n,O]),F=u.useRef($);F.current=$;const i=u.useCallback(f=>{const r=ce(m.current,f,F.current);m.current=r.state,d(r.state);for(const y of r.effects)w(y)},[]);function w(f){var y,E,T,_,z,W;const r=p.current;switch(f.type){case"recheck":{const V=m.current.token;(y=r.recheck)==null||y.call(r,f.answer).then(xe=>{g.current&&i({type:"result",result:xe,token:V})},()=>{g.current&&i({type:"checkFailed",token:V})})}break;case"send":(E=r.onAnswer)==null||E.call(r,f.answer);break;case"record":(T=r.onRecord)==null||T.call(r,f.answer);break;case"close":(_=r.onClose)==null||_.call(r);break;case"showTerm":(z=r.onShowTerm)==null||z.call(r);break;case"showNew":(W=r.onShowNew)==null||W.call(r);break;case"announce":x(f.text);break}}const R=u.useRef(!0);u.useEffect(()=>{if(R.current){R.current=!1;return}e.outcome&&i({type:"outcome",input:e.outcome})},[e.outcome,i]);const I=u.useRef(n.id);u.useEffect(()=>{I.current!==n.id&&(I.current=n.id,x(""),i({type:"reset"}),p.current.outcome&&i({type:"outcome",input:p.current.outcome}))},[n.id,i]),u.useEffect(()=>{var f;c.focus!=null&&j.current&&((f=a.current[c.focus])==null||f.focus())},[c.focus]);const N=u.useRef(c.mode),K=u.useRef(!1);u.useEffect(()=>{var r,y;const f=N.current;N.current=c.mode,c.mode==="free"&&f!=="free"?(r=k.current)==null||r.focus():f==="free"&&c.mode!=="free"&&K.current&&(K.current=!1,c.focus!=null&&((y=a.current[c.focus])==null||y.focus()))},[c.mode,c.focus]);const D=f=>{const r=m.current;if(r.mode==="readOnly")return;const y=Oe(f.target),E=Re(f,y,o,n.options.length,{multi:r.mode==="multi",focus:r.focus});if(E){if(E.type==="move"&&f.key==="Tab"){const T=r.focus,_=E.by===1?T===n.options.length-1:T===0;if(T!=null&&_)return}f.preventDefault(),f.stopPropagation(),j.current=!0,i(E)}},b=c.outcome,U=b.kind==="checking"||b.kind==="sent"?b.answer:null,fe=U&&U.kind!=="many"?U.index:-1,B=`${s}-title`,H=c.mode==="multi",pe=c.focus??0;return c.closed?null:t.jsxs("div",{className:"dc-dock","data-size":e.size==="phone"?"phone":void 0,"data-mode":c.mode,"data-outcome":b.kind,"data-kind":n.kind,children:[t.jsxs("div",{className:"dc-decision",role:"group","aria-labelledby":B,onKeyDown:D,onBlur:f=>{f.currentTarget.contains(f.relatedTarget)||(j.current=!1,m.current.focus!=null&&m.current.mode!=="free"&&i({type:"focus",index:null}))},children:[t.jsxs("div",{className:"dc-dq","data-outcome":b.kind,children:[t.jsx("h3",{className:"dc-title",id:B,children:n.title}),n.plan?t.jsx("ol",{className:"dc-plan",children:n.plan.map((f,r)=>t.jsxs("li",{children:[t.jsx("span",{className:"dc-plan-n",children:r+1}),f]},r))}):n.command?t.jsx("code",{className:"dc-cmd",children:n.command}):null,t.jsx("p",{className:"dc-caption",children:n.caption})]}),t.jsxs("div",{className:"dc-tree","aria-hidden":"true",children:[t.jsx("i",{className:"dc-stub"}),n.options.map((f,r)=>t.jsx("i",{className:"dc-tick","data-typing":c.mode==="free"&&c.focus===r||void 0},r))]}),t.jsx("div",{className:"dc-opts",role:H?"group":"radiogroup","aria-labelledby":B,children:n.options.map((f,r)=>t.jsx(ze,{index:r,option:f,selection:H?"checkbox":"radio",focused:c.focus===r,checked:H?c.checked.includes(r):fe===r,typing:c.mode==="free"&&c.focus===r,text:c.text,readOnly:c.mode==="readOnly",singleKeys:o,tabStop:pe===r,rowRef:y=>{a.current[r]=y},inputRef:k,onPick:()=>{j.current=!0,i({type:"pick",index:r})},onFocus:()=>i({type:"focus",index:r}),onText:y=>i({type:"typeFree",text:y}),onFieldKey:y=>{y.key==="Enter"?(y.preventDefault(),y.stopPropagation(),i({type:"submit"})):y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),K.current=!0,i({type:"escape"}))}},r))}),t.jsx(nn,{outcome:b,model:n,onShowNew:()=>i({type:"showNew"}),onShowTerm:()=>i({type:"showTerm"}),onOpenTranscript:()=>{var f,r;return(r=(f=p.current).onOpenTranscript)==null?void 0:r.call(f)}})]}),t.jsx(Me,{mode:c.mode,focused:c.focus!=null,checked:c.checked.length,rows:n.options.length,singleKeys:o,onShowTerm:()=>i({type:"showTerm"})}),t.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:h})]})}function on(e){const n=[];return e.forEach((o,s)=>{if(o.kind==="user"||o.kind==="record"){n.push({kind:o.kind,text:o.text,index:s});return}const c=n.at(-1);(c==null?void 0:c.kind)==="assistant"?c.turns.push(o):n.push({kind:"assistant",turns:[o],index:s})}),n}const cn=/^ {0,3}(`{3,}|~{3,})(.*)$/,ae=/^ {0,3}(#{1,6})[\t ]+(.+)$/,P=/^ {0,3}(?:([-+*])|([0-9]{1,9})[.)])[\t ]+(.*)$/,q=/^ {0,3}>[\t ]?(.*)$/;function le(e){const n=cn.exec(e);return n&&!(n[1][0]==="`"&&n[2].includes("`"))?n:null}function de(e){return e.map((n,o)=>n.kind==="code"?t.jsx("code",{children:n.text},o):n.kind==="bold"?t.jsx("strong",{children:de(n.kids)},o):t.jsx(u.Fragment,{children:n.text.split(`
2
2
  `).map((s,c)=>t.jsxs(u.Fragment,{children:[c>0&&t.jsx("br",{}),s]},c))},o))}const L=e=>de(ge(e)),Z=e=>le(e)||ae.test(e)||P.test(e)||q.test(e);function rn({text:e}){const n=e.replace(/\r\n?/g,`
3
3
  `).split(`
4
4
  `),o=[];let s=0;for(;s<n.length;){if(!n[s].trim()){s++;continue}const c=s,d=le(n[s]);if(d){const p=d[1],a=new RegExp(`^ {0,3}${p[0]}{${p.length},}[\\t ]*$`),k=d[2].trim().split(/\s+/)[0],j=++s;for(;s<n.length&&!a.test(n[s]);)s++;const g=n.slice(j,s).join(`
@@ -1,2 +1,2 @@
1
- import{bM as U,bN as W,bO as j,t as i,bP as O,bo as p,aG as G,bQ as H,bR as V,bS as B,bT as z,bU as X,ay as J,bV as K,az as E,bW as M,bX as S,bY as I,bZ as q}from"./app-40gNTTfq.js";const m=14,Z=18,Q=24,A=12,Y=26,ee=24,x=7,T=50,te=22,R=25,$=5,ne=8,se=168,oe=360;function ae(e,n){return n==="rail"||e<=0?x*2+T:x+T+$+(e-1)*R+te+ne}function Pe(e){return e.replace(/^(\d+m) \d+s$/,"$1")}function re(e,n){if(n==="rail")return[];const t=[];for(let s=0;s<e;s++)t.push(x+T+$+s*R);return t}function ie(e){return Math.max(1,Math.floor((e-m*2+A)/(se+A)))}function Ne(e,n,t){const s=new Map([...new Set(e.map(u=>u.col))].sort((u,c)=>u-c).map((u,c)=>[u,c])),a=e.map((u,c)=>({c:u,boardCol:s.get(u.col),order:u.order??c,i:c})).sort((u,c)=>u.boardCol-c.boardCol||u.order-c.order||u.i-c.i),o=s.size;let r=0,l=Math.max(1,o);if(t==="rail")for(;l>1;)l=Math.ceil(l/2),r+=1;else{const u=ie(n);for(;l>u;)l=Math.ceil(l/2),r+=1}const d=t==="rail"?Math.max(0,Math.floor(n-m*2)):Math.max(0,Math.min(oe,Math.floor((n-m*2-A*(l-1))/l))),g=t==="rail"?ee:Y,h=Array.from({length:l},()=>Z),b=Array.from({length:l},()=>[]);for(const{c:u,boardCol:c}of a){const f=t==="rail"?0:c>>r,C=ae(u.rows,t);b[f].push({sessionId:u.sessionId,col:f,boardCol:c,x:m+f*(d+A),y:h[f],w:d,h:C,rows:re(u.rows,t)}),h[f]+=C+g}const k=b.flat(),D=Math.max(0,...k.map(u=>u.y+u.h));return{density:t,columns:l,merges:r,width:n,height:k.length?D+Q:0,tileW:d,tiles:k}}function le(e){const n=[...e].sort((a,o)=>a.x-o.x||a.y-o.y),t=[];let s=-1/0;for(const a of n)t.length===0||a.x>=s?(t.push([a]),s=a.x+a.w):(t[t.length-1].push(a),s=Math.max(s,a.x+a.w));return t.flatMap((a,o)=>[...a].sort((r,l)=>r.y-l.y||r.x-l.x).map((r,l)=>({sessionId:r.sessionId,col:o,order:l})))}function ve(e,n,t){var l;const s=e.tiles.find(d=>d.sessionId===n);if(!s)return null;if(t==="up"||t==="down"){const d=e.tiles.filter(h=>h.col===s.col),g=d.indexOf(s)+(t==="down"?1:-1);return((l=d[g])==null?void 0:l.sessionId)??null}const a=s.col+(t==="right"?1:-1),o=s.y+s.h/2;let r=null;for(const d of e.tiles)d.col===a&&(!r||Math.abs(d.y+d.h/2-o)<Math.abs(r.y+r.h/2-o))&&(r=d);return(r==null?void 0:r.sessionId)??null}function Le(e){const n=new Map,t=new Map;for(const a of e){if(a.type!=="agent")continue;const o=a.data;if(!(o!=null&&o.sessionId)||o.exitAt!=null)continue;if(o.kind==="root"){n.set(o.sessionId,o);continue}const r=t.get(o.sessionId)??[];r.push({d:o,x:a.position.x,y:a.position.y}),t.set(o.sessionId,r)}const s=new Map;for(const a of new Set([...n.keys(),...t.keys()])){const o=(t.get(a)??[]).sort((r,l)=>r.y-l.y||r.x-l.x);s.set(a,{sessionId:a,root:n.get(a)??null,subs:o.map(r=>r.d)})}return s}function Oe(e,n){if(e.size!==n.size)return!1;for(const[t,s]of e){const a=n.get(t);if(!a||s.root!==a.root||s.subs.length!==a.subs.length)return!1;for(let o=0;o<s.subs.length;o++)if(s.subs[o]!==a.subs[o])return!1}return!0}function Re(e,n){return le(e).map(({sessionId:t,col:s,order:a})=>{var o;return{sessionId:t,col:s,order:a,rows:((o=n.get(t))==null?void 0:o.subs.length)??0}})}const y={sayWaiting:U,describeCall:e=>({name:j(e.name).label,subject:W(e.name,e.input)})};function $e(e){return O(e,e.kind==="root"?e.branch:void 0,y)}function Fe(e){return e===0?i("board.nav.none"):i("board.hosts.sessions",{count:e})}function w(e){let n=5381;for(let t=0;t<e.length;t++)n=(n<<5)+n^e.charCodeAt(t);return Math.abs(n)%360}const ue=3e3;function De(e,n){return e.exitStatus===0&&e.exitSignal===void 0&&n>=ue}function de(e){return e.kind==="live"||e.kind==="ended"||e.kind==="detached"||e.kind==="attaching"&&e.reconnect}function ce(e,n){return de(n)?"shown":n.kind==="attaching"&&e!=="hidden"?"held":"hidden"}function Ue(e,n){const t=ce(e.state,n),s=t==="shown"&&(e.state==="held"||e.state==="shown"&&e.afterHold);return{state:t,afterHold:s}}function We(e,n){return e.kind==="starting"||e.kind==="attaching"&&n==="hidden"}function je(e){return e.kind==="live"&&!e.readOnly}function _(e){return H(Math.max(0,Math.floor(e/1e3)))}function he(e,n){if(e.closedAt!=null){const t=p(n-e.closedAt);return{state:"ended",phrase:t===i("common.ago.now")?i("board.stage.phrase.endedJustNow"):i("board.stage.phrase.endedAgo",{ago:t})}}if(e.waiting)return{state:"waiting",phrase:i("board.queue.waiting"),emphasis:_(n-e.waiting.since),...e.waiting.tool?{tool:e.waiting.tool}:{},...e.waiting.detail?{arg:e.waiting.detail}:{}};if(e.yourTurn&&!e.tool){if(e.fresh)return{state:"ready",phrase:i("board.stage.phrase.ready"),arg:i("board.stage.phrase.firstPrompt")};const t=e.lastTurnEndAt!=null?p(n-e.lastTurnEndAt):null;return{state:"idle",phrase:i("board.list.yourTurn"),...t?{arg:P(t)}:{}}}if(e.fresh&&!e.tool&&!e.subagentsLive)return{state:"ready",phrase:i("board.stage.phrase.ready"),arg:i("board.stage.phrase.firstPrompt")};if(e.active){const t={state:"working",phrase:i("board.stage.phrase.working")};return e.tool?(t.tool=e.tool.name,e.tool.subject&&(t.arg=e.tool.subject),e.tool.startedAt!=null&&(t.seconds=G(e.tool.startedAt,void 0,n))):e.subagentsLive&&(t.arg=i("board.stage.subagentsRunning",{count:e.subagentsLive})),t}return e.fresh?{state:"ready",phrase:i("board.stage.phrase.ready"),arg:i("board.stage.phrase.firstPrompt")}:e.lastTurnEndAt!=null?{state:"idle",phrase:i("board.stage.phrase.idle"),arg:P(p(n-e.lastTurnEndAt))}:{state:"idle",phrase:i("board.stage.phrase.idle")}}function P(e){return e===i("common.ago.now")?i("board.stage.phrase.lastTurnNow"):i("board.stage.phrase.lastTurn",{ago:e})}const ge="board.stage.reconnectNote";function Ge(e,n){switch(n.kind){case"empty":return{state:"none",phrase:""};case"attaching":return n.reconnect?{state:"attaching",phrase:i("board.stage.phrase.reconnecting"),arg:i(ge)}:{state:"attaching",phrase:i("board.stage.attaching")};case"starting":return{state:"starting",phrase:i("board.stage.phrase.starting"),arg:n.cwd};case"tmux-installing":return{state:"starting",phrase:i("board.stage.settingUpTmux")};case"tmux-missing":return{state:"detached",phrase:i("board.stage.phrase.notAttached")};case"error":return n.code?{state:"detached",phrase:i("board.stage.phrase.notAttached")}:e??{state:"none",phrase:""};case"not-attachable":if(n.target.kind==="C"&&e&&e.state!=="ended"){const{tool:t,arg:s}=e;return{state:"elsewhere",phrase:i(pe(e.state)),...t?{tool:t}:{},...s?{arg:s}:{}}}return e??{state:"ended",phrase:i("board.stage.phrase.ended")};case"ended":return(e==null?void 0:e.state)==="ended"?e:{state:"ended",phrase:n.atOpen?i("board.stage.phrase.ended"):i("board.stage.phrase.endedJustNow")};default:return e??{state:"none",phrase:""}}}function He(e,n,t){return n.kind==="live"&&t&&e.state!=="waiting"}const Ve="board.stage.launchedUnreachable",Be="board.stage.provenanceUnknown";function fe(e,n){return e.kind==="C"&&n.windows===!0&&(n.launched===!0||e.provenance==="panel")}function ze(e,n){return e.kind==="C"&&n.windows===!0&&!fe(e,n)&&e.provenance==="unknown"}function Xe(e){switch(e){case"idle":case"ready":return"board.stage.elsewhere.idle";case"waiting":return"board.stage.elsewhere.waiting";case"working":return"board.stage.elsewhere.working";default:return"board.stage.elsewhere.running"}}function pe(e){return e==="working"?"board.stage.phrase.workingElsewhere":e==="idle"||e==="ready"||e==="waiting"?"board.stage.phrase.waitingElsewhere":"board.stage.phrase.elsewhere"}function Je(e,n){switch(n.kind){case"live":return i("board.stage.announceLive",{name:e});case"ended":return i("board.stage.announceEnded",{name:e});case"detached":return i("board.stage.announceDetached",{name:e});case"not-attachable":return n.stillRunning?i("board.stage.announceStillRunning",{name:e}):i("board.stage.announceNoPane",{name:e});case"tmux-installing":return i("board.stage.announceTmuxSetup");case"tmux-missing":return i("board.stage.announceTmuxMissing");case"error":return we(n.message);default:return null}}const be="board.stage.panelStopped",me=new Set(["That is not a session id.","The provider must be claude or codex."]);function we(e){return me.has(e.trim())?i(be):e}function Ke(e){return e?i("board.stage.closedNamed",{name:e}):i("board.stage.closed")}function Ae(e){return/^\//.test(e)||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\/]+[\\/][^\\/]+/.test(e)}function F(e){const n=e.split(/[\\/]+/).filter(Boolean);return n.length?n[n.length-1]:e}function ke(e,n){const t=new Map;for(const o of e){if(!o.cwd||!Ae(o.cwd))continue;const r=t.get(o.cwd);(!r||o.at>r.at)&&t.set(o.cwd,o)}const s=[...t.values()].sort((o,r)=>r.at-o.at),a=n?s.findIndex(o=>o.cwd===n):-1;return a>0&&s.unshift(...s.splice(a,1)),s.map(o=>({cwd:o.cwd,name:o.name||F(o.cwd),hue:o.hue,at:o.at}))}function qe(e,n=24){if(e.length<=n)return e;const t=e.split(/[\\/]+/).filter(Boolean),s=t.slice(-2).join("/");if(s.length+2<=n)return`…/${s}`;const a=t[t.length-1]??e;return a.length+2<=n?`…/${a}`:`…/${a.slice(0,Math.max(1,n-3))}…`}function xe(e){return e==="codex"?"Codex":"Claude Code"}function Ze(e){return e==="codex"?"Codex":"Claude"}const Te=160,ye=(e,n)=>e.length>n?`${e.slice(0,n-1)}…`:e;function N(e){var t;const n=((t=(e??"").split(`
1
+ import{bM as U,bN as W,bO as j,t as i,bP as O,bo as p,aG as G,bQ as H,bR as V,bS as B,bT as z,bU as X,ay as J,bV as K,az as E,bW as M,bX as S,bY as I,bZ as q}from"./app-DiIDGQPy.js";const m=14,Z=18,Q=24,A=12,Y=26,ee=24,x=7,T=50,te=22,R=25,$=5,ne=8,se=168,oe=360;function ae(e,n){return n==="rail"||e<=0?x*2+T:x+T+$+(e-1)*R+te+ne}function Pe(e){return e.replace(/^(\d+m) \d+s$/,"$1")}function re(e,n){if(n==="rail")return[];const t=[];for(let s=0;s<e;s++)t.push(x+T+$+s*R);return t}function ie(e){return Math.max(1,Math.floor((e-m*2+A)/(se+A)))}function Ne(e,n,t){const s=new Map([...new Set(e.map(u=>u.col))].sort((u,c)=>u-c).map((u,c)=>[u,c])),a=e.map((u,c)=>({c:u,boardCol:s.get(u.col),order:u.order??c,i:c})).sort((u,c)=>u.boardCol-c.boardCol||u.order-c.order||u.i-c.i),o=s.size;let r=0,l=Math.max(1,o);if(t==="rail")for(;l>1;)l=Math.ceil(l/2),r+=1;else{const u=ie(n);for(;l>u;)l=Math.ceil(l/2),r+=1}const d=t==="rail"?Math.max(0,Math.floor(n-m*2)):Math.max(0,Math.min(oe,Math.floor((n-m*2-A*(l-1))/l))),g=t==="rail"?ee:Y,h=Array.from({length:l},()=>Z),b=Array.from({length:l},()=>[]);for(const{c:u,boardCol:c}of a){const f=t==="rail"?0:c>>r,C=ae(u.rows,t);b[f].push({sessionId:u.sessionId,col:f,boardCol:c,x:m+f*(d+A),y:h[f],w:d,h:C,rows:re(u.rows,t)}),h[f]+=C+g}const k=b.flat(),D=Math.max(0,...k.map(u=>u.y+u.h));return{density:t,columns:l,merges:r,width:n,height:k.length?D+Q:0,tileW:d,tiles:k}}function le(e){const n=[...e].sort((a,o)=>a.x-o.x||a.y-o.y),t=[];let s=-1/0;for(const a of n)t.length===0||a.x>=s?(t.push([a]),s=a.x+a.w):(t[t.length-1].push(a),s=Math.max(s,a.x+a.w));return t.flatMap((a,o)=>[...a].sort((r,l)=>r.y-l.y||r.x-l.x).map((r,l)=>({sessionId:r.sessionId,col:o,order:l})))}function ve(e,n,t){var l;const s=e.tiles.find(d=>d.sessionId===n);if(!s)return null;if(t==="up"||t==="down"){const d=e.tiles.filter(h=>h.col===s.col),g=d.indexOf(s)+(t==="down"?1:-1);return((l=d[g])==null?void 0:l.sessionId)??null}const a=s.col+(t==="right"?1:-1),o=s.y+s.h/2;let r=null;for(const d of e.tiles)d.col===a&&(!r||Math.abs(d.y+d.h/2-o)<Math.abs(r.y+r.h/2-o))&&(r=d);return(r==null?void 0:r.sessionId)??null}function Le(e){const n=new Map,t=new Map;for(const a of e){if(a.type!=="agent")continue;const o=a.data;if(!(o!=null&&o.sessionId)||o.exitAt!=null)continue;if(o.kind==="root"){n.set(o.sessionId,o);continue}const r=t.get(o.sessionId)??[];r.push({d:o,x:a.position.x,y:a.position.y}),t.set(o.sessionId,r)}const s=new Map;for(const a of new Set([...n.keys(),...t.keys()])){const o=(t.get(a)??[]).sort((r,l)=>r.y-l.y||r.x-l.x);s.set(a,{sessionId:a,root:n.get(a)??null,subs:o.map(r=>r.d)})}return s}function Oe(e,n){if(e.size!==n.size)return!1;for(const[t,s]of e){const a=n.get(t);if(!a||s.root!==a.root||s.subs.length!==a.subs.length)return!1;for(let o=0;o<s.subs.length;o++)if(s.subs[o]!==a.subs[o])return!1}return!0}function Re(e,n){return le(e).map(({sessionId:t,col:s,order:a})=>{var o;return{sessionId:t,col:s,order:a,rows:((o=n.get(t))==null?void 0:o.subs.length)??0}})}const y={sayWaiting:U,describeCall:e=>({name:j(e.name).label,subject:W(e.name,e.input)})};function $e(e){return O(e,e.kind==="root"?e.branch:void 0,y)}function Fe(e){return e===0?i("board.nav.none"):i("board.hosts.sessions",{count:e})}function w(e){let n=5381;for(let t=0;t<e.length;t++)n=(n<<5)+n^e.charCodeAt(t);return Math.abs(n)%360}const ue=3e3;function De(e,n){return e.exitStatus===0&&e.exitSignal===void 0&&n>=ue}function de(e){return e.kind==="live"||e.kind==="ended"||e.kind==="detached"||e.kind==="attaching"&&e.reconnect}function ce(e,n){return de(n)?"shown":n.kind==="attaching"&&e!=="hidden"?"held":"hidden"}function Ue(e,n){const t=ce(e.state,n),s=t==="shown"&&(e.state==="held"||e.state==="shown"&&e.afterHold);return{state:t,afterHold:s}}function We(e,n){return e.kind==="starting"||e.kind==="attaching"&&n==="hidden"}function je(e){return e.kind==="live"&&!e.readOnly}function _(e){return H(Math.max(0,Math.floor(e/1e3)))}function he(e,n){if(e.closedAt!=null){const t=p(n-e.closedAt);return{state:"ended",phrase:t===i("common.ago.now")?i("board.stage.phrase.endedJustNow"):i("board.stage.phrase.endedAgo",{ago:t})}}if(e.waiting)return{state:"waiting",phrase:i("board.queue.waiting"),emphasis:_(n-e.waiting.since),...e.waiting.tool?{tool:e.waiting.tool}:{},...e.waiting.detail?{arg:e.waiting.detail}:{}};if(e.yourTurn&&!e.tool){if(e.fresh)return{state:"ready",phrase:i("board.stage.phrase.ready"),arg:i("board.stage.phrase.firstPrompt")};const t=e.lastTurnEndAt!=null?p(n-e.lastTurnEndAt):null;return{state:"idle",phrase:i("board.list.yourTurn"),...t?{arg:P(t)}:{}}}if(e.fresh&&!e.tool&&!e.subagentsLive)return{state:"ready",phrase:i("board.stage.phrase.ready"),arg:i("board.stage.phrase.firstPrompt")};if(e.active){const t={state:"working",phrase:i("board.stage.phrase.working")};return e.tool?(t.tool=e.tool.name,e.tool.subject&&(t.arg=e.tool.subject),e.tool.startedAt!=null&&(t.seconds=G(e.tool.startedAt,void 0,n))):e.subagentsLive&&(t.arg=i("board.stage.subagentsRunning",{count:e.subagentsLive})),t}return e.fresh?{state:"ready",phrase:i("board.stage.phrase.ready"),arg:i("board.stage.phrase.firstPrompt")}:e.lastTurnEndAt!=null?{state:"idle",phrase:i("board.stage.phrase.idle"),arg:P(p(n-e.lastTurnEndAt))}:{state:"idle",phrase:i("board.stage.phrase.idle")}}function P(e){return e===i("common.ago.now")?i("board.stage.phrase.lastTurnNow"):i("board.stage.phrase.lastTurn",{ago:e})}const ge="board.stage.reconnectNote";function Ge(e,n){switch(n.kind){case"empty":return{state:"none",phrase:""};case"attaching":return n.reconnect?{state:"attaching",phrase:i("board.stage.phrase.reconnecting"),arg:i(ge)}:{state:"attaching",phrase:i("board.stage.attaching")};case"starting":return{state:"starting",phrase:i("board.stage.phrase.starting"),arg:n.cwd};case"tmux-installing":return{state:"starting",phrase:i("board.stage.settingUpTmux")};case"tmux-missing":return{state:"detached",phrase:i("board.stage.phrase.notAttached")};case"error":return n.code?{state:"detached",phrase:i("board.stage.phrase.notAttached")}:e??{state:"none",phrase:""};case"not-attachable":if(n.target.kind==="C"&&e&&e.state!=="ended"){const{tool:t,arg:s}=e;return{state:"elsewhere",phrase:i(pe(e.state)),...t?{tool:t}:{},...s?{arg:s}:{}}}return e??{state:"ended",phrase:i("board.stage.phrase.ended")};case"ended":return(e==null?void 0:e.state)==="ended"?e:{state:"ended",phrase:n.atOpen?i("board.stage.phrase.ended"):i("board.stage.phrase.endedJustNow")};default:return e??{state:"none",phrase:""}}}function He(e,n,t){return n.kind==="live"&&t&&e.state!=="waiting"}const Ve="board.stage.launchedUnreachable",Be="board.stage.provenanceUnknown";function fe(e,n){return e.kind==="C"&&n.windows===!0&&(n.launched===!0||e.provenance==="panel")}function ze(e,n){return e.kind==="C"&&n.windows===!0&&!fe(e,n)&&e.provenance==="unknown"}function Xe(e){switch(e){case"idle":case"ready":return"board.stage.elsewhere.idle";case"waiting":return"board.stage.elsewhere.waiting";case"working":return"board.stage.elsewhere.working";default:return"board.stage.elsewhere.running"}}function pe(e){return e==="working"?"board.stage.phrase.workingElsewhere":e==="idle"||e==="ready"||e==="waiting"?"board.stage.phrase.waitingElsewhere":"board.stage.phrase.elsewhere"}function Je(e,n){switch(n.kind){case"live":return i("board.stage.announceLive",{name:e});case"ended":return i("board.stage.announceEnded",{name:e});case"detached":return i("board.stage.announceDetached",{name:e});case"not-attachable":return n.stillRunning?i("board.stage.announceStillRunning",{name:e}):i("board.stage.announceNoPane",{name:e});case"tmux-installing":return i("board.stage.announceTmuxSetup");case"tmux-missing":return i("board.stage.announceTmuxMissing");case"error":return we(n.message);default:return null}}const be="board.stage.panelStopped",me=new Set(["That is not a session id.","The provider must be claude or codex."]);function we(e){return me.has(e.trim())?i(be):e}function Ke(e){return e?i("board.stage.closedNamed",{name:e}):i("board.stage.closed")}function Ae(e){return/^\//.test(e)||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\/]+[\\/][^\\/]+/.test(e)}function F(e){const n=e.split(/[\\/]+/).filter(Boolean);return n.length?n[n.length-1]:e}function ke(e,n){const t=new Map;for(const o of e){if(!o.cwd||!Ae(o.cwd))continue;const r=t.get(o.cwd);(!r||o.at>r.at)&&t.set(o.cwd,o)}const s=[...t.values()].sort((o,r)=>r.at-o.at),a=n?s.findIndex(o=>o.cwd===n):-1;return a>0&&s.unshift(...s.splice(a,1)),s.map(o=>({cwd:o.cwd,name:o.name||F(o.cwd),hue:o.hue,at:o.at}))}function qe(e,n=24){if(e.length<=n)return e;const t=e.split(/[\\/]+/).filter(Boolean),s=t.slice(-2).join("/");if(s.length+2<=n)return`…/${s}`;const a=t[t.length-1]??e;return a.length+2<=n?`…/${a}`:`…/${a.slice(0,Math.max(1,n-3))}…`}function xe(e){return e==="codex"?"Codex":"Claude Code"}function Ze(e){return e==="codex"?"Codex":"Claude"}const Te=160,ye=(e,n)=>e.length>n?`${e.slice(0,n-1)}…`:e;function N(e){var t;const n=((t=(e??"").split(`
2
2
  `).find(s=>s.trim()!==""))==null?void 0:t.trim())??"";return n?ye(n,Te):null}function _e(e,n){const t=[];for(const s of e)s.sessionId===n&&s.kind==="subagent"&&t.push(s);return t}function Ce(e,n){var a,o;const t=e.waiting;let s=null;if(e.state==="active")for(let r=e.tools.length-1;r>=0;r--){const l=e.tools[r];if(l.endedAt!=null)continue;const d=y.describeCall(l);s={name:d.name,subject:d.subject??null,startedAt:l.startedAt};break}return{closedAt:e.closedAt??null,waiting:t&&J(t)?{since:t.since,...(a=t.tool)!=null&&a.name?{tool:t.tool.name}:{},...(o=t.tool)!=null&&o.preview?{detail:t.tool.preview}:{}}:null,active:e.state==="active",tool:s,subagentsLive:n.filter(r=>r.state==="active").length,lastTurnEndAt:e.lastTurnEndAt??null,fresh:e.prompts.length===0&&!e.firstPrompt&&e.lastTurnEndAt==null,yourTurn:(t==null?void 0:t.kind)==="idle"}}function Ee(e){const{used:n,limit:t}=K(e);return{used:n,window:t}}const v=32,L=e=>e.length>v?`${e.slice(0,v-1).trimEnd()}…`:e;function Me(e,n){const{title:t}=E(e),s=[...n.values()].filter(r=>r.kind!=="subagent"&&r.sessionId!==e.sessionId&&M(E(r).title,t));if(!s.length)return t;const a=L(S(e)),o=s.filter(r=>M(L(S(r)),a));return a&&!o.length?`${t}${I}${a}`:`${t}${I}${q(e.sessionId,o.map(r=>r.sessionId))}`}function Qe(e,n,t){if(!e||e.kind==="empty")return{kind:"empty"};if(e.kind==="launch")return{kind:"launch",agent:e.agent,cwd:e.cwd,name:F(e.cwd),hue:w(e.key),key:e.key,...e.options?{options:e.options}:{}};const s=V(n,e.id),a=e.launch?{launch:e.launch}:{},o=n.get(s);if(!o)return{kind:"session",session:{ref:{sessionId:s,provider:"claude",cwd:""},name:s.slice(0,8),hue:w(s),status:{state:"none",phrase:""},...e.launch?{launched:!0}:{}},...a};const r=_e(n.values(),s),l=Ce(o,r),d=o.provider==="codex"?"codex":"claude",g=B(o),h=O(o,void 0,y),b=[l.subagentsLive?i("board.stage.subagentsWorking",{count:l.subagentsLive}):null,o.closedAt!=null?i("board.stage.phrase.endedAgo",{ago:p(t-o.closedAt)}):null,`${xe(d)}${o.cwd?` · ${o.cwd}`:""}`].filter(Boolean).join(" · ");return{kind:"session",session:{ref:{sessionId:s,provider:d,cwd:o.cwd??""},name:Me(o,n),hue:w(s),model:o.model??null,effort:o.effort??null,status:he(l,t),contextUse:Ee(o),promptCount:X(o.prompts).length,ghostLine:(h==null?void 0:h.long)??N(g),context:{prompt:N(g),fact:b},endedAgo:o.closedAt!=null?p(t-o.closedAt):null,...o.panelLaunch!=null||e.launch?{launched:!0}:{},rename:z(o)},...a}}function Ye(e,n,t){var a,o;if(e.track.length===0)return null;let s=null;if(e.next){const r=n.find(l=>l.id===e.next.id);s={name:e.next.label,waited:r?_(t-r.waiting.since):"",tool:((a=r==null?void 0:r.waiting.tool)==null?void 0:a.name)??null}}return{position:e.position?{index:e.position.index-1,total:e.position.total}:null,resumed:((o=e.resumed)==null?void 0:o.label)??null,next:s,clear:e.clear}}function Se(e){return e.kind==="asked"?i("board.stage.askAsked"):e.kind==="idle"?i("board.stage.askIdle"):e.tool?e.tool.name==="Bash"?i("board.stage.askCommand"):i("board.stage.askTool",{tool:e.tool.name}):i("board.stage.askPermission")}function et(e,n){var s;const t=e[0];return t?{id:t.id,name:t.label,waited:_(n-t.waiting.since),ask:Se(t.waiting),command:((s=t.waiting.tool)==null?void 0:s.preview)||null}:null}function tt(e,n){var a;const t=e.arrival;if(!t)return null;const s=n.find(o=>o.id===t.id);return{name:t.label,tool:((a=s==null?void 0:s.waiting.tool)==null?void 0:a.name)??null}}function nt(e,n){const t=[];for(const s of e)s.kind!=="root"||!s.cwd||t.push({cwd:s.cwd,hue:w(s.sessionId),at:s.lastEventAt??s.startedAt});return ke(t,n)}export{Je as A,We as B,Qe as C,nt as D,Ke as E,T as F,et as G,tt as H,Ye as I,he as J,Ce as K,Ve as L,Be as P,te as R,x as T,Re as a,ve as b,$e as c,Oe as d,Le as e,w as f,F as g,qe as h,Ae as i,De as j,de as k,xe as l,Ue as m,Ne as n,we as o,fe as p,ze as q,Pe as r,Fe as s,Xe as t,ge as u,Ze as v,ce as w,Ge as x,He as y,je as z};
@@ -1 +1 @@
1
- import{c4 as j,c5 as x,c6 as M,c7 as B,r as E,c8 as C,c9 as J,ca as U,a as P,cb as D}from"./app-40gNTTfq.js";const $=2e3;function G(n){var s,o,i,r;if(!n)return null;const t=n.state==="connected";return{connected:t,email:t?((s=n.account)==null?void 0:s.email)??null:null,unread:t?((o=n.feedback)==null?void 0:o.unread)??0:0,latestAt:t?((i=n.feedback)==null?void 0:i.latestAt)??null:null,mail:!t||((r=n.feedback)==null?void 0:r.mail)!==!1}}function F({post:n,read:t,appliers:s,themes:o,setTimer:i=(e,f)=>setTimeout(e,f),clearTimer:r=e=>clearTimeout(e),debounceMs:m=$}){let e=!1,f={},O=null,v={},u=null;function R(){u!=null&&r(u),u=null,v={}}function T(c){var V;const a=s();let l;const w=j(t);for(const[S,h]of Object.entries(x(c.values))){if(S==="theme"&&!o().includes(h)){l={theme:h};continue}f[S]=h,w[S]!==h&&((V=a[S])==null||V.call(a,h))}O=c.revision,n("/api/account/ui/applied",{revision:c.revision,...l?{skipped:l}:{}}).catch(()=>{})}function _(c){const a=(c==null?void 0:c.state)==="connected"?c.sync:null;if(!a){e=!1,O=null,R();return}if(!e){if(e=!0,f=j(t),a.initialUpload){n("/api/account/ui",{values:{...f},reason:"initial"}).catch(()=>{});return}T(a.apply??a.adopt);return}a.apply&&a.apply.revision!==O&&T(a.apply)}function N(){u=null;const c=v;v={},Object.keys(c).length&&n("/api/account/ui",{values:c,reason:"user"}).catch(()=>{})}function L(c,a){if(!e)return;const l=M(c);if(!l)return;const w=B(l,a);f[l.key]!==w&&(f[l.key]=w,v[l.key]=w,u!=null&&r(u),u=i(N,m))}return{onView:_,onStored:L,flush:()=>{u!=null&&r(u),N()},dispose:R}}let k=null,b=!1;const A=new Set;let g=!1;function p(n){k=n;for(const t of A)t()}async function y(){try{const n=await fetch("/api/account",{headers:{accept:"application/json"}});if(!n.ok){b=!0,p(k);return}b=!1,p(await n.json())}catch{b=!0,p(k)}}function H(){g||typeof window>"u"||(g=!0,window.addEventListener(C,n=>{const t=n.detail;try{p(JSON.parse(t))}catch{}}),window.addEventListener(J,()=>{y()}),y())}function K(n){return H(),A.add(n),()=>{A.delete(n)}}function q(){return{view:E.useSyncExternalStore(K,()=>k,()=>null),failed:b}}async function d(n,t={}){const s=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),o=await s.json().catch(()=>null);if(!s.ok&&!o)throw new Error(`${n} answered ${s.status}`);return o}function I(n){try{const t=new URL(String(n??""));return t.username||t.password?!1:t.protocol==="https:"?!0:t.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(t.hostname)}catch{return!1}}const Q={async connect(n){const t=await d("/api/account/connect",{name:n});return t&&p(t),t},async cancel(){p(await d("/api/account/connect/cancel"))},async disconnect(){p(await d("/api/account/disconnect"))},async setMode(n){const t=await d("/api/account/sync/mode",n);return await y(),t},async resolve(n){await d("/api/account/sync/resolve",{action:n}),await y()},async upload(){await d("/api/account/sync/upload",{upload:!0}),await y()},async preview(){return(await fetch("/api/account/sync/preview")).json()},refresh:y};function W(n){const t=E.useRef(n);t.current=n;const{view:s}=q(),o=E.useRef(null);o.current||(o.current=F({post:(i,r)=>d(i,r),read:P,appliers:()=>t.current,themes:()=>D})),E.useEffect(()=>{const i=o.current,r=m=>{const e=m.detail;e&&typeof e.key=="string"&&i.onStored(e.key,e.value??null)};return window.addEventListener(U,r),()=>{window.removeEventListener(U,r),i.dispose()}},[]),E.useEffect(()=>{o.current.onView(s)},[s])}export{q as a,Q as b,G as f,I as o,W as u};
1
+ import{c4 as j,c5 as x,c6 as M,c7 as B,r as E,c8 as C,c9 as J,ca as U,a as P,cb as D}from"./app-DiIDGQPy.js";const $=2e3;function G(n){var s,o,i,r;if(!n)return null;const t=n.state==="connected";return{connected:t,email:t?((s=n.account)==null?void 0:s.email)??null:null,unread:t?((o=n.feedback)==null?void 0:o.unread)??0:0,latestAt:t?((i=n.feedback)==null?void 0:i.latestAt)??null:null,mail:!t||((r=n.feedback)==null?void 0:r.mail)!==!1}}function F({post:n,read:t,appliers:s,themes:o,setTimer:i=(e,f)=>setTimeout(e,f),clearTimer:r=e=>clearTimeout(e),debounceMs:m=$}){let e=!1,f={},O=null,v={},u=null;function R(){u!=null&&r(u),u=null,v={}}function T(c){var V;const a=s();let l;const w=j(t);for(const[S,h]of Object.entries(x(c.values))){if(S==="theme"&&!o().includes(h)){l={theme:h};continue}f[S]=h,w[S]!==h&&((V=a[S])==null||V.call(a,h))}O=c.revision,n("/api/account/ui/applied",{revision:c.revision,...l?{skipped:l}:{}}).catch(()=>{})}function _(c){const a=(c==null?void 0:c.state)==="connected"?c.sync:null;if(!a){e=!1,O=null,R();return}if(!e){if(e=!0,f=j(t),a.initialUpload){n("/api/account/ui",{values:{...f},reason:"initial"}).catch(()=>{});return}T(a.apply??a.adopt);return}a.apply&&a.apply.revision!==O&&T(a.apply)}function N(){u=null;const c=v;v={},Object.keys(c).length&&n("/api/account/ui",{values:c,reason:"user"}).catch(()=>{})}function L(c,a){if(!e)return;const l=M(c);if(!l)return;const w=B(l,a);f[l.key]!==w&&(f[l.key]=w,v[l.key]=w,u!=null&&r(u),u=i(N,m))}return{onView:_,onStored:L,flush:()=>{u!=null&&r(u),N()},dispose:R}}let k=null,b=!1;const A=new Set;let g=!1;function p(n){k=n;for(const t of A)t()}async function y(){try{const n=await fetch("/api/account",{headers:{accept:"application/json"}});if(!n.ok){b=!0,p(k);return}b=!1,p(await n.json())}catch{b=!0,p(k)}}function H(){g||typeof window>"u"||(g=!0,window.addEventListener(C,n=>{const t=n.detail;try{p(JSON.parse(t))}catch{}}),window.addEventListener(J,()=>{y()}),y())}function K(n){return H(),A.add(n),()=>{A.delete(n)}}function q(){return{view:E.useSyncExternalStore(K,()=>k,()=>null),failed:b}}async function d(n,t={}){const s=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),o=await s.json().catch(()=>null);if(!s.ok&&!o)throw new Error(`${n} answered ${s.status}`);return o}function I(n){try{const t=new URL(String(n??""));return t.username||t.password?!1:t.protocol==="https:"?!0:t.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(t.hostname)}catch{return!1}}const Q={async connect(n){const t=await d("/api/account/connect",{name:n});return t&&p(t),t},async cancel(){p(await d("/api/account/connect/cancel"))},async disconnect(){p(await d("/api/account/disconnect"))},async setMode(n){const t=await d("/api/account/sync/mode",n);return await y(),t},async resolve(n){await d("/api/account/sync/resolve",{action:n}),await y()},async upload(){await d("/api/account/sync/upload",{upload:!0}),await y()},async preview(){return(await fetch("/api/account/sync/preview")).json()},refresh:y};function W(n){const t=E.useRef(n);t.current=n;const{view:s}=q(),o=E.useRef(null);o.current||(o.current=F({post:(i,r)=>d(i,r),read:P,appliers:()=>t.current,themes:()=>D})),E.useEffect(()=>{const i=o.current,r=m=>{const e=m.detail;e&&typeof e.key=="string"&&i.onStored(e.key,e.value??null)};return window.addEventListener(U,r),()=>{window.removeEventListener(U,r),i.dispose()}},[]),E.useEffect(()=>{o.current.onView(s)},[s])}export{q as a,Q as b,G as f,I as o,W as u};
@@ -87,9 +87,9 @@
87
87
  document.documentElement.setAttribute("data-density", density === "tightest" || density === "tighter" || density === "default" || density === "comfortable" ? density : "compact");
88
88
  })();
89
89
  </script>
90
- <script type="module" crossorigin src="/assets/index-XIY3yFiN.js"></script>
91
- <link rel="modulepreload" crossorigin href="/assets/app-40gNTTfq.js">
92
- <link rel="stylesheet" crossorigin href="/assets/app-BRjYF6oD.css">
90
+ <script type="module" crossorigin src="/assets/index-BXBkLnYy.js"></script>
91
+ <link rel="modulepreload" crossorigin href="/assets/app-DiIDGQPy.js">
92
+ <link rel="stylesheet" crossorigin href="/assets/app-82JtqhPe.css">
93
93
  </head>
94
94
  <body>
95
95
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccdeck",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Local dashboard for Claude Code and Codex CLI sessions: which Claude Code session needs input, every tool call and Claude Code subagent live, token cost and quota, several Claude accounts. Run npx ccdeck.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -107,11 +107,11 @@
107
107
  "ws": "8.22.1"
108
108
  },
109
109
  "optionalDependencies": {
110
- "@ccdeck/engine-darwin-arm64": "0.1.5",
111
- "@ccdeck/engine-darwin-x64": "0.1.5",
112
- "@ccdeck/engine-linux-arm64": "0.1.5",
113
- "@ccdeck/engine-linux-x64": "0.1.5",
114
- "@ccdeck/engine-win32-x64": "0.1.5"
110
+ "@ccdeck/engine-darwin-arm64": "0.1.6",
111
+ "@ccdeck/engine-darwin-x64": "0.1.6",
112
+ "@ccdeck/engine-linux-arm64": "0.1.6",
113
+ "@ccdeck/engine-linux-x64": "0.1.6",
114
+ "@ccdeck/engine-win32-x64": "0.1.6"
115
115
  },
116
116
  "bundledDependencies": [
117
117
  "fs-native-extensions",
@@ -1,4 +1,30 @@
1
1
  {
2
+ "4.0.2": [
3
+ {
4
+ "title": "🖱️ A click on a Board card opens the session in Workspace",
5
+ "body": "With the terminal on, clicking a session's card on the Board switches to Workspace with that session in the pane and the keys in it, and Sessions shows the same rows in both views."
6
+ },
7
+ {
8
+ "title": "🔍 The Inspector opens beside your Workspace session",
9
+ "body": "On a window 1320 px or wider, opening a session in Workspace unfolds the Inspector next to its terminal, with Usage and This machine at the window's edge, and its context and recap are easier to scan."
10
+ },
11
+ {
12
+ "title": "🗂️ Sessions appears whole when the deck loads",
13
+ "body": "The Sessions list waits for the session history to load and then shows every row at once, in its final order, instead of filling in and reshuffling."
14
+ },
15
+ {
16
+ "title": "🧰 Panes draw correctly with tmux 3.2 to 3.5",
17
+ "body": "Where the system's tmux is 3.2 to 3.5, as on Ubuntu 24.04, the deck now runs its own newer tmux, so a pane that reconnects no longer shows a line shifted by one character; sessions already running keep their tmux until they end."
18
+ },
19
+ {
20
+ "title": "🎨 Codex keeps its colours in terminal panes",
21
+ "body": "A Codex session started from the deck now shows its prompt and status line in colour, even where the deck itself runs with NO_COLOR set."
22
+ },
23
+ {
24
+ "title": "📡 Browser Watch's radar keeps turning",
25
+ "body": "The radar no longer stops with an error when its dialog has no room for it, and draws again as soon as there is space."
26
+ }
27
+ ],
2
28
  "4.0.0": [
3
29
  {
4
30
  "title": "🖥️ Your sessions' terminals, inside the deck",
@@ -12,7 +38,7 @@
12
38
  "title": "🧭 A calmer deck that shows what needs you",
13
39
  "body": "The Sessions list reads like an inbox, colour on the board means state, and the Inspector offers each session's next step under its title.",
14
40
  "priority": "highlight",
15
- "details": "Each stripe keeps its everyday doors and puts the rest behind More. Counters at zero and key hints you have learned step aside, and the board's tools sit in one ⋯ menu. Quotas moved from Sessions to Usage, and Codex's helper agents stay inside their main conversation. Every key works as before."
41
+ "details": "Counters at zero and key hints you have learned step aside, and the board's tools sit in one ⋯ menu. Quotas moved from Sessions to Usage, and Codex's helper agents stay inside their main conversation. Every key works as before."
16
42
  },
17
43
  {
18
44
  "title": "🪟 Up to four sessions side by side in Workspace",
@@ -184,6 +210,7 @@
184
210
  "without one."
185
211
  ],
186
212
  "//summaries": {
213
+ "4.0.2": "Board cards open in Workspace, the Inspector opens with the session, and panes draw right on tmux 3.2–3.5",
187
214
  "4.0.0": "A calmer deck, with your sessions' terminals inside it",
188
215
  "3.82.3": "Windows CPU limits and more reliable session and usage history",
189
216
  "3.82.2": "Arrow keys show the selected row on ccdeck tui's Network tab",
@@ -243,7 +270,8 @@
243
270
  "3.48.1",
244
271
  "3.49.1",
245
272
  "3.53.1",
246
- "3.53.3"
273
+ "3.53.3",
274
+ "4.0.1"
247
275
  ],
248
276
  "3.82.2": [
249
277
  {
@@ -4,8 +4,8 @@
4
4
  //
5
5
  // NOTHING HAPPENS UNTIL A ROUTE ASKS. Importing this does no I/O. The routes
6
6
  // (terminal-routes.mjs) ask only while the panel's switch is on — with it off
7
- // they are a 404 and never get here — so a deck with the switch off, the
8
- // default, never looks at the install folder, never builds a client, never
7
+ // they are a 404 and never get here — so a deck with the switch off (it is
8
+ // on by default) never looks at the install folder, never builds a client, never
9
9
  // starts anything and never touches the network. On a platform without the
10
10
  // panel, a route is answered `unsupported` without looking either.
11
11
  //
@@ -25,8 +25,8 @@
25
25
  // environment variable, a setting, a CLI flag, a file or a request;
26
26
  // - startServer was also given an explicit `terminal.engine`: the engine
27
27
  // that preload built, with a fresh test key it holds in memory and passes
28
- // as that engine's `publicKey`. The deck's own ENGINE_PUBLIC_KEYS stay
29
- // empty and are never added to;
28
+ // as that engine's `publicKey`. The deck's own ENGINE_PUBLIC_KEYS (the
29
+ // one release key) are never used for it and never added to;
30
30
  // - the test-only module preview/command-panel-windows.mjs, outside
31
31
  // src/server, can be loaded. It is not in the published package
32
32
  // (package.json `files`) nor in the desktop app's resources
@@ -12,7 +12,8 @@
12
12
  // no I/O. command-panel-engine.mjs calls importEngine only when a question for
13
13
  // the Command Panel arrives while its switch is on, on a platform that has the
14
14
  // panel, and only when the deck holds keys to verify with. With the switch off
15
- // (the default) nothing here is called: the package folder is never looked at.
15
+ // (it is on by default) nothing here is called: the package folder is never
16
+ // looked at.
16
17
  //
17
18
  // THE PACKAGE IS FOUND BY WALKING UP FROM THE DECK'S OWN FOLDER through each
18
19
  // `node_modules`, the way Node finds a dependency, and nowhere else: not on
@@ -1,4 +1,5 @@
1
- // Optional local executable verification. No downloads or public runtime deps.
1
+ // Optional local executable verification. Nothing is downloaded here (a
2
+ // person's Install does that, in engine-download.mjs) and no public runtime deps.
2
3
  //
3
4
  // TWO CALLERS, ONE SET OF RULES. verifyEngineInstallation checks the folder the
4
5
  // engine runs from (`<deck data folder>/engine`). engine-package.mjs checks the
@@ -109,8 +109,9 @@ const READ_LOST = new Map([
109
109
 
110
110
  /** What an engine route answers: `status` and `body` for the page, and maybe
111
111
  * a `handle` where that body's ticket is, a line for the deck's log, and
112
- * `fixable` on a status with no tmux the engine can use, which the deck
113
- * could fetch its own of (terminal-routes.mjs' withOwnTmux). */
112
+ * `fixable` on a status with no tmux the engine can use, or only one older
113
+ * than 3.6, which the deck could fetch its own of (terminal-routes.mjs'
114
+ * withOwnTmux and fetchBehind). */
114
115
  const ANSWER_KEYS = new Set(["status", "body", "handle", "log", "fixable"]);
115
116
  const HANDLE = /^[0-9a-f]{64}$/;
116
117
 
@@ -48,7 +48,7 @@ import {
48
48
  import { terminalBridge } from "./terminal-bridge.mjs";
49
49
  import { TICKET_TTL_MS } from "./terminal-socket.mjs";
50
50
  import { checkTargetQuery, describeTarget, resolveTarget } from "./terminal-target.mjs";
51
- import { DECK_SOCKET, findTmux, resetTmuxCache } from "./tmux.mjs";
51
+ import { DECK_SOCKET, findTmux, ownTmuxWanted, resetTmuxCache } from "./tmux.mjs";
52
52
  import { ensureManagedTmux, recentTmuxFailure, tmuxDownloadBlocked, tmuxDownloadProgress } from "./tmux-download.mjs";
53
53
  import { deckDataDir } from "./deck-home.mjs";
54
54
 
@@ -132,9 +132,11 @@ export function jsTerminalDeps(routes = {}) {
132
132
  home: homedir,
133
133
  ttySize: null,
134
134
  openControl: null,
135
- // ccdeck's own tmux, for a machine with none (tmux-download.mjs).
135
+ // ccdeck's own tmux, for a machine with none or one older than 3.6
136
+ // (tmux-download.mjs).
136
137
  downloadBlocked: null,
137
138
  downloadTmux: null,
139
+ ownTmuxWanted: null,
138
140
  downloadProgress: tmuxDownloadProgress,
139
141
  recentDownloadFailure: recentTmuxFailure,
140
142
  forgetTmux: resetTmuxCache,
@@ -143,7 +145,8 @@ export function jsTerminalDeps(routes = {}) {
143
145
  d.downloadBlocked ??= () => tmuxDownloadBlocked({ env: d.env, platform: d.platform });
144
146
  // Into the folder tmuxCandidates looks in, which is decided by the same env.
145
147
  d.downloadTmux ??= () => ensureManagedTmux({ env: d.env, platform: d.platform, dataDir: deckDataDir(d.platform, d.env) });
146
- d.findTmux ??= () => findTmux({ env: d.env, platform: d.platform });
148
+ d.ownTmuxWanted ??= (found) => ownTmuxWanted(found, { env: d.env, platform: d.platform });
149
+ d.findTmux ??= () => findTmux({ env: d.env, platform: d.platform, socket: d.deckSocket });
147
150
  d.claudeBin ??= () => resolveAgentBin("claude", { env: d.env, platform: d.platform });
148
151
  d.ttySize ??= (tty) => ttySize(tty, d.platform);
149
152
  return d;
@@ -334,6 +337,13 @@ export function tmuxStatus(found) {
334
337
  * the download has said how far it is; the panel asks again until it is `ok`. A download that failed is answered for RETRY_AFTER_MS as
335
338
  * the plain missing or too-old state with `download: <why>`, so the panel can
336
339
  * offer the install line instead, and is tried again after that.
340
+ *
341
+ * With a tmux 3.2–3.5 and no own build yet (tmux.mjs ownTmuxWanted), the
342
+ * same download starts behind an answer that says only that tmux works: the
343
+ * panel keeps that tmux meanwhile and is told nothing of the download — no
344
+ * "installing", and no failure, since offline the older tmux simply stays.
345
+ * Once the build lands the remembered answer is forgotten, and findTmux moves
346
+ * to it unless the deck's server still runs sessions under the older one.
337
347
  */
338
348
  async function status(req, res, _input, routes) {
339
349
  const d = jsTerminalDeps(routes);
@@ -349,6 +359,9 @@ async function status(req, res, _input, routes) {
349
359
  const progress = d.downloadProgress();
350
360
  return send(res, 200, { ok: true, platform: d.platform, tmux: { ok: false, reason: "installing", ...(progress ? { progress } : {}) } });
351
361
  }
362
+ if (found?.ok === true && d.ownTmuxWanted(found) && !d.downloadBlocked() && !d.recentDownloadFailure()) {
363
+ void d.downloadTmux().then((r) => { if (r?.ok) d.forgetTmux(); });
364
+ }
352
365
  maybePrune(d, found);
353
366
  return send(res, 200, { ok: true, platform: d.platform, tmux: tmuxStatus(found) });
354
367
  }
@@ -57,7 +57,10 @@
57
57
  // "installing" with how far it has got, and once the build has landed tells
58
58
  // the engine to look again (`terminal.forgetTmux`). That download is the one
59
59
  // piece of the JS backend's tmux handling on the product's path;
60
- // terminal-js-offpath.test.ts holds that nothing else of it is.
60
+ // terminal-js-offpath.test.ts holds that nothing else of it is. A machine
61
+ // whose tmux is 3.2–3.5 gets the same download, behind a status that keeps
62
+ // saying that tmux works (fetchBehind): the engine says `fixable` there too,
63
+ // and moves to the build once it has landed.
61
64
  //
62
65
  // THE PAGE NEVER NAMES A PANE. It names a session — an id, a provider, a
63
66
  // folder — and the engine works the rest out. Where its answer carries a
@@ -79,7 +82,8 @@ import { checkFolder } from "./terminal-folder.mjs";
79
82
  import { discoverProjects } from "./project-discovery.mjs";
80
83
  import { createTicketStore } from "./terminal-socket.mjs";
81
84
  import {
82
- TMUX_BUILD, ensureManagedTmux, managedTmuxPath, recentTmuxFailure, tmuxDownloadBlocked, tmuxDownloadProgress,
85
+ PREFERRED_TMUX_VERSION, TMUX_BUILD, ensureManagedTmux, managedTmuxPath, recentTmuxFailure, tmuxDownloadBlocked,
86
+ tmuxDownloadProgress,
83
87
  } from "./tmux-download.mjs";
84
88
 
85
89
  /** The bodies here are an id, a provider and a folder. A few kilobytes is far
@@ -451,7 +455,8 @@ async function jsonBody(req, res) {
451
455
  * use, bound to `{ handle, origin }` — the page's origin, as for any ticket —
452
456
  * and the upgrade relays it to the engine. The `log` line goes to the deck's
453
457
  * log, never to the page. A status it calls `fixable` runs the deck's own tmux
454
- * download first (withOwnTmux). An engine that could not take the question answers
458
+ * download first (withOwnTmux), or behind the answer where that status's tmux
459
+ * works (fetchBehind). An engine that could not take the question answers
455
460
  * its refusal in the same shape (routeThroughEngine); one that failed in a way
456
461
  * that must not be asked again throws, which is `guard`'s 500.
457
462
  */
@@ -485,6 +490,8 @@ async function answer(d, req, res, method, question) {
485
490
  said = await withOwnTmux(d, said);
486
491
  // It may have asked the engine again on the way: the switch once more.
487
492
  if (!d.enabled()) return answeredAfterOff(res, method, said);
493
+ } else if (method === "status" && fixableBehind(said)) {
494
+ fetchBehind(d);
488
495
  }
489
496
  let out = withProvenance(d.provenance, question, said.body);
490
497
  if (said.handle) {
@@ -551,3 +558,38 @@ async function withOwnTmux(d, said) {
551
558
  const progress = own.progress();
552
559
  return withTmux(said, { ok: false, reason: "installing", ...(progress ? { progress } : {}) });
553
560
  }
561
+
562
+ /** Whether the engine's answer is a status it calls `fixable` beside a tmux
563
+ * that works and is older than PREFERRED_TMUX_VERSION: one the engine runs
564
+ * only until ccdeck's own build is in place. Asked of the body too, so
565
+ * fixable beside a tmux that new, or one whose version it does not say,
566
+ * fetches nothing. */
567
+ function fixableBehind(said) {
568
+ const tmux = said?.body?.tmux;
569
+ if (said?.fixable !== true || said.status !== 200 || said.body?.ok !== true) return false;
570
+ if (!tmux || typeof tmux !== "object" || tmux.ok !== true || typeof tmux.version !== "string") return false;
571
+ const m = /^(\d+)\.(\d+)$/.exec(tmux.version);
572
+ if (!m) return false;
573
+ const [major, minor] = [Number(m[1]), Number(m[2])];
574
+ const [pMajor, pMinor] = PREFERRED_TMUX_VERSION;
575
+ return major < pMajor || (major === pMajor && minor < pMinor);
576
+ }
577
+
578
+ /**
579
+ * A status the engine called `fixable` beside a tmux 3.2–3.5 that works:
580
+ * ccdeck's own build is fetched behind it — the same download as for a
581
+ * machine with none — and the answer is sent as it is. Nothing tells the page:
582
+ * the tmux it has keeps working meanwhile, so there is no "installing", and a
583
+ * download that fails is no news either (offline, the older tmux simply
584
+ * stays). Once the build lands the engine is told to look again
585
+ * (`terminal.forgetTmux`), and moves to it unless the deck's server still runs
586
+ * sessions under the older tmux. Nothing starts where no download may, while
587
+ * one is out, for a build already in place — the engine knows it is there,
588
+ * and keeps the older tmux for its sessions — or for RETRY_AFTER_MS after one
589
+ * failed. Never awaited, never rejects.
590
+ */
591
+ function fetchBehind(d) {
592
+ const own = d.ownTmux;
593
+ if (!own || own.blocked() || own.out || own.landed() || own.recentFailure()) return;
594
+ own.start(() => d.engine.forgetTmux?.());
595
+ }
@@ -326,7 +326,8 @@ export function launchCommand({ name, cwd, cols, rows, argv, sessionId = "", age
326
326
  "-c", tmuxFormatLiteral(cwd), "-e", "COLORTERM=truecolor",
327
327
  ...(agent === "claude" ? ["-e", "CLAUDE_CODE_NONBLOCKING_STDOUT=1", "-e", "CLAUDE_CODE_TMUX_TRUECOLOR=1", "-e", `CLAUDE_CODE_SCROLL_SPEED=${CLAUDE_SCROLL_SPEED}`] : []),
328
328
  "-P", "-F", "#{pane_id}",
329
- "--", ...paneArgv(argv)],
329
+ // Strip NO_COLOR at exec time, even if the tmux server inherited it.
330
+ "--", ...paneArgv(agent === "codex" ? ["env", "-u", "NO_COLOR", ...argv] : argv)],
330
331
  // The panel's colours, straight after the pane and in the same sequence,
331
332
  // so they are tmux's answer before the program can ask. A program asking
332
333
  // its terminal's colours (OSC 10/11: Codex at its first frame, Claude
@@ -1,4 +1,5 @@
1
- // ccdeck's own tmux, fetched for a machine that has no usable one.
1
+ // ccdeck's own tmux, fetched for a machine that has no usable one, or only one
2
+ // older than 3.6.
2
3
  //
3
4
  // The terminal panel runs every session inside tmux 3.2 or newer, and most of
4
5
  // the people who run ccdeck have never installed tmux. Installing it for them
@@ -8,6 +9,10 @@
8
9
  // repository. This file fetches the build for this machine into the deck's
9
10
  // data folder.
10
11
  //
12
+ // A machine whose tmux is 3.2–3.5 (Ubuntu 22.04 and 24.04, Debian 12) gets it
13
+ // too, behind a panel that keeps working meanwhile: see
14
+ // PREFERRED_TMUX_VERSION.
15
+ //
11
16
  // THE TRUST IS IN THIS FILE, NOT IN THE RELEASE PAGE. uv-bootstrap.mjs checks
12
17
  // uv against the SHA-256 that Astral publishes beside it, because Astral is the
13
18
  // publisher and the deck is not. Here the deck is the publisher, so the hashes
@@ -41,6 +46,21 @@ export const TMUX_BUILD = Object.freeze({
41
46
  }),
42
47
  });
43
48
 
49
+ /**
50
+ * The oldest tmux the deck runs in preference to this build, as [major,
51
+ * minor].
52
+ *
53
+ * tmux before 3.6 mis-draws a row with a wide glyph in it (upstream
54
+ * `9c07903a`), and a pane that reconnects or reopens is reseeded from what
55
+ * tmux drew, so the panel shows that row one cell off until the program
56
+ * redraws it. A tmux 3.2–3.5 still works, so it is never refused for this:
57
+ * the build is fetched behind it, and the deck moves to the build once it is
58
+ * in place and the deck's own tmux server runs no session under the older
59
+ * one (tmux.mjs ownOverOlder). Here rather than in tmux.mjs because the
60
+ * deck's routes read it, and tmux.mjs is not on their path.
61
+ */
62
+ export const PREFERRED_TMUX_VERSION = Object.freeze([3, 6]);
63
+
44
64
  const RELEASES = "https://github.com/BarganConstantin/ccdeck/releases/download";
45
65
  /** A build is about 1 MB; anything near this is not one. */
46
66
  const MAX_BYTES = 32 << 20;