@openclaw/codex 2026.6.8-beta.2 → 2026.6.9-beta.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/{notification-correlation-BGoG0N90.js → app-server-policy-KpyUye2D.js} +15 -74
- package/dist/attempt-notifications-Meja3TX6.js +249 -0
- package/dist/{client-factory-C71Xdb6z.js → client-factory-CPuoOOx6.js} +3 -2
- package/dist/{client-DovmVtbr.js → client-m7XiCQpO.js} +24 -2
- package/dist/{command-handlers-DHecBkuc.js → command-handlers-CqS0Kv3Z.js} +17 -13
- package/dist/{compact-GEKusemL.js → compact-CMVlldii.js} +5 -5
- package/dist/{computer-use-D1qxvTE_.js → computer-use-qLm7Gf35.js} +3 -3
- package/dist/{config-DJXpBkGf.js → config-BksX0T33.js} +160 -20
- package/dist/{conversation-binding-CbnMilVW.js → conversation-binding-DBof5w9J.js} +166 -58
- package/dist/doctor-contract-api.js +37 -3
- package/dist/harness.js +6 -6
- package/dist/index.js +108 -27
- package/dist/media-understanding-provider-CiwPkR58.js +463 -0
- package/dist/media-understanding-provider.js +1 -355
- package/dist/{models-DRKnOpzF.js → models-BsyV1Psm.js} +2 -2
- package/dist/{plugin-app-cache-key-kIqpGTQj.js → plugin-app-cache-key-CN9zBiCG.js} +17 -6
- package/dist/{protocol-oeJQu4rs.js → protocol-dh-ETiNd.js} +4 -1
- package/dist/{protocol-validators-B48C6S9O.js → protocol-validators-B19q5BIX.js} +210 -16
- package/dist/{native-hook-relay-C3i3FYtc.js → provider-capabilities-BOvTfMhF.js} +803 -78
- package/dist/{provider-C5P6352f.js → provider-qJygHQx4.js} +4 -4
- package/dist/provider.js +1 -1
- package/dist/{request-BxZ40QKY.js → request-DTIEyUrA.js} +2 -2
- package/dist/{run-attempt-D_q-VrpR.js → run-attempt-DRhB6bTc.js} +421 -774
- package/dist/{sandbox-guard-C-Yv9uwY.js → sandbox-guard-3tnjhjFb.js} +37 -10
- package/dist/{session-binding-ElbcSq2o.js → session-binding-BRUi8y6E.js} +27 -8
- package/dist/{shared-client-jFMumCOe.js → shared-client-Bg5d7VV9.js} +4 -4
- package/dist/{side-question-DqKLfWMB.js → side-question-BdYL4kj1.js} +106 -42
- package/dist/{thread-lifecycle-cban34w3.js → thread-lifecycle-CbJqqnEw.js} +912 -616
- package/dist/web-search-contract-api.js +10 -0
- package/dist/web-search-provider.runtime-DrpQ8Cyd.js +74 -0
- package/dist/web-search-provider.shared-BrZmlqyR.js +32 -0
- package/npm-shrinkwrap.json +2 -2
- package/openclaw.plugin.json +129 -4
- package/package.json +13 -5
|
@@ -10,18 +10,27 @@ const TRAILING_DASH_PATTERN = /-+$/;
|
|
|
10
10
|
function resolveCodexNativeExecutionPolicy(params) {
|
|
11
11
|
const config = params.config ?? {};
|
|
12
12
|
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim() || void 0;
|
|
13
|
-
const
|
|
13
|
+
const agentId = resolvePolicyAgentId({
|
|
14
|
+
config,
|
|
15
|
+
sessionKey,
|
|
16
|
+
agentId: params.agentId
|
|
17
|
+
});
|
|
18
|
+
const canReadSessionEntry = params.readRuntimeSessionEntry && shouldReadRuntimeSessionEntry({
|
|
19
|
+
config,
|
|
20
|
+
sessionKey,
|
|
21
|
+
agentId: params.agentId
|
|
22
|
+
});
|
|
23
|
+
const sessionEntry = params.sessionEntry ?? (canReadSessionEntry && sessionKey ? readRuntimeSessionEntryBestEffort({
|
|
24
|
+
sessionKey,
|
|
25
|
+
agentId
|
|
26
|
+
}) : void 0);
|
|
14
27
|
const sandboxAvailable = params.sandboxAvailable ?? (sessionKey ? resolveSandboxRuntimeStatus({
|
|
15
28
|
cfg: config,
|
|
16
29
|
sessionKey
|
|
17
30
|
}).sandboxed : false);
|
|
18
31
|
const agentExec = resolvePolicyAgentExec({
|
|
19
32
|
config,
|
|
20
|
-
agentId
|
|
21
|
-
config,
|
|
22
|
-
sessionKey,
|
|
23
|
-
agentId: params.agentId
|
|
24
|
-
})
|
|
33
|
+
agentId
|
|
25
34
|
});
|
|
26
35
|
const globalExec = config.tools?.exec;
|
|
27
36
|
const requestedExecHost = normalizeExecTarget(params.execOverrides?.host) ?? normalizeExecTarget(sessionEntry?.execHost) ?? normalizeExecTarget(agentExec?.host) ?? normalizeExecTarget(globalExec?.host) ?? "auto";
|
|
@@ -57,8 +66,7 @@ function resolvePolicyAgentId(params) {
|
|
|
57
66
|
if (explicitAgentId) return explicitAgentId;
|
|
58
67
|
const sessionAgentId = parseAgentIdFromSessionKey(params.sessionKey);
|
|
59
68
|
if (sessionAgentId) return sessionAgentId;
|
|
60
|
-
|
|
61
|
-
return normalizeAgentId((agents.find((entry) => entry?.default) ?? agents[0])?.id);
|
|
69
|
+
return resolveDefaultPolicyAgentId(listAgentEntries(params.config));
|
|
62
70
|
}
|
|
63
71
|
function resolvePolicyAgentExec(params) {
|
|
64
72
|
return listAgentEntries(params.config).find((entry) => normalizeAgentId(entry?.id) === params.agentId)?.tools?.exec;
|
|
@@ -73,6 +81,23 @@ function parseAgentIdFromSessionKey(sessionKey) {
|
|
|
73
81
|
if (parts.length < 3 || parts[0] !== "agent" || !parts[2]) return;
|
|
74
82
|
return normalizeAgentIdOrDefault(parts[1]);
|
|
75
83
|
}
|
|
84
|
+
function shouldReadRuntimeSessionEntry(params) {
|
|
85
|
+
if (!params.sessionKey) return false;
|
|
86
|
+
const explicitAgentId = normalizeAgentIdOrDefault(params.agentId);
|
|
87
|
+
if (!explicitAgentId) return true;
|
|
88
|
+
const sessionAgentId = parseAgentIdFromSessionKey(params.sessionKey);
|
|
89
|
+
if (!sessionAgentId) return isDefaultAgentSessionKeyForAgent({
|
|
90
|
+
config: params.config,
|
|
91
|
+
agentId: explicitAgentId
|
|
92
|
+
});
|
|
93
|
+
return sessionAgentId === explicitAgentId;
|
|
94
|
+
}
|
|
95
|
+
function isDefaultAgentSessionKeyForAgent(params) {
|
|
96
|
+
return normalizeAgentId(params.agentId) === resolveDefaultPolicyAgentId(listAgentEntries(params.config));
|
|
97
|
+
}
|
|
98
|
+
function resolveDefaultPolicyAgentId(agents) {
|
|
99
|
+
return normalizeAgentId((agents.find((entry) => entry?.default) ?? agents[0])?.id);
|
|
100
|
+
}
|
|
76
101
|
function normalizeAgentIdOrDefault(value) {
|
|
77
102
|
const normalized = normalizeAgentId(value);
|
|
78
103
|
return normalized === DEFAULT_AGENT_ID && !(value ?? "").trim() ? void 0 : normalized;
|
|
@@ -92,10 +117,11 @@ function resolveEffectiveExecHost(params) {
|
|
|
92
117
|
if (params.requestedExecHost === "auto") return params.sandboxAvailable ? "sandbox" : "gateway";
|
|
93
118
|
return params.requestedExecHost;
|
|
94
119
|
}
|
|
95
|
-
function readRuntimeSessionEntryBestEffort(
|
|
120
|
+
function readRuntimeSessionEntryBestEffort(params) {
|
|
96
121
|
try {
|
|
97
122
|
return getSessionEntry({
|
|
98
|
-
sessionKey,
|
|
123
|
+
sessionKey: params.sessionKey,
|
|
124
|
+
agentId: params.agentId,
|
|
99
125
|
hydrateSkillPromptRefs: false
|
|
100
126
|
});
|
|
101
127
|
} catch {
|
|
@@ -229,6 +255,7 @@ function resolveCodexNativeNodeExecBlock(params) {
|
|
|
229
255
|
const policy = resolveCodexNativeExecutionPolicy({
|
|
230
256
|
config: params.config,
|
|
231
257
|
sessionKey,
|
|
258
|
+
agentId: params.agentId,
|
|
232
259
|
readRuntimeSessionEntry: Boolean(sessionKey)
|
|
233
260
|
});
|
|
234
261
|
if (policy.nativeToolSurfaceAllowed) return;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { l as normalizeCodexServiceTier } from "./config-
|
|
2
|
+
import { l as normalizeCodexServiceTier } from "./config-BksX0T33.js";
|
|
3
|
+
import fs from "node:fs/promises";
|
|
3
4
|
import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
|
|
4
5
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
5
|
-
import fs from "node:fs/promises";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
8
8
|
//#region extensions/codex/src/app-server/session-binding.ts
|
|
@@ -78,10 +78,11 @@ async function readCodexAppServerBinding(sessionFile, lookup = {}) {
|
|
|
78
78
|
}
|
|
79
79
|
try {
|
|
80
80
|
const parsed = JSON.parse(raw);
|
|
81
|
-
|
|
81
|
+
const schemaVersion = parsed.schemaVersion === 1 || parsed.schemaVersion === 2 ? parsed.schemaVersion : void 0;
|
|
82
|
+
if (schemaVersion === void 0 || typeof parsed.threadId !== "string") return;
|
|
82
83
|
const authProfileId = typeof parsed.authProfileId === "string" ? parsed.authProfileId : void 0;
|
|
83
84
|
return {
|
|
84
|
-
schemaVersion:
|
|
85
|
+
schemaVersion: 2,
|
|
85
86
|
threadId: parsed.threadId,
|
|
86
87
|
sessionFile,
|
|
87
88
|
cwd: typeof parsed.cwd === "string" ? parsed.cwd : "",
|
|
@@ -95,14 +96,18 @@ async function readCodexAppServerBinding(sessionFile, lookup = {}) {
|
|
|
95
96
|
approvalPolicy: readApprovalPolicy(parsed.approvalPolicy),
|
|
96
97
|
sandbox: readSandboxMode(parsed.sandbox),
|
|
97
98
|
serviceTier: readServiceTier(parsed.serviceTier),
|
|
99
|
+
networkProxyProfileName: typeof parsed.networkProxyProfileName === "string" ? parsed.networkProxyProfileName : void 0,
|
|
100
|
+
networkProxyConfigFingerprint: typeof parsed.networkProxyConfigFingerprint === "string" ? parsed.networkProxyConfigFingerprint : void 0,
|
|
98
101
|
dynamicToolsFingerprint: typeof parsed.dynamicToolsFingerprint === "string" ? parsed.dynamicToolsFingerprint : void 0,
|
|
99
102
|
dynamicToolsContainDeferred: typeof parsed.dynamicToolsContainDeferred === "boolean" ? parsed.dynamicToolsContainDeferred : void 0,
|
|
103
|
+
webSearchThreadConfigFingerprint: typeof parsed.webSearchThreadConfigFingerprint === "string" ? parsed.webSearchThreadConfigFingerprint : void 0,
|
|
100
104
|
userMcpServersFingerprint: typeof parsed.userMcpServersFingerprint === "string" ? parsed.userMcpServersFingerprint : void 0,
|
|
101
105
|
mcpServersFingerprint: typeof parsed.mcpServersFingerprint === "string" ? parsed.mcpServersFingerprint : void 0,
|
|
102
106
|
nativeHookRelayGeneration: typeof parsed.nativeHookRelayGeneration === "string" && parsed.nativeHookRelayGeneration.trim() ? parsed.nativeHookRelayGeneration : void 0,
|
|
107
|
+
appServerRuntimeFingerprint: typeof parsed.appServerRuntimeFingerprint === "string" && parsed.appServerRuntimeFingerprint.trim() ? parsed.appServerRuntimeFingerprint : void 0,
|
|
103
108
|
pluginAppsFingerprint: typeof parsed.pluginAppsFingerprint === "string" ? parsed.pluginAppsFingerprint : void 0,
|
|
104
109
|
pluginAppsInputFingerprint: typeof parsed.pluginAppsInputFingerprint === "string" ? parsed.pluginAppsInputFingerprint : void 0,
|
|
105
|
-
pluginAppPolicyContext: readPluginAppPolicyContext(parsed.pluginAppPolicyContext),
|
|
110
|
+
pluginAppPolicyContext: readPluginAppPolicyContext(parsed.pluginAppPolicyContext, schemaVersion),
|
|
106
111
|
contextEngine: readContextEngineBinding(parsed.contextEngine),
|
|
107
112
|
environmentSelectionFingerprint: typeof parsed.environmentSelectionFingerprint === "string" ? parsed.environmentSelectionFingerprint : void 0,
|
|
108
113
|
createdAt: typeof parsed.createdAt === "string" ? parsed.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -121,7 +126,7 @@ async function writeCodexAppServerBinding(sessionFile, binding, lookup = {}) {
|
|
|
121
126
|
await withCodexAppServerBindingLock(sessionFile, async () => {
|
|
122
127
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
123
128
|
const payload = {
|
|
124
|
-
schemaVersion:
|
|
129
|
+
schemaVersion: 2,
|
|
125
130
|
sessionFile,
|
|
126
131
|
threadId: binding.threadId,
|
|
127
132
|
cwd: binding.cwd,
|
|
@@ -135,11 +140,15 @@ async function writeCodexAppServerBinding(sessionFile, binding, lookup = {}) {
|
|
|
135
140
|
approvalPolicy: binding.approvalPolicy,
|
|
136
141
|
sandbox: binding.sandbox,
|
|
137
142
|
serviceTier: binding.serviceTier,
|
|
143
|
+
networkProxyProfileName: binding.networkProxyProfileName,
|
|
144
|
+
networkProxyConfigFingerprint: binding.networkProxyConfigFingerprint,
|
|
138
145
|
dynamicToolsFingerprint: binding.dynamicToolsFingerprint,
|
|
139
146
|
dynamicToolsContainDeferred: binding.dynamicToolsContainDeferred,
|
|
147
|
+
webSearchThreadConfigFingerprint: binding.webSearchThreadConfigFingerprint,
|
|
140
148
|
userMcpServersFingerprint: binding.userMcpServersFingerprint,
|
|
141
149
|
mcpServersFingerprint: binding.mcpServersFingerprint,
|
|
142
150
|
nativeHookRelayGeneration: binding.nativeHookRelayGeneration,
|
|
151
|
+
appServerRuntimeFingerprint: binding.appServerRuntimeFingerprint,
|
|
143
152
|
pluginAppsFingerprint: binding.pluginAppsFingerprint,
|
|
144
153
|
pluginAppsInputFingerprint: binding.pluginAppsInputFingerprint,
|
|
145
154
|
pluginAppPolicyContext: binding.pluginAppPolicyContext,
|
|
@@ -173,7 +182,7 @@ function readContextEngineProjectionBinding(value) {
|
|
|
173
182
|
fingerprint: typeof record.fingerprint === "string" ? record.fingerprint : void 0
|
|
174
183
|
};
|
|
175
184
|
}
|
|
176
|
-
function readPluginAppPolicyContext(value) {
|
|
185
|
+
function readPluginAppPolicyContext(value, bindingSchemaVersion) {
|
|
177
186
|
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
178
187
|
const record = value;
|
|
179
188
|
if (typeof record.fingerprint !== "string") return;
|
|
@@ -183,12 +192,14 @@ function readPluginAppPolicyContext(value) {
|
|
|
183
192
|
for (const [appId, rawEntry] of Object.entries(apps)) {
|
|
184
193
|
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) return;
|
|
185
194
|
const entry = rawEntry;
|
|
186
|
-
|
|
195
|
+
const destructiveApprovalMode = readDestructiveApprovalMode(entry.destructiveApprovalMode, bindingSchemaVersion);
|
|
196
|
+
if ("appId" in entry || typeof entry.configKey !== "string" || entry.marketplaceName !== "openai-curated" || typeof entry.pluginName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || destructiveApprovalMode === "invalid" || !Array.isArray(entry.mcpServerNames) || entry.mcpServerNames.some((serverName) => typeof serverName !== "string")) return;
|
|
187
197
|
parsedApps[appId] = {
|
|
188
198
|
configKey: entry.configKey,
|
|
189
199
|
marketplaceName: entry.marketplaceName,
|
|
190
200
|
pluginName: entry.pluginName,
|
|
191
201
|
allowDestructiveActions: entry.allowDestructiveActions,
|
|
202
|
+
...destructiveApprovalMode ? { destructiveApprovalMode } : {},
|
|
192
203
|
mcpServerNames: entry.mcpServerNames
|
|
193
204
|
};
|
|
194
205
|
}
|
|
@@ -205,6 +216,14 @@ function readPluginAppPolicyContext(value) {
|
|
|
205
216
|
pluginAppIds: parsedPluginAppIds
|
|
206
217
|
};
|
|
207
218
|
}
|
|
219
|
+
function readDestructiveApprovalMode(value, bindingSchemaVersion) {
|
|
220
|
+
if (value === void 0) return;
|
|
221
|
+
if (value === "deny") return "deny";
|
|
222
|
+
if (value === "allow") return "allow";
|
|
223
|
+
if (value === "auto") return bindingSchemaVersion === 1 ? "allow" : "auto";
|
|
224
|
+
if (value === "on-request" && bindingSchemaVersion === 1) return "auto";
|
|
225
|
+
return "invalid";
|
|
226
|
+
}
|
|
208
227
|
/** Removes the Codex app-server binding sidecar if present. */
|
|
209
228
|
async function clearCodexAppServerBinding(sessionFile, _lookup = {}) {
|
|
210
229
|
if (!await codexAppServerBindingSidecarExists(sessionFile)) return;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { d as resolveCodexAppServerRuntimeOptions, r as codexAppServerStartOptionsKey } from "./config-
|
|
3
|
-
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-
|
|
2
|
+
import { d as resolveCodexAppServerRuntimeOptions, r as codexAppServerStartOptionsKey } from "./config-BksX0T33.js";
|
|
3
|
+
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-m7XiCQpO.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
+
import fs, { access } from "node:fs/promises";
|
|
6
|
+
import path from "node:path";
|
|
5
7
|
import { createHash } from "node:crypto";
|
|
6
8
|
import fsSync, { constants, readFileSync } from "node:fs";
|
|
7
9
|
import os from "node:os";
|
|
8
|
-
import path from "node:path";
|
|
9
10
|
import { ensureAuthProfileStore, findPersistedAuthProfileCredential, loadAuthProfileStoreForSecretsRuntime, refreshOAuthCredentialForRuntime, resolveApiKeyForProfile, resolveAuthProfileOrder, resolveDefaultAgentDir, resolvePersistedAuthProfileOwnerAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
|
|
10
|
-
import fs, { access } from "node:fs/promises";
|
|
11
11
|
import { isDeepStrictEqual } from "node:util";
|
|
12
12
|
import { hasUsableOAuthCredential } from "openclaw/plugin-sdk/provider-auth";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i as
|
|
5
|
-
import { i as
|
|
6
|
-
import {
|
|
7
|
-
import { i as isCodexAppServerNativeAuthProfile, o as readCodexAppServerBinding } from "./session-binding-
|
|
8
|
-
import {
|
|
9
|
-
import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, u as refreshCodexAppServerAuthTokens } from "./shared-client-
|
|
10
|
-
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-
|
|
11
|
-
import {
|
|
1
|
+
import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
|
|
2
|
+
import { B as readCodexNotificationThreadId, M as mergeCodexThreadConfigs, S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, V as readCodexNotificationTurnId, _ as resolveCodexWebSearchPlan, d as resolveCodexAppServerRequestModelSelection, m as resolveReasoningEffort, p as resolveCodexBindingModelProviderFallback, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-CbJqqnEw.js";
|
|
3
|
+
import { d as resolveCodexAppServerRuntimeOptions, g as shouldAutoApproveCodexAppServerApprovals, h as resolveOpenClawExecPolicyForCodexAppServer, n as canUseCodexModelBackedApprovalsReviewerForModel, p as resolveCodexModelBackedReviewerPolicyContext, u as readCodexPluginConfig } from "./config-BksX0T33.js";
|
|
4
|
+
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-B19q5BIX.js";
|
|
5
|
+
import { i as formatCodexUsageLimitErrorMessage } from "./provider-qJygHQx4.js";
|
|
6
|
+
import { i as isCodexAppServerApprovalRequest } from "./client-m7XiCQpO.js";
|
|
7
|
+
import { i as isCodexAppServerNativeAuthProfile, o as readCodexAppServerBinding } from "./session-binding-BRUi8y6E.js";
|
|
8
|
+
import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-KpyUye2D.js";
|
|
9
|
+
import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, u as refreshCodexAppServerAuthTokens } from "./shared-client-Bg5d7VV9.js";
|
|
10
|
+
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-3tnjhjFb.js";
|
|
11
|
+
import { C as resolveCodexMessageToolProvider, O as filterToolsForVisionInputs, T as shouldEnableCodexAppServerNativeToolSurface, a as buildCodexNativeHookRelayConfig, d as handleCodexAppServerElicitationRequest, f as createCodexDynamicToolBridge, h as emitDynamicToolTerminalDiagnostic, k as handleCodexAppServerApprovalRequest, m as emitDynamicToolStartedDiagnostic, n as resolveCodexProviderWebSearchSupportForClient, o as buildCodexNativeHookRelayDisabledConfig, p as emitDynamicToolErrorDiagnostic, r as CODEX_NATIVE_HOOK_RELAY_EVENTS } from "./provider-capabilities-BOvTfMhF.js";
|
|
12
12
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-C7qmZ0Jh.js";
|
|
13
13
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
14
14
|
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -52,13 +52,6 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
52
52
|
config: params.cfg
|
|
53
53
|
});
|
|
54
54
|
if (!binding?.threadId) throw new Error("Codex /btw needs an active Codex thread. Send a normal message first, then try /btw again.");
|
|
55
|
-
const nativeExecutionBlock = resolveCodexNativeExecutionBlock({
|
|
56
|
-
config: params.cfg,
|
|
57
|
-
sessionKey: params.sessionKey,
|
|
58
|
-
sessionId: params.sessionId,
|
|
59
|
-
surface: "/btw side-question mode"
|
|
60
|
-
});
|
|
61
|
-
if (nativeExecutionBlock) throw new Error(nativeExecutionBlock);
|
|
62
55
|
const pluginConfig = readCodexPluginConfig(options.pluginConfig);
|
|
63
56
|
const { sessionAgentId } = resolveSessionAgentIds({
|
|
64
57
|
sessionKey: params.sessionKey,
|
|
@@ -108,6 +101,20 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
108
101
|
config: params.cfg,
|
|
109
102
|
agentDir: params.agentDir
|
|
110
103
|
});
|
|
104
|
+
const cwd = binding.cwd || params.workspaceDir || process.cwd();
|
|
105
|
+
const sideRunParams = buildSideRunAttemptParams(params, {
|
|
106
|
+
cwd,
|
|
107
|
+
authProfileId
|
|
108
|
+
});
|
|
109
|
+
const nativeExecutionBlock = resolveCodexNativeExecutionBlock({
|
|
110
|
+
config: sideRunParams.config,
|
|
111
|
+
sessionKey: sideRunParams.sandboxSessionKey?.trim() || sideRunParams.sessionKey,
|
|
112
|
+
sessionId: sideRunParams.sessionId,
|
|
113
|
+
surface: "/btw side-question mode"
|
|
114
|
+
});
|
|
115
|
+
if (nativeExecutionBlock) throw new Error(nativeExecutionBlock);
|
|
116
|
+
const nativeToolSurfaceEnabled = shouldEnableCodexAppServerNativeToolSurface(sideRunParams);
|
|
117
|
+
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.");
|
|
111
118
|
const client = await getLeasedSharedCodexAppServerClient({
|
|
112
119
|
startOptions: appServer.start,
|
|
113
120
|
timeoutMs: appServer.requestTimeoutMs,
|
|
@@ -126,11 +133,6 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
126
133
|
let removeRequestHandler;
|
|
127
134
|
let nativeHookRelay;
|
|
128
135
|
try {
|
|
129
|
-
const cwd = binding.cwd || params.workspaceDir || process.cwd();
|
|
130
|
-
const sideRunParams = buildSideRunAttemptParams(params, {
|
|
131
|
-
cwd,
|
|
132
|
-
authProfileId
|
|
133
|
-
});
|
|
134
136
|
const modelScopedAppServer = resolveCodexAppServerForModelProvider({
|
|
135
137
|
appServer,
|
|
136
138
|
provider: reviewerPolicyContext.modelProvider,
|
|
@@ -148,11 +150,21 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
148
150
|
});
|
|
149
151
|
const approvalPolicy = useModelScopedPolicy ? modelScopedAppServer.approvalPolicy : binding.approvalPolicy ?? modelScopedAppServer.approvalPolicy;
|
|
150
152
|
const sandbox = useModelScopedPolicy ? modelScopedAppServer.sandbox : binding.sandbox ?? modelScopedAppServer.sandbox;
|
|
151
|
-
const toolBridge = await createCodexSideToolBridge({
|
|
153
|
+
const { toolBridge, webSearchPlan } = await createCodexSideToolBridge({
|
|
152
154
|
params,
|
|
153
155
|
cwd,
|
|
154
156
|
pluginConfig,
|
|
155
157
|
sessionAgentId,
|
|
158
|
+
nativeToolSurfaceEnabled,
|
|
159
|
+
nativeProviderWebSearchSupport: resolveCodexWebSearchPlan({
|
|
160
|
+
config: params.cfg,
|
|
161
|
+
nativeToolSurfaceEnabled
|
|
162
|
+
}).kind === "native-hosted" ? await resolveCodexProviderWebSearchSupportForClient({
|
|
163
|
+
client,
|
|
164
|
+
timeoutMs: appServer.requestTimeoutMs,
|
|
165
|
+
modelProviderOverride: modelSelection.modelProvider,
|
|
166
|
+
signal: runAbortController.signal
|
|
167
|
+
}) : "unsupported",
|
|
156
168
|
signal: runAbortController.signal
|
|
157
169
|
});
|
|
158
170
|
removeRequestHandler = client.addRequestHandler(async (request) => {
|
|
@@ -183,6 +195,7 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
183
195
|
internalExecAutoReview: modelScopedAppServer.approvalsReviewer === "user",
|
|
184
196
|
autoApprove: shouldAutoApproveCodexAppServerApprovals({
|
|
185
197
|
approvalPolicy,
|
|
198
|
+
networkProxy: modelScopedAppServer.networkProxy,
|
|
186
199
|
sandbox
|
|
187
200
|
}),
|
|
188
201
|
signal: runAbortController.signal
|
|
@@ -255,8 +268,11 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
255
268
|
hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec,
|
|
256
269
|
clearOmittedEvents: true
|
|
257
270
|
}) : options.nativeHookRelay?.enabled === false ? buildCodexNativeHookRelayDisabledConfig() : void 0;
|
|
258
|
-
const runtimeThreadConfig = buildCodexRuntimeThreadConfig(
|
|
259
|
-
|
|
271
|
+
const runtimeThreadConfig = buildCodexRuntimeThreadConfig(webSearchPlan.threadConfig, {
|
|
272
|
+
nativeCodeModeEnabled: nativeToolSurfaceEnabled,
|
|
273
|
+
nativeCodeModeOnlyEnabled: appServer.codeModeOnly
|
|
274
|
+
});
|
|
275
|
+
const threadConfig = mergeCodexThreadConfigs(nativeHookRelayConfig, runtimeThreadConfig, modelScopedAppServer.networkProxy?.configPatch) ?? runtimeThreadConfig;
|
|
260
276
|
childThreadId = assertCodexThreadForkResponse(await forkCodexSideThread(client, {
|
|
261
277
|
threadId: binding.threadId,
|
|
262
278
|
model: modelSelection.model,
|
|
@@ -265,7 +281,7 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
265
281
|
cwd,
|
|
266
282
|
approvalPolicy,
|
|
267
283
|
approvalsReviewer: modelScopedAppServer.approvalsReviewer,
|
|
268
|
-
sandbox,
|
|
284
|
+
...modelScopedAppServer.networkProxy ? {} : { sandbox },
|
|
269
285
|
...serviceTier ? { serviceTier } : {},
|
|
270
286
|
config: threadConfig,
|
|
271
287
|
developerInstructions: SIDE_DEVELOPER_INSTRUCTIONS,
|
|
@@ -375,10 +391,25 @@ function buildSideRunAttemptParams(params, options) {
|
|
|
375
391
|
sessionId: params.sessionId,
|
|
376
392
|
sessionFile: params.sessionFile,
|
|
377
393
|
sessionKey: params.sessionKey,
|
|
394
|
+
...params.sandboxSessionKey ? { sandboxSessionKey: params.sandboxSessionKey } : {},
|
|
378
395
|
agentId: params.agentId,
|
|
379
396
|
...params.messageChannel ? { messageChannel: params.messageChannel } : {},
|
|
380
397
|
...params.messageProvider ? { messageProvider: params.messageProvider } : {},
|
|
398
|
+
...params.agentAccountId ? { agentAccountId: params.agentAccountId } : {},
|
|
399
|
+
...params.messageTo ? { messageTo: params.messageTo } : {},
|
|
400
|
+
...params.messageThreadId !== void 0 ? { messageThreadId: params.messageThreadId } : {},
|
|
401
|
+
...params.groupId !== void 0 ? { groupId: params.groupId } : {},
|
|
402
|
+
...params.groupChannel !== void 0 ? { groupChannel: params.groupChannel } : {},
|
|
403
|
+
...params.groupSpace !== void 0 ? { groupSpace: params.groupSpace } : {},
|
|
404
|
+
...params.memberRoleIds ? { memberRoleIds: params.memberRoleIds } : {},
|
|
405
|
+
...params.spawnedBy !== void 0 ? { spawnedBy: params.spawnedBy } : {},
|
|
406
|
+
...params.senderId !== void 0 ? { senderId: params.senderId } : {},
|
|
407
|
+
...params.senderName !== void 0 ? { senderName: params.senderName } : {},
|
|
408
|
+
...params.senderUsername !== void 0 ? { senderUsername: params.senderUsername } : {},
|
|
409
|
+
...params.senderE164 !== void 0 ? { senderE164: params.senderE164 } : {},
|
|
410
|
+
...params.senderIsOwner !== void 0 ? { senderIsOwner: params.senderIsOwner } : {},
|
|
381
411
|
...params.currentChannelId ? { currentChannelId: params.currentChannelId } : {},
|
|
412
|
+
...params.toolsAllow ? { toolsAllow: params.toolsAllow } : {},
|
|
382
413
|
workspaceDir: options.cwd,
|
|
383
414
|
authProfileId: options.authProfileId,
|
|
384
415
|
authProfileIdSource: params.authProfileIdSource,
|
|
@@ -401,10 +432,11 @@ async function createCodexSideToolBridge(input) {
|
|
|
401
432
|
id: input.params.model,
|
|
402
433
|
provider: input.params.provider
|
|
403
434
|
};
|
|
435
|
+
const messageToolProvider = resolveCodexMessageToolProvider(input.params);
|
|
404
436
|
let tools = [];
|
|
405
437
|
if (supportsModelTools(runtimeModel)) {
|
|
406
438
|
const createOpenClawCodingTools = (await import("openclaw/plugin-sdk/agent-harness")).createOpenClawCodingTools;
|
|
407
|
-
const sandboxSessionKey = input.params.sessionKey?.trim() || input.params.sessionId || input.sessionAgentId;
|
|
439
|
+
const sandboxSessionKey = input.params.sandboxSessionKey?.trim() || input.params.sessionKey?.trim() || input.params.sessionId || input.sessionAgentId;
|
|
408
440
|
const sandbox = await resolveSandboxContext({
|
|
409
441
|
config: input.params.cfg,
|
|
410
442
|
sessionKey: sandboxSessionKey,
|
|
@@ -430,7 +462,24 @@ async function createCodexSideToolBridge(input) {
|
|
|
430
462
|
modelApi: runtimeModel.api,
|
|
431
463
|
modelContextWindowTokens: runtimeModel.contextWindow,
|
|
432
464
|
modelAuthMode: resolveModelAuthMode(runtimeModel.provider, input.params.cfg, void 0, { workspaceDir: input.cwd }),
|
|
433
|
-
|
|
465
|
+
suppressManagedWebSearch: false,
|
|
466
|
+
...input.params.messageProvider || input.params.messageChannel ? {
|
|
467
|
+
messageProvider: messageToolProvider,
|
|
468
|
+
toolPolicyMessageProvider: input.params.messageProvider ?? input.params.messageChannel
|
|
469
|
+
} : {},
|
|
470
|
+
...input.params.agentAccountId ? { agentAccountId: input.params.agentAccountId } : {},
|
|
471
|
+
...input.params.messageTo ? { messageTo: input.params.messageTo } : {},
|
|
472
|
+
...input.params.messageThreadId !== void 0 ? { messageThreadId: input.params.messageThreadId } : {},
|
|
473
|
+
...input.params.groupId !== void 0 ? { groupId: input.params.groupId } : {},
|
|
474
|
+
...input.params.groupChannel !== void 0 ? { groupChannel: input.params.groupChannel } : {},
|
|
475
|
+
...input.params.groupSpace !== void 0 ? { groupSpace: input.params.groupSpace } : {},
|
|
476
|
+
...input.params.memberRoleIds ? { memberRoleIds: input.params.memberRoleIds } : {},
|
|
477
|
+
...input.params.spawnedBy !== void 0 ? { spawnedBy: input.params.spawnedBy } : {},
|
|
478
|
+
...input.params.senderId !== void 0 ? { senderId: input.params.senderId } : {},
|
|
479
|
+
...input.params.senderName !== void 0 ? { senderName: input.params.senderName } : {},
|
|
480
|
+
...input.params.senderUsername !== void 0 ? { senderUsername: input.params.senderUsername } : {},
|
|
481
|
+
...input.params.senderE164 !== void 0 ? { senderE164: input.params.senderE164 } : {},
|
|
482
|
+
...input.params.senderIsOwner !== void 0 ? { senderIsOwner: input.params.senderIsOwner } : {},
|
|
434
483
|
...input.params.currentChannelId ? { currentChannelId: input.params.currentChannelId } : {},
|
|
435
484
|
hookChannelId: buildAgentHookContextChannelFields({
|
|
436
485
|
sessionKey: input.params.sessionKey,
|
|
@@ -447,25 +496,40 @@ async function createCodexSideToolBridge(input) {
|
|
|
447
496
|
hasInboundImages: false
|
|
448
497
|
});
|
|
449
498
|
}
|
|
499
|
+
const requestedWebSearchPlan = resolveCodexWebSearchPlan({
|
|
500
|
+
config: input.params.cfg,
|
|
501
|
+
nativeToolSurfaceEnabled: input.nativeToolSurfaceEnabled,
|
|
502
|
+
nativeProviderWebSearchSupport: input.nativeProviderWebSearchSupport,
|
|
503
|
+
webSearchAllowed: tools.some((tool) => tool.name === "web_search")
|
|
504
|
+
});
|
|
505
|
+
const webSearchPlan = requestedWebSearchPlan.kind === "managed" ? resolveCodexWebSearchPlan({
|
|
506
|
+
config: input.params.cfg,
|
|
507
|
+
webSearchAllowed: false
|
|
508
|
+
}) : requestedWebSearchPlan;
|
|
509
|
+
const exposedTools = tools.filter((tool) => tool.name !== "web_search");
|
|
450
510
|
const hookChannelFields = buildAgentHookContextChannelFields({
|
|
451
511
|
sessionKey: input.params.sessionKey,
|
|
452
512
|
messageChannel: input.params.messageChannel,
|
|
453
513
|
messageProvider: input.params.messageProvider,
|
|
454
514
|
currentChannelId: input.params.currentChannelId
|
|
455
515
|
});
|
|
456
|
-
return
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
516
|
+
return {
|
|
517
|
+
toolBridge: createCodexDynamicToolBridge({
|
|
518
|
+
tools: exposedTools,
|
|
519
|
+
signal: input.signal,
|
|
520
|
+
loading: resolveCodexDynamicToolsLoading(input.pluginConfig),
|
|
521
|
+
hookContext: {
|
|
522
|
+
agentId: input.sessionAgentId,
|
|
523
|
+
config: input.params.cfg,
|
|
524
|
+
sessionId: input.params.sessionId,
|
|
525
|
+
sessionKey: input.params.sessionKey,
|
|
526
|
+
runId: input.params.opts?.runId ?? `codex-btw:${input.params.sessionId}`,
|
|
527
|
+
currentChannelProvider: messageToolProvider,
|
|
528
|
+
...hookChannelFields
|
|
529
|
+
}
|
|
530
|
+
}),
|
|
531
|
+
webSearchPlan
|
|
532
|
+
};
|
|
469
533
|
}
|
|
470
534
|
async function handleSideDynamicToolCallWithTimeout(params) {
|
|
471
535
|
if (params.signal.aborted) return failedSideDynamicToolResponse("OpenClaw dynamic tool call aborted before execution.");
|