mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 22:30:43 +00:00
* fix: keep migrated openai codex routes automatic * scope runtime policy to providers and models * fix runtime policy surfaces * fix ci runtime policy checks * fix doctor stale session runtime pins
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
|
import { resolveAgentHarnessPolicy } from "./harness/policy.js";
|
|
import { resolveDefaultModelForAgent } from "./model-selection.js";
|
|
|
|
type AgentRuntimeMetadata = {
|
|
id: string;
|
|
source: "implicit" | "model" | "provider";
|
|
};
|
|
|
|
export function resolveAgentRuntimeMetadata(
|
|
_cfg: OpenClawConfig,
|
|
_agentId: string,
|
|
_env: NodeJS.ProcessEnv = process.env,
|
|
): AgentRuntimeMetadata {
|
|
return {
|
|
id: "auto",
|
|
source: "implicit",
|
|
};
|
|
}
|
|
|
|
export function resolveModelAgentRuntimeMetadata(params: {
|
|
cfg: OpenClawConfig;
|
|
agentId: string;
|
|
provider?: string;
|
|
model?: string;
|
|
sessionKey?: string;
|
|
}): AgentRuntimeMetadata {
|
|
const resolved =
|
|
params.provider && params.model
|
|
? { provider: params.provider, model: params.model }
|
|
: resolveDefaultModelForAgent({ cfg: params.cfg, agentId: params.agentId });
|
|
const policy = resolveAgentHarnessPolicy({
|
|
provider: resolved.provider,
|
|
modelId: resolved.model,
|
|
config: params.cfg,
|
|
agentId: params.agentId,
|
|
sessionKey: params.sessionKey,
|
|
});
|
|
return {
|
|
id: policy.runtime,
|
|
source: policy.runtimeSource ?? "implicit",
|
|
};
|
|
}
|