Files
openclaw/src/agents/agent-runtime-metadata.ts
pashpashpash 02fe0d8978 Keep OpenAI Codex migrations on automatic runtime routing (#79238)
* 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
2026-05-08 16:05:35 +09:00

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",
};
}