@opengeni/worker-bundle 0.16.21 → 0.17.2

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 (180) hide show
  1. package/dist/activities/agent-turn.d.ts +145 -32
  2. package/dist/activities/api-integrations.d.ts +21 -0
  3. package/dist/activities/codemode-dispatcher.d.ts +35 -0
  4. package/dist/activities/codemode-token-renewal.d.ts +23 -0
  5. package/dist/activities/codex-capacity.d.ts +5 -5
  6. package/dist/activities/codex-image-generation.d.ts +21 -0
  7. package/dist/activities/context-compaction.d.ts +3 -0
  8. package/dist/activities/documents.d.ts +3 -2
  9. package/dist/activities/environment.d.ts +11 -7
  10. package/dist/activities/expiring-material-renewal.d.ts +5 -3
  11. package/dist/activities/file-upload-reaper.d.ts +7 -2
  12. package/dist/activities/gateway-image-generation.d.ts +39 -0
  13. package/dist/activities/gateway-video-generation.d.ts +53 -0
  14. package/dist/activities/generated-images.d.ts +112 -0
  15. package/dist/activities/git-credential-renewal.d.ts +2 -2
  16. package/dist/activities/goals.d.ts +2 -2
  17. package/dist/activities/google-drive-changes.d.ts +99 -0
  18. package/dist/activities/image-generation-operation.d.ts +74 -0
  19. package/dist/activities/image-generation-references.d.ts +25 -0
  20. package/dist/activities/knowledge-source-sync-driver.d.ts +23 -0
  21. package/dist/activities/knowledge-source-sync.d.ts +75 -0
  22. package/dist/activities/packs.d.ts +13 -26
  23. package/dist/activities/parent-wake.d.ts +1 -1
  24. package/dist/activities/retained-screenshot-reaper.d.ts +32 -0
  25. package/dist/activities/retained-screenshots.d.ts +129 -0
  26. package/dist/activities/rig-verification.d.ts +82 -5
  27. package/dist/activities/run-credential-renewal.d.ts +2 -2
  28. package/dist/activities/run-input.d.ts +5 -1
  29. package/dist/activities/sandbox-images.d.ts +14 -0
  30. package/dist/activities/sandbox-lease.d.ts +47 -9
  31. package/dist/activities/scheduled-tasks.d.ts +2 -2
  32. package/dist/activities/session-state.d.ts +4 -4
  33. package/dist/activities/streaming.d.ts +1 -1
  34. package/dist/activities/types.d.ts +71 -5
  35. package/dist/activities/video-generation-admission.d.ts +38 -0
  36. package/dist/activities/video-generation-credential.d.ts +7 -0
  37. package/dist/activities/video-generation-reconciliation.d.ts +13 -0
  38. package/dist/activities/video-media-validation.d.ts +34 -0
  39. package/dist/activities/video-output-retention.d.ts +36 -0
  40. package/dist/activities/video-reference-staging.d.ts +49 -0
  41. package/dist/activities/workflow-wake.d.ts +2 -2
  42. package/dist/activities/workspace-capture.d.ts +11 -1
  43. package/dist/activities-control-44KBWLSM.js +6885 -0
  44. package/dist/activities-control-44KBWLSM.js.map +1 -0
  45. package/dist/activities-control.d.ts +289 -0
  46. package/dist/activities-turn-K4CEDEGJ.js +14675 -0
  47. package/dist/activities-turn-K4CEDEGJ.js.map +1 -0
  48. package/dist/activities-turn.d.ts +17 -0
  49. package/dist/activities.d.ts +130 -147
  50. package/dist/activity-services.d.ts +10 -0
  51. package/dist/artifact-materializer-entry.d.ts +6 -0
  52. package/dist/artifact-materializer-entry.js +2662 -0
  53. package/dist/artifact-materializer-entry.js.map +1 -0
  54. package/dist/artifact-outbox-entry.d.ts +2 -0
  55. package/dist/artifact-outbox-entry.js +681 -0
  56. package/dist/artifact-outbox-entry.js.map +1 -0
  57. package/dist/chunk-E3RI3I33.js +828 -0
  58. package/dist/chunk-E3RI3I33.js.map +1 -0
  59. package/dist/chunk-GRFQTTSQ.js +448 -0
  60. package/dist/chunk-GRFQTTSQ.js.map +1 -0
  61. package/dist/chunk-KKCRGAGZ.js +3091 -0
  62. package/dist/chunk-KKCRGAGZ.js.map +1 -0
  63. package/dist/{chunk-BJUW5LCM.js → chunk-RAMNYSAW.js} +15 -12
  64. package/dist/chunk-RAMNYSAW.js.map +1 -0
  65. package/dist/concurrency.d.ts +108 -5
  66. package/dist/editable-artifact-hint-broker.d.ts +49 -0
  67. package/dist/editable-artifact-materializer-launcher.d.ts +49 -0
  68. package/dist/editable-artifact-materializer-service.d.ts +108 -0
  69. package/dist/editable-artifact-materializer-storage.d.ts +12 -0
  70. package/dist/editable-artifact-materializer-subprocess.d.ts +50 -0
  71. package/dist/editable-artifact-materializer.d.ts +262 -0
  72. package/dist/editable-artifact-outbox-dispatcher.d.ts +44 -0
  73. package/dist/editable-artifact-outbox-service.d.ts +70 -0
  74. package/dist/host-export.d.ts +1 -1
  75. package/dist/host-export.js +1 -1
  76. package/dist/index.d.ts +176 -10
  77. package/dist/index.js +675 -16460
  78. package/dist/index.js.map +1 -1
  79. package/dist/memory-pressure-guard.d.ts +57 -0
  80. package/dist/model-checkpoint-memory-collector.d.ts +22 -0
  81. package/dist/observability-metrics.d.ts +33 -0
  82. package/dist/sandbox-reaper-contract.d.ts +40 -0
  83. package/dist/sandbox-reaper-timeout.d.ts +14 -0
  84. package/dist/sandbox-resume.d.ts +40 -7
  85. package/dist/sandbox-routing.d.ts +13 -6
  86. package/dist/worker-service-lifecycle.d.ts +6 -2
  87. package/dist/workflow-bundle.js +1044 -363
  88. package/dist/workflows/activities.d.ts +7 -1
  89. package/dist/workflows/document-index.d.ts +1 -1
  90. package/dist/workflows/knowledge-source-sync.d.ts +13 -0
  91. package/dist/workflows/rig-verification.d.ts +1 -1
  92. package/dist/workflows/sandbox-reaper.d.ts +8 -0
  93. package/dist/workflows/scheduled-tasks.d.ts +1 -1
  94. package/dist/workflows/session.d.ts +2 -2
  95. package/dist/workflows/video-generation.d.ts +10 -0
  96. package/dist/workflows/workflow-wake.d.ts +1 -1
  97. package/dist/workflows.d.ts +9 -7
  98. package/package.json +34 -15
  99. package/src/activities/agent-turn.ts +1905 -559
  100. package/src/activities/api-integrations.ts +138 -0
  101. package/src/activities/codemode-dispatcher.ts +335 -0
  102. package/src/activities/codemode-token-renewal.ts +64 -0
  103. package/src/activities/codex-capacity.ts +16 -7
  104. package/src/activities/codex-image-generation.ts +56 -0
  105. package/src/activities/codex-rotation.ts +19 -5
  106. package/src/activities/context-compaction.ts +47 -6
  107. package/src/activities/documents.ts +14 -4
  108. package/src/activities/environment.ts +52 -60
  109. package/src/activities/expiring-material-renewal.ts +16 -7
  110. package/src/activities/file-upload-reaper.ts +34 -3
  111. package/src/activities/gateway-image-generation.ts +146 -0
  112. package/src/activities/gateway-video-generation.ts +298 -0
  113. package/src/activities/generated-images.ts +860 -0
  114. package/src/activities/git-credential-renewal.ts +3 -3
  115. package/src/activities/goals.ts +6 -2
  116. package/src/activities/google-drive-changes.ts +454 -0
  117. package/src/activities/image-generation-operation.ts +333 -0
  118. package/src/activities/image-generation-references.ts +118 -0
  119. package/src/activities/knowledge-source-sync-driver.ts +27 -0
  120. package/src/activities/knowledge-source-sync.ts +2840 -0
  121. package/src/activities/mcp-credentials.ts +1 -0
  122. package/src/activities/packs.ts +55 -55
  123. package/src/activities/recording.ts +4 -5
  124. package/src/activities/retained-screenshot-reaper.ts +202 -0
  125. package/src/activities/retained-screenshots.ts +1317 -0
  126. package/src/activities/rig-verification.ts +567 -77
  127. package/src/activities/run-credential-renewal.ts +9 -2
  128. package/src/activities/run-input.ts +40 -10
  129. package/src/activities/sandbox-images.ts +167 -0
  130. package/src/activities/sandbox-lease.ts +1065 -483
  131. package/src/activities/scheduled-tasks.ts +96 -7
  132. package/src/activities/session-state.ts +4 -4
  133. package/src/activities/streaming.ts +42 -3
  134. package/src/activities/types.ts +87 -5
  135. package/src/activities/video-generation-admission.ts +270 -0
  136. package/src/activities/video-generation-credential.ts +34 -0
  137. package/src/activities/video-generation-reconciliation.ts +578 -0
  138. package/src/activities/video-media-validation.ts +326 -0
  139. package/src/activities/video-output-retention.ts +314 -0
  140. package/src/activities/video-reference-staging.ts +263 -0
  141. package/src/activities/workflow-wake.ts +2 -2
  142. package/src/activities/workspace-capture.ts +77 -13
  143. package/src/activities-control.ts +54 -0
  144. package/src/activities-turn.ts +40 -0
  145. package/src/activities.ts +50 -118
  146. package/src/activity-services.ts +62 -0
  147. package/src/artifact-materializer-entry.ts +35 -0
  148. package/src/artifact-outbox-entry.ts +29 -0
  149. package/src/concurrency.ts +484 -6
  150. package/src/editable-artifact-hint-broker.ts +235 -0
  151. package/src/editable-artifact-materializer-launcher.ts +515 -0
  152. package/src/editable-artifact-materializer-service.ts +787 -0
  153. package/src/editable-artifact-materializer-storage.ts +413 -0
  154. package/src/editable-artifact-materializer-subprocess.ts +956 -0
  155. package/src/editable-artifact-materializer.ts +1289 -0
  156. package/src/editable-artifact-outbox-dispatcher.ts +244 -0
  157. package/src/editable-artifact-outbox-service.ts +438 -0
  158. package/src/host-export-pump.ts +28 -11
  159. package/src/http.ts +3 -6
  160. package/src/index.ts +277 -72
  161. package/src/memory-pressure-guard.ts +489 -0
  162. package/src/model-checkpoint-memory-collector.ts +116 -0
  163. package/src/observability-metrics.ts +202 -7
  164. package/src/sandbox-reaper-contract.ts +73 -0
  165. package/src/sandbox-reaper-timeout.ts +79 -0
  166. package/src/sandbox-resume.ts +331 -157
  167. package/src/sandbox-routing.ts +49 -39
  168. package/src/worker-service-lifecycle.ts +82 -12
  169. package/src/workflows/activities.ts +30 -0
  170. package/src/workflows/file-upload-reaper.ts +6 -1
  171. package/src/workflows/knowledge-source-sync.ts +83 -0
  172. package/src/workflows/sandbox-reaper.ts +183 -21
  173. package/src/workflows/scheduled-tasks.ts +42 -6
  174. package/src/workflows/video-generation.ts +36 -0
  175. package/src/workflows.ts +17 -1
  176. package/dist/activities/redaction.d.ts +0 -1
  177. package/dist/activities/toolspace-token-renewal.d.ts +0 -23
  178. package/dist/chunk-BJUW5LCM.js.map +0 -1
  179. package/src/activities/redaction.ts +0 -9
  180. package/src/activities/toolspace-token-renewal.ts +0 -57
