@openclaw/codex 2026.9.4 → 2026.9.6
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-Eem_WGqY.mjs +75 -0
- package/dist/{apply-CvT8tW5i.js → .setup/apply-DDOi8uNx.mjs} +24 -30
- package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
- package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-CEv1cKwF.mjs} +79 -49
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -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-B2mpaI9D.mjs} +9 -81
- package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/binding-connection-ThoatDcb.mjs +50 -0
- package/dist/.setup/binding-connection.runtime-yoHrABt-.mjs +48 -0
- package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-B2HScEgT.mjs} +143 -32
- package/dist/{build-state-BCmg9-5p.js → .setup/build-state-C7EnDVgr.mjs} +1 -1
- package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/{client-B57KWPQx.js → .setup/client-Cs08OXVQ.mjs} +705 -512
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-DW7Lx9oH.mjs} +137 -186
- package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DixIj3HW.mjs} +47 -23
- package/dist/{compact-B_H3AOd7.js → .setup/compact-Du5UvtxA.mjs} +29 -51
- package/dist/{config-oIORaQ5T.js → .setup/config-BoTP_mrL.mjs} +5 -4
- package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BvaRs51b.mjs} +50 -446
- package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
- package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-C8Rw1m1m.mjs} +2 -2
- package/dist/.setup/config-security-BEReZ6go.mjs +380 -0
- package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DP-gMrBP.mjs} +29 -38
- package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
- package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-uK9Jomlc.mjs} +32 -67
- 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-BDXl-8Cw.mjs} +936 -620
- package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-poidXgek.mjs} +9 -7
- package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-BsruvNrH.mjs} +8 -7
- package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-CnBS8Wa3.mjs} +102 -9
- package/dist/{harness-C7rRa7bm.js → .setup/harness-a_MsE4-_.mjs} +81 -21
- package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-BIZFhTNG.mjs} +18 -11
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-BnshlFag.mjs} +14 -3
- 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-CfXJf9Ay.mjs} +36 -12
- package/dist/{models-PCKOim-h.js → .setup/models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/native-auth-rWbGbMn3.mjs +57 -0
- package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs} +43 -35
- package/dist/.setup/native-subagent-monitor-D3filLY2.mjs +4859 -0
- package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-wb8CKZGN.mjs} +98 -44
- package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/{plan-7uG-Fp36.js → .setup/plan-CN3VwfNU.mjs} +133 -119
- package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-B2CsSdnV.mjs} +32 -44
- package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-BoRei8Z4.mjs} +21 -11
- package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-Ctmo83k_.mjs} +226 -141
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/{provider-MQ8PVkuE.js → .setup/provider-BOsxQHOM.mjs} +9 -5
- package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-CMU3DUD0.mjs} +174 -151
- package/dist/{request-B7hEkBGq.js → .setup/request-D2L0zMrq.mjs} +130 -42
- package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-BHu11r7h.mjs} +1628 -966
- package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
- package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-C2sRMOEY.mjs} +3 -3
- package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-Cm0apEbd.mjs} +36 -83
- package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-BGoz8wOK.mjs} +202 -5
- package/dist/.setup/session-binding-sidecars-BlB5EvIS.mjs +546 -0
- package/dist/.setup/session-catalog-Pno1xGcl.mjs +2764 -0
- package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-BI6UTDZT.mjs} +58 -26
- package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +347 -0
- package/dist/.setup/session-catalog-index-B9_VQIUz.mjs +1170 -0
- package/dist/.setup/session-catalog-index-order-hcdz07yN.mjs +48 -0
- package/dist/.setup/session-catalog-index-state-Dgh8ORJm.mjs +183 -0
- package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-DowriLid.mjs} +223 -95
- package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-ITddWx_X.mjs} +25 -13
- package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-6g6qi4A9.mjs} +24 -15
- package/dist/.setup/session-catalog-projection-zK_PUsiE.mjs +422 -0
- package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-irrD-uo7.mjs} +3 -3
- package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-BrqhSCf9.mjs} +19 -19
- package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-D-3wAgOP.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-CaCh0xF_.mjs} +10 -24
- package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-BH-S6qkJ.mjs} +26 -7
- 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-DiAi6Kx6.mjs} +12 -12
- package/dist/{shared-client-CscigXXL.js → .setup/shared-client-DA4VR4Eb.mjs} +332 -221
- package/dist/{side-question-BGMJQf4U.js → .setup/side-question-BJ1wSDcB.mjs} +183 -230
- package/dist/{source-CElXU0Oy.js → .setup/source-CUzJq5WN.mjs} +11 -10
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +83 -0
- package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-B3mfz1TG.mjs} +347 -2318
- package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-DcTtAcXj.mjs} +6 -4
- package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-DIBXwOpE.mjs} +8 -5
- package/dist/.setup/timeout-C910MdAB.mjs +80 -0
- package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-ZZpkFkJ_.mjs} +96 -61
- package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-BtHDBp1G.mjs} +224 -195
- 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-h2VHOskC.mjs} +274 -89
- package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-BUr4OUbC.mjs} +51 -42
- package/dist/{usage-tCk-mg_x.js → .setup/usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/usage-limit-error-DUMbefVY.mjs +166 -0
- package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
- package/dist/api.js +23 -12
- package/dist/catalog-page-worker-entrypoint.js +12 -0
- package/dist/catalog-page.worker.js +9 -0
- 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 +306 -215
- 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 +36 -35
- 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 +14 -8
- package/dist/attempt-context-D44yeDII.js +0 -636
- package/dist/binding-connection-D3udKbIE.js +0 -60
- package/dist/event-projector-usage-BfXmpOec.js +0 -102
- package/dist/inference-proxy-HGXKUIre.js +0 -311
- package/dist/launch-args-RXQwn8zV.js +0 -90
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
- package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
- package/dist/node-exec-server.runtime-Cl2vapEi.js +0 -226
- 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/version-omm6IPI3.js +0 -12
- /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-umd0tgh4.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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region extensions/codex/src/app-server/launch-args.ts
|
|
4
|
+
const CODEX_VALUE_OPTIONS = /* @__PURE__ */ new Set([
|
|
5
|
+
"-m",
|
|
6
|
+
"--model",
|
|
7
|
+
"--local-provider",
|
|
8
|
+
"-p",
|
|
9
|
+
"--profile",
|
|
10
|
+
"-s",
|
|
11
|
+
"--sandbox",
|
|
12
|
+
"-a",
|
|
13
|
+
"--ask-for-approval",
|
|
14
|
+
"-C",
|
|
15
|
+
"--cd",
|
|
16
|
+
"--add-dir",
|
|
17
|
+
"--remote",
|
|
18
|
+
"--remote-auth-token-env",
|
|
19
|
+
"-c",
|
|
20
|
+
"--config",
|
|
21
|
+
"--enable",
|
|
22
|
+
"--disable",
|
|
23
|
+
"--listen",
|
|
24
|
+
"--sock",
|
|
25
|
+
"--code-mode-host",
|
|
26
|
+
"--ws-auth",
|
|
27
|
+
"--ws-token-file",
|
|
28
|
+
"--ws-token-sha256",
|
|
29
|
+
"--ws-shared-secret-file",
|
|
30
|
+
"--ws-issuer",
|
|
31
|
+
"--ws-audience",
|
|
32
|
+
"--ws-max-clock-skew-seconds"
|
|
33
|
+
]);
|
|
34
|
+
/** One tokenization owner for launch, turn policy, reviewer trust, and private turns. */
|
|
35
|
+
function readCodexArgs(args) {
|
|
36
|
+
const tokens = [];
|
|
37
|
+
let nativeSubcommand = false;
|
|
38
|
+
let end = 0;
|
|
39
|
+
for (const [index, arg] of args.entries()) {
|
|
40
|
+
if (index < end) continue;
|
|
41
|
+
end = index + 1;
|
|
42
|
+
const attached = /^(--[^=]+)=([\s\S]*)$/u.exec(arg) ?? /^(-[cmpisaC])=?([\s\S]+)$/u.exec(arg);
|
|
43
|
+
const name = attached?.[1] ?? arg;
|
|
44
|
+
let value = attached?.[2];
|
|
45
|
+
if (name === "-i" || name === "--image") while (args[end]?.startsWith("-") === false) end += 1;
|
|
46
|
+
else if (!attached && CODEX_VALUE_OPTIONS.has(name)) {
|
|
47
|
+
value = args[end];
|
|
48
|
+
if (value !== void 0) end += 1;
|
|
49
|
+
}
|
|
50
|
+
tokens.push({
|
|
51
|
+
index,
|
|
52
|
+
end,
|
|
53
|
+
name,
|
|
54
|
+
value
|
|
55
|
+
});
|
|
56
|
+
if (name === "app-server") nativeSubcommand = true;
|
|
57
|
+
if (name === "--" && nativeSubcommand) break;
|
|
58
|
+
}
|
|
59
|
+
return tokens;
|
|
60
|
+
}
|
|
61
|
+
/** Uses the native CLI configuration for status without starting its transport. */
|
|
62
|
+
function buildCodexLoginStatusArgs(args) {
|
|
63
|
+
const options = /* @__PURE__ */ new Set([
|
|
64
|
+
"-c",
|
|
65
|
+
"--config",
|
|
66
|
+
"-p",
|
|
67
|
+
"--profile",
|
|
68
|
+
"--enable",
|
|
69
|
+
"--disable"
|
|
70
|
+
]);
|
|
71
|
+
const tokens = readCodexArgs(args);
|
|
72
|
+
const subcommandIndex = tokens.findLast(({ name }) => name === "app-server")?.index ?? -1;
|
|
73
|
+
const prefix = subcommandIndex < 0 ? [] : args.slice(0, subcommandIndex);
|
|
74
|
+
const configArgs = tokens.filter(({ index, name }) => index > subcommandIndex && options.has(name)).flatMap(({ index, end }) => args.slice(index, end));
|
|
75
|
+
return [
|
|
76
|
+
...prefix,
|
|
77
|
+
...configArgs,
|
|
78
|
+
"login",
|
|
79
|
+
"status"
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
function readCodexAppServerConfigOptions(args) {
|
|
83
|
+
return readCodexArgs(args).filter(({ name }) => name === "-c" || name === "--config" || name === "-p" || name === "--profile");
|
|
84
|
+
}
|
|
85
|
+
const NODE_LAUNCH_VALUE_OPTIONS = /* @__PURE__ */ new Set([
|
|
86
|
+
"-r",
|
|
87
|
+
"--require",
|
|
88
|
+
"--import",
|
|
89
|
+
"--loader",
|
|
90
|
+
"--experimental-loader",
|
|
91
|
+
"--max-old-space-size",
|
|
92
|
+
"--max-semi-space-size",
|
|
93
|
+
"--stack-size"
|
|
94
|
+
]);
|
|
95
|
+
const NODE_LAUNCH_FLAGS = /* @__PURE__ */ new Set([
|
|
96
|
+
"--enable-source-maps",
|
|
97
|
+
"--no-warnings",
|
|
98
|
+
"--trace-warnings",
|
|
99
|
+
"--trace-uncaught",
|
|
100
|
+
"--no-deprecation",
|
|
101
|
+
"--trace-deprecation",
|
|
102
|
+
"--experimental-strip-types",
|
|
103
|
+
"--experimental-transform-types",
|
|
104
|
+
"--no-experimental-strip-types",
|
|
105
|
+
"--use-strict",
|
|
106
|
+
"--expose-gc"
|
|
107
|
+
]);
|
|
108
|
+
function resolveNodeLauncherModule(value, option, cwd) {
|
|
109
|
+
if (path.isAbsolute(value)) return value;
|
|
110
|
+
if (/^\.{1,2}[\\/]/u.test(value)) return path.resolve(cwd, value);
|
|
111
|
+
if (option === "-r" || option === "--require") return createRequire(path.join(cwd, "openclaw-codex-launcher.cjs")).resolve(value);
|
|
112
|
+
if (/^(?:file|data|node):/u.test(value)) return value;
|
|
113
|
+
throw new Error("Private Codex turns require an absolute or relative file path for ESM preloads");
|
|
114
|
+
}
|
|
115
|
+
/** Separates a supported launcher from native flags before a private turn sanitizes them. */
|
|
116
|
+
function resolveCodexPrivateLauncher(params) {
|
|
117
|
+
const launcherArgs = [];
|
|
118
|
+
let nativeArgs = [...params.args];
|
|
119
|
+
const executable = params.command.split(/[\\/]/u).at(-1)?.toLowerCase();
|
|
120
|
+
if (executable && [
|
|
121
|
+
"node",
|
|
122
|
+
"node.exe",
|
|
123
|
+
"nodejs",
|
|
124
|
+
"nodejs.exe"
|
|
125
|
+
].includes(executable)) {
|
|
126
|
+
let index = 0;
|
|
127
|
+
while (params.args[index]?.startsWith("-")) {
|
|
128
|
+
const raw = params.args[index];
|
|
129
|
+
index += 1;
|
|
130
|
+
if (raw === "--") {
|
|
131
|
+
launcherArgs.push(raw);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
const attached = /^(--[^=]+)=([\s\S]*)$/u.exec(raw) ?? /^(-r)([\s\S]+)$/u.exec(raw);
|
|
135
|
+
const name = attached?.[1] ?? raw;
|
|
136
|
+
const normalizedName = name.replaceAll("_", "-");
|
|
137
|
+
if (NODE_LAUNCH_VALUE_OPTIONS.has(normalizedName)) {
|
|
138
|
+
const value = attached?.[2] ?? params.args[index++];
|
|
139
|
+
if (value === void 0 || !value.trim()) throw new Error("Private Codex turns received a Node launcher option without its value");
|
|
140
|
+
const moduleOption = [
|
|
141
|
+
"-r",
|
|
142
|
+
"--require",
|
|
143
|
+
"--import",
|
|
144
|
+
"--loader",
|
|
145
|
+
"--experimental-loader"
|
|
146
|
+
].includes(normalizedName);
|
|
147
|
+
if (attached && !moduleOption) launcherArgs.push(raw);
|
|
148
|
+
else launcherArgs.push(name, moduleOption ? resolveNodeLauncherModule(value, normalizedName, path.resolve(params.cwd)) : value);
|
|
149
|
+
} else if (!attached && NODE_LAUNCH_FLAGS.has(name)) launcherArgs.push(raw);
|
|
150
|
+
else throw new Error(`Private Codex turns cannot isolate unsupported Node launcher option ${name}`);
|
|
151
|
+
}
|
|
152
|
+
const script = params.args[index];
|
|
153
|
+
if (!script) throw new Error("Private Codex turns require a Node wrapper script");
|
|
154
|
+
launcherArgs.push(path.resolve(params.cwd, script));
|
|
155
|
+
nativeArgs = params.args.slice(index + 1);
|
|
156
|
+
if (!readCodexArgs(nativeArgs).some(({ name }) => name === "app-server")) throw new Error("Private Codex turns require a native app-server command after the Node wrapper");
|
|
157
|
+
}
|
|
158
|
+
if (executable && /^(?:(?:ba|da|z|fi)?sh|python(?:\d+(?:\.\d+)*)?|ruby|perl|cmd|powershell|pwsh)(?:\.exe)?$/u.test(executable)) throw new Error("Private Codex turns cannot isolate inline or interpreted wrappers; use a Node script or a directly executable wrapper");
|
|
159
|
+
const tokens = readCodexArgs(nativeArgs);
|
|
160
|
+
const serverIndex = tokens.findLast(({ name }) => name === "app-server")?.index ?? nativeArgs.length;
|
|
161
|
+
if (tokens.some(({ index, name }) => index < serverIndex && (!name.startsWith("-") || name === "--"))) throw new Error("Private Codex turns cannot isolate this launcher prefix; use a Node script or a directly executable wrapper");
|
|
162
|
+
return {
|
|
163
|
+
launcherArgs,
|
|
164
|
+
nativeArgs
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/** The stdio proxy forwards to an external server; it does not own that runtime. */
|
|
168
|
+
function isCodexAppServerProxyLaunch(args) {
|
|
169
|
+
const tokens = readCodexArgs(args);
|
|
170
|
+
const server = tokens.findLastIndex(({ name }) => name === "app-server");
|
|
171
|
+
return server >= 0 && tokens.slice(server + 1).find(({ name }) => !name.startsWith("-"))?.name === "proxy";
|
|
172
|
+
}
|
|
173
|
+
/** Keeps Codex overrides in one CLI scope without rewriting raw TOML or wrapper prefixes. */
|
|
174
|
+
function normalizeCodexAppServerArgs(rawArgs, enforcedOverride) {
|
|
175
|
+
const tokens = readCodexArgs(rawArgs);
|
|
176
|
+
const subcommandIndex = tokens.findLast(({ name }) => name === "app-server")?.index ?? -1;
|
|
177
|
+
const prefix = subcommandIndex < 0 ? [...rawArgs] : rawArgs.slice(0, subcommandIndex);
|
|
178
|
+
const suffix = [];
|
|
179
|
+
if (subcommandIndex >= 0) for (const token of tokens) {
|
|
180
|
+
if (token.index <= subcommandIndex) continue;
|
|
181
|
+
if (token.name === "--") {
|
|
182
|
+
suffix.push(...rawArgs.slice(token.index));
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
(token.name === "-c" || token.name === "--config" ? prefix : suffix).push(...rawArgs.slice(token.index, token.end));
|
|
186
|
+
}
|
|
187
|
+
if (enforcedOverride && !(prefix.at(-2) === "-c" && prefix.at(-1) === enforcedOverride)) prefix.push("-c", enforcedOverride);
|
|
188
|
+
const normalized = subcommandIndex < 0 ? prefix : [
|
|
189
|
+
...prefix,
|
|
190
|
+
"app-server",
|
|
191
|
+
...suffix
|
|
192
|
+
];
|
|
193
|
+
return normalized.length === rawArgs.length && normalized.every((arg, index) => arg === rawArgs[index]) ? rawArgs : normalized;
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
export { resolveCodexPrivateLauncher as a, readCodexAppServerConfigOptions as i, isCodexAppServerProxyLaunch as n, normalizeCodexAppServerArgs as r, buildCodexLoginStatusArgs as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.
|
|
2
|
-
import { n as MANAGED_CODEX_APP_SERVER_PACKAGE } from "./version-omm6IPI3.js";
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
3
2
|
import { createRequire } from "node:module";
|
|
4
3
|
import { constants, existsSync, realpathSync } from "node:fs";
|
|
5
4
|
import path from "node:path";
|
|
@@ -43,6 +42,17 @@ function resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath(params = {}
|
|
|
43
42
|
return candidates.find((candidate) => pathExists(candidate));
|
|
44
43
|
}
|
|
45
44
|
//#endregion
|
|
45
|
+
//#region extensions/codex/src/app-server/version.ts
|
|
46
|
+
/**
|
|
47
|
+
* Version and package pins for the managed Codex app-server runtime.
|
|
48
|
+
*/
|
|
49
|
+
/** Exact Codex app-server version shipped by the OpenClaw Codex bridge. */
|
|
50
|
+
const CODEX_APP_SERVER_VERSION = "0.155.1";
|
|
51
|
+
/** Inclusive runtime compatibility floor for external app-server binaries. */
|
|
52
|
+
const MIN_SUPPORTED_CODEX_APP_SERVER_VERSION = "0.149.0";
|
|
53
|
+
/** npm package name for the managed Codex app-server binary. */
|
|
54
|
+
const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
|
|
55
|
+
//#endregion
|
|
46
56
|
//#region extensions/codex/src/app-server/managed-binary.ts
|
|
47
57
|
/**
|
|
48
58
|
* Resolves the managed Codex app-server binary shipped with or installed beside
|
|
@@ -160,6 +170,7 @@ function resolvePackageJsonFromRoot(packageName, root) {
|
|
|
160
170
|
function resolveManagedCodexAppServerCommandCandidates(pluginRoot, platform, managedCommandOrder) {
|
|
161
171
|
const packageCommand = resolveManagedCodexPackageEntrypoint(pluginRoot);
|
|
162
172
|
const packageCommandPaths = packageCommand ? [packageCommand] : [];
|
|
173
|
+
if (managedCommandOrder === "package-only") return packageCommandPaths;
|
|
163
174
|
const desktopCommandPaths = resolveMacOSDesktopCodexAppServerCommandCandidates(platform);
|
|
164
175
|
return managedCommandOrder === "desktop-first" ? [...desktopCommandPaths, ...packageCommandPaths] : [...packageCommandPaths, ...desktopCommandPaths];
|
|
165
176
|
}
|
|
@@ -192,4 +203,4 @@ async function commandPathExists(filePath, platform) {
|
|
|
192
203
|
}
|
|
193
204
|
}
|
|
194
205
|
//#endregion
|
|
195
|
-
export { resolvePackagedCodexNativeCommand as a,
|
|
206
|
+
export { resolvePackagedCodexNativeCommand as a, MIN_SUPPORTED_CODEX_APP_SERVER_VERSION as c, resolveMacOSDesktopCodexBundledMarketplaceCandidates as d, resolveMacOSDesktopCodexComputerUseServiceAppCandidates as f, resolveManagedCodexNativeCommand as i, resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath as l, managed_binary_exports as n, setManagedCodexPluginRoot as o, resolveManagedCodexAppServerStartOptions as r, CODEX_APP_SERVER_VERSION as s, isManagedCodexDesktopCommand as t, resolveMacOSDesktopCodexAppPathCandidates as u };
|
|
@@ -28,10 +28,53 @@ function managedThreadStoreKey(sourceHomeId, threadId) {
|
|
|
28
28
|
}
|
|
29
29
|
/** Durable ownership index for Codex threads created by OpenClaw. */
|
|
30
30
|
function createCodexManagedThreadStore(state) {
|
|
31
|
+
const byHome = /* @__PURE__ */ new Map();
|
|
32
|
+
const memberships = /* @__PURE__ */ new Map();
|
|
33
|
+
let hydration;
|
|
34
|
+
const remember = ({ sourceHomeId, threadId }) => {
|
|
35
|
+
const key = managedThreadStoreKey(sourceHomeId, threadId);
|
|
36
|
+
if (memberships.has(key)) return key;
|
|
37
|
+
memberships.set(key, {
|
|
38
|
+
sourceHomeId,
|
|
39
|
+
threadId
|
|
40
|
+
});
|
|
41
|
+
let ids = byHome.get(sourceHomeId);
|
|
42
|
+
if (!ids) {
|
|
43
|
+
ids = /* @__PURE__ */ new Set();
|
|
44
|
+
byHome.set(sourceHomeId, ids);
|
|
45
|
+
}
|
|
46
|
+
ids.add(threadId);
|
|
47
|
+
if (memberships.size > 2e4) {
|
|
48
|
+
const oldest = memberships.entries().next().value;
|
|
49
|
+
if (oldest) {
|
|
50
|
+
memberships.delete(oldest[0]);
|
|
51
|
+
const oldestHome = byHome.get(oldest[1].sourceHomeId);
|
|
52
|
+
oldestHome?.delete(oldest[1].threadId);
|
|
53
|
+
if (oldestHome?.size === 0) byHome.delete(oldest[1].sourceHomeId);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return key;
|
|
57
|
+
};
|
|
58
|
+
const snapshot = async () => {
|
|
59
|
+
hydration ??= state.entries().then((entries) => {
|
|
60
|
+
const marked = new Map(memberships);
|
|
61
|
+
memberships.clear();
|
|
62
|
+
byHome.clear();
|
|
63
|
+
for (const entry of entries.toSorted((a, b) => a.createdAt - b.createdAt)) {
|
|
64
|
+
const parsed = managedThreadSchema.safeParse(entry.value);
|
|
65
|
+
if (parsed.success) marked.delete(remember(parsed.data));
|
|
66
|
+
}
|
|
67
|
+
for (const membership of marked.values()) remember(membership);
|
|
68
|
+
}).catch((error) => {
|
|
69
|
+
hydration = void 0;
|
|
70
|
+
throw error;
|
|
71
|
+
});
|
|
72
|
+
await hydration;
|
|
73
|
+
return byHome;
|
|
74
|
+
};
|
|
31
75
|
return {
|
|
32
76
|
async has(sourceHomeId, threadId) {
|
|
33
|
-
|
|
34
|
-
return parsed.success && parsed.data.sourceHomeId === sourceHomeId && parsed.data.threadId === threadId;
|
|
77
|
+
return (await snapshot()).get(sourceHomeId)?.has(threadId) ?? false;
|
|
35
78
|
},
|
|
36
79
|
async mark(params) {
|
|
37
80
|
try {
|
|
@@ -42,24 +85,15 @@ function createCodexManagedThreadStore(state) {
|
|
|
42
85
|
threadId: params.threadId.trim(),
|
|
43
86
|
...params.rolloutPath?.trim() ? { rolloutPath: params.rolloutPath.trim() } : {}
|
|
44
87
|
});
|
|
45
|
-
state.registerIfAbsent(managedThreadStoreKey(value.sourceHomeId, value.threadId), value);
|
|
88
|
+
await state.registerIfAbsent(managedThreadStoreKey(value.sourceHomeId, value.threadId), value);
|
|
89
|
+
remember(value);
|
|
46
90
|
return true;
|
|
47
91
|
} catch (error) {
|
|
48
92
|
embeddedAgentLog.warn("failed to record Codex managed thread ownership", { error });
|
|
49
93
|
return false;
|
|
50
94
|
}
|
|
51
95
|
},
|
|
52
|
-
|
|
53
|
-
const byHome = /* @__PURE__ */ new Map();
|
|
54
|
-
for (const entry of state.entries()) {
|
|
55
|
-
const parsed = managedThreadSchema.safeParse(entry.value);
|
|
56
|
-
if (!parsed.success) continue;
|
|
57
|
-
const ids = byHome.get(parsed.data.sourceHomeId) ?? /* @__PURE__ */ new Set();
|
|
58
|
-
ids.add(parsed.data.threadId);
|
|
59
|
-
byHome.set(parsed.data.sourceHomeId, ids);
|
|
60
|
-
}
|
|
61
|
-
return byHome;
|
|
62
|
-
}
|
|
96
|
+
snapshot
|
|
63
97
|
};
|
|
64
98
|
}
|
|
65
99
|
//#endregion
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { r as buildCodexRuntimeModelParams } from "./harness-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { r as buildCodexRuntimeModelParams } from "./harness-a_MsE4-_.mjs";
|
|
2
|
+
import { d as readCodexPluginConfig } from "./config-parsing-CcB9iPoq.mjs";
|
|
3
|
+
import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
|
|
4
|
+
import { o as withCodexAppServerJsonClient } from "./request-D2L0zMrq.mjs";
|
|
5
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
|
|
6
|
+
import { a as resolveCodexAppServerAuthProfileStore, r as resolveCodexAppServerAuthProfileId } from "./auth-profile-WqZtZfXN.mjs";
|
|
7
|
+
import { r as captureSharedCodexAppServerCatalogLifetime } from "./shared-client-DA4VR4Eb.mjs";
|
|
8
|
+
import { t as listAllCodexAppServerModels } from "./models-KnqBv0hE.mjs";
|
|
9
|
+
import { probeCodexNativeAuth } from "./native-auth-rWbGbMn3.mjs";
|
|
7
10
|
//#region extensions/codex/src/app-server/model-catalog.ts
|
|
8
11
|
const DEFAULT_MODEL_DISCOVERY_TIMEOUT_MS = 2500;
|
|
9
12
|
const INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -51,7 +54,10 @@ function createCodexAppServerModelCatalog(runtime) {
|
|
|
51
54
|
},
|
|
52
55
|
read(params, pluginConfig) {
|
|
53
56
|
const observation = scopes.get(params.config)?.get(scopeKey(params));
|
|
54
|
-
return !disposed && params.provider === "openai" && observation !== void 0 && observation.pluginConfig === pluginConfig && observation.models?.has(params.modelId) && observation.accountType && observation.isCurrent?.() ? {
|
|
57
|
+
return !disposed && params.provider === "openai" && observation !== void 0 && observation.pluginConfig === pluginConfig && observation.models?.has(params.modelId) && observation.accountType && observation.isCurrent?.() ? {
|
|
58
|
+
accountType: observation.accountType,
|
|
59
|
+
...observation.authMode ? { authMode: observation.authMode } : {}
|
|
60
|
+
} : void 0;
|
|
55
61
|
},
|
|
56
62
|
async load(params, pluginConfig) {
|
|
57
63
|
if (disposed) return [];
|
|
@@ -65,13 +71,30 @@ function createCodexAppServerModelCatalog(runtime) {
|
|
|
65
71
|
observations.set(key, observation);
|
|
66
72
|
const discovery = readCodexPluginConfig(pluginConfig).discovery;
|
|
67
73
|
if (discovery?.enabled === false) return [];
|
|
68
|
-
const
|
|
74
|
+
const options = resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
75
|
+
const ownsLocalProcess = options.start.transport === "stdio" && !isCodexAppServerProxyLaunch(options.start.args);
|
|
76
|
+
const authProfileStore = ownsLocalProcess && options.start.homeScope === "agent" ? resolveCodexAppServerAuthProfileStore({
|
|
77
|
+
agentDir: params.agentDir,
|
|
78
|
+
config: params.config
|
|
79
|
+
}) : void 0;
|
|
80
|
+
const authProfileId = authProfileStore ? resolveCodexAppServerAuthProfileId({
|
|
81
|
+
store: authProfileStore,
|
|
82
|
+
config: params.config
|
|
83
|
+
}) : void 0;
|
|
84
|
+
const usesNativeHome = ownsLocalProcess && options.start.homeScope === "user";
|
|
85
|
+
const native = usesNativeHome ? await probeCodexNativeAuth({ pluginConfig }) : void 0;
|
|
86
|
+
if (usesNativeHome && !native || disposed || observations.get(key) !== observation) return [];
|
|
87
|
+
const { start } = options;
|
|
69
88
|
const timeoutMs = discovery?.timeoutMs ?? DEFAULT_MODEL_DISCOVERY_TIMEOUT_MS;
|
|
70
89
|
const result = await withCodexAppServerJsonClient({
|
|
71
90
|
startOptions: start,
|
|
72
91
|
config: params.config,
|
|
73
92
|
agentDir: params.agentDir,
|
|
74
|
-
timeoutMs
|
|
93
|
+
timeoutMs,
|
|
94
|
+
...authProfileStore ? {
|
|
95
|
+
authProfileStore,
|
|
96
|
+
authProfileId
|
|
97
|
+
} : {}
|
|
75
98
|
}, async (request, client) => {
|
|
76
99
|
const isCurrent = captureSharedCodexAppServerCatalogLifetime(client);
|
|
77
100
|
const models = (await listAllCodexAppServerModels({
|
|
@@ -83,17 +106,18 @@ function createCodexAppServerModelCatalog(runtime) {
|
|
|
83
106
|
method: "account/read",
|
|
84
107
|
requestParams: { refreshToken: false }
|
|
85
108
|
});
|
|
86
|
-
const observedType =
|
|
109
|
+
const observedType = account.account?.type;
|
|
87
110
|
return {
|
|
88
111
|
models,
|
|
89
112
|
isCurrent,
|
|
90
|
-
accountType: account.requiresOpenaiAuth
|
|
113
|
+
accountType: account.requiresOpenaiAuth ? observedType === "apiKey" || observedType === "chatgpt" ? observedType : void 0 : void 0
|
|
91
114
|
};
|
|
92
115
|
});
|
|
93
116
|
if (disposed || observations.get(key) !== observation || !result.isCurrent()) return [];
|
|
94
117
|
observation.models = new Set(result.models.map((model) => model.id));
|
|
95
|
-
observation.accountType = result.accountType;
|
|
118
|
+
observation.accountType = !usesNativeHome || native?.mode === "api-key" && result.accountType === "apiKey" || (native?.mode === "oauth" || native?.mode === "token") && result.accountType === "chatgpt" ? result.accountType : void 0;
|
|
96
119
|
observation.isCurrent = result.isCurrent;
|
|
120
|
+
observation.authMode = observation.accountType === "apiKey" ? "api_key" : observation.accountType === "chatgpt" && (native?.mode === "oauth" || native?.mode === "token") ? native.mode : void 0;
|
|
97
121
|
return codexAppServerModelsToCatalogEntries(result.models, runtime);
|
|
98
122
|
}
|
|
99
123
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as assertCodexModelListResponse } from "./client-Cs08OXVQ.mjs";
|
|
2
2
|
import { normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/codex/src/app-server/models.ts
|
|
4
4
|
/**
|
|
@@ -37,8 +37,8 @@ async function withCodexAppServerModelRequest(options, run) {
|
|
|
37
37
|
if (options.request) return await run(options.request);
|
|
38
38
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
39
39
|
const useSharedClient = options.sharedClient !== false;
|
|
40
|
-
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-
|
|
41
|
-
const { requestCodexAppServerClientJson } = await import("./request-
|
|
40
|
+
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-DA4VR4Eb.mjs").then((n) => n.y);
|
|
41
|
+
const { requestCodexAppServerClientJson } = await import("./request-D2L0zMrq.mjs").then((n) => n.a);
|
|
42
42
|
const client = await (useSharedClient ? getLeasedSharedCodexAppServerClient : createIsolatedCodexAppServerClient)({
|
|
43
43
|
startOptions: options.startOptions,
|
|
44
44
|
timeoutMs,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { d as readCodexPluginConfig } from "./config-parsing-CcB9iPoq.mjs";
|
|
2
|
+
import { n as isCodexAppServerProxyLaunch, t as buildCodexLoginStatusArgs } from "./launch-args-DbFCehO7.mjs";
|
|
3
|
+
import { r as resolveManagedCodexAppServerStartOptions } from "./managed-binary-BnshlFag.mjs";
|
|
4
|
+
import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-h2VHOskC.mjs";
|
|
5
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
|
|
6
|
+
import { runUtf8CommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
|
|
7
|
+
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
8
|
+
//#region extensions/codex/src/app-server/native-auth.ts
|
|
9
|
+
const OPENAI_LOGIN_MODES = {
|
|
10
|
+
"Logged in using ChatGPT": "oauth",
|
|
11
|
+
"Logged in using access token": "token",
|
|
12
|
+
"Logged in using personal access token": "token"
|
|
13
|
+
};
|
|
14
|
+
/** Ask the selected native binary about its own store; retain no credential material. */
|
|
15
|
+
async function probeCodexNativeAuth(params) {
|
|
16
|
+
params.signal?.throwIfAborted();
|
|
17
|
+
try {
|
|
18
|
+
const pluginConfig = readCodexPluginConfig(params.pluginConfig ?? params.config?.plugins?.entries?.codex?.config);
|
|
19
|
+
const options = resolveCodexAppServerRuntimeOptions({
|
|
20
|
+
pluginConfig,
|
|
21
|
+
env: params.env
|
|
22
|
+
});
|
|
23
|
+
if (options.start.transport !== "stdio" || options.start.homeScope !== "user" || isCodexAppServerProxyLaunch(options.start.args)) return;
|
|
24
|
+
const start = await resolveManagedCodexAppServerStartOptions(options.start, { pluginRoot: params.pluginRoot });
|
|
25
|
+
if (start.transport !== "stdio") return;
|
|
26
|
+
const env = resolveCodexAppServerSpawnEnv(start, params.env ?? process.env);
|
|
27
|
+
const invocation = materializeWindowsSpawnProgram(resolveWindowsSpawnProgram({
|
|
28
|
+
command: start.command,
|
|
29
|
+
env,
|
|
30
|
+
packageName: "@openai/codex"
|
|
31
|
+
}), buildCodexLoginStatusArgs(start.args));
|
|
32
|
+
const result = await runUtf8CommandWithTimeout([invocation.command, ...invocation.argv], {
|
|
33
|
+
baseEnv: env,
|
|
34
|
+
timeoutMs: 3e3,
|
|
35
|
+
signal: params.signal,
|
|
36
|
+
killProcessTree: true
|
|
37
|
+
});
|
|
38
|
+
params.signal?.throwIfAborted();
|
|
39
|
+
if (result.termination !== "exit" || result.code !== 0) return;
|
|
40
|
+
const line = `${result.stdout}\n${result.stderr}`.split("\n").map((value) => value.trim()).find((value) => value.startsWith("Logged in using "));
|
|
41
|
+
const mode = line?.startsWith("Logged in using an API key - ") ? "api-key" : line ? OPENAI_LOGIN_MODES[line] : void 0;
|
|
42
|
+
return mode ? {
|
|
43
|
+
apiKey: "codex-app-server",
|
|
44
|
+
source: "Codex native login",
|
|
45
|
+
mode,
|
|
46
|
+
nativeAuth: {
|
|
47
|
+
runtime: "codex",
|
|
48
|
+
mode
|
|
49
|
+
}
|
|
50
|
+
} : void 0;
|
|
51
|
+
} catch {
|
|
52
|
+
params.signal?.throwIfAborted();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { probeCodexNativeAuth };
|
package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as readCodexThreadHistoryPage } from "./thread-history-page-
|
|
3
|
-
import {
|
|
4
|
-
import { r as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { c as
|
|
9
|
-
import {
|
|
1
|
+
import { C as readCodexNativeSubagentHistoryOwner, b as codexNativeSubagentHistoryConnectionFingerprint, m as sessionBindingIdentity } from "./session-binding-record-BGoz8wOK.mjs";
|
|
2
|
+
import { t as readCodexThreadHistoryPage } from "./thread-history-page-DoVpnHim.mjs";
|
|
3
|
+
import { l as itemStatus } from "./event-projector-items-C6L_5ZiT.mjs";
|
|
4
|
+
import { r as readMirrorIdentity } from "./upstream-prompt-provenance-LphB8slG.mjs";
|
|
5
|
+
import { r as projectCodexThreadHistoryItem } from "./transcript-history-projection-ZZpkFkJ_.mjs";
|
|
6
|
+
import { n as buildCodexAppServerRuntimeFingerprint, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-B2CsSdnV.mjs";
|
|
7
|
+
import { i as resolveCodexBindingAppServerConnection } from "./binding-connection-ThoatDcb.mjs";
|
|
8
|
+
import { c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient } from "./shared-client-DA4VR4Eb.mjs";
|
|
9
|
+
import { a as readCodexNativeSubagentRunId, f as itemToolArgs, g as projectCodexToolActivity, h as itemTranscriptResultText } from "./native-subagent-task-ids-wb8CKZGN.mjs";
|
|
10
10
|
import { resolveAgentDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
11
11
|
import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
12
12
|
//#region extensions/codex/src/app-server/native-subagent-history.ts
|
|
@@ -26,7 +26,7 @@ async function readCodexNativeSubagentHistory(params, options) {
|
|
|
26
26
|
const { task, cfg } = params;
|
|
27
27
|
const sessionKey = task.requesterSessionKey;
|
|
28
28
|
const agentId = task.agentId;
|
|
29
|
-
const threadId =
|
|
29
|
+
const threadId = readCodexNativeSubagentRunId(task.runId)?.threadId;
|
|
30
30
|
if (task.taskKind !== "codex-native" || !sessionKey || !agentId || !threadId) throw new Error("Subagent transcript owner is unavailable.");
|
|
31
31
|
const storePath = resolveStorePath(cfg.session?.store, { agentId });
|
|
32
32
|
const readSession = () => getSessionEntry({
|
|
@@ -59,10 +59,12 @@ async function readCodexNativeSubagentHistory(params, options) {
|
|
|
59
59
|
if (currentSession?.sessionId !== sessionId || currentSession?.lifecycleRevision !== lifecycleRevision || current?.threadId !== binding.threadId || current?.appServerRuntimeFingerprint !== binding.appServerRuntimeFingerprint || current?.connectionScope !== binding.connectionScope || current?.authProfileId !== binding.authProfileId) throw new Error("Subagent parent changed; refresh its transcript.");
|
|
60
60
|
};
|
|
61
61
|
const agentDir = resolveAgentDir(cfg, agentId);
|
|
62
|
-
const connection = resolveCodexBindingAppServerConnection({
|
|
62
|
+
const connection = await resolveCodexBindingAppServerConnection({
|
|
63
63
|
binding,
|
|
64
64
|
pluginConfig: options.pluginConfig,
|
|
65
65
|
agentDir,
|
|
66
|
+
config: cfg,
|
|
67
|
+
assertCurrent,
|
|
66
68
|
authProfileId: binding.authProfileId
|
|
67
69
|
});
|
|
68
70
|
const client = await getLeasedSharedCodexAppServerClient({
|
|
@@ -81,11 +83,16 @@ async function readCodexNativeSubagentHistory(params, options) {
|
|
|
81
83
|
runtimeIdentity: client.getRuntimeIdentity()
|
|
82
84
|
});
|
|
83
85
|
if (!binding.appServerRuntimeFingerprint || fingerprint !== binding.appServerRuntimeFingerprint) throw new Error("Subagent connection changed; reconnect its parent session.");
|
|
84
|
-
const
|
|
86
|
+
const read = async (method, request) => {
|
|
87
|
+
assertCurrent();
|
|
88
|
+
const result = await client.request(method, request, { assertCurrent });
|
|
89
|
+
assertCurrent();
|
|
90
|
+
return result;
|
|
91
|
+
};
|
|
92
|
+
const { thread } = await read("thread/read", {
|
|
85
93
|
threadId,
|
|
86
94
|
includeTurns: false
|
|
87
|
-
}
|
|
88
|
-
assertCurrent();
|
|
95
|
+
});
|
|
89
96
|
if (thread.id !== threadId || threadId === historyParentThreadId) throw new Error("Subagent transcript does not belong to this parent session.");
|
|
90
97
|
const visited = /* @__PURE__ */ new Set([threadId]);
|
|
91
98
|
let ancestor = thread;
|
|
@@ -94,42 +101,43 @@ async function readCodexNativeSubagentHistory(params, options) {
|
|
|
94
101
|
if (parentId === historyParentThreadId) break;
|
|
95
102
|
if (!parentId || visited.has(parentId) || visited.size >= MAX_SUBAGENT_ANCESTRY_READS) throw new Error("Subagent transcript does not belong to this parent session.");
|
|
96
103
|
visited.add(parentId);
|
|
97
|
-
const response = await
|
|
104
|
+
const response = await read("thread/read", {
|
|
98
105
|
threadId: parentId,
|
|
99
106
|
includeTurns: false
|
|
100
|
-
}
|
|
101
|
-
assertCurrent();
|
|
107
|
+
});
|
|
102
108
|
if (response.thread.id !== parentId) throw new Error("Subagent transcript does not belong to this parent session.");
|
|
103
109
|
ancestor = response.thread;
|
|
104
110
|
}
|
|
105
111
|
const page = await readCodexThreadHistoryPage({
|
|
106
|
-
listItemPage:
|
|
107
|
-
|
|
108
|
-
const result = await client.request("thread/items/list", request, { assertCurrent });
|
|
109
|
-
assertCurrent();
|
|
110
|
-
return result;
|
|
111
|
-
},
|
|
112
|
-
listTurnPage: async (request) => {
|
|
113
|
-
assertCurrent();
|
|
114
|
-
const result = await client.request("thread/turns/list", request, { assertCurrent });
|
|
115
|
-
assertCurrent();
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
112
|
+
listItemPage: (request) => read("thread/items/list", request),
|
|
113
|
+
listTurnPage: (request) => read("thread/turns/list", request)
|
|
118
114
|
}, thread, {
|
|
119
115
|
threadId,
|
|
120
116
|
cursor: params.cursor,
|
|
121
117
|
limit: Math.max(1, Math.floor(Math.min(params.limit, 200) / 2))
|
|
122
118
|
}, {
|
|
123
|
-
project: (entries) => entries.map((entry) =>
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
project: (entries) => entries.map((entry) => {
|
|
120
|
+
const item = projectCodexToolActivity(entry.item, itemStatus(entry.item) === "running" ? "start" : "result");
|
|
121
|
+
const messages = projectCodexThreadHistoryItem(thread, entry, taskHistoryToolItems).map((message) => {
|
|
122
|
+
const messageIdentity = readMirrorIdentity(message);
|
|
123
|
+
if (!messageIdentity) throw new Error("Subagent history message is missing its native identity.");
|
|
124
|
+
return Object.assign(message, { messageId: JSON.stringify([threadId, messageIdentity]) });
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
messages,
|
|
128
|
+
activity: item ? messages.map(({ messageId }) => ({
|
|
129
|
+
messageId,
|
|
130
|
+
items: item.hideFromChannelProgress ? [] : [item]
|
|
131
|
+
})) : []
|
|
132
|
+
};
|
|
133
|
+
}),
|
|
128
134
|
fits: (result) => Buffer.byteLength(JSON.stringify(result), "utf8") <= 524288
|
|
129
135
|
});
|
|
130
136
|
assertCurrent();
|
|
137
|
+
const rows = page.items.toReversed();
|
|
131
138
|
return {
|
|
132
|
-
messages:
|
|
139
|
+
messages: rows.flatMap((row) => row.messages),
|
|
140
|
+
activity: rows.flatMap((row) => row.activity),
|
|
133
141
|
...page.nextCursor ? { nextCursor: page.nextCursor } : {}
|
|
134
142
|
};
|
|
135
143
|
} finally {
|