@openclaw/codex 2026.5.20-beta.2 → 2026.5.22
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-Ab4Fw77C.js → client-D3SUwPFl.js} +14 -8
- package/dist/{client-factory-BbesECdh.js → client-factory-DdrIY1lw.js} +1 -1
- package/dist/{command-handlers-Gceg_rBZ.js → command-handlers-DsB0GYd2.js} +64 -7
- package/dist/{compact-BaSDurdH.js → compact-BwQn7jKq.js} +186 -40
- package/dist/{computer-use-B4iTog6z.js → computer-use-BMMwWwno.js} +2 -2
- package/dist/{config-DqIp6oTk.js → config-DDMrwfJl.js} +21 -2
- package/dist/dynamic-tools-DA42no4X.js +497 -0
- package/dist/harness.js +15 -5
- package/dist/index.js +10 -9
- package/dist/media-understanding-provider.js +6 -3
- package/dist/{models-C8MdOXGD.js → models-B_uo1pf5.js} +1 -1
- package/dist/{node-cli-sessions-T1olB1SH.js → node-cli-sessions-yVCifOyG.js} +23 -9
- package/dist/{command-formatters-BVBnEgyA.js → notification-correlation-qKY_sgga.js} +66 -15
- package/dist/provider.js +3 -3
- package/dist/{request-BePR77QD.js → request-NklFaHM4.js} +12 -3
- package/dist/{run-attempt-CRHVB240.js → run-attempt-DzlLXP5Y.js} +3750 -1409
- package/dist/sandbox-guard-CTnEWuor.js +233 -0
- package/dist/{session-binding-DEiYHgJ_.js → session-binding-Bw_mfIW2.js} +4 -2
- package/dist/{shared-client-DCxJx5QU.js → shared-client-C_RbGxW8.js} +2 -2
- package/dist/{side-question-DlJAUYst.js → side-question-DzP1wClA.js} +20 -15
- package/dist/test-api.js +3 -2
- package/dist/{thread-lifecycle-Cgi62SSl.js → thread-lifecycle-4Ul7RoW4.js} +606 -589
- package/dist/{vision-tools-B2wt6ecs.js → vision-tools-DOnxzH2y.js} +7 -3
- package/npm-shrinkwrap.json +1934 -0
- package/openclaw.plugin.json +29 -0
- package/package.json +8 -6
- package/dist/plugin-activation-BkQkPLOY.js +0 -452
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { resolveSandboxRuntimeStatus } from "openclaw/plugin-sdk/sandbox";
|
|
2
|
+
import { getSessionEntry } from "openclaw/plugin-sdk/session-store-runtime";
|
|
3
|
+
//#region extensions/codex/src/app-server/native-execution-policy.ts
|
|
4
|
+
const DEFAULT_AGENT_ID = "main";
|
|
5
|
+
const VALID_AGENT_ID_PATTERN = /^[a-z0-9][a-z0-9_-]{0,63}$/i;
|
|
6
|
+
const INVALID_AGENT_ID_CHARS_PATTERN = /[^a-z0-9_-]+/g;
|
|
7
|
+
const LEADING_DASH_PATTERN = /^-+/;
|
|
8
|
+
const TRAILING_DASH_PATTERN = /-+$/;
|
|
9
|
+
function resolveCodexNativeExecutionPolicy(params) {
|
|
10
|
+
const config = params.config ?? {};
|
|
11
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim() || void 0;
|
|
12
|
+
const sessionEntry = params.sessionEntry ?? (params.readRuntimeSessionEntry && sessionKey ? readRuntimeSessionEntryBestEffort(sessionKey) : void 0);
|
|
13
|
+
const sandboxAvailable = params.sandboxAvailable ?? (sessionKey ? resolveSandboxRuntimeStatus({
|
|
14
|
+
cfg: config,
|
|
15
|
+
sessionKey
|
|
16
|
+
}).sandboxed : false);
|
|
17
|
+
const agentExec = resolvePolicyAgentExec({
|
|
18
|
+
config,
|
|
19
|
+
agentId: resolvePolicyAgentId({
|
|
20
|
+
config,
|
|
21
|
+
sessionKey,
|
|
22
|
+
agentId: params.agentId
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
const globalExec = config.tools?.exec;
|
|
26
|
+
const requestedExecHost = normalizeExecTarget(params.execOverrides?.host) ?? normalizeExecTarget(sessionEntry?.execHost) ?? normalizeExecTarget(agentExec?.host) ?? normalizeExecTarget(globalExec?.host) ?? "auto";
|
|
27
|
+
const effectiveExecHost = resolveEffectiveExecHost({
|
|
28
|
+
requestedExecHost,
|
|
29
|
+
sandboxAvailable
|
|
30
|
+
});
|
|
31
|
+
const node = params.execOverrides?.node ?? sessionEntry?.execNode ?? agentExec?.node ?? globalExec?.node;
|
|
32
|
+
if (effectiveExecHost !== "node") return {
|
|
33
|
+
nativeToolSurfaceAllowed: true,
|
|
34
|
+
requestedExecHost,
|
|
35
|
+
effectiveExecHost,
|
|
36
|
+
node
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
nativeToolSurfaceAllowed: false,
|
|
40
|
+
requestedExecHost,
|
|
41
|
+
effectiveExecHost,
|
|
42
|
+
node,
|
|
43
|
+
blockReason: "OpenClaw exec host=node is active for this session. Codex app-server native execution cannot route shell, filesystem, MCP, or app-backed work through the selected OpenClaw node."
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function formatCodexNativeNodeExecBlock(params) {
|
|
47
|
+
return [
|
|
48
|
+
`Codex-native ${params.surface} is unavailable because OpenClaw exec host=node is active for this session.`,
|
|
49
|
+
params.reason ?? "Codex app-server native execution cannot route execution through the selected OpenClaw node.",
|
|
50
|
+
"Use a normal Codex harness turn so OpenClaw exec/process tools run on the node, or switch exec host to gateway for native Codex app-server execution."
|
|
51
|
+
].join(" ");
|
|
52
|
+
}
|
|
53
|
+
function resolvePolicyAgentId(params) {
|
|
54
|
+
const explicitAgentId = normalizeAgentIdOrDefault(params.agentId);
|
|
55
|
+
if (explicitAgentId) return explicitAgentId;
|
|
56
|
+
const sessionAgentId = parseAgentIdFromSessionKey(params.sessionKey);
|
|
57
|
+
if (sessionAgentId) return sessionAgentId;
|
|
58
|
+
const agents = listAgentEntries(params.config);
|
|
59
|
+
return normalizeAgentId((agents.find((entry) => entry?.default) ?? agents[0])?.id);
|
|
60
|
+
}
|
|
61
|
+
function resolvePolicyAgentExec(params) {
|
|
62
|
+
return listAgentEntries(params.config).find((entry) => normalizeAgentId(entry?.id) === params.agentId)?.tools?.exec;
|
|
63
|
+
}
|
|
64
|
+
function listAgentEntries(config) {
|
|
65
|
+
return (config.agents?.list ?? []).filter((entry) => entry !== null && typeof entry === "object");
|
|
66
|
+
}
|
|
67
|
+
function parseAgentIdFromSessionKey(sessionKey) {
|
|
68
|
+
const raw = sessionKey?.trim();
|
|
69
|
+
if (!raw) return;
|
|
70
|
+
const parts = raw.toLowerCase().split(":").filter(Boolean);
|
|
71
|
+
if (parts.length < 3 || parts[0] !== "agent" || !parts[2]) return;
|
|
72
|
+
return normalizeAgentIdOrDefault(parts[1]);
|
|
73
|
+
}
|
|
74
|
+
function normalizeAgentIdOrDefault(value) {
|
|
75
|
+
const normalized = normalizeAgentId(value);
|
|
76
|
+
return normalized === DEFAULT_AGENT_ID && !(value ?? "").trim() ? void 0 : normalized;
|
|
77
|
+
}
|
|
78
|
+
function normalizeAgentId(value) {
|
|
79
|
+
const trimmed = (value ?? "").trim();
|
|
80
|
+
if (!trimmed) return DEFAULT_AGENT_ID;
|
|
81
|
+
const normalized = trimmed.toLowerCase();
|
|
82
|
+
if (VALID_AGENT_ID_PATTERN.test(trimmed)) return normalized;
|
|
83
|
+
return normalized.replace(INVALID_AGENT_ID_CHARS_PATTERN, "-").replace(LEADING_DASH_PATTERN, "").replace(TRAILING_DASH_PATTERN, "").slice(0, 64) || DEFAULT_AGENT_ID;
|
|
84
|
+
}
|
|
85
|
+
function normalizeExecTarget(value) {
|
|
86
|
+
const normalized = value?.trim().toLowerCase();
|
|
87
|
+
if (normalized === "auto" || normalized === "sandbox" || normalized === "gateway" || normalized === "node") return normalized;
|
|
88
|
+
}
|
|
89
|
+
function resolveEffectiveExecHost(params) {
|
|
90
|
+
if (params.requestedExecHost === "auto") return params.sandboxAvailable ? "sandbox" : "gateway";
|
|
91
|
+
return params.requestedExecHost;
|
|
92
|
+
}
|
|
93
|
+
function readRuntimeSessionEntryBestEffort(sessionKey) {
|
|
94
|
+
try {
|
|
95
|
+
return getSessionEntry({ sessionKey });
|
|
96
|
+
} catch {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region extensions/codex/src/app-server/sandbox-guard.ts
|
|
102
|
+
const DIRECT_METHOD_POLICIES = new Map([
|
|
103
|
+
["account/rateLimits/read", "allowed-control-plane"],
|
|
104
|
+
["account/read", "allowed-control-plane"],
|
|
105
|
+
["app/list", "allowed-control-plane"],
|
|
106
|
+
["config/mcpServer/reload", "allowed-control-plane"],
|
|
107
|
+
["environment/add", "allowed-control-plane"],
|
|
108
|
+
["experimentalFeature/enablement/set", "allowed-control-plane"],
|
|
109
|
+
["feedback/upload", "allowed-control-plane"],
|
|
110
|
+
["hooks/list", "allowed-control-plane"],
|
|
111
|
+
["initialize", "allowed-control-plane"],
|
|
112
|
+
["marketplace/add", "allowed-control-plane"],
|
|
113
|
+
["mcpServerStatus/list", "allowed-control-plane"],
|
|
114
|
+
["model/list", "allowed-control-plane"],
|
|
115
|
+
["plugin/install", "allowed-control-plane"],
|
|
116
|
+
["plugin/list", "allowed-control-plane"],
|
|
117
|
+
["plugin/read", "allowed-control-plane"],
|
|
118
|
+
["skills/list", "allowed-control-plane"],
|
|
119
|
+
["thread/archive", "allowed-control-plane"],
|
|
120
|
+
["thread/inject_items", "allowed-control-plane"],
|
|
121
|
+
["thread/list", "allowed-control-plane"],
|
|
122
|
+
["thread/metadata/update", "allowed-control-plane"],
|
|
123
|
+
["thread/name/update", "allowed-control-plane"],
|
|
124
|
+
["thread/read", "allowed-control-plane"],
|
|
125
|
+
["thread/rollback", "allowed-control-plane"],
|
|
126
|
+
["thread/start", "requires-openclaw-environment"],
|
|
127
|
+
["thread/unarchive", "allowed-control-plane"],
|
|
128
|
+
["thread/unsubscribe", "allowed-control-plane"],
|
|
129
|
+
["turn/interrupt", "allowed-control-plane"],
|
|
130
|
+
["turn/steer", "allowed-control-plane"],
|
|
131
|
+
["command/exec", "blocked-native-bypass"],
|
|
132
|
+
["command/resize", "blocked-native-bypass"],
|
|
133
|
+
["command/terminate", "blocked-native-bypass"],
|
|
134
|
+
["command/write", "blocked-native-bypass"],
|
|
135
|
+
["fuzzyFileSearch", "blocked-native-bypass"],
|
|
136
|
+
["mcpServer/resource/read", "blocked-native-bypass"],
|
|
137
|
+
["mcpServer/tool/call", "blocked-native-bypass"],
|
|
138
|
+
["process/kill", "blocked-native-bypass"],
|
|
139
|
+
["process/resizePty", "blocked-native-bypass"],
|
|
140
|
+
["process/spawn", "blocked-native-bypass"],
|
|
141
|
+
["process/writeStdin", "blocked-native-bypass"],
|
|
142
|
+
["review/start", "blocked-native-bypass"],
|
|
143
|
+
["thread/compact/start", "blocked-native-bypass"],
|
|
144
|
+
["thread/fork", "blocked-native-bypass"],
|
|
145
|
+
["thread/resume", "blocked-native-bypass"],
|
|
146
|
+
["thread/shellCommand", "blocked-native-bypass"],
|
|
147
|
+
["turn/start", "blocked-native-bypass"]
|
|
148
|
+
]);
|
|
149
|
+
const BLOCKED_DIRECT_METHOD_PREFIXES = [
|
|
150
|
+
"command/",
|
|
151
|
+
"fs/",
|
|
152
|
+
"windowsSandbox/"
|
|
153
|
+
];
|
|
154
|
+
const NODE_EXEC_BLOCKED_CONTROL_PLANE_METHODS = new Set(["config/mcpServer/reload"]);
|
|
155
|
+
function resolveCodexAppServerDirectSandboxBypassBlock(params) {
|
|
156
|
+
const policy = resolveDirectMethodPolicy(params.method);
|
|
157
|
+
if (NODE_EXEC_BLOCKED_CONTROL_PLANE_METHODS.has(params.method)) {
|
|
158
|
+
const nodeExecBlock = resolveCodexNativeNodeExecBlock({
|
|
159
|
+
config: params.config,
|
|
160
|
+
sessionKey: params.sessionKey,
|
|
161
|
+
sessionId: params.sessionId,
|
|
162
|
+
surface: `app-server method \`${params.method}\``
|
|
163
|
+
});
|
|
164
|
+
if (nodeExecBlock) return nodeExecBlock;
|
|
165
|
+
}
|
|
166
|
+
if (policy === "allowed-control-plane") return;
|
|
167
|
+
const nodeExecBlock = resolveCodexNativeNodeExecBlock({
|
|
168
|
+
config: params.config,
|
|
169
|
+
sessionKey: params.sessionKey,
|
|
170
|
+
sessionId: params.sessionId,
|
|
171
|
+
surface: `app-server method \`${params.method}\``
|
|
172
|
+
});
|
|
173
|
+
if (nodeExecBlock) return nodeExecBlock;
|
|
174
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
|
|
175
|
+
if (!sessionKey) return;
|
|
176
|
+
const sandboxBlock = resolveCodexNativeSandboxBlock({
|
|
177
|
+
config: params.config,
|
|
178
|
+
sessionKey,
|
|
179
|
+
surface: `app-server method \`${params.method}\``
|
|
180
|
+
});
|
|
181
|
+
if (!sandboxBlock) return;
|
|
182
|
+
if (policy === "requires-openclaw-environment" && hasOpenClawSandboxEnvironmentSelection(params.requestParams)) return;
|
|
183
|
+
return sandboxBlock;
|
|
184
|
+
}
|
|
185
|
+
function resolveCodexNativeExecutionBlock(params) {
|
|
186
|
+
return resolveCodexNativeSandboxBlock(params) ?? resolveCodexNativeNodeExecBlock(params);
|
|
187
|
+
}
|
|
188
|
+
function resolveCodexNativeSandboxBlock(params) {
|
|
189
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
|
|
190
|
+
if (!sessionKey) return;
|
|
191
|
+
if (!resolveSandboxRuntimeStatus({
|
|
192
|
+
cfg: params.config,
|
|
193
|
+
sessionKey
|
|
194
|
+
}).sandboxed) return;
|
|
195
|
+
return formatCodexNativeSandboxBlock({ surface: params.surface });
|
|
196
|
+
}
|
|
197
|
+
function resolveDirectMethodPolicy(method) {
|
|
198
|
+
const exact = DIRECT_METHOD_POLICIES.get(method);
|
|
199
|
+
if (exact) return exact;
|
|
200
|
+
if (BLOCKED_DIRECT_METHOD_PREFIXES.some((prefix) => method.startsWith(prefix))) return "blocked-native-bypass";
|
|
201
|
+
return "blocked-native-bypass";
|
|
202
|
+
}
|
|
203
|
+
function hasOpenClawSandboxEnvironmentSelection(value) {
|
|
204
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
205
|
+
const environments = value.environments;
|
|
206
|
+
return Array.isArray(environments) && environments.length > 0 && environments.every((entry) => {
|
|
207
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
208
|
+
const environment = entry;
|
|
209
|
+
return typeof environment.environmentId === "string" && environment.environmentId.startsWith("openclaw-sandbox-") && typeof environment.cwd === "string" && environment.cwd.trim().length > 0;
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
function formatCodexNativeSandboxBlock(params) {
|
|
213
|
+
return [
|
|
214
|
+
`Codex-native ${params.surface} is unavailable because OpenClaw sandboxing is active for this session.`,
|
|
215
|
+
"This mode cannot route execution through the OpenClaw sandbox backend.",
|
|
216
|
+
"Use a normal Codex harness turn, or run an intentionally unsandboxed session."
|
|
217
|
+
].join(" ");
|
|
218
|
+
}
|
|
219
|
+
function resolveCodexNativeNodeExecBlock(params) {
|
|
220
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
|
|
221
|
+
const policy = resolveCodexNativeExecutionPolicy({
|
|
222
|
+
config: params.config,
|
|
223
|
+
sessionKey,
|
|
224
|
+
readRuntimeSessionEntry: Boolean(sessionKey)
|
|
225
|
+
});
|
|
226
|
+
if (policy.nativeToolSurfaceAllowed) return;
|
|
227
|
+
return formatCodexNativeNodeExecBlock({
|
|
228
|
+
surface: params.surface,
|
|
229
|
+
reason: policy.blockReason
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
export { resolveCodexNativeExecutionPolicy as i, resolveCodexNativeExecutionBlock as n, resolveCodexNativeSandboxBlock as r, resolveCodexAppServerDirectSandboxBypassBlock as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
2
|
+
import { s as normalizeCodexServiceTier } from "./config-DDMrwfJl.js";
|
|
3
3
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -56,6 +56,7 @@ async function readCodexAppServerBinding(sessionFile, lookup = {}) {
|
|
|
56
56
|
pluginAppsInputFingerprint: typeof parsed.pluginAppsInputFingerprint === "string" ? parsed.pluginAppsInputFingerprint : void 0,
|
|
57
57
|
pluginAppPolicyContext: readPluginAppPolicyContext(parsed.pluginAppPolicyContext),
|
|
58
58
|
contextEngine: readContextEngineBinding(parsed.contextEngine),
|
|
59
|
+
environmentSelectionFingerprint: typeof parsed.environmentSelectionFingerprint === "string" ? parsed.environmentSelectionFingerprint : void 0,
|
|
59
60
|
createdAt: typeof parsed.createdAt === "string" ? parsed.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
60
61
|
updatedAt: typeof parsed.updatedAt === "string" ? parsed.updatedAt : (/* @__PURE__ */ new Date()).toISOString()
|
|
61
62
|
};
|
|
@@ -91,6 +92,7 @@ async function writeCodexAppServerBinding(sessionFile, binding, lookup = {}) {
|
|
|
91
92
|
pluginAppsInputFingerprint: binding.pluginAppsInputFingerprint,
|
|
92
93
|
pluginAppPolicyContext: binding.pluginAppPolicyContext,
|
|
93
94
|
contextEngine: binding.contextEngine,
|
|
95
|
+
environmentSelectionFingerprint: binding.environmentSelectionFingerprint,
|
|
94
96
|
createdAt: binding.createdAt ?? now,
|
|
95
97
|
updatedAt: now
|
|
96
98
|
};
|
|
@@ -150,7 +152,7 @@ function readPluginAppPolicyContext(value) {
|
|
|
150
152
|
pluginAppIds: parsedPluginAppIds
|
|
151
153
|
};
|
|
152
154
|
}
|
|
153
|
-
async function clearCodexAppServerBinding(sessionFile) {
|
|
155
|
+
async function clearCodexAppServerBinding(sessionFile, _lookup = {}) {
|
|
154
156
|
try {
|
|
155
157
|
await fs.unlink(resolveCodexAppServerBindingPath(sessionFile));
|
|
156
158
|
} catch (error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { l as resolveCodexAppServerRuntimeOptions, n as codexAppServerStartOptionsKey } from "./config-DDMrwfJl.js";
|
|
3
|
+
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-D3SUwPFl.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { constants, readFileSync } from "node:fs";
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { a as readCodexDynamicToolCallParams,
|
|
1
|
+
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions } from "./config-DDMrwfJl.js";
|
|
2
|
+
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-_gKDcd0x.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-oeJQu4rs.js";
|
|
4
|
-
import {
|
|
5
|
-
import { u as
|
|
6
|
-
import { i as
|
|
7
|
-
import { i as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { i as isCodexAppServerApprovalRequest } from "./client-D3SUwPFl.js";
|
|
5
|
+
import { d as resolveReasoningEffort, h as mergeCodexThreadConfigs, n as buildCodexRuntimeThreadConfig, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-4Ul7RoW4.js";
|
|
6
|
+
import { i as readCodexAppServerBinding } from "./session-binding-Bw_mfIW2.js";
|
|
7
|
+
import { i as readCodexNotificationTurnId, m as formatCodexUsageLimitErrorMessage, r as readCodexNotificationThreadId } from "./notification-correlation-qKY_sgga.js";
|
|
8
|
+
import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-C_RbGxW8.js";
|
|
9
|
+
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
10
|
+
import { a as resolveCodexDynamicToolsLoading, n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-DA42no4X.js";
|
|
11
|
+
import { a as handleCodexAppServerElicitationRequest, c as emitDynamicToolTerminalDiagnostic, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerApprovalRequest, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as emitDynamicToolErrorDiagnostic, r as buildCodexNativeHookRelayConfig, s as emitDynamicToolStartedDiagnostic, t as filterToolsForVisionInputs } from "./vision-tools-DOnxzH2y.js";
|
|
10
12
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
11
13
|
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
12
14
|
//#region extensions/codex/src/app-server/side-question.ts
|
|
@@ -49,6 +51,13 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
49
51
|
config: params.cfg
|
|
50
52
|
});
|
|
51
53
|
if (!binding?.threadId) throw new Error("Codex /btw needs an active Codex thread. Send a normal message first, then try /btw again.");
|
|
54
|
+
const nativeExecutionBlock = resolveCodexNativeExecutionBlock({
|
|
55
|
+
config: params.cfg,
|
|
56
|
+
sessionKey: params.sessionKey,
|
|
57
|
+
sessionId: params.sessionId,
|
|
58
|
+
surface: "/btw side-question mode"
|
|
59
|
+
});
|
|
60
|
+
if (nativeExecutionBlock) throw new Error(nativeExecutionBlock);
|
|
52
61
|
const pluginConfig = readCodexPluginConfig(options.pluginConfig);
|
|
53
62
|
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
54
63
|
const authProfileId = params.authProfileId ?? binding.authProfileId;
|
|
@@ -601,7 +610,7 @@ var CodexSideQuestionCollector = class {
|
|
|
601
610
|
this.assistantText += delta;
|
|
602
611
|
}
|
|
603
612
|
completeFromTurn(params) {
|
|
604
|
-
const turn =
|
|
613
|
+
const turn = readCodexTurn(params.turn);
|
|
605
614
|
if (!turn || turn.id !== this.turnId) return;
|
|
606
615
|
this.completed = true;
|
|
607
616
|
if (turn.status === "failed") {
|
|
@@ -636,14 +645,10 @@ function collectAssistantText(turn) {
|
|
|
636
645
|
return (turn.items ?? []).filter((item) => item.type === "agentMessage" && typeof item.text === "string").map((item) => item.text.trim()).filter(Boolean).at(-1) ?? "";
|
|
637
646
|
}
|
|
638
647
|
function isNotificationForTurn(params, threadId, turnId) {
|
|
639
|
-
return
|
|
648
|
+
return readCodexNotificationThreadId(params) === threadId && readNotificationTurnId(params) === turnId;
|
|
640
649
|
}
|
|
641
650
|
function readNotificationTurnId(record) {
|
|
642
|
-
return
|
|
643
|
-
}
|
|
644
|
-
function readNestedTurnId(record) {
|
|
645
|
-
const turn = record.turn;
|
|
646
|
-
return isJsonObject(turn) ? readString(turn, "id") : void 0;
|
|
651
|
+
return readCodexNotificationTurnId(record);
|
|
647
652
|
}
|
|
648
653
|
function readBooleanAlias(record, keys) {
|
|
649
654
|
for (const key of keys) {
|
package/dist/test-api.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { l as resolveCodexAppServerRuntimeOptions } from "./config-DDMrwfJl.js";
|
|
2
|
+
import { a as buildThreadResumeParams, i as buildDeveloperInstructions, o as buildThreadStartParams, s as buildTurnStartParams } from "./thread-lifecycle-4Ul7RoW4.js";
|
|
3
|
+
import { n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-DA42no4X.js";
|
|
3
4
|
//#region extensions/codex/test-api.ts
|
|
4
5
|
function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
|
|
5
6
|
return resolveCodexAppServerRuntimeOptions({
|