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/extensions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $a as ExtensionConfigStringItem, $i as ExtensionCatalogPartition, $o as ExtensionToolResultMetadataRegistration, Aa as discoverExtensions, Ao as ExtensionManifest, Ba as defineExtension, Bo as ExtensionRunTransform, Ca as readExtensionInstallProvenance, Co as ExtensionCustomRendererEntry, Cs as ExtensionSessionsSurface, Da as ENTRY_CANDIDATES, Do as ExtensionGuiSurface, Ds as createWorkspaceSurface, Ea as registerExtensionHostModules, Eo as ExtensionGuiPanel, Es as createExtensionHostRuntimeBridge, Fa as DiscoverAndBuildExtensionRegistryOptions, Fo as ExtensionPaths, Ga as ExtensionConfigCategory, Go as ExtensionStorageScope, Ha as ExtensionConfigActionResult, Ho as ExtensionSessionStateSurface, Ia as discoverAndBuildExtensionRegistry, Io as ExtensionPermission, Ja as ExtensionConfigItem, Jo as ExtensionToolPolicy, Ka as ExtensionConfigChangeBehavior, Ko as ExtensionStorageSurface, La as ExtensionPromptBridge, Lo as ExtensionPromptTransform, Ma as isExtensionDefinition, Mo as ExtensionModal, Na as parseExtensionScanPathEnv, No as ExtensionModalNode, Oa as ExtensionScanEntry, Oo as ExtensionKeybinding, Pa as scanExtensionDirectories, Po as ExtensionOrderedContribution, Qa as ExtensionConfigScope, Qi as BuildExtensionRegistryOptions, Qo as ExtensionToolRendererRegistration, Ra as ExtensionPromptDelivery, Ro as ExtensionProviderMiddleware, Sa as parseExtensionInstallSource, So as ExtensionCustomRenderer, Ss as ExtensionSessionSummary, Ta as updateInstalledExtension, To as ExtensionFooterHint, Ts as ExtensionWorkspaceSurface, Ua as ExtensionConfigActionStatus, Uo as ExtensionSkillPolicy, Va as ExtensionConfigActionItem, Vo as ExtensionRuntimeEnv, Wa as ExtensionConfigBooleanItem, Wo as ExtensionSource, Xa as ExtensionConfigModelItem, Xo as ExtensionToolRenderer, Ya as ExtensionConfigItemBase, Yo as ExtensionToolRenderProps, Za as ExtensionConfigNumberItem, Zo as ExtensionToolRendererEntry, _a as InstallExtensionFromSpecOptions, _o as ExtensionBehaviorTransform, _s as createExtensionHud, aa as filterRegistryPlugins, ao as WireExtensionConfigSchema, as as LoadedExtension, ba as installExtensionFromSpec, bo as ExtensionContextTransform, bs as ExtensionModelEntry, ca as ExtensionFetchResult, co as isValidExtensionConfigItem, cs as ExtensionBannerOptions, da as ExtensionInstallErrorCode, do as resolveExtensionConfigValue, ds as ExtensionHudStatus, ea as buildExtensionPreset, eo as ExtensionConfigSurface, es as ExtensionToolResultPatch, fa as ExtensionInstallIo, fo as sanitizeExtensionConfigActionPatch, fs as ExtensionHudWriter, ga as ExtensionInstallSource, go as ExtensionApiVersion, gs as ExtensionStatusOptions, ha as ExtensionInstallScope, ho as ExtensionAgentPluginOptions, hs as ExtensionNotifyTone, ia as filterExtensionRegistry, io as WireExtensionConfigItem, is as GuiContributions, ja as inlineLoadedExtension, jo as ExtensionMcpConfigTransform, ka as defaultExtensionScanPaths, ko as ExtensionKeybindingDispatchContext, la as ExtensionInstallCandidate, lo as isValidExtensionConfigValue, ls as ExtensionHud, ma as ExtensionInstallResult, mo as EMPTY_EXTENSION_REGISTRY, ms as ExtensionNotifyOptions, na as composeExtensionPreset, no as ExtensionConfigValueItem, ns as ExtensionToolVerdict, oa as mergeContributions, oo as clampExtensionConfigNumber, os as LoadedPluginRecord, pa as ExtensionInstallProvenance, po as toWireConfigSchema, ps as ExtensionNotification, qa as ExtensionConfigEnumItem, qo as ExtensionToolCatalogTransform, ra as disposeExtensionRegistry, ro as StoredExtensionConfigItem, rs as ExtensionTuiSurface, sa as partitionExtensionCatalog, so as coerceExtensionConfigInput, ss as TuiContributions, ta as buildExtensionRegistry, to as ExtensionConfigValue, ts as ExtensionToolResultTransform, ua as ExtensionInstallError, uo as resolveExtensionConfig, us as ExtensionHudState, va as InstalledExtensionTargetOptions, vo as ExtensionCapability, vs as ExtensionHostRuntimeBridge, wa as removeInstalledExtension, wo as ExtensionDefinition, ws as ExtensionWorkspacePair, xa as listExtensionCandidates, xo as ExtensionContributions, xs as ExtensionRuntimeSurface, ya as fetchExtensionSource, yo as ExtensionContext, ys as ExtensionHostRuntimeImpl, za as createExtensionPromptBridge, zo as ExtensionRegistry } from "./index-
|
|
1
|
+
import { $a as ExtensionConfigStringItem, $i as ExtensionCatalogPartition, $o as ExtensionToolResultMetadataRegistration, Aa as discoverExtensions, Ao as ExtensionManifest, Ba as defineExtension, Bo as ExtensionRunTransform, Ca as readExtensionInstallProvenance, Co as ExtensionCustomRendererEntry, Cs as ExtensionSessionsSurface, Da as ENTRY_CANDIDATES, Do as ExtensionGuiSurface, Ds as createWorkspaceSurface, Ea as registerExtensionHostModules, Eo as ExtensionGuiPanel, Es as createExtensionHostRuntimeBridge, Fa as DiscoverAndBuildExtensionRegistryOptions, Fo as ExtensionPaths, Ga as ExtensionConfigCategory, Go as ExtensionStorageScope, Ha as ExtensionConfigActionResult, Ho as ExtensionSessionStateSurface, Ia as discoverAndBuildExtensionRegistry, Io as ExtensionPermission, Ja as ExtensionConfigItem, Jo as ExtensionToolPolicy, Ka as ExtensionConfigChangeBehavior, Ko as ExtensionStorageSurface, La as ExtensionPromptBridge, Lo as ExtensionPromptTransform, Ma as isExtensionDefinition, Mo as ExtensionModal, Na as parseExtensionScanPathEnv, No as ExtensionModalNode, Oa as ExtensionScanEntry, Oo as ExtensionKeybinding, Pa as scanExtensionDirectories, Po as ExtensionOrderedContribution, Qa as ExtensionConfigScope, Qi as BuildExtensionRegistryOptions, Qo as ExtensionToolRendererRegistration, Ra as ExtensionPromptDelivery, Ro as ExtensionProviderMiddleware, Sa as parseExtensionInstallSource, So as ExtensionCustomRenderer, Ss as ExtensionSessionSummary, Ta as updateInstalledExtension, To as ExtensionFooterHint, Ts as ExtensionWorkspaceSurface, Ua as ExtensionConfigActionStatus, Uo as ExtensionSkillPolicy, Va as ExtensionConfigActionItem, Vo as ExtensionRuntimeEnv, Wa as ExtensionConfigBooleanItem, Wo as ExtensionSource, Xa as ExtensionConfigModelItem, Xo as ExtensionToolRenderer, Ya as ExtensionConfigItemBase, Yo as ExtensionToolRenderProps, Za as ExtensionConfigNumberItem, Zo as ExtensionToolRendererEntry, _a as InstallExtensionFromSpecOptions, _o as ExtensionBehaviorTransform, _s as createExtensionHud, aa as filterRegistryPlugins, ao as WireExtensionConfigSchema, as as LoadedExtension, ba as installExtensionFromSpec, bo as ExtensionContextTransform, bs as ExtensionModelEntry, ca as ExtensionFetchResult, co as isValidExtensionConfigItem, cs as ExtensionBannerOptions, da as ExtensionInstallErrorCode, do as resolveExtensionConfigValue, ds as ExtensionHudStatus, ea as buildExtensionPreset, eo as ExtensionConfigSurface, es as ExtensionToolResultPatch, fa as ExtensionInstallIo, fo as sanitizeExtensionConfigActionPatch, fs as ExtensionHudWriter, ga as ExtensionInstallSource, go as ExtensionApiVersion, gs as ExtensionStatusOptions, ha as ExtensionInstallScope, ho as ExtensionAgentPluginOptions, hs as ExtensionNotifyTone, ia as filterExtensionRegistry, io as WireExtensionConfigItem, is as GuiContributions, ja as inlineLoadedExtension, jo as ExtensionMcpConfigTransform, ka as defaultExtensionScanPaths, ko as ExtensionKeybindingDispatchContext, la as ExtensionInstallCandidate, lo as isValidExtensionConfigValue, ls as ExtensionHud, ma as ExtensionInstallResult, mo as EMPTY_EXTENSION_REGISTRY, ms as ExtensionNotifyOptions, na as composeExtensionPreset, no as ExtensionConfigValueItem, ns as ExtensionToolVerdict, oa as mergeContributions, oo as clampExtensionConfigNumber, os as LoadedPluginRecord, pa as ExtensionInstallProvenance, po as toWireConfigSchema, ps as ExtensionNotification, qa as ExtensionConfigEnumItem, qo as ExtensionToolCatalogTransform, ra as disposeExtensionRegistry, ro as StoredExtensionConfigItem, rs as ExtensionTuiSurface, sa as partitionExtensionCatalog, so as coerceExtensionConfigInput, ss as TuiContributions, ta as buildExtensionRegistry, to as ExtensionConfigValue, ts as ExtensionToolResultTransform, ua as ExtensionInstallError, uo as resolveExtensionConfig, us as ExtensionHudState, va as InstalledExtensionTargetOptions, vo as ExtensionCapability, vs as ExtensionHostRuntimeBridge, wa as removeInstalledExtension, wo as ExtensionDefinition, ws as ExtensionWorkspacePair, xa as listExtensionCandidates, xo as ExtensionContributions, xs as ExtensionRuntimeSurface, ya as fetchExtensionSource, yo as ExtensionContext, ys as ExtensionHostRuntimeImpl, za as createExtensionPromptBridge, zo as ExtensionRegistry } from "./index-ZWibV230.js";
|
|
2
2
|
export { type BuildExtensionRegistryOptions, type DiscoverAndBuildExtensionRegistryOptions, EMPTY_EXTENSION_REGISTRY, ENTRY_CANDIDATES, type ExtensionAgentPluginOptions, type ExtensionApiVersion, type ExtensionBannerOptions, type ExtensionBehaviorTransform, type ExtensionCapability, type ExtensionCatalogPartition, type ExtensionConfigActionItem, type ExtensionConfigActionResult, type ExtensionConfigActionStatus, type ExtensionConfigBooleanItem, type ExtensionConfigCategory, type ExtensionConfigChangeBehavior, type ExtensionConfigEnumItem, type ExtensionConfigItem, type ExtensionConfigItemBase, type ExtensionConfigModelItem, type ExtensionConfigNumberItem, type ExtensionConfigScope, type ExtensionConfigStringItem, type ExtensionConfigSurface, type ExtensionConfigValue, type ExtensionConfigValueItem, type ExtensionContext, type ExtensionContextTransform, type ExtensionContributions, type ExtensionCustomRenderer, type ExtensionCustomRendererEntry, type ExtensionDefinition, type ExtensionFetchResult, type ExtensionFooterHint, type ExtensionGuiPanel, type ExtensionGuiSurface, type ExtensionHostRuntimeBridge, type ExtensionHostRuntimeImpl, type ExtensionHud, type ExtensionHudState, type ExtensionHudStatus, type ExtensionHudWriter, type ExtensionInstallCandidate, ExtensionInstallError, type ExtensionInstallErrorCode, type ExtensionInstallIo, type ExtensionInstallProvenance, type ExtensionInstallResult, type ExtensionInstallScope, type ExtensionInstallSource, type ExtensionKeybinding, type ExtensionKeybindingDispatchContext, type ExtensionManifest, type ExtensionMcpConfigTransform, type ExtensionModal, type ExtensionModalNode, type ExtensionModelEntry, type ExtensionNotification, type ExtensionNotifyOptions, type ExtensionNotifyTone, type ExtensionOrderedContribution, type ExtensionPaths, type ExtensionPermission, type ExtensionPromptBridge, type ExtensionPromptDelivery, type ExtensionPromptTransform, type ExtensionProviderMiddleware, type ExtensionRegistry, type ExtensionRunTransform, type ExtensionRuntimeEnv, type ExtensionRuntimeSurface, type ExtensionScanEntry, type ExtensionSessionStateSurface, type ExtensionSessionSummary, type ExtensionSessionsSurface, type ExtensionSkillPolicy, type ExtensionSource, type ExtensionStatusOptions, type ExtensionStorageScope, type ExtensionStorageSurface, type ExtensionToolCatalogTransform, type ExtensionToolPolicy, type ExtensionToolRenderProps, type ExtensionToolRenderer, type ExtensionToolRendererEntry, type ExtensionToolRendererRegistration, type ExtensionToolResultMetadataRegistration, type ExtensionToolResultPatch, type ExtensionToolResultTransform, type ExtensionToolVerdict, type ExtensionTuiSurface, type ExtensionWorkspacePair, type ExtensionWorkspaceSurface, type GuiContributions, type InstallExtensionFromSpecOptions, type InstalledExtensionTargetOptions, type LoadedExtension, type LoadedPluginRecord, type StoredExtensionConfigItem, type TuiContributions, type WireExtensionConfigItem, type WireExtensionConfigSchema, buildExtensionPreset, buildExtensionRegistry, clampExtensionConfigNumber, coerceExtensionConfigInput, composeExtensionPreset, createExtensionHostRuntimeBridge, createExtensionHud, createExtensionPromptBridge, createWorkspaceSurface, defaultExtensionScanPaths, defineExtension, discoverAndBuildExtensionRegistry, discoverExtensions, disposeExtensionRegistry, fetchExtensionSource, filterExtensionRegistry, filterRegistryPlugins, inlineLoadedExtension, installExtensionFromSpec, isExtensionDefinition, isValidExtensionConfigItem, isValidExtensionConfigValue, listExtensionCandidates, mergeContributions, parseExtensionInstallSource, parseExtensionScanPathEnv, partitionExtensionCatalog, readExtensionInstallProvenance, registerExtensionHostModules, removeInstalledExtension, resolveExtensionConfig, resolveExtensionConfigValue, sanitizeExtensionConfigActionPatch, scanExtensionDirectories, toWireConfigSchema, updateInstalledExtension };
|
package/dist/extensions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as installExtensionFromSpec, Cn as resolveExtensionConfigValue, Q as fetchExtensionSource, Sn as
|
|
1
|
+
import { $ as installExtensionFromSpec, Cn as isValidExtensionConfigItem, Dn as sanitizeExtensionConfigActionPatch, En as resolveExtensionConfigValue, On as toWireConfigSchema, Q as fetchExtensionSource, Sn as coerceExtensionConfigInput, Tn as resolveExtensionConfig, X as createExtensionPromptBridge, Y as EMPTY_EXTENSION_REGISTRY, Z as ExtensionInstallError, _n as parseExtensionScanPathEnv, at as createExtensionHud, bn as defineExtension, ct as buildExtensionRegistry, dn as registerExtensionHostModules, dt as filterExtensionRegistry, et as listExtensionCandidates, fn as ENTRY_CANDIDATES, ft as filterRegistryPlugins, gn as isExtensionDefinition, gt as createWorkspaceSurface, hn as inlineLoadedExtension, ht as createExtensionHostRuntimeBridge, it as updateInstalledExtension, lt as composeExtensionPreset, mn as discoverExtensions, mt as partitionExtensionCatalog, nt as readExtensionInstallProvenance, ot as discoverAndBuildExtensionRegistry, pn as defaultExtensionScanPaths, pt as mergeContributions, rt as removeInstalledExtension, st as buildExtensionPreset, tt as parseExtensionInstallSource, ut as disposeExtensionRegistry, vn as scanExtensionDirectories, wn as isValidExtensionConfigValue, xn as clampExtensionConfigNumber } from "./agent-CcTWL-Z6.js";
|
|
2
2
|
export { EMPTY_EXTENSION_REGISTRY, ENTRY_CANDIDATES, ExtensionInstallError, buildExtensionPreset, buildExtensionRegistry, clampExtensionConfigNumber, coerceExtensionConfigInput, composeExtensionPreset, createExtensionHostRuntimeBridge, createExtensionHud, createExtensionPromptBridge, createWorkspaceSurface, defaultExtensionScanPaths, defineExtension, discoverAndBuildExtensionRegistry, discoverExtensions, disposeExtensionRegistry, fetchExtensionSource, filterExtensionRegistry, filterRegistryPlugins, inlineLoadedExtension, installExtensionFromSpec, isExtensionDefinition, isValidExtensionConfigItem, isValidExtensionConfigValue, listExtensionCandidates, mergeContributions, parseExtensionInstallSource, parseExtensionScanPathEnv, partitionExtensionCatalog, readExtensionInstallProvenance, registerExtensionHostModules, removeInstalledExtension, resolveExtensionConfig, resolveExtensionConfigValue, sanitizeExtensionConfigActionPatch, scanExtensionDirectories, toWireConfigSchema, updateInstalledExtension };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as errorMessage } from "./errors-
|
|
1
|
+
import { u as errorMessage } from "./errors-DKiMrOKq.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
import { request } from "node:http";
|
|
4
4
|
import { promises } from "node:dns";
|
|
@@ -531,4 +531,4 @@ const fetchUrl = {
|
|
|
531
531
|
//#endregion
|
|
532
532
|
export { isBlockedAddress as a, stripHtmlInline as c, fetchWithSsrfGuard as i, clearFetchUrlCache as n, isHostAllowed as o, fetchUrl as r, pinnedRequest as s, __fetchCacheTestApi as t };
|
|
533
533
|
|
|
534
|
-
//# sourceMappingURL=fetch-url-
|
|
534
|
+
//# sourceMappingURL=fetch-url-ma-5_p0p.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-url-B7aSg6Bp.js","names":["dns","request","httpsRequest","httpRequest"],"sources":["../src/tools/_html.ts","../src/tools/fetch-url.ts"],"sourcesContent":["/**\n * Shared HTML → plain-text helpers used by the web-egress tools (`web_search`\n * snippet extraction, `fetch_url` body decoding).\n *\n * Best-effort by contract: a real HTML parser would be more correct but the\n * payload is always model context, never user-facing rendered output, so a\n * tag-stripper plus a curated entity table covers the practical cases\n * (Wikipedia, GitHub READMEs, MDN docs, Stack Overflow answers). When a tool\n * needs richer parsing it should reach for an actual parser rather than\n * extending these helpers ad-hoc.\n */\n\n/**\n * Curated named-entity table. Kept narrow on purpose — the long tail\n * (`Å`, `×`, mathematical refs, …) is out of scope because the\n * model handles unknown entities fine when they pass through verbatim. Add\n * entries when an entity is observed mangling real output, not speculatively.\n *\n * Keys are stored without the leading `&` / trailing `;` and matched\n * case-insensitively by the decoder.\n */\nconst NAMED_ENTITIES: Record<string, string> = {\n amp: '&',\n apos: '\\'',\n bull: '•',\n copy: '\\u00A9',\n ensp: ' ',\n emsp: ' ',\n gt: '>',\n hellip: '\\u2026',\n laquo: '\\u00AB',\n ldquo: '\\u201C',\n lsquo: '\\u2018',\n lt: '<',\n mdash: '\\u2014',\n middot: '\\u00B7',\n nbsp: ' ',\n ndash: '\\u2013',\n quot: '\"',\n raquo: '\\u00BB',\n rdquo: '\\u201D',\n reg: '\\u00AE',\n rsquo: '\\u2019',\n thinsp: ' ',\n trade: '\\u2122',\n}\n\n/**\n * `String.fromCodePoint` raises on out-of-range / non-finite inputs; the\n * agent's untrusted-payload assumption means we can't let a single broken\n * numeric reference crash the whole decode. Empty string on rejection is\n * the safest outcome (matches what most browsers do for invalid refs).\n */\nfunction safeFromCodePoint(cp: number): string {\n if (!Number.isFinite(cp) || cp < 0 || cp > 0x10FFFF)\n return ''\n try {\n return String.fromCodePoint(cp)\n }\n catch {\n return ''\n }\n}\n\n/**\n * Decode numeric character references (`&#x...;` / `&#NNN;`) and the curated\n * subset of named entities in {@link NAMED_ENTITIES}. Unknown named entities\n * are left as-is so the model can detect them rather than seeing a silently\n * corrupted token.\n *\n * `&` is decoded LAST so a double-escaped string like `&lt;` resolves\n * to `<` (not `<`) — that's the spec-correct single-pass decode shape.\n */\nexport function decodeHtmlEntities(text: string): string {\n let s = text\n .replace(/&#x([0-9a-f]+);/gi, (_, h) => safeFromCodePoint(Number.parseInt(h, 16)))\n .replace(/&#(\\d+);/g, (_, n) => safeFromCodePoint(Number.parseInt(n, 10)))\n s = s.replace(/&([a-z][a-z0-9]*);/gi, (full, name) => {\n const key = name.toLowerCase()\n // Defer `amp` so `&lt;` doesn't double-decode in a single pass.\n if (key === 'amp')\n return full\n const replacement = NAMED_ENTITIES[key]\n return replacement ?? full\n })\n return s.replace(/&/gi, '&')\n}\n\n/**\n * Strip `<script>`, `<style>`, `<noscript>`, comments, and every other tag.\n * Block-level openers (`<br>`, `<p>`, `<div>`, `<li>`, `<tr>`, `<h1-6>`) are\n * replaced with newlines so the resulting plaintext preserves readable\n * structure. Other tags collapse to spaces.\n */\nexport function stripHtml(html: string): string {\n return html\n .replace(/<script[\\s\\S]*?<\\/script>/gi, ' ')\n .replace(/<style[\\s\\S]*?<\\/style>/gi, ' ')\n .replace(/<noscript[\\s\\S]*?<\\/noscript>/gi, ' ')\n .replace(/<!--[\\s\\S]*?-->/g, ' ')\n .replace(/<(?:br|p|div|li|tr|h[1-6])[^>]*>/gi, '\\n')\n .replace(/<[^>]+>/g, ' ')\n}\n\n/**\n * Inline variant — strip tags + decode entities + collapse all whitespace\n * (including line breaks) into single spaces. For short snippets where\n * structural breaks would be visual noise (search-result titles, link text).\n */\nexport function stripHtmlInline(html: string): string {\n return decodeHtmlEntities(stripHtml(html))\n .replace(/\\s+/g, ' ')\n .trim()\n}\n\n/**\n * Block variant — strip tags + decode entities, preserve newlines emitted\n * by block-level openers, then collapse inline whitespace per-line and drop\n * empty lines. For full-page reductions where structure aids reading.\n */\nexport function stripHtmlBlock(html: string): string {\n return decodeHtmlEntities(stripHtml(html))\n .split('\\n')\n .map(line => line.replace(/[ \\t]+/g, ' ').trim())\n .filter(line => line.length > 0)\n .join('\\n')\n}\n","import type { RequestOptions as HttpRequestOptions } from 'node:http'\nimport type { RequestOptions as HttpsRequestOptions } from 'node:https'\nimport type { ToolContext, ToolDef } from './types'\nimport { Buffer } from 'node:buffer'\nimport { promises as dns } from 'node:dns'\nimport { request as httpRequest } from 'node:http'\nimport { request as httpsRequest } from 'node:https'\nimport { isIP } from 'node:net'\nimport { errorMessage } from '../errors'\nimport { stripHtmlBlock } from './_html'\n\n/**\n * Fetch a URL and return its text content.\n *\n * Companion to `web_search` (when registered) — after the model finds a\n * promising result it fetches the page to read the body in full. HTML is\n * reduced to plain text because the model rarely benefits from the markup\n * and we want to keep the payload inside the per-turn output budget.\n *\n * Restrictions:\n * - Only http(s) URLs. Anything else (file://, data:, ftp:) is rejected so\n * the tool can't be coerced into reading local files or arbitrary\n * resources.\n * - SSRF guard with TOCTOU defense: the host is DNS-resolved against the\n * loopback / link-local / private / reserved blocklist BEFORE the\n * request, and the resolved IP is then PINNED at the connection layer\n * via `node:http(s).request({ host: <resolved IP>, headers: { Host: ... },\n * servername: ... })`. This closes the classic DNS-rebinding gap where a\n * `globalThis.fetch` re-resolves the hostname and connects to a freshly\n * minted private IP. TLS verification still runs against the original\n * hostname via the explicit `servername` option.\n *\n * Note: the more idiomatic Node fix (an `undici.Agent` with a custom\n * `connect.lookup`) is silently a no-op on Bun ≤1.3 — both\n * `undici.Agent` and `node:https.Agent.lookup` are stubbed out. The\n * explicit `host: IP` + `Host:` header dance is the only mechanism that\n * actually pins on the current Bun runtime.\n * - Redirects are followed manually (up to `MAX_REDIRECTS`) and each hop\n * is re-validated, so a public hostname that 302s into a metadata\n * endpoint is rejected at the redirect step.\n * - 15s hard timeout per request.\n * - Output capped at `max_bytes` (default 200 KiB) — long pages are\n * truncated with an explicit marker. The pinned reader also stops\n * buffering past 2× the cap so a multi-MB body can't OOM us.\n */\n\nconst DEFAULT_MAX_BYTES = 200 * 1024\nconst HARD_MAX_BYTES = 1024 * 1024\nconst HTTP_TIMEOUT_MS = 15_000\nconst MAX_REDIRECTS = 5\n\n/**\n * IPv4 ranges that the SSRF guard refuses to fetch from. Covers the cloud\n * metadata services (AWS/Azure 169.254.169.254, GCP routes through the same\n * link-local block) plus every RFC1918 / loopback / reserved block a model\n * could be prompt-injected into hitting.\n */\nfunction isBlockedIPv4(ip: string): boolean {\n const parts = ip.split('.').map(Number)\n if (parts.length !== 4 || parts.some(p => !Number.isInteger(p) || p < 0 || p > 255))\n return true\n const [a, b] = parts as [number, number, number, number]\n if (a === 0)\n return true // 0.0.0.0/8 unspecified / \"this network\"\n if (a === 10)\n return true // 10/8 private\n if (a === 127)\n return true // loopback\n if (a === 169 && b === 254)\n return true // link-local + cloud metadata\n if (a === 172 && b >= 16 && b <= 31)\n return true // 172.16/12 private\n if (a === 192 && b === 168)\n return true // 192.168/16 private\n if (a === 192 && b === 0 && parts[2] === 0)\n return true // 192.0.0/24 IETF\n if (a === 198 && (b === 18 || b === 19))\n return true // 198.18/15 benchmark\n if (a >= 224)\n return true // multicast + reserved (224/4, 240/4)\n return false\n}\n\nfunction isBlockedIPv6(ip: string): boolean {\n const lower = ip.toLowerCase()\n // Normalise IPv4-mapped (::ffff:1.2.3.4) — recurse on the v4 tail. URL\n // parsing tends to canonicalise the dotted form into the hex pair\n // `::ffff:a9fe:a9fe`, so accept both shapes.\n const v4MappedDotted = lower.match(/^::ffff:([0-9.]+)$/)\n if (v4MappedDotted)\n return isBlockedIPv4(v4MappedDotted[1]!)\n const v4MappedHex = lower.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/)\n if (v4MappedHex) {\n const hi = Number.parseInt(v4MappedHex[1]!, 16)\n const lo = Number.parseInt(v4MappedHex[2]!, 16)\n const ipv4 = `${(hi >> 8) & 0xFF}.${hi & 0xFF}.${(lo >> 8) & 0xFF}.${lo & 0xFF}`\n return isBlockedIPv4(ipv4)\n }\n if (lower === '::' || lower === '::1')\n return true\n // fc00::/7 unique-local (covers fc.. and fd..)\n if (/^f[cd][0-9a-f]{0,2}:/.test(lower))\n return true\n // fe80::/10 link-local\n if (/^fe[89ab][0-9a-f]?:/.test(lower))\n return true\n // ff00::/8 multicast\n if (lower.startsWith('ff'))\n return true\n return false\n}\n\nexport function isBlockedAddress(ip: string): boolean {\n const family = isIP(ip)\n if (family === 4)\n return isBlockedIPv4(ip)\n if (family === 6)\n return isBlockedIPv6(ip)\n return true // not a recognised IP literal — refuse\n}\n\n/**\n * Normalize a hostname for allowlist comparison: lowercase, strip a trailing\n * dot (FQDN root) and IPv6 brackets, drop a leading dot on allowlist entries.\n */\nfunction normalizeHost(host: string): string {\n let h = host.trim().toLowerCase()\n if (h.startsWith('[') && h.endsWith(']'))\n h = h.slice(1, -1)\n if (h.endsWith('.'))\n h = h.slice(0, -1)\n if (h.startsWith('.'))\n h = h.slice(1)\n return h\n}\n\n/**\n * Site identity for cross-host redirect detection: the lowercased hostname\n * with a leading `www.` stripped, so `example.com` ⇄ `www.example.com` and a\n * path-only redirect aren't flagged as cross-host. Returns `null` for an\n * unparseable URL (caller skips the note rather than guessing).\n */\nfunction sameSiteHost(url: string): string | null {\n try {\n return new URL(url).hostname.toLowerCase().replace(/^www\\./, '')\n }\n catch {\n return null\n }\n}\n\n/**\n * Host-suffix allowlist check. An empty / undefined list means \"no allowlist\"\n * → every host passes (the SSRF blocklist is the only gate). Otherwise the\n * host must equal, or be a subdomain of, one of the entries. Subdomain match\n * is on a dot boundary so `example.com` matches `docs.example.com` but not\n * `notexample.com`.\n */\nexport function isHostAllowed(hostname: string, allowHosts: readonly string[] | undefined): boolean {\n if (!allowHosts || allowHosts.length === 0)\n return true\n const host = normalizeHost(hostname)\n for (const entry of allowHosts) {\n const allowed = normalizeHost(entry)\n if (allowed.length === 0)\n continue\n if (host === allowed || host.endsWith(`.${allowed}`))\n return true\n }\n return false\n}\n\n/**\n * Resolve `hostname` and refuse if any answer falls in a blocked range.\n *\n * Returns the first allowed `{ address, family }` so the caller can pin\n * the connection to it. Throws on any blocked answer so a multi-record\n * response with one private record fails closed.\n */\nasync function resolveAndCheck(hostname: string, allowHosts?: readonly string[]): Promise<{ address: string, family: 4 | 6 }> {\n // Egress allowlist (when configured) gates BEFORE DNS so a non-approved\n // host never even triggers a lookup. Enforced here so every redirect hop\n // is re-checked, not just the initial URL.\n if (!isHostAllowed(hostname, allowHosts))\n throw new Error(`refused: ${hostname} is not in the configured egress allowlist`)\n // `URL.hostname` keeps brackets around IPv6 literals (`[::1]`) — strip them\n // before the IP check so `isIP` recognises the literal and `dns.lookup`\n // doesn't try to resolve `[::1]` as a name.\n const bare = hostname.startsWith('[') && hostname.endsWith(']')\n ? hostname.slice(1, -1)\n : hostname\n const family = isIP(bare)\n if (family === 4 || family === 6) {\n if (isBlockedAddress(bare))\n throw new Error(`refused: ${bare} is in a blocked range`)\n return { address: bare, family }\n }\n const answers = await dns.lookup(bare, { all: true, verbatim: true })\n if (answers.length === 0)\n throw new Error(`DNS lookup returned no records for ${bare}`)\n for (const { address } of answers) {\n if (isBlockedAddress(address))\n throw new Error(`refused: ${bare} resolves to blocked address ${address}`)\n }\n const first = answers[0]!\n const fam = first.family === 6 ? 6 : 4\n return { address: first.address, family: fam }\n}\n\n/**\n * Pinned HTTP/HTTPS request. Connects to `pinnedIp` directly (bypassing\n * Node/Bun's own DNS resolution) while preserving the `Host:` header and\n * (for HTTPS) TLS SNI on the URL's original hostname. This is the\n * concrete defense against DNS rebinding — see the file-level docstring.\n *\n * Reads up to `maxBufferBytes` of body and then forcibly closes the\n * connection. The body is decoded as UTF-8; binary responses degrade to\n * mojibake but the tool's contract is text payloads anyway.\n */\ninterface PinnedResponse {\n status: number\n url: string\n contentType: string\n body: string\n location: string | null\n /**\n * True when the body was cut at `maxBufferBytes` before the server\n * finished sending. Optional so test seams that stub `requestImpl`\n * don't have to populate it; absent means \"not truncated\".\n */\n truncated?: boolean\n}\n\nfunction buildHostHeader(url: URL): string {\n if (!url.port)\n return url.hostname\n const defaultPort = url.protocol === 'https:' ? '443' : '80'\n return url.port === defaultPort ? url.hostname : `${url.hostname}:${url.port}`\n}\n\nexport function pinnedRequest(\n url: URL,\n pinnedIp: string,\n family: 4 | 6,\n headers: Record<string, string>,\n signal: AbortSignal,\n maxBufferBytes: number,\n): Promise<PinnedResponse> {\n return new Promise((resolve, reject) => {\n const isHttps = url.protocol === 'https:'\n const port = url.port\n ? Number.parseInt(url.port, 10)\n : (isHttps ? 443 : 80)\n\n // `host` is the literal IP, `servername` is the original hostname so\n // TLS cert verification still matches the cert's SAN/CN against the\n // user-visible name. Node uses `servername` for `checkServerIdentity`\n // automatically when set.\n const options: HttpRequestOptions & HttpsRequestOptions = {\n host: pinnedIp,\n port,\n path: `${url.pathname}${url.search}`,\n method: 'GET',\n family,\n headers: { ...headers, Host: buildHostHeader(url) },\n ...(isHttps ? { servername: url.hostname } : {}),\n }\n\n const request = isHttps ? httpsRequest : httpRequest\n const chunks: Buffer[] = []\n let received = 0\n // Single-shot settle guard. Bun's `node:http` is quirky around\n // `req.destroy(err)` — passing an error doesn't reliably surface as an\n // `error` event the way it does on Node. We track the settle state\n // ourselves and call `resolve` / `reject` directly from the abort /\n // timeout paths so the promise terminates even when the underlying\n // socket teardown is silent.\n let settled = false\n // Forward-declared so the `finish` / abort / timeout handlers can\n // close over `req` before it's assigned below. The request object is\n // wired into them via mutable refs because the handlers must be set\n // up *before* `request(options, callback)` fires its first event.\n let req: ReturnType<typeof httpRequest> | undefined\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const teardown = (): void => {\n try { req?.destroy() }\n catch { /* tear-down best effort */ }\n }\n\n const finish = (settler: () => void): void => {\n if (settled)\n return\n settled = true\n if (timer)\n clearTimeout(timer)\n signal.removeEventListener('abort', onSignalAbort)\n settler()\n }\n\n function onSignalAbort(): void {\n finish(() => reject(new Error('request aborted')))\n teardown()\n }\n\n // Pre-aborted signal — short-circuit so we don't even open a socket.\n // (This is the realistic shape when a user hits Ctrl+C while the agent\n // is already shutting down: the signal is `.aborted` by the time the\n // tool function runs.)\n if (signal.aborted) {\n reject(new Error('request aborted'))\n return\n }\n\n timer = setTimeout(() => {\n finish(() => reject(new Error(`request timed out after ${HTTP_TIMEOUT_MS}ms`)))\n teardown()\n }, HTTP_TIMEOUT_MS)\n\n signal.addEventListener('abort', onSignalAbort, { once: true })\n\n req = request(options, (res) => {\n const status = res.statusCode ?? 0\n const headersOut = res.headers\n const contentType = (headersOut['content-type'] ?? '').toString().toLowerCase()\n const location = typeof headersOut.location === 'string' ? headersOut.location : null\n\n // Short-circuit on redirect responses — body is irrelevant.\n if (status >= 300 && status < 400 && location) {\n res.resume() // drain so the socket can be released\n finish(() => resolve({ status, url: url.toString(), contentType, body: '', location }))\n return\n }\n\n let bodyTruncated = false\n res.on('data', (chunk: Buffer) => {\n if (received >= maxBufferBytes) {\n // Stop accumulating; tear the socket down so the server stops\n // sending. We still resolve cleanly from `end` (or `close` if\n // the server doesn't finish flushing before the kill lands).\n bodyTruncated = true\n teardown()\n return\n }\n // Keep only what fits in the budget — a chunk straddling the cap\n // would otherwise overshoot it by up to one chunk. A partial slice\n // means the body was cut, so flag it and stop the transfer.\n const room = maxBufferBytes - received\n if (chunk.length > room) {\n chunks.push(chunk.subarray(0, room))\n received += room\n bodyTruncated = true\n teardown()\n return\n }\n received += chunk.length\n chunks.push(chunk)\n })\n res.on('end', () => {\n const body = Buffer.concat(chunks).toString('utf-8')\n finish(() => resolve({ status, url: url.toString(), contentType, body, location: null, truncated: bodyTruncated }))\n })\n res.on('close', () => {\n // Socket torn down before `end` (e.g. when our maxBufferBytes\n // trigger destroyed the request). Resolve with whatever we\n // buffered so far — `truncated` tells the caller the body is cut.\n if (!settled) {\n const body = Buffer.concat(chunks).toString('utf-8')\n finish(() => resolve({ status, url: url.toString(), contentType, body, location: null, truncated: bodyTruncated }))\n }\n })\n res.on('error', err => finish(() => reject(err)))\n })\n\n req.on('error', (err: Error) => finish(() => reject(err)))\n req.end()\n })\n}\n\n/**\n * Walk up to {@link MAX_REDIRECTS} hops, validating the target host of each\n * 3xx response against the SSRF blocklist before following.\n *\n * `deps` is an internal seam for tests — production callers use the\n * defaults. Both knobs are intentionally opaque: hosts that want to\n * customize the blocklist should use a higher-level mechanism (a future\n * `behavior.fetchUrlAllowHosts` setting) rather than reaching into this.\n */\nexport interface FetchSsrfDeps {\n /** Resolve + validate a hostname. Defaults to {@link resolveAndCheck}. */\n resolver?: (hostname: string) => Promise<{ address: string, family: 4 | 6 }>\n /** Execute a single pinned HTTP request. Defaults to {@link pinnedRequest}. */\n requestImpl?: typeof pinnedRequest\n}\n\nexport async function fetchWithSsrfGuard(\n startUrl: URL,\n headers: Record<string, string>,\n signal: AbortSignal,\n maxBufferBytes: number,\n deps: FetchSsrfDeps = {},\n allowHosts?: readonly string[],\n): Promise<PinnedResponse> {\n // Default resolver binds the egress allowlist; a test-injected resolver\n // owns its own policy.\n const resolver = deps.resolver ?? ((hostname: string) => resolveAndCheck(hostname, allowHosts))\n const requestImpl = deps.requestImpl ?? pinnedRequest\n let current = startUrl\n for (let hop = 0; hop <= MAX_REDIRECTS; hop++) {\n const { address, family } = await resolver(current.hostname)\n const res = await requestImpl(current, address, family, headers, signal, maxBufferBytes)\n if (!res.location)\n return res\n if (hop === MAX_REDIRECTS)\n throw new Error(`too many redirects (>${MAX_REDIRECTS})`)\n let next: URL\n try {\n next = new URL(res.location, current)\n }\n catch {\n throw new Error(`invalid redirect target: ${res.location}`)\n }\n if (next.protocol !== 'http:' && next.protocol !== 'https:')\n throw new Error(`refused redirect to non-http(s) target: ${next.protocol}`)\n current = next\n }\n throw new Error('redirect loop exited unexpectedly')\n}\n\n/**\n * Opt-in, process-local response cache for `fetch_url`. Disabled unless\n * `behavior.fetchUrlCacheTtlMs` is set (> 0). Bounded by entry count and total\n * cached bytes; eviction is oldest-first (insertion order via `Map`, which is\n * a good-enough LRU because we delete-then-set on hit to refresh recency).\n *\n * Keyed on `<url>\\u0000<cap>\\u0000<egress-policy>` so two calls with different\n * `max_bytes` (hence different truncation) don't alias, and — because the\n * cache is module-global — an agent with a permissive `fetchUrlAllowHosts`\n * can't populate entries that a co-resident agent with a stricter allowlist\n * would then be served. Only successful text responses are stored — the\n * caller gates on status before writing.\n */\nconst FETCH_CACHE_MAX_ENTRIES = 64\nconst FETCH_CACHE_MAX_BYTES = 16 * 1024 * 1024 // 16 MiB total\n\ninterface FetchCacheEntry {\n /** Fully-formatted tool output (header + body) ready to return verbatim. */\n output: string\n expiresAt: number\n bytes: number\n}\n\nconst fetchCache = new Map<string, FetchCacheEntry>()\nlet fetchCacheBytes = 0\n\nfunction cacheKey(url: string, cap: number, allowHosts?: readonly string[]): string {\n // Normalize + sort so equivalent policies (`['A.com', 'b.com']` vs\n // `['b.com', 'a.com.']`) share entries; an absent/empty allowlist keys\n // as the empty policy.\n const policy = (allowHosts ?? []).map(normalizeHost).sort().join(',')\n return `${url}\\u0000${cap}\\u0000${policy}`\n}\n\nfunction cacheGet(key: string): string | null {\n const entry = fetchCache.get(key)\n if (!entry)\n return null\n if (Date.now() >= entry.expiresAt) {\n fetchCache.delete(key)\n fetchCacheBytes -= entry.bytes\n return null\n }\n // Refresh recency: re-insert at the tail of the Map's iteration order.\n fetchCache.delete(key)\n fetchCache.set(key, entry)\n return entry.output\n}\n\nfunction cacheSet(key: string, output: string, ttlMs: number): void {\n const bytes = Buffer.byteLength(output, 'utf-8')\n // A single oversize payload that can't fit under the byte cap is simply not\n // cached (still returned to the caller) rather than evicting everything.\n if (bytes > FETCH_CACHE_MAX_BYTES)\n return\n // Drop any stale entry for this key first so the byte accounting stays exact.\n const prev = fetchCache.get(key)\n if (prev) {\n fetchCache.delete(key)\n fetchCacheBytes -= prev.bytes\n }\n fetchCache.set(key, { output, expiresAt: Date.now() + ttlMs, bytes })\n fetchCacheBytes += bytes\n // Evict oldest-first until both caps are satisfied.\n while (fetchCache.size > FETCH_CACHE_MAX_ENTRIES || fetchCacheBytes > FETCH_CACHE_MAX_BYTES) {\n const oldest = fetchCache.keys().next().value\n if (oldest === undefined)\n break\n const victim = fetchCache.get(oldest)!\n fetchCache.delete(oldest)\n fetchCacheBytes -= victim.bytes\n }\n}\n\n/** Test seam — drop all cached entries. */\nexport function clearFetchUrlCache(): void {\n fetchCache.clear()\n fetchCacheBytes = 0\n}\n\n/**\n * Test seam — exercise the cache get/set/eviction in isolation without\n * standing up the full SSRF + HTTP path. Not part of the public tool surface;\n * `execute` uses the module-private functions directly.\n */\nexport const __fetchCacheTestApi = {\n key: cacheKey,\n get: cacheGet,\n set: cacheSet,\n size: () => fetchCache.size,\n bytes: () => fetchCacheBytes,\n}\n\nexport const fetchUrl: ToolDef = {\n isConcurrencySafe: true,\n spec: {\n name: 'fetch_url',\n description: 'Fetch a public URL and return its body as plain text. HTML is reduced to text (scripts, styles, tags stripped; entities decoded). If a `web_search` tool is also available, use it first when you do not already know the exact URL. Only http(s) URLs are accepted; loopback, link-local, private, and cloud-metadata addresses are refused. Output is capped (default 200 KiB).',\n inputSchema: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n description: 'HTTP or HTTPS URL to fetch.',\n },\n max_bytes: {\n type: 'number',\n description: `Truncate the response body beyond this many bytes. Default: ${DEFAULT_MAX_BYTES}. Hard cap: ${HARD_MAX_BYTES}.`,\n },\n },\n required: ['url'],\n },\n },\n async execute({ url, max_bytes }, ctx: ToolContext) {\n const raw = typeof url === 'string' ? url.trim() : ''\n if (!raw)\n return 'fetch_url error: `url` is required'\n let parsed: URL\n try {\n parsed = new URL(raw)\n }\n catch {\n return `fetch_url error: invalid URL: ${raw}`\n }\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')\n return `fetch_url error: only http(s) URLs are allowed (got ${parsed.protocol})`\n\n const cap = Math.min(\n typeof max_bytes === 'number' && max_bytes > 0 ? Math.floor(max_bytes) : DEFAULT_MAX_BYTES,\n HARD_MAX_BYTES,\n )\n // Buffer up to 2× the cap so HTML overhead doesn't starve the visible\n // text budget — a 200 KiB cap on rendered text can legitimately need to\n // read ~400 KiB of raw HTML before stripping. Hard ceiling is still\n // governed by `HARD_MAX_BYTES * 2` which is comfortably below OOM.\n const bufferCap = Math.min(cap * 2, HARD_MAX_BYTES * 2)\n\n // Opt-in response cache (off unless `behavior.fetchUrlCacheTtlMs > 0`).\n // The egress allowlist is part of the key AND re-checked before serving\n // a hit — the cache is module-global, so neither a policy change within\n // an agent nor a co-resident agent's entries may bypass this agent's\n // allowlist.\n const allowHosts = ctx.behavior?.fetchUrlAllowHosts\n const ttlMs = ctx.behavior?.fetchUrlCacheTtlMs\n const cacheEnabled = typeof ttlMs === 'number' && ttlMs > 0\n const key = cacheKey(parsed.toString(), cap, allowHosts)\n if (cacheEnabled && isHostAllowed(parsed.hostname, allowHosts)) {\n const hit = cacheGet(key)\n if (hit !== null)\n return hit\n }\n\n try {\n const res = await fetchWithSsrfGuard(\n parsed,\n {\n 'user-agent': 'Mozilla/5.0 (compatible; zidane/1.0)',\n 'accept': 'text/html,text/plain,application/json;q=0.9,*/*;q=0.5',\n 'accept-encoding': 'identity', // no gzip — we don't decompress\n },\n ctx.signal,\n bufferCap,\n {},\n allowHosts,\n )\n const body = res.body\n const isHtml = res.contentType.includes('html') || /^\\s*<!doctype html|^\\s*<html/i.test(body)\n const text = isHtml ? stripHtmlBlock(body) : body\n const truncated = text.length > cap\n // Two distinct truncation reasons: the rendered text overflowing `cap`,\n // and the raw transfer being cut at the buffer ceiling (`res.truncated`)\n // — the latter can leave the rendered text under `cap` (HTML overhead\n // stripped away), so it needs its own marker or the model would treat\n // a partial body as complete.\n const out = truncated\n ? `${text.slice(0, cap)}\\n\\n[truncated at ${cap} bytes; full length ${text.length}]`\n : res.truncated\n ? `${text}\\n\\n[response truncated: body exceeded the ${bufferCap}-byte transfer buffer]`\n : text\n // `res.url` reflects the FINAL hop after redirects; flag a cross-host\n // landing so the model knows the content came from a different origin\n // than it asked for (open-redirect awareness). Same-host path changes\n // and www add/strip are treated as the same site and not flagged.\n const finalHost = sameSiteHost(res.url)\n const requestedHost = sameSiteHost(parsed.toString())\n const redirectNote = finalHost && requestedHost && finalHost !== requestedHost\n ? `Note: ${parsed.hostname} redirected to a different host (${new URL(res.url).hostname}).\\n`\n : ''\n const header = `URL: ${res.url}\\nStatus: ${res.status}\\nContent-Type: ${res.contentType || '(none)'}\\n${redirectNote}\\n`\n const formatted = header + out\n // Cache only successful, complete text responses — never errors /\n // redirects / transfer-truncated bodies (a retry may get the rest).\n if (cacheEnabled && res.status >= 200 && res.status < 300 && res.truncated !== true)\n cacheSet(key, formatted, ttlMs)\n return formatted\n }\n catch (err) {\n return `fetch_url error: ${errorMessage(err)}`\n }\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,iBAAyC;CAC7C,KAAK;CACL,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,IAAI;CACJ,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,IAAI;CACJ,OAAO;CACP,QAAQ;CACR,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;CACP,OAAO;CACP,KAAK;CACL,OAAO;CACP,QAAQ;CACR,OAAO;AACT;;;;;;;AAQA,SAAS,kBAAkB,IAAoB;CAC7C,IAAI,CAAC,OAAO,SAAS,EAAE,KAAK,KAAK,KAAK,KAAK,SACzC,OAAO;CACT,IAAI;EACF,OAAO,OAAO,cAAc,EAAE;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SAAS,MAO5B,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE,oBAAoB,IAAI,sBAAsB,KAAK,OAAO,KAChF,IAAI,YACF,GAAG,KAAK,6CAA6C,UAAU,0BAC/D;GAKN,MAAM,YAAY,aAAa,IAAI,GAAG;GACtC,MAAM,gBAAgB,aAAa,OAAO,SAAS,CAAC;GACpD,MAAM,eAAe,aAAa,iBAAiB,cAAc,gBAC7D,SAAS,OAAO,SAAS,mCAAmC,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,SAAS,QACtF;GAEJ,MAAM,YAAY,QADK,IAAI,IAAI,YAAY,IAAI,OAAO,kBAAkB,IAAI,eAAe,SAAS,IAAI,aAAa,MAC1F;GAG3B,IAAI,gBAAgB,IAAI,UAAU,OAAO,IAAI,SAAS,OAAO,IAAI,cAAc,MAC7E,SAAS,KAAK,WAAW,KAAK;GAChC,OAAO;EACT,SACO,KAAK;GACV,OAAO,oBAAoB,aAAa,GAAG;EAC7C;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"fetch-url-ma-5_p0p.js","names":["dns","request","httpsRequest","httpRequest"],"sources":["../src/tools/_html.ts","../src/tools/fetch-url.ts"],"sourcesContent":["/**\n * Shared HTML → plain-text helpers used by the web-egress tools (`web_search`\n * snippet extraction, `fetch_url` body decoding).\n *\n * Best-effort by contract: a real HTML parser would be more correct but the\n * payload is always model context, never user-facing rendered output, so a\n * tag-stripper plus a curated entity table covers the practical cases\n * (Wikipedia, GitHub READMEs, MDN docs, Stack Overflow answers). When a tool\n * needs richer parsing it should reach for an actual parser rather than\n * extending these helpers ad-hoc.\n */\n\n/**\n * Curated named-entity table. Kept narrow on purpose — the long tail\n * (`Å`, `×`, mathematical refs, …) is out of scope because the\n * model handles unknown entities fine when they pass through verbatim. Add\n * entries when an entity is observed mangling real output, not speculatively.\n *\n * Keys are stored without the leading `&` / trailing `;` and matched\n * case-insensitively by the decoder.\n */\nconst NAMED_ENTITIES: Record<string, string> = {\n amp: '&',\n apos: '\\'',\n bull: '•',\n copy: '\\u00A9',\n ensp: ' ',\n emsp: ' ',\n gt: '>',\n hellip: '\\u2026',\n laquo: '\\u00AB',\n ldquo: '\\u201C',\n lsquo: '\\u2018',\n lt: '<',\n mdash: '\\u2014',\n middot: '\\u00B7',\n nbsp: ' ',\n ndash: '\\u2013',\n quot: '\"',\n raquo: '\\u00BB',\n rdquo: '\\u201D',\n reg: '\\u00AE',\n rsquo: '\\u2019',\n thinsp: ' ',\n trade: '\\u2122',\n}\n\n/**\n * `String.fromCodePoint` raises on out-of-range / non-finite inputs; the\n * agent's untrusted-payload assumption means we can't let a single broken\n * numeric reference crash the whole decode. Empty string on rejection is\n * the safest outcome (matches what most browsers do for invalid refs).\n */\nfunction safeFromCodePoint(cp: number): string {\n if (!Number.isFinite(cp) || cp < 0 || cp > 0x10FFFF)\n return ''\n try {\n return String.fromCodePoint(cp)\n }\n catch {\n return ''\n }\n}\n\n/**\n * Decode numeric character references (`&#x...;` / `&#NNN;`) and the curated\n * subset of named entities in {@link NAMED_ENTITIES}. Unknown named entities\n * are left as-is so the model can detect them rather than seeing a silently\n * corrupted token.\n *\n * `&` is decoded LAST so a double-escaped string like `&lt;` resolves\n * to `<` (not `<`) — that's the spec-correct single-pass decode shape.\n */\nexport function decodeHtmlEntities(text: string): string {\n let s = text\n .replace(/&#x([0-9a-f]+);/gi, (_, h) => safeFromCodePoint(Number.parseInt(h, 16)))\n .replace(/&#(\\d+);/g, (_, n) => safeFromCodePoint(Number.parseInt(n, 10)))\n s = s.replace(/&([a-z][a-z0-9]*);/gi, (full, name) => {\n const key = name.toLowerCase()\n // Defer `amp` so `&lt;` doesn't double-decode in a single pass.\n if (key === 'amp')\n return full\n const replacement = NAMED_ENTITIES[key]\n return replacement ?? full\n })\n return s.replace(/&/gi, '&')\n}\n\n/**\n * Strip `<script>`, `<style>`, `<noscript>`, comments, and every other tag.\n * Block-level openers (`<br>`, `<p>`, `<div>`, `<li>`, `<tr>`, `<h1-6>`) are\n * replaced with newlines so the resulting plaintext preserves readable\n * structure. Other tags collapse to spaces.\n */\nexport function stripHtml(html: string): string {\n return html\n .replace(/<script[\\s\\S]*?<\\/script>/gi, ' ')\n .replace(/<style[\\s\\S]*?<\\/style>/gi, ' ')\n .replace(/<noscript[\\s\\S]*?<\\/noscript>/gi, ' ')\n .replace(/<!--[\\s\\S]*?-->/g, ' ')\n .replace(/<(?:br|p|div|li|tr|h[1-6])[^>]*>/gi, '\\n')\n .replace(/<[^>]+>/g, ' ')\n}\n\n/**\n * Inline variant — strip tags + decode entities + collapse all whitespace\n * (including line breaks) into single spaces. For short snippets where\n * structural breaks would be visual noise (search-result titles, link text).\n */\nexport function stripHtmlInline(html: string): string {\n return decodeHtmlEntities(stripHtml(html))\n .replace(/\\s+/g, ' ')\n .trim()\n}\n\n/**\n * Block variant — strip tags + decode entities, preserve newlines emitted\n * by block-level openers, then collapse inline whitespace per-line and drop\n * empty lines. For full-page reductions where structure aids reading.\n */\nexport function stripHtmlBlock(html: string): string {\n return decodeHtmlEntities(stripHtml(html))\n .split('\\n')\n .map(line => line.replace(/[ \\t]+/g, ' ').trim())\n .filter(line => line.length > 0)\n .join('\\n')\n}\n","import type { RequestOptions as HttpRequestOptions } from 'node:http'\nimport type { RequestOptions as HttpsRequestOptions } from 'node:https'\nimport type { ToolContext, ToolDef } from './types'\nimport { Buffer } from 'node:buffer'\nimport { promises as dns } from 'node:dns'\nimport { request as httpRequest } from 'node:http'\nimport { request as httpsRequest } from 'node:https'\nimport { isIP } from 'node:net'\nimport { errorMessage } from '../errors'\nimport { stripHtmlBlock } from './_html'\n\n/**\n * Fetch a URL and return its text content.\n *\n * Companion to `web_search` (when registered) — after the model finds a\n * promising result it fetches the page to read the body in full. HTML is\n * reduced to plain text because the model rarely benefits from the markup\n * and we want to keep the payload inside the per-turn output budget.\n *\n * Restrictions:\n * - Only http(s) URLs. Anything else (file://, data:, ftp:) is rejected so\n * the tool can't be coerced into reading local files or arbitrary\n * resources.\n * - SSRF guard with TOCTOU defense: the host is DNS-resolved against the\n * loopback / link-local / private / reserved blocklist BEFORE the\n * request, and the resolved IP is then PINNED at the connection layer\n * via `node:http(s).request({ host: <resolved IP>, headers: { Host: ... },\n * servername: ... })`. This closes the classic DNS-rebinding gap where a\n * `globalThis.fetch` re-resolves the hostname and connects to a freshly\n * minted private IP. TLS verification still runs against the original\n * hostname via the explicit `servername` option.\n *\n * Note: the more idiomatic Node fix (an `undici.Agent` with a custom\n * `connect.lookup`) is silently a no-op on Bun ≤1.3 — both\n * `undici.Agent` and `node:https.Agent.lookup` are stubbed out. The\n * explicit `host: IP` + `Host:` header dance is the only mechanism that\n * actually pins on the current Bun runtime.\n * - Redirects are followed manually (up to `MAX_REDIRECTS`) and each hop\n * is re-validated, so a public hostname that 302s into a metadata\n * endpoint is rejected at the redirect step.\n * - 15s hard timeout per request.\n * - Output capped at `max_bytes` (default 200 KiB) — long pages are\n * truncated with an explicit marker. The pinned reader also stops\n * buffering past 2× the cap so a multi-MB body can't OOM us.\n */\n\nconst DEFAULT_MAX_BYTES = 200 * 1024\nconst HARD_MAX_BYTES = 1024 * 1024\nconst HTTP_TIMEOUT_MS = 15_000\nconst MAX_REDIRECTS = 5\n\n/**\n * IPv4 ranges that the SSRF guard refuses to fetch from. Covers the cloud\n * metadata services (AWS/Azure 169.254.169.254, GCP routes through the same\n * link-local block) plus every RFC1918 / loopback / reserved block a model\n * could be prompt-injected into hitting.\n */\nfunction isBlockedIPv4(ip: string): boolean {\n const parts = ip.split('.').map(Number)\n if (parts.length !== 4 || parts.some(p => !Number.isInteger(p) || p < 0 || p > 255))\n return true\n const [a, b] = parts as [number, number, number, number]\n if (a === 0)\n return true // 0.0.0.0/8 unspecified / \"this network\"\n if (a === 10)\n return true // 10/8 private\n if (a === 127)\n return true // loopback\n if (a === 169 && b === 254)\n return true // link-local + cloud metadata\n if (a === 172 && b >= 16 && b <= 31)\n return true // 172.16/12 private\n if (a === 192 && b === 168)\n return true // 192.168/16 private\n if (a === 192 && b === 0 && parts[2] === 0)\n return true // 192.0.0/24 IETF\n if (a === 198 && (b === 18 || b === 19))\n return true // 198.18/15 benchmark\n if (a >= 224)\n return true // multicast + reserved (224/4, 240/4)\n return false\n}\n\nfunction isBlockedIPv6(ip: string): boolean {\n const lower = ip.toLowerCase()\n // Normalise IPv4-mapped (::ffff:1.2.3.4) — recurse on the v4 tail. URL\n // parsing tends to canonicalise the dotted form into the hex pair\n // `::ffff:a9fe:a9fe`, so accept both shapes.\n const v4MappedDotted = lower.match(/^::ffff:([0-9.]+)$/)\n if (v4MappedDotted)\n return isBlockedIPv4(v4MappedDotted[1]!)\n const v4MappedHex = lower.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/)\n if (v4MappedHex) {\n const hi = Number.parseInt(v4MappedHex[1]!, 16)\n const lo = Number.parseInt(v4MappedHex[2]!, 16)\n const ipv4 = `${(hi >> 8) & 0xFF}.${hi & 0xFF}.${(lo >> 8) & 0xFF}.${lo & 0xFF}`\n return isBlockedIPv4(ipv4)\n }\n if (lower === '::' || lower === '::1')\n return true\n // fc00::/7 unique-local (covers fc.. and fd..)\n if (/^f[cd][0-9a-f]{0,2}:/.test(lower))\n return true\n // fe80::/10 link-local\n if (/^fe[89ab][0-9a-f]?:/.test(lower))\n return true\n // ff00::/8 multicast\n if (lower.startsWith('ff'))\n return true\n return false\n}\n\nexport function isBlockedAddress(ip: string): boolean {\n const family = isIP(ip)\n if (family === 4)\n return isBlockedIPv4(ip)\n if (family === 6)\n return isBlockedIPv6(ip)\n return true // not a recognised IP literal — refuse\n}\n\n/**\n * Normalize a hostname for allowlist comparison: lowercase, strip a trailing\n * dot (FQDN root) and IPv6 brackets, drop a leading dot on allowlist entries.\n */\nfunction normalizeHost(host: string): string {\n let h = host.trim().toLowerCase()\n if (h.startsWith('[') && h.endsWith(']'))\n h = h.slice(1, -1)\n if (h.endsWith('.'))\n h = h.slice(0, -1)\n if (h.startsWith('.'))\n h = h.slice(1)\n return h\n}\n\n/**\n * Site identity for cross-host redirect detection: the lowercased hostname\n * with a leading `www.` stripped, so `example.com` ⇄ `www.example.com` and a\n * path-only redirect aren't flagged as cross-host. Returns `null` for an\n * unparseable URL (caller skips the note rather than guessing).\n */\nfunction sameSiteHost(url: string): string | null {\n try {\n return new URL(url).hostname.toLowerCase().replace(/^www\\./, '')\n }\n catch {\n return null\n }\n}\n\n/**\n * Host-suffix allowlist check. An empty / undefined list means \"no allowlist\"\n * → every host passes (the SSRF blocklist is the only gate). Otherwise the\n * host must equal, or be a subdomain of, one of the entries. Subdomain match\n * is on a dot boundary so `example.com` matches `docs.example.com` but not\n * `notexample.com`.\n */\nexport function isHostAllowed(hostname: string, allowHosts: readonly string[] | undefined): boolean {\n if (!allowHosts || allowHosts.length === 0)\n return true\n const host = normalizeHost(hostname)\n for (const entry of allowHosts) {\n const allowed = normalizeHost(entry)\n if (allowed.length === 0)\n continue\n if (host === allowed || host.endsWith(`.${allowed}`))\n return true\n }\n return false\n}\n\n/**\n * Resolve `hostname` and refuse if any answer falls in a blocked range.\n *\n * Returns the first allowed `{ address, family }` so the caller can pin\n * the connection to it. Throws on any blocked answer so a multi-record\n * response with one private record fails closed.\n */\nasync function resolveAndCheck(hostname: string, allowHosts?: readonly string[]): Promise<{ address: string, family: 4 | 6 }> {\n // Egress allowlist (when configured) gates BEFORE DNS so a non-approved\n // host never even triggers a lookup. Enforced here so every redirect hop\n // is re-checked, not just the initial URL.\n if (!isHostAllowed(hostname, allowHosts))\n throw new Error(`refused: ${hostname} is not in the configured egress allowlist`)\n // `URL.hostname` keeps brackets around IPv6 literals (`[::1]`) — strip them\n // before the IP check so `isIP` recognises the literal and `dns.lookup`\n // doesn't try to resolve `[::1]` as a name.\n const bare = hostname.startsWith('[') && hostname.endsWith(']')\n ? hostname.slice(1, -1)\n : hostname\n const family = isIP(bare)\n if (family === 4 || family === 6) {\n if (isBlockedAddress(bare))\n throw new Error(`refused: ${bare} is in a blocked range`)\n return { address: bare, family }\n }\n const answers = await dns.lookup(bare, { all: true, verbatim: true })\n if (answers.length === 0)\n throw new Error(`DNS lookup returned no records for ${bare}`)\n for (const { address } of answers) {\n if (isBlockedAddress(address))\n throw new Error(`refused: ${bare} resolves to blocked address ${address}`)\n }\n const first = answers[0]!\n const fam = first.family === 6 ? 6 : 4\n return { address: first.address, family: fam }\n}\n\n/**\n * Pinned HTTP/HTTPS request. Connects to `pinnedIp` directly (bypassing\n * Node/Bun's own DNS resolution) while preserving the `Host:` header and\n * (for HTTPS) TLS SNI on the URL's original hostname. This is the\n * concrete defense against DNS rebinding — see the file-level docstring.\n *\n * Reads up to `maxBufferBytes` of body and then forcibly closes the\n * connection. The body is decoded as UTF-8; binary responses degrade to\n * mojibake but the tool's contract is text payloads anyway.\n */\ninterface PinnedResponse {\n status: number\n url: string\n contentType: string\n body: string\n location: string | null\n /**\n * True when the body was cut at `maxBufferBytes` before the server\n * finished sending. Optional so test seams that stub `requestImpl`\n * don't have to populate it; absent means \"not truncated\".\n */\n truncated?: boolean\n}\n\nfunction buildHostHeader(url: URL): string {\n if (!url.port)\n return url.hostname\n const defaultPort = url.protocol === 'https:' ? '443' : '80'\n return url.port === defaultPort ? url.hostname : `${url.hostname}:${url.port}`\n}\n\nexport function pinnedRequest(\n url: URL,\n pinnedIp: string,\n family: 4 | 6,\n headers: Record<string, string>,\n signal: AbortSignal,\n maxBufferBytes: number,\n): Promise<PinnedResponse> {\n return new Promise((resolve, reject) => {\n const isHttps = url.protocol === 'https:'\n const port = url.port\n ? Number.parseInt(url.port, 10)\n : (isHttps ? 443 : 80)\n\n // `host` is the literal IP, `servername` is the original hostname so\n // TLS cert verification still matches the cert's SAN/CN against the\n // user-visible name. Node uses `servername` for `checkServerIdentity`\n // automatically when set.\n const options: HttpRequestOptions & HttpsRequestOptions = {\n host: pinnedIp,\n port,\n path: `${url.pathname}${url.search}`,\n method: 'GET',\n family,\n headers: { ...headers, Host: buildHostHeader(url) },\n ...(isHttps ? { servername: url.hostname } : {}),\n }\n\n const request = isHttps ? httpsRequest : httpRequest\n const chunks: Buffer[] = []\n let received = 0\n // Single-shot settle guard. Bun's `node:http` is quirky around\n // `req.destroy(err)` — passing an error doesn't reliably surface as an\n // `error` event the way it does on Node. We track the settle state\n // ourselves and call `resolve` / `reject` directly from the abort /\n // timeout paths so the promise terminates even when the underlying\n // socket teardown is silent.\n let settled = false\n // Forward-declared so the `finish` / abort / timeout handlers can\n // close over `req` before it's assigned below. The request object is\n // wired into them via mutable refs because the handlers must be set\n // up *before* `request(options, callback)` fires its first event.\n let req: ReturnType<typeof httpRequest> | undefined\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const teardown = (): void => {\n try { req?.destroy() }\n catch { /* tear-down best effort */ }\n }\n\n const finish = (settler: () => void): void => {\n if (settled)\n return\n settled = true\n if (timer)\n clearTimeout(timer)\n signal.removeEventListener('abort', onSignalAbort)\n settler()\n }\n\n function onSignalAbort(): void {\n finish(() => reject(new Error('request aborted')))\n teardown()\n }\n\n // Pre-aborted signal — short-circuit so we don't even open a socket.\n // (This is the realistic shape when a user hits Ctrl+C while the agent\n // is already shutting down: the signal is `.aborted` by the time the\n // tool function runs.)\n if (signal.aborted) {\n reject(new Error('request aborted'))\n return\n }\n\n timer = setTimeout(() => {\n finish(() => reject(new Error(`request timed out after ${HTTP_TIMEOUT_MS}ms`)))\n teardown()\n }, HTTP_TIMEOUT_MS)\n\n signal.addEventListener('abort', onSignalAbort, { once: true })\n\n req = request(options, (res) => {\n const status = res.statusCode ?? 0\n const headersOut = res.headers\n const contentType = (headersOut['content-type'] ?? '').toString().toLowerCase()\n const location = typeof headersOut.location === 'string' ? headersOut.location : null\n\n // Short-circuit on redirect responses — body is irrelevant.\n if (status >= 300 && status < 400 && location) {\n res.resume() // drain so the socket can be released\n finish(() => resolve({ status, url: url.toString(), contentType, body: '', location }))\n return\n }\n\n let bodyTruncated = false\n res.on('data', (chunk: Buffer) => {\n if (received >= maxBufferBytes) {\n // Stop accumulating; tear the socket down so the server stops\n // sending. We still resolve cleanly from `end` (or `close` if\n // the server doesn't finish flushing before the kill lands).\n bodyTruncated = true\n teardown()\n return\n }\n // Keep only what fits in the budget — a chunk straddling the cap\n // would otherwise overshoot it by up to one chunk. A partial slice\n // means the body was cut, so flag it and stop the transfer.\n const room = maxBufferBytes - received\n if (chunk.length > room) {\n chunks.push(chunk.subarray(0, room))\n received += room\n bodyTruncated = true\n teardown()\n return\n }\n received += chunk.length\n chunks.push(chunk)\n })\n res.on('end', () => {\n const body = Buffer.concat(chunks).toString('utf-8')\n finish(() => resolve({ status, url: url.toString(), contentType, body, location: null, truncated: bodyTruncated }))\n })\n res.on('close', () => {\n // Socket torn down before `end` (e.g. when our maxBufferBytes\n // trigger destroyed the request). Resolve with whatever we\n // buffered so far — `truncated` tells the caller the body is cut.\n if (!settled) {\n const body = Buffer.concat(chunks).toString('utf-8')\n finish(() => resolve({ status, url: url.toString(), contentType, body, location: null, truncated: bodyTruncated }))\n }\n })\n res.on('error', err => finish(() => reject(err)))\n })\n\n req.on('error', (err: Error) => finish(() => reject(err)))\n req.end()\n })\n}\n\n/**\n * Walk up to {@link MAX_REDIRECTS} hops, validating the target host of each\n * 3xx response against the SSRF blocklist before following.\n *\n * `deps` is an internal seam for tests — production callers use the\n * defaults. Both knobs are intentionally opaque: hosts that want to\n * customize the blocklist should use a higher-level mechanism (a future\n * `behavior.fetchUrlAllowHosts` setting) rather than reaching into this.\n */\nexport interface FetchSsrfDeps {\n /** Resolve + validate a hostname. Defaults to {@link resolveAndCheck}. */\n resolver?: (hostname: string) => Promise<{ address: string, family: 4 | 6 }>\n /** Execute a single pinned HTTP request. Defaults to {@link pinnedRequest}. */\n requestImpl?: typeof pinnedRequest\n}\n\nexport async function fetchWithSsrfGuard(\n startUrl: URL,\n headers: Record<string, string>,\n signal: AbortSignal,\n maxBufferBytes: number,\n deps: FetchSsrfDeps = {},\n allowHosts?: readonly string[],\n): Promise<PinnedResponse> {\n // Default resolver binds the egress allowlist; a test-injected resolver\n // owns its own policy.\n const resolver = deps.resolver ?? ((hostname: string) => resolveAndCheck(hostname, allowHosts))\n const requestImpl = deps.requestImpl ?? pinnedRequest\n let current = startUrl\n for (let hop = 0; hop <= MAX_REDIRECTS; hop++) {\n const { address, family } = await resolver(current.hostname)\n const res = await requestImpl(current, address, family, headers, signal, maxBufferBytes)\n if (!res.location)\n return res\n if (hop === MAX_REDIRECTS)\n throw new Error(`too many redirects (>${MAX_REDIRECTS})`)\n let next: URL\n try {\n next = new URL(res.location, current)\n }\n catch {\n throw new Error(`invalid redirect target: ${res.location}`)\n }\n if (next.protocol !== 'http:' && next.protocol !== 'https:')\n throw new Error(`refused redirect to non-http(s) target: ${next.protocol}`)\n current = next\n }\n throw new Error('redirect loop exited unexpectedly')\n}\n\n/**\n * Opt-in, process-local response cache for `fetch_url`. Disabled unless\n * `behavior.fetchUrlCacheTtlMs` is set (> 0). Bounded by entry count and total\n * cached bytes; eviction is oldest-first (insertion order via `Map`, which is\n * a good-enough LRU because we delete-then-set on hit to refresh recency).\n *\n * Keyed on `<url>\\u0000<cap>\\u0000<egress-policy>` so two calls with different\n * `max_bytes` (hence different truncation) don't alias, and — because the\n * cache is module-global — an agent with a permissive `fetchUrlAllowHosts`\n * can't populate entries that a co-resident agent with a stricter allowlist\n * would then be served. Only successful text responses are stored — the\n * caller gates on status before writing.\n */\nconst FETCH_CACHE_MAX_ENTRIES = 64\nconst FETCH_CACHE_MAX_BYTES = 16 * 1024 * 1024 // 16 MiB total\n\ninterface FetchCacheEntry {\n /** Fully-formatted tool output (header + body) ready to return verbatim. */\n output: string\n expiresAt: number\n bytes: number\n}\n\nconst fetchCache = new Map<string, FetchCacheEntry>()\nlet fetchCacheBytes = 0\n\nfunction cacheKey(url: string, cap: number, allowHosts?: readonly string[]): string {\n // Normalize + sort so equivalent policies (`['A.com', 'b.com']` vs\n // `['b.com', 'a.com.']`) share entries; an absent/empty allowlist keys\n // as the empty policy.\n const policy = (allowHosts ?? []).map(normalizeHost).sort().join(',')\n return `${url}\\u0000${cap}\\u0000${policy}`\n}\n\nfunction cacheGet(key: string): string | null {\n const entry = fetchCache.get(key)\n if (!entry)\n return null\n if (Date.now() >= entry.expiresAt) {\n fetchCache.delete(key)\n fetchCacheBytes -= entry.bytes\n return null\n }\n // Refresh recency: re-insert at the tail of the Map's iteration order.\n fetchCache.delete(key)\n fetchCache.set(key, entry)\n return entry.output\n}\n\nfunction cacheSet(key: string, output: string, ttlMs: number): void {\n const bytes = Buffer.byteLength(output, 'utf-8')\n // A single oversize payload that can't fit under the byte cap is simply not\n // cached (still returned to the caller) rather than evicting everything.\n if (bytes > FETCH_CACHE_MAX_BYTES)\n return\n // Drop any stale entry for this key first so the byte accounting stays exact.\n const prev = fetchCache.get(key)\n if (prev) {\n fetchCache.delete(key)\n fetchCacheBytes -= prev.bytes\n }\n fetchCache.set(key, { output, expiresAt: Date.now() + ttlMs, bytes })\n fetchCacheBytes += bytes\n // Evict oldest-first until both caps are satisfied.\n while (fetchCache.size > FETCH_CACHE_MAX_ENTRIES || fetchCacheBytes > FETCH_CACHE_MAX_BYTES) {\n const oldest = fetchCache.keys().next().value\n if (oldest === undefined)\n break\n const victim = fetchCache.get(oldest)!\n fetchCache.delete(oldest)\n fetchCacheBytes -= victim.bytes\n }\n}\n\n/** Test seam — drop all cached entries. */\nexport function clearFetchUrlCache(): void {\n fetchCache.clear()\n fetchCacheBytes = 0\n}\n\n/**\n * Test seam — exercise the cache get/set/eviction in isolation without\n * standing up the full SSRF + HTTP path. Not part of the public tool surface;\n * `execute` uses the module-private functions directly.\n */\nexport const __fetchCacheTestApi = {\n key: cacheKey,\n get: cacheGet,\n set: cacheSet,\n size: () => fetchCache.size,\n bytes: () => fetchCacheBytes,\n}\n\nexport const fetchUrl: ToolDef = {\n isConcurrencySafe: true,\n spec: {\n name: 'fetch_url',\n description: 'Fetch a public URL and return its body as plain text. HTML is reduced to text (scripts, styles, tags stripped; entities decoded). If a `web_search` tool is also available, use it first when you do not already know the exact URL. Only http(s) URLs are accepted; loopback, link-local, private, and cloud-metadata addresses are refused. Output is capped (default 200 KiB).',\n inputSchema: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n description: 'HTTP or HTTPS URL to fetch.',\n },\n max_bytes: {\n type: 'number',\n description: `Truncate the response body beyond this many bytes. Default: ${DEFAULT_MAX_BYTES}. Hard cap: ${HARD_MAX_BYTES}.`,\n },\n },\n required: ['url'],\n },\n },\n async execute({ url, max_bytes }, ctx: ToolContext) {\n const raw = typeof url === 'string' ? url.trim() : ''\n if (!raw)\n return 'fetch_url error: `url` is required'\n let parsed: URL\n try {\n parsed = new URL(raw)\n }\n catch {\n return `fetch_url error: invalid URL: ${raw}`\n }\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')\n return `fetch_url error: only http(s) URLs are allowed (got ${parsed.protocol})`\n\n const cap = Math.min(\n typeof max_bytes === 'number' && max_bytes > 0 ? Math.floor(max_bytes) : DEFAULT_MAX_BYTES,\n HARD_MAX_BYTES,\n )\n // Buffer up to 2× the cap so HTML overhead doesn't starve the visible\n // text budget — a 200 KiB cap on rendered text can legitimately need to\n // read ~400 KiB of raw HTML before stripping. Hard ceiling is still\n // governed by `HARD_MAX_BYTES * 2` which is comfortably below OOM.\n const bufferCap = Math.min(cap * 2, HARD_MAX_BYTES * 2)\n\n // Opt-in response cache (off unless `behavior.fetchUrlCacheTtlMs > 0`).\n // The egress allowlist is part of the key AND re-checked before serving\n // a hit — the cache is module-global, so neither a policy change within\n // an agent nor a co-resident agent's entries may bypass this agent's\n // allowlist.\n const allowHosts = ctx.behavior?.fetchUrlAllowHosts\n const ttlMs = ctx.behavior?.fetchUrlCacheTtlMs\n const cacheEnabled = typeof ttlMs === 'number' && ttlMs > 0\n const key = cacheKey(parsed.toString(), cap, allowHosts)\n if (cacheEnabled && isHostAllowed(parsed.hostname, allowHosts)) {\n const hit = cacheGet(key)\n if (hit !== null)\n return hit\n }\n\n try {\n const res = await fetchWithSsrfGuard(\n parsed,\n {\n 'user-agent': 'Mozilla/5.0 (compatible; zidane/1.0)',\n 'accept': 'text/html,text/plain,application/json;q=0.9,*/*;q=0.5',\n 'accept-encoding': 'identity', // no gzip — we don't decompress\n },\n ctx.signal,\n bufferCap,\n {},\n allowHosts,\n )\n const body = res.body\n const isHtml = res.contentType.includes('html') || /^\\s*<!doctype html|^\\s*<html/i.test(body)\n const text = isHtml ? stripHtmlBlock(body) : body\n const truncated = text.length > cap\n // Two distinct truncation reasons: the rendered text overflowing `cap`,\n // and the raw transfer being cut at the buffer ceiling (`res.truncated`)\n // — the latter can leave the rendered text under `cap` (HTML overhead\n // stripped away), so it needs its own marker or the model would treat\n // a partial body as complete.\n const out = truncated\n ? `${text.slice(0, cap)}\\n\\n[truncated at ${cap} bytes; full length ${text.length}]`\n : res.truncated\n ? `${text}\\n\\n[response truncated: body exceeded the ${bufferCap}-byte transfer buffer]`\n : text\n // `res.url` reflects the FINAL hop after redirects; flag a cross-host\n // landing so the model knows the content came from a different origin\n // than it asked for (open-redirect awareness). Same-host path changes\n // and www add/strip are treated as the same site and not flagged.\n const finalHost = sameSiteHost(res.url)\n const requestedHost = sameSiteHost(parsed.toString())\n const redirectNote = finalHost && requestedHost && finalHost !== requestedHost\n ? `Note: ${parsed.hostname} redirected to a different host (${new URL(res.url).hostname}).\\n`\n : ''\n const header = `URL: ${res.url}\\nStatus: ${res.status}\\nContent-Type: ${res.contentType || '(none)'}\\n${redirectNote}\\n`\n const formatted = header + out\n // Cache only successful, complete text responses — never errors /\n // redirects / transfer-truncated bodies (a retry may get the rest).\n if (cacheEnabled && res.status >= 200 && res.status < 300 && res.truncated !== true)\n cacheSet(key, formatted, ttlMs)\n return formatted\n }\n catch (err) {\n return `fetch_url error: ${errorMessage(err)}`\n }\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,iBAAyC;CAC7C,KAAK;CACL,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,IAAI;C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GAC9D,MAAM,MAAM,SAAS,GAAG;GACxB,IAAI,QAAQ,MACV,OAAO;EACX;EAEA,IAAI;GACF,MAAM,MAAM,MAAM,mBAChB,QACA;IACE,cAAc;IACd,UAAU;IACV,mBAAmB;GACrB,GACA,IAAI,QACJ,WACA,CAAC,GACD,UACF;GACA,MAAM,OAAO,IAAI;GAEjB,MAAM,OADS,IAAI,YAAY,SAAS,MAAM,KAAK,gCAAgC,KAAK,IAAI,IACtE,eAAe,IAAI,IAAI;GAO7C,MAAM,MANY,KAAK,SAAS,MAO5B,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE,oBAAoB,IAAI,sBAAsB,KAAK,OAAO,KAChF,IAAI,YACF,GAAG,KAAK,6CAA6C,UAAU,0BAC/D;GAKN,MAAM,YAAY,aAAa,IAAI,GAAG;GACtC,MAAM,gBAAgB,aAAa,OAAO,SAAS,CAAC;GACpD,MAAM,eAAe,aAAa,iBAAiB,cAAc,gBAC7D,SAAS,OAAO,SAAS,mCAAmC,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,SAAS,QACtF;GAEJ,MAAM,YAAY,QADK,IAAI,IAAI,YAAY,IAAI,OAAO,kBAAkB,IAAI,eAAe,SAAS,IAAI,aAAa,MAC1F;GAG3B,IAAI,gBAAgB,IAAI,UAAU,OAAO,IAAI,SAAS,OAAO,IAAI,cAAc,MAC7E,SAAS,KAAK,WAAW,KAAK;GAChC,OAAO;EACT,SACO,KAAK;GACV,OAAO,oBAAoB,aAAa,GAAG;EAC7C;CACF;AACF"}
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $n as HeadlessResult, Jn as FormattedHeadlessTurnEvent, Qn as HeadlessOutputFormat, Xn as HeadlessEvent, Yn as HeadlessErrorInfo, Zn as HeadlessOptions, ar as exitCodeForHeadlessResult, cr as formattedHeadlessTurnEventToJsonl, dr as providerTranscriptFormatForProvider, er as HeadlessStatus, fr as runHeadless, ir as ProviderTranscriptFormat, lr as headlessEventToJsonl, mr as transcriptToProviderMessages, nr as OpenAIChatContentPart, or as formatHeadlessResult, pr as transcriptToOpenAIMessages, qn as FormattedHeadlessResult, rr as OpenAIChatMessage, sr as formatHeadlessTurnEvent, tr as HeadlessUsage, ur as installHeadlessEventAdapter } from "./index-
|
|
1
|
+
import { $n as HeadlessResult, Jn as FormattedHeadlessTurnEvent, Qn as HeadlessOutputFormat, Xn as HeadlessEvent, Yn as HeadlessErrorInfo, Zn as HeadlessOptions, ar as exitCodeForHeadlessResult, cr as formattedHeadlessTurnEventToJsonl, dr as providerTranscriptFormatForProvider, er as HeadlessStatus, fr as runHeadless, ir as ProviderTranscriptFormat, lr as headlessEventToJsonl, mr as transcriptToProviderMessages, nr as OpenAIChatContentPart, or as formatHeadlessResult, pr as transcriptToOpenAIMessages, qn as FormattedHeadlessResult, rr as OpenAIChatMessage, sr as formatHeadlessTurnEvent, tr as HeadlessUsage, ur as installHeadlessEventAdapter } from "./index-ZWibV230.js";
|
|
2
2
|
export { FormattedHeadlessResult, FormattedHeadlessTurnEvent, HeadlessErrorInfo, HeadlessEvent, HeadlessOptions, HeadlessOutputFormat, HeadlessResult, HeadlessStatus, HeadlessUsage, OpenAIChatContentPart, OpenAIChatMessage, ProviderTranscriptFormat, exitCodeForHeadlessResult, formatHeadlessResult, formatHeadlessTurnEvent, formattedHeadlessTurnEventToJsonl, headlessEventToJsonl, installHeadlessEventAdapter, providerTranscriptFormatForProvider, runHeadless, transcriptToOpenAIMessages, transcriptToProviderMessages };
|
package/dist/headless.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as isWireTurn, i as documentBlockMarker, l as toolResultToText, n as assertResolvedMediaBlock } from "./types-BIarq1qE.js";
|
|
2
|
-
import { bt as basic_default, t as createAgent } from "./agent-
|
|
2
|
+
import { bt as basic_default, t as createAgent } from "./agent-CcTWL-Z6.js";
|
|
3
3
|
import { r as createProcessContext } from "./contexts-DWVt7MvF.js";
|
|
4
4
|
import { t as audioFormatFromMediaType } from "./media-sniff-UKijEaiQ.js";
|
|
5
|
-
import { c as ensureToolResultPairing, g as toAnthropic } from "./messages-
|
|
6
|
-
import { d as createMemoryStore, t as createSession } from "./session-
|
|
5
|
+
import { c as ensureToolResultPairing, g as toAnthropic } from "./messages-CZMUuKzo.js";
|
|
6
|
+
import { d as createMemoryStore, t as createSession } from "./session-CyRLSsVa.js";
|
|
7
7
|
import { t as createRunSummaryCollector } from "./run-summary-BU_NgwUT.js";
|
|
8
8
|
//#region src/headless.ts
|
|
9
9
|
function exitCodeForHeadlessResult(result) {
|
|
@@ -5193,11 +5193,21 @@ declare function getOAuthProvider(id: string): OAuthProviderInterface | undefine
|
|
|
5193
5193
|
* Get an API key for a provider from OAuth credentials, refreshing expired
|
|
5194
5194
|
* tokens through the registered flow. Same contract as the pi-ai original
|
|
5195
5195
|
* (`null` when no credentials are stored for the provider, throws on unknown
|
|
5196
|
-
* provider or refresh failure),
|
|
5197
|
-
*
|
|
5198
|
-
*
|
|
5199
|
-
|
|
5200
|
-
|
|
5196
|
+
* provider or refresh failure), with two deliberate additions:
|
|
5197
|
+
*
|
|
5198
|
+
* - refresh failures keep the underlying reason — the original discarded it,
|
|
5199
|
+
* leaving invalid_grant (needs re-login) indistinguishable from a transient
|
|
5200
|
+
* network error.
|
|
5201
|
+
* - `options.force` rotates regardless of the local expiry, for 401 recovery
|
|
5202
|
+
* when the server revoked the grant before our stored timestamp said so.
|
|
5203
|
+
* Expressed as a flag rather than by handing this function a credential
|
|
5204
|
+
* with a doctored `expires`: callers persist whatever comes back, so a
|
|
5205
|
+
* fabricated expiry that a provider echoes through would land in the
|
|
5206
|
+
* credential store. See `resolveCredentialSource` in `./oauth.ts`.
|
|
5207
|
+
*/
|
|
5208
|
+
declare function getOAuthApiKey(providerId: string, credentials: Record<string, OAuthCredentials>, options?: {
|
|
5209
|
+
force?: boolean;
|
|
5210
|
+
}): Promise<{
|
|
5201
5211
|
newCredentials: OAuthCredentials;
|
|
5202
5212
|
apiKey: string;
|
|
5203
5213
|
} | null>;
|
|
@@ -5271,6 +5281,15 @@ interface ResolveOAuthApiKeyOptions<TParams extends OAuthParams = OAuthParams> {
|
|
|
5271
5281
|
readCredentials?: () => Record<string, OAuthCredentials | undefined>;
|
|
5272
5282
|
writeCredentials?: (credentials: Record<string, OAuthCredentials | undefined>) => void;
|
|
5273
5283
|
getOAuthApiKey?: GetOAuthApiKey;
|
|
5284
|
+
/**
|
|
5285
|
+
* Force a refresh even when the credential's local expiry is still in the
|
|
5286
|
+
* future (for one-shot 401 recovery). Reaches the refresh helper as an
|
|
5287
|
+
* explicit flag, so no credential with a fabricated expiry ever exists to
|
|
5288
|
+
* leak into the store — see {@link getOAuthApiKey}.
|
|
5289
|
+
*/
|
|
5290
|
+
forceRefresh?: boolean;
|
|
5291
|
+
/** Access token rejected by the server; a different token found under lock is reused instead of rotated again. */
|
|
5292
|
+
rejectedAccess?: string;
|
|
5274
5293
|
}
|
|
5275
5294
|
/**
|
|
5276
5295
|
* Read the shared credentials file.
|
|
@@ -8146,6 +8165,20 @@ interface AuthMethod {
|
|
|
8146
8165
|
source: 'env' | 'oauth' | 'apikey';
|
|
8147
8166
|
/** Human-readable detail (env var name, expiry timestamp, …). */
|
|
8148
8167
|
detail: string;
|
|
8168
|
+
/**
|
|
8169
|
+
* True for the credential every reader actually resolves.
|
|
8170
|
+
*
|
|
8171
|
+
* Exactly one STORED credential is active: the one in the canonical file key
|
|
8172
|
+
* (see `alternateCredKey`). A provider can now hold both an API key and an
|
|
8173
|
+
* OAuth grant, so the list alone no longer says which one wins. `env` is
|
|
8174
|
+
* never marked active — it is an observable signal, not a stored credential
|
|
8175
|
+
* the user can promote.
|
|
8176
|
+
*
|
|
8177
|
+
* Optional so hosts that build `ProviderAuth` themselves (this type is public
|
|
8178
|
+
* via `zidane/chat`) keep compiling; absent reads as "not active".
|
|
8179
|
+
* {@link detectAuth} always sets it.
|
|
8180
|
+
*/
|
|
8181
|
+
active?: boolean;
|
|
8149
8182
|
}
|
|
8150
8183
|
interface ProviderAuth {
|
|
8151
8184
|
key: ProviderKey;
|
|
@@ -8153,17 +8186,29 @@ interface ProviderAuth {
|
|
|
8153
8186
|
/** True when at least one credential source is present. */
|
|
8154
8187
|
available: boolean;
|
|
8155
8188
|
methods: AuthMethod[];
|
|
8189
|
+
/**
|
|
8190
|
+
* Env var this provider reads, when it declares one.
|
|
8191
|
+
*
|
|
8192
|
+
* Carried separately from {@link methods} because the settings list shows the
|
|
8193
|
+
* env slot even when it holds nothing. `methods` only ever lists sources that
|
|
8194
|
+
* are actually present, since `available` is derived from it.
|
|
8195
|
+
*/
|
|
8196
|
+
envKey?: string;
|
|
8156
8197
|
}
|
|
8157
8198
|
/**
|
|
8158
8199
|
* Detect available auth for every registered provider.
|
|
8159
8200
|
*
|
|
8160
|
-
*
|
|
8161
|
-
*
|
|
8162
|
-
*
|
|
8201
|
+
* A method appears in `methods` for every layer that has a credential:
|
|
8202
|
+
*
|
|
8203
|
+
* - `kind: 'apikey'` from `credentials.json` (injected into env at TUI launch)
|
|
8204
|
+
* - explicit env var (descriptor's `envKey`)
|
|
8205
|
+
* - `kind: 'oauth'` from `credentials.json` (or legacy `cwd/.credentials.json`)
|
|
8163
8206
|
*
|
|
8164
|
-
*
|
|
8165
|
-
*
|
|
8166
|
-
*
|
|
8207
|
+
* A provider may store one of EACH kind. The preferred one lives in the
|
|
8208
|
+
* canonical file key and is flagged {@link AuthMethod.active}; the other sits
|
|
8209
|
+
* in `alternateCredKey` and is reported too, so the UI can offer to promote it.
|
|
8210
|
+
* Order within `methods` is presentational — it is no longer a resolution
|
|
8211
|
+
* order, because the active flag answers that directly.
|
|
8167
8212
|
*
|
|
8168
8213
|
* Pure read — never refreshes or rewrites the credentials file.
|
|
8169
8214
|
*/
|
|
@@ -8620,6 +8665,7 @@ interface SessionMeta {
|
|
|
8620
8665
|
* inspecting what the model actually sent.
|
|
8621
8666
|
*/
|
|
8622
8667
|
type ToolCallDisplay = 'hidden' | 'formatted' | 'full';
|
|
8668
|
+
type InteractionMode = 'ask' | 'skip' | 'disabled';
|
|
8623
8669
|
/**
|
|
8624
8670
|
* How `edit` / `multi_edit` / `write_file` diffs render in the transcript.
|
|
8625
8671
|
* Gated by {@link Settings.showEditDiffs}; when that's off, the raw `↳ name(args)`
|
|
@@ -8940,22 +8986,11 @@ interface Settings {
|
|
|
8940
8986
|
*/
|
|
8941
8987
|
mouseInteractions: boolean;
|
|
8942
8988
|
/**
|
|
8943
|
-
*
|
|
8944
|
-
*
|
|
8945
|
-
*
|
|
8946
|
-
* submit a structured plan, so it must proceed on its best guess and
|
|
8947
|
-
* narrate any plan inline in its final message instead.
|
|
8948
|
-
*
|
|
8949
|
-
* The system prompt also adapts: the `INTERACTION_GUIDANCE` block is
|
|
8950
|
-
* replaced with a short note explaining the lack of interactive tools,
|
|
8951
|
-
* and Plan-mode's "explore → ask → propose" loop becomes
|
|
8952
|
-
* "explore → propose-in-chat".
|
|
8953
|
-
*
|
|
8954
|
-
* Takes effect on the next session activation — flipping mid-stream
|
|
8955
|
-
* doesn't tear down an in-flight `ask_user` / `present_plan` call.
|
|
8956
|
-
* Default: on.
|
|
8989
|
+
* Policy for `ask_user` / `present_plan`: prompt normally, resolve them
|
|
8990
|
+
* automatically from repository/task context, or omit both tools. Switching
|
|
8991
|
+
* between Ask and Skip applies live; Disabled affects the next activation.
|
|
8957
8992
|
*/
|
|
8958
|
-
|
|
8993
|
+
interactionMode: InteractionMode;
|
|
8959
8994
|
/**
|
|
8960
8995
|
* Drip-feed the assistant's text content character-by-character at a
|
|
8961
8996
|
* smooth cadence (typewriter effect) instead of committing each
|
|
@@ -9626,9 +9661,19 @@ interface QuestionPayload {
|
|
|
9626
9661
|
}
|
|
9627
9662
|
/** Per-question answer value — `string` for text/textarea/select, `boolean` for confirm, `string[]` for multi-select. */
|
|
9628
9663
|
type AnswerValue = string | boolean | readonly string[];
|
|
9664
|
+
/**
|
|
9665
|
+
* Who raised a request. `model` is a tool call awaiting a `tool_result`;
|
|
9666
|
+
* `host` is a slash command or extension prompt whose consumer is local
|
|
9667
|
+
* code. Automatic mode may only answer on the model's behalf, so this is
|
|
9668
|
+
* carried as data rather than inferred from the id — a missing value is a
|
|
9669
|
+
* compile error at the construction site instead of a silent mis-answer.
|
|
9670
|
+
*/
|
|
9671
|
+
type InteractionOrigin = 'model' | 'host';
|
|
9629
9672
|
interface BaseRequest {
|
|
9630
9673
|
/** Stable id — the `tool_call.id` from the model. */
|
|
9631
9674
|
id: string;
|
|
9675
|
+
/** Whether the model or the host raised this request. */
|
|
9676
|
+
origin: InteractionOrigin;
|
|
9632
9677
|
/** Tool canonical name. */
|
|
9633
9678
|
tool: string;
|
|
9634
9679
|
/** Run that emitted the call, when known. */
|
|
@@ -9655,6 +9700,11 @@ interface PlanResponse {
|
|
|
9655
9700
|
decision: PlanDecision;
|
|
9656
9701
|
/** Optional free-text feedback — shown to the model verbatim. */
|
|
9657
9702
|
comment?: string;
|
|
9703
|
+
/**
|
|
9704
|
+
* Resolved by automatic mode rather than by a person. Serialized so the
|
|
9705
|
+
* model can tell a real decision from a default it is free to override.
|
|
9706
|
+
*/
|
|
9707
|
+
automatic?: boolean;
|
|
9658
9708
|
}
|
|
9659
9709
|
interface QuestionResponse {
|
|
9660
9710
|
kind: 'question';
|
|
@@ -9664,8 +9714,28 @@ interface QuestionResponse {
|
|
|
9664
9714
|
* `required: false`).
|
|
9665
9715
|
*/
|
|
9666
9716
|
answers: Readonly<Record<string, AnswerValue>>;
|
|
9717
|
+
/** See {@link PlanResponse.automatic}. */
|
|
9718
|
+
automatic?: boolean;
|
|
9667
9719
|
}
|
|
9668
9720
|
type InteractionResponse = PlanResponse | QuestionResponse;
|
|
9721
|
+
declare const AUTOMATIC_INTERACTION_INSTRUCTION = "Automatic mode is enabled. Make the best choice from the repository and current task, then continue without asking for this input again.";
|
|
9722
|
+
/**
|
|
9723
|
+
* Id prefix for interactions the HOST synthesizes — slash commands and
|
|
9724
|
+
* extension `ctx.interaction.*` share the prompt slot with the tools but
|
|
9725
|
+
* never pass through {@link createInteractionTools}. Model-originated
|
|
9726
|
+
* requests carry the provider's `tool_call.id` instead. Naming only:
|
|
9727
|
+
* origin policy reads {@link BaseRequest.origin}, never the id.
|
|
9728
|
+
*/
|
|
9729
|
+
declare const HOST_INTERACTION_ID_PREFIX = "command_";
|
|
9730
|
+
/**
|
|
9731
|
+
* Whether a queued request came from a model tool call. Automatic mode
|
|
9732
|
+
* answers on the model's behalf, so it must leave host-originated prompts
|
|
9733
|
+
* alone: their consumer is local code awaiting a real decision, with no
|
|
9734
|
+
* model on the other end to act on an instruction sentence.
|
|
9735
|
+
*/
|
|
9736
|
+
declare function isModelInteraction(request: InteractionRequest): boolean;
|
|
9737
|
+
/** Build the deterministic response used when the host skips interaction UI. */
|
|
9738
|
+
declare function createAutomaticInteractionResponse(request: InteractionRequest): InteractionResponse;
|
|
9669
9739
|
/**
|
|
9670
9740
|
* Format an {@link InteractionResponse} as the tool_result content. JSON
|
|
9671
9741
|
* keeps the envelope parseable and explicit. Empty fields are stripped so
|
|
@@ -9715,6 +9785,8 @@ interface CreateInteractionToolsOptions {
|
|
|
9715
9785
|
* `Tool error: <message>` as the result).
|
|
9716
9786
|
*/
|
|
9717
9787
|
requestInteraction: (request: InteractionRequest) => Promise<InteractionResponse>;
|
|
9788
|
+
/** Evaluated at invocation time so hosts can switch modes without rebuilding the agent. */
|
|
9789
|
+
shouldSkipInteractions?: () => boolean;
|
|
9718
9790
|
}
|
|
9719
9791
|
/**
|
|
9720
9792
|
* Create the `present_plan` and `ask_user` tools as a record, ready to
|
|
@@ -19158,5 +19230,5 @@ declare function definePreset(config: Preset): Preset;
|
|
|
19158
19230
|
*/
|
|
19159
19231
|
declare function composePresets(...presets: Preset[]): Preset;
|
|
19160
19232
|
//#endregion
|
|
19161
|
-
export { SessionArtifactDirMigration as $, ExtensionConfigStringItem as $a, createSkillActivationState as $c, restoreModelOptions as $d, SchemaSanitizeProfile as $f, reasoningWireAction as $g, ToolStateOp as $h, ExtensionCatalogPartition as $i, commandBlocksToContent as $l, PromptDocumentPart as $m, HeadlessResult as $n, ExtensionToolResultMetadataRegistration as $o, buildAnthropicClientOptions as $p, createRunSummaryCollector as $r, AgentPluginsVersion as $s, EvalRunUsage as $t, AgentProfile as $u, Meter as A, discoverExtensions as Aa, SkillInstallError as Ac, toggleChainEntry as Ad, CacheDriftInfo as Af, FileMapAdapter as Ag, ToolResultMetadata as Ah, CompactionSlice as Ai, CompletionReference as Al, AgentStats as Am, efficiencyMetricValues as An, ExtensionManifest as Ao, openai as Ap, createSkillsReadTool as Ar, SpawnTaskInput as As, resolveExtensionDocsDir as At, pendingInteractionsFromTurns as Au, McpCredentialStore as B, defineExtension as Ba, discoverSkills as Bc, anthropicDescriptor as Bd, StreamCallbacks as Bf, RemintResult as Bg, ToolMap as Bh, defaultRepeatGuardTracked as Bi, CommandArgSuggestion as Bl, DedupHasher as Bm, functionalityMetric as Bn, ExtensionRunTransform as Bo, cerebras as Bp, grep as Br, SpawnModelEntry as Bs, EvalAgentStats as Bt, ConsoleSinkOptions as Bu, SuccessfulMutationOutcome as C, ModelCatalog as C_, readExtensionInstallProvenance as Ca, resolveSkills as Cc, buildRunModel as Cd, ContextUsageSplit as Cf, loadSession as Cg, ToolOutcome as Ch, buildCompactPrompt as Ci, tokenEndingAtCursor as Cl, getOAuthProvider as Cm, clearRegisteredEvals as Cn, ExtensionCustomRendererEntry as Co, openaiCompat as Cp, ToolSearchToolOptions as Cr, ExtensionSessionsSurface as Cs, ZIDANE_SKILL_EDIT_SKILL_NAME as Ct, QuestionType as Cu, Counter as D, setModelCatalog as D_, ENTRY_CANDIDATES as Da, SKILL_PROVENANCE_FILE as Dc, providerKeySetChanged as Dd, CacheDimensionDiff as Df, RemoteStoreOptions as Dg, ToolResultDocumentRefContent as Dh, buildUpToCompactPrompt as Di, CompletionContext as Dl, AgentBehavior as Dm, createReusableExecutionContext as Dn, ExtensionGuiSurface as Do, OpenAIParams as Dp, SkillsRunScriptToolOptions as Dr, createWorkspaceSurface as Ds, extensionDirForCwd as Dt, createInteractionTools as Du, resolveModelTargets as E, getModelCatalog as E_, registerExtensionHostModules as Ea, stripShellInterpolations as Ec, filterChainFallbacks as Ed, CacheBreakLoggerOptions as Ef, withExtensionSession as Eg, ToolResultDocumentContent as Eh, buildTailCompactPrompt as Ei, ActiveTrigger as El, registerOAuthProvider as Em, createEvalRunReporter as En, ExtensionGuiPanel as Eo, userMessage as Ep, createSkillsUseTool as Er, createExtensionHostRuntimeBridge as Es, editSessionMetadata as Et, buildResumedToolResultsTurn as Eu, createMetricsHooks as F, DiscoverAndBuildExtensionRegistryOptions as Fa, installSkillFromSpec as Fc, BUILTIN_PROVIDERS as Fd, snapshotCacheDimensions as Ff, PairingDrop as Fg, toolOutputBudgetByteLength as Fh, summaryToTurn as Fi, mergeReferences as Fl, CompactEndHookContext as Fm, fileExistsOneOf as Fn, ExtensionPaths as Fo, LocalParams as Fp, readFile as Fr, SubagentDef as Fs, EvalAgent as Ft, SchemaInput as Fu, OAuthCallbackHandle as G, ExtensionConfigCategory as Ga, buildCatalog as Gc, getModelInfo as Gd, ToolSpec as Gf, autoDetectAndConvert as Gg, hashContent as Gh, AgentHookMap as Gi, CommandInvocation as Gl, McpToolHookContext as Gm, runEvalCase as Gn, ExtensionStorageScope as Go, arcee as Gp, RunSummaryBudget as Gr, PLUGIN_MCP_FILE as Gs, EvalDefinitionContext as Gt, LoggingHookSet as Gu, McpOAuthProviderOptions as H, ExtensionConfigActionResult as Ha, inferSource as Hc, credKeyOf as Hd, TokenCountPayload as Hf, TOOL_USE_INTERRUPTED_MARKER as Hg, ReadStateEntry as Hh, stableStringify as Hi, CommandExecution as Hl, GeometricThinkingDecay as Hm, normalizeMetric as Hn, ExtensionSessionStateSurface as Ho, baseten as Hp, edit as Hr, formatModelLine as Hs, EvalCaseOptions as Ht, LogRecord as Hu, LoginMcpServerOptions as I, discoverAndBuildExtensionRegistry as Ia, listSkillCandidates as Ic, CustomField as Id, HistoryRepair as If, PairingDropKind as Ig, toolOutputByteLength as Ih, truncateHeadForPtlRetry as Ii, mergeSuggestions as Il, CompactFunction as Im, finalizeEvalMetrics as In, ExtensionPermission as Io, local as Ip, multiEdit as Ir, SubagentOverride as Is, EvalAgentMcpServers as It, StandardSchemaLike as Iu, startOAuthCallback as J, ExtensionConfigItem as Ja, ActivationVia as Jc, modelSupportsReasoning as Jd, planZaiReasoning as Jf, ensureEndsWithUserMessage as Jg, readStateKey as Jh, McpConnector as Ji, CommandSpawnTask as Jl, ModelTargetSpec as Jm, FormattedHeadlessTurnEvent as Jn, ExtensionToolPolicy as Jo, AnthropicParams as Jp, RunSummaryCollectorOptions as Jr, parsePluginManifest as Js, EvalRunMetricAggregate as Jt, consoleSink as Ju, OAuthCallbackOptions as K, ExtensionConfigChangeBehavior as Ka, IMPLICITLY_ALLOWED_SKILL_TOOLS as Kc, localDescriptor as Kd, TurnResult as Kf, detectTurnInterruption as Kg, hydrateReadStateFromSession as Kh, AgentHooks as Ki, CommandOutputBlock as Kl, McpToolSchema as Km, statusCompleted as Kn, ExtensionStorageSurface as Ko, AnthropicBedrockConfig as Kp, RunSummaryByModel as Kr, expandPluginVars as Ks, EvalMetric as Kt, LoggingHooksOptions as Ku, LoginMcpServerResult as L, ExtensionPromptBridge as La, parseSkillInstallSpec as Lc, ModelInfo as Ld, Provider as Lf, PairingRepair as Lg, toolResultToText as Lh, GenerateStructuredDataOptions as Li, resolveCompletionSubmit as Ll, CompactHookContext as Lm, formatEvalCaseSummary as Ln, ExtensionPromptTransform as Lo, CursorParams as Lp, listFiles as Lr, SubagentRegistry as Ls, EvalAgentRunOptions as Lt, isStandardSchema as Lu, MetricsHookSet as M, isExtensionDefinition as Ma, SkillInstallOptions as Mc, ProviderAuth as Md, fnv1a32 as Mf, createFileMapStore as Mg, ToolResultVideoContent as Mh, anchorPreviewFor as Mi, applyInsert as Ml, AutoCompactConfig as Mm, fileContains as Mn, ExtensionModal as Mo, MistralParams as Mp, CreateShellToolOptions as Mr, SpawnTool as Ms, withZidaneSkillEditSkill as Mt, useInteractionsActions as Mu, MetricsHooksOptions as N, parseExtensionScanPathEnv as Na, SkillInstallResult as Nc, ProviderKey as Nd, hashMessages as Nf, EnsureToolResultPairingOptions as Ng, TurnFinishReason as Nh, sliceForCompaction as Ni, collectReferences as Nl, CacheTtl as Nm, fileContentQuality as Nn, ExtensionModalNode as No, mistral as Np, createShellTool as Nr, SpawnToolOptions as Ns, CreateEvalAgentOptions as Nt, useInteractionsQueue as Nu, Histogram as O, ExtensionScanEntry as Oa, SkillCandidateDetail as Oc, restoreChainFallbacks as Od, CacheDimensionName as Of, createRemoteStore as Og, ToolResultImageContent as Oh, ANCHOR_PREVIEW_MAX_CHARS as Oi, CompletionItem as Ol, AgentClock as Om, defineEval as On, ExtensionKeybinding as Oo, classifyOpenAIError as Op, createSkillsRunScriptTool as Or, ChildAgent as Os, extensionScaffold as Ot, isInteractionTool as Ou, UpDownCounter as P, scanExtensionDirectories as Pa, SkillInstallSpec as Pc, detectAuth as Pd, installCacheBreakLogger as Pf, ORPHANED_TOOL_RESULT_MARKER as Pg, TurnUsage as Ph, stripImagesFromTurns as Pi, findActiveTrigger as Pl, ChildRunStats as Pm, fileExists as Pn, ExtensionOrderedContribution as Po, planMistralReasoning as Pp, shell as Pr, SpawnToolState as Ps, EFFICIENCY_METRICS as Pt, InferSchemaOutput as Pu, PersistOutcome as Q, ExtensionConfigScope as Qa, SkillActivationStateOptions as Qc, piIdOf as Qd, SchemaSanitizeOptions as Qf, fromOpenAI as Qg, ToolStateController as Qh, BuildExtensionRegistryOptions as Qi, commandBlockToEvent as Ql, PromptAudioPart as Qm, HeadlessOutputFormat as Qn, ExtensionToolRendererRegistration as Qo, applyAnthropicCacheBreakpoints as Qp, RunSummaryValidation as Qr, loadAgentPlugin as Qs, EvalRunSummaryCase as Qt, AgentAccent as Qu, loginMcpServer as R, ExtensionPromptDelivery as Ra, readSkillProvenance as Rc, ModelOption as Rd, ProviderCapabilities as Rf, PairingRepairMode as Rg, ToolContext as Rh, generateStructuredData as Ri, Command as Rl, CompactStartHookContext as Rm, formatEvalRunSummary as Rn, ExtensionProviderMiddleware as Ro, cursor as Rp, InteractionToolOptions as Rr, createSpawnTool as Rs, EvalAgentRunResult as Rt, resolveSchemaInput as Ru, MutationValidationResult as S, originPinnedFetch as S_, parseExtensionInstallSource as Sa, validateSkillName as Sc, ModelChainEntry as Sd, ContextSnapshot as Sf, getExtensionSessionState as Sg, ToolHookContext as Sh, TRAILER as Si, resolveInlineSuggestion as Sl, getOAuthApiKey as Sm, buildTrajectory as Sn, ExtensionCustomRenderer as So, openAICompatPromptMessage as Sp, LazyToolEntry as Sr, ExtensionSessionSummary as Ss, ZIDANE_EXTENSION_SKILL_NAME as St, QuestionResponse as Su, normalizeProviders as T, ModelCatalogSource as T_, updateInstalledExtension as Ta, interpolateShellCommands as Tc, chainsEqual as Td, CacheBreakInfo as Tf, setExtensionSessionState as Tg, ToolResultContent as Th, buildFullCompactPrompt as Ti, useCompletion as Tl, refreshOpenAICodexToken as Tm, createEvalAgent as Tn, ExtensionFooterHint as To, toolResultsMessage as Tp, SkillsUseToolOptions as Tr, ExtensionWorkspaceSurface as Ts, buildZidaneSkillEditSkill as Tt, TextQuestion as Tu, createMemoryMcpCredentialStore as U, ExtensionConfigActionStatus as Ua, parseFrontmatter as Uc, enabledModelOptions as Ud, ToolCall as Uf, ToWireMessagesOptions as Ug, ReadStateMap as Uh, localReliabilityBehavior as Ui, CommandGenerateDataOptions as Ul, JsonValue as Um, registerEvalTests as Un, ExtensionSkillPolicy as Uo, planBasetenReasoning as Up, RunSummary as Ur, matchModelEntries as Us, EvalCaseResult as Ut, LogSink as Uu, McpOAuthProvider as V, ExtensionConfigActionItem as Va, getDefaultScanPaths as Vc, cerebrasDescriptor as Vd, StreamOptions as Vf, SYNTHETIC_TOOL_RESULT_PLACEHOLDER as Vg, HydrateReadStateOptions as Vh, normalizeShellCommand as Vi, CommandAttachment as Vl, DedupToolConfig as Vm, llmJudge as Vn, ExtensionRuntimeEnv as Vo, BasetenParams as Vp, glob as Vr, createModelSearchTool as Vs, EvalArtifacts as Vt, LogLevel as Vu, hasAuthorizationHeader as W, ExtensionConfigBooleanItem as Wa, parseSkillFile as Wc, getContextWindow as Wd, ToolResult as Wf, TurnInterruptionState as Wg, getReadState as Wh, Agent as Wi, CommandInteraction as Wl, McpServerConfig as Wm, relativeArtifactPath as Wn, ExtensionSource as Wo, ArceeParams as Wp, RunSummaryBlock as Wr, PLUGIN_SKILLS_DIR as Ws, EvalDefinition as Wt, Logger as Wu, PERSISTENCE_PREVIEW_BYTES as X, ExtensionConfigModelItem as Xa, DeactivationReason as Xc, openaiDescriptor as Xd, XaiParams as Xf, filterUnresolvedToolUses as Xg, DEFAULT_MAX_VALUE_BYTES as Xh, McpToolWrap as Xi, CommandStepContext as Xl, ProgressNudgeKind as Xm, HeadlessEvent as Xn, ExtensionToolRenderer as Xo, EXTENDED_CACHE_TTL_BETA as Xp, RunSummaryRepeatGuard as Xr, PLUGIN_MANIFEST_FILE as Xs, EvalRunReporterOptions as Xt, createLoggingHooks as Xu, PERSISTED_STUB_PREFIX as Y, ExtensionConfigItemBase as Ya, ActiveSkill as Yc, modelsForDescriptor as Yd, zai as Yf, ensureToolResultPairing as Yg, resolveReadStateMap as Yh, McpToolMeta as Yi, CommandStep as Yl, OAuthRefreshHookContext as Ym, HeadlessErrorInfo as Yn, ExtensionToolRenderProps as Yo, AnthropicThinkingPlan as Yp, RunSummaryError as Yr, validatePluginManifest as Ys, EvalRunReporter as Yt, createLogger as Yu, PersistInput as Z, ExtensionConfigNumberItem as Za, SkillActivationState as Zc, openrouterDescriptor as Zd, xai as Zf, fromAnthropic as Zg, StagedToolState as Zh, createAgent as Zi, CommandStepFn as Zl, ProgressNudgeMessage as Zm, HeadlessOptions as Zn, ExtensionToolRendererEntry as Zo, anthropic as Zp, RunSummaryTokens as Zr, defaultPluginDataRoot as Zs, EvalRunSummary as Zt, jsonSink as Zu, statsByModel as _, resolveTransportConfig as __, InstallExtensionFromSpecOptions as _a, matchesAllowedTool as _c, Screen as _d, ContextExactCounts as _f, SessionStore as _g, StepThinkingDecay as _h, BASE_INSTRUCTIONS as _i, InlineAutocompleteContext as _l, readOAuthCredentials as _m, TrajectoryStep as _n, ExtensionBehaviorTransform as _o, buildAssistantContent as _p, waitTask as _r, createExtensionHud as _s, EXTENSION_EDIT_METADATA_KEY as _t, PlanStep as _u, basicTools as a, ConnectMcpServersOptions as a_, filterRegistryPlugins as aa, PluginManifest as ac, DEFAULT_PERSIST_EXCLUDE_TOOLS as ad, shouldAutoCompact as af, ShellInterpolationApproval as ag, RepeatGuardToolMatcher as ah, RecentFile as ai, BUILTIN_THEMES as al, resolveAnthropicBetas as am, EvalWorkspaceFile as an, WireExtensionConfigSchema as ao, openrouter as ap, exitCodeForHeadlessResult as ar, LoadedExtension as as, resolveLegacySessionDir as at, ConfirmQuestion as au, MutationValidationHooksOptions as b, PinnedFetch as b_, installExtensionFromSpec as ba, validateResourcePathReal as bc, StreamEvent as bd, ContextItem as bf, deleteExtensionSessionState as bg, ThinkingLevel as bh, CompactPromptOptions as bi, createPathAutocompleteProvider as bl, writeOAuthCredentials as bm, buildEvalRunSummary as bn, ExtensionContextTransform as bo, formatTools as bp, TailTruncateOptions as br, ExtensionModelEntry as bs, SKILL_EDIT_METADATA_KEY as bt, QuestionPayload as bu, StartSpan as c, attachStderrWarnPump as c_, ExtensionFetchResult as ca, agentPluginsSchemaId as cc, resolveAgentId as cd, ContextSegmentOrigin as cf, SkillResource as cg, RetryConfig as ch, selectFilesFromSession as ci, DEFAULT_THEME as cl, PromptCacheKeyOption as cm, LlmJudgeOptions as cn, isValidExtensionConfigItem as co, OAITool as cp, formattedHeadlessTurnEventToJsonl as cr, ExtensionBannerOptions as cs, resolveSessionDir as ct, InteractionResponse as cu, TracingHooksOptions as d, deriveMcpToolMeta as d_, ExtensionInstallErrorCode as da, defineSkill as dc, EditHunk as dd, ContextBreakdown as df, CreateSessionOptions as dg, SessionEndStatus as dh, CompactOptions as di, Theme as dl, OAuthParams as dm, MetricSpec as dn, resolveExtensionConfigValue as do, OpenAICompatParams as dp, providerTranscriptFormatForProvider as dr, ExtensionHudStatus as ds, SHELL_CASCADE_CANCEL_MESSAGE as dt, PRESENT_PLAN_TOOL as du, remintDuplicateToolCallIds as e_, buildExtensionPreset as ea, LoadAgentPluginOptions as ec, AgentRegistry as ed, AUTO_COMPACT_MIN_GROWTH_FRACTION as ef, ToolStateStore as eg, PromptImagePart as eh, BYTES_PER_TOKEN as ei, ResolveStorageDirsOptions as el, classifyAnthropicError as em, EvalScore as en, ExtensionConfigSurface as eo, SchemaSanitizeResult as ep, HeadlessStatus as er, ExtensionToolResultPatch as es, buildPersistedStub as et, commandSteps as eu, createTracingHooks as f, expandEnvPlaceholders as f_, ExtensionInstallIo as fa, writeSkillToDisk as fc, EditOutcome as fd, ContextBreakdownContributionContext as ff, LoadSessionOptions as fg, SessionHookContext as fh, CompactResult as fi, ThemeColors as fl, ResolveOAuthApiKeyOptions as fm, MetricSpecMap as fn, sanitizeExtensionConfigActionPatch as fo, OpenAICompatStreamError as fp, runHeadless as fr, ExtensionHudWriter as fs, TOOL_USE_CANCELLED_MESSAGE as ft, PendingInteractionEntry as fu, formatTokenUsage as g, normalizeMcpServers as g_, ExtensionInstallSource as ga, isToolAllowedByUnion as gc, Picked as gd, ContextCategoryId as gf, SessionRun as gg, StaleReadPolicy as gh, CompactPromptTooLongError as gi, resolveTheme as gl, isOAuthAccessToken as gm, Trajectory as gn, ExtensionApiVersion as go, assistantMessage as gp, WAIT_TASK_TIMED_OUT_PREFIX as gr, ExtensionStatusOptions as gs, renderStaleReadNotice as gt, PlanResponse as gu, flattenTurns as h, normalizeMcpBlocks as h_, ExtensionInstallScope as ha, SkillValidationResult as hc, Owner as hd, ContextCategory as hf, SessionMetaRow as hg, SpawnHookContext as hh, CompactInvalidInputError as hi, resolveChipColor as hl, extractRuntimeCredentials as hm, ReusableExecutionContext as hn, ExtensionAgentPluginOptions as ho, applyOAIToolCacheBreakpoint as hp, writeFile as hr, ExtensionNotifyTone as hs, collectNewlyStaleReadPaths as ht, PlanRequest as hu, _default as i, toWireMessages as i_, filterExtensionRegistry as ia, PluginDiagnostic as ic, DEFAULT_BUDGET_EXCLUDE_TOOLS as id, effectiveContextWindow as if, stagedToolState as ig, RepeatGuardConfig as ih, PostCompactRestoreOptions as ii, resolveStorageDirs as il, resolveAnthropicAuthShape as im, EvalVariantSummary as in, WireExtensionConfigItem as io, normalizeOpenRouterModelId as ip, ProviderTranscriptFormat as ir, GuiContributions as is, resolveLegacyPersistDir as it, AnswerValue as iu, MetricAttributes as j, inlineLoadedExtension as ja, SkillInstallErrorCode as jc, AuthMethod as jd, diffCacheDimensions as jf, FileMapStoreOptions as jg, ToolResultTextContent as jh, SummaryToTurnInput as ji, CompletionSubmitContext as jl, AutoCompact as jm, emitEfficiencyMetrics as jn, ExtensionMcpConfigTransform as jo, toPiMessages as jp, shellKill as jr, SpawnTaskOutcome as js, withZidaneExtensionSkill as jt, serializeInteractionResponse as ju, InstrumentOptions as k, defaultExtensionScanPaths as ka, SkillInstallCandidate as kc, sanitizeModelChain as kd, CacheDimensionSnapshot as kf, createMemoryStore as kg, ToolResultImageRefContent as kh, CompactScope as ki, CompletionProvider as kl, AgentRunOptions as km, defineMetrics as kn, ExtensionKeybindingDispatchContext as ko, mapCodexStopReason as kp, SkillsReadToolOptions as kr, ExtensionSubagentDef as ks, readSkillEditMarker as kt, makeRequestInteraction as ku, TracingConventions as l, connectMcpServers as l_, ExtensionInstallCandidate as la, isSupportedAgentPluginsVersion as lc, singleAgentRegistry as ld, ContextSegmentsInput as lf, SkillSource as lg, RunHookMap as lh, selectRecentFiles as li, SyntaxStyles as ll, derivePromptCacheKey as lm, MetricDirection as ln, isValidExtensionConfigValue as lo, OpenAICompatAuthHeader as lp, headlessEventToJsonl as lr, ExtensionHud as ls, resolveTasksDir as lt, InteractionsActions as lu, TokenUsageLike as m, nonOwningMcpView as m_, ExtensionInstallResult as ma, SkillValidationIssue as mc, EditPayload as md, ContextBreakdownOptions as mf, SessionData as mg, SessionTurn as mh, compactConversation as mi, ThemeSurfaces as ml, credentialsFromParams as mm, RegisterEvalTestsOptions as mn, EMPTY_EXTENSION_REGISTRY as mo, applyOAICacheBreakpoints as mp, transcriptToProviderMessages as mr, ExtensionNotifyOptions as ms, applyCompactSummaryCutoff as mt, PlanPayload as mu, composePresets as n, toAnthropic as n_, composeExtensionPreset as na, PluginAuthor as nc, BUILTIN_AGENTS as nd, AutoCompactInput as nf, createToolStateController as ng, PromptTextPart as nh, utf8ByteLength as ni, StorageMode as nl, defaultAnthropicMaxTokens as nm, EvalScorerContext as nn, ExtensionConfigValueItem as no, sanitizeToolSpecs as np, OpenAIChatContentPart as nr, ExtensionToolVerdict as ns, maybePersistToolResult as nt, parseCommandInvocation as nu, GEN_AI_ATTRIBUTES as o, McpConnection as o_, mergeContributions as oa, PluginSchemaKind as oc, PLAN_AGENT as od, ContextSegment as of, SkillConfig as og, ResolveContentRef as oh, buildPostCompactAttachments as oi, ChipColor as ol, resolveAnthropicMaxOutput as om, EvalWorkspaceOptions as on, clampExtensionConfigNumber as oo, ASSISTANT_TOOL_CALLS_TAG as op, formatHeadlessResult as or, LoadedPluginRecord as os, resolveMcpWarningsDir as ot, CreateInteractionToolsOptions as ou, ModelUsage as p, expandMcpConfigEnv as p_, ExtensionInstallProvenance as pa, writeSkillsToDisk as pc, EditOutcomeKind as pd, ContextBreakdownContributor as pf, Session as pg, SessionMessage as ph, CompactStartEvent as pi, ThemeSelect as pl, credentialsFilePath as pm, MetricStats as pn, toWireConfigSchema as po, TOOL_RESULTS_TAG as pp, transcriptToOpenAIMessages as pr, ExtensionNotification as ps, TOOL_USE_SKIPPED_MESSAGE as pt, PlanDecision as pu, OAuthCallbackResult as q, ExtensionConfigEnumItem as qa, installAllowedToolsGate as qc, modelOptionsFor as qd, ZaiParams as qf, dropInvalidToolPairings as qg, hydrateReadStateFromSessionAsync as qh, AgentOptions as qi, CommandSpawnResult as ql, ModelTarget as qm, FormattedHeadlessResult as qn, ExtensionToolCatalogTransform as qo, AnthropicContextManagement as qp, RunSummaryCollector as qr, ManifestValidation as qs, EvalMetricError as qt, RingBufferSink as qu, definePreset as r, toOpenAI as r_, disposeExtensionRegistry as ra, PluginComponentStatus as rc, DEFAULT_AGENT_ID as rd, OUTPUT_RESERVE_TOKENS as rf, isToolStateOps as rg, PromptVideoPart as rh, PostCompactAttachments as ri, StorageSlot as rl, planAnthropicThinking as rm, EvalTestRunner as rn, StoredExtensionConfigItem as ro, OpenRouterParams as rp, OpenAIChatMessage as rr, ExtensionTuiSurface as rs, migrateSessionArtifactDirs as rt, ASK_USER_TOOL as ru, Span as s, McpExecutionBinding as s_, partitionExtensionCatalog as sa, SUPPORTED_AGENT_PLUGINS_VERSIONS as sc, accentColor as sd, ContextSegmentFile as sf, SkillDiagnostic as sg, ResolveContentRefBlock as sh, selectFilesFromReadState as si, ChipColorMap as sl, PromptCacheKeyContext as sm, EvalWorkspaceSnapshot as sn, coerceExtensionConfigInput as so, OAIMessage as sp, formatHeadlessTurnEvent as sr, TuiContributions as ss, resolvePersistDir as st, InteractionRequest as su, Preset as t, sanitizeHistoryForProvider as t_, buildExtensionRegistry as ta, LoadedPlugin as tc, BUILD_AGENT as td, AutoCompactDecision as tf, ToolStateView as tg, PromptPart as th, estimateTokens as ti, StorageDirs as tl, credentialIdentity as tm, EvalScorer as tn, ExtensionConfigValue as to, sanitizeToolSchema as tp, HeadlessUsage as tr, ExtensionToolResultTransform as ts, cleanupPersistedSession as tt, executeCommand as tu, TracingHookSet as u, createStderrLineEmitter as u_, ExtensionInstallError as ua, parseSchemaId as uc, EditDiffDisplay as ud, buildContextSegments as uf, SkillsConfig as ug, SessionContentBlock as uh, CompactEndEvent as ui, SyntaxTokenStyle as ul, resolvePromptCacheKey as um, MetricEmitter as un, resolveExtensionConfig as uo, OpenAICompatHttpError as up, installHeadlessEventAdapter as ur, ExtensionHudState as us, INTERRUPT_MESSAGE_FOR_TOOL_USE as ut, InteractionsProvider as uu, MutationValidationBatch as v, resultToString as v_, InstalledExtensionTargetOptions as va, parseAllowedToolPattern as vc, SessionMeta as vd, ContextExtensionRow as vf, createSession as vg, StreamHookContext as vh, CompactDirection as vi, InlineAutocompleteProvider as vl, registerCustomOAuthProvider as vm, TrajectoryStepKind as vn, ExtensionCapability as vo, classifyOpenAICompatError as vp, ValidationResult as vr, ExtensionHostRuntimeBridge as vs, EditSessionTarget as vt, Question as vu, createMutationValidationHooks as w, ModelCatalogEntry as w_, removeInstalledExtension as wa, InterpolateShellCommandsOptions as wc, chainPositionOf as wd, buildContextBreakdown as wf, resumeChainRunIds as wg, ToolResultAudioContent as wh, buildFromCompactPrompt as wi, CompletionState as wl, refreshAnthropicToken as wm, computeEvalTagScores as wn, ExtensionDefinition as wo, toOAIMessages as wp, createToolSearchTool as wr, ExtensionWorkspacePair as ws, buildZidaneExtensionSkill as wt, SelectQuestion as wu, MutationValidationMutation as x, isAllowedRemoteUrl as x_, listExtensionCandidates as xa, validateSkillForWrite as xc, ToolCallDisplay as xd, ContextMcpGroup as xf, demoteStaleRunningStatus as xg, ToolBatchExecutor as xh, NO_TOOLS_PREAMBLE as xi, patchInlineGhost as xl, OAuthProviderInterface as xm, buildRegisteredEvals as xn, ExtensionContributions as xo, mapOAIFinishReason as xp, tailTruncate as xr, ExtensionRuntimeSurface as xs, SkillEditMarker as xt, QuestionRequest as xu, MutationValidationFailure as y, wrapDiscoveredMcpTools as y_, fetchExtensionSource as ya, validateResourcePath as yc, Settings as yd, ContextExtensionSection as yf, currentExtensionSession as yg, ThinkingDecay as yh, CompactPromptBuilder as yi, InlineGhost as yl, resolveOAuthApiKey as ym, artifactPath as yn, ExtensionContext as yo, consumeSSE as yp, validateToolArgs as yr, ExtensionHostRuntimeImpl as ys, ExtensionEditMarker as yt, QuestionChoice as yu, McpCredentialEntry as z, createExtensionPromptBridge as za, SourcedScanPath as zc, ProviderDescriptor as zd, ProviderMeta as zf, ReasoningWireAction as zg, ToolDef as zh, defaultRepeatGuardNormalize as zi, CommandAgentResult as zl, DEFAULT_AGENT_CLOCK as zm, formatTrajectoryLine as zn, ExtensionRegistry as zo, CerebrasParams as zp, createInteractionTool as zr, isSpawnTool as zs, EvalAgentRunStats as zt, zodToJsonSchema as zu };
|
|
19162
|
-
//# sourceMappingURL=index-
|
|
19233
|
+
export { SessionArtifactDirMigration as $, ExtensionConfigStringItem as $a, createSkillActivationState as $c, modelOptionsFor as $d, ZaiParams as $f, dropInvalidToolPairings as $g, hydrateReadStateFromSessionAsync as $h, ExtensionCatalogPartition as $i, commandBlocksToContent as $l, ModelTarget as $m, HeadlessResult as $n, ExtensionToolResultMetadataRegistration as $o, AnthropicContextManagement as $p, createRunSummaryCollector as $r, AgentPluginsVersion as $s, EvalRunUsage as $t, consoleSink as $u, Meter as A, ModelCatalogEntry as A_, discoverExtensions as Aa, SkillInstallError as Ac, chainPositionOf as Ad, buildContextBreakdown as Af, resumeChainRunIds as Ag, ToolResultAudioContent as Ah, CompactionSlice as Ai, CompletionReference as Al, refreshAnthropicToken as Am, efficiencyMetricValues as An, ExtensionManifest as Ao, toOAIMessages as Ap, createSkillsReadTool as Ar, SpawnTaskInput as As, resolveExtensionDocsDir as At, createAutomaticInteractionResponse as Au, McpCredentialStore as B, defineExtension as Ba, discoverSkills as Bc, detectAuth as Bd, installCacheBreakLogger as Bf, ORPHANED_TOOL_RESULT_MARKER as Bg, TurnUsage as Bh, defaultRepeatGuardTracked as Bi, CommandArgSuggestion as Bl, ChildRunStats as Bm, functionalityMetric as Bn, ExtensionRunTransform as Bo, planMistralReasoning as Bp, grep as Br, SpawnModelEntry as Bs, EvalAgentStats as Bt, SchemaInput as Bu, SuccessfulMutationOutcome as C, resolveTransportConfig as C_, readExtensionInstallProvenance as Ca, resolveSkills as Cc, Screen as Cd, ContextExactCounts as Cf, SessionStore as Cg, StepThinkingDecay as Ch, buildCompactPrompt as Ci, tokenEndingAtCursor as Cl, readOAuthCredentials as Cm, clearRegisteredEvals as Cn, ExtensionCustomRendererEntry as Co, buildAssistantContent as Cp, ToolSearchToolOptions as Cr, ExtensionSessionsSurface as Cs, ZIDANE_SKILL_EDIT_SKILL_NAME as Ct, QuestionPayload as Cu, Counter as D, isAllowedRemoteUrl as D_, ENTRY_CANDIDATES as Da, SKILL_PROVENANCE_FILE as Dc, ToolCallDisplay as Dd, ContextMcpGroup as Df, demoteStaleRunningStatus as Dg, ToolBatchExecutor as Dh, buildUpToCompactPrompt as Di, CompletionContext as Dl, OAuthProviderInterface as Dm, createReusableExecutionContext as Dn, ExtensionGuiSurface as Do, mapOAIFinishReason as Dp, SkillsRunScriptToolOptions as Dr, createWorkspaceSurface as Ds, extensionDirForCwd as Dt, SelectQuestion as Du, resolveModelTargets as E, PinnedFetch as E_, registerExtensionHostModules as Ea, stripShellInterpolations as Ec, StreamEvent as Ed, ContextItem as Ef, deleteExtensionSessionState as Eg, ThinkingLevel as Eh, buildTailCompactPrompt as Ei, ActiveTrigger as El, writeOAuthCredentials as Em, createEvalRunReporter as En, ExtensionGuiPanel as Eo, formatTools as Ep, createSkillsUseTool as Er, createExtensionHostRuntimeBridge as Es, editSessionMetadata as Et, QuestionType as Eu, createMetricsHooks as F, DiscoverAndBuildExtensionRegistryOptions as Fa, installSkillFromSpec as Fc, sanitizeModelChain as Fd, CacheDimensionSnapshot as Ff, createMemoryStore as Fg, ToolResultImageRefContent as Fh, summaryToTurn as Fi, mergeReferences as Fl, AgentRunOptions as Fm, fileExistsOneOf as Fn, ExtensionPaths as Fo, mapCodexStopReason as Fp, readFile as Fr, SubagentDef as Fs, EvalAgent as Ft, pendingInteractionsFromTurns as Fu, OAuthCallbackHandle as G, ExtensionConfigCategory as Ga, buildCatalog as Gc, ProviderDescriptor as Gd, ProviderMeta as Gf, ReasoningWireAction as Gg, ToolDef as Gh, AgentHookMap as Gi, CommandInvocation as Gl, DEFAULT_AGENT_CLOCK as Gm, runEvalCase as Gn, ExtensionStorageScope as Go, CerebrasParams as Gp, RunSummaryBudget as Gr, PLUGIN_MCP_FILE as Gs, EvalDefinitionContext as Gt, ConsoleSinkOptions as Gu, McpOAuthProviderOptions as H, ExtensionConfigActionResult as Ha, inferSource as Hc, CustomField as Hd, HistoryRepair as Hf, PairingDropKind as Hg, toolOutputByteLength as Hh, stableStringify as Hi, CommandExecution as Hl, CompactFunction as Hm, normalizeMetric as Hn, ExtensionSessionStateSurface as Ho, local as Hp, edit as Hr, formatModelLine as Hs, EvalCaseOptions as Ht, isStandardSchema as Hu, LoginMcpServerOptions as I, discoverAndBuildExtensionRegistry as Ia, listSkillCandidates as Ic, toggleChainEntry as Id, CacheDriftInfo as If, FileMapAdapter as Ig, ToolResultMetadata as Ih, truncateHeadForPtlRetry as Ii, mergeSuggestions as Il, AgentStats as Im, finalizeEvalMetrics as In, ExtensionPermission as Io, openai as Ip, multiEdit as Ir, SubagentOverride as Is, EvalAgentMcpServers as It, serializeInteractionResponse as Iu, startOAuthCallback as J, ExtensionConfigItem as Ja, ActivationVia as Jc, credKeyOf as Jd, TokenCountPayload as Jf, TOOL_USE_INTERRUPTED_MARKER as Jg, ReadStateEntry as Jh, McpConnector as Ji, CommandSpawnTask as Jl, GeometricThinkingDecay as Jm, FormattedHeadlessTurnEvent as Jn, ExtensionToolPolicy as Jo, baseten as Jp, RunSummaryCollectorOptions as Jr, parsePluginManifest as Js, EvalRunMetricAggregate as Jt, LogSink as Ju, OAuthCallbackOptions as K, ExtensionConfigChangeBehavior as Ka, IMPLICITLY_ALLOWED_SKILL_TOOLS as Kc, anthropicDescriptor as Kd, StreamCallbacks as Kf, RemintResult as Kg, ToolMap as Kh, AgentHooks as Ki, CommandOutputBlock as Kl, DedupHasher as Km, statusCompleted as Kn, ExtensionStorageSurface as Ko, cerebras as Kp, RunSummaryByModel as Kr, expandPluginVars as Ks, EvalMetric as Kt, LogLevel as Ku, LoginMcpServerResult as L, ExtensionPromptBridge as La, parseSkillInstallSpec as Lc, AuthMethod as Ld, diffCacheDimensions as Lf, FileMapStoreOptions as Lg, ToolResultTextContent as Lh, GenerateStructuredDataOptions as Li, resolveCompletionSubmit as Ll, AutoCompact as Lm, formatEvalCaseSummary as Ln, ExtensionPromptTransform as Lo, toPiMessages as Lp, listFiles as Lr, SubagentRegistry as Ls, EvalAgentRunOptions as Lt, useInteractionsActions as Lu, MetricsHookSet as M, getModelCatalog as M_, isExtensionDefinition as Ma, SkillInstallOptions as Mc, filterChainFallbacks as Md, CacheBreakLoggerOptions as Mf, withExtensionSession as Mg, ToolResultDocumentContent as Mh, anchorPreviewFor as Mi, applyInsert as Ml, registerOAuthProvider as Mm, fileContains as Mn, ExtensionModal as Mo, userMessage as Mp, CreateShellToolOptions as Mr, SpawnTool as Ms, withZidaneSkillEditSkill as Mt, isInteractionTool as Mu, MetricsHooksOptions as N, setModelCatalog as N_, parseExtensionScanPathEnv as Na, SkillInstallResult as Nc, providerKeySetChanged as Nd, CacheDimensionDiff as Nf, RemoteStoreOptions as Ng, ToolResultDocumentRefContent as Nh, sliceForCompaction as Ni, collectReferences as Nl, AgentBehavior as Nm, fileContentQuality as Nn, ExtensionModalNode as No, OpenAIParams as Np, createShellTool as Nr, SpawnToolOptions as Ns, CreateEvalAgentOptions as Nt, isModelInteraction as Nu, Histogram as O, originPinnedFetch as O_, ExtensionScanEntry as Oa, SkillCandidateDetail as Oc, ModelChainEntry as Od, ContextSnapshot as Of, getExtensionSessionState as Og, ToolHookContext as Oh, ANCHOR_PREVIEW_MAX_CHARS as Oi, CompletionItem as Ol, getOAuthApiKey as Om, defineEval as On, ExtensionKeybinding as Oo, openAICompatPromptMessage as Op, createSkillsRunScriptTool as Or, ChildAgent as Os, extensionScaffold as Ot, TextQuestion as Ou, UpDownCounter as P, scanExtensionDirectories as Pa, SkillInstallSpec as Pc, restoreChainFallbacks as Pd, CacheDimensionName as Pf, createRemoteStore as Pg, ToolResultImageContent as Ph, stripImagesFromTurns as Pi, findActiveTrigger as Pl, AgentClock as Pm, fileExists as Pn, ExtensionOrderedContribution as Po, classifyOpenAIError as Pp, shell as Pr, SpawnToolState as Ps, EFFICIENCY_METRICS as Pt, makeRequestInteraction as Pu, PersistOutcome as Q, ExtensionConfigScope as Qa, SkillActivationStateOptions as Qc, localDescriptor as Qd, TurnResult as Qf, detectTurnInterruption as Qg, hydrateReadStateFromSession as Qh, BuildExtensionRegistryOptions as Qi, commandBlockToEvent as Ql, McpToolSchema as Qm, HeadlessOutputFormat as Qn, ExtensionToolRendererRegistration as Qo, AnthropicBedrockConfig as Qp, RunSummaryValidation as Qr, loadAgentPlugin as Qs, EvalRunSummaryCase as Qt, RingBufferSink as Qu, loginMcpServer as R, ExtensionPromptDelivery as Ra, readSkillProvenance as Rc, ProviderAuth as Rd, fnv1a32 as Rf, createFileMapStore as Rg, ToolResultVideoContent as Rh, generateStructuredData as Ri, Command as Rl, AutoCompactConfig as Rm, formatEvalRunSummary as Rn, ExtensionProviderMiddleware as Ro, MistralParams as Rp, InteractionToolOptions as Rr, createSpawnTool as Rs, EvalAgentRunResult as Rt, useInteractionsQueue as Ru, MutationValidationResult as S, normalizeMcpServers as S_, parseExtensionInstallSource as Sa, validateSkillName as Sc, Picked as Sd, ContextCategoryId as Sf, SessionRun as Sg, StaleReadPolicy as Sh, TRAILER as Si, resolveInlineSuggestion as Sl, isOAuthAccessToken as Sm, buildTrajectory as Sn, ExtensionCustomRenderer as So, assistantMessage as Sp, LazyToolEntry as Sr, ExtensionSessionSummary as Ss, ZIDANE_EXTENSION_SKILL_NAME as St, QuestionChoice as Su, normalizeProviders as T, wrapDiscoveredMcpTools as T_, updateInstalledExtension as Ta, interpolateShellCommands as Tc, Settings as Td, ContextExtensionSection as Tf, currentExtensionSession as Tg, ThinkingDecay as Th, buildFullCompactPrompt as Ti, useCompletion as Tl, resolveOAuthApiKey as Tm, createEvalAgent as Tn, ExtensionFooterHint as To, consumeSSE as Tp, SkillsUseToolOptions as Tr, ExtensionWorkspaceSurface as Ts, buildZidaneSkillEditSkill as Tt, QuestionResponse as Tu, createMemoryMcpCredentialStore as U, ExtensionConfigActionStatus as Ua, parseFrontmatter as Uc, ModelInfo as Ud, Provider as Uf, PairingRepair as Ug, toolResultToText as Uh, localReliabilityBehavior as Ui, CommandGenerateDataOptions as Ul, CompactHookContext as Um, registerEvalTests as Un, ExtensionSkillPolicy as Uo, CursorParams as Up, RunSummary as Ur, matchModelEntries as Us, EvalCaseResult as Ut, resolveSchemaInput as Uu, McpOAuthProvider as V, ExtensionConfigActionItem as Va, getDefaultScanPaths as Vc, BUILTIN_PROVIDERS as Vd, snapshotCacheDimensions as Vf, PairingDrop as Vg, toolOutputBudgetByteLength as Vh, normalizeShellCommand as Vi, CommandAttachment as Vl, CompactEndHookContext as Vm, llmJudge as Vn, ExtensionRuntimeEnv as Vo, LocalParams as Vp, glob as Vr, createModelSearchTool as Vs, EvalArtifacts as Vt, StandardSchemaLike as Vu, hasAuthorizationHeader as W, ExtensionConfigBooleanItem as Wa, parseSkillFile as Wc, ModelOption as Wd, ProviderCapabilities as Wf, PairingRepairMode as Wg, ToolContext as Wh, Agent as Wi, CommandInteraction as Wl, CompactStartHookContext as Wm, relativeArtifactPath as Wn, ExtensionSource as Wo, cursor as Wp, RunSummaryBlock as Wr, PLUGIN_SKILLS_DIR as Ws, EvalDefinition as Wt, zodToJsonSchema as Wu, PERSISTENCE_PREVIEW_BYTES as X, ExtensionConfigModelItem as Xa, DeactivationReason as Xc, getContextWindow as Xd, ToolResult as Xf, TurnInterruptionState as Xg, getReadState as Xh, McpToolWrap as Xi, CommandStepContext as Xl, McpServerConfig as Xm, HeadlessEvent as Xn, ExtensionToolRenderer as Xo, ArceeParams as Xp, RunSummaryRepeatGuard as Xr, PLUGIN_MANIFEST_FILE as Xs, EvalRunReporterOptions as Xt, LoggingHookSet as Xu, PERSISTED_STUB_PREFIX as Y, ExtensionConfigItemBase as Ya, ActiveSkill as Yc, enabledModelOptions as Yd, ToolCall as Yf, ToWireMessagesOptions as Yg, ReadStateMap as Yh, McpToolMeta as Yi, CommandStep as Yl, JsonValue as Ym, HeadlessErrorInfo as Yn, ExtensionToolRenderProps as Yo, planBasetenReasoning as Yp, RunSummaryError as Yr, validatePluginManifest as Ys, EvalRunReporter as Yt, Logger as Yu, PersistInput as Z, ExtensionConfigNumberItem as Za, SkillActivationState as Zc, getModelInfo as Zd, ToolSpec as Zf, autoDetectAndConvert as Zg, hashContent as Zh, createAgent as Zi, CommandStepFn as Zl, McpToolHookContext as Zm, HeadlessOptions as Zn, ExtensionToolRendererEntry as Zo, arcee as Zp, RunSummaryTokens as Zr, defaultPluginDataRoot as Zs, EvalRunSummary as Zt, LoggingHooksOptions as Zu, statsByModel as _, deriveMcpToolMeta as __, InstallExtensionFromSpecOptions as _a, matchesAllowedTool as _c, EditOutcome as _d, ContextBreakdown as _f, CreateSessionOptions as _g, SessionEndStatus as _h, BASE_INSTRUCTIONS as _i, InlineAutocompleteContext as _l, OAuthParams as _m, TrajectoryStep as _n, ExtensionBehaviorTransform as _o, OpenAICompatParams as _p, waitTask as _r, createExtensionHud as _s, EXTENSION_EDIT_METADATA_KEY as _t, PlanPayload as _u, basicTools as a, reasoningWireAction as a_, filterRegistryPlugins as aa, PluginManifest as ac, AgentRegistry as ad, restoreModelOptions as af, ToolStateOp as ag, PromptDocumentPart as ah, RecentFile as ai, BUILTIN_THEMES as al, buildAnthropicClientOptions as am, EvalWorkspaceFile as an, WireExtensionConfigSchema as ao, SchemaSanitizeProfile as ap, exitCodeForHeadlessResult as ar, LoadedExtension as as, resolveLegacySessionDir as at, AnswerValue as au, MutationValidationHooksOptions as b, nonOwningMcpView as b_, installExtensionFromSpec as ba, validateResourcePathReal as bc, InteractionMode as bd, ContextBreakdownOptions as bf, SessionData as bg, SessionTurn as bh, CompactPromptOptions as bi, createPathAutocompleteProvider as bl, credentialsFromParams as bm, buildEvalRunSummary as bn, ExtensionContextTransform as bo, applyOAICacheBreakpoints as bp, TailTruncateOptions as br, ExtensionModelEntry as bs, SKILL_EDIT_METADATA_KEY as bt, PlanStep as bu, StartSpan as c, toAnthropic as c_, ExtensionFetchResult as ca, agentPluginsSchemaId as cc, DEFAULT_AGENT_ID as cd, AutoCompactInput as cf, createToolStateController as cg, PromptTextPart as ch, selectFilesFromSession as ci, DEFAULT_THEME as cl, defaultAnthropicMaxTokens as cm, LlmJudgeOptions as cn, isValidExtensionConfigItem as co, sanitizeToolSpecs as cp, formattedHeadlessTurnEventToJsonl as cr, ExtensionBannerOptions as cs, resolveSessionDir as ct, HOST_INTERACTION_ID_PREFIX as cu, TracingHooksOptions as d, ConnectMcpServersOptions as d_, ExtensionInstallErrorCode as da, defineSkill as dc, PLAN_AGENT as dd, shouldAutoCompact as df, ShellInterpolationApproval as dg, RepeatGuardToolMatcher as dh, CompactOptions as di, Theme as dl, resolveAnthropicBetas as dm, MetricSpec as dn, resolveExtensionConfigValue as do, openrouter as dp, providerTranscriptFormatForProvider as dr, ExtensionHudStatus as ds, SHELL_CASCADE_CANCEL_MESSAGE as dt, InteractionResponse as du, ensureEndsWithUserMessage as e_, buildExtensionPreset as ea, LoadAgentPluginOptions as ec, createLogger as ed, modelSupportsReasoning as ef, readStateKey as eg, ModelTargetSpec as eh, BYTES_PER_TOKEN as ei, ResolveStorageDirsOptions as el, AnthropicParams as em, EvalScore as en, ExtensionConfigSurface as eo, planZaiReasoning as ep, HeadlessStatus as er, ExtensionToolResultPatch as es, buildPersistedStub as et, commandSteps as eu, createTracingHooks as f, McpConnection as f_, ExtensionInstallIo as fa, writeSkillToDisk as fc, accentColor as fd, ContextSegment as ff, SkillConfig as fg, ResolveContentRef as fh, CompactResult as fi, ThemeColors as fl, resolveAnthropicMaxOutput as fm, MetricSpecMap as fn, sanitizeExtensionConfigActionPatch as fo, ASSISTANT_TOOL_CALLS_TAG as fp, runHeadless as fr, ExtensionHudWriter as fs, TOOL_USE_CANCELLED_MESSAGE as ft, InteractionsActions as fu, formatTokenUsage as g, createStderrLineEmitter as g_, ExtensionInstallSource as ga, isToolAllowedByUnion as gc, EditHunk as gd, buildContextSegments as gf, SkillsConfig as gg, SessionContentBlock as gh, CompactPromptTooLongError as gi, resolveTheme as gl, resolvePromptCacheKey as gm, Trajectory as gn, ExtensionApiVersion as go, OpenAICompatHttpError as gp, WAIT_TASK_TIMED_OUT_PREFIX as gr, ExtensionStatusOptions as gs, renderStaleReadNotice as gt, PlanDecision as gu, flattenTurns as h, connectMcpServers as h_, ExtensionInstallScope as ha, SkillValidationResult as hc, EditDiffDisplay as hd, ContextSegmentsInput as hf, SkillSource as hg, RunHookMap as hh, CompactInvalidInputError as hi, resolveChipColor as hl, derivePromptCacheKey as hm, ReusableExecutionContext as hn, ExtensionAgentPluginOptions as ho, OpenAICompatAuthHeader as hp, writeFile as hr, ExtensionNotifyTone as hs, collectNewlyStaleReadPaths as ht, PendingInteractionEntry as hu, _default as i, fromOpenAI as i_, filterExtensionRegistry as ia, PluginDiagnostic as ic, AgentProfile as id, piIdOf as if, ToolStateController as ig, PromptAudioPart as ih, PostCompactRestoreOptions as ii, resolveStorageDirs as il, applyAnthropicCacheBreakpoints as im, EvalVariantSummary as in, WireExtensionConfigItem as io, SchemaSanitizeOptions as ip, ProviderTranscriptFormat as ir, GuiContributions as is, resolveLegacyPersistDir as it, AUTOMATIC_INTERACTION_INSTRUCTION as iu, MetricAttributes as j, ModelCatalogSource as j_, inlineLoadedExtension as ja, SkillInstallErrorCode as jc, chainsEqual as jd, CacheBreakInfo as jf, setExtensionSessionState as jg, ToolResultContent as jh, SummaryToTurnInput as ji, CompletionSubmitContext as jl, refreshOpenAICodexToken as jm, emitEfficiencyMetrics as jn, ExtensionMcpConfigTransform as jo, toolResultsMessage as jp, shellKill as jr, SpawnTaskOutcome as js, withZidaneExtensionSkill as jt, createInteractionTools as ju, InstrumentOptions as k, ModelCatalog as k_, defaultExtensionScanPaths as ka, SkillInstallCandidate as kc, buildRunModel as kd, ContextUsageSplit as kf, loadSession as kg, ToolOutcome as kh, CompactScope as ki, CompletionProvider as kl, getOAuthProvider as km, defineMetrics as kn, ExtensionKeybindingDispatchContext as ko, openaiCompat as kp, SkillsReadToolOptions as kr, ExtensionSubagentDef as ks, readSkillEditMarker as kt, buildResumedToolResultsTurn as ku, TracingConventions as l, toOpenAI as l_, ExtensionInstallCandidate as la, isSupportedAgentPluginsVersion as lc, DEFAULT_BUDGET_EXCLUDE_TOOLS as ld, OUTPUT_RESERVE_TOKENS as lf, isToolStateOps as lg, PromptVideoPart as lh, selectRecentFiles as li, SyntaxStyles as ll, planAnthropicThinking as lm, MetricDirection as ln, isValidExtensionConfigValue as lo, OpenRouterParams as lp, headlessEventToJsonl as lr, ExtensionHud as ls, resolveTasksDir as lt, InteractionOrigin as lu, TokenUsageLike as m, attachStderrWarnPump as m_, ExtensionInstallResult as ma, SkillValidationIssue as mc, singleAgentRegistry as md, ContextSegmentOrigin as mf, SkillResource as mg, RetryConfig as mh, compactConversation as mi, ThemeSurfaces as ml, PromptCacheKeyOption as mm, RegisterEvalTestsOptions as mn, EMPTY_EXTENSION_REGISTRY as mo, OAITool as mp, transcriptToProviderMessages as mr, ExtensionNotifyOptions as ms, applyCompactSummaryCutoff as mt, PRESENT_PLAN_TOOL as mu, composePresets as n, filterUnresolvedToolUses as n_, composeExtensionPreset as na, PluginAuthor as nc, jsonSink as nd, openaiDescriptor as nf, DEFAULT_MAX_VALUE_BYTES as ng, ProgressNudgeKind as nh, utf8ByteLength as ni, StorageMode as nl, EXTENDED_CACHE_TTL_BETA as nm, EvalScorerContext as nn, ExtensionConfigValueItem as no, XaiParams as np, OpenAIChatContentPart as nr, ExtensionToolVerdict as ns, maybePersistToolResult as nt, parseCommandInvocation as nu, GEN_AI_ATTRIBUTES as o, remintDuplicateToolCallIds as o_, mergeContributions as oa, PluginSchemaKind as oc, BUILD_AGENT as od, AUTO_COMPACT_MIN_GROWTH_FRACTION as of, ToolStateStore as og, PromptImagePart as oh, buildPostCompactAttachments as oi, ChipColor as ol, classifyAnthropicError as om, EvalWorkspaceOptions as on, clampExtensionConfigNumber as oo, SchemaSanitizeResult as op, formatHeadlessResult as or, LoadedPluginRecord as os, resolveMcpWarningsDir as ot, ConfirmQuestion as ou, ModelUsage as p, McpExecutionBinding as p_, ExtensionInstallProvenance as pa, writeSkillsToDisk as pc, resolveAgentId as pd, ContextSegmentFile as pf, SkillDiagnostic as pg, ResolveContentRefBlock as ph, CompactStartEvent as pi, ThemeSelect as pl, PromptCacheKeyContext as pm, MetricStats as pn, toWireConfigSchema as po, OAIMessage as pp, transcriptToOpenAIMessages as pr, ExtensionNotification as ps, TOOL_USE_SKIPPED_MESSAGE as pt, InteractionsProvider as pu, OAuthCallbackResult as q, ExtensionConfigEnumItem as qa, installAllowedToolsGate as qc, cerebrasDescriptor as qd, StreamOptions as qf, SYNTHETIC_TOOL_RESULT_PLACEHOLDER as qg, HydrateReadStateOptions as qh, AgentOptions as qi, CommandSpawnResult as ql, DedupToolConfig as qm, FormattedHeadlessResult as qn, ExtensionToolCatalogTransform as qo, BasetenParams as qp, RunSummaryCollector as qr, ManifestValidation as qs, EvalMetricError as qt, LogRecord as qu, definePreset as r, fromAnthropic as r_, disposeExtensionRegistry as ra, PluginComponentStatus as rc, AgentAccent as rd, openrouterDescriptor as rf, StagedToolState as rg, ProgressNudgeMessage as rh, PostCompactAttachments as ri, StorageSlot as rl, anthropic as rm, EvalTestRunner as rn, StoredExtensionConfigItem as ro, xai as rp, OpenAIChatMessage as rr, ExtensionTuiSurface as rs, migrateSessionArtifactDirs as rt, ASK_USER_TOOL as ru, Span as s, sanitizeHistoryForProvider as s_, partitionExtensionCatalog as sa, SUPPORTED_AGENT_PLUGINS_VERSIONS as sc, BUILTIN_AGENTS as sd, AutoCompactDecision as sf, ToolStateView as sg, PromptPart as sh, selectFilesFromReadState as si, ChipColorMap as sl, credentialIdentity as sm, EvalWorkspaceSnapshot as sn, coerceExtensionConfigInput as so, sanitizeToolSchema as sp, formatHeadlessTurnEvent as sr, TuiContributions as ss, resolvePersistDir as st, CreateInteractionToolsOptions as su, Preset as t, ensureToolResultPairing as t_, buildExtensionRegistry as ta, LoadedPlugin as tc, createLoggingHooks as td, modelsForDescriptor as tf, resolveReadStateMap as tg, OAuthRefreshHookContext as th, estimateTokens as ti, StorageDirs as tl, AnthropicThinkingPlan as tm, EvalScorer as tn, ExtensionConfigValue as to, zai as tp, HeadlessUsage as tr, ExtensionToolResultTransform as ts, cleanupPersistedSession as tt, executeCommand as tu, TracingHookSet as u, toWireMessages as u_, ExtensionInstallError as ua, parseSchemaId as uc, DEFAULT_PERSIST_EXCLUDE_TOOLS as ud, effectiveContextWindow as uf, stagedToolState as ug, RepeatGuardConfig as uh, CompactEndEvent as ui, SyntaxTokenStyle as ul, resolveAnthropicAuthShape as um, MetricEmitter as un, resolveExtensionConfig as uo, normalizeOpenRouterModelId as up, installHeadlessEventAdapter as ur, ExtensionHudState as us, INTERRUPT_MESSAGE_FOR_TOOL_USE as ut, InteractionRequest as uu, MutationValidationBatch as v, expandEnvPlaceholders as v_, InstalledExtensionTargetOptions as va, parseAllowedToolPattern as vc, EditOutcomeKind as vd, ContextBreakdownContributionContext as vf, LoadSessionOptions as vg, SessionHookContext as vh, CompactDirection as vi, InlineAutocompleteProvider as vl, ResolveOAuthApiKeyOptions as vm, TrajectoryStepKind as vn, ExtensionCapability as vo, OpenAICompatStreamError as vp, ValidationResult as vr, ExtensionHostRuntimeBridge as vs, EditSessionTarget as vt, PlanRequest as vu, createMutationValidationHooks as w, resultToString as w_, removeInstalledExtension as wa, InterpolateShellCommandsOptions as wc, SessionMeta as wd, ContextExtensionRow as wf, createSession as wg, StreamHookContext as wh, buildFromCompactPrompt as wi, CompletionState as wl, registerCustomOAuthProvider as wm, computeEvalTagScores as wn, ExtensionDefinition as wo, classifyOpenAICompatError as wp, createToolSearchTool as wr, ExtensionWorkspacePair as ws, buildZidaneExtensionSkill as wt, QuestionRequest as wu, MutationValidationMutation as x, normalizeMcpBlocks as x_, listExtensionCandidates as xa, validateSkillForWrite as xc, Owner as xd, ContextCategory as xf, SessionMetaRow as xg, SpawnHookContext as xh, NO_TOOLS_PREAMBLE as xi, patchInlineGhost as xl, extractRuntimeCredentials as xm, buildRegisteredEvals as xn, ExtensionContributions as xo, applyOAIToolCacheBreakpoint as xp, tailTruncate as xr, ExtensionRuntimeSurface as xs, SkillEditMarker as xt, Question as xu, MutationValidationFailure as y, expandMcpConfigEnv as y_, fetchExtensionSource as ya, validateResourcePath as yc, EditPayload as yd, ContextBreakdownContributor as yf, Session as yg, SessionMessage as yh, CompactPromptBuilder as yi, InlineGhost as yl, credentialsFilePath as ym, artifactPath as yn, ExtensionContext as yo, TOOL_RESULTS_TAG as yp, validateToolArgs as yr, ExtensionHostRuntimeImpl as ys, ExtensionEditMarker as yt, PlanResponse as yu, McpCredentialEntry as z, createExtensionPromptBridge as za, SourcedScanPath as zc, ProviderKey as zd, hashMessages as zf, EnsureToolResultPairingOptions as zg, TurnFinishReason as zh, defaultRepeatGuardNormalize as zi, CommandAgentResult as zl, CacheTtl as zm, formatTrajectoryLine as zn, ExtensionRegistry as zo, mistral as zp, createInteractionTool as zr, isSpawnTool as zs, EvalAgentRunStats as zt, InferSchemaOutput as zu };
|
|
19234
|
+
//# sourceMappingURL=index-ZWibV230.d.ts.map
|