@openclaw/codex 2026.5.26 → 2026.5.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{command-handlers-hYTtzAdy.js → command-handlers-YXjMla3v.js} +4 -4
- package/dist/{compact-C_1JAB4C.js → compact-DIXx9K0Q.js} +1 -1
- package/dist/{computer-use-DSdj1hJY.js → computer-use-CakwWGCR.js} +1 -1
- package/dist/{conversation-binding-OjYqDwhw.js → conversation-binding-CWaG0k5A.js} +3 -3
- package/dist/{dynamic-tools-DlEefKNQ.js → dynamic-tools-BSZIYzfP.js} +14 -1
- package/dist/harness.js +9 -5
- package/dist/index.js +4 -4
- package/dist/media-understanding-provider.js +1 -1
- package/dist/{request-OaxhR46w.js → request-Dtg0vQrE.js} +1 -1
- package/dist/{run-attempt-D8Vxo-Jm.js → run-attempt-BIbGYJog.js} +169 -40
- package/dist/{session-binding-UFjjws4k.js → session-binding-4fRldGaa.js} +2 -0
- package/dist/{side-question-DU7en3_R.js → side-question-v4nixmAs.js} +3 -3
- package/dist/test-api.js +2 -2
- package/dist/{thread-lifecycle-CUXQezJL.js → thread-lifecycle-DZAfY4d6.js} +34 -6
- package/npm-shrinkwrap.json +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +5 -5
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { a as isCodexFastServiceTier, l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
2
2
|
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-_XwpqjR8.js";
|
|
3
3
|
import { l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
4
|
-
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
5
|
-
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-
|
|
4
|
+
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-4fRldGaa.js";
|
|
5
|
+
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-Dtg0vQrE.js";
|
|
6
6
|
import { _ as summarizeCodexAccountUsage, a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatThreads, l as formatComputerUseStatus, o as formatAccount, p as readString$1, s as formatCodexDisplayText, u as formatList } from "./notification-correlation-YINts3PA.js";
|
|
7
7
|
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
8
|
-
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-
|
|
9
|
-
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-
|
|
8
|
+
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-CWaG0k5A.js";
|
|
9
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-CakwWGCR.js";
|
|
10
10
|
import { n as rememberCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
11
11
|
import crypto from "node:crypto";
|
|
12
12
|
import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as defaultCodexAppServerClientFactory } from "./client-factory-fW4Hh9q_.js";
|
|
2
2
|
import { l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
3
|
-
import { i as readCodexAppServerBinding } from "./session-binding-
|
|
3
|
+
import { i as readCodexAppServerBinding } from "./session-binding-4fRldGaa.js";
|
|
4
4
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
5
5
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as resolveCodexAppServerRuntimeOptions, u as resolveCodexComputerUseConfig } from "./config-0-UN67Qg.js";
|
|
2
|
-
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-
|
|
2
|
+
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-Dtg0vQrE.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
//#region extensions/codex/src/app-server/computer-use.ts
|
|
5
5
|
var CodexComputerUseSetupError = class extends Error {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as isCodexFastServiceTier, l as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-0-UN67Qg.js";
|
|
2
2
|
import { l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
3
|
-
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-
|
|
4
|
-
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-
|
|
5
|
-
import { r as CODEX_CONTROL_METHODS } from "./request-
|
|
3
|
+
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-DZAfY4d6.js";
|
|
4
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-4fRldGaa.js";
|
|
5
|
+
import { r as CODEX_CONTROL_METHODS } from "./request-Dtg0vQrE.js";
|
|
6
6
|
import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-YINts3PA.js";
|
|
7
7
|
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-8kIrP817.js";
|
|
8
8
|
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { E as sanitizeInlineImageDataUrl, w as invalidInlineImageText } from "./thread-lifecycle-
|
|
1
|
+
import { E as sanitizeInlineImageDataUrl, w as invalidInlineImageText } from "./thread-lifecycle-DZAfY4d6.js";
|
|
2
2
|
import { asOptionalRecord, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { HEARTBEAT_RESPONSE_TOOL_NAME, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractToolResultMediaArtifact, filterToolResultMediaUrls, isMessagingTool, isMessagingToolSendAction, isToolWrappedWithBeforeToolCallHook, normalizeHeartbeatToolResponse, projectRuntimeToolInputSchema, runAgentHarnessAfterToolCallHook, setBeforeToolCallDiagnosticsEnabled, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
|
+
import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
4
5
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
5
6
|
//#region extensions/codex/src/app-server/dynamic-tool-profile.ts
|
|
6
7
|
const CODEX_APP_SERVER_OWNED_DYNAMIC_TOOL_EXCLUDES = [
|
|
@@ -67,6 +68,7 @@ function createCodexDynamicToolBridge(params) {
|
|
|
67
68
|
const registeredToolNames = new Set(registeredTools.map((tool) => tool.name));
|
|
68
69
|
const quarantinedTools = dedupeQuarantinedDynamicTools([...availableProjection.quarantinedTools, ...registeredProjection.quarantinedTools]);
|
|
69
70
|
warnQuarantinedDynamicTools(quarantinedTools);
|
|
71
|
+
emitQuarantinedDynamicToolDiagnostics(quarantinedTools, params.hookContext);
|
|
70
72
|
const telemetry = {
|
|
71
73
|
didSendViaMessagingTool: false,
|
|
72
74
|
messagingToolSentTexts: [],
|
|
@@ -245,6 +247,17 @@ function warnQuarantinedDynamicTools(tools) {
|
|
|
245
247
|
violations
|
|
246
248
|
})) });
|
|
247
249
|
}
|
|
250
|
+
function emitQuarantinedDynamicToolDiagnostics(tools, ctx) {
|
|
251
|
+
for (const tool of tools) emitTrustedDiagnosticEvent({
|
|
252
|
+
type: "tool.execution.blocked",
|
|
253
|
+
runId: ctx?.runId,
|
|
254
|
+
sessionId: ctx?.sessionId,
|
|
255
|
+
sessionKey: ctx?.sessionKey,
|
|
256
|
+
toolName: tool.tool,
|
|
257
|
+
deniedReason: "unsupported_tool_schema",
|
|
258
|
+
reason: tool.violations.join(", ")
|
|
259
|
+
});
|
|
260
|
+
}
|
|
248
261
|
function dedupeQuarantinedDynamicTools(tools) {
|
|
249
262
|
return [...new Map(tools.map((tool) => [tool.tool, {
|
|
250
263
|
tool: tool.tool,
|
package/dist/harness.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
//#region extensions/codex/harness.ts
|
|
2
|
-
const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = new Set([
|
|
2
|
+
const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = new Set([
|
|
3
|
+
"codex",
|
|
4
|
+
"openai-codex",
|
|
5
|
+
"openai"
|
|
6
|
+
]);
|
|
3
7
|
const CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES = [
|
|
4
8
|
"bootstrap",
|
|
5
9
|
"assemble-before-prompt",
|
|
@@ -28,26 +32,26 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
28
32
|
};
|
|
29
33
|
},
|
|
30
34
|
runAttempt: async (params) => {
|
|
31
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
35
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-BIbGYJog.js");
|
|
32
36
|
return runCodexAppServerAttempt(params, {
|
|
33
37
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
34
38
|
nativeHookRelay: { enabled: true }
|
|
35
39
|
});
|
|
36
40
|
},
|
|
37
41
|
runSideQuestion: async (params) => {
|
|
38
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
42
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-v4nixmAs.js");
|
|
39
43
|
return runCodexAppServerSideQuestion(params, {
|
|
40
44
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
41
45
|
nativeHookRelay: { enabled: true }
|
|
42
46
|
});
|
|
43
47
|
},
|
|
44
48
|
compact: async (params) => {
|
|
45
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
49
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-DIXx9K0Q.js");
|
|
46
50
|
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
47
51
|
},
|
|
48
52
|
reset: async (params) => {
|
|
49
53
|
if (params.sessionFile) {
|
|
50
|
-
const { clearCodexAppServerBinding } = await import("./session-binding-
|
|
54
|
+
const { clearCodexAppServerBinding } = await import("./session-binding-4fRldGaa.js").then((n) => n.a);
|
|
51
55
|
await clearCodexAppServerBinding(params.sessionFile);
|
|
52
56
|
}
|
|
53
57
|
},
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createCodexAppServerAgentHarness } from "./harness.js";
|
|
2
2
|
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-0-UN67Qg.js";
|
|
3
3
|
import { buildCodexProvider } from "./provider.js";
|
|
4
|
-
import { C as defaultCodexAppInventoryCache, b as ensureCodexPluginActivation, x as pluginReadParams } from "./thread-lifecycle-
|
|
4
|
+
import { C as defaultCodexAppInventoryCache, b as ensureCodexPluginActivation, x as pluginReadParams } from "./thread-lifecycle-DZAfY4d6.js";
|
|
5
5
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
6
|
-
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-
|
|
6
|
+
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-Dtg0vQrE.js";
|
|
7
7
|
import { s as formatCodexDisplayText } from "./notification-correlation-YINts3PA.js";
|
|
8
8
|
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-8kIrP817.js";
|
|
9
|
-
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-
|
|
9
|
+
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-CWaG0k5A.js";
|
|
10
10
|
import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
|
|
11
11
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
12
12
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
@@ -47,7 +47,7 @@ async function handleCodexCommand(ctx, options = {}) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
async function loadDefaultCodexSubcommandHandler() {
|
|
50
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
50
|
+
const { handleCodexSubcommand } = await import("./command-handlers-YXjMla3v.js");
|
|
51
51
|
return handleCodexSubcommand;
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
@@ -4,7 +4,7 @@ import { l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
|
4
4
|
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
5
5
|
import { i as readModelListResult } from "./models-_XwpqjR8.js";
|
|
6
6
|
import { l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
7
|
-
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-
|
|
7
|
+
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-DZAfY4d6.js";
|
|
8
8
|
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
9
9
|
import "openclaw/plugin-sdk/media-understanding";
|
|
10
10
|
//#region extensions/codex/media-understanding-provider.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as CodexAppServerRpcError } from "./client-BVK_jmHW.js";
|
|
2
|
-
import { S as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-
|
|
2
|
+
import { S as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-DZAfY4d6.js";
|
|
3
3
|
import { a as releaseLeasedSharedCodexAppServerClient, c as withTimeout, i as getLeasedSharedCodexAppServerClient, m as resolveCodexAppServerHomeDir, r as createIsolatedCodexAppServerClient } from "./shared-client-8kIrP817.js";
|
|
4
4
|
import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
@@ -2,20 +2,20 @@ import { n as defaultLeasedCodexAppServerClientFactory } from "./client-factory-
|
|
|
2
2
|
import { c as readCodexPluginConfig, d as resolveCodexPluginsPolicy, f as shouldAutoApproveCodexAppServerApprovals, i as isCodexAppServerApprovalPolicyAllowedByRequirements, l as resolveCodexAppServerRuntimeOptions, o as isCodexSandboxExecServerEnabled, p as withMcpElicitationsApprovalPolicy, u as resolveCodexComputerUseConfig } from "./config-0-UN67Qg.js";
|
|
3
3
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
4
4
|
import { a as isCodexAppServerConnectionClosedError, i as isCodexAppServerApprovalRequest, l as isJsonObject, r as compareCodexAppServerVersions, s as MIN_CODEX_SANDBOX_EXEC_SERVER_APP_SERVER_VERSION } from "./client-BVK_jmHW.js";
|
|
5
|
-
import { C as defaultCodexAppInventoryCache, D as projectContextEngineAssemblyForCodex, O as resolveCodexContextEngineProjectionMaxChars, T as sanitizeCodexHistoryImagePayloads, _ as buildCodexPluginThreadConfigInputFingerprint, a as buildDeveloperInstructions, c as buildTurnCollaborationMode, d as isContextEngineBindingCompatible, g as buildCodexPluginThreadConfig, h as isCodexAppServerProfilerEnabled, i as buildContextEngineBinding, k as resolveCodexContextEngineProjectionReserveTokens, l as buildTurnStartParams, m as startOrResumeThread, n as areCodexDynamicToolFingerprintsCompatible, u as codexDynamicToolsFingerprint, v as mergeCodexThreadConfigs, y as shouldBuildCodexPluginThreadConfig } from "./thread-lifecycle-
|
|
6
|
-
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
7
|
-
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-
|
|
5
|
+
import { C as defaultCodexAppInventoryCache, D as projectContextEngineAssemblyForCodex, O as resolveCodexContextEngineProjectionMaxChars, T as sanitizeCodexHistoryImagePayloads, _ as buildCodexPluginThreadConfigInputFingerprint, a as buildDeveloperInstructions, c as buildTurnCollaborationMode, d as isContextEngineBindingCompatible, g as buildCodexPluginThreadConfig, h as isCodexAppServerProfilerEnabled, i as buildContextEngineBinding, k as resolveCodexContextEngineProjectionReserveTokens, l as buildTurnStartParams, m as startOrResumeThread, n as areCodexDynamicToolFingerprintsCompatible, u as codexDynamicToolsFingerprint, v as mergeCodexThreadConfigs, y as shouldBuildCodexPluginThreadConfig } from "./thread-lifecycle-DZAfY4d6.js";
|
|
6
|
+
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-4fRldGaa.js";
|
|
7
|
+
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-Dtg0vQrE.js";
|
|
8
8
|
import { g as shouldRefreshCodexRateLimitsForUsageLimitMessage, h as resolveCodexUsageLimitResetAtMs, i as readCodexNotificationTurnId, m as formatCodexUsageLimitErrorMessage, n as isCodexNotificationForTurn, r as readCodexNotificationThreadId, s as formatCodexDisplayText, t as describeCodexNotificationCorrelation } from "./notification-correlation-YINts3PA.js";
|
|
9
9
|
import { a as releaseLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthProfileId, f as resolveCodexAppServerAuthProfileIdForAgent, l as refreshCodexAppServerAuthTokens, m as resolveCodexAppServerHomeDir, o as retireSharedCodexAppServerClientIfCurrent, p as resolveCodexAppServerFallbackApiKeyCacheKey, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-8kIrP817.js";
|
|
10
10
|
import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-CTnEWuor.js";
|
|
11
|
-
import { a as resolveCodexDynamicToolsLoading, i as normalizeCodexDynamicToolName, n as filterCodexDynamicTools, r as isForcedPrivateQaCodexRuntime, t as createCodexDynamicToolBridge } from "./dynamic-tools-
|
|
11
|
+
import { a as resolveCodexDynamicToolsLoading, i as normalizeCodexDynamicToolName, n as filterCodexDynamicTools, r as isForcedPrivateQaCodexRuntime, t as createCodexDynamicToolBridge } from "./dynamic-tools-BSZIYzfP.js";
|
|
12
12
|
import { a as handleCodexAppServerElicitationRequest, c as emitDynamicToolTerminalDiagnostic, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerApprovalRequest, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as emitDynamicToolErrorDiagnostic, r as buildCodexNativeHookRelayConfig, s as emitDynamicToolStartedDiagnostic, t as filterToolsForVisionInputs } from "./vision-tools-DqpLmF5H.js";
|
|
13
|
-
import { t as ensureCodexComputerUse } from "./computer-use-
|
|
13
|
+
import { t as ensureCodexComputerUse } from "./computer-use-CakwWGCR.js";
|
|
14
14
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
15
15
|
import { createHash, randomUUID } from "node:crypto";
|
|
16
16
|
import fsSync from "node:fs";
|
|
17
17
|
import { asBoolean, asFiniteNumber, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
18
|
-
import { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, getBeforeToolCallPolicyDiagnosticState, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, loadCodexBundleMcpThreadConfig, normalizeAgentRuntimeTools, normalizeUsage, registerNativeHookRelay, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir,
|
|
18
|
+
import { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildAgentHookContextChannelFields, buildBootstrapContextForFiles, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, getBeforeToolCallPolicyDiagnosticState, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, loadCodexBundleMcpThreadConfig, normalizeAgentRuntimeTools, normalizeUsage, registerNativeHookRelay, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapFilesForRun, resolveContextEngineOwnerPluginId, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockOptions, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
19
19
|
import { spawn } from "node:child_process";
|
|
20
20
|
import { once } from "node:events";
|
|
21
21
|
import { WebSocketServer } from "ws";
|
|
@@ -23,7 +23,7 @@ import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugi
|
|
|
23
23
|
import fs from "node:fs/promises";
|
|
24
24
|
import path, { posix } from "node:path";
|
|
25
25
|
import { createDiagnosticTraceContextFromActiveScope, emitTrustedDiagnosticEvent, emitTrustedDiagnosticEventWithPrivateData, freezeDiagnosticTraceContext, hasPendingInternalDiagnosticEvent, onInternalDiagnosticEvent, resolveDiagnosticModelContentCapturePolicy } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
26
|
-
import { markAuthProfileBlockedUntil, resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
26
|
+
import { markAuthProfileBlockedUntil, resolveAgentDir as resolveAgentDir$1, resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
27
27
|
import { isToolAllowed } from "openclaw/plugin-sdk/sandbox";
|
|
28
28
|
import { appendRegularFile, pathExists } from "openclaw/plugin-sdk/security-runtime";
|
|
29
29
|
import { buildSessionContext, migrateSessionEntries, parseSessionEntries } from "@earendil-works/pi-coding-agent";
|
|
@@ -4387,6 +4387,7 @@ const CODEX_TURN_SCOPED_WORKSPACE_DEVELOPER_CONTEXT_BASENAMES = new Set([
|
|
|
4387
4387
|
]);
|
|
4388
4388
|
const CODEX_WORKSPACE_DEVELOPER_CONTEXT_BASENAMES = new Set([...CODEX_INHERITED_WORKSPACE_DEVELOPER_CONTEXT_BASENAMES, ...CODEX_TURN_SCOPED_WORKSPACE_DEVELOPER_CONTEXT_BASENAMES]);
|
|
4389
4389
|
const CODEX_HEARTBEAT_CONTEXT_BASENAME = "heartbeat.md";
|
|
4390
|
+
const CODEX_MEMORY_TOOL_NAMES = new Set(["memory_search", "memory_get"]);
|
|
4390
4391
|
const CODEX_NATIVE_HOOK_RELAY_EVENTS_WITH_APP_SERVER_APPROVALS = CODEX_NATIVE_HOOK_RELAY_EVENTS.filter((event) => event !== "permission_request");
|
|
4391
4392
|
const CODEX_BOOTSTRAP_CONTEXT_ORDER = new Map([
|
|
4392
4393
|
["soul.md", 10],
|
|
@@ -5065,13 +5066,18 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
5065
5066
|
resolvedWorkspace,
|
|
5066
5067
|
effectiveWorkspace,
|
|
5067
5068
|
sessionKey: contextSessionKey,
|
|
5068
|
-
sessionAgentId
|
|
5069
|
+
sessionAgentId,
|
|
5070
|
+
memoryToolNames: getCodexWorkspaceMemoryToolNames(toolBridge.availableSpecs)
|
|
5069
5071
|
});
|
|
5070
5072
|
const baseDeveloperInstructions = joinPresentSections(buildDeveloperInstructions(params, { dynamicTools: toolBridge.availableSpecs }), workspaceBootstrapContext.developerInstructions);
|
|
5071
5073
|
const openClawPromptContext = buildCodexOpenClawPromptContext({
|
|
5072
5074
|
params,
|
|
5073
5075
|
skillsPrompt: params.skillsSnapshot?.prompt,
|
|
5074
|
-
workspacePromptContext: workspaceBootstrapContext.promptContext
|
|
5076
|
+
workspacePromptContext: workspaceBootstrapContext.promptContext,
|
|
5077
|
+
workspaceMemoryReference: renderCodexWorkspaceMemoryReference({
|
|
5078
|
+
files: workspaceBootstrapContext.memoryReferenceFiles ?? [],
|
|
5079
|
+
toolNames: workspaceBootstrapContext.memoryToolNames
|
|
5080
|
+
})
|
|
5075
5081
|
});
|
|
5076
5082
|
let promptText = params.prompt;
|
|
5077
5083
|
let developerInstructions = baseDeveloperInstructions;
|
|
@@ -5203,13 +5209,12 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
5203
5209
|
timeoutMs: params.timeoutMs,
|
|
5204
5210
|
timeoutFloorMs: options.startupTimeoutFloorMs
|
|
5205
5211
|
});
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
stream: "codex_app_server.lifecycle",
|
|
5209
|
-
data: { phase: "startup" }
|
|
5210
|
-
});
|
|
5212
|
+
const buildNativeHookRelayFinalConfigPatch = (decision) => {
|
|
5213
|
+
nativeHookRelay?.unregister();
|
|
5211
5214
|
nativeHookRelay = createCodexNativeHookRelay({
|
|
5212
5215
|
options: options.nativeHookRelay,
|
|
5216
|
+
generation: decision.action === "resume" ? decision.binding.nativeHookRelayGeneration : void 0,
|
|
5217
|
+
generationMismatchGraceMs: decision.action === "resume" && !decision.binding.nativeHookRelayGeneration ? CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS : void 0,
|
|
5213
5218
|
events: nativeHookRelayEvents,
|
|
5214
5219
|
agentId: sessionAgentId,
|
|
5215
5220
|
sessionId: params.sessionId,
|
|
@@ -5222,11 +5227,20 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
5222
5227
|
turnStartTimeoutMs: params.timeoutMs,
|
|
5223
5228
|
signal: runAbortController.signal
|
|
5224
5229
|
});
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
+
return {
|
|
5231
|
+
configPatch: nativeHookRelay ? buildCodexNativeHookRelayConfig({
|
|
5232
|
+
relay: nativeHookRelay,
|
|
5233
|
+
events: nativeHookRelayEvents,
|
|
5234
|
+
hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec
|
|
5235
|
+
}) : options.nativeHookRelay?.enabled === false ? buildCodexNativeHookRelayDisabledConfig() : void 0,
|
|
5236
|
+
nativeHookRelayGeneration: nativeHookRelay?.generation
|
|
5237
|
+
};
|
|
5238
|
+
};
|
|
5239
|
+
try {
|
|
5240
|
+
emitCodexAppServerEvent(params, {
|
|
5241
|
+
stream: "codex_app_server.lifecycle",
|
|
5242
|
+
data: { phase: "startup" }
|
|
5243
|
+
});
|
|
5230
5244
|
const threadConfig = mergeCodexThreadConfigs(bundleMcpThreadConfig?.configPatch);
|
|
5231
5245
|
const pluginThreadConfigRequired = !nativeToolSurfaceEnabled || shouldBuildCodexPluginThreadConfig(pluginConfig);
|
|
5232
5246
|
const pluginThreadConfigPluginConfig = nativeToolSurfaceEnabled ? pluginConfig : disableCodexPluginThreadConfig(pluginConfig);
|
|
@@ -5333,7 +5347,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
5333
5347
|
appServer: pluginAppServer,
|
|
5334
5348
|
developerInstructions: promptBuild.developerInstructions,
|
|
5335
5349
|
config: threadConfig,
|
|
5336
|
-
|
|
5350
|
+
buildFinalConfigPatch: buildNativeHookRelayFinalConfigPatch,
|
|
5337
5351
|
nativeCodeModeEnabled: nativeToolSurfaceEnabled,
|
|
5338
5352
|
nativeCodeModeOnlyEnabled: appServer.codeModeOnly,
|
|
5339
5353
|
userMcpServersEnabled: nativeToolSurfaceEnabled,
|
|
@@ -5431,7 +5445,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
5431
5445
|
} catch (error) {
|
|
5432
5446
|
nativeHookRelay?.unregister();
|
|
5433
5447
|
await releaseSandboxExecEnvironment();
|
|
5434
|
-
clearSharedCodexAppServerClientIfCurrent(startupClientForCleanup);
|
|
5448
|
+
if (runAbortController.signal.aborted || shouldClearSharedClientAfterStartupRace(error)) clearSharedCodexAppServerClientIfCurrent(startupClientForCleanup);
|
|
5435
5449
|
params.abortSignal?.removeEventListener("abort", abortFromUpstream);
|
|
5436
5450
|
throw error;
|
|
5437
5451
|
}
|
|
@@ -5892,7 +5906,9 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
5892
5906
|
if (isCurrentTurnNotification && (rawToolOutputCompletion || isNativeToolProgressNotification(notification))) turnCrossedToolHandoff = true;
|
|
5893
5907
|
const assistantCompletionCanRelease = isAssistantCompletionReleaseNotification(notification, turnCrossedToolHandoff);
|
|
5894
5908
|
const postToolRawAssistantCompletionNeedsTerminalGuard = isCurrentTurnNotification && turnCrossedToolHandoff && isRawAssistantCompletionNotification(notification) && activeTurnItemIds.size === 0;
|
|
5909
|
+
const rawResponseItemCompletedWithNoActiveItems = isCurrentTurnNotification && notification.method === "rawResponseItem/completed" && activeTurnItemIds.size === 0 && activeAppServerTurnRequests === 0 && !assistantCompletionCanRelease && !postToolRawAssistantCompletionNeedsTerminalGuard;
|
|
5895
5910
|
const shouldArmPostReasoningSourceReplyWatch = isCurrentTurnNotification && isReasoningItemCompletionNotification(notification) && activeTurnItemIds.size === 0 && params.sourceReplyDeliveryMode === "message_tool_only";
|
|
5911
|
+
const shouldArmPostRawReasoningSourceReplyWatch = rawResponseItemCompletedWithNoActiveItems && isRawReasoningCompletionNotification(notification) && params.sourceReplyDeliveryMode === "message_tool_only";
|
|
5896
5912
|
const shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem = isCurrentTurnNotification && notification.method === "item/completed" && activeTurnItemIds.size === 0 && !trackedDynamicToolCompletion && !assistantCompletionCanRelease && !shouldArmPostReasoningSourceReplyWatch;
|
|
5897
5913
|
if (isCurrentTurnNotification && notification.method === "error") {
|
|
5898
5914
|
if (isRetryableErrorNotification(notification.params)) disarmTurnCompletionIdleWatch();
|
|
@@ -5901,12 +5917,13 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
5901
5917
|
} else if (isTurnCompletion) disarmTurnAssistantCompletionIdleWatch();
|
|
5902
5918
|
else if (isCurrentTurnNotification && assistantCompletionCanRelease) armTurnAssistantCompletionIdleWatch(describeNotificationActivity(notification));
|
|
5903
5919
|
else if (postToolRawAssistantCompletionNeedsTerminalGuard) armTurnCompletionIdleWatch({ timeoutMs: postToolRawAssistantCompletionIdleTimeoutMs });
|
|
5904
|
-
else if (shouldArmPostReasoningSourceReplyWatch) armTurnCompletionIdleWatch({ timeoutMs: CODEX_POST_REASONING_SOURCE_REPLY_IDLE_TIMEOUT_MS });
|
|
5920
|
+
else if (shouldArmPostReasoningSourceReplyWatch || shouldArmPostRawReasoningSourceReplyWatch) armTurnCompletionIdleWatch({ timeoutMs: CODEX_POST_REASONING_SOURCE_REPLY_IDLE_TIMEOUT_MS });
|
|
5905
5921
|
else if (unblockedAssistantCompletionRelease) armTurnAssistantCompletionIdleWatch(describeNotificationActivity(notification));
|
|
5906
5922
|
else if (shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem) armTurnCompletionIdleWatch();
|
|
5923
|
+
else if (rawResponseItemCompletedWithNoActiveItems) armTurnCompletionIdleWatch();
|
|
5907
5924
|
else if (isCurrentTurnNotification && rawToolOutputCompletion) armTurnCompletionIdleWatch();
|
|
5908
5925
|
else if (isCurrentTurnNotification && shouldDisarmAssistantCompletionIdleWatch(notification)) disarmTurnAssistantCompletionIdleWatch();
|
|
5909
|
-
if (turnCompletionIdleWatchArmed && !turnCompletionIdleWatchPinnedByTerminalError && notification.method !== "turn/completed" && isCurrentTurnNotification && !trackedDynamicToolCompletion && !rawToolOutputCompletion && !postToolRawAssistantCompletionNeedsTerminalGuard && !shouldArmPostReasoningSourceReplyWatch && !shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem) disarmTurnCompletionIdleWatch();
|
|
5926
|
+
if (turnCompletionIdleWatchArmed && !turnCompletionIdleWatchPinnedByTerminalError && notification.method !== "turn/completed" && isCurrentTurnNotification && !trackedDynamicToolCompletion && !rawToolOutputCompletion && !postToolRawAssistantCompletionNeedsTerminalGuard && !rawResponseItemCompletedWithNoActiveItems && !shouldArmPostReasoningSourceReplyWatch && !shouldArmPostRawReasoningSourceReplyWatch && !shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem) disarmTurnCompletionIdleWatch();
|
|
5910
5927
|
if (trackedDynamicToolCompletion) {
|
|
5911
5928
|
const itemId = readNotificationItemId(notification);
|
|
5912
5929
|
if (itemId) {
|
|
@@ -6497,7 +6514,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
6497
6514
|
const handle = {
|
|
6498
6515
|
kind: "embedded",
|
|
6499
6516
|
queueMessage: async (text, options) => activeSteeringQueue.queue(text, options),
|
|
6500
|
-
isStreaming: () => !completed,
|
|
6517
|
+
isStreaming: () => !completed && !terminalTurnNotificationQueued,
|
|
6501
6518
|
isCompacting: () => projector?.isCompacting() ?? false,
|
|
6502
6519
|
sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
|
|
6503
6520
|
cancel: () => runAbortController.abort("cancelled"),
|
|
@@ -6932,6 +6949,8 @@ function createCodexNativeHookRelay(params) {
|
|
|
6932
6949
|
sessionId: params.sessionId,
|
|
6933
6950
|
sessionKey: params.sessionKey
|
|
6934
6951
|
}),
|
|
6952
|
+
...params.generation ? { generation: params.generation } : {},
|
|
6953
|
+
...params.generationMismatchGraceMs ? { generationMismatchGraceMs: params.generationMismatchGraceMs } : {},
|
|
6935
6954
|
...params.agentId ? { agentId: params.agentId } : {},
|
|
6936
6955
|
sessionId: params.sessionId,
|
|
6937
6956
|
...params.sessionKey ? { sessionKey: params.sessionKey } : {},
|
|
@@ -7681,6 +7700,11 @@ function isReasoningItemCompletionNotification(notification) {
|
|
|
7681
7700
|
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
7682
7701
|
return item ? readString(item, "type") === "reasoning" : false;
|
|
7683
7702
|
}
|
|
7703
|
+
function isRawReasoningCompletionNotification(notification) {
|
|
7704
|
+
if (!isJsonObject(notification.params) || notification.method !== "rawResponseItem/completed") return false;
|
|
7705
|
+
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
7706
|
+
return item ? readString(item, "type") === "reasoning" : false;
|
|
7707
|
+
}
|
|
7684
7708
|
function isAssistantCompletionReleaseNotification(notification, turnCrossedToolHandoff) {
|
|
7685
7709
|
if (isCompletedAssistantNotification(notification)) return true;
|
|
7686
7710
|
return !turnCrossedToolHandoff && isRawAssistantCompletionNotification(notification);
|
|
@@ -7810,7 +7834,12 @@ async function readMirroredSessionHistoryMessages(sessionFile) {
|
|
|
7810
7834
|
}
|
|
7811
7835
|
async function buildCodexWorkspaceBootstrapContext(params) {
|
|
7812
7836
|
try {
|
|
7813
|
-
const
|
|
7837
|
+
const memoryToolsAvailable = params.memoryToolNames.length > 0 && canRouteCodexWorkspaceMemoryThroughTools({
|
|
7838
|
+
config: params.params.config,
|
|
7839
|
+
agentId: params.params.agentId ?? params.sessionAgentId,
|
|
7840
|
+
workspaceDir: params.effectiveWorkspace
|
|
7841
|
+
});
|
|
7842
|
+
const bootstrapFiles = await resolveBootstrapFilesForRun({
|
|
7814
7843
|
workspaceDir: params.resolvedWorkspace,
|
|
7815
7844
|
config: params.params.config,
|
|
7816
7845
|
sessionKey: params.sessionKey,
|
|
@@ -7820,22 +7849,45 @@ async function buildCodexWorkspaceBootstrapContext(params) {
|
|
|
7820
7849
|
contextMode: params.params.bootstrapContextMode,
|
|
7821
7850
|
runKind: params.params.bootstrapContextRunKind
|
|
7822
7851
|
});
|
|
7823
|
-
const
|
|
7852
|
+
const memoryToolRoutedBootstrapFiles = memoryToolsAvailable ? selectCodexWorkspaceMemoryReferenceFiles({
|
|
7853
|
+
bootstrapFiles,
|
|
7854
|
+
workspaceDir: params.resolvedWorkspace
|
|
7855
|
+
}) : [];
|
|
7856
|
+
const memoryReferenceFiles = memoryToolRoutedBootstrapFiles.map((file) => remapCodexContextFilePath({
|
|
7857
|
+
file: toCodexEmbeddedContextFile(file),
|
|
7858
|
+
sourceWorkspaceDir: params.resolvedWorkspace,
|
|
7859
|
+
targetWorkspaceDir: params.effectiveWorkspace
|
|
7860
|
+
}));
|
|
7861
|
+
const contextFiles = buildBootstrapContextForFiles(memoryToolsAvailable ? bootstrapFiles.filter((file) => !isCodexWorkspaceRootMemoryBootstrapFile({
|
|
7862
|
+
file,
|
|
7863
|
+
workspaceDir: params.resolvedWorkspace
|
|
7864
|
+
})) : bootstrapFiles, {
|
|
7865
|
+
config: params.params.config,
|
|
7866
|
+
agentId: params.params.agentId ?? params.sessionAgentId,
|
|
7867
|
+
warn: (message) => embeddedAgentLog.warn(message)
|
|
7868
|
+
}).map((file) => remapCodexContextFilePath({
|
|
7824
7869
|
file,
|
|
7825
7870
|
sourceWorkspaceDir: params.resolvedWorkspace,
|
|
7826
7871
|
targetWorkspaceDir: params.effectiveWorkspace
|
|
7827
7872
|
}));
|
|
7828
|
-
const promptContextFiles = selectCodexWorkspacePromptContextFiles(contextFiles
|
|
7873
|
+
const promptContextFiles = selectCodexWorkspacePromptContextFiles(contextFiles, {
|
|
7874
|
+
excludeMemory: memoryToolsAvailable,
|
|
7875
|
+
memoryWorkspaceDir: params.effectiveWorkspace
|
|
7876
|
+
});
|
|
7829
7877
|
const developerInstructionFiles = shouldInjectCodexOpenClawPromptContext(params.params) ? selectCodexWorkspaceInheritedDeveloperInstructionFiles(contextFiles) : [];
|
|
7830
7878
|
const turnScopedDeveloperInstructionFiles = shouldInjectCodexOpenClawPromptContext(params.params) ? selectCodexWorkspaceTurnScopedDeveloperInstructionFiles(contextFiles) : [];
|
|
7831
7879
|
const heartbeatReferenceFiles = selectCodexWorkspaceHeartbeatReferenceFiles(contextFiles);
|
|
7832
7880
|
return {
|
|
7833
|
-
|
|
7881
|
+
bootstrapFiles,
|
|
7834
7882
|
contextFiles,
|
|
7835
7883
|
promptContextFiles,
|
|
7836
7884
|
developerInstructionFiles,
|
|
7837
7885
|
turnScopedDeveloperInstructionFiles,
|
|
7838
7886
|
heartbeatReferenceFiles,
|
|
7887
|
+
memoryReferenceFiles,
|
|
7888
|
+
memoryToolRoutedBootstrapFiles,
|
|
7889
|
+
memoryToolNames: [...params.memoryToolNames],
|
|
7890
|
+
memoryToolRouted: memoryToolsAvailable,
|
|
7839
7891
|
promptContext: renderCodexWorkspaceBootstrapPromptContext(promptContextFiles),
|
|
7840
7892
|
developerInstructions: renderCodexWorkspaceThreadDeveloperInstructions(developerInstructionFiles),
|
|
7841
7893
|
turnScopedDeveloperInstructions: renderCodexWorkspaceCollaborationDeveloperInstructions(turnScopedDeveloperInstructionFiles),
|
|
@@ -7874,7 +7926,9 @@ function buildCodexSystemPromptReport(params) {
|
|
|
7874
7926
|
injectedWorkspaceFiles: buildCodexBootstrapInjectionStats({
|
|
7875
7927
|
bootstrapFiles: params.workspaceBootstrapContext.bootstrapFiles,
|
|
7876
7928
|
injectedFiles: params.workspaceBootstrapContext.promptContextFiles ?? [],
|
|
7877
|
-
developerInstructionFiles: [...params.workspaceBootstrapContext.developerInstructionFiles ?? [], ...params.workspaceBootstrapContext.turnScopedDeveloperInstructionFiles ?? []]
|
|
7929
|
+
developerInstructionFiles: [...params.workspaceBootstrapContext.developerInstructionFiles ?? [], ...params.workspaceBootstrapContext.turnScopedDeveloperInstructionFiles ?? []],
|
|
7930
|
+
memoryToolRoutedBootstrapFiles: params.workspaceBootstrapContext.memoryToolRoutedBootstrapFiles ?? [],
|
|
7931
|
+
memoryToolRouted: params.workspaceBootstrapContext.memoryToolRouted === true
|
|
7878
7932
|
}),
|
|
7879
7933
|
skills: {
|
|
7880
7934
|
promptChars: skillsPrompt.length,
|
|
@@ -7954,6 +8008,10 @@ function stableJsonHash(value) {
|
|
|
7954
8008
|
function buildCodexBootstrapInjectionStats(params) {
|
|
7955
8009
|
const injectedIndex = indexCodexContextFileContent(params.injectedFiles);
|
|
7956
8010
|
const developerInstructionIndex = indexCodexContextFileContent(params.developerInstructionFiles ?? []);
|
|
8011
|
+
const memoryToolRoutedIndex = new Set((params.memoryToolRoutedBootstrapFiles ?? []).map((file) => {
|
|
8012
|
+
const fileName = readNonEmptyString(file.name);
|
|
8013
|
+
return readNonEmptyString(file.path) ?? fileName ?? "";
|
|
8014
|
+
}));
|
|
7957
8015
|
return params.bootstrapFiles.map((file) => {
|
|
7958
8016
|
const fileName = readNonEmptyString(file.name);
|
|
7959
8017
|
const pathValue = readNonEmptyString(file.path) ?? fileName ?? "";
|
|
@@ -7963,6 +8021,10 @@ function buildCodexBootstrapInjectionStats(params) {
|
|
|
7963
8021
|
const injected = readCodexIndexedContextFileContent(injectedIndex, pathValue, fileName) ?? readCodexIndexedContextFileContent(developerInstructionIndex, pathValue, fileName);
|
|
7964
8022
|
let injectedChars = injected?.length ?? 0;
|
|
7965
8023
|
let truncated = !file.missing && injectedChars < rawChars;
|
|
8024
|
+
if (params.memoryToolRouted === true && memoryToolRoutedIndex.has(pathValue)) {
|
|
8025
|
+
injectedChars = 0;
|
|
8026
|
+
truncated = false;
|
|
8027
|
+
}
|
|
7966
8028
|
if (injected === void 0) {
|
|
7967
8029
|
if (CODEX_NATIVE_PROJECT_DOC_BASENAMES.has(baseName)) {
|
|
7968
8030
|
injectedChars = rawChars;
|
|
@@ -8025,15 +8087,19 @@ function splitLeadingCodexDeliveryHint(prompt) {
|
|
|
8025
8087
|
}
|
|
8026
8088
|
function buildCodexOpenClawPromptContext(params) {
|
|
8027
8089
|
if (!shouldInjectCodexOpenClawPromptContext(params.params)) return;
|
|
8028
|
-
const sections = [
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
"
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8090
|
+
const sections = [
|
|
8091
|
+
params.skillsPrompt?.trim() ? [
|
|
8092
|
+
"## OpenClaw Skills",
|
|
8093
|
+
"",
|
|
8094
|
+
params.skillsPrompt.trim()
|
|
8095
|
+
].join("\n") : void 0,
|
|
8096
|
+
params.workspacePromptContext?.trim() ? [
|
|
8097
|
+
"## OpenClaw Workspace Context",
|
|
8098
|
+
"",
|
|
8099
|
+
params.workspacePromptContext.trim()
|
|
8100
|
+
].join("\n") : void 0,
|
|
8101
|
+
params.workspaceMemoryReference?.trim()
|
|
8102
|
+
].filter(isNonEmptyString);
|
|
8037
8103
|
if (sections.length === 0) return;
|
|
8038
8104
|
return [
|
|
8039
8105
|
"OpenClaw runtime context for this turn:",
|
|
@@ -8074,10 +8140,13 @@ function renderCodexWorkspaceBootstrapPromptContext(contextFiles) {
|
|
|
8074
8140
|
for (const file of files) lines.push(`## ${file.path}`, "", file.content, "");
|
|
8075
8141
|
return lines.join("\n").trim();
|
|
8076
8142
|
}
|
|
8077
|
-
function selectCodexWorkspacePromptContextFiles(contextFiles) {
|
|
8143
|
+
function selectCodexWorkspacePromptContextFiles(contextFiles, options = {}) {
|
|
8078
8144
|
return contextFiles.filter((file) => {
|
|
8079
8145
|
const baseName = getCodexContextFileBasename(file.path);
|
|
8080
|
-
return baseName && !CODEX_NATIVE_PROJECT_DOC_BASENAMES.has(baseName) && !CODEX_WORKSPACE_DEVELOPER_CONTEXT_BASENAMES.has(baseName) && baseName !== CODEX_HEARTBEAT_CONTEXT_BASENAME && !
|
|
8146
|
+
return baseName && !CODEX_NATIVE_PROJECT_DOC_BASENAMES.has(baseName) && !CODEX_WORKSPACE_DEVELOPER_CONTEXT_BASENAMES.has(baseName) && baseName !== CODEX_HEARTBEAT_CONTEXT_BASENAME && !(options.excludeMemory === true && isCodexWorkspaceRootMemoryContextFile({
|
|
8147
|
+
file,
|
|
8148
|
+
workspaceDir: options.memoryWorkspaceDir
|
|
8149
|
+
})) && !isMissingCodexBootstrapContextFile(file);
|
|
8081
8150
|
}).toSorted(compareCodexContextFiles);
|
|
8082
8151
|
}
|
|
8083
8152
|
function selectCodexWorkspaceInheritedDeveloperInstructionFiles(contextFiles) {
|
|
@@ -8134,9 +8203,63 @@ function renderCodexWorkspaceHeartbeatReference(files) {
|
|
|
8134
8203
|
for (const file of files) lines.push(`- ${file.path}`);
|
|
8135
8204
|
return lines.join("\n").trim();
|
|
8136
8205
|
}
|
|
8206
|
+
function selectCodexWorkspaceMemoryReferenceFiles(params) {
|
|
8207
|
+
return params.bootstrapFiles.filter((file) => {
|
|
8208
|
+
return isCodexWorkspaceRootMemoryBootstrapFile({
|
|
8209
|
+
file,
|
|
8210
|
+
workspaceDir: params.workspaceDir
|
|
8211
|
+
}) && !file.missing && (file.content ?? "").trim().length > 0;
|
|
8212
|
+
}).toSorted(compareCodexBootstrapFiles);
|
|
8213
|
+
}
|
|
8214
|
+
function renderCodexWorkspaceMemoryReference(params) {
|
|
8215
|
+
if (params.files.length === 0) return;
|
|
8216
|
+
const lines = [
|
|
8217
|
+
"## OpenClaw Workspace Memory",
|
|
8218
|
+
"",
|
|
8219
|
+
`MEMORY.md exists in the active agent workspace. OpenClaw does not paste its contents into native Codex turns; use ${(params.toolNames?.length ? params.toolNames : Array.from(CODEX_MEMORY_TOOL_NAMES)).join(" or ")} when durable memory is relevant and the tools are available.`,
|
|
8220
|
+
""
|
|
8221
|
+
];
|
|
8222
|
+
for (const file of params.files) lines.push(`- ${file.path}`);
|
|
8223
|
+
return lines.join("\n").trim();
|
|
8224
|
+
}
|
|
8225
|
+
function getCodexWorkspaceMemoryToolNames(tools) {
|
|
8226
|
+
const availableToolNames = new Set(tools.map((tool) => normalizeCodexDynamicToolName(tool.name)));
|
|
8227
|
+
return Array.from(CODEX_MEMORY_TOOL_NAMES).filter((name) => availableToolNames.has(name));
|
|
8228
|
+
}
|
|
8229
|
+
function canRouteCodexWorkspaceMemoryThroughTools(params) {
|
|
8230
|
+
if (!params.config) return false;
|
|
8231
|
+
return isSameCodexWorkspacePath(resolveAgentWorkspaceDir(params.config, params.agentId), params.workspaceDir);
|
|
8232
|
+
}
|
|
8137
8233
|
function isMissingCodexBootstrapContextFile(file) {
|
|
8138
8234
|
return file.content.trimStart().startsWith("[MISSING] Expected at:");
|
|
8139
8235
|
}
|
|
8236
|
+
function toCodexEmbeddedContextFile(file) {
|
|
8237
|
+
return {
|
|
8238
|
+
path: readNonEmptyString(file.path) ?? readNonEmptyString(file.name) ?? "",
|
|
8239
|
+
content: file.content ?? ""
|
|
8240
|
+
};
|
|
8241
|
+
}
|
|
8242
|
+
function isCodexWorkspaceRootMemoryBootstrapFile(params) {
|
|
8243
|
+
return isCodexWorkspaceRootMemoryPath({
|
|
8244
|
+
filePath: readNonEmptyString(params.file.path) ?? readNonEmptyString(params.file.name) ?? "",
|
|
8245
|
+
workspaceDir: params.workspaceDir
|
|
8246
|
+
});
|
|
8247
|
+
}
|
|
8248
|
+
function isCodexWorkspaceRootMemoryContextFile(params) {
|
|
8249
|
+
if (!params.workspaceDir) return false;
|
|
8250
|
+
return isCodexWorkspaceRootMemoryPath({
|
|
8251
|
+
filePath: params.file.path,
|
|
8252
|
+
workspaceDir: params.workspaceDir
|
|
8253
|
+
});
|
|
8254
|
+
}
|
|
8255
|
+
function isCodexWorkspaceRootMemoryPath(params) {
|
|
8256
|
+
const filePath = params.filePath.trim();
|
|
8257
|
+
if (!filePath) return false;
|
|
8258
|
+
return (path.isAbsolute(filePath) ? path.resolve(filePath) : path.resolve(params.workspaceDir, filePath)) === path.join(path.resolve(params.workspaceDir), "MEMORY.md");
|
|
8259
|
+
}
|
|
8260
|
+
function isSameCodexWorkspacePath(left, right) {
|
|
8261
|
+
return path.resolve(left) === path.resolve(right);
|
|
8262
|
+
}
|
|
8140
8263
|
function remapCodexContextFilePath(params) {
|
|
8141
8264
|
const relativePath = path.relative(params.sourceWorkspaceDir, params.file.path);
|
|
8142
8265
|
if (!relativePath || relativePath === ".." || relativePath.startsWith(`..${path.sep}`) || path.isAbsolute(relativePath) || params.sourceWorkspaceDir === params.targetWorkspaceDir) return params.file;
|
|
@@ -8158,6 +8281,9 @@ function compareCodexContextFiles(left, right) {
|
|
|
8158
8281
|
if (leftBase !== rightBase) return leftBase.localeCompare(rightBase);
|
|
8159
8282
|
return leftPath.localeCompare(rightPath);
|
|
8160
8283
|
}
|
|
8284
|
+
function compareCodexBootstrapFiles(left, right) {
|
|
8285
|
+
return compareCodexContextFiles(toCodexEmbeddedContextFile(left), toCodexEmbeddedContextFile(right));
|
|
8286
|
+
}
|
|
8161
8287
|
function normalizeCodexContextFilePath(filePath) {
|
|
8162
8288
|
return filePath.trim().replaceAll("\\", "/").toLowerCase();
|
|
8163
8289
|
}
|
|
@@ -8268,6 +8394,9 @@ function waitForCodexNotificationDispatchTurn() {
|
|
|
8268
8394
|
setImmediate(resolve);
|
|
8269
8395
|
});
|
|
8270
8396
|
}
|
|
8397
|
+
function shouldClearSharedClientAfterStartupRace(error) {
|
|
8398
|
+
return error instanceof Error && (error.message === "codex app-server startup timed out" || error.message === "codex app-server startup aborted" || error.message.endsWith(" timed out"));
|
|
8399
|
+
}
|
|
8271
8400
|
function handleApprovalRequest(params) {
|
|
8272
8401
|
return handleCodexAppServerApprovalRequest({
|
|
8273
8402
|
method: params.method,
|
|
@@ -52,6 +52,7 @@ async function readCodexAppServerBinding(sessionFile, lookup = {}) {
|
|
|
52
52
|
dynamicToolsFingerprint: typeof parsed.dynamicToolsFingerprint === "string" ? parsed.dynamicToolsFingerprint : void 0,
|
|
53
53
|
userMcpServersFingerprint: typeof parsed.userMcpServersFingerprint === "string" ? parsed.userMcpServersFingerprint : void 0,
|
|
54
54
|
mcpServersFingerprint: typeof parsed.mcpServersFingerprint === "string" ? parsed.mcpServersFingerprint : void 0,
|
|
55
|
+
nativeHookRelayGeneration: typeof parsed.nativeHookRelayGeneration === "string" && parsed.nativeHookRelayGeneration.trim() ? parsed.nativeHookRelayGeneration : void 0,
|
|
55
56
|
pluginAppsFingerprint: typeof parsed.pluginAppsFingerprint === "string" ? parsed.pluginAppsFingerprint : void 0,
|
|
56
57
|
pluginAppsInputFingerprint: typeof parsed.pluginAppsInputFingerprint === "string" ? parsed.pluginAppsInputFingerprint : void 0,
|
|
57
58
|
pluginAppPolicyContext: readPluginAppPolicyContext(parsed.pluginAppPolicyContext),
|
|
@@ -88,6 +89,7 @@ async function writeCodexAppServerBinding(sessionFile, binding, lookup = {}) {
|
|
|
88
89
|
dynamicToolsFingerprint: binding.dynamicToolsFingerprint,
|
|
89
90
|
userMcpServersFingerprint: binding.userMcpServersFingerprint,
|
|
90
91
|
mcpServersFingerprint: binding.mcpServersFingerprint,
|
|
92
|
+
nativeHookRelayGeneration: binding.nativeHookRelayGeneration,
|
|
91
93
|
pluginAppsFingerprint: binding.pluginAppsFingerprint,
|
|
92
94
|
pluginAppsInputFingerprint: binding.pluginAppsInputFingerprint,
|
|
93
95
|
pluginAppPolicyContext: binding.pluginAppPolicyContext,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { c as readCodexPluginConfig, f as shouldAutoApproveCodexAppServerApprovals, l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
3
3
|
import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
4
|
-
import { f as resolveCodexAppServerModelProvider, p as resolveReasoningEffort, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, v as mergeCodexThreadConfigs } from "./thread-lifecycle-
|
|
5
|
-
import { i as readCodexAppServerBinding } from "./session-binding-
|
|
4
|
+
import { f as resolveCodexAppServerModelProvider, p as resolveReasoningEffort, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, v as mergeCodexThreadConfigs } from "./thread-lifecycle-DZAfY4d6.js";
|
|
5
|
+
import { i as readCodexAppServerBinding } from "./session-binding-4fRldGaa.js";
|
|
6
6
|
import { i as readCodexNotificationTurnId, m as formatCodexUsageLimitErrorMessage, r as readCodexNotificationThreadId } from "./notification-correlation-YINts3PA.js";
|
|
7
7
|
import { a as releaseLeasedSharedCodexAppServerClient, i as getLeasedSharedCodexAppServerClient, l as refreshCodexAppServerAuthTokens } from "./shared-client-8kIrP817.js";
|
|
8
8
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
9
|
-
import { a as resolveCodexDynamicToolsLoading, n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-
|
|
9
|
+
import { a as resolveCodexDynamicToolsLoading, n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-BSZIYzfP.js";
|
|
10
10
|
import { a as handleCodexAppServerElicitationRequest, c as emitDynamicToolTerminalDiagnostic, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerApprovalRequest, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as emitDynamicToolErrorDiagnostic, r as buildCodexNativeHookRelayConfig, s as emitDynamicToolStartedDiagnostic, t as filterToolsForVisionInputs } from "./vision-tools-DqpLmF5H.js";
|
|
11
11
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
12
12
|
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
package/dist/test-api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
2
|
-
import { a as buildDeveloperInstructions, l as buildTurnStartParams, o as buildThreadResumeParams, s as buildThreadStartParams } from "./thread-lifecycle-
|
|
3
|
-
import { n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-
|
|
2
|
+
import { a as buildDeveloperInstructions, l as buildTurnStartParams, o as buildThreadResumeParams, s as buildThreadStartParams } from "./thread-lifecycle-DZAfY4d6.js";
|
|
3
|
+
import { n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-BSZIYzfP.js";
|
|
4
4
|
//#region extensions/codex/test-api.ts
|
|
5
5
|
function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
|
|
6
6
|
return resolveCodexAppServerRuntimeOptions({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { d as resolveCodexPluginsPolicy, r as codexSandboxPolicyForTurn, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-0-UN67Qg.js";
|
|
2
2
|
import { n as assertCodexThreadResumeResponse, r as assertCodexThreadStartResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
3
|
-
import { a as isCodexAppServerConnectionClosedError, l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
3
|
+
import { a as isCodexAppServerConnectionClosedError, l as isJsonObject, n as CodexAppServerRpcError } from "./client-BVK_jmHW.js";
|
|
4
4
|
import { CODEX_GPT5_HEARTBEAT_PROMPT_OVERLAY } from "./prompt-overlay.js";
|
|
5
5
|
import { isModernCodexModel } from "./provider.js";
|
|
6
|
-
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
6
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-4fRldGaa.js";
|
|
7
7
|
import crypto from "node:crypto";
|
|
8
8
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
-
import { embeddedAgentLog, isActiveHarnessContextEngine } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
9
|
+
import { embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
10
10
|
import { buildCodexUserMcpServersThreadConfigPatch } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
11
11
|
import { listRegisteredPluginAgentPromptGuidance } from "openclaw/plugin-sdk/plugin-runtime";
|
|
12
12
|
import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
@@ -1075,6 +1075,12 @@ function isCodexAppServerProfilerEnabled(config, env = process.env) {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
//#endregion
|
|
1077
1077
|
//#region extensions/codex/src/app-server/thread-lifecycle.ts
|
|
1078
|
+
var CodexThreadStartRequestError = class extends Error {
|
|
1079
|
+
constructor(cause) {
|
|
1080
|
+
super(formatErrorMessage(cause), { cause });
|
|
1081
|
+
this.name = "CodexThreadStartRequestError";
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1078
1084
|
const CODEX_NATIVE_PERSONALITY_NONE = "none";
|
|
1079
1085
|
const CODEX_CODE_MODE_THREAD_CONFIG = {
|
|
1080
1086
|
"features.code_mode": true,
|
|
@@ -1244,7 +1250,14 @@ async function startOrResumeThread(params) {
|
|
|
1244
1250
|
}
|
|
1245
1251
|
} else try {
|
|
1246
1252
|
const authProfileId = params.params.authProfileId ?? binding.authProfileId;
|
|
1247
|
-
const
|
|
1253
|
+
const finalConfigPatch = params.buildFinalConfigPatch?.({
|
|
1254
|
+
action: "resume",
|
|
1255
|
+
binding
|
|
1256
|
+
}) ?? {
|
|
1257
|
+
configPatch: params.finalConfigPatch,
|
|
1258
|
+
nativeHookRelayGeneration: params.nativeHookRelayGeneration
|
|
1259
|
+
};
|
|
1260
|
+
const resumeConfig = mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, finalConfigPatch.configPatch);
|
|
1248
1261
|
const resumeParams = lifecycleTiming.measureSync("thread_resume_params", () => buildThreadResumeParams(params.params, {
|
|
1249
1262
|
threadId: binding.threadId,
|
|
1250
1263
|
authProfileId,
|
|
@@ -1274,6 +1287,7 @@ async function startOrResumeThread(params) {
|
|
|
1274
1287
|
dynamicToolsFingerprint,
|
|
1275
1288
|
userMcpServersFingerprint,
|
|
1276
1289
|
mcpServersFingerprint: nextMcpServersFingerprint,
|
|
1290
|
+
nativeHookRelayGeneration: finalConfigPatch.nativeHookRelayGeneration ?? binding.nativeHookRelayGeneration,
|
|
1277
1291
|
pluginAppsFingerprint: binding.pluginAppsFingerprint,
|
|
1278
1292
|
pluginAppsInputFingerprint: binding.pluginAppsInputFingerprint,
|
|
1279
1293
|
pluginAppPolicyContext: binding.pluginAppPolicyContext,
|
|
@@ -1311,6 +1325,7 @@ async function startOrResumeThread(params) {
|
|
|
1311
1325
|
dynamicToolsFingerprint,
|
|
1312
1326
|
userMcpServersFingerprint,
|
|
1313
1327
|
mcpServersFingerprint: nextMcpServersFingerprint,
|
|
1328
|
+
nativeHookRelayGeneration: finalConfigPatch.nativeHookRelayGeneration ?? binding.nativeHookRelayGeneration,
|
|
1314
1329
|
pluginAppsFingerprint: binding.pluginAppsFingerprint,
|
|
1315
1330
|
pluginAppsInputFingerprint: binding.pluginAppsInputFingerprint,
|
|
1316
1331
|
pluginAppPolicyContext: binding.pluginAppPolicyContext,
|
|
@@ -1324,7 +1339,11 @@ async function startOrResumeThread(params) {
|
|
|
1324
1339
|
await clearCodexAppServerBinding(params.params.sessionFile);
|
|
1325
1340
|
}
|
|
1326
1341
|
const pluginThreadConfig = params.pluginThreadConfig?.enabled ? prebuiltPluginThreadConfig ?? await lifecycleTiming.measure("plugin_config_build", () => params.pluginThreadConfig?.build()) : void 0;
|
|
1327
|
-
const
|
|
1342
|
+
const finalConfigPatch = params.buildFinalConfigPatch?.({ action: "start" }) ?? {
|
|
1343
|
+
configPatch: params.finalConfigPatch,
|
|
1344
|
+
nativeHookRelayGeneration: params.nativeHookRelayGeneration
|
|
1345
|
+
};
|
|
1346
|
+
const config = lifecycleTiming.measureSync("merge_thread_config", () => mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, pluginThreadConfig?.configPatch, finalConfigPatch.configPatch));
|
|
1328
1347
|
const startParams = lifecycleTiming.measureSync("thread_start_params", () => buildThreadStartParams(params.params, {
|
|
1329
1348
|
cwd: params.cwd,
|
|
1330
1349
|
dynamicTools: params.dynamicTools,
|
|
@@ -1335,7 +1354,14 @@ async function startOrResumeThread(params) {
|
|
|
1335
1354
|
nativeCodeModeOnlyEnabled: params.nativeCodeModeOnlyEnabled,
|
|
1336
1355
|
environmentSelection: params.environmentSelection
|
|
1337
1356
|
}));
|
|
1338
|
-
const response = assertCodexThreadStartResponse(await lifecycleTiming.measure("thread_start_request", () =>
|
|
1357
|
+
const response = assertCodexThreadStartResponse(await lifecycleTiming.measure("thread_start_request", async () => {
|
|
1358
|
+
try {
|
|
1359
|
+
return await params.client.request("thread/start", startParams);
|
|
1360
|
+
} catch (error) {
|
|
1361
|
+
if (error instanceof CodexAppServerRpcError) throw new CodexThreadStartRequestError(error);
|
|
1362
|
+
throw error;
|
|
1363
|
+
}
|
|
1364
|
+
}));
|
|
1339
1365
|
const modelProvider = resolveCodexAppServerModelProvider({
|
|
1340
1366
|
provider: params.params.provider,
|
|
1341
1367
|
authProfileId: params.params.authProfileId,
|
|
@@ -1355,6 +1381,7 @@ async function startOrResumeThread(params) {
|
|
|
1355
1381
|
dynamicToolsFingerprint,
|
|
1356
1382
|
userMcpServersFingerprint,
|
|
1357
1383
|
mcpServersFingerprint: nextMcpServersFingerprint,
|
|
1384
|
+
nativeHookRelayGeneration: finalConfigPatch.nativeHookRelayGeneration,
|
|
1358
1385
|
pluginAppsFingerprint: pluginThreadConfig?.fingerprint,
|
|
1359
1386
|
pluginAppsInputFingerprint: pluginThreadConfig?.inputFingerprint,
|
|
1360
1387
|
pluginAppPolicyContext: pluginThreadConfig?.policyContext,
|
|
@@ -1394,6 +1421,7 @@ async function startOrResumeThread(params) {
|
|
|
1394
1421
|
dynamicToolsFingerprint,
|
|
1395
1422
|
userMcpServersFingerprint,
|
|
1396
1423
|
mcpServersFingerprint: nextMcpServersFingerprint,
|
|
1424
|
+
nativeHookRelayGeneration: finalConfigPatch.nativeHookRelayGeneration,
|
|
1397
1425
|
pluginAppsFingerprint: pluginThreadConfig?.fingerprint,
|
|
1398
1426
|
pluginAppsInputFingerprint: pluginThreadConfig?.inputFingerprint,
|
|
1399
1427
|
pluginAppPolicyContext: pluginThreadConfig?.policyContext,
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.27",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/codex",
|
|
9
|
-
"version": "2026.5.
|
|
9
|
+
"version": "2026.5.27",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@earendil-works/pi-coding-agent": "0.75.5",
|
|
12
12
|
"@openai/codex": "0.134.0",
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "codex",
|
|
3
3
|
"name": "Codex",
|
|
4
|
-
"description": "Codex app-server harness and Codex-managed GPT
|
|
4
|
+
"description": "OpenClaw Codex app-server harness and model provider plugin with a Codex-managed GPT catalog.",
|
|
5
5
|
"providers": ["codex"],
|
|
6
6
|
"contracts": {
|
|
7
7
|
"mediaUnderstandingProviders": ["codex"],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.
|
|
4
|
-
"description": "OpenClaw Codex harness and model provider plugin",
|
|
3
|
+
"version": "2026.5.27",
|
|
4
|
+
"description": "OpenClaw Codex app-server harness and model provider plugin with a Codex-managed GPT catalog.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/openclaw/openclaw"
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"minHostVersion": ">=2026.5.1-beta.1"
|
|
28
28
|
},
|
|
29
29
|
"compat": {
|
|
30
|
-
"pluginApi": ">=2026.5.
|
|
30
|
+
"pluginApi": ">=2026.5.27"
|
|
31
31
|
},
|
|
32
32
|
"build": {
|
|
33
|
-
"openclawVersion": "2026.5.
|
|
33
|
+
"openclawVersion": "2026.5.27"
|
|
34
34
|
},
|
|
35
35
|
"release": {
|
|
36
36
|
"publishToClawHub": true,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"npm-shrinkwrap.json"
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"openclaw": ">=2026.5.
|
|
50
|
+
"openclaw": ">=2026.5.27"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"openclaw": {
|