@openclaw/codex 2026.9.6 → 2026.9.8
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 +2 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-G348lY1q.mjs} +5 -5
- package/dist/.setup/{apply-DDOi8uNx.mjs → apply-Cqb-YoCS.mjs} +22 -36
- package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-B-S7ngS_.mjs} +128 -37
- package/dist/.setup/attempt-workspace-context-BJ5Z_olH.mjs +164 -0
- package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
- package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dnps4W4_.mjs} +36 -34
- package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
- package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
- package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
- package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-BNunZPtz.mjs} +15 -18
- package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
- package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-DIQ5O_-S.mjs} +1 -1
- package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
- package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-DRvx_wCC.mjs} +1 -1
- package/dist/.setup/{client-Cs08OXVQ.mjs → client-qyUBJlGZ.mjs} +138 -399
- package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-Btrs1D6f.mjs} +5 -8
- package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
- package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-DvlCHJch.mjs} +222 -343
- package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-skzRq4wD.mjs} +15 -18
- package/dist/.setup/compact-8ttks5U5.mjs +776 -0
- package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
- package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
- package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
- package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
- package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
- package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
- package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
- package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-74LaGGH-.mjs} +67 -90
- package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
- package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-OrN6zuaY.mjs} +8 -8
- package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
- package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-Db2sY5cZ.mjs} +2305 -2606
- package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-Bi6-SQ7i.mjs} +8 -17
- package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-DiCS1ijR.mjs} +3 -3
- package/dist/.setup/event-projector-assistant-message-MV_1dj-3.mjs +69 -0
- package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
- package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
- package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
- package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
- package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
- package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
- package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
- package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-D80IXfQF.mjs} +9 -12
- package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
- package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-DiC0Tkha.mjs} +11 -10
- package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
- package/dist/.setup/{models-KnqBv0hE.mjs → models-DfLmPV0k.mjs} +9 -18
- package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
- package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
- package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-BwkQXf9e.mjs} +4395 -3609
- package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
- package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
- package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
- package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
- package/dist/.setup/{plan-CN3VwfNU.mjs → plan-DPdMk1Oy.mjs} +49 -92
- package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
- package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
- package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
- package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
- package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-BRwtRct9.mjs} +116 -176
- package/dist/.setup/{provider-BOsxQHOM.mjs → provider-D6F_7p1I.mjs} +11 -14
- package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-DG5qbsUZ.mjs} +13 -18
- package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
- package/dist/.setup/{request-D2L0zMrq.mjs → request-BZOfsSXW.mjs} +7 -6
- package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
- package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-dYJhjZrp.mjs} +1035 -1023
- package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
- package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
- package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
- package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
- package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
- package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
- package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
- package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
- package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-BFafIiF6.mjs} +185 -350
- package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
- package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
- package/dist/.setup/session-catalog-events-BMCFMZw-.mjs +139 -0
- package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
- package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-DwJjnF5k.mjs} +126 -122
- package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
- package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
- package/dist/.setup/session-catalog-native-projection-CuaFZuQE.mjs +178 -0
- package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
- package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
- package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
- package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
- package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-CGfzfP93.mjs} +6 -4
- package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
- package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-DlmBHYIe.mjs} +9 -22
- package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
- package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
- package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
- package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
- package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
- package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
- package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-LlYWBKTJ.mjs} +17 -17
- package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-DW9W3gza.mjs} +14 -10
- package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-CJCTeFpQ.mjs} +783 -412
- package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +153 -0
- package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-BLeGj7TQ.mjs} +79 -143
- package/dist/.setup/{source-CUzJq5WN.mjs → source-CJis_1EF.mjs} +80 -137
- package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-_bAbjedG.mjs} +294 -737
- package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-B6pPt21M.mjs} +45 -10
- package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
- package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-gNPzzpVp.mjs} +46 -7
- package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-OWGOiDaV.mjs} +199 -302
- package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-GOry0AYh.mjs} +6 -6
- package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
- package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
- package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
- package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
- package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
- package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
- package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-gkdRj2yH.mjs} +23 -23
- package/dist/.setup/{usage-BML0r-ua.mjs → usage-CApUvLOV.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-wSMQkbpV.mjs} +4 -19
- package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-UKgeiBUG.mjs} +8 -19
- package/dist/api.js +9 -11
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +50 -8
- package/dist/harness.js +344 -1
- package/dist/index.js +193 -245
- package/dist/media-understanding-provider.js +9 -22
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +3 -3
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +14 -2
- package/package.json +7 -6
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
- package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
- package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
- package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
- package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
- package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
- package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
- package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
- package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
- package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
- package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
- package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
- package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
- package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
- package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import
|
|
1
|
+
import { u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-Cky2XJUw.mjs";
|
|
2
|
+
import { t as isOnlyMigrationKind } from "./scope-DOC1Xjc8.mjs";
|
|
3
|
+
import "./config-DKhXquav.mjs";
|
|
4
|
+
import { i as hasCodexSource, n as defaultCodexHome, o as readJsonObject, r as discoverCodexSource, s as sanitizeName, t as codexPluginMigrationSubscriptionWarning } from "./source-CJis_1EF.mjs";
|
|
4
5
|
import { asBoolean, asOptionalRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
6
|
import { createHash } from "node:crypto";
|
|
6
7
|
import { runCommandBuffered } from "openclaw/plugin-sdk/process-runtime";
|
|
@@ -11,10 +12,10 @@ import { readSecretFile } from "openclaw/plugin-sdk/secret-file";
|
|
|
11
12
|
import { fileURLToPath } from "node:url";
|
|
12
13
|
import { loadAuthProfileStoreWithoutExternalProfiles } from "openclaw/plugin-sdk/agent-runtime";
|
|
13
14
|
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
|
+
import { extractErrorCode, pathExists } from "openclaw/plugin-sdk/security-runtime";
|
|
15
16
|
import { MIGRATION_REASON_TARGET_EXISTS, createMigrationItem, createMigrationManualItem, hasMigrationConfigPatchConflict, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, mergeMigrationConfigValue, readMigrationConfigPath, resolveMigrationConfigRuntime, summarizeMigrationItems } from "openclaw/plugin-sdk/migration";
|
|
16
17
|
import { resolvePlannedMigrationTargets } from "openclaw/plugin-sdk/migration-runtime";
|
|
17
|
-
import { decodeOpenAICodexJwtPayload } from "openclaw/plugin-sdk/provider-oauth-runtime";
|
|
18
|
+
import { decodeOpenAICodexJwtPayload as decodeOpenAICodexJwtPayload$1 } from "openclaw/plugin-sdk/provider-oauth-runtime";
|
|
18
19
|
//#region extensions/codex/src/migration/auth-profile-target.ts
|
|
19
20
|
const OPENAI_PROVIDER_ID$1 = "openai";
|
|
20
21
|
const LEGACY_CODEX_PROFILE_ID = "openai:default";
|
|
@@ -28,7 +29,7 @@ function findMatchingOAuthProfile(store, credential) {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
function oauthSubject(credential) {
|
|
31
|
-
const claims = decodeOpenAICodexJwtPayload(credential.access)?.["https://api.openai.com/auth"];
|
|
32
|
+
const claims = decodeOpenAICodexJwtPayload$1(credential.access)?.["https://api.openai.com/auth"];
|
|
32
33
|
if (!isRecord(claims)) return;
|
|
33
34
|
const accountId = normalizeOptionalString(claims.chatgpt_account_id);
|
|
34
35
|
const userId = normalizeOptionalString(claims.chatgpt_user_id) ?? normalizeOptionalString(claims.user_id);
|
|
@@ -96,8 +97,8 @@ async function readCodexCliCredentialsAsync(options) {
|
|
|
96
97
|
options.signal?.throwIfAborted();
|
|
97
98
|
if (!options.allowKeychainPrompt) return;
|
|
98
99
|
const home = await fs.realpath(options.codexHome).catch(() => path.resolve(options.codexHome));
|
|
99
|
-
const { CodexAppServerClient } = await import("./client-
|
|
100
|
-
const { resolveManagedCodexPackageEntrypoint, resolveManagedCodexNativeCommand } = await import("./managed-binary-
|
|
100
|
+
const { CodexAppServerClient } = await import("./client-qyUBJlGZ.mjs").then((n) => n.n);
|
|
101
|
+
const { resolveManagedCodexPackageEntrypoint, resolveManagedCodexNativeCommand } = await import("./managed-binary-kiWRhNRE.mjs").then((n) => n.n);
|
|
101
102
|
const launcher = resolveManagedCodexPackageEntrypoint(path.dirname(fileURLToPath(import.meta.url)));
|
|
102
103
|
const command = launcher ? resolveManagedCodexNativeCommand(launcher) : void 0;
|
|
103
104
|
if (!command) return;
|
|
@@ -179,12 +180,8 @@ async function readNativeCredential(client, home, options, signal) {
|
|
|
179
180
|
} : void 0;
|
|
180
181
|
}
|
|
181
182
|
function jwtExpiry(token) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return typeof exp === "number" && Number.isFinite(exp) && exp > 0 ? exp * 1e3 : void 0;
|
|
185
|
-
} catch {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
183
|
+
const exp = decodeOpenAICodexJwtPayload$1(token)?.exp;
|
|
184
|
+
return typeof exp === "number" && Number.isFinite(exp) && exp > 0 ? exp * 1e3 : void 0;
|
|
188
185
|
}
|
|
189
186
|
function parseOAuthCredential(data) {
|
|
190
187
|
const mode = typeof data.auth_mode === "string" ? data.auth_mode.toLowerCase() : void 0;
|
|
@@ -300,15 +297,10 @@ function replaceConfigDraft(draft, next) {
|
|
|
300
297
|
for (const key of Object.keys(draft)) delete draft[key];
|
|
301
298
|
Object.assign(draft, next);
|
|
302
299
|
}
|
|
303
|
-
function existingAuthProfileConfigIsCompatible(existing, profile) {
|
|
304
|
-
if (existing.provider !== profile.provider || existing.mode !== profile.mode) return false;
|
|
305
|
-
if (existing.email && profile.email && existing.email !== profile.email) return false;
|
|
306
|
-
return true;
|
|
307
|
-
}
|
|
308
300
|
function hasAuthProfileConfigConflict(config, profile, overwrite) {
|
|
309
301
|
if (overwrite) return false;
|
|
310
302
|
const existing = config.auth?.profiles?.[profile.profileId];
|
|
311
|
-
return Boolean(existing &&
|
|
303
|
+
return Boolean(existing && (existing.provider !== profile.provider || existing.mode !== profile.mode || existing.email && profile.email && existing.email !== profile.email));
|
|
312
304
|
}
|
|
313
305
|
function hasCurrentAuthProfileConfigConflict(ctx, profile) {
|
|
314
306
|
let config = ctx.config;
|
|
@@ -334,28 +326,6 @@ function applyDefaultModelIfMissing(cfg) {
|
|
|
334
326
|
}
|
|
335
327
|
};
|
|
336
328
|
}
|
|
337
|
-
function applyOAuthConfigToConfig(cfg, credential, profileId) {
|
|
338
|
-
let next = mergeMigrationConfigValue(cfg, credential.result.configPatch);
|
|
339
|
-
const profile = credential.result.profiles[0];
|
|
340
|
-
if (profile) next = applyAuthProfileConfig(next, {
|
|
341
|
-
profileId,
|
|
342
|
-
provider: profile.credential.provider,
|
|
343
|
-
mode: "oauth",
|
|
344
|
-
..."email" in profile.credential && profile.credential.email ? { email: profile.credential.email } : {},
|
|
345
|
-
..."displayName" in profile.credential && profile.credential.displayName ? { displayName: profile.credential.displayName } : {},
|
|
346
|
-
preferProfileFirst: false
|
|
347
|
-
});
|
|
348
|
-
return applyDefaultModelIfMissing(next);
|
|
349
|
-
}
|
|
350
|
-
function applyApiKeyConfigToConfig(cfg, credential, profileId) {
|
|
351
|
-
return applyAuthProfileConfig(cfg, {
|
|
352
|
-
profileId,
|
|
353
|
-
provider: credential.provider,
|
|
354
|
-
mode: "api_key",
|
|
355
|
-
displayName: CODEX_IMPORT_DISPLAY_NAME,
|
|
356
|
-
preferProfileFirst: false
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
329
|
function resolveCodexConfigPatchMode(ctx) {
|
|
360
330
|
const mode = ctx.providerOptions?.configPatchMode;
|
|
361
331
|
return mode === "none" || mode === "return" ? mode : "apply";
|
|
@@ -393,9 +363,8 @@ async function applyCodexAuthProfileConfig(ctx, profile, applyConfig) {
|
|
|
393
363
|
base: "runtime",
|
|
394
364
|
afterWrite: { mode: "auto" },
|
|
395
365
|
mutate(draft) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
replaceConfigDraft(draft, applyConfig(current));
|
|
366
|
+
if (hasAuthProfileConfigConflict(draft, profile, Boolean(ctx.overwrite))) throw new CodexAuthConfigConflict();
|
|
367
|
+
replaceConfigDraft(draft, applyConfig(draft));
|
|
399
368
|
}
|
|
400
369
|
});
|
|
401
370
|
return "configured";
|
|
@@ -403,13 +372,14 @@ async function applyCodexAuthProfileConfig(ctx, profile, applyConfig) {
|
|
|
403
372
|
return error instanceof CodexAuthConfigConflict ? "conflict" : "unavailable";
|
|
404
373
|
}
|
|
405
374
|
}
|
|
406
|
-
async function applyCodexAuthConfig(ctx, credential, profileId) {
|
|
407
|
-
const profile = authProfileConfigForCredential(credential, profileId);
|
|
408
|
-
if (!profile) return "unavailable";
|
|
409
|
-
return applyCodexAuthProfileConfig(ctx, profile, (config) => applyCredentialConfig(config, credential, profileId));
|
|
410
|
-
}
|
|
411
375
|
function applyCredentialConfig(config, credential, profileId) {
|
|
412
|
-
|
|
376
|
+
let next = credential.kind === "oauth" ? mergeMigrationConfigValue(config, credential.result.configPatch) : config;
|
|
377
|
+
const profile = authProfileConfigForCredential(credential, profileId);
|
|
378
|
+
if (profile) next = applyAuthProfileConfig(next, {
|
|
379
|
+
...profile,
|
|
380
|
+
preferProfileFirst: false
|
|
381
|
+
});
|
|
382
|
+
return credential.kind === "oauth" ? applyDefaultModelIfMissing(next) : next;
|
|
413
383
|
}
|
|
414
384
|
async function buildCodexAuthItems(params) {
|
|
415
385
|
const configPatchMode = resolveCodexConfigPatchMode(params.ctx);
|
|
@@ -501,8 +471,7 @@ async function applyCodexAuthItem(params) {
|
|
|
501
471
|
const credentials = await params.readCredentials();
|
|
502
472
|
ctx.signal?.throwIfAborted();
|
|
503
473
|
const credential = credentials.find((candidate) => candidate.provider === provider && candidate.kind === credentialKind && (!sourceProfileId || candidate.profileId === sourceProfileId));
|
|
504
|
-
if (!credential) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_NO_LONGER_PRESENT)];
|
|
505
|
-
if (item.details?.sourceCredentialFingerprint !== sourceCredentialFingerprint(credential)) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_NO_LONGER_PRESENT)];
|
|
474
|
+
if (!credential || item.details?.sourceCredentialFingerprint !== sourceCredentialFingerprint(credential)) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_NO_LONGER_PRESENT)];
|
|
506
475
|
if (item.details?.legacyNativeHome !== void 0 && (item.details.legacyNativeHome !== source.codexHome || source.codexHome !== defaultCodexHome())) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_NO_LONGER_PRESENT)];
|
|
507
476
|
ctx.signal?.throwIfAborted();
|
|
508
477
|
const oauthProfile = credential.kind === "oauth" ? credential.result.profiles[0] : void 0;
|
|
@@ -547,7 +516,7 @@ async function applyCodexAuthItem(params) {
|
|
|
547
516
|
if (conflicted) return [markMigrationItemConflict(item, CODEX_REASON_AUTH_PROFILE_EXISTS)];
|
|
548
517
|
if (unusable) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_PROFILE_UNUSABLE)];
|
|
549
518
|
if (!store || !loadAuthProfileStoreWithoutExternalProfiles(targets.agentDir).profiles[profileId]) return [markMigrationItemError(item, CODEX_REASON_AUTH_PROFILE_WRITE_FAILED)];
|
|
550
|
-
const configResult = configPatchMode !== "apply" ? "unavailable" : await
|
|
519
|
+
const configResult = configPatchMode !== "apply" ? "unavailable" : await applyCodexAuthProfileConfig(ctx, configProfile, (config) => applyCredentialConfig(config, credential, profileId));
|
|
551
520
|
if (configResult === "conflict") return [markMigrationItemConflict(item, CODEX_REASON_AUTH_PROFILE_EXISTS)];
|
|
552
521
|
const migratedItem = {
|
|
553
522
|
...item,
|
|
@@ -563,32 +532,28 @@ async function applyCodexAuthItem(params) {
|
|
|
563
532
|
}
|
|
564
533
|
function buildCodexAuthConfigPatchItems(ctx, item, credential, profileId) {
|
|
565
534
|
const next = applyCredentialConfig(ctx.config, credential, profileId);
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
535
|
+
return [{
|
|
536
|
+
suffix: "auth",
|
|
537
|
+
path: ["auth"],
|
|
538
|
+
value: next.auth,
|
|
539
|
+
message: "Configure imported Codex auth profile."
|
|
540
|
+
}, {
|
|
541
|
+
suffix: "agents-defaults",
|
|
542
|
+
path: ["agents", "defaults"],
|
|
543
|
+
value: next.agents?.defaults,
|
|
544
|
+
message: "Configure imported Codex models."
|
|
545
|
+
}].flatMap(({ suffix, path, value, message }) => value ? [createMigrationItem({
|
|
546
|
+
id: `${item.id}:config:${suffix}`,
|
|
569
547
|
kind: "config",
|
|
570
548
|
action: "merge",
|
|
571
549
|
status: "migrated",
|
|
572
|
-
target: "
|
|
573
|
-
message
|
|
550
|
+
target: path.join("."),
|
|
551
|
+
message,
|
|
574
552
|
details: {
|
|
575
|
-
path
|
|
576
|
-
value
|
|
577
|
-
}
|
|
578
|
-
}));
|
|
579
|
-
if (next.agents?.defaults) items.push(createMigrationItem({
|
|
580
|
-
id: `${item.id}:config:agents-defaults`,
|
|
581
|
-
kind: "config",
|
|
582
|
-
action: "merge",
|
|
583
|
-
status: "migrated",
|
|
584
|
-
target: "agents.defaults",
|
|
585
|
-
message: "Configure imported Codex models.",
|
|
586
|
-
details: {
|
|
587
|
-
path: ["agents", "defaults"],
|
|
588
|
-
value: next.agents.defaults
|
|
553
|
+
path,
|
|
554
|
+
value
|
|
589
555
|
}
|
|
590
|
-
}));
|
|
591
|
-
return items;
|
|
556
|
+
})] : []);
|
|
592
557
|
}
|
|
593
558
|
//#endregion
|
|
594
559
|
//#region extensions/codex/src/migration/plan.ts
|
|
@@ -689,7 +654,7 @@ async function buildCodexSkillItems(params) {
|
|
|
689
654
|
}, /* @__PURE__ */ new Map());
|
|
690
655
|
return await Promise.all(planned.map(async (item) => {
|
|
691
656
|
const collision = (resolvedCounts.get(item.name) ?? 0) > 1;
|
|
692
|
-
const targetExists = await
|
|
657
|
+
const targetExists = await pathExists(item.target);
|
|
693
658
|
const conflict = collision || targetExists && !params.overwrite;
|
|
694
659
|
return createMigrationItem({
|
|
695
660
|
id: `skill:${item.name}`,
|
|
@@ -714,10 +679,7 @@ function readExistingCodexPluginEntries(config) {
|
|
|
714
679
|
function hasExistingCodexPluginEntry(existingEntries, configKey, pluginName, nextEntry) {
|
|
715
680
|
const existingEntry = existingEntries[configKey];
|
|
716
681
|
if (existingEntry !== void 0) return !isLegacyDestructivePolicyRepair(existingEntry, nextEntry);
|
|
717
|
-
return Object.values(existingEntries).some((entry) =>
|
|
718
|
-
if (!isRecord(entry)) return false;
|
|
719
|
-
return entry.pluginName === pluginName;
|
|
720
|
-
});
|
|
682
|
+
return Object.values(existingEntries).some((entry) => isRecord(entry) && entry.pluginName === pluginName);
|
|
721
683
|
}
|
|
722
684
|
function isLegacyDestructivePolicyRepair(existing, nextEntry) {
|
|
723
685
|
const existingEntry = isRecord(existing) ? existing : void 0;
|
|
@@ -742,14 +704,12 @@ function buildPluginItems(ctx, plugins) {
|
|
|
742
704
|
for (const plugin of plugins) {
|
|
743
705
|
if (plugin.migratable && plugin.marketplaceName === "openai-curated" && plugin.pluginName) {
|
|
744
706
|
const configKey = plugin.pluginName;
|
|
707
|
+
const allowDestructiveActions = readExistingPluginAllowDestructiveActions(existingPluginEntries[configKey], plugin.pluginName);
|
|
745
708
|
const plannedEntry = {
|
|
746
709
|
enabled: true,
|
|
747
710
|
marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
|
|
748
711
|
pluginName: plugin.pluginName,
|
|
749
|
-
...
|
|
750
|
-
const allowDestructiveActions = readExistingPluginAllowDestructiveActions(existingPluginEntries[configKey], plugin.pluginName);
|
|
751
|
-
return allowDestructiveActions ? { allow_destructive_actions: allowDestructiveActions } : {};
|
|
752
|
-
})()
|
|
712
|
+
...allowDestructiveActions ? { allow_destructive_actions: allowDestructiveActions } : {}
|
|
753
713
|
};
|
|
754
714
|
const conflict = !ctx.overwrite && hasExistingCodexPluginEntry(existingPluginEntries, configKey, plugin.pluginName, plannedEntry);
|
|
755
715
|
items.push(createMigrationItem({
|
|
@@ -768,8 +728,8 @@ function buildPluginItems(ctx, plugins) {
|
|
|
768
728
|
pluginName: plugin.pluginName,
|
|
769
729
|
sourceInstalled: plugin.installed === true,
|
|
770
730
|
sourceEnabled: plugin.enabled === true,
|
|
771
|
-
...
|
|
772
|
-
...plugin.apps && plugin.apps.length > 0 &&
|
|
731
|
+
...allowDestructiveActions ? { allowDestructiveActions } : {},
|
|
732
|
+
...plugin.apps && plugin.apps.length > 0 && ctx.providerOptions?.verifyPluginApps !== true ? { sourceAppVerification: CODEX_PLUGIN_SOURCE_APP_VERIFICATION_UNVERIFIED } : {}
|
|
773
733
|
}
|
|
774
734
|
}));
|
|
775
735
|
continue;
|
|
@@ -802,9 +762,6 @@ function buildPluginItems(ctx, plugins) {
|
|
|
802
762
|
}
|
|
803
763
|
return items;
|
|
804
764
|
}
|
|
805
|
-
function shouldVerifyPluginApps(ctx) {
|
|
806
|
-
return ctx.providerOptions?.verifyPluginApps === true;
|
|
807
|
-
}
|
|
808
765
|
function readCodexPluginMigrationConfigEntry(item, enabled) {
|
|
809
766
|
const configKey = item.details?.configKey;
|
|
810
767
|
const marketplaceName = item.details?.marketplaceName;
|
|
@@ -896,14 +853,14 @@ function buildPluginConfigItem(ctx, pluginItems) {
|
|
|
896
853
|
}
|
|
897
854
|
async function buildCodexMigrationPlan(ctx) {
|
|
898
855
|
const targets = resolvePlannedMigrationTargets(ctx);
|
|
899
|
-
const memoryOnly = ctx
|
|
900
|
-
const authOnly = ctx
|
|
856
|
+
const memoryOnly = isOnlyMigrationKind(ctx, "memory");
|
|
857
|
+
const authOnly = isOnlyMigrationKind(ctx, "auth");
|
|
901
858
|
const source = await discoverCodexSource({
|
|
902
859
|
input: ctx.source,
|
|
903
860
|
memoryOnly,
|
|
904
861
|
authOnly,
|
|
905
862
|
evaluatePluginMigrationEligibility: !memoryOnly && !authOnly,
|
|
906
|
-
verifyPluginApps:
|
|
863
|
+
verifyPluginApps: ctx.providerOptions?.verifyPluginApps === true
|
|
907
864
|
});
|
|
908
865
|
if (!hasCodexSource(source) && !authOnly) throw new Error(`Codex state was not found at ${source.root}. Pass --from <path> if it lives elsewhere.`);
|
|
909
866
|
const items = [];
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./config-
|
|
1
|
+
import { i as listCodexPluginMetadata, n as isOpenAiCuratedMarketplace, o as pluginReadParams, r as isOpenAiCuratedMarketplaceName, t as findCodexMarketplacePluginSummary, u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-Cky2XJUw.mjs";
|
|
2
|
+
import { n as CodexAppServerRpcError } from "./rpc-error-BlD2vuzn.mjs";
|
|
3
|
+
import "./config-DKhXquav.mjs";
|
|
4
4
|
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
//#region extensions/codex/src/app-server/plugin-activation.ts
|
|
6
|
-
/**
|
|
7
|
-
* Activates legacy curated Codex plugins while requiring owner-managed
|
|
8
|
-
* installation for every other marketplace.
|
|
9
|
-
*/
|
|
10
6
|
/** Activates legacy curated plugins without granting install authority to other marketplaces. */
|
|
11
7
|
async function ensureCodexPluginActivation(params) {
|
|
12
8
|
if (params.identity.marketplaceName === "workspace-directory") return activationFailure(params.identity, "disabled", { message: "workspace-directory plugins must be installed and enabled outside OpenClaw before use." });
|
|
@@ -14,7 +10,7 @@ async function ensureCodexPluginActivation(params) {
|
|
|
14
10
|
const target = params.identity.pluginName.endsWith(`@${params.identity.marketplaceName}`) ? params.identity.pluginName : `${params.identity.pluginName}@${params.identity.marketplaceName}`;
|
|
15
11
|
return activationFailure(params.identity, "disabled", { message: `${params.identity.marketplaceName} plugins must be installed and enabled by an owner before use. Run /codex plugins install ${target}.` });
|
|
16
12
|
}
|
|
17
|
-
const listed = await
|
|
13
|
+
const listed = await listCodexPluginMetadata(params, CODEX_PLUGINS_MARKETPLACE_NAME);
|
|
18
14
|
const resolved = findCodexMarketplacePluginSummary(listed, params.identity.marketplaceName, params.identity.pluginName);
|
|
19
15
|
if (!resolved) {
|
|
20
16
|
if (!listed.marketplaces.some((marketplace) => isOpenAiCuratedMarketplace(marketplace))) return activationFailure(params.identity, "marketplace_missing", { message: `Codex marketplace ${CODEX_PLUGINS_MARKETPLACE_NAME} was not found.` });
|
|
@@ -48,16 +44,7 @@ async function ensureCodexPluginActivation(params) {
|
|
|
48
44
|
const refreshDiagnostics = [];
|
|
49
45
|
let refreshFailed = false;
|
|
50
46
|
try {
|
|
51
|
-
const refreshResult = await refreshCodexPluginRuntimeState(
|
|
52
|
-
request: params.request,
|
|
53
|
-
appCache: params.appCache,
|
|
54
|
-
appCacheKey: params.appCacheKey,
|
|
55
|
-
appInventoryCacheKey: params.appInventoryCacheKey,
|
|
56
|
-
configCwd: params.configCwd,
|
|
57
|
-
metadataCache: params.metadataCache,
|
|
58
|
-
deferAppInventoryRefresh: params.deferAppInventoryRefresh,
|
|
59
|
-
targetAppIds: params.targetAppIds
|
|
60
|
-
});
|
|
47
|
+
const refreshResult = await refreshCodexPluginRuntimeState(params);
|
|
61
48
|
refreshDiagnostics.push(...refreshResult.diagnostics);
|
|
62
49
|
} catch (error) {
|
|
63
50
|
refreshFailed = true;
|
|
@@ -74,11 +61,10 @@ async function ensureCodexPluginActivation(params) {
|
|
|
74
61
|
diagnostics: [...refreshDiagnostics, ...installResponse.appsNeedingAuth.map((app) => ({ message: `${app.name} requires app authentication before plugin tools are exposed.` }))]
|
|
75
62
|
};
|
|
76
63
|
}
|
|
77
|
-
/** Refreshes OpenClaw inventories after Codex installs a plugin. */
|
|
78
64
|
async function refreshCodexPluginRuntimeState(params) {
|
|
79
65
|
const diagnostics = [];
|
|
80
66
|
if (params.appCacheKey) params.metadataCache?.invalidate(params.appCacheKey);
|
|
81
|
-
await
|
|
67
|
+
await listCodexPluginMetadata(params, CODEX_PLUGINS_MARKETPLACE_NAME, { forceRefetch: true });
|
|
82
68
|
if (params.appCache && params.appCacheKey) try {
|
|
83
69
|
await refreshCodexAppRuntimeState({
|
|
84
70
|
...params,
|
|
@@ -102,27 +88,13 @@ async function refreshCodexAppRuntimeState(params) {
|
|
|
102
88
|
targetAppIds: params.targetAppIds
|
|
103
89
|
});
|
|
104
90
|
}
|
|
105
|
-
|
|
106
|
-
const requestParams = {
|
|
107
|
-
...params.configCwd ? { cwds: [params.configCwd] } : {},
|
|
108
|
-
...options.forceRefetch ? { forceRefetch: true } : {}
|
|
109
|
-
};
|
|
110
|
-
if (!params.metadataCache || !params.appCacheKey) return await params.request("plugin/list", requestParams);
|
|
111
|
-
return (await params.metadataCache.load({
|
|
112
|
-
appCacheKey: params.appCacheKey,
|
|
113
|
-
queryKind: "curated-global",
|
|
114
|
-
requestParams,
|
|
115
|
-
request: async (method, listedParams) => await params.request(method, listedParams),
|
|
116
|
-
cacheable: (response) => response.marketplaces.some((marketplace) => isOpenAiCuratedMarketplace(marketplace))
|
|
117
|
-
})).response;
|
|
118
|
-
}
|
|
119
|
-
function activationFailure(identity, reason, diagnostic, extraDiagnostics = []) {
|
|
91
|
+
function activationFailure(identity, reason, diagnostic) {
|
|
120
92
|
return {
|
|
121
93
|
identity,
|
|
122
94
|
ok: false,
|
|
123
95
|
reason,
|
|
124
96
|
installAttempted: false,
|
|
125
|
-
diagnostics: [diagnostic
|
|
97
|
+
diagnostics: [diagnostic]
|
|
126
98
|
};
|
|
127
99
|
}
|
|
128
100
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as resolveCodexAppServerLocalHomeDir, r as resolveCodexAppServerUserHomeDir, t as resolveCodexAppServerHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -23,15 +23,9 @@ function findCodexAppById(apps, id) {
|
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region extensions/codex/src/app-server/app-inventory-cache.ts
|
|
26
|
-
/**
|
|
27
|
-
* Process-local cache for Codex app-server app inventories, keyed by runtime
|
|
28
|
-
* identity and safe to refresh in the background.
|
|
29
|
-
*/
|
|
30
|
-
/** Default app inventory cache freshness window. */
|
|
31
26
|
const CODEX_APP_INVENTORY_CACHE_TTL_MS = 36e5;
|
|
32
27
|
const CODEX_APP_READ_BATCH_LIMIT = 100;
|
|
33
28
|
const MAX_SERIALIZED_ERROR_MESSAGE_LENGTH = 500;
|
|
34
|
-
/** In-memory app inventory cache with coalesced refreshes per key. */
|
|
35
29
|
var CodexAppInventoryCache = class {
|
|
36
30
|
constructor(options = {}) {
|
|
37
31
|
this.entries = /* @__PURE__ */ new Map();
|
|
@@ -41,7 +35,6 @@ var CodexAppInventoryCache = class {
|
|
|
41
35
|
this.revision = 0;
|
|
42
36
|
this.ttlMs = options.ttlMs ?? CODEX_APP_INVENTORY_CACHE_TTL_MS;
|
|
43
37
|
}
|
|
44
|
-
/** Reads a snapshot and schedules refresh when missing, stale, or forced. */
|
|
45
38
|
read(params) {
|
|
46
39
|
const nowMs = resolveDateTimestampMs(params.nowMs);
|
|
47
40
|
const entry = this.entries.get(params.key);
|
|
@@ -66,10 +59,6 @@ var CodexAppInventoryCache = class {
|
|
|
66
59
|
...entry.lastError ? { diagnostic: entry.lastError } : {}
|
|
67
60
|
};
|
|
68
61
|
}
|
|
69
|
-
/** Forces or joins an immediate refresh for a cache key. */
|
|
70
|
-
refreshNow(params) {
|
|
71
|
-
return this.refresh(params);
|
|
72
|
-
}
|
|
73
62
|
/**
|
|
74
63
|
* Marks a key stale and records the reason as a diagnostic. A scope names
|
|
75
64
|
* the app ids the invalidation concerns so a covering targeted refresh can
|
|
@@ -77,7 +66,7 @@ var CodexAppInventoryCache = class {
|
|
|
77
66
|
*/
|
|
78
67
|
invalidate(key, reason, nowMs = Date.now(), invalidatedAppIds) {
|
|
79
68
|
this.revision += 1;
|
|
80
|
-
this.refreshTokens.
|
|
69
|
+
this.refreshTokens.delete(key);
|
|
81
70
|
this.inFlight.delete(key);
|
|
82
71
|
const diagnostic = {
|
|
83
72
|
message: reason,
|
|
@@ -95,7 +84,6 @@ var CodexAppInventoryCache = class {
|
|
|
95
84
|
} else this.diagnostics.set(key, diagnostic);
|
|
96
85
|
return this.revision;
|
|
97
86
|
}
|
|
98
|
-
/** Clears all cached snapshots, diagnostics, in-flight requests, and revision state. */
|
|
99
87
|
clear() {
|
|
100
88
|
this.entries.clear();
|
|
101
89
|
this.inFlight.clear();
|
|
@@ -103,20 +91,18 @@ var CodexAppInventoryCache = class {
|
|
|
103
91
|
this.diagnostics.clear();
|
|
104
92
|
this.revision = 0;
|
|
105
93
|
}
|
|
106
|
-
/** Returns the monotonically increasing cache revision. */
|
|
107
94
|
getRevision() {
|
|
108
95
|
return this.revision;
|
|
109
96
|
}
|
|
110
97
|
scheduleRefresh(params) {
|
|
111
|
-
|
|
112
|
-
if (existing && !params.forceRefetch && doesInFlightRefreshCover(existing, params)) return true;
|
|
113
|
-
this.refresh(params).catch(() => void 0);
|
|
98
|
+
this.refreshNow(params).catch(() => void 0);
|
|
114
99
|
return true;
|
|
115
100
|
}
|
|
116
|
-
|
|
101
|
+
/** Forces or joins an immediate refresh for a cache key. */
|
|
102
|
+
async refreshNow(params) {
|
|
117
103
|
const existing = this.inFlight.get(params.key);
|
|
118
104
|
if (existing && !params.forceRefetch && doesInFlightRefreshCover(existing, params)) return existing.promise;
|
|
119
|
-
const refreshToken = (
|
|
105
|
+
const refreshToken = Symbol("app-inventory-refresh");
|
|
120
106
|
this.refreshTokens.set(params.key, refreshToken);
|
|
121
107
|
const previousRefresh = params.forceRefetch ? void 0 : existing?.promise;
|
|
122
108
|
const promise = this.refreshUncoalesced(params, refreshToken, previousRefresh);
|
|
@@ -236,7 +222,6 @@ function doesInFlightRefreshCover(existing, params) {
|
|
|
236
222
|
const requestedAppIds = new Set(params.targetAppIds?.filter(Boolean).map(codexAppIdentityKey) ?? []);
|
|
237
223
|
return requestedAppIds.size > 0 && Array.from(requestedAppIds).every((appId) => existing.targetAppIds.has(appId));
|
|
238
224
|
}
|
|
239
|
-
/** Serializes a refresh failure without leaking large or sensitive error data. */
|
|
240
225
|
function serializeCodexAppInventoryError(error) {
|
|
241
226
|
const record = isRecord(error) ? error : void 0;
|
|
242
227
|
const data = record && "data" in record ? redactErrorData(record.data) : void 0;
|
|
@@ -247,9 +232,7 @@ function serializeCodexAppInventoryError(error) {
|
|
|
247
232
|
...data !== void 0 ? { data } : {}
|
|
248
233
|
};
|
|
249
234
|
}
|
|
250
|
-
/** Shared app inventory cache used by Codex app-server runtime paths. */
|
|
251
235
|
const defaultCodexAppInventoryCache = new CodexAppInventoryCache();
|
|
252
|
-
/** Builds a stable cache key from build versions and runtime identity fields. */
|
|
253
236
|
function buildCodexAppInventoryCacheKey(input, openClawVersion, codexPluginVersion) {
|
|
254
237
|
return JSON.stringify({
|
|
255
238
|
openClawVersion,
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { f as resolveCodexPluginsPolicy } from "./config-parsing-
|
|
2
|
-
import { c as findCodexAppById } from "./plugin-app-cache-key-
|
|
3
|
-
import "./config-
|
|
1
|
+
import { f as resolveCodexPluginsPolicy } from "./config-parsing-b088LyhT.mjs";
|
|
2
|
+
import { c as findCodexAppById } from "./plugin-app-cache-key-BL9B5H0L.mjs";
|
|
3
|
+
import "./config-DKhXquav.mjs";
|
|
4
4
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
5
5
|
//#region extensions/codex/src/app-server/config-contracts.ts
|
|
6
6
|
const CODEX_PLUGINS_MARKETPLACE_NAME = "openai-curated";
|
|
7
7
|
const CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME = "workspace-directory";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region extensions/codex/src/app-server/plugin-inventory.ts
|
|
10
|
-
/**
|
|
11
|
-
* Reads Codex plugin marketplace state and app inventory to decide which
|
|
12
|
-
* plugin-owned apps can be exposed to a native Codex thread.
|
|
13
|
-
*/
|
|
14
10
|
const CODEX_PLUGINS_REMOTE_MARKETPLACE_NAME = `${CODEX_PLUGINS_MARKETPLACE_NAME}-remote`;
|
|
15
11
|
const CODEX_PLUGINS_API_MARKETPLACE_NAME = "openai-api-curated";
|
|
16
|
-
/** Reads configured Codex plugin state and maps owned apps to readiness diagnostics. */
|
|
17
12
|
async function readCodexPluginInventory(params) {
|
|
18
13
|
const policy = params.policy ?? resolveCodexPluginsPolicy(params.pluginConfig);
|
|
19
14
|
if (!policy.enabled) return {
|
|
@@ -148,7 +143,6 @@ function pluginReadParams(marketplace, pluginName) {
|
|
|
148
143
|
pluginName
|
|
149
144
|
};
|
|
150
145
|
}
|
|
151
|
-
/** Returns configured plugin keys whose current metadata may still recover. */
|
|
152
146
|
function resolveRecoverableCodexPluginConfigKeys(params) {
|
|
153
147
|
return params.policy.pluginPolicies.filter((pluginPolicy) => pluginPolicy.enabled && !isSettledMissingPluginPolicy({
|
|
154
148
|
pluginPolicy,
|
|
@@ -157,8 +151,11 @@ function resolveRecoverableCodexPluginConfigKeys(params) {
|
|
|
157
151
|
configCwd: params.configCwd
|
|
158
152
|
})).map((pluginPolicy) => pluginPolicy.configKey).toSorted();
|
|
159
153
|
}
|
|
160
|
-
async function listCodexPluginMetadata(params, marketplaceName) {
|
|
161
|
-
const requestParams =
|
|
154
|
+
async function listCodexPluginMetadata(params, marketplaceName, options = {}) {
|
|
155
|
+
const requestParams = {
|
|
156
|
+
...buildPluginCatalogRequestParams(params, marketplaceName),
|
|
157
|
+
...options.forceRefetch ? { forceRefetch: true } : {}
|
|
158
|
+
};
|
|
162
159
|
if (!params.metadataCache || !params.appCacheKey) return await params.request("plugin/list", requestParams);
|
|
163
160
|
return (await params.metadataCache.load({
|
|
164
161
|
appCacheKey: params.appCacheKey,
|
|
@@ -233,7 +230,7 @@ async function readPluginDetail(params, marketplace, pluginPolicy, summary, diag
|
|
|
233
230
|
}
|
|
234
231
|
function resolveAppOwnership(params) {
|
|
235
232
|
if (params.detail && params.detail.apps.length > 0) return "proven";
|
|
236
|
-
return (params.appInventory?.snapshot?.apps ?? []).
|
|
233
|
+
return (params.appInventory?.snapshot?.apps ?? []).some((app) => app.pluginDisplayNames.includes(params.summary.name)) ? "ambiguous" : "none";
|
|
237
234
|
}
|
|
238
235
|
function resolveOwnedApps(params) {
|
|
239
236
|
const detailApps = params.detail?.apps ?? [];
|
|
@@ -257,15 +254,19 @@ function resolveOwnedApps(params) {
|
|
|
257
254
|
enabled: false,
|
|
258
255
|
needsAuth: true
|
|
259
256
|
};
|
|
260
|
-
return Object.assign({
|
|
261
|
-
id: info.id,
|
|
262
|
-
name: app.name,
|
|
263
|
-
accessible: true,
|
|
264
|
-
enabled: findCodexAppById(installedApps, info.id)?.enabled ?? false,
|
|
265
|
-
needsAuth: false
|
|
266
|
-
}, resolveOwnedAppApprovalOverrideKeys(info));
|
|
257
|
+
return Object.assign(toCodexPluginOwnedAccountApp(info, findCodexAppById(installedApps, info.id)), { name: app.name });
|
|
267
258
|
}).toSorted((left, right) => left.id.localeCompare(right.id));
|
|
268
259
|
}
|
|
260
|
+
function toCodexPluginOwnedAccountApp(app, installedApp) {
|
|
261
|
+
return {
|
|
262
|
+
id: app.id,
|
|
263
|
+
name: app.name,
|
|
264
|
+
accessible: true,
|
|
265
|
+
enabled: installedApp?.enabled ?? false,
|
|
266
|
+
needsAuth: false,
|
|
267
|
+
...resolveOwnedAppApprovalOverrideKeys(app)
|
|
268
|
+
};
|
|
269
|
+
}
|
|
269
270
|
/** Returns current tool keys whose overrides could bypass the requested reviewer. */
|
|
270
271
|
function resolveOwnedAppApprovalOverrideKeys(app) {
|
|
271
272
|
if (!app.toolSummaries) return {};
|
|
@@ -330,9 +331,8 @@ function marketplaceRef(marketplace, name) {
|
|
|
330
331
|
function isOpenAiCuratedMarketplace(marketplace) {
|
|
331
332
|
return isOpenAiCuratedMarketplaceName(marketplace.name);
|
|
332
333
|
}
|
|
333
|
-
/** True for all Codex wire aliases of the same OpenAI-curated catalog. */
|
|
334
334
|
function isOpenAiCuratedMarketplaceName(marketplaceName) {
|
|
335
335
|
return marketplaceName === "openai-curated" || marketplaceName === CODEX_PLUGINS_REMOTE_MARKETPLACE_NAME || marketplaceName === CODEX_PLUGINS_API_MARKETPLACE_NAME;
|
|
336
336
|
}
|
|
337
337
|
//#endregion
|
|
338
|
-
export {
|
|
338
|
+
export { marketplaceRef as a, resolveRecoverableCodexPluginConfigKeys as c, CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME as d, listCodexPluginMetadata as i, toCodexPluginOwnedAccountApp as l, isOpenAiCuratedMarketplace as n, pluginReadParams as o, isOpenAiCuratedMarketplaceName as r, readCodexPluginInventory as s, findCodexMarketplacePluginSummary as t, CODEX_PLUGINS_MARKETPLACE_NAME as u };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { d as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN } from "./config-utils-D0CXecki.mjs";
|
|
1
2
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
3
|
//#region extensions/codex/src/command-authorization.ts
|
|
3
4
|
const CODEX_NATIVE_EXECUTION_AUTH_ERROR = "Only an owner or operator.admin can control Codex native execution.";
|
|
@@ -16,7 +17,6 @@ function assertCodexHostOwnerCurrent(ctx) {
|
|
|
16
17
|
//#region extensions/codex/src/plugin-marketplace-discovery.ts
|
|
17
18
|
/** Read-only discovery of Codex-owned local, curated, and remote plugin marketplaces. */
|
|
18
19
|
const PLUGIN_NAME_PATTERN = /^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/;
|
|
19
|
-
const MARKETPLACE_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
20
20
|
const MAX_PLUGIN_METADATA_LENGTH = 160;
|
|
21
21
|
const SUPPLEMENTAL_MARKETPLACE_KINDS = [
|
|
22
22
|
"workspace-directory",
|
|
@@ -34,7 +34,7 @@ function parseCodexPluginMarketplaceId(value) {
|
|
|
34
34
|
if (separator <= 0 || separator === value.length - 1) return;
|
|
35
35
|
const pluginName = value.slice(0, separator);
|
|
36
36
|
const marketplaceName = value.slice(separator + 1);
|
|
37
|
-
return PLUGIN_NAME_PATTERN.test(pluginName) &&
|
|
37
|
+
return PLUGIN_NAME_PATTERN.test(pluginName) && CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN.test(marketplaceName) ? {
|
|
38
38
|
pluginName,
|
|
39
39
|
marketplaceName
|
|
40
40
|
} : void 0;
|
|
@@ -42,26 +42,25 @@ function parseCodexPluginMarketplaceId(value) {
|
|
|
42
42
|
/** Lists local/global first and separately requests workspace, shared, and personal catalogs. */
|
|
43
43
|
async function discoverCodexMarketplacePlugins(params) {
|
|
44
44
|
const requestParams = { cwds: [params.workspaceDir] };
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const supplemental = await params.request({
|
|
45
|
+
const warnings = [];
|
|
46
|
+
const marketplaces = [];
|
|
47
|
+
const readMarketplaces = async (marketplaceKinds) => {
|
|
48
|
+
const response = await params.request({
|
|
50
49
|
...requestParams,
|
|
51
|
-
marketplaceKinds:
|
|
50
|
+
...marketplaceKinds ? { marketplaceKinds } : {}
|
|
52
51
|
});
|
|
53
|
-
marketplaces.push(...
|
|
54
|
-
warnings.push(...(
|
|
52
|
+
marketplaces.push(...response.marketplaces);
|
|
53
|
+
warnings.push(...(response.marketplaceLoadErrors ?? []).map((error) => boundedCatalogText(error.message)));
|
|
54
|
+
return response.marketplaces.length > 0;
|
|
55
|
+
};
|
|
56
|
+
await readMarketplaces();
|
|
57
|
+
try {
|
|
58
|
+
await readMarketplaces([...SUPPLEMENTAL_MARKETPLACE_KINDS]);
|
|
55
59
|
} catch (error) {
|
|
56
60
|
let recoveredSupplementalMarketplace = false;
|
|
57
61
|
for (const kind of SUPPLEMENTAL_MARKETPLACE_KINDS) try {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
marketplaceKinds: [kind]
|
|
61
|
-
});
|
|
62
|
-
marketplaces.push(...supplemental.marketplaces);
|
|
63
|
-
recoveredSupplementalMarketplace ||= supplemental.marketplaces.length > 0;
|
|
64
|
-
warnings.push(...(supplemental.marketplaceLoadErrors ?? []).map((loadError) => boundedCatalogText(loadError.message)));
|
|
62
|
+
const found = await readMarketplaces([kind]);
|
|
63
|
+
recoveredSupplementalMarketplace ||= found;
|
|
65
64
|
} catch (kindError) {
|
|
66
65
|
warnings.push(boundedCatalogText(`${kind} marketplace unavailable: ${kindError instanceof Error ? kindError.message : String(kindError)}`));
|
|
67
66
|
}
|
|
@@ -70,7 +69,7 @@ async function discoverCodexMarketplacePlugins(params) {
|
|
|
70
69
|
const discovered = /* @__PURE__ */ new Map();
|
|
71
70
|
const ambiguous = /* @__PURE__ */ new Set();
|
|
72
71
|
for (const marketplace of marketplaces) {
|
|
73
|
-
if (!
|
|
72
|
+
if (!CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN.test(marketplace.name)) continue;
|
|
74
73
|
for (const summary of marketplace.plugins) {
|
|
75
74
|
const pluginName = pluginSlug(summary, marketplace.name);
|
|
76
75
|
if (!pluginName) continue;
|
|
@@ -129,12 +128,7 @@ function pluginSlug(summary, marketplaceName) {
|
|
|
129
128
|
}
|
|
130
129
|
function boundedCatalogText(value) {
|
|
131
130
|
if (typeof value !== "string") return "";
|
|
132
|
-
|
|
133
|
-
for (const character of value) {
|
|
134
|
-
const codePoint = character.codePointAt(0);
|
|
135
|
-
sanitized += codePoint !== void 0 && (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) ? " " : character;
|
|
136
|
-
}
|
|
137
|
-
return sanitized.replace(/\s+/g, " ").trim().slice(0, MAX_PLUGIN_METADATA_LENGTH);
|
|
131
|
+
return value.replace(/\p{Cc}/gu, " ").replace(/\s+/g, " ").trim().slice(0, MAX_PLUGIN_METADATA_LENGTH);
|
|
138
132
|
}
|
|
139
133
|
//#endregion
|
|
140
134
|
export { CODEX_HOST_INSPECTION_AUTH_ERROR as a, canMutateCodexHost as c, CODEX_FULL_PERMISSIONS_AUTH_ERROR as i, hasCodexAdminScope as l, filterCodexMarketplacePlugins as n, CODEX_NATIVE_EXECUTION_AUTH_ERROR as o, parseCodexPluginMarketplaceId as r, assertCodexHostOwnerCurrent as s, discoverCodexMarketplacePlugins as t };
|