openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
6 lines (4 loc) • 4.85 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./plugin-help-value-B31Fb9zo.js","./lit-runtime-IOnANfcZ.js","./gateway-runtime-C77LeWZN.js","./session-snapshot-database-BBKeXATO.js","./control-ui-boot-shared-gZIpWrfw.js","./control-ui-boot-shared-CkXlyZBY.js","./control-ui-boot-shared-SQHdJTzb.js","./control-ui-boot-shared-VLPz5vN2.js","./plugin-contracts-runtime-ByiEPbv_.js","./control-ui-boot-shared-Q8KG_noF.js","./config-runtime-BecGLziM.js","./markdown-runtime-ORQpioyT.js","./control-ui-boot-chat-Ye5j4vAg.js","./control-ui-boot-shared-UG5ko-VG.js","./control-ui-boot-shared-XreXSF7h.js","./control-ui-boot-shared-dOnP4mAA.js","./control-ui-boot-shared-styles-BXPMRytW.js","./sidebar-update-runtime-DQZboSgD.js","./control-ui-boot-chat-CmENwCKi.js","./control-ui-boot-chat-XPUNenUd.js","./control-ui-boot-chat-k_u3nGjS.js","./chat-transcript-styles-BN-TorbW.js","./control-ui-boot-chat-styles-BcslGtWC.js","./config-form.node.shared-BA7MSXRE.js","./config-form.search-cybY4IfR.js","./control-ui-core-DI-Q_yCI.css","./control-ui-boot-shared-styles-DUf4zEvn.css","./control-ui-boot-shared-DIWJGbGi.css","./sidebar-update-runtime-Bpn2ByHA.css","./chat-transcript-styles-B0IJwY9P.css","./control-ui-boot-chat-styles-SRk09zDG.css","./control-ui-boot-chat-C2DT0d4M.css"])))=>i.map(i=>d[i]);
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{Cc as t,Ec as n,Pu as r,Tc as i,_u as a,vu as o,wc as s,zu as c}from"./control-ui-core-CBJ5efDh.js";import{ei as l,ui as u}from"./control-ui-core-DtLivg_r.js";import{Bi as d,ma as f,pa as p,ya as m}from"./ui-CmSP4d14.js";import{dt as h,ft as g}from"./control-ui-boot-chat-CGYcTLro.js";function _(e,t){let n=m(t);if(!n)return;let r={incomplete:!0};e.declared=r;let i=()=>JSON.stringify(e).length<=y;if(!i()){delete e.declared;return}let a=n.incomplete===!0;for(let e of b){let t=n[e];if(t===void 0)continue;if(!Array.isArray(t)){a=!0;continue}let o=[];if(r[e]=o,!i()){delete r[e],a=!0;continue}let s=t.filter(e=>typeof e==`string`&&e.length>0&&e.length<=128),c=[...new Set(s)].toSorted();a||=s.length!==t.length||c.length>8;for(let e of c.slice(0,8))o.push(e),i()||(o.pop(),a=!0)}a||delete r.incomplete}function v(e){let t=m(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 r=m(t.setting);return r&&Array.isArray(r.path)&&r.path.length>0&&r.path.length<=16&&r.path.every(e=>typeof e==`string`&&e.length>0&&e.length<=64)&&typeof r.label==`string`&&r.label.trim()&&r.label.length<=96&&(n.setting={path:[...r.path],label:r.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,a){let o=n(e),c=o.publication,l=v({...r,installed:a.installed,name:d(r.name,96),setting:c?.reference.id===r.id?c.reference.setting:void 0});if(!l)return o.publication?.owner===t&&(o.publication=void 0,o.selectionEpoch+=1,s(o)),()=>void 0;let u={owner:t,reference:l,pathname:i(e),...a};o.publication=u;let f=c?.owner!==t||c.reference.id!==l.id||c.pathname!==u.pathname;return f&&(o.selectionEpoch+=1),(f||c?.overview!==a.overview||c?.installed!==a.installed||JSON.stringify(c?.reference)!==JSON.stringify(l))&&s(o),()=>{o.publication===u&&(o.publication=void 0,o.selectionEpoch+=1,s(o))}}function C(e,t){let r=n(e),i=r.scope,a=r.selectionEpoch;return async u=>{if(n(e).scope===i&&r.selectionEpoch===a){if(window.dispatchEvent(new CustomEvent(l,{detail:{open:!0}})),u&&`question`in u)r.pendingDraft=[r.pendingDraft,u.question].filter(Boolean).join(`
`);else if(u){let s=u,l;try{({formatPluginHelpValue:l}=await p(()=>import(`./plugin-help-value-B31Fb9zo.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,28,29,30,31]),import.meta.url))}catch{n(e).scope===i&&r.selectionEpoch===a&&o({message:c(`custodian.pluginHelpFailed`)});return}if(n(e).scope!==i||r.selectionEpoch!==a)return;let f=l(s.value,s.sensitive),m=`${c(`custodian.pluginHelpQuestion`,{setting:d(s.label,96)})}\n\n${c(`custodian.pluginHelpValue`,{value:f})}`;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:d(s.label,96)}})??h.reference)}r.focusRequest+=1,s(r)}}}function w(e){let t=n(e);return t.publication?.pathname===i(e)?t.publication.reference:void 0}function T(e){let t=n(e),r=t.pendingDraft;return t.pendingDraft=``,r}function E(e){return n(e).focusRequest}function D(){return(D=e((()=>{x(),u(),r(),h(),a(),t(),f(),g()})))()}export{S as a,E as i,w as n,T as o,D as r,C as t};