openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
6 lines (4 loc) • 4.71 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./plugin-help-value-CI8Y-xxa.js","./lit-runtime-P5vbNq6b.js","./gateway-runtime-5YzSCmfV.js","./control-ui-boot-shared-JlZTSJEC.js","./control-ui-boot-shared-3SP_aL-Y.js","./control-ui-boot-shared-90V688bk.js","./control-ui-boot-shared-DBJri5ri.js","./control-ui-boot-shared-BykNRHBP.js","./control-ui-boot-shared-Rs4iS2kF.js","./plugin-contracts-runtime-CsJ0WpAd.js","./markdown-runtime-Hc-lvqnn.js","./config-runtime-CgOgfOrG.js","./control-ui-boot-shared-CG9HtEG-.js","./control-ui-boot-shared-73R4ErOy.js","./control-ui-boot-shared-CcmBeh0v.js","./control-ui-boot-shared-BR12heUA.js","./control-ui-boot-shared-CApmg5ot.js","./css-chat-Ckz95ikh.js","./chat-transcript-layout-w3EszKw8.js","./css-chat-custodian-new-session-B_euK-Vu.js","./sidebar-update-runtime-B0vYzX3D.js","./config-form.node.shared-YCBWiPxU.js","./config-form.search-Cgp2izNk.js","./control-ui-core-D-VUH4Gq.css","./control-ui-boot-shared-BJ_QKfFn.css","./css-chat-DCHf01mf.css","./css-chat-custodian-new-session-CEndYuO5.css","./sidebar-update-runtime-ah7rgQE7.css"])))=>i.map(i=>d[i]);
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{Bi as t,Ii as n,Ui as r,zi as i}from"./control-ui-foundation-ZY_Flbbd.js";import{Qs as a,Ul as o,Wl as s,Xs as c,Ys as l,Zs as u,hu as d,uu as f}from"./control-ui-core-3P365fbR.js";import{$r as p,Wr as m}from"./control-ui-core-CFW9Qtjn.js";import{di as h,fi as g}from"./control-ui-boot-shared-DoKu-5Ju.js";function _(e,t){let n=r(t);if(!n)return;let i={incomplete:!0};e.declared=i;let a=()=>JSON.stringify(e).length<=y;if(!a()){delete e.declared;return}let o=n.incomplete===!0;for(let e of b){let t=n[e];if(t===void 0)continue;if(!Array.isArray(t)){o=!0;continue}let r=[];if(i[e]=r,!a()){delete i[e],o=!0;continue}let s=t.filter(e=>typeof e==`string`&&e.length>0&&e.length<=128),c=[...new Set(s)].toSorted();o||=s.length!==t.length||c.length>8;for(let e of c.slice(0,8))r.push(e),a()||(r.pop(),o=!0)}o||delete i.incomplete}function v(e){let t=r(e);if(!t||typeof t.id!=`string`||!/^[A-Za-z0-9@][A-Za-z0-9@._/-]{0,127}$/u.test(t.id)||typeof t.name!=`string`||!t.name.trim()||t.name.length>96)return;let n={id:t.id,name:t.name.trim()};typeof t.installed==`boolean`&&(n.installed=t.installed);let i=r(t.setting);return i&&Array.isArray(i.path)&&i.path.length>0&&i.path.length<=16&&i.path.every(e=>typeof e==`string`&&e.length>0&&e.length<=64)&&typeof i.label==`string`&&i.label.trim()&&i.label.length<=96&&(n.setting={path:[...i.path],label:i.label.trim()}),JSON.stringify(n).length>1024&&delete n.setting,_(n,t.declared),JSON.stringify(n).length<=1024?n:void 0}var y,b;function x(){return(x=e((()=>{y=1024,b=[`tools`,`providers`,`channels`,`contracts`,`skills`,`mcpServers`]})))()}function S(e,t,r,i){let o=a(e),s=o.publication,l=v({...r,installed:i.installed,name:n(r.name,96),setting:s?.reference.id===r.id?s.reference.setting:void 0});if(!l)return C(e,t),()=>void 0;let d={owner:t,reference:l,pathname:u(e),...i};o.publication=d;let f=s?.owner!==t||s.reference.id!==l.id||s.pathname!==d.pathname;return f&&(o.selectionEpoch+=1),(f||s?.overview!==i.overview||s?.installed!==i.installed||JSON.stringify(s?.reference)!==JSON.stringify(l))&&c(o),()=>{o.publication===d&&(o.publication=void 0,o.selectionEpoch+=1,c(o))}}function C(e,t){let n=a(e);n.publication?.owner===t&&(n.publication=void 0,n.selectionEpoch+=1,c(n))}function w(e,t){let r=a(e),o=r.scope,l=r.selectionEpoch;return async u=>{if(a(e).scope===o&&r.selectionEpoch===l){if(window.dispatchEvent(new CustomEvent(m,{detail:{open:!0}})),u&&`question`in u)r.pendingDraft=[r.pendingDraft,u.question].filter(Boolean).join(`
`);else if(u){let c=u,f;try{({formatPluginHelpValue:f}=await i(()=>import(`./plugin-help-value-CI8Y-xxa.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]),import.meta.url))}catch{a(e).scope===o&&r.selectionEpoch===l&&s({message:d(`custodian.pluginHelpFailed`)});return}if(a(e).scope!==o||r.selectionEpoch!==l)return;let p=f(c.value,c.sensitive),m=`${d(`custodian.pluginHelpQuestion`,{setting:n(c.label,96)})}\n\n${d(`custodian.pluginHelpValue`,{value:p})}`;r.pendingDraft=[r.pendingDraft,m].filter(Boolean).join(`
`);let h=r.publication;h?.reference.id===t.id&&(h.reference=v({...h.reference,setting:{path:c.path.map(String),label:n(c.label,96)}})??h.reference)}r.focusRequest+=1,c(r)}}}function T(e){let t=a(e);return t.publication?.pathname===u(e)?t.publication.reference:void 0}function E(e){let t=a(e),n=t.pendingDraft;return t.pendingDraft=``,n}function D(e){return a(e).focusRequest}function O(){return(O=e((()=>{x(),p(),f(),h(),o(),l(),t(),g()})))()}export{S as a,D as i,T as n,E as o,O as r,w as t};