@muxcodecli/cli 1.15.18 → 1.15.19

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.
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Mj as a,Nj as b}from"./chunk-hx718zrz.js";import"./chunk-zn283041.js";import"./chunk-11285jfy.js";import"./chunk-34d0nkas.js";import"./chunk-tvw8tfpr.js";import"./chunk-4k6px3aw.js";import"./chunk-638270xn.js";import"./chunk-sjd8mzvx.js";import"./chunk-sftkw30q.js";import"./chunk-kr1vbd82.js";import"./chunk-fk9bmtwr.js";import"./chunk-an9wvc2n.js";import"./chunk-v107htgw.js";import"./chunk-cbz8b7g5.js";import"./chunk-5jn2z3nf.js";import"./chunk-8cm9znxk.js";import"./chunk-a0srn4ak.js";import"./chunk-ygpen625.js";import"./chunk-jfz77m78.js";import"./chunk-my9cfmvt.js";import"./chunk-8jy0dvcn.js";import"./chunk-frbht418.js";import"./chunk-8ebkxjar.js";import"./chunk-zjpnyah2.js";import"./chunk-0hqmdrjr.js";import"./chunk-1pv2317e.js";import"./chunk-21x3anp4.js";import"./chunk-ntvr3177.js";import"./chunk-9h1pwxb2.js";import"./chunk-fkmzj0qt.js";import"./chunk-q9yddd1r.js";import"./chunk-eskw1cj2.js";import"./chunk-k19y2psf.js";import"./chunk-ppg6zhae.js";import"./chunk-ng3vbpmy.js";import"./chunk-1mqsg5s7.js";import"./chunk-z3mx7n44.js";import"./chunk-0qqpjj2h.js";import"./chunk-9g64kggy.js";import"./chunk-8j3aw4qg.js";export{b as AppRuntime,a as AppLayer};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{Ui as _}from"./chunk-6ny7q7hj.js";import{Mq as Y,Nq as J,Oq as N,Pq as q,gr as H,jr as v,mr as $,nr as z,pr as V}from"./chunk-a0srn4ak.js";import{cs as h,gs as d}from"./chunk-my9cfmvt.js";import{us as F,xs as S}from"./chunk-8jy0dvcn.js";import{AF as G}from"./chunk-1mqsg5s7.js";import{RF as Er,SF as tr,UF as er}from"./chunk-8j3aw4qg.js";var Br=Er(($r,D)=>{var E=process||{},Q=E.argv||[],T=E.env||{},Pr=!(!!T.NO_COLOR||Q.includes("--no-color"))&&(!!T.FORCE_COLOR||Q.includes("--color")||E.platform==="win32"||(E.stdout||{}).isTTY&&T.TERM!=="dumb"||!!T.CI),_r=(r,t,e=r)=>(n)=>{let i=""+n,a=i.indexOf(t,r.length);return~a?r+Or(i,t,e,a)+t:r+i+t},Or=(r,t,e,n)=>{let i="",a=0;do i+=r.substring(a,n)+e,a=n+t.length,n=r.indexOf(t,a);while(~n);return i+r.substring(a)},Z=(r=Pr)=>{let t=r?_r:()=>String;return{isColorSupported:r,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};D.exports=Z();D.exports.createColors=Z});var C={};tr(C,{println:()=>R,print:()=>K,markdown:()=>cr,logo:()=>ir,input:()=>sr,error:()=>ar,empty:()=>or,UI:()=>C,Style:()=>y,CancelledError:()=>L});import{EOL as O}from"os";var nr=[" ","# # # # # # #### #### ##### ###### ","## ## # # # # # # # # # # # ","# ## # # # ## # # # # # ##### ","# # # # ## # # # # # # ","# # # # # # # # # # # # # ","# # #### # # #### #### ##### ###### "];class L extends G.TaggedErrorClass()("UICancelledError",{}){}var y={TEXT_HIGHLIGHT:"\x1B[96m",TEXT_HIGHLIGHT_BOLD:"\x1B[96m\x1B[1m",TEXT_DIM:"\x1B[90m",TEXT_DIM_BOLD:"\x1B[90m\x1B[1m",TEXT_NORMAL:"\x1B[0m",TEXT_NORMAL_BOLD:"\x1B[1m",TEXT_WARNING:"\x1B[93m",TEXT_WARNING_BOLD:"\x1B[93m\x1B[1m",TEXT_DANGER:"\x1B[91m",TEXT_DANGER_BOLD:"\x1B[91m\x1B[1m",TEXT_SUCCESS:"\x1B[92m",TEXT_SUCCESS_BOLD:"\x1B[92m\x1B[1m",TEXT_INFO:"\x1B[94m",TEXT_INFO_BOLD:"\x1B[94m\x1B[1m"};function R(...r){K(...r),process.stderr.write(O)}function K(...r){B=!1,process.stderr.write(r.join(" "))}var B=!1;function or(){if(B)return;R(""+y.TEXT_NORMAL),B=!0}function ir(r){if(!process.stdout.isTTY&&!process.stderr.isTTY){let c=[];for(let s of nr){if(r)c.push(r);c.push(s),c.push(O)}return c.join("").trimEnd()}let t=[],e="\x1B[0m",n={fg:"\x1B[90m",shadow:"\x1B[38;5;235m",bg:"\x1B[48;5;235m"},i={fg:e,shadow:"\x1B[38;5;238m",bg:"\x1B[48;5;238m"},a=" ",x=(c,s,m,u)=>{let o=[];for(let f of c){if(f==="_"){o.push(u," ",e);continue}if(f==="^"){o.push(s,u,"\u2580",e);continue}if(f==="~"){o.push(m,"\u2580",e);continue}if(f===" "){o.push(" ");continue}o.push(s,f,e)}return o.join("")};return _.left.forEach((c,s)=>{if(r)t.push(r);t.push(x(c,n.fg,n.shadow,n.bg)),t.push(a);let m=_.right[s]??"";t.push(x(m,i.fg,i.shadow,i.bg)),t.push(O)}),t.join("").trimEnd()}async function sr(r){let e=er("readline").createInterface({input:process.stdin,output:process.stdout});return new Promise((n)=>{e.question(r,(i)=>{e.close(),n(i.trim())})})}function ar(r){if(r.startsWith("Error: "))r=r.slice(7);R(y.TEXT_DANGER_BOLD+"Error: "+y.TEXT_NORMAL+r)}function cr(r){return r}import{dlopen as mr,ptr as I}from"bun:ffi";var X=-10,w=1,ur=()=>mr("kernel32.dll",{GetStdHandle:{args:["i32"],returns:"ptr"},GetConsoleMode:{args:["ptr","ptr"],returns:"i32"},SetConsoleMode:{args:["ptr","u32"],returns:"i32"},FlushConsoleInputBuffer:{args:["ptr"],returns:"i32"}}),g;function j(){if(process.platform!=="win32")return!1;try{return g??=ur(),!0}catch{return!1}}function jr(){if(process.platform!=="win32")return;if(!process.stdin.isTTY)return;if(!j())return;let r=g.symbols.GetStdHandle(X),t=new Uint32Array(1);if(g.symbols.GetConsoleMode(r,I(t))===0)return;let e=t[0];if((e&w)===0)return;g.symbols.SetConsoleMode(r,e&~w)}function vr(){if(process.platform!=="win32")return;if(!process.stdin.isTTY)return;if(!j())return;let r=g.symbols.GetStdHandle(X);g.symbols.FlushConsoleInputBuffer(r)}var p;function Mr(){if(process.platform!=="win32")return;if(!process.stdin.isTTY)return;if(!j())return;if(p)return p;let r=process.stdin,t=r.setRawMode,e=g.symbols.GetStdHandle(X),n=new Uint32Array(1);if(g.symbols.GetConsoleMode(e,I(n))===0)return;let i=n[0],a=()=>{if(g.symbols.GetConsoleMode(e,I(n))===0)return;let u=n[0];if((u&w)===0)return;g.symbols.SetConsoleMode(e,u&~w)},x=()=>{a(),setImmediate(a)},c;if(typeof t==="function")c=(u)=>{let o=t.call(r,u);return x(),o},r.setRawMode=c;x();let s=setInterval(a,100);s.unref();let m=!1;return p=()=>{if(m)return;if(m=!0,clearInterval(s),c&&r.setRawMode===c)r.setRawMode=t;g.symbols.SetConsoleMode(e,i),p=void 0},p}import M from"path";var fr={resolve:(r)=>$(r)},gr={readText:(r)=>d.readText(r),write:async(r,t)=>{await d.write(r,t)},exists:(r)=>d.exists(r),files:(r,t)=>H(r,t)};function lr(r){if(typeof r==="string")return r;if(!Array.isArray(r))return;if(typeof r[0]!=="string")return;return r[0]}function xr(r){if(!r||typeof r!=="object"||Array.isArray(r))return;let t=r;if(!Array.isArray(t.plugin))return;return t.plugin}function pr(r){if(typeof r==="string"){let t=r.trim();if(t)return t;return}if(!h(r))return;for(let t of["import","default"]){let e=r[t];if(typeof e!=="string")continue;let n=e.trim();if(!n)continue;return n}}function br(r){if(!h(r))return;let t=r.config;if(!h(t))return;return t}function W(r,t){let e=r.exports;if(!h(e))return;let n=e[`./${t}`];if(!pr(n))return;return{opts:br(n)}}function dr(r){let t=r.main;if(typeof t!=="string")return!1;return Boolean(t.trim())}function hr(r){let t=typeof r.json.name==="string"&&r.json.name.trim().length>0?r.json.name.trim():M.basename(r.dir),e=[],n=W(r.json,"server");if(n)e.push({kind:"server",opts:n.opts});else if(dr(r.json))e.push({kind:"server"});let i=W(r.json,"tui");if(i)e.push({kind:"tui",opts:i.opts});if(!e.some((a)=>a.kind==="tui")&&V(t,r).length)e.push({kind:"tui"});return e}function b(r,t,e,n=!1){return q(r,N(r,t,e,{formattingOptions:{tabSize:2,insertSpaces:!0},isArrayInsertion:n}))}function kr(r,t,e,n,i=!1){let a=v(e).pkg,c=(t??[]).map((o,f)=>({item:o,i:f,spec:lr(o)})).filter((o)=>{if(!o.spec)return!1;if(o.spec===e)return!0;if(o.spec.startsWith("file://"))return!1;return v(o.spec).pkg===a});if(!c.length){if(!t)return{mode:"add",text:b(r,["plugin"],[n])};return{mode:"add",text:b(r,["plugin",t.length],n,!0)}}if(!i)return{mode:"noop",text:r};let s=c[0];if(!s)return{mode:"noop",text:r};if(c.length===1&&s.spec===e)return{mode:"noop",text:r};let m=r;if(typeof s.item==="string")m=b(m,["plugin",s.i],n);if(Array.isArray(s.item)&&typeof s.item[0]==="string")m=b(m,["plugin",s.i,0],e);let u=c.map((o)=>o.i).filter((o)=>o!==s.i).sort((o,f)=>f-o);for(let o of u)m=b(m,["plugin",o],void 0);return{mode:"replace",text:m}}async function Jr(r,t=fr){let e=await t.resolve(r).then((n)=>({ok:!0,item:n}),(n)=>({ok:!1,error:n}));if(!e.ok)return{ok:!1,code:"install_failed",error:e.error};return{ok:!0,target:e.item}}async function Nr(r){let t=await z(r).then((n)=>({ok:!0,item:n}),(n)=>({ok:!1,error:n}));if(!t.ok)return{ok:!1,code:"manifest_read_failed",file:r,error:t.error};let e=await Promise.resolve().then(()=>hr(t.item)).then((n)=>({ok:!0,item:n}),(n)=>({ok:!1,error:n}));if(!e.ok)return{ok:!1,code:"manifest_read_failed",file:t.item.pkg,error:e.error};if(!e.item.length)return{ok:!1,code:"manifest_no_targets",file:t.item.pkg};return{ok:!0,targets:e.item}}function yr(r){if(r.global)return r.config??S.Path.config;let e=r.vcs==="git"&&r.worktree!=="/"?r.worktree:r.directory;return M.join(e,".muxcode")}function wr(r){if(r==="server")return"muxcode";return"tui"}async function Tr(r,t,e,n,i){let a=wr(t.kind);await using x=await F.acquire(`plug-config:${d.resolve(M.join(r,a))}`);let c=i.files(r,a),s=c[0];for(let l of c){if(!await i.exists(l))continue;s=l;break}let m=await i.readText(s).catch((l)=>{if(l.code==="ENOENT")return"{}";return l});if(m instanceof Error)return{ok:!1,code:"patch_failed",kind:t.kind,error:m};let u=m.trim()?m:"{}",o=[],f=Y(u,o,{allowTrailingComma:!0});if(o.length){let l=o[0],P=u.substring(0,l.offset).split(`
3
+ `);return{ok:!1,code:"invalid_json",kind:t.kind,file:s,line:P.length,col:P[P.length-1].length+1,parse:J(l.error)}}let U=xr(f),rr=t.opts?[e,t.opts]:e,k=kr(u,U,e,rr,n);if(k.mode==="noop")return{ok:!0,item:{kind:t.kind,mode:k.mode,file:s}};let A=await i.write(s,k.text).catch((l)=>l);if(A instanceof Error)return{ok:!1,code:"patch_failed",kind:t.kind,error:A};return{ok:!0,item:{kind:t.kind,mode:k.mode,file:s}}}async function qr(r,t=gr){let e=yr(r),n=[];for(let i of r.targets){let a=await Tr(e,i,r.spec,Boolean(r.force),t);if(!a.ok)return{...a,dir:e};n.push(a.item)}return{ok:!0,dir:e,items:n}}
4
+ export{C as Ki,Br as Li,jr as Mi,vr as Ni,Mr as Oi,Jr as Pi,Nr as Qi,qr as Ri};
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ import{uj as k}from"./chunk-xedav0qx.js";import{vj as m,xj as G}from"./chunk-9n629gtn.js";import{Ck as g}from"./chunk-34d0nkas.js";import{yn as R}from"./chunk-8cm9znxk.js";import O from"os";import d from"path";function f(t){if(!t||typeof t!=="object"||Array.isArray(t))return{};return{...t}}function w(t){return{input:Object.assign(Object.create(null),t.input),metadata:Object.assign(Object.create(null),t.meta),frame:t}}function D(t){return{input:Object.assign(Object.create(null),t.input),metadata:Object.assign(Object.create(null),t.meta),patterns:t.patterns}}function l(t){return typeof t==="string"?t:""}function P(t){if(typeof t!=="number"||!Number.isFinite(t))return;return t}function p(t){if(!Array.isArray(t))return[];return t}function S(t,o=[]){let e=Object.entries(t).filter(([n,r])=>{if(o.includes(n))return!1;return typeof r==="string"||typeof r==="number"||typeof r==="boolean"});if(e.length===0)return"";return`[${e.map(([n,r])=>`${n}=${String(r)}`).join(", ")}]`}function T(t){let o=f(t.time),e=P(o.start),n=P(o.end);if(e===void 0||n===void 0||n<=e)return"";return G(n-e)}function $(t){let o=j(t);if(o)return`\u2716 ${t.name} failed: ${o}`;return`\u2716 ${t.name} failed`}function j(t){if(t.error)return t.error;let o=l(t.state.error).trim();if(o)return o;return t.raw.trim()}function W(t){let o=S(t.input);if(!o)return`\u2699 ${t.name}`;return`\u2699 ${t.name} ${o}`}function F(t){if(t.status==="error")return $(t);if(t.status&&t.status!=="completed")return t.raw.trim();let o=T(t.state);if(!o)return`${t.name} completed`;return`${t.name} completed \xB7 ${o}`}function s(t,o={}){if(!t)return"";let e=process.cwd(),n=O.homedir(),r=d.isAbsolute(t)?t:d.resolve(e,t),i=d.relative(e,r);if(!i)return".";if(!i.startsWith(".."))return i.replaceAll("\\","/");if(o.home&&n&&(r===n||r.startsWith(n+d.sep)))return r.replace(n,"~").replaceAll("\\","/");return r.replaceAll("\\","/")}function L(t){let o=l(t.state.title)||(Object.keys(t.input).length>0?JSON.stringify(t.input):"Unknown");return{icon:"\u2699",title:`${t.name} ${o}`}}function B(t,o){return`${t} ${o}${t===1?"":"es"}`}function Q(t){let o=t.input.path??"",e=`Glob "${t.input.pattern??""}"`,n=o?`in ${s(o)}`:"",r=t.metadata.count,i=r===void 0?n:`${n}${n?" \xB7 ":""}${B(r,"match")}`;return{icon:"\u2731",title:e,...i&&{description:i}}}function C(t){let o=t.input.path??"",e=`Grep "${t.input.pattern??""}"`,n=o?`in ${s(o)}`:"",r=t.metadata.matches,i=r===void 0?n:`${n}${n?" \xB7 ":""}${B(r,"match")}`;return{icon:"\u2731",title:e,...i&&{description:i}}}function N(t){let o=l(f(t.input).path);return{icon:"\u2192",title:o?`List ${s(o)}`:"List"}}function M(t){let o=s(t.input.filePath),e=S(t.frame.input,["filePath"])||void 0;return{icon:"\u2192",title:`Read ${o}`,...e&&{description:e}}}function U(t){return{icon:"\u2190",title:`Write ${s(t.input.filePath)}`,mode:"block",body:t.frame.status==="completed"?l(t.frame.state.output):void 0}}function V(t){let o=t.input.url??"";return{icon:"%",title:o?`WebFetch ${o}`:"WebFetch"}}function K(t){return{icon:"\u2190",title:`Edit ${s(t.input.filePath)}`,mode:"block",body:t.metadata.diff}}function J(t){let o=g(t.metadata.provider);return{icon:"\u25C8",title:t.input.query?`${o} "${t.input.query}"`:o}}function X(t){let o=m(t.input.subagent_type||"unknown"),e=t.input.description;return{icon:t.frame.status==="error"?"\u2717":t.frame.status==="running"?"\u2022":"\u2713",title:e||`${o} Task`,description:e?`${o} Agent`:void 0}}function z(t){return{icon:"#",title:"Todos",mode:"block",body:p(t.frame.input.todos).flatMap((o)=>{let e=typeof o?.content==="string"?o.content:"";if(!e)return[];return[`${o.status==="completed"?"[\u2713]":o.status==="in_progress"?"[\u2022]":"[ ]"} ${e}`]}).join(`
3
+ `)}}function H(t){return{icon:"\u2192",title:`Skill "${t.input.name??""}"`}}function Y(t){let o=t.metadata.files?.length??0;if(o===0)return{icon:"%",title:"Patch"};return{icon:"%",title:`Patch ${o} file${o===1?"":"s"}`}}function Z(t){let o=p(t.frame.input.questions).length;return{icon:"\u2192",title:`Asked ${o} question${o===1?"":"s"}`}}function tt(t){return{icon:"\u2717",title:l(t.frame.state.title)||"Invalid Tool",mode:"block",body:t.frame.status==="completed"?l(t.frame.state.output):void 0}}function ot(t){let o=p(f(t.input).tool_calls).length;return{icon:"#",title:l(t.frame.state.title)||(o>0?`Batch ${o} tool${o===1?"":"s"}`:"Batch"),mode:"block",body:t.frame.status==="completed"?l(t.frame.state.output):void 0}}function I(t,o={}){let e=t.operation||"request",n=t.filePath?s(t.filePath,o):"",r=typeof t.line==="number"?t.line:void 0,i=typeof t.character==="number"?t.character:void 0,a=r!==void 0&&i!==void 0?`:${r}:${i}`:"";if(!n)return`LSP ${e}`;return`LSP ${e} ${n}${a}`}function et(t){return{icon:"\u2192",title:l(t.frame.state.title)||I(t.input)}}function nt(t){return{icon:"\u2192",title:l(t.frame.state.title)||"Switching to build agent",mode:"block",body:t.frame.status==="completed"?l(t.frame.state.output):void 0}}function rt(t){let{relativePath:o,filePath:e}=t;if(t.type==="add")return`# Created ${o||s(e)}`;if(t.type==="delete")return`# Deleted ${o||s(e)}`;if(t.type==="move")return`# Moved ${s(e)} -> ${o||s(t.movePath)}`;return`# Patched ${o||s(e)}`}function it(t){let o=t.input.filePath||"",e=t.input.content||"";if(!o&&!e)return;return{kind:"code",title:`# Wrote ${s(o)}`,content:e,file:o}}function st(t){let o=t.input.filePath||"",e=t.metadata.diff||"";if(!o||!e.trim())return;return{kind:"diff",items:[{title:`# Edited ${s(o)}`,diff:e,file:o}]}}function lt(t){let o=p(t.frame.meta.files);if(o.length===0)return;let e=o.flatMap((n)=>{if(!n||typeof n!=="object")return[];let r=typeof n.patch==="string"?n.patch:"";if(!r.trim())return[];let i=n.movePath||n.filePath||n.relativePath;return[{title:rt(n),diff:r,file:i,deletions:typeof n.deletions==="number"?n.deletions:0}]});if(e.length===0)return;return{kind:"diff",items:e}}function at(t){let o=m(t.input.subagent_type||"general"),e=t.input.description,n=l(t.frame.state.title),r=[e||n].filter((i)=>Boolean(i));return{kind:"task",title:`# ${o} Task`,rows:r,tail:""}}function ut(t){return{kind:"todo",items:p(t.frame.input.todos).flatMap((e)=>{let n=typeof e?.content==="string"?e.content:"";if(!n)return[];return[{status:typeof e.status==="string"?e.status:"",content:n}]}),tail:""}}function ft(t){let o=p(t.frame.meta.answers);return{kind:"question",items:p(t.frame.input.questions).map((n,r)=>{let i=p(o[r]).filter((a)=>typeof a==="string");return{question:n.question||`Question ${r+1}`,answer:i.length>0?i.join(", "):"(no answer)"}}),tail:""}}function pt(t){let o=t.input.command??"",e=t.input.description||"Shell",n=t.input.workdir??"",r=n&&n!=="."?s(n):"";if(o&&e==="Shell"&&!r)return`$ ${o}`;let i=r&&!e.includes(r)?`${e} in ${r}`:e;if(!o)return`# ${i}`;return`# ${i}
4
+ $ ${o}`}function ct(t){let o=k(t.frame.raw),e=(t.input.command??"").trim(),n=(x)=>{let v=x.replace(/^\n+/,"").replace(/\n+$/,"");return v?`
5
+ ${v}`:""};if(!e)return o.replace(/\n+$/,"");let r=(t.input.workdir??"").trim(),i=r?s(r):"",a=o.split(`
6
+ `),u=(a[0]||"").trim(),y=(a[1]||"").trim();if(i&&(u===i||u===r)&&y===e)return n(a.slice(2).join(`
7
+ `));if(u===e||u===`$ ${e}`)return n(a.slice(1).join(`
8
+ `));if(i&&(u===`${i} ${e}`||u===`${r} ${e}`))return n(a.slice(1).join(`
9
+ `));return n(o)}function dt(t){let o=t.metadata.exit??P(t.frame.meta.exitCode)??P(t.frame.meta.exit_code),e=T(t.frame.state);if(o===void 0){if(!e)return"bash completed";return`bash completed \xB7 ${e}`}return`bash completed (exit ${o})${e?` \xB7 ${e}`:""}`}function mt(t){let o=s(t.input.filePath),e=S(t.frame.input,["filePath"]),n=e?` ${e}`:"";return`\u2192 Read ${o}${n}`.trim()}function Tt(t){return""}function ht(t){return""}function yt(t){return""}function E(t){let{type:o,relativePath:e,filePath:n}=t;if(o==="add")return`+ Created ${e||s(n)}`;if(o==="delete")return`- Deleted ${e||s(n)}`;if(o==="move")return`\u2192 Moved ${s(n)} \u2192 ${e||s(t.movePath)}`;return`~ Patched ${e||s(n)}`}function Pt(t){if(t.frame.status==="error")return $(t.frame);let o=p(t.frame.meta.files);if(o.length===0){let i=T(t.frame.state);if(!i)return"patch";return`patch \xB7 ${i}`}let e=!o.some((i)=>i?.type&&i.type!=="update"),n=o.filter((i)=>e||i.type!=="update"),r=n.slice(0,6).map(E);if(n.length>6)r.push(`... and ${n.length-6} more`);if(r.length>0)return r.join(`
10
+ `);return E(o[0])}function gt(t){return""}function $t(t){if(!t.trim())return;let o=t.match(/<task_result>\s*([\s\S]*?)\s*<\/task_result>/);if(o)return o[1].trim()||void 0;return t.split(`
11
+ `).filter((n)=>!n.startsWith("task_id:")).join(`
12
+ `).trim()||void 0}function bt(t){if(t.frame.status==="error")return $(t.frame);let o=m(t.input.subagent_type||"general"),e=t.input.description||l(t.frame.state.title);if(!e)return`# ${o} Task`;return`# ${o} Task
13
+ ${e}`}function kt(t){return""}function wt(t){let o=p(t.input.todos),e=T(t.frame.state);if(o.length===0){if(!e)return"0 todos";return`0 todos \xB7 ${e}`}let n=o.filter((u)=>u.status==="completed").length,r=o.filter((u)=>u.status==="in_progress").length,i=o.length-n-r,a=[`${o.length} total`];if(n>0)a.push(`${n} done`);if(r>0)a.push(`${r} active`);if(i>0)a.push(`${i} pending`);if(e)a.push(e);return a.join(" \xB7 ")}function St(t){return""}function It(t){let o=t.input.questions??[],e=t.metadata.answers??[],n=T(t.frame.state);if(o.length===0){if(!n)return"0 questions";return`0 questions \xB7 ${n}`}let r=[];for(let[i,a]of o.slice(0,4).entries()){let u=a.question,y=e[i]??[];r.push(`? ${u||`Question ${i+1}`}`),r.push(` ${y.length>0?y.join(", "):"(no answer)"}`)}if(o.length>4)r.push(`... and ${o.length-4} more`);return r.join(`
14
+ `)}function vt(t){return`\u2192 ${I(t.input)}`}function Wt(t){return`\u2192 Skill "${t.input.name??""}"`}function Ft(t){let o=t.input.pattern??"",e=o?`\u2731 Glob "${o}"`:"\u2731 Glob",n=t.input.path??"";if(!n)return e;return`${e} in ${s(n)}`}function Lt(t){return j(t.frame)||$(t.frame)}function Et(t){let o=t.input.pattern??"",e=o?`\u2731 Grep "${o}"`:"\u2731 Grep",n=t.input.path??"";if(!n)return e;return`${e} in ${s(n)}`}function Rt(t){let o=l(f(t.input).path);if(!o)return"\u2192 List";return`\u2192 List ${s(o)}`}function Gt(t){let o=t.input.url??"";if(!o)return"% WebFetch";return`% WebFetch ${o}`}function jt(t){let o=g(t.metadata.provider),e=t.input.query??"";if(!e)return`\u25C8 ${o}`;return`\u25C8 ${o} "${e}"`}function Bt(t){let o=t.input,e=o.filePath||o.filepath||t.patterns[0]||"";return{icon:"\u2192",title:`Edit ${s(e,{home:!0})}`,lines:[],diff:t.metadata.diff??o.diff,file:e}}function _t(t){let o=t.input.filePath||t.patterns[0]||"";return{icon:"\u2192",title:`Read ${s(o,{home:!0})}`,lines:o?[`Path: ${s(o,{home:!0})}`]:[]}}function qt(t){let o=t.input.pattern||t.patterns[0]||"";return{icon:"\u2731",title:`Glob "${o}"`,lines:o?[`Pattern: ${o}`]:[]}}function At(t){let o=t.input.pattern||t.patterns[0]||"";return{icon:"\u2731",title:`Grep "${o}"`,lines:o?[`Pattern: ${o}`]:[]}}function xt(t){let o=l(f(t.input).path)||t.patterns[0]||"";return{icon:"\u2192",title:`List ${s(o,{home:!0})}`,lines:o?[`Path: ${s(o,{home:!0})}`]:[]}}function Ot(t){let o=t.input.description||"Shell command",e=t.input.command||"";return{icon:"#",title:o,lines:e?[`$ ${e}`]:t.patterns.map((n)=>`- ${n}`)}}function Dt(t){let o=t.input.subagent_type||"general",e=t.input.description;return{icon:"#",title:`${m(o)} Task`,lines:e?[`\u25C9 ${e}`]:[]}}function Qt(t){let o=t.input.url||"";return{icon:"%",title:`WebFetch ${o}`,lines:o?[`URL: ${o}`]:[]}}function Ct(t){let o=t.input.query||"",e=g(t.metadata.provider);return{icon:"\u25C8",title:o?`${e} "${o}"`:e,lines:o?[`Query: ${o}`]:[]}}function Nt(t){let o=t.input.filePath||"",e=typeof t.input.line==="number"?t.input.line:void 0,n=typeof t.input.character==="number"?t.input.character:void 0,r=e!==void 0&&n!==void 0?`${e}:${n}`:void 0;return{icon:"\u2192",title:I(t.input,{home:!0}),lines:[...t.input.operation?[`Operation: ${t.input.operation}`]:[],...o?[`Path: ${s(o,{home:!0})}`]:[],...r?[`Position: ${r}`]:[]]}}var _={invalid:{view:{output:!0,final:!1},run:tt,scroll:{start:()=>""}},bash:{view:{output:!0,final:!1},run:Vt,scroll:{start:pt,progress:ct,final:dt},permission:Ot},write:{view:{output:!1,final:!0,snap:"code"},run:U,snap:it,scroll:{start:Tt}},edit:{view:{output:!1,final:!0,snap:"diff"},run:K,snap:st,scroll:{start:ht},permission:Bt},apply_patch:{view:{output:!1,final:!0,snap:"diff"},run:Y,snap:lt,scroll:{start:yt,final:Pt}},batch:{view:{output:!0,final:!1},run:ot,scroll:{start:()=>""}},task:{view:{output:!1,final:!0,snap:"structured"},run:X,snap:at,scroll:{start:gt,final:bt},permission:Dt},todowrite:{view:{output:!1,final:!0,snap:"structured"},run:z,snap:ut,scroll:{start:kt,final:wt}},question:{view:{output:!1,final:!0,snap:"structured"},run:Z,snap:ft,scroll:{start:St,final:It}},read:{view:{output:!1,final:!1},run:M,scroll:{start:mt},permission:_t},glob:{view:{output:!1,final:!1},run:Q,scroll:{start:Ft,final:Lt},permission:qt},grep:{view:{output:!1,final:!1},run:C,scroll:{start:Et},permission:At},list:{view:{output:!1,final:!1},run:N,scroll:{start:Rt},permission:xt},lsp:{view:{output:!1,final:!1},run:et,scroll:{start:vt},permission:Nt},webfetch:{view:{output:!1,final:!1},run:V,scroll:{start:Gt},permission:Qt},websearch:{view:{output:!1,final:!1},run:J,scroll:{start:jt},permission:Ct},skill:{view:{output:!1,final:!1},run:H,scroll:{start:Wt}},plan_exit:{view:{output:!0,final:!1},run:nt,scroll:{start:()=>""}}};function Mt(t){return Object.prototype.hasOwnProperty.call(_,t)}function h(t){if(!t||!Mt(t))return;return _[t]}function Ut(t){let o=f(t.state);return{raw:"",name:t.tool,input:f(o.input),meta:"metadata"in t.state?f(t.state.metadata):{},state:o,status:l(o.status),error:l(o.error)}}function q(t,o){let e=f(t.part?.state);return{raw:o,name:t.tool||t.part?.tool||"tool",input:f(e.input),meta:t.part?.state&&"metadata"in t.part.state?f(t.part.state.metadata):{},state:e,status:t.toolState??l(e.status),error:(t.toolError??"").trim()}}function Vt(t){return{icon:"$",title:t.input.command||"",mode:"block",body:t.frame.status==="completed"?l(t.frame.state.output).trim():void 0}}function A(t){return h(t)?.view??{output:!0,final:!0}}function Kt(t){let o=t.toolState??t.part?.state.status;return t.kind==="tool"&&t.phase==="final"&&o==="completed"&&Boolean(A(t.tool??t.part?.tool).snap)}function ro(t){let o=Ut(t),e=h(o.name)?.run;try{if(e)return e(w(o))}catch{return L(o)}return L(o)}function b(t,o){let e=h(o.name)?.scroll?.[t];try{if(e)return e(w(o))}catch{if(t==="start")return W(o);if(t==="progress")return o.raw;return F(o)}if(t==="start")return W(o);if(t==="progress")return o.raw;return F(o)}function io(t,o,e,n){let r=h(t)?.permission;if(!r)return;try{return r(D({input:o,meta:e,patterns:n}))}catch{return}}function Jt(t,o){let e=q(t,o),n=h(e.name)?.snap;if(!n)return;try{return n(w(e))}catch{return}}function c(t){if(!t)return;return{type:"text",content:t}}function Xt(t){if(!t)return;return{type:"markdown",content:t}}function zt(t,o){let e=Jt(t,o);if(!e)return;return{type:"structured",snapshot:e}}function Ht(t,o){let e=k(o).replace(/^\n+/,"").replace(/\n+$/,"");if(!e)return;if(!t)return e;return`
15
+ ${e}`}function so(t,o){if(t.shell){if(t.phase==="start")return c(`$ ${t.shell.command}`);if(t.phase==="progress")return c(Ht(t.shell.command,o)??"");return}let e=q(t,o),n=A(e.name);if(e.name==="task"){if(t.phase==="start")return;if(t.phase==="final"&&e.status==="completed"){let r=$t(l(e.state.output));if(r)return Xt(r)}}if(t.phase==="progress"&&!n.output)return;if(t.phase==="final"){if(e.status==="error")return c(b("final",e));if(!n.final)return;if(e.status&&e.status!=="completed")return c(e.raw.trim());if(Kt(t))return zt(t,o)??c(b("final",e))}return c(b(t.phase,e))}function lo(t){if(!t)return;let o=d.extname(t),e=R[o];if(["typescriptreact","javascriptreact","javascript"].includes(e))return"typescript";return e}
16
+ export{s as Df,q as Ef,A as Ff,Kt as Gf,ro as Hf,b as If,io as Jf,Jt as Kf,so as Lf,lo as Mf};