@@ -1,17 +1,20 @@
1
- import { type AppendEventInput, type ActiveSandboxPointer, type SandboxRecord } from "@opengeni/db";
2
- import { modelResponseServiceTierFromSdkEvent, modelTerminalResponseFromSdkEvent, type SandboxFileDownload, type ComputerToolMode, type ModelResponseUsage, type ModelCallUsageInput, type ModelCallUsageNormalization, type RunAgentStreamOptions, type TurnToolCancellationFence, type BackendUnresolvableCode } from "@opengeni/runtime";
1
+ import { type AppendEventInput, type ActiveSandboxPointer, type SandboxRecord, type SessionAttemptQuiescenceCommit } from "@opengeni/db";
2
+ import { modelResponseServiceTierFromSdkEvent, modelTerminalResponseFromSdkEvent, type SandboxFileDownload, type ComputerToolMode, type ModelResponseUsage, type ModelCallUsageInput, type ModelCallUsageNormalization, type TurnToolCancellationFence, type BackendUnresolvableCode, type LazyToolTransport } from "@opengeni/runtime";
3
3
  import { resolveTurnExecutionPolicyV1, type ModelUsageInput, type ModelProviderApi, type RegistryProviderKind, type Settings } from "@opengeni/config";
4
4
  import { ApplicationFailure, CancelledFailure } from "@temporalio/activity";
