Files
openclaw/src/plugin-sdk/lmstudio.ts
Rugved Somwanshi 0cfb83edfa feat: LM Studio Integration (#53248)
* Feat: LM Studio Integration

* Format

* Support usage in streaming true

Fix token count

* Add custom window check

* Drop max tokens fallback

* tweak docs

Update generated

* Avoid error if stale header does not resolve

* Fix test

* Fix test

* Fix rebase issues

Trim code

* Fix tests

Drop keyless

Fixes

* Fix linter issues in tests

* Update generated artifacts

* Do not have fatal header resoltuion for discovery

* Do the same for API key as well

* fix: honor lmstudio preload runtime auth

* fix: clear stale lmstudio header auth

* fix: lazy-load lmstudio runtime facade

* fix: preserve lmstudio shared synthetic auth

* fix: clear stale lmstudio header auth in discovery

* fix: prefer lmstudio header auth for discovery

* fix: honor lmstudio header auth in warmup paths

* fix: clear stale lmstudio profile auth

* fix: ignore lmstudio env auth on header migration

* fix: use local lmstudio setup seam

* fix: resolve lmstudio rebase fallout

---------

Co-authored-by: Frank Yang <frank.ekn@gmail.com>
2026-04-13 15:22:44 +08:00

68 lines
2.3 KiB
TypeScript

export type {
OpenClawPluginApi,
ProviderAuthContext,
ProviderAuthMethodNonInteractiveContext,
ProviderAuthResult,
ProviderCatalogContext,
ProviderDiscoveryContext,
ProviderPrepareDynamicModelContext,
ProviderRuntimeModel,
} from "../plugins/types.js";
export type { LmstudioModelBase, LmstudioModelWire } from "./lmstudio-runtime.js";
export {
LMSTUDIO_DEFAULT_API_KEY_ENV_VAR,
LMSTUDIO_DEFAULT_BASE_URL,
LMSTUDIO_DEFAULT_EMBEDDING_MODEL,
LMSTUDIO_DEFAULT_INFERENCE_BASE_URL,
LMSTUDIO_DEFAULT_LOAD_CONTEXT_LENGTH,
LMSTUDIO_DEFAULT_MODEL_ID,
LMSTUDIO_LOCAL_API_KEY_PLACEHOLDER,
LMSTUDIO_MODEL_PLACEHOLDER,
LMSTUDIO_PROVIDER_ID,
LMSTUDIO_PROVIDER_LABEL,
buildLmstudioAuthHeaders,
discoverLmstudioModels,
ensureLmstudioModelLoaded,
fetchLmstudioModels,
mapLmstudioWireEntry,
normalizeLmstudioProviderConfig,
resolveLoadedContextWindow,
resolveLmstudioConfiguredApiKey,
resolveLmstudioInferenceBase,
resolveLmstudioProviderHeaders,
resolveLmstudioReasoningCapability,
resolveLmstudioRuntimeApiKey,
resolveLmstudioServerBase,
} from "./lmstudio-runtime.js";
type FacadeModule = typeof import("@openclaw/lmstudio/api.js");
import { loadBundledPluginPublicSurfaceModuleSync } from "./facade-runtime.js";
function loadFacadeModule(): FacadeModule {
return loadBundledPluginPublicSurfaceModuleSync<FacadeModule>({
dirName: "lmstudio",
artifactBasename: "api.js",
});
}
export const promptAndConfigureLmstudioInteractive: FacadeModule["promptAndConfigureLmstudioInteractive"] =
((...args) =>
loadFacadeModule().promptAndConfigureLmstudioInteractive(
...args,
)) as FacadeModule["promptAndConfigureLmstudioInteractive"];
export const configureLmstudioNonInteractive: FacadeModule["configureLmstudioNonInteractive"] = ((
...args
) =>
loadFacadeModule().configureLmstudioNonInteractive(
...args,
)) as FacadeModule["configureLmstudioNonInteractive"];
export const discoverLmstudioProvider: FacadeModule["discoverLmstudioProvider"] = ((...args) =>
loadFacadeModule().discoverLmstudioProvider(...args)) as FacadeModule["discoverLmstudioProvider"];
export const prepareLmstudioDynamicModels: FacadeModule["prepareLmstudioDynamicModels"] = ((
...args
) =>
loadFacadeModule().prepareLmstudioDynamicModels(
...args,
)) as FacadeModule["prepareLmstudioDynamicModels"];