@openclaw/codex 2026.10.5-beta.4 → 2026.10.10-beta.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/README.md +10 -3
- package/dist/.setup/{account-usage-runtime-CoVpNIlD.mjs → account-usage-runtime-BVO-lpvn.mjs} +15 -9
- package/dist/.setup/{app-server-policy-D_zv8J7V.mjs → app-server-policy-Cog6mm2i.mjs} +1 -1
- package/dist/.setup/{apply-BXDMd05l.mjs → apply-tJl5mopa.mjs} +11 -11
- package/dist/.setup/{attempt-client-cleanup-zNuNTKVr.mjs → attempt-client-cleanup-DMJWXGxM.mjs} +14 -8
- package/dist/.setup/attempt-terminal-sZutF0WY.mjs +1 -0
- package/dist/.setup/{attempt-workspace-context-CcwP3DA3.mjs → attempt-workspace-context-GYPLawX6.mjs} +2 -2
- package/dist/.setup/{auth-binding-BaxlhaNx.mjs → auth-binding-830RLAJW.mjs} +2 -2
- package/dist/.setup/{auth-cache-key-f8ODJ_OX.mjs → auth-cache-key-BW1YeaIk.mjs} +92 -80
- package/dist/.setup/{auth-profile-CgHQ8Vot.mjs → auth-profile-auwzSwwy.mjs} +14 -8
- package/dist/.setup/{auth-profile-health-oHizqgye.mjs → auth-profile-health-BVPZU9I8.mjs} +15 -8
- package/dist/.setup/{auth-profile-selection-hr8ocLtz.mjs → auth-profile-selection-Bp5PDk3W.mjs} +24 -7
- package/dist/.setup/{binding-connection-B7HAAZSI.mjs → binding-connection-GTgUj9pi.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-DAXn7iFl.mjs → binding-connection.runtime-RcWR3vQu.mjs} +4 -3
- package/dist/.setup/{bounded-turn-DfIJtRlv.mjs → bounded-turn-BQkmyyjB.mjs} +18 -22
- package/dist/.setup/{bounded-turn-isolation-BfDAo-qZ.mjs → bounded-turn-isolation-D8CDrAVX.mjs} +3 -3
- package/dist/.setup/{build-state-Ds14X10-.mjs → build-state-CjLCC0wm.mjs} +1 -1
- package/dist/.setup/{capabilities-DbOzOglY.mjs → capabilities-DAS-JX1z.mjs} +1 -1
- package/dist/.setup/{client-D93nbdB8.mjs → client--P8jwXvA.mjs} +47 -317
- package/dist/.setup/{client-catalog-response-CuVLp4I0.mjs → client-catalog-response-CsDxVVOZ.mjs} +2 -2
- package/dist/.setup/client-initialize-CjgZcX61.mjs +165 -0
- package/dist/.setup/{command-dispatch-DxdH5a9-.mjs → command-dispatch-DqaVBeR3.mjs} +3 -3
- package/dist/.setup/{command-formatters-xW9KpoSZ.mjs → command-formatters-B_7-QZ1c.mjs} +2 -2
- package/dist/.setup/{command-handlers-fiYvYYq0.mjs → command-handlers-i6mEjvfo.mjs} +539 -406
- package/dist/.setup/command-rpc-B65jEc0r.mjs +296 -0
- package/dist/.setup/compact-AO2H4RJe.mjs +823 -0
- package/dist/.setup/{computer-use-DL2v3Kxq.mjs → computer-use-YUnu0JVx.mjs} +21 -68
- package/dist/.setup/{config-C1YVVLEA.mjs → config-BfrAlTMT.mjs} +3 -3
- package/dist/.setup/{config-options-DDzeNQ8m.mjs → config-options-DMFZkd3X.mjs} +1 -1
- package/dist/.setup/{config-runtime-DWzK-k0n.mjs → config-runtime-BZRizyuG.mjs} +2 -2
- package/dist/.setup/{context-engine-projection-ps-yn_ci.mjs → context-engine-projection-PIeLSnR-.mjs} +16 -30
- package/dist/.setup/{conversation-binding-BieJZRRV.mjs → conversation-binding-CfnUR-IM.mjs} +228 -116
- package/dist/.setup/{conversation-binding-data-UgLuTSQT.mjs → conversation-binding-data-khgW0n-o.mjs} +4 -2
- package/dist/.setup/{conversation-control-GXM3unE4.mjs → conversation-control-B2EpVZEb.mjs} +53 -23
- package/dist/.setup/{cyber-failover-D4dgNfFf.mjs → cyber-failover-CqEZoQsj.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-ljgGGL0s.mjs → cyber-failover-notice-poL3Advd.mjs} +1 -1
- package/dist/.setup/{doctor-start-options-JjTAl-q_.mjs → doctor-start-options-8uIBXIzR.mjs} +8 -5
- package/dist/.setup/{dynamic-tool-build-DcaPmBlE.mjs → dynamic-tool-build-DOub3CB5.mjs} +208 -218
- package/dist/.setup/{dynamic-tools-CnQFnNKH.mjs → dynamic-tools-Us5mvq_N.mjs} +344 -118
- package/dist/.setup/{effective-mcp-catalog-B5HKFZNK.mjs → effective-mcp-catalog-DfUUoeeM.mjs} +11 -9
- package/dist/.setup/{ephemeral-turn-De3qb8EQ.mjs → ephemeral-turn-B2z0RIeF.mjs} +5 -4
- package/dist/.setup/{event-projector-assistant-message-CLMKN4x-.mjs → event-projector-assistant-message-ChOAY7rW.mjs} +16 -11
- package/dist/.setup/{event-projector-usage-BpKfdoTm.mjs → event-projector-usage-CBY0Hkga.mjs} +2 -2
- package/dist/.setup/{event-projector-values-CLvG1Hil.mjs → event-projector-values-yf4us9Pf.mjs} +1 -1
- package/dist/.setup/experimental-features-uGnVDtp-.mjs +19 -0
- package/dist/.setup/inference-context-HRw3PDwn.mjs +209 -0
- package/dist/.setup/{inference-dispatch-CO6tTs4q.mjs → inference-dispatch-C2zVSnrr.mjs} +2 -2
- package/dist/.setup/{inference-metadata-DCvcG_N_.mjs → inference-metadata-CYFWLHVk.mjs} +3 -1
- package/dist/.setup/{inference-proxy-BDWV0djM.mjs → inference-proxy-CiLbHMLf.mjs} +8 -8
- package/dist/.setup/installed-probe-lVC1X5ve.mjs +185 -0
- package/dist/.setup/{isolated-completion-BPJdvk5F.mjs → isolated-completion-CybgD6uU.mjs} +7 -7
- package/dist/.setup/managed-binary-DbKvGXKl.mjs +395 -0
- package/dist/.setup/{mcp-app-session-preparation-Dz2GOwyE.mjs → mcp-app-session-preparation-zUgpDLWR.mjs} +18 -14
- package/dist/.setup/{model-catalog-ZNwltCKl.mjs → model-catalog-CWY3wo0B.mjs} +28 -17
- package/dist/.setup/{models-BHpbAuz8.mjs → models-CmOBxsKF.mjs} +3 -3
- package/dist/.setup/{native-auth-esN5MdIv.mjs → native-auth-DpZIaY8N.mjs} +7 -4
- package/dist/.setup/native-execution-policy-D09tLP-u.mjs +152 -0
- package/dist/.setup/{native-hook-relay-wq7jrNLk.mjs → native-hook-relay-CocOW9YS.mjs} +45 -10
- package/dist/.setup/{native-mcp-app-DX3nyTtc.mjs → native-mcp-app-DrQeLxXj.mjs} +5 -5
- package/dist/.setup/{native-skill-isolation-DSBeF-Yy.mjs → native-skill-isolation-DL4-PQa4.mjs} +7 -7
- package/dist/.setup/{native-subagent-monitor-DOLEIf9r.mjs → native-subagent-monitor-C3CIIaZG.mjs} +485 -239
- package/dist/.setup/{native-subagent-pending-assignments-DmVhedNs.mjs → native-subagent-pending-assignments-CTinVtjo.mjs} +1 -1
- package/dist/.setup/{native-task-assignments-DimsQ9Qa.mjs → native-task-assignments-YJopbaVO.mjs} +9 -5
- package/dist/.setup/{node-cli-sessions-CzKg2nGq.mjs → node-cli-sessions-BuJnBnEq.mjs} +7 -4
- package/dist/.setup/{node-exec-server.runtime-BWkULhBM.mjs → node-exec-server.runtime-CP7RC1Nd.mjs} +3 -3
- package/dist/.setup/{plan-41-YOBMq.mjs → plan-Bqj6VQvQ.mjs} +7 -20
- package/dist/.setup/{plugin-activation-D7WkJMvU.mjs → plugin-activation-CXPWe-hl.mjs} +4 -4
- package/dist/.setup/{plugin-app-cache-key-Bg9DbDI6.mjs → plugin-app-cache-key-DRb-niJc.mjs} +17 -55
- package/dist/.setup/{plugin-approval-roundtrip-CD88q3yx.mjs → plugin-approval-roundtrip-CGEiG7hG.mjs} +1 -1
- package/dist/.setup/{plugin-inventory-CYgdo14P.mjs → plugin-inventory-DE9wcaeH.mjs} +2 -2
- package/dist/.setup/{plugin-metadata-cache-Bi8TAPwX.mjs → plugin-metadata-cache-BqC-a6Fb.mjs} +2 -15
- package/dist/.setup/{project-doc-thread-config-BVcvnps8.mjs → project-doc-thread-config-B0UI3f1D.mjs} +6 -6
- package/dist/.setup/protocol-CaPAVwe9.mjs +12 -0
- package/dist/.setup/{provider-LWKll6dV.mjs → provider-C_1fMsyD.mjs} +4 -4
- package/dist/.setup/{provider-capabilities-Dn2WwH4P.mjs → provider-capabilities-C7pYYpvh.mjs} +1 -1
- package/dist/.setup/{rate-limits-CI8pTPqL.mjs → rate-limits-BpfURnuy.mjs} +1 -1
- package/dist/.setup/{request-Bo0kKABI.mjs → request-C6U8q2uz.mjs} +132 -136
- package/dist/.setup/{responses-oauth-twnuTaAa.mjs → responses-oauth-CCV7aVYF.mjs} +6 -6
- package/dist/.setup/{rpc-error-C98SHchT.mjs → rpc-error-DemqqaxE.mjs} +7 -3
- package/dist/.setup/{run-attempt-ClU8MxhZ.mjs → run-attempt-BhuXanLv.mjs} +595 -426
- package/dist/.setup/{run-attempt-lifecycle-KN4oh-7O.mjs → run-attempt-lifecycle-DN-ATDp9.mjs} +1 -1
- package/dist/.setup/{runtime-artifact-C13pR7tD.mjs → runtime-artifact-CmLWeyJB.mjs} +3 -3
- package/dist/.setup/{runtime-artifact-connection-jS5DeCok.mjs → runtime-artifact-connection-DpWlZ02e.mjs} +3 -3
- package/dist/.setup/{sandbox-guard-DIImwCy1.mjs → sandbox-guard-DneAfNye.mjs} +70 -30
- package/dist/.setup/{session-binding-JEHNMPsr.mjs → session-binding-BgsWcbdY.mjs} +25 -23
- package/dist/.setup/{session-binding-record-DU_0biMD.mjs → session-binding-record-C_THntMe.mjs} +27 -12
- package/dist/.setup/{session-binding-record-codec-BpH8u_G9.mjs → session-binding-record-codec-DvmOI7g_.mjs} +1 -0
- package/dist/.setup/{session-binding-sidecars-DD-enC8w.mjs → session-binding-sidecars-BNSS6WL4.mjs} +55 -63
- package/dist/.setup/session-cancellation-DCN1FcBZ.mjs +43 -0
- package/dist/.setup/{session-catalog-adoption-Ca3OYGYM.mjs → session-catalog-adoption-ppsLlVLB.mjs} +24 -38
- package/dist/.setup/{session-catalog-archive-Bv6gV7x9.mjs → session-catalog-archive-CqLRHJ6z.mjs} +11 -13
- package/dist/.setup/{session-catalog-events-kR2Ot6nX.mjs → session-catalog-events-CEi6SuLQ.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-order-CTfoefow.mjs → session-catalog-index-order-0Zqng2u8.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-CrnfVEnT.mjs → session-catalog-index-qt4UWBua.mjs} +96 -271
- package/dist/.setup/{session-catalog-limits-BynIoOYm.mjs → session-catalog-limits-Dc6E0BZz.mjs} +1 -1
- package/dist/.setup/{session-catalog-list-request-D4MYNgDB.mjs → session-catalog-list-request-CAjoWjaH.mjs} +3 -4
- package/dist/.setup/{session-catalog-native-projection-CWqCU1I_.mjs → session-catalog-native-projection-BqBYi6kV.mjs} +5 -5
- package/dist/.setup/{session-catalog-node-adoption-BdP9Zjqo.mjs → session-catalog-node-adoption-e9v8mGgx.mjs} +5 -5
- package/dist/.setup/{session-catalog-node-continue-CNJibO4_.mjs → session-catalog-node-continue-H7nrzcUD.mjs} +5 -5
- package/dist/.setup/{session-catalog-node-lookup-BH_DBGa9.mjs → session-catalog-node-lookup-BrZfDkA8.mjs} +2 -2
- package/dist/.setup/{session-catalog-parsing-DkeoVn60.mjs → session-catalog-parsing-V6jyFg9g.mjs} +2 -2
- package/dist/.setup/{session-catalog-projection-BzHiV818.mjs → session-catalog-projection-CNyhjZze.mjs} +8 -7
- package/dist/.setup/{session-catalog-provenance-CmsOE5mh.mjs → session-catalog-provenance-Dg9s12z-.mjs} +50 -30
- package/dist/.setup/{session-catalog-source-DGuRdGvM.mjs → session-catalog-source-z_mNyQdX.mjs} +2 -6
- package/dist/.setup/{session-cli-GwU0izn-.mjs → session-cli-CBGKiqdv.mjs} +1 -1
- package/dist/.setup/{session-history-BO6i_pfk.mjs → session-history-7W0cgTXF.mjs} +11 -9
- package/dist/.setup/{session-history-import-CaO8s6ta.mjs → session-history-import-BwPKwcNi.mjs} +4 -4
- package/dist/.setup/{session-initialization-Bi_2DKhc.mjs → session-initialization-Dn3vveGv.mjs} +2 -2
- package/dist/.setup/{session-retirement-B3U5hpGJ.mjs → session-retirement-RZStisKb.mjs} +8 -8
- package/dist/.setup/{session-history.worker-DJQfek5p.mjs → settled-turn-evidence--tRW6fSm.mjs} +2 -18
- package/dist/.setup/{settled-turn-finalizer-CYCVpTv2.mjs → settled-turn-finalizer-gioXygEX.mjs} +8 -8
- package/dist/.setup/{shared-client-BCx1wbyA.mjs → shared-client-CkyTrNB8.mjs} +380 -557
- package/dist/.setup/side-question-DHPWKgO3.mjs +998 -0
- package/dist/.setup/{source-DipMO9hL.mjs → source-63MLSmLJ.mjs} +5 -5
- package/dist/.setup/{thread-archive-guard-LKdwQKyr.mjs → thread-archive-guard-BWjSsA92.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-run-C_aYiYqk.mjs → thread-lifecycle-run-zCXYFW8W.mjs} +172 -75
- package/dist/.setup/{thread-model-selection-DcVebr8N.mjs → thread-model-selection-DxposL4X.mjs} +9 -9
- package/dist/.setup/{thread-ownership-BoUd0i6L.mjs → thread-ownership-Bmk5a2Gu.mjs} +7 -7
- package/dist/.setup/{thread-policy-B3wBRNph.mjs → thread-policy-DYtvZ5Ay.mjs} +6 -6
- package/dist/.setup/{thread-requests-BgzJwJtS.mjs → thread-requests-BjawdIVV.mjs} +14 -14
- package/dist/.setup/{thread-resume-D-3bsr1j.mjs → thread-resume-vBShG3-o.mjs} +6 -6
- package/dist/.setup/{transcript-history-projection-DfKcoZCB.mjs → transcript-history-projection-i-FVpyha.mjs} +1 -1
- package/dist/.setup/{transcript-mirror-Bee2o6jj.mjs → transcript-mirror-CEQJZlF3.mjs} +6 -9
- package/dist/.setup/{transport-stdio-CRWTkKOn.mjs → transport-stdio-Bq160Dhv.mjs} +63 -64
- package/dist/.setup/{transport-websocket-DIyPfkHo.mjs → transport-websocket-0YqiI_MH.mjs} +1 -1
- package/dist/.setup/{turn-router-DBVMToGo.mjs → turn-router-BGj67FMK.mjs} +2 -2
- package/dist/.setup/{upstream-session-fork-p5fwKi7w.mjs → upstream-session-fork-CWKjpdtW.mjs} +46 -219
- package/dist/.setup/{usage-C2Kq7oej.mjs → usage-AhrLFxZP.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-BQX8RHAd.mjs → usage-limit-error-BdNbGJC3.mjs} +4 -4
- package/dist/.setup/{web-search-item-CvokaZOo.mjs → web-search-item-DHVuNSqk.mjs} +1 -1
- package/dist/.setup/{web-search-provider.runtime-D89djc7e.mjs → web-search-provider.runtime-Yk6lnJBG.mjs} +3 -3
- package/dist/.setup/{workspace-write-sandbox-probe-BDWO2Qkh.mjs → workspace-write-sandbox-probe-DJxOXcF3.mjs} +2 -2
- package/dist/api.js +7 -28
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-version-api.js +25 -0
- package/dist/doctor-contract-api.js +5 -5
- package/dist/harness.js +59 -36
- package/dist/index.js +259 -295
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -2
- package/dist/native-session-binding-api.js +1 -2
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-entrypoint.js +12 -0
- package/dist/session-history-worker-runtime.js +7 -18
- package/dist/session-history.worker.js +18 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +6 -6
- package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +0 -2
- package/dist/.setup/command-rpc-HIvsy3wS.mjs +0 -247
- package/dist/.setup/compact-ClZ7Ar7L.mjs +0 -808
- package/dist/.setup/inference-context-DNlGwzwy.mjs +0 -91
- package/dist/.setup/managed-binary-BtIjV7yN.mjs +0 -175
- package/dist/.setup/native-execution-policy-MXEe7PB3.mjs +0 -75
- package/dist/.setup/protocol-CANUwXJ3.mjs +0 -17
- package/dist/.setup/side-question-Bz2UQW0l.mjs +0 -826
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as retainSharedCodexAppServerClientByInstanceId } from "./auth-cache-key-BW1YeaIk.mjs";
|
|
2
2
|
import { t as withCodexAppServerThreadMutation } from "./thread-ownership-queue-CeyYScUC.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { f as unsubscribeCodexThreadBestEffort, o as closeCodexStartupClientBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-
|
|
5
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
3
|
+
import { B as retainCodexAppServerLiveThread, N as isCodexAppServerLiveThreadClaimed, z as releaseCodexAppServerLiveThread } from "./shared-client-CkyTrNB8.mjs";
|
|
4
|
+
import { f as unsubscribeCodexThreadBestEffort, o as closeCodexStartupClientBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-DMJWXGxM.mjs";
|
|
5
|
+
import { t as __exportAll } from "./session-binding-sidecars-BNSS6WL4.mjs";
|
|
6
6
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
7
7
|
import { runWithAsyncWorkResources } from "openclaw/plugin-sdk/agent-harness-tool-runtime";
|
|
8
8
|
//#region extensions/codex/src/app-server/thread-ownership.ts
|
|
@@ -86,7 +86,7 @@ async function releaseCodexAppServerBindingSubscription(binding, options = {}) {
|
|
|
86
86
|
if (await releaseCodexAppServerLiveThread(clientLease.client, binding.threadId, options.assertCurrent, options.withCurrent)) return;
|
|
87
87
|
options.assertCurrent?.();
|
|
88
88
|
if (isCodexAppServerLiveThreadClaimed(clientLease.client, binding.threadId)) throw new Error(`Codex thread ${binding.threadId} has an active run; stop it before changing its owner.`);
|
|
89
|
-
if (!options.allowUntracked) return;
|
|
89
|
+
if (!options.allowUntracked && binding.conversationIncognito !== true) return;
|
|
90
90
|
if (!await unsubscribeCodexThreadBestEffort(clientLease.client, {
|
|
91
91
|
threadId: binding.threadId,
|
|
92
92
|
timeoutMs: 5e3,
|
|
@@ -103,10 +103,10 @@ async function releaseCodexAppServerBindingSubscription(binding, options = {}) {
|
|
|
103
103
|
/** Clears and releases one exact conversation generation without touching its replacement. */
|
|
104
104
|
async function retireCodexConversationThreadBinding(params) {
|
|
105
105
|
const assertCurrent = params.assertCurrent;
|
|
106
|
-
const expected = params.bindingStore.
|
|
106
|
+
const expected = await params.bindingStore.readAsync(params.identity);
|
|
107
107
|
if (!expected || params.expectedThreadId && expected.threadId !== params.expectedThreadId) return false;
|
|
108
108
|
return await withCodexAppServerThreadMutation(expected.threadId, () => params.bindingStore.withLease(params.identity, async () => {
|
|
109
|
-
const current = params.bindingStore.
|
|
109
|
+
const current = await params.bindingStore.readAsync(params.identity);
|
|
110
110
|
if (!current || !isSameCodexAppServerThreadOwner(current, expected) || params.expectedStartId && current?.conversationStartId !== params.expectedStartId) return false;
|
|
111
111
|
assertCurrent?.();
|
|
112
112
|
await releaseCodexAppServerBindingSubscription(current, {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { i as CodexAppServerScopedRequestRejectedError, o as isCodexAppServerOverloadError } from "./rpc-error-
|
|
2
|
-
import { n as requestCodexAppServerClientJson } from "./request-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { i as CodexAppServerScopedRequestRejectedError, o as isCodexAppServerOverloadError } from "./rpc-error-DemqqaxE.mjs";
|
|
2
|
+
import { n as requestCodexAppServerClientJson } from "./request-C6U8q2uz.mjs";
|
|
3
|
+
import { g as CodexAdoptedThreadActiveError } from "./shared-client-CkyTrNB8.mjs";
|
|
4
|
+
import { f as assertCodexThreadAcceptsDirectInput, o as isCodexAppServerPrewriteRequestCancellationError } from "./client--P8jwXvA.mjs";
|
|
5
5
|
import { AgentHarnessPreflightError, embeddedAgentLog, formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/thread-policy.ts
|
|
7
7
|
/** A refusal, not a failed native write: the ephemeral conversation must stay alive. */
|
|
8
8
|
var CodexIncognitoPolicyChangeError = class extends AgentHarnessPreflightError {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(
|
|
9
|
+
constructor(policy = "generic instructions") {
|
|
10
|
+
super(`Codex cannot change ${policy} in a live incognito conversation. No turn was sent and the conversation is preserved. Restore the previous settings to continue it, or start a new incognito conversation for the changed policy.`);
|
|
11
11
|
this.name = "CodexIncognitoPolicyChangeError";
|
|
12
12
|
}
|
|
13
13
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as isJsonObject } from "./protocol-CaPAVwe9.mjs";
|
|
2
2
|
import { t as appendCodexGitConfigParameters } from "./config-utils-DN_YT7dE.mjs";
|
|
3
|
-
import { d as readCodexEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-
|
|
4
|
-
import { a as isCodexResponsesOAuthRun } from "./responses-oauth-
|
|
5
|
-
import { d as mergeCodexThreadConfigs, t as buildCodexProjectDocThreadConfig } from "./project-doc-thread-config-
|
|
6
|
-
import { o as hashCodexAppServerBindingFingerprint } from "./session-binding-
|
|
7
|
-
import { n as resolveCodexAppServerModelProvider, r as resolveCodexAppServerRequestModelSelection, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-model-selection-
|
|
3
|
+
import { d as readCodexEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-DMFZkd3X.mjs";
|
|
4
|
+
import { a as isCodexResponsesOAuthRun } from "./responses-oauth-CCV7aVYF.mjs";
|
|
5
|
+
import { d as mergeCodexThreadConfigs, t as buildCodexProjectDocThreadConfig } from "./project-doc-thread-config-B0UI3f1D.mjs";
|
|
6
|
+
import { o as hashCodexAppServerBindingFingerprint } from "./session-binding-BgsWcbdY.mjs";
|
|
7
|
+
import { n as resolveCodexAppServerModelProvider, r as resolveCodexAppServerRequestModelSelection, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-model-selection-DxposL4X.mjs";
|
|
8
8
|
import { normalizeOptionalString, normalizeUniqueStringEntries, normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
-
import * as crypto$1 from "node:crypto";
|
|
10
|
-
import crypto from "node:crypto";
|
|
9
|
+
import crypto, * as crypto$1 from "node:crypto";
|
|
11
10
|
import path from "node:path";
|
|
12
11
|
import { isIncognitoSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
|
|
13
12
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
@@ -30,6 +29,7 @@ const CODEX_NATIVE_TOOLS = /* @__PURE__ */ new Map([
|
|
|
30
29
|
["process", "shell"],
|
|
31
30
|
["update_plan", "always"],
|
|
32
31
|
["tool_call", "always"],
|
|
32
|
+
["dispatch_action", "always"],
|
|
33
33
|
["tool_describe", "always"],
|
|
34
34
|
["tool_search", "always"],
|
|
35
35
|
["get_goal", "goal"],
|
|
@@ -520,13 +520,13 @@ function buildCodexThreadConfiguration(params, options) {
|
|
|
520
520
|
}), options.refreshableInstructions)
|
|
521
521
|
};
|
|
522
522
|
}
|
|
523
|
-
function buildThreadStartParams(params, options) {
|
|
524
|
-
const resolvedModelProvider = resolveCodexAppServerModelProvider({
|
|
523
|
+
async function buildThreadStartParams(params, options) {
|
|
524
|
+
const resolvedModelProvider = await resolveCodexAppServerModelProvider({
|
|
525
525
|
...params,
|
|
526
526
|
homeScope: options.appServer.start.homeScope
|
|
527
527
|
});
|
|
528
528
|
return {
|
|
529
|
-
...resolveCodexAppServerRequestModelSelection({
|
|
529
|
+
...await resolveCodexAppServerRequestModelSelection({
|
|
530
530
|
...params,
|
|
531
531
|
homeScope: options.appServer.start.homeScope,
|
|
532
532
|
model: options.model ?? params.modelId,
|
|
@@ -543,12 +543,12 @@ function buildThreadStartParams(params, options) {
|
|
|
543
543
|
...isIncognitoSessionKey(params.sessionKey) ? { ephemeral: true } : {}
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
|
-
function buildThreadResumeParams(params, options) {
|
|
547
|
-
const modelSelection = options.preserveNativeModel ? void 0 : resolveCodexAppServerRequestModelSelection({
|
|
546
|
+
async function buildThreadResumeParams(params, options) {
|
|
547
|
+
const modelSelection = options.preserveNativeModel ? void 0 : await resolveCodexAppServerRequestModelSelection({
|
|
548
548
|
...params,
|
|
549
549
|
homeScope: options.appServer.start.homeScope,
|
|
550
550
|
model: options.model ?? params.modelId,
|
|
551
|
-
modelProvider: options.modelProvider ?? resolveCodexAppServerModelProvider({
|
|
551
|
+
modelProvider: options.modelProvider ?? await resolveCodexAppServerModelProvider({
|
|
552
552
|
...params,
|
|
553
553
|
homeScope: options.appServer.start.homeScope,
|
|
554
554
|
authProfileId: options.authProfileId ?? params.authProfileId
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as CodexAppServerScopedRequestRejectedError, o as isCodexAppServerOverloadError, r as CodexAppServerRpcError } from "./rpc-error-
|
|
2
|
-
import { r as publishCodexCatalogResume } from "./session-catalog-events-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { f as unsubscribeCodexThreadBestEffort, i as assertCodexThreadResumeSubscription, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-
|
|
1
|
+
import { i as CodexAppServerScopedRequestRejectedError, o as isCodexAppServerOverloadError, r as CodexAppServerRpcError } from "./rpc-error-DemqqaxE.mjs";
|
|
2
|
+
import { r as publishCodexCatalogResume } from "./session-catalog-events-CEi6SuLQ.mjs";
|
|
3
|
+
import { k as forgetCodexWorkspaceReferences, lt as isCodexAppServerStartupError } from "./shared-client-CkyTrNB8.mjs";
|
|
4
|
+
import { m as assertCodexThreadResumeResponse, o as isCodexAppServerPrewriteRequestCancellationError } from "./client--P8jwXvA.mjs";
|
|
5
|
+
import { f as unsubscribeCodexThreadBestEffort, i as assertCodexThreadResumeSubscription, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-DMJWXGxM.mjs";
|
|
6
6
|
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
7
7
|
//#region extensions/codex/src/app-server/thread-resume.ts
|
|
8
8
|
/** Owns Codex thread/resume subscription safety. */
|
|
@@ -20,7 +20,7 @@ async function resumeCodexAppServerThread(params) {
|
|
|
20
20
|
assertCodexThreadResumeSubscription(threadId, response.thread.id);
|
|
21
21
|
forgetCodexWorkspaceReferences(params.client, threadId);
|
|
22
22
|
} catch (error) {
|
|
23
|
-
if (
|
|
23
|
+
if (isCodexAppServerStartupError(error) || error instanceof CodexAppServerScopedRequestRejectedError || isCodexAppServerPrewriteRequestCancellationError(error) || isCodexAppServerOverloadError(error)) throw error;
|
|
24
24
|
if (error instanceof CodexAppServerRpcError) {
|
|
25
25
|
if (await unsubscribeCodexThreadBestEffort(params.client, {
|
|
26
26
|
threadId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as readCodexAsyncQuestions } from "./async-questions-DdhOCwGi.mjs";
|
|
2
|
-
import { i as readCodexProviderRefusal, t as codexProviderRefusalDiagnostics } from "./event-projector-values-
|
|
2
|
+
import { i as readCodexProviderRefusal, t as codexProviderRefusalDiagnostics } from "./event-projector-values-yf4us9Pf.mjs";
|
|
3
3
|
import { n as attachCodexMirrorIdentity } from "./upstream-prompt-provenance-Ccd9MFRJ.mjs";
|
|
4
4
|
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as readCodexAsyncQuestions } from "./async-questions-DdhOCwGi.mjs";
|
|
2
2
|
import { a as readUpstreamUserText, i as readMirrorIdentity, n as attachCodexMirrorIdentity, o as takeCodexAssistantItemIds, r as attachUpstreamUserText } from "./upstream-prompt-provenance-Ccd9MFRJ.mjs";
|
|
3
|
-
import { t as projectBoundedCodexThreadHistory } from "./transcript-history-projection-
|
|
3
|
+
import { t as projectBoundedCodexThreadHistory } from "./transcript-history-projection-i-FVpyha.mjs";
|
|
4
4
|
import { a as buildCodexMirrorIdempotencyKey, c as isMirroredAgentMessage, i as buildCodexMirrorDedupeIdentity, l as readCodexMirrorSourceFingerprint, n as attachCodexMirrorAttestation, o as fingerprintCodexMirrorSourceMessage, r as attachCodexMirrorRunId, t as applyCodexTranscriptTaint } from "./transcript-mirror-attestation-BzUXnrvv.mjs";
|
|
5
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
5
|
+
import { t as __exportAll } from "./session-binding-sidecars-BNSS6WL4.mjs";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { deliverAgentHarnessUserInputPrompt, embeddedAgentLog, formatErrorMessage, projectAgentHarnessTranscriptMessageForDisplay, restorePreparedUserTurnOperationalMetaForRuntime, runAgentHarnessBeforeMessageWriteHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
8
8
|
import { withCodexSessionTranscriptMirrorWrite } from "openclaw/plugin-sdk/codex-session-transcript-runtime";
|
|
9
|
-
import { createNativeSessionBindingAuthority } from "openclaw/plugin-sdk/agent-harness-session-runtime";
|
|
10
9
|
import { composeSessionTranscriptWriteAssertion, publishSessionTranscriptUpdateByIdentity } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
10
|
+
import { createNativeSessionBindingScope } from "openclaw/plugin-sdk/agent-harness-session-runtime";
|
|
11
11
|
//#region extensions/codex/src/app-server/user-prompt-message.ts
|
|
12
12
|
function buildFromPrepared(params, preparedUserMessage) {
|
|
13
13
|
const senderId = normalizeOptionalString(params.senderId);
|
|
@@ -102,7 +102,8 @@ async function mirror(params) {
|
|
|
102
102
|
assertWritable();
|
|
103
103
|
const result = await withCodexSessionTranscriptMirrorWrite({
|
|
104
104
|
...transcriptTarget,
|
|
105
|
-
config: params.config
|
|
105
|
+
config: params.config,
|
|
106
|
+
...params.assertCurrent || params.assertWriteCurrent ? { assertCurrent: assertWritable } : {}
|
|
106
107
|
}, async (transcript) => {
|
|
107
108
|
assertWritable();
|
|
108
109
|
const nextAssistantMirrorIdentitiesOwned = /* @__PURE__ */ new Set();
|
|
@@ -191,10 +192,6 @@ async function mirror(params) {
|
|
|
191
192
|
assertWritable();
|
|
192
193
|
const { lifecycleRevision, messageSeq, result: appended } = await transcript.appendMessageWithMessageSequence({
|
|
193
194
|
message: messageToAppend,
|
|
194
|
-
...params.assertCurrent || params.assertWriteCurrent ? { preparation: {
|
|
195
|
-
prepareMessage: async (preparedMessage) => preparedMessage,
|
|
196
|
-
source: assertWritable
|
|
197
|
-
} } : {},
|
|
198
195
|
idempotencyLookup: "scan",
|
|
199
196
|
cwd: params.cwd
|
|
200
197
|
});
|
|
@@ -399,7 +396,7 @@ async function mirrorPromptAtTurnStartBestEffort(params) {
|
|
|
399
396
|
return;
|
|
400
397
|
}
|
|
401
398
|
const mirrorResult = await mirror({
|
|
402
|
-
assertCurrent:
|
|
399
|
+
assertCurrent: createNativeSessionBindingScope(params.params.hostCapabilities.assertActive).assertLegacyCurrent,
|
|
403
400
|
agentId: params.agentId,
|
|
404
401
|
sessionKey: params.sessionKey,
|
|
405
402
|
sessionId: params.params.sessionId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as appendCodexGitConfigParameters } from "./config-utils-DN_YT7dE.mjs";
|
|
2
2
|
import { r as normalizeCodexAppServerArgs } from "./launch-args-DbFCehO7.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { f as resolveManagedCodexNativeCommand } from "./managed-binary-DbKvGXKl.mjs";
|
|
4
4
|
import { i as recordCodexAppServerSpawnFailure, r as getCodexAppServerSpawnFailure } from "./spawn-error-CL3n6MAa.mjs";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -10,7 +10,6 @@ import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "open
|
|
|
10
10
|
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
11
11
|
import { closeSync, constants, openSync, readSync } from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
13
|
-
import { readFile, readdir } from "node:fs/promises";
|
|
14
13
|
import { once } from "node:events";
|
|
15
14
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
16
15
|
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
@@ -26,26 +25,45 @@ const PROCESS_COLUMNS = "pid=,ppid=,pgid=,stat=,lstart=";
|
|
|
26
25
|
const MAX_PROCESS_CONTAINMENT_MS$1 = 2e3;
|
|
27
26
|
const PROCESS_INSPECTION_MAX_BYTES = 8388608;
|
|
28
27
|
const PROCFS_COMMAND_PERMISSION_EXIT = 77;
|
|
29
|
-
const
|
|
28
|
+
const PROCFS_READER = `
|
|
30
29
|
const fs = require("node:fs");
|
|
31
|
-
const [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
const [target, limit] = process.argv.slice(-2);
|
|
31
|
+
const maxBytes = Number(limit);
|
|
32
|
+
const buffer = Buffer.alloc(4096);
|
|
33
|
+
let bytes = 0;
|
|
34
|
+
function read(file) {
|
|
35
|
+
const fd = fs.openSync(file, "r");
|
|
35
36
|
const chunks = [];
|
|
36
|
-
let
|
|
37
|
+
let size = 0;
|
|
37
38
|
try {
|
|
38
39
|
for (;;) {
|
|
39
40
|
const count = fs.readSync(fd, buffer, 0, Math.min(buffer.length, maxBytes - bytes + 1), null);
|
|
40
41
|
if (count === 0) break;
|
|
41
42
|
bytes += count;
|
|
42
|
-
if (bytes > maxBytes) throw new Error("
|
|
43
|
+
if (bytes > maxBytes) throw new Error("Process inspection byte limit exceeded");
|
|
43
44
|
chunks.push(Buffer.from(buffer.subarray(0, count)));
|
|
45
|
+
size += count;
|
|
44
46
|
}
|
|
45
47
|
} finally {
|
|
46
48
|
fs.closeSync(fd);
|
|
47
49
|
}
|
|
48
|
-
|
|
50
|
+
return Buffer.concat(chunks, size);
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
if (target === "snapshot") {
|
|
54
|
+
const rows = [read("/proc/sys/kernel/random/boot_id").toString()];
|
|
55
|
+
for (const pid of fs.readdirSync("/proc")) {
|
|
56
|
+
if (!/^\\d+$/.test(pid)) continue;
|
|
57
|
+
try {
|
|
58
|
+
rows.push(pid, read("/proc/" + pid + "/stat").toString());
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (!["ENOENT", "ESRCH"].includes(error?.code)) throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
process.stdout.end(rows.join("\\0"));
|
|
64
|
+
} else {
|
|
65
|
+
process.stdout.end(read("/proc/" + target + "/cmdline"));
|
|
66
|
+
}
|
|
49
67
|
} catch (error) {
|
|
50
68
|
process.exitCode = ["EACCES", "EPERM", "ERR_ACCESS_DENIED"].includes(error?.code)
|
|
51
69
|
? ${PROCFS_COMMAND_PERMISSION_EXIT} : 1;
|
|
@@ -64,7 +82,7 @@ var ProcessInspectionError = class extends Error {
|
|
|
64
82
|
}
|
|
65
83
|
};
|
|
66
84
|
function remainingInspectionTime(deadline) {
|
|
67
|
-
const remainingMs = deadline -
|
|
85
|
+
const remainingMs = Math.floor(deadline - performance.now());
|
|
68
86
|
if (remainingMs <= 0) throw new ProcessInspectionError("deadline");
|
|
69
87
|
return remainingMs;
|
|
70
88
|
}
|
|
@@ -76,7 +94,7 @@ function inspectionFailure(error) {
|
|
|
76
94
|
function isMissingProcess(error) {
|
|
77
95
|
return error !== null && typeof error === "object" && "code" in error && (error.code === "ENOENT" || error.code === "ESRCH");
|
|
78
96
|
}
|
|
79
|
-
async function readCodexAppServerProcessSnapshot(deadline =
|
|
97
|
+
async function readCodexAppServerProcessSnapshot(deadline = performance.now() + MAX_PROCESS_CONTAINMENT_MS$1, pids) {
|
|
80
98
|
const selected = pids === void 0 ? void 0 : [.../* @__PURE__ */ new Set([process.pid, ...pids])];
|
|
81
99
|
const rows = await readProcesses(selected, deadline, selected !== void 0);
|
|
82
100
|
if (selected && !rows.some((row) => row.pid === process.pid)) throw new ProcessInspectionError("unavailable");
|
|
@@ -139,12 +157,12 @@ async function readProcessOutput(command, deadline) {
|
|
|
139
157
|
if (output instanceof ProcessInspectionError) reject(output);
|
|
140
158
|
else resolve(output);
|
|
141
159
|
};
|
|
142
|
-
const procfs = command.kind
|
|
160
|
+
const procfs = command.kind !== "ps";
|
|
143
161
|
const inspector = execFile(procfs ? process.execPath : "ps", procfs ? [
|
|
144
162
|
...process.versions.bun ? ["--no-env-file", "--config=/dev/null"] : [],
|
|
145
163
|
"-e",
|
|
146
|
-
|
|
147
|
-
String(command.pid),
|
|
164
|
+
PROCFS_READER,
|
|
165
|
+
command.kind === "procfs-command" ? String(command.pid) : "snapshot",
|
|
148
166
|
String(PROCESS_INSPECTION_MAX_BYTES)
|
|
149
167
|
] : command.args, {
|
|
150
168
|
encoding: "utf8",
|
|
@@ -156,7 +174,7 @@ async function readProcessOutput(command, deadline) {
|
|
|
156
174
|
TZ: "UTC"
|
|
157
175
|
}
|
|
158
176
|
}, (error, stdout) => {
|
|
159
|
-
settle(
|
|
177
|
+
settle(performance.now() >= deadline ? new ProcessInspectionError("deadline") : error ? procfs && error.code === PROCFS_COMMAND_PERMISSION_EXIT ? new ProcessInspectionError("permission") : inspectionFailure(error) : stdout);
|
|
160
178
|
});
|
|
161
179
|
const timer = setTimeout(() => {
|
|
162
180
|
settle(new ProcessInspectionError("deadline"));
|
|
@@ -202,34 +220,15 @@ function parseProcesses(output, selected) {
|
|
|
202
220
|
}
|
|
203
221
|
async function readLinuxProcesses(selected, deadline) {
|
|
204
222
|
if (selected !== void 0) return readSelectedLinuxProcesses(selected, deadline);
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const bootId = parseLinuxBootId(await readFile("/proc/sys/kernel/random/boot_id", options));
|
|
212
|
-
const pids = await readdir("/proc");
|
|
213
|
-
const rows = [];
|
|
214
|
-
let bytes = 0;
|
|
215
|
-
for (const entry of pids) {
|
|
216
|
-
if (!/^\d+$/.test(entry)) continue;
|
|
217
|
-
remainingInspectionTime(deadline);
|
|
218
|
-
const stat = await readFile(`/proc/${entry}/stat`, options).catch((error) => {
|
|
219
|
-
if (isMissingProcess(error)) return;
|
|
220
|
-
throw error;
|
|
221
|
-
});
|
|
222
|
-
if (stat === void 0) continue;
|
|
223
|
-
bytes += stat.length;
|
|
224
|
-
if (bytes > PROCESS_INSPECTION_MAX_BYTES) throw new ProcessInspectionError("unavailable");
|
|
225
|
-
const row = parseLinuxProcess(stat, entry, bootId, false);
|
|
226
|
-
if (row) rows.push(row);
|
|
227
|
-
}
|
|
228
|
-
remainingInspectionTime(deadline);
|
|
229
|
-
return rows;
|
|
230
|
-
} catch (error) {
|
|
231
|
-
throw inspectionFailure(error);
|
|
223
|
+
const [boot, ...fields] = (await readProcessOutput({ kind: "procfs-snapshot" }, deadline)).split("\0");
|
|
224
|
+
const bootId = parseLinuxBootId(boot ?? "");
|
|
225
|
+
const rows = [];
|
|
226
|
+
for (let index = 0; index < fields.length; index += 2) {
|
|
227
|
+
const row = parseLinuxProcess(fields[index + 1], fields[index], bootId, false);
|
|
228
|
+
if (row) rows.push(row);
|
|
232
229
|
}
|
|
230
|
+
remainingInspectionTime(deadline);
|
|
231
|
+
return rows;
|
|
233
232
|
}
|
|
234
233
|
function parseLinuxBootId(value) {
|
|
235
234
|
const bootId = value.trim();
|
|
@@ -238,7 +237,7 @@ function parseLinuxBootId(value) {
|
|
|
238
237
|
}
|
|
239
238
|
function parseLinuxProcess(stat, entry, bootId, selected) {
|
|
240
239
|
const commEnd = stat.lastIndexOf(")");
|
|
241
|
-
const fields = stat.slice(commEnd + 1).trim().split(/\s
|
|
240
|
+
const fields = stat.slice(commEnd + 1).trim().split(/\s+/, 20);
|
|
242
241
|
const ppid = Number(fields[1]);
|
|
243
242
|
const pgid = Number(fields[2]);
|
|
244
243
|
const startTicks = fields[19];
|
|
@@ -311,7 +310,7 @@ const MAX_PROCESS_CONTAINMENT_MS = 2e3;
|
|
|
311
310
|
const MAX_PROCESS_QUIESCE_PASSES = 16;
|
|
312
311
|
/** Discharges the registered root obligation, including an already-obsolete PID. */
|
|
313
312
|
async function terminateCodexAppServerOrphan(expected) {
|
|
314
|
-
const deadline =
|
|
313
|
+
const deadline = performance.now() + MAX_PROCESS_CONTAINMENT_MS;
|
|
315
314
|
const initial = (await readCodexAppServerProcessSnapshot(deadline, [expected.pid])).find((row) => row.pid === expected.pid);
|
|
316
315
|
if (!initial || !hasSameIdentity(initial, expected) || isDeadProcessState(initial.state)) return true;
|
|
317
316
|
const result = await terminateCodexAppServerDescendants({
|
|
@@ -325,7 +324,7 @@ async function terminateCodexAppServerOrphan(expected) {
|
|
|
325
324
|
const current = await readCodexAppServerProcess(expected.pid, deadline).catch(() => void 0);
|
|
326
325
|
if (current && isSameLiveRoot(current, contained.root, true)) signalProcess(current.pgid === current.pid ? -current.pid : current.pid, "SIGKILL");
|
|
327
326
|
}
|
|
328
|
-
while (
|
|
327
|
+
while (performance.now() < deadline) {
|
|
329
328
|
const snapshot = await readCodexAppServerProcessSnapshot(deadline, [expected.pid]).catch(() => void 0);
|
|
330
329
|
if (!snapshot?.some((row) => row.pid === process.pid)) return false;
|
|
331
330
|
const current = snapshot.find((row) => row.pid === expected.pid);
|
|
@@ -340,15 +339,15 @@ async function terminateCodexAppServerOrphan(expected) {
|
|
|
340
339
|
}
|
|
341
340
|
return false;
|
|
342
341
|
} finally {
|
|
343
|
-
if (contained && !gone) await signalSameProcess(contained.root, "SIGCONT",
|
|
342
|
+
if (contained && !gone) await signalSameProcess(contained.root, "SIGCONT", performance.now() + MAX_PROCESS_CONTAINMENT_MS, "root");
|
|
344
343
|
}
|
|
345
344
|
}
|
|
346
|
-
async function terminateCodexAppServerDescendants(child, expected, deadline =
|
|
345
|
+
async function terminateCodexAppServerDescendants(child, expected, deadline = performance.now() + MAX_PROCESS_CONTAINMENT_MS) {
|
|
347
346
|
const rootPid = child.pid;
|
|
348
347
|
if (child.exitCode != null || child.signalCode != null) return "exited";
|
|
349
348
|
if (process.platform === "win32" || !rootPid || !child.kill) return;
|
|
350
349
|
const snapshot = await readCodexAppServerProcessSnapshot(deadline).catch(() => void 0);
|
|
351
|
-
if (!snapshot ||
|
|
350
|
+
if (!snapshot || performance.now() >= deadline) return;
|
|
352
351
|
const root = snapshot.find((row) => row.pid === rootPid);
|
|
353
352
|
if (!expected && (!root || isDeadProcessState(root.state))) return "exited";
|
|
354
353
|
if (!root || !(expected ? isSameLiveProcess(root, expected) : root.ppid === process.pid) || isDeadProcessState(root.state)) return;
|
|
@@ -361,15 +360,15 @@ async function terminateCodexAppServerDescendants(child, expected, deadline = Da
|
|
|
361
360
|
const descendants = await quiesceDescendants(root, initialDescendants, stoppedDescendants, deadline);
|
|
362
361
|
if (!descendants) return;
|
|
363
362
|
for (const descendant of descendants.toReversed()) {
|
|
364
|
-
if (
|
|
363
|
+
if (performance.now() >= deadline) return;
|
|
365
364
|
if (!isDeadProcessState(descendant.state)) {
|
|
366
|
-
if (!await signalSameProcess(descendant, "SIGKILL", deadline) ||
|
|
365
|
+
if (!await signalSameProcess(descendant, "SIGKILL", deadline) || performance.now() >= deadline) return;
|
|
367
366
|
}
|
|
368
367
|
}
|
|
369
368
|
const remaining = new Map(descendants.map((row) => [row.pid, row]));
|
|
370
369
|
while (remaining.size > 0) {
|
|
371
370
|
const terminationSnapshot = await readCodexAppServerProcessSnapshot(deadline, [root.pid, ...remaining.keys()]).catch(() => void 0);
|
|
372
|
-
if (!terminationSnapshot ||
|
|
371
|
+
if (!terminationSnapshot || performance.now() >= deadline) return;
|
|
373
372
|
const currentRoot = terminationSnapshot.find((row) => row.pid === root.pid);
|
|
374
373
|
if (!currentRoot || !isSameLiveRoot(currentRoot, root, true)) return;
|
|
375
374
|
const currentByPid = new Map(terminationSnapshot.map((row) => [row.pid, row]));
|
|
@@ -394,7 +393,7 @@ async function terminateCodexAppServerDescendants(child, expected, deadline = Da
|
|
|
394
393
|
} finally {
|
|
395
394
|
if (resumeRootOnUnwind) {
|
|
396
395
|
if (expected) {
|
|
397
|
-
const releaseDeadline =
|
|
396
|
+
const releaseDeadline = performance.now() + MAX_PROCESS_CONTAINMENT_MS;
|
|
398
397
|
for (const descendant of stoppedDescendants.values()) await signalSameProcess(descendant, "SIGCONT", releaseDeadline);
|
|
399
398
|
await signalSameProcess(root, "SIGCONT", releaseDeadline, "root");
|
|
400
399
|
} else {
|
|
@@ -408,13 +407,13 @@ async function quiesceDescendants(root, initialDescendants, stopped, deadline) {
|
|
|
408
407
|
const provenByPid = new Map(initialDescendants.map((descendant) => [descendant.pid, descendant]));
|
|
409
408
|
const stopFailures = /* @__PURE__ */ new Map();
|
|
410
409
|
for (let pass = 0; pass < MAX_PROCESS_QUIESCE_PASSES; pass += 1) {
|
|
411
|
-
if (
|
|
410
|
+
if (performance.now() >= deadline) return;
|
|
412
411
|
const snapshot = await readCodexAppServerProcessSnapshot(deadline).catch(() => void 0);
|
|
413
|
-
if (!snapshot ||
|
|
412
|
+
if (!snapshot || performance.now() >= deadline) return;
|
|
414
413
|
const currentRoot = snapshot.find((row) => row.pid === root.pid);
|
|
415
414
|
if (!currentRoot || !isSameLiveRoot(currentRoot, root)) return;
|
|
416
415
|
if (!isSameLiveRoot(currentRoot, root, true)) {
|
|
417
|
-
if (!await signalSameProcess(root, "SIGSTOP", deadline, "root") ||
|
|
416
|
+
if (!await signalSameProcess(root, "SIGSTOP", deadline, "root") || performance.now() >= deadline) return;
|
|
418
417
|
continue;
|
|
419
418
|
}
|
|
420
419
|
const snapshotByPid = new Map(snapshot.map((process) => [process.pid, process]));
|
|
@@ -439,10 +438,10 @@ async function quiesceDescendants(root, initialDescendants, stopped, deadline) {
|
|
|
439
438
|
if (provenByPid.size > MAX_CONTAINED_PROCESSES) return;
|
|
440
439
|
let allStopped = true;
|
|
441
440
|
for (const descendant of provenByPid.values()) {
|
|
442
|
-
if (
|
|
441
|
+
if (performance.now() >= deadline) return;
|
|
443
442
|
if (isStoppedState(descendant.state)) continue;
|
|
444
443
|
const stopQueued = await signalSameProcess(descendant, "SIGSTOP", deadline);
|
|
445
|
-
if (
|
|
444
|
+
if (performance.now() >= deadline) return;
|
|
446
445
|
if (stopQueued) {
|
|
447
446
|
stopFailures.delete(identityKey(descendant));
|
|
448
447
|
stopped.set(identityKey(descendant), descendant);
|
|
@@ -566,9 +565,9 @@ async function reapRegisteredCodexAppServerOrphans() {
|
|
|
566
565
|
}
|
|
567
566
|
async function sweepRegisteredCodexAppServerOrphans(store) {
|
|
568
567
|
const entries = await store.entries();
|
|
569
|
-
const deadline =
|
|
568
|
+
const deadline = performance.now() + PROCESS_REGISTRATION_INSPECTION_MS;
|
|
570
569
|
for (const entry of entries) {
|
|
571
|
-
if (
|
|
570
|
+
if (performance.now() >= deadline) throw new Error("Codex orphan cleanup exceeded its startup budget. Retry to finish cleanup.");
|
|
572
571
|
const registration = registrationSchema.parse(entry.value);
|
|
573
572
|
const snapshot = await readCodexAppServerProcessSnapshot(deadline, [registration.parent.pid, registration.child.pid]);
|
|
574
573
|
const parent = snapshot.find((row) => row.pid === registration.parent.pid);
|
|
@@ -617,7 +616,7 @@ async function prepareCodexAppServerProcessRegistration() {
|
|
|
617
616
|
await once(child, "spawn");
|
|
618
617
|
if (!store) return;
|
|
619
618
|
if (!child.pid) throw new ProcessInspectionError("unavailable");
|
|
620
|
-
const deadline =
|
|
619
|
+
const deadline = performance.now() + PROCESS_REGISTRATION_INSPECTION_MS;
|
|
621
620
|
const snapshot = await readCodexAppServerProcessSnapshot(deadline, [child.pid]);
|
|
622
621
|
const parent = snapshot.find((row) => row.pid === process.pid);
|
|
623
622
|
const spawned = snapshot.find((row) => row.pid === child.pid);
|
|
@@ -893,7 +892,7 @@ async function createStdioTransport(options, baseEnv = process.env, assertCurren
|
|
|
893
892
|
const previousFailure = getCodexAppServerSpawnFailure(launchKey) ?? (nativeCommand ? getCodexAppServerSpawnFailure(nativeCommand) : void 0);
|
|
894
893
|
if (previousFailure) throw previousFailure;
|
|
895
894
|
const register = await prepareCodexAppServerProcessRegistration();
|
|
896
|
-
assertCurrent?.();
|
|
895
|
+
await assertCurrent?.();
|
|
897
896
|
embeddedAgentLog.debug("Codex app-server spawn", {
|
|
898
897
|
command: invocation.command,
|
|
899
898
|
launcher: options.command,
|
|
@@ -923,11 +922,11 @@ async function createStdioTransport(options, baseEnv = process.env, assertCurren
|
|
|
923
922
|
if (nativeCommand && invocation.resolution === "node-entrypoint") observeManagedCodexLauncherFailure(child, nativeCommand);
|
|
924
923
|
onSpawn?.(child);
|
|
925
924
|
await register(child);
|
|
926
|
-
assertCurrent?.();
|
|
925
|
+
await assertCurrent?.();
|
|
927
926
|
return child;
|
|
928
927
|
} catch (error) {
|
|
929
928
|
await closeCodexAppServerTransportAndWait(child, { drainStdio: true });
|
|
930
|
-
assertCurrent?.();
|
|
929
|
+
await assertCurrent?.();
|
|
931
930
|
throw child.startupFailure?.error ?? recordCodexAppServerSpawnFailure(error, invocation.command, launchKey);
|
|
932
931
|
}
|
|
933
932
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as resolveCodexAppServerUserHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
2
|
-
import "./config-
|
|
2
|
+
import "./config-BfrAlTMT.mjs";
|
|
3
3
|
import { t as codexWebSocketDataToBuffer } from "./websocket-data-XlRvt8Ys.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { EventEmitter } from "node:events";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as isJsonObject } from "./protocol-CaPAVwe9.mjs";
|
|
2
2
|
import { n as waitForPromiseOrAbort, t as abortReason } from "./timeout-D0mEWSGG.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { b as readCodexTurnCompletedNotification } from "./client--P8jwXvA.mjs";
|
|
4
4
|
import { normalizeOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { AsyncResource } from "node:async_hooks";
|
|
6
6
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|