5
5
  import type { CodexAccountStatus } from "@opengeni/db";
6
- import { type GitCredentialRenewalController } from "./git-credential-renewal";
7
- import { type RunCredentialRenewalController } from "./run-credential-renewal";
8
- import { type ToolspaceTokenRenewalController } from "./toolspace-token-renewal";
9
- import { type SecretForRedaction } from "./redaction";
10
- import { type ModelAttachmentInputPolicy } from "./run-input";
11
- import type { ActivityServices, EscapedMcpTimeoutRecoveryDetail, RunAgentTurnInput, RunAgentTurnResult, SessionAttemptQuiescenceProof } from "./types";
12
- import { type TurnSandboxLeaseHolderId } from "../sandbox-resume";
6
+ import { type GitCredentialRenewalController } from "./git-credential-renewal.js";
7
+ import { type RunCredentialRenewalController } from "./run-credential-renewal.js";
8
+ import { type CodemodeTokenRenewalController } from "./codemode-token-renewal.js";
9
+ import { type ModelAttachmentInputPolicy } from "./run-input.js";
10
+ import type { TurnActivityServices as ActivityServices, EscapedMcpTimeoutRecoveryDetail, RunAgentTurnInput, RunAgentTurnResult, SessionAttemptQuiescenceProof } from "./types.js";
11
+ import { type ResumedTurnSandbox, type TurnSandboxLeaseHolderId } from "../sandbox-resume.js";
13
12
  import { type LatencyMode, type SessionEvent, type SessionEventType, type SessionTurn, type ToolAuthNeededPayload, type TurnExecutionPolicyV1 } from "@opengeni/contracts";
14
13
  export declare const PROVIDER_BACKPRESSURE_DELAY_MS = 60000;
14
+ export declare class WorkspaceHumanInputDisabledError extends Error {
15
+ constructor(kind: "resume" | "interruption");
16
+ }
17
+ export declare function assertWorkspaceHumanInputAllowed(enabled: boolean, kind: "resume" | "interruption", attempted: boolean): void;
15
18
  /** Broad personal lookup is allowed only for a direct human/API command. */
16
19
  export declare function credentialSubjectIdForTurnInitiator(turn: Pick<SessionTurn, "source" | "initiator" | "initiatorContext">): string | undefined;
17
20
  /**
@@ -130,12 +133,14 @@ export declare function assertSessionAttemptQuiescenceRecoveryDurable(input: {
130
133
  * state. The proof object never changes between attempts. */
131
134
  export declare function persistOrSignalSessionAttemptQuiescence(input: {
132
135
  proof: SessionAttemptQuiescenceProof;
133
- persistReceipt: () => Promise<SessionEvent[]>;
136
+ persistReceipt: () => Promise<SessionAttemptQuiescenceCommit>;
137
+ deliverWorkflowWake?: (wake: NonNullable<SessionAttemptQuiescenceCommit["workflowWake"]>) => Promise<unknown>;
134
138
  publishEvents: (events: SessionEvent[]) => Promise<unknown>;
135
139
  signalProof: ActivityServices["signalSessionAttemptQuiesced"];
136
140
  sleep?: (ms: number) => Promise<void>;
137
141
  heartbeat?: (attempt: number, delayMs: number) => void;
138
142
  onReceiptFailure?: (error: unknown) => void;
143
+ onWakeFailure?: (error: unknown) => void;
139
144
  onPublishFailure?: (error: unknown) => void;
140
145
  onSignalFailure?: (error: unknown, attempt: number, delayMs: number) => void;
141
146
  }): Promise<"receipt" | "signal">;
@@ -150,9 +155,19 @@ export declare function drainAttemptOwnedSandboxWriters(input: {
150
155
  toolCancellationFence: Pick<TurnToolCancellationFence, "cancel" | "waitForQuiescence"> | null;
151
156
  cancellationReason?: unknown;
152
157
  gitCredentialRenewals: readonly Pick<GitCredentialRenewalController, "stop">[];
153
- toolspaceTokenRenewal: Pick<ToolspaceTokenRenewalController, "stop"> | null;
158
+ codemodeTokenRenewal: Pick<CodemodeTokenRenewalController, "stop"> | null;
154
159
  runCredentialRenewal: Pick<RunCredentialRenewalController, "stop"> | null;
155
160
  }): Promise<void>;
161
+ /** Persist the exact turn's second-stage release only after the caller has
162
+ * crossed the physical writer boundary. This wait is intentionally independent
163
+ * of Temporal cancellation: it is a short idempotent DB transaction that closes
164
+ * the durable archive-capture fence. Bounded retries cover a rollout connection
165
+ * reset without turning ordinary finalizer housekeeping into lifecycle state. */
166
+ export declare function releaseTurnSandboxAfterWriterDrain(sandbox: Pick<ResumedTurnSandbox, "release">, options?: {
167
+ maxAttempts?: number;
168
+ retryDelayMs?: number;
169
+ wait?: (delayMs: number) => Promise<void>;
170
+ }): Promise<void>;
156
171
  /**
157
172
  * Await a finalizer operation only while this Temporal activity still owns its
158
173
  * execution window. Once Pause/Steer cancellation arrives, the operation keeps
@@ -168,19 +183,47 @@ export declare function waitForTurnFinalizerStep<T>(operation: Promise<T>, signa
168
183
  * may pin the activity behind cancellation after durable writes are fenced.
169
184
  */
170
185
  export declare function waitForTurnStreamCleanup(batcherFlush: Promise<unknown>, providerCompleted: Promise<unknown>, signal: AbortSignal | undefined): Promise<void>;
