@openclaw/codex 2026.9.2 → 2026.9.4

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.
Files changed (120) hide show
  1. package/README.md +2 -0
  2. package/dist/api.js +29 -26
  3. package/dist/apply-CvT8tW5i.js +356 -0
  4. package/dist/{attempt-client-cleanup-Bp1ZOnk2.js → attempt-client-cleanup-DKHzbwt5.js} +38 -214
  5. package/dist/{attempt-context-CSazkWns.js → attempt-context-D44yeDII.js} +9 -7
  6. package/dist/{event-projector-usage-ZqEVbAEY.js → attempt-notifications-C9XufG6l.js} +3 -106
  7. package/dist/{auth-binding-Ds_QVm-X.js → auth-binding-CWlKVccJ.js} +2 -2
  8. package/dist/auth-cache-key-7orQae_j.js +498 -0
  9. package/dist/auth-profile-CwzO4_RG.js +43 -0
  10. package/dist/auth-profile-selection-DFu9e167.js +45 -0
  11. package/dist/binding-connection-D3udKbIE.js +60 -0
  12. package/dist/{bounded-turn-DxGJRYbY.js → bounded-turn-C_Hneydj.js} +28 -125
  13. package/dist/build-state-BCmg9-5p.js +19 -0
  14. package/dist/{capabilities-B1mgvpP8.js → capabilities-8vx68WLH.js} +1 -1
  15. package/dist/cli-metadata.js +1 -1
  16. package/dist/client-B57KWPQx.js +4005 -0
  17. package/dist/command-dispatch-BpduNGVf.js +21 -0
  18. package/dist/{command-formatters-DSbGMXA0.js → command-formatters-lxlkNZgU.js} +4 -3
  19. package/dist/{command-handlers-DOJvGv6-.js → command-handlers-tiL9iWj7.js} +788 -135
  20. package/dist/command-rpc-CR5EOEZX.js +233 -0
  21. package/dist/{compact-Y_xBqrHN.js → compact-B_H3AOd7.js} +19 -14
  22. package/dist/config-oIORaQ5T.js +106 -0
  23. package/dist/{config-CyapYSji.js → config-options-CXMq1T-C.js} +205 -593
  24. package/dist/config-runtime-D0zGNIHu.js +11 -0
  25. package/dist/{config-utils-C57JiJrU.js → config-utils-DujwEnhg.js} +2 -4
  26. package/dist/conversation-binding-DsB4-O7U.js +900 -0
  27. package/dist/{plugin-marketplace-discovery-B7gHXJ3d.js → conversation-control-CtUu1b3m.js} +11 -143
  28. package/dist/doctor-contract-api.js +5 -5
  29. package/dist/{dynamic-tools-BwpvTxaX.js → dynamic-tools-CmN5RAip.js} +133 -76
  30. package/dist/{effective-mcp-catalog-CY9Jn4bA.js → effective-mcp-catalog-Bd73bqA8.js} +3 -3
  31. package/dist/{elicitation-input-DMkeki8d.js → elicitation-input-DPoK8F7w.js} +8 -22
  32. package/dist/ephemeral-turn-D78_VmzO.js +101 -0
  33. package/dist/{event-projector-assistant-message-B9kp6iGC.js → event-projector-assistant-message-BmBM4qBV.js} +12 -25
  34. package/dist/event-projector-items-5VhsECCO.js +200 -0
  35. package/dist/event-projector-usage-BfXmpOec.js +102 -0
  36. package/dist/{harness-Czh2Sdoc.js → harness-C7rRa7bm.js} +48 -24
  37. package/dist/harness.js +1 -1
  38. package/dist/history-rejection-B4nOXNXF.js +13 -0
  39. package/dist/incognito-session-uhrBF6wJ.js +15 -0
  40. package/dist/index.js +406 -2915
  41. package/dist/inference-context-Dr_mzvk4.js +94 -0
  42. package/dist/inference-proxy-HGXKUIre.js +311 -0
  43. package/dist/{isolated-completion-CRh-51AK.js → isolated-completion-DWVb5U2J.js} +7 -4
  44. package/dist/launch-args-RXQwn8zV.js +90 -0
  45. package/dist/{managed-binary-DcpnJF9x.js → managed-binary-D22rNEcR.js} +13 -103
  46. package/dist/managed-thread-store-D1t5jh3G.js +66 -0
  47. package/dist/media-understanding-provider.js +4 -1
  48. package/dist/migration-provider-api.js +2 -0
  49. package/dist/{model-catalog-DT5vo6qo.js → model-catalog-Dq2n8f_p.js} +6 -5
  50. package/dist/{models-CcrgSMQR.js → models-PCKOim-h.js} +3 -3
  51. package/dist/native-execution-policy-umd0tgh4.js +128 -0
  52. package/dist/native-subagent-history-DjtPloaU.js +140 -0
  53. package/dist/native-subagent-history-owner-Pcp7JuVF.js +34 -0
  54. package/dist/{native-subagent-monitor-B3bvQGcg.js → native-subagent-monitor-fQ7eIXEf.js} +115 -460
  55. package/dist/native-subagent-task-ids-BzTdT0Uw.js +387 -0
  56. package/dist/node-cli-sessions-DKaOmVUh.js +527 -0
  57. package/dist/{node-exec-server.runtime-nfbUOtUB.js → node-exec-server.runtime-Cl2vapEi.js} +55 -24
  58. package/dist/plan-7uG-Fp36.js +947 -0
  59. package/dist/plugin-activation-BYQculil.js +138 -0
  60. package/dist/{thread-resume-BLgqkUc1.js → plugin-app-cache-key-d0eKxy7b.js} +4 -52
  61. package/dist/{plugin-approval-roundtrip-aQVdyL5g.js → plugin-approval-roundtrip-Bz3FT8W5.js} +1 -1
  62. package/dist/plugin-inventory-oL4Na1ZG.js +328 -0
  63. package/dist/plugin-marketplace-discovery-P-Vndfqq.js +137 -0
  64. package/dist/{plugin-metadata-cache-BwCLTY_U.js → plugin-metadata-cache-ClPJpRio.js} +17 -9
  65. package/dist/protocol-5bh1G-H7.js +275 -0
  66. package/dist/provider-MQ8PVkuE.js +50 -0
  67. package/dist/{provider-capabilities-BpG9Ltc5.js → provider-capabilities-BvCUL69A.js} +2 -2
  68. package/dist/{rate-limits-Fx_l4eNa.js → rate-limits-CBMmWBr9.js} +1 -1
  69. package/dist/request-B7hEkBGq.js +212 -0
  70. package/dist/rpc-error-ttN_QjEm.js +30 -0
  71. package/dist/{run-attempt-BzthFQSM.js → run-attempt-CvsAAGa0.js} +664 -377
  72. package/dist/{runtime-artifact-Bh_gf6-t.js → runtime-artifact-BJ0rXBZ_.js} +27 -27
  73. package/dist/sandbox-guard-BxgyoM8M.js +166 -0
  74. package/dist/{session-binding-4Ki04sW-.js → session-binding-CI8UuilT.js} +30 -48
  75. package/dist/{session-binding-record-CyaXZvTe.js → session-binding-record-Bcvslnhf.js} +12 -26
  76. package/dist/session-catalog-adoption-tcZi1IfX.js +251 -0
  77. package/dist/session-catalog-archive-CwKg8Xz2.js +56 -0
  78. package/dist/session-catalog-ct-AH01I.js +1477 -0
  79. package/dist/session-catalog-home-id-CwhLdC03.js +18 -0
  80. package/dist/session-catalog-node-adoption-B1tgDW-m.js +182 -0
  81. package/dist/session-catalog-node-continue-Ci-DXyJP.js +238 -0
  82. package/dist/session-catalog-provenance-D-dIfRAH.js +96 -0
  83. package/dist/{session-cli-BjLhpmS1.js → session-cli-DNN_jhGc.js} +3 -2
  84. package/dist/{session-history-DWmMqiqW.js → session-history-Cz-tOOYj.js} +6 -3
  85. package/dist/{session-upstream-marker-DReTpGz6.js → session-history-import-DwyijFI6.js} +5 -50
  86. package/dist/{session-history-read-LHldwvyh.js → session-history-read-cxPUxyVV.js} +21 -7
  87. package/dist/session-history-worker-runtime.js +18 -6
  88. package/dist/session-history.worker-BeK1YOyT.js +378 -0
  89. package/dist/session-history.worker.js +1 -1
  90. package/dist/{session-initialization-BCFVnLL4.js → session-initialization-Ct0_Hzmg.js} +2 -2
  91. package/dist/{session-permission-policy-BaueHmSj.js → session-permission-policy-BBmXA8Eg.js} +4 -7
  92. package/dist/{session-retirement-DNdmYdFc.js → session-retirement-B2YfbAAT.js} +6 -5
  93. package/dist/session-upstream-marker-D15C9NHp.js +46 -0
  94. package/dist/{settled-turn-context-BOM3Y1pl.js → settled-turn-context-Du6gdUDd.js} +9 -9
  95. package/dist/{settled-turn-finalizer-BI-b1sry.js → settled-turn-finalizer-Dn91stmc.js} +8 -7
  96. package/dist/shared-client-CscigXXL.js +3109 -0
  97. package/dist/{side-question-B6DWAw1A.js → side-question-BGMJQf4U.js} +65 -170
  98. package/dist/source-CElXU0Oy.js +518 -0
  99. package/dist/thread-archive-guard-DfpBr-Sz.js +53 -0
  100. package/dist/thread-history-page-D0JIp48V.js +361 -0
  101. package/dist/{thread-lifecycle-DPK30jad.js → thread-lifecycle-DXl1-I6b.js} +187 -639
  102. package/dist/{thread-ownership-CbucAmmp.js → thread-ownership-BsDRTsyp.js} +13 -15
  103. package/dist/thread-policy-BuEQfE0g.js +54 -0
  104. package/dist/thread-resume-DsDOZpFg.js +52 -0
  105. package/dist/timeout-BVw8aaM1.js +33 -0
  106. package/dist/transcript-history-projection-v17wXgdK.js +238 -0
  107. package/dist/{transcript-mirror-_njEB84z.js → transcript-mirror-C5CKgNy6.js} +50 -260
  108. package/dist/{transcript-mirror-attestation-Byl34PC-.js → transcript-mirror-attestation-DibE0krH.js} +17 -4
  109. package/dist/{transport-stdio-CzTngV0j.js → transport-stdio-BGjHoYLr.js} +73 -43
  110. package/dist/{upstream-session-fork-1fwbNKzQ.js → upstream-session-fork-BZerMte_.js} +27 -19
  111. package/dist/{usage-i9fv5-4m.js → usage-tCk-mg_x.js} +4 -3
  112. package/dist/version-omm6IPI3.js +12 -0
  113. package/dist/{web-search-provider.runtime-DKQn67A7.js → web-search-provider.runtime-B7bGbGWq.js} +3 -3
  114. package/openclaw.plugin.json +23 -1
  115. package/package.json +4 -4
  116. package/dist/request-C8H22rPi.js +0 -475
  117. package/dist/session-catalog-B47uwekb.js +0 -3272
  118. package/dist/session-history.worker-zZVcx0ME.js +0 -267
  119. package/dist/shared-client-CKhX2kFt.js +0 -7505
  120. package/dist/thread-policy-CTalhWFy.js +0 -105
