spexcode 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/spec-cli/src/anchors.ts +53 -12
- package/spec-cli/src/cli.ts +9 -5
- package/spec-cli/src/gateway.ts +8 -1
- package/spec-cli/src/graph.ts +13 -7
- package/spec-cli/src/guide.ts +52 -21
- package/spec-cli/src/harness.ts +85 -34
- package/spec-cli/src/help.ts +20 -14
- package/spec-cli/src/index.ts +25 -7
- package/spec-cli/src/lint.ts +91 -49
- package/spec-cli/src/migrate-table.ts +16 -6
- package/spec-cli/src/session-timeline.ts +148 -0
- package/spec-cli/src/sessions.ts +29 -4
- package/spec-cli/src/specs.ts +35 -17
- package/spec-cli/templates/hooks/prepare-commit-msg +6 -1
- package/spec-cli/templates/spec/project/.plugins/commands/spec.md +16 -0
- package/spec-cli/templates/spec/project/.plugins/skills/spec.md +17 -0
- package/spec-cli/templates/spec/project/.plugins/spec.md +3 -3
- package/spec-dashboard/dist/assets/{Dashboard-CTcH2eW9.js → Dashboard-C_fGmOKK.js} +3 -3
- package/spec-dashboard/dist/assets/EvalsPage-Cnr1s3bq.js +2 -0
- package/spec-dashboard/dist/assets/{FoldToggle-CVFbBpyW.js → FoldToggle-x9gtO1OQ.js} +1 -1
- package/spec-dashboard/dist/assets/{IssuesPage-kULjonqj.js → IssuesPage-5f_vL-JV.js} +1 -1
- package/spec-dashboard/dist/assets/MobileApp-DEO1jgGM.js +1 -0
- package/spec-dashboard/dist/assets/SessionInterface-CAlbMOFR.js +66 -0
- package/spec-dashboard/dist/assets/SessionWindow-JYbpPwNB.js +13 -0
- package/spec-dashboard/dist/assets/{Settings-BL6FV_8S.js → Settings-DKb5Ji_X.js} +1 -1
- package/spec-dashboard/dist/assets/index-BQu-oJ8J.js +41 -0
- package/spec-dashboard/dist/assets/index-BbMkwuix.css +1 -0
- package/spec-dashboard/dist/assets/launch-BM9GgvkX.js +6 -0
- package/spec-dashboard/dist/index.html +2 -2
- package/spec-eval/src/cli.ts +32 -18
- package/spec-eval/src/evaltab.ts +4 -3
- package/spec-eval/src/scenarios.ts +116 -4
- package/spec-dashboard/dist/assets/EvalsPage-CJNKwHLN.js +0 -2
- package/spec-dashboard/dist/assets/MobileApp-B0ZJju8K.js +0 -1
- package/spec-dashboard/dist/assets/SessionInterface-BRKJqU2U.js +0 -71
- package/spec-dashboard/dist/assets/SessionWindow-CDhEL7wO.js +0 -9
- package/spec-dashboard/dist/assets/index-DmQsNYKK.css +0 -1
- package/spec-dashboard/dist/assets/index-DulGPk6A.js +0 -41
- /package/spec-cli/templates/spec/project/.plugins/{extract → commands/extract}/spec.md +0 -0
- /package/spec-cli/templates/spec/project/.plugins/{regroup → commands/regroup}/spec.md +0 -0
- /package/spec-cli/templates/spec/project/.plugins/{supervisor → commands/supervisor}/spec.md +0 -0
- /package/spec-cli/templates/spec/project/.plugins/{tidy → commands/tidy}/spec.md +0 -0
- /package/spec-cli/templates/spec/project/.plugins/{distill → skills/distill}/digest.mjs +0 -0
- /package/spec-cli/templates/spec/project/.plugins/{distill → skills/distill}/spec.md +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{j as s,u as k,r as m,p as De,d as _}from"./index-BQu-oJ8J.js";function je(e){let n=2166136261;for(let a=0;a<(e||"").length;a++)n^=e.charCodeAt(a),n=Math.imul(n,16777619);return n>>>0}function we(e){return je(e)%360}function Pe(e){const n=we(e);return{bg:`hsl(${n} 55% 42%)`,fg:`hsl(${n} 70% 92%)`}}function Ie(e){return`hsl(${we(e)} 65% 50%)`}const ie=["◆","▲","●","■","★","✦","⬟","⬢","❖","◈","✸","⟡","✚","❂","◐","◑","⬣","▰","✶","⬤","✹","◇","⊛","✺"],re=["circle","rounded","square","hex"];function He(e){const n=je(e);return{seed:e,glyph:ie[(n>>>9)%ie.length],shape:re[(n>>>17)%re.length],...Pe(e)}}function Te({seed:e,status:n,title:a,size:t=16}){const l=He(e),i={width:t,height:t};return s.jsx("span",{className:`avatar av-st-${n||"none"}`,"data-tip":a,"aria-label":a,style:i,children:s.jsx("span",{className:`av-face av-gen av-${l.shape}`,style:{...i,background:l.bg,color:l.fg,fontSize:t*.62},children:l.glyph})})}function Re(e){var n,a;return((n=e==null?void 0:e.verdict)==null?void 0:n.status)==="pass"?"check":((a=e==null?void 0:e.verdict)==null?void 0:a.status)==="fail"?"cross":null}const Be={pass:"✓",fail:"✗",stalePass:"✓",staleFail:"✗",empty:""};function ye(e){const n=Re(e);return n?e.fresh?n==="cross"?"fail":"pass":n==="cross"?"staleFail":"stalePass":"empty"}function te(e,n){if(!e)return[];const a=new Map;for(const t of n||[])a.has(t.scenario)||a.set(t.scenario,t);return e.map(t=>{const l=a.get(t.name)||null;return{...t,reading:l,state:l?ye(l):"missing"}})}function Oe(e){return e.length?e.some(n=>n.state==="fail")?"fail":e.some(n=>n.state==="staleFail")?"staleFail":e.some(n=>n.state==="stalePass")?"stalePass":e.some(n=>n.state==="empty"||n.state==="missing")?"empty":"pass":null}function qe({scenarios:e,evals:n}){const a=k(),t=te(e,n);if(!t.length)return null;const l=Oe(t),i=t.filter(r=>r.state==="pass").length,o=t.length,c=a("score.count",{satisfied:i,total:o,outstanding:o-i});return s.jsxs("span",{className:`scenario-count ${l}`,"data-tip":c,"aria-label":c,children:["✓",i,"/",o]})}function Ke({tags:e}){return e!=null&&e.length?s.jsx("span",{className:"tag-chips",children:e.map(n=>s.jsx("span",{className:"tag-chip",children:n},n))}):null}function ae({state:e,title:n}){const a=k();if(!e)return null;const t=n??a(`score.${e}`);return s.jsx("span",{className:`score-badge ${e}`,"data-tip":t,"aria-label":t,children:Be[e]})}const Qs={merged:{color:"#859900"},active:{color:"#cb4b16"},drift:{color:"#b58900"},pending:{color:"#93a1a1"}},ze={added:"+",edited:"~",deleted:"✕",moved:"→"},L={working:"var(--green)",parked:"var(--green)",asking:"var(--yellow)",review:"var(--yellow)",done:"var(--yellow)",error:"var(--red)",idle:"var(--muted)",starting:"var(--muted)",queued:"var(--muted)","close-pending":"var(--muted)",offline:"var(--muted)",unknown:"var(--yellow)"},We={working:"●",parked:"‖",asking:"?",review:"◑",done:"✓",error:"✕",idle:"·",starting:"◌",queued:"⋯","close-pending":"⊘",offline:"○",unknown:"⁇"},Ne=new Set(["asking","review","done","close-pending","error"]),z=e=>(e==null?void 0:e.liveness)==="offline"||(e==null?void 0:e.status)==="offline"?"offline":Ne.has(e==null?void 0:e.status)?"need":"run",be=(e,n)=>{const a=n?(e||[]).find(t=>t.id===n):null;return a&&z(a)!=="offline"?a:null},oe=e=>(e==null?void 0:e.sortKey)!=null?e.sortKey:(e==null?void 0:e.created)??0,ce=e=>{const n={need:0,run:1,offline:2};return[...e].sort((a,t)=>n[z(a)]-n[z(t)]||oe(t)-oe(a))},_e=e=>(e==null?void 0:e.label)||(e==null?void 0:e.name)||(e==null?void 0:e.node)||(e==null?void 0:e.title)||(e==null?void 0:e.branch)||(e==null?void 0:e.id),ke=e=>(e==null?void 0:e.headline)||(e==null?void 0:e.name)||(e==null?void 0:e.activity)||(e==null?void 0:e.promptPreview)||(e==null?void 0:e.node)||(e==null?void 0:e.title)||(e==null?void 0:e.branch)||(e==null?void 0:e.id);function Ue(e){const n=new Set(e.map(l=>l==null?void 0:l.id)),a=new Map,t=[];for(const l of e){const i=l!=null&&l.parent&&l.parent!==l.id&&n.has(l.parent)?l.parent:null;if(i){const o=a.get(i)||[];o.push(l),a.set(i,o)}else t.push(l)}return{roots:t,childrenOf:a}}function Ge(e,n){let a=!1,t=!1,l=0;const i=(o,c)=>{for(const r of n.get(o)||[])c.has(r.id)||(c.add(r.id),l++,Ne.has(r.status)?a=!0:L[r.status]===L.working&&(t=!0),i(r.id,c))};return i(e,new Set([e])),{color:a?L.asking:t?L.working:L.idle,count:l}}function Ze(e,n){const{roots:a,childrenOf:t}=Ue(e),l=[],i=(r,u,f,j)=>{const v=t.get(r.id)||[],$=v.length>0,N=$&&!!n(r.id),x=$?Ge(r.id,t):null;if(l.push({type:"row",s:r,depth:u,expandable:$,expanded:N,rollup:(x==null?void 0:x.color)??null,kin:(x==null?void 0:x.count)??0,guides:j}),N){const w=ce(v).filter(d=>!f.has(d.id));w.forEach((d,h)=>{f.add(d.id),i(d,u+1,f,[...j,h<w.length-1])})}},o=new Set;let c=null;for(const r of ce(a)){if(o.has(r.id))continue;o.add(r.id);const u=z(r);u!==c&&(l.push({type:"zone",zone:u}),c=u),i(r,0,o,[])}return l}function Ye({value:e,onChange:n,options:a}){return s.jsx("select",{className:"fv-filter",value:e,onChange:t=>n(t.target.value),children:a.map(t=>s.jsx("option",{value:t.value,children:t.label},t.value))})}const Je={video:"vid",image:"img",transcript:"txt",data:"data"},$e=e=>{var n;return(n=e.evidence)!=null&&n.length?e.evidence:e.blob!=null?[{hash:e.blob,kind:e.blobKind||"image",state:e.blobState||"present"}]:[]},K=e=>{const n=$e(e);return n.length?["video","image","transcript","data"].filter(a=>n.some(t=>t.kind===a)):["note"]};function Qe(e){var a;const n=[];for(const t of e)if((a=t.evals)!=null&&a.length)for(const l of te(t.scenarios,t.evals))l.reading&&n.push({...l.reading,expected:l.expected??l.reading.expected,state:l.state,node:t.id,hue:t.hue});return n.sort((t,l)=>t.ts<l.ts?1:-1),n}const R=e=>`eval:${e.node}·${e.scenario}`;function Xe({e,selected:n,onClick:a,onOk:t}){const l=k();return s.jsxs("button",{className:`ef-row ${n?"sel":""}`,onClick:a,children:[s.jsx(ae,{state:e.state}),e.inSession&&s.jsx("span",{className:"ef-insession","data-tip":"measured by this session",children:"✦"}),s.jsx("span",{className:"ef-scenario","data-tip":e.scenario,children:e.scenario}),s.jsx("span",{className:"ef-node",style:{color:`hsl(${e.hue??210} 60% 70%)`},children:e.node}),s.jsx("span",{className:"ef-kind",children:K(e).map(i=>Je[i]).filter(Boolean).join("·")}),e.humanOk?s.jsx("span",{className:"ef-okd","data-tip":l("evalsFeed.okdTip",{by:e.humanOk.by,at:new Date(e.humanOk.ts).toLocaleString()}),children:"☑"}):t?s.jsx("span",{role:"button",tabIndex:-1,className:"ef-okbtn","data-tip":l("evalsFeed.okTitle"),onClick:i=>{i.stopPropagation(),t(e)},children:l("evalsFeed.okBtn")}):null,s.jsx("span",{className:"ef-time",children:es(e.ts)})]})}const es=e=>{const n=Math.max(0,(Date.now()-new Date(e).getTime())/1e3);return n<3600?`${Math.max(1,Math.floor(n/60))}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}d`};function Xs({nodes:e=[],sessions:n=[],sel:a,onSel:t,onRows:l,onOk:i=null,mustShow:o=null,lead:c=null}){const r=k(),[u,f]=m.useState(null),[j,v]=m.useState(!1),[$,N]=m.useState(!1),x=m.useMemo(()=>Qe(e),[e]),w=x.some(y=>K(y).includes("video")),d=x.some(y=>K(y).includes("image")),h=u??(w?"video":d?"image":"all"),g=m.useMemo(()=>x.filter(y=>h==="all"||K(y).includes(h)),[x,h]),S=y=>!!be(n,y.by),M=m.useMemo(()=>g.filter(S).length,[g,n]),E=m.useMemo(()=>j?g.filter(S):g,[g,j,n]),A=y=>!!(y.fresh&&y.humanOk),V=m.useMemo(()=>E.filter(A).length,[E]),C=m.useMemo(()=>$?E:E.filter(y=>!A(y)),[E,$]);return m.useEffect(()=>{l==null||l(C)},[C,l]),m.useEffect(()=>{o&&(C.some(y=>R(y)===o)||x.some(y=>R(y)===o)&&(f("all"),v(!1),N(!0)))},[o,C,x]),s.jsxs("section",{className:"fv-group",children:[s.jsxs("header",{className:"fv-group-head",children:[s.jsxs("span",{className:"fv-head-row",children:[c,s.jsx(Ye,{value:h,onChange:f,options:["video","image","all"].map(y=>({value:y,label:r(`evalsFeed.kind.${y}`)}))})]}),(j||M>0||$||V>0)&&s.jsxs("span",{className:"ef-chipbar",children:[(j||M>0)&&s.jsx("button",{type:"button",className:`ef-chip fv-live ${j?"on":""}`,onClick:()=>v(y=>!y),"data-tip":r("masterList.liveChipTitle"),children:r("masterList.liveChip",{n:M})}),($||V>0)&&s.jsx("button",{type:"button",className:`ef-chip ef-okchip ${$?"on":""}`,onClick:()=>N(y=>!y),"data-tip":r("evalsFeed.okChipTitle"),children:r("evalsFeed.okChip",{n:V})})]})]}),C.length===0&&s.jsx("div",{className:"ef-empty",children:r("evalsFeed.empty")}),C.map(y=>s.jsx(Xe,{e:y,selected:a===R(y),onClick:()=>t(R(y),y),onOk:i},R(y)))]})}const ss={plus:{node:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 12h14"}),s.jsx("path",{d:"M12 5v14"})]})},x:{node:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M18 6 6 18"}),s.jsx("path",{d:"m6 6 12 12"})]})},"chevron-left":{node:s.jsx("path",{d:"m15 18-6-6 6-6"}),sw:2},"chevron-right":{node:s.jsx("path",{d:"m9 18 6-6-6-6"}),sw:2},download:{node:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 15V3"}),s.jsx("path",{d:"m7 10 5 5 5-5"}),s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"})]})},clock:{node:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M12 6v6l4 2"})]})},search:{node:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("path",{d:"m21 21-4.3-4.3"})]})},play:{node:s.jsx("path",{d:"M6 3.5 19.5 12 6 20.5Z"})},pause:{node:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),s.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]})},"panel-left":{sw:2,node:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"1",y:"2",width:"22",height:"20",rx:"4"}),s.jsx("rect",{x:"4",y:"5",width:"2",height:"14",rx:"2",fill:"currentColor",stroke:"none"})]})},settings:{node:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})},graph:{vb:18,sw:1.4,node:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"1.5",y:"6.5",width:"5",height:"4.4",rx:"1"}),s.jsx("rect",{x:"11.5",y:"1.8",width:"5",height:"4.4",rx:"1"}),s.jsx("rect",{x:"11.5",y:"11.8",width:"5",height:"4.4",rx:"1"}),s.jsx("path",{d:"M6.5 8.7 h2.2 M11.5 4 h-1.3 q-1.5 0-1.5 1.5 v7 q0 1.5 1.5 1.5 h1.3"})]})},sessions:{vb:18,sw:1.4,node:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"1.5",y:"2.5",width:"15",height:"13",rx:"1.6"}),s.jsx("path",{d:"M4.6 6.5 l2.6 2.3 -2.6 2.3 M9 12.4 h4"})]})},evals:{vb:18,sw:1.4,node:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M2.5 15.5 v-11"}),s.jsx("path",{d:"M2.5 15.5 h13"}),s.jsx("rect",{x:"4.6",y:"10",width:"2.6",height:"3.5",rx:"0.5"}),s.jsx("rect",{x:"8.7",y:"7",width:"2.6",height:"6.5",rx:"0.5"}),s.jsx("path",{d:"M13 6 l1.4 1.4 L16.5 3.6"})]})},issues:{vb:18,sw:1.4,node:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M2.5 3.5 h13 v8.4 h-7 l-3.6 3 v-3 h-2.4 z"}),s.jsx("path",{d:"M5.4 6.7 h7.2 M5.4 9.2 h4.8"})]})},lock:{vb:16,sw:1.3,node:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3.5",y:"7",width:"9",height:"6.5",rx:"1.2"}),s.jsx("path",{d:"M5.5 7 V5 a2.5 2.5 0 0 1 5 0 V7"})]})},paperclip:{vb:16,sw:1.3,node:s.jsx("path",{d:"M12.5 7.2 L7 12.6 a2.6 2.6 0 0 1-3.7-3.7 L9 3.2 a1.7 1.7 0 0 1 2.4 2.4 L5.8 11.2 a0.8 0.8 0 0 1-1.2-1.2 L9.7 5"})},loader:{vb:16,sw:1.5,node:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"8",cy:"8",r:"5.5",opacity:"0.3"}),s.jsx("path",{d:"M8 2.5 a5.5 5.5 0 0 1 5.5 5.5"})]})},maximize:{vb:16,sw:1.4,node:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M2 6V2h4"}),s.jsx("path",{d:"M14 6V2h-4"}),s.jsx("path",{d:"M2 10v4h4"}),s.jsx("path",{d:"M14 10v4h-4"})]})},minimize:{vb:16,sw:1.4,node:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M6 2v4H2"}),s.jsx("path",{d:"M10 2v4h4"}),s.jsx("path",{d:"M6 14v-4H2"}),s.jsx("path",{d:"M10 14v-4h4"})]})}};function U({name:e,size:n=16,strokeWidth:a,className:t,style:l}){const i=ss[e];if(!i)throw new Error(`unknown icon: ${e}`);const o=i.vb||24;return s.jsx("svg",{width:n,height:n,viewBox:`0 0 ${o} ${o}`,fill:"none",stroke:"currentColor",strokeWidth:a??i.sw??1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:t,style:l,children:i.node})}function en({icon:e,label:n,onClick:a,className:t,size:l,iconClassName:i,...o}){return s.jsx("button",{type:"button",className:t,"data-tip":n,"aria-label":n,onClick:a,...o,children:s.jsx(U,{name:e,size:l,className:i})})}const sn=()=>s.jsx("svg",{className:"si-agent-glyph",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})}),nn=()=>s.jsx("svg",{className:"si-agent-glyph",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z"})}),H=e=>`/api/evidence/${e}`;function ns({src:e,alt:n,onClose:a}){return m.useEffect(()=>{const t=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),a())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[a]),s.jsx("div",{className:"lightbox",onClick:a,children:s.jsx("img",{src:e,alt:n})})}function ts({hash:e}){const n=k(),[a,t]=m.useState(null);return m.useEffect(()=>{let l=!0;return fetch(H(e)).then(i=>i.ok?i.text():Promise.reject(new Error("miss"))).then(i=>{l&&t(i)}).catch(()=>{l&&t("")}),()=>{l=!1}},[e]),a===null?s.jsx("pre",{className:"eval-transcript loading",children:n("nodeView.eval.loadingTranscript")}):s.jsx("pre",{className:"eval-transcript",children:a})}function as({hash:e}){const n=k(),[a,t]=m.useState(null);return m.useEffect(()=>{let l=!0;return fetch(H(e)).then(i=>i.ok?i.text():Promise.reject(new Error("miss"))).then(i=>{let o=i,c=!0;try{o=JSON.stringify(JSON.parse(i),null,2)}catch{c=!1}l&&t({text:o,valid:c})}).catch(()=>{l&&t({text:"",valid:!1})}),()=>{l=!1}},[e]),a===null?s.jsx("pre",{className:"eval-data loading",children:n("nodeView.eval.loadingData")}):s.jsxs("div",{className:"eval-datawrap",children:[s.jsx("div",{className:"eval-datahead",children:a.valid?n("nodeView.eval.data"):n("nodeView.eval.dataInvalid")}),s.jsx("pre",{className:"eval-data",children:a.text})]})}function ls({hash:e,alt:n}){const[a,t]=m.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx("img",{className:"an-image",src:H(e),alt:n,loading:"lazy",onClick:()=>t(!0)}),a&&s.jsx(ns,{src:H(e),alt:n,onClose:()=>t(!1)})]})}function is({exit:e}){return s.jsx(U,{name:e?"minimize":"maximize",size:15})}function tn({target:e,className:n=""}){const a=k(),[t,l]=m.useState(!1);m.useEffect(()=>{const o=()=>{const c=document.fullscreenElement,r=e==null?void 0:e.current;l(!!c&&!!r&&(c===r||r.contains(c)))};return document.addEventListener("fullscreenchange",o),()=>document.removeEventListener("fullscreenchange",o)},[e]);const i=()=>{var c,r;const o=e==null?void 0:e.current;o&&(document.fullscreenElement?(c=document.exitFullscreen||document.webkitExitFullscreen)==null||c.call(document):(r=o.requestFullscreen||o.webkitRequestFullscreen)==null||r.call(o))};return s.jsx("button",{type:"button",className:`an-fs ${n}`,onClick:i,"data-tip":a(t?"annotator.exitFullscreen":"annotator.fullscreen"),"aria-label":a(t?"annotator.exitFullscreen":"annotator.fullscreen"),children:s.jsx(is,{exit:t})})}function Se({e,alt:n=""}){const a=k();return e.state==="miss"?s.jsx("div",{className:"eval-noimg",children:a("nodeView.eval.miss")}):e.kind==="transcript"?s.jsx(ts,{hash:e.hash}):e.kind==="data"?s.jsx(as,{hash:e.hash}):e.kind==="video"?s.jsx("video",{className:"eval-video",src:H(e.hash),controls:!0,preload:"metadata",playsInline:!0}):s.jsx(ls,{hash:e.hash,alt:n})}const O=new Map;function rs(e){const[n,a]=m.useState(()=>O.get(e)??null);return m.useEffect(()=>{if(O.has(e)){a(O.get(e));return}let t=!0;return fetch(H(e),{headers:{Range:"bytes=0-0"}}).then(l=>{const i=l.headers.get("content-type")||"",o=l.ok?{kind:i.startsWith("video/")?"video":i.startsWith("image/")?"image":i.startsWith("application/json")?"data":"transcript",state:"present"}:{kind:"image",state:"miss"};O.set(e,o),t&&a(o)}).catch(()=>{t&&a({kind:"image",state:"miss"})}),()=>{t=!1}},[e]),n}function Me({hash:e,alt:n=""}){const a=rs(e);return a?s.jsx(Se,{e:{hash:e,...a},alt:n}):null}const an=/\[\[(\.?[\p{L}\p{N}_-]+)\]\]/gu,Ee=e=>(e||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,"");function os(e,n,a){const t=n.toLowerCase(),l=[];for(const i of e){const o=i.id.toLowerCase(),c=Ee(i.path).toLowerCase();let r;if(!t)r=3;else if(o.startsWith(t))r=0;else if(o.includes(t))r=1;else if(c.includes(t))r=2;else continue;i.id===a&&(r=-1),l.push({s:i,score:r})}return l.sort((i,o)=>i.score-o.score||i.s.id.length-o.s.id.length||i.s.id.localeCompare(o.s.id)),l.slice(0,8).map(i=>i.s)}function cs(e,n){const a=n.toLowerCase(),t=c=>ke(c)||(c.id||"").slice(0,8),l=[];for(const c of e||[]){if(c.liveness!=="online")continue;const r=(c.id||"").toLowerCase(),u=t(c).toLowerCase();let f;if(!a)f=3;else if(r===a||u===a)f=0;else if(r.startsWith(a)||u.startsWith(a))f=1;else if(r.includes(a)||u.includes(a))f=2;else continue;l.push({s:c,score:f})}l.sort((c,r)=>c.score-r.score||(r.s.created||0)-(c.s.created||0));const i=l.map(c=>({id:c.s.id,label:t(c.s),sub:c.s.node||c.s.status})),o=l.filter(c=>c.score===0).length;return i.splice(o,0,{id:"new",label:"new",sub:"spawn a fresh worker"}),i.slice(0,8)}function ee(e,n){if(!n)return e;const a=e.toLowerCase().indexOf(n.toLowerCase());return a<0?e:s.jsxs(s.Fragment,{children:[e.slice(0,a),s.jsx("b",{className:"mention-hit",children:e.slice(a,a+n.length)}),e.slice(a+n.length)]})}function ds(e,n){const a=n.toLowerCase(),t=[];for(const l of e){const i=l.name.toLowerCase();let o;if(!a)o=1;else if(i.startsWith(a))o=0;else if(i.includes(a))o=1;else continue;t.push({c:l,score:o})}return t.sort((l,i)=>l.score-i.score),t.slice(0,10).map(l=>l.c)}const us=e=>e&&e[0].toUpperCase()+e.slice(1),hs={user:"(user)",project:"(project)",skill:"[skill]","built-in":"built-in",ui:"[ui]",review:"[review]"};function ps({menu:e,up:n,head:a,onPick:t,onHover:l}){const i=k();return s.jsxs("ul",{className:n?"mention-menu up":"mention-menu",role:"listbox",children:[s.jsxs("li",{className:"mention-head",children:["// ",a," — ",i("session.menuHint")]}),e.items.map((o,c)=>{const r=o.ui?"ui":o.source??o.kind,u=o.ui?` sc-${o.color}`:"";return s.jsxs("li",{role:"option","aria-selected":c===e.index,className:`${c===e.index?"mention-item on":"mention-item"}${u}`,onMouseDown:f=>{f.preventDefault(),t(o)},onMouseEnter:()=>l(c),children:[s.jsxs("span",{className:o.ui?"slash-name ui":"slash-name",children:["/",ee(o.name,e.query)]}),s.jsx("span",{className:"slash-desc",children:us(o.description??o.desc)}),s.jsx("span",{className:`slash-src src-${r}`,children:hs[r]||r})]},`${r}:${o.name}`)})]})}function fs(e,n,a,t){let l=n-1;for(;l>=0&&/[\p{L}\p{N}_.\-]/u.test(e[l]);)l--;if(l>=1&&e[l-1]==="["&&e[l]==="["){const i=e.slice(l+1,n),o=os(a,i,t);return o.length?{kind:"mention",items:o,index:0,start:l-1,end:n,query:i}:null}return null}function ms(e,n,a){let t=n-1;for(;t>=0&&/[\p{L}\p{N}_.\-]/u.test(e[t]);)t--;if(t>=0&&e[t]==="@"&&(t===0||/\s/.test(e[t-1]))){const l=e.slice(t+1,n),i=cs(a,l);return i.length?{kind:"actor",items:i,index:0,start:t,end:n,query:l}:null}return null}function xs({menu:e,up:n,fixedStyle:a,onPick:t,onHover:l}){const i=k(),o=e.kind==="actor",c=e.query?o?`@${e.query}`:`[[${e.query}]]`:i(o?"session.menuSessions":"session.menuSpecNodes");return s.jsxs("ul",{className:`${n?"mention-menu up":"mention-menu"}${a?" fixed":""}`,style:a||void 0,role:"listbox",children:[s.jsxs("li",{className:"mention-head",children:["// ",c," — ",i("session.menuHint")]}),e.items.map((r,u)=>s.jsxs("li",{role:"option","aria-selected":u===e.index,className:`${u===e.index?"mention-item on":"mention-item"}${o&&r.id==="new"?" new":""}`,onMouseDown:f=>{f.preventDefault(),t(r)},onMouseEnter:()=>l(u),children:[!o&&s.jsx("span",{className:"mention-dot",style:{background:L[r.status]||L.offline}}),s.jsx("span",{className:"mention-id",children:o?s.jsxs(s.Fragment,{children:["@",ee(r.label,e.query)]}):ee(r.id,e.query)}),s.jsx("span",{className:"mention-path",children:o?r.sub:Ee(r.path)})]},r.id))]})}function vs({inputRef:e,value:n,setValue:a,specs:t=[],sessions:l=[],focusId:i=null,up:o=!1,fixedAbove:c=null}){const[r,u]=m.useState(null),[f,j]=m.useState(null),v=h=>{var V;if(!h){u(null),j(null);return}const g=h.selectionStart,S=fs(h.value,g,t,i)||ms(h.value,g,l);if(u(S),!S||!c){j(null);return}const M=h.getBoundingClientRect(),E=(V=h.closest(c))==null?void 0:V.getBoundingClientRect(),A=(E==null?void 0:E.top)??M.top;j({left:`${M.left}px`,width:`${M.width}px`,right:"auto",bottom:`${Math.max(8,window.innerHeight-A+8)}px`})},$=h=>u(g=>g&&{...g,index:(g.index+h+g.items.length)%g.items.length}),N=h=>{if(!h||!r)return;const g=r.kind==="actor"?`@${h.id} `:`[[${h.id}]] `,S=n.slice(0,r.start);a(S+g+n.slice(r.end)),u(null),j(null);const M=S.length+g.length;requestAnimationFrame(()=>{const E=e.current;E&&(E.focus(),E.setSelectionRange(M,M))})};return{menu:r,sync:v,onKeyDown:h=>r?h.key==="ArrowDown"?(h.preventDefault(),h.stopPropagation(),$(1),!0):h.key==="ArrowUp"?(h.preventDefault(),h.stopPropagation(),$(-1),!0):h.key==="Enter"||h.key==="Tab"?(h.preventDefault(),h.stopPropagation(),N(r.items[r.index]),!0):h.key==="Escape"?(h.preventDefault(),h.stopPropagation(),u(null),j(null),!0):!1:!1,close:()=>{u(null),j(null)},menuEl:r?s.jsx(xs,{menu:r,up:o,fixedStyle:f,onPick:N,onHover:h=>u(g=>g&&{...g,index:h})}):null}}function gs(e,n,a=0){e&&(e.style.height="auto",e.style.overflowY=e.scrollHeight>n?"auto":"hidden",e.style.height=`${Math.min(Math.max(e.scrollHeight,a),n)}px`)}const js=/^▶\s*(\d+):([0-5]?\d)(?:\s*·\s*([^\n]*))?/,de=/^!\[frame\]\(\/api\/(?:evidence|yatsu\/blob)\/[0-9a-f]{64}\)\n?/,ws=/\/api\/(?:evidence|yatsu\/blob)\/([0-9a-f]{64})/g,ue=/!\[[^\]]*\]\(\/api\/(?:evidence|yatsu\/blob)\/([0-9a-f]{64})\)/g,ys=e=>{const n=Math.floor(e/1e3);return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`};function se(e){var i;const n=e||"",a=n.split(`
|
|
2
|
+
`,1)[0],t=js.exec(a);return t?{tMs:(parseInt(t[1],10)*60+parseInt(t[2],10))*1e3,step:((i=t[3])==null?void 0:i.trim())||null,label:a.trim(),rest:n.slice(a.length).replace(/^\n/,"")}:null}const Ce=(e,n)=>`▶${ys(e)}${n?` · ${n}`:""}`,he=e=>[...(e||"").matchAll(ws)].map(n=>n[1]);function Ns(e,n){if(!e)return null;if(e.step&&(n!=null&&n.length)){const a=n.find(t=>t.step===e.step);return a?{tMs:a.at,step:e.step,label:Ce(a.at,e.step),seekable:!0,degraded:!1}:{tMs:e.tMs,step:e.step,label:e.label,seekable:!1,degraded:!0}}return{tMs:e.tMs,step:e.step,label:e.label,seekable:!0,degraded:!1}}function ln({originator:e,sessions:n=[],kind:a="issue",onOpenSession:t=null}){const l=k();if(!e)return null;const i=be(n,e),o=!!i,c=o?L[i.status]||L.working:L.offline,r=l(a==="eval"?"thread.originatorEval":"thread.originatorIssue",{by:e}),u=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"fv-originator-dot",style:{background:c},"aria-hidden":"true"}),s.jsx("span",{className:"fv-originator-who",children:e})]});return o&&t?s.jsx("button",{type:"button",className:"fv-originator alive openable","data-tip":r,"aria-label":r,onClick:()=>t(e),children:u}):s.jsx("span",{className:`fv-originator ${o?"alive":"offline"}`,"data-tip":r,children:u})}function bs({replies:e,onSeek:n,selIdx:a=null,activeIdx:t=null,onSelect:l=null,events:i=null,threadId:o=null,onRemarkChange:c=null}){const r=k(),[u,f]=m.useState(null),[j,v]=m.useState(null),$=async(N,x)=>{if(!u){f(x),v(null);try{const w=await De(N,x);w!=null&&w.ok?await(c==null?void 0:c()):v({ref:x,msg:(w==null?void 0:w.error)||`${N} failed`})}finally{f(null)}}};return e.map((N,x)=>{const w=se(N.body),d=Ns(w,i),h=w?w.rest:N.body,g=[...h.matchAll(ue)].map(y=>y[1]),S=(g.length?h.replace(ue,""):h).trim(),M=N.rid!==void 0,E=M?N.resolved?" remark resolved":" remark open":"",A=`fv-reply${a===x?" sel":""}${t===x?" active":""}${E}`,V=d&&d.seekable&&n?()=>l?l(x,d.tMs):n(d.tMs):null,C=M&&o?`${o}#${N.rid}`:null;return s.jsxs("div",{className:A,children:[s.jsxs("div",{className:"fv-reply-meta",children:[s.jsx("span",{className:"fv-reply-by",children:N.by}),N.at&&s.jsx("span",{className:"fv-reply-at",children:N.at}),d&&(V?s.jsx("button",{type:"button",className:"fv-anchor",onClick:V,"data-tip":"seek the clip to this moment",children:d.label}):s.jsxs("span",{className:`fv-anchor static${d.degraded?" degraded":""}`,"data-tip":d.degraded?r("thread.anchorDegraded"):void 0,children:[d.label,d.degraded?" ⚠":""]})),M&&(N.resolved?s.jsxs("span",{className:"fv-remark-state resolved","data-tip":N.resolvedBy?r("thread.resolvedBy",{by:N.resolvedBy}):r("thread.resolved"),children:["✓ ",r("thread.resolved")]}):s.jsxs("span",{className:"fv-remark-state open","data-tip":r("thread.openRemark"),children:["● ",r("thread.openRemark")]})),C&&c&&!N.resolved&&(N.by==="human"?s.jsx("button",{type:"button",className:"fv-remark-act retract",disabled:!!u,"data-tip":r("thread.retractTitle"),onClick:()=>$("retract",C),children:r("thread.retract")}):s.jsx("button",{type:"button",className:"fv-remark-act resolve",disabled:!!u,"data-tip":r("thread.resolveTitle"),onClick:()=>$("resolve",C),children:r("thread.resolve")}))]}),j&&j.ref===C&&s.jsx("div",{className:"fv-error",children:j.msg}),S&&s.jsx("div",{className:"fvd-body",children:s.jsx(W,{body:S})}),g.length>0&&s.jsx("div",{className:"fv-reply-media",children:g.map((y,G)=>s.jsx(Me,{hash:y,alt:"evidence"},`${y}-${G}`))})]},x)})}function ks(e,n,a){const t=e.lastIndexOf(`
|
|
3
|
+
`,n-1)+1,l=/^\/(\S*)$/.exec(e.slice(t,n));if(!l)return null;const i=ds(a,l[1]);return i.length?{items:i,index:0,start:t,end:n,query:l[1]}:null}function rn({onSend:e,specs:n=[],sessions:a=[],focusId:t=null,onDone:l,anchorNow:i=null,draft:o=null,actionsEnd:c=null,commands:r=null}){const u=k(),[f,j]=m.useState(""),[v,$]=m.useState(!1),[N,x]=m.useState(""),[w,d]=m.useState(!1),h=m.useRef(null),g=vs({inputRef:h,value:f,setValue:j,specs:n,sessions:a,focusId:t,up:!0}),[S,M]=m.useState(null),E=p=>M(p&&(r!=null&&r.length)?ks(p.value,p.selectionStart,r):null),A=p=>{var T;if(!p||!S)return;const b=f.slice(0,S.start)+f.slice(S.end);if(M(null),p.run){j(b.trim()?b:""),p.run();return}const I=se(b);let D="";if(I){const F=((T=de.exec(I.rest))==null?void 0:T[0])??"";D=`${I.label}
|
|
4
|
+
${F}`,D.endsWith(`
|
|
5
|
+
`)||(D+=`
|
|
6
|
+
`)}j(D+p.prefill()),requestAnimationFrame(()=>{const F=h.current;F&&(F.focus(),F.setSelectionRange(F.value.length,F.value.length))})},V=p=>S?p.key==="ArrowDown"?(p.preventDefault(),p.stopPropagation(),M(b=>({...b,index:(b.index+1)%b.items.length})),!0):p.key==="ArrowUp"?(p.preventDefault(),p.stopPropagation(),M(b=>({...b,index:(b.index-1+b.items.length)%b.items.length})),!0):p.key==="Enter"||p.key==="Tab"?(p.preventDefault(),p.stopPropagation(),A(S.items[S.index]),!0):p.key==="Escape"?(p.preventDefault(),p.stopPropagation(),M(null),!0):!1:!1,C=he(f),y=w||!!f||C.length>0||!!N;m.useEffect(()=>{const p=h.current;if(!p)return;const b=getComputedStyle(p);gs(p,parseFloat(b.maxHeight)||1/0,parseFloat(b.minHeight)||0)},[f]),m.useEffect(()=>{var p;if(!o){j("");return}j(o.body||""),(p=h.current)==null||p.focus()},[o==null?void 0:o.seq]);const G=async()=>{var I;const p=await(i==null?void 0:i());if(!p)return;const b=Ce(p.tMs,p.step)+(p.frame?`
|
|
7
|
+
`:"");j(D=>{const T=se(D),F=(T?T.rest:D).replace(de,"");return F?`${b}
|
|
8
|
+
${F}`:`${b}
|
|
9
|
+
`}),(I=h.current)==null||I.focus()},le=async()=>{const p=f.trim();if(!(!p||v)){$(!0);try{const b=await e(p,he(p));b!=null&&b.ok?(j(""),x(""),await(l==null?void 0:l(b.outcomes||""))):x((b==null?void 0:b.error)||"reply failed")}finally{$(!1)}}};return s.jsxs("div",{className:`fv-compose${y?" engaged":""}`,children:[C.length>0&&s.jsx("div",{className:"fv-frames",children:C.map(p=>s.jsx(Me,{hash:p,alt:"frame"},p))}),s.jsxs("div",{className:"fv-tawrap",children:[s.jsx("textarea",{ref:h,className:"fv-textarea",rows:1,value:f,placeholder:u("session.issuesReplyPlaceholder"),disabled:v,onChange:p=>{j(p.target.value),g.sync(p.target),E(p.target)},onSelect:p=>{g.sync(p.target),E(p.target)},onFocus:()=>d(!0),onBlur:()=>{d(!1),g.close(),M(null)},onKeyDown:p=>{V(p)||g.onKeyDown(p)||p.key==="Enter"&&(p.metaKey||p.ctrlKey)&&(p.preventDefault(),le())}}),g.menuEl,S&&s.jsx(ps,{menu:S,up:!0,head:S.query?`/${S.query}`:u("annotator.menuReview"),onPick:A,onHover:p=>M(b=>b&&{...b,index:p})})]}),s.jsxs("div",{className:"fv-actions",children:[i&&s.jsxs("button",{type:"button",className:"fv-anchor-btn","data-tip":u("thread.anchorTitle"),onMouseDown:p=>p.preventDefault(),onClick:G,children:[s.jsx(U,{name:"clock",size:11})," ",u("thread.anchorNow")]}),s.jsx("span",{className:"fv-hint",children:N||u("session.issuesMentionHint")}),s.jsx("button",{type:"button",className:"fv-send",disabled:v||!f.trim(),onMouseDown:p=>p.preventDefault(),onClick:le,children:u(v?"session.issuesSending":"session.issuesSend")}),c]})]})}const $s=["graph","sessions","evals","issues","settings"];function ne(e){const n=(e||"").replace(/^#\/?/,"").split("/").filter(Boolean),a=$s.includes(n[0])?n[0]:"graph",t=a==="sessions"?n[1]||null:a==="evals"?n.length>1?n.slice(1).map(decodeURIComponent).join("/"):null:a==="issues"&&n.length>1?n.slice(1).map(decodeURIComponent).join("/"):null;return{page:a,param:t}}const P=(e,n)=>`#/${e}${n?`/${String(n).split("/").map(encodeURIComponent).join("/")}`:""}`;function Z(e,n=null,{replace:a=!1}={}){const t=P(e,n);window.location.hash!==t&&(a?window.history.replaceState(null,"",t):window.location.hash=t)}function on(){const[e,n]=m.useState(()=>ne(window.location.hash));return m.useEffect(()=>{const a=()=>n(ne(window.location.hash));return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]),e}const cn=e=>({kind:"graph-node",nodeId:e}),dn=e=>({kind:"session",sessionId:e}),Ss=e=>({kind:"issue",issueId:e}),un=(e,n)=>({kind:"eval",nodeId:e,scenario:n});function Ve(e){return!e||e.kind==="graph-node"?P("graph"):e.kind==="session"?P("sessions",e.sessionId):e.kind==="issue"?P("issues",e.issueId):e.kind==="eval"?P("evals",`${e.nodeId}/${e.scenario}`):P("graph")}function hn(e,{onFocusNode:n,onOpenSession:a}={}){if(e)if(e.kind==="graph-node")n==null||n(e.nodeId),Z("graph");else if(e.kind==="session")a?a(e.sessionId):Z("sessions",e.sessionId);else{const{page:t,param:l}=ne(Ve(e));Z(t,l)}}function pe({issue:e,onNavigateAddress:n}){const a=(e==null?void 0:e.store)||"local",t=(e==null?void 0:e.status)||"open",l=Ss(e.id);return s.jsxs("a",{className:"issue-card",href:Ve(l),"data-tip":e.concern||e.id,onClick:n?i=>{i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey||(i.preventDefault(),n(l))}:void 0,children:[s.jsxs("span",{className:"issue-card-top",children:[s.jsx("span",{className:"issue-num",children:e.id}),s.jsx("span",{className:`fv-store fv-store-${a==="local"?"local":"forge"}`,children:a}),s.jsx("span",{className:`issue-state st-${t}`,children:t})]}),s.jsx("span",{className:"issue-card-title",children:e.concern})]})}const fe=[{key:"spec",label:"spec"},{key:"history",label:"history"},{key:"issues",label:"issues"},{key:"eval",label:"eval"}];function Ms(e){var n;return(n=e==null?void 0:e.overlays)!=null&&n.length?[{key:"edit",label:"edit"},...fe]:fe}const Es={added:"+",edited:"~",deleted:"✕",moved:"→"};function B(e){const n=[],a=/`([^`]+)`|\*\*([^*]+)\*\*|\[\[([^\]]+)\]\]/g;let t=0,l,i=0;for(;l=a.exec(e);)l.index>t&&n.push(e.slice(t,l.index)),l[1]!=null?n.push(s.jsx("code",{children:l[1]},i++)):l[2]!=null?n.push(s.jsx("strong",{children:l[2]},i++)):n.push(s.jsx("span",{className:"doc-link",children:l[3]},i++)),t=a.lastIndex;return t<e.length&&n.push(e.slice(t)),n}function me(e){const n=e.trim();return n.includes("|")&&/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/.test(n)}function Y(e){let n=e.trim();return n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1)),n.split("|").map(a=>a.trim())}function Cs(e){const n=e.startsWith(":"),a=e.endsWith(":");return n&&a?"center":a?"right":null}function W({body:e}){if(!e)return null;const n=e.replace(/^#\s+[^\n]*\n+/,"").split(`
|
|
10
|
+
`),a=[];let t=0,l=0;for(;t<n.length;){const i=n[t].trim();if(/^```/.test(i)){const o=[];for(t++;t<n.length&&!/^```/.test(n[t].trim());)o.push(n[t++]);t++,a.push(s.jsx("pre",{className:"doc-pre",children:s.jsx("code",{children:o.join(`
|
|
11
|
+
`)})},l++))}else if(/^#{1,6}\s+/.test(n[t]))a.push(s.jsx("h4",{className:"doc-h",children:B(n[t].replace(/^#+\s+/,""))},l++)),t++;else if(i.includes("|")&&t+1<n.length&&me(n[t+1])){const o=Y(n[t]),c=Y(n[t+1]).map(Cs);t+=2;const r=[];for(;t<n.length&&n[t].includes("|")&&n[t].trim()!==""&&!/^```/.test(n[t].trim());)r.push(Y(n[t])),t++;a.push(s.jsxs("table",{className:"doc-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:o.map((u,f)=>s.jsx("th",{style:c[f]?{textAlign:c[f]}:void 0,children:B(u)},f))})}),s.jsx("tbody",{children:r.map((u,f)=>s.jsx("tr",{children:o.map((j,v)=>s.jsx("td",{style:c[v]?{textAlign:c[v]}:void 0,children:B(u[v]??"")},v))},f))})]},l++))}else if(/^-\s+/.test(i)){const o=[];for(;t<n.length&&/^-\s+/.test(n[t].trim());)o.push(n[t++].trim().replace(/^-\s+/,""));a.push(s.jsx("ul",{children:o.map((c,r)=>s.jsx("li",{children:B(c)},r))},l++))}else if(i==="")t++;else{const o=[];for(;t<n.length;){const c=n[t];if(c.trim()===""||/^```/.test(c.trim())||/^#{1,6}\s+/.test(c)||/^-\s+/.test(c.trim())||c.includes("|")&&t+1<n.length&&me(n[t+1]))break;o.push(c),t++}a.push(s.jsx("p",{children:B(o.join(" "))},l++))}}return s.jsx("div",{className:"doc-body",children:a})}function xe({kind:e,title:n,owner:a,ownerLabel:t,note:l,children:i}){return s.jsxs("section",{className:`spec-part part-${e}`,children:[s.jsxs("header",{className:"part-head",children:[s.jsx("span",{className:"part-title",children:n}),s.jsx("span",{className:`part-owner owner-${a}`,children:t}),l&&s.jsx("span",{className:"part-note",children:l})]}),s.jsx("div",{className:"part-body",children:i})]})}function Vs({parts:e}){const n=k();return s.jsxs("div",{className:"spec-parts",children:[s.jsx(xe,{kind:"raw",title:n("nodeView.rawTitle"),owner:"human",ownerLabel:n("nodeView.rawOwner"),note:n("nodeView.rawNote"),children:s.jsx(W,{body:e.rawSource})}),s.jsx(xe,{kind:"expanded",title:n("nodeView.expandedTitle"),owner:"agent",ownerLabel:n("nodeView.expandedOwner"),note:n("nodeView.expandedNote"),children:s.jsx(W,{body:e.expandedSpec})})]})}const J=new Map;function Ls(e,n){const a=`${e}@${n??""}`,[t,l]=m.useState(()=>J.get(a)??null);return m.useEffect(()=>{const i=J.get(a);if(i){l(i);return}l(null);let o=!0;return fetch(_(e,"content")).then(c=>c.ok?c.json():Promise.reject(c.status)).then(c=>{J.set(a,c),o&&l(c)}).catch(()=>{o&&l({body:"",parts:null})}),()=>{o=!1}},[e,n,a]),t}function Fs({node:e}){var l;const n=k(),a=Ls(e.id,e.version),t=(e.driftFiles||[]).map(i=>`${i.file}: ${n("specNode.driftAhead",{n:i.behind})}`).join(`
|
|
12
|
+
`);return s.jsxs("div",{className:"pane-doc",children:[s.jsxs("h1",{children:["# ",e.title]}),s.jsx("blockquote",{children:e.desc}),s.jsxs("div",{className:"doc-stat",children:[s.jsxs("span",{className:`stat-status st-${e.status}`,"data-tip":n("nodeView.statusLabel"),children:[s.jsx("i",{className:"stat-dot"}),n(`status.${e.status}`)]}),s.jsxs("span",{className:"stat-chip","data-tip":n("nodeView.versionLabel"),children:["v",e.version||0]}),s.jsx(qe,{scenarios:e.scenarios,evals:e.evals}),e.drift>0&&s.jsxs("span",{className:"stat-chip stat-drift","data-tip":t,children:["⚠",e.drift]}),s.jsxs("span",{className:"stat-sess","data-tip":n("nodeView.lastEditedBy"),children:["✎ ",s.jsx("b",{children:e.session||n("common.none")})]})]}),((l=e.code)==null?void 0:l.length)>0?s.jsxs("div",{className:"doc-gov",children:[s.jsxs("span",{className:"doc-gov-h",children:[n("nodeView.governs")," ",s.jsx("b",{children:e.code.length})]}),s.jsx("div",{className:"doc-gov-files",children:e.code.map(i=>s.jsx("code",{className:"gov-f",children:i},i))})]}):s.jsx("div",{className:"doc-gov prose",children:s.jsx("span",{className:"doc-gov-h",children:n("nodeView.proseNode")})}),(()=>{if(a===null&&e.body==null)return s.jsx("div",{className:"pane-loading",children:s.jsx("span",{className:"spinner","aria-label":n("common.loading")})});const i=e.body??(a==null?void 0:a.body)??"",o=e.parts??(a==null?void 0:a.parts)??null;return o?s.jsx(Vs,{parts:o}):s.jsx(W,{body:i})})()]})}function As(e,n=!0){const[a,t]=m.useState(null);return m.useEffect(()=>{if(!n)return;let l=!0;return fetch(_(e,"history")).then(i=>i.json()).then(i=>{l&&t(i)}).catch(()=>l&&t([])),()=>{l=!1}},[e,n]),a}const Q=new Map;function Ds(e,n,a){const t=`${e}/${n}`,[l,i]=m.useState(()=>Q.get(t)??null);return m.useEffect(()=>{const o=Q.get(t);if(o){i(o);return}let c=!0;return fetch(_(e,"diff",n)).then(r=>r.json()).then(r=>{Q.set(t,r),c&&i(r)}).catch(()=>c&&i({patch:""})),()=>{c=!1}},[e,n,a,t]),l}function Ps(e){const n=[];let a=!1;for(const t of e.split(`
|
|
13
|
+
`)){if(t.startsWith("@@")){a=!0,n.push({t:"hunk",s:t});continue}!a||t.startsWith("\\")||(t.startsWith("+")?n.push({t:"add",s:t.slice(1)}):t.startsWith("-")?n.push({t:"del",s:t.slice(1)}):n.push({t:"ctx",s:t.slice(1)}))}for(;n.length&&n[n.length-1].t==="ctx"&&n[n.length-1].s==="";)n.pop();return n}function Le({diff:e}){const n=k();if(e==null)return s.jsx("figcaption",{className:"ev-note",children:n("nodeView.loadingChange")});const a=e.patch?Ps(e.patch):[];return a.length?s.jsxs(s.Fragment,{children:[s.jsx("figcaption",{className:"ev-difflabel",children:n("nodeView.diffLabel")}),s.jsx("pre",{className:"ev-diff",children:a.map((t,l)=>s.jsx("div",{className:`dl dl-${t.t}`,children:t.s||" "},l))})]}):s.jsx("figcaption",{className:"ev-note",children:n("nodeView.noChange")})}function Fe({items:e,itemKey:n,classes:a,rowClass:t,renderHeader:l,renderEvidence:i,leading:o,trailing:c,resetKey:r}){const u=k(),f=m.useRef(null),[j,v]=m.useState(()=>new Set([0]));m.useEffect(()=>{r!==void 0&&v(new Set([0]))},[r]);const $=m.useCallback(x=>v(w=>{const d=new Set(w);return d.has(x)?d.delete(x):d.add(x),d}),[]),N=m.useCallback(()=>v(x=>{const w=f.current;if(!w)return x;let d=-1;for(;x.has(d+1);)d++;if(d<0||d>=e.length-1)return x;const h=w.querySelector(`[data-i="${d}"]`);return!h||h.getBoundingClientRect().bottom-w.getBoundingClientRect().top>w.clientHeight+40?x:new Set(x).add(d+1)}),[e]);return m.useEffect(()=>{const x=f.current;if(!x)return;let w=x.scrollTop;const d=()=>{const g=x.scrollTop,S=g>w;w=g,S&&N()},h=g=>{g.key!=="j"&&g.key!=="ArrowDown"||x.scrollHeight-x.clientHeight-x.scrollTop>1||N()};return x.addEventListener("scroll",d,{passive:!0}),window.addEventListener("keydown",h,!0),()=>{x.removeEventListener("scroll",d),window.removeEventListener("keydown",h,!0)}},[N]),s.jsxs("div",{className:a.pane,ref:f,children:[e.length>1&&j.size<e.length&&s.jsx("div",{className:"chrono-tools",children:s.jsx("button",{className:"chrono-all",onClick:()=>v(new Set(e.keys())),children:u("nodeView.expandAll",{n:e.length})})}),o,e.map((x,w)=>{const d=j.has(w),h=t?t(x,w):"";return s.jsxs("div",{"data-i":w,className:`${a.row}${h?` ${h}`:""}${d?" open":""}`,children:[s.jsx("button",{className:a.head,onClick:()=>$(w),"aria-expanded":d,children:l(x,w,d)}),d&&s.jsx("figure",{className:a.evidence,children:i(x,w)})]},n(x,w))}),c]})}function Is({node:e,r:n,latest:a}){const t=Ds(e.id,n.hash,!0);return s.jsx(Le,{diff:t})}function Hs({node:e,rows:n}){const a=k();return n?n.length?s.jsx(Fe,{items:n,itemKey:t=>t.hash,classes:{pane:"pane-hist",row:"ver-row",head:"rec-toggle",evidence:"rec-evidence"},rowClass:(t,l)=>l===0?"latest":"",renderHeader:(t,l,i)=>s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"rec-head",children:[s.jsx("span",{className:"rec-caret",children:i?"▾":"▸"}),s.jsxs("span",{className:"rec-v",children:["v",n.length-l]}),s.jsx("code",{className:"rec-hash",children:t.hash.slice(0,7)}),s.jsx("span",{className:"rec-date",children:(t.date||"").slice(0,10)}),s.jsxs("span",{className:"rec-diff",children:[s.jsxs("b",{className:"rec-add",children:["+",t.additions??0]}),s.jsxs("b",{className:"rec-del",children:["−",t.deletions??0]})]})]}),s.jsx("div",{className:"rec-msg",children:t.reason}),s.jsxs("div",{className:"rec-sub",children:[a("nodeView.filesChanged",{n:t.files??0})," · ",t.session||a("common.idle")]})]}),renderEvidence:(t,l)=>s.jsx(Is,{node:e,r:t,latest:l===0})}):s.jsx("div",{className:"pane-hist empty",children:a("common.noVersions")}):s.jsx("div",{className:"pane-hist empty",children:a("nodeView.loadingHistory")})}function Ae({q:e,setQ:n,placeholder:a}){return s.jsx("div",{className:"pane-filter",children:s.jsx("input",{className:"pane-filter-input",value:e,placeholder:a,onChange:t=>n(t.target.value)})})}function Ts({node:e}){const n=k(),[a,t]=m.useState(""),l=e.issues||[];if(!l.length)return s.jsx("div",{className:"pane-issues empty",children:n("nodeView.noIssues")});const i=a.trim().toLowerCase(),o=i?l.filter(u=>`${u.id} ${u.concern||""}`.toLowerCase().includes(i)):l,c=o.filter(u=>u.status==="open"),r=o.filter(u=>u.status!=="open");return s.jsxs("div",{className:"pane-issues",children:[l.length>5&&s.jsx(Ae,{q:a,setQ:t,placeholder:n("nodeView.filterIssues")}),i&&!o.length&&s.jsx("div",{className:"pane-filter-none",children:n("nodeView.filterNone")}),c.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"issue-group-head",children:n("nodeView.openIssues",{n:c.length})}),c.map(u=>s.jsx(pe,{issue:u},u.id))]}),r.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"issue-group-head closed",children:n("nodeView.closedIssues",{n:r.length})}),r.map(u=>s.jsx(pe,{issue:u},u.id))]})]})}const X=new Map;function Rs(e,n,a){const t=`${e} ${n}`,[l,i]=m.useState(()=>X.get(t)??null);return m.useEffect(()=>{if(!e||!n)return;const o=X.get(t);o&&i(o);let c=!0;return fetch(`/api/edit?source=${encodeURIComponent(e)}&path=${encodeURIComponent(n)}`).then(r=>r.json()).then(r=>{X.set(t,r),c&&i(r)}).catch(()=>c&&i(r=>r??{patch:""})),()=>{c=!1}},[e,n,a,t]),l}function Bs({node:e,ov:n}){const a=k(),t=Rs(n.source,e.path,!0);return s.jsxs("figure",{className:"edit-rev",children:[s.jsxs("figcaption",{className:"edit-by",children:[s.jsx("span",{className:`ov-mark ov-${n.op}`,children:Es[n.op]||"•"}),s.jsx("span",{className:"edit-by-label",children:n.label}),s.jsx("span",{className:"edit-state",children:n.committed?a("nodeView.editCommitted"):a("nodeView.editDirty")})]}),s.jsx(Le,{diff:t})]})}function Os({node:e}){const n=k(),a=e.overlays||[];return a.length?s.jsx("div",{className:"pane-edit",children:a.map((t,l)=>s.jsx(Bs,{node:e,ov:t},l))}):s.jsx("div",{className:"pane-edit empty",children:n("nodeView.noEdit")})}function qs({verdict:e}){const n=k();return e?e.status==="pass"?s.jsx("span",{className:"eval-verdict pass",children:n("nodeView.eval.pass")}):e.status==="fail"?s.jsx("span",{className:"eval-verdict fail",children:n("nodeView.eval.fail")}):s.jsx("span",{className:"eval-verdict note","data-tip":e.note,children:n("nodeView.eval.note")}):s.jsx("span",{className:"eval-verdict legacy",children:n("nodeView.eval.legacy")})}function Ks({r:e}){var t;const n=k(),a=$e(e);return s.jsxs(s.Fragment,{children:[e.expected&&s.jsxs("div",{className:"eval-expected",children:[s.jsx("span",{className:"eval-expected-label",children:n("nodeView.eval.expected")})," ",e.expected]}),((t=e.verdict)==null?void 0:t.note)&&s.jsxs("div",{className:"eval-note",children:[s.jsx("span",{className:"eval-expected-label",children:n("nodeView.eval.noteLabel")})," ",e.verdict.note]}),a.length>0?s.jsx("div",{className:"eval-gallery",style:{display:"flex",flexDirection:"column",gap:8},children:a.map((l,i)=>s.jsx(Se,{e:l,alt:n("nodeView.eval.shotAlt",{scenario:e.scenario})},`${l.hash}-${i}`))}):s.jsx("figcaption",{className:"eval-noimg",children:e.blobState==="miss"?n("nodeView.eval.miss"):n("nodeView.eval.noImage")})]})}function ve({s:e}){var a;const n=k();return s.jsxs("div",{className:"eval-row eval-declared-row",children:[s.jsxs("span",{className:"eval-top",children:[s.jsx(ae,{state:"empty",title:n("score.missing")}),s.jsx("span",{className:"eval-scenario",children:e.name}),s.jsx(Ke,{tags:e.tags}),((a=e.code)==null?void 0:a.length)>0&&s.jsx("code",{className:"eval-tracks",children:e.code.join(", ")})]}),e.expected&&s.jsxs("div",{className:"eval-expected",children:[s.jsx("span",{className:"eval-expected-label",children:n("nodeView.eval.expected")})," ",e.expected]})]})}function ge({track:e}){const n=k();return s.jsxs("div",{className:"eval-row eval-dangling-row",children:[s.jsxs("span",{className:"eval-top",children:[s.jsx("span",{className:"eval-dangling-badge","data-tip":n("nodeView.eval.danglingTitle"),children:"⚠"}),s.jsx("span",{className:"eval-scenario eval-dangling-name",children:e.scenario}),s.jsx("span",{className:"eval-dangling-tag",children:n("nodeView.eval.danglingGone")})]}),s.jsx("div",{className:"eval-dangling-remarks",children:s.jsx(bs,{replies:e.remarks})})]})}const q=new Map;function zs({node:e}){var N,x,w;const n=k(),[a,t]=m.useState(""),l=`${e.id}@${((x=(N=e.evals)==null?void 0:N[0])==null?void 0:x.ts)||""}:${((w=e.evals)==null?void 0:w.length)||0}`,[i,o]=m.useState(()=>q.get(l)??null);if(m.useEffect(()=>{if(q.has(l)){o(q.get(l));return}let d=!0;return o(null),fetch(_(e.id,"evals")).then(h=>h.ok?h.json():Promise.reject(h.status)).then(h=>{const g={scenarios:h.scenarios||e.scenarios||[],readings:h.readings||[],dangling:h.dangling||[]};q.set(l,g),d&&o(g)}).catch(()=>{d&&o({scenarios:e.scenarios||[],readings:e.evals||[],dangling:[]})}),()=>{d=!1}},[l,e.id]),!e.evals)return s.jsx("div",{className:"pane-eval empty",children:n("nodeView.eval.noScenarios")});if(i===null)return s.jsx("div",{className:"pane-eval pane-loading",children:s.jsx("span",{className:"spinner","aria-label":n("common.loading")})});const c=i.readings,r=a.trim().toLowerCase(),u=d=>!r||(d||"").toLowerCase().includes(r),f=r?c.filter(d=>u(d.scenario)):c,j=(i.dangling||[]).filter(d=>u(d.scenario)),v=te(i.scenarios,c).filter(d=>!d.reading&&u(d.name)),$=i.readings.length+i.scenarios.length>5?s.jsx(Ae,{q:a,setQ:t,placeholder:n("nodeView.filterScenarios")},"filter"):null;return c.length?s.jsx(Fe,{items:f,resetKey:r,leading:[$,r&&!f.length&&!v.length&&!j.length?s.jsx("div",{className:"pane-filter-none",children:n("nodeView.filterNone")},"none"):null,...v.map(d=>s.jsx(ve,{s:d},d.name))],trailing:j.map(d=>s.jsx(ge,{track:d},d.threadId)),itemKey:(d,h)=>`${d.scenario}-${d.ts}-${h}`,classes:{pane:"pane-eval",row:"eval-row",head:"eval-head",evidence:"eval-shot"},renderHeader:(d,h,g)=>s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"eval-top",children:[s.jsx("span",{className:"eval-caret",children:g?"▾":"▸"}),s.jsx("span",{className:"eval-scenario",children:d.scenario}),s.jsx(qs,{verdict:d.verdict}),s.jsx(ae,{state:ye(d),title:d.fresh?void 0:n("nodeView.eval.staleAxes",{axes:d.staleAxes.join(", ")})})]}),s.jsxs("span",{className:"eval-meta",children:[d.evaluator&&s.jsx("span",{className:"eval-evaluator",children:d.evaluator}),s.jsx("code",{className:"eval-sha",children:d.codeSha.slice(0,7)}),s.jsx("span",{className:"eval-ts",children:d.ts.replace("T"," ").slice(0,16)})]})]}),renderEvidence:d=>s.jsx(Ks,{r:d})}):s.jsxs("div",{className:"pane-eval pane-eval-declared",children:[$,s.jsx("div",{className:"eval-todo-note",children:r&&!v.length?n("nodeView.filterNone"):n("nodeView.eval.noReadings")}),v.map(d=>s.jsx(ve,{s:d},d.name)),j.map(d=>s.jsx(ge,{track:d},d.threadId))]})}const Ws={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"};function pn({node:e,pane:n,setPane:a,onClose:t}){const l=k(),i=e.issues||[],o=i.filter(v=>v.status==="open").length,c=i.length-o,r=(e.overlays||[]).length,u=Ms(e),f=u.some(v=>v.key===n)?n:u[0].key,j=As(e.id,f==="history");return s.jsx("div",{className:"ov-backdrop","data-focus-overlay":!0,onMouseDown:t,children:s.jsxs("div",{className:"ov-panel",onMouseDown:v=>v.stopPropagation(),children:[s.jsxs("div",{className:"ov-head",children:[s.jsx("span",{className:"ov-title",children:e.title}),s.jsx("div",{className:"ov-tabs",children:u.map((v,$)=>s.jsxs("button",{className:v.key===f?"ov-tab on":"ov-tab",onClick:()=>a(v.key),children:[s.jsx("kbd",{children:$+1})," ",l(Ws[v.key]),v.key==="issues"&&(o>0||c>0)&&s.jsxs("span",{className:"ov-tab-counts",children:[o>0&&s.jsx("span",{className:"ovc st-open","data-tip":l("nodeView.openIssues",{n:o}),children:o}),c>0&&s.jsx("span",{className:"ovc st-closed","data-tip":l("nodeView.closedIssues",{n:c}),children:c})]}),v.key==="edit"&&r>0&&s.jsx("span",{className:"ov-tab-counts",children:s.jsx("span",{className:"ovc st-edit","data-tip":l("nodeView.pendingEdits",{n:r}),children:r})})]},v.key))}),s.jsx("span",{className:"ov-hint",children:l("nodeView.hint")})]}),s.jsxs("div",{className:"ov-body",children:[f==="spec"&&s.jsx("div",{className:"pane-solo",children:s.jsx(Fs,{node:e})}),f==="history"&&s.jsx(Hs,{node:e,rows:j}),f==="issues"&&s.jsx(Ts,{node:e}),f==="eval"&&s.jsx(zs,{node:e}),f==="edit"&&s.jsx(Os,{node:e})]})]})})}const _s=({size:e=12})=>s.jsx(U,{name:"lock",size:e});function Us(e){if(!e.length)return null;const n={};return e.forEach(a=>{n[a.op]=(n[a.op]||0)+1}),Object.entries(n).map(([a,t])=>`${ze[a]}${t}`).join(" ")}function Gs({guides:e=[],expandable:n,expanded:a,rollup:t,kin:l=0,onToggle:i}){return s.jsxs("span",{className:"sess-lead",children:[e.map((o,c)=>{const r=c===e.length-1?o?"tee":"elbow":o?"rail":"gap";return s.jsx("span",{className:`sess-rail ${r}`,"aria-hidden":"true"},c)}),n&&s.jsx("span",{className:`sess-fold pod${a?" open":""}`,role:"button",tabIndex:-1,style:a?{color:t,borderColor:t}:{background:t,borderColor:t},"data-tip":`${l} nested session${l===1?"":"s"} — click to ${a?"collapse":"expand"}`,onClick:o=>{o.stopPropagation(),i==null||i()},onMouseDown:o=>o.stopPropagation(),children:l})]})}function Zs(){const[e,n]=m.useState(()=>new Set);return{expanded:e,toggle:t=>n(l=>{const i=new Set(l);return i.has(t)?i.delete(t):i.add(t),i})}}function Ys({s:e,locked:n,showAvatar:a=!0,lead:t=null}){const l=k(),i=Us(e.ops),o=ke(e),c=l(`status.${e.status}`);return s.jsxs(s.Fragment,{children:[t,a&&s.jsx(Te,{seed:e.id,status:e.status,title:`${_e(e)} · ${c} — ${e.id.slice(0,8)}`}),s.jsxs("span",{className:"sess-meta",children:[s.jsx("span",{className:"sess-glyph",style:{color:L[e.status]},"data-tip":c,"aria-label":c,children:We[e.status]}),i&&s.jsx("span",{className:"sess-ops",children:i})]}),s.jsx("span",{className:"sess-id","data-tip":o,children:o}),n&&s.jsx("span",{className:"sess-lock","data-tip":l("sessionWindow.lockedTitle"),children:s.jsx(_s,{})})]})}function fn({sessions:e,activeId:n,onPick:a,onOpenSession:t}){const l=k(),{expanded:i,toggle:o}=Zs(),c=m.useMemo(()=>Ze(e,r=>i.has(r)),[e,i]);return s.jsx("div",{className:"sesswin",children:e.length===0?s.jsxs("div",{className:"sesswin-empty",children:[l("sessionWindow.emptyBefore"),s.jsx("kbd",{children:"⏎"}),l("sessionWindow.emptyAfter")]}):c.map(r=>{if(r.type==="zone")return s.jsx("div",{className:`sesswin-zone sesswin-zone-${r.zone}`,children:l(`sessionZone.${r.zone}`)},`zone-${r.zone}`);const u=r.s,f=u.source===n,j=r.expandable||r.depth?s.jsx(Gs,{guides:r.guides,expandable:r.expandable,expanded:r.expanded,rollup:r.rollup,kin:r.kin,onToggle:()=>o(u.id)}):null;return s.jsx("button",{className:f?"sess-row locked":"sess-row",style:{"--ov":Ie(u.id)},onClick:()=>a(u),onDoubleClick:()=>t(u.id),"data-tip":l("sessionWindow.rowTitle"),children:s.jsx(Ys,{s:u,locked:f,lead:j})},u.id)})})}export{ln as $,Te as A,Ys as B,sn as C,R as D,zs as E,Xe as F,ze as G,Hs as H,pe as I,gs as J,ps as K,_s as L,xs as M,pn as N,nn as O,fs as P,ms as Q,Gs as R,Qs as S,Ke as T,ds as U,an as V,Ee as W,$e as X,Ns as Y,se as Z,Ce as _,qe as a,ys as a0,tn as a1,Se as a2,bs as a3,rn as a4,Qe as a5,Xs as a6,be as a7,Ye as a8,W as a9,vs as aa,We as b,L as c,te as d,Oe as e,un as f,en as g,cn as h,Ss as i,_e as j,dn as k,Ie as l,ae as m,U as n,Z as o,hn as p,Ms as q,fn as r,ke as s,As as t,on as u,Fs as v,Ts as w,Os as x,Zs as y,Ze as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{w as g,r,j as s,L as u}from"./index-BQu-oJ8J.js";import{A as p,k as x,b as j,i as k,r as f,s as N}from"./Dashboard-C_fGmOKK.js";import"./SessionWindow-JYbpPwNB.js";const o="spexcode.theme",b=[{code:"light",label:"settings.theme.light"},{code:"dark",label:"settings.theme.dark"}];function m(){try{if(typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}catch{}return"light"}function y(){try{const t=localStorage.getItem(o);if(t==="light"||t==="dark")return t}catch{}return m()}function v(t){const c=t==="light"||t==="dark"?t:m();try{document.documentElement.setAttribute("data-theme",c)}catch{}try{localStorage.setItem(o,c)}catch{}return c}function E({t}){const[c,d]=r.useState(0),[n,i]=r.useState(null),l=()=>d(e=>e+1);return r.useEffect(()=>{if(!n)return;const e=a=>{if(a.preventDefault(),a.stopPropagation(),a.key==="Escape"){i(null);return}["Shift","Control","Alt","Meta"].includes(a.key)||(N(n,{keys:[a.key]}),i(null),l())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]),s.jsxs("section",{className:"legend-sec",children:[s.jsx("div",{className:"legend-h",children:t("settings.secShortcuts")}),s.jsx("div",{className:"set-keys",children:p.map(e=>s.jsxs("div",{className:"set-key-row",children:[s.jsx("span",{className:"legend-desc",children:t(e.desc)}),s.jsx("button",{className:`bind-cell${n===e.id?" capturing":""}${e.rebind?"":" fixed"}${k(e.id)?" custom":""}`,disabled:!e.rebind,onClick:()=>e.rebind&&i(e.id),children:n===e.id?s.jsx("span",{className:"bind-hint",children:t("settings.bindPrompt")}):x(e.id).map((a,h)=>s.jsx("kbd",{children:j(a)},h))})]},e.id))}),s.jsxs("div",{className:"set-foot",children:[s.jsx("span",{className:"legend-desc set-hint",children:t("settings.shortcutsHint")}),s.jsx("button",{className:"set-reset",onClick:()=>{f(),i(null),l()},children:t("settings.reset")})]})]})}function w(){const{t,lang:c,setLang:d}=g(),[n,i]=r.useState(y),l=e=>{v(e),i(e)};return s.jsx("div",{className:"page-pane page-settings",children:s.jsxs("div",{className:"settings-body",children:[s.jsx("h1",{className:"page-title",children:t("settings.title")}),s.jsxs("section",{className:"legend-sec",children:[s.jsx("div",{className:"legend-h",children:t("settings.secLanguage")}),s.jsx("div",{className:"set-langs",children:u.map(e=>s.jsx("button",{className:e.code===c?"set-lang on":"set-lang",onClick:()=>d(e.code),"aria-pressed":e.code===c,children:e.label},e.code))})]}),s.jsxs("section",{className:"legend-sec",children:[s.jsx("div",{className:"legend-h",children:t("settings.secTheme")}),s.jsx("div",{className:"set-langs",children:b.map(e=>s.jsx("button",{className:e.code===n?"set-lang on":"set-lang",onClick:()=>l(e.code),"aria-pressed":e.code===n,children:t(e.label)},e.code))})]}),s.jsx(E,{t})]})})}export{w as default};
|