@raytrace-cli/cli 0.21.0 → 0.22.0

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.
@@ -33,5 +33,5 @@ Error generating stack: `+e.message+`
33
33
  `),children:[`+`,f.size-8]})]})]}),(0,G.jsx)(`td`,{className:`rt-pid`,children:e.pid}),(0,G.jsx)(`td`,{className:`exec-${a.tone}`,children:(0,G.jsx)(gC,{outcome:a})}),(0,G.jsx)(`td`,{className:`rt-time`,children:Number.isFinite(o)&&Number.isFinite(s)?lC(s-o):`—`}),(0,G.jsx)(`td`,{children:t===0?(0,G.jsx)(iC,{severity:e.severity,flags:u?g[u]?.flags:void 0}):null}),(0,G.jsx)(`td`,{children:t>0?null:u?(0,G.jsxs)(`button`,{type:`button`,className:`link-button`,onClick:e=>{e.stopPropagation(),n(u)},children:[`#`,y.get(u)??`?`]}):d?(0,G.jsxs)(`span`,{className:`rt-muted`,children:[`under #`,y.get(d)??`?`]}):(0,G.jsx)(`span`,{className:`rt-muted`,title:`This process ran, but matched no proposed tool call.`,children:`no tool call`})})]}),i&&r.map(e=>P(e,t+1))]},e.event_id)}return(0,G.jsxs)(`section`,{className:`rt-view`,children:[(0,G.jsxs)(`header`,{className:`rt-view-head`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`eyebrow`,children:`SANDBOX EVIDENCE`}),(0,G.jsx)(`h1`,{children:`What actually ran`})]}),(0,G.jsx)(`div`,{className:`rt-actions`,children:(0,G.jsxs)(`button`,{type:`button`,className:`rt-button`,onClick:()=>n(),children:[(0,G.jsx)(N,{size:14}),` Tool calls`]})})]}),e.sandboxId?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`rt-stats`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Commands`}),(0,G.jsx)(`dd`,{children:a?C.length:`—`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Succeeded`}),(0,G.jsx)(`dd`,{className:`exec-ok`,children:a?w.filter(e=>e.tone===`ok`).length:`—`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Failed`}),(0,G.jsx)(`dd`,{className:`exec-fail`,children:a?w.filter(e=>e.tone===`fail`).length:`—`})]}),(0,G.jsxs)(`div`,{title:[...m].join(`
