@openclaw/codex 2026.6.11 → 2026.7.1-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-server-policy-BPTiVNsW.js → app-server-policy-C968Kgin.js} +5 -5
- package/dist/{attempt-notifications-BYnndyFl.js → attempt-notifications-BGsEIIDI.js} +29 -40
- package/dist/{command-handlers-DEPTJYk0.js → command-handlers-Dv-pzAmg.js} +278 -237
- package/dist/command-rpc-eLM_mtC7.js +784 -0
- package/dist/compact-4mVBriKT.js +603 -0
- package/dist/{computer-use-ClrJwoFp.js → computer-use-Bmaz333N.js} +3 -3
- package/dist/{config-CszD0vP3.js → config-CYEDnLJ2.js} +44 -18
- package/dist/conversation-binding-data-BHRpYbX3.js +121 -0
- package/dist/doctor-contract-api.js +590 -22
- package/dist/harness.js +29 -10
- package/dist/index.js +1134 -35
- package/dist/{media-understanding-provider-ZUQHN7gT.js → media-understanding-provider-BHOu9-Gg.js} +13 -8
- package/dist/media-understanding-provider.js +1 -1
- package/dist/{models-CAmfBWRl.js → models-DDmO1zwd.js} +2 -2
- package/dist/notification-correlation-Bo7KB3ks.js +35 -0
- package/dist/{plugin-app-cache-key-C9ILt7bl.js → plugin-app-cache-key-BrhVdeEf.js} +13 -5
- package/dist/{protocol-dh-ETiNd.js → protocol-2POPqAY4.js} +2 -1
- package/dist/{protocol-validators-B19q5BIX.js → protocol-validators-dZQ-UTOa.js} +205 -56
- package/dist/provider-capabilities-DzI8fgEu.js +6172 -0
- package/dist/provider-catalog.js +4 -2
- package/dist/{provider-B-OHpbD3.js → provider-zjPfx5Fs.js} +94 -23
- package/dist/provider.js +2 -2
- package/dist/{request-Dcd452Nk.js → request-BcJyl8KL.js} +2 -2
- package/dist/{run-attempt-CXxtFC9d.js → run-attempt-DNSNk_G8.js} +1250 -2992
- package/dist/{sandbox-guard-3tnjhjFb.js → sandbox-guard-DA2TQfZW.js} +5 -3
- package/dist/session-binding-C1ZXdP-x.js +627 -0
- package/dist/session-binding-meta-B7aEMU7g.js +6 -0
- package/dist/shared-client-4ICy3U6d.js +1853 -0
- package/dist/{side-question-C-DhgJOd.js → side-question-CMOpEhvY.js} +134 -142
- package/dist/{thread-lifecycle-DtT3-ehU.js → thread-lifecycle-qWE88Dn2.js} +803 -481
- package/dist/{web-search-provider.runtime-CkwxrXQj.js → web-search-provider.runtime-BSlriav6.js} +3 -3
- package/npm-shrinkwrap.json +34 -34
- package/openclaw.plugin.json +23 -3
- package/package.json +9 -6
- package/dist/client-CLrtWgrD.js +0 -729
- package/dist/client-factory-Bm6HsGob.js +0 -18
- package/dist/compact-aQJ0ZKhe.js +0 -278
- package/dist/conversation-binding-t0XMLz-j.js +0 -1557
- package/dist/provider-capabilities-D7hnTO76.js +0 -3201
- package/dist/rate-limit-cache-C7qmZ0Jh.js +0 -26
- package/dist/session-binding-HOuPt-E0.js +0 -338
- package/dist/shared-client-Dtx5i7Ez.js +0 -1013
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
-
let sharedClientModulePromise = null;
|
|
3
|
-
const loadSharedClientModule = async () => {
|
|
4
|
-
sharedClientModulePromise ??= import("./shared-client-Dtx5i7Ez.js").then((n) => n.c);
|
|
5
|
-
return await sharedClientModulePromise;
|
|
6
|
-
};
|
|
7
|
-
/** Returns a leased shared client so startup can release ownership explicitly. */
|
|
8
|
-
const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config, options) => loadSharedClientModule().then(({ getLeasedSharedCodexAppServerClient }) => getLeasedSharedCodexAppServerClient({
|
|
9
|
-
startOptions,
|
|
10
|
-
authProfileId,
|
|
11
|
-
agentDir,
|
|
12
|
-
config,
|
|
13
|
-
onStartedClient: options?.onStartedClient,
|
|
14
|
-
abandonSignal: options?.abandonSignal,
|
|
15
|
-
timeoutMs: options?.timeoutMs
|
|
16
|
-
}));
|
|
17
|
-
//#endregion
|
|
18
|
-
export { defaultLeasedCodexAppServerClientFactory as t };
|
package/dist/compact-aQJ0ZKhe.js
DELETED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
import { d as resolveCodexAppServerRuntimeOptions } from "./config-CszD0vP3.js";
|
|
2
|
-
import { c as withCodexAppServerBindingLock, l as writeCodexAppServerBinding, o as readCodexAppServerBinding, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-HOuPt-E0.js";
|
|
3
|
-
import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-Dtx5i7Ez.js";
|
|
4
|
-
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-3tnjhjFb.js";
|
|
5
|
-
import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-Bm6HsGob.js";
|
|
6
|
-
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
7
|
-
//#region extensions/codex/src/app-server/compact.ts
|
|
8
|
-
/**
|
|
9
|
-
* Native Codex app-server compaction bridge for bound OpenClaw sessions.
|
|
10
|
-
*/
|
|
11
|
-
const warnedIgnoredCompactionOverrides = /* @__PURE__ */ new Set();
|
|
12
|
-
/**
|
|
13
|
-
* Starts native Codex compaction for a manually requested bound session, or
|
|
14
|
-
* reports why Codex-owned automatic compaction should handle the trigger.
|
|
15
|
-
*/
|
|
16
|
-
async function maybeCompactCodexAppServerSession(params, options = {}) {
|
|
17
|
-
warnIfIgnoringOpenClawCompactionOverrides(params);
|
|
18
|
-
return compactCodexNativeThread(params, options);
|
|
19
|
-
}
|
|
20
|
-
function warnIfIgnoringOpenClawCompactionOverrides(params) {
|
|
21
|
-
const ignoredConfig = readIgnoredCompactionOverridePaths(params);
|
|
22
|
-
if (ignoredConfig.length === 0) return;
|
|
23
|
-
const warningKey = ignoredConfig.join("\0");
|
|
24
|
-
if (warnedIgnoredCompactionOverrides.has(warningKey)) return;
|
|
25
|
-
warnedIgnoredCompactionOverrides.add(warningKey);
|
|
26
|
-
embeddedAgentLog.warn("ignoring OpenClaw compaction overrides for Codex app-server compaction; Codex uses native server-side compaction", {
|
|
27
|
-
sessionId: params.sessionId,
|
|
28
|
-
sessionKey: params.sessionKey,
|
|
29
|
-
ignoredConfig
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function readIgnoredCompactionOverridePaths(params) {
|
|
33
|
-
const ignored = /* @__PURE__ */ new Set();
|
|
34
|
-
for (const entry of readCompactionOverrideEntries(params)) {
|
|
35
|
-
const localProvider = typeof entry.record.provider === "string" ? entry.record.provider.trim() : "";
|
|
36
|
-
const inheritedProvider = !localProvider && typeof entry.inheritedRecord?.provider === "string" ? entry.inheritedRecord.provider.trim() : "";
|
|
37
|
-
const providerPath = localProvider ? `${entry.path}.compaction.provider` : inheritedProvider && entry.inheritedPath ? `${entry.inheritedPath}.compaction.provider` : void 0;
|
|
38
|
-
if (typeof entry.record.model === "string" && entry.record.model.trim()) ignored.add(`${entry.path}.compaction.model`);
|
|
39
|
-
if (providerPath) ignored.add(providerPath);
|
|
40
|
-
}
|
|
41
|
-
return [...ignored];
|
|
42
|
-
}
|
|
43
|
-
function readCompactionOverrideEntries(params) {
|
|
44
|
-
const entries = [];
|
|
45
|
-
const defaultCompaction = readRecord(readRecord(params.config?.agents)?.defaults)?.compaction;
|
|
46
|
-
const defaultRecord = readRecord(defaultCompaction);
|
|
47
|
-
if (defaultRecord) entries.push({
|
|
48
|
-
path: "agents.defaults",
|
|
49
|
-
record: defaultRecord
|
|
50
|
-
});
|
|
51
|
-
const agentId = readAgentIdFromSessionKey(params.sessionKey ?? params.sandboxSessionKey);
|
|
52
|
-
if (!agentId) return entries;
|
|
53
|
-
const agentCompaction = readRecord((Array.isArray(params.config?.agents?.list) ? params.config.agents.list : []).find((agent) => {
|
|
54
|
-
return (typeof agent?.id === "string" ? agent.id.trim().toLowerCase() : "") === agentId;
|
|
55
|
-
}))?.compaction;
|
|
56
|
-
const agentRecord = readRecord(agentCompaction);
|
|
57
|
-
if (agentRecord) entries.push({
|
|
58
|
-
path: `agents.list.${agentId}`,
|
|
59
|
-
record: agentRecord,
|
|
60
|
-
inheritedRecord: defaultRecord,
|
|
61
|
-
inheritedPath: "agents.defaults"
|
|
62
|
-
});
|
|
63
|
-
return entries;
|
|
64
|
-
}
|
|
65
|
-
function readAgentIdFromSessionKey(sessionKey) {
|
|
66
|
-
const parts = sessionKey?.trim().toLowerCase().split(":").filter(Boolean) ?? [];
|
|
67
|
-
if (parts.length < 3 || parts[0] !== "agent") return;
|
|
68
|
-
return parts[1]?.trim() || void 0;
|
|
69
|
-
}
|
|
70
|
-
function readRecord(value) {
|
|
71
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
72
|
-
}
|
|
73
|
-
async function compactCodexNativeThread(params, options = {}) {
|
|
74
|
-
if (params.trigger !== "manual" && !options.allowNonManualNativeRequest) {
|
|
75
|
-
embeddedAgentLog.info("skipping codex app-server compaction for non-manual trigger", {
|
|
76
|
-
sessionId: params.sessionId,
|
|
77
|
-
sessionKey: params.sessionKey,
|
|
78
|
-
trigger: params.trigger
|
|
79
|
-
});
|
|
80
|
-
return {
|
|
81
|
-
ok: true,
|
|
82
|
-
compacted: false,
|
|
83
|
-
reason: "codex app-server owns automatic compaction",
|
|
84
|
-
result: {
|
|
85
|
-
summary: "",
|
|
86
|
-
firstKeptEntryId: "",
|
|
87
|
-
tokensBefore: params.currentTokenCount ?? 0,
|
|
88
|
-
details: {
|
|
89
|
-
backend: "codex-app-server",
|
|
90
|
-
skipped: true,
|
|
91
|
-
reason: "non_manual_trigger",
|
|
92
|
-
trigger: params.trigger ?? "unknown"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
const nativeExecutionBlock = resolveCodexNativeExecutionBlock({
|
|
98
|
-
config: params.config,
|
|
99
|
-
sessionKey: params.sandboxSessionKey ?? params.sessionKey,
|
|
100
|
-
sessionId: params.sessionId,
|
|
101
|
-
surface: "native compaction"
|
|
102
|
-
});
|
|
103
|
-
if (nativeExecutionBlock) return {
|
|
104
|
-
ok: false,
|
|
105
|
-
compacted: false,
|
|
106
|
-
reason: nativeExecutionBlock
|
|
107
|
-
};
|
|
108
|
-
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: options.pluginConfig });
|
|
109
|
-
const initialBinding = await readCodexAppServerBinding(params.sessionFile, { config: params.config });
|
|
110
|
-
if (!initialBinding?.threadId) return failedCodexThreadBindingCompactionResult(params, {
|
|
111
|
-
reason: "no codex app-server thread binding",
|
|
112
|
-
recovery: "missing_thread_binding"
|
|
113
|
-
});
|
|
114
|
-
let binding = initialBinding;
|
|
115
|
-
const requestedAuthProfileId = params.authProfileId?.trim() || void 0;
|
|
116
|
-
if (requestedAuthProfileId && binding.authProfileId && binding.authProfileId !== requestedAuthProfileId) return {
|
|
117
|
-
ok: false,
|
|
118
|
-
compacted: false,
|
|
119
|
-
reason: "auth profile mismatch for session binding"
|
|
120
|
-
};
|
|
121
|
-
const shouldReleaseDefaultLease = !options.clientFactory;
|
|
122
|
-
const client = await (options.clientFactory ?? defaultLeasedCodexAppServerClientFactory)(appServer.start, requestedAuthProfileId ?? binding.authProfileId, params.agentDir, params.config);
|
|
123
|
-
try {
|
|
124
|
-
if (options.allowNonManualNativeRequest) {
|
|
125
|
-
const guardedResult = await withCodexAppServerBindingLock(params.sessionFile, async () => {
|
|
126
|
-
const currentBinding = await readCodexAppServerBinding(params.sessionFile, { config: params.config });
|
|
127
|
-
if (params.abortSignal?.aborted) return {
|
|
128
|
-
started: false,
|
|
129
|
-
result: skippedCodexNativeCompactionResult(params, {
|
|
130
|
-
reason: "codex app-server compaction aborted before native compaction",
|
|
131
|
-
code: "aborted_before_native_compaction",
|
|
132
|
-
expectedThreadId: binding.threadId,
|
|
133
|
-
currentThreadId: currentBinding?.threadId
|
|
134
|
-
})
|
|
135
|
-
};
|
|
136
|
-
if (!currentBinding || !isSameNativeCompactionBinding(currentBinding, binding)) {
|
|
137
|
-
embeddedAgentLog.warn("skipping codex app-server compaction because the thread binding changed", {
|
|
138
|
-
sessionId: params.sessionId,
|
|
139
|
-
sessionKey: params.sessionKey,
|
|
140
|
-
expectedThreadId: binding.threadId,
|
|
141
|
-
currentThreadId: currentBinding?.threadId
|
|
142
|
-
});
|
|
143
|
-
return {
|
|
144
|
-
started: false,
|
|
145
|
-
result: skippedCodexNativeCompactionResult(params, {
|
|
146
|
-
reason: "codex app-server binding changed before native compaction",
|
|
147
|
-
code: "binding_changed_before_native_compaction",
|
|
148
|
-
expectedThreadId: binding.threadId,
|
|
149
|
-
currentThreadId: currentBinding?.threadId
|
|
150
|
-
})
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
binding = currentBinding;
|
|
154
|
-
await clearContextEngineProjectionBeforeNativeCompaction({
|
|
155
|
-
sessionId: params.sessionId,
|
|
156
|
-
sessionFile: params.sessionFile,
|
|
157
|
-
binding,
|
|
158
|
-
config: params.config
|
|
159
|
-
});
|
|
160
|
-
await client.request("thread/compact/start", { threadId: binding.threadId }, { timeoutMs: Math.min(appServer.requestTimeoutMs, CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS) });
|
|
161
|
-
return { started: true };
|
|
162
|
-
});
|
|
163
|
-
if (!guardedResult.started) return guardedResult.result;
|
|
164
|
-
} else await client.request("thread/compact/start", { threadId: binding.threadId });
|
|
165
|
-
embeddedAgentLog.info("started codex app-server compaction", {
|
|
166
|
-
sessionId: params.sessionId,
|
|
167
|
-
threadId: binding.threadId
|
|
168
|
-
});
|
|
169
|
-
} catch (error) {
|
|
170
|
-
if (isCodexThreadNotFoundError(error)) return failedCodexThreadBindingCompactionResult(params, {
|
|
171
|
-
threadId: binding.threadId,
|
|
172
|
-
reason: formatCompactionError(error),
|
|
173
|
-
recovery: "stale_thread_binding"
|
|
174
|
-
});
|
|
175
|
-
embeddedAgentLog.warn("codex app-server compaction failed", {
|
|
176
|
-
sessionId: params.sessionId,
|
|
177
|
-
sessionKey: params.sessionKey,
|
|
178
|
-
threadId: binding.threadId,
|
|
179
|
-
reason: formatCompactionError(error)
|
|
180
|
-
});
|
|
181
|
-
return {
|
|
182
|
-
ok: false,
|
|
183
|
-
compacted: false,
|
|
184
|
-
reason: formatCompactionError(error)
|
|
185
|
-
};
|
|
186
|
-
} finally {
|
|
187
|
-
if (shouldReleaseDefaultLease) releaseLeasedSharedCodexAppServerClient(client);
|
|
188
|
-
}
|
|
189
|
-
const resultDetails = {
|
|
190
|
-
backend: "codex-app-server",
|
|
191
|
-
threadId: binding.threadId,
|
|
192
|
-
signal: "thread/compact/start",
|
|
193
|
-
pending: true,
|
|
194
|
-
...options.allowNonManualNativeRequest ? {
|
|
195
|
-
request: "after_context_engine",
|
|
196
|
-
trigger: params.trigger ?? "unknown"
|
|
197
|
-
} : {}
|
|
198
|
-
};
|
|
199
|
-
return {
|
|
200
|
-
ok: true,
|
|
201
|
-
compacted: false,
|
|
202
|
-
result: {
|
|
203
|
-
summary: "",
|
|
204
|
-
firstKeptEntryId: "",
|
|
205
|
-
tokensBefore: params.currentTokenCount ?? 0,
|
|
206
|
-
details: resultDetails
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
function skippedCodexNativeCompactionResult(params, skipped) {
|
|
211
|
-
return {
|
|
212
|
-
ok: true,
|
|
213
|
-
compacted: false,
|
|
214
|
-
reason: skipped.reason,
|
|
215
|
-
result: {
|
|
216
|
-
summary: "",
|
|
217
|
-
firstKeptEntryId: "",
|
|
218
|
-
tokensBefore: params.currentTokenCount ?? 0,
|
|
219
|
-
details: {
|
|
220
|
-
backend: "codex-app-server",
|
|
221
|
-
skipped: true,
|
|
222
|
-
reason: skipped.code,
|
|
223
|
-
request: "after_context_engine",
|
|
224
|
-
trigger: params.trigger ?? "unknown",
|
|
225
|
-
...skipped.expectedThreadId ? { expectedThreadId: skipped.expectedThreadId } : {},
|
|
226
|
-
...skipped.currentThreadId ? { currentThreadId: skipped.currentThreadId } : {}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
function failedCodexThreadBindingCompactionResult(params, recovery) {
|
|
232
|
-
embeddedAgentLog.warn("codex app-server compaction could not use thread binding", {
|
|
233
|
-
sessionId: params.sessionId,
|
|
234
|
-
sessionKey: params.sessionKey,
|
|
235
|
-
threadId: recovery.threadId,
|
|
236
|
-
reason: recovery.reason,
|
|
237
|
-
recovery: recovery.recovery
|
|
238
|
-
});
|
|
239
|
-
return {
|
|
240
|
-
ok: false,
|
|
241
|
-
compacted: false,
|
|
242
|
-
reason: recovery.reason,
|
|
243
|
-
failure: {
|
|
244
|
-
reason: recovery.recovery,
|
|
245
|
-
rawError: recovery.reason
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
async function clearContextEngineProjectionBeforeNativeCompaction(params) {
|
|
250
|
-
const contextEngineBinding = params.binding.contextEngine;
|
|
251
|
-
if (!contextEngineBinding?.projection) return;
|
|
252
|
-
await writeCodexAppServerBinding(params.sessionFile, {
|
|
253
|
-
...params.binding,
|
|
254
|
-
contextEngine: {
|
|
255
|
-
...contextEngineBinding,
|
|
256
|
-
projection: void 0
|
|
257
|
-
},
|
|
258
|
-
createdAt: params.binding.createdAt
|
|
259
|
-
}, { config: params.config });
|
|
260
|
-
embeddedAgentLog.info("cleared codex context-engine projection before native compaction", {
|
|
261
|
-
sessionId: params.sessionId,
|
|
262
|
-
threadId: params.binding.threadId,
|
|
263
|
-
previousEpoch: contextEngineBinding.projection.epoch,
|
|
264
|
-
previousFingerprint: contextEngineBinding.projection.fingerprint
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
function isSameNativeCompactionBinding(current, expected) {
|
|
268
|
-
return current.threadId === expected.threadId && current.authProfileId === expected.authProfileId && current.contextEngine?.engineId === expected.contextEngine?.engineId && current.contextEngine?.policyFingerprint === expected.contextEngine?.policyFingerprint && current.contextEngine?.projection?.mode === expected.contextEngine?.projection?.mode && current.contextEngine?.projection?.epoch === expected.contextEngine?.projection?.epoch && current.contextEngine?.projection?.fingerprint === expected.contextEngine?.projection?.fingerprint;
|
|
269
|
-
}
|
|
270
|
-
function isCodexThreadNotFoundError(error) {
|
|
271
|
-
return formatCompactionError(error).toLowerCase().includes("thread not found");
|
|
272
|
-
}
|
|
273
|
-
function formatCompactionError(error) {
|
|
274
|
-
if (error instanceof Error) return error.message;
|
|
275
|
-
return String(error);
|
|
276
|
-
}
|
|
277
|
-
//#endregion
|
|
278
|
-
export { maybeCompactCodexAppServerSession };
|