





























@@ -8,6 +8,7 @@ import {
88type EmbeddedRunAttemptParams,
99} from "openclaw/plugin-sdk/agent-harness";
1010import {
11+buildAgentRuntimePlan,
1112embeddedAgentLog,
1213nativeHookRelayTesting,
1314onAgentEvent,
@@ -61,25 +62,25 @@ function createParamsWithRuntimePlan(
6162workspaceDir: string,
6263): EmbeddedRunAttemptParams {
6364const params = createParams(sessionFile, workspaceDir);
64-useLightweightCodexRuntimePlan(params);
65-return params;
65+return {
66+ ...params,
67+runtimePlan: buildCodexRuntimePlan(params, workspaceDir),
68+};
6669}
677068-function useLightweightCodexRuntimePlan(params: EmbeddedRunAttemptParams): void {
69-params.runtimePlan = {
70-auth: {},
71-prompt: {
72-resolveSystemPromptContribution: () => undefined,
73-},
74-tools: {
75-normalize: (tools: unknown) => tools,
76-logDiagnostics: () => undefined,
77-},
78-observability: {
79-resolvedRef: `${params.provider}/${params.modelId}`,
80-harnessId: "codex",
81-},
82-} as unknown as NonNullable<EmbeddedRunAttemptParams["runtimePlan"]>;
71+function buildCodexRuntimePlan(params: EmbeddedRunAttemptParams, workspaceDir: string) {
72+return buildAgentRuntimePlan({
73+provider: params.provider,
74+modelId: params.modelId,
75+model: params.model,
76+modelApi: params.model.api,
77+harnessId: "codex",
78+harnessRuntime: "codex",
79+config: params.config,
80+ workspaceDir,
81+agentDir: tempDir,
82+thinkingLevel: params.thinkLevel,
83+});
8384}
84858586function threadStartResult(threadId = "thread-1") {
@@ -504,7 +505,7 @@ describe("runCodexAppServerAttempt", () => {
504505params.config = { tools: { profile: "coding" } };
505506params.sourceReplyDeliveryMode = "message_tool_only";
506507params.messageProvider = "whatsapp";
507-useLightweightCodexRuntimePlan(params);
508+params.runtimePlan = buildCodexRuntimePlan(params, workspaceDir);
508509let seenForceMessageTool: boolean | undefined;
509510__testing.setOpenClawCodingToolsFactoryForTests((options) => {
510511seenForceMessageTool = options?.forceMessageTool;
@@ -545,7 +546,7 @@ describe("runCodexAppServerAttempt", () => {
545546session: { store: sessionsPath, mainKey: "main", scope: "per-sender" },
546547tools: { profile: "coding" },
547548};
548-useLightweightCodexRuntimePlan(params);
549+params.runtimePlan = buildCodexRuntimePlan(params, workspaceDir);
549550await fs.writeFile(
550551sessionsPath,
551552JSON.stringify({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。