34
34
  `)||void 0,children:[(0,G.jsx)(`dt`,{children:`Reached on the network`}),(0,G.jsx)(`dd`,{children:d?m.size:`—`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Severity`}),(0,G.jsx)(`dd`,{className:`rt-sev-counts`,children:[`none`,`low`,`high`,`severe`].map((e,t)=>(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":E===t,className:`severity-badge severity-${t}${E===t?` rt-sev-on`:``}${E!=null&&E!==t?` rt-sev-off`:``}`,title:E===t?`Show every severity`:`Show only ${e} commands`,onClick:()=>D(e=>e===t?null:t),children:[T[t],` `,e]},e))})]})]}),o&&(0,G.jsx)(`p`,{role:`alert`,className:`verify-error`,children:o}),!a&&!o&&(0,G.jsx)(rp,{label:`Loading sandbox evidence…`}),a&&!s&&(0,G.jsxs)(G.Fragment,{children:[E!=null&&(0,G.jsxs)(`p`,{className:`rt-foot rt-filter-note`,children:[`Showing `,O.length,` of `,C.length,` commands with `,[`none`,`low`,`high`,`severe`][E],` severity.`,` `,(0,G.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>D(null),children:`Show all`})]}),C.length?O.length?(0,G.jsx)(`div`,{className:`rt-table-wrap`,children:(0,G.jsxs)(`table`,{className:`rt-table rt-sandbox`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Started`}),(0,G.jsx)(`th`,{children:`Command`}),(0,G.jsx)(`th`,{children:`pid`}),(0,G.jsx)(`th`,{children:`Result`}),(0,G.jsx)(`th`,{children:`Took`}),(0,G.jsx)(`th`,{children:`Severity`}),(0,G.jsx)(`th`,{children:`Tool call`})]})}),(0,G.jsx)(`tbody`,{children:O.map(e=>P(e,0))})]})}):(0,G.jsx)(`p`,{className:`rt-empty`,children:`No commands with this severity.`}):(0,G.jsx)(`p`,{className:`rt-empty`,children:`No commands were captured in the sandbox during this prompt. Missing evidence is not proof of non-execution.`}),(0,G.jsxs)(`p`,{className:`rt-foot`,children:[`Seen by the sandbox kernel layer, independent of what the agent reported. Collector gaps: `,a.gaps,`.`,` `,a.folded&&aC(a.folded)?`Folded, not shown as commands: ${aC(a.folded)}. `:``,(0,G.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>c(!0),children:`Show every raw event`})]})]}),a&&s&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`rt-foot`,children:(0,G.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>c(!1),children:`Back to commands`})}),(0,G.jsx)(`ul`,{className:`evidence-raw`,children:(a.events??[]).map(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`code`,{children:e.kind===`exec_succeeded`?(e.argv??[]).join(` `):`${e.kind} exit=${e.exit_code??`unknown`}`}),(0,G.jsxs)(`small`,{children:[` pid `,e.pid,` · #`,e.event_id]})]},e.event_id))})]})]}):(0,G.jsx)(`p`,{className:`rt-empty`,children:`This prompt did not run in a sandbox, so there is no independent evidence of what ran.`})]})}var yB=1048576,bB={file:25*yB,total:200*yB,files:2e4,archive:100*yB},xB=new Set([`.git`,`.raytace`,`.raytrace`,`.ssh`,`.aws`,`.azure`,`.config`,`.claude`,`node_modules`,`.venv`,`__pycache__`,`.next`,`.vinext`,`dist`,`coverage`,`.wrangler`,`.DS_Store`]),SB=new Set([`.npmrc`,`.netrc`,`.pypirc`,`.htpasswd`,`.dockercfg`,`credentials`,`credentials.json`,`credentials.ini`,`auth.json`,`service-account.json`,`service_account.json`,`serviceAccountKey.json`,`client_secret.json`,`client_secrets.json`,`token.json`,`id_rsa`,`id_dsa`,`id_ecdsa`,`id_ed25519`,`id_ecdsa_sk`,`id_ed25519_sk`,`known_hosts`]),CB=/\.(pem|key|p12|pfx)$/i,wB=e=>{let t=e.toLowerCase();return t.startsWith(`.env`)||t.startsWith(`.secret`)||CB.test(e)||SB.has(t)};function TB(e,t){let n=[];for(let r of e.split(/\r?\n/)){let e=r.replace(/(?<!\\)\s+$/,``);if(!e||e.startsWith(`#`))continue;let i=e.startsWith(`!`);i&&(e=e.slice(1)),e.startsWith(`\\`)&&(e=e.slice(1));let a=e.endsWith(`/`);if(a&&(e=e.slice(0,-1)),!e)continue;let o=e.includes(`/`);e.startsWith(`/`)&&(e=e.slice(1));let s=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===`*`&&e[t+1]===`*`)e[t+2]===`/`?(s+=`(?:.*/)?`,t+=2):(s+=`.*`,t+=1);else if(n===`*`)s+=`[^/]*`;else if(n===`?`)s+=`[^/]`;else if(n===`[`){let n=e.indexOf(`]`,t+2);n<0?s+=`\\[`:(s+=`[${e.slice(t+1,n).replace(/^!/,`^`).replace(/\\/g,`\\\\`)}]`,t=n)}else s+=n.replace(/[.+^${}()|\\\]]/g,`\\$&`)}try{n.push({base:t,negate:i,dirOnly:a,match:RegExp(`^${o?``:`(?:.*/)?`}${s}$`)})}catch{}}return n}function EB(e,t,n){let r=!1;for(let i of e)(!i.dirOnly||n)&&(!i.base||t.startsWith(`${i.base}/`))&&i.match.test(i.base?t.slice(i.base.length+1):t)&&(r=!i.negate);return r}function DB(e,t){let n=t.split(`/`);for(let t=1;t<n.length;t++)if(EB(e,n.slice(0,t).join(`/`),!0))return!0;return EB(e,t,!1)}function OB(e,t,n,r){let i=[],a=0,o=[];for(let e of t.sort((e,t)=>e.path.localeCompare(t.path))){if(e.file.size>bB.file){o.push(`${e.path} (${(e.file.size/yB).toFixed(0)} MiB)`);continue}i.push(e),a+=e.file.size}return o.length&&r.push(`${o.length} file${o.length===1?` is`:`s are`} over ${bB.file/yB} MiB: ${o.slice(0,5).join(`, `)}${o.length>5?`, …`:``}. Add ${o.length===1?`it`:`them`} to .gitignore, or remove ${o.length===1?`it`:`them`}.`),i.length>bB.files&&r.push(`${i.length.toLocaleString()} files; a project may have at most ${bB.files.toLocaleString()}.`),a>bB.total&&r.push(`${(a/yB).toFixed(0)} MiB in all; a project may be at most ${bB.total/yB} MiB.`),!i.length&&!r.length&&r.push(`No files to upload in this folder.`),{name:e,files:i,total:a,skipped:n,problems:r}}var kB=e=>new Promise((t,n)=>{let r=e.createReader(),i=[],a=()=>r.readEntries(e=>{e.length?(i.push(...e),a()):t(i)},n);a()}),AB=e=>new Promise((t,n)=>e.file(t,n));function jB(e){return[...e.items].map(e=>e.webkitGetAsEntry?.()??null).filter(e=>e!==null)}async function MB(e){let t={ignored:0,excluded:0,secret:[]};if(e.length!==1||!e[0].isDirectory)return{name:``,files:[],total:0,skipped:t,problems:[`Drop one project folder (not files, and not several folders).`]};let n=e[0],r=[],i=[],a=async(e,n,i)=>{let o=await kB(e),s=o.find(e=>e.isFile&&e.name===`.gitignore`),c=s?[...i,...TB(await(await AB(s)).text(),n)]:i;for(let e of o){let i=n?`${n}/${e.name}`:e.name;if(xB.has(e.name)){t.excluded+=1;continue}if(EB(c,i,e.isDirectory)){t.ignored+=1;continue}if(e.isDirectory){await a(e,i,c);continue}if(wB(e.name)){t.secret.push(i);continue}r.length>bB.files*2||r.push({path:i,file:await AB(e)})}};try{await a(n,``,[])}catch{i.push(`Some of this folder could not be read.`)}return OB(n.name,r,t,i)}async function NB(e){let t={ignored:0,excluded:0,secret:[]},n=[...e].map(e=>{let[,...t]=(e.webkitRelativePath||e.name).split(`/`);return{path:t.join(`/`)||e.name,file:e}}),r=(e[0]?.webkitRelativePath||``).split(`/`)[0]||`project`,i=new Set,a=n.filter(e=>{let t=e.path.split(`/`),n=t.findIndex(e=>xB.has(e));return n<0||(i.add(t.slice(0,n+1).join(`/`)),!1)});t.excluded=i.size;let o=a.filter(e=>e.path.split(`/`).pop()===`.gitignore`).sort((e,t)=>e.path.split(`/`).length-t.path.split(`/`).length),s=[];for(let e of o)s.push(...TB(await e.file.text(),e.path.split(`/`).slice(0,-1).join(`/`)));let c=[];for(let e of a){if(DB(s,e.path)){t.ignored+=1;continue}if(wB(e.path.split(`/`).pop())){t.secret.push(e.path);continue}c.push(e)}return OB(r,c,t,[])}var PB=new TextEncoder;function FB(e,t,n,r,i){let a=new Uint8Array(512),o=(e,t)=>a.set(typeof e==`string`?PB.encode(e):e,t),s=(e,t)=>e.toString(8).padStart(t-1,`0`)+`\0`;o(e,0),o(s(420,8),100),o(s(1e3,8),108),o(s(1e3,8),116),o(s(n,12),124),o(s(Math.max(0,Math.floor(r)),12),136),o(` `,148),o(i,156),o(`ustar\x0000`,257),o(`node`,265),o(`node`,297),o(t,345);let c=0;for(let e of a)c+=e;return o(c.toString(8).padStart(6,`0`)+`\0 `,148),a}function IB(e,t,n){let r=PB.encode(e),i=r.length===e.length;if(i&&r.length<=100)return[FB(r,new Uint8Array,t,n,`0`)];if(i){for(let i=e.lastIndexOf(`/`);i>0;i=e.lastIndexOf(`/`,i-1))if(i<=155&&r.length-i-1<=100)return[FB(r.slice(i+1),r.slice(0,i),t,n,`0`)]}let a=` path=${e}\n`,o=PB.encode(a).length,s=o+String(o).length;String(s).length!==String(o).length&&(s=o+String(s).length);let c=PB.encode(`${s}${a}`),l=new Uint8Array(Math.ceil(c.length/512)*512);l.set(c);let u=PB.encode(e.replace(/[^\x20-\x7e]/g,`_`).slice(-100));return[FB(PB.encode(`PaxHeader`),new Uint8Array,c.length,n,`x`),l,FB(u,new Uint8Array,t,n,`0`)]}async function LB(e){let t=[];for(let{path:n,file:r}of e){t.push(...IB(n,r.size,r.lastModified/1e3),r);let e=r.size%512;e&&t.push(new Uint8Array(512-e))}t.push(new Uint8Array(1024));let n=await new Response(new Blob(t).stream().pipeThrough(new CompressionStream(`gzip`))).blob();if(n.size>bB.archive)throw Error(`The packed project is ${(n.size/yB).toFixed(0)} MiB; the most allowed is ${bB.archive/yB} MiB.`);return n}var RB=1048576,zB=e=>e<RB?`${Math.max(1,Math.round(e/1024))} KiB`:`${(e/RB).toFixed(1)} MiB`,BB=e=>e.replace(/[^A-Za-z0-9._ -]/g,`-`).slice(0,100),VB=(e,t,n=`${t}s`)=>`${e.toLocaleString()} ${e===1?t:n}`;function HB({onCreated:e}){let[t,n]=(0,_.useState)({at:`idle`}),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),c=async e=>{n({at:`reading`});try{let t=await e;i(BB(t.name)),n({at:`preview`,project:t})}catch{n({at:`failed`,message:`That folder could not be read.`})}},l=e=>{e.preventDefault(),o(!1),c(MB(jB(e.dataTransfer)))},u=async t=>{let i=x().createSandbox;if(i)try{n({at:`working`,step:`Packing ${VB(t.files.length,`file`)}…`});let a=await LB(t.files);n({at:`working`,step:`Uploading ${zB(a.size)} and starting the sandbox. This can take a minute…`});let o=await i(r.trim(),a),s=await o.json().catch(()=>({}));if(!o.ok||!s.id)throw Error(s.error||`The sandbox could not be created (HTTP ${o.status}).`);n({at:`idle`}),e(s.id)}catch(e){n({at:`failed`,project:t,message:e instanceof Error&&e.message!==`Failed to fetch`?e.message:`RayTrace could not be reached. Check your connection and try again.`})}},d=t.at===`preview`||t.at===`failed`?t.project:void 0,f=/^[A-Za-z0-9._ -]{1,100}$/.test(r.trim());return(0,G.jsxs)(`div`,{className:`rt-new-sandbox`,children:[(t.at===`idle`||t.at===`reading`||t.at===`failed`&&!d)&&(0,G.jsxs)(`div`,{className:a?`rt-drop over`:`rt-drop`,onDragOver:e=>{e.preventDefault(),o(!0)},onDragLeave:()=>o(!1),onDrop:l,children:[(0,G.jsx)(ne,{size:20}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:t.at===`reading`?`Reading the folder…`:`New sandbox: drop a project folder here`}),(0,G.jsxs)(`small`,{children:[`You will see what would be uploaded first. `,(0,G.jsx)(`code`,{children:`.env`}),` files, keys, `,(0,G.jsx)(`code`,{children:`node_modules`}),` and anything your `,(0,G.jsx)(`code`,{children:`.gitignore`}),` excludes stay on this machine. Up to `,bB.total/RB,` MiB, `,bB.file/RB,` MiB a file.`]}),t.at===`failed`&&(0,G.jsx)(`p`,{className:`rt-problem`,children:t.message})]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-button`,disabled:t.at===`reading`,onClick:()=>s.current?.click(),children:`Choose folder`}),(0,G.jsx)(`input`,{ref:s,type:`file`,hidden:!0,multiple:!0,webkitdirectory:``,onChange:e=>{let t=e.target.files;t?.length&&c(NB(t)),e.target.value=``}})]}),d&&(0,G.jsxs)(`div`,{className:`rt-upload-preview`,children:[(0,G.jsxs)(`div`,{className:`rt-upload-head`,children:[(0,G.jsxs)(`label`,{children:[`Sandbox name`,(0,G.jsx)(`input`,{value:r,maxLength:100,onChange:e=>i(e.target.value)})]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-icon-button`,"aria-label":`Cancel`,onClick:()=>n({at:`idle`}),children:(0,G.jsx)(Me,{size:15})})]}),(0,G.jsxs)(`dl`,{className:`rt-facts`,children:[(0,G.jsx)(`dt`,{children:`Will upload`}),(0,G.jsxs)(`dd`,{children:[VB(d.files.length,`file`),` · `,zB(d.total)]}),(0,G.jsx)(`dt`,{children:`Stays here`}),(0,G.jsxs)(`dd`,{children:[!d.skipped.ignored&&!d.skipped.excluded&&!d.skipped.secret.length&&`Nothing was left out.`,d.skipped.ignored>0&&(0,G.jsxs)(`span`,{children:[VB(d.skipped.ignored,`path`),` ignored by .gitignore. `]}),d.skipped.excluded>0&&(0,G.jsxs)(`span`,{children:[VB(d.skipped.excluded,`dependency or build folder`),` (node_modules, .git, dist…). `]}),d.skipped.secret.length>0&&(0,G.jsxs)(`span`,{children:[VB(d.skipped.secret.length,`credential file`),`: `,(0,G.jsxs)(`code`,{children:[d.skipped.secret.slice(0,6).join(`, `),d.skipped.secret.length>6?`, …`:``]})]})]}),(0,G.jsx)(`dt`,{children:`Files`}),(0,G.jsx)(`dd`,{className:`rt-upload-files`,children:(0,G.jsxs)(`code`,{children:[d.files.slice(0,12).map(e=>e.path).join(`
35
35
  `),d.files.length>12?`\n… and ${(d.files.length-12).toLocaleString()} more`:``]})})]}),d.problems.map(e=>(0,G.jsx)(`p`,{className:`rt-problem`,children:e},e)),t.at===`failed`&&(0,G.jsx)(`p`,{className:`rt-problem`,children:t.message}),(0,G.jsxs)(`div`,{className:`rt-actions`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`rt-button primary`,disabled:d.problems.length>0||!f,onClick:()=>void u(d),children:[(0,G.jsx)(Ee,{size:13}),` Create sandbox`]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-button`,onClick:()=>n({at:`idle`}),children:`Cancel`}),!f&&(0,G.jsx)(`small`,{className:`rt-muted`,children:`Name: letters, digits, spaces, and . _ - only.`})]})]}),t.at===`working`&&(0,G.jsx)(rp,{label:t.step})]})}var UB=e=>e.split(`
36
- `).find(e=>e.trim())?.trim()??`(empty prompt)`,WB=e=>new Date(typeof e==`number`?e*1e3:e).toLocaleString(void 0,{day:`numeric`,month:`short`,hour:`numeric`,minute:`2-digit`}),GB=e=>e==null?`—`:`${(e/1048576).toFixed(e<1048576?2:1)} MiB`;function KB(e){return e===`lima`?{title:`Local VM`,detail:`Lima on this machine`}:{title:`Cloud VM ${e.split(`@`).pop()}`,detail:e}}function qB(e){return e.status===`deleted`?{label:`Destroyed`,tone:`deleted`}:e.on_host?e.status===`running`?{label:`Running`,tone:`running`}:e.status===`import_failed`?{label:`Failed to create`,tone:`deleted`}:{label:`Stopped`,tone:`stopped`}:{label:`Not connected`,tone:`unknown`}}function JB({traces:e,selectedId:t,onSelect:n,onOpenTrace:r,onOpenScan:i}){let[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(0),h=!!x().createSandbox;(0,_.useEffect)(()=>{let e=!1,t,n=async()=>{try{let t=await x().fetch(`/raytace/sandboxes`,{cache:`no-store`}),n=await t.json();if(!t.ok)throw Error(n.error||`Sandbox list unavailable`);e||(o(n.sandboxes??[]),c(null))}catch(t){e||c(t instanceof Error?t.message:`Proxy unavailable`)}e||(t=setTimeout(n,1e4))};return n(),()=>{e=!0,clearTimeout(t)}},[p]);let g=new Map;for(let t of e)t.sandboxId&&!t.forkId&&g.set(t.sandboxId,[...g.get(t.sandboxId)??[],t]);let v=[...new Set((a??[]).map(e=>e.host))].sort((e,t)=>{let n=e=>+!(a??[]).some(t=>t.host===e&&t.on_host);return n(e)-n(t)||e.localeCompare(t)}),y=e=>typeof e.created==`number`?e.created*1e3:Date.parse(e.created),[b,S]=(0,_.useState)(null),C=async e=>{u(e.id),f(``);try{let t=await x().fetch(`/raytace/sandboxes/${e.id}`,{method:`DELETE`,headers:{"x-raytace-experiment":`1`}}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||`Destroy failed`);n(``),m(e=>e+1)}catch(e){f(e instanceof Error?e.message:`Destroy failed`)}finally{u(``),S(null)}};return(0,G.jsxs)(`section`,{className:`rt-view`,children:[(0,G.jsx)(`header`,{className:`rt-view-head`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`eyebrow`,children:`SANDBOXES`}),(0,G.jsx)(`h1`,{children:`Where your agents ran`})]})}),h&&(0,G.jsx)(HB,{onCreated:e=>{m(e=>e+1),(i??n)(e)}}),s&&(0,G.jsx)(`p`,{className:`rt-empty`,children:s}),d&&(0,G.jsx)(`p`,{className:`rt-empty`,children:d}),!s&&a===null&&(0,G.jsx)(rp,{label:`Loading your sandboxes…`}),!s&&a?.length===0&&(0,G.jsxs)(`p`,{className:`rt-empty`,children:[`No sandboxes yet. `,h?`Drop a project folder above, or from`:`From`,` a Git repository: `,(0,G.jsx)(`code`,{children:`raytrace sandbox create`})]}),v.map(e=>{let o=KB(e),s=(a??[]).filter(t=>t.host===e).sort((e,t)=>Number(e.status===`deleted`)-Number(t.status===`deleted`)||y(t)-y(e)),c=s.some(e=>e.on_host);return(0,G.jsxs)(`div`,{className:`rt-host`,children:[(0,G.jsxs)(`div`,{className:`rt-list-head`,children:[(0,G.jsxs)(`span`,{className:`rt-host-title`,children:[(0,G.jsx)(be,{size:13}),` `,o.title.toUpperCase()]}),(0,G.jsxs)(`small`,{children:[o.detail,` · `,c?`connected`:`not connected now`,` · `,s.length,` sandbox`,s.length===1?``:`es`]})]}),(0,G.jsx)(`ol`,{className:`rt-prompts`,children:s.map(e=>{let a=e.id===t,s=(g.get(e.id)??[]).sort((e,t)=>t.startedAt.localeCompare(e.startedAt)),c=qB(e),u=`raytrace connect ${e.host===`lima`&&e.name?e.name:e.id}`;return(0,G.jsxs)(`li`,{className:a?`rt-prompt open`:`rt-prompt`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`rt-prompt-row`,"aria-expanded":a,onClick:()=>n(a?``:e.id),children:[(0,G.jsx)(`time`,{children:WB(e.created)}),(0,G.jsxs)(`strong`,{children:[(0,G.jsx)(`span`,{className:`rt-state s-${c.tone}`,children:c.label}),e.name]}),(0,G.jsxs)(`small`,{children:[s.length,` prompt`,s.length===1?``:`s`,` · `,e.id.slice(0,12),`…`]})]}),a&&(0,G.jsxs)(`div`,{className:`rt-prompt-detail`,children:[(0,G.jsxs)(`dl`,{className:`rt-facts`,children:[(0,G.jsx)(`dt`,{children:`Sandbox`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(`code`,{children:e.id})}),(0,G.jsx)(`dt`,{children:`Runs on`}),(0,G.jsxs)(`dd`,{children:[o.title,` `,(0,G.jsxs)(`span`,{className:`rt-muted`,children:[`(`,o.detail,`)`]})]}),(0,G.jsx)(`dt`,{children:`State`}),(0,G.jsxs)(`dd`,{children:[c.label,!e.on_host&&e.status!==`deleted`?(0,G.jsxs)(`span`,{className:`rt-muted`,children:[` — the manager is connected to another VM; last recorded: `,e.status]}):null]}),(0,G.jsx)(`dt`,{children:`Created`}),(0,G.jsxs)(`dd`,{children:[WB(e.created),e.deleted?(0,G.jsxs)(`span`,{className:`rt-muted`,children:[` · destroyed `,WB(e.deleted)]}):null]}),e.host!==`lima`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{children:`Uploaded`}),(0,G.jsxs)(`dd`,{children:[GB(e.imported_bytes),e.skipped_count?(0,G.jsxs)(`span`,{className:`rt-muted`,children:[` · `,e.skipped_count,` file`,e.skipped_count===1?``:`s`,` left out`]}):null]})]}),(0,G.jsx)(`dt`,{children:`Recording`}),(0,G.jsx)(`dd`,{children:e.transcripts===!1?`Commands only (no Claude Code transcripts)`:`Commands and Claude Code transcripts`}),i&&e.scan?.by_level&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{children:`Initial scan`}),(0,G.jsxs)(`dd`,{children:[e.scan.files,` files, `,(e.scan.by_level[4]??0)+(e.scan.by_level[5]??0),` at level 4 or 5`,` `,(0,G.jsxs)(`button`,{type:`button`,className:`link-button`,onClick:()=>i(e.id),children:[(0,G.jsx)(_e,{size:11}),` Open the scan`]})]})]})]}),e.status!==`deleted`&&e.on_host&&(0,G.jsxs)(`div`,{className:`rt-shell-line`,children:[(0,G.jsx)(`code`,{children:u}),(0,G.jsx)(Nz,{text:u})]}),e.host===`lima`&&(0,G.jsxs)(`div`,{className:`rt-shell-line`,children:[(0,G.jsxs)(`code`,{children:[`raytrace sandbox destroy `,e.name||e.id]}),(0,G.jsx)(Nz,{text:`raytrace sandbox destroy ${e.name||e.id}`})]}),e.host===`lima`&&(0,G.jsxs)(`p`,{className:`rt-foot`,children:[`Run the first command in a terminal to open this sandbox, then start `,(0,G.jsx)(`code`,{children:`claude`}),` or `,(0,G.jsx)(`code`,{children:`codex`}),` there. The second deletes it, and asks whether to delete the logs recorded in it too.`]}),e.host!==`lima`&&e.status!==`deleted`&&e.on_host&&(0,G.jsxs)(`div`,{className:`rt-shell-line`,children:[(0,G.jsx)(`code`,{children:`Destroy this sandbox and stop anything running in it. Its recorded evidence stays.`}),(0,G.jsx)(oz,{disabled:l===e.id,onClick:()=>S(e),children:l===e.id?`Destroying…`:`Destroy`})]}),e.host!==`lima`&&e.status!==`deleted`&&e.on_host&&(0,G.jsxs)(`p`,{className:`rt-foot`,children:[`Run it in a terminal to open this sandbox, then start `,(0,G.jsx)(`code`,{children:`claude`}),` or `,(0,G.jsx)(`code`,{children:`codex`}),` there. Needs the RayTrace CLI, signed in as this account: `,(0,G.jsx)(`code`,{children:`npm install -g @raytrace-cli/cli@latest`}),`. On CLI 0.2 the command is `,(0,G.jsxs)(`code`,{children:[`raytrace sandbox shell `,e.id]}),`.`]}),(0,G.jsx)(`h3`,{children:`History`}),!s.length&&(0,G.jsx)(`p`,{className:`rt-muted`,children:`No prompts recorded in this sandbox yet.`}),s.length>0&&(0,G.jsx)(`ol`,{className:`rt-history`,children:s.map(e=>{let t=e.callVerifications??[],n=t.filter(e=>e.exec_id||(e.kind?e.kind===`command`:e.proposed!=null)),i=n.filter(e=>e.exec_id).length,a=t.filter(e=>e.kind===`file`&&!e.exec_id).length;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),children:[(0,G.jsx)(`time`,{dateTime:e.startedAt,children:WB(e.startedAt)}),(0,G.jsx)(`span`,{children:UB(e.title)}),(0,G.jsxs)(`small`,{className:n.length&&i===n.length?`all`:``,children:[n.length?`${i} of ${n.length} command${n.length===1?``:`s`} observed in the sandbox`:`no commands`,a>0&&` · ${a} file operation${a===1?``:`s`}`]}),(0,G.jsx)(P,{size:13})]})},e.id)})})]})]},e.id)})})]},e)}),b&&(0,G.jsxs)(`dialog`,{open:!0,className:`rt-dialog`,"aria-labelledby":`rt-destroy-title`,onCancel:e=>{e.preventDefault(),l||S(null)},children:[(0,G.jsx)(`h2`,{id:`rt-destroy-title`,children:`Destroy this sandbox?`}),(0,G.jsxs)(`p`,{children:[`“`,b.name||b.id,`” stops and is deleted. Its recorded evidence stays.`]}),(0,G.jsxs)(`div`,{className:`rt-dialog-actions`,children:[(0,G.jsx)(`button`,{type:`button`,className:`rt-button`,autoFocus:!0,disabled:!!l,onClick:()=>S(null),children:`No`}),(0,G.jsx)(oz,{className:`rt-danger`,disabled:!!l,onClick:()=>void C(b),children:l?`Destroying…`:`Yes, destroy`})]})]})]})}var YB=2e4,XB=`https://github.com/Godcreatebugs/raytrace-cli`,ZB=`https://raytracer.si`;async function QB(e,t=`dashboard`){try{await x().fetch(`/raytace/star-prompt`,{method:`POST`,headers:{"content-type":`application/json`,"x-raytace-experiment":`1`},body:JSON.stringify({action:e,source:t})})}catch{}}function $B({promptCount:e,connected:t,suppressed:n=!1}){let r=Bf(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(`hidden`);(0,_.useEffect)(()=>{if(n||!t||o||e<3)return;let r=!1;return x().fetch(`/raytace/star-prompt`,{cache:`no-store`}).then(e=>e.ok?e.json():null).then(e=>{r||(s(!0),e?.eligible&&a(e))}).catch(()=>{r||s(!0)}),()=>{r=!0}},[n,t,o,e]),(0,_.useEffect)(()=>{if(!i?.eligible||n){n&&l(e=>e===`ask`?`hidden`:e);return}let e=setTimeout(()=>l(e=>e===`hidden`?`ask`:e),YB);return()=>clearTimeout(e)},[i,n]);let u=i?.url||XB,d=i?.website_url||ZB,f=Math.max(i?.prompts??0,e);function p(e){l(`hidden`),QB(e,`dashboard`)}function m(){QB(`opened`,`dashboard`),l(`thanks`)}return(0,G.jsx)(Ed,{children:c!==`hidden`&&(0,G.jsxs)(Vf.aside,{className:`rt-star-popup`,role:`region`,"aria-label":c===`ask`?`Star RayTrace on GitHub`:`Explore RayTrace`,initial:r?{opacity:0}:{opacity:0,y:14,scale:.98},animate:{opacity:1,y:0,scale:1},exit:r?{opacity:0}:{opacity:0,y:10,scale:.98},transition:{duration:r?.1:.22,ease:`easeOut`},children:[(0,G.jsxs)(`div`,{className:`rt-star-popup-head`,children:[(0,G.jsxs)(`span`,{className:`rt-star-popup-eyebrow`,children:[(0,G.jsx)(Ce,{size:13,fill:`currentColor`,"aria-hidden":`true`}),c===`ask`?`ENJOYING RAYTRACE?`:`THANKS FOR SUPPORTING RAYTRACE`]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-star-popup-close`,"aria-label":`Dismiss`,onClick:()=>c===`ask`?p(`dismissed`):l(`hidden`),children:(0,G.jsx)(Me,{size:14})})]}),c===`ask`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`rt-star-popup-copy`,children:[`You've recorded `,(0,G.jsx)(`strong`,{children:f}),` prompts locally. A GitHub star helps other developers discover RayTrace.`]}),(0,G.jsxs)(`div`,{className:`rt-star-popup-actions`,children:[(0,G.jsxs)(`a`,{className:`rt-button primary rt-star-popup-cta`,href:u,target:`_blank`,rel:`noopener noreferrer`,onClick:m,children:[(0,G.jsx)(Ce,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`span`,{children:`Star on GitHub`})]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-star-popup-secondary`,onClick:()=>p(`already_starred`),children:`Already starred`})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`rt-star-popup-copy`,children:`Want cloud sandboxes, shareable trace links, or product updates?`}),(0,G.jsxs)(`div`,{className:`rt-star-popup-actions`,children:[(0,G.jsxs)(`a`,{className:`rt-button primary rt-star-popup-cta`,href:d,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>l(`hidden`),children:[(0,G.jsx)(`span`,{children:`Visit raytracer.si`}),(0,G.jsx)(ee,{size:13,"aria-hidden":`true`})]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-star-popup-secondary`,onClick:()=>l(`hidden`),children:`Close`})]})]})]},c)})}var eV=[`prompts`,`search`,`story`,`sandboxes`,`scan`,`calls`,`changes`,`sandbox`,`context`,`thought`,`playground`];function tV(e){let t=new URLSearchParams(typeof window>`u`?``:window.location.search),n=t.get(`view`),r=n===`lab`?`context`:n;return{view:r&&e.includes(r)?r:`prompts`,trace:t.get(`trace`)??``,call:t.get(`call`),step:t.get(`step`),box:t.get(`box`)??``,q:t.get(`q`)??``}}function nV(e){let t=new URLSearchParams;e.view!==`prompts`&&t.set(`view`,e.view),e.trace&&t.set(`trace`,e.trace),e.call&&t.set(`call`,e.call),e.step&&t.set(`step`,e.step),e.box&&t.set(`box`,e.box),e.view===`search`&&e.q&&t.set(`q`,e.q);let n=t.toString();window.history.pushState(null,``,n?`?${n}`:window.location.pathname)}var rV=e=>e.split(`
37
- `).find(e=>e.trim())?.trim()??``,iV=e=>`${e.exchange_id}:${e.output_index}`;function aV({views:e=eV,offline:t=`PROXY OFFLINE`,footer:n=null}){let r=t=>e.includes(t),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)({view:`prompts`,trace:``,call:null,step:null,box:``,q:``}),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null);(0,_.useEffect)(()=>{d(tV(e));let t=()=>d(tV(e));return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let v=(0,_.useCallback)(e=>{d(t=>{let n={...t,call:null,step:null,box:``,q:``,...e};return nV(n),n})},[]);(0,_.useEffect)(()=>{let e=!1,t,n=``,r=async()=>{try{let t=await x().fetch(`/raytace/traces?scope=history`,{cache:`no-store`,headers:n?{"if-none-match":n}:{}});if(t.status===304)e||s(!0);else{if(!t.ok)throw Error(`Proxy unavailable`);let r=await t.json();n=t.headers.get(`etag`)??``,e||(a(r.traces||[]),s(!0))}}catch{e||s(!1)}e||(l(!0),t=setTimeout(r,5e3))};return r(),()=>{e=!0,clearTimeout(t)}},[]);let[y,b]=(0,_.useState)(0),[S,C]=(0,_.useState)(0),w=e.includes(`scan`);(0,_.useEffect)(()=>{if(!w)return;let e=!1,t,n=async()=>{try{let t=await wL();e||b(t.unseen)}catch{}e||(t=setTimeout(n,1e4))};return n(),()=>{e=!0,clearTimeout(t)}},[w,S]);let T=i.find(e=>e.id===u.trace),E=[{view:`prompts`,label:`Prompts`,icon:ce},{view:`search`,label:`Search`,icon:ve},{view:`story`,label:`Story`,icon:le},{view:`sandboxes`,label:`Sandboxes`,icon:L},{view:`scan`,label:`Initial scan`,icon:_e},{view:`calls`,label:`Tool calls`,icon:je},{view:`changes`,label:`Changes`,icon:W},{view:`sandbox`,label:`Sandbox evidence`,icon:xe},{view:`context`,label:`Context`,icon:ae},{view:`thought`,label:`Chain of thought`,icon:R},{view:`playground`,label:`Playground`,icon:re}].filter(e=>r(e.view));function D(){return!c&&u.trace?(0,G.jsx)(`section`,{className:`rt-view`,children:(0,G.jsx)(rp,{label:`Loading recorded prompts…`})}):(0,G.jsx)(`section`,{className:`rt-view`,children:(0,G.jsxs)(`p`,{className:`rt-empty`,children:[c&&u.trace&&!T?`That prompt is no longer in the loaded history.`:`Choose a prompt first.`,` `,(0,G.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>v({view:`prompts`}),children:`Go to Prompts`})]})})}return(0,G.jsxs)(`main`,{className:`rt-shell`,ref:g,children:[(0,G.jsxs)(`aside`,{className:`nav rt-nav`,children:[(0,G.jsxs)(`div`,{className:`brand`,children:[(0,G.jsx)(Pe,{}),` RayTrace`]}),r(`search`)&&(0,G.jsxs)(`form`,{className:`rt-nav-search`,onSubmit:e=>{e.preventDefault(),v({view:`search`,q:f})},children:[(0,G.jsx)(ve,{size:13}),(0,G.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:`Search what agents did…`,"aria-label":`Search agent activity`,spellCheck:!1})]}),(0,G.jsx)(`nav`,{className:`nav-destinations`,children:E.map(({view:e,label:t,icon:n})=>(0,G.jsxs)(`button`,{type:`button`,className:`nav-item ${u.view===e?`active`:``}`,onClick:()=>v({view:e,trace:u.trace,...e===`scan`?{box:u.box||T?.sandboxId||``}:{}}),children:[(0,G.jsx)(n,{size:16}),` `,t,e===`scan`&&y>0&&(0,G.jsx)(`span`,{className:`rt-count`,title:`${y} unseen alert${y===1?``:`s`}`,children:y})]},e))}),T&&(0,G.jsxs)(`div`,{className:`rt-viewing`,children:[(0,G.jsx)(`span`,{className:`workspace-label`,children:`VIEWING`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>v({view:`prompts`,trace:T.id}),title:T.title,children:rV(T.title)}),(0,G.jsx)(`small`,{children:new Date(T.startedAt).toLocaleString(void 0,{day:`numeric`,month:`short`,hour:`numeric`,minute:`2-digit`})})]}),(0,G.jsxs)(`div`,{className:`nav-bottom`,children:[(0,G.jsx)(`div`,{className:`rt-nav-tools`,children:(0,G.jsx)(rz,{onStarClick:()=>{h(!0),QB(`opened`,`sidebar`)}})}),(0,G.jsxs)(`div`,{className:`nav-status`,children:[(0,G.jsx)(az,{loaded:c,connected:o,offline:t}),(0,G.jsx)(sz,{}),(0,G.jsx)(iz,{})]}),n]}),(0,G.jsx)(uz,{target:g,variable:`--nav-width`,storageKey:`raytace.nav-width`,min:180,max:480,label:`Navigation width`})]}),u.view===`prompts`&&r(`prompts`)&&(0,G.jsx)(Uz,{traces:i.filter(e=>!e.forkId),loaded:c,selectedId:u.trace,box:u.box,onBox:e=>v({view:`prompts`,box:e}),onSelect:e=>v({view:`prompts`,trace:e,box:u.box}),onOpen:(e,t)=>v({view:e,trace:t}),onOpenStep:(e,t)=>v({view:`calls`,trace:e,call:t}),canOpen:r}),u.view===`search`&&r(`search`)&&(0,G.jsx)(Qz,{initialQuery:u.q,onQuery:e=>v({view:`search`,trace:u.trace,q:e}),onOpenCall:(e,t)=>v({view:`calls`,trace:e,call:t}),onOpenTrace:e=>v({view:`prompts`,trace:e}),onOpenSandbox:r(`sandbox`)?(e,t)=>v({view:`sandbox`,trace:e,call:t}):void 0},u.q),u.view===`story`&&r(`story`)&&(T?(0,G.jsx)(pB,{trace:T,focusCall:u.call,onSelect:e=>v({view:`story`,trace:T.id,call:e}),onOpenCall:e=>v({view:`calls`,trace:T.id,call:e}),onOpenThought:r(`thought`)?e=>v({view:`thought`,trace:T.id,call:e}):void 0,onOpenSandbox:r(`sandbox`)?e=>v({view:`sandbox`,trace:T.id,call:e}):void 0},T.id):D()),u.view===`sandboxes`&&r(`sandboxes`)&&(0,G.jsx)(JB,{traces:i,selectedId:u.box,onSelect:e=>v({view:`sandboxes`,box:e}),onOpenTrace:e=>v({view:`calls`,trace:e}),onOpenScan:r(`scan`)?e=>v({view:`scan`,trace:u.trace,box:e}):void 0}),u.view===`scan`&&r(`scan`)&&(0,G.jsx)(eR,{box:u.box,traces:i,onSelect:e=>v({view:`scan`,trace:u.trace,box:e}),onOpenCall:(e,t)=>v({view:`calls`,trace:e,call:t}),onAlertsSeen:()=>C(e=>e+1)}),u.view===`calls`&&r(`calls`)&&(T?(0,G.jsx)(TR,{trace:T,traces:i,focusCall:u.call,onOpenSandbox:r(`sandbox`)?e=>v({view:`sandbox`,trace:T.id,call:e??null}):void 0,onOpenContext:r(`context`)?e=>v({view:`context`,trace:T.id,step:iV(e)}):void 0,onOpenThought:r(`thought`)?e=>v({view:`thought`,trace:T.id,call:e}):void 0,onOpenPlayground:r(`playground`)?(e,t)=>v({view:`playground`,trace:T.id,step:e,call:t??null}):void 0},T.id):D()),u.view===`changes`&&r(`changes`)&&(T?(0,G.jsx)(hB,{trace:T,onOpenCall:r(`calls`)?e=>v({view:`calls`,trace:T.id,call:e}):void 0},T.id):D()),u.view===`sandbox`&&r(`sandbox`)&&(T?(0,G.jsx)(vB,{trace:T,focusCall:u.call,onOpenCall:e=>v({view:`calls`,trace:T.id,call:e??null})},T.id):D()),u.view===`playground`&&r(`playground`)&&(T?(0,G.jsx)(Mz,{trace:T,stepId:u.step,removeCall:u.call,forkTraces:i.filter(e=>e.forkId),onStep:e=>v({view:`playground`,trace:T.id,step:e}),onOpenTrace:e=>v({view:`calls`,trace:e})},`${T.id}:${u.step??``}`):D()),u.view===`context`&&r(`context`)&&(T?(0,G.jsx)($R,{trace:T,stepKey:u.step,onStep:e=>v({view:`context`,trace:T.id,step:e}),onRerunWithout:r(`playground`)?(e,t)=>v({view:`playground`,trace:T.id,step:e,call:t}):void 0},T.id):D()),u.view===`thought`&&r(`thought`)&&(T?(0,G.jsx)(zR,{trace:T,focusCall:u.call},T.id):D()),(0,G.jsx)($B,{promptCount:i.filter(e=>!e.forkId).length,connected:o,suppressed:m})]})}var oV=[`prompts`,`search`,`story`,`sandboxes`,`calls`,`changes`,`sandbox`,`context`,`thought`,`playground`];S({fetch:(e,t)=>fetch(e,t)});var sV=6;function cV(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{fetch(`/raytace/version`).then(e=>e.ok?e.json():{api:0}).then(e=>t((Number(e.api)||0)<sV),()=>{}),fetch(`/raytace/models`).then(e=>r(e.status===401),()=>{})},[]),!e&&!n?null:(0,G.jsx)(`div`,{role:`alert`,style:{padding:`10px 16px`,background:`light-dark(#fff4d6,#3a2f12)`,color:`light-dark(#5c4300,#ffd97a)`,fontSize:13,borderBottom:`1px solid light-dark(#f0d48a,#5c4a1c)`},children:e?(0,G.jsxs)(G.Fragment,{children:[`An older RayTrace proxy is running, so parts of this page cannot load. Restart it: `,(0,G.jsx)(`code`,{children:`raytrace stop && raytrace start`})]}):(0,G.jsxs)(G.Fragment,{children:[`This browser is not signed in to RayTrace, so nothing can load. In a terminal, run: `,(0,G.jsx)(`code`,{children:`raytrace open`})]})})}(0,v.createRoot)(document.getElementById(`root`)).render((0,G.jsxs)(_.StrictMode,{children:[(0,G.jsx)(cV,{}),(0,G.jsx)(aV,{views:oV,footer:(0,G.jsx)(`a`,{className:`rt-site-link`,href:`https://raytracer.si`,target:`_blank`,rel:`noopener noreferrer`,children:`raytracer.si ↗`})})]}));
36
+ `).find(e=>e.trim())?.trim()??`(empty prompt)`,WB=e=>new Date(typeof e==`number`?e*1e3:e).toLocaleString(void 0,{day:`numeric`,month:`short`,hour:`numeric`,minute:`2-digit`}),GB=e=>e==null?`—`:`${(e/1048576).toFixed(e<1048576?2:1)} MiB`;function KB(e){return e===`lima`?{title:`Local VM`,detail:`Lima on this machine`}:{title:`Cloud VM ${e.split(`@`).pop()}`,detail:e}}function qB(e){return e.status===`deleted`?{label:`Destroyed`,tone:`deleted`}:e.on_host?e.status===`running`?{label:`Running`,tone:`running`}:e.status===`import_failed`?{label:`Failed to create`,tone:`deleted`}:{label:`Stopped`,tone:`stopped`}:{label:`Not connected`,tone:`unknown`}}function JB({traces:e,selectedId:t,onSelect:n,onOpenTrace:r,onOpenScan:i}){let[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(0),h=!!x().createSandbox;(0,_.useEffect)(()=>{let e=!1,t,n=async()=>{try{let t=await x().fetch(`/raytace/sandboxes`,{cache:`no-store`}),n=await t.json();if(!t.ok)throw Error(n.error||`Sandbox list unavailable`);e||(o(n.sandboxes??[]),c(null))}catch(t){e||c(t instanceof Error?t.message:`Proxy unavailable`)}e||(t=setTimeout(n,1e4))};return n(),()=>{e=!0,clearTimeout(t)}},[p]);let g=new Map;for(let t of e)t.sandboxId&&!t.forkId&&g.set(t.sandboxId,[...g.get(t.sandboxId)??[],t]);let v=[...new Set((a??[]).map(e=>e.host))].sort((e,t)=>{let n=e=>+!(a??[]).some(t=>t.host===e&&t.on_host);return n(e)-n(t)||e.localeCompare(t)}),y=e=>typeof e.created==`number`?e.created*1e3:Date.parse(e.created),[b,S]=(0,_.useState)(null),C=async e=>{u(e.id),f(``);try{let t=await x().fetch(`/raytace/sandboxes/${e.id}`,{method:`DELETE`,headers:{"x-raytace-experiment":`1`}}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||`Destroy failed`);n(``),m(e=>e+1)}catch(e){f(e instanceof Error?e.message:`Destroy failed`)}finally{u(``),S(null)}};return(0,G.jsxs)(`section`,{className:`rt-view`,children:[(0,G.jsx)(`header`,{className:`rt-view-head`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`eyebrow`,children:`SANDBOXES`}),(0,G.jsx)(`h1`,{children:`Where your agents ran`})]})}),h&&(0,G.jsx)(HB,{onCreated:e=>{m(e=>e+1),(i??n)(e)}}),s&&(0,G.jsx)(`p`,{className:`rt-empty`,children:s}),d&&(0,G.jsx)(`p`,{className:`rt-empty`,children:d}),!s&&a===null&&(0,G.jsx)(rp,{label:`Loading your sandboxes…`}),!s&&a?.length===0&&(0,G.jsxs)(`p`,{className:`rt-empty`,children:[`No sandboxes yet. `,h?`Drop a project folder above, or from`:`From`,` a Git repository: `,(0,G.jsx)(`code`,{children:`raytrace sandbox create`})]}),v.map(e=>{let o=KB(e),s=(a??[]).filter(t=>t.host===e).sort((e,t)=>Number(e.status===`deleted`)-Number(t.status===`deleted`)||y(t)-y(e)),c=s.some(e=>e.on_host);return(0,G.jsxs)(`div`,{className:`rt-host`,children:[(0,G.jsxs)(`div`,{className:`rt-list-head`,children:[(0,G.jsxs)(`span`,{className:`rt-host-title`,children:[(0,G.jsx)(be,{size:13}),` `,o.title.toUpperCase()]}),(0,G.jsxs)(`small`,{children:[o.detail,` · `,c?`connected`:`not connected now`,` · `,s.length,` sandbox`,s.length===1?``:`es`]})]}),(0,G.jsx)(`ol`,{className:`rt-prompts`,children:s.map(e=>{let a=e.id===t,s=(g.get(e.id)??[]).sort((e,t)=>t.startedAt.localeCompare(e.startedAt)),c=qB(e),u=`raytrace connect ${e.host===`lima`&&e.name?e.name:e.id}`;return(0,G.jsxs)(`li`,{className:a?`rt-prompt open`:`rt-prompt`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`rt-prompt-row`,"aria-expanded":a,onClick:()=>n(a?``:e.id),children:[(0,G.jsx)(`time`,{children:WB(e.created)}),(0,G.jsxs)(`strong`,{children:[(0,G.jsx)(`span`,{className:`rt-state s-${c.tone}`,children:c.label}),e.name]}),(0,G.jsxs)(`small`,{children:[s.length,` prompt`,s.length===1?``:`s`,` · `,e.id.slice(0,12),`…`]})]}),a&&(0,G.jsxs)(`div`,{className:`rt-prompt-detail`,children:[(0,G.jsxs)(`dl`,{className:`rt-facts`,children:[(0,G.jsx)(`dt`,{children:`Sandbox`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(`code`,{children:e.id})}),(0,G.jsx)(`dt`,{children:`Runs on`}),(0,G.jsxs)(`dd`,{children:[o.title,` `,(0,G.jsxs)(`span`,{className:`rt-muted`,children:[`(`,o.detail,`)`]})]}),(0,G.jsx)(`dt`,{children:`State`}),(0,G.jsxs)(`dd`,{children:[c.label,!e.on_host&&e.status!==`deleted`?(0,G.jsxs)(`span`,{className:`rt-muted`,children:[` — the manager is connected to another VM; last recorded: `,e.status]}):null]}),(0,G.jsx)(`dt`,{children:`Created`}),(0,G.jsxs)(`dd`,{children:[WB(e.created),e.deleted?(0,G.jsxs)(`span`,{className:`rt-muted`,children:[` · destroyed `,WB(e.deleted)]}):null]}),e.host!==`lima`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{children:`Uploaded`}),(0,G.jsxs)(`dd`,{children:[GB(e.imported_bytes),e.skipped_count?(0,G.jsxs)(`span`,{className:`rt-muted`,children:[` · `,e.skipped_count,` file`,e.skipped_count===1?``:`s`,` left out`]}):null]})]}),(0,G.jsx)(`dt`,{children:`Recording`}),(0,G.jsx)(`dd`,{children:e.transcripts===!1?`Commands only (no Claude Code transcripts)`:`Commands and Claude Code transcripts`}),i&&e.scan?.by_level&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{children:`Initial scan`}),(0,G.jsxs)(`dd`,{children:[e.scan.files,` files, `,(e.scan.by_level[4]??0)+(e.scan.by_level[5]??0),` at level 4 or 5`,` `,(0,G.jsxs)(`button`,{type:`button`,className:`link-button`,onClick:()=>i(e.id),children:[(0,G.jsx)(_e,{size:11}),` Open the scan`]})]})]})]}),e.status!==`deleted`&&e.on_host&&(0,G.jsxs)(`div`,{className:`rt-shell-line`,children:[(0,G.jsx)(`code`,{children:u}),(0,G.jsx)(Nz,{text:u})]}),e.host===`lima`&&(0,G.jsxs)(`div`,{className:`rt-shell-line`,children:[(0,G.jsxs)(`code`,{children:[`raytrace sandbox destroy `,e.name||e.id]}),(0,G.jsx)(Nz,{text:`raytrace sandbox destroy ${e.name||e.id}`})]}),e.host===`lima`&&(0,G.jsxs)(`p`,{className:`rt-foot`,children:[`Run the first command in a terminal to open this sandbox, then start `,(0,G.jsx)(`code`,{children:`claude`}),` or `,(0,G.jsx)(`code`,{children:`codex`}),` there. The second deletes it, and asks whether to delete the logs recorded in it too.`]}),e.host!==`lima`&&e.status!==`deleted`&&e.on_host&&(0,G.jsxs)(`div`,{className:`rt-shell-line`,children:[(0,G.jsx)(`code`,{children:`Destroy this sandbox and stop anything running in it. Its recorded evidence stays.`}),(0,G.jsx)(oz,{disabled:l===e.id,onClick:()=>S(e),children:l===e.id?`Destroying…`:`Destroy`})]}),e.host!==`lima`&&e.status!==`deleted`&&e.on_host&&(0,G.jsxs)(`p`,{className:`rt-foot`,children:[`Run it in a terminal to open this sandbox, then start `,(0,G.jsx)(`code`,{children:`claude`}),` or `,(0,G.jsx)(`code`,{children:`codex`}),` there. Needs the RayTrace CLI, signed in as this account: `,(0,G.jsx)(`code`,{children:`npm install -g @raytrace-cli/cli@latest`}),`. On CLI 0.2 the command is `,(0,G.jsxs)(`code`,{children:[`raytrace sandbox shell `,e.id]}),`.`]}),(0,G.jsx)(`h3`,{children:`History`}),!s.length&&(0,G.jsx)(`p`,{className:`rt-muted`,children:`No prompts recorded in this sandbox yet.`}),s.length>0&&(0,G.jsx)(`ol`,{className:`rt-history`,children:s.map(e=>{let t=e.callVerifications??[],n=t.filter(e=>e.exec_id||(e.kind?e.kind===`command`:e.proposed!=null)),i=n.filter(e=>e.exec_id).length,a=t.filter(e=>e.kind===`file`&&!e.exec_id).length;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),children:[(0,G.jsx)(`time`,{dateTime:e.startedAt,children:WB(e.startedAt)}),(0,G.jsx)(`span`,{children:UB(e.title)}),(0,G.jsxs)(`small`,{className:n.length&&i===n.length?`all`:``,children:[n.length?`${i} of ${n.length} command${n.length===1?``:`s`} observed in the sandbox`:`no commands`,a>0&&` · ${a} file operation${a===1?``:`s`}`]}),(0,G.jsx)(P,{size:13})]})},e.id)})})]})]},e.id)})})]},e)}),b&&(0,G.jsxs)(`dialog`,{open:!0,className:`rt-dialog`,"aria-labelledby":`rt-destroy-title`,onCancel:e=>{e.preventDefault(),l||S(null)},children:[(0,G.jsx)(`h2`,{id:`rt-destroy-title`,children:`Destroy this sandbox?`}),(0,G.jsxs)(`p`,{children:[`“`,b.name||b.id,`” stops and is deleted. Its recorded evidence stays.`]}),(0,G.jsxs)(`div`,{className:`rt-dialog-actions`,children:[(0,G.jsx)(`button`,{type:`button`,className:`rt-button`,autoFocus:!0,disabled:!!l,onClick:()=>S(null),children:`No`}),(0,G.jsx)(oz,{className:`rt-danger`,disabled:!!l,onClick:()=>void C(b),children:l?`Destroying…`:`Yes, destroy`})]})]})]})}var YB=2e4,XB=`https://github.com/Godcreatebugs/raytrace-cli`,ZB=`https://raytracer.si/sign-in.html?src=star-thanks`;async function QB(e,t=`dashboard`){try{await x().fetch(`/raytace/star-prompt`,{method:`POST`,headers:{"content-type":`application/json`,"x-raytace-experiment":`1`},body:JSON.stringify({action:e,source:t})})}catch{}}function $B({promptCount:e,connected:t,suppressed:n=!1}){let r=Bf(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(`hidden`);(0,_.useEffect)(()=>{if(n||!t||o||e<3)return;let r=!1;return x().fetch(`/raytace/star-prompt`,{cache:`no-store`}).then(e=>e.ok?e.json():null).then(e=>{r||(s(!0),e?.eligible&&a(e))}).catch(()=>{r||s(!0)}),()=>{r=!0}},[n,t,o,e]),(0,_.useEffect)(()=>{if(!i?.eligible||n){n&&l(e=>e===`ask`?`hidden`:e);return}let e=setTimeout(()=>l(e=>e===`hidden`?`ask`:e),YB);return()=>clearTimeout(e)},[i,n]);let u=i?.url||XB,d=i?.website_url||ZB,f=Math.max(i?.prompts??0,e);function p(e){l(`hidden`),QB(e,`dashboard`)}function m(){QB(`opened`,`dashboard`),l(`thanks`)}return(0,G.jsx)(Ed,{children:c!==`hidden`&&(0,G.jsxs)(Vf.aside,{className:`rt-star-popup`,role:`region`,"aria-label":c===`ask`?`Star RayTrace on GitHub`:`Explore RayTrace`,initial:r?{opacity:0}:{opacity:0,y:14,scale:.98},animate:{opacity:1,y:0,scale:1},exit:r?{opacity:0}:{opacity:0,y:10,scale:.98},transition:{duration:r?.1:.22,ease:`easeOut`},children:[(0,G.jsxs)(`div`,{className:`rt-star-popup-head`,children:[(0,G.jsxs)(`span`,{className:`rt-star-popup-eyebrow`,children:[(0,G.jsx)(Ce,{size:13,fill:`currentColor`,"aria-hidden":`true`}),c===`ask`?`ENJOYING RAYTRACE?`:`THANKS FOR SUPPORTING RAYTRACE`]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-star-popup-close`,"aria-label":`Dismiss`,onClick:()=>c===`ask`?p(`dismissed`):l(`hidden`),children:(0,G.jsx)(Me,{size:14})})]}),c===`ask`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`rt-star-popup-copy`,children:[`You've recorded `,(0,G.jsx)(`strong`,{children:f}),` prompts locally. A GitHub star helps other developers discover RayTrace.`]}),(0,G.jsxs)(`div`,{className:`rt-star-popup-actions`,children:[(0,G.jsxs)(`a`,{className:`rt-button primary rt-star-popup-cta`,href:u,target:`_blank`,rel:`noopener noreferrer`,onClick:m,children:[(0,G.jsx)(Ce,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`span`,{children:`Star on GitHub`})]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-star-popup-secondary`,onClick:()=>p(`already_starred`),children:`Already starred`})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`rt-star-popup-copy`,children:`Want cloud sandboxes, shareable trace links, or product updates?`}),(0,G.jsxs)(`div`,{className:`rt-star-popup-actions`,children:[(0,G.jsxs)(`a`,{className:`rt-button primary rt-star-popup-cta`,href:d,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>l(`hidden`),children:[(0,G.jsx)(`span`,{children:`Create free account`}),(0,G.jsx)(ee,{size:13,"aria-hidden":`true`})]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-star-popup-secondary`,onClick:()=>l(`hidden`),children:`Close`})]})]})]},c)})}var eV=2e4,tV=`https://raytracer.si/sign-in.html?src=local-dashboard`;async function nV(e){try{let t=await x().fetch(`/raytace/signup-prompt`,{method:`POST`,headers:{"content-type":`application/json`,"x-raytace-experiment":`1`},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));return t.ok?{ok:!0}:{ok:!1,error:n.error||`Request failed (HTTP ${t.status}).`}}catch{return{ok:!1,error:`Could not reach the local RayTrace proxy.`}}}function rV({promptCount:e,connected:t}){let n=Bf(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(`hidden`),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(``);(0,_.useEffect)(()=>{if(!t||a||e<10)return;let n=!1;return x().fetch(`/raytace/signup-prompt`,{cache:`no-store`}).then(e=>e.ok?e.json():null).then(e=>{n||(o(!0),e?.eligible&&i(e))}).catch(()=>{n||o(!0)}),()=>{n=!0}},[t,a,e]),(0,_.useEffect)(()=>{if(!r?.eligible)return;let e=setTimeout(()=>c(e=>e===`hidden`?`ask`:e),eV);return()=>clearTimeout(e)},[r]);let h=r?.signup_url||tV,g=Math.max(r?.prompts??0,e);function v(){c(`hidden`),nV({action:`dismissed`})}function y(){c(`hidden`),nV({action:`clicked_signup`})}async function b(e){e.preventDefault();let t=l.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)){m(`Please enter a valid email address.`);return}m(``),f(!0);let n=await nV({action:`subscribe`,email:t});if(f(!1),!n.ok){m(n.error||`Could not subscribe right now.`);return}c(`subscribed`)}return(0,G.jsx)(Ed,{children:s!==`hidden`&&(0,G.jsxs)(Vf.aside,{className:`rt-star-popup rt-signup-popup`,role:`region`,"aria-label":s===`ask`?`Create a RayTrace account or subscribe to updates`:`Subscription confirmation sent`,initial:n?{opacity:0}:{opacity:0,y:14,scale:.98},animate:{opacity:1,y:0,scale:1},exit:n?{opacity:0}:{opacity:0,y:10,scale:.98},transition:{duration:n?.1:.22,ease:`easeOut`},children:[(0,G.jsxs)(`div`,{className:`rt-star-popup-head`,children:[(0,G.jsxs)(`span`,{className:`rt-star-popup-eyebrow`,children:[(0,G.jsx)(Se,{size:13,"aria-hidden":`true`}),s===`ask`?`GET MORE FROM RAYTRACE`:`CHECK YOUR INBOX`]}),(0,G.jsx)(`button`,{type:`button`,className:`rt-star-popup-close`,"aria-label":`Dismiss`,onClick:()=>s===`ask`?v():c(`hidden`),children:(0,G.jsx)(Me,{size:14})})]}),s===`ask`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`rt-star-popup-copy`,children:[`You've recorded `,(0,G.jsx)(`strong`,{children:g}),` prompts locally. Create a free account for cloud sandboxes, shareable trace links, and backup.`]}),(0,G.jsx)(`div`,{className:`rt-star-popup-actions`,children:(0,G.jsxs)(`a`,{className:`rt-button primary rt-star-popup-cta`,href:h,target:`_blank`,rel:`noopener noreferrer`,onClick:y,children:[(0,G.jsx)(`span`,{children:`Create free account`}),(0,G.jsx)(ee,{size:13,"aria-hidden":`true`})]})}),(0,G.jsx)(`div`,{className:`rt-signup-divider`}),(0,G.jsxs)(`form`,{className:`rt-signup-newsletter`,onSubmit:b,noValidate:!0,children:[(0,G.jsx)(`label`,{className:`rt-signup-label`,htmlFor:`rt-signup-email`,children:`Not ready for an account? Get the weekly what's new email:`}),(0,G.jsxs)(`div`,{className:`rt-signup-row`,children:[(0,G.jsx)(`input`,{id:`rt-signup-email`,type:`email`,value:l,onChange:e=>u(e.target.value),placeholder:`you@example.com`,autoComplete:`email`,disabled:d}),(0,G.jsx)(`button`,{type:`submit`,className:`rt-button`,disabled:d,children:d?`Sending…`:`Subscribe`})]}),p&&(0,G.jsx)(`p`,{className:`rt-signup-error`,role:`alert`,children:p}),(0,G.jsx)(`p`,{className:`rt-signup-note`,children:`Only your email is sent — zero trace data leaves your machine.`})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`rt-star-popup-copy`,children:`Check your inbox to confirm your subscription. You can unsubscribe any time.`}),(0,G.jsx)(`div`,{className:`rt-star-popup-actions`,children:(0,G.jsx)(`button`,{type:`button`,className:`rt-button`,onClick:()=>c(`hidden`),children:`Close`})})]})]},s)})}var iV=[`prompts`,`search`,`story`,`sandboxes`,`scan`,`calls`,`changes`,`sandbox`,`context`,`thought`,`playground`];function aV(e){let t=new URLSearchParams(typeof window>`u`?``:window.location.search),n=t.get(`view`),r=n===`lab`?`context`:n;return{view:r&&e.includes(r)?r:`prompts`,trace:t.get(`trace`)??``,call:t.get(`call`),step:t.get(`step`),box:t.get(`box`)??``,q:t.get(`q`)??``}}function oV(e){let t=new URLSearchParams;e.view!==`prompts`&&t.set(`view`,e.view),e.trace&&t.set(`trace`,e.trace),e.call&&t.set(`call`,e.call),e.step&&t.set(`step`,e.step),e.box&&t.set(`box`,e.box),e.view===`search`&&e.q&&t.set(`q`,e.q);let n=t.toString();window.history.pushState(null,``,n?`?${n}`:window.location.pathname)}var sV=e=>e.split(`
37
+ `).find(e=>e.trim())?.trim()??``,cV=e=>`${e.exchange_id}:${e.output_index}`;function lV({views:e=iV,offline:t=`PROXY OFFLINE`,footer:n=null}){let r=t=>e.includes(t),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)({view:`prompts`,trace:``,call:null,step:null,box:``,q:``}),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null);(0,_.useEffect)(()=>{d(aV(e));let t=()=>d(aV(e));return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let v=(0,_.useCallback)(e=>{d(t=>{let n={...t,call:null,step:null,box:``,q:``,...e};return oV(n),n})},[]);(0,_.useEffect)(()=>{let e=!1,t,n=``,r=async()=>{try{let t=await x().fetch(`/raytace/traces?scope=history`,{cache:`no-store`,headers:n?{"if-none-match":n}:{}});if(t.status===304)e||s(!0);else{if(!t.ok)throw Error(`Proxy unavailable`);let r=await t.json();n=t.headers.get(`etag`)??``,e||(a(r.traces||[]),s(!0))}}catch{e||s(!1)}e||(l(!0),t=setTimeout(r,5e3))};return r(),()=>{e=!0,clearTimeout(t)}},[]);let[y,b]=(0,_.useState)(0),[S,C]=(0,_.useState)(0),w=e.includes(`scan`);(0,_.useEffect)(()=>{if(!w)return;let e=!1,t,n=async()=>{try{let t=await wL();e||b(t.unseen)}catch{}e||(t=setTimeout(n,1e4))};return n(),()=>{e=!0,clearTimeout(t)}},[w,S]);let T=i.find(e=>e.id===u.trace),E=[{view:`prompts`,label:`Prompts`,icon:ce},{view:`search`,label:`Search`,icon:ve},{view:`story`,label:`Story`,icon:le},{view:`sandboxes`,label:`Sandboxes`,icon:L},{view:`scan`,label:`Initial scan`,icon:_e},{view:`calls`,label:`Tool calls`,icon:je},{view:`changes`,label:`Changes`,icon:W},{view:`sandbox`,label:`Sandbox evidence`,icon:xe},{view:`context`,label:`Context`,icon:ae},{view:`thought`,label:`Chain of thought`,icon:R},{view:`playground`,label:`Playground`,icon:re}].filter(e=>r(e.view));function D(){return!c&&u.trace?(0,G.jsx)(`section`,{className:`rt-view`,children:(0,G.jsx)(rp,{label:`Loading recorded prompts…`})}):(0,G.jsx)(`section`,{className:`rt-view`,children:(0,G.jsxs)(`p`,{className:`rt-empty`,children:[c&&u.trace&&!T?`That prompt is no longer in the loaded history.`:`Choose a prompt first.`,` `,(0,G.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>v({view:`prompts`}),children:`Go to Prompts`})]})})}return(0,G.jsxs)(`main`,{className:`rt-shell`,ref:g,children:[(0,G.jsxs)(`aside`,{className:`nav rt-nav`,children:[(0,G.jsxs)(`div`,{className:`brand`,children:[(0,G.jsx)(Pe,{}),` RayTrace`]}),r(`search`)&&(0,G.jsxs)(`form`,{className:`rt-nav-search`,onSubmit:e=>{e.preventDefault(),v({view:`search`,q:f})},children:[(0,G.jsx)(ve,{size:13}),(0,G.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:`Search what agents did…`,"aria-label":`Search agent activity`,spellCheck:!1})]}),(0,G.jsx)(`nav`,{className:`nav-destinations`,children:E.map(({view:e,label:t,icon:n})=>(0,G.jsxs)(`button`,{type:`button`,className:`nav-item ${u.view===e?`active`:``}`,onClick:()=>v({view:e,trace:u.trace,...e===`scan`?{box:u.box||T?.sandboxId||``}:{}}),children:[(0,G.jsx)(n,{size:16}),` `,t,e===`scan`&&y>0&&(0,G.jsx)(`span`,{className:`rt-count`,title:`${y} unseen alert${y===1?``:`s`}`,children:y})]},e))}),T&&(0,G.jsxs)(`div`,{className:`rt-viewing`,children:[(0,G.jsx)(`span`,{className:`workspace-label`,children:`VIEWING`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>v({view:`prompts`,trace:T.id}),title:T.title,children:sV(T.title)}),(0,G.jsx)(`small`,{children:new Date(T.startedAt).toLocaleString(void 0,{day:`numeric`,month:`short`,hour:`numeric`,minute:`2-digit`})})]}),(0,G.jsxs)(`div`,{className:`nav-bottom`,children:[(0,G.jsx)(`div`,{className:`rt-nav-tools`,children:(0,G.jsx)(rz,{onStarClick:()=>{h(!0),QB(`opened`,`sidebar`)}})}),(0,G.jsxs)(`div`,{className:`nav-status`,children:[(0,G.jsx)(az,{loaded:c,connected:o,offline:t}),(0,G.jsx)(sz,{}),(0,G.jsx)(iz,{})]}),n]}),(0,G.jsx)(uz,{target:g,variable:`--nav-width`,storageKey:`raytace.nav-width`,min:180,max:480,label:`Navigation width`})]}),u.view===`prompts`&&r(`prompts`)&&(0,G.jsx)(Uz,{traces:i.filter(e=>!e.forkId),loaded:c,selectedId:u.trace,box:u.box,onBox:e=>v({view:`prompts`,box:e}),onSelect:e=>v({view:`prompts`,trace:e,box:u.box}),onOpen:(e,t)=>v({view:e,trace:t}),onOpenStep:(e,t)=>v({view:`calls`,trace:e,call:t}),canOpen:r}),u.view===`search`&&r(`search`)&&(0,G.jsx)(Qz,{initialQuery:u.q,onQuery:e=>v({view:`search`,trace:u.trace,q:e}),onOpenCall:(e,t)=>v({view:`calls`,trace:e,call:t}),onOpenTrace:e=>v({view:`prompts`,trace:e}),onOpenSandbox:r(`sandbox`)?(e,t)=>v({view:`sandbox`,trace:e,call:t}):void 0},u.q),u.view===`story`&&r(`story`)&&(T?(0,G.jsx)(pB,{trace:T,focusCall:u.call,onSelect:e=>v({view:`story`,trace:T.id,call:e}),onOpenCall:e=>v({view:`calls`,trace:T.id,call:e}),onOpenThought:r(`thought`)?e=>v({view:`thought`,trace:T.id,call:e}):void 0,onOpenSandbox:r(`sandbox`)?e=>v({view:`sandbox`,trace:T.id,call:e}):void 0},T.id):D()),u.view===`sandboxes`&&r(`sandboxes`)&&(0,G.jsx)(JB,{traces:i,selectedId:u.box,onSelect:e=>v({view:`sandboxes`,box:e}),onOpenTrace:e=>v({view:`calls`,trace:e}),onOpenScan:r(`scan`)?e=>v({view:`scan`,trace:u.trace,box:e}):void 0}),u.view===`scan`&&r(`scan`)&&(0,G.jsx)(eR,{box:u.box,traces:i,onSelect:e=>v({view:`scan`,trace:u.trace,box:e}),onOpenCall:(e,t)=>v({view:`calls`,trace:e,call:t}),onAlertsSeen:()=>C(e=>e+1)}),u.view===`calls`&&r(`calls`)&&(T?(0,G.jsx)(TR,{trace:T,traces:i,focusCall:u.call,onOpenSandbox:r(`sandbox`)?e=>v({view:`sandbox`,trace:T.id,call:e??null}):void 0,onOpenContext:r(`context`)?e=>v({view:`context`,trace:T.id,step:cV(e)}):void 0,onOpenThought:r(`thought`)?e=>v({view:`thought`,trace:T.id,call:e}):void 0,onOpenPlayground:r(`playground`)?(e,t)=>v({view:`playground`,trace:T.id,step:e,call:t??null}):void 0},T.id):D()),u.view===`changes`&&r(`changes`)&&(T?(0,G.jsx)(hB,{trace:T,onOpenCall:r(`calls`)?e=>v({view:`calls`,trace:T.id,call:e}):void 0},T.id):D()),u.view===`sandbox`&&r(`sandbox`)&&(T?(0,G.jsx)(vB,{trace:T,focusCall:u.call,onOpenCall:e=>v({view:`calls`,trace:T.id,call:e??null})},T.id):D()),u.view===`playground`&&r(`playground`)&&(T?(0,G.jsx)(Mz,{trace:T,stepId:u.step,removeCall:u.call,forkTraces:i.filter(e=>e.forkId),onStep:e=>v({view:`playground`,trace:T.id,step:e}),onOpenTrace:e=>v({view:`calls`,trace:e})},`${T.id}:${u.step??``}`):D()),u.view===`context`&&r(`context`)&&(T?(0,G.jsx)($R,{trace:T,stepKey:u.step,onStep:e=>v({view:`context`,trace:T.id,step:e}),onRerunWithout:r(`playground`)?(e,t)=>v({view:`playground`,trace:T.id,step:e,call:t}):void 0},T.id):D()),u.view===`thought`&&r(`thought`)&&(T?(0,G.jsx)(zR,{trace:T,focusCall:u.call},T.id):D()),(0,G.jsx)($B,{promptCount:i.filter(e=>!e.forkId).length,connected:o,suppressed:m}),(0,G.jsx)(rV,{promptCount:i.filter(e=>!e.forkId).length,connected:o})]})}var uV=[`prompts`,`search`,`story`,`sandboxes`,`calls`,`changes`,`sandbox`,`context`,`thought`,`playground`];S({fetch:(e,t)=>fetch(e,t)});var dV=7;function fV(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{fetch(`/raytace/version`).then(e=>e.ok?e.json():{api:0}).then(e=>t((Number(e.api)||0)<dV),()=>{}),fetch(`/raytace/models`).then(e=>r(e.status===401),()=>{})},[]),!e&&!n?null:(0,G.jsx)(`div`,{role:`alert`,style:{padding:`10px 16px`,background:`light-dark(#fff4d6,#3a2f12)`,color:`light-dark(#5c4300,#ffd97a)`,fontSize:13,borderBottom:`1px solid light-dark(#f0d48a,#5c4a1c)`},children:e?(0,G.jsxs)(G.Fragment,{children:[`An older RayTrace proxy is running, so parts of this page cannot load. Restart it: `,(0,G.jsx)(`code`,{children:`raytrace stop && raytrace start`})]}):(0,G.jsxs)(G.Fragment,{children:[`This browser is not signed in to RayTrace, so nothing can load. In a terminal, run: `,(0,G.jsx)(`code`,{children:`raytrace open`})]})})}(0,v.createRoot)(document.getElementById(`root`)).render((0,G.jsxs)(_.StrictMode,{children:[(0,G.jsx)(fV,{}),(0,G.jsx)(lV,{views:uV,footer:(0,G.jsx)(`a`,{className:`rt-site-link`,href:`https://raytracer.si/?src=local-sidebar`,target:`_blank`,rel:`noopener noreferrer`,children:`raytracer.si ↗`})})]}));