@openclaw/codex 2026.9.4 → 2026.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/account-usage-runtime-C2MOIvfq.mjs +75 -0
- package/dist/{apply-CvT8tW5i.js → .setup/apply-CJ0ZfmBG.mjs} +11 -11
- package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
- package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-BpYKdTA0.mjs} +29 -14
- package/dist/{attempt-context-D44yeDII.js → .setup/attempt-context-VXVwTCfS.mjs} +5 -5
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
- package/dist/{auth-binding-CWlKVccJ.js → .setup/auth-binding-DhLWa_7K.mjs} +1 -1
- package/dist/{auth-cache-key-7orQae_j.js → .setup/auth-cache-key-QirmgiCo.mjs} +3 -3
- package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
- package/dist/.setup/binding-connection-Bm38niE8.mjs +50 -0
- package/dist/.setup/binding-connection.runtime-CnRMC0ta.mjs +48 -0
- package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-BtlZcivC.mjs} +16 -11
- package/dist/{build-state-BCmg9-5p.js → .setup/build-state-Xx9ybZqa.mjs} +1 -1
- package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-_vXcZGSx.mjs} +1 -1
- package/dist/{client-B57KWPQx.js → .setup/client-vXs2929Q.mjs} +332 -163
- package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-naHIZwwF.mjs} +3 -3
- package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-CGEkdawF.mjs} +2 -2
- package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-BtAJEW1X.mjs} +59 -42
- package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DHFpn4le.mjs} +22 -13
- package/dist/{compact-B_H3AOd7.js → .setup/compact-C3i3qlzj.mjs} +28 -43
- package/dist/{config-oIORaQ5T.js → .setup/config-CedDWjM-.mjs} +5 -4
- package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BsanJ8QG.mjs} +6 -418
- package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
- package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-CeAhl_h4.mjs} +2 -2
- package/dist/.setup/config-security-BRQ2mgW9.mjs +465 -0
- package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DhzrpTM6.mjs} +23 -21
- package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
- package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-DN53ns41.mjs} +17 -13
- package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
- package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
- package/dist/{dynamic-tools-CmN5RAip.js → .setup/dynamic-tools-D16lOp67.mjs} +101 -55
- package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-K6kLCN8X.mjs} +3 -3
- package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-R1gA8Sn6.mjs} +4 -5
- package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-DNUR1s0A.mjs} +6 -3
- package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-DyTQ_XqL.mjs} +1 -1
- package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-C7Ntzs-f.mjs} +102 -9
- package/dist/{harness-C7rRa7bm.js → .setup/harness-rxaaoN-o.mjs} +74 -20
- package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-fulhZuz8.mjs} +1 -1
- package/dist/{inference-proxy-HGXKUIre.js → .setup/inference-proxy-CC15HuSi.mjs} +4 -4
- package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-B6srt48J.mjs} +7 -7
- package/dist/{launch-args-RXQwn8zV.js → .setup/launch-args-DnMak49W.mjs} +22 -1
- package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-DP6Rib3P.mjs} +2 -2
- package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
- package/dist/{model-catalog-Dq2n8f_p.js → .setup/model-catalog-DkvUuBey.mjs} +35 -10
- package/dist/{models-PCKOim-h.js → .setup/models-BDFgm_G-.mjs} +3 -3
- package/dist/.setup/native-auth-BLZGqFjw.mjs +57 -0
- package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-YXaL6dMd.mjs} +24 -29
- package/dist/.setup/native-subagent-monitor-B1hxzIOy.mjs +5031 -0
- package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-DsuOonKv.mjs} +32 -8
- package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-Cl8b2ZF3.mjs} +1 -1
- package/dist/{node-exec-server.runtime-Cl2vapEi.js → .setup/node-exec-server.runtime-BaViBKNz.mjs} +3 -3
- package/dist/{plan-7uG-Fp36.js → .setup/plan-xD7WKYTM.mjs} +64 -48
- package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-r8nq5Jzp.mjs} +3 -3
- package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-BOxKP7db.mjs} +29 -25
- package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-CjfzafAZ.mjs} +1 -1
- package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-DUle8DLz.mjs} +7 -6
- package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-DsS5buNa.mjs} +29 -14
- package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-B8J4Dy-O.mjs} +2 -2
- package/dist/{provider-MQ8PVkuE.js → .setup/provider-fFh_-VR3.mjs} +4 -4
- package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-DOEGYRNs.mjs} +90 -46
- package/dist/{request-B7hEkBGq.js → .setup/request-BioXJLYa.mjs} +113 -33
- package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
- package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-rlA07pUv.mjs} +580 -498
- package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-Dy38Z5iU.mjs} +2 -2
- package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-BBP-RbTf.mjs} +3 -3
- package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-_0W_fHRr.mjs} +46 -64
- package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-TH3xA0zj.mjs} +181 -3
- package/dist/.setup/session-binding-sidecars-CKYEcfNn.mjs +543 -0
- package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-CR_whkEW.mjs} +6 -6
- package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-CwZaPacf.mjs} +6 -6
- package/dist/.setup/session-catalog-events-jMcYfQyd.mjs +250 -0
- package/dist/.setup/session-catalog-fUdWDx-U.mjs +2464 -0
- package/dist/.setup/session-catalog-index-B141u15s.mjs +1070 -0
- package/dist/.setup/session-catalog-index-order-Cc5BzlQr.mjs +48 -0
- package/dist/.setup/session-catalog-index-state-BAuDztHN.mjs +180 -0
- package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-ChV3cCtm.mjs} +206 -95
- package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-BVRsYOSh.mjs} +3 -3
- package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-Dowv8osw.mjs} +7 -7
- package/dist/.setup/session-catalog-projection-C1Bj9Jl-.mjs +414 -0
- package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-DIj-IE-E.mjs} +4 -4
- package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-C--SrLI8.mjs} +10 -5
- package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-JHXT5Xfi.mjs} +4 -4
- package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
- package/dist/{session-history.worker-BeK1YOyT.js → .setup/session-history.worker-CpNj7H_P.mjs} +5 -6
- package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-DH1z6fXn.mjs} +2 -2
- package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-DhurXY0l.mjs} +2 -2
- package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-CU87AOg9.mjs} +6 -6
- package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
- package/dist/{settled-turn-finalizer-Dn91stmc.js → .setup/settled-turn-finalizer-CiY2bLFK.mjs} +9 -9
- package/dist/{shared-client-CscigXXL.js → .setup/shared-client-BpTtuLQ5.mjs} +286 -145
- package/dist/{side-question-BGMJQf4U.js → .setup/side-question-DSCZyoBD.mjs} +64 -47
- package/dist/{source-CElXU0Oy.js → .setup/source-Bjp4UQij.mjs} +7 -6
- package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-jmecf6OJ.mjs} +1 -1
- package/dist/.setup/thread-history-page-BTx-4xsg.mjs +83 -0
- package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-Cik28qWn.mjs} +256 -128
- package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-skomxnIt.mjs} +4 -4
- package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-Cjs4B8xf.mjs} +2 -2
- package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-BkNpj9Pz.mjs} +8 -5
- package/dist/.setup/timeout-DZF05XrR.mjs +63 -0
- package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-DHNBDhCU.mjs} +8 -3
- package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-D4qp_leP.mjs} +15 -6
- package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
- package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-Cmx94Oiy.mjs} +149 -44
- package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-D3UKxgVD.mjs} +27 -26
- package/dist/{usage-tCk-mg_x.js → .setup/usage-BOgBEKso.mjs} +4 -4
- package/dist/.setup/usage-limit-error-C0ow7DOc.mjs +166 -0
- package/dist/{version-omm6IPI3.js → .setup/version-CoqzXPgK.mjs} +1 -1
- package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CTGuJt6i.mjs} +3 -3
- package/dist/api.js +6 -6
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +8 -528
- package/dist/harness.js +1 -1
- package/dist/index.js +123 -83
- package/dist/media-understanding-provider.js +3 -3
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-tool-policy.js +12 -0
- package/dist/provider-discovery.js +18 -0
- package/dist/session-history-worker-runtime.js +23 -5
- package/dist/session-history.worker.js +2 -2
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +354 -69
- package/package.json +11 -8
- package/dist/binding-connection-D3udKbIE.js +0 -60
- package/dist/event-projector-usage-BfXmpOec.js +0 -102
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
- package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
- package/dist/rpc-error-ttN_QjEm.js +0 -30
- package/dist/session-catalog-ct-AH01I.js +0 -1477
- package/dist/session-catalog-home-id-CwhLdC03.js +0 -18
- package/dist/session-catalog-provenance-D-dIfRAH.js +0 -96
- package/dist/timeout-BVw8aaM1.js +0 -33
- package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
- package/dist/{config-utils-DujwEnhg.js → .setup/config-utils-DujwEnhg.mjs} +0 -0
- package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
- package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
- package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
- package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
- package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
- package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
- package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-YBMHSzC4.mjs} +1 -1
- /package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-P-Vndfqq.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
- /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
import { a as readCodexPluginInventory, o as resolveOwnedAppApprovalOverrideKeys } from "./plugin-inventory-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { L as resolveCodexToolAbortTerminalReason, _ as assertCodexThreadAcceptsDirectInput, b as assertCodexThreadStartResponse, d as isCodexAppServerRequestTimeoutError, l as isCodexAppServerOverloadError, p as resolveCodexAppServerClientInstanceId, r as getCodexAppServerClientInstanceId, v as assertCodexThreadForkResponse } from "./client-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import "./
|
|
15
|
-
import
|
|
16
|
-
import { t as
|
|
17
|
-
import { n as normalizeCodexAppServerBindingModelProvider, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-
|
|
18
|
-
import { C as CodexThreadBindingConflictError,
|
|
19
|
-
import { a as closeCodexStartupClientBestEffort,
|
|
20
|
-
import { t as ensureCodexPluginActivation } from "./plugin-activation-
|
|
21
|
-
import { o as resolveCodexSessionBinding, r as hashCodexAppServerBindingFingerprint } from "./session-binding-
|
|
22
|
-
import { i as refreshCodexThreadPolicy, n as CodexThreadPolicyHandoffError, r as assertCodexSupervisionThreadLineage, t as CodexIncognitoPolicyChangeError } from "./thread-policy-
|
|
23
|
-
import { t as resumeCodexAppServerThread } from "./thread-resume-
|
|
24
|
-
import { r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread } from "./thread-ownership-
|
|
25
|
-
import "./transcript-mirror-
|
|
1
|
+
import { a as readCodexPluginInventory, o as resolveOwnedAppApprovalOverrideKeys } from "./plugin-inventory-DUle8DLz.mjs";
|
|
2
|
+
import { n as assertCodexBindingMayBeReplaced, p as sessionBindingIdentity } from "./session-binding-record-TH3xA0zj.mjs";
|
|
3
|
+
import { g as resolveCodexAppServerLocalHomeDir, h as resolveCodexAppServerHomeDir, m as isJsonObject, p as flattenCodexDynamicToolFunctions } from "./config-security-BRQ2mgW9.mjs";
|
|
4
|
+
import { f as resolveCodexPluginsPolicy } from "./config-parsing-CcB9iPoq.mjs";
|
|
5
|
+
import { L as resolveCodexToolAbortTerminalReason, _ as assertCodexThreadAcceptsDirectInput, b as assertCodexThreadStartResponse, d as isCodexAppServerRequestTimeoutError, l as isCodexAppServerOverloadError, p as resolveCodexAppServerClientInstanceId, r as getCodexAppServerClientInstanceId, v as assertCodexThreadForkResponse } from "./client-vXs2929Q.mjs";
|
|
6
|
+
import { d as readCodexEffectiveConfig, n as codexSandboxPolicyForTurn, s as assertCodexModelBackedReviewerEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-BsanJ8QG.mjs";
|
|
7
|
+
import { f as getCurrentSharedClientEntry } from "./auth-cache-key-QirmgiCo.mjs";
|
|
8
|
+
import { i as markStartedCodexManagedThread } from "./managed-thread-store-BMqgThVL.mjs";
|
|
9
|
+
import { n as withCodexAppServerThreadMutation, t as isIncognitoSessionKey } from "./incognito-session-uhrBF6wJ.mjs";
|
|
10
|
+
import { a as isCodexThreadReadMissingError, i as CodexAppServerRpcError, t as withAbortableTimeout } from "./timeout-DZF05XrR.mjs";
|
|
11
|
+
import { t as projectBoundedCodexThreadHistory } from "./transcript-history-projection-DHNBDhCU.mjs";
|
|
12
|
+
import { a as defaultCodexAppInventoryCache, i as CodexAppInventoryCache, o as serializeCodexAppInventoryError, s as codexAppIdentityKey, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BOxKP7db.mjs";
|
|
13
|
+
import { a as codexCatalogHomeId, c as readCodexSessionMeta } from "./session-catalog-events-jMcYfQyd.mjs";
|
|
14
|
+
import { t as assertCodexSessionRuntimeOwnership } from "./binding-connection-Bm38niE8.mjs";
|
|
15
|
+
import "./config-CedDWjM-.mjs";
|
|
16
|
+
import { r as sanitizeInlineImageDataUrl, t as invalidInlineImageText } from "./image-payload-sanitizer-tupAr-2o.mjs";
|
|
17
|
+
import { n as normalizeCodexAppServerBindingModelProvider, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-WqZtZfXN.mjs";
|
|
18
|
+
import { C as CodexThreadBindingConflictError, E as nativeHookRelayUnregisterQueue, G as unsubscribeCodexAppServerLiveThread, H as readCodexClientSessionMeta, L as hasCodexAppServerSiblingThreadWork, N as consumeCodexAppServerLiveThread, O as assertCodexInferenceRouteConfig, R as isCodexAppServerClientRuntimeLive, S as CodexAdoptedThreadActiveError, T as CodexThreadStartRequestError, U as releaseCodexAppServerLiveThread, _ as retainSharedCodexAppServerClientByInstanceId, j as prepareCodexInferenceThreadConfig, k as bindCodexInferenceThread, n as captureCodexAppServerClientLifetime, w as CodexThreadClientReplacementError, z as isCodexAppServerLiveThreadClaimed } from "./shared-client-BpTtuLQ5.mjs";
|
|
19
|
+
import { a as closeCodexStartupClientBestEffort, f as unsubscribeCodexThreadBestEffort, h as hasCodexAppServerSiblingRouteWork, l as retireUnsafeCodexTurnClientBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, r as CodexAppServerUnsafeSubscriptionError, s as isCodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-BpYKdTA0.mjs";
|
|
20
|
+
import { t as ensureCodexPluginActivation } from "./plugin-activation-r8nq5Jzp.mjs";
|
|
21
|
+
import { o as resolveCodexSessionBinding, r as hashCodexAppServerBindingFingerprint } from "./session-binding-_0W_fHRr.mjs";
|
|
22
|
+
import { i as refreshCodexThreadPolicy, n as CodexThreadPolicyHandoffError, r as assertCodexSupervisionThreadLineage, t as CodexIncognitoPolicyChangeError } from "./thread-policy-Cjs4B8xf.mjs";
|
|
23
|
+
import { t as resumeCodexAppServerThread } from "./thread-resume-BkNpj9Pz.mjs";
|
|
24
|
+
import { r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread } from "./thread-ownership-skomxnIt.mjs";
|
|
25
|
+
import "./transcript-mirror-D4qp_leP.mjs";
|
|
26
26
|
import { asOptionalRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
27
27
|
import * as crypto$1 from "node:crypto";
|
|
28
28
|
import crypto, { createHash } from "node:crypto";
|
|
29
|
+
import { isDeepStrictEqual } from "node:util";
|
|
29
30
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
30
31
|
import { addTimerTimeoutGraceMs, finiteSecondsToTimerSafeMilliseconds } from "openclaw/plugin-sdk/number-runtime";
|
|
31
32
|
import path from "node:path";
|
|
32
33
|
import os from "node:os";
|
|
33
34
|
import fs from "node:fs/promises";
|
|
34
35
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
36
|
+
import { toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
35
37
|
import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
38
|
+
import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
36
39
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
37
40
|
import { createStageTimingTracker, formatStageTimings } from "openclaw/plugin-sdk/time-runtime";
|
|
38
41
|
import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
39
42
|
import { resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
40
|
-
import { AgentHarnessPreflightError, SKILL_WORKSHOP_TOOL_NAME, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection, buildTemporalContextText, buildUiPresentationPrompt, embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, isHostScopedAgentToolActive, isOpenClawRuntimeContextCustomMessage, resolveMainSessionDelegationMode } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
41
|
-
import { isDeepStrictEqual } from "node:util";
|
|
42
|
-
import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
43
|
+
import { AgentHarnessPreflightError, SKILL_WORKSHOP_TOOL_NAME, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection, buildTemporalContextText, buildUiPresentationPrompt, embeddedAgentLog, formatErrorMessage as formatErrorMessage$1, isActiveHarnessContextEngine, isHostScopedAgentToolActive, isOpenClawRuntimeContextCustomMessage, resolveMainSessionDelegationMode } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
43
44
|
import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
44
45
|
import { IMAGE_BLOCK_TOKENS } from "openclaw/plugin-sdk/agent-core";
|
|
45
46
|
import { resolveRequiredHomeDir, resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
46
47
|
import { buildCodexUserMcpServersThreadConfigPatchForRun } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
47
|
-
import {
|
|
48
|
+
import { registerNativeHookRelayForBundledRuntime } from "openclaw/plugin-sdk/native-hook-relay-runtime";
|
|
48
49
|
import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-flags";
|
|
49
50
|
import { listRegisteredPluginAgentPromptGuidance } from "openclaw/plugin-sdk/plugin-runtime";
|
|
50
51
|
import { buildHostnameAllowlistPolicyFromSuffixAllowlist } from "openclaw/plugin-sdk/ssrf-policy";
|
|
@@ -106,7 +107,7 @@ function collectCodexPluginOwnedAppIds(inventory) {
|
|
|
106
107
|
return Array.from(new Set(inventory.records.flatMap((record) => record.ownedAppIds).filter(Boolean))).toSorted();
|
|
107
108
|
}
|
|
108
109
|
function collectCodexReservedPluginAppIds(params) {
|
|
109
|
-
const reserved = new Set(params.inventory.records.flatMap((record) => record.appOwnership === "proven" ? record.ownedAppIds : []));
|
|
110
|
+
const reserved = new Set(params.inventory.records.flatMap((record) => record.appOwnership === "proven" ? record.ownedAppIds : []).map(codexAppIdentityKey));
|
|
110
111
|
const recordsByConfigKey = new Map(params.inventory.records.map((record) => [record.policy.configKey, record]));
|
|
111
112
|
const configuredOwnerNames = new Set(params.policy.pluginPolicies.flatMap((policy) => {
|
|
112
113
|
const record = recordsByConfigKey.get(policy.configKey);
|
|
@@ -117,7 +118,7 @@ function collectCodexReservedPluginAppIds(params) {
|
|
|
117
118
|
record?.summary.id
|
|
118
119
|
].filter((name) => Boolean(name)).map(normalizeCodexPluginOwnerName);
|
|
119
120
|
}));
|
|
120
|
-
for (const app of params.accountApps) if (app.pluginDisplayNames.some((name) => configuredOwnerNames.has(normalizeCodexPluginOwnerName(name)))) reserved.add(app.id);
|
|
121
|
+
for (const app of params.accountApps) if (app.pluginDisplayNames.some((name) => configuredOwnerNames.has(normalizeCodexPluginOwnerName(name)))) reserved.add(codexAppIdentityKey(app.id));
|
|
121
122
|
return reserved;
|
|
122
123
|
}
|
|
123
124
|
function normalizeCodexPluginOwnerName(name) {
|
|
@@ -199,8 +200,8 @@ async function readCodexConfigForAppAdmission(params) {
|
|
|
199
200
|
function resolveCodexExplicitAppEnablement(layersHighestPrecedenceFirst, appId) {
|
|
200
201
|
for (const layer of layersHighestPrecedenceFirst) {
|
|
201
202
|
const apps = layer.apps;
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
203
|
+
const values = isJsonObject(apps) ? Object.entries(apps).filter(([id, app]) => codexAppIdentityKey(id) === codexAppIdentityKey(appId) && isJsonObject(app) && Object.hasOwn(app, "enabled")).map(([, app]) => isJsonObject(app) && app.enabled === true) : [];
|
|
204
|
+
if (values.length > 0) return values.every(Boolean);
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
207
|
function shouldForceRefreshCodexNotReadyPluginApps(params, policy, inventory) {
|
|
@@ -213,7 +214,7 @@ function shouldForceRefreshCodexNotReadyPluginApps(params, policy, inventory) {
|
|
|
213
214
|
* Builds Codex thread config patches that expose only policy-approved apps
|
|
214
215
|
* for native Codex turns.
|
|
215
216
|
*/
|
|
216
|
-
const CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION =
|
|
217
|
+
const CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION = 7;
|
|
217
218
|
const CODEX_PLUGIN_THREAD_CONFIG_FINGERPRINT_VERSION = 2;
|
|
218
219
|
/** Returns true when plugin config exists and thread config may need app patches. */
|
|
219
220
|
function shouldBuildCodexPluginThreadConfig(pluginConfig) {
|
|
@@ -419,7 +420,7 @@ async function buildCodexPluginThreadConfig(params) {
|
|
|
419
420
|
}
|
|
420
421
|
}
|
|
421
422
|
for (const app of unresolvedDisabledPluginOwnership ? [] : accountAppsResult.apps) {
|
|
422
|
-
if (pluginOwnedAppIds.has(app.id)) continue;
|
|
423
|
+
if (pluginOwnedAppIds.has(codexAppIdentityKey(app.id))) continue;
|
|
423
424
|
const admissionConfig = await getAdmissionConfig();
|
|
424
425
|
if (resolveCodexExplicitAppEnablement(admissionConfig.layers, app.id) === false) continue;
|
|
425
426
|
const accountApp = toCodexPluginOwnedAccountApp(app);
|
|
@@ -638,8 +639,34 @@ const CODEX_TURN_START_TEXT_INPUT_MAX_CHARS = 1 << 20;
|
|
|
638
639
|
const DEFAULT_CODEX_PROJECTION_RESERVE_TOKENS = 2e4;
|
|
639
640
|
const MIN_PROMPT_BUDGET_RATIO = .5;
|
|
640
641
|
const MIN_PROMPT_BUDGET_TOKENS = 8e3;
|
|
642
|
+
const CODEX_CONTEXT_SENDER_FIELD_MAX_CHARS = 256;
|
|
643
|
+
/**
|
|
644
|
+
* This projection has no access to agent-core's private compaction helper, but
|
|
645
|
+
* must keep the same attribution contract: a stable ID is identity; display
|
|
646
|
+
* labels are optional metadata, never provenance on their own.
|
|
647
|
+
*/
|
|
648
|
+
function formatCodexContextSenderSuffix(message) {
|
|
649
|
+
if (message.role !== "user") return "";
|
|
650
|
+
const metadata = Reflect.get(message, "__openclaw");
|
|
651
|
+
if (!metadata || typeof metadata !== "object") return "";
|
|
652
|
+
const normalize = (value) => {
|
|
653
|
+
if (typeof value !== "string") return;
|
|
654
|
+
const normalized = value.replaceAll("\0", "").trim();
|
|
655
|
+
return normalized ? truncateUtf16Safe(normalized, CODEX_CONTEXT_SENDER_FIELD_MAX_CHARS) : void 0;
|
|
656
|
+
};
|
|
657
|
+
const record = metadata;
|
|
658
|
+
const id = normalize(record.senderId);
|
|
659
|
+
if (!id) return "";
|
|
660
|
+
const name = normalize(record.senderName);
|
|
661
|
+
const username = normalize(record.senderUsername);
|
|
662
|
+
return ` sender=${JSON.stringify({
|
|
663
|
+
id,
|
|
664
|
+
...name ? { name } : {},
|
|
665
|
+
...username ? { username } : {}
|
|
666
|
+
})}`;
|
|
667
|
+
}
|
|
641
668
|
function neutralizeCodexExplicitMentionSigils(text) {
|
|
642
|
-
return text.replace(/\$(?=[A-Za-z0-9_:-])/gu, "$").replace(/\[@(?=[A-Za-z0-9_:-]+\]\()/gu, "[@");
|
|
669
|
+
return text.replace(/\$(?=[A-Za-z0-9_:-])/gu, "$").replace(/\[@(?=[A-Za-z0-9_:-]+\]\s*\()/gu, "[@");
|
|
643
670
|
}
|
|
644
671
|
/** Hidden durable notes are context; transient runtime carriers are current-turn only. */
|
|
645
672
|
function isCodexDurableCustomMessage(message) {
|
|
@@ -675,7 +702,11 @@ async function projectContextEngineAssemblyForCodex(params) {
|
|
|
675
702
|
...promptContextRange ? { promptContextRange } : {},
|
|
676
703
|
assembledMessages: params.assembledMessages,
|
|
677
704
|
prePromptMessageCount: params.originalHistoryMessages.length,
|
|
678
|
-
...context.
|
|
705
|
+
...context.imageGroups.length && promptPrefix ? { imageGroups: context.imageGroups.map((group) => ({
|
|
706
|
+
images: group.images,
|
|
707
|
+
start: group.start + promptPrefix.length,
|
|
708
|
+
end: group.end + promptPrefix.length
|
|
709
|
+
})) } : {}
|
|
679
710
|
};
|
|
680
711
|
}
|
|
681
712
|
/** Resolves rendered context size from a token budget and reserve. */
|
|
@@ -719,32 +750,61 @@ function resolveCodexContinuityProjectionMaxChars(params) {
|
|
|
719
750
|
}
|
|
720
751
|
/** Fits projected context prompts under Codex app-server turn/start text limits. */
|
|
721
752
|
function fitCodexProjectedContextForTurnStart(params) {
|
|
753
|
+
const slice = (start, end, budget = end - start) => {
|
|
754
|
+
const retained = truncateOlderContext(params.promptText.slice(start, end), budget);
|
|
755
|
+
return {
|
|
756
|
+
...retained,
|
|
757
|
+
sourceStart: start + retained.retainedStart,
|
|
758
|
+
sourceEnd: end
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
const finish = (...parts) => {
|
|
762
|
+
const imageGroups = [];
|
|
763
|
+
let offset = 0;
|
|
764
|
+
for (const part of parts) {
|
|
765
|
+
for (const group of params.imageGroups ?? []) if (group.start >= part.sourceStart && group.end <= part.sourceEnd) {
|
|
766
|
+
const shift = offset + part.prefixLength - part.sourceStart;
|
|
767
|
+
imageGroups.push({
|
|
768
|
+
...group,
|
|
769
|
+
start: group.start + shift,
|
|
770
|
+
end: group.end + shift
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
offset += part.text.length;
|
|
774
|
+
}
|
|
775
|
+
return {
|
|
776
|
+
promptText: parts.map((part) => part.text).join(""),
|
|
777
|
+
...imageGroups.length ? { imageGroups } : {}
|
|
778
|
+
};
|
|
779
|
+
};
|
|
722
780
|
const maxChars = typeof params.maxChars === "number" && Number.isFinite(params.maxChars) ? Math.max(0, Math.floor(params.maxChars)) : CODEX_TURN_START_TEXT_INPUT_MAX_CHARS;
|
|
723
|
-
if (params.promptText.length <= maxChars) return params.promptText;
|
|
781
|
+
if (params.promptText.length <= maxChars) return finish(slice(0, params.promptText.length));
|
|
724
782
|
const range = normalizeProjectedContextRange(params.contextRange, params.promptText.length);
|
|
725
783
|
if (!range) {
|
|
726
784
|
const preservedRange = normalizeProjectedContextRange(params.preservedRange, params.promptText.length);
|
|
727
|
-
if (!preservedRange) return params.promptText;
|
|
785
|
+
if (!preservedRange) return finish(slice(0, params.promptText.length));
|
|
728
786
|
const preservedText = params.promptText.slice(preservedRange.start, preservedRange.end);
|
|
729
|
-
if (!preservedText) return
|
|
730
|
-
if (preservedText.length >= maxChars) return
|
|
731
|
-
return
|
|
787
|
+
if (!preservedText) return finish(slice(0, params.promptText.length, maxChars));
|
|
788
|
+
if (preservedText.length >= maxChars) return finish(slice(preservedRange.start, preservedRange.end, maxChars));
|
|
789
|
+
return finish(slice(0, preservedRange.start, maxChars - preservedText.length), slice(preservedRange.start, preservedRange.end));
|
|
732
790
|
}
|
|
733
791
|
const beforeContext = params.promptText.slice(0, range.start);
|
|
734
|
-
const context = params.promptText.slice(range.start, range.end);
|
|
735
792
|
const afterContext = params.promptText.slice(range.end);
|
|
736
793
|
const requestRange = normalizeProjectedContextRange(params.requestRange, params.promptText.length);
|
|
737
794
|
if (requestRange && requestRange.start >= range.end && requestRange.end < params.promptText.length) {
|
|
738
795
|
const request = params.promptText.slice(requestRange.start, requestRange.end);
|
|
739
|
-
if (request.length >= maxChars) return
|
|
740
|
-
const fittedAppendedContext =
|
|
741
|
-
const
|
|
742
|
-
|
|
796
|
+
if (request.length >= maxChars) return finish(slice(requestRange.start, requestRange.end, maxChars));
|
|
797
|
+
const fittedAppendedContext = slice(requestRange.end, params.promptText.length, maxChars - request.length);
|
|
798
|
+
const contextBudget = maxChars - request.length - fittedAppendedContext.text.length;
|
|
799
|
+
const fittedContext = slice(range.start, range.end, contextBudget);
|
|
800
|
+
const beforeContextBudget = maxChars - fittedContext.text.length - request.length - fittedAppendedContext.text.length;
|
|
801
|
+
return finish(slice(0, range.start, beforeContextBudget), fittedContext, slice(requestRange.start, requestRange.end), fittedAppendedContext);
|
|
743
802
|
}
|
|
744
803
|
const contextBudget = maxChars - beforeContext.length - afterContext.length;
|
|
745
|
-
if (contextBudget > 0) return
|
|
746
|
-
const afterContextText =
|
|
747
|
-
|
|
804
|
+
if (contextBudget > 0) return finish(slice(0, range.start), slice(range.start, range.end, contextBudget), slice(range.end, params.promptText.length));
|
|
805
|
+
const afterContextText = slice(range.end, params.promptText.length, maxChars);
|
|
806
|
+
const contextBudgetAfterRequest = maxChars - afterContextText.text.length;
|
|
807
|
+
return finish(slice(range.start, range.end, contextBudgetAfterRequest), afterContextText);
|
|
748
808
|
}
|
|
749
809
|
function normalizeProjectedContextRange(range, textLength) {
|
|
750
810
|
if (!range) return;
|
|
@@ -765,7 +825,6 @@ function resolveProjectionPromptBudgetTokens(params) {
|
|
|
765
825
|
}
|
|
766
826
|
async function renderMessagesForCodexContext(messages, options) {
|
|
767
827
|
const tail = [];
|
|
768
|
-
const images = [];
|
|
769
828
|
let retainedImageChars = 0;
|
|
770
829
|
let totalChars = 0;
|
|
771
830
|
let retainedChars = 0;
|
|
@@ -786,19 +845,38 @@ async function renderMessagesForCodexContext(messages, options) {
|
|
|
786
845
|
imageChars > 0 && !imagesFit ? "[Attachment images omitted: context budget exceeded]" : void 0
|
|
787
846
|
].filter(Boolean).join("\n\n");
|
|
788
847
|
if (!text && acceptedImageChars === 0) continue;
|
|
789
|
-
const
|
|
848
|
+
const separator = totalChars > 0 ? "\n\n" : "";
|
|
849
|
+
const chunk = `[${message.role}${formatCodexContextSenderSuffix(message)}]\n${text}${separator}`;
|
|
790
850
|
totalChars += chunk.length;
|
|
791
851
|
if (remaining > 0) {
|
|
792
852
|
const retained = neutralizeCodexExplicitMentionSigils(chunk).slice(-(remaining - acceptedImageChars));
|
|
793
|
-
tail.push(
|
|
853
|
+
tail.push({
|
|
854
|
+
text: retained,
|
|
855
|
+
separatorLength: separator.length,
|
|
856
|
+
...imagesFit && files?.images.length && retained.length === chunk.length ? { images: files.images } : {}
|
|
857
|
+
});
|
|
794
858
|
retainedChars += retained.length + acceptedImageChars;
|
|
795
859
|
retainedImageChars += acceptedImageChars;
|
|
796
|
-
if (imagesFit && files?.images.length) images.unshift(...files.images);
|
|
797
860
|
}
|
|
798
861
|
}
|
|
862
|
+
const ordered = tail.toReversed();
|
|
863
|
+
const fitted = truncateOlderContext(ordered.map((entry) => entry.text).join(""), options.maxRenderedContextChars - retainedImageChars, totalChars);
|
|
864
|
+
const imageGroups = [];
|
|
865
|
+
let offset = 0;
|
|
866
|
+
for (const entry of ordered) {
|
|
867
|
+
if (entry.images && offset >= fitted.retainedStart) {
|
|
868
|
+
const start = offset - fitted.retainedStart + fitted.prefixLength;
|
|
869
|
+
imageGroups.push({
|
|
870
|
+
start,
|
|
871
|
+
end: start + entry.text.length - entry.separatorLength,
|
|
872
|
+
images: entry.images
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
offset += entry.text.length;
|
|
876
|
+
}
|
|
799
877
|
return {
|
|
800
|
-
text:
|
|
801
|
-
|
|
878
|
+
text: fitted.text,
|
|
879
|
+
imageGroups
|
|
802
880
|
};
|
|
803
881
|
}
|
|
804
882
|
function renderMessageBody(message, options) {
|
|
@@ -873,8 +951,12 @@ function summarizeToolInputShape(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
873
951
|
return `[${typeof value}]`;
|
|
874
952
|
}
|
|
875
953
|
function redactPreservedToolValue(key, value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
876
|
-
if (typeof value === "string"
|
|
877
|
-
|
|
954
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
955
|
+
const text = String(value);
|
|
956
|
+
const redacted = redactSensitiveFieldValue(key, redactToolPayloadText(text));
|
|
957
|
+
return redacted === text ? value : redacted;
|
|
958
|
+
}
|
|
959
|
+
if (value === null || value === void 0) return value;
|
|
878
960
|
if (Array.isArray(value)) {
|
|
879
961
|
if (seen.has(value)) return "[Circular]";
|
|
880
962
|
seen.add(value);
|
|
@@ -912,15 +994,32 @@ function truncateText(text, maxChars) {
|
|
|
912
994
|
return `${truncated}\n[truncated ${text.length - truncated.length} chars]`;
|
|
913
995
|
}
|
|
914
996
|
function truncateOlderContext(text, maxChars, totalChars = text.length) {
|
|
915
|
-
if (totalChars <= maxChars) return
|
|
916
|
-
|
|
997
|
+
if (totalChars <= maxChars) return {
|
|
998
|
+
text,
|
|
999
|
+
retainedStart: 0,
|
|
1000
|
+
prefixLength: 0
|
|
1001
|
+
};
|
|
1002
|
+
if (maxChars <= 0) return {
|
|
1003
|
+
text: "",
|
|
1004
|
+
retainedStart: text.length,
|
|
1005
|
+
prefixLength: 0
|
|
1006
|
+
};
|
|
917
1007
|
const buildMarker = (omittedChars) => `[truncated ${omittedChars} chars from older context]\n`;
|
|
918
1008
|
let marker = buildMarker(totalChars - maxChars);
|
|
919
1009
|
let tailChars = Math.max(0, maxChars - marker.length);
|
|
920
1010
|
marker = buildMarker(totalChars - tailChars);
|
|
921
|
-
if (marker.length >= maxChars) return
|
|
1011
|
+
if (marker.length >= maxChars) return {
|
|
1012
|
+
text: marker.slice(0, maxChars),
|
|
1013
|
+
retainedStart: text.length,
|
|
1014
|
+
prefixLength: maxChars
|
|
1015
|
+
};
|
|
922
1016
|
tailChars = maxChars - marker.length;
|
|
923
|
-
|
|
1017
|
+
const tail = sliceUtf16Safe(text, -tailChars).trimStart();
|
|
1018
|
+
return {
|
|
1019
|
+
text: `${marker}${tail}`,
|
|
1020
|
+
retainedStart: text.length - tail.length,
|
|
1021
|
+
prefixLength: marker.length
|
|
1022
|
+
};
|
|
924
1023
|
}
|
|
925
1024
|
//#endregion
|
|
926
1025
|
//#region extensions/codex/src/app-server/thread-context-engine.ts
|
|
@@ -1577,30 +1676,6 @@ async function discardUnattestedCodexPluginThread(params) {
|
|
|
1577
1676
|
}
|
|
1578
1677
|
}
|
|
1579
1678
|
//#endregion
|
|
1580
|
-
//#region extensions/codex/src/app-server/native-hook-relay-state.ts
|
|
1581
|
-
const pending = /* @__PURE__ */ new Set();
|
|
1582
|
-
/** Owns delayed hook-relay cleanup across runtime scheduling and test teardown. */
|
|
1583
|
-
const nativeHookRelayUnregisterQueue = {
|
|
1584
|
-
add(entry) {
|
|
1585
|
-
pending.add(entry);
|
|
1586
|
-
},
|
|
1587
|
-
delete(entry) {
|
|
1588
|
-
return pending.delete(entry);
|
|
1589
|
-
},
|
|
1590
|
-
flush() {
|
|
1591
|
-
while (pending.size > 0) {
|
|
1592
|
-
const entry = pending.values().next().value;
|
|
1593
|
-
if (!entry) return;
|
|
1594
|
-
clearTimeout(entry.timeout);
|
|
1595
|
-
entry.unregister();
|
|
1596
|
-
}
|
|
1597
|
-
},
|
|
1598
|
-
clear() {
|
|
1599
|
-
for (const entry of pending) clearTimeout(entry.timeout);
|
|
1600
|
-
pending.clear();
|
|
1601
|
-
}
|
|
1602
|
-
};
|
|
1603
|
-
//#endregion
|
|
1604
1679
|
//#region extensions/codex/src/app-server/native-hook-relay.ts
|
|
1605
1680
|
/**
|
|
1606
1681
|
* Bridges Codex native hook callbacks into OpenClaw's native hook relay so
|
|
@@ -1666,6 +1741,7 @@ function scheduleCodexNativeHookRelayUnregister(params) {
|
|
|
1666
1741
|
pending = void 0;
|
|
1667
1742
|
if (!nativeHookRelayUnregisterQueue.delete(current)) return;
|
|
1668
1743
|
params.relay.unregister();
|
|
1744
|
+
nativeHookRelayUnregisterQueue.track(params.relay.drain());
|
|
1669
1745
|
};
|
|
1670
1746
|
const timeout = setTimeout(unregister, resolveCodexNativeHookRelayUnregisterGraceMs(params.hookTimeoutSec));
|
|
1671
1747
|
pending = {
|
|
@@ -1708,7 +1784,7 @@ function createCodexNativeHookRelay(params) {
|
|
|
1708
1784
|
for (const pending of pendingDirectChildAdmissions.values()) pending.reject(new Error(reason));
|
|
1709
1785
|
pendingDirectChildAdmissions.clear();
|
|
1710
1786
|
};
|
|
1711
|
-
const relay =
|
|
1787
|
+
const relay = registerNativeHookRelayForBundledRuntime({
|
|
1712
1788
|
provider: "codex",
|
|
1713
1789
|
relayId: buildCodexNativeHookRelayId({
|
|
1714
1790
|
agentId: params.agentId,
|
|
@@ -1737,6 +1813,7 @@ function createCodexNativeHookRelay(params) {
|
|
|
1737
1813
|
}),
|
|
1738
1814
|
signal: params.signal,
|
|
1739
1815
|
runBeforeToolCall: params.hostCapabilities.runBeforeToolCall,
|
|
1816
|
+
approvalHost: params.hostCapabilities,
|
|
1740
1817
|
assertActive: () => {
|
|
1741
1818
|
params.hostCapabilities.assertActive();
|
|
1742
1819
|
params.assertCurrent?.();
|
|
@@ -1745,20 +1822,32 @@ function createCodexNativeHookRelay(params) {
|
|
|
1745
1822
|
readClaim: readCodexNativeChildThreadId,
|
|
1746
1823
|
shouldRetainAfterForegroundClose: () => successfulYieldRetentionAuthorized && directChildClaims.size > 0,
|
|
1747
1824
|
allowPreToolUse: (childThreadId) => directChildClaims.has(childThreadId),
|
|
1748
|
-
awaitForegroundAdmission: (childThreadId) => {
|
|
1825
|
+
awaitForegroundAdmission: (childThreadId, signal) => {
|
|
1749
1826
|
if (foregroundClosed) return Promise.reject(/* @__PURE__ */ new Error("native hook relay foreground admission unavailable"));
|
|
1750
1827
|
const existingClaim = directChildClaims.get(childThreadId);
|
|
1751
1828
|
if (existingClaim) return Promise.resolve(assertClaim(childThreadId, existingClaim));
|
|
1752
|
-
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1829
|
+
let pending = pendingDirectChildAdmissions.get(childThreadId);
|
|
1830
|
+
if (!pending) {
|
|
1831
|
+
if (pendingDirectChildAdmissions.size >= MAX_PENDING_DIRECT_CHILD_ADMISSIONS) return Promise.reject(/* @__PURE__ */ new Error("native hook relay foreground admission capacity reached"));
|
|
1832
|
+
pending = {
|
|
1833
|
+
...createDeferred(),
|
|
1834
|
+
waiters: 0
|
|
1835
|
+
};
|
|
1836
|
+
pendingDirectChildAdmissions.set(childThreadId, pending);
|
|
1837
|
+
}
|
|
1838
|
+
const admission = pending;
|
|
1839
|
+
admission.waiters++;
|
|
1840
|
+
let onAbort;
|
|
1841
|
+
return new Promise((resolve, reject) => {
|
|
1842
|
+
admission.promise.then(resolve, reject);
|
|
1843
|
+
onAbort = () => reject(toErrorObject(signal?.reason, "native hook relay admission aborted"));
|
|
1844
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1845
|
+
if (signal?.aborted) onAbort();
|
|
1846
|
+
}).then((claim) => assertClaim(childThreadId, claim)).finally(() => {
|
|
1847
|
+
if (onAbort) signal?.removeEventListener("abort", onAbort);
|
|
1848
|
+
admission.waiters--;
|
|
1849
|
+
if (admission.waiters === 0 && pendingDirectChildAdmissions.get(childThreadId) === admission) pendingDirectChildAdmissions.delete(childThreadId);
|
|
1760
1850
|
});
|
|
1761
|
-
return promise.then((claim) => assertClaim(childThreadId, claim));
|
|
1762
1851
|
},
|
|
1763
1852
|
onDispose: () => {
|
|
1764
1853
|
foregroundClosed = true;
|
|
@@ -1805,7 +1894,10 @@ function createCodexNativeHookRelay(params) {
|
|
|
1805
1894
|
released = true;
|
|
1806
1895
|
if (directChildClaims.get(threadId) !== claim) return;
|
|
1807
1896
|
directChildClaims.delete(threadId);
|
|
1808
|
-
if (foregroundClosed && directChildClaims.size === 0)
|
|
1897
|
+
if (foregroundClosed && directChildClaims.size === 0) {
|
|
1898
|
+
relay.unregister();
|
|
1899
|
+
nativeHookRelayUnregisterQueue.track(relay.drain());
|
|
1900
|
+
}
|
|
1809
1901
|
};
|
|
1810
1902
|
}
|
|
1811
1903
|
};
|
|
@@ -2056,6 +2148,7 @@ function resolveCodexAppServerModelProvider(params) {
|
|
|
2056
2148
|
//#region extensions/codex/src/app-server/thread-prompt.ts
|
|
2057
2149
|
function buildDeveloperInstructions(params, options = {}) {
|
|
2058
2150
|
const deferredToolNames = /* @__PURE__ */ new Set();
|
|
2151
|
+
let screenToolName;
|
|
2059
2152
|
let showWidgetToolName;
|
|
2060
2153
|
let dashboardToolName;
|
|
2061
2154
|
let portalToolName;
|
|
@@ -2074,6 +2167,7 @@ function buildDeveloperInstructions(params, options = {}) {
|
|
|
2074
2167
|
const name = tool.name.trim();
|
|
2075
2168
|
const qualifiedName = spec.type === "namespace" ? `${spec.name}.${name}` : name;
|
|
2076
2169
|
if (tool.deferLoading === true && name) deferredToolNames.add(name);
|
|
2170
|
+
if (name === "screen") screenToolName ??= qualifiedName;
|
|
2077
2171
|
if (name === "show_widget") showWidgetToolName ??= qualifiedName;
|
|
2078
2172
|
if (name === "dashboard") dashboardToolName ??= qualifiedName;
|
|
2079
2173
|
if (name === "portal") portalToolName ??= qualifiedName;
|
|
@@ -2117,6 +2211,7 @@ function buildDeveloperInstructions(params, options = {}) {
|
|
|
2117
2211
|
hasSessionsSend
|
|
2118
2212
|
}).join("\n") : void 0,
|
|
2119
2213
|
params.disableTools !== true && params.promptMode !== "minimal" && params.promptMode !== "none" ? buildUiPresentationPrompt({
|
|
2214
|
+
screenToolName,
|
|
2120
2215
|
showWidgetToolName,
|
|
2121
2216
|
dashboardToolName,
|
|
2122
2217
|
portalToolName,
|
|
@@ -2357,6 +2452,7 @@ function buildThreadStartParams(params, options) {
|
|
|
2357
2452
|
...(options.hostSystemAgentActive ?? isHostScopedAgentToolActive("openclaw")) && isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow) ? { baseInstructions: "" } : {},
|
|
2358
2453
|
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
2359
2454
|
serviceName: "OpenClaw",
|
|
2455
|
+
threadSource: "openclaw",
|
|
2360
2456
|
...resolveCodexThreadEnvironmentSelection(options),
|
|
2361
2457
|
dynamicTools: [...options.dynamicTools],
|
|
2362
2458
|
experimentalRawEvents: true,
|
|
@@ -2998,7 +3094,7 @@ async function prepareCodexThreadLifecyclePreflight(params) {
|
|
|
2998
3094
|
warn: (message) => embeddedAgentLog.warn(message),
|
|
2999
3095
|
onServerUnavailable: (serverName, error) => embeddedAgentLog.warn("skipping unavailable MCP OAuth server", {
|
|
3000
3096
|
serverName,
|
|
3001
|
-
error: formatErrorMessage(error)
|
|
3097
|
+
error: formatErrorMessage$1(error)
|
|
3002
3098
|
})
|
|
3003
3099
|
});
|
|
3004
3100
|
const nativeSkillIsolation = await lifecycleTiming.measure("native-skill-isolation", () => resolveCodexNativeSkillIsolation({
|
|
@@ -3085,8 +3181,14 @@ async function resumeExistingCodexThread(params, context) {
|
|
|
3085
3181
|
disposeConfiguration = configuration.dispose;
|
|
3086
3182
|
await context.releaseRetainedThread(configuration.assertCurrent);
|
|
3087
3183
|
configuration.assertCurrent();
|
|
3184
|
+
const clientBoundThread = ringZeroClientInstanceId !== void 0 || resumeBinding.ringZeroClientInstanceId !== void 0 || resumeBinding.ringZeroConfigFingerprint !== void 0 || context.ringZeroActive;
|
|
3185
|
+
const sharedEntry = getCurrentSharedClientEntry(params.client);
|
|
3186
|
+
if (configuration.settledSystemError && !clientBoundThread && resumeBinding.connectionScope !== "supervision" && (!sharedEntry || sharedEntry.activeLeases <= 1 && sharedEntry.pendingAcquires === 0) && !hasCodexAppServerSiblingThreadWork(params.client, resumeBinding.threadId) && !hasCodexAppServerSiblingRouteWork(params.client, resumeBinding.threadId)) {
|
|
3187
|
+
await abandonClient();
|
|
3188
|
+
throw new CodexThreadClientReplacementError();
|
|
3189
|
+
}
|
|
3088
3190
|
const authProfileId = resumeBinding.connectionScope === "supervision" ? void 0 : params.params.authProfileId ?? resumeBinding.authProfileId;
|
|
3089
|
-
const finalConfigPatch = context.prebuiltFinalConfigPatch ?? params.buildFinalConfigPatch?.({
|
|
3191
|
+
const finalConfigPatch = context.prebuiltFinalConfigPatch ?? await params.buildFinalConfigPatch?.({
|
|
3090
3192
|
action: "resume",
|
|
3091
3193
|
binding: resumeBinding
|
|
3092
3194
|
}) ?? {
|
|
@@ -3261,7 +3363,7 @@ async function startFreshCodexThread(params, context) {
|
|
|
3261
3363
|
const clientId = resolveCodexAppServerClientInstanceId(params.client);
|
|
3262
3364
|
const { bindingIdentity, startModelSelection, startModelProvider, userMcpServersConfigPatch, dynamicToolsFingerprint, dynamicToolsContainDeferred, webSearchThreadConfigFingerprint, nativeSkillIsolationFingerprint, userMcpServersFingerprint, ringZeroConfigFingerprint, ringZeroClientInstanceId, networkProxyConfigFingerprint, contextEngineBinding, environmentSelectionFingerprint, hostSystemAgentActive, restrictedToolSurface, restrictedToolSurfaceInheritedMcpServerNames, nativeSkillIsolation, lifecycleTiming, normalizeBindingModelProvider, throwIfAborted, prebuiltPluginThreadConfig, preserveExistingBinding, rotatedContextEngineBinding, replacementPredecessor } = context;
|
|
3263
3365
|
const pluginThreadConfig = params.pluginThreadConfig?.enabled ? prebuiltPluginThreadConfig ?? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0;
|
|
3264
|
-
const finalConfigPatch = params.buildFinalConfigPatch?.({ action: "start" }) ?? {
|
|
3366
|
+
const finalConfigPatch = await params.buildFinalConfigPatch?.({ action: "start" }) ?? {
|
|
3265
3367
|
configPatch: params.finalConfigPatch,
|
|
3266
3368
|
nativeHookRelayGeneration: params.nativeHookRelayGeneration
|
|
3267
3369
|
};
|
|
@@ -3496,7 +3598,7 @@ async function tryReuseCodexLiveThread(options) {
|
|
|
3496
3598
|
const incognito = isIncognitoSessionKey(params.params.sessionKey);
|
|
3497
3599
|
if (incognito && (binding.preserveNativeModel || binding.connectionScope === "supervision")) {
|
|
3498
3600
|
if (binding.clientId === clientId && binding.clientId && ((await options.buildLoadedPluginThreadConfig(binding))?.fingerprint ?? binding.pluginAppsFingerprint) === binding.pluginAppsFingerprint) {
|
|
3499
|
-
params.buildFinalConfigPatch?.({
|
|
3601
|
+
await params.buildFinalConfigPatch?.({
|
|
3500
3602
|
action: "resume",
|
|
3501
3603
|
binding
|
|
3502
3604
|
});
|
|
@@ -3532,7 +3634,7 @@ async function tryReuseCodexLiveThread(options) {
|
|
|
3532
3634
|
const pluginThreadConfig = await options.buildLoadedPluginThreadConfig(binding);
|
|
3533
3635
|
assertWarmOwner();
|
|
3534
3636
|
if (pluginThreadConfig && pluginThreadConfig.fingerprint !== binding.pluginAppsFingerprint) return { kind: "rotate" };
|
|
3535
|
-
const prebuiltFinalConfigPatch = params.buildFinalConfigPatch?.({
|
|
3637
|
+
const prebuiltFinalConfigPatch = await params.buildFinalConfigPatch?.({
|
|
3536
3638
|
action: "resume",
|
|
3537
3639
|
binding
|
|
3538
3640
|
}) ?? {
|
|
@@ -3767,7 +3869,8 @@ async function preparePendingCodexThreadResume(params, binding, dynamicToolsFing
|
|
|
3767
3869
|
return {
|
|
3768
3870
|
assertConfigured: observation.assertConfigured,
|
|
3769
3871
|
assertCurrent,
|
|
3770
|
-
dispose
|
|
3872
|
+
dispose,
|
|
3873
|
+
settledSystemError: observation.settledSystemError
|
|
3771
3874
|
};
|
|
3772
3875
|
} catch (error) {
|
|
3773
3876
|
dispose();
|
|
@@ -3776,7 +3879,7 @@ async function preparePendingCodexThreadResume(params, binding, dynamicToolsFing
|
|
|
3776
3879
|
}
|
|
3777
3880
|
/** Observe teardown before release; a successful resume alone can acknowledge ignored overrides. */
|
|
3778
3881
|
async function prepareCodexThreadResume(params, binding, context) {
|
|
3779
|
-
const assertClient = captureCodexAppServerClientLifetime(params.client, binding.connectionScope === "supervision" ? "connection" : "
|
|
3882
|
+
const assertClient = captureCodexAppServerClientLifetime(params.client, binding.connectionScope === "supervision" ? "connection" : "thread-configuration");
|
|
3780
3883
|
const assertCurrent = () => {
|
|
3781
3884
|
params.params.hostCapabilities.assertActive();
|
|
3782
3885
|
params.assertCurrent?.();
|
|
@@ -3802,11 +3905,13 @@ function isCodexThreadNonRunning(status) {
|
|
|
3802
3905
|
}
|
|
3803
3906
|
function observeCodexThreadConfiguration(params, thread, assertCurrent) {
|
|
3804
3907
|
if (!isCodexThreadNonRunning(thread.status)) throw new CodexAdoptedThreadActiveError();
|
|
3908
|
+
const settledSystemError = thread.status.type === "systemError";
|
|
3805
3909
|
let unloaded = thread.status.type === "notLoaded";
|
|
3806
3910
|
return {
|
|
3807
3911
|
dispose: params.client.addNotificationHandler((notification) => {
|
|
3808
3912
|
if (notification.method === "thread/status/changed" && isJsonObject(notification.params) && notification.params.threadId === thread.id && isJsonObject(notification.params.status) && notification.params.status.type === "notLoaded") unloaded = true;
|
|
3809
3913
|
}),
|
|
3914
|
+
settledSystemError,
|
|
3810
3915
|
assertConfigured: () => {
|
|
3811
3916
|
assertCurrent();
|
|
3812
3917
|
if (!unloaded) throw new Error("Codex did not confirm unloading its previous configuration. The thread is preserved; stop competing native work and reconnect before retrying.");
|
|
@@ -4166,7 +4271,7 @@ async function archiveSupervisionArtifact(client, threadId) {
|
|
|
4166
4271
|
await client.request("thread/archive", { threadId }, { timeoutMs: CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS });
|
|
4167
4272
|
return true;
|
|
4168
4273
|
} catch (error) {
|
|
4169
|
-
const message = formatErrorMessage(error).toLowerCase();
|
|
4274
|
+
const message = formatErrorMessage$1(error).toLowerCase();
|
|
4170
4275
|
if (message.includes("no rollout found for thread id") || message.includes("thread not found") || message.includes("already archived")) return true;
|
|
4171
4276
|
await unsubscribeCodexThreadBestEffort(client, {
|
|
4172
4277
|
threadId,
|
|
@@ -4247,7 +4352,7 @@ async function startOrResumeThread(input) {
|
|
|
4247
4352
|
await releaseRetainedThread(binding.threadId);
|
|
4248
4353
|
const pendingBinding = binding;
|
|
4249
4354
|
const pluginThreadConfig = params.pluginThreadConfig?.enabled ? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0;
|
|
4250
|
-
const finalConfigPatch = params.buildFinalConfigPatch?.({ action: "start" }) ?? {
|
|
4355
|
+
const finalConfigPatch = await params.buildFinalConfigPatch?.({ action: "start" }) ?? {
|
|
4251
4356
|
configPatch: params.finalConfigPatch,
|
|
4252
4357
|
nativeHookRelayGeneration: params.nativeHookRelayGeneration
|
|
4253
4358
|
};
|
|
@@ -4575,10 +4680,7 @@ const LEGACY_PRO_MODEL_ID_RE = /^gpt-5\.[45]-pro$/u;
|
|
|
4575
4680
|
const MODERN_GPT_5_MODEL_ID_RE = /^gpt-5\.(?:[3-9]|[1-9]\d)(?:$|-)/u;
|
|
4576
4681
|
/** Read reasoning metadata after the Codex app-server route has been selected. */
|
|
4577
4682
|
function readCodexSupportedReasoningEfforts(compat) {
|
|
4578
|
-
|
|
4579
|
-
const efforts = compat.supportedReasoningEfforts;
|
|
4580
|
-
if (!Array.isArray(efforts)) return;
|
|
4581
|
-
return efforts.filter((effort) => typeof effort === "string");
|
|
4683
|
+
return compat && "supportedReasoningEfforts" in compat ? compat.supportedReasoningEfforts : void 0;
|
|
4582
4684
|
}
|
|
4583
4685
|
function resolveSupportedReasoningEffort(params) {
|
|
4584
4686
|
const declared = new Set(params.supportedReasoningEfforts.map((effort) => effort.trim().toLowerCase()));
|
|
@@ -4591,23 +4693,40 @@ function resolveCodexAppServerReasoningEffort(params) {
|
|
|
4591
4693
|
if (params.thinkLevel === "ultra") return "ultra";
|
|
4592
4694
|
if (params.thinkLevel === "off") return params.supportedReasoningEfforts?.includes("none") ? "none" : null;
|
|
4593
4695
|
if (params.thinkLevel === "adaptive") return null;
|
|
4594
|
-
if (params.supportedReasoningEfforts) return resolveSupportedReasoningEffort({
|
|
4595
|
-
requested: params.thinkLevel,
|
|
4596
|
-
supportedReasoningEfforts: params.supportedReasoningEfforts
|
|
4597
|
-
}) ?? null;
|
|
4598
4696
|
const modelId = params.modelId.trim().toLowerCase();
|
|
4599
|
-
|
|
4697
|
+
const supportedReasoningEfforts = params.supportedReasoningEfforts ?? (LEGACY_PRO_MODEL_ID_RE.test(modelId) ? LEGACY_PRO_REASONING_EFFORTS : void 0);
|
|
4698
|
+
if (supportedReasoningEfforts) return resolveSupportedReasoningEffort({
|
|
4600
4699
|
requested: params.thinkLevel,
|
|
4601
|
-
supportedReasoningEfforts
|
|
4700
|
+
supportedReasoningEfforts
|
|
4602
4701
|
}) ?? null;
|
|
4603
4702
|
if (params.thinkLevel === "minimal" && MODERN_GPT_5_MODEL_ID_RE.test(modelId)) return "low";
|
|
4604
|
-
|
|
4605
|
-
return null;
|
|
4703
|
+
return params.thinkLevel === "max" ? null : params.thinkLevel;
|
|
4606
4704
|
}
|
|
4607
4705
|
//#endregion
|
|
4608
4706
|
//#region extensions/codex/src/app-server/user-input.ts
|
|
4707
|
+
function prependHistoryProvenance(input, historyProvenancePrefix) {
|
|
4708
|
+
if (!historyProvenancePrefix) return input;
|
|
4709
|
+
const firstTextIndex = input.findIndex((item) => item.type === "text");
|
|
4710
|
+
if (firstTextIndex === -1) return [{
|
|
4711
|
+
type: "text",
|
|
4712
|
+
text: historyProvenancePrefix,
|
|
4713
|
+
text_elements: []
|
|
4714
|
+
}, ...input];
|
|
4715
|
+
return input.map((item, index) => index === firstTextIndex && item.type === "text" ? {
|
|
4716
|
+
...item,
|
|
4717
|
+
text: `${historyProvenancePrefix}${item.text}`
|
|
4718
|
+
} : item);
|
|
4719
|
+
}
|
|
4609
4720
|
/** Builds ordered Codex user input for both new turns and same-turn steering. */
|
|
4610
|
-
function buildCodexUserInput(text, images) {
|
|
4721
|
+
function buildCodexUserInput(text, images, contextImageGroups, historyProvenancePrefix) {
|
|
4722
|
+
if (text !== void 0 && contextImageGroups?.length) {
|
|
4723
|
+
let offset = 0;
|
|
4724
|
+
return prependHistoryProvenance([...contextImageGroups.flatMap((group) => {
|
|
4725
|
+
const parts = buildCodexUserInput(text.slice(offset, group.end), group.images);
|
|
4726
|
+
offset = group.end;
|
|
4727
|
+
return parts;
|
|
4728
|
+
}), ...buildCodexUserInput(text.slice(offset), images)], historyProvenancePrefix);
|
|
4729
|
+
}
|
|
4611
4730
|
const imageInputs = (images ?? []).map((image) => {
|
|
4612
4731
|
const imageUrl = sanitizeInlineImageDataUrl(`data:${image.mimeType};base64,${image.data}`);
|
|
4613
4732
|
return imageUrl ? {
|
|
@@ -4619,16 +4738,16 @@ function buildCodexUserInput(text, images) {
|
|
|
4619
4738
|
text_elements: []
|
|
4620
4739
|
};
|
|
4621
4740
|
});
|
|
4622
|
-
return [...text === void 0 ? [] : [{
|
|
4741
|
+
return prependHistoryProvenance([...text === void 0 ? [] : [{
|
|
4623
4742
|
type: "text",
|
|
4624
4743
|
text,
|
|
4625
4744
|
text_elements: []
|
|
4626
|
-
}], ...imageInputs];
|
|
4745
|
+
}], ...imageInputs], historyProvenancePrefix);
|
|
4627
4746
|
}
|
|
4628
4747
|
//#endregion
|
|
4629
4748
|
//#region extensions/codex/src/app-server/turn-params.ts
|
|
4630
4749
|
const CODEX_CURRENT_SENDER_FIELD_MAX_CHARS = 256;
|
|
4631
|
-
function
|
|
4750
|
+
function readCodexCurrentSender(params) {
|
|
4632
4751
|
const metadata = asOptionalRecord(asOptionalRecord(params.userTurnTranscriptRecorder?.message)?.["__openclaw"]);
|
|
4633
4752
|
const recorded = [
|
|
4634
4753
|
normalizeOptionalString(metadata?.["senderId"]),
|
|
@@ -4642,11 +4761,19 @@ function buildCodexCurrentSenderContextValue(params) {
|
|
|
4642
4761
|
];
|
|
4643
4762
|
if (!id && !name && !username) return;
|
|
4644
4763
|
const bound = (value) => truncateUtf16Safe(value, CODEX_CURRENT_SENDER_FIELD_MAX_CHARS);
|
|
4645
|
-
return
|
|
4764
|
+
return {
|
|
4646
4765
|
...id ? { id: bound(id) } : {},
|
|
4647
4766
|
...name ? { name: bound(name) } : {},
|
|
4648
4767
|
...username ? { username: bound(username) } : {}
|
|
4649
|
-
}
|
|
4768
|
+
};
|
|
4769
|
+
}
|
|
4770
|
+
function buildCodexCurrentSenderContextValue(params) {
|
|
4771
|
+
const sender = readCodexCurrentSender(params);
|
|
4772
|
+
return sender ? JSON.stringify({ sender }) : void 0;
|
|
4773
|
+
}
|
|
4774
|
+
function buildCodexHistoryProvenancePrefix(params) {
|
|
4775
|
+
const sender = readCodexCurrentSender(params);
|
|
4776
|
+
return sender?.id ? neutralizeCodexExplicitMentionSigils(`[OpenClaw conversation info: sender=${JSON.stringify(sender)}]\n`) : void 0;
|
|
4650
4777
|
}
|
|
4651
4778
|
function buildTurnStartParams(params, options) {
|
|
4652
4779
|
const modelSelection = options.preserveNativeTurnSettings ? void 0 : resolveCodexAppServerRequestModelSelection({
|
|
@@ -4694,7 +4821,8 @@ function buildTurnStartParams(params, options) {
|
|
|
4694
4821
|
};
|
|
4695
4822
|
return {
|
|
4696
4823
|
threadId: options.threadId,
|
|
4697
|
-
|
|
4824
|
+
...params.trigger ? { turnTrigger: params.trigger } : {},
|
|
4825
|
+
input: [...buildCodexUserInput(options.promptText ?? params.prompt, params.images, options.contextImageGroups, options.historyProvenancePrefix ?? (params.trigger === "user" ? buildCodexHistoryProvenancePrefix(params) : void 0)), ...options.explicitSkillInputs ?? []],
|
|
4698
4826
|
...additionalContext ? { additionalContext } : {},
|
|
4699
4827
|
cwd: options.cwd,
|
|
4700
4828
|
...options.appServer.sessionRoot ? { runtimeWorkspaceRoots: [options.appServer.sessionRoot] } : {},
|
|
@@ -4758,7 +4886,7 @@ function buildDefaultCollaborationInstructions() {
|
|
|
4758
4886
|
"",
|
|
4759
4887
|
"Use the `request_user_input` tool only when it is listed in the available tools for this turn.",
|
|
4760
4888
|
"",
|
|
4761
|
-
"In Default mode, strongly prefer making reasonable assumptions and executing the user's request rather than stopping to ask questions.
|
|
4889
|
+
"In Default mode, strongly prefer making reasonable assumptions and executing the user's request rather than stopping to ask questions. When a missing preference, constraint, or clarification warrants a question, use `request_user_input_async` if it is available and continue independent work. Answers arrive as ordinary user messages. A suggested or preselected answer is not consent; wait for explicit approval before dependent actions that require it. If neither question tool is available, ask a concise plain-text question. Never write a multiple choice question as a textual assistant message."
|
|
4762
4890
|
].join("\n");
|
|
4763
4891
|
}
|
|
4764
4892
|
function buildCronCollaborationInstructions() {
|
|
@@ -4773,4 +4901,4 @@ function joinPresentSections(...sections) {
|
|
|
4773
4901
|
return sections.filter((section) => Boolean(section?.trim())).join("\n\n");
|
|
4774
4902
|
}
|
|
4775
4903
|
//#endregion
|
|
4776
|
-
export {
|
|
4904
|
+
export { areCodexDynamicToolFingerprintsCompatible as $, resolveCodexBindingModelProviderFallback as A, shouldBuildCodexPluginThreadConfig as At, buildCodexNativeHookRelayId as B, buildCodexNativeWebSearchThreadConfig as C, resolveCodexContinuityProjectionMaxChars as Ct, resolveCodexAppServerModelProvider as D, buildDisabledAppsConfigPatch as Dt, CODEX_NATIVE_PERSONALITY_NONE as E, buildCodexPluginThreadConfigTimeoutFallback as Et, CODEX_NATIVE_HOOK_RELAY_EVENTS as F, scheduleCodexNativeHookRelayUnregister as G, emitCodexNativePreToolUseFailureDiagnostic as H, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as I, hasCodexNativeToolCatalog as J, checkCodexThreadAppAvailability as K, assertCodexNativeHookRelayAllowed as L, readCodexMcpToolUiVisibility as M, buildCodexProjectDocThreadConfig as N, resolveCodexAppServerRequestModelSelection as O, mergeCodexThreadConfigs as Ot, isCodexAppServerProfilerEnabled as P, resolveCodexNativeSkillIsolation as Q, buildCodexNativeHookRelayConfig as R, readCodexInheritedMcpServerNames as S, resolveCodexContextEngineProjectionReserveTokens as St, buildDeveloperInstructions as T, buildCodexPluginThreadConfigInputFingerprint as Tt, resolveCodexNativeHookRelayEvents as U, createCodexNativeHookRelay as V, resolveCodexNativeHookRelayTtlMs as W, parseCodexNativeToolCatalog as X, loadCodexNativeToolCatalog as Y, applyCodexNativeSkillIsolation as Z, resolveScheduledCodexAppCreatorCaptureDecision as _, fitCodexProjectedContextForTurnStart as _t, buildTurnStartParams as a, filterCodexDynamicToolsForDisabledNativeSurface as at, buildCodexRuntimeThreadConfig as b, projectContextEngineAssemblyForCodex as bt, resolveCodexAppServerReasoningEffort as c, isSystemAgentOnlyCodexDynamicToolAllowlist as ct, buildLegacyScheduledCodexAppRecoveryPrompt as d, resolveCodexDynamicToolsLoadingForRuntime as dt, codexDynamicToolsFingerprint as et, buildScheduledCodexAppAuthorityInputFingerprint as f, buildContextEngineBinding as ft, readCurrentCodexScheduledAppPolicy as g, buildCodexContinuityCalibration as gt, intersectCodexPluginThreadConfigWithScheduledAuthority as h, CodexContextAttachmentError as ht, buildTurnCollaborationMode as i, filterCodexDynamicTools as it, readCodexMcpToolConnectorId as j, resolveCodexAppServerThreadModelSelection as k, refreshCodexPluginAppApprovalPolicy as kt, startOrResumeThread as l, normalizeCodexDynamicToolName as lt, captureScheduledCodexAppAuthority as m, CODEX_TURN_START_TEXT_INPUT_MAX_CHARS as mt, buildCodexParentLocalInstructions as n, fingerprintJsonObject as nt, buildCodexUserInput as o, isForcedPrivateQaCodexRuntime as ot, buildScheduledCodexAppServerConnectionIdentity as p, isContextEngineBindingCompatible as pt, attestCodexRestrictedToolSurfaceMcpServersDisabled as q, buildCodexTemporalAdditionalContext as r, fingerprintUserMcpServersConfigPatch as rt, readCodexSupportedReasoningEfforts as s, isMessageOnlyCodexSourceReply as st, buildCodexHistoryProvenancePrefix as t, codexLegacyDynamicToolsFingerprint as tt, assertScheduledCodexAppAuthorityRuntime as u, resolveCodexDynamicToolsLoading as ut, assertCodexManagedRequirementsDoNotOverrideToolPolicy as v, isCodexDurableCustomMessage as vt, resolveCodexWebSearchPlan as w, buildCodexPluginThreadConfig as wt, buildCodexThreadConfiguration as x, resolveCodexContextEngineProjectionMaxChars as xt, buildCodexRingZeroThreadConfigPatch as y, neutralizeCodexExplicitMentionSigils as yt, buildCodexNativeHookRelayDisabledConfig as z };
|