spexcode 0.2.6 → 0.2.8
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/README.md +4 -2
- package/package.json +1 -1
- package/spec-cli/src/cli.ts +9 -1
- package/spec-cli/src/guide.ts +23 -16
- package/spec-cli/src/harness.ts +18 -9
- package/spec-cli/src/help.ts +4 -1
- package/spec-cli/src/sessions.ts +34 -15
- package/spec-cli/templates/spec/project/.config/supervisor/spec.md +1 -1
- package/spec-dashboard/dist/assets/{Dashboard-BlRRsxE7.js → Dashboard-P0B9ukSG.js} +3 -3
- package/spec-dashboard/dist/assets/{EvalsPage-BzVE38-Z.js → EvalsPage-BrvAGyc4.js} +1 -1
- package/spec-dashboard/dist/assets/{FoldToggle-DFuLVOeu.js → FoldToggle-BuQ0lokE.js} +1 -1
- package/spec-dashboard/dist/assets/{IssuesPage-CzDaazhe.js → IssuesPage-H-D8aHEl.js} +1 -1
- package/spec-dashboard/dist/assets/{MobileApp-CXQrQCNp.js → MobileApp-oZXIeCPb.js} +1 -1
- package/spec-dashboard/dist/assets/{SessionInterface-D1pUBl6q.js → SessionInterface-Blr_MEdU.js} +1 -1
- package/spec-dashboard/dist/assets/{SessionWindow-Y25Bwg1e.js → SessionWindow-LcCzBMU7.js} +2 -2
- package/spec-dashboard/dist/assets/{Settings-R610Vbzd.js → Settings-_yOye-In.js} +1 -1
- package/spec-dashboard/dist/assets/{index-BO0Zuweu.js → index-BhIslAau.js} +2 -2
- package/spec-dashboard/dist/index.html +1 -1
- package/spec-yatsu/src/cli.ts +3 -5
- package/spec-yatsu/src/evaltab.ts +3 -2
- package/spec-yatsu/src/filing.ts +3 -4
- package/spec-yatsu/src/freshness.ts +7 -5
- package/spec-yatsu/src/proof.ts +3 -2
- package/spec-yatsu/src/scenariofresh.ts +27 -5
- package/spec-yatsu/src/sidecar.ts +8 -8
- package/spec-yatsu/src/evaluator.ts +0 -24
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as pe,r as a,s as We,e as Ye,j as n,f as Ge}from"./index-
|
|
1
|
+
import{u as pe,r as a,s as We,e as Ye,j as n,f as Ge}from"./index-BhIslAau.js";import{V as Ze,W as Je,X as Qe,Y as et,Z as tt,g as fe,n as nt,_ as Q,$ as st,a0 as Ae,a1 as at,a2 as lt,u as ot,z as he,a3 as it,o as rt,a4 as ct}from"./SessionWindow-LcCzBMU7.js";import{F as me}from"./FoldToggle-BuQ0lokE.js";const Ie=(l,c)=>{let d=null;for(const v of l)if(v.at<=c)d=v;else break;return d},ut=l=>{if(!l||!Array.isArray(l.events))return null;const c=l.v===1?"time":typeof l.axis=="string"?l.axis:"time",d=l.v===1?v=>v.tMs:v=>v.at;return{axis:c,events:l.events.map(v=>({at:d(v),step:v.step,...v.node?{node:v.node}:{}}))}},dt=(l,c,d)=>l==="time"?Q(c):l==="frame"?`#${c}`:l==="line"?`L${c}`:l==="index"?d?`${c}/${d}`:`${c}`:String(c);function Pe({events:l,axis:c,extent:d,activeStepIdx:v,onSeek:$}){return n.jsx("div",{className:"an-ruler",children:l.map((i,f)=>n.jsxs("button",{className:`an-step ${v===f?"on":""}`,onClick:()=>$(i.at),"data-tip":i.node?`→ ${i.node}`:void 0,children:[dt(c,i.at,d)," ",i.step]},f))})}const ve=l=>{var c,d;return((c=l.verdict)==null?void 0:c.status)==="pass"?"✓":((d=l.verdict)==null?void 0:d.status)==="fail"?"✗":"·"},Fe=l=>{var c,d;return((c=l.verdict)==null?void 0:c.status)==="pass"?"pass":((d=l.verdict)==null?void 0:d.status)==="fail"?"fail":"legacy"};function ft({entry:l,specs:c=[],sessions:d=[],onWrite:v,onOpenSession:$}){var Re,Le,Te,De,Ce;const i=pe(),f=a.useRef(null),x=a.useRef(null),j=a.useRef(null),k=a.useRef(null),g=a.useRef(0),[u,M]=a.useState([]),[w,y]=a.useState("time"),[r,b]=a.useState(null),[S,T]=a.useState(""),[D,X]=a.useState(!1),[ee,z]=a.useState(null),C=a.useRef(null),h=a.useRef(null),I=a.useRef(null),te=a.useRef(0),[Be,xe]=a.useState(0),[ne,ge]=a.useState(-1),[ye,be]=a.useState(null),[H,se]=a.useState(!1),[we,ae]=a.useState(!1),[le,oe]=a.useState(null),[_,ie]=a.useState(null),[E,je]=a.useState(null),[A,q]=a.useState(0),p=E&&E[A]||l;a.useEffect(()=>{b(null),T(""),M([]),z(null),q(0),je(null);let e=!0;return fetch(We(l.node,"evals")).then(t=>t.ok?t.json():null).then(t=>{e&&Array.isArray(t==null?void 0:t.readings)&&je(t.readings.filter(s=>s.scenario===l.scenario))}).catch(()=>{}),()=>{e=!1}},[l.node,l.scenario,l.ts,l.blob]),a.useEffect(()=>{b(null),z(null)},[A]);const O=Ze(p),P=O.find(e=>e.kind==="video"&&e.state==="present"),re=O.filter(e=>e.kind==="image"),Ve=O.filter(e=>e.kind!=="video"&&e.kind!=="image"),K=!!P,B=l.thread??null,ce=a.useMemo(()=>B?[{by:B.by,at:B.created,body:B.body},...B.replies||[]]:[],[B]),Xe=E&&((Re=E[0])==null?void 0:Re.by)||l.by||null,R=a.useMemo(()=>ce.map((e,t)=>{const s=Je(Qe(e.body),u);return s&&s.seekable?{i:t,tMs:s.tMs,step:s.step,label:s.label}:null}).filter(Boolean).sort((e,t)=>e.tMs-t.tMs),[ce,u]),ke=a.useRef(u);ke.current=u;const Me=a.useRef(R);Me.current=R;const W=a.useCallback(()=>{const e=te.current,t=ke.current;let s=-1;for(let m=0;m<t.length&&t[m].at<=e;m++)s=m;ge(m=>m===s?m:s);let o=null;for(const m of Me.current)if(m.tMs<=e)o=m.i;else break;be(m=>m===o?m:o)},[]);a.useEffect(()=>{W()},[R,u,W]),a.useEffect(()=>{te.current=0,C.current&&(C.current.style.width="0%"),h.current&&(h.current.style.left="0%"),I.current&&(I.current.textContent=""),ge(-1),be(null),xe(0),se(!1),ae(!1),oe(null),ie(null)},[l.blob,l.scenario,l.node]),a.useEffect(()=>{if(M([]),y("time"),!p.timelineBlob)return;let e=!0;return fetch(`/api/yatsu/blob/${p.timelineBlob}`).then(t=>t.ok?t.json():null).then(t=>{const s=e&&ut(t);s&&(M(s.events),y(s.axis))}).catch(()=>{}),()=>{e=!1}},[p.timelineBlob]),a.useEffect(()=>{const e=f.current;if(!e)return;const t=()=>{const N=Math.round((e.currentTime||0)*1e3),L=Math.round((e.duration||0)*1e3);te.current=N;const J=L?N/L*100:0;C.current&&(C.current.style.width=`${J}%`),h.current&&(h.current.style.left=`${J}%`),I.current&&(I.current.textContent=`${Q(N)} / ${Q(L)}`),W()},s=()=>{xe(e.duration||0),t()},o=()=>se(!0),m=()=>se(!1);return e.addEventListener("timeupdate",t),e.addEventListener("seeked",t),e.addEventListener("loadedmetadata",s),e.addEventListener("durationchange",s),e.addEventListener("play",o),e.addEventListener("pause",m),s(),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("seeked",t),e.removeEventListener("loadedmetadata",s),e.removeEventListener("durationchange",s),e.removeEventListener("play",o),e.removeEventListener("pause",m)}},[P==null?void 0:P.hash,l.node,l.scenario,A,W]);const F=Math.round(Be*1e3),Y=u[ne]||null,Ne=w==="time"?F:w==="frame"?re.length:w==="index"?u.length:0,V=a.useCallback(e=>{const t=f.current;t&&(t.currentTime=e/1e3)},[]),G=a.useCallback(()=>{const e=f.current;e&&(e.paused?e.play():e.pause())},[]),Ee=(e,t)=>{ie(e),t!=null&&V(t)},Z=a.useCallback(async e=>{const t=f.current;if(!(t!=null&&t.videoWidth))return null;X(!0),T(i("annotator.capturing"));try{t.seeking&&await new Promise(L=>t.addEventListener("seeked",L,{once:!0}));const s=document.createElement("canvas");s.width=t.videoWidth,s.height=t.videoHeight;const o=s.getContext("2d");o.drawImage(t,0,0,s.width,s.height),e&&(o.strokeStyle="#ff9a3c",o.lineWidth=Math.max(2,s.width/300),o.strokeRect(e.x/100*s.width,e.y/100*s.height,e.w/100*s.width,e.h/100*s.height));const m=await new Promise(L=>s.toBlob(L,"image/png")),{hash:N}=await Ye(m);if(!N)throw new Error("no hash");return T(""),N}catch{return T(i("annotator.failed")),null}finally{X(!1)}},[i]),ze=a.useCallback(async()=>{var s;const e=f.current;if(!e)return null;e.pause();const t=Math.round((e.currentTime??0)*1e3);return{tMs:t,step:((s=Ie(u,t))==null?void 0:s.step)??null,frame:await Z(null)}},[u,Z]),ue=a.useCallback(async e=>{const t=f.current;if(!t)return;t.pause();const s=Math.round((t.currentTime||0)*1e3),o=Ie(u,s),m=await Z(e),N=[et(s,o==null?void 0:o.step)];m&&N.push(``),o!=null&&o.node&&o.node!==l.node&&N.push(`re: [[${o.node}]]`),N.push(""),z({seq:++g.current,body:N.join(`
|
|
2
2
|
`)})},[u,l.node,Z]),de=a.useCallback(e=>{var o;if(!R.length)return;let t=R.findIndex(m=>m.i===_);if(t<0){const m=Math.round((((o=f.current)==null?void 0:o.currentTime)||0)*1e3);t=R.reduce((N,L,J)=>L.tMs<=m?J:N,-1)}t=Math.min(R.length-1,Math.max(0,t+e));const s=R[t];ie(s.i),V(s.tMs)},[R,_,V]);a.useEffect(()=>{if(!K)return;const e=t=>{const s=document.activeElement;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"||s.isContentEditable))return;const o=f.current;o&&(t.key===" "?(t.preventDefault(),G()):t.key==="ArrowRight"?(t.preventDefault(),o.currentTime=Math.min(o.duration||o.currentTime,o.currentTime+(t.shiftKey?1:5))):t.key==="ArrowLeft"?(t.preventDefault(),o.currentTime=Math.max(0,o.currentTime-(t.shiftKey?1:5))):t.key===","?(t.preventDefault(),o.currentTime=Math.max(0,o.currentTime-1/30)):t.key==="."?(t.preventDefault(),o.duration&&(o.currentTime=Math.min(o.duration,o.currentTime+1/30))):t.key==="ArrowDown"?(t.preventDefault(),de(1)):t.key==="ArrowUp"?(t.preventDefault(),de(-1)):(t.key==="a"||t.key==="A")&&(t.preventDefault(),ue(null)))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[K,G,de,ue]);const $e=e=>{var o;const t=(o=j.current)==null?void 0:o.getBoundingClientRect(),s=f.current;!t||!t.width||!s||!s.duration||(s.currentTime=Math.min(1,Math.max(0,(e-t.left)/t.width))*s.duration)},Oe=e=>{e.preventDefault(),ae(!0),$e(e.clientX)},Ue=e=>{var s;const t=(s=j.current)==null?void 0:s.getBoundingClientRect();t!=null&&t.width&&oe(Math.min(100,Math.max(0,(e.clientX-t.left)/t.width*100)))};a.useEffect(()=>{if(!we)return;const e=s=>$e(s.clientX),t=()=>ae(!1);return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[we]);const Se=e=>{const t=x.current.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width*100,y:(e.clientY-t.top)/t.height*100}},He=e=>{if(e.button!==0||D)return;const t=Se(e);b({x0:t.x,y0:t.y,x:t.x,y:t.y})},_e=e=>{var s,o;if(!r)return;const t=Se(e);!((s=f.current)!=null&&s.paused)&&(Math.abs(t.x-r.x0)>1||Math.abs(t.y-r.y0)>1)&&((o=f.current)==null||o.pause()),b({...r,x:t.x,y:t.y})},qe=()=>{if(!r)return;const e={x:Math.min(r.x0,r.x),y:Math.min(r.y0,r.y),w:Math.abs(r.x-r.x0),h:Math.abs(r.y-r.y0)};if(b(null),e.w<1&&e.h<1){G();return}ue(e)},U=r&&{x:Math.min(r.x0,r.x),y:Math.min(r.y0,r.y),w:Math.abs(r.x-r.x0),h:Math.abs(r.y-r.y0)};return n.jsxs("div",{className:"an-detail",children:[n.jsxs("header",{className:"an-head",children:[n.jsx("span",{className:"an-title",children:l.scenario}),n.jsx("span",{className:"an-node",children:l.node}),n.jsx("span",{className:`an-verdict-badge ${Fe(p)}`,children:ve(p)}),p.evaluator&&n.jsx("span",{className:"an-meta",children:p.evaluator}),n.jsx("span",{className:"an-meta",children:new Date(p.ts).toLocaleString()}),n.jsx(tt,{originator:Xe,sessions:d,kind:"eval",onOpenSession:$}),E&&E.length>1&&n.jsxs("div",{className:"an-ab",children:[n.jsx(fe,{icon:"chevron-left",size:13,className:"an-ab-nav",disabled:A>=E.length-1,onClick:()=>q(e=>Math.min(E.length-1,e+1)),label:i("annotator.abOlder")}),n.jsx("div",{className:"an-ab-track",children:E.slice().reverse().map((e,t)=>{const s=E.length-1-t;return n.jsx("button",{type:"button",className:`an-ab-pip ${Fe(e)} ${s===A?"on":""}`,onClick:()=>q(s),"data-tip":`${ve(e)} ${new Date(e.ts).toLocaleString()}`,children:ve(e)},`${e.ts}-${s}`)})}),n.jsx(fe,{icon:"chevron-right",size:13,className:"an-ab-nav",disabled:A<=0,onClick:()=>q(e=>Math.max(0,e-1)),label:i("annotator.abNewer")}),n.jsx("span",{className:"an-ab-pos",children:A===0?i("annotator.abLatest"):i("annotator.abPos",{i:E.length-A,n:E.length})})]})]}),n.jsxs("div",{className:"an-work",children:[n.jsxs("div",{className:"an-stage-col",children:[p.expected&&n.jsxs("div",{className:"an-expected",children:[n.jsx("b",{children:i("nodeView.eval.expected")})," ",p.expected]}),O.length>0&&((Le=p.verdict)==null?void 0:Le.note)&&n.jsxs("div",{className:"an-expected an-prior-note",children:[n.jsx("b",{children:i("nodeView.eval.noteLabel")})," ",p.verdict.note]}),!p.fresh&&(((Te=p.staleAxes)==null?void 0:Te.length)??0)>0&&n.jsxs("div",{className:"an-expected an-stale","data-tip":i("nodeView.eval.staleReadoutTitle"),children:[n.jsx("b",{children:i("nodeView.eval.staleLabel")})," ",p.staleAxes.join(" · "),(((De=p.codeDrift)==null?void 0:De.length)??0)>0&&n.jsxs("span",{className:"an-stale-files",children:[" — ",p.codeDrift.map(e=>`${e.file.split("/").pop()} +${e.behind}`).join(", ")]})]}),P&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"an-player",ref:k,children:[n.jsxs("div",{className:`an-stage ${H?"playing":"paused"}`,ref:x,onMouseDown:He,onMouseMove:_e,onMouseUp:qe,children:[n.jsx("video",{className:"an-video",ref:f,src:`/api/yatsu/blob/${P.hash}`,preload:"metadata",playsInline:!0}),U&&n.jsx("div",{className:"an-rect live",style:{left:`${U.x}%`,top:`${U.y}%`,width:`${U.w}%`,height:`${U.h}%`}}),!H&&!r&&n.jsx("div",{className:"an-bigplay","aria-hidden":!0,children:n.jsx(nt,{name:"play",size:22})})]}),n.jsxs("div",{className:"an-bar",children:[n.jsx(fe,{icon:H?"pause":"play",size:14,className:"an-play",label:i(H?"annotator.pause":"annotator.play"),onClick:G}),n.jsxs("div",{className:"an-seek",ref:j,onMouseDown:Oe,onMouseMove:Ue,onMouseLeave:()=>oe(null),children:[n.jsx("div",{className:"an-seek-trk"}),F>0&&w==="time"&&u.map((e,t)=>n.jsx("div",{className:"an-band",style:{left:`${e.at/F*100}%`},"data-tip":e.step},`band-${t}`)),n.jsx("div",{className:"an-seek-play",ref:C}),F>0&&R.map(e=>n.jsx("button",{type:"button",className:`an-mk ${_===e.i?"on":""} ${ye===e.i?"active":""}`,style:{left:`${e.tMs/F*100}%`},"data-tip":e.label,onMouseDown:t=>t.stopPropagation(),onClick:t=>{t.stopPropagation(),Ee(e.i,e.tMs)}},`mk-${e.i}`)),n.jsx("div",{className:"an-knob",ref:h}),le!=null&&F>0&&n.jsx("div",{className:"an-seek-hov",style:{left:`${le}%`},children:Q(le/100*F)})]}),n.jsx("span",{className:"an-time",ref:I}),Y&&n.jsx("span",{className:"an-curstep","data-tip":Y.node?`→ ${Y.node}`:void 0,children:Y.step}),n.jsx(st,{target:k})]})]}),u.length>0&&n.jsx(Pe,{events:u,axis:w,extent:Ne,activeStepIdx:ne,onSeek:V}),n.jsx("div",{className:"an-hint",children:i("annotator.hint")}),n.jsx("div",{className:"an-keys",children:i("annotator.keys")}),S&&n.jsx("div",{className:"an-flash",children:S})]}),!P&&u.length>0&&n.jsx(Pe,{events:u,axis:w,extent:Ne,activeStepIdx:ne,onSeek:V}),re.length>0&&n.jsx("div",{className:"an-gallery",children:re.map((e,t)=>n.jsx(Ae,{e,alt:l.scenario},`${e.hash}-${t}`))}),Ve.map((e,t)=>n.jsx(Ae,{e,alt:l.scenario},`${e.hash}-${t}`)),O.length===0&&((Ce=p.verdict)!=null&&Ce.note?n.jsx("pre",{className:"eval-transcript",children:p.verdict.note}):n.jsx("div",{className:"an-hint",children:i("nodeView.eval.noImage")}))]}),n.jsx(ht,{entry:l,comments:ce,specs:c,sessions:d,onWrite:v,codeSha:p.codeSha,seekMs:K?V:null,anchorNow:K?ze:null,draft:ee,selIdx:_,activeIdx:ye,onSelect:K?Ee:null,events:K?u:null})]})]})}function ht({entry:l,comments:c,codeSha:d,specs:v,sessions:$,onWrite:i,seekMs:f,anchorNow:x,draft:j,selIdx:k,activeIdx:g,onSelect:u,events:M}){var r;const w=pe(),y=(b,S)=>Ge({node:l.node,scenario:l.scenario,body:b,codeSha:d,evidence:S});return n.jsxs("aside",{className:"an-rail",children:[n.jsx("div",{className:"an-comments-head",children:w("annotator.comments",{n:c.length})}),n.jsx("div",{className:"an-rail-list",children:n.jsx(at,{replies:c,onSeek:f,selIdx:k,activeIdx:g,onSelect:u,events:M,threadId:((r=l.thread)==null?void 0:r.id)??null,onRemarkChange:()=>i==null?void 0:i("")})}),n.jsx("div",{className:"an-rail-compose",children:n.jsx(lt,{onSend:y,specs:v,sessions:$,focusId:l.node,onDone:i,anchorNow:x,draft:j},`${l.node}·${l.scenario}`)})]})}function Ke({rowKeys:l,sel:c,onSel:d,detail:v,children:$}){const[i,f]=a.useState(!1),x=a.useRef({});x.current={rowKeys:l,sel:c},a.useEffect(()=>{const k=g=>{var b;const u=(b=g.target)==null?void 0:b.tagName;if(u==="INPUT"||u==="TEXTAREA"||g.metaKey||g.ctrlKey||g.altKey||g.key!=="j"&&g.key!=="k")return;g.preventDefault(),g.stopPropagation();const{rowKeys:M,sel:w}=x.current;if(!M.length)return;const y=M.indexOf(w),r=y<0?g.key==="j"?0:M.length-1:Math.max(0,Math.min(M.length-1,y+(g.key==="j"?1:-1)));d(M[r])};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[d]),a.useEffect(()=>{var k;(k=document.querySelector(".fv-list-col .sel"))==null||k.scrollIntoView({block:"nearest"})},[c]);const j=n.jsx(me,{className:"fv-fold-inline",onToggle:()=>f(!0)});return n.jsxs("div",{className:`fv-master ${i?"folded":""}`,children:[i&&n.jsx(me,{className:"fv-unfold",folded:!0,onToggle:()=>f(!1)}),n.jsx("div",{className:"fv-list-col",style:i?{display:"none"}:void 0,children:typeof $=="function"?$(j):n.jsxs(n.Fragment,{children:[n.jsx(me,{className:"fv-fold",onToggle:()=>f(!0)}),$]})}),n.jsx("div",{className:"fv-detail",children:v})]})}function mt({specs:l=[],sessions:c=[],reloadBoard:d,onOpenSession:v}){const $=pe(),{page:i,param:f}=ot(),[x,j]=a.useState(null),[k,g]=a.useState(""),[u,M]=a.useState([]),w=a.useRef([]),y=a.useMemo(()=>new Map(u.map(h=>[he(h),h])),[u]);w.current=u.map(he);const r=x&&y.has(x)?x:w.current[0]??null,b=a.useMemo(()=>{if(!f)return null;const h=f.indexOf("/");return h>0?`eval:${f.slice(0,h)}·${f.slice(h+1)}`:null},[f]),[S,T]=a.useState(null);a.useEffect(()=>{i==="evals"&&b&&(j(b),T(b))},[i,b]),a.useEffect(()=>{S&&y.has(S)&&T(null)},[S,y]);const D=x&&!y.has(x),X=a.useMemo(()=>!D||it(l).some(h=>he(h)===x),[D,l,x]);a.useEffect(()=>{D&&!X&&(j(null),T(null))},[D,X]),a.useEffect(()=>{x&&!S&&u.length&&!y.has(x)&&j(null)},[x,S,u,y]),a.useEffect(()=>{if(i!=="evals"||!r||D)return;const h=/^eval:([^·]+)·(.+)$/.exec(r);h&&rt("evals",`${h[1]}/${h[2]}`,{replace:!0})},[i,r,D]);const ee=a.useCallback(h=>M(h),[]),z=h=>{h&&(g(h),setTimeout(()=>g(""),6e3))},C=r?y.get(r):null;return n.jsx(Ke,{rowKeys:w.current,sel:r,onSel:j,detail:C?n.jsx(ft,{entry:C,specs:l,sessions:c,onOpenSession:v,onWrite:async h=>{z(h),await(d==null?void 0:d())}}):n.jsx("div",{className:"fv-note",children:$("evalsFeed.empty")}),children:h=>n.jsxs(n.Fragment,{children:[k&&n.jsx("div",{className:"fv-notice",children:k}),n.jsx(ct,{nodes:l,sessions:c,sel:r,onSel:I=>j(I),onRows:ee,mustShow:S,lead:h})]})})}const gt=Object.freeze(Object.defineProperty({__proto__:null,EvalMasterDetail:Ke,default:mt},Symbol.toStringTag,{value:"Module"}));export{ft as E,Ke as a,gt as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as l,j as t}from"./index-
|
|
1
|
+
import{u as l,j as t}from"./index-BhIslAau.js";import{n as a}from"./SessionWindow-LcCzBMU7.js";function r(){return t.jsx(a,{name:"panel-left",className:"fold-toggle-icon"})}function m({className:n,folded:e,onToggle:s}){const o=l()(e?"masterList.unfold":"masterList.fold");return t.jsx("button",{type:"button",className:n,"data-tip":o,"aria-label":o,onClick:s,children:t.jsx(r,{})})}export{m as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as D,r as a,j as s,h as Y,i as W,k as ss,m as es}from"./index-
|
|
1
|
+
import{u as D,r as a,j as s,h as Y,i as W,k as ss,m as es}from"./index-BhIslAau.js";import{a5 as Z,a6 as ts,g as ns,Z as ls,a7 as as,a1 as os,a2 as is,a8 as cs}from"./SessionWindow-LcCzBMU7.js";import{F as _}from"./FoldToggle-BuQ0lokE.js";import{u as rs,M as ds}from"./Dashboard-P0B9ukSG.js";function js({onFocusNode:t,onOpenSession:k,specs:v=[],sessions:x=[],issuesData:w=null,reloadIssues:o,issueId:d=null}){const i=D(),c=w,[h,p]=a.useState(!1),[j,m]=a.useState(!1),[b,S]=a.useState(!1),[g,N]=a.useState(!1),[l,y]=a.useState("all"),[f,n]=a.useState(""),[u,L]=a.useState(null),T=a.useRef([]),G=a.useCallback(()=>o==null?void 0:o(!0),[o]),V=e=>{e&&(n(e),setTimeout(()=>n(""),6e3))},C=Array.isArray(c==null?void 0:c.issues)?c.issues:[],P=e=>e.status!=="open",B=[...new Set(C.map(e=>e.store).filter(Boolean))],J=Array.isArray(c==null?void 0:c.stores)&&c.stores.length?c.stores:[{id:"local",label:"local",kind:"local"}];a.useEffect(()=>{if(!d||!C.length)return;const e=C.find(r=>r.id===d);e&&(l!=="all"&&e.store!==l&&y("all"),P(e)&&S(!0),M(e)||N(!1),L(`issue:${e.id}`))},[d,C,l]);const K=l==="all"?C:C.filter(e=>e.store===l),M=e=>!!Z(x,e.by)||Array.isArray(e.replies)&&e.replies.some(r=>Z(x,r.by)),I=b?K:K.filter(e=>!P(e)),E=g?I.filter(M):I,F=I.filter(M).length,O=K.filter(P).length,H=a.useMemo(()=>new Map(E.map(e=>[`issue:${e.id}`,e])),[E]);T.current=E.map(e=>`issue:${e.id}`);const A=u&&H.has(u)?u:T.current[0]??null,U=a.useRef({});if(U.current={effSel:A},rs(h,()=>p(!1)),a.useEffect(()=>{const e=r=>{var X;const R=(X=r.target)==null?void 0:X.tagName;if(R==="INPUT"||R==="TEXTAREA"||r.metaKey||r.ctrlKey||r.altKey||r.key!=="j"&&r.key!=="k")return;r.preventDefault(),r.stopPropagation();const $=T.current;if(!$.length)return;const z=$.indexOf(U.current.effSel),Q=z<0?r.key==="j"?0:$.length-1:Math.max(0,Math.min($.length-1,z+(r.key==="j"?1:-1)));L($[Q])};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[]),a.useEffect(()=>{var e;(e=document.querySelector(".fv-list-col .sel"))==null||e.scrollIntoView({block:"nearest"})},[A]),c==null)return s.jsx("div",{className:"fv-note",children:i("session.issuesLoading")});if(!c.enabled)return s.jsx("div",{className:"fv-note",children:i("session.issuesOff")});const q=A?H.get(A):null;return s.jsxs("div",{className:`fv-master ${j?"folded":""}`,children:[j&&s.jsx(_,{className:"fv-unfold",folded:!0,onToggle:()=>m(!1)}),s.jsxs("div",{className:"fv-list-col",style:j?{display:"none"}:void 0,children:[f&&s.jsx("div",{className:"fv-notice",children:f}),s.jsxs("section",{className:"fv-group",children:[s.jsxs("header",{className:"fv-group-head",children:[s.jsxs("span",{className:"fv-head-row",children:[s.jsx(_,{className:"fv-fold-inline",onToggle:()=>m(!0)}),B.length>1&&s.jsx(ts,{value:l,onChange:y,options:[{value:"all",label:i("session.issuesStoreAll")},...B.map(e=>({value:e,label:e}))]}),s.jsx(ns,{icon:"plus",size:12,className:"fv-new-btn",label:i("session.issuesNew"),onClick:()=>p(!0)})]}),(g||F>0||O>0)&&s.jsxs("span",{className:"ef-chipbar",children:[(g||F>0)&&s.jsx("button",{type:"button",className:`ef-chip fv-live ${g?"on":""}`,onClick:()=>N(e=>!e),"data-tip":i("masterList.liveChipTitle"),children:i("masterList.liveChip",{n:F})}),O>0&&s.jsx("button",{type:"button",className:`ef-chip fv-concluded ${b?"on":""}`,onClick:()=>S(e=>!e),children:i("nodeView.closedIssues",{n:O})})]})]}),!E.length&&s.jsx("div",{className:"fv-note",children:i("session.issuesEmpty")}),E.map(e=>{var R;const r=`issue:${e.id}`;return s.jsxs("button",{className:`fv-row ${A===r?"sel":""}`,onClick:()=>L(r),children:[s.jsx("span",{className:`fv-dot st-${e.status||"open"}`,"data-tip":e.status}),s.jsx("span",{className:"fv-concern","data-tip":e.concern,children:e.concern}),(((R=e.replies)==null?void 0:R.length)??0)>0&&s.jsx("span",{className:"fv-replies","data-tip":i("session.issuesReplies",{n:e.replies.length}),children:e.replies.length}),B.length>1&&s.jsx("span",{className:`fv-store fv-store-${e.store==="local"?"local":"forge"}`,children:e.store})]},e.id)})]})]}),s.jsx("div",{className:"fv-detail",children:q?s.jsx(us,{issue:q,specs:v,sessions:x,onFocusNode:t,onOpenSession:k,onWrite:async e=>{V(e),await G()}}):s.jsx("div",{className:"fv-note",children:i("session.issuesEmpty")})}),h&&s.jsx(ds,{title:i("session.issuesNew"),closeLabel:i("common.close"),onClose:()=>p(!1),className:"fv-new-modal",children:s.jsx(ms,{specs:v,sessions:x,stores:J,onCancel:()=>p(!1),onDone:async e=>{p(!1),V(e),await G()}})})]})}function us({issue:t,specs:k,sessions:v,onFocusNode:x,onOpenSession:w,onWrite:o}){const d=D(),i=t.store==="local",c=t.status!=="open",[h,p]=a.useState(""),[j,m]=a.useState(""),b=Array.isArray(t.nodes)?t.nodes:[],S=Array.isArray(t.replies)?t.replies:[],g=(l,y)=>async()=>{if(!h){p(l);try{const f=await y();f!=null&&f.ok?(m(""),await(o==null?void 0:o(""))):m((f==null?void 0:f.error)||`${l} failed`)}finally{p("")}}},N=(l,y,f,n)=>s.jsx("button",{type:"button",className:`fv-close-issue fv-life-${l}`,disabled:!!h,"data-tip":n,onMouseDown:u=>u.preventDefault(),onClick:g(l,f),children:h===l?d("session.issuesActing"):y});return s.jsxs("div",{className:"fvd",children:[s.jsxs("div",{className:"fvd-scroll",children:[s.jsx("header",{className:"fvd-head",children:s.jsx("span",{className:"fvd-concern",children:t.concern})}),s.jsxs("div",{className:"fvd-meta",children:[t.status&&s.jsx("span",{className:`fv-status fv-st-${t.status}`,children:t.status}),s.jsx("span",{className:`fv-store fv-store-${i?"local":"forge"}`,children:t.store}),i?s.jsx(ls,{originator:t.by,sessions:v,kind:"issue",onOpenSession:w}):t.by&&s.jsx("span",{className:"fv-by",children:t.by}),b.map(l=>s.jsx("button",{type:"button",className:"fv-chip",onClick:()=>x==null?void 0:x(l),"data-tip":d("session.issuesFocusNode"),children:l},l)),t.url&&s.jsx("a",{className:"fv-link",href:t.url,target:"_blank",rel:"noreferrer",children:d("session.issuesOpenOnForge")})]}),t.body&&s.jsx("div",{className:"fvd-body",children:s.jsx(as,{body:t.body})}),s.jsx(os,{replies:S,threadId:i?t.id:null,onRemarkChange:()=>o==null?void 0:o("")})]}),s.jsx("div",{className:"fvd-compose",children:s.jsx(is,{onSend:(l,y)=>ss(t.id,l,y),specs:k,sessions:v,focusId:b[0]||null,onDone:o,actionsEnd:!c&&s.jsxs(s.Fragment,{children:[j&&s.jsx("span",{className:"fv-error",children:j}),i&&N("promote",d("session.issuesPromote"),()=>Y(t.id),d("session.issuesPromoteTitle")),N("close",d("session.issuesCloseIssue"),()=>W(t.id),d("session.issuesCloseIssueTitle"))]})},t.id)})]})}const fs=t=>t.id==="local"?"L":t.id==="github"?"GH":t.id==="gitlab"?"GL":(t.id||"?").slice(0,2).toUpperCase();function ms({specs:t,sessions:k,stores:v,onCancel:x,onDone:w}){var f;const o=D(),[d,i]=a.useState(((f=v[0])==null?void 0:f.id)||"local"),[c,h]=a.useState(""),[p,j]=a.useState(""),[m,b]=a.useState(!1),[S,g]=a.useState(""),N=a.useRef(null),l=cs({inputRef:N,value:p,setValue:j,specs:t,sessions:k,up:!0,fixedAbove:".fv-new-modal"});a.useEffect(()=>{var n;v.some(u=>u.id===d)||i(((n=v[0])==null?void 0:n.id)||"local")},[v,d]);const y=async()=>{const n=c.trim();if(!(!n||m)){b(!0),g("");try{const u=await es({concern:n,body:p.trim()||void 0,store:d});u!=null&&u.ok?(h(""),j(""),await(w==null?void 0:w(u.outcomes||""))):g((u==null?void 0:u.error)||o("session.issuesPostFailed"))}finally{b(!1)}}};return s.jsxs("div",{className:"fv-new-form",children:[s.jsxs("label",{className:"fv-store-pick",children:[s.jsx("span",{children:o("session.issuesStoreLabel")}),s.jsx("select",{value:d,disabled:m,onChange:n=>i(n.target.value),children:v.map(n=>s.jsxs("option",{value:n.id,children:[fs(n)," · ",n.label||n.id]},n.id))})]}),s.jsx("input",{className:"fv-input",value:c,placeholder:o("session.issuesConcernPlaceholder"),disabled:m,onChange:n=>h(n.target.value)}),s.jsxs("div",{className:"fv-tawrap",children:[s.jsx("textarea",{ref:N,className:"fv-textarea",rows:3,value:p,placeholder:o("session.issuesBodyPlaceholder"),disabled:m,onChange:n=>{j(n.target.value),l.sync(n.target)},onSelect:n=>l.sync(n.target),onBlur:l.close,onKeyDown:n=>{l.onKeyDown(n)||n.key==="Enter"&&(n.metaKey||n.ctrlKey)&&(n.preventDefault(),y())}}),l.menuEl]}),s.jsxs("div",{className:"fv-actions",children:[s.jsx("span",{className:S?"fv-error":"fv-hint",children:S||o("session.issuesMentionHint")}),s.jsx("button",{type:"button",className:"fv-cancel",disabled:m,onClick:x,children:o("common.cancel")}),s.jsx("button",{type:"button",className:"fv-send",disabled:m||!c.trim(),onClick:y,children:o(m?"session.issuesSending":"session.issuesPost")})]})]})}export{js as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as k,r as b,j as s}from"./index-
|
|
1
|
+
import{u as k,r as b,j as s}from"./index-BhIslAau.js";import{q as M,t as A,A as y,j as g,v as H,H as V,w as R,E as _,c as $,G as B,x as G,S}from"./SessionWindow-LcCzBMU7.js";const L={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"},C=(e,l)=>l.filter(u=>{var h;return(h=u.ops)==null?void 0:h.some(n=>n.nodeId===e.id)});function T({status:e}){const l=S[e]||S.pending;return s.jsx("span",{className:"m-dot",style:{background:l.color}})}function U({node:e,kids:l,editors:u,onTap:h}){return s.jsxs("button",{className:"m-row",onClick:h,children:[s.jsx(T,{status:e.status}),s.jsx("span",{className:"m-row-title",children:e.title}),u.length>0&&s.jsx("span",{className:"m-row-faces",children:u.slice(0,3).map(n=>s.jsx(y,{seed:n.id,status:n.status,title:g(n)},n.id))}),e.version?s.jsxs("span",{className:"m-row-ver",children:["v",e.version]}):null,l>0&&s.jsxs("span",{className:"m-row-kids",children:["▸",l]}),s.jsx("span",{className:"m-row-chev",children:"›"})]})}function q({node:e,childrenOf:l,sessions:u,onOpenChild:h}){const n=k(),m=l(e.id),d=M(e),i=[...m.length?[{key:"children",label:n("mobile.childrenTab",{n:m.length})}]:[],...d.map(a=>({key:a.key,label:n(L[a.key])}))],[r,x]=b.useState(null);b.useEffect(()=>{x(null)},[e.id]);const c=r&&i.some(a=>a.key===r)?r:i[0].key,j=A(e.id,c==="history"),N=C(e,u);return s.jsxs("div",{className:"m-node",children:[s.jsxs("div",{className:"m-node-head",children:[s.jsx(T,{status:e.status}),s.jsx("span",{className:"m-node-title",children:e.title}),e.version?s.jsxs("span",{className:"m-node-ver",children:["v",e.version]}):null,s.jsx("span",{className:"m-node-status",children:n(`status.${e.status}`)}),N.length>0&&s.jsx("span",{className:"m-node-faces",title:n("mobile.liveEditors",{n:N.length}),children:N.map(a=>s.jsx(y,{seed:a.id,status:a.status,title:g(a)},a.id))})]}),e.desc&&s.jsx("div",{className:"m-node-desc",children:e.desc}),s.jsx("div",{className:"m-tabs",children:i.map(a=>s.jsx("button",{className:a.key===c?"m-tab on":"m-tab",onClick:()=>x(a.key),children:a.label},a.key))}),s.jsxs("div",{className:c==="history"?"m-pane-host fixed":"m-pane-host",children:[c==="children"&&s.jsx("div",{className:"m-children",children:m.map(a=>s.jsx(U,{node:a,kids:l(a.id).length,editors:C(a,u),onTap:()=>h(a.id)},a.id))}),c==="spec"&&s.jsx(H,{node:e}),c==="history"&&s.jsx(V,{node:e,rows:j}),c==="issues"&&s.jsx(R,{node:e}),c==="edit"&&s.jsx(_,{node:e})]})]})}function D({sessions:e,openId:l,setOpenId:u,byId:h,goToNode:n}){const m=k(),d=l?e.find(i=>i.id===l):null;if(d){const i=d.ops||[];return s.jsxs("div",{className:"m-sessdetail",children:[s.jsxs("div",{className:"m-sess-card",children:[s.jsx(y,{seed:d.id,status:d.status}),s.jsxs("div",{className:"m-sess-meta",children:[s.jsx("span",{className:"m-sess-name",children:g(d)}),s.jsx("span",{className:"m-sess-status",style:{color:$[d.status]},children:m(`status.${d.status}`)})]})]}),d.activity&&s.jsx("div",{className:"m-sess-activity",children:d.activity}),s.jsx("div",{className:"m-sess-section",children:m("mobile.changing",{n:i.length})}),i.length===0?s.jsx("div",{className:"m-empty",children:m("mobile.noChanges")}):i.map((r,x)=>{const c=h[r.nodeId];return s.jsxs("button",{className:"m-row",disabled:!c,onClick:()=>c&&n(r.nodeId),children:[s.jsx("span",{className:`ov-mark ov-${r.op}`,children:B[r.op]||"•"}),s.jsx("span",{className:"m-row-title",children:c?c.title:r.nodeId}),c&&s.jsx("span",{className:"m-row-chev",children:"›"})]},x)})]})}return e.length?s.jsx("div",{className:"m-sesslist",children:e.map(i=>s.jsx("button",{className:"m-sess-row",onClick:()=>u(i.id),children:s.jsx(G,{s:i,locked:!1})},i.id))}):s.jsx("div",{className:"m-empty big",children:m("mobile.noSessions")})}function z({specs:e,sessions:l,project:u}){const h=k(),n=b.useMemo(()=>Object.fromEntries(e.map(t=>[t.id,t])),[e]),m=b.useMemo(()=>e.find(t=>!t.parent)||e[0],[e]),d=b.useMemo(()=>{const t={};return e.forEach(o=>{var p;o.parent&&(t[p=o.parent]??(t[p]=[])).push(o)}),o=>t[o]||[]},[e]),i=b.useMemo(()=>t=>{const o=[];for(let p=n[t];p;p=p.parent?n[p.parent]:null)o.unshift(p.id);return o},[n]),[r,x]=b.useState("specs"),[c,j]=b.useState(()=>m?[m.id]:[]),[N,a]=b.useState(null),v=c.filter(t=>n[t]),w=v[v.length-1]||(m==null?void 0:m.id),f=w?n[w]:null,E=t=>j(o=>[...o.filter(p=>n[p]),t]),I=t=>{j(i(t)),a(null),x("specs")},P=r==="specs"?v.length>1:!!N,O=()=>{r==="specs"?j(t=>t.slice(0,-1)):a(null)};return s.jsxs("div",{className:"m-app",children:[s.jsxs("header",{className:"m-topbar",children:[P?s.jsx("button",{className:"m-back",onClick:O,"aria-label":h("mobile.back"),children:"‹"}):s.jsx("span",{className:"m-back ghost","aria-hidden":"true"}),s.jsx("span",{className:"m-brand",children:u||"SpexCode"})]}),s.jsx("main",{className:"m-main",children:r==="specs"?s.jsxs("div",{className:"m-specs",children:[s.jsx("nav",{className:"m-crumbs",children:v.map((t,o)=>s.jsxs("span",{className:"m-crumb",children:[o>0&&s.jsx("span",{className:"m-crumb-sep",children:"›"}),s.jsx("button",{className:o===v.length-1?"m-crumb-btn cur":"m-crumb-btn",onClick:()=>j(v.slice(0,o+1)),children:n[t].title})]},t))}),f&&s.jsx(q,{node:f,childrenOf:d,sessions:l,onOpenChild:E},f.id)]}):s.jsx(D,{sessions:l,openId:N,setOpenId:a,byId:n,goToNode:I})}),s.jsxs("nav",{className:"m-tabbar",children:[s.jsxs("button",{className:r==="specs"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>x("specs"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"❯_"}),h("mobile.specsTab")]}),s.jsxs("button",{className:r==="sessions"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>x("sessions"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"◐"}),h("mobile.sessionsTab"),l.length>0&&s.jsx("span",{className:"m-tabbar-badge",children:l.length})]})]})]})}export{z as default};
|
package/spec-dashboard/dist/assets/{SessionInterface-D1pUBl6q.js → SessionInterface-Blr_MEdU.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as K,j as F,u as Ke,b as Qe,c as qt,d as Kt}from"./index-
|
|
1
|
+
import{r as K,j as F,u as Ke,b as Qe,c as qt,d as Kt}from"./index-BhIslAau.js";import{y as Gt,O as Vt,s as _t,d as Xt,z as Yt,n as He,m as Jt,B as Zt,C as Qt,D as es,F as ft,R as ts,x as ss,l as is,J as rs,M as ns,K as vt,P as os,Q as as,U as hs}from"./SessionWindow-LcCzBMU7.js";import{u as qe,M as et,a as ls}from"./Dashboard-P0B9ukSG.js";import{E as cs,a as ds}from"./EvalsPage-BrvAGyc4.js";import{F as us}from"./FoldToggle-BuQ0lokE.js";var bt={exports:{}};(function(U,ie){(function(ee,G){U.exports=G()})(globalThis,()=>(()=>{var ee={4567:function(O,t,a){var l=this&&this.__decorate||function(s,r,h,v){var u,m=arguments.length,c=m<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(s,r,h,v);else for(var p=s.length-1;p>=0;p--)(u=s[p])&&(c=(m<3?u(c):m>3?u(r,h,c):u(r,h))||c);return m>3&&c&&Object.defineProperty(r,h,c),c},d=this&&this.__param||function(s,r){return function(h,v){r(h,v,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=a(9042),_=a(9924),g=a(844),f=a(4725),o=a(2585),e=a(3656);let i=t.AccessibilityManager=class extends g.Disposable{constructor(s,r,h,v){super(),this._terminal=s,this._coreBrowserService=h,this._renderService=v,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let u=0;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);if(this._topBoundaryFocusListener=u=>this._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(u=>this._handleResize(u.rows))),this.register(this._terminal.onRender(u=>this._refreshRows(u.start,u.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(u=>this._handleChar(u))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
2
2
|
`))),this.register(this._terminal.onA11yTab(u=>this._handleTab(u))),this.register(this._terminal.onKey(u=>this._handleKey(u.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,e.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,g.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(s){for(let r=0;r<s;r++)this._handleChar(" ")}_handleChar(s){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==s&&(this._charsToAnnounce+=s):this._charsToAnnounce+=s,s===`
|
|
3
3
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(s){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(s)||this._charsToConsume.push(s)}_refreshRows(s,r){this._liveRegionDebouncer.refresh(s,r,this._terminal.rows)}_renderRows(s,r){const h=this._terminal.buffer,v=h.lines.length.toString();for(let u=s;u<=r;u++){const m=h.lines.get(h.ydisp+u),c=[],p=(m==null?void 0:m.translateToString(!0,void 0,void 0,c))||"",S=(h.ydisp+u+1).toString(),y=this._rowElements[u];y&&(p.length===0?(y.innerText=" ",this._rowColumns.set(y,[0,1])):(y.textContent=p,this._rowColumns.set(y,c)),y.setAttribute("aria-posinset",S),y.setAttribute("aria-setsize",v))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(s,r){const h=s.target,v=this._rowElements[r===0?1:this._rowElements.length-2];if(h.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||s.relatedTarget!==v)return;let u,m;if(r===0?(u=h,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(u=this._rowElements.shift(),m=h,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){const c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{const c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(r===0?-1:1),this._rowElements[r===0?1:this._rowElements.length-2].focus(),s.preventDefault(),s.stopImmediatePropagation()}_handleSelectionChange(){var p;if(this._rowElements.length===0)return;const s=document.getSelection();if(!s)return;if(s.isCollapsed)return void(this._rowContainer.contains(s.anchorNode)&&this._terminal.clearSelection());if(!s.anchorNode||!s.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:s.anchorNode,offset:s.anchorOffset},h={node:s.focusNode,offset:s.focusOffset};if((r.node.compareDocumentPosition(h.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===h.node&&r.offset>h.offset)&&([r,h]=[h,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.node))return;const v=this._rowElements.slice(-1)[0];if(h.node.compareDocumentPosition(v)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(h={node:v,offset:((p=v.textContent)==null?void 0:p.length)??0}),!this._rowContainer.contains(h.node))return;const u=({node:S,offset:y})=>{const b=S instanceof Text?S.parentNode:S;let w=parseInt(b==null?void 0:b.getAttribute("aria-posinset"),10)-1;if(isNaN(w))return console.warn("row is invalid. Race condition?"),null;const L=this._rowColumns.get(b);if(!L)return console.warn("columns is null. Race condition?"),null;let B=y<L.length?L[y]:L.slice(-1)[0]+1;return B>=this._terminal.cols&&(++w,B=0),{row:w,column:B}},m=u(r),c=u(h);if(m&&c){if(m.row>c.row||m.row===c.row&&m.column>=c.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(c.row-m.row)*this._terminal.cols-m.column+c.column)}}_handleResize(s){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);for(;this._rowElements.length>s;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const s=this._coreBrowserService.mainDocument.createElement("div");return s.setAttribute("role","listitem"),s.tabIndex=-1,this._refreshRowDimensions(s),s}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let s=0;s<this._terminal.rows;s++)this._refreshRowDimensions(this._rowElements[s])}}_refreshRowDimensions(s){s.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=i=l([d(1,o.IInstantiationService),d(2,f.ICoreBrowserService),d(3,f.IRenderService)],i)},3614:(O,t)=>{function a(_){return _.replace(/\r?\n/g,"\r")}function l(_,g){return g?"\x1B[200~"+_+"\x1B[201~":_}function d(_,g,f,o){_=l(_=a(_),f.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),f.triggerDataEvent(_,!0),g.value=""}function n(_,g,f){const o=f.getBoundingClientRect(),e=_.clientX-o.left-10,i=_.clientY-o.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${e}px`,g.style.top=`${i}px`,g.style.zIndex="1000",g.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=a,t.bracketTextForPaste=l,t.copyHandler=function(_,g){_.clipboardData&&_.clipboardData.setData("text/plain",g.selectionText),_.preventDefault()},t.handlePasteEvent=function(_,g,f,o){_.stopPropagation(),_.clipboardData&&d(_.clipboardData.getData("text/plain"),g,f,o)},t.paste=d,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(_,g,f,o,e){n(_,g,f),e&&o.rightClickSelect(_),g.value=o.selectionText,g.select()}},7239:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const l=a(1505);t.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(d,n,_){this._css.set(d,n,_)}getCss(d,n){return this._css.get(d,n)}setColor(d,n,_){this._color.set(d,n,_)}getColor(d,n){return this._color.get(d,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,l,d,n){a.addEventListener(l,d,n);let _=!1;return{dispose:()=>{_||(_=!0,a.removeEventListener(l,d,n))}}}},3551:function(O,t,a){var l=this&&this.__decorate||function(i,s,r,h){var v,u=arguments.length,m=u<3?s:h===null?h=Object.getOwnPropertyDescriptor(s,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,s,r,h);else for(var c=i.length-1;c>=0;c--)(v=i[c])&&(m=(u<3?v(m):u>3?v(s,r,m):v(s,r))||m);return u>3&&m&&Object.defineProperty(s,r,m),m},d=this&&this.__param||function(i,s){return function(r,h){s(r,h,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=a(3656),_=a(8460),g=a(844),f=a(2585),o=a(4725);let e=t.Linkifier=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(i,s,r,h,v){super(),this._element=i,this._mouseService=s,this._renderService=r,this._bufferService=h,this._linkProviderService=v,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)(()=>{var u;this._lastMouseEvent=void 0,(u=this._activeProviderReplies)==null||u.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(i){this._lastMouseEvent=i;const s=this._positionFromMouseEvent(i,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const r=i.composedPath();for(let h=0;h<r.length;h++){const v=r[h];if(v.classList.contains("xterm"))break;if(v.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._handleHover(s),this._lastBufferCell=s)}_handleHover(i){if(this._activeLine!==i.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(i,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,i)||(this._clearCurrentLink(),this._askForLink(i,!0))}_askForLink(i,s){var h,v;this._activeProviderReplies&&s||((h=this._activeProviderReplies)==null||h.forEach(u=>{u==null||u.forEach(m=>{m.link.dispose&&m.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=i.y);let r=!1;for(const[u,m]of this._linkProviderService.linkProviders.entries())s?(v=this._activeProviderReplies)!=null&&v.get(u)&&(r=this._checkLinkProviderResult(u,i,r)):m.provideLinks(i.y,c=>{var S,y;if(this._isMouseOut)return;const p=c==null?void 0:c.map(b=>({link:b}));(S=this._activeProviderReplies)==null||S.set(u,p),r=this._checkLinkProviderResult(u,i,r),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)})}_removeIntersectingLinks(i,s){const r=new Set;for(let h=0;h<s.size;h++){const v=s.get(h);if(v)for(let u=0;u<v.length;u++){const m=v[u],c=m.link.range.start.y<i?0:m.link.range.start.x,p=m.link.range.end.y>i?this._bufferService.cols:m.link.range.end.x;for(let S=c;S<=p;S++){if(r.has(S)){v.splice(u--,1);break}r.add(S)}}}}_checkLinkProviderResult(i,s,r){var u;if(!this._activeProviderReplies)return r;const h=this._activeProviderReplies.get(i);let v=!1;for(let m=0;m<i;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(v=!0);if(!v&&h){const m=h.find(c=>this._linkAtPosition(c.link,s));m&&(r=!0,this._handleNewLink(m))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let m=0;m<this._activeProviderReplies.size;m++){const c=(u=this._activeProviderReplies.get(m))==null?void 0:u.find(p=>this._linkAtPosition(p.link,s));if(c){r=!0,this._handleNewLink(c);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(i){if(!this._currentLink)return;const s=this._positionFromMouseEvent(i,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(i,this._currentLink.link.text)}_clearCurrentLink(i,s){this._currentLink&&this._lastMouseEvent&&(!i||!s||this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(i){if(!this._lastMouseEvent)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(i.link,s)&&(this._currentLink=i,this._currentLink.state={decorations:{underline:i.link.decorations===void 0||i.link.decorations.underline,pointerCursor:i.link.decorations===void 0||i.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,i.link,this._lastMouseEvent),i.link.decorations={},Object.defineProperties(i.link.decorations,{pointerCursor:{get:()=>{var r,h;return(h=(r=this._currentLink)==null?void 0:r.state)==null?void 0:h.decorations.pointerCursor},set:r=>{var h;(h=this._currentLink)!=null&&h.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,h;return(h=(r=this._currentLink)==null?void 0:r.state)==null?void 0:h.decorations.underline},set:r=>{var h,v,u;(h=this._currentLink)!=null&&h.state&&((u=(v=this._currentLink)==null?void 0:v.state)==null?void 0:u.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(i.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;const h=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,v=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=v&&(this._clearCurrentLink(h,v),this._lastMouseEvent)){const u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._askForLink(u,!1)}})))}_linkHover(i,s,r){var h;(h=this._currentLink)!=null&&h.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&i.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(r,s.text)}_fireUnderlineEvent(i,s){const r=i.range,h=this._bufferService.buffer.ydisp,v=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-h-1,r.end.x,r.end.y-h-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(v)}_linkLeave(i,s,r){var h;(h=this._currentLink)!=null&&h.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&i.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(r,s.text)}_linkAtPosition(i,s){const r=i.range.start.y*this._bufferService.cols+i.range.start.x,h=i.range.end.y*this._bufferService.cols+i.range.end.x,v=s.y*this._bufferService.cols+s.x;return r<=v&&v<=h}_positionFromMouseEvent(i,s,r){const h=r.getCoords(i,s,this._bufferService.cols,this._bufferService.rows);if(h)return{x:h[0],y:h[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,s,r,h,v){return{x1:i,y1:s,x2:r,y2:h,cols:this._bufferService.cols,fg:v}}};t.Linkifier=e=l([d(1,o.IMouseService),d(2,o.IRenderService),d(3,f.IBufferService),d(4,o.ILinkProviderService)],e)},9042:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(O,t,a){var l=this&&this.__decorate||function(o,e,i,s){var r,h=arguments.length,v=h<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(o,e,i,s);else for(var u=o.length-1;u>=0;u--)(r=o[u])&&(v=(h<3?r(v):h>3?r(e,i,v):r(e,i))||v);return h>3&&v&&Object.defineProperty(e,i,v),v},d=this&&this.__param||function(o,e){return function(i,s){e(i,s,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=a(511),_=a(2585);let g=t.OscLinkProvider=class{constructor(o,e,i){this._bufferService=o,this._optionsService=e,this._oscLinkService=i}provideLinks(o,e){var p;const i=this._bufferService.buffer.lines.get(o-1);if(!i)return void e(void 0);const s=[],r=this._optionsService.rawOptions.linkHandler,h=new n.CellData,v=i.getTrimmedLength();let u=-1,m=-1,c=!1;for(let S=0;S<v;S++)if(m!==-1||i.hasContent(S)){if(i.loadCell(S,h),h.hasExtendedAttrs()&&h.extended.urlId){if(m===-1){m=S,u=h.extended.urlId;continue}c=h.extended.urlId!==u}else m!==-1&&(c=!0);if(c||m!==-1&&S===v-1){const y=(p=this._oscLinkService.getLinkData(u))==null?void 0:p.uri;if(y){const b={start:{x:m+1,y:o},end:{x:S+(c||S!==v-1?0:1),y:o}};let w=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{const L=new URL(y);["http:","https:"].includes(L.protocol)||(w=!0)}catch{w=!0}w||s.push({text:y,range:b,activate:(L,B)=>r?r.activate(L,B,b):f(0,B),hover:(L,B)=>{var I;return(I=r==null?void 0:r.hover)==null?void 0:I.call(r,L,B,b)},leave:(L,B)=>{var I;return(I=r==null?void 0:r.leave)==null?void 0:I.call(r,L,B,b)}})}c=!1,h.hasExtendedAttrs()&&h.extended.urlId?(m=S,u=h.extended.urlId):(m=-1,u=-1)}}e(s)}};function f(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as s,u as b,r as f,p as Ee,s as O}from"./index-BO0Zuweu.js";function ue(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 he(e){return ue(e)%360}function Me(e){const n=he(e);return{bg:`hsl(${n} 55% 42%)`,fg:`hsl(${n} 70% 92%)`}}function Ce(e){return`hsl(${he(e)} 65% 50%)`}const Q=["◆","▲","●","■","★","✦","⬟","⬢","❖","◈","✸","⟡","✚","❂","◐","◑","⬣","▰","✶","⬤","✹","◇","⊛","✺"],X=["circle","rounded","square","hex"];function Ve(e){const n=ue(e);return{seed:e,glyph:Q[(n>>>9)%Q.length],shape:X[(n>>>17)%X.length],...Me(e)}}function Le({seed:e,status:n,title:a,size:t=16}){const l=Ve(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 Fe(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 Ae={pass:"✓",fail:"✗",stalePass:"✓",staleFail:"✗",empty:""};function pe(e){const n=Fe(e);return n?e.fresh?n==="cross"?"fail":"pass":n==="cross"?"staleFail":"stalePass":"empty"}function Z(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?pe(l):"missing"}})}function De(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 Ie({scenarios:e,evals:n}){const a=b(),t=Z(e,n);if(!t.length)return null;const l=De(t),i=t.filter(r=>r.state==="pass").length,c=t.length,o=a("score.count",{satisfied:i,total:c,outstanding:c-i});return s.jsxs("span",{className:`scenario-count ${l}`,"data-tip":o,"aria-label":o,children:["✓",i,"/",c]})}function Pe({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 Y({state:e,title:n}){const a=b();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:Ae[e]})}const Os={merged:{color:"#859900"},active:{color:"#cb4b16"},drift:{color:"#b58900"},pending:{color:"#93a1a1"}},He={added:"+",edited:"~",deleted:"✕",moved:"→"},M={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)"},Te={working:"●",parked:"‖",asking:"?",review:"◑",done:"✓",error:"✕",idle:"·",starting:"◌",queued:"⋯","close-pending":"⊘",offline:"○",unknown:"⁇"},fe=new Set(["asking","review","done","close-pending","error"]),B=e=>(e==null?void 0:e.liveness)==="offline"||(e==null?void 0:e.status)==="offline"?"offline":fe.has(e==null?void 0:e.status)?"need":"run",me=(e,n)=>{const a=n?(e||[]).find(t=>t.id===n):null;return a&&B(a)!=="offline"?a:null},ee=e=>(e==null?void 0:e.sortKey)!=null?e.sortKey:(e==null?void 0:e.created)??0,se=e=>{const n={need:0,run:1,offline:2};return[...e].sort((a,t)=>n[B(a)]-n[B(t)]||ee(t)-ee(a))},Be=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),xe=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 Re(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 c=a.get(i)||[];c.push(l),a.set(i,c)}else t.push(l)}return{roots:t,childrenOf:a}}function Oe(e,n){let a=!1,t=!1,l=0;const i=(c,o)=>{for(const r of n.get(c)||[])o.has(r.id)||(o.add(r.id),l++,fe.has(r.status)?a=!0:M[r.status]===M.working&&(t=!0),i(r.id,o))};return i(e,new Set([e])),{color:a?M.asking:t?M.working:M.idle,count:l}}function ze(e,n){const{roots:a,childrenOf:t}=Re(e),l=[],i=(r,u,p,N)=>{const x=t.get(r.id)||[],k=x.length>0,y=k&&!!n(r.id),m=k?Oe(r.id,t):null;if(l.push({type:"row",s:r,depth:u,expandable:k,expanded:y,rollup:(m==null?void 0:m.color)??null,kin:(m==null?void 0:m.count)??0,guides:N}),y){const v=se(x).filter(d=>!p.has(d.id));v.forEach((d,h)=>{p.add(d.id),i(d,u+1,p,[...N,h<v.length-1])})}},c=new Set;let o=null;for(const r of se(a)){if(c.has(r.id))continue;c.add(r.id);const u=B(r);u!==o&&(l.push({type:"zone",zone:u}),o=u),i(r,0,c,[])}return l}function Ke({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 We={video:"vid",image:"img",transcript:"txt",data:"data"},ve=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"}]:[]},T=e=>{const n=ve(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 Z(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 A=e=>`eval:${e.node}·${e.scenario}`;function _e({e,selected:n,onClick:a}){return s.jsxs("button",{className:`ef-row ${n?"sel":""}`,onClick:a,children:[s.jsx(Y,{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:T(e).map(t=>We[t]).filter(Boolean).join("·")}),s.jsx("span",{className:"ef-time",children:Ue(e.ts)})]})}const Ue=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 zs({nodes:e=[],sessions:n=[],sel:a,onSel:t,onRows:l,mustShow:i=null,lead:c=null}){const o=b(),[r,u]=f.useState(null),[p,N]=f.useState(!1),x=f.useMemo(()=>qe(e),[e]),k=x.some(w=>T(w).includes("video")),y=x.some(w=>T(w).includes("image")),m=r??(k?"video":y?"image":"all"),v=f.useMemo(()=>x.filter(w=>m==="all"||T(w).includes(m)),[x,m]),d=w=>!!me(n,w.by),h=f.useMemo(()=>v.filter(d).length,[v,n]),g=f.useMemo(()=>p?v.filter(d):v,[v,p,n]);return f.useEffect(()=>{l==null||l(g)},[g,l]),f.useEffect(()=>{i&&(g.some(w=>A(w)===i)||x.some(w=>A(w)===i)&&(u("all"),N(!1)))},[i,g,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(Ke,{value:m,onChange:u,options:["video","image","all"].map(w=>({value:w,label:o(`evalsFeed.kind.${w}`)}))})]}),(p||h>0)&&s.jsx("span",{className:"ef-chipbar",children:s.jsx("button",{type:"button",className:`ef-chip fv-live ${p?"on":""}`,onClick:()=>N(w=>!w),"data-tip":o("masterList.liveChipTitle"),children:o("masterList.liveChip",{n:h})})})]}),g.length===0&&s.jsx("div",{className:"ef-empty",children:o("evalsFeed.empty")}),g.map(w=>s.jsx(_e,{e:w,selected:a===A(w),onClick:()=>t(A(w),w)},A(w)))]})}const Ge={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 z({name:e,size:n=16,strokeWidth:a,className:t,style:l}){const i=Ge[e];if(!i)throw new Error(`unknown icon: ${e}`);const c=i.vb||24;return s.jsx("svg",{width:n,height:n,viewBox:`0 0 ${c} ${c}`,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 Ks({icon:e,label:n,onClick:a,className:t,size:l,iconClassName:i,...c}){return s.jsx("button",{type:"button",className:t,"data-tip":n,"aria-label":n,onClick:a,...c,children:s.jsx(z,{name:e,size:l,className:i})})}const Ws=()=>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"})}),qs=()=>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"})}),F=e=>`/api/yatsu/blob/${e}`;function Ze({src:e,alt:n,onClose:a}){return f.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 Ye({hash:e}){const n=b(),[a,t]=f.useState(null);return f.useEffect(()=>{let l=!0;return fetch(F(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 Je({hash:e}){const n=b(),[a,t]=f.useState(null);return f.useEffect(()=>{let l=!0;return fetch(F(e)).then(i=>i.ok?i.text():Promise.reject(new Error("miss"))).then(i=>{let c=i,o=!0;try{c=JSON.stringify(JSON.parse(i),null,2)}catch{o=!1}l&&t({text:c,valid:o})}).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 Qe({hash:e,alt:n}){const[a,t]=f.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx("img",{className:"an-image",src:F(e),alt:n,loading:"lazy",onClick:()=>t(!0)}),a&&s.jsx(Ze,{src:F(e),alt:n,onClose:()=>t(!1)})]})}function Xe({exit:e}){return s.jsx(z,{name:e?"minimize":"maximize",size:15})}function _s({target:e,className:n=""}){const a=b(),[t,l]=f.useState(!1);f.useEffect(()=>{const c=()=>{const o=document.fullscreenElement,r=e==null?void 0:e.current;l(!!o&&!!r&&(o===r||r.contains(o)))};return document.addEventListener("fullscreenchange",c),()=>document.removeEventListener("fullscreenchange",c)},[e]);const i=()=>{var o,r;const c=e==null?void 0:e.current;c&&(document.fullscreenElement?(o=document.exitFullscreen||document.webkitExitFullscreen)==null||o.call(document):(r=c.requestFullscreen||c.webkitRequestFullscreen)==null||r.call(c))};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(Xe,{exit:t})})}function ge({e,alt:n=""}){const a=b();return e.state==="miss"?s.jsx("div",{className:"eval-noimg",children:a("nodeView.eval.miss")}):e.kind==="transcript"?s.jsx(Ye,{hash:e.hash}):e.kind==="data"?s.jsx(Je,{hash:e.hash}):e.kind==="video"?s.jsx("video",{className:"eval-video",src:F(e.hash),controls:!0,preload:"metadata",playsInline:!0}):s.jsx(Qe,{hash:e.hash,alt:n})}const P=new Map;function es(e){const[n,a]=f.useState(()=>P.get(e)??null);return f.useEffect(()=>{if(P.has(e)){a(P.get(e));return}let t=!0;return fetch(F(e),{headers:{Range:"bytes=0-0"}}).then(l=>{const i=l.headers.get("content-type")||"",c=l.ok?{kind:i.startsWith("video/")?"video":i.startsWith("image/")?"image":i.startsWith("application/json")?"data":"transcript",state:"present"}:{kind:"image",state:"miss"};P.set(e,c),t&&a(c)}).catch(()=>{t&&a({kind:"image",state:"miss"})}),()=>{t=!1}},[e]),n}function je({hash:e,alt:n=""}){const a=es(e);return a?s.jsx(ge,{e:{hash:e,...a},alt:n}):null}const Us=/\[\[(\.?[\p{L}\p{N}_-]+)\]\]/gu,we=e=>(e||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,"");function ss(e,n,a){const t=n.toLowerCase(),l=[];for(const i of e){const c=i.id.toLowerCase(),o=we(i.path).toLowerCase();let r;if(!t)r=3;else if(c.startsWith(t))r=0;else if(c.includes(t))r=1;else if(o.includes(t))r=2;else continue;i.id===a&&(r=-1),l.push({s:i,score:r})}return l.sort((i,c)=>i.score-c.score||i.s.id.length-c.s.id.length||i.s.id.localeCompare(c.s.id)),l.slice(0,8).map(i=>i.s)}function ns(e,n){const a=n.toLowerCase(),t=o=>xe(o)||(o.id||"").slice(0,8),l=[];for(const o of e||[]){if(o.liveness!=="online")continue;const r=(o.id||"").toLowerCase(),u=t(o).toLowerCase();let p;if(!a)p=3;else if(r===a||u===a)p=0;else if(r.startsWith(a)||u.startsWith(a))p=1;else if(r.includes(a)||u.includes(a))p=2;else continue;l.push({s:o,score:p})}l.sort((o,r)=>o.score-r.score||(r.s.created||0)-(o.s.created||0));const i=l.map(o=>({id:o.s.id,label:t(o.s),sub:o.s.node||o.s.status})),c=l.filter(o=>o.score===0).length;return i.splice(c,0,{id:"new",label:"new",sub:"spawn a fresh worker"}),i.slice(0,8)}function ne(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 ts(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),c=ss(a,i,t);return c.length?{kind:"mention",items:c,index:0,start:l-1,end:n,query:i}:null}return null}function as(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=ns(a,l);return i.length?{kind:"actor",items:i,index:0,start:t,end:n,query:l}:null}return null}function ls({menu:e,up:n,fixedStyle:a,onPick:t,onHover:l}){const i=b(),c=e.kind==="actor",o=e.query?c?`@${e.query}`:`[[${e.query}]]`:i(c?"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:["// ",o," — ",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"}${c&&r.id==="new"?" new":""}`,onMouseDown:p=>{p.preventDefault(),t(r)},onMouseEnter:()=>l(u),children:[!c&&s.jsx("span",{className:"mention-dot",style:{background:M[r.status]||M.offline}}),s.jsx("span",{className:"mention-id",children:c?s.jsxs(s.Fragment,{children:["@",ne(r.label,e.query)]}):ne(r.id,e.query)}),s.jsx("span",{className:"mention-path",children:c?r.sub:we(r.path)})]},r.id))]})}function is({inputRef:e,value:n,setValue:a,specs:t=[],sessions:l=[],focusId:i=null,up:c=!1,fixedAbove:o=null}){const[r,u]=f.useState(null),[p,N]=f.useState(null),x=h=>{var $;if(!h){u(null),N(null);return}const g=h.selectionStart,w=ts(h.value,g,t,i)||as(h.value,g,l);if(u(w),!w||!o){N(null);return}const S=h.getBoundingClientRect(),E=($=h.closest(o))==null?void 0:$.getBoundingClientRect(),j=(E==null?void 0:E.top)??S.top;N({left:`${S.left}px`,width:`${S.width}px`,right:"auto",bottom:`${Math.max(8,window.innerHeight-j+8)}px`})},k=h=>u(g=>g&&{...g,index:(g.index+h+g.items.length)%g.items.length}),y=h=>{if(!h||!r)return;const g=r.kind==="actor"?`@${h.id} `:`[[${h.id}]] `,w=n.slice(0,r.start);a(w+g+n.slice(r.end)),u(null),N(null);const S=w.length+g.length;requestAnimationFrame(()=>{const E=e.current;E&&(E.focus(),E.setSelectionRange(S,S))})};return{menu:r,sync:x,onKeyDown:h=>r?h.key==="ArrowDown"?(h.preventDefault(),h.stopPropagation(),k(1),!0):h.key==="ArrowUp"?(h.preventDefault(),h.stopPropagation(),k(-1),!0):h.key==="Enter"||h.key==="Tab"?(h.preventDefault(),h.stopPropagation(),y(r.items[r.index]),!0):h.key==="Escape"?(h.preventDefault(),h.stopPropagation(),u(null),N(null),!0):!1:!1,close:()=>{u(null),N(null)},menuEl:r?s.jsx(ls,{menu:r,up:c,fixedStyle:p,onPick:y,onHover:h=>u(g=>g&&{...g,index:h})}):null}}function rs(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 cs=/^▶\s*(\d+):([0-5]?\d)(?:\s*·\s*([^\n]*))?/,os=/^!\[frame\]\(\/api\/yatsu\/blob\/[0-9a-f]{64}\)\n?/,ds=/\/api\/yatsu\/blob\/([0-9a-f]{64})/g,te=/!\[[^\]]*\]\(\/api\/yatsu\/blob\/([0-9a-f]{64})\)/g,us=e=>{const n=Math.floor(e/1e3);return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`};function ye(e){var i;const n=e||"",a=n.split(`
|
|
1
|
+
import{j as s,u as b,r as f,p as Ee,s as O}from"./index-BhIslAau.js";function ue(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 he(e){return ue(e)%360}function Me(e){const n=he(e);return{bg:`hsl(${n} 55% 42%)`,fg:`hsl(${n} 70% 92%)`}}function Ce(e){return`hsl(${he(e)} 65% 50%)`}const Q=["◆","▲","●","■","★","✦","⬟","⬢","❖","◈","✸","⟡","✚","❂","◐","◑","⬣","▰","✶","⬤","✹","◇","⊛","✺"],X=["circle","rounded","square","hex"];function Ve(e){const n=ue(e);return{seed:e,glyph:Q[(n>>>9)%Q.length],shape:X[(n>>>17)%X.length],...Me(e)}}function Le({seed:e,status:n,title:a,size:t=16}){const l=Ve(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 Fe(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 Ae={pass:"✓",fail:"✗",stalePass:"✓",staleFail:"✗",empty:""};function pe(e){const n=Fe(e);return n?e.fresh?n==="cross"?"fail":"pass":n==="cross"?"staleFail":"stalePass":"empty"}function Z(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?pe(l):"missing"}})}function De(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 Ie({scenarios:e,evals:n}){const a=b(),t=Z(e,n);if(!t.length)return null;const l=De(t),i=t.filter(r=>r.state==="pass").length,c=t.length,o=a("score.count",{satisfied:i,total:c,outstanding:c-i});return s.jsxs("span",{className:`scenario-count ${l}`,"data-tip":o,"aria-label":o,children:["✓",i,"/",c]})}function Pe({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 Y({state:e,title:n}){const a=b();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:Ae[e]})}const Os={merged:{color:"#859900"},active:{color:"#cb4b16"},drift:{color:"#b58900"},pending:{color:"#93a1a1"}},He={added:"+",edited:"~",deleted:"✕",moved:"→"},M={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)"},Te={working:"●",parked:"‖",asking:"?",review:"◑",done:"✓",error:"✕",idle:"·",starting:"◌",queued:"⋯","close-pending":"⊘",offline:"○",unknown:"⁇"},fe=new Set(["asking","review","done","close-pending","error"]),B=e=>(e==null?void 0:e.liveness)==="offline"||(e==null?void 0:e.status)==="offline"?"offline":fe.has(e==null?void 0:e.status)?"need":"run",me=(e,n)=>{const a=n?(e||[]).find(t=>t.id===n):null;return a&&B(a)!=="offline"?a:null},ee=e=>(e==null?void 0:e.sortKey)!=null?e.sortKey:(e==null?void 0:e.created)??0,se=e=>{const n={need:0,run:1,offline:2};return[...e].sort((a,t)=>n[B(a)]-n[B(t)]||ee(t)-ee(a))},Be=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),xe=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 Re(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 c=a.get(i)||[];c.push(l),a.set(i,c)}else t.push(l)}return{roots:t,childrenOf:a}}function Oe(e,n){let a=!1,t=!1,l=0;const i=(c,o)=>{for(const r of n.get(c)||[])o.has(r.id)||(o.add(r.id),l++,fe.has(r.status)?a=!0:M[r.status]===M.working&&(t=!0),i(r.id,o))};return i(e,new Set([e])),{color:a?M.asking:t?M.working:M.idle,count:l}}function ze(e,n){const{roots:a,childrenOf:t}=Re(e),l=[],i=(r,u,p,N)=>{const x=t.get(r.id)||[],k=x.length>0,y=k&&!!n(r.id),m=k?Oe(r.id,t):null;if(l.push({type:"row",s:r,depth:u,expandable:k,expanded:y,rollup:(m==null?void 0:m.color)??null,kin:(m==null?void 0:m.count)??0,guides:N}),y){const v=se(x).filter(d=>!p.has(d.id));v.forEach((d,h)=>{p.add(d.id),i(d,u+1,p,[...N,h<v.length-1])})}},c=new Set;let o=null;for(const r of se(a)){if(c.has(r.id))continue;c.add(r.id);const u=B(r);u!==o&&(l.push({type:"zone",zone:u}),o=u),i(r,0,c,[])}return l}function Ke({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 We={video:"vid",image:"img",transcript:"txt",data:"data"},ve=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"}]:[]},T=e=>{const n=ve(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 Z(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 A=e=>`eval:${e.node}·${e.scenario}`;function _e({e,selected:n,onClick:a}){return s.jsxs("button",{className:`ef-row ${n?"sel":""}`,onClick:a,children:[s.jsx(Y,{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:T(e).map(t=>We[t]).filter(Boolean).join("·")}),s.jsx("span",{className:"ef-time",children:Ue(e.ts)})]})}const Ue=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 zs({nodes:e=[],sessions:n=[],sel:a,onSel:t,onRows:l,mustShow:i=null,lead:c=null}){const o=b(),[r,u]=f.useState(null),[p,N]=f.useState(!1),x=f.useMemo(()=>qe(e),[e]),k=x.some(w=>T(w).includes("video")),y=x.some(w=>T(w).includes("image")),m=r??(k?"video":y?"image":"all"),v=f.useMemo(()=>x.filter(w=>m==="all"||T(w).includes(m)),[x,m]),d=w=>!!me(n,w.by),h=f.useMemo(()=>v.filter(d).length,[v,n]),g=f.useMemo(()=>p?v.filter(d):v,[v,p,n]);return f.useEffect(()=>{l==null||l(g)},[g,l]),f.useEffect(()=>{i&&(g.some(w=>A(w)===i)||x.some(w=>A(w)===i)&&(u("all"),N(!1)))},[i,g,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(Ke,{value:m,onChange:u,options:["video","image","all"].map(w=>({value:w,label:o(`evalsFeed.kind.${w}`)}))})]}),(p||h>0)&&s.jsx("span",{className:"ef-chipbar",children:s.jsx("button",{type:"button",className:`ef-chip fv-live ${p?"on":""}`,onClick:()=>N(w=>!w),"data-tip":o("masterList.liveChipTitle"),children:o("masterList.liveChip",{n:h})})})]}),g.length===0&&s.jsx("div",{className:"ef-empty",children:o("evalsFeed.empty")}),g.map(w=>s.jsx(_e,{e:w,selected:a===A(w),onClick:()=>t(A(w),w)},A(w)))]})}const Ge={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 z({name:e,size:n=16,strokeWidth:a,className:t,style:l}){const i=Ge[e];if(!i)throw new Error(`unknown icon: ${e}`);const c=i.vb||24;return s.jsx("svg",{width:n,height:n,viewBox:`0 0 ${c} ${c}`,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 Ks({icon:e,label:n,onClick:a,className:t,size:l,iconClassName:i,...c}){return s.jsx("button",{type:"button",className:t,"data-tip":n,"aria-label":n,onClick:a,...c,children:s.jsx(z,{name:e,size:l,className:i})})}const Ws=()=>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"})}),qs=()=>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"})}),F=e=>`/api/yatsu/blob/${e}`;function Ze({src:e,alt:n,onClose:a}){return f.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 Ye({hash:e}){const n=b(),[a,t]=f.useState(null);return f.useEffect(()=>{let l=!0;return fetch(F(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 Je({hash:e}){const n=b(),[a,t]=f.useState(null);return f.useEffect(()=>{let l=!0;return fetch(F(e)).then(i=>i.ok?i.text():Promise.reject(new Error("miss"))).then(i=>{let c=i,o=!0;try{c=JSON.stringify(JSON.parse(i),null,2)}catch{o=!1}l&&t({text:c,valid:o})}).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 Qe({hash:e,alt:n}){const[a,t]=f.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx("img",{className:"an-image",src:F(e),alt:n,loading:"lazy",onClick:()=>t(!0)}),a&&s.jsx(Ze,{src:F(e),alt:n,onClose:()=>t(!1)})]})}function Xe({exit:e}){return s.jsx(z,{name:e?"minimize":"maximize",size:15})}function _s({target:e,className:n=""}){const a=b(),[t,l]=f.useState(!1);f.useEffect(()=>{const c=()=>{const o=document.fullscreenElement,r=e==null?void 0:e.current;l(!!o&&!!r&&(o===r||r.contains(o)))};return document.addEventListener("fullscreenchange",c),()=>document.removeEventListener("fullscreenchange",c)},[e]);const i=()=>{var o,r;const c=e==null?void 0:e.current;c&&(document.fullscreenElement?(o=document.exitFullscreen||document.webkitExitFullscreen)==null||o.call(document):(r=c.requestFullscreen||c.webkitRequestFullscreen)==null||r.call(c))};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(Xe,{exit:t})})}function ge({e,alt:n=""}){const a=b();return e.state==="miss"?s.jsx("div",{className:"eval-noimg",children:a("nodeView.eval.miss")}):e.kind==="transcript"?s.jsx(Ye,{hash:e.hash}):e.kind==="data"?s.jsx(Je,{hash:e.hash}):e.kind==="video"?s.jsx("video",{className:"eval-video",src:F(e.hash),controls:!0,preload:"metadata",playsInline:!0}):s.jsx(Qe,{hash:e.hash,alt:n})}const P=new Map;function es(e){const[n,a]=f.useState(()=>P.get(e)??null);return f.useEffect(()=>{if(P.has(e)){a(P.get(e));return}let t=!0;return fetch(F(e),{headers:{Range:"bytes=0-0"}}).then(l=>{const i=l.headers.get("content-type")||"",c=l.ok?{kind:i.startsWith("video/")?"video":i.startsWith("image/")?"image":i.startsWith("application/json")?"data":"transcript",state:"present"}:{kind:"image",state:"miss"};P.set(e,c),t&&a(c)}).catch(()=>{t&&a({kind:"image",state:"miss"})}),()=>{t=!1}},[e]),n}function je({hash:e,alt:n=""}){const a=es(e);return a?s.jsx(ge,{e:{hash:e,...a},alt:n}):null}const Us=/\[\[(\.?[\p{L}\p{N}_-]+)\]\]/gu,we=e=>(e||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,"");function ss(e,n,a){const t=n.toLowerCase(),l=[];for(const i of e){const c=i.id.toLowerCase(),o=we(i.path).toLowerCase();let r;if(!t)r=3;else if(c.startsWith(t))r=0;else if(c.includes(t))r=1;else if(o.includes(t))r=2;else continue;i.id===a&&(r=-1),l.push({s:i,score:r})}return l.sort((i,c)=>i.score-c.score||i.s.id.length-c.s.id.length||i.s.id.localeCompare(c.s.id)),l.slice(0,8).map(i=>i.s)}function ns(e,n){const a=n.toLowerCase(),t=o=>xe(o)||(o.id||"").slice(0,8),l=[];for(const o of e||[]){if(o.liveness!=="online")continue;const r=(o.id||"").toLowerCase(),u=t(o).toLowerCase();let p;if(!a)p=3;else if(r===a||u===a)p=0;else if(r.startsWith(a)||u.startsWith(a))p=1;else if(r.includes(a)||u.includes(a))p=2;else continue;l.push({s:o,score:p})}l.sort((o,r)=>o.score-r.score||(r.s.created||0)-(o.s.created||0));const i=l.map(o=>({id:o.s.id,label:t(o.s),sub:o.s.node||o.s.status})),c=l.filter(o=>o.score===0).length;return i.splice(c,0,{id:"new",label:"new",sub:"spawn a fresh worker"}),i.slice(0,8)}function ne(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 ts(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),c=ss(a,i,t);return c.length?{kind:"mention",items:c,index:0,start:l-1,end:n,query:i}:null}return null}function as(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=ns(a,l);return i.length?{kind:"actor",items:i,index:0,start:t,end:n,query:l}:null}return null}function ls({menu:e,up:n,fixedStyle:a,onPick:t,onHover:l}){const i=b(),c=e.kind==="actor",o=e.query?c?`@${e.query}`:`[[${e.query}]]`:i(c?"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:["// ",o," — ",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"}${c&&r.id==="new"?" new":""}`,onMouseDown:p=>{p.preventDefault(),t(r)},onMouseEnter:()=>l(u),children:[!c&&s.jsx("span",{className:"mention-dot",style:{background:M[r.status]||M.offline}}),s.jsx("span",{className:"mention-id",children:c?s.jsxs(s.Fragment,{children:["@",ne(r.label,e.query)]}):ne(r.id,e.query)}),s.jsx("span",{className:"mention-path",children:c?r.sub:we(r.path)})]},r.id))]})}function is({inputRef:e,value:n,setValue:a,specs:t=[],sessions:l=[],focusId:i=null,up:c=!1,fixedAbove:o=null}){const[r,u]=f.useState(null),[p,N]=f.useState(null),x=h=>{var $;if(!h){u(null),N(null);return}const g=h.selectionStart,w=ts(h.value,g,t,i)||as(h.value,g,l);if(u(w),!w||!o){N(null);return}const S=h.getBoundingClientRect(),E=($=h.closest(o))==null?void 0:$.getBoundingClientRect(),j=(E==null?void 0:E.top)??S.top;N({left:`${S.left}px`,width:`${S.width}px`,right:"auto",bottom:`${Math.max(8,window.innerHeight-j+8)}px`})},k=h=>u(g=>g&&{...g,index:(g.index+h+g.items.length)%g.items.length}),y=h=>{if(!h||!r)return;const g=r.kind==="actor"?`@${h.id} `:`[[${h.id}]] `,w=n.slice(0,r.start);a(w+g+n.slice(r.end)),u(null),N(null);const S=w.length+g.length;requestAnimationFrame(()=>{const E=e.current;E&&(E.focus(),E.setSelectionRange(S,S))})};return{menu:r,sync:x,onKeyDown:h=>r?h.key==="ArrowDown"?(h.preventDefault(),h.stopPropagation(),k(1),!0):h.key==="ArrowUp"?(h.preventDefault(),h.stopPropagation(),k(-1),!0):h.key==="Enter"||h.key==="Tab"?(h.preventDefault(),h.stopPropagation(),y(r.items[r.index]),!0):h.key==="Escape"?(h.preventDefault(),h.stopPropagation(),u(null),N(null),!0):!1:!1,close:()=>{u(null),N(null)},menuEl:r?s.jsx(ls,{menu:r,up:c,fixedStyle:p,onPick:y,onHover:h=>u(g=>g&&{...g,index:h})}):null}}function rs(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 cs=/^▶\s*(\d+):([0-5]?\d)(?:\s*·\s*([^\n]*))?/,os=/^!\[frame\]\(\/api\/yatsu\/blob\/[0-9a-f]{64}\)\n?/,ds=/\/api\/yatsu\/blob\/([0-9a-f]{64})/g,te=/!\[[^\]]*\]\(\/api\/yatsu\/blob\/([0-9a-f]{64})\)/g,us=e=>{const n=Math.floor(e/1e3);return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`};function ye(e){var i;const n=e||"",a=n.split(`
|
|
2
2
|
`,1)[0],t=cs.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 Ne=(e,n)=>`▶${us(e)}${n?` · ${n}`:""}`,ae=e=>[...(e||"").matchAll(ds)].map(n=>n[1]);function hs(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:Ne(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 Gs({originator:e,sessions:n=[],kind:a="issue",onOpenSession:t=null}){const l=b();if(!e)return null;const i=me(n,e),c=!!i,o=c?M[i.status]||M.working:M.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:o},"aria-hidden":"true"}),s.jsx("span",{className:"fv-originator-who",children:e})]});return c&&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 ${c?"alive":"offline"}`,"data-tip":r,children:u})}function ps({replies:e,onSeek:n,selIdx:a=null,activeIdx:t=null,onSelect:l=null,events:i=null,threadId:c=null,onRemarkChange:o=null}){const r=b(),[u,p]=f.useState(null),[N,x]=f.useState(null),k=async(y,m)=>{if(!u){p(m),x(null);try{const v=await Ee(y,m);v!=null&&v.ok?await(o==null?void 0:o()):x({ref:m,msg:(v==null?void 0:v.error)||`${y} failed`})}finally{p(null)}}};return e.map((y,m)=>{const v=ye(y.body),d=hs(v,i),h=v?v.rest:y.body,g=[...h.matchAll(te)].map(V=>V[1]),w=(g.length?h.replace(te,""):h).trim(),S=y.rid!==void 0,E=S?y.resolved?" remark resolved":" remark open":"",j=`fv-reply${a===m?" sel":""}${t===m?" active":""}${E}`,$=d&&d.seekable&&n?()=>l?l(m,d.tMs):n(d.tMs):null,C=S&&c?`${c}#${y.rid}`:null;return s.jsxs("div",{className:j,children:[s.jsxs("div",{className:"fv-reply-meta",children:[s.jsx("span",{className:"fv-reply-by",children:y.by}),y.at&&s.jsx("span",{className:"fv-reply-at",children:y.at}),d&&($?s.jsx("button",{type:"button",className:"fv-anchor",onClick:$,"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?" ⚠":""]})),S&&(y.resolved?s.jsxs("span",{className:"fv-remark-state resolved","data-tip":y.resolvedBy?r("thread.resolvedBy",{by:y.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&&o&&!y.resolved&&(y.by==="human"?s.jsx("button",{type:"button",className:"fv-remark-act retract",disabled:!!u,"data-tip":r("thread.retractTitle"),onClick:()=>k("retract",C),children:r("thread.retract")}):s.jsx("button",{type:"button",className:"fv-remark-act resolve",disabled:!!u,"data-tip":r("thread.resolveTitle"),onClick:()=>k("resolve",C),children:r("thread.resolve")}))]}),N&&N.ref===C&&s.jsx("div",{className:"fv-error",children:N.msg}),w&&s.jsx("div",{className:"fvd-body",children:s.jsx(R,{body:w})}),g.length>0&&s.jsx("div",{className:"fv-reply-media",children:g.map((V,I)=>s.jsx(je,{hash:V,alt:"evidence"},`${V}-${I}`))})]},m)})}function Zs({onSend:e,specs:n=[],sessions:a=[],focusId:t=null,onDone:l,anchorNow:i=null,draft:c=null,actionsEnd:o=null}){const r=b(),[u,p]=f.useState(""),[N,x]=f.useState(!1),[k,y]=f.useState(""),[m,v]=f.useState(!1),d=f.useRef(null),h=is({inputRef:d,value:u,setValue:p,specs:n,sessions:a,focusId:t,up:!0}),g=ae(u),w=m||!!u||g.length>0||!!k;f.useEffect(()=>{const j=d.current;if(!j)return;const $=getComputedStyle(j);rs(j,parseFloat($.maxHeight)||1/0,parseFloat($.minHeight)||0)},[u]),f.useEffect(()=>{var j;if(!c){p("");return}p(c.body||""),(j=d.current)==null||j.focus()},[c==null?void 0:c.seq]);const S=async()=>{var C;const j=await(i==null?void 0:i());if(!j)return;const $=Ne(j.tMs,j.step)+(j.frame?`
|
|
3
3
|
`:"");p(V=>{const I=ye(V),J=(I?I.rest:V).replace(os,"");return J?`${$}
|
|
4
4
|
${J}`:`${$}
|
|
@@ -6,4 +6,4 @@ ${J}`:`${$}
|
|
|
6
6
|
`),a=[];let t=0,l=0;for(;t<n.length;){const i=n[t].trim();if(/^```/.test(i)){const c=[];for(t++;t<n.length&&!/^```/.test(n[t].trim());)c.push(n[t++]);t++,a.push(s.jsx("pre",{className:"doc-pre",children:s.jsx("code",{children:c.join(`
|
|
7
7
|
`)})},l++))}else if(/^#{1,6}\s+/.test(n[t]))a.push(s.jsx("h4",{className:"doc-h",children:D(n[t].replace(/^#+\s+/,""))},l++)),t++;else if(i.includes("|")&&t+1<n.length&&re(n[t+1])){const c=W(n[t]),o=W(n[t+1]).map(gs);t+=2;const r=[];for(;t<n.length&&n[t].includes("|")&&n[t].trim()!==""&&!/^```/.test(n[t].trim());)r.push(W(n[t])),t++;a.push(s.jsxs("table",{className:"doc-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:c.map((u,p)=>s.jsx("th",{style:o[p]?{textAlign:o[p]}:void 0,children:D(u)},p))})}),s.jsx("tbody",{children:r.map((u,p)=>s.jsx("tr",{children:c.map((N,x)=>s.jsx("td",{style:o[x]?{textAlign:o[x]}:void 0,children:D(u[x]??"")},x))},p))})]},l++))}else if(/^-\s+/.test(i)){const c=[];for(;t<n.length&&/^-\s+/.test(n[t].trim());)c.push(n[t++].trim().replace(/^-\s+/,""));a.push(s.jsx("ul",{children:c.map((o,r)=>s.jsx("li",{children:D(o)},r))},l++))}else if(i==="")t++;else{const c=[];for(;t<n.length;){const o=n[t];if(o.trim()===""||/^```/.test(o.trim())||/^#{1,6}\s+/.test(o)||/^-\s+/.test(o.trim())||o.includes("|")&&t+1<n.length&&re(n[t+1]))break;c.push(o),t++}a.push(s.jsx("p",{children:D(c.join(" "))},l++))}}return s.jsx("div",{className:"doc-body",children:a})}function ce({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 js({parts:e}){const n=b();return s.jsxs("div",{className:"spec-parts",children:[s.jsx(ce,{kind:"raw",title:n("nodeView.rawTitle"),owner:"human",ownerLabel:n("nodeView.rawOwner"),note:n("nodeView.rawNote"),children:s.jsx(R,{body:e.rawSource})}),s.jsx(ce,{kind:"expanded",title:n("nodeView.expandedTitle"),owner:"agent",ownerLabel:n("nodeView.expandedOwner"),note:n("nodeView.expandedNote"),children:s.jsx(R,{body:e.expandedSpec})})]})}const q=new Map;function ws(e,n){const a=`${e}@${n??""}`,[t,l]=f.useState(()=>q.get(a)??null);return f.useEffect(()=>{const i=q.get(a);if(i){l(i);return}l(null);let c=!0;return fetch(O(e,"content")).then(o=>o.ok?o.json():Promise.reject(o.status)).then(o=>{q.set(a,o),c&&l(o)}).catch(()=>{c&&l({body:"",parts:null})}),()=>{c=!1}},[e,n,a]),t}function ys({node:e}){var l;const n=b(),a=ws(e.id,e.version),t=(e.driftFiles||[]).map(i=>`${i.file}: ${n("specNode.driftAhead",{n:i.behind})}`).join(`
|
|
8
8
|
`);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(Ie,{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)??"",c=e.parts??(a==null?void 0:a.parts)??null;return c?s.jsx(js,{parts:c}):s.jsx(R,{body:i})})()]})}function Ns(e,n=!0){const[a,t]=f.useState(null);return f.useEffect(()=>{if(!n)return;let l=!0;return fetch(O(e,"history")).then(i=>i.json()).then(i=>{l&&t(i)}).catch(()=>l&&t([])),()=>{l=!1}},[e,n]),a}const _=new Map;function bs(e,n,a){const t=`${e}/${n}`,[l,i]=f.useState(()=>_.get(t)??null);return f.useEffect(()=>{const c=_.get(t);if(c){i(c);return}let o=!0;return fetch(O(e,"diff",n)).then(r=>r.json()).then(r=>{_.set(t,r),o&&i(r)}).catch(()=>o&&i({patch:""})),()=>{o=!1}},[e,n,a,t]),l}function ks(e){const n=[];let a=!1;for(const t of e.split(`
|
|
9
|
-
`)){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 ke({diff:e}){const n=b();if(e==null)return s.jsx("figcaption",{className:"ev-note",children:n("nodeView.loadingChange")});const a=e.patch?ks(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 $e({items:e,itemKey:n,classes:a,rowClass:t,renderHeader:l,renderEvidence:i,leading:c,trailing:o,resetKey:r}){const u=b(),p=f.useRef(null),[N,x]=f.useState(()=>new Set([0]));f.useEffect(()=>{r!==void 0&&x(new Set([0]))},[r]);const k=f.useCallback(m=>x(v=>{const d=new Set(v);return d.has(m)?d.delete(m):d.add(m),d}),[]),y=f.useCallback(()=>x(m=>{const v=p.current;if(!v)return m;let d=-1;for(;m.has(d+1);)d++;if(d<0||d>=e.length-1)return m;const h=v.querySelector(`[data-i="${d}"]`);return!h||h.getBoundingClientRect().bottom-v.getBoundingClientRect().top>v.clientHeight+40?m:new Set(m).add(d+1)}),[e]);return f.useEffect(()=>{const m=p.current;if(!m)return;let v=m.scrollTop;const d=()=>{const g=m.scrollTop,w=g>v;v=g,w&&y()},h=g=>{g.key!=="j"&&g.key!=="ArrowDown"||m.scrollHeight-m.clientHeight-m.scrollTop>1||y()};return m.addEventListener("scroll",d,{passive:!0}),window.addEventListener("keydown",h,!0),()=>{m.removeEventListener("scroll",d),window.removeEventListener("keydown",h,!0)}},[y]),s.jsxs("div",{className:a.pane,ref:p,children:[e.length>1&&N.size<e.length&&s.jsx("div",{className:"chrono-tools",children:s.jsx("button",{className:"chrono-all",onClick:()=>x(new Set(e.keys())),children:u("nodeView.expandAll",{n:e.length})})}),c,e.map((m,v)=>{const d=N.has(v),h=t?t(m,v):"";return s.jsxs("div",{"data-i":v,className:`${a.row}${h?` ${h}`:""}${d?" open":""}`,children:[s.jsx("button",{className:a.head,onClick:()=>k(v),"aria-expanded":d,children:l(m,v,d)}),d&&s.jsx("figure",{className:a.evidence,children:i(m,v)})]},n(m,v))}),o]})}function $s({node:e,r:n,latest:a}){const t=bs(e.id,n.hash,!0);return s.jsx(ke,{diff:t})}function Ss({node:e,rows:n}){const a=b();return n?n.length?s.jsx($e,{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($s,{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 Se({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 Es({node:e}){const n=b(),[a,t]=f.useState(""),l=e.issues||[];if(!l.length)return s.jsx("div",{className:"pane-issues empty",children:n("nodeView.noIssues")});const i=a.trim().toLowerCase(),c=i?l.filter(u=>`${u.id} ${u.concern||""}`.toLowerCase().includes(i)):l,o=c.filter(u=>u.status==="open"),r=c.filter(u=>u.status!=="open");return s.jsxs("div",{className:"pane-issues",children:[l.length>5&&s.jsx(Se,{q:a,setQ:t,placeholder:n("nodeView.filterIssues")}),i&&!c.length&&s.jsx("div",{className:"pane-filter-none",children:n("nodeView.filterNone")}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"issue-group-head",children:n("nodeView.openIssues",{n:o.length})}),o.map(u=>s.jsx(le,{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(le,{issue:u},u.id))]})]})}const U=new Map;function Ms(e,n,a){const t=`${e} ${n}`,[l,i]=f.useState(()=>U.get(t)??null);return f.useEffect(()=>{if(!e||!n)return;const c=U.get(t);c&&i(c);let o=!0;return fetch(`/api/edit?source=${encodeURIComponent(e)}&path=${encodeURIComponent(n)}`).then(r=>r.json()).then(r=>{U.set(t,r),o&&i(r)}).catch(()=>o&&i(r=>r??{patch:""})),()=>{o=!1}},[e,n,a,t]),l}function Cs({node:e,ov:n}){const a=b(),t=Ms(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:vs[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(ke,{diff:t})]})}function Vs({node:e}){const n=b(),a=e.overlays||[];return a.length?s.jsx("div",{className:"pane-edit",children:a.map((t,l)=>s.jsx(Cs,{node:e,ov:t},l))}):s.jsx("div",{className:"pane-edit empty",children:n("nodeView.noEdit")})}function Ls({verdict:e}){const n=b();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 Fs({r:e}){var t;const n=b(),a=ve(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(ge,{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 oe({s:e}){var a;const n=b();return s.jsxs("div",{className:"eval-row eval-declared-row",children:[s.jsxs("span",{className:"eval-top",children:[s.jsx(Y,{state:"empty",title:n("score.missing")}),s.jsx("span",{className:"eval-scenario",children:e.name}),s.jsx(Pe,{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 de({track:e}){const n=b();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(ps,{replies:e.remarks})})]})}const H=new Map;function As({node:e}){var y,m,v;const n=b(),[a,t]=f.useState(""),l=`${e.id}@${((m=(y=e.evals)==null?void 0:y[0])==null?void 0:m.ts)||""}:${((v=e.evals)==null?void 0:v.length)||0}`,[i,c]=f.useState(()=>H.get(l)??null);if(f.useEffect(()=>{if(H.has(l)){c(H.get(l));return}let d=!0;return c(null),fetch(O(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||[]};H.set(l,g),d&&c(g)}).catch(()=>{d&&c({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 o=i.readings,r=a.trim().toLowerCase(),u=d=>!r||(d||"").toLowerCase().includes(r),p=r?o.filter(d=>u(d.scenario)):o,N=(i.dangling||[]).filter(d=>u(d.scenario)),x=Z(i.scenarios,o).filter(d=>!d.reading&&u(d.name)),k=i.readings.length+i.scenarios.length>5?s.jsx(Se,{q:a,setQ:t,placeholder:n("nodeView.filterScenarios")},"filter"):null;return o.length?s.jsx($e,{items:p,resetKey:r,leading:[k,r&&!p.length&&!x.length&&!N.length?s.jsx("div",{className:"pane-filter-none",children:n("nodeView.filterNone")},"none"):null,...x.map(d=>s.jsx(oe,{s:d},d.name))],trailing:N.map(d=>s.jsx(de,{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(Ls,{verdict:d.verdict}),s.jsx(Y,{state:pe(d),title:d.fresh?void 0:n("nodeView.eval.staleAxes",{axes:d.staleAxes.join(", ")})})]}),s.jsxs("span",{className:"eval-meta",children:[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(Fs,{r:d})}):s.jsxs("div",{className:"pane-eval pane-eval-declared",children:[k,s.jsx("div",{className:"eval-todo-note",children:r&&!x.length?n("nodeView.filterNone"):n("nodeView.eval.noReadings")}),x.map(d=>s.jsx(oe,{s:d},d.name)),N.map(d=>s.jsx(de,{track:d},d.threadId))]})}const Ds={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"};function sn({node:e,pane:n,setPane:a,onClose:t}){const l=b(),i=e.issues||[],c=i.filter(x=>x.status==="open").length,o=i.length-c,r=(e.overlays||[]).length,u=xs(e),p=u.some(x=>x.key===n)?n:u[0].key,N=Ns(e.id,p==="history");return s.jsx("div",{className:"ov-backdrop","data-focus-overlay":!0,onMouseDown:t,children:s.jsxs("div",{className:"ov-panel",onMouseDown:x=>x.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((x,k)=>s.jsxs("button",{className:x.key===p?"ov-tab on":"ov-tab",onClick:()=>a(x.key),children:[s.jsx("kbd",{children:k+1})," ",l(Ds[x.key]),x.key==="issues"&&(c>0||o>0)&&s.jsxs("span",{className:"ov-tab-counts",children:[c>0&&s.jsx("span",{className:"ovc st-open","data-tip":l("nodeView.openIssues",{n:c}),children:c}),o>0&&s.jsx("span",{className:"ovc st-closed","data-tip":l("nodeView.closedIssues",{n:o}),children:o})]}),x.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})})]},x.key))}),s.jsx("span",{className:"ov-hint",children:l("nodeView.hint")})]}),s.jsxs("div",{className:"ov-body",children:[p==="spec"&&s.jsx("div",{className:"pane-solo",children:s.jsx(ys,{node:e})}),p==="history"&&s.jsx(Ss,{node:e,rows:N}),p==="issues"&&s.jsx(Es,{node:e}),p==="eval"&&s.jsx(As,{node:e}),p==="edit"&&s.jsx(Vs,{node:e})]})]})})}const Is=({size:e=12})=>s.jsx(z,{name:"lock",size:e});function Ps(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])=>`${He[a]}${t}`).join(" ")}function Hs({guides:e=[],expandable:n,expanded:a,rollup:t,kin:l=0,onToggle:i}){return s.jsxs("span",{className:"sess-lead",children:[e.map((c,o)=>{const r=o===e.length-1?c?"tee":"elbow":c?"rail":"gap";return s.jsx("span",{className:`sess-rail ${r}`,"aria-hidden":"true"},o)}),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:c=>{c.stopPropagation(),i==null||i()},onMouseDown:c=>c.stopPropagation(),children:l})]})}function Ts(){const[e,n]=f.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 Bs({s:e,locked:n,showAvatar:a=!0,compact:t=!1,lead:l=null}){const i=b(),c=Ps(e.ops),o=xe(e),r=i(`status.${e.status}`);return s.jsxs(s.Fragment,{children:[l,a&&s.jsx(Le,{seed:e.id,status:e.status,title:`${Be(e)} · ${r} — ${e.id.slice(0,8)}`}),s.jsxs("span",{className:"sess-meta",children:[t?s.jsx("span",{className:"sess-glyph",style:{color:M[e.status]},"data-tip":r,"aria-label":r,children:Te[e.status]}):s.jsx("span",{className:"sess-status",style:{color:M[e.status]},children:r}),c&&s.jsx("span",{className:"sess-ops",children:c})]}),s.jsx("span",{className:"sess-id","data-tip":o,children:o}),n&&s.jsx("span",{className:"sess-lock","data-tip":i("sessionWindow.lockedTitle"),children:s.jsx(Is,{})})]})}function nn({sessions:e,activeId:n,onPick:a,onOpenSession:t}){const l=b(),{expanded:i,toggle:c}=Ts(),o=f.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")]}):o.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,p=u.source===n,N=r.expandable||r.depth?s.jsx(Hs,{guides:r.guides,expandable:r.expandable,expanded:r.expanded,rollup:r.rollup,kin:r.kin,onToggle:()=>c(u.id)}):null;return s.jsx("button",{className:p?"sess-row locked":"sess-row",style:{"--ov":Ce(u.id)},onClick:()=>a(u),onDoubleClick:()=>t(u.id),"data-tip":l("sessionWindow.rowTitle"),children:s.jsx(Bs,{s:u,locked:p,compact:!0,lead:N})},u.id)})})}export{_s as $,Le as A,_e as B,Ts as C,ze as D,Vs as E,rs as F,He as G,Ss as H,le as I,ne as J,Us as K,Is as L,ls as M,sn as N,qs as O,we as P,ts as Q,Hs as R,Os as S,Pe as T,as as U,ve as V,hs as W,ye as X,Ne as Y,Gs as Z,us as _,Ie as a,ge as a0,ps as a1,Zs as a2,qe as a3,zs as a4,me as a5,Ke as a6,R as a7,is as a8,Te as b,M as c,Z as d,De as e,Xs as f,Ks as g,Js as h,ms as i,Be as j,Qs as k,Ce as l,Y as m,z as n,K as o,en as p,xs as q,nn as r,xe as s,Ns as t,Ys as u,ys as v,Es as w,Bs as x,Ws as y,A as z};
|
|
9
|
+
`)){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 ke({diff:e}){const n=b();if(e==null)return s.jsx("figcaption",{className:"ev-note",children:n("nodeView.loadingChange")});const a=e.patch?ks(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 $e({items:e,itemKey:n,classes:a,rowClass:t,renderHeader:l,renderEvidence:i,leading:c,trailing:o,resetKey:r}){const u=b(),p=f.useRef(null),[N,x]=f.useState(()=>new Set([0]));f.useEffect(()=>{r!==void 0&&x(new Set([0]))},[r]);const k=f.useCallback(m=>x(v=>{const d=new Set(v);return d.has(m)?d.delete(m):d.add(m),d}),[]),y=f.useCallback(()=>x(m=>{const v=p.current;if(!v)return m;let d=-1;for(;m.has(d+1);)d++;if(d<0||d>=e.length-1)return m;const h=v.querySelector(`[data-i="${d}"]`);return!h||h.getBoundingClientRect().bottom-v.getBoundingClientRect().top>v.clientHeight+40?m:new Set(m).add(d+1)}),[e]);return f.useEffect(()=>{const m=p.current;if(!m)return;let v=m.scrollTop;const d=()=>{const g=m.scrollTop,w=g>v;v=g,w&&y()},h=g=>{g.key!=="j"&&g.key!=="ArrowDown"||m.scrollHeight-m.clientHeight-m.scrollTop>1||y()};return m.addEventListener("scroll",d,{passive:!0}),window.addEventListener("keydown",h,!0),()=>{m.removeEventListener("scroll",d),window.removeEventListener("keydown",h,!0)}},[y]),s.jsxs("div",{className:a.pane,ref:p,children:[e.length>1&&N.size<e.length&&s.jsx("div",{className:"chrono-tools",children:s.jsx("button",{className:"chrono-all",onClick:()=>x(new Set(e.keys())),children:u("nodeView.expandAll",{n:e.length})})}),c,e.map((m,v)=>{const d=N.has(v),h=t?t(m,v):"";return s.jsxs("div",{"data-i":v,className:`${a.row}${h?` ${h}`:""}${d?" open":""}`,children:[s.jsx("button",{className:a.head,onClick:()=>k(v),"aria-expanded":d,children:l(m,v,d)}),d&&s.jsx("figure",{className:a.evidence,children:i(m,v)})]},n(m,v))}),o]})}function $s({node:e,r:n,latest:a}){const t=bs(e.id,n.hash,!0);return s.jsx(ke,{diff:t})}function Ss({node:e,rows:n}){const a=b();return n?n.length?s.jsx($e,{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($s,{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 Se({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 Es({node:e}){const n=b(),[a,t]=f.useState(""),l=e.issues||[];if(!l.length)return s.jsx("div",{className:"pane-issues empty",children:n("nodeView.noIssues")});const i=a.trim().toLowerCase(),c=i?l.filter(u=>`${u.id} ${u.concern||""}`.toLowerCase().includes(i)):l,o=c.filter(u=>u.status==="open"),r=c.filter(u=>u.status!=="open");return s.jsxs("div",{className:"pane-issues",children:[l.length>5&&s.jsx(Se,{q:a,setQ:t,placeholder:n("nodeView.filterIssues")}),i&&!c.length&&s.jsx("div",{className:"pane-filter-none",children:n("nodeView.filterNone")}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"issue-group-head",children:n("nodeView.openIssues",{n:o.length})}),o.map(u=>s.jsx(le,{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(le,{issue:u},u.id))]})]})}const U=new Map;function Ms(e,n,a){const t=`${e} ${n}`,[l,i]=f.useState(()=>U.get(t)??null);return f.useEffect(()=>{if(!e||!n)return;const c=U.get(t);c&&i(c);let o=!0;return fetch(`/api/edit?source=${encodeURIComponent(e)}&path=${encodeURIComponent(n)}`).then(r=>r.json()).then(r=>{U.set(t,r),o&&i(r)}).catch(()=>o&&i(r=>r??{patch:""})),()=>{o=!1}},[e,n,a,t]),l}function Cs({node:e,ov:n}){const a=b(),t=Ms(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:vs[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(ke,{diff:t})]})}function Vs({node:e}){const n=b(),a=e.overlays||[];return a.length?s.jsx("div",{className:"pane-edit",children:a.map((t,l)=>s.jsx(Cs,{node:e,ov:t},l))}):s.jsx("div",{className:"pane-edit empty",children:n("nodeView.noEdit")})}function Ls({verdict:e}){const n=b();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 Fs({r:e}){var t;const n=b(),a=ve(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(ge,{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 oe({s:e}){var a;const n=b();return s.jsxs("div",{className:"eval-row eval-declared-row",children:[s.jsxs("span",{className:"eval-top",children:[s.jsx(Y,{state:"empty",title:n("score.missing")}),s.jsx("span",{className:"eval-scenario",children:e.name}),s.jsx(Pe,{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 de({track:e}){const n=b();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(ps,{replies:e.remarks})})]})}const H=new Map;function As({node:e}){var y,m,v;const n=b(),[a,t]=f.useState(""),l=`${e.id}@${((m=(y=e.evals)==null?void 0:y[0])==null?void 0:m.ts)||""}:${((v=e.evals)==null?void 0:v.length)||0}`,[i,c]=f.useState(()=>H.get(l)??null);if(f.useEffect(()=>{if(H.has(l)){c(H.get(l));return}let d=!0;return c(null),fetch(O(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||[]};H.set(l,g),d&&c(g)}).catch(()=>{d&&c({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 o=i.readings,r=a.trim().toLowerCase(),u=d=>!r||(d||"").toLowerCase().includes(r),p=r?o.filter(d=>u(d.scenario)):o,N=(i.dangling||[]).filter(d=>u(d.scenario)),x=Z(i.scenarios,o).filter(d=>!d.reading&&u(d.name)),k=i.readings.length+i.scenarios.length>5?s.jsx(Se,{q:a,setQ:t,placeholder:n("nodeView.filterScenarios")},"filter"):null;return o.length?s.jsx($e,{items:p,resetKey:r,leading:[k,r&&!p.length&&!x.length&&!N.length?s.jsx("div",{className:"pane-filter-none",children:n("nodeView.filterNone")},"none"):null,...x.map(d=>s.jsx(oe,{s:d},d.name))],trailing:N.map(d=>s.jsx(de,{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(Ls,{verdict:d.verdict}),s.jsx(Y,{state:pe(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(Fs,{r:d})}):s.jsxs("div",{className:"pane-eval pane-eval-declared",children:[k,s.jsx("div",{className:"eval-todo-note",children:r&&!x.length?n("nodeView.filterNone"):n("nodeView.eval.noReadings")}),x.map(d=>s.jsx(oe,{s:d},d.name)),N.map(d=>s.jsx(de,{track:d},d.threadId))]})}const Ds={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"};function sn({node:e,pane:n,setPane:a,onClose:t}){const l=b(),i=e.issues||[],c=i.filter(x=>x.status==="open").length,o=i.length-c,r=(e.overlays||[]).length,u=xs(e),p=u.some(x=>x.key===n)?n:u[0].key,N=Ns(e.id,p==="history");return s.jsx("div",{className:"ov-backdrop","data-focus-overlay":!0,onMouseDown:t,children:s.jsxs("div",{className:"ov-panel",onMouseDown:x=>x.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((x,k)=>s.jsxs("button",{className:x.key===p?"ov-tab on":"ov-tab",onClick:()=>a(x.key),children:[s.jsx("kbd",{children:k+1})," ",l(Ds[x.key]),x.key==="issues"&&(c>0||o>0)&&s.jsxs("span",{className:"ov-tab-counts",children:[c>0&&s.jsx("span",{className:"ovc st-open","data-tip":l("nodeView.openIssues",{n:c}),children:c}),o>0&&s.jsx("span",{className:"ovc st-closed","data-tip":l("nodeView.closedIssues",{n:o}),children:o})]}),x.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})})]},x.key))}),s.jsx("span",{className:"ov-hint",children:l("nodeView.hint")})]}),s.jsxs("div",{className:"ov-body",children:[p==="spec"&&s.jsx("div",{className:"pane-solo",children:s.jsx(ys,{node:e})}),p==="history"&&s.jsx(Ss,{node:e,rows:N}),p==="issues"&&s.jsx(Es,{node:e}),p==="eval"&&s.jsx(As,{node:e}),p==="edit"&&s.jsx(Vs,{node:e})]})]})})}const Is=({size:e=12})=>s.jsx(z,{name:"lock",size:e});function Ps(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])=>`${He[a]}${t}`).join(" ")}function Hs({guides:e=[],expandable:n,expanded:a,rollup:t,kin:l=0,onToggle:i}){return s.jsxs("span",{className:"sess-lead",children:[e.map((c,o)=>{const r=o===e.length-1?c?"tee":"elbow":c?"rail":"gap";return s.jsx("span",{className:`sess-rail ${r}`,"aria-hidden":"true"},o)}),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:c=>{c.stopPropagation(),i==null||i()},onMouseDown:c=>c.stopPropagation(),children:l})]})}function Ts(){const[e,n]=f.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 Bs({s:e,locked:n,showAvatar:a=!0,compact:t=!1,lead:l=null}){const i=b(),c=Ps(e.ops),o=xe(e),r=i(`status.${e.status}`);return s.jsxs(s.Fragment,{children:[l,a&&s.jsx(Le,{seed:e.id,status:e.status,title:`${Be(e)} · ${r} — ${e.id.slice(0,8)}`}),s.jsxs("span",{className:"sess-meta",children:[t?s.jsx("span",{className:"sess-glyph",style:{color:M[e.status]},"data-tip":r,"aria-label":r,children:Te[e.status]}):s.jsx("span",{className:"sess-status",style:{color:M[e.status]},children:r}),c&&s.jsx("span",{className:"sess-ops",children:c})]}),s.jsx("span",{className:"sess-id","data-tip":o,children:o}),n&&s.jsx("span",{className:"sess-lock","data-tip":i("sessionWindow.lockedTitle"),children:s.jsx(Is,{})})]})}function nn({sessions:e,activeId:n,onPick:a,onOpenSession:t}){const l=b(),{expanded:i,toggle:c}=Ts(),o=f.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")]}):o.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,p=u.source===n,N=r.expandable||r.depth?s.jsx(Hs,{guides:r.guides,expandable:r.expandable,expanded:r.expanded,rollup:r.rollup,kin:r.kin,onToggle:()=>c(u.id)}):null;return s.jsx("button",{className:p?"sess-row locked":"sess-row",style:{"--ov":Ce(u.id)},onClick:()=>a(u),onDoubleClick:()=>t(u.id),"data-tip":l("sessionWindow.rowTitle"),children:s.jsx(Bs,{s:u,locked:p,compact:!0,lead:N})},u.id)})})}export{_s as $,Le as A,_e as B,Ts as C,ze as D,Vs as E,rs as F,He as G,Ss as H,le as I,ne as J,Us as K,Is as L,ls as M,sn as N,qs as O,we as P,ts as Q,Hs as R,Os as S,Pe as T,as as U,ve as V,hs as W,ye as X,Ne as Y,Gs as Z,us as _,Ie as a,ge as a0,ps as a1,Zs as a2,qe as a3,zs as a4,me as a5,Ke as a6,R as a7,is as a8,Te as b,M as c,Z as d,De as e,Xs as f,Ks as g,Js as h,ms as i,Be as j,Qs as k,Ce as l,Y as m,z as n,K as o,en as p,xs as q,nn as r,xe as s,Ns as t,Ys as u,ys as v,Es as w,Bs as x,Ws as y,A as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as g,r,j as s,L as u}from"./index-
|
|
1
|
+
import{n as g,r,j as s,L as u}from"./index-BhIslAau.js";import{A as p,k as x,b as j,i as k,r as f,s as N}from"./Dashboard-P0B9ukSG.js";import"./SessionWindow-LcCzBMU7.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};
|