@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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-
|
|
2
|
-
import "./config-
|
|
3
|
-
import {
|
|
1
|
+
import { c as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-BoRei8Z4.mjs";
|
|
2
|
+
import "./config-BoTP_mrL.mjs";
|
|
3
|
+
import { c as sanitizeName, i as hasCodexSource, n as defaultCodexHome, o as exists, r as discoverCodexSource, s as readJsonObject, t as codexPluginMigrationSubscriptionWarning } from "./source-CUzJq5WN.mjs";
|
|
4
4
|
import { asBoolean, asOptionalRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { runCommandBuffered } from "openclaw/plugin-sdk/process-runtime";
|
|
@@ -9,11 +9,58 @@ import fs from "node:fs/promises";
|
|
|
9
9
|
import { canonicalPathFromExistingAncestor, isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
10
10
|
import { readSecretFile } from "openclaw/plugin-sdk/secret-file";
|
|
11
11
|
import { fileURLToPath } from "node:url";
|
|
12
|
-
import { loadAuthProfileStoreWithoutExternalProfiles
|
|
13
|
-
import { extractErrorCode } from "openclaw/plugin-sdk/security-runtime";
|
|
12
|
+
import { loadAuthProfileStoreWithoutExternalProfiles } from "openclaw/plugin-sdk/agent-runtime";
|
|
14
13
|
import { applyAuthProfileConfig, buildApiKeyCredential, buildOauthProviderAuthResult, buildOpenAICodexCredentialExtra, hasUsableOAuthCredential, resolveOpenAICodexAuthIdentity, resolveOpenAICodexImportProfileName, updateAuthProfileStoreWithLock } from "openclaw/plugin-sdk/provider-auth";
|
|
14
|
+
import { extractErrorCode } from "openclaw/plugin-sdk/security-runtime";
|
|
15
15
|
import { MIGRATION_REASON_TARGET_EXISTS, createMigrationItem, createMigrationManualItem, hasMigrationConfigPatchConflict, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, mergeMigrationConfigValue, readMigrationConfigPath, resolveMigrationConfigRuntime, summarizeMigrationItems } from "openclaw/plugin-sdk/migration";
|
|
16
|
+
import { resolvePlannedMigrationTargets } from "openclaw/plugin-sdk/migration-runtime";
|
|
16
17
|
import { decodeOpenAICodexJwtPayload } from "openclaw/plugin-sdk/provider-oauth-runtime";
|
|
18
|
+
//#region extensions/codex/src/migration/auth-profile-target.ts
|
|
19
|
+
const OPENAI_PROVIDER_ID$1 = "openai";
|
|
20
|
+
const LEGACY_CODEX_PROFILE_ID = "openai:default";
|
|
21
|
+
function findMatchingOAuthProfile(store, credential) {
|
|
22
|
+
const subject = oauthSubject(credential);
|
|
23
|
+
if (!subject) return;
|
|
24
|
+
for (const [profileId, existing] of Object.entries(store.profiles)) {
|
|
25
|
+
if (existing.type !== "oauth" || existing.provider !== credential.provider) continue;
|
|
26
|
+
const previous = oauthSubject(existing);
|
|
27
|
+
if (previous?.accountId === subject.accountId && previous.userId === subject.userId) return profileId;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function oauthSubject(credential) {
|
|
31
|
+
const claims = decodeOpenAICodexJwtPayload(credential.access)?.["https://api.openai.com/auth"];
|
|
32
|
+
if (!isRecord(claims)) return;
|
|
33
|
+
const accountId = normalizeOptionalString(claims.chatgpt_account_id);
|
|
34
|
+
const userId = normalizeOptionalString(claims.chatgpt_user_id) ?? normalizeOptionalString(claims.user_id);
|
|
35
|
+
return accountId && userId ? {
|
|
36
|
+
accountId,
|
|
37
|
+
userId
|
|
38
|
+
} : void 0;
|
|
39
|
+
}
|
|
40
|
+
function findMatchingApiKeyProfile(store, provider, key) {
|
|
41
|
+
for (const [profileId, existing] of Object.entries(store.profiles)) if (existing.type === "api_key" && existing.provider === provider && existing.key === key) return profileId;
|
|
42
|
+
}
|
|
43
|
+
function itemProfileTarget(credential, store, ctx, source) {
|
|
44
|
+
if (credential.kind === "oauth") {
|
|
45
|
+
const profile = credential.result.profiles[0];
|
|
46
|
+
const matched = profile?.credential.type === "oauth" ? findMatchingOAuthProfile(store, profile.credential) : void 0;
|
|
47
|
+
if (matched) return {
|
|
48
|
+
profileId: matched,
|
|
49
|
+
matchedExisting: true
|
|
50
|
+
};
|
|
51
|
+
const legacyProfile = ctx.config.auth?.profiles?.[LEGACY_CODEX_PROFILE_ID];
|
|
52
|
+
return {
|
|
53
|
+
profileId: legacyProfile?.provider === OPENAI_PROVIDER_ID$1 && legacyProfile.mode === "oauth" && source.codexHome === defaultCodexHome() && profile?.credential.type === "oauth" && oauthSubject(profile.credential) !== void 0 && !Object.entries(store.profiles).some(([id, existing]) => id !== "openai:default" && existing.type === "oauth" && existing.provider === OPENAI_PROVIDER_ID$1) ? LEGACY_CODEX_PROFILE_ID : credential.profileId,
|
|
54
|
+
matchedExisting: false
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const matched = findMatchingApiKeyProfile(store, credential.provider, credential.key);
|
|
58
|
+
return {
|
|
59
|
+
profileId: matched ?? credential.profileId,
|
|
60
|
+
matchedExisting: Boolean(matched)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
17
64
|
//#region extensions/codex/src/migration/cli-credentials.ts
|
|
18
65
|
/** Explicit migration reads the storage selected by the native credential owner. */
|
|
19
66
|
async function readAuthFile(home) {
|
|
@@ -45,15 +92,16 @@ async function readDirectKeyring(home, signal) {
|
|
|
45
92
|
return;
|
|
46
93
|
}
|
|
47
94
|
}
|
|
48
|
-
async function
|
|
95
|
+
async function readCodexCliCredentialsAsync(options) {
|
|
49
96
|
options.signal?.throwIfAborted();
|
|
97
|
+
if (!options.allowKeychainPrompt) return;
|
|
50
98
|
const home = await fs.realpath(options.codexHome).catch(() => path.resolve(options.codexHome));
|
|
51
|
-
const { CodexAppServerClient } = await import("./client-
|
|
52
|
-
const { resolveManagedCodexPackageEntrypoint, resolveManagedCodexNativeCommand } = await import("./managed-binary-
|
|
99
|
+
const { CodexAppServerClient } = await import("./client-Cs08OXVQ.mjs").then((n) => n.n);
|
|
100
|
+
const { resolveManagedCodexPackageEntrypoint, resolveManagedCodexNativeCommand } = await import("./managed-binary-BnshlFag.mjs").then((n) => n.n);
|
|
53
101
|
const launcher = resolveManagedCodexPackageEntrypoint(path.dirname(fileURLToPath(import.meta.url)));
|
|
54
102
|
const command = launcher ? resolveManagedCodexNativeCommand(launcher) : void 0;
|
|
55
103
|
if (!command) return;
|
|
56
|
-
const signal = AbortSignal.any([AbortSignal.timeout(
|
|
104
|
+
const signal = AbortSignal.any([AbortSignal.timeout(process.platform === "darwin" ? 6e4 : 5e3), ...options.signal ? [options.signal] : []]);
|
|
57
105
|
const client = await CodexAppServerClient.start({
|
|
58
106
|
transport: "stdio",
|
|
59
107
|
command,
|
|
@@ -75,7 +123,7 @@ async function readSelectedCredentialStorage(options, requireApiKey) {
|
|
|
75
123
|
signal.addEventListener("abort", abort, { once: true });
|
|
76
124
|
let credential;
|
|
77
125
|
try {
|
|
78
|
-
credential = await readNativeCredential(client, home,
|
|
126
|
+
credential = await readNativeCredential(client, home, options, signal);
|
|
79
127
|
} catch {}
|
|
80
128
|
signal.removeEventListener("abort", abort);
|
|
81
129
|
const closed = await client.closeAndWait({
|
|
@@ -86,15 +134,11 @@ async function readSelectedCredentialStorage(options, requireApiKey) {
|
|
|
86
134
|
options.signal?.throwIfAborted();
|
|
87
135
|
return credential;
|
|
88
136
|
}
|
|
89
|
-
async function readNativeCredential(client, home,
|
|
137
|
+
async function readNativeCredential(client, home, options, signal) {
|
|
90
138
|
signal.throwIfAborted();
|
|
91
139
|
await client.initialize();
|
|
92
140
|
if (client.getRuntimeIdentity()?.codexHome !== home) return;
|
|
93
141
|
const revision = client.getModelCatalogRevision();
|
|
94
|
-
if (requireApiKey) {
|
|
95
|
-
const account = await client.request("account/read", { refreshToken: false }, { signal });
|
|
96
|
-
if (asOptionalRecord(account.account)?.type !== "apiKey" || account.requiresOpenaiAuth !== true) return;
|
|
97
|
-
}
|
|
98
142
|
const configured = await client.request("config/read", {
|
|
99
143
|
includeLayers: false,
|
|
100
144
|
cwd: home
|
|
@@ -102,7 +146,7 @@ async function readNativeCredential(client, home, requireApiKey, options, signal
|
|
|
102
146
|
const mode = (await client.request("configRequirements/read", {}, { signal })).requirements?.cli_auth_credentials_store ?? configured.config.cli_auth_credentials_store ?? "file";
|
|
103
147
|
let record;
|
|
104
148
|
if (mode === "file") record = await readAuthFile(home);
|
|
105
|
-
else if ((mode === "keyring" || mode === "auto") && process.platform === "darwin"
|
|
149
|
+
else if ((mode === "keyring" || mode === "auto") && process.platform === "darwin") {
|
|
106
150
|
let cursor;
|
|
107
151
|
let encrypted;
|
|
108
152
|
do {
|
|
@@ -121,7 +165,18 @@ async function readNativeCredential(client, home, requireApiKey, options, signal
|
|
|
121
165
|
record = await readDirectKeyring(home, signal);
|
|
122
166
|
}
|
|
123
167
|
signal.throwIfAborted();
|
|
124
|
-
|
|
168
|
+
if (!record) return;
|
|
169
|
+
const oauth = options.credentialKind === "api_key" ? void 0 : parseOAuthCredential(record);
|
|
170
|
+
let apiKey = options.credentialKind === "oauth" ? void 0 : parseApiKeyCredential(record);
|
|
171
|
+
if (apiKey) {
|
|
172
|
+
const account = await client.request("account/read", { refreshToken: false }, { signal }).catch(() => void 0);
|
|
173
|
+
if (account?.account?.type !== "apiKey" || !account.requiresOpenaiAuth) apiKey = void 0;
|
|
174
|
+
}
|
|
175
|
+
signal.throwIfAborted();
|
|
176
|
+
return !client.getCloseError() && client.getModelCatalogRevision() === revision ? {
|
|
177
|
+
...oauth ? { oauth } : {},
|
|
178
|
+
...apiKey ? { apiKey } : {}
|
|
179
|
+
} : void 0;
|
|
125
180
|
}
|
|
126
181
|
function jwtExpiry(token) {
|
|
127
182
|
try {
|
|
@@ -131,10 +186,9 @@ function jwtExpiry(token) {
|
|
|
131
186
|
return;
|
|
132
187
|
}
|
|
133
188
|
}
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
if (!data || mode !== void 0 && mode !== "chatgpt" && mode !== "chatgptauthtokens") return;
|
|
189
|
+
function parseOAuthCredential(data) {
|
|
190
|
+
const mode = typeof data.auth_mode === "string" ? data.auth_mode.toLowerCase() : void 0;
|
|
191
|
+
if (mode !== void 0 && mode !== "chatgpt" && mode !== "chatgptauthtokens") return;
|
|
138
192
|
const tokens = asOptionalRecord(data.tokens);
|
|
139
193
|
if (typeof tokens?.access_token !== "string" || !tokens.access_token || typeof tokens.refresh_token !== "string" || !tokens.refresh_token) return;
|
|
140
194
|
const lastRefresh = typeof data.last_refresh === "string" ? Date.parse(data.last_refresh) : NaN;
|
|
@@ -148,10 +202,9 @@ async function readCodexCliCredentialsAsync(options) {
|
|
|
148
202
|
...typeof tokens.id_token === "string" ? { idToken: tokens.id_token } : {}
|
|
149
203
|
};
|
|
150
204
|
}
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
if (!data || mode !== void 0 && mode !== "apikey" && mode !== "api_key") return;
|
|
205
|
+
function parseApiKeyCredential(data) {
|
|
206
|
+
const mode = typeof data.auth_mode === "string" ? data.auth_mode.toLowerCase() : void 0;
|
|
207
|
+
if (mode !== void 0 && mode !== "apikey" && mode !== "api_key") return;
|
|
155
208
|
const key = typeof data.OPENAI_API_KEY === "string" ? data.OPENAI_API_KEY.trim() : "";
|
|
156
209
|
return key ? {
|
|
157
210
|
type: "api_key",
|
|
@@ -164,7 +217,7 @@ async function readCodexCliActiveApiKeyAsync(options) {
|
|
|
164
217
|
const OPENAI_PROVIDER_ID = "openai";
|
|
165
218
|
const OPENAI_OAUTH_ITEM_ID = "auth:openai";
|
|
166
219
|
const OPENAI_API_KEY_ITEM_ID = "auth:openai:api-key";
|
|
167
|
-
const OPENAI_CODEX_DEFAULT_MODEL = "openai/gpt-
|
|
220
|
+
const OPENAI_CODEX_DEFAULT_MODEL = "openai/gpt-6-astra";
|
|
168
221
|
const CODEX_IMPORT_DISPLAY_NAME = "Codex import";
|
|
169
222
|
const CODEX_REASON_AUTH_NOT_SELECTED = "auth credential migration not selected";
|
|
170
223
|
const CODEX_REASON_AUTH_PROFILE_EXISTS = "auth profile exists";
|
|
@@ -199,13 +252,7 @@ async function readModelRefs(source) {
|
|
|
199
252
|
refs.add(OPENAI_CODEX_DEFAULT_MODEL);
|
|
200
253
|
return [...refs].toSorted();
|
|
201
254
|
}
|
|
202
|
-
async function buildCodexOAuthCredential(source,
|
|
203
|
-
const credential = await readCodexCliCredentialsAsync({
|
|
204
|
-
codexHome: source.codexHome,
|
|
205
|
-
allowKeychainPrompt: options.allowKeychainPrompt,
|
|
206
|
-
...options.signal ? { signal: options.signal } : {}
|
|
207
|
-
});
|
|
208
|
-
if (!credential) return null;
|
|
255
|
+
async function buildCodexOAuthCredential(source, credential, includeConfigPatch) {
|
|
209
256
|
const identity = resolveOpenAICodexAuthIdentity({
|
|
210
257
|
access: credential.access,
|
|
211
258
|
accountId: credential.accountId
|
|
@@ -235,62 +282,19 @@ async function buildCodexOAuthCredential(source, includeConfigPatch, options) {
|
|
|
235
282
|
result
|
|
236
283
|
} : null;
|
|
237
284
|
}
|
|
238
|
-
async function
|
|
239
|
-
const
|
|
285
|
+
async function readCodexAuthCredentials(source, options) {
|
|
286
|
+
const credentials = await readCodexCliCredentialsAsync({
|
|
240
287
|
codexHome: source.codexHome,
|
|
241
|
-
|
|
242
|
-
|
|
288
|
+
credentialKind: options.credentialKind,
|
|
289
|
+
allowKeychainPrompt: options.allowKeychainPrompt,
|
|
290
|
+
...options.signal ? { signal: options.signal } : {}
|
|
243
291
|
});
|
|
244
|
-
|
|
245
|
-
return {
|
|
292
|
+
return [credentials?.oauth ? await buildCodexOAuthCredential(source, credentials.oauth, options.includeConfigPatch) : null, credentials?.apiKey ? {
|
|
246
293
|
kind: "api_key",
|
|
247
294
|
provider: OPENAI_PROVIDER_ID,
|
|
248
295
|
profileId: "openai:codex-import",
|
|
249
|
-
key:
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
async function readCodexAuthCredentials(source, options) {
|
|
253
|
-
return [options.credentialKind === "api_key" ? null : await buildCodexOAuthCredential(source, options.includeConfigPatch, {
|
|
254
|
-
allowKeychainPrompt: options.allowKeychainPrompt,
|
|
255
|
-
...options.signal ? { signal: options.signal } : {}
|
|
256
|
-
}), options.credentialKind === "oauth" ? null : await buildCodexApiKeyCredential(source, options.allowKeychainPrompt, options.signal)].filter((entry) => entry !== null);
|
|
257
|
-
}
|
|
258
|
-
function findMatchingOAuthProfile(store, credential) {
|
|
259
|
-
const subject = oauthSubject(credential);
|
|
260
|
-
if (!subject) return;
|
|
261
|
-
for (const [profileId, existing] of Object.entries(store.profiles)) {
|
|
262
|
-
if (existing.type !== "oauth" || existing.provider !== credential.provider) continue;
|
|
263
|
-
const previous = oauthSubject(existing);
|
|
264
|
-
if (previous?.accountId === subject.accountId && previous.userId === subject.userId) return profileId;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
function oauthSubject(credential) {
|
|
268
|
-
const claims = decodeOpenAICodexJwtPayload(credential.access)?.["https://api.openai.com/auth"];
|
|
269
|
-
if (!isRecord(claims)) return;
|
|
270
|
-
const accountId = normalizeOptionalString(claims.chatgpt_account_id);
|
|
271
|
-
const userId = normalizeOptionalString(claims.chatgpt_user_id) ?? normalizeOptionalString(claims.user_id);
|
|
272
|
-
return accountId && userId ? {
|
|
273
|
-
accountId,
|
|
274
|
-
userId
|
|
275
|
-
} : void 0;
|
|
276
|
-
}
|
|
277
|
-
function findMatchingApiKeyProfile(store, provider, key) {
|
|
278
|
-
for (const [profileId, existing] of Object.entries(store.profiles)) if (existing.type === "api_key" && existing.provider === provider && existing.key === key) return profileId;
|
|
279
|
-
}
|
|
280
|
-
function itemProfileTarget(credential, store) {
|
|
281
|
-
if (credential.kind === "oauth") {
|
|
282
|
-
const profile = credential.result.profiles[0];
|
|
283
|
-
const matched = profile?.credential.type === "oauth" ? findMatchingOAuthProfile(store, profile.credential) : void 0;
|
|
284
|
-
return {
|
|
285
|
-
profileId: matched ?? credential.profileId,
|
|
286
|
-
matchedExisting: Boolean(matched)
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
const matched = findMatchingApiKeyProfile(store, credential.provider, credential.key);
|
|
290
|
-
return {
|
|
291
|
-
profileId: matched ?? credential.profileId,
|
|
292
|
-
matchedExisting: Boolean(matched)
|
|
293
|
-
};
|
|
296
|
+
key: credentials.apiKey.key
|
|
297
|
+
} : null].filter((entry) => entry !== null);
|
|
294
298
|
}
|
|
295
299
|
function replaceConfigDraft(draft, next) {
|
|
296
300
|
for (const key of Object.keys(draft)) delete draft[key];
|
|
@@ -357,7 +361,8 @@ function resolveCodexConfigPatchMode(ctx) {
|
|
|
357
361
|
return mode === "none" || mode === "return" ? mode : "apply";
|
|
358
362
|
}
|
|
359
363
|
function allowCodexKeychainPrompt(ctx) {
|
|
360
|
-
|
|
364
|
+
const explicit = ctx.providerOptions?.allowKeychainPrompt;
|
|
365
|
+
return typeof explicit === "boolean" ? explicit : ctx.includeSecrets === true;
|
|
361
366
|
}
|
|
362
367
|
function resolveRequestedCredentialKind(ctx) {
|
|
363
368
|
const kind = ctx.providerOptions?.credentialKind;
|
|
@@ -408,36 +413,36 @@ function applyCredentialConfig(config, credential, profileId) {
|
|
|
408
413
|
}
|
|
409
414
|
async function buildCodexAuthItems(params) {
|
|
410
415
|
const configPatchMode = resolveCodexConfigPatchMode(params.ctx);
|
|
416
|
+
const allowKeychainPrompt = allowCodexKeychainPrompt(params.ctx);
|
|
411
417
|
const credentials = await readCodexAuthCredentials(params.source, {
|
|
412
418
|
credentialKind: resolveRequestedCredentialKind(params.ctx),
|
|
413
419
|
includeConfigPatch: configPatchMode !== "none",
|
|
414
|
-
allowKeychainPrompt
|
|
420
|
+
allowKeychainPrompt,
|
|
415
421
|
signal: params.ctx.signal
|
|
416
422
|
});
|
|
417
423
|
if (credentials.length === 0) {
|
|
418
424
|
const requestedKind = resolveRequestedCredentialKind(params.ctx);
|
|
419
|
-
if (!requestedKind) return [];
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
id: credentialKind === "oauth" ? OPENAI_OAUTH_ITEM_ID : OPENAI_API_KEY_ITEM_ID,
|
|
425
|
+
if (!requestedKind && allowKeychainPrompt) return [];
|
|
426
|
+
return (requestedKind ? [requestedKind] : ["oauth", "api_key"]).map((credentialKind) => createMigrationItem({
|
|
427
|
+
id: credentialKind === "api_key" ? OPENAI_API_KEY_ITEM_ID : OPENAI_OAUTH_ITEM_ID,
|
|
423
428
|
kind: "auth",
|
|
424
429
|
action: "skip",
|
|
425
430
|
source: params.source.codexHome,
|
|
426
431
|
status: "skipped",
|
|
427
432
|
sensitive: true,
|
|
428
|
-
reason: CODEX_REASON_AUTH_STORAGE_NOT_IMPORTABLE,
|
|
429
|
-
message: "No supported Codex credential could be imported. Continue with sign-in to connect OpenClaw.",
|
|
433
|
+
reason: allowKeychainPrompt ? CODEX_REASON_AUTH_STORAGE_NOT_IMPORTABLE : void 0,
|
|
434
|
+
message: allowKeychainPrompt ? "No supported Codex credential could be imported. Continue with sign-in to connect OpenClaw." : "Codex credentials have not been inspected. Confirm credential import to check the current Codex sign-in.",
|
|
430
435
|
details: {
|
|
431
436
|
provider: OPENAI_PROVIDER_ID,
|
|
432
437
|
credentialKind,
|
|
433
438
|
credentialImportUnavailable: true
|
|
434
439
|
}
|
|
435
|
-
})
|
|
440
|
+
}));
|
|
436
441
|
}
|
|
437
442
|
const store = loadAuthProfileStoreWithoutExternalProfiles(params.targets.agentDir);
|
|
438
443
|
const skipped = !params.ctx.includeSecrets;
|
|
439
444
|
return credentials.map((credential) => {
|
|
440
|
-
const { profileId, matchedExisting } = itemProfileTarget(credential, store);
|
|
445
|
+
const { profileId, matchedExisting } = itemProfileTarget(credential, store, params.ctx, params.source);
|
|
441
446
|
const existing = store.profiles[profileId];
|
|
442
447
|
const configProfile = authProfileConfigForCredential(credential, profileId);
|
|
443
448
|
const configConflict = configProfile ? hasAuthProfileConfigConflict(params.ctx.config, configProfile, Boolean(params.ctx.overwrite)) : false;
|
|
@@ -459,13 +464,31 @@ async function buildCodexAuthItems(params) {
|
|
|
459
464
|
sourceProfileId: credential.profileId,
|
|
460
465
|
sourceCredentialFingerprint: sourceCredentialFingerprint(credential),
|
|
461
466
|
sourceKind: "codex-native-selected-storage",
|
|
467
|
+
...profileId === "openai:default" && !matchedExisting ? { legacyNativeHome: params.source.codexHome } : {},
|
|
462
468
|
credentialKind: credential.kind,
|
|
463
469
|
credentialImportUnavailable: unavailable
|
|
464
470
|
}
|
|
465
471
|
});
|
|
466
472
|
});
|
|
467
473
|
}
|
|
468
|
-
|
|
474
|
+
function createCodexAuthItemApplier(params) {
|
|
475
|
+
const { items, ...context } = params;
|
|
476
|
+
const selectedKinds = new Set(items.filter((item) => item.kind === "auth" && item.status === "planned").map((item) => item.details?.credentialKind));
|
|
477
|
+
const selectedKind = selectedKinds.size === 1 ? selectedKinds.values().next().value : void 0;
|
|
478
|
+
let snapshot;
|
|
479
|
+
const readCredentials = () => snapshot ??= readCodexAuthCredentials(context.source, {
|
|
480
|
+
credentialKind: selectedKind === "oauth" || selectedKind === "api_key" ? selectedKind : void 0,
|
|
481
|
+
includeConfigPatch: resolveCodexConfigPatchMode(context.ctx) !== "none",
|
|
482
|
+
allowKeychainPrompt: allowCodexKeychainPrompt(context.ctx),
|
|
483
|
+
signal: context.ctx.signal
|
|
484
|
+
});
|
|
485
|
+
return (item) => applyCodexAuthItem({
|
|
486
|
+
...context,
|
|
487
|
+
item,
|
|
488
|
+
readCredentials
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
async function applyCodexAuthItem(params) {
|
|
469
492
|
const { ctx, item, source, targets } = params;
|
|
470
493
|
if (item.status !== "planned") return [item];
|
|
471
494
|
const profileId = typeof item.details?.profileId === "string" ? item.details.profileId : "";
|
|
@@ -474,14 +497,13 @@ async function applyCodexAuthItems(params) {
|
|
|
474
497
|
const credentialKind = item.details?.credentialKind;
|
|
475
498
|
if (!profileId || !provider || credentialKind !== "oauth" && credentialKind !== "api_key") return [markMigrationItemError(item, CODEX_REASON_MISSING_AUTH_METADATA)];
|
|
476
499
|
const configPatchMode = resolveCodexConfigPatchMode(ctx);
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
signal: ctx.signal
|
|
482
|
-
})).find((candidate) => candidate.provider === provider && candidate.kind === credentialKind && (!sourceProfileId || candidate.profileId === sourceProfileId));
|
|
500
|
+
ctx.signal?.throwIfAborted();
|
|
501
|
+
const credentials = await params.readCredentials();
|
|
502
|
+
ctx.signal?.throwIfAborted();
|
|
503
|
+
const credential = credentials.find((candidate) => candidate.provider === provider && candidate.kind === credentialKind && (!sourceProfileId || candidate.profileId === sourceProfileId));
|
|
483
504
|
if (!credential) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_NO_LONGER_PRESENT)];
|
|
484
505
|
if (item.details?.sourceCredentialFingerprint !== sourceCredentialFingerprint(credential)) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_NO_LONGER_PRESENT)];
|
|
506
|
+
if (item.details?.legacyNativeHome !== void 0 && (item.details.legacyNativeHome !== source.codexHome || source.codexHome !== defaultCodexHome())) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_NO_LONGER_PRESENT)];
|
|
485
507
|
ctx.signal?.throwIfAborted();
|
|
486
508
|
const oauthProfile = credential.kind === "oauth" ? credential.result.profiles[0] : void 0;
|
|
487
509
|
const oauthCredential = oauthProfile?.credential.type === "oauth" ? oauthProfile.credential : void 0;
|
|
@@ -497,9 +519,14 @@ async function applyCodexAuthItems(params) {
|
|
|
497
519
|
stateDir: ctx.stateDir,
|
|
498
520
|
updater: (freshStore) => {
|
|
499
521
|
ctx.signal?.throwIfAborted();
|
|
500
|
-
const
|
|
522
|
+
const effectiveStore = loadAuthProfileStoreWithoutExternalProfiles(targets.agentDir);
|
|
523
|
+
if (item.details?.legacyNativeHome !== void 0 && itemProfileTarget(credential, effectiveStore, ctx, source).profileId !== profileId) {
|
|
524
|
+
conflicted = true;
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
const existing = effectiveStore.profiles[profileId];
|
|
501
528
|
if (!ctx.overwrite && existing) {
|
|
502
|
-
if ((credential.kind === "oauth" ? findMatchingOAuthProfile(
|
|
529
|
+
if ((credential.kind === "oauth" ? findMatchingOAuthProfile(effectiveStore, oauthCredential) : findMatchingApiKeyProfile(effectiveStore, credential.provider, credential.key)) === profileId) {
|
|
503
530
|
unusable = existing.type === "oauth" && !hasUsableOAuthCredential(existing);
|
|
504
531
|
return false;
|
|
505
532
|
}
|
|
@@ -519,7 +546,7 @@ async function applyCodexAuthItems(params) {
|
|
|
519
546
|
});
|
|
520
547
|
if (conflicted) return [markMigrationItemConflict(item, CODEX_REASON_AUTH_PROFILE_EXISTS)];
|
|
521
548
|
if (unusable) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_PROFILE_UNUSABLE)];
|
|
522
|
-
if (!store
|
|
549
|
+
if (!store || !loadAuthProfileStoreWithoutExternalProfiles(targets.agentDir).profiles[profileId]) return [markMigrationItemError(item, CODEX_REASON_AUTH_PROFILE_WRITE_FAILED)];
|
|
523
550
|
const configResult = configPatchMode !== "apply" ? "unavailable" : await applyCodexAuthConfig(ctx, credential, profileId);
|
|
524
551
|
if (configResult === "conflict") return [markMigrationItemConflict(item, CODEX_REASON_AUTH_PROFILE_EXISTS)];
|
|
525
552
|
const migratedItem = {
|
|
@@ -564,18 +591,6 @@ function buildCodexAuthConfigPatchItems(ctx, item, credential, profileId) {
|
|
|
564
591
|
return items;
|
|
565
592
|
}
|
|
566
593
|
//#endregion
|
|
567
|
-
//#region extensions/codex/src/migration/targets.ts
|
|
568
|
-
function resolveCodexMigrationTargets(ctx) {
|
|
569
|
-
const cfg = ctx.config;
|
|
570
|
-
const agentId = ctx.targetAgentId ?? resolveDefaultAgentId(cfg);
|
|
571
|
-
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
|
572
|
-
const configuredAgentDir = resolveAgentConfig(cfg, agentId)?.agentDir?.trim();
|
|
573
|
-
return {
|
|
574
|
-
workspaceDir,
|
|
575
|
-
agentDir: ctx.runtime?.agent?.resolveAgentDir(cfg, agentId) ?? (configuredAgentDir ? resolveHomePath(configuredAgentDir) : void 0) ?? path.join(ctx.stateDir, "agents", agentId, "agent")
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
//#endregion
|
|
579
594
|
//#region extensions/codex/src/migration/plan.ts
|
|
580
595
|
const CODEX_PLUGIN_CONFIG_ITEM_ID = "config:codex-plugins";
|
|
581
596
|
const CODEX_PLUGIN_CONFIG_PATH = [
|
|
@@ -880,7 +895,7 @@ function buildPluginConfigItem(ctx, pluginItems) {
|
|
|
880
895
|
});
|
|
881
896
|
}
|
|
882
897
|
async function buildCodexMigrationPlan(ctx) {
|
|
883
|
-
const targets =
|
|
898
|
+
const targets = resolvePlannedMigrationTargets(ctx);
|
|
884
899
|
const memoryOnly = ctx.itemKinds !== void 0 && ctx.itemKinds.length > 0 && ctx.itemKinds.every((kind) => kind === "memory");
|
|
885
900
|
const authOnly = ctx.itemKinds !== void 0 && ctx.itemKinds.length > 0 && ctx.itemKinds.every((kind) => kind === "auth");
|
|
886
901
|
const source = await discoverCodexSource({
|
|
@@ -922,7 +937,6 @@ async function buildCodexMigrationPlan(ctx) {
|
|
|
922
937
|
}));
|
|
923
938
|
}
|
|
924
939
|
const warnings = [
|
|
925
|
-
...!ctx.includeSecrets && items.some((item) => item.kind === "auth") ? ["Auth credentials were detected but skipped. Re-run interactively or pass --include-secrets to import supported credentials."] : [],
|
|
926
940
|
...items.some((item) => item.status === "conflict") ? ["Conflicts were found. Re-run with --overwrite to replace conflicting migration targets after item-level backups."] : [],
|
|
927
941
|
...source.pluginDiscoveryError ? [`Codex app-server plugin inventory discovery failed: ${source.pluginDiscoveryError}. Cached plugin bundles, if any, are advisory only.`] : [],
|
|
928
942
|
...source.plugins.some((plugin) => plugin.migrationBlock?.code === "codex_subscription_required") ? [codexPluginMigrationSubscriptionWarning()] : []
|
|
@@ -944,4 +958,4 @@ async function buildCodexMigrationPlan(ctx) {
|
|
|
944
958
|
};
|
|
945
959
|
}
|
|
946
960
|
//#endregion
|
|
947
|
-
export { CODEX_PLUGIN_CONFIG_ITEM_ID, CODEX_PLUGIN_CONFIG_PATH, buildCodexMigrationPlan, buildCodexPluginsConfigValue, hasCodexPluginConfigConflict,
|
|
961
|
+
export { CODEX_PLUGIN_CONFIG_ITEM_ID, CODEX_PLUGIN_CONFIG_PATH, buildCodexMigrationPlan, buildCodexPluginsConfigValue, hasCodexPluginConfigConflict, resolveCodexConfigPatchMode as n, readCodexPluginMigrationConfigEntry, createCodexAuthItemApplier as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as CODEX_PLUGINS_MARKETPLACE_NAME, i as pluginReadParams, n as isOpenAiCuratedMarketplace, r as isOpenAiCuratedMarketplaceName, t as findCodexMarketplacePluginSummary } from "./plugin-inventory-
|
|
2
|
-
import {
|
|
3
|
-
import "./config-
|
|
1
|
+
import { c as CODEX_PLUGINS_MARKETPLACE_NAME, i as pluginReadParams, n as isOpenAiCuratedMarketplace, r as isOpenAiCuratedMarketplaceName, t as findCodexMarketplacePluginSummary } from "./plugin-inventory-BoRei8Z4.mjs";
|
|
2
|
+
import { o as CodexAppServerRpcError } from "./timeout-C910MdAB.mjs";
|
|
3
|
+
import "./config-BoTP_mrL.mjs";
|
|
4
4
|
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
//#region extensions/codex/src/app-server/plugin-activation.ts
|
|
6
6
|
/**
|
|
@@ -45,7 +45,6 @@ async function ensureCodexPluginActivation(params) {
|
|
|
45
45
|
diagnostics: [{ message: `Codex plugin install failed: ${coerceErrorMessage(error)}` }]
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
if (params.metadataCache && params.appCacheKey) params.metadataCache.invalidate(params.appCacheKey);
|
|
49
48
|
const refreshDiagnostics = [];
|
|
50
49
|
let refreshFailed = false;
|
|
51
50
|
try {
|
|
@@ -53,6 +52,7 @@ async function ensureCodexPluginActivation(params) {
|
|
|
53
52
|
request: params.request,
|
|
54
53
|
appCache: params.appCache,
|
|
55
54
|
appCacheKey: params.appCacheKey,
|
|
55
|
+
appInventoryCacheKey: params.appInventoryCacheKey,
|
|
56
56
|
configCwd: params.configCwd,
|
|
57
57
|
metadataCache: params.metadataCache,
|
|
58
58
|
deferAppInventoryRefresh: params.deferAppInventoryRefresh,
|
|
@@ -74,25 +74,16 @@ async function ensureCodexPluginActivation(params) {
|
|
|
74
74
|
diagnostics: [...refreshDiagnostics, ...installResponse.appsNeedingAuth.map((app) => ({ message: `${app.name} requires app authentication before plugin tools are exposed.` }))]
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
/**
|
|
77
|
+
/** Refreshes OpenClaw inventories after Codex installs a plugin. */
|
|
78
78
|
async function refreshCodexPluginRuntimeState(params) {
|
|
79
79
|
const diagnostics = [];
|
|
80
|
+
if (params.appCacheKey) params.metadataCache?.invalidate(params.appCacheKey);
|
|
80
81
|
await listCuratedCodexPluginMetadata(params, { forceRefetch: true });
|
|
81
|
-
await params.request("skills/list", {
|
|
82
|
-
cwds: params.configCwd ? [params.configCwd] : [],
|
|
83
|
-
forceReload: true
|
|
84
|
-
});
|
|
85
|
-
try {
|
|
86
|
-
await params.request("hooks/list", { cwds: params.configCwd ? [params.configCwd] : [] });
|
|
87
|
-
} catch (error) {
|
|
88
|
-
diagnostics.push({ message: `Codex hooks refresh skipped: ${coerceErrorMessage(error)}` });
|
|
89
|
-
}
|
|
90
|
-
await params.request("config/mcpServer/reload", void 0);
|
|
91
82
|
if (params.appCache && params.appCacheKey) try {
|
|
92
83
|
await refreshCodexAppRuntimeState({
|
|
93
84
|
...params,
|
|
94
85
|
appCache: params.appCache,
|
|
95
|
-
appCacheKey: params.appCacheKey
|
|
86
|
+
appCacheKey: params.appInventoryCacheKey ?? params.appCacheKey
|
|
96
87
|
});
|
|
97
88
|
} catch (error) {
|
|
98
89
|
diagnostics.push({ message: `Codex app inventory refresh skipped: ${coerceErrorMessage(error)}` });
|