@kw-yeh/vibeflow 4.11.45 → 4.11.47

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/dist/vibeflow.mjs CHANGED
@@ -5576,11 +5576,14 @@ async function readTerminalFile(cwd, input, metadataOnly = false) {
5576
5576
  const stat = await handle.stat();
5577
5577
  if (!stat.isFile()) return { ok: false, error: "not_file", message: "\u9019\u500B\u8DEF\u5F91\u4E0D\u662F\u4E00\u822C\u6A94\u6848\u3002" };
5578
5578
  if (metadataOnly) return { ok: true, path: target, kind: "binary", reason: "" };
5579
- const mime = IMAGE_MIME2[path16.extname(target).toLowerCase()];
5580
- if (mime && stat.size > MAX_PREVIEW_IMAGE_BYTES) {
5581
- return { ok: true, path: target, kind: "binary", reason: "\u5716\u7247\u8D85\u904E 20 MB \u9810\u89BD\u4E0A\u9650\u3002" };
5582
- }
5583
- const limit = mime ? MAX_PREVIEW_IMAGE_BYTES : MAX_TEXT_BYTES2;
5579
+ const extension = path16.extname(target).toLowerCase();
5580
+ const imageMime = IMAGE_MIME2[extension];
5581
+ const videoMime = VIDEO_MIME[extension];
5582
+ const mime = imageMime ?? videoMime;
5583
+ const mediaLimit = videoMime ? MAX_VIDEO_BYTES : MAX_PREVIEW_IMAGE_BYTES;
5584
+ const tooLarge = videoMime ? "\u5F71\u7247\u8D85\u904E 20 MB \u9810\u89BD\u4E0A\u9650\u3002" : "\u5716\u7247\u8D85\u904E 20 MB \u9810\u89BD\u4E0A\u9650\u3002";
5585
+ if (mime && stat.size > mediaLimit) return { ok: true, path: target, kind: "binary", reason: tooLarge };
5586
+ const limit = mime ? mediaLimit : MAX_TEXT_BYTES2;
5584
5587
  const buffer = Buffer.alloc(Math.min(stat.size, limit + 1));
5585
5588
  let bytes = 0;
5586
5589
  while (bytes < buffer.length) {
@@ -5589,8 +5592,8 @@ async function readTerminalFile(cwd, input, metadataOnly = false) {
5589
5592
  bytes += bytesRead;
5590
5593
  }
5591
5594
  if (mime) {
5592
- if (bytes > limit) return { ok: true, path: target, kind: "binary", reason: "\u5716\u7247\u8D85\u904E 20 MB \u9810\u89BD\u4E0A\u9650\u3002" };
5593
- return { ok: true, path: target, kind: "image", dataUrl: `data:${mime};base64,${buffer.subarray(0, bytes).toString("base64")}` };
5595
+ if (bytes > limit) return { ok: true, path: target, kind: "binary", reason: tooLarge };
5596
+ return { ok: true, path: target, kind: videoMime ? "video" : "image", dataUrl: `data:${mime};base64,${buffer.subarray(0, bytes).toString("base64")}` };
5594
5597
  }
5595
5598
  const sample = buffer.subarray(0, Math.min(bytes, 8192));
5596
5599
  if (/\.(pdf|zip|gz|tar|exe|dll|woff2?|mp4|mov|webm|mp3|wav)$/i.test(target) || sample.some((b) => b === 0 || (b < 9 || b > 13 && b < 32))) {
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><link rel="manifest" href="/manifest.webmanifest" data-next-head=""/><meta name="theme-color" content="#0d1117" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/9df7da0ff08b98d3.css" as="style"/><link rel="stylesheet" href="/_next/static/css/9df7da0ff08b98d3.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c8c96fd26290e204.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-ba514e8a4a55baf5.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/dpJ9ud-40LGbxZabQInE1/_buildManifest.js" defer=""></script><script src="/_next/static/dpJ9ud-40LGbxZabQInE1/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"dpJ9ud-40LGbxZabQInE1","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><link rel="manifest" href="/manifest.webmanifest" data-next-head=""/><meta name="theme-color" content="#0d1117" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/9df7da0ff08b98d3.css" as="style"/><link rel="stylesheet" href="/_next/static/css/9df7da0ff08b98d3.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-1f79da4960e22d5d.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-ba514e8a4a55baf5.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/9f1up211o0OyTx-hoAAac/_buildManifest.js" defer=""></script><script src="/_next/static/9f1up211o0OyTx-hoAAac/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"9f1up211o0OyTx-hoAAac","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
package/dist/web/404.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><link rel="manifest" href="/manifest.webmanifest" data-next-head=""/><meta name="theme-color" content="#0d1117" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/9df7da0ff08b98d3.css" as="style"/><link rel="stylesheet" href="/_next/static/css/9df7da0ff08b98d3.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c8c96fd26290e204.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-ba514e8a4a55baf5.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/dpJ9ud-40LGbxZabQInE1/_buildManifest.js" defer=""></script><script src="/_next/static/dpJ9ud-40LGbxZabQInE1/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"dpJ9ud-40LGbxZabQInE1","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><link rel="manifest" href="/manifest.webmanifest" data-next-head=""/><meta name="theme-color" content="#0d1117" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/9df7da0ff08b98d3.css" as="style"/><link rel="stylesheet" href="/_next/static/css/9df7da0ff08b98d3.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-1f79da4960e22d5d.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-ba514e8a4a55baf5.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/9f1up211o0OyTx-hoAAac/_buildManifest.js" defer=""></script><script src="/_next/static/9f1up211o0OyTx-hoAAac/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"9f1up211o0OyTx-hoAAac","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -1 +1 @@
1
- self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:null,bitArray:[]},__routerFilterDynamic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:null,bitArray:[]},"/_error":["static/chunks/pages/_error-8f65b0f8749f42d2.js"],"/home":["static/chunks/5547-fcd96dc40c69c4dd.js","static/chunks/pages/home-0ab1b98f95f93c00.js"],sortedPages:["/_app","/_error","/home"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
1
+ self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:null,bitArray:[]},__routerFilterDynamic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:null,bitArray:[]},"/_error":["static/chunks/pages/_error-8f65b0f8749f42d2.js"],"/home":["static/chunks/5547-fcd96dc40c69c4dd.js","static/chunks/pages/home-76084d416f0c4fbc.js"],sortedPages:["/_app","/_error","/home"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1225],{91225:(e,t,s)=>{s.r(t),s.d(t,{TerminalFilePreview:()=>u});var r=s(26514),a=s(75834),l=s(60851),n=s(78141),o=s(6329),d=s(54996),c=s(86570),i=s(23072),m=s(26374),x=s(53150);function u({sessionKey:e,path:t,onClose:s}){let[p,h]=(0,a.useState)(null),[k,f]=(0,a.useState)(""),[j,b]=(0,a.useState)(!1),[g,w]=(0,a.useState)(!1),[N,y]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let s=!0;return(0,m.N9)(e,t).then(e=>{s&&h(e??{ok:!1,error:"unreadable",message:"未連線到 VibeFlow。"})}).catch(e=>{s&&h({ok:!1,error:"unreadable",message:e instanceof Error?e.message:"無法讀取檔案。"})}),()=>{s=!1}},[e,t]);let v=async()=>{b(!0),f("");try{let s=await (0,m.Br)(e,t);s?.ok||f(s?.message??"未連線到 VibeFlow。")}catch(e){f(e instanceof Error?e.message:"無法開啟檔案。")}finally{b(!1)}};return(0,l.createPortal)((0,r.jsx)(o.h,{className:"dark",title:"檔案預覽",description:(0,r.jsx)("span",{className:"block break-all font-mono text-xs",children:p?.ok?p.path:t}),onClose:s,showHeader:!0,contentClassName:"max-w-5xl",bodyClassName:"min-w-0 p-4",footer:p?.ok?(0,r.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[k&&(0,r.jsx)("p",{role:"alert",className:"break-all text-sm text-destructive",children:k}),(0,r.jsx)(d.$,{variant:"outline",onClick:()=>void v(),disabled:j,children:j?"開啟中…":"用系統程式開啟"})]}):void 0,children:(0,r.jsx)(x.a,{phase:p?p.ok?p.kind:"error":"loading",children:p?p.ok?"image"===p.kind?(0,r.jsx)("div",{onError:()=>w(!0),children:g?(0,r.jsx)("p",{role:"alert",children:"無法顯示這張圖片,請用系統程式開啟。"}):(0,r.jsx)(c.p,{src:p.dataUrl,alt:p.path})}):"video"===p.kind?N?(0,r.jsx)("p",{role:"alert",className:"py-10 text-center text-sm text-muted-foreground",children:"這個影片的編碼無法在 VibeFlow 內播放,請用系統程式開啟。"}):(0,r.jsx)("video",{src:p.dataUrl,controls:!0,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,onError:()=>y(!0),className:"max-h-[70vh] w-full rounded-md bg-black"}):"binary"===p.kind?(0,r.jsxs)("p",{className:"py-10 text-center text-sm text-muted-foreground",children:[p.reason," 請用系統程式開啟。"]}):(0,r.jsxs)(r.Fragment,{children:[/\.md(?:own|x)?$/i.test(p.path)?(0,r.jsx)(i.h,{source:p.text}):(0,r.jsx)("pre",{className:"whitespace-pre-wrap break-words rounded-md bg-muted/30 p-3 font-mono text-xs",children:p.text}),p.truncated&&(0,r.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"內容過長,僅顯示開頭 256 KB。"})]}):(0,r.jsx)("p",{role:"alert",className:"py-10 text-center text-sm text-muted-foreground",children:p.message}):(0,r.jsxs)("p",{role:"status",className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[(0,r.jsx)(n.A,{className:"size-4 animate-spin"}),"讀取中…"]})})}),document.body)}}}]);