openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 1.69 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Ko as t,Qo as n,Ss as r,ll as i}from"./_4____________________________.js";import{Cm as a,IN as o,Kp as s,PN as c,Wp as l}from"./_2_____________________________.js";import{F as u,J as d,U as f,V as p,gt as m,j as h,u as g}from"./_6____________________.js";import{n as _,t as v}from"./chat-subagent-activity-VJPy8NAC.js";function y(e,n){let a=e.session;return e.status===`running`&&typeof n.sessionKey==`string`&&t(e.key,n.sessionKey)&&typeof n.runId==`string`&&a.activeRunIds?.includes(n.runId)===!0&&(typeof n.agentId!=`string`||i(n.agentId)===r(a,``))&&(!n.sessionId||n.sessionId===a.sessionId)&&(!n.lifecycleRevision||n.lifecycleRevision===a.lifecycleRevision)}function b(e){let t=o(),[n,r]=p(t=>{let n=e.rows;for(let[e,r]of Object.entries(t))n.some(t=>t.key===e&&y(t,r))||delete t[e]},Object.create(null),{shallow:!0});m(()=>{if(!t)return;let n=t.gateway,i=n.snapshot.hello,o=n.subscribe(()=>{i!==n.snapshot.hello&&(i=n.snapshot.hello,r(e=>{for(let t of Object.keys(e))delete e[t]}))});function c(t){if(t.event!==`session.observer`||!i||i!==n.snapshot.hello||!s(t.payload))return;let o=t.payload,c=e.rows.find(e=>y(e,o));c&&r(e=>{a(e[c.key],o)===o&&(e[c.key]=o)})}let l=n.subscribeEvents(c);return()=>{o(),l()}});let i=u(()=>e.rows.map(e=>{let t=n[e.key],r=e.session.observerDigest,i=a(t&&y(e,t)?t:void 0,r?.runId&&e.session.activeRunIds?.includes(r.runId)?r:void 0);return{...e,activity:i?.headline.trim()||e.activity,progress:t&&i===t&&t.planProgress?.total?t.planProgress:void 0}}));return h(v,d(e,{get rows(){return i()}}))}function x(){return(x=e((()=>{g(),f(),l(),c(),n(),_()})))()}x();export{b as ChatSubagentActivity};