openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 2.28 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{wa as t,xa as n}from"./control-ui-connection-Bfj9beF_.js";import{Cb as r,Db as i,Ob as a,Sb as o,Vh as s,gM as c,hM as l,kb as u,yb as d}from"./control-ui-boot-shared-DFTSUQQ0.js";import{J as f}from"./deferred-ui-support-D-VedBtc.js";function p(e,t=!1){if(e==null||!Number.isFinite(e)||e<0)return;let n=BigInt(Math.round(e)),r=[];for(let e of[`week`,`day`,`hour`,`minute`,`second`,`millisecond`]){let i=n/BigInt(l[e]);i>0n&&(e!==`week`||t)&&(r.push({value:i,unit:e}),n%=BigInt(l[e]))}return r.length?r:[{value:0,unit:`millisecond`}]}function m(){return(m=e((()=>{c()})))()}function h(e){if(!e)return t(`common.na`);let n=d(e,{weekday:`short`});return n===t(`common.na`)?n:`${n}, ${o(e)} (${r(e)})`}function g(e){if(e.totalTokens==null)return t(`common.na`);let n=e.totalTokens??0,r=f(e).tokens;return r?`${n} / ${r}`:String(n)}function _(e){if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return a(e)}}function v(e){let n=e.state??{},r=n.nextRunAtMs?o(n.nextRunAtMs):t(`common.na`),i=n.lastRunAtMs?o(n.lastRunAtMs):t(`common.na`);return`${s(e)} · next ${r} · last ${i}`}function y(e){let n=e.schedule;if(n.kind===`at`){let e=Date.parse(n.at);return Number.isFinite(e)?`At ${o(e)}`:`At ${n.at}`}return n.kind===`every`?`Every ${p(n.everyMs)?.map(i).join(` `)??t(`common.na`)}`:n.kind===`on-exit`?`On exit: ${n.command}${n.cwd?` (cwd: ${n.cwd})`:``}`:n.kind===`event`?`Event: ${typeof n.options.name==`string`?n.options.name:n.source}`:n.kind===`stream`?`Stream: ${n.command.join(` `)}${n.cwd?` (cwd: ${n.cwd})`:``}`:`Cron ${n.expr}${n.tz?` (${n.tz})`:``}`}function b(e){let t=e.payload;if(e.payloadSource?.kind===`pluginCommand`)return`Plugin command: /${e.payloadSource.command} (${e.payloadSource.pluginId})`;if(t.kind===`systemEvent`)return`System: ${t.text}`;if(t.kind===`command`)return`Command: ${t.argv.join(` `)}`;if(t.kind===`script`)return`Script: ${t.script}`;let n=`Agent: ${t.message}`,r=e.delivery;if(r&&r.mode!==`none`){let e=r.mode===`webhook`?r.to?` (${r.to})`:``:r.channel||r.to?` (${r.channel??`last`}${r.to?` -> ${r.to}`:``})`:``;return`${n} · ${r.mode}${e}`}return n}function x(){return(x=e((()=>{m(),n(),u()})))()}export{h as a,m as c,_ as i,p as l,y as n,g as o,v as r,x as s,b as t};