openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
12 lines • 9.03 kB
JavaScript
import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{Kn as t,R as n,wr as r,z as i}from"./control-ui-foundation-Cydpkyqa.js";import{Bn as a,Eo as o,Oo as s,Sc as c,bc as l,bs as u,xs as d,zn as f}from"./control-ui-core-Rwzhj6nO.js";import{$ as p,K as m,X as h,at as g,q as _}from"./lit-runtime-CV_MH99K.js";import{_ as v,_n as y,g as b,jn as x}from"./control-ui-core-YphAl4aM.js";import{Yt as S,en as C}from"./control-ui-core-vvcQQV2m.js";import{Cr as w,Sr as T,xr as E}from"./control-ui-boot-shared-DfZ39Yj9.js";import{J as D,K as O,L as k,X as A,et as j,q as M,z as N}from"./control-ui-boot-chat-_QSl8fbH.js";import{Is as P,Ls as F}from"./control-ui-boot-shared-CXVvK2AW.js";import{n as I,t as L}from"./settings-workspace-Bseic8Tf.js";function R(e,n){if(typeof e==`boolean`||typeof e==`string`)return n.includes(e);if(!t(e))return!1;let r=e.enabled;return typeof r==`boolean`||typeof r==`string`?n.includes(r):Object.keys(e).some(e=>e!==`enabled`)}function z(e,n){let r=e;for(let e of n){if(!t(r))return;r=r[e]}return r}function B(e){let n=z(e,[`agents`,`defaults`,`model`]);if(typeof n==`string`)return n;if(!t(n))return;let r=n.primary;return typeof r==`string`?r:void 0}function V(e,t){if(t.id!==J)return!1;let n=z(e,Y);return typeof n==`string`&&B(e)===n&&z(e,t.configPath)===!0}function H(e,n){let r=e.configPath.at(-1);return e.readEnabled?e.readEnabled(n):r===`enabled`&&(typeof n==`boolean`||typeof n==`string`)?e.activeValues.includes(n):!t(n)||!r?!1:e.activeValues.includes(n[r])}function U(e,n){let r=n.configPath.slice(0,-1),i=n.configPath.at(-1),a=z(e,r);return i?n.resetScope===`parent`?a===void 0?null:r:i===`enabled`&&a!==void 0&&(typeof a!=`object`||!a)?r:t(a)&&Object.hasOwn(a,i)?n.configPath:null:null}function W(e,n){let r=e??{};if(V(r,n))return{enabled:!0,defaultEnabled:!0,overridden:!1};let i=n.configPath.slice(0,-1),a=n.configPath.at(-1),o=z(r,i),s=U(r,n),c=o;return s?.length===i.length?c=void 0:s&&a&&t(o)&&(c={...o},delete c[a]),{enabled:H(n,o),defaultEnabled:H(n,c),overridden:s!==null}}function G(e,t,n){let r={[t.configPath.at(-1)]:n?t.onValue:t.offValue,...n?t.enableAlso:null};for(let e of t.configPath.slice(0,-1).toReversed())r={[e]:r};return K(e,t,r)}function K(e,t,n){return t.id!==J||z(e??{},Y)===void 0?n:{...n,wizard:{localModelLeanAutoModel:null}}}function q(e,t){let n=U(e??{},t);if(!n?.length)return null;let r=null;for(let e of n.toReversed())r={[e]:r};return K(e,t,r)}var J,Y,X;function Z(){return(Z=e((()=>{S(),J=`localModelLean`,Y=[`wizard`,`localModelLeanAutoModel`],X=[{id:`codeMode`,title:()=>C(`labsPage.codeMode.title`),description:()=>C(`labsPage.codeMode.description`),docsUrl:`https://docs.openclaw.ai/tools/code-mode`,configPath:[`tools`,`codeMode`,`enabled`],onValue:`auto`,offValue:!1,activeValues:[!0,`auto`],readEnabled:null,enableAlso:null,resetScope:`gate`,restartHint:null},{id:`swarm`,title:()=>C(`labsPage.swarm.title`),description:()=>C(`labsPage.swarm.description`),docsUrl:`https://docs.openclaw.ai/tools/swarm`,configPath:[`tools`,`swarm`,`enabled`],onValue:!0,offValue:!1,activeValues:[!0],readEnabled:e=>e!==!1&&(!t(e)||e.enabled!==!1),enableAlso:null,resetScope:`gate`,restartHint:null},{id:`toolSearch`,title:()=>C(`labsPage.toolSearch.title`),description:()=>C(`labsPage.toolSearch.description`),docsUrl:`https://docs.openclaw.ai/tools/tool-search`,configPath:[`tools`,`toolSearch`,`enabled`],onValue:!0,offValue:!1,activeValues:[!0],readEnabled:e=>R(e,[!0]),enableAlso:{mode:`directory`},resetScope:`parent`,restartHint:null},{id:`loopDetection`,title:()=>C(`labsPage.loopDetection.title`),description:()=>C(`labsPage.loopDetection.description`),docsUrl:`https://docs.openclaw.ai/tools/loop-detection`,configPath:[`tools`,`loopDetection`,`enabled`],onValue:!0,offValue:!1,activeValues:[!0],readEnabled:null,enableAlso:null,resetScope:`gate`,restartHint:null},{id:`localModelLean`,title:()=>C(`labsPage.localModelLean.title`),description:()=>C(`labsPage.localModelLean.description`),docsUrl:`https://docs.openclaw.ai/gateway/local-models`,configPath:[`agents`,`defaults`,`experimental`,`localModelLean`],onValue:!0,offValue:!1,activeValues:[!0],readEnabled:null,enableAlso:null,resetScope:`gate`,restartHint:null},{id:`cliAgents`,title:()=>C(`labsPage.cliAgents.title`),description:()=>C(`labsPage.cliAgents.description`),docsUrl:`https://docs.openclaw.ai/gateway/configuration-reference#gateway`,configPath:[`gateway`,`cliAgents`,`enabled`],onValue:!0,offValue:!1,activeValues:[!0],readEnabled:null,enableAlso:null,resetScope:`gate`,restartHint:null},{id:`customPluginUi`,title:()=>C(`labsPage.customPluginUi.title`),description:()=>C(`labsPage.customPluginUi.description`),docsUrl:`https://docs.openclaw.ai/plugins/feature-plugins`,configPath:[`gateway`,`controlUi`,`experimental`,`customPlugins`],onValue:!0,offValue:!1,activeValues:[!0],readEnabled:null,enableAlso:null,resetScope:`gate`,restartHint:()=>C(`labsPage.customPluginUi.restartRequired`)},{id:`auditMessages`,title:()=>C(`labsPage.auditMessages.title`),description:()=>C(`labsPage.auditMessages.description`),docsUrl:`https://docs.openclaw.ai/gateway/audit`,configPath:[`logging`,`audit`,`messages`],onValue:`direct`,offValue:`off`,activeValues:[`direct`,`all`],readEnabled:null,enableAlso:null,resetScope:`gate`,restartHint:()=>C(`labsPage.restartRequired`)},{id:`hostDesktop`,title:()=>C(`labsPage.hostDesktop.title`),description:()=>C(`labsPage.hostDesktop.description`),docsUrl:`https://docs.openclaw.ai/gateway/configuration-reference#desktop`,configPath:[`desktop`,`host`,`enabled`],onValue:!0,offValue:!1,activeValues:[!0],readEnabled:null,enableAlso:null,resetScope:`gate`,restartHint:()=>C(`labsPage.restartRequired`)},{id:`workerDesktop`,title:()=>C(`labsPage.workerDesktop.title`),description:()=>C(`labsPage.workerDesktop.description`),docsUrl:`https://docs.openclaw.ai/gateway/cloud-workers#desktop-interactive`,configPath:[`cloudWorkers`,`desktop`],onValue:!0,offValue:!1,activeValues:[!0],readEnabled:null,enableAlso:null,resetScope:`gate`,restartHint:()=>C(`labsPage.restartRequired`)}]})))()}var Q;function $(){return($=e((()=>{i(),m(),p(),y(),v(),k(),L(),S(),u(),w(),s(),F(),c(),a(),Z(),Q=class extends l{constructor(...e){super(...e),this.busyFeatureId=null,this.pendingValues={},this.saveError=null,this.gateway=new P(this,{getGateway:()=>this.context?.gateway,invalidateRequests:()=>{this.busyFeatureId=null,this.pendingValues={},this.saveError=null}}),this.subscriptions=new f(this).effect(()=>this.context?.runtimeConfig,e=>(e.ensureLoaded(),e.subscribe(()=>this.requestUpdate())))}disconnectedCallback(){this.subscriptions.clear(),super.disconnectedCallback()}editableConfig(){let e=this.context?.runtimeConfig.state.configSnapshot;return d(e)}featureEnabled(e){let t=this.pendingValues[e.id];return t===void 0?W(this.editableConfig(),e).enabled:t}canToggle(){let e=this.context?.runtimeConfig.state;return!!(e?.connected&&e.configSnapshot?.hash&&!e.configLoading&&this.busyFeatureId===null)}clearPendingValue(e){let t={...this.pendingValues};delete t[e],this.pendingValues=t}async updateFeature(e,t,n){let r=this.gateway.capture(),i=this.context.runtimeConfig;if(!r||!this.canToggle())return;let a=()=>this.gateway.isCurrent(r)&&this.context.runtimeConfig===i;this.busyFeatureId=e.id,this.pendingValues={...this.pendingValues,[e.id]:t},this.saveError=null;try{let t=await i.patch({raw:n,note:`labs: update ${e.id}`});a()&&!t&&(this.saveError=i.state.lastError??C(`labsPage.saveFailed`))}catch(e){a()&&(this.saveError=o(e))}finally{a()&&(this.clearPendingValue(e.id),this.busyFeatureId===e.id&&(this.busyFeatureId=null))}}setFeatureEnabled(e,t){let n=this.editableConfig(),r=t===W(n,e).defaultEnabled?q(n,e):null;this.updateFeature(e,t,r??G(n,e,t))}renderFeature(e){let t=e.title(),n=W(this.editableConfig(),e),r=this.canToggle(),i=C(n.overridden?`configForm.defaultValue`:`configForm.usingDefault`,{value:n.defaultEnabled?C(`common.enabled`):C(`common.disabled`)}),a=h`
${e.description()}
<a href=${e.docsUrl} target=${E} rel=${T()}
>${C(`labsPage.documentation`)}</a
>${e.restartHint?h` <span>${e.restartHint()}</span>`:_}
<span>${i}</span>
`;return j({title:t,description:a,checked:this.featureEnabled(e),disabled:!r,onChange:t=>this.setFeatureEnabled(e,t)})}render(){let e=[...X.map(e=>this.renderFeature(e)),this.saveError?D({title:C(`labsPage.saveErrorTitle`),description:h`<span role="alert">${this.saveError}</span>`}):_],t=O(A({title:C(`labsPage.sectionTitle`),description:C(`labsPage.sectionDescription`)},e));return h`
${M({title:x(`labs`),subtitle:h`${C(`labsPage.intro`)}
${N(`https://docs.openclaw.ai/concepts/experimental-features`)}`})}
${I(t)}
`}},r([n({context:b,subscribe:!0})],Q.prototype,`context`,void 0),r([g()],Q.prototype,`busyFeatureId`,void 0),r([g()],Q.prototype,`pendingValues`,void 0),r([g()],Q.prototype,`saveError`,void 0),customElements.get(`openclaw-labs-page`)||customElements.define(`openclaw-labs-page`,Q)})))()}$();
//# sourceMappingURL=labs-page-C1nec0B-.js.map