@openclaw/codex 2026.5.4-beta.1 → 2026.5.4-beta.3
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-chGfNrq5.js → client-BGbqC7jk.js} +2 -2
- package/dist/{client-factory-ClSvDfKC.js → client-factory--cll1Fba.js} +1 -1
- package/dist/command-formatters-PiJcdUbu.js +337 -0
- package/dist/{command-handlers-DsknA9lT.js → command-handlers-DiH-D13x.js} +154 -163
- package/dist/{compact-CCKeE8zJ.js → compact-DcR5aTxd.js} +2 -2
- package/dist/{config-CkkoMeqF.js → config-ByrA30No.js} +0 -2
- package/dist/{conversation-binding-LXwwffvV.js → conversation-binding-CtHkMJfG.js} +128 -61
- package/dist/doctor-contract-api.js +19 -0
- package/dist/harness.js +3 -3
- package/dist/index.js +8 -3
- package/dist/media-understanding-provider.js +4 -4
- package/dist/{models-B-1qT9nX.js → models-CkowdYbm.js} +2 -2
- package/dist/{protocol-validators-Cpopom3_.js → protocol-validators-Dky2yV4W.js} +2354 -2258
- package/dist/provider.js +2 -2
- package/dist/{computer-use-DtCrnbLb.js → rate-limit-cache-t6ebYmfS.js} +27 -4
- package/dist/{run-attempt-DdEBxgoj.js → run-attempt-CFL1BFBl.js} +345 -120
- package/dist/{shared-client-B7LbV3PF.js → shared-client-Dfk3Enm-.js} +2 -2
- package/dist/test-api.js +2 -2
- package/dist/{thread-lifecycle-C2MSeIjn.js → thread-lifecycle-CzllX4PU.js} +56 -21
- package/package.json +6 -6
- package/dist/capabilities-BmhO5h8O.js +0 -22
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
1
|
+
import { i as resolveCodexAppServerRuntimeOptions } from "./config-ByrA30No.js";
|
|
2
2
|
import { n as isRpcResponse } from "./protocol-C9UWI98H.js";
|
|
3
|
+
import { createInterface } from "node:readline";
|
|
3
4
|
import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
5
|
import { spawn } from "node:child_process";
|
|
5
6
|
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
6
|
-
import { createInterface } from "node:readline";
|
|
7
7
|
import { EventEmitter } from "node:events";
|
|
8
8
|
import { PassThrough, Writable } from "node:stream";
|
|
9
9
|
import WebSocket from "ws";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
-
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-
|
|
2
|
+
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-Dfk3Enm-.js").then((n) => n.r).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
3
3
|
startOptions,
|
|
4
4
|
authProfileId,
|
|
5
5
|
agentDir,
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
2
|
+
import { n as CodexAppServerRpcError } from "./client-BGbqC7jk.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/rate-limits.ts
|
|
24
|
+
const CODEX_LIMIT_ID = "codex";
|
|
25
|
+
const LIMIT_WINDOW_KEYS = ["primary", "secondary"];
|
|
26
|
+
const ONE_MINUTE_MS = 6e4;
|
|
27
|
+
const ONE_HOUR_MS = 60 * ONE_MINUTE_MS;
|
|
28
|
+
const ONE_DAY_MS = 24 * ONE_HOUR_MS;
|
|
29
|
+
function formatCodexUsageLimitErrorMessage(params) {
|
|
30
|
+
const message = normalizeText(params.message);
|
|
31
|
+
if (!isCodexUsageLimitError(params.codexErrorInfo, message)) return;
|
|
32
|
+
const nowMs = params.nowMs ?? Date.now();
|
|
33
|
+
const nextReset = selectNextRateLimitReset(params.rateLimits, nowMs);
|
|
34
|
+
const parts = ["You've reached your Codex subscription usage limit."];
|
|
35
|
+
if (nextReset) parts.push(`Next reset ${formatResetTime(nextReset.resetsAtMs, nowMs)}.`);
|
|
36
|
+
else parts.push("Codex did not return a reset time for this limit.");
|
|
37
|
+
parts.push("Run /codex account for current usage details.");
|
|
38
|
+
return parts.join(" ");
|
|
39
|
+
}
|
|
40
|
+
function summarizeCodexRateLimits(value, nowMs = Date.now()) {
|
|
41
|
+
const snapshots = collectCodexRateLimitSnapshots(value);
|
|
42
|
+
if (snapshots.length === 0) return;
|
|
43
|
+
return snapshots.slice(0, 4).map((snapshot) => summarizeRateLimitSnapshot(snapshot, nowMs)).join("; ");
|
|
44
|
+
}
|
|
45
|
+
function isCodexUsageLimitError(codexErrorInfo, message) {
|
|
46
|
+
if (codexErrorInfo === "usageLimitExceeded") return true;
|
|
47
|
+
if (typeof codexErrorInfo === "string") {
|
|
48
|
+
if (codexErrorInfo.replace(/[_\s-]/gu, "").toLowerCase() === "usagelimitexceeded") return true;
|
|
49
|
+
}
|
|
50
|
+
return Boolean(message?.toLowerCase().includes("usage limit"));
|
|
51
|
+
}
|
|
52
|
+
function selectNextRateLimitReset(value, nowMs) {
|
|
53
|
+
const futureWindows = collectCodexRateLimitSnapshots(value).flatMap((snapshot) => LIMIT_WINDOW_KEYS.flatMap((key) => readRateLimitWindow(snapshot, key) ?? [])).filter((window) => window.resetsAtMs > nowMs);
|
|
54
|
+
if (futureWindows.length === 0) return;
|
|
55
|
+
const exhaustedWindows = futureWindows.filter((window) => window.usedPercent !== void 0 && window.usedPercent >= 100);
|
|
56
|
+
const candidates = exhaustedWindows.length > 0 ? exhaustedWindows : futureWindows;
|
|
57
|
+
candidates.sort((left, right) => left.resetsAtMs - right.resetsAtMs);
|
|
58
|
+
return candidates[0];
|
|
59
|
+
}
|
|
60
|
+
function summarizeRateLimitSnapshot(snapshot, nowMs) {
|
|
61
|
+
const label = formatLimitLabel(snapshot);
|
|
62
|
+
const windows = LIMIT_WINDOW_KEYS.flatMap((key) => {
|
|
63
|
+
const window = readRateLimitWindow(snapshot, key);
|
|
64
|
+
return window ? [formatRateLimitWindow(key, window, nowMs)] : [];
|
|
65
|
+
});
|
|
66
|
+
const reachedType = readString$1(snapshot, "rateLimitReachedType");
|
|
67
|
+
const suffix = reachedType ? ` (${formatReachedType(reachedType)})` : "";
|
|
68
|
+
return `${label}: ${windows.join(", ") || "available"}${suffix}`;
|
|
69
|
+
}
|
|
70
|
+
function collectCodexRateLimitSnapshots(value) {
|
|
71
|
+
const snapshots = [];
|
|
72
|
+
collectRateLimitSnapshots(value, snapshots, /* @__PURE__ */ new Set());
|
|
73
|
+
return snapshots;
|
|
74
|
+
}
|
|
75
|
+
function collectRateLimitSnapshots(value, snapshots, seen) {
|
|
76
|
+
if (Array.isArray(value)) {
|
|
77
|
+
for (const entry of value) collectRateLimitSnapshots(entry, snapshots, seen);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (!isJsonObject(value)) return;
|
|
81
|
+
if (isRateLimitSnapshot(value)) {
|
|
82
|
+
addRateLimitSnapshot(value, snapshots, seen);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const byLimitId = value.rateLimitsByLimitId;
|
|
86
|
+
if (isJsonObject(byLimitId)) for (const key of sortedRateLimitKeys(Object.keys(byLimitId))) collectRateLimitSnapshots(byLimitId[key], snapshots, seen);
|
|
87
|
+
collectRateLimitSnapshots(value.rateLimits, snapshots, seen);
|
|
88
|
+
collectRateLimitSnapshots(value.data, snapshots, seen);
|
|
89
|
+
collectRateLimitSnapshots(value.items, snapshots, seen);
|
|
90
|
+
}
|
|
91
|
+
function sortedRateLimitKeys(keys) {
|
|
92
|
+
return keys.toSorted((left, right) => {
|
|
93
|
+
if (left === CODEX_LIMIT_ID) return -1;
|
|
94
|
+
if (right === CODEX_LIMIT_ID) return 1;
|
|
95
|
+
return left.localeCompare(right);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function addRateLimitSnapshot(snapshot, snapshots, seen) {
|
|
99
|
+
const signature = [
|
|
100
|
+
readNullableString(snapshot, "limitId") ?? "",
|
|
101
|
+
readNullableString(snapshot, "limitName") ?? "",
|
|
102
|
+
formatWindowSignature(snapshot.primary),
|
|
103
|
+
formatWindowSignature(snapshot.secondary)
|
|
104
|
+
].join("|");
|
|
105
|
+
if (seen.has(signature)) return;
|
|
106
|
+
seen.add(signature);
|
|
107
|
+
snapshots.push(snapshot);
|
|
108
|
+
}
|
|
109
|
+
function isRateLimitSnapshot(value) {
|
|
110
|
+
return isJsonObject(value.primary) || isJsonObject(value.secondary) || value.rateLimitReachedType !== void 0 || value.limitId !== void 0 || value.limitName !== void 0;
|
|
111
|
+
}
|
|
112
|
+
function readRateLimitWindow(snapshot, key) {
|
|
113
|
+
const window = snapshot[key];
|
|
114
|
+
if (!isJsonObject(window)) return;
|
|
115
|
+
const resetsAt = readNumber(window, "resetsAt");
|
|
116
|
+
return {
|
|
117
|
+
...typeof resetsAt === "number" && Number.isFinite(resetsAt) && resetsAt > 0 ? { resetsAtMs: resetsAt * 1e3 } : { resetsAtMs: 0 },
|
|
118
|
+
...readOptionalNumberField(window, "usedPercent")
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function readOptionalNumberField(record, key) {
|
|
122
|
+
const value = readNumber(record, key);
|
|
123
|
+
return value === void 0 ? {} : { usedPercent: value };
|
|
124
|
+
}
|
|
125
|
+
function formatRateLimitWindow(key, window, nowMs) {
|
|
126
|
+
return `${key} ${window.usedPercent === void 0 ? "usage unknown" : `${Math.round(window.usedPercent)}%`}${window.resetsAtMs > nowMs ? `, resets ${formatResetTime(window.resetsAtMs, nowMs)}` : ""}`;
|
|
127
|
+
}
|
|
128
|
+
function formatLimitLabel(snapshot) {
|
|
129
|
+
const label = readNullableString(snapshot, "limitName") ?? readNullableString(snapshot, "limitId");
|
|
130
|
+
if (!label || label === CODEX_LIMIT_ID) return "Codex";
|
|
131
|
+
return label.replace(/[_-]+/gu, " ").replace(/\s+/gu, " ").trim();
|
|
132
|
+
}
|
|
133
|
+
function formatReachedType(value) {
|
|
134
|
+
return value.replace(/[_-]+/gu, " ").replace(/\s+/gu, " ").trim();
|
|
135
|
+
}
|
|
136
|
+
function formatResetTime(resetsAtMs, nowMs) {
|
|
137
|
+
return `in ${formatRelativeDuration(resetsAtMs - nowMs)} (${new Date(resetsAtMs).toISOString()})`;
|
|
138
|
+
}
|
|
139
|
+
function formatRelativeDuration(durationMs) {
|
|
140
|
+
const safeMs = Math.max(1e3, durationMs);
|
|
141
|
+
if (safeMs < ONE_MINUTE_MS) return `${Math.ceil(safeMs / 1e3)} seconds`;
|
|
142
|
+
if (safeMs < ONE_HOUR_MS) {
|
|
143
|
+
const minutes = Math.ceil(safeMs / ONE_MINUTE_MS);
|
|
144
|
+
return `${minutes} ${minutes === 1 ? "minute" : "minutes"}`;
|
|
145
|
+
}
|
|
146
|
+
if (safeMs < ONE_DAY_MS) {
|
|
147
|
+
const hours = Math.ceil(safeMs / ONE_HOUR_MS);
|
|
148
|
+
return `${hours} ${hours === 1 ? "hour" : "hours"}`;
|
|
149
|
+
}
|
|
150
|
+
const days = Math.ceil(safeMs / ONE_DAY_MS);
|
|
151
|
+
return `${days} ${days === 1 ? "day" : "days"}`;
|
|
152
|
+
}
|
|
153
|
+
function formatWindowSignature(value) {
|
|
154
|
+
if (!isJsonObject(value)) return "";
|
|
155
|
+
return `${readNumber(value, "usedPercent") ?? ""}:${readNumber(value, "resetsAt") ?? ""}`;
|
|
156
|
+
}
|
|
157
|
+
function readString$1(record, key) {
|
|
158
|
+
const value = record[key];
|
|
159
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
160
|
+
}
|
|
161
|
+
function readNullableString(record, key) {
|
|
162
|
+
return readString$1(record, key) ?? void 0;
|
|
163
|
+
}
|
|
164
|
+
function readNumber(record, key) {
|
|
165
|
+
const value = record[key];
|
|
166
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
167
|
+
}
|
|
168
|
+
function normalizeText(value) {
|
|
169
|
+
const text = value?.trim();
|
|
170
|
+
return text ? text : void 0;
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region extensions/codex/src/command-formatters.ts
|
|
174
|
+
function formatCodexStatus(probes) {
|
|
175
|
+
const lines = [`Codex app-server: ${probes.models.ok || probes.account.ok || probes.limits.ok || probes.mcps.ok || probes.skills.ok ? "connected" : "unavailable"}`];
|
|
176
|
+
if (probes.models.ok) lines.push(`Models: ${probes.models.value.models.map((model) => formatCodexDisplayText(model.id)).slice(0, 8).join(", ") || "none"}`);
|
|
177
|
+
else lines.push(`Models: ${formatCodexDisplayText(probes.models.error)}`);
|
|
178
|
+
lines.push(`Account: ${probes.account.ok ? formatCodexAccountSummary(probes.account.value) : formatCodexDisplayText(probes.account.error)}`);
|
|
179
|
+
lines.push(`Rate limits: ${probes.limits.ok ? formatCodexRateLimitSummary(probes.limits.value) : formatCodexDisplayText(probes.limits.error)}`);
|
|
180
|
+
lines.push(`MCP servers: ${probes.mcps.ok ? summarizeArrayLike(probes.mcps.value) : formatCodexDisplayText(probes.mcps.error)}`);
|
|
181
|
+
lines.push(`Skills: ${probes.skills.ok ? summarizeArrayLike(probes.skills.value) : formatCodexDisplayText(probes.skills.error)}`);
|
|
182
|
+
return lines.join("\n");
|
|
183
|
+
}
|
|
184
|
+
function formatModels(result) {
|
|
185
|
+
if (result.models.length === 0) return "No Codex app-server models returned.";
|
|
186
|
+
const lines = ["Codex models:", ...result.models.map((model) => `- ${formatCodexDisplayText(model.id)}${model.isDefault ? " (default)" : ""}`)];
|
|
187
|
+
if (result.truncated) lines.push("- More models available; output truncated.");
|
|
188
|
+
return lines.join("\n");
|
|
189
|
+
}
|
|
190
|
+
function formatThreads(response) {
|
|
191
|
+
const threads = extractArray(response);
|
|
192
|
+
if (threads.length === 0) return "No Codex threads returned.";
|
|
193
|
+
return ["Codex threads:", ...threads.slice(0, 10).map((thread) => {
|
|
194
|
+
const record = isJsonObject(thread) ? thread : {};
|
|
195
|
+
const id = readString(record, "threadId") ?? readString(record, "id") ?? "<unknown>";
|
|
196
|
+
const title = readString(record, "title") ?? readString(record, "name") ?? readString(record, "summary");
|
|
197
|
+
const details = [
|
|
198
|
+
readString(record, "model"),
|
|
199
|
+
readString(record, "cwd"),
|
|
200
|
+
readString(record, "updatedAt") ?? readString(record, "lastUpdatedAt")
|
|
201
|
+
].filter((value) => Boolean(value));
|
|
202
|
+
return `- ${formatCodexDisplayText(id)}${title ? ` - ${formatCodexDisplayText(title)}` : ""}${details.length > 0 ? ` (${details.map(formatCodexDisplayText).join(", ")})` : ""}\n Resume: ${formatCodexResumeHint(id)}`;
|
|
203
|
+
})].join("\n");
|
|
204
|
+
}
|
|
205
|
+
function formatAccount(account, limits) {
|
|
206
|
+
return [`Account: ${account.ok ? formatCodexAccountSummary(account.value) : formatCodexDisplayText(account.error)}`, `Rate limits: ${limits.ok ? formatCodexRateLimitSummary(limits.value) : formatCodexDisplayText(limits.error)}`].join("\n");
|
|
207
|
+
}
|
|
208
|
+
function formatComputerUseStatus(status) {
|
|
209
|
+
const lines = [`Computer Use: ${status.ready ? "ready" : status.enabled ? "not ready" : "disabled"}`];
|
|
210
|
+
lines.push(`Plugin: ${formatCodexDisplayText(status.pluginName)} (${computerUsePluginState(status)})`);
|
|
211
|
+
lines.push(`MCP server: ${formatCodexDisplayText(status.mcpServerName)}${status.mcpServerAvailable ? ` (${status.tools.length} tools)` : " (unavailable)"}`);
|
|
212
|
+
if (status.marketplaceName) lines.push(`Marketplace: ${formatCodexDisplayText(status.marketplaceName)}`);
|
|
213
|
+
if (status.tools.length > 0) lines.push(`Tools: ${status.tools.slice(0, 8).map(formatCodexDisplayText).join(", ")}`);
|
|
214
|
+
lines.push(formatCodexDisplayText(status.message));
|
|
215
|
+
return lines.join("\n");
|
|
216
|
+
}
|
|
217
|
+
function computerUsePluginState(status) {
|
|
218
|
+
if (!status.installed) return "not installed";
|
|
219
|
+
return status.pluginEnabled ? "installed" : "installed, disabled";
|
|
220
|
+
}
|
|
221
|
+
function formatList(response, label) {
|
|
222
|
+
const entries = extractArray(response);
|
|
223
|
+
if (entries.length === 0) return `${label}: none returned.`;
|
|
224
|
+
return [`${label}:`, ...entries.slice(0, 25).map((entry) => {
|
|
225
|
+
const record = isJsonObject(entry) ? entry : {};
|
|
226
|
+
return `- ${formatCodexDisplayText(readString(record, "name") ?? readString(record, "id") ?? JSON.stringify(entry))}`;
|
|
227
|
+
})].join("\n");
|
|
228
|
+
}
|
|
229
|
+
const CODEX_RESUME_SAFE_THREAD_ID_PATTERN = /^[A-Za-z0-9._:-]+$/;
|
|
230
|
+
function formatCodexResumeHint(threadId) {
|
|
231
|
+
const safe = formatCodexTextForDisplay(threadId);
|
|
232
|
+
if (!CODEX_RESUME_SAFE_THREAD_ID_PATTERN.test(safe)) return "copy the thread id above and run /codex resume <thread-id>";
|
|
233
|
+
return `/codex resume ${safe}`;
|
|
234
|
+
}
|
|
235
|
+
function formatCodexDisplayText(value) {
|
|
236
|
+
return escapeCodexChatText(formatCodexTextForDisplay(value));
|
|
237
|
+
}
|
|
238
|
+
function formatCodexAccountSummary(value) {
|
|
239
|
+
const safe = formatCodexTextForDisplay(summarizeAccount(value));
|
|
240
|
+
return isLikelyEmailAddress(safe) ? escapeCodexChatTextPreservingAt(safe) : escapeCodexChatText(safe);
|
|
241
|
+
}
|
|
242
|
+
function formatCodexTextForDisplay(value) {
|
|
243
|
+
let safe = "";
|
|
244
|
+
for (const character of value) {
|
|
245
|
+
const codePoint = character.codePointAt(0);
|
|
246
|
+
safe += codePoint != null && isUnsafeDisplayCodePoint(codePoint) ? "?" : character;
|
|
247
|
+
}
|
|
248
|
+
safe = safe.trim();
|
|
249
|
+
return safe || "<unknown>";
|
|
250
|
+
}
|
|
251
|
+
function escapeCodexChatText(value) {
|
|
252
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("@", "@").replaceAll("`", "`").replaceAll("[", "[").replaceAll("]", "]").replaceAll("(", "(").replaceAll(")", ")").replaceAll("*", "∗").replaceAll("_", "_").replaceAll("~", "~").replaceAll("|", "|");
|
|
253
|
+
}
|
|
254
|
+
function escapeCodexChatTextPreservingAt(value) {
|
|
255
|
+
return escapeCodexChatText(value).replaceAll("@", "@");
|
|
256
|
+
}
|
|
257
|
+
function isLikelyEmailAddress(value) {
|
|
258
|
+
return /^[^\s@<>()[\]`]+@[^\s@<>()[\]`]+\.[^\s@<>()[\]`]+$/.test(value);
|
|
259
|
+
}
|
|
260
|
+
function isUnsafeDisplayCodePoint(codePoint) {
|
|
261
|
+
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint === 173 || codePoint === 1564 || codePoint === 6158 || codePoint >= 8203 && codePoint <= 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8288 && codePoint <= 8303 || codePoint === 65279 || codePoint >= 65529 && codePoint <= 65531 || codePoint >= 917504 && codePoint <= 917631;
|
|
262
|
+
}
|
|
263
|
+
function buildHelp() {
|
|
264
|
+
return [
|
|
265
|
+
"Codex commands:",
|
|
266
|
+
"- /codex status",
|
|
267
|
+
"- /codex models",
|
|
268
|
+
"- /codex threads [filter]",
|
|
269
|
+
"- /codex resume <thread-id>",
|
|
270
|
+
"- /codex bind [thread-id] [--cwd <path>] [--model <model>] [--provider <provider>]",
|
|
271
|
+
"- /codex binding",
|
|
272
|
+
"- /codex stop",
|
|
273
|
+
"- /codex steer <message>",
|
|
274
|
+
"- /codex model [model]",
|
|
275
|
+
"- /codex fast [on|off|status]",
|
|
276
|
+
"- /codex permissions [default|yolo|status]",
|
|
277
|
+
"- /codex detach",
|
|
278
|
+
"- /codex compact",
|
|
279
|
+
"- /codex review",
|
|
280
|
+
"- /codex diagnostics [note]",
|
|
281
|
+
"- /codex computer-use [status|install]",
|
|
282
|
+
"- /codex account",
|
|
283
|
+
"- /codex mcp",
|
|
284
|
+
"- /codex skills"
|
|
285
|
+
].join("\n");
|
|
286
|
+
}
|
|
287
|
+
function summarizeAccount(value) {
|
|
288
|
+
if (!isJsonObject(value)) return "unavailable";
|
|
289
|
+
const account = isJsonObject(value.account) ? value.account : value;
|
|
290
|
+
if (readString(account, "type") === "amazonBedrock") return "Amazon Bedrock";
|
|
291
|
+
return readString(account, "email") ?? readString(account, "accountEmail") ?? readString(account, "planType") ?? readString(account, "id") ?? "available";
|
|
292
|
+
}
|
|
293
|
+
function summarizeArrayLike(value) {
|
|
294
|
+
const entries = extractArray(value);
|
|
295
|
+
if (entries.length === 0) return "none returned";
|
|
296
|
+
return `${entries.length}`;
|
|
297
|
+
}
|
|
298
|
+
function formatCodexRateLimitSummary(value) {
|
|
299
|
+
return formatCodexDisplayText(summarizeCodexRateLimits(value) ?? summarizeRateLimits(value));
|
|
300
|
+
}
|
|
301
|
+
function summarizeRateLimits(value) {
|
|
302
|
+
const entries = extractArray(value);
|
|
303
|
+
if (entries.length > 0) return `${entries.length}`;
|
|
304
|
+
if (!isJsonObject(value)) return "none returned";
|
|
305
|
+
const keyed = value.rateLimitsByLimitId;
|
|
306
|
+
if (isJsonObject(keyed)) {
|
|
307
|
+
const count = Object.values(keyed).filter(isMeaningfulRateLimitSnapshot).length;
|
|
308
|
+
if (count > 0) return `${count}`;
|
|
309
|
+
}
|
|
310
|
+
return isMeaningfulRateLimitSnapshot(value.rateLimits) ? "1" : "none returned";
|
|
311
|
+
}
|
|
312
|
+
function isMeaningfulRateLimitSnapshot(value) {
|
|
313
|
+
return isJsonObject(value) && Object.values(value).some((entry) => entry != null);
|
|
314
|
+
}
|
|
315
|
+
function extractArray(value) {
|
|
316
|
+
if (Array.isArray(value)) return value;
|
|
317
|
+
if (!isJsonObject(value)) return [];
|
|
318
|
+
for (const key of [
|
|
319
|
+
"data",
|
|
320
|
+
"items",
|
|
321
|
+
"threads",
|
|
322
|
+
"models",
|
|
323
|
+
"skills",
|
|
324
|
+
"servers",
|
|
325
|
+
"rateLimits"
|
|
326
|
+
]) {
|
|
327
|
+
const child = value[key];
|
|
328
|
+
if (Array.isArray(child)) return child;
|
|
329
|
+
}
|
|
330
|
+
return [];
|
|
331
|
+
}
|
|
332
|
+
function readString(record, key) {
|
|
333
|
+
const value = record[key];
|
|
334
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
335
|
+
}
|
|
336
|
+
//#endregion
|
|
337
|
+
export { formatComputerUseStatus as a, formatThreads as c, CODEX_CONTROL_METHODS as d, describeControlFailure as f, formatCodexStatus as i, readString as l, formatAccount as n, formatList as o, formatCodexDisplayText as r, formatModels as s, buildHelp as t, formatCodexUsageLimitErrorMessage as u };
|