@openclaw/codex 2026.9.1-beta.1 → 2026.9.2
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/api.js +8 -9
- package/dist/{attempt-client-cleanup-bfsmcQ6m.js → attempt-client-cleanup-Bp1ZOnk2.js} +105 -75
- package/dist/attempt-context-CSazkWns.js +634 -0
- package/dist/{auth-binding-B4FfbcCg.js → auth-binding-Ds_QVm-X.js} +18 -3
- package/dist/{bounded-turn-B7iBUcuP.js → bounded-turn-DxGJRYbY.js} +53 -57
- package/dist/{capabilities-BRMh0aIq.js → capabilities-B1mgvpP8.js} +2 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-DEsIufkt.js → command-formatters-DSbGMXA0.js} +5 -4
- package/dist/{command-handlers-D_-1_qRp.js → command-handlers-DOJvGv6-.js} +243 -148
- package/dist/{compact-BglNFZrQ.js → compact-Y_xBqrHN.js} +109 -65
- package/dist/{config-giW8X0QA.js → config-CyapYSji.js} +328 -374
- package/dist/config-utils-C57JiJrU.js +69 -0
- package/dist/{context-compaction-activity-BOeJf7yo.js → context-compaction-activity-CMla5FPJ.js} +4 -1
- package/dist/{conversation-binding-data-CW2GuupV.js → conversation-binding-data-BiodpIzq.js} +2 -1
- package/dist/doctor-contract-api.js +144 -14
- package/dist/{dynamic-tools-Dnlfa--w.js → dynamic-tools-BwpvTxaX.js} +1119 -1135
- package/dist/{effective-mcp-catalog-CTeGrnfO.js → effective-mcp-catalog-CY9Jn4bA.js} +4 -3
- package/dist/{event-projector-assistant-message-C5-Ds8mA.js → event-projector-assistant-message-B9kp6iGC.js} +15 -6
- package/dist/event-projector-usage-ZqEVbAEY.js +212 -0
- package/dist/{harness-Csz0F-DK.js → harness-Czh2Sdoc.js} +65 -52
- package/dist/harness.js +1 -1
- package/dist/{image-payload-sanitizer-CnfoUPCE.js → image-payload-sanitizer-tupAr-2o.js} +29 -15
- package/dist/index.js +495 -457
- package/dist/{isolated-completion-Cv6FqygM.js → isolated-completion-CRh-51AK.js} +9 -21
- package/dist/{managed-binary-DFYK4DWq.js → managed-binary-DcpnJF9x.js} +117 -80
- package/dist/media-understanding-provider.js +1 -1
- package/dist/model-catalog-DT5vo6qo.js +101 -0
- package/dist/{models-TS3HBU-q.js → models-CcrgSMQR.js} +26 -29
- package/dist/{native-subagent-monitor-4Mfq2HDs.js → native-subagent-monitor-B3bvQGcg.js} +63 -122
- package/dist/{node-exec-server.runtime-BpWqJO1V.js → node-exec-server.runtime-nfbUOtUB.js} +10 -7
- package/dist/{plugin-approval-roundtrip-bUm777tR.js → plugin-approval-roundtrip-aQVdyL5g.js} +30 -3
- package/dist/{plugin-marketplace-discovery-B9DvaAG-.js → plugin-marketplace-discovery-B7gHXJ3d.js} +44 -30
- package/dist/{plugin-metadata-cache-CTCT3w5L.js → plugin-metadata-cache-BwCLTY_U.js} +6 -6
- package/dist/provider-capabilities-BpG9Ltc5.js +101 -0
- package/dist/{rate-limits-C5_D8Gmb.js → rate-limits-Fx_l4eNa.js} +3 -2
- package/dist/{sandbox-guard-kuWTn9C5.js → request-C8H22rPi.js} +195 -2
- package/dist/{run-attempt-DYc0QCBF.js → run-attempt-BzthFQSM.js} +1616 -2634
- package/dist/{runtime-artifact-BvyT1uyd.js → runtime-artifact-Bh_gf6-t.js} +22 -15
- package/dist/{session-binding-Bcynfd-_.js → session-binding-4Ki04sW-.js} +282 -399
- package/dist/session-binding-record-CyaXZvTe.js +270 -0
- package/dist/{session-catalog-DaLKVtpH.js → session-catalog-B47uwekb.js} +812 -504
- package/dist/{session-cli-DMc4oS2w.js → session-cli-BjLhpmS1.js} +1 -1
- package/dist/session-history-DWmMqiqW.js +93 -0
- package/dist/session-history-read-LHldwvyh.js +36 -0
- package/dist/session-history-worker-runtime.js +48 -0
- package/dist/session-history.worker-zZVcx0ME.js +267 -0
- package/dist/session-history.worker.js +2 -0
- package/dist/session-initialization-BCFVnLL4.js +75 -0
- package/dist/{session-permission-policy-BrNH1bjy.js → session-permission-policy-BaueHmSj.js} +2 -2
- package/dist/session-retirement-DNdmYdFc.js +97 -0
- package/dist/{session-upstream-marker-BIkusb95.js → session-upstream-marker-DReTpGz6.js} +20 -4
- package/dist/settled-turn-context-BOM3Y1pl.js +45 -0
- package/dist/settled-turn-finalizer-BI-b1sry.js +115 -0
- package/dist/{shared-client-DKz23hHY.js → shared-client-CKhX2kFt.js} +3659 -847
- package/dist/{side-question-DjA_jsNe.js → side-question-B6DWAw1A.js} +168 -81
- package/dist/{thread-lifecycle-L7oEkTlq.js → thread-lifecycle-DPK30jad.js} +2412 -2145
- package/dist/{thread-ownership-DZeuKH1j.js → thread-ownership-CbucAmmp.js} +27 -16
- package/dist/thread-policy-CTalhWFy.js +105 -0
- package/dist/{plugin-app-cache-key-C1CAdfcP.js → thread-resume-BLgqkUc1.js} +61 -9
- package/dist/{transcript-mirror-DsCMWBca.js → transcript-mirror-_njEB84z.js} +114 -110
- package/dist/transcript-mirror-attestation-Byl34PC-.js +76 -0
- package/dist/transport-stdio-CzTngV0j.js +728 -0
- package/dist/{upstream-prompt-provenance-CFmsKwr9.js → upstream-prompt-provenance-LphB8slG.js} +8 -4
- package/dist/upstream-session-fork-1fwbNKzQ.js +886 -0
- package/dist/{usage-ROIaW3wo.js → usage-i9fv5-4m.js} +3 -3
- package/dist/{web-search-provider.runtime-ClaNPV7N.js → web-search-provider.runtime-DKQn67A7.js} +3 -3
- package/openclaw.plugin.json +1 -30
- package/package.json +6 -6
- package/dist/binding-connection-BMvPX73o.js +0 -45
- package/dist/command-rpc-CCeCkf_v.js +0 -90
- package/dist/event-projector-usage-Bk1I90Bg.js +0 -328
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/model-catalog-i9rNBthX.js +0 -48
- package/dist/protocol-validators-VeJxxJ0U.js +0 -2421
- package/dist/request-DXXGHko0.js +0 -157
- package/dist/session-catalog-home-id-BNwAJ9D7.js +0 -18
- package/dist/session-retirement-CcNC3YSY.js +0 -36
- package/dist/settled-turn-finalizer-Dc3ApjU4.js +0 -328
- package/dist/thread-resume-BE9qNEW0.js +0 -30
- package/dist/transport-stdio-DhoGy33Z.js +0 -99
- package/dist/upstream-session-fork-DlaHxSLC.js +0 -326
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
1
|
+
import { i as resolveCodexAppServerRuntimeOptions } from "./config-CyapYSji.js";
|
|
2
|
+
import { n as readCodexAppServerUsage } from "./request-C8H22rPi.js";
|
|
3
|
+
import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-Fx_l4eNa.js";
|
|
4
4
|
import { CODEX_APP_SERVER_AUTH_MARKER } from "openclaw/plugin-sdk/agent-runtime";
|
|
5
5
|
//#region extensions/codex/src/app-server/usage.ts
|
|
6
6
|
/** Handles the synthetic usage credential for a Codex-backed OpenAI route. */
|
package/dist/{web-search-provider.runtime-ClaNPV7N.js → web-search-provider.runtime-DKQn67A7.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
1
|
+
import { B as isJsonObject } from "./config-CyapYSji.js";
|
|
2
|
+
import { x as buildCodexNativeWebSearchThreadConfig } from "./thread-lifecycle-DPK30jad.js";
|
|
3
|
+
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-DxGJRYbY.js";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { readStringParam, resolveSearchTimeoutSeconds, wrapWebContent } from "openclaw/plugin-sdk/provider-web-search";
|
|
6
6
|
//#region extensions/codex/src/web-search-provider.runtime.ts
|
package/openclaw.plugin.json
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"configRepair": true,
|
|
22
22
|
"stateMigrations": true
|
|
23
23
|
},
|
|
24
|
+
"doctorHealthChecks": true,
|
|
24
25
|
"sessionRouteStateOwners": [
|
|
25
26
|
{
|
|
26
27
|
"id": "codex",
|
|
@@ -331,21 +332,6 @@
|
|
|
331
332
|
"minimum": 1,
|
|
332
333
|
"default": 60000
|
|
333
334
|
},
|
|
334
|
-
"turnCompletionIdleTimeoutMs": {
|
|
335
|
-
"type": "number",
|
|
336
|
-
"minimum": 1,
|
|
337
|
-
"default": 60000
|
|
338
|
-
},
|
|
339
|
-
"turnAssistantCompletionIdleTimeoutMs": {
|
|
340
|
-
"type": "number",
|
|
341
|
-
"minimum": 1,
|
|
342
|
-
"default": 10000
|
|
343
|
-
},
|
|
344
|
-
"postToolRawAssistantCompletionIdleTimeoutMs": {
|
|
345
|
-
"type": "number",
|
|
346
|
-
"minimum": 1,
|
|
347
|
-
"default": 300000
|
|
348
|
-
},
|
|
349
335
|
"approvalPolicy": {
|
|
350
336
|
"type": "string",
|
|
351
337
|
"enum": ["never", "on-request", "on-failure", "untrusted"]
|
|
@@ -663,21 +649,6 @@
|
|
|
663
649
|
"help": "Maximum time to wait for Codex app-server control-plane requests.",
|
|
664
650
|
"advanced": true
|
|
665
651
|
},
|
|
666
|
-
"appServer.turnCompletionIdleTimeoutMs": {
|
|
667
|
-
"label": "Turn Completion Idle Timeout",
|
|
668
|
-
"help": "Maximum quiet time after Codex accepts a turn or after a turn-scoped app-server request before OpenClaw interrupts the turn while waiting for turn/completed.",
|
|
669
|
-
"advanced": true
|
|
670
|
-
},
|
|
671
|
-
"appServer.turnAssistantCompletionIdleTimeoutMs": {
|
|
672
|
-
"label": "Assistant Completion Idle Timeout",
|
|
673
|
-
"help": "Short quiet-time guard after Codex reports a completed assistant message before OpenClaw releases the turn.",
|
|
674
|
-
"advanced": true
|
|
675
|
-
},
|
|
676
|
-
"appServer.postToolRawAssistantCompletionIdleTimeoutMs": {
|
|
677
|
-
"label": "Post-Tool Continuation Idle Timeout",
|
|
678
|
-
"help": "Completion-idle and progress guard after a tool handoff, native tool completion, or post-tool raw assistant progress while waiting for turn/completed. Defaults to 300000 ms when unset.",
|
|
679
|
-
"advanced": true
|
|
680
|
-
},
|
|
681
652
|
"appServer.approvalPolicy": {
|
|
682
653
|
"label": "Approval Policy",
|
|
683
654
|
"help": "Codex native approval policy sent to thread start, resume, and turns.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.2",
|
|
4
4
|
"description": "OpenClaw Codex app-server harness and native session supervision plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@openai/codex": "0.
|
|
11
|
+
"@openai/codex": "0.153.4",
|
|
12
12
|
"semver": "7.8.5",
|
|
13
13
|
"smol-toml": "1.8.0",
|
|
14
|
-
"typebox": "1.3.
|
|
14
|
+
"typebox": "1.3.18",
|
|
15
15
|
"ws": "8.21.3",
|
|
16
16
|
"zod": "4.4.3"
|
|
17
17
|
},
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
38
|
"compat": {
|
|
39
|
-
"pluginApi": ">=2026.9.
|
|
39
|
+
"pluginApi": ">=2026.9.2"
|
|
40
40
|
},
|
|
41
41
|
"build": {
|
|
42
|
-
"openclawVersion": "2026.9.
|
|
42
|
+
"openclawVersion": "2026.9.2"
|
|
43
43
|
},
|
|
44
44
|
"release": {
|
|
45
45
|
"publishToClawHub": true,
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"README.md"
|
|
60
60
|
],
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"openclaw": ">=2026.9.
|
|
62
|
+
"openclaw": ">=2026.9.2"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|
|
65
65
|
"openclaw": {
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { h as readCodexPluginConfig, i as resolveCodexAppServerRuntimeOptions, s as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-giW8X0QA.js";
|
|
2
|
-
import { a as resolveCodexCatalogConnectionHome, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-C1CAdfcP.js";
|
|
3
|
-
//#region extensions/codex/src/app-server/binding-connection.ts
|
|
4
|
-
/** Requires the native model pair after a supervised pending branch has materialized. */
|
|
5
|
-
function requireCodexSupervisionModelSelection(binding) {
|
|
6
|
-
const model = binding.model?.trim();
|
|
7
|
-
const modelProvider = binding.modelProvider?.trim();
|
|
8
|
-
if (binding.connectionScope !== "supervision" || !model || !modelProvider) throw new Error("Codex supervised binding is missing its native model and provider; refusing request selection");
|
|
9
|
-
return {
|
|
10
|
-
model,
|
|
11
|
-
modelProvider
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
/** Resolves connection and auth ownership exclusively from the private thread binding. */
|
|
15
|
-
function resolveCodexBindingAppServerConnection(params) {
|
|
16
|
-
const { binding, authProfileId, ...runtimeParams } = params;
|
|
17
|
-
const usesSupervisionConnection = binding?.connectionScope === "supervision";
|
|
18
|
-
if (usesSupervisionConnection && readCodexPluginConfig(runtimeParams.pluginConfig).supervision?.enabled !== true) throw new Error("Codex supervision is disabled; refusing to open a native user-home supervised session");
|
|
19
|
-
let appServer = (usesSupervisionConnection ? resolveCodexSupervisionAppServerRuntimeOptions : resolveCodexAppServerRuntimeOptions)(runtimeParams);
|
|
20
|
-
if (usesSupervisionConnection) {
|
|
21
|
-
const persistedFingerprint = binding.pendingSupervisionBranch?.connectionFingerprint ?? binding.appServerRuntimeFingerprint;
|
|
22
|
-
const catalogHome = persistedFingerprint ? resolveCodexCatalogConnectionHome(persistedFingerprint, runtimeParams.agentDir) : void 0;
|
|
23
|
-
if (catalogHome) appServer = {
|
|
24
|
-
...appServer,
|
|
25
|
-
start: {
|
|
26
|
-
...appServer.start,
|
|
27
|
-
homeScope: "user",
|
|
28
|
-
env: {
|
|
29
|
-
...appServer.start.env,
|
|
30
|
-
CODEX_HOME: catalogHome
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const currentFingerprint = buildCodexAppServerConnectionFingerprint(appServer, runtimeParams.agentDir);
|
|
35
|
-
if (!persistedFingerprint || persistedFingerprint !== currentFingerprint) throw new Error("Codex supervision connection changed; refusing to operate on its bound native thread");
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
appServer,
|
|
39
|
-
usesSupervisionConnection,
|
|
40
|
-
requestAuthProfileId: usesSupervisionConnection ? void 0 : authProfileId,
|
|
41
|
-
clientAuthProfileId: usesSupervisionConnection ? null : authProfileId
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
export { resolveCodexBindingAppServerConnection as n, requireCodexSupervisionModelSelection as t };
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { i as resolveCodexAppServerRuntimeOptions, s as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-giW8X0QA.js";
|
|
2
|
-
import { n as listCodexAppServerModels } from "./models-TS3HBU-q.js";
|
|
3
|
-
import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-BRMh0aIq.js";
|
|
4
|
-
import { i as withCodexAppServerJsonClient, r as requestCodexAppServerJson } from "./request-DXXGHko0.js";
|
|
5
|
-
//#region extensions/codex/src/command-rpc.ts
|
|
6
|
-
function requestOptions(pluginConfig, limit, config, agentDir) {
|
|
7
|
-
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
8
|
-
return {
|
|
9
|
-
limit,
|
|
10
|
-
timeoutMs: runtime.requestTimeoutMs,
|
|
11
|
-
startOptions: runtime.start,
|
|
12
|
-
config,
|
|
13
|
-
agentDir
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
async function codexControlRequest(pluginConfig, method, requestParams, options = {}) {
|
|
17
|
-
const runtime = options.startOptions ? resolveCodexSupervisionAppServerRuntimeOptions({ pluginConfig }) : resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
18
|
-
const controlRequestOptions = {
|
|
19
|
-
timeoutMs: options.timeoutMs ?? runtime.requestTimeoutMs,
|
|
20
|
-
startOptions: options.startOptions ?? runtime.start,
|
|
21
|
-
config: options.config,
|
|
22
|
-
sessionKey: options.sessionKey,
|
|
23
|
-
sessionId: options.sessionId,
|
|
24
|
-
authProfileId: options.authProfileId,
|
|
25
|
-
agentDir: options.agentDir,
|
|
26
|
-
isolated: options.isolated
|
|
27
|
-
};
|
|
28
|
-
if (options.onResponse) return await withCodexAppServerJsonClient(controlRequestOptions, async (request, client) => {
|
|
29
|
-
const response = await request({
|
|
30
|
-
method,
|
|
31
|
-
requestParams
|
|
32
|
-
});
|
|
33
|
-
await options.onResponse(response, client);
|
|
34
|
-
return response;
|
|
35
|
-
});
|
|
36
|
-
return await requestCodexAppServerJson({
|
|
37
|
-
method,
|
|
38
|
-
requestParams,
|
|
39
|
-
...controlRequestOptions
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
async function safeCodexControlRequest(pluginConfig, method, requestParams, options = {}) {
|
|
43
|
-
return await safeValue(async () => await codexControlRequest(pluginConfig, method, requestParams, options));
|
|
44
|
-
}
|
|
45
|
-
async function safeCodexModelList(pluginConfig, limit, config, agentDir) {
|
|
46
|
-
return await safeValue(async () => await listCodexAppServerModels(requestOptions(pluginConfig, limit, config, agentDir)));
|
|
47
|
-
}
|
|
48
|
-
async function readCodexStatusProbes(pluginConfig, config, agentDir) {
|
|
49
|
-
const [models, account, limits, mcps, skills] = await Promise.all([
|
|
50
|
-
safeCodexModelList(pluginConfig, 20, config, agentDir),
|
|
51
|
-
safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.account, { refreshToken: false }, {
|
|
52
|
-
config,
|
|
53
|
-
agentDir
|
|
54
|
-
}),
|
|
55
|
-
safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.rateLimits, void 0, {
|
|
56
|
-
config,
|
|
57
|
-
agentDir
|
|
58
|
-
}),
|
|
59
|
-
safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.listMcpServers, { limit: 100 }, {
|
|
60
|
-
config,
|
|
61
|
-
agentDir
|
|
62
|
-
}),
|
|
63
|
-
safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.listSkills, {}, {
|
|
64
|
-
config,
|
|
65
|
-
agentDir
|
|
66
|
-
})
|
|
67
|
-
]);
|
|
68
|
-
return {
|
|
69
|
-
models,
|
|
70
|
-
account,
|
|
71
|
-
limits,
|
|
72
|
-
mcps,
|
|
73
|
-
skills
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
async function safeValue(read) {
|
|
77
|
-
try {
|
|
78
|
-
return {
|
|
79
|
-
ok: true,
|
|
80
|
-
value: await read()
|
|
81
|
-
};
|
|
82
|
-
} catch (error) {
|
|
83
|
-
return {
|
|
84
|
-
ok: false,
|
|
85
|
-
error: describeControlFailure(error)
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
90
|
-
export { safeCodexControlRequest as i, readCodexStatusProbes as n, requestOptions as r, codexControlRequest as t };
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import { vt as isJsonObject } from "./shared-client-DKz23hHY.js";
|
|
2
|
-
import { asSafeIntegerInRange, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
import { normalizeUsage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
|
-
//#region extensions/codex/src/app-server/attempt-notifications.ts
|
|
6
|
-
/**
|
|
7
|
-
* Predicates and readers for Codex app-server notification envelopes.
|
|
8
|
-
*/
|
|
9
|
-
const CODEX_TURN_ABORT_MARKER_START = "<turn_aborted>";
|
|
10
|
-
const CODEX_TURN_ABORT_MARKER_END = "</turn_aborted>";
|
|
11
|
-
/** Builds compact activity metadata for watchdog and diagnostic updates. */
|
|
12
|
-
function describeNotificationActivity(notification) {
|
|
13
|
-
if (!isJsonObject(notification.params)) return { lastNotificationMethod: notification.method };
|
|
14
|
-
if (notification.method !== "rawResponseItem/completed") return { lastNotificationMethod: notification.method };
|
|
15
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
16
|
-
if (!item) return { lastNotificationMethod: notification.method };
|
|
17
|
-
return {
|
|
18
|
-
lastNotificationMethod: notification.method,
|
|
19
|
-
lastNotificationItemId: readStringField(item, "id"),
|
|
20
|
-
lastNotificationItemType: readStringField(item, "type"),
|
|
21
|
-
lastNotificationItemRole: readStringField(item, "role"),
|
|
22
|
-
lastAssistantTextPreview: readRawAssistantTextPreview(item)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
/** Tracks active app-server item ids from item start/completion notifications. */
|
|
26
|
-
function updateActiveTurnItemIds(notification, activeItemIds) {
|
|
27
|
-
if (notification.method !== "item/started" && notification.method !== "item/completed") return;
|
|
28
|
-
const itemId = readNotificationItemId(notification);
|
|
29
|
-
if (!itemId) return;
|
|
30
|
-
if (notification.method === "item/started") {
|
|
31
|
-
activeItemIds.add(itemId);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
activeItemIds.delete(itemId);
|
|
35
|
-
}
|
|
36
|
-
function updateActiveCompletionBlockerItemIds(notification, activeItemIds) {
|
|
37
|
-
if (notification.method !== "item/started" && notification.method !== "item/completed") return;
|
|
38
|
-
const itemId = readNotificationItemId(notification);
|
|
39
|
-
if (!itemId) return;
|
|
40
|
-
if (notification.method === "item/completed") {
|
|
41
|
-
activeItemIds.delete(itemId);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const item = readCodexNotificationItem(notification.params);
|
|
45
|
-
if (item && isCompletionBlockingItem(item)) activeItemIds.add(itemId);
|
|
46
|
-
}
|
|
47
|
-
function isCompletionBlockingItem(item) {
|
|
48
|
-
switch (item.type) {
|
|
49
|
-
case "collabAgentToolCall":
|
|
50
|
-
case "commandExecution":
|
|
51
|
-
case "dynamicToolCall":
|
|
52
|
-
case "fileChange":
|
|
53
|
-
case "imageGeneration":
|
|
54
|
-
case "imageView":
|
|
55
|
-
case "mcpToolCall":
|
|
56
|
-
case "webSearch": return true;
|
|
57
|
-
default: return false;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function isCompletedAssistantNotification(notification) {
|
|
61
|
-
if (!isJsonObject(notification.params)) return false;
|
|
62
|
-
if (notification.method !== "item/completed") return false;
|
|
63
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
64
|
-
return Boolean(item && readStringField(item, "type") === "agentMessage" && readStringField(item, "phase") !== "commentary" && readStringField(item, "delivery") !== "async");
|
|
65
|
-
}
|
|
66
|
-
/** Returns true for completed app-server reasoning items. */
|
|
67
|
-
function isReasoningItemCompletionNotification(notification) {
|
|
68
|
-
if (!isJsonObject(notification.params) || notification.method !== "item/completed") return false;
|
|
69
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
70
|
-
return item ? readStringField(item, "type") === "reasoning" : false;
|
|
71
|
-
}
|
|
72
|
-
/** Returns true for completed assistant commentary items. */
|
|
73
|
-
function isAssistantCommentaryCompletionNotification(notification) {
|
|
74
|
-
if (!isJsonObject(notification.params) || notification.method !== "item/completed") return false;
|
|
75
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
76
|
-
return Boolean(item && readStringField(item, "type") === "agentMessage" && (readStringField(item, "phase") === "commentary" || readStringField(item, "delivery") === "async"));
|
|
77
|
-
}
|
|
78
|
-
/** Returns true for completed raw response reasoning items. */
|
|
79
|
-
function isRawReasoningCompletionNotification(notification) {
|
|
80
|
-
if (!isJsonObject(notification.params) || notification.method !== "rawResponseItem/completed") return false;
|
|
81
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
82
|
-
return item ? readStringField(item, "type") === "reasoning" : false;
|
|
83
|
-
}
|
|
84
|
-
/** Returns true for streamed app-server reasoning progress. */
|
|
85
|
-
function isReasoningProgressNotification(notification) {
|
|
86
|
-
return notification.method === "item/reasoning/textDelta" || notification.method === "item/reasoning/summaryTextDelta" || notification.method === "item/reasoning/summaryPartAdded";
|
|
87
|
-
}
|
|
88
|
-
/** Returns true when assistant completion can release the short idle watch. */
|
|
89
|
-
function isAssistantCompletionReleaseNotification(notification, turnCrossedToolHandoff) {
|
|
90
|
-
if (isCompletedAssistantNotification(notification)) return true;
|
|
91
|
-
return !turnCrossedToolHandoff && isRawAssistantCompletionNotification(notification);
|
|
92
|
-
}
|
|
93
|
-
/** Returns true when a notification proves assistant output is still active. */
|
|
94
|
-
function shouldDisarmAssistantCompletionIdleWatch(notification) {
|
|
95
|
-
if (!isJsonObject(notification.params)) return false;
|
|
96
|
-
if (notification.method === "item/started") return true;
|
|
97
|
-
if (notification.method === "item/agentMessage/delta") return true;
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
/** Reads an item id from supported notification envelope shapes. */
|
|
101
|
-
function readNotificationItemId(notification) {
|
|
102
|
-
if (!isJsonObject(notification.params)) return;
|
|
103
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
104
|
-
return (item ? readStringField(item, "id") : void 0) ?? readStringField(notification.params, "itemId") ?? readStringField(notification.params, "id");
|
|
105
|
-
}
|
|
106
|
-
/** Detects completion for an OpenClaw dynamic tool result still awaited by Codex. */
|
|
107
|
-
function isPendingOpenClawDynamicToolCompletionNotification(notification, pendingOpenClawDynamicToolCompletionIds) {
|
|
108
|
-
if (notification.method !== "item/completed" || !isJsonObject(notification.params)) return false;
|
|
109
|
-
const itemId = readNotificationItemId(notification);
|
|
110
|
-
if (!itemId || !pendingOpenClawDynamicToolCompletionIds.has(itemId)) return false;
|
|
111
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
112
|
-
const itemType = item ? readStringField(item, "type") : void 0;
|
|
113
|
-
return itemType === void 0 || itemType === "dynamicToolCall";
|
|
114
|
-
}
|
|
115
|
-
/** Returns true for raw response tool-output completion notifications. */
|
|
116
|
-
function isRawToolOutputCompletionNotification(notification) {
|
|
117
|
-
if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
|
|
118
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
119
|
-
switch (item ? readStringField(item, "type") : void 0) {
|
|
120
|
-
case "custom_tool_call_output":
|
|
121
|
-
case "function_call_output": return true;
|
|
122
|
-
default: return false;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function isRawFunctionToolOutputCompletionNotification(notification) {
|
|
126
|
-
if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
|
|
127
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
128
|
-
return item ? readStringField(item, "type") === "function_call_output" : false;
|
|
129
|
-
}
|
|
130
|
-
/** Returns true for progress on Codex-native tool item types. */
|
|
131
|
-
function isNativeToolProgressNotification(notification) {
|
|
132
|
-
if (notification.method !== "item/started" && notification.method !== "item/completed" && notification.method !== "item/updated") return false;
|
|
133
|
-
if (!isJsonObject(notification.params)) return false;
|
|
134
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
135
|
-
switch (item ? readStringField(item, "type") : void 0) {
|
|
136
|
-
case "commandExecution":
|
|
137
|
-
case "fileChange":
|
|
138
|
-
case "mcpToolCall":
|
|
139
|
-
case "webSearch": return true;
|
|
140
|
-
default: return false;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/** Returns true for file-change patch update notifications. */
|
|
144
|
-
function isFileChangePatchUpdatedNotification(notification) {
|
|
145
|
-
return notification.method === "item/fileChange/patchUpdated" && isJsonObject(notification.params);
|
|
146
|
-
}
|
|
147
|
-
/** Returns true for raw assistant message progress with readable text. */
|
|
148
|
-
function isRawAssistantProgressNotification(notification) {
|
|
149
|
-
if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
|
|
150
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
151
|
-
return Boolean(item && readStringField(item, "type") === "message" && readStringField(item, "role") === "assistant" && readRawAssistantTextPreview(item));
|
|
152
|
-
}
|
|
153
|
-
/** Returns true for raw assistant completion outside commentary phase. */
|
|
154
|
-
function isRawAssistantCompletionNotification(notification) {
|
|
155
|
-
if (!isRawAssistantProgressNotification(notification) || !isJsonObject(notification.params)) return false;
|
|
156
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
157
|
-
return Boolean(item && readStringField(item, "phase") !== "commentary");
|
|
158
|
-
}
|
|
159
|
-
function readRawAssistantTextPreview(item) {
|
|
160
|
-
if (readStringField(item, "role") !== "assistant" || !Array.isArray(item.content)) return;
|
|
161
|
-
const text = item.content.flatMap((content) => {
|
|
162
|
-
if (!isJsonObject(content)) return [];
|
|
163
|
-
const contentText = readStringField(content, "text");
|
|
164
|
-
return contentText ? [contentText] : [];
|
|
165
|
-
}).join("\n").trim();
|
|
166
|
-
if (!text) return;
|
|
167
|
-
return text.length > 240 ? `${truncateUtf16Safe(text, 237)}...` : text;
|
|
168
|
-
}
|
|
169
|
-
/** Returns true for app-server error notifications that will retry. */
|
|
170
|
-
function isRetryableErrorNotification(value) {
|
|
171
|
-
return isJsonObject(value) && value.willRetry === true;
|
|
172
|
-
}
|
|
173
|
-
/** Returns true for terminal app-server thread status strings. */
|
|
174
|
-
function isTerminalTurnStatus(status) {
|
|
175
|
-
return status === "completed" || status === "interrupted" || status === "failed";
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Detects Codex's synthetic interrupted-turn marker while ignoring the current
|
|
179
|
-
* user prompt echoed through raw response events.
|
|
180
|
-
*/
|
|
181
|
-
function isCodexTurnAbortMarkerNotification(notification, options = {}) {
|
|
182
|
-
if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
|
|
183
|
-
const item = notification.params.item;
|
|
184
|
-
const role = isJsonObject(item) ? readStringField(item, "role") : void 0;
|
|
185
|
-
if (!isJsonObject(item) || readStringField(item, "type") !== "message" || role !== "user" && role !== "developer") return false;
|
|
186
|
-
const text = extractRawResponseItemText(item).trim();
|
|
187
|
-
const currentPromptTexts = [options.currentPromptText, ...options.currentPromptTexts ?? []].filter(isNonEmptyString).map((prompt) => prompt.trim());
|
|
188
|
-
if (role === "user" && currentPromptTexts.includes(text)) return false;
|
|
189
|
-
return readCodexTurnAbortMarkerBody(text) !== void 0;
|
|
190
|
-
}
|
|
191
|
-
function readCodexTurnAbortMarkerBody(text) {
|
|
192
|
-
if (!text.startsWith(CODEX_TURN_ABORT_MARKER_START) || !text.endsWith(CODEX_TURN_ABORT_MARKER_END)) return;
|
|
193
|
-
return text.slice(14, -15).trim();
|
|
194
|
-
}
|
|
195
|
-
function extractRawResponseItemText(item) {
|
|
196
|
-
const content = item.content;
|
|
197
|
-
if (!Array.isArray(content)) return "";
|
|
198
|
-
return content.flatMap((entry) => {
|
|
199
|
-
if (!isJsonObject(entry)) return [];
|
|
200
|
-
const type = readStringField(entry, "type");
|
|
201
|
-
if (type !== "input_text" && type !== "text") return [];
|
|
202
|
-
const text = readStringField(entry, "text");
|
|
203
|
-
return text ? [text] : [];
|
|
204
|
-
}).join("");
|
|
205
|
-
}
|
|
206
|
-
/** Reads a typed Codex item from notification params when id/type are present. */
|
|
207
|
-
function readCodexNotificationItem(params) {
|
|
208
|
-
if (!isJsonObject(params) || !isJsonObject(params.item)) return;
|
|
209
|
-
const item = params.item;
|
|
210
|
-
return typeof item.id === "string" && typeof item.type === "string" ? item : void 0;
|
|
211
|
-
}
|
|
212
|
-
/** Reads the stable call id from a model-emitted raw tool item. */
|
|
213
|
-
function readRawResponseToolCallId(notification) {
|
|
214
|
-
if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return;
|
|
215
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
216
|
-
if (!item) return;
|
|
217
|
-
switch (readStringField(item, "type")) {
|
|
218
|
-
case "custom_tool_call":
|
|
219
|
-
case "function_call":
|
|
220
|
-
case "local_shell_call":
|
|
221
|
-
case "tool_search_call": return readStringField(item, "call_id");
|
|
222
|
-
case "image_generation_call":
|
|
223
|
-
case "web_search_call": return readStringField(item, "id");
|
|
224
|
-
default: return;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
/** Maps Codex item types to the tool name shown in execution progress. */
|
|
228
|
-
function codexExecutionToolName(item) {
|
|
229
|
-
if (item.type === "dynamicToolCall" && typeof item.tool === "string") return item.tool;
|
|
230
|
-
if (item.type === "mcpToolCall" && typeof item.tool === "string") {
|
|
231
|
-
const server = typeof item.server === "string" && item.server ? item.server : void 0;
|
|
232
|
-
return server ? `${server}.${item.tool}` : item.tool;
|
|
233
|
-
}
|
|
234
|
-
if (item.type === "commandExecution") return "bash";
|
|
235
|
-
if (item.type === "fileChange") return "apply_patch";
|
|
236
|
-
if (item.type === "webSearch") return "web_search";
|
|
237
|
-
}
|
|
238
|
-
function isNonEmptyString(value) {
|
|
239
|
-
return typeof value === "string" && value.length > 0;
|
|
240
|
-
}
|
|
241
|
-
//#endregion
|
|
242
|
-
//#region extensions/codex/src/app-server/event-projector-usage.ts
|
|
243
|
-
function readTokenCount(record, key) {
|
|
244
|
-
return asSafeIntegerInRange(record[key], { min: 0 });
|
|
245
|
-
}
|
|
246
|
-
function readCodexThreadTokenUsage(params) {
|
|
247
|
-
const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
|
|
248
|
-
const last = tokenUsage && isJsonObject(tokenUsage.last) ? tokenUsage.last : void 0;
|
|
249
|
-
return last ? normalizeCodexThreadTokenUsage(last) : void 0;
|
|
250
|
-
}
|
|
251
|
-
function readCodexThreadContextSnapshot(params) {
|
|
252
|
-
const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
|
|
253
|
-
const last = tokenUsage && isJsonObject(tokenUsage.last) ? tokenUsage.last : void 0;
|
|
254
|
-
const modelContextWindow = tokenUsage ? readTokenCount(tokenUsage, "modelContextWindow") : void 0;
|
|
255
|
-
const activeContextTokens = last ? readTokenCount(last, "totalTokens") : void 0;
|
|
256
|
-
const inputTokens = last ? readTokenCount(last, "inputTokens") : void 0;
|
|
257
|
-
const cachedInputTokens = last ? readTokenCount(last, "cachedInputTokens") : void 0;
|
|
258
|
-
const cacheWriteInputTokens = last ? readTokenCount(last, "cacheWriteInputTokens") : void 0;
|
|
259
|
-
const outputTokens = last ? readTokenCount(last, "outputTokens") : void 0;
|
|
260
|
-
const reasoningOutputTokens = last ? readTokenCount(last, "reasoningOutputTokens") : void 0;
|
|
261
|
-
return {
|
|
262
|
-
...activeContextTokens !== void 0 ? { activeContextTokens } : {},
|
|
263
|
-
...cachedInputTokens !== void 0 ? { cachedInputTokens } : {},
|
|
264
|
-
...cacheWriteInputTokens !== void 0 ? { cacheWriteInputTokens } : {},
|
|
265
|
-
...inputTokens !== void 0 ? { inputTokens } : {},
|
|
266
|
-
...modelContextWindow && modelContextWindow > 0 ? { modelContextWindow } : {},
|
|
267
|
-
...outputTokens !== void 0 ? { outputTokens } : {},
|
|
268
|
-
...inputTokens !== void 0 ? { promptTokens: inputTokens } : {},
|
|
269
|
-
...reasoningOutputTokens !== void 0 ? { reasoningOutputTokens } : {}
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function projectCodexThreadUsageUpdate(params, currentUsage, applyUsage, emitContext) {
|
|
273
|
-
applyUsage(readCodexThreadTokenUsage(params) ?? currentUsage);
|
|
274
|
-
const context = readCodexThreadContextSnapshot(params);
|
|
275
|
-
if (Object.keys(context).length > 0) emitContext(context);
|
|
276
|
-
}
|
|
277
|
-
function normalizeCodexThreadTokenUsage(record) {
|
|
278
|
-
return normalizeCodexTokenUsageBreakdown(record);
|
|
279
|
-
}
|
|
280
|
-
function normalizeCodexResponseTokenUsage(record) {
|
|
281
|
-
return normalizeCodexTokenUsageBreakdown(record);
|
|
282
|
-
}
|
|
283
|
-
function normalizeCodexTokenUsageBreakdown(record) {
|
|
284
|
-
const totalTokens = readTokenCount(record, "totalTokens");
|
|
285
|
-
const inputTokens = readTokenCount(record, "inputTokens");
|
|
286
|
-
const cacheRead = readTokenCount(record, "cachedInputTokens");
|
|
287
|
-
const output = readTokenCount(record, "outputTokens");
|
|
288
|
-
const reasoningTokens = readTokenCount(record, "reasoningOutputTokens");
|
|
289
|
-
const cacheWrite = record.cacheWriteInputTokens === void 0 ? 0 : readTokenCount(record, "cacheWriteInputTokens");
|
|
290
|
-
const hasCoherentInput = inputTokens !== void 0 && cacheRead !== void 0 && cacheWrite !== void 0 && cacheRead + cacheWrite <= inputTokens;
|
|
291
|
-
const hasCoherentContext = hasCoherentInput && totalTokens !== void 0 && output !== void 0 && totalTokens === inputTokens + output;
|
|
292
|
-
const usage = normalizeUsage({
|
|
293
|
-
input: hasCoherentInput ? inputTokens - cacheRead - cacheWrite : void 0,
|
|
294
|
-
output,
|
|
295
|
-
cacheRead,
|
|
296
|
-
cacheWrite,
|
|
297
|
-
reasoningTokens,
|
|
298
|
-
total: totalTokens
|
|
299
|
-
});
|
|
300
|
-
if (!usage) return;
|
|
301
|
-
return {
|
|
302
|
-
...usage,
|
|
303
|
-
contextUsage: hasCoherentContext ? {
|
|
304
|
-
state: "available",
|
|
305
|
-
promptTokens: inputTokens,
|
|
306
|
-
totalTokens
|
|
307
|
-
} : { state: "unavailable" }
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
var CodexResponseCompletionProjection = class {
|
|
311
|
-
constructor() {
|
|
312
|
-
this.responseIds = /* @__PURE__ */ new Set();
|
|
313
|
-
}
|
|
314
|
-
get modelIterations() {
|
|
315
|
-
return this.responseIds.size;
|
|
316
|
-
}
|
|
317
|
-
clear() {
|
|
318
|
-
this.usage = void 0;
|
|
319
|
-
}
|
|
320
|
-
record(params) {
|
|
321
|
-
const responseId = readStringField(params, "responseId");
|
|
322
|
-
if (responseId) this.responseIds.add(responseId);
|
|
323
|
-
const usage = isJsonObject(params.usage) ? params.usage : void 0;
|
|
324
|
-
this.usage = usage ? normalizeCodexResponseTokenUsage(usage) : void 0;
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
//#endregion
|
|
328
|
-
export { readRawResponseToolCallId as C, updateActiveTurnItemIds as E, readNotificationItemId as S, updateActiveCompletionBlockerItemIds as T, isReasoningItemCompletionNotification as _, codexExecutionToolName as a, isTerminalTurnStatus as b, isAssistantCompletionReleaseNotification as c, isNativeToolProgressNotification as d, isPendingOpenClawDynamicToolCompletionNotification as f, isRawToolOutputCompletionNotification as g, isRawReasoningCompletionNotification as h, readCodexThreadContextSnapshot as i, isCodexTurnAbortMarkerNotification as l, isRawFunctionToolOutputCompletionNotification as m, normalizeCodexResponseTokenUsage as n, describeNotificationActivity as o, isRawAssistantProgressNotification as p, projectCodexThreadUsageUpdate as r, isAssistantCommentaryCompletionNotification as s, CodexResponseCompletionProjection as t, isFileChangePatchUpdatedNotification as u, isReasoningProgressNotification as v, shouldDisarmAssistantCompletionIdleWatch as w, readCodexNotificationItem as x, isRetryableErrorNotification as y };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { r as buildCodexRuntimeModelParams } from "./harness-Csz0F-DK.js";
|
|
2
|
-
import { h as readCodexPluginConfig } from "./config-giW8X0QA.js";
|
|
3
|
-
import { t as listAllCodexAppServerModels } from "./models-TS3HBU-q.js";
|
|
4
|
-
import { r as requestOptions } from "./command-rpc-CCeCkf_v.js";
|
|
5
|
-
//#region extensions/codex/src/app-server/model-catalog.ts
|
|
6
|
-
const OPENAI_CODEX_BASE_URL = "https://chatgpt.com/backend-api/codex";
|
|
7
|
-
const DEFAULT_MODEL_DISCOVERY_TIMEOUT_MS = 2500;
|
|
8
|
-
const INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
9
|
-
"text",
|
|
10
|
-
"image",
|
|
11
|
-
"audio",
|
|
12
|
-
"video",
|
|
13
|
-
"document"
|
|
14
|
-
]);
|
|
15
|
-
function isModelInputType(value) {
|
|
16
|
-
return INPUT_TYPES.has(value);
|
|
17
|
-
}
|
|
18
|
-
function codexAppServerModelsToCatalogEntries(models) {
|
|
19
|
-
return models.map((model, providerOrder) => {
|
|
20
|
-
const input = model.inputModalities.filter(isModelInputType);
|
|
21
|
-
const runtimeParams = buildCodexRuntimeModelParams(model.id, model.model);
|
|
22
|
-
return {
|
|
23
|
-
provider: "openai",
|
|
24
|
-
id: model.id,
|
|
25
|
-
name: model.displayName ?? model.id,
|
|
26
|
-
providerOrder,
|
|
27
|
-
api: "openai-chatgpt-responses",
|
|
28
|
-
baseUrl: OPENAI_CODEX_BASE_URL,
|
|
29
|
-
reasoning: model.supportedReasoningEfforts.length > 0,
|
|
30
|
-
...input.length > 0 ? { input } : {},
|
|
31
|
-
...runtimeParams ? { params: runtimeParams } : {},
|
|
32
|
-
compat: {
|
|
33
|
-
supportsReasoningEffort: model.supportedReasoningEfforts.length > 0,
|
|
34
|
-
supportedReasoningEfforts: model.supportedReasoningEfforts
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
async function loadCodexAppServerModelCatalog(params, pluginConfig) {
|
|
40
|
-
const discovery = readCodexPluginConfig(pluginConfig).discovery;
|
|
41
|
-
if (discovery?.enabled === false) return [];
|
|
42
|
-
return codexAppServerModelsToCatalogEntries((await listAllCodexAppServerModels({
|
|
43
|
-
...requestOptions(pluginConfig, 100, params.config, params.agentDir),
|
|
44
|
-
timeoutMs: discovery?.timeoutMs ?? DEFAULT_MODEL_DISCOVERY_TIMEOUT_MS
|
|
45
|
-
})).models);
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
|
-
export { loadCodexAppServerModelCatalog };
|