@@ -0,0 +1,138 @@
1
+ import { c as CODEX_PLUGINS_MARKETPLACE_NAME, i as pluginReadParams, n as isOpenAiCuratedMarketplace, r as isOpenAiCuratedMarketplaceName, t as findCodexMarketplacePluginSummary } from "./plugin-inventory-oL4Na1ZG.js";
2
+ import { t as CodexAppServerRpcError } from "./rpc-error-ttN_QjEm.js";
3
+ import "./config-oIORaQ5T.js";
4
+ import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
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
+ /** Activates legacy curated plugins without granting install authority to other marketplaces. */
11
+ async function ensureCodexPluginActivation(params) {
12
+ if (params.identity.marketplaceName === "workspace-directory") return activationFailure(params.identity, "disabled", { message: "workspace-directory plugins must be installed and enabled outside OpenClaw before use." });
13
+ if (!isOpenAiCuratedMarketplaceName(params.identity.marketplaceName)) {
14
+ const target = params.identity.pluginName.endsWith(`@${params.identity.marketplaceName}`) ? params.identity.pluginName : `${params.identity.pluginName}@${params.identity.marketplaceName}`;
15
+ 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
+ }
17
+ const listed = await listCuratedCodexPluginMetadata(params);
18
+ const resolved = findCodexMarketplacePluginSummary(listed, params.identity.marketplaceName, params.identity.pluginName);
19
+ if (!resolved) {
20
+ if (!listed.marketplaces.some((marketplace) => isOpenAiCuratedMarketplace(marketplace))) return activationFailure(params.identity, "marketplace_missing", { message: `Codex marketplace ${CODEX_PLUGINS_MARKETPLACE_NAME} was not found.` });
21
+ return activationFailure(params.identity, "plugin_missing", { message: `${params.identity.pluginName} was not found in ${CODEX_PLUGINS_MARKETPLACE_NAME}.` });
22
+ }
23
+ if (resolved.marketplace.remoteMarketplaceName && !resolved.summary.remotePluginId) return activationFailure(params.identity, "plugin_missing", { message: `${params.identity.pluginName} detail unavailable: Codex did not return a remote plugin id.` });
24
+ if (resolved.summary.availability === "DISABLED_BY_ADMIN" || resolved.summary.installPolicy === "NOT_AVAILABLE") return activationFailure(params.identity, "disabled", { message: `${params.identity.pluginName} was disabled or made unavailable by its marketplace administrator.` });
25
+ if (resolved.summary.installed && resolved.summary.enabled && !params.installEvenIfActive) return {
26
+ identity: params.identity,
27
+ ok: true,
28
+ reason: "already_active",
29
+ installAttempted: false,
30
+ marketplace: resolved.marketplace,
31
+ diagnostics: []
32
+ };
33
+ const remotePluginId = resolved.marketplace.remoteMarketplaceName ? resolved.summary.remotePluginId : void 0;
34
+ let installResponse;
35
+ try {
36
+ installResponse = await params.request("plugin/install", pluginReadParams(resolved.marketplace, remotePluginId ?? params.identity.pluginName));
37
+ } catch (error) {
38
+ if (!(error instanceof CodexAppServerRpcError) || error.code !== -32600 || !remotePluginId || error.message !== `remote plugin ${remotePluginId} is disabled by admin` && error.message !== `remote plugin ${remotePluginId} is not available for install`) throw error;
39
+ return {
40
+ identity: params.identity,
41
+ ok: false,
42
+ reason: "install_failed",
43
+ installAttempted: true,
44
+ marketplace: resolved.marketplace,
45
+ diagnostics: [{ message: `Codex plugin install failed: ${coerceErrorMessage(error)}` }]
46
+ };
47
+ }
48
+ if (params.metadataCache && params.appCacheKey) params.metadataCache.invalidate(params.appCacheKey);
49
+ const refreshDiagnostics = [];
50
+ let refreshFailed = false;
51
+ try {
52
+ const refreshResult = await refreshCodexPluginRuntimeState({
53
+ request: params.request,
54
+ appCache: params.appCache,
55
+ appCacheKey: params.appCacheKey,
56
+ configCwd: params.configCwd,
57
+ metadataCache: params.metadataCache,
58
+ deferAppInventoryRefresh: params.deferAppInventoryRefresh,
59
+ targetAppIds: params.targetAppIds
60
+ });
61
+ refreshDiagnostics.push(...refreshResult.diagnostics);
62
+ } catch (error) {
63
+ refreshFailed = true;
64
+ refreshDiagnostics.push({ message: `Codex plugin runtime refresh failed after install: ${coerceErrorMessage(error)}` });
65
+ }
66
+ const authRequired = installResponse.appsNeedingAuth.length > 0;
67
+ return {
68
+ identity: params.identity,
69
+ ok: !authRequired && !refreshFailed,
70
+ reason: refreshFailed ? "refresh_failed" : authRequired ? "auth_required" : resolved.summary.installed && resolved.summary.enabled ? "already_active" : "installed",
71
+ installAttempted: true,
72
+ marketplace: resolved.marketplace,
73
+ installResponse,
74
+ diagnostics: [...refreshDiagnostics, ...installResponse.appsNeedingAuth.map((app) => ({ message: `${app.name} requires app authentication before plugin tools are exposed.` }))]
75
+ };
76
+ }
77
+ /** Forces Codex plugin, skill, hook, MCP, and app inventory refreshes after activation. */
78
+ async function refreshCodexPluginRuntimeState(params) {
79
+ const diagnostics = [];
80
+ 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
+ if (params.appCache && params.appCacheKey) try {
92
+ await refreshCodexAppRuntimeState({
93
+ ...params,
94
+ appCache: params.appCache,
95
+ appCacheKey: params.appCacheKey
96
+ });
97
+ } catch (error) {
98
+ diagnostics.push({ message: `Codex app inventory refresh skipped: ${coerceErrorMessage(error)}` });
99
+ }
100
+ return { diagnostics };
101
+ }
102
+ /** Refreshes hosted app tools without reloading unrelated active threads. */
103
+ async function refreshCodexAppRuntimeState(params) {
104
+ params.appCache.invalidate(params.appCacheKey, "Codex plugin app inventory refresh requested", void 0, params.targetAppIds);
105
+ if (params.deferAppInventoryRefresh) return;
106
+ const request = async (method, requestParams) => await params.request(method, requestParams);
107
+ await params.appCache.refreshNow({
108
+ key: params.appCacheKey,
109
+ request,
110
+ forceRefetch: true,
111
+ targetAppIds: params.targetAppIds
112
+ });
113
+ }
114
+ async function listCuratedCodexPluginMetadata(params, options = {}) {
115
+ const requestParams = {
116
+ ...params.configCwd ? { cwds: [params.configCwd] } : {},
117
+ ...options.forceRefetch ? { forceRefetch: true } : {}
118
+ };
119
+ if (!params.metadataCache || !params.appCacheKey) return await params.request("plugin/list", requestParams);
120
+ return (await params.metadataCache.load({
121
+ appCacheKey: params.appCacheKey,
122
+ queryKind: "curated-global",
123
+ requestParams,
124
+ request: async (method, listedParams) => await params.request(method, listedParams),
125
+ cacheable: (response) => response.marketplaces.some((marketplace) => isOpenAiCuratedMarketplace(marketplace))
126
+ })).response;
127
+ }
128
+ function activationFailure(identity, reason, diagnostic, extraDiagnostics = []) {
129
+ return {
130
+ identity,
131
+ ok: false,
132
+ reason,
133
+ installAttempted: false,
134
+ diagnostics: [diagnostic, ...extraDiagnostics]
135
+ };
136
+ }
137
+ //#endregion
138
+ export { refreshCodexAppRuntimeState as n, refreshCodexPluginRuntimeState as r, ensureCodexPluginActivation as t };
@@ -1,14 +1,11 @@
1
- import { M as resolveCodexAppServerHomeDir, N as resolveCodexAppServerLocalHomeDir, P as resolveCodexAppServerUserHomeDir } from "./config-CyapYSji.js";
2
- import { H as isCodexAppServerOverloadError, M as isCodexAppServerStartupError, U as isCodexAppServerPrewriteRequestCancellationError, q as CodexAppServerRpcError, tt as assertCodexThreadResumeResponse, u as isCodexAppServerStartSelectionChangedError } from "./shared-client-CKhX2kFt.js";
3
- import { d as unsubscribeCodexThreadBestEffort, i as assertCodexThreadResumeSubscription, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-Bp1ZOnk2.js";
4
- import { t as CodexAppServerScopedRequestRejectedError } from "./request-C8H22rPi.js";
1
+ import { c as resolveCodexAppServerLocalHomeDir, l as resolveCodexAppServerUserHomeDir, s as resolveCodexAppServerHomeDir } from "./protocol-5bh1G-H7.js";
5
2
  import { createRequire } from "node:module";
6
3
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
7
4
  import { createHash } from "node:crypto";
5
+ import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
8
6
  import { isFutureDateTimestampMs, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
9
- import { readPluginPackageVersion } from "openclaw/plugin-sdk/extension-shared";
10
- import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
11
7
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
8
+ import { readPluginPackageVersion } from "openclaw/plugin-sdk/extension-shared";
12
9
  //#region extensions/codex/src/app-server/app-inventory-cache.ts
13
10
  /**
14
11
  * Process-local cache for Codex app-server app inventories, keyed by runtime
@@ -427,49 +424,4 @@ function fingerprintCodexPluginAppCacheCredentials(startOptions) {
427
424
  return `sha256:${hash.digest("hex")}`;
428
425
  }
429
426
  //#endregion
430
- //#region extensions/codex/src/app-server/thread-resume.ts
431
- /** Owns Codex thread/resume subscription safety. */
432
- /** Resumes one thread, releasing or isolating every possible native subscription. */
433
- async function resumeCodexAppServerThread(params) {
434
- const threadId = params.request.threadId;
435
- let response;
436
- let ownershipRejected = false;
437
- const assertCurrent = params.assertCurrent && (() => {
438
- try {
439
- params.assertCurrent?.();
440
- } catch (error) {
441
- ownershipRejected = true;
442
- throw error;
443
- }
444
- });
445
- try {
446
- response = assertCodexThreadResumeResponse(await (params.requestResume ? params.requestResume(params.request) : params.client.request("thread/resume", params.request, {
447
- ...params.timeoutMs !== void 0 ? { timeoutMs: params.timeoutMs } : {},
448
- ...params.signal ? { signal: params.signal } : {},
449
- assertCurrent
450
- })));
451
- assertCodexThreadResumeSubscription(threadId, response.thread.id);
452
- } catch (error) {
453
- if (ownershipRejected || isCodexAppServerStartSelectionChangedError(error) || isCodexAppServerStartupError(error) || error instanceof CodexAppServerScopedRequestRejectedError || isCodexAppServerPrewriteRequestCancellationError(error) || isCodexAppServerOverloadError(error)) throw error;
454
- if (error instanceof CodexAppServerRpcError) {
455
- if (await unsubscribeCodexThreadBestEffort(params.client, {
456
- threadId,
457
- timeoutMs: 5e3,
458
- assertCurrent: params.assertCurrent
459
- }).catch(() => false)) {
460
- params.onSubscriptionReleased?.();
461
- throw error;
462
- }
463
- }
464
- try {
465
- await params.abandonClient();
466
- } catch (abandonError) {
467
- throw new CodexAppServerUnsafeSubscriptionError(`Codex thread/resume client could not be retired for ${threadId}`, { cause: abandonError });
468
- }
469
- if (error instanceof CodexAppServerUnsafeSubscriptionError) throw error;
470
- throw new CodexAppServerUnsafeSubscriptionError(error instanceof Error ? error.message : `Codex thread/resume outcome is indeterminate for ${threadId}`, { cause: error });
471
- }
472
- return response;
473
- }
474
- //#endregion
475
- export { replaceCodexCatalogConnectionHomes as a, defaultCodexAppInventoryCache as c, buildCodexPluginAppCacheKey as i, serializeCodexAppInventoryError as l, buildCodexAppServerConnectionFingerprint as n, resolveCodexCatalogConnectionHome as o, buildCodexAppServerRuntimeFingerprint as r, CodexAppInventoryCache as s, resumeCodexAppServerThread as t };
427
+ export { resolveCodexCatalogConnectionHome as a, serializeCodexAppInventoryError as c, replaceCodexCatalogConnectionHomes as i, buildCodexAppServerRuntimeFingerprint as n, CodexAppInventoryCache as o, buildCodexPluginAppCacheKey as r, defaultCodexAppInventoryCache as s, buildCodexAppServerConnectionFingerprint as t };
@@ -1,4 +1,4 @@
1
- import { N as resolveCodexGatewayTimeoutWithGraceMs } from "./shared-client-CKhX2kFt.js";
1
+ import { P as resolveCodexGatewayTimeoutWithGraceMs } from "./shared-client-CscigXXL.js";
2
2
  import { isApprovalNotFoundError, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
3
3
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
4
4
  //#region extensions/codex/src/app-server/plugin-approval-roundtrip.ts
@@ -0,0 +1,328 @@
1
+ import { S as resolveCodexPluginsPolicy } from "./protocol-5bh1G-H7.js";
2
+ import "./config-oIORaQ5T.js";
3
+ import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
4
+ //#region extensions/codex/src/app-server/config-contracts.ts
5
+ const CODEX_PLUGINS_MARKETPLACE_NAME = "openai-curated";
6
+ const CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME = "workspace-directory";
7
+ //#endregion
8
+ //#region extensions/codex/src/app-server/plugin-inventory.ts
9
+ /**
10
+ * Reads Codex plugin marketplace state and app inventory to decide which
11
+ * plugin-owned apps can be exposed to a native Codex thread.
12
+ */
13
+ const CODEX_PLUGINS_REMOTE_MARKETPLACE_NAME = `${CODEX_PLUGINS_MARKETPLACE_NAME}-remote`;
14
+ const CODEX_PLUGINS_API_MARKETPLACE_NAME = "openai-api-curated";
15
+ /** Reads configured Codex plugin state and maps owned apps to readiness diagnostics. */
16
+ async function readCodexPluginInventory(params) {
17
+ const policy = params.policy ?? resolveCodexPluginsPolicy(params.pluginConfig);
18
+ if (!policy.enabled) return {
19
+ policy,
20
+ records: [],
21
+ diagnostics: [{
22
+ code: "disabled",
23
+ message: "Native Codex plugin support is disabled."
24
+ }]
25
+ };
26
+ const appInventory = readCachedAppInventory(params);
27
+ const installedPlugins = await readInstalledCodexPluginMetadata({
28
+ ...params,
29
+ policy
30
+ });
31
+ const pluginCatalogs = /* @__PURE__ */ new Map();
32
+ const diagnostics = [];
33
+ const records = [];
34
+ if (appInventory?.state === "missing") diagnostics.push({
35
+ code: "app_inventory_missing",
36
+ message: "Cached Codex app inventory is missing; plugin apps are excluded for this setup."
37
+ });
38
+ else if (appInventory?.state === "stale") diagnostics.push({
39
+ code: "app_inventory_stale",
40
+ message: "Cached Codex app inventory is stale; using stale app readiness and refreshing."
41
+ });
42
+ for (const pluginPolicy of policy.pluginPolicies) {
43
+ if (!pluginPolicy.enabled && !policy.allowAllPlugins) continue;
44
+ let listed = installedPlugins;
45
+ let resolvedPlugin = findConfiguredMarketplacePlugin(listed, pluginPolicy);
46
+ if (!resolvedPlugin && pluginPolicy.enabled && pluginPolicy.marketplaceName !== "workspace-directory") {
47
+ const requestParams = buildPluginCatalogRequestParams(params, pluginPolicy.marketplaceName);
48
+ const catalogKey = JSON.stringify([requestParams, pluginMetadataCatalogScope(pluginPolicy.marketplaceName)]);
49
+ let catalog = pluginCatalogs.get(catalogKey);
50
+ if (!catalog) {
51
+ catalog = listCodexPluginMetadata(params, pluginPolicy.marketplaceName);
52
+ pluginCatalogs.set(catalogKey, catalog);
53
+ }
54
+ listed = await catalog;
55
+ resolvedPlugin = findConfiguredMarketplacePlugin(listed, pluginPolicy);
56
+ }
57
+ if (!listed.marketplaces.some((marketplace) => marketplaceMatchesConfiguredName(marketplace, pluginPolicy.marketplaceName))) {
58
+ diagnostics.push({
59
+ code: "marketplace_missing",
60
+ plugin: pluginPolicy,
61
+ message: `Codex marketplace ${pluginPolicy.marketplaceName} was not found.`
62
+ });
63
+ continue;
64
+ }
65
+ if (!resolvedPlugin) {
66
+ diagnostics.push({
67
+ code: "plugin_missing",
68
+ plugin: pluginPolicy,
69
+ message: `${pluginPolicy.pluginName} was not found in ${pluginPolicy.marketplaceName}.`
70
+ });
71
+ continue;
72
+ }
73
+ const { summary } = resolvedPlugin;
74
+ const unavailableByMarketplacePolicy = summary.availability === "DISABLED_BY_ADMIN" || summary.installPolicy === "NOT_AVAILABLE";
75
+ if (unavailableByMarketplacePolicy) {
76
+ diagnostics.push({
77
+ code: "plugin_disabled",
78
+ plugin: pluginPolicy,
79
+ message: `${pluginPolicy.pluginName} is unavailable in ${pluginPolicy.marketplaceName}.`
80
+ });
81
+ if (!summary.installed) continue;
82
+ }
83
+ const detail = await readPluginDetail(params, marketplaceRef(resolvedPlugin.marketplace, pluginPolicy.marketplaceName), pluginPolicy, summary, diagnostics);
84
+ const ownedAppIds = detail?.apps.map((app) => app.id).filter(Boolean).toSorted() ?? [];
85
+ const appOwnership = resolveAppOwnership({
86
+ detail,
87
+ appInventory,
88
+ summary
89
+ });
90
+ if (appOwnership === "ambiguous") diagnostics.push({
91
+ code: "app_ownership_ambiguous",
92
+ plugin: pluginPolicy,
93
+ message: `${pluginPolicy.pluginName} has only display-name app matches; apps are not exposed until ownership is stable.`
94
+ });
95
+ if (summary.installed && !summary.enabled) diagnostics.push({
96
+ code: "plugin_disabled",
97
+ plugin: pluginPolicy,
98
+ message: `${pluginPolicy.pluginName} is installed in Codex but disabled.`
99
+ });
100
+ const apps = resolveOwnedApps({
101
+ pluginPolicy,
102
+ detail,
103
+ appInventory
104
+ });
105
+ records.push({
106
+ policy: pluginPolicy,
107
+ summary,
108
+ ...detail ? { detail } : {},
109
+ activationRequired: pluginPolicy.enabled && (unavailableByMarketplacePolicy || !summary.installed || !summary.enabled),
110
+ authRequired: apps.some((app) => app.needsAuth || !app.accessible),
111
+ appOwnership,
112
+ ownedAppIds,
113
+ apps
114
+ });
115
+ }
116
+ return {
117
+ policy,
118
+ records,
119
+ diagnostics,
120
+ ...appInventory ? { appInventory } : {}
121
+ };
122
+ }
123
+ /** Finds a configured plugin only in its authorized marketplace identity. */
124
+ function findCodexMarketplacePluginSummary(listed, marketplaceName, pluginName) {
125
+ const resolved = findConfiguredMarketplacePlugin(listed, {
126
+ marketplaceName,
127
+ pluginName
128
+ });
129
+ return resolved ? {
130
+ marketplace: marketplaceRef(resolved.marketplace, marketplaceName),
131
+ summary: resolved.summary
132
+ } : void 0;
133
+ }
134
+ /** Builds plugin/read or plugin/install params from a marketplace reference. */
135
+ function pluginReadParams(marketplace, pluginName) {
136
+ return {
137
+ ...marketplace.path ? { marketplacePath: marketplace.path } : {},
138
+ ...marketplace.remoteMarketplaceName ? { remoteMarketplaceName: marketplace.remoteMarketplaceName } : {},
139
+ pluginName
140
+ };
141
+ }
142
+ /** Returns configured plugin keys whose current metadata may still recover. */
143
+ function resolveRecoverableCodexPluginConfigKeys(params) {
144
+ return params.policy.pluginPolicies.filter((pluginPolicy) => pluginPolicy.enabled && !isSettledMissingPluginPolicy({
145
+ pluginPolicy,
146
+ metadataCache: params.metadataCache,
147
+ appCacheKey: params.appCacheKey,
148
+ configCwd: params.configCwd
149
+ })).map((pluginPolicy) => pluginPolicy.configKey).toSorted();
150
+ }
151
+ async function listCodexPluginMetadata(params, marketplaceName) {
152
+ const requestParams = buildPluginCatalogRequestParams(params, marketplaceName);
153
+ if (!params.metadataCache || !params.appCacheKey) return await params.request("plugin/list", requestParams);
154
+ return (await params.metadataCache.load({
155
+ appCacheKey: params.appCacheKey,
156
+ queryKind: "curated-global",
157
+ requestParams,
158
+ catalogScope: pluginMetadataCatalogScope(marketplaceName),
159
+ request: async (method, listedParams) => await params.request(method, listedParams),
160
+ cacheable: (response) => response.marketplaces.some((marketplace) => marketplaceMatchesConfiguredName(marketplace, marketplaceName))
161
+ })).response;
162
+ }
163
+ async function readInstalledCodexPluginMetadata(params) {
164
+ const requestParams = params.configCwd ? { cwds: [params.configCwd] } : {};
165
+ if (!params.metadataCache || !params.appCacheKey) return await params.request("plugin/installed", requestParams);
166
+ return (await params.metadataCache.load({
167
+ appCacheKey: params.appCacheKey,
168
+ queryKind: "installed",
169
+ requestParams,
170
+ request: async (method, installedParams) => await params.request(method, installedParams),
171
+ cacheable: (response) => params.policy.pluginPolicies.every((pluginPolicy) => {
172
+ if (!pluginPolicy.enabled && !params.policy.allowAllPlugins) return true;
173
+ return Boolean(findConfiguredMarketplacePlugin(response, pluginPolicy));
174
+ })
175
+ })).response;
176
+ }
177
+ function isSettledMissingPluginPolicy(params) {
178
+ const queryKind = params.pluginPolicy.marketplaceName === "workspace-directory" ? "installed" : "curated-global";
179
+ const requestParams = queryKind === "installed" ? params.configCwd ? { cwds: [params.configCwd] } : {} : buildPluginCatalogRequestParams(params, params.pluginPolicy.marketplaceName);
180
+ const listed = params.metadataCache.read(params.appCacheKey, queryKind, requestParams, queryKind === "curated-global" ? pluginMetadataCatalogScope(params.pluginPolicy.marketplaceName) : void 0)?.response;
181
+ if (!listed) return false;
182
+ return !findConfiguredMarketplacePlugin(listed, params.pluginPolicy);
183
+ }
184
+ function pluginMetadataCatalogScope(marketplaceName) {
185
+ return isOpenAiCuratedMarketplaceName(marketplaceName) ? void 0 : marketplaceName;
186
+ }
187
+ function buildPluginCatalogRequestParams(params, marketplaceName) {
188
+ const marketplaceKinds = marketplaceName === "created-by-me-remote" ? ["created-by-me-remote"] : marketplaceName.startsWith("workspace-shared-with-me") ? ["shared-with-me"] : void 0;
189
+ return {
190
+ ...params.configCwd ? { cwds: [params.configCwd] } : {},
191
+ ...marketplaceKinds ? { marketplaceKinds: [...marketplaceKinds] } : {}
192
+ };
193
+ }
194
+ function readCachedAppInventory(params) {
195
+ if (!params.appCache || !params.appCacheKey) return;
196
+ const request = async (method, requestParams) => await params.request(method, requestParams);
197
+ return params.appCache.read({
198
+ key: params.appCacheKey,
199
+ request,
200
+ nowMs: params.nowMs,
201
+ suppressRefresh: params.suppressAppInventoryRefresh
202
+ });
203
+ }
204
+ async function readPluginDetail(params, marketplace, pluginPolicy, summary, diagnostics) {
205
+ if (params.readPluginDetails === false) return;
206
+ if (marketplace.remoteMarketplaceName && !summary.remotePluginId) {
207
+ diagnostics.push({
208
+ code: "plugin_detail_unavailable",
209
+ plugin: pluginPolicy,
210
+ message: `${pluginPolicy.pluginName} detail unavailable: Codex did not return a remote plugin id.`
211
+ });
212
+ return;
213
+ }
214
+ try {
215
+ return (await params.request("plugin/read", pluginReadParams(marketplace, marketplace.remoteMarketplaceName && summary.remotePluginId ? summary.remotePluginId : pluginPolicy.pluginName))).plugin;
216
+ } catch (error) {
217
+ diagnostics.push({
218
+ code: "plugin_detail_unavailable",
219
+ plugin: pluginPolicy,
220
+ message: `${pluginPolicy.pluginName} detail unavailable: ${error instanceof Error ? error.message : String(error)}`
221
+ });
222
+ return;
223
+ }
224
+ }
225
+ function resolveAppOwnership(params) {
226
+ if (params.detail && params.detail.apps.length > 0) return "proven";
227
+ return (params.appInventory?.snapshot?.apps ?? []).filter((app) => app.pluginDisplayNames.some((displayName) => displayName === params.summary.name)).length > 0 ? "ambiguous" : "none";
228
+ }
229
+ function resolveOwnedApps(params) {
230
+ const detailApps = params.detail?.apps ?? [];
231
+ if (detailApps.length === 0) return [];
232
+ if (params.appInventory?.state === "missing") {
233
+ embeddedAgentLog.warn("codex plugin inventory missing app inventory for detail apps", {
234
+ configKey: params.pluginPolicy.configKey,
235
+ pluginName: params.pluginPolicy.pluginName,
236
+ appIds: detailApps.map((app) => app.id).toSorted()
237
+ });
238
+ return [];
239
+ }
240
+ const appInfoById = new Map((params.appInventory?.snapshot?.apps ?? []).map((app) => [app.id, app]));
241
+ return detailApps.map((app) => {
242
+ const info = appInfoById.get(app.id);
243
+ if (!info) return {
244
+ id: app.id,
245
+ name: app.name,
246
+ accessible: false,
247
+ enabled: false,
248
+ needsAuth: true
249
+ };
250
+ return Object.assign({
251
+ id: app.id,
252
+ name: app.name,
253
+ accessible: info.isAccessible,
254
+ enabled: info.isEnabled,
255
+ needsAuth: !info.isAccessible
256
+ }, resolveOwnedAppApprovalOverrideKeys(info));
257
+ }).toSorted((left, right) => left.id.localeCompare(right.id));
258
+ }
259
+ /** Returns current tool keys whose overrides could bypass the requested reviewer. */
260
+ function resolveOwnedAppApprovalOverrideKeys(app) {
261
+ if (!app.toolSummaries) return {};
262
+ const appName = app.name.trim();
263
+ const appNameLower = appName.toLowerCase();
264
+ const keys = app.toolSummaries.filter((tool) => !tool.isReadOnly).flatMap((tool) => resolveAppToolConfigKeys({
265
+ appName,
266
+ appNameLower,
267
+ tool
268
+ }));
269
+ return { approvalOverrideToolConfigKeys: Array.from(new Set(keys)).toSorted() };
270
+ }
271
+ function resolveAppToolConfigKeys(params) {
272
+ const keys = [params.tool.name];
273
+ if (params.tool.title) keys.push(params.tool.title);
274
+ if (params.appName) keys.push(`${params.appName}_${params.tool.name}`);
275
+ if (params.appNameLower && params.appNameLower !== params.appName) keys.push(`${params.appNameLower}_${params.tool.name}`);
276
+ return keys;
277
+ }
278
+ function findPluginSummary(marketplace, pluginName) {
279
+ const exact = marketplace.plugins.find((plugin) => plugin.id === pluginName || plugin.id === `${pluginName}@${marketplace.name}`);
280
+ if (exact) return exact;
281
+ const matches = marketplace.plugins.filter((plugin) => plugin.name === pluginName || pluginNameFromPluginId(plugin.id, marketplace.name) === pluginName);
282
+ return matches.length === 1 ? matches[0] : void 0;
283
+ }
284
+ function findConfiguredMarketplacePlugin(listed, plugin) {
285
+ if (plugin.marketplaceName === "workspace-directory") return findWorkspaceMarketplacePlugin(listed, plugin.pluginName);
286
+ for (const marketplace of listed.marketplaces) {
287
+ if (!marketplaceMatchesConfiguredName(marketplace, plugin.marketplaceName)) continue;
288
+ const summary = findPluginSummary(marketplace, plugin.pluginName);
289
+ if (summary) return {
290
+ marketplace,
291
+ summary
292
+ };
293
+ }
294
+ }
295
+ function marketplaceMatchesConfiguredName(marketplace, configuredMarketplaceName) {
296
+ return isOpenAiCuratedMarketplaceName(configuredMarketplaceName) ? isOpenAiCuratedMarketplace(marketplace) : marketplace.name === configuredMarketplaceName;
297
+ }
298
+ function findWorkspaceMarketplacePlugin(listed, pluginName) {
299
+ const marketplace = listed.marketplaces.find((entry) => entry.name === CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME);
300
+ const summary = marketplace?.plugins.find((plugin) => plugin.id === pluginName);
301
+ return marketplace && summary ? {
302
+ marketplace,
303
+ summary
304
+ } : void 0;
305
+ }
306
+ function pluginNameFromPluginId(pluginId, marketplaceName) {
307
+ const trimmed = pluginId.trim();
308
+ if (!trimmed) return;
309
+ const marketplaceSuffix = `@${marketplaceName}`;
310
+ return (trimmed.endsWith(marketplaceSuffix) ? trimmed.slice(0, -marketplaceSuffix.length) : trimmed).split("/").at(-1)?.trim() || void 0;
311
+ }
312
+ function marketplaceRef(marketplace, name) {
313
+ return {
314
+ name,
315
+ ...marketplace.path ? { path: marketplace.path } : {},
316
+ ...!marketplace.path ? { remoteMarketplaceName: marketplace.name } : {}
317
+ };
318
+ }
319
+ /** True for any supported OpenAI curated marketplace wire name, matching Codex's own curated predicate. */
320
+ function isOpenAiCuratedMarketplace(marketplace) {
321
+ return isOpenAiCuratedMarketplaceName(marketplace.name);
322
+ }
323
+ /** True for all Codex wire aliases of the same OpenAI-curated catalog. */
324
+ function isOpenAiCuratedMarketplaceName(marketplaceName) {
325
+ return marketplaceName === "openai-curated" || marketplaceName === CODEX_PLUGINS_REMOTE_MARKETPLACE_NAME || marketplaceName === CODEX_PLUGINS_API_MARKETPLACE_NAME;
326
+ }
327
+ //#endregion
328
+ export { readCodexPluginInventory as a, CODEX_PLUGINS_MARKETPLACE_NAME as c, pluginReadParams as i, CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME as l, isOpenAiCuratedMarketplace as n, resolveOwnedAppApprovalOverrideKeys as o, isOpenAiCuratedMarketplaceName as r, resolveRecoverableCodexPluginConfigKeys as s, findCodexMarketplacePluginSummary as t };