meshy-node 0.3.1 → 0.3.3
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-vg1FNZ-b.js +124 -0
- package/dashboard/assets/DashboardShared-C9XLT05J.js +54 -0
- package/dashboard/assets/DiffTab-BBoqxtBo.js +4 -0
- package/dashboard/assets/{FilesTab-Csi7UE5G.js → FilesTab-8j_HSIrt.js} +14 -13
- package/dashboard/assets/{PreviewTab-DT95fOD3.js → PreviewTab-CcfSJBUg.js} +3 -3
- package/dashboard/assets/SharedConversationPage-CNmEk_vb.js +12 -0
- package/dashboard/assets/{file-BUN3RpOS.js → file-DgdB9H7_.js} +1 -1
- package/dashboard/assets/{folder-C28inzgP.js → folder-5L-FBUD2.js} +1 -1
- package/dashboard/assets/index-D2dDklXI.js +266 -0
- package/dashboard/assets/index-XG2bTevi.css +1 -0
- package/dashboard/index.html +2 -2
- package/main.cjs +2065 -811
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-ChA_y3oq.js +0 -120
- package/dashboard/assets/DashboardShared-B4AJ8Ukj.js +0 -59
- package/dashboard/assets/DiffTab-DgOYOCn1.js +0 -4
- package/dashboard/assets/SharedConversationPage-D5DMTSIy.js +0 -7
- package/dashboard/assets/index-COwXI8L0.js +0 -250
- package/dashboard/assets/index-tpSDJYRT.css +0 -1
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import{c as g,r as h,j as s,i as U,w as T,a as E,X as te,H as re,Q as ne,K as se,z,B as oe}from"./index-COwXI8L0.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 ie=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ae=g("brain",ie);/**
|
|
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 ce=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],le=g("circle-question-mark",ce);/**
|
|
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 de=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ue=g("circle",de);/**
|
|
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 me=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],X=g("copy",me);/**
|
|
22
|
-
* @license lucide-react v1.7.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const fe=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],pe=g("list-checks",fe);/**
|
|
27
|
-
* @license lucide-react v1.7.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const xe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ge=g("loader-circle",xe);/**
|
|
32
|
-
* @license lucide-react v1.7.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const he=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ye=g("shield-alert",he);/**
|
|
37
|
-
* @license lucide-react v1.7.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const be=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],je=g("shield-check",be);/**
|
|
42
|
-
* @license lucide-react v1.7.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const Ne=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],we=g("user",Ne);/**
|
|
47
|
-
* @license lucide-react v1.7.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const ke=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Y=g("wrench",ke);function P(e){return typeof e=="object"&&e!==null}function ve(e){if(!P(e))return null;if(e.type==="text"&&typeof e.text=="string"){const t=e.text.trim();return t?{type:"text",text:t}:null}if(e.type==="image"&&typeof e.mediaType=="string"&&typeof e.data=="string"){const t=e.mediaType.trim(),r=e.data;return!t||!r?null:{type:"image",mediaType:t,data:r,...typeof e.filename=="string"&&e.filename.trim()?{filename:e.filename.trim()}:{}}}if(e.type==="tool_result"&&typeof e.toolUseId=="string"&&typeof e.content=="string"){const t=e.toolUseId.trim(),r=e.content.trim();return!t||!r?null:{type:"tool_result",toolUseId:t,content:r,...typeof e.isError=="boolean"?{isError:e.isError}:{}}}return null}function Se(e){if(!P(e))return null;if(e.type==="text"&&typeof e.text=="string"){const n=e.text.trim();return n?{type:"text",text:n}:null}if(e.type!=="image"||!P(e.source)){if(e.type==="tool_result"&&typeof e.tool_use_id=="string"&&typeof e.content=="string"){const n=e.tool_use_id.trim(),o=e.content.trim();return!n||!o?null:{type:"tool_result",toolUseId:n,content:o,...typeof e.is_error=="boolean"?{isError:e.is_error}:{}}}return null}const t=typeof e.source.media_type=="string"?e.source.media_type.trim():"",r=typeof e.source.data=="string"?e.source.data:"";return!t||!r?null:{type:"image",mediaType:t,data:r}}function M(e){if(typeof e=="string"){const t=e.trim();return t?[{type:"text",text:t}]:[]}return Array.isArray(e)?e.map(t=>ve(t)??Se(t)).filter(t=>t!==null):[]}function ft(e,t){const r=e.trim();return[...r?[{type:"text",text:r}]:[],...t]}function _e(e){return{role:"user",content:e.map(t=>t.type==="text"?{type:"text",text:t.text}:t.type==="tool_result"?{type:"tool_result",tool_use_id:t.toolUseId,content:t.content,...typeof t.isError=="boolean"?{is_error:t.isError}:{}}:{type:"image",source:{type:"base64",media_type:t.mediaType,data:t.data}})}}function pt(e,t=new Date().toISOString()){return{type:"user",message:_e(e),timestamp:t}}function A(e){if(e.type!=="user"||e.isSynthetic===!0)return null;if(typeof e.message=="string"){const t=M(e.message);return t.length>0?t:null}if(P(e.message)&&Array.isArray(e.message.content)){const t=M(e.message.content);return t.length>0?t:null}if(Array.isArray(e.content)){const t=M(e.content);return t.length>0?t:null}return null}function xt(e){return M(e.payload.initialMessage)}function b(e){return e.map(t=>{if(t.type==="text")return`t:${t.text}`;if(t.type==="tool_result")return`r:${t.toolUseId}:${t.isError===!0?"1":"0"}:${t.content}`;const r=t.data.slice(0,32),n=t.data.slice(-32);return`i:${t.mediaType}:${t.data.length}:${r}:${n}`}).join("|")}function Ce(e){return e.map(t=>t.type==="text"?t.text:t.type==="tool_result"?t.content:"").filter(Boolean).join(`
|
|
52
|
-
`)}function Te(e){return`data:${e.mediaType};base64,${e.data}`}function gt(e){var o,i;if(!e)return[];const t=[],r=e.items;if(r)for(const c of Array.from(r)){if((c==null?void 0:c.kind)!=="file"||!((o=c.type)!=null&&o.startsWith("image/")))continue;const a=(i=c.getAsFile)==null?void 0:i.call(c);a&&a.type.startsWith("image/")&&t.push(a)}if(t.length>0)return t;const n=e.files;return n?Array.from(n).filter(c=>c.type.startsWith("image/")):[]}function Ae(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{if(typeof n.result!="string"){r(new Error(`Failed to read ${e.name}`));return}t(n.result)},n.onerror=()=>r(n.error??new Error(`Failed to read ${e.name}`)),n.readAsDataURL(e)})}async function ht(e){return Promise.all(Array.from(e).map(async t=>{if(!t.type.startsWith("image/"))throw new Error(`${t.name} is not an image`);const r=await Ae(t),n=r.indexOf(",");if(n===-1)throw new Error(`Failed to parse ${t.name}`);return{type:"image",mediaType:t.type||"image/png",data:r.slice(n+1),filename:t.name}}))}function $(e){return typeof e=="object"&&e!==null}function $e(e){return $(e)&&typeof e.name=="string"&&e.name.toLowerCase()==="askuserquestion"}function Me(e){return!$(e)||typeof e.label!="string"||!e.label.trim()?null:{label:e.label.trim(),description:typeof e.description=="string"?e.description.trim():""}}function Ue(e){if(!$(e)||typeof e.question!="string"||!e.question.trim())return null;const t=Array.isArray(e.options)?e.options.map(Me).filter(r=>r!==null):[];return t.length===0?null:{header:typeof e.header=="string"&&e.header.trim()?e.header.trim():void 0,question:e.question.trim(),multiSelect:e.multiSelect===!0,options:t}}function q(e){if(!$(e)||!Array.isArray(e.questions))return null;const t=e.questions.map(Ue).filter(r=>r!==null);return t.length===0?null:{questions:t}}function v(e){return JSON.stringify({questions:e.questions})}function O(e){const t=q(e);if(t)return t;if($e(e)){const r=$(e.input)?e.input:void 0,n=q(r);return n?{...n,...typeof e.id=="string"&&e.id.trim()?{toolUseId:e.id.trim()}:{}}:null}return null}function Ee(e){var o;const t=e.trim();if(!t)return[];const r=[t],n=t.matchAll(/```(?:json)?\s*([\s\S]*?)```/gi);for(const i of n){const c=(o=i[1])==null?void 0:o.trim();c&&r.push(c)}return r}function B(e){for(const t of Ee(e))try{const r=JSON.parse(t),n=q(r);if(n)return n}catch{}return null}function Pe(e){return e.questions.map(t=>t.options.length>0?[0]:[])}function Ie(e,t){return e.questions.every((r,n)=>(t[n]??[]).length>0)}function Oe(e,t){const n=e.questions.map((o,i)=>{const c=[...new Set(t[i]??[])].sort((a,u)=>a-u).filter(a=>o.options[a]!==void 0);return{header:o.header??null,question:o.question,multiSelect:o.multiSelect,selectedOptions:c.map(a=>o.options[a]).filter(a=>a!==void 0)}}).map(o=>{const i=o.header??o.question,c=o.selectedOptions.map(a=>a.label).join(o.multiSelect?", ":"");return`${i}: ${c}`}).join(`
|
|
53
|
-
`);return e.toolUseId?[{type:"tool_result",toolUseId:e.toolUseId,content:n,isError:!1}]:[{type:"text",text:n}]}function _(e){return typeof e=="object"&&e!==null}function Be(e){if(!e)return;const t=["file_path","path","command"].map(r=>e[r]).find(r=>typeof r=="string"&&r.trim().length>0);return t==null?void 0:t.trim()}function Fe(e){const t=e.toLowerCase();return t.includes(" permission to write ")?"Write":t.includes(" permission to edit ")?"Edit":t.includes(" permission to run ")||t.includes(" permission to execute ")?"Bash":"Action"}function R(e){const t=e.trim();if(!t.startsWith("Awaiting your permission to "))return null;const r=t.match(/`([^`]+)`/);return{requests:[{toolName:Fe(t),target:r==null?void 0:r[1],summary:t}]}}function ze(e){if(!Array.isArray(e.permission_denials))return null;const t=[];for(const r of e.permission_denials){if(!_(r)||typeof r.tool_name!="string")continue;const n=_(r.tool_input)?r.tool_input:void 0,o=Be(n),i=typeof e.result=="string"&&e.result.trim().length>0?e.result.trim():`Awaiting your permission to use ${r.tool_name}${o?` on \`${o}\``:""}.`;t.push({toolName:r.tool_name,...typeof r.tool_use_id=="string"?{toolUseId:r.tool_use_id}:{},...o?{target:o}:{},summary:i})}return t.length>0?{requests:t}:null}function G(e){if(!Array.isArray(e))return null;for(const t of e){if(!_(t)||t.type!=="text"||typeof t.text!="string")continue;const r=R(t.text);if(r)return r}return null}function J(e){if(!_(e))return null;const t=ze(e);if(t)return t;if(typeof e.result=="string"){const n=R(e.result);if(n)return n}if(typeof e.message=="string"){const n=R(e.message);if(n)return n}if(_(e.message)){const n=J(e.message);if(n)return n;const o=G(e.message.content);if(o)return o}const r=G(e.content);return r||null}function Le(e){return JSON.stringify(e.requests.map(t=>({toolName:t.toolName,target:t.target??null,summary:t.summary})))}function qe(e,t){return e.requests.map(r=>{const n=r.target?` for \`${r.target}\``:"",o=t==="approve"?`Approved. Proceed with the requested ${r.toolName} action${n}.`:`Denied. Do not proceed with the requested ${r.toolName} action${n}. Ask for another approach if needed.`;return r.toolUseId?{type:"tool_result",toolUseId:r.toolUseId,content:o,isError:t==="deny"}:t==="approve"?{type:"text",text:o}:{type:"text",text:o}})}function Re(e){return A(e)!==null}function I(e){if(e.type==="user"){const t=A(e),r=typeof e.timestamp=="string"?e.timestamp:"";if(t)return`user:${r}:${b(t)}`}return JSON.stringify(e)}function W(e){const t=O(e);return t?`question:${v(t)}`:null}function We(e){const t=J(e);return t?`permission:${Le(t)}`:null}function H(e){if(!Array.isArray(e))return null;const t=new Set;for(const r of e){const n=W(r);if(n){t.add(n);continue}if(typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"){const o=B(r.text);o&&t.add(v(o))}}return t.size===0?null:Array.from(t).sort().join("|")}function De(e){const t=W(e);if(t)return t;if(typeof e.message=="string"){const r=B(e.message);return r?v(r):null}if(typeof e.message=="object"&&e.message!==null){const r=W(e.message);return r||H(e.message.content)}return H(e.content)}function Je(e){return We(e)}function yt(e,t,r){const n=typeof t.timestamp=="string"?t.timestamp:"";return`${e}-${n}-${r}`}function bt(e,t){const r=t.map(o=>({...o})),n=new Set(r.map(I));for(const o of e){const i=I(o);n.has(i)||(r.push(o),n.add(i))}return r}function jt(e,t){const r=I(t);return e.some(n=>I(n)===r)?e:[...e,{...t}]}function Nt(e,t){const r=new Map;for(const n of t){const o=A(n);if(!o)continue;const i=b(o);r.set(i,(r.get(i)??0)+1)}return e.filter(n=>{const o=b(n.content),i=r.get(o)??0;return i<=0?!0:(r.set(o,i-1),!1)})}function wt(e,t){const r=b(t),n=e.findIndex(o=>b(o.content)===r);return n===-1?e:e.filter((o,i)=>i!==n)}function kt(e,t){const r=b(t);return e.some(n=>{const o=A(n);return o!==null&&b(o)===r})}function vt(e){const t=[];let r=null;for(const n of e){if(Re(n)){r=null,t.push(n);continue}const o=Je(n)??De(n);o&&o===r||(t.push(n),o&&(r=o))}return t}function C({payload:e,disabled:t=!1,bypassEnabled:r=!1,onBypassChange:n,onSubmit:o}){const[i,c]=h.useState(()=>r?Pe(e):e.questions.map(()=>[])),[a,u]=h.useState(!1),[l,m]=h.useState(!1);h.useEffect(()=>{r&&c(d=>d.map((f,y)=>{var p;return f.length>0?f:(p=e.questions[y])!=null&&p.options.length?[0]:[]}))},[r,e]);const x=Ie(e,i)&&!t&&!a&&!l&&!!o,j=(d,f)=>{t||l||a||c(y=>y.map((p,N)=>{if(N!==d)return p;const w=e.questions[N];return w?w.multiSelect?p.includes(f)?p.filter(F=>F!==f):[...p,f].sort((F,ee)=>F-ee):[f]:p}))},K=async()=>{if(!x||!o)return;u(!0);const d=await o(Oe(e,i));u(!1),d&&m(!0)};return s.jsxs("div",{className:"rounded-[24px] border border-primary/20 bg-primary/5 p-4 shadow-[0_24px_80px_-60px_hsl(var(--primary)/0.9)]",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:s.jsx(le,{className:"h-4 w-4"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-primary/80",children:"Ask User Question"}),s.jsx("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:"Select the answer you want to send back to the agent."})]})]}),s.jsxs(U,{type:"button",variant:r?"secondary":"outline",size:"sm",onClick:()=>n==null?void 0:n(!r),className:"rounded-full",children:[s.jsx(je,{className:"h-4 w-4"}),r?"Bypass on":"Bypass future questions"]})]}),s.jsx("div",{className:"mt-4 space-y-4",children:e.questions.map((d,f)=>{const y=i[f]??[];return s.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/75 p-4",children:[s.jsxs("div",{children:[d.header&&s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:d.header}),s.jsx("div",{className:"mt-1 text-sm font-medium leading-6 text-foreground",children:d.question}),s.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:d.multiSelect?"Select one or more options.":"Select one option."})]}),s.jsx("div",{className:"space-y-2",children:d.options.map((p,N)=>{const w=y.includes(N);return s.jsxs("button",{type:"button",onClick:()=>j(f,N),disabled:t||a||l,"aria-pressed":w,className:E("flex w-full items-start gap-3 rounded-[18px] border px-4 py-3 text-left transition-colors",w?"border-primary/50 bg-primary/10 text-foreground":"border-border/60 bg-background/80 text-foreground hover:border-primary/30 hover:bg-primary/5"),children:[s.jsx("span",{className:E("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",w?"border-primary bg-primary text-primary-foreground":"border-border/70 bg-background text-transparent"),children:s.jsx(T,{className:"h-3.5 w-3.5"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block text-sm font-medium leading-5",children:p.label}),p.description&&s.jsx("span",{className:"mt-1 block text-xs leading-5 text-muted-foreground",children:p.description})]})]},`${p.label}-${N}`)})})]},`${d.header??"question"}-${f}`)})}),s.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[s.jsx("div",{className:"text-xs text-muted-foreground",children:r?"Bypass is enabled. New question cards will default to the first option.":"Enable bypass if you want future question cards to preselect the first option."}),s.jsx(U,{type:"button",onClick:()=>void K(),disabled:!x,className:"rounded-full px-5",children:l?"Sent":a?"Sending...":e.questions.length>1?"Send answers":"Send answer"})]})]})}function Ve({payload:e,disabled:t=!1,onSubmit:r}){const[n,o]=h.useState(null),[i,c]=h.useState(!1),a=!t&&!i&&!!r,u=async l=>{if(!a||!r)return;o(l);const m=await r(qe(e,l));o(null),m&&c(!0)};return s.jsxs("div",{className:"rounded-[24px] border border-amber-500/25 bg-amber-500/5 p-4 shadow-[0_24px_80px_-60px_rgba(245,158,11,0.8)]",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-400",children:s.jsx(ye,{className:"h-4 w-4"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-amber-700/80 dark:text-amber-300/80",children:"Permission Request"}),s.jsx("div",{className:"mt-1 space-y-3",children:e.requests.map((l,m)=>s.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/75 px-4 py-3",children:[s.jsx("div",{className:"text-sm font-medium leading-6 text-foreground",children:l.summary}),(l.toolName||l.target)&&s.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:[s.jsx("span",{children:l.toolName}),l.target&&s.jsx("span",{className:"font-mono normal-case tracking-normal",children:l.target})]})]},`${l.toolUseId??l.toolName}-${m}`))})]})]}),s.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-end gap-2",children:[s.jsxs(U,{type:"button",variant:"outline",onClick:()=>void u("deny"),disabled:!a||n!==null,className:"rounded-full",children:[s.jsx(te,{className:"h-4 w-4"}),i?"Sent":n==="deny"?"Sending...":"Deny"]}),s.jsxs(U,{type:"button",onClick:()=>void u("approve"),disabled:!a||n!==null,className:"rounded-full",children:[s.jsx(T,{className:"h-4 w-4"}),i?"Sent":n==="approve"?"Sending...":"Approve"]})]})]})}function St({event:e,questionBypassEnabled:t=!1,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o=!1}){const i=e.type,c=J(e),a=O(e);if(c)return s.jsx(S,{children:s.jsx(Ve,{payload:c,onSubmit:n,disabled:o})});if(a)return s.jsx(S,{children:s.jsx(C,{payload:a,bypassEnabled:t,onBypassChange:r,onSubmit:n,disabled:o})});if(i==="user"){const u=Ke(e),l=u.filter(x=>x.type==="tool_result");if(l.length>0&&u.every(x=>x.type==="tool_result"))return s.jsx(S,{children:l.map((x,j)=>s.jsx(Q,{block:x,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o},j))});const m=A(e);return m?s.jsx(Ye,{content:m}):null}return i==="assistant"?s.jsx(Ze,{event:e,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o}):null}function Ke(e){const t=e.message,r=t==null?void 0:t.content;if(Array.isArray(r))return r.filter(o=>typeof o=="object"&&o!==null);const n=e.content;return Array.isArray(n)?n.filter(o=>typeof o=="object"&&o!==null):[]}function L(e){var r;const t=e.replace(/\r\n/g,`
|
|
54
|
-
`).split(`
|
|
55
|
-
`);for(;t.length>0&&((r=t[0])==null?void 0:r.trim())==="";)t.shift();return t.join(`
|
|
56
|
-
`)}function Z({text:e,className:t=""}){const[r,n]=h.useState(!1);if(!e)return null;const o=async i=>{i.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}};return s.jsx("button",{type:"button",onClick:o,"aria-label":r?"Copied":"Copy message",className:`flex h-6 w-6 items-center justify-center rounded-full border border-border/60 bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:r?s.jsx(T,{className:"h-3 w-3 text-emerald-500"}):s.jsx(X,{className:"h-3 w-3"})})}async function Ge(e){let r=await(await fetch(e)).blob();r.type!=="image/png"&&(r=await He(r)),await navigator.clipboard.write([new ClipboardItem({[r.type]:r})])}async function He(e){const t=await createImageBitmap(e),r=document.createElement("canvas");r.width=t.width,r.height=t.height;const n=r.getContext("2d");if(!n)throw new Error("canvas 2d context unavailable");return n.drawImage(t,0,0),await new Promise((o,i)=>{r.toBlob(c=>c?o(c):i(new Error("toBlob failed")),"image/png")})}function Xe({dataUrl:e,className:t=""}){const[r,n]=h.useState(!1),o=async i=>{i.stopPropagation();try{await Ge(e),n(!0),setTimeout(()=>n(!1),1500)}catch(c){console.error("copy image failed",c)}};return s.jsx("button",{type:"button",onClick:o,"aria-label":r?"Copied":"Copy image",className:`flex h-6 w-6 items-center justify-center rounded-full border border-border/60 bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:r?s.jsx(T,{className:"h-3 w-3 text-emerald-500"}):s.jsx(X,{className:"h-3 w-3"})})}function Ye({content:e}){const t=Ce(e),r=e.filter(n=>n.type==="image");return s.jsx("div",{className:"animate-message-rise flex justify-end",children:s.jsxs("div",{className:"group relative flex max-w-[88%] items-start gap-3",children:[s.jsx(Z,{text:t,className:"absolute -left-8 top-2"}),s.jsxs("div",{className:"space-y-1 rounded-[26px] rounded-tr-md border border-primary/25 bg-primary px-4 py-3 text-[13px] leading-5 text-primary-foreground shadow-[0_20px_70px_-42px_hsl(var(--primary)/0.95)]",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-primary-foreground/75",children:"You"}),t&&s.jsx("div",{className:"whitespace-pre-wrap",children:t}),r.length>0&&s.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:r.map((n,o)=>{const i=Te(n);return s.jsxs("div",{className:"relative",children:[s.jsx("img",{src:i,alt:n.filename??`attachment ${o+1}`,className:"max-h-72 w-full rounded-2xl border border-primary-foreground/15 object-cover"}),s.jsx(Xe,{dataUrl:i,className:"absolute right-2 top-2"})]},`${n.filename??"image"}-${o}`)})})]}),s.jsx("div",{className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:s.jsx(we,{className:"h-4 w-4"})})]})})}function S({children:e}){return s.jsx("div",{className:"animate-message-rise flex justify-start",children:s.jsxs("div",{className:"flex max-w-[92%] items-start gap-3",children:[s.jsx("div",{className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-border/70 bg-muted/70 text-muted-foreground",children:s.jsx(re,{className:"h-4 w-4"})}),s.jsxs("div",{className:"min-w-0 space-y-3",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-muted-foreground",children:"Agent"}),e]})]})})}function Ze({event:e,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o}){const i=e.message;if(!i)return null;const c=O(i);if(c)return s.jsx(S,{children:s.jsx(C,{payload:c,bypassEnabled:t,onBypassChange:r,onSubmit:n,disabled:o})});const a=i.content;if(!a||!Array.isArray(a))return null;const u=new Set,l=a.filter(d=>d.type==="text").map(d=>({...d,text:L(String(d.text??"")),questionPayload:B(L(String(d.text??"")))})).filter(d=>d.text.length>0||d.questionPayload),m=a.filter(d=>d.type==="thinking").map(d=>L(String(d.thinking??""))).filter(Boolean).join(`
|
|
57
|
-
|
|
58
|
-
`),x=a.filter(d=>d.type==="tool_use"),j=a.filter(d=>d.type==="tool_result");return l.length>0||m.length>0||x.length>0||j.length>0?s.jsxs(S,{children:[m.length>0&&s.jsx(rt,{text:m}),l.map((d,f)=>{if(d.questionPayload){const y=v(d.questionPayload);return u.has(y)?null:(u.add(y),s.jsx(C,{payload:d.questionPayload,bypassEnabled:t,onBypassChange:r,onSubmit:n,disabled:o},f))}return s.jsxs("div",{className:"group relative rounded-[26px] rounded-tl-md border border-border/70 bg-card/80 px-4 py-3 text-[13px] leading-5 text-foreground shadow-[0_20px_70px_-58px_rgba(0,0,0,0.9)] backdrop-blur-sm",children:[s.jsx(Z,{text:d.text,className:"absolute right-2 top-2"}),s.jsx("div",{className:"whitespace-pre-wrap",children:d.text})]},f)}),x.map((d,f)=>s.jsx(nt,{block:d,renderedQuestionSignatures:u,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o},f)),j.map((d,f)=>s.jsx(Q,{block:d,renderedQuestionSignatures:u,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o},f))]}):null}function Qe(e){return e.replace(/\s+/g," ").trim()}function k(e,t=132){const r=Qe(e);return r?r.length>t?`${r.slice(0,t-3)}...`:r:""}function D(e,t=84){if(typeof e=="string")return k(e,t);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const r=e.slice(0,3).map(n=>D(n,28)).filter(Boolean).join(", ");return k(r||JSON.stringify(e),t)}if(typeof e=="object"&&e!==null){const r=Object.entries(e).slice(0,3).map(([n,o])=>`${n}: ${D(o,32)}`).join(" · ");return k(r||JSON.stringify(e),t)}return""}function et(e){if(!e)return"No input";const t=Object.entries(e).slice(0,4).map(([r,n])=>`${r}: ${D(n,40)}`).filter(r=>r.trim().length>0).join(" · ");return k(t||JSON.stringify(e),156)||"No input"}function tt({expanded:e}){return s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-border/60 bg-background/70 px-2 py-1 text-[10px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[e?"Less":"More",e?s.jsx(ne,{className:"h-3 w-3"}):s.jsx(se,{className:"h-3 w-3"})]})}function V({title:e,preview:t,icon:r,children:n,accentClassName:o,previewClassName:i="font-mono text-[11px] text-muted-foreground/90"}){const[c,a]=h.useState(!1);return s.jsxs("div",{className:`overflow-hidden rounded-[22px] border border-border/60 ${o}`,children:[s.jsxs("button",{type:"button",onClick:()=>a(u=>!u),className:"flex w-full items-start gap-3 px-4 py-3 text-left transition-colors hover:bg-background/30",children:[s.jsx("div",{className:"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border/60 bg-background/70 text-muted-foreground",children:r}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-muted-foreground",children:e})}),s.jsx("div",{className:`mt-1 whitespace-pre-wrap break-words text-[12px] leading-5 ${i}`,children:t})]}),s.jsx(tt,{expanded:c})]}),c&&s.jsx("div",{className:"border-t border-border/60 px-4 py-3",children:n})]})}function rt({text:e}){const t=k(e,156);return s.jsx(V,{title:"Thinking",preview:t,icon:s.jsx(ae,{className:"h-3.5 w-3.5"}),accentClassName:"bg-muted/35",previewClassName:"text-[12px] leading-5 text-muted-foreground/90",children:s.jsx("div",{className:"whitespace-pre-wrap text-[13px] leading-5 text-muted-foreground/90",children:e})})}function nt({block:e,renderedQuestionSignatures:t,questionBypassEnabled:r,onQuestionBypassChange:n,onSubmitQuestionResponse:o,questionResponseDisabled:i}){const c=String(e.name??"tool"),a=e.input,u=O(e);if(u){const m=v(u);return t!=null&&t.has(m)?null:(t==null||t.add(m),s.jsx(C,{payload:u,bypassEnabled:r,onBypassChange:n,onSubmit:o,disabled:i}))}const l=et(a);if(c==="TodoWrite"){const m=st(a==null?void 0:a.todos);if(m.length>0)return s.jsx(ot,{todos:m})}return s.jsx(V,{title:`Tool: ${c}`,preview:l,icon:s.jsx(Y,{className:"h-3.5 w-3.5"}),accentClassName:"bg-muted/25",children:s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:JSON.stringify(a??{},null,2)})})}function Q({block:e,renderedQuestionSignatures:t,questionBypassEnabled:r,onQuestionBypassChange:n,onSubmitQuestionResponse:o,questionResponseDisabled:i}){const c=e.content,a=typeof c=="string"?c:Array.isArray(c)?c.map(m=>String(m.text??"")).join(`
|
|
59
|
-
`):"";if(!a)return null;const u=B(a);if(u){const m=v(u);return t!=null&&t.has(m)?null:(t==null||t.add(m),s.jsx(C,{payload:u,bypassEnabled:r,onBypassChange:n,onSubmit:o,disabled:i}))}const l=k(a,156);return s.jsx(V,{title:"Result",preview:l,icon:s.jsx(Y,{className:"h-3.5 w-3.5"}),accentClassName:"bg-background/65",children:s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:a})})}function st(e){return Array.isArray(e)?e.map(t=>{if(typeof t!="object"||t===null)return null;const r=t,n=typeof r.content=="string"?r.content:"";if(!n)return null;const o=typeof r.activeForm=="string"?r.activeForm:n,i=typeof r.status=="string"?r.status:"pending";return{content:n,activeForm:o,status:i==="completed"||i==="in_progress"?i:"pending"}}).filter(t=>t!==null):[]}function ot({todos:e}){const t=e.filter(o=>o.status==="completed").length,r=e.length,n=e.find(o=>o.status==="in_progress");return s.jsxs("div",{className:"overflow-hidden rounded-[22px] border border-border/60 bg-muted/20",children:[s.jsxs("div",{className:"flex items-center gap-3 border-b border-border/50 px-4 py-3",children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border/60 bg-background/70 text-muted-foreground",children:s.jsx(pe,{className:"h-3.5 w-3.5"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-muted-foreground",children:"Todos"}),s.jsx("div",{className:"mt-0.5 truncate text-[12px] leading-5 text-muted-foreground/90",children:n?n.activeForm:r===0?"No items":t===r?"All complete":"Up next"})]}),s.jsxs("div",{className:"shrink-0 rounded-full border border-border/60 bg-background/70 px-2 py-0.5 font-mono text-[10px] tracking-wide text-muted-foreground",children:[t,"/",r]})]}),s.jsx("ul",{className:"divide-y divide-border/40",children:e.map((o,i)=>s.jsxs("li",{className:"flex items-start gap-3 px-4 py-2.5",children:[s.jsx(it,{status:o.status}),s.jsx("span",{className:o.status==="completed"?"text-[13px] leading-5 text-muted-foreground line-through decoration-muted-foreground/60":o.status==="in_progress"?"text-[13px] font-medium leading-5 text-foreground":"text-[13px] leading-5 text-foreground/85",children:o.status==="in_progress"?o.activeForm:o.content})]},`${i}-${o.content}`))})]})}function it({status:e}){return e==="completed"?s.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-emerald-500/15 text-emerald-500 dark:text-emerald-400",children:s.jsx(T,{className:"h-3 w-3"})}):e==="in_progress"?s.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center text-primary",children:s.jsx(ge,{className:"h-3.5 w-3.5 animate-spin"})}):s.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/60",children:s.jsx(ue,{className:"h-3 w-3"})})}const _t="bypass",at=[{value:"claudecode",label:"claudecode",supportsFollowUp:!0},{value:"codex",label:"codex",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],Ct=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],Tt=new Set(at.filter(e=>e.supportsFollowUp).map(e=>e.value)),At=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],ct=new Set(["pending","assigned"]),lt=new Set(["running"]),dt=new Set(["completed","failed","cancelled"]);function $t(e,t){switch(t){case"running":return lt.has(e.status);case"waiting":return ct.has(e.status);case"closed":return dt.has(e.status);case"shared":return!!e.activeShare;case"archived":return e.status==="archived";case"active":default:return e.status!=="archived"}}function Mt(e,t){const r=t.trim().toLowerCase();return r?[e.title,e.description,e.id,e.agent,e.assignedTo??"",e.assignedNodeName??"",e.project??"",e.effectiveProjectPath??"",e.activeShare?"shared conversation":""].some(n=>n.toLowerCase().includes(r)):!0}function ut(e,t,r){if(!e)return"unassigned";const n=t==null?void 0:t.find(o=>o.id===e);return(n==null?void 0:n.name)??r??e.slice(0,8)}function Ut(e,t,r){return ut(e,t,r).toLowerCase()}function Et(e,t){return[...e].sort((r,n)=>r.id===t?-1:n.id===t?1:r.name.localeCompare(n.name))}function Pt(e){if(!e||typeof e!="object")return null;const t=e;return{draftNewTask:t.draftNewTask===!0,returnRoute:typeof t.returnRoute=="string"?t.returnRoute:void 0,returnTaskId:typeof t.returnTaskId=="string"||t.returnTaskId===null?t.returnTaskId:void 0}}function It(e){switch(e){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function Ot(e){return e==="default workspace"?e:e.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e}function Bt(e){const t=Date.now()-e;return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m`:t<864e5?`${Math.floor(t/36e5)}h`:`${Math.floor(t/864e5)}d`}function Ft(e){return new Date(e).toLocaleString()}function zt(e){const t=Math.floor(e/1e3),r=Math.floor(t/3600),n=Math.floor(t%3600/60),o=t%60;return`${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}`}async function Lt(e,t="Copied to clipboard"){var r,n,o;try{if((n=(r=globalThis.navigator)==null?void 0:r.clipboard)!=null&&n.writeText)return await globalThis.navigator.clipboard.writeText(e),z.success(t),!0;const i=globalThis.document,c=(o=i==null?void 0:i.execCommand)==null?void 0:o.bind(i);if(!(i!=null&&i.body)||typeof i.createElement!="function"||typeof c!="function")throw new Error("Clipboard access is unavailable");const a=i.createElement("textarea"),u=i.activeElement,l=u&&typeof u.focus=="function"?u:null;a.value=e,a.setAttribute("readonly","true"),a.style.position="fixed",a.style.opacity="0",a.style.pointerEvents="none",i.body.appendChild(a),a.select(),a.setSelectionRange(0,a.value.length);const m=c("copy");if(i.body.removeChild(a),l==null||l.focus(),!m)throw new Error("Clipboard access is unavailable");return z.success(t),!0}catch(i){return z.error(i instanceof Error?i.message:"Failed to copy"),!1}}function qt(e,t){const r=new Map;for(const o of e){const i=o.assignedTo??null,c=i??"__unassigned__",a=i?t.get(i)??o.assignedNodeName??i.slice(0,8):"Unassigned",u=o.effectiveProjectPath??o.project??"default workspace";r.has(c)||r.set(c,{nodeId:i,nodeName:a,dirMap:new Map});const l=r.get(c);l.dirMap.has(u)||l.dirMap.set(u,[]),l.dirMap.get(u).push(o)}const n=Array.from(r.values()).map(({nodeId:o,nodeName:i,dirMap:c})=>{const a=Array.from(c.entries()).map(([u,l])=>({path:u,tasks:l})).sort((u,l)=>l.tasks.length-u.tasks.length||u.path.localeCompare(l.path));return{nodeId:o,nodeName:i,dirs:a}});return n.sort((o,i)=>o.nodeId===null?1:i.nodeId===null?-1:o.nodeName.localeCompare(i.nodeName)),n}function Rt({label:e,value:t}){return s.jsxs("div",{className:"min-w-[7.25rem] flex-1 rounded-[20px] border border-border/60 bg-background/45 px-3 py-3",children:[s.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),s.jsx("div",{className:"mt-1 text-lg font-semibold tracking-tight text-foreground",children:t})]})}function Wt({label:e}){return s.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-muted-foreground",children:e})}function Dt({label:e,value:t,mono:r,action:n}){return s.jsxs("div",{className:"grid grid-cols-[5.25rem,minmax(0,1fr)] items-start gap-3",children:[s.jsx("span",{className:"pt-0.5 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:e}),s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx("span",{className:E("min-w-0 flex-1 break-all text-sm text-foreground",r&&"font-mono text-[11px] leading-5"),children:t}),n]})]})}function Jt({label:e,value:t,mono:r}){return s.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/60 px-3 py-3",children:[s.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),s.jsx("div",{className:E("mt-1 text-sm font-medium text-foreground",r&&"font-mono text-[11px]"),children:t})]})}function Vt({capabilities:e,action:t}){return s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[s.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Capabilities"}),s.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.length>0?e.map(r=>s.jsx(oe,{variant:"secondary",className:"rounded-full",children:r},r)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"None declared"})})]}),t&&s.jsx("div",{className:"shrink-0 self-start",children:t})]})}export{jt as A,A as B,X as C,_t as D,wt as E,Tt as F,vt as G,pt as H,Dt as I,xt as J,M as K,ge as L,Jt as M,kt as N,lt as R,at as T,ct as W,Ct as a,ft as b,Lt as c,ut as d,gt as e,Ft as f,St as g,yt as h,Wt as i,Rt as j,zt as k,Vt as l,qt as m,At as n,Ot as o,It as p,Bt as q,ht as r,Et as s,Te as t,Pt as u,$t as v,Ut as w,Mt as x,bt as y,Nt as z};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{r as c,aD as L,ay as M,j as e,B as g,a as w,K as P}from"./index-COwXI8L0.js";import{G as O}from"./DashboardPage-ChA_y3oq.js";import{F as R}from"./file-BUN3RpOS.js";import{C as _,F as B}from"./folder-C28inzgP.js";import"./DashboardShared-B4AJ8Ukj.js";function C(r,t){if(!(r!=null&&r.trim()))return[];const s=r.split(`
|
|
2
|
-
`),n=[];let a=[];const d=()=>{if(a.length===0)return;const l=a.join(`
|
|
3
|
-
`).trim();if(!l){a=[];return}const i=J(a);if(!i){a=[];return}n.push({id:`${t}:${i}`,path:i,section:t,patch:l}),a=[]};for(const l of s)l.startsWith("diff --git ")&&a.length>0&&d(),a.push(l);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((l,i)=>{d=d?`${d}/${l}`:l;const p=i===n.length-1;let m=a.find(b=>b.name===l);m||(m=p?{type:"file",name:l,path:d,item:s}:{type:"folder",name:l,path:d,children:[]},a.push(m)),p||(m.children??(m.children=[]),a=m.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.map(t=>({id:`untracked:${t}`,path:t,section:"untracked"}))}function J(r){var d,l;const t=(d=r.find(i=>i.startsWith("+++ ")))==null?void 0:d.slice(4).trim();if(t&&t!=="/dev/null")return k(t);const s=(l=r.find(i=>i.startsWith("--- ")))==null?void 0:l.slice(4).trim();if(s&&s!=="/dev/null")return k(s);const n=r.find(i=>i.startsWith("diff --git "));if(!n)return null;const a=n.match(/^diff --git a\/(.+?) b\/(.+)$/);return a?k(a[2]||a[1]||""):null}function k(r){return r.replace(/^[ab]\//,"")}const y={staged:"Staged",unstaged:"Unstaged",untracked:"Untracked"};function re({taskId:r}){const[t,s]=c.useState(null),[n,a]=c.useState(!0),[d,l]=c.useState(null),[i,p]=c.useState(null),[m,b]=c.useState(null),[T,v]=c.useState(!1),[U,N]=c.useState(null),S=c.useCallback(async()=>{a(!0),l(null),s(null);try{const o=await L(r);s(o)}catch(o){l(o instanceof Error?o.message:"Failed to load diff")}finally{a(!1)}},[r]);c.useEffect(()=>{S()},[S]);const F=c.useMemo(()=>C(t==null?void 0:t.staged,"staged"),[t==null?void 0:t.staged]),D=c.useMemo(()=>C(t==null?void 0:t.unstaged,"unstaged"),[t==null?void 0:t.unstaged]),E=c.useMemo(()=>A((t==null?void 0:t.untrackedFiles)??[]),[t==null?void 0:t.untrackedFiles]),j=c.useMemo(()=>[{section:"staged",items:F},{section:"unstaged",items:D},{section:"untracked",items:E}],[F,D,E]),h=c.useMemo(()=>j.flatMap(o=>o.items),[j]),u=c.useMemo(()=>h.find(o=>o.id===i)??h[0]??null,[h,i]);return c.useEffect(()=>{var o;(!i||!h.some(x=>x.id===i))&&p(((o=h[0])==null?void 0:o.id)??null)},[h,i]),c.useEffect(()=>{if(b(null),N(null),v(!1),!u||u.section!=="untracked")return;if(u.path.endsWith("/")){N("This untracked path is a directory. Open the Files tab to inspect its contents.");return}let o=!1;return v(!0),M(r,u.path).then(x=>{o||b(x)}).catch(x=>{o||N(x instanceof Error?x.message:"Failed to load file content")}).finally(()=>{o||v(!1)}),()=>{o=!0}},[u,r]),n?e.jsx(f,{tone:"muted",children:"Loading diff..."}):d?e.jsx(f,{tone:"destructive",children:d}):t!=null&&t.available?h.length>0?e.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[19rem_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-4 py-4",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Repository diff"}),e.jsx("div",{className:"mt-3 flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[e.jsx(O,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:t.branch??"detached HEAD"})]}),t.repoRoot&&e.jsx("div",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",children:t.repoRoot})]})}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:j.map(o=>e.jsxs(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[y[o.section]," ",o.items.length]},o.section))})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:e.jsx("div",{className:"space-y-3",children:j.map(({section:o,items:x})=>e.jsx(V,{section:o,items:x,selectedId:(u==null?void 0:u.id)??null,onSelect:p},o))})})]}),e.jsx("section",{className:"min-h-0 flex flex-col bg-card/10",children:u?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:y[u.section]}),u.section==="untracked"?e.jsx(g,{variant:"secondary",className:"rounded-full",children:"File content"}):e.jsx(g,{variant:"secondary",className:"rounded-full",children:"Diff patch"})]}),e.jsx("div",{className:"mt-3 break-all font-mono text-xs text-muted-foreground",children:u.path})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:u.section==="untracked"?e.jsx(K,{loading:T,error:U,content:m}):e.jsx(H,{patch:u.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=c.useMemo(()=>I(t),[t]),d=c.useMemo(()=>t.find(i=>i.id===s)??null,[t,s]),l=c.useMemo(()=>new Set(d?G(d.path):[]),[d]);return e.jsxs("section",{className:"rounded-[22px] border border-border/60 bg-background/35",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/60 px-3 py-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:y[r]}),e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:t.length})]}),e.jsx("div",{className:"p-2",children:a.length>0?e.jsx("div",{className:"space-y-1",children:a.map(i=>e.jsx(W,{node:i,depth:0,selectedId:s,expandedAncestorPaths:l,onSelect:n},`${r}:${i.path}`))}):e.jsx("div",{className:"rounded-[16px] border border-dashed border-border/70 bg-background/30 px-3 py-3 text-sm text-muted-foreground",children:"No files."})})]})}function W({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:w("flex w-full cursor-pointer items-center gap-2 rounded-[16px] px-2 py-2 text-left transition-colors",((d=r.item)==null?void 0:d.id)===s?"bg-primary/8 text-foreground":"text-foreground/90 hover:bg-background/55"),style:{paddingLeft:`${t*14+8}px`},children:[e.jsx(R,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate text-sm",children:r.name})]})}function z({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){const[d,l]=c.useState(!0);return c.useEffect(()=>{n.has(r.path)&&l(!0)},[n,r.path]),e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>l(i=>!i),"aria-expanded":d,className:"flex w-full cursor-pointer select-none items-center gap-2 rounded-[14px] px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-background/55 hover:text-foreground",style:{paddingLeft:`${t*14+8}px`},children:[d?e.jsx(P,{className:"h-4 w-4 shrink-0"}):e.jsx(_,{className:"h-4 w-4 shrink-0"}),e.jsx(B,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:r.name})]}),d&&e.jsx("div",{className:"space-y-1",children:(r.children??[]).map(i=>e.jsx(W,{node:i,depth:t+1,selectedId:s,expandedAncestorPaths:n,onSelect:a},i.path))})]})}function H({patch:r}){const t=r.split(`
|
|
4
|
-
`);return e.jsxs("div",{className:"rounded-[28px] border border-border/60 bg-background/55",children:[e.jsxs("div",{className:"border-b border-border/60 px-4 py-4",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"File diff"}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[t.length," lines"]})]}),e.jsx("div",{className:"font-mono text-xs leading-6",children:t.map((s,n)=>e.jsxs("div",{className:w("grid grid-cols-[56px_minmax(0,1fr)] gap-4 px-4 py-0.5",q(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 K({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-[20rem] items-center justify-center rounded-[28px] border border-border/60 bg-background/55 p-4",children:e.jsx("img",{src:n,alt:s.path,className:"max-h-full max-w-full rounded-[20px] 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-[24rem] overflow-hidden rounded-[28px] 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($,{content:n,truncated:s.truncated})}return s.kind==="markdown"||s.kind==="text"||s.kind==="html"?e.jsx($,{content:s.content,truncated:s.truncated}):e.jsx(f,{tone:"muted",children:"This file cannot be previewed inline."})}function $({content:r,truncated:t}){return e.jsxs("div",{className:"rounded-[28px] border border-border/60 bg-background/55",children:[e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-5 py-5 font-mono text-xs leading-6 text-foreground",children:r}),t&&e.jsx("div",{className:"border-t border-border/60 px-5 py-3 text-xs 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:w("flex h-full min-h-[16rem] items-center justify-center rounded-[24px] text-sm",t==="muted"?"text-muted-foreground":"text-destructive"),children:r})}function q(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,7 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-Csi7UE5G.js","assets/index-COwXI8L0.js","assets/index-tpSDJYRT.css","assets/folder-C28inzgP.js","assets/file-BUN3RpOS.js","assets/PreviewTab-DT95fOD3.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as b,aa as j,r as s,ar as v,as as w,j as e,M as N,N as y,at as k,au as S,av as f,aw as T,_ as g}from"./index-COwXI8L0.js";import{K as P,H as C,G as _,L as M,g as E,f as L,i as p}from"./DashboardShared-B4AJ8Ukj.js";/**
|
|
3
|
-
* @license lucide-react v1.7.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const O=[["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"}]],A=b("message-square-text",O),I=s.lazy(async()=>({default:(await g(()=>import("./FilesTab-Csi7UE5G.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),F=s.lazy(async()=>({default:(await g(()=>import("./PreviewTab-DT95fOD3.js"),__vite__mapDeps([5,1,2]))).PreviewTab})),R={getOutput:f,getOutputTree:S,getOutputContent:k},z={getOutput:f,createPreviewSession:T};function B(){const{shareId:t}=j(),[u,d]=s.useState(null),[o,r]=s.useState([]),[c,n]=s.useState(!0),[m,i]=s.useState(null),l=s.useRef(null);return s.useEffect(()=>{if(!t){d(null),r([]),i("Shared conversation not found"),n(!1);return}l.current=t,n(!0),i(null),Promise.all([v(t),w(t)]).then(([a,x])=>{l.current===t&&(d(a),r(x.logs),i(null))}).catch(a=>{l.current===t&&(d(null),r([]),i(a instanceof Error?a.message:"Failed to load shared conversation"))}).finally(()=>{l.current===t&&n(!1)})},[t]),e.jsx(D,{conversation:u,logs:o,loading:c,error:m})}function D({conversation:t,logs:u,loading:d,error:o}){const[r,c]=s.useState("transcript"),n=s.useMemo(()=>{if(!t)return null;const a=P(t.payload.initialMessage);return a.length>0?C(a,new Date(t.createdAt).toISOString()):null},[t]),m=s.useMemo(()=>_([...n?[n]:[],...u]),[n,u]),i=(t==null?void 0:t.scope)==="filesPreview",l=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 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(M,{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&&m.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(A,{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&&m.map((a,x)=>e.jsx(E,{event:a,questionResponseDisabled:!0},`shared-${x}`))]})});return e.jsxs("div",{className:"relative flex h-full min-h-0 overflow-hidden bg-background text-foreground",children:[e.jsxs("aside",{className:"hidden w-72 shrink-0 border-r border-border/60 bg-background/85 px-5 py-5 lg:block",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background",children:"M"}),e.jsx("div",{className:"mt-6 text-xs font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsx("h1",{className:"text-lg font-semibold leading-6 text-foreground",children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(N,{status:t.status}),e.jsx(y,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsxs("div",{children:["updated ",L(t.updatedAt)]}),e.jsx("div",{className:"font-mono",children:t.id.slice(0,8)})]})]})]}),e.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/60 bg-background/85 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 items-center justify-center rounded-md 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:"Shared conversation"}),e.jsx("div",{className:"truncate text-base font-semibold text-foreground",children:(t==null?void 0:t.title)??"Meshy"})]})]}),i&&e.jsxs("div",{className:"mt-3 inline-flex h-auto rounded-full bg-muted/70 p-1 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>c("transcript"),className:h(r==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>c("files"),className:h(r==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>c("preview"),className:h(r==="preview"),children:"Preview"})]})]}),i&&t?e.jsxs(e.Fragment,{children:[r==="transcript"&&l,r==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(p,{label:"Loading files..."}),children:e.jsx(I,{taskId:t.shareId,api:R})})}),r==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(p,{label:"Loading preview..."}),children:e.jsx(F,{taskId:t.shareId,api:z})})})]}):l]})]})}function h(t){return t?"inline-flex items-center justify-center whitespace-nowrap rounded-full bg-background px-3 py-1.5 text-sm font-medium text-foreground shadow-sm":"inline-flex items-center justify-center whitespace-nowrap rounded-full px-3 py-1.5 text-sm font-medium transition-colors hover:text-foreground"}export{B as SharedConversationPage,D as SharedConversationView};
|