meshy-node 0.6.10 → 0.7.2
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-BPjhUitz.js +134 -0
- package/dashboard/assets/{DashboardShared-Cp1PtqR4.js → DashboardShared-BH63Fv3w.js} +14 -14
- package/dashboard/assets/{DiffTab-ByqKEMMX.js → DiffTab-CJpDtHss.js} +2 -2
- package/dashboard/assets/{FilesTab-DduCc88K.js → FilesTab-D5FGbmOx.js} +4 -4
- package/dashboard/assets/{PreviewTab-tzyoRAdH.js → PreviewTab-CfHMHHQj.js} +2 -2
- package/dashboard/assets/{SharedConversationPage-CR-ifEMz.js → SharedConversationPage-B-16RtZR.js} +3 -3
- package/dashboard/assets/{file-irHQknFz.js → file-BlNP1aly.js} +1 -1
- package/dashboard/assets/index-C920K5oZ.js +321 -0
- package/dashboard/assets/index-DtAYxdhK.css +1 -0
- package/dashboard/assets/{play-BupOIahu.js → play-b-4tjLEk.js} +1 -1
- package/dashboard/index.html +2 -2
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-BFq2FfuI.js +0 -134
- package/dashboard/assets/index-BAhTyv8k.js +0 -321
- package/dashboard/assets/index-DVQohQR6.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,
|
|
1
|
+
import{r as l,bu as P,bo as O,j as e,N as g,b as N,v as $,k as T,i as R}from"./index-C920K5oZ.js";import{G as _}from"./DashboardPage-BPjhUitz.js";import{F as B}from"./file-BlNP1aly.js";import"./DashboardShared-BH63Fv3w.js";import"./play-b-4tjLEk.js";function D(r,t){if(!(r!=null&&r.trim()))return[];const s=r.split(`
|
|
2
2
|
`),n=[];let a=[];const d=()=>{if(a.length===0)return;const c=a.join(`
|
|
3
|
-
`).trim();if(!c){a=[];return}const i=J(a);if(!i){a=[];return}n.push({id:`${t}:${i}`,path:i,section:t,patch:c}),a=[]};for(const c of s)c.startsWith("diff --git ")&&a.length>0&&d(),a.push(c);return d(),n}function I(r){const t=[];for(const s of[...r].sort((n,a)=>n.path.localeCompare(a.path))){const n=s.path.split("/").filter(Boolean);let a=t,d="";n.forEach((c,i)=>{d=d?`${d}/${c}`:c;const h=i===n.length-1;let u=a.find(b=>b.name===c);u||(u=h?{type:"file",name:c,path:d,item:s}:{type:"folder",name:c,path:d,children:[]},a.push(u)),h||(u.children??(u.children=[]),a=u.children)})}return t}function G(r){const t=[];let s="";for(const n of r.split("/").filter(Boolean).slice(0,-1))s=s?`${s}/${n}`:n,t.push(s);return t}function A(r){return r.filter(t=>t&&!t.endsWith("/")).map(t=>({id:`untracked:${t}`,path:t,section:"untracked"}))}function J(r){var d,c;const t=(d=r.find(i=>i.startsWith("+++ ")))==null?void 0:d.slice(4).trim();if(t&&t!=="/dev/null")return y(t);const s=(c=r.find(i=>i.startsWith("--- ")))==null?void 0:c.slice(4).trim();if(s&&s!=="/dev/null")return y(s);const n=r.find(i=>i.startsWith("diff --git "));if(!n)return null;const a=n.match(/^diff --git a\/(.+?) b\/(.+)$/);return a?y(a[2]||a[1]||""):null}function y(r){return r.replace(/^[ab]\//,"")}const w={staged:"Staged",unstaged:"Unstaged",untracked:"Untracked"};function re({taskId:r}){const[t,s]=l.useState(null),[n,a]=l.useState(!0),[d,c]=l.useState(null),[i,h]=l.useState(null),[u,b]=l.useState(null),[
|
|
3
|
+
`).trim();if(!c){a=[];return}const i=J(a);if(!i){a=[];return}n.push({id:`${t}:${i}`,path:i,section:t,patch:c}),a=[]};for(const c of s)c.startsWith("diff --git ")&&a.length>0&&d(),a.push(c);return d(),n}function I(r){const t=[];for(const s of[...r].sort((n,a)=>n.path.localeCompare(a.path))){const n=s.path.split("/").filter(Boolean);let a=t,d="";n.forEach((c,i)=>{d=d?`${d}/${c}`:c;const h=i===n.length-1;let u=a.find(b=>b.name===c);u||(u=h?{type:"file",name:c,path:d,item:s}:{type:"folder",name:c,path:d,children:[]},a.push(u)),h||(u.children??(u.children=[]),a=u.children)})}return t}function G(r){const t=[];let s="";for(const n of r.split("/").filter(Boolean).slice(0,-1))s=s?`${s}/${n}`:n,t.push(s);return t}function A(r){return r.filter(t=>t&&!t.endsWith("/")).map(t=>({id:`untracked:${t}`,path:t,section:"untracked"}))}function J(r){var d,c;const t=(d=r.find(i=>i.startsWith("+++ ")))==null?void 0:d.slice(4).trim();if(t&&t!=="/dev/null")return y(t);const s=(c=r.find(i=>i.startsWith("--- ")))==null?void 0:c.slice(4).trim();if(s&&s!=="/dev/null")return y(s);const n=r.find(i=>i.startsWith("diff --git "));if(!n)return null;const a=n.match(/^diff --git a\/(.+?) b\/(.+)$/);return a?y(a[2]||a[1]||""):null}function y(r){return r.replace(/^[ab]\//,"")}const w={staged:"Staged",unstaged:"Unstaged",untracked:"Untracked"};function re({taskId:r}){const[t,s]=l.useState(null),[n,a]=l.useState(!0),[d,c]=l.useState(null),[i,h]=l.useState(null),[u,b]=l.useState(null),[L,v]=l.useState(!1),[M,k]=l.useState(null),S=l.useCallback(async()=>{a(!0),c(null),s(null);try{const o=await P(r);s(o)}catch(o){c(o instanceof Error?o.message:"Failed to load diff")}finally{a(!1)}},[r]);l.useEffect(()=>{S()},[S]);const E=l.useMemo(()=>D(t==null?void 0:t.staged,"staged"),[t==null?void 0:t.staged]),F=l.useMemo(()=>D(t==null?void 0:t.unstaged,"unstaged"),[t==null?void 0:t.unstaged]),C=l.useMemo(()=>A((t==null?void 0:t.untrackedFiles)??[]),[t==null?void 0:t.untrackedFiles]),j=l.useMemo(()=>[{section:"staged",items:E},{section:"unstaged",items:F},{section:"untracked",items:C}],[E,F,C]),p=l.useMemo(()=>j.flatMap(o=>o.items),[j]),m=l.useMemo(()=>p.find(o=>o.id===i)??p[0]??null,[p,i]);return l.useEffect(()=>{var o;(!i||!p.some(x=>x.id===i))&&h(((o=p[0])==null?void 0:o.id)??null)},[p,i]),l.useEffect(()=>{if(b(null),k(null),v(!1),!m||m.section!=="untracked")return;if(m.path.endsWith("/")){k("This untracked path is a directory. Open the Files tab to inspect its contents.");return}let o=!1;return v(!0),O(r,m.path).then(x=>{o||b(x)}).catch(x=>{o||k(x instanceof Error?x.message:"Failed to load file content")}).finally(()=>{o||v(!1)}),()=>{o=!0}},[m,r]),n?e.jsx(f,{tone:"muted",children:"Loading diff..."}):d?e.jsx(f,{tone:"destructive",children:d}):t!=null&&t.available?p.length>0?e.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[16rem_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"flex min-h-0 flex-col border-b border-border/60 bg-background/30 lg:border-b-0 lg:border-r",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-2.5 py-2",children:[e.jsx("div",{className:"text-[9px] font-medium uppercase tracking-[0.2em] text-muted-foreground",children:"Repository diff"}),e.jsx("div",{className:"mt-1 flex items-start justify-between gap-1.5",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-semibold text-foreground",children:[e.jsx(_,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:t.branch??"detached HEAD"})]}),t.repoRoot&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[9px] text-muted-foreground",children:t.repoRoot})]})}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:j.map(o=>e.jsxs(g,{variant:"outline",className:"rounded-sm border-border/70 bg-background/60 px-1.5 py-0 text-[9px]",children:[w[o.section]," ",o.items.length]},o.section))})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1",children:e.jsx("div",{className:"space-y-1",children:j.map(({section:o,items:x})=>e.jsx(V,{section:o,items:x,selectedId:(m==null?void 0:m.id)??null,onSelect:h},o))})})]}),e.jsx("section",{className:"min-h-0 flex flex-col bg-card/10",children:m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-2.5 py-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[e.jsx(g,{variant:"outline",className:"rounded-sm border-border/70 bg-background/60 px-1.5 py-0 text-[9px]",children:w[m.section]}),m.section==="untracked"?e.jsx(g,{variant:"secondary",className:"rounded-sm px-1.5 py-0 text-[9px]",children:"File content"}):e.jsx(g,{variant:"secondary",className:"rounded-sm px-1.5 py-0 text-[9px]",children:"Diff patch"})]}),e.jsx("div",{className:"mt-1 break-all font-mono text-[9px] text-muted-foreground",children:m.path})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-1.5",children:m.section==="untracked"?e.jsx(q,{loading:L,error:M,content:u}):e.jsx(H,{patch:m.patch??""})})]}):e.jsx(f,{tone:"muted",children:"Select a file to inspect."})})]}):e.jsx(f,{tone:"muted",children:"Working tree is clean."}):e.jsx(f,{tone:"muted",children:"Task working directory is not inside a Git repository."})}function V({section:r,items:t,selectedId:s,onSelect:n}){const a=l.useMemo(()=>I(t),[t]),d=l.useMemo(()=>t.find(u=>u.id===s)??null,[t,s]),c=l.useMemo(()=>new Set(d?G(d.path):[]),[d]),[i,h]=l.useState(!0);return e.jsxs("section",{className:"rounded-sm border border-border/60 bg-background/35",children:[e.jsxs("button",{type:"button",onClick:()=>h(u=>!u),"aria-expanded":i,className:N("flex w-full items-center justify-between gap-1.5 px-2 py-1 text-left transition-colors hover:bg-background/55",i?"border-b border-border/60":""),children:[e.jsxs("div",{className:"flex items-center gap-1",children:[i?e.jsx($,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):e.jsx(T,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"text-[10px] font-medium text-foreground",children:w[r]})]}),e.jsx(g,{variant:"outline",className:"rounded-sm border-border/70 bg-background/60 px-1.5 py-0 text-[9px]",children:t.length})]}),i&&e.jsx("div",{className:"p-1",children:a.length>0?e.jsx("div",{className:"space-y-0.5",children:a.map(u=>e.jsx(U,{node:u,depth:0,selectedId:s,expandedAncestorPaths:c,onSelect:n},`${r}:${u.path}`))}):e.jsx("div",{className:"rounded-sm border border-dashed border-border/70 bg-background/30 px-2 py-1 text-[10px] text-muted-foreground",children:"No files."})})]})}function U({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){var d;return r.type==="folder"?e.jsx(z,{node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}):e.jsxs("button",{type:"button",onClick:()=>{r.item&&a(r.item.id)},className:N("flex w-full cursor-pointer items-center gap-1 rounded-sm px-1 py-0.5 text-left transition-colors",((d=r.item)==null?void 0:d.id)===s?"bg-primary/10 text-foreground":"text-foreground/90 hover:bg-background/55"),style:{paddingLeft:`${t*10+5}px`},children:[e.jsx(B,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate text-[10px] leading-4",children:r.name})]})}function z({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){const[d,c]=l.useState(!0);return l.useEffect(()=>{n.has(r.path)&&c(!0)},[n,r.path]),e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>c(i=>!i),"aria-expanded":d,className:"flex w-full cursor-pointer select-none items-center gap-1 rounded-sm px-1 py-0.5 text-left text-[10px] leading-4 text-muted-foreground transition-colors hover:bg-background/55 hover:text-foreground",style:{paddingLeft:`${t*10+5}px`},children:[d?e.jsx($,{className:"h-3 w-3 shrink-0"}):e.jsx(T,{className:"h-3 w-3 shrink-0"}),e.jsx(R,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:r.name})]}),d&&e.jsx("div",{className:"space-y-0.5",children:(r.children??[]).map(i=>e.jsx(U,{node:i,depth:t+1,selectedId:s,expandedAncestorPaths:n,onSelect:a},i.path))})]})}function H({patch:r}){const t=r.split(`
|
|
4
4
|
`);return e.jsxs("div",{className:"rounded-sm border border-border/60 bg-background/55",children:[e.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[e.jsx("div",{className:"text-[10px] font-medium text-foreground",children:"File diff"}),e.jsxs("div",{className:"mt-0.5 text-[9px] text-muted-foreground",children:[t.length," lines"]})]}),e.jsx("div",{className:"font-mono text-[10px] leading-4",children:t.map((s,n)=>e.jsxs("div",{className:N("grid grid-cols-[36px_minmax(0,1fr)] gap-2 px-2.5 py-px",K(s)),children:[e.jsx("span",{className:"select-none text-right text-muted-foreground/55",children:n+1}),e.jsx("span",{className:"whitespace-pre-wrap break-all text-foreground",children:s||" "})]},`${n}-${s}`))})]})}function q({loading:r,error:t,content:s}){if(r)return e.jsx(f,{tone:"muted",children:"Loading file content..."});if(t)return e.jsx(f,{tone:"destructive",children:t});if(!s)return e.jsx(f,{tone:"muted",children:"Select an untracked file to preview its content."});if(s.kind==="image"){const n=s.content?`data:${s.mimeType};base64,${s.content}`:s.downloadUrl;return n?e.jsx("div",{className:"flex min-h-[18rem] items-center justify-center rounded-sm border border-border/60 bg-background/55 p-3",children:e.jsx("img",{src:n,alt:s.path,className:"max-h-full max-w-full rounded-sm object-contain shadow-[0_24px_90px_-52px_rgba(0,0,0,0.65)]"})}):e.jsx(f,{tone:"muted",children:"Image preview is not available."})}if(s.kind==="pdf"&&s.downloadUrl)return e.jsx("div",{className:"h-full min-h-[22rem] overflow-hidden rounded-sm border border-border/60 bg-background/55",children:e.jsx("iframe",{src:s.downloadUrl,title:s.path,className:"h-full w-full border-0"})});if(s.kind==="json"){let n=s.content;try{n=JSON.stringify(JSON.parse(s.content),null,2)}catch{}return e.jsx(W,{content:n,truncated:s.truncated})}return s.kind==="markdown"||s.kind==="text"||s.kind==="html"?e.jsx(W,{content:s.content,truncated:s.truncated}):e.jsx(f,{tone:"muted",children:"This file cannot be previewed inline."})}function W({content:r,truncated:t}){return e.jsxs("div",{className:"rounded-sm border border-border/60 bg-background/55",children:[e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-2.5 py-2 font-mono text-[10px] leading-4 text-foreground",children:r}),t&&e.jsx("div",{className:"border-t border-border/60 px-2.5 py-1.5 text-[10px] text-muted-foreground",children:"Content truncated. Open the Files tab to inspect the full artifact."})]})}function f({children:r,tone:t}){return e.jsx("div",{className:N("flex h-full min-h-[10rem] items-center justify-center rounded-sm text-[10px]",t==="muted"?"text-muted-foreground":"text-destructive"),children:r})}function K(r){return r.startsWith("@@")?"bg-sky-500/10":r.startsWith("+")&&!r.startsWith("+++")?"bg-emerald-500/10":r.startsWith("-")&&!r.startsWith("---")?"bg-destructive/10":r.startsWith("diff ")||r.startsWith("index ")||r.startsWith("---")||r.startsWith("+++")?"bg-muted/45":""}export{re as DiffTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as p,r as o,
|
|
1
|
+
import{c as p,r as o,bo as P,bp as H,bq as J,j as e,N as j,B as m,i as V,k as q,b as x}from"./index-C920K5oZ.js";import{F as K}from"./file-BlNP1aly.js";import{w as W}from"./DashboardShared-BH63Fv3w.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,10 +13,10 @@ import{c as p,r as o,bg as P,bh as H,bi as J,j as e,M as j,B as m,i as V,k as K,
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Y=[["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"}]],
|
|
16
|
+
*/const Y=[["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"}]],v=p("download",Y);/**
|
|
17
17
|
* @license lucide-react v1.7.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Z=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],I=p("eye",Z),ee={getOutput:J,getOutputTree:H,getOutputContent:P};function oe({taskId:r,api:s=ee}){var F,S,T,O,z,_,E;const[a,l]=o.useState(null),[i,g]=o.useState([]),[c,w]=o.useState("."),[n,h]=o.useState(null),[A,f]=o.useState(!0),[k,u]=o.useState(null),y=o.useCallback(async()=>{u(null),f(!0),w("."),g([]),h(null);try{const t=await s.getOutput(r);if(l(t),!t.available){f(!1);return}const d=await s.getOutputTree(r,".");g(d.entries),f(!1)}catch(t){u(t instanceof Error?t.message:"Failed to load output"),f(!1)}},[s,r]);o.useEffect(()=>{y()},[y]);const b=o.useCallback(async t=>{u(null);try{const d=await s.getOutputTree(r,t);g(d.entries),w(t),h(null)}catch(d){u(d instanceof Error?d.message:"Failed to load directory")}},[s,r]),L=o.useCallback(async t=>{u(null);try{const d=await s.getOutputContent(r,t);h(d)}catch(d){u(d instanceof Error?d.message:"Failed to load file")}},[s,r]),R=o.useCallback(()=>{if(c===".")return;const t=c.split("/");t.pop();const d=t.length===0?".":t.join("/");b(d)},[c,b]);if(A)return e.jsx(
|
|
22
|
-
`),a=`${Math.max(2,String(s.length).length)+1}ch`;return e.jsx("div",{className:"overflow-x-auto font-mono text-[11px] leading-5 text-foreground",children:e.jsx("div",{className:"min-w-full",children:s.map((l,i)=>e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"sticky left-0 shrink-0 select-none border-r border-border/40 bg-background/95 px-2 py-0 text-right tabular-nums text-muted-foreground/55",style:{width:a},children:i+1}),e.jsx("span",{className:"whitespace-pre-wrap break-all px-3 py-0",children:l||" "})]},i))})})}function D({content:r}){return e.jsx(B,{title:`${r.kind} file`,description:r.path,action:r.downloadUrl?e.jsx(m,{asChild:!0,variant:"outline",size:"sm",className:"h-7 rounded-full px-2.5 text-[11px]",children:e.jsxs("a",{href:r.downloadUrl,download:!0,children:[e.jsx(
|
|
21
|
+
*/const Z=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],I=p("eye",Z),ee={getOutput:J,getOutputTree:H,getOutputContent:P};function oe({taskId:r,api:s=ee}){var F,S,T,O,z,_,E;const[a,l]=o.useState(null),[i,g]=o.useState([]),[c,w]=o.useState("."),[n,h]=o.useState(null),[A,f]=o.useState(!0),[k,u]=o.useState(null),y=o.useCallback(async()=>{u(null),f(!0),w("."),g([]),h(null);try{const t=await s.getOutput(r);if(l(t),!t.available){f(!1);return}const d=await s.getOutputTree(r,".");g(d.entries),f(!1)}catch(t){u(t instanceof Error?t.message:"Failed to load output"),f(!1)}},[s,r]);o.useEffect(()=>{y()},[y]);const b=o.useCallback(async t=>{u(null);try{const d=await s.getOutputTree(r,t);g(d.entries),w(t),h(null)}catch(d){u(d instanceof Error?d.message:"Failed to load directory")}},[s,r]),L=o.useCallback(async t=>{u(null);try{const d=await s.getOutputContent(r,t);h(d)}catch(d){u(d instanceof Error?d.message:"Failed to load file")}},[s,r]),R=o.useCallback(()=>{if(c===".")return;const t=c.split("/");t.pop();const d=t.length===0?".":t.join("/");b(d)},[c,b]);if(A)return e.jsx(N,{tone:"muted",children:"Loading files..."});if(k)return e.jsx(N,{tone:"destructive",children:k});if(!(a!=null&&a.available))return e.jsx(N,{tone:"muted",children:"Task output is not available yet. The task may not have started."});const C=(((F=a.summary)==null?void 0:F.htmlEntries.length)??0)+(((T=(S=a.summary)==null?void 0:S.markdownEntries)==null?void 0:T.length)??0);return e.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[18rem_minmax(0,1fr)]",children:[e.jsxs("aside",{className:x("flex min-h-0 flex-col border-b border-border/60 bg-background/30 lg:border-b-0 lg:border-r",n&&"hidden lg:flex"),children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-3 py-2.5",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Task output"}),e.jsxs("div",{className:"mt-1.5 flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:((O=a.summary)==null?void 0:O.rootName)??"Artifacts"}),e.jsxs("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:[((z=a.summary)==null?void 0:z.fileCount)??i.length," files",C>0&&` · ${C} previews`]})]}),e.jsx(j,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px]",children:n?"Inspecting":"Browse"})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-full border border-border/70 bg-background/55 px-2 py-1",children:[c!=="."&&e.jsx(m,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-full",onClick:R,children:e.jsx($,{className:"h-3 w-3"})}),e.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground",children:c==="."?((_=a.summary)==null?void 0:_.rootPath)??((E=a.summary)==null?void 0:E.rootName)??"/":c})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:i.length>0?e.jsx("div",{className:"space-y-0.5",children:i.map(t=>e.jsxs("button",{type:"button",onClick:()=>{t.type==="directory"?b(t.path):L(t.path)},className:x("flex w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",(n==null?void 0:n.path)===t.path?"border-primary/40 bg-primary/10":"border-transparent bg-transparent hover:border-border/60 hover:bg-background/55"),children:[t.type==="directory"?e.jsx(V,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):e.jsx(K,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:t.name}),e.jsx("div",{className:"mt-0 flex items-center gap-1.5 text-[10px] text-muted-foreground",children:t.type==="directory"?e.jsx("span",{children:"Directory"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"capitalize",children:t.kind??"file"}),t.size!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),e.jsx("span",{children:se(t.size)})]})]})})]}),t.type==="directory"&&e.jsx(q,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]},t.path))}):e.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:"Empty directory"})})]}),e.jsx("section",{className:x("min-h-0 flex flex-col bg-card/10",!n&&"hidden lg:flex"),children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-3 py-2.5",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(m,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 rounded-full",onClick:()=>h(null),children:e.jsx($,{className:"h-3 w-3"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(j,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px] capitalize",children:n.kind}),n.truncated&&e.jsx(j,{variant:"secondary",className:"rounded-full text-[10px]",children:"Truncated"})]}),e.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:n.path})]})]}),n.downloadUrl&&e.jsx(m,{asChild:!0,variant:"outline",size:"sm",className:"h-7 rounded-full px-2.5 text-[11px]",children:e.jsxs("a",{href:n.downloadUrl,download:!0,children:[e.jsx(v,{className:"h-3.5 w-3.5"}),"Download"]})})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-2.5",children:e.jsx(re,{content:n})})]}):e.jsx("div",{className:"flex h-full items-center justify-center p-4",children:e.jsxs("div",{className:"max-w-md rounded-lg border border-border/60 bg-background/55 px-4 py-4 text-center",children:[e.jsx("div",{className:"text-[12px] font-medium text-foreground",children:"Select a file to inspect"}),e.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 re({content:r}){const s=r.downloadUrl;if(r.truncated&&!r.content)return e.jsx(B,{title:"File is too large to preview inline",description:r.path,action:s?e.jsx(m,{asChild:!0,variant:"outline",size:"sm",className:"h-7 rounded-full px-2.5 text-[11px]",children:e.jsxs("a",{href:s,download:!0,children:[e.jsx(v,{className:"h-3.5 w-3.5"}),"Download"]})}):void 0});if(r.kind==="image"){const a=r.content?`data:${r.mimeType};base64,${r.content}`:s;return a?e.jsx("div",{className:"flex h-full min-h-[16rem] items-center justify-center rounded-lg border border-border/60 bg-background/55 p-3",children:e.jsx("img",{src:a,alt:r.path,className:"max-h-full max-w-full rounded-sm object-contain shadow-[0_24px_90px_-52px_rgba(0,0,0,0.65)]"})}):e.jsx(D,{content:r})}if(r.kind==="pdf"&&s)return e.jsx("div",{className:"h-full min-h-[20rem] overflow-hidden rounded-lg border border-border/60 bg-background/55",children:e.jsx("iframe",{src:s,title:r.path,className:"h-full w-full border-0"})});if(r.kind==="json"){let a=r.content;try{a=JSON.stringify(JSON.parse(r.content),null,2)}catch{}return e.jsx(M,{content:a,truncated:r.truncated})}return r.kind==="markdown"?e.jsx(te,{content:r.content,truncated:r.truncated}):r.kind==="text"||r.kind==="html"?e.jsx(M,{content:r.content,truncated:r.truncated}):e.jsx(D,{content:r})}function te({content:r,truncated:s}){const[a,l]=o.useState(!1);return e.jsxs("div",{className:"rounded-lg border border-border/60 bg-background",children:[e.jsx("div",{className:"sticky top-0 z-10 flex items-center justify-end rounded-t-[20px] border-b border-border/60 bg-background/95 px-3 py-1.5 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:e.jsxs("div",{className:"flex items-center gap-1 rounded-full border border-border/70 bg-muted/50 p-0.5",children:[e.jsxs("button",{type:"button",onClick:()=>l(!1),className:x("flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] transition-colors",a?"text-muted-foreground hover:text-foreground":"bg-background font-medium text-foreground shadow-sm"),children:[e.jsx(I,{className:"h-3 w-3"}),"Preview"]}),e.jsxs("button",{type:"button",onClick:()=>l(!0),className:x("flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] transition-colors",a?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(X,{className:"h-3 w-3"}),"Raw"]})]})}),a?e.jsx(U,{content:r}):e.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3 text-foreground",children:e.jsx(W,{children:r})}),s&&e.jsx("div",{className:"border-t border-border/60 px-3 py-1.5 text-[10px] text-muted-foreground",children:"Content truncated. Download the file to inspect the full artifact."})]})}function M({content:r,truncated:s}){return e.jsxs("div",{className:"rounded-lg border border-border/60 bg-background",children:[e.jsx(U,{content:r}),s&&e.jsx("div",{className:"border-t border-border/60 px-3 py-1.5 text-[10px] text-muted-foreground",children:"Content truncated. Download the file to inspect the full artifact."})]})}function U({content:r}){const s=r.length===0?[""]:r.split(`
|
|
22
|
+
`),a=`${Math.max(2,String(s.length).length)+1}ch`;return e.jsx("div",{className:"overflow-x-auto font-mono text-[11px] leading-5 text-foreground",children:e.jsx("div",{className:"min-w-full",children:s.map((l,i)=>e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"sticky left-0 shrink-0 select-none border-r border-border/40 bg-background/95 px-2 py-0 text-right tabular-nums text-muted-foreground/55",style:{width:a},children:i+1}),e.jsx("span",{className:"whitespace-pre-wrap break-all px-3 py-0",children:l||" "})]},i))})})}function D({content:r}){return e.jsx(B,{title:`${r.kind} file`,description:r.path,action:r.downloadUrl?e.jsx(m,{asChild:!0,variant:"outline",size:"sm",className:"h-7 rounded-full px-2.5 text-[11px]",children:e.jsxs("a",{href:r.downloadUrl,download:!0,children:[e.jsx(v,{className:"h-3.5 w-3.5"}),"Download"]})}):void 0})}function B({title:r,description:s,action:a}){return e.jsx("div",{className:"flex h-full min-h-[14rem] items-center justify-center rounded-lg border border-dashed border-border/70 bg-background/35 p-4 text-center",children:e.jsxs("div",{className:"max-w-sm",children:[e.jsx("div",{className:"text-[12px] font-medium text-foreground",children:r}),e.jsx("div",{className:"mt-1 break-all font-mono text-[10px] text-muted-foreground",children:s}),a&&e.jsx("div",{className:"mt-2.5 flex justify-center",children:a})]})})}function N({children:r,tone:s}){return e.jsx("div",{className:x("flex h-48 items-center justify-center text-[12px]",s==="muted"?"text-muted-foreground":"text-destructive"),children:r})}function se(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}export{oe as FilesTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as O,j as e,I as W,B as u,
|
|
1
|
+
import{c as O,j as e,I as W,B as u,br as T,ak as B,r as a,bs as X,bq as Y,z as Z,A as ee,E as se,bt as re,N as _}from"./index-C920K5oZ.js";import{P as te}from"./play-b-4tjLEk.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,4 +13,4 @@ import{c as O,j as e,I as W,B as u,bj as T,aj as B,r as a,bk as X,bi as Y,y as Z
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ce=[["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"}]],oe=O("settings-2",ce),de={getOutput:Y,createPreviewSession:X};function he({taskId:s,api:n=de,allowPortPreview:l=!0}){const[i,c]=a.useState(null),[r,v]=a.useState(null),[d,p]=a.useState(null),[b,m]=a.useState(""),[P,k]=a.useState(!1),[V,
|
|
16
|
+
*/const ce=[["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"}]],oe=O("settings-2",ce),de={getOutput:Y,createPreviewSession:X};function he({taskId:s,api:n=de,allowPortPreview:l=!0}){const[i,c]=a.useState(null),[r,v]=a.useState(null),[d,p]=a.useState(null),[b,m]=a.useState(""),[P,k]=a.useState(!1),[V,E]=a.useState(!0),[j,h]=a.useState(null),[G,C]=a.useState(!1),F=a.useCallback(async()=>{E(!0),h(null),c(null),v(null),p(null);try{const t=await n.getOutput(s);c(t),E(!1)}catch(t){h(t instanceof Error?t.message:"Failed to load output"),E(!1)}},[n,s]);a.useEffect(()=>{F()},[F]);const w=a.useCallback(async t=>{h(null);try{const o=await n.createPreviewSession(s,t!=null&&t.path?{path:t.path}:void 0);v(o),k(!1),t&&p(t)}catch(o){h(o instanceof Error?o.message:"Failed to create preview session")}},[n,s]),y=a.useCallback(async t=>{const o=t??Number.parseInt(b,10);if(!Number.isInteger(o)||o<1||o>65535){h("Enter a port between 1 and 65535");return}h(null);try{const S=await n.createPreviewSession(s,{port:o});v(S),p(null),m(String(o)),k(!0)}catch(S){h(S instanceof Error?S.message:"Failed to create preview session")}},[n,b,s]),g=a.useMemo(()=>D(i),[i]);a.useEffect(()=>{if(P||!(i!=null&&i.available)||g.length===0||r&&r.kind!=="service")return;const t=d??g[0];t&&w(t)},[d,i,g,P,r,w]);const f=a.useCallback(()=>{if((r==null?void 0:r.kind)==="service"&&typeof r.port=="number"){y(r.port);return}v(null);const t=d??D(i)[0];t&&w(t)},[d,i,r,y,w]);if(a.useEffect(()=>{if(!r)return;const t=r.expiresAt-Date.now()-5e3;if(t<=0){f();return}const o=window.setTimeout(f,t);return()=>window.clearTimeout(o)},[f,r]),V)return e.jsx(N,{children:"Loading preview..."});const x=l&&P;if(j&&r&&!x)return e.jsx(N,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-sm text-destructive",children:j}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:f,className:"rounded-full",children:[e.jsx(T,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});const $=!!(i!=null&&i.available);if(!$&&!l)return e.jsx(N,{children:"Task output is not available yet."});if(!r)return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:null,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>C(!0),onServiceModeToggle:()=>k(t=>!t),onServicePortChange:m,onServiceStart:()=>void y()}),!x&&e.jsx(L,{entries:g,activeEntry:d,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:null,error:j}):e.jsx(N,{children:j?e.jsx("span",{className:"text-sm text-destructive",children:j}):$?g.length>0?"Starting preview session...":"No HTML or Markdown files were found in this task output.":"Task output is not available yet."})]});const A=K(r),J=q(r),R=ue(r),M=r.kind==="service"?r:null,Q=x?M:r,U=e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:R,title:"Task Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:Q,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>C(!0),onServiceModeToggle:()=>k(t=>!t),onServicePortChange:m,onServiceStart:()=>void y()}),!x&&e.jsx(L,{entries:g,activeEntry:d,previewKind:r.kind,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:M,error:j,children:M?U:null}):e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-2xl border border-border/60 bg-white shadow-sm",children:U})}),e.jsx(Z,{open:G,onOpenChange:C,children:e.jsxs(ee,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(se,{className:"sr-only",children:["Preview: ",A]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:A}),e.jsx("span",{className:"text-xs text-muted-foreground",children:z(r.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:f,title:"Refresh",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:J,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(re,{asChild:!0,children:e.jsxs(u,{variant:"outline",size:"sm",className:"rounded-full",title:"Exit fullscreen",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:R,title:"Task Preview Fullscreen"})})]})})]})}function D(s){var i,c;const n=((i=s==null?void 0:s.summary)==null?void 0:i.htmlEntries)??[],l=((c=s==null?void 0:s.summary)==null?void 0:c.markdownEntries)??[];return[...n.map(r=>({...r,kind:"html"})),...l.map(r=>({...r,kind:"markdown"}))]}function L({entries:s,activeEntry:n,previewKind:l,onEntrySelect:i}){return e.jsx("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.map(c=>{const r=(n==null?void 0:n.path)===c.path;return e.jsx("button",{type:"button",onClick:()=>i(c),className:r?"rounded-full border border-primary/40 bg-primary/10 px-3 py-1 text-xs font-medium text-primary":"rounded-full border border-border/70 bg-background/55 px-3 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:c.label},`${c.kind}:${c.path}`)}),e.jsxs(_,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[s.length," ",s.length===1?"file":"files"]}),e.jsx(_,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:l==="service"?"Service proxy":"Sandboxed iframe"})]})})}function H({session:s,serviceModeOpen:n,allowPortPreview:l,servicePort:i,onRefresh:c,onFullscreen:r,onServiceModeToggle:v,onServicePortChange:d,onServiceStart:p}){const b=s?q(s):null;return e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-3",children:n&&d&&p?e.jsxs("form",{className:"flex min-w-0 items-center gap-2",onSubmit:m=>{m.preventDefault(),p()},children:[e.jsx("span",{className:"shrink-0 text-sm font-semibold text-foreground",children:"Preview service"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:["Port",e.jsx(W,{type:"number",min:1,max:65535,inputMode:"numeric",value:i??"",onChange:m=>d(m.target.value),placeholder:"12345","aria-label":"Service preview port",className:"h-7 w-24 rounded-full px-3 text-xs"})]}),e.jsxs(u,{type:"submit",variant:"outline",size:"sm",className:"h-7 rounded-full px-2.5 text-xs",children:[e.jsx(te,{className:"h-3.5 w-3.5"}),"Run"]}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:z(s.expiresAt)})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:s?K(s):"Preview"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:z(s.expiresAt)})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:c,title:"Refresh",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:b??s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:r,title:"Fullscreen",children:e.jsx(ie,{className:"h-3.5 w-3.5"})})]}),l&&e.jsxs(u,{type:"button",variant:n?"secondary":"ghost",size:"sm","aria-pressed":n,onClick:v,className:"h-7 shrink-0 rounded-full px-2.5 text-xs",children:[e.jsx(oe,{className:"h-3.5 w-3.5"}),"Advanced"]})]})]})}function I({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-2xl border border-border/60 bg-white shadow-sm",children:l}):e.jsx(N,{children:"No service preview running."})})]})}function q(s){return s.openUrl??s.previewUrl}function ue(s){return s.kind==="service"?void 0:"allow-scripts allow-same-origin"}function K(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 N({children:s}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:s})}function z(s){const n=Math.max(0,Math.round((s-Date.now())/1e3));if(n<60)return`${n}s`;const l=Math.floor(n/60),i=n%60;return`${l}m ${i}s`}export{H as PreviewHeader,I as PreviewServicePanel,he as PreviewTab,L as PreviewToolbar,ue as getPreviewIframeSandbox,q as getPreviewOpenUrl};
|
package/dashboard/assets/{SharedConversationPage-CR-ifEMz.js → SharedConversationPage-B-16RtZR.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-
|
|
2
|
-
import{c as N,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-D5FGbmOx.js","assets/index-C920K5oZ.js","assets/index-DtAYxdhK.css","assets/file-BlNP1aly.js","assets/DashboardShared-BH63Fv3w.js","assets/PreviewTab-CfHMHHQj.js","assets/play-b-4tjLEk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as N,aV as k,r as s,j as e,O as S,P as T,U as C,a8 as P,bf as M,bg as _,bh as j,bi as E,bj as L,a3 as w,bk as O}from"./index-C920K5oZ.js";import{u as A,q as I,p as z,h as F,L as R,C as V,T as v,m as q}from"./DashboardShared-BH63Fv3w.js";/**
|
|
3
3
|
* @license lucide-react v1.7.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const
|
|
7
|
+
*/const D=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],B=N("message-square-text",D),G=s.lazy(async()=>({default:(await w(()=>import("./FilesTab-D5FGbmOx.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),U=s.lazy(async()=>({default:(await w(()=>import("./PreviewTab-CfHMHHQj.js"),__vite__mapDeps([5,1,2,6]))).PreviewTab})),H={getOutput:j,getOutputTree:_,getOutputContent:M},W={getOutput:j,createPreviewSession:(t,r)=>O(t,typeof r=="string"?r:r==null?void 0:r.path)};function Q(){const{shareId:t}=k(),[r,d]=s.useState(null),[o,a]=s.useState([]),[x,c]=s.useState(!0),[g,i]=s.useState(null),l=s.useRef(null);return s.useEffect(()=>{if(!t){d(null),a([]),i("Shared conversation not found"),c(!1);return}let u=!1;l.current=t,c(!0),i(null);const h=async n=>{try{const[m,f]=await Promise.all([E(t),L(t)]);if(u||l.current!==t)return;d(m),a(y=>n?f.logs:q(y,f.logs)),i(null)}catch(m){if(u||l.current!==t)return;n&&(d(null),a([]),i(m instanceof Error?m.message:"Failed to load shared conversation"))}finally{!u&&l.current===t&&n&&c(!1)}};h(!0);const p=window.setInterval(()=>{h(!1)},2500);return()=>{u=!0,window.clearInterval(p)}},[t]),e.jsx(Z,{conversation:r,logs:o,loading:x,error:g})}function Z({conversation:t,logs:r,loading:d,error:o}){const[a,x]=s.useState("transcript"),[c,g]=s.useState(!1),i=s.useMemo(()=>{if(!t)return null;const n=A(t.payload.initialMessage);return n.length>0?I(n,new Date(t.createdAt).toISOString()):null},[t]),l=s.useMemo(()=>z([...i?[i]:[],...r]),[i,r]),u=s.useMemo(()=>F(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-5 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5 pb-16",children:[d&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 bg-background/60 px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!d&&o&&e.jsxs("div",{className:"rounded-lg border border-destructive/20 bg-destructive/10 px-5 py-8 text-center text-destructive",children:[e.jsx("div",{className:"text-base font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-2 text-sm",children:o})]}),!d&&!o&&l.length===0&&e.jsxs("div",{className:"rounded-lg border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[e.jsx(B,{className:"mx-auto h-6 w-6 text-muted-foreground"}),e.jsx("div",{className:"mt-3 text-sm font-medium text-foreground",children:"No transcript output yet"})]}),!d&&!o&&u.map(({event:n,subItems:m},f)=>e.jsx(V,{event:n,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-3 px-3 py-3 sm:px-5 lg:px-6",children:[e.jsxs("aside",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle hidden w-64 shrink-0 flex-col overflow-hidden rounded-xl px-4 py-5 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm 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-7 text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("h1",{className:"max-h-28 overflow-hidden break-words text-base 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(S,{status:t.status}),e.jsx(T,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsxs("div",{children:["updated ",C(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-xl border border-border/70 bg-background/80 p-3 font-mono text-[11px] text-foreground shadow-sm",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-9 w-9 items-center justify-center rounded-sm border border-border/70 bg-background/70 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx($,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>g(n=>!n),"aria-expanded":c,className:"inline-flex h-9 items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-3 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(P,{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-xl",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/55 bg-card/28 px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-sm border border-border/70 bg-foreground text-xs 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-base 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:b(a==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>x("files"),className:b(a==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>x("preview"),className:b(a==="preview"),children:"Preview"})]})]}),h&&t?e.jsxs(e.Fragment,{children:[a==="transcript"&&p,a==="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:H})})}),a==="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(U,{taskId:t.shareId,api:W,allowPortPreview:!1})})})]}):p]})]})]})}function b(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 $({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{Q as SharedConversationPage,Z as SharedConversationView};
|