@openclaw/codex 2026.9.8 → 2026.10.1-beta.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/README.md +8 -0
- package/dist/.setup/{account-usage-runtime-G348lY1q.mjs → account-usage-runtime-C4GFoef_.mjs} +5 -5
- package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
- package/dist/.setup/{apply-Cqb-YoCS.mjs → apply-D02fLpgN.mjs} +48 -39
- package/dist/.setup/attempt-client-cleanup-yLjGwbwT.mjs +155 -0
- package/dist/.setup/{attempt-workspace-context-BJ5Z_olH.mjs → attempt-workspace-context-CbSzT6V2.mjs} +11 -15
- package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
- package/dist/.setup/{auth-cache-key-Dnps4W4_.mjs → auth-cache-key-CEd9QlIs.mjs} +244 -82
- package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
- package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
- package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
- package/dist/.setup/{bounded-turn-BNunZPtz.mjs → bounded-turn-DlHlNTyS.mjs} +14 -13
- package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
- package/dist/.setup/{build-state-DIQ5O_-S.mjs → build-state-CIi3Ckqu.mjs} +1 -1
- package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
- package/dist/.setup/{client-qyUBJlGZ.mjs → client-CBzEVDyb.mjs} +438 -160
- package/dist/.setup/{client-catalog-response-DRvx_wCC.mjs → client-catalog-response-CmvIiDdj.mjs} +57 -25
- package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
- package/dist/.setup/{command-dispatch-Btrs1D6f.mjs → command-dispatch-BE_RdMou.mjs} +3 -3
- package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
- package/dist/.setup/{command-handlers-DvlCHJch.mjs → command-handlers-DNoRq5Ps.mjs} +82 -144
- package/dist/.setup/{command-rpc-skzRq4wD.mjs → command-rpc-B6xsq2dB.mjs} +23 -31
- package/dist/.setup/{compact-8ttks5U5.mjs → compact-BLSAd-ru.mjs} +117 -65
- package/dist/.setup/{plugin-metadata-cache-BRwtRct9.mjs → computer-use-DpolvQHw.mjs} +65 -202
- package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
- package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
- package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
- package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
- package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
- package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
- package/dist/.setup/{conversation-binding-74LaGGH-.mjs → conversation-binding-CgSSD1Qz.mjs} +36 -48
- package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
- package/dist/.setup/{conversation-control-OrN6zuaY.mjs → conversation-control-tCg763cI.mjs} +19 -21
- package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
- package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
- package/dist/.setup/dynamic-tool-build-CVrx02cH.mjs +463 -0
- package/dist/.setup/{dynamic-tools-Db2sY5cZ.mjs → dynamic-tools-DdsymYGQ.mjs} +238 -878
- package/dist/.setup/{effective-mcp-catalog-Bi6-SQ7i.mjs → effective-mcp-catalog-BysTBZCW.mjs} +83 -11
- package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
- package/dist/.setup/{ephemeral-turn-DiCS1ijR.mjs → ephemeral-turn-oPKxs3ia.mjs} +2 -2
- package/dist/.setup/{event-projector-assistant-message-MV_1dj-3.mjs → event-projector-assistant-message-YCL2wspu.mjs} +2 -2
- package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
- package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
- package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
- package/dist/.setup/{isolated-completion-D80IXfQF.mjs → isolated-completion-D5gbKm6k.mjs} +8 -8
- package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
- package/dist/.setup/mcp-app-session-preparation-CdqsXwZX.mjs +223 -0
- package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
- package/dist/.setup/{model-catalog-DiC0Tkha.mjs → model-catalog-Dj_uvusa.mjs} +7 -7
- package/dist/.setup/{models-DfLmPV0k.mjs → models-Du_i5G_t.mjs} +10 -7
- package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
- package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
- package/dist/.setup/native-mcp-app-DV7VbfzF.mjs +310 -0
- package/dist/.setup/{native-subagent-monitor-BwkQXf9e.mjs → native-subagent-monitor-CCEFO6qK.mjs} +235 -318
- package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
- package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
- package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
- package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
- package/dist/.setup/{plan-DPdMk1Oy.mjs → plan-CUHSIOep.mjs} +67 -89
- package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
- package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
- package/dist/.setup/plugin-approval-roundtrip-uAR-oQfr.mjs +109 -0
- package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
- package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
- package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
- package/dist/.setup/plugin-thread-config-deadline-CdRzGJt4.mjs +124 -0
- package/dist/.setup/{provider-D6F_7p1I.mjs → provider-BP8ZaZqn.mjs} +4 -4
- package/dist/.setup/provider-capabilities-Z5ZbBxqP.mjs +50 -0
- package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
- package/dist/.setup/{request-BZOfsSXW.mjs → request-BH3FvYUE.mjs} +189 -49
- package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
- package/dist/.setup/{run-attempt-dYJhjZrp.mjs → run-attempt-CgvFoW7R.mjs} +553 -727
- package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
- package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
- package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
- package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
- package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
- package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
- package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
- package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
- package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
- package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
- package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
- package/dist/.setup/{session-catalog-events-BMCFMZw-.mjs → session-catalog-events-KIXOoSnQ.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-DwJjnF5k.mjs → session-catalog-index-DPICGlxr.mjs} +361 -72
- package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
- package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
- package/dist/.setup/{session-catalog-native-projection-CuaFZuQE.mjs → session-catalog-native-projection-CTBd4EUm.mjs} +7 -6
- package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
- package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
- package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
- package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
- package/dist/.setup/{session-catalog-projection-CGfzfP93.mjs → session-catalog-projection-CE0_Hffi.mjs} +6 -122
- package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
- package/dist/.setup/{session-cli-DlmBHYIe.mjs → session-cli-kH4vuGod.mjs} +1 -2
- package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
- package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
- package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
- package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
- package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
- package/dist/.setup/{session-retirement-LlYWBKTJ.mjs → session-retirement-aC60o6P3.mjs} +14 -15
- package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
- package/dist/.setup/{settled-turn-finalizer-DW9W3gza.mjs → settled-turn-finalizer-CDxCejjC.mjs} +8 -8
- package/dist/.setup/{shared-client-CJCTeFpQ.mjs → shared-client-DJJ3ljH2.mjs} +291 -272
- package/dist/.setup/{provider-capabilities-DG5qbsUZ.mjs → shell-dynamic-tools-Do9lIAT1.mjs} +16 -55
- package/dist/.setup/{side-question-BLeGj7TQ.mjs → side-question-B7T0_GEC.mjs} +99 -91
- package/dist/.setup/{source-CJis_1EF.mjs → source-DH70LqN0.mjs} +24 -40
- package/dist/.setup/{thread-lifecycle-_bAbjedG.mjs → thread-lifecycle-DkcoX9q-.mjs} +262 -305
- package/dist/.setup/{thread-ownership-B6pPt21M.mjs → thread-ownership-0aRHD9iK.mjs} +10 -8
- package/dist/.setup/{thread-policy-gNPzzpVp.mjs → thread-policy-CXZV97TS.mjs} +22 -21
- package/dist/.setup/{thread-requests-OWGOiDaV.mjs → thread-requests-COrRJcZb.mjs} +107 -98
- package/dist/.setup/{thread-resume-GOry0AYh.mjs → thread-resume-rx7J68Rx.mjs} +10 -18
- package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
- package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
- package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
- package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
- package/dist/.setup/{attempt-client-cleanup-B-S7ngS_.mjs → turn-router-CX1-EoCp.mjs} +75 -170
- package/dist/.setup/{upstream-session-fork-gkdRj2yH.mjs → upstream-session-fork-LYlaQnbt.mjs} +35 -46
- package/dist/.setup/{usage-CApUvLOV.mjs → usage-Dmx7B0W2.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-wSMQkbpV.mjs → usage-limit-error-M8jVnITZ.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-UKgeiBUG.mjs → web-search-provider.runtime-CsVmqbFm.mjs} +4 -20
- package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
- package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
- package/dist/api.js +34 -54
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +15 -27
- package/dist/harness.js +37 -22
- package/dist/index.js +2880 -276
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +2 -0
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +33 -4
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +3 -3
- package/package.json +6 -6
- package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
- package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
- package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
- package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
- package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
- package/dist/.setup/session-catalog-BFafIiF6.mjs +0 -2599
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
- package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +0 -153
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as readCodexCatalogDecodeRoute, c as isRpcResponse, i as listenCodexAppServerLines, n as projectCodexCatalogMessage, o as CodexAppServerMessageDecoder, r as createCodexAppServerMessageWriter, s as redactCodexAppServerLinePreview } from "./client-catalog-response-CmvIiDdj.mjs";
|
|
2
2
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
3
|
-
import { c as MIN_SUPPORTED_CODEX_APP_SERVER_VERSION, s as CODEX_APP_SERVER_VERSION } from "./managed-binary-
|
|
4
|
-
import { a as closeCodexAppServerTransportAndWait, i as closeCodexAppServerTransport, o as hasCodexAppServerNaturalExit, t as createStdioTransport } from "./transport-stdio-
|
|
5
|
-
import { n as CodexAppServerRpcError, t as CODEX_APP_SERVER_OVERLOADED_ERROR_CODE } from "./rpc-error-
|
|
6
|
-
import { f as recordCodexCatalogResponseSource, i as reuseCodexCatalogPreview, o as closeCodexCatalogClientSource, s as codexCatalogSourceForClient } from "./session-catalog-native-projection-
|
|
7
|
-
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-
|
|
3
|
+
import { c as MIN_SUPPORTED_CODEX_APP_SERVER_VERSION, s as CODEX_APP_SERVER_VERSION } from "./managed-binary-C1VFoVPf.mjs";
|
|
4
|
+
import { a as closeCodexAppServerTransportAndWait, c as getCodexAppServerRegisteredTransportIdentity, i as closeCodexAppServerTransport, o as hasCodexAppServerNaturalExit, t as createStdioTransport } from "./transport-stdio-a0HDa2Mj.mjs";
|
|
5
|
+
import { i as CodexAppServerScopedRequestRejectedError, n as CodexAppServerLocalRequestCancellationError, o as isCodexAppServerOverloadError, r as CodexAppServerRpcError, t as CODEX_APP_SERVER_OVERLOADED_ERROR_CODE } from "./rpc-error-hmWM21RB.mjs";
|
|
6
|
+
import { f as recordCodexCatalogResponseSource, i as reuseCodexCatalogPreview, o as closeCodexCatalogClientSource, s as codexCatalogSourceForClient } from "./session-catalog-native-projection-CTBd4EUm.mjs";
|
|
7
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-cUYrqu_a.mjs";
|
|
8
8
|
import { codexCatalogPageWorkerEntrypoint } from "../catalog-page-worker-entrypoint.js";
|
|
9
|
-
import { t as createWebSocketTransport } from "./transport-websocket-
|
|
10
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
11
|
-
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
+
import { t as createWebSocketTransport } from "./transport-websocket-zqJ0Cmtn.mjs";
|
|
10
|
+
import { t as __exportAll } from "./session-binding-sidecars-BrdV95Fg.mjs";
|
|
11
|
+
import { isRecord, normalizeOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { randomUUID } from "node:crypto";
|
|
13
13
|
import { normalizeJsonSchemaForTypeBox } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
14
14
|
import { addSafeTimeoutDelayGraceMs, addTimerTimeoutGraceMs, parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -19,6 +19,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
19
19
|
import { hasPendingInternalDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
20
20
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
21
21
|
import { OPENCLAW_VERSION, embeddedAgentLog, formatToolExecutionErrorMessage, normalizeQuestionTimeoutSeconds, resolveToolExecutionErrorKind } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
22
|
+
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
22
23
|
import { parse } from "semver";
|
|
23
24
|
import { AsyncWorkScope } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
24
25
|
import { copyInternalToolResultState, runWithAsyncWorkResources } from "openclaw/plugin-sdk/agent-harness-tool-runtime";
|
|
@@ -120,6 +121,18 @@ var CodexCatalogWorker = class {
|
|
|
120
121
|
};
|
|
121
122
|
//#endregion
|
|
122
123
|
//#region extensions/codex/src/app-server/client-diagnostics.ts
|
|
124
|
+
const CODEX_APP_SERVER_CLIENT_INSTANCE_IDS = /* @__PURE__ */ new WeakMap();
|
|
125
|
+
/** Process-local generation fence for bindings tied to one app-server client instance. */
|
|
126
|
+
function getCodexAppServerClientInstanceId(client) {
|
|
127
|
+
const current = CODEX_APP_SERVER_CLIENT_INSTANCE_IDS.get(client);
|
|
128
|
+
if (current) return current;
|
|
129
|
+
const created = randomUUID();
|
|
130
|
+
CODEX_APP_SERVER_CLIENT_INSTANCE_IDS.set(client, created);
|
|
131
|
+
return created;
|
|
132
|
+
}
|
|
133
|
+
function resolveCodexAppServerClientInstanceId(client) {
|
|
134
|
+
return client.getInstanceId?.call(client) ?? getCodexAppServerClientInstanceId(client);
|
|
135
|
+
}
|
|
123
136
|
function observeCodexAppServerStderr(stderr, consume) {
|
|
124
137
|
stderr.setEncoding("utf8");
|
|
125
138
|
stderr.on("data", (chunk) => {
|
|
@@ -148,6 +161,16 @@ function logCodexAppServerParseFailure(value, error, fragmentCount) {
|
|
|
148
161
|
consoleMessage: `failed to parse codex app-server message${suffix}: preview=${JSON.stringify(linePreview)}`
|
|
149
162
|
});
|
|
150
163
|
}
|
|
164
|
+
function isCodexAppServerBrokenPipeError(error) {
|
|
165
|
+
const seen = /* @__PURE__ */ new Set();
|
|
166
|
+
let current = error;
|
|
167
|
+
while (current && typeof current === "object" && !seen.has(current)) {
|
|
168
|
+
seen.add(current);
|
|
169
|
+
if ("code" in current && current.code === "EPIPE") return true;
|
|
170
|
+
current = "cause" in current ? current.cause : void 0;
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
151
174
|
function formatExitValue(value) {
|
|
152
175
|
if (value === null || value === void 0) return "null";
|
|
153
176
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
@@ -196,6 +219,65 @@ const CODEX_APP_SERVER_OPT_OUT_NOTIFICATION_METHODS = [
|
|
|
196
219
|
];
|
|
197
220
|
//#endregion
|
|
198
221
|
//#region extensions/codex/src/app-server/client-initialize.ts
|
|
222
|
+
/** Scalar observations only: a stream callback is not a native response. */
|
|
223
|
+
function createCodexInitializeDiagnostics() {
|
|
224
|
+
let current;
|
|
225
|
+
let beforeClose;
|
|
226
|
+
return {
|
|
227
|
+
begin() {
|
|
228
|
+
let snapshot = {
|
|
229
|
+
boundary: "request",
|
|
230
|
+
outcome: "pending",
|
|
231
|
+
overloadAttemptOrdinal: 0,
|
|
232
|
+
writeState: "not-attempted",
|
|
233
|
+
wireOutcome: "not-written"
|
|
234
|
+
};
|
|
235
|
+
current = snapshot;
|
|
236
|
+
return {
|
|
237
|
+
boundary(boundary) {
|
|
238
|
+
if (current === snapshot) snapshot.boundary = boundary;
|
|
239
|
+
},
|
|
240
|
+
finish(succeeded) {
|
|
241
|
+
if (current === snapshot) snapshot.outcome = succeeded ? "succeeded" : "failed";
|
|
242
|
+
},
|
|
243
|
+
attempt(ordinal) {
|
|
244
|
+
if (current !== snapshot) return;
|
|
245
|
+
const attempt = {
|
|
246
|
+
boundary: "request",
|
|
247
|
+
outcome: "pending",
|
|
248
|
+
overloadAttemptOrdinal: ordinal,
|
|
249
|
+
writeState: "not-attempted",
|
|
250
|
+
wireOutcome: "retained-pending"
|
|
251
|
+
};
|
|
252
|
+
current = snapshot = attempt;
|
|
253
|
+
return {
|
|
254
|
+
observe(event) {
|
|
255
|
+
if (event.kind === "wire") attempt.wireOutcome = event.outcome;
|
|
256
|
+
else if (event.kind === "waiter") attempt.waiterOutcome = event.outcome;
|
|
257
|
+
else attempt.writeState = "possible-write";
|
|
258
|
+
},
|
|
259
|
+
writeResult(error) {
|
|
260
|
+
attempt.writeState = error ? "callback-error" : "callback-ok";
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
},
|
|
266
|
+
closing() {
|
|
267
|
+
if (current && !beforeClose) beforeClose = {
|
|
268
|
+
...current,
|
|
269
|
+
clientClosed: false
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
snapshot(clientClosed, beforeClientClose = false) {
|
|
273
|
+
if (beforeClientClose) return beforeClose ? { ...beforeClose } : void 0;
|
|
274
|
+
return current ? {
|
|
275
|
+
...current,
|
|
276
|
+
clientClosed
|
|
277
|
+
} : void 0;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
199
281
|
function buildCodexAppServerInitializeParams() {
|
|
200
282
|
return {
|
|
201
283
|
clientInfo: {
|
|
@@ -209,6 +291,7 @@ function buildCodexAppServerInitializeParams() {
|
|
|
209
291
|
extensions: {
|
|
210
292
|
"openai/standard-form-input": {},
|
|
211
293
|
"openai/form": {},
|
|
294
|
+
"openai/elicitation": { form: {} },
|
|
212
295
|
"io.modelcontextprotocol/ui": { mimeTypes: ["text/html;profile=mcp-app"] }
|
|
213
296
|
}
|
|
214
297
|
}
|
|
@@ -227,6 +310,74 @@ function buildCodexAppServerRuntimeIdentity(response, serverVersion) {
|
|
|
227
310
|
...platformOs ? { platformOs } : {}
|
|
228
311
|
};
|
|
229
312
|
}
|
|
313
|
+
var CodexAppServerVersionError = class extends Error {
|
|
314
|
+
constructor(detectedVersion) {
|
|
315
|
+
const detected = detectedVersion ? `detected ${detectedVersion}` : "OpenClaw could not determine the running Codex version";
|
|
316
|
+
super(`Codex app-server ${MIN_SUPPORTED_CODEX_APP_SERVER_VERSION} or newer is required, but ${detected}. Update the configured Codex app-server binary, or remove custom command overrides to use the managed binary.`);
|
|
317
|
+
this.name = "CodexAppServerVersionError";
|
|
318
|
+
this.detectedVersion = detectedVersion;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
function assertSupportedCodexAppServerVersion(response) {
|
|
322
|
+
const detectedVersion = readCodexVersionFromUserAgent(response.userAgent);
|
|
323
|
+
if (!detectedVersion) throw new CodexAppServerVersionError(detectedVersion);
|
|
324
|
+
const detected = parse(detectedVersion);
|
|
325
|
+
if (!detected || detected.compare("0.149.0") < 0) throw new CodexAppServerVersionError(detectedVersion);
|
|
326
|
+
if (detected.compare("0.160.0") > 0) embeddedAgentLog.warn("codex app-server is newer than OpenClaw's managed runtime; continuing with normal startup validation", {
|
|
327
|
+
detectedVersion,
|
|
328
|
+
validatedVersion: CODEX_APP_SERVER_VERSION
|
|
329
|
+
});
|
|
330
|
+
return detectedVersion;
|
|
331
|
+
}
|
|
332
|
+
function readCodexVersionFromUserAgent(userAgent) {
|
|
333
|
+
return (userAgent?.match(/^[^/]+\/(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?:[\s(]|$)/))?.[1];
|
|
334
|
+
}
|
|
335
|
+
function isUnsupportedCodexAppServerVersionError(error) {
|
|
336
|
+
return error instanceof CodexAppServerVersionError;
|
|
337
|
+
}
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region extensions/codex/src/app-server/client-notifications.ts
|
|
340
|
+
const CODEX_APP_SERVER_PENDING_STARTUP_WARNINGS_MAX = 32;
|
|
341
|
+
const LOG_ONLY_CODEX_WARNING_PATTERNS = [/^Configured service tier `[^`\r\n]+` is not advertised as supported for model `[^`\r\n]+` and will be omitted from requests\.$/, /^Code Mode is enabled in configuration, but model `[^`\r\n]+` does not advertise Code Mode support\. This may degrade model performance\. Disable `features\.code_mode` and `features\.code_mode_only`, or select a model whose metadata enables Code Mode\.$/];
|
|
342
|
+
const CODEX_LOG_WRITE_WARNINGS = /* @__PURE__ */ new Set(["Codex couldn't save diagnostic logs to its local database. Use /feedback with logs included before closing Codex, or run `codex doctor` for diagnostics.", "Codex couldn't save diagnostic logs to its local database. Run `codex doctor` for diagnostics."]);
|
|
343
|
+
function readCodexAppServerWarningMessage(params) {
|
|
344
|
+
return [readStringField(params, "summary") ?? readStringField(params, "message"), readStringField(params, "details")].filter(Boolean).join("\n");
|
|
345
|
+
}
|
|
346
|
+
function logCodexAppServerManagedWarning(notification) {
|
|
347
|
+
if (notification.method !== "warning" && notification.method !== "configWarning" || !isJsonObject(notification.params)) return false;
|
|
348
|
+
const message = readCodexAppServerWarningMessage(notification.params);
|
|
349
|
+
if (!(notification.method === "warning" && notification.params.threadId === null && CODEX_LOG_WRITE_WARNINGS.has(message)) && !LOG_ONLY_CODEX_WARNING_PATTERNS.some((pattern) => pattern.test(message))) return false;
|
|
350
|
+
try {
|
|
351
|
+
embeddedAgentLog.warn(message);
|
|
352
|
+
} catch {}
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
355
|
+
var CodexAppServerNotifications = class {
|
|
356
|
+
constructor() {
|
|
357
|
+
this.handlers = /* @__PURE__ */ new Set();
|
|
358
|
+
this.pendingStartupWarnings = [];
|
|
359
|
+
}
|
|
360
|
+
addHandler(handler) {
|
|
361
|
+
this.handlers.add(handler);
|
|
362
|
+
for (const notification of this.pendingStartupWarnings.splice(0)) this.dispatch(notification);
|
|
363
|
+
return () => this.handlers.delete(handler);
|
|
364
|
+
}
|
|
365
|
+
dispatch(notification) {
|
|
366
|
+
if (logCodexAppServerManagedWarning(notification)) return;
|
|
367
|
+
if (this.handlers.size === 0 && notification.method === "configWarning") {
|
|
368
|
+
if (this.pendingStartupWarnings.length === CODEX_APP_SERVER_PENDING_STARTUP_WARNINGS_MAX) this.pendingStartupWarnings.shift();
|
|
369
|
+
this.pendingStartupWarnings.push(notification);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
for (const handler of this.handlers) try {
|
|
373
|
+
Promise.resolve(handler(notification)).catch((error) => {
|
|
374
|
+
embeddedAgentLog.warn("codex app-server notification handler failed", { error });
|
|
375
|
+
});
|
|
376
|
+
} catch (error) {
|
|
377
|
+
embeddedAgentLog.warn("codex app-server notification handler failed", { error });
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
230
381
|
//#endregion
|
|
231
382
|
//#region extensions/codex/src/app-server/client-response.ts
|
|
232
383
|
/** Settles one wire attempt and reports newly observed native execution. */
|
|
@@ -260,12 +411,47 @@ function dispatchCodexAppServerResponse(response, attempts, catalogResponses, so
|
|
|
260
411
|
return nativeExecution;
|
|
261
412
|
}
|
|
262
413
|
//#endregion
|
|
414
|
+
//#region extensions/codex/src/app-server/request-admission.ts
|
|
415
|
+
/** Consume authority once at the physical writer; waiter expiry never permits a late write. */
|
|
416
|
+
function dispatchCodexRequestAttempt(attempt, options, assertTransportCurrent, writeMessage) {
|
|
417
|
+
if (!attempt.pending) return;
|
|
418
|
+
let consumed = false;
|
|
419
|
+
const write = () => {
|
|
420
|
+
if (consumed) throw new Error("Codex request wire admission was already consumed");
|
|
421
|
+
consumed = true;
|
|
422
|
+
if (!attempt.pending) return;
|
|
423
|
+
assertTransportCurrent();
|
|
424
|
+
try {
|
|
425
|
+
options.assertCurrent?.();
|
|
426
|
+
} catch (cause) {
|
|
427
|
+
throw cause instanceof CodexAppServerScopedRequestRejectedError ? cause : new CodexAppServerScopedRequestRejectedError(coerceErrorMessage(cause), { cause });
|
|
428
|
+
}
|
|
429
|
+
if (attempt.pending) writeMessage();
|
|
430
|
+
};
|
|
431
|
+
const rejectAdmission = (cause) => {
|
|
432
|
+
attempt.failLocal(!consumed && !(cause instanceof CodexAppServerScopedRequestRejectedError) ? new CodexAppServerScopedRequestRejectedError(coerceErrorMessage(cause), { cause }) : toStringifiedError(cause));
|
|
433
|
+
};
|
|
434
|
+
try {
|
|
435
|
+
if (options.withCurrent) options.withCurrent(write).then(() => {
|
|
436
|
+
if (!consumed && attempt.pending) throw new Error("Codex request authority did not admit the wire write");
|
|
437
|
+
}).catch(rejectAdmission);
|
|
438
|
+
else write();
|
|
439
|
+
} catch (error) {
|
|
440
|
+
rejectAdmission(error);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
263
444
|
//#region extensions/codex/src/app-server/request-attempt.ts
|
|
264
445
|
/** One caller per wire attempt; local waiter expiry need not imply a native response. */
|
|
265
446
|
function createCodexRequestAttempt(params) {
|
|
266
447
|
let pending = true;
|
|
267
448
|
let mayHaveWritten = false;
|
|
268
449
|
let waiter;
|
|
450
|
+
const observeAttempt = (event) => {
|
|
451
|
+
try {
|
|
452
|
+
params.observe?.(event);
|
|
453
|
+
} catch {}
|
|
454
|
+
};
|
|
269
455
|
const diagnostics = params.diagnosticIdentity ? {
|
|
270
456
|
...params.diagnosticIdentity,
|
|
271
457
|
attemptCreatedAtMs: performance.now(),
|
|
@@ -276,6 +462,10 @@ function createCodexRequestAttempt(params) {
|
|
|
276
462
|
const finish = (outcome) => {
|
|
277
463
|
if (!pending) return false;
|
|
278
464
|
pending = false;
|
|
465
|
+
observeAttempt({
|
|
466
|
+
kind: "wire",
|
|
467
|
+
outcome
|
|
468
|
+
});
|
|
279
469
|
if (diagnostics) {
|
|
280
470
|
diagnostics.wireOutcomeAtWaiterSettlement = outcome;
|
|
281
471
|
diagnostics.wireObservedAtMs = performance.now();
|
|
@@ -321,6 +511,10 @@ function createCodexRequestAttempt(params) {
|
|
|
321
511
|
waiter = void 0;
|
|
322
512
|
cleanup();
|
|
323
513
|
if (!params.retainWritten || !mayHaveWritten) finish(mayHaveWritten ? "correlation-closed" : "not-written");
|
|
514
|
+
observeAttempt({
|
|
515
|
+
kind: "waiter",
|
|
516
|
+
outcome: waiterOutcome
|
|
517
|
+
});
|
|
324
518
|
const callback = observe;
|
|
325
519
|
observe = void 0;
|
|
326
520
|
if (diagnostics && callback) try {
|
|
@@ -374,10 +568,13 @@ function createCodexRequestAttempt(params) {
|
|
|
374
568
|
},
|
|
375
569
|
reject(error, definitelyNotEnqueued = false) {
|
|
376
570
|
if (finish(definitelyNotEnqueued ? "ingress-rejected" : "native-error")) {
|
|
377
|
-
if (definitelyNotEnqueued)
|
|
571
|
+
if (definitelyNotEnqueued) {
|
|
572
|
+
mayHaveWritten = false;
|
|
573
|
+
params.onIngressRejected?.();
|
|
574
|
+
}
|
|
378
575
|
params.onResponse?.(mayHaveWritten);
|
|
379
576
|
const current = currentWaiterError();
|
|
380
|
-
waiter?.reject(current?.error ?? params.localError(error, mayHaveWritten), current?.outcome ?? "native-error");
|
|
577
|
+
waiter?.reject(current?.error ?? (error instanceof CodexAppServerRpcError ? error : params.localError(error, mayHaveWritten)), current?.outcome ?? "native-error");
|
|
381
578
|
}
|
|
382
579
|
},
|
|
383
580
|
close(error) {
|
|
@@ -390,6 +587,7 @@ function createCodexRequestAttempt(params) {
|
|
|
390
587
|
},
|
|
391
588
|
markWritten() {
|
|
392
589
|
mayHaveWritten = true;
|
|
590
|
+
observeAttempt({ kind: "possible-write" });
|
|
393
591
|
if (diagnostics && diagnostics.firstPossibleWriteAtMs === null) diagnostics.firstPossibleWriteAtMs = performance.now();
|
|
394
592
|
}
|
|
395
593
|
};
|
|
@@ -471,7 +669,7 @@ function readNumericTimeoutMs(value) {
|
|
|
471
669
|
if (typeof value === "number" && Number.isFinite(value)) return Math.max(0, Math.floor(value));
|
|
472
670
|
if (typeof value === "string") {
|
|
473
671
|
const parsed = parseStrictNonNegativeInteger(value);
|
|
474
|
-
|
|
672
|
+
return parsed === void 0 ? void 0 : Math.max(0, parsed);
|
|
475
673
|
}
|
|
476
674
|
}
|
|
477
675
|
function formatDynamicToolTimeoutDetails(params) {
|
|
@@ -682,9 +880,6 @@ function toCodexDynamicToolProgressResponse(response, protocolResponse) {
|
|
|
682
880
|
function shouldReleaseTurnAfterTerminalDynamicTool(state) {
|
|
683
881
|
return !state.completed && !state.aborted && state.responseSuccess && !state.currentTurnHadNonTerminalDynamicToolResult && state.activeAppServerTurnRequests === 0 && state.activeTurnItemIdsCount === 0 && state.pendingOpenClawDynamicToolCompletionIdsCount === 0;
|
|
684
882
|
}
|
|
685
|
-
function shouldBlockTerminalReleaseForNonTerminalDynamicToolResult(response) {
|
|
686
|
-
return response.asyncStarted !== true;
|
|
687
|
-
}
|
|
688
883
|
function resolveTerminalDynamicToolBatchAction(state) {
|
|
689
884
|
if (state.activeAppServerTurnRequests > 0 || state.activeTurnItemIdsCount > 0 || state.pendingOpenClawDynamicToolCompletionIdsCount > 0) return "wait";
|
|
690
885
|
if (state.currentTurnHadNonTerminalDynamicToolResult) return "clear-nonterminal-batch";
|
|
@@ -861,6 +1056,15 @@ var definitions = {
|
|
|
861
1056
|
"type": "object"
|
|
862
1057
|
}
|
|
863
1058
|
] },
|
|
1059
|
+
"AccountRoutingOverride": {
|
|
1060
|
+
"description": "Backend routing policy. Wire values match the accounts/check contract.",
|
|
1061
|
+
"enum": [
|
|
1062
|
+
"NO_CONSTRAINT",
|
|
1063
|
+
"us",
|
|
1064
|
+
"us_cr"
|
|
1065
|
+
],
|
|
1066
|
+
"type": "string"
|
|
1067
|
+
},
|
|
864
1068
|
"ActivePermissionProfile": {
|
|
865
1069
|
"properties": {
|
|
866
1070
|
"extends": {
|
|
@@ -1032,9 +1236,11 @@ var definitions = {
|
|
|
1032
1236
|
"sessionBudgetExceeded",
|
|
1033
1237
|
"usageLimitExceeded",
|
|
1034
1238
|
"rateLimitExceeded",
|
|
1239
|
+
"flexUnavailable",
|
|
1035
1240
|
"serverOverloaded",
|
|
1036
1241
|
"cyberPolicy",
|
|
1037
1242
|
"misalignmentPolicyViolation",
|
|
1243
|
+
"tooManyDenials",
|
|
1038
1244
|
"internalServerError",
|
|
1039
1245
|
"unauthorized",
|
|
1040
1246
|
"badRequest",
|
|
@@ -1089,6 +1295,15 @@ var definitions = {
|
|
|
1089
1295
|
],
|
|
1090
1296
|
"type": "string"
|
|
1091
1297
|
},
|
|
1298
|
+
"CollaborationMode": {
|
|
1299
|
+
"description": "Collaboration mode for a Codex session.",
|
|
1300
|
+
"properties": {
|
|
1301
|
+
"mode": { "$ref": "#/definitions/ModeKind" },
|
|
1302
|
+
"settings": { "$ref": "#/definitions/Settings" }
|
|
1303
|
+
},
|
|
1304
|
+
"required": ["mode", "settings"],
|
|
1305
|
+
"type": "object"
|
|
1306
|
+
},
|
|
1092
1307
|
"CommandAction": { "oneOf": [
|
|
1093
1308
|
{
|
|
1094
1309
|
"properties": {
|
|
@@ -1171,6 +1386,15 @@ var definitions = {
|
|
|
1171
1386
|
],
|
|
1172
1387
|
"type": "string"
|
|
1173
1388
|
},
|
|
1389
|
+
"CyberAccessProgram": {
|
|
1390
|
+
"description": "Requested cyber treatment for a ChatGPT-authenticated Codex turn. Authorization and model-tier restrictions remain server-owned.",
|
|
1391
|
+
"enum": [
|
|
1392
|
+
"standard",
|
|
1393
|
+
"daybreakBlue",
|
|
1394
|
+
"daybreakRed"
|
|
1395
|
+
],
|
|
1396
|
+
"type": "string"
|
|
1397
|
+
},
|
|
1174
1398
|
"DynamicToolCallOutputContentItem": { "oneOf": [
|
|
1175
1399
|
{
|
|
1176
1400
|
"properties": {
|
|
@@ -1254,16 +1478,26 @@ var definitions = {
|
|
|
1254
1478
|
"type": "object"
|
|
1255
1479
|
},
|
|
1256
1480
|
{
|
|
1481
|
+
"anyOf": [{
|
|
1482
|
+
"properties": { "image_url": { "type": "string" } },
|
|
1483
|
+
"required": ["image_url"],
|
|
1484
|
+
"title": "ImageUrlFunctionCallOutputContentItem",
|
|
1485
|
+
"type": "object"
|
|
1486
|
+
}, {
|
|
1487
|
+
"properties": { "file_id": { "type": "string" } },
|
|
1488
|
+
"required": ["file_id"],
|
|
1489
|
+
"title": "FileIdFunctionCallOutputContentItem",
|
|
1490
|
+
"type": "object"
|
|
1491
|
+
}],
|
|
1257
1492
|
"properties": {
|
|
1258
1493
|
"detail": { "anyOf": [{ "$ref": "#/definitions/ImageDetail" }, { "type": "null" }] },
|
|
1259
|
-
"image_url": { "type": "string" },
|
|
1260
1494
|
"type": {
|
|
1261
1495
|
"enum": ["input_image"],
|
|
1262
1496
|
"title": "InputImageFunctionCallOutputContentItemType",
|
|
1263
1497
|
"type": "string"
|
|
1264
1498
|
}
|
|
1265
1499
|
},
|
|
1266
|
-
"required": ["
|
|
1500
|
+
"required": ["type"],
|
|
1267
1501
|
"title": "InputImageFunctionCallOutputContentItem",
|
|
1268
1502
|
"type": "object"
|
|
1269
1503
|
},
|
|
@@ -1358,6 +1592,19 @@ var definitions = {
|
|
|
1358
1592
|
]
|
|
1359
1593
|
},
|
|
1360
1594
|
"LegacyAppPathString": { "type": "string" },
|
|
1595
|
+
"McpAppDisplayMode": {
|
|
1596
|
+
"enum": ["inline", "fullscreen"],
|
|
1597
|
+
"type": "string"
|
|
1598
|
+
},
|
|
1599
|
+
"McpAppUi": {
|
|
1600
|
+
"description": "UI resource and display preference for model invocations, captured from the tool descriptor.",
|
|
1601
|
+
"properties": {
|
|
1602
|
+
"preferredModelDisplayMode": { "$ref": "#/definitions/McpAppDisplayMode" },
|
|
1603
|
+
"resourceUri": { "type": "string" }
|
|
1604
|
+
},
|
|
1605
|
+
"required": ["preferredModelDisplayMode", "resourceUri"],
|
|
1606
|
+
"type": "object"
|
|
1607
|
+
},
|
|
1361
1608
|
"McpToolCallAppContext": {
|
|
1362
1609
|
"properties": {
|
|
1363
1610
|
"actionName": { "type": ["string", "null"] },
|
|
@@ -1465,6 +1712,11 @@ var definitions = {
|
|
|
1465
1712
|
"required": ["message"],
|
|
1466
1713
|
"type": "object"
|
|
1467
1714
|
},
|
|
1715
|
+
"ModeKind": {
|
|
1716
|
+
"description": "Initial collaboration mode to use when the TUI starts.",
|
|
1717
|
+
"enum": ["plan", "default"],
|
|
1718
|
+
"type": "string"
|
|
1719
|
+
},
|
|
1468
1720
|
"Model": {
|
|
1469
1721
|
"properties": {
|
|
1470
1722
|
"additionalSpeedTiers": {
|
|
@@ -1474,6 +1726,11 @@ var definitions = {
|
|
|
1474
1726
|
"type": "array"
|
|
1475
1727
|
},
|
|
1476
1728
|
"availabilityNux": { "anyOf": [{ "$ref": "#/definitions/ModelAvailabilityNux" }, { "type": "null" }] },
|
|
1729
|
+
"availableAccessPrograms": {
|
|
1730
|
+
"anyOf": [{ "$ref": "#/definitions/ModelAccessPrograms" }, { "type": "null" }],
|
|
1731
|
+
"default": null,
|
|
1732
|
+
"description": "Null when the catalog does not provide access-program metadata."
|
|
1733
|
+
},
|
|
1477
1734
|
"defaultReasoningEffort": { "$ref": "#/definitions/ReasoningEffort" },
|
|
1478
1735
|
"defaultServiceTier": {
|
|
1479
1736
|
"default": null,
|
|
@@ -1510,6 +1767,7 @@ var definitions = {
|
|
|
1510
1767
|
},
|
|
1511
1768
|
"supportsPersonality": {
|
|
1512
1769
|
"default": false,
|
|
1770
|
+
"description": "@deprecated Always false; models no longer support personality selection.",
|
|
1513
1771
|
"type": "boolean"
|
|
1514
1772
|
},
|
|
1515
1773
|
"upgrade": { "type": ["string", "null"] },
|
|
@@ -1527,6 +1785,16 @@ var definitions = {
|
|
|
1527
1785
|
],
|
|
1528
1786
|
"type": "object"
|
|
1529
1787
|
},
|
|
1788
|
+
"ModelAccessPrograms": {
|
|
1789
|
+
"description": "Caller-specific explicit access programs advertised by model discovery.",
|
|
1790
|
+
"properties": { "cyber": {
|
|
1791
|
+
"description": "Accepted explicit selections.",
|
|
1792
|
+
"items": { "$ref": "#/definitions/CyberAccessProgram" },
|
|
1793
|
+
"type": "array"
|
|
1794
|
+
} },
|
|
1795
|
+
"required": ["cyber"],
|
|
1796
|
+
"type": "object"
|
|
1797
|
+
},
|
|
1530
1798
|
"ModelAvailabilityNux": {
|
|
1531
1799
|
"properties": { "message": { "type": "string" } },
|
|
1532
1800
|
"required": ["message"],
|
|
@@ -1641,6 +1909,7 @@ var definitions = {
|
|
|
1641
1909
|
"plus",
|
|
1642
1910
|
"pro",
|
|
1643
1911
|
"prolite",
|
|
1912
|
+
"promax",
|
|
1644
1913
|
"team",
|
|
1645
1914
|
"self_serve_business_prolite",
|
|
1646
1915
|
"self_serve_business_usage_based",
|
|
@@ -1768,6 +2037,16 @@ var definitions = {
|
|
|
1768
2037
|
"type": "string"
|
|
1769
2038
|
}
|
|
1770
2039
|
] },
|
|
2040
|
+
"Settings": {
|
|
2041
|
+
"description": "Settings for a collaboration mode.",
|
|
2042
|
+
"properties": {
|
|
2043
|
+
"developer_instructions": { "type": ["string", "null"] },
|
|
2044
|
+
"model": { "type": "string" },
|
|
2045
|
+
"reasoning_effort": { "anyOf": [{ "$ref": "#/definitions/ReasoningEffort" }, { "type": "null" }] }
|
|
2046
|
+
},
|
|
2047
|
+
"required": ["model"],
|
|
2048
|
+
"type": "object"
|
|
2049
|
+
},
|
|
1771
2050
|
"SubAgentActivityKind": {
|
|
1772
2051
|
"enum": [
|
|
1773
2052
|
"started",
|
|
@@ -1864,6 +2143,16 @@ var definitions = {
|
|
|
1864
2143
|
"allOf": [{ "$ref": "#/definitions/AbsolutePathBuf" }],
|
|
1865
2144
|
"description": "Working directory captured for the thread."
|
|
1866
2145
|
},
|
|
2146
|
+
"daybreakEnabled": {
|
|
2147
|
+
"description": "Saved Daybreak choice, independent of turn execution. Null if unset.",
|
|
2148
|
+
"type": ["boolean", "null"]
|
|
2149
|
+
},
|
|
2150
|
+
"environments": {
|
|
2151
|
+
"default": null,
|
|
2152
|
+
"description": "Current environments for a loaded thread, in priority order, primary first. `null` means the thread is not loaded or the server does not expose its selection. An empty list means no environments are selected. This does not report connection status.",
|
|
2153
|
+
"items": { "$ref": "#/definitions/ThreadEnvironment" },
|
|
2154
|
+
"type": ["array", "null"]
|
|
2155
|
+
},
|
|
1867
2156
|
"ephemeral": {
|
|
1868
2157
|
"description": "Whether the thread is ephemeral and should not be materialized on disk.",
|
|
1869
2158
|
"type": "boolean"
|
|
@@ -1901,6 +2190,10 @@ var definitions = {
|
|
|
1901
2190
|
"description": "Optional user-facing thread title.",
|
|
1902
2191
|
"type": ["string", "null"]
|
|
1903
2192
|
},
|
|
2193
|
+
"originator": {
|
|
2194
|
+
"description": "Originator recorded when the thread was created, independent of its current client or executor. Null when the recorded originator is unavailable.",
|
|
2195
|
+
"type": ["string", "null"]
|
|
2196
|
+
},
|
|
1904
2197
|
"parentThreadId": {
|
|
1905
2198
|
"description": "The ID of the parent thread. This will only be set if this thread is a subagent.",
|
|
1906
2199
|
"type": ["string", "null"]
|
|
@@ -1954,7 +2247,7 @@ var definitions = {
|
|
|
1954
2247
|
"description": "Optional analytics source classification for this thread."
|
|
1955
2248
|
},
|
|
1956
2249
|
"turns": {
|
|
1957
|
-
"description": "Only populated on `thread/resume`, `thread/
|
|
2250
|
+
"description": "Only populated on `thread/resume`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.",
|
|
1958
2251
|
"items": { "$ref": "#/definitions/Turn" },
|
|
1959
2252
|
"type": "array"
|
|
1960
2253
|
},
|
|
@@ -1985,6 +2278,23 @@ var definitions = {
|
|
|
1985
2278
|
"enum": ["waitingOnApproval", "waitingOnUserInput"],
|
|
1986
2279
|
"type": "string"
|
|
1987
2280
|
},
|
|
2281
|
+
"ThreadEnvironment": {
|
|
2282
|
+
"description": "An environment selected by a loaded thread, independent of connection status.",
|
|
2283
|
+
"properties": {
|
|
2284
|
+
"cwd": { "$ref": "#/definitions/LegacyAppPathString" },
|
|
2285
|
+
"environmentId": { "type": "string" },
|
|
2286
|
+
"runtimeWorkspaceRoots": {
|
|
2287
|
+
"items": { "$ref": "#/definitions/LegacyAppPathString" },
|
|
2288
|
+
"type": "array"
|
|
2289
|
+
}
|
|
2290
|
+
},
|
|
2291
|
+
"required": [
|
|
2292
|
+
"cwd",
|
|
2293
|
+
"environmentId",
|
|
2294
|
+
"runtimeWorkspaceRoots"
|
|
2295
|
+
],
|
|
2296
|
+
"type": "object"
|
|
2297
|
+
},
|
|
1988
2298
|
"ThreadExtra": {
|
|
1989
2299
|
"description": "Extra app-server data for a thread.",
|
|
1990
2300
|
"type": "object"
|
|
@@ -2237,9 +2547,13 @@ var definitions = {
|
|
|
2237
2547
|
"error": { "anyOf": [{ "$ref": "#/definitions/McpToolCallError" }, { "type": "null" }] },
|
|
2238
2548
|
"id": { "type": "string" },
|
|
2239
2549
|
"mcpAppResourceUri": {
|
|
2240
|
-
"description": "
|
|
2550
|
+
"description": "Legacy compatibility field; prefer `mcpAppUi.resourceUri` when available.",
|
|
2241
2551
|
"type": ["string", "null"]
|
|
2242
2552
|
},
|
|
2553
|
+
"mcpAppUi": {
|
|
2554
|
+
"anyOf": [{ "$ref": "#/definitions/McpAppUi" }, { "type": "null" }],
|
|
2555
|
+
"description": "Presentation captured from the invoked descriptor; absent in older history."
|
|
2556
|
+
},
|
|
2243
2557
|
"pluginId": { "type": ["string", "null"] },
|
|
2244
2558
|
"readOnlyHint": { "type": ["boolean", "null"] },
|
|
2245
2559
|
"result": { "anyOf": [{ "$ref": "#/definitions/McpToolCallResult" }, { "type": "null" }] },
|
|
@@ -2613,7 +2927,7 @@ var definitions = {
|
|
|
2613
2927
|
},
|
|
2614
2928
|
"error": {
|
|
2615
2929
|
"anyOf": [{ "$ref": "#/definitions/TurnError" }, { "type": "null" }],
|
|
2616
|
-
"description": "
|
|
2930
|
+
"description": "Error associated with a failed or interrupted turn."
|
|
2617
2931
|
},
|
|
2618
2932
|
"id": {
|
|
2619
2933
|
"description": "Identifier for this turn. Codex-generated turn IDs are UUIDv7.",
|
|
@@ -2719,6 +3033,17 @@ var definitions = {
|
|
|
2719
3033
|
"type": "object"
|
|
2720
3034
|
},
|
|
2721
3035
|
{
|
|
3036
|
+
"anyOf": [{
|
|
3037
|
+
"properties": { "url": { "type": "string" } },
|
|
3038
|
+
"required": ["url"],
|
|
3039
|
+
"title": "UrlUserInput",
|
|
3040
|
+
"type": "object"
|
|
3041
|
+
}, {
|
|
3042
|
+
"properties": { "fileId": { "type": "string" } },
|
|
3043
|
+
"required": ["fileId"],
|
|
3044
|
+
"title": "FileIdUserInput",
|
|
3045
|
+
"type": "object"
|
|
3046
|
+
}],
|
|
2722
3047
|
"properties": {
|
|
2723
3048
|
"detail": {
|
|
2724
3049
|
"anyOf": [{ "$ref": "#/definitions/ImageDetail" }, { "type": "null" }],
|
|
@@ -2728,10 +3053,9 @@ var definitions = {
|
|
|
2728
3053
|
"enum": ["image"],
|
|
2729
3054
|
"title": "ImageUserInputType",
|
|
2730
3055
|
"type": "string"
|
|
2731
|
-
}
|
|
2732
|
-
"url": { "type": "string" }
|
|
3056
|
+
}
|
|
2733
3057
|
},
|
|
2734
|
-
"required": ["type"
|
|
3058
|
+
"required": ["type"],
|
|
2735
3059
|
"title": "ImageUserInput",
|
|
2736
3060
|
"type": "object"
|
|
2737
3061
|
},
|
|
@@ -2870,7 +3194,20 @@ var definitions = {
|
|
|
2870
3194
|
"title": "OtherWebSearchAction",
|
|
2871
3195
|
"type": "object"
|
|
2872
3196
|
}
|
|
2873
|
-
] }
|
|
3197
|
+
] },
|
|
3198
|
+
"WorkspaceRouting": {
|
|
3199
|
+
"properties": {
|
|
3200
|
+
"accountRoutingOverride": { "$ref": "#/definitions/AccountRoutingOverride" },
|
|
3201
|
+
"backendOrigin": { "type": "string" },
|
|
3202
|
+
"chatgptAccountId": { "type": "string" }
|
|
3203
|
+
},
|
|
3204
|
+
"required": [
|
|
3205
|
+
"accountRoutingOverride",
|
|
3206
|
+
"backendOrigin",
|
|
3207
|
+
"chatgptAccountId"
|
|
3208
|
+
],
|
|
3209
|
+
"type": "object"
|
|
3210
|
+
}
|
|
2874
3211
|
};
|
|
2875
3212
|
//#endregion
|
|
2876
3213
|
//#region extensions/codex/src/app-server/protocol-generated/json/v2/ErrorNotification.json
|
|
@@ -2924,7 +3261,17 @@ var ThreadResumeResponse_default = {
|
|
|
2924
3261
|
"allOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ApprovalsReviewer" }],
|
|
2925
3262
|
"description": "Reviewer currently used for approval requests on this thread."
|
|
2926
3263
|
},
|
|
3264
|
+
"collaborationMode": {
|
|
3265
|
+
"anyOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/CollaborationMode" }, { "type": "null" }],
|
|
3266
|
+
"description": "Effective collaboration mode. Absent when resuming from an older server."
|
|
3267
|
+
},
|
|
2927
3268
|
"cwd": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" },
|
|
3269
|
+
"disabledPluginIds": {
|
|
3270
|
+
"default": [],
|
|
3271
|
+
"description": "Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.",
|
|
3272
|
+
"items": { "type": "string" },
|
|
3273
|
+
"type": "array"
|
|
3274
|
+
},
|
|
2928
3275
|
"initialTurnsPage": {
|
|
2929
3276
|
"anyOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/TurnsPage" }, { "type": "null" }],
|
|
2930
3277
|
"default": null,
|
|
@@ -2995,6 +3342,12 @@ var ThreadStartResponse_default = {
|
|
|
2995
3342
|
"description": "Reviewer currently used for approval requests on this thread."
|
|
2996
3343
|
},
|
|
2997
3344
|
"cwd": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" },
|
|
3345
|
+
"disabledPluginIds": {
|
|
3346
|
+
"default": [],
|
|
3347
|
+
"description": "Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.",
|
|
3348
|
+
"items": { "type": "string" },
|
|
3349
|
+
"type": "array"
|
|
3350
|
+
},
|
|
2998
3351
|
"instructionSources": {
|
|
2999
3352
|
"default": [],
|
|
3000
3353
|
"description": "Environment-native paths to instruction source files currently loaded for this thread.",
|
|
@@ -3388,13 +3741,10 @@ function timeoutServerRequestResponse(timeoutMs) {
|
|
|
3388
3741
|
//#region extensions/codex/src/app-server/client.ts
|
|
3389
3742
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
3390
3743
|
CodexAppServerClient: () => CodexAppServerClient,
|
|
3391
|
-
getCodexAppServerClientInstanceId: () => getCodexAppServerClientInstanceId,
|
|
3392
3744
|
isCodexAppServerApprovalRequest: () => isCodexAppServerApprovalRequest,
|
|
3393
|
-
isCodexAppServerBrokenPipeError: () => isCodexAppServerBrokenPipeError,
|
|
3394
3745
|
isCodexAppServerConnectionClosedError: () => isCodexAppServerConnectionClosedError,
|
|
3395
3746
|
isCodexAppServerIndeterminateRequestCancellationError: () => isCodexAppServerIndeterminateRequestCancellationError,
|
|
3396
3747
|
isCodexAppServerIndeterminateTransportError: () => isCodexAppServerIndeterminateTransportError,
|
|
3397
|
-
isCodexAppServerOverloadError: () => isCodexAppServerOverloadError,
|
|
3398
3748
|
isCodexAppServerPrewriteRequestCancellationError: () => isCodexAppServerPrewriteRequestCancellationError,
|
|
3399
3749
|
isCodexAppServerRequestTimeoutError: () => isCodexAppServerRequestTimeoutError,
|
|
3400
3750
|
isUnsupportedCodexAppServerVersionError: () => isUnsupportedCodexAppServerVersionError,
|
|
@@ -3403,46 +3753,9 @@ var client_exports = /* @__PURE__ */ __exportAll({
|
|
|
3403
3753
|
const CODEX_APP_SERVER_STDERR_TAIL_MAX = 2e3;
|
|
3404
3754
|
const CODEX_APP_SERVER_OVERLOAD_MAX_RETRIES = 3;
|
|
3405
3755
|
const CODEX_APP_SERVER_OVERLOAD_RETRY_BASE_MS = 50;
|
|
3406
|
-
const CODEX_APP_SERVER_PENDING_STARTUP_WARNINGS_MAX = 32;
|
|
3407
|
-
const CODEX_APP_SERVER_CLIENT_INSTANCE_IDS = /* @__PURE__ */ new WeakMap();
|
|
3408
|
-
/** Process-local generation fence for bindings tied to one app-server client instance. */
|
|
3409
|
-
function getCodexAppServerClientInstanceId(client) {
|
|
3410
|
-
const current = CODEX_APP_SERVER_CLIENT_INSTANCE_IDS.get(client);
|
|
3411
|
-
if (current) return current;
|
|
3412
|
-
const created = randomUUID();
|
|
3413
|
-
CODEX_APP_SERVER_CLIENT_INSTANCE_IDS.set(client, created);
|
|
3414
|
-
return created;
|
|
3415
|
-
}
|
|
3416
|
-
function resolveCodexAppServerClientInstanceId(client) {
|
|
3417
|
-
return client.getInstanceId?.call(client) ?? getCodexAppServerClientInstanceId(client);
|
|
3418
|
-
}
|
|
3419
|
-
/** Codex rejects this exact code before enqueueing, including mutating requests. */
|
|
3420
|
-
function isCodexAppServerOverloadError(error) {
|
|
3421
|
-
return error instanceof CodexAppServerRpcError && error.code === -32001;
|
|
3422
|
-
}
|
|
3423
|
-
var CodexAppServerLocalRequestCancellationError = class extends Error {
|
|
3424
|
-
constructor(method, reason, mayHaveWritten, cause) {
|
|
3425
|
-
const detail = cause instanceof Error || typeof cause === "string" ? coerceErrorMessage(cause) : void 0;
|
|
3426
|
-
super(`${method} ${reason}${detail ? `: ${detail}` : ""}`, { cause });
|
|
3427
|
-
this.reason = reason;
|
|
3428
|
-
this.mayHaveWritten = mayHaveWritten;
|
|
3429
|
-
this.code = "CODEX_APP_SERVER_LOCAL_REQUEST_CANCELLED";
|
|
3430
|
-
this.name = "CodexAppServerLocalRequestCancellationError";
|
|
3431
|
-
}
|
|
3432
|
-
};
|
|
3433
3756
|
function isCodexAppServerRequestTimeoutError(error) {
|
|
3434
3757
|
return error instanceof Error && "code" in error && error.code === "CODEX_APP_SERVER_LOCAL_REQUEST_CANCELLED" && "reason" in error && error.reason === "timed out";
|
|
3435
3758
|
}
|
|
3436
|
-
function isCodexAppServerBrokenPipeError(error) {
|
|
3437
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3438
|
-
let current = error;
|
|
3439
|
-
while (current && typeof current === "object" && !seen.has(current)) {
|
|
3440
|
-
seen.add(current);
|
|
3441
|
-
if ("code" in current && current.code === "EPIPE") return true;
|
|
3442
|
-
current = "cause" in current ? current.cause : void 0;
|
|
3443
|
-
}
|
|
3444
|
-
return false;
|
|
3445
|
-
}
|
|
3446
3759
|
var CodexAppServerIndeterminateTransportError = class extends Error {
|
|
3447
3760
|
constructor(method, cause) {
|
|
3448
3761
|
super(`${method} transport failed after request write: ${cause.message}`, { cause });
|
|
@@ -3476,11 +3789,11 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3476
3789
|
this.pending = /* @__PURE__ */ new Map();
|
|
3477
3790
|
this.catalogResponses = /* @__PURE__ */ new WeakMap();
|
|
3478
3791
|
this.serverRequests = new CodexServerRequests((response) => this.writeMessage(response));
|
|
3479
|
-
this.
|
|
3480
|
-
this.pendingStartupWarnings = [];
|
|
3792
|
+
this.notificationDispatch = new CodexAppServerNotifications();
|
|
3481
3793
|
this.closeHandlers = /* @__PURE__ */ new Set();
|
|
3482
3794
|
this.nextId = 1;
|
|
3483
3795
|
this.initialized = false;
|
|
3796
|
+
this.initializeDiagnostics = createCodexInitializeDiagnostics();
|
|
3484
3797
|
this.modelCatalogRevision = 0;
|
|
3485
3798
|
this.closed = false;
|
|
3486
3799
|
this.transportExited = false;
|
|
@@ -3488,6 +3801,13 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3488
3801
|
this.stderrTail = "";
|
|
3489
3802
|
this.privateTransportSecrets = /* @__PURE__ */ new Set();
|
|
3490
3803
|
this.privateStderrPending = "";
|
|
3804
|
+
this.writeMessage = createCodexAppServerMessageWriter({
|
|
3805
|
+
getTransport: () => this.child,
|
|
3806
|
+
isClosed: () => this.closed,
|
|
3807
|
+
onNativeExecution: () => {
|
|
3808
|
+
this.nativeExecutionObserved = true;
|
|
3809
|
+
}
|
|
3810
|
+
});
|
|
3491
3811
|
this.child = child;
|
|
3492
3812
|
this.closeMessageReader = listenCodexAppServerLines(child.stdout, (line) => {
|
|
3493
3813
|
const route = this.catalogWorker.continuation ?? (this.decoder.hasPending ? void 0 : readCodexCatalogDecodeRoute(line));
|
|
@@ -3534,12 +3854,32 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3534
3854
|
}
|
|
3535
3855
|
async initialize() {
|
|
3536
3856
|
if (this.initialized) return;
|
|
3537
|
-
const
|
|
3538
|
-
this.
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3857
|
+
const observation = this.initializeDiagnostics.begin();
|
|
3858
|
+
this.initializeObservation = observation;
|
|
3859
|
+
let succeeded = false;
|
|
3860
|
+
try {
|
|
3861
|
+
const response = await this.request("initialize", buildCodexAppServerInitializeParams()).catch(async (error) => {
|
|
3862
|
+
if (this.closed && this.child.startupFailure) {
|
|
3863
|
+
await closeCodexAppServerTransportAndWait(this.child, { drainStdio: true });
|
|
3864
|
+
throw this.child.startupFailure.error ?? error;
|
|
3865
|
+
}
|
|
3866
|
+
throw error;
|
|
3867
|
+
});
|
|
3868
|
+
this.child.startupFailure?.complete();
|
|
3869
|
+
observation.boundary("version-validation");
|
|
3870
|
+
const serverVersion = assertSupportedCodexAppServerVersion(response);
|
|
3871
|
+
this.runtimeIdentity = buildCodexAppServerRuntimeIdentity(response, serverVersion);
|
|
3872
|
+
observation.boundary("initialized-notification");
|
|
3873
|
+
this.notify("initialized");
|
|
3874
|
+
this.initialized = true;
|
|
3875
|
+
observation.boundary("ready");
|
|
3876
|
+
succeeded = true;
|
|
3877
|
+
} finally {
|
|
3878
|
+
observation.finish(succeeded);
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
getInitializeDiagnostic(beforeClientClose = false) {
|
|
3882
|
+
return this.initializeDiagnostics.snapshot(this.closed, beforeClientClose);
|
|
3543
3883
|
}
|
|
3544
3884
|
getServerVersion() {
|
|
3545
3885
|
return this.runtimeIdentity?.serverVersion;
|
|
@@ -3572,6 +3912,9 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3572
3912
|
getTransportPid() {
|
|
3573
3913
|
return this.child.pid;
|
|
3574
3914
|
}
|
|
3915
|
+
getRegisteredTransportIdentity() {
|
|
3916
|
+
return getCodexAppServerRegisteredTransportIdentity(this.child);
|
|
3917
|
+
}
|
|
3575
3918
|
request(method, params, optionsInput) {
|
|
3576
3919
|
const options = optionsInput ?? {};
|
|
3577
3920
|
if (this.closed) return Promise.reject(this.closeError ?? /* @__PURE__ */ new Error("codex app-server client is closed"));
|
|
@@ -3661,27 +4004,15 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3661
4004
|
const remainingMs = deadline === void 0 ? void 0 : deadline - performance.now();
|
|
3662
4005
|
if (remainingMs !== void 0 && remainingMs <= 0) throw new CodexAppServerLocalRequestCancellationError(method, "timed out", false);
|
|
3663
4006
|
const delayMs = remainingMs === void 0 ? backoffMs : Math.min(backoffMs, remainingMs);
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
const abortListener = () => {
|
|
3671
|
-
cleanup();
|
|
3672
|
-
reject(new CodexAppServerLocalRequestCancellationError(method, "aborted", false, signal?.reason));
|
|
3673
|
-
};
|
|
3674
|
-
const cleanup = () => {
|
|
3675
|
-
clearTimeout(timer);
|
|
3676
|
-
signal?.removeEventListener("abort", abortListener);
|
|
3677
|
-
};
|
|
3678
|
-
signal?.addEventListener("abort", abortListener, { once: true });
|
|
3679
|
-
if (signal?.aborted) abortListener();
|
|
3680
|
-
});
|
|
4007
|
+
try {
|
|
4008
|
+
await sleepWithAbort(delayMs, signal, { ref: false });
|
|
4009
|
+
} catch (error) {
|
|
4010
|
+
if (signal?.aborted) throw new CodexAppServerLocalRequestCancellationError(method, "aborted", false, signal.reason);
|
|
4011
|
+
throw error;
|
|
4012
|
+
}
|
|
3681
4013
|
}
|
|
3682
4014
|
requestOnce(method, params, options, overloadAttemptOrdinal, onWriteStateChange, deadline, onResponse) {
|
|
3683
4015
|
if (this.closed) return Promise.reject(this.closeError ?? /* @__PURE__ */ new Error("codex app-server client is closed"));
|
|
3684
|
-
if (options.signal?.aborted) return Promise.reject(new CodexAppServerLocalRequestCancellationError(method, "aborted", false, options.signal?.reason));
|
|
3685
4016
|
const id = codexCatalogRequestId(method, params, this.nextId++, options.catalogPreview);
|
|
3686
4017
|
if (method === "account/login/start" || method === "account/logout" || method === "config/value/write" || method === "config/batchWrite") this.modelCatalogRevision += 1;
|
|
3687
4018
|
const message = {
|
|
@@ -3689,9 +4020,11 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3689
4020
|
method,
|
|
3690
4021
|
params
|
|
3691
4022
|
};
|
|
4023
|
+
const initialize = method === "initialize" ? this.initializeObservation?.attempt(overloadAttemptOrdinal) : void 0;
|
|
3692
4024
|
const attempt = createCodexRequestAttempt({
|
|
3693
4025
|
method,
|
|
3694
4026
|
retainWritten: onResponse !== void 0,
|
|
4027
|
+
observe: initialize?.observe,
|
|
3695
4028
|
...method === "thread/list" ? { diagnosticIdentity: {
|
|
3696
4029
|
clientInstanceId: this.instanceId,
|
|
3697
4030
|
rpcId: id
|
|
@@ -3700,11 +4033,12 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3700
4033
|
onWriteStateChange?.(mayHaveWritten);
|
|
3701
4034
|
onResponse();
|
|
3702
4035
|
} : void 0,
|
|
4036
|
+
onIngressRejected: options.onIngressRejected,
|
|
3703
4037
|
onSettled: () => {
|
|
3704
4038
|
if (this.pending.get(id) === attempt) this.pending.delete(id);
|
|
3705
4039
|
},
|
|
3706
4040
|
cancellationError: (reason, written, cause) => new CodexAppServerLocalRequestCancellationError(method, reason, written, cause),
|
|
3707
|
-
localError: (error, written) => written && !
|
|
4041
|
+
localError: (error, written) => written && !isCodexAppServerIndeterminateRequestCancellationError(error) && !isCodexAppServerIndeterminateTransportError(error) ? new CodexAppServerIndeterminateTransportError(method, error) : error
|
|
3708
4042
|
});
|
|
3709
4043
|
this.pending.set(id, attempt);
|
|
3710
4044
|
if (options.catalogPreview) this.catalogResponses.set(attempt, {
|
|
@@ -3715,16 +4049,16 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3715
4049
|
...options,
|
|
3716
4050
|
overloadAttemptOrdinal
|
|
3717
4051
|
}, deadline);
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
options.
|
|
3721
|
-
if (
|
|
4052
|
+
dispatchCodexRequestAttempt(attempt, options, () => {
|
|
4053
|
+
if (this.closed) throw this.closeError ?? /* @__PURE__ */ new Error("codex app-server client is closed");
|
|
4054
|
+
if (options.signal?.aborted) throw new CodexAppServerLocalRequestCancellationError(method, "aborted", false, options.signal.reason);
|
|
4055
|
+
if (deadline !== void 0 && performance.now() >= deadline) throw new CodexAppServerLocalRequestCancellationError(method, "timed out", false);
|
|
4056
|
+
}, () => {
|
|
4057
|
+
this.writeMessage(message, (error) => attempt.failLocal(error), () => {
|
|
3722
4058
|
attempt.markWritten();
|
|
3723
4059
|
onWriteStateChange?.(true);
|
|
3724
|
-
});
|
|
3725
|
-
}
|
|
3726
|
-
attempt.failLocal(toStringifiedError(error));
|
|
3727
|
-
}
|
|
4060
|
+
}, initialize?.writeResult);
|
|
4061
|
+
});
|
|
3728
4062
|
return result;
|
|
3729
4063
|
}
|
|
3730
4064
|
notify(method, params) {
|
|
@@ -3738,9 +4072,7 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3738
4072
|
return () => this.serverRequests.handlers.delete(handler);
|
|
3739
4073
|
}
|
|
3740
4074
|
addNotificationHandler(handler) {
|
|
3741
|
-
this.
|
|
3742
|
-
for (const notification of this.pendingStartupWarnings.splice(0)) this.handleNotification(notification);
|
|
3743
|
-
return () => this.notificationHandlers.delete(handler);
|
|
4075
|
+
return this.notificationDispatch.addHandler(handler);
|
|
3744
4076
|
}
|
|
3745
4077
|
addCloseHandler(handler) {
|
|
3746
4078
|
this.closeHandlers.add(handler);
|
|
@@ -3785,25 +4117,6 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3785
4117
|
});
|
|
3786
4118
|
}
|
|
3787
4119
|
}
|
|
3788
|
-
writeMessage(message, onError, beforeWrite) {
|
|
3789
|
-
if (this.closed) return;
|
|
3790
|
-
const id = "id" in message ? message.id : void 0;
|
|
3791
|
-
const method = "method" in message ? message.method : void 0;
|
|
3792
|
-
const frame = stringifyCodexAppServerMessage(message);
|
|
3793
|
-
if (this.child.maxFrameBytes && Buffer.byteLength(frame) > this.child.maxFrameBytes) throw new Error("Codex request exceeds the transport frame limit; reduce attached images or context.");
|
|
3794
|
-
beforeWrite?.();
|
|
3795
|
-
if (method === "command/exec") this.nativeExecutionObserved = true;
|
|
3796
|
-
this.child.stdin.write(`${frame}\n`, (error) => {
|
|
3797
|
-
if (error) {
|
|
3798
|
-
embeddedAgentLog.warn("codex app-server write failed", {
|
|
3799
|
-
error,
|
|
3800
|
-
id,
|
|
3801
|
-
method
|
|
3802
|
-
});
|
|
3803
|
-
onError?.(error);
|
|
3804
|
-
}
|
|
3805
|
-
});
|
|
3806
|
-
}
|
|
3807
4120
|
/** Protect private loopback route capabilities before native diagnostics can mention them. */
|
|
3808
4121
|
protectPrivateTransportSecret(secret) {
|
|
3809
4122
|
if (!/^[A-Za-z0-9_-]{43}$/.test(secret) || this.privateTransportSecrets.size >= 8) {
|
|
@@ -3859,24 +4172,14 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3859
4172
|
if (notification.method === "serverRequest/resolved") this.serverRequests.resolve(params);
|
|
3860
4173
|
if (notification.method === "item/commandExecution/outputDelta" || notification.method === "item/commandExecution/terminalInteraction" || isJsonObject(params) && (isJsonObject(params.item) && params.item.type === "commandExecution" || isJsonObject(params.turn) && Array.isArray(params.turn.items) && params.turn.items.some((item) => isJsonObject(item) && item.type === "commandExecution"))) this.nativeExecutionObserved = true;
|
|
3861
4174
|
if (notification.method === "account/updated") this.modelCatalogRevision += 1;
|
|
3862
|
-
|
|
3863
|
-
if (this.pendingStartupWarnings.length === CODEX_APP_SERVER_PENDING_STARTUP_WARNINGS_MAX) this.pendingStartupWarnings.shift();
|
|
3864
|
-
this.pendingStartupWarnings.push(notification);
|
|
3865
|
-
return;
|
|
3866
|
-
}
|
|
3867
|
-
for (const handler of this.notificationHandlers) try {
|
|
3868
|
-
Promise.resolve(handler(notification)).catch((error) => {
|
|
3869
|
-
embeddedAgentLog.warn("codex app-server notification handler failed", { error });
|
|
3870
|
-
});
|
|
3871
|
-
} catch (error) {
|
|
3872
|
-
embeddedAgentLog.warn("codex app-server notification handler failed", { error });
|
|
3873
|
-
}
|
|
4175
|
+
this.notificationDispatch.dispatch(notification);
|
|
3874
4176
|
}
|
|
3875
4177
|
closeWithError(error) {
|
|
3876
|
-
if (this.markClosed(error)) closeCodexAppServerTransport(this.child);
|
|
4178
|
+
if (this.markClosed(error)) closeCodexAppServerTransport(this.child, { drainStdio: !this.initialized && this.child.startupFailure !== void 0 });
|
|
3877
4179
|
}
|
|
3878
4180
|
markClosed(error) {
|
|
3879
4181
|
if (this.closed) return false;
|
|
4182
|
+
this.initializeDiagnostics.closing();
|
|
3880
4183
|
this.closed = true;
|
|
3881
4184
|
closeCodexCatalogClientSource(this);
|
|
3882
4185
|
this.closeError = error;
|
|
@@ -3900,31 +4203,6 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
3900
4203
|
}
|
|
3901
4204
|
}
|
|
3902
4205
|
};
|
|
3903
|
-
var CodexAppServerVersionError = class extends Error {
|
|
3904
|
-
constructor(detectedVersion) {
|
|
3905
|
-
const detected = detectedVersion ? `detected ${detectedVersion}` : "OpenClaw could not determine the running Codex version";
|
|
3906
|
-
super(`Codex app-server ${MIN_SUPPORTED_CODEX_APP_SERVER_VERSION} or newer is required, but ${detected}. Update the configured Codex app-server binary, or remove custom command overrides to use the managed binary.`);
|
|
3907
|
-
this.name = "CodexAppServerVersionError";
|
|
3908
|
-
this.detectedVersion = detectedVersion;
|
|
3909
|
-
}
|
|
3910
|
-
};
|
|
3911
|
-
function assertSupportedCodexAppServerVersion(response) {
|
|
3912
|
-
const detectedVersion = readCodexVersionFromUserAgent(response.userAgent);
|
|
3913
|
-
if (!detectedVersion) throw new CodexAppServerVersionError(detectedVersion);
|
|
3914
|
-
const detected = parse(detectedVersion);
|
|
3915
|
-
if (!detected || detected.compare("0.149.0") < 0) throw new CodexAppServerVersionError(detectedVersion);
|
|
3916
|
-
if (detected.compare("0.158.0") > 0) embeddedAgentLog.warn("codex app-server is newer than OpenClaw's managed runtime; continuing with normal startup validation", {
|
|
3917
|
-
detectedVersion,
|
|
3918
|
-
validatedVersion: CODEX_APP_SERVER_VERSION
|
|
3919
|
-
});
|
|
3920
|
-
return detectedVersion;
|
|
3921
|
-
}
|
|
3922
|
-
function isUnsupportedCodexAppServerVersionError(error) {
|
|
3923
|
-
return error instanceof CodexAppServerVersionError;
|
|
3924
|
-
}
|
|
3925
|
-
function readCodexVersionFromUserAgent(userAgent) {
|
|
3926
|
-
return (userAgent?.match(/^[^/]+\/(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?:[\s(]|$)/))?.[1];
|
|
3927
|
-
}
|
|
3928
4206
|
const CODEX_APP_SERVER_APPROVAL_REQUEST_METHODS = /* @__PURE__ */ new Set([
|
|
3929
4207
|
"item/commandExecution/requestApproval",
|
|
3930
4208
|
"item/fileChange/requestApproval",
|
|
@@ -3934,4 +4212,4 @@ function isCodexAppServerApprovalRequest(method) {
|
|
|
3934
4212
|
return CODEX_APP_SERVER_APPROVAL_REQUEST_METHODS.has(method);
|
|
3935
4213
|
}
|
|
3936
4214
|
//#endregion
|
|
3937
|
-
export {
|
|
4215
|
+
export { resolveTerminalDynamicToolBatchAction as A, getCodexAppServerClientInstanceId as B, resolveCodexThreadRolloutPath as C, isDynamicToolTerminalDiagnosticEvent as D, hasPendingDynamicToolTerminalDiagnostic as E, createFailedDynamicToolResponse as F, resolveCodexAppServerClientInstanceId as H, failedToolResult as I, readCodexAppServerWarningMessage as L, toCodexDynamicToolProgressResponse as M, toCodexDynamicToolProtocolResponse as N, isMatchingDynamicToolTerminalDiagnostic as O, resolveCodexToolAbortTerminalReason as P, isUnsupportedCodexAppServerVersionError as R, readSupervisionResponseThreadId as S, handleDynamicToolCallWithTimeout as T, isCodexAppServerBrokenPipeError as V, assertCodexTurnStartResponse as _, isCodexAppServerIndeterminateRequestCancellationError as a, readCodexErrorNotification as b, isCodexAppServerRequestTimeoutError as c, assertCodexModelListResponse as d, assertCodexPassiveTurnItems as f, assertCodexThreadStartResponse as g, assertCodexThreadResumeResponse as h, isCodexAppServerConnectionClosedError as i, shouldReleaseTurnAfterTerminalDynamicTool as j, resolveDynamicToolCallTimeoutMs as k, CodexServerRequestResolvedError as l, assertCodexThreadForkResponse as m, client_exports as n, isCodexAppServerIndeterminateTransportError as o, assertCodexThreadAcceptsDirectInput as p, isCodexAppServerApprovalRequest as r, isCodexAppServerPrewriteRequestCancellationError as s, CodexAppServerClient as t, CodexThreadDirectInputError as u, assertExactSupervisionModelSelection as v, createCodexElicitationResponse as w, readCodexTurnCompletedNotification as x, readCodexDynamicToolCallParams as y, CODEX_APP_SERVER_OPT_OUT_NOTIFICATION_METHODS as z };
|