@openclaw/codex 2026.5.12 → 2026.5.14-beta.2
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/dist/{client-iRf11BEu.js → client-CoctX13d.js} +5 -1
- package/dist/client-factory-Be6RD28K.js +9 -0
- package/dist/{command-formatters-Ttwc_kgX.js → command-formatters-DRJaVHhN.js} +32 -7
- package/dist/{command-handlers-BYf_veEb.js → command-handlers-CXxykxjq.js} +139 -11
- package/dist/{compact-Bl8jRPk4.js → compact-DWa8cylR.js} +2 -6
- package/dist/{computer-use-Ct3ngNBt.js → computer-use-DsJxRRtm.js} +1 -1
- package/dist/harness.js +4 -4
- package/dist/index.js +147 -32
- package/dist/media-understanding-provider.js +2 -2
- package/dist/{models-BmLfrDci.js → models-GCYf5s8J.js} +1 -1
- package/dist/{conversation-binding-CKofEetY.js → node-cli-sessions-CiexDHeV.js} +518 -6
- package/dist/{plugin-activation-PXGqUjwY.js → plugin-activation-aQOmRQwA.js} +6 -2
- package/dist/provider.js +1 -1
- package/dist/{plugin-app-cache-key-B7eU8fNZ.js → request-CKYiRqsN.js} +46 -3
- package/dist/{run-attempt-4t06MuNr.js → run-attempt-DG9NQab2.js} +95 -39
- package/dist/{shared-client-Cr6W-a2G.js → shared-client-BwUqd3lh.js} +5 -12
- package/dist/{side-question-DV7KYIB8.js → side-question-CVWPOkY-.js} +6 -6
- package/dist/test-api.js +1 -1
- package/dist/{thread-lifecycle-CJppEyYT.js → thread-lifecycle-DrbViNpf.js} +50 -7
- package/dist/{vision-tools-DHyuabWn.js → vision-tools-CzTdigBu.js} +1 -1
- package/package.json +5 -5
- package/dist/client-factory-DfnbdQv7.js +0 -19
- package/dist/request-ohCy5ASa.js +0 -45
- /package/dist/{rate-limit-cache-BFi-50LG.js → rate-limit-cache-dvhq-4pi.js} +0 -0
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { l as resolveCodexPluginsPolicy, o as readCodexPluginConfig, s as resolveCodexAppServerRuntimeOptions, u as withMcpElicitationsApprovalPolicy } from "./config-0rd3LnKg.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-CSY0BFBo.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { i as isCodexAppServerConnectionClosedError, r as isCodexAppServerApprovalRequest } from "./client-
|
|
5
|
-
import { n as CODEX_CONTROL_METHODS } from "./request-
|
|
6
|
-
import { d as resolveCodexUsageLimitResetAtMs, f as shouldRefreshCodexRateLimitsForUsageLimitMessage, r as formatCodexDisplayText, u as formatCodexUsageLimitErrorMessage } from "./command-formatters-
|
|
7
|
-
import { c as
|
|
4
|
+
import { i as isCodexAppServerConnectionClosedError, r as isCodexAppServerApprovalRequest } from "./client-CoctX13d.js";
|
|
5
|
+
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-CKYiRqsN.js";
|
|
6
|
+
import { d as resolveCodexUsageLimitResetAtMs, f as shouldRefreshCodexRateLimitsForUsageLimitMessage, r as formatCodexDisplayText, u as formatCodexUsageLimitErrorMessage } from "./command-formatters-DRJaVHhN.js";
|
|
7
|
+
import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, l as resolveCodexAppServerAuthProfileId, n as clearSharedCodexAppServerClientIfCurrent, s as refreshCodexAppServerAuthTokens, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-BwUqd3lh.js";
|
|
8
8
|
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
|
|
9
|
-
import { a as defaultCodexAppInventoryCache } from "./plugin-activation-
|
|
10
|
-
import { t as
|
|
11
|
-
import {
|
|
12
|
-
import { n as
|
|
13
|
-
import {
|
|
14
|
-
import { t as
|
|
15
|
-
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-BFi-50LG.js";
|
|
9
|
+
import { a as defaultCodexAppInventoryCache } from "./plugin-activation-aQOmRQwA.js";
|
|
10
|
+
import { _ as resolveCodexContextEngineProjectionReserveTokens, b as normalizeCodexDynamicToolName, d as buildCodexPluginThreadConfig, f as buildCodexPluginThreadConfigInputFingerprint, g as resolveCodexContextEngineProjectionMaxChars, h as projectContextEngineAssemblyForCodex, m as shouldBuildCodexPluginThreadConfig, o as buildTurnStartParams, p as mergeCodexThreadConfigs, r as buildDeveloperInstructions, s as codexDynamicToolsFingerprint, t as areCodexDynamicToolFingerprintsCompatible, u as startOrResumeThread, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-DrbViNpf.js";
|
|
11
|
+
import { t as defaultCodexAppServerClientFactory } from "./client-factory-Be6RD28K.js";
|
|
12
|
+
import { n as handleCodexAppServerElicitationRequest, r as handleCodexAppServerApprovalRequest, t as filterToolsForVisionInputs } from "./vision-tools-CzTdigBu.js";
|
|
13
|
+
import { t as ensureCodexComputerUse } from "./computer-use-DsJxRRtm.js";
|
|
14
|
+
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
|
|
16
15
|
import { createHash } from "node:crypto";
|
|
17
16
|
import nodeFs from "node:fs";
|
|
18
17
|
import { TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, bootstrapHarnessContextEngine, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, loadCodexBundleMcpThreadConfig, normalizeAgentRuntimeTools, normalizeUsage, registerNativeHookRelay, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockAcquireTimeoutMs, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -20,7 +19,6 @@ import fs from "node:fs/promises";
|
|
|
20
19
|
import path from "node:path";
|
|
21
20
|
import { markAuthProfileBlockedUntil, resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
22
21
|
import { appendRegularFile, pathExists } from "openclaw/plugin-sdk/security-runtime";
|
|
23
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
24
22
|
import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
25
23
|
import { createRunningTaskRun, finalizeTaskRunByRunId, recordTaskRunProgressByRunId } from "openclaw/plugin-sdk/codex-native-task-runtime";
|
|
26
24
|
import { buildSessionContext, migrateSessionEntries, parseSessionEntries } from "@earendil-works/pi-coding-agent";
|
|
@@ -490,6 +488,8 @@ var CodexAppServerEventProjector = class {
|
|
|
490
488
|
this.options = options;
|
|
491
489
|
this.assistantTextByItem = /* @__PURE__ */ new Map();
|
|
492
490
|
this.assistantItemOrder = [];
|
|
491
|
+
this.assistantPhaseByItem = /* @__PURE__ */ new Map();
|
|
492
|
+
this.lastCommentaryProgressTextByItem = /* @__PURE__ */ new Map();
|
|
493
493
|
this.reasoningTextByItem = /* @__PURE__ */ new Map();
|
|
494
494
|
this.planTextByItem = /* @__PURE__ */ new Map();
|
|
495
495
|
this.activeItemIds = /* @__PURE__ */ new Set();
|
|
@@ -694,6 +694,10 @@ var CodexAppServerEventProjector = class {
|
|
|
694
694
|
this.rememberAssistantItem(itemId);
|
|
695
695
|
const text = `${this.assistantTextByItem.get(itemId) ?? ""}${delta}`;
|
|
696
696
|
this.assistantTextByItem.set(itemId, text);
|
|
697
|
+
if (this.isCommentaryAssistantItem(itemId)) this.emitCommentaryProgress({
|
|
698
|
+
itemId,
|
|
699
|
+
text
|
|
700
|
+
});
|
|
697
701
|
}
|
|
698
702
|
async handleReasoningDelta(params) {
|
|
699
703
|
const itemId = readString$2(params, "itemId") ?? readString$2(params, "id") ?? "reasoning";
|
|
@@ -730,6 +734,7 @@ var CodexAppServerEventProjector = class {
|
|
|
730
734
|
async handleItemStarted(params) {
|
|
731
735
|
const item = readItem(params.item);
|
|
732
736
|
const itemId = item?.id ?? readString$2(params, "itemId") ?? readString$2(params, "id");
|
|
737
|
+
this.rememberAssistantPhase(item);
|
|
733
738
|
if (itemId) this.activeItemIds.add(itemId);
|
|
734
739
|
if (item?.type === "contextCompaction" && itemId) {
|
|
735
740
|
this.activeCompactionItemIds.add(itemId);
|
|
@@ -784,9 +789,14 @@ var CodexAppServerEventProjector = class {
|
|
|
784
789
|
this.activeItemIds.delete(itemId);
|
|
785
790
|
this.completedItemIds.add(itemId);
|
|
786
791
|
}
|
|
792
|
+
this.rememberAssistantPhase(item);
|
|
787
793
|
if (item?.type === "agentMessage" && typeof item.text === "string" && item.text) {
|
|
788
794
|
this.rememberAssistantItem(item.id);
|
|
789
795
|
this.assistantTextByItem.set(item.id, item.text);
|
|
796
|
+
if (this.isCommentaryAssistantItem(item.id)) this.emitCommentaryProgress({
|
|
797
|
+
itemId: item.id,
|
|
798
|
+
text: item.text
|
|
799
|
+
});
|
|
790
800
|
}
|
|
791
801
|
this.recordNativeGeneratedMedia(item);
|
|
792
802
|
if (item?.type === "plan" && typeof item.text === "string" && item.text) {
|
|
@@ -914,6 +924,7 @@ var CodexAppServerEventProjector = class {
|
|
|
914
924
|
this.promptErrorSource = "prompt";
|
|
915
925
|
}
|
|
916
926
|
for (const item of turn.items ?? []) {
|
|
927
|
+
this.rememberAssistantPhase(item);
|
|
917
928
|
if (item.type === "agentMessage" && typeof item.text === "string" && item.text) {
|
|
918
929
|
this.rememberAssistantItem(item.id);
|
|
919
930
|
this.assistantTextByItem.set(item.id, item.text);
|
|
@@ -1006,6 +1017,30 @@ var CodexAppServerEventProjector = class {
|
|
|
1006
1017
|
}
|
|
1007
1018
|
});
|
|
1008
1019
|
}
|
|
1020
|
+
rememberAssistantPhase(item) {
|
|
1021
|
+
if (item?.type !== "agentMessage") return;
|
|
1022
|
+
const phase = readItemString(item, "phase");
|
|
1023
|
+
if (phase) this.assistantPhaseByItem.set(item.id, phase);
|
|
1024
|
+
}
|
|
1025
|
+
isCommentaryAssistantItem(itemId) {
|
|
1026
|
+
return this.assistantPhaseByItem.get(itemId) === "commentary";
|
|
1027
|
+
}
|
|
1028
|
+
emitCommentaryProgress(params) {
|
|
1029
|
+
const progressText = params.text.replace(/\s+/g, " ").trim();
|
|
1030
|
+
if (!progressText || this.lastCommentaryProgressTextByItem.get(params.itemId) === progressText) return;
|
|
1031
|
+
this.lastCommentaryProgressTextByItem.set(params.itemId, progressText);
|
|
1032
|
+
this.emitAgentEvent({
|
|
1033
|
+
stream: "item",
|
|
1034
|
+
data: {
|
|
1035
|
+
itemId: params.itemId,
|
|
1036
|
+
kind: "preamble",
|
|
1037
|
+
title: "Preamble",
|
|
1038
|
+
phase: "update",
|
|
1039
|
+
progressText,
|
|
1040
|
+
source: "codex-app-server"
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1009
1044
|
emitStandardItemEvent(params) {
|
|
1010
1045
|
const { item } = params;
|
|
1011
1046
|
if (!item) return;
|
|
@@ -1249,6 +1284,7 @@ var CodexAppServerEventProjector = class {
|
|
|
1249
1284
|
const itemId = this.assistantItemOrder[i];
|
|
1250
1285
|
if (!itemId) continue;
|
|
1251
1286
|
const text = this.assistantTextByItem.get(itemId)?.trim();
|
|
1287
|
+
if (this.assistantPhaseByItem.get(itemId) === "commentary") continue;
|
|
1252
1288
|
if (text && !this.toolProgressTexts.has(text)) return text;
|
|
1253
1289
|
}
|
|
1254
1290
|
}
|
|
@@ -2094,12 +2130,7 @@ const CODEX_BOOTSTRAP_CONTEXT_ORDER = new Map([
|
|
|
2094
2130
|
["memory.md", 60],
|
|
2095
2131
|
["heartbeat.md", 70]
|
|
2096
2132
|
]);
|
|
2097
|
-
const testClientFactoryStorage = new AsyncLocalStorage();
|
|
2098
|
-
const clientFactory = defaultCodexAppServerClientFactory;
|
|
2099
2133
|
let openClawCodingToolsFactoryForTests;
|
|
2100
|
-
function resolveCodexAppServerClientFactory() {
|
|
2101
|
-
return testClientFactoryStorage.getStore() ?? clientFactory;
|
|
2102
|
-
}
|
|
2103
2134
|
function emitCodexAppServerEvent(params, event) {
|
|
2104
2135
|
try {
|
|
2105
2136
|
emitAgentEvent({
|
|
@@ -2181,7 +2212,8 @@ function createCodexSteeringQueue(params) {
|
|
|
2181
2212
|
}
|
|
2182
2213
|
};
|
|
2183
2214
|
const sendTexts = async (texts) => {
|
|
2184
|
-
if (texts.length === 0
|
|
2215
|
+
if (texts.length === 0) return;
|
|
2216
|
+
if (params.signal.aborted) throw new Error("codex app-server steering queue aborted");
|
|
2185
2217
|
await params.client.request("turn/steer", {
|
|
2186
2218
|
threadId: params.threadId,
|
|
2187
2219
|
expectedTurnId: params.turnId,
|
|
@@ -2189,39 +2221,49 @@ function createCodexSteeringQueue(params) {
|
|
|
2189
2221
|
});
|
|
2190
2222
|
};
|
|
2191
2223
|
const enqueueSend = (texts) => {
|
|
2192
|
-
|
|
2224
|
+
const send = sendChain.then(() => sendTexts(texts));
|
|
2225
|
+
sendChain = send.catch((error) => {
|
|
2193
2226
|
embeddedAgentLog.debug("codex app-server queued steer failed", { error });
|
|
2194
2227
|
});
|
|
2195
|
-
return
|
|
2228
|
+
return send;
|
|
2196
2229
|
};
|
|
2197
2230
|
const flushBatch = () => {
|
|
2198
2231
|
clearBatchTimer();
|
|
2199
|
-
const
|
|
2232
|
+
const items = batchedTexts;
|
|
2200
2233
|
batchedTexts = [];
|
|
2201
|
-
|
|
2234
|
+
const send = enqueueSend(items.map((item) => item.text));
|
|
2235
|
+
send.then(() => {
|
|
2236
|
+
for (const item of items) item.resolve();
|
|
2237
|
+
}, (error) => {
|
|
2238
|
+
for (const item of items) item.reject(error);
|
|
2239
|
+
});
|
|
2240
|
+
return send;
|
|
2202
2241
|
};
|
|
2203
2242
|
return {
|
|
2204
2243
|
async queue(text, options) {
|
|
2205
2244
|
if (params.answerPendingUserInput(text)) return;
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2245
|
+
return await new Promise((resolve, reject) => {
|
|
2246
|
+
batchedTexts.push({
|
|
2247
|
+
text,
|
|
2248
|
+
resolve,
|
|
2249
|
+
reject
|
|
2250
|
+
});
|
|
2251
|
+
clearBatchTimer();
|
|
2252
|
+
const debounceMs = normalizeCodexSteerDebounceMs(options?.debounceMs);
|
|
2253
|
+
batchTimer = setTimeout(() => {
|
|
2254
|
+
batchTimer = void 0;
|
|
2255
|
+
flushBatch().catch(() => void 0);
|
|
2256
|
+
}, debounceMs);
|
|
2257
|
+
});
|
|
2218
2258
|
},
|
|
2219
2259
|
async flushPending() {
|
|
2220
|
-
await flushBatch();
|
|
2260
|
+
await flushBatch().catch(() => void 0);
|
|
2221
2261
|
},
|
|
2222
2262
|
cancel() {
|
|
2223
2263
|
clearBatchTimer();
|
|
2264
|
+
const items = batchedTexts;
|
|
2224
2265
|
batchedTexts = [];
|
|
2266
|
+
for (const item of items) item.reject(/* @__PURE__ */ new Error("codex app-server steering queue cancelled"));
|
|
2225
2267
|
}
|
|
2226
2268
|
};
|
|
2227
2269
|
}
|
|
@@ -2244,7 +2286,7 @@ function restrictCodexAppServerSandboxForOpenClawSandbox(appServer, sandbox) {
|
|
|
2244
2286
|
}
|
|
2245
2287
|
async function runCodexAppServerAttempt(params, options = {}) {
|
|
2246
2288
|
const attemptStartedAt = Date.now();
|
|
2247
|
-
const attemptClientFactory =
|
|
2289
|
+
const attemptClientFactory = options.clientFactory ?? defaultCodexAppServerClientFactory;
|
|
2248
2290
|
const pluginConfig = readCodexPluginConfig(options.pluginConfig);
|
|
2249
2291
|
const configuredAppServer = resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
2250
2292
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
@@ -2335,6 +2377,11 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2335
2377
|
});
|
|
2336
2378
|
const hadSessionFile = await pathExists(params.sessionFile);
|
|
2337
2379
|
let historyMessages = await readMirroredSessionHistoryMessages(params.sessionFile) ?? [];
|
|
2380
|
+
const hookContextWindowFields = {
|
|
2381
|
+
...params.contextWindowInfo?.tokens ? { contextTokenBudget: params.contextWindowInfo.tokens } : params.contextTokenBudget ? { contextTokenBudget: params.contextTokenBudget } : {},
|
|
2382
|
+
...params.contextWindowInfo?.source ? { contextWindowSource: params.contextWindowInfo.source } : {},
|
|
2383
|
+
...params.contextWindowInfo?.referenceTokens ? { contextWindowReferenceTokens: params.contextWindowInfo.referenceTokens } : {}
|
|
2384
|
+
};
|
|
2338
2385
|
const hookContext = {
|
|
2339
2386
|
runId: params.runId,
|
|
2340
2387
|
agentId: sessionAgentId,
|
|
@@ -2343,7 +2390,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2343
2390
|
workspaceDir: params.workspaceDir,
|
|
2344
2391
|
messageProvider: params.messageProvider ?? void 0,
|
|
2345
2392
|
trigger: params.trigger,
|
|
2346
|
-
channelId: params.messageChannel ?? params.messageProvider ?? void 0
|
|
2393
|
+
channelId: params.messageChannel ?? params.messageProvider ?? void 0,
|
|
2394
|
+
...hookContextWindowFields
|
|
2347
2395
|
};
|
|
2348
2396
|
if (activeContextEngine) {
|
|
2349
2397
|
await bootstrapHarnessContextEngine({
|
|
@@ -3125,6 +3173,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3125
3173
|
sessionId: params.sessionId,
|
|
3126
3174
|
provider: params.provider,
|
|
3127
3175
|
model: params.modelId,
|
|
3176
|
+
...hookContextWindowFields,
|
|
3128
3177
|
resolvedRef: params.runtimePlan?.observability.resolvedRef ?? `${params.provider}/${params.modelId}`,
|
|
3129
3178
|
...params.runtimePlan?.observability.harnessId ? { harnessId: params.runtimePlan.observability.harnessId } : {},
|
|
3130
3179
|
assistantTexts: []
|
|
@@ -3324,6 +3373,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3324
3373
|
sessionId: params.sessionId,
|
|
3325
3374
|
provider: params.provider,
|
|
3326
3375
|
model: params.modelId,
|
|
3376
|
+
...hookContextWindowFields,
|
|
3327
3377
|
resolvedRef: params.runtimePlan?.observability.resolvedRef ?? `${params.provider}/${params.modelId}`,
|
|
3328
3378
|
...params.runtimePlan?.observability.harnessId ? { harnessId: params.runtimePlan.observability.harnessId } : {},
|
|
3329
3379
|
assistantTexts: result.assistantTexts,
|
|
@@ -3674,7 +3724,7 @@ async function buildDynamicTools(input) {
|
|
|
3674
3724
|
}), input.pluginConfig), {
|
|
3675
3725
|
modelHasVision,
|
|
3676
3726
|
hasInboundImages: (params.images?.length ?? 0) > 0
|
|
3677
|
-
}), params.toolsAllow);
|
|
3727
|
+
}), includeForcedMessageToolAllow(params.toolsAllow, params));
|
|
3678
3728
|
return normalizeAgentRuntimeTools({
|
|
3679
3729
|
runtimePlan: params.runtimePlan,
|
|
3680
3730
|
tools: filteredTools,
|
|
@@ -3687,6 +3737,12 @@ async function buildDynamicTools(input) {
|
|
|
3687
3737
|
model: params.model
|
|
3688
3738
|
});
|
|
3689
3739
|
}
|
|
3740
|
+
function includeForcedMessageToolAllow(toolsAllow, params) {
|
|
3741
|
+
if (!shouldForceMessageTool(params)) return toolsAllow;
|
|
3742
|
+
if (toolsAllow === void 0) return toolsAllow;
|
|
3743
|
+
if (toolsAllow.length === 0) return ["message"];
|
|
3744
|
+
return new Set(toolsAllow.map((name) => normalizeCodexDynamicToolName(name))).has("message") ? toolsAllow : [...toolsAllow, "message"];
|
|
3745
|
+
}
|
|
3690
3746
|
function filterCodexDynamicToolsForAllowlist(tools, toolsAllow) {
|
|
3691
3747
|
if (!toolsAllow || toolsAllow.length === 0) return tools;
|
|
3692
3748
|
const allowSet = new Set(toolsAllow.map((name) => normalizeCodexDynamicToolName(name)).filter(Boolean));
|
|
@@ -4118,7 +4174,7 @@ function renderCodexWorkspaceBootstrapInstructions(contextFiles) {
|
|
|
4118
4174
|
}
|
|
4119
4175
|
function remapCodexContextFilePath(params) {
|
|
4120
4176
|
const relativePath = path.relative(params.sourceWorkspaceDir, params.file.path);
|
|
4121
|
-
if (!relativePath || relativePath.startsWith(
|
|
4177
|
+
if (!relativePath || relativePath === ".." || relativePath.startsWith(`..${path.sep}`) || path.isAbsolute(relativePath) || params.sourceWorkspaceDir === params.targetWorkspaceDir) return params.file;
|
|
4122
4178
|
return {
|
|
4123
4179
|
...params.file,
|
|
4124
4180
|
path: path.join(params.targetWorkspaceDir, relativePath)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
2
|
import { n as codexAppServerStartOptionsKey, s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
|
|
3
|
-
import { a as MANAGED_CODEX_APP_SERVER_PACKAGE, o as resolveCodexAppServerSpawnEnv, t as CodexAppServerClient } from "./client-
|
|
3
|
+
import { a as MANAGED_CODEX_APP_SERVER_PACKAGE, o as resolveCodexAppServerSpawnEnv, t as CodexAppServerClient } from "./client-CoctX13d.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { constants, readFileSync } from "node:fs";
|
|
7
7
|
import fs, { access } from "node:fs/promises";
|
|
8
8
|
import path from "node:path";
|
|
9
|
-
import { ensureAuthProfileStore, ensureAuthProfileStoreWithoutExternalProfiles, loadAuthProfileStoreForSecretsRuntime, refreshOAuthCredentialForRuntime, resolveApiKeyForProfile, resolveAuthProfileOrder, resolveDefaultAgentDir, resolvePersistedAuthProfileOwnerAgentDir, resolveProviderIdForAuth
|
|
9
|
+
import { ensureAuthProfileStore, ensureAuthProfileStoreWithoutExternalProfiles, loadAuthProfileStoreForSecretsRuntime, refreshOAuthCredentialForRuntime, resolveApiKeyForProfile, resolveAuthProfileOrder, resolveDefaultAgentDir, resolvePersistedAuthProfileOwnerAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { withTimeout } from "openclaw/plugin-sdk/security-runtime";
|
|
12
12
|
//#region extensions/codex/src/app-server/auth-bridge.ts
|
|
@@ -283,24 +283,17 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
|
|
|
283
283
|
const persistedOAuthCredential = persistedCredential?.type === "oauth" && isCodexAppServerAuthProvider(persistedCredential.provider, params.config) ? persistedCredential : void 0;
|
|
284
284
|
const ownerCredential = store.profiles[profileId];
|
|
285
285
|
const overlaidOAuthCredential = ownerCredential?.type === "oauth" && isCodexAppServerAuthProvider(ownerCredential.provider, params.config) ? ownerCredential : void 0;
|
|
286
|
-
const credentialForOwner = persistedOAuthCredential ?? overlaidOAuthCredential ?? credential;
|
|
287
286
|
if (params.forceRefresh && !persistedOAuthCredential && overlaidOAuthCredential) {
|
|
288
287
|
const refreshedRuntimeCredential = await refreshOAuthCredentialForRuntime({ credential: overlaidOAuthCredential });
|
|
289
288
|
if (!refreshedRuntimeCredential?.access?.trim()) throw new Error(`Codex app-server auth profile "${profileId}" could not refresh.`);
|
|
290
289
|
store.profiles[profileId] = refreshedRuntimeCredential;
|
|
291
290
|
return refreshedRuntimeCredential;
|
|
292
291
|
}
|
|
293
|
-
if (params.forceRefresh && persistedOAuthCredential) {
|
|
294
|
-
store.profiles[profileId] = {
|
|
295
|
-
...credentialForOwner,
|
|
296
|
-
expires: 0
|
|
297
|
-
};
|
|
298
|
-
saveAuthProfileStore(store, ownerAgentDir);
|
|
299
|
-
}
|
|
300
292
|
const resolved = await resolveApiKeyForProfile({
|
|
301
293
|
store,
|
|
302
294
|
profileId,
|
|
303
|
-
agentDir: ownerAgentDir
|
|
295
|
+
agentDir: ownerAgentDir,
|
|
296
|
+
forceRefresh: params.forceRefresh && Boolean(persistedOAuthCredential)
|
|
304
297
|
});
|
|
305
298
|
const refreshed = loadAuthProfileStoreForSecretsRuntime(ownerAgentDir).profiles[profileId];
|
|
306
299
|
const storedCredential = store.profiles[profileId];
|
|
@@ -601,4 +594,4 @@ function clearSharedClientIfCurrent(client) {
|
|
|
601
594
|
state.key = void 0;
|
|
602
595
|
}
|
|
603
596
|
//#endregion
|
|
604
|
-
export {
|
|
597
|
+
export { shared_client_exports as a, resolveCodexAppServerAuthAccountCacheKey as c, resolveCodexAppServerEnvApiKeyCacheKey as d, resolveCodexAppServerHomeDir as f, getSharedCodexAppServerClient as i, resolveCodexAppServerAuthProfileId as l, clearSharedCodexAppServerClientIfCurrent as n, withTimeout$1 as o, createIsolatedCodexAppServerClient as r, refreshCodexAppServerAuthTokens as s, clearSharedCodexAppServerClientAndWait as t, resolveCodexAppServerAuthProfileIdForAgent as u };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { o as readCodexPluginConfig, s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, t as assertCodexThreadForkResponse } from "./protocol-validators-CSY0BFBo.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { r as isCodexAppServerApprovalRequest } from "./client-
|
|
5
|
-
import { u as formatCodexUsageLimitErrorMessage } from "./command-formatters-
|
|
6
|
-
import {
|
|
4
|
+
import { r as isCodexAppServerApprovalRequest } from "./client-CoctX13d.js";
|
|
5
|
+
import { u as formatCodexUsageLimitErrorMessage } from "./command-formatters-DRJaVHhN.js";
|
|
6
|
+
import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-BwUqd3lh.js";
|
|
7
7
|
import { i as readCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
|
|
8
|
-
import { c as resolveCodexAppServerModelProvider, l as resolveReasoningEffort, n as buildCodexRuntimeThreadConfig, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-
|
|
9
|
-
import { n as handleCodexAppServerElicitationRequest, r as handleCodexAppServerApprovalRequest, t as filterToolsForVisionInputs } from "./vision-tools-
|
|
10
|
-
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-
|
|
8
|
+
import { c as resolveCodexAppServerModelProvider, l as resolveReasoningEffort, n as buildCodexRuntimeThreadConfig, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-DrbViNpf.js";
|
|
9
|
+
import { n as handleCodexAppServerElicitationRequest, r as handleCodexAppServerApprovalRequest, t as filterToolsForVisionInputs } from "./vision-tools-CzTdigBu.js";
|
|
10
|
+
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
|
|
11
11
|
import { embeddedAgentLog, formatErrorMessage, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
12
12
|
//#region extensions/codex/src/app-server/side-question.ts
|
|
13
13
|
const CODEX_SIDE_DYNAMIC_TOOL_TIMEOUT_MS = 3e4;
|
package/dist/test-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
|
|
2
|
-
import { a as buildThreadStartParams, i as buildThreadResumeParams, o as buildTurnStartParams, r as buildDeveloperInstructions, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-
|
|
2
|
+
import { a as buildThreadStartParams, i as buildThreadResumeParams, o as buildTurnStartParams, r as buildDeveloperInstructions, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-DrbViNpf.js";
|
|
3
3
|
//#region extensions/codex/test-api.ts
|
|
4
4
|
function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
|
|
5
5
|
return resolveCodexAppServerRuntimeOptions({
|
|
@@ -3,9 +3,9 @@ import { n as assertCodexThreadResumeResponse, r as assertCodexThreadStartRespon
|
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
4
|
import { CODEX_GPT5_HEARTBEAT_PROMPT_OVERLAY, renderCodexPromptOverlay } from "./prompt-overlay.js";
|
|
5
5
|
import { isModernCodexModel } from "./provider.js";
|
|
6
|
-
import { i as isCodexAppServerConnectionClosedError } from "./client-
|
|
6
|
+
import { i as isCodexAppServerConnectionClosedError } from "./client-CoctX13d.js";
|
|
7
7
|
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
|
|
8
|
-
import { a as defaultCodexAppInventoryCache, r as readCodexPluginInventory, t as ensureCodexPluginActivation } from "./plugin-activation-
|
|
8
|
+
import { a as defaultCodexAppInventoryCache, r as readCodexPluginInventory, t as ensureCodexPluginActivation } from "./plugin-activation-aQOmRQwA.js";
|
|
9
9
|
import crypto from "node:crypto";
|
|
10
10
|
import { HEARTBEAT_RESPONSE_TOOL_NAME, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractToolResultMediaArtifact, filterToolResultMediaUrls, isActiveHarnessContextEngine, isMessagingTool, isMessagingToolSendAction, isToolWrappedWithBeforeToolCallHook, normalizeHeartbeatToolResponse, runAgentHarnessAfterToolCallHook, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
11
11
|
import { buildCodexUserMcpServersThreadConfigPatch } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
@@ -297,14 +297,33 @@ function readFirstString(record, keys) {
|
|
|
297
297
|
}
|
|
298
298
|
function collectMediaUrls(record) {
|
|
299
299
|
const urls = [];
|
|
300
|
+
const pushMediaUrl = (value) => {
|
|
301
|
+
if (typeof value === "string" && value.trim()) urls.push(value.trim());
|
|
302
|
+
};
|
|
303
|
+
const pushAttachment = (value) => {
|
|
304
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
305
|
+
const attachment = value;
|
|
306
|
+
for (const key of [
|
|
307
|
+
"media",
|
|
308
|
+
"mediaUrl",
|
|
309
|
+
"path",
|
|
310
|
+
"filePath",
|
|
311
|
+
"fileUrl",
|
|
312
|
+
"url"
|
|
313
|
+
]) pushMediaUrl(attachment[key]);
|
|
314
|
+
};
|
|
300
315
|
for (const key of [
|
|
316
|
+
"media",
|
|
301
317
|
"mediaUrl",
|
|
302
318
|
"media_url",
|
|
319
|
+
"path",
|
|
320
|
+
"filePath",
|
|
321
|
+
"fileUrl",
|
|
303
322
|
"imageUrl",
|
|
304
323
|
"image_url"
|
|
305
324
|
]) {
|
|
306
325
|
const value = record[key];
|
|
307
|
-
|
|
326
|
+
pushMediaUrl(value);
|
|
308
327
|
}
|
|
309
328
|
for (const key of [
|
|
310
329
|
"mediaUrls",
|
|
@@ -314,8 +333,10 @@ function collectMediaUrls(record) {
|
|
|
314
333
|
]) {
|
|
315
334
|
const value = record[key];
|
|
316
335
|
if (!Array.isArray(value)) continue;
|
|
317
|
-
for (const entry of value)
|
|
336
|
+
for (const entry of value) pushMediaUrl(entry);
|
|
318
337
|
}
|
|
338
|
+
const attachments = record.attachments;
|
|
339
|
+
if (Array.isArray(attachments)) for (const attachment of attachments) pushAttachment(attachment);
|
|
319
340
|
return urls;
|
|
320
341
|
}
|
|
321
342
|
function isCronAddAction(args) {
|
|
@@ -680,6 +701,7 @@ const CODEX_CODE_MODE_THREAD_CONFIG = {
|
|
|
680
701
|
"features.code_mode": true,
|
|
681
702
|
"features.code_mode_only": true
|
|
682
703
|
};
|
|
704
|
+
const CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG = { project_doc_max_bytes: 0 };
|
|
683
705
|
async function startOrResumeThread(params) {
|
|
684
706
|
const dynamicToolsFingerprint = fingerprintDynamicTools(params.dynamicTools);
|
|
685
707
|
const contextEngineBinding = buildContextEngineBinding(params.params);
|
|
@@ -939,7 +961,7 @@ function buildThreadStartParams(params, options) {
|
|
|
939
961
|
sandbox: options.appServer.sandbox,
|
|
940
962
|
...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
|
|
941
963
|
serviceName: "OpenClaw",
|
|
942
|
-
config:
|
|
964
|
+
config: buildCodexRuntimeThreadConfigForRun(params, options.config),
|
|
943
965
|
developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params),
|
|
944
966
|
dynamicTools: options.dynamicTools,
|
|
945
967
|
experimentalRawEvents: true,
|
|
@@ -962,7 +984,7 @@ function buildThreadResumeParams(params, options) {
|
|
|
962
984
|
approvalsReviewer: options.appServer.approvalsReviewer,
|
|
963
985
|
sandbox: options.appServer.sandbox,
|
|
964
986
|
...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
|
|
965
|
-
config:
|
|
987
|
+
config: buildCodexRuntimeThreadConfigForRun(params, options.config),
|
|
966
988
|
developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params),
|
|
967
989
|
persistExtendedHistory: true
|
|
968
990
|
};
|
|
@@ -970,6 +992,14 @@ function buildThreadResumeParams(params, options) {
|
|
|
970
992
|
function buildCodexRuntimeThreadConfig(config) {
|
|
971
993
|
return mergeCodexThreadConfigs(config, CODEX_CODE_MODE_THREAD_CONFIG) ?? { ...CODEX_CODE_MODE_THREAD_CONFIG };
|
|
972
994
|
}
|
|
995
|
+
function buildCodexRuntimeThreadConfigForRun(params, config) {
|
|
996
|
+
const runtimeConfig = buildCodexRuntimeThreadConfig(config);
|
|
997
|
+
if (params.bootstrapContextMode !== "lightweight") return runtimeConfig;
|
|
998
|
+
return mergeCodexThreadConfigs(runtimeConfig, CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG) ?? {
|
|
999
|
+
...runtimeConfig,
|
|
1000
|
+
...CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
973
1003
|
function buildTurnStartParams(params, options) {
|
|
974
1004
|
return {
|
|
975
1005
|
threadId: options.threadId,
|
|
@@ -990,10 +1020,23 @@ function buildTurnCollaborationMode(params) {
|
|
|
990
1020
|
settings: {
|
|
991
1021
|
model: params.modelId,
|
|
992
1022
|
reasoning_effort: resolveReasoningEffort(params.thinkLevel, params.modelId),
|
|
993
|
-
developer_instructions: params
|
|
1023
|
+
developer_instructions: buildTurnScopedCollaborationInstructions(params)
|
|
994
1024
|
}
|
|
995
1025
|
};
|
|
996
1026
|
}
|
|
1027
|
+
function buildTurnScopedCollaborationInstructions(params) {
|
|
1028
|
+
if (params.trigger === "cron") return buildCronCollaborationInstructions();
|
|
1029
|
+
if (params.trigger === "heartbeat") return buildHeartbeatCollaborationInstructions();
|
|
1030
|
+
return null;
|
|
1031
|
+
}
|
|
1032
|
+
function buildCronCollaborationInstructions() {
|
|
1033
|
+
return [
|
|
1034
|
+
"This is an OpenClaw cron automation turn. Apply these instructions only to this scheduled job; ordinary chat turns should stay in Codex Default mode.",
|
|
1035
|
+
"Execute the cron payload directly. If it asks you to run an exact command, run that command before doing any investigation, planning, memory review, or workspace bootstrap.",
|
|
1036
|
+
"Use context already provided by the runtime, but do not spend time loading or re-reading workspace bootstrap, memory, or project-doc files before executing the cron payload. Inspect those files only if the payload asks for them or the command fails and they are needed to diagnose it.",
|
|
1037
|
+
"Keep output concise and automation-oriented. Prefer the final command result or a short failure summary over status narration."
|
|
1038
|
+
].join("\n\n");
|
|
1039
|
+
}
|
|
997
1040
|
function buildHeartbeatCollaborationInstructions() {
|
|
998
1041
|
return [
|
|
999
1042
|
"This is an OpenClaw heartbeat turn. Apply these instructions only to this heartbeat wake; ordinary chat turns should stay in Codex Default mode.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
2
|
-
import { r as formatCodexDisplayText } from "./command-formatters-
|
|
2
|
+
import { r as formatCodexDisplayText } from "./command-formatters-DRJaVHhN.js";
|
|
3
3
|
import { callGatewayTool, embeddedAgentLog, formatApprovalDisplayPath } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
4
|
//#region extensions/codex/src/app-server/plugin-approval-roundtrip.ts
|
|
5
5
|
const DEFAULT_CODEX_APPROVAL_TIMEOUT_MS = 12e4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.14-beta.2",
|
|
4
4
|
"description": "OpenClaw Codex harness and model provider plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@earendil-works/pi-coding-agent": "0.74.0",
|
|
12
12
|
"@openai/codex": "0.130.0",
|
|
13
13
|
"ajv": "8.20.0",
|
|
14
|
-
"ws": "8.20.
|
|
14
|
+
"ws": "8.20.1",
|
|
15
15
|
"zod": "4.4.3"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"minHostVersion": ">=2026.5.1-beta.1"
|
|
28
28
|
},
|
|
29
29
|
"compat": {
|
|
30
|
-
"pluginApi": ">=2026.5.
|
|
30
|
+
"pluginApi": ">=2026.5.14-beta.2"
|
|
31
31
|
},
|
|
32
32
|
"build": {
|
|
33
|
-
"openclawVersion": "2026.5.
|
|
33
|
+
"openclawVersion": "2026.5.14-beta.2"
|
|
34
34
|
},
|
|
35
35
|
"release": {
|
|
36
36
|
"publishToClawHub": true,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"openclaw.plugin.json"
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"openclaw": ">=2026.5.
|
|
48
|
+
"openclaw": ">=2026.5.14-beta.2"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"openclaw": {
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
-
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-Cr6W-a2G.js").then((n) => n.i).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
3
|
-
startOptions,
|
|
4
|
-
authProfileId,
|
|
5
|
-
agentDir,
|
|
6
|
-
config
|
|
7
|
-
}));
|
|
8
|
-
function createCodexAppServerClientFactoryTestHooks(setFactory) {
|
|
9
|
-
return {
|
|
10
|
-
setCodexAppServerClientFactoryForTests(factory) {
|
|
11
|
-
setFactory(factory);
|
|
12
|
-
},
|
|
13
|
-
resetCodexAppServerClientFactoryForTests() {
|
|
14
|
-
setFactory(defaultCodexAppServerClientFactory);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { defaultCodexAppServerClientFactory as n, createCodexAppServerClientFactoryTestHooks as t };
|
package/dist/request-ohCy5ASa.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { n as CodexAppServerRpcError } from "./client-iRf11BEu.js";
|
|
2
|
-
import { a as withTimeout, n as createIsolatedCodexAppServerClient, r as getSharedCodexAppServerClient } from "./shared-client-Cr6W-a2G.js";
|
|
3
|
-
//#region extensions/codex/src/app-server/capabilities.ts
|
|
4
|
-
const CODEX_CONTROL_METHODS = {
|
|
5
|
-
account: "account/read",
|
|
6
|
-
compact: "thread/compact/start",
|
|
7
|
-
feedback: "feedback/upload",
|
|
8
|
-
listMcpServers: "mcpServerStatus/list",
|
|
9
|
-
listSkills: "skills/list",
|
|
10
|
-
listThreads: "thread/list",
|
|
11
|
-
rateLimits: "account/rateLimits/read",
|
|
12
|
-
resumeThread: "thread/resume",
|
|
13
|
-
review: "review/start"
|
|
14
|
-
};
|
|
15
|
-
function describeControlFailure(error) {
|
|
16
|
-
if (isUnsupportedControlError(error)) return "unsupported by this Codex app-server";
|
|
17
|
-
return error instanceof Error ? error.message : String(error);
|
|
18
|
-
}
|
|
19
|
-
function isUnsupportedControlError(error) {
|
|
20
|
-
return error instanceof CodexAppServerRpcError && error.code === -32601;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region extensions/codex/src/app-server/request.ts
|
|
24
|
-
async function requestCodexAppServerJson(params) {
|
|
25
|
-
const timeoutMs = params.timeoutMs ?? 6e4;
|
|
26
|
-
return await withTimeout((async () => {
|
|
27
|
-
const client = await (params.isolated ? createIsolatedCodexAppServerClient : getSharedCodexAppServerClient)({
|
|
28
|
-
startOptions: params.startOptions,
|
|
29
|
-
timeoutMs,
|
|
30
|
-
authProfileId: params.authProfileId,
|
|
31
|
-
agentDir: params.agentDir,
|
|
32
|
-
config: params.config
|
|
33
|
-
});
|
|
34
|
-
try {
|
|
35
|
-
return await client.request(params.method, params.requestParams, { timeoutMs });
|
|
36
|
-
} finally {
|
|
37
|
-
if (params.isolated) await client.closeAndWait({
|
|
38
|
-
exitTimeoutMs: 2e3,
|
|
39
|
-
forceKillDelayMs: 250
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
})(), timeoutMs, `codex app-server ${params.method} timed out`);
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
export { CODEX_CONTROL_METHODS as n, describeControlFailure as r, requestCodexAppServerJson as t };
|
|
File without changes
|