spexcode 0.2.2 → 0.2.3
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 +26 -15
- package/package.json +1 -1
- package/spec-cli/src/cli.ts +3 -2
- package/spec-cli/src/guide.ts +38 -32
- package/spec-cli/src/harness.ts +26 -31
- package/spec-cli/src/help.ts +1 -1
- package/spec-cli/src/layout.ts +1 -3
- package/spec-cli/src/lint.ts +34 -5
- package/spec-cli/src/sessions.ts +11 -7
- package/spec-cli/templates/spexcode.json +7 -0
- package/spec-dashboard/dist/assets/{Dashboard-BwZ2KzxB.js → Dashboard-Dlg78cbC.js} +3 -3
- package/spec-dashboard/dist/assets/EvalsPage-CDxc1-in.js +3 -0
- package/spec-dashboard/dist/assets/{FoldToggle-GwE0-k1d.js → FoldToggle-B5leylLf.js} +1 -1
- package/spec-dashboard/dist/assets/{IssuesPage-B17pnl9I.js → IssuesPage-C2yFXiO-.js} +1 -1
- package/spec-dashboard/dist/assets/{MobileApp-WEZbR8M1.js → MobileApp-RHNECU6x.js} +1 -1
- package/spec-dashboard/dist/assets/{SessionInterface-Sh8kHpnj.js → SessionInterface-YLD6IOmC.js} +1 -1
- package/spec-dashboard/dist/assets/SessionWindow-CmKtpNUX.js +9 -0
- package/spec-dashboard/dist/assets/{Settings-Dgtg-Xb9.js → Settings-ZnOwskMZ.js} +1 -1
- package/spec-dashboard/dist/assets/{index-Dd0_U5rk.js → index-BdRQfrkR.js} +2 -2
- package/spec-dashboard/dist/assets/{index-CCmnCbKS.css → index-DEc5Ru3l.css} +1 -1
- package/spec-dashboard/dist/index.html +2 -2
- package/spec-yatsu/src/cli.ts +39 -11
- package/spec-yatsu/src/evaltab.ts +7 -6
- package/spec-yatsu/src/filing.ts +6 -3
- package/spec-yatsu/src/proof.ts +10 -0
- package/spec-yatsu/src/sidecar.ts +25 -3
- package/spec-yatsu/src/timeline.ts +53 -23
- package/README.zh-CN.md +0 -170
- package/spec-dashboard/dist/assets/EvalsPage-DV75EdP4.js +0 -3
- package/spec-dashboard/dist/assets/SessionWindow-EzFq-hLG.js +0 -9
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{u as pe,r as a,s as Ze,j as n,e as Je,f as Qe}from"./index-BdRQfrkR.js";import{V as et,W as tt,X as nt,Y as Ie,Z as st,g as de,n as at,_ as J,$ as lt,a0 as Pe,a1 as ot,a2 as it,u as rt,z as fe,a3 as ct,o as ut,a4 as dt}from"./SessionWindow-CmKtpNUX.js";import{F as he}from"./FoldToggle-B5leylLf.js";const me=(l,u)=>{let f=null;for(const v of l)if(v.at<=u)f=v;else break;return f},ft=l=>{if(!l||!Array.isArray(l.events))return null;const u=l.v===1?"time":typeof l.axis=="string"?l.axis:"time",f=l.v===1?v=>v.tMs:v=>v.at;return{axis:u,events:l.events.map(v=>({at:f(v),step:v.step,...v.node?{node:v.node}:{}}))}},ht=(l,u,f)=>l==="time"?J(u):l==="frame"?`#${u}`:l==="line"?`L${u}`:l==="index"?f?`${u}/${f}`:`${u}`:String(u);function Fe({events:l,axis:u,extent:f,activeStepIdx:v,onSeek:E}){return n.jsx("div",{className:"an-ruler",children:l.map((r,h)=>n.jsxs("button",{className:`an-step ${v===h?"on":""}`,onClick:()=>E(r.at),"data-tip":r.node?`→ ${r.node}`:void 0,children:[ht(u,r.at,f)," ",r.step]},h))})}const ve=l=>{var u,f;return((u=l.verdict)==null?void 0:u.status)==="pass"?"✓":((f=l.verdict)==null?void 0:f.status)==="fail"?"✗":"·"},Ke=l=>{var u,f;return((u=l.verdict)==null?void 0:u.status)==="pass"?"pass":((f=l.verdict)==null?void 0:f.status)==="fail"?"fail":"legacy"};function mt({entry:l,specs:u=[],sessions:f=[],onWrite:v,onOpenSession:E}){var Le,Te,De,Ce,Ae;const r=pe(),h=a.useRef(null),x=a.useRef(null),w=a.useRef(null),k=a.useRef(null),g=a.useRef(0),[d,M]=a.useState([]),[j,y]=a.useState("time"),[i,b]=a.useState(null),[$,L]=a.useState(""),[T,O]=a.useState(!1),[Q,B]=a.useState(null),D=a.useRef(null),m=a.useRef(null),A=a.useRef(null),ee=a.useRef(0),[Ve,xe]=a.useState(0),[te,ge]=a.useState(-1),[ye,be]=a.useState(null),[_,ne]=a.useState(!1),[je,se]=a.useState(!1),[ae,le]=a.useState(null),[q,oe]=a.useState(null),[N,we]=a.useState(null),[C,W]=a.useState(0),p=N&&N[C]||l;a.useEffect(()=>{b(null),L(""),M([]),B(null),W(0),we(null);let e=!0;return fetch(Ze(l.node,"evals")).then(t=>t.ok?t.json():null).then(t=>{e&&Array.isArray(t==null?void 0:t.readings)&&we(t.readings.filter(s=>s.scenario===l.scenario))}).catch(()=>{}),()=>{e=!1}},[l.node,l.scenario,l.ts,l.blob]),a.useEffect(()=>{b(null),B(null)},[C]);const U=et(p),I=U.find(e=>e.kind==="video"&&e.state==="present"),ie=U.filter(e=>e.kind==="image"),Xe=U.filter(e=>e.kind!=="video"&&e.kind!=="image"),V=!!I,X=l.thread??null,re=a.useMemo(()=>X?[{by:X.by,at:X.created,body:X.body},...X.replies||[]]:[],[X]),ze=N&&((Le=N[0])==null?void 0:Le.by)||l.by||null,S=a.useMemo(()=>re.map((e,t)=>{const s=tt(nt(e.body),d);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),[re,d]),ke=a.useRef(d);ke.current=d;const Me=a.useRef(S);Me.current=S;const Y=a.useCallback(()=>{const e=ee.current,t=ke.current;let s=-1;for(let c=0;c<t.length&&t[c].at<=e;c++)s=c;ge(c=>c===s?c:s);let o=null;for(const c of Me.current)if(c.tMs<=e)o=c.i;else break;be(c=>c===o?c:o)},[]);a.useEffect(()=>{Y()},[S,d,Y]),a.useEffect(()=>{ee.current=0,D.current&&(D.current.style.width="0%"),m.current&&(m.current.style.left="0%"),A.current&&(A.current.textContent=""),ge(-1),be(null),xe(0),ne(!1),se(!1),le(null),oe(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&&ft(t);s&&(M(s.events),y(s.axis))}).catch(()=>{}),()=>{e=!1}},[p.timelineBlob]),a.useEffect(()=>{const e=h.current;if(!e)return;const t=()=>{const R=Math.round((e.currentTime||0)*1e3),F=Math.round((e.duration||0)*1e3);ee.current=R;const K=F?R/F*100:0;D.current&&(D.current.style.width=`${K}%`),m.current&&(m.current.style.left=`${K}%`),A.current&&(A.current.textContent=`${J(R)} / ${J(F)}`),Y()},s=()=>{xe(e.duration||0),t()},o=()=>ne(!0),c=()=>ne(!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",c),s(),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("seeked",t),e.removeEventListener("loadedmetadata",s),e.removeEventListener("durationchange",s),e.removeEventListener("play",o),e.removeEventListener("pause",c)}},[I==null?void 0:I.hash,l.node,l.scenario,C,Y]);const P=Math.round(Ve*1e3),G=d[te]||null,Ne=j==="time"?P:j==="frame"?ie.length:j==="index"?d.length:0,z=a.useCallback(e=>{const t=h.current;t&&(t.currentTime=e/1e3)},[]),Z=a.useCallback(()=>{const e=h.current;e&&(e.paused?e.play():e.pause())},[]),Ee=(e,t)=>{oe(e),t!=null&&z(t)},Oe=a.useCallback(()=>{var t,s;const e=Math.round((((t=h.current)==null?void 0:t.currentTime)??0)*1e3);return{tMs:e,step:((s=me(d,e))==null?void 0:s.step)??null}},[d]),$e=a.useCallback(()=>{const e=h.current;if(!e)return;e.pause();const t=Math.round((e.currentTime||0)*1e3),s=me(d,t),o=[Ie(t,s==null?void 0:s.step)];s!=null&&s.node&&s.node!==l.node&&o.push(`re: [[${s.node}]]`),o.push(""),B({seq:++g.current,body:o.join(`
|
|
2
|
+
`)})},[d,l.node]),ce=a.useCallback(e=>{var o;if(!S.length)return;let t=S.findIndex(c=>c.i===q);if(t<0){const c=Math.round((((o=h.current)==null?void 0:o.currentTime)||0)*1e3);t=S.reduce((R,F,K)=>F.tMs<=c?K:R,-1)}t=Math.min(S.length-1,Math.max(0,t+e));const s=S[t];oe(s.i),z(s.tMs)},[S,q,z]);a.useEffect(()=>{if(!V)return;const e=t=>{const s=document.activeElement;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"||s.isContentEditable))return;const o=h.current;o&&(t.key===" "?(t.preventDefault(),Z()):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(),ce(1)):t.key==="ArrowUp"?(t.preventDefault(),ce(-1)):(t.key==="a"||t.key==="A")&&(t.preventDefault(),$e()))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[V,Z,ce,$e]);const Se=e=>{var o;const t=(o=w.current)==null?void 0:o.getBoundingClientRect(),s=h.current;!t||!t.width||!s||!s.duration||(s.currentTime=Math.min(1,Math.max(0,(e-t.left)/t.width))*s.duration)},Ue=e=>{e.preventDefault(),se(!0),Se(e.clientX)},He=e=>{var s;const t=(s=w.current)==null?void 0:s.getBoundingClientRect();t!=null&&t.width&&le(Math.min(100,Math.max(0,(e.clientX-t.left)/t.width*100)))};a.useEffect(()=>{if(!je)return;const e=s=>Se(s.clientX),t=()=>se(!1);return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[je]);const Re=e=>{const t=x.current.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width*100,y:(e.clientY-t.top)/t.height*100}},_e=e=>{if(e.button!==0||T)return;const t=Re(e);b({x0:t.x,y0:t.y,x:t.x,y:t.y})},qe=e=>{var s,o;if(!i)return;const t=Re(e);!((s=h.current)!=null&&s.paused)&&(Math.abs(t.x-i.x0)>1||Math.abs(t.y-i.y0)>1)&&((o=h.current)==null||o.pause()),b({...i,x:t.x,y:t.y})},We=async e=>{const t=h.current;if(!(t!=null&&t.videoWidth))return;const s=Math.round((t.currentTime??0)*1e3),o=me(d,s);O(!0),L(r("annotator.capturing"));try{const c=document.createElement("canvas");c.width=t.videoWidth,c.height=t.videoHeight;const R=c.getContext("2d");R.drawImage(t,0,0,c.width,c.height),R.strokeStyle="#ff9a3c",R.lineWidth=Math.max(2,c.width/300),R.strokeRect(e.x/100*c.width,e.y/100*c.height,e.w/100*c.width,e.h/100*c.height);const F=await new Promise(Ge=>c.toBlob(Ge,"image/png")),{hash:K}=await Je(F);if(!K)throw new Error("no hash");const ue=[Ie(s,o==null?void 0:o.step),``];o!=null&&o.node&&o.node!==l.node&&ue.push(`re: [[${o.node}]]`),ue.push(""),B({seq:++g.current,body:ue.join(`
|
|
3
|
+
`)}),L("")}catch{L(r("annotator.failed"))}finally{O(!1)}},Ye=()=>{if(!i)return;const e={x:Math.min(i.x0,i.x),y:Math.min(i.y0,i.y),w:Math.abs(i.x-i.x0),h:Math.abs(i.y-i.y0)};if(b(null),e.w<1&&e.h<1){Z();return}We(e)},H=i&&{x:Math.min(i.x0,i.x),y:Math.min(i.y0,i.y),w:Math.abs(i.x-i.x0),h:Math.abs(i.y-i.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 ${Ke(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(st,{originator:ze,sessions:f,kind:"eval",onOpenSession:E}),N&&N.length>1&&n.jsxs("div",{className:"an-ab",children:[n.jsx(de,{icon:"chevron-left",size:13,className:"an-ab-nav",disabled:C>=N.length-1,onClick:()=>W(e=>Math.min(N.length-1,e+1)),label:r("annotator.abOlder")}),n.jsx("div",{className:"an-ab-track",children:N.slice().reverse().map((e,t)=>{const s=N.length-1-t;return n.jsx("button",{type:"button",className:`an-ab-pip ${Ke(e)} ${s===C?"on":""}`,onClick:()=>W(s),"data-tip":`${ve(e)} ${new Date(e.ts).toLocaleString()}`,children:ve(e)},`${e.ts}-${s}`)})}),n.jsx(de,{icon:"chevron-right",size:13,className:"an-ab-nav",disabled:C<=0,onClick:()=>W(e=>Math.max(0,e-1)),label:r("annotator.abNewer")}),n.jsx("span",{className:"an-ab-pos",children:C===0?r("annotator.abLatest"):r("annotator.abPos",{i:N.length-C,n:N.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:r("nodeView.eval.expected")})," ",p.expected]}),U.length>0&&((Te=p.verdict)==null?void 0:Te.note)&&n.jsxs("div",{className:"an-expected an-prior-note",children:[n.jsx("b",{children:r("nodeView.eval.noteLabel")})," ",p.verdict.note]}),!p.fresh&&(((De=p.staleAxes)==null?void 0:De.length)??0)>0&&n.jsxs("div",{className:"an-expected an-stale","data-tip":r("nodeView.eval.staleReadoutTitle"),children:[n.jsx("b",{children:r("nodeView.eval.staleLabel")})," ",p.staleAxes.join(" · "),(((Ce=p.codeDrift)==null?void 0:Ce.length)??0)>0&&n.jsxs("span",{className:"an-stale-files",children:[" — ",p.codeDrift.map(e=>`${e.file.split("/").pop()} +${e.behind}`).join(", ")]})]}),I&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"an-player",ref:k,children:[n.jsxs("div",{className:`an-stage ${_?"playing":"paused"}`,ref:x,onMouseDown:_e,onMouseMove:qe,onMouseUp:Ye,children:[n.jsx("video",{className:"an-video",ref:h,src:`/api/yatsu/blob/${I.hash}`,preload:"metadata",playsInline:!0}),H&&n.jsx("div",{className:"an-rect live",style:{left:`${H.x}%`,top:`${H.y}%`,width:`${H.w}%`,height:`${H.h}%`}}),!_&&!i&&n.jsx("div",{className:"an-bigplay","aria-hidden":!0,children:n.jsx(at,{name:"play",size:22})})]}),n.jsxs("div",{className:"an-bar",children:[n.jsx(de,{icon:_?"pause":"play",size:14,className:"an-play",label:r(_?"annotator.pause":"annotator.play"),onClick:Z}),n.jsxs("div",{className:"an-seek",ref:w,onMouseDown:Ue,onMouseMove:He,onMouseLeave:()=>le(null),children:[n.jsx("div",{className:"an-seek-trk"}),P>0&&j==="time"&&d.map((e,t)=>n.jsx("div",{className:"an-band",style:{left:`${e.at/P*100}%`},"data-tip":e.step},`band-${t}`)),n.jsx("div",{className:"an-seek-play",ref:D}),P>0&&S.map(e=>n.jsx("button",{type:"button",className:`an-mk ${q===e.i?"on":""} ${ye===e.i?"active":""}`,style:{left:`${e.tMs/P*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:m}),ae!=null&&P>0&&n.jsx("div",{className:"an-seek-hov",style:{left:`${ae}%`},children:J(ae/100*P)})]}),n.jsx("span",{className:"an-time",ref:A}),G&&n.jsx("span",{className:"an-curstep","data-tip":G.node?`→ ${G.node}`:void 0,children:G.step}),n.jsx(lt,{target:k})]})]}),d.length>0&&n.jsx(Fe,{events:d,axis:j,extent:Ne,activeStepIdx:te,onSeek:z}),n.jsx("div",{className:"an-hint",children:r("annotator.hint")}),n.jsx("div",{className:"an-keys",children:r("annotator.keys")}),$&&n.jsx("div",{className:"an-flash",children:$})]}),!I&&d.length>0&&n.jsx(Fe,{events:d,axis:j,extent:Ne,activeStepIdx:te,onSeek:z}),ie.length>0&&n.jsx("div",{className:"an-gallery",children:ie.map((e,t)=>n.jsx(Pe,{e,alt:l.scenario},`${e.hash}-${t}`))}),Xe.map((e,t)=>n.jsx(Pe,{e,alt:l.scenario},`${e.hash}-${t}`)),U.length===0&&((Ae=p.verdict)!=null&&Ae.note?n.jsx("pre",{className:"eval-transcript",children:p.verdict.note}):n.jsx("div",{className:"an-hint",children:r("nodeView.eval.noImage")}))]}),n.jsx(vt,{entry:l,comments:re,specs:u,sessions:f,onWrite:v,codeSha:p.codeSha,seekMs:V?z:null,anchorNow:V?Oe:null,draft:Q,selIdx:q,activeIdx:ye,onSelect:V?Ee:null,events:V?d:null})]})]})}function vt({entry:l,comments:u,codeSha:f,specs:v,sessions:E,onWrite:r,seekMs:h,anchorNow:x,draft:w,selIdx:k,activeIdx:g,onSelect:d,events:M}){var i;const j=pe(),y=(b,$)=>Qe({node:l.node,scenario:l.scenario,body:b,codeSha:f,evidence:$});return n.jsxs("aside",{className:"an-rail",children:[n.jsx("div",{className:"an-comments-head",children:j("annotator.comments",{n:u.length})}),n.jsx("div",{className:"an-rail-list",children:n.jsx(ot,{replies:u,onSeek:h,selIdx:k,activeIdx:g,onSelect:d,events:M,threadId:((i=l.thread)==null?void 0:i.id)??null,onRemarkChange:()=>r==null?void 0:r("")})}),n.jsx("div",{className:"an-rail-compose",children:n.jsx(it,{onSend:y,specs:v,sessions:E,focusId:l.node,onDone:r,anchorNow:x,draft:w},`${l.node}·${l.scenario}`)})]})}function Be({rowKeys:l,sel:u,onSel:f,detail:v,children:E}){const[r,h]=a.useState(!1),x=a.useRef({});x.current={rowKeys:l,sel:u},a.useEffect(()=>{const k=g=>{var b;const d=(b=g.target)==null?void 0:b.tagName;if(d==="INPUT"||d==="TEXTAREA"||g.metaKey||g.ctrlKey||g.altKey||g.key!=="j"&&g.key!=="k")return;g.preventDefault(),g.stopPropagation();const{rowKeys:M,sel:j}=x.current;if(!M.length)return;const y=M.indexOf(j),i=y<0?g.key==="j"?0:M.length-1:Math.max(0,Math.min(M.length-1,y+(g.key==="j"?1:-1)));f(M[i])};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[f]),a.useEffect(()=>{var k;(k=document.querySelector(".fv-list-col .sel"))==null||k.scrollIntoView({block:"nearest"})},[u]);const w=n.jsx(he,{className:"fv-fold-inline",onToggle:()=>h(!0)});return n.jsxs("div",{className:`fv-master ${r?"folded":""}`,children:[r&&n.jsx(he,{className:"fv-unfold",folded:!0,onToggle:()=>h(!1)}),n.jsx("div",{className:"fv-list-col",style:r?{display:"none"}:void 0,children:typeof E=="function"?E(w):n.jsxs(n.Fragment,{children:[n.jsx(he,{className:"fv-fold",onToggle:()=>h(!0)}),E]})}),n.jsx("div",{className:"fv-detail",children:v})]})}function pt({specs:l=[],sessions:u=[],reloadBoard:f,onOpenSession:v}){const E=pe(),{page:r,param:h}=rt(),[x,w]=a.useState(null),[k,g]=a.useState(""),[d,M]=a.useState([]),j=a.useRef([]),y=a.useMemo(()=>new Map(d.map(m=>[fe(m),m])),[d]);j.current=d.map(fe);const i=x&&y.has(x)?x:j.current[0]??null,b=a.useMemo(()=>{if(!h)return null;const m=h.indexOf("/");return m>0?`eval:${h.slice(0,m)}·${h.slice(m+1)}`:null},[h]),[$,L]=a.useState(null);a.useEffect(()=>{r==="evals"&&b&&(w(b),L(b))},[r,b]),a.useEffect(()=>{$&&y.has($)&&L(null)},[$,y]);const T=x&&!y.has(x),O=a.useMemo(()=>!T||ct(l).some(m=>fe(m)===x),[T,l,x]);a.useEffect(()=>{T&&!O&&(w(null),L(null))},[T,O]),a.useEffect(()=>{x&&!$&&d.length&&!y.has(x)&&w(null)},[x,$,d,y]),a.useEffect(()=>{if(r!=="evals"||!i||T)return;const m=/^eval:([^·]+)·(.+)$/.exec(i);m&&ut("evals",`${m[1]}/${m[2]}`,{replace:!0})},[r,i,T]);const Q=a.useCallback(m=>M(m),[]),B=m=>{m&&(g(m),setTimeout(()=>g(""),6e3))},D=i?y.get(i):null;return n.jsx(Be,{rowKeys:j.current,sel:i,onSel:w,detail:D?n.jsx(mt,{entry:D,specs:l,sessions:u,onOpenSession:v,onWrite:async m=>{B(m),await(f==null?void 0:f())}}):n.jsx("div",{className:"fv-note",children:E("evalsFeed.empty")}),children:m=>n.jsxs(n.Fragment,{children:[k&&n.jsx("div",{className:"fv-notice",children:k}),n.jsx(dt,{nodes:l,sessions:u,sel:i,onSel:A=>w(A),onRows:Q,mustShow:$,lead:m})]})})}const bt=Object.freeze(Object.defineProperty({__proto__:null,EvalMasterDetail:Be,default:pt},Symbol.toStringTag,{value:"Module"}));export{mt as E,Be as a,bt as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as l,j as t}from"./index-
|
|
1
|
+
import{u as l,j as t}from"./index-BdRQfrkR.js";import{n as a}from"./SessionWindow-CmKtpNUX.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-BdRQfrkR.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-CmKtpNUX.js";import{F as _}from"./FoldToggle-B5leylLf.js";import{u as rs,M as ds}from"./Dashboard-Dlg78cbC.js";function js({onFocusNode:t,onOpenSession:k,specs:v=[],sessions:x=[],issuesData:N=null,reloadIssues:o,issueId:d=null}){const i=D(),c=N,[h,p]=a.useState(!1),[j,m]=a.useState(!1),[g,w]=a.useState(!1),[S,b]=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)&&w(!0),M(e)||b(!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=g?K:K.filter(e=>!P(e)),E=S?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)})]}),(F>0||O>0)&&s.jsxs("span",{className:"ef-chipbar",children:[F>0&&s.jsx("button",{type:"button",className:`ef-chip fv-live ${S?"on":""}`,onClick:()=>b(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 ${g?"on":""}`,onClick:()=>w(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:N,onWrite:o}){const d=D(),i=t.store==="local",c=t.status!=="open",[h,p]=a.useState(""),[j,m]=a.useState(""),g=Array.isArray(t.nodes)?t.nodes:[],w=Array.isArray(t.replies)?t.replies:[],S=(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("")}}},b=(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:S(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:N}):t.by&&s.jsx("span",{className:"fv-by",children:t.by}),g.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:w,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:g[0]||null,onDone:o,actionsEnd:!c&&s.jsxs(s.Fragment,{children:[j&&s.jsx("span",{className:"fv-error",children:j}),i&&b("promote",d("session.issuesPromote"),()=>Y(t.id),d("session.issuesPromoteTitle")),b("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:N}){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,g]=a.useState(!1),[w,S]=a.useState(""),b=a.useRef(null),l=cs({inputRef:b,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)){g(!0),S("");try{const u=await es({concern:n,body:p.trim()||void 0,store:d});u!=null&&u.ok?(h(""),j(""),await(N==null?void 0:N(u.outcomes||""))):S((u==null?void 0:u.error)||o("session.issuesPostFailed"))}finally{g(!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:b,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:w?"fv-error":"fv-hint",children:w||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-BdRQfrkR.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-CmKtpNUX.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-Sh8kHpnj.js → SessionInterface-YLD6IOmC.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as K,j as F,u as Ge,b as Ze,c as qt,d as Kt}from"./index-
|
|
1
|
+
import{r as K,j as F,u as Ge,b as Ze,c as qt,d as Kt}from"./index-BdRQfrkR.js";import{y as Gt,O as Vt,s as ft,d as Xt,z as Yt,n as $e,m as Jt,B as Zt,C as Qt,D as es,F as vt,R as ts,x as ss,l as is,J as rs,M as ns,K as gt,P as os,Q as as,U as hs}from"./SessionWindow-CmKtpNUX.js";import{u as Ke,M as Qe,a as ls}from"./Dashboard-Dlg78cbC.js";import{E as cs,a as ds}from"./EvalsPage-CDxc1-in.js";import{F as us}from"./FoldToggle-B5leylLf.js";var wt={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
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{j as s,u as b,r as f,p as Se,s as z}from"./index-BdRQfrkR.js";function de(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 ue(e){return de(e)%360}function Me(e){const n=ue(e);return{bg:`hsl(${n} 55% 42%)`,fg:`hsl(${n} 70% 92%)`}}function Ee(e){return`hsl(${ue(e)} 65% 50%)`}const J=["◆","▲","●","■","★","✦","⬟","⬢","❖","◈","✸","⟡","✚","❂","◐","◑","⬣","▰","✶","⬤","✹","◇","⊛","✺"],Q=["circle","rounded","square","hex"];function Ce(e){const n=de(e);return{seed:e,glyph:J[(n>>>9)%J.length],shape:Q[(n>>>17)%Q.length],...Me(e)}}function Ve({seed:e,status:n,title:a,size:t=16}){const l=Ce(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 Le(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 Fe={pass:"✓",fail:"✗",stalePass:"✓",staleFail:"✗",empty:""};function he(e){const n=Le(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?he(l):"missing"}})}function Ae(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=Ae(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 De({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:Fe[e]})}const Bs={merged:{color:"#859900"},active:{color:"#cb4b16"},drift:{color:"#b58900"},pending:{color:"#93a1a1"}},Pe={added:"+",edited:"~",deleted:"✕",moved:"→"},E={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)"},He={working:"●",parked:"‖",asking:"?",review:"◑",done:"✓",error:"✕",idle:"·",starting:"◌",queued:"⋯","close-pending":"⊘",offline:"○",unknown:"⁇"},pe=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":pe.has(e==null?void 0:e.status)?"need":"run",fe=(e,n)=>{const a=n?(e||[]).find(t=>t.id===n):null;return a&&B(a)!=="offline"?a:null},X=e=>(e==null?void 0:e.sortKey)!=null?e.sortKey:(e==null?void 0:e.created)??0,ee=e=>{const n={need:0,run:1,offline:2};return[...e].sort((a,t)=>n[B(a)]-n[B(t)]||X(t)-X(a))},Te=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),me=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 Be(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 Re(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++,pe.has(r.status)?a=!0:E[r.status]===E.working&&(t=!0),i(r.id,o))};return i(e,new Set([e])),{color:a?E.asking:t?E.working:E.idle,count:l}}function ze(e,n){const{roots:a,childrenOf:t}=Be(e),l=[],i=(r,u,p,N)=>{const x=t.get(r.id)||[],k=x.length>0,y=k&&!!n(r.id),m=k?Re(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=ee(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 ee(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 Oe({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 Ke={video:"vid",image:"img",transcript:"txt",data:"data"},xe=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=xe(e);return n.length?["video","image","transcript","data"].filter(a=>n.some(t=>t.kind===a)):["note"]};function We(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 qe({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=>Ke[t]).filter(Boolean).join("·")}),s.jsx("span",{className:"ef-time",children:_e(e.ts)})]})}const _e=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 Rs({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(()=>We(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=>!!fe(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(Oe,{value:m,onChange:u,options:["video","image","all"].map(w=>({value:w,label:o(`evalsFeed.kind.${w}`)}))})]}),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(qe,{e:w,selected:a===A(w),onClick:()=>t(A(w),w)},A(w)))]})}const Ue={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 O({name:e,size:n=16,strokeWidth:a,className:t,style:l}){const i=Ue[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 zs({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(O,{name:e,size:l,className:i})})}const Os=()=>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"})}),Ks=()=>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 Ge({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 Ze({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 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=>{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 Je({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(Ge,{src:F(e),alt:n,onClose:()=>t(!1)})]})}function Qe({exit:e}){return s.jsx(O,{name:e?"minimize":"maximize",size:15})}function Ws({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(Qe,{exit:t})})}function ve({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(Ze,{hash:e.hash}):e.kind==="data"?s.jsx(Ye,{hash:e.hash}):e.kind==="video"?s.jsx("video",{className:"eval-video",src:F(e.hash),controls:!0,preload:"metadata",playsInline:!0}):s.jsx(Je,{hash:e.hash,alt:n})}const P=new Map;function Xe(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 ge({hash:e,alt:n=""}){const a=Xe(e);return a?s.jsx(ve,{e:{hash:e,...a},alt:n}):null}const qs=/\[\[(\.?[A-Za-z0-9_-]+)\]\]/g,je=e=>(e||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,"");function es(e,n,a){const t=n.toLowerCase(),l=[];for(const i of e){const c=i.id.toLowerCase(),o=je(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 ss(e,n){const a=n.toLowerCase(),t=o=>me(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 se(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 ns(e,n,a,t){let l=n-1;for(;l>=0&&/[A-Za-z0-9_.\-]/.test(e[l]);)l--;if(l>=1&&e[l-1]==="["&&e[l]==="["){const i=e.slice(l+1,n),c=es(a,i,t);return c.length?{kind:"mention",items:c,index:0,start:l-1,end:n,query:i}:null}return null}function ts(e,n,a){let t=n-1;for(;t>=0&&/[A-Za-z0-9_.\-]/.test(e[t]);)t--;if(t>=0&&e[t]==="@"&&(t===0||/\s/.test(e[t-1]))){const l=e.slice(t+1,n),i=ss(a,l);return i.length?{kind:"actor",items:i,index:0,start:t,end:n,query:l}:null}return null}function as({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:E[r.status]||E.offline}}),s.jsx("span",{className:"mention-id",children:c?s.jsxs(s.Fragment,{children:["@",se(r.label,e.query)]}):se(r.id,e.query)}),s.jsx("span",{className:"mention-path",children:c?r.sub:je(r.path)})]},r.id))]})}function ls({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=ns(h.value,g,t,i)||ts(h.value,g,l);if(u(w),!w||!o){N(null);return}const S=h.getBoundingClientRect(),M=($=h.closest(o))==null?void 0:$.getBoundingClientRect(),j=(M==null?void 0:M.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 M=e.current;M&&(M.focus(),M.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(as,{menu:r,up:c,fixedStyle:p,onPick:y,onHover:h=>u(g=>g&&{...g,index:h})}):null}}function is(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 rs=/^▶\s*(\d+):([0-5]?\d)(?:\s*·\s*([^\n]*))?/,cs=/\/api\/yatsu\/blob\/([0-9a-f]{64})/g,ne=/!\[[^\]]*\]\(\/api\/yatsu\/blob\/([0-9a-f]{64})\)/g,os=e=>{const n=Math.floor(e/1e3);return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`};function we(e){var i;const n=e||"",a=n.split(`
|
|
2
|
+
`,1)[0],t=rs.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 ye=(e,n)=>`▶${os(e)}${n?` · ${n}`:""}`,te=e=>[...(e||"").matchAll(cs)].map(n=>n[1]);function ds(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:ye(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 _s({originator:e,sessions:n=[],kind:a="issue",onOpenSession:t=null}){const l=b();if(!e)return null;const i=fe(n,e),c=!!i,o=c?E[i.status]||E.working:E.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 us({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 Se(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=we(y.body),d=ds(v,i),h=v?v.rest:y.body,g=[...h.matchAll(ne)].map(C=>C[1]),w=(g.length?h.replace(ne,""):h).trim(),S=y.rid!==void 0,M=S?y.resolved?" remark resolved":" remark open":"",j=`fv-reply${a===m?" sel":""}${t===m?" active":""}${M}`,$=d&&d.seekable&&n?()=>l?l(m,d.tMs):n(d.tMs):null,V=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")]})),V&&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",V),children:r("thread.retract")}):s.jsx("button",{type:"button",className:"fv-remark-act resolve",disabled:!!u,"data-tip":r("thread.resolveTitle"),onClick:()=>k("resolve",V),children:r("thread.resolve")}))]}),N&&N.ref===V&&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((C,D)=>s.jsx(ge,{hash:C,alt:"evidence"},`${C}-${D}`))})]},m)})}function Us({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=ls({inputRef:d,value:u,setValue:p,specs:n,sessions:a,focusId:t,up:!0}),g=te(u),w=m||!!u||g.length>0||!!k;f.useEffect(()=>{const j=d.current;if(!j)return;const $=getComputedStyle(j);is(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=()=>{var V;const j=i==null?void 0:i();if(!j)return;const $=ye(j.tMs,j.step);p(C=>{const D=we(C);return D?`${$}
|
|
3
|
+
${D.rest}`:C?`${$}
|
|
4
|
+
${C}`:`${$}
|
|
5
|
+
`}),(V=d.current)==null||V.focus()},M=async()=>{const j=u.trim();if(!(!j||N)){x(!0);try{const $=await e(j,te(j));$!=null&&$.ok?(p(""),y(""),await(l==null?void 0:l($.outcomes||""))):y(($==null?void 0:$.error)||"reply failed")}finally{x(!1)}}};return s.jsxs("div",{className:`fv-compose${w?" engaged":""}`,children:[g.length>0&&s.jsx("div",{className:"fv-frames",children:g.map(j=>s.jsx(ge,{hash:j,alt:"frame"},j))}),s.jsxs("div",{className:"fv-tawrap",children:[s.jsx("textarea",{ref:d,className:"fv-textarea",rows:1,value:u,placeholder:r("session.issuesReplyPlaceholder"),disabled:N,onChange:j=>{p(j.target.value),h.sync(j.target)},onSelect:j=>h.sync(j.target),onFocus:()=>v(!0),onBlur:()=>{v(!1),h.close()},onKeyDown:j=>{h.onKeyDown(j)||j.key==="Enter"&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),M())}}),h.menuEl]}),s.jsxs("div",{className:"fv-actions",children:[i&&s.jsxs("button",{type:"button",className:"fv-anchor-btn","data-tip":r("thread.anchorTitle"),onMouseDown:j=>j.preventDefault(),onClick:S,children:[s.jsx(O,{name:"clock",size:11})," ",r("thread.anchorNow")]}),s.jsx("span",{className:"fv-hint",children:k||r("session.issuesMentionHint")}),s.jsx("button",{type:"button",className:"fv-send",disabled:N||!u.trim(),onMouseDown:j=>j.preventDefault(),onClick:M,children:r(N?"session.issuesSending":"session.issuesSend")}),o]})]})}const hs=["graph","sessions","evals","issues","settings"];function G(e){const n=(e||"").replace(/^#\/?/,"").split("/").filter(Boolean),a=hs.includes(n[0])?n[0]:"graph",t=a==="sessions"?n[1]||null:a==="evals"?n.length>1?n.slice(1).map(decodeURIComponent).join("/"):null:a==="issues"&&n.length>1?n.slice(1).map(decodeURIComponent).join("/"):null;return{page:a,param:t}}const L=(e,n)=>`#/${e}${n?`/${String(n).split("/").map(encodeURIComponent).join("/")}`:""}`;function K(e,n=null,{replace:a=!1}={}){const t=L(e,n);window.location.hash!==t&&(a?window.history.replaceState(null,"",t):window.location.hash=t)}function Gs(){const[e,n]=f.useState(()=>G(window.location.hash));return f.useEffect(()=>{const a=()=>n(G(window.location.hash));return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]),e}const Zs=e=>({kind:"graph-node",nodeId:e}),Ys=e=>({kind:"session",sessionId:e}),ps=e=>({kind:"issue",issueId:e}),Js=(e,n)=>({kind:"eval",nodeId:e,scenario:n});function Ne(e){return!e||e.kind==="graph-node"?L("graph"):e.kind==="session"?L("sessions",e.sessionId):e.kind==="issue"?L("issues",e.issueId):e.kind==="eval"?L("evals",`${e.nodeId}/${e.scenario}`):L("graph")}function Qs(e,{onFocusNode:n,onOpenSession:a}={}){if(e)if(e.kind==="graph-node")n==null||n(e.nodeId),K("graph");else if(e.kind==="session")a?a(e.sessionId):K("sessions",e.sessionId);else{const{page:t,param:l}=G(Ne(e));K(t,l)}}function ae({issue:e,onNavigateAddress:n}){const a=(e==null?void 0:e.store)||"local",t=(e==null?void 0:e.status)||"open",l=ps(e.id);return s.jsxs("a",{className:"issue-card",href:Ne(l),"data-tip":e.concern||e.id,onClick:n?i=>{i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey||(i.preventDefault(),n(l))}:void 0,children:[s.jsxs("span",{className:"issue-card-top",children:[s.jsx("span",{className:"issue-num",children:e.id}),s.jsx("span",{className:`fv-store fv-store-${a==="local"?"local":"forge"}`,children:a}),s.jsx("span",{className:`issue-state st-${t}`,children:t})]}),s.jsx("span",{className:"issue-card-title",children:e.concern})]})}const le=[{key:"spec",label:"spec"},{key:"history",label:"history"},{key:"issues",label:"issues"},{key:"eval",label:"eval"}];function fs(e){var n;return(n=e==null?void 0:e.overlays)!=null&&n.length?[{key:"edit",label:"edit"},...le]:le}const ms={added:"+",edited:"~",deleted:"✕",moved:"→"};function I(e){const n=[],a=/`([^`]+)`|\*\*([^*]+)\*\*|\[\[([^\]]+)\]\]/g;let t=0,l,i=0;for(;l=a.exec(e);)l.index>t&&n.push(e.slice(t,l.index)),l[1]!=null?n.push(s.jsx("code",{children:l[1]},i++)):l[2]!=null?n.push(s.jsx("strong",{children:l[2]},i++)):n.push(s.jsx("span",{className:"doc-link",children:l[3]},i++)),t=a.lastIndex;return t<e.length&&n.push(e.slice(t)),n}function ie(e){const n=e.trim();return n.includes("|")&&/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/.test(n)}function W(e){let n=e.trim();return n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1)),n.split("|").map(a=>a.trim())}function xs(e){const n=e.startsWith(":"),a=e.endsWith(":");return n&&a?"center":a?"right":null}function R({body:e}){if(!e)return null;const n=e.replace(/^#\s+[^\n]*\n+/,"").split(`
|
|
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
|
+
`)})},l++))}else if(/^#{1,6}\s+/.test(n[t]))a.push(s.jsx("h4",{className:"doc-h",children:I(n[t].replace(/^#+\s+/,""))},l++)),t++;else if(i.includes("|")&&t+1<n.length&&ie(n[t+1])){const c=W(n[t]),o=W(n[t+1]).map(xs);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:I(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:I(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:I(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&&ie(n[t+1]))break;c.push(o),t++}a.push(s.jsx("p",{children:I(c.join(" "))},l++))}}return s.jsx("div",{className:"doc-body",children:a})}function re({kind:e,title:n,owner:a,ownerLabel:t,note:l,children:i}){return s.jsxs("section",{className:`spec-part part-${e}`,children:[s.jsxs("header",{className:"part-head",children:[s.jsx("span",{className:"part-title",children:n}),s.jsx("span",{className:`part-owner owner-${a}`,children:t}),l&&s.jsx("span",{className:"part-note",children:l})]}),s.jsx("div",{className:"part-body",children:i})]})}function vs({parts:e}){const n=b();return s.jsxs("div",{className:"spec-parts",children:[s.jsx(re,{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(re,{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 gs(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(z(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 js({node:e}){var l;const n=b(),a=gs(e.id,e.version),t=(e.driftFiles||[]).map(i=>`${i.file}: ${n("specNode.driftAhead",{n:i.behind})}`).join(`
|
|
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(vs,{parts:c}):s.jsx(R,{body:i})})()]})}function ws(e,n=!0){const[a,t]=f.useState(null);return f.useEffect(()=>{if(!n)return;let l=!0;return fetch(z(e,"history")).then(i=>i.json()).then(i=>{l&&t(i)}).catch(()=>l&&t([])),()=>{l=!1}},[e,n]),a}const _=new Map;function ys(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(z(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 Ns(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 be({diff:e}){const n=b();if(e==null)return s.jsx("figcaption",{className:"ev-note",children:n("nodeView.loadingChange")});const a=e.patch?Ns(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 ke({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 bs({node:e,r:n,latest:a}){const t=ys(e.id,n.hash,!0);return s.jsx(be,{diff:t})}function ks({node:e,rows:n}){const a=b();return n?n.length?s.jsx(ke,{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(bs,{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 $e({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 $s({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($e,{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(ae,{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(ae,{issue:u},u.id))]})]})}const U=new Map;function Ss(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 Ms({node:e,ov:n}){const a=b(),t=Ss(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:ms[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(be,{diff:t})]})}function Es({node:e}){const n=b(),a=e.overlays||[];return a.length?s.jsx("div",{className:"pane-edit",children:a.map((t,l)=>s.jsx(Ms,{node:e,ov:t},l))}):s.jsx("div",{className:"pane-edit empty",children:n("nodeView.noEdit")})}function Cs({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 Vs({r:e}){var t;const n=b(),a=xe(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(ve,{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 ce({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(De,{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 oe({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(us,{replies:e.remarks})})]})}const H=new Map;function Ls({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(z(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($e,{q:a,setQ:t,placeholder:n("nodeView.filterScenarios")},"filter"):null;return o.length?s.jsx(ke,{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(ce,{s:d},d.name))],trailing:N.map(d=>s.jsx(oe,{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(Cs,{verdict:d.verdict}),s.jsx(Y,{state:he(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(Vs,{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(ce,{s:d},d.name)),N.map(d=>s.jsx(oe,{track:d},d.threadId))]})}const Fs={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"};function Xs({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=fs(e),p=u.some(x=>x.key===n)?n:u[0].key,N=ws(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(Fs[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(js,{node:e})}),p==="history"&&s.jsx(ks,{node:e,rows:N}),p==="issues"&&s.jsx($s,{node:e}),p==="eval"&&s.jsx(Ls,{node:e}),p==="edit"&&s.jsx(Es,{node:e})]})]})})}const As=({size:e=12})=>s.jsx(O,{name:"lock",size:e});function Is(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])=>`${Pe[a]}${t}`).join(" ")}function Ds({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 Ps(){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 Hs({s:e,locked:n,showAvatar:a=!0,compact:t=!1,lead:l=null}){const i=b(),c=Is(e.ops),o=me(e),r=i(`status.${e.status}`);return s.jsxs(s.Fragment,{children:[l,a&&s.jsx(Ve,{seed:e.id,status:e.status,title:`${Te(e)} · ${r} — ${e.id.slice(0,8)}`}),s.jsxs("span",{className:"sess-meta",children:[t?s.jsx("span",{className:"sess-glyph",style:{color:E[e.status]},"data-tip":r,"aria-label":r,children:He[e.status]}):s.jsx("span",{className:"sess-status",style:{color:E[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(As,{})})]})}function en({sessions:e,activeId:n,onPick:a,onOpenSession:t}){const l=b(),{expanded:i,toggle:c}=Ps(),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(Ds,{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":Ee(u.id)},onClick:()=>a(u),onDoubleClick:()=>t(u.id),"data-tip":l("sessionWindow.rowTitle"),children:s.jsx(Hs,{s:u,locked:p,compact:!0,lead:N})},u.id)})})}export{Ws as $,Ve as A,qe as B,Ps as C,ze as D,Es as E,is as F,Pe as G,ks as H,ae as I,se as J,qs as K,As as L,as as M,Xs as N,Ks as O,je as P,ns as Q,Ds as R,Bs as S,De as T,ts as U,xe as V,ds as W,we as X,ye as Y,_s as Z,os as _,Ie as a,ve as a0,us as a1,Us as a2,We as a3,Rs as a4,fe as a5,Oe as a6,R as a7,ls as a8,He as b,E as c,Z as d,Ae as e,Js as f,zs as g,Zs as h,ps as i,Te as j,Ys as k,Ee as l,Y as m,O as n,K as o,Qs as p,fs as q,en as r,me as s,ws as t,Gs as u,js as v,$s as w,Hs as x,Os 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-BdRQfrkR.js";import{A as p,k as x,b as j,i as k,r as f,s as N}from"./Dashboard-Dlg78cbC.js";import"./SessionWindow-CmKtpNUX.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};
|