mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-04 16:21:39 +00:00
* improve: simplify coding session catalog headers * improve: simplify coding session catalog headers
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import {
|
|
resolveAllowedModelRef,
|
|
resolveDefaultAgentId,
|
|
resolveDefaultModelForAgent,
|
|
} from "openclaw/plugin-sdk/agent-runtime";
|
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
|
|
|
|
const CODEX_AGENT_RUNTIME_ID = "codex";
|
|
const CODEX_CATALOG_DEFAULT_MODEL_REF = "openai/gpt-5.6-sol";
|
|
|
|
export function resolveCodexCatalogCreateSession(
|
|
config: OpenClawConfig | undefined,
|
|
requestedAgentId?: string,
|
|
): { model: string; agentRuntime: string } | undefined {
|
|
if (!config) {
|
|
return undefined;
|
|
}
|
|
const agentId = requestedAgentId ?? resolveDefaultAgentId(config);
|
|
const defaultModel = resolveDefaultModelForAgent({ cfg: config, agentId });
|
|
const allowed = resolveAllowedModelRef({
|
|
cfg: config,
|
|
catalog: [],
|
|
raw: CODEX_CATALOG_DEFAULT_MODEL_REF,
|
|
defaultProvider: defaultModel.provider,
|
|
defaultModel: defaultModel.model,
|
|
agentId,
|
|
});
|
|
return "error" in allowed
|
|
? undefined
|
|
: { model: CODEX_CATALOG_DEFAULT_MODEL_REF, agentRuntime: CODEX_AGENT_RUNTIME_ID };
|
|
}
|