@openclaw/codex 2026.9.8 → 2026.10.1-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 +8 -0
- package/dist/.setup/{account-usage-runtime-G348lY1q.mjs → account-usage-runtime-DGqFpAud.mjs} +5 -5
- package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
- package/dist/.setup/{apply-Cqb-YoCS.mjs → apply-CXTudl9p.mjs} +48 -39
- package/dist/.setup/attempt-client-cleanup-BH0hW2xU.mjs +155 -0
- package/dist/.setup/{attempt-workspace-context-BJ5Z_olH.mjs → attempt-workspace-context-BY0jprWJ.mjs} +11 -15
- package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
- package/dist/.setup/{auth-cache-key-Dnps4W4_.mjs → auth-cache-key-CGm0UJOr.mjs} +244 -82
- package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
- package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
- package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
- package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
- package/dist/.setup/{bounded-turn-BNunZPtz.mjs → bounded-turn-pGsfXcmH.mjs} +14 -13
- package/dist/.setup/{build-state-DIQ5O_-S.mjs → build-state-CqQnsg7T.mjs} +1 -1
- package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
- package/dist/.setup/{client-qyUBJlGZ.mjs → client-C8lgBOoO.mjs} +438 -160
- package/dist/.setup/{client-catalog-response-DRvx_wCC.mjs → client-catalog-response-Bqp7WG51.mjs} +57 -25
- package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
- package/dist/.setup/{command-dispatch-Btrs1D6f.mjs → command-dispatch-DhBbFIQ5.mjs} +3 -3
- package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
- package/dist/.setup/{command-handlers-DvlCHJch.mjs → command-handlers-ztOOzm6O.mjs} +82 -144
- package/dist/.setup/{command-rpc-skzRq4wD.mjs → command-rpc-CuC5fPom.mjs} +23 -31
- package/dist/.setup/{compact-8ttks5U5.mjs → compact-tUb9AYfH.mjs} +117 -65
- package/dist/.setup/{plugin-metadata-cache-BRwtRct9.mjs → computer-use-BBN9y326.mjs} +65 -202
- package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
- package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
- package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
- package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
- package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
- package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
- package/dist/.setup/{conversation-binding-74LaGGH-.mjs → conversation-binding-B3MNMVzb.mjs} +36 -48
- package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
- package/dist/.setup/{conversation-control-OrN6zuaY.mjs → conversation-control-CYsMlCuE.mjs} +19 -21
- package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
- package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
- package/dist/.setup/dynamic-tool-build-C8xGEXmR.mjs +463 -0
- package/dist/.setup/{dynamic-tools-Db2sY5cZ.mjs → dynamic-tools-DyERJnR6.mjs} +238 -878
- package/dist/.setup/{effective-mcp-catalog-Bi6-SQ7i.mjs → effective-mcp-catalog-C26Mio5l.mjs} +83 -11
- package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
- package/dist/.setup/{ephemeral-turn-DiCS1ijR.mjs → ephemeral-turn-D8VcDTNo.mjs} +2 -2
- package/dist/.setup/{event-projector-assistant-message-MV_1dj-3.mjs → event-projector-assistant-message-BN7CNUB5.mjs} +2 -2
- package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
- package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
- package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
- package/dist/.setup/{isolated-completion-D80IXfQF.mjs → isolated-completion-C0jrcplS.mjs} +8 -8
- package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
- package/dist/.setup/mcp-app-session-preparation-BxN0_CYe.mjs +223 -0
- package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
- package/dist/.setup/{model-catalog-DiC0Tkha.mjs → model-catalog-DZyNeDKG.mjs} +7 -7
- package/dist/.setup/{models-DfLmPV0k.mjs → models-DSseKSMg.mjs} +10 -7
- package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
- package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
- package/dist/.setup/native-mcp-app-CqcPVmhH.mjs +310 -0
- package/dist/.setup/{native-subagent-monitor-BwkQXf9e.mjs → native-subagent-monitor-BUYOUp9X.mjs} +235 -318
- package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
- package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
- package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
- package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
- package/dist/.setup/{plan-DPdMk1Oy.mjs → plan-BJ37d2Og.mjs} +67 -89
- package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
- package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
- package/dist/.setup/plugin-approval-roundtrip-CuahdPLC.mjs +109 -0
- package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
- package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
- package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
- package/dist/.setup/plugin-thread-config-deadline-B8LGaZNW.mjs +124 -0
- package/dist/.setup/{provider-D6F_7p1I.mjs → provider-BnwHVD_z.mjs} +4 -4
- package/dist/.setup/provider-capabilities-D68Whix6.mjs +50 -0
- package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
- package/dist/.setup/{request-BZOfsSXW.mjs → request-jSbhc1sg.mjs} +189 -49
- package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
- package/dist/.setup/{run-attempt-dYJhjZrp.mjs → run-attempt-BLDZeYLD.mjs} +553 -727
- package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
- package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
- package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
- package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
- package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
- package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
- package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
- package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
- package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
- package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
- package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
- package/dist/.setup/{session-catalog-events-BMCFMZw-.mjs → session-catalog-events-Bdjw9HEn.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-DwJjnF5k.mjs → session-catalog-index-DufISKJ6.mjs} +361 -72
- package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
- package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
- package/dist/.setup/{session-catalog-native-projection-CuaFZuQE.mjs → session-catalog-native-projection-D6IiLtMb.mjs} +7 -6
- package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
- package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
- package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
- package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
- package/dist/.setup/{session-catalog-projection-CGfzfP93.mjs → session-catalog-projection-8aHNwzWD.mjs} +6 -122
- package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
- package/dist/.setup/{session-cli-DlmBHYIe.mjs → session-cli-kH4vuGod.mjs} +1 -2
- package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
- package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
- package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
- package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
- package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
- package/dist/.setup/{session-retirement-LlYWBKTJ.mjs → session-retirement-Czbchv_O.mjs} +14 -15
- package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
- package/dist/.setup/{settled-turn-finalizer-DW9W3gza.mjs → settled-turn-finalizer-DjZsIwbZ.mjs} +8 -8
- package/dist/.setup/{shared-client-CJCTeFpQ.mjs → shared-client-qhyYWbew.mjs} +291 -272
- package/dist/.setup/{provider-capabilities-DG5qbsUZ.mjs → shell-dynamic-tools-D3Brj3g9.mjs} +16 -55
- package/dist/.setup/{side-question-BLeGj7TQ.mjs → side-question-D3NJlgbl.mjs} +99 -91
- package/dist/.setup/{source-CJis_1EF.mjs → source-BYu0T780.mjs} +24 -40
- package/dist/.setup/{thread-lifecycle-_bAbjedG.mjs → thread-lifecycle-Cbz_7ySv.mjs} +262 -305
- package/dist/.setup/{thread-ownership-B6pPt21M.mjs → thread-ownership-DwuSrt3s.mjs} +10 -8
- package/dist/.setup/{thread-policy-gNPzzpVp.mjs → thread-policy-DoNxbhqt.mjs} +22 -21
- package/dist/.setup/{thread-requests-OWGOiDaV.mjs → thread-requests-CL1e8Wmx.mjs} +107 -98
- package/dist/.setup/{thread-resume-GOry0AYh.mjs → thread-resume-BT6NHMkM.mjs} +10 -18
- package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
- package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
- package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
- package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
- package/dist/.setup/{attempt-client-cleanup-B-S7ngS_.mjs → turn-router-sS69wYnI.mjs} +75 -170
- package/dist/.setup/{upstream-session-fork-gkdRj2yH.mjs → upstream-session-fork-ChSld66u.mjs} +35 -46
- package/dist/.setup/{usage-CApUvLOV.mjs → usage-D8e8Xiqf.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-wSMQkbpV.mjs → usage-limit-error-GbT-5NcW.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-UKgeiBUG.mjs → web-search-provider.runtime-dL2GD1Kl.mjs} +4 -20
- package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
- package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
- package/dist/api.js +34 -54
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +15 -27
- package/dist/harness.js +37 -22
- package/dist/index.js +2880 -276
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +2 -0
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +33 -4
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +3 -3
- package/package.json +6 -6
- package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
- package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
- package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
- package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
- package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
- package/dist/.setup/session-catalog-BFafIiF6.mjs +0 -2599
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
- package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +0 -153
package/dist/.setup/{client-catalog-response-DRvx_wCC.mjs → client-catalog-response-Bqp7WG51.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { n as projectCodexCatalogNativeResponse, r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-
|
|
3
|
-
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
2
|
+
import { n as projectCodexCatalogNativeResponse, r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-D6IiLtMb.mjs";
|
|
4
3
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
4
|
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
5
|
+
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/protocol-json.ts
|
|
7
7
|
function isRpcResponse(message) {
|
|
8
8
|
return message !== null && typeof message === "object" && "id" in message && (typeof message.id === "number" || typeof message.id === "string") && !("method" in message);
|
|
@@ -38,14 +38,14 @@ var CodexAppServerMessageDecoder = class {
|
|
|
38
38
|
try {
|
|
39
39
|
return JSON.parse(trimmed);
|
|
40
40
|
} catch (error) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
const text = rawLine.trimStart();
|
|
42
|
+
const inString = recoverableJsonStringState(text, error);
|
|
43
|
+
if (inString !== void 0) this.pending = {
|
|
44
|
+
fragments: [text],
|
|
45
|
+
length: text.length,
|
|
46
|
+
inString
|
|
47
|
+
};
|
|
48
|
+
else this.reportError(trimmed, error, 1);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
parseContinuation(line, pending) {
|
|
@@ -58,27 +58,35 @@ var CodexAppServerMessageDecoder = class {
|
|
|
58
58
|
try {
|
|
59
59
|
return JSON.parse(candidate);
|
|
60
60
|
} catch (error) {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const inString = withinBounds ? recoverableJsonStringState(candidate, error) : void 0;
|
|
62
|
+
if (inString !== void 0) {
|
|
63
|
+
pending.inString = inString;
|
|
63
64
|
this.pending = pending;
|
|
64
65
|
} else this.reportError(candidate, error, pending.fragments.length);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
function endsInsideJsonString(value) {
|
|
69
|
+
/** Undefined rejects malformed JSON; false retains a trailing escape for native parsing. */
|
|
70
|
+
function recoverableJsonStringState(value, error) {
|
|
71
|
+
if (!(error instanceof SyntaxError) || !value.startsWith("{") && !value.startsWith("[")) return;
|
|
72
|
+
const closers = [];
|
|
74
73
|
for (let index = 0; index < value.length; index++) {
|
|
75
|
-
|
|
74
|
+
const character = value[index];
|
|
75
|
+
if (character === "{" || character === "[") closers.push(character === "{" ? "}" : "]");
|
|
76
|
+
else if (character === "}" || character === "]") closers.pop();
|
|
77
|
+
if (character !== "\"") continue;
|
|
76
78
|
const end = scanJsonString(value, index + 1);
|
|
77
|
-
if (end < 0) return
|
|
78
|
-
if (end
|
|
79
|
+
if (end < 0) return;
|
|
80
|
+
if (end >= value.length) {
|
|
81
|
+
const closing = closers.toReversed().join("");
|
|
82
|
+
for (const suffix of ["\"", "\":null"]) try {
|
|
83
|
+
JSON.parse(`${value}\\n${suffix}${closing}`);
|
|
84
|
+
return end === value.length;
|
|
85
|
+
} catch {}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
79
88
|
index = end;
|
|
80
89
|
}
|
|
81
|
-
return false;
|
|
82
90
|
}
|
|
83
91
|
/** Finds a closing quote; incomplete or invalid escapes require native parsing. */
|
|
84
92
|
function scanJsonString(value, start) {
|
|
@@ -88,15 +96,39 @@ function scanJsonString(value, start) {
|
|
|
88
96
|
if (value.charCodeAt(index) < 32) return -1;
|
|
89
97
|
if (character !== "\\") continue;
|
|
90
98
|
const escape = value[++index];
|
|
91
|
-
if (escape
|
|
99
|
+
if (!escape) return value.length + 1;
|
|
100
|
+
else if (escape === "u") {
|
|
92
101
|
if (!UNICODE_ESCAPE_QUAD.test(value.slice(index + 1, index + 5))) return -1;
|
|
93
102
|
index += 4;
|
|
94
|
-
} else if (!
|
|
103
|
+
} else if (!"\"\\/bfnrt".includes(escape)) return -1;
|
|
95
104
|
}
|
|
96
105
|
return value.length;
|
|
97
106
|
}
|
|
98
107
|
//#endregion
|
|
99
108
|
//#region extensions/codex/src/app-server/client-message-frames.ts
|
|
109
|
+
function createCodexAppServerMessageWriter(options) {
|
|
110
|
+
return (message, onError, beforeWrite, onWriteResult) => {
|
|
111
|
+
if (options.isClosed()) return;
|
|
112
|
+
const child = options.getTransport();
|
|
113
|
+
const id = "id" in message ? message.id : void 0;
|
|
114
|
+
const method = "method" in message ? message.method : void 0;
|
|
115
|
+
const frame = stringifyCodexAppServerMessage(message);
|
|
116
|
+
if (child.maxFrameBytes && Buffer.byteLength(frame) > child.maxFrameBytes) throw new Error("Codex request exceeds the transport frame limit; reduce attached images or context.");
|
|
117
|
+
beforeWrite?.();
|
|
118
|
+
if (method === "command/exec") options.onNativeExecution();
|
|
119
|
+
child.stdin.write(`${frame}\n`, (error) => {
|
|
120
|
+
onWriteResult?.(error);
|
|
121
|
+
if (error) {
|
|
122
|
+
embeddedAgentLog.warn("codex app-server write failed", {
|
|
123
|
+
error,
|
|
124
|
+
id,
|
|
125
|
+
method
|
|
126
|
+
});
|
|
127
|
+
onError?.(error);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
}
|
|
100
132
|
const UNPAIRED_SURROGATE_RE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
|
|
101
133
|
/** One byte reader owns framing and stops at an asynchronous page decode. */
|
|
102
134
|
function listenCodexAppServerLines(input, onLine, onError) {
|
|
@@ -282,4 +314,4 @@ function projectCodexCatalogMessage(parsed, input, cachedPreview) {
|
|
|
282
314
|
return result;
|
|
283
315
|
}
|
|
284
316
|
//#endregion
|
|
285
|
-
export {
|
|
317
|
+
export { readCodexCatalogDecodeRoute as a, isRpcResponse as c, listenCodexAppServerLines as i, projectCodexCatalogMessage as n, CodexAppServerMessageDecoder as o, createCodexAppServerMessageWriter as r, redactCodexAppServerLinePreview as s, createCodexCatalogDecoder as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region extensions/codex/src/command-authorization.ts
|
|
2
|
+
const CODEX_NATIVE_EXECUTION_AUTH_ERROR = "Only an owner or operator.admin can control Codex native execution.";
|
|
3
|
+
const CODEX_HOST_INSPECTION_AUTH_ERROR = "Only an owner or operator.admin can inspect Codex host state.";
|
|
4
|
+
const CODEX_FULL_PERMISSIONS_AUTH_ERROR = "Full Codex permissions require operator.admin. Choose Admin in the Control UI permission picker, or use an admin-authenticated CLI.";
|
|
5
|
+
function hasCodexAdminScope(ctx) {
|
|
6
|
+
return ctx.gatewayClientScopes?.includes("operator.admin") === true;
|
|
7
|
+
}
|
|
8
|
+
function canMutateCodexHost(ctx) {
|
|
9
|
+
return ctx.senderIsOwner === true || hasCodexAdminScope(ctx);
|
|
10
|
+
}
|
|
11
|
+
function assertCodexHostOwnerCurrent(ctx) {
|
|
12
|
+
if (!hasCodexAdminScope(ctx)) ctx.assertOwnerCurrent?.();
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { canMutateCodexHost as a, assertCodexHostOwnerCurrent as i, CODEX_HOST_INSPECTION_AUTH_ERROR as n, hasCodexAdminScope as o, CODEX_NATIVE_EXECUTION_AUTH_ERROR as r, CODEX_FULL_PERMISSIONS_AUTH_ERROR as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as formatCodexDisplayText } from "./command-formatters-
|
|
2
|
-
import { n as describeControlFailure } from "./capabilities-
|
|
1
|
+
import { o as formatCodexDisplayText } from "./command-formatters-DV3DHhdr.mjs";
|
|
2
|
+
import { n as describeControlFailure } from "./capabilities-kQntafj_.mjs";
|
|
3
3
|
//#region extensions/codex/src/command-dispatch.ts
|
|
4
4
|
/** Dispatches a `/codex` command to the lazily loaded handler. */
|
|
5
5
|
async function handleCodexCommand(ctx, options) {
|
|
@@ -9,7 +9,7 @@ async function handleCodexCommand(ctx, options) {
|
|
|
9
9
|
};
|
|
10
10
|
const { resolvePluginConfig, ...subcommandOptions } = options;
|
|
11
11
|
try {
|
|
12
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
12
|
+
const { handleCodexSubcommand } = await import("./command-handlers-ztOOzm6O.mjs");
|
|
13
13
|
return await handleCodexSubcommand(commandContext, {
|
|
14
14
|
...subcommandOptions,
|
|
15
15
|
pluginConfig: resolvePluginConfig?.() ?? subcommandOptions.pluginConfig
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-
|
|
2
|
+
import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-CMPy24F5.mjs";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
//#region extensions/codex/src/command-account-email.ts
|
|
5
|
+
function isLikelyEmailAddress(value) {
|
|
6
|
+
return /^[^\s@<>()[\]`]+@[^\s@<>()[\]`]+\.[^\s@<>()[\]`]+$/.test(value);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
4
9
|
//#region extensions/codex/src/command-formatters.ts
|
|
5
10
|
/**
|
|
6
11
|
* Formats Codex command responses for safe chat display, including status,
|
|
@@ -141,9 +146,6 @@ function formatCodexAccountLine(value) {
|
|
|
141
146
|
formatted += escapeCodexChatText(safe.slice(lastIndex));
|
|
142
147
|
return formatted;
|
|
143
148
|
}
|
|
144
|
-
function isLikelyEmailAddress(value) {
|
|
145
|
-
return /^[^\s@<>()[\]`]+@[^\s@<>()[\]`]+\.[^\s@<>()[\]`]+$/.test(value);
|
|
146
|
-
}
|
|
147
149
|
function buildHelp() {
|
|
148
150
|
return [
|
|
149
151
|
"Codex commands:",
|
|
@@ -252,4 +254,4 @@ function extractArray(value) {
|
|
|
252
254
|
return [];
|
|
253
255
|
}
|
|
254
256
|
//#endregion
|
|
255
|
-
export { formatCodexAccountLine as a, formatCodexTextForDisplay as c, formatModels as d, formatSkills as f, formatAccount as i, formatComputerUseStatus as l, buildHelp as n, formatCodexDisplayText as o, formatThreads as p, escapeCodexChatText as r, formatCodexStatus as s, CODEX_RESUME_SAFE_THREAD_ID_PATTERN as t, formatList as u };
|
|
257
|
+
export { formatCodexAccountLine as a, formatCodexTextForDisplay as c, formatModels as d, formatSkills as f, formatAccount as i, formatComputerUseStatus as l, isLikelyEmailAddress as m, buildHelp as n, formatCodexDisplayText as o, formatThreads as p, escapeCodexChatText as r, formatCodexStatus as s, CODEX_RESUME_SAFE_THREAD_ID_PATTERN as t, formatList as u };
|
|
@@ -1,48 +1,51 @@
|
|
|
1
|
-
import { n as isCodexFastServiceTier } from "./config-utils-D0CXecki.mjs";
|
|
2
|
-
import { o as pluginReadParams, r as isOpenAiCuratedMarketplaceName, t as findCodexMarketplacePluginSummary, u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-Cky2XJUw.mjs";
|
|
3
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey } from "./session-binding-record-BZB8RgcF.mjs";
|
|
3
|
+
import { m as isCodexFastServiceTier } from "./config-parsing-BQq-CHTF.mjs";
|
|
4
|
+
import { c as resolveCodexAppServerPreparedApiKeyCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./auth-cache-key-CGm0UJOr.mjs";
|
|
6
5
|
import { n as withCodexConversationThreadActivity } from "./thread-ownership-queue-Dp24d7-F.mjs";
|
|
7
|
-
import { a as
|
|
8
|
-
import { l as formatRelativeDuration, s as summarizeCodexAccountUsage } from "./rate-limits-
|
|
9
|
-
import { a as formatCodexAccountLine, c as formatCodexTextForDisplay, d as formatModels, f as formatSkills, i as formatAccount, l as formatComputerUseStatus, n as buildHelp, o as formatCodexDisplayText, p as formatThreads, r as escapeCodexChatText, s as formatCodexStatus, t as CODEX_RESUME_SAFE_THREAD_ID_PATTERN, u as formatList } from "./command-formatters-
|
|
10
|
-
import { i as readCodexConversationBindingData, n as createCodexCliNodeConversationBindingData, o as resolveCodexDefaultWorkspaceDir, r as createCodexConversationBindingData } from "./conversation-binding-data-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import { o as formatCodexCliSessions } from "./node-cli-sessions-
|
|
15
|
-
import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-
|
|
16
|
-
import { i as resolveCodexBindingAppServerConnection } from "./binding-connection-
|
|
17
|
-
import {
|
|
18
|
-
import "./
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { n as
|
|
26
|
-
import { n as
|
|
27
|
-
import { n as
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { n as
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
6
|
+
import { a as canMutateCodexHost, i as assertCodexHostOwnerCurrent, n as CODEX_HOST_INSPECTION_AUTH_ERROR, o as hasCodexAdminScope, r as CODEX_NATIVE_EXECUTION_AUTH_ERROR, t as CODEX_FULL_PERMISSIONS_AUTH_ERROR } from "./command-authorization-AikPDtcc.mjs";
|
|
7
|
+
import { l as formatRelativeDuration, s as summarizeCodexAccountUsage } from "./rate-limits-CMPy24F5.mjs";
|
|
8
|
+
import { a as formatCodexAccountLine, c as formatCodexTextForDisplay, d as formatModels, f as formatSkills, i as formatAccount, l as formatComputerUseStatus, m as isLikelyEmailAddress, n as buildHelp, o as formatCodexDisplayText, p as formatThreads, r as escapeCodexChatText, s as formatCodexStatus, t as CODEX_RESUME_SAFE_THREAD_ID_PATTERN, u as formatList } from "./command-formatters-DV3DHhdr.mjs";
|
|
9
|
+
import { i as readCodexConversationBindingData, n as createCodexCliNodeConversationBindingData, o as resolveCodexDefaultWorkspaceDir, r as createCodexConversationBindingData } from "./conversation-binding-data-DJ4ix-W5.mjs";
|
|
10
|
+
import { r as CodexAppServerRpcError } from "./rpc-error-hmWM21RB.mjs";
|
|
11
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-kQntafj_.mjs";
|
|
12
|
+
import { n as filterCodexMarketplacePlugins, r as parseCodexPluginMarketplaceId, t as discoverCodexMarketplacePlugins } from "./plugin-marketplace-discovery-SQPhSuic.mjs";
|
|
13
|
+
import { o as formatCodexCliSessions } from "./node-cli-sessions-B5oNDkUS.mjs";
|
|
14
|
+
import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-BW8rd98k.mjs";
|
|
15
|
+
import { i as resolveCodexBindingAppServerConnection } from "./binding-connection-C-08ez1w.mjs";
|
|
16
|
+
import { a as withCodexAppServerJsonClient } from "./request-jSbhc1sg.mjs";
|
|
17
|
+
import { a as pluginReadParams, l as CODEX_PLUGINS_MARKETPLACE_NAME, n as isOpenAiCuratedMarketplaceName, t as findCodexMarketplacePluginSummary } from "./plugin-inventory-Bf0_piTw.mjs";
|
|
18
|
+
import "./config-0Gxk3_eq.mjs";
|
|
19
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-cUYrqu_a.mjs";
|
|
20
|
+
import { a as resolveCodexAppServerAuthProfileStore, i as resolveCodexAppServerAuthProfileIdForAgent, n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-CgHQ8Vot.mjs";
|
|
21
|
+
import { F as consumeCodexAppServerLiveThread, R as hasCodexAppServerLiveThread, c as getLeasedSharedCodexAppServerClient, et as resolveCodexAppServerAuthAccountCacheKey, h as releaseLeasedSharedCodexAppServerClient } from "./shared-client-qhyYWbew.mjs";
|
|
22
|
+
import { a as isCodexAppServerIndeterminateRequestCancellationError, h as assertCodexThreadResumeResponse, p as assertCodexThreadAcceptsDirectInput, s as isCodexAppServerPrewriteRequestCancellationError } from "./client-C8lgBOoO.mjs";
|
|
23
|
+
import { o as closeCodexStartupClientBestEffort } from "./attempt-client-cleanup-BH0hW2xU.mjs";
|
|
24
|
+
import { n as fingerprintCodexAppServerAuthBinding } from "./auth-binding-BoMwpuPN.mjs";
|
|
25
|
+
import { n as listAllCodexAppServerModels } from "./models-DSseKSMg.mjs";
|
|
26
|
+
import { n as refreshCodexAppRuntimeState, r as refreshCodexPluginRuntimeState } from "./plugin-activation-BcyBv8PG.mjs";
|
|
27
|
+
import { o as createCodexSessionGenerationSupersededError, r as resolveCodexSessionBinding } from "./session-binding-Ce7BqiPN.mjs";
|
|
28
|
+
import { i as assertCodexSupervisionThreadLineage } from "./thread-policy-DoNxbhqt.mjs";
|
|
29
|
+
import { a as rollbackCodexAppServerBindingSubscription, c as withExclusiveCodexAppServerThread, i as retireCodexConversationThreadBinding, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-DwuSrt3s.mjs";
|
|
30
|
+
import { n as resolveCodexNativeSandboxBlock, t as resolveCodexNativeExecutionBlock } from "./sandbox-guard-WqE8yPge.mjs";
|
|
31
|
+
import { t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-DWnB7VMj.mjs";
|
|
32
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-BBN9y326.mjs";
|
|
33
|
+
import { a as requestOptions, i as readCodexStatusProbes, o as safeCodexControlRequest, r as prepareCodexControlSessionAuth, t as codexControlRequest } from "./command-rpc-CuC5fPom.mjs";
|
|
34
|
+
import { a as readCodexConversationActiveTurn, c as setCodexConversationModel, d as stopCodexConversationTurn, i as parseCodexPermissionsModeArg, l as setCodexConversationPermissions, n as formatPermissionsMode, r as parseCodexFastModeArg, s as setCodexConversationFastMode, u as steerCodexConversationTurn } from "./conversation-control-CYsMlCuE.mjs";
|
|
34
35
|
import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
35
36
|
import crypto from "node:crypto";
|
|
36
37
|
import { isDeepStrictEqual } from "node:util";
|
|
37
38
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
38
39
|
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
39
40
|
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
41
|
+
import { isIncognitoSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
|
|
40
42
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
41
43
|
import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
42
44
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
43
45
|
import { ensureAuthProfileStore, resolveAgentDir as resolveAgentDir$1, resolveAgentWorkspaceDir, resolveAuthProfileEligibility, resolveProfileUnusableUntilForDisplay } from "openclaw/plugin-sdk/agent-runtime";
|
|
44
46
|
import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
45
47
|
import { findNormalizedProviderValue, resolveAuthProfileOrder } from "openclaw/plugin-sdk/provider-auth";
|
|
48
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
46
49
|
import { renderMessagePresentationFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
|
|
47
50
|
import { MODEL_SELECTION_LOCKED_MESSAGE, isModelSelectionLocked, resolvePersistedSessionRuntimeId } from "openclaw/plugin-sdk/model-session-runtime";
|
|
48
51
|
//#region extensions/codex/src/command-account.ts
|
|
@@ -173,15 +176,13 @@ function isChatGptSubscriptionProfile(credential) {
|
|
|
173
176
|
}
|
|
174
177
|
function formatProfileKind(credential) {
|
|
175
178
|
if (!credential) return "credential";
|
|
176
|
-
|
|
177
|
-
if (credential.type === "api_key") return "API key";
|
|
178
|
-
return "credential";
|
|
179
|
+
return credential.type === "api_key" ? "API key" : "ChatGPT subscription";
|
|
179
180
|
}
|
|
180
181
|
function formatProfileLabel(profileId, credential) {
|
|
181
182
|
const tail = profileId.includes(":") ? profileId.slice(profileId.indexOf(":") + 1) : profileId;
|
|
182
183
|
const displayName = credential?.displayName?.trim();
|
|
183
184
|
if (displayName) return credential?.type === "api_key" ? simplifyApiKeyDisplayName(displayName, tail) : displayName;
|
|
184
|
-
const email = credential?.email?.trim() ??
|
|
185
|
+
const email = credential?.email?.trim() ?? (isLikelyEmailAddress(tail) ? tail : void 0);
|
|
185
186
|
if (email) return email;
|
|
186
187
|
if (credential?.type === "api_key") return tail || "API key";
|
|
187
188
|
return humanizeProfileTail(tail);
|
|
@@ -210,10 +211,6 @@ function splitProfileTail(tail) {
|
|
|
210
211
|
function titleCase(value) {
|
|
211
212
|
return value ? `${value[0]?.toUpperCase() ?? ""}${value.slice(1)}` : value;
|
|
212
213
|
}
|
|
213
|
-
function extractEmailFromProfileId(profileId) {
|
|
214
|
-
const tail = profileId.includes(":") ? profileId.slice(profileId.indexOf(":") + 1) : profileId;
|
|
215
|
-
return /^[^\s@<>()[\]`]+@[^\s@<>()[\]`]+\.[^\s@<>()[\]`]+$/.test(tail) ? tail : void 0;
|
|
216
|
-
}
|
|
217
214
|
function describeFailureStatus(reason, credential) {
|
|
218
215
|
if (reason === "auth" || reason === "auth_permanent" || reason === "session_expired") return credential?.type === "api_key" ? "auth failed - check key" : "sign-in expired";
|
|
219
216
|
if (reason === "billing") return "billing unavailable";
|
|
@@ -290,14 +287,11 @@ function buildCodexPluginStatusButtons(pluginId, canRefreshHostedApps) {
|
|
|
290
287
|
}
|
|
291
288
|
function safeCodexAppLink(value) {
|
|
292
289
|
if (!value || value.length > 2048 || /[\s\p{Cc}\p{Cf}<>]/u.test(value)) return;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
} catch {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
290
|
+
const url = URL.parse(value);
|
|
291
|
+
if (!url) return;
|
|
292
|
+
const host = url.hostname;
|
|
293
|
+
const hosted = host === "chatgpt.com" || host === "chatgpt-staging.com" || host.endsWith(".chatgpt.com") || host.endsWith(".chatgpt-staging.com");
|
|
294
|
+
return url.protocol === "https:" && !url.username && !url.password && hosted ? value : void 0;
|
|
301
295
|
}
|
|
302
296
|
//#endregion
|
|
303
297
|
//#region extensions/codex/src/command-plugin-config.ts
|
|
@@ -997,7 +991,8 @@ function parseComputerUseArgs(args) {
|
|
|
997
991
|
parsed.help = true;
|
|
998
992
|
continue;
|
|
999
993
|
}
|
|
1000
|
-
parsed.overrides[option] = value;
|
|
994
|
+
parsed.overrides[option] = value.trim();
|
|
995
|
+
parsed.hasOverrides = true;
|
|
1001
996
|
index += 1;
|
|
1002
997
|
continue;
|
|
1003
998
|
}
|
|
@@ -1014,19 +1009,6 @@ function parseComputerUseArgs(args) {
|
|
|
1014
1009
|
}
|
|
1015
1010
|
parsed.help = true;
|
|
1016
1011
|
}
|
|
1017
|
-
const overrides = parsed.overrides;
|
|
1018
|
-
parsed.overrides = {};
|
|
1019
|
-
for (const key of [
|
|
1020
|
-
"marketplaceSource",
|
|
1021
|
-
"marketplacePath",
|
|
1022
|
-
"marketplaceName"
|
|
1023
|
-
]) {
|
|
1024
|
-
const value = normalizeOptionalString(overrides[key]);
|
|
1025
|
-
if (value) {
|
|
1026
|
-
parsed.overrides[key] = value;
|
|
1027
|
-
parsed.hasOverrides = true;
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
1012
|
return parsed;
|
|
1031
1013
|
}
|
|
1032
1014
|
function formatComputerUsePersistentIdentityMigration(parsed) {
|
|
@@ -1097,20 +1079,11 @@ function createCodexDiagnosticsConfirmation(params) {
|
|
|
1097
1079
|
const token = crypto.randomBytes(6).toString("hex");
|
|
1098
1080
|
scopeTokens.push(token);
|
|
1099
1081
|
pendingCodexDiagnosticsConfirmationTokensByScope.set(params.scopeKey, scopeTokens);
|
|
1082
|
+
const { now, ...confirmation } = params;
|
|
1100
1083
|
pendingCodexDiagnosticsConfirmations.set(token, {
|
|
1084
|
+
...confirmation,
|
|
1101
1085
|
token,
|
|
1102
|
-
|
|
1103
|
-
note: params.note,
|
|
1104
|
-
senderId: params.senderId,
|
|
1105
|
-
channel: params.channel,
|
|
1106
|
-
accountId: params.accountId,
|
|
1107
|
-
channelId: params.channelId,
|
|
1108
|
-
messageThreadId: params.messageThreadId,
|
|
1109
|
-
threadParentId: params.threadParentId,
|
|
1110
|
-
sessionKey: params.sessionKey,
|
|
1111
|
-
scopeKey: params.scopeKey,
|
|
1112
|
-
...params.privateRouted === void 0 ? {} : { privateRouted: params.privateRouted },
|
|
1113
|
-
createdAt: params.now
|
|
1086
|
+
createdAt: now
|
|
1114
1087
|
});
|
|
1115
1088
|
return token;
|
|
1116
1089
|
}
|
|
@@ -1186,19 +1159,15 @@ function formatCodexDiagnosticsUploadResult(sent, failed) {
|
|
|
1186
1159
|
}
|
|
1187
1160
|
function formatCodexDiagnosticsTargetLines(targets) {
|
|
1188
1161
|
return targets.flatMap((target, index) => {
|
|
1189
|
-
const lines =
|
|
1162
|
+
const lines = [`Session ${index + 1}`];
|
|
1163
|
+
if (target.channel) lines.push(`Channel: ${formatCodexDisplayText(target.channel)}`);
|
|
1164
|
+
if (target.sessionKey) lines.push(`OpenClaw session key: ${formatCodexCopyableValueForDisplay(target.sessionKey)}`);
|
|
1165
|
+
if (target.sessionId) lines.push(`OpenClaw session id: ${formatCodexCopyableValueForDisplay(target.sessionId)}`);
|
|
1166
|
+
lines.push(`Codex thread id: ${formatCodexCopyableValueForDisplay(target.threadId)}`);
|
|
1167
|
+
lines.push(`Inspect locally: ${formatCodexResumeCommandForDisplay(target.threadId)}`);
|
|
1190
1168
|
return index < targets.length - 1 ? [...lines, ""] : lines;
|
|
1191
1169
|
});
|
|
1192
1170
|
}
|
|
1193
|
-
function formatCodexDiagnosticsTargetBlock(target, index) {
|
|
1194
|
-
const lines = [`Session ${index + 1}`];
|
|
1195
|
-
if (target.channel) lines.push(`Channel: ${formatCodexDisplayText(target.channel)}`);
|
|
1196
|
-
if (target.sessionKey) lines.push(`OpenClaw session key: ${formatCodexCopyableValueForDisplay(target.sessionKey)}`);
|
|
1197
|
-
if (target.sessionId) lines.push(`OpenClaw session id: ${formatCodexCopyableValueForDisplay(target.sessionId)}`);
|
|
1198
|
-
lines.push(`Codex thread id: ${formatCodexCopyableValueForDisplay(target.threadId)}`);
|
|
1199
|
-
lines.push(`Inspect locally: ${formatCodexResumeCommandForDisplay(target.threadId)}`);
|
|
1200
|
-
return lines;
|
|
1201
|
-
}
|
|
1202
1171
|
function formatCodexDiagnosticsTargetLine(target) {
|
|
1203
1172
|
const parts = [];
|
|
1204
1173
|
if (target.channel) parts.push(`channel ${formatCodexDisplayText(target.channel)}`);
|
|
@@ -1219,7 +1188,7 @@ function readCodexDiagnosticsTargetsCooldownMessage(targets, ctx, now, options =
|
|
|
1219
1188
|
if (scopeCooldownMs > 0) return `Codex diagnostics were already sent for this account or channel recently. Try again in ${Math.ceil(scopeCooldownMs / 1e3)}s.`;
|
|
1220
1189
|
}
|
|
1221
1190
|
function recordCodexDiagnosticsUpload(threadId, ctx, now, cooldownScope) {
|
|
1222
|
-
|
|
1191
|
+
for (const map of [lastCodexDiagnosticsUploadByThread, lastCodexDiagnosticsUploadByScope]) for (const [key, lastSentAt] of map) if (now - lastSentAt >= CODEX_DIAGNOSTICS_COOLDOWN_MS) map.delete(key);
|
|
1223
1192
|
recordBoundedCodexDiagnosticsCooldown(lastCodexDiagnosticsUploadByScope, cooldownScope ?? readCodexDiagnosticsCooldownScope(ctx), CODEX_DIAGNOSTICS_COOLDOWN_MAX_SCOPES, now);
|
|
1224
1193
|
recordBoundedCodexDiagnosticsCooldown(lastCodexDiagnosticsUploadByThread, threadId, CODEX_DIAGNOSTICS_COOLDOWN_MAX_THREADS, now);
|
|
1225
1194
|
}
|
|
@@ -1256,20 +1225,9 @@ function readCodexDiagnosticsCooldownMs(map, key, now) {
|
|
|
1256
1225
|
return remainingMs;
|
|
1257
1226
|
}
|
|
1258
1227
|
function recordBoundedCodexDiagnosticsCooldown(map, key, maxSize, now) {
|
|
1259
|
-
if (!map.has(key))
|
|
1260
|
-
const oldestKey = map.keys().next().value;
|
|
1261
|
-
if (typeof oldestKey !== "string") break;
|
|
1262
|
-
map.delete(oldestKey);
|
|
1263
|
-
}
|
|
1228
|
+
if (!map.has(key)) pruneMapToMaxSize(map, maxSize - 1);
|
|
1264
1229
|
map.set(key, now);
|
|
1265
1230
|
}
|
|
1266
|
-
function pruneCodexDiagnosticsCooldowns(now) {
|
|
1267
|
-
pruneCodexDiagnosticsCooldownMap(lastCodexDiagnosticsUploadByThread, now);
|
|
1268
|
-
pruneCodexDiagnosticsCooldownMap(lastCodexDiagnosticsUploadByScope, now);
|
|
1269
|
-
}
|
|
1270
|
-
function pruneCodexDiagnosticsCooldownMap(map, now) {
|
|
1271
|
-
for (const [key, lastSentAt] of map) if (now - lastSentAt >= CODEX_DIAGNOSTICS_COOLDOWN_MS) map.delete(key);
|
|
1272
|
-
}
|
|
1273
1231
|
function formatCodexErrorForDisplay(error) {
|
|
1274
1232
|
const safe = truncateUtf16Safe(formatCodexTextForDisplay(error), CODEX_DIAGNOSTICS_ERROR_MAX_CHARS);
|
|
1275
1233
|
return escapeCodexChatText(safe) || "unknown error";
|
|
@@ -1358,7 +1316,7 @@ async function resolvePreparedCodexCommandAuthority(deps, ctx) {
|
|
|
1358
1316
|
config: ctx.config,
|
|
1359
1317
|
storePath
|
|
1360
1318
|
}) : void 0;
|
|
1361
|
-
const assertHostCurrent = currentSession?.
|
|
1319
|
+
const assertHostCurrent = currentSession?.authority.assertLegacyCurrent ?? (() => {});
|
|
1362
1320
|
const binding = (target && (!sessionIdentity || !isDeepStrictEqual(target.identity, sessionIdentity)) ? await resolveCodexSessionBinding({
|
|
1363
1321
|
bindingStore: deps.bindingStore,
|
|
1364
1322
|
identity: target.identity,
|
|
@@ -1454,13 +1412,13 @@ async function handleCodexDiagnosticsFeedback(deps, context, pluginConfig, args,
|
|
|
1454
1412
|
if (parsed.action === "usage") return { text: formatDiagnosticsUsage(commandPrefix) };
|
|
1455
1413
|
if (parsed.action === "confirm") return { text: await confirmCodexDiagnosticsFeedback(deps, ctx, pluginConfig, parsed.token) };
|
|
1456
1414
|
if (parsed.action === "cancel") return { text: cancelCodexDiagnosticsFeedback(ctx, parsed.token) };
|
|
1457
|
-
if (ctx.diagnosticsUploadApproved === true) return { text: await sendCodexDiagnosticsFeedbackForContext(deps, ctx, pluginConfig, parsed.note) };
|
|
1458
|
-
if (ctx.diagnosticsPreviewOnly === true) return { text: await previewCodexDiagnosticsFeedbackApproval(deps, ctx, parsed.note) };
|
|
1459
|
-
return await requestCodexDiagnosticsFeedbackApproval(deps, ctx, parsed.note, commandPrefix);
|
|
1460
|
-
}
|
|
1461
|
-
async function requestCodexDiagnosticsFeedbackApproval(deps, ctx, note, commandPrefix) {
|
|
1462
1415
|
const targets = await requireCodexDiagnosticsTargets(deps, ctx);
|
|
1463
1416
|
if (typeof targets === "string") return { text: targets };
|
|
1417
|
+
if (ctx.diagnosticsUploadApproved === true) return { text: await sendCodexDiagnosticsFeedbackForTargets(deps, ctx, pluginConfig, parsed.note, targets) };
|
|
1418
|
+
if (ctx.diagnosticsPreviewOnly === true) return { text: previewCodexDiagnosticsFeedbackApproval(targets, ctx, parsed.note) };
|
|
1419
|
+
return requestCodexDiagnosticsFeedbackApproval(targets, ctx, parsed.note, commandPrefix);
|
|
1420
|
+
}
|
|
1421
|
+
function requestCodexDiagnosticsFeedbackApproval(targets, ctx, note, commandPrefix) {
|
|
1464
1422
|
const now = Date.now();
|
|
1465
1423
|
const cooldownMessage = readCodexDiagnosticsTargetsCooldownMessage(targets, ctx, now);
|
|
1466
1424
|
if (cooldownMessage) return { text: cooldownMessage };
|
|
@@ -1513,9 +1471,7 @@ async function requestCodexDiagnosticsFeedbackApproval(deps, ctx, note, commandP
|
|
|
1513
1471
|
}] }
|
|
1514
1472
|
};
|
|
1515
1473
|
}
|
|
1516
|
-
|
|
1517
|
-
const targets = await requireCodexDiagnosticsTargets(deps, ctx);
|
|
1518
|
-
if (typeof targets === "string") return targets;
|
|
1474
|
+
function previewCodexDiagnosticsFeedbackApproval(targets, ctx, note) {
|
|
1519
1475
|
const cooldownMessage = readCodexDiagnosticsTargetsCooldownMessage(targets, ctx, Date.now(), { includeThreadId: false });
|
|
1520
1476
|
if (cooldownMessage) return cooldownMessage;
|
|
1521
1477
|
const reason = normalizeDiagnosticsReason(note);
|
|
@@ -1534,7 +1490,7 @@ async function confirmCodexDiagnosticsFeedback(deps, ctx, pluginConfig, token) {
|
|
|
1534
1490
|
if (!pending.privateRouted && !await hasAnyCodexDiagnosticsIdentity(ctx)) return "Cannot send Codex diagnostics because this command did not include a stable session identity.";
|
|
1535
1491
|
const currentTargets = pending.privateRouted ? resolvePendingCodexDiagnosticsTargets(deps, pending.targets, ctx.config) : await resolveCodexDiagnosticsTargets(deps, ctx);
|
|
1536
1492
|
if (!codexDiagnosticsTargetsMatch(pending.targets, currentTargets)) return "The Codex diagnostics sessions changed before confirmation. Run /diagnostics again for the current threads.";
|
|
1537
|
-
return await sendCodexDiagnosticsFeedbackForTargets(deps, ctx, pluginConfig, pending.note ?? "", currentTargets,
|
|
1493
|
+
return await sendCodexDiagnosticsFeedbackForTargets(deps, ctx, pluginConfig, pending.note ?? "", currentTargets, pending.scopeKey);
|
|
1538
1494
|
}
|
|
1539
1495
|
function cancelCodexDiagnosticsFeedback(ctx, token) {
|
|
1540
1496
|
const pending = consumeCodexDiagnosticsConfirmation(ctx, token, "cancel");
|
|
@@ -1545,15 +1501,10 @@ function cancelCodexDiagnosticsFeedback(ctx, token) {
|
|
|
1545
1501
|
...formatCodexDiagnosticsTargetLines(pending.targets)
|
|
1546
1502
|
].join("\n");
|
|
1547
1503
|
}
|
|
1548
|
-
async function
|
|
1549
|
-
const targets = await requireCodexDiagnosticsTargets(deps, ctx);
|
|
1550
|
-
if (typeof targets === "string") return targets;
|
|
1551
|
-
return await sendCodexDiagnosticsFeedbackForTargets(deps, ctx, pluginConfig, note, targets);
|
|
1552
|
-
}
|
|
1553
|
-
async function sendCodexDiagnosticsFeedbackForTargets(deps, ctx, pluginConfig, note, targets, options = {}) {
|
|
1504
|
+
async function sendCodexDiagnosticsFeedbackForTargets(deps, ctx, pluginConfig, note, targets, cooldownScope) {
|
|
1554
1505
|
if (targets.length === 0) return NO_DIAGNOSTICS_THREAD;
|
|
1555
1506
|
const now = Date.now();
|
|
1556
|
-
const cooldownMessage = readCodexDiagnosticsTargetsCooldownMessage(targets, ctx, now, { cooldownScope
|
|
1507
|
+
const cooldownMessage = readCodexDiagnosticsTargetsCooldownMessage(targets, ctx, now, { cooldownScope });
|
|
1557
1508
|
if (cooldownMessage) return cooldownMessage;
|
|
1558
1509
|
const reason = normalizeDiagnosticsReason(note);
|
|
1559
1510
|
const sent = [];
|
|
@@ -1608,7 +1559,7 @@ async function sendCodexDiagnosticsFeedbackForTargets(deps, ctx, pluginConfig, n
|
|
|
1608
1559
|
...target,
|
|
1609
1560
|
threadId: responseThreadId ?? target.threadId
|
|
1610
1561
|
});
|
|
1611
|
-
recordCodexDiagnosticsUpload(target.threadId, ctx, now,
|
|
1562
|
+
recordCodexDiagnosticsUpload(target.threadId, ctx, now, cooldownScope);
|
|
1612
1563
|
}
|
|
1613
1564
|
return formatCodexDiagnosticsUploadResult(sent, failed);
|
|
1614
1565
|
}
|
|
@@ -1891,13 +1842,14 @@ async function resumeThread(deps, ctx, pluginConfig, args) {
|
|
|
1891
1842
|
agentId: scope.agentId,
|
|
1892
1843
|
config: ctx.config
|
|
1893
1844
|
});
|
|
1894
|
-
const {
|
|
1845
|
+
const { authority } = await resolveCodexSessionBinding({
|
|
1895
1846
|
reclaimStale: true,
|
|
1896
1847
|
bindingStore: deps.bindingStore,
|
|
1897
1848
|
identity,
|
|
1898
1849
|
config: ctx.config,
|
|
1899
1850
|
storePath: ctx.sessionTarget?.storePath
|
|
1900
1851
|
});
|
|
1852
|
+
const assertHostGeneration = authority.assertLegacyCurrent;
|
|
1901
1853
|
return await withExclusiveCodexAppServerThread({
|
|
1902
1854
|
bindingStore: deps.bindingStore,
|
|
1903
1855
|
identity,
|
|
@@ -2055,9 +2007,7 @@ const CODEX_NATIVE_CONTROL_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
|
2055
2007
|
"stop"
|
|
2056
2008
|
]);
|
|
2057
2009
|
function resolveCodexNativeCommandSandboxBlock(ctx, subcommand, args) {
|
|
2058
|
-
if (isReadOnlyCodexGoalCommand(subcommand, args)) return;
|
|
2059
|
-
if (!CODEX_NATIVE_EXECUTION_SUBCOMMANDS.has(subcommand)) return;
|
|
2060
|
-
if (returnsBeforeNativeCodexExecution(subcommand, args)) return;
|
|
2010
|
+
if (isReadOnlyCodexGoalCommand(subcommand, args) || !CODEX_NATIVE_EXECUTION_SUBCOMMANDS.has(subcommand) || returnsBeforeNativeCodexExecution(subcommand, args)) return;
|
|
2061
2011
|
if (isCodexCliNodeResumeBind(subcommand, args)) return resolveCodexNativeSandboxBlock({
|
|
2062
2012
|
config: ctx.config,
|
|
2063
2013
|
sessionKey: ctx.sessionKey,
|
|
@@ -2100,10 +2050,8 @@ function isCodexCliNodeResumeBind(subcommand, args) {
|
|
|
2100
2050
|
}
|
|
2101
2051
|
function returnsBeforeNativeCodexResume(args) {
|
|
2102
2052
|
const parsed = parseResumeArgs([...args]);
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
if (parsed.host) return !normalizedThreadId || parsed.bindHere !== true;
|
|
2106
|
-
return !normalizedThreadId || args.length !== 1;
|
|
2053
|
+
if (parsed.help || !parsed.threadId) return true;
|
|
2054
|
+
return parsed.host ? parsed.bindHere !== true : args.length !== 1;
|
|
2107
2055
|
}
|
|
2108
2056
|
async function handleComputerUseCommand(deps, ctx, pluginConfig, args) {
|
|
2109
2057
|
const parsed = parseComputerUseArgs(args);
|
|
@@ -2188,28 +2136,21 @@ function formatNativeGoal(response) {
|
|
|
2188
2136
|
`- Tokens: ${tokensUsed}${tokenBudget === void 0 ? "" : ` / ${tokenBudget}`}`
|
|
2189
2137
|
].join("\n");
|
|
2190
2138
|
}
|
|
2191
|
-
async function
|
|
2192
|
-
const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
|
|
2193
|
-
const { target, binding } = authority;
|
|
2194
|
-
if (!target) return "Cannot stop Codex because this command did not include a stable binding identity.";
|
|
2195
|
-
return (await deps.stopCodexConversationTurn({
|
|
2196
|
-
identity: target.identity,
|
|
2197
|
-
binding,
|
|
2198
|
-
assertCurrent: authority.assertMutationCurrent
|
|
2199
|
-
})).message;
|
|
2200
|
-
}
|
|
2201
|
-
async function steerConversationTurn(deps, ctx, message) {
|
|
2139
|
+
async function controlConversationTurn(deps, ctx, command, message) {
|
|
2202
2140
|
const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
|
|
2203
2141
|
const { target, binding } = authority;
|
|
2204
|
-
if (!target) return
|
|
2205
|
-
|
|
2142
|
+
if (!target) return `Cannot ${command} Codex because this command did not include a stable binding identity.`;
|
|
2143
|
+
const params = {
|
|
2206
2144
|
identity: target.identity,
|
|
2207
2145
|
binding,
|
|
2208
|
-
message,
|
|
2209
2146
|
assertCurrent: authority.assertMutationCurrent
|
|
2147
|
+
};
|
|
2148
|
+
return (command === "stop" ? await deps.stopCodexConversationTurn(params) : await deps.steerCodexConversationTurn({
|
|
2149
|
+
...params,
|
|
2150
|
+
message
|
|
2210
2151
|
})).message;
|
|
2211
2152
|
}
|
|
2212
|
-
async function setConversationModel(deps, ctx,
|
|
2153
|
+
async function setConversationModel(deps, ctx, args) {
|
|
2213
2154
|
if (args.length > 1) return "Usage: /codex model <model>";
|
|
2214
2155
|
const [model = ""] = args;
|
|
2215
2156
|
const normalized = model.trim();
|
|
@@ -2232,7 +2173,6 @@ async function setConversationModel(deps, ctx, pluginConfig, args) {
|
|
|
2232
2173
|
return await deps.setCodexConversationModel({
|
|
2233
2174
|
identity: target.identity,
|
|
2234
2175
|
bindingStore: deps.bindingStore,
|
|
2235
|
-
pluginConfig,
|
|
2236
2176
|
model: normalized,
|
|
2237
2177
|
agentDir: target.agentDir,
|
|
2238
2178
|
config: ctx.config,
|
|
@@ -2417,7 +2357,7 @@ async function handleCodexPluginsSubcommand(input, rest, io, runtime) {
|
|
|
2417
2357
|
if (normalized === "list") {
|
|
2418
2358
|
if (args.length > 0) return { text: "Usage: /codex plugins list" };
|
|
2419
2359
|
const current = await io.readConfig();
|
|
2420
|
-
return { text: formatPluginList(current.plugins ?? {},
|
|
2360
|
+
return { text: formatPluginList(current.plugins ?? {}, current.enabled === true) };
|
|
2421
2361
|
}
|
|
2422
2362
|
if (normalized === "available") {
|
|
2423
2363
|
if (!canMutateCodexHost(ctx)) return { text: "Only an owner or operator.admin gateway client can list available Codex plugins." };
|
|
@@ -2724,8 +2664,7 @@ async function installCodexPlugin(requestedId, io, runtime, ctx) {
|
|
|
2724
2664
|
const status = alreadyInstalled ? "bundle was already installed in Codex" : "bundle was installed in Codex";
|
|
2725
2665
|
return { text: `${formatCodexDisplayText(requestedId)} ${status}. OpenClaw app access is configured.${refreshWarning} ${POLICY_REFRESH_HINT}` };
|
|
2726
2666
|
}
|
|
2727
|
-
function formatPluginList(plugins,
|
|
2728
|
-
const globalEnabled = options.globalEnabled === true;
|
|
2667
|
+
function formatPluginList(plugins, globalEnabled) {
|
|
2729
2668
|
const keys = Object.keys(plugins).toSorted();
|
|
2730
2669
|
if (keys.length === 0) return "No Codex sub-plugins configured under plugins.entries.codex.config.codexPlugins.plugins";
|
|
2731
2670
|
const rows = keys.map((key) => {
|
|
@@ -3004,9 +2943,8 @@ async function handleCodexSubcommand(ctx, options) {
|
|
|
3004
2943
|
if (normalized === "bind") return await bindConversation(deps, ctx, options.pluginConfig, rest);
|
|
3005
2944
|
if (normalized === "detach" || normalized === "unbind") return { text: await detachConversation(deps, ctx) };
|
|
3006
2945
|
if (normalized === "binding") return { text: await describeConversationBinding(deps, ctx) };
|
|
3007
|
-
if (normalized === "stop") return { text: await
|
|
3008
|
-
if (normalized === "
|
|
3009
|
-
if (normalized === "model") return { text: await setConversationModel(deps, ctx, options.pluginConfig, rest) };
|
|
2946
|
+
if (normalized === "stop" || normalized === "steer") return { text: await controlConversationTurn(deps, ctx, normalized, rest.join(" ")) };
|
|
2947
|
+
if (normalized === "model") return { text: await setConversationModel(deps, ctx, rest) };
|
|
3010
2948
|
if (normalized === "fast") {
|
|
3011
2949
|
if (isMenuVerb(rest)) return buildCodexFastMenuReply();
|
|
3012
2950
|
return { text: await setConversationFastMode(deps, ctx, rest) };
|