@open-mercato/cezar 0.20.0-pr1895.4821 → 0.20.0-pr1899.4824

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.
Files changed (19) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/{agent-task-pickers-D_xhthT_.js → agent-task-pickers-CSi8roas.js} +1 -1
  3. package/web/dist/assets/{assets-view-C3DMAEs3.js → assets-view-DVnlAuvY.js} +1 -1
  4. package/web/dist/assets/{automations-route-DLyqk28c.js → automations-route-CLQgBD2P.js} +1 -1
  5. package/web/dist/assets/{compare-variants-fCkKFg8A.js → compare-variants-cTojdhp-.js} +1 -1
  6. package/web/dist/assets/{dashboard-D05_GNIm.js → dashboard-DBkrsPk0.js} +1 -1
  7. package/web/dist/assets/{github-CD8STRPa.js → github-BKolQ6oI.js} +1 -1
  8. package/web/dist/assets/{index-BvB76A30.js → index-DkeOxdSy.js} +5 -5
  9. package/web/dist/assets/{manager-chat-BL6hWaci.js → manager-chat-BqnkkoYG.js} +1 -1
  10. package/web/dist/assets/{manager-index-B0NkMEw_.js → manager-index-Djq3MlIV.js} +1 -1
  11. package/web/dist/assets/{manager-new-CSq9Uzyj.js → manager-new-Bn1uvMOW.js} +1 -1
  12. package/web/dist/assets/{mascot-picker-BLkJPQ1Q.js → mascot-picker-B8oGci1_.js} +1 -1
  13. package/web/dist/assets/{repo-git--9KIo-C9.js → repo-git-D-cuG5yQ.js} +1 -1
  14. package/web/dist/assets/{skills-CoeoHDp5.js → skills-BE7av1Dt.js} +1 -1
  15. package/web/dist/assets/{task-graph-BKcLm5TG.js → task-graph-D4YYyucN.js} +1 -1
  16. package/web/dist/assets/{task-workspace-D8LN5gJD.js → task-workspace-RtYm8huL.js} +2 -2
  17. package/web/dist/assets/{tracker-BpfyQ8MA.js → tracker-DbS9JCVS.js} +1 -1
  18. package/web/dist/assets/{workflow-graph-Cclf8xeE.js → workflow-graph-Bbyqt_Fg.js} +1 -1
  19. package/web/dist/index.html +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/cezar",
3
- "version": "0.20.0-pr1895.4821",
3
+ "version": "0.20.0-pr1899.4824",
4
4
  "description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -56,8 +56,8 @@
56
56
  "zod": "^4.4.3"
57
57
  },
