@openclaw/codex 2026.5.16-beta.3 → 2026.5.16-beta.5
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-CA7amCZ8.js → client-6FkrXfaz.js} +1 -1
- package/dist/{client-factory-DwzPofwS.js → client-factory-9L6Ie1dC.js} +1 -1
- package/dist/{command-handlers-C4F8BChC.js → command-handlers-DcoFMn4e.js} +91 -37
- package/dist/{compact-96QPqIAu.js → compact-UKyG6Pw2.js} +3 -3
- package/dist/{computer-use-BX02ojP4.js → computer-use-UJ3dxrXF.js} +2 -2
- package/dist/{config-3ATInASk.js → config-B5pq6hEz.js} +7 -1
- package/dist/harness.js +9 -6
- package/dist/index.js +11 -8
- package/dist/media-understanding-provider.js +3 -3
- package/dist/{models-BZLMz9WS.js → models-C1zn2RN0.js} +1 -1
- package/dist/{node-cli-sessions-BLDFnUEF.js → node-cli-sessions-C9rlYMPw.js} +83 -35
- package/dist/{plugin-activation-BDU4e-NA.js → plugin-activation-B49xb7pI.js} +1 -1
- package/dist/provider.js +2 -2
- package/dist/{request-Czoa60Nt.js → request-XPjLayGw.js} +3 -3
- package/dist/{run-attempt-B3nk5oT1.js → run-attempt-Bssnu2uw.js} +355 -117
- package/dist/{session-binding-DbdVqMzW.js → session-binding-DqApZIgD.js} +1 -1
- package/dist/{shared-client-CnbrvEfV.js → shared-client-DlvmoLBJ.js} +70 -36
- package/dist/{side-question-D3nH-Jk1.js → side-question-DgVgwmjR.js} +107 -20
- package/dist/test-api.js +2 -2
- package/dist/{thread-lifecycle-D2sxRPdz.js → thread-lifecycle-BbriKhTq.js} +215 -17
- package/dist/{vision-tools-Cm_YicZb.js → vision-tools-BX9YuTEK.js} +203 -7
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
-
import { o as normalizeCodexServiceTier } from "./config-
|
|
2
|
+
import { o as normalizeCodexServiceTier } from "./config-B5pq6hEz.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";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
-
import { c as resolveCodexAppServerRuntimeOptions, n as codexAppServerStartOptionsKey } from "./config-
|
|
3
|
-
import { a as MANAGED_CODEX_APP_SERVER_PACKAGE, o as resolveCodexAppServerSpawnEnv, t as CodexAppServerClient } from "./client-
|
|
2
|
+
import { c as resolveCodexAppServerRuntimeOptions, n as codexAppServerStartOptionsKey } from "./config-B5pq6hEz.js";
|
|
3
|
+
import { a as MANAGED_CODEX_APP_SERVER_PACKAGE, o as resolveCodexAppServerSpawnEnv, t as CodexAppServerClient } from "./client-6FkrXfaz.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { constants, readFileSync } from "node:fs";
|
|
@@ -467,20 +467,39 @@ async function withTimeout$1(promise, timeoutMs, timeoutMessage) {
|
|
|
467
467
|
//#endregion
|
|
468
468
|
//#region extensions/codex/src/app-server/shared-client.ts
|
|
469
469
|
var shared_client_exports = /* @__PURE__ */ __exportAll({
|
|
470
|
-
clearSharedCodexAppServerClient: () => clearSharedCodexAppServerClient,
|
|
471
470
|
clearSharedCodexAppServerClientAndWait: () => clearSharedCodexAppServerClientAndWait,
|
|
472
471
|
clearSharedCodexAppServerClientIfCurrent: () => clearSharedCodexAppServerClientIfCurrent,
|
|
472
|
+
clearSharedCodexAppServerClientIfCurrentAndWait: () => clearSharedCodexAppServerClientIfCurrentAndWait,
|
|
473
473
|
createIsolatedCodexAppServerClient: () => createIsolatedCodexAppServerClient,
|
|
474
474
|
getSharedCodexAppServerClient: () => getSharedCodexAppServerClient
|
|
475
475
|
});
|
|
476
476
|
const SHARED_CODEX_APP_SERVER_CLIENT_STATE = Symbol.for("openclaw.codexAppServerClientState");
|
|
477
477
|
function getSharedCodexAppServerClientState() {
|
|
478
478
|
const globalState = globalThis;
|
|
479
|
-
globalState[SHARED_CODEX_APP_SERVER_CLIENT_STATE]
|
|
480
|
-
return
|
|
479
|
+
const state = globalState[SHARED_CODEX_APP_SERVER_CLIENT_STATE];
|
|
480
|
+
if (isSharedCodexAppServerClientState(state)) return state;
|
|
481
|
+
const legacyState = readLegacySharedCodexAppServerClientState(state);
|
|
482
|
+
const clients = /* @__PURE__ */ new Map();
|
|
483
|
+
if (legacyState?.key && (legacyState.client || legacyState.promise)) {
|
|
484
|
+
const legacyKey = legacyState.key;
|
|
485
|
+
clients.set(legacyKey, {
|
|
486
|
+
client: legacyState.client,
|
|
487
|
+
promise: legacyState.promise
|
|
488
|
+
});
|
|
489
|
+
legacyState.client?.addCloseHandler((closedClient) => clearSharedClientEntryIfCurrent(legacyKey, closedClient));
|
|
490
|
+
}
|
|
491
|
+
const nextState = { clients };
|
|
492
|
+
globalState[SHARED_CODEX_APP_SERVER_CLIENT_STATE] = nextState;
|
|
493
|
+
return nextState;
|
|
494
|
+
}
|
|
495
|
+
function isSharedCodexAppServerClientState(value) {
|
|
496
|
+
return value !== null && typeof value === "object" && value.clients instanceof Map;
|
|
497
|
+
}
|
|
498
|
+
function readLegacySharedCodexAppServerClientState(value) {
|
|
499
|
+
if (value === null || typeof value !== "object") return;
|
|
500
|
+
return value;
|
|
481
501
|
}
|
|
482
502
|
async function getSharedCodexAppServerClient(options) {
|
|
483
|
-
const state = getSharedCodexAppServerClientState();
|
|
484
503
|
const agentDir = options?.agentDir ?? resolveDefaultAgentDir(options?.config ?? {});
|
|
485
504
|
const usesNativeAuth = options?.authProfileId === null;
|
|
486
505
|
const requestedAuthProfileId = options?.authProfileId === null ? void 0 : options?.authProfileId;
|
|
@@ -499,12 +518,12 @@ async function getSharedCodexAppServerClient(options) {
|
|
|
499
518
|
authProfileId,
|
|
500
519
|
agentDir: usesNativeAuth ? void 0 : agentDir
|
|
501
520
|
});
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const sharedPromise =
|
|
521
|
+
const state = getSharedCodexAppServerClientState();
|
|
522
|
+
const entry = getOrCreateSharedClientEntry(state, key);
|
|
523
|
+
const sharedPromise = entry.promise ?? (entry.promise = (async () => {
|
|
505
524
|
const client = CodexAppServerClient.start(startOptions);
|
|
506
|
-
|
|
507
|
-
client.addCloseHandler(
|
|
525
|
+
entry.client = client;
|
|
526
|
+
client.addCloseHandler((closedClient) => clearSharedClientEntryIfCurrent(key, closedClient));
|
|
508
527
|
try {
|
|
509
528
|
await client.initialize();
|
|
510
529
|
await applyCodexAppServerAuthProfile({
|
|
@@ -523,7 +542,8 @@ async function getSharedCodexAppServerClient(options) {
|
|
|
523
542
|
try {
|
|
524
543
|
return await withTimeout$1(sharedPromise, options?.timeoutMs ?? 0, "codex app-server initialize timed out");
|
|
525
544
|
} catch (error) {
|
|
526
|
-
|
|
545
|
+
const currentEntry = state.clients.get(key);
|
|
546
|
+
if (currentEntry?.promise === sharedPromise) clearSharedClientEntry(key, currentEntry);
|
|
527
547
|
throw error;
|
|
528
548
|
}
|
|
529
549
|
}
|
|
@@ -560,38 +580,52 @@ async function createIsolatedCodexAppServerClient(options) {
|
|
|
560
580
|
throw error;
|
|
561
581
|
}
|
|
562
582
|
}
|
|
563
|
-
function
|
|
583
|
+
function clearSharedCodexAppServerClientIfCurrent(client) {
|
|
584
|
+
if (!client) return false;
|
|
564
585
|
const state = getSharedCodexAppServerClientState();
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
586
|
+
for (const [key, entry] of state.clients) if (entry.client === client) {
|
|
587
|
+
state.clients.delete(key);
|
|
588
|
+
client.close();
|
|
589
|
+
return true;
|
|
590
|
+
}
|
|
591
|
+
return false;
|
|
570
592
|
}
|
|
571
|
-
function
|
|
593
|
+
async function clearSharedCodexAppServerClientIfCurrentAndWait(client, options) {
|
|
572
594
|
if (!client) return false;
|
|
573
595
|
const state = getSharedCodexAppServerClientState();
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
return
|
|
596
|
+
for (const [key, entry] of state.clients) if (entry.client === client) {
|
|
597
|
+
state.clients.delete(key);
|
|
598
|
+
await client.closeAndWait(options);
|
|
599
|
+
return true;
|
|
600
|
+
}
|
|
601
|
+
return false;
|
|
580
602
|
}
|
|
581
603
|
async function clearSharedCodexAppServerClientAndWait(options) {
|
|
582
604
|
const state = getSharedCodexAppServerClientState();
|
|
583
|
-
const
|
|
584
|
-
state.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
605
|
+
const clients = collectSharedClients(state);
|
|
606
|
+
state.clients.clear();
|
|
607
|
+
await Promise.all(clients.map((client) => client.closeAndWait(options)));
|
|
608
|
+
}
|
|
609
|
+
function getOrCreateSharedClientEntry(state, key) {
|
|
610
|
+
let entry = state.clients.get(key);
|
|
611
|
+
if (!entry) {
|
|
612
|
+
entry = {};
|
|
613
|
+
state.clients.set(key, entry);
|
|
614
|
+
}
|
|
615
|
+
return entry;
|
|
616
|
+
}
|
|
617
|
+
function clearSharedClientEntry(key, entry) {
|
|
618
|
+
const state = getSharedCodexAppServerClientState();
|
|
619
|
+
if (state.clients.get(key) !== entry) return;
|
|
620
|
+
state.clients.delete(key);
|
|
621
|
+
entry.client?.close();
|
|
588
622
|
}
|
|
589
|
-
function
|
|
623
|
+
function clearSharedClientEntryIfCurrent(key, client) {
|
|
590
624
|
const state = getSharedCodexAppServerClientState();
|
|
591
|
-
if (state.client
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
state.
|
|
625
|
+
if (state.clients.get(key)?.client === client) state.clients.delete(key);
|
|
626
|
+
}
|
|
627
|
+
function collectSharedClients(state) {
|
|
628
|
+
return [...new Set([...state.clients.values()].map((entry) => entry.client).filter((client) => Boolean(client)))];
|
|
595
629
|
}
|
|
596
630
|
//#endregion
|
|
597
|
-
export { shared_client_exports as a, resolveCodexAppServerAuthAccountCacheKey as c, resolveCodexAppServerEnvApiKeyCacheKey as d, resolveCodexAppServerHomeDir as f, getSharedCodexAppServerClient as i, resolveCodexAppServerAuthProfileId as l,
|
|
631
|
+
export { shared_client_exports as a, resolveCodexAppServerAuthAccountCacheKey as c, resolveCodexAppServerEnvApiKeyCacheKey as d, resolveCodexAppServerHomeDir as f, getSharedCodexAppServerClient as i, resolveCodexAppServerAuthProfileId as l, clearSharedCodexAppServerClientIfCurrentAndWait as n, withTimeout$1 as o, createIsolatedCodexAppServerClient as r, refreshCodexAppServerAuthTokens as s, clearSharedCodexAppServerClientIfCurrent as t, resolveCodexAppServerAuthProfileIdForAgent as u };
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig } from "./config-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig } from "./config-B5pq6hEz.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, t as assertCodexThreadForkResponse } from "./protocol-validators-BGBspNmF.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { r as isCodexAppServerApprovalRequest } from "./client-
|
|
4
|
+
import { r as isCodexAppServerApprovalRequest } from "./client-6FkrXfaz.js";
|
|
5
5
|
import { u as formatCodexUsageLimitErrorMessage } from "./command-formatters-BRW7_Nu7.js";
|
|
6
|
-
import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-
|
|
7
|
-
import { i as readCodexAppServerBinding } from "./session-binding-
|
|
8
|
-
import { b as createCodexDynamicToolBridge, d as resolveReasoningEffort,
|
|
9
|
-
import {
|
|
6
|
+
import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-DlvmoLBJ.js";
|
|
7
|
+
import { i as readCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
|
|
8
|
+
import { S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, b as createCodexDynamicToolBridge, d as resolveReasoningEffort, h as mergeCodexThreadConfigs, n as buildCodexRuntimeThreadConfig, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-BbriKhTq.js";
|
|
9
|
+
import { a as handleCodexAppServerElicitationRequest, i as buildCodexNativeHookRelayDisabledConfig, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as handleCodexAppServerApprovalRequest, r as buildCodexNativeHookRelayConfig, t as filterToolsForVisionInputs } from "./vision-tools-BX9YuTEK.js";
|
|
10
10
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
|
|
11
|
-
import { embeddedAgentLog, formatErrorMessage, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
11
|
+
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, 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;
|
|
14
14
|
const CODEX_SIDE_DYNAMIC_TOOL_MAX_TIMEOUT_MS = 6e5;
|
|
15
15
|
const CODEX_SIDE_DYNAMIC_IMAGE_TOOL_TIMEOUT_MS = 6e4;
|
|
16
16
|
const SIDE_QUESTION_COMPLETION_TIMEOUT_MS = 6e5;
|
|
17
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_MIN_TTL_MS = 30 * 6e4;
|
|
18
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_TTL_GRACE_MS = 5 * 6e4;
|
|
19
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_STARTUP_REQUEST_COUNT = 3;
|
|
20
|
+
const CODEX_SIDE_NATIVE_HOOK_RELAY_EVENTS_WITH_APP_SERVER_APPROVALS = CODEX_NATIVE_HOOK_RELAY_EVENTS.filter((event) => event !== "permission_request");
|
|
17
21
|
const SIDE_BOUNDARY_PROMPT = `Side conversation boundary.
|
|
18
22
|
|
|
19
23
|
Everything before this boundary is inherited history from the parent thread. It is reference context only. It is not your current task.
|
|
@@ -63,6 +67,7 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
63
67
|
let childThreadId;
|
|
64
68
|
let turnId;
|
|
65
69
|
let removeRequestHandler;
|
|
70
|
+
let nativeHookRelay;
|
|
66
71
|
try {
|
|
67
72
|
const cwd = binding.cwd || params.workspaceDir || process.cwd();
|
|
68
73
|
const sideRunParams = buildSideRunAttemptParams(params, {
|
|
@@ -103,6 +108,7 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
103
108
|
paramsForRun: sideRunParams,
|
|
104
109
|
threadId: childThreadId,
|
|
105
110
|
turnId,
|
|
111
|
+
nativeHookRelay,
|
|
106
112
|
signal: runAbortController.signal
|
|
107
113
|
});
|
|
108
114
|
if (request.method !== "item/tool/call") return;
|
|
@@ -122,6 +128,36 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
122
128
|
const approvalPolicy = binding.approvalPolicy ?? appServer.approvalPolicy;
|
|
123
129
|
const sandbox = binding.sandbox ?? appServer.sandbox;
|
|
124
130
|
const serviceTier = binding.serviceTier ?? appServer.serviceTier;
|
|
131
|
+
const nativeHookRelayEvents = resolveCodexSideNativeHookRelayEvents({
|
|
132
|
+
configuredEvents: options.nativeHookRelay?.events,
|
|
133
|
+
approvalPolicy
|
|
134
|
+
});
|
|
135
|
+
nativeHookRelay = options.nativeHookRelay ? registerCodexSideNativeHookRelay({
|
|
136
|
+
options: options.nativeHookRelay,
|
|
137
|
+
events: nativeHookRelayEvents,
|
|
138
|
+
agentId: sessionAgentId,
|
|
139
|
+
sessionId: params.sessionId,
|
|
140
|
+
sessionKey: params.sessionKey,
|
|
141
|
+
config: params.cfg,
|
|
142
|
+
runId: sideRunParams.runId,
|
|
143
|
+
channelId: buildAgentHookContextChannelFields({
|
|
144
|
+
sessionKey: params.sessionKey,
|
|
145
|
+
messageChannel: params.messageChannel,
|
|
146
|
+
messageProvider: params.messageProvider,
|
|
147
|
+
currentChannelId: params.currentChannelId
|
|
148
|
+
}).channelId,
|
|
149
|
+
requestTimeoutMs: appServer.requestTimeoutMs,
|
|
150
|
+
completionTimeoutMs: Math.max(appServer.turnCompletionIdleTimeoutMs, SIDE_QUESTION_COMPLETION_TIMEOUT_MS),
|
|
151
|
+
signal: runAbortController.signal
|
|
152
|
+
}) : void 0;
|
|
153
|
+
const nativeHookRelayConfig = nativeHookRelay ? buildCodexNativeHookRelayConfig({
|
|
154
|
+
relay: nativeHookRelay,
|
|
155
|
+
events: nativeHookRelayEvents,
|
|
156
|
+
hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec,
|
|
157
|
+
clearOmittedEvents: true
|
|
158
|
+
}) : options.nativeHookRelay?.enabled === false ? buildCodexNativeHookRelayDisabledConfig() : void 0;
|
|
159
|
+
const runtimeThreadConfig = buildCodexRuntimeThreadConfig(void 0);
|
|
160
|
+
const threadConfig = mergeCodexThreadConfigs(nativeHookRelayConfig, runtimeThreadConfig) ?? runtimeThreadConfig;
|
|
125
161
|
const modelProvider = resolveCodexAppServerModelProvider({
|
|
126
162
|
provider: params.provider,
|
|
127
163
|
authProfileId,
|
|
@@ -137,7 +173,7 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
137
173
|
approvalsReviewer: appServer.approvalsReviewer,
|
|
138
174
|
sandbox,
|
|
139
175
|
...serviceTier ? { serviceTier } : {},
|
|
140
|
-
config:
|
|
176
|
+
config: threadConfig,
|
|
141
177
|
developerInstructions: SIDE_DEVELOPER_INSTRUCTIONS,
|
|
142
178
|
ephemeral: true,
|
|
143
179
|
threadSource: "user"
|
|
@@ -184,18 +220,51 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
184
220
|
if (!trimmed) throw new Error("Codex /btw completed without an answer.");
|
|
185
221
|
return { text: trimmed };
|
|
186
222
|
} finally {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
223
|
+
try {
|
|
224
|
+
params.opts?.abortSignal?.removeEventListener("abort", abortFromUpstream);
|
|
225
|
+
if (!runAbortController.signal.aborted) runAbortController.abort("codex_side_question_finished");
|
|
226
|
+
removeNotificationHandler();
|
|
227
|
+
removeRequestHandler?.();
|
|
228
|
+
await cleanupCodexSideThread(client, {
|
|
229
|
+
threadId: childThreadId,
|
|
230
|
+
turnId,
|
|
231
|
+
interrupt: !collector.completed,
|
|
232
|
+
timeoutMs: appServer.requestTimeoutMs
|
|
233
|
+
});
|
|
234
|
+
} finally {
|
|
235
|
+
nativeHookRelay?.unregister();
|
|
236
|
+
}
|
|
197
237
|
}
|
|
198
238
|
}
|
|
239
|
+
function resolveCodexSideNativeHookRelayEvents(params) {
|
|
240
|
+
if (params.configuredEvents?.length) return params.configuredEvents;
|
|
241
|
+
return params.approvalPolicy === "never" ? CODEX_NATIVE_HOOK_RELAY_EVENTS : CODEX_SIDE_NATIVE_HOOK_RELAY_EVENTS_WITH_APP_SERVER_APPROVALS;
|
|
242
|
+
}
|
|
243
|
+
function registerCodexSideNativeHookRelay(params) {
|
|
244
|
+
if (params.options.enabled === false) return;
|
|
245
|
+
return registerNativeHookRelay({
|
|
246
|
+
provider: "codex",
|
|
247
|
+
...params.agentId ? { agentId: params.agentId } : {},
|
|
248
|
+
sessionId: params.sessionId,
|
|
249
|
+
...params.sessionKey ? { sessionKey: params.sessionKey } : {},
|
|
250
|
+
...params.config ? { config: params.config } : {},
|
|
251
|
+
runId: params.runId,
|
|
252
|
+
...params.channelId ? { channelId: params.channelId } : {},
|
|
253
|
+
allowedEvents: params.events,
|
|
254
|
+
ttlMs: resolveCodexSideNativeHookRelayTtlMs({
|
|
255
|
+
explicitTtlMs: params.options.ttlMs,
|
|
256
|
+
requestTimeoutMs: params.requestTimeoutMs,
|
|
257
|
+
completionTimeoutMs: params.completionTimeoutMs
|
|
258
|
+
}),
|
|
259
|
+
signal: params.signal,
|
|
260
|
+
command: { timeoutMs: params.options.gatewayTimeoutMs }
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function resolveCodexSideNativeHookRelayTtlMs(params) {
|
|
264
|
+
if (params.explicitTtlMs !== void 0) return params.explicitTtlMs;
|
|
265
|
+
const relayBudgetMs = params.requestTimeoutMs * CODEX_SIDE_NATIVE_HOOK_RELAY_STARTUP_REQUEST_COUNT + params.completionTimeoutMs + CODEX_SIDE_NATIVE_HOOK_RELAY_TTL_GRACE_MS;
|
|
266
|
+
return Math.max(CODEX_SIDE_NATIVE_HOOK_RELAY_MIN_TTL_MS, Math.floor(relayBudgetMs));
|
|
267
|
+
}
|
|
199
268
|
function buildSideRunAttemptParams(params, options) {
|
|
200
269
|
return {
|
|
201
270
|
params,
|
|
@@ -211,6 +280,9 @@ function buildSideRunAttemptParams(params, options) {
|
|
|
211
280
|
sessionFile: params.sessionFile,
|
|
212
281
|
sessionKey: params.sessionKey,
|
|
213
282
|
agentId: params.agentId,
|
|
283
|
+
...params.messageChannel ? { messageChannel: params.messageChannel } : {},
|
|
284
|
+
...params.messageProvider ? { messageProvider: params.messageProvider } : {},
|
|
285
|
+
...params.currentChannelId ? { currentChannelId: params.currentChannelId } : {},
|
|
214
286
|
workspaceDir: options.cwd,
|
|
215
287
|
authProfileId: options.authProfileId,
|
|
216
288
|
authProfileIdSource: params.authProfileIdSource,
|
|
@@ -262,6 +334,14 @@ async function createCodexSideToolBridge(input) {
|
|
|
262
334
|
modelApi: runtimeModel.api,
|
|
263
335
|
modelContextWindowTokens: runtimeModel.contextWindow,
|
|
264
336
|
modelAuthMode: resolveModelAuthMode(runtimeModel.provider, input.params.cfg, void 0, { workspaceDir: input.cwd }),
|
|
337
|
+
...input.params.messageProvider || input.params.messageChannel ? { messageProvider: input.params.messageProvider ?? input.params.messageChannel } : {},
|
|
338
|
+
...input.params.currentChannelId ? { currentChannelId: input.params.currentChannelId } : {},
|
|
339
|
+
hookChannelId: buildAgentHookContextChannelFields({
|
|
340
|
+
sessionKey: input.params.sessionKey,
|
|
341
|
+
messageChannel: input.params.messageChannel,
|
|
342
|
+
messageProvider: input.params.messageProvider,
|
|
343
|
+
currentChannelId: input.params.currentChannelId
|
|
344
|
+
}).channelId,
|
|
265
345
|
sandbox,
|
|
266
346
|
modelHasVision: runtimeModel.input?.includes("image") ?? false,
|
|
267
347
|
requireExplicitMessageTarget: true
|
|
@@ -270,16 +350,23 @@ async function createCodexSideToolBridge(input) {
|
|
|
270
350
|
hasInboundImages: false
|
|
271
351
|
});
|
|
272
352
|
}
|
|
353
|
+
const hookChannelFields = buildAgentHookContextChannelFields({
|
|
354
|
+
sessionKey: input.params.sessionKey,
|
|
355
|
+
messageChannel: input.params.messageChannel,
|
|
356
|
+
messageProvider: input.params.messageProvider,
|
|
357
|
+
currentChannelId: input.params.currentChannelId
|
|
358
|
+
});
|
|
273
359
|
return createCodexDynamicToolBridge({
|
|
274
360
|
tools,
|
|
275
361
|
signal: input.signal,
|
|
276
|
-
loading: input.pluginConfig
|
|
362
|
+
loading: resolveCodexDynamicToolsLoading(input.pluginConfig),
|
|
277
363
|
hookContext: {
|
|
278
364
|
agentId: input.sessionAgentId,
|
|
279
365
|
config: input.params.cfg,
|
|
280
366
|
sessionId: input.params.sessionId,
|
|
281
367
|
sessionKey: input.params.sessionKey,
|
|
282
|
-
runId: input.params.opts?.runId ?? `codex-btw:${input.params.sessionId}
|
|
368
|
+
runId: input.params.opts?.runId ?? `codex-btw:${input.params.sessionId}`,
|
|
369
|
+
...hookChannelFields
|
|
283
370
|
}
|
|
284
371
|
});
|
|
285
372
|
}
|
package/dist/test-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
-
import { a as buildThreadResumeParams, b as createCodexDynamicToolBridge, i as buildDeveloperInstructions, o as buildThreadStartParams, s as buildTurnStartParams
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5pq6hEz.js";
|
|
2
|
+
import { S as filterCodexDynamicTools, a as buildThreadResumeParams, b as createCodexDynamicToolBridge, i as buildDeveloperInstructions, o as buildThreadStartParams, s as buildTurnStartParams } from "./thread-lifecycle-BbriKhTq.js";
|
|
3
3
|
//#region extensions/codex/test-api.ts
|
|
4
4
|
function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
|
|
5
5
|
return resolveCodexAppServerRuntimeOptions({
|