186
+ /**
187
+ * Terminal settlement closes the active attempt before turn finalization. The
188
+ * ordinary workspace admission therefore correctly returns `attempt_fenced`
189
+ * for the final attempt-qualified credential deletion. Retry only that exact
190
+ * settled-attempt case directly; every other fence/status and the direct
191
+ * deletion itself remain fail-closed.
192
+ */
193
+ export declare function clearAttemptCredentialsWithSettledFence(input: {
194
+ activityStatus: RunAgentTurnResult["status"] | "unknown";
195
+ runWorkspaceFencedClear: () => Promise<void>;
196
+ clearExactAttempt: () => Promise<void>;
197
+ onSettledAttemptFence: () => void;
198
+ }): Promise<void>;
199
+ export type MandatoryHistoryPersistenceStage = "history_append" | "sandbox_envelope";
200
+ /**
201
+ * Preserve the exact storage failure for the permission-controlled turn event
202
+ * while attaching only a stable, non-secret operation token to public worker
203
+ * diagnostics. Mandatory history failures remain terminal and never inherit a
204
+ * provider-retry classification from coincidental source text or status.
205
+ */
206
+ export declare class MandatoryHistoryPersistenceError extends Error {
207
+ readonly stage: MandatoryHistoryPersistenceStage;
208
+ readonly name = "MandatoryHistoryPersistenceError";
209
+ readonly cause: unknown;
210
+ constructor(stage: MandatoryHistoryPersistenceStage, cause: unknown);
211
+ }
212
+ export declare function runMandatoryHistoryPersistenceStep<T>(stage: MandatoryHistoryPersistenceStage, operation: () => Promise<T>): Promise<T>;
171
213
  export type SafeErrorDiagnostic = {
172
- name: string;
173
- message: string;
214
+ errorClass: "WorkerOperationError";
215
+ errorCode: "worker_operation_failed";
174
216
  status?: number;
175
- code?: string;
217
+ origin: "worker";
218
+ historyPersistenceStage?: MandatoryHistoryPersistenceStage;
176
219
  };
177
220
  /**
178
221
  * Produce the only exception shape allowed in worker logs. It deliberately
179
- * excludes stack, cause, response/request bodies, and arbitrary enumerable
180
- * properties while retaining bounded, redacted diagnostics.
222
+ * excludes the arbitrary source message, stack, cause, response/request
223
+ * bodies, and enumerable properties. Exact failure content belongs in the
224
+ * permission-controlled session event, not stdout or telemetry.
181
225
  */
182
- export declare function safeErrorDiagnostic(error: unknown, redactText?: (value: string) => string): SafeErrorDiagnostic;
183
- export declare function headerSecretRedactions(prefix: string, headers: Readonly<Record<string, string>> | undefined, credentialHeaderNames?: Iterable<string>): SecretForRedaction[];
226
+ export declare function safeErrorDiagnostic(error: unknown): SafeErrorDiagnostic;
184
227
  export declare function shouldRecoverCompactionProviderFailure(error: unknown): boolean;
