@openclaw/codex 2026.8.1-beta.2 → 2026.8.1
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/api.js +146 -0
- package/dist/{attempt-client-cleanup-DMLXUfa8.js → attempt-client-cleanup-CVPvp9dL.js} +47 -5
- package/dist/{auth-binding-B4FfbcCg.js → auth-binding-Ds_QVm-X.js} +18 -3
- package/dist/{binding-connection-I5Bo-AsX.js → binding-connection-CCQFs8lf.js} +15 -3
- package/dist/{bounded-turn-qgZmzy_4.js → bounded-turn-rq5tiSXk.js} +27 -26
- package/dist/{capabilities-CybGI1oz.js → capabilities-CGm_94eL.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-B1AEz8ZA.js → command-formatters-C54Yg3eA.js} +2 -2
- package/dist/{command-handlers-Db8pu_ds.js → command-handlers-BvOAHTrA.js} +111 -67
- package/dist/{compact-LspQaGfl.js → compact-Hd7SAc0N.js} +35 -30
- package/dist/{session-binding-DPxIvMgE.js → config-Cxw3Cl3k.js} +361 -1161
- package/dist/context-compaction-activity-BOeJf7yo.js +58 -0
- package/dist/doctor-contract-api.js +128 -26
- package/dist/{dynamic-tools-BVdyWkUD.js → dynamic-tools-BFoUcRdx.js} +1341 -1464
- package/dist/{effective-mcp-catalog-DIIhAtOZ.js → effective-mcp-catalog-BTJHnDSx.js} +2 -2
- package/dist/elicitation-input-DMkeki8d.js +71 -0
- package/dist/{event-projector-assistant-message-BwxV4d6N.js → event-projector-assistant-message-C5-Ds8mA.js} +18 -1
- package/dist/{event-projector-usage-e5huIQWu.js → event-projector-usage-D3PHFFXh.js} +18 -18
- package/dist/harness-DVfUQBlQ.js +248 -0
- package/dist/harness.js +2 -226
- package/dist/index.js +405 -299
- package/dist/{isolated-completion-C58NbL40.js → isolated-completion-Cbbx_5Ed.js} +4 -4
- package/dist/launch-args-sXOAg0SX.js +84 -0
- package/dist/managed-binary-ZkGodW19.js +248 -0
- package/dist/media-understanding-provider.js +2 -2
- package/dist/model-catalog-o6Cgjoss.js +101 -0
- package/dist/{models-BFlpn1Ex.js → models-DgFWSuxA.js} +25 -28
- package/dist/{native-subagent-monitor-DyTGmTUx.js → native-subagent-monitor-CwFyoylz.js} +385 -94
- package/dist/node-exec-server.runtime-DXrqpw1c.js +195 -0
- package/dist/plugin-approval-roundtrip-D80UZiJ_.js +95 -0
- package/dist/{plugin-marketplace-discovery-CzrGJdCR.js → plugin-marketplace-discovery-mdmScYOj.js} +60 -55
- package/dist/{plugin-metadata-cache-CNJPj4_b.js → plugin-metadata-cache-CulOABwu.js} +164 -134
- package/dist/{protocol-validators-B4F7L8Rf.js → protocol-validators-Bg5rpNxk.js} +203 -7
- package/dist/{rate-limits-DZXmOL8-.js → rate-limits-hFtzt2Up.js} +1 -1
- package/dist/{sandbox-guard-Cmwc9eIk.js → request-CCm4LaED.js} +207 -20
- package/dist/{run-attempt-P8BdxC1I.js → run-attempt-BwNQDH2u.js} +1506 -836
- package/dist/{runtime-artifact-BVSPdd6g.js → runtime-artifact-DeBvleJw.js} +4 -7
- package/dist/session-binding-q2WSTVmC.js +947 -0
- package/dist/{session-catalog-xwNi_SDM.js → session-catalog-C2Tae4rI.js} +1698 -1346
- package/dist/session-catalog-home-id-DAKUrm3C.js +112 -0
- package/dist/{session-cli-7hgXZDV7.js → session-cli-BuDjm5Ou.js} +20 -7
- package/dist/session-permission-policy-gLm40Vtq.js +160 -0
- package/dist/session-retirement-CdkI0bvb.js +90 -0
- package/dist/{session-upstream-marker-CrIFX06J.js → session-upstream-marker-Bcy33kam.js} +2 -3
- package/dist/{settled-turn-finalizer-BRWBO4MO.js → settled-turn-finalizer-B8JJcxCi.js} +27 -22
- package/dist/{shared-client-kIBbGjk4.js → shared-client-kNkljY-R.js} +2023 -607
- package/dist/{side-question-9HAL26l9.js → side-question-GwD73tX6.js} +109 -57
- package/dist/{thread-lifecycle-Bu1BTDXr.js → thread-lifecycle-Ss-uwnC4.js} +1208 -497
- package/dist/{thread-ownership-6kOQHlyC.js → thread-ownership-CeYBqg_4.js} +18 -8
- package/dist/{plugin-app-cache-key-C3H2CVp6.js → thread-resume-DF54hagX.js} +64 -6
- package/dist/{transcript-mirror-B9gGgnJS.js → transcript-mirror-CkEQIna-.js} +158 -41
- package/dist/transport-stdio-C7-s9TLG.js +708 -0
- package/dist/{upstream-prompt-provenance-ClRBije0.js → upstream-prompt-provenance-CFmsKwr9.js} +12 -14
- package/dist/{upstream-session-fork-CE-_LdnP.js → upstream-session-fork-BACGlOFa.js} +86 -88
- package/dist/{usage-CHlV0e-o.js → usage-C2l8Mils.js} +3 -3
- package/dist/{web-search-provider.runtime-DRw2Vl42.js → web-search-provider.runtime-B2XgRdFv.js} +3 -3
- package/openclaw.plugin.json +50 -2
- package/package.json +9 -8
- package/dist/app-server-policy-zcBDc1JU.js +0 -49
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/request-BRl5_UfX.js +0 -157
- package/dist/session-retirement-DoMMJFKm.js +0 -36
- package/dist/thread-resume-CPrJNQVM.js +0 -30
- package/dist/transport-stdio-DIImwDVS.js +0 -99
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { C as isCodexRemoteExecPlacementSandbox,
|
|
2
|
-
import {
|
|
3
|
-
import { d as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
1
|
+
import { C as isCodexRemoteExecPlacementSandbox, D as resolveOpenClawExecPolicyForCodexAppServer, S as isCodexPairedNodeRemoteExecPlacementSandbox, T as readCodexPluginConfig, m as resolveCodexModelBackedReviewerPolicyContext, p as canUseCodexModelBackedApprovalsReviewerForModel, r as resolveCodexAppServerHomeScope, u as shouldAutoApproveCodexAppServerApprovals, v as readCodexRequirementsToml, w as isCodexSandboxExecServerEnabled } from "./config-Cxw3Cl3k.js";
|
|
2
|
+
import { C as withLeasedCodexAppServerClientStartSelectionRetry, Ht as isJsonObject, K as isCodexAppServerIndeterminateRequestCancellationError, Lt as resolveCodexAppServerPreparedAuthHandoff, Ot as readRecentCodexRateLimits, U as isCodexAppServerApprovalRequest, _t as ensureCodexAppServerClientRuntime, at as resolveDynamicToolCallTimeoutMs, c as getLeasedSharedCodexAppServerClient, dt as resolveCodexToolAbortTerminalReason, et as createCodexElicitationResponse, m as releaseCodexAppServerClientLease, tt as handleDynamicToolCallWithTimeout } from "./shared-client-kNkljY-R.js";
|
|
3
|
+
import { d as sessionBindingIdentity } from "./session-binding-q2WSTVmC.js";
|
|
4
|
+
import { a as assertCodexThreadForkResponse, c as assertCodexTurnStartResponse, d as readCodexTurn, l as readCodexDynamicToolCallParams } from "./protocol-validators-Bg5rpNxk.js";
|
|
5
|
+
import { f as unsubscribeCodexThreadBestEffort, g as isCodexNotificationForTurn, s as isCodexAlreadyTerminalInterruptError, u as retireUnsafeCodexTurnClientBestEffort } from "./attempt-client-cleanup-CVPvp9dL.js";
|
|
6
|
+
import { A as readCodexSupportedReasoningEfforts, E as resolveCodexAppServerRequestModelSelection, L as filterCodexDynamicTools, O as resolveCodexBindingModelProviderFallback, T as resolveCodexAppServerModelProvider, U as resolveCodexDynamicToolsLoading, c as buildCodexNativeHookRelayConfig, d as emitCodexNativePreToolUseFailureDiagnostic, et as buildCodexPluginAppsConfigPatchFromPolicyContext, k as resolveReasoningEffort, l as buildCodexNativeHookRelayDisabledConfig, o as CODEX_NATIVE_HOOK_RELAY_EVENTS, ot as mergeCodexThreadConfigs, v as buildCodexRuntimeThreadConfig, w as CODEX_NATIVE_PERSONALITY_NONE, x as resolveCodexWebSearchPlan } from "./thread-lifecycle-Ss-uwnC4.js";
|
|
7
|
+
import { s as resolveCodexNativeExecutionBlock } from "./request-CCm4LaED.js";
|
|
8
|
+
import { n as formatCodexUsageLimitErrorMessage } from "./rate-limits-hFtzt2Up.js";
|
|
9
|
+
import { a as resolveCodexAppServerForModelProvider, i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, r as resolveCodexEffectiveSessionPermissionPolicy, t as CODEX_SESSION_PERMISSION_EXEC_MODES } from "./session-permission-policy-gLm40Vtq.js";
|
|
10
|
+
import { n as resolveCodexBindingAppServerConnection, t as requireCodexSupervisionModelSelection } from "./binding-connection-CCQFs8lf.js";
|
|
11
|
+
import { C as shouldRequireCodexSandboxExecServerEnvironment, D as CodexNativeToolLifecycleProjector, S as shouldEnableCodexAppServerNativeToolSurface, T as filterCodexVisionTools, a as emitDynamicToolStartedDiagnostic, b as resolveCodexNodePlacementToolConstructionPlan, d as releaseCodexSandboxExecServerEnvironment, i as emitDynamicToolErrorDiagnostic, l as resolveCodexProviderWebSearchSupportForClient, o as emitDynamicToolTerminalDiagnostic, r as routeCodexAppServerElicitationRequest, s as handleCodexAppServerApprovalRequest, t as createCodexDynamicToolBridge, u as ensureCodexSandboxExecServerEnvironment, v as resolveCodexExternalSandboxPolicyForOpenClawSandbox, x as resolveCodexSandboxEnvironmentSelection, y as resolveCodexMessageToolProvider } from "./dynamic-tools-BFoUcRdx.js";
|
|
11
12
|
import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
|
-
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext,
|
|
13
|
+
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
13
14
|
import { randomUUID } from "node:crypto";
|
|
15
|
+
import { resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
16
|
+
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
14
17
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
15
18
|
//#region extensions/codex/src/app-server/side-question.ts
|
|
16
19
|
const SIDE_QUESTION_COMPLETION_TIMEOUT_MS = 6e5;
|
|
@@ -56,14 +59,18 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
56
59
|
config: params.cfg
|
|
57
60
|
}));
|
|
58
61
|
if (!binding?.threadId) throw new Error("Codex /btw needs an active Codex thread. Send a normal message first, then try /btw again.");
|
|
62
|
+
if (isCodexPairedNodeRemoteExecPlacementSandbox(params.sandbox)) throw new Error("Normal Codex turns are supported on nodes, but /btw is not yet bound to the active placement.");
|
|
59
63
|
const pluginConfig = readCodexPluginConfig(options.pluginConfig);
|
|
60
|
-
const { sessionAgentId } =
|
|
64
|
+
const { sessionAgentId } = resolveSessionAgentIdsStrict({
|
|
61
65
|
sessionKey: params.sessionKey,
|
|
62
66
|
config: params.cfg,
|
|
63
67
|
agentId: params.agentId
|
|
64
68
|
});
|
|
69
|
+
const agentWorkspaceDir = params.workspaceDir?.trim() || resolveAgentWorkspaceDir(params.cfg, sessionAgentId);
|
|
65
70
|
const execPolicy = resolveOpenClawExecPolicyForCodexAppServer({
|
|
66
|
-
|
|
71
|
+
permissionMode: params.sessionEntry.permissionMode,
|
|
72
|
+
execOverrides: params.sessionEntry.permissionMode ? { mode: CODEX_SESSION_PERMISSION_EXEC_MODES[params.sessionEntry.permissionMode] } : void 0,
|
|
73
|
+
approvals: params.sessionEntry.permissionMode === "full" ? void 0 : loadExecApprovals(),
|
|
67
74
|
config: params.cfg,
|
|
68
75
|
agentId: sessionAgentId
|
|
69
76
|
});
|
|
@@ -99,7 +106,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
99
106
|
bindingModelProvider: binding.modelProvider
|
|
100
107
|
});
|
|
101
108
|
const modelSelection = resolveCodexAppServerRequestModelSelection({
|
|
102
|
-
model: supervisionModelSelection?.model ?? params.model,
|
|
109
|
+
model: supervisionModelSelection?.model ?? options.runtimeModelId ?? params.model,
|
|
103
110
|
modelProvider,
|
|
104
111
|
authProfileId,
|
|
105
112
|
authProfileStore: preparedRuntimeAuth.authProfileStore,
|
|
@@ -123,8 +130,41 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
123
130
|
config: params.cfg,
|
|
124
131
|
agentDir: params.agentDir
|
|
125
132
|
});
|
|
126
|
-
const
|
|
127
|
-
|
|
133
|
+
const reviewerContext = {
|
|
134
|
+
modelProvider: reviewerPolicyContext.modelProvider,
|
|
135
|
+
model: reviewerPolicyContext.model,
|
|
136
|
+
config: params.cfg,
|
|
137
|
+
env: process.env,
|
|
138
|
+
agentDir: params.agentDir
|
|
139
|
+
};
|
|
140
|
+
const appServer = resolveCodexAppServerForModelProvider({
|
|
141
|
+
appServer: applyCodexSessionPermissionPolicy({
|
|
142
|
+
appServer: connection.appServer,
|
|
143
|
+
permissionMode: params.sessionEntry.permissionMode,
|
|
144
|
+
sessionRoot: params.sessionEntry.sessionRoot,
|
|
145
|
+
defaultRoot: agentWorkspaceDir,
|
|
146
|
+
pluginConfig,
|
|
147
|
+
canUseAutoReview: canUseCodexModelBackedApprovalsReviewerForModel(reviewerContext),
|
|
148
|
+
requirementsToml: readCodexRequirementsToml({}),
|
|
149
|
+
policyLocked: usesSupervisionConnection,
|
|
150
|
+
execMode: execPolicy.mode
|
|
151
|
+
}),
|
|
152
|
+
...reviewerContext,
|
|
153
|
+
provider: reviewerContext.modelProvider
|
|
154
|
+
});
|
|
155
|
+
const sessionPermissionPolicy = resolveCodexEffectiveSessionPermissionPolicy({
|
|
156
|
+
appServer,
|
|
157
|
+
permissionMode: params.sessionEntry.permissionMode,
|
|
158
|
+
sessionRoot: params.sessionEntry.sessionRoot,
|
|
159
|
+
defaultRoot: agentWorkspaceDir
|
|
160
|
+
});
|
|
161
|
+
const cwd = resolveCodexSessionPermissionCwd({
|
|
162
|
+
permissionMode: params.sessionEntry.permissionMode,
|
|
163
|
+
sessionRoot: params.sessionEntry.sessionRoot,
|
|
164
|
+
defaultRoot: agentWorkspaceDir,
|
|
165
|
+
requestedCwd: binding.cwd,
|
|
166
|
+
fallbackCwd: agentWorkspaceDir
|
|
167
|
+
});
|
|
128
168
|
const runId = params.opts?.runId ?? randomUUID();
|
|
129
169
|
const effectiveParams = supervisionModelSelection ? {
|
|
130
170
|
...params,
|
|
@@ -151,8 +191,14 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
151
191
|
runId,
|
|
152
192
|
timeoutMs: appServer.requestTimeoutMs
|
|
153
193
|
});
|
|
194
|
+
sideRunParams.permissionMode = sessionPermissionPolicy?.mode;
|
|
195
|
+
sideRunParams.sessionRoot = sessionPermissionPolicy?.root;
|
|
196
|
+
sideRunParams.execOverrides = sessionPermissionPolicy && { mode: sessionPermissionPolicy.execMode };
|
|
154
197
|
const sandboxExecServerEnabled = isCodexSandboxExecServerEnabled(pluginConfig, params.sandbox);
|
|
155
|
-
const nativeToolSurfaceEnabled = shouldEnableCodexAppServerNativeToolSurface(sideRunParams, params.sandbox ?? void 0, {
|
|
198
|
+
const nativeToolSurfaceEnabled = shouldEnableCodexAppServerNativeToolSurface(sideRunParams, params.sandbox ?? void 0, {
|
|
199
|
+
agentId: sideRunParams.agentId,
|
|
200
|
+
sandboxExecServerEnabled
|
|
201
|
+
});
|
|
156
202
|
const sandboxEnvironmentRequired = shouldRequireCodexSandboxExecServerEnvironment({
|
|
157
203
|
sandbox: params.sandbox ?? void 0,
|
|
158
204
|
nativeToolSurfaceEnabled,
|
|
@@ -162,6 +208,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
162
208
|
config: sideRunParams.config,
|
|
163
209
|
sessionKey: sideRunParams.sandboxSessionKey?.trim() || sideRunParams.sessionKey,
|
|
164
210
|
sessionId: sideRunParams.sessionId,
|
|
211
|
+
agentId: sideRunParams.agentId,
|
|
165
212
|
sandbox: params.sandbox,
|
|
166
213
|
sandboxEnvironmentSelected: sandboxEnvironmentRequired,
|
|
167
214
|
surface: "/btw side-question mode"
|
|
@@ -230,9 +277,10 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
230
277
|
const activeDynamicToolCalls = /* @__PURE__ */ new Set();
|
|
231
278
|
const releaseSandboxEnvironment = async () => {
|
|
232
279
|
if (!sandboxEnvironment) return;
|
|
280
|
+
const environment = sandboxEnvironment;
|
|
233
281
|
sandboxEnvironment = void 0;
|
|
234
282
|
sandboxEnvironmentClient = void 0;
|
|
235
|
-
await releaseCodexSandboxExecServerEnvironment(params.sandbox);
|
|
283
|
+
await releaseCodexSandboxExecServerEnvironment(params.sandbox, environment);
|
|
236
284
|
};
|
|
237
285
|
const ensureSandboxEnvironment = async (targetClient) => {
|
|
238
286
|
if (!sandboxEnvironmentRequired || sandboxEnvironmentClient === targetClient) return;
|
|
@@ -240,32 +288,23 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
240
288
|
const environment = await ensureCodexSandboxExecServerEnvironment({
|
|
241
289
|
client: targetClient,
|
|
242
290
|
sandbox: params.sandbox ?? null,
|
|
291
|
+
runtime: options.runtime,
|
|
243
292
|
appServerStartOptions: appServer.start,
|
|
244
293
|
timeoutMs: appServer.requestTimeoutMs,
|
|
245
|
-
signal: runAbortController.signal
|
|
294
|
+
signal: runAbortController.signal,
|
|
295
|
+
onExecutionDisconnect: (error) => {
|
|
296
|
+
collector.reject(error);
|
|
297
|
+
embeddedAgentLog.warn(error.message);
|
|
298
|
+
runAbortController.abort("client_closed");
|
|
299
|
+
}
|
|
246
300
|
});
|
|
247
301
|
if (!environment) throw new Error("Codex app-server did not register an OpenClaw sandbox exec-server environment.");
|
|
248
302
|
sandboxEnvironment = environment;
|
|
249
303
|
sandboxEnvironmentClient = targetClient;
|
|
250
304
|
};
|
|
251
305
|
try {
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
provider: reviewerPolicyContext.modelProvider,
|
|
255
|
-
model: reviewerPolicyContext.model,
|
|
256
|
-
config: params.cfg,
|
|
257
|
-
env: process.env,
|
|
258
|
-
agentDir: params.agentDir
|
|
259
|
-
});
|
|
260
|
-
const useModelScopedPolicy = !canUseCodexModelBackedApprovalsReviewerForModel({
|
|
261
|
-
modelProvider: reviewerPolicyContext.modelProvider,
|
|
262
|
-
model: reviewerPolicyContext.model,
|
|
263
|
-
config: params.cfg,
|
|
264
|
-
env: process.env,
|
|
265
|
-
agentDir: params.agentDir
|
|
266
|
-
});
|
|
267
|
-
const approvalPolicy = useModelScopedPolicy ? modelScopedAppServer.approvalPolicy : binding.approvalPolicy ?? modelScopedAppServer.approvalPolicy;
|
|
268
|
-
const sandbox = useModelScopedPolicy ? modelScopedAppServer.sandbox : binding.sandbox ?? modelScopedAppServer.sandbox;
|
|
306
|
+
const approvalPolicy = appServer.approvalPolicy;
|
|
307
|
+
const sandbox = appServer.sandbox;
|
|
269
308
|
const { toolBridge, webSearchPlan } = await createCodexSideToolBridge({
|
|
270
309
|
params: effectiveParams,
|
|
271
310
|
cwd,
|
|
@@ -281,6 +320,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
281
320
|
modelProviderOverride: modelSelection.modelProvider,
|
|
282
321
|
signal: runAbortController.signal
|
|
283
322
|
}) : "unsupported",
|
|
323
|
+
sessionPermissionPolicy,
|
|
284
324
|
runId,
|
|
285
325
|
signal: runAbortController.signal
|
|
286
326
|
});
|
|
@@ -295,14 +335,17 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
295
335
|
});
|
|
296
336
|
const registerRequestHandler = (targetClient) => targetClient.addRequestHandler(async (request) => {
|
|
297
337
|
if (!childThreadId || !turnId) return;
|
|
298
|
-
if (request.method === "mcpServer/elicitation/request")
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
338
|
+
if (request.method === "mcpServer/elicitation/request") {
|
|
339
|
+
const approvalResult = await routeCodexAppServerElicitationRequest({
|
|
340
|
+
requestParams: request.params,
|
|
341
|
+
paramsForRun: sideRunParams,
|
|
342
|
+
threadId: childThreadId,
|
|
343
|
+
turnId,
|
|
344
|
+
pluginAppPolicyContext: binding.pluginAppPolicyContext,
|
|
345
|
+
signal: runAbortController.signal
|
|
346
|
+
});
|
|
347
|
+
return approvalResult.kind === "handled" ? approvalResult.response : createCodexElicitationResponse("decline", null, { message: "OpenClaw Codex side questions do not support interactive MCP input." });
|
|
348
|
+
}
|
|
306
349
|
if (request.method === "item/tool/requestUserInput") return isSideUserInputRequest(request.params, childThreadId, turnId) ? emptySideUserInputResponse() : void 0;
|
|
307
350
|
if (isCodexAppServerApprovalRequest(request.method)) return handleCodexAppServerApprovalRequest({
|
|
308
351
|
method: request.method,
|
|
@@ -313,7 +356,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
313
356
|
nativeHookRelay,
|
|
314
357
|
autoApprove: shouldAutoApproveCodexAppServerApprovals({
|
|
315
358
|
approvalPolicy,
|
|
316
|
-
networkProxy:
|
|
359
|
+
networkProxy: appServer.networkProxy,
|
|
317
360
|
sandbox
|
|
318
361
|
}),
|
|
319
362
|
signal: runAbortController.signal,
|
|
@@ -412,18 +455,17 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
412
455
|
relay: nativeHookRelay,
|
|
413
456
|
events: nativeHookRelayEvents,
|
|
414
457
|
hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec,
|
|
415
|
-
clearOmittedEvents: true
|
|
416
|
-
loopDetectionPreToolUseRelay: appServer.loopDetectionPreToolUseRelay
|
|
458
|
+
clearOmittedEvents: true
|
|
417
459
|
}) : options.nativeHookRelay?.enabled === false ? buildCodexNativeHookRelayDisabledConfig() : void 0;
|
|
418
460
|
const runtimeThreadConfig = buildCodexRuntimeThreadConfig(webSearchPlan.threadConfig, {
|
|
419
461
|
nativeCodeModeEnabled: nativeToolSurfaceEnabled,
|
|
420
462
|
nativeCodeModeOnlyEnabled: appServer.codeModeOnly
|
|
421
463
|
});
|
|
422
|
-
const threadConfig = mergeCodexThreadConfigs(nativeHookRelayConfig, runtimeThreadConfig, binding.pluginAppPolicyContext ? buildCodexPluginAppsConfigPatchFromPolicyContext(binding.pluginAppPolicyContext) : void 0,
|
|
464
|
+
const threadConfig = mergeCodexThreadConfigs(nativeHookRelayConfig, runtimeThreadConfig, binding.pluginAppPolicyContext ? buildCodexPluginAppsConfigPatchFromPolicyContext(binding.pluginAppPolicyContext) : void 0, appServer.networkProxy?.configPatch) ?? runtimeThreadConfig;
|
|
423
465
|
const forkResponse = assertCodexThreadForkResponse(await withLeasedCodexAppServerClientStartSelectionRetry({
|
|
424
466
|
lease: clientLease,
|
|
425
467
|
options: clientOptions,
|
|
426
|
-
signal:
|
|
468
|
+
signal: runAbortController.signal,
|
|
427
469
|
run: async (forkClient, requestOptions) => {
|
|
428
470
|
await ensureSandboxEnvironment(forkClient);
|
|
429
471
|
const executionCwd = sandboxEnvironment?.cwd ?? cwd;
|
|
@@ -432,15 +474,16 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
432
474
|
model: modelSelection.model,
|
|
433
475
|
...modelSelection.modelProvider ? { modelProvider: modelSelection.modelProvider } : {},
|
|
434
476
|
cwd: executionCwd,
|
|
477
|
+
...sessionPermissionPolicy ? { runtimeWorkspaceRoots: [sessionPermissionPolicy.root] } : {},
|
|
435
478
|
approvalPolicy,
|
|
436
|
-
approvalsReviewer:
|
|
437
|
-
...sandboxEnvironment ||
|
|
479
|
+
approvalsReviewer: appServer.approvalsReviewer,
|
|
480
|
+
...sandboxEnvironment || appServer.networkProxy ? {} : { sandbox },
|
|
438
481
|
...serviceTier ? { serviceTier } : {},
|
|
439
482
|
config: threadConfig,
|
|
440
483
|
developerInstructions: SIDE_DEVELOPER_INSTRUCTIONS,
|
|
441
484
|
ephemeral: true,
|
|
442
485
|
threadSource: "user"
|
|
443
|
-
}, requestOptions);
|
|
486
|
+
}, requestOptions());
|
|
444
487
|
},
|
|
445
488
|
onClientChange: rebindClientHandlers
|
|
446
489
|
}));
|
|
@@ -451,7 +494,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
451
494
|
items: [sideBoundaryPromptItem()]
|
|
452
495
|
}, {
|
|
453
496
|
timeoutMs: appServer.requestTimeoutMs,
|
|
454
|
-
signal:
|
|
497
|
+
signal: runAbortController.signal
|
|
455
498
|
});
|
|
456
499
|
const effort = usesSupervisionConnection ? void 0 : resolveReasoningEffort(params.resolvedThinkLevel ?? "off", modelSelection.model, readCodexSupportedReasoningEfforts(params.runtimeModel?.compat));
|
|
457
500
|
turnId = assertCodexTurnStartResponse(await client.request("turn/start", {
|
|
@@ -482,7 +525,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
482
525
|
}
|
|
483
526
|
}, {
|
|
484
527
|
timeoutMs: appServer.requestTimeoutMs,
|
|
485
|
-
signal:
|
|
528
|
+
signal: runAbortController.signal
|
|
486
529
|
}).catch((error) => {
|
|
487
530
|
if (isCodexAppServerIndeterminateRequestCancellationError(error)) turnId = "";
|
|
488
531
|
throw error;
|
|
@@ -499,7 +542,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
499
542
|
let text;
|
|
500
543
|
try {
|
|
501
544
|
text = await collector.wait({
|
|
502
|
-
signal:
|
|
545
|
+
signal: runAbortController.signal,
|
|
503
546
|
timeoutMs: Math.max(appServer.turnCompletionIdleTimeoutMs, SIDE_QUESTION_COMPLETION_TIMEOUT_MS)
|
|
504
547
|
});
|
|
505
548
|
} catch (error) {
|
|
@@ -622,6 +665,7 @@ function buildSideRunAttemptParams(params, options) {
|
|
|
622
665
|
authStorage: params.preparedRuntimeAuth.authStorage,
|
|
623
666
|
authProfileStore: params.preparedRuntimeAuth.authProfileStore,
|
|
624
667
|
modelRegistry: params.preparedRuntimeAuth.modelRegistry,
|
|
668
|
+
preparedModelRuntime: params.preparedModelRuntime,
|
|
625
669
|
...params.preparedRuntimeAuth.resolvedApiKey ? { resolvedApiKey: params.preparedRuntimeAuth.resolvedApiKey } : {},
|
|
626
670
|
runId: options.runId,
|
|
627
671
|
abortSignal: params.opts?.abortSignal,
|
|
@@ -641,6 +685,7 @@ async function createCodexSideToolBridge(input) {
|
|
|
641
685
|
};
|
|
642
686
|
const messageToolProvider = resolveCodexMessageToolProvider(input.params);
|
|
643
687
|
let tools = [];
|
|
688
|
+
const webFetchHostnameAllowlistRef = {};
|
|
644
689
|
if (supportsModelTools(runtimeModel)) {
|
|
645
690
|
const createOpenClawCodingTools = (await import("openclaw/plugin-sdk/agent-harness")).createOpenClawCodingTools;
|
|
646
691
|
const sandboxSessionKey = input.params.sandboxSessionKey?.trim() || input.params.sessionKey?.trim() || input.params.sessionId || input.sessionAgentId;
|
|
@@ -649,11 +694,14 @@ async function createCodexSideToolBridge(input) {
|
|
|
649
694
|
sessionKey: sandboxSessionKey,
|
|
650
695
|
workspaceDir: input.cwd
|
|
651
696
|
});
|
|
652
|
-
|
|
697
|
+
const toolConstructionPlan = resolveCodexNodePlacementToolConstructionPlan(sandbox, input.nativeToolSurfaceEnabled);
|
|
698
|
+
tools = filterCodexVisionTools(filterCodexDynamicTools(createOpenClawCodingTools({
|
|
653
699
|
agentId: input.sessionAgentId,
|
|
654
700
|
sessionKey: sandboxSessionKey,
|
|
655
701
|
runSessionKey: input.params.sessionKey && input.params.sessionKey !== sandboxSessionKey ? input.params.sessionKey : void 0,
|
|
656
702
|
sessionId: input.params.sessionId,
|
|
703
|
+
exec: input.sessionPermissionPolicy && { mode: input.sessionPermissionPolicy.execMode },
|
|
704
|
+
sessionPermissionPolicy: input.sessionPermissionPolicy,
|
|
657
705
|
runId: input.runId,
|
|
658
706
|
agentDir: input.params.agentDir ?? resolveAgentDir(input.params.cfg ?? {}, input.sessionAgentId),
|
|
659
707
|
workspaceDir: input.cwd,
|
|
@@ -662,6 +710,7 @@ async function createCodexSideToolBridge(input) {
|
|
|
662
710
|
resolvedWorkspace: input.params.workspaceDir ?? input.cwd
|
|
663
711
|
}),
|
|
664
712
|
config: input.params.cfg,
|
|
713
|
+
preparedModelRuntime: input.params.preparedModelRuntime,
|
|
665
714
|
abortSignal: input.signal,
|
|
666
715
|
modelProvider: runtimeModel.provider,
|
|
667
716
|
modelId: input.params.model,
|
|
@@ -670,6 +719,7 @@ async function createCodexSideToolBridge(input) {
|
|
|
670
719
|
modelContextWindowTokens: runtimeModel.contextWindow,
|
|
671
720
|
modelAuthMode: resolveModelAuthMode(runtimeModel.provider, input.params.cfg, void 0, { workspaceDir: input.cwd }),
|
|
672
721
|
suppressManagedWebSearch: false,
|
|
722
|
+
webFetchHostnameAllowlistRef,
|
|
673
723
|
...input.params.messageProvider || input.params.messageChannel ? {
|
|
674
724
|
messageProvider: messageToolProvider,
|
|
675
725
|
toolPolicyMessageProvider: input.params.messageProvider ?? input.params.messageChannel
|
|
@@ -698,12 +748,13 @@ async function createCodexSideToolBridge(input) {
|
|
|
698
748
|
currentChannelId: input.params.currentChannelId
|
|
699
749
|
}).channelId,
|
|
700
750
|
sandbox,
|
|
751
|
+
...toolConstructionPlan ? { toolConstructionPlan } : {},
|
|
701
752
|
emitBeforeToolCallDiagnostics: false,
|
|
702
753
|
modelHasVision: runtimeModel.input?.includes("image") ?? false,
|
|
703
754
|
requireExplicitMessageTarget: true
|
|
704
755
|
}), input.pluginConfig), {
|
|
705
756
|
modelHasVision: runtimeModel.input?.includes("image") ?? false,
|
|
706
|
-
|
|
757
|
+
nativeImageInspectionEnabled: input.nativeToolSurfaceEnabled
|
|
707
758
|
});
|
|
708
759
|
}
|
|
709
760
|
const requestedWebSearchPlan = resolveCodexWebSearchPlan({
|
|
@@ -712,6 +763,7 @@ async function createCodexSideToolBridge(input) {
|
|
|
712
763
|
nativeProviderWebSearchSupport: input.nativeProviderWebSearchSupport,
|
|
713
764
|
webSearchAllowed: tools.some((tool) => tool.name === "web_search")
|
|
714
765
|
});
|
|
766
|
+
webFetchHostnameAllowlistRef.value = requestedWebSearchPlan.webFetchHostnameAllowlist;
|
|
715
767
|
const webSearchPlan = requestedWebSearchPlan.kind === "managed" ? resolveCodexWebSearchPlan({
|
|
716
768
|
config: input.params.cfg,
|
|
717
769
|
webSearchAllowed: false
|