@openclaw/codex 2026.7.2-beta.7 → 2026.7.34
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/README.md +3 -27
- package/dist/{command-formatters-C336eRVS.js → .setup/app-server-policy-C_qTMEMy.mjs} +51 -9
- package/dist/{attempt-notifications-AP-a-Q5k.js → .setup/attempt-notifications-F8krwWL4.mjs} +6 -3
- package/dist/{command-handlers-DAHUSry9.js → .setup/command-handlers-DSRFfor4.mjs} +1156 -1319
- package/dist/.setup/command-rpc-BvYsfQ7G.mjs +786 -0
- package/dist/{compact-D_uvHurS.js → .setup/compact-BNgh7I4t.mjs} +10 -40
- package/dist/.setup/computer-use-C3QkmSO3.mjs +377 -0
- package/dist/.setup/config-CYEDnLJ2.mjs +1138 -0
- package/dist/{conversation-binding-data-BHRpYbX3.js → .setup/conversation-binding-data-CrRxtDBu.mjs} +1 -1
- package/dist/{bounded-turn-D2ZAgZVz.js → .setup/media-understanding-provider-EbJCyDqe.mjs} +203 -109
- package/dist/{models-BBMKU4jA.js → .setup/models-C_aZk03A.mjs} +11 -6
- package/dist/.setup/notification-correlation-iYs4WieS.mjs +35 -0
- package/dist/.setup/plugin-app-cache-key-DR8jV9oS.mjs +99 -0
- package/dist/.setup/protocol-2POPqAY4.mjs +13 -0
- package/dist/{transcript-mirror-DzsdNCf5.js → .setup/protocol-validators-dZQ-UTOa.mjs} +112 -922
- package/dist/{rate-limits-CU-gVCCS.js → .setup/provider-DGxDs6g8.mjs} +269 -13
- package/dist/{dynamic-tools-D2gYkSBO.js → .setup/provider-capabilities-DS2N_zc1.mjs} +5632 -3953
- package/dist/.setup/request-DFR0JyoV.mjs +36 -0
- package/dist/.setup/run-attempt-C7xEKFVB.mjs +8180 -0
- package/dist/{sandbox-guard-NuhpXmPB.js → .setup/sandbox-guard-DA2TQfZW.mjs} +1 -14
- package/dist/.setup/session-binding-DuihlMJc.mjs +628 -0
- package/dist/.setup/shared-client-B2KmLPRw.mjs +1854 -0
- package/dist/{side-question-_ulBk1AL.js → .setup/side-question-Cv6JXWCS.mjs} +84 -159
- package/dist/.setup/thread-lifecycle-u6CZdOOH.mjs +2593 -0
- package/dist/{web-search-provider.runtime-CCFhg2z5.js → .setup/web-search-provider.runtime-Ce2zOHxW.mjs} +3 -3
- package/dist/doctor-contract-api.js +122 -88
- package/dist/harness.js +20 -89
- package/dist/index.js +436 -1615
- package/dist/media-understanding-provider.js +1 -173
- package/dist/prompt-overlay.js +15 -0
- package/dist/provider-catalog.js +79 -0
- package/dist/provider-discovery.js +34 -0
- package/dist/provider.js +2 -0
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +178 -221
- package/package.json +8 -9
- package/dist/app-server-policy-BSaO2JIT.js +0 -49
- package/dist/auth-binding-B4FfbcCg.js +0 -62
- package/dist/capabilities-BFDTVYr4.js +0 -36
- package/dist/cli-metadata.js +0 -20
- package/dist/computer-use-CYEc8U3w.js +0 -693
- package/dist/conversation-control-xsIeXbo4.js +0 -287
- package/dist/effective-mcp-catalog-Bbd98Inw.js +0 -114
- package/dist/event-projector-assistant-message-DTgnPPVF.js +0 -101
- package/dist/event-projector-usage-Xp4AlR2k.js +0 -86
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/notification-correlation-CU6_AnOb.js +0 -67
- package/dist/plugin-app-cache-key-DztPafOA.js +0 -408
- package/dist/request-qKh331yu.js +0 -157
- package/dist/run-attempt-CY9WlDLc.js +0 -12413
- package/dist/runtime-artifact-CmtG_t1L.js +0 -554
- package/dist/session-binding-BXpo9ymA.js +0 -2214
- package/dist/session-catalog-DyOgR4WH.js +0 -2668
- package/dist/session-cli-2PZaFLRh.js +0 -175
- package/dist/session-upstream-marker-B6U7tLw5.js +0 -82
- package/dist/settled-turn-finalizer-CXY2Z9dT.js +0 -316
- package/dist/shared-client-DTbvH-XV.js +0 -3069
- package/dist/thread-lifecycle-DF53ogiA.js +0 -3987
- package/dist/transport-stdio-DXgGZ7Ib.js +0 -88
- package/dist/upstream-session-fork-Dy4Xvuoj.js +0 -320
- package/dist/usage-CQ6GhD5-.js +0 -25
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { r as isJsonObject } from "./protocol-2POPqAY4.mjs";
|
|
2
|
+
import { _ as shouldAutoApproveCodexAppServerApprovals, d as resolveCodexAppServerRuntimeOptions, g as resolveOpenClawExecPolicyForCodexAppServer, m as resolveCodexModelBackedReviewerPolicyContext, n as canUseCodexModelBackedApprovalsReviewerForModel, u as readCodexPluginConfig } from "./config-CYEDnLJ2.mjs";
|
|
3
|
+
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-dZQ-UTOa.mjs";
|
|
4
|
+
import { C as filterCodexDynamicTools, E as resolveCodexDynamicToolsLoading, H as mergeCodexThreadConfigs, d as resolveCodexAppServerModelProvider, f as resolveCodexAppServerRequestModelSelection, h as resolveReasoningEffort, m as resolveCodexBindingModelProviderFallback, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, v as resolveCodexWebSearchPlan, z as buildCodexPluginAppsConfigPatchFromPolicyContext } from "./thread-lifecycle-u6CZdOOH.mjs";
|
|
5
|
+
import { a as readCodexSupportedReasoningEfforts, c as formatCodexUsageLimitErrorMessage } from "./provider-DGxDs6g8.mjs";
|
|
6
|
+
import { a as getLeasedSharedCodexAppServerClient, d as isCodexAppServerApprovalRequest, h as readRecentCodexRateLimits, o as releaseLeasedSharedCodexAppServerClient, p as ensureCodexAppServerClientRuntime } from "./shared-client-B2KmLPRw.mjs";
|
|
7
|
+
import { i as isCodexAppServerNativeAuthProfile, s as sessionBindingIdentity } from "./session-binding-DuihlMJc.mjs";
|
|
8
|
+
import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-C_qTMEMy.mjs";
|
|
9
|
+
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-DA2TQfZW.mjs";
|
|
10
|
+
import { n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-iYs4WieS.mjs";
|
|
11
|
+
import { D as emitDynamicToolStartedDiagnostic, E as emitDynamicToolErrorDiagnostic, I as resolveCodexMessageToolProvider, O as emitDynamicToolTerminalDiagnostic, R as shouldEnableCodexAppServerNativeToolSurface, T as createCodexDynamicToolBridge, U as handleCodexAppServerApprovalRequest, V as filterToolsForVisionInputs, Z as handleDynamicToolCallWithTimeout, _ as buildCodexNativeHookRelayDisabledConfig, g as buildCodexNativeHookRelayConfig, i as CodexNativeToolLifecycleProjector, m as CODEX_NATIVE_HOOK_RELAY_EVENTS, n as resolveCodexProviderWebSearchSupportForClient, st as resolveCodexToolAbortTerminalReason, tt as resolveDynamicToolCallTimeoutMs, w as handleCodexAppServerElicitationRequest, y as emitCodexNativePreToolUseFailureDiagnostic } from "./provider-capabilities-DS2N_zc1.mjs";
|
|
11
12
|
import { randomUUID } from "node:crypto";
|
|
12
13
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
14
|
+
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
13
15
|
//#region extensions/codex/src/app-server/side-question.ts
|
|
14
16
|
const SIDE_QUESTION_COMPLETION_TIMEOUT_MS = 6e5;
|
|
15
17
|
var CodexSideQuestionTimeoutError = class extends Error {
|
|
@@ -18,8 +20,8 @@ var CodexSideQuestionTimeoutError = class extends Error {
|
|
|
18
20
|
this.name = "TimeoutError";
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
|
-
const CODEX_SIDE_NATIVE_HOOK_RELAY_MIN_TTL_MS =
|
|
22
|
-
const CODEX_SIDE_NATIVE_HOOK_RELAY_TTL_GRACE_MS =
|
|
23
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_MIN_TTL_MS = 18e5;
|
|
24
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_TTL_GRACE_MS = 3e5;
|
|
23
25
|
const CODEX_SIDE_NATIVE_HOOK_RELAY_STARTUP_REQUEST_COUNT = 3;
|
|
24
26
|
const CODEX_SIDE_NATIVE_HOOK_RELAY_EVENTS_WITH_APP_SERVER_APPROVALS = CODEX_NATIVE_HOOK_RELAY_EVENTS.filter((event) => event !== "permission_request");
|
|
25
27
|
const SIDE_BOUNDARY_PROMPT = `Side conversation boundary.
|
|
@@ -65,28 +67,10 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
65
67
|
config: params.cfg,
|
|
66
68
|
agentId: sessionAgentId
|
|
67
69
|
});
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const preparedRuntimeAuth = params.preparedRuntimeAuth;
|
|
71
|
-
const { authProfileId, nativeAuthProfile: preparedNativeAuthProfile, preparedAuth: startupPreparedAuth } = usesSupervisionConnection ? {
|
|
72
|
-
authProfileId: void 0,
|
|
73
|
-
nativeAuthProfile: true,
|
|
74
|
-
preparedAuth: void 0
|
|
75
|
-
} : await resolveCodexAppServerPreparedAuthHandoff({
|
|
76
|
-
authRequirement: preparedRuntimeAuth.plan.modelRoute?.authRequirement,
|
|
77
|
-
resolvedApiKey: preparedRuntimeAuth.resolvedApiKey,
|
|
78
|
-
authProfileId: preparedRuntimeAuth.plan.forwardedAuthProfileId,
|
|
79
|
-
authProfileStore: preparedRuntimeAuth.authProfileStore,
|
|
80
|
-
agentDir: params.agentDir,
|
|
81
|
-
homeScope: resolveCodexAppServerHomeScope({ appServer: pluginConfig.appServer }),
|
|
82
|
-
config: params.cfg,
|
|
83
|
-
subscriptionProfileRequiredError: "Prepared Codex subscription route requires a scoped native OAuth or token profile.",
|
|
84
|
-
subscriptionProfileUnusableError: `Prepared Codex auth profile "${preparedRuntimeAuth.plan.forwardedAuthProfileId}" is unusable.`
|
|
85
|
-
});
|
|
86
|
-
const modelProvider = supervisionModelSelection ? supervisionModelSelection.modelProvider : resolveCodexAppServerModelProvider({
|
|
70
|
+
const authProfileId = params.authProfileId ?? binding.authProfileId;
|
|
71
|
+
const modelProvider = resolveCodexAppServerModelProvider({
|
|
87
72
|
provider: params.provider,
|
|
88
73
|
authProfileId,
|
|
89
|
-
authProfileStore: preparedRuntimeAuth.authProfileStore,
|
|
90
74
|
agentDir: params.agentDir,
|
|
91
75
|
config: params.cfg
|
|
92
76
|
}) ?? resolveCodexBindingModelProviderFallback({
|
|
@@ -96,23 +80,24 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
96
80
|
bindingModelProvider: binding.modelProvider
|
|
97
81
|
});
|
|
98
82
|
const modelSelection = resolveCodexAppServerRequestModelSelection({
|
|
99
|
-
model:
|
|
83
|
+
model: params.model,
|
|
100
84
|
modelProvider,
|
|
101
85
|
authProfileId,
|
|
102
|
-
authProfileStore: preparedRuntimeAuth.authProfileStore,
|
|
103
86
|
agentDir: params.agentDir,
|
|
104
87
|
config: params.cfg
|
|
105
88
|
});
|
|
106
89
|
const reviewerPolicyContext = resolveCodexModelBackedReviewerPolicyContext({
|
|
107
|
-
provider:
|
|
108
|
-
model:
|
|
90
|
+
provider: params.provider,
|
|
91
|
+
model: params.model,
|
|
109
92
|
bindingModelProvider: binding.modelProvider,
|
|
110
93
|
bindingModel: binding.model,
|
|
111
|
-
nativeAuthProfile:
|
|
94
|
+
nativeAuthProfile: isCodexAppServerNativeAuthProfile({
|
|
95
|
+
authProfileId,
|
|
96
|
+
agentDir: params.agentDir,
|
|
97
|
+
config: params.cfg
|
|
98
|
+
})
|
|
112
99
|
});
|
|
113
|
-
const
|
|
114
|
-
binding,
|
|
115
|
-
authProfileId,
|
|
100
|
+
const appServer = resolveCodexAppServerRuntimeOptions({
|
|
116
101
|
pluginConfig,
|
|
117
102
|
execPolicy,
|
|
118
103
|
modelProvider: reviewerPolicyContext.modelProvider,
|
|
@@ -120,29 +105,9 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
120
105
|
config: params.cfg,
|
|
121
106
|
agentDir: params.agentDir
|
|
122
107
|
});
|
|
123
|
-
const appServer = connection.appServer;
|
|
124
108
|
const cwd = binding.cwd || params.workspaceDir || process.cwd();
|
|
125
109
|
const runId = params.opts?.runId ?? randomUUID();
|
|
126
|
-
const
|
|
127
|
-
...params,
|
|
128
|
-
provider: supervisionModelSelection.modelProvider,
|
|
129
|
-
model: supervisionModelSelection.model,
|
|
130
|
-
runtimeModel: {
|
|
131
|
-
id: supervisionModelSelection.model,
|
|
132
|
-
name: supervisionModelSelection.model,
|
|
133
|
-
provider: supervisionModelSelection.modelProvider,
|
|
134
|
-
api: "openai-chatgpt-responses",
|
|
135
|
-
reasoning: true,
|
|
136
|
-
input: ["text", "image"],
|
|
137
|
-
cost: {
|
|
138
|
-
input: 0,
|
|
139
|
-
output: 0,
|
|
140
|
-
cacheRead: 0,
|
|
141
|
-
cacheWrite: 0
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
} : params;
|
|
145
|
-
const sideRunParams = buildSideRunAttemptParams(effectiveParams, {
|
|
110
|
+
const sideRunParams = buildSideRunAttemptParams(params, {
|
|
146
111
|
cwd,
|
|
147
112
|
authProfileId,
|
|
148
113
|
runId
|
|
@@ -156,17 +121,13 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
156
121
|
if (nativeExecutionBlock) throw new Error(nativeExecutionBlock);
|
|
157
122
|
const nativeToolSurfaceEnabled = shouldEnableCodexAppServerNativeToolSurface(sideRunParams);
|
|
158
123
|
if (!nativeToolSurfaceEnabled) throw new Error("Codex-native /btw side-question mode is unavailable because the effective tool policy restricts Codex native tools for this session.");
|
|
159
|
-
const
|
|
124
|
+
const client = await getLeasedSharedCodexAppServerClient({
|
|
160
125
|
startOptions: appServer.start,
|
|
161
126
|
timeoutMs: appServer.requestTimeoutMs,
|
|
162
|
-
|
|
163
|
-
...startupPreparedAuth ? { preparedAuth: startupPreparedAuth } : { authProfileId: connection.clientAuthProfileId },
|
|
127
|
+
authProfileId,
|
|
164
128
|
agentDir: params.agentDir,
|
|
165
|
-
config: params.cfg
|
|
166
|
-
|
|
167
|
-
};
|
|
168
|
-
let client = await getLeasedSharedCodexAppServerClient(clientOptions);
|
|
169
|
-
const clientLease = { client };
|
|
129
|
+
config: params.cfg
|
|
130
|
+
});
|
|
170
131
|
const collector = new CodexSideQuestionCollector(params, () => readRecentCodexRateLimits(client));
|
|
171
132
|
const runAbortController = new AbortController();
|
|
172
133
|
let nativeToolLifecycleProjector;
|
|
@@ -196,7 +157,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
196
157
|
}
|
|
197
158
|
flushPendingNativePreToolUseFailures();
|
|
198
159
|
};
|
|
199
|
-
const
|
|
160
|
+
const removeNotificationHandler = client.addNotificationHandler((notification) => {
|
|
200
161
|
collector.handleNotification(notification);
|
|
201
162
|
if (notification.method !== "item/started" && notification.method !== "item/completed" && notification.method !== "rawResponseItem/completed" && notification.method !== "turn/completed") return;
|
|
202
163
|
if (!nativeToolLifecycleProjector) {
|
|
@@ -204,8 +165,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
204
165
|
return;
|
|
205
166
|
}
|
|
206
167
|
nativeToolLifecycleProjector.handleNotification(notification);
|
|
207
|
-
};
|
|
208
|
-
let removeNotificationHandler = client.addNotificationHandler(handleNotification);
|
|
168
|
+
});
|
|
209
169
|
const abortFromUpstream = () => runAbortController.abort(params.opts?.abortSignal?.reason ?? "codex_side_question_abort");
|
|
210
170
|
if (params.opts?.abortSignal?.aborted) abortFromUpstream();
|
|
211
171
|
else params.opts?.abortSignal?.addEventListener("abort", abortFromUpstream, { once: true });
|
|
@@ -213,7 +173,6 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
213
173
|
let turnId;
|
|
214
174
|
let removeRequestHandler;
|
|
215
175
|
let nativeHookRelay;
|
|
216
|
-
const activeDynamicToolCalls = /* @__PURE__ */ new Set();
|
|
217
176
|
try {
|
|
218
177
|
const modelScopedAppServer = resolveCodexAppServerForModelProvider({
|
|
219
178
|
appServer,
|
|
@@ -233,7 +192,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
233
192
|
const approvalPolicy = useModelScopedPolicy ? modelScopedAppServer.approvalPolicy : binding.approvalPolicy ?? modelScopedAppServer.approvalPolicy;
|
|
234
193
|
const sandbox = useModelScopedPolicy ? modelScopedAppServer.sandbox : binding.sandbox ?? modelScopedAppServer.sandbox;
|
|
235
194
|
const { toolBridge, webSearchPlan } = await createCodexSideToolBridge({
|
|
236
|
-
params
|
|
195
|
+
params,
|
|
237
196
|
cwd,
|
|
238
197
|
pluginConfig,
|
|
239
198
|
sessionAgentId,
|
|
@@ -252,14 +211,10 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
252
211
|
});
|
|
253
212
|
ensureCodexAppServerClientRuntime(client, {
|
|
254
213
|
agentDir: params.agentDir,
|
|
255
|
-
authProfileId
|
|
256
|
-
...!usesSupervisionConnection ? {
|
|
257
|
-
authProfileStore: preparedRuntimeAuth.authProfileStore,
|
|
258
|
-
authMode: startupPreparedAuth?.kind === "api-key" ? "prepared-api-key" : "profile"
|
|
259
|
-
} : {},
|
|
214
|
+
authProfileId,
|
|
260
215
|
config: params.cfg
|
|
261
216
|
});
|
|
262
|
-
|
|
217
|
+
removeRequestHandler = client.addRequestHandler(async (request) => {
|
|
263
218
|
if (!childThreadId || !turnId) return;
|
|
264
219
|
if (request.method === "mcpServer/elicitation/request") return handleCodexAppServerElicitationRequest({
|
|
265
220
|
requestParams: request.params,
|
|
@@ -277,6 +232,9 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
277
232
|
threadId: childThreadId,
|
|
278
233
|
turnId,
|
|
279
234
|
nativeHookRelay,
|
|
235
|
+
execPolicy,
|
|
236
|
+
execReviewerAgentId: sessionAgentId,
|
|
237
|
+
internalExecAutoReview: modelScopedAppServer.approvalsReviewer === "user",
|
|
280
238
|
autoApprove: shouldAutoApproveCodexAppServerApprovals({
|
|
281
239
|
approvalPolicy,
|
|
282
240
|
networkProxy: modelScopedAppServer.networkProxy,
|
|
@@ -301,16 +259,13 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
301
259
|
sessionKey: params.sessionKey
|
|
302
260
|
};
|
|
303
261
|
emitDynamicToolStartedDiagnostic(diagnosticContext);
|
|
304
|
-
const toolCall = handleDynamicToolCallWithTimeout({
|
|
305
|
-
call,
|
|
306
|
-
toolBridge,
|
|
307
|
-
signal: runAbortController.signal,
|
|
308
|
-
timeoutMs,
|
|
309
|
-
observeToolTerminal: sideRunParams.observeToolTerminal
|
|
310
|
-
});
|
|
311
|
-
activeDynamicToolCalls.add(toolCall);
|
|
312
262
|
try {
|
|
313
|
-
const response = await
|
|
263
|
+
const response = await handleDynamicToolCallWithTimeout({
|
|
264
|
+
call,
|
|
265
|
+
toolBridge,
|
|
266
|
+
signal: runAbortController.signal,
|
|
267
|
+
timeoutMs
|
|
268
|
+
});
|
|
314
269
|
emitDynamicToolTerminalDiagnostic({
|
|
315
270
|
...diagnosticContext,
|
|
316
271
|
response,
|
|
@@ -327,23 +282,8 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
327
282
|
terminalReason: runAbortController.signal.aborted ? resolveCodexToolAbortTerminalReason(runAbortController.signal) : "failed"
|
|
328
283
|
});
|
|
329
284
|
throw error;
|
|
330
|
-
} finally {
|
|
331
|
-
activeDynamicToolCalls.delete(toolCall);
|
|
332
285
|
}
|
|
333
286
|
});
|
|
334
|
-
removeRequestHandler = registerRequestHandler(client);
|
|
335
|
-
const rebindClientHandlers = (nextClient) => {
|
|
336
|
-
removeRequestHandler?.();
|
|
337
|
-
removeNotificationHandler();
|
|
338
|
-
client = nextClient;
|
|
339
|
-
ensureCodexAppServerClientRuntime(client, {
|
|
340
|
-
agentDir: params.agentDir,
|
|
341
|
-
authProfileId: connection.requestAuthProfileId,
|
|
342
|
-
config: params.cfg
|
|
343
|
-
});
|
|
344
|
-
removeNotificationHandler = client.addNotificationHandler(handleNotification);
|
|
345
|
-
removeRequestHandler = registerRequestHandler(client);
|
|
346
|
-
};
|
|
347
287
|
const serviceTier = binding.serviceTier ?? appServer.serviceTier;
|
|
348
288
|
const nativeHookRelayEvents = resolveCodexSideNativeHookRelayEvents({
|
|
349
289
|
configuredEvents: options.nativeHookRelay?.events,
|
|
@@ -365,7 +305,6 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
365
305
|
}).channelId,
|
|
366
306
|
requestTimeoutMs: appServer.requestTimeoutMs,
|
|
367
307
|
completionTimeoutMs: Math.max(appServer.turnCompletionIdleTimeoutMs, SIDE_QUESTION_COMPLETION_TIMEOUT_MS),
|
|
368
|
-
loopDetectionPreToolUseRelay: appServer.loopDetectionPreToolUseRelay,
|
|
369
308
|
signal: runAbortController.signal,
|
|
370
309
|
onPreToolUseFailure: (failure) => {
|
|
371
310
|
if (nativePreToolUseFailureFallbackActive) emitNativePreToolUseFailure(failure);
|
|
@@ -377,36 +316,32 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
377
316
|
relay: nativeHookRelay,
|
|
378
317
|
events: nativeHookRelayEvents,
|
|
379
318
|
hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec,
|
|
380
|
-
clearOmittedEvents: true
|
|
381
|
-
loopDetectionPreToolUseRelay: appServer.loopDetectionPreToolUseRelay
|
|
319
|
+
clearOmittedEvents: true
|
|
382
320
|
}) : options.nativeHookRelay?.enabled === false ? buildCodexNativeHookRelayDisabledConfig() : void 0;
|
|
383
321
|
const runtimeThreadConfig = buildCodexRuntimeThreadConfig(webSearchPlan.threadConfig, {
|
|
384
322
|
nativeCodeModeEnabled: nativeToolSurfaceEnabled,
|
|
385
323
|
nativeCodeModeOnlyEnabled: appServer.codeModeOnly
|
|
386
324
|
});
|
|
387
|
-
const
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}));
|
|
408
|
-
childThreadId = forkResponse.thread.id;
|
|
409
|
-
if (supervisionModelSelection && (forkResponse.model !== supervisionModelSelection.model || forkResponse.modelProvider !== supervisionModelSelection.modelProvider)) throw new Error("Codex supervised side thread did not preserve its native model and provider");
|
|
325
|
+
const pluginAppsConfigPatch = binding.pluginAppPolicyContext ? buildCodexPluginAppsConfigPatchFromPolicyContext(binding.pluginAppPolicyContext) : void 0;
|
|
326
|
+
const threadConfig = mergeCodexThreadConfigs(nativeHookRelayConfig, runtimeThreadConfig, pluginAppsConfigPatch, modelScopedAppServer.networkProxy?.configPatch) ?? runtimeThreadConfig;
|
|
327
|
+
childThreadId = assertCodexThreadForkResponse(await forkCodexSideThread(client, {
|
|
328
|
+
threadId: binding.threadId,
|
|
329
|
+
model: modelSelection.model,
|
|
330
|
+
...modelSelection.modelProvider ? { modelProvider: modelSelection.modelProvider } : {},
|
|
331
|
+
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
332
|
+
cwd,
|
|
333
|
+
approvalPolicy,
|
|
334
|
+
approvalsReviewer: modelScopedAppServer.approvalsReviewer,
|
|
335
|
+
...modelScopedAppServer.networkProxy ? {} : { sandbox },
|
|
336
|
+
...serviceTier ? { serviceTier } : {},
|
|
337
|
+
config: threadConfig,
|
|
338
|
+
developerInstructions: SIDE_DEVELOPER_INSTRUCTIONS,
|
|
339
|
+
ephemeral: true,
|
|
340
|
+
threadSource: "user"
|
|
341
|
+
}, {
|
|
342
|
+
timeoutMs: appServer.requestTimeoutMs,
|
|
343
|
+
signal: params.opts?.abortSignal
|
|
344
|
+
})).thread.id;
|
|
410
345
|
await client.request("thread/inject_items", {
|
|
411
346
|
threadId: childThreadId,
|
|
412
347
|
items: [sideBoundaryPromptItem()]
|
|
@@ -414,7 +349,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
414
349
|
timeoutMs: appServer.requestTimeoutMs,
|
|
415
350
|
signal: params.opts?.abortSignal
|
|
416
351
|
});
|
|
417
|
-
const effort =
|
|
352
|
+
const effort = resolveReasoningEffort(params.resolvedThinkLevel ?? "off", modelSelection.model, readCodexSupportedReasoningEfforts(params.runtimeModel?.compat));
|
|
418
353
|
turnId = assertCodexTurnStartResponse(await client.request("turn/start", {
|
|
419
354
|
threadId: childThreadId,
|
|
420
355
|
input: [{
|
|
@@ -424,17 +359,15 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
424
359
|
}],
|
|
425
360
|
cwd,
|
|
426
361
|
model: modelSelection.model,
|
|
427
|
-
|
|
362
|
+
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
428
363
|
...serviceTier ? { serviceTier } : {},
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
developer_instructions: null
|
|
437
|
-
}
|
|
364
|
+
effort,
|
|
365
|
+
collaborationMode: {
|
|
366
|
+
mode: "default",
|
|
367
|
+
settings: {
|
|
368
|
+
model: modelSelection.model,
|
|
369
|
+
reasoning_effort: effort,
|
|
370
|
+
developer_instructions: null
|
|
438
371
|
}
|
|
439
372
|
}
|
|
440
373
|
}, {
|
|
@@ -470,7 +403,6 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
470
403
|
params.opts?.abortSignal?.removeEventListener("abort", abortFromUpstream);
|
|
471
404
|
removeRequestHandler?.();
|
|
472
405
|
if (!runAbortController.signal.aborted) runAbortController.abort("codex_side_question_finished");
|
|
473
|
-
await Promise.allSettled(activeDynamicToolCalls);
|
|
474
406
|
try {
|
|
475
407
|
await cleanupCodexSideThread(client, {
|
|
476
408
|
threadId: childThreadId,
|
|
@@ -488,7 +420,7 @@ async function runCodexAppServerSideQuestion(params, options) {
|
|
|
488
420
|
}
|
|
489
421
|
} finally {
|
|
490
422
|
flushPendingNativePreToolUseFailures();
|
|
491
|
-
|
|
423
|
+
releaseLeasedSharedCodexAppServerClient(client);
|
|
492
424
|
nativeHookRelay?.unregister();
|
|
493
425
|
}
|
|
494
426
|
}
|
|
@@ -508,7 +440,6 @@ function registerCodexSideNativeHookRelay(params) {
|
|
|
508
440
|
runId: params.runId,
|
|
509
441
|
...params.channelId ? { channelId: params.channelId } : {},
|
|
510
442
|
allowedEvents: params.events,
|
|
511
|
-
preToolUseLoopDetection: params.loopDetectionPreToolUseRelay,
|
|
512
443
|
ttlMs: resolveCodexSideNativeHookRelayTtlMs({
|
|
513
444
|
explicitTtlMs: params.options.ttlMs,
|
|
514
445
|
requestTimeoutMs: params.requestTimeoutMs,
|
|
@@ -542,12 +473,9 @@ function buildSideRunAttemptParams(params, options) {
|
|
|
542
473
|
agentId: params.agentId,
|
|
543
474
|
...params.messageChannel ? { messageChannel: params.messageChannel } : {},
|
|
544
475
|
...params.messageProvider ? { messageProvider: params.messageProvider } : {},
|
|
545
|
-
...params.chatType ? { chatType: params.chatType } : {},
|
|
546
476
|
...params.agentAccountId ? { agentAccountId: params.agentAccountId } : {},
|
|
547
477
|
...params.messageTo ? { messageTo: params.messageTo } : {},
|
|
548
478
|
...params.messageThreadId !== void 0 ? { messageThreadId: params.messageThreadId } : {},
|
|
549
|
-
...params.chatId ? { chatId: params.chatId } : {},
|
|
550
|
-
...params.messageActionTurnCapability ? { messageActionTurnCapability: params.messageActionTurnCapability } : {},
|
|
551
479
|
...params.groupId !== void 0 ? { groupId: params.groupId } : {},
|
|
552
480
|
...params.groupChannel !== void 0 ? { groupChannel: params.groupChannel } : {},
|
|
553
481
|
...params.groupSpace !== void 0 ? { groupSpace: params.groupSpace } : {},
|
|
@@ -562,13 +490,12 @@ function buildSideRunAttemptParams(params, options) {
|
|
|
562
490
|
...params.toolsAllow ? { toolsAllow: params.toolsAllow } : {},
|
|
563
491
|
workspaceDir: options.cwd,
|
|
564
492
|
authProfileId: options.authProfileId,
|
|
565
|
-
authProfileIdSource:
|
|
493
|
+
authProfileIdSource: params.authProfileIdSource,
|
|
566
494
|
thinkLevel: params.resolvedThinkLevel ?? "off",
|
|
567
495
|
resolvedReasoningLevel: params.resolvedReasoningLevel,
|
|
568
|
-
authStorage:
|
|
569
|
-
authProfileStore:
|
|
570
|
-
modelRegistry:
|
|
571
|
-
...params.preparedRuntimeAuth.resolvedApiKey ? { resolvedApiKey: params.preparedRuntimeAuth.resolvedApiKey } : {},
|
|
496
|
+
authStorage: void 0,
|
|
497
|
+
authProfileStore: void 0,
|
|
498
|
+
modelRegistry: void 0,
|
|
572
499
|
runId: options.runId,
|
|
573
500
|
abortSignal: params.opts?.abortSignal,
|
|
574
501
|
onAgentEvent: (event) => {
|
|
@@ -593,7 +520,7 @@ async function createCodexSideToolBridge(input) {
|
|
|
593
520
|
sessionKey: sandboxSessionKey,
|
|
594
521
|
workspaceDir: input.cwd
|
|
595
522
|
});
|
|
596
|
-
|
|
523
|
+
const allTools = createOpenClawCodingTools({
|
|
597
524
|
agentId: input.sessionAgentId,
|
|
598
525
|
sessionKey: sandboxSessionKey,
|
|
599
526
|
runSessionKey: input.params.sessionKey && input.params.sessionKey !== sandboxSessionKey ? input.params.sessionKey : void 0,
|
|
@@ -618,12 +545,9 @@ async function createCodexSideToolBridge(input) {
|
|
|
618
545
|
messageProvider: messageToolProvider,
|
|
619
546
|
toolPolicyMessageProvider: input.params.messageProvider ?? input.params.messageChannel
|
|
620
547
|
} : {},
|
|
621
|
-
...input.params.chatType ? { chatType: input.params.chatType } : {},
|
|
622
548
|
...input.params.agentAccountId ? { agentAccountId: input.params.agentAccountId } : {},
|
|
623
549
|
...input.params.messageTo ? { messageTo: input.params.messageTo } : {},
|
|
624
550
|
...input.params.messageThreadId !== void 0 ? { messageThreadId: input.params.messageThreadId } : {},
|
|
625
|
-
...input.params.chatId ? { nativeChannelId: input.params.chatId } : {},
|
|
626
|
-
...input.params.messageActionTurnCapability ? { messageActionTurnCapability: input.params.messageActionTurnCapability } : {},
|
|
627
551
|
...input.params.groupId !== void 0 ? { groupId: input.params.groupId } : {},
|
|
628
552
|
...input.params.groupChannel !== void 0 ? { groupChannel: input.params.groupChannel } : {},
|
|
629
553
|
...input.params.groupSpace !== void 0 ? { groupSpace: input.params.groupSpace } : {},
|
|
@@ -645,7 +569,9 @@ async function createCodexSideToolBridge(input) {
|
|
|
645
569
|
emitBeforeToolCallDiagnostics: false,
|
|
646
570
|
modelHasVision: runtimeModel.input?.includes("image") ?? false,
|
|
647
571
|
requireExplicitMessageTarget: true
|
|
648
|
-
})
|
|
572
|
+
});
|
|
573
|
+
const codexFilteredTools = filterCodexDynamicTools(allTools, input.pluginConfig);
|
|
574
|
+
tools = filterToolsForVisionInputs(codexFilteredTools, {
|
|
649
575
|
modelHasVision: runtimeModel.input?.includes("image") ?? false,
|
|
650
576
|
hasInboundImages: false
|
|
651
577
|
});
|
|
@@ -660,7 +586,7 @@ async function createCodexSideToolBridge(input) {
|
|
|
660
586
|
config: input.params.cfg,
|
|
661
587
|
webSearchAllowed: false
|
|
662
588
|
}) : requestedWebSearchPlan;
|
|
663
|
-
const exposedTools = tools.filter((tool) => tool.name !== "web_search"
|
|
589
|
+
const exposedTools = tools.filter((tool) => tool.name !== "web_search");
|
|
664
590
|
const hookChannelFields = buildAgentHookContextChannelFields({
|
|
665
591
|
sessionKey: input.params.sessionKey,
|
|
666
592
|
messageChannel: input.params.messageChannel,
|
|
@@ -675,7 +601,6 @@ async function createCodexSideToolBridge(input) {
|
|
|
675
601
|
hookContext: {
|
|
676
602
|
agentId: input.sessionAgentId,
|
|
677
603
|
config: input.params.cfg,
|
|
678
|
-
contextWindowTokens: runtimeModel.contextWindow,
|
|
679
604
|
sessionId: input.params.sessionId,
|
|
680
605
|
sessionKey: input.params.sessionKey,
|
|
681
606
|
runId: input.runId,
|