@openclaw/codex 2026.6.11 → 2026.7.1-beta.2

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.
Files changed (31) hide show
  1. package/dist/{app-server-policy-BPTiVNsW.js → app-server-policy-B7hqD3Xj.js} +2 -2
  2. package/dist/{attempt-notifications-BYnndyFl.js → attempt-notifications-tqyQ_Tdn.js} +26 -2
  3. package/dist/{client-CLrtWgrD.js → client-IcTBKEqA.js} +5 -2
  4. package/dist/{client-factory-Bm6HsGob.js → client-factory-DfFu9JH_.js} +2 -5
  5. package/dist/{command-handlers-DEPTJYk0.js → command-handlers-C9K-KRU-.js} +25 -19
  6. package/dist/{compact-aQJ0ZKhe.js → compact-CILptrPS.js} +5 -5
  7. package/dist/{computer-use-ClrJwoFp.js → computer-use-CpurU-G9.js} +3 -3
  8. package/dist/{config-CszD0vP3.js → config-C_whBx3M.js} +8 -3
  9. package/dist/{conversation-binding-t0XMLz-j.js → conversation-binding-DOJtUxOy.js} +28 -15
  10. package/dist/harness.js +6 -6
  11. package/dist/index.js +27 -26
  12. package/dist/{media-understanding-provider-ZUQHN7gT.js → media-understanding-provider-BOeoBhEw.js} +6 -6
  13. package/dist/media-understanding-provider.js +1 -1
  14. package/dist/{models-CAmfBWRl.js → models-DpzY1xpp.js} +2 -2
  15. package/dist/{plugin-app-cache-key-C9ILt7bl.js → plugin-app-cache-key-BrZUG9jj.js} +8 -4
  16. package/dist/{protocol-validators-B19q5BIX.js → protocol-validators-CJiWigAJ.js} +107 -15
  17. package/dist/{provider-capabilities-D7hnTO76.js → provider-capabilities-wqedK49Z.js} +184 -16
  18. package/dist/provider-catalog.js +4 -2
  19. package/dist/{provider-B-OHpbD3.js → provider-nmtMDcGH.js} +53 -18
  20. package/dist/provider.js +2 -2
  21. package/dist/{request-Dcd452Nk.js → request-BQuSQF29.js} +2 -2
  22. package/dist/{run-attempt-CXxtFC9d.js → run-attempt-DikbXia_.js} +416 -105
  23. package/dist/{sandbox-guard-3tnjhjFb.js → sandbox-guard-pTY2COoC.js} +2 -0
  24. package/dist/{session-binding-HOuPt-E0.js → session-binding-Cm0Gg7Z1.js} +2 -1
  25. package/dist/{shared-client-Dtx5i7Ez.js → shared-client-rR6TDJA3.js} +98 -47
  26. package/dist/{side-question-C-DhgJOd.js → side-question-Ca9wqmd0.js} +12 -12
  27. package/dist/{thread-lifecycle-DtT3-ehU.js → thread-lifecycle-D6R40plk.js} +148 -42
  28. package/dist/{web-search-provider.runtime-CkwxrXQj.js → web-search-provider.runtime-B6eZEFmd.js} +2 -2
  29. package/npm-shrinkwrap.json +30 -30
  30. package/openclaw.plugin.json +3 -3
  31. package/package.json +5 -5
@@ -1,3 +1,4 @@
1
+ import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
1
2
  import { Compile } from "typebox/compile";
2
3
  //#region extensions/codex/src/app-server/protocol-generated/json/DynamicToolCallParams.json
3
4
  var DynamicToolCallParams_default = {
@@ -642,6 +643,16 @@ var ThreadResumeResponse_default = {
642
643
  ],
643
644
  "type": "string"
644
645
  },
646
+ "LegacyAppPathString": { "type": "string" },
647
+ "McpToolCallAppContext": {
648
+ "properties": {
649
+ "connectorId": { "type": "string" },
650
+ "linkId": { "type": ["string", "null"] },
651
+ "resourceUri": { "type": ["string", "null"] }
652
+ },
653
+ "required": ["connectorId"],
654
+ "type": "object"
655
+ },
645
656
  "McpToolCallError": {
646
657
  "properties": { "message": { "type": "string" } },
647
658
  "required": ["message"],
@@ -716,6 +727,15 @@ var ThreadResumeResponse_default = {
716
727
  "type": "string"
717
728
  }]
718
729
  },
