zidane 6.5.4 → 6.5.6
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/{acp-CIpD8UIw.js → acp-Dm95NwNM.js} +6 -6
- package/dist/{acp-CIpD8UIw.js.map → acp-Dm95NwNM.js.map} +1 -1
- package/dist/acp-cli.js +6 -6
- package/dist/acp.d.ts +1 -1
- package/dist/acp.js +1 -1
- package/dist/{agent-8kfGIDb_.js → agent-CcTWL-Z6.js} +231 -167
- package/dist/agent-CcTWL-Z6.js.map +1 -0
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/{anthropic-qaw8XAc9.js → anthropic-DLc_Kw-1.js} +420 -25
- package/dist/anthropic-DLc_Kw-1.js.map +1 -0
- package/dist/{auth-BLy7X1SY.js → auth-BAclQnl3.js} +127 -35
- package/dist/{auth-BLy7X1SY.js.map → auth-BAclQnl3.js.map} +1 -1
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat/pure.js +2 -2
- package/dist/chat.d.ts +115 -9
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +8 -8
- package/dist/{context-segments-1mcqSCM3.js → context-segments-CJCtJ9sU.js} +16 -3
- package/dist/{context-segments-1mcqSCM3.js.map → context-segments-CJCtJ9sU.js.map} +1 -1
- package/dist/{context-transport-Bco9Wo0b.js → context-transport-D8yeGdpd.js} +2 -2
- package/dist/{context-transport-Bco9Wo0b.js.map → context-transport-D8yeGdpd.js.map} +1 -1
- package/dist/contexts/daytona.d.ts +1 -1
- package/dist/contexts/daytona.js +1 -1
- package/dist/contexts/e2b.d.ts +1 -1
- package/dist/{errors-BwBxu3zD.js → errors-DKiMrOKq.js} +61 -2
- package/dist/{errors-BwBxu3zD.js.map → errors-DKiMrOKq.js.map} +1 -1
- package/dist/errors.js +2 -2
- package/dist/eval.d.ts +1 -1
- package/dist/eval.js +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +1 -1
- package/dist/{fetch-url-B7aSg6Bp.js → fetch-url-ma-5_p0p.js} +2 -2
- package/dist/{fetch-url-B7aSg6Bp.js.map → fetch-url-ma-5_p0p.js.map} +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +3 -3
- package/dist/{index-BSNr0OQn.d.ts → index-ZWibV230.d.ts} +100 -28
- package/dist/index-ZWibV230.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -13
- package/dist/{login-D3CKhgbI.js → login-CB23LyI1.js} +3 -3
- package/dist/{login-D3CKhgbI.js.map → login-CB23LyI1.js.map} +1 -1
- package/dist/{mcp-D9fqOQo5.js → mcp-CVtSQTWg.js} +3 -3
- package/dist/{mcp-D9fqOQo5.js.map → mcp-CVtSQTWg.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{messages-C_H9soi5.js → messages-CZMUuKzo.js} +2 -2
- package/dist/{messages-C_H9soi5.js.map → messages-CZMUuKzo.js.map} +1 -1
- package/dist/{oauth-ZebH9NHb.js → oauth-C4GvY_p1.js} +27 -8
- package/dist/oauth-C4GvY_p1.js.map +1 -0
- package/dist/{openai-compat-CnHeo4Lz.js → openai-compat-BoTi-9fd.js} +9 -4
- package/dist/openai-compat-BoTi-9fd.js.map +1 -0
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/{plugins-2PMTVcp-.js → plugins-onDvTHEm.js} +2 -2
- package/dist/{plugins-2PMTVcp-.js.map → plugins-onDvTHEm.js.map} +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/arcee.js +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/baseten.js +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/local.js +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai-compat.js +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +4 -4
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +2 -2
- package/dist/{providers-Bxs-XHir.js → providers-CmhdtD7w.js} +3 -3
- package/dist/{providers-Bxs-XHir.js.map → providers-CmhdtD7w.js.map} +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +4 -4
- package/dist/restate.d.ts +1 -1
- package/dist/restate.js +2 -2
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session/sqlite.js +1 -1
- package/dist/{session-VpLrNaFQ.js → session-CyRLSsVa.js} +2 -2
- package/dist/{session-VpLrNaFQ.js.map → session-CyRLSsVa.js.map} +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/session.js +2 -2
- package/dist/{skills-Cp9vnBwd.js → skills-BMGH_KK1.js} +2 -2
- package/dist/{skills-Cp9vnBwd.js.map → skills-BMGH_KK1.js.map} +1 -1
- package/dist/skills.d.ts +1 -1
- package/dist/skills.js +1 -1
- package/dist/{timeout-BDetbuN6.js → timeout-CjOG2mea.js} +29 -2
- package/dist/timeout-CjOG2mea.js.map +1 -0
- package/dist/timeout-DEaqslLO.d.ts.map +1 -1
- package/dist/{tool-formatters-BfKqWm5N.d.ts → tool-formatters-D3wSS2zz.d.ts} +2 -2
- package/dist/{tool-formatters-BfKqWm5N.d.ts.map → tool-formatters-D3wSS2zz.d.ts.map} +1 -1
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/fetch-url.js +1 -1
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/tools/web-search.js +2 -2
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +1 -1
- package/dist/{transcript-anchors-Bv8HQ3S2.js → transcript-anchors-D-Yuimif.js} +177 -63
- package/dist/transcript-anchors-D-Yuimif.js.map +1 -0
- package/dist/{transcript-anchors-CNqDbrc9.d.ts → transcript-anchors-llwMrLRG.d.ts} +2 -2
- package/dist/{transcript-anchors-CNqDbrc9.d.ts.map → transcript-anchors-llwMrLRG.d.ts.map} +1 -1
- package/dist/tui.d.ts +24 -29
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +964 -244
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-iGu5J08j.js → turn-operations-7_Ff7INF.js} +2 -2
- package/dist/{turn-operations-iGu5J08j.js.map → turn-operations-7_Ff7INF.js.map} +1 -1
- package/dist/{turn-operations-CnIpcenJ.d.ts → turn-operations-C_XvfBU3.d.ts} +3 -3
- package/dist/{turn-operations-CnIpcenJ.d.ts.map → turn-operations-C_XvfBU3.d.ts.map} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/docs/CHAT.md +1 -1
- package/docs/TUI.md +4 -4
- package/package.json +2 -1
- package/dist/agent-8kfGIDb_.js.map +0 -1
- package/dist/anthropic-qaw8XAc9.js.map +0 -1
- package/dist/index-BSNr0OQn.d.ts.map +0 -1
- package/dist/oauth-ZebH9NHb.js.map +0 -1
- package/dist/openai-compat-CnHeo4Lz.js.map +0 -1
- package/dist/timeout-BDetbuN6.js.map +0 -1
- package/dist/transcript-anchors-Bv8HQ3S2.js.map +0 -1
package/dist/acp-cli.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { m as openaiCompat } from "./openai-compat-
|
|
3
|
-
import { bt as basic_default } from "./agent-
|
|
2
|
+
import { m as openaiCompat } from "./openai-compat-BoTi-9fd.js";
|
|
3
|
+
import { bt as basic_default } from "./agent-CcTWL-Z6.js";
|
|
4
4
|
import { r as createProcessContext } from "./contexts-DWVt7MvF.js";
|
|
5
5
|
import { createSandboxContext } from "./contexts/sandbox.js";
|
|
6
|
-
import { p as resolveStorageDirs } from "./plugins-
|
|
7
|
-
import { n as anthropic } from "./anthropic-
|
|
6
|
+
import { p as resolveStorageDirs } from "./plugins-onDvTHEm.js";
|
|
7
|
+
import { n as anthropic } from "./anthropic-DLc_Kw-1.js";
|
|
8
8
|
import { arcee } from "./providers/arcee.js";
|
|
9
9
|
import { baseten } from "./providers/baseten.js";
|
|
10
10
|
import { cerebras } from "./providers/cerebras.js";
|
|
11
11
|
import { openai } from "./providers/openai.js";
|
|
12
12
|
import { openrouter } from "./providers/openrouter.js";
|
|
13
13
|
import { xai } from "./providers/xai.js";
|
|
14
|
-
import { d as StartUsageError, f as buildStartLocalOptions, h as startProviderNames, i as withAcpDefaultTools, m as startLocalArgOptions, p as parseStartArgValues, t as runAcpStdioServer } from "./acp-
|
|
15
|
-
import {
|
|
14
|
+
import { d as StartUsageError, f as buildStartLocalOptions, h as startProviderNames, i as withAcpDefaultTools, m as startLocalArgOptions, p as parseStartArgValues, t as runAcpStdioServer } from "./acp-Dm95NwNM.js";
|
|
15
|
+
import { d as BUILTIN_PROVIDERS, i as readCredentials, m as credKeyOf, r as credentialsPath, t as detectAuth, x as modelsForDescriptor } from "./auth-BAclQnl3.js";
|
|
16
16
|
import { createDaytonaProvider } from "./contexts/daytona.js";
|
|
17
17
|
import { createDockerContext } from "./contexts/docker.js";
|
|
18
18
|
import { createE2BProvider } from "./contexts/e2b.js";
|
package/dist/acp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bh as TurnUsage, Cg as SessionStore, Gh as ToolDef, Nm as AgentBehavior, Uf as Provider, Wi as Agent, Xm as McpServerConfig, gh as SessionContentBlock, jh as ToolResultContent, qi as AgentOptions, sh as PromptPart, t as Preset, yg as Session } from "./index-ZWibV230.js";
|
|
2
2
|
import { c as ExecutionContext } from "./types-M2DauK2D.js";
|
|
3
3
|
import { Readable, Writable } from "node:stream";
|
|
4
4
|
|
package/dist/acp.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as createJsonRpcConnection, a as wrapToolsForAcpClient, c as sessionBlocksToAcp, g as JsonRpcRemoteError, i as withAcpDefaultTools, l as stopReasonFromRun, n as AcpProtocolError, o as acpMcpServersToZidane, r as createAcpServer, s as acpPromptToPromptParts, t as runAcpStdioServer, u as toolResultToAcpContent } from "./acp-
|
|
1
|
+
import { _ as createJsonRpcConnection, a as wrapToolsForAcpClient, c as sessionBlocksToAcp, g as JsonRpcRemoteError, i as withAcpDefaultTools, l as stopReasonFromRun, n as AcpProtocolError, o as acpMcpServersToZidane, r as createAcpServer, s as acpPromptToPromptParts, t as runAcpStdioServer, u as toolResultToAcpContent } from "./acp-Dm95NwNM.js";
|
|
2
2
|
export { AcpProtocolError, JsonRpcRemoteError, acpMcpServersToZidane, acpPromptToPromptParts, createAcpServer, createJsonRpcConnection, runAcpStdioServer, sessionBlocksToAcp, stopReasonFromRun, toolResultToAcpContent, withAcpDefaultTools, wrapToolsForAcpClient };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { B as rewriteMessagesToWire, H as toWireName, I as augmentMcpDoubleUnderscoreAliases, L as buildAliasMaps, M as buildPromptMessage, N as canonicalizePrompt, R as buildSanitizedWireAliases, V as toCanonicalName, z as rewriteContentToCanonical } from "./openai-compat-
|
|
1
|
+
import { B as rewriteMessagesToWire, H as toWireName, I as augmentMcpDoubleUnderscoreAliases, L as buildAliasMaps, M as buildPromptMessage, N as canonicalizePrompt, R as buildSanitizedWireAliases, V as toCanonicalName, z as rewriteContentToCanonical } from "./openai-compat-BoTi-9fd.js";
|
|
2
2
|
import { a as isWireTurn, c as toolOutputByteLength, i as documentBlockMarker, l as toolResultToText, o as sanitizeToolResultMetadata, s as toolOutputBudgetByteLength, t as DEFAULT_AGENT_CLOCK } from "./types-BIarq1qE.js";
|
|
3
|
-
import { a as stripLineNumberPrefixes, i as resolveOldString, n as buildContextBreakdown, o as styleReplacementForVia, r as describeVia, t as buildContextSegments } from "./context-segments-
|
|
3
|
+
import { a as stripLineNumberPrefixes, i as resolveOldString, n as buildContextBreakdown, o as styleReplacementForVia, r as describeVia, t as buildContextSegments } from "./context-segments-CJCtJ9sU.js";
|
|
4
4
|
import { n as estimateTokens, r as utf8ByteLength } from "./utils-ngQzYzZD.js";
|
|
5
5
|
import { a as formatDuration, c as previewLine, o as formatTaskStatus, s as formatTaskSummary } from "./format-BF745pLL.js";
|
|
6
6
|
import { i as parseGitLsFiles, r as GIT_LS_FILES_COMMAND } from "./glob-DluQFSw1.js";
|
|
7
7
|
import { i as isOutputExceededMessage } from "./output-cap-C9zukcCj.js";
|
|
8
8
|
import { r as createProcessContext, t as resolveDetachedTasksCapability } from "./contexts-DWVt7MvF.js";
|
|
9
9
|
import { n as shellQuote, t as alwaysQuote } from "./shell-quote-BmnhZmdM.js";
|
|
10
|
-
import { a as AgentProviderError, d as isAbortLikeError,
|
|
11
|
-
import { A as createSkillActivationState, D as escapeXml, E as buildCatalog, F as validateResourcePathReal, R as projectUserPaths, _ as lastLine, a as interpolateShellCommands, b as resolveSubdirRoot, g as fetchInstallSource, h as defaultWhich, k as installAllowedToolsGate, m as defaultExec, n as resolveSkills, o as stripShellInterpolations, p as InstallSourceError, v as parseInstallSource, y as resolveNpmVersion } from "./skills-
|
|
10
|
+
import { a as AgentProviderError, d as isAbortLikeError, g as toTypedError, i as AgentLengthResumeExhaustedError, n as AgentBudgetExceededError, p as isTransientTransportError, s as AgentToolPairingError, t as AgentAbortedError, u as errorMessage } from "./errors-DKiMrOKq.js";
|
|
11
|
+
import { A as createSkillActivationState, D as escapeXml, E as buildCatalog, F as validateResourcePathReal, R as projectUserPaths, _ as lastLine, a as interpolateShellCommands, b as resolveSubdirRoot, g as fetchInstallSource, h as defaultWhich, k as installAllowedToolsGate, m as defaultExec, n as resolveSkills, o as stripShellInterpolations, p as InstallSourceError, v as parseInstallSource, y as resolveNpmVersion } from "./skills-BMGH_KK1.js";
|
|
12
12
|
import { n as writeFileAtomicAsync, t as writeFileAtomic } from "./atomic-write-B7zr1ddF.js";
|
|
13
|
-
import { p as resolveStorageDirs, r as loadAgentPlugin } from "./plugins-
|
|
13
|
+
import { p as resolveStorageDirs, r as loadAgentPlugin } from "./plugins-onDvTHEm.js";
|
|
14
14
|
import { r as createLogger, t as consoleSink } from "./logger-DBX9uYOw.js";
|
|
15
15
|
import { n as reconcileImageMediaType } from "./media-sniff-UKijEaiQ.js";
|
|
16
|
-
import { f as wrapDiscoveredMcpTools, i as deriveMcpToolMeta, n as connectMcpServers, s as nonOwningMcpView } from "./mcp-
|
|
16
|
+
import { f as wrapDiscoveredMcpTools, i as deriveMcpToolMeta, n as connectMcpServers, s as nonOwningMcpView } from "./mcp-CVtSQTWg.js";
|
|
17
17
|
import { appendStaticSection, renderSystemForWire } from "./prompt.js";
|
|
18
|
-
import { a as detectTurnInterruption, c as ensureToolResultPairing, l as filterUnresolvedToolUses, m as resolveContentRefsInMessages, n as SYNTHETIC_TOOL_RESULT_PLACEHOLDER, p as remintDuplicateToolCallIds, s as ensureEndsWithUserMessage } from "./messages-
|
|
19
|
-
import { a as getExtensionSessionState, c as setExtensionSessionState, l as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as resumeChainRunIds } from "./session-
|
|
18
|
+
import { a as detectTurnInterruption, c as ensureToolResultPairing, l as filterUnresolvedToolUses, m as resolveContentRefsInMessages, n as SYNTHETIC_TOOL_RESULT_PLACEHOLDER, p as remintDuplicateToolCallIds, s as ensureEndsWithUserMessage } from "./messages-CZMUuKzo.js";
|
|
19
|
+
import { a as getExtensionSessionState, c as setExtensionSessionState, l as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as resumeChainRunIds } from "./session-CyRLSsVa.js";
|
|
20
20
|
import { n as flattenTurns, r as formatTokenUsage, t as effectiveInputFromTurn } from "./stats-DAKBEKjc.js";
|
|
21
|
-
import { a as
|
|
21
|
+
import { a as settleWithinTimeout, i as resolveTimeoutMs, n as abortableSleep, o as withInactivityTimeout, r as linkAbortSignal, s as withTimeout$1, t as OperationTimeoutError } from "./timeout-CjOG2mea.js";
|
|
22
22
|
import { createRequire } from "node:module";
|
|
23
23
|
import { basename, delimiter, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
24
24
|
import { createHooks } from "hookable";
|
|
@@ -2159,6 +2159,55 @@ function registerExtensionHostModules(modules) {
|
|
|
2159
2159
|
});
|
|
2160
2160
|
}
|
|
2161
2161
|
//#endregion
|
|
2162
|
+
//#region src/chat/cred-keys.ts
|
|
2163
|
+
/**
|
|
2164
|
+
* Credential-file key arithmetic, split from `./credentials` so the rules can
|
|
2165
|
+
* be enforced where credentials themselves must not be pulled in.
|
|
2166
|
+
*
|
|
2167
|
+
* `./credentials` reaches the provider registry (and through it the pi-ai
|
|
2168
|
+
* factories) for `credKeyOf`; the extension loader — an edge entrypoint that
|
|
2169
|
+
* validates descriptor keys at registration time — must stay clear of that
|
|
2170
|
+
* graph. This module is string arithmetic with no imports.
|
|
2171
|
+
*/
|
|
2172
|
+
/**
|
|
2173
|
+
* Reserved suffix marking a provider's SECOND credential slot.
|
|
2174
|
+
*
|
|
2175
|
+
* Not usable as (or as the tail of) a descriptor's credential key: `foo#alt`
|
|
2176
|
+
* holds `foo`'s alternate credential, so a provider claiming that name would
|
|
2177
|
+
* share storage with it.
|
|
2178
|
+
*/
|
|
2179
|
+
const ALTERNATE_CRED_KEY_SUFFIX = "#alt";
|
|
2180
|
+
/**
|
|
2181
|
+
* File key holding a provider's second credential, when it has one of each kind.
|
|
2182
|
+
*
|
|
2183
|
+
* The canonical key always holds the credential the user prefers; this sibling
|
|
2184
|
+
* holds the other. That one invariant is what makes preference selection free:
|
|
2185
|
+
* every existing reader (`applyApiKeyEnv`, the harness provider factories)
|
|
2186
|
+
* already resolves the canonical key, so "switch priority" is just moving two
|
|
2187
|
+
* objects between two keys — no precedence flag to interpret, no resolution
|
|
2188
|
+
* order to keep in sync across layers.
|
|
2189
|
+
*
|
|
2190
|
+
* A sibling key rather than a nested field because the canonical entry gets
|
|
2191
|
+
* REPLACED wholesale on token refresh; anything nested inside it would be
|
|
2192
|
+
* dropped by the next rotation. And older zidane versions look credentials up
|
|
2193
|
+
* by `credKeyOf`, so a suffixed key is simply invisible to them — they read the
|
|
2194
|
+
* preferred credential and behave exactly as before, which is why this needs no
|
|
2195
|
+
* migration or schema version.
|
|
2196
|
+
*/
|
|
2197
|
+
function alternateCredKey(fileKey) {
|
|
2198
|
+
return `${fileKey}${ALTERNATE_CRED_KEY_SUFFIX}`;
|
|
2199
|
+
}
|
|
2200
|
+
/**
|
|
2201
|
+
* True when a key claims the reserved alternate namespace.
|
|
2202
|
+
*
|
|
2203
|
+
* Built-in keys are plain identifiers (`anthropic`, `openai-codex`), but
|
|
2204
|
+
* `ProviderDescriptor.key` / `credentialFileKey` are open strings — so the
|
|
2205
|
+
* reservation is checked, not assumed.
|
|
2206
|
+
*/
|
|
2207
|
+
function isReservedCredKey(fileKey) {
|
|
2208
|
+
return fileKey.endsWith(ALTERNATE_CRED_KEY_SUFFIX);
|
|
2209
|
+
}
|
|
2210
|
+
//#endregion
|
|
2162
2211
|
//#region src/chat/keybindings.ts
|
|
2163
2212
|
/**
|
|
2164
2213
|
* Keybindings — a single source of truth for the app's global shortcuts.
|
|
@@ -2281,8 +2330,8 @@ const KEYBINDING_DEFS = [
|
|
|
2281
2330
|
{
|
|
2282
2331
|
action: "attachClipboardImage",
|
|
2283
2332
|
default: "ctrl+v",
|
|
2284
|
-
label: "paste
|
|
2285
|
-
description: "attach an image from the OS clipboard
|
|
2333
|
+
label: "paste clipboard",
|
|
2334
|
+
description: "paste text or attach an image directly from the OS clipboard, bypassing the terminal paste path",
|
|
2286
2335
|
group: "Global"
|
|
2287
2336
|
},
|
|
2288
2337
|
{
|
|
@@ -7520,6 +7569,11 @@ function makeContext(opts) {
|
|
|
7520
7569
|
warnUnsafeKey(logger, "registerProvider", descriptor.key);
|
|
7521
7570
|
return;
|
|
7522
7571
|
}
|
|
7572
|
+
const credKey = descriptor.credentialFileKey ?? descriptor.key;
|
|
7573
|
+
if (isReservedCredKey(credKey)) {
|
|
7574
|
+
logger.warn(`registerProvider: refused reserved credential key "${credKey}" ("${ALTERNATE_CRED_KEY_SUFFIX}" marks a provider's alternate credential)`);
|
|
7575
|
+
return;
|
|
7576
|
+
}
|
|
7523
7577
|
sinks.providers[descriptor.key] = descriptor;
|
|
7524
7578
|
};
|
|
7525
7579
|
const registerSystemPromptFragment = (text) => {
|
|
@@ -8583,6 +8637,139 @@ const EMPTY_EXTENSION_REGISTRY = Object.freeze({
|
|
|
8583
8637
|
dispose: async () => {}
|
|
8584
8638
|
});
|
|
8585
8639
|
//#endregion
|
|
8640
|
+
//#region src/loop-recovery.ts
|
|
8641
|
+
/**
|
|
8642
|
+
* Operation labels used by the provider-stream watchdogs.
|
|
8643
|
+
*
|
|
8644
|
+
* Single source of truth for the strings so `withTimeout` callers and the
|
|
8645
|
+
* failure classifier can never drift: the classifier matches on exactly the
|
|
8646
|
+
* label the watchdog emits.
|
|
8647
|
+
*/
|
|
8648
|
+
const PROVIDER_WATCHDOG_OPERATIONS = {
|
|
8649
|
+
"first response": "provider first response",
|
|
8650
|
+
"total stream": "provider total stream",
|
|
8651
|
+
"stream inactivity": "provider stream inactivity"
|
|
8652
|
+
};
|
|
8653
|
+
/** Watchdog operation names that count as provider-stream failures. */
|
|
8654
|
+
const PROVIDER_WATCHDOG_OPERATION_SET = new Set(Object.values(PROVIDER_WATCHDOG_OPERATIONS));
|
|
8655
|
+
const RETRY_DEFAULTS = {
|
|
8656
|
+
maxAttempts: 3,
|
|
8657
|
+
initialDelayMs: 1e3,
|
|
8658
|
+
maxDelayMs: 3e4
|
|
8659
|
+
};
|
|
8660
|
+
/**
|
|
8661
|
+
* Normalize a user-supplied `RetryConfig` (any field may be missing or invalid)
|
|
8662
|
+
* into a fully-populated config the retry loop can use without per-field guards.
|
|
8663
|
+
*
|
|
8664
|
+
* Invalid values (non-finite, < 1 for `maxAttempts`, < 0 for delays) fall back
|
|
8665
|
+
* to defaults rather than throwing — this is a behavior knob, not a validation
|
|
8666
|
+
* boundary, and a bad value here shouldn't crash a run.
|
|
8667
|
+
*/
|
|
8668
|
+
function resolveRetryConfig(cfg) {
|
|
8669
|
+
return {
|
|
8670
|
+
maxAttempts: Number.isFinite(cfg?.maxAttempts) && cfg.maxAttempts >= 1 ? Math.floor(cfg.maxAttempts) : RETRY_DEFAULTS.maxAttempts,
|
|
8671
|
+
initialDelayMs: Number.isFinite(cfg?.initialDelayMs) && cfg.initialDelayMs >= 0 ? cfg.initialDelayMs : RETRY_DEFAULTS.initialDelayMs,
|
|
8672
|
+
maxDelayMs: Number.isFinite(cfg?.maxDelayMs) && cfg.maxDelayMs >= 0 ? cfg.maxDelayMs : RETRY_DEFAULTS.maxDelayMs
|
|
8673
|
+
};
|
|
8674
|
+
}
|
|
8675
|
+
/**
|
|
8676
|
+
* Classify a failed stream attempt.
|
|
8677
|
+
*
|
|
8678
|
+
* Retry eligibility covers three sources: an error the provider's own classifier
|
|
8679
|
+
* marked retryable, a provider-stream watchdog timeout, and a transport-level
|
|
8680
|
+
* failure. The latter two are retryable BY CONSTRUCTION for the first-response
|
|
8681
|
+
* watchdog and for any dropped connection — zero observable events arrived, so
|
|
8682
|
+
* re-issuing is at least as safe as the mid-stream `overloaded_error` retries
|
|
8683
|
+
* the classifier opts into. The total-stream and inactivity watchdogs ride the
|
|
8684
|
+
* same carve-out but lean on `cleanSlate` for their safety.
|
|
8685
|
+
*
|
|
8686
|
+
* Transport failures need their own source because they happen BELOW the API:
|
|
8687
|
+
* they carry no status and no error body, so `classifyError` returns `null` and
|
|
8688
|
+
* the classifier-driven branch can never fire for them.
|
|
8689
|
+
*
|
|
8690
|
+
* Fallback excludes two classifications:
|
|
8691
|
+
* - `context_exceeded` — owned by overflow recovery; the transcript is the
|
|
8692
|
+
* problem, not the provider.
|
|
8693
|
+
* - `tool_pairing_corruption` — transcript-level corruption fails identically
|
|
8694
|
+
* on every provider.
|
|
8695
|
+
*
|
|
8696
|
+
* Everything else (rate limit, overload, 5xx, auth/billing, even unclassified
|
|
8697
|
+
* network failures) is provider-side: a sibling target may well succeed, and a
|
|
8698
|
+
* genuinely broken request just exhausts the chain and surfaces the last error.
|
|
8699
|
+
*/
|
|
8700
|
+
function assessStreamFailure(input) {
|
|
8701
|
+
const { err, runAborted, classifyError, progress, attempt, retry, hasNextTarget } = input;
|
|
8702
|
+
const wasAborted = runAborted || err instanceof Error && err.name === "AbortError";
|
|
8703
|
+
const classified = !wasAborted ? classifyError?.(err) ?? null : null;
|
|
8704
|
+
const cleanSlate = progress.text === "" && progress.thinking === "" && !progress.serverToolActivity;
|
|
8705
|
+
const isRetryable = classified?.kind === "provider_error" && classified.retryable === true;
|
|
8706
|
+
const isStreamWatchdogTimeout = !wasAborted && err instanceof OperationTimeoutError && PROVIDER_WATCHDOG_OPERATION_SET.has(err.operation);
|
|
8707
|
+
const isTransportFailure = !wasAborted && isTransientTransportError(err);
|
|
8708
|
+
const canRetry = !wasAborted && (isRetryable || isStreamWatchdogTimeout || isTransportFailure) && cleanSlate && attempt < retry.maxAttempts;
|
|
8709
|
+
const retryAfterMs = canRetry ? extractRetryAfterMs(err) : void 0;
|
|
8710
|
+
return {
|
|
8711
|
+
wasAborted,
|
|
8712
|
+
classified,
|
|
8713
|
+
cleanSlate,
|
|
8714
|
+
retryAfterMs,
|
|
8715
|
+
canRetry,
|
|
8716
|
+
preferFallbackOverRetry: retryAfterMs !== void 0 && retryAfterMs > 15e3 && hasNextTarget,
|
|
8717
|
+
canRecoverOverflow: !wasAborted && classified?.kind === "context_exceeded" && cleanSlate,
|
|
8718
|
+
canFallback: !wasAborted && cleanSlate && hasNextTarget && classified?.kind !== "context_exceeded" && classified?.kind !== "tool_pairing_corruption"
|
|
8719
|
+
};
|
|
8720
|
+
}
|
|
8721
|
+
/**
|
|
8722
|
+
* Backoff delay for the next attempt.
|
|
8723
|
+
*
|
|
8724
|
+
* A server-declared `retry-after` wins (capped at `maxDelayMs`); otherwise
|
|
8725
|
+
* full-jitter exponential backoff — a uniform draw from `[0, capped)` rather
|
|
8726
|
+
* than a fixed `capped`, so a fleet of clients retrying the same overloaded
|
|
8727
|
+
* endpoint spreads out instead of stampeding in lockstep.
|
|
8728
|
+
*/
|
|
8729
|
+
function computeRetryDelayMs(attempt, cfg, retryAfterMs) {
|
|
8730
|
+
if (retryAfterMs !== void 0 && retryAfterMs >= 0) return Math.min(retryAfterMs, cfg.maxDelayMs);
|
|
8731
|
+
const exponential = cfg.initialDelayMs * 2 ** (attempt - 1);
|
|
8732
|
+
const capped = Math.min(exponential, cfg.maxDelayMs);
|
|
8733
|
+
return Math.floor(Math.random() * capped);
|
|
8734
|
+
}
|
|
8735
|
+
/**
|
|
8736
|
+
* Extract a `retry-after` value (in milliseconds) from an error's `.headers`, if any.
|
|
8737
|
+
*
|
|
8738
|
+
* Supports both `retry-after-ms` (non-standard but Stainless-emitted; already in ms,
|
|
8739
|
+
* always integer) and the standard `retry-after` header (integer seconds, RFC 7231).
|
|
8740
|
+
* Returns `undefined` when neither is present, non-numeric, or negative.
|
|
8741
|
+
*
|
|
8742
|
+
* `parseInt` over `parseFloat` here matches the actual contract — Stainless emits
|
|
8743
|
+
* `retry-after-ms` as an integer and RFC 7231 specifies a non-negative integer for
|
|
8744
|
+
* the seconds form. The HTTP-date form of `retry-after` is deliberately unsupported
|
|
8745
|
+
* (Anthropic + OpenAI both emit numeric seconds; supporting dates invites clock-skew
|
|
8746
|
+
* concerns for negligible benefit).
|
|
8747
|
+
*/
|
|
8748
|
+
function extractRetryAfterMs(err) {
|
|
8749
|
+
if (!err || typeof err !== "object") return void 0;
|
|
8750
|
+
const headers = err.headers;
|
|
8751
|
+
if (!headers || typeof headers !== "object") return void 0;
|
|
8752
|
+
const get = (key) => {
|
|
8753
|
+
const h = headers;
|
|
8754
|
+
if (typeof h.get === "function") {
|
|
8755
|
+
const v = h.get(key);
|
|
8756
|
+
return typeof v === "string" ? v : void 0;
|
|
8757
|
+
}
|
|
8758
|
+
const v = h[key];
|
|
8759
|
+
return typeof v === "string" ? v : void 0;
|
|
8760
|
+
};
|
|
8761
|
+
const ms = get("retry-after-ms");
|
|
8762
|
+
if (ms !== void 0) {
|
|
8763
|
+
const parsed = Number.parseInt(ms, 10);
|
|
8764
|
+
if (Number.isFinite(parsed) && parsed >= 0) return parsed;
|
|
8765
|
+
}
|
|
8766
|
+
const seconds = get("retry-after");
|
|
8767
|
+
if (seconds !== void 0) {
|
|
8768
|
+
const parsed = Number.parseInt(seconds, 10);
|
|
8769
|
+
if (Number.isFinite(parsed) && parsed >= 0) return parsed * 1e3;
|
|
8770
|
+
}
|
|
8771
|
+
}
|
|
8772
|
+
//#endregion
|
|
8586
8773
|
//#region src/compact/errors.ts
|
|
8587
8774
|
/**
|
|
8588
8775
|
* Typed errors thrown by the compaction helper.
|
|
@@ -9142,6 +9329,24 @@ const DEFAULT_MAX_OUTPUT_TOKENS = 2e4;
|
|
|
9142
9329
|
const DEFAULT_MAX_PTL_RETRIES = 3;
|
|
9143
9330
|
/** Maximum transient-error retries before giving up. Independent of PTL. */
|
|
9144
9331
|
const TRANSIENT_RETRY_BUDGET = 2;
|
|
9332
|
+
/**
|
|
9333
|
+
* Backoff for transient retries. Shares the turn loop's policy
|
|
9334
|
+
* ({@link computeRetryDelayMs}: a server-declared `retry-after` wins, otherwise
|
|
9335
|
+
* exponential with full jitter) but keeps its own constants — the budget here is
|
|
9336
|
+
* 2 rather than 3, and a summarize call is cheap to re-issue, so waiting out the
|
|
9337
|
+
* loop's multi-second defaults would cost more than it buys.
|
|
9338
|
+
*
|
|
9339
|
+
* The jittered curve is FULL jitter — a uniform draw from `[0, capped)` — so it
|
|
9340
|
+
* raises the expected gap between re-dials (125ms, then 250ms on average) rather
|
|
9341
|
+
* than guaranteeing a floor; a near-zero wait is still a normal draw. Spreading
|
|
9342
|
+
* the retries out is the point, and an immediate re-dial of a socket that just
|
|
9343
|
+
* dropped is only the least promising single timing, not a disaster.
|
|
9344
|
+
*/
|
|
9345
|
+
const TRANSIENT_RETRY_BACKOFF = {
|
|
9346
|
+
maxAttempts: TRANSIENT_RETRY_BUDGET,
|
|
9347
|
+
initialDelayMs: 250,
|
|
9348
|
+
maxDelayMs: 2e3
|
|
9349
|
+
};
|
|
9145
9350
|
async function compactConversation(opts) {
|
|
9146
9351
|
const slice = sliceForCompaction(opts.turns, opts.scope ?? "tail", opts.keepTurns ?? DEFAULT_KEEP_TURNS);
|
|
9147
9352
|
const scope = opts.scope ?? "tail";
|
|
@@ -9223,6 +9428,7 @@ async function compactConversation(opts) {
|
|
|
9223
9428
|
}
|
|
9224
9429
|
if (isTransientError(err) && transientRetries < TRANSIENT_RETRY_BUDGET) {
|
|
9225
9430
|
transientRetries++;
|
|
9431
|
+
await abortableSleep(computeRetryDelayMs(transientRetries, TRANSIENT_RETRY_BACKOFF, extractRetryAfterMs(err)), opts.signal ?? new AbortController().signal);
|
|
9226
9432
|
continue;
|
|
9227
9433
|
}
|
|
9228
9434
|
throw err;
|
|
@@ -9462,14 +9668,23 @@ function isPromptTooLongError(err) {
|
|
|
9462
9668
|
}
|
|
9463
9669
|
/**
|
|
9464
9670
|
* Transient network / 5xx errors worth retrying once or twice.
|
|
9671
|
+
*
|
|
9672
|
+
* The 5xx test stays local and deliberately plain (`>= 500 && < 600`, where
|
|
9673
|
+
* `isRetryableHttpStatus` exempts 501 and adds 429) — see the note in
|
|
9674
|
+
* `errors.ts`. Re-summarizing has no side effects, so this leans further toward
|
|
9675
|
+
* retrying than the turn loop does.
|
|
9676
|
+
*
|
|
9677
|
+
* The transport half is NOT local: socket teardowns spell themselves a dozen
|
|
9678
|
+
* ways across runtimes, and keeping a second private list here is exactly how
|
|
9679
|
+
* this one came to miss Bun's wording entirely. Sharing also drops a hazard the
|
|
9680
|
+
* local list carried — its message test ignored `status`, so a 401 whose body
|
|
9681
|
+
* happened to say "terminated" was retried as if the socket had dropped.
|
|
9465
9682
|
*/
|
|
9466
9683
|
function isTransientError(err) {
|
|
9467
9684
|
if (!err || typeof err !== "object") return false;
|
|
9468
9685
|
const e = err;
|
|
9469
9686
|
if (typeof e.status === "number" && e.status >= 500 && e.status < 600) return true;
|
|
9470
|
-
|
|
9471
|
-
if (typeof e.message === "string" && /socket hang up|fetch failed|network error|terminated|ECONNRESET|read ETIMEDOUT/i.test(e.message)) return true;
|
|
9472
|
-
return false;
|
|
9687
|
+
return isTransientTransportError(err);
|
|
9473
9688
|
}
|
|
9474
9689
|
function isAbortError(err, signal) {
|
|
9475
9690
|
if (signal?.aborted) return true;
|
|
@@ -10542,134 +10757,6 @@ function textForPersistence(output) {
|
|
|
10542
10757
|
return parts.join("\n");
|
|
10543
10758
|
}
|
|
10544
10759
|
//#endregion
|
|
10545
|
-
//#region src/loop-recovery.ts
|
|
10546
|
-
/**
|
|
10547
|
-
* Operation labels used by the provider-stream watchdogs.
|
|
10548
|
-
*
|
|
10549
|
-
* Single source of truth for the strings so `withTimeout` callers and the
|
|
10550
|
-
* failure classifier can never drift: the classifier matches on exactly the
|
|
10551
|
-
* label the watchdog emits.
|
|
10552
|
-
*/
|
|
10553
|
-
const PROVIDER_WATCHDOG_OPERATIONS = {
|
|
10554
|
-
"first response": "provider first response",
|
|
10555
|
-
"total stream": "provider total stream",
|
|
10556
|
-
"stream inactivity": "provider stream inactivity"
|
|
10557
|
-
};
|
|
10558
|
-
/** Watchdog operation names that count as provider-stream failures. */
|
|
10559
|
-
const PROVIDER_WATCHDOG_OPERATION_SET = new Set(Object.values(PROVIDER_WATCHDOG_OPERATIONS));
|
|
10560
|
-
const RETRY_DEFAULTS = {
|
|
10561
|
-
maxAttempts: 3,
|
|
10562
|
-
initialDelayMs: 1e3,
|
|
10563
|
-
maxDelayMs: 3e4
|
|
10564
|
-
};
|
|
10565
|
-
/**
|
|
10566
|
-
* Normalize a user-supplied `RetryConfig` (any field may be missing or invalid)
|
|
10567
|
-
* into a fully-populated config the retry loop can use without per-field guards.
|
|
10568
|
-
*
|
|
10569
|
-
* Invalid values (non-finite, < 1 for `maxAttempts`, < 0 for delays) fall back
|
|
10570
|
-
* to defaults rather than throwing — this is a behavior knob, not a validation
|
|
10571
|
-
* boundary, and a bad value here shouldn't crash a run.
|
|
10572
|
-
*/
|
|
10573
|
-
function resolveRetryConfig(cfg) {
|
|
10574
|
-
return {
|
|
10575
|
-
maxAttempts: Number.isFinite(cfg?.maxAttempts) && cfg.maxAttempts >= 1 ? Math.floor(cfg.maxAttempts) : RETRY_DEFAULTS.maxAttempts,
|
|
10576
|
-
initialDelayMs: Number.isFinite(cfg?.initialDelayMs) && cfg.initialDelayMs >= 0 ? cfg.initialDelayMs : RETRY_DEFAULTS.initialDelayMs,
|
|
10577
|
-
maxDelayMs: Number.isFinite(cfg?.maxDelayMs) && cfg.maxDelayMs >= 0 ? cfg.maxDelayMs : RETRY_DEFAULTS.maxDelayMs
|
|
10578
|
-
};
|
|
10579
|
-
}
|
|
10580
|
-
/**
|
|
10581
|
-
* Classify a failed stream attempt.
|
|
10582
|
-
*
|
|
10583
|
-
* Retry eligibility covers two sources: an error the provider's own classifier
|
|
10584
|
-
* marked retryable, and a provider-stream watchdog timeout. The latter is
|
|
10585
|
-
* retryable BY CONSTRUCTION for the first-response watchdog — zero observable
|
|
10586
|
-
* events arrived, so re-issuing is at least as safe as the mid-stream
|
|
10587
|
-
* `overloaded_error` retries the classifier opts into. The total-stream and
|
|
10588
|
-
* inactivity watchdogs ride the same carve-out but lean on `cleanSlate` for
|
|
10589
|
-
* their safety.
|
|
10590
|
-
*
|
|
10591
|
-
* Fallback excludes two classifications:
|
|
10592
|
-
* - `context_exceeded` — owned by overflow recovery; the transcript is the
|
|
10593
|
-
* problem, not the provider.
|
|
10594
|
-
* - `tool_pairing_corruption` — transcript-level corruption fails identically
|
|
10595
|
-
* on every provider.
|
|
10596
|
-
*
|
|
10597
|
-
* Everything else (rate limit, overload, 5xx, auth/billing, even unclassified
|
|
10598
|
-
* network failures) is provider-side: a sibling target may well succeed, and a
|
|
10599
|
-
* genuinely broken request just exhausts the chain and surfaces the last error.
|
|
10600
|
-
*/
|
|
10601
|
-
function assessStreamFailure(input) {
|
|
10602
|
-
const { err, runAborted, classifyError, progress, attempt, retry, hasNextTarget } = input;
|
|
10603
|
-
const wasAborted = runAborted || err instanceof Error && err.name === "AbortError";
|
|
10604
|
-
const classified = !wasAborted ? classifyError?.(err) ?? null : null;
|
|
10605
|
-
const cleanSlate = progress.text === "" && progress.thinking === "" && !progress.serverToolActivity;
|
|
10606
|
-
const isRetryable = classified?.kind === "provider_error" && classified.retryable === true;
|
|
10607
|
-
const isStreamWatchdogTimeout = !wasAborted && err instanceof OperationTimeoutError && PROVIDER_WATCHDOG_OPERATION_SET.has(err.operation);
|
|
10608
|
-
const canRetry = !wasAborted && (isRetryable || isStreamWatchdogTimeout) && cleanSlate && attempt < retry.maxAttempts;
|
|
10609
|
-
const retryAfterMs = canRetry ? extractRetryAfterMs(err) : void 0;
|
|
10610
|
-
return {
|
|
10611
|
-
wasAborted,
|
|
10612
|
-
classified,
|
|
10613
|
-
cleanSlate,
|
|
10614
|
-
retryAfterMs,
|
|
10615
|
-
canRetry,
|
|
10616
|
-
preferFallbackOverRetry: retryAfterMs !== void 0 && retryAfterMs > 15e3 && hasNextTarget,
|
|
10617
|
-
canRecoverOverflow: !wasAborted && classified?.kind === "context_exceeded" && cleanSlate,
|
|
10618
|
-
canFallback: !wasAborted && cleanSlate && hasNextTarget && classified?.kind !== "context_exceeded" && classified?.kind !== "tool_pairing_corruption"
|
|
10619
|
-
};
|
|
10620
|
-
}
|
|
10621
|
-
/**
|
|
10622
|
-
* Backoff delay for the next attempt.
|
|
10623
|
-
*
|
|
10624
|
-
* A server-declared `retry-after` wins (capped at `maxDelayMs`); otherwise
|
|
10625
|
-
* full-jitter exponential backoff — a uniform draw from `[0, capped)` rather
|
|
10626
|
-
* than a fixed `capped`, so a fleet of clients retrying the same overloaded
|
|
10627
|
-
* endpoint spreads out instead of stampeding in lockstep.
|
|
10628
|
-
*/
|
|
10629
|
-
function computeRetryDelayMs(attempt, cfg, retryAfterMs) {
|
|
10630
|
-
if (retryAfterMs !== void 0 && retryAfterMs >= 0) return Math.min(retryAfterMs, cfg.maxDelayMs);
|
|
10631
|
-
const exponential = cfg.initialDelayMs * 2 ** (attempt - 1);
|
|
10632
|
-
const capped = Math.min(exponential, cfg.maxDelayMs);
|
|
10633
|
-
return Math.floor(Math.random() * capped);
|
|
10634
|
-
}
|
|
10635
|
-
/**
|
|
10636
|
-
* Extract a `retry-after` value (in milliseconds) from an error's `.headers`, if any.
|
|
10637
|
-
*
|
|
10638
|
-
* Supports both `retry-after-ms` (non-standard but Stainless-emitted; already in ms,
|
|
10639
|
-
* always integer) and the standard `retry-after` header (integer seconds, RFC 7231).
|
|
10640
|
-
* Returns `undefined` when neither is present, non-numeric, or negative.
|
|
10641
|
-
*
|
|
10642
|
-
* `parseInt` over `parseFloat` here matches the actual contract — Stainless emits
|
|
10643
|
-
* `retry-after-ms` as an integer and RFC 7231 specifies a non-negative integer for
|
|
10644
|
-
* the seconds form. The HTTP-date form of `retry-after` is deliberately unsupported
|
|
10645
|
-
* (Anthropic + OpenAI both emit numeric seconds; supporting dates invites clock-skew
|
|
10646
|
-
* concerns for negligible benefit).
|
|
10647
|
-
*/
|
|
10648
|
-
function extractRetryAfterMs(err) {
|
|
10649
|
-
if (!err || typeof err !== "object") return void 0;
|
|
10650
|
-
const headers = err.headers;
|
|
10651
|
-
if (!headers || typeof headers !== "object") return void 0;
|
|
10652
|
-
const get = (key) => {
|
|
10653
|
-
const h = headers;
|
|
10654
|
-
if (typeof h.get === "function") {
|
|
10655
|
-
const v = h.get(key);
|
|
10656
|
-
return typeof v === "string" ? v : void 0;
|
|
10657
|
-
}
|
|
10658
|
-
const v = h[key];
|
|
10659
|
-
return typeof v === "string" ? v : void 0;
|
|
10660
|
-
};
|
|
10661
|
-
const ms = get("retry-after-ms");
|
|
10662
|
-
if (ms !== void 0) {
|
|
10663
|
-
const parsed = Number.parseInt(ms, 10);
|
|
10664
|
-
if (Number.isFinite(parsed) && parsed >= 0) return parsed;
|
|
10665
|
-
}
|
|
10666
|
-
const seconds = get("retry-after");
|
|
10667
|
-
if (seconds !== void 0) {
|
|
10668
|
-
const parsed = Number.parseInt(seconds, 10);
|
|
10669
|
-
if (Number.isFinite(parsed) && parsed >= 0) return parsed * 1e3;
|
|
10670
|
-
}
|
|
10671
|
-
}
|
|
10672
|
-
//#endregion
|
|
10673
10760
|
//#region src/loop.ts
|
|
10674
10761
|
const DEFAULT_PROVIDER_STREAM_START_TIMEOUT_MS = 300 * 1e3;
|
|
10675
10762
|
const DEFAULT_PROVIDER_STREAM_TIMEOUT_MS = 1800 * 1e3;
|
|
@@ -12465,29 +12552,6 @@ async function maybeAutoCompact(ctx, turn, lastTurnUsage, state) {
|
|
|
12465
12552
|
}
|
|
12466
12553
|
}
|
|
12467
12554
|
/**
|
|
12468
|
-
* `setTimeout` that rejects if the given signal aborts before the timer fires.
|
|
12469
|
-
*
|
|
12470
|
-
* Resolves with `undefined` on normal completion. Rejects with the signal's
|
|
12471
|
-
* `reason` (or a generic AbortError when no reason is set) on abort. Cleans
|
|
12472
|
-
* up its `abort` listener in both paths so callers don't leak handlers.
|
|
12473
|
-
*/
|
|
12474
|
-
function abortableSleep(ms, signal) {
|
|
12475
|
-
if (signal.aborted) return Promise.reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
|
|
12476
|
-
return new Promise((resolve, reject) => {
|
|
12477
|
-
let timer;
|
|
12478
|
-
const onAbort = () => {
|
|
12479
|
-
clearTimeout(timer);
|
|
12480
|
-
signal.removeEventListener("abort", onAbort);
|
|
12481
|
-
reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
|
|
12482
|
-
};
|
|
12483
|
-
timer = setTimeout(() => {
|
|
12484
|
-
signal.removeEventListener("abort", onAbort);
|
|
12485
|
-
resolve();
|
|
12486
|
-
}, ms);
|
|
12487
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
12488
|
-
});
|
|
12489
|
-
}
|
|
12490
|
-
/**
|
|
12491
12555
|
* Advance the run to the next provider+model target and rebind the prepared
|
|
12492
12556
|
* request to it.
|
|
12493
12557
|
*
|
|
@@ -16966,6 +17030,6 @@ function createAgent(rawOptions) {
|
|
|
16966
17030
|
};
|
|
16967
17031
|
}
|
|
16968
17032
|
//#endregion
|
|
16969
|
-
export { installExtensionFromSpec as $, groupBindings as $t, selectFilesFromSession as A,
|
|
17033
|
+
export { installExtensionFromSpec as $, groupBindings as $t, selectFilesFromSession as A, OUTPUT_RESERVE_TOKENS as An, createSkillsReadTool as At, buildUpToCompactPrompt as B, hydrateReadStateFromSessionAsync as Bn, matchModelEntries as Bt, resolveLegacySessionDir as C, isValidExtensionConfigItem as Cn, waitTask as Ct, resolveTasksDir as D, sanitizeExtensionConfigActionPatch as Dn, reserveChildLabel as Dt, resolveSessionDir as E, resolveExtensionConfigValue as En, isSpawnTool as Et, TRAILER as F, normalizeShellCommand as Fn, readFile$1 as Ft, summaryToTurn as G, edit as Gt, anchorPreviewFor as H, resolveReadStateMap as Hn, createInteractionTool as Ht, buildCompactPrompt as I, stableStringify as In, looksBinary as It, CompactPromptTooLongError as J, KEYBINDING_DEFS as Jt, truncateHeadForPtlRetry as K, validateToolArgs as Kt, buildFromCompactPrompt as L, getReadState as Ln, multiEdit as Lt, compactConversation as M, shouldAutoCompact as Mn, createShellTool as Mt, BASE_INSTRUCTIONS as N, defaultRepeatGuardNormalize as Nn, shell as Nt, buildPostCompactAttachments as O, toWireConfigSchema as On, createSkillsUseTool as Ot, NO_TOOLS_PREAMBLE as P, defaultRepeatGuardTracked as Pn, tailTruncate as Pt, fetchExtensionSource as Q, formatBindingForDisplay as Qt, buildFullCompactPrompt as R, hashContent as Rn, createModelSearchTool as Rt, resolveLegacyPersistDir as S, coerceExtensionConfigInput as Sn, WAIT_TASK_TIMED_OUT_PREFIX as St, resolvePersistDir as T, resolveExtensionConfig as Tn, createSpawnTool as Tt, sliceForCompaction as U, grep as Ut, ANCHOR_PREVIEW_MAX_CHARS as V, readStateKey as Vn, listFiles as Vt, stripImagesFromTurns as W, glob as Wt, createExtensionPromptBridge as X, KEYBINDING_KEY_COL_WIDTH as Xt, EMPTY_EXTENSION_REGISTRY as Y, KEYBINDING_DEF_BY_ACTION as Yt, ExtensionInstallError as Z, ensureKeybindingsFile as Zt, buildPersistedStub as _, parseExtensionScanPathEnv as _n, composePresets as _t, stagedToolState as a, readKeybindingsRaw as an, createExtensionHud as at, migrateSessionArtifactDirs as b, defineExtension as bn, basic_default as bt, INTERRUPT_MESSAGE_FOR_TOOL_USE as c, ALTERNATE_CRED_KEY_SUFFIX as cn, buildExtensionRegistry as ct, TOOL_USE_SKIPPED_MESSAGE as d, registerExtensionHostModules as dn, filterExtensionRegistry as dt, keybindingsPath as en, listExtensionCandidates as et, applyCompactSummaryCutoff as f, ENTRY_CANDIDATES as fn, filterRegistryPlugins as ft, PERSISTENCE_PREVIEW_BYTES as g, isExtensionDefinition as gn, createWorkspaceSurface as gt, PERSISTED_STUB_PREFIX as h, inlineLoadedExtension as hn, createExtensionHostRuntimeBridge as ht, isToolStateOps as i, readKeybindings as in, updateInstalledExtension as it, selectRecentFiles as j, effectiveContextWindow as jn, shellKill as jt, selectFilesFromReadState as k, AUTO_COMPACT_MIN_GROWTH_FRACTION as kn, createSkillsRunScriptTool as kt, SHELL_CASCADE_CANCEL_MESSAGE as l, alternateCredKey as ln, composeExtensionPreset as lt, renderStaleReadNotice as m, discoverExtensions as mn, partitionExtensionCatalog as mt, DEFAULT_MAX_VALUE_BYTES as n, mergeKeybindings as nn, readExtensionInstallProvenance as nt, normalizeProviders as o, resolveExtensionKeybindings as on, discoverAndBuildExtensionRegistry as ot, collectNewlyStaleReadPaths as p, defaultExtensionScanPaths as pn, mergeContributions as pt, CompactInvalidInputError as q, DEFAULT_KEYBINDINGS as qt, createToolStateController as r, parseBindingSpec as rn, removeInstalledExtension as rt, resolveModelTargets as s, stripJsonComments as sn, buildExtensionPreset as st, createAgent as t, matchesBinding as tn, parseExtensionInstallSource as tt, TOOL_USE_CANCELLED_MESSAGE as u, isReservedCredKey as un, disposeExtensionRegistry as ut, cleanupPersistedSession as v, scanExtensionDirectories as vn, definePreset as vt, resolveMcpWarningsDir as w, isValidExtensionConfigValue as wn, createToolSearchTool as wt, rehomePersistedStubs as x, clampExtensionConfigNumber as xn, writeFile$1 as xt, maybePersistToolResult as y, createDebugLog as yn, basicTools as yt, buildTailCompactPrompt as z, hydrateReadStateFromSession as zn, formatModelLine as zt };
|
|
16970
17034
|
|
|
16971
|
-
//# sourceMappingURL=agent-
|
|
17035
|
+
//# sourceMappingURL=agent-CcTWL-Z6.js.map
|