openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 2.13 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Uu as t,or as n}from"./_4____________________________.js";import{GN as r,JN as i,qN as a}from"./_2_____________________________.js";import{F as o,O as s,U as c,d as l,j as u,s as d,u as f,x as p}from"./_6____________________.js";import{Ci as m,Ht as h,Qr as g,Si as _,Ut as v,Zr as y,li as b,si as x}from"./control-ui-boot-chat-styles-DMRbEm40.js";import{a as S,i as C,n as w,r as T,t as E}from"./tool-output-text-C7ntGI62.js";function D(e,t,n){return h(e,t)??(n&&b(n)?!1:e.get(t))}function O(){return(O=e((()=>{v(),x()})))()}function k(e){let r=o(()=>{let n=e.card;return m(n.name,t(n.args)).kind},{lazy:!0}),a=o(()=>{let t=r();if(t!==`command`&&t!==`read`&&t!==`search`)return;let i=e.output?{...e.card,outputText:e.output.outputText,liveOutput:e.output.liveOutput}:e.card,a=i.live&&!i.completed&&e.options.runActive?i.liveOutput:void 0,o=(a?.text??T(i))?.trimEnd();if(!o)return;let s=o.length;for(let e=0;e<3&&(s=s>0?o.lastIndexOf(`
`,s-1):-1,!(s<0));e++);let c=n(o,Math.max(s+1,o.length-600));return{text:c,rolling:a!==void 0,more:c.length<o.length||(a?.omittedChars??0)>0,truncated:i.outputTruncated||i.catalogTruncated||w(i)}});return u(s,{get when(){return a()},children:t=>(()=>{var n=M(),r=n.firstChild,a=r.firstChild,o=r.nextSibling,c=o.nextSibling;return l(a,()=>t().text),l(n,u(s,{get when(){return t().more},get children(){var n=A();return n._$$click=()=>e.options.onToggleExpanded(e.card.id),l(n,()=>i(t().rolling?`chat.toolCards.previewCaptured`:`chat.toolCards.previewMore`)),n}}),o),l(n,u(s,{get when(){return t().truncated},get children(){var e=j();return l(e,()=>i(`chat.toolCards.previewTruncated`)),e}}),c),n})()})}var A,j,M;function N(){return(N=e((()=>{f(),c(),C(),_(),E(),r(),A=p(`<button type=button class=chat-command-trail__more>`),j=p(`<span>`),M=p(`<div class=chat-command-trail__preview><div class=chat-command-trail__preview-output><pre class=chat-tool-output__text></pre></div><!><!>`),a(S),d([`click`])})))()}function P(){return(P=e((()=>{O(),g(),N()})))()}P();export{k as InlineToolPreview,y as ToolCardBody,D as readInlineToolExpansion};