@openclaw/codex 2026.7.2-beta.7 → 2026.8.1-beta.3

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.
Files changed (68) hide show
  1. package/README.md +2 -0
  2. package/dist/api.js +147 -0
  3. package/dist/app-server-policy-bg5QPSVP.js +25 -0
  4. package/dist/attempt-client-cleanup-URjUlCHg.js +735 -0
  5. package/dist/binding-connection-DAvZwp96.js +45 -0
  6. package/dist/{bounded-turn-D2ZAgZVz.js → bounded-turn-4BjrZEwW.js} +63 -56
  7. package/dist/{capabilities-BFDTVYr4.js → capabilities-CH3K57v4.js} +8 -2
  8. package/dist/cli-metadata.js +1 -1
  9. package/dist/{command-formatters-C336eRVS.js → command-formatters-D0nZ3qtd.js} +18 -18
  10. package/dist/{command-handlers-DAHUSry9.js → command-handlers-DC86lgT4.js} +507 -101
  11. package/dist/command-rpc-xUIIonsO.js +90 -0
  12. package/dist/{compact-D_uvHurS.js → compact-COqgBRny.js} +234 -214
  13. package/dist/{session-binding-BXpo9ymA.js → config-CpNeo5AE.js} +284 -1163
  14. package/dist/context-compaction-activity-BOeJf7yo.js +58 -0
  15. package/dist/{conversation-binding-data-BHRpYbX3.js → conversation-binding-data-CW2GuupV.js} +6 -10
  16. package/dist/doctor-contract-api.js +48 -50
  17. package/dist/{dynamic-tools-D2gYkSBO.js → dynamic-tools-fJZhl4CE.js} +3442 -1433
  18. package/dist/{effective-mcp-catalog-Bbd98Inw.js → effective-mcp-catalog-4YKn51aG.js} +20 -15
  19. package/dist/elicitation-input-DMkeki8d.js +71 -0
  20. package/dist/{event-projector-assistant-message-DTgnPPVF.js → event-projector-assistant-message-BwxV4d6N.js} +11 -23
  21. package/dist/{attempt-notifications-AP-a-Q5k.js → event-projector-usage-CLwNEJqW.js} +113 -29
  22. package/dist/harness-DoKQcF8n.js +258 -0
  23. package/dist/harness.js +2 -160
  24. package/dist/image-payload-sanitizer-CnfoUPCE.js +65 -0
  25. package/dist/index.js +730 -256
  26. package/dist/isolated-completion-DPMtlH9r.js +75 -0
  27. package/dist/local-runtime-attribution-B_2mnqhb.js +19 -0
  28. package/dist/managed-binary-By4FZC6i.js +212 -0
  29. package/dist/media-understanding-provider.js +5 -5
  30. package/dist/model-catalog-CmGoqVKB.js +48 -0
  31. package/dist/{models-BBMKU4jA.js → models-CZw1wClT.js} +12 -17
  32. package/dist/native-subagent-monitor-GGq3RnOo.js +3225 -0
  33. package/dist/node-exec-server.runtime-Bsu1LdFZ.js +192 -0
  34. package/dist/{plugin-app-cache-key-DztPafOA.js → plugin-app-cache-key-DMNQ8Zi8.js} +18 -6
  35. package/dist/plugin-approval-roundtrip-C75Yiiwc.js +95 -0
  36. package/dist/plugin-marketplace-discovery-CSWDkMrP.js +399 -0
  37. package/dist/{computer-use-CYEc8U3w.js → plugin-metadata-cache-BXH5NF-4.js} +109 -6
  38. package/dist/protocol-validators-VAVyEnDp.js +2399 -0
  39. package/dist/{rate-limits-CU-gVCCS.js → rate-limits-BI1dMHDG.js} +17 -35
  40. package/dist/{request-qKh331yu.js → request-DSK0W6YI.js} +3 -3
  41. package/dist/{run-attempt-CY9WlDLc.js → run-attempt-BV3HzuCf.js} +3416 -7194
  42. package/dist/{runtime-artifact-CmtG_t1L.js → runtime-artifact-BvyT1uyd.js} +11 -29
  43. package/dist/{sandbox-guard-NuhpXmPB.js → sandbox-guard-C1qEeZ5C.js} +29 -30
  44. package/dist/session-binding-BTrLf9Qm.js +874 -0
  45. package/dist/{session-catalog-DyOgR4WH.js → session-catalog-ezP_UcRM.js} +1584 -1289
  46. package/dist/session-catalog-home-id-BNwAJ9D7.js +18 -0
  47. package/dist/{session-cli-2PZaFLRh.js → session-cli-B1hKvfkI.js} +20 -7
  48. package/dist/session-retirement-CE4iMiLh.js +36 -0
  49. package/dist/{session-upstream-marker-B6U7tLw5.js → session-upstream-marker-D_2npHlA.js} +1 -1
  50. package/dist/{settled-turn-finalizer-CXY2Z9dT.js → settled-turn-finalizer-Dx1onIqg.js} +40 -28
  51. package/dist/{shared-client-DTbvH-XV.js → shared-client-Dw-rzii0.js} +1315 -469
  52. package/dist/{side-question-_ulBk1AL.js → side-question-DbXkJZzg.js} +140 -69
  53. package/dist/{thread-lifecycle-DF53ogiA.js → thread-lifecycle-DKdrnTMX.js} +927 -768
  54. package/dist/thread-ownership-i2NBwDUL.js +92 -0
  55. package/dist/thread-resume-CdJk2Ehf.js +30 -0
  56. package/dist/transcript-mirror-BU0_LKAL.js +588 -0
  57. package/dist/{transport-stdio-DXgGZ7Ib.js → transport-stdio-DhoGy33Z.js} +13 -2
  58. package/dist/upstream-prompt-provenance-CFmsKwr9.js +39 -0
  59. package/dist/{upstream-session-fork-Dy4Xvuoj.js → upstream-session-fork-BDVJCLAD.js} +14 -8
  60. package/dist/{usage-CQ6GhD5-.js → usage-9dKJCgcy.js} +3 -3
  61. package/dist/{web-search-provider.runtime-CCFhg2z5.js → web-search-provider.runtime-DCdx4DGu.js} +8 -9
  62. package/openclaw.plugin.json +49 -4
  63. package/package.json +6 -5
  64. package/dist/app-server-policy-BSaO2JIT.js +0 -49
  65. package/dist/conversation-control-xsIeXbo4.js +0 -287
  66. package/dist/event-projector-usage-Xp4AlR2k.js +0 -86
  67. package/dist/notification-correlation-CU6_AnOb.js +0 -67
  68. package/dist/transcript-mirror-DzsdNCf5.js +0 -6924
