@opengeni/runtime 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -18,6 +18,8 @@ type SandboxComputerOptions = {
18
18
  typeDelayMs?: number;
19
19
  readOnly?: boolean;
20
20
  screenshotTmpDir?: string;
21
+ screenshotWarmupBudgetMs?: number;
22
+ screenshotRetryDelayMs?: number;
21
23
  };
22
24
  /** No exec/execCommand on the session, or the display is not up. */
23
25
  declare class ComputerUnavailableError extends Error {
@@ -53,6 +55,8 @@ declare class SandboxComputer implements Computer {
53
55
  private readonly typeDelayMs;
54
56
  private readonly readOnly;
55
57
  private readonly tmp;
58
+ private readonly screenshotWarmupBudgetMs;
59
+ private readonly screenshotRetryDelayMs;
56
60
  constructor(session: SandboxSessionLike, opts?: SandboxComputerOptions);
57
61
  /** Rebind to a freshly resumed-by-id session after a box rollover / re-establish. */
58
62
  rebind(session: SandboxSessionLike): void;
@@ -280,97 +284,77 @@ declare function stripReasoningIdentityFromSerializedRunState(serialized: string
280
284
  declare function neutralizeToolSearchItemsInSerializedRunState(serialized: string): string;
281
285
 
282
286
  /**
283
- * Client-side conversation context compaction (the Azure path).
287
+ * Client-side conversation context compaction (the Azure/client path).
284
288
  *
285
- * OpenGeni runs long-lived agent sessions whose conversation truth
286
- * (`session_history_items`) grows unbounded. On the OpenAI platform the
287
- * Responses API compacts server-side (the SDK's `compaction()` capability). On
288
- * Azure that capability 400s (`unsupported_parameter`), so the session
289
- * eventually overflows the model context window and hard-fails every turn.
290
- *
291
- * This module is the Azure-safe replacement. It is built from two pure pieces
292
- * plus one impure step the caller wires in:
293
- *
294
- * 1. `planCompaction` — given the active history items, the last turn's actual
295
- * input-token count, and the token budget, decide WHETHER to compact and,
296
- * if so, WHERE the orphan-safe cut boundary is (the prefix to summarize vs
297
- * the recent tail to keep verbatim). Pure, exhaustively testable.
298
- * 2. (caller) summarize the prefix into ONE plain user `message` item via a
299
- * model call — see `buildCompactionMessages` / `SUMMARY_PREFIX`.
300
- * 3. `applyCompaction` shape — the storage write the caller performs:
301
- * supersede the prefix rows, insert the summary at the boundary position.
302
- *
303
- * Design constraints (non-negotiable):
304
- * - The summary is a PLAIN user message, NOT the SDK `compaction` item type
305
- * (that requires server-minted `encrypted_content`; a hand-rolled one risks
306
- * an Azure 400).
307
- * - ORPHAN SAFETY: the cut lands only at a clean turn boundary (start of a
308
- * user message). No tool call_id may straddle the cut — for every
309
- * `function_call` dropped, its `function_call_result` is also dropped, and
310
- * vice versa. Reasoning items drop/keep with their whole turn.
311
- * - SINGLE LIVE SUMMARY: each compaction folds the prior summary forward
312
- * (summarize [prior summary] + [items since]); prior summaries are excluded
313
- * from re-collection so drift stays bounded.
289
+ * This mirrors Codex CLI's compaction model: the checkpoint model sees the
290
+ * current active history plus one fixed checkpoint prompt, then the active
291
+ * history is rebuilt as all real user messages plus one summary message.
292
+ * Assistant messages, tool calls/results, reasoning, and images are removed
293
+ * from the active model-facing history; the database audit rows remain.
314
294
  */
315
295
  type CompactionItem = Record<string, unknown>;
316
296
  /**
317
- * Marker stored on the synthetic summary item so it can be recognized on the
318
- * next compaction (to fold it forward) and excluded from re-summarization. It
319
- * lives in the item JSON, not a DB column, so it survives verbatim replay.
297
+ * Marker stored on the synthetic summary item so the UI can render it and the
298
+ * next rebuild can exclude old summaries from the retained user-message set.
320
299
  */
321
300
  declare const COMPACTION_SUMMARY_MARKER = "opengeni_context_summary";
322
- /**
323
- * Bridge text prepended to the summary body in the synthetic user message. It
324
- * tells the model the preceding conversation was compacted and that durable
325
- * facts live in the notebook — so it treats the summary as a working-memory
326
- * pointer, not the whole truth.
327
- */
328
- declare const SUMMARY_PREFIX: string;
301
+ declare const SUMMARY_BUFFER_TOKENS = 20000;
302
+ declare const COMPACT_USER_MESSAGE_MAX_TOKENS = 20000;
303
+ declare const CLIENT_COMPACTION_TRIGGER_FRACTION = 0.9;
304
+ declare const COMPACTION_PROMPT: string;
305
+ 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:";
306
+ declare const USER_MESSAGE_TRUNCATION_MARKER = "\n[... middle truncated for context compaction ...]\n";
329
307
  /** A user-authored `message` item is the only legal turn boundary. */
330
308
  declare function isUserMessage(item: unknown): boolean;
331
309
  /** True for our synthetic compaction summary item. */
332
310
  declare function isCompactionSummary(item: unknown): boolean;
333
311
  /**
334
- * Rough token estimate for an item: char/4 over its serialized text. Used only
335
- * for the tail-budget walk; the trigger decision uses the real last-turn input
336
- * token count, falling back to this when that is unavailable.
312
+ * Rough token estimate for an item: char/4 over its serialized text. Used for
313
+ * the pre-first-call fallback, per-user-message cap, and read-path airbag.
337
314
  */
338
315
  declare function estimateItemTokens(item: CompactionItem): number;
339
316
  declare function estimateTokens(items: readonly CompactionItem[]): number;
317
+ declare function clientCompactionThresholdTokens(input: {
318
+ contextWindowTokens: number;
319
+ contextReservedOutputTokens: number;
320
+ }): number;
321
+ type ClientCompactionDecision = {
322
+ shouldCompact: boolean;
323
+ reason: "force" | "above_threshold" | "below_threshold" | "no_history";
324
+ signalTokens: number;
325
+ thresholdTokens: number;
326
+ };
327
+ declare function decideClientCompaction(input: {
328
+ items: readonly CompactionItem[];
329
+ lastInputTokens?: number | null;
330
+ contextWindowTokens: number;
331
+ contextReservedOutputTokens: number;
332
+ force?: boolean;
333
+ }): ClientCompactionDecision;
334
+ declare class CompactionNeededError extends Error {
335
+ readonly signalTokens: number;
336
+ readonly thresholdTokens: number;
337
+ readonly signalSource: "provider" | "estimate";
338
+ constructor(input: {
339
+ signalTokens: number;
340
+ thresholdTokens: number;
341
+ signalSource: "provider" | "estimate";
342
+ });
343
+ }
344
+ declare function findCompactionNeededError(error: unknown, seen?: WeakSet<object>): CompactionNeededError | null;
340
345
  /**
341
346
  * Walk backwards from the end of `items` keeping whole turns until the kept
342
347
  * tail would exceed `keepRecentTokens`, and return the index of the first kept
343
- * item. The returned index is always the start of a user message (a clean turn
344
- * boundary), so the prefix [0, index) never splits a tool-call pair.
345
- *
346
- * Returns `items.length` when nothing fits within the budget yet a boundary is
347
- * required (degenerate); callers treat an index of 0 or length as "no useful
348
- * cut".
348
+ * item. Retained for the read-path budget guard only; the client compaction
349
+ * rebuild no longer uses a keep-recent tail.
349
350
  */
350
351
  declare function findKeepBoundary(items: readonly CompactionItem[], keepRecentTokens: number): number;
351
352
  /**
352
353
  * READ-PATH BUDGET GUARD (last-resort backstop).
353
354
  *
354
- * Pre-turn compaction is best-effort: it can no-op (summarizer model call
355
- * fails, "client" mode off, a fresh user message arrives after a turn already
356
- * ballooned the history) and STILL leave an assembled input that exceeds the
357
- * model context window. The #61 orphan sanitizer is purely structural — it has
358
- * NO size awareness — so without this guard an over-budget input is sent and
359
- * 400s every turn, re-bricking the session.
360
- *
361
- * `enforceInputBudget` drops the OLDEST history at a clean turn boundary until
362
- * the estimated input fits `maxTokens`, ALWAYS keeping the most recent turn(s).
363
- * It is orphan-safe by construction: it only ever cuts at the start of a user
364
- * message (via `findKeepBoundary`), so no tool-call pair is split. It is a
365
- * crude data-loss fallback (no summary is generated) that exists solely so a
366
- * single over-budget assembled input is never put on the wire — real context
367
- * preservation is the summarizing pre-turn path; this is the airbag.
368
- *
369
- * Pure: returns a new array (same item references, in order) with an oldest
370
- * prefix omitted, or the input unchanged when it already fits. The provided
371
- * `trailingTokens` accounts for the un-stored part of the assembled input (the
372
- * new user/continuation message + fixed system/tool overhead) so the cap is
373
- * measured against the WHOLE request, not just the stored history.
355
+ * Drops the oldest history at a clean user-message boundary until an assembled
356
+ * input fits the request budget. This remains a request-local safety rail; it
357
+ * is not the compaction strategy.
374
358
  */
375
359
  declare function enforceInputBudget<T extends CompactionItem>(items: readonly T[], maxTokens: number, trailingTokens?: number): {
376
360
  items: T[];
@@ -378,111 +362,35 @@ declare function enforceInputBudget<T extends CompactionItem>(items: readonly T[
378
362
  droppedCount: number;
379
363
  estimatedTokens: number;
380
364
  };
381
- type CompactionPlan = {
382
- /** Whether a compaction should run this turn. */
383
- shouldCompact: boolean;
384
- /** Why not, when shouldCompact is false (for logs/tests). */
385
- reason: "below_threshold" | "no_boundary" | "nothing_to_summarize" | "compact";
386
- /**
387
- * The signal-token count the trigger decision was made on:
388
- * max(actual last-turn input tokens, char/4 estimate of the active items).
389
- * Recorded for logging / metrics and so a caller can reason about pressure.
390
- */
391
- signalTokens: number;
392
- /**
393
- * True when the signal reached hardFraction*B — the session is at/over the
394
- * hard ceiling and compaction was forced even if the recorded last-turn count
395
- * was stale-low. The boundary walk is run with a SHRUNK keep-recent budget in
396
- * this case so an over-budget history always yields a non-empty prefix to
397
- * summarize (the everything-is-"recent" deadlock can't strand it un-compacted).
398
- */
399
- hardForced: boolean;
400
- /** Index (into the active items) where the kept tail begins. */
401
- boundaryIndex: number;
402
- /**
403
- * The prefix items to summarize: active[0, boundaryIndex), EXCLUDING any
404
- * prior compaction summary (which is folded forward via `priorSummaryItem`).
405
- */
406
- prefixItems: CompactionItem[];
407
- /** The prior live summary item folded into this compaction, if any. */
408
- priorSummaryItem: CompactionItem | null;
409
- /** Items kept verbatim: active[boundaryIndex, end). */
410
- tailItems: CompactionItem[];
411
- };
412
- type PlanCompactionInput = {
413
- /** Active history items in position order (already excludes superseded rows). */
414
- items: readonly CompactionItem[];
415
- /**
416
- * Actual input tokens reported for the last model call of the previous turn.
417
- * Null/undefined falls back to a char/4 estimate over `items`.
418
- */
419
- lastInputTokens?: number | null;
420
- /** Usable input budget B = window - reserved output. */
421
- inputBudgetTokens: number;
422
- softFraction: number;
423
- hardFraction: number;
424
- keepRecentTokens: number;
425
- /**
426
- * Operator-forced compaction (the /compact command): bypass the soft-limit
427
- * token trigger and compact now if there is anything to summarize. The
428
- * boundary / nothing-to-summarize guards still apply — force never invents a
429
- * cut that would orphan a tool-call pair or summarize an empty prefix.
430
- */
431
- force?: boolean;
432
- };
433
- /**
434
- * Decide whether and where to compact. Pure.
435
- *
436
- * Trigger: signal tokens >= softFraction*B (soft) or hardFraction*B (hard).
437
- * Signal = MAX(actual last-turn input tokens, char/4 estimate of the active
438
- * items). The max — not "trust the recorded count, estimate only when it's
439
- * null" — is the self-heal fix: `sessions.last_input_tokens` is written ONLY
440
- * when a model response reports usage, so a turn that OVERFLOWS on its first
441
- * model call records NOTHING and the column keeps a STALE-POSITIVE value from
442
- * the last good turn (e.g. ~600k). Trusting that stale-low number let an
443
- * actually-over-budget history (>1.05M) slip under the soft limit and overflow
444
- * again, re-bricking with no self-heal. Taking the max means a bloated history
445
- * triggers compaction regardless of a stale recorded count.
446
- *
447
- * Hard force (hardFraction*B): at/over the hard ceiling we compact even if the
448
- * recorded count was stale-low, AND we run the boundary walk with a shrunk
449
- * keep-recent budget so an over-budget history always yields a non-empty prefix
450
- * — otherwise a history where the whole thing reads as "recent" (tail within
451
- * keepRecentTokens) would find no prefix and strand the session over budget.
452
- *
453
- * Boundary: the earliest user-message boundary whose kept tail fits the
454
- * (possibly shrunk) keep-recent budget. The prefix before it (minus any prior
455
- * summary, which is folded forward) is what gets summarized.
456
- */
457
- declare function planCompaction(input: PlanCompactionInput): CompactionPlan;
458
- /** Extract the plain-text body of the prior summary item, if any. */
459
- declare function compactionSummaryText(item: CompactionItem | null): string;
460
- /**
461
- * Build the synthetic summary item (a plain user message) to insert at the
462
- * boundary. `summaryBody` is the model-generated working-memory bridge.
463
- */
464
- declare function buildSummaryItem(summaryBody: string): CompactionItem;
465
365
  /**
466
- * Instruction prompt for the summarizer model call. Leans on OpenGeni's durable
467
- * structured memory (the notebook) so the summary stays a light working-memory
468
- * bridge, never a place secret values get copied.
366
+ * The exact checkpoint input shape: current active history followed by Codex's
367
+ * checkpoint prompt as a synthesized user message.
469
368
  */
470
- declare const SUMMARY_INSTRUCTIONS: string;
369
+ declare function buildCompactionPromptInput(items: readonly CompactionItem[]): CompactionItem[];
471
370
  /**
472
- * Render the prefix items into a transcript the summarizer reads. Keeps it
473
- * bounded by truncating individual items; the model call itself is what
474
- * produces the compact result.
371
+ * Build the active history after compaction:
372
+ * all real user messages (prior summaries excluded, images removed, each
373
+ * message capped) plus one marked summary item.
475
374
  */
476
- declare function renderPrefixTranscript(items: readonly CompactionItem[], priorSummaryText: string): string;
375
+ declare function buildCompactionReplacementHistory(items: readonly CompactionItem[], summaryBody: string): CompactionItem[];
477
376
  /**
478
- * The summarizer model call payload: a system instruction plus the rendered
479
- * prefix transcript. The caller turns this into a single model request (no
480
- * tools, no streaming) and feeds the text result into `buildSummaryItem`.
377
+ * Build the synthetic summary item (a plain user message) appended to the
378
+ * rebuilt active history.
481
379
  */
482
- declare function buildCompactionMessages(plan: CompactionPlan): {
483
- system: string;
484
- user: string;
380
+ declare function buildSummaryItem(summaryBody: string): CompactionItem;
381
+ declare function renderCompactionPromptInputForChat(input: readonly CompactionItem[]): string;
382
+
383
+ declare const SCREENSHOT_OMITTED_PLACEHOLDER = "[screenshot omitted: an older desktop frame \u2014 the full image remains in the session event log]";
384
+ type ElideStaleScreenshotsResult<T> = {
385
+ items: T[];
386
+ imageCount: number;
387
+ elidedCount: number;
485
388
  };
389
+ type ElideStaleScreenshotsOptions = {
390
+ keepLast?: number;
391
+ placeholder?: string;
392
+ };
393
+ declare function elideStaleScreenshotImages<T extends AgentInputItem>(items: readonly T[], options?: ElideStaleScreenshotsOptions): ElideStaleScreenshotsResult<T>;
486
394
 
487
395
  type NormalizedRuntimeEvent = {
488
396
  type: SessionEventType;
@@ -613,10 +521,10 @@ declare class CodexSubscriptionUnavailableError extends Error {
613
521
  declare function configureOpenAI(settings: Settings): void;
614
522
  /**
615
523
  * Run the compaction summarizer as one plain, tool-less, non-streaming model
616
- * call against the resolved provider. `system`/`user` come from
617
- * buildCompactionMessages. Returns the trimmed summary text, or null on any
524
+ * call against the resolved provider. `input` is the active history plus
525
+ * Codex's checkpoint prompt. Returns the trimmed summary text, or null on any
618
526
  * failure (the caller treats a failed summarize as "skip compaction this turn"
619
- * never fatal). The call deliberately does NOT request reasoning encryption,
527
+ * - never fatal). The call deliberately does NOT request reasoning encryption,
620
528
  * tools, or server-side compaction; it is a self-contained summarize.
621
529
  *
622
530
  * Provider-aware: the summary always runs on the SAME provider that serves the
@@ -628,10 +536,7 @@ declare function configureOpenAI(settings: Settings): void;
628
536
  * legacy global-client callers are byte-for-byte unchanged. store:false is set
629
537
  * only on the OpenAI-platform Responses path (Azure rejects it; chat ignores it).
630
538
  */
631
- declare function summarizeForCompaction(settings: Settings, messages: {
632
- system: string;
633
- user: string;
634
- }, options?: {
539
+ declare function summarizeForCompaction(settings: Settings, input: Array<Record<string, unknown>>, options?: {
635
540
  client?: OpenAI;
636
541
  api?: ModelProviderApi;
637
542
  maxOutputTokens?: number;
@@ -773,6 +678,7 @@ type RunAgentStreamOptions = {
773
678
  sandboxClient?: unknown;
774
679
  sandboxEnvironment?: Record<string, string>;
775
680
  onRuntimeEvent?: (event: NormalizedRuntimeEvent) => Promise<void> | void;
681
+ contextCompactionSignalTokens?: () => number | null | undefined;
776
682
  ownedSandbox?: {
777
683
  client: unknown;
778
684
  session: unknown;
@@ -781,6 +687,10 @@ type RunAgentStreamOptions = {
781
687
  };
782
688
  callModelInputFilter?: CallModelInputFilter;
783
689
  };
690
+ type ContextRobustnessFilterOptions = {
691
+ contextCompactionSignalTokens?: () => number | null | undefined;
692
+ throwOnCompactionNeeded?: boolean;
693
+ };
784
694
  declare const GENESIS_TITLE_DIRECTIVE = "This is the first turn of a new session. Before responding to the user, call the opengeni__set_session_title tool with a concise 3-7 word title that summarizes what this session is about, then address the user's request normally.";
785
695
  /**
786
696
  * callModelInputFilter that removes provider-assigned item ids (rs_/msg_/fc_…)
@@ -811,13 +721,15 @@ declare const stripProviderItemIdsFilter: CallModelInputFilter;
811
721
  * never mutated.
812
722
  */
813
723
  declare const normalizeComputerCallsFilter: CallModelInputFilter;
724
+ declare function contextRobustnessFilterForSettings(settings: Settings, options?: ContextRobustnessFilterOptions): CallModelInputFilter;
814
725
  /**
815
726
  * The model-input filter applied before every model call. The computer_call
816
727
  * action/actions normalizer is ALWAYS on (the Azure endpoint 400s without it);
817
728
  * the provider-item-id strip is layered on top when the configured policy
818
- * selects it.
729
+ * selects it; the context-robustness guard then elides stale screenshots on
730
+ * every mode and applies hard budget trimming only on the client-compaction path.
819
731
  */
820
- declare function callModelInputFilterForSettings(settings: Settings): CallModelInputFilter | undefined;
732
+ declare function callModelInputFilterForSettings(settings: Settings, options?: ContextRobustnessFilterOptions): CallModelInputFilter | undefined;
821
733
  declare function runAgentStream(agent: Agent<any, any>, input: PreparedAgentInput | string | RunState<any, any>, settings: Settings, overrides?: RunAgentStreamOptions): Promise<_openai_agents.StreamedRunResult<any, Agent<any, any>>>;
822
734
 
823
735
  /**
@@ -933,4 +845,4 @@ declare function azureOpenAIDefaultQuery(settings: Pick<Settings, "azureOpenaiAp
933
845
  */
934
846
  declare function lazySkillSourceWithPackSkills(packSkills: PackSkill[]): LocalDirLazySkillSource;
935
847
 
936
- export { type AgentSegmentInput, type BuildAgentOptions, COMPACTION_SUMMARY_MARKER, CodexSubscriptionUnavailableError, type CompactionItem, type CompactionPlan, ComputerActionError, ComputerReadOnlyError, type ComputerToolMode, ComputerUnavailableError, type ComputerUseArgs, ComputerUseCapability, GENESIS_TITLE_DIRECTIVE, type HistoryItem, type ModelResponseUsage, MultiProviderModelProvider, type NormalizedRuntimeEvent, type OpenGeniRuntime, type PackSkill, type PackSkillFile, type PlanCompactionInput, type PrepareInputOptions, type PrepareToolsOptions, type PreparedAgentInput, type PreparedAgentTools, type ProductionRuntimeOverrides, type RunAgentStreamOptions, SUMMARY_INSTRUCTIONS, SUMMARY_PREFIX, SandboxComputer, type SandboxComputerOptions, type SandboxFileDownload, type SandboxLifecycleHook, type SandboxLifecycleHookContext, type SandboxLifecycleHookPhase, type WorkspaceEnvironmentContext, agentsErrorRunState, applyMissingManifestEntries, azureCliLoginCommand, azureOpenAIDefaultQuery, buildAgentCapabilities, buildCompactionMessages, buildManifest, buildModelInstance, buildOpenAIClientFromSettings, buildOpenGeniAgent, buildProviderClient, buildSummaryItem, callModelInputFilterForSettings, compactionSummaryText, composeAgentInstructions, computerUse, configureOpenAI, coreInstructions, createProductionAgentRuntime, enforceInputBudget, ensureReadableStreamFrom, estimateItemTokens, estimateTokens, extractResponseOutputText, findKeepBoundary, isCompactionSummary, isUserMessage, lazySkillSourceWithPackSkills, materializeSandboxFileDownloads, maxTurnsExceededRunState, modelResponseUsageFromSdkEvent, neutralizeToolSearchItemsInSerializedRunState, normalizeComputerCallsFilter, normalizeSdkEvent, normalizeToolOutputForEvent, planCompaction, prefixedMcpToolName, prepareAgentTools, prepareRunInput, renderPrefixTranscript, repositoryCloneCommand, repositoryUsesSandboxClone, resolveTurnModel, runAgentStream, runAzureCliLoginHook, runBeforeAgentStartHooks, runRepositoryCloneHook, sandboxCommandExitCode, sandboxCommandOutput, sandboxCommandStillRunning, sandboxFileDownloadsForAgent, sandboxLifecycleHooksForIds, sandboxRunAs, sanitizeHistoryItemsForModel, serializeApprovals, stripProviderItemIdsFilter, stripReasoningEncryptedContent, stripReasoningIdentityFromSerializedRunState, summarizeForCompaction, withManifestRefreshOnResume, withSandboxFileDownloads, withSandboxLifecycleHooks, workspaceEnvironmentInstructions };
848
+ export { type AgentSegmentInput, type BuildAgentOptions, CLIENT_COMPACTION_TRIGGER_FRACTION, COMPACTION_PROMPT, COMPACTION_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, type ClientCompactionDecision, CodexSubscriptionUnavailableError, type CompactionItem, CompactionNeededError, ComputerActionError, ComputerReadOnlyError, type ComputerToolMode, ComputerUnavailableError, type ComputerUseArgs, ComputerUseCapability, type ContextRobustnessFilterOptions, type ElideStaleScreenshotsOptions, type ElideStaleScreenshotsResult, GENESIS_TITLE_DIRECTIVE, type HistoryItem, type ModelResponseUsage, MultiProviderModelProvider, type NormalizedRuntimeEvent, type OpenGeniRuntime, type PackSkill, type PackSkillFile, type PrepareInputOptions, type PrepareToolsOptions, type PreparedAgentInput, type PreparedAgentTools, type ProductionRuntimeOverrides, type RunAgentStreamOptions, SCREENSHOT_OMITTED_PLACEHOLDER, SUMMARY_BUFFER_TOKENS, SUMMARY_PREFIX, SandboxComputer, type SandboxComputerOptions, type SandboxFileDownload, type SandboxLifecycleHook, type SandboxLifecycleHookContext, type SandboxLifecycleHookPhase, USER_MESSAGE_TRUNCATION_MARKER, type WorkspaceEnvironmentContext, agentsErrorRunState, applyMissingManifestEntries, azureCliLoginCommand, azureOpenAIDefaultQuery, buildAgentCapabilities, buildCompactionPromptInput, buildCompactionReplacementHistory, buildManifest, buildModelInstance, buildOpenAIClientFromSettings, buildOpenGeniAgent, buildProviderClient, buildSummaryItem, callModelInputFilterForSettings, clientCompactionThresholdTokens, composeAgentInstructions, computerUse, configureOpenAI, contextRobustnessFilterForSettings, coreInstructions, createProductionAgentRuntime, decideClientCompaction, elideStaleScreenshotImages, enforceInputBudget, ensureReadableStreamFrom, estimateItemTokens, estimateTokens, extractResponseOutputText, findCompactionNeededError, findKeepBoundary, isCompactionSummary, isUserMessage, lazySkillSourceWithPackSkills, materializeSandboxFileDownloads, maxTurnsExceededRunState, modelResponseUsageFromSdkEvent, neutralizeToolSearchItemsInSerializedRunState, normalizeComputerCallsFilter, normalizeSdkEvent, normalizeToolOutputForEvent, prefixedMcpToolName, prepareAgentTools, prepareRunInput, renderCompactionPromptInputForChat, repositoryCloneCommand, repositoryUsesSandboxClone, resolveTurnModel, runAgentStream, runAzureCliLoginHook, runBeforeAgentStartHooks, runRepositoryCloneHook, sandboxCommandExitCode, sandboxCommandOutput, sandboxCommandStillRunning, sandboxFileDownloadsForAgent, sandboxLifecycleHooksForIds, sandboxRunAs, sanitizeHistoryItemsForModel, serializeApprovals, stripProviderItemIdsFilter, stripReasoningEncryptedContent, stripReasoningIdentityFromSerializedRunState, summarizeForCompaction, withManifestRefreshOnResume, withSandboxFileDownloads, withSandboxLifecycleHooks, workspaceEnvironmentInstructions };