Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.
JavaScript ai-codingclaudeclaude-codeclaude-code-pluginclicoding-agentsdeveloper-toolsgitllmtypescript
docs: rebuild the demo with the 1.0 map
Erenc005db207d20
diff --git a/docs/demo/index.html b/docs/demo/index.htmlindex d60314a..224d85f 100644--- a/docs/demo/index.html+++ b/docs/demo/index.html@@ -27,13 +27,13 @@ Error generating stack: `+e.message+``)}let r=[`flowchart TD`];for(let e of t.nodes){let[t,i]=km[e.kind]??[`[`,`]`];r.push(` ${e.id}${t}"${n(e.kind)} ${Am(e.label)}"${i}`)}return t.edges.forEach(e=>{e.label!==void 0&&e.label!==``?r.push(` ${e.from} -->|"${Am(e.label)}"| ${e.to}`):r.push(` ${e.from} --> ${e.to}`)}),r.join(``)}function Nm(e){let t=new Set;for(let n of e)if(n.kind===`flow`){let e=Om(n.text);for(let n of e?.nodes??[])t.add(n.kind)}else if(n.kind===`pseudo`)for(let e of n.text.split(``)){let n=/^\s*\d+[.)]\s+(\S)/.exec(e)?.[1],r=n===void 0?void 0:Tm.find(e=>e.symbol===n);r!==void 0&&t.add(r.id)}return Tm.filter(e=>t.has(e.id))}var Pm={mermaid:`Follow the arrows from the top. A box is a step; a diamond is a question, and the arrows leaving it are its answers.`,sequence:`Each column is an actor, named at the top. Read from top to bottom: each arrow is one actor handing work to another at that moment, and a dashed arrow is a reply.`,flow:`Follow the arrows from the top. Each box's symbol says what kind of thing it is — the legend above lists them; a ◇ is a question, and the arrows leaving it are its answers.`,table:`One row per case: what happens, how it behaved before this change, and how it behaves now.`,interface:`One row per thing other code or people use: a command, flag, function, setting or stored field. — means it did not exist before, or is gone now.`,example:`One concrete run. The first line is what you do or what happens; each line after → is what you would see.`,pseudo:`What the code does now, in order, one step per line; each step starts with the symbol of what it is.`};function Fm({id:e,label:t,children:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=r||a,c=`${e}-details`,l=(0,_.useRef)(null),u=(0,_.useRef)(null),[d,f]=(0,_.useState)(void 0);return(0,_.useLayoutEffect)(()=>{s?l.current!==null&&u.current!==null&&f(Rm(l.current.getBoundingClientRect(),u.current.offsetHeight,window.innerWidth,window.innerHeight)):f(void 0)},[s]),(0,R.jsxs)(`span`,{className:`settings-why-wrap`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[(0,R.jsx)(`span`,{ref:l,className:`settings-why`,tabIndex:0,role:`img`,"aria-label":t,"aria-describedby":s?c:void 0,onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:e=>{e.key===`Escape`&&s&&(e.stopPropagation(),i(!1),o(!1))},children:`?`}),s?(0,R.jsx)(`span`,{ref:u,className:`settings-details`,id:c,role:`tooltip`,style:d??Im,children:n}):null]})}var Im={position:`fixed`,left:0,top:0,visibility:`hidden`},Lm=8;function Rm(e,t,n,r){let i=Math.max(Lm,Math.min(e.left-Lm,n-Lm-360)),a=r-e.bottom-6-Lm,o=e.top-6-Lm;return t<=a||t>o&&a>=o?{position:`fixed`,left:i,top:e.bottom+6,bottom:`auto`,maxHeight:a,overflowY:`auto`}:{position:`fixed`,left:i,top:`auto`,bottom:r-e.top+6,maxHeight:o,overflowY:`auto`}}function zm(e,t){return e===`light`||e===`dark`?e:t?`dark`:`light`}var Bm=[{token:`--chip-bg`,variables:[`primaryColor`,`mainBkg`,`actorBkg`],fallback:`Canvas`},{token:`--text`,variables:[`primaryTextColor`,`textColor`,`actorTextColor`,`signalTextColor`,`labelTextColor`,`loopTextColor`,`noteTextColor`],fallback:`CanvasText`},{token:`--chip-line`,variables:[`primaryBorderColor`,`nodeBorder`,`actorBorder`,`labelBoxBorderColor`,`noteBorderColor`,`activationBorderColor`],fallback:`GrayText`},{token:`--muted`,variables:[`lineColor`,`signalColor`],fallback:`GrayText`},{token:`--line`,variables:[`actorLineColor`,`clusterBorder`],fallback:`GrayText`},{token:`--raised`,variables:[`edgeLabelBackground`,`labelBoxBkgColor`,`activationBkgColor`,`secondaryColor`],fallback:`Canvas`},{token:`--raised-2`,variables:[`tertiaryColor`,`clusterBkg`],fallback:`Canvas`},{token:`--kind-bg`,variables:[`noteBkgColor`],fallback:`Canvas`}];function Vm(e){let t={fontFamily:`inherit`};for(let n of Bm){let r=e(n.token)?.trim(),i=r===void 0||r===``?n.fallback:r;for(let e of n.variables)t[e]=i}return t}var Hm=.5,Um=.25,Wm=(e,t,n)=>Math.min(n,Math.max(t,e));function Gm(e,t,n=Hm){if(t.width<=0||t.height<=0||e.width<=0||e.height<=0)return 1;let r=Math.min(1,e.width/t.width,e.height/t.height);return Math.max(n,r)}function Km(e,t,n){let r=n,i=e-t-n;return[Math.min(r,i),Math.max(r,i)]}function qm(e,t,n,r=8){let[i,a]=Km(t.width,n.width*e.scale,r),[o,s]=Km(t.height,n.height*e.scale,r);return{scale:e.scale,x:Wm(e.x,i,a),y:Wm(e.y,o,s)}}function Jm(e,t,n){return t+2*n<=e?(e-t)/2:n}function Ym(e,t,n=8){let r=Gm(e,t);return qm({scale:r,x:Jm(e.width,t.width*r,n),y:Jm(e.height,t.height*r,n)},e,t,n)}function Xm(e,t,n,r,i={min:Um,max:3}){let a=Wm(e.scale*t,i.min,i.max),o=a/e.scale;return{scale:a,x:n-(n-e.x)*o,y:r-(r-e.y)*o}}var Zm=`cogit-theme`,Qm=[`system`,`light`,`dark`];function $m(e){return Qm[(Qm.indexOf(e)+1)%Qm.length]}function eh(e){return e===`system`?`same as your system`:e===`light`?`light`:`dark`}function th(e){try{let t=e?.getItem(Zm);return t===`light`||t===`dark`?t:`system`}catch{return`system`}}function nh(e,t){try{t===`system`?e?.removeItem(Zm):e?.setItem(Zm,t)}catch{}}function rh(e,t){t===`system`?delete e.dataset.theme:e.dataset.theme=t}function ih(){try{return typeof window>`u`?void 0:window.localStorage}catch{return}}var ah=th(ih()),oh=new Set;function sh(){return ah}function ch(e){ah=e,nh(ih(),e),typeof document<`u`&&rh(document.documentElement,e);for(let e of oh)e()}function lh(e){return oh.add(e),()=>oh.delete(e)}function uh(){typeof document<`u`&&rh(document.documentElement,ah)}var dh=`assets/mermaid.js`,fh;function ph(e=typeof window>`u`?`file:`:window.location.protocol){return e===`http:`||e===`https:`}function mh(){return fh??=new Promise((e,t)=>{let n=document.createElement(`script`);n.src=dh,n.onload=()=>{let n=window.mermaid;n===void 0?t(Error(`mermaid did not load`)):e(n)},n.onerror=()=>{fh=void 0,t(Error(`mermaid did not load`))},document.head.append(n)}),fh}function hh(e){if(typeof document>`u`)return;let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return t===``?void 0:t}function gh(){if(typeof document>`u`)return`dark`;let e=document.documentElement.dataset.theme;return zm(e===`light`||e===`dark`?e:sh(),typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches)}var _h=0;function vh(e){let t=e.style.maxWidth;t!==``&&(e.style.width=t,e.style.maxWidth=`none`)}var yh=40,bh=1.25;function xh({source:e,className:t,fit:n=!1,interactive:r=!1,available:i=ph()}){let a=(0,_.useRef)(null),o=(0,_.useRef)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(gh),[d,f]=(0,_.useState)({x:0,y:0,scale:1}),[p,m]=(0,_.useState)(!1),h=(0,_.useRef)(null),g=(0,_.useCallback)(()=>o.current===null||a.current===null?null:{box:{width:o.current.clientWidth,height:o.current.clientHeight},content:{width:a.current.offsetWidth,height:a.current.offsetHeight}},[]),v=(0,_.useCallback)(()=>{let e=g();e!==null&&f(Ym(e.box,e.content))},[g]),y=(0,_.useCallback)(e=>{f(t=>{let n=g(),r=e(t);return n===null?r:qm(r,n.box,n.content)})},[g]);(0,_.useEffect)(()=>{let e=()=>u(gh());e();let t=lh(e),n=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-color-scheme: dark)`):void 0;return n?.addEventListener(`change`,e),()=>{t(),n?.removeEventListener(`change`,e)}},[]),(0,_.useEffect)(()=>{if(!i)return;let t=!1;c(!1);let o=`cogit-shape-${_h+=1}`;return mh().then(t=>(t.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`base`,themeVariables:Vm(hh)}),t.render(o,e))).then(({svg:e})=>{if(t||a.current===null)return;a.current.innerHTML=e;let i=a.current.querySelector(`svg`);!n&&i!==null&&vh(i),r&&v()}).catch(()=>{t||c(!0)}),()=>{t=!0}},[e,i,n,r,v,l]),(0,_.useEffect)(()=>{let e=o.current;if(!r||e===null)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=Math.exp(-t.deltaY*.0015);y(e=>Xm(e,r,t.clientX-n.left,t.clientY-n.top))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[r,y]),(0,_.useEffect)(()=>{if(!r)return;let e=()=>y(e=>e);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[r,y]);let b=e=>{let t=g();t!==null&&y(n=>Xm(n,e,t.box.width/2,t.box.height/2))},x=e=>{e.button===0&&(e.currentTarget.setPointerCapture(e.pointerId),h.current={id:e.pointerId,x:e.clientX,y:e.clientY},m(!0))},S=e=>{let t=h.current;if(t===null||t.id!==e.pointerId)return;let n=e.clientX-t.x,r=e.clientY-t.y;h.current={id:t.id,x:e.clientX,y:e.clientY},y(e=>({...e,x:e.x+n,y:e.y+r}))},C=e=>{h.current?.id===e.pointerId&&(h.current=null,m(!1))},w=e=>{let t={ArrowLeft:[yh,0],ArrowRight:[-40,0],ArrowUp:[0,yh],ArrowDown:[0,-40]}[e.key];t!==void 0&&(e.preventDefault(),y(e=>({...e,x:e.x+t[0],y:e.y+t[1]})))},T=t?` ${t}`:``;return i?s?(0,R.jsx)(`pre`,{className:`shape-source${T}`,children:e}):r?(0,R.jsxs)(`div`,{className:`shape-diagram shape-diagram-interactive${T}`,children:[(0,R.jsx)(`div`,{ref:o,className:`shape-viewport${p?` is-dragging`:``}`,tabIndex:0,"aria-label":`Diagram: drag or use the arrow keys to move, the wheel to zoom`,onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onDoubleClick:v,onKeyDown:w,children:(0,R.jsx)(`div`,{ref:a,className:`shape-pan-content`,style:{transform:`translate(${d.x}px, ${d.y}px) scale(${d.scale})`}})}),(0,R.jsxs)(`div`,{className:`shape-zoom-controls`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,onClick:()=>b(1/bh),children:`−`}),(0,R.jsx)(`button`,{type:`button`,"aria-label":`Fit the diagram`,onClick:v,children:`Fit`}),(0,R.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,onClick:()=>b(bh),children:`+`})]})]}):(0,R.jsx)(`div`,{ref:a,className:`shape-diagram${T}`}):(0,R.jsxs)(`div`,{className:`shape-offline${T}`,children:[(0,R.jsx)(`pre`,{className:`shape-source`,children:e}),(0,R.jsxs)(`p`,{className:`shape-note`,children:[`The diagram is drawn when the map is opened with `,(0,R.jsx)(`code`,{children:`cogit open`}),`.`]})]})}var Sh=[{id:`intent`,number:`1`,label:`Intent`},{id:`shape`,number:`2`,label:`Shape`},{id:`code`,number:`3`,label:`Code`}],Ch={user:`You`,agent:`The agent, on its own`,agreed:`You, approving the agent's proposal`};function wh({node:e}){return!e.why&&!e.alternatives?.length&&!e.agentDecisions?.length&&!e.work?.length&&!e.decidedBy?(0,R.jsx)(`p`,{className:`muted`,children:`No reason was recorded for this message.`}):(0,R.jsxs)(`div`,{className:`shape-intent`,children:[e.why?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h4`,{children:`Why`}),(0,R.jsx)(`p`,{children:e.why})]}):null,e.alternatives?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h4`,{children:`Considered and rejected`}),(0,R.jsx)(`ul`,{children:e.alternatives.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`strong`,{children:e.option}),e.why?(0,R.jsxs)(R.Fragment,{children:[` — `,e.why]}):null]},e.option))})]}):null,e.agentDecisions?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h4`,{children:`Decided by the agent on its own`}),(0,R.jsx)(`ul`,{children:e.agentDecisions.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`strong`,{children:e.title}),e.why?(0,R.jsxs)(R.Fragment,{children:[` — `,e.why]}):null]},e.title))})]}):null,e.work?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h4`,{children:`What the agent did`}),(0,R.jsx)(`ul`,{children:e.work.map(e=>(0,R.jsx)(`li`,{children:e},e))})]}):null,e.decidedBy?(0,R.jsxs)(`p`,{className:`decided-by`,children:[`Decided by: `,Ch[e.decidedBy]]}):null]})}var Th={pseudo:`Steps`,example:`Example`,flow:`Flow source (not drawn)`,mermaid:`Flowchart source (not drawn)`,sequence:`Sequence source (not drawn)`,table:`Before / After (as written)`,interface:`Interface (as written)`};function Eh({id:e,label:t,reading:n}){let r=Pm[n];return r?(0,R.jsxs)(`figcaption`,{className:`shape-caption`,children:[(0,R.jsx)(`span`,{children:t}),(0,R.jsx)(Fm,{id:`shape-${e}`,label:`How to read the ${t}`,children:(0,R.jsx)(`span`,{className:`shape-reading`,children:r})})]}):(0,R.jsx)(`figcaption`,{className:`shape-caption`,children:(0,R.jsx)(`span`,{children:t})})}var Dh=new Set([`flow`,`mermaid`,`sequence`]);function Oh(e){return e===`sequence`?`Sequence`:e===`flow`?`Flow`:`Flowchart`}var kh={table:[`Case`,`Before`,`After`],interface:[`Item`,`Before`,`After`]};function Ah({columns:e,rows:t}){return(0,R.jsxs)(`table`,{className:`shape-table`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsx)(`tr`,{children:e.map(e=>(0,R.jsx)(`th`,{scope:`col`,children:e},e))})}),(0,R.jsx)(`tbody`,{children:t.map(([e,t,n],r)=>(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{scope:`row`,children:e}),(0,R.jsx)(`td`,{children:t}),(0,R.jsx)(`td`,{children:n})]},`${r}-${e}`))})]})}function jh({node:e,enabled:t,renderMermaid:n}){let r=Sm(e.shape,t);if(r===`off`)return(0,R.jsx)(`p`,{className:`muted`,children:`Shapes are off. Turn them on in Settings → Recording.`});if(r===`queued`)return(0,R.jsx)(`p`,{className:`muted`,children:`This Shape is being prepared, or the message landed no commits.`});if(r===`empty`)return(0,R.jsx)(`p`,{className:`muted`,children:`Nothing to show: the change was too small to draw.`});let i=e.shape?.tools??[],a=Nm(i);return(0,R.jsxs)(`div`,{className:`shape-tools`,children:[a.length>0?(0,R.jsx)(`div`,{className:`shape-legend`,"aria-label":`Kinds in this Shape`,children:a.map(e=>(0,R.jsxs)(`span`,{className:`shape-kind`,children:[(0,R.jsx)(`span`,{className:`shape-kind-symbol`,children:e.symbol}),e.name]},e.id))}):null,i.map((e,t)=>{let r=`${e.kind}-${t}`,i=e.kind===`flow`?Mm(e.text):e.text,a=e.kind===`flow`&&Om(e.text)?.ordered===!0;if(Dh.has(e.kind)&&e.valid!==!1&&i!==void 0)return(0,R.jsxs)(`figure`,{className:`shape-figure`,children:[n(i),(0,R.jsx)(Eh,{id:r,label:a?`Sequence`:Oh(e.kind),reading:a?`sequence`:e.kind})]},r);let o=kh[e.kind],s=o&&e.valid!==!1?wm(e.text):void 0;return o&&s!==void 0?(0,R.jsxs)(`figure`,{className:`shape-figure`,children:[(0,R.jsx)(Ah,{columns:o,rows:s}),(0,R.jsx)(Eh,{id:r,label:e.kind===`interface`?`Interface`:`Before / After`,reading:e.kind})]},r):(0,R.jsxs)(`figure`,{className:`shape-figure`,children:[(0,R.jsx)(`pre`,{className:`shape-source is-${e.kind}`,children:e.text}),(0,R.jsx)(Eh,{id:r,label:Th[e.kind]??e.kind,reading:e.kind})]},r)}),e.shape?.by?(0,R.jsxs)(`p`,{className:`shape-by`,children:[`Written by `,e.shape.by===`side`?`the side model`:`the agent`,`.`]}):null]})}async function Mh(e){let t=pe();if(t===null)throw Error("Open the map with `cogit open` to regenerate a Shape.");let n=await fetch(`/api/shape/regenerate`,{method:`POST`,headers:{"content-type":`application/json`,[S]:t},body:JSON.stringify(e)});if(n.ok)return;let r=(await n.text()).trim();throw Error(r===``?`the Shape was not written (${n.status})`:r)}function Nh({request:e}){let[t,n]=(0,_.useState)(`idle`),[r,i]=(0,_.useState)(``),a=async()=>{n(`running`),i(``);try{await Mh(e),n(`done`)}catch(e){n(`error`),i(e instanceof Error?e.message:String(e))}};return(0,R.jsxs)(`div`,{className:`shape-regenerate`,children:[(0,R.jsx)(`button`,{type:`button`,className:`shape-regenerate-button`,title:`Ask the side model to write this Shape again`,onClick:()=>void a(),disabled:t===`running`,children:t===`running`?`Regenerating…`:`Regenerate`}),t===`done`?(0,R.jsx)(`span`,{className:`muted`,children:`Written again.`}):null,t===`error`?(0,R.jsx)(`span`,{className:`shape-regenerate-error`,children:r}):null]})}function Ph({node:e,root:t}){let n=typeof document<`u`&&fe(),r=e.commits??[];return r.length===0?(0,R.jsx)(`p`,{className:`muted`,children:`No commit is linked to this message.`}):(0,R.jsxs)(`div`,{className:`shape-code`,children:[r.map(r=>(0,R.jsxs)(`section`,{children:[(0,R.jsxs)(`h4`,{children:[(0,R.jsx)(`code`,{children:r.slice(0,7)}),` `,e.commitTags?.find(e=>e.hash===r)?.subject??``]}),n?(0,R.jsx)(hm,{dir:t,commit:r}):null]},r)),n?null:(0,R.jsx)(`p`,{className:`muted`,children:"Open with `cogit open` to see the diffs."})]})}function Fh({node:e,root:t,tab:n,enabled:r,onTab:i,regenerate:a,renderMermaid:o=e=>(0,R.jsx)(xh,{source:e,interactive:!0})}){return(0,R.jsxs)(`div`,{className:`shape-layers`,children:[(0,R.jsx)(`div`,{className:`shape-tabs`,role:`tablist`,"aria-label":`Intent, Shape and Code`,children:Sh.map(e=>(0,R.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n===e.id,className:n===e.id?`shape-tab is-active`:`shape-tab`,onClick:()=>i(e.id),children:[(0,R.jsx)(`span`,{className:`shape-tab-no`,children:e.number}),` `,e.label]},e.id))}),(0,R.jsxs)(`div`,{className:`shape-layer`,role:`tabpanel`,"aria-label":Sh.find(e=>e.id===n)?.label,children:[n===`intent`?(0,R.jsx)(wh,{node:e}):null,n===`shape`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(jh,{node:e,enabled:r,renderMermaid:o}),a===void 0?null:(0,R.jsx)(Nh,{request:a})]}):null,n===`code`?(0,R.jsx)(Ph,{node:e,root:t}):null]})]})}function Ih({node:e,root:t,enabled:n,regenerate:r,onClose:i}){let[a,o]=(0,_.useState)(`shape`),s=(0,_.useRef)(null);return(0,_.useEffect)(()=>{s.current?.focus();let e=e=>{e.key===`Escape`?(e.stopPropagation(),i()):e.key===`1`?o(`intent`):e.key===`2`?o(`shape`):e.key===`3`&&o(`code`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,R.jsx)(`div`,{className:`shape-overlay`,onClick:i,children:(0,R.jsxs)(`div`,{ref:s,className:`shape-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`${e.title} — Intent, Shape and Code`,tabIndex:-1,onClick:e=>e.stopPropagation(),children:[(0,R.jsxs)(`header`,{className:`shape-head`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`kind`,children:`message`}),(0,R.jsx)(`h2`,{children:e.title})]}),(0,R.jsx)(`button`,{type:`button`,className:`drilldown-close`,"aria-label":`Close`,onClick:i,children:`×`})]}),(0,R.jsx)(Fh,{node:e,root:t,tab:a,enabled:n,onTab:o,regenerate:r})]})})}function Lh({node:e,root:t,enabled:n}){let[r,i]=(0,_.useState)(!1),a=Sm(e.shape,n),o=Cm(e.shape),s=typeof document<`u`&&fe(),c=n&&s&&e.sessionId!==void 0&&e.nodeId!==void 0?{dir:t,sessionId:e.sessionId,nodeId:e.nodeId}:void 0,l=e.shape?.tools.find(e=>Dh.has(e.kind)&&e.valid!==!1),u=l===void 0?void 0:l.kind===`flow`?Mm(l.text):l.text;return(0,R.jsxs)(`section`,{className:`shape-section`,children:[(0,R.jsx)(`h3`,{children:`Intent, Shape and Code`}),a===`ready`?(0,R.jsxs)(R.Fragment,{children:[u===void 0?null:(0,R.jsx)(xh,{source:u,className:`shape-preview-diagram`,fit:!0}),o===void 0?null:(0,R.jsx)(`pre`,{className:`shape-preview`,children:o})]}):a===`off`?(0,R.jsx)(`p`,{className:`muted`,children:`Shapes are off.`}):a===`empty`?(0,R.jsx)(`p`,{className:`muted`,children:`Nothing to show for this change.`}):(0,R.jsx)(`p`,{className:`muted`,children:`Shape is being prepared.`}),(0,R.jsx)(`button`,{type:`button`,className:`shape-open`,onClick:()=>i(!0),children:`Open`}),r?(0,R.jsx)(Ih,{node:e,root:t,enabled:n,regenerate:c,onClose:()=>i(!1)}):null]})}function Rh(e,t){return e.sessions.find(e=>e.sessionId===t)}function zh(e,t){return e.messages.find(e=>e.id===t)}function Bh({value:e}){let[t,n]=(0,_.useState)(`idle`),r=(0,_.useRef)(null),i=`Ask your agent: cogit show ${e}`;return(0,R.jsxs)(`div`,{className:`message-hash`,title:i,children:[(0,R.jsx)(`code`,{ref:r,children:sp(e)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{n(`idle`),tm(e).then(e=>{if(e){n(`copied`);return}let t=r.current;if(t){let e=document.createRange();e.selectNodeContents(t);let n=window.getSelection();n?.removeAllRanges(),n?.addRange(e)}n(`failed`)})},children:`Copy hash`}),t===`copied`?(0,R.jsx)(`span`,{className:`muted`,children:`Copied.`}):null,t===`failed`?(0,R.jsx)(`span`,{className:`muted`,children:`Copy failed — press Ctrl+C to copy.`}):null]})}function Vh({model:e,session:t}){return(0,R.jsx)(`div`,{className:`resume`,children:(0,R.jsx)(xm,{projectPath:e.project.path,sessionId:t.sessionId,available:t.transcriptAvailable})})}function Hh({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`drilldown-field`,children:[(0,R.jsx)(`dt`,{children:e}),(0,R.jsx)(`dd`,{children:t})]})}var Uh={suggested:`Suggested`,open:`Open`,done:`Done`,dismissed:`Dismissed`};function Wh({items:e,reveal:t=0}){let n=(0,_.useRef)(null),r=e.filter(e=>e.state!==`dismissed`).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt));if((0,_.useEffect)(()=>{t!==0&&n.current?.scrollIntoView({block:`nearest`})},[t]),r.length===0)return null;let i=new Date().toISOString();return(0,R.jsxs)(`section`,{className:`captured-work`,ref:n,children:[(0,R.jsxs)(`h3`,{children:[`Tasks `,(0,R.jsx)(`span`,{className:`count`,children:r.length})]}),(0,R.jsx)(`ul`,{className:`drilldown-list capture-here-list`,children:r.map(e=>{let t=Hf(e.updatedAt,i);return(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`span`,{className:`capture-state is-${e.state}`,children:Uh[e.state]}),` `,e.text,t===``?null:(0,R.jsxs)(`span`,{className:`muted`,children:[` · `,t,` ago`]})]},e.id)})})]})}function Gh({session:e}){let{worktree:t}=e;return t?(0,R.jsxs)(Hh,{label:`Worktree`,children:[t.branch??`detached HEAD`,` `,(0,R.jsx)(`code`,{children:t.path})]}):null}function Kh({model:e,session:t}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`dl`,{className:`drilldown-meta`,children:[(0,R.jsx)(Hh,{label:`Agent`,children:t.agent}),t.author?(0,R.jsxs)(Hh,{label:`Recorded by`,children:[t.author,Gp(e).mine(t)?` (you)`:``]}):null,(0,R.jsx)(Hh,{label:`Session`,children:(0,R.jsx)(`code`,{children:t.sessionId})}),(0,R.jsx)(Hh,{label:`Started`,children:Wf(t.startedAt)}),(0,R.jsx)(Hh,{label:`Updated`,children:Wf(t.updatedAt)}),(0,R.jsx)(Gh,{session:t}),t.unrecordedMessages?(0,R.jsxs)(Hh,{label:`Not recorded`,children:[t.unrecordedMessages,` message`,t.unrecordedMessages===1?``:`s`,` not recorded (the side model at session end is off)`]}):null]}),(0,R.jsx)(Vh,{model:e,session:t})]})}var qh={user:`You`,agent:`The agent, on its own`,agreed:`You, approving the agent's proposal`},Jh=1200;function Yh({text:e}){let[t,n]=(0,_.useState)(!1);return e.length<=Jh||t?(0,R.jsx)(`p`,{className:`chat-text`,children:e}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`chat-text`,children:[e.slice(0,Jh),`…`]}),(0,R.jsxs)(`button`,{type:`button`,className:`chat-more`,onClick:()=>n(!0),children:[`Show all (`,e.length.toLocaleString(),` characters)`]})]})}function Xh(e){let t=[];e.commands>0&&t.push(`ran ${e.commands} command${e.commands===1?``:`s`}`);let n=e.files.length;return n>0&&t.push(`edited ${n} file${n===1?``:`s`}`),e.other>0&&t.push(`${e.other} other tool call${e.other===1?``:`s`}`),t.join(`, `)}function Zh({session:e,id:t}){if(!e)return null;let n=e.chat?.find(e=>e.id===t),r;if(n){let e=Xh(n.tools);r=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`chat-entry chat-user`,children:[(0,R.jsxs)(`div`,{className:`chat-who`,children:[`You · `,Wf(n.at)]}),(0,R.jsx)(Yh,{text:n.text})]}),(0,R.jsxs)(`div`,{className:`chat-entry chat-agent`,children:[(0,R.jsx)(`div`,{className:`chat-who`,children:`Agent`}),n.replies.length===0?(0,R.jsx)(`p`,{className:`muted`,children:`No written reply.`}):n.replies.map((e,t)=>(0,R.jsx)(Yh,{text:e},`${n.id}-${t}`)),e?(0,R.jsx)(`p`,{className:`chat-tools`,title:n.tools.files.join(`-`),children:e}):null]})]})}else r=e.transcriptAvailable?(0,R.jsx)(`p`,{className:`muted`,children:`This message was not found in the transcript.`}):(0,R.jsx)(`p`,{className:`muted`,children:`This conversation is not on this machine. The summary above is what remains.`});return(0,R.jsxs)(`details`,{className:`chat fold`,children:[(0,R.jsx)(`summary`,{children:`Conversation`}),r]})}function Qh(e,t){return Mp(e.messages).segments.find(e=>e.ids.includes(t))?.id}function $h({session:e,branchId:t}){if(!t)return null;let n=Mp(e.messages).segments.find(e=>e.id===t);if(!n)return null;let{branch:r}=n,i=r.firstAt&&r.lastAt&&r.firstAt!==r.lastAt?` · ${Wf(r.firstAt)} → ${Wf(r.lastAt)}`:``;return(0,R.jsxs)(`details`,{className:`branch-detail fold`,children:[(0,R.jsxs)(`summary`,{children:[`Branch · `,(0,R.jsx)(`span`,{style:{color:`var(--l${n.colorIndex})`},children:r.title})]}),(0,R.jsxs)(`p`,{className:`branch-range`,children:[r.count>1?`${r.fromLabel}–${r.toLabel}`:r.fromLabel,` ·`,` `,r.count,` message`,r.count===1?``:`s`,i]}),r.asked?(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`b`,{children:`Asked:`}),` `,r.asked]}):null,r.outcome?(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`b`,{children:`Outcome:`}),` `,r.outcome]}):null,r.open?(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`b`,{children:`Open:`}),` `,r.open]}):null]})}function eg({session:e,node:t,onNavigate:n}){if(!e||!n||t.kind!==`message`)return null;let{previous:r,next:i}=lp(e.messages,t.nodeId),a=t=>t?()=>n({sessionId:e.sessionId,focusId:cp(ap(e.sessionId),t.id),selection:{type:`node`,sessionId:e.sessionId,nodeId:t.id}}):void 0;return(0,R.jsxs)(`nav`,{className:`message-nav`,"aria-label":`Messages`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:!r,onClick:a(r),title:r?.title,children:`← Previous message`}),(0,R.jsx)(`button`,{type:`button`,disabled:!i,onClick:a(i),title:i?.title,children:`Next message →`})]})}function tg({model:e,node:t,onNavigate:n,onOpenFileHistory:r,bigChangeLines:i}){let a=Rh(e,t.sessionId),o=typeof document<`u`&&fe()&&pe()!==null;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(eg,{session:a,node:t,onNavigate:n}),t.kind===`message`&&op(t.nodeId)?(0,R.jsx)(Bh,{value:t.nodeId}):null,t.summary?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Summary`}),(0,R.jsx)(`p`,{children:t.summary})]}):null,t.why?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Why`}),(0,R.jsx)(`p`,{children:t.why})]}):null,t.alternatives?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Considered and rejected`}),(0,R.jsx)(`ul`,{className:`drilldown-list`,children:t.alternatives.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`strong`,{children:e.option}),e.why?(0,R.jsxs)(R.Fragment,{children:[` — `,e.why]}):null]},e.option))})]}):null,t.decidedBy?(0,R.jsxs)(`p`,{className:`decided-by`,children:[`Decided by: `,qh[t.decidedBy]]}):null,t.agentDecisions?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Decided by the agent on its own`}),(0,R.jsx)(`ul`,{className:`drilldown-list`,children:t.agentDecisions.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`strong`,{children:e.title}),e.why?(0,R.jsxs)(R.Fragment,{children:[` — `,e.why]}):null,e.alternatives?.length?(0,R.jsx)(`ul`,{children:e.alternatives.map(e=>(0,R.jsxs)(`li`,{children:[`Not: `,e.option,e.why?(0,R.jsxs)(R.Fragment,{children:[` — `,e.why]}):null]},e.option))}):null]},e.title))})]}):null,t.work?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`What the agent did`}),(0,R.jsx)(`ul`,{className:`drilldown-list`,children:t.work.map(e=>(0,R.jsx)(`li`,{children:e},e))})]}):null,t.kind===`message`&&t.commits?.length?(0,R.jsx)(Lh,{node:t,root:e.project.path,enabled:e.settings?.shapes??!0}):null,t.kind===`message`&&t.change?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Code landed`}),(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`span`,{className:`git-change${hp(t.change,i)?` is-big`:``}`,children:_p(t.change)}),` `,`after this message.`]})]}):null,t.commits?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsxs)(`h3`,{children:[`Commits `,(0,R.jsx)(`span`,{className:`count`,children:t.commits.length})]}),(0,R.jsx)(`ul`,{className:`commit-list`,children:t.commits.map(n=>{let r=t.commitTags?.find(e=>e.hash===n),i=t.commitTags!==void 0&&r?.subject===void 0;return(0,R.jsx)(ng,{hash:n,subject:r?.subject,missing:i,root:e.project.path,expandable:!i&&(o||L(n))},n)})})]}):null,t.files?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsxs)(`h3`,{children:[`Changed files `,(0,R.jsx)(`span`,{className:`count`,children:t.files.length})]}),(0,R.jsx)(`ul`,{className:`file-list`,children:t.files.map(n=>{let i=[...t.commitTags??[]].reverse().find(e=>e.files?.includes(n));return(0,R.jsx)(rg,{file:n,root:e.project.path,commit:i?.hash,expandable:i!==void 0&&(o||L(i.hash,n)),onHistory:r},n)})})]}):null,!o&&(t.commits?.length||t.files?.length)&&!(t.commits??[]).some(e=>L(e))?(0,R.jsx)(`p`,{className:`muted`,children:"Open with `cogit open` to see diffs."}):null,t.kind===`message`?(0,R.jsx)(Zh,{session:a,id:t.nodeId}):null,a?(0,R.jsx)($h,{session:a,branchId:Qh(a,t.nodeId)}):null,(0,R.jsxs)(`dl`,{className:`drilldown-meta`,children:[(0,R.jsx)(Hh,{label:t.kind===`message`?`Sent`:`Recorded`,children:Wf(t.at??t.addedAt??null)}),t.touchedAt&&t.touchedAt!==t.addedAt?(0,R.jsx)(Hh,{label:`Last changed`,children:Wf(t.touchedAt)}):null,(0,R.jsx)(Hh,{label:`Session`,children:a?(0,R.jsxs)(R.Fragment,{children:[a.title||a.sessionId,` `,(0,R.jsx)(`code`,{children:a.sessionId})]}):(0,R.jsx)(`code`,{children:t.sessionId})}),a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Hh,{label:`Session started`,children:Wf(a.startedAt)}),(0,R.jsx)(Hh,{label:`Session updated`,children:Wf(a.updatedAt)}),(0,R.jsx)(Gh,{session:a})]}):null]}),a?(0,R.jsx)(Vh,{model:e,session:a}):null]})}function ng({hash:e,subject:t,missing:n,root:r,expandable:i}){let[a,o]=(0,_.useState)(!1),s=t===void 0?void 0:rm(t),c=s?.type===void 0?void 0:am(s.type),l=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`code`,{className:`commit-hash`,children:e.slice(0,7)}),s?.type?(0,R.jsxs)(`span`,{className:`commit-type`,style:c===void 0?void 0:{background:`var(--l${c})`},children:[s.type,s.breaking?`!`:``]}):null,s?.scope?(0,R.jsx)(`span`,{className:`commit-scope`,children:s.scope}):null,(0,R.jsx)(`span`,{className:`commit-subject`,children:s?s.text:`not in this repository`}),i?(0,R.jsx)(`span`,{className:`diff-caret`,children:a?`−`:`+`}):null]});return(0,R.jsxs)(`li`,{className:n?`commit-item is-missing`:`commit-item`,title:e,children:[i?(0,R.jsx)(`button`,{type:`button`,className:`commit-row`,"aria-expanded":a,onClick:()=>o(e=>!e),children:l}):(0,R.jsx)(`div`,{className:`commit-row`,children:l}),a?(0,R.jsx)(hm,{dir:r,commit:e}):null]})}function rg({file:e,root:t,commit:n,expandable:r,onHistory:i}){let[a,o]=(0,_.useState)(!1),{dir:s,name:c}=om(e),l=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`file-name`,children:c}),s?(0,R.jsx)(`span`,{className:`file-dir`,children:s}):null,r?(0,R.jsx)(`span`,{className:`diff-caret`,children:a?`−`:`+`}):null]});return(0,R.jsxs)(`li`,{title:e,children:[(0,R.jsxs)(`div`,{className:`file-item`,children:[r&&n!==void 0?(0,R.jsx)(`button`,{type:`button`,className:`file-row`,"aria-expanded":a,onClick:()=>o(e=>!e),children:l}):(0,R.jsx)(`div`,{className:`file-row`,children:l}),i===void 0?null:(0,R.jsx)(`button`,{type:`button`,className:`file-history`,title:`Every message that touched ${e}`,onClick:()=>i(e),children:`history`})]}),a&&n!==void 0?(0,R.jsx)(hm,{dir:t,commit:n,file:e}):null]})}function ig({model:e,session:t,captureReveal:n=0}){let{done:r,pending:i}=t.status;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Goal`}),(0,R.jsx)(`p`,{children:t.status.goal||`No goal recorded.`})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Done`}),r.length>0?(0,R.jsx)(`ul`,{className:`drilldown-list`,children:r.map((e,t)=>(0,R.jsx)(`li`,{children:e},`${t}-${e}`))}):(0,R.jsx)(`p`,{className:`muted`,children:`Nothing yet.`})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Pending`}),i.length>0?(0,R.jsx)(`ul`,{className:`drilldown-list`,children:i.map((e,t)=>(0,R.jsxs)(`li`,{className:e.needsUser?`needs-user`:void 0,children:[e.text,e.needsUser?(0,R.jsx)(`span`,{className:`badge`,children:`needs you`}):null]},`${t}-${e.text}`))}):(0,R.jsx)(`p`,{className:`muted`,children:`Nothing pending.`})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Next`}),(0,R.jsx)(`p`,{children:t.status.next||`No next step recorded.`})]}),(0,R.jsx)(Wh,{items:(e.captures??[]).filter(e=>e.source.sessionId===t.sessionId),reveal:n}),(0,R.jsx)(Kh,{model:e,session:t})]})}function ag({model:e,selection:t,captureReveal:n=0,onClose:r,onNavigate:i,onOpenFileHistory:a,bigChangeLines:o=300}){if((0,_.useEffect)(()=>{if(!t)return;let e=e=>{if(e.key===`Escape`){if(document.querySelector(`.shape-overlay`)!==null)return;r()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,r]),!t)return null;if(t.type===`session`){let i=Rh(e,t.sessionId);return i?(0,R.jsxs)(`aside`,{className:`drilldown`,role:`dialog`,"aria-label":`Session details`,children:[(0,R.jsxs)(`header`,{className:`drilldown-head`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`kind`,children:`session`}),(0,R.jsx)(`h2`,{children:i.title||i.sessionId})]}),(0,R.jsx)(`button`,{type:`button`,className:`drilldown-close`,"aria-label":`Close`,onClick:r,children:`×`})]}),(0,R.jsx)(`div`,{className:`drilldown-body`,children:(0,R.jsx)(ig,{model:e,session:i,captureReveal:n})})]}):null}let s=Rh(e,t.sessionId),c=s?zh(s,t.nodeId):void 0;if(!s||!c)return null;let l=tp(c,s.sessionId);return(0,R.jsxs)(`aside`,{className:`drilldown`,role:`dialog`,"aria-label":`Message details`,children:[(0,R.jsxs)(`header`,{className:`drilldown-head`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`kind kind-${l.kind}`,children:Yf(l.kind)}),(0,R.jsx)(`h2`,{children:l.title})]}),(0,R.jsx)(`button`,{type:`button`,className:`drilldown-close`,"aria-label":`Close`,onClick:r,children:`×`})]}),(0,R.jsx)(`div`,{className:`drilldown-body`,children:(0,R.jsx)(tg,{model:e,node:l,onNavigate:i,onOpenFileHistory:a,bigChangeLines:o})})]})}var og=`.react-flow, .settings-overlay, .switcher-overlay, .drilldown, .outline, .files-view`,sg=`.react-flow__renderer`;function cg(e){let t=e;return t===null||typeof t.closest!=`function`||t.closest(og)===null}function lg(e,t){e.preventDefault(),t.dispatchEvent(new WheelEvent(`wheel`,{bubbles:!0,cancelable:!0,composed:!0,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,clientX:e.clientX,clientY:e.clientY}))}function ug(e){if(!cg(e.target))return;let t=document.querySelector(sg);t&&lg(e,t)}function dg(){(0,_.useEffect)(()=>(window.addEventListener(`wheel`,ug,{passive:!1}),()=>window.removeEventListener(`wheel`,ug)),[])}function fg(e,t){let n=new Set(t),r=new Set(e.open),i=new Set;for(let t of e.bySearch)n.has(t)?i.add(t):r.delete(t);for(let e of n)r.has(e)||(r.add(e),i.add(e));return{open:r,bySearch:i}}function pg(e){return[...e.open].filter(t=>!e.bySearch.has(t))}function mg(e){if(!e)return-1/0;let t=Date.parse(e);return Number.isNaN(t)?-1/0:t}function hg(e){let t,n=-1/0;for(let r of e.messages){if(r.at===void 0)continue;let e=mg(r.at);e>n&&(n=e,t=r.at)}return t??e.updatedAt}function gg(e,t){let n=e.messages[0]?.continues?.sessionId;return n===void 0||n===e.sessionId?null:t.has(n)?n:null}function _g(e){return e.sessions.sort((e,t)=>mg(e.startedAt)-mg(t.startedAt)||e.sessionId.localeCompare(t.sessionId))}function vg(e,t){let n=_g(e),r=new Map(n.map(e=>[e.sessionId,e])),i=new Set(r.keys()),a=new Map,o=n.map(e=>{let t=gg(e,i);return a.set(e.sessionId,t),{id:e.sessionId,title:e.title||e.sessionId,at:e.startedAt,until:hg(e),parent:t}}),s=n.map(e=>mg(e.startedAt));return{git:Mp(o,{fold:!1,rowWidth:720,headId:ip(e)?.sessionId??null,itemEnd:e=>{let t=mg(e.until);if(t===-1/0)return null;let n=0;for(let e=0;e<s.length;e+=1)(s[e]??-1/0)<=t&&(n=e+1);return n},...t===void 0?{}:{spaceAfter:t}}),sessions:r,parents:a}}function yg(e,t,n){let r=new Set(_g(e).map(e=>e.sessionId)),i=new Set;if(Array.isArray(t))for(let e of t)typeof e==`string`&&r.has(e)&&i.add(e);return n!==null&&i.add(n.sessionId),i}function bg(){return(0,_.useSyncExternalStore)(lh,sh,sh)}var xg={width:20,height:20,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0};function Sg({mode:e}){return e===`light`?(0,R.jsxs)(`svg`,{...xg,children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,R.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}):e===`dark`?(0,R.jsx)(`svg`,{...xg,children:(0,R.jsx)(`path`,{d:`M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z`})}):(0,R.jsxs)(`svg`,{...xg,children:[(0,R.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,R.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function Cg(){let e=bg(),t=$m(e),n=`Theme: ${eh(e)}. Click for ${eh(t)}.`;return(0,R.jsx)(`button`,{type:`button`,className:`theme-button`,title:n,"aria-label":n,onClick:()=>ch(t),children:(0,R.jsx)(Sg,{mode:e})})}var wg=6,Tg=20,Eg=36,Dg=(0,_.createContext)({selection:null,openIds:new Set,bigChangeLines:300,openSession:()=>{},openSessionCard:()=>{},openNode:()=>{},openContinue:()=>{},unfold:()=>{},resizeRows:()=>{},storeRowWidth:()=>{},person:null,people:Gp({sessions:[]})});function Og({session:e,git:t,highlights:n,activeHitId:r}){let{selection:i,bigChangeLines:a,openNode:o,unfold:s,resizeRows:c,storeRowWidth:l,person:u,people:d}=(0,_.useContext)(Dg),f=i?.sessionId===e.sessionId;if(t.rows.length===0)return(0,R.jsx)(`p`,{className:`graph-status empty`,children:`No messages recorded in this session yet.`});let p=!d.matches(e,u);return(0,R.jsxs)(`div`,{className:p?`session-rows is-dimmed`:`session-rows`,children:[(0,R.jsx)(Lp,{git:t,selectedId:i?.type===`node`&&f?i.nodeId:null,highlightIds:n,activeHitId:r,bigChangeLines:a,onSelect:t=>o(e.sessionId,t.message.id),onUnfold:s}),(0,R.jsx)(Zp,{git:t,onResize:t=>c(e.sessionId,t),onDone:t=>l(e.sessionId,t)})]})}function kg({data:e}){let{openSession:t,openSessionCard:n,openNode:r,openContinue:i,selection:a,openIds:o,person:s}=(0,_.useContext)(Dg),c=(0,_.useMemo)(()=>ep(e.model.captures),[e.model.captures]);return(0,R.jsxs)(`div`,{className:`map-node`,children:[(0,R.jsx)(em,{model:e.model,graph:e.graph,selectedSessionId:a?.type===`session`?a.sessionId:null,openIds:o,highlightSessionIds:e.sessionHits,person:s,captured:c,onOpen:t,onOpenCard:n,onContinue:i}),e.openings.map(t=>{let n=e.activeHit;return(0,R.jsx)(`div`,{className:`session-open`,style:{top:t.top,left:t.left},children:(0,R.jsx)(Og,{session:t.session,git:t.git,highlights:e.highlights.get(t.session.sessionId),activeHitId:n?.sessionId===t.session.sessionId?n.messageId:null})},t.session.sessionId)})]})}var Ag={project:kg};function jg(e,t){let n=ip(e);if(n===null)return null;let r=n.messageId===null?{sessionId:n.sessionId}:{sessionId:n.sessionId,messageId:n.messageId};return t?{...r,quiet:t}:r}function Mg(e){if(typeof window>`u`)return null;let t=new URLSearchParams(window.location.hash.replace(/^#/,``));if(!t.has(`focus`)&&!t.has(`s`))return jg(e,!0);if(t.get(`focus`)===`head`){let t=ip(e);return t===null?null:t.messageId===null?{sessionId:t.sessionId}:{sessionId:t.sessionId,messageId:t.messageId}}let n=t.get(`s`);if(n===null||n===``)return null;let r=Pg(e,n);if(r===void 0)return null;let i=t.get(`m`);return i!==null&&r.messages.some(e=>e.id===i)?{sessionId:n,messageId:i}:{sessionId:n}}function Ng(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}function Pg(e,t){return e.sessions.find(e=>e.sessionId===t)}function Fg({model:e,search:t}){dg();let[n]=(0,_.useState)(()=>Mg(e));(0,_.useEffect)(()=>{n?.messageId!==void 0&&document.querySelector(`.lineage-map`)?.scrollIntoView({block:`start`})},[n]);let[r,i]=(0,_.useState)(()=>yg(e,e.openSessions,n)),[a,o]=(0,_.useState)(()=>new Set),s=(0,_.useCallback)(e=>{o(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),[c,l]=(0,_.useState)(()=>n===null||n.quiet?null:n.messageId===void 0?{type:`session`,sessionId:n.sessionId}:{type:`node`,sessionId:n.sessionId,nodeId:n.messageId}),[u,d]=(0,_.useState)(()=>new Set),[f,p]=(0,_.useState)(()=>Yp(e.rowWidths)),[m,h]=(0,_.useState)(0),g=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let t=pe();t!==null&&he(e.project.path,t).then(t=>{p(Yp(t.rowWidths));let r=yg(e,t.open,n);i(e=>Ng(e,r)?e:(h(e=>e+1),r))}).catch(()=>{}).finally(()=>{g.current=!0})},[]),(0,_.useEffect)(()=>{let t=pe();if(t===null||!g.current)return;let n=window.setTimeout(()=>{let n=pg({open:r,bySearch:a});F(e.project.path,n,t).catch(e=>{console.warn(`cogit: could not save the open sessions`,e)})},300);return()=>window.clearTimeout(n)},[r,a,e.project.path]);let v=(0,_.useCallback)((e,t)=>{p(n=>{let{[e]:r,...i}=n;return t===520?i:{...i,[e]:t}})},[]),y=(0,_.useCallback)((t,n)=>{let r=pe();r!==null&&I(e.project.path,t,n===520?null:n,r).catch(e=>{console.warn(`cogit: could not save the row width`,e)})},[e.project.path]),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!0),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),M=(0,_.useMemo)(()=>Gp(e),[e]),ee=(0,_.useMemo)(()=>M.options(),[M]),{expanded:N,toggle:te}=pp(),ne=e.settings?.bigChangeLines??300,re=Xf(e.captures,e.settings?.captures),[ie,P]=(0,_.useState)(()=>n===null?null:n.messageId===void 0?`session:${n.sessionId}`:`node:session:${n.sessionId}:${n.messageId}`),se=ip(e),ce=t.hash?.kind===`ok`?t.hash:null,le=t.hits[Math.min(t.active,t.hits.length-1)]??null,ue=(0,_.useMemo)(()=>ce===null?le===null?null:{sessionId:le.sessionId,messageId:le.messageId}:{sessionId:ce.sessionId,messageId:ce.messageId},[ce?.sessionId,ce?.messageId,le?.sessionId,le?.messageId]),de=(0,_.useMemo)(()=>oe(t.hits),[t.hits]),fe=(0,_.useMemo)(()=>new Set(t.hits.flatMap(e=>e.messageId===null?[e.sessionId]:[])),[t.hits]),me=(0,_.useMemo)(()=>ae(t.hits),[t.hits]),ge=(0,_.useRef)(r);ge.current=r;let _e=(0,_.useRef)(a);_e.current=a,(0,_.useEffect)(()=>{let e=fg({open:ge.current,bySearch:_e.current},me);Ng(e.open,ge.current)||i(e.open),Ng(e.bySearch,_e.current)||o(e.bySearch)},[me]);let ve=c?.type===`node`?c:null,ye=(0,_.useMemo)(()=>{let t=new Map;for(let n of r){let r=Pg(e,n);if(!r)continue;let i={unfolded:u,openAll:b,rowWidth:f[n]??520,headId:se?.sessionId===n?se.messageId:null},a=de.get(n);if(a!==void 0&&a.size>0){let e=Mp(r.messages,i).segments.filter(e=>e.ids.some(e=>a.has(e))).map(e=>e.id);e.length>0&&(i={...i,unfolded:new Set([...u,...e])})}let o=Mp(r.messages,i),s=ve?.sessionId===n?ve.nodeId:null;if(s!==null&&!o.rows.some(e=>e.kind===`message`&&e.message.id===s)){let e=o.segments.find(e=>e.ids.includes(s));e!==void 0&&(o=Mp(r.messages,{...i,unfolded:new Set([...u,e.id])}))}t.set(n,o)}return t},[e,r,u,b,f,de,se?.sessionId,se?.messageId,ve?.sessionId,ve?.nodeId]),be=(0,_.useMemo)(()=>{let e=new Map;for(let[t,n]of ye)e.set(t,wg+(n.rows.length===0?Eg:n.height)+Tg);return e},[ye]),L=(0,_.useMemo)(()=>vg(e,be),[e,be]),xe=(0,_.useMemo)(()=>{let e=[];for(let t of L.git.rows){if(t.kind!==`message`||t.spaceTop===void 0)continue;let n=L.sessions.get(t.message.id),r=ye.get(t.message.id);n&&r&&e.push({session:n,git:r,top:t.spaceTop+wg,left:L.git.graphWidth+8})}return e},[L,ye]),Se=(0,_.useCallback)((e,t)=>{if(t===void 0)return null;let n=xe.find(t=>t.session.sessionId===e),r=n?.git.rows.find(e=>e.kind===`message`&&e.message.id===t);return!n||!r?null:{x:n.left+n.git.graphWidth/2,y:n.top+r.y,left:n.left,right:n.left+n.git.width}},[xe]),Ce=(0,_.useCallback)(e=>{if(e.messageId!==null)return Se(e.sessionId,e.messageId);let t=L.git.rows.find(t=>t.kind===`message`&&t.message.id===e.sessionId);if(t===void 0)return null;let n=L.git.graphWidth+8,r=L.git.rowWidth;return{x:n+r/2,y:t.y,left:n,right:n+r}},[Se,L]),we=(0,_.useMemo)(()=>n===null?null:Se(n.sessionId,n.messageId),[n,Se]),[Te,Ee]=(0,_.useState)(0),[De,Oe]=(0,_.useState)(0),ke=(0,_.useMemo)(()=>jg(e,!0),[e]),Ae=(0,_.useMemo)(()=>Te===0||ke===null?null:{key:Te,point:Se(ke.sessionId,ke.messageId)},[Te,ke,Se]),je=(0,_.useMemo)(()=>ue===null?null:Ce(ue),[ue,Ce]),Me=(0,_.useMemo)(()=>t.step===0||je===null?null:{key:t.step,point:je},[t.step,je]),Ne=(0,_.useCallback)(e=>{s(e),i(t=>t.has(e)?t:new Set([...t,e]))},[s]),[Pe,Fe]=(0,_.useState)(0),Ie=(0,_.useCallback)(e=>{if(s(e),Fe(0),r.has(e)){let t=new Set(r);t.delete(e),i(t),l(t=>t?.sessionId===e?null:t)}else i(new Set([...r,e])),P(`session:${e}`)},[r,s]),Le=(0,_.useCallback)(e=>{s(e),P(`session:${e}`),l({type:`session`,sessionId:e}),Fe(e=>e+1),Ze(e),Ye(e=>e+1)},[s]),Re=(0,_.useCallback)((e,t)=>{Ne(e),Fe(0),P(`node:session:${e}:${t}`),l({type:`node`,sessionId:e,nodeId:t})},[Ne]),ze=(0,_.useCallback)((e,t)=>Re(e,t),[Re]);(0,_.useEffect)(()=>{ce!==null&&Re(ce.sessionId,ce.messageId)},[ce?.sessionId,ce?.messageId,Re]),(0,_.useEffect)(()=>{function t(){let t=Mg(e);t!==null&&(Ne(t.sessionId),t.messageId!==void 0&&Re(t.sessionId,t.messageId),document.querySelector(`.lineage-map`)?.scrollIntoView({block:`start`}))}return window.addEventListener(`hashchange`,t),()=>window.removeEventListener(`hashchange`,t)},[e,Ne,Re]);let Be=(0,_.useCallback)(e=>{d(t=>{let n=new Set(t);return n.add(e),n})},[]),Ve=(0,_.useCallback)(e=>{Fe(0),P(e.focusId),e.sessionId!==null&&Ne(e.sessionId),l(e.selection)},[Ne]),He=(0,_.useCallback)(e=>{T(!0),C(!1),k(!1),D(t=>({path:e,key:(t?.key??0)+1}))},[]),[Ue,We]=(0,_.useState)(0),Ge=(0,_.useCallback)(e=>{Re(e.sessionId,e.messageId),We(e=>e+1)},[Re]),Ke=(0,_.useMemo)(()=>ve===null?null:Se(ve.sessionId,ve.nodeId),[ve?.sessionId,ve?.nodeId,Se]),qe=(0,_.useMemo)(()=>Ue===0||Ke===null?null:{key:Ue,point:Ke},[Ue,Ke]),[Je,Ye]=(0,_.useState)(0),[Xe,Ze]=(0,_.useState)(null),Qe=(0,_.useMemo)(()=>Xe===null?null:Ce({sessionId:Xe,messageId:null}),[Xe,Ce]),$e=(0,_.useMemo)(()=>Je===0||Qe===null?null:{key:Je,point:Qe},[Je,Qe]),et=(0,_.useMemo)(()=>({selection:c,openIds:r,bigChangeLines:ne,openSession:Ie,openSessionCard:Le,openNode:Re,openContinue:ze,unfold:Be,resizeRows:v,storeRowWidth:y,person:A,people:M}),[c,r,ne,Ie,Le,Re,ze,Be,v,y,A,M]),tt=(0,_.useMemo)(()=>{let t=Math.max(L.git.width,...xe.map(e=>e.left+e.git.width));return[{id:`project`,type:`project`,position:{x:0,y:0},width:t,height:L.git.height,style:{width:t,height:L.git.height},draggable:!1,connectable:!1,selectable:!1,data:{model:e,graph:L,openings:xe,highlights:de,sessionHits:fe,activeHit:ue}}]},[e,L,xe,de,fe,ue]);return(0,R.jsx)(Dg.Provider,{value:et,children:(0,R.jsxs)(`div`,{className:N?`map-shell is-expanded`:`map-shell`,children:[(0,R.jsxs)(`div`,{className:`map-toolbar`,children:[(0,R.jsx)(`span`,{className:`map-title`,children:`${L.git.rows.length} session${L.git.rows.length===1?``:`s`}`}),ke?(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,title:`Open the newest session and go to its newest message`,onClick:()=>{Ne(ke.sessionId),Ee(e=>e+1),document.querySelector(`.lineage-map`)?.scrollIntoView({block:`start`})},children:`↧ Left off here`}):null,(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,"aria-pressed":b,title:b?`Close every session and fold long branches again`:`Open every session and every folded branch`,onClick:()=>{i(b?new Set:new Set(L.sessions.keys())),o(new Set),b&&Oe(e=>e+1),x(e=>!e),d(new Set)},children:b?`Fold all`:`Unfold all`}),ee.length>0?(0,R.jsx)(`select`,{className:`person-filter`,"aria-label":`Whose sessions`,title:`Fade the other people's sessions; the lines between them stay`,value:qp(A),onChange:e=>j(Kp(e.target.value)),children:ee.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))}):null,(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,"aria-pressed":N,onClick:te,children:N?`Exit full screen`:`Full screen`}),(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,"aria-pressed":S,onClick:()=>{C(e=>!e),T(!1),k(!1)},children:S?`Hide outline`:`Show outline`}),(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,"aria-pressed":w,title:`Which conversations touched which file`,onClick:()=>{T(e=>!e),C(!1),k(!1)},children:w?`Hide files`:`Files`}),re?(0,R.jsx)(`button`,{type:`button`,className:`outline-button capture-button`,"aria-pressed":O,title:`Tasks: what your sessions left undone — cogit drafts, you decide`,onClick:()=>{k(e=>!e),T(!1),C(!1)},children:O?`Hide tasks`:`Tasks`}):null]}),(0,R.jsxs)(`div`,{className:`graph-wrap`,children:[O?(0,R.jsx)($,{captures:e.captures,sessions:e.sessions,dir:e.project.path,onSelectSession:Le,onClose:()=>k(!1)}):w?(0,R.jsx)(fp,{files:e.files,sessions:e.sessions,active:c?.type===`node`?{sessionId:c.sessionId,messageId:c.nodeId}:null,focus:E,onSelect:Ge,onClose:()=>T(!1)}):S?(0,R.jsx)(Vp,{model:e,activeId:ie,onSelect:Ve,onClose:()=>C(!1)}):null,(0,R.jsx)(`div`,{className:`graph-canvas`,children:L.git.rows.length===0?(0,R.jsx)(`p`,{className:`graph-status empty`,children:`No sessions recorded yet.`}):(0,R.jsx)(Ig,{nodes:tt,focusRow:we,jump:Ae,searchJump:Me,fileJump:qe,sessionJump:$e,fit:De,refocus:m})}),(0,R.jsx)(ag,{model:e,selection:c,captureReveal:Pe,onClose:()=>{l(null),Fe(0)},onNavigate:Ve,onOpenFileHistory:He,bigChangeLines:ne})]})]})})}function Ig({nodes:e,focusRow:t,jump:n,searchJump:r,fileJump:i,sessionJump:a,fit:o,refocus:s}){let{fitView:c,setViewport:l}=ou(),u=bg();function d(e){let t=document.querySelector(`.react-flow`)?.getBoundingClientRect();t&&l(up(e,t,.9),{duration:300})}(0,_.useEffect)(()=>{if(o===0)return;let e=window.setTimeout(()=>void c({padding:.12,maxZoom:1,duration:300}),50);return()=>window.clearTimeout(e)},[o]);let f=n?.key??0,p=n?.point??null;(0,_.useEffect)(()=>{f!==0&&p!==null&&d(p)},[f]);let m=r?.key??0,h=r?.point??null;(0,_.useEffect)(()=>{m!==0&&h!==null&&d(h)},[m,h]);let g=i?.key??0,v=i?.point??null;(0,_.useEffect)(()=>{g!==0&&v!==null&&d(v)},[g,v]);let y=a?.key??0,b=a?.point??null;return(0,_.useEffect)(()=>{y!==0&&b!==null&&d(b)},[y,b]),(0,_.useEffect)(()=>{if(s===0||t===null)return;let e=document.querySelector(`.react-flow`)?.getBoundingClientRect();e&&l(up(t,e,.9))},[s]),(0,_.useEffect)(()=>{let e=window.setTimeout(()=>{let e=document.querySelector(`.react-flow`)?.getBoundingClientRect();t&&e?l(up(t,e,.9)):c({padding:.12,maxZoom:1,duration:200})},80);return()=>window.clearTimeout(e)},[]),(0,R.jsx)(cf,{proOptions:{hideAttribution:!0},nodes:e,edges:[],nodeTypes:Ag,fitView:!0,panOnScroll:!0,minZoom:.05,maxZoom:2,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,colorMode:u,children:(0,R.jsx)(Sf,{showInteractive:!1})})}function Lg({model:e,search:t}){return(0,R.jsx)(`section`,{className:`lineage-map`,"aria-label":`Project lineage graph`,children:(0,R.jsx)(rf,{children:(0,R.jsx)(Fg,{model:e,search:t})})})}function Rg(e){let t=fe()?`/map?dir=${encodeURIComponent(e.projectPath)}`:e.mapUrl,n=new URLSearchParams({s:e.sessionId});return e.messageId!==void 0&&n.set(`m`,e.messageId),`${t}#${n.toString()}`}function zg(e){let t=0;for(let n of e)t=t*31+(n.codePointAt(0)??0)>>>0;return t%6}function Bg({row:e}){let t=[e.goal===``?``:`Goal: ${e.goal}`,e.lastDecision===``?``:`Last decision: ${e.lastDecision}`,e.pending.length===0?``:`Open: ${e.pending.map(e=>e.text).join(`; `)}`].filter(e=>e!==``);return t.length===0?null:(0,R.jsxs)(`p`,{className:`inbox-where`,children:[(0,R.jsx)(`span`,{className:`muted`,children:`Where we were, from the record:`}),` `,t.join(` · `)]})}function Vg({rows:e,collapsible:t=!1}){let[n,r]=(0,_.useState)(!t),[i,a]=(0,_.useState)(new Set),[o,s]=(0,_.useState)(null),c=e.filter(e=>!i.has(Q(e.projectPath,e.sessionId)));if(c.length===0)return null;let l=new Date().toISOString();function u(e){let t=Q(e.projectPath,e.sessionId);s(null),a(e=>new Set(e).add(t));let n=pe();n!==null&&ge(e.projectPath,e.sessionId,e.at,n).catch(e=>{s(e instanceof Error?e.message:String(e)),a(e=>{let n=new Set(e);return n.delete(t),n})})}return(0,R.jsxs)(`section`,{className:`inbox`,"aria-labelledby":`inbox-title`,children:[(0,R.jsx)(`h2`,{id:`inbox-title`,children:t?(0,R.jsxs)(`button`,{type:`button`,className:`inbox-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[(0,R.jsx)(`span`,{className:`inbox-caret`,children:n?`▾`:`▸`}),` Your turn`,` `,(0,R.jsx)(`span`,{className:`muted inbox-count`,children:c.length})]}):(0,R.jsxs)(R.Fragment,{children:[`Your turn `,(0,R.jsx)(`span`,{className:`muted inbox-count`,children:c.length})]})}),n?(0,R.jsx)(`ul`,{className:`inbox-rows`,children:c.map(e=>(0,R.jsxs)(`li`,{className:`inbox-row`,style:{borderLeftColor:`var(--l${zg(e.projectPath)})`},children:[(0,R.jsxs)(`div`,{className:`inbox-head`,children:[(0,R.jsx)(`span`,{className:`inbox-project`,title:e.projectPath,children:e.projectName}),(0,R.jsx)(`span`,{className:`inbox-session`,children:e.sessionTitle}),(0,R.jsx)(`span`,{className:e.signal===`record`?`inbox-age is-record`:`inbox-age`,title:Wf(e.at),children:e.signal===`record`?`the record says it needs you · ${Hf(e.at,l)}`:`your turn for ${Hf(e.at,l)}`}),(0,R.jsx)(`button`,{type:`button`,className:`inbox-dismiss`,"aria-label":`Dismiss`,title:pe()===null?`Hide until this page is reloaded`:`Hide until the agent writes in this session again`,onClick:()=>u(e),children:`×`})]}),e.lastMessage===void 0?null:(0,R.jsx)(`p`,{className:`inbox-message`,children:e.lastMessage}),e.signal===`both`?(0,R.jsx)(`p`,{className:`inbox-signal`,children:`The record says it needs you.`}):null,(0,R.jsx)(Bg,{row:e}),(0,R.jsxs)(`div`,{className:`inbox-actions`,children:[(0,R.jsx)(`a`,{className:`inbox-open`,href:Rg(e),children:e.messageId===void 0?`Open the map →`:`Open at this message →`}),(0,R.jsx)(xm,{projectPath:e.projectPath,sessionId:e.sessionId,available:e.transcriptAvailable})]})]},Q(e.projectPath,e.sessionId)))}):null,o===null?null:(0,R.jsx)(`p`,{className:`muted inbox-error`,children:o})]})}function Hg({value:e,state:t,onQuery:n,onStep:r,onClear:i}){let a=(0,_.useRef)(null);(0,_.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`f`&&document.activeElement!==a.current&&(e.preventDefault(),a.current?.focus(),a.current?.select())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);function o(e){e.key===`Escape`?(e.preventDefault(),i(),a.current?.blur()):t.hash===null&&e.key===`Enter`&&(e.preventDefault(),r(e.shiftKey?-1:1))}let s=t.hits.length,c=Math.min(t.active,s-1),l=t.hash===null?e.trim()===``?``:s===0?`0 hits`:`${c+1} / ${s}`:t.hash.kind===`ok`?`1 / 1`:t.hash.kind===`ambiguous`?`${t.hash.count} matches`:`no match`,u=t.hash===null?s===0&&e.trim()!==``?`no matches`:null:t.hash.kind===`ok`?`→ ${t.hash.label??t.hash.messageId} · ${t.hash.title}`:t.hash.kind===`ambiguous`?`several messages match — type more of the hash`:`no recorded message has that hash`;return(0,R.jsxs)(`div`,{className:`map-search`,role:`search`,children:[(0,R.jsxs)(`div`,{className:`map-search-row`,children:[(0,R.jsx)(`input`,{ref:a,type:`search`,className:`map-search-input`,placeholder:`Search the lineage`,"aria-label":`Search the lineage`,value:e,onChange:e=>n(e.target.value),onKeyDown:o}),l===``?null:(0,R.jsx)(`span`,{className:`map-search-count`,children:l}),t.hash===null&&s>0?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,className:`map-search-step`,"aria-label":`Previous hit`,title:`Previous hit (Shift+Enter)`,disabled:c<=0,onClick:()=>r(-1),children:`↑`}),(0,R.jsx)(`button`,{type:`button`,className:`map-search-step`,"aria-label":`Next hit`,title:`Next hit (Enter)`,disabled:c>=s-1,onClick:()=>r(1),children:`↓`})]}):null]}),u===null?null:(0,R.jsx)(`p`,{className:`map-search-hint`,children:u})]})}o(((e,t)=>{t.exports={}}))();function Ug(e){return e.slice(0,6)}function Wg(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>`${e.name} ${e.path} ${e.leftOff}`.toLowerCase().includes(n))}function Gg(e){return`${fe()?`/map?dir=${encodeURIComponent(e.path)}`:e.lineageUrl}#focus=head`}function Kg(){return/mac/i.test(navigator.platform)?`⌘ K`:`Ctrl K`}function qg({model:e}){let t=(0,_.useMemo)(()=>e.switcher??[],[e.switcher]),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(0),c=(0,_.useRef)(null),l=(0,_.useMemo)(()=>Wg(t,i),[t,i]),u=Ug(t);if((0,_.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`?(e.preventDefault(),r(e=>!e),a(``),s(0)):e.key===`Escape`&&r(!1)}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,_.useEffect)(()=>{n&&c.current?.focus()},[n]),t.length===0)return null;function d(e){window.location.href=Gg(e)}function f(e){if(e.key===`ArrowDown`)e.preventDefault(),s(e=>Math.min(e+1,Math.max(l.length-1,0)));else if(e.key===`ArrowUp`)e.preventDefault(),s(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=l[o];t&&d(t)}}return(0,R.jsxs)(`div`,{className:`switcher`,children:[(0,R.jsxs)(`nav`,{className:`switcher-tabs`,"aria-label":`Recent projects`,children:[u.map(e=>(0,R.jsxs)(`a`,{"aria-current":e.current?`page`:void 0,className:e.current?`switcher-tab is-current`:`switcher-tab`,href:Gg(e),title:e.leftOff||e.path,children:[(0,R.jsx)(`span`,{className:`switcher-name`,children:e.name}),(0,R.jsx)(`span`,{className:`switcher-time`,children:Gf(e.lastActivity)})]},e.path)),(0,R.jsxs)(`button`,{type:`button`,className:`switcher-more`,onClick:()=>{r(!0),a(``),s(0)},"aria-haspopup":`dialog`,children:[`Switch project `,(0,R.jsx)(`kbd`,{children:Kg()})]})]}),n?(0,R.jsx)(`div`,{className:`switcher-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,R.jsxs)(`div`,{className:`switcher-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Switch project`,children:[(0,R.jsx)(`input`,{ref:c,className:`switcher-input`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`switcher-results`,"aria-activedescendant":l[o]?`switcher-${o}`:void 0,"aria-autocomplete":`list`,placeholder:`Search projects by name, path or where you left off…`,value:i,onChange:e=>{a(e.target.value),s(0)},onKeyDown:f}),l.length===0?(0,R.jsx)(`p`,{className:`empty switcher-none`,children:`No project matches.`}):(0,R.jsx)(`ul`,{className:`switcher-results`,id:`switcher-results`,role:`listbox`,children:l.map((e,t)=>(0,R.jsxs)(`li`,{id:`switcher-${t}`,role:`option`,"aria-selected":t===o,className:t===o?`switcher-result is-active`:`switcher-result`,onMouseMove:()=>s(t),onClick:()=>d(e),children:[(0,R.jsxs)(`span`,{className:`switcher-result-head`,children:[(0,R.jsx)(`span`,{className:`switcher-name`,children:e.name}),e.current?(0,R.jsx)(`span`,{className:`badge`,children:`current`}):null,(0,R.jsx)(`span`,{className:`switcher-time`,children:Wf(e.lastActivity)})]}),(0,R.jsx)(`span`,{className:`switcher-leftoff`,children:e.leftOff||`Nothing recorded yet.`}),(0,R.jsx)(`span`,{className:`switcher-path`,children:e.path})]},e.path))}),(0,R.jsx)(`p`,{className:`switcher-hint`,children:`↑↓ to move · Enter to open · Esc to close`})]})}):null]})}var Jg=[{key:`recorder`,label:`Recording`,help:`How much of the chat goes into the record.`,details:"Economical (recommended): a small model records in the background every few turns and closes each session with one pass that finds its threads, writes the branch summaries and one line on where the session left off. The agent is never interrupted; it costs about a cent per session. Detailed: on top of that, the main agent records its own decisions every 15 turns. It catches the agent's technical choices best and costs about 1–2% of a session. A third mode, where only the main agent records, is set with `cogit config set recorder agent`.",kind:`select`,options:[{value:`side`,label:`Economical (recommended)`},{value:`mixed`,label:`Detailed`}]},{key:`messageSummaries`,label:`One-line summary under each message`,help:`A sentence under each message title on the map.`,details:`A one-sentence summary under each message title, so a skim reads better. Off keeps the record shorter and cheaper. Branch summaries and the line on where a session left off are written either way.`,kind:`boolean`},{key:`startupContext`,label:`Record at session start`,help:`Hand the agent the previous session's record when a chat starts.`,details:`When a chat starts, the agent gets a short summary of where the previous session left off and how to read the record. It costs a few tokens; turn it off if your projects are unrelated.`,kind:`boolean`},{key:`recordHeadless`,label:`Headless sessions`,help:"Record sessions that start without a person, such as `claude -p`.",details:"Some plugins and scripts run `claude -p` in the background, often once per prompt. Off, cogit leaves those sessions out of the map and the inbox. Turn it on if you do real work through `claude -p` or the SDK and want it recorded.",kind:`boolean`},{key:`tryBeforeNotes`,label:`Tried-before notes`,help:`Before the agent edits a file, tell it which options earlier thoughts rejected for it.`,details:`Before the agent edits a file, it hears which options earlier thoughts tried and rejected for that file. These are notes from the record, never rules; they can make the agent ask before repeating a dead end.`,kind:`boolean`},{key:`shapes`,label:`Intent, Shape and Code`,help:`A small picture of what each change does, beside its reason and its diff.`,details:`For every message that landed commits, a small representation of what the change does: numbered plain-language steps or a Mermaid diagram. It sits between the record's intent (the decision, reason and rejected options) and the code (the diff), so a reviewer sees why, what and how in one place. The recorder writes it, not you; it costs one small model call per such message. Off, the map says so and nothing is written.`,kind:`boolean`},{key:`captures`,label:`Tasks`,help:`A short list of what each session left undone, drafted by the side model.`,details:`When a session ends, the side model reads what its record left open and drafts at most three things a person would ask for, in the conversation's language. The list is yours: accept, dismiss or close each item. Sessions with nothing open cost no model call; the map's Tasks button appears only while something waits or is open. Off, nothing is drafted and the list already in the store is kept, not deleted.`,kind:`boolean`},{key:`language`,label:`Language`,help:"Language the agent writes records in; `auto` follows the chat.",details:`The language the record is written in. With auto, it follows the language of the conversation.`,kind:`text`},{key:`shareConversations`,label:`Share conversations`,help:`Commit the raw chat text too, not only the session record (off: chat stays local).`,details:`Also commit the raw chat text, not only the record. Leave it off to keep conversations on your machine while the record still travels with the branch.`,kind:`boolean`},{key:`recordCommit`,label:`Commit the record`,help:`ask, auto or off: what to do with the last messages after the last code commit.`,details:`What happens to record changes made after your last code commit: ask you next time, commit them automatically, or leave them for you to commit.`,kind:`text`}];function Yg(e){return[{title:`Recording`,fields:Jg.map(t=>({...t,editable:e}))}]}var Xg={recorder:`side`,language:`auto`,updateEveryTurns:15,sideEveryTurns:5,sessionEndCatchUp:!0,sideModel:`haiku`,messageSummaries:!1,startupContext:!0,recordHeadless:!1,tryBeforeNotes:!0,shapes:!0,captures:!0,shareConversations:!1,recordCommit:`ask`,gitPolicy:`commit`,agents:[`claude-code`],bigChangeLines:300};function Zg(e){return{...Xg,...e}}function Qg(e){return Array.isArray(e)?e.length>0?e.join(`, `):`—`:typeof e==`boolean`?e?`yes`:`no`:e===void 0?`—`:String(e)}function $g({id:e,field:t}){return(0,R.jsx)(Fm,{id:e,label:`What does ${t.label} do?`,children:t.details})}function e_(e,t){return e.kind===`boolean`?!!t:e.kind===`number`?Number(t):String(t)}function t_(e,t,n){return e.kind===`boolean`?!!t!=!!n:String(t)!==String(n)}function n_({id:e,field:t,value:n,draft:r,error:i,onChange:a}){let o=r??(t.kind===`boolean`?!!n:String(n));return(0,R.jsxs)(`div`,{className:r===void 0?`settings-field`:`settings-field is-changed`,children:[(0,R.jsxs)(`div`,{className:`settings-field-text`,children:[(0,R.jsxs)(`span`,{className:`settings-label`,children:[(0,R.jsx)(`label`,{htmlFor:e,children:t.label}),(0,R.jsx)($g,{id:e,field:t})]}),(0,R.jsx)(`p`,{className:`settings-help`,id:`${e}-help`,children:t.help})]}),(0,R.jsxs)(`div`,{className:`setting-form`,children:[t.kind===`boolean`?(0,R.jsx)(`input`,{id:e,type:`checkbox`,checked:!!o,"aria-describedby":`${e}-help`,onChange:e=>a(t,e.target.checked)}):t.kind===`select`?(0,R.jsxs)(`select`,{id:e,value:String(o),"aria-describedby":`${e}-help`,onChange:e=>a(t,e.target.value),children:[(t.options??[]).map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value)),(t.options??[]).some(e=>e.value===String(o))?null:(0,R.jsx)(`option`,{value:String(o),children:String(o)})]}):(0,R.jsx)(`input`,{id:e,type:t.kind===`number`?`number`:`text`,value:String(o),"aria-describedby":`${e}-help`,onChange:e=>a(t,e.target.value)}),i?(0,R.jsx)(`span`,{className:`setting-error`,children:i}):null]})]})}function r_({embedded:e,onClose:t}){let n=fe()?pe():null,[r,i]=(0,_.useState)(()=>Zg(e)),[a,o]=(0,_.useState)(n!==null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)({}),[d,f]=(0,_.useState)({}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null),v=(0,_.useRef)(null);(0,_.useEffect)(()=>{v.current?.focus()},[]),(0,_.useEffect)(()=>{function e(e){e.key===`Escape`&&t()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,_.useEffect)(()=>{if(!n)return;let e=!0;return me(n).then(t=>{e&&i(e=>({...e,...t}))}).catch(t=>{e&&c(t instanceof Error?t.message:String(t))}).finally(()=>{e&&o(!1)}),()=>{e=!1}},[n]);let y=n!==null,b=Yg(y),x=new Map(b.flatMap(e=>e.fields).map(e=>[e.key,e])),S=Object.keys(l);function C(e,t){u(n=>{let i={...n};return t_(e,t,r[e.key])?i[e.key]=t:delete i[e.key],i}),f(t=>{let n={...t};return delete n[e.key],n}),g(null)}async function w(e){if(e.preventDefault(),!n||p||S.length===0)return;m(!0),g(null);let t={};for(let e of S){let r=x.get(e),a=l[e];if(!r||a===void 0)continue;let o=e_(r,a);try{await Se(e,o,n),i(t=>({...t,[e]:o})),u(t=>{let n={...t};return delete n[e],n})}catch(n){t[e]=n instanceof Error?n.message:String(n)}}f(t);let r=Object.keys(t).length;g(r===0?`Saved`:`${r} not saved`),m(!1)}return(0,R.jsx)(`div`,{className:`settings-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,R.jsxs)(`div`,{className:`settings-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,children:[(0,R.jsxs)(`div`,{className:`settings-head`,children:[(0,R.jsx)(`h2`,{id:`settings-title`,children:`Settings`}),(0,R.jsx)(`button`,{ref:v,type:`button`,className:`settings-close`,"aria-label":`Close settings`,onClick:t,children:`×`})]}),(0,R.jsx)(`p`,{className:`muted`,children:y?`A change here applies to new builds and chats.`:"Read-only. Open this page with `cogit open` to change settings, or use `cogit config set <key> <value>`."}),a?(0,R.jsx)(`p`,{className:`settings-help`,children:`Reading the current settings…`}):null,s?(0,R.jsx)(`p`,{className:`setting-error`,children:s}):null,(0,R.jsxs)(`form`,{onSubmit:w,children:[b.map(e=>(0,R.jsxs)(`section`,{className:`settings-section`,"aria-label":e.title,children:[(0,R.jsx)(`h3`,{children:e.title}),e.fields.map(e=>{let t=`setting-${e.key}`,i=r[e.key];return e.editable&&n?(0,R.jsx)(n_,{id:t,field:e,value:i,draft:l[e.key],error:d[e.key],onChange:C},e.key):(0,R.jsxs)(`div`,{className:`settings-field`,children:[(0,R.jsxs)(`div`,{className:`settings-field-text`,children:[(0,R.jsxs)(`span`,{className:`settings-label`,children:[e.label,(0,R.jsx)($g,{id:t,field:e})]}),(0,R.jsx)(`p`,{className:`settings-help`,id:`${t}-help`,children:e.help})]}),(0,R.jsx)(`span`,{className:`settings-value`,children:Qg(i)})]},e.key)})]},e.title)),y?(0,R.jsxs)(`div`,{className:`settings-foot`,children:[(0,R.jsx)(`span`,{className:`setting-status`,role:`status`,children:p?`Saving…`:S.length>0?`${S.length} unsaved ${S.length===1?`change`:`changes`}`:h??``}),(0,R.jsx)(`button`,{type:`submit`,disabled:S.length===0||p,children:`Save`})]}):null]})]})})}function i_({settings:e}){let[t,n]=(0,_.useState)(!1),r=(0,_.useRef)(null);function i(){n(!1),r.current?.focus()}return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{ref:r,type:`button`,className:`settings-button`,"aria-haspopup":`dialog`,"aria-expanded":t,onClick:()=>n(!0),children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,children:`⚙`}),` Settings`]}),t?(0,R.jsx)(r_,{embedded:e,onClose:i}):null]})}function a_({model:e}){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)(0),s=(0,_.useDeferredValue)(t),c=(0,_.useMemo)(()=>se(s)?ce(e,s):null,[e,s]),l=(0,_.useMemo)(()=>c===null?le(e,s):[],[e,s,c]),u={hits:l,active:r,step:a,hash:c};function d(e){n(e),i(0),o(e=>e+1)}function f(e){i(t=>P(t,l.length,e)),o(e=>e+1)}function p(){n(``),i(0),o(0)}return(0,R.jsxs)(`main`,{className:`map-page`,children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`div`,{className:`page-bar page-bar-centered`,children:[(0,R.jsx)(we,{}),(0,R.jsxs)(`div`,{className:`page-title`,children:[(0,R.jsx)(`h1`,{children:e.project.name}),(0,R.jsx)(`p`,{className:`muted`,children:e.project.path})]}),(0,R.jsxs)(`div`,{className:`page-bar-actions`,children:[(0,R.jsx)(Hg,{value:t,state:u,onQuery:d,onStep:f,onClear:p}),(0,R.jsx)(Cg,{}),(0,R.jsx)(i_,{settings:e.settings})]})]}),(0,R.jsx)(`header`,{className:`project`,children:(0,R.jsxs)(`div`,{children:[(0,R.jsx)(qg,{model:e}),(0,R.jsx)(Te,{})]})}),(0,R.jsx)(Vg,{rows:e.inbox??[],collapsible:!0})]}),(0,R.jsx)(Lg,{model:e,search:u})]})}function o_(e){return e.lineageUrl?typeof document<`u`&&fe()?`/map?dir=${encodeURIComponent(e.path)}`:e.lineageUrl:null}function s_({model:e}){return(0,R.jsxs)(`main`,{className:`panel-page`,children:[(0,R.jsx)(`div`,{className:`page-bar`,children:(0,R.jsx)(we,{home:!0})}),(0,R.jsxs)(`header`,{className:`project`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h1`,{children:`Projects`}),(0,R.jsx)(`p`,{className:`muted`,children:`Every project cogit knows about.`})]}),(0,R.jsxs)(`div`,{className:`page-actions`,children:[(0,R.jsx)(Cg,{}),(0,R.jsx)(i_,{settings:e.settings}),(0,R.jsxs)(`div`,{className:`meta`,children:[(0,R.jsxs)(`span`,{children:[e.projects.length,` `,e.projects.length===1?`project`:`projects`]}),(0,R.jsxs)(`span`,{className:`muted`,children:[`generated `,Wf(e.generatedAt)]})]})]})]}),(0,R.jsx)(Vg,{rows:e.inbox??[]}),e.projects.length===0?(0,R.jsx)(`p`,{className:`empty`,children:"No projects registered yet. Run `cogit init` in a project."}):(0,R.jsx)(`ul`,{className:`panel-grid`,children:e.projects.map(e=>{let t=o_(e);return(0,R.jsxs)(`li`,{className:e.missing?`card missing`:`card`,children:[(0,R.jsxs)(`div`,{className:`card-head`,children:[(0,R.jsx)(`h2`,{children:e.name}),e.missing?(0,R.jsx)(`span`,{className:`badge`,title:"This directory is gone. `cogit config prune` removes it from the panel.",children:`missing`}):null]}),(0,R.jsx)(`p`,{className:`muted path`,children:e.path}),(0,R.jsxs)(`dl`,{className:`card-facts`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{children:`Last activity`}),(0,R.jsx)(`dd`,{children:Wf(e.lastActivity)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{children:`Waiting on you`}),(0,R.jsx)(`dd`,{children:e.needsUserCount})]})]}),t?(0,R.jsx)(`a`,{className:`card-open`,href:t,children:`Open the map →`}):(0,R.jsx)(`p`,{className:`empty`,children:`Directory not found.`})]},e.path)})})]})}uh();async function c_(){try{let e=await fetch(location.href,{cache:`no-store`});if(!e.ok)return null;let t=new DOMParser().parseFromString(await e.text(),`text/html`).getElementById(y)?.textContent?.trim();return t?ue(t):null}catch{return null}}function l_({initial:e}){let[t,n]=(0,_.useState)(e);return ye(t),(0,_.useEffect)(()=>{if(!fe())return;let e=new EventSource(`/events${location.search}`);return e.addEventListener(`change`,()=>{c_().then(e=>{e&&n(e)})}),()=>e.close()},[]),t.kind===`lineage`?(0,R.jsx)(a_,{model:t}):(0,R.jsx)(s_,{model:t})}var u_=document.getElementById(`root`);if(!u_)throw Error(`missing #root`);de().then(e=>{(0,v.createRoot)(u_).render((0,R.jsx)(_.StrictMode,{children:(0,R.jsx)(l_,{initial:e})}))}).catch(e=>{let t=document.createElement(`p`);t.className=`error`,t.textContent=e instanceof Error?e.message:String(e),u_.replaceChildren(t)});</script>+`),children:e}):null]})]})}else r=e.transcriptAvailable?(0,R.jsx)(`p`,{className:`muted`,children:`This message was not found in the transcript.`}):(0,R.jsx)(`p`,{className:`muted`,children:`This conversation is not on this machine. The summary above is what remains.`});return(0,R.jsxs)(`details`,{className:`chat fold`,children:[(0,R.jsx)(`summary`,{children:`Conversation`}),r]})}function Qh(e,t){return Mp(e.messages).segments.find(e=>e.ids.includes(t))?.id}function $h({session:e,branchId:t}){if(!t)return null;let n=Mp(e.messages).segments.find(e=>e.id===t);if(!n)return null;let{branch:r}=n,i=r.firstAt&&r.lastAt&&r.firstAt!==r.lastAt?` · ${Wf(r.firstAt)} → ${Wf(r.lastAt)}`:``;return(0,R.jsxs)(`details`,{className:`branch-detail fold`,children:[(0,R.jsxs)(`summary`,{children:[`Branch · `,(0,R.jsx)(`span`,{style:{color:`var(--l${n.colorIndex})`},children:r.title})]}),(0,R.jsxs)(`p`,{className:`branch-range`,children:[r.count>1?`${r.fromLabel}–${r.toLabel}`:r.fromLabel,` ·`,` `,r.count,` message`,r.count===1?``:`s`,i]}),r.asked?(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`b`,{children:`Asked:`}),` `,r.asked]}):null,r.outcome?(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`b`,{children:`Outcome:`}),` `,r.outcome]}):null,r.open?(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`b`,{children:`Open:`}),` `,r.open]}):null]})}function eg({session:e,node:t,onNavigate:n}){if(!e||!n||t.kind!==`message`)return null;let{previous:r,next:i}=lp(e.messages,t.nodeId),a=t=>t?()=>n({sessionId:e.sessionId,focusId:cp(ap(e.sessionId),t.id),selection:{type:`node`,sessionId:e.sessionId,nodeId:t.id}}):void 0;return(0,R.jsxs)(`nav`,{className:`message-nav`,"aria-label":`Messages`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:!r,onClick:a(r),title:r?.title,children:`← Previous message`}),(0,R.jsx)(`button`,{type:`button`,disabled:!i,onClick:a(i),title:i?.title,children:`Next message →`})]})}function tg({model:e,node:t,onNavigate:n,onOpenFileHistory:r,bigChangeLines:i}){let a=Rh(e,t.sessionId),o=typeof document<`u`&&fe()&&pe()!==null;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(eg,{session:a,node:t,onNavigate:n}),t.kind===`message`&&op(t.nodeId)?(0,R.jsx)(Bh,{value:t.nodeId}):null,t.summary?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Summary`}),(0,R.jsx)(`p`,{children:t.summary})]}):null,t.why?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Why`}),(0,R.jsx)(`p`,{children:t.why})]}):null,t.alternatives?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Considered and rejected`}),(0,R.jsx)(`ul`,{className:`drilldown-list`,children:t.alternatives.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`strong`,{children:e.option}),e.why?(0,R.jsxs)(R.Fragment,{children:[` — `,e.why]}):null]},e.option))})]}):null,t.decidedBy?(0,R.jsxs)(`p`,{className:`decided-by`,children:[`Decided by: `,qh[t.decidedBy]]}):null,t.agentDecisions?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Decided by the agent on its own`}),(0,R.jsx)(`ul`,{className:`drilldown-list`,children:t.agentDecisions.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`strong`,{children:e.title}),e.why?(0,R.jsxs)(R.Fragment,{children:[` — `,e.why]}):null,e.alternatives?.length?(0,R.jsx)(`ul`,{children:e.alternatives.map(e=>(0,R.jsxs)(`li`,{children:[`Not: `,e.option,e.why?(0,R.jsxs)(R.Fragment,{children:[` — `,e.why]}):null]},e.option))}):null]},e.title))})]}):null,t.work?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`What the agent did`}),(0,R.jsx)(`ul`,{className:`drilldown-list`,children:t.work.map(e=>(0,R.jsx)(`li`,{children:e},e))})]}):null,t.kind===`message`&&t.commits?.length?(0,R.jsx)(Lh,{node:t,root:e.project.path,enabled:e.settings?.shapes??!0}):null,t.kind===`message`&&t.change?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Code landed`}),(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`span`,{className:`git-change${hp(t.change,i)?` is-big`:``}`,children:_p(t.change)}),` `,`after this message.`]})]}):null,t.commits?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsxs)(`h3`,{children:[`Commits `,(0,R.jsx)(`span`,{className:`count`,children:t.commits.length})]}),(0,R.jsx)(`ul`,{className:`commit-list`,children:t.commits.map(n=>{let r=t.commitTags?.find(e=>e.hash===n),i=t.commitTags!==void 0&&r?.subject===void 0;return(0,R.jsx)(ng,{hash:n,subject:r?.subject,missing:i,root:e.project.path,expandable:!i&&(o||L(n))},n)})})]}):null,t.files?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsxs)(`h3`,{children:[`Changed files `,(0,R.jsx)(`span`,{className:`count`,children:t.files.length})]}),(0,R.jsx)(`ul`,{className:`file-list`,children:t.files.map(n=>{let i=[...t.commitTags??[]].reverse().find(e=>e.files?.includes(n));return(0,R.jsx)(rg,{file:n,root:e.project.path,commit:i?.hash,expandable:i!==void 0&&(o||L(i.hash,n)),onHistory:r},n)})})]}):null,!o&&(t.commits?.length||t.files?.length)&&!(t.commits??[]).some(e=>L(e))?(0,R.jsx)(`p`,{className:`muted`,children:"Open with `cogit open` to see diffs."}):null,t.kind===`message`?(0,R.jsx)(Zh,{session:a,id:t.nodeId}):null,a?(0,R.jsx)($h,{session:a,branchId:Qh(a,t.nodeId)}):null,(0,R.jsxs)(`dl`,{className:`drilldown-meta`,children:[(0,R.jsx)(Hh,{label:t.kind===`message`?`Sent`:`Recorded`,children:Wf(t.at??t.addedAt??null)}),t.touchedAt&&t.touchedAt!==t.addedAt?(0,R.jsx)(Hh,{label:`Last changed`,children:Wf(t.touchedAt)}):null,(0,R.jsx)(Hh,{label:`Session`,children:a?(0,R.jsxs)(R.Fragment,{children:[a.title||a.sessionId,` `,(0,R.jsx)(`code`,{children:a.sessionId})]}):(0,R.jsx)(`code`,{children:t.sessionId})}),a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Hh,{label:`Session started`,children:Wf(a.startedAt)}),(0,R.jsx)(Hh,{label:`Session updated`,children:Wf(a.updatedAt)}),(0,R.jsx)(Gh,{session:a})]}):null]}),a?(0,R.jsx)(Vh,{model:e,session:a}):null]})}function ng({hash:e,subject:t,missing:n,root:r,expandable:i}){let[a,o]=(0,_.useState)(!1),s=t===void 0?void 0:rm(t),c=s?.type===void 0?void 0:am(s.type),l=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`code`,{className:`commit-hash`,children:e.slice(0,7)}),s?.type?(0,R.jsxs)(`span`,{className:`commit-type`,style:c===void 0?void 0:{background:`var(--l${c})`},children:[s.type,s.breaking?`!`:``]}):null,s?.scope?(0,R.jsx)(`span`,{className:`commit-scope`,children:s.scope}):null,(0,R.jsx)(`span`,{className:`commit-subject`,children:s?s.text:`not in this repository`}),i?(0,R.jsx)(`span`,{className:`diff-caret`,children:a?`−`:`+`}):null]});return(0,R.jsxs)(`li`,{className:n?`commit-item is-missing`:`commit-item`,title:e,children:[i?(0,R.jsx)(`button`,{type:`button`,className:`commit-row`,"aria-expanded":a,onClick:()=>o(e=>!e),children:l}):(0,R.jsx)(`div`,{className:`commit-row`,children:l}),a?(0,R.jsx)(hm,{dir:r,commit:e}):null]})}function rg({file:e,root:t,commit:n,expandable:r,onHistory:i}){let[a,o]=(0,_.useState)(!1),{dir:s,name:c}=om(e),l=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`file-name`,children:c}),s?(0,R.jsx)(`span`,{className:`file-dir`,children:s}):null,r?(0,R.jsx)(`span`,{className:`diff-caret`,children:a?`−`:`+`}):null]});return(0,R.jsxs)(`li`,{title:e,children:[(0,R.jsxs)(`div`,{className:`file-item`,children:[r&&n!==void 0?(0,R.jsx)(`button`,{type:`button`,className:`file-row`,"aria-expanded":a,onClick:()=>o(e=>!e),children:l}):(0,R.jsx)(`div`,{className:`file-row`,children:l}),i===void 0?null:(0,R.jsx)(`button`,{type:`button`,className:`file-history`,title:`Every message that touched ${e}`,onClick:()=>i(e),children:`history`})]}),a&&n!==void 0?(0,R.jsx)(hm,{dir:t,commit:n,file:e}):null]})}function ig({model:e,session:t,captureReveal:n=0}){let{done:r,pending:i}=t.status;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Goal`}),(0,R.jsx)(`p`,{children:t.status.goal||`No goal recorded.`})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Done`}),r.length>0?(0,R.jsx)(`ul`,{className:`drilldown-list`,children:r.map((e,t)=>(0,R.jsx)(`li`,{children:e},`${t}-${e}`))}):(0,R.jsx)(`p`,{className:`muted`,children:`Nothing yet.`})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Pending`}),i.length>0?(0,R.jsx)(`ul`,{className:`drilldown-list`,children:i.map((e,t)=>(0,R.jsxs)(`li`,{className:e.needsUser?`needs-user`:void 0,children:[e.text,e.needsUser?(0,R.jsx)(`span`,{className:`badge`,children:`needs you`}):null]},`${t}-${e.text}`))}):(0,R.jsx)(`p`,{className:`muted`,children:`Nothing pending.`})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{children:`Next`}),(0,R.jsx)(`p`,{children:t.status.next||`No next step recorded.`})]}),(0,R.jsx)(Wh,{items:(e.captures??[]).filter(e=>e.source.sessionId===t.sessionId),reveal:n}),(0,R.jsx)(Kh,{model:e,session:t})]})}function ag({model:e,selection:t,captureReveal:n=0,onClose:r,onNavigate:i,onOpenFileHistory:a,bigChangeLines:o=300}){if((0,_.useEffect)(()=>{if(!t)return;let e=e=>{if(e.key===`Escape`){if(document.querySelector(`.shape-overlay`)!==null)return;r()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,r]),!t)return null;if(t.type===`session`){let i=Rh(e,t.sessionId);return i?(0,R.jsxs)(`aside`,{className:`drilldown`,role:`dialog`,"aria-label":`Session details`,children:[(0,R.jsxs)(`header`,{className:`drilldown-head`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`kind`,children:`session`}),(0,R.jsx)(`h2`,{children:i.title||i.sessionId})]}),(0,R.jsx)(`button`,{type:`button`,className:`drilldown-close`,"aria-label":`Close`,onClick:r,children:`×`})]}),(0,R.jsx)(`div`,{className:`drilldown-body`,children:(0,R.jsx)(ig,{model:e,session:i,captureReveal:n})})]}):null}let s=Rh(e,t.sessionId),c=s?zh(s,t.nodeId):void 0;if(!s||!c)return null;let l=tp(c,s.sessionId);return(0,R.jsxs)(`aside`,{className:`drilldown`,role:`dialog`,"aria-label":`Message details`,children:[(0,R.jsxs)(`header`,{className:`drilldown-head`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`kind kind-${l.kind}`,children:Yf(l.kind)}),(0,R.jsx)(`h2`,{children:l.title})]}),(0,R.jsx)(`button`,{type:`button`,className:`drilldown-close`,"aria-label":`Close`,onClick:r,children:`×`})]}),(0,R.jsx)(`div`,{className:`drilldown-body`,children:(0,R.jsx)(tg,{model:e,node:l,onNavigate:i,onOpenFileHistory:a,bigChangeLines:o})})]})}var og=`.react-flow, .settings-overlay, .switcher-overlay, .drilldown, .outline, .files-view`,sg=`.react-flow__renderer`;function cg(e){let t=e;return t===null||typeof t.closest!=`function`||t.closest(og)===null}function lg(e,t){e.preventDefault(),t.dispatchEvent(new WheelEvent(`wheel`,{bubbles:!0,cancelable:!0,composed:!0,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,clientX:e.clientX,clientY:e.clientY}))}function ug(e){if(!cg(e.target))return;let t=document.querySelector(sg);t&&lg(e,t)}function dg(){(0,_.useEffect)(()=>(window.addEventListener(`wheel`,ug,{passive:!1}),()=>window.removeEventListener(`wheel`,ug)),[])}function fg(e,t){let n=new Set(t),r=new Set(e.open),i=new Set;for(let t of e.bySearch)n.has(t)?i.add(t):r.delete(t);for(let e of n)r.has(e)||(r.add(e),i.add(e));return{open:r,bySearch:i}}function pg(e){return[...e.open].filter(t=>!e.bySearch.has(t))}function mg(e){if(!e)return-1/0;let t=Date.parse(e);return Number.isNaN(t)?-1/0:t}function hg(e){let t,n=-1/0;for(let r of e.messages){if(r.at===void 0)continue;let e=mg(r.at);e>n&&(n=e,t=r.at)}return t??e.updatedAt}function gg(e,t){let n=e.messages[0]?.continues?.sessionId;return n===void 0||n===e.sessionId?null:t.has(n)?n:null}function _g(e){return e.sessions.sort((e,t)=>mg(e.startedAt)-mg(t.startedAt)||e.sessionId.localeCompare(t.sessionId))}function vg(e,t){let n=_g(e),r=new Map(n.map(e=>[e.sessionId,e])),i=new Set(r.keys()),a=new Map,o=n.map(e=>{let t=gg(e,i);return a.set(e.sessionId,t),{id:e.sessionId,title:e.title||e.sessionId,at:e.startedAt,until:hg(e),parent:t}}),s=n.map(e=>mg(e.startedAt));return{git:Mp(o,{fold:!1,rowWidth:720,headId:ip(e)?.sessionId??null,itemEnd:e=>{let t=mg(e.until);if(t===-1/0)return null;let n=0;for(let e=0;e<s.length;e+=1)(s[e]??-1/0)<=t&&(n=e+1);return n},...t===void 0?{}:{spaceAfter:t}}),sessions:r,parents:a}}function yg(e,t,n){let r=new Set(_g(e).map(e=>e.sessionId)),i=new Set;if(Array.isArray(t))for(let e of t)typeof e==`string`&&r.has(e)&&i.add(e);return n!==null&&i.add(n.sessionId),i}function bg(){return(0,_.useSyncExternalStore)(lh,sh,sh)}var xg={width:20,height:20,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0};function Sg({mode:e}){return e===`light`?(0,R.jsxs)(`svg`,{...xg,children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,R.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}):e===`dark`?(0,R.jsx)(`svg`,{...xg,children:(0,R.jsx)(`path`,{d:`M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z`})}):(0,R.jsxs)(`svg`,{...xg,children:[(0,R.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,R.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function Cg(){let e=bg(),t=$m(e),n=`Theme: ${eh(e)}. Click for ${eh(t)}.`;return(0,R.jsx)(`button`,{type:`button`,className:`theme-button`,title:n,"aria-label":n,onClick:()=>ch(t),children:(0,R.jsx)(Sg,{mode:e})})}var wg=6,Tg=20,Eg=36,Dg=(0,_.createContext)({selection:null,openIds:new Set,bigChangeLines:300,openSession:()=>{},openSessionCard:()=>{},openNode:()=>{},openContinue:()=>{},unfold:()=>{},resizeRows:()=>{},storeRowWidth:()=>{},person:null,people:Gp({sessions:[]})});function Og({session:e,git:t,highlights:n,activeHitId:r}){let{selection:i,bigChangeLines:a,openNode:o,unfold:s,resizeRows:c,storeRowWidth:l,person:u,people:d}=(0,_.useContext)(Dg),f=i?.sessionId===e.sessionId;if(t.rows.length===0)return(0,R.jsx)(`p`,{className:`graph-status empty`,children:`No messages recorded in this session yet.`});let p=!d.matches(e,u);return(0,R.jsxs)(`div`,{className:p?`session-rows is-dimmed`:`session-rows`,children:[(0,R.jsx)(Lp,{git:t,selectedId:i?.type===`node`&&f?i.nodeId:null,highlightIds:n,activeHitId:r,bigChangeLines:a,onSelect:t=>o(e.sessionId,t.message.id),onUnfold:s}),(0,R.jsx)(Zp,{git:t,onResize:t=>c(e.sessionId,t),onDone:t=>l(e.sessionId,t)})]})}function kg({data:e}){let{openSession:t,openSessionCard:n,openNode:r,openContinue:i,selection:a,openIds:o,person:s}=(0,_.useContext)(Dg),c=(0,_.useMemo)(()=>ep(e.model.captures),[e.model.captures]);return(0,R.jsxs)(`div`,{className:`map-node`,children:[(0,R.jsx)(em,{model:e.model,graph:e.graph,selectedSessionId:a?.type===`session`?a.sessionId:null,openIds:o,highlightSessionIds:e.sessionHits,person:s,captured:c,onOpen:t,onOpenCard:n,onContinue:i}),e.openings.map(t=>{let n=e.activeHit;return(0,R.jsx)(`div`,{className:`session-open`,style:{top:t.top,left:t.left},children:(0,R.jsx)(Og,{session:t.session,git:t.git,highlights:e.highlights.get(t.session.sessionId),activeHitId:n?.sessionId===t.session.sessionId?n.messageId:null})},t.session.sessionId)})]})}var Ag={project:kg};function jg(e,t){let n=ip(e);if(n===null)return null;let r=n.messageId===null?{sessionId:n.sessionId}:{sessionId:n.sessionId,messageId:n.messageId};return t?{...r,quiet:t}:r}function Mg(e){if(typeof window>`u`)return null;let t=new URLSearchParams(window.location.hash.replace(/^#/,``));if(!t.has(`focus`)&&!t.has(`s`))return jg(e,!0);if(t.get(`focus`)===`head`){let t=ip(e);return t===null?null:t.messageId===null?{sessionId:t.sessionId}:{sessionId:t.sessionId,messageId:t.messageId}}let n=t.get(`s`);if(n===null||n===``)return null;let r=Pg(e,n);if(r===void 0)return null;let i=t.get(`m`);return i!==null&&r.messages.some(e=>e.id===i)?{sessionId:n,messageId:i}:{sessionId:n}}function Ng(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}function Pg(e,t){return e.sessions.find(e=>e.sessionId===t)}function Fg({model:e,search:t}){dg();let[n]=(0,_.useState)(()=>Mg(e));(0,_.useEffect)(()=>{n?.messageId!==void 0&&document.querySelector(`.lineage-map`)?.scrollIntoView({block:`start`})},[n]);let[r,i]=(0,_.useState)(()=>yg(e,e.openSessions,n)),[a,o]=(0,_.useState)(()=>new Set),s=(0,_.useCallback)(e=>{o(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),[c,l]=(0,_.useState)(()=>n===null||n.quiet?null:n.messageId===void 0?{type:`session`,sessionId:n.sessionId}:{type:`node`,sessionId:n.sessionId,nodeId:n.messageId}),[u,d]=(0,_.useState)(()=>new Set),[f,p]=(0,_.useState)(()=>Yp(e.rowWidths)),[m,h]=(0,_.useState)(0),g=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let t=pe();t!==null&&he(e.project.path,t).then(t=>{p(Yp(t.rowWidths));let r=yg(e,t.open,n);i(e=>Ng(e,r)?e:(h(e=>e+1),r))}).catch(()=>{}).finally(()=>{g.current=!0})},[]),(0,_.useEffect)(()=>{let t=pe();if(t===null||!g.current)return;let n=window.setTimeout(()=>{let n=pg({open:r,bySearch:a});F(e.project.path,n,t).catch(e=>{console.warn(`cogit: could not save the open sessions`,e)})},300);return()=>window.clearTimeout(n)},[r,a,e.project.path]);let v=(0,_.useCallback)((e,t)=>{p(n=>{let{[e]:r,...i}=n;return t===520?i:{...i,[e]:t}})},[]),y=(0,_.useCallback)((t,n)=>{let r=pe();r!==null&&I(e.project.path,t,n===520?null:n,r).catch(e=>{console.warn(`cogit: could not save the row width`,e)})},[e.project.path]),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!0),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),M=(0,_.useMemo)(()=>Gp(e),[e]),ee=(0,_.useMemo)(()=>M.options(),[M]),{expanded:N,toggle:te}=pp(),ne=e.settings?.bigChangeLines??300,re=Xf(e.captures,e.settings?.captures),[ie,P]=(0,_.useState)(()=>n===null?null:n.messageId===void 0?`session:${n.sessionId}`:`node:session:${n.sessionId}:${n.messageId}`),se=ip(e),ce=t.hash?.kind===`ok`?t.hash:null,le=t.hits[Math.min(t.active,t.hits.length-1)]??null,ue=(0,_.useMemo)(()=>ce===null?le===null?null:{sessionId:le.sessionId,messageId:le.messageId}:{sessionId:ce.sessionId,messageId:ce.messageId},[ce?.sessionId,ce?.messageId,le?.sessionId,le?.messageId]),de=(0,_.useMemo)(()=>oe(t.hits),[t.hits]),fe=(0,_.useMemo)(()=>new Set(t.hits.flatMap(e=>e.messageId===null?[e.sessionId]:[])),[t.hits]),me=(0,_.useMemo)(()=>ae(t.hits),[t.hits]),ge=(0,_.useRef)(r);ge.current=r;let _e=(0,_.useRef)(a);_e.current=a,(0,_.useEffect)(()=>{let e=fg({open:ge.current,bySearch:_e.current},me);Ng(e.open,ge.current)||i(e.open),Ng(e.bySearch,_e.current)||o(e.bySearch)},[me]);let ve=c?.type===`node`?c:null,ye=(0,_.useMemo)(()=>{let t=new Map;for(let n of r){let r=Pg(e,n);if(!r)continue;let i={unfolded:u,openAll:b,rowWidth:f[n]??520,headId:se?.sessionId===n?se.messageId:null},a=de.get(n);if(a!==void 0&&a.size>0){let e=Mp(r.messages,i).segments.filter(e=>e.ids.some(e=>a.has(e))).map(e=>e.id);e.length>0&&(i={...i,unfolded:new Set([...u,...e])})}let o=Mp(r.messages,i),s=ve?.sessionId===n?ve.nodeId:null;if(s!==null&&!o.rows.some(e=>e.kind===`message`&&e.message.id===s)){let e=o.segments.find(e=>e.ids.includes(s));e!==void 0&&(o=Mp(r.messages,{...i,unfolded:new Set([...u,e.id])}))}t.set(n,o)}return t},[e,r,u,b,f,de,se?.sessionId,se?.messageId,ve?.sessionId,ve?.nodeId]),be=(0,_.useMemo)(()=>{let e=new Map;for(let[t,n]of ye)e.set(t,wg+(n.rows.length===0?Eg:n.height)+Tg);return e},[ye]),L=(0,_.useMemo)(()=>vg(e,be),[e,be]),xe=(0,_.useMemo)(()=>{let e=[];for(let t of L.git.rows){if(t.kind!==`message`||t.spaceTop===void 0)continue;let n=L.sessions.get(t.message.id),r=ye.get(t.message.id);n&&r&&e.push({session:n,git:r,top:t.spaceTop+wg,left:L.git.graphWidth+8})}return e},[L,ye]),Se=(0,_.useCallback)((e,t)=>{if(t===void 0)return null;let n=xe.find(t=>t.session.sessionId===e),r=n?.git.rows.find(e=>e.kind===`message`&&e.message.id===t);return!n||!r?null:{x:n.left+n.git.graphWidth/2,y:n.top+r.y,left:n.left,right:n.left+n.git.width}},[xe]),Ce=(0,_.useCallback)(e=>{if(e.messageId!==null)return Se(e.sessionId,e.messageId);let t=L.git.rows.find(t=>t.kind===`message`&&t.message.id===e.sessionId);if(t===void 0)return null;let n=L.git.graphWidth+8,r=L.git.rowWidth;return{x:n+r/2,y:t.y,left:n,right:n+r}},[Se,L]),we=(0,_.useMemo)(()=>n===null?null:Se(n.sessionId,n.messageId),[n,Se]),[Te,Ee]=(0,_.useState)(0),[De,Oe]=(0,_.useState)(0),ke=(0,_.useMemo)(()=>jg(e,!0),[e]),Ae=(0,_.useMemo)(()=>Te===0||ke===null?null:{key:Te,point:Se(ke.sessionId,ke.messageId)},[Te,ke,Se]),je=(0,_.useMemo)(()=>ue===null?null:Ce(ue),[ue,Ce]),Me=(0,_.useMemo)(()=>t.step===0||je===null?null:{key:t.step,point:je},[t.step,je]),Ne=(0,_.useCallback)(e=>{s(e),i(t=>t.has(e)?t:new Set([...t,e]))},[s]),[Pe,Fe]=(0,_.useState)(0),Ie=(0,_.useCallback)(e=>{if(s(e),Fe(0),r.has(e)){let t=new Set(r);t.delete(e),i(t),l(t=>t?.sessionId===e?null:t)}else i(new Set([...r,e])),P(`session:${e}`)},[r,s]),Le=(0,_.useCallback)(e=>{s(e),P(`session:${e}`),l({type:`session`,sessionId:e}),Fe(e=>e+1),Ze(e),Ye(e=>e+1)},[s]),Re=(0,_.useCallback)((e,t)=>{Ne(e),Fe(0),P(`node:session:${e}:${t}`),l({type:`node`,sessionId:e,nodeId:t})},[Ne]),ze=(0,_.useCallback)((e,t)=>Re(e,t),[Re]);(0,_.useEffect)(()=>{ce!==null&&Re(ce.sessionId,ce.messageId)},[ce?.sessionId,ce?.messageId,Re]),(0,_.useEffect)(()=>{function t(){let t=Mg(e);t!==null&&(Ne(t.sessionId),t.messageId!==void 0&&Re(t.sessionId,t.messageId),document.querySelector(`.lineage-map`)?.scrollIntoView({block:`start`}))}return window.addEventListener(`hashchange`,t),()=>window.removeEventListener(`hashchange`,t)},[e,Ne,Re]);let Be=(0,_.useCallback)(e=>{d(t=>{let n=new Set(t);return n.add(e),n})},[]),Ve=(0,_.useCallback)(e=>{Fe(0),P(e.focusId),e.sessionId!==null&&Ne(e.sessionId),l(e.selection)},[Ne]),He=(0,_.useCallback)(e=>{T(!0),C(!1),k(!1),D(t=>({path:e,key:(t?.key??0)+1}))},[]),[Ue,We]=(0,_.useState)(0),Ge=(0,_.useCallback)(e=>{Re(e.sessionId,e.messageId),We(e=>e+1)},[Re]),Ke=(0,_.useMemo)(()=>ve===null?null:Se(ve.sessionId,ve.nodeId),[ve?.sessionId,ve?.nodeId,Se]),qe=(0,_.useMemo)(()=>Ue===0||Ke===null?null:{key:Ue,point:Ke},[Ue,Ke]),[Je,Ye]=(0,_.useState)(0),[Xe,Ze]=(0,_.useState)(null),Qe=(0,_.useMemo)(()=>Xe===null?null:Ce({sessionId:Xe,messageId:null}),[Xe,Ce]),$e=(0,_.useMemo)(()=>Je===0||Qe===null?null:{key:Je,point:Qe},[Je,Qe]),et=(0,_.useMemo)(()=>({selection:c,openIds:r,bigChangeLines:ne,openSession:Ie,openSessionCard:Le,openNode:Re,openContinue:ze,unfold:Be,resizeRows:v,storeRowWidth:y,person:A,people:M}),[c,r,ne,Ie,Le,Re,ze,Be,v,y,A,M]),tt=(0,_.useMemo)(()=>{let t=Math.max(L.git.width,...xe.map(e=>e.left+e.git.width));return[{id:`project`,type:`project`,position:{x:0,y:0},width:t,height:L.git.height,style:{width:t,height:L.git.height},draggable:!1,connectable:!1,selectable:!1,data:{model:e,graph:L,openings:xe,highlights:de,sessionHits:fe,activeHit:ue}}]},[e,L,xe,de,fe,ue]);return(0,R.jsx)(Dg.Provider,{value:et,children:(0,R.jsxs)(`div`,{className:N?`map-shell is-expanded`:`map-shell`,children:[(0,R.jsxs)(`div`,{className:`map-toolbar`,children:[(0,R.jsx)(`span`,{className:`map-title`,children:`${L.git.rows.length} session${L.git.rows.length===1?``:`s`}`}),ke?(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,title:`Open the newest session and go to its newest message`,onClick:()=>{Ne(ke.sessionId),Ee(e=>e+1),document.querySelector(`.lineage-map`)?.scrollIntoView({block:`start`})},children:`↧ Left off here`}):null,(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,"aria-pressed":b,title:b?`Close every session and fold long branches again`:`Open every session and every folded branch`,onClick:()=>{i(b?new Set:new Set(L.sessions.keys())),o(new Set),b&&Oe(e=>e+1),x(e=>!e),d(new Set)},children:b?`Fold all`:`Unfold all`}),ee.length>0?(0,R.jsx)(`select`,{className:`person-filter`,"aria-label":`Whose sessions`,title:`Fade the other people's sessions; the lines between them stay`,value:qp(A),onChange:e=>j(Kp(e.target.value)),children:ee.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))}):null,(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,"aria-pressed":N,onClick:te,children:N?`Exit full screen`:`Full screen`}),(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,"aria-pressed":S,onClick:()=>{C(e=>!e),T(!1),k(!1)},children:S?`Hide outline`:`Show outline`}),(0,R.jsx)(`button`,{type:`button`,className:`outline-button`,"aria-pressed":w,title:`Which conversations touched which file`,onClick:()=>{T(e=>!e),C(!1),k(!1)},children:w?`Hide files`:`Files`}),re?(0,R.jsx)(`button`,{type:`button`,className:`outline-button capture-button`,"aria-pressed":O,title:`Tasks: what your sessions left undone — cogit drafts, you decide`,onClick:()=>{k(e=>!e),T(!1),C(!1)},children:O?`Hide tasks`:`Tasks`}):null]}),(0,R.jsxs)(`div`,{className:`graph-wrap`,children:[O?(0,R.jsx)($,{captures:e.captures,sessions:e.sessions,dir:e.project.path,onSelectSession:Le,onClose:()=>k(!1)}):w?(0,R.jsx)(fp,{files:e.files,sessions:e.sessions,active:c?.type===`node`?{sessionId:c.sessionId,messageId:c.nodeId}:null,focus:E,onSelect:Ge,onClose:()=>T(!1)}):S?(0,R.jsx)(Vp,{model:e,activeId:ie,onSelect:Ve,onClose:()=>C(!1)}):null,(0,R.jsx)(`div`,{className:`graph-canvas`,children:L.git.rows.length===0?(0,R.jsx)(`p`,{className:`graph-status empty`,children:e.recordDownloadFailed===!0?`Your team's session records could not be downloaded. Check your connection and run cogit open again.`:`No sessions recorded yet. They appear here as you work with Claude Code.`}):(0,R.jsx)(Ig,{nodes:tt,focusRow:we,jump:Ae,searchJump:Me,fileJump:qe,sessionJump:$e,fit:De,refocus:m})}),(0,R.jsx)(ag,{model:e,selection:c,captureReveal:Pe,onClose:()=>{l(null),Fe(0)},onNavigate:Ve,onOpenFileHistory:He,bigChangeLines:ne})]})]})})}function Ig({nodes:e,focusRow:t,jump:n,searchJump:r,fileJump:i,sessionJump:a,fit:o,refocus:s}){let{fitView:c,setViewport:l}=ou(),u=bg();function d(e){let t=document.querySelector(`.react-flow`)?.getBoundingClientRect();t&&l(up(e,t,.9),{duration:300})}(0,_.useEffect)(()=>{if(o===0)return;let e=window.setTimeout(()=>void c({padding:.12,maxZoom:1,duration:300}),50);return()=>window.clearTimeout(e)},[o]);let f=n?.key??0,p=n?.point??null;(0,_.useEffect)(()=>{f!==0&&p!==null&&d(p)},[f]);let m=r?.key??0,h=r?.point??null;(0,_.useEffect)(()=>{m!==0&&h!==null&&d(h)},[m,h]);let g=i?.key??0,v=i?.point??null;(0,_.useEffect)(()=>{g!==0&&v!==null&&d(v)},[g,v]);let y=a?.key??0,b=a?.point??null;return(0,_.useEffect)(()=>{y!==0&&b!==null&&d(b)},[y,b]),(0,_.useEffect)(()=>{if(s===0||t===null)return;let e=document.querySelector(`.react-flow`)?.getBoundingClientRect();e&&l(up(t,e,.9))},[s]),(0,_.useEffect)(()=>{let e=window.setTimeout(()=>{let e=document.querySelector(`.react-flow`)?.getBoundingClientRect();t&&e?l(up(t,e,.9)):c({padding:.12,maxZoom:1,duration:200})},80);return()=>window.clearTimeout(e)},[]),(0,R.jsx)(cf,{proOptions:{hideAttribution:!0},nodes:e,edges:[],nodeTypes:Ag,fitView:!0,panOnScroll:!0,minZoom:.05,maxZoom:2,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,colorMode:u,children:(0,R.jsx)(Sf,{showInteractive:!1})})}function Lg({model:e,search:t}){return(0,R.jsx)(`section`,{className:`lineage-map`,"aria-label":`Project lineage graph`,children:(0,R.jsx)(rf,{children:(0,R.jsx)(Fg,{model:e,search:t})})})}function Rg(e){let t=fe()?`/map?dir=${encodeURIComponent(e.projectPath)}`:e.mapUrl,n=new URLSearchParams({s:e.sessionId});return e.messageId!==void 0&&n.set(`m`,e.messageId),`${t}#${n.toString()}`}function zg(e){let t=0;for(let n of e)t=t*31+(n.codePointAt(0)??0)>>>0;return t%6}function Bg({row:e}){let t=[e.goal===``?``:`Goal: ${e.goal}`,e.lastDecision===``?``:`Last decision: ${e.lastDecision}`,e.pending.length===0?``:`Open: ${e.pending.map(e=>e.text).join(`; `)}`].filter(e=>e!==``);return t.length===0?null:(0,R.jsxs)(`p`,{className:`inbox-where`,children:[(0,R.jsx)(`span`,{className:`muted`,children:`Where we were, from the record:`}),` `,t.join(` · `)]})}function Vg({rows:e,collapsible:t=!1}){let[n,r]=(0,_.useState)(!t),[i,a]=(0,_.useState)(new Set),[o,s]=(0,_.useState)(null),c=e.filter(e=>!i.has(Q(e.projectPath,e.sessionId)));if(c.length===0)return null;let l=new Date().toISOString();function u(e){let t=Q(e.projectPath,e.sessionId);s(null),a(e=>new Set(e).add(t));let n=pe();n!==null&&ge(e.projectPath,e.sessionId,e.at,n).catch(e=>{s(e instanceof Error?e.message:String(e)),a(e=>{let n=new Set(e);return n.delete(t),n})})}return(0,R.jsxs)(`section`,{className:`inbox`,"aria-labelledby":`inbox-title`,children:[(0,R.jsx)(`h2`,{id:`inbox-title`,children:t?(0,R.jsxs)(`button`,{type:`button`,className:`inbox-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[(0,R.jsx)(`span`,{className:`inbox-caret`,children:n?`▾`:`▸`}),` Your turn`,` `,(0,R.jsx)(`span`,{className:`muted inbox-count`,children:c.length})]}):(0,R.jsxs)(R.Fragment,{children:[`Your turn `,(0,R.jsx)(`span`,{className:`muted inbox-count`,children:c.length})]})}),n?(0,R.jsx)(`ul`,{className:`inbox-rows`,children:c.map(e=>(0,R.jsxs)(`li`,{className:`inbox-row`,style:{borderLeftColor:`var(--l${zg(e.projectPath)})`},children:[(0,R.jsxs)(`div`,{className:`inbox-head`,children:[(0,R.jsx)(`span`,{className:`inbox-project`,title:e.projectPath,children:e.projectName}),(0,R.jsx)(`span`,{className:`inbox-session`,children:e.sessionTitle}),(0,R.jsx)(`span`,{className:e.signal===`record`?`inbox-age is-record`:`inbox-age`,title:Wf(e.at),children:e.signal===`record`?`the record says it needs you · ${Hf(e.at,l)}`:`your turn for ${Hf(e.at,l)}`}),(0,R.jsx)(`button`,{type:`button`,className:`inbox-dismiss`,"aria-label":`Dismiss`,title:pe()===null?`Hide until this page is reloaded`:`Hide until the agent writes in this session again`,onClick:()=>u(e),children:`×`})]}),e.lastMessage===void 0?null:(0,R.jsx)(`p`,{className:`inbox-message`,children:e.lastMessage}),e.signal===`both`?(0,R.jsx)(`p`,{className:`inbox-signal`,children:`The record says it needs you.`}):null,(0,R.jsx)(Bg,{row:e}),(0,R.jsxs)(`div`,{className:`inbox-actions`,children:[(0,R.jsx)(`a`,{className:`inbox-open`,href:Rg(e),children:e.messageId===void 0?`Open the map →`:`Open at this message →`}),(0,R.jsx)(xm,{projectPath:e.projectPath,sessionId:e.sessionId,available:e.transcriptAvailable})]})]},Q(e.projectPath,e.sessionId)))}):null,o===null?null:(0,R.jsx)(`p`,{className:`muted inbox-error`,children:o})]})}function Hg({value:e,state:t,onQuery:n,onStep:r,onClear:i}){let a=(0,_.useRef)(null);(0,_.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`f`&&document.activeElement!==a.current&&(e.preventDefault(),a.current?.focus(),a.current?.select())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);function o(e){e.key===`Escape`?(e.preventDefault(),i(),a.current?.blur()):t.hash===null&&e.key===`Enter`&&(e.preventDefault(),r(e.shiftKey?-1:1))}let s=t.hits.length,c=Math.min(t.active,s-1),l=t.hash===null?e.trim()===``?``:s===0?`0 hits`:`${c+1} / ${s}`:t.hash.kind===`ok`?`1 / 1`:t.hash.kind===`ambiguous`?`${t.hash.count} matches`:`no match`,u=t.hash===null?s===0&&e.trim()!==``?`no matches`:null:t.hash.kind===`ok`?`→ ${t.hash.label??t.hash.messageId} · ${t.hash.title}`:t.hash.kind===`ambiguous`?`several messages match — type more of the hash`:`no recorded message has that hash`;return(0,R.jsxs)(`div`,{className:`map-search`,role:`search`,children:[(0,R.jsxs)(`div`,{className:`map-search-row`,children:[(0,R.jsx)(`input`,{ref:a,type:`search`,className:`map-search-input`,placeholder:`Search the lineage`,"aria-label":`Search the lineage`,value:e,onChange:e=>n(e.target.value),onKeyDown:o}),l===``?null:(0,R.jsx)(`span`,{className:`map-search-count`,children:l}),t.hash===null&&s>0?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,className:`map-search-step`,"aria-label":`Previous hit`,title:`Previous hit (Shift+Enter)`,disabled:c<=0,onClick:()=>r(-1),children:`↑`}),(0,R.jsx)(`button`,{type:`button`,className:`map-search-step`,"aria-label":`Next hit`,title:`Next hit (Enter)`,disabled:c>=s-1,onClick:()=>r(1),children:`↓`})]}):null]}),u===null?null:(0,R.jsx)(`p`,{className:`map-search-hint`,children:u})]})}o(((e,t)=>{t.exports={}}))();function Ug(e){return e.slice(0,6)}function Wg(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>`${e.name} ${e.path} ${e.leftOff}`.toLowerCase().includes(n))}function Gg(e){return`${fe()?`/map?dir=${encodeURIComponent(e.path)}`:e.lineageUrl}#focus=head`}function Kg(){return/mac/i.test(navigator.platform)?`⌘ K`:`Ctrl K`}function qg({model:e}){let t=(0,_.useMemo)(()=>e.switcher??[],[e.switcher]),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(0),c=(0,_.useRef)(null),l=(0,_.useMemo)(()=>Wg(t,i),[t,i]),u=Ug(t);if((0,_.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`?(e.preventDefault(),r(e=>!e),a(``),s(0)):e.key===`Escape`&&r(!1)}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,_.useEffect)(()=>{n&&c.current?.focus()},[n]),t.length===0)return null;function d(e){window.location.href=Gg(e)}function f(e){if(e.key===`ArrowDown`)e.preventDefault(),s(e=>Math.min(e+1,Math.max(l.length-1,0)));else if(e.key===`ArrowUp`)e.preventDefault(),s(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=l[o];t&&d(t)}}return(0,R.jsxs)(`div`,{className:`switcher`,children:[(0,R.jsxs)(`nav`,{className:`switcher-tabs`,"aria-label":`Recent projects`,children:[u.map(e=>(0,R.jsxs)(`a`,{"aria-current":e.current?`page`:void 0,className:e.current?`switcher-tab is-current`:`switcher-tab`,href:Gg(e),title:e.leftOff||e.path,children:[(0,R.jsx)(`span`,{className:`switcher-name`,children:e.name}),(0,R.jsx)(`span`,{className:`switcher-time`,children:Gf(e.lastActivity)})]},e.path)),(0,R.jsxs)(`button`,{type:`button`,className:`switcher-more`,onClick:()=>{r(!0),a(``),s(0)},"aria-haspopup":`dialog`,children:[`Switch project `,(0,R.jsx)(`kbd`,{children:Kg()})]})]}),n?(0,R.jsx)(`div`,{className:`switcher-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,R.jsxs)(`div`,{className:`switcher-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Switch project`,children:[(0,R.jsx)(`input`,{ref:c,className:`switcher-input`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`switcher-results`,"aria-activedescendant":l[o]?`switcher-${o}`:void 0,"aria-autocomplete":`list`,placeholder:`Search projects by name, path or where you left off…`,value:i,onChange:e=>{a(e.target.value),s(0)},onKeyDown:f}),l.length===0?(0,R.jsx)(`p`,{className:`empty switcher-none`,children:`No project matches.`}):(0,R.jsx)(`ul`,{className:`switcher-results`,id:`switcher-results`,role:`listbox`,children:l.map((e,t)=>(0,R.jsxs)(`li`,{id:`switcher-${t}`,role:`option`,"aria-selected":t===o,className:t===o?`switcher-result is-active`:`switcher-result`,onMouseMove:()=>s(t),onClick:()=>d(e),children:[(0,R.jsxs)(`span`,{className:`switcher-result-head`,children:[(0,R.jsx)(`span`,{className:`switcher-name`,children:e.name}),e.current?(0,R.jsx)(`span`,{className:`badge`,children:`current`}):null,(0,R.jsx)(`span`,{className:`switcher-time`,children:Wf(e.lastActivity)})]}),(0,R.jsx)(`span`,{className:`switcher-leftoff`,children:e.leftOff||`Nothing recorded yet.`}),(0,R.jsx)(`span`,{className:`switcher-path`,children:e.path})]},e.path))}),(0,R.jsx)(`p`,{className:`switcher-hint`,children:`↑↓ to move · Enter to open · Esc to close`})]})}):null]})}var Jg=[{key:`recorder`,label:`Recording`,help:`How much of the chat goes into the record.`,details:"Economical (recommended): a small model records in the background every few turns and closes each session with one pass that finds its threads, writes the branch summaries and one line on where the session left off. The agent is never interrupted; it costs about a cent per session. Detailed: on top of that, the main agent records its own decisions every 15 turns. It catches the agent's technical choices best and costs about 1–2% of a session. A third mode, where only the main agent records, is set with `cogit config set recorder agent`.",kind:`select`,options:[{value:`side`,label:`Economical (recommended)`},{value:`mixed`,label:`Detailed`}]},{key:`messageSummaries`,label:`One-line summary under each message`,help:`A sentence under each message title on the map.`,details:`A one-sentence summary under each message title, so a skim reads better. Off keeps the record shorter and cheaper. Branch summaries and the line on where a session left off are written either way.`,kind:`boolean`},{key:`startupContext`,label:`Record at session start`,help:`Hand the agent the previous session's record when a chat starts.`,details:`When a chat starts, the agent gets a short summary of where the previous session left off and how to read the record. It costs a few tokens; turn it off if your projects are unrelated.`,kind:`boolean`},{key:`recordHeadless`,label:`Headless sessions`,help:"Record sessions that start without a person, such as `claude -p`.",details:"Some plugins and scripts run `claude -p` in the background, often once per prompt. Off, cogit leaves those sessions out of the map and the inbox. Turn it on if you do real work through `claude -p` or the SDK and want it recorded.",kind:`boolean`},{key:`tryBeforeNotes`,label:`Tried-before notes`,help:`Before the agent edits a file, tell it which options earlier thoughts rejected for it.`,details:`Before the agent edits a file, it hears which options earlier thoughts tried and rejected for that file. These are notes from the record, never rules; they can make the agent ask before repeating a dead end.`,kind:`boolean`},{key:`shapes`,label:`Intent, Shape and Code`,help:`A small picture of what each change does, beside its reason and its diff.`,details:`For every message that landed commits, a small representation of what the change does: numbered plain-language steps or a Mermaid diagram. It sits between the record's intent (the decision, reason and rejected options) and the code (the diff), so a reviewer sees why, what and how in one place. The recorder writes it, not you; it costs one small model call per such message. Off, the map says so and nothing is written.`,kind:`boolean`},{key:`captures`,label:`Tasks`,help:`A short list of what each session left undone, drafted by the side model.`,details:`When a session ends, the side model reads what its record left open and drafts at most three things a person would ask for, in the conversation's language. The list is yours: accept, dismiss or close each item. Sessions with nothing open cost no model call; the map's Tasks button appears only while something waits or is open. Off, nothing is drafted and the list already in the store is kept, not deleted.`,kind:`boolean`},{key:`language`,label:`Language`,help:"Language the agent writes records in; `auto` follows the chat.",details:`The language the record is written in. With auto, it follows the language of the conversation.`,kind:`text`},{key:`shareConversations`,label:`Share conversations`,help:`Send the raw chat text too, not only the session record (off: chat stays local).`,details:`In a project that shares its record, also send the raw chat text. Leave it off to keep conversations on your machine while teammates still see titles, decisions and reasons.`,kind:`boolean`}];function Yg(e){return[{title:`Recording`,fields:Jg.map(t=>({...t,editable:e}))}]}var Xg={recorder:`side`,language:`auto`,updateEveryTurns:15,sideEveryTurns:5,sessionEndCatchUp:!0,sideModel:`haiku`,messageSummaries:!1,startupContext:!0,recordHeadless:!1,tryBeforeNotes:!0,shapes:!0,captures:!0,shareConversations:!1,agents:[`claude-code`],bigChangeLines:300};function Zg(e){return{...Xg,...e}}function Qg(e){return Array.isArray(e)?e.length>0?e.join(`, `):`—`:typeof e==`boolean`?e?`yes`:`no`:e===void 0?`—`:String(e)}function $g({id:e,field:t}){return(0,R.jsx)(Fm,{id:e,label:`What does ${t.label} do?`,children:t.details})}function e_(e,t){return e.kind===`boolean`?!!t:e.kind===`number`?Number(t):String(t)}function t_(e,t,n){return e.kind===`boolean`?!!t!=!!n:String(t)!==String(n)}function n_({id:e,field:t,value:n,draft:r,error:i,onChange:a}){let o=r??(t.kind===`boolean`?!!n:String(n));return(0,R.jsxs)(`div`,{className:r===void 0?`settings-field`:`settings-field is-changed`,children:[(0,R.jsxs)(`div`,{className:`settings-field-text`,children:[(0,R.jsxs)(`span`,{className:`settings-label`,children:[(0,R.jsx)(`label`,{htmlFor:e,children:t.label}),(0,R.jsx)($g,{id:e,field:t})]}),(0,R.jsx)(`p`,{className:`settings-help`,id:`${e}-help`,children:t.help})]}),(0,R.jsxs)(`div`,{className:`setting-form`,children:[t.kind===`boolean`?(0,R.jsx)(`input`,{id:e,type:`checkbox`,checked:!!o,"aria-describedby":`${e}-help`,onChange:e=>a(t,e.target.checked)}):t.kind===`select`?(0,R.jsxs)(`select`,{id:e,value:String(o),"aria-describedby":`${e}-help`,onChange:e=>a(t,e.target.value),children:[(t.options??[]).map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value)),(t.options??[]).some(e=>e.value===String(o))?null:(0,R.jsx)(`option`,{value:String(o),children:String(o)})]}):(0,R.jsx)(`input`,{id:e,type:t.kind===`number`?`number`:`text`,value:String(o),"aria-describedby":`${e}-help`,onChange:e=>a(t,e.target.value)}),i?(0,R.jsx)(`span`,{className:`setting-error`,children:i}):null]})]})}function r_({embedded:e,onClose:t}){let n=fe()?pe():null,[r,i]=(0,_.useState)(()=>Zg(e)),[a,o]=(0,_.useState)(n!==null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)({}),[d,f]=(0,_.useState)({}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null),v=(0,_.useRef)(null);(0,_.useEffect)(()=>{v.current?.focus()},[]),(0,_.useEffect)(()=>{function e(e){e.key===`Escape`&&t()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,_.useEffect)(()=>{if(!n)return;let e=!0;return me(n).then(t=>{e&&i(e=>({...e,...t}))}).catch(t=>{e&&c(t instanceof Error?t.message:String(t))}).finally(()=>{e&&o(!1)}),()=>{e=!1}},[n]);let y=n!==null,b=Yg(y),x=new Map(b.flatMap(e=>e.fields).map(e=>[e.key,e])),S=Object.keys(l);function C(e,t){u(n=>{let i={...n};return t_(e,t,r[e.key])?i[e.key]=t:delete i[e.key],i}),f(t=>{let n={...t};return delete n[e.key],n}),g(null)}async function w(e){if(e.preventDefault(),!n||p||S.length===0)return;m(!0),g(null);let t={};for(let e of S){let r=x.get(e),a=l[e];if(!r||a===void 0)continue;let o=e_(r,a);try{await Se(e,o,n),i(t=>({...t,[e]:o})),u(t=>{let n={...t};return delete n[e],n})}catch(n){t[e]=n instanceof Error?n.message:String(n)}}f(t);let r=Object.keys(t).length;g(r===0?`Saved`:`${r} not saved`),m(!1)}return(0,R.jsx)(`div`,{className:`settings-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,R.jsxs)(`div`,{className:`settings-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,children:[(0,R.jsxs)(`div`,{className:`settings-head`,children:[(0,R.jsx)(`h2`,{id:`settings-title`,children:`Settings`}),(0,R.jsx)(`button`,{ref:v,type:`button`,className:`settings-close`,"aria-label":`Close settings`,onClick:t,children:`×`})]}),(0,R.jsx)(`p`,{className:`muted`,children:y?`A change here applies to new builds and chats.`:"Read-only. Open this page with `cogit open` to change settings, or use `cogit config set <key> <value>`."}),a?(0,R.jsx)(`p`,{className:`settings-help`,children:`Reading the current settings…`}):null,s?(0,R.jsx)(`p`,{className:`setting-error`,children:s}):null,(0,R.jsxs)(`form`,{onSubmit:w,children:[b.map(e=>(0,R.jsxs)(`section`,{className:`settings-section`,"aria-label":e.title,children:[(0,R.jsx)(`h3`,{children:e.title}),e.fields.map(e=>{let t=`setting-${e.key}`,i=r[e.key];return e.editable&&n?(0,R.jsx)(n_,{id:t,field:e,value:i,draft:l[e.key],error:d[e.key],onChange:C},e.key):(0,R.jsxs)(`div`,{className:`settings-field`,children:[(0,R.jsxs)(`div`,{className:`settings-field-text`,children:[(0,R.jsxs)(`span`,{className:`settings-label`,children:[e.label,(0,R.jsx)($g,{id:t,field:e})]}),(0,R.jsx)(`p`,{className:`settings-help`,id:`${t}-help`,children:e.help})]}),(0,R.jsx)(`span`,{className:`settings-value`,children:Qg(i)})]},e.key)})]},e.title)),y?(0,R.jsxs)(`div`,{className:`settings-foot`,children:[(0,R.jsx)(`span`,{className:`setting-status`,role:`status`,children:p?`Saving…`:S.length>0?`${S.length} unsaved ${S.length===1?`change`:`changes`}`:h??``}),(0,R.jsx)(`button`,{type:`submit`,disabled:S.length===0||p,children:`Save`})]}):null]})]})})}function i_({settings:e}){let[t,n]=(0,_.useState)(!1),r=(0,_.useRef)(null);function i(){n(!1),r.current?.focus()}return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{ref:r,type:`button`,className:`settings-button`,"aria-haspopup":`dialog`,"aria-expanded":t,onClick:()=>n(!0),children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,children:`⚙`}),` Settings`]}),t?(0,R.jsx)(r_,{embedded:e,onClose:i}):null]})}function a_({model:e}){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)(0),s=(0,_.useDeferredValue)(t),c=(0,_.useMemo)(()=>se(s)?ce(e,s):null,[e,s]),l=(0,_.useMemo)(()=>c===null?le(e,s):[],[e,s,c]),u={hits:l,active:r,step:a,hash:c};function d(e){n(e),i(0),o(e=>e+1)}function f(e){i(t=>P(t,l.length,e)),o(e=>e+1)}function p(){n(``),i(0),o(0)}return(0,R.jsxs)(`main`,{className:`map-page`,children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`div`,{className:`page-bar page-bar-centered`,children:[(0,R.jsx)(we,{}),(0,R.jsxs)(`div`,{className:`page-title`,children:[(0,R.jsx)(`h1`,{children:e.project.name}),(0,R.jsx)(`p`,{className:`muted`,children:e.project.path})]}),(0,R.jsxs)(`div`,{className:`page-bar-actions`,children:[(0,R.jsx)(Hg,{value:t,state:u,onQuery:d,onStep:f,onClear:p}),(0,R.jsx)(Cg,{}),(0,R.jsx)(i_,{settings:e.settings})]})]}),(0,R.jsx)(`header`,{className:`project`,children:(0,R.jsxs)(`div`,{children:[(0,R.jsx)(qg,{model:e}),(0,R.jsx)(Te,{})]})}),(0,R.jsx)(Vg,{rows:e.inbox??[],collapsible:!0})]}),(0,R.jsx)(Lg,{model:e,search:u})]})}function o_(e){return e.lineageUrl?typeof document<`u`&&fe()?`/map?dir=${encodeURIComponent(e.path)}`:e.lineageUrl:null}function s_({model:e}){return(0,R.jsxs)(`main`,{className:`panel-page`,children:[(0,R.jsx)(`div`,{className:`page-bar`,children:(0,R.jsx)(we,{home:!0})}),(0,R.jsxs)(`header`,{className:`project`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h1`,{children:`Projects`}),(0,R.jsx)(`p`,{className:`muted`,children:`Every project cogit knows about.`})]}),(0,R.jsxs)(`div`,{className:`page-actions`,children:[(0,R.jsx)(Cg,{}),(0,R.jsx)(i_,{settings:e.settings}),(0,R.jsxs)(`div`,{className:`meta`,children:[(0,R.jsxs)(`span`,{children:[e.projects.length,` `,e.projects.length===1?`project`:`projects`]}),(0,R.jsxs)(`span`,{className:`muted`,children:[`generated `,Wf(e.generatedAt)]})]})]})]}),(0,R.jsx)(Vg,{rows:e.inbox??[]}),e.projects.length===0?(0,R.jsx)(`p`,{className:`empty`,children:"No projects registered yet. Run `cogit init` in a project."}):(0,R.jsx)(`ul`,{className:`panel-grid`,children:e.projects.map(e=>{let t=o_(e);return(0,R.jsxs)(`li`,{className:e.missing?`card missing`:`card`,children:[(0,R.jsxs)(`div`,{className:`card-head`,children:[(0,R.jsx)(`h2`,{children:e.name}),e.missing?(0,R.jsx)(`span`,{className:`badge`,title:"This directory is gone. `cogit config prune` removes it from the panel.",children:`missing`}):null]}),(0,R.jsx)(`p`,{className:`muted path`,children:e.path}),(0,R.jsxs)(`dl`,{className:`card-facts`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{children:`Last activity`}),(0,R.jsx)(`dd`,{children:Wf(e.lastActivity)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{children:`Waiting on you`}),(0,R.jsx)(`dd`,{children:e.needsUserCount})]})]}),t?(0,R.jsx)(`a`,{className:`card-open`,href:t,children:`Open the map →`}):(0,R.jsx)(`p`,{className:`empty`,children:`Directory not found.`})]},e.path)})})]})}uh();async function c_(){try{let e=await fetch(location.href,{cache:`no-store`});if(!e.ok)return null;let t=new DOMParser().parseFromString(await e.text(),`text/html`).getElementById(y)?.textContent?.trim();return t?ue(t):null}catch{return null}}function l_({initial:e}){let[t,n]=(0,_.useState)(e);return ye(t),(0,_.useEffect)(()=>{if(!fe())return;let e=new EventSource(`/events${location.search}`);return e.addEventListener(`change`,()=>{c_().then(e=>{e&&n(e)})}),()=>e.close()},[]),t.kind===`lineage`?(0,R.jsx)(a_,{model:t}):(0,R.jsx)(s_,{model:t})}var u_=document.getElementById(`root`);if(!u_)throw Error(`missing #root`);de().then(e=>{(0,v.createRoot)(u_).render((0,R.jsx)(_.StrictMode,{children:(0,R.jsx)(l_,{initial:e})}))}).catch(e=>{let t=document.createElement(`p`);t.className=`error`,t.textContent=e instanceof Error?e.message:String(e),u_.replaceChildren(t)});</script><style rel="stylesheet" crossorigin>.react-flow{--xy-edge-stroke-default:#b1b1b7;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#555;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#ffffff80;--xy-minimap-background-color-default:#fff;--xy-minimap-mask-background-color-default:#f0f0f099;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#e2e2e2;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:transparent;--xy-background-pattern-dots-color-default:#91919a;--xy-background-pattern-lines-color-default:#eee;--xy-background-pattern-cross-color-default:#e2e2e2;background-color:var(--xy-background-color,var(--xy-background-color-default));--xy-node-color-default:inherit;--xy-node-border-default:1px solid #1a192b;--xy-node-background-color-default:#fff;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #00000014;--xy-node-boxshadow-selected-default:0 0 0 .5px #1a192b;--xy-node-border-radius-default:3px;--xy-handle-background-color-default:#1a192b;--xy-handle-border-color-default:#fff;--xy-selection-background-color-default:#0059dc14;--xy-selection-border-default:1px dotted #0059dccc;--xy-controls-button-background-color-default:#fefefe;--xy-controls-button-background-color-hover-default:#f4f4f4;--xy-controls-button-color-default:inherit;--xy-controls-button-color-hover-default:inherit;--xy-controls-button-border-color-default:#eee;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#fff;--xy-edge-label-color-default:inherit;--xy-resize-background-color-default:#3367d9;direction:ltr}.react-flow.dark{--xy-edge-stroke-default:#3e3e3e;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#727272;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#96969640;--xy-minimap-background-color-default:#141414;--xy-minimap-mask-background-color-default:#3c3c3c99;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#2b2b2b;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:#141414;--xy-background-pattern-dots-color-default:#555;--xy-background-pattern-lines-color-default:#333;--xy-background-pattern-cross-color-default:#333;--xy-node-color-default:#f8f8f8;--xy-node-border-default:1px solid #3c3c3c;--xy-node-background-color-default:#1e1e1e;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #ffffff14;--xy-node-boxshadow-selected-default:0 0 0 .5px #999;--xy-handle-background-color-default:#bebebe;--xy-handle-border-color-default:#1e1e1e;--xy-selection-background-color-default:#c8c8dc14;--xy-selection-border-default:1px dotted #c8c8dccc;--xy-controls-button-background-color-default:#2b2b2b;--xy-controls-button-background-color-hover-default:#3e3e3e;--xy-controls-button-color-default:#f8f8f8;--xy-controls-button-color-hover-default:#fff;--xy-controls-button-border-color-default:#5b5b5b;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#141414;--xy-edge-label-color-default:#f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props,var(--xy-background-color,var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width,var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke,var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width,var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{pointer-events:none;position:absolute;overflow:visible}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected,var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}svg.react-flow__connectionline{z-index:1001;position:absolute;overflow:visible}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.react-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.react-flow__handle{pointer-events:none;background-color:var(--xy-handle-background-color,var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color,var(--xy-handle-border-color-default));border-radius:100%;width:6px;min-width:5px;height:6px;min-height:5px;position:absolute}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;bottom:0;left:50%;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{z-index:5;margin:15px;position:absolute}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px)translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px)translateY(-50%)}.react-flow__attribution{background:var(--xy-attribution-background-color,var(--xy-attribution-background-color-default));margin:0;padding:2px 3px;font-size:10px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.react-flow__edgelabel-renderer{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__viewport-portal{-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__minimap{background:var(--xy-minimap-background-color-props,var(--xy-minimap-background-color,var(--xy-minimap-background-color-default)))}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var(--xy-minimap-mask-background-color-props,var(--xy-minimap-mask-background-color,var(--xy-minimap-mask-background-color-default)));stroke:var(--xy-minimap-mask-stroke-color-props,var(--xy-minimap-mask-stroke-color,var(--xy-minimap-mask-stroke-color-default)));stroke-width:var(--xy-minimap-mask-stroke-width-props,var(--xy-minimap-mask-stroke-width,var(--xy-minimap-mask-stroke-width-default)))}.react-flow__minimap-node{fill:var(--xy-minimap-node-background-color-props,var(--xy-minimap-node-background-color,var(--xy-minimap-node-background-color-default)));stroke:var(--xy-minimap-node-stroke-color-props,var(--xy-minimap-node-stroke-color,var(--xy-minimap-node-stroke-color-default)));stroke-width:var(--xy-minimap-node-stroke-width-props,var(--xy-minimap-node-stroke-width,var(--xy-minimap-node-stroke-width-default)))}.react-flow__background-pattern.dots{fill:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-dots-color-default)))}.react-flow__background-pattern.lines{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-lines-color-default)))}.react-flow__background-pattern.cross{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-cross-color-default)))}.react-flow__controls{box-shadow:var(--xy-controls-box-shadow,var(--xy-controls-box-shadow-default));flex-direction:column;display:flex}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{background:var(--xy-controls-button-background-color,var(--xy-controls-button-background-color-default));border:none;border-bottom:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)));width:26px;height:26px;color:var(--xy-controls-button-color-props,var(--xy-controls-button-color,var(--xy-controls-button-color-default)));cursor:pointer;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;padding:4px;display:flex}.react-flow__controls-button svg{fill:currentColor;width:100%;max-width:12px;max-height:12px}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{border-radius:var(--xy-node-border-radius,var(--xy-node-border-radius-default));width:150px;color:var(--xy-node-color,var(--xy-node-color-default));text-align:center;border:var(--xy-node-border,var(--xy-node-border-default));background-color:var(--xy-node-background-color,var(--xy-node-background-color-default));padding:10px;font-size:12px}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover,var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected,var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color,var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color,var(--xy-selection-background-color-default));border:var(--xy-selection-border,var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var(--xy-controls-button-background-color-hover-props,var(--xy-controls-button-background-color-hover,var(--xy-controls-button-background-color-hover-default)));color:var(--xy-controls-button-color-hover-props,var(--xy-controls-button-color-hover,var(--xy-controls-button-color-hover-default)))}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)))}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border:1px solid #fff;border-radius:1px;width:5px;height:5px;translate:-50% -50%}.react-flow__resize-control.handle.left{top:50%;left:0}.react-flow__resize-control.handle.right{top:50%;left:100%}.react-flow__resize-control.handle.top{top:0;left:50%}.react-flow__resize-control.handle.bottom{top:100%;left:50%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border-style:solid;border-width:0}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;height:100%;top:0;transform:translate(-50%)}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{width:100%;height:1px;left:0;transform:translateY(-50%)}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color,var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color,var(--xy-edge-label-color-default))}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--bg:#0f1115;--panel:#171a21;--line:#2a2f3a;--text:#e6e8ee;--muted:#9aa3b7;--accent:#7aa2f7;--warn:#e0af68;--capture:#73daca;--l0:#7aa2f7;--l1:#9ece6a;--l2:#e0af68;--l3:#bb9af7;--l4:#7dcfff;--l5:#f7768e;--raised:#1a1e27;--raised-2:#151922;--row-bg:#12151b;--hover:#1d222c;--active:#243040;--chip-bg:#1c222e;--chip-line:#323b4d;--kind-bg:#242a36;--kind-decision-bg:#2b2440;--kind-decision-text:#c0a8ff;--kind-question-bg:#3a2f1d;--kind-message-bg:#23331d;--kind-message-text:#9ece6a;--missing:#a2abbf;--search-hit-bg:#2b2724;--search-active-bg:#373129;--diff-add-bg:#16301c;--diff-add-text:#b7f0c0;--diff-remove-bg:#3a1d23;--diff-remove-text:#ffc4cc;--on-lane:#0f1115;--translucent-panel:#14171ef7;--translucent-outline:#11141af0;--overlay:#05070a9e;--shadow:#00000080}@media (prefers-color-scheme:light){:root:not([data-theme=dark]){--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--bg:#fbfbfd;--panel:#f2f4f8;--line:#d5dae4;--text:#1b2230;--muted:#545e72;--accent:#2957c8;--warn:#8a5300;--capture:#0f766e;--l0:#2957c8;--l1:#2f7d32;--l2:#8a5300;--l3:#6f42c1;--l4:#0b6e99;--l5:#b3261e;--raised:#e9edf5;--raised-2:#eef1f7;--row-bg:#f4f6fa;--hover:#e6ebf5;--active:#d9e3f7;--chip-bg:#e8edf5;--chip-line:#c2cbdb;--kind-bg:#e4e8f0;--kind-decision-bg:#ece4ff;--kind-decision-text:#5b3aa8;--kind-question-bg:#fbf0dc;--kind-message-bg:#e7f3e1;--kind-message-text:#2a7430;--missing:#4f586b;--search-hit-bg:#e7e2dc;--search-active-bg:#e1d9cd;--diff-add-bg:#e2f5e4;--diff-add-text:#145c22;--diff-remove-bg:#fbe4e6;--diff-remove-text:#8a1c26;--on-lane:#fff;--translucent-panel:#fffffff7;--translucent-outline:#f6f8fbf5;--overlay:#141a2659;--shadow:#141e322e}}:root[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--bg:#fbfbfd;--panel:#f2f4f8;--line:#d5dae4;--text:#1b2230;--muted:#545e72;--accent:#2957c8;--warn:#8a5300;--capture:#0f766e;--l0:#2957c8;--l1:#2f7d32;--l2:#8a5300;--l3:#6f42c1;--l4:#0b6e99;--l5:#b3261e;--raised:#e9edf5;--raised-2:#eef1f7;--row-bg:#f4f6fa;--hover:#e6ebf5;--active:#d9e3f7;--chip-bg:#e8edf5;--chip-line:#c2cbdb;--kind-bg:#e4e8f0;--kind-decision-bg:#ece4ff;--kind-decision-text:#5b3aa8;--kind-question-bg:#fbf0dc;--kind-message-bg:#e7f3e1;--kind-message-text:#2a7430;--missing:#4f586b;--search-hit-bg:#e7e2dc;--search-active-bg:#e1d9cd;--diff-add-bg:#e2f5e4;--diff-add-text:#145c22;--diff-remove-bg:#fbe4e6;--diff-remove-text:#8a1c26;--on-lane:#fff;--translucent-panel:#fffffff7;--translucent-outline:#f6f8fbf5;--overlay:#141a2659;--shadow:#141e322e}*{box-sizing:border-box}html,body,#root{height:100%}body:has(.map-page){overflow:hidden}body{background:var(--bg);color:var(--text);margin:0;font:15px/1.5 ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif}main{padding:32px 24px 64px}main.panel-page{width:66.667%;margin-left:auto;margin-right:auto;padding-left:0;padding-right:0}.panel-page .page-bar{margin-bottom:20px}.brand{color:var(--text);letter-spacing:-.02em;flex-direction:column;flex:none;align-self:center;font-size:26px;font-weight:700;line-height:1.1;text-decoration:none;display:inline-flex}.brand-tagline{color:var(--muted);letter-spacing:0;font-size:13px;font-style:italic;font-weight:400}a.brand:hover .brand-tagline{color:var(--text)}.back-link{width:fit-content;color:var(--muted);margin-top:8px;font-size:13px;text-decoration:none;display:block}.back-link:hover{color:var(--text);text-decoration:underline}main.map-page{flex-direction:column;height:100%;padding:20px 0 16px;display:flex}.map-page .page-head,.map-page .lineage-map{width:66.667%;margin-left:auto;margin-right:auto}.map-page .page-head{flex:none}@media (width>=1101px){.map-page .lineage-map:has(.drilldown){width:auto;margin-left:16.667%;margin-right:24px}}.map-page .lineage-map{flex-direction:column;flex:auto;min-height:0;margin-top:8px;padding:0;display:flex;container-type:inline-size}@media (width<=1100px){main.map-page{padding-left:16px;padding-right:16px}.map-page .page-head,.map-page .lineage-map{width:100%}main.panel-page{width:100%;padding-left:16px;padding-right:16px}}.page-head{margin:0}.page-bar{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.page-bar-actions{flex:none;align-items:flex-start;gap:12px;display:flex}.page-bar-centered{grid-template-columns:1fr auto 1fr;align-items:center;display:grid}.page-bar-centered .page-bar-actions{justify-self:end;align-items:center}.page-title{text-align:center;min-width:0}.page-title h1{margin:0;font-size:26px;line-height:1.2}.page-title .muted{text-overflow:ellipsis;white-space:nowrap;margin:2px 0 0;font-size:11px;overflow:hidden}.theme-button{width:36px;height:36px;color:var(--text);background:var(--panel);border:1px solid var(--line);cursor:pointer;border-radius:8px;justify-content:center;align-items:center;padding:0;display:inline-flex}.theme-button:hover{background:var(--hover)}.project .switcher{margin-top:10px;margin-bottom:0}.map-search{flex:none;width:250px}.map-search-row{align-items:center;gap:6px;display:flex}.map-search-input{min-width:0;color:var(--text);font:inherit;background:var(--raised);border:1px solid var(--line);border-radius:7px;flex:auto;padding:5px 10px;font-size:13px}.map-search-input:focus{outline:1px solid var(--accent)}.map-search-count{color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none;font-size:12px}.map-search-step{width:24px;height:26px;color:var(--muted);font:inherit;background:var(--raised);border:1px solid var(--line);cursor:pointer;border-radius:6px;flex:none;padding:0;font-size:12px}.map-search-step:hover:not(:disabled){color:var(--text);border-color:var(--accent)}.map-search-step:disabled{cursor:default;opacity:.4}.map-search-hint{color:var(--muted);text-align:right;text-overflow:ellipsis;white-space:nowrap;margin:4px 0 0;font-size:11px;overflow:hidden}.page-actions{flex-direction:column;align-items:flex-end;gap:8px;display:flex}.settings-button{color:var(--muted);font:inherit;background:var(--raised-2);border:1px solid var(--line);cursor:pointer;border-radius:8px;flex:none;margin-left:auto;padding:6px 12px;font-size:13px}.settings-button:hover{color:var(--text);border-color:var(--accent)}h1,h2,h3{margin:0 0 8px;line-height:1.25}h1{font-size:26px}h2{font-size:20px}h3{font-size:15px}p{margin:4px 0}ul{margin:6px 0;padding-left:20px}.switcher{margin-bottom:18px}.switcher-tabs{align-items:stretch;gap:6px;padding-bottom:2px;display:flex;overflow-x:auto}.switcher-tab{max-width:220px;color:var(--muted);background:var(--raised-2);border:1px solid var(--line);border-radius:8px;flex:none;align-items:baseline;gap:8px;padding:6px 12px;font-size:13px;text-decoration:none;display:flex}.switcher-tab:hover{color:var(--text);border-color:var(--chip-line)}.switcher-tab.is-current{color:var(--text);background:var(--active);border-color:var(--accent)}.switcher-name{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.switcher-time{color:var(--muted);white-space:nowrap;flex:none;font-size:11px}.switcher-more{color:var(--muted);font:inherit;border:1px dashed var(--line);cursor:pointer;background:0 0;border-radius:8px;flex:none;padding:5px 12px;font-size:13px}.switcher-more:hover{color:var(--text);border-color:var(--accent)}.switcher-more kbd{border:1px solid var(--line);border-radius:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px}.switcher-overlay{z-index:200;background:var(--overlay);justify-content:center;align-items:flex-start;padding:12vh 16px 32px;display:flex;position:fixed;inset:0}.switcher-dialog{background:var(--panel);border:1px solid var(--line);width:min(640px,100%);box-shadow:0 20px 60px var(--shadow);border-radius:12px;padding:12px}.switcher-input{width:100%;color:var(--text);font:inherit;background:var(--bg);border:1px solid var(--line);border-radius:8px;padding:9px 12px}.switcher-input:focus{outline:1px solid var(--accent)}.switcher-results{max-height:50vh;margin:8px 0 0;padding:0;list-style:none;overflow-y:auto}.switcher-result{cursor:pointer;border:1px solid #0000;border-radius:8px;padding:8px 10px}.switcher-result.is-active{background:var(--active);border-color:var(--accent)}.switcher-result-head{align-items:baseline;gap:8px;display:flex}.switcher-result-head .switcher-name{font-size:14px;font-weight:600}.switcher-result-head .switcher-time{margin-left:auto}.switcher-leftoff{-webkit-line-clamp:2;-webkit-box-orient:vertical;margin-top:2px;font-size:13px;display:-webkit-box;overflow:hidden}.switcher-path{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;font-size:11px;display:block;overflow:hidden}.switcher-hint{color:var(--muted);margin:8px 2px 0;font-size:11px}.switcher-none{padding:8px 10px}.settings-overlay{z-index:250;background:var(--overlay);justify-content:center;align-items:flex-start;padding:10vh 16px 32px;display:flex;position:fixed;inset:0}.settings-dialog{background:var(--panel);border:1px solid var(--line);width:min(640px,100%);max-height:80vh;box-shadow:0 20px 60px var(--shadow);border-radius:12px;padding:18px 20px 22px;overflow:auto}.settings-head{justify-content:space-between;align-items:center;gap:12px;display:flex}.settings-close{width:28px;height:28px;color:var(--muted);font:inherit;border:1px solid var(--line);cursor:pointer;background:0 0;border-radius:8px;font-size:18px;line-height:1}.settings-close:hover{color:var(--text);border-color:var(--accent)}.settings-section{margin-top:16px}.settings-section h3{color:var(--muted);letter-spacing:.08em;text-transform:uppercase;font-size:12px}.settings-field{border-bottom:1px solid var(--line);justify-content:space-between;align-items:flex-start;gap:16px;padding:10px 0;display:flex}.settings-field:last-child{border-bottom:0}.settings-field-text{min-width:0}.settings-label{align-items:center;gap:6px;font-size:14px;display:inline-flex}.settings-why{box-sizing:border-box;width:18px;height:18px;color:var(--muted);background:var(--panel);border:1px solid var(--line);font:inherit;cursor:help;border-radius:50%;justify-content:center;align-items:center;padding:0;font-size:11px;line-height:1;display:inline-flex}.settings-why-wrap:hover .settings-why,.settings-why:focus-visible{color:var(--text);border-color:var(--muted)}.settings-why-wrap{display:inline-flex;position:relative}.settings-details{z-index:5;width:max-content;max-width:min(46ch,100vw - 64px);color:var(--text);background:var(--panel);border:1px solid var(--line);white-space:normal;border-radius:6px;padding:8px 10px;font-size:12px;font-weight:400;line-height:1.5;position:absolute;top:calc(100% + 6px);left:-8px;box-shadow:0 6px 20px #0000002e}.settings-help{color:var(--muted);margin:2px 0 0;font-size:12px}.settings-value{max-width:40%;color:var(--muted);text-align:right;flex:none;font-size:13px}.settings-field .setting-form{flex-wrap:wrap;flex:none;justify-content:flex-end;max-width:50%}.project{border-bottom:1px solid var(--line);justify-content:space-between;align-items:flex-end;gap:16px;padding-bottom:16px;display:flex}.meta{flex-direction:column;align-items:flex-end;gap:2px;font-size:13px;display:flex}.muted{color:var(--muted);font-size:13px;font-weight:400}.needs-user{color:var(--warn)}.badge{border:1px solid var(--warn);white-space:nowrap;border-radius:999px;margin-left:6px;padding:1px 6px;font-size:11px}.map-shell{flex-direction:column;flex:auto;min-height:0;display:flex}.map-toolbar{flex:none;justify-content:flex-end;align-items:center;gap:8px;margin-top:0;display:flex}.map-title{min-width:0;color:var(--muted);text-overflow:ellipsis;white-space:nowrap;margin-right:auto;font-size:13px;overflow:hidden}body:has(.map-shell.is-expanded){overflow:hidden}.map-shell.is-expanded{z-index:100;background:var(--bg);flex-direction:column;padding:12px;display:flex;position:fixed;inset:0}.map-shell.is-expanded .map-toolbar{margin-top:0}.map-shell.is-expanded .graph-wrap{flex:1;height:auto}.person-filter{color:var(--muted);background:var(--raised);border:1px solid var(--line);font:inherit;border-radius:7px;padding:4px 8px;font-size:13px}.session-row.is-dimmed,.session-rows.is-dimmed{opacity:.35}.outline-button{color:var(--muted);background:var(--raised);border:1px solid var(--line);font:inherit;cursor:pointer;border-radius:7px;padding:5px 12px;font-size:13px}.outline-button:hover,.outline-button[aria-pressed=true]{color:var(--text);border-color:var(--accent)}.graph-wrap{background:var(--row-bg);border:1px solid var(--line);border-radius:12px;flex:auto;min-height:0;margin-top:8px;display:flex;position:relative;overflow:hidden}.graph-canvas{flex:1;min-width:0;height:100%;position:relative}.graph-status{justify-content:center;align-items:center;height:100%;margin:0;padding:24px;display:flex}.outline{background:var(--translucent-outline);border-right:1px solid var(--line);flex-direction:column;flex:none;width:270px;height:100%;display:flex}.outline-head{border-bottom:1px solid var(--line);flex:none;align-items:center;gap:8px;padding:10px 10px 10px 14px;display:flex}.outline-title{text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-size:12px;font-weight:600}.outline-badge{color:var(--muted);border:1px solid var(--line);border-radius:999px;padding:1px 6px;font-size:10px}.outline-head .drilldown-close{margin-left:auto}.outline-scroll{flex:1;padding:6px 6px 12px;overflow-y:auto}.outline-list,.outline-list ul{margin:0;padding:0;list-style:none}.outline-list ul{padding-left:14px}.outline-row{align-items:center;gap:2px;min-width:0;display:flex}.outline-toggle{width:18px;height:18px;color:var(--muted);cursor:pointer;background:0 0;border:0;flex:none;padding:0;font-size:11px;line-height:1}.outline-toggle:hover{color:var(--text)}.outline-toggle.is-empty{cursor:default;display:inline-block}.outline-item{min-width:0;color:var(--text);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:5px;flex:1;align-items:center;gap:6px;padding:4px 6px;font-size:13px;display:flex;overflow:hidden}.outline-item:hover{background:var(--hover)}.outline-item.is-active{background:var(--active);outline:1px solid var(--accent)}.outline-item .label{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.outline-count{color:var(--muted);flex:none;margin-left:auto;font-size:11px}.files-view{width:330px}.file-row .file-path{font-family:var(--mono,ui-monospace, SFMono-Regular, Menlo, monospace);font-size:12px}.file-hits{margin:0 0 4px;padding:0 0 0 20px;list-style:none}.file-hit{width:100%;color:var(--text);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:5px;flex-direction:column;gap:2px;padding:5px 8px;font-size:12px;display:flex}.file-hit:hover{background:var(--hover)}.file-hit.is-active{background:var(--active);outline:1px solid var(--accent)}.file-hit-line{align-items:baseline;gap:6px;min-width:0;display:flex}.file-hit-time{color:var(--muted);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.file-hash,.file-label{color:var(--muted);font-family:var(--mono,ui-monospace, SFMono-Regular, Menlo, monospace);flex:none;font-size:11px}.file-hit-title{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.file-hit-meta{color:var(--muted);white-space:nowrap;text-overflow:ellipsis;gap:6px;font-size:11px;display:flex;overflow:hidden}.file-hit-reason{color:var(--text);white-space:nowrap;text-overflow:ellipsis;font-size:11px;font-style:italic;display:block;overflow:hidden}.file-hit-branch,.file-hit-commit{font-family:var(--mono,ui-monospace, SFMono-Regular, Menlo, monospace)}.capture-view{width:340px}.outline-button.capture-button[aria-pressed=true]{border-color:var(--capture);color:var(--capture)}.capture-head{border-bottom-color:var(--capture)}.capture-title{color:var(--capture)}.capture-badge{color:var(--capture);border-color:var(--capture)}.capture-note{color:var(--muted);margin:0;padding:4px 10px 6px;font-size:11px}.capture-task-mark{color:var(--muted);margin-right:6px}.capture-list{margin:0;padding:0 4px;list-style:none}.capture-section{padding:2px 2px 4px}.capture-heading{color:var(--muted);letter-spacing:.04em;text-transform:uppercase;margin:6px 4px 2px;font-size:11px;font-weight:600}.capture-done>summary.capture-heading{cursor:pointer}.capture-hint{text-transform:none;letter-spacing:0;font-weight:400}.capture-row{border-left:2px solid var(--capture);border-radius:0 5px 5px 0;align-items:flex-start;gap:6px;margin:2px 0;padding:6px 8px;font-size:12px;display:flex}.capture-row:hover{background:var(--hover)}.capture-row.is-active{background:var(--active);outline:1px solid var(--capture)}.capture-open{min-width:0;color:var(--text);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;flex-direction:column;flex:1;gap:3px;padding:0;font-size:12px;display:flex}.capture-actions{flex:none;gap:4px;display:flex}.capture-action{color:var(--muted);border:1px solid var(--line);font:inherit;cursor:pointer;background:0 0;border-radius:6px;padding:1px 6px;font-size:11px}.capture-action:hover{color:var(--text);border-color:var(--capture)}.capture-action.is-accept{color:var(--capture);border-color:var(--capture)}.capture-error{margin:0;padding:2px 10px 6px;font-size:11px}.capture-text{overflow-wrap:anywhere}.capture-mark{color:var(--capture);border:1px solid var(--capture);font:inherit;cursor:pointer;background:0 0;border-radius:999px;flex:none;padding:0 5px;font-size:10px;font-weight:600;line-height:16px}.capture-mark:hover{color:var(--bg);background:var(--capture)}.capture-state{color:var(--muted);border:1px solid var(--line);letter-spacing:.04em;text-transform:uppercase;border-radius:6px;padding:0 5px;font-size:10px;display:inline-block}.capture-state.is-open{color:var(--capture);border-color:var(--capture)}.capture-here-list li{margin:3px 0}.capture-meta{color:var(--muted);flex-wrap:wrap;gap:6px;font-size:11px;display:flex}.capture-label{font-family:var(--mono,ui-monospace, SFMono-Regular, Menlo, monospace)}.map-node .git-graph{margin:0}.session-row{font-size:13px}.session-dot{cursor:pointer}.session-dot:hover{filter:brightness(1.3)}.session-count{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;overflow:hidden}.session-author{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;max-width:14ch;overflow:hidden}.left-off{color:var(--warn);border:1px solid var(--warn);border-radius:999px;margin-top:4px;padding:1px 6px;font-size:10px;line-height:14px;display:inline-block}.unsummarized{color:var(--muted);border:1px dashed var(--muted);border-radius:999px;margin-top:4px;padding:1px 6px;font-size:10px;line-height:14px;display:inline-block}.kind{text-transform:uppercase;letter-spacing:.04em;background:var(--kind-bg);color:var(--muted);border-radius:4px;flex:none;padding:1px 6px;font-size:10px}.kind.kind-decision{background:var(--kind-decision-bg);color:var(--kind-decision-text)}.kind.kind-question{background:var(--kind-question-bg);color:var(--warn)}.kind.kind-message{background:var(--kind-message-bg);color:var(--kind-message-text)}.empty,.error{color:var(--muted);font-style:italic}.drilldown{z-index:10;background:var(--translucent-panel);border-left:1px solid var(--line);flex-direction:column;flex:none;width:460px;display:flex}@media (width<=900px){.drilldown{border:1px solid var(--line);width:min(460px,100% - 24px);box-shadow:0 12px 32px var(--shadow);border-radius:10px;position:absolute;top:12px;bottom:12px;right:12px}}.drilldown-head{border-bottom:1px solid var(--line);justify-content:space-between;align-items:flex-start;gap:12px;padding:14px 16px;display:flex}.drilldown-head h2{overflow-wrap:anywhere;margin:6px 0 0;font-size:16px}.drilldown-close{width:28px;height:28px;color:var(--muted);background:var(--hover);border:1px solid var(--line);cursor:pointer;border-radius:6px;flex:none;padding:0;font-size:18px;line-height:1}.drilldown-close:hover{color:var(--text);border-color:var(--accent)}.drilldown-body{flex:1;padding:14px 16px;overflow-y:auto}.drilldown-body section{margin-bottom:14px}.drilldown-body h3{text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:4px;font-size:11px}.drilldown-body p{overflow-wrap:anywhere}.drilldown-body details.fold{margin-bottom:14px}.drilldown-body details.fold>summary{cursor:pointer;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:4px;font-size:11px}.drilldown-body details.fold>summary:hover{color:var(--text)}.drilldown-body .decided-by{color:var(--muted);margin:-8px 0 14px;font-size:12px}.drilldown-list{margin:4px 0 0;padding-left:18px}.drilldown-list li+li{margin-top:4px}h3 .count{color:var(--muted);background:var(--chip-bg);border-radius:8px;margin-left:4px;padding:0 6px;font-size:11px;font-weight:500}.commit-list,.file-list{border:1px solid var(--line);border-radius:6px;margin:6px 0 0;padding:0;list-style:none;overflow:hidden}.commit-item,.file-list li{background:var(--row-bg)}.commit-row{width:100%;color:inherit;font:inherit;text-align:left;background:0 0;border:0;flex-wrap:wrap;align-items:baseline;gap:6px;padding:7px 10px;font-size:13px;line-height:18px;display:flex}button.commit-row{cursor:pointer}button.commit-row:hover{background:var(--hover)}.commit-item+.commit-item,.file-list li+li{border-top:1px solid var(--line)}.commit-hash{color:var(--accent);background:var(--chip-bg);border:1px solid var(--chip-line);border-radius:4px;flex:none;padding:0 5px;font-size:11px}.commit-type{color:var(--on-lane);text-transform:uppercase;letter-spacing:.03em;background:var(--muted);border-radius:4px;flex:none;padding:0 6px;font-size:10px;font-weight:700;line-height:16px}.commit-scope{color:var(--muted);flex:none;font-size:12px}.commit-scope:before{content:"("}.commit-scope:after{content:")"}.commit-subject{flex:180px;min-width:0}.commit-item.is-missing .commit-hash{color:var(--missing);border-style:dashed}.commit-item.is-missing .commit-subject{color:var(--missing);font-style:italic}.file-row{width:100%;min-width:0;color:inherit;text-align:left;background:0 0;border:0;align-items:baseline;gap:8px;padding:5px 10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;display:flex}button.file-row{cursor:pointer}button.file-row:hover{background:var(--hover)}.file-item{align-items:center;display:flex}.file-item .file-row{flex:auto;min-width:0}.file-history{color:var(--muted);font:inherit;border:1px solid var(--line);cursor:pointer;background:0 0;border-radius:999px;flex:none;margin-right:8px;padding:1px 8px;font-size:11px}.file-history:hover{color:var(--text);background:var(--hover)}.file-name{color:var(--text);flex:none;font-weight:600}.file-dir{min-width:0;color:var(--muted);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.diff-caret{color:var(--muted);flex:none;margin-left:auto;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px}.diff-view{background:var(--raised-2);border-top:1px solid var(--line);padding:8px 10px 10px;overflow-x:hidden}.diff-toolbar{color:var(--muted);justify-content:flex-end;margin-bottom:6px;font-size:11px;display:flex}.diff-loading{margin:6px 0;padding:6px 10px;font-size:12px}.diff-patch+.diff-patch{border-top:1px solid var(--line);margin-top:8px;padding-top:8px}.diff-file{overflow-wrap:anywhere;margin-bottom:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;font-weight:600}.diff-meta{overflow-wrap:anywhere;color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px}.diff-hunk{overflow-wrap:anywhere;color:var(--muted);background:var(--chip-bg);border-radius:4px;margin:6px 0 2px;padding:2px 6px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px}.diff-row{align-items:baseline;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;line-height:16px;display:flex}.diff-no{width:34px;color:var(--muted);text-align:right;-webkit-user-select:none;user-select:none;flex:none;padding-right:4px}.diff-mark{text-align:center;flex:none;width:14px}.diff-text{white-space:pre-wrap;overflow-wrap:anywhere;flex:1;min-width:0}.diff-add{color:var(--diff-add-text);background:var(--diff-add-bg)}.diff-remove{color:var(--diff-remove-text);background:var(--diff-remove-bg)}.diff-context{color:var(--text)}.diff-note{color:var(--muted);font-style:italic}.diff-note-line{overflow-wrap:anywhere;color:var(--muted);padding:2px 6px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;display:block}.diff-side-row{grid-template-columns:34px minmax(0,1fr) 34px minmax(0,1fr);display:grid}.diff-side-row .diff-note-line{grid-column:1/-1}.diff-side-no{width:auto;padding:0 4px}.diff-cell{white-space:pre-wrap;overflow-wrap:anywhere;min-width:0;padding:0 4px}.diff-cell.is-empty{background:var(--bg);opacity:.55}.drilldown-meta{gap:8px;margin:0 0 16px;display:grid}.drilldown-field{grid-template-columns:110px 1fr;gap:8px;font-size:13px;display:grid}.drilldown-field dt{color:var(--muted)}.drilldown-field dd{overflow-wrap:anywhere;margin:0}.drilldown-field code{overflow-wrap:anywhere;font-size:12px}.resume{border-top:1px solid var(--line);padding-top:12px}.resume-actions{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.resume-button{color:var(--text);background:var(--active);border:1px solid var(--line);font:inherit;cursor:pointer;border-radius:7px;padding:2px 10px;font-size:12px}.resume-button:hover:not(:disabled){border-color:var(--accent)}.resume-button:disabled{color:var(--muted);cursor:not-allowed;opacity:.7}.resume-note{font-size:12px}.resume-command{background:var(--row-bg);border:1px solid var(--line);white-space:pre-wrap;overflow-wrap:anywhere;border-radius:6px;flex-basis:100%;margin:0;padding:6px 8px;font-size:12px;overflow-x:auto}time{color:var(--muted);font-size:12px}.inbox{margin:20px 0 8px}.inbox h2{margin:0;font-size:16px}.inbox-count{font-size:13px;font-weight:400}.inbox-rows{gap:8px;margin:10px 0 0;padding:0;list-style:none;display:grid}.inbox-row{background:var(--panel);border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:8px;flex-direction:column;gap:6px;padding:10px 12px;display:flex}.inbox-head{flex-wrap:wrap;align-items:baseline;gap:8px;display:flex}.inbox-project{font-weight:600}.inbox-session{color:var(--muted);font-size:13px}.inbox-age{color:var(--accent);border:1px solid var(--accent);white-space:nowrap;border-radius:999px;margin-left:auto;padding:1px 8px;font-size:12px}.inbox-age.is-record{color:var(--muted);border-color:var(--line)}.inbox-message{white-space:pre-wrap;-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:0;font-size:13px;line-height:1.45;display:-webkit-box;overflow:hidden}.inbox-signal,.inbox-where{margin:0;font-size:12px}.inbox-where{color:var(--text)}.inbox-actions{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.inbox-actions a{color:var(--accent)}.inbox-dismiss{width:24px;height:24px;color:var(--muted);cursor:pointer;background:0 0;border:1px solid #0000;border-radius:6px;padding:0;font-size:18px;line-height:22px}.inbox-dismiss:hover{color:var(--text);border-color:var(--line);background:var(--hover)}.inbox-toggle{color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;padding:0}.inbox-caret{width:1em;color:var(--muted);display:inline-block}.inbox-error{margin:6px 0 0;font-size:12px}.panel-grid{grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px;margin:24px 0 32px;padding:0;list-style:none;display:grid}.card{background:var(--panel);border:1px solid var(--line);border-radius:10px;flex-direction:column;gap:8px;padding:16px;display:flex}.card.missing{border-color:var(--warn)}.card-head{align-items:center;gap:6px;display:flex}.card-head h2{font-size:17px}.card .path{overflow-wrap:anywhere}.card-facts,.settings dl{gap:4px;margin:0;display:grid}.card-facts div,.settings dl div{justify-content:space-between;gap:12px;display:flex}.card-facts dt,.settings dt{color:var(--muted);font-size:13px}.card-facts dd,.settings dd{margin:0;font-size:13px}.card a{color:var(--accent)}.card{position:relative}.card a.card-open:after{content:"";border-radius:10px;position:absolute;inset:0}.card:has(a.card-open):hover{border-color:var(--accent);cursor:pointer}.settings{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:16px}.settings h2{text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-size:12px}.settings dl{margin-top:10px}@media (width<=720px){.page-bar-centered{grid-template-columns:1fr auto}.page-bar-centered .page-title{text-align:left;grid-area:2/1/auto/-1}.project{flex-direction:column;align-items:flex-start}.meta,.page-actions{align-items:flex-start}.page-bar{flex-wrap:wrap}.settings-field{flex-direction:column;gap:6px}.settings-field .setting-form{justify-content:flex-start;max-width:none}.settings-value{text-align:left;max-width:none}.graph-wrap{flex-direction:column}.outline{border-right:0;border-bottom:1px solid var(--line);width:100%;height:180px}.graph-canvas{flex:1;height:auto;min-height:0}}.message-nav{justify-content:space-between;gap:8px;margin-bottom:14px;display:flex}.message-nav button,.chat-more{font:inherit;color:var(--text);background:var(--raised);border:1px solid var(--line);cursor:pointer;border-radius:6px;padding:4px 10px;font-size:12px}.message-nav button:hover:not(:disabled),.chat-more:hover{border-color:var(--accent)}.message-nav button:disabled{opacity:.4;cursor:default}.message-hash{align-items:center;gap:8px;margin:0 0 12px;font-size:13px;display:flex}.message-hash code{font-size:12px}.message-hash button{color:var(--text);background:var(--active);border:1px solid var(--line);font:inherit;cursor:pointer;border-radius:6px;padding:3px 8px;font-size:12px}.message-hash button:hover{border-color:var(--accent)}.chat-entry{border-left:3px solid var(--line);background:var(--raised);border-radius:8px;margin-top:8px;padding:8px 10px}.chat-user{border-left-color:var(--l1)}.chat-agent{border-left-color:var(--accent)}.chat-who{color:var(--muted);margin-bottom:4px;font-size:11px}.drilldown-body .chat-text{white-space:pre-wrap;font-size:13px;line-height:1.5}.chat-text+.chat-text{margin-top:8px}.drilldown-body .chat-tools{color:var(--muted);margin-top:6px;font-size:12px;font-style:italic}.git-graph{margin:0 0 24px 24px;position:relative}.git-lanes{position:absolute;top:0;left:0;overflow:visible}.git-rows{width:520px;position:absolute;top:0}.git-row{width:100%;color:var(--text);font:inherit;text-align:left;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:5px;align-items:center;gap:8px;padding:0 8px;font-size:12px;display:flex;position:absolute;left:0;overflow:hidden}.git-row:hover{background:var(--hover)}.git-row.is-selected{background:var(--active);outline:1px solid var(--accent)}.git-row.is-search-hit{background:var(--search-hit-bg);box-shadow:inset 2px 0 0 var(--warn)}.git-row.is-search-active{background:var(--search-active-bg);outline:1px solid var(--warn)}.git-more{color:var(--muted);font-style:italic}.git-time{width:74px;color:var(--muted);text-overflow:ellipsis;white-space:nowrap;flex:none;font-size:11px;overflow:hidden}.git-id{color:var(--muted);opacity:.7;flex:none;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px}.git-title{overflow-wrap:anywhere;flex:auto;min-width:180px;line-height:16px}.git-tags{flex-wrap:wrap;flex:none;justify-content:flex-end;gap:4px;max-width:112px;display:flex}.git-tag{white-space:nowrap;color:var(--muted);background:var(--chip-bg);border:1px solid var(--chip-line);cursor:pointer;border-radius:3px;flex:none;padding:0 4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;line-height:15px}.git-tag:hover{color:var(--text);border-color:var(--accent)}.git-tag.is-missing{color:var(--missing);border-style:dashed}.git-continues{min-width:0;max-width:220px;color:var(--accent);text-overflow:ellipsis;white-space:nowrap;border:1px solid color-mix(in srgb, var(--accent) 45%, transparent);border-radius:4px;flex:0 auto;padding:1px 6px;font-size:11px;overflow:hidden}.git-continues:hover{background:color-mix(in srgb, var(--accent) 14%, transparent)}.git-row .left-off,.git-row .unsummarized{flex:none;margin:0}.branch-range{color:var(--muted);font-size:12px}.setting-form{align-items:center;gap:8px;display:flex}.setting-form input[type=text],.setting-form input[type=number],.setting-form select{width:150px;color:var(--text);background:var(--bg);border:1px solid var(--line);font:inherit;border-radius:6px;padding:3px 6px;font-size:13px}.setting-form input[type=checkbox]{margin:0}.settings-foot{background:var(--panel);border-top:1px solid var(--line);justify-content:flex-end;align-items:center;gap:12px;margin:8px -20px -22px;padding:12px 20px;display:flex;position:sticky;bottom:-22px}.settings-field.is-changed .settings-label:after{content:"•";color:var(--accent,var(--text))}.settings-foot button,.setting-form button{color:var(--text);background:var(--panel);border:1px solid var(--line);font:inherit;cursor:pointer;border-radius:6px;padding:3px 10px;font-size:13px}.settings-foot button:disabled,.setting-form button:disabled{opacity:.45;cursor:default}.setting-status{color:var(--muted);font-size:12px}.setting-error{color:var(--l5);font-size:12px}.map-node button,.map-node .git-row,.row-edge,.session-dot,.git-dot-hit{pointer-events:all}.git-dot-hit{cursor:pointer}.map-node{position:relative}.session-open{position:absolute}.session-rows{position:relative}.row-edge{cursor:col-resize;touch-action:none;position:absolute;top:0}.row-edge:after{content:"";background:var(--line);width:1px;position:absolute;top:0;bottom:0;left:50%}.row-edge:hover:after,.row-edge.is-dragging:after{background:var(--accent);width:3px;margin-left:-1px}.session-toggle{width:14px;color:var(--muted);font:inherit;font-size:10px;line-height:inherit;cursor:pointer;background:0 0;border:0;flex:none;padding:0}.session-toggle:hover,.session-toggle:focus-visible{color:var(--text)}.session-row.is-open{background:color-mix(in srgb, var(--accent) 8%, transparent)}.git-change{white-space:nowrap;color:var(--muted);background:var(--chip-bg);border:1px solid var(--chip-line);border-radius:3px;flex:none;padding:0 4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;line-height:15px}.git-row.is-big-change{box-shadow:inset 2px 0 0 color-mix(in srgb, var(--warn) 55%, transparent)}.git-change.is-big{color:var(--warn);border-color:color-mix(in srgb, var(--warn) 45%, transparent)}.shape-section{margin:14px 0}.shape-preview{max-height:8.5em;color:var(--text);white-space:pre-wrap;background:var(--chip-bg);border:1px solid var(--chip-line);border-radius:6px;margin:6px 0;padding:8px 10px;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;overflow:hidden}.shape-preview-diagram{height:240px;margin:6px 0;overflow:hidden}.shape-preview-diagram svg{width:100%!important;max-width:none!important;height:100%!important}.shape-open{color:var(--text);font:inherit;background:var(--chip-bg);border:1px solid var(--chip-line);cursor:pointer;border-radius:4px;padding:4px 12px;font-size:12px}.shape-overlay{z-index:40;background:color-mix(in srgb, var(--bg) 72%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);justify-content:center;align-items:center;padding:4vh 4vw;display:flex;position:fixed;inset:0}.shape-modal{background:var(--panel);border:1px solid var(--line);width:min(980px,100%);max-height:92vh;box-shadow:0 24px 64px var(--shadow);border-radius:12px;outline:none;flex-direction:column;display:flex}.shape-head{border-bottom:1px solid var(--line);justify-content:space-between;align-items:flex-start;gap:12px;padding:18px 20px 10px;display:flex}.shape-head h2{margin:4px 0 0;font-size:17px;font-weight:600}.shape-layers{flex-direction:column;flex:1;min-height:0;display:flex}.shape-tabs{gap:4px;padding:10px 20px 0;display:flex}.shape-tab{color:var(--muted);font:inherit;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:6px 6px 0 0;padding:7px 14px;font-size:13px}.shape-tab.is-active{color:var(--text);background:var(--chip-bg);border-color:var(--chip-line);border-bottom-color:#0000}.shape-tab-no{color:var(--muted);font-size:11px}.shape-layer{border-top:1px solid var(--chip-line);flex:1;min-height:0;padding:16px 20px 22px;overflow:auto}.shape-intent h4,.shape-code h4{letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin:12px 0 4px;font-size:12px}.shape-intent ul{margin:4px 0;padding-left:18px}.shape-legend{border-bottom:1px solid var(--line);color:var(--muted);flex-wrap:wrap;gap:6px;margin:0 0 14px;padding-bottom:10px;font-size:12px;display:flex}.shape-kind{background:var(--chip-bg);border:1px solid var(--chip-line);border-radius:999px;align-items:baseline;gap:5px;padding:2px 9px;display:inline-flex}.shape-kind-symbol{font-size:13px}.shape-table{border-collapse:collapse;width:100%;font-size:13px;line-height:1.5}.shape-table th,.shape-table td{text-align:left;vertical-align:top;border:1px solid var(--chip-line);padding:7px 10px}.shape-table thead th{color:var(--muted);letter-spacing:.04em;text-transform:uppercase;background:var(--chip-bg);font-size:11px;font-weight:600}.shape-table tbody th{width:26%;font-weight:600}.shape-caption{align-items:center;gap:6px;display:flex}.shape-reading{display:block}.shape-caption .settings-details{font-size:12.5px;line-height:1.5}.shape-figure{margin:0 0 16px}.shape-figure figcaption{color:var(--muted);margin-top:6px;font-size:11px}.shape-source{color:var(--text);white-space:pre-wrap;background:var(--chip-bg);border:1px solid var(--chip-line);border-radius:6px;margin:0;padding:12px 14px;font:12px/1.6 ui-monospace,SFMono-Regular,Menlo,monospace;overflow:auto}.shape-note{color:var(--muted);margin:6px 2px 0;font-size:12px}.shape-diagram{background:var(--chip-bg);border:1px solid var(--chip-line);border-radius:6px;padding:10px;overflow:auto}.shape-diagram svg{max-width:100%;height:auto;margin:0 auto;display:block}.shape-diagram-interactive{position:relative;overflow:hidden}.shape-viewport{cursor:grab;touch-action:none;overscroll-behavior:contain;height:min(60vh,560px);position:relative;overflow:hidden}.shape-viewport:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.shape-viewport.is-dragging{cursor:grabbing;-webkit-user-select:none;user-select:none}.shape-pan-content{transform-origin:0 0;width:max-content;position:absolute;top:0;left:0}.shape-diagram-interactive .shape-pan-content svg{max-width:none;margin:0}.shape-zoom-controls{gap:4px;display:flex;position:absolute;top:14px;right:14px}.shape-zoom-controls button{min-width:28px;color:var(--text);background:var(--panel);border:1px solid var(--chip-line);font:inherit;cursor:pointer;border-radius:5px;padding:2px 8px;font-size:12px}.shape-zoom-controls button:hover{background:var(--hover)}.shape-by{color:var(--muted);font-size:11px}.shape-regenerate{border-top:1px solid var(--line);align-items:center;gap:8px;margin-top:14px;padding-top:10px;font-size:12px;display:flex}.shape-regenerate-button{color:var(--text);font:inherit;background:var(--chip-bg);border:1px solid var(--chip-line);cursor:pointer;border-radius:4px;padding:4px 12px;font-size:12px}.shape-regenerate-button:disabled{cursor:progress;opacity:.7}.shape-regenerate-error{color:var(--danger,#d9483b)}.shape-code section{margin-bottom:14px}.shape-code h4 code{font-size:12px}/*$vite$:1*/</style></head><body><div id="root"></div><!-- `cogit build` replaces the empty element with the JSON view model. -->- <script id="cogit-data" type="application/json">{"kind":"lineage","schema":1,"project":{"name":"cogit","path":"/home/dev/cogit","generatedAt":"2026-10-24T12:00:00.000Z"},"status":{"goal":"Ship the project map as one self-contained HTML file.","done":["Define the view-model contract","Scaffold the template package"],"pending":[{"text":"Pick the graph layout that survives 500 nodes","needsUser":true},{"text":"Write the resume command copy fallback","needsUser":false}],"next":"Render the fixture through the template and check the single-file build.","lastActivity":"2026-10-24T11:42:00.000Z"},"settings":{"recorder":"mixed","language":"auto","updateEveryTurns":15,"sideEveryTurns":5,"sessionEndCatchUp":true,"sideModel":"haiku","messageSummaries":false,"startupContext":true,"recordHeadless":false,"tryBeforeNotes":true,"shapes":true,"captures":true,"shareConversations":false,"recordCommit":"ask","gitPolicy":"ignore","agents":["claude-code"],"bigChangeLines":300},"sessions":[{"sessionId":"fixture-unassigned","agent":"claude-code","title":"Scratch notes on status cards","startedAt":"2026-10-19T16:00:00.000Z","updatedAt":"2026-10-19T18:00:00.000Z","status":{"goal":"Decide how the status card merges parallel sessions.","done":[],"pending":[{"text":"Define active","needsUser":true}],"next":"Ask before implementing."},"messages":[{"id":"u1","kind":"message","title":"Sketch the status card","parent":null,"at":"2026-10-19T16:00:00.000Z","summary":"Goal, done, pending, next and last activity."},{"id":"u2","kind":"message","title":"What counts as an active session?","parent":"u1","at":"2026-10-19T18:00:00.000Z","summary":"Updated within the last 7 days.","unsummarized":true}],"transcriptAvailable":true},{"sessionId":"fixture-capture","agent":"claude-code","title":"Session merge and redaction","startedAt":"2026-10-20T09:00:00.000Z","updatedAt":"2026-10-20T16:30:00.000Z","status":{"goal":"Make session writes safe under concurrency.","done":["Per-session lock","redactDeep"],"pending":[],"next":"Add the turn counter."},"messages":[{"id":"c1","kind":"message","title":"Harden session writes","parent":null,"at":"2026-10-20T09:00:00.000Z","summary":"Locked read → merge → write with redaction.","files":["packages/cli/src/store/stores.ts"],"branch":{"title":"Safe writes","asked":"How do two turns write the same session?","outcome":"A per-session lock, then merge and redact.","open":""}},{"id":"c2","kind":"message","title":"Keep parents optional on input","parent":"c1","at":"2026-10-20T09:30:00.000Z","why":"The agent can add a child without re-sending the whole tree.","decidedBy":"agreed"},{"id":"c3","kind":"message","title":"Add the turn counter","parent":"c2","at":"2026-10-20T16:30:00.000Z"}],"transcriptAvailable":true},{"sessionId":"fixture-template","agent":"claude-code","title":"Template package and single-file output","startedAt":"2026-10-24T08:00:00.000Z","updatedAt":"2026-10-24T11:42:00.000Z","status":{"goal":"Render a typed fixture through the template.","done":["Scaffold Vite + React","Add the fixture"],"pending":[{"text":"Confirm the graph layout","needsUser":true}],"next":"Check the page in the browser."},"messages":[{"id":"m1","kind":"message","title":"Scaffold the template package","parent":null,"at":"2026-10-24T09:00:00.000Z","summary":"React 19 + Vite 8, one index.html at build time.","branch":{"title":"Template scaffold","asked":"Which build setup keeps the page one file?","outcome":"Vite + vite-plugin-singlefile; the data is embedded as JSON.","open":""}},{"id":"m2","kind":"message","title":"Wire the data contract","parent":"m1","at":"2026-10-24T09:12:00.000Z","summary":"The page reads the JSON script element and types it once.","work":["Added view/model.ts shared by CLI and template"],"files":["packages/cli/src/view/model.ts","packages/cli/src/view/lineage.ts"]},{"id":"m3","kind":"message","title":"Read data from the DOM","parent":"m2","at":"2026-10-24T09:20:00.000Z","summary":"A fetch would break file://; the JSON element survives inlining.","decidedBy":"agent","alternatives":[{"option":"fetch the JSON","why":"breaks over file://"}]},{"id":"m4","kind":"message","title":"Build the dev fixture","parent":"m3","at":"2026-10-24T09:41:00.000Z","summary":"Three sessions in start order, enough to exercise every branch shape.","decidedBy":"agreed","alternatives":[{"option":"ship the fixture as a separate JSON file","why":"the map has to stay one file"},{"option":"mock the model in the tests instead","why":"it never draws the real graph"}],"commits":["1a2b3c4","9f8e7d6"],"shape":{"by":"side","commits":["1a2b3c4","9f8e7d6"],"tools":[{"kind":"mermaid","valid":true,"text":"flowchart TD\n F[fixture.ts] --> S[Three sessions, in start order]\n S --> L[Lay out the git rows]\n L --> G[Draw the graph]\n G --> C{Every message placed?}\n C -- yes --> R[Render the map]\n C -- no --> L"}]},"commitTags":[{"hash":"1a2b3c4","subject":"feat(template): add the dev fixture"},{"hash":"9f8e7d6"}],"files":["packages/template/src/fixture.ts"]},{"id":"m5","kind":"message","title":"Check the page in the browser","parent":"m4","at":"2026-10-24T10:02:00.000Z","summary":"Layout measured; console clean."},{"id":"m6","kind":"message","title":"Draw nested groups","parent":"m4","at":"2026-10-24T10:20:00.000Z","summary":"A second branch off the fixture work.","files":["packages/template/src/Graph.tsx"],"branch":{"title":"Nested groups","asked":"How do sessions and messages nest?","outcome":"Groups around the git rows.","open":""}},{"id":"m7","kind":"message","title":"Return to the data contract","parent":"m6","at":"2026-10-24T10:35:00.000Z","summary":"The contract needed one more field for the pending count.","links":["m2"]},{"id":"m8","kind":"message","title":"Ship the map","parent":"m7","at":"2026-10-24T11:10:00.000Z","summary":"Build, open and verify."},{"id":"m9","kind":"message","title":"Lineage graph idea","parent":null,"at":"2026-10-24T11:42:00.000Z","summary":"A git graph of the user's messages.","files":["packages/cli/src/view/files.ts"],"branch":{"title":"Git graph","asked":"What if the map read like a git history?","outcome":"","open":"Not built yet."}}],"transcriptAvailable":true}],"diffs":{"1a2b3c4":{"":"diff --git a/packages/template/src/fixture.ts b/packages/template/src/fixture.ts\nnew file mode 100644\nindex 0000000..1a2b3c4\n--- /dev/null\n+++ b/packages/template/src/fixture.ts\n@@ -0,0 +1,4 @@\n+import type { LineageViewModel } from \"../../cli/src/view/model.js\";\n+\n+export const fixture: LineageViewModel = { kind: \"lineage\", schema: 1 };\n+","packages/template/src/fixture.ts":"diff --git a/packages/template/src/fixture.ts b/packages/template/src/fixture.ts\nnew file mode 100644\nindex 0000000..1a2b3c4\n--- /dev/null\n+++ b/packages/template/src/fixture.ts\n@@ -0,0 +1,4 @@\n+import type { LineageViewModel } from \"../../cli/src/view/model.js\";\n+\n+export const fixture: LineageViewModel = { kind: \"lineage\", schema: 1 };\n+"}},"files":[{"path":"packages/cli/src/view/files.ts","count":1,"lastAt":"2026-10-24T11:42:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m9","label":"m9","at":"2026-10-24T11:42:00.000Z","title":"Lineage graph idea","branch":"Git graph","commits":[]}]},{"path":"packages/template/src/Graph.tsx","count":1,"lastAt":"2026-10-24T10:20:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m6","label":"m6","at":"2026-10-24T10:20:00.000Z","title":"Draw nested groups","branch":"Nested groups","commits":[]}]},{"path":"packages/template/src/fixture.ts","count":1,"lastAt":"2026-10-24T09:41:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m4","label":"m4","at":"2026-10-24T09:41:00.000Z","title":"Build the dev fixture","branch":"Template scaffold","commits":["1a2b3c4","9f8e7d6"]}]},{"path":"packages/cli/src/view/model.ts","count":1,"lastAt":"2026-10-24T09:12:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m2","label":"m2","at":"2026-10-24T09:12:00.000Z","title":"Wire the data contract","branch":"Template scaffold","commits":[]}]},{"path":"packages/cli/src/view/lineage.ts","count":1,"lastAt":"2026-10-24T09:12:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m2","label":"m2","at":"2026-10-24T09:12:00.000Z","title":"Wire the data contract","branch":"Template scaffold","commits":[]}]},{"path":"packages/cli/src/store/stores.ts","count":1,"lastAt":"2026-10-20T09:00:00.000Z","hits":[{"sessionId":"fixture-capture","sessionTitle":"Session merge and redaction","messageId":"c1","label":"c1","at":"2026-10-20T09:00:00.000Z","title":"Harden session writes","branch":"Safe writes","commits":[]}]}],"captures":[{"id":"c1a2b3c4d","text":"Pick the graph layout that survives 500 nodes","state":"suggested","source":{"sessionId":"fixture-template"},"createdAt":"2026-10-24T11:42:00.000Z","updatedAt":"2026-10-24T11:42:00.000Z"},{"id":"c2b3c4d5e","text":"Write the resume command copy fallback","state":"suggested","source":{"sessionId":"fixture-template"},"createdAt":"2026-10-24T10:20:00.000Z","updatedAt":"2026-10-24T10:20:00.000Z"},{"id":"c3c4d5e6f","text":"Define what counts as an active session","state":"open","source":{"sessionId":"fixture-unassigned"},"createdAt":"2026-10-19T18:00:00.000Z","updatedAt":"2026-10-21T09:00:00.000Z"},{"id":"c4d5e6f70","text":"Add the turn counter to the status card","state":"done","source":{"sessionId":"fixture-capture"},"createdAt":"2026-10-20T16:30:00.000Z","updatedAt":"2026-10-21T10:00:00.000Z","closedAt":"2026-10-21T10:00:00.000Z"}],"switcher":[{"name":"cogit","path":"/home/dev/cogit","lastActivity":"2026-10-24T11:42:00.000Z","leftOff":"Render the fixture through the template and check the single-file build.","lineageUrl":"file:///home/dev/cogit/.cogit/map.html","current":true},{"name":"start-project","path":"/home/dev/start-project","lastActivity":"2026-10-23T18:05:00.000Z","leftOff":"Write the push commands for the release notes.","lineageUrl":"file:///home/dev/start-project/.cogit/map.html","current":false}]}</script>+ <script id="cogit-data" type="application/json">{"kind":"lineage","schema":1,"project":{"name":"cogit","path":"/home/dev/cogit","generatedAt":"2026-10-24T12:00:00.000Z"},"status":{"goal":"Ship the project map as one self-contained HTML file.","done":["Define the view-model contract","Scaffold the template package"],"pending":[{"text":"Pick the graph layout that survives 500 nodes","needsUser":true},{"text":"Write the resume command copy fallback","needsUser":false}],"next":"Render the fixture through the template and check the single-file build.","lastActivity":"2026-10-24T11:42:00.000Z"},"settings":{"recorder":"mixed","language":"auto","updateEveryTurns":15,"sideEveryTurns":5,"sessionEndCatchUp":true,"sideModel":"haiku","messageSummaries":false,"startupContext":true,"recordHeadless":false,"tryBeforeNotes":true,"shapes":true,"captures":true,"shareConversations":false,"agents":["claude-code"],"bigChangeLines":300},"sessions":[{"sessionId":"fixture-unassigned","agent":"claude-code","title":"Scratch notes on status cards","startedAt":"2026-10-19T16:00:00.000Z","updatedAt":"2026-10-19T18:00:00.000Z","status":{"goal":"Decide how the status card merges parallel sessions.","done":[],"pending":[{"text":"Define active","needsUser":true}],"next":"Ask before implementing."},"messages":[{"id":"u1","kind":"message","title":"Sketch the status card","parent":null,"at":"2026-10-19T16:00:00.000Z","summary":"Goal, done, pending, next and last activity."},{"id":"u2","kind":"message","title":"What counts as an active session?","parent":"u1","at":"2026-10-19T18:00:00.000Z","summary":"Updated within the last 7 days.","unsummarized":true}],"transcriptAvailable":true},{"sessionId":"fixture-capture","agent":"claude-code","title":"Session merge and redaction","startedAt":"2026-10-20T09:00:00.000Z","updatedAt":"2026-10-20T16:30:00.000Z","status":{"goal":"Make session writes safe under concurrency.","done":["Per-session lock","redactDeep"],"pending":[],"next":"Add the turn counter."},"messages":[{"id":"c1","kind":"message","title":"Harden session writes","parent":null,"at":"2026-10-20T09:00:00.000Z","summary":"Locked read → merge → write with redaction.","files":["packages/cli/src/store/stores.ts"],"branch":{"title":"Safe writes","asked":"How do two turns write the same session?","outcome":"A per-session lock, then merge and redact.","open":""}},{"id":"c2","kind":"message","title":"Keep parents optional on input","parent":"c1","at":"2026-10-20T09:30:00.000Z","why":"The agent can add a child without re-sending the whole tree.","decidedBy":"agreed"},{"id":"c3","kind":"message","title":"Add the turn counter","parent":"c2","at":"2026-10-20T16:30:00.000Z"}],"transcriptAvailable":true},{"sessionId":"fixture-template","agent":"claude-code","title":"Template package and single-file output","startedAt":"2026-10-24T08:00:00.000Z","updatedAt":"2026-10-24T11:42:00.000Z","status":{"goal":"Render a typed fixture through the template.","done":["Scaffold Vite + React","Add the fixture"],"pending":[{"text":"Confirm the graph layout","needsUser":true}],"next":"Check the page in the browser."},"messages":[{"id":"m1","kind":"message","title":"Scaffold the template package","parent":null,"at":"2026-10-24T09:00:00.000Z","summary":"React 19 + Vite 8, one index.html at build time.","branch":{"title":"Template scaffold","asked":"Which build setup keeps the page one file?","outcome":"Vite + vite-plugin-singlefile; the data is embedded as JSON.","open":""}},{"id":"m2","kind":"message","title":"Wire the data contract","parent":"m1","at":"2026-10-24T09:12:00.000Z","summary":"The page reads the JSON script element and types it once.","work":["Added view/model.ts shared by CLI and template"],"files":["packages/cli/src/view/model.ts","packages/cli/src/view/lineage.ts"]},{"id":"m3","kind":"message","title":"Read data from the DOM","parent":"m2","at":"2026-10-24T09:20:00.000Z","summary":"A fetch would break file://; the JSON element survives inlining.","decidedBy":"agent","alternatives":[{"option":"fetch the JSON","why":"breaks over file://"}]},{"id":"m4","kind":"message","title":"Build the dev fixture","parent":"m3","at":"2026-10-24T09:41:00.000Z","summary":"Three sessions in start order, enough to exercise every branch shape.","decidedBy":"agreed","alternatives":[{"option":"ship the fixture as a separate JSON file","why":"the map has to stay one file"},{"option":"mock the model in the tests instead","why":"it never draws the real graph"}],"commits":["1a2b3c4","9f8e7d6"],"shape":{"by":"side","commits":["1a2b3c4","9f8e7d6"],"tools":[{"kind":"mermaid","valid":true,"text":"flowchart TD\n F[fixture.ts] --> S[Three sessions, in start order]\n S --> L[Lay out the git rows]\n L --> G[Draw the graph]\n G --> C{Every message placed?}\n C -- yes --> R[Render the map]\n C -- no --> L"}]},"commitTags":[{"hash":"1a2b3c4","subject":"feat(template): add the dev fixture"},{"hash":"9f8e7d6"}],"files":["packages/template/src/fixture.ts"]},{"id":"m5","kind":"message","title":"Check the page in the browser","parent":"m4","at":"2026-10-24T10:02:00.000Z","summary":"Layout measured; console clean."},{"id":"m6","kind":"message","title":"Draw nested groups","parent":"m4","at":"2026-10-24T10:20:00.000Z","summary":"A second branch off the fixture work.","files":["packages/template/src/Graph.tsx"],"branch":{"title":"Nested groups","asked":"How do sessions and messages nest?","outcome":"Groups around the git rows.","open":""}},{"id":"m7","kind":"message","title":"Return to the data contract","parent":"m6","at":"2026-10-24T10:35:00.000Z","summary":"The contract needed one more field for the pending count.","links":["m2"]},{"id":"m8","kind":"message","title":"Ship the map","parent":"m7","at":"2026-10-24T11:10:00.000Z","summary":"Build, open and verify."},{"id":"m9","kind":"message","title":"Lineage graph idea","parent":null,"at":"2026-10-24T11:42:00.000Z","summary":"A git graph of the user's messages.","files":["packages/cli/src/view/files.ts"],"branch":{"title":"Git graph","asked":"What if the map read like a git history?","outcome":"","open":"Not built yet."}}],"transcriptAvailable":true}],"diffs":{"1a2b3c4":{"":"diff --git a/packages/template/src/fixture.ts b/packages/template/src/fixture.ts\nnew file mode 100644\nindex 0000000..1a2b3c4\n--- /dev/null\n+++ b/packages/template/src/fixture.ts\n@@ -0,0 +1,4 @@\n+import type { LineageViewModel } from \"../../cli/src/view/model.js\";\n+\n+export const fixture: LineageViewModel = { kind: \"lineage\", schema: 1 };\n+","packages/template/src/fixture.ts":"diff --git a/packages/template/src/fixture.ts b/packages/template/src/fixture.ts\nnew file mode 100644\nindex 0000000..1a2b3c4\n--- /dev/null\n+++ b/packages/template/src/fixture.ts\n@@ -0,0 +1,4 @@\n+import type { LineageViewModel } from \"../../cli/src/view/model.js\";\n+\n+export const fixture: LineageViewModel = { kind: \"lineage\", schema: 1 };\n+"}},"files":[{"path":"packages/cli/src/view/files.ts","count":1,"lastAt":"2026-10-24T11:42:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m9","label":"m9","at":"2026-10-24T11:42:00.000Z","title":"Lineage graph idea","branch":"Git graph","commits":[]}]},{"path":"packages/template/src/Graph.tsx","count":1,"lastAt":"2026-10-24T10:20:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m6","label":"m6","at":"2026-10-24T10:20:00.000Z","title":"Draw nested groups","branch":"Nested groups","commits":[]}]},{"path":"packages/template/src/fixture.ts","count":1,"lastAt":"2026-10-24T09:41:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m4","label":"m4","at":"2026-10-24T09:41:00.000Z","title":"Build the dev fixture","branch":"Template scaffold","commits":["1a2b3c4","9f8e7d6"]}]},{"path":"packages/cli/src/view/model.ts","count":1,"lastAt":"2026-10-24T09:12:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m2","label":"m2","at":"2026-10-24T09:12:00.000Z","title":"Wire the data contract","branch":"Template scaffold","commits":[]}]},{"path":"packages/cli/src/view/lineage.ts","count":1,"lastAt":"2026-10-24T09:12:00.000Z","hits":[{"sessionId":"fixture-template","sessionTitle":"Template package and single-file output","messageId":"m2","label":"m2","at":"2026-10-24T09:12:00.000Z","title":"Wire the data contract","branch":"Template scaffold","commits":[]}]},{"path":"packages/cli/src/store/stores.ts","count":1,"lastAt":"2026-10-20T09:00:00.000Z","hits":[{"sessionId":"fixture-capture","sessionTitle":"Session merge and redaction","messageId":"c1","label":"c1","at":"2026-10-20T09:00:00.000Z","title":"Harden session writes","branch":"Safe writes","commits":[]}]}],"captures":[{"id":"c1a2b3c4d","text":"Pick the graph layout that survives 500 nodes","state":"suggested","source":{"sessionId":"fixture-template"},"createdAt":"2026-10-24T11:42:00.000Z","updatedAt":"2026-10-24T11:42:00.000Z"},{"id":"c2b3c4d5e","text":"Write the resume command copy fallback","state":"suggested","source":{"sessionId":"fixture-template"},"createdAt":"2026-10-24T10:20:00.000Z","updatedAt":"2026-10-24T10:20:00.000Z"},{"id":"c3c4d5e6f","text":"Define what counts as an active session","state":"open","source":{"sessionId":"fixture-unassigned"},"createdAt":"2026-10-19T18:00:00.000Z","updatedAt":"2026-10-21T09:00:00.000Z"},{"id":"c4d5e6f70","text":"Add the turn counter to the status card","state":"done","source":{"sessionId":"fixture-capture"},"createdAt":"2026-10-20T16:30:00.000Z","updatedAt":"2026-10-21T10:00:00.000Z","closedAt":"2026-10-21T10:00:00.000Z"}],"switcher":[{"name":"cogit","path":"/home/dev/cogit","lastActivity":"2026-10-24T11:42:00.000Z","leftOff":"Render the fixture through the template and check the single-file build.","lineageUrl":"file:///home/dev/cogit/.cogit/map.html","current":true},{"name":"start-project","path":"/home/dev/start-project","lastActivity":"2026-10-23T18:05:00.000Z","leftOff":"Write the push commands for the release notes.","lineageUrl":"file:///home/dev/start-project/.cogit/map.html","current":false}]}</script></body></html>