@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.
- package/dist/activities/agent-turn.d.ts +145 -32
- package/dist/activities/api-integrations.d.ts +21 -0
- package/dist/activities/codemode-dispatcher.d.ts +35 -0
- package/dist/activities/codemode-token-renewal.d.ts +23 -0
- package/dist/activities/codex-capacity.d.ts +5 -5
- package/dist/activities/codex-image-generation.d.ts +21 -0
- package/dist/activities/context-compaction.d.ts +3 -0
- package/dist/activities/documents.d.ts +3 -2
- package/dist/activities/environment.d.ts +11 -7
- package/dist/activities/expiring-material-renewal.d.ts +5 -3
- package/dist/activities/file-upload-reaper.d.ts +7 -2
- package/dist/activities/gateway-image-generation.d.ts +39 -0
- package/dist/activities/gateway-video-generation.d.ts +53 -0
- package/dist/activities/generated-images.d.ts +112 -0
- package/dist/activities/git-credential-renewal.d.ts +2 -2
- package/dist/activities/goals.d.ts +2 -2
- package/dist/activities/google-drive-changes.d.ts +99 -0
- package/dist/activities/image-generation-operation.d.ts +74 -0
- package/dist/activities/image-generation-references.d.ts +25 -0
- package/dist/activities/knowledge-source-sync-driver.d.ts +23 -0
- package/dist/activities/knowledge-source-sync.d.ts +75 -0
- package/dist/activities/packs.d.ts +13 -26
- package/dist/activities/parent-wake.d.ts +1 -1
- package/dist/activities/retained-screenshot-reaper.d.ts +32 -0
- package/dist/activities/retained-screenshots.d.ts +129 -0
- package/dist/activities/rig-verification.d.ts +82 -5
- package/dist/activities/run-credential-renewal.d.ts +2 -2
- package/dist/activities/run-input.d.ts +5 -1
- package/dist/activities/sandbox-images.d.ts +14 -0
- package/dist/activities/sandbox-lease.d.ts +47 -9
- package/dist/activities/scheduled-tasks.d.ts +2 -2
- package/dist/activities/session-state.d.ts +4 -4
- package/dist/activities/streaming.d.ts +1 -1
- package/dist/activities/types.d.ts +71 -5
- package/dist/activities/video-generation-admission.d.ts +38 -0
- package/dist/activities/video-generation-credential.d.ts +7 -0
- package/dist/activities/video-generation-reconciliation.d.ts +13 -0
- package/dist/activities/video-media-validation.d.ts +34 -0
- package/dist/activities/video-output-retention.d.ts +36 -0
- package/dist/activities/video-reference-staging.d.ts +49 -0
- package/dist/activities/workflow-wake.d.ts +2 -2
- package/dist/activities/workspace-capture.d.ts +11 -1
- package/dist/activities-control-44KBWLSM.js +6885 -0
- package/dist/activities-control-44KBWLSM.js.map +1 -0
- package/dist/activities-control.d.ts +289 -0
- package/dist/activities-turn-K4CEDEGJ.js +14675 -0
- package/dist/activities-turn-K4CEDEGJ.js.map +1 -0
- package/dist/activities-turn.d.ts +17 -0
- package/dist/activities.d.ts +130 -147
- package/dist/activity-services.d.ts +10 -0
- package/dist/artifact-materializer-entry.d.ts +6 -0
- package/dist/artifact-materializer-entry.js +2662 -0
- package/dist/artifact-materializer-entry.js.map +1 -0
- package/dist/artifact-outbox-entry.d.ts +2 -0
- package/dist/artifact-outbox-entry.js +681 -0
- package/dist/artifact-outbox-entry.js.map +1 -0
- package/dist/chunk-E3RI3I33.js +828 -0
- package/dist/chunk-E3RI3I33.js.map +1 -0
- package/dist/chunk-GRFQTTSQ.js +448 -0
- package/dist/chunk-GRFQTTSQ.js.map +1 -0
- package/dist/chunk-KKCRGAGZ.js +3091 -0
- package/dist/chunk-KKCRGAGZ.js.map +1 -0
- package/dist/{chunk-BJUW5LCM.js → chunk-RAMNYSAW.js} +15 -12
- package/dist/chunk-RAMNYSAW.js.map +1 -0
- package/dist/concurrency.d.ts +108 -5
- package/dist/editable-artifact-hint-broker.d.ts +49 -0
- package/dist/editable-artifact-materializer-launcher.d.ts +49 -0
- package/dist/editable-artifact-materializer-service.d.ts +108 -0
- package/dist/editable-artifact-materializer-storage.d.ts +12 -0
- package/dist/editable-artifact-materializer-subprocess.d.ts +50 -0
- package/dist/editable-artifact-materializer.d.ts +262 -0
- package/dist/editable-artifact-outbox-dispatcher.d.ts +44 -0
- package/dist/editable-artifact-outbox-service.d.ts +70 -0
- package/dist/host-export.d.ts +1 -1
- package/dist/host-export.js +1 -1
- package/dist/index.d.ts +176 -10
- package/dist/index.js +675 -16460
- package/dist/index.js.map +1 -1
- package/dist/memory-pressure-guard.d.ts +57 -0
- package/dist/model-checkpoint-memory-collector.d.ts +22 -0
- package/dist/observability-metrics.d.ts +33 -0
- package/dist/sandbox-reaper-contract.d.ts +40 -0
- package/dist/sandbox-reaper-timeout.d.ts +14 -0
- package/dist/sandbox-resume.d.ts +40 -7
- package/dist/sandbox-routing.d.ts +13 -6
- package/dist/worker-service-lifecycle.d.ts +6 -2
- package/dist/workflow-bundle.js +1044 -363
- package/dist/workflows/activities.d.ts +7 -1
- package/dist/workflows/document-index.d.ts +1 -1
- package/dist/workflows/knowledge-source-sync.d.ts +13 -0
- package/dist/workflows/rig-verification.d.ts +1 -1
- package/dist/workflows/sandbox-reaper.d.ts +8 -0
- package/dist/workflows/scheduled-tasks.d.ts +1 -1
- package/dist/workflows/session.d.ts +2 -2
- package/dist/workflows/video-generation.d.ts +10 -0
- package/dist/workflows/workflow-wake.d.ts +1 -1
- package/dist/workflows.d.ts +9 -7
- package/package.json +34 -15
- package/src/activities/agent-turn.ts +1905 -559
- package/src/activities/api-integrations.ts +138 -0
- package/src/activities/codemode-dispatcher.ts +335 -0
- package/src/activities/codemode-token-renewal.ts +64 -0
- package/src/activities/codex-capacity.ts +16 -7
- package/src/activities/codex-image-generation.ts +56 -0
- package/src/activities/codex-rotation.ts +19 -5
- package/src/activities/context-compaction.ts +47 -6
- package/src/activities/documents.ts +14 -4
- package/src/activities/environment.ts +52 -60
- package/src/activities/expiring-material-renewal.ts +16 -7
- package/src/activities/file-upload-reaper.ts +34 -3
- package/src/activities/gateway-image-generation.ts +146 -0
- package/src/activities/gateway-video-generation.ts +298 -0
- package/src/activities/generated-images.ts +860 -0
- package/src/activities/git-credential-renewal.ts +3 -3
- package/src/activities/goals.ts +6 -2
- package/src/activities/google-drive-changes.ts +454 -0
- package/src/activities/image-generation-operation.ts +333 -0
- package/src/activities/image-generation-references.ts +118 -0
- package/src/activities/knowledge-source-sync-driver.ts +27 -0
- package/src/activities/knowledge-source-sync.ts +2840 -0
- package/src/activities/mcp-credentials.ts +1 -0
- package/src/activities/packs.ts +55 -55
- package/src/activities/recording.ts +4 -5
- package/src/activities/retained-screenshot-reaper.ts +202 -0
- package/src/activities/retained-screenshots.ts +1317 -0
- package/src/activities/rig-verification.ts +567 -77
- package/src/activities/run-credential-renewal.ts +9 -2
- package/src/activities/run-input.ts +40 -10
- package/src/activities/sandbox-images.ts +167 -0
- package/src/activities/sandbox-lease.ts +1065 -483
- package/src/activities/scheduled-tasks.ts +96 -7
- package/src/activities/session-state.ts +4 -4
- package/src/activities/streaming.ts +42 -3
- package/src/activities/types.ts +87 -5
- package/src/activities/video-generation-admission.ts +270 -0
- package/src/activities/video-generation-credential.ts +34 -0
- package/src/activities/video-generation-reconciliation.ts +578 -0
- package/src/activities/video-media-validation.ts +326 -0
- package/src/activities/video-output-retention.ts +314 -0
- package/src/activities/video-reference-staging.ts +263 -0
- package/src/activities/workflow-wake.ts +2 -2
- package/src/activities/workspace-capture.ts +77 -13
- package/src/activities-control.ts +54 -0
- package/src/activities-turn.ts +40 -0
- package/src/activities.ts +50 -118
- package/src/activity-services.ts +62 -0
- package/src/artifact-materializer-entry.ts +35 -0
- package/src/artifact-outbox-entry.ts +29 -0
- package/src/concurrency.ts +484 -6
- package/src/editable-artifact-hint-broker.ts +235 -0
- package/src/editable-artifact-materializer-launcher.ts +515 -0
- package/src/editable-artifact-materializer-service.ts +787 -0
- package/src/editable-artifact-materializer-storage.ts +413 -0
- package/src/editable-artifact-materializer-subprocess.ts +956 -0
- package/src/editable-artifact-materializer.ts +1289 -0
- package/src/editable-artifact-outbox-dispatcher.ts +244 -0
- package/src/editable-artifact-outbox-service.ts +438 -0
- package/src/host-export-pump.ts +28 -11
- package/src/http.ts +3 -6
- package/src/index.ts +277 -72
- package/src/memory-pressure-guard.ts +489 -0
- package/src/model-checkpoint-memory-collector.ts +116 -0
- package/src/observability-metrics.ts +202 -7
- package/src/sandbox-reaper-contract.ts +73 -0
- package/src/sandbox-reaper-timeout.ts +79 -0
- package/src/sandbox-resume.ts +331 -157
- package/src/sandbox-routing.ts +49 -39
- package/src/worker-service-lifecycle.ts +82 -12
- package/src/workflows/activities.ts +30 -0
- package/src/workflows/file-upload-reaper.ts +6 -1
- package/src/workflows/knowledge-source-sync.ts +83 -0
- package/src/workflows/sandbox-reaper.ts +183 -21
- package/src/workflows/scheduled-tasks.ts +42 -6
- package/src/workflows/video-generation.ts +36 -0
- package/src/workflows.ts +17 -1
- package/dist/activities/redaction.d.ts +0 -1
- package/dist/activities/toolspace-token-renewal.d.ts +0 -23
- package/dist/chunk-BJUW5LCM.js.map +0 -1
- package/src/activities/redaction.ts +0 -9
- 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
|
|
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
|
|
9
|
-
import { type
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
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<
|
|
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
|
-
|
|
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
|
-
|
|
173
|
-
|
|
214
|
+
errorClass: "WorkerOperationError";
|
|
215
|
+
errorCode: "worker_operation_failed";
|
|
174
216
|
status?: number;
|
|
175
|
-
|
|
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
|
|
180
|
-
* properties
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
656
|
-
*
|
|
657
|
-
|
|
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 {
|
|
3
|
+
import type { ControlActivityServices, GetCodexCapacityWaitInput, ReconcileCodexCapacityWaitInput, ReconcileCodexCapacityWaitResult } from "./types.js";
|
|
4
4
|
type CodexCapacitySignalServices = {
|
|
5
|
-
signalCodexCapacityWorkflow?: NonNullable<
|
|
6
|
-
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:
|
|
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<
|
|
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 {
|
|
2
|
-
|
|
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
|
|
29
|
-
export type
|
|
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
|
|
33
|
+
export type SandboxCodemodeAuthority = {
|
|
34
34
|
sessionId: string;
|
|
35
|
+
turnId: string;
|
|
36
|
+
attemptId: string;
|
|
37
|
+
executionGeneration: number;
|
|
35
38
|
};
|
|
36
|
-
export declare function
|
|
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
|
-
|
|
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
|
-
|
|
70
|
-
|
|
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
|
|
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:
|
|
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 {
|
|
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<
|
|
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>;
|