185
228
  export declare function classifyContextWindowOverflowError(error: unknown): {
186
229
  message: string;
@@ -215,14 +258,14 @@ export declare function classifyMcpTransportTimeoutError(error: unknown): {
215
258
  * an earlier slice — the orphaned tool output that 400s the Responses API and
216
259
  * bricks the session on every replay.
217
260
  *
218
- * Defending: sanitize the full current history into an API-valid sequence (the
261
+ * Defending: structurally repair the full current history into an API-valid sequence (the
219
262
  * same pure rules the read path uses), then append only the new tail beyond the
220
263
  * watermark. A trailing dangling call is dropped here and re-evaluated next
221
264
  * pass once its result lands, so a call and its result are written together at
222
265
  * consecutive positions and a result is never persisted without its call. The
223
- * watermark advances to the sanitized length — never past anything unwritten —
266
+ * watermark advances to the repaired length — never past anything unwritten —
224
267
  * so a non-monotonic history can never desync it. When previously-persisted
225
- * rows already exceed the sanitized length (e.g. legacy orphans written before
268
+ * rows already exceed the repaired length (e.g. legacy orphans written before
226
269
  * this fix), nothing new is appended and the watermark holds steady.
227
270
  */
228
271
  /**
@@ -408,7 +451,7 @@ export declare function emitModelCallUsage(input: {
408
451
  * owns idempotency; this helper must never receive raw provider values.
409
452
  */
410
453
  export declare function applyCodexCacheTelemetry(observability: ActivityServices["observability"], provider: string, normalizedUsage: ModelCallUsageNormalization): void;
411
- export declare function historyRowsToAppend(rawHistory: Array<Record<string, unknown>>, persistedHistoryCount: number, nextPosition?: number, toolOutputTruncationTokens?: number, redactValue?: (value: unknown) => unknown): {
454
+ export declare function historyRowsToAppend(rawHistory: Array<Record<string, unknown>>, persistedHistoryCount: number, nextPosition?: number, toolOutputTruncationTokens?: number): {
412
455
  rows: Array<{
413
456
  position: number;
414
457
  item: Record<string, unknown>;
@@ -426,7 +469,7 @@ export declare function selectRejectedProviderArtifactHistoryIds(activeHistory:
426
469
  historyItemIds: readonly string[];
427
470
  }, wireFingerprints: readonly string[]): string[];
428
471
  /** Literal final per-call boundary for replayed and current-turn model input. */
429
- export declare function secretRedactionModelInputFilter(redactValue: (value: unknown) => unknown): NonNullable<RunAgentStreamOptions["callModelInputFilter"]>;
472
+ export declare function isModelOrToolProgressHistoryItem(item: Record<string, unknown>): boolean;
430
473
  /**
431
474
  * Resolve the EFFECTIVE/active compute backend a turn should gate
432
475
  * filesystem-touching agent lifecycle hooks on (today: the repository clone).
@@ -521,6 +564,24 @@ export declare function reconcileActiveSandboxPointer(db: ActivityServices["db"]
521
564
  * `fromTag` path.
522
565
  */
523
566
  export declare function ensureTurnModalRegistryImage(runSettings: Settings, sandboxCreationBackend: Settings["sandboxBackend"] | undefined, ensureRegistryImage?: (settings: Settings) => Promise<void>): Promise<void>;
567
+ export type SandboxArtifactRuntimeAdmission = Readonly<{
568
+ available: boolean;
569
+ environment: Readonly<Record<string, string>>;
570
+ }>;
571
+ /**
572
+ * Admit the optional native standalone-file runtime only for the deployment's
573
+ * exact base sandbox image contract. A pack/rig image override is an
574
+ * independent filesystem and therefore fails closed even when the deployment
575
+ * base image is capable. Collaborative artifact skills are admitted separately
576
+ * from the frozen canonical tool catalog.
577
+ *
578
+ * This keeps lazy provisioning intact: CI/release proves the image closure,
579
+ * while a before-agent-start doctor verifies the actual box before any model
580
+ * call. No speculative sandbox is created merely to populate the skill index.
581
+ */
582
+ export declare function sandboxArtifactRuntimeAdmission(deploymentSettings: Settings, runSettings: Settings, backend: Settings["sandboxBackend"] | undefined, options?: Readonly<{
583
+ production?: boolean;
584
+ }>): SandboxArtifactRuntimeAdmission;
524
585
  /**
525
586
  * Decide whether the first actual computer action may start a proof recording.
526
587
  *
@@ -592,6 +653,21 @@ export declare function structuredToolTransportForTurn(resolvedModel: {
592
653
  kind: RegistryProviderKind;
593
654
  };
594
655
  } | null): boolean;
656
+ /**
657
+ * Progressive tool disclosure is universal for supported OpenGeni turns; only
658
+ * its contained transport differs. Codex keeps its native path, built-in direct
659
+ * OpenAI/Azure Responses use native client tool search, and every other ordinary
660
+ * function-calling provider uses OpenGeni's stable search/invoke dispatcher.
661
+ */
662
+ export declare function lazyToolTransportForTurn(resolvedModel: {
663
+ provider: {
664
+ id: string;
665
+ kind: RegistryProviderKind;
666
+ api: ModelProviderApi;
667
+ builtin: boolean;
668
+ baseUrl?: string | undefined;
669
+ };
670
+ } | null): LazyToolTransport;
595
671
  /**
596
672
  * Native web search is a runtime capability, not part of the session's MCP
597
673
  * allow-list. Attach it whenever the resolved provider advertises runnable
@@ -604,6 +680,27 @@ export declare function hostedWebSearchForTurn(resolvedModel: {
604
680
  hostedWebSearch: boolean;
605
681
  };
606
682
  } | null, deploymentWebSearchEnabled: boolean): boolean;
683
+ /** Direct OpenAI hosted image IDs are reusable only by the exact API credential. */
684
+ export declare function openAiHostedImageProviderBindingForTurn(settings: Pick<Settings, "openaiProvider" | "openaiApiKey" | "openaiBaseUrl">, resolvedModel: {
685
+ provider: {
686
+ id: string;
687
+ kind: RegistryProviderKind;
688
+ builtin: boolean;
689
+ baseUrl?: string | undefined;
690
+ };
691
+ configured: {
692
+ capabilities: {
693
+ hostedTools: {
694
+ imageGeneration: {
695
+ runnable: boolean;
696
+ };
697
+ };
698
+ };
699
+ };
700
+ } | null): {
701
+ providerId: string;
702
+ providerBindingHash: string;
703
+ } | null;
607
704
  /** Exact model-catalog modality gate; null preserves the legacy built-in path. */
608
705
  export declare function modelSupportsImageInputForTurn(resolvedModel: {
609
706
  configured: {
@@ -651,15 +748,10 @@ export declare class SandboxDeadlineRotationError extends Error {
651
748
  export declare function turnOperationCancellationFailure(error: unknown): CancelledFailure | null;
652
749
  export declare function waitForTurnOperation<T>(operation: Promise<T>, signal: AbortSignal | undefined, disposeLateResult: ((result: T) => Promise<void> | void) | undefined): Promise<T>;
653
750
  export declare function isLazySandboxProvisionRetryable(error: unknown): boolean;
654
- /**
655
- * Deadline recovery cannot re-admit the same turn until the global reaper has
656
- * observed the released holder, captured the final archive, terminated the old
657
- * provider box, and committed the lease cold. Give that full sequence one
658
- * snapshot budget plus two schedule periods. This is workflow-visible pacing,
659
- * not an in-memory sleep, so Pause/Steer/new user intent can still wake the
660
- * durable session immediately.
661
- */
662
- export declare function sandboxDeadlineRotationRecoveryDelayMs(settings: Pick<Settings, "sandboxLeaseReaperPeriodMs" | "sandboxSnapshotTimeoutMs">): number;
751
+ /** Short workflow-visible anti-churn pacing after a lifecycle transition. The
752
+ * next acquire waits on the exact durable claim itself, so this is deliberately
753
+ * not a guessed snapshot-plus-schedules completion time. */
754
+ export declare function sandboxDeadlineRotationRecoveryDelayMs(settings: Pick<Settings, "sandboxLeaseReaperPeriodMs">): number;
663
755
  export declare function createTurnSandboxProvisioner<T>(establish: () => Promise<T>, options?: {
664
756
  maxRetries?: number;
665
757
  backoffMs?: number;
@@ -694,6 +786,11 @@ export declare function acceptsPromptCacheKeyForTurn(resolvedModel: {
694
786
  * leased; callers check this before accepting an in-flight heartbeat promise.
695
787
  */
696
788
  export declare function codexCredentialLeaseDeadlineExpired(confirmedUntilMs: number | null, nowMs?: number): boolean;
789
+ type OpStreamFinalizer = {
790
+ finalizeOpStreamOps(): Promise<void>;
791
+ };
792
+ /** Release retained Connected Machine output only after the turn is durable. */
793
+ export declare function finalizeDurableTurnOpStreams(sessions: readonly unknown[], fallback: OpStreamFinalizer | null): Promise<void>;
697
794
  export declare function createRunAgentTurnActivity(services: () => Promise<ActivityServices>): (input: RunAgentTurnInput) => Promise<RunAgentTurnResult>;
698
795
  export declare function isTransientProviderError(error: unknown): boolean;
699
796
  export declare function agentRunFailurePayload(error: unknown, options?: {
@@ -712,6 +809,7 @@ export declare function agentRunFailurePayload(error: unknown, options?: {
712
809
  attempts?: number;
713
810
  retryOutcome?: string;
714
811
  database?: Record<string, string>;
812
+ historyPersistenceStage?: MandatoryHistoryPersistenceStage;
715
813
  };
716
814
  export type CodexCredentialFailure = {
717
815
  kind: "auth" | "forbidden" | "rate_limit" | "quota";
@@ -750,11 +848,26 @@ export declare function codexUsageLimitFailurePayload(info: {
750
848
  retryable: boolean;
751
849
  detail?: string;
752
850
  };
851
+ export declare function pendingToolCallFromSdkEvent(event: unknown): {
852
+ callId: string;
853
+ callType: string;
854
+ callName: string | null;
855
+ callItem: Record<string, unknown>;
856
+ } | null;
857
+ /** Tools whose intentional visual result must survive inline-media sanitization. */
858
+ export declare function toolCallProducesRetainableSessionImage(name: string | null): boolean;
859
+ export declare function completedToolCallFromSdkEvent(event: unknown): {
860
+ callId: string;
861
+ resultItem: Record<string, unknown>;
862
+ } | null;
753
863
  export declare function ensureRunAllowed(settings: Settings, db: ActivityServices["db"], accountId: string, workspaceId: string, isExternallyBilledTurn: boolean, entitlements?: ActivityServices["entitlements"]): Promise<void>;
754
864
  export type ModelUsageBillingRecord = {
755
865
  billingPath: "opengeni_credits" | "external";
756
866
  /** Same quantity written to usage_events.model.cost when present; else 0. */
757
867
  pricedCostMicros: number;
868
+ /** Hypothetical provider-rate USD micros; never an OpenGeni charge. */
869
+ estimatedProviderCostMicros: number | null;
870
+ pricingSource: "configured_list_price" | "gateway_reported" | null;
758
871
  normalizedUsage: ModelCallUsageNormalization;
759
872
  upstreamProvider?: string;
760
873
  };
@@ -0,0 +1,21 @@
1
+ import { type IntegrationInvocationAuthority } from "@opengeni/capabilities";
2
+ import type { Settings } from "@opengeni/config";
3
+ import type { ToolAuthNeededPayload } from "@opengeni/contracts";
4
+ import type { ApiIntegrationRuntime, ResolveConnectionCredentialInput, ResolveConnectionCredentialResult } from "@opengeni/db";
5
+ import type { LocalMcpServerRegistration } from "@opengeni/runtime";
6
+ import type { FetchLike } from "@opengeni/network";
7
+ export type BuildApiIntegrationServersInput = {
8
+ settings: Settings;
9
+ integrations: readonly ApiIntegrationRuntime[];
10
+ authority: Omit<IntegrationInvocationAuthority, "connectionRef">;
11
+ resolveCredential: (input: ResolveConnectionCredentialInput) => Promise<ResolveConnectionCredentialResult>;
12
+ onAuthNeeded?: (payload: ToolAuthNeededPayload) => Promise<void> | void;
13
+ fetchImpl?: FetchLike;
14
+ };
15
+ /**
16
+ * Compile active persisted API facets into ordinary in-process MCP servers for
17
+ * one exact attempt. Connection resolution remains request-time, destination-
18
+ * bound, personal-delegation-fenced, and refreshable through the same worker
19
+ * resolver used by remote MCP servers.
20
+ */
21
+ export declare function buildApiIntegrationServersForTurn(input: BuildApiIntegrationServersInput): LocalMcpServerRegistration[];
@@ -0,0 +1,35 @@
1
+ import { type AttemptToolEnvironment } from "@opengeni/codemode";
2
+ import { type Database } from "@opengeni/db";
3
+ import { type EventBus } from "@opengeni/events";
4
+ export type CodemodeDispatcherScope = {
5
+ accountId: string;
6
+ workspaceId: string;
7
+ sessionId: string;
8
+ turnId: string;
9
+ attemptId: string;
10
+ executionGeneration: number;
11
+ };
12
+ /**
13
+ * Owns the only Codemode execution edge for one exact attempt. NATS carries a
14
+ * wake-up only; the durable row is claimed before any side effect and the call
15
+ * is executed by the same AttemptToolEnvironment already bound to model MCP.
16
+ */
17
+ export declare class CodemodeAttemptDispatcher {
18
+ private readonly db;
19
+ private readonly bus;
20
+ private readonly environment;
21
+ private readonly scope;
22
+ private readonly turnSignal?;
23
+ private readonly maxConcurrentCalls;
24
+ private readonly stopController;
25
+ private readonly inFlight;
26
+ private pendingClaims;
27
+ private unsubscribe;
28
+ private closing;
29
+ constructor(db: Database, bus: EventBus, environment: AttemptToolEnvironment, scope: CodemodeDispatcherScope, turnSignal?: AbortSignal | undefined, maxConcurrentCalls?: number);
30
+ start(): void;
31
+ close(reason?: string): Promise<void>;
32
+ private execute;
33
+ private settleWithOutput;
34
+ private failBeforeExecution;
35
+ }
@@ -0,0 +1,23 @@
1
+ import { type ExpiringMaterialRenewalController } from "./expiring-material-renewal.js";
2
+ import type { MintedSandboxCodemodeToken } from "./environment.js";
3
+ export declare const CODEMODE_TOKEN_DEFAULT_REFRESH_MS: number;
4
+ export declare const CODEMODE_TOKEN_EXPIRY_LEAD_MS: number;
5
+ export declare const CODEMODE_TOKEN_MIN_REFRESH_MS = 5000;
6
+ export declare const CODEMODE_TOKEN_MAX_RETRY_MS: number;
7
+ export type CodemodeTokenRenewalController = ExpiringMaterialRenewalController;
8
+ export type CodemodeTokenRenewalOptions = {
9
+ initialExpiresAt: Date;
10
+ mint: () => Promise<MintedSandboxCodemodeToken | undefined>;
11
+ write: (material: MintedSandboxCodemodeToken) => Promise<void>;
12
+ now?: () => number;
13
+ schedule?: (callback: () => void, delayMs: number) => unknown;
14
+ clearSchedule?: (timer: unknown) => void;
15
+ onSuccess?: (result: {
16
+ nextDelayMs: number;
17
+ }) => void;
18
+ onFailure?: (failure: {
19
+ retryDelayMs: number;
20
+ errorClass: "CodemodeTokenRenewalOperationError";
21
+ }) => void;
22
+ };
23
+ export declare function startCodemodeTokenRenewalLoop(options: CodemodeTokenRenewalOptions): CodemodeTokenRenewalController;
@@ -1,9 +1,9 @@
1
1
  import { reconcileCodexCapacityWait as reconcileCodexCapacityWaitDb, type CodexCapacityWakeTarget, type CodexCapacitySelectionContext } from "@opengeni/db";
2
2
  import type { Settings } from "@opengeni/config";
3
- import type { ActivityServices, GetCodexCapacityWaitInput, ReconcileCodexCapacityWaitInput, ReconcileCodexCapacityWaitResult } from "./types";
3
+ import type { ControlActivityServices, GetCodexCapacityWaitInput, ReconcileCodexCapacityWaitInput, ReconcileCodexCapacityWaitResult } from "./types.js";
4
4
  type CodexCapacitySignalServices = {
5
- signalCodexCapacityWorkflow?: NonNullable<ActivityServices["signalCodexCapacityWorkflow"]> | null | undefined;
6
- wakeSessionWorkflow: ActivityServices["wakeSessionWorkflow"];
5
+ signalCodexCapacityWorkflow?: NonNullable<ControlActivityServices["signalCodexCapacityWorkflow"]> | null | undefined;
6
+ wakeSessionWorkflow: ControlActivityServices["wakeSessionWorkflow"];
7
7
  };
8
8
  /**
9
9
  * Run a bounded set of usage refreshes, then repair every committed waiter
@@ -16,10 +16,10 @@ export declare function refreshCodexUsageAndRepairCapacityWaiters(refreshes: rea
16
16
  export declare function signalCodexCapacityWakeTargets(services: CodexCapacitySignalServices, targets: readonly CodexCapacityWakeTarget[]): Promise<void>;
17
17
  /** Repair a commit/signal crash edge by redelivering every pending revision. */
18
18
  export declare function signalPendingCodexCapacityWakeTargets(services: CodexCapacitySignalServices & {
19
- db: ActivityServices["db"];
19
+ db: ControlActivityServices["db"];
20
20
  }, workspaceId: string): Promise<void>;
21
21
  export declare function codexCapacityDecision(context: CodexCapacitySelectionContext, settings: Settings): ReturnType<Parameters<typeof reconcileCodexCapacityWaitDb>[2]>;
22
- export declare function createCodexCapacityActivities(services: () => Promise<ActivityServices>): {
22
+ export declare function createCodexCapacityActivities(services: () => Promise<ControlActivityServices>): {
23
23
  getCodexCapacityWait: (input: GetCodexCapacityWaitInput) => Promise<{
24
24
  waiterId: string;
25
25
  generation: number;
@@ -0,0 +1,21 @@
1
+ import { type CodexRequestContext } from "@opengeni/codex";
2
+ import type { Database } from "@opengeni/db";
3
+ import type { ObjectStorage } from "@opengeni/storage";
4
+ import type { GeneratedImageReceipt } from "./generated-images.js";
5
+ import type { ResolvedImageGenerationReference } from "./image-generation-references.js";
6
+ /** Execute the same standalone subscription image path used by Codex clients. */
7
+ export declare function executeCodexImageGeneration(input: {
8
+ db: Database;
9
+ objectStorage: ObjectStorage | null;
10
+ accountId: string;
11
+ workspaceId: string;
12
+ sessionId: string;
13
+ turnId: string;
14
+ attemptId: string;
15
+ toolCallId: string;
16
+ prompt: string;
17
+ references?: readonly ResolvedImageGenerationReference[];
18
+ credentialId: string;
19
+ codexContext: Pick<CodexRequestContext, "clientVersion" | "getToken" | "refresh">;
20
+ abortSignal?: AbortSignal;
21
+ }): Promise<GeneratedImageReceipt>;
@@ -54,6 +54,8 @@ export declare function maybeCompactContext(db: Database, settings: Settings, sc
54
54
  * append again — the event is already durable.
55
55
  */
56
56
  publishLiveEvents?: (events: SessionEvent[]) => Promise<void>;
57
+ /** Materialize retained screenshot receipts only in the attempt-local model view. */
58
+ materializeHistory?: (items: CompactionItem[]) => Promise<CompactionItem[]>;
57
59
  /** Turn-scoped attachment/modality view; canonical persisted rows stay untouched. */
58
60
  projectModelInput?: (items: CompactionItem[]) => Promise<CompactionItem[]>;
59
61
  }): Promise<MaybeCompactResult>;
@@ -77,3 +79,4 @@ export declare function settleFailedContextCompactionLandmark(db: Database, scop
77
79
  compacted: false;
78
80
  }>>;
79
81
  export declare function isContextWindowExceeded(error: unknown, seen?: WeakSet<object>): boolean;
82
+ export declare function isExactContextLengthExceeded(error: unknown, seen?: WeakSet<object>): boolean;
@@ -1,5 +1,6 @@
1
- import type { ActivityServices, IndexDocumentInput } from "./types";
2
- export declare function createDocumentActivities(services: () => Promise<ActivityServices>): {
1
+ import type { DocumentServices } from "@opengeni/documents";
2
+ import type { ControlActivityServices, IndexDocumentInput } from "./types.js";
3
+ export declare function createDocumentActivities(services: () => Promise<ControlActivityServices>, resolveDocumentServices?: () => Promise<DocumentServices>): {
3
4
  indexDocument: (input: IndexDocumentInput) => Promise<{
4
5
  id: string;
5
6
  workspaceId: string;
@@ -25,15 +25,18 @@ export type GitHubTokenMintAuthorization = (selection: {
25
25
  installationId: number;
26
26
  repositoryIds: number[];
27
27
  }) => Promise<void>;
28
- export declare const TOOLSPACE_TOKEN_TTL_SECONDS: number;
29
- export type MintedSandboxToolspaceToken = {
28
+ export declare const CODEMODE_TOKEN_TTL_SECONDS: number;
29
+ export type MintedSandboxCodemodeToken = {
30
30
  token: string;
31
31
  expiresAt: Date;
32
32
  };
33
- export type SandboxToolspaceAuthority = {
33
+ export type SandboxCodemodeAuthority = {
34
34
  sessionId: string;
35
+ turnId: string;
36
+ attemptId: string;
37
+ executionGeneration: number;
35
38
  };
36
- export declare function mintSandboxToolspaceToken(settings: Settings, scope: ConnectionScope, authority: SandboxToolspaceAuthority, nowMs?: number): Promise<MintedSandboxToolspaceToken | undefined>;
39
+ export declare function mintSandboxCodemodeToken(settings: Settings, scope: ConnectionScope, authority: SandboxCodemodeAuthority, nowMs?: number): Promise<MintedSandboxCodemodeToken | undefined>;
37
40
  export type GitCredentialAuthority = {
38
41
  sessionId: string;
39
42
  rootSessionId: string;
@@ -58,16 +61,17 @@ type RunGitCredentialOptions = {
58
61
  export declare function loadWorkspaceEnvironmentForRunWithCredentials(db: Database, settings: Settings, scope: ConnectionScope, environmentId: string | null, sandboxSecrets?: ConnectionCredentialsPort["sandboxSecrets"]): Promise<WorkspaceEnvironmentForRun | null>;
59
62
  export declare function sandboxEnvironmentForRun(settings: Settings, resources: ResourceRef[], workspaceEnvironment?: Record<string, string>, options?: RunGitCredentialOptions & {
60
63
  skipGitHubToken?: boolean;
64
+ skipCodemode?: boolean;
61
65
  deferGitHubToken?: boolean;
62
- toolspaceAuthority?: SandboxToolspaceAuthority;
66
+ codemodeAuthority?: SandboxCodemodeAuthority;
63
67
  }): Promise<{
64
68
  environment: Record<string, string>;
65
69
  gitToken?: string;
66
70
  gitTokens?: GitTokenSeeds;
67
71
  gitTokenExpiresAt?: GitTokenExpiries;
68
72
  gitCredentialBindings?: GitCredentialBindingSeed[];
69
- toolspaceToken?: string;
70
- toolspaceTokenExpiresAt?: Date;
73
+ codemodeToken?: string;
74
+ codemodeTokenExpiresAt?: Date;
71
75
  }>;
72
76
  export declare function mintRunGitCredentials(settings: Settings, resources: ResourceRef[], options?: RunGitCredentialOptions): Promise<MintedRunGitCredentials | undefined>;
73
77
  export declare function mintRunGitCredentialBinding(settings: Settings, resources: ResourceRef[], provider: GitCredentialProvider, credentialBindingId: string, options?: RunGitCredentialOptions): Promise<GitCredentialBindingSeed | undefined>;
@@ -9,11 +9,13 @@ export type ExpiringMaterialRenewalController = {
9
9
  refreshNow(): Promise<void>;
10
10
  stop(): Promise<void>;
11
11
  };
12
- export type ExpiringMaterialRenewalOptions<T> = {
12
+ export type ExpiringMaterialRenewalPublicErrorClass = "RunCredentialRenewalOperationError" | "CodemodeTokenRenewalOperationError";
13
+ export type ExpiringMaterialRenewalOptions<T, ErrorClass extends ExpiringMaterialRenewalPublicErrorClass> = {
13
14
  initialExpiresAt: Date | null;
14
15
  resolve: () => Promise<T>;
15
16
  write: (material: T) => Promise<void>;
16
17
  expiresAt: (material: T) => Date | null;
18
+ publicErrorClass: ErrorClass;
17
19
  policy: ExpiringMaterialRenewalPolicy;
18
20
  now?: () => number;
19
21
  schedule?: (callback: () => void, delayMs: number) => RenewalTimer;
@@ -24,7 +26,7 @@ export type ExpiringMaterialRenewalOptions<T> = {
24
26
  }) => void;
25
27
  onFailure?: (failure: {
26
28
  retryDelayMs: number;
27
- errorClass: string;
29
+ errorClass: ErrorClass;
28
30
  }) => void;
29
31
  };
30
32
  export declare function nextExpiringMaterialRenewalDelay(expiresAt: Date | null, policy: ExpiringMaterialRenewalPolicy, nowMs?: number): number;
@@ -34,5 +36,5 @@ export declare function nextExpiringMaterialRenewalDelay(expiresAt: Date | null,
34
36
  * A late resolver cannot write after stop. A physical sandbox write that already
35
37
  * started is drained so turn settlement cannot race a stale mutation.
36
38
  */
37
- export declare function startExpiringMaterialRenewalLoop<T>(options: ExpiringMaterialRenewalOptions<T>): ExpiringMaterialRenewalController;
39
+ export declare function startExpiringMaterialRenewalLoop<T, ErrorClass extends ExpiringMaterialRenewalPublicErrorClass>(options: ExpiringMaterialRenewalOptions<T, ErrorClass>): ExpiringMaterialRenewalController;
38
40
  export {};
@@ -1,6 +1,6 @@
1
1
  import { claimDueTranscriptionRecordingObjectCleanup, claimExpiredFileUploadCleanup, completeDueTranscriptionRecordingObjectCleanup, completeExpiredFileUploadCleanup, purgeExpiredTranscriptionRecordings } from "@opengeni/db";
2
2
  import type { ObjectStorage } from "@opengeni/storage";
3
- import type { ActivityServices } from "./types";
3
+ import type { ControlActivityServices } from "./types.js";
4
4
  export declare const FILE_UPLOAD_CLEANUP_GRACE_MS: number;
5
5
  export declare const FILE_UPLOAD_CLEANUP_CLAIM_TIMEOUT_MS: number;
6
6
  export declare const FILE_UPLOAD_CLEANUP_BATCH_SIZE = 100;
@@ -26,6 +26,11 @@ export type FileUploadReaperActivityOptions = {
26
26
  * and reclaimable; object deletion is idempotent; only a successful delete is
27
27
  * settled terminally. One provider failure never aborts the rest of the batch.
28
28
  */
29
- export declare function createFileUploadReaperActivities(services: () => Promise<ActivityServices>, options?: FileUploadReaperActivityOptions): {
29
+ export declare function createFileUploadReaperActivities(services: () => Promise<ControlActivityServices>, options?: FileUploadReaperActivityOptions): {
30
30
  reapExpiredFileUploads: () => Promise<ReapExpiredFileUploadsResult>;
31
+ recoverVideoGenerationWorkflows: () => Promise<{
32
+ claimed: number;
33
+ started: number;
34
+ failed: number;
35
+ }>;
31
36
  };
@@ -0,0 +1,39 @@
1
+ import type { Database } from "@opengeni/db";
2
+ import { type FetchLike } from "@opengeni/network";
3
+ import type { ObjectStorage } from "@opengeni/storage";
4
+ import { type GeneratedImageOutput, type GeneratedImageReceipt } from "./generated-images.js";
5
+ import type { ResolvedImageGenerationReference } from "./image-generation-references.js";
6
+ export declare class GatewayImageApiError extends Error {
7
+ readonly status: number;
8
+ constructor(status: number, message: string);
9
+ }
10
+ export declare function executeGatewayImageGeneration(input: {
11
+ db: Database;
12
+ objectStorage: ObjectStorage | null;
13
+ accountId: string;
14
+ workspaceId: string;
15
+ sessionId: string;
16
+ turnId: string;
17
+ attemptId: string;
18
+ apiKey: string;
19
+ modelId: string;
20
+ prompt: string;
21
+ references?: readonly ResolvedImageGenerationReference[];
22
+ toolCallId: string;
23
+ abortSignal?: AbortSignal;
24
+ }): Promise<GeneratedImageReceipt>;
25
+ /**
26
+ * One explicit Vercel AI Gateway image-protocol adapter. The caller owns durable
27
+ * operation admission; this function never retries an outcome-ambiguous paid
28
+ * request. The response is decoded directly from its JSON stream so neither
29
+ * the complete envelope nor its multi-megabyte base64 string enters memory.
30
+ */
31
+ export declare function generateGatewayImage(input: {
32
+ apiKey: string;
33
+ modelId: string;
34
+ prompt: string;
35
+ references?: readonly ResolvedImageGenerationReference[];
36
+ toolCallId: string;
37
+ abortSignal?: AbortSignal;
38
+ fetch?: FetchLike;
39
+ }): Promise<GeneratedImageOutput>;