@opengeni/runtime 0.7.1 → 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.
Files changed (61) hide show
  1. package/THIRD_PARTY_NOTICES +32 -0
  2. package/dist/agent-UMUIWWD2.js +8 -0
  3. package/dist/agent-UMUIWWD2.js.map +1 -0
  4. package/dist/chunk-4YJ5Z52Z.js +1789 -0
  5. package/dist/chunk-4YJ5Z52Z.js.map +1 -0
  6. package/dist/chunk-65UDUFUO.js +22133 -0
  7. package/dist/chunk-65UDUFUO.js.map +1 -0
  8. package/dist/chunk-DPULLAJG.js +215 -0
  9. package/dist/chunk-DPULLAJG.js.map +1 -0
  10. package/dist/chunk-HAN5D27J.js +292 -0
  11. package/dist/chunk-HAN5D27J.js.map +1 -0
  12. package/dist/chunk-K4V4QYCL.js +37683 -0
  13. package/dist/chunk-K4V4QYCL.js.map +1 -0
  14. package/dist/chunk-PZ5AY32C.js +10 -0
  15. package/dist/chunk-PZ5AY32C.js.map +1 -0
  16. package/dist/{index-DIiiwQY2.d.ts → index-DGUrY_yR.d.ts} +171 -18
  17. package/dist/index.d.ts +404 -125
  18. package/dist/index.js +8857 -412
  19. package/dist/index.js.map +1 -1
  20. package/dist/localSources-T3HZ6KY4.js +15 -0
  21. package/dist/localSources-T3HZ6KY4.js.map +1 -0
  22. package/dist/mcp-network.d.ts +78 -0
  23. package/dist/mcp-network.js +62 -0
  24. package/dist/mcp-network.js.map +1 -0
  25. package/dist/sandbox/index.d.ts +1 -1
  26. package/dist/sandbox/index.js +42 -5
  27. package/dist/skill-library.d.ts +74 -0
  28. package/dist/skill-library.js +18 -0
  29. package/dist/skill-library.js.map +1 -0
  30. package/package.json +18 -5
  31. package/src/bundled_hashicorp_terraform_skills/README.md +3 -3
  32. package/src/bundled_hashicorp_terraform_skills/checkov/SKILL.md +1 -1
  33. package/src/codex-tool-search.ts +20 -1
  34. package/src/context-compaction.ts +421 -24
  35. package/src/history-sanitizer.ts +14 -5
  36. package/src/index.ts +1806 -347
  37. package/src/mcp-network.ts +330 -0
  38. package/src/sandbox/channel-a.ts +526 -113
  39. package/src/sandbox/display-stack.ts +860 -23
  40. package/src/sandbox/exec-banner.ts +67 -0
  41. package/src/sandbox/index.ts +43 -2
  42. package/src/sandbox/providers/modal.ts +29 -2
  43. package/src/sandbox/routing/routing-session.ts +10 -2
  44. package/src/sandbox/run-credentials.ts +818 -0
  45. package/src/sandbox/select.ts +3 -3
  46. package/src/sandbox/selfhosted/capabilities.ts +1 -1
  47. package/src/sandbox/selfhosted/op-stream.ts +40 -0
  48. package/src/sandbox/selfhosted/op-testing.ts +50 -3
  49. package/src/sandbox/selfhosted/session.ts +17 -4
  50. package/src/sandbox/selfhosted/testing.ts +1 -1
  51. package/src/sandbox/stream-port.ts +1 -1
  52. package/src/sandbox/stream-token.ts +1 -1
  53. package/src/sandbox/terminal-server.ts +6 -2
  54. package/src/sandbox/toolspace-token.ts +147 -0
  55. package/src/sandbox/turn-tool-cancellation.ts +940 -0
  56. package/src/sandbox-computer.ts +3 -1
  57. package/src/skill-library.ts +323 -0
  58. package/src/usage-telemetry.ts +495 -51
  59. package/dist/chunk-RYDCVTMW.js +0 -5531
  60. package/dist/chunk-RYDCVTMW.js.map +0 -1
  61. /package/src/{bundled_hashicorp_terraform_skills → bundled_skill_library}/azure-verified-modules/SKILL.md +0 -0
