@openclaw/codex 2026.6.11-beta.2 → 2026.7.1-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/{app-server-policy-BPTiVNsW.js → app-server-policy-xi0ZmBGO.js} +2 -2
- package/dist/{attempt-notifications-BYnndyFl.js → attempt-notifications-l9LElGOU.js} +26 -2
- package/dist/{client-CLrtWgrD.js → client-IcTBKEqA.js} +5 -2
- package/dist/{client-factory-Bm6HsGob.js → client-factory-CwjdQQ4j.js} +1 -1
- package/dist/{command-handlers-DEPTJYk0.js → command-handlers-vZy8xX5X.js} +25 -19
- package/dist/{compact-aQJ0ZKhe.js → compact-BzB9AqN1.js} +5 -5
- package/dist/{computer-use-ClrJwoFp.js → computer-use-FPGG-mtX.js} +3 -3
- package/dist/{config-CszD0vP3.js → config-C_whBx3M.js} +8 -3
- package/dist/{conversation-binding-t0XMLz-j.js → conversation-binding-CEE2UyYb.js} +28 -15
- package/dist/harness.js +6 -6
- package/dist/index.js +25 -17
- package/dist/{media-understanding-provider-ZUQHN7gT.js → media-understanding-provider-C5yYzx_6.js} +6 -6
- package/dist/media-understanding-provider.js +1 -1
- package/dist/{models-CAmfBWRl.js → models-Ccy1_7nN.js} +2 -2
- package/dist/{plugin-app-cache-key-C9ILt7bl.js → plugin-app-cache-key-CDioyur-.js} +8 -4
- package/dist/{protocol-validators-B19q5BIX.js → protocol-validators-CB4mtyrs.js} +106 -12
- package/dist/{provider-B-OHpbD3.js → provider-DosqwRb6.js} +53 -18
- package/dist/{provider-capabilities-D7hnTO76.js → provider-capabilities-CE5k8cmO.js} +179 -15
- package/dist/provider-catalog.js +4 -2
- package/dist/provider.js +2 -2
- package/dist/{request-Dcd452Nk.js → request-BQuSQF29.js} +2 -2
- package/dist/{run-attempt-CXxtFC9d.js → run-attempt-O3Zs32KI.js} +106 -29
- package/dist/{sandbox-guard-3tnjhjFb.js → sandbox-guard-pTY2COoC.js} +2 -0
- package/dist/{session-binding-HOuPt-E0.js → session-binding-Cm0Gg7Z1.js} +2 -1
- package/dist/{shared-client-Dtx5i7Ez.js → shared-client-rR6TDJA3.js} +98 -47
- package/dist/{side-question-C-DhgJOd.js → side-question-DDVgFmpv.js} +12 -12
- package/dist/{thread-lifecycle-DtT3-ehU.js → thread-lifecycle-DeSMZSXr.js} +148 -42
- package/dist/{web-search-provider.runtime-CkwxrXQj.js → web-search-provider.runtime-Q89rQhsL.js} +2 -2
- package/npm-shrinkwrap.json +30 -30
- package/openclaw.plugin.json +3 -3
- package/package.json +5 -5
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
|
|
2
|
-
import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, _ as resolveCodexWebSearchPlan, w as normalizeCodexDynamicToolName, x as sanitizeInlineImageDataUrl, y as invalidInlineImageText } from "./thread-lifecycle-
|
|
3
|
-
import { c as isTrustedCodexModelBackedOpenAIProvider, u as readCodexPluginConfig } from "./config-
|
|
4
|
-
import { a as formatCodexDisplayText } from "./app-server-policy-
|
|
5
|
-
import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-
|
|
6
|
-
import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-
|
|
2
|
+
import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, _ as resolveCodexWebSearchPlan, w as normalizeCodexDynamicToolName, x as sanitizeInlineImageDataUrl, y as invalidInlineImageText } from "./thread-lifecycle-DeSMZSXr.js";
|
|
3
|
+
import { c as isTrustedCodexModelBackedOpenAIProvider, u as readCodexPluginConfig } from "./config-C_whBx3M.js";
|
|
4
|
+
import { a as formatCodexDisplayText } from "./app-server-policy-xi0ZmBGO.js";
|
|
5
|
+
import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-rR6TDJA3.js";
|
|
6
|
+
import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-pTY2COoC.js";
|
|
7
7
|
import { addTimerTimeoutGraceMs, finiteSecondsToTimerSafeMilliseconds, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
8
8
|
import { asOptionalRecord, isRecord, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
import { resolveAgentDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
11
11
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
12
|
-
import { HEARTBEAT_RESPONSE_TOOL_NAME, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, callGatewayTool, consumeAdjustedParamsForToolCall, consumePreExecutionBlockedToolCall, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractMessagingToolSend, extractMessagingToolSendResult, extractToolResultMediaArtifact, filterProviderNormalizableTools, filterToolResultMediaUrls, finalizeToolTerminalPresentation, formatApprovalDisplayPath, getChannelAgentToolMeta, getPluginToolMeta, hasNativeHookRelayInvocation, invokeNativeHookRelay, isMessagingTool, isMessagingToolSendAction, isReplaySafeToolCall, isSubagentSessionKey, isToolResultError, isToolWrappedWithBeforeToolCallHook, normalizeAgentRuntimeTools, normalizeHeartbeatToolResponse, projectRuntimeToolInputSchema, registerNativeHookRelay, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveNativeHookRelayDeferredToolApproval, runAgentHarnessAfterToolCallHook, runBeforeToolCallHook, sanitizeToolResult, setBeforeToolCallDiagnosticsEnabled, supportsModelTools, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
12
|
+
import { HEARTBEAT_RESPONSE_TOOL_NAME, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, callGatewayTool, consumeAdjustedParamsForToolCall, consumePreExecutionBlockedToolCall, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractMessagingToolSend, extractMessagingToolSendResult, extractToolResultMediaArtifact, filterProviderNormalizableTools, filterToolResultMediaUrls, finalizeToolTerminalPresentation, formatApprovalDisplayPath, getChannelAgentToolMeta, getPluginToolMeta, hasNativeHookRelayInvocation, invokeNativeHookRelay, isDeliveredMessageToolOnlySourceReplyResult, isDeliveredMessagingToolResult, isMessagingTool, isMessagingToolSendAction, isReplaySafeToolCall, isSubagentSessionKey, isToolResultError, isToolWrappedWithBeforeToolCallHook, normalizeAgentRuntimeTools, normalizeHeartbeatToolResponse, projectRuntimeToolInputSchema, registerNativeHookRelay, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveNativeHookRelayDeferredToolApproval, runAgentHarnessAfterToolCallHook, runBeforeToolCallHook, sanitizeToolResult, setBeforeToolCallDiagnosticsEnabled, supportsModelTools, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
13
13
|
import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
14
14
|
import { isToolAllowed } from "openclaw/plugin-sdk/sandbox";
|
|
15
15
|
import { buildExecAutoReviewInputForShellCommand, reviewExecRequestWithConfiguredModel } from "openclaw/plugin-sdk/agent-harness-exec-review-runtime";
|
|
@@ -82,8 +82,9 @@ function resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs(value, fallback
|
|
|
82
82
|
return resolvePositiveIntegerTimeoutMs(value, Math.max(resolvePositiveIntegerTimeoutMs(void 0, fallbackMs), CODEX_POST_TOOL_RAW_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS));
|
|
83
83
|
}
|
|
84
84
|
/** Resolves the long terminal turn idle timeout. */
|
|
85
|
-
function resolveCodexTurnTerminalIdleTimeoutMs(value) {
|
|
86
|
-
|
|
85
|
+
function resolveCodexTurnTerminalIdleTimeoutMs(value, runTimeoutOverrideMs) {
|
|
86
|
+
const explicitRunBudgetMs = resolvePositiveIntegerTimeoutMs(runTimeoutOverrideMs, CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS);
|
|
87
|
+
return resolvePositiveIntegerTimeoutMs(value, Math.max(CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS, explicitRunBudgetMs));
|
|
87
88
|
}
|
|
88
89
|
/** Adds gateway grace time to a caller timeout without overflowing invalid values. */
|
|
89
90
|
function resolveCodexGatewayTimeoutWithGraceMs(timeoutMs, graceMs = 1e4) {
|
|
@@ -1672,9 +1673,135 @@ function applyCurrentMessageProvider(toolName, args, currentProvider) {
|
|
|
1672
1673
|
provider
|
|
1673
1674
|
};
|
|
1674
1675
|
}
|
|
1676
|
+
function normalizeRouteToken(value) {
|
|
1677
|
+
if (typeof value === "number") return Number.isFinite(value) ? String(value) : void 0;
|
|
1678
|
+
const normalized = value?.trim().toLowerCase();
|
|
1679
|
+
return normalized ? normalized : void 0;
|
|
1680
|
+
}
|
|
1681
|
+
function sourceRouteTokens(hookContext) {
|
|
1682
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
1683
|
+
const currentTarget = normalizeRouteToken(hookContext?.currentMessagingTarget);
|
|
1684
|
+
const currentChannel = normalizeRouteToken(hookContext?.currentChannelId);
|
|
1685
|
+
const currentProvider = normalizeRouteToken(hookContext?.currentChannelProvider);
|
|
1686
|
+
if (currentTarget) tokens.add(currentTarget);
|
|
1687
|
+
if (currentChannel) tokens.add(currentChannel);
|
|
1688
|
+
const channelPrefixIndex = currentChannel?.indexOf(":") ?? -1;
|
|
1689
|
+
if (channelPrefixIndex >= 0 && currentChannel) {
|
|
1690
|
+
const unprefixedChannel = currentChannel.slice(channelPrefixIndex + 1);
|
|
1691
|
+
if (unprefixedChannel) {
|
|
1692
|
+
tokens.add(unprefixedChannel);
|
|
1693
|
+
for (const segment of unprefixedChannel.split(/[;,]/u)) {
|
|
1694
|
+
const token = normalizeRouteToken(segment);
|
|
1695
|
+
if (token) tokens.add(token);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
if (currentProvider && currentChannel?.startsWith(`${currentProvider}:`)) {
|
|
1700
|
+
const unprefixedChannel = currentChannel.slice(currentProvider.length + 1);
|
|
1701
|
+
if (unprefixedChannel) tokens.add(unprefixedChannel);
|
|
1702
|
+
}
|
|
1703
|
+
return tokens;
|
|
1704
|
+
}
|
|
1705
|
+
function routeTokenMatchesSource(token, hookContext) {
|
|
1706
|
+
const normalized = normalizeRouteToken(token);
|
|
1707
|
+
return normalized !== void 0 && sourceRouteTokens(hookContext).has(normalized);
|
|
1708
|
+
}
|
|
1709
|
+
function routeProviderMatchesSource(provider, hookContext) {
|
|
1710
|
+
const normalized = normalizeRouteToken(provider);
|
|
1711
|
+
if (!normalized) return false;
|
|
1712
|
+
const currentProvider = normalizeRouteToken(hookContext?.currentChannelProvider);
|
|
1713
|
+
const currentChannel = normalizeRouteToken(hookContext?.currentChannelId);
|
|
1714
|
+
return currentProvider === normalized || currentChannel?.startsWith(`${normalized}:`) === true;
|
|
1715
|
+
}
|
|
1716
|
+
function routeTokenMatchesCurrentMessage(token, hookContext) {
|
|
1717
|
+
const normalized = normalizeRouteToken(token);
|
|
1718
|
+
return normalized !== void 0 && normalized === normalizeRouteToken(hookContext?.currentMessageId);
|
|
1719
|
+
}
|
|
1720
|
+
function readRouteToken(record, key) {
|
|
1721
|
+
const value = record[key];
|
|
1722
|
+
return typeof value === "string" || typeof value === "number" ? value : void 0;
|
|
1723
|
+
}
|
|
1724
|
+
function explicitRouteTokensMismatchCurrent(args, keys, currentToken) {
|
|
1725
|
+
const normalizedCurrent = normalizeRouteToken(currentToken);
|
|
1726
|
+
if (!normalizedCurrent) return false;
|
|
1727
|
+
return keys.some((key) => {
|
|
1728
|
+
const normalized = normalizeRouteToken(readRouteToken(args, key));
|
|
1729
|
+
return normalized !== void 0 && normalized !== normalizedCurrent;
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
function explicitThreadRouteTargetsNonSource(args, hookContext, messagingTarget) {
|
|
1733
|
+
const normalizedCurrentThread = normalizeRouteToken(hookContext?.currentThreadId);
|
|
1734
|
+
const explicitThreadTokens = [...EXPLICIT_MESSAGE_THREAD_KEYS.map((key) => normalizeRouteToken(readRouteToken(args, key))), normalizeRouteToken(messagingTarget?.threadId)].filter((value) => value !== void 0);
|
|
1735
|
+
if (explicitThreadTokens.length === 0) return false;
|
|
1736
|
+
return normalizedCurrentThread === void 0 || explicitThreadTokens.some((value) => value !== normalizedCurrentThread);
|
|
1737
|
+
}
|
|
1738
|
+
function replyReceiptMatchesCurrentMessage(value, hookContext, depth = 0) {
|
|
1739
|
+
if (depth > 4 || value === null) return false;
|
|
1740
|
+
if (typeof value === "string") {
|
|
1741
|
+
const trimmed = value.trim();
|
|
1742
|
+
if (!trimmed || !["{", "["].includes(trimmed[0] ?? "")) return false;
|
|
1743
|
+
try {
|
|
1744
|
+
return replyReceiptMatchesCurrentMessage(JSON.parse(trimmed), hookContext, depth + 1);
|
|
1745
|
+
} catch {
|
|
1746
|
+
return false;
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
if (typeof value !== "object") return false;
|
|
1750
|
+
if (Array.isArray(value)) return value.some((item) => replyReceiptMatchesCurrentMessage(item, hookContext, depth + 1));
|
|
1751
|
+
const record = value;
|
|
1752
|
+
for (const key of [
|
|
1753
|
+
"repliedTo",
|
|
1754
|
+
"replyTo",
|
|
1755
|
+
"replyToId",
|
|
1756
|
+
"replyToIdFull"
|
|
1757
|
+
]) if (routeTokenMatchesCurrentMessage(typeof record[key] === "string" ? record[key] : void 0, hookContext)) return true;
|
|
1758
|
+
for (const key of [
|
|
1759
|
+
"content",
|
|
1760
|
+
"details",
|
|
1761
|
+
"payload",
|
|
1762
|
+
"receipt",
|
|
1763
|
+
"result",
|
|
1764
|
+
"results",
|
|
1765
|
+
"sendResult",
|
|
1766
|
+
"text"
|
|
1767
|
+
]) if (replyReceiptMatchesCurrentMessage(record[key], hookContext, depth + 1)) return true;
|
|
1768
|
+
return false;
|
|
1769
|
+
}
|
|
1770
|
+
function hasExplicitNonSourceMessageRoute(args, hookContext, messagingTarget) {
|
|
1771
|
+
const currentProvider = normalizeRouteToken(hookContext?.currentChannelProvider);
|
|
1772
|
+
for (const key of EXPLICIT_MESSAGE_PROVIDER_KEYS) {
|
|
1773
|
+
const provider = normalizeRouteToken(typeof args[key] === "string" ? args[key] : void 0);
|
|
1774
|
+
if (provider && currentProvider !== provider && !routeProviderMatchesSource(provider, hookContext)) return true;
|
|
1775
|
+
}
|
|
1776
|
+
const targetValues = [...EXPLICIT_MESSAGE_TARGET_KEYS.map((key) => typeof args[key] === "string" ? args[key] : void 0), ...Array.isArray(args.targets) ? args.targets.map((value) => typeof value === "string" ? value : void 0) : []].filter((value) => normalizeRouteToken(value) !== void 0);
|
|
1777
|
+
if (explicitThreadRouteTargetsNonSource(args, hookContext, messagingTarget)) return true;
|
|
1778
|
+
if (explicitRouteTokensMismatchCurrent(args, EXPLICIT_MESSAGE_REPLY_KEYS, hookContext?.currentMessageId)) return true;
|
|
1779
|
+
if (messagingTarget?.to !== void 0 && !routeTokenMatchesSource(messagingTarget.to, hookContext)) return true;
|
|
1780
|
+
if (messagingTarget?.to !== void 0) return false;
|
|
1781
|
+
if (targetValues.length === 0) return false;
|
|
1782
|
+
if (targetValues.some((value) => !routeTokenMatchesSource(value, hookContext))) return true;
|
|
1783
|
+
return false;
|
|
1784
|
+
}
|
|
1675
1785
|
/** Namespace attached to OpenClaw-owned dynamic tools exposed to Codex. */
|
|
1676
1786
|
const CODEX_OPENCLAW_DYNAMIC_TOOL_NAMESPACE = "openclaw";
|
|
1677
1787
|
const ALWAYS_DIRECT_DYNAMIC_TOOL_NAMES = new Set(["sessions_yield"]);
|
|
1788
|
+
const EXPLICIT_MESSAGE_PROVIDER_KEYS = ["channel", "provider"];
|
|
1789
|
+
const EXPLICIT_MESSAGE_TARGET_KEYS = [
|
|
1790
|
+
"target",
|
|
1791
|
+
"to",
|
|
1792
|
+
"channelId"
|
|
1793
|
+
];
|
|
1794
|
+
const EXPLICIT_MESSAGE_THREAD_KEYS = [
|
|
1795
|
+
"threadId",
|
|
1796
|
+
"thread_id",
|
|
1797
|
+
"messageThreadId",
|
|
1798
|
+
"topicId"
|
|
1799
|
+
];
|
|
1800
|
+
const EXPLICIT_MESSAGE_REPLY_KEYS = [
|
|
1801
|
+
"replyTo",
|
|
1802
|
+
"replyToId",
|
|
1803
|
+
"replyToIdFull"
|
|
1804
|
+
];
|
|
1678
1805
|
const DEFAULT_CODEX_DYNAMIC_TOOL_RESULT_MAX_CHARS = 16e3;
|
|
1679
1806
|
/**
|
|
1680
1807
|
* Creates dynamic tool specs and a call handler that executes OpenClaw tools,
|
|
@@ -1700,6 +1827,7 @@ function createCodexDynamicToolBridge(params) {
|
|
|
1700
1827
|
emitQuarantinedDynamicToolDiagnostics(quarantinedTools, params.hookContext);
|
|
1701
1828
|
const telemetry = {
|
|
1702
1829
|
didSendViaMessagingTool: false,
|
|
1830
|
+
didDeliverSourceReplyViaMessageTool: false,
|
|
1703
1831
|
messagingToolSentTexts: [],
|
|
1704
1832
|
messagingToolSentMediaUrls: [],
|
|
1705
1833
|
messagingToolSentTargets: [],
|
|
@@ -1827,7 +1955,7 @@ function createCodexDynamicToolBridge(params) {
|
|
|
1827
1955
|
toolCallOrdinal: options?.toolCallOrdinal
|
|
1828
1956
|
});
|
|
1829
1957
|
const messagingTelemetryArgs = applyCurrentMessageProvider(toolName, executedArgs, params.hookContext?.currentChannelProvider);
|
|
1830
|
-
const messagingTarget = isMessagingTool(toolName)
|
|
1958
|
+
const messagingTarget = isMessagingTool(toolName) ? extractMessagingToolSend(toolName, messagingTelemetryArgs, messagingContext) : void 0;
|
|
1831
1959
|
const confirmedMessagingTarget = !rawIsError && messagingTarget ? extractMessagingToolSendResult(messagingTarget, telemetryRawResult) : messagingTarget;
|
|
1832
1960
|
collectToolTelemetry({
|
|
1833
1961
|
toolName,
|
|
@@ -1843,7 +1971,26 @@ function createCodexDynamicToolBridge(params) {
|
|
|
1843
1971
|
contentItems: convertToolContents(result.content, toolResultMaxChars),
|
|
1844
1972
|
success: !resultIsError
|
|
1845
1973
|
}, terminalType);
|
|
1846
|
-
|
|
1974
|
+
const blocksSourceReplyTermination = hasExplicitNonSourceMessageRoute(executedArgs, params.hookContext, confirmedMessagingTarget);
|
|
1975
|
+
const deliveredSourceReply = isDeliveredMessageToolOnlySourceReplyResult({
|
|
1976
|
+
sourceReplyDeliveryMode: params.hookContext?.sourceReplyDeliveryMode,
|
|
1977
|
+
toolName,
|
|
1978
|
+
args: executedArgs,
|
|
1979
|
+
result,
|
|
1980
|
+
hookResult: rawResult,
|
|
1981
|
+
isError: resultIsError,
|
|
1982
|
+
allowExplicitSourceRoute: !blocksSourceReplyTermination
|
|
1983
|
+
});
|
|
1984
|
+
const receiptConfirmedSourceReply = params.hookContext?.sourceReplyDeliveryMode === "message_tool_only" && toolName === "message" && normalizeRouteToken(typeof executedArgs.action === "string" ? executedArgs.action : void 0) === "reply" && !resultIsError && !blocksSourceReplyTermination && isDeliveredMessagingToolResult({
|
|
1985
|
+
toolName,
|
|
1986
|
+
args: executedArgs,
|
|
1987
|
+
result,
|
|
1988
|
+
hookResult: rawResult,
|
|
1989
|
+
isError: resultIsError
|
|
1990
|
+
}) && (replyReceiptMatchesCurrentMessage(rawResult, params.hookContext) || replyReceiptMatchesCurrentMessage(result, params.hookContext));
|
|
1991
|
+
const toolConfirmedSourceReply = params.hookContext?.sourceReplyDeliveryMode === "message_tool_only" && toolName === "message" && !resultIsError && (rawResult.terminate === true || result.terminate === true);
|
|
1992
|
+
if (deliveredSourceReply || receiptConfirmedSourceReply || toolConfirmedSourceReply) telemetry.didDeliverSourceReplyViaMessageTool = true;
|
|
1993
|
+
withDynamicToolTermination(response, rawResult.terminate === true || result.terminate === true || isToolResultYield(rawResult) || isToolResultYield(result) || deliveredSourceReply || receiptConfirmedSourceReply);
|
|
1847
1994
|
const asyncStarted = isAsyncStartedToolResult(rawResult) || isAsyncStartedToolResult(result);
|
|
1848
1995
|
withDynamicToolAsyncStarted(response, asyncStarted);
|
|
1849
1996
|
return withSideEffectEvidence(response, !(executionPrevented || !asyncStarted && isReplaySafeToolInstance(toolEntry.tool) && isReplaySafeToolCall(toolName, executedArgs)));
|
|
@@ -2155,7 +2302,16 @@ function collectToolTelemetry(params) {
|
|
|
2155
2302
|
if (media.audioAsVoice) params.telemetry.toolAudioAsVoice = true;
|
|
2156
2303
|
}
|
|
2157
2304
|
}
|
|
2158
|
-
if (!isMessagingTool(params.toolName)
|
|
2305
|
+
if (!isMessagingTool(params.toolName)) return;
|
|
2306
|
+
const isMessagingSendAction = isMessagingToolSendAction(params.toolName, params.args);
|
|
2307
|
+
if (!isMessagingSendAction && !params.messagingTarget) return;
|
|
2308
|
+
if (!isMessagingSendAction && !isDeliveredMessagingToolResult({
|
|
2309
|
+
toolName: params.toolName,
|
|
2310
|
+
args: params.args,
|
|
2311
|
+
result: params.result,
|
|
2312
|
+
hookResult: params.mediaTrustResult,
|
|
2313
|
+
isError: params.isError
|
|
2314
|
+
})) return;
|
|
2159
2315
|
params.telemetry.didSendViaMessagingTool = true;
|
|
2160
2316
|
const sourceReplyPayload = extractInternalSourceReplyPayload(params.result?.details);
|
|
2161
2317
|
if (sourceReplyPayload) {
|
|
@@ -2223,7 +2379,7 @@ function isCodexToolResultError(result) {
|
|
|
2223
2379
|
if (typeof details.exitCode === "number" && details.exitCode !== 0) return true;
|
|
2224
2380
|
if (typeof details.status !== "string") return false;
|
|
2225
2381
|
const status = details.status.trim().toLowerCase();
|
|
2226
|
-
return status !== "" && status !== "0" && status !== "ok" && status !== "success" && status !== "completed" && status !== "recorded" && status !== "pending" && status !== "started" && status !== "running" && status !== "yielded";
|
|
2382
|
+
return status !== "" && status !== "0" && status !== "ok" && status !== "success" && status !== "completed" && status !== "recorded" && status !== "created" && status !== "updated" && status !== "accepted" && status !== "found" && status !== "missing" && status !== "pending" && status !== "started" && status !== "running" && status !== "yielded";
|
|
2227
2383
|
}
|
|
2228
2384
|
function isToolResultYield(result) {
|
|
2229
2385
|
const details = result.details;
|
|
@@ -2593,13 +2749,13 @@ async function buildPluginPolicyElicitationResponse(params) {
|
|
|
2593
2749
|
const response = buildElicitationResponse(approvalPrompt, "approved-once");
|
|
2594
2750
|
if (isJsonObject(response) && response.action === "accept") {
|
|
2595
2751
|
if (mode === "allow") return response;
|
|
2596
|
-
return buildElicitationResponse(approvalPrompt, await requestPluginApprovalOutcome({
|
|
2752
|
+
return buildElicitationResponse(approvalPrompt, oneShotPluginPolicyApprovalOutcome(mode, await requestPluginApprovalOutcome({
|
|
2597
2753
|
paramsForRun: params.paramsForRun,
|
|
2598
2754
|
title: approvalPrompt.title,
|
|
2599
2755
|
description: approvalPrompt.description,
|
|
2600
|
-
allowedDecisions: approvalPrompt
|
|
2756
|
+
allowedDecisions: allowedPluginPolicyApprovalDecisions(mode, approvalPrompt),
|
|
2601
2757
|
signal: params.signal
|
|
2602
|
-
}));
|
|
2758
|
+
})));
|
|
2603
2759
|
}
|
|
2604
2760
|
logPluginElicitationDecline("unmappable_schema", params.requestParams);
|
|
2605
2761
|
return declineElicitationResponse();
|
|
@@ -2607,6 +2763,14 @@ async function buildPluginPolicyElicitationResponse(params) {
|
|
|
2607
2763
|
function resolvePluginDestructiveApprovalMode(entry) {
|
|
2608
2764
|
return entry.destructiveApprovalMode ?? (entry.allowDestructiveActions ? "allow" : "deny");
|
|
2609
2765
|
}
|
|
2766
|
+
function allowedPluginPolicyApprovalDecisions(mode, approvalPrompt) {
|
|
2767
|
+
const allowedDecisions = approvalPrompt.allowedDecisions ?? ["allow-once", "deny"];
|
|
2768
|
+
if (mode !== "ask") return allowedDecisions;
|
|
2769
|
+
return allowedDecisions.filter((decision) => decision !== "allow-always");
|
|
2770
|
+
}
|
|
2771
|
+
function oneShotPluginPolicyApprovalOutcome(mode, outcome) {
|
|
2772
|
+
return mode === "ask" && outcome === "approved-session" ? "approved-once" : outcome;
|
|
2773
|
+
}
|
|
2610
2774
|
function readPluginApprovalElicitation(entry, requestParams) {
|
|
2611
2775
|
if (readString(requestParams, "mode") !== "form" || !isJsonObject(requestParams.requestedSchema)) return;
|
|
2612
2776
|
const requestedSchema = requestParams.requestedSchema;
|
package/dist/provider-catalog.js
CHANGED
|
@@ -39,11 +39,12 @@ const FALLBACK_CODEX_MODELS = [{
|
|
|
39
39
|
*/
|
|
40
40
|
function buildCodexModelDefinition(model) {
|
|
41
41
|
const id = model.id.trim() || model.model.trim();
|
|
42
|
+
const supportedReasoningEfforts = model.supportedReasoningEfforts;
|
|
42
43
|
return {
|
|
43
44
|
id,
|
|
44
45
|
name: model.displayName?.trim() || id,
|
|
45
46
|
api: "openai-chatgpt-responses",
|
|
46
|
-
reasoning:
|
|
47
|
+
reasoning: supportedReasoningEfforts !== void 0 ? supportedReasoningEfforts.length > 0 : shouldDefaultToReasoningModel(id),
|
|
47
48
|
input: model.inputModalities.includes("image") ? ["text", "image"] : ["text"],
|
|
48
49
|
cost: {
|
|
49
50
|
input: 0,
|
|
@@ -54,7 +55,8 @@ function buildCodexModelDefinition(model) {
|
|
|
54
55
|
contextWindow: DEFAULT_CONTEXT_WINDOW,
|
|
55
56
|
maxTokens: DEFAULT_MAX_TOKENS,
|
|
56
57
|
compat: {
|
|
57
|
-
supportsReasoningEffort:
|
|
58
|
+
...supportedReasoningEfforts !== void 0 ? { supportsReasoningEffort: supportedReasoningEfforts.length > 0 } : {},
|
|
59
|
+
...supportedReasoningEfforts && supportedReasoningEfforts.length > 0 ? { supportedReasoningEfforts: [...supportedReasoningEfforts] } : {},
|
|
58
60
|
supportsUsageInStreaming: true
|
|
59
61
|
}
|
|
60
62
|
};
|
package/dist/provider.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as buildCodexProviderCatalog, r as
|
|
2
|
-
export { buildCodexProvider, buildCodexProviderCatalog, isModernCodexModel };
|
|
1
|
+
import { a as readCodexSupportedReasoningEfforts, i as isModernCodexModel, n as buildCodexProviderCatalog, o as resolveCodexSupportedReasoningEffort, r as isMaxReasoningCodexModel, t as buildCodexProvider } from "./provider-DosqwRb6.js";
|
|
2
|
+
export { buildCodexProvider, buildCodexProviderCatalog, isMaxReasoningCodexModel, isModernCodexModel, readCodexSupportedReasoningEfforts, resolveCodexSupportedReasoningEffort };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { a as getLeasedSharedCodexAppServerClient, i as createIsolatedCodexAppServerClient, l as withTimeout, o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-
|
|
3
|
-
import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-
|
|
2
|
+
import { a as getLeasedSharedCodexAppServerClient, i as createIsolatedCodexAppServerClient, l as withTimeout, o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-rR6TDJA3.js";
|
|
3
|
+
import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-pTY2COoC.js";
|
|
4
4
|
//#region extensions/codex/src/app-server/request.ts
|
|
5
5
|
var request_exports = /* @__PURE__ */ __exportAll({ requestCodexAppServerJson: () => requestCodexAppServerJson });
|
|
6
6
|
async function requestCodexAppServerJson(params) {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { n as isJsonObject, t as flattenCodexDynamicToolFunctions } from "./protocol-dh-ETiNd.js";
|
|
2
|
-
import { A as resolveCodexContextEngineProjectionReserveTokens, D as fitCodexProjectedContextForTurnStart, E as resolveCodexDynamicToolsLoadingForRuntime, H as
|
|
3
|
-
import { C as readCodexNotificationItem, D as
|
|
4
|
-
import { _ as withMcpElicitationsApprovalPolicy, a as isCodexAppServerApprovalPolicyAllowedByRequirements, d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig, g as shouldAutoApproveCodexAppServerApprovals, h as resolveOpenClawExecPolicyForCodexAppServer, m as resolveCodexPluginsPolicy, p as resolveCodexModelBackedReviewerPolicyContext, s as isCodexSandboxExecServerEnabled, u as readCodexPluginConfig } from "./config-
|
|
5
|
-
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-
|
|
6
|
-
import {
|
|
7
|
-
import { a as isCodexAppServerConnectionClosedError, i as isCodexAppServerApprovalRequest, n as CodexAppServerRpcError, r as compareCodexAppServerVersions
|
|
8
|
-
import { i as isCodexAppServerNativeAuthProfile, l as writeCodexAppServerBinding, n as clearCodexAppServerBinding, o as readCodexAppServerBinding, r as clearCodexAppServerBindingForThread } from "./session-binding-
|
|
9
|
-
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS, t as buildCodexAppServerRuntimeFingerprint } from "./plugin-app-cache-key-
|
|
10
|
-
import { a as formatCodexDisplayText, n as resolveCodexAppServerForOpenClawToolPolicy, t as resolveCodexAppServerForModelProvider } from "./app-server-policy-
|
|
11
|
-
import { d as resolveCodexAppServerAuthAccountCacheKey, f as resolveCodexAppServerAuthProfileId, h as resolveCodexAppServerHomeDir, m as resolveCodexAppServerFallbackApiKeyCacheKey, n as clearSharedCodexAppServerClientIfCurrentAndUnclaimed, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, s as retireSharedCodexAppServerClientIfCurrent, t as clearSharedCodexAppServerClientIfCurrent, u as refreshCodexAppServerAuthTokens } from "./shared-client-
|
|
12
|
-
import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-
|
|
13
|
-
import { A as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, C as resolveCodexMessageToolProvider, D as shouldWarnCodexDynamicToolBuildStageSummary, E as shouldRequireCodexSandboxExecServerEnvironment, F as resolveCodexTurnTerminalIdleTimeoutMs, I as withCodexStartupTimeout, M as resolveCodexStartupTimeoutMs, N as resolveCodexTurnAssistantCompletionIdleTimeoutMs, P as resolveCodexTurnCompletionIdleTimeoutMs, S as resolveCodexExternalSandboxPolicyForOpenClawSandbox, T as shouldEnableCodexAppServerNativeToolSurface, _ as createCodexDynamicToolBuildStageTracker, a as buildCodexNativeHookRelayConfig, b as resolveCodexAppServerExecutionCwd, c as resolveCodexNativeHookRelayEvents, d as handleCodexAppServerElicitationRequest, f as createCodexDynamicToolBridge, g as buildDynamicTools, h as emitDynamicToolTerminalDiagnostic, i as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, j as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, k as handleCodexAppServerApprovalRequest, l as resolveCodexNativeHookRelayTtlMs, m as emitDynamicToolStartedDiagnostic, o as buildCodexNativeHookRelayDisabledConfig, p as emitDynamicToolErrorDiagnostic, s as createCodexNativeHookRelay, t as resolveCodexProviderWebSearchSupport, u as scheduleCodexNativeHookRelayUnregister, v as disableCodexPluginThreadConfig, w as resolveCodexSandboxEnvironmentSelection, x as resolveCodexAppServerHookChannelId, y as formatCodexDynamicToolBuildStageSummary } from "./provider-capabilities-
|
|
14
|
-
import { t as ensureCodexComputerUse } from "./computer-use-
|
|
2
|
+
import { A as resolveCodexContextEngineProjectionReserveTokens, B as describeCodexNotificationCorrelation, D as fitCodexProjectedContextForTurnStart, E as resolveCodexDynamicToolsLoadingForRuntime, F as shouldBuildCodexPluginThreadConfig, H as readCodexNotificationThreadId, M as buildCodexPluginThreadConfig, N as buildCodexPluginThreadConfigInputFingerprint, O as projectContextEngineAssemblyForCodex, P as mergeCodexThreadConfigs, U as readCodexNotificationTurnId, _ as resolveCodexWebSearchPlan, a as buildDeveloperInstructions, b as sanitizeCodexHistoryImagePayloads, c as codexDynamicToolsFingerprint, f as resolveCodexAppServerThreadModelSelection, h as startOrResumeThread, i as buildContextEngineBinding, k as resolveCodexContextEngineProjectionMaxChars, l as isContextEngineBindingCompatible, n as areCodexDynamicToolFingerprintsCompatible, o as buildTurnCollaborationMode, s as buildTurnStartParams, v as isCodexAppServerProfilerEnabled, z as defaultCodexAppInventoryCache } from "./thread-lifecycle-DeSMZSXr.js";
|
|
3
|
+
import { C as readCodexNotificationItem, D as updateActiveCompletionBlockerItemIds, E as shouldDisarmAssistantCompletionIdleWatch, O as updateActiveTurnItemIds, S as isTurnNotification, T as readRawResponseToolCallId, _ as isRawToolOutputCompletionNotification, a as isCodexNotificationOutsideActiveRun, b as isRetryableErrorNotification, c as isCurrentThreadOptionalTurnRequestParams, d as isNativeResponseStreamDeltaNotification, f as isNativeToolProgressNotification, g as isRawReasoningCompletionNotification, h as isRawFunctionToolOutputCompletionNotification, i as isAssistantCompletionReleaseNotification, l as isCurrentThreadTurnRequestParams, m as isRawAssistantProgressNotification, n as describeNotificationActivity, o as isCodexTurnAbortMarkerNotification, p as isPendingOpenClawDynamicToolCompletionNotification, r as isAssistantCommentaryCompletionNotification, s as isCurrentApprovalTurnRequestParams, t as codexExecutionToolName, u as isFileChangePatchUpdatedNotification, v as isReasoningItemCompletionNotification, w as readNotificationItemId, x as isTerminalTurnStatus, y as isReasoningProgressNotification } from "./attempt-notifications-l9LElGOU.js";
|
|
4
|
+
import { _ as withMcpElicitationsApprovalPolicy, a as isCodexAppServerApprovalPolicyAllowedByRequirements, d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig, g as shouldAutoApproveCodexAppServerApprovals, h as resolveOpenClawExecPolicyForCodexAppServer, m as resolveCodexPluginsPolicy, p as resolveCodexModelBackedReviewerPolicyContext, s as isCodexSandboxExecServerEnabled, u as readCodexPluginConfig } from "./config-C_whBx3M.js";
|
|
5
|
+
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-CB4mtyrs.js";
|
|
6
|
+
import { l as resolveCodexUsageLimitResetAtMs, s as formatCodexUsageLimitErrorMessage, u as shouldRefreshCodexRateLimitsForUsageLimitMessage } from "./provider-DosqwRb6.js";
|
|
7
|
+
import { a as isCodexAppServerConnectionClosedError, c as MIN_CODEX_SANDBOX_EXEC_SERVER_APP_SERVER_VERSION, i as isCodexAppServerApprovalRequest, n as CodexAppServerRpcError, r as compareCodexAppServerVersions } from "./client-IcTBKEqA.js";
|
|
8
|
+
import { i as isCodexAppServerNativeAuthProfile, l as writeCodexAppServerBinding, n as clearCodexAppServerBinding, o as readCodexAppServerBinding, r as clearCodexAppServerBindingForThread } from "./session-binding-Cm0Gg7Z1.js";
|
|
9
|
+
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS, t as buildCodexAppServerRuntimeFingerprint } from "./plugin-app-cache-key-CDioyur-.js";
|
|
10
|
+
import { a as formatCodexDisplayText, n as resolveCodexAppServerForOpenClawToolPolicy, t as resolveCodexAppServerForModelProvider } from "./app-server-policy-xi0ZmBGO.js";
|
|
11
|
+
import { d as resolveCodexAppServerAuthAccountCacheKey, f as resolveCodexAppServerAuthProfileId, h as resolveCodexAppServerHomeDir, m as resolveCodexAppServerFallbackApiKeyCacheKey, n as clearSharedCodexAppServerClientIfCurrentAndUnclaimed, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, s as retireSharedCodexAppServerClientIfCurrent, t as clearSharedCodexAppServerClientIfCurrent, u as refreshCodexAppServerAuthTokens } from "./shared-client-rR6TDJA3.js";
|
|
12
|
+
import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-CwjdQQ4j.js";
|
|
13
|
+
import { A as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, C as resolveCodexMessageToolProvider, D as shouldWarnCodexDynamicToolBuildStageSummary, E as shouldRequireCodexSandboxExecServerEnvironment, F as resolveCodexTurnTerminalIdleTimeoutMs, I as withCodexStartupTimeout, M as resolveCodexStartupTimeoutMs, N as resolveCodexTurnAssistantCompletionIdleTimeoutMs, P as resolveCodexTurnCompletionIdleTimeoutMs, S as resolveCodexExternalSandboxPolicyForOpenClawSandbox, T as shouldEnableCodexAppServerNativeToolSurface, _ as createCodexDynamicToolBuildStageTracker, a as buildCodexNativeHookRelayConfig, b as resolveCodexAppServerExecutionCwd, c as resolveCodexNativeHookRelayEvents, d as handleCodexAppServerElicitationRequest, f as createCodexDynamicToolBridge, g as buildDynamicTools, h as emitDynamicToolTerminalDiagnostic, i as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, j as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, k as handleCodexAppServerApprovalRequest, l as resolveCodexNativeHookRelayTtlMs, m as emitDynamicToolStartedDiagnostic, o as buildCodexNativeHookRelayDisabledConfig, p as emitDynamicToolErrorDiagnostic, s as createCodexNativeHookRelay, t as resolveCodexProviderWebSearchSupport, u as scheduleCodexNativeHookRelayUnregister, v as disableCodexPluginThreadConfig, w as resolveCodexSandboxEnvironmentSelection, x as resolveCodexAppServerHookChannelId, y as formatCodexDynamicToolBuildStageSummary } from "./provider-capabilities-CE5k8cmO.js";
|
|
14
|
+
import { t as ensureCodexComputerUse } from "./computer-use-FPGG-mtX.js";
|
|
15
15
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-C7qmZ0Jh.js";
|
|
16
16
|
import fs from "node:fs/promises";
|
|
17
17
|
import path, { posix } from "node:path";
|
|
@@ -947,6 +947,7 @@ function applyCodexTurnNotificationState(params) {
|
|
|
947
947
|
});
|
|
948
948
|
params.onReportExecutionNotification(notification);
|
|
949
949
|
updateActiveTurnItemIds(notification, params.activeTurnItemIds);
|
|
950
|
+
updateActiveCompletionBlockerItemIds(notification, params.activeCompletionBlockerItemIds);
|
|
950
951
|
if (notification.method === "item/completed" && params.activeTurnItemIds.size === 0) params.onScheduleTerminalDynamicToolReleaseCheck();
|
|
951
952
|
}
|
|
952
953
|
const unblockedAssistantCompletionRelease = isCurrentTurnNotification && turnWatches.isAssistantCompletionIdleWatchArmed() && notification.method === "item/completed" && params.activeTurnItemIds.size === 0;
|
|
@@ -2628,6 +2629,7 @@ async function startCodexAttemptThread(params) {
|
|
|
2628
2629
|
timeoutMs: params.appServer.requestTimeoutMs,
|
|
2629
2630
|
signal
|
|
2630
2631
|
}),
|
|
2632
|
+
configCwd: startupExecutionCwd,
|
|
2631
2633
|
appCache: defaultCodexAppInventoryCache,
|
|
2632
2634
|
appCacheKey: pluginAppCacheKey
|
|
2633
2635
|
})
|
|
@@ -2902,7 +2904,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
2902
2904
|
};
|
|
2903
2905
|
function scheduleCompletionIdleWatch() {
|
|
2904
2906
|
clearCompletionIdleTimer();
|
|
2905
|
-
if (params.isCompleted() || params.signal.aborted || !completionIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0) return;
|
|
2907
|
+
if (params.isCompleted() || params.signal.aborted || !completionIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0 || params.getActiveCompletionBlockerItemCount() > 0) return;
|
|
2906
2908
|
const elapsedMs = Math.max(0, Date.now() - completionLastActivityAt);
|
|
2907
2909
|
const delayMs = Math.max(1, (completionIdleTimeoutOverrideMs ?? turnCompletionIdleTimeoutMs) - elapsedMs);
|
|
2908
2910
|
completionIdleTimer = setTimeout(fireCompletionIdleTimeout, delayMs);
|
|
@@ -2938,7 +2940,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
2938
2940
|
scheduleTerminalIdleWatch();
|
|
2939
2941
|
}
|
|
2940
2942
|
function isCompletionIdleTimeoutDueBeforeAttempt(timeoutMs) {
|
|
2941
|
-
if (params.isCompleted() || params.isTerminalTurnNotificationQueued() || params.signal.aborted || !completionIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0) return false;
|
|
2943
|
+
if (params.isCompleted() || params.isTerminalTurnNotificationQueued() || params.signal.aborted || !completionIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0 || params.getActiveCompletionBlockerItemCount() > 0) return false;
|
|
2942
2944
|
const completionTimeoutMs = completionIdleTimeoutOverrideMs ?? turnCompletionIdleTimeoutMs;
|
|
2943
2945
|
if (completionTimeoutMs > timeoutMs) return false;
|
|
2944
2946
|
return Math.max(0, Date.now() - completionLastActivityAt) >= completionTimeoutMs;
|
|
@@ -3028,7 +3030,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3028
3030
|
params.onAbort("turn_progress_idle_timeout");
|
|
3029
3031
|
}
|
|
3030
3032
|
function fireCompletionIdleTimeout() {
|
|
3031
|
-
if (params.isCompleted() || params.isTerminalTurnNotificationQueued() || params.signal.aborted || !completionIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0) return;
|
|
3033
|
+
if (params.isCompleted() || params.isTerminalTurnNotificationQueued() || params.signal.aborted || !completionIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0 || params.getActiveCompletionBlockerItemCount() > 0) return;
|
|
3032
3034
|
const timeoutMs = completionIdleTimeoutOverrideMs ?? turnCompletionIdleTimeoutMs;
|
|
3033
3035
|
const idleMs = Math.max(0, Date.now() - completionLastActivityAt);
|
|
3034
3036
|
if (idleMs < timeoutMs) {
|
|
@@ -3974,6 +3976,7 @@ var CodexAppServerEventProjector = class {
|
|
|
3974
3976
|
currentAttemptAssistant,
|
|
3975
3977
|
...this.lastNativeToolError ? { lastToolError: this.lastNativeToolError } : {},
|
|
3976
3978
|
didSendViaMessagingTool: toolTelemetry.didSendViaMessagingTool,
|
|
3979
|
+
didDeliverSourceReplyViaMessageTool: toolTelemetry.didDeliverSourceReplyViaMessageTool === true,
|
|
3977
3980
|
messagingToolSentTexts: toolTelemetry.messagingToolSentTexts,
|
|
3978
3981
|
messagingToolSentMediaUrls: toolTelemetry.messagingToolSentMediaUrls,
|
|
3979
3982
|
messagingToolSentTargets: toolTelemetry.messagingToolSentTargets,
|
|
@@ -7112,6 +7115,7 @@ const JWT_VALUE_RE = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]
|
|
|
7112
7115
|
const COOKIE_PAIR_RE = /\b([A-Za-z][A-Za-z0-9_.-]{1,64})=([A-Za-z0-9+/._~%=-]{16,})(?=;|\s|$)/gu;
|
|
7113
7116
|
const TRAJECTORY_RUNTIME_FILE_MAX_BYTES = 50 * 1024 * 1024;
|
|
7114
7117
|
const TRAJECTORY_RUNTIME_EVENT_MAX_BYTES = 256 * 1024;
|
|
7118
|
+
const TRAJECTORY_RUNTIME_OVERSIZE_PRESERVED_DATA_KEYS = ["usage", "promptCache"];
|
|
7115
7119
|
/** Resolves secure create/truncate flags for trajectory pointer files. */
|
|
7116
7120
|
function resolveCodexTrajectoryPointerFlags(constants = fsSync.constants) {
|
|
7117
7121
|
const noFollow = constants.O_NOFOLLOW;
|
|
@@ -7129,16 +7133,41 @@ function boundedTrajectoryLine(event) {
|
|
|
7129
7133
|
const line = JSON.stringify(event);
|
|
7130
7134
|
const bytes = Buffer.byteLength(line, "utf8");
|
|
7131
7135
|
if (bytes <= TRAJECTORY_RUNTIME_EVENT_MAX_BYTES) return `${line}\n`;
|
|
7132
|
-
const
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7136
|
+
const originalData = event.data && typeof event.data === "object" && !Array.isArray(event.data) ? event.data : {};
|
|
7137
|
+
const originalDataKeys = Object.keys(originalData);
|
|
7138
|
+
const preservedDataKeys = /* @__PURE__ */ new Set();
|
|
7139
|
+
const baseData = {
|
|
7140
|
+
truncated: true,
|
|
7141
|
+
originalBytes: bytes,
|
|
7142
|
+
limitBytes: TRAJECTORY_RUNTIME_EVENT_MAX_BYTES,
|
|
7143
|
+
reason: "trajectory-event-size-limit"
|
|
7144
|
+
};
|
|
7145
|
+
const buildTruncatedLine = (includeDroppedFields) => {
|
|
7146
|
+
const data = { ...baseData };
|
|
7147
|
+
for (const key of TRAJECTORY_RUNTIME_OVERSIZE_PRESERVED_DATA_KEYS) if (preservedDataKeys.has(key)) data[key] = originalData[key];
|
|
7148
|
+
if (includeDroppedFields) {
|
|
7149
|
+
const droppedFields = originalDataKeys.filter((key) => !preservedDataKeys.has(key));
|
|
7150
|
+
if (droppedFields.length > 0) data.droppedFields = droppedFields;
|
|
7151
|
+
}
|
|
7152
|
+
const truncated = JSON.stringify({
|
|
7153
|
+
...event,
|
|
7154
|
+
data
|
|
7155
|
+
});
|
|
7156
|
+
if (Buffer.byteLength(truncated, "utf8") <= TRAJECTORY_RUNTIME_EVENT_MAX_BYTES) return `${truncated}\n`;
|
|
7157
|
+
};
|
|
7158
|
+
let best = buildTruncatedLine(true) ?? buildTruncatedLine(false);
|
|
7159
|
+
if (!best) return;
|
|
7160
|
+
for (const key of TRAJECTORY_RUNTIME_OVERSIZE_PRESERVED_DATA_KEYS) {
|
|
7161
|
+
if (!Object.hasOwn(originalData, key)) continue;
|
|
7162
|
+
preservedDataKeys.add(key);
|
|
7163
|
+
const next = buildTruncatedLine(true) ?? buildTruncatedLine(false);
|
|
7164
|
+
if (next) {
|
|
7165
|
+
best = next;
|
|
7166
|
+
continue;
|
|
7139
7167
|
}
|
|
7140
|
-
|
|
7141
|
-
|
|
7168
|
+
preservedDataKeys.delete(key);
|
|
7169
|
+
}
|
|
7170
|
+
return best;
|
|
7142
7171
|
}
|
|
7143
7172
|
function resolveTrajectoryPointerFilePath(sessionFile) {
|
|
7144
7173
|
return sessionFile.endsWith(".jsonl") ? `${sessionFile.slice(0, -6)}.trajectory-path.json` : `${sessionFile}.trajectory-path.json`;
|
|
@@ -8021,9 +8050,11 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8021
8050
|
currentChannelProvider: resolveCodexMessageToolProvider(params),
|
|
8022
8051
|
currentChannelId: params.currentChannelId,
|
|
8023
8052
|
currentMessagingTarget: params.currentMessagingTarget,
|
|
8053
|
+
currentMessageId: params.currentMessageId,
|
|
8024
8054
|
currentThreadId: params.currentThreadTs,
|
|
8025
8055
|
replyToMode: params.replyToMode,
|
|
8026
8056
|
hasRepliedRef: params.hasRepliedRef,
|
|
8057
|
+
sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
|
|
8027
8058
|
onToolOutcome: onCodexToolOutcome,
|
|
8028
8059
|
allocateToolOutcomeOrdinal: allocateCodexToolOutcomeOrdinal
|
|
8029
8060
|
}
|
|
@@ -8193,6 +8224,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8193
8224
|
developerInstructions,
|
|
8194
8225
|
messages: codexModelInputHistoryMessages,
|
|
8195
8226
|
ctx: hookContext,
|
|
8227
|
+
bootstrapContextRunKind: params.bootstrapContextRunKind,
|
|
8196
8228
|
..."beforeAgentStartResult" in params ? { beforeAgentStartResult: params.beforeAgentStartResult } : {}
|
|
8197
8229
|
});
|
|
8198
8230
|
const resolveShiftedPromptInputRange = (prompt, promptInputRange, turnPromptText) => {
|
|
@@ -8488,6 +8520,46 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8488
8520
|
client = startupResult.client;
|
|
8489
8521
|
thread = startupResult.thread;
|
|
8490
8522
|
pluginAppServer = startupResult.pluginAppServer;
|
|
8523
|
+
if (thread.lifecycle.action === "started") {
|
|
8524
|
+
const activeThreadReviewerPolicyContext = resolveCodexModelBackedReviewerPolicyContext({
|
|
8525
|
+
provider: params.provider,
|
|
8526
|
+
model: params.modelId,
|
|
8527
|
+
bindingModelProvider: thread.modelProvider,
|
|
8528
|
+
bindingModel: thread.model,
|
|
8529
|
+
nativeAuthProfile: isCodexAppServerNativeAuthProfile({
|
|
8530
|
+
authProfileId: startupAuthProfileId,
|
|
8531
|
+
authProfileStore: params.authProfileStore,
|
|
8532
|
+
agentDir,
|
|
8533
|
+
config: params.config
|
|
8534
|
+
})
|
|
8535
|
+
});
|
|
8536
|
+
const activeThreadAppServer = resolveCodexAppServerForModelProvider({
|
|
8537
|
+
appServer: resolveCodexAppServerRuntimeOptions({
|
|
8538
|
+
pluginConfig,
|
|
8539
|
+
execPolicy,
|
|
8540
|
+
modelProvider: activeThreadReviewerPolicyContext.modelProvider,
|
|
8541
|
+
model: activeThreadReviewerPolicyContext.model,
|
|
8542
|
+
config: params.config,
|
|
8543
|
+
agentDir,
|
|
8544
|
+
openClawSandboxActive: sandbox?.enabled === true
|
|
8545
|
+
}),
|
|
8546
|
+
provider: activeThreadReviewerPolicyContext.modelProvider,
|
|
8547
|
+
model: activeThreadReviewerPolicyContext.model,
|
|
8548
|
+
config: params.config,
|
|
8549
|
+
env: process.env,
|
|
8550
|
+
agentDir
|
|
8551
|
+
});
|
|
8552
|
+
const previousApprovalsReviewer = pluginAppServer.approvalsReviewer;
|
|
8553
|
+
pluginAppServer = {
|
|
8554
|
+
...pluginAppServer,
|
|
8555
|
+
approvalsReviewer: activeThreadAppServer.approvalsReviewer
|
|
8556
|
+
};
|
|
8557
|
+
if (pluginAppServer.approvalsReviewer !== previousApprovalsReviewer) embeddedAgentLog.info("codex app-server approval reviewer updated from active thread model provider", {
|
|
8558
|
+
from: previousApprovalsReviewer,
|
|
8559
|
+
to: pluginAppServer.approvalsReviewer,
|
|
8560
|
+
modelProvider: activeThreadReviewerPolicyContext.modelProvider
|
|
8561
|
+
});
|
|
8562
|
+
}
|
|
8491
8563
|
sandboxExecEnvironmentAcquired = Boolean(startupResult.sandboxEnvironment);
|
|
8492
8564
|
codexEnvironmentSelection = startupResult.environmentSelection;
|
|
8493
8565
|
codexExecutionCwd = startupResult.executionCwd;
|
|
@@ -8546,12 +8618,13 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8546
8618
|
const turnCompletionIdleTimeoutMs = resolveCodexTurnCompletionIdleTimeoutMs(options.turnCompletionIdleTimeoutMs ?? appServer.turnCompletionIdleTimeoutMs);
|
|
8547
8619
|
const turnAssistantCompletionIdleTimeoutMs = resolveCodexTurnAssistantCompletionIdleTimeoutMs(options.turnAssistantCompletionIdleTimeoutMs);
|
|
8548
8620
|
const postToolRawAssistantCompletionIdleTimeoutMs = resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs(options.postToolRawAssistantCompletionIdleTimeoutMs ?? appServer.postToolRawAssistantCompletionIdleTimeoutMs, turnAssistantCompletionIdleTimeoutMs);
|
|
8549
|
-
const turnTerminalIdleTimeoutMs = resolveCodexTurnTerminalIdleTimeoutMs(options.turnTerminalIdleTimeoutMs);
|
|
8621
|
+
const turnTerminalIdleTimeoutMs = resolveCodexTurnTerminalIdleTimeoutMs(options.turnTerminalIdleTimeoutMs, params.runTimeoutOverrideMs);
|
|
8550
8622
|
const turnAttemptIdleTimeoutMs = Math.max(100, Math.floor(params.timeoutMs));
|
|
8551
8623
|
let nativeHookRelayLastRenewedAt = 0;
|
|
8552
8624
|
let activeAppServerTurnRequests = 0;
|
|
8553
8625
|
const pendingOpenClawDynamicToolCompletionIds = /* @__PURE__ */ new Set();
|
|
8554
8626
|
const activeTurnItemIds = /* @__PURE__ */ new Set();
|
|
8627
|
+
const activeCompletionBlockerItemIds = /* @__PURE__ */ new Set();
|
|
8555
8628
|
let turnCrossedToolHandoff = false;
|
|
8556
8629
|
let pendingTerminalDynamicToolRelease;
|
|
8557
8630
|
let terminalDynamicToolReleaseCheckScheduled = false;
|
|
@@ -8582,6 +8655,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8582
8655
|
isTerminalTurnNotificationQueued: () => terminalTurnNotificationQueued,
|
|
8583
8656
|
getActiveAppServerTurnRequests: () => activeAppServerTurnRequests,
|
|
8584
8657
|
getActiveTurnItemCount: () => activeTurnItemIds.size,
|
|
8658
|
+
getActiveCompletionBlockerItemCount: () => activeCompletionBlockerItemIds.size,
|
|
8585
8659
|
turnCompletionIdleTimeoutMs,
|
|
8586
8660
|
turnAssistantCompletionIdleTimeoutMs,
|
|
8587
8661
|
turnAttemptIdleTimeoutMs,
|
|
@@ -8793,6 +8867,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8793
8867
|
currentPromptTexts: [codexTurnPromptText],
|
|
8794
8868
|
turnWatches,
|
|
8795
8869
|
activeTurnItemIds,
|
|
8870
|
+
activeCompletionBlockerItemIds,
|
|
8796
8871
|
activeAppServerTurnRequests,
|
|
8797
8872
|
pendingOpenClawDynamicToolCompletionIds,
|
|
8798
8873
|
turnCrossedToolHandoff,
|
|
@@ -9506,12 +9581,13 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
9506
9581
|
kind: "embedded",
|
|
9507
9582
|
queueMessage: async (text, optionsLocal) => activeSteeringQueue.queue(text, optionsLocal),
|
|
9508
9583
|
isStreaming: () => !completed && !runAbortController.signal.aborted,
|
|
9584
|
+
isStopped: () => completed || timedOut || runAbortController.signal.aborted,
|
|
9509
9585
|
isCompacting: () => projectorRef.current?.isCompacting() ?? false,
|
|
9510
9586
|
sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
|
|
9511
9587
|
cancel: () => runAbortController.abort("cancelled"),
|
|
9512
9588
|
abort: () => runAbortController.abort("aborted")
|
|
9513
9589
|
};
|
|
9514
|
-
setActiveEmbeddedRun(params.sessionId, handle, params.sessionKey);
|
|
9590
|
+
setActiveEmbeddedRun(params.sessionId, handle, params.sessionKey, params.sessionFile);
|
|
9515
9591
|
const notifyUserMessagePersisted = createCodexAppServerUserMessagePersistenceNotifier(params);
|
|
9516
9592
|
mirrorPromptAtTurnStartBestEffort({
|
|
9517
9593
|
params,
|
|
@@ -9648,6 +9724,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
9648
9724
|
});
|
|
9649
9725
|
if (activeContextEngine) {
|
|
9650
9726
|
const activeContextEnginePluginIdLocal = resolveContextEngineOwnerPluginId(activeContextEngine);
|
|
9727
|
+
const isHeartbeatLifecycleRun = params.bootstrapContextRunKind === "heartbeat" || params.bootstrapContextRunKind === "commitment-only";
|
|
9651
9728
|
const finalMessages = await readMirroredSessionHistoryMessages(activeTranscriptTarget) ?? historyMessages.concat(result.messagesSnapshot);
|
|
9652
9729
|
await finalizeHarnessContextEngineTurn({
|
|
9653
9730
|
contextEngine: activeContextEngine,
|
|
@@ -9680,7 +9757,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
9680
9757
|
runMaintenance: runHarnessContextEngineMaintenance,
|
|
9681
9758
|
config: params.config,
|
|
9682
9759
|
warn: (message) => embeddedAgentLog.warn(message),
|
|
9683
|
-
isHeartbeat:
|
|
9760
|
+
isHeartbeat: isHeartbeatLifecycleRun
|
|
9684
9761
|
});
|
|
9685
9762
|
}
|
|
9686
9763
|
runAgentHarnessLlmOutputHook({
|
|
@@ -9779,7 +9856,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
9779
9856
|
runAbortController.signal.removeEventListener("abort", abortListener);
|
|
9780
9857
|
params.abortSignal?.removeEventListener("abort", abortFromUpstream);
|
|
9781
9858
|
steeringQueueRef.current?.cancel();
|
|
9782
|
-
clearActiveEmbeddedRun(params.sessionId, handle, params.sessionKey);
|
|
9859
|
+
clearActiveEmbeddedRun(params.sessionId, handle, params.sessionKey, params.sessionFile);
|
|
9783
9860
|
}
|
|
9784
9861
|
}
|
|
9785
9862
|
function readDynamicToolCallParams(value) {
|
|
@@ -135,6 +135,8 @@ const DIRECT_METHOD_POLICIES = new Map([
|
|
|
135
135
|
["account/read", "allowed-control-plane"],
|
|
136
136
|
["app/list", "allowed-control-plane"],
|
|
137
137
|
["config/mcpServer/reload", "allowed-control-plane"],
|
|
138
|
+
["config/read", "allowed-control-plane"],
|
|
139
|
+
["config/value/write", "allowed-control-plane"],
|
|
138
140
|
["environment/add", "allowed-control-plane"],
|
|
139
141
|
["experimentalFeature/enablement/set", "allowed-control-plane"],
|
|
140
142
|
["feedback/upload", "allowed-control-plane"],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { l as normalizeCodexServiceTier } from "./config-
|
|
2
|
+
import { l as normalizeCodexServiceTier } from "./config-C_whBx3M.js";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
|
|
5
5
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -221,6 +221,7 @@ function readDestructiveApprovalMode(value, bindingSchemaVersion) {
|
|
|
221
221
|
if (value === "deny") return "deny";
|
|
222
222
|
if (value === "allow") return "allow";
|
|
223
223
|
if (value === "auto") return bindingSchemaVersion === 1 ? "allow" : "auto";
|
|
224
|
+
if (value === "ask" && bindingSchemaVersion === 2) return "ask";
|
|
224
225
|
if (value === "on-request" && bindingSchemaVersion === 1) return "auto";
|
|
225
226
|
return "invalid";
|
|
226
227
|
}
|