1404 lines
175 KiB
JavaScript
1404 lines
175 KiB
JavaScript
import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{Di as t,Jt as n,Sn as r,bn as i,dn as a,er as o,ki as s,un as c,wn as l}from"./control-ui-foundation-CeFMP1Ly.js";import{Bn as u,Dr as d,Hi as f,Hs as p,Js as m,Ki as ee,Ln as h,Os as g,Rn as te,Tr as _,Ts as v,U as y,Wi as ne,Ys as re,as as ie,b as ae,cs as oe,dc as se,fl as b,fs as x,h as ce,ks as S,lc as le,ml as C,ms as w,ni as ue,ns as de,ps as T,qi as fe,qs as pe,rs as me,ti as he,uc as ge,vr as _e,w as ve,x as ye,yr as be,zn as xe}from"./control-ui-core-pH6nakZ-.js";import{E as Se,G as E,J as D,O as Ce,W as O,Z as we,at as k,i as Te,n as Ee,rt as A}from"./lit-runtime-BEtFSUCp.js";import{B as De,C as Oe,Cn as ke,G as Ae,Gn as je,J as Me,Jt as Ne,R as Pe,Sn as Fe,St as Ie,T as Le,U as Re,Ut as ze,W as Be,X as Ve,Yt as He,Z as Ue,_t as We,a as Ge,at as Ke,b as qe,ct as Je,g as Ye,gt as Xe,h as Ze,ht as Qe,i as $e,it as et,ln as tt,lt as nt,m as rt,mt as it,n as at,o as ot,ot as st,p as ct,pt as lt,q as ut,qn as dt,qt as ft,r as pt,st as mt,ut as ht,vt as gt,w as _t,y as vt,yt,z as j,zn as bt}from"./control-ui-core-DGVkFhVB.js";import{Ft as xt,Gt as St,Ht as M,Jt as Ct,Lt as N,Rt as P,Xt as wt,ht as Tt,qt as F,vt as Et}from"./control-ui-core-Br5DB0Zj.js";import{F as Dt,I as Ot,In as kt,L as At,Ln as jt,z as Mt}from"./control-ui-boot-wpHCbPL9.js";import{a as Nt,n as Pt,r as Ft}from"./gateway-runtime-DUNO4Mi1.js";import{$l as It,$o as Lt,$t as Rt,Br as zt,Cn as I,Fr as Bt,Hr as Vt,Ir as Ht,Jl as Ut,Kl as Wt,Lr as Gt,Mr as Kt,Nr as qt,Ns as Jt,Pr as Yt,Ps as Xt,Ql as Zt,Qo as Qt,Rr as $t,Sn as L,Ur as en,Wr as tn,Y as nn,Zl as rn,an,at as on,bn as R,cn as sn,ct as cn,dt as ln,eu as un,ft as dn,gn as z,hn as fn,it as pn,jr as mn,ln as B,lt as hn,mn as gn,on as V,ot as _n,pn as vn,rt as yn,sn as bn,st as xn,tn as Sn,un as Cn,ut as wn,va as Tn,vn as H,ya as En,yn as Dn,zr as On}from"./control-ui-boot-Cdpgu1Gm.js";import{F as kn,M as An,N as jn,P as Mn,b as Nn,j as Pn,x as Fn}from"./control-ui-boot-D1DWJlBr.js";import"./control-ui-boot-BW_XZcbY.js";import{i as In,n as Ln,t as Rn}from"./select-picker-BINM0f88.js";import{n as zn,t as Bn}from"./update-confirmation-BNyRSVb0.js";import{a as Vn,c as Hn,f as Un,i as Wn,l as U,n as Gn,p as Kn,r as qn,s as Jn,t as Yn,u as Xn}from"./memory-schema-3MkJhUhF.js";import{a as Zn,t as Qn}from"./settings-targets-GAGqNu16.js";import{n as $n,t as er}from"./hub-tabs-mHLCJmKB.js";import{n as tr,t as nr}from"./settings-workspace-Bo4nqRhI.js";import{t as rr}from"./agent-select-registration-Bgp9CYzQ.js";import{i as ir,n as ar,r as or,t as sr}from"./memory-panel-DzvRfI2l.js";import{n as cr,t as lr}from"./model-picker-CTfQ10Hi.js";import{a as ur,d as dr,f as fr,h as pr,m as mr,n as hr,p as gr,t as _r}from"./config-form-Bcjgoeiw.js";import{n as vr,r as yr,t as br}from"./system-info-BKnpc1o9.js";function xr(e){return L({title:F(`browserLinkPreferences.openInControlUi`),checked:e.enabled,onChange:e.onChange})}function Sr(){return(Sr=e((()=>{V(),M()})))()}var Cr,wr;function Tr(){return(Tr=e((()=>{w(),Cr={url:``,busy:!1,message:null,expanded:!1,focusToken:0},wr=class{constructor(e){this.publish=e,this.requestRevision=0,this.activationIntent={revision:0,theme:null},this.gatewayScope=``,this.serverSelectionRevision=0,this.state=Cr}get snapshot(){return this.state}connect(e,t){this.gatewayScope=e,this.serverSelectionRevision=this.selectionForScope(e,t)?.revision??0}synchronizeScope(e,t){this.gatewayScope&&e!==this.gatewayScope&&this.retireImport(),this.connect(e,t)}adoptSettings(e,t,n){let r=this.selectionForScope(this.gatewayScope,n),i=this.serverSelectionRevision!==(r?.revision??0);return this.serverSelectionRevision=r?.revision??0,t.customTheme?.importedAt===e.customTheme?.importedAt?(i&&this.recordActivation(r?.theme??null),t.theme!==e.theme&&this.recordActivation(t.theme),t):(this.retireImport(),t)}recordActivation(e){this.activationIntent={revision:this.activationIntent.revision+1,theme:e}}open(){this.update({expanded:!0,focusToken:this.state.focusToken+1})}setUrl(e){e!==this.state.url&&this.retireImport(),this.update({url:e,...this.state.message?.kind===`error`?{message:null}:{}})}retireForConfigMutation(e){this.state.busy&&(this.retireImport(),this.update({message:{kind:`error`,text:e}}))}async import(e){let t=this.blockedReason(e.config);if(t){this.update({expanded:!0,message:{kind:`error`,text:e.messages.blocked(t)}});return}let n=this.beginImport(),r=this.state.url;this.update({expanded:!0,busy:!0,message:null});try{let t=await e.load(r);if(!this.ownsImport(n))return;e.apply(t,!e.hasCustomTheme&&this.mayActivate(n)),this.update({url:``,message:{kind:`success`,text:e.messages.imported(t.label)}})}catch(e){if(!this.ownsImport(n))return;this.update({message:{kind:`error`,text:x(e)}})}finally{this.ownsImport(n)&&this.update({busy:!1})}}clear(e){this.retireImport(),e.apply(),this.update({expanded:!0,message:{kind:`success`,text:e.message}})}retireImport(){this.requestRevision+=1,this.state.busy&&this.update({busy:!1})}beginImport(){return this.requestRevision+=1,{requestRevision:this.requestRevision,activationRevision:this.activationIntent.revision}}ownsImport(e){return e.requestRevision===this.requestRevision}mayActivate(e){return e.activationRevision===this.activationIntent.revision||this.activationIntent.theme===`custom`}blockedReason(e){return e.connected&&(e.configLoading||!e.configSnapshot)?`loading`:e.configFormDirty||e.configSaving||e.configApplying||e.configAutoSaveStatus===`saving`?`unsaved`:null}update(e){this.state={...this.state,...e},this.publish(this.state)}selectionForScope(e,t){return t?.scope===e?t:null}}})))()}function Er(e){let t=e.split(`/`).filter(Boolean),n=t.at(-1);return n&&(t.length===2&&t[0]===`themes`||t.length===3&&t[0]===`r`&&t[1]===`themes`)?(yt(n),n):null}function Dr(e){let t=s(e);if(!t)throw Error(`Paste a tweakcn theme link to import.`);let n=t.replace(/[.,;:]+$/,``);return lt.test(n)?`https://tweakcn.com/themes/${n}`:n.startsWith(`/themes/`)||n.startsWith(`/r/themes/`)?`https://tweakcn.com${n}`:/^(?:www\.)?tweakcn\.com\//i.test(n)?`https://${n}`:n.match(/https?:\/\/(?:www\.)?tweakcn\.com\/[^\s<>"')]+/i)?.[0]?.replace(/[.,;:]+$/,``)??n}function Or(e){let t=Er(e.pathname);if(t)return t;let n=e.searchParams.get(`theme`)??e.searchParams.get(`themeId`)??e.searchParams.get(`id`);if(n)return yt(n),n;throw Error(`Unsupported tweakcn link. Expected a theme share URL.`)}function kr(e,t){let n=We(e,t),r=n.toLowerCase();if(Hr.has(r)||Wr.test(n)||Ur.test(n))return n;throw Error(`Unsupported tweakcn token: ${t}`)}function Ar(e,t){return t===`font-sans`||t===`font-mono`?gt(e,t):kr(e,t)}function W(e,t,n,r){let i=s(e[n]);if(i)return Ar(i,n);let a=s(t?.[n]);if(a)return Ar(a,n);if(r!=null)return n===`font-sans`||n===`font-mono`?gt(r,n):We(r,n);throw Error(`tweakcn theme is missing required token: ${n}`)}function jr(e,t,n){let r=e===`light`,i=r?`black`:`white`,a=W(t,n,`background`),o=W(t,n,`foreground`),s=W(t,n,`card`),c=W(t,n,`card-foreground`),l=W(t,n,`popover`),u=W(t,n,`popover-foreground`),d=W(t,n,`primary`),f=W(t,n,`primary-foreground`),p=W(t,n,`secondary`),m=W(t,n,`secondary-foreground`),ee=W(t,n,`muted`),h=W(t,n,`muted-foreground`),g=W(t,n,`accent`),te=W(t,n,`accent-foreground`),_=W(t,n,`destructive`),v=W(t,n,`destructive-foreground`),y=W(t,n,`border`),ne=W(t,n,`input`),re=W(t,n,`ring`),ie=W(t,n,`font-sans`,Br),ae=W(t,n,`font-mono`,Vr);return Xe([[`bg`,a],[`bg-accent`,`color-mix(in srgb, var(--bg) 88%, var(--card) 12%)`],[`bg-elevated`,s],[`bg-hover`,`color-mix(in srgb, var(--muted) 68%, var(--bg) 32%)`],[`bg-muted`,ee],[`bg-content`,`color-mix(in srgb, var(--bg) 92%, var(--card) 8%)`],[`card`,s],[`card-foreground`,c],[`card-highlight`,`color-mix(in srgb, var(--text) ${r?`3`:`5`}%, transparent)`],[`popover`,l],[`popover-foreground`,u],[`panel`,a],[`panel-strong`,s],[`panel-hover`,`color-mix(in srgb, var(--card) 76%, var(--muted) 24%)`],[`chrome`,`color-mix(in srgb, var(--bg) 96%, transparent)`],[`chrome-strong`,`color-mix(in srgb, var(--bg) 98%, transparent)`],[`text`,o],[`text-strong`,o],[`chat-text`,o],[`muted`,h],[`muted-strong`,`color-mix(in srgb, var(--muted) 84%, var(--text) 16%)`],[`muted-foreground`,h],[`border`,y],[`border-strong`,`color-mix(in srgb, var(--border) 72%, var(--text) 28%)`],[`border-hover`,`color-mix(in srgb, var(--border) 55%, var(--text) 45%)`],[`input`,ne],[`ring`,re],[`accent`,g],[`accent-hover`,`color-mix(in srgb, var(--accent) 82%, ${i} 18%)`],[`accent-muted`,g],[`accent-subtle`,`color-mix(in srgb, var(--accent) ${r?`10`:`16`}%, transparent)`],[`accent-foreground`,te],[`accent-glow`,`color-mix(in srgb, var(--accent) ${r?`18`:`30`}%, transparent)`],[`primary`,d],[`primary-foreground`,f],[`secondary`,p],[`secondary-foreground`,m],[`accent-2`,d],[`accent-2-muted`,`color-mix(in srgb, var(--accent-2) 72%, transparent)`],[`accent-2-subtle`,`color-mix(in srgb, var(--accent-2) ${r?`8`:`12`}%, transparent)`],[`destructive`,_],[`destructive-foreground`,v],[`danger`,_],[`danger-muted`,`color-mix(in srgb, var(--danger) 75%, transparent)`],[`danger-subtle`,`color-mix(in srgb, var(--danger) ${r?`8`:`12`}%, transparent)`],[`focus`,`color-mix(in srgb, var(--ring) ${r?`14`:`22`}%, transparent)`],[`focus-ring`,`0 0 0 2px var(--bg), 0 0 0 3px color-mix(in srgb, var(--ring) ${r?`70`:`80`}%, transparent)`],[`focus-glow`,`0 0 0 2px var(--bg), 0 0 0 3px var(--ring), 0 0 16px var(--accent-glow)`],[`font-body`,ie],[`font-display`,ie],[`mono`,ae],[`grid-line`,`color-mix(in srgb, var(--text) ${r?`4`:`3`}%, transparent)`]])}function Mr(e){let t=Dr(e),n;try{n=new URL(t)}catch{throw Error(`Paste a full tweakcn URL.`)}if(!Lr.has(n.hostname))throw Error(`Only tweakcn.com theme links are supported.`);let r=Or(n);return{themeId:r,sourceUrl:`https://tweakcn.com/themes/${r}`,fetchUrl:`https://tweakcn.com/r/themes/${r}`}}function Nr(e,t){let n=i(e),r=i(n?.cssVars),a=i(r?.light),o=i(r?.dark),c=r?.theme===void 0?void 0:i(r.theme);if(!n||!r||!a||!o||c===null)throw Error(`tweakcn returned an invalid theme payload.`);return{sourceUrl:t.sourceUrl,themeId:t.themeId,label:it(s(n.name)),importedAt:new Date().toISOString(),light:jr(`light`,a,c),dark:jr(`dark`,o,c)}}function Pr(e){if(!e)return;let t;try{t=new URL(e)}catch{throw Error(`Unexpected tweakcn import response URL.`)}if(t.protocol!==`https:`||!Lr.has(t.hostname))throw Error(`Unexpected redirect during tweakcn import.`)}async function Fr(e){let t=await nn(e,{maxBytes:Rr,tooLargeMessage:`tweakcn theme payload is too large.`,missingBodyMessage:`tweakcn returned an unreadable theme payload.`});try{return JSON.parse(t)}catch{throw Error(`tweakcn returned invalid JSON.`)}}async function Ir(e,t=fetch){let n=Mr(e),r=new AbortController,i=setTimeout(()=>r.abort(),zr);try{let e=await t(n.fetchUrl,{headers:{accept:`application/json`},redirect:`error`,signal:r.signal});if(Pr(e.url),!e.ok)throw Error(`tweakcn import failed (${e.status}).`);return Nr(await Fr(e),n)}catch(e){throw r.signal.aborted?Error(`tweakcn import timed out.`,{cause:e}):e}finally{clearTimeout(i)}}var Lr,Rr,zr,Br,Vr,Hr,Ur,Wr;function Gr(){return(Gr=e((()=>{Qe(),Lr=new Set([`tweakcn.com`,`www.tweakcn.com`]),Rr=2e5,zr=1e4,Br=`"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`,Vr=`"JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace`,Hr=new Set([`black`,`white`,`transparent`,`currentcolor`]),Ur=/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([a-z0-9+\-.,/%\s]+\)$/i,Wr=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i})))()}function Kr(e){return/^[A-Za-z0-9._:/-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`}function qr(e){switch(e){case`verify-off`:return F(`mcpPage.tlsVerifyOff`);case`mtls`:return F(`mcpPage.mtls`);default:return null}}var G;function Jr(){return(Jr=e((()=>{jt(),O(),we(),rt(),Ne(),M(),ge(),xn(),w(),C(),be(),P(),ln(),V(),G=class extends b{constructor(...e){super(...e),this.pluginsHref=``,this.docsUrl=`https://docs.openclaw.ai/tools/mcp`,this.rows=null,this.busy=!1,this.message=null,this.formOpen=!1,this.subscriptions=new _e(this).effect(()=>this.context?.runtimeConfig,e=>(this.syncRows(),e.ensureLoaded().then(()=>this.syncRows()).catch(e=>{this.message={kind:`error`,text:x(e)}}),e.subscribe(()=>this.syncRows()))).effect(()=>this.context?.gateway,e=>e.subscribe(()=>this.requestUpdate()))}disconnectedCallback(){this.subscriptions.clear(),super.disconnectedCallback()}syncRows(){let e=this.context?.runtimeConfig.state.configSnapshot;this.rows=wn(se(e))}mutationBlockedReason(){let e=this.context?.gateway;return e?.snapshot.phase===`connected`?ze(e.snapshot.hello?.auth??null)?null:F(`mcpServers.adminRequired`):F(`mcpServers.connectRequired`)}canMutate(){return this.context!==void 0&&this.mutationBlockedReason()===null}async mutate(e){if(!this.context||!this.canMutate()||this.busy)return!1;this.busy=!0,this.message=null;let t=await hn(this.context.runtimeConfig,e);return this.busy=!1,t.ok?(this.syncRows(),this.message={kind:`success`,text:e.successText},!0):(this.message={kind:`error`,text:t.error},!1)}async addServer(e){let t=e.name.trim();if(!yn.test(t)){this.message={kind:`error`,text:F(`mcpServers.nameInvalid`)};return}let n=cn(e.target,e.transport);if(!n){this.message={kind:`error`,text:F(`mcpServers.targetInvalid`)};return}await this.mutate({buildPatch:e=>pn(e,t,n),note:`mcp settings: add server ${t}`,successText:F(`mcpServers.addedSuccess`,{name:t})})&&(this.formOpen=!1)}async toggleServer(e,t){await this.mutate({buildPatch:n=>_n(n,e,t),note:`mcp settings: ${t?`enable`:`disable`} server ${e}`,successText:F(t?`mcpServers.enabledSuccess`:`mcpServers.disabledSuccess`,{name:e})})}async removeServer(e){await this.mutate({buildPatch:t=>on(t,e),note:`mcp settings: remove server ${e}`,successText:F(`mcpServers.removedSuccess`,{name:e})})}renderRow(e){let t=`openclaw mcp ${e.auth===`oauth`?`login`:`probe`} ${Kr(e.name)}`,n=[e.transport,e.auth,e.toolFilter?F(`mcpPage.toolFilter`):null,e.parallel?F(`mcpPage.parallel`):null,qr(e.tls)].filter(e=>!!e),r=this.mutationBlockedReason(),i=this.busy||!this.canMutate();return D`
|
|
<div class="settings-row mcp-server-row" data-mcp-name=${e.name}>
|
|
<div class="settings-row__text">
|
|
<span class="settings-row__title">${e.name}</span>
|
|
<span class="settings-row__desc mcp-server-row__launch">
|
|
${e.target||F(`mcpServers.missingTransport`)}
|
|
</span>
|
|
<span class="settings-row__desc">${n.join(` · `)}</span>
|
|
</div>
|
|
<div class="settings-row__control">
|
|
${R({kind:e.enabled?`ok`:`muted`,label:e.enabled?F(`common.enabled`):F(`common.disabled`)})}
|
|
<code>${t}</code>
|
|
<button
|
|
type="button"
|
|
class="btn btn--sm"
|
|
title=${r??``}
|
|
?disabled=${i}
|
|
@click=${()=>void this.toggleServer(e.name,!e.enabled)}
|
|
>
|
|
${this.busy?F(`mcpServers.working`):e.enabled?F(`mcpServers.disable`):F(`mcpServers.enable`)}
|
|
</button>
|
|
<button
|
|
type="button"
|
|
class="btn btn--sm btn--icon mcp-server-remove"
|
|
aria-label=${F(`mcpServers.removeNamed`,{name:e.name})}
|
|
title=${r??F(`mcpServers.removeNamed`,{name:e.name})}
|
|
?disabled=${i}
|
|
@click=${()=>void this.removeServer(e.name)}
|
|
>
|
|
${N.trash}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
`}render(){let e=this.mutationBlockedReason(),t=this.rows,n=t?t.length===0?Cn(D`
|
|
${F(`mcpPage.noServers`)} ${bn(this.docsUrl,F(`mcpPage.setUpFirstServer`))}
|
|
`):t.map(e=>this.renderRow(e)):D`<div class="mcp-server-loading" role="status">${F(`common.loading`)}</div>`;return D`
|
|
<div class="mcp-server-list">
|
|
${H({title:F(`mcpPage.configuredServers`),description:D`
|
|
${F(`mcpPage.runtimeHint`)} ${sn(this.pluginsHref)}
|
|
`,actions:D`
|
|
<button
|
|
type="button"
|
|
class="btn btn--sm"
|
|
title=${e??``}
|
|
?disabled=${this.busy||!this.canMutate()}
|
|
@click=${()=>{this.formOpen=!this.formOpen,this.formOpen&&(this.message=null)}}
|
|
>
|
|
<span aria-hidden="true">${N.plus}</span>
|
|
${F(`mcpServers.add`)}
|
|
</button>
|
|
`},D`
|
|
${this.formOpen?dn({busy:this.busy,disabled:!this.canMutate(),blockedReason:e,onSubmit:e=>void this.addServer(e),onCancel:()=>{this.formOpen=!1}}):E}
|
|
${this.message?D`<div
|
|
class="mcp-server-message mcp-server-message--${this.message.kind}"
|
|
role=${this.message.kind===`error`?`alert`:`status`}
|
|
>
|
|
${this.message.text}
|
|
</div>`:E}
|
|
${n}
|
|
`)}
|
|
</div>
|
|
`}},o([kt({context:ct,subscribe:!0})],G.prototype,`context`,void 0),o([k()],G.prototype,`pluginsHref`,void 0),o([k()],G.prototype,`docsUrl`,void 0),o([A()],G.prototype,`rows`,void 0),o([A()],G.prototype,`busy`,void 0),o([A()],G.prototype,`message`,void 0),o([A()],G.prototype,`formOpen`,void 0),customElements.get(`openclaw-mcp-servers-card`)||customElements.define(`openclaw-mcp-servers-card`,G)})))()}function Yr(e){let t=wn(e.configObject)??[],n=t.filter(e=>e.enabled).length,r=t.filter(e=>e.auth===`oauth`).length,i=t.filter(e=>e.toolFilter).length;return D`
|
|
<section class="mcp-page">
|
|
<div class="settings-page">
|
|
<section class="settings-section mcp-page__summary">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`mcpPage.servers`)}</h2>
|
|
</div>
|
|
<div class="settings-group">
|
|
${z({title:F(`mcpPage.servers`),control:I(t.length)})}
|
|
${z({title:F(`common.enabled`),control:I(n)})}
|
|
${z({title:F(`mcpPage.oauth`),control:I(r)})}
|
|
${z({title:F(`mcpPage.filtered`),control:I(i)})}
|
|
</div>
|
|
</section>
|
|
|
|
<section class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`mcpPage.operatorCommands`)}</h2>
|
|
</div>
|
|
<p class="settings-section__desc">${F(`mcpPage.operatorCommandsHint`)}</p>
|
|
<div class="settings-group">
|
|
<div class="settings-row settings-row--stacked">
|
|
<div class="mcp-command-card__grid">
|
|
<code>openclaw mcp status --verbose</code>
|
|
<code>openclaw mcp doctor --probe</code>
|
|
<code>openclaw mcp login <name></code>
|
|
<code>openclaw mcp reload</code>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<openclaw-mcp-servers-card
|
|
.pluginsHref=${e.pluginsHref}
|
|
.docsUrl=${Xr}
|
|
></openclaw-mcp-servers-card>
|
|
</div>
|
|
|
|
${e.editor}
|
|
</section>
|
|
`}var Xr;function Zr(){return(Zr=e((()=>{O(),Jr(),V(),M(),xn(),Xr=`https://docs.openclaw.ai/tools/mcp`})))()}var Qr;function $r(){return($r=e((()=>{O(),we(),C(),sr(),Qr=class extends b{constructor(...e){super(...e),this.agentId=null}render(){return D`
|
|
${this.agentId?D`<openclaw-agent-memory-panel .agentId=${this.agentId}></openclaw-agent-memory-panel>`:E}
|
|
`}},o([k()],Qr.prototype,`agentId`,void 0),customElements.get(`openclaw-memory-dreaming`)||customElements.define(`openclaw-memory-dreaming`,Qr)})))()}function ei(e,t){return`${t}:${e.path}:${e.startLine}:${e.endLine}`}function ti(e){let t=e.path.replaceAll(`\\`,`/`),n=!t.startsWith(`/`)&&!t.startsWith(`sessions/`)&&!/^[a-zA-Z]:\//.test(t)&&t.split(`/`).every(e=>e&&e!==`.`&&e!==`..`),r=t===`MEMORY.md`||t.startsWith(`memory/`);return e.source===`memory`&&n&&r}function ni(e,t){let n=e.split(/\r?\n/),r=Math.max(0,t.startLine-1),i=Math.min(n.length,t.endLine),a=n.slice(0,r),o=n.slice(r,i),s=n.slice(i);return D`<pre class="memory-memories__file" tabindex="0"><span
|
|
>${a.join(`
|
|
`)}${a.length?`
|
|
`:``}</span
|
|
><mark data-memory-match="true">${o.join(`
|
|
`)}</mark
|
|
><span>${s.length?`\n${s.join(`
|
|
`)}`:``}</span></pre>`}var K;function ri(){return(ri=e((()=>{O(),we(),M(),w(),C(),K=class extends b{constructor(...e){super(...e),this.client=null,this.connected=!1,this.methodAdvertised=!0,this.agentId=null,this.query=``,this.searchState={kind:`idle`},this.openResultKey=null,this.details=new Map,this.searchRequest=null,this.detailRequests=new Map}updated(e){(e.has(`agentId`)||e.has(`client`)||e.has(`connected`)||e.has(`methodAdvertised`))&&this.resetSearch()}resetSearch(){this.searchRequest=null,this.detailRequests.clear(),this.query=``,this.searchState={kind:`idle`},this.openResultKey=null,this.details=new Map}async search(e){let t=e.trim(),n=this.connected?this.client:null,r=this.agentId;if(!t||!n||!r||!this.methodAdvertised)return;let i={client:n,agentId:r,query:t};this.searchRequest=i,this.query=t,this.searchState={kind:`loading`,query:t},this.openResultKey=null,this.details=new Map,this.detailRequests.clear();try{let e=await n.request(`memory.search`,{query:t,agentId:r});if(this.searchRequest!==i||this.agentId!==r||this.client!==n)return;this.searchState={kind:`ready`,query:t,...e}}catch(e){if(this.searchRequest!==i||this.agentId!==r||this.client!==n)return;this.searchState={kind:`error`,query:t,message:x(e)}}}toggleResult(e,t){let n=ei(e,t);if(this.openResultKey===n){this.openResultKey=null;return}this.openResultKey=n,this.details.has(n)||this.loadDetail(n,e)}async loadDetail(e,t){let n=this.connected?this.client:null,r=this.agentId;if(!n||!r)return;let i={client:n,agentId:r,path:t.path};this.detailRequests.set(e,i),this.details=new Map(this.details).set(e,{kind:`loading`});try{let a=await n.request(`agents.workspace.get`,{agentId:r,path:t.path});if(this.detailRequests.get(e)!==i||this.agentId!==r)return;let o=a.file.encoding===`utf8`?{kind:`ready`,content:a.file.content}:{kind:`error`,message:F(`memoryPage.memories.fileUnsupported`)};this.details=new Map(this.details).set(e,o)}catch(t){if(this.detailRequests.get(e)!==i||this.agentId!==r)return;this.details=new Map(this.details).set(e,{kind:`error`,message:x(t)})}finally{this.detailRequests.get(e)===i&&this.detailRequests.delete(e)}}renderDetail(e,t,n){if(this.openResultKey!==e)return E;let r=this.details.get(e);return D`<div id=${t} class="memory-memories__detail">
|
|
${!r||r.kind===`loading`?D`<p role="status">${F(`memoryPage.memories.fileLoading`)}</p>`:r.kind===`error`?D`<p class="memory-memories__detail-error" role="alert">
|
|
${F(`memoryPage.memories.fileError`,{message:r.message})}
|
|
</p>`:ni(r.content,n)}
|
|
</div>`}renderResults(e){let t=e.searchMode===`hybrid`?F(`memoryPage.memories.hybridSearch`):F(`memoryPage.memories.keywordSearch`);return D`
|
|
<div class="memory-memories__results-heading">
|
|
<span>${F(`memoryPage.memories.results`,{count:String(e.results.length)})}</span>
|
|
<span class="memory-memories__mode">${t}</span>
|
|
</div>
|
|
${e.results.length===0?D`<p class="memory-memories__state">
|
|
${F(`memoryPage.memories.empty`,{query:e.query})}
|
|
</p>`:D`<div class="settings-group memory-memories__results">
|
|
${e.results.map((e,t)=>{let n=ei(e,t),r=this.openResultKey===n,i=ti(e),a=`memory-detail-${t}`,o=D`
|
|
<span class="settings-row__text">
|
|
<span class="settings-row__title">${e.snippet}</span>
|
|
<span class="settings-row__desc memory-memories__path"
|
|
>${e.path} ·
|
|
${F(`memoryPage.memories.lineRange`,{start:String(e.startLine),end:String(e.endLine)})}</span
|
|
>
|
|
</span>
|
|
<span class="settings-row__control memory-memories__meta">
|
|
<span class="memory-memories__source"
|
|
>${F(e.source===`sessions`?`memoryPage.memories.sourceSessions`:`memoryPage.memories.sourceMemory`)}</span
|
|
>
|
|
<span
|
|
>${F(`memoryPage.memories.score`,{score:e.score.toFixed(2)})}</span
|
|
>
|
|
</span>
|
|
`;return D`<article class="memory-memories__result">
|
|
${i?D`<button
|
|
type="button"
|
|
class="settings-row settings-row--nav"
|
|
aria-expanded=${String(r)}
|
|
aria-controls=${a}
|
|
@click=${()=>this.toggleResult(e,t)}
|
|
>
|
|
${o}
|
|
</button>`:D`<div class="settings-row">${o}</div>`}
|
|
${i?this.renderDetail(n,a,e):E}
|
|
</article>`})}
|
|
</div>`}
|
|
`}renderSearchState(){switch(this.searchState.kind){case`loading`:return D`<p class="memory-memories__state" role="status">
|
|
${F(`memoryPage.memories.searching`)}
|
|
</p>`;case`error`:{let e=this.searchState;return D`<div class="memory-memories__state" role="alert">
|
|
<p>${F(`memoryPage.memories.error`,{message:e.message})}</p>
|
|
<button class="btn btn--sm" @click=${()=>void this.search(e.query)}>
|
|
${F(`memoryPage.memories.retry`)}
|
|
</button>
|
|
</div>`}case`ready`:return this.renderResults(this.searchState);default:return D`<p class="memory-memories__state">${F(`memoryPage.memories.idle`)}</p>`}}render(){return D`<div class="settings-page memory-memories">
|
|
${this.methodAdvertised?D`<form
|
|
class="memory-memories__search"
|
|
role="search"
|
|
@submit=${e=>{e.preventDefault(),this.search(this.query)}}
|
|
>
|
|
<label class="settings-control__sr-label" for="memory-search-input"
|
|
>${F(`memoryPage.memories.searchLabel`)}</label
|
|
>
|
|
<input
|
|
id="memory-search-input"
|
|
type="search"
|
|
class="settings-input"
|
|
.value=${this.query}
|
|
placeholder=${F(`memoryPage.memories.searchPlaceholder`)}
|
|
@input=${e=>{this.query=e.currentTarget.value}}
|
|
/>
|
|
<button
|
|
class="btn btn--sm primary"
|
|
type="submit"
|
|
?disabled=${!this.connected||!this.agentId||!this.query.trim()||this.searchState.kind===`loading`}
|
|
>
|
|
${F(`memoryPage.memories.searchButton`)}
|
|
</button>
|
|
</form>
|
|
${this.renderSearchState()}`:D`<p class="memory-memories__unavailable">
|
|
${F(`memoryPage.memories.gatewayUpdateRequired`)}
|
|
</p>`}
|
|
</div>`}},o([k({attribute:!1})],K.prototype,`client`,void 0),o([k({type:Boolean})],K.prototype,`connected`,void 0),o([k({type:Boolean})],K.prototype,`methodAdvertised`,void 0),o([k()],K.prototype,`agentId`,void 0),o([A()],K.prototype,`query`,void 0),o([A()],K.prototype,`searchState`,void 0),o([A()],K.prototype,`openResultKey`,void 0),o([A()],K.prototype,`details`,void 0),customElements.get(`openclaw-memory-memories`)||customElements.define(`openclaw-memory-memories`,K)})))()}function ii(e,t){return[`plugins`,`entries`,e,`config`,`dreaming`,...t]}function ai(e){let t=i(e?.agents),n=i(t?.defaults)?.userTimezone;return typeof n==`string`&&n.trim()?n.trim():null}function oi(){return(oi=e((()=>{})))()}function si(e,t){let n=e;for(let[e,r]of t.entries()){if(!n)return;let a=n[r];if(e===t.length-1)return a;n=i(a)}}function ci(e,t){let n=e;for(let[e,r]of t.entries()){if(!n||!Object.hasOwn(n,r))return!1;if(e===t.length-1)return!0;n=i(n[r])}return!1}function li(e){return yi.find(t=>t===e)??bi}function ui(e){let t=si(e,[`execution`,`defaults`,`model`]);return typeof t==`string`&&t.trim()?t.trim():F(`memoryPage.dreaming.model.default`)}function di(e,t){let n=Number(e);return!Number.isFinite(n)||n<t.min||t.integer&&!Number.isInteger(n)||t.max!==void 0&&n>t.max?null:n}function fi(e,t){let n=si(e.dreaming,t.path),r=ci(e.dreaming,t.path),i=t.kind===`toggle`?t.fallback?F(`common.enabled`):F(`common.disabled`):t.kind===`number`?String(t.defaultValue):t.path[0]===`timezone`?e.timezoneDefault??F(`memoryPage.dreaming.timezone.default`):t.path[0]===`model`?ui(e.dreaming):t.defaultValue?t.defaultValue:t.defaultLabelKey?F(t.defaultLabelKey):``,a=B(i,r);if(t.kind===`toggle`)return L({title:F(t.labelKey),description:D`${F(t.helpKey)} ${a}`,checked:typeof n==`boolean`?n:t.fallback,disabled:e.disabled,onChange:n=>e.onPatch(t.path,n)});let o=t.kind===`number`?typeof n==`number`?String(n):``:typeof n==`string`?n:``,s=t.kind===`number`?t.bounds:null;if(t.kind===`text`&&t.path[0]===`model`){let n=Ut(i);return z({title:F(t.labelKey),description:D`${F(t.helpKey)} ${a}`,control:cr({label:F(t.labelKey),value:o,options:[{value:``,label:i,...n?{provider:n}:{}}],disabled:e.disabled,custom:{label:F(`cron.form.customModel`),placeholder:t.placeholderKey?F(t.placeholderKey):``,commit:`change`},onChange:n=>e.onPatch(t.path,n.trim()||void 0)})})}return z({title:F(t.labelKey),description:D`${F(t.helpKey)} ${a}`,control:D`
|
|
<input
|
|
class="settings-input"
|
|
type=${t.kind===`number`?`number`:`text`}
|
|
min=${s?String(s.min):E}
|
|
max=${s?.max===void 0?E:String(s.max)}
|
|
step=${s?s.integer?`1`:`any`:E}
|
|
spellcheck="false"
|
|
aria-label=${F(t.labelKey)}
|
|
?disabled=${e.disabled}
|
|
.value=${o}
|
|
placeholder=${i}
|
|
@change=${n=>{let r=n.currentTarget,i=r.value.trim();if(!i){e.onPatch(t.path,void 0);return}if(s){let n=di(i,s);if(n===null){r.value=o;return}e.onPatch(t.path,n);return}e.onPatch(t.path,i)}}
|
|
/>
|
|
`})}function pi(e){let t=li(si(e.dreaming,[`storage`,`mode`])),n=B(F(`memoryPage.dreaming.storage.modes.separate`),ci(e.dreaming,[`storage`,`mode`]));return D`
|
|
${H({title:F(`memoryPage.dreaming.schedule.title`),description:F(`memoryPage.dreaming.schedule.description`)},_i.map(t=>fi(e,t)))}
|
|
${H({title:F(`memoryPage.dreaming.storage.title`),description:F(`memoryPage.dreaming.storage.description`)},D`
|
|
${z({title:F(`memoryPage.dreaming.storage.modeLabel`),description:D`
|
|
${F(`memoryPage.dreaming.storage.modeHelp`)} ${n}
|
|
`,stacked:!0,control:Dn({value:t,options:yi.map(e=>({value:e,label:F(`memoryPage.dreaming.storage.modes.${e}`)})),ariaLabel:F(`memoryPage.dreaming.storage.modeLabel`),disabled:e.disabled,onChange:t=>e.onPatch([`storage`,`mode`],t)})})}
|
|
${fi(e,{kind:`toggle`,path:[`storage`,`separateReports`],labelKey:`memoryPage.dreaming.storage.separateReportsLabel`,helpKey:`memoryPage.dreaming.storage.separateReportsHelp`,fallback:!1})}
|
|
`)}
|
|
${vi.map(t=>H({title:F(t.titleKey),description:F(t.descriptionKey)},t.fields.map(t=>fi(e,t))))}
|
|
`}function mi(e){return H({title:F(`memoryPage.dreaming.unsupported.title`)},z({title:F(`memoryPage.dreaming.unsupported.rowTitle`),description:F(`memoryPage.dreaming.unsupported.description`,{plugin:e})}))}var q,hi,gi,_i,vi,yi,bi;function xi(){return(xi=e((()=>{O(),lr(),Wt(),V(),M(),q={integer:!0,min:0},hi={integer:!0,min:1},gi={integer:!1,min:0,max:1},_i=[{kind:`text`,path:[`frequency`],labelKey:`memoryPage.dreaming.frequency.label`,helpKey:`memoryPage.dreaming.frequency.help`,placeholderKey:`memoryPage.dreaming.frequency.placeholder`,defaultValue:`0 3 * * *`},{kind:`text`,path:[`timezone`],labelKey:`memoryPage.dreaming.timezone.label`,helpKey:`memoryPage.dreaming.timezone.help`,placeholderKey:`memoryPage.dreaming.timezone.placeholder`},{kind:`text`,path:[`model`],labelKey:`memoryPage.dreaming.model.label`,helpKey:`memoryPage.dreaming.model.help`,placeholderKey:`memoryPage.dreaming.model.placeholder`,defaultLabelKey:`memoryPage.dreaming.model.default`},{kind:`toggle`,path:[`verboseLogging`],labelKey:`memoryPage.dreaming.verboseLogging.label`,helpKey:`memoryPage.dreaming.verboseLogging.help`,fallback:!1}],vi=[{titleKey:`memoryPage.dreaming.phases.light.title`,descriptionKey:`memoryPage.dreaming.phases.light.description`,fields:[{kind:`toggle`,path:[`phases`,`light`,`enabled`],labelKey:`memoryPage.dreaming.phaseFields.enabled`,helpKey:`memoryPage.dreaming.phaseFields.enabledHelp`,fallback:!0},{kind:`number`,path:[`phases`,`light`,`lookbackDays`],labelKey:`memoryPage.dreaming.phaseFields.lookbackDays`,helpKey:`memoryPage.dreaming.phaseFields.lookbackDaysHelp`,bounds:q,defaultValue:2},{kind:`number`,path:[`phases`,`light`,`limit`],labelKey:`memoryPage.dreaming.phaseFields.limit`,helpKey:`memoryPage.dreaming.phaseFields.limitHelp`,bounds:q,defaultValue:100},{kind:`number`,path:[`phases`,`light`,`dedupeSimilarity`],labelKey:`memoryPage.dreaming.phaseFields.dedupeSimilarity`,helpKey:`memoryPage.dreaming.phaseFields.dedupeSimilarityHelp`,bounds:gi,defaultValue:.9}]},{titleKey:`memoryPage.dreaming.phases.deep.title`,descriptionKey:`memoryPage.dreaming.phases.deep.description`,fields:[{kind:`toggle`,path:[`phases`,`deep`,`enabled`],labelKey:`memoryPage.dreaming.phaseFields.enabled`,helpKey:`memoryPage.dreaming.phaseFields.enabledHelp`,fallback:!0},{kind:`number`,path:[`phases`,`deep`,`limit`],labelKey:`memoryPage.dreaming.phaseFields.limit`,helpKey:`memoryPage.dreaming.phaseFields.limitHelp`,bounds:q,defaultValue:10},{kind:`number`,path:[`phases`,`deep`,`minScore`],labelKey:`memoryPage.dreaming.phaseFields.minScore`,helpKey:`memoryPage.dreaming.phaseFields.minScoreHelp`,bounds:gi,defaultValue:.75},{kind:`number`,path:[`phases`,`deep`,`minRecallCount`],labelKey:`memoryPage.dreaming.phaseFields.minRecallCount`,helpKey:`memoryPage.dreaming.phaseFields.minRecallCountHelp`,bounds:q,defaultValue:3},{kind:`number`,path:[`phases`,`deep`,`minUniqueQueries`],labelKey:`memoryPage.dreaming.phaseFields.minUniqueQueries`,helpKey:`memoryPage.dreaming.phaseFields.minUniqueQueriesHelp`,bounds:q,defaultValue:3},{kind:`number`,path:[`phases`,`deep`,`recencyHalfLifeDays`],labelKey:`memoryPage.dreaming.phaseFields.recencyHalfLifeDays`,helpKey:`memoryPage.dreaming.phaseFields.recencyHalfLifeDaysHelp`,bounds:q,defaultValue:14},{kind:`number`,path:[`phases`,`deep`,`maxAgeDays`],labelKey:`memoryPage.dreaming.phaseFields.maxAgeDays`,helpKey:`memoryPage.dreaming.phaseFields.maxAgeDaysHelp`,bounds:hi,defaultValue:30},{kind:`number`,path:[`phases`,`deep`,`maxPromotedSnippetTokens`],labelKey:`memoryPage.dreaming.phaseFields.maxPromotedSnippetTokens`,helpKey:`memoryPage.dreaming.phaseFields.maxPromotedSnippetTokensHelp`,bounds:hi,defaultValue:160}]},{titleKey:`memoryPage.dreaming.phases.rem.title`,descriptionKey:`memoryPage.dreaming.phases.rem.description`,fields:[{kind:`toggle`,path:[`phases`,`rem`,`enabled`],labelKey:`memoryPage.dreaming.phaseFields.enabled`,helpKey:`memoryPage.dreaming.phaseFields.enabledHelp`,fallback:!0},{kind:`number`,path:[`phases`,`rem`,`lookbackDays`],labelKey:`memoryPage.dreaming.phaseFields.lookbackDays`,helpKey:`memoryPage.dreaming.phaseFields.lookbackDaysHelp`,bounds:q,defaultValue:7},{kind:`number`,path:[`phases`,`rem`,`limit`],labelKey:`memoryPage.dreaming.phaseFields.limit`,helpKey:`memoryPage.dreaming.phaseFields.limitHelp`,bounds:q,defaultValue:10},{kind:`number`,path:[`phases`,`rem`,`minPatternStrength`],labelKey:`memoryPage.dreaming.phaseFields.minPatternStrength`,helpKey:`memoryPage.dreaming.phaseFields.minPatternStrengthHelp`,bounds:gi,defaultValue:.75}]}],yi=[`inline`,`separate`,`both`],bi=`separate`})))()}function Si(e){return!e.embedding.ok&&e.embedding.checked!==!1}function Ci(e){return e.provider===`none`?F(`memoryPage.overview.hero.keywordSearch`):F(`memoryPage.overview.hero.hybridSearch`)}function wi(e){let t=U(e.engineSelection),n=e.engineSelection.kind===`off`||e.engineDisabled,r=e.status.kind===`ready`?e.status.payload:null,i=e.status.kind===`error`||r!==null&&Si(r),a=Kt(Lt(e.agentId??`memory`)),o=n?F(`memoryPage.overview.hero.hibernating`):e.status.kind===`loading`||e.status.kind===`idle`?F(`memoryPage.overview.hero.waking`):F(i?`memoryPage.overview.hero.needsAttention`:`memoryPage.overview.hero.awake`),s=n?F(e.engineDisabled?`memoryPage.overview.hero.disabledDescription`:`memoryPage.overview.hero.offDescription`):e.status.kind===`error`?e.status.message:r?Si(r)?r.embedding.error??F(`memoryPage.overview.health.unavailable`):F(`memoryPage.overview.hero.activeDescription`,{engine:t??F(`common.unknown`),mode:Ci(r)}):F(`memoryPage.overview.hero.loadingDescription`),c=n?{sleeping:!0}:i?{grumpy:!0,standalone:!0}:r?{reading:!0,standalone:!0}:{standalone:!0};return D`
|
|
<section class="memory-overview__hero ${n?`memory-overview__hero--sleeping`:``}">
|
|
<div class="memory-overview__lobster" style=${Yt(a)}>
|
|
${Bt(a,c)}
|
|
</div>
|
|
<div class="memory-overview__hero-copy">
|
|
<h2>${o}</h2>
|
|
<p class=${i?`memory-overview__hero-error`:``}>${s}</p>
|
|
<div class="memory-overview__hero-actions">
|
|
${n?D`<button class="btn btn--sm" @click=${()=>e.onNavigate(`settings`)}>
|
|
${F(`memoryPage.overview.hero.openSettings`)}
|
|
</button>`:D`<button class="btn btn--sm" @click=${e.onRefresh}>
|
|
${e.status.kind===`error`?F(`memoryPage.overview.hero.retry`):F(`memoryPage.overview.hero.refresh`)}
|
|
</button>`}
|
|
</div>
|
|
</div>
|
|
</section>
|
|
`}function Ti(e,t,n){return[e.cron||F(`common.na`),t,n&&e.nextRunAtMs?F(`memoryPage.overview.schedule.nextRun`,{time:ae(e.nextRunAtMs)}):null,e.lastRunAtMs?F(`memoryPage.overview.schedule.lastRun`,{time:ae(e.lastRunAtMs)}):null].filter(e=>!!e).join(` · `)}function Ei(e){let t=[[`light`,e.phases.light],[`rem`,e.phases.rem],[`deep`,e.phases.deep]];return H({title:F(`memoryPage.overview.schedule.title`)},D`
|
|
${t.map(([t,n])=>z({title:F(`memoryPage.dreaming.phases.${t}.title`),description:D`
|
|
${F(`memoryPage.overview.schedule.${t}Description`)}<br />
|
|
${Ti(n,e.timezone,e.enabled&&n.enabled&&n.managedCronPresent)}
|
|
`,control:R({kind:e.enabled&&n.enabled&&n.managedCronPresent?`ok`:`muted`,label:!e.enabled||!n.enabled?F(`common.disabled`):n.managedCronPresent?F(`common.enabled`):F(`memoryPage.overview.schedule.notScheduled`)})}))}
|
|
${z({title:F(`memoryPage.overview.schedule.learnMore`),control:D`<a
|
|
class="memory-page__link"
|
|
href="https://docs.openclaw.ai/concepts/dreaming"
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
>${F(`memoryPage.overview.schedule.openDocs`)}</a
|
|
>`})}
|
|
`)}function Di(e){let t=[[`promotedToday`,e.promotedToday],[`promotedTotal`,e.promotedTotal],[`shortTermCount`,e.shortTermCount],[`phaseHitCount`,e.phaseSignalCount],[`lightPhaseHitCount`,e.lightPhaseHitCount],[`remPhaseHitCount`,e.remPhaseHitCount]];return H({title:F(`memoryPage.overview.activity.title`)},t.map(([e,t])=>z({title:F(`memoryPage.overview.activity.${e}`),control:I(t)})))}function Oi(e,t){let n=e.embedding.checked===!1,r=e.embedding.ok?`ok`:n?`muted`:`danger`,i=t.probingEmbeddings?F(`memoryPage.overview.health.checking`):e.embedding.ok?F(`memoryPage.overview.health.healthy`):F(n?`memoryPage.overview.health.notChecked`:`memoryPage.overview.health.unavailable`);return H({title:F(`memoryPage.overview.health.title`)},D`
|
|
${z({title:F(`memoryPage.overview.health.provider`),control:I(e.provider??F(`common.unknown`),{mono:!0})})}
|
|
${z({title:F(`memoryPage.overview.health.embeddings`),description:e.embedding.ok?E:n?F(`memoryPage.overview.health.notCheckedDescription`):e.embedding.error,control:D`
|
|
${R({kind:r,label:i})}
|
|
${n?D`<button
|
|
type="button"
|
|
class="btn btn--sm"
|
|
?disabled=${t.probingEmbeddings}
|
|
@click=${t.onProbeEmbeddings}
|
|
>
|
|
${t.probingEmbeddings?F(`memoryPage.overview.health.testing`):F(`memoryPage.overview.health.test`)}
|
|
</button>`:E}
|
|
`})}
|
|
${e.embeddingRuntime?z({title:F(`memoryPage.overview.health.runtime`),description:e.embeddingRuntime.loadError,control:I([e.embeddingRuntime.engine,e.embeddingRuntime.backend,e.embeddingRuntime.buildInfo,e.embeddingRuntime.model?.id,e.embeddingRuntime.endpoints?Object.entries(e.embeddingRuntime.endpoints).map(([e,t])=>`${e}=${t}`).join(` `):void 0].filter(Boolean).join(` · `))}):E}
|
|
`)}function ki(e){return e.status.kind===`ready`?D`
|
|
${e.status.payload.dreaming?Ei(e.status.payload.dreaming):E}
|
|
${e.status.payload.dreaming?Di(e.status.payload.dreaming):E}
|
|
${Oi(e.status.payload,e)}
|
|
`:E}function Ai(e){return H({title:F(`memoryPage.overview.shortcuts.title`)},D`
|
|
${vn({title:F(`memoryPage.overview.shortcuts.memories`),onClick:()=>e.onNavigate(`memories`)})}
|
|
${vn({title:F(`memoryPage.overview.shortcuts.diary`),onClick:()=>e.onNavigate(`dreams`)})}
|
|
${vn({title:F(`memoryPage.overview.shortcuts.settings`),onClick:()=>e.onNavigate(`settings`)})}
|
|
`)}function ji(e){let t=e.engineSelection.kind!==`off`&&!e.engineDisabled;return D`
|
|
<div class="settings-page memory-overview">
|
|
${wi(e)} ${t?ki(e):E} ${Ai(e)}
|
|
</div>
|
|
`}function Mi(){return(Mi=e((()=>{O(),Qt(),qt(),V(),M(),ve(),qn()})))()}function Ni(e,t){if(e.kind!==`ready`)return[];let n=e.plugins.filter(e=>e.installed&&e.kind?.includes(`memory`)===!0).map(e=>({id:e.id,label:e.id===Yn?F(`memoryPage.engine.openClawMemory`):e.name,available:!0})).toSorted((e,t)=>{let n=e.id===Yn;return n===(t.id===Yn)?e.label.localeCompare(t.label):n?-1:1}),r=U(t);if(r&&!n.some(e=>e.id===r)){let e={id:r,label:r===Yn?F(`memoryPage.engine.openClawMemory`):r,available:!1};r===Yn?n.unshift(e):n.push(e)}return n}function Pi(e,t){return e.kind===`ready`?!t?.installed||t.state===`not-installed`||t.state===`error`?`unknown`:t.enabled?`enabled`:`disabled`:e.kind===`loading`?`loading`:`unknown`}function Fi(e,t){return e.kind===`ready`&&t?e.plugins.find(e=>e.id===t):void 0}function Ii(e,t){return Wi.map(n=>{let r=Fi(e,n.id);return{id:n.id,label:F(n.labelKey),description:r?.description??n.id,state:Pi(e,r),busy:t.busy.has(n.id),error:t.errors.get(n.id)??null,notice:[t.notices.get(n.id)?.message,t.refreshWarnings.get(n.id)].filter(Boolean).join(` `)||null}})}function Li(e){switch(e.kind){case`auto`:return`memoryPage.engine.autoHint`;case`off`:return`memoryPage.engine.offHint`;default:return`memoryPage.engine.explicitHint`}}function Ri(e){let t=U(e.engineSelection),n=e.engineOptions.find(e=>e.id===Yn)?.label??F(`memoryPage.engine.openClawMemory`),r=B(n,e.engineSelection.kind!==`auto`);if(e.engineOptions.length===0)return H({title:F(`memoryPage.engine.title`),description:F(`memoryPage.engine.description`)},z({title:F(`memoryPage.engine.rowTitle`),description:D`
|
|
${F(`memoryPage.engine.catalogUnavailable`)} ${F(Li(e.engineSelection))}
|
|
${r}
|
|
`,control:I(t??F(`memoryPage.engine.off`),{mono:!0})}));let i=[...e.engineOptions.map(e=>({value:e.id,label:e.available?e.label:`${e.label} (${F(`memoryPage.engine.unavailable`)})`})),{value:qi,label:F(`memoryPage.engine.off`)}];return H({title:F(`memoryPage.engine.title`),description:F(`memoryPage.engine.description`)},D`
|
|
${z({title:F(`memoryPage.engine.rowTitle`),description:D`${F(Li(e.engineSelection))} ${r}`,stacked:!0,control:Dn({value:t??qi,options:i,disabled:e.engineBusy,ariaLabel:F(`memoryPage.engine.rowTitle`),onChange:t=>e.onEngineChange(t||null)})})}
|
|
${zi(e,t)}
|
|
${e.engineOutcome===null?E:z({title:F(e.engineOutcome.kind===`error`?`memoryPage.engine.changeFailed`:`pluginsPage.needsAttention`),description:e.engineOutcome.message,control:R({kind:e.engineOutcome.kind===`error`?`danger`:`warn`,label:F(e.engineOutcome.kind===`error`?`common.failed`:`pluginsPage.needsAttention`)})})}
|
|
`)}function zi(e,t){return t===null||e.engineState!==`disabled`?E:z({title:F(`memoryPage.engine.disabledTitle`),description:F(`memoryPage.engine.disabledHint`),control:D`
|
|
<button
|
|
class="btn btn--sm"
|
|
?disabled=${e.engineBusy}
|
|
@click=${()=>e.onEngineChange(t)}
|
|
>
|
|
${F(`memoryPage.engine.enable`)}
|
|
</button>
|
|
`})}function Bi(e){switch(e){case`enabled`:return R({kind:`ok`,label:F(`common.enabled`)});case`disabled`:return R({kind:`muted`,label:F(`common.disabled`)});case`loading`:return R({kind:`muted`,label:F(`common.loading`)});default:return R({kind:`muted`,label:F(`memoryPage.addons.stateUnknown`)})}}function Vi(e){return H({title:F(`memoryPage.addons.title`),description:F(`memoryPage.addons.description`)},D`
|
|
${e.addons.map(t=>D`
|
|
${e.canToggleAddons&&(t.state===`enabled`||t.state===`disabled`)?L({title:t.label,ariaLabel:F(`memoryPage.addons.toggleAriaLabel`,{plugin:t.label}),description:t.description,checked:t.state===`enabled`,disabled:t.busy,onChange:n=>e.onAddonChange(t.id,n)}):z({title:t.label,description:t.description,control:Bi(t.state)})}
|
|
${t.error===null?E:z({title:F(`memoryPage.addons.changeFailed`,{plugin:t.label}),description:t.error,control:R({kind:`danger`,label:F(`common.failed`)})})}
|
|
${t.notice===null?E:z({title:F(`pluginsPage.needsAttention`),description:t.notice,control:R({kind:`warn`,label:F(`pluginsPage.needsAttention`)})})}
|
|
`)}
|
|
${z({title:F(`memoryPage.addons.manage`),control:D`<a class="memory-page__link" href=${e.pluginsHref}
|
|
>${F(`memoryPage.addons.manageLink`)}</a
|
|
>`})}
|
|
`)}function Hi(e){return D`
|
|
<div class="settings-page">
|
|
${Ri(e)} ${Vi(e)}
|
|
<p class="settings-page__intro">${F(`memoryPage.search.intro`)}</p>
|
|
</div>
|
|
${e.editor}
|
|
<div class="settings-page">
|
|
${e.dreamingSettings}
|
|
${H({title:F(`memoryPage.import.title`),description:F(`memoryPage.import.description`)},z({title:F(`tabs.memoryImport`),description:F(`subtitles.memoryImport`),control:e.canImportMemory?D`<a class="memory-page__link" href=${e.memoryImportHref}
|
|
>${F(`memoryPage.import.link`)}</a
|
|
>`:I(F(`memoryImport.adminRequired`))}))}
|
|
</div>
|
|
`}function Ui(e){return D`
|
|
<section class="memory-page">
|
|
<section class="content-header content-header--page hub-page-header">
|
|
<div class="hub-page-header__title">
|
|
<div class="page-title">${F(`tabs.memory`)}</div>
|
|
<div class="page-subtitle">
|
|
${F(`memoryPage.intro`)} ${sn(Ki)}
|
|
</div>
|
|
</div>
|
|
<div class="hub-page-header__tabs">
|
|
${$n({id:`memory`,active:e.activeTab,tabs:[{value:`overview`,label:F(`memoryPage.tabs.overview`)},{value:`memories`,label:F(`memoryPage.tabs.memories`)},{value:`dreams`,label:F(`memoryPage.tabs.dreams`)},{value:`settings`,label:F(`memoryPage.tabs.settings`)}],ariaLabel:F(`memoryPage.tablistLabel`),panelId:Gi,onSelect:t=>e.onTabChange(t)})}
|
|
</div>
|
|
<div class="hub-page-header__actions">
|
|
${e.activeTab===`settings`||e.agents.length<=1?E:D`
|
|
<div class="agent-scope-control">
|
|
<span class="agent-scope-control__label"
|
|
>${F(`memoryPage.dreaming.agentScope.rowTitle`)}</span
|
|
>
|
|
<openclaw-agent-select
|
|
.options=${e.agents}
|
|
.value=${e.agentId??``}
|
|
.accessibleLabel=${F(`memoryPage.dreaming.agentScope.rowTitle`)}
|
|
.onSelect=${t=>e.onAgentChange(t||null)}
|
|
></openclaw-agent-select>
|
|
</div>
|
|
`}
|
|
</div>
|
|
</section>
|
|
<div id=${Gi} class="memory-page__panel" role="tabpanel">
|
|
${e.activeTab===`overview`?e.overview:e.activeTab===`memories`?e.memories:e.activeTab===`dreams`?e.dreams:Hi(e)}
|
|
</div>
|
|
</section>
|
|
`}var Wi,Gi,Ki,qi;function Ji(){return(Ji=e((()=>{O(),rr(),er(),V(),M(),qn(),Wi=[{id:`active-memory`,labelKey:`memoryPage.addons.activeMemory.title`},{id:`memory-wiki`,labelKey:`memoryPage.addons.memoryWiki.title`}],Gi=`memory-settings-panel`,Ki=`https://docs.openclaw.ai/concepts/memory`,qi=``})))()}function Yi(e){return D`
|
|
<openclaw-memory-settings
|
|
.configObject=${e.configObject}
|
|
.mutationDisabled=${e.mutationDisabled}
|
|
.pluginsHref=${e.pluginsHref}
|
|
.memoryImportHref=${e.memoryImportHref}
|
|
.routeData=${e.routeData}
|
|
.buildEditor=${e.buildEditor}
|
|
></openclaw-memory-settings>
|
|
`}var Xi,Zi,Qi,J;function $i(){return($i=e((()=>{jt(),O(),we(),bt(),rt(),Ne(),V(),M(),pe(),ge(),w(),Ft(),f(),C(),be(),ar(),$r(),ri(),oi(),xi(),Mi(),qn(),Ji(),Xi=`none`,Zi=[`plugins`,`slots`,`memory`],Qi=`https://docs.openclaw.ai/concepts/dreaming`,J=class extends b{constructor(...e){super(...e),this.configObject={},this.mutationDisabled=!1,this.pluginsHref=``,this.memoryImportHref=``,this.routeData=null,this.buildEditor=()=>D``,this.catalog={kind:`unavailable`},this.engineBusy=!1,this.engineOutcome=null,this.addonBusy=new Set,this.addonErrors=new Map,this.addonNotices=new Map,this.addonRefreshWarnings=new Map,this.selectedAgentId=null,this.overviewStatus={kind:`idle`},this.probingEmbeddings=!1,this.support=`unknown`,this.connection=null,this.catalogRequest=0,this.overviewRequest=null,this.supportPluginId=null,this.supportProbe=null,this.addonNoticeOperations=new Map,this.normalizedLocation=``,this.subscriptions=new _e(this).watch(()=>this.context?.gateway,(e,t)=>e.subscribe(t),e=>this.syncGateway(e.snapshot.client,e.snapshot.phase===`connected`)).watch(()=>this.context?.runtimeConfig,(e,t)=>e.subscribe(t),e=>this.syncSupport(e)).watch(()=>this.context?.agents,(e,t)=>e.subscribe(t),e=>{!e.state.agentsList&&!e.state.agentsLoading&&e.ensureList().catch(()=>void 0),this.loadOverviewStatus()})}disconnectedCallback(){this.subscriptions.clear(),this.connection=null,this.overviewRequest=null,this.probingEmbeddings=!1,this.catalog={kind:`unavailable`},this.supportPluginId=null,this.supportProbe=null,this.addonNoticeOperations.clear(),super.disconnectedCallback()}connectedCallback(){super.connectedCallback(),this.syncCanonicalLocation()}updated(e){if(e.has(`routeData`)&&(this.activeTab(e.get(`routeData`)??null)!==this.activeTab()&&(this.overviewRequest=null,this.probingEmbeddings=!1,this.loadOverviewStatus()),this.syncCanonicalLocation()),e.has(`configObject`)){let t=e.get(`configObject`),n=t?U(Hn(t)):null,r=U(Hn(this.configObject));t&&n!==r&&(this.overviewRequest=null,this.probingEmbeddings=!1,this.loadOverviewStatus())}}activeTab(e=this.routeData){return Vn(e??{},this.context?.basePath??``)??`overview`}syncCanonicalLocation(){let e=this.context,t=this.routeData;if(!e||!t)return;let n=Gn(t,e.basePath);if(!n){this.normalizedLocation=``;return}let r=`${t.pathname}${t.search}${t.hash}`;this.normalizedLocation!==r&&(this.normalizedLocation=r,e.replace(`memory`,n))}syncGateway(e,t){if(this.connection?.client===e&&this.connection.connected===t)return;let n={client:e,connected:t};if(this.connection=n,this.engineBusy=!1,this.engineOutcome=null,this.addonBusy=new Set,this.addonRefreshWarnings=new Map,this.overviewRequest=null,this.probingEmbeddings=!1,!e||!t){this.catalog={kind:`unavailable`},this.activeTab()===`overview`&&(this.overviewStatus={kind:`error`,message:F(`memoryPage.overview.hero.gatewayOffline`)});return}this.catalog={kind:`loading`},this.loadCatalog(e,n),this.reconcileAddonNotices(e,n),this.loadOverviewStatus()}async readProcessInstanceId(e){if(!Nt(this.context.gateway.snapshot,`system.info`))return null;try{return(await e.request(`system.info`,{})).processInstanceId??null}catch{return null}}async reconcileAddonNotices(e,t){if(this.addonNotices.size===0)return;let n=await this.readProcessInstanceId(e);if(!n||!this.isConnected||this.connection!==t)return;let r=new Map;for(let[e,t]of this.addonNotices)t.processInstanceId===null?r.set(e,{...t,processInstanceId:n}):t.processInstanceId===n&&r.set(e,t);(r.size!==this.addonNotices.size||[...r].some(([e,t])=>this.addonNotices.get(e)!==t))&&(this.addonNotices=r)}async loadCatalog(e,t){let n=++this.catalogRequest;try{let r=await ne(e);this.applyCatalog(t,n,{kind:`ready`,plugins:r.plugins,mutationAllowed:r.mutationAllowed})}catch{this.applyCatalog(t,n,{kind:`unavailable`})}}applyCatalog(e,t,n){!this.isConnected||this.connection!==e||this.catalogRequest!==t||(this.catalog=n)}resolveAgentId(){let e=this.context.agents.state.agentsList,t=m(e?.agents??[]);return this.selectedAgentId&&t.some(e=>e.id===this.selectedAgentId)?this.selectedAgentId:e?.defaultId??t[0]?.id??null}agentOptions(){return m(this.context.agents.state.agentsList?.agents??[]).map(e=>({value:e.id,label:re(e),agent:e}))}selectAgent(e){this.selectedAgentId!==e&&(this.selectedAgentId=e,this.overviewRequest=null,this.probingEmbeddings=!1,this.loadOverviewStatus())}async loadOverviewStatus(e={}){if(this.activeTab()!==`overview`)return;if(Hn(this.configObject).kind===`off`){this.overviewRequest=null,this.overviewStatus={kind:`idle`},this.probingEmbeddings=!1;return}let t=this.connection,n=t?.connected?t.client:null,r=this.resolveAgentId();if(!t||!n){this.overviewStatus={kind:`error`,message:F(`memoryPage.overview.hero.gatewayOffline`)},this.probingEmbeddings=!1;return}if(!r||!e.force&&this.overviewRequest?.connection===t&&this.overviewRequest.agentId===r)return;let i=e.probeEmbeddings===!0,a={connection:t,agentId:r,probeEmbeddings:i};this.overviewRequest=a,this.probingEmbeddings=i,i||(this.overviewStatus={kind:`loading`});try{let e=await n.request(`doctor.memory.status`,{agentId:r,...i?{probe:!0}:{}});if(!this.isConnected||this.overviewRequest!==a)return;this.overviewStatus={kind:`ready`,payload:e}}catch(e){if(!this.isConnected||this.overviewRequest!==a)return;this.overviewStatus={kind:`error`,message:x(e)}}finally{this.overviewRequest===a&&(this.probingEmbeddings=!1)}}engineState(e){let t=U(e);return t===null?`unknown`:Pi(this.catalog,Fi(this.catalog,t))}applyPluginRefreshOutcome(e,t,n){if(this.connection!==e)return;if(!t){this.addonRefreshWarnings=new Map,this.engineOutcome?.kind===`warning`&&(this.engineOutcome=null);return}let r=F(`pluginsPage.configRefreshFailed`,{error:t});n?this.addonRefreshWarnings=new Map(this.addonRefreshWarnings).set(n,r):this.engineOutcome={kind:`warning`,message:r}}async changeAddon(e,t){if(this.addonBusy.has(e)||this.mutationDisabled||this.catalog.kind!==`ready`||!this.catalog.mutationAllowed||!He(this.context.gateway.snapshot).canAdmin)return;let n=Fi(this.catalog,e),r=Pi(this.catalog,n),i=this.connection,a=i?.connected?i.client:null;if(!i||!a||r!==`enabled`&&r!==`disabled`)return;let o={};this.addonNoticeOperations.set(e,o),this.addonBusy=new Set(this.addonBusy).add(e);let s=new Map(this.addonErrors);s.delete(e),this.addonErrors=s;let c=new Map(this.addonRefreshWarnings);c.delete(e),this.addonRefreshWarnings=c;try{let n=await ee(this.context.runtimeConfig,a,async n=>{let r=this.readProcessInstanceId(n);return{result:await fe(n,e,t),processInstanceId:r}}),{result:r,processInstanceId:s}=n.value,c=t?`pluginsPage.enabledRestart`:`pluginsPage.disabledRestart`,l=`warnings`in r?r.warnings??[]:[],u=[r.restartRequired?F(c,{name:r.plugin.name}):null,...l].filter(Boolean).join(` `);if(this.addonNoticeOperations.get(e)===o){this.applyPluginRefreshOutcome(i,n.refreshError,e);let t=u?await s:null;if(this.addonNoticeOperations.get(e)===o){let n=new Map(this.addonNotices);if(u?n.set(e,{message:u,processInstanceId:t}):n.delete(e),this.addonNotices=n,u){let e=this.connection;e?.connected&&e.client&&this.reconcileAddonNotices(e.client,e)}}}let d=this.connection;d?.connected&&d.client&&await this.loadCatalog(d.client,d)}catch(t){this.connection===i&&(this.addonErrors=new Map(this.addonErrors).set(e,x(t)))}finally{if(this.addonNoticeOperations.get(e)===o&&this.addonNoticeOperations.delete(e),this.connection===i){let t=new Set(this.addonBusy);t.delete(e),this.addonBusy=t}}}async changeEngine(e,t){if(this.engineBusy||this.mutationDisabled||this.catalog.kind===`ready`&&!this.catalog.mutationAllowed||e===U(t)&&(e===null||this.engineState(t)===`enabled`))return;if(this.engineOutcome=null,!e){this.context.runtimeConfig.patchForm(Zi,Xi);return}let n=this.connection,r=n?.connected?n.client:null;if(!(!n||!r)){this.engineBusy=!0;try{let t=await ee(this.context.runtimeConfig,r,t=>fe(t,e,!0));this.applyPluginRefreshOutcome(n,t.refreshError);let i=this.connection;i?.connected&&i.client&&await this.loadCatalog(i.client,i)}catch(e){this.connection===n&&(this.engineOutcome={kind:`error`,message:x(e)})}finally{this.connection===n&&(this.engineBusy=!1)}}}configObjectFromController(){return le(this.context.runtimeConfig.state)}dreamingPluginId(){return or(this.configObjectFromController()).pluginId}dreamingConfig(){let e=i(this.configObjectFromController()?.plugins),t=i(i(e?.entries)?.[this.dreamingPluginId()]);return i(i(t?.config)?.dreaming)}syncSupport(e){let t=or(le(e.state)).pluginId;t!==this.supportPluginId&&(this.supportPluginId=t,this.support=`unknown`);let n=e.state.connected;if(this.supportProbe&&(this.supportProbe.pluginId!==t||!n)&&(this.supportProbe=null),this.support!==`unknown`||this.supportProbe||!n)return;let r={pluginId:t};this.supportProbe=r,ir(e,t).then(e=>{this.supportProbe===r&&(this.supportProbe=null,this.isConnected&&(this.support=e))})}patchDreaming(e,t){if(this.mutationDisabled)return;let n=ii(this.dreamingPluginId(),e);if(t===void 0){this.context.runtimeConfig.removeFormValue(n);return}this.context.runtimeConfig.patchForm(n,t)}renderDreamingControls(){let e=this.dreamingPluginId();return D`
|
|
<p class="settings-page__intro">
|
|
${F(`memoryPage.dreaming.intro`,{plugin:e})}
|
|
${sn(Qi)}
|
|
</p>
|
|
${this.support===`unsupported`?mi(e):pi({dreaming:this.dreamingConfig(),timezoneDefault:ai(this.configObjectFromController()),disabled:this.mutationDisabled,onPatch:(e,t)=>this.patchDreaming(e,t)})}
|
|
`}navigateTab(e){this.context.navigate(`memory`,{pathname:je(e,this.context.basePath)})}render(){let e=Hn(this.configObject),t=this.mutationDisabled||this.catalog.kind===`ready`&&!this.catalog.mutationAllowed,n=this.activeTab(),r=this.resolveAgentId();return Ui({activeTab:n,onTabChange:e=>this.navigateTab(e),engineOptions:Ni(this.catalog,e),engineSelection:e,engineState:this.engineState(e),engineBusy:this.engineBusy||t,engineOutcome:this.engineOutcome,onEngineChange:t=>void this.changeEngine(t,e),addons:Ii(this.catalog,{busy:this.addonBusy,errors:this.addonErrors,notices:this.addonNotices,refreshWarnings:this.addonRefreshWarnings}),canToggleAddons:this.catalog.kind===`ready`&&this.catalog.mutationAllowed&&!this.mutationDisabled&&He(this.context.gateway.snapshot).canAdmin,onAddonChange:(e,t)=>void this.changeAddon(e,t),pluginsHref:this.pluginsHref,memoryImportHref:this.memoryImportHref,canImportMemory:He(this.context.gateway.snapshot).canAdmin,agentId:r,agents:this.agentOptions(),onAgentChange:e=>this.selectAgent(e),overview:ji({agentId:r,engineSelection:e,engineDisabled:this.engineState(e)===`disabled`,status:this.overviewStatus,probingEmbeddings:this.probingEmbeddings,onRefresh:()=>void this.loadOverviewStatus({force:!0}),onProbeEmbeddings:()=>void this.loadOverviewStatus({force:!0,probeEmbeddings:!0}),onNavigate:e=>this.navigateTab(e)}),memories:D`
|
|
<openclaw-memory-memories
|
|
.client=${this.context.gateway.snapshot.client}
|
|
.connected=${this.context.gateway.snapshot.phase===`connected`}
|
|
.methodAdvertised=${Nt(this.context.gateway.snapshot,`memory.search`)===!0}
|
|
.agentId=${r}
|
|
></openclaw-memory-memories>
|
|
`,dreams:D` <openclaw-memory-dreaming .agentId=${r}></openclaw-memory-dreaming> `,editor:n===`settings`?this.buildEditor(Wn(`settings`)):D``,dreamingSettings:n===`settings`?this.renderDreamingControls():D``})}},o([kt({context:ct,subscribe:!0})],J.prototype,`context`,void 0),o([k({attribute:!1})],J.prototype,`configObject`,void 0),o([k({type:Boolean})],J.prototype,`mutationDisabled`,void 0),o([k()],J.prototype,`pluginsHref`,void 0),o([k()],J.prototype,`memoryImportHref`,void 0),o([k({attribute:!1})],J.prototype,`routeData`,void 0),o([k({attribute:!1})],J.prototype,`buildEditor`,void 0),o([A()],J.prototype,`catalog`,void 0),o([A()],J.prototype,`engineBusy`,void 0),o([A()],J.prototype,`engineOutcome`,void 0),o([A()],J.prototype,`addonBusy`,void 0),o([A()],J.prototype,`addonErrors`,void 0),o([A()],J.prototype,`addonNotices`,void 0),o([A()],J.prototype,`addonRefreshWarnings`,void 0),o([A()],J.prototype,`selectedAgentId`,void 0),o([A()],J.prototype,`overviewStatus`,void 0),o([A()],J.prototype,`probingEmbeddings`,void 0),o([A()],J.prototype,`support`,void 0),customElements.get(`openclaw-memory-settings`)||customElements.define(`openclaw-memory-settings`,J)})))()}function ea(e){let{gatewayAuth:t,execPolicy:n,browserEnabled:r,browserEnabledOverridden:i,toolProfile:a,toolProfileOverridden:o}=e.security,s=a.trim()||`full`,c=p.map(e=>({value:e.id,label:F(e.labelKey)}));return c.some(e=>e.value===s)||c.push({value:s,label:s}),H({title:F(`quickSettings.security.title`)},[z({title:F(`quickSettings.security.gatewayAuth`),control:R({kind:t===`none`?`warn`:t===`unknown`?`muted`:`ok`,label:t})}),z({title:F(`quickSettings.security.execPolicy`),control:I(n)}),L({title:F(`quickSettings.security.browserEnabled`),description:B(F(`common.enabled`),i),checked:r,disabled:e.configBusy,onChange:t=>e.onBrowserEnabledToggle?.(t)}),z({title:F(`quickSettings.security.toolProfile`),description:B(F(`agents.toolCatalog.profiles.full`),o),stacked:!0,control:Dn({value:s,options:c,disabled:e.configBusy,onChange:t=>e.onToolProfileChange?.(t)})}),z({title:F(`devices.pairing.title`),control:D`
|
|
<button
|
|
class="btn"
|
|
title=${e.canPairDevice?``:F(`devices.pairing.adminRequired`)}
|
|
?disabled=${!e.canPairDevice}
|
|
@click=${e.onPairMobile}
|
|
>
|
|
${N.smartphone} ${F(`devices.pairing.button`)}
|
|
</button>
|
|
`})])}function ta(e){return D`
|
|
<section class="security-page">
|
|
<div class="settings-page">${ea(e)}</div>
|
|
${e.editor}
|
|
</section>
|
|
`}function na(){return(na=e((()=>{O(),P(),V(),M(),pe()})))()}function ra(e){return{gateway:{controlUi:{sessionObserver:e?null:!1}}}}function ia(e){return{agents:{defaults:{utilityModel:e.kind===`auto`?null:e.kind===`disabled`?``:e.model}}}}function aa(e){return!e||e.status===`unavailable`?F(`configView.sessionObserver.modelUnavailable`):e.status===`disabled`?F(`configView.sessionObserver.modelDisabled`):F(e.status===`auto`?`configView.sessionObserver.modelAuto`:`configView.sessionObserver.modelConfigured`,{model:e.model})}function oa(e){let t=new Set;return e.filter(e=>e.available!==!1).map(e=>({value:e.id.startsWith(`${e.provider}/`)?e.id:`${e.provider}/${e.id}`,label:e.name||e.id,provider:e.provider})).filter(e=>!t.has(e.value)&&(t.add(e.value),!0)).toSorted((e,t)=>e.label.localeCompare(t.label))}function sa(e){let t=e.utilityModel===void 0?ca:e.utilityModel,n=oa(e.models),r=n.some(e=>e.value===t),i=Ut(t);return D`
|
|
<div class="settings-group">
|
|
${L({title:F(`configView.sessionObserver.toggle`),description:F(`configView.sessionObserver.toggleHint`),checked:e.enabled,disabled:e.disabled,onChange:e.onEnabledChange})}
|
|
${z({title:F(`configView.sessionObserver.resolvedModel`),description:aa(e.resolvedUtilityModel)})}
|
|
${z({title:F(`configView.sessionObserver.modelPicker`),description:e.modelsUnavailable?F(`configView.sessionObserver.modelCatalogUnavailable`):F(`configView.sessionObserver.modelPickerHint`),control:cr({label:F(`configView.sessionObserver.modelPicker`),value:t,options:[{value:ca,label:F(`configView.sessionObserver.auto`)},{value:``,label:F(`configView.sessionObserver.disabled`)},...t!==ca&&t!==``&&!r?[{value:t,label:t,disabled:e.modelsUnavailable,...i?{provider:i}:{}}]:[],...n.map(({value:t,label:n,provider:r})=>({value:t,label:n,provider:r,disabled:e.modelsUnavailable}))],disabled:e.disabled,onChange:t=>e.onUtilityModelChange(t===ca?{kind:`auto`}:t===``?{kind:`disabled`}:{kind:`model`,model:t})})})}
|
|
</div>
|
|
`}var ca;function la(){return(la=e((()=>{O(),lr(),Wt(),V(),M(),ca=`__openclaw_observer_auto__`})))()}function ua(e){let n=r(r(e.talk)?.realtime),i=r(n?.providers)??{},a={};for(let[e,n]of Object.entries(i)){let i=r(n);i&&(a[e]={model:t(i.model),speakerVoice:t(i.speakerVoice)??t(i.voice)})}return{provider:t(n?.provider),model:t(n?.model),speakerVoice:t(n?.speakerVoice)??t(n?.speakerVoiceId),transport:t(n?.transport),consultRouting:t(n?.consultRouting)?.toLowerCase()??null,providerEntries:a}}function da(e){let t=e?.trim().toLowerCase();return t===`gpt-live`||t?.startsWith(`gpt-live-`)===!0}function fa(e,t){return e!==void 0&&e.length>0&&!e.includes(t)}function pa(){return(pa=e((()=>{})))()}function ma(e,t){if(t)return e.find(e=>e.id===t||e.aliases.includes(t))}function ha(e,t){if(e.kind===`ready`)return t.provider?ma(e.providers,t.provider):ma(e.providers,e.activeProvider)}function ga(e,t){let n=[e.provider,t?.id,...t?.aliases??[]],r=[];for(let t of n)t&&t in e.providerEntries&&!r.includes(t)&&r.push(t);return r}function _a(e,t){let n=e.model,r=e.speakerVoice;for(let i of ga(e,t)){let t=e.providerEntries[i];n??=t?.model??null,r??=t?.speakerVoice??null}return{model:n,speakerVoice:r}}function va(e){return z({title:e.title,description:e.description,control:D`
|
|
<select
|
|
class="settings-select"
|
|
aria-label=${e.title}
|
|
?disabled=${e.disabled}
|
|
.value=${e.value}
|
|
@change=${t=>e.onChange(t.currentTarget.value)}
|
|
>
|
|
${e.options.map(t=>D`
|
|
<option value=${t.value} ?selected=${e.value===t.value}>
|
|
${t.label}
|
|
</option>
|
|
`)}
|
|
</select>
|
|
`})}function ya(e){let t=e.catalog;return t.kind===`loading`?z({title:F(`talkPage.status.title`),control:R({kind:`muted`,label:F(`common.loading`)})}):t.kind===`unavailable`?z({title:F(`talkPage.status.title`),description:F(`talkPage.status.unavailableHint`),control:R({kind:`muted`,label:F(`talkPage.status.unavailable`)})}):z({title:F(`talkPage.status.title`),description:t.activeProvider?F(`talkPage.status.activeProvider`,{provider:t.activeProvider}):F(`talkPage.status.noProvider`),control:t.ready?R({kind:`ok`,label:F(`talkPage.status.ready`)}):R({kind:`warn`,label:F(`talkPage.status.notReady`)})})}function ba(e){if(e.catalog.kind!==`ready`||e.catalog.providers.length===0)return z({title:F(`talkPage.provider.title`),description:F(`talkPage.provider.description`),control:I(e.selection.provider??F(`talkPage.provider.auto`),{mono:!0})});let t=ma(e.catalog.providers,e.selection.provider),n=e.selection.provider&&!t?e.selection.provider:null;return z({title:F(`talkPage.provider.title`),description:F(`talkPage.provider.description`),stacked:!0,control:Dn({value:t?.id??n??Y,options:[...e.catalog.providers.map(e=>({value:e.id,label:e.label})),...n?[{value:n,label:n}]:[],{value:Y,label:F(`talkPage.provider.auto`)}],disabled:e.configBusy,ariaLabel:F(`talkPage.provider.title`),onChange:t=>e.onProviderChange(t||null)})})}function xa(e){let t=ha(e.catalog,e.selection),{model:n}=_a(e.selection,t);if(!t)return z({title:F(`talkPage.model.title`),description:F(`talkPage.model.description`),control:I(n??F(`talkPage.model.default`),{mono:!0})});let r=t.models.length?t.models:t.defaultModel?[t.defaultModel]:[],i=[{value:Y,label:t.defaultModel?F(`talkPage.model.defaultNamed`,{model:t.defaultModel}):F(`talkPage.model.default`)},...r.map(e=>({value:e,label:e})),...n&&!r.includes(n)?[{value:n,label:n}]:[]];return z({title:F(`talkPage.model.title`),description:F(`talkPage.model.description`),control:cr({label:F(`talkPage.model.title`),value:n??Y,options:i.map(({value:e,label:n})=>({value:e,label:n,provider:t.id})),disabled:e.configBusy,onChange:t=>e.onModelChange(t||null)})})}function Sa(e){let t=ha(e.catalog,e.selection),{model:n,speakerVoice:r}=_a(e.selection,t),i=t?.voicesByModel?.[n??t.defaultModel??``]??t?.voices??[];if(i.length===0)return z({title:F(`talkPage.voice.title`),description:F(`talkPage.voice.description`),control:I(r??F(`talkPage.voice.default`),{mono:!0})});let a=[{value:Y,label:F(`talkPage.voice.default`)},...i.map(e=>({value:e,label:e})),...r&&!i.includes(r)?[{value:r,label:r}]:[]];return va({title:F(`talkPage.voice.title`),description:F(`talkPage.voice.description`),value:r??Y,options:a,disabled:e.configBusy,onChange:t=>e.onVoiceChange(t||null)})}function Ca(e){let t=ha(e.catalog,e.selection),{model:n}=_a(e.selection,t);return t?.id!==`openai`||!da(n)?E:z({title:F(`talkPage.gptLive.title`),description:F(`talkPage.gptLive.hint`),control:t.configured?R({kind:`ok`,label:F(`talkPage.gptLive.ready`)}):R({kind:`warn`,label:F(`talkPage.status.notReady`)})})}function wa(e){return D`
|
|
<section class="talk-page">
|
|
<div class="settings-page">
|
|
${H({title:F(`talkPage.voiceSection.title`),description:F(`talkPage.voiceSection.description`)},D`
|
|
${ya(e)} ${ba(e)} ${xa(e)}
|
|
${Sa(e)} ${Ca(e)}
|
|
`)}
|
|
</div>
|
|
${e.editor}
|
|
</section>
|
|
`}var Y;function Ta(){return(Ta=e((()=>{O(),lr(),V(),M(),pa(),Y=``})))()}function Ea(e){return{id:e.id,label:e.label,configured:e.configured,aliases:e.aliases??[],models:e.models??[],voices:e.voices??[],voicesByModel:e.voicesByModel,transports:e.transports??[],defaultModel:e.defaultModel??null}}function Da(e,t){return da(e)&&t===`provider-websocket`}function Oa(e){return D`
|
|
<openclaw-talk-settings
|
|
.configObject=${e.configObject}
|
|
.mutationDisabled=${e.mutationDisabled}
|
|
.buildEditor=${e.buildEditor}
|
|
></openclaw-talk-settings>
|
|
`}var ka,X;function Aa(){return(Aa=e((()=>{jt(),O(),we(),rt(),C(),be(),pa(),Ta(),ka=new Set([`webrtc`,`provider-websocket`]),X=class extends b{constructor(...e){super(...e),this.configObject={},this.mutationDisabled=!1,this.buildEditor=()=>D``,this.catalog={kind:`unavailable`},this.connection=null,this.catalogRequestId=0,this.subscriptions=new _e(this).watch(()=>this.context?.gateway,(e,t)=>e.subscribe(t),e=>this.syncCatalog(e.snapshot.client,e.snapshot.phase===`connected`)).watch(()=>this.context?.runtimeConfig,(e,t)=>e.subscribe(t),e=>this.refreshCatalogOnConfigChange(e.state)),this.refreshOnFocus=()=>{let e=this.connection;e?.client&&e.connected&&this.loadCatalog(e.client,e)}}connectedCallback(){super.connectedCallback(),window.addEventListener(`focus`,this.refreshOnFocus)}disconnectedCallback(){window.removeEventListener(`focus`,this.refreshOnFocus),this.subscriptions.clear(),this.connection=null,this.catalog={kind:`unavailable`},super.disconnectedCallback()}syncCatalog(e,t){if(this.connection?.client===e&&this.connection.connected===t)return;let n={client:e,connected:t};if(this.connection=n,!e||!t){this.catalog={kind:`unavailable`};return}this.catalog={kind:`loading`},this.loadCatalog(e,n)}async loadCatalog(e,t){let n=++this.catalogRequestId;try{let r=await e.request(`talk.catalog`,{});this.applyCatalog(t,n,{kind:`ready`,ready:r.realtime.ready===!0,activeProvider:r.realtime.activeProvider??null,providers:r.realtime.providers.map(Ea)})}catch{this.applyCatalog(t,n,{kind:`unavailable`})}}applyCatalog(e,t,n){!this.isConnected||this.connection!==e||this.catalogRequestId!==t||(this.catalog=n)}refreshCatalogOnConfigChange(e){let t=e.configSnapshot?.hash??null;if(this.lastCatalogConfigHash===void 0){this.lastCatalogConfigHash=t;return}if(t===null||t===this.lastCatalogConfigHash)return;this.lastCatalogConfigHash=t;let n=this.connection;n?.client&&n.connected&&this.loadCatalog(n.client,n)}changeModel(e){if(this.mutationDisabled)return;let t=this.context.runtimeConfig;if(e!==null){t.patchForm([`talk`,`realtime`,`model`],e);let n=this.liveSelection(),r=n.transport,i=ha(this.catalog,n),a=r!==null&&(Da(e,r)||fa(i?.transports,r));da(e)&&a?t.removeFormValue([`talk`,`realtime`,`transport`]):i?.id===`openai`&&da(e)&&r===`gateway-relay`&&n.consultRouting===`force-agent-consult`&&t.removeFormValue([`talk`,`realtime`,`consultRouting`]);return}t.removeFormValue([`talk`,`realtime`,`model`]);for(let e of this.selectedProviderConfigKeys())t.removeFormValue([`talk`,`realtime`,`providers`,e,`model`])}changeVoice(e){if(this.mutationDisabled)return;let t=this.context.runtimeConfig;if(e!==null){t.patchForm([`talk`,`realtime`,`speakerVoice`],e);return}t.removeFormValue([`talk`,`realtime`,`speakerVoice`]),t.removeFormValue([`talk`,`realtime`,`speakerVoiceId`]);for(let e of this.selectedProviderConfigKeys())t.removeFormValue([`talk`,`realtime`,`providers`,e,`speakerVoice`]),t.removeFormValue([`talk`,`realtime`,`providers`,e,`voice`])}selectedProviderConfigKeys(){let e=this.liveSelection();return ga(e,ha(this.catalog,e))}liveSelection(){let e=this.context.runtimeConfig.state.configForm;return ua(e&&typeof e==`object`?e:this.configObject)}changeProvider(e){if(this.mutationDisabled)return;let t=this.context.runtimeConfig,n=this.liveSelection();for(let e of[`model`,`speakerVoice`,`speakerVoiceId`])t.removeFormValue([`talk`,`realtime`,e]);if(e===null){t.removeFormValue([`talk`,`realtime`,`provider`]);return}let r=n.transport,i=this.catalog.kind===`ready`?this.catalog.providers.find(t=>t.id===e):void 0,a=_a({...n,provider:e,model:null,speakerVoice:null},i).model??i?.defaultModel,o=r!==null&&(Da(a??null,r)||fa(i?.transports,r));o&&t.removeFormValue([`talk`,`realtime`,`transport`]),t.patchForm([`talk`,`realtime`,`provider`],e);let s=i!==void 0&&i.transports.length>0&&!i.transports.some(e=>ka.has(e)),c=o?null:r;s&&r!==`gateway-relay`&&(t.patchForm([`talk`,`realtime`,`transport`],`gateway-relay`),c=`gateway-relay`),i?.id===`openai`&&da(a??null)&&c===`gateway-relay`&&n.consultRouting===`force-agent-consult`&&t.removeFormValue([`talk`,`realtime`,`consultRouting`])}render(){let e=this.context.runtimeConfig.state;return wa({selection:ua(this.configObject),catalog:this.catalog,configBusy:this.mutationDisabled||e.configLoading||e.configSaving||e.configApplying,onProviderChange:e=>this.changeProvider(e),onModelChange:e=>this.changeModel(e),onVoiceChange:e=>this.changeVoice(e),editor:this.buildEditor()})}},o([kt({context:ct,subscribe:!0})],X.prototype,`context`,void 0),o([k({attribute:!1})],X.prototype,`configObject`,void 0),o([k({type:Boolean})],X.prototype,`mutationDisabled`,void 0),o([k({attribute:!1})],X.prototype,`buildEditor`,void 0),o([A()],X.prototype,`catalog`,void 0),customElements.get(`openclaw-talk-settings`)||customElements.define(`openclaw-talk-settings`,X)})))()}function ja(e,t){return e?`v${e}`:t?t.slice(0,12):F(`common.unknown`)}function Ma(e){let t=e.recordedAttempt;if(!t&&!e.statusBanner)return E;let n=e.canUpdate&&!e.updateBusy,r=t?ja(t.targetVersion,t.targetSha):null,i=r&&r!==F(`common.unknown`)?r:_t(e.schedule,e.updateAvailable)??F(`common.unknown`);return H({title:F(`updates.page.latestAttempt`)},[t?z({title:F(`updates.page.attemptedAt`),control:Fa(t.timestampMs,e.nowMs)}):E,z({title:F(`updates.page.attemptTarget`),control:I(i,{mono:!0})}),t?z({title:F(`updates.page.installedIdentity`),control:I(ja(t.installedVersion,t.installedSha),{mono:!0})}):E,t?.installKind?z({title:F(`updates.page.attemptInstallKind`),control:I(t.installKind)}):E,t?z({title:F(`updates.page.attemptReason`),control:I(D`<code>${t.reason}</code>`,{mono:!0})}):E,t?.failure?z({title:F(`updates.page.failedStep`),stacked:!0,control:D`<details class="updates-attempt-details">
|
|
<summary>${F(`updates.page.viewDetails`)}</summary>
|
|
<div><code>${t.failure.step}</code></div>
|
|
<pre>${t.failure.detail}</pre>
|
|
</details>`}):E,z({title:F(`updates.page.recoveryActions`),control:D`<div class="updates-status-control">
|
|
<button
|
|
class="btn btn--sm"
|
|
type="button"
|
|
title=${e.canCheckStatus?``:F(`updates.adminRequired`)}
|
|
?disabled=${!e.canCheckStatus||e.updateBusy}
|
|
@click=${()=>void e.onCheckStatus()}
|
|
>
|
|
${F(`updates.page.checkStatus`)}
|
|
</button>
|
|
<button
|
|
class="btn btn--sm primary"
|
|
type="button"
|
|
title=${n?``:F(`updates.adminRequired`)}
|
|
?disabled=${!n}
|
|
@click=${e.onUpdateNow}
|
|
>
|
|
${F(`updates.page.retryUpdate`)}
|
|
</button>
|
|
</div>`}),z({title:F(`updates.page.cliFallback`),stacked:!0,control:D`<details class="updates-attempt-details">
|
|
<summary>${F(`updates.page.showCliFallback`)}</summary>
|
|
<pre><code>openclaw update status --json
|
|
openclaw update</code></pre>
|
|
</details>`})])}function Na(e,t){let n=i(e.update),r=i(n?.auto),a=n?.channel,o=a===`extended-stable`;return{channel:a===`stable`||a===`beta`||a===`dev`||o?a:t?.channel===`beta`||t?.channel===`dev`?t.channel:`stable`,autoEnabled:typeof r?.enabled==`boolean`?r.enabled:t?.autoEnabled??!1,extendedStableAuthored:o}}function Pa(e){return a(e)??null}function Fa(e,t=Date.now()){let n=ye(Math.max(0,t-e));return I(D`<time datetime=${new Date(e).toISOString()} title=${n}
|
|
>${ce(e,{dateStyle:`medium`,timeStyle:`short`})}
|
|
<span class="muted">· ${n}</span></time
|
|
>`)}function Ia(e){let t=e.schedule?.install?.kind,n=e.schedule?.install?.git,r=Pa(e.controlUiBuiltAt),i=n?.commitAtMs??Pa(e.controlUiCommitAt);return H({title:F(`updates.page.buildTitle`)},[z({title:F(`updates.page.gatewayVersion`),control:I(e.gatewayVersion?D`<code dir="ltr" title=${e.gatewayVersion}>${e.gatewayVersion}</code>`:F(`common.na`),{mono:!0})}),z({title:F(`updates.page.controlUiCommit`),control:I(e.controlUiCommit?D`<code dir="ltr" title=${e.controlUiCommit}
|
|
>${e.controlUiCommit.slice(0,12)}</code
|
|
>`:F(`common.na`),{mono:!0})}),r===null?E:z({title:F(`updates.page.builtAt`),control:Fa(r,e.nowMs)}),t===`git`?z({title:F(`updates.page.installedAt`),control:n?.installedAtMs===void 0?I(F(`updates.page.installedAtUnknown`)):Fa(n.installedAtMs,e.nowMs)}):E,i===null?E:z({title:F(`updates.page.lastCommitAt`),control:Fa(i,e.nowMs)}),t?z({title:F(`updates.page.installKind`),control:I(F(`updates.installKind.${t}`))}):E])}function La(e){let t=e.schedule?.campaign,n=Oe(e.schedule,e.nowMs),r=_t(e.schedule,e.updateAvailable),i=`muted`,a;if(n)i=t?.state===`waiting-for-idle`?`warn`:`accent`,a=n;else if(e.statusBanner)i=e.statusBanner.tone===`danger`?`danger`:e.statusBanner.tone===`warn`?`warn`:`accent`,a=e.statusBanner.text;else if(e.schedule?.install?.kind===`git`){let t=e.schedule.install.git;if(!t)a=F(`updates.page.statusUnavailable`);else if(t.status===`current`)i=`ok`,a=F(`updates.page.upToDate`);else if(t.status===`behind`){i=`accent`;let e=F(t.commitsBehind===1?`updates.target.commitBehind`:`updates.target.commitsBehind`,{count:String(t.commitsBehind)});a=F(`updates.page.available`,{target:e})}else t.status===`ahead`?a=F(t.commitsAhead===1?`updates.page.gitCommitAhead`:`updates.page.gitCommitsAhead`,{count:String(t.commitsAhead)}):t.status===`diverged`?(i=`warn`,a=F(`updates.page.gitDiverged`,{ahead:String(t.commitsAhead),behind:String(t.commitsBehind)})):(i=`warn`,a=t.reason===`fetch-failed`?F(`updates.page.gitFetchFailed`):t.reason===`no-upstream`?F(`updates.page.gitNoUpstream`):F(`updates.page.gitComparisonFailed`))}else r?(i=`accent`,a=F(`updates.page.available`,{target:r})):e.schedule?.install?.kind===`package`?(i=`ok`,a=F(`updates.page.upToDate`)):a=F(`updates.page.statusUnavailable`);let o=t?.state===`waiting-for-idle`||t?.state===`countdown`;return D`<span role=${o?`timer`:E} aria-live=${o?`off`:E}
|
|
>${R({kind:i,label:a,dot:!1})}</span
|
|
>`}function Ra(e){let t=e.updateAvailable,n=e.schedule?.target?.kind===`git`||!!t?.currentSha,r=e.schedule?.install?.git;if(r&&r.status!==`behind`&&r.status!==`diverged`)return[];let i=r?.status===`behind`||r?.status===`diverged`?r.commitsBehind:void 0,a=i===void 0||i===t?.commitsBehind;return n&&a?t?.commits??[]:[]}function za(e){let t=Ra(e);return t.length===0?E:z({title:F(`updates.page.commits`),stacked:!0,control:D`
|
|
<div class="updates-commit-list" role="list" aria-label=${F(`updates.page.commits`)}>
|
|
${t.map(e=>D`
|
|
<div class="updates-commit-list__row" role="listitem">
|
|
<code title=${e.sha}>${e.sha}</code>
|
|
<span>${e.subject}</span>
|
|
</div>
|
|
`)}
|
|
</div>
|
|
`})}function Ba(e){let t=Na(e.configObject,e.schedule),n=[{value:`stable`,label:F(`updates.channel.stable`)},{value:`beta`,label:F(`updates.channel.beta`)},{value:`dev`,label:F(`updates.channel.dev`)}];t.extendedStableAuthored&&n.push({value:`extended-stable`,label:F(`updates.channel.extendedStable`)});let r=t.channel!==`extended-stable`,i=t.channel===`dev`&&e.schedule?.install?.kind===`package`,a=e.schedule?.campaign,o=a?.holdUntilMs!==void 0&&a.holdUntilMs>(e.nowMs??Date.now()),s=!!(a&&a.state!==`applying`&&e.canUpdate&&e.canHoldUpdate&&!o&&e.heldUpdateCampaignId!==a.id),c=[z({title:F(`updates.page.channel`),description:F(`updates.page.channelDescription`),stacked:!0,control:Dn({value:t.channel,options:n,ariaLabel:F(`updates.page.channel`),disabled:e.configBusy,onChange:e.onChannelChange})}),L({title:F(`updates.page.automaticUpdates`),description:F(r?i?`updates.page.devPackageAutomaticHint`:`updates.page.automaticUpdatesDescription`:`updates.page.extendedStableAutomaticHint`),checked:r&&t.autoEnabled,disabled:e.configBusy||!r||i,onChange:e.onAutomaticUpdatesChange})],l=e.canAdmin?``:F(`updates.adminRequired`);return D`
|
|
<div id="config-section-update">
|
|
${gn([e.canAdmin?E:D`<div class="callout warning" role="note">${F(`updates.adminRequired`)}</div>`,Ia(e),Ma(e),H({title:F(`updates.page.policyTitle`)},c),H({title:F(`updates.page.statusTitle`)},[z({title:F(`updates.page.scheduleStatus`),control:D`
|
|
<div class="updates-status-control">
|
|
${La(e)}
|
|
${s?D`
|
|
<button
|
|
type="button"
|
|
class="btn btn--sm"
|
|
?disabled=${e.updateBusy}
|
|
@click=${()=>void e.onHoldUpdate()}
|
|
>
|
|
${F(`updates.holdOneHour`)}
|
|
</button>
|
|
`:E}
|
|
</div>
|
|
`}),za(e),z({title:F(`updates.page.updateNow`),description:F(`updates.page.updateNowDescription`),control:D`
|
|
<button
|
|
type="button"
|
|
class="btn primary"
|
|
title=${l}
|
|
?disabled=${e.updateBusy||!e.canUpdate}
|
|
@click=${e.onUpdateNow}
|
|
>
|
|
${N.download}
|
|
${e.updateBusy?F(`chat.updating`):F(`updates.page.updateNow`)}
|
|
</button>
|
|
`})]),D`<p class="settings-page__hint">
|
|
<a href="https://docs.openclaw.ai/install/update-troubleshooting" target="_blank"
|
|
>${F(`updates.page.troubleshoot`)}</a
|
|
>
|
|
</p>`])}
|
|
</div>
|
|
`}function Va(){return(Va=e((()=>{c(),O(),Le(),P(),V(),M(),ve()})))()}function Ha(e){return`${String(Math.floor(e/60)).padStart(2,`0`)}:${String(e%60).padStart(2,`0`)}`}function Ua(e,t){let n=/^(\d{2}):(\d{2})$/u.exec(e);return n?Number(n[1])*60+Number(n[2]):t}function Z(e){return e.currentTarget}function Wa(e){return e.currentTarget}function Ga(e){return e===`identified`||e===`detailed`?e:`private`}function Ka(e,t){let n=n=>t({...e,...n});return D`
|
|
<section class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.notifications.accountDefaults`)}</h2>
|
|
</div>
|
|
<div class="settings-group">
|
|
${Xa.map(([t,r])=>z({title:r(),control:D`<input
|
|
type="checkbox"
|
|
.checked=${e.categories[t]}
|
|
@change=${r=>n({categories:{...e.categories,[t]:Z(r).checked}})}
|
|
/>`}))}
|
|
${z({title:F(`configView.notifications.lockScreenDetail`),description:F(`configView.notifications.lockScreenDetailHint`),control:D`<select
|
|
.value=${e.detailLevel}
|
|
@change=${e=>n({detailLevel:Ga(Wa(e).value)})}
|
|
>
|
|
<option value="private">${F(`configView.notifications.private`)}</option>
|
|
<option value="identified">${F(`configView.notifications.namesOnly`)}</option>
|
|
<option value="detailed">${F(`configView.notifications.detailed`)}</option>
|
|
</select>`})}
|
|
${z({title:F(`configView.notifications.quietHours`),control:D`<input
|
|
type="checkbox"
|
|
.checked=${e.quietHours.enabled}
|
|
@change=${t=>n({quietHours:{...e.quietHours,enabled:Z(t).checked}})}
|
|
/>`})}
|
|
${e.quietHours.enabled?D`
|
|
${z({title:F(`configView.notifications.quietHoursWindow`),control:D`<span>
|
|
<input
|
|
type="time"
|
|
.value=${Ha(e.quietHours.startMinute)}
|
|
@change=${t=>n({quietHours:{...e.quietHours,startMinute:Ua(Z(t).value,e.quietHours.startMinute)}})}
|
|
/>
|
|
–
|
|
<input
|
|
type="time"
|
|
.value=${Ha(e.quietHours.endMinute)}
|
|
@change=${t=>n({quietHours:{...e.quietHours,endMinute:Ua(Z(t).value,e.quietHours.endMinute)}})}
|
|
/>
|
|
</span>`})}
|
|
${z({title:F(`configView.notifications.timeZone`),control:D`<input
|
|
type="text"
|
|
.value=${e.quietHours.timeZone}
|
|
@change=${t=>n({quietHours:{...e.quietHours,timeZone:Z(t).value}})}
|
|
/>`})}
|
|
`:E}
|
|
${z({title:F(`configView.notifications.onlyAgents`),control:D`<input
|
|
type="text"
|
|
.value=${e.agentIds.join(`, `)}
|
|
@change=${e=>n({agentIds:Z(e).value.split(`,`).map(e=>e.trim()).filter(Boolean)})}
|
|
/>`})}
|
|
</div>
|
|
</section>
|
|
`}function qa(e,t){let n=n=>t({...e,...n}),r=e.quietHours;return D`
|
|
<section class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.notifications.installedApp`)}</h2>
|
|
</div>
|
|
<div class="settings-group">
|
|
${z({title:F(`configView.notifications.deliverDevice`),control:D`<input
|
|
type="checkbox"
|
|
.checked=${e.enabled}
|
|
@change=${e=>n({enabled:Z(e).checked})}
|
|
/>`})}
|
|
${z({title:F(`configView.notifications.notificationLabel`),control:D`<input
|
|
type="text"
|
|
maxlength="80"
|
|
.value=${e.label}
|
|
@change=${e=>n({label:Z(e).value})}
|
|
/>`})}
|
|
${z({title:F(`configView.notifications.lockScreenDetail`),control:D`<select
|
|
.value=${e.detailLevel??`inherit`}
|
|
@change=${e=>{let t=Wa(e).value;n({detailLevel:t===`inherit`?void 0:Ga(t)})}}
|
|
>
|
|
<option value="inherit">${F(`configView.notifications.inheritDetail`)}</option>
|
|
<option value="private">${F(`configView.notifications.private`)}</option>
|
|
<option value="identified">${F(`configView.notifications.namesOnly`)}</option>
|
|
<option value="detailed">${F(`configView.notifications.detailed`)}</option>
|
|
</select>`})}
|
|
${z({title:F(`configView.notifications.quietHours`),control:D`<select
|
|
.value=${e.quietHours===void 0?`inherit`:e.quietHours.enabled?`on`:`off`}
|
|
@change=${t=>{let r=Wa(t).value;n({quietHours:r===`inherit`?void 0:{enabled:r===`on`,startMinute:e.quietHours?.startMinute??1320,endMinute:e.quietHours?.endMinute??420,timeZone:e.quietHours?.timeZone??`UTC`}})}}
|
|
>
|
|
<option value="inherit">${F(`configView.notifications.inheritQuietHours`)}</option>
|
|
<option value="on">${F(`configForm.enumOn`)}</option>
|
|
<option value="off">${F(`configForm.enumOff`)}</option>
|
|
</select>`})}
|
|
${r?.enabled?D`
|
|
${z({title:F(`configView.notifications.quietHoursWindow`),control:D`<span>
|
|
<input
|
|
type="time"
|
|
.value=${Ha(r.startMinute)}
|
|
@change=${e=>n({quietHours:{...r,startMinute:Ua(Z(e).value,r.startMinute)}})}
|
|
/>
|
|
–
|
|
<input
|
|
type="time"
|
|
.value=${Ha(r.endMinute)}
|
|
@change=${e=>n({quietHours:{...r,endMinute:Ua(Z(e).value,r.endMinute)}})}
|
|
/>
|
|
</span>`})}
|
|
${z({title:F(`configView.notifications.timeZone`),control:D`<input
|
|
type="text"
|
|
.value=${r.timeZone}
|
|
@change=${e=>n({quietHours:{...r,timeZone:Z(e).value}})}
|
|
/>`})}
|
|
`:E}
|
|
${z({title:F(`configView.notifications.onlyAgents`),control:D`<select
|
|
.value=${e.agentIds===void 0?`inherit`:`override`}
|
|
@change=${e=>{let t=Wa(e).value;n({agentIds:t===`inherit`?void 0:[]})}}
|
|
>
|
|
<option value="inherit">${F(`configView.notifications.inherit`)}</option>
|
|
<option value="override">${F(`configView.notifications.overrideAgents`)}</option>
|
|
</select>`})}
|
|
${e.agentIds===void 0?E:z({title:F(`configView.notifications.onlyAgents`),control:D`<input
|
|
type="text"
|
|
.value=${e.agentIds.join(`, `)}
|
|
@change=${e=>n({agentIds:Z(e).value.split(`,`).map(e=>e.trim()).filter(Boolean)})}
|
|
/>`})}
|
|
${Xa.map(([t,r])=>z({title:r(),control:D`<select
|
|
.value=${e.categories?.[t]===void 0?`inherit`:e.categories[t]?`on`:`off`}
|
|
@change=${r=>{let i=Wa(r).value,a={...e.categories};i===`inherit`?delete a[t]:a[t]=i===`on`,n({categories:a})}}
|
|
>
|
|
<option value="inherit">${F(`configView.notifications.inherit`)}</option>
|
|
<option value="on">${F(`configForm.enumOn`)}</option>
|
|
<option value="off">${F(`configForm.enumOff`)}</option>
|
|
</select>`}))}
|
|
</div>
|
|
</section>
|
|
`}function Ja(e){switch(e){case`granted`:return{kind:`ok`,label:F(`configView.notifications.granted`)};case`denied`:return{kind:`danger`,label:F(`configView.notifications.denied`)};case`notDetermined`:return{kind:`accent`,label:F(`configView.notifications.notRequested`)};default:return{kind:`muted`,label:F(`configView.notifications.checking`)}}}function Ya(e){let t=e.nativeNotifications;if(t){let n=Ja(t.permission),r=t.test?.state===`pending`,i=t.permission===`notDetermined`?D`
|
|
<button
|
|
class="btn primary"
|
|
@click=${()=>e.onNativeNotificationsRequestPermission?.()}
|
|
>
|
|
${F(`configView.notifications.enable`)}
|
|
</button>
|
|
`:t.permission===`denied`?D`
|
|
<button class="btn" @click=${()=>e.onNativeNotificationsRequestPermission?.()}>
|
|
${F(`configView.notifications.openSystemSettings`)}
|
|
</button>
|
|
`:t.permission===`granted`?D`
|
|
<button
|
|
class="btn primary"
|
|
?disabled=${r}
|
|
@click=${()=>e.onNativeNotificationsSendTest?.()}
|
|
>
|
|
${r?N.loader:N.send}
|
|
${F(r?`configView.notifications.sendingTest`:`configView.notifications.sendTest`)}
|
|
</button>
|
|
`:E;return D`
|
|
<div class="settings-page">
|
|
<section class="settings-section" id=${Qn.notifications}>
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.notifications.nativeTitle`)}</h2>
|
|
<div class="settings-section__actions">${R(n)}</div>
|
|
</div>
|
|
<div class="settings-group">
|
|
${z({title:F(`configView.notifications.permission`),control:I(n.label)})}
|
|
${i===E?E:D`
|
|
<div class="settings-row">
|
|
<div class="settings-row__control">${i}</div>
|
|
</div>
|
|
`}
|
|
${t.permission===`denied`?z({title:F(`configView.notifications.blocked`),description:F(`configView.notifications.nativeBlockedHint`),control:R({kind:`danger`,label:F(`configView.notifications.denied`)})}):E}
|
|
${t.test?z({title:F(`configView.notifications.testOutcome`),description:t.test.state===`error`?t.test.message:void 0,control:R(t.test.state===`pending`?{kind:`accent`,label:F(`configView.notifications.sendingTest`)}:t.test.state===`sent`?{kind:`ok`,label:F(`configView.notifications.testQueued`)}:{kind:`danger`,label:F(`configView.notifications.testFailed`)})}):E}
|
|
</div>
|
|
</section>
|
|
</div>
|
|
`}let n=e.webPush;if(!n)return D`
|
|
<div class="settings-page">
|
|
<section class="settings-section" id=${Qn.notifications}>
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.notifications.title`)}</h2>
|
|
<div class="settings-section__actions">
|
|
${R({kind:`muted`,label:F(`configView.notifications.unavailable`)})}
|
|
</div>
|
|
</div>
|
|
<div class="settings-group">
|
|
<div class="settings-row">
|
|
<div class="settings-row__text">
|
|
<span class="settings-row__desc">
|
|
${F(`configView.notifications.unavailableHint`)}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
`;let r=n.permission===`granted`?F(`configView.notifications.granted`):n.permission===`denied`?F(`configView.notifications.denied`):n.permission==="default"?F(`configView.notifications.notRequested`):F(`configView.notifications.unsupported`),i=n.subscription===`registered`,a=i||n.subscription===`vapid-mismatch`,o=i?F(`configView.notifications.subscribed`):n.subscription===`unknown`?F(`configView.notifications.checking`):F(`configView.notifications.notSubscribed`),s=n.supported?n.permission===`denied`?F(`configView.notifications.blocked`):i?F(`configView.notifications.subscribed`):n.subscription===`vapid-mismatch`?F(`configView.notifications.unavailable`):n.subscription===`unknown`?F(`configView.notifications.checking`):F(`configView.notifications.ready`):F(`configView.notifications.unsupported`),c=n.supported?n.permission===`denied`||n.subscription===`vapid-mismatch`?`danger`:i?`ok`:`accent`:`muted`,l=n.supported&&n.permission!==`denied`?a?D`
|
|
<button
|
|
class="btn"
|
|
?disabled=${n.loading||!e.connected}
|
|
@click=${()=>e.onWebPushUnsubscribe?.()}
|
|
>
|
|
${N.x} ${F(`configView.notifications.unsubscribe`)}
|
|
</button>
|
|
${i?D`<button
|
|
class="btn primary"
|
|
?disabled=${n.loading||!e.connected}
|
|
@click=${()=>e.onWebPushTest?.()}
|
|
>
|
|
${N.send} ${F(`configView.notifications.sendTest`)}
|
|
</button>`:E}
|
|
`:D`
|
|
<button
|
|
class="btn primary"
|
|
?disabled=${n.loading||!e.connected}
|
|
@click=${()=>e.onWebPushSubscribe?.()}
|
|
>
|
|
${n.loading?N.loader:E}
|
|
${n.loading?F(`configView.notifications.subscribing`):F(`configView.notifications.enable`)}
|
|
</button>
|
|
`:E;return D`
|
|
<div class="settings-page">
|
|
<section class="settings-section" id=${Qn.notifications}>
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.notifications.title`)}</h2>
|
|
<div class="settings-section__actions">
|
|
${R({kind:c,label:s})}
|
|
</div>
|
|
</div>
|
|
${n.permission===`install-required`?D`<p class="settings-section__desc">
|
|
${F(`configView.notifications.iosInstallRequired`)}
|
|
</p>`:E}
|
|
<div class="settings-group">
|
|
${z({title:F(`configView.notifications.browserSupport`),control:I(n.supported?F(`configView.notifications.available`):F(`configView.notifications.notSupported`))})}
|
|
${z({title:F(`configView.notifications.permission`),control:I(r)})}
|
|
${z({title:F(`configView.notifications.status`),control:R({kind:i?`ok`:`muted`,label:o})})}
|
|
${l===E?E:D`
|
|
<div class="settings-row">
|
|
<div class="settings-row__control">${l}</div>
|
|
</div>
|
|
`}
|
|
${n.permission===`denied`?z({title:F(`configView.notifications.blocked`),description:F(`configView.notifications.blockedHint`),control:R({kind:`danger`,label:F(`configView.notifications.denied`)})}):E}
|
|
${n.error?D`
|
|
<div class="settings-row">
|
|
<div class="settings-row__text">
|
|
<span class="cfg-field__error">${T(n.error)}</span>
|
|
</div>
|
|
</div>
|
|
`:E}
|
|
</div>
|
|
</section>
|
|
${i&&n.preferences?D`<div class="settings-page" ?inert=${n.loading}>
|
|
${n.preferences.durableIdentity?Ka(n.preferences.user,t=>e.onWebPushSetUserPreferences?.(t)):E}
|
|
${qa(n.preferences.device,t=>e.onWebPushSetDevicePreferences?.(t))}
|
|
</div>`:E}
|
|
</div>
|
|
`}var Xa;function Za(){return(Za=e((()=>{O(),P(),V(),M(),w(),Zn(),Xa=[[`approvalRequested`,()=>F(`configView.notifications.approvalRequested`)],[`agentFinished`,()=>F(`configView.notifications.agentFinished`)],[`agentQuestion`,()=>F(`configView.notifications.agentQuestion`)],[`scheduledTaskFailed`,()=>F(`configView.notifications.scheduledTaskFailed`)],[`backgroundTaskFailed`,()=>F(`configView.notifications.backgroundTaskFailed`)]]})))()}function Qa(e){let t=e.replace(/-([a-zA-Z])/g,(e,t)=>t.toUpperCase());return F(`languages.${t}`)}function $a(e,t,n){let r=e??`system`,i=`${F(`common.system`)} (${Qa(t)})`;return D`
|
|
<wa-select
|
|
class="settings-select"
|
|
.value=${r}
|
|
@change=${e=>{let t=e.currentTarget.value;n(t===`system`?void 0:t)}}
|
|
>
|
|
<span slot="label" class="settings-control__sr-label">${F(`quickSettings.language`)}</span>
|
|
<wa-option value="system" .label=${i} .selected=${r===`system`}>
|
|
${i}
|
|
</wa-option>
|
|
${Ct.map(e=>{let t=Qa(e);return D`
|
|
<wa-option value=${e} .label=${t} .selected=${e===r}>
|
|
${t}
|
|
</wa-option>
|
|
`})}
|
|
</wa-select>
|
|
`}function eo(){return(eo=e((()=>{O(),In(),M()})))()}function to(e){return z({title:e.title,description:e.description,control:D`
|
|
<select
|
|
class="settings-select"
|
|
?data-settings-send-shortcut=${e.setting===`send-shortcut`}
|
|
?data-settings-follow-up-mode=${e.setting===`follow-up-mode`}
|
|
?data-settings-catalog-open-target=${e.setting===`catalog-open-target`}
|
|
aria-label=${e.title}
|
|
.value=${e.value}
|
|
@change=${t=>e.onChange(t.currentTarget.value)}
|
|
>
|
|
${e.options.map(t=>D`
|
|
<option value=${t.value} ?selected=${e.value===t.value}>
|
|
${t.label}
|
|
</option>
|
|
`)}
|
|
</select>
|
|
`})}function no(){return(no=e((()=>{O(),V()})))()}function ro(e){return F(e===`profile`?`configView.profileSyncedHint`:e===`device-local`?`quickSettings.personal.browserOnly`:e===`pending`?`configView.syncPendingHint`:`configView.syncedHint`)}function io(e){let t=B(e.localeResetValue?Qa(e.localeResetValue):F(`common.system`),e.localeOverridden),n=ro(e.localeProvenance);return D`
|
|
<section id=${v.language} class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`quickSettings.language`)}</h2>
|
|
</div>
|
|
<div class="settings-group">
|
|
${z({title:F(`quickSettings.language`),description:D`${t} ${n}`,control:$a(e.localeOverride,e.systemLocale,e.onLocaleChange)})}
|
|
</div>
|
|
</section>
|
|
`}function ao(e){let t=e.state;if(!t||!e.onSelect)return E;let n=t.selectedDeviceId.trim(),r=t.devices.some(e=>e.deviceId===n),i=[{label:e.systemDefaultLabel,value:``},...t.devices.map(e=>({label:e.label,value:e.deviceId})),...n&&!r?[{label:e.fallbackLabel(t.devices.length+1),value:n}]:[]],a=`${F(`common.refresh`)}: ${e.title}`,o=!1,s=()=>{o||!t.permissionRequired||(o=!0,e.onRefresh?.())},c=e=>{e.button===0&&s()},l=e=>{[`Enter`,` `,`ArrowDown`,`ArrowUp`,`F4`].includes(e.key)&&s()},u=t.error?D`<span role="alert">${t.error}</span>`:!t.loading&&t.devices.length===0?e.emptyLabel:void 0;return z({title:e.title,description:D`${u?D`${u}<br />`:E}${F(`quickSettings.personal.browserOnly`)}`,control:D`
|
|
<select
|
|
class="settings-select settings-select--media-device"
|
|
data-settings-microphone=${e.dataAttribute===`microphone`?``:E}
|
|
data-settings-camera=${e.dataAttribute===`camera`?``:E}
|
|
aria-label=${e.title}
|
|
.value=${n}
|
|
@pointerdown=${c}
|
|
@keydown=${l}
|
|
@change=${t=>e.onSelect?.(t.currentTarget.value)}
|
|
>
|
|
${i.map(e=>D`
|
|
<option value=${e.value} ?selected=${e.value===n}>
|
|
${e.label}
|
|
</option>
|
|
`)}
|
|
</select>
|
|
<button
|
|
type="button"
|
|
class="btn btn--sm btn--icon"
|
|
aria-label=${a}
|
|
?disabled=${t.loading}
|
|
@click=${()=>e.onRefresh?.()}
|
|
>
|
|
${t.loading?N.loader:N.refresh}
|
|
</button>
|
|
`})}function oo(e){return ao({state:e.microphone,title:F(`chat.composer.microphoneInput`),systemDefaultLabel:F(`chat.composer.systemDefaultMicrophone`),emptyLabel:F(`chat.composer.noMicrophones`),fallbackLabel:e=>F(`chat.composer.microphoneFallback`,{number:String(e)}),dataAttribute:`microphone`,onRefresh:e.onMicrophoneRefresh,onSelect:e.onMicrophoneSelect})}function so(e){return ao({state:e.camera,title:F(`chat.composer.cameraInput`),systemDefaultLabel:F(`chat.composer.systemDefaultCamera`),emptyLabel:F(`chat.composer.noCameras`),fallbackLabel:e=>F(`chat.composer.cameraFallback`,{number:String(e)}),dataAttribute:`camera`,onRefresh:e.onCameraRefresh,onSelect:e.onCameraSelect})}function co(e,t){let n=e.chatFollowUpMode??`server`,r=e.serverQueueMode??F(`chat.followUpModeLoading`),i=e.chatFollowUpMode?F(`chat.followUpModeOverriding`,{mode:r}):F(`chat.followUpModeUsingServer`,{mode:r}),a=B(j.chatMessageMaxWidth,e.chatMessageMaxWidth!==void 0),o=B(e.chatSendShortcutResetValue===`modifier-enter`?F(`chat.sendShortcutModifierEnter`):F(`chat.sendShortcutEnter`),e.chatSendShortcutOverridden),s=ro(e.chatSendShortcutProvenance),c=ro(e.chatFollowUpModeProvenance),l=B(F(`chat.catalogOpenTargetViewer`),e.catalogOpenTarget!==j.catalogOpenTarget),u=B(F(`common.enabled`),(e.composerHoldToRecord??j.composerHoldToRecord)!==j.composerHoldToRecord),d=B(F(`common.disabled`),e.chatCollapseTaskProgress!==j.chatCollapseTaskProgress);return D`
|
|
<section id=${v.chat} class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.chatPrefs.title`)}</h2>
|
|
</div>
|
|
<div class="settings-group">
|
|
${z({title:F(`configView.chatPrefs.messageWidth`),description:D`${F(`configView.chatPrefs.messageWidthHint`)}<br />
|
|
${a} ${F(`quickSettings.personal.browserOnly`)}`,control:t})}
|
|
${L({title:F(`configView.chatPrefs.collapseTaskProgress`),description:D`${F(`configView.chatPrefs.collapseTaskProgressHint`)}<br />
|
|
${d} ${F(`quickSettings.personal.browserOnly`)}`,checked:e.chatCollapseTaskProgress,onChange:e.setChatCollapseTaskProgress})}
|
|
${to({title:F(`chat.sendShortcut`),value:e.chatSendShortcut,setting:`send-shortcut`,description:D`${o} ${s}`,options:[{value:`enter`,label:F(`chat.sendShortcutEnter`)},{value:`modifier-enter`,label:F(`chat.sendShortcutModifierEnter`)}],onChange:t=>e.setChatSendShortcut(Me(t))})}
|
|
${z({title:F(`chat.followUpMode`),description:D`${i} ${c}`,control:D`
|
|
<select
|
|
class="settings-select"
|
|
data-settings-follow-up-mode
|
|
aria-label=${F(`chat.followUpMode`)}
|
|
.value=${n}
|
|
@change=${t=>{let n=t.currentTarget.value;e.setChatFollowUpMode(n===`server`?void 0:Ae(n))}}
|
|
>
|
|
<option value="server" ?selected=${n===`server`}>
|
|
${F(`chat.followUpModeServer`,{mode:r})}
|
|
</option>
|
|
<option value="steer" ?selected=${n===`steer`}>
|
|
${F(`chat.followUpModeSteer`)}
|
|
</option>
|
|
<option value="queue" ?selected=${n===`queue`}>
|
|
${F(`chat.followUpModeQueue`)}
|
|
</option>
|
|
</select>
|
|
${e.chatFollowUpModeOverridden?D`<button
|
|
type="button"
|
|
class="btn btn--sm"
|
|
@click=${e.resetChatFollowUpMode}
|
|
>
|
|
${F(`chat.followUpModeReset`)}
|
|
</button>`:E}
|
|
`})}
|
|
${to({title:F(`chat.catalogOpenTarget`),value:e.catalogOpenTarget,setting:`catalog-open-target`,description:D`${l}
|
|
${F(`quickSettings.personal.browserOnly`)}`,options:[{value:`viewer`,label:F(`chat.catalogOpenTargetViewer`)},{value:`terminal`,label:F(`chat.catalogOpenTargetTerminal`)}],onChange:t=>e.setCatalogOpenTarget(Be(t))})}
|
|
${oo(e)} ${so(e)}
|
|
${e.setComposerHoldToRecord?L({title:F(`chat.composer.holdToRecordSetting`),description:D`${F(`chat.composer.holdToRecordSettingDescription`)}<br />
|
|
${u} ${F(`quickSettings.personal.browserOnly`)}`,checked:e.composerHoldToRecord??j.composerHoldToRecord,onChange:e.setComposerHoldToRecord}):E}
|
|
</div>
|
|
</section>
|
|
`}function lo(e){if(!e.setLobsterPetVisits||!e.setLobsterPetSounds)return E;let t=e.lobsterPetVisits??j.lobsterPetVisits,n=e.lobsterPetSounds??j.lobsterPetSounds,r=B(F(`common.enabled`),t!==j.lobsterPetVisits),i=B(F(`common.disabled`),n!==j.lobsterPetSounds),a=en(),o=Ht.filter(e=>a.has(e.id)).length;return D`
|
|
<section class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`quickSettings.appearance.lobsterdex`)}</h2>
|
|
</div>
|
|
<div class="settings-group">
|
|
${L({title:F(`quickSettings.appearance.lobsterVisits`),description:t?D`${F(`quickSettings.appearance.lobsterVisitsOn`)}<br />
|
|
${r} ${F(`quickSettings.personal.browserOnly`)}`:D`${F(`quickSettings.appearance.lobsterVisitsOff`)}<br />
|
|
${r} ${F(`quickSettings.personal.browserOnly`)}`,checked:t,onChange:t=>e.setLobsterPetVisits?.(t)})}
|
|
${L({title:F(`quickSettings.appearance.lobsterSounds`),description:n?D`${F(`quickSettings.appearance.lobsterSoundsOn`)}<br />
|
|
${i} ${F(`quickSettings.personal.browserOnly`)}`:D`${F(`quickSettings.appearance.lobsterSoundsOff`)}<br />
|
|
${i} ${F(`quickSettings.personal.browserOnly`)}`,checked:n,onChange:t=>e.setLobsterPetSounds?.(t),onAct:e=>{e&&Vt()}})}
|
|
${z({title:F(`quickSettings.appearance.lobsterdex`),description:F(`quickSettings.appearance.lobsterdexSeen`,{seen:String(o),total:String(Ht.length)}),stacked:!0,control:D`
|
|
<div class="lobsterdex__gallery">
|
|
<div class="lobsterdex">
|
|
${Ht.map(e=>{let t=mn(e),n=a.get(e.id),r=n!==void 0,i=n?.shinySeenAt!=null,o=r?n.name??zt(e.id):`?`,s=i?`${o} ✦`:o,c=$t[e.id],l=r?c.flavor:c.hint,u=r&&n.firstSeenAt!==null?F(`quickSettings.appearance.lobsterdexFirstVisited`,{name:o,date:new Date(n.firstSeenAt).toLocaleDateString()}):null,d=[s,l,u].filter(e=>e!==null).join(`
|
|
`);return D`
|
|
<openclaw-tooltip>
|
|
<span
|
|
class="lobsterdex__mini lobster-pet--palette-${e.id} ${r?``:`lobsterdex__mini--unseen`}"
|
|
style=${Yt(t)}
|
|
tabindex="0"
|
|
role="img"
|
|
aria-label=${d}
|
|
>
|
|
${Bt(t,{standalone:!0})}
|
|
${i?D`<span class="lobsterdex__mini-star" aria-hidden="true">✦</span>`:E}
|
|
</span>
|
|
<span slot="content" class="lobsterdex__tooltip">
|
|
<strong>${s}</strong>
|
|
<span>${l}</span>
|
|
${u?D`<span>${u}</span>`:E}
|
|
</span>
|
|
</openclaw-tooltip>
|
|
`})}
|
|
</div>
|
|
${e.lobsterdexHref?D`<a
|
|
class="btn btn--sm lobsterdex__open"
|
|
href=${e.lobsterdexHref}
|
|
@click=${t=>{y(t)&&(t.preventDefault(),e.onOpenLobsterdex?.())}}
|
|
>${F(`quickSettings.appearance.lobsterdexOpen`)}</a
|
|
>`:E}
|
|
</div>
|
|
`})}
|
|
</div>
|
|
</section>
|
|
`}function uo(e){let t=[...e.hiddenSessionCatalogIds].toSorted(),n=B(F(`common.enabled`),e.sidebarLiveActivity!==j.sidebarLiveActivity),r=e.setSessionDeleteConfirm,i=e.sessionDeleteConfirm??j.sessionDeleteConfirm,a=B(F(`common.enabled`),i!==j.sessionDeleteConfirm);return D`
|
|
<section id=${v.sidebar} class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.sidebarPrefs.title`)}</h2>
|
|
</div>
|
|
<p class="settings-section__desc">${F(`configView.sidebarPrefs.hint`)}</p>
|
|
<div class="settings-group">
|
|
${L({title:F(`configView.sidebarPrefs.liveActivity`),description:D`${F(`configView.sidebarPrefs.liveActivityHint`)}<br />
|
|
${n} ${F(`quickSettings.personal.browserOnly`)}`,checked:e.sidebarLiveActivity,onChange:e.setSidebarLiveActivity})}
|
|
${r?L({title:F(`configView.sidebarPrefs.deleteConfirm`),description:D`${F(`configView.sidebarPrefs.deleteConfirmHint`)}<br />
|
|
${a} ${F(`quickSettings.personal.browserOnly`)}`,checked:i,onChange:r}):E}
|
|
</div>
|
|
${t.length>0?D`
|
|
<div class="settings-section__header settings-section__header--subsection">
|
|
<h3 class="settings-section__heading">${F(`chat.sidebar.hiddenSessionSections`)}</h3>
|
|
</div>
|
|
<div class="settings-group">
|
|
${t.map(t=>z({title:e.hiddenSessionCatalogLabels.get(t)??t,description:F(`quickSettings.personal.browserOnly`),control:D`<button
|
|
type="button"
|
|
class="btn btn--sm"
|
|
@click=${()=>e.setSessionCatalogHidden(t,!1)}
|
|
>
|
|
${F(`chat.sidebar.showSessionSection`)}
|
|
</button>`}))}
|
|
</div>
|
|
`:E}
|
|
<div class="settings-section__header settings-section__header--subsection">
|
|
<h3 class="settings-section__heading">${F(`configView.sessionObserver.title`)}</h3>
|
|
</div>
|
|
<p class="settings-section__desc">${F(`configView.sessionObserver.hint`)}</p>
|
|
${sa({enabled:e.sessionObserverEnabled!==!1,utilityModel:e.sessionObserverUtilityModel,resolvedUtilityModel:e.sessionObserverResolvedModel,models:e.sessionObserverModels??[],modelsUnavailable:e.sessionObserverModelsUnavailable===!0,disabled:e.sessionObserverDisabled===!0,onEnabledChange:t=>e.setSessionObserverEnabled?.(t),onUtilityModelChange:t=>e.setSessionObserverUtilityModel?.(t)})}
|
|
</section>
|
|
`}function fo(){return(fo=e((()=>{O(),De(),P(),tn(),qt(),On(),Gt(),xt(),V(),M(),eo(),S(),la(),no()})))()}function po(e,t){return e===`custom`&&t!==`custom`?D`<span class="settings-theme-card__icon" aria-hidden="true"
|
|
>${N.download}</span
|
|
>`:D`
|
|
<span class="settings-theme-card__palette" aria-hidden="true">
|
|
<span class="settings-theme-card__chip settings-theme-card__chip--accent"></span>
|
|
<span class="settings-theme-card__chip settings-theme-card__chip--accent-2"></span>
|
|
<span class="settings-theme-card__chip settings-theme-card__chip--bg"></span>
|
|
</span>
|
|
`}function mo(e){return e.hasCustomTheme&&e.customThemeLabel?e.customThemeLabel:F(`configView.appearance.importedTheme`)}function ho(){(typeof requestAnimationFrame==`function`?requestAnimationFrame:e=>window.setTimeout(()=>e(0),0))(()=>{let e=globalThis.document?.querySelector(`[data-custom-theme-import-input]`);e&&(typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`center`,behavior:an()}),e.focus(),e.select())})}function go(e,t){let n=Object.entries(Ke).map(([e,t])=>({value:e,label:e===`system`?F(`configView.appearance.fonts.system`):t.label,description:F(`configView.appearance.fontNotes.${e}`),labelStyle:`font-family: ${t.stack}`}));return D`
|
|
<section class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.appearance.typography`)}</h2>
|
|
</div>
|
|
<div class="settings-group">
|
|
${[`ui`,`chat`].map(r=>{let i=r===`ui`,a=F(`configView.appearance.fonts.${r}`),o=et[e.theme][r];return z({title:a,description:ro(i?e.fontUiProvenance:e.fontChatProvenance),stackedOnNarrow:!0,control:Ln({id:`settings-font-${r}`,label:a,value:(i?e.fontUi:e.fontChat)??`theme`,options:[{value:`theme`,label:F(`configView.appearance.fonts.themeDefault`),description:F(`configView.appearance.fonts.themeFace`,{theme:t,face:Ke[o].label}),labelStyle:`font-family: ${Ke[o].stack}`},...n],onOpen:mt,onChange:t=>(i?e.setFontUi:e.setFontChat)(Je(t))})})})}
|
|
<div class="settings-row settings-row--stacked">
|
|
<div class="settings-typography-preview">
|
|
<div class="settings-typography-preview__caption">
|
|
${F(`configView.appearance.fonts.previewCaption`)}
|
|
</div>
|
|
<p class="settings-typography-preview__prose">
|
|
${F(`configView.appearance.fonts.previewProse`)}
|
|
</p>
|
|
<code class="settings-typography-preview__code"
|
|
>${F(`configView.appearance.fonts.previewCode`)}</code
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
`}function _o(e,t){let n=e.viewState,r=e.hasCustomTheme||e.customThemeImportExpanded===!0;r&&e.customThemeImportFocusToken!=null&&e.customThemeImportFocusToken!==n.lastCustomThemeImportFocusToken&&(n.lastCustomThemeImportFocusToken=e.customThemeImportFocusToken,ho());let i=mo(e),a=[...yo.map(e=>({id:e.id,label:F(e.labelKey),description:F(e.descriptionKey)})),{id:`custom`,label:e.hasCustomTheme?i:F(`configView.appearance.import`),description:e.hasCustomTheme?F(`configView.appearance.importedFrom`,{name:i}):F(`configView.appearance.importHint`)}],o=a.find(t=>t.id===e.themeResetValue)?.label??F(`configView.themes.claw.label`),s=e.themeModeResetValue===`light`?F(`common.light`):e.themeModeResetValue===`dark`?F(`common.dark`):F(`common.system`),c=ro(e.themeProvenance),l=ro(e.themeModeProvenance),u=ro(e.accentProvenance),d=!!(e.accent&&!bo.some(t=>t.hex===e.accent)),f=bo.find(t=>t.hex===e.accent),p=e.accent==null?F(`configView.appearance.usingInheritedAccent`):F(`configView.appearance.usingAccent`,{value:F(f?f.labelKey:`configView.appearance.customAccent`)});return D`
|
|
<div class="settings-page">
|
|
${io(e)}
|
|
<section id=${v.theme} class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.appearance.theme`)}</h2>
|
|
</div>
|
|
<p class="settings-section__desc">
|
|
${F(`configView.appearance.chooseTheme`)}
|
|
${B(o,e.themeOverridden)}
|
|
${c}
|
|
</p>
|
|
<div class="settings-group">
|
|
<div class="settings-row settings-row--stacked">
|
|
<div class="settings-theme-grid">
|
|
${a.map(t=>D`
|
|
<button
|
|
class="settings-theme-card settings-theme-card--${t.id} ${t.id===e.theme?`settings-theme-card--active`:``}"
|
|
aria-pressed=${t.id===`custom`&&!e.hasCustomTheme?E:String(t.id===e.theme)}
|
|
title=${t.description}
|
|
@click=${n=>{if(t.id===`custom`&&!e.hasCustomTheme){e.onOpenCustomThemeImport?.();return}if(t.id!==e.theme||t.id===e.themeResetValue&&e.themeOverridden){let r={element:n.currentTarget??void 0};e.setTheme(t.id,r)}}}
|
|
>
|
|
${po(t.id,e.theme)}
|
|
<span class="settings-theme-card__label">${t.label}</span>
|
|
</button>
|
|
`)}
|
|
</div>
|
|
</div>
|
|
${z({title:F(`common.colorMode`),description:D`${B(s,e.themeModeOverridden)}
|
|
${l}`,stackedOnNarrow:!0,control:Dn({value:e.themeMode,options:[{value:`system`,label:F(`common.system`)},{value:`light`,label:F(`common.light`)},{value:`dark`,label:F(`common.dark`)}],ariaLabel:F(`common.colorMode`),onChange:(t,n)=>e.setThemeMode(t,{element:n}),onReselect:(t,n)=>{e.themeModeOverridden&&t===e.themeModeResetValue&&e.setThemeMode(t,{element:n})}})})}
|
|
<div class="settings-row settings-row--stacked">
|
|
${r?D`
|
|
<div class="settings-theme-import">
|
|
<div class="settings-theme-import__copy">
|
|
<div class="settings-theme-import__title">
|
|
${F(`configView.appearance.importFromTweakcn`)}
|
|
</div>
|
|
<p class="settings-theme-import__hint">
|
|
${F(`configView.appearance.tweakcnInstructions`)}
|
|
</p>
|
|
</div>
|
|
<a
|
|
class="settings-theme-import__external"
|
|
href="https://tweakcn.com/editor/theme"
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
>
|
|
${F(`configView.appearance.browseTweakcn`)} ${N.externalLink}
|
|
</a>
|
|
<label class="settings-theme-import__field">
|
|
<span class="settings-theme-import__label"
|
|
>${F(`configView.appearance.themeLink`)}</span
|
|
>
|
|
${t.customThemeImport}
|
|
</label>
|
|
<div class="settings-theme-import__actions">
|
|
<button
|
|
class="btn btn--sm primary"
|
|
?disabled=${e.customThemeImportBusy||e.customThemeImportUrl.trim().length===0}
|
|
@click=${e.onImportCustomTheme}
|
|
>
|
|
${e.customThemeImportBusy?F(`common.importing`):e.hasCustomTheme?F(`configView.appearance.replace`,{name:i}):F(`configView.appearance.importTheme`)}
|
|
</button>
|
|
${e.hasCustomTheme?D`<button
|
|
class="btn btn--sm danger"
|
|
@click=${e.onClearCustomTheme}
|
|
>
|
|
${F(`configView.appearance.clear`,{name:i})}
|
|
</button>`:E}
|
|
</div>
|
|
${e.hasCustomTheme?D`<div class="settings-theme-import__meta">
|
|
<span class="settings-theme-import__meta-label"
|
|
>${F(`configView.appearance.loaded`)}</span
|
|
>
|
|
<span class="settings-theme-import__meta-value"
|
|
>${i} · ${e.customThemeSourceUrl??`tweakcn`}</span
|
|
>
|
|
</div>`:E}
|
|
${e.customThemeImportMessage?D`<div
|
|
class="settings-theme-import__message settings-theme-import__message--${e.customThemeImportMessage.kind}"
|
|
role=${e.customThemeImportMessage.kind===`error`?`alert`:`status`}
|
|
>
|
|
${e.customThemeImportMessage.text}
|
|
</div>`:E}
|
|
</div>
|
|
`:D`<p class="settings-theme-import__inline-hint">
|
|
${F(`configView.appearance.inlineHintBefore`)}
|
|
<strong>${F(`configView.appearance.import`)}</strong>
|
|
${F(`configView.appearance.inlineHintAfter`)}
|
|
</p>`}
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
${go(e,a.find(t=>t.id===e.theme).label)}
|
|
|
|
<section id=${v.accent} class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.appearance.accent`)}</h2>
|
|
</div>
|
|
<p class="settings-section__desc">${F(`configView.appearance.accentHint`)}</p>
|
|
<div class="settings-group">
|
|
<div class="settings-row settings-row--stacked">
|
|
<div class="settings-accent-swatches">
|
|
${bo.map(t=>{let n=t.hex===e.accent,r=F(t.labelKey),i=t.hex?``:` settings-accent-theme--${e.theme}`;return D`
|
|
<button
|
|
type="button"
|
|
class="settings-accent-swatch${i} ${n?`settings-accent-swatch--active`:``}"
|
|
style=${Ce({"--settings-accent-swatch":t.hex??`var(--theme-chip-accent, var(--accent))`})}
|
|
data-accent-preset=${t.id}
|
|
aria-label=${r}
|
|
aria-pressed=${String(n)}
|
|
title=${r}
|
|
@click=${()=>e.setAccent(t.hex)}
|
|
>
|
|
${n?D`<span class="settings-accent-swatch__check" aria-hidden="true"
|
|
>${N.check}</span
|
|
>`:E}
|
|
</button>
|
|
`})}
|
|
<span
|
|
class="settings-accent-swatch settings-accent-swatch--custom ${d?`settings-accent-swatch--active`:``}"
|
|
style=${Ce({"--settings-accent-swatch":e.accent??bo[1].hex,"--settings-accent-swatch-ink":Ie(e.accent??bo[1].hex)})}
|
|
>
|
|
<input
|
|
type="color"
|
|
class="settings-accent-swatch__input"
|
|
data-accent-custom
|
|
aria-label=${F(`configView.appearance.customAccent`)}
|
|
aria-describedby="settings-accent-status"
|
|
title=${F(`configView.appearance.customAccent`)}
|
|
.value=${e.accent??bo[1].hex}
|
|
@input=${t=>e.setAccent(t.currentTarget.value)}
|
|
/>
|
|
<span class="settings-accent-swatch__picker" aria-hidden="true"
|
|
>${N.pipette}</span
|
|
>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<p id="settings-accent-status" class="settings-section__desc settings-accent-status">
|
|
<span class="settings-accent-status__selection">${p}</span>
|
|
<span class="settings-accent-status__scope">${u}</span>
|
|
</p>
|
|
</section>
|
|
|
|
<section id=${v.textSize} class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.appearance.textSize`)}</h2>
|
|
</div>
|
|
<p class="settings-section__desc">
|
|
${B(`${j.textScale}%`,e.textScaleOverridden)}
|
|
${F(`quickSettings.personal.browserOnly`)}
|
|
</p>
|
|
<div class="settings-group">
|
|
<div class="settings-row settings-row--stacked">
|
|
<div class="settings-text-scale">
|
|
<div class="settings-text-scale__options">
|
|
${Pe.map(t=>D`
|
|
<button
|
|
type="button"
|
|
class="settings-text-scale__btn ${t===e.textScale?`active`:``}"
|
|
aria-pressed=${String(t===e.textScale)}
|
|
@click=${()=>e.setTextScale(t)}
|
|
>
|
|
<span class="settings-text-scale__sample">${F(vo[t])}</span>
|
|
<span class="settings-text-scale__label">${t}%</span>
|
|
</button>
|
|
`)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
${uo(e)} ${lo(e)}
|
|
${co(e,t.chatMessageWidth)}
|
|
|
|
<section id=${v.connection} class="settings-section">
|
|
<div class="settings-section__header">
|
|
<h2 class="settings-section__heading">${F(`configView.connection.title`)}</h2>
|
|
</div>
|
|
<div class="settings-group">
|
|
${z({title:F(`configView.connection.gateway`),control:I(e.gatewayUrl||`-`,{mono:!0})})}
|
|
${z({title:F(`configView.connection.status`),control:R({kind:e.connected?`ok`:`muted`,label:e.connected?F(`common.connected`):F(`common.offline`)})})}
|
|
${e.assistantName?z({title:F(`configView.connection.assistant`),control:I(e.assistantName)}):E}
|
|
</div>
|
|
</section>
|
|
</div>
|
|
`}var vo,yo,bo;function xo(){return(xo=e((()=>{O(),Se(),De(),st(),P(),Rn(),V(),M(),S(),fo(),vo={90:`configView.textSizes.small`,100:`configView.textSizes.default`,110:`configView.textSizes.large`,125:`configView.textSizes.xl`,140:`configView.textSizes.xxl`},yo=[{id:`claw`,labelKey:`configView.themes.claw.label`,descriptionKey:`configView.themes.claw.description`},{id:`knot`,labelKey:`configView.themes.knot.label`,descriptionKey:`configView.themes.knot.description`},{id:`dash`,labelKey:`configView.themes.dash.label`,descriptionKey:`configView.themes.dash.description`},{id:`absolutely`,labelKey:`configView.themes.absolutely.label`,descriptionKey:`configView.themes.absolutely.description`},{id:`tide`,labelKey:`configView.themes.tide.label`,descriptionKey:`configView.themes.tide.description`},{id:`beacon`,labelKey:`configView.themes.beacon.label`,descriptionKey:`configView.themes.beacon.description`},{id:`phosphor`,labelKey:`configView.themes.phosphor.label`,descriptionKey:`configView.themes.phosphor.description`}],bo=[{id:`default`,hex:void 0,labelKey:`configView.appearance.accents.default`},{id:`claw`,hex:`#ff5c5c`,labelKey:`configView.appearance.accents.claw`},{id:`coral`,hex:`#ff8066`,labelKey:`configView.appearance.accents.coral`},{id:`amber`,hex:`#f5b942`,labelKey:`configView.appearance.accents.amber`},{id:`mint`,hex:`#52c99a`,labelKey:`configView.appearance.accents.mint`},{id:`teal`,hex:`#35b9b0`,labelKey:`configView.appearance.accents.teal`},{id:`blue`,hex:`#5b9cf6`,labelKey:`configView.appearance.accents.blue`},{id:`violet`,hex:`#a78bfa`,labelKey:`configView.appearance.accents.violet`},{id:`pink`,hex:`#f472b6`,labelKey:`configView.appearance.accents.pink`},{id:`slate`,hex:`#8795a8`,labelKey:`configView.appearance.accents.slate`}]})))()}function So(e){return e.length>0?e.join(`.`):F(`configView.root`)}function Co(e,t){if(!e||!t)return[];let n=[],r=0;function i(e,t,r){n.length<Mo&&n.push({path:e,from:t,to:r})}function a(e,t,n){if(e.length!==t.length||e.length>No)return!0;for(let r=0;r<e.length;r+=1)if(s(e[r],t[r],n+1))return!0;return!1}function o(e,t,n){let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!0;for(let i of r)if(!Object.hasOwn(t,i)||s(e[i],t[i],n+1))return!0;return!1}function s(e,t,n){return r+=1,r>jo||n>Ao?!0:e===t?!1:typeof e==typeof t?typeof e!=`object`||!e||t===null?e!==t:Array.isArray(e)||Array.isArray(t)?Array.isArray(e)&&Array.isArray(t)?a(e,t,n+1):!0:o(e,t,n+1):!0}function c(e,t,o,s){if(r+=1,r>jo||s>Ao||n.length>=Mo||e===t)return;if(typeof e!=typeof t){i(o,e,t);return}if(typeof e!=`object`||!e||t===null){e!==t&&i(o,e,t);return}if(Array.isArray(e)||Array.isArray(t)){(Array.isArray(e)&&Array.isArray(t)&&a(e,t,s+1)||!Array.isArray(e)||!Array.isArray(t))&&i(o,e,t);return}let l=e,u=t,d=new Set([...Object.keys(l),...Object.keys(u)]);for(let e of d)c(l[e],u[e],[...o,e],s+1)}return c(e,t,[],0),n}function wo(e,t,n){if(e.rawDiffCache?.original===t&&e.rawDiffCache.current===n)return e.rawDiffCache.diff;if(t.length>Po||n.length>Po)return e.rawDiffCache={original:t,current:n,diff:[]},e.rawDiffCache.diff;try{let r=xe(t),i=xe(n);if(!r||!i||typeof r!=`object`||typeof i!=`object`||Array.isArray(r)||Array.isArray(i))return e.rawDiffCache={original:t,current:n,diff:[]},[];let a=Co(r,i);return e.rawDiffCache={original:t,current:n,diff:a},a}catch{return te()&&(e.rawDiffCache={original:t,current:n,diff:[]}),[]}}function To(e,t=40){if(Array.isArray(e))return F(e.length===1?`configView.itemCount`:`configView.itemCountPlural`,{count:String(e.length)});let r;try{r=JSON.stringify(e)??String(e)}catch{r=String(e)}return r.length<=t?r:n(r,t-3)+`...`}function Eo(e,t){let n=e.split(`.`);return n.length===t.length&&n.every((e,n)=>e===`*`||e===t[n])}function Do(e,t){return Object.entries(t).some(([t,n])=>!!n.sensitive&&Eo(t,e))}function Oo(e,t){for(let n=1;n<=e.length;n+=1){let r=e.slice(0,n),i=So(r);if((de(r,t)?.sensitive??!1)||Do(r,t)||pr(i))return!0}return!1}function ko(e,t,n,r){let i=dr(t,e,n)>0;return!r&&t!=null&&(Oo(e,n)||i)?gr():To(t)}var Ao,jo,Mo,No,Po;function Fo(){return(Fo=e((()=>{mr(),fr(),M(),h(),Ao=64,jo=2e4,Mo=1e3,No=2e3,Po=2e5})))()}function Io(e){return Lo.has(e)}var Lo;function Ro(){return(Ro=e((()=>{Lo=new Set([`defaults`,`modelByChannel`])})))()}function zo(e,t){let n=Object.entries(e.properties??{}),r=n.filter(([e])=>!Io(e)).map(([e,n])=>({key:e,label:de([`channels`,e],t)?.label??n.title??me(e),keys:[e]})).toSorted((e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key)),i=n.filter(([e])=>Io(e)).map(([e])=>e);return[...r,...i.length>0?[{key:null,label:F(`configView.categories.other`),keys:i}]:[]]}function Bo(e){return Vo[e]??N.file}var Vo,Ho,Uo;function Wo(){return(Wo=e((()=>{Ro(),fr(),P(),M(),Vo={all:N.layoutGrid,env:N.settings,update:N.download,agents:N.bot,auth:N.lock,channels:N.messageSquare,messages:N.mail,commands:N.terminal,hooks:N.link,skills:N.star,tools:N.wrench,gateway:N.globe,wizard:N.wandSparkles,meta:N.penLine,logging:N.fileText,browser:N.chrome,ui:N.panelsTopLeft,models:N.box,bindings:N.server,broadcast:N.radio,tts:N.music,session:N.users,cron:N.clock,discovery:N.search,talk:N.mic,plugins:N.asterisk,diagnostics:N.activity,cli:N.terminal,secrets:N.key,acp:N.users,mcp:N.server,__appearance__:N.sun,__notifications__:N.bell},Ho=[{id:`core`,sections:[`env`,`auth`,`update`,`meta`,`logging`,`diagnostics`,`cli`,`secrets`]},{id:`ai`,sections:[`agents`,`models`,`skills`,`tools`,`memory`,`session`]},{id:`communication`,sections:[`channels`,`messages`,`broadcast`,`__notifications__`,`talk`,`tts`]},{id:`security`,sections:[`security`,`approvals`]},{id:`automation`,sections:[`commands`,`hooks`,`bindings`,`cron`,`plugins`]},{id:`infrastructure`,sections:[`gateway`,`browser`,`nodeHost`,`discovery`,`acp`,`mcp`]},{id:`appearance`,sections:[`__appearance__`,`ui`,`wizard`]}],Uo=new Set(Ho.flatMap(e=>e.sections))})))()}function Go(e,t){if(!e||oe(e)!==`object`||!e.properties)return e;let n=t.include,r=t.exclude,i={};for(let t of Object.keys(e.properties)){if(n&&n.size>0&&!n.has(t)||r&&r.size>0&&r.has(t))continue;let a=e.properties[t];a&&(i[t]=a)}return{...e,properties:i}}function Ko(e){return l(e)?e:null}function qo(e){return e?.length?e.join(``):``}function Jo(e,t,n,r,i,a){let o=qo(n),s=qo(r),c=e.schemaAnalysisCache;if(c&&c.schema===t&&c.includeKey===o&&c.excludeKey===s)return c.analysis;let l=Go(t,{include:i,exclude:a}),u=hr(l);return e.schemaAnalysisCache={schema:t,includeKey:o,excludeKey:s,analysis:u},u}function Yo(e,t){if(!e||t===`<root>`)return!1;let n=t.split(`.`),r=(e,t)=>{if(t===n.length)return e!==void 0;if(typeof e!=`object`||!e)return!1;let i=n[t];return i===`*`?Object.values(e).some(e=>r(e,t+1)):!i||!Object.hasOwn(e,i)?!1:r(e[i],t+1)};return r(e,0)}function Xo(e){let t=`__OPENCLAW_CONFIG_PATHS__`,n=e.length===1?`configView.formUnsafeCount`:`configView.formUnsafeCountPlural`,[r,i=``]=F(n,{count:String(e.length),paths:t}).split(t);return D`
|
|
<span class="config-content-callout__text">
|
|
${r}${e.slice(0,3).map((e,t)=>D`${t>0?`, `:``}<code>${e}</code>`)}${i}${e.length>3?D` ${F(`configView.formUnsafeMore`,{count:String(e.length-3)})}`:E}
|
|
</span>
|
|
`}function Zo(){return(Zo=e((()=>{O(),fr(),_r(),M()})))()}function Qo(){return{rawRevealed:!1,rawDiffOpen:!1,envRevealed:!1,validityDismissed:!1,revealedSensitivePaths:new Set,lastCustomThemeImportFocusToken:null,lastConfigContextKey:null,lastFormModeForScroll:null}}function $o(e){e.rawRevealed=!1,e.rawDiffOpen=!1,e.envRevealed=!1,e.validityDismissed=!1,e.revealedSensitivePaths.clear(),e.lastCustomThemeImportFocusToken=null,e.rawDiffCache=void 0}function es(e){let t=e.includeSections?.join(``)??``,n=e.excludeSections?.join(``)??``;return[e.configPath??``,e.gatewayUrl,e.navRootLabel??``,t,n].join(``)}function ts(e,t){let n=ie(t);return n?e.revealedSensitivePaths.has(n):!1}function ns(e,t){let n=ie(t);n&&(e.revealedSensitivePaths.has(n)?e.revealedSensitivePaths.delete(n):e.revealedSensitivePaths.add(n))}function rs(){return(rs=e((()=>{fr()})))()}function is(e){return _o(e,{chatMessageWidth:D`
|
|
<input
|
|
class="settings-input"
|
|
data-settings-chat-message-width
|
|
type="text"
|
|
spellcheck="false"
|
|
placeholder="48rem"
|
|
.value=${e.chatMessageMaxWidth??``}
|
|
@change=${t=>{let n=t.currentTarget,r=ut(n.value);if(n.value.trim()&&!r){n.setCustomValidity(F(`configView.chatPrefs.messageWidthInvalid`)),n.reportValidity();return}n.setCustomValidity(``),n.value=r??``,e.setChatMessageMaxWidth(r)}}
|
|
/>
|
|
`,customThemeImport:D`
|
|
<input
|
|
class="settings-theme-import__input"
|
|
data-custom-theme-import-input
|
|
type="text"
|
|
spellcheck="false"
|
|
placeholder="https://tweakcn.com/editor/theme?theme=... or amethyst-haze"
|
|
.value=${e.customThemeImportUrl}
|
|
@input=${t=>e.onCustomThemeImportUrlChange(t.currentTarget.value)}
|
|
/>
|
|
`})}function as(e){let t=e.viewState,n=e.showModeToggle??!1,r=e.showRootTab??!0,i=e.valid==null?`unknown`:e.valid?`valid`:`invalid`,a=e.includeVirtualSections??!0,o=e.includeSections?.length?new Set(e.includeSections):null,s=e.excludeSections?.length?new Set(e.excludeSections):null,c=Jo(t,Ko(e.schema),e.includeSections,e.excludeSections,o,s),l=c.unsupportedPaths.filter(t=>t!==`<root>`&&(!e.activeSection||t===e.activeSection||t.startsWith(`${e.activeSection}.`))&&Yo(e.formValue,t)),d=l.length>0,f=e.forceShowAdvanced===!0||e.showAdvancedSettings,p=e.rawAvailable??!0,m=!!e.rawDraftPending&&p,ee=n&&p?e.formMode:`form`,h=m?`raw`:ee,g=e.onViewStateChange,_=e=>{queueMicrotask(()=>{let t=[(e instanceof Element?e:null)?.closest(`.config-lead`)?.parentElement?.querySelector(`.config-content`)??globalThis.document?.querySelector(`.config-content`),globalThis.document?.querySelector(`.shell--settings .content`)];for(let e of t)e&&(typeof e.scrollTo==`function`?e.scrollTo({top:0,left:0,behavior:`auto`}):(e.scrollTop=0,e.scrollLeft=0))})};t.lastFormModeForScroll!==null&&t.lastFormModeForScroll!==h&&_(null),t.lastFormModeForScroll=h;let v=es(e);t.lastConfigContextKey!==v&&($o(t),t.lastConfigContextKey=v);let y=t.envRevealed,ne=c.schema?.properties??{},re=new Set([`__appearance__`,`__notifications__`]),ie=e=>a&&re.has(e)&&(e===`__appearance__`||o?.has(e)===!0),ae=e=>F(`configView.sections.${e===`__appearance__`?`theme`:e===`__notifications__`?`notifications`:e}`),oe=Ho.map(e=>({id:e.id,label:F(`configView.categories.${e.id}`),sections:e.sections.filter(e=>(ie(e)||e in ne)&&(!o||o.has(e))&&(!s||!s.has(e))).map(e=>({key:e,label:ae(e)}))})).filter(e=>e.sections.length>0),se=Object.keys(ne).filter(e=>!Uo.has(e)).map(e=>({key:e,label:e.charAt(0).toUpperCase()+e.slice(1)})),b=se.length>0?{id:`other`,label:F(`configView.categories.other`),sections:se}:null,x=e.activeSection===`channels`?ne.channels:void 0,ce=x?zo(x,e.uiHints):[],S=ce.find(t=>t.key===e.activeSubsection)??ce[0],le=x&&S?{...c.schema,properties:{...ne,channels:{...x,properties:Object.fromEntries(Object.entries(x.properties??{}).filter(([e])=>S.keys.includes(e))),required:x.required?.filter(e=>S.keys.includes(e)),additionalProperties:!1}}}:c.schema,C=[...r?[{key:null,label:e.navRootLabel??F(`nav.settings`)}]:[],...[...oe,...b?[b]:[]].flatMap(e=>e.sections.map(e=>({key:e.key,label:e.label})))],w=e.settingsLayout??`tabs`,ue=[...oe,...b?[b]:[]];function de(){return D`
|
|
<div class="config-accordion-nav">
|
|
${ue.map(t=>{let n=t.sections.some(t=>t.key===e.activeSection),r=`config-accordion-panel-${t.id}`;return D`
|
|
<div class="config-accordion-group">
|
|
<button
|
|
class="config-accordion-group__header ${n?`config-accordion-group__header--active`:``}"
|
|
aria-expanded=${n?`true`:`false`}
|
|
aria-controls=${r}
|
|
@click=${r=>{let i=t.sections[0]?.key??null;e.onSectionChange(n?null:i),_(r.currentTarget)}}
|
|
>
|
|
<span class="config-accordion-group__icon">
|
|
${Bo(t.sections[0]?.key??`default`)}
|
|
</span>
|
|
<span>${t.label}</span>
|
|
<svg
|
|
class="config-accordion-group__chevron ${n?`config-accordion-group__chevron--open`:``}"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
width="14"
|
|
height="14"
|
|
>
|
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
</svg>
|
|
</button>
|
|
<div id=${r} class="config-accordion-group__items" ?hidden=${!n}>
|
|
${t.sections.map(t=>D`<button
|
|
class="config-accordion-group__item ${e.activeSection===t.key?`config-accordion-group__item--active`:``}"
|
|
@click=${n=>{e.onSectionChange(t.key),_(n.currentTarget)}}
|
|
>
|
|
<span class="config-accordion-group__item-icon">
|
|
${Bo(t.key)}
|
|
</span>
|
|
${t.label}
|
|
</button>`)}
|
|
</div>
|
|
</div>
|
|
`})}
|
|
</div>
|
|
`}let T=h===`raw`&&e.raw!==e.originalRaw;(!T||h!==`raw`)&&t.rawDiffOpen&&(t.rawDiffOpen=!1),(!T||h!==`raw`||!t.rawDiffOpen)&&(t.rawDiffCache=void 0);let fe=h===`raw`&&T&&t.rawDiffOpen?wo(t,e.originalRaw,e.raw):[];h===`raw`&&T&&t.rawDiffOpen&&!te()&&u().then(()=>g()).catch(()=>void 0);let pe=e.loading||e.saving||e.applying||e.updating,me=e.mutationAllowed!==!1,he=e.connected&&me&&!pe&&T,ge=a&&h===`form`&&e.activeSection===null&&!!o?.has(`__appearance__`),_e=T&&h===`raw`?D`<details
|
|
class="config-diff"
|
|
?open=${t.rawDiffOpen}
|
|
@toggle=${e=>{let n=e.target;t.rawDiffOpen!==n.open&&(t.rawDiffOpen=n.open,n.open||(t.rawDiffCache=void 0),g())}}
|
|
>
|
|
<summary class="config-diff__summary">
|
|
<span>${F(`configView.viewPendingChangesRaw`)}</span>
|
|
<svg
|
|
class="config-diff__chevron"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
>
|
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
</svg>
|
|
</summary>
|
|
<div class="config-diff__content">
|
|
${fe.length>0?fe.map(n=>D`<div class="config-diff__item">
|
|
<div class="config-diff__path">${So(n.path)}</div>
|
|
<div class="config-diff__values">
|
|
<span class="config-diff__from"
|
|
>${ko(n.path,n.from,e.uiHints,t.rawRevealed)}</span
|
|
>
|
|
<span class="config-diff__arrow">→</span>
|
|
<span class="config-diff__to"
|
|
>${ko(n.path,n.to,e.uiHints,t.rawRevealed)}</span
|
|
>
|
|
</div>
|
|
</div>`):D`<div class="config-diff__item">${F(`configView.rawDiffUnavailable`)}</div>`}
|
|
</div>
|
|
</details>`:E,ve=w!==`accordion`&&C.length>1,ye=ve?$n({id:`config-sections`,active:e.activeSection??`root`,tabs:C.map(e=>({value:e.key??`root`,label:e.label})),ariaLabel:F(`common.settingsSections`),panelId:`config-section-panel`,onSelect:t=>e.onSectionChange(t===`root`?null:t),onActivate:_}):E,be=n||ve,xe=i===`invalid`&&!t.validityDismissed,Se=be||w===`accordion`||xe||!!S,Ce=D`<div class="config-lead">
|
|
${be?D`<div class="config-toolbar">
|
|
${n?D`<div class="config-mode-toggle">
|
|
<button
|
|
class="config-mode-toggle__btn ${h===`form`?`active`:``}"
|
|
?disabled=${e.schemaLoading||!e.schema||m}
|
|
title=${m?F(`configView.rawDraftPendingFormTitle`):d?F(`configView.formUnsafeTitle`):``}
|
|
@click=${()=>e.onFormModeChange(`form`)}
|
|
>
|
|
${F(`configView.form`)}
|
|
</button>
|
|
<button
|
|
class="config-mode-toggle__btn ${h===`raw`?`active`:``}"
|
|
?disabled=${!p}
|
|
title=${F(p?`configView.rawTitle`:`configView.rawUnavailableTitle`)}
|
|
@click=${()=>e.onFormModeChange(`raw`)}
|
|
>
|
|
${F(`configView.raw`)}
|
|
</button>
|
|
</div>`:E}
|
|
${ye}
|
|
</div>`:E}
|
|
${w===`accordion`?de():E}
|
|
${S&&h===`form`?D`<div class="config-toolbar">
|
|
<label class="field">
|
|
<span>${F(`configView.channelSettings`)}</span>
|
|
<select
|
|
class="settings-select"
|
|
.value=${S.key??``}
|
|
@change=${t=>{let n=t.currentTarget;e.onSubsectionChange(n.value||null),_(t.currentTarget)}}
|
|
>
|
|
${ce.map(e=>D`<option value=${e.key??``} ?selected=${e.key===S.key}>
|
|
${e.label}
|
|
</option>`)}
|
|
</select>
|
|
</label>
|
|
</div>`:E}
|
|
${xe?D`<div class="config-validity-warning">
|
|
<svg
|
|
class="config-validity-warning__icon"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
width="16"
|
|
height="16"
|
|
>
|
|
<path
|
|
d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
|
|
></path>
|
|
<line x1="12" y1="9" x2="12" y2="13"></line>
|
|
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
</svg>
|
|
<span class="config-validity-warning__text">${F(`configView.invalidConfig`)}</span>
|
|
<button
|
|
class="btn btn--sm"
|
|
@click=${()=>{t.validityDismissed=!0,g()}}
|
|
>
|
|
${F(`configView.dismissWarning`)}
|
|
</button>
|
|
</div>`:E}
|
|
</div>`;return D`
|
|
${Se?Ce:E}
|
|
<div
|
|
id="config-section-panel"
|
|
class="config-content"
|
|
role=${ve?`tabpanel`:`region`}
|
|
aria-labelledby=${ve?`config-sections-tab-${e.activeSection??`root`}`:E}
|
|
aria-label=${ve?E:F(`common.settingsSections`)}
|
|
>
|
|
${e.activeSection===`__appearance__`?a?is(e):E:e.activeSection===`__notifications__`?a?Ya(e):E:h===`form`?D`
|
|
${d&&n&&p?D`<div class="config-content-callout">
|
|
<div class="callout info">
|
|
${Xo(l)}
|
|
<button
|
|
type="button"
|
|
class="btn btn--sm"
|
|
@click=${()=>e.onFormModeChange(`raw`)}
|
|
>
|
|
${F(`configView.openRawEditor`)}
|
|
</button>
|
|
</div>
|
|
</div>`:E}
|
|
${ge?is(e):E}
|
|
${e.schemaLoading?D`<div class="config-loading">
|
|
<div class="config-loading__spinner"></div>
|
|
<span>${F(`configView.loadingSchema`)}</span>
|
|
</div>`:ur({schema:le,uiHints:e.uiHints,value:e.formValue,embedded:e.embeddedEditor===!0,rawAvailable:p,disabled:pe||!e.formValue||!me,unsupportedPaths:c.unsupportedPaths,onPatch:e.onFormPatch,onRemove:e.onFormRemove,activeSection:e.activeSection,activeSubsection:null,showAdvanced:f,forceAdvancedSection:e.forceAdvancedSection,onShowAdvanced:()=>e.setShowAdvancedSettings(!0),onHideAdvanced:e.forceShowAdvanced?void 0:()=>e.setShowAdvancedSettings(!1),sectionActions:e.activeSection===`env`?D`<button
|
|
class="btn btn--sm ${y?`active`:``}"
|
|
aria-pressed=${y?`true`:`false`}
|
|
title=${F(y?`configView.hideEnvValues`:`configView.revealEnvValues`)}
|
|
@click=${()=>{t.envRevealed=!t.envRevealed,g()}}
|
|
>
|
|
${y?N.eyeOff:N.eye}
|
|
${F(`configView.peek`)}
|
|
</button>`:void 0,showSectionDocs:e.showSectionDocs,sectionPrelude:e.sectionPrelude,revealSensitive:e.activeSection===`env`&&y,isSensitivePathRevealed:e=>ts(t,e),onToggleSensitivePath:e=>{ns(t,e),g()}})}
|
|
`:(()=>{let n=dr(e.formValue,[],e.uiHints),r=n>0&&!t.rawRevealed;return D`<div class="settings-page">
|
|
${_e}
|
|
<!-- Raw editor: one group surface owning file-level operations. -->
|
|
<div class="settings-group">
|
|
<div class="settings-row settings-row--stacked">
|
|
<div class="config-raw-actions">
|
|
${e.onOpenFile&&e.openFileAllowed!==!1?D`<button class="btn btn--sm" @click=${e.onOpenFile}>
|
|
${N.fileText} ${F(`configView.open`)}
|
|
</button>`:E}
|
|
<button
|
|
class="btn btn--sm"
|
|
?disabled=${pe||!T}
|
|
@click=${e.onRawDiscard}
|
|
>
|
|
${F(`configView.rawDiscard`)}
|
|
</button>
|
|
<button
|
|
class="btn btn--sm primary"
|
|
?disabled=${!he}
|
|
aria-busy=${e.saving?`true`:`false`}
|
|
@click=${e.onSave}
|
|
>
|
|
${e.saving?D`<span class="config-action-spinner" aria-hidden="true"
|
|
>${N.loader}</span
|
|
>${F(`common.saving`)}`:F(`common.save`)}
|
|
</button>
|
|
</div>
|
|
<div class="field config-raw-field">
|
|
<span style="display:flex;align-items:center;gap:8px;">
|
|
${F(`configView.rawConfig`)}
|
|
${n>0?D`<span class="settings-count"
|
|
>${F(n===1?`configView.secretCount`:`configView.secretCountPlural`,{count:String(n)})}
|
|
${F(r?`configView.redacted`:`configView.visible`)}</span
|
|
>
|
|
<openclaw-tooltip
|
|
.content=${F(r?`configView.revealSensitive`:`configView.hideSensitive`)}
|
|
>
|
|
<button
|
|
class="btn btn--icon config-raw-toggle ${r?``:`active`}"
|
|
aria-label=${F(`configView.toggleRawRedaction`)}
|
|
aria-pressed=${!r}
|
|
@click=${()=>{t.rawRevealed=!t.rawRevealed,g()}}
|
|
>
|
|
${r?N.eyeOff:N.eye}
|
|
</button>
|
|
</openclaw-tooltip>`:E}
|
|
</span>
|
|
${r?D`<div class="callout info" style="margin-top: 12px">
|
|
${F(n===1?`configView.sensitiveHidden`:`configView.sensitiveHiddenPlural`,{count:String(n)})}
|
|
</div>`:D`<textarea
|
|
placeholder=${F(`configView.rawConfig`)}
|
|
.value=${e.raw}
|
|
?disabled=${pe||!me}
|
|
@input=${t=>{e.onRawChange(t.target.value)}}
|
|
></textarea>`}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`})()}
|
|
${e.issues.length>0?D`<div class="config-content-callout">
|
|
<div class="callout danger">
|
|
<pre class="code-block">
|
|
${Te(Tn(JSON.stringify(e.issues,null,2)))}</pre>
|
|
</div>
|
|
</div>`:E}
|
|
</div>
|
|
`}function os(){return(os=e((()=>{O(),Ee(),De(),fr(),_r(),er(),xt(),P(),En(),M(),h(),Za(),xo(),Fo(),Wo(),Zo(),rs(),u().catch(()=>void 0)})))()}function Q(e){switch(e){case`communications`:return{activeSection:`messages`,activeSubsection:null};case`appearance`:return{activeSection:`__appearance__`,activeSubsection:null};case`notifications`:return{activeSection:`__notifications__`,activeSubsection:null};case`security`:return{activeSection:`security`,activeSubsection:null};case`automation`:return{activeSection:`commands`,activeSubsection:null};case`mcp`:return{activeSection:`mcp`,activeSubsection:null};case`memory`:return{activeSection:`memory`,activeSubsection:null};case`talk`:return{activeSection:`talk`,activeSubsection:null};case`infrastructure`:return{activeSection:`gateway`,activeSubsection:null};case`updates`:return{activeSection:`update`,activeSubsection:null};case`ai-agents`:return{activeSection:`agents`,activeSubsection:null};case`advanced`:return{activeSection:null,activeSubsection:null}}throw Error(`Unknown config page`)}function ss(e,t,n){let r=Un(e)??null;return e===`advanced`&&t&&Xn.has(t)?{activeSection:null,activeSubsection:null}:r&&(!t||!r.includes(t))?Q(e):{activeSection:t,activeSubsection:n}}function cs(e,t){let n=new URLSearchParams(t).get(`section`);return n?ss(e,n,null):Q(e)}function ls(e){return ke(e)}function us(e){switch(e){case`appearance`:return D`${F(`configView.appearance.intro`)}
|
|
${sn(`https://docs.openclaw.ai/web/control-ui`)}`;case`mcp`:return D`${F(`mcpPage.intro`)} ${sn(`https://docs.openclaw.ai/tools/mcp`)}`;case`security`:return D`${F(`quickSettings.security.intro`)}
|
|
${sn(`https://docs.openclaw.ai/gateway/security`)}`;case`talk`:return D`${F(`talkPage.intro`)}
|
|
${sn(`https://docs.openclaw.ai/nodes/talk`)}`;case`updates`:return F(`updates.page.intro`);default:return Fe(e)}}function ds(e){let t=i(e?.configForm)??i(e);if(!t)return{gatewayAuth:`unknown`,execPolicy:`unknown`,browserEnabled:!0,browserEnabledOverridden:!1,toolProfile:`full`,toolProfileOverridden:!1};let n=i(t.gateway),r=i(n?.auth),a=i(t.tools),o=i(a?.exec)??{},s=i(t.browser),c=`unknown`;r&&(c=(typeof r.mode==`string`?r.mode.trim():``)||(r.password?`password`:r.token?`token`:r.trustedProxy?`trusted-proxy`:`none`));let l=a?.profile,u=o.security;return{gatewayAuth:c,execPolicy:typeof u==`string`&&u.trim()?u.trim():`allowlist`,browserEnabled:s?.enabled!==!1,browserEnabledOverridden:s!==null&&Object.hasOwn(s,`enabled`),toolProfile:typeof l==`string`&&l.trim()?l.trim():`full`,toolProfileOverridden:a!==null&&Object.hasOwn(a,`profile`)}}function fs(e){typeof document>`u`||document.documentElement.style.setProperty(`--control-ui-text-scale`,(Ve(e)/100).toFixed(2))}var ps,ms,hs,$;function gs(){return(gs=e((()=>{jt(),Dt(),O(),we(),tt(),bt(),rt(),Ne(),vt(),Ge(),at(),De(),Ze(),nt(),zn(),Et(),Zt(),V(),nr(),M(),Rt(),w(),he(),Ft(),_(),C(),Xt(),be(),jn(),Nn(),br(),Sr(),Kn(),Tr(),Gr(),Zr(),$i(),qn(),S(),na(),la(),Aa(),Va(),os(),ps={"communications:__notifications__":{routeId:`notifications`,keepSection:!1},"communications:channels":{routeId:`channels`,keepSection:!1},"communications:broadcast":{routeId:`advanced`,keepSection:!0},"communications:talk":{routeId:`talk`,keepSection:!0},"automation:approvals":{routeId:`security`,keepSection:!0},"ai-agents:memory":{routeId:`memory`,keepSection:!0},"ai-agents:models":{routeId:`model-providers`,keepSection:!1}},ms=1e4,hs=new Map,$=class extends b{constructor(...e){super(...e),this.pageId=`advanced`,this.routeData=null,this.settings=Re(),this.hiddenSessionCatalogIds=It(),this.systemInfo=null,this.systemInfoUnavailable=!1,this.sessionObserverModels=[],this.sessionObserverModelsUnavailable=!1,this.mediaDeviceWatch=null,this.microphoneDevices=[],this.microphonePermissionRequired=!0,this.microphoneLoading=!1,this.microphoneError=null,this.microphoneLoaded=!1,this.microphoneRefreshRequestsPermission=!1,this.microphonePermissionRefreshPending=!1,this.cameraDevices=[],this.cameraPermissionRequired=!0,this.cameraLoading=!1,this.cameraError=null,this.cameraLoaded=!1,this.cameraRefreshRequestsPermission=!1,this.cameraPermissionRefreshPending=!1,this.cameraSelectionRequest=0,this.formModes={communications:`form`,appearance:`form`,notifications:`form`,security:`form`,automation:`form`,mcp:`form`,memory:`form`,talk:`form`,infrastructure:`form`,updates:`form`,"ai-agents":`form`,advanced:`form`},this.selections={communications:Q(`communications`),appearance:Q(`appearance`),notifications:Q(`notifications`),security:Q(`security`),automation:Q(`automation`),mcp:Q(`mcp`),memory:Q(`memory`),talk:Q(`talk`),infrastructure:Q(`infrastructure`),updates:Q(`updates`),"ai-agents":Q(`ai-agents`),advanced:Q(`advanced`)},this.customThemeImport=Cr,this.customThemeImportOwner=new wr(e=>{this.customThemeImport=e}),this.configViewState=Qo(),this.runtimeConfigSource=null,this.systemInfoGatewaySource=null,this.systemInfoClient=null,this.updateStatusClient=null,this.sessionObserverModelsClient=null,this.sessionObserverModelsAgentId=null,this.sessionObserverModelsRequest=null,this.systemInfoPolling=new Jt(this,ms,()=>{this.systemInfoTask.status!==Mt.PENDING&&this.systemInfoTask.run()},!1),this.updateCountdownPolling=new Jt(this,1e3,()=>this.requestUpdate(),!1),this.systemInfoTask=new Ot(this,{autoRun:!1,args:()=>[this.systemInfoGatewaySource,this.systemInfoRequestClient()],task:([e,t],{signal:n})=>e&&t?t.request(`system.info`,{},{signal:n}):At,onComplete:e=>{this.systemInfo=e;let t=this.systemInfoRequestClient();t&&this.ensureSessionObserverModels(t,this.context.agentSelection.state.selectedId)},onError:e=>{(ue(e)||vr(e))&&(this.systemInfo=null,this.systemInfoUnavailable=!0,this.systemInfoPolling.stop())}}),this.hiddenSessionCatalogLabelsTask=new Ot(this,{args:()=>{let e=this.context?.gateway.snapshot,t=[...this.hiddenSessionCatalogIds].toSorted();return[this.pageId===`appearance`&&t.length>0&&Pt(e,`sessions.catalog.list`,`operator.read`)?e?.client:null,this.context?.agentSelection.state.selectedId??null,t.join(`\0`)]},task:async([e,t],{signal:n})=>{if(!e)return hs;try{let r=await e.request(`sessions.catalog.list`,{...t?{agentId:t}:{},limitPerHost:1},{signal:n});return new Map(r.catalogs.map(e=>[e.id,e.label]))}catch{return hs}}}),this.pendingRouteTargetId=null,this.subscriptions=new _e(this).watch(()=>this.context?.runtimeConfig,(e,t)=>e.subscribe(t),e=>this.synchronizeRuntimeConfig(e)).watch(()=>this.context?.overlays,(e,t)=>e.subscribe(t)).watch(()=>this.context?.config,(e,t)=>e.subscribe(t)).watch(()=>this.context?.gateway,(e,t)=>e.subscribe(t),e=>this.synchronizeSystemInfoGateway(e)).watch(()=>this.context?.agentSelection,(e,t)=>e.subscribe(t),e=>this.synchronizeSessionObserverAgent(e.state.selectedId)).watch(()=>this.context?.nativeNotifications??void 0,(e,t)=>e.subscribe(t)).watch(()=>this.context?.webPush,(e,t)=>e.subscribe(t)).watch(()=>this.context?.theme,(e,t)=>e.subscribe(t),()=>{this.settings=this.customThemeImportOwner.adoptSettings(this.settings,Re(),this.context.theme.serverSelection)}),this.hiddenSessionCatalogsChanged=()=>{this.hiddenSessionCatalogIds=It()},this.watchUpdateProgress=e=>{let t=()=>{let t=this.context.overlays.snapshot.updateStatusBanner;e({busy:this.isUpdateBusy(),connected:this.context.gateway.snapshot.phase===`connected`,failure:t&&t.tone!==`info`?t.text:null})},n=this.context.overlays.subscribe(t),r=this.context.gateway.subscribe(t);return t(),()=>{n(),r()}}}connectedCallback(){super.connectedCallback(),this.hiddenSessionCatalogsChanged(),window.addEventListener(rn,this.hiddenSessionCatalogsChanged),this.customThemeImportOwner.connect(this.context.gateway.connection.gatewayUrl,this.context.theme.serverSelection),this.settings=Re(),this.mediaDeviceWatch=Mn(()=>{this.refreshMicrophones(!1),this.refreshCameras(!1)}),this.syncRouteData()}disconnectedCallback(){window.removeEventListener(rn,this.hiddenSessionCatalogsChanged),this.customThemeImportOwner.retireImport(),this.mediaDeviceWatch?.(),this.mediaDeviceWatch=null,this.systemInfoPolling.stop(),this.updateCountdownPolling.stop(),this.invalidateSystemInfoRequest(),this.runtimeConfigSource=null,this.resetConfigViewState(),this.systemInfoGatewaySource=null,this.systemInfoClient=null,this.updateStatusClient=null,this.subscriptions.clear(),super.disconnectedCallback()}willUpdate(e){e.get(`pageId`)===`appearance`&&this.pageId!==`appearance`&&this.customThemeImportOwner.retireImport(),(e.has(`pageId`)||e.has(`routeData`))&&this.syncRouteData()}updated(e){e.has(`pageId`)&&e.get(`pageId`)!==void 0&&this.invalidateSystemInfoRequest(),this.syncSystemInfoPolling(),this.syncUpdateStatusRefresh(),this.syncUpdateCountdownPolling(),this.scrollToPendingRouteTarget(),this.pageId===`appearance`&&!this.microphoneLoaded&&(this.microphoneLoaded=!0,this.refreshMicrophones(!1)),this.pageId===`appearance`&&!this.cameraLoaded&&(this.cameraLoaded=!0,this.refreshCameras(!1))}async refreshMicrophones(e){if(this.microphoneLoading){e&&!this.microphoneRefreshRequestsPermission&&(this.microphonePermissionRefreshPending=!0);return}this.microphoneLoading=!0,this.microphoneRefreshRequestsPermission=e,this.microphoneError=null;try{let t=await An(e);this.microphoneDevices=t.devices,this.microphonePermissionRequired=t.permissionRequired,this.microphoneError=t.issue?kn(t.issue,`audioinput`):null}catch(e){this.microphoneError=x(e)}finally{this.microphoneLoading=!1,this.microphoneRefreshRequestsPermission=!1}this.microphonePermissionRefreshPending&&(this.microphonePermissionRefreshPending=!1,await this.refreshMicrophones(!0))}async refreshCameras(e){if(this.cameraLoading){e&&!this.cameraRefreshRequestsPermission&&(this.cameraPermissionRefreshPending=!0);return}this.cameraLoading=!0,this.cameraRefreshRequestsPermission=e,this.cameraError=null;try{let t=await Pn(e);this.cameraDevices=t.devices,this.cameraPermissionRequired=t.permissionRequired,this.cameraError=t.issue?kn(t.issue,`videoinput`):null}catch(e){this.cameraError=x(e)}finally{this.cameraLoading=!1,this.cameraRefreshRequestsPermission=!1}this.cameraPermissionRefreshPending&&(this.cameraPermissionRefreshPending=!1,await this.refreshCameras(!0))}syncRouteData(){let e=this.routeData?this.routeData.section:new URLSearchParams(globalThis.location?.search??``).get(`section`);if(e){let t=ps[`${this.pageId}:${e}`];if(t){this.context?.navigate(t.routeId,{search:t.keepSection?`?section=${encodeURIComponent(e)}`:``,hash:globalThis.location?.hash??``});return}}let t=this.routeData?ss(this.pageId,this.routeData.section,null):cs(this.pageId,globalThis.location?.search??``);this.selections={...this.selections,[this.pageId]:t};let n=this.routeData?.targetBlockId??g(globalThis.location?.hash??``);this.pendingRouteTargetId=n}scrollToPendingRouteTarget(){let e=this.pendingRouteTargetId;if(!e)return;let t=[...this.renderRoot.querySelectorAll(`[id]`)].find(t=>t.id===e);t&&(t.scrollIntoView?.({behavior:an(),block:`start`}),this.pendingRouteTargetId=null)}isSystemInfoVisible(){return this.pageId===`appearance`}syncUpdateCountdownPolling(){let e=this.context?.overlays.snapshot.updateSchedule?.campaign;if(this.pageId===`updates`&&(e?.state===`countdown`||e?.state===`waiting-for-idle`)){this.updateCountdownPolling.start();return}this.updateCountdownPolling.stop()}syncUpdateStatusRefresh(){let e=this.context.gateway.snapshot,t=this.pageId===`updates`&&e.phase===`connected`&&Pt(e,`update.status`,`operator.admin`)?e.client:null;t!==this.updateStatusClient&&(this.updateStatusClient=t,t&&this.context.overlays.refreshUpdateStatus())}synchronizeRuntimeConfig(e){e!==this.runtimeConfigSource&&(this.runtimeConfigSource&&this.customThemeImportOwner.retireImport(),this.runtimeConfigSource=e,this.resetConfigViewState());let t=e.state;if(!t.configSnapshot&&!t.configLoading){e.ensureLoaded().then(()=>this.runtimeConfigSource===e&&this.pageId!==`updates`?e.ensureSchemaLoaded():void 0).catch(()=>void 0);return}this.pageId!==`updates`&&!t.configSchema&&!t.configSchemaLoading&&e.ensureSchemaLoaded().catch(()=>void 0)}synchronizeSystemInfoGateway(e){this.customThemeImportOwner.synchronizeScope(e.connection.gatewayUrl,this.context.theme.serverSelection),e!==this.systemInfoGatewaySource&&(this.systemInfoPolling.stop(),this.invalidateSystemInfoRequest(),this.systemInfoGatewaySource=e,this.resetConfigViewState(),this.systemInfoClient=null,this.updateStatusClient=null,this.systemInfo=null,this.systemInfoUnavailable=!1,this.resetSessionObserverModels()),this.handleSystemInfoGatewaySnapshot(e.snapshot),this.syncUpdateStatusRefresh()}resetConfigViewState(){this.configViewState=Qo()}handleSystemInfoGatewaySnapshot(e){let t=e.client!==this.systemInfoClient,n=yr(e.hello);this.systemInfoClient=e.client,t?(this.invalidateSystemInfoRequest(),this.systemInfo=null,this.systemInfoUnavailable=!1,this.resetSessionObserverModels()):e.phase!==`connected`&&(this.invalidateSystemInfoRequest(),this.systemInfo=null),e.phase===`connected`&&e.hello&&(this.systemInfoUnavailable=!n,n||(this.invalidateSystemInfoRequest(),this.systemInfo=null)),this.syncSystemInfoPolling(t)}syncSystemInfoPolling(e=!1){let t=this.context.gateway.snapshot;if(!(this.isConnected&&this.isSystemInfoVisible()&&!this.systemInfoUnavailable&&t.phase===`connected`&&yr(t.hello)&&t.client!=null)){this.systemInfoPolling.stop();return}(this.systemInfoPolling.start()||e)&&this.systemInfoTask.run()}invalidateSystemInfoRequest(){this.systemInfoTask.run([null,null])}systemInfoRequestClient(){let e=this.systemInfoGatewaySource,t=e?.snapshot;return!e||!t||!this.isConnected||!this.isSystemInfoVisible()||this.context.gateway!==e||t.phase!==`connected`||!yr(t.hello)||this.systemInfoUnavailable?null:t.client}synchronizeSessionObserverAgent(e){if(this.sessionObserverModelsAgentId===e&&(e!==null||this.sessionObserverModelsUnavailable))return;this.resetSessionObserverModels(!e);let t=this.systemInfoRequestClient();this.systemInfo&&t&&this.ensureSessionObserverModels(t,e)}ensureSessionObserverModels(e,t){if(!t)return this.resetSessionObserverModels(!0),Promise.resolve();if(this.sessionObserverModelsClient===e&&this.sessionObserverModelsAgentId===t)return Promise.resolve();let n=this.sessionObserverModelsRequest;if(n?.client===e&&n.agentId===t)return n.promise;let r=this.systemInfoGatewaySource,i=()=>this.isConnected&&this.systemInfoGatewaySource===r&&this.context.gateway.snapshot.client===e&&this.context.agentSelection.state.selectedId===t,a=d(e,{agentId:t,preparedOnly:!0}).then(({models:n})=>{i()&&(this.sessionObserverModels=n,this.sessionObserverModelsClient=e,this.sessionObserverModelsAgentId=t,this.sessionObserverModelsUnavailable=!1)}).catch(()=>{i()&&this.resetSessionObserverModels(!0)}).finally(()=>{this.sessionObserverModelsRequest?.promise===a&&(this.sessionObserverModelsRequest=null)});return this.sessionObserverModelsRequest={client:e,agentId:t,promise:a},a}resetSessionObserverModels(e=!1){this.sessionObserverModels=[],this.sessionObserverModelsClient=null,this.sessionObserverModelsAgentId=null,this.sessionObserverModelsUnavailable=e}setFormMode(e){this.formModes={...this.formModes,[this.pageId]:e}}setActiveSection(e){this.selections={...this.selections,[this.pageId]:{activeSection:e,activeSubsection:null}}}setActiveSubsection(e){this.selections={...this.selections,[this.pageId]:{...this.selections[this.pageId],activeSubsection:e}}}applySettings(e){this.settings=Ue(e),fs(this.settings.textScale),this.context.theme.refresh()}setLocale(e){if(e===void 0){this.resetLocale();return}this.settings=Ue({locale:e}),St.setLocale(e)}currentSyncedPref(e){return $e(this.context.runtimeConfig.state.configSnapshot?.config,e,this.context.gateway.connection.gatewayUrl,this.settings,ot(e)?{canSync:this.serverUiPrefsCanSync(e),profileId:this.context.gateway.snapshot?.selfUser?.id}:{canSync:this.serverUiPrefsCanSync()})}setFont(e,t){let n=this.currentSyncedPref(e);n.overridden&&t===n.resetValue?this.resetSyncedAppearancePref(e):this.applySettings({[e]:t})}serverUiPrefsCanSync(e){let t=this.context.runtimeConfig;if(!t.state.connected)return null;let n=this.context.gateway.snapshot;return(e===`fontUi`||e===`fontChat`)&&!n?.selfUser?!1:e&&n?.selfUser?ft(n.hello?.auth??null):t.canPatch!==!1}resetLocale(){this.settings=pt(`locale`,this.currentSyncedPref(`locale`),this.context.gateway.connection.gatewayUrl),wt(this.settings.locale)?St.setLocale(this.settings.locale):St.useSystemLocale()}resetSyncedAppearancePref(e){this.settings=pt(e,this.currentSyncedPref(e),this.context.gateway.connection.gatewayUrl),this.context.theme.refresh()}setTheme(e,t){let n=this.currentSyncedPref(`theme`),r=n.overridden&&e===n.resetValue;this.customThemeImportOwner.recordActivation(r?null:e);let i=ht(this.settings.theme,this.settings.themeMode);Ye({currentTheme:i,nextTheme:ht(e,this.settings.themeMode),context:t,applyTheme:()=>r?this.resetSyncedAppearancePref(`theme`):this.applySettings({theme:e})})}setThemeMode(e,t){let n=this.currentSyncedPref(`themeMode`),r=n.overridden&&e===n.resetValue,i=ht(this.settings.theme,this.settings.themeMode);Ye({currentTheme:i,nextTheme:ht(this.settings.theme,e),context:t,applyTheme:()=>r?this.resetSyncedAppearancePref(`themeMode`):this.applySettings({themeMode:e})})}setSetting(e,t){this.applySettings({[e]:t})}selectMicrophone(e){this.applySettings({realtimeTalkInputDeviceId:e.trim()||void 0})}async selectCamera(e){let t=++this.cameraSelectionRequest,n=e.trim()||void 0;this.cameraError=null;try{if(await Fn(n),t!==this.cameraSelectionRequest)return;this.applySettings({realtimeTalkVideoDeviceId:n})}catch(e){t===this.cameraSelectionRequest&&(this.cameraError=x(e))}}async importCustomTheme(){await this.customThemeImportOwner.import({config:this.context.runtimeConfig.state,hasCustomTheme:!!this.settings.customTheme,load:Ir,apply:(e,t)=>this.applySettings({customTheme:e,theme:t?`custom`:this.settings.theme}),messages:{blocked:e=>F(e===`loading`?`common.loading`:`common.unsavedChanges`),imported:e=>F(`configPage.themeImported`,{name:e})}})}clearCustomTheme(){this.customThemeImportOwner.clear({apply:()=>this.applySettings({theme:this.settings.theme===`custom`?`claw`:this.settings.theme,customTheme:void 0}),message:F(`configPage.themeRemoved`)})}includeSections(){return Un(this.pageId)}isUpdateBusy(){let e=this.context.overlays.snapshot;return e.updateRunning||e.updateStatusRefreshing||e.updateReconciliationPending}isCuratedConfigMutationDisabled(){let e=this.context.runtimeConfig.state;return!e.connected||e.configLoading||e.configSaving||e.configApplying||this.isUpdateBusy()||!this.context.runtimeConfig.canSet||!ze(this.context.gateway.snapshot.hello?.auth??null)}renderAdvancedConfig(e){let t=this.context.runtimeConfig,n=t.state;if(this.pageId===`updates`){let n=this.context.gateway.snapshot,r=this.context.overlays.snapshot,i=ze(n.hello?.auth??null);return Ba({configObject:e,gatewayVersion:this.context.config.current.serverVersion??n.hello?.server?.version??null,controlUiCommit:Tt.commit,controlUiCommitAt:Tt.commitAt,controlUiBuiltAt:Tt.builtAt,schedule:r.updateSchedule,heldUpdateCampaignId:r.heldUpdateCampaignId,updateAvailable:r.updateAvailable,statusBanner:r.updateStatusBanner,recordedAttempt:r.recordedUpdateAttempt,configBusy:this.isCuratedConfigMutationDisabled(),canAdmin:i,canUpdate:Pt(n,`update.run`,`operator.admin`),canCheckStatus:Pt(n,`update.status`,`operator.admin`),canHoldUpdate:Pt(n,`update.hold`,`operator.admin`),updateBusy:this.isUpdateBusy(),onChannelChange:e=>t.patchForm([`update`,`channel`],e),onAutomaticUpdatesChange:e=>t.patchForm([`update`,`auto`,`enabled`],e),onUpdateNow:()=>void Bn({startGatewayUpdate:()=>void this.context.overlays.runUpdate(),watchUpdateProgress:this.watchUpdateProgress,updateAvailable:r.updateAvailable,updateSchedule:r.updateSchedule,viaNativeApp:!1}),onHoldUpdate:()=>this.context.overlays.holdUpdate(),onCheckStatus:()=>this.context.overlays.refreshUpdateStatus()})}let r=this.includeSections(),a=this.pageId===`advanced`?[...Xn]:void 0,o=ss(this.pageId,this.selections[this.pageId].activeSection,this.selections[this.pageId].activeSubsection),s=this.pageId===`mcp`?`mcp`:o.activeSection,c=qe(this.context.gateway.snapshot),l=this.pageId===`mcp`?null:o.activeSubsection,u=i(e.gateway),d=i(u?.controlUi),f=i(i(e.agents)?.defaults),p=this.currentSyncedPref(`theme`),m=this.currentSyncedPref(`themeMode`),ee=this.currentSyncedPref(`accent`),h=this.currentSyncedPref(`locale`),g=this.currentSyncedPref(`chatSendShortcut`),te=this.currentSyncedPref(`chatFollowUpMode`),_=!n.connected||n.configSaving||n.configApplying||this.isUpdateBusy()||!ze(this.context.gateway.snapshot.hello?.auth??null),v={raw:n.configRaw,originalRaw:n.configRawOriginal,valid:n.configValid,issues:n.configIssues,loading:n.configLoading,saving:n.configSaving,applying:n.configApplying,updating:this.isUpdateBusy(),connected:n.connected,mutationAllowed:t.canSet,openFileAllowed:t.canOpenFile,schema:n.configSchema,schemaLoading:n.configSchemaLoading,uiHints:n.configUiHints,formMode:this.formModes[this.pageId],rawDraftPending:n.configFormMode===`raw`&&n.configFormDirty,viewState:this.configViewState,rawAvailable:!!(n.configSnapshot?.config||n.configForm||n.configRaw),showModeToggle:this.pageId===`advanced`,formValue:n.configForm,originalValue:n.configFormOriginal,activeSection:s,activeSubsection:l,onRawChange:e=>{this.customThemeImportOwner.retireForConfigMutation(F(`common.unsavedChanges`)),t.setRaw(e)},onFormModeChange:e=>this.setFormMode(e),onViewStateChange:()=>this.requestUpdate(),onFormPatch:(e,n)=>{this.customThemeImportOwner.retireForConfigMutation(F(`common.unsavedChanges`)),t.patchForm(e,n)},onFormRemove:e=>{this.customThemeImportOwner.retireForConfigMutation(F(`common.unsavedChanges`)),t.removeFormValue(e)},onSectionChange:e=>this.setActiveSection(e),onSubsectionChange:e=>this.setActiveSubsection(e),onSave:()=>void t.save(),onRawDiscard:()=>void t.discardDraft(),onOpenFile:()=>void t.openFile(),version:this.context.config.current.serverVersion??this.context.gateway.snapshot.hello?.server?.version??``,theme:this.settings.theme,themeOverridden:p.overridden,themeProvenance:p.provenance,themeResetValue:p.resetValue??j.theme,themeMode:this.settings.themeMode,themeModeOverridden:m.overridden,themeModeProvenance:m.provenance,themeModeResetValue:m.resetValue??j.themeMode,accent:this.settings.accent,accentOverridden:ee.overridden,accentProvenance:ee.provenance,fontUi:this.settings.fontUi,fontChat:this.settings.fontChat,fontUiProvenance:this.currentSyncedPref(`fontUi`).provenance,fontChatProvenance:this.currentSyncedPref(`fontChat`).provenance,setFontUi:e=>this.setFont(`fontUi`,e),setFontChat:e=>this.setFont(`fontChat`,e),systemLocale:St.getSystemLocale(),localeOverride:wt(h.value)?h.value:void 0,localeOverridden:h.overridden,localeProvenance:h.provenance,localeResetValue:wt(h.resetValue)?h.resetValue:void 0,onLocaleChange:e=>this.setLocale(e),setTheme:(e,t)=>this.setTheme(e,t),setThemeMode:(e,t)=>this.setThemeMode(e,t),setAccent:e=>e===void 0?this.resetSyncedAppearancePref(`accent`):this.applySettings({accent:e}),hasCustomTheme:!!this.settings.customTheme,customThemeLabel:this.settings.customTheme?.label??null,customThemeSourceUrl:this.settings.customTheme?.sourceUrl??null,customThemeImportUrl:this.customThemeImport.url,customThemeImportBusy:this.customThemeImport.busy,customThemeImportMessage:this.customThemeImport.message,customThemeImportExpanded:this.customThemeImport.expanded,customThemeImportFocusToken:this.customThemeImport.focusToken,onCustomThemeImportUrlChange:e=>this.customThemeImportOwner.setUrl(e),onImportCustomTheme:()=>void this.importCustomTheme(),onClearCustomTheme:()=>this.clearCustomTheme(),onOpenCustomThemeImport:()=>this.customThemeImportOwner.open(),textScale:this.settings.textScale??j.textScale,textScaleOverridden:this.settings.textScale!==void 0,setTextScale:e=>this.setSetting(`textScale`,e===j.textScale?void 0:Ve(e)),sidebarLiveActivity:this.settings.sidebarLiveActivity??j.sidebarLiveActivity,setSidebarLiveActivity:e=>this.setSetting(`sidebarLiveActivity`,e),hiddenSessionCatalogIds:this.hiddenSessionCatalogIds,hiddenSessionCatalogLabels:this.hiddenSessionCatalogLabelsTask.status===Mt.COMPLETE?this.hiddenSessionCatalogLabelsTask.value??hs:hs,setSessionCatalogHidden:un,chatMessageMaxWidth:this.settings.chatMessageMaxWidth,setChatMessageMaxWidth:e=>this.setSetting(`chatMessageMaxWidth`,e),chatCollapseTaskProgress:this.settings.chatCollapseTaskProgress===!0,setChatCollapseTaskProgress:e=>this.setSetting(`chatCollapseTaskProgress`,e),showAdvancedSettings:this.settings.showAdvancedSettings===!0,setShowAdvancedSettings:e=>this.setSetting(`showAdvancedSettings`,e),forceShowAdvanced:this.pageId===`advanced`,forceAdvancedSection:this.routeData?.advanced?this.routeData.section:null,sessionObserverEnabled:d?.sessionObserver!==!1,sessionObserverUtilityModel:typeof f?.utilityModel==`string`?f.utilityModel:void 0,sessionObserverResolvedModel:this.systemInfo?.defaultAgentUtilityModel,sessionObserverModels:this.sessionObserverModels,sessionObserverModelsUnavailable:this.sessionObserverModelsUnavailable,sessionObserverDisabled:_,setSessionObserverEnabled:e=>{t.patch({raw:ra(e),note:F(`configView.sessionObserver.toggleNote`)})},setSessionObserverUtilityModel:e=>{t.patch({raw:ia(e),note:F(`configView.sessionObserver.modelNote`)}).then(e=>{e&&this.systemInfoTask.run()})},lobsterPetVisits:this.settings.lobsterPetVisits??j.lobsterPetVisits,setLobsterPetVisits:e=>this.applySettings({lobsterPetVisits:e}),sessionDeleteConfirm:this.settings.sessionDeleteConfirm??j.sessionDeleteConfirm,setSessionDeleteConfirm:e=>this.applySettings({sessionDeleteConfirm:e}),lobsterPetSounds:this.settings.lobsterPetSounds??j.lobsterPetSounds,setLobsterPetSounds:e=>this.applySettings({lobsterPetSounds:e}),lobsterdexHref:dt(`lobsterdex`,this.context.basePath),onOpenLobsterdex:()=>this.context.navigate(`lobsterdex`),chatSendShortcut:Me(this.settings.chatSendShortcut),chatSendShortcutOverridden:g.overridden,chatSendShortcutProvenance:g.provenance,chatSendShortcutResetValue:g.resetValue??j.chatSendShortcut,setChatSendShortcut:e=>this.setSetting(`chatSendShortcut`,e),chatFollowUpMode:this.settings.chatFollowUpMode,chatFollowUpModeOverridden:te.overridden,chatFollowUpModeProvenance:te.provenance,serverQueueMode:n.configSnapshot?Sn(n.configSnapshot.runtimeConfig,{configNeedsApply:n.configNeedsApply}):void 0,setChatFollowUpMode:e=>this.setSetting(`chatFollowUpMode`,e),resetChatFollowUpMode:()=>this.resetSyncedAppearancePref(`chatFollowUpMode`),catalogOpenTarget:Be(this.settings.catalogOpenTarget),setCatalogOpenTarget:e=>this.setSetting(`catalogOpenTarget`,e),microphone:{devices:this.microphoneDevices,permissionRequired:this.microphonePermissionRequired,selectedDeviceId:this.settings.realtimeTalkInputDeviceId??``,loading:this.microphoneLoading,error:this.microphoneError},composerHoldToRecord:this.settings.composerHoldToRecord!==!1,setComposerHoldToRecord:e=>this.setSetting(`composerHoldToRecord`,e),onMicrophoneRefresh:()=>void this.refreshMicrophones(!0),onMicrophoneSelect:e=>this.selectMicrophone(e),camera:{devices:this.cameraDevices,permissionRequired:this.cameraPermissionRequired,selectedDeviceId:this.settings.realtimeTalkVideoDeviceId??``,loading:this.cameraLoading,error:this.cameraError},onCameraRefresh:()=>void this.refreshCameras(!0),onCameraSelect:e=>void this.selectCamera(e),gatewayUrl:this.context.gateway.connection.gatewayUrl,assistantName:this.context.config.current.assistantIdentity.name,configPath:n.configSnapshot?.path??null,navRootLabel:this.pageId===`advanced`?void 0:ls(this.pageId),showSectionDocs:this.pageId!==`communications`,sectionPrelude:s===`browser`&&c?xr({enabled:this.settings.openLinksInControlUiBrowser===!0,onChange:e=>this.setSetting(`openLinksInControlUiBrowser`,e)}):void 0,showRootTab:!r?.length,includeSections:r?[...r]:void 0,excludeSections:a,includeVirtualSections:this.pageId===`appearance`||this.pageId===`notifications`,settingsLayout:this.pageId===`advanced`?`accordion`:void 0,nativeNotifications:this.context.nativeNotifications?.snapshot,onNativeNotificationsRequestPermission:()=>this.context.nativeNotifications?.requestPermission(),onNativeNotificationsSendTest:()=>this.context.nativeNotifications?.sendTest(),webPush:this.context.webPush.snapshot,onWebPushSubscribe:()=>void this.context.webPush.run({kind:`enable`}),onWebPushUnsubscribe:()=>void this.context.webPush.run({kind:`disable`}),onWebPushTest:()=>void this.context.webPush.run({kind:`test`}),onWebPushSetUserPreferences:e=>void this.context.webPush.run({kind:`set`,scope:`user`,preferences:e}),onWebPushSetDevicePreferences:e=>void this.context.webPush.run({kind:`set`,scope:`device`,preferences:e})};if(this.pageId===`mcp`)return Yr({configObject:e,pluginsHref:dt(`plugins`,this.context.basePath),editor:as({...v,activeSection:`mcp`,activeSubsection:null,showModeToggle:!1,embeddedEditor:!0,navRootLabel:`MCP`})});if(this.pageId===`memory`)return Yi({configObject:e,mutationDisabled:this.isCuratedConfigMutationDisabled(),pluginsHref:dt(`plugins`,this.context.basePath),memoryImportHref:dt(`memory-import`,this.context.basePath),routeData:this.routeData,buildEditor:e=>as({...v,schema:Jn(v.schema,e),activeSection:`memory`,activeSubsection:null,showModeToggle:!1,embeddedEditor:!0,navRootLabel:F(`tabs.memory`)})});if(this.pageId===`talk`)return Oa({configObject:e,mutationDisabled:this.isCuratedConfigMutationDisabled(),buildEditor:()=>as({...v,activeSection:`talk`,activeSubsection:null,showModeToggle:!1,embeddedEditor:!0,navRootLabel:F(`tabs.talk`)})});if(this.pageId===`security`){let n=t.state,r=this.isCuratedConfigMutationDisabled();return ta({security:ds(e),configBusy:r,canPairDevice:n.connected&&ze(this.context.gateway.snapshot.hello?.auth??null),onPairMobile:()=>void this.context.overlays.openDevicePairSetup(),onBrowserEnabledToggle:e=>{if(e){t.removeFormValue([`browser`,`enabled`]);return}t.patchForm([`browser`,`enabled`],!1)},onToolProfileChange:e=>{if(e===`full`){t.removeFormValue([`tools`,`profile`]);return}t.patchForm([`tools`,`profile`],e)},editor:as({...v,embeddedEditor:!0})})}return as(v)}render(){let e=this.context.runtimeConfig.state,t=i(e.configForm??e.configSnapshot?.config)??{},n=this.renderAdvancedConfig(t);return D`
|
|
${this.pageId===`memory`?E:D`
|
|
${fn({title:ls(this.pageId),subtitle:us(this.pageId)})}
|
|
`}
|
|
${tr(n)}
|
|
`}},o([kt({context:ct,subscribe:!0})],$.prototype,`context`,void 0),o([k({attribute:`page-id`})],$.prototype,`pageId`,void 0),o([k({attribute:!1})],$.prototype,`routeData`,void 0),o([A()],$.prototype,`settings`,void 0),o([A()],$.prototype,`hiddenSessionCatalogIds`,void 0),o([A()],$.prototype,`systemInfo`,void 0),o([A()],$.prototype,`systemInfoUnavailable`,void 0),o([A()],$.prototype,`sessionObserverModels`,void 0),o([A()],$.prototype,`sessionObserverModelsUnavailable`,void 0),o([A()],$.prototype,`microphoneDevices`,void 0),o([A()],$.prototype,`microphonePermissionRequired`,void 0),o([A()],$.prototype,`microphoneLoading`,void 0),o([A()],$.prototype,`microphoneError`,void 0),o([A()],$.prototype,`cameraDevices`,void 0),o([A()],$.prototype,`cameraPermissionRequired`,void 0),o([A()],$.prototype,`cameraLoading`,void 0),o([A()],$.prototype,`cameraError`,void 0),o([A()],$.prototype,`formModes`,void 0),o([A()],$.prototype,`selections`,void 0),o([A()],$.prototype,`customThemeImport`,void 0),customElements.get(`openclaw-config-page`)||customElements.define(`openclaw-config-page`,$)})))()}gs();
|
|
//# sourceMappingURL=config-page-CBWlz9sG.js.map
|