@openclaw/codex 2026.7.1 → 2026.7.2-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/README.md +27 -3
- package/dist/app-server-policy-Scc-Wevo.js +49 -0
- package/dist/{attempt-notifications-BGsEIIDI.js → attempt-notifications-BFmNhqFl.js} +3 -6
- package/dist/auth-binding-C1czuHPA.js +62 -0
- package/dist/cli-metadata.js +20 -0
- package/dist/{app-server-policy-C968Kgin.js → command-formatters-Dq9InZUK.js} +39 -51
- package/dist/{command-handlers-Dv-pzAmg.js → command-handlers-IgqmL_kv.js} +161 -61
- package/dist/{compact-4mVBriKT.js → compact-DCTmg3id.js} +39 -10
- package/dist/computer-use-CPcU8TjG.js +685 -0
- package/dist/conversation-control-CGkBlfc5.js +286 -0
- package/dist/doctor-contract-api.js +120 -81
- package/dist/{provider-capabilities-CDnHbmUZ.js → dynamic-tools-C_1tEs34.js} +6109 -5725
- package/dist/harness.js +59 -15
- package/dist/index.js +1460 -269
- package/dist/{media-understanding-provider-BHOu9-Gg.js → media-understanding-provider-D31dOJwb.js} +32 -15
- package/dist/media-understanding-provider.js +1 -1
- package/dist/{models-DDmO1zwd.js → models-uh26C8QU.js} +5 -9
- package/dist/notification-correlation-KmfV4EkP.js +67 -0
- package/dist/plugin-app-cache-key-Ceb-lm2c.js +315 -0
- package/dist/{provider-zjPfx5Fs.js → rate-limits-DyXaYAxU.js} +10 -266
- package/dist/request-B_oQsCXy.js +157 -0
- package/dist/{run-attempt-FUyOjGCV.js → run-attempt-MLzoMe_m.js} +7395 -6430
- package/dist/runtime-artifact-C2ITXdhM.js +488 -0
- package/dist/{sandbox-guard-DA2TQfZW.js → sandbox-guard-D1Wky__S.js} +10 -1
- package/dist/{config-CYEDnLJ2.js → session-binding-h1mmCGnl.js} +985 -31
- package/dist/session-catalog-CEvoXWHA.js +2412 -0
- package/dist/session-cli-XsEuWb_C.js +175 -0
- package/dist/{shared-client-4ICy3U6d.js → shared-client-JiAnW6pc.js} +2193 -1319
- package/dist/{side-question-N4OaDer2.js → side-question-DqDvIwSU.js} +140 -70
- package/dist/{thread-lifecycle-qWE88Dn2.js → thread-lifecycle-CN_pPtPh.js} +1826 -1188
- package/dist/{protocol-validators-dZQ-UTOa.js → transcript-mirror-D9rTxx2P.js} +485 -2
- package/dist/transport-stdio-DXgGZ7Ib.js +88 -0
- package/dist/usage-D5Rohxoc.js +25 -0
- package/dist/{web-search-provider.runtime-BSlriav6.js → web-search-provider.runtime-CKVBn3fP.js} +3 -3
- package/npm-shrinkwrap.json +56 -30
- package/openclaw.plugin.json +177 -14
- package/package.json +8 -6
- package/dist/command-rpc-eLM_mtC7.js +0 -784
- package/dist/computer-use-Bmaz333N.js +0 -377
- package/dist/notification-correlation-Bo7KB3ks.js +0 -35
- package/dist/plugin-app-cache-key-BrhVdeEf.js +0 -98
- package/dist/prompt-overlay.js +0 -15
- package/dist/protocol-2POPqAY4.js +0 -13
- package/dist/provider-catalog.js +0 -79
- package/dist/provider-discovery.js +0 -34
- package/dist/provider.js +0 -2
- package/dist/request-BcJyl8KL.js +0 -36
- package/dist/session-binding-C1ZXdP-x.js +0 -627
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { a as CODEX_LOCAL_SESSION_HOST_ID } from "./session-catalog-CEvoXWHA.js";
|
|
2
|
+
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
3
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { addGatewayClientOptions, callGatewayFromCli } from "openclaw/plugin-sdk/gateway-runtime";
|
|
5
|
+
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
6
|
+
//#region extensions/codex/src/session-cli.ts
|
|
7
|
+
const CODEX_SESSION_CATALOG_CLI_TIMEOUT_MS = 75e3;
|
|
8
|
+
function writeLine(value = "") {
|
|
9
|
+
process.stdout.write(`${value}\n`);
|
|
10
|
+
}
|
|
11
|
+
function writeJson(value) {
|
|
12
|
+
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
13
|
+
}
|
|
14
|
+
function gatewayOptions(options) {
|
|
15
|
+
return {
|
|
16
|
+
...options.url ? { url: options.url } : {},
|
|
17
|
+
...options.token ? { token: options.token } : {},
|
|
18
|
+
...options.timeout !== void 0 ? { timeout: options.timeout } : {},
|
|
19
|
+
json: options.json === true
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function parsePageLimit(value) {
|
|
23
|
+
if (value === void 0) return;
|
|
24
|
+
const trimmed = value.trim();
|
|
25
|
+
const parsed = Number(trimmed);
|
|
26
|
+
if (!/^\d+$/.test(trimmed) || !Number.isSafeInteger(parsed) || parsed < 1 || parsed > 100) throw new Error(`--limit must be an integer between 1 and 100`);
|
|
27
|
+
return parsed;
|
|
28
|
+
}
|
|
29
|
+
function normalizeTimestampMs(value) {
|
|
30
|
+
return Math.abs(value) < 0xe8d4a51000 ? value * 1e3 : value;
|
|
31
|
+
}
|
|
32
|
+
function formatTimestamp(session) {
|
|
33
|
+
const value = session.recencyAt ?? session.updatedAt ?? session.createdAt;
|
|
34
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return "-";
|
|
35
|
+
const date = new Date(normalizeTimestampMs(value));
|
|
36
|
+
return Number.isNaN(date.getTime()) ? "-" : `${date.toISOString().replace("T", " ").slice(0, 16)}Z`;
|
|
37
|
+
}
|
|
38
|
+
function singleLineTerminalText(value) {
|
|
39
|
+
return sanitizeTerminalText(value).replace(/\s+/g, " ").trim();
|
|
40
|
+
}
|
|
41
|
+
function truncate(value, maxLength) {
|
|
42
|
+
return value.length <= maxLength ? value : `${truncateUtf16Safe(value, maxLength - 1)}\u2026`;
|
|
43
|
+
}
|
|
44
|
+
function sessionTitle(session) {
|
|
45
|
+
return truncate((typeof session.name === "string" ? singleLineTerminalText(session.name) : "") || singleLineTerminalText(session.threadId) || "(untitled)", 72);
|
|
46
|
+
}
|
|
47
|
+
function sessionStatus(session) {
|
|
48
|
+
return session.status === "notLoaded" ? "stored / activity unknown" : singleLineTerminalText(session.status) || "unknown";
|
|
49
|
+
}
|
|
50
|
+
function quoteShellArgument(value) {
|
|
51
|
+
return `'${singleLineTerminalText(value).replaceAll("'", `'"'"'`)}'`;
|
|
52
|
+
}
|
|
53
|
+
function formatHostIdentity(host) {
|
|
54
|
+
const identifiers = [host.kind, singleLineTerminalText(host.hostId)];
|
|
55
|
+
if (host.nodeId && host.nodeId !== host.hostId) identifiers.push(singleLineTerminalText(host.nodeId));
|
|
56
|
+
return identifiers.join(" · ");
|
|
57
|
+
}
|
|
58
|
+
function writeHost(host) {
|
|
59
|
+
const connection = host.connected ? "connected" : "offline";
|
|
60
|
+
const count = `${host.sessions.length} session${host.sessions.length === 1 ? "" : "s"}`;
|
|
61
|
+
writeLine(`${singleLineTerminalText(host.label)} (${formatHostIdentity(host)}) — ${connection} — ${count}`);
|
|
62
|
+
if (host.error) writeLine(` Error [${singleLineTerminalText(host.error.code)}]: ${singleLineTerminalText(host.error.message)}`);
|
|
63
|
+
if (host.sessions.length === 0 && !host.error) writeLine(" No sessions.");
|
|
64
|
+
for (const session of host.sessions) {
|
|
65
|
+
writeLine(` ${formatTimestamp(session)} ${sessionStatus(session)} ${singleLineTerminalText(session.threadId)} ${sessionTitle(session)}`);
|
|
66
|
+
const details = [
|
|
67
|
+
session.cwd ? singleLineTerminalText(session.cwd) : void 0,
|
|
68
|
+
session.gitBranch ? `branch ${singleLineTerminalText(session.gitBranch)}` : void 0,
|
|
69
|
+
session.source ? `source ${singleLineTerminalText(session.source)}` : void 0,
|
|
70
|
+
session.modelProvider ? `provider ${singleLineTerminalText(session.modelProvider)}` : void 0
|
|
71
|
+
].filter((entry) => Boolean(entry));
|
|
72
|
+
if (details.length > 0) writeLine(` ${details.join(" · ")}`);
|
|
73
|
+
}
|
|
74
|
+
if (host.nextCursor) writeLine(` More sessions: repeat the same filters with --host ${quoteShellArgument(host.hostId)} --cursor ${quoteShellArgument(host.nextCursor)}`);
|
|
75
|
+
}
|
|
76
|
+
function filterHosts(result, selector) {
|
|
77
|
+
return selector ? {
|
|
78
|
+
...result,
|
|
79
|
+
hosts: result.hosts.filter((host) => host.hostId === selector)
|
|
80
|
+
} : result;
|
|
81
|
+
}
|
|
82
|
+
async function listCodexSessions(options) {
|
|
83
|
+
const host = options.host?.trim() || void 0;
|
|
84
|
+
const cursor = options.cursor?.trim() || void 0;
|
|
85
|
+
if (cursor && !host) throw new Error("--cursor requires --host so the cursor is routed to one Codex host");
|
|
86
|
+
const search = options.search?.trim() || void 0;
|
|
87
|
+
const limitPerHost = parsePageLimit(options.limit);
|
|
88
|
+
const params = {
|
|
89
|
+
...search ? { search } : {},
|
|
90
|
+
...limitPerHost !== void 0 ? { limitPerHost } : {},
|
|
91
|
+
...host ? { hostIds: [host] } : {},
|
|
92
|
+
...cursor && host ? { cursors: { [host]: cursor } } : {}
|
|
93
|
+
};
|
|
94
|
+
const raw = await callGatewayFromCli("sessions.catalog.list", gatewayOptions(options), {
|
|
95
|
+
catalogId: "codex",
|
|
96
|
+
...params
|
|
97
|
+
}, {
|
|
98
|
+
mode: "cli",
|
|
99
|
+
scopes: ["operator.write"]
|
|
100
|
+
});
|
|
101
|
+
if (!isRecord(raw) || !Array.isArray(raw.catalogs)) throw new Error("Codex session catalog returned an invalid result");
|
|
102
|
+
const catalog = raw.catalogs.find((candidate) => isRecord(candidate) && candidate.id === "codex" && Array.isArray(candidate.hosts));
|
|
103
|
+
if (!isRecord(catalog)) throw new Error("Codex session catalog is unavailable on this Gateway");
|
|
104
|
+
const result = filterHosts({ hosts: catalog.hosts }, host);
|
|
105
|
+
if (options.json) {
|
|
106
|
+
writeJson(result);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (result.hosts.length === 0) {
|
|
110
|
+
writeLine(host ? `No Codex session host matched "${singleLineTerminalText(host)}".` : "No Codex session hosts found.");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
result.hosts.forEach((catalogHost, index) => {
|
|
114
|
+
if (index > 0) writeLine();
|
|
115
|
+
writeHost(catalogHost);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function readThreadId(value) {
|
|
119
|
+
const threadId = value.trim();
|
|
120
|
+
if (!threadId) throw new Error("Codex thread id must not be empty");
|
|
121
|
+
return threadId;
|
|
122
|
+
}
|
|
123
|
+
async function continueCodexSession(threadIdValue, options) {
|
|
124
|
+
const threadId = readThreadId(threadIdValue);
|
|
125
|
+
const raw = await callGatewayFromCli("sessions.catalog.continue", gatewayOptions(options), {
|
|
126
|
+
catalogId: "codex",
|
|
127
|
+
hostId: CODEX_LOCAL_SESSION_HOST_ID,
|
|
128
|
+
threadId
|
|
129
|
+
}, {
|
|
130
|
+
mode: "cli",
|
|
131
|
+
scopes: ["operator.write"]
|
|
132
|
+
});
|
|
133
|
+
if (!isRecord(raw) || typeof raw.sessionKey !== "string" || !raw.sessionKey.trim()) throw new Error("Codex session continue returned an invalid session key");
|
|
134
|
+
const result = { sessionKey: raw.sessionKey };
|
|
135
|
+
if (options.json) {
|
|
136
|
+
writeJson(result);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
writeLine(`OpenClaw session: ${singleLineTerminalText(result.sessionKey)}`);
|
|
140
|
+
}
|
|
141
|
+
async function archiveCodexSession(threadIdValue, options) {
|
|
142
|
+
const threadId = readThreadId(threadIdValue);
|
|
143
|
+
if (options.confirmNoOtherRunner !== true) throw new Error("--confirm-no-other-runner is required because Codex client and runner activity is process-local");
|
|
144
|
+
const raw = await callGatewayFromCli("sessions.catalog.archive", gatewayOptions(options), {
|
|
145
|
+
catalogId: "codex",
|
|
146
|
+
hostId: CODEX_LOCAL_SESSION_HOST_ID,
|
|
147
|
+
threadId,
|
|
148
|
+
confirmNoOtherRunner: true
|
|
149
|
+
}, {
|
|
150
|
+
mode: "cli",
|
|
151
|
+
scopes: ["operator.write"]
|
|
152
|
+
});
|
|
153
|
+
if (!isRecord(raw) || raw.ok !== true) throw new Error("Codex session archive returned an invalid result");
|
|
154
|
+
const result = { ok: true };
|
|
155
|
+
if (options.json) {
|
|
156
|
+
writeJson(result);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
writeLine(`Archived Codex thread ${singleLineTerminalText(threadId)}.`);
|
|
160
|
+
}
|
|
161
|
+
/** Registers the plugin-owned Codex session supervision CLI. */
|
|
162
|
+
function registerCodexSessionCli(program) {
|
|
163
|
+
const codex = program.command("codex").description("Inspect and branch from Codex sessions through the Gateway");
|
|
164
|
+
addGatewayClientOptions(codex.command("sessions").description("List non-archived Codex app-server sessions across connected hosts").option("--search <text>", "Search session titles (case-insensitive)").option("--host <id>", "Filter by stable host id").option("--limit <count>", "Maximum sessions returned per host").option("--cursor <cursor>", "Continue one host page (requires --host)").option("--json", "Print the structured catalog response", false), { timeoutMs: CODEX_SESSION_CATALOG_CLI_TIMEOUT_MS }).action(async (options) => {
|
|
165
|
+
await listCodexSessions(options);
|
|
166
|
+
});
|
|
167
|
+
addGatewayClientOptions(codex.command("continue <thread-id>").description("Continue a Gateway-local Codex thread as an OpenClaw branch").option("--json", "Print the structured response", false)).action(async (threadId, options) => {
|
|
168
|
+
await continueCodexSession(threadId, options);
|
|
169
|
+
});
|
|
170
|
+
addGatewayClientOptions(codex.command("archive <thread-id>").description("Archive a stored or idle Gateway-local Codex thread").option("--confirm-no-other-runner", "Confirm no other Codex client or OpenClaw runner is using this thread", false).option("--json", "Print the structured response", false)).action(async (threadId, options) => {
|
|
171
|
+
await archiveCodexSession(threadId, options);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { registerCodexSessionCli };
|