meshy-node 0.9.3 → 0.9.5
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-D21dWlmw.js +164 -0
- package/dashboard/assets/{DashboardShared-Coi8X4Mf.js → DashboardShared-CtD601bB.js} +35 -35
- package/dashboard/assets/{DiffTab-797YuD9i.js → DiffTab-D1I57xJM.js} +1 -1
- package/dashboard/assets/{FilesTab-CxWQD31o.js → FilesTab-B_30Lp2l.js} +2 -2
- package/dashboard/assets/{MarkdownPreviewFrame-tY-M5bCG.js → MarkdownPreviewFrame-hB6tBCB8.js} +1 -1
- package/dashboard/assets/PreviewTab-BBaAgEyn.js +21 -0
- package/dashboard/assets/SharedConversationPage-DpJKqW_3.js +2 -0
- package/dashboard/assets/{file-QtUVb5S2.js → file-B8vnmnf2.js} +1 -1
- package/dashboard/assets/index-9hU42hur.js +316 -0
- package/dashboard/assets/index-DQIXvvgG.css +1 -0
- package/dashboard/index.html +2 -2
- package/main.cjs +147003 -53902
- package/package.json +1 -1
- package/runtime-metadata.json +4 -4
- package/dashboard/assets/DashboardPage-DyNoe7cv.js +0 -149
- package/dashboard/assets/PreviewTab-Ci5d1xLj.js +0 -16
- package/dashboard/assets/SharedConversationPage-BMmvljLM.js +0 -2
- package/dashboard/assets/index-BT6taBuK.css +0 -1
- package/dashboard/assets/index-BxuLE_uo.js +0 -316
- package/dashboard/assets/play-Cwrx3Fzy.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as W,j as n,b as k,r as c,
|
|
1
|
+
import{c as W,j as n,b as k,r as c,bI as A,bD as B,v as U,k as I,R as V,i as G}from"./index-9hU42hur.js";import{G as H}from"./DashboardPage-D21dWlmw.js";import{F as J}from"./file-B8vnmnf2.js";import"./DashboardShared-CtD601bB.js";import"./MarkdownPreviewFrame-hB6tBCB8.js";import"./PreviewTab-BBaAgEyn.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 ye,r as o,
|
|
1
|
+
import{c as ye,r as o,bD as De,bE as Pe,bF as Te,j as t,i as me,B as L,u as xe,X as _e,k as Oe,b as x,t as ze}from"./index-9hU42hur.js";import{M as Re,L as $e}from"./MarkdownPreviewFrame-hB6tBCB8.js";import{y as A,z as Be,B as Ae,E as Le,F as Me,G as Ue,H as He}from"./DashboardShared-CtD601bB.js";import{F as Ke}from"./file-B8vnmnf2.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 ye,r as o,by as De,bz as Pe,bA as Te,j as t,i as me,B as L,u as xe,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 Xe=[["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"}]],Je=ye("download",Xe),Ve="save_dashboard_download";function we(e=je()){var l,d;const i=(d=(l=e==null?void 0:e.__TAURI__)==null?void 0:l.core)==null?void 0:d.invoke;return typeof i=="function"?i:null}function Ge(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 Ie({href:e,filePath:i,currentWindow:l=je(),fetchImpl:d=fetch}){const s=we(l);if(!s)return!1;const h=await d(e,{cache:"no-store"});if(!h.ok)throw new Error(`Failed to download file (${h.status})`);const N=await h.blob(),F=await Ye(N),p=await s(Ve,{fileName:Ge(i),contentBase64:F});return!Ze(p)||p.saved!==!1}async function Ye(e){const i=new Uint8Array(await e.arrayBuffer()),l=[],d=32768;for(let s=0;s<i.length;s+=d){const h=i.subarray(s,s+d);l.push(String.fromCharCode(...h))}return btoa(l.join(""))}function je(){return typeof window>"u"?null:window}function Ze(e){return!!(e&&typeof e=="object"&&"saved"in e)}const qe={getOutput:Te,getOutputTree:Pe,getOutputContent:De},ge=120,We=1200;function lt({taskId:e,api:i=qe,requestedFilePath:l=null,requestedFileRequestId:d=0}){var ne,ie,oe,le,de,ce,ue,he;const[s,h]=o.useState(null),[N,F]=o.useState([]),[p,Z]=o.useState({}),[S,D]=o.useState(new Set),[M,U]=o.useState(new Set),[b,P]=o.useState("."),[u,C]=o.useState(null),[Ne,v]=o.useState(!1),[j,y]=o.useState(""),[q,T]=o.useState([]),[W,_]=o.useState(!1),[ee,O]=o.useState(null),[H,z]=o.useState(!0),[te,f]=o.useState(null),re=o.useRef(null),K=o.useRef(null),m=((ne=s==null?void 0:s.summary)==null?void 0:ne.rootPath)??(s==null?void 0:s.effectiveProjectPath)??null,Q=j.trim(),w=Q.length>0,g=Ne||j.length>0,ae=o.useCallback(async()=>{f(null),z(!0),P("."),F([]),Z({}),D(new Set),U(new Set),C(null),v(!1),y(""),T([]),O(null),K.current=null;try{const a=await i.getOutput(e);if(h(a),!a.available){z(!1);return}const r=await i.getOutputTree(e,".");F(r.entries),z(!1)}catch(a){f(a instanceof Error?a.message:"Failed to load output"),z(!1)}},[i,e]);o.useEffect(()=>{ae()},[ae]);const R=o.useCallback(async a=>{const r=B(a,m);if(!r)return f("Invalid directory path"),[];if(p[r])return p[r];f(null),U(n=>new Set(n).add(r));try{const n=await i.getOutputTree(e,r);return Z(c=>({...c,[r]:n.entries})),n.entries}catch(n){return f(n instanceof Error?n.message:"Failed to load directory"),[]}finally{U(n=>{const c=new Set(n);return c.delete(r),c})}},[i,p,m,e]),$=o.useCallback(async a=>{const r=a.filter(n=>n!==".");if(r.length!==0){D(n=>{const c=new Set(n);for(const E of r)c.add(E);return c});for(const n of r)await R(n)}},[R]),X=o.useCallback(async a=>{const r=B(a,m);if(!r){f("Invalid directory path");return}v(!1),y(""),P(r),C(null),r!=="."&&await $(rt(r))},[$,m]),Se=o.useCallback(async a=>{const r=B(a,m);if(!r){f("Invalid directory path");return}if(P(r),C(null),S.has(r)){D(n=>{const c=new Set(n);return c.delete(r),c});return}D(n=>new Set(n).add(r)),await R(r)},[S,R,m]),A=o.useCallback(async a=>{const r=B(a,m);if(!r){f("Invalid file path");return}f(null);try{const n=Ae(r);v(!1),y(""),await $(Be(r));const c=await i.getOutputContent(e,r);P(n),C(c)}catch(n){f(n instanceof Error?n.message:"Failed to load file")}},[i,$,m,e]),Ce=o.useCallback(()=>{if(b===".")return;const a=b.split("/");a.pop();const r=a.length===0?".":a.join("/");X(r)},[b,X]);o.useEffect(()=>{if(!l||!(s!=null&&s.available)||H)return;const a=`${d}:${l}`;K.current!==a&&(K.current=a,y(""),A(l))},[H,A,s==null?void 0:s.available,l,d]),o.useEffect(()=>{var a;g&&((a=re.current)==null||a.focus())},[g]),o.useEffect(()=>{if(!w||!(s!=null&&s.available)){_(!1),T([]),O(null);return}let a=!1;async function r(){_(!0),O(null);const n=["."],c=new Set,E=[];let fe=0;try{for(;n.length>0&&fe<We&&E.length<ge;){const k=n.shift()??".";if(c.has(k))continue;c.add(k);const V=await i.getOutputTree(e,k);if(a)return;fe+=V.entries.length,E.push(...Ue(V.entries,Q));for(const G of V.entries)G.type==="directory"&&!c.has(G.path)&&n.push(G.path)}a||(T(E.slice(0,ge)),_(!1))}catch(k){a||(T([]),O(k instanceof Error?k.message:"Failed to search files"),_(!1))}}return r(),()=>{a=!0}},[i,Q,s==null?void 0:s.available,w,e]);const Ee=o.useMemo(()=>Le(N,p,S,M),[p,N,S,M]),J=w?q.map(a=>({entry:a,depth:Me(a.path),expanded:a.type==="directory"&&S.has(a.path),loading:a.type==="directory"&&M.has(a.path)})):Ee;if(H)return t.jsx(I,{tone:"muted",children:"Loading files..."});if(te)return t.jsx(I,{tone:"destructive",children:te});if(!(s!=null&&s.available))return t.jsx(I,{tone:"muted",children:"Task output is not available yet. The task may not have started."});const se=(((ie=s.summary)==null?void 0:ie.htmlEntries.length)??0)+(((le=(oe=s.summary)==null?void 0:oe.markdownEntries)==null?void 0:le.length)??0),Fe=w?`${q.length}${W?"+":""} matches`:`${((de=s.summary)==null?void 0:de.fileCount)??N.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",u&&"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(me,{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:((ce=s.summary)==null?void 0:ce.rootName)??"Artifacts"}),t.jsxs("div",{className:"text-[10px] leading-4 text-muted-foreground",children:[Fe,se>0&&` · ${se} previews`]})]}),t.jsx(L,{type:"button",variant:g?"secondary":"ghost",size:"icon","aria-expanded":g,"aria-label":g&&j.length===0?"Hide file search":"Search files",title:g&&j.length===0?"Hide file search":"Search files",className:"h-6 w-6 shrink-0 rounded-sm",onClick:()=>{g&&j.length===0?v(!1):v(!0)},children:t.jsx(xe,{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:[b!=="."&&t.jsx(L,{variant:"ghost",size:"icon",className:"h-5 w-5 rounded-sm",onClick:Ce,children:t.jsx(pe,{className:"h-3 w-3"})}),t.jsx("span",{className:"truncate font-mono text-[10px] leading-4 text-muted-foreground",children:b==="."?((ue=s.summary)==null?void 0:ue.rootPath)??((he=s.summary)==null?void 0:he.rootName)??"/":b})]}),g&&t.jsxs("div",{className:"mt-1 flex items-center gap-1 rounded-sm bg-muted/35 px-1.5 py-0",children:[t.jsx(xe,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("input",{ref:re,value:j,onChange:a=>y(a.target.value),onKeyDown:a=>{a.key==="Escape"&&(y(""),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:()=>{y(""),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(_e,{className:"h-3 w-3"})})]})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1",children:W&&J.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..."}):ee?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:ee}):J.length>0?t.jsx("div",{className:"space-y-0",children:J.map(a=>{const r=a.entry,n=(u==null?void 0:u.path)===r.path||!u&&r.type==="directory"&&b===r.path;return t.jsxs("button",{type:"button","aria-current":n?"page":void 0,style:{"--tree-depth":a.depth,paddingLeft:`${4+a.depth*11}px`},onClick:()=>{r.type==="directory"?w?X(r.path):Se(r.path):A(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",n?'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(Oe,{className:x("h-3 w-3 shrink-0 text-muted-foreground transition-transform",n&&"text-primary",a.expanded&&"rotate-90")}):t.jsx("span",{className:"h-3 w-3 shrink-0"}),r.type==="directory"?t.jsx(me,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",n&&"text-primary")}):t.jsx(Ke,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",n&&"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",n?"text-primary/75":"text-muted-foreground"),children:a.loading?"loading":tt(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",!u&&"hidden lg:flex"),children:u?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(L,{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:()=>C(null),children:t.jsx(pe,{className:"h-3 w-3"})}),t.jsx("div",{className:"min-w-0 truncate font-mono text-[10px] leading-5 text-muted-foreground",children:u.path})]}),u.downloadUrl&&t.jsx(Y,{href:u.downloadUrl,filePath:u.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(et,{content:u,rootPath:m,onOpenFile:A})})]}):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 et({content:e,rootPath:i,onOpenFile:l}){const d=e.downloadUrl;if(e.truncated&&!e.content)return t.jsx(ke,{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 s=e.content?`data:${e.mimeType};base64,${e.content}`:d;return s?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:s,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(ve,{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 s=e.content;try{s=JSON.stringify(JSON.parse(e.content),null,2)}catch{}return t.jsx(be,{content:s,truncated:e.truncated})}return e.kind==="markdown"?t.jsx(Re,{content:e.content,truncated:e.truncated,resolveFileLink:s=>He(s,i,{allowRootRelative:!0,baseFilePath:e.path}),onOpenFileLink:l}):e.kind==="text"||e.kind==="html"?t.jsx(be,{content:e.content,truncated:e.truncated}):t.jsx(ve,{content:e})}function be({content:e,truncated:i}){return t.jsxs("div",{className:"rounded-sm bg-background/55",children:[t.jsx($e,{content:e}),i&&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 ve({content:e}){return t.jsx(ke,{title:`${e.kind} file`,description:e.path,action:e.downloadUrl?t.jsx(Y,{href:e.downloadUrl,filePath:e.path}):void 0})}function Y({href:e,filePath:i,iconOnly:l=!1}){const d=o.useCallback(s=>{we()&&(s.preventDefault(),Ie({href:e,filePath:i}).catch(h=>{ze.error(h instanceof Error?h.message:"Failed to save file")}))},[i,e]);return t.jsx(L,{asChild:!0,variant:"ghost",size:l?"icon":"sm",className:x("rounded-sm text-primary shadow-none hover:bg-primary/10 hover:text-primary",l?"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":l?"Download file":void 0,title:l?"Download file":void 0,onClick:d,children:[t.jsx(Je,{className:"h-3.5 w-3.5"}),!l&&"Download"]})})}function ke({title:e,description:i,action:l}){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:i}),l&&t.jsx("div",{className:"mt-2.5 flex justify-center",children:l})]})})}function I({children:e,tone:i}){return t.jsx("div",{className:x("flex h-48 items-center justify-center text-[12px]",i==="muted"?"text-muted-foreground":"text-destructive"),children:e})}function tt(e){return e.type==="directory"?"dir":e.size===void 0?e.kind??"file":`${e.kind??"file"} · ${at(e.size)}`}function rt(e){if(e===".")return[];const i=e.split("/").filter(Boolean);return i.map((l,d)=>i.slice(0,d+1).join("/"))}function at(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}export{lt as FilesTab};
|
|
11
|
+
*/const Xe=[["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"}]],Je=ye("download",Xe),Ve="save_dashboard_download";function we(e=je()){var l,d;const i=(d=(l=e==null?void 0:e.__TAURI__)==null?void 0:l.core)==null?void 0:d.invoke;return typeof i=="function"?i:null}function Ge(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 Ie({href:e,filePath:i,currentWindow:l=je(),fetchImpl:d=fetch}){const s=we(l);if(!s)return!1;const h=await d(e,{cache:"no-store"});if(!h.ok)throw new Error(`Failed to download file (${h.status})`);const N=await h.blob(),F=await Ye(N),p=await s(Ve,{fileName:Ge(i),contentBase64:F});return!Ze(p)||p.saved!==!1}async function Ye(e){const i=new Uint8Array(await e.arrayBuffer()),l=[],d=32768;for(let s=0;s<i.length;s+=d){const h=i.subarray(s,s+d);l.push(String.fromCharCode(...h))}return btoa(l.join(""))}function je(){return typeof window>"u"?null:window}function Ze(e){return!!(e&&typeof e=="object"&&"saved"in e)}const qe={getOutput:Te,getOutputTree:Pe,getOutputContent:De},ge=120,We=1200;function lt({taskId:e,api:i=qe,requestedFilePath:l=null,requestedFileRequestId:d=0}){var ne,ie,oe,le,de,ce,ue,he;const[s,h]=o.useState(null),[N,F]=o.useState([]),[p,Z]=o.useState({}),[S,D]=o.useState(new Set),[M,U]=o.useState(new Set),[b,P]=o.useState("."),[u,C]=o.useState(null),[Ne,v]=o.useState(!1),[j,y]=o.useState(""),[q,T]=o.useState([]),[W,_]=o.useState(!1),[ee,O]=o.useState(null),[H,z]=o.useState(!0),[te,f]=o.useState(null),re=o.useRef(null),K=o.useRef(null),m=((ne=s==null?void 0:s.summary)==null?void 0:ne.rootPath)??(s==null?void 0:s.effectiveProjectPath)??null,Q=j.trim(),w=Q.length>0,g=Ne||j.length>0,ae=o.useCallback(async()=>{f(null),z(!0),P("."),F([]),Z({}),D(new Set),U(new Set),C(null),v(!1),y(""),T([]),O(null),K.current=null;try{const a=await i.getOutput(e);if(h(a),!a.available){z(!1);return}const r=await i.getOutputTree(e,".");F(r.entries),z(!1)}catch(a){f(a instanceof Error?a.message:"Failed to load output"),z(!1)}},[i,e]);o.useEffect(()=>{ae()},[ae]);const R=o.useCallback(async a=>{const r=A(a,m);if(!r)return f("Invalid directory path"),[];if(p[r])return p[r];f(null),U(n=>new Set(n).add(r));try{const n=await i.getOutputTree(e,r);return Z(c=>({...c,[r]:n.entries})),n.entries}catch(n){return f(n instanceof Error?n.message:"Failed to load directory"),[]}finally{U(n=>{const c=new Set(n);return c.delete(r),c})}},[i,p,m,e]),$=o.useCallback(async a=>{const r=a.filter(n=>n!==".");if(r.length!==0){D(n=>{const c=new Set(n);for(const E of r)c.add(E);return c});for(const n of r)await R(n)}},[R]),X=o.useCallback(async a=>{const r=A(a,m);if(!r){f("Invalid directory path");return}v(!1),y(""),P(r),C(null),r!=="."&&await $(rt(r))},[$,m]),Se=o.useCallback(async a=>{const r=A(a,m);if(!r){f("Invalid directory path");return}if(P(r),C(null),S.has(r)){D(n=>{const c=new Set(n);return c.delete(r),c});return}D(n=>new Set(n).add(r)),await R(r)},[S,R,m]),B=o.useCallback(async a=>{const r=A(a,m);if(!r){f("Invalid file path");return}f(null);try{const n=Be(r);v(!1),y(""),await $(Ae(r));const c=await i.getOutputContent(e,r);P(n),C(c)}catch(n){f(n instanceof Error?n.message:"Failed to load file")}},[i,$,m,e]),Ce=o.useCallback(()=>{if(b===".")return;const a=b.split("/");a.pop();const r=a.length===0?".":a.join("/");X(r)},[b,X]);o.useEffect(()=>{if(!l||!(s!=null&&s.available)||H)return;const a=`${d}:${l}`;K.current!==a&&(K.current=a,y(""),B(l))},[H,B,s==null?void 0:s.available,l,d]),o.useEffect(()=>{var a;g&&((a=re.current)==null||a.focus())},[g]),o.useEffect(()=>{if(!w||!(s!=null&&s.available)){_(!1),T([]),O(null);return}let a=!1;async function r(){_(!0),O(null);const n=["."],c=new Set,E=[];let fe=0;try{for(;n.length>0&&fe<We&&E.length<ge;){const k=n.shift()??".";if(c.has(k))continue;c.add(k);const V=await i.getOutputTree(e,k);if(a)return;fe+=V.entries.length,E.push(...Ue(V.entries,Q));for(const G of V.entries)G.type==="directory"&&!c.has(G.path)&&n.push(G.path)}a||(T(E.slice(0,ge)),_(!1))}catch(k){a||(T([]),O(k instanceof Error?k.message:"Failed to search files"),_(!1))}}return r(),()=>{a=!0}},[i,Q,s==null?void 0:s.available,w,e]);const Ee=o.useMemo(()=>Le(N,p,S,M),[p,N,S,M]),J=w?q.map(a=>({entry:a,depth:Me(a.path),expanded:a.type==="directory"&&S.has(a.path),loading:a.type==="directory"&&M.has(a.path)})):Ee;if(H)return t.jsx(I,{tone:"muted",children:"Loading files..."});if(te)return t.jsx(I,{tone:"destructive",children:te});if(!(s!=null&&s.available))return t.jsx(I,{tone:"muted",children:"Task output is not available yet. The task may not have started."});const se=(((ie=s.summary)==null?void 0:ie.htmlEntries.length)??0)+(((le=(oe=s.summary)==null?void 0:oe.markdownEntries)==null?void 0:le.length)??0),Fe=w?`${q.length}${W?"+":""} matches`:`${((de=s.summary)==null?void 0:de.fileCount)??N.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",u&&"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(me,{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:((ce=s.summary)==null?void 0:ce.rootName)??"Artifacts"}),t.jsxs("div",{className:"text-[10px] leading-4 text-muted-foreground",children:[Fe,se>0&&` · ${se} previews`]})]}),t.jsx(L,{type:"button",variant:g?"secondary":"ghost",size:"icon","aria-expanded":g,"aria-label":g&&j.length===0?"Hide file search":"Search files",title:g&&j.length===0?"Hide file search":"Search files",className:"h-6 w-6 shrink-0 rounded-sm",onClick:()=>{g&&j.length===0?v(!1):v(!0)},children:t.jsx(xe,{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:[b!=="."&&t.jsx(L,{variant:"ghost",size:"icon",className:"h-5 w-5 rounded-sm",onClick:Ce,children:t.jsx(pe,{className:"h-3 w-3"})}),t.jsx("span",{className:"truncate font-mono text-[10px] leading-4 text-muted-foreground",children:b==="."?((ue=s.summary)==null?void 0:ue.rootPath)??((he=s.summary)==null?void 0:he.rootName)??"/":b})]}),g&&t.jsxs("div",{className:"mt-1 flex items-center gap-1 rounded-sm bg-muted/35 px-1.5 py-0",children:[t.jsx(xe,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("input",{ref:re,value:j,onChange:a=>y(a.target.value),onKeyDown:a=>{a.key==="Escape"&&(y(""),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:()=>{y(""),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(_e,{className:"h-3 w-3"})})]})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1",children:W&&J.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..."}):ee?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:ee}):J.length>0?t.jsx("div",{className:"space-y-0",children:J.map(a=>{const r=a.entry,n=(u==null?void 0:u.path)===r.path||!u&&r.type==="directory"&&b===r.path;return t.jsxs("button",{type:"button","aria-current":n?"page":void 0,style:{"--tree-depth":a.depth,paddingLeft:`${4+a.depth*11}px`},onClick:()=>{r.type==="directory"?w?X(r.path):Se(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",n?'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(Oe,{className:x("h-3 w-3 shrink-0 text-muted-foreground transition-transform",n&&"text-primary",a.expanded&&"rotate-90")}):t.jsx("span",{className:"h-3 w-3 shrink-0"}),r.type==="directory"?t.jsx(me,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",n&&"text-primary")}):t.jsx(Ke,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",n&&"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",n?"text-primary/75":"text-muted-foreground"),children:a.loading?"loading":tt(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",!u&&"hidden lg:flex"),children:u?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(L,{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:()=>C(null),children:t.jsx(pe,{className:"h-3 w-3"})}),t.jsx("div",{className:"min-w-0 truncate font-mono text-[10px] leading-5 text-muted-foreground",children:u.path})]}),u.downloadUrl&&t.jsx(Y,{href:u.downloadUrl,filePath:u.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(et,{content:u,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 et({content:e,rootPath:i,onOpenFile:l}){const d=e.downloadUrl;if(e.truncated&&!e.content)return t.jsx(ke,{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 s=e.content?`data:${e.mimeType};base64,${e.content}`:d;return s?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:s,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(ve,{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 s=e.content;try{s=JSON.stringify(JSON.parse(e.content),null,2)}catch{}return t.jsx(be,{content:s,truncated:e.truncated})}return e.kind==="markdown"?t.jsx(Re,{content:e.content,truncated:e.truncated,resolveFileLink:s=>He(s,i,{allowRootRelative:!0,baseFilePath:e.path}),onOpenFileLink:l}):e.kind==="text"||e.kind==="html"?t.jsx(be,{content:e.content,truncated:e.truncated}):t.jsx(ve,{content:e})}function be({content:e,truncated:i}){return t.jsxs("div",{className:"rounded-sm bg-background/55",children:[t.jsx($e,{content:e}),i&&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 ve({content:e}){return t.jsx(ke,{title:`${e.kind} file`,description:e.path,action:e.downloadUrl?t.jsx(Y,{href:e.downloadUrl,filePath:e.path}):void 0})}function Y({href:e,filePath:i,iconOnly:l=!1}){const d=o.useCallback(s=>{we()&&(s.preventDefault(),Ie({href:e,filePath:i}).catch(h=>{ze.error(h instanceof Error?h.message:"Failed to save file")}))},[i,e]);return t.jsx(L,{asChild:!0,variant:"ghost",size:l?"icon":"sm",className:x("rounded-sm text-primary shadow-none hover:bg-primary/10 hover:text-primary",l?"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":l?"Download file":void 0,title:l?"Download file":void 0,onClick:d,children:[t.jsx(Je,{className:"h-3.5 w-3.5"}),!l&&"Download"]})})}function ke({title:e,description:i,action:l}){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:i}),l&&t.jsx("div",{className:"mt-2.5 flex justify-center",children:l})]})})}function I({children:e,tone:i}){return t.jsx("div",{className:x("flex h-48 items-center justify-center text-[12px]",i==="muted"?"text-muted-foreground":"text-destructive"),children:e})}function tt(e){return e.type==="directory"?"dir":e.size===void 0?e.kind??"file":`${e.kind??"file"} · ${at(e.size)}`}function rt(e){if(e===".")return[];const i=e.split("/").filter(Boolean);return i.map((l,d)=>i.slice(0,d+1).join("/"))}function at(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}export{lt as FilesTab};
|
package/dashboard/assets/{MarkdownPreviewFrame-tY-M5bCG.js → MarkdownPreviewFrame-hB6tBCB8.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as p,r as h,j as e,b as s}from"./index-
|
|
1
|
+
import{c as p,r as h,j as e,b as s}from"./index-9hU42hur.js";import{J as f}from"./DashboardShared-CtD601bB.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,21 @@
|
|
|
1
|
+
import{c as O,j as e,I as re,B as v,au as A,an as K,r as i,bG as te,bF as ne,as as T,z as ae,A as ie,E as le,bH as oe,v as ce,C as de}from"./index-9hU42hur.js";/**
|
|
2
|
+
* @license lucide-react v1.7.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ue=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],xe=O("maximize-2",ue);/**
|
|
7
|
+
* @license lucide-react v1.7.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const me=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],he=O("minimize-2",me);/**
|
|
12
|
+
* @license lucide-react v1.7.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const fe=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],pe=O("play",fe);/**
|
|
17
|
+
* @license lucide-react v1.7.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const ve=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],we=O("settings-2",ve),_="8314",be={getOutput:ne,createPreviewSession:te};function ge({taskId:s,api:n=be,allowPortPreview:l=!1}){const[a,d]=i.useState(null),[t,x]=i.useState(null),[u,m]=i.useState(null),[h,f]=i.useState(_),[j,b]=i.useState(!1),[P,S]=i.useState(!0),[w,c]=i.useState(null),[Z,F]=i.useState(!1),[L,p]=i.useState(!1),U=i.useCallback(async()=>{S(!0),c(null),d(null),x(null),m(null),p(!1);try{const r=await n.getOutput(s);d(r),S(!1)}catch(r){c(r instanceof Error?r.message:"Failed to load output"),S(!1)}},[n,s]);i.useEffect(()=>{U()},[U]);const N=i.useCallback(async r=>{c(null);try{const o=await n.createPreviewSession(s,r!=null&&r.path?{path:r.path}:void 0);x(o),b(!1),p(!1),r&&m(r),T("preview.created",{result:"success",previewType:(r==null?void 0:r.kind)??"file"})}catch(o){c(o instanceof Error?o.message:"Failed to create preview session"),T("preview.failed",{result:"failed",previewType:(r==null?void 0:r.kind)??"file"})}},[n,s]),M=i.useCallback(async r=>{const o=r??Number.parseInt(h.trim()||_,10);if(!Number.isInteger(o)||o<1||o>65535){c("Enter a port between 1 and 65535");return}c(null);try{const C=await n.createPreviewSession(s,{port:o});x(C),m(null),f(String(o)),b(!0),p(!1),T("preview.created",{result:"success",previewType:"service-port"})}catch(C){c(C instanceof Error?C.message:"Failed to create preview session"),T("preview.failed",{result:"failed",previewType:"service-port"})}},[n,h,s]),k=i.useMemo(()=>W(a),[a]);i.useEffect(()=>{if(j||!(a!=null&&a.available)||k.length===0||t&&t.kind!=="service")return;const r=u??k[0];r&&N(r)},[u,a,k,j,t,N]);const g=i.useCallback(()=>{if((t==null?void 0:t.kind)==="service"&&typeof t.port=="number"){M(t.port);return}x(null);const r=u??W(a)[0];r&&N(r)},[u,a,t,M,N]);if(i.useEffect(()=>{if(!t)return;const r=t.expiresAt-Date.now()-5e3;if(r<=0){g();return}const o=window.setTimeout(g,r);return()=>window.clearTimeout(o)},[g,t]),P)return e.jsx(E,{children:"Loading preview..."});const y=l&&j;if(w&&t&&!y)return e.jsx(E,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-[11px] text-destructive",children:w}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(v,{variant:"outline",size:"sm",onClick:g,className:"rounded-sm",children:[e.jsx(A,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});const H=!!(a!=null&&a.available);if(!H&&!l)return e.jsx(E,{children:"Task output is not available yet."});if(!t)return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-3 py-1.5",children:e.jsx(D,{session:null,serviceModeOpen:y,allowPortPreview:l,servicePort:h,previewEntries:k,activeEntry:u,filesMenuOpen:L,onRefresh:g,onFullscreen:()=>F(!0),onServiceModeToggle:()=>{p(!1),b(r=>!r)},onServicePortChange:f,onServiceStart:()=>void M(),onFileMenuToggle:()=>p(r=>!r),onEntrySelect:r=>{p(!1),N(r)}})}),y?e.jsx(R,{serviceSession:null,error:w}):e.jsx(E,{children:w?e.jsx("span",{className:"text-[11px] text-destructive",children:w}):H?k.length>0?"Starting preview session...":"No HTML or Markdown files were found in this task output.":"Task output is not available yet."})]});const V=Y(t),ee=z(t),B=Q(t),q=X(t),$=t.kind==="service"?t:null,se=y?$:t,G=e.jsx("iframe",{src:B,className:"h-full w-full border-0",sandbox:q,title:"Task Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-3 py-1.5",children:e.jsx(D,{session:se,serviceModeOpen:y,allowPortPreview:l,servicePort:h,previewEntries:k,activeEntry:u,filesMenuOpen:L,onRefresh:g,onFullscreen:()=>F(!0),onServiceModeToggle:()=>{p(!1),b(r=>!r)},onServicePortChange:f,onServiceStart:()=>void M(),onFileMenuToggle:()=>p(r=>!r),onEntrySelect:r=>{p(!1),N(r)}})}),y?e.jsx(R,{serviceSession:$,error:w,children:$?G:null}):e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-sm border border-border/60 bg-white shadow-none",children:G})}),e.jsx(ae,{open:Z,onOpenChange:F,children:e.jsxs(ie,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(le,{className:"sr-only",children:["Preview: ",V]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-3 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-[12px] font-semibold text-foreground",children:V}),e.jsx("span",{className:"text-xs text-muted-foreground",children:I(t.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:g,title:"Refresh",children:e.jsx(A,{className:"h-3.5 w-3.5"})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:ee,target:"_blank",rel:"noopener noreferrer",children:e.jsx(K,{className:"h-3.5 w-3.5"})})}),e.jsx(oe,{asChild:!0,children:e.jsxs(v,{variant:"outline",size:"sm",className:"h-6 rounded-sm px-2 text-[11px]",title:"Exit fullscreen",children:[e.jsx(he,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:B,className:"h-full w-full border-0",sandbox:q,title:"Task Preview Fullscreen"})})]})})]})}function W(s){var a,d;const n=((a=s==null?void 0:s.summary)==null?void 0:a.htmlEntries)??[],l=((d=s==null?void 0:s.summary)==null?void 0:d.markdownEntries)??[];return[...n.map(t=>({...t,kind:"html"})),...l.map(t=>({...t,kind:"markdown"}))]}function je({entries:s,activeEntry:n,open:l,onToggle:a,onEntrySelect:d}){const t=s[0];if(!t)return null;const x=n??t,u=J(x);return e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("button",{type:"button","aria-expanded":l,"aria-haspopup":"menu","aria-label":"Preview files",onClick:a,className:"flex h-6 max-w-[min(24rem,calc(100vw-7rem))] items-center gap-1.5 rounded-sm px-1.5 text-left text-[12px] font-semibold text-foreground transition-colors hover:bg-background/70",children:[e.jsx("span",{className:"truncate",children:x.label}),e.jsx(ce,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]}),l&&e.jsx("div",{role:"menu","aria-label":"Preview files",className:"absolute left-0 top-full z-30 mt-1 max-h-64 min-w-[14rem] max-w-[min(28rem,calc(100vw-4rem))] overflow-y-auto rounded-sm border border-border/70 bg-popover/95 p-1 text-popover-foreground shadow-[0_16px_48px_-34px_rgba(0,0,0,0.45)] backdrop-blur-xl",children:s.map(m=>{const h=J(m),f=h===u;return e.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":f,onClick:()=>d(m),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1 text-left text-[11px] leading-4 text-foreground transition-colors hover:bg-accent/75 hover:text-accent-foreground",children:[e.jsx("span",{className:"w-3.5 shrink-0 text-primary",children:f?e.jsx(de,{className:"h-3.5 w-3.5"}):null}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label})]},h)})})]})}function J(s){return`${s.kind}:${s.path}`}function D({session:s,serviceModeOpen:n,allowPortPreview:l,servicePort:a,previewEntries:d=[],activeEntry:t=null,filesMenuOpen:x=!1,onRefresh:u,onFullscreen:m,onServiceModeToggle:h,onServicePortChange:f,onServiceStart:j,onFileMenuToggle:b,onEntrySelect:P}){const S=s?z(s):null,w=!n&&d.length>0&&b&&P;return e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:n&&f&&j?e.jsxs("form",{className:"flex min-w-0 items-center gap-1.5",onSubmit:c=>{c.preventDefault(),j()},children:[e.jsx("span",{className:"shrink-0 text-[12px] font-semibold text-foreground",children:"Preview service"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:["Port",e.jsx(re,{type:"text",min:1,max:65535,inputMode:"numeric",value:a??"",onChange:c=>f(c.target.value),placeholder:_,"aria-label":"Service preview port",className:"h-6 w-20 rounded-sm border-0 bg-muted/55 px-2 text-[11px] shadow-none focus:bg-muted/55 focus:outline-none focus-visible:border-0 focus-visible:bg-muted/55 focus-visible:ring-0 focus-visible:ring-offset-0"})]}),e.jsxs(v,{type:"submit",variant:"ghost",size:"sm",className:"h-6 rounded-sm border-0 bg-primary/10 px-2 text-[11px] text-primary shadow-none hover:bg-primary/15 hover:text-primary",children:[e.jsx(pe,{className:"h-3.5 w-3.5"}),"Preview"]}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:I(s.expiresAt)})]}):e.jsxs(e.Fragment,{children:[w?e.jsx(je,{entries:d,activeEntry:t,open:x,onToggle:b,onEntrySelect:P}):e.jsx("span",{className:"truncate text-[12px] font-semibold text-foreground",children:s?Y(s):"Preview"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:I(s.expiresAt)})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:u,title:"Refresh",children:e.jsx(A,{className:"h-3.5 w-3.5"})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:S??s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(K,{className:"h-3.5 w-3.5"})})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:m,title:"Fullscreen",children:e.jsx(xe,{className:"h-3.5 w-3.5"})})]}),l&&e.jsxs(v,{type:"button",variant:n?"secondary":"ghost",size:"sm","aria-pressed":n,onClick:h,className:"h-6 shrink-0 rounded-sm px-2 text-[11px]",children:[e.jsx(we,{className:"h-3.5 w-3.5"}),"Advanced"]})]})]})}function R({serviceSession:s,error:n,children:l}){return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n&&e.jsx("div",{className:"shrink-0 border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-xs text-destructive",children:n}),e.jsx("div",{className:"min-h-0 flex-1 p-2",children:s&&l?e.jsx("div",{className:"h-full overflow-hidden rounded-sm border border-border/60 bg-white shadow-none",children:l}):e.jsx(E,{children:"No service preview running."})})]})}function z(s){return s.openUrl??s.previewUrl}function Q(s){return s.kind==="service"?z(s):s.previewUrl}function X(s){return s.kind==="service"?void 0:"allow-scripts allow-same-origin"}function Y(s){if(s.kind==="service"&&typeof s.port=="number"){const n=s.entryPath?`/${s.entryPath.replace(/^\/+/,"")}`:"";return`127.0.0.1:${s.port}${n}`}return s.entryPath}function E({children:s}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:s})}function I(s){const n=Math.max(0,Math.round((s-Date.now())/1e3));if(n<60)return`${n}s`;const l=Math.floor(n/60),a=n%60;return`${l}m ${a}s`}const ke=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SERVICE_PREVIEW_PORT:_,PreviewHeader:D,PreviewServicePanel:R,PreviewTab:ge,getPreviewIframeSandbox:X,getPreviewIframeSrc:Q,getPreviewOpenUrl:z},Symbol.toStringTag,{value:"Module"}));export{_ as D,pe as P,X as a,Q as b,ke as c,z as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-B_30Lp2l.js","assets/index-9hU42hur.js","assets/index-DQIXvvgG.css","assets/MarkdownPreviewFrame-hB6tBCB8.js","assets/DashboardShared-CtD601bB.js","assets/file-B8vnmnf2.js","assets/PreviewTab-BBaAgEyn.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{b5 as N,r as s,j as e,bs as k,Q as S,U as T,a8 as C,bt as P,bu as M,bv as j,bw as E,bx as _,a3 as w,by as L}from"./index-9hU42hur.js";import{w as O,x as A,u as I,s as F,h as R,L as z,M as D,C as U,T as v,m as B}from"./DashboardShared-CtD601bB.js";const G=s.lazy(async()=>({default:(await w(()=>import("./FilesTab-B_30Lp2l.js"),__vite__mapDeps([0,1,2,3,4,5]))).FilesTab})),V=s.lazy(async()=>({default:(await w(()=>import("./PreviewTab-BBaAgEyn.js").then(r=>r.c),__vite__mapDeps([6,1,2]))).PreviewTab})),q={getOutput:j,getOutputTree:M,getOutputContent:P},W={getOutput:j,createPreviewSession:(t,r)=>L(t,typeof r=="string"?r:r==null?void 0:r.path)};function J(){const{shareId:t}=N(),[r,d]=s.useState(null),[o,n]=s.useState([]),[x,c]=s.useState(!0),[b,i]=s.useState(null),l=s.useRef(null);return s.useEffect(()=>{if(!t){d(null),n([]),i("Shared conversation not found"),c(!1);return}let u=!1;l.current=t,c(!0),i(null);const h=async a=>{try{const[m,f]=await Promise.all([E(t),_(t)]);if(u||l.current!==t)return;d(m),n(y=>a?f.logs:B(y,f.logs)),i(null)}catch(m){if(u||l.current!==t)return;a&&(d(null),n([]),i(m instanceof Error?m.message:"Failed to load shared conversation"))}finally{!u&&l.current===t&&a&&c(!1)}};h(!0);const p=window.setInterval(()=>{h(!1)},2500);return()=>{u=!0,window.clearInterval(p)}},[t]),e.jsx(H,{conversation:r,logs:o,loading:x,error:b})}function H({conversation:t,logs:r,loading:d,error:o}){const[n,x]=s.useState("transcript"),[c,b]=s.useState(!1),i=s.useMemo(()=>{if(!t)return null;const a=O(t.payload.initialMessage);return a.length>0&&A(r,a)?null:a.length>0?I(a,new Date(t.createdAt).toISOString()):null},[t,r]),l=s.useMemo(()=>F([...i?[i]:[],...r]),[i,r]),u=s.useMemo(()=>R(l),[l]),h=(t==null?void 0:t.scope)==="filesPreview",p=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(z,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!d&&o&&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:o})]}),!d&&!o&&l.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(D,{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&&!o&&u.map(({event:a,subItems:m},f)=>e.jsx(U,{event:a,agent:t==null?void 0:t.agent,subItems:m,questionResponseDisabled:!0},`shared-${f}`))]})});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(k,{status:t.status}),e.jsx(S,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[e.jsxs("div",{children:["updated ",T(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:[c&&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/ai-microsoft/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(Q,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>b(a=>!a),"aria-expanded":c,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(C,{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==null?void 0:t.title)??"Shared conversation"})]})]}),h&&e.jsxs("div",{className:"mt-3 inline-flex h-auto rounded-sm bg-muted/70 p-0.5 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>x("transcript"),className:g(n==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>x("files"),className:g(n==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>x("preview"),className:g(n==="preview"),children:"Preview"})]})]}),h&&t?e.jsxs(e.Fragment,{children:[n==="transcript"&&p,n==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading files..."}),children:e.jsx(G,{taskId:t.shareId,api:q})})}),n==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading preview..."}),children:e.jsx(V,{taskId:t.shareId,api:W,allowPortPreview:!1})})})]}):p]})]})]})}function g(t){return t?"inline-flex items-center justify-center whitespace-nowrap rounded-sm bg-background px-2.5 py-0.5 text-[11px] font-medium text-foreground shadow-sm":"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-2.5 py-0.5 text-[11px] font-medium transition-colors hover:text-foreground"}function Q({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{J as SharedConversationPage,H as SharedConversationView};
|