mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-17 16:12:21 -06:00
47d37ddd54
* fix: reuse model selection metadata snapshot * test: cover concurrent model policy snapshot reuse --------- Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
/** Prepared plugin metadata handoff for runtime model normalization. */
|
|
import { normalizeModelRef } from "../../agents/model-selection.js";
|
|
import { RUNTIME_MODEL_VISIBILITY_NORMALIZATION } from "../../agents/model-visibility-policy.js";
|
|
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
|
import { getCurrentPluginMetadataSnapshot } from "../../plugins/current-plugin-metadata-snapshot.js";
|
|
|
|
export type RuntimeModelNormalization = NonNullable<Parameters<typeof normalizeModelRef>[2]>;
|
|
|
|
/** Carries the Gateway-owned metadata snapshot through one model-selection run. */
|
|
export function resolveRuntimeNormalization(cfg: OpenClawConfig): RuntimeModelNormalization {
|
|
return {
|
|
...RUNTIME_MODEL_VISIBILITY_NORMALIZATION,
|
|
manifestPlugins: getCurrentPluginMetadataSnapshot({
|
|
config: cfg,
|
|
allowWorkspaceScopedSnapshot: true,
|
|
})?.plugins,
|
|
};
|
|
}
|
|
|
|
export function normalizeRuntimeRef(
|
|
provider: string,
|
|
model: string,
|
|
normalization: RuntimeModelNormalization = RUNTIME_MODEL_VISIBILITY_NORMALIZATION,
|
|
) {
|
|
return normalizeModelRef(provider, model, normalization);
|
|
}
|