mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-08 15:13:55 +00:00
26 lines
990 B
TypeScript
26 lines
990 B
TypeScript
/**
|
|
* Session runtime compatibility helpers.
|
|
*
|
|
* Resolves persisted runtime overrides without leaking provider-specific CLI runtime bindings across model routes.
|
|
*/
|
|
import type { SessionEntry } from "../config/sessions.js";
|
|
import { isDefaultAgentRuntimeId } from "./agent-runtime-id.js";
|
|
import { normalizeOptionalAgentRuntimeId } from "./agent-runtime-id.js";
|
|
|
|
/** Persisted runtime fields used to recover session runtime compatibility. */
|
|
type SessionRuntimeCompatEntry = Pick<
|
|
SessionEntry,
|
|
"agentHarnessId" | "agentRuntimeOverride"
|
|
>;
|
|
|
|
/** Resolves the persisted runtime id, preferring explicit overrides. */
|
|
export function resolvePersistedSessionRuntimeId(
|
|
entry?: SessionRuntimeCompatEntry,
|
|
): string | undefined {
|
|
const runtimeOverride = normalizeOptionalAgentRuntimeId(entry?.agentRuntimeOverride);
|
|
if (runtimeOverride && !isDefaultAgentRuntimeId(runtimeOverride)) {
|
|
return runtimeOverride;
|
|
}
|
|
return normalizeOptionalAgentRuntimeId(entry?.agentHarnessId);
|
|
}
|