@opengeni/runtime 0.7.1 → 0.11.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/THIRD_PARTY_NOTICES +32 -0
- package/dist/agent-UMUIWWD2.js +8 -0
- package/dist/agent-UMUIWWD2.js.map +1 -0
- package/dist/chunk-4YJ5Z52Z.js +1789 -0
- package/dist/chunk-4YJ5Z52Z.js.map +1 -0
- package/dist/chunk-DPULLAJG.js +215 -0
- package/dist/chunk-DPULLAJG.js.map +1 -0
- package/dist/chunk-K4V4QYCL.js +37683 -0
- package/dist/chunk-K4V4QYCL.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-YUAFQEFY.js +21522 -0
- package/dist/chunk-YUAFQEFY.js.map +1 -0
- package/dist/{index-DIiiwQY2.d.ts → index-D6yi-JcU.d.ts} +138 -15
- package/dist/index.d.ts +329 -121
- package/dist/index.js +8149 -307
- package/dist/index.js.map +1 -1
- package/dist/localSources-T3HZ6KY4.js +15 -0
- package/dist/localSources-T3HZ6KY4.js.map +1 -0
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.js +42 -5
- package/dist/skill-library.d.ts +74 -0
- package/dist/skill-library.js +18 -0
- package/dist/skill-library.js.map +1 -0
- package/package.json +13 -5
- package/src/bundled_hashicorp_terraform_skills/README.md +3 -3
- package/src/bundled_hashicorp_terraform_skills/checkov/SKILL.md +1 -1
- package/src/context-compaction.ts +421 -24
- package/src/history-sanitizer.ts +14 -5
- package/src/index.ts +1335 -280
- package/src/sandbox/channel-a.ts +535 -97
- package/src/sandbox/index.ts +36 -2
- package/src/sandbox/routing/routing-session.ts +10 -2
- package/src/sandbox/run-credentials.ts +818 -0
- package/src/sandbox/select.ts +3 -3
- package/src/sandbox/selfhosted/capabilities.ts +1 -1
- package/src/sandbox/selfhosted/op-stream.ts +40 -0
- package/src/sandbox/selfhosted/op-testing.ts +50 -3
- package/src/sandbox/selfhosted/session.ts +17 -4
- package/src/sandbox/selfhosted/testing.ts +1 -1
- package/src/sandbox/stream-port.ts +1 -1
- package/src/sandbox/stream-token.ts +1 -1
- package/src/sandbox/terminal-server.ts +6 -2
- package/src/sandbox/toolspace-token.ts +147 -0
- package/src/sandbox/turn-tool-cancellation.ts +940 -0
- package/src/skill-library.ts +323 -0
- package/dist/chunk-RYDCVTMW.js +0 -5531
- package/dist/chunk-RYDCVTMW.js.map +0 -1
- /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,211 @@ 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, 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-
|
|
11
|
-
export { A as ActiveBackendResolverDeps,
|
|
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';
|
|
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
|
+
|
|
15
211
|
type ComputerButton = "left" | "right" | "wheel" | "back" | "forward";
|
|
16
212
|
type SandboxComputerOptions = {
|
|
17
213
|
display?: string;
|
|
@@ -222,7 +418,7 @@ declare function elideSupersededViewImagePairs<T extends HistoryItem>(items: rea
|
|
|
222
418
|
* types exist with that id, the call appearing before the result. Calls and
|
|
223
419
|
* results that satisfy that survive untouched.
|
|
224
420
|
*/
|
|
225
|
-
declare function sanitizeHistoryItemsForModel<T extends HistoryItem>(items: readonly T[]): T[];
|
|
421
|
+
declare function sanitizeHistoryItemsForModel<T extends HistoryItem>(items: readonly T[], toolOutputTruncationTokens?: number): T[];
|
|
226
422
|
/**
|
|
227
423
|
* Drop the account/org-bound `reasoning.encrypted_content` blob from a single
|
|
228
424
|
* history item, preserving everything else (the visible chain-of-thought text in
|
|
@@ -312,94 +508,6 @@ declare function stripReasoningIdentityFromSerializedRunState(serialized: string
|
|
|
312
508
|
*/
|
|
313
509
|
declare function neutralizeToolSearchItemsInSerializedRunState(serialized: string): string;
|
|
314
510
|
|
|
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;
|
|
362
|
-
};
|
|
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
|
-
/**
|
|
397
|
-
* Build the synthetic summary item (a plain user message) appended to the
|
|
398
|
-
* rebuilt active history.
|
|
399
|
-
*/
|
|
400
|
-
declare function buildSummaryItem(summaryBody: string): CompactionItem;
|
|
401
|
-
declare function renderCompactionPromptInputForChat(input: readonly CompactionItem[]): string;
|
|
402
|
-
|
|
403
511
|
type UsageDetails = Record<string, unknown> | Array<Record<string, unknown>>;
|
|
404
512
|
type ModelCallUsageTelemetry = {
|
|
405
513
|
inputTokens: number | null;
|
|
@@ -445,9 +553,11 @@ type ResolveConnectionCredentialResult = {
|
|
|
445
553
|
status: "auth_needed";
|
|
446
554
|
reason: ToolAuthNeededPayload["reason"];
|
|
447
555
|
providerDomain: string;
|
|
556
|
+
provider?: string;
|
|
448
557
|
connectionId?: string;
|
|
449
558
|
scopes?: string[];
|
|
450
559
|
resource?: string;
|
|
560
|
+
selectedResources?: McpServerConnectionRef["selectedResources"];
|
|
451
561
|
authorizationUrl?: string;
|
|
452
562
|
};
|
|
453
563
|
declare function ensureReadableStreamFrom(): void;
|
|
@@ -465,11 +575,20 @@ type AgentSegmentInput = {
|
|
|
465
575
|
approvalId: string;
|
|
466
576
|
decision: "approve" | "reject";
|
|
467
577
|
message?: string;
|
|
578
|
+
} | {
|
|
579
|
+
kind: "human_input";
|
|
580
|
+
serializedRunState: string;
|
|
581
|
+
toolCallId: string;
|
|
468
582
|
};
|
|
469
583
|
type PreparedAgentInput = {
|
|
470
584
|
input: string | AgentInputItem[] | RunState<any, any>;
|
|
471
585
|
sandboxSessionState?: SandboxSessionState;
|
|
472
586
|
};
|
|
587
|
+
declare const HUMAN_INPUT_TOOL_NAME = "request_human_input";
|
|
588
|
+
type SerializedHumanInputInterruption = {
|
|
589
|
+
toolCallId: string;
|
|
590
|
+
input: ReturnType<typeof RequestHumanInputToolInput.parse>;
|
|
591
|
+
};
|
|
473
592
|
type SandboxFileDownload = {
|
|
474
593
|
fileId: string;
|
|
475
594
|
mountPath: string;
|
|
@@ -499,6 +618,7 @@ type OpenGeniRuntime = {
|
|
|
499
618
|
prepareInput: (agent: Agent<any, any>, input: AgentSegmentInput, options?: PrepareInputOptions) => Promise<PreparedAgentInput>;
|
|
500
619
|
runStream: (agent: Agent<any, any>, input: PreparedAgentInput, settings: Settings, options?: RunAgentStreamOptions) => Promise<Awaited<ReturnType<typeof runAgentStream>>>;
|
|
501
620
|
serializeApprovals: (interruptions: unknown[]) => unknown[];
|
|
621
|
+
serializeHumanInputRequests?: (interruptions: unknown[]) => SerializedHumanInputInterruption[];
|
|
502
622
|
};
|
|
503
623
|
type ProductionRuntimeOverrides = {
|
|
504
624
|
model?: Model;
|
|
@@ -615,6 +735,10 @@ declare function summarizeForCompaction(settings: Settings, input: Array<Record<
|
|
|
615
735
|
systemInstructions?: string;
|
|
616
736
|
onUsage?: (usage: ModelResponseUsage) => void | Promise<void>;
|
|
617
737
|
}): Promise<string>;
|
|
738
|
+
/** Bounded provider diagnostics: identifiers and classifications, never messages or model data. */
|
|
739
|
+
declare function compactionProviderFailureDiagnostics(error: unknown): Record<string, unknown>;
|
|
740
|
+
/** Bounded, content-free diagnostics for a semantically empty checkpoint. */
|
|
741
|
+
declare function compactionResponseDiagnostics(response: unknown, extractedText?: string): Record<string, unknown>;
|
|
618
742
|
/**
|
|
619
743
|
* Pull the assistant text out of a Responses API result, shape-tolerant. Only
|
|
620
744
|
* `role === "assistant"` message items contribute: a provider whose Responses
|
|
@@ -625,9 +749,39 @@ declare function summarizeForCompaction(settings: Settings, input: Array<Record<
|
|
|
625
749
|
*/
|
|
626
750
|
declare function extractResponseOutputText(response: unknown): string;
|
|
627
751
|
type GitTokenSeeds = Partial<Record<GitCredentialProvider, string>>;
|
|
752
|
+
type GitCredentialBindingSeed = {
|
|
753
|
+
credentialBindingId: string;
|
|
754
|
+
provider: GitCredentialProvider;
|
|
755
|
+
token: string;
|
|
756
|
+
expiresAt?: string;
|
|
757
|
+
/** Total active bindings for this provider, used to suppress unsafe aliases. */
|
|
758
|
+
providerBindingCount?: number;
|
|
759
|
+
};
|
|
628
760
|
type GitCredentialTokenWriterSession = SandboxSessionLike;
|
|
761
|
+
type ToolspaceTokenWriterSession = SandboxSessionLike;
|
|
762
|
+
type EffectiveSkillSelection = Readonly<{
|
|
763
|
+
id: string;
|
|
764
|
+
name: string;
|
|
765
|
+
source: "bundled" | "library" | "pack";
|
|
766
|
+
version: string | null;
|
|
767
|
+
contentSha256: string | null;
|
|
768
|
+
reason: string;
|
|
769
|
+
}>;
|
|
770
|
+
/**
|
|
771
|
+
* Read-only, secret-free skill provenance for an already-built agent. This is
|
|
772
|
+
* intentionally separate from the model instructions and sandbox manifest so
|
|
773
|
+
* effective configuration inspection cannot accidentally expose credentials or
|
|
774
|
+
* turn skill activation into an authorization change.
|
|
775
|
+
*/
|
|
776
|
+
declare function effectiveSkillSelectionsForAgent(agent: object): readonly EffectiveSkillSelection[];
|
|
629
777
|
type BuildAgentOptions = {
|
|
630
778
|
model?: Model;
|
|
779
|
+
/** Settled response for the one internal human-input interruption resumed by this run. */
|
|
780
|
+
humanInputResponse?: {
|
|
781
|
+
requestId: string;
|
|
782
|
+
toolCallId: string;
|
|
783
|
+
response: HumanInputResponse;
|
|
784
|
+
};
|
|
631
785
|
reasoningEffort?: ReasoningEffort;
|
|
632
786
|
hostedWebSearch?: boolean;
|
|
633
787
|
encryptedReasoning?: boolean;
|
|
@@ -653,12 +807,29 @@ type BuildAgentOptions = {
|
|
|
653
807
|
rigCredentialHookIds?: string[];
|
|
654
808
|
gitTokenSeed?: string;
|
|
655
809
|
gitTokenSeeds?: GitTokenSeeds;
|
|
810
|
+
gitCredentialBindings?: GitCredentialBindingSeed[];
|
|
656
811
|
toolspaceTokenSeed?: string;
|
|
812
|
+
toolspaceTokenSessionId?: string;
|
|
657
813
|
genesisTitleHint?: boolean;
|
|
658
814
|
persistentSessionSettings?: PersistentSessionSettings;
|
|
659
815
|
instructionsTemplate?: string;
|
|
660
816
|
sessionInstructions?: string;
|
|
817
|
+
turnInstructions?: string;
|
|
661
818
|
packSkills?: PackSkill[];
|
|
819
|
+
skillLibrarySkills?: PackSkill[];
|
|
820
|
+
skillLibrarySelections?: EffectiveSkillSelection[];
|
|
821
|
+
/**
|
|
822
|
+
* Internal per-attempt cancellation boundary. The worker supplies Temporal's
|
|
823
|
+
* signal so an in-flight shell process is interrupted immediately instead of
|
|
824
|
+
* holding Steer/Pause behind its requested yield or natural exit.
|
|
825
|
+
*/
|
|
826
|
+
turnCancellationSignal?: AbortSignal;
|
|
827
|
+
/**
|
|
828
|
+
* Receives the physical sandbox-tool fence at agent construction time. A
|
|
829
|
+
* cancelled/fenced worker attempt must await it before publishing its durable
|
|
830
|
+
* attempt-quiesced receipt.
|
|
831
|
+
*/
|
|
832
|
+
onToolCancellationFence?: (fence: TurnToolCancellationFence) => void;
|
|
662
833
|
};
|
|
663
834
|
type PackSkillFile = {
|
|
664
835
|
path: string;
|
|
@@ -727,6 +898,8 @@ declare function composeAgentInstructions(template: string, workspaceEnvironment
|
|
|
727
898
|
* is a no-op that returns the composed string byte-for-byte.
|
|
728
899
|
*/
|
|
729
900
|
declare function appendSessionInstructions(composed: string, sessionInstructions?: string): string;
|
|
901
|
+
/** Append system instructions that apply to this exact turn only. */
|
|
902
|
+
declare function appendTurnInstructions(composed: string, turnInstructions?: string): string;
|
|
730
903
|
/**
|
|
731
904
|
* Append the durable session metadata the model otherwise cannot observe.
|
|
732
905
|
* This is deliberately declarative and excludes the title text: the title is
|
|
@@ -808,9 +981,12 @@ declare function buildOpenGeniAgent(settings: Settings, resources: ResourceRef[]
|
|
|
808
981
|
*/
|
|
809
982
|
declare function withStructuredViewImageFunctionResults(tools: Tool<unknown>[]): Tool<unknown>[];
|
|
810
983
|
declare function buildAgentCapabilities(settings: Settings, packSkills: PackSkill[], options?: {
|
|
984
|
+
skillLibrarySkills?: PackSkill[];
|
|
811
985
|
structuredToolTransport?: boolean;
|
|
812
986
|
computerToolMode?: ComputerToolMode;
|
|
813
987
|
onComputerUseReady?: (session: SandboxSessionLike) => Promise<void>;
|
|
988
|
+
turnCancellationSignal?: AbortSignal;
|
|
989
|
+
onToolCancellationFence?: (fence: TurnToolCancellationFence) => void;
|
|
814
990
|
}): ReturnType<typeof Capabilities.default>;
|
|
815
991
|
declare function sandboxRunAs(_settings: Settings): string | undefined;
|
|
816
992
|
type PreparedAgentTools = {
|
|
@@ -843,9 +1019,12 @@ type RunAgentStreamOptions = {
|
|
|
843
1019
|
sandboxClient?: unknown;
|
|
844
1020
|
sandboxEnvironment?: Record<string, string>;
|
|
845
1021
|
onRuntimeEvent?: (event: NormalizedRuntimeEvent) => Promise<void> | void;
|
|
846
|
-
|
|
1022
|
+
contextCompactionSignal?: () => ProviderContextTokenSignal | null | undefined;
|
|
847
1023
|
contextCompactionRequested?: () => boolean | Promise<boolean>;
|
|
848
1024
|
onGitCredentialSessionReady?: (session: GitCredentialTokenWriterSession) => Promise<void> | void;
|
|
1025
|
+
onToolspaceTokenSessionReady?: (session: ToolspaceTokenWriterSession) => Promise<void> | void;
|
|
1026
|
+
runCredentialSessionId?: string;
|
|
1027
|
+
onRunCredentialSessionReady?: RunCredentialSessionReady;
|
|
849
1028
|
ownedSandbox?: {
|
|
850
1029
|
client: unknown;
|
|
851
1030
|
session: unknown;
|
|
@@ -854,10 +1033,17 @@ type RunAgentStreamOptions = {
|
|
|
854
1033
|
fileDownloadsMaterialized?: boolean;
|
|
855
1034
|
deferredSetup?: boolean;
|
|
856
1035
|
};
|
|
1036
|
+
/**
|
|
1037
|
+
* The attempt's authoritative physical sandbox-operation fence. Platform
|
|
1038
|
+
* lifecycle commands use its command runner too, so Steer/Pause can interrupt
|
|
1039
|
+
* repository clone, rig setup, file materialization, and credential seeding
|
|
1040
|
+
* before the attempt-quiesced receipt opens queue admission.
|
|
1041
|
+
*/
|
|
1042
|
+
turnToolCancellationFence?: TurnToolCancellationFence;
|
|
857
1043
|
callModelInputFilter?: CallModelInputFilter;
|
|
858
1044
|
};
|
|
859
1045
|
type ContextRobustnessFilterOptions = {
|
|
860
|
-
|
|
1046
|
+
contextCompactionSignal?: () => ProviderContextTokenSignal | null | undefined;
|
|
861
1047
|
contextCompactionRequested?: () => boolean | Promise<boolean>;
|
|
862
1048
|
throwOnCompactionNeeded?: boolean;
|
|
863
1049
|
};
|
|
@@ -870,7 +1056,7 @@ declare const GENESIS_TITLE_DIRECTIVE = "This is the first turn of a new session
|
|
|
870
1056
|
* fails: a retry/recovery must continue the task, not restart setup.
|
|
871
1057
|
*/
|
|
872
1058
|
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.
|
|
1059
|
+
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
1060
|
/**
|
|
875
1061
|
* callModelInputFilter that removes provider-assigned item ids (rs_/msg_/fc_…)
|
|
876
1062
|
* from every input item immediately before each model call. Responses-API
|
|
@@ -906,6 +1092,12 @@ declare const normalizeComputerCallsFilter: CallModelInputFilter;
|
|
|
906
1092
|
* information and can otherwise balloon every following model request.
|
|
907
1093
|
*/
|
|
908
1094
|
declare const elideSupersededViewImagesFilter: CallModelInputFilter;
|
|
1095
|
+
/**
|
|
1096
|
+
* Canonical Codex-style tool-result bound at the final model-input seam. The
|
|
1097
|
+
* identical pure normalizer also runs before conversation rows are persisted,
|
|
1098
|
+
* so this is a live-turn defense rather than a request-only alternate history.
|
|
1099
|
+
*/
|
|
1100
|
+
declare function boundModelToolOutputsFilterForSettings(settings: Settings): CallModelInputFilter;
|
|
909
1101
|
declare function contextRobustnessFilterForSettings(settings: Settings, options?: ContextRobustnessFilterOptions): CallModelInputFilter;
|
|
910
1102
|
/**
|
|
911
1103
|
* The model-input filter applied before every model call. The computer_call
|
|
@@ -988,25 +1180,19 @@ declare function runOwnedSandboxSetup(agent: Agent<any, any>, session: SandboxSe
|
|
|
988
1180
|
onRuntimeEvent?: SandboxLifecycleHookContext["onRuntimeEvent"];
|
|
989
1181
|
gitTokenSeedsOverride?: GitTokenSeeds;
|
|
990
1182
|
gitTokenSeedOverride?: string;
|
|
1183
|
+
gitCredentialBindingsOverride?: GitCredentialBindingSeed[];
|
|
1184
|
+
toolspaceTokenSeedOverride?: string;
|
|
1185
|
+
commandRunner?: SandboxLifecycleCommandRunner;
|
|
991
1186
|
}): 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>;
|
|
1187
|
+
declare function withSandboxFileDownloads(client: SandboxClient, downloads: SandboxFileDownload[], context?: Pick<SandboxLifecycleHookContext, "onRuntimeEvent" | "runAs" | "commandRunner">): SandboxClient;
|
|
1188
|
+
declare function materializeSandboxFileDownloads(session: SandboxSessionLike, downloads: SandboxFileDownload[], context?: Pick<SandboxLifecycleHookContext, "onRuntimeEvent" | "runAs" | "commandRunner">): Promise<SandboxFileDownloadMaterializationResult>;
|
|
994
1189
|
declare function sandboxFileDownloadFailureNote(failures: SandboxFileDownloadFailure[]): string;
|
|
995
1190
|
declare function sandboxFileDownloadsForAgent(agent: unknown): SandboxFileDownload[];
|
|
996
1191
|
/**
|
|
997
|
-
*
|
|
998
|
-
*
|
|
999
|
-
*
|
|
1000
|
-
*
|
|
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.
|
|
1192
|
+
* Normalize a tool-call output for the lossy `agent.toolCall.output` audit event.
|
|
1193
|
+
* Inline image bytes/data URLs become a compact `media_preview` with exact byte
|
|
1194
|
+
* length where knowable and `fullOutputAvailable:false`. The model-facing output
|
|
1195
|
+
* is not changed here, and mixed arrays retain their non-image text/error facts.
|
|
1010
1196
|
*/
|
|
1011
1197
|
declare function normalizeToolOutputForEvent(output: unknown): unknown;
|
|
1012
1198
|
declare function normalizeSdkEvent(event: RunStreamEvent): NormalizedRuntimeEvent[];
|
|
@@ -1014,16 +1200,21 @@ declare function modelResponseUsageFromSdkEvent(event: RunStreamEvent): ModelRes
|
|
|
1014
1200
|
/** Normalize usage from either a Responses or Chat Completions result. */
|
|
1015
1201
|
declare function modelResponseUsageFromResponse(response: unknown): ModelResponseUsage | null;
|
|
1016
1202
|
declare function serializeApprovals(interruptions: unknown[]): unknown[];
|
|
1203
|
+
declare function serializeHumanInputRequests(interruptions: unknown[]): SerializedHumanInputInterruption[];
|
|
1017
1204
|
declare function buildManifest(settings: Settings, resources: ResourceRef[], environment?: Record<string, string>, fileResourceDownloads?: SandboxFileDownload[]): Manifest;
|
|
1018
1205
|
type SandboxLifecycleHookPhase = "beforeAgentStart";
|
|
1206
|
+
type SandboxLifecycleCommandRunner = (session: TurnSandboxCommandSession, args: TurnSandboxCommandArgs) => Promise<unknown>;
|
|
1019
1207
|
type SandboxLifecycleHookContext = {
|
|
1020
1208
|
environment: Record<string, string>;
|
|
1021
1209
|
onRuntimeEvent?: (event: NormalizedRuntimeEvent) => Promise<void> | void;
|
|
1022
1210
|
runAs?: string;
|
|
1023
1211
|
gitTokenSeed?: string;
|
|
1024
1212
|
gitTokenSeeds?: GitTokenSeeds;
|
|
1213
|
+
gitCredentialBindings?: GitCredentialBindingSeed[];
|
|
1025
1214
|
toolspaceTokenSeed?: string;
|
|
1215
|
+
toolspaceTokenFile?: string;
|
|
1026
1216
|
rigSetup?: RigSetupDescriptor;
|
|
1217
|
+
commandRunner?: SandboxLifecycleCommandRunner;
|
|
1027
1218
|
};
|
|
1028
1219
|
type RigSetupDescriptor = {
|
|
1029
1220
|
rigId: string;
|
|
@@ -1073,6 +1264,7 @@ declare function withSandboxLifecycleHooks(client: SandboxClient, hooks: Sandbox
|
|
|
1073
1264
|
declare function repositoryUsesSandboxClone(settings: Settings, resource: Extract<ResourceRef, {
|
|
1074
1265
|
kind: "repository";
|
|
1075
1266
|
}>, activeSandboxBackend?: Settings["sandboxBackend"]): boolean;
|
|
1267
|
+
declare function gitCredentialBindingHash(credentialBindingId: string): string;
|
|
1076
1268
|
/**
|
|
1077
1269
|
* Build the off-manifest command used to atomically replace provider token files.
|
|
1078
1270
|
*
|
|
@@ -1082,14 +1274,29 @@ declare function repositoryUsesSandboxClone(settings: Settings, resource: Extrac
|
|
|
1082
1274
|
* manifest environment or rebuilding the sandbox.
|
|
1083
1275
|
*/
|
|
1084
1276
|
declare function gitProviderTokenRefreshCommand(seeds: GitTokenSeeds): string;
|
|
1277
|
+
declare function gitCredentialBindingTokenRefreshCommand(bindings: GitCredentialBindingSeed[]): string;
|
|
1085
1278
|
declare function refreshGitProviderTokenFiles(session: GitCredentialTokenWriterSession, seeds: GitTokenSeeds, options?: {
|
|
1086
1279
|
runAs?: string;
|
|
1280
|
+
commandRunner?: SandboxLifecycleCommandRunner;
|
|
1281
|
+
}): Promise<void>;
|
|
1282
|
+
declare function refreshGitCredentialBindingTokenFiles(session: GitCredentialTokenWriterSession, bindings: GitCredentialBindingSeed[], options?: {
|
|
1283
|
+
runAs?: string;
|
|
1284
|
+
commandRunner?: SandboxLifecycleCommandRunner;
|
|
1087
1285
|
}): Promise<void>;
|
|
1088
1286
|
declare function repositoryCloneCommand(resources: Extract<ResourceRef, {
|
|
1089
1287
|
kind: "repository";
|
|
1090
|
-
}>[]): string;
|
|
1091
|
-
declare function toolspaceTokenSeedCommand(
|
|
1288
|
+
}>[], bindings?: GitCredentialBindingSeed[]): string;
|
|
1289
|
+
declare function toolspaceTokenSeedCommand(options?: {
|
|
1290
|
+
tokenFile?: string;
|
|
1291
|
+
legacyTokenFile?: string;
|
|
1292
|
+
}): string;
|
|
1092
1293
|
declare function runToolspaceTokenSeedHook(session: SandboxSessionLike, context: SandboxLifecycleHookContext): Promise<void>;
|
|
1294
|
+
declare function refreshToolspaceTokenFile(session: ToolspaceTokenWriterSession, token: string, options?: {
|
|
1295
|
+
runAs?: string;
|
|
1296
|
+
commandRunner?: SandboxLifecycleCommandRunner;
|
|
1297
|
+
tokenFile?: string;
|
|
1298
|
+
legacyTokenFile?: string;
|
|
1299
|
+
}): Promise<void>;
|
|
1093
1300
|
/**
|
|
1094
1301
|
* The rig-setup command (M3). One idempotent bash program:
|
|
1095
1302
|
* 1. `mkdir -p /var/opengeni` and, if the per-version marker already exists,
|
|
@@ -1127,14 +1334,15 @@ declare function sandboxCommandStillRunning(result: unknown): boolean;
|
|
|
1127
1334
|
declare function runAzureCliLoginHook(session: SandboxSessionLike, context?: SandboxLifecycleHookContext): Promise<void>;
|
|
1128
1335
|
declare function azureOpenAIDefaultQuery(settings: Pick<Settings, "azureOpenaiApiVersion">, baseURL: string): Record<string, string> | undefined;
|
|
1129
1336
|
/**
|
|
1130
|
-
* The skill source fed to the SDK Skills capability. Without pack
|
|
1131
|
-
* is the plain bundled local-dir source, byte-for-byte the
|
|
1132
|
-
* With
|
|
1133
|
-
* skill directories (as local_dir
|
|
1134
|
-
*
|
|
1135
|
-
* index, one `## Skills` instruction section, lazy
|
|
1136
|
-
* them. A pack skill shadows a bundled
|
|
1337
|
+
* The skill source fed to the SDK Skills capability. Without pack or curated
|
|
1338
|
+
* skills this is the plain bundled local-dir source, byte-for-byte the
|
|
1339
|
+
* pre-pack behavior. With either selected source it becomes a single
|
|
1340
|
+
* in-memory dir source combining bundled skill directories (as local_dir
|
|
1341
|
+
* entries the SDK materializes lazily) with selected in-memory skill
|
|
1342
|
+
* directories — one skill index, one `## Skills` instruction section, lazy
|
|
1343
|
+
* `load_skill` for all of them. A pack skill shadows a bundled or curated
|
|
1344
|
+
* skill with the same directory name, case-insensitively.
|
|
1137
1345
|
*/
|
|
1138
|
-
declare function lazySkillSourceWithPackSkills(packSkills: PackSkill[]): LocalDirLazySkillSource;
|
|
1346
|
+
declare function lazySkillSourceWithPackSkills(packSkills: PackSkill[], skillLibrarySkills?: PackSkill[]): LocalDirLazySkillSource;
|
|
1139
1347
|
|
|
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 };
|
|
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 };
|