package/dist/index.d.ts CHANGED
@@ -3,15 +3,219 @@ 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 { ReasoningEffort, GitCredentialProvider, SessionEventType, ResourceRef, ToolRef, Permission, McpServerConnectionRef, ToolAuthNeededPayload } 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 RuntimeMetricsHooks } from './index-DIiiwQY2.js';
11
- export { A as ActiveBackendResolverDeps, a as ActiveBackendUnresolvableError, b as ActivePointer, B as BackendUnresolvableCode, C as ChannelAConflictError, c as ChannelAEmitter, d as ChannelAExecArgs, e as ChannelAExecResult, f as ChannelANotFoundError, g as ChannelASession, h as ChannelAUnsupportedError, i as ChannelAValidationError, j as ControlRpc, D as DEFAULT_DESKTOP_GEOMETRY, k as DISPLAY_STACK_TIMEOUT_MS, l as DesktopGeometry, m as DisplayStackError, n as DisplayStackUnsupportedError, E as EnsureDisplayStackOptions, o as EnsureDisplayStackResult, p as EnsureTerminalServerOptions, q as EnsureTerminalServerResult, r as EstablishedSandboxSession, s as ExposeStreamPortInput, t as ExposeStreamPortResult, u as ExposedPortEndpoint, F as FAULT_FIELD_WHAT_HAPPENED, v as FAULT_FIELD_WHAT_PRESERVED, w as FAULT_FIELD_WHAT_TO_TRY, x as FAULT_FIELD_WHICH_LAYER, L as LiveModalSandboxLeaseAttribution, M as MintStreamTokenInput, y as MockAgentResponder, z as MockAgentResponderOptions, G as MockExecHandler, H as ModalModuleLoader, I as ModalOrphanSweepResult, J as ModalSandboxAttribution, N as NEVER_SENT_DETAIL_KEY, K as NatsControlRpc, O as NatsOpStreamConnection, P as NatsOpStreamTransport, Q as NatsRequestConnection, S as NegotiationContext, T as NumstatEntry, U as OP_STREAM_ACK_INTERVAL_MS, V as OP_STREAM_DEFAULT_WINDOW_BYTES, W as OP_STREAM_RECONNECT_HOLD_MS, X as OP_STREAM_SILENCE_TIMEOUT_MS, Y as OpStreamExecOutcome, Z as OpStreamJournal, _ as OpStreamSubscription, $ as OpStreamTransport, a0 as OpStreamUnavailableError, a1 as PROVIDER_REGISTRY, a2 as ProviderConstructionContext, a3 as ProviderRegistration, a4 as REPOSITORY_DISCOVERY_LIMIT, a5 as RecordingArtifactMetadata, a6 as RecordingCodec, a7 as RecordingContentType, a8 as RecordingError, a9 as RecordingProcess, aa as RecordingUnavailableError, ab as RepositoryDiscoveryDegradedReason, ac as RepositoryDiscoveryResult, ad as ResolvedActiveBackend, ae as RoutableBackendSession, af as RoutableSandbox, ag as RoutingSandboxSession, ah as RoutingSandboxSessionDeps, ai as RoutingTransitionEvent, aj as RoutingUnsupportedError, ak as SELFHOSTED_DEFAULT_TIMEOUT_MS, al as SELFHOSTED_DRAINING_MAX_RETRIES, am as SELFHOSTED_EXEC_DRAINING_MAX_RETRIES, an as SELFHOSTED_IDEMPOTENT_READONLY_OPS, ao as SELFHOSTED_INFRASTRUCTURE_FAULT_CLASSES, ap as SELFHOSTED_NEVER_SENT_MAX_RETRIES, aq as SELFHOSTED_RECONNECT_WINDOW_MS, ar as SELFHOSTED_RELAY_STREAM_PATH, as as SELFHOSTED_RETRY_BACKOFF_BASE_MS, at as SELFHOSTED_RETRY_BACKOFF_CAP_MS, au as SELFHOSTED_RETRY_BACKOFF_FACTOR, av as SELFHOSTED_TIMEOUT_MAX_RETRIES, aw as STREAM_PORT, ax as STREAM_TOKEN_DEFAULT_TTL_SECONDS, ay as SandboxChannelAService, az as SandboxChannelAServiceOptions, aA as SandboxConfigError, aB as SandboxCreatedCallback, aC as SandboxProviderUnavailableError, aD as SandboxResumeStateUnavailableError, aE as SelfhostedApplyDiff, aF as SelfhostedControlError, aG as SelfhostedEditor, aH as SelfhostedEnrollment, aI as SelfhostedExecArgs, aJ as SelfhostedExecResult, aK as SelfhostedImageOutput, aL as SelfhostedLivenessState, aM as SelfhostedNegotiationInput, aN as SelfhostedOpObservation, aO as SelfhostedOpObserver, aP as SelfhostedOpStreamDeps, aQ as SelfhostedRelayConfig, aR as SelfhostedRetryClock, aS as SelfhostedRetryDecision, aT as SelfhostedSandboxClient, aU as SelfhostedSession, aV as SelfhostedSessionBuild, aW as SelfhostedSessionDeps, aX as SelfhostedSessionState, aY as SelfhostedUnavailableReason, aZ as StartRecordingInput, a_ as StreamPortUnavailableError, a$ as SwapTargetEstablishability, b0 as TERMINAL_SERVER_TIMEOUT_MS, b1 as TerminalServerError, b2 as TerminalServerUnsupportedError, b3 as agentErrorToControlError, b4 as assertDescriptorRegistryInvariants, b5 as assertProviderRegistryInvariants, b6 as assertSafeRelPath, b7 as backendSupportsOs, b8 as buildDisplayStackScript, b9 as buildSelfhostedBackendSession, ba as buildStreamUrl, bb as buildTerminalServerScript, bc as contentTypeForCodec, bd as createSandboxClient, be as createSandboxClientForBackend, bf as decideSelfhostedRetry, bg as decodeModalSnapshotId, bh as defaultSelfhostedRetryClock, bi as deletePriorPersistedSnapshot, bj as deleteRecordingArtifacts, bk as deserializeSandboxSessionStateEnvelope, bl as desktopCapableBackend, bm as drainingExhaustedError, bn as drainingMessage, bo as ensureDisplayStack, bp as ensureModalRegistryImage, bq as ensureTerminalServer, br as establishSandboxSessionFromEnvelope, bs as execDeadlineHint, bt as exposeStreamPort, bu as extForCodec, bv as inspectRecordingArtifact, bw as isExecSessionLostBanner, bx as isProviderSandboxNotFoundError, by as isSelfhostedProviderNotFoundError, bz as isWorkspaceEscapeError, bA as makeActiveBackendResolver, bB as mintStreamToken, bC as modalSandboxAttributionEnvironment, bD as modalSandboxAttributionTags, bE as negotiateCapabilities, bF as negotiateSelfhostedCapabilities, bG as nextDurableOpId, bH as offlineAgentError, bI as offlineControlResponse, bJ as opAckSubject, bK as opFrameSubject, bL as parseExecBannerSessionId, bM as parseNumstatZ, bN as parsePorcelainV2, bO as parseUnifiedPatch, bP as payloadTooLargeMessage, bQ as readWorkspaceArchiveFromEnvelopeSessionState, bR as recordingStorageKey, bS as renderSelfhostedFault, bT as restoredSandboxSessionStateFromEntry, bU as runWithToolCallCorrelation, bV as sandboxStateEntryFromRunState, bW as sanitizeOpIdToken, bX as selectBackend, bY as selfhostedFaultClass, bZ as selfhostedLiveness, b_ as selfhostedRetryBackoffMs, b$ as serializeEstablishedSandboxEnvelope, c0 as setSelfhostedApplyDiff, c1 as startRecording, c2 as stopRecording, c3 as stripExecBanner, c4 as subjectFor, c5 as swapTargetEstablishability, c6 as sweepModalOrphanSandboxes, c7 as tagModalSandbox, c8 as tearDownDisplayStack, c9 as tearDownTerminalServer, ca as terminateModalSandboxById, cb as timeoutAgentError, cc as timeoutControlResponse, cd as uploadRecordingArtifact, ce as verifyStreamToken } from './index-DIiiwQY2.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
+ export { SkillLibraryEntry, SkillLibraryFile, SkillLibrarySkill, getSkillLibraryEntry, isSkillLibraryEntryId, listSkillLibraryEntries, loadSkillLibrarySkill } from './skill-library.js';
12
13
  import 'modal';
13
14
  import '@opengeni/agent-proto';
14
15
 
