UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

5 lines • 2.81 kB
import{n as createLazyRuntimeMethodBinder,r as createLazyRuntimeModule}from"../../lazy-runtime-Ds6M7vp4.mjs";import{t as definePluginEntry}from"../../plugin-entry-DhKiQ4Uu.mjs";import{i as OMLX_PROVIDER_ID,r as OMLX_LOCAL_API_KEY,t as OMLX_API_KEY_ENV_VAR}from"../../defaults-BVmCrQ3O.mjs";import{t as omlxEmbeddingProvider}from"../../memory-embedding-adapter-BIrX2kLX.mjs"; //!extensions/omlx/provider-discovery.ts var provider_discovery_default={id:OMLX_PROVIDER_ID,label:`oMLX`,docsPath:`/providers/omlx`,envVars:[OMLX_API_KEY_ENV_VAR],auth:[],catalog:{order:`late`,run:async e=>{const{discoverOmlxProvider:t}=await import(`./setup.js`);return t(e)}},resolveSyntheticAuth:({providerConfig:e})=>{if(e?.apiKey&&e.apiKey!==`omlx-local`)return;return{apiKey:OMLX_LOCAL_API_KEY,source:`oMLX local server`,mode:`api-key`}},prepareRuntimeAuthV2:async({config:e,provider:t,model:n,apiKey:r})=>{const[{CUSTOM_LOCAL_AUTH_MARKER:i,findNormalizedProviderValue:a},{getModelProviderRequestTransport:o}]=await Promise.all([import(`../../plugin-sdk/provider-auth.js`),import(`../../plugin-sdk/agent-harness-runtime.js`)]);const s=a(e?.models?.providers,t);const c=o(n)??s?.request;if(s?.apiKey&&s.apiKey!==`omlx-local`&&c?.auth?.mode!==`header`)return;const l=c?.auth;if(l?.mode===`authorization-bearer`||(l?.mode===`header`?l.headerName.trim().toLowerCase()===`authorization`:[s?.headers,c?.headers,n.headers].some(e=>Object.entries(e??{}).some(([e,t])=>e.trim().toLowerCase()===`authorization`&&Boolean(typeof t===`string`?t.trim():t)))))return{apiKey:OMLX_LOCAL_API_KEY};if(s?.apiKey===`omlx-local`||r===`omlx-local`||r===i||c?.auth?.mode===`header`)return{apiKey:i}}}; //!extensions/omlx/index.ts const setup=createLazyRuntimeMethodBinder(createLazyRuntimeModule(()=>import(`./setup.js`)));var omlx_default=definePluginEntry({id:`omlx`,name:`oMLX Provider`,description:`Local Apple Silicon chat and memory embeddings through oMLX`,register(e){e.registerEmbeddingProvider(omlxEmbeddingProvider);e.registerProvider({...provider_discovery_default,auth:[{id:`local`,label:`oMLX`,hint:`Connect to an oMLX server on Apple Silicon`,kind:`custom`,appGuidedSetup:{detectAvailability:setup(e=>e.detectOmlxAvailability),detect:setup(e=>e.detectOmlx),prepare:setup(e=>e.prepareOmlx)},run:setup(e=>e.configureOmlxInteractive),validateNonInteractive:setup(e=>e.validateOmlxNonInteractive),runNonInteractive:setup(e=>e.configureOmlxNonInteractive)}],shouldDeferSyntheticProfileAuth:({resolvedApiKey:e})=>e===OMLX_LOCAL_API_KEY,wizard:{setup:{choiceId:`omlx`,choiceLabel:`oMLX`,choiceHint:`Local Apple Silicon server`,groupId:`omlx`,groupLabel:`oMLX`,groupHint:`Local chat and memory embeddings`,methodId:`local`},modelPicker:{label:`oMLX`,hint:`Discover models from the oMLX server`,methodId:`local`}}})}});export{omlx_default as default};