UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

6 lines (4 loc) • 3.92 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./config-form-utils-BqrafwiP.js","./config-form.node.shared-DNbFFflG.js","./json-schema-BDPIr-N8.js","./deferred-ui-support-D-VedBtc.js","./system-Bk-o-QjI.js","./config-form.numeric-ClklwzWp.js","./config-form.constraints-BF6pi17w.js","./config-form.array-items-DbVc_YXt.js","./config-form.search-CIkOo1VV.js","./control-ui-boot-shared-DsegYo6K.js","./control-ui-connection-D5QrEAFW.css","./control-ui-boot-shared-styles-BorAdMVO.css"])))=>i.map(i=>d[i]); import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{eu as t,kc as n,lu as r,uu as i,wa as a,xa as o}from"./control-ui-connection-Bfj9beF_.js";import{FO as s,IO as c,NO as l,Nj as u,PO as d,bD as f,vD as p,wj as m}from"./control-ui-boot-shared-DFTSUQQ0.js";import{n as h,t as g}from"./en-plugin-management-BoZM4tY6.js";function _(e,n){let r=t(n);if(!r)return;let i={incomplete:!0};e.declared=i;let a=()=>JSON.stringify(e).length<=y;if(!a()){delete e.declared;return}let o=r.incomplete===!0;for(let e of b){let t=r[e];if(t===void 0)continue;if(!Array.isArray(t)){o=!0;continue}let n=[];if(i[e]=n,!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))n.push(e),a()||(n.pop(),o=!0)}o||delete i.incomplete}function v(e){let n=t(e);if(!n||typeof n.id!=`string`||!/^[A-Za-z0-9@][A-Za-z0-9@._/-]{0,127}$/u.test(n.id)||typeof n.name!=`string`||!n.name.trim()||n.name.length>96)return;let r={id:n.id,name:n.name.trim()};typeof n.installed==`boolean`&&(r.installed=n.installed);let i=t(n.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&&(r.setting={path:[...i.path],label:i.label.trim()}),JSON.stringify(r).length>1024&&delete r.setting,_(r,n.declared),JSON.stringify(r).length<=1024?r: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 a=c(e),o=a.publication,l=v({...r,installed:i.installed,name:n(r.name,96),setting:o?.reference.id===r.id?o.reference.setting:void 0});if(!l)return a.publication?.owner===t&&(a.publication=void 0,a.selectionEpoch+=1,d(a)),()=>void 0;let u={owner:t,reference:l,pathname:s(e)};a.publication=u;let f=o?.owner!==t||o.reference.id!==l.id||o.pathname!==u.pathname;return f&&(a.selectionEpoch+=1),(f||JSON.stringify(o?.reference)!==JSON.stringify(l))&&d(a),()=>{a.publication===u&&(a.publication=void 0,a.selectionEpoch+=1,d(a))}}function C(e,t){let i=c(e),o=i.scope,s=i.selectionEpoch;return async l=>{if(c(e).scope===o&&i.selectionEpoch===s){if(window.dispatchEvent(new CustomEvent(m,{detail:{open:!0}})),l&&`question`in l)i.pendingDraft=[i.pendingDraft,l.question].filter(Boolean).join(` `);else if(l){let u=l,d;try{({formatPluginHelpValue:d}=await r(()=>import(`./plugin-help-value-Cx6QYond.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url))}catch{c(e).scope===o&&i.selectionEpoch===s&&f({message:a(`custodian.pluginHelpFailed`)});return}if(c(e).scope!==o||i.selectionEpoch!==s)return;let p=d(u.value,u.sensitive),m=`${a(`custodian.pluginHelpQuestion`,{setting:n(u.label,96)})}\n\n${a(`custodian.pluginHelpValue`,{value:p})}`;i.pendingDraft=[i.pendingDraft,m].filter(Boolean).join(` `);let h=i.publication;h?.reference.id===t.id&&(h.reference=v({...h.reference,setting:{path:u.path.map(String),label:n(u.label,96)}})??h.reference)}i.focusRequest+=1,d(i)}}}function w(e){let t=c(e);return t.publication?.pathname===s(e)?t.publication.reference:void 0}function T(e){let t=c(e),n=t.pendingDraft;return t.pendingDraft=``,n}function E(e){return c(e).focusRequest}function D(){return(D=e((()=>{x(),u(),o(),g(),p(),l(),i(),h()})))()}export{S as a,E as i,w as n,T as o,D as r,C as t};