@openclaw/codex 2026.6.8 → 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 +4 -4
|
@@ -1,356 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as resolveCodexAppServerRuntimeOptions } from "./config-DJXpBkGf.js";
|
|
3
|
-
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-B48C6S9O.js";
|
|
4
|
-
import { i as readModelListResult } from "./models-DRKnOpzF.js";
|
|
5
|
-
import { t as isJsonObject } from "./protocol-oeJQu4rs.js";
|
|
6
|
-
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-cban34w3.js";
|
|
7
|
-
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
8
|
-
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
9
|
-
//#region extensions/codex/media-understanding-provider.ts
|
|
10
|
-
/**
|
|
11
|
-
* Codex-backed media understanding provider for bounded image description and
|
|
12
|
-
* structured extraction turns.
|
|
13
|
-
*/
|
|
14
|
-
const DEFAULT_CODEX_IMAGE_MODEL = FALLBACK_CODEX_MODELS.find((model) => model.inputModalities.includes("image"))?.id ?? FALLBACK_CODEX_MODELS[0]?.id;
|
|
15
|
-
const DEFAULT_CODEX_IMAGE_PROMPT = "Describe the image.";
|
|
16
|
-
/**
|
|
17
|
-
* Builds the media-understanding provider that delegates image tasks to an
|
|
18
|
-
* isolated Codex app-server session.
|
|
19
|
-
*/
|
|
20
|
-
function buildCodexMediaUnderstandingProvider(options = {}) {
|
|
21
|
-
return {
|
|
22
|
-
id: CODEX_PROVIDER_ID,
|
|
23
|
-
capabilities: ["image"],
|
|
24
|
-
...DEFAULT_CODEX_IMAGE_MODEL ? { defaultModels: { image: DEFAULT_CODEX_IMAGE_MODEL } } : {},
|
|
25
|
-
describeImage: async (req) => describeCodexImages({
|
|
26
|
-
images: [{
|
|
27
|
-
buffer: req.buffer,
|
|
28
|
-
fileName: req.fileName,
|
|
29
|
-
mime: req.mime
|
|
30
|
-
}],
|
|
31
|
-
provider: req.provider,
|
|
32
|
-
model: req.model,
|
|
33
|
-
prompt: req.prompt,
|
|
34
|
-
maxTokens: req.maxTokens,
|
|
35
|
-
timeoutMs: req.timeoutMs,
|
|
36
|
-
profile: req.profile,
|
|
37
|
-
preferredProfile: req.preferredProfile,
|
|
38
|
-
authStore: req.authStore,
|
|
39
|
-
agentDir: req.agentDir,
|
|
40
|
-
cfg: req.cfg
|
|
41
|
-
}, options),
|
|
42
|
-
describeImages: async (req) => describeCodexImages(req, options),
|
|
43
|
-
extractStructured: async (req) => extractCodexStructured(req, options)
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
async function describeCodexImages(req, options) {
|
|
47
|
-
const model = req.model.trim();
|
|
48
|
-
if (!model) throw new Error("Codex image understanding requires model id.");
|
|
49
|
-
return {
|
|
50
|
-
text: await runBoundedCodexVisionTurn({
|
|
51
|
-
model,
|
|
52
|
-
profile: req.profile,
|
|
53
|
-
timeoutMs: req.timeoutMs,
|
|
54
|
-
agentDir: req.agentDir,
|
|
55
|
-
authStore: req.authStore,
|
|
56
|
-
cfg: req.cfg,
|
|
57
|
-
options,
|
|
58
|
-
taskLabel: "image understanding",
|
|
59
|
-
developerInstructions: "You are OpenClaw's bounded image-understanding worker. Describe only the provided image content. Do not call tools, edit files, or ask follow-up questions.",
|
|
60
|
-
input: [{
|
|
61
|
-
type: "text",
|
|
62
|
-
text: buildCodexImagePrompt(req),
|
|
63
|
-
text_elements: []
|
|
64
|
-
}, ...req.images.map((image) => ({
|
|
65
|
-
type: "image",
|
|
66
|
-
url: `data:${image.mime ?? "image/png"};base64,${image.buffer.toString("base64")}`
|
|
67
|
-
}))],
|
|
68
|
-
requiredModalities: ["text", "image"]
|
|
69
|
-
}),
|
|
70
|
-
model
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
async function runBoundedCodexVisionTurn(params) {
|
|
74
|
-
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
|
|
75
|
-
const timeoutMs = resolveTimerTimeoutMs(params.timeoutMs, 100, 100);
|
|
76
|
-
const agentDir = params.agentDir?.trim() || void 0;
|
|
77
|
-
const cwd = agentDir ?? process.cwd();
|
|
78
|
-
const ownsClient = !params.options.clientFactory;
|
|
79
|
-
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile, agentDir, params.cfg) : await import("./shared-client-jFMumCOe.js").then((n) => n.c).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
80
|
-
startOptions: appServer.start,
|
|
81
|
-
timeoutMs,
|
|
82
|
-
authProfileId: params.profile,
|
|
83
|
-
agentDir,
|
|
84
|
-
authProfileStore: params.authStore,
|
|
85
|
-
config: params.cfg
|
|
86
|
-
}));
|
|
87
|
-
const abortController = new AbortController();
|
|
88
|
-
const timeout = setTimeout(() => abortController.abort("timeout"), timeoutMs);
|
|
89
|
-
timeout.unref?.();
|
|
90
|
-
try {
|
|
91
|
-
await assertCodexModelSupportsInput({
|
|
92
|
-
client,
|
|
93
|
-
model: params.model,
|
|
94
|
-
requiredModalities: params.requiredModalities,
|
|
95
|
-
timeoutMs,
|
|
96
|
-
signal: abortController.signal
|
|
97
|
-
});
|
|
98
|
-
const thread = assertCodexThreadStartResponse(await client.request("thread/start", {
|
|
99
|
-
model: params.model,
|
|
100
|
-
modelProvider: "openai",
|
|
101
|
-
cwd,
|
|
102
|
-
approvalPolicy: "on-request",
|
|
103
|
-
sandbox: "read-only",
|
|
104
|
-
serviceName: "OpenClaw",
|
|
105
|
-
developerInstructions: params.developerInstructions,
|
|
106
|
-
config: buildCodexRuntimeThreadConfig(void 0, { nativeCodeModeEnabled: false }),
|
|
107
|
-
environments: [],
|
|
108
|
-
dynamicTools: [],
|
|
109
|
-
experimentalRawEvents: true,
|
|
110
|
-
persistExtendedHistory: false,
|
|
111
|
-
ephemeral: true
|
|
112
|
-
}, {
|
|
113
|
-
timeoutMs,
|
|
114
|
-
signal: abortController.signal
|
|
115
|
-
}));
|
|
116
|
-
const collector = createCodexTurnCollector(thread.thread.id, params.taskLabel);
|
|
117
|
-
const cleanup = client.addNotificationHandler(collector.handleNotification);
|
|
118
|
-
const requestCleanup = client.addRequestHandler(denyCodexImageApprovalRequest);
|
|
119
|
-
try {
|
|
120
|
-
const turn = assertCodexTurnStartResponse(await client.request("turn/start", {
|
|
121
|
-
threadId: thread.thread.id,
|
|
122
|
-
input: params.input,
|
|
123
|
-
cwd,
|
|
124
|
-
approvalPolicy: "on-request",
|
|
125
|
-
model: params.model,
|
|
126
|
-
effort: "low"
|
|
127
|
-
}, {
|
|
128
|
-
timeoutMs,
|
|
129
|
-
signal: abortController.signal
|
|
130
|
-
}));
|
|
131
|
-
return await collector.collect(turn.turn, {
|
|
132
|
-
timeoutMs,
|
|
133
|
-
signal: abortController.signal
|
|
134
|
-
});
|
|
135
|
-
} finally {
|
|
136
|
-
requestCleanup();
|
|
137
|
-
cleanup();
|
|
138
|
-
}
|
|
139
|
-
} finally {
|
|
140
|
-
clearTimeout(timeout);
|
|
141
|
-
if (ownsClient) client.close();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
async function extractCodexStructured(req, options) {
|
|
145
|
-
const model = req.model.trim();
|
|
146
|
-
if (!model) throw new Error("Codex structured extraction requires model id.");
|
|
147
|
-
if (!req.instructions.trim()) throw new Error("Codex structured extraction requires instructions.");
|
|
148
|
-
if (req.input.length === 0) throw new Error("Codex structured extraction requires at least one input.");
|
|
149
|
-
if (!req.input.some((entry) => entry.type === "image")) throw new Error("Codex structured extraction requires at least one image input.");
|
|
150
|
-
return normalizeStructuredExtractionResult({
|
|
151
|
-
text: await runBoundedCodexVisionTurn({
|
|
152
|
-
model,
|
|
153
|
-
profile: req.profile,
|
|
154
|
-
timeoutMs: req.timeoutMs,
|
|
155
|
-
agentDir: req.agentDir,
|
|
156
|
-
authStore: req.authStore,
|
|
157
|
-
cfg: req.cfg,
|
|
158
|
-
options,
|
|
159
|
-
taskLabel: "structured extraction",
|
|
160
|
-
developerInstructions: "You are OpenClaw's bounded structured-extraction worker. Return only the requested extraction. Do not call tools, edit files, ask follow-up questions, or include secrets.",
|
|
161
|
-
input: buildCodexStructuredInput(req),
|
|
162
|
-
requiredModalities: requiredStructuredModalities()
|
|
163
|
-
}),
|
|
164
|
-
model,
|
|
165
|
-
provider: req.provider,
|
|
166
|
-
req
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
function denyCodexImageApprovalRequest(request) {
|
|
170
|
-
if (request.method === "item/commandExecution/requestApproval" || request.method === "item/fileChange/requestApproval") return {
|
|
171
|
-
decision: "decline",
|
|
172
|
-
reason: "OpenClaw Codex image understanding does not grant tool or file approvals."
|
|
173
|
-
};
|
|
174
|
-
if (request.method === "item/permissions/requestApproval") return {
|
|
175
|
-
permissions: {},
|
|
176
|
-
scope: "turn"
|
|
177
|
-
};
|
|
178
|
-
if (request.method.includes("requestApproval")) return {
|
|
179
|
-
decision: "decline",
|
|
180
|
-
reason: "OpenClaw Codex image understanding does not grant native approvals."
|
|
181
|
-
};
|
|
182
|
-
if (request.method === "mcpServer/elicitation/request") return { action: "decline" };
|
|
183
|
-
}
|
|
184
|
-
async function assertCodexModelSupportsInput(params) {
|
|
185
|
-
const match = readModelListResult(await params.client.request("model/list", {
|
|
186
|
-
limit: 100,
|
|
187
|
-
cursor: null,
|
|
188
|
-
includeHidden: false
|
|
189
|
-
}, {
|
|
190
|
-
timeoutMs: Math.min(params.timeoutMs, 5e3),
|
|
191
|
-
signal: params.signal
|
|
192
|
-
})).models.find((entry) => entry.model === params.model || entry.id === params.model);
|
|
193
|
-
if (!match) throw new Error(`Codex app-server model not found: ${params.model}`);
|
|
194
|
-
if (params.requiredModalities.includes("image") && !match.inputModalities.includes("image")) throw new Error(`Codex app-server model does not support images: ${params.model}`);
|
|
195
|
-
if (params.requiredModalities.includes("text") && !match.inputModalities.includes("text")) throw new Error(`Codex app-server model does not support text: ${params.model}`);
|
|
196
|
-
}
|
|
197
|
-
function buildCodexImagePrompt(req) {
|
|
198
|
-
const prompt = req.prompt?.trim() || DEFAULT_CODEX_IMAGE_PROMPT;
|
|
199
|
-
if (req.images.length <= 1) return prompt;
|
|
200
|
-
return `${prompt}\n\nAnalyze all ${req.images.length} images together.`;
|
|
201
|
-
}
|
|
202
|
-
function requiredStructuredModalities() {
|
|
203
|
-
return ["text", "image"];
|
|
204
|
-
}
|
|
205
|
-
function buildCodexStructuredInput(req) {
|
|
206
|
-
return [{
|
|
207
|
-
type: "text",
|
|
208
|
-
text: buildStructuredExtractionPrompt(req),
|
|
209
|
-
text_elements: []
|
|
210
|
-
}, ...req.input.map((entry) => {
|
|
211
|
-
if (entry.type === "text") return {
|
|
212
|
-
type: "text",
|
|
213
|
-
text: entry.text,
|
|
214
|
-
text_elements: []
|
|
215
|
-
};
|
|
216
|
-
return {
|
|
217
|
-
type: "image",
|
|
218
|
-
url: `data:${entry.mime ?? "image/png"};base64,${entry.buffer.toString("base64")}`
|
|
219
|
-
};
|
|
220
|
-
})];
|
|
221
|
-
}
|
|
222
|
-
function buildStructuredExtractionPrompt(req) {
|
|
223
|
-
return [
|
|
224
|
-
req.instructions.trim(),
|
|
225
|
-
req.schemaName ? `Schema name: ${req.schemaName}` : void 0,
|
|
226
|
-
req.jsonSchema ? `JSON schema:\n${JSON.stringify(req.jsonSchema)}` : void 0,
|
|
227
|
-
req.jsonMode === false ? "Return the extraction as concise text." : "Return valid JSON only. Do not wrap the JSON in Markdown fences."
|
|
228
|
-
].filter((part) => Boolean(part)).join("\n\n");
|
|
229
|
-
}
|
|
230
|
-
function isJsonSchemaObject(value) {
|
|
231
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
232
|
-
}
|
|
233
|
-
function normalizeStructuredExtractionResult(params) {
|
|
234
|
-
const result = {
|
|
235
|
-
text: params.text,
|
|
236
|
-
model: params.model,
|
|
237
|
-
provider: params.provider,
|
|
238
|
-
contentType: params.req.jsonMode === false ? "text" : "json"
|
|
239
|
-
};
|
|
240
|
-
if (params.req.jsonMode !== false) {
|
|
241
|
-
try {
|
|
242
|
-
result.parsed = JSON.parse(params.text);
|
|
243
|
-
} catch {
|
|
244
|
-
throw new Error("Codex structured extraction returned invalid JSON.");
|
|
245
|
-
}
|
|
246
|
-
if (isJsonSchemaObject(params.req.jsonSchema)) {
|
|
247
|
-
const validation = validateJsonSchemaValue({
|
|
248
|
-
schema: params.req.jsonSchema,
|
|
249
|
-
cacheKey: "codex.media-understanding.extractStructured",
|
|
250
|
-
value: result.parsed,
|
|
251
|
-
cache: false
|
|
252
|
-
});
|
|
253
|
-
if (!validation.ok) {
|
|
254
|
-
const message = validation.errors.map((error) => error.text).join("; ") || "invalid";
|
|
255
|
-
throw new Error(`Codex structured extraction JSON did not match schema: ${message}`);
|
|
256
|
-
}
|
|
257
|
-
result.parsed = validation.value;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return result;
|
|
261
|
-
}
|
|
262
|
-
function createCodexTurnCollector(threadId, taskLabel) {
|
|
263
|
-
let turnId;
|
|
264
|
-
let completedTurn;
|
|
265
|
-
let promptError;
|
|
266
|
-
const pending = [];
|
|
267
|
-
const assistantTextByItem = /* @__PURE__ */ new Map();
|
|
268
|
-
const assistantItemOrder = [];
|
|
269
|
-
let resolveCompletion;
|
|
270
|
-
const completion = new Promise((resolve) => {
|
|
271
|
-
resolveCompletion = resolve;
|
|
272
|
-
});
|
|
273
|
-
const rememberAssistantText = (itemId, text) => {
|
|
274
|
-
if (!text) return;
|
|
275
|
-
if (!assistantTextByItem.has(itemId)) assistantItemOrder.push(itemId);
|
|
276
|
-
assistantTextByItem.set(itemId, text);
|
|
277
|
-
};
|
|
278
|
-
const handleNotification = (notification) => {
|
|
279
|
-
const params = isJsonObject(notification.params) ? notification.params : void 0;
|
|
280
|
-
if (!params || readString(params, "threadId") !== threadId) return;
|
|
281
|
-
if (!turnId) {
|
|
282
|
-
pending.push(notification);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
if (readNotificationTurnId(params) !== turnId) return;
|
|
286
|
-
if (notification.method === "item/agentMessage/delta") {
|
|
287
|
-
const itemId = readString(params, "itemId") ?? readString(params, "id") ?? "assistant";
|
|
288
|
-
const delta = readString(params, "delta") ?? "";
|
|
289
|
-
rememberAssistantText(itemId, `${assistantTextByItem.get(itemId) ?? ""}${delta}`);
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
if (notification.method === "turn/completed") {
|
|
293
|
-
completedTurn = readCodexTurnCompletedNotification(notification.params)?.turn ?? completedTurn;
|
|
294
|
-
resolveCompletion?.();
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
if (notification.method === "error") {
|
|
298
|
-
promptError = readCodexErrorNotification(notification.params)?.error.message ?? `codex app-server ${taskLabel} turn failed`;
|
|
299
|
-
resolveCompletion?.();
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
return {
|
|
303
|
-
handleNotification,
|
|
304
|
-
async collect(startedTurn, options) {
|
|
305
|
-
turnId = startedTurn.id;
|
|
306
|
-
if (isTerminalTurn(startedTurn)) completedTurn = startedTurn;
|
|
307
|
-
for (const notification of pending.splice(0)) handleNotification(notification);
|
|
308
|
-
if (!completedTurn && !promptError) await waitForTurnCompletion({
|
|
309
|
-
completion,
|
|
310
|
-
timeoutMs: options.timeoutMs,
|
|
311
|
-
signal: options.signal,
|
|
312
|
-
taskLabel
|
|
313
|
-
});
|
|
314
|
-
if (promptError) throw new Error(promptError);
|
|
315
|
-
if (completedTurn?.status === "failed") throw new Error(completedTurn.error?.message ?? `codex app-server ${taskLabel} turn failed`);
|
|
316
|
-
const itemText = collectAssistantTextFromItems(completedTurn?.items);
|
|
317
|
-
const deltaText = assistantItemOrder.map((itemId) => assistantTextByItem.get(itemId)?.trim()).filter((text) => Boolean(text)).join("\n\n").trim();
|
|
318
|
-
const text = (itemText || deltaText).trim();
|
|
319
|
-
if (!text) throw new Error(`Codex app-server ${taskLabel} turn returned no text.`);
|
|
320
|
-
return text;
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
async function waitForTurnCompletion(params) {
|
|
325
|
-
let timeout;
|
|
326
|
-
let cleanupAbort;
|
|
327
|
-
try {
|
|
328
|
-
await Promise.race([params.completion, new Promise((_, reject) => {
|
|
329
|
-
timeout = setTimeout(() => reject(/* @__PURE__ */ new Error(`codex app-server ${params.taskLabel} turn timed out`)), params.timeoutMs);
|
|
330
|
-
timeout.unref?.();
|
|
331
|
-
const abortListener = () => reject(/* @__PURE__ */ new Error(`codex app-server ${params.taskLabel} turn aborted`));
|
|
332
|
-
params.signal.addEventListener("abort", abortListener, { once: true });
|
|
333
|
-
cleanupAbort = () => params.signal.removeEventListener("abort", abortListener);
|
|
334
|
-
})]);
|
|
335
|
-
} finally {
|
|
336
|
-
if (timeout) clearTimeout(timeout);
|
|
337
|
-
cleanupAbort?.();
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function collectAssistantTextFromItems(items) {
|
|
341
|
-
return (items ?? []).filter((item) => item.type === "agentMessage").map((item) => item.text.trim()).filter(Boolean).join("\n\n").trim();
|
|
342
|
-
}
|
|
343
|
-
function readNotificationTurnId(record) {
|
|
344
|
-
const direct = readString(record, "turnId");
|
|
345
|
-
if (direct) return direct;
|
|
346
|
-
return isJsonObject(record.turn) ? readString(record.turn, "id") : void 0;
|
|
347
|
-
}
|
|
348
|
-
function readString(record, key) {
|
|
349
|
-
const value = record[key];
|
|
350
|
-
return typeof value === "string" ? value : void 0;
|
|
351
|
-
}
|
|
352
|
-
function isTerminalTurn(turn) {
|
|
353
|
-
return turn.status === "completed" || turn.status === "interrupted" || turn.status === "failed";
|
|
354
|
-
}
|
|
355
|
-
//#endregion
|
|
1
|
+
import { t as buildCodexMediaUnderstandingProvider } from "./media-understanding-provider-CiwPkR58.js";
|
|
356
2
|
export { buildCodexMediaUnderstandingProvider };
|
|
@@ -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-B19q5BIX.js";
|
|
3
3
|
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/codex/src/app-server/models.ts
|
|
5
5
|
/**
|
|
@@ -46,7 +46,7 @@ async function listAllCodexAppServerModels(options = {}) {
|
|
|
46
46
|
async function withCodexAppServerModelClient(options, run) {
|
|
47
47
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
48
48
|
const useSharedClient = options.sharedClient !== false;
|
|
49
|
-
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-
|
|
49
|
+
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-Bg5d7VV9.js").then((n) => n.c);
|
|
50
50
|
const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
|
|
51
51
|
startOptions: options.startOptions,
|
|
52
52
|
timeoutMs,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { h as resolveCodexAppServerHomeDir } from "./shared-client-
|
|
1
|
+
import { I as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-CbJqqnEw.js";
|
|
2
|
+
import { n as CodexAppServerRpcError } from "./client-m7XiCQpO.js";
|
|
3
|
+
import { h as resolveCodexAppServerHomeDir } from "./shared-client-Bg5d7VV9.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
//#region extensions/codex/src/app-server/capabilities.ts
|
|
6
6
|
/**
|
|
@@ -35,12 +35,23 @@ function isUnsupportedControlError(error) {
|
|
|
35
35
|
/** Builds the full app inventory cache key for Codex plugin/app discovery. */
|
|
36
36
|
function buildCodexPluginAppCacheKey(params) {
|
|
37
37
|
return buildCodexAppInventoryCacheKey({
|
|
38
|
-
codexHome: resolveCodexPluginAppCacheCodexHome(params.appServer, params.agentDir),
|
|
38
|
+
codexHome: params.runtimeIdentity?.codexHome ?? resolveCodexPluginAppCacheCodexHome(params.appServer, params.agentDir),
|
|
39
39
|
endpoint: resolveCodexPluginAppCacheEndpoint(params.appServer),
|
|
40
40
|
authProfileId: params.authProfileId,
|
|
41
41
|
accountId: params.accountId,
|
|
42
42
|
envApiKeyFingerprint: params.envApiKeyFingerprint,
|
|
43
|
-
appServerVersion: params.appServerVersion
|
|
43
|
+
appServerVersion: params.appServerVersion ?? params.runtimeIdentity?.serverVersion,
|
|
44
|
+
runtimeIdentity: params.runtimeIdentity
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Builds a durable thread-binding fingerprint for one initialized app-server runtime. */
|
|
48
|
+
function buildCodexAppServerRuntimeFingerprint(params) {
|
|
49
|
+
return JSON.stringify({
|
|
50
|
+
endpoint: resolveCodexPluginAppCacheEndpoint(params.appServer),
|
|
51
|
+
connectionClass: params.appServer.connectionClass,
|
|
52
|
+
remoteWorkspaceRoot: params.appServer.remoteWorkspaceRoot ?? null,
|
|
53
|
+
appServerVersion: params.appServerVersion ?? params.runtimeIdentity?.serverVersion ?? null,
|
|
54
|
+
runtimeIdentity: params.runtimeIdentity ?? null
|
|
44
55
|
});
|
|
45
56
|
}
|
|
46
57
|
/** Serializes app-server endpoint identity, including credential fingerprints. */
|
|
@@ -76,4 +87,4 @@ function fingerprintCodexPluginAppCacheCredentials(startOptions) {
|
|
|
76
87
|
return `sha256:${hash.digest("hex")}`;
|
|
77
88
|
}
|
|
78
89
|
//#endregion
|
|
79
|
-
export {
|
|
90
|
+
export { describeControlFailure as i, buildCodexPluginAppCacheKey as n, CODEX_CONTROL_METHODS as r, buildCodexAppServerRuntimeFingerprint as t };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
//#region extensions/codex/src/app-server/protocol.ts
|
|
2
|
+
function flattenCodexDynamicToolFunctions(tools) {
|
|
3
|
+
return (tools ?? []).flatMap((tool) => tool.type === "namespace" ? tool.tools : [tool]);
|
|
4
|
+
}
|
|
2
5
|
function isJsonObject(value) {
|
|
3
6
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
4
7
|
}
|
|
@@ -6,4 +9,4 @@ function isRpcResponse(message) {
|
|
|
6
9
|
return "id" in message && !("method" in message);
|
|
7
10
|
}
|
|
8
11
|
//#endregion
|
|
9
|
-
export {
|
|
12
|
+
export { isJsonObject as n, isRpcResponse as r, flattenCodexDynamicToolFunctions as t };
|