@openclaw/codex 2026.5.3-beta.2 → 2026.5.3-beta.4
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/{capabilities-CYg1OFaL.js → capabilities-BmhO5h8O.js} +1 -1
- package/dist/{client-factory-Bh5chnqU.js → client-factory-MaOMEltT.js} +1 -1
- package/dist/{command-handlers-Dxx2slu2.js → command-handlers-CeaXhO5y.js} +11 -7
- package/dist/{compact-CpZ5DNlM.js → compact-C0_rGlHZ.js} +2 -2
- package/dist/{computer-use-BblypQuj.js → computer-use-amNk2zrB.js} +2 -2
- package/dist/{conversation-binding-D12ISGdf.js → conversation-binding-DjptpT9W.js} +51 -14
- package/dist/harness.js +4 -4
- package/dist/index.js +2 -2
- package/dist/media-understanding-provider.js +2 -2
- package/dist/{models-Ddmxtdog.js → models-Ds7g6191.js} +1 -1
- package/dist/provider.js +1 -1
- package/dist/{run-attempt-C5v380B8.js → run-attempt-BNbVe-IG.js} +20 -10
- package/dist/{session-binding-C7Y7rY0i.js → session-binding-DuJYTJQy.js} +57 -6
- package/dist/{shared-client-DEzBJ9G1.js → shared-client-0El8eRIE.js} +35 -10
- package/dist/test-api.js +1 -1
- package/dist/{thread-lifecycle-BKZiIxyU.js → thread-lifecycle-OAlp5Pku.js} +52 -12
- package/package.json +4 -4
- package/dist/{client-Bm5-MMSf.js → client-chGfNrq5.js} +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
-
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir) => import("./shared-client-
|
|
2
|
+
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir) => import("./shared-client-0El8eRIE.js").then((n) => n.r).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
3
3
|
startOptions,
|
|
4
4
|
authProfileId,
|
|
5
5
|
agentDir
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { i as resolveCodexAppServerRuntimeOptions } from "./config-CkkoMeqF.js";
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-Ds7g6191.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-
|
|
5
|
-
import { i as
|
|
6
|
-
import { a as parseCodexFastModeArg, c as setCodexConversationFastMode, d as steerCodexConversationTurn, f as stopCodexConversationTurn, i as formatPermissionsMode, l as setCodexConversationModel, m as resolveCodexDefaultWorkspaceDir, o as parseCodexPermissionsModeArg, p as readCodexConversationBindingData, r as startCodexConversationThread, s as readCodexConversationActiveTurn, u as setCodexConversationPermissions } from "./conversation-binding-
|
|
7
|
-
import { i as requestCodexAppServerJson, n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-
|
|
4
|
+
import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-BmhO5h8O.js";
|
|
5
|
+
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-DuJYTJQy.js";
|
|
6
|
+
import { a as parseCodexFastModeArg, c as setCodexConversationFastMode, d as steerCodexConversationTurn, f as stopCodexConversationTurn, i as formatPermissionsMode, l as setCodexConversationModel, m as resolveCodexDefaultWorkspaceDir, o as parseCodexPermissionsModeArg, p as readCodexConversationBindingData, r as startCodexConversationThread, s as readCodexConversationActiveTurn, u as setCodexConversationPermissions } from "./conversation-binding-DjptpT9W.js";
|
|
7
|
+
import { i as requestCodexAppServerJson, n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-amNk2zrB.js";
|
|
8
8
|
import crypto from "node:crypto";
|
|
9
9
|
//#region extensions/codex/src/command-formatters.ts
|
|
10
10
|
function formatCodexStatus(probes) {
|
|
@@ -257,14 +257,18 @@ async function bindConversation(deps, ctx, pluginConfig, args) {
|
|
|
257
257
|
const parsed = parseBindArgs(args);
|
|
258
258
|
if (parsed.help) return { text: "Usage: /codex bind [thread-id] [--cwd <path>] [--model <model>] [--provider <provider>]" };
|
|
259
259
|
const workspaceDir = parsed.cwd ?? deps.resolveCodexDefaultWorkspaceDir(pluginConfig);
|
|
260
|
-
const
|
|
260
|
+
const authProfileId = (await deps.readCodexAppServerBinding(ctx.sessionFile))?.authProfileId;
|
|
261
|
+
const startParams = {
|
|
261
262
|
pluginConfig,
|
|
263
|
+
config: ctx.config,
|
|
262
264
|
sessionFile: ctx.sessionFile,
|
|
263
265
|
workspaceDir,
|
|
264
266
|
threadId: parsed.threadId,
|
|
265
267
|
model: parsed.model,
|
|
266
268
|
modelProvider: parsed.provider
|
|
267
|
-
}
|
|
269
|
+
};
|
|
270
|
+
if (authProfileId) startParams.authProfileId = authProfileId;
|
|
271
|
+
const data = await deps.startCodexConversationThread(startParams);
|
|
268
272
|
const threadId = (await deps.readCodexAppServerBinding(ctx.sessionFile))?.threadId ?? parsed.threadId ?? "new thread";
|
|
269
273
|
const summary = `Codex app-server thread ${threadId} in ${workspaceDir}`;
|
|
270
274
|
let request;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as resolveCodexAppServerRuntimeOptions } from "./config-CkkoMeqF.js";
|
|
2
2
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
3
|
-
import {
|
|
4
|
-
import { n as defaultCodexAppServerClientFactory, t as createCodexAppServerClientFactoryTestHooks } from "./client-factory-
|
|
3
|
+
import { i as readCodexAppServerBinding } from "./session-binding-DuJYTJQy.js";
|
|
4
|
+
import { n as defaultCodexAppServerClientFactory, t as createCodexAppServerClientFactoryTestHooks } from "./client-factory-MaOMEltT.js";
|
|
5
5
|
import { embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, runHarnessContextEngineMaintenance } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/compact.ts
|
|
7
7
|
const DEFAULT_CODEX_COMPACTION_WAIT_TIMEOUT_MS = 300 * 1e3;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as resolveCodexComputerUseConfig, i as resolveCodexAppServerRuntimeOptions } from "./config-CkkoMeqF.js";
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
2
|
+
import { i as withTimeout, n as getSharedCodexAppServerClient } from "./shared-client-0El8eRIE.js";
|
|
3
|
+
import { n as describeControlFailure } from "./capabilities-BmhO5h8O.js";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
//#region extensions/codex/src/app-server/request.ts
|
|
6
6
|
async function requestCodexAppServerJson(params) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as resolveCodexAppServerRuntimeOptions, n as codexSandboxPolicyForTurn } from "./config-CkkoMeqF.js";
|
|
2
2
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
3
|
+
import { n as getSharedCodexAppServerClient, s as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-0El8eRIE.js";
|
|
4
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-BmhO5h8O.js";
|
|
5
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-DuJYTJQy.js";
|
|
6
6
|
import { formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
|
@@ -373,20 +373,29 @@ function getGlobalState() {
|
|
|
373
373
|
}
|
|
374
374
|
async function startCodexConversationThread(params) {
|
|
375
375
|
const workspaceDir = params.workspaceDir?.trim() || resolveCodexDefaultWorkspaceDir(params.pluginConfig);
|
|
376
|
+
const existingBinding = await readCodexAppServerBinding(params.sessionFile, { config: params.config });
|
|
377
|
+
const authProfileId = resolveCodexAppServerAuthProfileIdForAgent({
|
|
378
|
+
authProfileId: params.authProfileId ?? existingBinding?.authProfileId,
|
|
379
|
+
config: params.config
|
|
380
|
+
});
|
|
376
381
|
if (params.threadId?.trim()) await attachExistingThread({
|
|
377
382
|
pluginConfig: params.pluginConfig,
|
|
378
383
|
sessionFile: params.sessionFile,
|
|
379
384
|
threadId: params.threadId.trim(),
|
|
380
385
|
workspaceDir,
|
|
381
386
|
model: params.model,
|
|
382
|
-
modelProvider: params.modelProvider
|
|
387
|
+
modelProvider: params.modelProvider,
|
|
388
|
+
authProfileId,
|
|
389
|
+
config: params.config
|
|
383
390
|
});
|
|
384
391
|
else await createThread({
|
|
385
392
|
pluginConfig: params.pluginConfig,
|
|
386
393
|
sessionFile: params.sessionFile,
|
|
387
394
|
workspaceDir,
|
|
388
395
|
model: params.model,
|
|
389
|
-
modelProvider: params.modelProvider
|
|
396
|
+
modelProvider: params.modelProvider,
|
|
397
|
+
authProfileId,
|
|
398
|
+
config: params.config
|
|
390
399
|
});
|
|
391
400
|
return createCodexConversationBindingData({
|
|
392
401
|
sessionFile: params.sessionFile,
|
|
@@ -425,13 +434,19 @@ async function handleCodexConversationBindingResolved(event) {
|
|
|
425
434
|
}
|
|
426
435
|
async function attachExistingThread(params) {
|
|
427
436
|
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
|
|
437
|
+
const modelProvider = resolveThreadRequestModelProvider({
|
|
438
|
+
authProfileId: params.authProfileId,
|
|
439
|
+
modelProvider: params.modelProvider,
|
|
440
|
+
config: params.config
|
|
441
|
+
});
|
|
428
442
|
const response = await (await getSharedCodexAppServerClient({
|
|
429
443
|
startOptions: runtime.start,
|
|
430
|
-
timeoutMs: runtime.requestTimeoutMs
|
|
444
|
+
timeoutMs: runtime.requestTimeoutMs,
|
|
445
|
+
authProfileId: params.authProfileId
|
|
431
446
|
})).request(CODEX_CONTROL_METHODS.resumeThread, {
|
|
432
447
|
threadId: params.threadId,
|
|
433
448
|
...params.model ? { model: params.model } : {},
|
|
434
|
-
...
|
|
449
|
+
...modelProvider ? { modelProvider } : {},
|
|
435
450
|
approvalPolicy: runtime.approvalPolicy,
|
|
436
451
|
approvalsReviewer: runtime.approvalsReviewer,
|
|
437
452
|
sandbox: runtime.sandbox,
|
|
@@ -442,22 +457,33 @@ async function attachExistingThread(params) {
|
|
|
442
457
|
await writeCodexAppServerBinding(params.sessionFile, {
|
|
443
458
|
threadId: thread.id,
|
|
444
459
|
cwd: thread.cwd ?? params.workspaceDir,
|
|
460
|
+
authProfileId: params.authProfileId,
|
|
445
461
|
model: response.model ?? params.model,
|
|
446
|
-
modelProvider:
|
|
462
|
+
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
463
|
+
config: params.config,
|
|
464
|
+
authProfileId: params.authProfileId,
|
|
465
|
+
modelProvider: response.modelProvider ?? params.modelProvider
|
|
466
|
+
}),
|
|
447
467
|
approvalPolicy: runtime.approvalPolicy,
|
|
448
468
|
sandbox: runtime.sandbox,
|
|
449
469
|
serviceTier: runtime.serviceTier
|
|
450
|
-
});
|
|
470
|
+
}, { config: params.config });
|
|
451
471
|
}
|
|
452
472
|
async function createThread(params) {
|
|
453
473
|
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
|
|
474
|
+
const modelProvider = resolveThreadRequestModelProvider({
|
|
475
|
+
authProfileId: params.authProfileId,
|
|
476
|
+
modelProvider: params.modelProvider,
|
|
477
|
+
config: params.config
|
|
478
|
+
});
|
|
454
479
|
const response = await (await getSharedCodexAppServerClient({
|
|
455
480
|
startOptions: runtime.start,
|
|
456
|
-
timeoutMs: runtime.requestTimeoutMs
|
|
481
|
+
timeoutMs: runtime.requestTimeoutMs,
|
|
482
|
+
authProfileId: params.authProfileId
|
|
457
483
|
})).request("thread/start", {
|
|
458
484
|
cwd: params.workspaceDir,
|
|
459
485
|
...params.model ? { model: params.model } : {},
|
|
460
|
-
...
|
|
486
|
+
...modelProvider ? { modelProvider } : {},
|
|
461
487
|
approvalPolicy: runtime.approvalPolicy,
|
|
462
488
|
approvalsReviewer: runtime.approvalsReviewer,
|
|
463
489
|
sandbox: runtime.sandbox,
|
|
@@ -469,12 +495,17 @@ async function createThread(params) {
|
|
|
469
495
|
await writeCodexAppServerBinding(params.sessionFile, {
|
|
470
496
|
threadId: response.thread.id,
|
|
471
497
|
cwd: response.thread.cwd ?? params.workspaceDir,
|
|
498
|
+
authProfileId: params.authProfileId,
|
|
472
499
|
model: response.model ?? params.model,
|
|
473
|
-
modelProvider:
|
|
500
|
+
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
501
|
+
config: params.config,
|
|
502
|
+
authProfileId: params.authProfileId,
|
|
503
|
+
modelProvider: response.modelProvider ?? params.modelProvider
|
|
504
|
+
}),
|
|
474
505
|
approvalPolicy: runtime.approvalPolicy,
|
|
475
506
|
sandbox: runtime.sandbox,
|
|
476
507
|
serviceTier: runtime.serviceTier
|
|
477
|
-
});
|
|
508
|
+
}, { config: params.config });
|
|
478
509
|
}
|
|
479
510
|
async function runBoundTurn(params) {
|
|
480
511
|
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
|
|
@@ -542,8 +573,14 @@ function enqueueBoundTurn(key, run) {
|
|
|
542
573
|
state.queues.set(key, queued);
|
|
543
574
|
next.finally(() => {
|
|
544
575
|
if (state.queues.get(key) === queued) state.queues.delete(key);
|
|
545
|
-
});
|
|
576
|
+
}).catch(() => void 0);
|
|
546
577
|
return next;
|
|
547
578
|
}
|
|
579
|
+
function resolveThreadRequestModelProvider(params) {
|
|
580
|
+
const modelProvider = params.modelProvider?.trim();
|
|
581
|
+
if (!modelProvider || modelProvider.toLowerCase() === "codex") return;
|
|
582
|
+
if (isCodexAppServerNativeAuthProfile(params) && (modelProvider.toLowerCase() === "openai" || modelProvider.toLowerCase() === "openai-codex")) return;
|
|
583
|
+
return modelProvider.toLowerCase() === "openai-codex" ? "openai" : modelProvider;
|
|
584
|
+
}
|
|
548
585
|
//#endregion
|
|
549
586
|
export { parseCodexFastModeArg as a, setCodexConversationFastMode as c, steerCodexConversationTurn as d, stopCodexConversationTurn as f, formatPermissionsMode as i, setCodexConversationModel as l, resolveCodexDefaultWorkspaceDir as m, handleCodexConversationInboundClaim as n, parseCodexPermissionsModeArg as o, readCodexConversationBindingData as p, startCodexConversationThread as r, readCodexConversationActiveTurn as s, handleCodexConversationBindingResolved as t, setCodexConversationPermissions as u };
|
package/dist/harness.js
CHANGED
|
@@ -18,21 +18,21 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
18
18
|
};
|
|
19
19
|
},
|
|
20
20
|
runAttempt: async (params) => {
|
|
21
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
21
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-BNbVe-IG.js");
|
|
22
22
|
return runCodexAppServerAttempt(params, { pluginConfig: options?.pluginConfig });
|
|
23
23
|
},
|
|
24
24
|
compact: async (params) => {
|
|
25
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
25
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-C0_rGlHZ.js");
|
|
26
26
|
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.pluginConfig });
|
|
27
27
|
},
|
|
28
28
|
reset: async (params) => {
|
|
29
29
|
if (params.sessionFile) {
|
|
30
|
-
const { clearCodexAppServerBinding } = await import("./session-binding-
|
|
30
|
+
const { clearCodexAppServerBinding } = await import("./session-binding-DuJYTJQy.js").then((n) => n.a);
|
|
31
31
|
await clearCodexAppServerBinding(params.sessionFile);
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
dispose: async () => {
|
|
35
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-
|
|
35
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-0El8eRIE.js").then((n) => n.r);
|
|
36
36
|
await clearSharedCodexAppServerClientAndWait();
|
|
37
37
|
}
|
|
38
38
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCodexAppServerAgentHarness } from "./harness.js";
|
|
2
2
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
3
3
|
import { buildCodexProvider } from "./provider.js";
|
|
4
|
-
import { n as handleCodexConversationInboundClaim, t as handleCodexConversationBindingResolved } from "./conversation-binding-
|
|
4
|
+
import { n as handleCodexConversationInboundClaim, t as handleCodexConversationBindingResolved } from "./conversation-binding-DjptpT9W.js";
|
|
5
5
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
6
6
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
@@ -23,7 +23,7 @@ function createCodexCommand(options) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
async function handleCodexCommand(ctx, options = {}) {
|
|
26
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
26
|
+
const { handleCodexSubcommand } = await import("./command-handlers-CeaXhO5y.js");
|
|
27
27
|
return await handleCodexSubcommand(ctx, options);
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
|
|
2
2
|
import { i as resolveCodexAppServerRuntimeOptions } from "./config-CkkoMeqF.js";
|
|
3
3
|
import { a as readCodexErrorNotification, c as readCodexTurnCompletedNotification, n as assertCodexThreadStartResponse, r as assertCodexTurnStartResponse } from "./protocol-validators-Cpopom3_.js";
|
|
4
|
-
import { i as readModelListResult } from "./models-
|
|
4
|
+
import { i as readModelListResult } from "./models-Ds7g6191.js";
|
|
5
5
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
6
6
|
//#region extensions/codex/media-understanding-provider.ts
|
|
7
7
|
const DEFAULT_CODEX_IMAGE_MODEL = FALLBACK_CODEX_MODELS.find((model) => model.inputModalities.includes("image"))?.id ?? FALLBACK_CODEX_MODELS[0]?.id;
|
|
@@ -37,7 +37,7 @@ async function describeCodexImages(req, options) {
|
|
|
37
37
|
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: options.pluginConfig });
|
|
38
38
|
const timeoutMs = Math.max(100, req.timeoutMs);
|
|
39
39
|
const ownsClient = !options.clientFactory;
|
|
40
|
-
const client = options.clientFactory ? await options.clientFactory(appServer.start, req.profile) : await import("./shared-client-
|
|
40
|
+
const client = options.clientFactory ? await options.clientFactory(appServer.start, req.profile) : await import("./shared-client-0El8eRIE.js").then((n) => n.r).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
41
41
|
startOptions: appServer.start,
|
|
42
42
|
timeoutMs,
|
|
43
43
|
authProfileId: req.profile
|
|
@@ -39,7 +39,7 @@ async function listAllCodexAppServerModels(options = {}) {
|
|
|
39
39
|
async function withCodexAppServerModelClient(options, run) {
|
|
40
40
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
41
41
|
const useSharedClient = options.sharedClient !== false;
|
|
42
|
-
const { createIsolatedCodexAppServerClient, getSharedCodexAppServerClient } = await import("./shared-client-
|
|
42
|
+
const { createIsolatedCodexAppServerClient, getSharedCodexAppServerClient } = await import("./shared-client-0El8eRIE.js").then((n) => n.r);
|
|
43
43
|
const client = useSharedClient ? await getSharedCodexAppServerClient({
|
|
44
44
|
startOptions: options.startOptions,
|
|
45
45
|
timeoutMs,
|
package/dist/provider.js
CHANGED
|
@@ -123,7 +123,7 @@ async function listModelsBestEffort(params) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
async function listCodexAppServerModelsLazy(options) {
|
|
126
|
-
const { listCodexAppServerModels } = await import("./models-
|
|
126
|
+
const { listCodexAppServerModels } = await import("./models-Ds7g6191.js").then((n) => n.r);
|
|
127
127
|
return listCodexAppServerModels(options);
|
|
128
128
|
}
|
|
129
129
|
function normalizeTimeoutMs(value) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as resolveCodexAppServerRuntimeOptions, r as readCodexPluginConfig } from "./config-CkkoMeqF.js";
|
|
2
2
|
import { i as readCodexDynamicToolCallParams, r as assertCodexTurnStartResponse, s as readCodexTurn } from "./protocol-validators-Cpopom3_.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { i as isCodexAppServerConnectionClosedError, r as isCodexAppServerApprovalRequest } from "./client-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { a as startOrResumeThread, i as buildTurnStartParams, o as createCodexDynamicToolBridge, s as applyCodexDynamicToolProfile, t as buildDeveloperInstructions } from "./thread-lifecycle-
|
|
8
|
-
import { n as defaultCodexAppServerClientFactory, t as createCodexAppServerClientFactoryTestHooks } from "./client-factory-
|
|
9
|
-
import { t as ensureCodexComputerUse } from "./computer-use-
|
|
4
|
+
import { i as isCodexAppServerConnectionClosedError, r as isCodexAppServerApprovalRequest } from "./client-chGfNrq5.js";
|
|
5
|
+
import { a as refreshCodexAppServerAuthTokens, o as resolveCodexAppServerAuthProfileId, s as resolveCodexAppServerAuthProfileIdForAgent, t as clearSharedCodexAppServerClientIfCurrent } from "./shared-client-0El8eRIE.js";
|
|
6
|
+
import { i as readCodexAppServerBinding } from "./session-binding-DuJYTJQy.js";
|
|
7
|
+
import { a as startOrResumeThread, i as buildTurnStartParams, o as createCodexDynamicToolBridge, s as applyCodexDynamicToolProfile, t as buildDeveloperInstructions } from "./thread-lifecycle-OAlp5Pku.js";
|
|
8
|
+
import { n as defaultCodexAppServerClientFactory, t as createCodexAppServerClientFactoryTestHooks } from "./client-factory-MaOMEltT.js";
|
|
9
|
+
import { t as ensureCodexComputerUse } from "./computer-use-amNk2zrB.js";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import { TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, bootstrapHarnessContextEngine, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, callGatewayTool, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatApprovalDisplayPath, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, normalizeAgentRuntimeTools, normalizeUsage, registerNativeHookRelay, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveModelAuthMode, resolveOpenClawAgentDir, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockAcquireTimeoutMs, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
12
12
|
import fs from "node:fs/promises";
|
|
@@ -2428,14 +2428,24 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2428
2428
|
agentId: params.agentId
|
|
2429
2429
|
});
|
|
2430
2430
|
const agentDir = params.agentDir ?? resolveOpenClawAgentDir();
|
|
2431
|
+
const startupBinding = await readCodexAppServerBinding(params.sessionFile);
|
|
2432
|
+
const startupAuthProfileCandidate = params.runtimePlan?.auth.forwardedAuthProfileId ?? params.authProfileId ?? startupBinding?.authProfileId;
|
|
2433
|
+
const startupAuthProfileId = params.authProfileStore ? resolveCodexAppServerAuthProfileId({
|
|
2434
|
+
authProfileId: startupAuthProfileCandidate,
|
|
2435
|
+
store: params.authProfileStore,
|
|
2436
|
+
config: params.config
|
|
2437
|
+
}) : resolveCodexAppServerAuthProfileIdForAgent({
|
|
2438
|
+
authProfileId: startupAuthProfileCandidate,
|
|
2439
|
+
agentDir,
|
|
2440
|
+
config: params.config
|
|
2441
|
+
});
|
|
2431
2442
|
const runtimeParams = {
|
|
2432
2443
|
...params,
|
|
2433
|
-
sessionKey: sandboxSessionKey
|
|
2444
|
+
sessionKey: sandboxSessionKey,
|
|
2445
|
+
...startupAuthProfileId ? { authProfileId: startupAuthProfileId } : {}
|
|
2434
2446
|
};
|
|
2435
2447
|
const activeContextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
|
|
2436
2448
|
let yieldDetected = false;
|
|
2437
|
-
const startupBinding = await readCodexAppServerBinding(params.sessionFile);
|
|
2438
|
-
const startupAuthProfileId = params.runtimePlan?.auth.forwardedAuthProfileId ?? params.authProfileId ?? startupBinding?.authProfileId;
|
|
2439
2449
|
const toolBridge = createCodexDynamicToolBridge({
|
|
2440
2450
|
tools: await buildDynamicTools({
|
|
2441
2451
|
params,
|
|
@@ -2581,7 +2591,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2581
2591
|
client: startupClient,
|
|
2582
2592
|
thread: await startOrResumeThread({
|
|
2583
2593
|
client: startupClient,
|
|
2584
|
-
params,
|
|
2594
|
+
params: runtimeParams,
|
|
2585
2595
|
cwd: effectiveWorkspace,
|
|
2586
2596
|
dynamicTools: toolBridge.specs,
|
|
2587
2597
|
appServer,
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
2
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
|
+
import { ensureAuthProfileStore, resolveOpenClawAgentDir as resolveOpenClawAgentDir$1, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
|
|
4
5
|
//#region extensions/codex/src/app-server/session-binding.ts
|
|
5
6
|
var session_binding_exports = /* @__PURE__ */ __exportAll({
|
|
6
7
|
clearCodexAppServerBinding: () => clearCodexAppServerBinding,
|
|
8
|
+
isCodexAppServerNativeAuthProfile: () => isCodexAppServerNativeAuthProfile,
|
|
9
|
+
normalizeCodexAppServerBindingModelProvider: () => normalizeCodexAppServerBindingModelProvider,
|
|
7
10
|
readCodexAppServerBinding: () => readCodexAppServerBinding,
|
|
8
11
|
resolveCodexAppServerBindingPath: () => resolveCodexAppServerBindingPath,
|
|
9
12
|
writeCodexAppServerBinding: () => writeCodexAppServerBinding
|
|
10
13
|
});
|
|
14
|
+
const CODEX_APP_SERVER_NATIVE_AUTH_PROVIDER = "openai-codex";
|
|
15
|
+
const PUBLIC_OPENAI_MODEL_PROVIDER = "openai";
|
|
11
16
|
function resolveCodexAppServerBindingPath(sessionFile) {
|
|
12
17
|
return `${sessionFile}.codex-app-server.json`;
|
|
13
18
|
}
|
|
14
|
-
async function readCodexAppServerBinding(sessionFile) {
|
|
19
|
+
async function readCodexAppServerBinding(sessionFile, lookup = {}) {
|
|
15
20
|
const path = resolveCodexAppServerBindingPath(sessionFile);
|
|
16
21
|
let raw;
|
|
17
22
|
try {
|
|
@@ -27,14 +32,19 @@ async function readCodexAppServerBinding(sessionFile) {
|
|
|
27
32
|
try {
|
|
28
33
|
const parsed = JSON.parse(raw);
|
|
29
34
|
if (parsed.schemaVersion !== 1 || typeof parsed.threadId !== "string") return;
|
|
35
|
+
const authProfileId = typeof parsed.authProfileId === "string" ? parsed.authProfileId : void 0;
|
|
30
36
|
return {
|
|
31
37
|
schemaVersion: 1,
|
|
32
38
|
threadId: parsed.threadId,
|
|
33
39
|
sessionFile,
|
|
34
40
|
cwd: typeof parsed.cwd === "string" ? parsed.cwd : "",
|
|
35
|
-
authProfileId
|
|
41
|
+
authProfileId,
|
|
36
42
|
model: typeof parsed.model === "string" ? parsed.model : void 0,
|
|
37
|
-
modelProvider:
|
|
43
|
+
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
44
|
+
...lookup,
|
|
45
|
+
authProfileId,
|
|
46
|
+
modelProvider: typeof parsed.modelProvider === "string" ? parsed.modelProvider : void 0
|
|
47
|
+
}),
|
|
38
48
|
approvalPolicy: readApprovalPolicy(parsed.approvalPolicy),
|
|
39
49
|
sandbox: readSandboxMode(parsed.sandbox),
|
|
40
50
|
serviceTier: readServiceTier(parsed.serviceTier),
|
|
@@ -50,7 +60,7 @@ async function readCodexAppServerBinding(sessionFile) {
|
|
|
50
60
|
return;
|
|
51
61
|
}
|
|
52
62
|
}
|
|
53
|
-
async function writeCodexAppServerBinding(sessionFile, binding) {
|
|
63
|
+
async function writeCodexAppServerBinding(sessionFile, binding, lookup = {}) {
|
|
54
64
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
55
65
|
const payload = {
|
|
56
66
|
schemaVersion: 1,
|
|
@@ -59,7 +69,11 @@ async function writeCodexAppServerBinding(sessionFile, binding) {
|
|
|
59
69
|
cwd: binding.cwd,
|
|
60
70
|
authProfileId: binding.authProfileId,
|
|
61
71
|
model: binding.model,
|
|
62
|
-
modelProvider:
|
|
72
|
+
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
73
|
+
...lookup,
|
|
74
|
+
authProfileId: binding.authProfileId,
|
|
75
|
+
modelProvider: binding.modelProvider
|
|
76
|
+
}),
|
|
63
77
|
approvalPolicy: binding.approvalPolicy,
|
|
64
78
|
sandbox: binding.sandbox,
|
|
65
79
|
serviceTier: binding.serviceTier,
|
|
@@ -82,6 +96,43 @@ async function clearCodexAppServerBinding(sessionFile) {
|
|
|
82
96
|
function isNotFound(error) {
|
|
83
97
|
return Boolean(error && typeof error === "object" && "code" in error && error.code === "ENOENT");
|
|
84
98
|
}
|
|
99
|
+
function isCodexAppServerNativeAuthProfile(lookup) {
|
|
100
|
+
const authProfileId = lookup.authProfileId?.trim();
|
|
101
|
+
if (!authProfileId) return false;
|
|
102
|
+
try {
|
|
103
|
+
return isCodexAppServerNativeAuthProvider({
|
|
104
|
+
provider: resolveCodexAppServerAuthProfileCredential({
|
|
105
|
+
...lookup,
|
|
106
|
+
authProfileId
|
|
107
|
+
})?.provider,
|
|
108
|
+
config: lookup.config
|
|
109
|
+
});
|
|
110
|
+
} catch (error) {
|
|
111
|
+
embeddedAgentLog.debug("failed to resolve codex app-server auth profile provider", {
|
|
112
|
+
authProfileId,
|
|
113
|
+
error
|
|
114
|
+
});
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function normalizeCodexAppServerBindingModelProvider(params) {
|
|
119
|
+
const modelProvider = params.modelProvider?.trim();
|
|
120
|
+
if (!modelProvider) return;
|
|
121
|
+
if (isCodexAppServerNativeAuthProfile(params) && modelProvider.toLowerCase() === PUBLIC_OPENAI_MODEL_PROVIDER) return;
|
|
122
|
+
return modelProvider;
|
|
123
|
+
}
|
|
124
|
+
function resolveCodexAppServerAuthProfileCredential(lookup) {
|
|
125
|
+
const authProfileId = lookup.authProfileId?.trim();
|
|
126
|
+
if (!authProfileId) return;
|
|
127
|
+
return (lookup.authProfileStore ?? loadCodexAppServerAuthProfileStore(lookup.agentDir)).profiles[authProfileId];
|
|
128
|
+
}
|
|
129
|
+
function loadCodexAppServerAuthProfileStore(agentDir) {
|
|
130
|
+
return ensureAuthProfileStore(agentDir?.trim() || resolveOpenClawAgentDir$1(), { allowKeychainPrompt: false });
|
|
131
|
+
}
|
|
132
|
+
function isCodexAppServerNativeAuthProvider(params) {
|
|
133
|
+
const provider = params.provider?.trim();
|
|
134
|
+
return Boolean(provider && resolveProviderIdForAuth(provider, { config: params.config }) === CODEX_APP_SERVER_NATIVE_AUTH_PROVIDER);
|
|
135
|
+
}
|
|
85
136
|
function readApprovalPolicy(value) {
|
|
86
137
|
return value === "never" || value === "on-request" || value === "on-failure" || value === "untrusted" ? value : void 0;
|
|
87
138
|
}
|
|
@@ -92,4 +143,4 @@ function readServiceTier(value) {
|
|
|
92
143
|
return value === "fast" || value === "flex" ? value : void 0;
|
|
93
144
|
}
|
|
94
145
|
//#endregion
|
|
95
|
-
export {
|
|
146
|
+
export { session_binding_exports as a, readCodexAppServerBinding as i, isCodexAppServerNativeAuthProfile as n, writeCodexAppServerBinding as o, normalizeCodexAppServerBindingModelProvider as r, clearCodexAppServerBinding as t };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
2
|
import { i as resolveCodexAppServerRuntimeOptions, t as codexAppServerStartOptionsKey } from "./config-CkkoMeqF.js";
|
|
3
|
-
import { a as MANAGED_CODEX_APP_SERVER_PACKAGE, o as resolveCodexAppServerSpawnEnv, t as CodexAppServerClient } from "./client-
|
|
3
|
+
import { a as MANAGED_CODEX_APP_SERVER_PACKAGE, o as resolveCodexAppServerSpawnEnv, t as CodexAppServerClient } from "./client-chGfNrq5.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import fs, { access } from "node:fs/promises";
|
|
6
|
-
import { resolveOpenClawAgentDir } from "openclaw/plugin-sdk/provider-auth";
|
|
7
6
|
import path from "node:path";
|
|
8
|
-
import { ensureAuthProfileStore, loadAuthProfileStoreForSecretsRuntime, resolveApiKeyForProfile, resolvePersistedAuthProfileOwnerAgentDir, resolveProviderIdForAuth, saveAuthProfileStore } from "openclaw/plugin-sdk/agent-runtime";
|
|
7
|
+
import { ensureAuthProfileStore, loadAuthProfileStoreForSecretsRuntime, resolveApiKeyForProfile, resolveAuthProfileOrder, resolveOpenClawAgentDir, resolvePersistedAuthProfileOwnerAgentDir, resolveProviderIdForAuth, saveAuthProfileStore } from "openclaw/plugin-sdk/agent-runtime";
|
|
8
|
+
import { resolveOpenClawAgentDir as resolveOpenClawAgentDir$1 } from "openclaw/plugin-sdk/provider-auth";
|
|
9
9
|
import { constants, readFileSync } from "node:fs";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
//#region extensions/codex/src/app-server/auth-bridge.ts
|
|
@@ -20,11 +20,32 @@ const CODEX_APP_SERVER_ISOLATION_ENV_VARS = [CODEX_HOME_ENV_VAR, HOME_ENV_VAR];
|
|
|
20
20
|
async function bridgeCodexAppServerStartOptions(params) {
|
|
21
21
|
if (params.startOptions.transport !== "stdio") return params.startOptions;
|
|
22
22
|
const isolatedStartOptions = await withAgentCodexHomeEnvironment(params.startOptions, params.agentDir);
|
|
23
|
+
const store = ensureAuthProfileStore(params.agentDir, { allowKeychainPrompt: false });
|
|
23
24
|
return shouldClearOpenAiApiKeyForCodexAuthProfile({
|
|
24
|
-
store
|
|
25
|
-
authProfileId:
|
|
25
|
+
store,
|
|
26
|
+
authProfileId: resolveCodexAppServerAuthProfileId({
|
|
27
|
+
authProfileId: params.authProfileId,
|
|
28
|
+
store
|
|
29
|
+
})
|
|
26
30
|
}) ? withClearedEnvironmentVariables(isolatedStartOptions, CODEX_APP_SERVER_API_KEY_ENV_VARS) : isolatedStartOptions;
|
|
27
31
|
}
|
|
32
|
+
function resolveCodexAppServerAuthProfileId(params) {
|
|
33
|
+
const requested = params.authProfileId?.trim();
|
|
34
|
+
if (requested) return requested;
|
|
35
|
+
return resolveAuthProfileOrder({
|
|
36
|
+
cfg: params.config,
|
|
37
|
+
store: params.store,
|
|
38
|
+
provider: CODEX_APP_SERVER_AUTH_PROVIDER
|
|
39
|
+
})[0]?.trim();
|
|
40
|
+
}
|
|
41
|
+
function resolveCodexAppServerAuthProfileIdForAgent(params) {
|
|
42
|
+
const store = ensureAuthProfileStore(params.agentDir?.trim() || resolveOpenClawAgentDir(), { allowKeychainPrompt: false });
|
|
43
|
+
return resolveCodexAppServerAuthProfileId({
|
|
44
|
+
authProfileId: params.authProfileId,
|
|
45
|
+
store,
|
|
46
|
+
config: params.config
|
|
47
|
+
});
|
|
48
|
+
}
|
|
28
49
|
function resolveCodexAppServerHomeDir(agentDir) {
|
|
29
50
|
return path.join(path.resolve(agentDir), CODEX_APP_SERVER_HOME_DIRNAME);
|
|
30
51
|
}
|
|
@@ -85,9 +106,13 @@ async function refreshCodexAppServerAuthTokens(params) {
|
|
|
85
106
|
};
|
|
86
107
|
}
|
|
87
108
|
async function resolveCodexAppServerAuthProfileLoginParamsInternal(params) {
|
|
88
|
-
const
|
|
109
|
+
const store = ensureAuthProfileStore(params.agentDir, { allowKeychainPrompt: false });
|
|
110
|
+
const profileId = resolveCodexAppServerAuthProfileId({
|
|
111
|
+
authProfileId: params.authProfileId,
|
|
112
|
+
store
|
|
113
|
+
});
|
|
89
114
|
if (!profileId) return;
|
|
90
|
-
const credential =
|
|
115
|
+
const credential = store.profiles[profileId];
|
|
91
116
|
if (!credential) throw new Error(`Codex app-server auth profile "${profileId}" was not found.`);
|
|
92
117
|
if (!isCodexAppServerAuthProvider(credential.provider)) throw new Error(`Codex app-server auth profile "${profileId}" must belong to provider "openai-codex" or a supported alias.`);
|
|
93
118
|
const loginParams = await resolveLoginParamsForCredential(profileId, credential, {
|
|
@@ -336,7 +361,7 @@ function getSharedCodexAppServerClientState() {
|
|
|
336
361
|
}
|
|
337
362
|
async function getSharedCodexAppServerClient(options) {
|
|
338
363
|
const state = getSharedCodexAppServerClientState();
|
|
339
|
-
const agentDir = options?.agentDir ?? resolveOpenClawAgentDir();
|
|
364
|
+
const agentDir = options?.agentDir ?? resolveOpenClawAgentDir$1();
|
|
340
365
|
const startOptions = await bridgeCodexAppServerStartOptions({
|
|
341
366
|
startOptions: await resolveManagedCodexAppServerStartOptions(options?.startOptions ?? resolveCodexAppServerRuntimeOptions().start),
|
|
342
367
|
agentDir,
|
|
@@ -374,7 +399,7 @@ async function getSharedCodexAppServerClient(options) {
|
|
|
374
399
|
}
|
|
375
400
|
}
|
|
376
401
|
async function createIsolatedCodexAppServerClient(options) {
|
|
377
|
-
const agentDir = options?.agentDir ?? resolveOpenClawAgentDir();
|
|
402
|
+
const agentDir = options?.agentDir ?? resolveOpenClawAgentDir$1();
|
|
378
403
|
const startOptions = await bridgeCodexAppServerStartOptions({
|
|
379
404
|
startOptions: await resolveManagedCodexAppServerStartOptions(options?.startOptions ?? resolveCodexAppServerRuntimeOptions().start),
|
|
380
405
|
agentDir,
|
|
@@ -431,4 +456,4 @@ function clearSharedClientIfCurrent(client) {
|
|
|
431
456
|
state.key = void 0;
|
|
432
457
|
}
|
|
433
458
|
//#endregion
|
|
434
|
-
export { refreshCodexAppServerAuthTokens as a, withTimeout as i, getSharedCodexAppServerClient as n, shared_client_exports as r, clearSharedCodexAppServerClientIfCurrent as t };
|
|
459
|
+
export { refreshCodexAppServerAuthTokens as a, withTimeout as i, getSharedCodexAppServerClient as n, resolveCodexAppServerAuthProfileId as o, shared_client_exports as r, resolveCodexAppServerAuthProfileIdForAgent as s, clearSharedCodexAppServerClientIfCurrent as t };
|
package/dist/test-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as resolveCodexAppServerRuntimeOptions } from "./config-CkkoMeqF.js";
|
|
2
|
-
import { i as buildTurnStartParams, n as buildThreadResumeParams, o as createCodexDynamicToolBridge, r as buildThreadStartParams, s as applyCodexDynamicToolProfile, t as buildDeveloperInstructions } from "./thread-lifecycle-
|
|
2
|
+
import { i as buildTurnStartParams, n as buildThreadResumeParams, o as createCodexDynamicToolBridge, r as buildThreadStartParams, s as applyCodexDynamicToolProfile, t as buildDeveloperInstructions } from "./thread-lifecycle-OAlp5Pku.js";
|
|
3
3
|
//#region extensions/codex/test-api.ts
|
|
4
4
|
function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
|
|
5
5
|
return resolveCodexAppServerRuntimeOptions({
|
|
@@ -3,8 +3,8 @@ import { n as assertCodexThreadStartResponse, t as assertCodexThreadResumeRespon
|
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
4
|
import { CODEX_GPT5_HEARTBEAT_PROMPT_OVERLAY, renderCodexPromptOverlay } from "./prompt-overlay.js";
|
|
5
5
|
import { isModernCodexModel } from "./provider.js";
|
|
6
|
-
import { i as isCodexAppServerConnectionClosedError } from "./client-
|
|
7
|
-
import { i as
|
|
6
|
+
import { i as isCodexAppServerConnectionClosedError } from "./client-chGfNrq5.js";
|
|
7
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-DuJYTJQy.js";
|
|
8
8
|
import { HEARTBEAT_RESPONSE_TOOL_NAME, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractToolResultMediaArtifact, filterToolResultMediaUrls, isMessagingTool, isMessagingToolSendAction, isToolWrappedWithBeforeToolCallHook, normalizeHeartbeatToolResponse, runAgentHarnessAfterToolCallHook, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
9
9
|
//#region extensions/codex/src/app-server/dynamic-tool-profile.ts
|
|
10
10
|
const CODEX_NATIVE_FIRST_DYNAMIC_TOOL_EXCLUDES = [
|
|
@@ -260,19 +260,31 @@ function isCronAddAction(args) {
|
|
|
260
260
|
//#region extensions/codex/src/app-server/thread-lifecycle.ts
|
|
261
261
|
async function startOrResumeThread(params) {
|
|
262
262
|
const dynamicToolsFingerprint = fingerprintDynamicTools(params.dynamicTools);
|
|
263
|
-
const binding = await readCodexAppServerBinding(params.params.sessionFile
|
|
263
|
+
const binding = await readCodexAppServerBinding(params.params.sessionFile, {
|
|
264
|
+
authProfileStore: params.params.authProfileStore,
|
|
265
|
+
agentDir: params.params.agentDir,
|
|
266
|
+
config: params.params.config
|
|
267
|
+
});
|
|
264
268
|
if (binding?.threadId) if (binding.dynamicToolsFingerprint && binding.dynamicToolsFingerprint !== dynamicToolsFingerprint) {
|
|
265
269
|
embeddedAgentLog.debug("codex app-server dynamic tool catalog changed; starting a new thread", { threadId: binding.threadId });
|
|
266
270
|
await clearCodexAppServerBinding(params.params.sessionFile);
|
|
267
271
|
} else try {
|
|
272
|
+
const authProfileId = params.params.authProfileId ?? binding.authProfileId;
|
|
268
273
|
const response = assertCodexThreadResumeResponse(await params.client.request("thread/resume", buildThreadResumeParams(params.params, {
|
|
269
274
|
threadId: binding.threadId,
|
|
275
|
+
authProfileId,
|
|
270
276
|
appServer: params.appServer,
|
|
271
277
|
developerInstructions: params.developerInstructions,
|
|
272
278
|
config: params.config
|
|
273
279
|
})));
|
|
274
|
-
const boundAuthProfileId =
|
|
275
|
-
const fallbackModelProvider = resolveCodexAppServerModelProvider(
|
|
280
|
+
const boundAuthProfileId = authProfileId;
|
|
281
|
+
const fallbackModelProvider = resolveCodexAppServerModelProvider({
|
|
282
|
+
provider: params.params.provider,
|
|
283
|
+
authProfileId: boundAuthProfileId,
|
|
284
|
+
authProfileStore: params.params.authProfileStore,
|
|
285
|
+
agentDir: params.params.agentDir,
|
|
286
|
+
config: params.params.config
|
|
287
|
+
});
|
|
276
288
|
await writeCodexAppServerBinding(params.params.sessionFile, {
|
|
277
289
|
threadId: response.thread.id,
|
|
278
290
|
cwd: params.cwd,
|
|
@@ -281,6 +293,10 @@ async function startOrResumeThread(params) {
|
|
|
281
293
|
modelProvider: response.modelProvider ?? fallbackModelProvider,
|
|
282
294
|
dynamicToolsFingerprint,
|
|
283
295
|
createdAt: binding.createdAt
|
|
296
|
+
}, {
|
|
297
|
+
authProfileStore: params.params.authProfileStore,
|
|
298
|
+
agentDir: params.params.agentDir,
|
|
299
|
+
config: params.params.config
|
|
284
300
|
});
|
|
285
301
|
return {
|
|
286
302
|
...binding,
|
|
@@ -303,7 +319,13 @@ async function startOrResumeThread(params) {
|
|
|
303
319
|
developerInstructions: params.developerInstructions,
|
|
304
320
|
config: params.config
|
|
305
321
|
})));
|
|
306
|
-
const modelProvider = resolveCodexAppServerModelProvider(
|
|
322
|
+
const modelProvider = resolveCodexAppServerModelProvider({
|
|
323
|
+
provider: params.params.provider,
|
|
324
|
+
authProfileId: params.params.authProfileId,
|
|
325
|
+
authProfileStore: params.params.authProfileStore,
|
|
326
|
+
agentDir: params.params.agentDir,
|
|
327
|
+
config: params.params.config
|
|
328
|
+
});
|
|
307
329
|
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
308
330
|
await writeCodexAppServerBinding(params.params.sessionFile, {
|
|
309
331
|
threadId: response.thread.id,
|
|
@@ -313,6 +335,10 @@ async function startOrResumeThread(params) {
|
|
|
313
335
|
modelProvider: response.modelProvider ?? modelProvider,
|
|
314
336
|
dynamicToolsFingerprint,
|
|
315
337
|
createdAt
|
|
338
|
+
}, {
|
|
339
|
+
authProfileStore: params.params.authProfileStore,
|
|
340
|
+
agentDir: params.params.agentDir,
|
|
341
|
+
config: params.params.config
|
|
316
342
|
});
|
|
317
343
|
return {
|
|
318
344
|
schemaVersion: 1,
|
|
@@ -328,7 +354,13 @@ async function startOrResumeThread(params) {
|
|
|
328
354
|
};
|
|
329
355
|
}
|
|
330
356
|
function buildThreadStartParams(params, options) {
|
|
331
|
-
const modelProvider = resolveCodexAppServerModelProvider(
|
|
357
|
+
const modelProvider = resolveCodexAppServerModelProvider({
|
|
358
|
+
provider: params.provider,
|
|
359
|
+
authProfileId: params.authProfileId,
|
|
360
|
+
authProfileStore: params.authProfileStore,
|
|
361
|
+
agentDir: params.agentDir,
|
|
362
|
+
config: params.config
|
|
363
|
+
});
|
|
332
364
|
return {
|
|
333
365
|
model: params.modelId,
|
|
334
366
|
...modelProvider ? { modelProvider } : {},
|
|
@@ -346,7 +378,13 @@ function buildThreadStartParams(params, options) {
|
|
|
346
378
|
};
|
|
347
379
|
}
|
|
348
380
|
function buildThreadResumeParams(params, options) {
|
|
349
|
-
const modelProvider = resolveCodexAppServerModelProvider(
|
|
381
|
+
const modelProvider = resolveCodexAppServerModelProvider({
|
|
382
|
+
provider: params.provider,
|
|
383
|
+
authProfileId: options.authProfileId ?? params.authProfileId,
|
|
384
|
+
authProfileStore: params.authProfileStore,
|
|
385
|
+
agentDir: params.agentDir,
|
|
386
|
+
config: params.config
|
|
387
|
+
});
|
|
350
388
|
return {
|
|
351
389
|
threadId: options.threadId,
|
|
352
390
|
model: params.modelId,
|
|
@@ -446,10 +484,12 @@ function buildUserInput(params, promptText = params.prompt) {
|
|
|
446
484
|
url: `data:${image.mimeType};base64,${image.data}`
|
|
447
485
|
}))];
|
|
448
486
|
}
|
|
449
|
-
function resolveCodexAppServerModelProvider(
|
|
450
|
-
const normalized = provider.trim();
|
|
451
|
-
|
|
452
|
-
|
|
487
|
+
function resolveCodexAppServerModelProvider(params) {
|
|
488
|
+
const normalized = params.provider.trim();
|
|
489
|
+
const normalizedLower = normalized.toLowerCase();
|
|
490
|
+
if (!normalized || normalizedLower === "codex") return;
|
|
491
|
+
if (isCodexAppServerNativeAuthProfile(params) && (normalizedLower === "openai" || normalizedLower === "openai-codex")) return;
|
|
492
|
+
return normalizedLower === "openai-codex" ? "openai" : normalized;
|
|
453
493
|
}
|
|
454
494
|
function resolveReasoningEffort(thinkLevel, modelId) {
|
|
455
495
|
if (thinkLevel === "minimal") return isModernCodexModel(modelId) ? "low" : "minimal";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.3-beta.
|
|
3
|
+
"version": "2026.5.3-beta.4",
|
|
4
4
|
"description": "OpenClaw Codex harness and model provider plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"minHostVersion": ">=2026.5.1-beta.1"
|
|
28
28
|
},
|
|
29
29
|
"compat": {
|
|
30
|
-
"pluginApi": ">=2026.5.3-beta.
|
|
30
|
+
"pluginApi": ">=2026.5.3-beta.4"
|
|
31
31
|
},
|
|
32
32
|
"build": {
|
|
33
|
-
"openclawVersion": "2026.5.3-beta.
|
|
33
|
+
"openclawVersion": "2026.5.3-beta.4"
|
|
34
34
|
},
|
|
35
35
|
"release": {
|
|
36
36
|
"publishToClawHub": true,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"openclaw.plugin.json"
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"openclaw": ">=2026.5.3-beta.
|
|
48
|
+
"openclaw": ">=2026.5.3-beta.4"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"openclaw": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as resolveCodexAppServerRuntimeOptions } from "./config-CkkoMeqF.js";
|
|
2
2
|
import { n as isRpcResponse } from "./protocol-C9UWI98H.js";
|
|
3
3
|
import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
|
-
import { createInterface } from "node:readline";
|
|
5
4
|
import { spawn } from "node:child_process";
|
|
6
5
|
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
6
|
+
import { createInterface } from "node:readline";
|
|
7
7
|
import { EventEmitter } from "node:events";
|
|
8
8
|
import { PassThrough, Writable } from "node:stream";
|
|
9
9
|
import WebSocket from "ws";
|