@opengeni/runtime 0.11.0 → 0.13.0

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/index.d.ts CHANGED
@@ -3,12 +3,12 @@ import { Tool, Computer, AgentInputItem, Model, MCPServer, ModelProvider, Agent,
3
3
  export { MaxTurnsExceededError, OpenAIChatCompletionsModel, OpenAIResponsesModel } from '@openai/agents';
4
4
  import { Settings, ResolvedModelProvider, ConfiguredModel, ModelProviderApi } from '@opengeni/config';
5
5
  export { collectSandboxEnvironment, parseExposedPorts } from '@opengeni/config';
6
- import { HumanInputResponse, ReasoningEffort, GitCredentialProvider, SessionEventType, ResourceRef, ToolRef, Permission, McpServerConnectionRef, ToolAuthNeededPayload, RequestHumanInputToolInput } from '@opengeni/contracts';
6
+ import { HumanInputResponse, ReasoningEffort, GitCredentialProvider, GitCredentialTransport, SessionEventType, ResourceRef, ToolRef, Permission, McpServerConnectionRef, ToolAuthNeededPayload, RequestHumanInputToolInput } from '@opengeni/contracts';
7
7
  export { CAPABILITY_DESCRIPTORS, CapabilityDescriptor, DESKTOP_STREAM_PORT, StreamTokenPayload, StreamTokenPayload as StreamTokenPayloadType, TERMINAL_STREAM_PORT } from '@opengeni/contracts';
8
8
  import { SandboxSessionLike, Capability, SandboxSessionState, Manifest, Capabilities, LocalDirLazySkillSource, SandboxClient } from '@openai/agents/sandbox';
9
9
  import OpenAI from 'openai';
10
- import { R as RunCredentialSessionReady, a as RuntimeMetricsHooks } from './index-D6yi-JcU.js';
11
- export { A as ActiveBackendResolverDeps, b as ActiveBackendUnresolvableError, c as ActivePointer, B as BackendUnresolvableCode, C as ChannelAConflictError, d as ChannelAEmitter, e as ChannelAExecArgs, f as ChannelAExecResult, g as ChannelANotFoundError, h as ChannelASession, i as ChannelAUnavailableError, j as ChannelAUnsupportedError, k as ChannelAValidationError, l as ControlRpc, D as DEFAULT_DESKTOP_GEOMETRY, m as DISPLAY_STACK_TIMEOUT_MS, n as DesktopGeometry, o as DisplayStackError, p as DisplayStackUnsupportedError, E as EnsureDisplayStackOptions, q as EnsureDisplayStackResult, r as EnsureTerminalServerOptions, s as EnsureTerminalServerResult, t as EstablishedSandboxSession, u as ExposeStreamPortInput, v as ExposeStreamPortResult, w as ExposedPortEndpoint, F as FAULT_FIELD_WHAT_HAPPENED, x as FAULT_FIELD_WHAT_PRESERVED, y as FAULT_FIELD_WHAT_TO_TRY, z as FAULT_FIELD_WHICH_LAYER, L as LiveModalSandboxLeaseAttribution, M as MaterializeRunCredentialsOptions, G as MintStreamTokenInput, H as MockAgentResponder, I as MockAgentResponderOptions, J as MockExecHandler, K as ModalModuleLoader, N as ModalOrphanSweepResult, O as ModalSandboxAttribution, P as NEVER_SENT_DETAIL_KEY, Q as NatsControlRpc, S as NatsOpStreamConnection, T as NatsOpStreamTransport, U as NatsRequestConnection, V as NegotiationContext, W as NormalizedRunCredentialMaterial, X as NumstatEntry, Y as OP_STREAM_ACK_INTERVAL_MS, Z as OP_STREAM_DEFAULT_WINDOW_BYTES, _ as OP_STREAM_RECONNECT_HOLD_MS, $ as OP_STREAM_SILENCE_TIMEOUT_MS, a0 as OpStreamExecOutcome, a1 as OpStreamJournal, a2 as OpStreamSubscription, a3 as OpStreamTransport, a4 as OpStreamUnavailableError, a5 as PROVIDER_REGISTRY, a6 as ProviderConstructionContext, a7 as ProviderRegistration, a8 as REPOSITORY_DISCOVERY_LIMIT, a9 as RecordingArtifactMetadata, aa as RecordingCodec, ab as RecordingContentType, ac as RecordingError, ad as RecordingProcess, ae as RecordingUnavailableError, af as RepositoryDiscoveryDegradedReason, ag as RepositoryDiscoveryResult, ah as ResolvedActiveBackend, ai as RoutableBackendSession, aj as RoutableSandbox, ak as RoutingSandboxSession, al as RoutingSandboxSessionDeps, am as RoutingTransitionEvent, an as RoutingUnsupportedError, ao as RunCredentialCommandRunner, ap as RunCredentialCommandSession, aq as RunCredentialExpectedScope, ar as RunCredentialValidationError, as as SELFHOSTED_DEFAULT_TIMEOUT_MS, at as SELFHOSTED_DRAINING_MAX_RETRIES, au as SELFHOSTED_EXEC_DRAINING_MAX_RETRIES, av as SELFHOSTED_IDEMPOTENT_READONLY_OPS, aw as SELFHOSTED_INFRASTRUCTURE_FAULT_CLASSES, ax as SELFHOSTED_NEVER_SENT_MAX_RETRIES, ay as SELFHOSTED_RECONNECT_WINDOW_MS, az as SELFHOSTED_RELAY_STREAM_PATH, aA as SELFHOSTED_RETRY_BACKOFF_BASE_MS, aB as SELFHOSTED_RETRY_BACKOFF_CAP_MS, aC as SELFHOSTED_RETRY_BACKOFF_FACTOR, aD as SELFHOSTED_TIMEOUT_MAX_RETRIES, aE as STREAM_PORT, aF as STREAM_TOKEN_DEFAULT_TTL_SECONDS, aG as SandboxChannelAService, aH as SandboxChannelAServiceOptions, aI as SandboxConfigError, aJ as SandboxCreatedCallback, aK as SandboxProviderUnavailableError, aL as SandboxResumeStateUnavailableError, aM as SelfhostedApplyDiff, aN as SelfhostedControlError, aO as SelfhostedEditor, aP as SelfhostedEnrollment, aQ as SelfhostedExecArgs, aR as SelfhostedExecResult, aS as SelfhostedImageOutput, aT as SelfhostedLivenessState, aU as SelfhostedNegotiationInput, aV as SelfhostedOpObservation, aW as SelfhostedOpObserver, aX as SelfhostedOpStreamDeps, aY as SelfhostedRelayConfig, aZ as SelfhostedRetryClock, a_ as SelfhostedRetryDecision, a$ as SelfhostedSandboxClient, b0 as SelfhostedSession, b1 as SelfhostedSessionBuild, b2 as SelfhostedSessionDeps, b3 as SelfhostedSessionState, b4 as SelfhostedUnavailableReason, b5 as StartRecordingInput, b6 as StreamPortUnavailableError, b7 as SwapTargetEstablishability, b8 as TERMINAL_SERVER_TIMEOUT_MS, b9 as TerminalServerError, ba as TerminalServerUnsupportedError, bb as ToolspaceTokenPathError, bc as agentErrorToControlError, bd as assertDescriptorRegistryInvariants, be as assertProviderRegistryInvariants, bf as assertSafeRelPath, bg as backendSupportsOs, bh as buildDisplayStackScript, bi as buildSelfhostedBackendSession, bj as buildStreamUrl, bk as buildTerminalServerScript, bl as clearRunCredentials, bm as clearRunCredentialsForAttempt, bn as contentTypeForCodec, bo as createSandboxClient, bp as createSandboxClientForBackend, bq as decideSelfhostedRetry, br as decodeModalSnapshotId, bs as defaultSelfhostedRetryClock, bt as deletePriorPersistedSnapshot, bu as deleteRecordingArtifacts, bv as deserializeSandboxSessionStateEnvelope, bw as desktopCapableBackend, bx as drainingExhaustedError, by as drainingMessage, bz as ensureDisplayStack, bA as ensureModalRegistryImage, bB as ensureTerminalServer, bC as establishSandboxSessionFromEnvelope, bD as execDeadlineHint, bE as exposeStreamPort, bF as extForCodec, bG as inspectRecordingArtifact, bH as isExecSessionLostBanner, bI as isProviderSandboxNotFoundError, bJ as isSelfhostedProviderNotFoundError, bK as makeActiveBackendResolver, bL as materializeRunCredentials, bM as mintStreamToken, bN as modalSandboxAttributionEnvironment, bO as modalSandboxAttributionTags, bP as negotiateCapabilities, bQ as negotiateSelfhostedCapabilities, bR as nextDurableOpId, bS as normalizeRunCredentialsResolution, bT as offlineAgentError, bU as offlineControlResponse, bV as opAckSubject, bW as opFrameSubject, bX as parseExecBannerExitCode, bY as parseExecBannerSessionId, bZ as parseNumstatZ, b_ as parsePorcelainV2, b$ as parseUnifiedPatch, c0 as payloadTooLargeMessage, c1 as readWorkspaceArchiveFromEnvelopeSessionState, c2 as recordingStorageKey, c3 as renderSelfhostedFault, c4 as restoredSandboxSessionStateFromEntry, c5 as runCredentialPointerFile, c6 as runCredentialRoot, c7 as runWithToolCallCorrelation, c8 as sandboxStateEntryFromRunState, c9 as sanitizeOpIdToken, ca as selectBackend, cb as selfhostedFaultClass, cc as selfhostedLiveness, cd as selfhostedRetryBackoffMs, ce as serializeEstablishedSandboxEnvelope, cf as setSelfhostedApplyDiff, cg as startRecording, ch as stopRecording, ci as stripExecBanner, cj as subjectFor, ck as swapTargetEstablishability, cl as sweepModalOrphanSandboxes, cm as tagModalSandbox, cn as tearDownDisplayStack, co as tearDownTerminalServer, cp as terminateModalSandboxById, cq as timeoutAgentError, cr as timeoutControlResponse, cs as toolspaceTokenFileForSession, ct as toolspaceTokenFileFromEnvironment, cu as uploadRecordingArtifact, cv as verifyStreamToken, cw as withRunCredentialEnvironment, cx as withRunCredentialsClient, cy as withRunCredentialsSession, cz as withToolspaceTokenClient, cA as withToolspaceTokenEnvironment, cB as withToolspaceTokenSession } from './index-D6yi-JcU.js';
10
+ import { R as RunCredentialSessionReady, a as RuntimeMetricsHooks } from './index-DGUrY_yR.js';
11
+ export { A as ActiveBackendResolverDeps, b as ActiveBackendUnresolvableError, c as ActivePointer, B as BackendUnresolvableCode, C as ChannelAConflictError, d as ChannelAEmitter, e as ChannelAExecArgs, f as ChannelAExecResult, g as ChannelANotFoundError, h as ChannelASession, i as ChannelAUnavailableError, j as ChannelAUnsupportedError, k as ChannelAValidationError, l as ControlRpc, D as DEFAULT_DESKTOP_GEOMETRY, m as DISPLAY_STACK_TIMEOUT_MS, n as DesktopGeometry, o as DisplayStackCallerKind, p as DisplayStackClassification, q as DisplayStackError, r as DisplayStackTelemetryContext, s as DisplayStackTelemetryEvent, t as DisplayStackTelemetryStatus, u as DisplayStackUnsupportedError, E as EnsureDisplayStackOptions, v as EnsureDisplayStackResult, w as EnsureTerminalServerOptions, x as EnsureTerminalServerResult, y as EstablishedSandboxSession, z as ExposeStreamPortInput, F as ExposeStreamPortResult, G as ExposedPortEndpoint, H as FAULT_FIELD_WHAT_HAPPENED, I as FAULT_FIELD_WHAT_PRESERVED, J as FAULT_FIELD_WHAT_TO_TRY, K as FAULT_FIELD_WHICH_LAYER, L as LiveModalSandboxLeaseAttribution, M as MaterializeRunCredentialsOptions, N as MintStreamTokenInput, O as MockAgentResponder, P as MockAgentResponderOptions, Q as MockExecHandler, S as ModalModuleLoader, T as ModalOrphanSweepResult, U as ModalOrphanSweepTermination, V as ModalSandboxAttribution, W as NEVER_SENT_DETAIL_KEY, X as NatsControlRpc, Y as NatsOpStreamConnection, Z as NatsOpStreamTransport, _ as NatsRequestConnection, $ as NegotiationContext, a0 as NormalizedRunCredentialMaterial, a1 as NumstatEntry, a2 as OP_STREAM_ACK_INTERVAL_MS, a3 as OP_STREAM_DEFAULT_WINDOW_BYTES, a4 as OP_STREAM_RECONNECT_HOLD_MS, a5 as OP_STREAM_SILENCE_TIMEOUT_MS, a6 as OpStreamExecOutcome, a7 as OpStreamJournal, a8 as OpStreamSubscription, a9 as OpStreamTransport, aa as OpStreamUnavailableError, ab as PROVIDER_REGISTRY, ac as ProviderConstructionContext, ad as ProviderRegistration, ae as REPOSITORY_DISCOVERY_LIMIT, af as RecordingArtifactMetadata, ag as RecordingCodec, ah as RecordingContentType, ai as RecordingError, aj as RecordingProcess, ak as RecordingUnavailableError, al as RepositoryDiscoveryDegradedReason, am as RepositoryDiscoveryResult, an as ResolvedActiveBackend, ao as RevalidateModalOrphanTermination, ap as RoutableBackendSession, aq as RoutableSandbox, ar as RoutingSandboxSession, as as RoutingSandboxSessionDeps, at as RoutingTransitionEvent, au as RoutingUnsupportedError, av as RunCredentialCommandRunner, aw as RunCredentialCommandSession, ax as RunCredentialExpectedScope, ay as RunCredentialValidationError, az as SELFHOSTED_DEFAULT_TIMEOUT_MS, aA as SELFHOSTED_DRAINING_MAX_RETRIES, aB as SELFHOSTED_EXEC_DRAINING_MAX_RETRIES, aC as SELFHOSTED_IDEMPOTENT_READONLY_OPS, aD as SELFHOSTED_INFRASTRUCTURE_FAULT_CLASSES, aE as SELFHOSTED_NEVER_SENT_MAX_RETRIES, aF as SELFHOSTED_RECONNECT_WINDOW_MS, aG as SELFHOSTED_RELAY_STREAM_PATH, aH as SELFHOSTED_RETRY_BACKOFF_BASE_MS, aI as SELFHOSTED_RETRY_BACKOFF_CAP_MS, aJ as SELFHOSTED_RETRY_BACKOFF_FACTOR, aK as SELFHOSTED_TIMEOUT_MAX_RETRIES, aL as STREAM_PORT, aM as STREAM_TOKEN_DEFAULT_TTL_SECONDS, aN as SandboxChannelAService, aO as SandboxChannelAServiceOptions, aP as SandboxConfigError, aQ as SandboxCreatedCallback, aR as SandboxProviderUnavailableError, aS as SandboxResumeStateUnavailableError, aT as SelfhostedApplyDiff, aU as SelfhostedControlError, aV as SelfhostedEditor, aW as SelfhostedEnrollment, aX as SelfhostedExecArgs, aY as SelfhostedExecResult, aZ as SelfhostedImageOutput, a_ as SelfhostedLivenessState, a$ as SelfhostedNegotiationInput, b0 as SelfhostedOpObservation, b1 as SelfhostedOpObserver, b2 as SelfhostedOpStreamDeps, b3 as SelfhostedRelayConfig, b4 as SelfhostedRetryClock, b5 as SelfhostedRetryDecision, b6 as SelfhostedSandboxClient, b7 as SelfhostedSession, b8 as SelfhostedSessionBuild, b9 as SelfhostedSessionDeps, ba as SelfhostedSessionState, bb as SelfhostedUnavailableReason, bc as StartRecordingInput, bd as StreamPortUnavailableError, be as SwapTargetEstablishability, bf as TERMINAL_SERVER_TIMEOUT_MS, bg as TerminalServerError, bh as TerminalServerUnsupportedError, bi as ToolspaceTokenPathError, bj as agentErrorToControlError, bk as assertDescriptorRegistryInvariants, bl as assertProviderRegistryInvariants, bm as assertSafeRelPath, bn as backendSupportsOs, bo as buildDisplayStackScript, bp as buildSelfhostedBackendSession, bq as buildStreamUrl, br as buildTerminalServerScript, bs as clearRunCredentials, bt as clearRunCredentialsForAttempt, bu as contentTypeForCodec, bv as createSandboxClient, bw as createSandboxClientForBackend, bx as decideSelfhostedRetry, by as decodeModalSnapshotId, bz as defaultSelfhostedRetryClock, bA as deletePriorPersistedSnapshot, bB as deleteRecordingArtifacts, bC as deserializeSandboxSessionStateEnvelope, bD as desktopCapableBackend, bE as drainingExhaustedError, bF as drainingMessage, bG as ensureDisplayStack, bH as ensureModalRegistryImage, bI as ensureTerminalServer, bJ as establishSandboxSessionFromEnvelope, bK as execDeadlineHint, bL as exposeStreamPort, bM as extForCodec, bN as inspectRecordingArtifact, bO as isExecSessionLostBanner, bP as isProviderSandboxNotFoundError, bQ as isSelfhostedProviderNotFoundError, bR as makeActiveBackendResolver, bS as materializeRunCredentials, bT as mintStreamToken, bU as modalSandboxAttributionEnvironment, bV as modalSandboxAttributionTags, bW as negotiateCapabilities, bX as negotiateSelfhostedCapabilities, bY as nextDurableOpId, bZ as normalizeRunCredentialsResolution, b_ as offlineAgentError, b$ as offlineControlResponse, c0 as opAckSubject, c1 as opFrameSubject, c2 as parseExecBannerExitCode, c3 as parseExecBannerSessionId, c4 as parseNumstatZ, c5 as parsePorcelainV2, c6 as parseUnifiedPatch, c7 as payloadTooLargeMessage, c8 as readWorkspaceArchiveFromEnvelopeSessionState, c9 as recordingStorageKey, ca as renderSelfhostedFault, cb as restoredSandboxSessionStateFromEntry, cc as runCredentialPointerFile, cd as runCredentialRoot, ce as runWithToolCallCorrelation, cf as sandboxStateEntryFromRunState, cg as sanitizeOpIdToken, ch as selectBackend, ci as selfhostedFaultClass, cj as selfhostedLiveness, ck as selfhostedRetryBackoffMs, cl as serializeEstablishedSandboxEnvelope, cm as setSelfhostedApplyDiff, cn as startRecording, co as stopRecording, cp as stripExecBanner, cq as subjectFor, cr as swapTargetEstablishability, cs as sweepModalOrphanSandboxes, ct as tagModalSandbox, cu as tearDownDisplayStack, cv as tearDownTerminalServer, cw as terminateModalSandboxById, cx as timeoutAgentError, cy as timeoutControlResponse, cz as toolspaceTokenFileForSession, cA as toolspaceTokenFileFromEnvironment, cB as uploadRecordingArtifact, cC as verifyStreamToken, cD as withRunCredentialEnvironment, cE as withRunCredentialsClient, cF as withRunCredentialsSession, cG as withToolspaceTokenClient, cH as withToolspaceTokenEnvironment, cI as withToolspaceTokenSession } from './index-DGUrY_yR.js';
12
12
  export { SkillLibraryEntry, SkillLibraryFile, SkillLibrarySkill, getSkillLibraryEntry, isSkillLibraryEntryId, listSkillLibraryEntries, loadSkillLibrarySkill } from './skill-library.js';
13
13
  import 'modal';
14
14
  import '@opengeni/agent-proto';
@@ -207,6 +207,14 @@ type TurnToolCancellationFence = {
207
207
  waitForQuiescence(): Promise<void>;
208
208
  runSandboxCommand(session: TurnSandboxCommandSession, args: TurnSandboxCommandArgs): Promise<unknown>;
209
209
  };
210
+ type TurnToolCancellationController = TurnToolCancellationFence & {
211
+ wrapTools(tools: Tool<unknown>[], session?: CommandCancellationSession): Tool<unknown>[];
212
+ };
213
+ declare class TurnSandboxCommandCancelledError extends Error {
214
+ readonly name = "TurnSandboxCommandCancelledError";
215
+ constructor(reason: unknown);
216
+ }
217
+ declare function createTurnToolCancellationController(signal?: AbortSignal): TurnToolCancellationController;
210
218
 
211
219
  type ComputerButton = "left" | "right" | "wheel" | "back" | "forward";
212
220
  type SandboxComputerOptions = {
@@ -509,18 +517,49 @@ declare function stripReasoningIdentityFromSerializedRunState(serialized: string
509
517
  declare function neutralizeToolSearchItemsInSerializedRunState(serialized: string): string;
510
518
 
511
519
  type UsageDetails = Record<string, unknown> | Array<Record<string, unknown>>;
520
+ type RequestUsageEntry = {
521
+ inputTokens?: unknown;
522
+ input_tokens?: unknown;
523
+ outputTokens?: unknown;
524
+ output_tokens?: unknown;
525
+ totalTokens?: unknown;
526
+ total_tokens?: unknown;
527
+ inputTokensDetails?: UsageDetails | undefined;
528
+ input_tokens_details?: UsageDetails | undefined;
529
+ outputTokensDetails?: UsageDetails | undefined;
530
+ output_tokens_details?: UsageDetails | undefined;
531
+ };
532
+ type ModelCallUsageInput = {
533
+ inputTokens?: unknown;
534
+ outputTokens?: unknown;
535
+ totalTokens?: unknown;
536
+ inputTokensDetails?: UsageDetails | undefined;
537
+ outputTokensDetails?: UsageDetails | undefined;
538
+ requestUsageEntries?: RequestUsageEntry[] | undefined;
539
+ };
540
+ /**
541
+ * A single provider usage frame above one billion tokens is outside every
542
+ * supported OpenGeni model contract. Keeping the ceiling explicit also prevents
543
+ * malformed-but-finite provider values from corrupting durable accounting or a
544
+ * process-lifetime Prometheus counter.
545
+ */
546
+ declare const MAX_MODEL_USAGE_TOKEN_COUNT = 1000000000;
512
547
  type ModelCallUsageTelemetry = {
513
548
  inputTokens: number | null;
514
549
  outputTokens: number | null;
515
550
  cachedTokens: number | null;
551
+ cacheWriteTokens: number | null;
516
552
  reasoningTokens: number | null;
517
553
  };
518
- declare function modelCallUsageTelemetry(usage: {
519
- inputTokens?: unknown;
520
- outputTokens?: unknown;
521
- inputTokensDetails?: UsageDetails | undefined;
522
- outputTokensDetails?: UsageDetails | undefined;
523
- } | null | undefined): ModelCallUsageTelemetry;
554
+ type ModelCallUsageNormalization = {
555
+ telemetry: ModelCallUsageTelemetry;
556
+ totalTokens: number | null;
557
+ /** Bounded field paths only; raw provider values are never retained. */
558
+ rejectedFields: string[];
559
+ };
560
+ declare function modelUsageTokenCountOrNull(value: unknown): number | null;
561
+ declare function normalizeModelCallUsage(usage: ModelCallUsageInput | null | undefined): ModelCallUsageNormalization;
562
+ declare function modelCallUsageTelemetry(usage: ModelCallUsageInput | null | undefined): ModelCallUsageTelemetry;
524
563
 
525
564
  type NormalizedRuntimeEvent = {
526
565
  type: SessionEventType;
@@ -534,14 +573,29 @@ type ModelResponseUsage = {
534
573
  totalTokens?: number;
535
574
  inputTokensDetails?: Record<string, number> | Array<Record<string, number>>;
536
575
  outputTokensDetails?: Record<string, number> | Array<Record<string, number>>;
576
+ requestUsageEntries?: Array<{
577
+ inputTokens?: number;
578
+ input_tokens?: number;
579
+ outputTokens?: number;
580
+ output_tokens?: number;
581
+ totalTokens?: number;
582
+ total_tokens?: number;
583
+ inputTokensDetails?: Record<string, number>;
584
+ input_tokens_details?: Record<string, number>;
585
+ outputTokensDetails?: Record<string, number>;
586
+ output_tokens_details?: Record<string, number>;
587
+ }>;
537
588
  };
538
589
  };
590
+ type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
539
591
  type ResolveConnectionCredentialInput = {
540
592
  workspaceId: string;
541
593
  subjectId?: string;
542
594
  serverId: string;
543
595
  toolName?: string;
544
596
  connectionRef: McpServerConnectionRef;
597
+ /** Exact MCP destination whose request would receive the resolved headers. */
598
+ destinationUrl: string;
545
599
  forceRefresh?: boolean;
546
600
  };
547
601
  type ResolveConnectionCredentialResult = {
@@ -753,6 +807,7 @@ type GitCredentialBindingSeed = {
753
807
  credentialBindingId: string;
754
808
  provider: GitCredentialProvider;
755
809
  token: string;
810
+ transport?: GitCredentialTransport;
756
811
  expiresAt?: string;
757
812
  /** Total active bindings for this provider, used to suppress unsafe aliases. */
758
813
  providerBindingCount?: number;
@@ -1006,7 +1061,23 @@ type PrepareToolsOptions = {
1006
1061
  firstPartyPermissions?: Permission[];
1007
1062
  resolveCredential?: (input: ResolveConnectionCredentialInput) => Promise<ResolveConnectionCredentialResult>;
1008
1063
  onAuthNeeded?: (payload: ToolAuthNeededPayload) => Promise<void> | void;
1064
+ /** Injectable final MCP transport for tests and embedded hosts. */
1065
+ mcpFetchImpl?: FetchLike;
1066
+ };
1067
+ type ConnectedMcpServerBatches = {
1068
+ active: MCPServer[];
1069
+ failed: MCPServer[];
1070
+ errors: ReadonlyMap<MCPServer, Error>;
1071
+ close: () => Promise<void>;
1009
1072
  };
1073
+ /**
1074
+ * Connect SDK-managed MCP servers in stable, bounded batches. The SDK cleans a
1075
+ * failing strict batch; this wrapper additionally closes every earlier batch
1076
+ * before rethrowing, so a later-batch failure cannot leak live connections.
1077
+ */
1078
+ declare function connectMcpServersInBatches(servers: MCPServer[], options: {
1079
+ strict: boolean;
1080
+ }): Promise<ConnectedMcpServerBatches>;
1010
1081
  declare function prepareAgentTools(settings: Settings, tools: ToolRef[], options?: PrepareToolsOptions): Promise<PreparedAgentTools>;
1011
1082
  declare function prefixedMcpToolName(registryId: string, toolName: string): string;
1012
1083
  type PrepareInputOptions = {
@@ -1345,4 +1416,4 @@ declare function azureOpenAIDefaultQuery(settings: Pick<Settings, "azureOpenaiAp
1345
1416
  */
1346
1417
  declare function lazySkillSourceWithPackSkills(packSkills: PackSkill[], skillLibrarySkills?: PackSkill[]): LocalDirLazySkillSource;
1347
1418
 
1348
- export { type AgentSegmentInput, type BuildAgentOptions, COMPACTION_PROMPT, COMPACTION_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, CodexSubscriptionUnavailableError, type CompactionDecision, type CompactionItem, CompactionNeededError, CompactionProviderResponseError, ComputerActionError, ComputerReadOnlyError, type ComputerToolMode, ComputerUnavailableError, type ComputerUseArgs, ComputerUseCapability, type ContextRobustnessFilterOptions, DEFAULT_COMPACTION_THRESHOLD_RATIO, type EffectiveSkillSelection, EmptyCompactionSummaryError, GENESIS_TITLE_DIRECTIVE, type GitCredentialBindingSeed, type GitCredentialTokenWriterSession, type GitTokenSeeds, HUMAN_INPUT_TOOL_NAME, type HistoryItem, MAX_COMPACTION_THRESHOLD_RATIO, MIN_COMPACTION_THRESHOLD_RATIO, type ModelCallUsageTelemetry, type ModelResponseUsage, MultiProviderModelProvider, type NormalizedRuntimeEvent, type OpenGeniRuntime, type PackSkill, type PackSkillFile, type PersistentSessionSettings, type PrepareInputOptions, type PrepareToolsOptions, type PreparedAgentInput, type PreparedAgentTools, type PreparedCompactionPromptInput, type ProductionRuntimeOverrides, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult, type RigInstructionsContext, type RigSetupDescriptor, type RunAgentStreamOptions, RunCredentialSessionReady, RuntimeMetricsHooks, SUMMARY_BUFFER_TOKENS, SUMMARY_PREFIX, SandboxComputer, type SandboxComputerOptions, type SandboxFileDownload, type SandboxFileDownloadFailure, type SandboxFileDownloadMaterializationResult, type SandboxLifecycleCommandRunner, type SandboxLifecycleHook, type SandboxLifecycleHookContext, type SandboxLifecycleHookPhase, type SerializedHumanInputInterruption, TOOLSPACE_PROGRAMMATIC_DIRECTIVE, type ToolspaceTokenWriterSession, type TurnToolCancellationFence, USER_MESSAGE_TRUNCATION_MARKER, type WorkspaceEnvironmentContext, WorkspaceModelPolicyBlockedError, agentsErrorRunState, appendGenesisTitleDirective, appendPersistentSessionSettings, appendSessionInstructions, appendToolspaceInstructions, appendTurnInstructions, appendWorkspaceMemory, applyMissingManifestEntries, azureCliLoginCommand, azureOpenAIDefaultQuery, boundModelToolOutputsFilterForSettings, buildAgentCapabilities, buildCompactionPromptInput, buildCompactionReplacementHistory, buildManifest, buildModelInstance, buildOpenAIClientFromSettings, buildOpenGeniAgent, buildProviderClient, buildSummaryItem, callModelInputFilterForSettings, clampCompactionThresholdRatio, compactionProviderFailureDiagnostics, compactionReplacementFingerprint, compactionResponseDiagnostics, compactionThresholdTokens, composeAgentInstructions, computerUse, configureOpenAI, configureRuntimeMetricsHooks, contextRobustnessFilterForSettings, coreInstructions, createProductionAgentRuntime, decideCompaction, effectiveSkillSelectionsForAgent, elideSupersededViewImagePairs, elideSupersededViewImagesFilter, ensureReadableStreamFrom, estimateCompleteModelInput, estimateItemTokens, estimateSerializedValueTokens, estimateTokens, extractResponseOutputText, findCompactionNeededError, gitCredentialBindingHash, gitCredentialBindingTokenRefreshCommand, gitProviderTokenRefreshCommand, hasModelGeneratedItem, isCompactionSummary, isEphemeralInternalContext, isUserMessage, latestCompactionReplacementFingerprint, lazySkillSourceWithPackSkills, manifestEnvironmentDrift, materializeSandboxFileDownloads, maxTurnsExceededRunState, mcpToolErrorOutput, modelCallUsageTelemetry, modelResponseUsageFromResponse, modelResponseUsageFromSdkEvent, neutralizeToolSearchItemsInSerializedRunState, normalizeComputerCallsFilter, normalizeSdkEvent, normalizeToolOutputForEvent, oneShotGenesisTitleInputFilter, pinProvidedSessionManifestEnvironment, prefixedMcpToolName, prepareAgentTools, prepareCompactionPromptInput, prepareRunInput, refreshGitCredentialBindingTokenFiles, refreshGitProviderTokenFiles, refreshToolspaceTokenFile, renderCompactionPromptInputForChat, repositoryCloneCommand, repositoryUsesSandboxClone, resolveTurnModel, rigInstructions, rigSetupScriptCommand, runAgentStream, runAzureCliLoginHook, runBeforeAgentStartHooks, runOwnedSandboxSetup, runRepositoryCloneHook, runRigSetupHook, runToolspaceTokenSeedHook, sandboxCommandExitCode, sandboxCommandOutput, sandboxCommandStillRunning, sandboxFileDownloadFailureNote, sandboxFileDownloadsForAgent, sandboxLifecycleHooksForIds, sandboxRunAs, sanitizeHistoryItemsForModel, serializeApprovals, serializeHumanInputRequests, stripProviderItemIdsFilter, stripReasoningEncryptedContent, stripReasoningIdentityFromSerializedRunState, summarizeForCompaction, toolspaceTokenSeedCommand, withManifestRefreshOnResume, withSandboxFileDownloads, withSandboxLifecycleHooks, withStructuredViewImageFunctionResults, workspaceEnvironmentInstructions };
1419
+ export { type AgentSegmentInput, type BuildAgentOptions, COMPACTION_PROMPT, COMPACTION_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, CodexSubscriptionUnavailableError, type CompactionDecision, type CompactionItem, CompactionNeededError, CompactionProviderResponseError, ComputerActionError, ComputerReadOnlyError, type ComputerToolMode, ComputerUnavailableError, type ComputerUseArgs, ComputerUseCapability, type ConnectedMcpServerBatches, type ContextRobustnessFilterOptions, DEFAULT_COMPACTION_THRESHOLD_RATIO, type EffectiveSkillSelection, EmptyCompactionSummaryError, GENESIS_TITLE_DIRECTIVE, type GitCredentialBindingSeed, type GitCredentialTokenWriterSession, type GitTokenSeeds, HUMAN_INPUT_TOOL_NAME, type HistoryItem, MAX_COMPACTION_THRESHOLD_RATIO, MAX_MODEL_USAGE_TOKEN_COUNT, MIN_COMPACTION_THRESHOLD_RATIO, type ModelCallUsageInput, type ModelCallUsageNormalization, type ModelCallUsageTelemetry, type ModelResponseUsage, MultiProviderModelProvider, type NormalizedRuntimeEvent, type OpenGeniRuntime, type PackSkill, type PackSkillFile, type PersistentSessionSettings, type PrepareInputOptions, type PrepareToolsOptions, type PreparedAgentInput, type PreparedAgentTools, type PreparedCompactionPromptInput, type ProductionRuntimeOverrides, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult, type RigInstructionsContext, type RigSetupDescriptor, type RunAgentStreamOptions, RunCredentialSessionReady, RuntimeMetricsHooks, SUMMARY_BUFFER_TOKENS, SUMMARY_PREFIX, SandboxComputer, type SandboxComputerOptions, type SandboxFileDownload, type SandboxFileDownloadFailure, type SandboxFileDownloadMaterializationResult, type SandboxLifecycleCommandRunner, type SandboxLifecycleHook, type SandboxLifecycleHookContext, type SandboxLifecycleHookPhase, type SerializedHumanInputInterruption, TOOLSPACE_PROGRAMMATIC_DIRECTIVE, type ToolspaceTokenWriterSession, type TurnSandboxCommandArgs, TurnSandboxCommandCancelledError, type TurnSandboxCommandSession, type TurnToolCancellationController, type TurnToolCancellationFence, USER_MESSAGE_TRUNCATION_MARKER, type WorkspaceEnvironmentContext, WorkspaceModelPolicyBlockedError, agentsErrorRunState, appendGenesisTitleDirective, appendPersistentSessionSettings, appendSessionInstructions, appendToolspaceInstructions, appendTurnInstructions, appendWorkspaceMemory, applyMissingManifestEntries, azureCliLoginCommand, azureOpenAIDefaultQuery, boundModelToolOutputsFilterForSettings, buildAgentCapabilities, buildCompactionPromptInput, buildCompactionReplacementHistory, buildManifest, buildModelInstance, buildOpenAIClientFromSettings, buildOpenGeniAgent, buildProviderClient, buildSummaryItem, callModelInputFilterForSettings, clampCompactionThresholdRatio, compactionProviderFailureDiagnostics, compactionReplacementFingerprint, compactionResponseDiagnostics, compactionThresholdTokens, composeAgentInstructions, computerUse, configureOpenAI, configureRuntimeMetricsHooks, connectMcpServersInBatches, contextRobustnessFilterForSettings, coreInstructions, createProductionAgentRuntime, createTurnToolCancellationController, decideCompaction, effectiveSkillSelectionsForAgent, elideSupersededViewImagePairs, elideSupersededViewImagesFilter, ensureReadableStreamFrom, estimateCompleteModelInput, estimateItemTokens, estimateSerializedValueTokens, estimateTokens, extractResponseOutputText, findCompactionNeededError, gitCredentialBindingHash, gitCredentialBindingTokenRefreshCommand, gitProviderTokenRefreshCommand, hasModelGeneratedItem, isCompactionSummary, isEphemeralInternalContext, isUserMessage, latestCompactionReplacementFingerprint, lazySkillSourceWithPackSkills, manifestEnvironmentDrift, materializeSandboxFileDownloads, maxTurnsExceededRunState, mcpToolErrorOutput, modelCallUsageTelemetry, modelResponseUsageFromResponse, modelResponseUsageFromSdkEvent, modelUsageTokenCountOrNull, neutralizeToolSearchItemsInSerializedRunState, normalizeComputerCallsFilter, normalizeModelCallUsage, normalizeSdkEvent, normalizeToolOutputForEvent, oneShotGenesisTitleInputFilter, pinProvidedSessionManifestEnvironment, prefixedMcpToolName, prepareAgentTools, prepareCompactionPromptInput, prepareRunInput, refreshGitCredentialBindingTokenFiles, refreshGitProviderTokenFiles, refreshToolspaceTokenFile, renderCompactionPromptInputForChat, repositoryCloneCommand, repositoryUsesSandboxClone, resolveTurnModel, rigInstructions, rigSetupScriptCommand, runAgentStream, runAzureCliLoginHook, runBeforeAgentStartHooks, runOwnedSandboxSetup, runRepositoryCloneHook, runRigSetupHook, runToolspaceTokenSeedHook, sandboxCommandExitCode, sandboxCommandOutput, sandboxCommandStillRunning, sandboxFileDownloadFailureNote, sandboxFileDownloadsForAgent, sandboxLifecycleHooksForIds, sandboxRunAs, sanitizeHistoryItemsForModel, serializeApprovals, serializeHumanInputRequests, stripProviderItemIdsFilter, stripReasoningEncryptedContent, stripReasoningIdentityFromSerializedRunState, summarizeForCompaction, toolspaceTokenSeedCommand, withManifestRefreshOnResume, withSandboxFileDownloads, withSandboxLifecycleHooks, withStructuredViewImageFunctionResults, workspaceEnvironmentInstructions };