UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

6 lines (4 loc) • 3.94 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./config-form-utils-runtime-CqcGJa6w.js","./config-form.node.shared-D-tDfw5e.js","./json-schema-QgwGaU4v.js","./deferred-ui-support-DZEPWjAk.js","./schema-VvtGzI60.js","./system-CeTchkPd.js","./config-form.numeric-ClklwzWp.js","./config-form-analysis-runtime-oVfDtt-o.js","./config-form.search-Z0jyQfrJ.js","./_3_____________________________.js","./_1____________________________.css","./_0____________________________________.css"])))=>i.map(i=>d[i]); import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{$u as t,Qu as n,Uu as r,li as i,oi as a,sr as o}from"./_4____________________________.js";import{CA as s,SA as c,TA as l,fM as u,fk as d,mk as f,wA as p,xM as m}from"./_2_____________________________.js";import{n as h,t as g}from"./en-plugin-management-D2xHjJYC.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,n,r){let i=l(e),a=i.publication,c=v({...n,installed:r.installed,name:o(n.name,96),setting:a?.reference.id===n.id?a.reference.setting:void 0});if(!c)return i.publication?.owner===t&&(i.publication=void 0,i.selectionEpoch+=1,s(i)),()=>void 0;let u={owner:t,reference:c,pathname:p(e)};i.publication=u;let d=a?.owner!==t||a.reference.id!==c.id||a.pathname!==u.pathname;return d&&(i.selectionEpoch+=1),(d||JSON.stringify(a?.reference)!==JSON.stringify(c))&&s(i),()=>{i.publication===u&&(i.publication=void 0,i.selectionEpoch+=1,s(i))}}function C(e,t){let r=l(e),a=r.scope,c=r.selectionEpoch;return async d=>{if(l(e).scope===a&&r.selectionEpoch===c){if(window.dispatchEvent(new CustomEvent(u,{detail:{open:!0}})),d&&`question`in d)r.pendingDraft=[r.pendingDraft,d.question].filter(Boolean).join(` `);else if(d){let s=d,u;try{({formatPluginHelpValue:u}=await n(()=>import(`./plugin-help-value-BJmVfihV.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url))}catch{l(e).scope===a&&r.selectionEpoch===c&&f({severity:`error`,message:i(`custodian.pluginHelpFailed`)});return}if(l(e).scope!==a||r.selectionEpoch!==c)return;let p=u(s.value,s.sensitive),m=`${i(`custodian.pluginHelpQuestion`,{setting:o(s.label,96)})}\n\n${i(`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:s.path.map(String),label:o(s.label,96)}})??h.reference)}r.focusRequest+=1,s(r)}}}function w(e){let t=l(e);return t.publication?.pathname===p(e)?t.publication.reference:void 0}function T(e){let t=l(e),n=t.pendingDraft;return t.pendingDraft=``,n}function E(e){return l(e).focusRequest}function D(){return(D=e((()=>{x(),m(),a(),g(),d(),c(),t(),h()})))()}export{S as a,E as i,w as n,T as o,D as r,C as t};