16
+ /**
17
+ * Portable conversation context compaction, following Codex CLI's local path.
18
+ *
19
+ * The checkpoint model sees the current active history plus one fixed
20
+ * checkpoint prompt, then the active history is rebuilt from the newest real
21
+ * user messages within one cumulative 20k-token budget plus one summary.
22
+ * Assistant messages, tool calls/results, reasoning, and images are removed
23
+ * from the active model-facing history; the database audit rows remain.
24
+ */
25
+ type CompactionItem = Record<string, unknown>;
26
+ /**
27
+ * Marker stored on the synthetic summary item so the UI can render it and the
28
+ * next rebuild can exclude old summaries from the retained user-message set.
29
+ */
30
+ declare const COMPACTION_SUMMARY_MARKER = "opengeni_context_summary";
31
+ declare const SUMMARY_BUFFER_TOKENS = 20000;
32
+ declare const COMPACT_USER_MESSAGE_MAX_TOKENS = 20000;
33
+ declare const DEFAULT_COMPACTION_THRESHOLD_RATIO = 0.9;
34
+ declare const MIN_COMPACTION_THRESHOLD_RATIO = 0.3;
35
+ declare const MAX_COMPACTION_THRESHOLD_RATIO = 0.9;
36
+ declare const COMPACTION_PROMPT: string;
37
+ declare const SUMMARY_PREFIX = "Another language model started to solve this problem and produced a summary of its thinking process. You also have access to the state of the tools that were used by that language model. Use this to build on the work that has already been done and avoid duplicating work. Here is the summary produced by the other language model, use the information in this summary to assist with your own analysis:";
38
+ declare const USER_MESSAGE_TRUNCATION_MARKER = "\n[... middle truncated for context compaction ...]\n";
39
+ /** A user-authored `message` item is the only legal turn boundary. */
40
+ declare function isUserMessage(item: unknown): boolean;
41
+ /** True for our synthetic compaction summary item. */
42
+ declare function isCompactionSummary(item: unknown): boolean;
43
+ /** Platform-authored system context exists for one inference and is never persisted. */
44
+ declare function isEphemeralInternalContext(item: unknown): boolean;
45
+ /** Serialized-item estimate for pre-call accounting and retained user budgets. */
46
+ declare function estimateItemTokens(item: CompactionItem): number;
47
+ declare function estimateTokens(items: readonly CompactionItem[]): number;
48
+ declare function estimateSerializedValueTokens(value: unknown): number;
49
+ type CompleteModelInputFootprint = {
50
+ input: readonly CompactionItem[];
51
+ instructionsTokens: number;
52
+ toolSchemaTokens: number;
53
+ };
54
+ type ProviderContextTokenSignal = {
55
+ /** Monotonic within one sampled run; advances after every model response. */
56
+ revision: number;
57
+ /** Provider total tokens after that response (input + generated output). */
58
+ totalTokens: number;
59
+ };
60
+ type CompleteModelInputEstimate = {
61
+ tokens: number;
62
+ source: "complete_estimate" | "provider_plus_local";
63
+ inputTokens: number;
64
+ instructionsTokens: number;
65
+ toolSchemaTokens: number;
66
+ appendedAfterModelTokens: number;
67
+ };
68
+ /**
69
+ * Match Codex history accounting: after one provider response, start from its
70
+ * authoritative TOTAL token count and add only local items placed after the
71
+ * newest model-generated item. System instructions and tool schemas are
72
+ * compared with the exact request footprint that produced the provider count;
73
+ * positive growth is added. Without a bound anchor, estimate the entire
74
+ * outgoing request rather than trusting stale usage from an earlier turn.
75
+ */
76
+ declare function estimateCompleteModelInput(input: {
77
+ current: CompleteModelInputFootprint;
78
+ provider?: ProviderContextTokenSignal | null;
79
+ providerRequestFootprint?: CompleteModelInputFootprint | null;
80
+ }): CompleteModelInputEstimate;
81
+ declare function hasModelGeneratedItem(items: readonly CompactionItem[]): boolean;
82
+ declare function clampCompactionThresholdRatio(value: number | undefined | null): number;
83
+ declare function compactionThresholdTokens(input: {
84
+ contextWindowTokens: number;
85
+ contextReservedOutputTokens: number;
86
+ contextAutoCompactThresholdTokens?: number | null | undefined;
87
+ contextCompactionThresholdRatio?: number | null | undefined;
88
+ }): number;
89
+ type CompactionDecision = {
90
+ shouldCompact: boolean;
91
+ reason: "force" | "above_threshold" | "below_threshold" | "no_history";
92
+ signalTokens: number;
93
+ thresholdTokens: number;
94
+ };
95
+ declare function decideCompaction(input: {
96
+ items: readonly CompactionItem[];
97
+ lastInputTokens?: number | null;
98
+ contextWindowTokens: number;
99
+ contextReservedOutputTokens: number;
100
+ contextAutoCompactThresholdTokens?: number | null | undefined;
101
+ contextCompactionThresholdRatio?: number | null | undefined;
102
+ force?: boolean;
103
+ }): CompactionDecision;
104
+ declare class CompactionNeededError extends Error {
105
+ readonly signalTokens: number;
106
+ readonly thresholdTokens: number;
107
+ readonly signalSource: "provider" | "estimate";
108
+ readonly trigger: "threshold" | "operator";
109
+ constructor(input: {
110
+ signalTokens: number;
111
+ thresholdTokens: number;
112
+ signalSource: "provider" | "estimate";
113
+ trigger?: "threshold" | "operator";
114
+ });
115
+ }
116
+ declare class EmptyCompactionSummaryError extends Error {
117
+ readonly diagnostics: Record<string, unknown>;
118
+ constructor(diagnostics?: Record<string, unknown>);
119
+ }
120
+ /**
121
+ * The checkpoint model request ended in a provider/transport failure rather
122
+ * than a successful response with an empty assistant message. Diagnostics are
123
+ * deliberately bounded and content-free so this error can be persisted on a
124
+ * turn without copying provider messages or conversation input into events.
125
+ */
126
+ declare class CompactionProviderResponseError extends Error {
127
+ readonly diagnostics: Record<string, unknown>;
128
+ readonly status?: number;
129
+ readonly code?: string;
130
+ readonly type?: string;
131
+ readonly cause?: unknown;
132
+ constructor(diagnostics?: Record<string, unknown>, cause?: unknown);
133
+ }
134
+ declare function findCompactionNeededError(error: unknown, seen?: WeakSet<object>): CompactionNeededError | null;
135
+ /**
136
+ * The exact checkpoint input shape: current active history followed by Codex's
137
+ * checkpoint prompt as a synthesized user message.
138
+ */
139
+ declare function buildCompactionPromptInput(items: readonly CompactionItem[]): CompactionItem[];
140
+ type PreparedCompactionPromptInput = {
141
+ input: CompactionItem[];
142
+ estimatedInputTokens: number;
143
+ rewrittenToolOutputs: number;
144
+ droppedHistoryItems: number;
145
+ };
146
+ /**
147
+ * Fit the explicit checkpoint request without mutating canonical history.
148
+ *
149
+ * Codex first replaces oversized tool outputs in its temporary remote-
150
+ * compaction input. OpenGeni does the same oldest-first, preserving the most
151
+ * recent tool detail for the plaintext summary. If that is still insufficient,
152
+ * whole oldest user-delimited work units are removed and the remaining suffix
153
+ * is protocol-sanitized so no call/result/reasoning fragment is orphaned.
154
+ * The raw active history is still the source for the eventual replacement and
155
+ * remains unchanged if the provider call fails.
156
+ */
157
+ declare function prepareCompactionPromptInput(items: readonly CompactionItem[], maxInputTokens: number): PreparedCompactionPromptInput;
158
+ /**
159
+ * Build the active history after compaction:
160
+ * the newest real user messages that fit one cumulative 20k-token budget
161
+ * (prior summaries excluded, images removed) plus one marked summary item.
162
+ */
163
+ declare function buildCompactionReplacementHistory(items: readonly CompactionItem[], summaryBody: string): CompactionItem[];
164
+ declare function compactionReplacementFingerprint(items: readonly CompactionItem[]): string;
165
+ /** Fingerprint the latest durable replacement prefix in active history. */
166
+ declare function latestCompactionReplacementFingerprint(items: readonly CompactionItem[]): string | null;
167
+ /**
168
+ * Build the synthetic summary item (a plain user message) appended to the
169
+ * rebuilt active history.
170
+ */
171
+ declare function buildSummaryItem(summaryBody: string): CompactionItem;
172
+ declare function renderCompactionPromptInputForChat(input: readonly CompactionItem[]): string;
173
+
174
+ type CommandCancellationSession = {
175
+ cancelExecCommand?(opId: string): Promise<boolean>;
176
+ supportsPty?(): boolean;
177
+ };
178
+ type TurnSandboxCommandArgs = {
179
+ cmd: string;
180
+ workdir?: string;
181
+ shell?: string;
182
+ login?: boolean;
183
+ tty?: boolean;
184
+ yieldTimeMs?: number;
185
+ maxOutputTokens?: number;
186
+ runAs?: string;
187
+ };
188
+ type TurnSandboxCommandSession = CommandCancellationSession & {
189
+ exec?(args: TurnSandboxCommandArgs): Promise<unknown>;
190
+ execCommand?(args: TurnSandboxCommandArgs): Promise<string>;
191
+ writeStdin?(args: {
192
+ sessionId: number;
193
+ chars?: string;
194
+ yieldTimeMs?: number;
195
+ maxOutputTokens?: number;
196
+ }): Promise<string>;
197
+ };
198
+ /**
199
+ * The worker may publish an attempt-quiesced receipt only after this fence
200
+ * resolves. `cancel()` prevents new turn-owned sandbox calls, actively stops
201
+ * shell processes, and `waitForQuiescence()` drains every capability call that
202
+ * was already in flight. Cleanup/telemetry outside the sandbox capability set
203
+ * remains independently attempt-fenced.
204
+ */
205
+ type TurnToolCancellationFence = {
206
+ cancel(reason?: unknown): void;
207
+ waitForQuiescence(): Promise<void>;
208
+ runSandboxCommand(session: TurnSandboxCommandSession, args: TurnSandboxCommandArgs): Promise<unknown>;
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;
218
+
15
219
  type ComputerButton = "left" | "right" | "wheel" | "back" | "forward";
16
220
  type SandboxComputerOptions = {
17
221
  display?: string;
@@ -222,7 +426,7 @@ declare function elideSupersededViewImagePairs<T extends HistoryItem>(items: rea
222
426
  * types exist with that id, the call appearing before the result. Calls and
223
427
  * results that satisfy that survive untouched.
224
428
  */
225
- declare function sanitizeHistoryItemsForModel<T extends HistoryItem>(items: readonly T[]): T[];
429
+ declare function sanitizeHistoryItemsForModel<T extends HistoryItem>(items: readonly T[], toolOutputTruncationTokens?: number): T[];
226
430
  /**
227
431
  * Drop the account/org-bound `reasoning.encrypted_content` blob from a single
228
432
  * history item, preserving everything else (the visible chain-of-thought text in
@@ -312,107 +516,50 @@ declare function stripReasoningIdentityFromSerializedRunState(serialized: string
312
516
  */
313
517
  declare function neutralizeToolSearchItemsInSerializedRunState(serialized: string): string;
314
518
 
315
- /**
316
- * Portable conversation context compaction, following Codex CLI's local path.
317
- *
318
- * The checkpoint model sees the current active history plus one fixed
319
- * checkpoint prompt, then the active history is rebuilt from the newest real
320
- * user messages within one cumulative 20k-token budget plus one summary.
321
- * Assistant messages, tool calls/results, reasoning, and images are removed
322
- * from the active model-facing history; the database audit rows remain.
323
- */
324
- type CompactionItem = Record<string, unknown>;
325
- /**
326
- * Marker stored on the synthetic summary item so the UI can render it and the
327
- * next rebuild can exclude old summaries from the retained user-message set.
328
- */
329
- declare const COMPACTION_SUMMARY_MARKER = "opengeni_context_summary";
330
- declare const SUMMARY_BUFFER_TOKENS = 20000;
331
- declare const COMPACT_USER_MESSAGE_MAX_TOKENS = 20000;
332
- declare const DEFAULT_COMPACTION_THRESHOLD_RATIO = 0.9;
333
- declare const MIN_COMPACTION_THRESHOLD_RATIO = 0.3;
334
- declare const MAX_COMPACTION_THRESHOLD_RATIO = 0.9;
335
- declare const COMPACTION_PROMPT: string;
336
- declare const SUMMARY_PREFIX = "Another language model started to solve this problem and produced a summary of its thinking process. You also have access to the state of the tools that were used by that language model. Use this to build on the work that has already been done and avoid duplicating work. Here is the summary produced by the other language model, use the information in this summary to assist with your own analysis:";
337
- declare const USER_MESSAGE_TRUNCATION_MARKER = "\n[... middle truncated for context compaction ...]\n";
338
- /** A user-authored `message` item is the only legal turn boundary. */
339
- declare function isUserMessage(item: unknown): boolean;
340
- /** True for our synthetic compaction summary item. */
341
- declare function isCompactionSummary(item: unknown): boolean;
342
- /** Platform-authored system context exists for one inference and is never persisted. */
343
- declare function isEphemeralInternalContext(item: unknown): boolean;
344
- /**
345
- * Rough token estimate for an item: char/4 over its serialized text. Used for
346
- * the pre-first-call signal and the retained user-message budget.
347
- */
348
- declare function estimateItemTokens(item: CompactionItem): number;
349
- declare function estimateTokens(items: readonly CompactionItem[]): number;
350
- declare function clampCompactionThresholdRatio(value: number | undefined | null): number;
351
- declare function compactionThresholdTokens(input: {
352
- contextWindowTokens: number;
353
- contextReservedOutputTokens: number;
354
- contextAutoCompactThresholdTokens?: number | null | undefined;
355
- contextCompactionThresholdRatio?: number | null | undefined;
356
- }): number;
357
- type CompactionDecision = {
358
- shouldCompact: boolean;
359
- reason: "force" | "above_threshold" | "below_threshold" | "no_history";
360
- signalTokens: number;
361
- thresholdTokens: number;
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;
362
539
  };
363
- declare function decideCompaction(input: {
364
- items: readonly CompactionItem[];
365
- lastInputTokens?: number | null;
366
- contextWindowTokens: number;
367
- contextReservedOutputTokens: number;
368
- contextAutoCompactThresholdTokens?: number | null | undefined;
369
- contextCompactionThresholdRatio?: number | null | undefined;
370
- force?: boolean;
371
- }): CompactionDecision;
372
- declare class CompactionNeededError extends Error {
373
- readonly signalTokens: number;
374
- readonly thresholdTokens: number;
375
- readonly signalSource: "provider" | "estimate";
376
- readonly trigger: "threshold" | "operator";
377
- constructor(input: {
378
- signalTokens: number;
379
- thresholdTokens: number;
380
- signalSource: "provider" | "estimate";
381
- trigger?: "threshold" | "operator";
382
- });
383
- }
384
- declare function findCompactionNeededError(error: unknown, seen?: WeakSet<object>): CompactionNeededError | null;
385
- /**
386
- * The exact checkpoint input shape: current active history followed by Codex's
387
- * checkpoint prompt as a synthesized user message.
388
- */
389
- declare function buildCompactionPromptInput(items: readonly CompactionItem[]): CompactionItem[];
390
- /**
391
- * Build the active history after compaction:
392
- * the newest real user messages that fit one cumulative 20k-token budget
393
- * (prior summaries excluded, images removed) plus one marked summary item.
394
- */
395
- declare function buildCompactionReplacementHistory(items: readonly CompactionItem[], summaryBody: string): CompactionItem[];
396
540
  /**
397
- * Build the synthetic summary item (a plain user message) appended to the
398
- * rebuilt active history.
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.
399
545
  */
400
- declare function buildSummaryItem(summaryBody: string): CompactionItem;
401
- declare function renderCompactionPromptInputForChat(input: readonly CompactionItem[]): string;
402
-
403
- type UsageDetails = Record<string, unknown> | Array<Record<string, unknown>>;
546
+ declare const MAX_MODEL_USAGE_TOKEN_COUNT = 1000000000;
404
547
  type ModelCallUsageTelemetry = {
405
548
  inputTokens: number | null;
406
549
  outputTokens: number | null;
407
550
  cachedTokens: number | null;
551
+ cacheWriteTokens: number | null;
408
552
  reasoningTokens: number | null;
409
553
  };
410
- declare function modelCallUsageTelemetry(usage: {
411
- inputTokens?: unknown;
412
- outputTokens?: unknown;
413
- inputTokensDetails?: UsageDetails | undefined;
414
- outputTokensDetails?: UsageDetails | undefined;
415
- } | 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;
416
563
 
417
564
  type NormalizedRuntimeEvent = {
418
565
  type: SessionEventType;
@@ -426,14 +573,29 @@ type ModelResponseUsage = {
426
573
  totalTokens?: number;
427
574
  inputTokensDetails?: Record<string, number> | Array<Record<string, number>>;
428
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
+ }>;
429
588
  };
430
589
  };
590
+ type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
431
591
  type ResolveConnectionCredentialInput = {
432
592
  workspaceId: string;
433
593
  subjectId?: string;
434
594
  serverId: string;
435
595
  toolName?: string;
436
596
  connectionRef: McpServerConnectionRef;
597
+ /** Exact MCP destination whose request would receive the resolved headers. */
598
+ destinationUrl: string;
437
599
  forceRefresh?: boolean;
438
600
  };
439
601
  type ResolveConnectionCredentialResult = {
@@ -445,9 +607,11 @@ type ResolveConnectionCredentialResult = {
445
607
  status: "auth_needed";
446
608
  reason: ToolAuthNeededPayload["reason"];
447
609
  providerDomain: string;
610
+ provider?: string;
448
611
  connectionId?: string;
449
612
  scopes?: string[];
450
613
  resource?: string;
614
+ selectedResources?: McpServerConnectionRef["selectedResources"];
451
615
  authorizationUrl?: string;
452
616
  };
453
617
  declare function ensureReadableStreamFrom(): void;
@@ -465,11 +629,20 @@ type AgentSegmentInput = {
465
629
  approvalId: string;
466
630
  decision: "approve" | "reject";
467
631
  message?: string;
632
+ } | {
633
+ kind: "human_input";
634
+ serializedRunState: string;
635
+ toolCallId: string;
468
636
  };
469
637
  type PreparedAgentInput = {
470
638
  input: string | AgentInputItem[] | RunState<any, any>;
471
639
  sandboxSessionState?: SandboxSessionState;
472
640
  };
641
+ declare const HUMAN_INPUT_TOOL_NAME = "request_human_input";
642
+ type SerializedHumanInputInterruption = {
643
+ toolCallId: string;
644
+ input: ReturnType<typeof RequestHumanInputToolInput.parse>;
645
+ };
473
646
  type SandboxFileDownload = {
474
647
  fileId: string;
475
648
  mountPath: string;
@@ -499,6 +672,7 @@ type OpenGeniRuntime = {
499
672
  prepareInput: (agent: Agent<any, any>, input: AgentSegmentInput, options?: PrepareInputOptions) => Promise<PreparedAgentInput>;
500
673
  runStream: (agent: Agent<any, any>, input: PreparedAgentInput, settings: Settings, options?: RunAgentStreamOptions) => Promise<Awaited<ReturnType<typeof runAgentStream>>>;
501
674
  serializeApprovals: (interruptions: unknown[]) => unknown[];
675
+ serializeHumanInputRequests?: (interruptions: unknown[]) => SerializedHumanInputInterruption[];
502
676
  };
503
677
  type ProductionRuntimeOverrides = {
504
678
  model?: Model;
@@ -615,6 +789,10 @@ declare function summarizeForCompaction(settings: Settings, input: Array<Record<
615
789
  systemInstructions?: string;
616
790
  onUsage?: (usage: ModelResponseUsage) => void | Promise<void>;
617
791
  }): Promise<string>;
792
+ /** Bounded provider diagnostics: identifiers and classifications, never messages or model data. */
793
+ declare function compactionProviderFailureDiagnostics(error: unknown): Record<string, unknown>;
794
+ /** Bounded, content-free diagnostics for a semantically empty checkpoint. */
795
+ declare function compactionResponseDiagnostics(response: unknown, extractedText?: string): Record<string, unknown>;
618
796
  /**
619
797
  * Pull the assistant text out of a Responses API result, shape-tolerant. Only
620
798
  * `role === "assistant"` message items contribute: a provider whose Responses
@@ -625,9 +803,40 @@ declare function summarizeForCompaction(settings: Settings, input: Array<Record<
625
803
  */
626
804
  declare function extractResponseOutputText(response: unknown): string;
627
805
  type GitTokenSeeds = Partial<Record<GitCredentialProvider, string>>;
806
+ type GitCredentialBindingSeed = {
807
+ credentialBindingId: string;
808
+ provider: GitCredentialProvider;
809
+ token: string;
810
+ transport?: GitCredentialTransport;
811
+ expiresAt?: string;
812
+ /** Total active bindings for this provider, used to suppress unsafe aliases. */
813
+ providerBindingCount?: number;
814
+ };
628
815
  type GitCredentialTokenWriterSession = SandboxSessionLike;
816
+ type ToolspaceTokenWriterSession = SandboxSessionLike;
817
+ type EffectiveSkillSelection = Readonly<{
818
+ id: string;
819
+ name: string;
820
+ source: "bundled" | "library" | "pack";
821
+ version: string | null;
822
+ contentSha256: string | null;
823
+ reason: string;
824
+ }>;
825
+ /**
826
+ * Read-only, secret-free skill provenance for an already-built agent. This is
827
+ * intentionally separate from the model instructions and sandbox manifest so
828
+ * effective configuration inspection cannot accidentally expose credentials or
829
+ * turn skill activation into an authorization change.
830
+ */
831
+ declare function effectiveSkillSelectionsForAgent(agent: object): readonly EffectiveSkillSelection[];
629
832
  type BuildAgentOptions = {
630
833
  model?: Model;
834
+ /** Settled response for the one internal human-input interruption resumed by this run. */
835
+ humanInputResponse?: {
836
+ requestId: string;
837
+ toolCallId: string;
838
+ response: HumanInputResponse;
839
+ };
631
840
  reasoningEffort?: ReasoningEffort;
632
841
  hostedWebSearch?: boolean;
633
842
  encryptedReasoning?: boolean;
@@ -653,12 +862,29 @@ type BuildAgentOptions = {
653
862
  rigCredentialHookIds?: string[];
654
863
  gitTokenSeed?: string;
655
864
  gitTokenSeeds?: GitTokenSeeds;
865
+ gitCredentialBindings?: GitCredentialBindingSeed[];
656
866
  toolspaceTokenSeed?: string;
867
+ toolspaceTokenSessionId?: string;
657
868
  genesisTitleHint?: boolean;
658
869
  persistentSessionSettings?: PersistentSessionSettings;
659
870
  instructionsTemplate?: string;
660
871
  sessionInstructions?: string;
872
+ turnInstructions?: string;
661
873
  packSkills?: PackSkill[];
874
+ skillLibrarySkills?: PackSkill[];
875
+ skillLibrarySelections?: EffectiveSkillSelection[];
876
+ /**
877
+ * Internal per-attempt cancellation boundary. The worker supplies Temporal's
878
+ * signal so an in-flight shell process is interrupted immediately instead of
879
+ * holding Steer/Pause behind its requested yield or natural exit.
880
+ */
881
+ turnCancellationSignal?: AbortSignal;
882
+ /**
883
+ * Receives the physical sandbox-tool fence at agent construction time. A
884
+ * cancelled/fenced worker attempt must await it before publishing its durable
885
+ * attempt-quiesced receipt.
886
+ */
887
+ onToolCancellationFence?: (fence: TurnToolCancellationFence) => void;
662
888
  };
663
889
  type PackSkillFile = {
664
890
  path: string;
@@ -727,6 +953,8 @@ declare function composeAgentInstructions(template: string, workspaceEnvironment
727
953
  * is a no-op that returns the composed string byte-for-byte.
728
954
  */
729
955
  declare function appendSessionInstructions(composed: string, sessionInstructions?: string): string;
956
+ /** Append system instructions that apply to this exact turn only. */
957
+ declare function appendTurnInstructions(composed: string, turnInstructions?: string): string;
730
958
  /**
731
959
  * Append the durable session metadata the model otherwise cannot observe.
732
960
  * This is deliberately declarative and excludes the title text: the title is
@@ -808,9 +1036,12 @@ declare function buildOpenGeniAgent(settings: Settings, resources: ResourceRef[]
808
1036
  */
809
1037
  declare function withStructuredViewImageFunctionResults(tools: Tool<unknown>[]): Tool<unknown>[];
810
1038
  declare function buildAgentCapabilities(settings: Settings, packSkills: PackSkill[], options?: {
1039
+ skillLibrarySkills?: PackSkill[];
811
1040
  structuredToolTransport?: boolean;
812
1041
  computerToolMode?: ComputerToolMode;
813
1042
  onComputerUseReady?: (session: SandboxSessionLike) => Promise<void>;
1043
+ turnCancellationSignal?: AbortSignal;
1044
+ onToolCancellationFence?: (fence: TurnToolCancellationFence) => void;
814
1045
  }): ReturnType<typeof Capabilities.default>;
815
1046
  declare function sandboxRunAs(_settings: Settings): string | undefined;
816
1047
  type PreparedAgentTools = {
@@ -830,7 +1061,23 @@ type PrepareToolsOptions = {
830
1061
  firstPartyPermissions?: Permission[];
831
1062
  resolveCredential?: (input: ResolveConnectionCredentialInput) => Promise<ResolveConnectionCredentialResult>;
832
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>;
833
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>;
834
1081
  declare function prepareAgentTools(settings: Settings, tools: ToolRef[], options?: PrepareToolsOptions): Promise<PreparedAgentTools>;
835
1082
  declare function prefixedMcpToolName(registryId: string, toolName: string): string;
836
1083
  type PrepareInputOptions = {
@@ -843,9 +1090,12 @@ type RunAgentStreamOptions = {
843
1090
  sandboxClient?: unknown;
844
1091
  sandboxEnvironment?: Record<string, string>;
845
1092
  onRuntimeEvent?: (event: NormalizedRuntimeEvent) => Promise<void> | void;
846
- contextCompactionSignalTokens?: () => number | null | undefined;
1093
+ contextCompactionSignal?: () => ProviderContextTokenSignal | null | undefined;
847
1094
  contextCompactionRequested?: () => boolean | Promise<boolean>;
848
1095
  onGitCredentialSessionReady?: (session: GitCredentialTokenWriterSession) => Promise<void> | void;
1096
+ onToolspaceTokenSessionReady?: (session: ToolspaceTokenWriterSession) => Promise<void> | void;
1097
+ runCredentialSessionId?: string;
1098
+ onRunCredentialSessionReady?: RunCredentialSessionReady;
849
1099
  ownedSandbox?: {
850
1100
  client: unknown;
851
1101
  session: unknown;
@@ -854,10 +1104,17 @@ type RunAgentStreamOptions = {
854
1104
  fileDownloadsMaterialized?: boolean;
855
1105
  deferredSetup?: boolean;
856
1106
  };
1107
+ /**
1108
+ * The attempt's authoritative physical sandbox-operation fence. Platform
1109
+ * lifecycle commands use its command runner too, so Steer/Pause can interrupt
1110
+ * repository clone, rig setup, file materialization, and credential seeding
1111
+ * before the attempt-quiesced receipt opens queue admission.
1112
+ */
1113
+ turnToolCancellationFence?: TurnToolCancellationFence;
857
1114
  callModelInputFilter?: CallModelInputFilter;
858
1115
  };
859
1116
  type ContextRobustnessFilterOptions = {
860
- contextCompactionSignalTokens?: () => number | null | undefined;
1117
+ contextCompactionSignal?: () => ProviderContextTokenSignal | null | undefined;
861
1118
  contextCompactionRequested?: () => boolean | Promise<boolean>;
862
1119
  throwOnCompactionNeeded?: boolean;
863
1120
  };
@@ -870,7 +1127,7 @@ declare const GENESIS_TITLE_DIRECTIVE = "This is the first turn of a new session
870
1127
  * fails: a retry/recovery must continue the task, not restart setup.
871
1128
  */
872
1129
  declare function oneShotGenesisTitleInputFilter(): CallModelInputFilter;
873
- declare const TOOLSPACE_PROGRAMMATIC_DIRECTIVE = "Every tool on your MCP surface is also callable programmatically from the sandbox shell, so scripts can invoke tools without a model round trip per call. Run `ogtool list` to see the available tools and their input schemas (from tools/list), then `ogtool call <tool-name> '<json-args>'`; equivalently, POST MCP JSON-RPC to $OPENGENI_TOOLSPACE_URL with the bearer token read from $OPENGENI_TOOLSPACE_TOKEN_FILE. Prefer programmatic calls for loops, polling, and bulk filtering: their results stay in the sandbox and do not consume your context window. Tools that require human approval must still be invoked normally \u2014 called programmatically they return a typed error.";
1130
+ declare const TOOLSPACE_PROGRAMMATIC_DIRECTIVE = "Every tool on your MCP surface is also callable programmatically from the sandbox shell, so scripts can invoke tools without a model round trip per call. If `ogtool` is installed, run `ogtool list` to see the available tools and their input schemas (from tools/list), then `ogtool call <tool-name> '<json-args>'`. If it is absent and both npm and $OPENGENI_OGTOOL_PACKAGE_SPEC are available, run the exact deployment-pinned package with `npm exec --yes --package=\"$OPENGENI_OGTOOL_PACKAGE_SPEC\" -- ogtool ...`; never guess a version or install `latest`. Otherwise POST MCP JSON-RPC directly to $OPENGENI_TOOLSPACE_URL with the bearer token read from $OPENGENI_TOOLSPACE_TOKEN_FILE. Prefer programmatic calls for loops, polling, and bulk filtering: their results stay in the sandbox and do not consume your context window. Tools that require human approval must still be invoked normally \u2014 called programmatically they return a typed error.";
874
1131
  /**
875
1132
  * callModelInputFilter that removes provider-assigned item ids (rs_/msg_/fc_…)
876
1133
  * from every input item immediately before each model call. Responses-API
@@ -906,6 +1163,12 @@ declare const normalizeComputerCallsFilter: CallModelInputFilter;
906
1163
  * information and can otherwise balloon every following model request.
907
1164
  */
908
1165
  declare const elideSupersededViewImagesFilter: CallModelInputFilter;
1166
+ /**
1167
+ * Canonical Codex-style tool-result bound at the final model-input seam. The
1168
+ * identical pure normalizer also runs before conversation rows are persisted,
1169
+ * so this is a live-turn defense rather than a request-only alternate history.
1170
+ */
1171
+ declare function boundModelToolOutputsFilterForSettings(settings: Settings): CallModelInputFilter;
909
1172
  declare function contextRobustnessFilterForSettings(settings: Settings, options?: ContextRobustnessFilterOptions): CallModelInputFilter;
910
1173
  /**
911
1174
  * The model-input filter applied before every model call. The computer_call
@@ -988,25 +1251,19 @@ declare function runOwnedSandboxSetup(agent: Agent<any, any>, session: SandboxSe
988
1251
  onRuntimeEvent?: SandboxLifecycleHookContext["onRuntimeEvent"];
989
1252
  gitTokenSeedsOverride?: GitTokenSeeds;
990
1253
  gitTokenSeedOverride?: string;
1254
+ gitCredentialBindingsOverride?: GitCredentialBindingSeed[];
1255
+ toolspaceTokenSeedOverride?: string;
1256
+ commandRunner?: SandboxLifecycleCommandRunner;
991
1257
  }): Promise<void>;
992
- declare function withSandboxFileDownloads(client: SandboxClient, downloads: SandboxFileDownload[], context?: Pick<SandboxLifecycleHookContext, "onRuntimeEvent" | "runAs">): SandboxClient;
993
- declare function materializeSandboxFileDownloads(session: SandboxSessionLike, downloads: SandboxFileDownload[], context?: Pick<SandboxLifecycleHookContext, "onRuntimeEvent" | "runAs">): Promise<SandboxFileDownloadMaterializationResult>;
1258
+ declare function withSandboxFileDownloads(client: SandboxClient, downloads: SandboxFileDownload[], context?: Pick<SandboxLifecycleHookContext, "onRuntimeEvent" | "runAs" | "commandRunner">): SandboxClient;
1259
+ declare function materializeSandboxFileDownloads(session: SandboxSessionLike, downloads: SandboxFileDownload[], context?: Pick<SandboxLifecycleHookContext, "onRuntimeEvent" | "runAs" | "commandRunner">): Promise<SandboxFileDownloadMaterializationResult>;
994
1260
  declare function sandboxFileDownloadFailureNote(failures: SandboxFileDownloadFailure[]): string;
995
1261
  declare function sandboxFileDownloadsForAgent(agent: unknown): SandboxFileDownload[];
996
1262
  /**
997
- * Compact a tool-call output for the `agent.toolCall.output` SESSION EVENT so it
998
- * never carries a raw binary payload. The codex-path `computer_screenshot` function
999
- * tool returns a structured `{type:'image', image:{data: Uint8Array, mediaType}}`;
1000
- * captured verbatim its `Uint8Array` JSON-serializes as an object-of-numbers (~12.7MB
1001
- * per screenshot in session_events — ~10x the base64 form). This mirrors the desktop
1002
- * screenshot to the SAME compact `data:<mediaType>;base64,…` STRING the HOSTED
1003
- * `computer_call` event already carries (agents-core sets its output to that data-URL),
1004
- * so both computer-use transports emit one representation. The full data-URL is kept
1005
- * (not truncated) because the web timeline RENDERS the screenshot from this event
1006
- * payload — packages/react/src/timeline/tool-renderers.tsx ComputerCallRenderer
1007
- * (`out.startsWith("data:image")` → <ScreenshotFigure src={out}/>) and ViewImageRenderer.
1008
- * Non-image outputs (text strings, MCP `{isError,content}` objects, hosted computer_call
1009
- * data-URL strings) pass through unchanged.
1263
+ * Normalize a tool-call output for the lossy `agent.toolCall.output` audit event.
1264
+ * Inline image bytes/data URLs become a compact `media_preview` with exact byte
1265
+ * length where knowable and `fullOutputAvailable:false`. The model-facing output
1266
+ * is not changed here, and mixed arrays retain their non-image text/error facts.
1010
1267
  */
1011
1268
  declare function normalizeToolOutputForEvent(output: unknown): unknown;
1012
1269
  declare function normalizeSdkEvent(event: RunStreamEvent): NormalizedRuntimeEvent[];
@@ -1014,16 +1271,21 @@ declare function modelResponseUsageFromSdkEvent(event: RunStreamEvent): ModelRes
1014
1271
  /** Normalize usage from either a Responses or Chat Completions result. */
1015
1272
  declare function modelResponseUsageFromResponse(response: unknown): ModelResponseUsage | null;
1016
1273
  declare function serializeApprovals(interruptions: unknown[]): unknown[];
1274
+ declare function serializeHumanInputRequests(interruptions: unknown[]): SerializedHumanInputInterruption[];
1017
1275
  declare function buildManifest(settings: Settings, resources: ResourceRef[], environment?: Record<string, string>, fileResourceDownloads?: SandboxFileDownload[]): Manifest;
1018
1276
  type SandboxLifecycleHookPhase = "beforeAgentStart";
1277
+ type SandboxLifecycleCommandRunner = (session: TurnSandboxCommandSession, args: TurnSandboxCommandArgs) => Promise<unknown>;
1019
1278
  type SandboxLifecycleHookContext = {
1020
1279
  environment: Record<string, string>;
1021
1280
  onRuntimeEvent?: (event: NormalizedRuntimeEvent) => Promise<void> | void;
1022
1281
  runAs?: string;
1023
1282
  gitTokenSeed?: string;
1024
1283
  gitTokenSeeds?: GitTokenSeeds;
1284
+ gitCredentialBindings?: GitCredentialBindingSeed[];
1025
1285
  toolspaceTokenSeed?: string;
1286
+ toolspaceTokenFile?: string;
1026
1287
  rigSetup?: RigSetupDescriptor;
1288
+ commandRunner?: SandboxLifecycleCommandRunner;
1027
1289
  };
1028
1290
  type RigSetupDescriptor = {
1029
1291
  rigId: string;
@@ -1073,6 +1335,7 @@ declare function withSandboxLifecycleHooks(client: SandboxClient, hooks: Sandbox
1073
1335
  declare function repositoryUsesSandboxClone(settings: Settings, resource: Extract<ResourceRef, {
1074
1336
  kind: "repository";
1075
1337
  }>, activeSandboxBackend?: Settings["sandboxBackend"]): boolean;
1338
+ declare function gitCredentialBindingHash(credentialBindingId: string): string;
1076
1339
  /**
1077
1340
  * Build the off-manifest command used to atomically replace provider token files.
1078
1341
  *
@@ -1082,14 +1345,29 @@ declare function repositoryUsesSandboxClone(settings: Settings, resource: Extrac
1082
1345
  * manifest environment or rebuilding the sandbox.
1083
1346
  */
1084
1347
  declare function gitProviderTokenRefreshCommand(seeds: GitTokenSeeds): string;
1348
+ declare function gitCredentialBindingTokenRefreshCommand(bindings: GitCredentialBindingSeed[]): string;
1085
1349
  declare function refreshGitProviderTokenFiles(session: GitCredentialTokenWriterSession, seeds: GitTokenSeeds, options?: {
1086
1350
  runAs?: string;
1351
+ commandRunner?: SandboxLifecycleCommandRunner;
1352
+ }): Promise<void>;
1353
+ declare function refreshGitCredentialBindingTokenFiles(session: GitCredentialTokenWriterSession, bindings: GitCredentialBindingSeed[], options?: {
1354
+ runAs?: string;
1355
+ commandRunner?: SandboxLifecycleCommandRunner;
1087
1356
  }): Promise<void>;
1088
1357
  declare function repositoryCloneCommand(resources: Extract<ResourceRef, {
1089
1358
  kind: "repository";
1090
- }>[]): string;
1091
- declare function toolspaceTokenSeedCommand(): string;
1359
+ }>[], bindings?: GitCredentialBindingSeed[]): string;
1360
+ declare function toolspaceTokenSeedCommand(options?: {
1361
+ tokenFile?: string;
1362
+ legacyTokenFile?: string;
1363
+ }): string;
1092
1364
  declare function runToolspaceTokenSeedHook(session: SandboxSessionLike, context: SandboxLifecycleHookContext): Promise<void>;
1365
+ declare function refreshToolspaceTokenFile(session: ToolspaceTokenWriterSession, token: string, options?: {
1366
+ runAs?: string;
1367
+ commandRunner?: SandboxLifecycleCommandRunner;
1368
+ tokenFile?: string;
1369
+ legacyTokenFile?: string;
1370
+ }): Promise<void>;
1093
1371
  /**
1094
1372
  * The rig-setup command (M3). One idempotent bash program:
1095
1373
  * 1. `mkdir -p /var/opengeni` and, if the per-version marker already exists,
@@ -1127,14 +1405,15 @@ declare function sandboxCommandStillRunning(result: unknown): boolean;
1127
1405
  declare function runAzureCliLoginHook(session: SandboxSessionLike, context?: SandboxLifecycleHookContext): Promise<void>;
1128
1406
  declare function azureOpenAIDefaultQuery(settings: Pick<Settings, "azureOpenaiApiVersion">, baseURL: string): Record<string, string> | undefined;
1129
1407
  /**
1130
- * The skill source fed to the SDK Skills capability. Without pack skills this
1131
- * is the plain bundled local-dir source, byte-for-byte the pre-pack behavior.
1132
- * With pack skills it becomes a single in-memory dir source combining bundled
1133
- * skill directories (as local_dir entries the SDK materializes lazily) with
1134
- * pack skill directories built from manifest-carried file content — one skill
1135
- * index, one `## Skills` instruction section, lazy `load_skill` for all of
1136
- * them. A pack skill shadows a bundled skill with the same directory name.
1408
+ * The skill source fed to the SDK Skills capability. Without pack or curated
1409
+ * skills this is the plain bundled local-dir source, byte-for-byte the
1410
+ * pre-pack behavior. With either selected source it becomes a single
1411
+ * in-memory dir source combining bundled skill directories (as local_dir
1412
+ * entries the SDK materializes lazily) with selected in-memory skill
1413
+ * directories — one skill index, one `## Skills` instruction section, lazy
1414
+ * `load_skill` for all of them. A pack skill shadows a bundled or curated
1415
+ * skill with the same directory name, case-insensitively.
1137
1416
  */
1138
- declare function lazySkillSourceWithPackSkills(packSkills: PackSkill[]): LocalDirLazySkillSource;
1417
+ declare function lazySkillSourceWithPackSkills(packSkills: PackSkill[], skillLibrarySkills?: PackSkill[]): LocalDirLazySkillSource;
1139
1418
 
1140
- export { type AgentSegmentInput, type BuildAgentOptions, COMPACTION_PROMPT, COMPACTION_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, CodexSubscriptionUnavailableError, type CompactionDecision, type CompactionItem, CompactionNeededError, ComputerActionError, ComputerReadOnlyError, type ComputerToolMode, ComputerUnavailableError, type ComputerUseArgs, ComputerUseCapability, type ContextRobustnessFilterOptions, DEFAULT_COMPACTION_THRESHOLD_RATIO, GENESIS_TITLE_DIRECTIVE, type GitCredentialTokenWriterSession, type GitTokenSeeds, 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 ProductionRuntimeOverrides, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult, type RigInstructionsContext, type RigSetupDescriptor, type RunAgentStreamOptions, RuntimeMetricsHooks, SUMMARY_BUFFER_TOKENS, SUMMARY_PREFIX, SandboxComputer, type SandboxComputerOptions, type SandboxFileDownload, type SandboxFileDownloadFailure, type SandboxFileDownloadMaterializationResult, type SandboxLifecycleHook, type SandboxLifecycleHookContext, type SandboxLifecycleHookPhase, TOOLSPACE_PROGRAMMATIC_DIRECTIVE, USER_MESSAGE_TRUNCATION_MARKER, type WorkspaceEnvironmentContext, WorkspaceModelPolicyBlockedError, agentsErrorRunState, appendGenesisTitleDirective, appendPersistentSessionSettings, appendSessionInstructions, appendToolspaceInstructions, appendWorkspaceMemory, applyMissingManifestEntries, azureCliLoginCommand, azureOpenAIDefaultQuery, buildAgentCapabilities, buildCompactionPromptInput, buildCompactionReplacementHistory, buildManifest, buildModelInstance, buildOpenAIClientFromSettings, buildOpenGeniAgent, buildProviderClient, buildSummaryItem, callModelInputFilterForSettings, clampCompactionThresholdRatio, compactionThresholdTokens, composeAgentInstructions, computerUse, configureOpenAI, configureRuntimeMetricsHooks, contextRobustnessFilterForSettings, coreInstructions, createProductionAgentRuntime, decideCompaction, elideSupersededViewImagePairs, elideSupersededViewImagesFilter, ensureReadableStreamFrom, estimateItemTokens, estimateTokens, extractResponseOutputText, findCompactionNeededError, gitProviderTokenRefreshCommand, isCompactionSummary, isEphemeralInternalContext, isUserMessage, lazySkillSourceWithPackSkills, manifestEnvironmentDrift, materializeSandboxFileDownloads, maxTurnsExceededRunState, mcpToolErrorOutput, modelCallUsageTelemetry, modelResponseUsageFromResponse, modelResponseUsageFromSdkEvent, neutralizeToolSearchItemsInSerializedRunState, normalizeComputerCallsFilter, normalizeSdkEvent, normalizeToolOutputForEvent, oneShotGenesisTitleInputFilter, pinProvidedSessionManifestEnvironment, prefixedMcpToolName, prepareAgentTools, prepareRunInput, refreshGitProviderTokenFiles, renderCompactionPromptInputForChat, repositoryCloneCommand, repositoryUsesSandboxClone, resolveTurnModel, rigInstructions, rigSetupScriptCommand, runAgentStream, runAzureCliLoginHook, runBeforeAgentStartHooks, runOwnedSandboxSetup, runRepositoryCloneHook, runRigSetupHook, runToolspaceTokenSeedHook, sandboxCommandExitCode, sandboxCommandOutput, sandboxCommandStillRunning, sandboxFileDownloadFailureNote, sandboxFileDownloadsForAgent, sandboxLifecycleHooksForIds, sandboxRunAs, sanitizeHistoryItemsForModel, serializeApprovals, 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 };