730
+ "MultiAgentMode": {
731
+ "description": "Controls whether the model receives multi-agent delegation instructions and, when it does, whether it should only spawn sub-agents after an explicit user request or may delegate proactively when doing so would help. `none` leaves the multi-agent tools available without injecting delegation instructions.",
732
+ "enum": [
733
+ "none",
734
+ "explicitRequestOnly",
735
+ "proactive"
736
+ ],
737
+ "type": "string"
738
+ },
719
739
  "NetworkAccess": {
720
740
  "enum": ["restricted", "enabled"],
721
741
  "type": "string"
@@ -996,6 +1016,11 @@ var ThreadResumeResponse_default = {
996
1016
  "description": "Usually the first user message in the thread, if available.",
997
1017
  "type": "string"
998
1018
  },
1019
+ "recencyAt": {
1020
+ "description": "Unix timestamp (in seconds) used for thread recency ordering.",
1021
+ "format": "int64",
1022
+ "type": ["integer", "null"]
1023
+ },
999
1024
  "sessionId": {
1000
1025
  "description": "Session id shared by threads that belong to the same session tree.",
1001
1026
  "type": "string"
@@ -1172,7 +1197,7 @@ var ThreadResumeResponse_default = {
1172
1197
  "type": "array"
1173
1198
  },
1174
1199
  "cwd": {
1175
- "allOf": [{ "$ref": "#/definitions/AbsolutePathBuf" }],
1200
+ "allOf": [{ "$ref": "#/definitions/LegacyAppPathString" }],
1176
1201
  "description": "The command's working directory."
1177
1202
  },
1178
1203
  "durationMs": {
@@ -1237,6 +1262,7 @@ var ThreadResumeResponse_default = {
1237
1262
  },
1238
1263
  {
1239
1264
  "properties": {
1265
+ "appContext": { "anyOf": [{ "$ref": "#/definitions/McpToolCallAppContext" }, { "type": "null" }] },
1240
1266
  "arguments": true,
1241
1267
  "durationMs": {
1242
1268
  "description": "The duration of the MCP tool call in milliseconds.",
@@ -1245,7 +1271,10 @@ var ThreadResumeResponse_default = {
1245
1271
  },
1246
1272
  "error": { "anyOf": [{ "$ref": "#/definitions/McpToolCallError" }, { "type": "null" }] },
1247
1273
  "id": { "type": "string" },
1248
- "mcpAppResourceUri": { "type": ["string", "null"] },
1274
+ "mcpAppResourceUri": {
1275
+ "description": "Deprecated: use `appContext.resourceUri` instead.",
1276
+ "type": ["string", "null"]
1277
+ },
1249
1278
  "pluginId": { "type": ["string", "null"] },
1250
1279
  "result": { "anyOf": [{ "$ref": "#/definitions/McpToolCallResult" }, { "type": "null" }] },
1251
1280
  "server": { "type": "string" },
@@ -1819,12 +1848,17 @@ var ThreadResumeResponse_default = {
1819
1848
  },
1820
1849
  "instructionSources": {
1821
1850
  "default": [],
1822
- "description": "Instruction source files currently loaded for this thread.",
1823
- "items": { "$ref": "#/definitions/AbsolutePathBuf" },
1851
+ "description": "Environment-native paths to instruction source files currently loaded for this thread.",
1852
+ "items": { "$ref": "#/definitions/LegacyAppPathString" },
1824
1853
  "type": "array"
1825
1854
  },
1826
1855
  "model": { "type": "string" },
1827
1856
  "modelProvider": { "type": "string" },
1857
+ "multiAgentMode": {
1858
+ "allOf": [{ "$ref": "#/definitions/MultiAgentMode" }],
1859
+ "default": "explicitRequestOnly",
1860
+ "description": "@deprecated Always `explicitRequestOnly`. Use `reasoningEffort` for Ultra behavior."
1861
+ },
1828
1862
  "reasoningEffort": { "anyOf": [{ "$ref": "#/definitions/ReasoningEffort" }, { "type": "null" }] },
1829
1863
  "runtimeWorkspaceRoots": {
1830
1864
  "default": [],
@@ -2218,6 +2252,16 @@ var ThreadStartResponse_default = {
2218
2252
  ],
2219
2253
  "type": "string"
2220
2254
  },
2255
+ "LegacyAppPathString": { "type": "string" },
2256
+ "McpToolCallAppContext": {
2257
+ "properties": {
2258
+ "connectorId": { "type": "string" },
2259
+ "linkId": { "type": ["string", "null"] },
2260
+ "resourceUri": { "type": ["string", "null"] }
2261
+ },
2262
+ "required": ["connectorId"],
2263
+ "type": "object"
2264
+ },
2221
2265
  "McpToolCallError": {
2222
2266
  "properties": { "message": { "type": "string" } },
2223
2267
  "required": ["message"],
@@ -2292,6 +2336,15 @@ var ThreadStartResponse_default = {
2292
2336
  "type": "string"
2293
2337
  }]
2294
2338
  },
2339
+ "MultiAgentMode": {
2340
+ "description": "Controls whether the model receives multi-agent delegation instructions and, when it does, whether it should only spawn sub-agents after an explicit user request or may delegate proactively when doing so would help. `none` leaves the multi-agent tools available without injecting delegation instructions.",
2341
+ "enum": [
2342
+ "none",
2343
+ "explicitRequestOnly",
2344
+ "proactive"
2345
+ ],
2346
+ "type": "string"
2347
+ },
2295
2348
  "NetworkAccess": {
2296
2349
  "enum": ["restricted", "enabled"],
2297
2350
  "type": "string"
@@ -2572,6 +2625,11 @@ var ThreadStartResponse_default = {
2572
2625
  "description": "Usually the first user message in the thread, if available.",
2573
2626
  "type": "string"
2574
2627
  },
2628
+ "recencyAt": {
2629
+ "description": "Unix timestamp (in seconds) used for thread recency ordering.",
2630
+ "format": "int64",
2631
+ "type": ["integer", "null"]
2632
+ },
2575
2633
  "sessionId": {
2576
2634
  "description": "Session id shared by threads that belong to the same session tree.",
2577
2635
  "type": "string"
@@ -2748,7 +2806,7 @@ var ThreadStartResponse_default = {
2748
2806
  "type": "array"
2749
2807
  },
2750
2808
  "cwd": {
2751
- "allOf": [{ "$ref": "#/definitions/AbsolutePathBuf" }],
2809
+ "allOf": [{ "$ref": "#/definitions/LegacyAppPathString" }],
2752
2810
  "description": "The command's working directory."
2753
2811
  },
2754
2812
  "durationMs": {
@@ -2813,6 +2871,7 @@ var ThreadStartResponse_default = {
2813
2871
  },
2814
2872
  {
2815
2873
  "properties": {
2874
+ "appContext": { "anyOf": [{ "$ref": "#/definitions/McpToolCallAppContext" }, { "type": "null" }] },
2816
2875
  "arguments": true,
2817
2876
  "durationMs": {
2818
2877
  "description": "The duration of the MCP tool call in milliseconds.",
@@ -2821,7 +2880,10 @@ var ThreadStartResponse_default = {
2821
2880
  },
2822
2881
  "error": { "anyOf": [{ "$ref": "#/definitions/McpToolCallError" }, { "type": "null" }] },
2823
2882
  "id": { "type": "string" },
2824
- "mcpAppResourceUri": { "type": ["string", "null"] },
2883
+ "mcpAppResourceUri": {
2884
+ "description": "Deprecated: use `appContext.resourceUri` instead.",
2885
+ "type": ["string", "null"]
2886
+ },
2825
2887
  "pluginId": { "type": ["string", "null"] },
2826
2888
  "result": { "anyOf": [{ "$ref": "#/definitions/McpToolCallResult" }, { "type": "null" }] },
2827
2889
  "server": { "type": "string" },
@@ -3378,12 +3440,17 @@ var ThreadStartResponse_default = {
3378
3440
  "cwd": { "$ref": "#/definitions/AbsolutePathBuf" },
3379
3441
  "instructionSources": {
3380
3442
  "default": [],
3381
- "description": "Instruction source files currently loaded for this thread.",
3382
- "items": { "$ref": "#/definitions/AbsolutePathBuf" },
3443
+ "description": "Environment-native paths to instruction source files currently loaded for this thread.",
3444
+ "items": { "$ref": "#/definitions/LegacyAppPathString" },
3383
3445
  "type": "array"
3384
3446
  },
3385
3447
  "model": { "type": "string" },
3386
3448
  "modelProvider": { "type": "string" },
3449
+ "multiAgentMode": {
3450
+ "allOf": [{ "$ref": "#/definitions/MultiAgentMode" }],
3451
+ "default": "explicitRequestOnly",
3452
+ "description": "@deprecated Always `explicitRequestOnly`. Use `reasoningEffort` for Ultra behavior."
3453
+ },
3387
3454
  "reasoningEffort": { "anyOf": [{ "$ref": "#/definitions/ReasoningEffort" }, { "type": "null" }] },
3388
3455
  "runtimeWorkspaceRoots": {
3389
3456
  "default": [],
@@ -3709,6 +3776,16 @@ var TurnCompletedNotification_default = {
3709
3776
  ],
3710
3777
  "type": "string"
3711
3778
  },
3779
+ "LegacyAppPathString": { "type": "string" },
3780
+ "McpToolCallAppContext": {
3781
+ "properties": {
3782
+ "connectorId": { "type": "string" },
3783
+ "linkId": { "type": ["string", "null"] },
3784
+ "resourceUri": { "type": ["string", "null"] }
3785
+ },
3786
+ "required": ["connectorId"],
3787
+ "type": "object"
3788
+ },
3712
3789
  "McpToolCallError": {
3713
3790
  "properties": { "message": { "type": "string" } },
3714
3791
  "required": ["message"],
@@ -3986,7 +4063,7 @@ var TurnCompletedNotification_default = {
3986
4063
  "type": "array"
3987
4064
  },
3988
4065
  "cwd": {
3989
- "allOf": [{ "$ref": "#/definitions/AbsolutePathBuf" }],
4066
+ "allOf": [{ "$ref": "#/definitions/LegacyAppPathString" }],
3990
4067
  "description": "The command's working directory."
3991
4068
  },
3992
4069
  "durationMs": {
@@ -4051,6 +4128,7 @@ var TurnCompletedNotification_default = {
4051
4128
  },
4052
4129
  {
4053
4130
  "properties": {
4131
+ "appContext": { "anyOf": [{ "$ref": "#/definitions/McpToolCallAppContext" }, { "type": "null" }] },
4054
4132
  "arguments": true,
4055
4133
  "durationMs": {
4056
4134
  "description": "The duration of the MCP tool call in milliseconds.",
@@ -4059,7 +4137,10 @@ var TurnCompletedNotification_default = {
4059
4137
  },
4060
4138
  "error": { "anyOf": [{ "$ref": "#/definitions/McpToolCallError" }, { "type": "null" }] },
4061
4139
  "id": { "type": "string" },
4062
- "mcpAppResourceUri": { "type": ["string", "null"] },
4140
+ "mcpAppResourceUri": {
4141
+ "description": "Deprecated: use `appContext.resourceUri` instead.",
4142
+ "type": ["string", "null"]
4143
+ },
4063
4144
  "pluginId": { "type": ["string", "null"] },
4064
4145
  "result": { "anyOf": [{ "$ref": "#/definitions/McpToolCallResult" }, { "type": "null" }] },
4065
4146
  "server": { "type": "string" },
@@ -4860,6 +4941,16 @@ var TurnStartResponse_default = {
4860
4941
  ],
4861
4942
  "type": "string"
4862
4943
  },
4944
+ "LegacyAppPathString": { "type": "string" },
4945
+ "McpToolCallAppContext": {
4946
+ "properties": {
4947
+ "connectorId": { "type": "string" },
4948
+ "linkId": { "type": ["string", "null"] },
4949
+ "resourceUri": { "type": ["string", "null"] }
4950
+ },
4951
+ "required": ["connectorId"],
4952
+ "type": "object"
4953
+ },
4863
4954
  "McpToolCallError": {
4864
4955
  "properties": { "message": { "type": "string" } },
4865
4956
  "required": ["message"],
@@ -5137,7 +5228,7 @@ var TurnStartResponse_default = {
5137
5228
  "type": "array"
5138
5229
  },
5139
5230
  "cwd": {
5140
- "allOf": [{ "$ref": "#/definitions/AbsolutePathBuf" }],
5231
+ "allOf": [{ "$ref": "#/definitions/LegacyAppPathString" }],
5141
5232
  "description": "The command's working directory."
5142
5233
  },
5143
5234
  "durationMs": {
@@ -5202,6 +5293,7 @@ var TurnStartResponse_default = {
5202
5293
  },
5203
5294
  {
5204
5295
  "properties": {
5296
+ "appContext": { "anyOf": [{ "$ref": "#/definitions/McpToolCallAppContext" }, { "type": "null" }] },
5205
5297
  "arguments": true,
5206
5298
  "durationMs": {
5207
5299
  "description": "The duration of the MCP tool call in milliseconds.",
@@ -5210,7 +5302,10 @@ var TurnStartResponse_default = {
5210
5302
  },
5211
5303
  "error": { "anyOf": [{ "$ref": "#/definitions/McpToolCallError" }, { "type": "null" }] },
5212
5304
  "id": { "type": "string" },
5213
- "mcpAppResourceUri": { "type": ["string", "null"] },
5305
+ "mcpAppResourceUri": {
5306
+ "description": "Deprecated: use `appContext.resourceUri` instead.",
5307
+ "type": ["string", "null"]
5308
+ },
5214
5309
  "pluginId": { "type": ["string", "null"] },
5215
5310
  "result": { "anyOf": [{ "$ref": "#/definitions/McpToolCallResult" }, { "type": "null" }] },
5216
5311
  "server": { "type": "string" },
@@ -5722,9 +5817,6 @@ function compileCodexSchema(schema) {
5722
5817
  errors: (value) => [...validator.Errors(value)]
5723
5818
  };
5724
5819
  }
5725
- function isRecord(value) {
5726
- return Boolean(value && typeof value === "object" && !Array.isArray(value));
5727
- }
5728
5820
  const schemaMapKeywords = new Set([
5729
5821
  "$defs",
5730
5822
  "definitions",
@@ -1,15 +1,15 @@
1
1
  import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
- import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, _ as resolveCodexWebSearchPlan, w as normalizeCodexDynamicToolName, x as sanitizeInlineImageDataUrl, y as invalidInlineImageText } from "./thread-lifecycle-DtT3-ehU.js";
3
- import { c as isTrustedCodexModelBackedOpenAIProvider, u as readCodexPluginConfig } from "./config-CszD0vP3.js";
4
- import { a as formatCodexDisplayText } from "./app-server-policy-BPTiVNsW.js";
5
- import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-Dtx5i7Ez.js";
6
- import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-3tnjhjFb.js";
2
+ import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, _ as resolveCodexWebSearchPlan, w as normalizeCodexDynamicToolName, x as sanitizeInlineImageDataUrl, y as invalidInlineImageText } from "./thread-lifecycle-D6R40plk.js";
3
+ import { c as isTrustedCodexModelBackedOpenAIProvider, u as readCodexPluginConfig } from "./config-C_whBx3M.js";
4
+ import { a as formatCodexDisplayText } from "./app-server-policy-B7hqD3Xj.js";
5
+ import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-rR6TDJA3.js";
6
+ import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-pTY2COoC.js";
7
7
  import { addTimerTimeoutGraceMs, finiteSecondsToTimerSafeMilliseconds, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
8
8
  import { asOptionalRecord, isRecord, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
9
9
  import { createHash } from "node:crypto";
10
10
  import { resolveAgentDir } from "openclaw/plugin-sdk/agent-runtime";
11
11
  import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
12
- import { HEARTBEAT_RESPONSE_TOOL_NAME, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, callGatewayTool, consumeAdjustedParamsForToolCall, consumePreExecutionBlockedToolCall, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractMessagingToolSend, extractMessagingToolSendResult, extractToolResultMediaArtifact, filterProviderNormalizableTools, filterToolResultMediaUrls, finalizeToolTerminalPresentation, formatApprovalDisplayPath, getChannelAgentToolMeta, getPluginToolMeta, hasNativeHookRelayInvocation, invokeNativeHookRelay, isMessagingTool, isMessagingToolSendAction, isReplaySafeToolCall, isSubagentSessionKey, isToolResultError, isToolWrappedWithBeforeToolCallHook, normalizeAgentRuntimeTools, normalizeHeartbeatToolResponse, projectRuntimeToolInputSchema, registerNativeHookRelay, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveNativeHookRelayDeferredToolApproval, runAgentHarnessAfterToolCallHook, runBeforeToolCallHook, sanitizeToolResult, setBeforeToolCallDiagnosticsEnabled, supportsModelTools, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
12
+ import { HEARTBEAT_RESPONSE_TOOL_NAME, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, callGatewayTool, consumeAdjustedParamsForToolCall, consumePreExecutionBlockedToolCall, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractMessagingToolSend, extractMessagingToolSendResult, extractToolResultMediaArtifact, filterProviderNormalizableTools, filterToolResultMediaUrls, finalizeToolTerminalPresentation, formatApprovalDisplayPath, getChannelAgentToolMeta, getPluginToolMeta, hasNativeHookRelayInvocation, invokeNativeHookRelay, isDeliveredMessageToolOnlySourceReplyResult, isDeliveredMessagingToolResult, isMessagingTool, isMessagingToolSendAction, isReplaySafeToolCall, isSubagentSessionKey, isToolResultError, isToolWrappedWithBeforeToolCallHook, normalizeAgentRuntimeTools, normalizeHeartbeatToolResponse, projectRuntimeToolInputSchema, registerNativeHookRelay, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveNativeHookRelayDeferredToolApproval, runAgentHarnessAfterToolCallHook, runBeforeToolCallHook, sanitizeToolResult, setBeforeToolCallDiagnosticsEnabled, supportsModelTools, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
13
13
  import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
14
14
  import { isToolAllowed } from "openclaw/plugin-sdk/sandbox";
15
15
  import { buildExecAutoReviewInputForShellCommand, reviewExecRequestWithConfiguredModel } from "openclaw/plugin-sdk/agent-harness-exec-review-runtime";
@@ -82,8 +82,9 @@ function resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs(value, fallback
82
82
  return resolvePositiveIntegerTimeoutMs(value, Math.max(resolvePositiveIntegerTimeoutMs(void 0, fallbackMs), CODEX_POST_TOOL_RAW_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS));
83
83
  }
84
84
  /** Resolves the long terminal turn idle timeout. */
85
- function resolveCodexTurnTerminalIdleTimeoutMs(value) {
86
- return resolvePositiveIntegerTimeoutMs(value, CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS);
85
+ function resolveCodexTurnTerminalIdleTimeoutMs(value, runTimeoutOverrideMs) {
86
+ const explicitRunBudgetMs = resolvePositiveIntegerTimeoutMs(runTimeoutOverrideMs, CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS);
87
+ return resolvePositiveIntegerTimeoutMs(value, Math.max(CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS, explicitRunBudgetMs));
87
88
  }
88
89
  /** Adds gateway grace time to a caller timeout without overflowing invalid values. */
89
90
  function resolveCodexGatewayTimeoutWithGraceMs(timeoutMs, graceMs = 1e4) {
@@ -1672,9 +1673,139 @@ function applyCurrentMessageProvider(toolName, args, currentProvider) {
1672
1673
  provider
1673
1674
  };
1674
1675
  }
1676
+ function normalizeRouteToken(value) {
1677
+ if (typeof value === "number") return Number.isFinite(value) ? String(value) : void 0;
1678
+ const normalized = value?.trim().toLowerCase();
1679
+ return normalized ? normalized : void 0;
1680
+ }
1681
+ function sourceRouteTokens(hookContext) {
1682
+ const tokens = /* @__PURE__ */ new Set();
1683
+ const currentTarget = normalizeRouteToken(hookContext?.currentMessagingTarget);
1684
+ const currentChannel = normalizeRouteToken(hookContext?.currentChannelId);
1685
+ const currentProvider = normalizeRouteToken(hookContext?.currentChannelProvider);
1686
+ if (currentTarget) tokens.add(currentTarget);
1687
+ if (currentChannel) tokens.add(currentChannel);
1688
+ const channelPrefixIndex = currentChannel?.indexOf(":") ?? -1;
1689
+ if (channelPrefixIndex >= 0 && currentChannel) {
1690
+ const unprefixedChannel = currentChannel.slice(channelPrefixIndex + 1);
1691
+ if (unprefixedChannel) {
1692
+ tokens.add(unprefixedChannel);
1693
+ for (const segment of unprefixedChannel.split(/[;,]/u)) {
1694
+ const token = normalizeRouteToken(segment);
1695
+ if (token) tokens.add(token);
1696
+ }
1697
+ }
1698
+ }
1699
+ if (currentProvider && currentChannel?.startsWith(`${currentProvider}:`)) {
1700
+ const unprefixedChannel = currentChannel.slice(currentProvider.length + 1);
1701
+ if (unprefixedChannel) tokens.add(unprefixedChannel);
1702
+ }
1703
+ return tokens;
1704
+ }
1705
+ function routeTokenMatchesSource(token, hookContext) {
1706
+ const normalized = normalizeRouteToken(token);
1707
+ return normalized !== void 0 && sourceRouteTokens(hookContext).has(normalized);
1708
+ }
1709
+ function routeProviderMatchesSource(provider, hookContext) {
1710
+ const normalized = normalizeRouteToken(provider);
1711
+ if (!normalized) return false;
1712
+ const currentProvider = normalizeRouteToken(hookContext?.currentChannelProvider);
1713
+ const currentChannel = normalizeRouteToken(hookContext?.currentChannelId);
1714
+ return currentProvider === normalized || currentChannel?.startsWith(`${normalized}:`) === true;
1715
+ }
1716
+ function routeTokenMatchesCurrentMessage(token, hookContext) {
1717
+ const normalized = normalizeRouteToken(token);
1718
+ return normalized !== void 0 && normalized === normalizeRouteToken(hookContext?.currentMessageId);
1719
+ }
1720
+ function readRouteToken(record, key) {
1721
+ const value = record[key];
1722
+ return typeof value === "string" || typeof value === "number" ? value : void 0;
1723
+ }
1724
+ function explicitRouteTokensMismatchCurrent(args, keys, currentToken) {
1725
+ const normalizedCurrent = normalizeRouteToken(currentToken);
1726
+ if (!normalizedCurrent) return false;
1727
+ return keys.some((key) => {
1728
+ const normalized = normalizeRouteToken(readRouteToken(args, key));
1729
+ return normalized !== void 0 && normalized !== normalizedCurrent;
1730
+ });
1731
+ }
1732
+ function explicitThreadRouteTargetsNonSource(args, hookContext, messagingTarget) {
1733
+ const normalizedCurrentThread = normalizeRouteToken(hookContext?.currentThreadId);
1734
+ const explicitThreadTokens = [...EXPLICIT_MESSAGE_THREAD_KEYS.map((key) => normalizeRouteToken(readRouteToken(args, key))), normalizeRouteToken(messagingTarget?.threadId)].filter((value) => value !== void 0);
1735
+ if (explicitThreadTokens.length === 0) return false;
1736
+ return normalizedCurrentThread === void 0 || explicitThreadTokens.some((value) => value !== normalizedCurrentThread);
1737
+ }
1738
+ function replyReceiptMatchesCurrentMessage(value, hookContext, depth = 0) {
1739
+ if (depth > 4 || value === null) return false;
1740
+ if (typeof value === "string") {
1741
+ const trimmed = value.trim();
1742
+ if (!trimmed || !["{", "["].includes(trimmed[0] ?? "")) return false;
1743
+ try {
1744
+ return replyReceiptMatchesCurrentMessage(JSON.parse(trimmed), hookContext, depth + 1);
1745
+ } catch {
1746
+ return false;
1747
+ }
1748
+ }
1749
+ if (typeof value !== "object") return false;
1750
+ if (Array.isArray(value)) return value.some((item) => replyReceiptMatchesCurrentMessage(item, hookContext, depth + 1));
1751
+ const record = value;
1752
+ for (const key of [
1753
+ "repliedTo",
1754
+ "replyTo",
1755
+ "replyToId",
1756
+ "replyToIdFull"
1757
+ ]) if (routeTokenMatchesCurrentMessage(typeof record[key] === "string" ? record[key] : void 0, hookContext)) return true;
1758
+ for (const key of [
1759
+ "content",
1760
+ "details",
1761
+ "payload",
1762
+ "receipt",
1763
+ "result",
1764
+ "results",
1765
+ "sendResult",
1766
+ "text"
1767
+ ]) if (replyReceiptMatchesCurrentMessage(record[key], hookContext, depth + 1)) return true;
1768
+ return false;
1769
+ }
1770
+ function hasExplicitNonSourceMessageRoute(args, hookContext, messagingTarget) {
1771
+ const currentProvider = normalizeRouteToken(hookContext?.currentChannelProvider);
1772
+ for (const key of EXPLICIT_MESSAGE_PROVIDER_KEYS) {
1773
+ const provider = normalizeRouteToken(typeof args[key] === "string" ? args[key] : void 0);
1774
+ if (provider && currentProvider !== provider && !routeProviderMatchesSource(provider, hookContext)) return true;
1775
+ }
1776
+ const targetValues = [...EXPLICIT_MESSAGE_TARGET_KEYS.map((key) => typeof args[key] === "string" ? args[key] : void 0), ...Array.isArray(args.targets) ? args.targets.map((value) => typeof value === "string" ? value : void 0) : []].filter((value) => normalizeRouteToken(value) !== void 0);
1777
+ if (explicitThreadRouteTargetsNonSource(args, hookContext, messagingTarget)) return true;
1778
+ if (explicitRouteTokensMismatchCurrent(args, EXPLICIT_MESSAGE_REPLY_KEYS, hookContext?.currentMessageId)) return true;
1779
+ if (messagingTarget?.to !== void 0 && !routeTokenMatchesSource(messagingTarget.to, hookContext)) return true;
1780
+ if (messagingTarget?.to !== void 0) return false;
1781
+ if (targetValues.length === 0) return false;
1782
+ if (targetValues.some((value) => !routeTokenMatchesSource(value, hookContext))) return true;
1783
+ return false;
1784
+ }
1675
1785
  /** Namespace attached to OpenClaw-owned dynamic tools exposed to Codex. */
1676
1786
  const CODEX_OPENCLAW_DYNAMIC_TOOL_NAMESPACE = "openclaw";
1677
- const ALWAYS_DIRECT_DYNAMIC_TOOL_NAMES = new Set(["sessions_yield"]);
1787
+ const ALWAYS_DIRECT_DYNAMIC_TOOL_NAMES = new Set([
1788
+ "agents_list",
1789
+ "sessions_spawn",
1790
+ "sessions_yield"
1791
+ ]);
1792
+ const EXPLICIT_MESSAGE_PROVIDER_KEYS = ["channel", "provider"];
1793
+ const EXPLICIT_MESSAGE_TARGET_KEYS = [
1794
+ "target",
1795
+ "to",
1796
+ "channelId"
1797
+ ];
1798
+ const EXPLICIT_MESSAGE_THREAD_KEYS = [
1799
+ "threadId",
1800
+ "thread_id",
1801
+ "messageThreadId",
1802
+ "topicId"
1803
+ ];
1804
+ const EXPLICIT_MESSAGE_REPLY_KEYS = [
1805
+ "replyTo",
1806
+ "replyToId",
1807
+ "replyToIdFull"
1808
+ ];
1678
1809
  const DEFAULT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS = 16e3;
1679
1810
  /**
1680
1811
  * Creates dynamic tool specs and a call handler that executes OpenClaw tools,
@@ -1700,6 +1831,7 @@ function createCodexDynamicToolBridge(params) {
1700
1831
  emitQuarantinedDynamicToolDiagnostics(quarantinedTools, params.hookContext);
1701
1832
  const telemetry = {
1702
1833
  didSendViaMessagingTool: false,
1834
+ didDeliverSourceReplyViaMessageTool: false,
1703
1835
  messagingToolSentTexts: [],
1704
1836
  messagingToolSentMediaUrls: [],
1705
1837
  messagingToolSentTargets: [],
@@ -1827,7 +1959,7 @@ function createCodexDynamicToolBridge(params) {
1827
1959
  toolCallOrdinal: options?.toolCallOrdinal
1828
1960
  });
1829
1961
  const messagingTelemetryArgs = applyCurrentMessageProvider(toolName, executedArgs, params.hookContext?.currentChannelProvider);
1830
- const messagingTarget = isMessagingTool(toolName) && isMessagingToolSendAction(toolName, executedArgs) ? extractMessagingToolSend(toolName, messagingTelemetryArgs, messagingContext) : void 0;
1962
+ const messagingTarget = isMessagingTool(toolName) ? extractMessagingToolSend(toolName, messagingTelemetryArgs, messagingContext) : void 0;
1831
1963
  const confirmedMessagingTarget = !rawIsError && messagingTarget ? extractMessagingToolSendResult(messagingTarget, telemetryRawResult) : messagingTarget;
1832
1964
  collectToolTelemetry({
1833
1965
  toolName,
@@ -1843,7 +1975,26 @@ function createCodexDynamicToolBridge(params) {
1843
1975
  contentItems: convertToolContents(result.content, toolResultMaxChars),
1844
1976
  success: !resultIsError
1845
1977
  }, terminalType);
1846
- withDynamicToolTermination(response, rawResult.terminate === true || result.terminate === true || isToolResultYield(rawResult) || isToolResultYield(result));
1978
+ const blocksSourceReplyTermination = hasExplicitNonSourceMessageRoute(executedArgs, params.hookContext, confirmedMessagingTarget);
1979
+ const deliveredSourceReply = isDeliveredMessageToolOnlySourceReplyResult({
1980
+ sourceReplyDeliveryMode: params.hookContext?.sourceReplyDeliveryMode,
1981
+ toolName,
1982
+ args: executedArgs,
1983
+ result,
1984
+ hookResult: rawResult,
1985
+ isError: resultIsError,
1986
+ allowExplicitSourceRoute: !blocksSourceReplyTermination
1987
+ });
1988
+ const receiptConfirmedSourceReply = params.hookContext?.sourceReplyDeliveryMode === "message_tool_only" && toolName === "message" && normalizeRouteToken(typeof executedArgs.action === "string" ? executedArgs.action : void 0) === "reply" && !resultIsError && !blocksSourceReplyTermination && isDeliveredMessagingToolResult({
1989
+ toolName,
1990
+ args: executedArgs,
1991
+ result,
1992
+ hookResult: rawResult,
1993
+ isError: resultIsError
1994
+ }) && (replyReceiptMatchesCurrentMessage(rawResult, params.hookContext) || replyReceiptMatchesCurrentMessage(result, params.hookContext));
1995
+ const toolConfirmedSourceReply = params.hookContext?.sourceReplyDeliveryMode === "message_tool_only" && toolName === "message" && !resultIsError && (rawResult.terminate === true || result.terminate === true);
1996
+ if (deliveredSourceReply || receiptConfirmedSourceReply || toolConfirmedSourceReply) telemetry.didDeliverSourceReplyViaMessageTool = true;
1997
+ withDynamicToolTermination(response, rawResult.terminate === true || result.terminate === true || isToolResultYield(rawResult) || isToolResultYield(result) || deliveredSourceReply || receiptConfirmedSourceReply);
1847
1998
  const asyncStarted = isAsyncStartedToolResult(rawResult) || isAsyncStartedToolResult(result);
1848
1999
  withDynamicToolAsyncStarted(response, asyncStarted);
1849
2000
  return withSideEffectEvidence(response, !(executionPrevented || !asyncStarted && isReplaySafeToolInstance(toolEntry.tool) && isReplaySafeToolCall(toolName, executedArgs)));
@@ -2155,7 +2306,16 @@ function collectToolTelemetry(params) {
2155
2306
  if (media.audioAsVoice) params.telemetry.toolAudioAsVoice = true;
2156
2307
  }
2157
2308
  }
2158
- if (!isMessagingTool(params.toolName) || !isMessagingToolSendAction(params.toolName, params.args)) return;
2309
+ if (!isMessagingTool(params.toolName)) return;
2310
+ const isMessagingSendAction = isMessagingToolSendAction(params.toolName, params.args);
2311
+ if (!isMessagingSendAction && !params.messagingTarget) return;
2312
+ if (!isMessagingSendAction && !isDeliveredMessagingToolResult({
2313
+ toolName: params.toolName,
2314
+ args: params.args,
2315
+ result: params.result,
2316
+ hookResult: params.mediaTrustResult,
2317
+ isError: params.isError
2318
+ })) return;
2159
2319
  params.telemetry.didSendViaMessagingTool = true;
2160
2320
  const sourceReplyPayload = extractInternalSourceReplyPayload(params.result?.details);
2161
2321
  if (sourceReplyPayload) {
@@ -2223,7 +2383,7 @@ function isCodexToolResultError(result) {
2223
2383
  if (typeof details.exitCode === "number" && details.exitCode !== 0) return true;
2224
2384
  if (typeof details.status !== "string") return false;
2225
2385
  const status = details.status.trim().toLowerCase();
2226
- return status !== "" && status !== "0" && status !== "ok" && status !== "success" && status !== "completed" && status !== "recorded" && status !== "pending" && status !== "started" && status !== "running" && status !== "yielded";
2386
+ return status !== "" && status !== "0" && status !== "ok" && status !== "success" && status !== "completed" && status !== "recorded" && status !== "created" && status !== "updated" && status !== "accepted" && status !== "found" && status !== "missing" && status !== "pending" && status !== "started" && status !== "running" && status !== "yielded";
2227
2387
  }
2228
2388
  function isToolResultYield(result) {
2229
2389
  const details = result.details;
@@ -2593,13 +2753,13 @@ async function buildPluginPolicyElicitationResponse(params) {
2593
2753
  const response = buildElicitationResponse(approvalPrompt, "approved-once");
2594
2754
  if (isJsonObject(response) && response.action === "accept") {
2595
2755
  if (mode === "allow") return response;
2596
- return buildElicitationResponse(approvalPrompt, await requestPluginApprovalOutcome({
2756
+ return buildElicitationResponse(approvalPrompt, oneShotPluginPolicyApprovalOutcome(mode, await requestPluginApprovalOutcome({
2597
2757
  paramsForRun: params.paramsForRun,
2598
2758
  title: approvalPrompt.title,
2599
2759
  description: approvalPrompt.description,
2600
- allowedDecisions: approvalPrompt.allowedDecisions,
2760
+ allowedDecisions: allowedPluginPolicyApprovalDecisions(mode, approvalPrompt),
2601
2761
  signal: params.signal
2602
- }));
2762
+ })));
2603
2763
  }
2604
2764
  logPluginElicitationDecline("unmappable_schema", params.requestParams);
2605
2765
  return declineElicitationResponse();
@@ -2607,6 +2767,14 @@ async function buildPluginPolicyElicitationResponse(params) {
2607
2767
  function resolvePluginDestructiveApprovalMode(entry) {
2608
2768
  return entry.destructiveApprovalMode ?? (entry.allowDestructiveActions ? "allow" : "deny");
2609
2769
  }
2770
+ function allowedPluginPolicyApprovalDecisions(mode, approvalPrompt) {
2771
+ const allowedDecisions = approvalPrompt.allowedDecisions ?? ["allow-once", "deny"];
2772
+ if (mode !== "ask") return allowedDecisions;
2773
+ return allowedDecisions.filter((decision) => decision !== "allow-always");
2774
+ }
2775
+ function oneShotPluginPolicyApprovalOutcome(mode, outcome) {
2776
+ return mode === "ask" && outcome === "approved-session" ? "approved-once" : outcome;
2777
+ }
2610
2778
  function readPluginApprovalElicitation(entry, requestParams) {
2611
2779
  if (readString(requestParams, "mode") !== "form" || !isJsonObject(requestParams.requestedSchema)) return;
2612
2780
  const requestedSchema = requestParams.requestedSchema;
@@ -39,11 +39,12 @@ const FALLBACK_CODEX_MODELS = [{
39
39
  */
40
40
  function buildCodexModelDefinition(model) {
41
41
  const id = model.id.trim() || model.model.trim();
42
+ const supportedReasoningEfforts = model.supportedReasoningEfforts;
42
43
  return {
43
44
  id,
44
45
  name: model.displayName?.trim() || id,
45
46
  api: "openai-chatgpt-responses",
46
- reasoning: model.supportedReasoningEfforts.length > 0 || shouldDefaultToReasoningModel(id),
47
+ reasoning: supportedReasoningEfforts !== void 0 ? supportedReasoningEfforts.length > 0 : shouldDefaultToReasoningModel(id),
47
48
  input: model.inputModalities.includes("image") ? ["text", "image"] : ["text"],
48
49
  cost: {
49
50
  input: 0,
@@ -54,7 +55,8 @@ function buildCodexModelDefinition(model) {
54
55
  contextWindow: DEFAULT_CONTEXT_WINDOW,
55
56
  maxTokens: DEFAULT_MAX_TOKENS,
56
57
  compat: {
57
- supportsReasoningEffort: model.supportedReasoningEfforts.length > 0,
58
+ ...supportedReasoningEfforts !== void 0 ? { supportsReasoningEffort: supportedReasoningEfforts.length > 0 } : {},
59
+ ...supportedReasoningEfforts && supportedReasoningEfforts.length > 0 ? { supportedReasoningEfforts: [...supportedReasoningEfforts] } : {},
58
60
  supportsUsageInStreaming: true
59
61
  }
60
62
  };