@@ -0,0 +1,258 @@
1
+ import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
2
+ import { completeWithPreparedSimpleCompletionModel } from "openclaw/plugin-sdk/simple-completion-runtime";
3
+ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ //#region extensions/codex/src/app-server/model-runtime.ts
5
+ const CODEX_APP_SERVER_RUNTIME_MODEL_PARAM = "codexAppServerRuntimeModel";
6
+ function buildCodexRuntimeModelParams(catalogId, runtimeModelId) {
7
+ return catalogId === runtimeModelId ? void 0 : { [CODEX_APP_SERVER_RUNTIME_MODEL_PARAM]: runtimeModelId };
8
+ }
9
+ function readCodexRuntimeModelId(model, fallbackId) {
10
+ return normalizeOptionalString(model?.params?.[CODEX_APP_SERVER_RUNTIME_MODEL_PARAM]) ?? model?.id ?? fallbackId;
11
+ }
12
+ //#endregion
13
+ //#region extensions/codex/harness.ts
14
+ const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = /* @__PURE__ */ new Set(["codex", "openai"]);
15
+ const SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER = Symbol.for("openclaw.codexAppServerClientDisposer");
16
+ const CODEX_TOOL_POLICY_SAFE_DENY_NAMES = [
17
+ "web_fetch",
18
+ "x_search",
19
+ "memory_search",
20
+ "memory_get",
21
+ "dashboard",
22
+ "canvas",
23
+ "show_widget",
24
+ "message",
25
+ "heartbeat_respond",
26
+ "automations",
27
+ "gateway",
28
+ "skill_workshop",
29
+ "image_generate",
30
+ "music_generate",
31
+ "video_generate",
32
+ "tts"
33
+ ];
34
+ const CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES = [
35
+ "bootstrap",
36
+ "assemble-before-prompt",
37
+ "after-turn",
38
+ "maintain",
39
+ "compact",
40
+ "runtime-llm-complete",
41
+ "thread-bootstrap-projection"
42
+ ];
43
+ async function runCodexHostPreparedIsolatedCompletion(params) {
44
+ const timeoutSignal = AbortSignal.timeout(params.timeoutMs);
45
+ const signal = params.abortSignal ? AbortSignal.any([params.abortSignal, timeoutSignal]) : timeoutSignal;
46
+ return { assistant: await completeWithPreparedSimpleCompletionModel({
47
+ model: params.model,
48
+ auth: params.auth,
49
+ cfg: params.config,
50
+ context: {
51
+ systemPrompt: params.systemPrompt,
52
+ messages: [{
53
+ role: "user",
54
+ content: params.prompt,
55
+ timestamp: Date.now()
56
+ }],
57
+ tools: []
58
+ },
59
+ options: {
60
+ maxTokens: params.streamParams?.maxTokens,
61
+ temperature: params.streamParams?.temperature,
62
+ reasoning: params.thinkLevel,
63
+ signal
64
+ }
65
+ }) };
66
+ }
67
+ async function disposeSharedCodexAppServerClients() {
68
+ const dispose = globalThis[SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER];
69
+ await dispose?.();
70
+ }
71
+ /**
72
+ * Creates the Codex app-server harness used for attempts, side questions,
73
+ * compaction, reset, and disposal.
74
+ */
75
+ function createCodexAppServerAgentHarness(options) {
76
+ const harnessRuntimeId = options?.id ?? "codex";
77
+ const normalizedHarnessRuntimeId = harnessRuntimeId.trim().toLowerCase();
78
+ const providerIds = new Set([...options?.providerIds ?? DEFAULT_CODEX_HARNESS_PROVIDER_IDS].map((id) => id.trim().toLowerCase()));
79
+ const sessionCatalogControlFactory = options.sessionCatalogControlFactory;
80
+ const sessionRuntime = options.runtime;
81
+ const resolveAttemptPluginConfig = (config) => resolvePluginConfigObject(config, "codex") ?? options.resolvePluginConfig?.() ?? options.pluginConfig;
82
+ return {
83
+ id: harnessRuntimeId,
84
+ label: options?.label ?? "Codex agent harness",
85
+ autoSelection: { providerIds: [...providerIds] },
86
+ cloudPlacement: {
87
+ mode: "remote-exec",
88
+ devicePlacement: {
89
+ requiredNodeCommands: ["codex.exec-server.stdio.v1"],
90
+ consumesWorkerSlot: false
91
+ }
92
+ },
93
+ delegatedExecutionPluginIds: ["voice-call"],
94
+ contextEngineHostCapabilities: CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES,
95
+ conversationToolPolicySupport: "exact",
96
+ conversationToolPolicySafeDenyTools: CODEX_TOOL_POLICY_SAFE_DENY_NAMES,
97
+ deliveryDefaults: { visibleReplies: "message_tool" },
98
+ authBootstrap: "harness",
99
+ ...sessionCatalogControlFactory && sessionRuntime ? { sessionFork: {
100
+ upstreamKinds: ["codex-app-server"],
101
+ fork: async (params) => {
102
+ const { forkCodexUpstreamSession } = await import("./upstream-session-fork-BDVJCLAD.js");
103
+ return await forkCodexUpstreamSession(params, {
104
+ bindingStore: options.bindingStore,
105
+ controlFactory: sessionCatalogControlFactory,
106
+ harnessRuntimeId,
107
+ resolveConfig: options.resolveConfig,
108
+ runtime: sessionRuntime
109
+ });
110
+ }
111
+ } } : {},
112
+ authBinding: { fingerprint: async (params) => {
113
+ const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-B4FfbcCg.js").then((n) => n.t);
114
+ return fingerprintCodexAppServerAuthBinding(params);
115
+ } },
116
+ runtimeArtifact: { validate: async (binding) => {
117
+ const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-BvyT1uyd.js");
118
+ return validateCodexAppServerRuntimeArtifact(binding);
119
+ } },
120
+ fetchUsageSnapshot: async (ctx) => {
121
+ const { fetchCodexAppServerUsageSnapshot } = await import("./usage-9dKJCgcy.js");
122
+ return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
123
+ },
124
+ loadModelCatalog: async (params) => {
125
+ const { loadCodexAppServerModelCatalog } = await import("./model-catalog-CmGoqVKB.js");
126
+ return await loadCodexAppServerModelCatalog(params, resolveAttemptPluginConfig(params.config));
127
+ },
128
+ loadMcpToolCatalog: async (params) => {
129
+ const { loadCodexEffectiveMcpCatalog } = await import("./effective-mcp-catalog-4YKn51aG.js");
130
+ return await loadCodexEffectiveMcpCatalog(params, { bindingStore: options.bindingStore });
131
+ },
132
+ supports: (ctx) => {
133
+ const provider = ctx.provider.trim().toLowerCase();
134
+ if (!providerIds.has(provider)) return {
135
+ supported: false,
136
+ reason: `provider is not one of: ${[...providerIds].toSorted().join(", ")}`
137
+ };
138
+ if (ctx.modelProvider?.requestTransportOverrides === "present") return {
139
+ supported: false,
140
+ reason: "Codex cannot reproduce authored request transport overrides",
141
+ fallbackRuntime: "openclaw"
142
+ };
143
+ const preparedAuth = ctx.modelProvider?.preparedAuth;
144
+ const runtimePolicy = ctx.modelProvider?.runtimePolicy;
145
+ const nativeAccountOwnsUnobservedModel = provider === "openai" && ctx.requestedRuntime === "codex" && Boolean(ctx.modelId?.trim()) && (preparedAuth === void 0 || preparedAuth.source === "harness") && preparedAuth?.mode === void 0 && preparedAuth?.requirement === void 0 && ctx.modelProvider?.api === void 0 && ctx.modelProvider?.baseUrl === void 0 && ctx.modelProvider?.azureApiVersion === void 0 && ctx.modelProvider?.request === void 0;
146
+ if (runtimePolicy) {
147
+ if (!runtimePolicy.compatibleIds.some((id) => id.trim().toLowerCase() === normalizedHarnessRuntimeId)) return {
148
+ supported: false,
149
+ reason: "Codex cannot reproduce the prepared provider route"
150
+ };
151
+ } else if (ctx.modelProvider && provider !== "codex" && !nativeAccountOwnsUnobservedModel) return {
152
+ supported: false,
153
+ reason: "provider route compatibility with Codex is not declared"
154
+ };
155
+ if (preparedAuth?.requirement === "subscription") {
156
+ if (!(preparedAuth.source === "profile" && (preparedAuth.mode === "oauth" || preparedAuth.mode === "token"))) return {
157
+ supported: false,
158
+ reason: "Codex subscription auth requires a prepared OAuth or token profile"
159
+ };
160
+ } else if (preparedAuth?.requirement === "api-key") {
161
+ if (!(preparedAuth.source !== "none" && preparedAuth.source !== "harness" && (preparedAuth.mode === "api-key" || preparedAuth.mode === "api_key"))) return {
162
+ supported: false,
163
+ reason: "Codex Platform auth requires a prepared API key"
164
+ };
165
+ }
166
+ return {
167
+ supported: true,
168
+ priority: 100
169
+ };
170
+ },
171
+ runAttempt: async (params) => {
172
+ const { runCodexAppServerAttempt } = await import("./run-attempt-BV3HzuCf.js");
173
+ return runCodexAppServerAttempt(params, {
174
+ bindingStore: options.bindingStore,
175
+ pluginConfig: resolveAttemptPluginConfig(params.config),
176
+ runtime: sessionRuntime,
177
+ runtimeModelId: readCodexRuntimeModelId(params.model, params.modelId),
178
+ nativeHookRelay: { enabled: true }
179
+ });
180
+ },
181
+ runIsolatedCompletionV2: async (params) => {
182
+ if (params.authorization.owner === "host") {
183
+ const { authorization, ...commonParams } = params;
184
+ return runCodexHostPreparedIsolatedCompletion({
185
+ ...commonParams,
186
+ model: authorization.model,
187
+ auth: authorization.auth,
188
+ ...authorization.sourceAuthFingerprint ? { sourceAuthFingerprint: authorization.sourceAuthFingerprint } : {}
189
+ });
190
+ }
191
+ const { runCodexIsolatedCompletion } = await import("./isolated-completion-DPMtlH9r.js");
192
+ return runCodexIsolatedCompletion(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
193
+ },
194
+ runIsolatedCompletion: async (params) => {
195
+ return runCodexHostPreparedIsolatedCompletion(params);
196
+ },
197
+ finalizeSettledTurn: async (params) => {
198
+ const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-Dx1onIqg.js");
199
+ return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
200
+ },
201
+ runSideQuestion: async (params) => {
202
+ const { runCodexAppServerSideQuestion } = await import("./side-question-DbXkJZzg.js");
203
+ return runCodexAppServerSideQuestion(params, {
204
+ bindingStore: options.bindingStore,
205
+ pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
206
+ runtime: sessionRuntime,
207
+ runtimeModelId: readCodexRuntimeModelId(params.runtimeModel, params.model),
208
+ nativeHookRelay: { enabled: true }
209
+ });
210
+ },
211
+ compact: async (params) => {
212
+ const { maybeCompactCodexAppServerSession } = await import("./compact-COqgBRny.js");
213
+ return maybeCompactCodexAppServerSession(params, {
214
+ bindingStore: options.bindingStore,
215
+ pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
216
+ });
217
+ },
218
+ reset: async (params) => {
219
+ if (params.sessionId) {
220
+ const [{ reclaimCurrentCodexSessionGeneration, sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./session-binding-BTrLf9Qm.js").then((n) => n.f), import("./session-retirement-CE4iMiLh.js")]);
221
+ const identity = sessionBindingIdentity({
222
+ agentId: params.agentId,
223
+ sessionId: params.sessionId,
224
+ sessionKey: params.sessionKey
225
+ });
226
+ const resetGeneration = () => retireCodexAppServerSessionGeneration({
227
+ bindingStore: options.bindingStore,
228
+ identity,
229
+ mode: params.reason === "deleted" ? "retire" : "reset"
230
+ });
231
+ let reset = await resetGeneration();
232
+ if (reset === "conflict") {
233
+ if (await reclaimCurrentCodexSessionGeneration({
234
+ bindingStore: options.bindingStore,
235
+ identity,
236
+ config: options.resolveConfig?.()
237
+ })) reset = await resetGeneration();
238
+ }
239
+ if (reset === "conflict") throw new Error(`Codex binding generation changed before session ${params.sessionId} could reset`);
240
+ }
241
+ },
242
+ dispose: disposeSharedCodexAppServerClients
243
+ };
244
+ }
245
+ /** Creates the private native-compaction bridge registered in host-owned capability state. */
246
+ function createCodexAppServerNativeCompaction(options) {
247
+ return async (params) => {
248
+ const { maybeCompactCodexAppServerSession } = await import("./compact-COqgBRny.js");
249
+ return maybeCompactCodexAppServerSession(params, {
250
+ bindingStore: options.bindingStore,
251
+ pluginConfig: options.resolvePluginConfig?.() ?? options.pluginConfig,
252
+ allowNonManualNativeRequest: true,
253
+ nativeCompactionRequest: params.nativeCompactionRequest
254
+ });
255
+ };
256
+ }
257
+ //#endregion
258
+ export { createCodexAppServerNativeCompaction as n, buildCodexRuntimeModelParams as r, createCodexAppServerAgentHarness as t };
package/dist/harness.js CHANGED
@@ -1,160 +1,2 @@
1
- //#region extensions/codex/harness.ts
2
- const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = /* @__PURE__ */ new Set(["codex", "openai"]);
3
- const SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER = Symbol.for("openclaw.codexAppServerClientDisposer");
4
- const CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES = [
5
- "bootstrap",
6
- "assemble-before-prompt",
7
- "after-turn",
8
- "maintain",
9
- "compact",
10
- "runtime-llm-complete",
11
- "thread-bootstrap-projection"
12
- ];
13
- async function disposeSharedCodexAppServerClients() {
14
- const dispose = globalThis[SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER];
15
- await dispose?.();
16
- }
17
- /**
18
- * Creates the Codex app-server harness used for attempts, side questions,
19
- * compaction, reset, and disposal.
20
- */
21
- function createCodexAppServerAgentHarness(options) {
22
- const harnessRuntimeId = options?.id ?? "codex";
23
- const normalizedHarnessRuntimeId = harnessRuntimeId.trim().toLowerCase();
24
- const providerIds = new Set([...options?.providerIds ?? DEFAULT_CODEX_HARNESS_PROVIDER_IDS].map((id) => id.trim().toLowerCase()));
25
- const sessionCatalogControl = options.sessionCatalogControl;
26
- const sessionRuntime = options.runtime;
27
- return {
28
- id: harnessRuntimeId,
29
- label: options?.label ?? "Codex agent harness",
30
- autoSelection: { providerIds: [...providerIds] },
31
- delegatedExecutionPluginIds: ["voice-call"],
32
- contextEngineHostCapabilities: CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES,
33
- deliveryDefaults: { visibleReplies: "message_tool" },
34
- authBootstrap: "harness",
35
- ...sessionCatalogControl && sessionRuntime ? { sessionFork: {
36
- upstreamKinds: ["codex-app-server"],
37
- fork: async (params) => {
38
- const { forkCodexUpstreamSession } = await import("./upstream-session-fork-Dy4Xvuoj.js");
39
- return await forkCodexUpstreamSession(params, {
40
- bindingStore: options.bindingStore,
41
- control: sessionCatalogControl,
42
- harnessRuntimeId,
43
- resolveConfig: options.resolveConfig,
44
- runtime: sessionRuntime
45
- });
46
- }
47
- } } : {},
48
- authBinding: { fingerprint: async (params) => {
49
- const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-B4FfbcCg.js").then((n) => n.t);
50
- return fingerprintCodexAppServerAuthBinding(params);
51
- } },
52
- runtimeArtifact: { validate: async (binding) => {
53
- const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-CmtG_t1L.js");
54
- return validateCodexAppServerRuntimeArtifact(binding);
55
- } },
56
- fetchUsageSnapshot: async (ctx) => {
57
- const { fetchCodexAppServerUsageSnapshot } = await import("./usage-CQ6GhD5-.js");
58
- return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
59
- },
60
- loadMcpToolCatalog: async (params) => {
61
- const { loadCodexEffectiveMcpCatalog } = await import("./effective-mcp-catalog-Bbd98Inw.js");
62
- return await loadCodexEffectiveMcpCatalog(params, { bindingStore: options.bindingStore });
63
- },
64
- supports: (ctx) => {
65
- const provider = ctx.provider.trim().toLowerCase();
66
- if (!providerIds.has(provider)) return {
67
- supported: false,
68
- reason: `provider is not one of: ${[...providerIds].toSorted().join(", ")}`
69
- };
70
- if (ctx.modelProvider?.requestTransportOverrides === "present") return {
71
- supported: false,
72
- reason: "Codex cannot reproduce authored request transport overrides"
73
- };
74
- const preparedAuth = ctx.modelProvider?.preparedAuth;
75
- const runtimePolicy = ctx.modelProvider?.runtimePolicy;
76
- if (runtimePolicy) {
77
- if (!runtimePolicy.compatibleIds.some((id) => id.trim().toLowerCase() === normalizedHarnessRuntimeId)) return {
78
- supported: false,
79
- reason: "Codex cannot reproduce the prepared provider route"
80
- };
81
- } else if (ctx.modelProvider && provider !== "codex") return {
82
- supported: false,
83
- reason: "provider route compatibility with Codex is not declared"
84
- };
85
- if (preparedAuth?.requirement === "subscription") {
86
- if (!(preparedAuth.source === "profile" && (preparedAuth.mode === "oauth" || preparedAuth.mode === "token"))) return {
87
- supported: false,
88
- reason: "Codex subscription auth requires a prepared OAuth or token profile"
89
- };
90
- } else if (preparedAuth?.requirement === "api-key") {
91
- if (!(preparedAuth.source !== "none" && preparedAuth.source !== "harness" && (preparedAuth.mode === "api-key" || preparedAuth.mode === "api_key"))) return {
92
- supported: false,
93
- reason: "Codex Platform auth requires a prepared API key"
94
- };
95
- }
96
- return {
97
- supported: true,
98
- priority: 100
99
- };
100
- },
101
- runAttempt: async (params) => {
102
- const { runCodexAppServerAttempt } = await import("./run-attempt-CY9WlDLc.js");
103
- return runCodexAppServerAttempt(params, {
104
- bindingStore: options.bindingStore,
105
- pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
106
- nativeHookRelay: { enabled: true }
107
- });
108
- },
109
- finalizeSettledTurn: async (params) => {
110
- const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-CXY2Z9dT.js");
111
- return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
112
- },
113
- runSideQuestion: async (params) => {
114
- const { runCodexAppServerSideQuestion } = await import("./side-question-_ulBk1AL.js");
115
- return runCodexAppServerSideQuestion(params, {
116
- bindingStore: options.bindingStore,
117
- pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
118
- nativeHookRelay: { enabled: true }
119
- });
120
- },
121
- compact: async (params) => {
122
- const { maybeCompactCodexAppServerSession } = await import("./compact-D_uvHurS.js");
123
- return maybeCompactCodexAppServerSession(params, {
124
- bindingStore: options.bindingStore,
125
- pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
126
- });
127
- },
128
- compactAfterContextEngine: async (params) => {
129
- const { maybeCompactCodexAppServerSession } = await import("./compact-D_uvHurS.js");
130
- return maybeCompactCodexAppServerSession(params, {
131
- bindingStore: options.bindingStore,
132
- pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
133
- allowNonManualNativeRequest: true
134
- });
135
- },
136
- reset: async (params) => {
137
- if (params.sessionId) {
138
- const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-BXpo9ymA.js").then((n) => n.f);
139
- const identity = sessionBindingIdentity({
140
- agentId: params.agentId,
141
- sessionId: params.sessionId,
142
- sessionKey: params.sessionKey
143
- });
144
- const resetGeneration = params.reason === "deleted" ? options.bindingStore.retireSessionGeneration.bind(options.bindingStore) : options.bindingStore.resetSessionGeneration.bind(options.bindingStore);
145
- let reset = await resetGeneration(identity);
146
- if (reset === "conflict") {
147
- if (await reclaimCurrentCodexSessionGeneration({
148
- bindingStore: options.bindingStore,
149
- identity,
150
- config: options.resolveConfig?.()
151
- })) reset = await resetGeneration(identity);
152
- }
153
- if (reset === "conflict") throw new Error(`Codex binding generation changed before session ${params.sessionId} could reset`);
154
- }
155
- },
156
- dispose: disposeSharedCodexAppServerClients
157
- };
158
- }
159
- //#endregion
160
- export { createCodexAppServerAgentHarness };
1
+ import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./harness-DoKQcF8n.js";
2
+ export { createCodexAppServerAgentHarness, createCodexAppServerNativeCompaction };
@@ -0,0 +1,65 @@
1
+ import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
2
+ import { INLINE_IMAGE_DATA_URL_PREFIX, sanitizeInlineImageDataUrl } from "openclaw/plugin-sdk/inline-image-data-url-runtime";
3
+ //#region extensions/codex/src/app-server/image-payload-sanitizer.ts
4
+ /**
5
+ * Sanitizes inline image payloads mirrored through Codex history so invalid
6
+ * base64 data becomes readable text instead of poisoning replayed transcripts.
7
+ */
8
+ const IMAGE_OMITTED_TEXT = "omitted image payload: invalid inline image data";
9
+ /** Validates and normalizes an inline image data URL for Codex history payloads. */
10
+ function sanitizeInlineImageDataUrl$1(imageUrl) {
11
+ return sanitizeInlineImageDataUrl(imageUrl);
12
+ }
13
+ /** Builds the replacement text inserted when an inline image payload is invalid. */
14
+ function invalidInlineImageText(label) {
15
+ return `[${label}] ${IMAGE_OMITTED_TEXT}`;
16
+ }
17
+ function sanitizeImageContentRecord(record, label) {
18
+ if (record.type === "image" && typeof record.data === "string") {
19
+ const mimeType = typeof record.mimeType === "string" ? record.mimeType : "image/png";
20
+ const imageUrl = sanitizeInlineImageDataUrl$1(`data:${mimeType};base64,${record.data}`);
21
+ if (!imageUrl) return {
22
+ type: "text",
23
+ text: invalidInlineImageText(label)
24
+ };
25
+ const commaIndex = imageUrl.indexOf(",");
26
+ const mime = imageUrl.slice(INLINE_IMAGE_DATA_URL_PREFIX.length, commaIndex).split(";")[0] ?? mimeType;
27
+ return {
28
+ ...record,
29
+ mimeType: mime,
30
+ data: imageUrl.slice(commaIndex + 1)
31
+ };
32
+ }
33
+ if (record.type === "inputImage" && typeof record.imageUrl === "string") {
34
+ const imageUrl = sanitizeInlineImageDataUrl$1(record.imageUrl);
35
+ return imageUrl ? {
36
+ ...record,
37
+ imageUrl
38
+ } : {
39
+ type: "inputText",
40
+ text: invalidInlineImageText(label)
41
+ };
42
+ }
43
+ if (record.type === "input_image" && typeof record.image_url === "string") {
44
+ const imageUrl = sanitizeInlineImageDataUrl$1(record.image_url);
45
+ return imageUrl ? {
46
+ ...record,
47
+ image_url: imageUrl
48
+ } : {
49
+ type: "input_text",
50
+ text: invalidInlineImageText(label)
51
+ };
52
+ }
53
+ }
54
+ /** Recursively sanitizes all Codex history image shapes while preserving unknown structure. */
55
+ function sanitizeCodexHistoryImagePayloads(value, label) {
56
+ if (Array.isArray(value)) return value.map((entry) => sanitizeCodexHistoryImagePayloads(entry, label));
57
+ if (!isRecord(value)) return value;
58
+ const imageRecord = sanitizeImageContentRecord(value, label);
59
+ if (imageRecord) return imageRecord;
60
+ const next = {};
61
+ for (const [key, child] of Object.entries(value)) next[key] = sanitizeCodexHistoryImagePayloads(child, label);
62
+ return next;
63
+ }
64
+ //#endregion
65
+ export { sanitizeCodexHistoryImagePayloads as n, sanitizeInlineImageDataUrl$1 as r, invalidInlineImageText as t };