@openclaw/codex 2026.5.28 → 2026.5.31-beta.1
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-DMXvboVu.js → client-BnOmn0y-.js} +20 -6
- package/dist/client-factory-B8dh39UW.js +20 -0
- package/dist/{command-handlers-C2t6-ChO.js → command-handlers-BsK6kZJi.js} +265 -16
- package/dist/{compact-Dlnt5G3v.js → compact-BXLjhUHX.js} +4 -4
- package/dist/{computer-use-Ba4vW9fO.js → computer-use-D-0EFJBJ.js} +3 -4
- package/dist/{config--tW89bHH.js → config-AlzuNKCY.js} +14 -5
- package/dist/{conversation-binding-CC9XMAwn.js → conversation-binding-KUDxop-C.js} +69 -92
- package/dist/doctor-contract-api.js +1 -1
- package/dist/harness.js +6 -10
- package/dist/index.js +23 -60
- package/dist/media-understanding-provider.js +8 -9
- package/dist/{models-QT-XOhE7.js → models-mbjSisZL.js} +2 -2
- package/dist/{native-hook-relay-B8qM8ZwR.js → native-hook-relay-DCxPRaBN.js} +77 -9
- package/dist/{notification-correlation-BDakP_d3.js → notification-correlation-BykOI_jh.js} +3 -3
- package/dist/{protocol-validators-DtjYmUw_.js → protocol-validators-DIt7cXIp.js} +2 -2
- package/dist/provider-catalog.js +2 -2
- package/dist/provider.js +2 -2
- package/dist/{request-CF4f5hWY.js → request-DuFgTwRU.js} +4 -4
- package/dist/{run-attempt-CuhGEh0u.js → run-attempt-CgaY9r5u.js} +579 -288
- package/dist/{sandbox-guard-mXE4_vE_.js → sandbox-guard-DMCJlzmz.js} +4 -1
- package/dist/{session-binding-ueMCn4om.js → session-binding-BXJAV_xy.js} +27 -10
- package/dist/{shared-client-Duh1bHaP.js → shared-client-DBlR-rV2.js} +33 -4
- package/dist/{side-question-B-Cjb9wm.js → side-question-SjBLGANT.js} +10 -10
- package/dist/{thread-lifecycle-Dv9Npl7a.js → thread-lifecycle-Bnlv_Q8u.js} +78 -120
- package/npm-shrinkwrap.json +34 -34
- package/openclaw.plugin.json +5 -4
- package/package.json +6 -6
- package/dist/client-factory-qZvhyyXr.js +0 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as resolveCodexAppServerRuntimeOptions } from "./config-AlzuNKCY.js";
|
|
2
2
|
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
3
3
|
import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
4
|
import { createInterface } from "node:readline";
|
|
@@ -120,11 +120,18 @@ function createWebSocketTransport(options) {
|
|
|
120
120
|
const text = websocketFrameToText(data);
|
|
121
121
|
stdout.write(text.endsWith("\n") ? text : `${text}\n`);
|
|
122
122
|
});
|
|
123
|
+
const stdin = new Writable({ write(chunk, _encoding, callback) {
|
|
124
|
+
for (const frame of chunk.toString("utf8").split("\n")) sendFrame(frame);
|
|
125
|
+
callback();
|
|
126
|
+
} });
|
|
127
|
+
const closeSocket = () => {
|
|
128
|
+
if (socket.readyState === WebSocket.CLOSED || socket.readyState === WebSocket.CLOSING) return;
|
|
129
|
+
socket.close();
|
|
130
|
+
};
|
|
131
|
+
stdin.once("finish", closeSocket);
|
|
132
|
+
stdin.once("close", closeSocket);
|
|
123
133
|
return {
|
|
124
|
-
stdin
|
|
125
|
-
for (const frame of chunk.toString("utf8").split("\n")) sendFrame(frame);
|
|
126
|
-
callback();
|
|
127
|
-
} }),
|
|
134
|
+
stdin,
|
|
128
135
|
stdout,
|
|
129
136
|
stderr,
|
|
130
137
|
get killed() {
|
|
@@ -294,7 +301,8 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
294
301
|
getServerVersion() {
|
|
295
302
|
return this.serverVersion;
|
|
296
303
|
}
|
|
297
|
-
request(method, params,
|
|
304
|
+
request(method, params, optionsInput) {
|
|
305
|
+
let options = optionsInput;
|
|
298
306
|
options ??= {};
|
|
299
307
|
if (this.closed) return Promise.reject(this.closeError ?? /* @__PURE__ */ new Error("codex app-server client is closed"));
|
|
300
308
|
if (options.signal?.aborted) return Promise.reject(/* @__PURE__ */ new Error(`${method} aborted`));
|
|
@@ -367,6 +375,12 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
367
375
|
this.notificationHandlers.add(handler);
|
|
368
376
|
return () => this.notificationHandlers.delete(handler);
|
|
369
377
|
}
|
|
378
|
+
setActiveSharedLeaseCountProviderForUnscopedNotifications(provider) {
|
|
379
|
+
this.activeSharedLeaseCountProvider = provider;
|
|
380
|
+
}
|
|
381
|
+
getActiveSharedLeaseCountForUnscopedNotifications() {
|
|
382
|
+
return this.activeSharedLeaseCountProvider?.();
|
|
383
|
+
}
|
|
370
384
|
addCloseHandler(handler) {
|
|
371
385
|
this.closeHandlers.add(handler);
|
|
372
386
|
return () => this.closeHandlers.delete(handler);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
+
let sharedClientModulePromise = null;
|
|
3
|
+
const loadSharedClientModule = async () => {
|
|
4
|
+
sharedClientModulePromise ??= import("./shared-client-DBlR-rV2.js").then((n) => n.s);
|
|
5
|
+
return await sharedClientModulePromise;
|
|
6
|
+
};
|
|
7
|
+
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => loadSharedClientModule().then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
8
|
+
startOptions,
|
|
9
|
+
authProfileId,
|
|
10
|
+
agentDir,
|
|
11
|
+
config
|
|
12
|
+
}));
|
|
13
|
+
const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => loadSharedClientModule().then(({ getLeasedSharedCodexAppServerClient }) => getLeasedSharedCodexAppServerClient({
|
|
14
|
+
startOptions,
|
|
15
|
+
authProfileId,
|
|
16
|
+
agentDir,
|
|
17
|
+
config
|
|
18
|
+
}));
|
|
19
|
+
//#endregion
|
|
20
|
+
export { defaultLeasedCodexAppServerClientFactory as n, defaultCodexAppServerClientFactory as t };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
3
|
-
import { l as isJsonObject } from "./client-
|
|
4
|
-
import {
|
|
5
|
-
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-
|
|
6
|
-
import { a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatSkills, l as formatComputerUseStatus, m as readString$1, o as formatAccount, p as formatThreads, s as formatCodexDisplayText, u as formatList, v as summarizeCodexAccountUsage } from "./notification-correlation-
|
|
7
|
-
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-
|
|
8
|
-
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-
|
|
9
|
-
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-
|
|
1
|
+
import { d as resolveCodexAppServerRuntimeOptions, o as isCodexFastServiceTier } from "./config-AlzuNKCY.js";
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-mbjSisZL.js";
|
|
3
|
+
import { l as isJsonObject } from "./client-BnOmn0y-.js";
|
|
4
|
+
import { a as readCodexAppServerBinding, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
|
|
5
|
+
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-DuFgTwRU.js";
|
|
6
|
+
import { a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatSkills, l as formatComputerUseStatus, m as readString$1, o as formatAccount, p as formatThreads, s as formatCodexDisplayText, u as formatList, v as summarizeCodexAccountUsage } from "./notification-correlation-BykOI_jh.js";
|
|
7
|
+
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-DMCJlzmz.js";
|
|
8
|
+
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-KUDxop-C.js";
|
|
9
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-D-0EFJBJ.js";
|
|
10
10
|
import { n as rememberCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
11
|
+
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
11
12
|
import crypto from "node:crypto";
|
|
12
13
|
import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
13
14
|
import { ensureAuthProfileStore, findNormalizedProviderValue, resolveAgentDir, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveDefaultAgentDir, resolveProfileUnusableUntilForDisplay, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-runtime";
|
|
14
|
-
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
15
15
|
//#region extensions/codex/src/command-account.ts
|
|
16
16
|
const OPENAI_PROVIDER_ID = "openai";
|
|
17
|
-
const OPENAI_CODEX_PROVIDER_ID =
|
|
17
|
+
const OPENAI_CODEX_PROVIDER_ID = OPENAI_PROVIDER_ID;
|
|
18
18
|
async function readCodexAccountAuthOverview(params) {
|
|
19
19
|
const config = params.ctx.config;
|
|
20
20
|
const store = ensureAuthProfileStore(resolveDefaultAgentDir(config), {
|
|
@@ -115,7 +115,7 @@ function resolveActiveProfileId(params) {
|
|
|
115
115
|
profileId,
|
|
116
116
|
now: params.now
|
|
117
117
|
}).eligible);
|
|
118
|
-
const lastGood = [params.store.lastGood?.[OPENAI_PROVIDER_ID], params.store.lastGood?.[OPENAI_CODEX_PROVIDER_ID]].find((profileId) =>
|
|
118
|
+
const lastGood = [params.store.lastGood?.[OPENAI_PROVIDER_ID], params.store.lastGood?.[OPENAI_CODEX_PROVIDER_ID]].find((profileId) => typeof profileId === "string" && params.order.includes(profileId) && isActiveProfileCandidate(params, profileId));
|
|
119
119
|
if (lastGood) return lastGood;
|
|
120
120
|
const mostRecent = params.order.map((profileId) => ({
|
|
121
121
|
profileId,
|
|
@@ -307,9 +307,32 @@ function formatRelativeReset(untilMs, nowMs) {
|
|
|
307
307
|
//#endregion
|
|
308
308
|
//#region extensions/codex/src/command-plugins-management.ts
|
|
309
309
|
const POLICY_REFRESH_HINT = "New Codex conversations pick this up automatically. Use /new or /reset to refresh the current one.";
|
|
310
|
+
function buildPickerPresentation$1(title, prompt, buttons) {
|
|
311
|
+
return {
|
|
312
|
+
title,
|
|
313
|
+
blocks: [{
|
|
314
|
+
type: "text",
|
|
315
|
+
text: prompt
|
|
316
|
+
}, {
|
|
317
|
+
type: "buttons",
|
|
318
|
+
buttons: buttons.map((button) => ({
|
|
319
|
+
label: button.label,
|
|
320
|
+
value: button.command
|
|
321
|
+
}))
|
|
322
|
+
}]
|
|
323
|
+
};
|
|
324
|
+
}
|
|
310
325
|
async function handleCodexPluginsSubcommand(ctx, rest, io) {
|
|
311
326
|
const [verb = "list", ...args] = rest;
|
|
312
327
|
const normalized = verb.toLowerCase();
|
|
328
|
+
if (normalized === "menu") {
|
|
329
|
+
if (args.length > 0) return { text: "Usage: /codex plugins menu" };
|
|
330
|
+
return buildPluginsMenuReply();
|
|
331
|
+
}
|
|
332
|
+
if (normalized === "help") {
|
|
333
|
+
if (args.length > 0) return { text: "Usage: /codex plugins help" };
|
|
334
|
+
return { text: buildPluginsHelp() };
|
|
335
|
+
}
|
|
313
336
|
if (normalized === "list") {
|
|
314
337
|
if (args.length > 0) return { text: "Usage: /codex plugins list" };
|
|
315
338
|
const current = await io.readConfig();
|
|
@@ -317,6 +340,7 @@ async function handleCodexPluginsSubcommand(ctx, rest, io) {
|
|
|
317
340
|
}
|
|
318
341
|
const target = args[0];
|
|
319
342
|
if (normalized === "enable" || normalized === "disable") {
|
|
343
|
+
if (args.length === 0) return buildPluginNamePickerReply(normalized, await io.readConfig());
|
|
320
344
|
if (!target || args.length > 1) return { text: `Usage: /codex plugins ${normalized} <name>` };
|
|
321
345
|
if (!canMutateCodexPlugins(ctx)) return { text: `Only an owner or operator.admin gateway client can run /codex plugins ${normalized}.` };
|
|
322
346
|
const wantEnabled = normalized === "enable";
|
|
@@ -333,6 +357,82 @@ async function handleCodexPluginsSubcommand(ctx, rest, io) {
|
|
|
333
357
|
}
|
|
334
358
|
return { text: `Unknown /codex plugins subcommand: ${formatCodexDisplayText(verb)}\n\n${buildPluginsHelp()}` };
|
|
335
359
|
}
|
|
360
|
+
function buildPluginsMenuReply() {
|
|
361
|
+
return {
|
|
362
|
+
text: [
|
|
363
|
+
"Codex sub-plugins. Pick a sub-action or type:",
|
|
364
|
+
"",
|
|
365
|
+
" 1. /codex plugins list",
|
|
366
|
+
" 2. /codex plugins enable",
|
|
367
|
+
" 3. /codex plugins disable",
|
|
368
|
+
" 4. /codex plugins help",
|
|
369
|
+
"",
|
|
370
|
+
"Type '/codex' to go back to the main menu."
|
|
371
|
+
].join("\n"),
|
|
372
|
+
presentation: buildPickerPresentation$1("Codex sub-plugins", "Pick a Codex sub-plugin action:", [
|
|
373
|
+
{
|
|
374
|
+
label: "list",
|
|
375
|
+
command: "/codex plugins list"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
label: "enable",
|
|
379
|
+
command: "/codex plugins enable"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
label: "disable",
|
|
383
|
+
command: "/codex plugins disable"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
label: "help",
|
|
387
|
+
command: "/codex plugins help"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
label: "back",
|
|
391
|
+
command: "/codex"
|
|
392
|
+
}
|
|
393
|
+
])
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
function buildPluginNamePickerReply(verb, current) {
|
|
397
|
+
const globalEnabled = current.enabled === true;
|
|
398
|
+
const eligible = Object.entries(current.plugins ?? {}).toSorted(([left], [right]) => left.localeCompare(right)).filter(([, entry]) => {
|
|
399
|
+
const effectivelyEnabled = globalEnabled && entry.enabled !== false;
|
|
400
|
+
return verb === "disable" ? effectivelyEnabled : !effectivelyEnabled;
|
|
401
|
+
});
|
|
402
|
+
if (eligible.length === 0) return {
|
|
403
|
+
text: [
|
|
404
|
+
`No configured ${verb === "enable" ? "disabled" : "enabled"} Codex sub-plugins found.`,
|
|
405
|
+
"",
|
|
406
|
+
"Type '/codex plugins list' to inspect configured sub-plugins.",
|
|
407
|
+
"Type '/codex plugins menu' to go back to the plugins menu."
|
|
408
|
+
].join("\n"),
|
|
409
|
+
presentation: buildPickerPresentation$1("Codex sub-plugins", "Pick another Codex sub-plugin action:", [{
|
|
410
|
+
label: "list",
|
|
411
|
+
command: "/codex plugins list"
|
|
412
|
+
}, {
|
|
413
|
+
label: "back",
|
|
414
|
+
command: "/codex plugins menu"
|
|
415
|
+
}])
|
|
416
|
+
};
|
|
417
|
+
const buttons = [...eligible.map(([key]) => ({
|
|
418
|
+
label: formatCodexDisplayText(key),
|
|
419
|
+
command: `/codex plugins ${verb} ${key}`
|
|
420
|
+
})), {
|
|
421
|
+
label: "back",
|
|
422
|
+
command: "/codex plugins menu"
|
|
423
|
+
}];
|
|
424
|
+
return {
|
|
425
|
+
text: [
|
|
426
|
+
`Codex sub-plugins to ${verb}. Pick one or type:`,
|
|
427
|
+
"",
|
|
428
|
+
...eligible.map(([key], index) => ` ${index + 1}. /codex plugins ${verb} ${key}`),
|
|
429
|
+
"",
|
|
430
|
+
...verb === "enable" && !globalEnabled ? ["Global codexPlugins.enabled is off; enabling one configured sub-plugin turns it on.", ""] : [],
|
|
431
|
+
"Type '/codex plugins menu' to go back to the plugins menu."
|
|
432
|
+
].join("\n"),
|
|
433
|
+
presentation: buildPickerPresentation$1("Codex sub-plugins", `Pick a Codex sub-plugin to ${verb}:`, buttons)
|
|
434
|
+
};
|
|
435
|
+
}
|
|
336
436
|
function canMutateCodexPlugins(ctx) {
|
|
337
437
|
if (ctx.senderIsOwner === true) return true;
|
|
338
438
|
return ctx.gatewayClientScopes?.includes("operator.admin") === true;
|
|
@@ -485,12 +585,152 @@ const lastCodexDiagnosticsUploadByThread = /* @__PURE__ */ new Map();
|
|
|
485
585
|
const lastCodexDiagnosticsUploadByScope = /* @__PURE__ */ new Map();
|
|
486
586
|
const pendingCodexDiagnosticsConfirmations = /* @__PURE__ */ new Map();
|
|
487
587
|
const pendingCodexDiagnosticsConfirmationTokensByScope = /* @__PURE__ */ new Map();
|
|
588
|
+
function buildPickerPresentation(title, prompt, buttons) {
|
|
589
|
+
return {
|
|
590
|
+
title,
|
|
591
|
+
blocks: [{
|
|
592
|
+
type: "text",
|
|
593
|
+
text: prompt
|
|
594
|
+
}, {
|
|
595
|
+
type: "buttons",
|
|
596
|
+
buttons: buttons.map((button) => ({
|
|
597
|
+
label: button.label,
|
|
598
|
+
value: button.command
|
|
599
|
+
}))
|
|
600
|
+
}]
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* No-arg `/codex` picker. Core owns the native command tree; channels render
|
|
605
|
+
* the portable buttons as inline controls when their transport can.
|
|
606
|
+
*/
|
|
607
|
+
function buildCodexSubcommandPickerReply() {
|
|
608
|
+
const verbs = [
|
|
609
|
+
{
|
|
610
|
+
label: "plugins",
|
|
611
|
+
command: "/codex plugins menu"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
label: "permissions",
|
|
615
|
+
command: "/codex permissions menu"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
label: "fast",
|
|
619
|
+
command: "/codex fast menu"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
label: "computer-use",
|
|
623
|
+
command: "/codex computer-use menu"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
label: "account",
|
|
627
|
+
command: "/codex account"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
label: "help",
|
|
631
|
+
command: "/codex help"
|
|
632
|
+
}
|
|
633
|
+
];
|
|
634
|
+
return {
|
|
635
|
+
text: [
|
|
636
|
+
"Codex commands. Pick a category or type:",
|
|
637
|
+
"",
|
|
638
|
+
...verbs.map((v, i) => ` ${i + 1}. ${v.command}`),
|
|
639
|
+
"",
|
|
640
|
+
"Tap 'help' (or type /codex help) for the full list of typeable verbs",
|
|
641
|
+
"including threads, mcp, binding, detach, skills, resume, bind, steer,",
|
|
642
|
+
"model, diagnostics, compact, review, computer-use.",
|
|
643
|
+
"",
|
|
644
|
+
"Top-level shortcuts cover everyday operations: /status, /fast, /help, /stop, /models."
|
|
645
|
+
].join("\n"),
|
|
646
|
+
presentation: buildPickerPresentation("Codex commands", "Pick a Codex subcommand:", verbs)
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
/** Sub-picker for `/codex fast menu` (on / off / status). */
|
|
650
|
+
function buildCodexFastMenuReply() {
|
|
651
|
+
const modes = [
|
|
652
|
+
"on",
|
|
653
|
+
"off",
|
|
654
|
+
"status"
|
|
655
|
+
];
|
|
656
|
+
const buttons = [...modes.map((mode) => ({
|
|
657
|
+
label: mode,
|
|
658
|
+
command: `/codex fast ${mode}`
|
|
659
|
+
})), {
|
|
660
|
+
label: "back",
|
|
661
|
+
command: "/codex"
|
|
662
|
+
}];
|
|
663
|
+
return {
|
|
664
|
+
text: [
|
|
665
|
+
"Codex fast mode. Pick one or type /codex fast <mode>:",
|
|
666
|
+
"",
|
|
667
|
+
...modes.map((m, i) => ` ${i + 1}. /codex fast ${m}`),
|
|
668
|
+
"",
|
|
669
|
+
"Type '/codex' to go back to the main menu."
|
|
670
|
+
].join("\n"),
|
|
671
|
+
presentation: buildPickerPresentation("Codex fast mode", "Pick a Codex fast mode:", buttons)
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
/** Sub-picker for `/codex permissions menu` (default / yolo / status). */
|
|
675
|
+
function buildCodexPermissionsMenuReply() {
|
|
676
|
+
const modes = [
|
|
677
|
+
"default",
|
|
678
|
+
"yolo",
|
|
679
|
+
"status"
|
|
680
|
+
];
|
|
681
|
+
const buttons = [...modes.map((mode) => ({
|
|
682
|
+
label: mode,
|
|
683
|
+
command: `/codex permissions ${mode}`
|
|
684
|
+
})), {
|
|
685
|
+
label: "back",
|
|
686
|
+
command: "/codex"
|
|
687
|
+
}];
|
|
688
|
+
return {
|
|
689
|
+
text: [
|
|
690
|
+
"Codex permissions. Pick one or type /codex permissions <mode>:",
|
|
691
|
+
"",
|
|
692
|
+
...modes.map((m, i) => ` ${i + 1}. /codex permissions ${m}`),
|
|
693
|
+
"",
|
|
694
|
+
"Type '/codex' to go back to the main menu."
|
|
695
|
+
].join("\n"),
|
|
696
|
+
presentation: buildPickerPresentation("Codex permissions", "Pick a Codex permissions mode:", buttons)
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
/** Sub-picker for `/codex computer-use menu` (status / install). */
|
|
700
|
+
function buildCodexComputerUseMenuReply() {
|
|
701
|
+
const actions = ["status", "install"];
|
|
702
|
+
const buttons = [...actions.map((action) => ({
|
|
703
|
+
label: action,
|
|
704
|
+
command: `/codex computer-use ${action}`
|
|
705
|
+
})), {
|
|
706
|
+
label: "back",
|
|
707
|
+
command: "/codex"
|
|
708
|
+
}];
|
|
709
|
+
return {
|
|
710
|
+
text: [
|
|
711
|
+
"Codex computer-use. Pick one or type /codex computer-use <action>:",
|
|
712
|
+
"",
|
|
713
|
+
...actions.map((a, i) => ` ${i + 1}. /codex computer-use ${a}`),
|
|
714
|
+
"",
|
|
715
|
+
"Flag-driven invocations (--source, --marketplace-path, --marketplace) are not in the picker. Type '/codex computer-use' or read '/codex help' for the full surface.",
|
|
716
|
+
"",
|
|
717
|
+
"Type '/codex' to go back to the main menu."
|
|
718
|
+
].join("\n"),
|
|
719
|
+
presentation: buildPickerPresentation("Codex computer-use", "Pick a Codex computer-use action:", buttons)
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
/** Returns true when the rest-args are exactly `["menu"]` (case-insensitive). */
|
|
723
|
+
function isMenuVerb(rest) {
|
|
724
|
+
return rest.length === 1 && (rest[0] ?? "").trim().toLowerCase() === "menu";
|
|
725
|
+
}
|
|
488
726
|
async function handleCodexSubcommand(ctx, options) {
|
|
489
727
|
const deps = {
|
|
490
728
|
...defaultCodexCommandDeps,
|
|
491
729
|
...options.deps
|
|
492
730
|
};
|
|
493
|
-
const
|
|
731
|
+
const args = splitArgs(ctx.args);
|
|
732
|
+
if (args.length === 0) return buildCodexSubcommandPickerReply();
|
|
733
|
+
const [subcommand = "status", ...rest] = args;
|
|
494
734
|
const normalized = subcommand.toLowerCase();
|
|
495
735
|
if (normalized === "help") return { text: buildHelp() };
|
|
496
736
|
const sandboxBlock = resolveCodexNativeCommandSandboxBlock(ctx, normalized, rest);
|
|
@@ -525,12 +765,21 @@ async function handleCodexSubcommand(ctx, options) {
|
|
|
525
765
|
}
|
|
526
766
|
if (normalized === "steer") return { text: await steerConversationTurn(deps, ctx, options.pluginConfig, rest.join(" ")) };
|
|
527
767
|
if (normalized === "model") return { text: await setConversationModel(deps, ctx, options.pluginConfig, rest) };
|
|
528
|
-
if (normalized === "fast")
|
|
529
|
-
|
|
768
|
+
if (normalized === "fast") {
|
|
769
|
+
if (isMenuVerb(rest)) return buildCodexFastMenuReply();
|
|
770
|
+
return { text: await setConversationFastMode(deps, ctx, options.pluginConfig, rest) };
|
|
771
|
+
}
|
|
772
|
+
if (normalized === "permissions") {
|
|
773
|
+
if (isMenuVerb(rest)) return buildCodexPermissionsMenuReply();
|
|
774
|
+
return { text: await setConversationPermissions(deps, ctx, options.pluginConfig, rest) };
|
|
775
|
+
}
|
|
530
776
|
if (normalized === "compact") return { text: await startThreadAction(deps, ctx, options.pluginConfig, CODEX_CONTROL_METHODS.compact, "compaction", rest) };
|
|
531
777
|
if (normalized === "review") return { text: await startThreadAction(deps, ctx, options.pluginConfig, CODEX_CONTROL_METHODS.review, "review", rest) };
|
|
532
778
|
if (normalized === "diagnostics") return await handleCodexDiagnosticsFeedback(deps, ctx, options.pluginConfig, rest.join(" "), "/codex diagnostics");
|
|
533
|
-
if (normalized === "computer-use" || normalized === "computeruse")
|
|
779
|
+
if (normalized === "computer-use" || normalized === "computeruse") {
|
|
780
|
+
if (isMenuVerb(rest)) return buildCodexComputerUseMenuReply();
|
|
781
|
+
return { text: await handleComputerUseCommand(deps, options.pluginConfig, rest) };
|
|
782
|
+
}
|
|
534
783
|
if (normalized === "mcp") {
|
|
535
784
|
if (rest.length > 0) return { text: "Usage: /codex mcp" };
|
|
536
785
|
return { text: formatList(await deps.codexControlRequest(options.pluginConfig, CODEX_CONTROL_METHODS.listMcpServers, { limit: 100 }), "MCP servers") };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { d as resolveCodexAppServerRuntimeOptions } from "./config-AlzuNKCY.js";
|
|
2
|
+
import { a as readCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
|
|
3
|
+
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-DMCJlzmz.js";
|
|
4
|
+
import { t as defaultCodexAppServerClientFactory } from "./client-factory-B8dh39UW.js";
|
|
5
5
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/compact.ts
|
|
7
7
|
const warnedIgnoredCompactionOverrides = /* @__PURE__ */ new Set();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-
|
|
1
|
+
import { d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig } from "./config-AlzuNKCY.js";
|
|
2
|
+
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-DuFgTwRU.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
//#region extensions/codex/src/app-server/computer-use.ts
|
|
5
5
|
var CodexComputerUseSetupError = class extends Error {
|
|
@@ -237,13 +237,12 @@ function marketplaceDiscoveryWaitUntil(params) {
|
|
|
237
237
|
async function delay(ms, signal) {
|
|
238
238
|
if (signal?.aborted) throw abortError(signal);
|
|
239
239
|
await new Promise((resolve, reject) => {
|
|
240
|
-
let timer;
|
|
241
240
|
const onAbort = () => {
|
|
242
241
|
clearTimeout(timer);
|
|
243
242
|
signal?.removeEventListener("abort", onAbort);
|
|
244
243
|
reject(abortError(signal));
|
|
245
244
|
};
|
|
246
|
-
timer = setTimeout(() => {
|
|
245
|
+
const timer = setTimeout(() => {
|
|
247
246
|
signal?.removeEventListener("abort", onAbort);
|
|
248
247
|
resolve();
|
|
249
248
|
}, ms);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolvePositiveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
1
2
|
import { createHmac, randomBytes } from "node:crypto";
|
|
2
3
|
import { readFileSync } from "node:fs";
|
|
3
4
|
import { hostname } from "node:os";
|
|
@@ -12,7 +13,15 @@ const START_OPTIONS_KEY_SECRET = getStartOptionsKeySecret();
|
|
|
12
13
|
const UNIX_CODEX_REQUIREMENTS_PATH = "/etc/codex/requirements.toml";
|
|
13
14
|
const WINDOWS_CODEX_REQUIREMENTS_SUFFIX = "\\OpenAI\\Codex\\requirements.toml";
|
|
14
15
|
const PLAIN_DECIMAL_NUMBER_RE = /^[+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))$/;
|
|
16
|
+
const CODEX_PLUGINS_MARKETPLACE_NAMES = [
|
|
17
|
+
"openai-curated",
|
|
18
|
+
"openai-bundled",
|
|
19
|
+
"openai-primary-runtime"
|
|
20
|
+
];
|
|
15
21
|
const CODEX_PLUGINS_MARKETPLACE_NAME = "openai-curated";
|
|
22
|
+
function isCodexPluginsMarketplaceName(name) {
|
|
23
|
+
return name !== void 0 && CODEX_PLUGINS_MARKETPLACE_NAMES.includes(name);
|
|
24
|
+
}
|
|
16
25
|
function shouldAutoApproveCodexAppServerApprovals(appServer) {
|
|
17
26
|
return appServer.approvalPolicy === "never" && appServer.sandbox === "danger-full-access";
|
|
18
27
|
}
|
|
@@ -42,7 +51,7 @@ const codexAppServerServiceTierSchema = z.preprocess((value) => value === null ?
|
|
|
42
51
|
const codexAppServerExperimentalSchema = z.object({ sandboxExecServer: z.boolean().optional() }).strict();
|
|
43
52
|
const codexPluginEntryConfigSchema = z.object({
|
|
44
53
|
enabled: z.boolean().optional(),
|
|
45
|
-
marketplaceName: z.
|
|
54
|
+
marketplaceName: z.enum(CODEX_PLUGINS_MARKETPLACE_NAMES).optional(),
|
|
46
55
|
pluginName: z.string().trim().min(1).optional(),
|
|
47
56
|
allow_destructive_actions: z.boolean().optional()
|
|
48
57
|
}).strict();
|
|
@@ -121,10 +130,10 @@ function resolveCodexPluginsPolicy(pluginConfig) {
|
|
|
121
130
|
enabled,
|
|
122
131
|
allowDestructiveActions,
|
|
123
132
|
pluginPolicies: Object.entries(config?.plugins ?? {}).flatMap(([configKey, entry]) => {
|
|
124
|
-
if (entry.marketplaceName
|
|
133
|
+
if (!isCodexPluginsMarketplaceName(entry.marketplaceName) || !entry.pluginName) return [];
|
|
125
134
|
return [{
|
|
126
135
|
configKey,
|
|
127
|
-
marketplaceName:
|
|
136
|
+
marketplaceName: entry.marketplaceName,
|
|
128
137
|
pluginName: entry.pluginName,
|
|
129
138
|
enabled: enabled && entry.enabled !== false,
|
|
130
139
|
allowDestructiveActions: entry.allow_destructive_actions ?? allowDestructiveActions
|
|
@@ -674,7 +683,7 @@ function isCodexFastServiceTier(value) {
|
|
|
674
683
|
return normalizeCodexServiceTier(value) === "priority";
|
|
675
684
|
}
|
|
676
685
|
function normalizePositiveNumber(value, fallback) {
|
|
677
|
-
return
|
|
686
|
+
return resolvePositiveTimerTimeoutMs(value, fallback);
|
|
678
687
|
}
|
|
679
688
|
function normalizeHeaders(value) {
|
|
680
689
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
@@ -756,4 +765,4 @@ function splitShellWords(value) {
|
|
|
756
765
|
return words;
|
|
757
766
|
}
|
|
758
767
|
//#endregion
|
|
759
|
-
export {
|
|
768
|
+
export { isCodexAppServerApprovalPolicyAllowedByRequirements as a, isCodexSandboxExecServerEnabled as c, resolveCodexAppServerRuntimeOptions as d, resolveCodexComputerUseConfig as f, withMcpElicitationsApprovalPolicy as g, shouldAutoApproveCodexAppServerApprovals as h, codexSandboxPolicyForTurn as i, normalizeCodexServiceTier as l, resolveOpenClawExecPolicyForCodexAppServer as m, CODEX_PLUGINS_MARKETPLACE_NAMES as n, isCodexFastServiceTier as o, resolveCodexPluginsPolicy as p, codexAppServerStartOptionsKey as r, isCodexPluginsMarketplaceName as s, CODEX_PLUGINS_MARKETPLACE_NAME as t, readCodexPluginConfig as u };
|