UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 15 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{I as t,lo as n}from"./control-ui-connection-Bfj9beF_.js";import{BA as r,CC as i,J_ as a,RA as o,X_ as s,Y_ as c,cj as l,dj as u,mj as d,pj as f,q_ as p,sj as m,wC as h,zA as g}from"./control-ui-boot-shared-DFTSUQQ0.js";import{A as _,C as v,F as ee,O as y,U as b,d as x,f as te,g as S,gt as C,j as w,l as T,m as E,s as D,u as O,v as k,x as A}from"./solid-runtime-C416s-HC.js";import{Qt as ne,Xt as re,mo as ie,ot as ae,po as oe}from"./control-ui-boot-chat-DewxEbIm.js";import{i as se,s as ce}from"./session-progress-card-C1D1tB_F.js";import{n as le,t as ue}from"./en-github-CL8n2jUp.js";import{n as de,t as fe}from"./en-chat-session-optional-iBUVV79A.js";function j(e){let t=()=>{let t=e.name;return t===`goal`||t===`pause`||t===`bot`||t===`filledStop`||t===`spinner`||t===`github`?void 0:t};return w(y,{get when(){return e.name!==`spinner`},get fallback(){return B()},get children(){return w(y,{get when(){return e.name!==`github`},get fallback(){return w(o,{name:`github`})},get children(){return w(y,{get when(){return e.name===`goal`||e.name===`pause`||e.name===`bot`||e.name===`filledStop`},get fallback(){return w(y,{get when(){return t()},children:e=>w(g,{get name(){return e()}})})},get children(){var t=z(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling,a=i.nextSibling;return x(t,w(y,{get when(){return e.name===`goal`},get children(){return P()}}),n),x(t,w(y,{get when(){return e.name===`pause`},get children(){return F()}}),r),x(t,w(y,{get when(){return e.name===`bot`},get children(){return[I(),L()]}}),i),x(t,w(y,{get when(){return e.name===`filledStop`},get children(){return R()}}),a),t}})}})}})}function M(e){let t=e.value,n=e.recovery;if(n?.goalId===t.id&&n.action===`resume`&&!n.retired)return n.pending?{label:d(`chat.goals.resuming`),icon:`spinner`}:{label:d(`chat.activityPills.goal.resumeUnconfirmed`),icon:`alertTriangle`,tone:`warn`,attention:!0};switch(t.status){case`active`:return{label:e.executionConfirmed?d(`chat.activityPills.goal.pursuing`):d(`chat.activityPills.goal.active`),icon:`goal`,tone:`ok`,shine:e.executionConfirmed};case`paused`:return{label:d(`chat.activityPills.goal.paused`),icon:`pause`,tone:`muted`};case`complete`:return{label:d(`chat.activityPills.goal.achieved`),icon:`check`,tone:`ok`};default:return{label:t.status===`blocked`?d(`chat.activityPills.goal.blocked`):t.status===`usage_limited`?d(`chat.activityPills.goal.usageLimit`):d(`chat.activityPills.goal.budgetReached`),icon:`alertTriangle`,tone:`warn`,attention:!0}}}function pe(e){let t=ce(e.card,e.sessionStatus,e.startedAt,e.endedAt,e.hasActiveRun,e.runtime),n;if(e.refresh===`pending`)n={icon:`spinner`,tone:`normal`,label:d(`chat.activityPills.progress.updating`)};else if(e.refresh===`failed`||e.refresh===`timeout`)n={icon:`alertTriangle`,tone:`warn`,label:d(`chat.activityPills.progress.updateUnavailable`)};else if(e.runtime?.connected===!1||e.runtime?.known===!1)n={icon:`alertTriangle`,tone:`warn`,label:d(e.runtime.connected===!1?`sessionProgressCard.runtime.offline`:`sessionProgressCard.runtime.unknown`)};else if(e.runtime?.children?.failed)n={icon:`x`,tone:`danger`,label:d(`sessionProgressCard.runtime.failed`,{count:String(e.runtime.children.failed)})};else if(t.counts)n=t.hasCurrentRunActivity?{icon:`spinner`,tone:`normal`,label:d(`common.running`)}:t.complete?{icon:`check`,tone:`ok`,label:d(`common.completed`)}:t.effectiveSessionStatus===`timeout`?{icon:`alertTriangle`,tone:`warn`,label:d(`chat.activityPills.progress.timedOut`)}:t.terminalOutcome===`failed`?{icon:`x`,tone:`danger`,label:d(`chat.activityPills.progress.failed`)}:t.terminalOutcome===`stopped`?{icon:`filledStop`,tone:`danger`,label:d(`chat.activityPills.progress.stopped`)}:t.presentedCurrentStatus===`paused`?{icon:`pause`,tone:`warn`,label:d(`chat.activityPills.paused`)}:{icon:`clock`,tone:`warn`,label:d(`chat.activityPills.pending`)};else return{label:d(`sessionProgressCard.composerTitle`),icon:`listChecks`};return t.counts?{label:t.stepLabel,icon:`listChecks`,count:d(`chat.activityPills.progress.count`,{completed:String(t.counts.completed),total:String(t.counts.total)}),description:d(`chat.activityPills.progress.description`,{step:t.stepLabel,completed:String(t.counts.completed),total:String(t.counts.total),status:n.label}),badge:n,attention:e.refresh===`failed`||e.refresh===`timeout`||!t.complete&&t.terminalOutcome===`failed`}:{label:d(`sessionProgressCard.composerTitle`),icon:`listChecks`,badge:n,attention:e.refresh===`failed`||e.refresh===`timeout`}}function me(e,t){let n=(e.state===`open`||e.state===`draft`)&&t===`ready`?e.checks:void 0,r=n?{icon:n.state===`pending`?`spinner`:n.state===`passing`?`check`:`x`,tone:n.state===`passing`?`ok`:n.state===`failing`?`danger`:`normal`,label:n.state===`passing`?d(`chat.activityPills.pullRequest.checksPassed`):n.state===`failing`?d(`chat.activityPills.pullRequest.checksFailed`):d(`chat.activityPills.pullRequest.checksRunning`)}:void 0,i=t===`ready`?``:d(t===`rate-limited`?`chat.activityPills.pullRequest.rateLimitedSuffix`:`chat.activityPills.pullRequest.unavailableSuffix`);return{label:d(`chat.activityPills.pullRequest.number`,{number:String(e.number)}),icon:be[e.state],tone:xe[e.state],badge:r,attention:t===`unavailable`,description:d(`chat.activityPills.pullRequest.description`,{owner:e.owner,repo:e.repo,number:String(e.number),title:e.title,state:d(`chat.activityPills.pullRequest.states.${e.state}`),checks:r?d(`chat.activityPills.pullRequest.checksSuffix`,{checks:r.label}):``,query:i})}}function he(e){return e.activity===null?e.optionsUnavailable?{label:d(`chat.activityPills.publication.unavailable`),icon:`gitPullRequest`,badge:{icon:`alertTriangle`,tone:`warn`,label:d(`chat.activityPills.publication.discoveryUnavailable`)},attention:!0}:e.error||e.locked&&!e.result?{label:d(`chat.activityPills.publication.unconfirmed`),icon:`gitPullRequest`,badge:{icon:`alertTriangle`,tone:`warn`,label:d(`chat.activityPills.publication.verifyBeforeRetry`)},attention:!0}:e.result?.status===`published`?{label:d(`chat.activityPills.publication.published`),icon:`gitPullRequest`,badge:{icon:`check`,tone:`ok`,label:d(`chat.activityPills.publication.publishedBadge`)}}:e.result?.status===`failed`?{label:d(`chat.activityPills.publication.failed`),icon:`gitPullRequest`,tone:`danger`,badge:{icon:`x`,tone:`danger`,label:d(`githubPublication.statusFailed`)},attention:!0}:e.result?.status===`needs_confirmation`?{label:d(`chat.activityPills.publication.confirm`),icon:`gitPullRequest`,badge:{icon:`clock`,tone:`warn`,label:d(`githubPublication.statusConfirm`)}}:e.result?.status===`requested`||e.result?.status===`publishing`?{label:e.result.status===`requested`?d(`githubPublication.statusRequested`):d(`chat.activityPills.publication.publishing`),icon:`gitPullRequest`,badge:{icon:e.result.status===`requested`?`clock`:`spinner`,tone:`warn`,label:d(e.result.status===`requested`?`chat.activityPills.publication.requestedBadge`:`chat.activityPills.publication.publishingBadge`)}}:{label:d(`chat.pullRequests.publishPr`),icon:`github`,description:d(`chat.activityPills.publication.review`)}:{label:e.activity===`read`?e.result||e.locked?d(`chat.activityPills.publication.verifying`):d(`chat.activityPills.publication.checkingOptions`):d(`chat.activityPills.publication.publishing`),icon:`gitPullRequest`,badge:{icon:`spinner`,tone:`normal`,label:d(`chat.activityPills.pending`)}}}function N(e){let t=_(()=>e.leading),n,r=p((e,t)=>e.toggleAttribute(`data-overflow`,t.scrollable),{horizontal:!0,trackScroll:!1,content:()=>e.view.label}),i=()=>e.view.description??(e.view.badge?d(`chat.activityPills.withBadge`,{label:e.view.label,badge:e.view.badge.label}):e.view.label);C(()=>h([n],([e])=>n.toggleAttribute(`data-out-of-view`,!e?.isIntersecting)));var a=U(),o=a.firstChild,s=o.nextSibling,c=s.firstChild,l=c.nextSibling,u=s.nextSibling,f=u.nextSibling;return a._$$click=t=>e.onOpen(t.currentTarget),E(()=>[e=>{n=e},m(t=>e.registerButton(t))],a),x(a,w(y,{get when(){return e.flow},get children(){return V()}}),o),x(a,w(y,{get when(){return t()},get fallback(){var t=W(),n=t.firstChild,r=n.firstChild,i=r.nextSibling;return x(n,w(j,{get name(){return e.view.icon}}),r),x(n,w(y,{get when(){return e.view.badge},children:e=>(()=>{var t=G();return x(t,w(j,{get name(){return e().icon}})),T(()=>e().tone,e=>{S(t,`data-tone`,e)}),t})()}),i),t},get children(){return t()}}),s),E(()=>r,s),x(s,()=>e.view.label,c),x(s,w(y,{get when(){return e.view.shine},get children(){var t=H();return x(t,()=>e.view.label),t}}),l),x(a,w(y,{get when(){return e.view.count},children:e=>(()=>{var t=K();return x(t,e),t})()}),u),x(a,()=>e.trailing,f),T(()=>({e:!!e.view.attention,t:!!e.flow,a:e.family,o:e.view.tone??`normal`,i:e.view.count?`true`:`false`,n:i(),s:i(),h:!!e.view.shine}),({e,t,a:n,o:r,i,n:o,s:c,h:l},u)=>{e!==u?.e&&a.classList.toggle(`activity-pill--attention`,e),t!==u?.t&&a.classList.toggle(`activity-pill--flow`,t),n!==u?.a&&S(a,`data-family`,n),r!==u?.o&&S(a,`data-tone`,r),i!==u?.i&&S(a,`data-counted`,i),o!==u?.n&&S(a,`aria-label`,o),c!==u?.s&&S(a,`title`,c),l!==u?.h&&s.classList.toggle(`activity-pill__label--shine`,l)}),a}function ge(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return Q[t%Q.length]}function _e(e){let r,i,a=new Set,o,c,l=e=>(a.add(e),o?.observe(e),c?.(),()=>{a.delete(e),o?.unobserve(e),c?.()}),u=ee(()=>e.subagents?.activities.filter(e=>e.status===`running`||e.status===`waiting`)??[]),f=()=>!!e.goal;C(()=>{let t=s(r,t=>{r.toggleAttribute(`data-fade-left`,!t.atStart),r.toggleAttribute(`data-fade-right`,!t.atEnd),e.onLayout?.({strip:r,pills:a})},!0);c=t.schedule,o=new ResizeObserver(t.schedule),o.observe(i),a.forEach(e=>o?.observe(e));let l=()=>r.toggleAttribute(`data-document-hidden`,document.hidden),u=n(document,`visibilitychange`,l);return l(),()=>{t.disconnect(),o?.disconnect(),o=void 0,c=void 0,e.onLayout?.({strip:r,pills:a},!0),u()}});function p(e){if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=[...a].filter(e=>e.isConnected).toSorted((e,t)=>e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),n=t.findIndex(t=>t===e.target);if(n<0)return;let i=e.key===`Home`?0:e.key===`End`?t.length-1:Math.max(0,Math.min(t.length-1,n+(e.key===`ArrowRight`?1:-1)));e.preventDefault();let o=t[i];if(!o)return;o.focus({preventScroll:!0});let s=r.getBoundingClientRect(),c=o.getBoundingClientRect();c.left<s.left+20?r.scrollLeft-=s.left+20-c.left:c.right>s.right-20&&(r.scrollLeft+=c.right-s.right+20)}var m=q(),h=m.firstChild,_=h.firstChild,b=_.nextSibling,D=b.nextSibling,O=D.nextSibling;return m._$$keydown=p,E(()=>e=>{r=e},m),E(()=>e=>{i=e},h),x(h,w(y,{get when(){return te(()=>!e.approvalPending)()&&u().length>0},get children(){return w(N,{registerButton:l,family:`subagents`,get view(){return{label:d(`chat.activityPills.working`,{count:String(u().length)}),icon:`bot`,shine:!0}},onOpen:t=>e.subagents.onOpen(t),get flow(){return u().length>=10},get leading(){var e=J();return x(e,w(v,{get each(){return u().slice(0,3)},keyed:e=>e.key,children:(e,n)=>(()=>{var r=Y();return x(r,w(j,{name:`bot`})),T(()=>({e:t(e().key)%360,t:ge(e().key)[0],a:ge(e().key)[1],o:`${n()*120}ms`}),({e,t,a:n,o:i},a)=>{e!==a?.e&&k(r,`--subagent-avatar-hue`,e),t!==a?.t&&k(r,`--avatar-bg`,t),n!==a?.a&&k(r,`--avatar-ink`,n),i!==a?.o&&k(r,`--wave-delay`,i)}),r})()})),e}})}}),_),x(h,w(y,{get when(){return f()},get children(){return w(N,{registerButton:l,family:`goal`,get view(){return{...M(e.goal),description:d(`chat.activityPills.goal.description`,{status:M(e.goal).label,objective:e.goal.value.objective})}},onOpen:t=>e.goal.onOpen(t)})}}),b),x(h,w(y,{get when(){return te(()=>!e.approvalPending)()&&e.progress},get children(){return w(N,{registerButton:l,family:`progress`,get view(){return pe(e.progress)},onOpen:t=>e.progress.onOpen(t)})}}),D),x(h,w(y,{get when(){return!e.approvalPending},get children(){return[w(v,{get each(){return e.pullRequests?.items??[]},keyed:re,children:t=>w(N,{registerButton:l,family:`pull-request`,get view(){return me(t(),e.pullRequests.status)},onOpen:n=>e.pullRequests.onOpen(t(),n),get trailing(){return w(y,{get when(){return e.pullRequests.status!==`ready`},get fallback(){return w(y,{get when(){return e.pullRequests.items.length===1},get children(){var e=ye(),n=e.firstChild,r=n.nextSibling;return x(e,w(y,{get when(){return t().additions!==void 0},get children(){var e=Z();return e.firstChild,x(e,()=>t().additions,null),e}}),n),x(e,w(y,{get when(){return t().deletions!==void 0},get children(){var e=ve();return e.firstChild,x(e,()=>t().deletions,null),e}}),r),e}})},get children(){var e=X();return x(e,w(g,{name:`alertTriangle`})),e}})}})}),w(y,{get when(){return e.publication},get children(){return w(N,{registerButton:l,family:`publication`,get view(){return he(e.publication.view)},onOpen:t=>e.publication.onOpen(t)})}})]}}),O),T(()=>({e:!ae(e),t:e.presented?`true`:`false`,a:d(`chat.activityPills.label`)}),({e,t,a:n},r)=>{e!==r?.e&&S(m,`hidden`,e),t!==r?.t&&S(m,`data-presented`,t),n!==r?.a&&S(m,`aria-label`,n)}),m}var P,F,I,L,R,z,B,V,H,U,W,G,K,q,J,Y,X,Z,ve,ye,be,xe,Q;function $(){return($=e((()=>{O(),b(),c(),se(),r(),oe(),fe(),ue(),l(),u(),i(),a(),ne(),P=A(`<svg><path d="M12 13V2l8 4-8 4M20.561 10.222a9 9 0 1 1-12.55-5.29M8.002 9.997a5 5 0 1 0 8.9 2.02"></svg>`,2),F=A(`<svg><path d="M9 5v14M15 5v14"></svg>`,2),I=A(`<svg><rect x=4 y=7 width=16 height=13 rx=2></svg>`,2),L=A(`<svg><path d="M12 3v4M9 12v3m6-3v3M1 11v5m22-5v5"></svg>`,2),R=A(`<svg><rect x=4 y=4 width=16 height=16 rx=2 fill=currentColor stroke=none></svg>`,2),z=A(`<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.7 stroke-linecap=round stroke-linejoin=round aria-hidden=true><!><!><!><!>`),B=A(`<span class=activity-pill__spinner>`),V=A(`<span class=activity-pill__flow aria-hidden=true><span class=activity-pill__atlas>`),H=A(`<span class=activity-pill__shimmer aria-hidden=true>`),U=A(`<button class=activity-pill type=button aria-haspopup=dialog><!><span class=activity-pill__label><!><!></span><!><!>`),W=A(`<span class=activity-pill__leading aria-hidden=true><span class=activity-pill__composite><!><!>`),G=A(`<span class=activity-pill__badge>`),K=A(`<span class=activity-pill__count>`),q=A(`<div class=chat-activity-pills role=group><div class=chat-activity-pills__row><!><!><!><!>`),J=A(`<span class=activity-pill__avatars aria-hidden=true>`),Y=A(`<span class=activity-pill__avatar>`),X=A(`<span class=activity-pill__problem aria-hidden=true>`),Z=A(`<span class=activity-pill__additions>+`),ve=A(`<span class=activity-pill__deletions>−`),ye=A(`<span class=activity-pill__diff><!><!>`),f(de),f(ie),f(le),be={open:`gitPullRequest`,draft:`gitPullRequestDraft`,merged:`gitMerge`,closed:`gitPullRequestClosed`},xe={open:`ok`,draft:`muted`,merged:`purple`,closed:`danger`},Q=[[`#34383b`,`#bdc3c7`],[`#34414b`,`#afc4d4`],[`#38353e`,`#beb6ca`],[`#30383c`,`#acbec5`],[`#3c363a`,`#c6b9c1`],[`#3a3832`,`#c3beae`]],D([`click`,`keydown`])})))()}$();export{_e as ChatActivityPills};