UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 8.38 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{GN as t,JN as n,Lk as r,by as i,dT as a,fN as o,fT as s,iv as c,ov as l,pN as u,qN as d,yy as ee}from"./_2_____________________________.js";import{C as f,F as p,H as te,O as m,U as h,d as g,f as _,g as v,gt as ne,j as y,l as b,m as x,s as S,u as C,x as w}from"./_6____________________.js";import{_t as T,gt as E}from"./control-ui-boot-new-pHXPNTZp.js";import{n as D,t as O}from"./en-chat-session-optional-Dhpd_jPf.js";function k(e){return e.replace(/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,``)}function A(e){let t=()=>e.view.taskSuggestions??[],n=p(()=>t().some(t=>t.id===e.view.activeTaskSuggestionId)?e.view.activeTaskSuggestionId:t()[0]?.id);return y(m,{get when(){return t().length>0},get children(){var r=M();return g(r,y(f,{get each(){return t()},keyed:e=>e.id,children:(r,i)=>y(m,{keyed:!0,get when(){return`${r().id}:${r().id===n()?e.view.taskSuggestionSwapGeneration??0:`inactive`}`},children:a=>y(j,{get suggestion(){return r()},get index(){return i()},get count(){return t().length},get active(){return r().id===n()},get view(){return e.view}})})})),b(()=>t().length>1,e=>{r.classList.toggle(`task-suggestions--stack`,e)}),r}})}function j(e){let t=()=>e.view.canAcceptTaskSuggestions===!0,i=()=>e.view.taskSuggestionAcceptance?.(e.suggestion.id),s=()=>i()?.phase===`starting`,l=()=>{let e=i();return e?.phase===`failed`?e:void 0},u=()=>l()?.repository,d=()=>k(e.suggestion.title),h=()=>k(e.suggestion.cwd),S=()=>n(e.view.taskSuggestionCopiedIds?.has(e.suggestion.id)?`chat.taskSuggestions.promptCopied`:`chat.taskSuggestions.copyPrompt`),C=p(()=>u()?.cwd??``),w=p(()=>!!i()),E=ee((e,t)=>e.toggleAttribute(`data-overflow-right`,!t.atEnd),{presented:()=>e.active,horizontal:!0,content:h}),D=n=>{!s()&&t()&&e.view.onAcceptTaskSuggestion?.(e.suggestion,n,void 0)};function O(){let r=te();return y(c,{id:`task-start-${r}`,placement:`bottom-end`,get label(){return n(`chat.taskSuggestions.startOptions`)},get disabled(){return s()||!t()},triggerClass:`btn task-suggestion__start task-suggestion__start--options`,get triggerAttributes(){return{title:t()?``:e.view.taskSuggestionBlockedReason}},get trigger(){return y(o,{name:`chevronDown`})},get items(){return[{id:`local`,label:n(`chat.taskSuggestions.startSession`),disabled:s()||!t()},{id:`worktree`,label:n(`chat.taskSuggestions.startWorktree`),disabled:s()||!t()},{id:`session`,label:n(`chat.taskSuggestions.startCurrentSession`),disabled:s()||!t()}]},onSelect:e=>{(e.id===`local`||e.id===`worktree`||e.id===`session`)&&D(e.id)}})}var A=L(),j=A.firstChild,M=j.firstChild,H=M.firstChild,re=H.nextSibling,U=M.nextSibling,W=U.firstChild,G=W.nextSibling,ie=G.nextSibling,K=j.nextSibling,q=K.firstChild,J=q.nextSibling,Y=J.nextSibling,X=Y.firstChild,Z=X.firstChild,Q=Z.nextSibling,ae=Q.nextSibling,$=X.nextSibling.firstChild,oe=$.nextSibling,se=Y.nextSibling,ce=se.nextSibling,le=K.nextSibling;return g(M,()=>n(`chat.taskSuggestions.eyebrow`,{repo:k(r(h()))}),H),g(M,y(m,{get when(){return e.count>1},get children(){var t=N(),n=t.firstChild,r=n.nextSibling;return g(t,()=>e.index+1,n),g(t,()=>e.count,r),t}}),re),W._$$click=()=>e.view.onCopyTaskSuggestionPrompt?.(e.suggestion),g(W,y(o,{get name(){return e.view.taskSuggestionCopiedIds?.has(e.suggestion.id)?`check`:`copy`}})),g(U,y(m,{get when(){return e.count>1},get children(){return y(f,{each:[`previous`,`next`],children:t=>{let r;ne(()=>{e.active&&r&&e.view.onTaskSuggestionNavigationMount?.(e.suggestion.id,t,r)});var i=R();return i._$$click=()=>e.view.onNavigateTaskSuggestion?.(e.suggestion.id,t),v(i,`data-task-prev`,t===`previous`?``:void 0),v(i,`data-task-next`,t===`next`?``:void 0),x(()=>e=>{r=e},i),g(i,y(o,{name:t===`previous`?`chevronLeft`:`chevronRight`})),b(()=>n(t===`previous`?`chat.taskSuggestions.previous`:`chat.taskSuggestions.next`),e=>{v(i,`aria-label`,e)}),i}})}}),G),g(U,y(m,{get when(){return e.view.canDismissTaskSuggestions===!0},get children(){var t=P();return t._$$click=()=>e.view.onDismissTaskSuggestion?.(e.suggestion),g(t,y(o,{name:`x`})),b(()=>({e:s(),t:n(`chat.taskSuggestions.dismiss`,{title:d()})}),({e,t:n},r)=>{e!==r?.e&&v(t,`disabled`,e),n!==r?.t&&v(t,`aria-label`,n)}),t}}),ie),g(q,d),g(J,()=>k(e.suggestion.tldr)),g(Z,y(o,{name:`chevronRight`})),g(Q,()=>n(`chat.taskSuggestions.showInstructions`)),g(ae,()=>n(`chat.taskSuggestions.hideInstructions`)),x(()=>E,$),g($,h),g(oe,()=>k(e.suggestion.prompt)),g(K,y(m,{get when(){return l()},children:e=>y(a,{tone:`danger`,role:`alert`,get children(){var t=z(),r=t.firstChild,i=r.nextSibling;return g(t,(()=>{var e=_(()=>!!u());return()=>e()?void 0:n(`chat.taskSuggestions.startUnconfirmed`)})(),r),g(t,()=>e().error,i),t}})}),se),g(K,y(m,{get when(){return u()?.open},get children(){var r=F(),i=r.firstChild,a=i.nextSibling,o=a.firstChild,s=o.nextSibling,c=a.nextSibling;return g(i,()=>n(`chat.taskSuggestions.chooseRepositoryHelp`)),g(o,()=>n(`chat.taskSuggestions.repositoryFolder`)),s._$$input=t=>e.view.onChangeTaskRepository?.(e.suggestion,{cwd:t.currentTarget.value}),g(r,y(f,{get each(){return u()?.projects??[]},children:n=>(()=>{var r=B(),i=r.firstChild;return r._$$click=()=>e.view.onChangeTaskRepository?.(e.suggestion,{cwd:n.repoRoot??``}),g(r,()=>n.displayName,i),g(i,()=>n.repoRoot),b(()=>({e:!t(),t:n.repoRoot??``}),({e,t},n)=>{e!==n?.e&&v(r,`disabled`,e),t!==n?.t&&v(r,`title`,t)}),r})()}),c),c._$$click=()=>e.view.onChangeTaskRepository?.(e.suggestion,{open:!1}),g(c,()=>n(`common.cancel`)),b(()=>({e:C(),t:!t()}),({e,t},n)=>{s.value=e??``,t!==n?.t&&v(s,`disabled`,t)}),r}}),ce),g(le,y(m,{get when(){return l()},get fallback(){return[(()=>{var r=V(),i=r.firstChild,a=i.nextSibling;return r._$$click=()=>D(`local`),g(r,y(o,{name:`play`}),i),g(r,()=>n(s()?`chat.taskSuggestions.starting`:`chat.taskSuggestions.startSession`),a),b(()=>({e:s()||!t(),t:t()?``:e.view.taskSuggestionBlockedReason}),({e,t},n)=>{e!==n?.e&&v(r,`disabled`,e),t!==n?.t&&v(r,`title`,t)}),r})(),y(O,{})]},get children(){var r=I();return r._$$click=()=>{let n=u();n?n.open?t()&&T(n.cwd.trim())&&e.view.onAcceptTaskSuggestion?.(e.suggestion,`worktree`,n.cwd.trim()):e.view.onChangeTaskRepository?.(e.suggestion,{open:!0}):D(`local`)},g(r,(()=>{var e=_(()=>!!u());return()=>e()?n(u()?.open?`chat.taskSuggestions.startWorktree`:`chat.taskSuggestions.chooseRepository`):n(`common.retry`)})()),b(()=>!t()||!(!u()?.open||T(C().trim())),e=>{v(r,`disabled`,e)}),r}})),b(()=>({e:e.suggestion.id,t:e.active?e.view.taskSuggestionSwapDirection:void 0,a:!e.active,o:h(),i:S(),n:S(),s:w()}),({e,t,a:n,o:r,i,n:a,s:o},s)=>{e!==s?.e&&v(A,`data-task-id`,e),t!==s?.t&&v(A,`data-swap-direction`,t),n!==s?.a&&v(A,`hidden`,n),r!==s?.o&&v(M,`title`,r),i!==s?.i&&v(W,`aria-label`,i),a!==s?.n&&v(W,`title`,a),o!==s?.s&&v(Y,`open`,o)}),A}var M,N,P,F,I,L,R,z,B,V;function H(){return(H=e((()=>{C(),h(),u(),s(),l(),O(),t(),i(),E(),M=w(`<div class=task-suggestions aria-live=polite>`),N=w(`<span class=task-suggestion__position> / <!>`),P=w(`<button class="task-suggestion__header-action task-suggestion__dismiss"type=button>`),F=w(`<div class=task-suggestion__repository><p></p><label><span></span><input type=text class=task-suggestion__repository-path></label><button type=button class=btn>`),I=w(`<button class="btn task-suggestion__start task-suggestion__retry"type=button>`),L=w(`<article class=task-suggestion><header class=task-suggestion__header><div class=task-suggestion__eyebrow><!><!></div><div class=task-suggestion__header-actions><button class="task-suggestion__header-action task-suggestion__copy"type=button></button><!><!></div></header><div class=task-suggestion__body><div class=task-suggestion__title></div><div class=task-suggestion__summary></div><details class=task-suggestion__instructions><summary><span class=task-suggestion__instructions-chevron aria-hidden=true></span><span class=task-suggestion__show></span><span class=task-suggestion__hide></span></summary><div class=task-suggestion__instruction-body><code></code><pre></pre></div></details><!><!></div><div class=task-suggestion__actions>`),R=w(`<button class=task-suggestion__header-action type=button>`),z=w(`<span> <!>`),B=w(`<button type=button class="btn task-suggestion__repository-choice"><small>`),V=w(`<button class="btn task-suggestion__start task-suggestion__start--primary"type=button><!><!>`),d(D),S([`click`,`input`])})))()}H();export{A as ChatTaskSuggestionTray};