@openclaw/codex 2026.7.2-beta.5 → 2026.7.33
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 +3 -27
- package/dist/{command-formatters-ico4ZFnk.js → .setup/app-server-policy-C_qTMEMy.mjs} +51 -9
- package/dist/{attempt-notifications-CMR2_fmR.js → .setup/attempt-notifications-F8krwWL4.mjs} +6 -3
- package/dist/{command-handlers-CRmnwI2N.js → .setup/command-handlers-DSRFfor4.mjs} +1156 -1319
- package/dist/.setup/command-rpc-BvYsfQ7G.mjs +786 -0
- package/dist/{compact-dEN49UH6.js → .setup/compact-BNgh7I4t.mjs} +10 -40
- package/dist/.setup/computer-use-C3QkmSO3.mjs +377 -0
- package/dist/.setup/config-CYEDnLJ2.mjs +1138 -0
- package/dist/{conversation-binding-data-BHRpYbX3.js → .setup/conversation-binding-data-CrRxtDBu.mjs} +1 -1
- package/dist/{bounded-turn-FEbUXoYT.js → .setup/media-understanding-provider-EbJCyDqe.mjs} +193 -92
- package/dist/{models-BA01NEez.js → .setup/models-C_aZk03A.mjs} +11 -6
- package/dist/.setup/notification-correlation-iYs4WieS.mjs +35 -0
- package/dist/.setup/plugin-app-cache-key-DR8jV9oS.mjs +99 -0
- package/dist/.setup/protocol-2POPqAY4.mjs +13 -0
- package/dist/{protocol-validators-Dm4eXZmt.js → .setup/protocol-validators-dZQ-UTOa.mjs} +111 -334
- package/dist/{rate-limits-S_PXs0ul.js → .setup/provider-DGxDs6g8.mjs} +269 -13
- package/dist/{dynamic-tools-LIt9ojep.js → .setup/provider-capabilities-DS2N_zc1.mjs} +5465 -3399
- package/dist/.setup/request-DFR0JyoV.mjs +36 -0
- package/dist/.setup/run-attempt-C7xEKFVB.mjs +8180 -0
- package/dist/{sandbox-guard-D1Wky__S.js → .setup/sandbox-guard-DA2TQfZW.mjs} +1 -10
- package/dist/.setup/session-binding-DuihlMJc.mjs +628 -0
- package/dist/.setup/shared-client-B2KmLPRw.mjs +1854 -0
- package/dist/{side-question-CO12sHxo.js → .setup/side-question-Cv6JXWCS.mjs} +84 -159
- package/dist/{thread-lifecycle-DRg_FdzC.js → .setup/thread-lifecycle-u6CZdOOH.mjs} +1159 -1799
- package/dist/{web-search-provider.runtime-CaQMYDbp.js → .setup/web-search-provider.runtime-Ce2zOHxW.mjs} +3 -3
- package/dist/doctor-contract-api.js +122 -88
- package/dist/harness.js +20 -85
- package/dist/index.js +381 -1537
- package/dist/media-understanding-provider.js +1 -173
- package/dist/prompt-overlay.js +15 -0
- package/dist/provider-catalog.js +79 -0
- package/dist/provider-discovery.js +34 -0
- package/dist/provider.js +2 -0
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +178 -221
- package/package.json +8 -10
- package/dist/app-server-policy-BmDgseo_.js +0 -49
- package/dist/attempt-client-cleanup-Ia52yRWc.js +0 -127
- package/dist/auth-binding-B4FfbcCg.js +0 -62
- package/dist/capabilities-BHRSI6Cn.js +0 -36
- package/dist/cli-metadata.js +0 -20
- package/dist/computer-use-BjGylO-E.js +0 -695
- package/dist/conversation-control-DE7d9DOj.js +0 -287
- package/dist/event-projector-assistant-message-DTgnPPVF.js +0 -101
- package/dist/event-projector-usage-tvgb1NCX.js +0 -69
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/notification-correlation-Bj_Ak_jI.js +0 -67
- package/dist/plugin-app-cache-key-DSXX-rXO.js +0 -315
- package/dist/realtime-voice-api-BPcA1uN9.js +0 -494
- package/dist/realtime-voice-api.js +0 -2
- package/dist/request-CXpPennK.js +0 -157
- package/dist/run-attempt-C5GTPJOE.js +0 -11935
- package/dist/runtime-artifact-C2ITXdhM.js +0 -488
- package/dist/session-binding-DlVQ-Pxs.js +0 -2161
- package/dist/session-catalog-CP2oCcEb.js +0 -2444
- package/dist/session-cli-CqZ0Fp2a.js +0 -175
- package/dist/session-upstream-marker-QE-m5QFG.js +0 -82
- package/dist/settled-turn-finalizer-CA_2QXIE.js +0 -303
- package/dist/shared-client-BVKE40c-.js +0 -2952
- package/dist/transcript-mirror-uKA-A4tB.js +0 -550
- package/dist/transport-stdio-DXgGZ7Ib.js +0 -88
- package/dist/upstream-session-fork-_Vrz4WJr.js +0 -320
- package/dist/usage-UpVbdX5G.js +0 -25
- /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/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import { U as resolveCodexAppServerHomeDir } from "./shared-client-BVKE40c-.js";
|
|
2
|
-
import { x as resolveCodexAppServerUserHomeDir } from "./session-binding-DlVQ-Pxs.js";
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
|
-
import { isFutureDateTimestampMs, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
5
|
-
import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
|
-
import { createHash } from "node:crypto";
|
|
7
|
-
import { readPluginPackageVersion } from "openclaw/plugin-sdk/extension-shared";
|
|
8
|
-
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
10
|
-
//#region extensions/codex/src/app-server/app-inventory-cache.ts
|
|
11
|
-
/**
|
|
12
|
-
* Process-local cache for Codex app-server app inventories, keyed by runtime
|
|
13
|
-
* identity and safe to refresh in the background.
|
|
14
|
-
*/
|
|
15
|
-
/** Default app inventory cache freshness window. */
|
|
16
|
-
const CODEX_APP_INVENTORY_CACHE_TTL_MS = 3600 * 1e3;
|
|
17
|
-
const CODEX_TARGETED_APP_INVENTORY_LIMIT = 1e3;
|
|
18
|
-
const MAX_SERIALIZED_ERROR_MESSAGE_LENGTH = 500;
|
|
19
|
-
/** In-memory app inventory cache with coalesced refreshes per key. */
|
|
20
|
-
var CodexAppInventoryCache = class {
|
|
21
|
-
constructor(options = {}) {
|
|
22
|
-
this.entries = /* @__PURE__ */ new Map();
|
|
23
|
-
this.inFlight = /* @__PURE__ */ new Map();
|
|
24
|
-
this.refreshTokens = /* @__PURE__ */ new Map();
|
|
25
|
-
this.diagnostics = /* @__PURE__ */ new Map();
|
|
26
|
-
this.revision = 0;
|
|
27
|
-
this.ttlMs = options.ttlMs ?? CODEX_APP_INVENTORY_CACHE_TTL_MS;
|
|
28
|
-
}
|
|
29
|
-
/** Reads a snapshot and schedules refresh when missing, stale, or forced. */
|
|
30
|
-
read(params) {
|
|
31
|
-
const nowMs = resolveDateTimestampMs(params.nowMs);
|
|
32
|
-
const entry = this.entries.get(params.key);
|
|
33
|
-
if (!entry) {
|
|
34
|
-
const refreshScheduled = params.suppressRefresh ? false : this.scheduleRefresh(params);
|
|
35
|
-
return {
|
|
36
|
-
state: "missing",
|
|
37
|
-
key: params.key,
|
|
38
|
-
revision: this.revision,
|
|
39
|
-
refreshScheduled,
|
|
40
|
-
...this.diagnostics.get(params.key) ? { diagnostic: this.diagnostics.get(params.key) } : {}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const state = entry.invalidated || !isFutureDateTimestampMs(entry.expiresAtMs, { nowMs }) ? "stale" : "fresh";
|
|
44
|
-
const refreshScheduled = state === "fresh" && !params.forceRefetch ? false : this.scheduleRefresh(params);
|
|
45
|
-
return {
|
|
46
|
-
state,
|
|
47
|
-
key: params.key,
|
|
48
|
-
revision: entry.revision,
|
|
49
|
-
snapshot: stripEntryState(entry),
|
|
50
|
-
refreshScheduled,
|
|
51
|
-
...entry.lastError ? { diagnostic: entry.lastError } : {}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/** Forces or joins an immediate refresh for a cache key. */
|
|
55
|
-
refreshNow(params) {
|
|
56
|
-
return this.refresh(params);
|
|
57
|
-
}
|
|
58
|
-
/** Marks a key stale and records the reason as a diagnostic. */
|
|
59
|
-
invalidate(key, reason, nowMs = Date.now()) {
|
|
60
|
-
this.revision += 1;
|
|
61
|
-
const diagnostic = {
|
|
62
|
-
message: reason,
|
|
63
|
-
atMs: nowMs
|
|
64
|
-
};
|
|
65
|
-
const entry = this.entries.get(key);
|
|
66
|
-
if (entry) {
|
|
67
|
-
entry.invalidated = true;
|
|
68
|
-
entry.lastError = diagnostic;
|
|
69
|
-
entry.revision = this.revision;
|
|
70
|
-
} else this.diagnostics.set(key, diagnostic);
|
|
71
|
-
return this.revision;
|
|
72
|
-
}
|
|
73
|
-
/** Clears all cached snapshots, diagnostics, in-flight requests, and revision state. */
|
|
74
|
-
clear() {
|
|
75
|
-
this.entries.clear();
|
|
76
|
-
this.inFlight.clear();
|
|
77
|
-
this.refreshTokens.clear();
|
|
78
|
-
this.diagnostics.clear();
|
|
79
|
-
this.revision = 0;
|
|
80
|
-
}
|
|
81
|
-
/** Returns the monotonically increasing cache revision. */
|
|
82
|
-
getRevision() {
|
|
83
|
-
return this.revision;
|
|
84
|
-
}
|
|
85
|
-
scheduleRefresh(params) {
|
|
86
|
-
if (this.inFlight.has(params.key) && !params.forceRefetch) return true;
|
|
87
|
-
const promise = this.refresh(params);
|
|
88
|
-
this.inFlight.set(params.key, promise);
|
|
89
|
-
promise.catch(() => void 0);
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
async refresh(params) {
|
|
93
|
-
const existing = this.inFlight.get(params.key);
|
|
94
|
-
if (existing && !params.forceRefetch) return existing;
|
|
95
|
-
const refreshToken = (this.refreshTokens.get(params.key) ?? 0) + 1;
|
|
96
|
-
this.refreshTokens.set(params.key, refreshToken);
|
|
97
|
-
const promise = this.refreshUncoalesced(params, refreshToken);
|
|
98
|
-
this.inFlight.set(params.key, promise);
|
|
99
|
-
try {
|
|
100
|
-
return await promise;
|
|
101
|
-
} finally {
|
|
102
|
-
if (this.inFlight.get(params.key) === promise) this.inFlight.delete(params.key);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async refreshUncoalesced(params, refreshToken) {
|
|
106
|
-
const nowMs = resolveDateTimestampMs(params.nowMs);
|
|
107
|
-
try {
|
|
108
|
-
const apps = await listAllApps(params.request, params.forceRefetch ?? false, params.targetAppIds);
|
|
109
|
-
this.revision += 1;
|
|
110
|
-
const expiresAtMs = resolveExpiresAtMsFromDurationMs(this.ttlMs, { nowMs }) ?? 0;
|
|
111
|
-
const snapshot = {
|
|
112
|
-
key: params.key,
|
|
113
|
-
apps,
|
|
114
|
-
fetchedAtMs: nowMs,
|
|
115
|
-
expiresAtMs,
|
|
116
|
-
revision: this.revision
|
|
117
|
-
};
|
|
118
|
-
if (this.refreshTokens.get(params.key) === refreshToken) {
|
|
119
|
-
this.entries.set(params.key, {
|
|
120
|
-
...snapshot,
|
|
121
|
-
invalidated: false
|
|
122
|
-
});
|
|
123
|
-
this.diagnostics.delete(params.key);
|
|
124
|
-
}
|
|
125
|
-
return snapshot;
|
|
126
|
-
} catch (error) {
|
|
127
|
-
const diagnostic = {
|
|
128
|
-
message: sanitizeErrorMessage(error instanceof Error ? error.message : String(error)),
|
|
129
|
-
atMs: nowMs
|
|
130
|
-
};
|
|
131
|
-
this.diagnostics.set(params.key, diagnostic);
|
|
132
|
-
const entry = this.entries.get(params.key);
|
|
133
|
-
if (entry) entry.lastError = diagnostic;
|
|
134
|
-
embeddedAgentLog.warn("codex app inventory refresh failed", {
|
|
135
|
-
forceRefetch: params.forceRefetch === true,
|
|
136
|
-
keyFingerprint: fingerprintInventoryCacheKey(params.key),
|
|
137
|
-
error: serializeCodexAppInventoryError(error)
|
|
138
|
-
});
|
|
139
|
-
throw error;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
/** Serializes a refresh failure without leaking large or sensitive error data. */
|
|
144
|
-
function serializeCodexAppInventoryError(error) {
|
|
145
|
-
const record = isRecord(error) ? error : void 0;
|
|
146
|
-
const data = record && "data" in record ? redactErrorData(record.data) : void 0;
|
|
147
|
-
return {
|
|
148
|
-
name: error instanceof Error ? error.name : typeof record?.name === "string" ? record.name : void 0,
|
|
149
|
-
message: sanitizeErrorMessage(error instanceof Error ? error.message : String(error)),
|
|
150
|
-
...typeof record?.code === "number" ? { code: record.code } : {},
|
|
151
|
-
...data !== void 0 ? { data } : {}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
/** Shared app inventory cache used by Codex app-server runtime paths. */
|
|
155
|
-
const defaultCodexAppInventoryCache = new CodexAppInventoryCache();
|
|
156
|
-
/** Builds a stable cache key from build versions and runtime identity fields. */
|
|
157
|
-
function buildCodexAppInventoryCacheKey(input, openClawVersion, codexPluginVersion) {
|
|
158
|
-
return JSON.stringify({
|
|
159
|
-
openClawVersion,
|
|
160
|
-
codexPluginVersion,
|
|
161
|
-
codexHome: input.codexHome ?? null,
|
|
162
|
-
endpoint: input.endpoint ?? null,
|
|
163
|
-
runtimeIdentity: normalizeRuntimeIdentityForCacheKey(input.runtimeIdentity),
|
|
164
|
-
authProfileId: input.authProfileId ?? null,
|
|
165
|
-
accountId: input.accountId ?? null,
|
|
166
|
-
envApiKeyFingerprint: input.envApiKeyFingerprint ?? null,
|
|
167
|
-
appServerVersion: input.appServerVersion ?? null
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function normalizeRuntimeIdentityForCacheKey(value) {
|
|
171
|
-
if (!value) return null;
|
|
172
|
-
const entries = Object.entries(value).flatMap(([key, rawValue]) => {
|
|
173
|
-
const normalized = rawValue?.trim();
|
|
174
|
-
return normalized ? [[key, normalized]] : [];
|
|
175
|
-
}).toSorted(([left], [right]) => left.localeCompare(right));
|
|
176
|
-
return entries.length > 0 ? Object.fromEntries(entries) : null;
|
|
177
|
-
}
|
|
178
|
-
async function listAllApps(request, forceRefetch, targetAppIds = []) {
|
|
179
|
-
const apps = [];
|
|
180
|
-
const targetIds = new Set(targetAppIds.filter(Boolean));
|
|
181
|
-
const remainingTargetIds = new Set(targetIds);
|
|
182
|
-
const seenCursors = /* @__PURE__ */ new Set();
|
|
183
|
-
let cursor;
|
|
184
|
-
do {
|
|
185
|
-
const response = await request("app/list", {
|
|
186
|
-
cursor,
|
|
187
|
-
limit: targetIds.size > 0 ? CODEX_TARGETED_APP_INVENTORY_LIMIT : 100,
|
|
188
|
-
forceRefetch
|
|
189
|
-
});
|
|
190
|
-
apps.push(...response.data);
|
|
191
|
-
for (const app of response.data) remainingTargetIds.delete(app.id);
|
|
192
|
-
if (targetIds.size > 0 && remainingTargetIds.size === 0) break;
|
|
193
|
-
cursor = response.nextCursor;
|
|
194
|
-
if (cursor && seenCursors.has(cursor)) throw new Error(`app/list returned repeated cursor ${cursor}`);
|
|
195
|
-
if (cursor) seenCursors.add(cursor);
|
|
196
|
-
} while (cursor);
|
|
197
|
-
return apps;
|
|
198
|
-
}
|
|
199
|
-
function stripEntryState(entry) {
|
|
200
|
-
const { invalidated: _invalidated, ...snapshot } = entry;
|
|
201
|
-
return snapshot;
|
|
202
|
-
}
|
|
203
|
-
function fingerprintInventoryCacheKey(key) {
|
|
204
|
-
let hash = 0;
|
|
205
|
-
for (let index = 0; index < key.length; index += 1) hash = hash * 31 + key.charCodeAt(index) >>> 0;
|
|
206
|
-
return hash.toString(16).padStart(8, "0");
|
|
207
|
-
}
|
|
208
|
-
function truncateSerializedErrorText(value) {
|
|
209
|
-
return value.length > MAX_SERIALIZED_ERROR_MESSAGE_LENGTH ? `${truncateUtf16Safe(value, MAX_SERIALIZED_ERROR_MESSAGE_LENGTH)}...` : value;
|
|
210
|
-
}
|
|
211
|
-
function redactErrorData(value, depth = 0) {
|
|
212
|
-
if (value === void 0) return;
|
|
213
|
-
if (value === null || typeof value === "boolean" || typeof value === "number") return value;
|
|
214
|
-
if (depth > 6) return "[truncated]";
|
|
215
|
-
if (Array.isArray(value)) return value.map((entry) => redactErrorData(entry, depth + 1) ?? null);
|
|
216
|
-
if (isRecord(value)) {
|
|
217
|
-
const redacted = {};
|
|
218
|
-
for (const [key, entry] of Object.entries(value)) redacted[key] = isSensitiveErrorDataKey(key) ? "<redacted>" : redactErrorData(entry, depth + 1) ?? null;
|
|
219
|
-
return redacted;
|
|
220
|
-
}
|
|
221
|
-
if (typeof value === "string") return truncateSerializedErrorText(value);
|
|
222
|
-
if (typeof value === "bigint") return value.toString();
|
|
223
|
-
if (typeof value === "symbol") return value.description ? `Symbol(${value.description})` : "Symbol()";
|
|
224
|
-
if (typeof value === "function") return value.name ? `[function ${value.name}]` : "[function]";
|
|
225
|
-
return "[unserializable]";
|
|
226
|
-
}
|
|
227
|
-
function sanitizeErrorMessage(message) {
|
|
228
|
-
const htmlStart = message.search(/<html[\s>]/i);
|
|
229
|
-
return truncateSerializedErrorText((htmlStart >= 0 ? `${message.slice(0, htmlStart).trimEnd()} [HTML response body omitted]` : message).replace(/([?&][^=\s"'<>]*(?:api[_-]?key|authorization|cookie|credential|password|secret|token|tk)[^=\s"'<>]*=)[^&\s"'<>]+/gi, "$1<redacted>"));
|
|
230
|
-
}
|
|
231
|
-
function isSensitiveErrorDataKey(key) {
|
|
232
|
-
return /api[_-]?key|authorization|cookie|credential|password|secret|token/i.test(key);
|
|
233
|
-
}
|
|
234
|
-
//#endregion
|
|
235
|
-
//#region extensions/codex/src/app-server/plugin-app-cache-key.ts
|
|
236
|
-
/**
|
|
237
|
-
* Builds stable Codex plugin/app inventory cache keys from app-server startup,
|
|
238
|
-
* auth, account, and version inputs without storing secret material.
|
|
239
|
-
*/
|
|
240
|
-
const CODEX_PLUGIN_VERSION = readPluginPackageVersion({ require: createRequire(import.meta.url) });
|
|
241
|
-
/** Builds the full app inventory cache key for Codex plugin/app discovery. */
|
|
242
|
-
function buildCodexPluginAppCacheKey(params) {
|
|
243
|
-
return buildCodexAppInventoryCacheKey({
|
|
244
|
-
codexHome: params.runtimeIdentity?.codexHome ?? resolveCodexPluginAppCacheCodexHome(params.appServer, params.agentDir),
|
|
245
|
-
endpoint: resolveCodexPluginAppCacheEndpoint(params.appServer),
|
|
246
|
-
authProfileId: params.authProfileId,
|
|
247
|
-
accountId: params.accountId,
|
|
248
|
-
envApiKeyFingerprint: params.envApiKeyFingerprint,
|
|
249
|
-
appServerVersion: params.appServerVersion ?? params.runtimeIdentity?.serverVersion,
|
|
250
|
-
runtimeIdentity: params.runtimeIdentity
|
|
251
|
-
}, OPENCLAW_VERSION, CODEX_PLUGIN_VERSION);
|
|
252
|
-
}
|
|
253
|
-
/** Builds a durable thread-binding fingerprint for one initialized app-server runtime. */
|
|
254
|
-
function buildCodexAppServerRuntimeFingerprint(params) {
|
|
255
|
-
return JSON.stringify({
|
|
256
|
-
endpoint: resolveCodexPluginAppCacheEndpoint(params.appServer),
|
|
257
|
-
connectionClass: params.appServer.connectionClass,
|
|
258
|
-
remoteWorkspaceRoot: params.appServer.remoteWorkspaceRoot ?? null,
|
|
259
|
-
appServerVersion: params.appServerVersion ?? params.runtimeIdentity?.serverVersion ?? null,
|
|
260
|
-
runtimeIdentity: params.runtimeIdentity ?? null
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
/** Fingerprints the configured connection that owns a supervised source thread. */
|
|
264
|
-
function buildCodexAppServerConnectionFingerprint(appServer, agentDir) {
|
|
265
|
-
return JSON.stringify({
|
|
266
|
-
endpoint: resolveCodexPluginAppCacheEndpoint(appServer),
|
|
267
|
-
connectionClass: appServer.connectionClass,
|
|
268
|
-
remoteWorkspaceRoot: appServer.remoteWorkspaceRoot ?? null,
|
|
269
|
-
homeScope: appServer.start.homeScope ?? null,
|
|
270
|
-
codexHome: resolveCodexAppServerConnectionHome(appServer.start, agentDir),
|
|
271
|
-
cwd: appServer.start.cwd ?? null
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
function resolveCodexAppServerConnectionHome(start, agentDir) {
|
|
275
|
-
const configured = start.env?.CODEX_HOME?.trim();
|
|
276
|
-
if (configured) return configured;
|
|
277
|
-
if (start.transport === "unix" && (!start.url || start.url === "unix://")) return resolveCodexAppServerUserHomeDir(start.env ?? process.env);
|
|
278
|
-
if (start.transport !== "stdio") return null;
|
|
279
|
-
if (start.homeScope === "user") return resolveCodexAppServerUserHomeDir(process.env);
|
|
280
|
-
return agentDir ? resolveCodexAppServerHomeDir(agentDir) : null;
|
|
281
|
-
}
|
|
282
|
-
/** Serializes app-server endpoint identity, including credential fingerprints. */
|
|
283
|
-
function resolveCodexPluginAppCacheEndpoint(appServer) {
|
|
284
|
-
return JSON.stringify({
|
|
285
|
-
transport: appServer.start.transport,
|
|
286
|
-
command: appServer.start.command,
|
|
287
|
-
args: appServer.start.args,
|
|
288
|
-
url: appServer.start.url ?? null,
|
|
289
|
-
credentialFingerprint: fingerprintCodexPluginAppCacheCredentials(appServer.start)
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
/** Resolves the CODEX_HOME value that scopes local app-server inventory. */
|
|
293
|
-
function resolveCodexPluginAppCacheCodexHome(appServer, agentDir) {
|
|
294
|
-
const configuredCodexHome = appServer.start.env?.CODEX_HOME?.trim();
|
|
295
|
-
if (configuredCodexHome) return configuredCodexHome;
|
|
296
|
-
return appServer.start.transport === "stdio" && agentDir ? resolveCodexAppServerHomeDir(agentDir) : void 0;
|
|
297
|
-
}
|
|
298
|
-
function fingerprintCodexPluginAppCacheCredentials(startOptions) {
|
|
299
|
-
const authToken = startOptions.authToken ?? "";
|
|
300
|
-
const headers = Object.entries(startOptions.headers).map(([key, value]) => [key.toLowerCase(), value]).toSorted(([left], [right]) => left.localeCompare(right));
|
|
301
|
-
if (!authToken && headers.length === 0) return null;
|
|
302
|
-
const hash = createHash("sha256");
|
|
303
|
-
hash.update("openclaw:codex:plugin-app-cache-credentials:v1");
|
|
304
|
-
hash.update("\0");
|
|
305
|
-
hash.update(authToken);
|
|
306
|
-
for (const [key, value] of headers) {
|
|
307
|
-
hash.update("\0");
|
|
308
|
-
hash.update(key);
|
|
309
|
-
hash.update("\0");
|
|
310
|
-
hash.update(value);
|
|
311
|
-
}
|
|
312
|
-
return `sha256:${hash.digest("hex")}`;
|
|
313
|
-
}
|
|
314
|
-
//#endregion
|
|
315
|
-
export { serializeCodexAppInventoryError as a, defaultCodexAppInventoryCache as i, buildCodexAppServerRuntimeFingerprint as n, buildCodexPluginAppCacheKey as r, buildCodexAppServerConnectionFingerprint as t };
|