@openclaw/codex 2026.5.26-beta.1 → 2026.5.26
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/client-factory-fW4Hh9q_.js +15 -0
- package/dist/{command-handlers-D4C2y46B.js → command-handlers-hYTtzAdy.js} +4 -4
- package/dist/{compact-CRI0BEc_.js → compact-C_1JAB4C.js} +24 -1
- package/dist/{computer-use-CDDlIBhY.js → computer-use-DSdj1hJY.js} +1 -1
- package/dist/{conversation-binding-BnnjOmgs.js → conversation-binding-OjYqDwhw.js} +110 -84
- package/dist/{dynamic-tools-BG9ICyU4.js → dynamic-tools-DlEefKNQ.js} +61 -20
- package/dist/harness.js +4 -4
- package/dist/index.js +7 -6
- package/dist/media-understanding-provider.js +5 -5
- package/dist/{models-ASKu9eOY.js → models-_XwpqjR8.js} +5 -4
- package/dist/{protocol-validators-CSuFMLvY.js → protocol-validators-DtjYmUw_.js} +50 -412
- package/dist/provider.js +1 -1
- package/dist/{request-DmBkYLPy.js → request-OaxhR46w.js} +4 -3
- package/dist/{run-attempt-CFBsGx1T.js → run-attempt-D8Vxo-Jm.js} +293 -131
- package/dist/{shared-client-Fou5nAyt.js → shared-client-8kIrP817.js} +103 -9
- package/dist/{side-question-fq_T2d_x.js → side-question-DU7en3_R.js} +8 -7
- package/dist/test-api.js +2 -2
- package/dist/{thread-lifecycle-BapIT9Qs.js → thread-lifecycle-CUXQezJL.js} +4 -3
- package/dist/{vision-tools-B30YCKRK.js → vision-tools-DqpLmF5H.js} +3 -1
- package/npm-shrinkwrap.json +30 -30
- package/package.json +5 -5
- package/dist/client-factory-CaOpX89B.js +0 -9
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
+
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-8kIrP817.js").then((n) => n.s).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
3
|
+
startOptions,
|
|
4
|
+
authProfileId,
|
|
5
|
+
agentDir,
|
|
6
|
+
config
|
|
7
|
+
}));
|
|
8
|
+
const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-8kIrP817.js").then((n) => n.s).then(({ getLeasedSharedCodexAppServerClient }) => getLeasedSharedCodexAppServerClient({
|
|
9
|
+
startOptions,
|
|
10
|
+
authProfileId,
|
|
11
|
+
agentDir,
|
|
12
|
+
config
|
|
13
|
+
}));
|
|
14
|
+
//#endregion
|
|
15
|
+
export { defaultLeasedCodexAppServerClientFactory as n, defaultCodexAppServerClientFactory as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { a as isCodexFastServiceTier, l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-_XwpqjR8.js";
|
|
3
3
|
import { l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
4
4
|
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-UFjjws4k.js";
|
|
5
|
-
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-
|
|
5
|
+
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-OaxhR46w.js";
|
|
6
6
|
import { _ as summarizeCodexAccountUsage, a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatThreads, l as formatComputerUseStatus, o as formatAccount, p as readString$1, s as formatCodexDisplayText, u as formatList } from "./notification-correlation-YINts3PA.js";
|
|
7
7
|
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
8
|
-
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-
|
|
9
|
-
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-
|
|
8
|
+
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-OjYqDwhw.js";
|
|
9
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-DSdj1hJY.js";
|
|
10
10
|
import { n as rememberCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
11
11
|
import crypto from "node:crypto";
|
|
12
12
|
import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as defaultCodexAppServerClientFactory } from "./client-factory-
|
|
1
|
+
import { t as defaultCodexAppServerClientFactory } from "./client-factory-fW4Hh9q_.js";
|
|
2
2
|
import { l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
3
3
|
import { i as readCodexAppServerBinding } from "./session-binding-UFjjws4k.js";
|
|
4
4
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
@@ -61,6 +61,29 @@ function readAgentIdFromSessionKey(sessionKey) {
|
|
|
61
61
|
return parts[1]?.trim() || void 0;
|
|
62
62
|
}
|
|
63
63
|
async function compactCodexNativeThread(params, options = {}) {
|
|
64
|
+
if (params.trigger !== "manual") {
|
|
65
|
+
embeddedAgentLog.info("skipping codex app-server compaction for non-manual trigger", {
|
|
66
|
+
sessionId: params.sessionId,
|
|
67
|
+
sessionKey: params.sessionKey,
|
|
68
|
+
trigger: params.trigger
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
ok: true,
|
|
72
|
+
compacted: false,
|
|
73
|
+
reason: "codex app-server owns automatic compaction",
|
|
74
|
+
result: {
|
|
75
|
+
summary: "",
|
|
76
|
+
firstKeptEntryId: "",
|
|
77
|
+
tokensBefore: params.currentTokenCount ?? 0,
|
|
78
|
+
details: {
|
|
79
|
+
backend: "codex-app-server",
|
|
80
|
+
skipped: true,
|
|
81
|
+
reason: "non_manual_trigger",
|
|
82
|
+
trigger: params.trigger ?? "unknown"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
64
87
|
const nativeExecutionBlock = resolveCodexNativeExecutionBlock({
|
|
65
88
|
config: params.config,
|
|
66
89
|
sessionKey: params.sandboxSessionKey ?? params.sessionKey,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as resolveCodexAppServerRuntimeOptions, u as resolveCodexComputerUseConfig } from "./config-0-UN67Qg.js";
|
|
2
|
-
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-
|
|
2
|
+
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-OaxhR46w.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
//#region extensions/codex/src/app-server/computer-use.ts
|
|
5
5
|
var CodexComputerUseSetupError = class extends Error {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as isCodexFastServiceTier, l as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-0-UN67Qg.js";
|
|
2
2
|
import { l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
3
|
-
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-
|
|
3
|
+
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-CUXQezJL.js";
|
|
4
4
|
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-UFjjws4k.js";
|
|
5
|
-
import { r as CODEX_CONTROL_METHODS } from "./request-
|
|
5
|
+
import { r as CODEX_CONTROL_METHODS } from "./request-OaxhR46w.js";
|
|
6
6
|
import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-YINts3PA.js";
|
|
7
|
-
import {
|
|
7
|
+
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-8kIrP817.js";
|
|
8
8
|
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
9
9
|
import os from "node:os";
|
|
10
10
|
import { asOptionalRecord, isRecord, normalizeSingleOrTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -98,15 +98,20 @@ async function stopCodexConversationTurn(params) {
|
|
|
98
98
|
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
|
|
99
99
|
const lookup = buildBindingLookup(params);
|
|
100
100
|
const binding = await readCodexAppServerBinding(params.sessionFile, lookup);
|
|
101
|
-
|
|
101
|
+
const client = await getLeasedSharedCodexAppServerClient({
|
|
102
102
|
startOptions: runtime.start,
|
|
103
103
|
timeoutMs: runtime.requestTimeoutMs,
|
|
104
104
|
authProfileId: binding?.authProfileId,
|
|
105
105
|
...lookup
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
});
|
|
107
|
+
try {
|
|
108
|
+
await client.request("turn/interrupt", {
|
|
109
|
+
threadId: active.threadId,
|
|
110
|
+
turnId: active.turnId
|
|
111
|
+
}, { timeoutMs: runtime.requestTimeoutMs });
|
|
112
|
+
} finally {
|
|
113
|
+
releaseLeasedSharedCodexAppServerClient(client);
|
|
114
|
+
}
|
|
110
115
|
return {
|
|
111
116
|
stopped: true,
|
|
112
117
|
message: "Codex stop requested."
|
|
@@ -126,20 +131,25 @@ async function steerCodexConversationTurn(params) {
|
|
|
126
131
|
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
|
|
127
132
|
const lookup = buildBindingLookup(params);
|
|
128
133
|
const binding = await readCodexAppServerBinding(params.sessionFile, lookup);
|
|
129
|
-
|
|
134
|
+
const client = await getLeasedSharedCodexAppServerClient({
|
|
130
135
|
startOptions: runtime.start,
|
|
131
136
|
timeoutMs: runtime.requestTimeoutMs,
|
|
132
137
|
authProfileId: binding?.authProfileId,
|
|
133
138
|
...lookup
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
});
|
|
140
|
+
try {
|
|
141
|
+
await client.request("turn/steer", {
|
|
142
|
+
threadId: active.threadId,
|
|
143
|
+
expectedTurnId: active.turnId,
|
|
144
|
+
input: [{
|
|
145
|
+
type: "text",
|
|
146
|
+
text,
|
|
147
|
+
text_elements: []
|
|
148
|
+
}]
|
|
149
|
+
}, { timeoutMs: runtime.requestTimeoutMs });
|
|
150
|
+
} finally {
|
|
151
|
+
releaseLeasedSharedCodexAppServerClient(client);
|
|
152
|
+
}
|
|
143
153
|
return {
|
|
144
154
|
steered: true,
|
|
145
155
|
message: "Sent steer message to Codex."
|
|
@@ -214,20 +224,25 @@ async function requireThreadBinding(sessionFile, lookup = {}) {
|
|
|
214
224
|
}
|
|
215
225
|
async function resumeThreadWithOverrides(params) {
|
|
216
226
|
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
|
|
217
|
-
|
|
227
|
+
const client = await getLeasedSharedCodexAppServerClient({
|
|
218
228
|
startOptions: runtime.start,
|
|
219
229
|
timeoutMs: runtime.requestTimeoutMs,
|
|
220
230
|
authProfileId: params.authProfileId,
|
|
221
231
|
...buildBindingLookup(params)
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
232
|
+
});
|
|
233
|
+
try {
|
|
234
|
+
return await client.request(CODEX_CONTROL_METHODS.resumeThread, {
|
|
235
|
+
threadId: params.threadId,
|
|
236
|
+
...params.model ? { model: params.model } : {},
|
|
237
|
+
approvalPolicy: params.approvalPolicy ?? runtime.approvalPolicy,
|
|
238
|
+
sandbox: params.sandbox ?? runtime.sandbox,
|
|
239
|
+
approvalsReviewer: runtime.approvalsReviewer,
|
|
240
|
+
...params.serviceTier ? { serviceTier: params.serviceTier } : {},
|
|
241
|
+
persistExtendedHistory: true
|
|
242
|
+
}, { timeoutMs: runtime.requestTimeoutMs });
|
|
243
|
+
} finally {
|
|
244
|
+
releaseLeasedSharedCodexAppServerClient(client);
|
|
245
|
+
}
|
|
231
246
|
}
|
|
232
247
|
function buildBindingLookup(params) {
|
|
233
248
|
const agentDir = params.agentDir?.trim();
|
|
@@ -1029,38 +1044,43 @@ async function attachExistingThread(params) {
|
|
|
1029
1044
|
modelProvider: params.modelProvider,
|
|
1030
1045
|
...agentLookup
|
|
1031
1046
|
});
|
|
1032
|
-
const
|
|
1047
|
+
const client = await getLeasedSharedCodexAppServerClient({
|
|
1033
1048
|
startOptions: runtime.start,
|
|
1034
1049
|
timeoutMs: runtime.requestTimeoutMs,
|
|
1035
1050
|
authProfileId: params.authProfileId,
|
|
1036
1051
|
...agentLookup
|
|
1037
|
-
})
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
1052
|
+
});
|
|
1053
|
+
try {
|
|
1054
|
+
const response = await client.request(CODEX_CONTROL_METHODS.resumeThread, {
|
|
1055
|
+
threadId: params.threadId,
|
|
1056
|
+
...params.model ? { model: params.model } : {},
|
|
1057
|
+
...modelProvider ? { modelProvider } : {},
|
|
1058
|
+
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
1059
|
+
approvalPolicy: params.approvalPolicy ?? runtime.approvalPolicy,
|
|
1060
|
+
approvalsReviewer: runtime.approvalsReviewer,
|
|
1061
|
+
sandbox: params.sandbox ?? runtime.sandbox,
|
|
1062
|
+
...params.serviceTier ?? runtime.serviceTier ? { serviceTier: params.serviceTier ?? runtime.serviceTier } : {},
|
|
1063
|
+
persistExtendedHistory: true
|
|
1064
|
+
}, { timeoutMs: runtime.requestTimeoutMs });
|
|
1065
|
+
const thread = response.thread;
|
|
1066
|
+
const runtimeApprovalPolicy = typeof runtime.approvalPolicy === "string" ? runtime.approvalPolicy : void 0;
|
|
1067
|
+
await writeCodexAppServerBinding(params.sessionFile, {
|
|
1068
|
+
threadId: thread.id,
|
|
1069
|
+
cwd: thread.cwd ?? params.workspaceDir,
|
|
1056
1070
|
authProfileId: params.authProfileId,
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1071
|
+
model: response.model ?? params.model,
|
|
1072
|
+
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
1073
|
+
authProfileId: params.authProfileId,
|
|
1074
|
+
modelProvider: response.modelProvider ?? params.modelProvider,
|
|
1075
|
+
...agentLookup
|
|
1076
|
+
}),
|
|
1077
|
+
approvalPolicy: params.approvalPolicy ?? runtimeApprovalPolicy,
|
|
1078
|
+
sandbox: params.sandbox ?? runtime.sandbox,
|
|
1079
|
+
serviceTier: params.serviceTier ?? runtime.serviceTier
|
|
1080
|
+
}, { ...agentLookup });
|
|
1081
|
+
} finally {
|
|
1082
|
+
releaseLeasedSharedCodexAppServerClient(client);
|
|
1083
|
+
}
|
|
1064
1084
|
}
|
|
1065
1085
|
async function createThread(params) {
|
|
1066
1086
|
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
|
|
@@ -1073,39 +1093,44 @@ async function createThread(params) {
|
|
|
1073
1093
|
modelProvider: params.modelProvider,
|
|
1074
1094
|
...agentLookup
|
|
1075
1095
|
});
|
|
1076
|
-
const
|
|
1096
|
+
const client = await getLeasedSharedCodexAppServerClient({
|
|
1077
1097
|
startOptions: runtime.start,
|
|
1078
1098
|
timeoutMs: runtime.requestTimeoutMs,
|
|
1079
1099
|
authProfileId: params.authProfileId,
|
|
1080
1100
|
...agentLookup
|
|
1081
|
-
})
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
1101
|
+
});
|
|
1102
|
+
try {
|
|
1103
|
+
const response = await client.request("thread/start", {
|
|
1104
|
+
cwd: params.workspaceDir,
|
|
1105
|
+
...params.model ? { model: params.model } : {},
|
|
1106
|
+
...modelProvider ? { modelProvider } : {},
|
|
1107
|
+
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
1108
|
+
approvalPolicy: params.approvalPolicy ?? runtime.approvalPolicy,
|
|
1109
|
+
approvalsReviewer: runtime.approvalsReviewer,
|
|
1110
|
+
sandbox: params.sandbox ?? runtime.sandbox,
|
|
1111
|
+
...params.serviceTier ?? runtime.serviceTier ? { serviceTier: params.serviceTier ?? runtime.serviceTier } : {},
|
|
1112
|
+
developerInstructions: "This Codex thread is bound to an OpenClaw conversation. Answer normally; OpenClaw will deliver your final response back to the conversation.",
|
|
1113
|
+
experimentalRawEvents: true,
|
|
1114
|
+
persistExtendedHistory: true
|
|
1115
|
+
}, { timeoutMs: runtime.requestTimeoutMs });
|
|
1116
|
+
const runtimeApprovalPolicy = typeof runtime.approvalPolicy === "string" ? runtime.approvalPolicy : void 0;
|
|
1117
|
+
await writeCodexAppServerBinding(params.sessionFile, {
|
|
1118
|
+
threadId: response.thread.id,
|
|
1119
|
+
cwd: response.thread.cwd ?? params.workspaceDir,
|
|
1101
1120
|
authProfileId: params.authProfileId,
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1121
|
+
model: response.model ?? params.model,
|
|
1122
|
+
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
1123
|
+
authProfileId: params.authProfileId,
|
|
1124
|
+
modelProvider: response.modelProvider ?? params.modelProvider,
|
|
1125
|
+
...agentLookup
|
|
1126
|
+
}),
|
|
1127
|
+
approvalPolicy: params.approvalPolicy ?? runtimeApprovalPolicy,
|
|
1128
|
+
sandbox: params.sandbox ?? runtime.sandbox,
|
|
1129
|
+
serviceTier: params.serviceTier ?? runtime.serviceTier
|
|
1130
|
+
}, { ...agentLookup });
|
|
1131
|
+
} finally {
|
|
1132
|
+
releaseLeasedSharedCodexAppServerClient(client);
|
|
1133
|
+
}
|
|
1109
1134
|
}
|
|
1110
1135
|
async function runBoundTurn(params) {
|
|
1111
1136
|
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
|
|
@@ -1113,7 +1138,7 @@ async function runBoundTurn(params) {
|
|
|
1113
1138
|
const binding = await readCodexAppServerBinding(params.data.sessionFile, agentLookup);
|
|
1114
1139
|
const threadId = binding?.threadId;
|
|
1115
1140
|
if (!threadId) throw new Error("bound Codex conversation has no thread binding");
|
|
1116
|
-
const client = await
|
|
1141
|
+
const client = await getLeasedSharedCodexAppServerClient({
|
|
1117
1142
|
startOptions: runtime.start,
|
|
1118
1143
|
timeoutMs: runtime.requestTimeoutMs,
|
|
1119
1144
|
authProfileId: binding.authProfileId,
|
|
@@ -1167,6 +1192,7 @@ async function runBoundTurn(params) {
|
|
|
1167
1192
|
} finally {
|
|
1168
1193
|
notificationCleanup();
|
|
1169
1194
|
requestCleanup();
|
|
1195
|
+
releaseLeasedSharedCodexAppServerClient(client);
|
|
1170
1196
|
}
|
|
1171
1197
|
}
|
|
1172
1198
|
async function runBoundTurnWithMissingThreadRecovery(params) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as sanitizeInlineImageDataUrl, w as invalidInlineImageText } from "./thread-lifecycle-
|
|
1
|
+
import { E as sanitizeInlineImageDataUrl, w as invalidInlineImageText } from "./thread-lifecycle-CUXQezJL.js";
|
|
2
2
|
import { asOptionalRecord, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
import { HEARTBEAT_RESPONSE_TOOL_NAME, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, extractToolResultMediaArtifact, filterToolResultMediaUrls, isMessagingTool, isMessagingToolSendAction, isToolWrappedWithBeforeToolCallHook, normalizeHeartbeatToolResponse, runAgentHarnessAfterToolCallHook, setBeforeToolCallDiagnosticsEnabled, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
3
|
+
import { HEARTBEAT_RESPONSE_TOOL_NAME, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractToolResultMediaArtifact, filterToolResultMediaUrls, isMessagingTool, isMessagingToolSendAction, isToolWrappedWithBeforeToolCallHook, normalizeHeartbeatToolResponse, projectRuntimeToolInputSchema, runAgentHarnessAfterToolCallHook, setBeforeToolCallDiagnosticsEnabled, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
4
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
5
5
|
//#region extensions/codex/src/app-server/dynamic-tool-profile.ts
|
|
6
6
|
const CODEX_APP_SERVER_OWNED_DYNAMIC_TOOL_EXCLUDES = [
|
|
@@ -47,16 +47,26 @@ const DEFAULT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS = 16e3;
|
|
|
47
47
|
function createCodexDynamicToolBridge(params) {
|
|
48
48
|
const toolResultHookContext = toToolResultHookContext(params.hookContext);
|
|
49
49
|
const toolResultMaxChars = resolveCodexDynamicToolResultMaxChars(params.hookContext);
|
|
50
|
-
const
|
|
50
|
+
const availableProjection = projectCodexDynamicTools(params.tools);
|
|
51
|
+
const registeredProjection = params.registeredTools ? projectCodexDynamicTools(params.registeredTools) : availableProjection;
|
|
52
|
+
const availableTools = availableProjection.tools.map(({ tool, inputSchema }) => {
|
|
51
53
|
if (isToolWrappedWithBeforeToolCallHook(tool)) {
|
|
52
54
|
setBeforeToolCallDiagnosticsEnabled(tool, false);
|
|
53
|
-
return
|
|
55
|
+
return {
|
|
56
|
+
tool,
|
|
57
|
+
inputSchema
|
|
58
|
+
};
|
|
54
59
|
}
|
|
55
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
tool: wrapToolWithBeforeToolCallHook(tool, params.hookContext, { emitDiagnostics: false }),
|
|
62
|
+
inputSchema
|
|
63
|
+
};
|
|
56
64
|
});
|
|
57
|
-
const toolMap = new Map(
|
|
58
|
-
const registeredTools =
|
|
65
|
+
const toolMap = new Map(availableTools.map(({ tool }) => [tool.name, tool]));
|
|
66
|
+
const registeredTools = registeredProjection.tools.map(({ tool }) => tool);
|
|
59
67
|
const registeredToolNames = new Set(registeredTools.map((tool) => tool.name));
|
|
68
|
+
const quarantinedTools = dedupeQuarantinedDynamicTools([...availableProjection.quarantinedTools, ...registeredProjection.quarantinedTools]);
|
|
69
|
+
warnQuarantinedDynamicTools(quarantinedTools);
|
|
60
70
|
const telemetry = {
|
|
61
71
|
didSendViaMessagingTool: false,
|
|
62
72
|
messagingToolSentTexts: [],
|
|
@@ -64,7 +74,8 @@ function createCodexDynamicToolBridge(params) {
|
|
|
64
74
|
messagingToolSentTargets: [],
|
|
65
75
|
messagingToolSourceReplyPayloads: [],
|
|
66
76
|
toolMediaUrls: [],
|
|
67
|
-
toolAudioAsVoice: false
|
|
77
|
+
toolAudioAsVoice: false,
|
|
78
|
+
quarantinedTools
|
|
68
79
|
};
|
|
69
80
|
const middlewareRunner = createAgentToolResultMiddlewareRunner({
|
|
70
81
|
runtime: "codex",
|
|
@@ -73,13 +84,15 @@ function createCodexDynamicToolBridge(params) {
|
|
|
73
84
|
const legacyExtensionRunner = createCodexAppServerToolResultExtensionRunner(toolResultHookContext);
|
|
74
85
|
const directToolNames = new Set([...ALWAYS_DIRECT_DYNAMIC_TOOL_NAMES, ...params.directToolNames ?? []]);
|
|
75
86
|
return {
|
|
76
|
-
availableSpecs:
|
|
87
|
+
availableSpecs: availableTools.map(({ tool, inputSchema }) => createCodexDynamicToolSpec({
|
|
77
88
|
tool,
|
|
89
|
+
inputSchema,
|
|
78
90
|
loading: params.loading ?? "searchable",
|
|
79
91
|
directToolNames
|
|
80
92
|
})),
|
|
81
|
-
specs:
|
|
93
|
+
specs: registeredProjection.tools.map(({ tool, inputSchema }) => createCodexDynamicToolSpec({
|
|
82
94
|
tool,
|
|
95
|
+
inputSchema,
|
|
83
96
|
loading: params.loading ?? "searchable",
|
|
84
97
|
directToolNames
|
|
85
98
|
})),
|
|
@@ -192,7 +205,7 @@ function createCodexDynamicToolSpec(params) {
|
|
|
192
205
|
const base = {
|
|
193
206
|
name: params.tool.name,
|
|
194
207
|
description: params.tool.description,
|
|
195
|
-
inputSchema:
|
|
208
|
+
inputSchema: params.inputSchema
|
|
196
209
|
};
|
|
197
210
|
if (params.loading === "direct" || params.directToolNames.has(params.tool.name)) return base;
|
|
198
211
|
return {
|
|
@@ -201,6 +214,43 @@ function createCodexDynamicToolSpec(params) {
|
|
|
201
214
|
deferLoading: true
|
|
202
215
|
};
|
|
203
216
|
}
|
|
217
|
+
function projectCodexDynamicTools(tools) {
|
|
218
|
+
const projectedTools = [];
|
|
219
|
+
const quarantinedTools = [];
|
|
220
|
+
for (const tool of tools) {
|
|
221
|
+
const projection = projectRuntimeToolInputSchema(tool.parameters, `${tool.name}.inputSchema`);
|
|
222
|
+
if (projection.violations.length > 0) {
|
|
223
|
+
quarantinedTools.push({
|
|
224
|
+
tool: tool.name,
|
|
225
|
+
violations: projection.violations
|
|
226
|
+
});
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
projectedTools.push({
|
|
230
|
+
tool,
|
|
231
|
+
inputSchema: projection.schema
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
tools: projectedTools,
|
|
236
|
+
quarantinedTools
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function warnQuarantinedDynamicTools(tools) {
|
|
240
|
+
if (tools.length === 0) return;
|
|
241
|
+
const unique = /* @__PURE__ */ new Map();
|
|
242
|
+
for (const tool of tools) unique.set(tool.tool, tool.violations);
|
|
243
|
+
embeddedAgentLog.warn(`codex app-server quarantined ${unique.size} dynamic ${unique.size === 1 ? "tool" : "tools"} with unsupported input schemas: ${[...unique.keys()].join(", ")}`, { tools: [...unique.entries()].map(([tool, violations]) => ({
|
|
244
|
+
tool,
|
|
245
|
+
violations
|
|
246
|
+
})) });
|
|
247
|
+
}
|
|
248
|
+
function dedupeQuarantinedDynamicTools(tools) {
|
|
249
|
+
return [...new Map(tools.map((tool) => [tool.tool, {
|
|
250
|
+
tool: tool.tool,
|
|
251
|
+
violations: tool.violations
|
|
252
|
+
}])).values()];
|
|
253
|
+
}
|
|
204
254
|
function toToolResultHookContext(ctx) {
|
|
205
255
|
const { agentId, sessionId, sessionKey, runId, channelId } = ctx ?? {};
|
|
206
256
|
return {
|
|
@@ -434,15 +484,6 @@ function convertToolContent(content) {
|
|
|
434
484
|
imageUrl
|
|
435
485
|
}];
|
|
436
486
|
}
|
|
437
|
-
function toJsonValue(value) {
|
|
438
|
-
try {
|
|
439
|
-
const text = JSON.stringify(value);
|
|
440
|
-
if (!text) return {};
|
|
441
|
-
return JSON.parse(text);
|
|
442
|
-
} catch {
|
|
443
|
-
return {};
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
487
|
function jsonObjectToRecord(value) {
|
|
447
488
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
448
489
|
return value;
|
package/dist/harness.js
CHANGED
|
@@ -28,21 +28,21 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
28
28
|
};
|
|
29
29
|
},
|
|
30
30
|
runAttempt: async (params) => {
|
|
31
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
31
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-D8Vxo-Jm.js");
|
|
32
32
|
return runCodexAppServerAttempt(params, {
|
|
33
33
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
34
34
|
nativeHookRelay: { enabled: true }
|
|
35
35
|
});
|
|
36
36
|
},
|
|
37
37
|
runSideQuestion: async (params) => {
|
|
38
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
38
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-DU7en3_R.js");
|
|
39
39
|
return runCodexAppServerSideQuestion(params, {
|
|
40
40
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
41
41
|
nativeHookRelay: { enabled: true }
|
|
42
42
|
});
|
|
43
43
|
},
|
|
44
44
|
compact: async (params) => {
|
|
45
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
45
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-C_1JAB4C.js");
|
|
46
46
|
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
47
47
|
},
|
|
48
48
|
reset: async (params) => {
|
|
@@ -52,7 +52,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
dispose: async () => {
|
|
55
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-
|
|
55
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-8kIrP817.js").then((n) => n.s);
|
|
56
56
|
await clearSharedCodexAppServerClientAndWait();
|
|
57
57
|
}
|
|
58
58
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createCodexAppServerAgentHarness } from "./harness.js";
|
|
2
2
|
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-0-UN67Qg.js";
|
|
3
3
|
import { buildCodexProvider } from "./provider.js";
|
|
4
|
-
import { C as defaultCodexAppInventoryCache, b as ensureCodexPluginActivation, x as pluginReadParams } from "./thread-lifecycle-
|
|
4
|
+
import { C as defaultCodexAppInventoryCache, b as ensureCodexPluginActivation, x as pluginReadParams } from "./thread-lifecycle-CUXQezJL.js";
|
|
5
5
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
6
|
-
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-
|
|
6
|
+
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-OaxhR46w.js";
|
|
7
7
|
import { s as formatCodexDisplayText } from "./notification-correlation-YINts3PA.js";
|
|
8
|
-
import {
|
|
9
|
-
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-
|
|
8
|
+
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-8kIrP817.js";
|
|
9
|
+
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-OjYqDwhw.js";
|
|
10
10
|
import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
|
|
11
11
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
12
12
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
@@ -47,7 +47,7 @@ async function handleCodexCommand(ctx, options = {}) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
async function loadDefaultCodexSubcommandHandler() {
|
|
50
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
50
|
+
const { handleCodexSubcommand } = await import("./command-handlers-hYTtzAdy.js");
|
|
51
51
|
return handleCodexSubcommand;
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
@@ -1182,7 +1182,7 @@ function prepareTargetCodexAppServer(ctx) {
|
|
|
1182
1182
|
const appServer = resolveTargetCodexAppServer(ctx);
|
|
1183
1183
|
const targets = resolveCodexMigrationTargets(ctx);
|
|
1184
1184
|
let warmedClient;
|
|
1185
|
-
const ready =
|
|
1185
|
+
const ready = getLeasedSharedCodexAppServerClient({
|
|
1186
1186
|
startOptions: appServer.start,
|
|
1187
1187
|
timeoutMs: 6e4,
|
|
1188
1188
|
agentDir: targets.agentDir,
|
|
@@ -1192,6 +1192,7 @@ function prepareTargetCodexAppServer(ctx) {
|
|
|
1192
1192
|
}, () => void 0);
|
|
1193
1193
|
return { async dispose() {
|
|
1194
1194
|
await ready;
|
|
1195
|
+
if (warmedClient) releaseLeasedSharedCodexAppServerClient(warmedClient);
|
|
1195
1196
|
await clearSharedCodexAppServerClientIfCurrentAndWait(warmedClient, {
|
|
1196
1197
|
exitTimeoutMs: 2e3,
|
|
1197
1198
|
forceKillDelayMs: 250
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
|
|
2
|
-
import "./client-factory-
|
|
2
|
+
import "./client-factory-fW4Hh9q_.js";
|
|
3
3
|
import { l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
4
|
-
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-
|
|
5
|
-
import { i as readModelListResult } from "./models-
|
|
4
|
+
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
5
|
+
import { i as readModelListResult } from "./models-_XwpqjR8.js";
|
|
6
6
|
import { l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
7
|
-
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-
|
|
7
|
+
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-CUXQezJL.js";
|
|
8
8
|
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
9
9
|
import "openclaw/plugin-sdk/media-understanding";
|
|
10
10
|
//#region extensions/codex/media-understanding-provider.ts
|
|
@@ -65,7 +65,7 @@ async function runBoundedCodexVisionTurn(params) {
|
|
|
65
65
|
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
|
|
66
66
|
const timeoutMs = Math.max(100, params.timeoutMs);
|
|
67
67
|
const ownsClient = !params.options.clientFactory;
|
|
68
|
-
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-
|
|
68
|
+
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-8kIrP817.js").then((n) => n.s).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
69
69
|
startOptions: appServer.start,
|
|
70
70
|
timeoutMs,
|
|
71
71
|
authProfileId: params.profile
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { s as readCodexModelListResponse } from "./protocol-validators-
|
|
2
|
+
import { s as readCodexModelListResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
3
3
|
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/codex/src/app-server/models.ts
|
|
5
5
|
var models_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -40,8 +40,8 @@ async function listAllCodexAppServerModels(options = {}) {
|
|
|
40
40
|
async function withCodexAppServerModelClient(options, run) {
|
|
41
41
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
42
42
|
const useSharedClient = options.sharedClient !== false;
|
|
43
|
-
const { createIsolatedCodexAppServerClient,
|
|
44
|
-
const client = useSharedClient ? await
|
|
43
|
+
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-8kIrP817.js").then((n) => n.s);
|
|
44
|
+
const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
|
|
45
45
|
startOptions: options.startOptions,
|
|
46
46
|
timeoutMs,
|
|
47
47
|
authProfileId: options.authProfileId,
|
|
@@ -60,7 +60,8 @@ async function withCodexAppServerModelClient(options, run) {
|
|
|
60
60
|
timeoutMs
|
|
61
61
|
});
|
|
62
62
|
} finally {
|
|
63
|
-
if (
|
|
63
|
+
if (useSharedClient) releaseLeasedSharedCodexAppServerClient(client);
|
|
64
|
+
else client.close();
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
async function requestModelListPage(client, options) {
|