meshy-node 0.10.8 → 0.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dashboard/assets/{DashboardPage-BA5_31Nu.js → DashboardPage-bZy6ZY6K.js} +43 -43
- package/dashboard/assets/{DashboardShared-BfK1KyJO.js → DashboardShared-CrDF53oL.js} +2 -2
- package/dashboard/assets/{DiffTab-BPQY3AYd.js → DiffTab-CNBS3yRm.js} +1 -1
- package/dashboard/assets/{FilesTab-91w4HaID.js → FilesTab-BHeht0ZL.js} +2 -2
- package/dashboard/assets/{MarkdownPreviewFrame-C56qjNyn.js → MarkdownPreviewFrame-L2oxne--.js} +1 -1
- package/dashboard/assets/{PreviewTab-DQ4yhJji.js → PreviewTab-UMpaLVaV.js} +1 -1
- package/dashboard/assets/SharedConversationPage-CTyYVCbw.js +2 -0
- package/dashboard/assets/{file-DQcCuz7j.js → file-BgR9-rpB.js} +1 -1
- package/dashboard/assets/{index-BvnWYZW6.js → index-D260dUEm.js} +2 -2
- package/dashboard/index.html +1 -1
- package/main.cjs +32 -9
- package/package.json +1 -1
- package/runtime-metadata.json +4 -4
- package/dashboard/assets/SharedConversationPage-hiwRfWZA.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as be,j as m,G as Ml,aq as Fl,d as $e,H as Ol,J as Rl,ar as Bl,Z as $l,bQ as Kr,T as Zr,o as _t,bR as Ul,bS as Hl,bT as ql,bU as ei,r as fe,B as At,C as He,X as ti,V as Vl,y as Wl,L as Gl,M as ni}from"./index-
|
|
1
|
+
import{c as be,j as m,G as Ml,aq as Fl,d as $e,H as Ol,J as Rl,ar as Bl,Z as $l,bQ as Kr,T as Zr,o as _t,bR as Ul,bS as Hl,bT as ql,bU as ei,r as fe,B as At,C as He,X as ti,V as Vl,y as Wl,L as Gl,M as ni}from"./index-D260dUEm.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -81,4 +81,4 @@ import{c as be,j as m,G as Ml,aq as Fl,d as $e,H as Ol,J as Rl,ar as Bl,Z as $l,
|
|
|
81
81
|
`)}function zh(e){if(typeof e=="number"&&Number.isFinite(e))return Number.isNaN(new Date(e).getTime())?null:{raw:String(e),time:e};if(typeof e=="string"&&e.trim().length>0){const t=Date.parse(e);return Number.isNaN(t)?null:{raw:e,time:t}}return null}function Lh(e){const t=new Date(e.time),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),l=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${n}-${r}-${i} ${l}:${o}:${s}`}function Al({text:e,tone:t="default",size:n="default",className:r="",taskRootPath:i,onOpenFilePath:l}){const o=t==="inverted",s=n==="compact"?"text-[10px] leading-4":"text-[11px] leading-[17px]",a=o?"underline decoration-current/45 underline-offset-2 hover:decoration-current":"underline decoration-current/35 underline-offset-2 hover:decoration-current",u=o?"rounded-sm bg-black/15 px-1 py-0.5 font-mono text-[10px] text-primary-foreground":"rounded-sm bg-muted/80 px-1 py-0.5 font-mono text-[10px] text-foreground",f=o?"overflow-x-auto rounded-md border border-primary-foreground/12 bg-black/15 px-3 py-2 font-mono text-[10px] leading-4 text-primary-foreground":"overflow-x-auto rounded-md border border-border/45 bg-muted/50 px-3 py-2 font-mono text-[10px] leading-4 text-foreground",c=o?"w-full border-collapse text-left text-[11px] text-primary-foreground":"w-full border-collapse text-left text-[11px] text-foreground",h=o?"border border-primary-foreground/20 px-2 py-1 align-top":"border border-border/60 px-2 py-1 align-top",p=o?"border-l-2 border-primary-foreground/30 pl-3 italic text-primary-foreground/90":"border-l-2 border-border pl-3 italic text-muted-foreground";return m.jsx("div",{className:[`max-w-none break-words ${s} [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>*+*]:mt-2 [&_li>p]:my-0`,r].filter(Boolean).join(" "),children:m.jsx(Qc,{remarkPlugins:[hh,uf],components:{a:({node:d,href:k,...w})=>{const y=l?Ch(k,i):null,A=l&&!y&&!i&&Sh(k)?k?.trim()??null:null,v=y??A;return v?m.jsx("a",{...w,href:k,"data-task-file-link":v,"data-task-file-link-unresolved":y?void 0:"true",className:a,onClick:_=>{_.preventDefault(),l?.(v)}}):m.jsx("a",{...w,href:k,target:"_blank",rel:"noreferrer noopener",className:a,onClick:_=>Qr(_,k)})},blockquote:({node:d,...k})=>m.jsx("blockquote",{...k,className:p}),code:({node:d,className:k,children:w,...y})=>k?m.jsx("code",{...y,className:k,children:w}):m.jsx("code",{...y,className:u,children:w}),h1:({node:d,...k})=>m.jsx("h1",{...k,className:"text-[14px] font-semibold leading-5"}),h2:({node:d,...k})=>m.jsx("h2",{...k,className:"text-[13px] font-semibold leading-5"}),h3:({node:d,...k})=>m.jsx("h3",{...k,className:"text-[12px] font-semibold leading-5"}),h4:({node:d,...k})=>m.jsx("h4",{...k,className:"text-[11px] font-semibold leading-4"}),hr:({node:d,...k})=>m.jsx("hr",{...k,className:o?"border-primary-foreground/20":"border-border"}),img:({node:d,alt:k,src:w})=>w?m.jsx("a",{href:w,target:"_blank",rel:"noreferrer noopener",className:a,onClick:y=>Qr(y,w),children:k?.trim()||w}):m.jsx("span",{children:k?.trim()||"Image"}),ol:({node:d,...k})=>m.jsx("ol",{...k,className:"list-decimal space-y-0.5 pl-5"}),p:({node:d,...k})=>m.jsx("p",{...k,className:"my-0"}),pre:({node:d,...k})=>m.jsx("pre",{...k,className:f}),table:({node:d,...k})=>m.jsx("table",{...k,className:c}),td:({node:d,...k})=>m.jsx("td",{...k,className:h}),th:({node:d,...k})=>m.jsx("th",{...k,className:`${h} font-semibold`}),ul:({node:d,...k})=>m.jsx("ul",{...k,className:"list-disc space-y-0.5 pl-5"})},children:e})})}function El({text:e,className:t=""}){const[n,r]=fe.useState(!1);if(!e)return null;const i=async l=>{l.stopPropagation();try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return m.jsx("button",{type:"button",onClick:i,"aria-label":n?"Copied":"Copy message",className:`flex h-6 w-6 items-center justify-center rounded-sm border border-border/60 bg-background/86 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-all hover:-translate-y-px hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:n?m.jsx(He,{className:"h-3 w-3 text-emerald-500"}):m.jsx(ni,{className:"h-3 w-3"})})}async function Dh(e){let n=await(await fetch(e)).blob();n.type!=="image/png"&&(n=await Mh(n)),await navigator.clipboard.write([new ClipboardItem({[n.type]:n})])}async function Mh(e){const t=await createImageBitmap(e),n=document.createElement("canvas");n.width=t.width,n.height=t.height;const r=n.getContext("2d");if(!r)throw new Error("canvas 2d context unavailable");return r.drawImage(t,0,0),await new Promise((i,l)=>{n.toBlob(o=>o?i(o):l(new Error("toBlob failed")),"image/png")})}function Fh({dataUrl:e,className:t=""}){const[n,r]=fe.useState(!1),i=async l=>{l.stopPropagation();try{await Dh(e),r(!0),setTimeout(()=>r(!1),1500)}catch(o){console.error("copy image failed",o)}};return m.jsx("button",{type:"button",onClick:i,"aria-label":n?"Copied":"Copy image",className:`flex h-6 w-6 items-center justify-center rounded-sm border border-border/60 bg-background/86 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-all hover:-translate-y-px hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:n?m.jsx(He,{className:"h-3 w-3 text-emerald-500"}):m.jsx(ni,{className:"h-3 w-3"})})}function Oh({content:e,sentAsGoal:t=!1,taskRootPath:n,onOpenFilePath:r}){const i=ho(e),l=e.filter(o=>o.type==="image");return m.jsx("div",{className:"animate-message-send flex w-full max-w-full min-w-0 justify-end",children:m.jsxs("div",{className:"group relative flex min-w-0 max-w-[88%] items-start gap-2",children:[m.jsx(El,{text:i,className:"absolute -left-8 top-5"}),m.jsxs("div",{className:"flex min-w-0 max-w-full flex-col items-end gap-0.5",children:[m.jsxs("div",{className:"flex max-w-full items-center justify-end gap-1.5 pr-0.5",children:[m.jsx("span",{className:"shrink-0 text-[8px] font-semibold uppercase tracking-[0.16em] text-muted-foreground/72",children:"You"}),t&&m.jsxs("span",{"data-message-goal-label":"true",title:"Sent as Codex goal",className:"inline-flex h-4 max-w-full items-center gap-1 rounded-sm border border-border/45 bg-background/85 px-1.5 text-[9px] font-medium leading-3 tracking-normal text-muted-foreground shadow-none",children:[m.jsx(oo,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":"true"}),m.jsx("span",{className:"truncate",children:"Sent as goal"})]})]}),m.jsxs("div",{className:"max-w-full space-y-1 overflow-hidden rounded-lg rounded-br-md bg-primary px-3 py-2 text-[10px] leading-4 text-primary-foreground shadow-[0_16px_52px_-38px_hsl(var(--primary)/0.9)]",children:[i&&m.jsx(Al,{text:i,tone:"inverted",size:"compact",taskRootPath:n,onOpenFilePath:r}),l.length>0&&m.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:l.map((o,s)=>{const a=ii(o);return m.jsxs("div",{className:"relative",children:[m.jsx(Fo,{image:o,alt:o.filename??`attachment ${s+1}`,thumbnailClassName:"w-full border border-primary-foreground/15",imageClassName:"max-h-72 w-full"}),m.jsx(Fh,{dataUrl:a,className:"absolute right-2 top-2"})]},`${o.filename??"image"}-${s}`)})})]})]}),m.jsx("div",{className:"mt-4 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm bg-primary/8 text-primary",children:m.jsx(ao,{className:"h-3.5 w-3.5"})})]})})}function lt({agent:e,children:t,timestamp:n}){const r=e?ai(e):"Agent",i=zh(n);return m.jsx("div",{className:"animate-message-receive flex w-full max-w-full min-w-0 justify-start",children:m.jsxs("div",{className:"flex w-full min-w-0 max-w-[92%] items-start gap-2",children:[m.jsx("div",{className:"mt-4 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm bg-muted/45 text-muted-foreground/82",children:m.jsx(oi,{agent:e??"",className:"h-3.5 w-3.5"})}),m.jsxs("div",{className:"min-w-0 max-w-full flex-1 space-y-1",children:[m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsx("div",{className:"text-[8px] font-semibold uppercase tracking-[0.16em] text-muted-foreground/72","data-agent-speaker-label":r,children:r}),i&&m.jsx("span",{className:"shrink-0 rounded-sm bg-muted/18 px-1 py-0.5 text-[8px] font-mono font-medium leading-3 tabular-nums text-muted-foreground/54","data-agent-message-timestamp":i.raw,children:Lh(i)})]}),t]})]})})}function Rh({event:e,agent:t,subItems:n=[],questionBypassEnabled:r,onQuestionBypassChange:i,onSubmitQuestionResponse:l,questionResponseDisabled:o,taskRootPath:s,onOpenFilePath:a}){const u=e.message;if(!u)return null;const f=ft(u);if(f)return m.jsx(lt,{agent:t,children:m.jsx(ut,{payload:f,bypassEnabled:r,onBypassChange:i,onSubmit:l,disabled:o})});const c=u.content;if(!c||!Array.isArray(c))return null;const h=new Set,p=c.filter(I=>I.type==="text"||I.type==="commentary").map(I=>({...I,text:nn(String(I.text??"")),questionPayload:pt(nn(String(I.text??"")))})).filter(I=>I.text.length>0||I.questionPayload),d=c.filter(I=>I.type==="thinking").map(I=>nn(String(I.thinking??""))).filter(Boolean).join(`
|
|
82
82
|
|
|
83
83
|
`),k=c.filter(I=>I.type==="tool_use"),w=c.filter(I=>I.type==="tool_result"),y=typeof e.timestamp=="string"||typeof e.timestamp=="number"?e.timestamp:void 0,A=p.length>0,_=[...A&&(d.length>0||k.length>0||w.length>0)?[{type:"assistant",...y!==void 0?{timestamp:y}:{},message:{content:[...d.length>0?[{type:"thinking",thinking:d}]:[],...k,...w]}}]:[],...n],D=xh(_);return p.length>0||d.length>0||k.length>0||w.length>0||D?m.jsxs(lt,{agent:t,timestamp:y,children:[p.map((I,O)=>{if(I.questionPayload){const B=Ve(I.questionPayload);return h.has(B)?null:(h.add(B),m.jsx(ut,{payload:I.questionPayload,bypassEnabled:r,onBypassChange:i,onSubmit:l,disabled:o},O))}return m.jsxs("div",{className:"group relative max-w-full overflow-hidden rounded-lg rounded-bl-md bg-card/72 px-3 py-2 text-[11px] leading-[17px] text-foreground shadow-[0_14px_48px_-42px_rgba(15,23,42,0.65)] backdrop-blur-sm dark:bg-card/68 dark:shadow-[0_14px_48px_-42px_rgba(0,0,0,0.9)]",children:[m.jsx(El,{text:I.text,className:"absolute right-2 top-2"}),m.jsx(Al,{text:I.text,taskRootPath:s,onOpenFilePath:a})]},O)}),D&&m.jsx(yh,{events:_,questionBypassEnabled:r,onQuestionBypassChange:i,onSubmitQuestionResponse:l,questionResponseDisabled:o}),d.length>0&&!A&&m.jsx(xl,{text:d}),!A&&k.map((I,O)=>m.jsx(yl,{block:I,renderedQuestionSignatures:h,questionBypassEnabled:r,onQuestionBypassChange:i,onSubmitQuestionResponse:l,questionResponseDisabled:o},O)),!A&&w.map((I,O)=>m.jsx(Hn,{block:I,renderedQuestionSignatures:h,questionBypassEnabled:r,onQuestionBypassChange:i,onSubmitQuestionResponse:l,questionResponseDisabled:o},O))]}):null}function vt(e){return typeof e=="object"&&e!==null}function Bh(e){const t=e.message;return vt(t)&&Array.isArray(t.content)?t.content.filter(vt):Array.isArray(e.content)?e.content.filter(vt):[]}function $h(e){const t=e.content;return typeof t=="string"?t:Array.isArray(t)?t.filter(vt).map(n=>String(n.text??"")).join(`
|
|
84
|
-
`):""}function Uh(e){return ft(e)?!0:e.type==="tool_result"&&pt($h(e))!==null}function Hh(e){const t=Bh(e);return t.length===0||t.some(Uh)?!1:e.type==="assistant"?t.every(n=>n.type==="thinking"||n.type==="tool_use"||n.type==="tool_result"):e.type==="user"?t.every(n=>n.type==="tool_result"):!1}function bm(e){const t=[];let n=[];const r=()=>{if(n.length===0)return;const i=typeof n[0]?.timestamp=="string"?n[0].timestamp:void 0;t.push({event:{type:"assistant",message:{role:"assistant",content:[]},...i?{timestamp:i}:{}},subItems:n}),n=[]};for(const i of e){if(Hh(i)){n.push(i);continue}r(),t.push({event:i,subItems:[]})}return r(),t}function wm({label:e,value:t}){return m.jsxs("div",{className:"min-w-[4.75rem] flex-1 rounded-sm bg-muted/45 px-2 py-1.5 shadow-none",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:e}),m.jsx("div",{className:"mt-0.5 text-[11px] font-semibold leading-4 tracking-tight text-foreground",children:t})]})}function Sm({label:e}){return m.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-muted-foreground",children:e})}function Cm({label:e,value:t,mono:n,action:r}){return m.jsxs("div",{className:"grid grid-cols-[3.75rem,minmax(0,1fr)] items-start gap-1.5",children:[m.jsx("span",{className:"pt-px text-[8px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:e}),m.jsxs("div",{className:"flex min-w-0 items-start gap-1",children:[m.jsx("span",{className:$e("min-w-0 flex-1 break-all text-[9px] leading-[0.95rem] text-foreground",n&&"font-mono"),children:t}),r]})]})}function vm({label:e,value:t,mono:n}){return m.jsxs("div",{className:"rounded-sm bg-muted/45 px-2 py-1.5 shadow-none",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:e}),m.jsx("div",{className:$e("mt-0.5 text-[9px] font-medium leading-[0.95rem] text-foreground",n&&"font-mono"),children:t})]})}export{
|
|
84
|
+
`):""}function Uh(e){return ft(e)?!0:e.type==="tool_result"&&pt($h(e))!==null}function Hh(e){const t=Bh(e);return t.length===0||t.some(Uh)?!1:e.type==="assistant"?t.every(n=>n.type==="thinking"||n.type==="tool_use"||n.type==="tool_result"):e.type==="user"?t.every(n=>n.type==="tool_result"):!1}function bm(e){const t=[];let n=[];const r=()=>{if(n.length===0)return;const i=typeof n[0]?.timestamp=="string"?n[0].timestamp:void 0;t.push({event:{type:"assistant",message:{role:"assistant",content:[]},...i?{timestamp:i}:{}},subItems:n}),n=[]};for(const i of e){if(Hh(i)){n.push(i);continue}r(),t.push({event:i,subItems:[]})}return r(),t}function wm({label:e,value:t}){return m.jsxs("div",{className:"min-w-[4.75rem] flex-1 rounded-sm bg-muted/45 px-2 py-1.5 shadow-none",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:e}),m.jsx("div",{className:"mt-0.5 text-[11px] font-semibold leading-4 tracking-tight text-foreground",children:t})]})}function Sm({label:e}){return m.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-muted-foreground",children:e})}function Cm({label:e,value:t,mono:n,action:r}){return m.jsxs("div",{className:"grid grid-cols-[3.75rem,minmax(0,1fr)] items-start gap-1.5",children:[m.jsx("span",{className:"pt-px text-[8px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:e}),m.jsxs("div",{className:"flex min-w-0 items-start gap-1",children:[m.jsx("span",{className:$e("min-w-0 flex-1 break-all text-[9px] leading-[0.95rem] text-foreground",n&&"font-mono"),children:t}),r]})]})}function vm({label:e,value:t,mono:n}){return m.jsxs("div",{className:"rounded-sm bg-muted/45 px-2 py-1.5 shadow-none",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:e}),m.jsx("div",{className:$e("mt-0.5 text-[9px] font-medium leading-[0.95rem] text-foreground",n&&"font-mono"),children:t})]})}export{gi as $,oi as A,wt as B,km as C,wm as D,tm as E,Sl as F,Cl as G,mm as H,Fo as I,hm as J,dm as K,eo as L,vm as M,gm as N,Ch as O,Zo as P,pm as Q,fm as R,an as S,oo as T,ns as U,vn as V,cm as W,$o as X,rs as Y,An as Z,Mn as _,ai as a,It as a0,cs as a1,Qc as a2,hh as a3,Vh as b,xm as c,om as d,Jh as e,am as f,im as g,um as h,rm as i,lm as j,sm as k,ym as l,bm as m,Yh as n,Sm as o,jh as p,qe as q,Xh as r,Cm as s,Kh as t,em as u,Qh as v,Zh as w,nm as x,Wh as y,Gh as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as _,j as n,d as j,r as l,b_ as Q,bV as X,y as V,n as B,a1 as Y,l as Z}from"./index-
|
|
1
|
+
import{c as _,j as n,d as j,r as l,b_ as Q,bV as X,y as V,n as B,a1 as Y,l as Z}from"./index-D260dUEm.js";import{A as ee,G as ne}from"./DashboardPage-bZy6ZY6K.js";import{F as te}from"./file-BgR9-rpB.js";import"./DashboardShared-CrDF53oL.js";import"./MarkdownPreviewFrame-L2oxne--.js";import"./PreviewTab-UMpaLVaV.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as fe,r as i,bV as je,bW as ke,bX as Ne,j as t,l as oe,B as P,x as le,X as Se,n as Ce,d as x,t as
|
|
1
|
+
import{c as fe,r as i,bV as je,bW as ke,bX as Ne,j as t,l as oe,B as P,x as le,X as Se,n as Ce,d as x,t as Fe}from"./index-D260dUEm.js";import{E as Ee,M as Pe,L as De}from"./MarkdownPreviewFrame-L2oxne--.js";import{F as L,G as Te,H as _e,J as Oe,K as ze,N as Re,O as $e}from"./DashboardShared-CrDF53oL.js";import{F as Ae}from"./file-BgR9-rpB.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{c as fe,r as i,bV as je,bW as ke,bX as Ne,j as t,l as oe,B as P,x as le,X
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Le=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Me=fe("download",Le),Ue="save_dashboard_download";function me(e=xe()){const n=e?.__TAURI__?.core?.invoke;return typeof n=="function"?n:null}function He(e){const d=(e.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop()??"").replace(/[<>:"/\\|?*\x00-\x1f]/g,"_").replace(/^[ .]+|[ .]+$/g,"");return d.length>0?d:"download"}async function Ke({href:e,filePath:n,currentWindow:o=xe(),fetchImpl:d=fetch}){const c=me(o);if(!c)return!1;const l=await d(e,{cache:"no-store"});if(!l.ok)throw new Error(`Failed to download file (${l.status})`);const M=await l.blob(),k=await Xe(M),N=await c(Ue,{fileName:He(n),contentBase64:k});return!Je(N)||N.saved!==!1}async function Xe(e){const n=new Uint8Array(await e.arrayBuffer()),o=[],d=32768;for(let c=0;c<n.length;c+=d){const l=n.subarray(c,c+d);o.push(String.fromCharCode(...l))}return btoa(o.join(""))}function xe(){return typeof window>"u"?null:window}function Je(e){return!!(e&&typeof e=="object"&&"saved"in e)}const Qe={getOutput:Ne,getOutputTree:ke,getOutputContent:je},ce=120,Ve=1200;function at({taskId:e,api:n=Qe,requestedFilePath:o=null,requestedFileRequestId:d=0,onPreviewFile:c}){const[l,M]=i.useState(null),[k,N]=i.useState([]),[S,Z]=i.useState({}),[C,D]=i.useState(new Set),[U,H]=i.useState(new Set),[g,T]=i.useState("."),[h,E]=i.useState(null),[ge,v]=i.useState(!1),[y,b]=i.useState(""),[q,_]=i.useState([]),[ee,O]=i.useState(!1),[te,z]=i.useState(null),[K,R]=i.useState(!0),[re,f]=i.useState(null),ae=i.useRef(null),X=i.useRef(null),m=l?.summary?.rootPath??l?.effectiveProjectPath??null,J=y.trim(),w=J.length>0,p=ge||y.length>0,se=i.useCallback(async()=>{f(null),R(!0),T("."),N([]),Z({}),D(new Set),H(new Set),E(null),v(!1),b(""),_([]),z(null),X.current=null;try{const a=await n.getOutput(e);if(M(a),!a.available){R(!1);return}const r=await n.getOutputTree(e,".");N(r.entries),R(!1)}catch(a){f(a instanceof Error?a.message:"Failed to load output"),R(!1)}},[n,e]);i.useEffect(()=>{se()},[se]);const $=i.useCallback(async a=>{const r=L(a,m);if(!r)return f("Invalid directory path"),[];if(S[r])return S[r];f(null),H(s=>new Set(s).add(r));try{const s=await n.getOutputTree(e,r);return Z(u=>({...u,[r]:s.entries})),s.entries}catch(s){return f(s instanceof Error?s.message:"Failed to load directory"),[]}finally{H(s=>{const u=new Set(s);return u.delete(r),u})}},[n,S,m,e]),A=i.useCallback(async a=>{const r=a.filter(s=>s!==".");if(r.length!==0){D(s=>{const u=new Set(s);for(const F of r)u.add(F);return u});for(const s of r)await $(s)}},[$]),Q=i.useCallback(async a=>{const r=L(a,m);if(!r){f("Invalid directory path");return}v(!1),b(""),T(r),E(null),r!=="."&&await A(Ye(r))},[A,m]),ve=i.useCallback(async a=>{const r=L(a,m);if(!r){f("Invalid directory path");return}if(T(r),E(null),C.has(r)){D(s=>{const u=new Set(s);return u.delete(r),u});return}D(s=>new Set(s).add(r)),await $(r)},[C,$,m]),B=i.useCallback(async a=>{const r=L(a,m);if(!r){f("Invalid file path");return}f(null);try{const s=Te(r);v(!1),b(""),await A(_e(r));const u=await n.getOutputContent(e,r);T(s),E(u)}catch(s){f(s instanceof Error?s.message:"Failed to load file")}},[n,A,m,e]),be=i.useCallback(()=>{if(g===".")return;const a=g.split("/");a.pop();const r=a.length===0?".":a.join("/");Q(r)},[g,Q]);i.useEffect(()=>{if(!o||!l?.available||K)return;const a=`${d}:${o}`;X.current!==a&&(X.current=a,b(""),B(o))},[K,B,l?.available,o,d]),i.useEffect(()=>{p&&ae.current?.focus()},[p]),i.useEffect(()=>{if(!w||!l?.available){O(!1),_([]),z(null);return}let a=!1;async function r(){O(!0),z(null);const s=["."],u=new Set,F=[];let ie=0;try{for(;s.length>0&&ie<Ve&&F.length<ce;){const j=s.shift()??".";if(u.has(j))continue;u.add(j);const W=await n.getOutputTree(e,j);if(a)return;ie+=W.entries.length,F.push(...Re(W.entries,J));for(const G of W.entries)G.type==="directory"&&!u.has(G.path)&&s.push(G.path)}a||(_(F.slice(0,ce)),O(!1))}catch(j){a||(_([]),z(j instanceof Error?j.message:"Failed to search files"),O(!1))}}return r(),()=>{a=!0}},[n,J,l?.available,w,e]);const we=i.useMemo(()=>Oe(k,S,C,U),[S,k,C,U]),V=w?q.map(a=>({entry:a,depth:ze(a.path),expanded:a.type==="directory"&&C.has(a.path),loading:a.type==="directory"&&U.has(a.path)})):we;if(K)return t.jsx(I,{tone:"muted",children:"Loading files..."});if(re)return t.jsx(I,{tone:"destructive",children:re});if(!l?.available)return t.jsx(I,{tone:"muted",children:"Task output is not available yet. The task may not have started."});const ne=(l.summary?.htmlEntries.length??0)+(l.summary?.markdownEntries?.length??0),ye=w?`${q.length}${ee?"+":""} matches`:`${l.summary?.fileCount??k.length} files`;return t.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[16rem_minmax(0,1fr)] lg:pl-5",children:[t.jsxs("aside",{className:x("flex min-h-0 flex-col bg-card/25 lg:border-r lg:border-border/50",h&&"hidden lg:flex"),children:[t.jsxs("div",{className:"shrink-0 bg-card/20 px-2 py-1.5",children:[t.jsxs("div",{className:"flex items-start gap-1.5",children:[t.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-sm bg-primary/10 text-primary",children:t.jsx(oe,{className:"h-3.5 w-3.5"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"truncate text-[12px] font-semibold leading-4 text-foreground",children:l.summary?.rootName??"Artifacts"}),t.jsxs("div",{className:"text-[10px] leading-4 text-muted-foreground",children:[ye,ne>0&&` · ${ne} previews`]})]}),t.jsx(P,{type:"button",variant:p?"secondary":"ghost",size:"icon","aria-expanded":p,"aria-label":p&&y.length===0?"Hide file search":"Search files",title:p&&y.length===0?"Hide file search":"Search files",className:"h-6 w-6 shrink-0 rounded-sm",onClick:()=>{p&&y.length===0?v(!1):v(!0)},children:t.jsx(le,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{className:"mt-1 flex min-h-5 items-center gap-1 rounded-sm bg-muted/35 px-1.5 py-0",children:[g!=="."&&t.jsx(P,{variant:"ghost",size:"icon",className:"h-5 w-5 rounded-sm",onClick:be,children:t.jsx(de,{className:"h-3 w-3"})}),t.jsx("span",{className:"truncate font-mono text-[10px] leading-4 text-muted-foreground",children:g==="."?l.summary?.rootPath??l.summary?.rootName??"/":g})]}),p&&t.jsxs("div",{className:"mt-1 flex items-center gap-1 rounded-sm bg-muted/35 px-1.5 py-0",children:[t.jsx(le,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("input",{ref:ae,value:y,onChange:a=>b(a.target.value),onKeyDown:a=>{a.key==="Escape"&&(b(""),v(!1))},placeholder:"Search files and folders",className:"h-5 min-w-0 flex-1 bg-transparent text-[10px] leading-4 text-foreground outline-none placeholder:text-muted-foreground/70"}),t.jsx("button",{type:"button",onClick:()=>{b(""),v(!1)},className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted/70 hover:text-foreground","aria-label":"Close file search",children:t.jsx(Se,{className:"h-3 w-3"})})]})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1",children:ee&&V.length===0?t.jsx("div",{className:"flex h-full items-center justify-center rounded-sm border border-dashed border-border/70 bg-background/35 px-3 text-center text-[11px] text-muted-foreground",children:"Searching files..."}):te?t.jsx("div",{className:"flex h-full items-center justify-center rounded-sm border border-dashed border-destructive/35 bg-destructive/10 px-3 text-center text-[11px] text-destructive",children:te}):V.length>0?t.jsx("div",{className:"space-y-0",children:V.map(a=>{const r=a.entry,s=h?.path===r.path||!h&&r.type==="directory"&&g===r.path;return t.jsxs("button",{type:"button","aria-current":s?"page":void 0,style:{"--tree-depth":a.depth,paddingLeft:`${4+a.depth*11}px`},onClick:()=>{r.type==="directory"?w?Q(r.path):ve(r.path):B(r.path)},className:x("animate-task-row-reveal group relative flex min-h-5 w-full items-center gap-1 rounded-sm py-0 text-left transition-all duration-150",s?'bg-primary/10 text-foreground before:absolute before:left-0 before:top-1/2 before:h-1/2 before:w-[2px] before:-translate-y-1/2 before:rounded-full before:bg-primary before:content-[""]':"text-foreground hover:bg-muted/40"),children:[r.type==="directory"?t.jsx(Ce,{className:x("h-3 w-3 shrink-0 text-muted-foreground transition-transform",s&&"text-primary",a.expanded&&"rotate-90")}):t.jsx("span",{className:"h-3 w-3 shrink-0"}),r.type==="directory"?t.jsx(oe,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",s&&"text-primary")}):t.jsx(Ae,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",s&&"text-primary")}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] font-medium leading-4",children:w?r.path:r.name}),t.jsx("span",{className:x("max-w-[5.75rem] shrink-0 truncate text-right text-[9px] leading-4",s?"text-primary/75":"text-muted-foreground"),children:a.loading?"loading":Ie(r)})]},r.path)})}):t.jsx("div",{className:"flex h-full items-center justify-center rounded-sm border border-dashed border-border/70 bg-background/35 px-3 text-center text-[11px] text-muted-foreground",children:w?"No matching files or folders":"Empty directory"})})]}),t.jsx("section",{className:x("min-h-0 flex flex-col bg-card/15",!h&&"hidden lg:flex"),children:h?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"shrink-0 px-3 py-1.5",children:t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx(P,{variant:"ghost",size:"icon","aria-label":"Back to file list",title:"Back to file list",className:"h-6 w-6 shrink-0 rounded-sm text-muted-foreground hover:bg-muted/55 hover:text-foreground",onClick:()=>E(null),children:t.jsx(de,{className:"h-3 w-3"})}),t.jsx("div",{className:"min-w-0 truncate font-mono text-[10px] leading-5 text-muted-foreground",children:h.path})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[c&&Ge(h)&&t.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Preview file",title:"Preview file",className:"h-6 w-6 shrink-0 rounded-sm text-primary hover:bg-primary/10 hover:text-primary",onClick:()=>c(h.path),children:t.jsx(Fe,{className:"h-3.5 w-3.5"})}),h.downloadUrl&&t.jsx(Y,{href:h.downloadUrl,filePath:h.path,iconOnly:!0})]})]})}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-2.5 pb-2.5 pt-1",children:t.jsx(We,{content:h,rootPath:m,onOpenFile:B})})]}):t.jsx("div",{className:"flex h-full items-center justify-center p-4",children:t.jsxs("div",{className:"max-w-md rounded-lg border border-border/60 bg-background/55 px-4 py-4 text-center",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:"Select a file to inspect"}),t.jsx("p",{className:"mt-1 text-[11px] leading-5 text-muted-foreground",children:"Preview source files, generated assets, or exported documents from this task."})]})})})]})}function We({content:e,rootPath:n,onOpenFile:o}){const d=e.downloadUrl;if(e.truncated&&!e.content)return t.jsx(pe,{title:"File is too large to preview inline",description:e.path,action:d?t.jsx(Y,{href:d,filePath:e.path}):void 0});if(e.kind==="image"){const c=e.content?`data:${e.mimeType};base64,${e.content}`:d;return c?t.jsx("div",{className:"flex h-full min-h-[16rem] items-center justify-center rounded-sm bg-background/55 p-3",children:t.jsx("img",{src:c,alt:e.path,className:"max-h-full max-w-full rounded-sm object-contain shadow-[0_24px_90px_-52px_rgba(0,0,0,0.65)]"})}):t.jsx(he,{content:e})}if(e.kind==="pdf"&&d)return t.jsx("div",{className:"h-full min-h-[20rem] overflow-hidden rounded-sm bg-background/55",children:t.jsx("iframe",{src:d,title:e.path,className:"h-full w-full border-0"})});if(e.kind==="json"){let c=e.content;try{c=JSON.stringify(JSON.parse(e.content),null,2)}catch{}return t.jsx(ue,{content:c,truncated:e.truncated})}return e.kind==="markdown"?t.jsx(Pe,{content:e.content,truncated:e.truncated,resolveFileLink:c=>$e(c,n,{allowRootRelative:!0,baseFilePath:e.path}),onOpenFileLink:o}):e.kind==="text"||e.kind==="html"?t.jsx(ue,{content:e.content,truncated:e.truncated}):t.jsx(he,{content:e})}function ue({content:e,truncated:n}){return t.jsxs("div",{className:"rounded-sm bg-background/55",children:[t.jsx(De,{content:e}),n&&t.jsx("div",{className:"bg-muted/30 px-3 py-1.5 text-[10px] text-muted-foreground",children:"Content truncated. Download the file to inspect the full artifact."})]})}function he({content:e}){return t.jsx(pe,{title:`${e.kind} file`,description:e.path,action:e.downloadUrl?t.jsx(Y,{href:e.downloadUrl,filePath:e.path}):void 0})}function Ge(e){return e.kind==="html"||e.kind==="markdown"}function Y({href:e,filePath:n,iconOnly:o=!1}){const d=i.useCallback(c=>{me()&&(c.preventDefault(),Ke({href:e,filePath:n}).catch(l=>{Ee.error(l instanceof Error?l.message:"Failed to save file")}))},[n,e]);return t.jsx(P,{asChild:!0,variant:"ghost",size:o?"icon":"sm",className:x("rounded-sm text-primary shadow-none hover:bg-primary/10 hover:text-primary",o?"h-6 w-6 shrink-0 bg-transparent":"h-7 bg-primary/10 px-2.5 text-[11px] hover:bg-primary/15"),children:t.jsxs("a",{href:e,download:!0,"aria-label":o?"Download file":void 0,title:o?"Download file":void 0,onClick:d,children:[t.jsx(Me,{className:"h-3.5 w-3.5"}),!o&&"Download"]})})}function pe({title:e,description:n,action:o}){return t.jsx("div",{className:"flex h-full min-h-[14rem] items-center justify-center rounded-sm bg-background/35 p-4 text-center",children:t.jsxs("div",{className:"max-w-sm",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e}),t.jsx("div",{className:"mt-1 break-all font-mono text-[10px] text-muted-foreground",children:n}),o&&t.jsx("div",{className:"mt-2.5 flex justify-center",children:o})]})})}function I({children:e,tone:n}){return t.jsx("div",{className:x("flex h-48 items-center justify-center text-[12px]",n==="muted"?"text-muted-foreground":"text-destructive"),children:e})}function Ie(e){return e.type==="directory"?"dir":e.size===void 0?e.kind??"file":`${e.kind??"file"} · ${Ze(e.size)}`}function Ye(e){if(e===".")return[];const n=e.split("/").filter(Boolean);return n.map((o,d)=>n.slice(0,d+1).join("/"))}function Ze(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}export{at as FilesTab};
|
|
11
|
+
*/const Le=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Me=fe("download",Le),Ue="save_dashboard_download";function me(e=xe()){const n=e?.__TAURI__?.core?.invoke;return typeof n=="function"?n:null}function He(e){const d=(e.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop()??"").replace(/[<>:"/\\|?*\x00-\x1f]/g,"_").replace(/^[ .]+|[ .]+$/g,"");return d.length>0?d:"download"}async function Ke({href:e,filePath:n,currentWindow:o=xe(),fetchImpl:d=fetch}){const c=me(o);if(!c)return!1;const l=await d(e,{cache:"no-store"});if(!l.ok)throw new Error(`Failed to download file (${l.status})`);const M=await l.blob(),k=await Xe(M),N=await c(Ue,{fileName:He(n),contentBase64:k});return!Je(N)||N.saved!==!1}async function Xe(e){const n=new Uint8Array(await e.arrayBuffer()),o=[],d=32768;for(let c=0;c<n.length;c+=d){const l=n.subarray(c,c+d);o.push(String.fromCharCode(...l))}return btoa(o.join(""))}function xe(){return typeof window>"u"?null:window}function Je(e){return!!(e&&typeof e=="object"&&"saved"in e)}const Qe={getOutput:Ne,getOutputTree:ke,getOutputContent:je},ce=120,Ve=1200;function at({taskId:e,api:n=Qe,requestedFilePath:o=null,requestedFileRequestId:d=0,onPreviewFile:c}){const[l,M]=i.useState(null),[k,N]=i.useState([]),[S,Z]=i.useState({}),[C,D]=i.useState(new Set),[U,H]=i.useState(new Set),[g,T]=i.useState("."),[h,F]=i.useState(null),[ge,v]=i.useState(!1),[y,b]=i.useState(""),[q,_]=i.useState([]),[ee,O]=i.useState(!1),[te,z]=i.useState(null),[K,R]=i.useState(!0),[re,f]=i.useState(null),ae=i.useRef(null),X=i.useRef(null),m=l?.summary?.rootPath??l?.effectiveProjectPath??null,J=y.trim(),w=J.length>0,p=ge||y.length>0,se=i.useCallback(async()=>{f(null),R(!0),T("."),N([]),Z({}),D(new Set),H(new Set),F(null),v(!1),b(""),_([]),z(null),X.current=null;try{const a=await n.getOutput(e);if(M(a),!a.available){R(!1);return}const r=await n.getOutputTree(e,".");N(r.entries),R(!1)}catch(a){f(a instanceof Error?a.message:"Failed to load output"),R(!1)}},[n,e]);i.useEffect(()=>{se()},[se]);const $=i.useCallback(async a=>{const r=L(a,m);if(!r)return f("Invalid directory path"),[];if(S[r])return S[r];f(null),H(s=>new Set(s).add(r));try{const s=await n.getOutputTree(e,r);return Z(u=>({...u,[r]:s.entries})),s.entries}catch(s){return f(s instanceof Error?s.message:"Failed to load directory"),[]}finally{H(s=>{const u=new Set(s);return u.delete(r),u})}},[n,S,m,e]),A=i.useCallback(async a=>{const r=a.filter(s=>s!==".");if(r.length!==0){D(s=>{const u=new Set(s);for(const E of r)u.add(E);return u});for(const s of r)await $(s)}},[$]),Q=i.useCallback(async a=>{const r=L(a,m);if(!r){f("Invalid directory path");return}v(!1),b(""),T(r),F(null),r!=="."&&await A(Ye(r))},[A,m]),ve=i.useCallback(async a=>{const r=L(a,m);if(!r){f("Invalid directory path");return}if(T(r),F(null),C.has(r)){D(s=>{const u=new Set(s);return u.delete(r),u});return}D(s=>new Set(s).add(r)),await $(r)},[C,$,m]),B=i.useCallback(async a=>{const r=L(a,m);if(!r){f("Invalid file path");return}f(null);try{const s=Te(r);v(!1),b(""),await A(_e(r));const u=await n.getOutputContent(e,r);T(s),F(u)}catch(s){f(s instanceof Error?s.message:"Failed to load file")}},[n,A,m,e]),be=i.useCallback(()=>{if(g===".")return;const a=g.split("/");a.pop();const r=a.length===0?".":a.join("/");Q(r)},[g,Q]);i.useEffect(()=>{if(!o||!l?.available||K)return;const a=`${d}:${o}`;X.current!==a&&(X.current=a,b(""),B(o))},[K,B,l?.available,o,d]),i.useEffect(()=>{p&&ae.current?.focus()},[p]),i.useEffect(()=>{if(!w||!l?.available){O(!1),_([]),z(null);return}let a=!1;async function r(){O(!0),z(null);const s=["."],u=new Set,E=[];let ie=0;try{for(;s.length>0&&ie<Ve&&E.length<ce;){const j=s.shift()??".";if(u.has(j))continue;u.add(j);const W=await n.getOutputTree(e,j);if(a)return;ie+=W.entries.length,E.push(...Re(W.entries,J));for(const G of W.entries)G.type==="directory"&&!u.has(G.path)&&s.push(G.path)}a||(_(E.slice(0,ce)),O(!1))}catch(j){a||(_([]),z(j instanceof Error?j.message:"Failed to search files"),O(!1))}}return r(),()=>{a=!0}},[n,J,l?.available,w,e]);const we=i.useMemo(()=>Oe(k,S,C,U),[S,k,C,U]),V=w?q.map(a=>({entry:a,depth:ze(a.path),expanded:a.type==="directory"&&C.has(a.path),loading:a.type==="directory"&&U.has(a.path)})):we;if(K)return t.jsx(I,{tone:"muted",children:"Loading files..."});if(re)return t.jsx(I,{tone:"destructive",children:re});if(!l?.available)return t.jsx(I,{tone:"muted",children:"Task output is not available yet. The task may not have started."});const ne=(l.summary?.htmlEntries.length??0)+(l.summary?.markdownEntries?.length??0),ye=w?`${q.length}${ee?"+":""} matches`:`${l.summary?.fileCount??k.length} files`;return t.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[16rem_minmax(0,1fr)] lg:pl-5",children:[t.jsxs("aside",{className:x("flex min-h-0 flex-col bg-card/25 lg:border-r lg:border-border/50",h&&"hidden lg:flex"),children:[t.jsxs("div",{className:"shrink-0 bg-card/20 px-2 py-1.5",children:[t.jsxs("div",{className:"flex items-start gap-1.5",children:[t.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-sm bg-primary/10 text-primary",children:t.jsx(oe,{className:"h-3.5 w-3.5"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"truncate text-[12px] font-semibold leading-4 text-foreground",children:l.summary?.rootName??"Artifacts"}),t.jsxs("div",{className:"text-[10px] leading-4 text-muted-foreground",children:[ye,ne>0&&` · ${ne} previews`]})]}),t.jsx(P,{type:"button",variant:p?"secondary":"ghost",size:"icon","aria-expanded":p,"aria-label":p&&y.length===0?"Hide file search":"Search files",title:p&&y.length===0?"Hide file search":"Search files",className:"h-6 w-6 shrink-0 rounded-sm",onClick:()=>{p&&y.length===0?v(!1):v(!0)},children:t.jsx(le,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{className:"mt-1 flex min-h-5 items-center gap-1 rounded-sm bg-muted/35 px-1.5 py-0",children:[g!=="."&&t.jsx(P,{variant:"ghost",size:"icon",className:"h-5 w-5 rounded-sm",onClick:be,children:t.jsx(de,{className:"h-3 w-3"})}),t.jsx("span",{className:"truncate font-mono text-[10px] leading-4 text-muted-foreground",children:g==="."?l.summary?.rootPath??l.summary?.rootName??"/":g})]}),p&&t.jsxs("div",{className:"mt-1 flex items-center gap-1 rounded-sm bg-muted/35 px-1.5 py-0",children:[t.jsx(le,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("input",{ref:ae,value:y,onChange:a=>b(a.target.value),onKeyDown:a=>{a.key==="Escape"&&(b(""),v(!1))},placeholder:"Search files and folders",className:"h-5 min-w-0 flex-1 bg-transparent text-[10px] leading-4 text-foreground outline-none placeholder:text-muted-foreground/70"}),t.jsx("button",{type:"button",onClick:()=>{b(""),v(!1)},className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted/70 hover:text-foreground","aria-label":"Close file search",children:t.jsx(Se,{className:"h-3 w-3"})})]})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1",children:ee&&V.length===0?t.jsx("div",{className:"flex h-full items-center justify-center rounded-sm border border-dashed border-border/70 bg-background/35 px-3 text-center text-[11px] text-muted-foreground",children:"Searching files..."}):te?t.jsx("div",{className:"flex h-full items-center justify-center rounded-sm border border-dashed border-destructive/35 bg-destructive/10 px-3 text-center text-[11px] text-destructive",children:te}):V.length>0?t.jsx("div",{className:"space-y-0",children:V.map(a=>{const r=a.entry,s=h?.path===r.path||!h&&r.type==="directory"&&g===r.path;return t.jsxs("button",{type:"button","aria-current":s?"page":void 0,style:{"--tree-depth":a.depth,paddingLeft:`${4+a.depth*11}px`},onClick:()=>{r.type==="directory"?w?Q(r.path):ve(r.path):B(r.path)},className:x("animate-task-row-reveal group relative flex min-h-5 w-full items-center gap-1 rounded-sm py-0 text-left transition-all duration-150",s?'bg-primary/10 text-foreground before:absolute before:left-0 before:top-1/2 before:h-1/2 before:w-[2px] before:-translate-y-1/2 before:rounded-full before:bg-primary before:content-[""]':"text-foreground hover:bg-muted/40"),children:[r.type==="directory"?t.jsx(Ce,{className:x("h-3 w-3 shrink-0 text-muted-foreground transition-transform",s&&"text-primary",a.expanded&&"rotate-90")}):t.jsx("span",{className:"h-3 w-3 shrink-0"}),r.type==="directory"?t.jsx(oe,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",s&&"text-primary")}):t.jsx(Ae,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",s&&"text-primary")}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] font-medium leading-4",children:w?r.path:r.name}),t.jsx("span",{className:x("max-w-[5.75rem] shrink-0 truncate text-right text-[9px] leading-4",s?"text-primary/75":"text-muted-foreground"),children:a.loading?"loading":Ie(r)})]},r.path)})}):t.jsx("div",{className:"flex h-full items-center justify-center rounded-sm border border-dashed border-border/70 bg-background/35 px-3 text-center text-[11px] text-muted-foreground",children:w?"No matching files or folders":"Empty directory"})})]}),t.jsx("section",{className:x("min-h-0 flex flex-col bg-card/15",!h&&"hidden lg:flex"),children:h?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"shrink-0 px-3 py-1.5",children:t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx(P,{variant:"ghost",size:"icon","aria-label":"Back to file list",title:"Back to file list",className:"h-6 w-6 shrink-0 rounded-sm text-muted-foreground hover:bg-muted/55 hover:text-foreground",onClick:()=>F(null),children:t.jsx(de,{className:"h-3 w-3"})}),t.jsx("div",{className:"min-w-0 truncate font-mono text-[10px] leading-5 text-muted-foreground",children:h.path})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[c&&Ge(h)&&t.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Preview file",title:"Preview file",className:"h-6 w-6 shrink-0 rounded-sm text-primary hover:bg-primary/10 hover:text-primary",onClick:()=>c(h.path),children:t.jsx(Ee,{className:"h-3.5 w-3.5"})}),h.downloadUrl&&t.jsx(Y,{href:h.downloadUrl,filePath:h.path,iconOnly:!0})]})]})}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-2.5 pb-2.5 pt-1",children:t.jsx(We,{content:h,rootPath:m,onOpenFile:B})})]}):t.jsx("div",{className:"flex h-full items-center justify-center p-4",children:t.jsxs("div",{className:"max-w-md rounded-lg border border-border/60 bg-background/55 px-4 py-4 text-center",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:"Select a file to inspect"}),t.jsx("p",{className:"mt-1 text-[11px] leading-5 text-muted-foreground",children:"Preview source files, generated assets, or exported documents from this task."})]})})})]})}function We({content:e,rootPath:n,onOpenFile:o}){const d=e.downloadUrl;if(e.truncated&&!e.content)return t.jsx(pe,{title:"File is too large to preview inline",description:e.path,action:d?t.jsx(Y,{href:d,filePath:e.path}):void 0});if(e.kind==="image"){const c=e.content?`data:${e.mimeType};base64,${e.content}`:d;return c?t.jsx("div",{className:"flex h-full min-h-[16rem] items-center justify-center rounded-sm bg-background/55 p-3",children:t.jsx("img",{src:c,alt:e.path,className:"max-h-full max-w-full rounded-sm object-contain shadow-[0_24px_90px_-52px_rgba(0,0,0,0.65)]"})}):t.jsx(he,{content:e})}if(e.kind==="pdf"&&d)return t.jsx("div",{className:"h-full min-h-[20rem] overflow-hidden rounded-sm bg-background/55",children:t.jsx("iframe",{src:d,title:e.path,className:"h-full w-full border-0"})});if(e.kind==="json"){let c=e.content;try{c=JSON.stringify(JSON.parse(e.content),null,2)}catch{}return t.jsx(ue,{content:c,truncated:e.truncated})}return e.kind==="markdown"?t.jsx(Pe,{content:e.content,truncated:e.truncated,resolveFileLink:c=>$e(c,n,{allowRootRelative:!0,baseFilePath:e.path}),onOpenFileLink:o}):e.kind==="text"||e.kind==="html"?t.jsx(ue,{content:e.content,truncated:e.truncated}):t.jsx(he,{content:e})}function ue({content:e,truncated:n}){return t.jsxs("div",{className:"rounded-sm bg-background/55",children:[t.jsx(De,{content:e}),n&&t.jsx("div",{className:"bg-muted/30 px-3 py-1.5 text-[10px] text-muted-foreground",children:"Content truncated. Download the file to inspect the full artifact."})]})}function he({content:e}){return t.jsx(pe,{title:`${e.kind} file`,description:e.path,action:e.downloadUrl?t.jsx(Y,{href:e.downloadUrl,filePath:e.path}):void 0})}function Ge(e){return e.kind==="html"||e.kind==="markdown"}function Y({href:e,filePath:n,iconOnly:o=!1}){const d=i.useCallback(c=>{me()&&(c.preventDefault(),Ke({href:e,filePath:n}).catch(l=>{Fe.error(l instanceof Error?l.message:"Failed to save file")}))},[n,e]);return t.jsx(P,{asChild:!0,variant:"ghost",size:o?"icon":"sm",className:x("rounded-sm text-primary shadow-none hover:bg-primary/10 hover:text-primary",o?"h-6 w-6 shrink-0 bg-transparent":"h-7 bg-primary/10 px-2.5 text-[11px] hover:bg-primary/15"),children:t.jsxs("a",{href:e,download:!0,"aria-label":o?"Download file":void 0,title:o?"Download file":void 0,onClick:d,children:[t.jsx(Me,{className:"h-3.5 w-3.5"}),!o&&"Download"]})})}function pe({title:e,description:n,action:o}){return t.jsx("div",{className:"flex h-full min-h-[14rem] items-center justify-center rounded-sm bg-background/35 p-4 text-center",children:t.jsxs("div",{className:"max-w-sm",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e}),t.jsx("div",{className:"mt-1 break-all font-mono text-[10px] text-muted-foreground",children:n}),o&&t.jsx("div",{className:"mt-2.5 flex justify-center",children:o})]})})}function I({children:e,tone:n}){return t.jsx("div",{className:x("flex h-48 items-center justify-center text-[12px]",n==="muted"?"text-muted-foreground":"text-destructive"),children:e})}function Ie(e){return e.type==="directory"?"dir":e.size===void 0?e.kind??"file":`${e.kind??"file"} · ${Ze(e.size)}`}function Ye(e){if(e===".")return[];const n=e.split("/").filter(Boolean);return n.map((o,d)=>n.slice(0,d+1).join("/"))}function Ze(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}export{at as FilesTab};
|
package/dashboard/assets/{MarkdownPreviewFrame-C56qjNyn.js → MarkdownPreviewFrame-L2oxne--.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as st,r as Xt,j as C,d as z}from"./index-
|
|
1
|
+
import{c as st,r as Xt,j as C,d as z}from"./index-D260dUEm.js";import{P as Re,Q as ye,R as He,S as Fe,U as he,V as ae,W as Ne,X as Kt,Y as Vt,Z as w,_ as zt,$ as rt,a0 as pe,a1 as jt,a2 as Jt,a3 as $t}from"./DashboardShared-CrDF53oL.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as z,j as e,I as le,B as f,as as L,aC as q,r as i,bY as oe,bX as ce,aH as O,G as de,H as ue,J as me,bZ as xe,y as fe,C as he}from"./index-
|
|
1
|
+
import{c as z,j as e,I as le,B as f,as as L,aC as q,r as i,bY as oe,bX as ce,aH as O,G as de,H as ue,J as me,bZ as xe,y as fe,C as he}from"./index-D260dUEm.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-BHeht0ZL.js","assets/index-D260dUEm.js","assets/index-By1kKB26.css","assets/MarkdownPreviewFrame-L2oxne--.js","assets/DashboardShared-CrDF53oL.js","assets/file-BgR9-rpB.js","assets/PreviewTab-UMpaLVaV.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{bk as S,r,j as e,L as T,R as C,bJ as P,a0 as M,a2 as E,ah as O,bK as I,bL as _,bM as y,bN as F,bO as L,ac as N,bP as q}from"./index-D260dUEm.js";import{B as A,E as R,y as z,x as B,m as D,C as G,o as w,v as U}from"./DashboardShared-CrDF53oL.js";const V=r.lazy(async()=>({default:(await N(()=>import("./FilesTab-BHeht0ZL.js"),__vite__mapDeps([0,1,2,3,4,5]))).FilesTab})),W=r.lazy(async()=>({default:(await N(()=>import("./PreviewTab-UMpaLVaV.js").then(a=>a.c),__vite__mapDeps([6,1,2]))).PreviewTab})),H={getOutput:y,getOutputTree:_,getOutputContent:I},J={getOutput:y,createPreviewSession:(t,a)=>q(t,typeof a=="string"?a:a?.path)};function X(){const{shareId:t}=S(),[a,d]=r.useState(null),[c,s]=r.useState([]),[u,m]=r.useState(!0),[b,l]=r.useState(null),x=r.useRef(null);return r.useEffect(()=>{if(!t){d(null),s([]),l("Shared conversation not found"),m(!1);return}let i=!1;x.current=t,m(!0),l(null);const h=async o=>{try{const[p,f]=await Promise.all([F(t),L(t)]);if(i||x.current!==t)return;d(p),s(n=>o?f.logs:U(n,f.logs)),l(null)}catch(p){if(i||x.current!==t)return;o&&(d(null),s([]),l(p instanceof Error?p.message:"Failed to load shared conversation"))}finally{!i&&x.current===t&&o&&m(!1)}};h(!0);const g=window.setInterval(()=>{h(!1)},2500);return()=>{i=!0,window.clearInterval(g)}},[t]),e.jsx(K,{conversation:a,logs:c,loading:u,error:b})}function K({conversation:t,logs:a,loading:d,error:c}){const[s,u]=r.useState("transcript"),[m,b]=r.useState(null),[l,x]=r.useState(!1),i=r.useMemo(()=>{if(!t)return null;const n=A(t.payload.initialMessage);return n.length>0&&R(a,n)?null:n.length>0?z(n,new Date(t.createdAt).toISOString()):null},[t,a]),h=r.useMemo(()=>B([...i?[i]:[],...a]),[i,a]),g=r.useMemo(()=>D(h),[h]),o=t?.scope==="filesPreview",p=r.useCallback(n=>{o&&(b(v=>({path:n,requestId:(v?.requestId??0)+1})),u("files"))},[o]);r.useEffect(()=>{b(null)},[t?.shareId]);const f=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 bg-gradient-to-b from-background/15 via-transparent to-background/35 px-4 py-4 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-4 pb-16",children:[d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-border/60 bg-background/60 px-3 py-2 text-[11px] text-muted-foreground",children:[e.jsx(T,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!d&&c&&e.jsxs("div",{className:"rounded-sm border border-destructive/20 bg-destructive/10 px-3 py-4 text-center text-destructive",children:[e.jsx("div",{className:"text-[12px] font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-1 text-[11px]",children:c})]}),!d&&!c&&h.length===0&&e.jsxs("div",{className:"rounded-sm border border-dashed border-border/70 bg-background/35 px-3 py-4 text-center",children:[e.jsx(C,{className:"mx-auto h-5 w-5 text-muted-foreground"}),e.jsx("div",{className:"mt-2 text-[12px] font-medium text-foreground",children:"No transcript output yet"})]}),!d&&!c&&g.map(({event:n,subItems:v},k)=>e.jsx(G,{event:n,agent:t?.agent,subItems:v,onOpenFilePath:p,questionResponseDisabled:!0},`shared-${k}`))]})});return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[e.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),e.jsxs("div",{className:"relative z-10 flex h-full min-h-0 gap-2 px-2 py-2 sm:px-3",children:[e.jsxs("aside",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle hidden w-64 shrink-0 flex-col overflow-hidden rounded-sm px-3 py-3 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-sm border border-border/70 bg-foreground text-[11px] font-semibold tracking-[0.24em] text-background shadow-none",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared view"})]})]}),e.jsx("div",{className:"mt-4 text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-2 space-y-2.5",children:[e.jsx("h1",{className:"max-h-24 overflow-hidden break-words text-[13px] font-semibold leading-5 text-foreground [overflow-wrap:anywhere]",title:t.title,children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(P,{status:t.status}),e.jsx(M,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[e.jsxs("div",{children:["updated ",E(t.updatedAt)]}),e.jsx("div",{className:"font-mono",children:t.id.slice(0,8)})]})]}),e.jsxs("div",{className:"mt-auto space-y-2 pt-6",children:[l&&e.jsx("div",{className:"rounded-sm border border-border/70 bg-background/80 p-2.5 font-mono text-[11px] text-foreground shadow-none",children:"npx -y meshy-node@latest start"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{href:"https://github.com/gim-home/meshy",target:"_blank",rel:"noreferrer","aria-label":"Open Meshy on GitHub",className:"inline-flex h-8 w-8 items-center justify-center rounded-sm border border-border/70 bg-background/70 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(Z,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>x(n=>!n),"aria-expanded":l,className:"inline-flex h-8 items-center gap-1.5 rounded-sm border border-border/70 bg-background/70 px-2.5 text-[11px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(O,{className:"h-4 w-4"}),"Try it"]})]})]})]}),e.jsxs("main",{className:"dashboard-panel animate-panel-settle flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-sm",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/55 bg-card/28 px-3 py-2 sm:px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-sm border border-border/70 bg-foreground text-[11px] font-semibold tracking-[0.24em] text-background lg:hidden",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:t?.title??"Shared conversation"})]})]}),o&&e.jsxs("div",{className:"mt-3 inline-flex h-7 rounded-sm border border-border/55 bg-background/35 p-0.5 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>u("transcript"),"aria-current":s==="transcript"?"page":void 0,className:j(s==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>u("files"),"aria-current":s==="files"?"page":void 0,className:j(s==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>u("preview"),"aria-current":s==="preview"?"page":void 0,className:j(s==="preview"),children:"Preview"})]})]}),o&&t?e.jsxs(e.Fragment,{children:[s==="transcript"&&f,s==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Suspense,{fallback:e.jsx(w,{label:"Loading files..."}),children:e.jsx(V,{taskId:t.shareId,api:H,requestedFilePath:m?.path??null,requestedFileRequestId:m?.requestId??0})})}),s==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Suspense,{fallback:e.jsx(w,{label:"Loading preview..."}),children:e.jsx(W,{taskId:t.shareId,api:J,allowPortPreview:!1})})})]}):f]})]})]})}function j(t){return t?"inline-flex h-full items-center justify-center whitespace-nowrap rounded-sm border border-primary/30 bg-primary/10 px-2.5 text-[11px] font-medium text-primary shadow-none":"inline-flex h-full items-center justify-center whitespace-nowrap rounded-sm border border-transparent px-2.5 text-[11px] font-medium transition-colors hover:bg-muted/35 hover:text-foreground"}function Z({className:t}){return e.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.58 2 12.23c0 4.51 2.87 8.34 6.84 9.7.5.1.68-.22.68-.49 0-.24-.01-.88-.01-1.73-2.78.62-3.37-1.37-3.37-1.37-.45-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.63.07-.63 1 .07 1.53 1.06 1.53 1.06.89 1.56 2.34 1.11 2.91.85.09-.66.35-1.11.63-1.37-2.22-.26-4.55-1.14-4.55-5.05 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.31.1-2.71 0 0 .84-.27 2.75 1.05A9.3 9.3 0 0 1 12 6.96c.85 0 1.71.12 2.51.34 1.91-1.32 2.75-1.05 2.75-1.05.55 1.4.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.92-2.34 4.79-4.57 5.05.36.32.68.94.68 1.9 0 1.37-.01 2.47-.01 2.81 0 .27.18.59.69.49A10.05 10.05 0 0 0 22 12.23C22 6.58 17.52 2 12 2Z"})})}export{X as SharedConversationPage,K as SharedConversationView};
|