@openclaw/codex 2026.7.2-beta.4 → 2026.7.2-beta.5
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/{app-server-policy-BO3jYBkv.js → app-server-policy-BmDgseo_.js} +1 -1
- package/dist/attempt-client-cleanup-Ia52yRWc.js +127 -0
- package/dist/{attempt-notifications-DdmnBMUp.js → attempt-notifications-CMR2_fmR.js} +1 -1
- package/dist/{bounded-turn-CaQL96kg.js → bounded-turn-FEbUXoYT.js} +36 -13
- package/dist/{capabilities-CLICvTxf.js → capabilities-BHRSI6Cn.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-DgADqnHa.js → command-formatters-ico4ZFnk.js} +2 -2
- package/dist/{command-handlers-l_lVPNlB.js → command-handlers-CRmnwI2N.js} +1232 -1221
- package/dist/{compact-CC5KhBzX.js → compact-dEN49UH6.js} +7 -7
- package/dist/{computer-use-Ip1-QGa-.js → computer-use-BjGylO-E.js} +16 -6
- package/dist/{conversation-control-sNPsbTCP.js → conversation-control-DE7d9DOj.js} +6 -6
- package/dist/doctor-contract-api.js +24 -86
- package/dist/{dynamic-tools-CQI3UwqY.js → dynamic-tools-LIt9ojep.js} +50 -46
- package/dist/{event-projector-usage-D6tE7_qD.js → event-projector-usage-tvgb1NCX.js} +2 -2
- package/dist/harness.js +14 -13
- package/dist/index.js +208 -267
- package/dist/media-understanding-provider.js +6 -1
- package/dist/{models-BNeMlHgg.js → models-BA01NEez.js} +2 -2
- package/dist/{notification-correlation-BGLixv5_.js → notification-correlation-Bj_Ak_jI.js} +3 -3
- package/dist/{plugin-app-cache-key-CvzvmBRz.js → plugin-app-cache-key-DSXX-rXO.js} +5 -5
- package/dist/{transcript-mirror-2p7kl6e4.js → protocol-validators-Dm4eXZmt.js} +2 -550
- package/dist/{rate-limits-D0IJT-a6.js → rate-limits-S_PXs0ul.js} +1 -1
- package/dist/realtime-voice-api-BPcA1uN9.js +494 -0
- package/dist/realtime-voice-api.js +2 -0
- package/dist/{request-BTccUTD3.js → request-CXpPennK.js} +1 -1
- package/dist/{run-attempt--858NXDl.js → run-attempt-C5GTPJOE.js} +417 -237
- package/dist/{session-binding-ZSMX1omP.js → session-binding-DlVQ-Pxs.js} +952 -890
- package/dist/{session-catalog-DsKaezgR.js → session-catalog-CP2oCcEb.js} +32 -23
- package/dist/{session-cli-CYJTfRLG.js → session-cli-CqZ0Fp2a.js} +2 -2
- package/dist/{session-upstream-marker-D7XlI9us.js → session-upstream-marker-QE-m5QFG.js} +1 -1
- package/dist/{settled-turn-finalizer-DHltNgtF.js → settled-turn-finalizer-CA_2QXIE.js} +2 -2
- package/dist/{shared-client-wmgNFNYp.js → shared-client-BVKE40c-.js} +1863 -1707
- package/dist/{side-question-BfFZCsJ-.js → side-question-CO12sHxo.js} +11 -9
- package/dist/{thread-lifecycle-cqrOlJkq.js → thread-lifecycle-DRg_FdzC.js} +12 -132
- package/dist/transcript-mirror-uKA-A4tB.js +550 -0
- package/dist/{upstream-session-fork-vPjwkT1i.js → upstream-session-fork-_Vrz4WJr.js} +3 -3
- package/dist/{usage-DM_I3mPT.js → usage-UpVbdX5G.js} +3 -3
- package/dist/{web-search-provider.runtime-Bx6HAc_k.js → web-search-provider.runtime-CaQMYDbp.js} +3 -3
- package/package.json +4 -5
- package/npm-shrinkwrap.json +0 -202
- package/dist/{auth-binding-C1czuHPA.js → auth-binding-B4FfbcCg.js} +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { V as isJsonObject, _ as CodexAppServerRpcError, a as getLeasedSharedCodexAppServerClient, l as releaseLeasedSharedCodexAppServerClient } from "./shared-client-BVKE40c-.js";
|
|
2
|
+
import { l as sessionBindingIdentity, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-DlVQ-Pxs.js";
|
|
3
|
+
import { _ as readCodexNotificationItem } from "./attempt-notifications-CMR2_fmR.js";
|
|
4
4
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-D1Wky__S.js";
|
|
5
|
-
import { a as resolveCodexBindingAppServerConnection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-
|
|
6
|
-
import { resolveAgentDir, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
|
|
5
|
+
import { a as resolveCodexBindingAppServerConnection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-Bj_Ak_jI.js";
|
|
7
6
|
import { embeddedAgentLog, resolveCompactionTimeoutMs } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
7
|
+
import { resolveAgentDir as resolveAgentDir$1, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
|
|
8
8
|
//#region extensions/codex/src/app-server/compact.ts
|
|
9
9
|
/**
|
|
10
10
|
* Native Codex app-server compaction bridge for bound OpenClaw sessions.
|
|
@@ -353,7 +353,7 @@ async function compactCodexNativeThread(params, options) {
|
|
|
353
353
|
authProfileId: requestedAuthProfileId ?? binding.authProfileId,
|
|
354
354
|
pluginConfig: options.pluginConfig,
|
|
355
355
|
config,
|
|
356
|
-
agentDir: resolveAgentDir(config, agentId)
|
|
356
|
+
agentDir: resolveAgentDir$1(config, agentId)
|
|
357
357
|
});
|
|
358
358
|
} catch (error) {
|
|
359
359
|
return {
|
|
@@ -371,7 +371,7 @@ async function compactCodexNativeThread(params, options) {
|
|
|
371
371
|
const shouldReleaseDefaultLease = !options.clientFactory;
|
|
372
372
|
const clientFactory = options.clientFactory ?? getLeasedSharedCodexAppServerClient;
|
|
373
373
|
const runtimeAuthPlan = params.runtimeAuthPlan ?? params.runtimePlan?.auth;
|
|
374
|
-
const usesPreparedApiKey = !usesSupervisionConnection && runtimeAuthPlan?.modelRoute?.authRequirement === "api-key";
|
|
374
|
+
const usesPreparedApiKey = !usesSupervisionConnection && appServer.start.homeScope !== "user" && runtimeAuthPlan?.modelRoute?.authRequirement === "api-key";
|
|
375
375
|
const preparedApiKey = usesPreparedApiKey ? params.resolvedApiKey?.trim() : void 0;
|
|
376
376
|
if (usesPreparedApiKey && !preparedApiKey) return {
|
|
377
377
|
ok: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as describeControlFailure } from "./capabilities-
|
|
4
|
-
import { r as requestCodexAppServerJson } from "./request-
|
|
1
|
+
import { C as isCodexAppServerIndeterminateTransportError, H as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, S as isCodexAppServerIndeterminateRequestCancellationError, a as getLeasedSharedCodexAppServerClient, g as acquireCodexNativeConfigFence, l as releaseLeasedSharedCodexAppServerClient, u as resolveCodexNativeConfigFenceKey, x as isCodexAppServerConnectionClosedError } from "./shared-client-BVKE40c-.js";
|
|
2
|
+
import { h as resolveCodexComputerUseConfig, p as resolveCodexAppServerRuntimeOptions } from "./session-binding-DlVQ-Pxs.js";
|
|
3
|
+
import { n as describeControlFailure } from "./capabilities-BHRSI6Cn.js";
|
|
4
|
+
import { r as requestCodexAppServerJson } from "./request-CXpPennK.js";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { runExec } from "openclaw/plugin-sdk/process-runtime";
|
|
7
7
|
//#region extensions/codex/src/app-server/computer-use.ts
|
|
@@ -113,6 +113,7 @@ async function inspectCodexComputerUse(params) {
|
|
|
113
113
|
if (!runtime) throw new Error("Computer Use install could not resolve its app-server runtime");
|
|
114
114
|
client = await getLeasedSharedCodexAppServerClient({
|
|
115
115
|
startOptions: runtime.start,
|
|
116
|
+
pluginConfig: params.pluginConfig,
|
|
116
117
|
timeoutMs: params.timeoutMs ?? runtime.requestTimeoutMs,
|
|
117
118
|
config: params.config,
|
|
118
119
|
agentDir: params.agentDir,
|
|
@@ -213,9 +214,11 @@ async function ensureComputerUsePlugin(params) {
|
|
|
213
214
|
}
|
|
214
215
|
async function readComputerUseTools(params) {
|
|
215
216
|
let server = await readMcpServerStatus(params.request, params.config.mcpServerName);
|
|
216
|
-
|
|
217
|
+
let tools = Object.keys(server?.tools ?? {}).toSorted();
|
|
218
|
+
if ((!server || tools.length === 0) && params.installPlugin) {
|
|
217
219
|
await reloadMcpServers(params.request);
|
|
218
220
|
server = await readMcpServerStatus(params.request, params.config.mcpServerName);
|
|
221
|
+
tools = Object.keys(server?.tools ?? {}).toSorted();
|
|
219
222
|
}
|
|
220
223
|
if (!server) return statusFromPlugin({
|
|
221
224
|
config: params.config,
|
|
@@ -224,10 +227,17 @@ async function readComputerUseTools(params) {
|
|
|
224
227
|
reason: "mcp_missing",
|
|
225
228
|
message: `Computer Use is installed, but the ${params.config.mcpServerName} MCP server is not available.`
|
|
226
229
|
});
|
|
230
|
+
if (tools.length === 0) return statusFromPlugin({
|
|
231
|
+
config: params.config,
|
|
232
|
+
plugin: params.plugin,
|
|
233
|
+
tools,
|
|
234
|
+
reason: "mcp_missing",
|
|
235
|
+
message: `Computer Use is installed, but the ${params.config.mcpServerName} MCP server exposes no tools.`
|
|
236
|
+
});
|
|
227
237
|
const status = statusFromPlugin({
|
|
228
238
|
config: params.config,
|
|
229
239
|
plugin: params.plugin,
|
|
230
|
-
tools
|
|
240
|
+
tools,
|
|
231
241
|
reason: "ready",
|
|
232
242
|
message: "Computer Use is ready."
|
|
233
243
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as getLeasedSharedCodexAppServerClient, c as
|
|
2
|
-
import {
|
|
3
|
-
import { x as resolveCodexBindingModelProviderFallback, y as resolveCodexAppServerRequestModelSelection } from "./thread-lifecycle-
|
|
4
|
-
import { t as CODEX_CONTROL_METHODS } from "./capabilities-
|
|
5
|
-
import { r as formatCodexDisplayText } from "./command-formatters-
|
|
6
|
-
import { a as resolveCodexBindingAppServerConnection } from "./notification-correlation-
|
|
1
|
+
import { a as getLeasedSharedCodexAppServerClient, c as releaseCodexAppServerClientLease, l as releaseLeasedSharedCodexAppServerClient, m as withLeasedCodexAppServerClientStartSelectionRetry } from "./shared-client-BVKE40c-.js";
|
|
2
|
+
import { O as isCodexFastServiceTier, S as resolveCodexModelBackedReviewerPolicyContext, o as isCodexAppServerNativeAuthProfile, p as resolveCodexAppServerRuntimeOptions, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-DlVQ-Pxs.js";
|
|
3
|
+
import { x as resolveCodexBindingModelProviderFallback, y as resolveCodexAppServerRequestModelSelection } from "./thread-lifecycle-DRg_FdzC.js";
|
|
4
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-BHRSI6Cn.js";
|
|
5
|
+
import { r as formatCodexDisplayText } from "./command-formatters-ico4ZFnk.js";
|
|
6
|
+
import { a as resolveCodexBindingAppServerConnection } from "./notification-correlation-Bj_Ak_jI.js";
|
|
7
7
|
import { ModelSelectionLockedError } from "openclaw/plugin-sdk/model-session-runtime";
|
|
8
8
|
//#region extensions/codex/src/command-authorization.ts
|
|
9
9
|
const CODEX_NATIVE_EXECUTION_AUTH_ERROR = "Only an owner or operator.admin can control Codex native execution.";
|
|
@@ -3,37 +3,11 @@ import fs from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { listAgentIds, resolveAgentDir, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-runtime";
|
|
5
5
|
import { isDeepStrictEqual } from "node:util";
|
|
6
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
7
|
import { patchSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
8
|
+
import { canonicalPathFromExistingAncestor, isPathInside, pathExists } from "openclaw/plugin-sdk/security-runtime";
|
|
7
9
|
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
8
|
-
|
|
9
|
-
async function pathExists$1(filePath) {
|
|
10
|
-
try {
|
|
11
|
-
await fs.access(filePath);
|
|
12
|
-
return true;
|
|
13
|
-
} catch {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
async function firstFreeArchivePath(sourcePath) {
|
|
18
|
-
for (let index = 2;; index++) {
|
|
19
|
-
const candidate = `${sourcePath}.migrated.${index}`;
|
|
20
|
-
if (!await pathExists$1(candidate)) return candidate;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
async function archiveBindingSidecar(sourcePath) {
|
|
24
|
-
const archivePath = `${sourcePath}.migrated`;
|
|
25
|
-
if (!await pathExists$1(archivePath)) {
|
|
26
|
-
await fs.rename(sourcePath, archivePath);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const [sourceBytes, archiveBytes] = await Promise.all([fs.readFile(sourcePath), fs.readFile(archivePath)]);
|
|
30
|
-
if (sourceBytes.equals(archiveBytes)) {
|
|
31
|
-
await fs.rm(sourcePath, { force: true });
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
await fs.rename(sourcePath, await firstFreeArchivePath(sourcePath));
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
10
|
+
import { archiveLegacyStateSource, legacyStateFileExists } from "openclaw/plugin-sdk/runtime-doctor";
|
|
37
11
|
//#region extensions/codex/src/migration/session-binding-sidecars.ts
|
|
38
12
|
const LEGACY_BINDING_SUFFIX = ".codex-app-server.json";
|
|
39
13
|
const CODEX_AGENT_HARNESS_ID = "codex";
|
|
@@ -49,9 +23,9 @@ const LEGACY_BINDING_LOCK_OPTIONS = {
|
|
|
49
23
|
};
|
|
50
24
|
async function collectSessionSurfaces(params) {
|
|
51
25
|
const surfaces = /* @__PURE__ */ new Map();
|
|
52
|
-
const stateRoot = await
|
|
26
|
+
const stateRoot = await canonicalPathFromExistingAncestor(params.stateDir);
|
|
53
27
|
const add = async (root, storePath, agentId, scan) => {
|
|
54
|
-
const canonicalRoot = await
|
|
28
|
+
const canonicalRoot = await canonicalPathFromExistingAncestor(root);
|
|
55
29
|
const surface = surfaces.get(canonicalRoot) ?? {
|
|
56
30
|
root: canonicalRoot,
|
|
57
31
|
scan: false,
|
|
@@ -81,7 +55,7 @@ async function collectSessionSurfaces(params) {
|
|
|
81
55
|
env: params.env
|
|
82
56
|
});
|
|
83
57
|
const root = path.dirname(storePath);
|
|
84
|
-
await add(root, storePath, agentId,
|
|
58
|
+
await add(root, storePath, agentId, isPathInside(stateRoot, await canonicalPathFromExistingAncestor(root)));
|
|
85
59
|
}
|
|
86
60
|
const legacyRoot = path.join(params.stateDir, "sessions");
|
|
87
61
|
const defaultAgentId = resolveSessionAgentIds({ config: params.config }).defaultAgentId;
|
|
@@ -92,7 +66,7 @@ async function collectLegacyBindingSources(params, options = {}) {
|
|
|
92
66
|
const surfaces = await collectSessionSurfaces(params);
|
|
93
67
|
const sources = /* @__PURE__ */ new Map();
|
|
94
68
|
const addSource = async (sidecarPath, surface) => {
|
|
95
|
-
const canonicalSidecar = await
|
|
69
|
+
const canonicalSidecar = await canonicalPathFromExistingAncestor(sidecarPath);
|
|
96
70
|
const source = sources.get(canonicalSidecar) ?? {
|
|
97
71
|
sidecarPath: canonicalSidecar,
|
|
98
72
|
transcriptPath: sidecarPath.slice(0, -22),
|
|
@@ -167,7 +141,7 @@ async function* iterateIndexedSidecars(surface) {
|
|
|
167
141
|
continue;
|
|
168
142
|
}
|
|
169
143
|
const sidecarPath = `${transcriptPath}${LEGACY_BINDING_SUFFIX}`;
|
|
170
|
-
if (await
|
|
144
|
+
if (await legacyStateFileExists(sidecarPath)) yield sidecarPath;
|
|
171
145
|
}
|
|
172
146
|
}
|
|
173
147
|
}
|
|
@@ -190,7 +164,7 @@ async function* walkSidecars(root) {
|
|
|
190
164
|
}
|
|
191
165
|
}
|
|
192
166
|
async function collectBindingOwners(sources, surfaces, params) {
|
|
193
|
-
const sourcePaths = new Set(await Promise.all(sources.map((source) =>
|
|
167
|
+
const sourcePaths = new Set(await Promise.all(sources.map((source) => canonicalPathFromExistingAncestor(source.transcriptPath))));
|
|
194
168
|
const owners = /* @__PURE__ */ new Map();
|
|
195
169
|
const storePaths = new Set(surfaces.flatMap((surface) => [...surface.storePaths]));
|
|
196
170
|
const storeAgentIds = /* @__PURE__ */ new Map();
|
|
@@ -201,7 +175,7 @@ async function collectBindingOwners(sources, surfaces, params) {
|
|
|
201
175
|
}
|
|
202
176
|
const failures = [];
|
|
203
177
|
for (const storePath of storePaths) {
|
|
204
|
-
const canonicalStorePath = await
|
|
178
|
+
const canonicalStorePath = await canonicalPathFromExistingAncestor(storePath);
|
|
205
179
|
const index = await readLegacySessionIndex(storePath);
|
|
206
180
|
if ("failure" in index) {
|
|
207
181
|
failures.push(index.failure);
|
|
@@ -219,7 +193,7 @@ async function collectBindingOwners(sources, surfaces, params) {
|
|
|
219
193
|
let canonicalLegacyTranscriptPath;
|
|
220
194
|
try {
|
|
221
195
|
legacyTranscriptPath = await resolveLegacySessionFileLocator(sessionsDir, entry, sessionId);
|
|
222
|
-
canonicalLegacyTranscriptPath = await
|
|
196
|
+
canonicalLegacyTranscriptPath = await canonicalPathFromExistingAncestor(legacyTranscriptPath);
|
|
223
197
|
} catch {
|
|
224
198
|
failures.push(`session index ${storePath} has an invalid locator for ${sessionKey}`);
|
|
225
199
|
continue;
|
|
@@ -256,8 +230,8 @@ async function resolveLegacySessionFileLocator(sessionsDir, entry, sessionId) {
|
|
|
256
230
|
const sessionFile = entry.sessionFile?.trim();
|
|
257
231
|
if (!sessionFile) return fallback;
|
|
258
232
|
const candidate = path.resolve(base, sessionFile);
|
|
259
|
-
const [canonicalBase, canonicalCandidate] = await Promise.all([
|
|
260
|
-
if (!
|
|
233
|
+
const [canonicalBase, canonicalCandidate] = await Promise.all([canonicalPathFromExistingAncestor(base), canonicalPathFromExistingAncestor(candidate)]);
|
|
234
|
+
if (!isPathInside(canonicalBase, canonicalCandidate)) throw new Error("legacy session file locator escapes its session directory");
|
|
261
235
|
return candidate;
|
|
262
236
|
}
|
|
263
237
|
function resolveLegacyBindingOwnerAgentId(params) {
|
|
@@ -302,7 +276,7 @@ async function migrateSource(source, candidates, params, store) {
|
|
|
302
276
|
return await withFileLock(source.sidecarPath, LEGACY_BINDING_LOCK_OPTIONS, async () => {
|
|
303
277
|
const [contents, stat] = await Promise.all([fs.readFile(source.sidecarPath, "utf8"), fs.stat(source.sidecarPath)]);
|
|
304
278
|
const raw = JSON.parse(contents);
|
|
305
|
-
const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-
|
|
279
|
+
const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-DlVQ-Pxs.js").then((n) => n.u), import("./conversation-binding-data-BHRpYbX3.js").then((n) => n.t)]);
|
|
306
280
|
const agentId = owner?.agentId ?? (source.agentIds.size === 1 ? [...source.agentIds][0] : void 0);
|
|
307
281
|
const baseStored = createStoredCodexAppServerBinding(raw, {
|
|
308
282
|
now: stat.mtime.toISOString(),
|
|
@@ -402,7 +376,14 @@ async function migrateSource(source, candidates, params, store) {
|
|
|
402
376
|
}
|
|
403
377
|
for (const entry of entries) if (!hasExpected(await store.lookup(entry.key), entry.value)) return retain(`canonical plugin state changed at ${entry.key}`);
|
|
404
378
|
}
|
|
405
|
-
|
|
379
|
+
const archiveWarnings = [];
|
|
380
|
+
await archiveLegacyStateSource({
|
|
381
|
+
filePath: source.sidecarPath,
|
|
382
|
+
label: "Codex app-server binding",
|
|
383
|
+
changes: [],
|
|
384
|
+
warnings: archiveWarnings
|
|
385
|
+
});
|
|
386
|
+
if (archiveWarnings.length > 0 && await pathExists(source.sidecarPath)) return retain(archiveWarnings.join("; "));
|
|
406
387
|
return {
|
|
407
388
|
archived: true,
|
|
408
389
|
importedKeys
|
|
@@ -427,7 +408,7 @@ async function recordSessionOwner(owner, env) {
|
|
|
427
408
|
} catch {
|
|
428
409
|
return "its session owner changed before Codex ownership could be recorded";
|
|
429
410
|
}
|
|
430
|
-
if (await
|
|
411
|
+
if (await canonicalPathFromExistingAncestor(currentTranscriptPath) !== await canonicalPathFromExistingAncestor(owner.transcriptPath) || currentOwner.entry.lifecycleRevision !== owner.lifecycleRevision) return "its session owner changed before Codex ownership could be recorded";
|
|
431
412
|
const legacyHarnessId = currentOwner.entry.agentHarnessId?.trim();
|
|
432
413
|
if (currentOwner.entry.agentHarnessId !== void 0 && !legacyHarnessId) return "its session owner changed before Codex ownership could be recorded";
|
|
433
414
|
if (legacyHarnessId && legacyHarnessId !== CODEX_AGENT_HARNESS_ID) return `its session is owned by agent harness ${legacyHarnessId}`;
|
|
@@ -474,54 +455,11 @@ async function readDirectoryEntries(directory) {
|
|
|
474
455
|
throw error;
|
|
475
456
|
}
|
|
476
457
|
}
|
|
477
|
-
async function isRegularFile(filePath) {
|
|
478
|
-
try {
|
|
479
|
-
return (await fs.stat(filePath)).isFile();
|
|
480
|
-
} catch {
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
function isRecord(value) {
|
|
485
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
486
|
-
}
|
|
487
458
|
function isSafeLegacySessionId(value) {
|
|
488
459
|
if (typeof value !== "string") return false;
|
|
489
460
|
const trimmed = value.trim();
|
|
490
461
|
return trimmed.length > 0 && trimmed.length <= 255 && /^[A-Za-z0-9][A-Za-z0-9._:@-]*$/.test(trimmed);
|
|
491
462
|
}
|
|
492
|
-
function isPathWithin(root, candidate) {
|
|
493
|
-
const relative = path.relative(root, candidate);
|
|
494
|
-
return relative === "" || relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
|
|
495
|
-
}
|
|
496
|
-
async function canonicalizePath(filePath) {
|
|
497
|
-
try {
|
|
498
|
-
return await fs.realpath(filePath);
|
|
499
|
-
} catch {
|
|
500
|
-
return path.resolve(filePath);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
async function canonicalizePathForContainment(filePath) {
|
|
504
|
-
const resolved = path.resolve(filePath);
|
|
505
|
-
const suffix = [];
|
|
506
|
-
let probe = resolved;
|
|
507
|
-
while (true) try {
|
|
508
|
-
const realProbe = await fs.realpath(probe);
|
|
509
|
-
return suffix.length === 0 ? realProbe : path.join(realProbe, ...suffix.toReversed());
|
|
510
|
-
} catch {
|
|
511
|
-
const parent = path.dirname(probe);
|
|
512
|
-
if (parent === probe) return resolved;
|
|
513
|
-
suffix.push(path.basename(probe));
|
|
514
|
-
probe = parent;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
async function pathExists(filePath) {
|
|
518
|
-
try {
|
|
519
|
-
await fs.access(filePath);
|
|
520
|
-
return true;
|
|
521
|
-
} catch {
|
|
522
|
-
return false;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
463
|
const stateMigrations = [{
|
|
526
464
|
id: "codex-app-server-sidecars-to-plugin-state",
|
|
527
465
|
label: "Codex app-server thread bindings",
|
|
@@ -554,7 +492,7 @@ const stateMigrations = [{
|
|
|
554
492
|
let migrated = 0;
|
|
555
493
|
let partialImports = 0;
|
|
556
494
|
for (const source of sources) {
|
|
557
|
-
const result = await migrateSource(source, ownerCollection.owners.get(await
|
|
495
|
+
const result = await migrateSource(source, ownerCollection.owners.get(await canonicalPathFromExistingAncestor(source.transcriptPath)) ?? [], params, store);
|
|
558
496
|
if (result.warning) warnings.push(result.warning);
|
|
559
497
|
if (result.notice) notices.push(result.notice);
|
|
560
498
|
if (result.archived) migrated++;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { D as isForcedPrivateQaCodexRuntime, E as filterCodexDynamicToolsWithOpenClawShell, O as isSystemAgentOnlyCodexDynamicToolAllowlist, T as filterCodexDynamicTools,
|
|
4
|
-
import {
|
|
5
|
-
import { r as formatCodexDisplayText } from "./command-formatters-
|
|
1
|
+
import { V as isJsonObject, l as releaseLeasedSharedCodexAppServerClient, q as resolveCodexGatewayTimeoutWithGraceMs, z as CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE } from "./shared-client-BVKE40c-.js";
|
|
2
|
+
import { T as readCodexPluginConfig } from "./session-binding-DlVQ-Pxs.js";
|
|
3
|
+
import { D as isForcedPrivateQaCodexRuntime, E as filterCodexDynamicToolsWithOpenClawShell, O as isSystemAgentOnlyCodexDynamicToolAllowlist, T as filterCodexDynamicTools, et as readItem, h as resolveCodexWebSearchPlan, i as invalidInlineImageText, k as normalizeCodexDynamicToolName, o as sanitizeInlineImageDataUrl, st as readString$2, tt as readItemString } from "./thread-lifecycle-DRg_FdzC.js";
|
|
4
|
+
import { l as readCodexTurn } from "./protocol-validators-Dm4eXZmt.js";
|
|
5
|
+
import { r as formatCodexDisplayText } from "./command-formatters-ico4ZFnk.js";
|
|
6
6
|
import { a as resolveCodexNodeExecToolOverrides, i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-D1Wky__S.js";
|
|
7
|
-
import { n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-
|
|
7
|
+
import { n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-Bj_Ak_jI.js";
|
|
8
8
|
import { addTimerTimeoutGraceMs, asDateTimestampMs, finiteSecondsToTimerSafeMilliseconds, parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
9
|
-
import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
10
|
-
import { createHash } from "node:crypto";
|
|
11
|
-
import { resolveAgentDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
12
|
-
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
13
|
-
import { asOptionalRecord, isRecord, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
9
|
import { HEARTBEAT_RESPONSE_TOOL_NAME, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, callGatewayTool, consumeAdjustedParamsForToolCall, consumePreExecutionBlockedToolCall, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractMessagingToolSend, extractMessagingToolSendResult, extractToolResultMediaArtifact, filterProviderNormalizableTools, filterToolResultMediaUrls, finalizeToolTerminalPresentation, formatApprovalDisplayPath, formatToolExecutionErrorMessage, getBeforeToolCallFailureDisposition, getChannelAgentToolMeta, getPluginToolMeta, hasNativeHookRelayInvocation, invokeNativeHookRelay, isDeliveredMessageToolOnlySourceReplyResult, isDeliveredMessagingToolResult, isHostScopedAgentToolActive, isMessagingTool, isMessagingToolSendAction, isReplaySafeToolCall, isSubagentSessionKey, isToolResultError, isToolWrappedWithBeforeToolCallHook, normalizeAgentRuntimeTools, normalizeHeartbeatToolResponse, projectRuntimeToolInputSchema, registerNativeHookRelay, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveNativeHookRelayDeferredToolApproval, resolveToolExecutionErrorKind, resolveToolResultFailureKind, runAgentHarnessAfterToolCallHook, runBeforeToolCallHook, sanitizeToolResult, setBeforeToolCallDiagnosticsEnabled, supportsModelTools, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
12
|
+
import { isRecord, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
13
|
+
import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
15
14
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
16
15
|
import { emitTrustedDiagnosticEvent, hasPendingInternalDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
17
16
|
import { isToolAllowed } from "openclaw/plugin-sdk/sandbox";
|
|
@@ -129,6 +128,18 @@ function shouldClearTerminalPresentationForNativeItem(item) {
|
|
|
129
128
|
}
|
|
130
129
|
//#endregion
|
|
131
130
|
//#region extensions/codex/src/app-server/dynamic-tool-response-state.ts
|
|
131
|
+
/** Retains the host-owned app preview without adding it to Codex's response payload. */
|
|
132
|
+
function withDynamicToolTranscriptDetails(response, details) {
|
|
133
|
+
if (!details || typeof details !== "object" || Array.isArray(details)) return response;
|
|
134
|
+
const mcpAppPreview = details.mcpAppPreview;
|
|
135
|
+
if (!mcpAppPreview || typeof mcpAppPreview !== "object" || Array.isArray(mcpAppPreview)) return response;
|
|
136
|
+
Object.defineProperty(response, "transcriptDetails", {
|
|
137
|
+
configurable: true,
|
|
138
|
+
enumerable: false,
|
|
139
|
+
value: { mcpAppPreview }
|
|
140
|
+
});
|
|
141
|
+
return response;
|
|
142
|
+
}
|
|
132
143
|
function withDynamicToolTerminalResolution(response, terminalResolution) {
|
|
133
144
|
if (terminalResolution) {
|
|
134
145
|
Object.defineProperties(response, {
|
|
@@ -444,13 +455,16 @@ function toCodexDynamicToolProtocolResponse(response) {
|
|
|
444
455
|
}
|
|
445
456
|
/** Adds async-started progress details when a tool result continues out of band. */
|
|
446
457
|
function toCodexDynamicToolProgressResponse(response, protocolResponse) {
|
|
447
|
-
|
|
458
|
+
const transcriptDetails = response.transcriptDetails;
|
|
459
|
+
if (response.asyncStarted !== true && transcriptDetails === void 0) return protocolResponse;
|
|
448
460
|
return {
|
|
449
461
|
...protocolResponse,
|
|
450
|
-
details: {
|
|
462
|
+
...transcriptDetails ? { details: transcriptDetails } : {},
|
|
463
|
+
...response.asyncStarted === true ? { details: {
|
|
464
|
+
...transcriptDetails,
|
|
451
465
|
async: true,
|
|
452
466
|
status: "started"
|
|
453
|
-
}
|
|
467
|
+
} } : {}
|
|
454
468
|
};
|
|
455
469
|
}
|
|
456
470
|
/** Decides whether a terminal dynamic tool response can release the Codex turn. */
|
|
@@ -1178,7 +1192,7 @@ async function buildDynamicTools(input) {
|
|
|
1178
1192
|
}
|
|
1179
1193
|
const toolBuildStages = createCodexDynamicToolBuildStageTracker({ enabled: input.profilerEnabled });
|
|
1180
1194
|
const modelHasVision = params.model.input?.includes("image") ?? false;
|
|
1181
|
-
const agentDir = params.agentDir ?? resolveAgentDir(params.config ?? {}, input.sessionAgentId);
|
|
1195
|
+
const agentDir = params.agentDir ?? resolveAgentDir$1(params.config ?? {}, input.sessionAgentId);
|
|
1182
1196
|
const { createOpenClawCodingTools: defaultCreateOpenClawCodingTools, resolveWebSearchToolPolicy } = await import("openclaw/plugin-sdk/agent-harness");
|
|
1183
1197
|
const createOpenClawCodingTools = dynamicToolBuildState.openClawCodingToolsFactory ?? defaultCreateOpenClawCodingTools;
|
|
1184
1198
|
toolBuildStages.mark("load-agent-harness-tools");
|
|
@@ -1214,6 +1228,7 @@ async function buildDynamicTools(input) {
|
|
|
1214
1228
|
senderIsOwner: params.senderIsOwner,
|
|
1215
1229
|
inputProvenance: params.inputProvenance,
|
|
1216
1230
|
trustedInternalHandoff: params.trustedInternalHandoff,
|
|
1231
|
+
scheduledToolPolicy: params.scheduledToolPolicy,
|
|
1217
1232
|
allowGatewaySubagentBinding: params.allowGatewaySubagentBinding || isForcedPrivateQaCodexRuntime(),
|
|
1218
1233
|
...sessionKeys,
|
|
1219
1234
|
sessionId: params.sessionId,
|
|
@@ -1308,7 +1323,8 @@ async function buildDynamicTools(input) {
|
|
|
1308
1323
|
senderUsername: params.senderUsername,
|
|
1309
1324
|
senderE164: params.senderE164,
|
|
1310
1325
|
inputProvenance: params.inputProvenance,
|
|
1311
|
-
trustedInternalHandoff: params.trustedInternalHandoff
|
|
1326
|
+
trustedInternalHandoff: params.trustedInternalHandoff,
|
|
1327
|
+
scheduledToolPolicy: params.scheduledToolPolicy
|
|
1312
1328
|
});
|
|
1313
1329
|
const transientWebSearchRestriction = !webSearchPolicy.allowed && webSearchPolicy.persistentAllowed || isCodexMemoryFlushRun(params);
|
|
1314
1330
|
const persistentCodexWebSearchSurface = params.config?.tools?.web?.search?.enabled !== false && !(input.pluginConfig.codexDynamicToolsExclude ?? []).some((name) => normalizeCodexDynamicToolName(name) === "web_search");
|
|
@@ -1587,6 +1603,11 @@ function settleCodexSourceReplyFinality(owner, turnSucceeded) {
|
|
|
1587
1603
|
}
|
|
1588
1604
|
//#endregion
|
|
1589
1605
|
//#region extensions/codex/src/app-server/provider-capabilities.ts
|
|
1606
|
+
function resolveOverriddenProviderWebSearchSupport(modelProviderOverride) {
|
|
1607
|
+
const provider = modelProviderOverride?.trim().toLowerCase();
|
|
1608
|
+
if (!provider) return;
|
|
1609
|
+
return provider === "openai" ? "supported" : "unsupported";
|
|
1610
|
+
}
|
|
1590
1611
|
async function readConfiguredProviderWebSearchSupport(params) {
|
|
1591
1612
|
return (await params.client.request("modelProvider/capabilities/read", {}, {
|
|
1592
1613
|
timeoutMs: params.timeoutMs,
|
|
@@ -1594,9 +1615,8 @@ async function readConfiguredProviderWebSearchSupport(params) {
|
|
|
1594
1615
|
})).webSearch ? "supported" : "unsupported";
|
|
1595
1616
|
}
|
|
1596
1617
|
async function resolveCodexProviderWebSearchSupportForClient(params) {
|
|
1597
|
-
const
|
|
1598
|
-
if (
|
|
1599
|
-
if (modelProviderOverride) return "unsupported";
|
|
1618
|
+
const overrideSupport = resolveOverriddenProviderWebSearchSupport(params.modelProviderOverride);
|
|
1619
|
+
if (overrideSupport) return overrideSupport;
|
|
1600
1620
|
try {
|
|
1601
1621
|
return await readConfiguredProviderWebSearchSupport(params);
|
|
1602
1622
|
} catch {
|
|
@@ -1604,6 +1624,8 @@ async function resolveCodexProviderWebSearchSupportForClient(params) {
|
|
|
1604
1624
|
}
|
|
1605
1625
|
}
|
|
1606
1626
|
async function resolveCodexProviderWebSearchSupport(params) {
|
|
1627
|
+
const overrideSupport = resolveOverriddenProviderWebSearchSupport(params.modelProviderOverride);
|
|
1628
|
+
if (overrideSupport) return overrideSupport;
|
|
1607
1629
|
let client;
|
|
1608
1630
|
try {
|
|
1609
1631
|
client = await params.clientFactory({
|
|
@@ -3152,25 +3174,6 @@ function formatErrorMessage$1(error) {
|
|
|
3152
3174
|
return error instanceof Error ? error.message : String(error);
|
|
3153
3175
|
}
|
|
3154
3176
|
//#endregion
|
|
3155
|
-
//#region extensions/codex/src/app-server/agent-context-limits.ts
|
|
3156
|
-
/** Resolves an agent override before falling back to the configured default. */
|
|
3157
|
-
function resolveAgentContextLimitValue(params) {
|
|
3158
|
-
const agents = asOptionalRecord(params.config?.agents);
|
|
3159
|
-
const defaultValue = readPositiveInteger(asOptionalRecord(asOptionalRecord(agents?.defaults)?.contextLimits)?.[params.key]);
|
|
3160
|
-
if (!params.agentId) return defaultValue;
|
|
3161
|
-
const list = agents?.list;
|
|
3162
|
-
if (!Array.isArray(list)) return defaultValue;
|
|
3163
|
-
const normalizedAgentId = normalizeAgentId(params.agentId);
|
|
3164
|
-
return readPositiveInteger(asOptionalRecord(asOptionalRecord(list.find((entry) => {
|
|
3165
|
-
const entryId = asOptionalRecord(entry)?.id;
|
|
3166
|
-
return typeof entryId === "string" && normalizeAgentId(entryId) === normalizedAgentId;
|
|
3167
|
-
}))?.contextLimits)?.[params.key]) ?? defaultValue;
|
|
3168
|
-
}
|
|
3169
|
-
function readPositiveInteger(value) {
|
|
3170
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return;
|
|
3171
|
-
return Math.floor(value);
|
|
3172
|
-
}
|
|
3173
|
-
//#endregion
|
|
3174
3177
|
//#region extensions/codex/src/app-server/dynamic-tools.ts
|
|
3175
3178
|
/**
|
|
3176
3179
|
* Bridges OpenClaw runtime tools into Codex app-server dynamic tool specs and
|
|
@@ -3319,6 +3322,13 @@ const EXPLICIT_MESSAGE_REPLY_KEYS = [
|
|
|
3319
3322
|
"replyToIdFull"
|
|
3320
3323
|
];
|
|
3321
3324
|
const DEFAULT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS = 16e3;
|
|
3325
|
+
const LARGE_CONTEXT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS = 32e3;
|
|
3326
|
+
const XL_CONTEXT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS = 64e3;
|
|
3327
|
+
function resolveCodexDynamicToolResultMaxChars(contextWindowTokens) {
|
|
3328
|
+
if (typeof contextWindowTokens !== "number" || !Number.isFinite(contextWindowTokens) || contextWindowTokens <= 0) return DEFAULT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS;
|
|
3329
|
+
const tokens = Math.floor(contextWindowTokens);
|
|
3330
|
+
return Math.min(tokens >= 2e5 ? XL_CONTEXT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS : tokens >= 1e5 ? LARGE_CONTEXT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS : DEFAULT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS, Math.max(1, Math.floor(tokens * .3) * 4));
|
|
3331
|
+
}
|
|
3322
3332
|
function computerFrameImageIdentity(content) {
|
|
3323
3333
|
if (!Array.isArray(content)) return;
|
|
3324
3334
|
const images = content.filter((block) => block.type === "image");
|
|
@@ -3337,7 +3347,7 @@ function invalidateComputerFrame(contextEpoch) {
|
|
|
3337
3347
|
*/
|
|
3338
3348
|
function createCodexDynamicToolBridge(params) {
|
|
3339
3349
|
const toolResultHookContext = toToolResultHookContext(params.hookContext);
|
|
3340
|
-
const toolResultMaxChars = resolveCodexDynamicToolResultMaxChars(params.hookContext);
|
|
3350
|
+
const toolResultMaxChars = resolveCodexDynamicToolResultMaxChars(params.hookContext?.contextWindowTokens);
|
|
3341
3351
|
const availableProjection = projectCodexDynamicTools(params.tools);
|
|
3342
3352
|
const registeredProjection = params.registeredTools ? projectCodexDynamicTools(params.registeredTools) : availableProjection;
|
|
3343
3353
|
const wrappedAvailableProjection = wrapProjectedCodexDynamicTools(availableProjection.tools, params.hookContext);
|
|
@@ -3516,6 +3526,7 @@ function createCodexDynamicToolBridge(params) {
|
|
|
3516
3526
|
contentItems,
|
|
3517
3527
|
success: !resultIsError
|
|
3518
3528
|
}, terminalType);
|
|
3529
|
+
withDynamicToolTranscriptDetails(response, result.details);
|
|
3519
3530
|
withDiagnosticFailureDisposition(response, resultFailureKind);
|
|
3520
3531
|
const blocksSourceReplyTermination = hasExplicitNonSourceMessageRoute(executedArgs, params.hookContext, confirmedMessagingTarget);
|
|
3521
3532
|
const deliveredSourceReply = isDeliveredMessageToolOnlySourceReplyResult({
|
|
@@ -3856,13 +3867,6 @@ function toToolResultHookContext(ctx) {
|
|
|
3856
3867
|
...channelId && { channelId }
|
|
3857
3868
|
};
|
|
3858
3869
|
}
|
|
3859
|
-
function resolveCodexDynamicToolResultMaxChars(ctx) {
|
|
3860
|
-
return resolveAgentContextLimitValue({
|
|
3861
|
-
config: ctx?.config,
|
|
3862
|
-
agentId: ctx?.agentId,
|
|
3863
|
-
key: "toolResultMaxChars"
|
|
3864
|
-
}) ?? DEFAULT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS;
|
|
3865
|
-
}
|
|
3866
3870
|
function composeAbortSignals(...signals) {
|
|
3867
3871
|
const activeSignals = signals.filter((signal) => Boolean(signal));
|
|
3868
3872
|
if (activeSignals.length === 0) return new AbortController().signal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { V as isJsonObject } from "./shared-client-BVKE40c-.js";
|
|
2
|
+
import { it as readNonNegativeInteger, ot as readNumber } from "./thread-lifecycle-DRg_FdzC.js";
|
|
3
3
|
import { normalizeUsage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
4
|
//#region extensions/codex/src/app-server/event-projector-usage.ts
|
|
5
5
|
function readTokenCount(record, key) {
|
package/dist/harness.js
CHANGED
|
@@ -35,7 +35,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
35
35
|
...sessionCatalogControl && sessionRuntime ? { sessionFork: {
|
|
36
36
|
upstreamKinds: ["codex-app-server"],
|
|
37
37
|
fork: async (params) => {
|
|
38
|
-
const { forkCodexUpstreamSession } = await import("./upstream-session-fork-
|
|
38
|
+
const { forkCodexUpstreamSession } = await import("./upstream-session-fork-_Vrz4WJr.js");
|
|
39
39
|
return await forkCodexUpstreamSession(params, {
|
|
40
40
|
bindingStore: options.bindingStore,
|
|
41
41
|
control: sessionCatalogControl,
|
|
@@ -46,7 +46,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
46
46
|
}
|
|
47
47
|
} } : {},
|
|
48
48
|
authBinding: { fingerprint: async (params) => {
|
|
49
|
-
const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-
|
|
49
|
+
const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-B4FfbcCg.js").then((n) => n.t);
|
|
50
50
|
return fingerprintCodexAppServerAuthBinding(params);
|
|
51
51
|
} },
|
|
52
52
|
runtimeArtifact: { validate: async (binding) => {
|
|
@@ -54,7 +54,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
54
54
|
return validateCodexAppServerRuntimeArtifact(binding);
|
|
55
55
|
} },
|
|
56
56
|
fetchUsageSnapshot: async (ctx) => {
|
|
57
|
-
const { fetchCodexAppServerUsageSnapshot } = await import("./usage-
|
|
57
|
+
const { fetchCodexAppServerUsageSnapshot } = await import("./usage-UpVbdX5G.js");
|
|
58
58
|
return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
59
59
|
},
|
|
60
60
|
supports: (ctx) => {
|
|
@@ -95,7 +95,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
95
95
|
};
|
|
96
96
|
},
|
|
97
97
|
runAttempt: async (params) => {
|
|
98
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt
|
|
98
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-C5GTPJOE.js");
|
|
99
99
|
return runCodexAppServerAttempt(params, {
|
|
100
100
|
bindingStore: options.bindingStore,
|
|
101
101
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
@@ -103,11 +103,11 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
103
103
|
});
|
|
104
104
|
},
|
|
105
105
|
finalizeSettledTurn: async (params) => {
|
|
106
|
-
const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-
|
|
106
|
+
const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-CA_2QXIE.js");
|
|
107
107
|
return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
108
108
|
},
|
|
109
109
|
runSideQuestion: async (params) => {
|
|
110
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
110
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-CO12sHxo.js");
|
|
111
111
|
return runCodexAppServerSideQuestion(params, {
|
|
112
112
|
bindingStore: options.bindingStore,
|
|
113
113
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
@@ -115,14 +115,14 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
115
115
|
});
|
|
116
116
|
},
|
|
117
117
|
compact: async (params) => {
|
|
118
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
118
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-dEN49UH6.js");
|
|
119
119
|
return maybeCompactCodexAppServerSession(params, {
|
|
120
120
|
bindingStore: options.bindingStore,
|
|
121
121
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
|
|
122
122
|
});
|
|
123
123
|
},
|
|
124
124
|
compactAfterContextEngine: async (params) => {
|
|
125
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
125
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-dEN49UH6.js");
|
|
126
126
|
return maybeCompactCodexAppServerSession(params, {
|
|
127
127
|
bindingStore: options.bindingStore,
|
|
128
128
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
@@ -131,21 +131,22 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
131
131
|
},
|
|
132
132
|
reset: async (params) => {
|
|
133
133
|
if (params.sessionId) {
|
|
134
|
-
const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-
|
|
134
|
+
const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-DlVQ-Pxs.js").then((n) => n.u);
|
|
135
135
|
const identity = sessionBindingIdentity({
|
|
136
136
|
agentId: params.agentId,
|
|
137
137
|
sessionId: params.sessionId,
|
|
138
138
|
sessionKey: params.sessionKey
|
|
139
139
|
});
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
const resetGeneration = params.reason === "deleted" ? options.bindingStore.retireSessionGeneration.bind(options.bindingStore) : options.bindingStore.resetSessionGeneration.bind(options.bindingStore);
|
|
141
|
+
let reset = await resetGeneration(identity);
|
|
142
|
+
if (reset === "conflict") {
|
|
142
143
|
if (await reclaimCurrentCodexSessionGeneration({
|
|
143
144
|
bindingStore: options.bindingStore,
|
|
144
145
|
identity,
|
|
145
146
|
config: options.resolveConfig?.()
|
|
146
|
-
}))
|
|
147
|
+
})) reset = await resetGeneration(identity);
|
|
147
148
|
}
|
|
148
|
-
if (
|
|
149
|
+
if (reset === "conflict") throw new Error(`Codex binding generation changed before session ${params.sessionId} could reset`);
|
|
149
150
|
}
|
|
150
151
|
},
|
|
151
152
|
dispose: disposeSharedCodexAppServerClients
|