@openclaw/codex 2026.7.2-beta.3 → 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-DUMF2Xyr.js → app-server-policy-BmDgseo_.js} +1 -1
- package/dist/attempt-client-cleanup-Ia52yRWc.js +127 -0
- package/dist/{attempt-notifications-Ecjyzufe.js → attempt-notifications-CMR2_fmR.js} +1 -1
- package/dist/{media-understanding-provider-IPNNQre6.js → bounded-turn-FEbUXoYT.js} +71 -188
- package/dist/capabilities-BHRSI6Cn.js +36 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-NCTL7A2q.js → command-formatters-ico4ZFnk.js} +3 -37
- package/dist/{command-handlers-DtFbZiba.js → command-handlers-CRmnwI2N.js} +1233 -1221
- package/dist/{compact-Kgy26gIM.js → compact-dEN49UH6.js} +8 -7
- package/dist/{computer-use-C7x4ZaqR.js → computer-use-BjGylO-E.js} +16 -6
- package/dist/{conversation-control-B0s3aIjT.js → conversation-control-DE7d9DOj.js} +6 -5
- package/dist/doctor-contract-api.js +24 -86
- package/dist/{dynamic-tools-D_vSVmv9.js → dynamic-tools-LIt9ojep.js} +135 -2696
- package/dist/event-projector-assistant-message-DTgnPPVF.js +101 -0
- package/dist/event-projector-usage-tvgb1NCX.js +69 -0
- package/dist/harness.js +31 -11
- package/dist/incognito-session-ET_ufDH-.js +2 -0
- package/dist/index.js +250 -275
- package/dist/media-understanding-provider.js +173 -1
- package/dist/{models-DD5zBdX5.js → models-BA01NEez.js} +2 -2
- package/dist/{notification-correlation-C8DVQ_Bq.js → notification-correlation-Bj_Ak_jI.js} +3 -3
- package/dist/{plugin-app-cache-key-DJbhLYSK.js → plugin-app-cache-key-DSXX-rXO.js} +5 -5
- package/dist/{transcript-mirror-D9rTxx2P.js → protocol-validators-Dm4eXZmt.js} +335 -595
- package/dist/{rate-limits-CqhWQ2R9.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-9yf9pZjf.js → request-CXpPennK.js} +1 -1
- package/dist/{run-attempt-BIoO8ISr.js → run-attempt-C5GTPJOE.js} +3111 -387
- package/dist/{session-binding-Bmt20HfB.js → session-binding-DlVQ-Pxs.js} +957 -890
- package/dist/{session-catalog-CA7R-hX2.js → session-catalog-CP2oCcEb.js} +98 -87
- package/dist/{session-cli-Bxk3-Wqz.js → session-cli-CqZ0Fp2a.js} +2 -2
- package/dist/session-upstream-marker-QE-m5QFG.js +82 -0
- package/dist/settled-turn-finalizer-CA_2QXIE.js +303 -0
- package/dist/{shared-client-CSXLtCLE.js → shared-client-BVKE40c-.js} +1870 -1694
- package/dist/{side-question-DtzquMOb.js → side-question-CO12sHxo.js} +24 -16
- package/dist/{thread-lifecycle-CQ_9mAa1.js → thread-lifecycle-DRg_FdzC.js} +127 -153
- package/dist/transcript-mirror-uKA-A4tB.js +550 -0
- package/dist/upstream-session-fork-_Vrz4WJr.js +320 -0
- package/dist/{usage-CuPpFgTc.js → usage-UpVbdX5G.js} +3 -3
- package/dist/{web-search-provider.runtime-_x5XTeqh.js → web-search-provider.runtime-CaQMYDbp.js} +3 -3
- package/package.json +7 -8
- package/npm-shrinkwrap.json +0 -202
- package/dist/{auth-binding-C1czuHPA.js → auth-binding-B4FfbcCg.js} +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
2
|
+
//#region extensions/codex/src/app-server/local-runtime-attribution.ts
|
|
3
|
+
const OPENAI_PROVIDER_ID = "openai";
|
|
4
|
+
const OPENAI_RESPONSES_API = "openai-responses";
|
|
5
|
+
const OPENAI_CODEX_RESPONSES_API = "openai-chatgpt-responses";
|
|
6
|
+
function normalizeRuntimeId(value) {
|
|
7
|
+
return value?.trim().toLowerCase() ?? "";
|
|
8
|
+
}
|
|
9
|
+
/** Maps local Codex runtime plans onto the provider/api pair exposed to event projection. */
|
|
10
|
+
function resolveCodexLocalRuntimeAttribution(params) {
|
|
11
|
+
const authProfileProvider = normalizeRuntimeId(params.runtimePlan?.auth?.authProfileProviderForAuth);
|
|
12
|
+
if (normalizeRuntimeId(params.runtimePlan?.observability.harnessId) === "codex" && authProfileProvider !== OPENAI_PROVIDER_ID && normalizeRuntimeId(params.model.provider) === OPENAI_PROVIDER_ID && normalizeRuntimeId(params.model.api) === OPENAI_RESPONSES_API) return {
|
|
13
|
+
provider: OPENAI_PROVIDER_ID,
|
|
14
|
+
api: OPENAI_CODEX_RESPONSES_API
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
provider: params.provider,
|
|
18
|
+
api: params.model.api
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region extensions/codex/src/app-server/event-projector-assistant-message.ts
|
|
23
|
+
const ZERO_USAGE = {
|
|
24
|
+
input: 0,
|
|
25
|
+
output: 0,
|
|
26
|
+
cacheRead: 0,
|
|
27
|
+
cacheWrite: 0,
|
|
28
|
+
totalTokens: 0,
|
|
29
|
+
cost: {
|
|
30
|
+
input: 0,
|
|
31
|
+
output: 0,
|
|
32
|
+
cacheRead: 0,
|
|
33
|
+
cacheWrite: 0,
|
|
34
|
+
total: 0
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
function createAssistantMessage(params, text, options) {
|
|
38
|
+
const attribution = resolveCodexLocalRuntimeAttribution(params);
|
|
39
|
+
const usage = options.tokenUsage ? {
|
|
40
|
+
input: options.tokenUsage.input ?? 0,
|
|
41
|
+
output: options.tokenUsage.output ?? 0,
|
|
42
|
+
cacheRead: options.tokenUsage.cacheRead ?? 0,
|
|
43
|
+
cacheWrite: options.tokenUsage.cacheWrite ?? 0,
|
|
44
|
+
...options.tokenUsage.contextUsage ? { contextUsage: options.tokenUsage.contextUsage } : {},
|
|
45
|
+
totalTokens: options.tokenUsage.total ?? (options.tokenUsage.input ?? 0) + (options.tokenUsage.output ?? 0) + (options.tokenUsage.cacheRead ?? 0) + (options.tokenUsage.cacheWrite ?? 0),
|
|
46
|
+
cost: ZERO_USAGE.cost
|
|
47
|
+
} : ZERO_USAGE;
|
|
48
|
+
return {
|
|
49
|
+
role: "assistant",
|
|
50
|
+
content: [{
|
|
51
|
+
type: "text",
|
|
52
|
+
text
|
|
53
|
+
}],
|
|
54
|
+
api: attribution.api ?? "openai-chatgpt-responses",
|
|
55
|
+
provider: attribution.provider,
|
|
56
|
+
model: params.modelId,
|
|
57
|
+
usage,
|
|
58
|
+
stopReason: options.aborted ? "aborted" : options.promptError ? "error" : "stop",
|
|
59
|
+
errorMessage: options.promptError ? formatErrorMessage(options.promptError) : void 0,
|
|
60
|
+
timestamp: Date.now()
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function createAssistantCommentaryMessage(params, text, itemId, timestamp) {
|
|
64
|
+
const attribution = resolveCodexLocalRuntimeAttribution(params);
|
|
65
|
+
return {
|
|
66
|
+
role: "assistant",
|
|
67
|
+
content: [{
|
|
68
|
+
type: "text",
|
|
69
|
+
text
|
|
70
|
+
}],
|
|
71
|
+
api: attribution.api ?? "openai-chatgpt-responses",
|
|
72
|
+
provider: attribution.provider,
|
|
73
|
+
model: params.modelId,
|
|
74
|
+
usage: ZERO_USAGE,
|
|
75
|
+
stopReason: "stop",
|
|
76
|
+
timestamp,
|
|
77
|
+
openclawStreamFallback: {
|
|
78
|
+
replacementText: text,
|
|
79
|
+
source: "segment",
|
|
80
|
+
itemId
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function createAssistantMirrorMessage(params, title, text) {
|
|
85
|
+
const attribution = resolveCodexLocalRuntimeAttribution(params);
|
|
86
|
+
return {
|
|
87
|
+
role: "assistant",
|
|
88
|
+
content: [{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: `${title}:\n${text}`
|
|
91
|
+
}],
|
|
92
|
+
api: attribution.api ?? "openai-chatgpt-responses",
|
|
93
|
+
provider: attribution.provider,
|
|
94
|
+
model: params.modelId,
|
|
95
|
+
usage: ZERO_USAGE,
|
|
96
|
+
stopReason: "stop",
|
|
97
|
+
timestamp: Date.now()
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { resolveCodexLocalRuntimeAttribution as i, createAssistantMessage as n, createAssistantMirrorMessage as r, createAssistantCommentaryMessage as t };
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
import { normalizeUsage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
|
+
//#region extensions/codex/src/app-server/event-projector-usage.ts
|
|
5
|
+
function readTokenCount(record, key) {
|
|
6
|
+
const value = readNonNegativeInteger(record, key);
|
|
7
|
+
return value !== void 0 && Number.isSafeInteger(value) ? value : void 0;
|
|
8
|
+
}
|
|
9
|
+
function readCodexThreadTokenUsage(params) {
|
|
10
|
+
const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
|
|
11
|
+
const last = tokenUsage && isJsonObject(tokenUsage.last) ? tokenUsage.last : void 0;
|
|
12
|
+
return last ? normalizeCodexThreadTokenUsage(last) : void 0;
|
|
13
|
+
}
|
|
14
|
+
function readCodexThreadContextSnapshot(params) {
|
|
15
|
+
const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
|
|
16
|
+
const last = tokenUsage && isJsonObject(tokenUsage.last) ? tokenUsage.last : void 0;
|
|
17
|
+
const modelContextWindow = tokenUsage ? readTokenCount(tokenUsage, "modelContextWindow") : void 0;
|
|
18
|
+
const promptTokens = last ? readTokenCount(last, "inputTokens") : void 0;
|
|
19
|
+
return {
|
|
20
|
+
...modelContextWindow && modelContextWindow > 0 ? { modelContextWindow } : {},
|
|
21
|
+
...promptTokens !== void 0 ? { promptTokens } : {}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function projectCodexThreadUsageUpdate(params, currentUsage, applyUsage, emitContext) {
|
|
25
|
+
applyUsage(readCodexThreadTokenUsage(params) ?? currentUsage);
|
|
26
|
+
const context = readCodexThreadContextSnapshot(params);
|
|
27
|
+
if (context.modelContextWindow !== void 0 || context.promptTokens !== void 0) emitContext(context);
|
|
28
|
+
}
|
|
29
|
+
function normalizeCodexThreadTokenUsage(record) {
|
|
30
|
+
const inputTokens = readNumber(record, "inputTokens");
|
|
31
|
+
const cacheRead = readNumber(record, "cachedInputTokens");
|
|
32
|
+
const usage = normalizeUsage({
|
|
33
|
+
input: inputTokens !== void 0 && cacheRead !== void 0 ? Math.max(0, inputTokens - cacheRead) : inputTokens,
|
|
34
|
+
output: readNumber(record, "outputTokens"),
|
|
35
|
+
cacheRead,
|
|
36
|
+
total: readNumber(record, "totalTokens")
|
|
37
|
+
});
|
|
38
|
+
return usage ? {
|
|
39
|
+
...usage,
|
|
40
|
+
contextUsage: { state: "unavailable" }
|
|
41
|
+
} : void 0;
|
|
42
|
+
}
|
|
43
|
+
function normalizeCodexResponseTokenUsage(record) {
|
|
44
|
+
const totalTokens = readTokenCount(record, "totalTokens");
|
|
45
|
+
const inputTokens = readTokenCount(record, "inputTokens");
|
|
46
|
+
const cacheRead = readTokenCount(record, "cachedInputTokens");
|
|
47
|
+
const output = readTokenCount(record, "outputTokens");
|
|
48
|
+
const reasoningOutput = readTokenCount(record, "reasoningOutputTokens");
|
|
49
|
+
const cacheWrite = record.cacheWriteInputTokens === void 0 ? 0 : readTokenCount(record, "cacheWriteInputTokens");
|
|
50
|
+
if (totalTokens === void 0 || inputTokens === void 0 || cacheRead === void 0 || cacheWrite === void 0 || output === void 0 || reasoningOutput === void 0 || cacheRead + cacheWrite > inputTokens || totalTokens !== inputTokens + output) return;
|
|
51
|
+
const usage = normalizeUsage({
|
|
52
|
+
input: inputTokens - cacheRead - cacheWrite,
|
|
53
|
+
output,
|
|
54
|
+
cacheRead,
|
|
55
|
+
cacheWrite,
|
|
56
|
+
total: totalTokens
|
|
57
|
+
});
|
|
58
|
+
if (!usage) return;
|
|
59
|
+
return {
|
|
60
|
+
...usage,
|
|
61
|
+
contextUsage: {
|
|
62
|
+
state: "available",
|
|
63
|
+
promptTokens: inputTokens,
|
|
64
|
+
totalTokens
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { projectCodexThreadUsageUpdate as n, normalizeCodexResponseTokenUsage as t };
|
package/dist/harness.js
CHANGED
|
@@ -22,6 +22,8 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
22
22
|
const harnessRuntimeId = options?.id ?? "codex";
|
|
23
23
|
const normalizedHarnessRuntimeId = harnessRuntimeId.trim().toLowerCase();
|
|
24
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;
|
|
25
27
|
return {
|
|
26
28
|
id: harnessRuntimeId,
|
|
27
29
|
label: options?.label ?? "Codex agent harness",
|
|
@@ -30,8 +32,21 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
30
32
|
contextEngineHostCapabilities: CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES,
|
|
31
33
|
deliveryDefaults: { visibleReplies: "message_tool" },
|
|
32
34
|
authBootstrap: "harness",
|
|
35
|
+
...sessionCatalogControl && sessionRuntime ? { sessionFork: {
|
|
36
|
+
upstreamKinds: ["codex-app-server"],
|
|
37
|
+
fork: async (params) => {
|
|
38
|
+
const { forkCodexUpstreamSession } = await import("./upstream-session-fork-_Vrz4WJr.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
|
+
} } : {},
|
|
33
48
|
authBinding: { fingerprint: async (params) => {
|
|
34
|
-
const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-
|
|
49
|
+
const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-B4FfbcCg.js").then((n) => n.t);
|
|
35
50
|
return fingerprintCodexAppServerAuthBinding(params);
|
|
36
51
|
} },
|
|
37
52
|
runtimeArtifact: { validate: async (binding) => {
|
|
@@ -39,7 +54,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
39
54
|
return validateCodexAppServerRuntimeArtifact(binding);
|
|
40
55
|
} },
|
|
41
56
|
fetchUsageSnapshot: async (ctx) => {
|
|
42
|
-
const { fetchCodexAppServerUsageSnapshot } = await import("./usage-
|
|
57
|
+
const { fetchCodexAppServerUsageSnapshot } = await import("./usage-UpVbdX5G.js");
|
|
43
58
|
return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
44
59
|
},
|
|
45
60
|
supports: (ctx) => {
|
|
@@ -80,15 +95,19 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
80
95
|
};
|
|
81
96
|
},
|
|
82
97
|
runAttempt: async (params) => {
|
|
83
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
98
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-C5GTPJOE.js");
|
|
84
99
|
return runCodexAppServerAttempt(params, {
|
|
85
100
|
bindingStore: options.bindingStore,
|
|
86
101
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
87
102
|
nativeHookRelay: { enabled: true }
|
|
88
103
|
});
|
|
89
104
|
},
|
|
105
|
+
finalizeSettledTurn: async (params) => {
|
|
106
|
+
const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-CA_2QXIE.js");
|
|
107
|
+
return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
108
|
+
},
|
|
90
109
|
runSideQuestion: async (params) => {
|
|
91
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
110
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-CO12sHxo.js");
|
|
92
111
|
return runCodexAppServerSideQuestion(params, {
|
|
93
112
|
bindingStore: options.bindingStore,
|
|
94
113
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
@@ -96,14 +115,14 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
96
115
|
});
|
|
97
116
|
},
|
|
98
117
|
compact: async (params) => {
|
|
99
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
118
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-dEN49UH6.js");
|
|
100
119
|
return maybeCompactCodexAppServerSession(params, {
|
|
101
120
|
bindingStore: options.bindingStore,
|
|
102
121
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
|
|
103
122
|
});
|
|
104
123
|
},
|
|
105
124
|
compactAfterContextEngine: async (params) => {
|
|
106
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
125
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-dEN49UH6.js");
|
|
107
126
|
return maybeCompactCodexAppServerSession(params, {
|
|
108
127
|
bindingStore: options.bindingStore,
|
|
109
128
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
@@ -112,21 +131,22 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
112
131
|
},
|
|
113
132
|
reset: async (params) => {
|
|
114
133
|
if (params.sessionId) {
|
|
115
|
-
const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-
|
|
134
|
+
const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-DlVQ-Pxs.js").then((n) => n.u);
|
|
116
135
|
const identity = sessionBindingIdentity({
|
|
117
136
|
agentId: params.agentId,
|
|
118
137
|
sessionId: params.sessionId,
|
|
119
138
|
sessionKey: params.sessionKey
|
|
120
139
|
});
|
|
121
|
-
|
|
122
|
-
|
|
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") {
|
|
123
143
|
if (await reclaimCurrentCodexSessionGeneration({
|
|
124
144
|
bindingStore: options.bindingStore,
|
|
125
145
|
identity,
|
|
126
146
|
config: options.resolveConfig?.()
|
|
127
|
-
}))
|
|
147
|
+
})) reset = await resetGeneration(identity);
|
|
128
148
|
}
|
|
129
|
-
if (
|
|
149
|
+
if (reset === "conflict") throw new Error(`Codex binding generation changed before session ${params.sessionId} could reset`);
|
|
130
150
|
}
|
|
131
151
|
},
|
|
132
152
|
dispose: disposeSharedCodexAppServerClients
|