openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
44 lines (43 loc) • 1.69 kB
JavaScript
import "./model-ref-shared-DqE2RqZv.mjs";
import { k as tryResolveConfiguredAgentWorkspaceDir } from "./agent-scope-config-DmXgFGKP.mjs";
import { t as getPluginRuntimeGenerationRegistry } from "./generation-state-CbpjEoxA.mjs";
import { n as withPluginRuntimeGenerationScope } from "./generation-scope-Cq7RLFex.mjs";
import { s as loadManifestMetadataSnapshot } from "./manifest-contract-eligibility-DoGGge-2.mjs";
import { r as modelKey } from "./provider-registry-index-DhPtwFh_.mjs";
import { n as resolvePluginProviderRegistryCore } from "./providers.runtime-6wA04_U8.mjs";
//#region src/commands/models/model-selection.runtime.ts
/** Prepares only the provider owners needed by a model config mutation. */
function withModelCommandProviderRuntime(e, t) {
const n = getPluginRuntimeGenerationRegistry();
const r = e.runtimeConfig;
const i = process.env;
const a = tryResolveConfiguredAgentWorkspaceDir(r, i);
const o = loadManifestMetadataSnapshot({
config: r,
env: i,
workspaceDir: a
});
const s = /* @__PURE__ */ new Set();
const c = /* @__PURE__ */ new Set();
const l = withPluginRuntimeGenerationScope({ metadataSnapshot: o }, e.selectModelRefs);
for (const e of l) if (e) {
s.add(e.provider);
c.add(modelKey(e.provider, e.model));
}
const u = s.size ? resolvePluginProviderRegistryCore({
config: r,
env: i,
workspaceDir: a,
pluginMetadataSnapshot: o,
providerRefs: [...s],
modelRefs: [...c],
registryScope: "exact",
activate: false
}) : void 0;
return withPluginRuntimeGenerationScope({
metadataSnapshot: o,
pluginRegistry: u?.registry
}, () => t(!n || n.providers.length > 0));
}
//#endregion
export { withModelCommandProviderRuntime };