58
58
  "devDependencies": {
59
- "@open-mercato/cezar-api-client": "0.20.0-pr1895.4821",
60
- "@open-mercato/cezar-contract": "0.20.0-pr1895.4821",
59
+ "@open-mercato/cezar-api-client": "0.20.0-pr1899.4824",
60
+ "@open-mercato/cezar-contract": "0.20.0-pr1899.4824",
61
61
  "@types/node": "^20.14.0",
62
62
  "@types/proper-lockfile": "4.1.4",
63
63
  "@types/ws": "^8.18.1",
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-BdZWtrih.js";import{t as i}from"./project-router-BENNbi0L.js";import{k as a}from"./run-actions-DH4E0sVZ.js";import{t as o}from"./check-a8DW-5xT.js";import{s}from"./dist-DuIPAwrM.js";import{v as c}from"./impact-model-Cmjyomel.js";import{C as l,S as u,b as d,g as f,w as p}from"./composer-BECpe2ga.js";import{t as m}from"./workflow-D-yaQOTP.js";import{_ as h,h as g,v as _}from"./use-now-C0gy0Kbc.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./command-Bqs3AoVg.js";import{a as w}from"./picker-pill-MlQIn-EU.js";import{l as T}from"./index-BvB76A30.js";var E=n();function D({name:e,route:t,selected:n,list:i,detail:a}){return(0,E.jsxs)(`div`,{"data-route":t,className:`flex h-full min-h-0 items-stretch`,children:[(0,E.jsx)(`section`,{"data-slot":`${e}-list`,className:r(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,n?`hidden`:`flex`),children:i}),(0,E.jsx)(`section`,{"data-slot":`${e}-detail`,className:r(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,n?`flex`:`hidden md:flex`),children:a})]})}function O({resolved:e,dataSlot:t}){return e.providerPending||e.canRun?null:(0,E.jsxs)(`span`,{"data-slot":t,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[e.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,E.jsx)(i,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]})}var k=e(t(),1);function A({workflows:e,value:t,onChange:n,slotPrefix:i=`gh`}){let[a,c]=(0,k.useState)(!1),[u,d]=(0,k.useState)(``),f=(0,k.useRef)(null),T=l(e,u);return(0,E.jsxs)(g,{open:a,onOpenChange:e=>{c(e),e||d(``)},children:[(0,E.jsx)(_,{asChild:!0,children:(0,E.jsxs)(`button`,{type:`button`,"data-slot":`${i}-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(w,t&&`border-foreground/60 font-mono text-meta font-semibold text-foreground`),children:[(0,E.jsx)(m,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,E.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,E.jsx)(s,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,E.jsx)(h,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,E.jsxs)(C,{label:`Choose a workflow`,shouldFilter:!1,children:[(0,E.jsx)(v,{placeholder:`search workflows…`,value:u,onValueChange:d,onInput:()=>f.current?.scrollTo(0,0)}),(0,E.jsxs)(S,{ref:f,"data-slot":`${i}-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[T.length===0?(0,E.jsx)(x,{children:`Nothing matches.`}):null,(0,E.jsx)(y,{children:T.map(e=>{let r=t===e.name;return(0,E.jsxs)(b,{value:`workflow ${e.name}`,keywords:p(e.name,e.description),"data-slot":`${i}-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),c(!1)},children:[(0,E.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,E.jsx)(o,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function j({skills:e,skillUsage:t,selected:n,onToggle:i,maxSelections:l,slotPrefix:m=`gh`}){let[D,O]=(0,k.useState)(!1),[A,j]=(0,k.useState)(``),[M,N]=(0,k.useState)(null),P=(0,k.useRef)(null),{mostUsed:F,project:I,global:L}=d(u(e,A,t),t),R=(e,t)=>{let a=n.includes(e.name);return(0,E.jsxs)(b,{value:`skill ${e.name} ${e.path}`,keywords:p(e.name,e.description),"data-slot":`${m}-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,disabled:!a&&l!==void 0&&n.length>=l,onSelect:()=>i(e.name),children:[(0,E.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,E.jsx)(`button`,{type:`button`,"data-slot":`${m}-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),N(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,E.jsx)(c,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,E.jsx)(o,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(T,{skill:M,onClose:()=>N(null)}),(0,E.jsxs)(g,{open:D,onOpenChange:e=>{O(e),e||j(``)},children:[(0,E.jsx)(_,{asChild:!0,children:(0,E.jsxs)(`button`,{type:`button`,"data-slot":`${m}-skills-trigger`,"aria-label":`Choose skills`,className:r(w,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,E.jsx)(a,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,E.jsx)(s,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,E.jsx)(h,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,E.jsxs)(C,{label:`Choose skills`,shouldFilter:!1,children:[(0,E.jsx)(v,{placeholder:`search skills…`,value:A,onValueChange:j,onInput:()=>P.current?.scrollTo(0,0)}),(0,E.jsxs)(S,{ref:P,"data-slot":`${m}-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[F.length===0&&I.length===0&&L.length===0?(0,E.jsx)(x,{children:`Nothing matches.`}):null,F.length>0?(0,E.jsx)(y,{heading:`Most used`,children:F.map(e=>R(e,f(e)))}):null,I.length>0?(0,E.jsx)(y,{heading:`Project skills`,children:I.map(e=>R(e,!0))}):null,L.length>0?(0,E.jsx)(y,{heading:`Global`,children:L.map(e=>R(e,!1))}):null]})]})})]})]})}export{D as i,A as n,O as r,j as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-BdZWtrih.js";import{t as i}from"./project-router-BENNbi0L.js";import{k as a}from"./run-actions-DH4E0sVZ.js";import{t as o}from"./check-a8DW-5xT.js";import{s}from"./dist-DuIPAwrM.js";import{v as c}from"./impact-model-Cmjyomel.js";import{C as l,S as u,b as d,g as f,w as p}from"./composer-BECpe2ga.js";import{t as m}from"./workflow-D-yaQOTP.js";import{_ as h,h as g,v as _}from"./use-now-C0gy0Kbc.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./command-Bqs3AoVg.js";import{a as w}from"./picker-pill-MlQIn-EU.js";import{l as T}from"./index-DkeOxdSy.js";var E=n();function D({name:e,route:t,selected:n,list:i,detail:a}){return(0,E.jsxs)(`div`,{"data-route":t,className:`flex h-full min-h-0 items-stretch`,children:[(0,E.jsx)(`section`,{"data-slot":`${e}-list`,className:r(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,n?`hidden`:`flex`),children:i}),(0,E.jsx)(`section`,{"data-slot":`${e}-detail`,className:r(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,n?`flex`:`hidden md:flex`),children:a})]})}function O({resolved:e,dataSlot:t}){return e.providerPending||e.canRun?null:(0,E.jsxs)(`span`,{"data-slot":t,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[e.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,E.jsx)(i,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]})}var k=e(t(),1);function A({workflows:e,value:t,onChange:n,slotPrefix:i=`gh`}){let[a,c]=(0,k.useState)(!1),[u,d]=(0,k.useState)(``),f=(0,k.useRef)(null),T=l(e,u);return(0,E.jsxs)(g,{open:a,onOpenChange:e=>{c(e),e||d(``)},children:[(0,E.jsx)(_,{asChild:!0,children:(0,E.jsxs)(`button`,{type:`button`,"data-slot":`${i}-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(w,t&&`border-foreground/60 font-mono text-meta font-semibold text-foreground`),children:[(0,E.jsx)(m,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,E.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,E.jsx)(s,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,E.jsx)(h,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,E.jsxs)(C,{label:`Choose a workflow`,shouldFilter:!1,children:[(0,E.jsx)(v,{placeholder:`search workflows…`,value:u,onValueChange:d,onInput:()=>f.current?.scrollTo(0,0)}),(0,E.jsxs)(S,{ref:f,"data-slot":`${i}-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[T.length===0?(0,E.jsx)(x,{children:`Nothing matches.`}):null,(0,E.jsx)(y,{children:T.map(e=>{let r=t===e.name;return(0,E.jsxs)(b,{value:`workflow ${e.name}`,keywords:p(e.name,e.description),"data-slot":`${i}-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),c(!1)},children:[(0,E.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,E.jsx)(o,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function j({skills:e,skillUsage:t,selected:n,onToggle:i,maxSelections:l,slotPrefix:m=`gh`}){let[D,O]=(0,k.useState)(!1),[A,j]=(0,k.useState)(``),[M,N]=(0,k.useState)(null),P=(0,k.useRef)(null),{mostUsed:F,project:I,global:L}=d(u(e,A,t),t),R=(e,t)=>{let a=n.includes(e.name);return(0,E.jsxs)(b,{value:`skill ${e.name} ${e.path}`,keywords:p(e.name,e.description),"data-slot":`${m}-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,disabled:!a&&l!==void 0&&n.length>=l,onSelect:()=>i(e.name),children:[(0,E.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,E.jsx)(`button`,{type:`button`,"data-slot":`${m}-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),N(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,E.jsx)(c,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,E.jsx)(o,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(T,{skill:M,onClose:()=>N(null)}),(0,E.jsxs)(g,{open:D,onOpenChange:e=>{O(e),e||j(``)},children:[(0,E.jsx)(_,{asChild:!0,children:(0,E.jsxs)(`button`,{type:`button`,"data-slot":`${m}-skills-trigger`,"aria-label":`Choose skills`,className:r(w,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,E.jsx)(a,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,E.jsx)(s,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,E.jsx)(h,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,E.jsxs)(C,{label:`Choose skills`,shouldFilter:!1,children:[(0,E.jsx)(v,{placeholder:`search skills…`,value:A,onValueChange:j,onInput:()=>P.current?.scrollTo(0,0)}),(0,E.jsxs)(S,{ref:P,"data-slot":`${m}-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[F.length===0&&I.length===0&&L.length===0?(0,E.jsx)(x,{children:`Nothing matches.`}):null,F.length>0?(0,E.jsx)(y,{heading:`Most used`,children:F.map(e=>R(e,f(e)))}):null,I.length>0?(0,E.jsx)(y,{heading:`Project skills`,children:I.map(e=>R(e,!0))}):null,L.length>0?(0,E.jsx)(y,{heading:`Global`,children:L.map(e=>R(e,!1))}):null]})]})})]})]})}export{D as i,A as n,O as r,j as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,wt as i,xa as a}from"./queries-ulWjkQ8y.js";import{t as o,wt as s}from"./utils-BdZWtrih.js";import{c,x as l}from"./project-router-BENNbi0L.js";import{N as u,t as d}from"./button-DlATnGEr.js";import{T as f}from"./run-actions-DH4E0sVZ.js";import{s as p}from"./dist-DuIPAwrM.js";import{a as m,i as h,l as g,n as _,o as v,t as y}from"./dropdown-menu-EpgT0bci.js";import{t as b}from"./download-fhhT22Gv.js";import{t as x}from"./external-link-65uYp9hQ.js";import{t as S}from"./file-preview-CGzA3pnM.js";import{t as C}from"./file-cgpPGziJ.js";import{t as w}from"./layers-lugEOu8L.js";import{t as T}from"./loader-circle-BHoeiDvX.js";import{a as E,c as D,d as O,f as k,i as A,l as j,o as M,r as N,s as P,t as F,u as I}from"./follow-up-engine-Csx5YQhI.js";import{t as L}from"./triangle-alert-CwLmF9Ne.js";import{t as ee}from"./x-2UhdkEEP.js";import{n as R}from"./format-DHK74MwW.js";import{t as z}from"./centered-state-DX6Gs7Sn.js";import{t as B}from"./markdown-BtpIXTjY.js";import{Ot as V,ct as H,kt as U,mt as W,wt as G}from"./index-BvB76A30.js";var K=u(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),q=u(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),J=e(t(),1);function Y(e){let t=s.safeParse(e);return t.success?{ref:t.data.ref,label:t.data.label.slice(0,200)}:null}function X(e,t){return e?`About ${e.ref} ("${e.label}"): ${t}`:t}function Z(e,t){let n=(0,J.useRef)(t);n.current=t,(0,J.useEffect)(()=>{let t=t=>{let r=e.current?.contentWindow;if(!r||t.source!==r)return;let i=Y(t.data);i&&n.current(i)};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[e])}var Q=n();function $({run:e,reference:t,onClearReference:n}){let r=F(e),i=N(e,r.continueWith),a=f(e),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1),[u,p]=(0,J.useState)(null),m=(0,J.useId)(),h=e.status===`running`||e.status===`waiting`,g=e.status===`queued`,_=!h&&!g&&r.available;if(!h&&!g&&!_||e.worktreeLifecycle?.activeOperationId)return null;let v=h&&!a.usable?a.reason:_&&!r.canContinue?r.reason??`No provider can continue this task.`:void 0,y=!v&&!c&&o.trim()!==``,b=async e=>{if(e?.preventDefault(),y){l(!0),p(null);try{await i(X(t,o.trim()),[]),s(``),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{l(!1)}}};return(0,Q.jsxs)(`form`,{"data-slot":`assets-ask`,"aria-label":`Ask about this asset`,onSubmit:e=>void b(e),className:`shrink-0 border-t border-border bg-background px-2 py-2 sm:px-3`,children:[t?(0,Q.jsxs)(`span`,{"data-slot":`assets-ask-ref`,className:`mb-1.5 inline-flex max-w-full items-center gap-1 rounded-full border border-border bg-muted py-0.5 pr-0.5 pl-2 text-meta`,children:[(0,Q.jsx)(K,{"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`truncate`,title:`${t.ref} — ${t.label}`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:t.ref}),` `,t.label]}),(0,Q.jsx)(`button`,{type:`button`,"data-action":`assets-ask-ref-remove`,"aria-label":`Remove reference`,onClick:n,className:`rounded-full p-0.5 text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-3`})})]}):null,(0,Q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Q.jsx)(`textarea`,{"data-slot":`assets-ask-input`,"aria-label":t?`Ask about ${t.label||t.ref}`:`Ask the agent about this asset`,"aria-describedby":v||u?m:void 0,rows:1,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&b()},disabled:!!v,placeholder:t?`Ask or correct — ⌘↵ to send`:`Ask the agent about this report — click an element to reference it`,className:`max-h-32 min-h-9 flex-1 resize-y rounded-md border border-border bg-card px-2.5 py-2 text-ui focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:opacity-60`}),(0,Q.jsxs)(d,{type:`submit`,size:`sm`,"data-action":`assets-ask-send`,disabled:!y,"aria-busy":c||void 0,children:[c?(0,Q.jsx)(T,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(O,{"aria-hidden":`true`}),_?`Continue`:`Send`]})]}),v||u?(0,Q.jsx)(`p`,{id:m,"data-slot":`assets-ask-reason`,className:`mt-1 text-xs text-soft-foreground`,children:u??v}):null]})}var te=`No assets yet`,ne=`Agents publish pages here when they write to the run's artifacts folder.`;function re({runId:e,routed:t,run:n}){let r=i(e),s=l(),u=c(),[f,p]=(0,J.useState)(void 0),m=t?s.name:f,h=r.data?.artifacts??[],g=D(h,m),_=(0,J.useCallback)(n=>{t?u(`/tasks/${e}/assets/${encodeURIComponent(n)}`,{replace:!0}):p(n)},[u,t,e]),[v,y]=oe(),[S,C]=(0,J.useState)(0),[E,O]=(0,J.useState)(void 0),A=g?.kind===`html`?ie(r.data?.versions,g.name):[],j=A.at(-1)?.version,M=E&&g&&E.name===g.name&&E.version!==j&&A.some(e=>e.version===E.version)?E.version:void 0,N=(0,J.useRef)(null),[P,F]=(0,J.useState)(null);return Z(N,F),r.isPending?(0,Q.jsx)(z,{icon:(0,Q.jsx)(T,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading assets…`}):r.isError?(0,Q.jsx)(z,{icon:(0,Q.jsx)(L,{}),tone:`danger`,heading:`h2`,title:`Could not load this task's assets`,subtitle:r.error.message}):(0,Q.jsxs)(`section`,{"data-slot":`assets-view`,className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,Q.jsxs)(`div`,{"data-slot":`assets-toolbar`,role:`toolbar`,"aria-label":`Assets`,className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-2 sm:px-3`,children:[g?(0,Q.jsx)(se,{artifacts:h,current:g,onSelect:_}):(0,Q.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`Assets`}),g?.kind===`html`?(0,Q.jsxs)(`span`,{"data-slot":`assets-sandboxed`,title:`Runs in a sandbox: no access to cezar, your cookies or the network beyond pinned CDN scripts`,className:`hidden items-center gap-1 rounded-sm border border-border px-1.5 py-px text-meta text-muted-foreground sm:inline-flex`,children:[(0,Q.jsx)(G,{"aria-hidden":`true`,className:`size-3`}),`sandboxed`]}):null,g&&A.length>1?(0,Q.jsx)(ae,{versions:A,viewing:M,onSelect:e=>O(e===j?void 0:{name:g.name,version:e})}):null,M===void 0?null:(0,Q.jsxs)(`span`,{"data-slot":`assets-viewing-version`,className:`inline-flex items-center gap-1.5 text-meta text-muted-foreground`,children:[`Viewing v`,M,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`—`}),(0,Q.jsx)(`button`,{type:`button`,"data-action":`assets-version-current`,onClick:()=>O(void 0),className:`font-medium text-foreground underline underline-offset-2`,children:`back to current`})]}),r.data.truncated?(0,Q.jsxs)(`span`,{className:`hidden text-meta text-muted-foreground md:inline`,children:[`Showing the newest `,r.data.artifacts.length,` files; the folder has more`]}):null,(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,Q.jsx)(d,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-action":`assets-focus`,"aria-pressed":v,"aria-label":v?`Leave focus`:`Focus`,title:v?`Leave focus — bring the sidebar back`:`Focus — fold the sidebar to icons while Assets is open`,className:o(`text-muted-foreground`,v&&`bg-muted text-foreground`),onClick:()=>y(!v),children:v?(0,Q.jsx)(V,{"aria-hidden":`true`}):(0,Q.jsx)(U,{"aria-hidden":`true`})}),g?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,children:(0,Q.jsx)(`a`,{"data-action":`assets-open`,href:a(e,g.name,M),target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open in new tab`,title:`Open in new tab (still sandboxed)`,children:(0,Q.jsx)(x,{"aria-hidden":`true`})})}),(0,Q.jsx)(d,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,children:(0,Q.jsx)(`a`,{"data-action":`assets-download`,href:a(e,g.name,M),download:g.name,"aria-label":`Download`,title:`Download`,children:(0,Q.jsx)(b,{"aria-hidden":`true`})})}),(0,Q.jsx)(d,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-action":`assets-reload`,"aria-label":`Reload`,title:`Reload`,className:`text-muted-foreground`,onClick:()=>C(e=>e+1),children:(0,Q.jsx)(k,{"aria-hidden":`true`})})]}):null]})]}),g?(0,Q.jsx)(ce,{runId:e,artifact:g,version:M,frameRef:N},`${g.name}@${g.updatedAt}#${S}v${M??``}`):(0,Q.jsx)(z,{icon:(0,Q.jsx)(w,{}),tone:`neutral`,heading:`h2`,title:te,subtitle:ne}),n&&g?(0,Q.jsx)($,{run:n,reference:P,onClearReference:()=>F(null)}):null]})}function ie(e,t){return(e??[]).filter(e=>e.files.includes(t))}function ae({versions:e,viewing:t,onSelect:n}){let r=e.at(-1),i=t??r?.version;return(0,Q.jsxs)(y,{children:[(0,Q.jsx)(g,{asChild:!0,children:(0,Q.jsxs)(d,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`assets-versions`,"aria-label":`Version v${i} — pick another version`,className:`h-7 gap-1 px-2 text-label text-muted-foreground`,children:[(0,Q.jsx)(q,{"aria-hidden":`true`,className:`size-3.5`}),`v`,i,r&&t===void 0?(0,Q.jsxs)(`span`,{className:`hidden sm:inline`,children:[`· `,R(r.updatedAt),` ago`]}):null,(0,Q.jsx)(p,{"aria-hidden":`true`,className:`size-3.5 opacity-60`})]})}),(0,Q.jsxs)(_,{align:`start`,className:`w-56`,children:[(0,Q.jsx)(h,{children:`Versions`}),(0,Q.jsx)(m,{value:String(i),onValueChange:e=>n(Number(e)),children:[...e].reverse().map(e=>(0,Q.jsxs)(v,{value:String(e.version),"data-version":e.version,children:[`v`,e.version,` · `,R(e.updatedAt),` ago`,e.version===r?.version?(0,Q.jsx)(`span`,{className:`ml-auto text-meta text-muted-foreground`,children:`current`}):null]},e.version))})]})]})}function oe(){let[e,t]=(0,J.useState)(()=>j(`assets`)),n=(0,J.useCallback)(e=>{I(`assets`,e),t(e)},[]);return(0,J.useEffect)(()=>{if(e)return H(()=>n(!1))},[e,n]),[e,n]}function se({artifacts:e,current:t,onSelect:n}){let r=P(e);return(0,Q.jsxs)(y,{children:[(0,Q.jsx)(g,{asChild:!0,children:(0,Q.jsxs)(d,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`assets-switcher`,"aria-label":`Asset: ${M(t)} — switch asset`,className:`h-7 min-w-0 max-w-[min(28rem,60vw)] gap-1.5 px-2 text-ui font-medium`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:M(t)}),(0,Q.jsx)(`span`,{className:`shrink-0 text-meta font-normal text-muted-foreground`,children:E[t.kind]}),(0,Q.jsx)(p,{"aria-hidden":`true`,className:`size-3.5 shrink-0 opacity-60`})]})}),(0,Q.jsxs)(_,{align:`start`,className:`max-h-80 w-80 overflow-y-auto`,children:[(0,Q.jsxs)(h,{children:[e.length,` `,e.length===1?`asset`:`assets`]}),(0,Q.jsx)(m,{value:t.name,onValueChange:n,children:r.map(e=>(0,Q.jsx)(v,{value:e.name,"data-asset":e.name,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:M(e)}),(0,Q.jsxs)(`span`,{className:`truncate font-mono text-meta text-muted-foreground`,children:[e.name,` · `,E[e.kind],` · `,R(e.updatedAt)]})]})},e.name))})]})]})}function ce({runId:e,artifact:t,version:n,frameRef:r}){let i=W(),o=a(e,t.name,n);switch(t.kind){case`html`:return(0,Q.jsx)(`iframe`,{ref:r,"data-slot":`assets-frame`,title:M(t),src:`${o}#theme=${i}`,sandbox:A,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-background`});case`image`:return(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,Q.jsx)(`img`,{"data-slot":`assets-image`,src:o,alt:M(t),className:`max-w-full rounded-sm`})});case`markdown`:case`json`:return(0,Q.jsx)(le,{runId:e,artifact:t});case`other`:return(0,Q.jsx)(z,{icon:(0,Q.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`No preview for this file`,subtitle:`${t.name} — download it to open it locally.`,actions:(0,Q.jsx)(d,{asChild:!0,variant:`outline`,children:(0,Q.jsxs)(`a`,{"data-action":`assets-download-file`,href:o,download:t.name,children:[(0,Q.jsx)(b,{"aria-hidden":`true`}),`Download`]})})})}}function le({runId:e,artifact:t}){let n=r(e,t.name,t.updatedAt);return n.isPending?(0,Q.jsxs)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t.name,`…`]}):n.isError?(0,Q.jsx)(z,{icon:(0,Q.jsx)(L,{}),tone:`danger`,heading:`h2`,title:`Could not load this asset`,subtitle:n.error.message}):(0,Q.jsx)(`div`,{"data-slot":`assets-${t.kind}`,className:`min-h-0 flex-1 overflow-auto`,children:t.kind===`markdown`?(0,Q.jsx)(`div`,{className:`mx-auto max-w-3xl px-4 py-4`,children:(0,Q.jsx)(B,{children:n.data})}):(0,Q.jsx)(S,{path:t.name,text:n.data})})}export{re as AssetsView};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,wt as i,xa as a}from"./queries-ulWjkQ8y.js";import{t as o,wt as s}from"./utils-BdZWtrih.js";import{c,x as l}from"./project-router-BENNbi0L.js";import{N as u,t as d}from"./button-DlATnGEr.js";import{T as f}from"./run-actions-DH4E0sVZ.js";import{s as p}from"./dist-DuIPAwrM.js";import{a as m,i as h,l as g,n as _,o as v,t as y}from"./dropdown-menu-EpgT0bci.js";import{t as b}from"./download-fhhT22Gv.js";import{t as x}from"./external-link-65uYp9hQ.js";import{t as S}from"./file-preview-CGzA3pnM.js";import{t as C}from"./file-cgpPGziJ.js";import{t as w}from"./layers-lugEOu8L.js";import{t as T}from"./loader-circle-BHoeiDvX.js";import{a as E,c as D,d as O,f as k,i as A,l as j,o as M,r as N,s as P,t as F,u as I}from"./follow-up-engine-Csx5YQhI.js";import{t as L}from"./triangle-alert-CwLmF9Ne.js";import{t as ee}from"./x-2UhdkEEP.js";import{n as R}from"./format-DHK74MwW.js";import{t as z}from"./centered-state-DX6Gs7Sn.js";import{t as B}from"./markdown-BtpIXTjY.js";import{Ot as V,ct as H,kt as U,mt as W,wt as G}from"./index-DkeOxdSy.js";var K=u(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),q=u(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),J=e(t(),1);function Y(e){let t=s.safeParse(e);return t.success?{ref:t.data.ref,label:t.data.label.slice(0,200)}:null}function X(e,t){return e?`About ${e.ref} ("${e.label}"): ${t}`:t}function Z(e,t){let n=(0,J.useRef)(t);n.current=t,(0,J.useEffect)(()=>{let t=t=>{let r=e.current?.contentWindow;if(!r||t.source!==r)return;let i=Y(t.data);i&&n.current(i)};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[e])}var Q=n();function $({run:e,reference:t,onClearReference:n}){let r=F(e),i=N(e,r.continueWith),a=f(e),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1),[u,p]=(0,J.useState)(null),m=(0,J.useId)(),h=e.status===`running`||e.status===`waiting`,g=e.status===`queued`,_=!h&&!g&&r.available;if(!h&&!g&&!_||e.worktreeLifecycle?.activeOperationId)return null;let v=h&&!a.usable?a.reason:_&&!r.canContinue?r.reason??`No provider can continue this task.`:void 0,y=!v&&!c&&o.trim()!==``,b=async e=>{if(e?.preventDefault(),y){l(!0),p(null);try{await i(X(t,o.trim()),[]),s(``),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{l(!1)}}};return(0,Q.jsxs)(`form`,{"data-slot":`assets-ask`,"aria-label":`Ask about this asset`,onSubmit:e=>void b(e),className:`shrink-0 border-t border-border bg-background px-2 py-2 sm:px-3`,children:[t?(0,Q.jsxs)(`span`,{"data-slot":`assets-ask-ref`,className:`mb-1.5 inline-flex max-w-full items-center gap-1 rounded-full border border-border bg-muted py-0.5 pr-0.5 pl-2 text-meta`,children:[(0,Q.jsx)(K,{"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`truncate`,title:`${t.ref} — ${t.label}`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:t.ref}),` `,t.label]}),(0,Q.jsx)(`button`,{type:`button`,"data-action":`assets-ask-ref-remove`,"aria-label":`Remove reference`,onClick:n,className:`rounded-full p-0.5 text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-3`})})]}):null,(0,Q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Q.jsx)(`textarea`,{"data-slot":`assets-ask-input`,"aria-label":t?`Ask about ${t.label||t.ref}`:`Ask the agent about this asset`,"aria-describedby":v||u?m:void 0,rows:1,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&b()},disabled:!!v,placeholder:t?`Ask or correct — ⌘↵ to send`:`Ask the agent about this report — click an element to reference it`,className:`max-h-32 min-h-9 flex-1 resize-y rounded-md border border-border bg-card px-2.5 py-2 text-ui focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:opacity-60`}),(0,Q.jsxs)(d,{type:`submit`,size:`sm`,"data-action":`assets-ask-send`,disabled:!y,"aria-busy":c||void 0,children:[c?(0,Q.jsx)(T,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(O,{"aria-hidden":`true`}),_?`Continue`:`Send`]})]}),v||u?(0,Q.jsx)(`p`,{id:m,"data-slot":`assets-ask-reason`,className:`mt-1 text-xs text-soft-foreground`,children:u??v}):null]})}var te=`No assets yet`,ne=`Agents publish pages here when they write to the run's artifacts folder.`;function re({runId:e,routed:t,run:n}){let r=i(e),s=l(),u=c(),[f,p]=(0,J.useState)(void 0),m=t?s.name:f,h=r.data?.artifacts??[],g=D(h,m),_=(0,J.useCallback)(n=>{t?u(`/tasks/${e}/assets/${encodeURIComponent(n)}`,{replace:!0}):p(n)},[u,t,e]),[v,y]=oe(),[S,C]=(0,J.useState)(0),[E,O]=(0,J.useState)(void 0),A=g?.kind===`html`?ie(r.data?.versions,g.name):[],j=A.at(-1)?.version,M=E&&g&&E.name===g.name&&E.version!==j&&A.some(e=>e.version===E.version)?E.version:void 0,N=(0,J.useRef)(null),[P,F]=(0,J.useState)(null);return Z(N,F),r.isPending?(0,Q.jsx)(z,{icon:(0,Q.jsx)(T,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading assets…`}):r.isError?(0,Q.jsx)(z,{icon:(0,Q.jsx)(L,{}),tone:`danger`,heading:`h2`,title:`Could not load this task's assets`,subtitle:r.error.message}):(0,Q.jsxs)(`section`,{"data-slot":`assets-view`,className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,Q.jsxs)(`div`,{"data-slot":`assets-toolbar`,role:`toolbar`,"aria-label":`Assets`,className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-2 sm:px-3`,children:[g?(0,Q.jsx)(se,{artifacts:h,current:g,onSelect:_}):(0,Q.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`Assets`}),g?.kind===`html`?(0,Q.jsxs)(`span`,{"data-slot":`assets-sandboxed`,title:`Runs in a sandbox: no access to cezar, your cookies or the network beyond pinned CDN scripts`,className:`hidden items-center gap-1 rounded-sm border border-border px-1.5 py-px text-meta text-muted-foreground sm:inline-flex`,children:[(0,Q.jsx)(G,{"aria-hidden":`true`,className:`size-3`}),`sandboxed`]}):null,g&&A.length>1?(0,Q.jsx)(ae,{versions:A,viewing:M,onSelect:e=>O(e===j?void 0:{name:g.name,version:e})}):null,M===void 0?null:(0,Q.jsxs)(`span`,{"data-slot":`assets-viewing-version`,className:`inline-flex items-center gap-1.5 text-meta text-muted-foreground`,children:[`Viewing v`,M,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`—`}),(0,Q.jsx)(`button`,{type:`button`,"data-action":`assets-version-current`,onClick:()=>O(void 0),className:`font-medium text-foreground underline underline-offset-2`,children:`back to current`})]}),r.data.truncated?(0,Q.jsxs)(`span`,{className:`hidden text-meta text-muted-foreground md:inline`,children:[`Showing the newest `,r.data.artifacts.length,` files; the folder has more`]}):null,(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,Q.jsx)(d,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-action":`assets-focus`,"aria-pressed":v,"aria-label":v?`Leave focus`:`Focus`,title:v?`Leave focus — bring the sidebar back`:`Focus — fold the sidebar to icons while Assets is open`,className:o(`text-muted-foreground`,v&&`bg-muted text-foreground`),onClick:()=>y(!v),children:v?(0,Q.jsx)(V,{"aria-hidden":`true`}):(0,Q.jsx)(U,{"aria-hidden":`true`})}),g?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,children:(0,Q.jsx)(`a`,{"data-action":`assets-open`,href:a(e,g.name,M),target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open in new tab`,title:`Open in new tab (still sandboxed)`,children:(0,Q.jsx)(x,{"aria-hidden":`true`})})}),(0,Q.jsx)(d,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,children:(0,Q.jsx)(`a`,{"data-action":`assets-download`,href:a(e,g.name,M),download:g.name,"aria-label":`Download`,title:`Download`,children:(0,Q.jsx)(b,{"aria-hidden":`true`})})}),(0,Q.jsx)(d,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-action":`assets-reload`,"aria-label":`Reload`,title:`Reload`,className:`text-muted-foreground`,onClick:()=>C(e=>e+1),children:(0,Q.jsx)(k,{"aria-hidden":`true`})})]}):null]})]}),g?(0,Q.jsx)(ce,{runId:e,artifact:g,version:M,frameRef:N},`${g.name}@${g.updatedAt}#${S}v${M??``}`):(0,Q.jsx)(z,{icon:(0,Q.jsx)(w,{}),tone:`neutral`,heading:`h2`,title:te,subtitle:ne}),n&&g?(0,Q.jsx)($,{run:n,reference:P,onClearReference:()=>F(null)}):null]})}function ie(e,t){return(e??[]).filter(e=>e.files.includes(t))}function ae({versions:e,viewing:t,onSelect:n}){let r=e.at(-1),i=t??r?.version;return(0,Q.jsxs)(y,{children:[(0,Q.jsx)(g,{asChild:!0,children:(0,Q.jsxs)(d,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`assets-versions`,"aria-label":`Version v${i} — pick another version`,className:`h-7 gap-1 px-2 text-label text-muted-foreground`,children:[(0,Q.jsx)(q,{"aria-hidden":`true`,className:`size-3.5`}),`v`,i,r&&t===void 0?(0,Q.jsxs)(`span`,{className:`hidden sm:inline`,children:[`· `,R(r.updatedAt),` ago`]}):null,(0,Q.jsx)(p,{"aria-hidden":`true`,className:`size-3.5 opacity-60`})]})}),(0,Q.jsxs)(_,{align:`start`,className:`w-56`,children:[(0,Q.jsx)(h,{children:`Versions`}),(0,Q.jsx)(m,{value:String(i),onValueChange:e=>n(Number(e)),children:[...e].reverse().map(e=>(0,Q.jsxs)(v,{value:String(e.version),"data-version":e.version,children:[`v`,e.version,` · `,R(e.updatedAt),` ago`,e.version===r?.version?(0,Q.jsx)(`span`,{className:`ml-auto text-meta text-muted-foreground`,children:`current`}):null]},e.version))})]})]})}function oe(){let[e,t]=(0,J.useState)(()=>j(`assets`)),n=(0,J.useCallback)(e=>{I(`assets`,e),t(e)},[]);return(0,J.useEffect)(()=>{if(e)return H(()=>n(!1))},[e,n]),[e,n]}function se({artifacts:e,current:t,onSelect:n}){let r=P(e);return(0,Q.jsxs)(y,{children:[(0,Q.jsx)(g,{asChild:!0,children:(0,Q.jsxs)(d,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`assets-switcher`,"aria-label":`Asset: ${M(t)} — switch asset`,className:`h-7 min-w-0 max-w-[min(28rem,60vw)] gap-1.5 px-2 text-ui font-medium`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:M(t)}),(0,Q.jsx)(`span`,{className:`shrink-0 text-meta font-normal text-muted-foreground`,children:E[t.kind]}),(0,Q.jsx)(p,{"aria-hidden":`true`,className:`size-3.5 shrink-0 opacity-60`})]})}),(0,Q.jsxs)(_,{align:`start`,className:`max-h-80 w-80 overflow-y-auto`,children:[(0,Q.jsxs)(h,{children:[e.length,` `,e.length===1?`asset`:`assets`]}),(0,Q.jsx)(m,{value:t.name,onValueChange:n,children:r.map(e=>(0,Q.jsx)(v,{value:e.name,"data-asset":e.name,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:M(e)}),(0,Q.jsxs)(`span`,{className:`truncate font-mono text-meta text-muted-foreground`,children:[e.name,` · `,E[e.kind],` · `,R(e.updatedAt)]})]})},e.name))})]})]})}function ce({runId:e,artifact:t,version:n,frameRef:r}){let i=W(),o=a(e,t.name,n);switch(t.kind){case`html`:return(0,Q.jsx)(`iframe`,{ref:r,"data-slot":`assets-frame`,title:M(t),src:`${o}#theme=${i}`,sandbox:A,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-background`});case`image`:return(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,Q.jsx)(`img`,{"data-slot":`assets-image`,src:o,alt:M(t),className:`max-w-full rounded-sm`})});case`markdown`:case`json`:return(0,Q.jsx)(le,{runId:e,artifact:t});case`other`:return(0,Q.jsx)(z,{icon:(0,Q.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`No preview for this file`,subtitle:`${t.name} — download it to open it locally.`,actions:(0,Q.jsx)(d,{asChild:!0,variant:`outline`,children:(0,Q.jsxs)(`a`,{"data-action":`assets-download-file`,href:o,download:t.name,children:[(0,Q.jsx)(b,{"aria-hidden":`true`}),`Download`]})})})}}function le({runId:e,artifact:t}){let n=r(e,t.name,t.updatedAt);return n.isPending?(0,Q.jsxs)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t.name,`…`]}):n.isError?(0,Q.jsx)(z,{icon:(0,Q.jsx)(L,{}),tone:`danger`,heading:`h2`,title:`Could not load this asset`,subtitle:n.error.message}):(0,Q.jsx)(`div`,{"data-slot":`assets-${t.kind}`,className:`min-h-0 flex-1 overflow-auto`,children:t.kind===`markdown`?(0,Q.jsx)(`div`,{className:`mx-auto max-w-3xl px-4 py-4`,children:(0,Q.jsx)(B,{children:n.data})}):(0,Q.jsx)(S,{path:t.name,text:n.data})})}export{re as AssetsView};