@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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CanonicalVideoGenerationRequest } from "@opengeni/core";
|
|
2
|
+
import { type FetchLike } from "@opengeni/network";
|
|
3
|
+
export declare const GATEWAY_VIDEO_PROVIDER_ID: "vercel-ai-gateway";
|
|
4
|
+
export declare const GATEWAY_VIDEO_START_URL: "https://ai-gateway.vercel.sh/v4/ai/video-model/start";
|
|
5
|
+
export declare const GATEWAY_VIDEO_STATUS_URL: "https://ai-gateway.vercel.sh/v4/ai/video-model/status";
|
|
6
|
+
export type GatewayVideoReferenceGrant = Readonly<{
|
|
7
|
+
role: "first_frame" | "last_frame" | "image_reference" | "video_reference";
|
|
8
|
+
url: string;
|
|
9
|
+
mediaType: string;
|
|
10
|
+
}>;
|
|
11
|
+
export type GatewayVideoStartResult = Readonly<{
|
|
12
|
+
providerJobId: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type GatewayVideoStatusResult = Readonly<{
|
|
15
|
+
status: "pending";
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
status: "completed";
|
|
18
|
+
outputUrl: string;
|
|
19
|
+
mediaType: string;
|
|
20
|
+
}> | Readonly<{
|
|
21
|
+
status: "error";
|
|
22
|
+
publicReason: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare class GatewayVideoApiError extends Error {
|
|
25
|
+
readonly status: number | null;
|
|
26
|
+
readonly retryable: boolean;
|
|
27
|
+
constructor(status: number | null, retryable: boolean, message: string);
|
|
28
|
+
}
|
|
29
|
+
export declare function startGatewayVideoGeneration(input: {
|
|
30
|
+
apiKey: string;
|
|
31
|
+
request: CanonicalVideoGenerationRequest;
|
|
32
|
+
idempotencyKey: string;
|
|
33
|
+
referenceGrants: readonly GatewayVideoReferenceGrant[];
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
fetch?: FetchLike;
|
|
36
|
+
}): Promise<GatewayVideoStartResult>;
|
|
37
|
+
/** Replay entrypoint for the encrypted, byte-stable provider request. */
|
|
38
|
+
export declare function startGatewayVideoGenerationWithBody(input: {
|
|
39
|
+
apiKey: string;
|
|
40
|
+
modelId: string;
|
|
41
|
+
body: Record<string, unknown>;
|
|
42
|
+
idempotencyKey: string;
|
|
43
|
+
signal?: AbortSignal;
|
|
44
|
+
fetch?: FetchLike;
|
|
45
|
+
}): Promise<GatewayVideoStartResult>;
|
|
46
|
+
export declare function getGatewayVideoGenerationStatus(input: {
|
|
47
|
+
apiKey: string;
|
|
48
|
+
modelId: string;
|
|
49
|
+
providerJobId: string;
|
|
50
|
+
signal?: AbortSignal;
|
|
51
|
+
fetch?: FetchLike;
|
|
52
|
+
}): Promise<GatewayVideoStatusResult>;
|
|
53
|
+
export declare function buildGatewayVideoStartBody(request: CanonicalVideoGenerationRequest, referenceGrants: readonly GatewayVideoReferenceGrant[]): Record<string, unknown>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { type GeneratedImageReceipt } from "@opengeni/contracts";
|
|
2
|
+
import { type Database, type GeneratedImageArtifact, type GeneratedImageSourceStrategy } from "@opengeni/db";
|
|
3
|
+
import type { ObjectStorage } from "@opengeni/storage";
|
|
4
|
+
export type GeneratedImageMediaType = "image/png" | "image/jpeg" | "image/webp";
|
|
5
|
+
export type ValidatedGeneratedImage = {
|
|
6
|
+
bytes: Uint8Array;
|
|
7
|
+
mediaType: GeneratedImageMediaType;
|
|
8
|
+
extension: "png" | "jpg" | "webp";
|
|
9
|
+
sizeBytes: number;
|
|
10
|
+
sha256: string;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
export type GeneratedImageOutput = {
|
|
15
|
+
toolCallId: string;
|
|
16
|
+
providerItemId: string | null;
|
|
17
|
+
bytes: Uint8Array;
|
|
18
|
+
declaredMediaType?: string;
|
|
19
|
+
};
|
|
20
|
+
export type { GeneratedImageReceipt };
|
|
21
|
+
export type RetainedGeneratedImage = {
|
|
22
|
+
receipt: GeneratedImageReceipt;
|
|
23
|
+
artifact: GeneratedImageArtifact;
|
|
24
|
+
};
|
|
25
|
+
export declare class GeneratedImageValidationError extends Error {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
/** Extract the completed Responses hosted-tool payload before JSON serialization. */
|
|
29
|
+
export declare function generatedImageFromSdkEvent(event: unknown): GeneratedImageOutput | null;
|
|
30
|
+
/** Classify the native terminal item independently from its current payload shape. */
|
|
31
|
+
export declare function isCompletedGeneratedImageSdkEvent(event: unknown): boolean;
|
|
32
|
+
export declare function generatedImagesFromHistory(history: ReadonlyArray<Record<string, unknown>>, retainedProviderItems?: Pick<ReadonlyMap<string, unknown>, "has">): GeneratedImageOutput[];
|
|
33
|
+
/** Refuse to serialize a completed native item unless its bytes have a receipt. */
|
|
34
|
+
export declare function assertGeneratedImageHistoryRetained(history: ReadonlyArray<Record<string, unknown>>, receiptsByProviderItemId: Pick<ReadonlyMap<string, unknown>, "has">): void;
|
|
35
|
+
export declare function decodeGeneratedImageBase64(value: string): Uint8Array;
|
|
36
|
+
/** Validate signatures and dimensions; never trust provider-declared MIME metadata. */
|
|
37
|
+
export declare function validateGeneratedImage(input: {
|
|
38
|
+
bytes: Uint8Array;
|
|
39
|
+
declaredMediaType?: string;
|
|
40
|
+
}): ValidatedGeneratedImage;
|
|
41
|
+
type GeneratedImageIdentityInput = {
|
|
42
|
+
workspaceId: string;
|
|
43
|
+
sessionId: string;
|
|
44
|
+
turnId: string;
|
|
45
|
+
providerId: string;
|
|
46
|
+
providerBindingHash: string;
|
|
47
|
+
toolCallId: string;
|
|
48
|
+
} & ({
|
|
49
|
+
sourceStrategy: "native_hosted";
|
|
50
|
+
providerItemId: string;
|
|
51
|
+
} | {
|
|
52
|
+
sourceStrategy: "provider_adapter";
|
|
53
|
+
providerItemId: null;
|
|
54
|
+
});
|
|
55
|
+
export declare function generatedImageIdentity(input: GeneratedImageIdentityInput): {
|
|
56
|
+
artifactId: string;
|
|
57
|
+
uploadId: string;
|
|
58
|
+
settlementKey: string;
|
|
59
|
+
};
|
|
60
|
+
export declare function retainGeneratedImage(input: {
|
|
61
|
+
db: Database;
|
|
62
|
+
objectStorage: ObjectStorage | null;
|
|
63
|
+
accountId: string;
|
|
64
|
+
workspaceId: string;
|
|
65
|
+
sessionId: string;
|
|
66
|
+
turnId: string;
|
|
67
|
+
attemptId: string;
|
|
68
|
+
sourceStrategy: GeneratedImageSourceStrategy;
|
|
69
|
+
providerId: string;
|
|
70
|
+
providerBindingHash: string;
|
|
71
|
+
output: GeneratedImageOutput;
|
|
72
|
+
now?: Date;
|
|
73
|
+
}): Promise<RetainedGeneratedImage>;
|
|
74
|
+
/** Replace provider bytes before they can enter event/history serialization. */
|
|
75
|
+
export declare function compactGeneratedImageHistory(history: Array<Record<string, unknown>>, receiptsByProviderItemId: ReadonlyMap<string, GeneratedImageReceipt>): Array<Record<string, unknown>>;
|
|
76
|
+
export declare function compactGeneratedImageSdkEvent(event: unknown, receipt: GeneratedImageReceipt): unknown;
|
|
77
|
+
export declare function collectGeneratedImageReceipts(history: ReadonlyArray<Record<string, unknown>>, target?: Map<string, GeneratedImageReceipt>): Map<string, GeneratedImageReceipt>;
|
|
78
|
+
export declare function collectGeneratedImageArtifactReceipts(history: ReadonlyArray<Record<string, unknown>>, target?: Map<string, GeneratedImageReceipt>): Map<string, GeneratedImageReceipt>;
|
|
79
|
+
/**
|
|
80
|
+
* Project native image calls to one provider-neutral, cache-stable model fact.
|
|
81
|
+
* The canonical hosted-tool item remains available to the UI, but its provider
|
|
82
|
+
* id and compact receipt are never replayed as a counterfeit native result.
|
|
83
|
+
*/
|
|
84
|
+
export declare function projectGeneratedImageHistoryForModel(history: Array<Record<string, unknown>>): Array<Record<string, unknown>>;
|
|
85
|
+
/**
|
|
86
|
+
* Build the attempt-local RunState view consumed by the Agents SDK on resume.
|
|
87
|
+
*
|
|
88
|
+
* OpenAI serializes a hosted image call from `providerData.result`, not from
|
|
89
|
+
* the SDK item's generic `output`. Our durable state deliberately replaces
|
|
90
|
+
* those bytes with a compact receipt, so replaying the hosted item would send
|
|
91
|
+
* a counterfeit `result: null`. Convert it to the same provider-neutral fact
|
|
92
|
+
* used for ordinary history instead. Durable state is never modified.
|
|
93
|
+
*/
|
|
94
|
+
export declare function projectGeneratedImageRunStateForModel(serialized: string): string;
|
|
95
|
+
export declare function compactGeneratedImageRunState(serialized: string, receiptsByProviderItemId: ReadonlyMap<string, GeneratedImageReceipt>): string;
|
|
96
|
+
export declare function collectGeneratedImageRunStateArtifactReceipts(serialized: string, target?: Map<string, GeneratedImageReceipt>): Map<string, GeneratedImageReceipt>;
|
|
97
|
+
export declare function generatedImageReceiptFromUnknown(value: unknown): GeneratedImageReceipt | null;
|
|
98
|
+
export declare function retainedGeneratedImageFromArtifact(artifact: GeneratedImageArtifact): RetainedGeneratedImage;
|
|
99
|
+
/** Verify a recovered ready correlation against the immutable object metadata. */
|
|
100
|
+
export declare function verifyReadyGeneratedImageArtifact(storage: ObjectStorage, artifact: GeneratedImageArtifact): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Finish a crash-interrupted upload from immutable DB/object metadata without
|
|
103
|
+
* provider replay. A missing object is not proof that generation failed: the
|
|
104
|
+
* paid outcome remains unknown and the caller may check again later.
|
|
105
|
+
*/
|
|
106
|
+
export declare function recoverGeneratedImageArtifact(input: {
|
|
107
|
+
db: Database;
|
|
108
|
+
storage: ObjectStorage;
|
|
109
|
+
accountId: string;
|
|
110
|
+
workspaceId: string;
|
|
111
|
+
artifact: GeneratedImageArtifact;
|
|
112
|
+
}): Promise<GeneratedImageArtifact | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GitCredentialProvider } from "@opengeni/contracts";
|
|
2
|
-
import type { GitTokenExpiries, GitTokenSeeds, MintedRunGitCredentials } from "./environment";
|
|
2
|
+
import type { GitTokenExpiries, GitTokenSeeds, MintedRunGitCredentials } from "./environment.js";
|
|
3
3
|
export declare const GIT_CREDENTIAL_DEFAULT_REFRESH_MS: number;
|
|
4
4
|
export declare const GIT_CREDENTIAL_EXPIRY_LEAD_MS: number;
|
|
5
5
|
export declare const GIT_CREDENTIAL_MIN_REFRESH_MS = 5000;
|
|
@@ -12,7 +12,7 @@ export type GitCredentialRenewalResult = {
|
|
|
12
12
|
export type GitCredentialRenewalFailure = {
|
|
13
13
|
providers: readonly GitCredentialProvider[];
|
|
14
14
|
retryDelayMs: number;
|
|
15
|
-
errorClass:
|
|
15
|
+
errorClass: "GitCredentialRenewalOperationError";
|
|
16
16
|
};
|
|
17
17
|
export type GitCredentialRenewalController = {
|
|
18
18
|
refreshNow(): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Settings } from "@opengeni/config";
|
|
2
2
|
import { type SessionGoal, type ToolRef } from "@opengeni/contracts";
|
|
3
|
-
import type {
|
|
4
|
-
export declare function createGoalActivities(services: () => Promise<
|
|
3
|
+
import type { ControlActivityServices, MaybeContinueGoalInput, MaybeContinueGoalResult } from "./types.js";
|
|
4
|
+
export declare function createGoalActivities(services: () => Promise<ControlActivityServices>): {
|
|
5
5
|
enqueueGoalRetryWake: (input: MaybeContinueGoalInput) => Promise<void>;
|
|
6
6
|
maybeContinueGoal: (input: MaybeContinueGoalInput) => Promise<MaybeContinueGoalResult>;
|
|
7
7
|
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { GoogleDriveSelectedSource } from "@opengeni/contracts/google-drive";
|
|
2
|
+
import { type GoogleDriveInventoryEntry, type GoogleDriveInventoryProviderItem } from "@opengeni/documents/google-drive";
|
|
3
|
+
export type GoogleDriveSyncBudget = {
|
|
4
|
+
examinedItems: number;
|
|
5
|
+
providerRequests: number;
|
|
6
|
+
elapsedMs: number;
|
|
7
|
+
};
|
|
8
|
+
export type GoogleDriveChangesCursor = {
|
|
9
|
+
version: 1;
|
|
10
|
+
kind: "google_drive_changes";
|
|
11
|
+
connectionId: string;
|
|
12
|
+
googlePermissionId: string;
|
|
13
|
+
sourceId: string;
|
|
14
|
+
driveId: string | null;
|
|
15
|
+
boundaryId: string;
|
|
16
|
+
pageToken: string;
|
|
17
|
+
cursorGeneration: number;
|
|
18
|
+
lastFullReconciliationAt: string;
|
|
19
|
+
nextFullReconciliationAt: string;
|
|
20
|
+
};
|
|
21
|
+
export type GoogleDriveChangesCheckpoint = {
|
|
22
|
+
version: 2;
|
|
23
|
+
pageToken: string;
|
|
24
|
+
requiresFullReconciliation: boolean;
|
|
25
|
+
seenPageTokenHashes: string[];
|
|
26
|
+
budget: GoogleDriveSyncBudget;
|
|
27
|
+
};
|
|
28
|
+
export type GoogleDriveChange = {
|
|
29
|
+
fileId: string;
|
|
30
|
+
removed: boolean;
|
|
31
|
+
file: GoogleDriveInventoryProviderItem | null;
|
|
32
|
+
};
|
|
33
|
+
export type GoogleDriveChangesPage = {
|
|
34
|
+
changes: GoogleDriveChange[];
|
|
35
|
+
nextPageToken: string | null;
|
|
36
|
+
newStartPageToken: string | null;
|
|
37
|
+
};
|
|
38
|
+
export type GoogleDriveChangesStopReason = "item_limit" | "api_request_limit" | "elapsed_time_limit";
|
|
39
|
+
export type GoogleDriveChangesDrainResult = {
|
|
40
|
+
status: "complete" | "paused";
|
|
41
|
+
stopReason: GoogleDriveChangesStopReason | null;
|
|
42
|
+
entries: GoogleDriveInventoryEntry[];
|
|
43
|
+
checkpoint: GoogleDriveChangesCheckpoint | null;
|
|
44
|
+
newStartPageToken: string | null;
|
|
45
|
+
requiresFullReconciliation: boolean;
|
|
46
|
+
providerRequests: number;
|
|
47
|
+
elapsedMs: number;
|
|
48
|
+
budget: GoogleDriveSyncBudget;
|
|
49
|
+
hardLimitReached: boolean;
|
|
50
|
+
};
|
|
51
|
+
export declare function parseGoogleDriveChangesCursor(value: Record<string, unknown> | null, expected: {
|
|
52
|
+
connectionId: string;
|
|
53
|
+
googlePermissionId: string;
|
|
54
|
+
sourceId: string;
|
|
55
|
+
driveId: string | null;
|
|
56
|
+
}): GoogleDriveChangesCursor | null;
|
|
57
|
+
export declare function buildGoogleDriveChangesCursor(input: {
|
|
58
|
+
connectionId: string;
|
|
59
|
+
googlePermissionId: string;
|
|
60
|
+
sourceId: string;
|
|
61
|
+
driveId: string | null;
|
|
62
|
+
boundaryId: string;
|
|
63
|
+
pageToken: string;
|
|
64
|
+
previousGeneration: number;
|
|
65
|
+
reconciledAt: Date;
|
|
66
|
+
fullReconciliationIntervalMs: number;
|
|
67
|
+
}): GoogleDriveChangesCursor;
|
|
68
|
+
export declare function advanceGoogleDriveChangesCursor(cursor: GoogleDriveChangesCursor, pageToken: string): GoogleDriveChangesCursor;
|
|
69
|
+
export declare function googleDriveFullReconciliationDue(cursor: GoogleDriveChangesCursor, now: Date): boolean;
|
|
70
|
+
export declare function resolveGoogleDriveChangesBoundaryId(input: {
|
|
71
|
+
source: GoogleDriveSelectedSource;
|
|
72
|
+
getFile: (fileId: string) => Promise<GoogleDriveInventoryProviderItem | null>;
|
|
73
|
+
}): Promise<string>;
|
|
74
|
+
export declare function parseGoogleDriveChangesCheckpoint(value: unknown, limits: {
|
|
75
|
+
maxItems: number;
|
|
76
|
+
maxProviderRequests: number;
|
|
77
|
+
maxElapsedMs: number;
|
|
78
|
+
}): GoogleDriveChangesCheckpoint | null;
|
|
79
|
+
export declare function drainGoogleDriveChanges(input: {
|
|
80
|
+
source: GoogleDriveSelectedSource;
|
|
81
|
+
cursor: GoogleDriveChangesCursor;
|
|
82
|
+
checkpoint: GoogleDriveChangesCheckpoint | null;
|
|
83
|
+
maxItems: number;
|
|
84
|
+
maxProviderRequests: number;
|
|
85
|
+
maxElapsedMs: number;
|
|
86
|
+
maxInvocationElapsedMs: number;
|
|
87
|
+
maxFileBytes: number;
|
|
88
|
+
listChanges: (pageToken: string, pageSize: number) => Promise<GoogleDriveChangesPage>;
|
|
89
|
+
getFile: (fileId: string) => Promise<GoogleDriveInventoryProviderItem | null>;
|
|
90
|
+
observedExternalObjectIds: (ids: string[]) => Promise<Set<string>>;
|
|
91
|
+
now?: () => number;
|
|
92
|
+
}): Promise<GoogleDriveChangesDrainResult>;
|
|
93
|
+
export declare class GoogleDriveCursorInvalidError extends Error {
|
|
94
|
+
budget: GoogleDriveSyncBudget | null;
|
|
95
|
+
constructor();
|
|
96
|
+
}
|
|
97
|
+
export declare class GoogleDriveChangesProtocolError extends Error {
|
|
98
|
+
constructor(message: string);
|
|
99
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { beginImageGenerationOperation, completeImageGenerationOperation, markImageGenerationOperationOutcomeUnknown, markImageGenerationOperationRetentionFailed, prepareImageGenerationOperation, type Database } from "@opengeni/db";
|
|
2
|
+
import type { ObjectStorage } from "@opengeni/storage";
|
|
3
|
+
import { retainGeneratedImage, type GeneratedImageOutput, type GeneratedImageReceipt } from "./generated-images.js";
|
|
4
|
+
export declare class ImageGenerationOutcomeUnknownError extends Error {
|
|
5
|
+
readonly operationId: string;
|
|
6
|
+
constructor(operationId: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class ImageGenerationRetentionFailedError extends Error {
|
|
9
|
+
readonly operationId: string;
|
|
10
|
+
constructor(operationId: string, cause?: unknown);
|
|
11
|
+
}
|
|
12
|
+
export type ImageGenerationOperationPorts = {
|
|
13
|
+
prepare: typeof prepareImageGenerationOperation;
|
|
14
|
+
begin: typeof beginImageGenerationOperation;
|
|
15
|
+
retain: typeof retainGeneratedImage;
|
|
16
|
+
complete: typeof completeImageGenerationOperation;
|
|
17
|
+
markOutcomeUnknown: typeof markImageGenerationOperationOutcomeUnknown;
|
|
18
|
+
markRetentionFailed: typeof markImageGenerationOperationRetentionFailed;
|
|
19
|
+
recover: typeof recoverCompletedImage;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Durable admission fence shared by every client-executed image provider.
|
|
23
|
+
* Provider execution is permitted at most once after the prepared ->
|
|
24
|
+
* provider_started transition. A crash at that boundary may conservatively
|
|
25
|
+
* leave the outcome unknown; a retry may recover a ready artifact, but never
|
|
26
|
+
* blindly replays the paid operation.
|
|
27
|
+
*/
|
|
28
|
+
export type ExecuteImageGenerationOperationInput = {
|
|
29
|
+
db: Database;
|
|
30
|
+
objectStorage: ObjectStorage | null;
|
|
31
|
+
accountId: string;
|
|
32
|
+
workspaceId: string;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
turnId: string;
|
|
35
|
+
attemptId: string;
|
|
36
|
+
toolCallId: string;
|
|
37
|
+
providerId: string;
|
|
38
|
+
providerBindingHash: string;
|
|
39
|
+
modelId: string;
|
|
40
|
+
prompt: string;
|
|
41
|
+
referenceDigests?: readonly Readonly<{
|
|
42
|
+
mediaType: string;
|
|
43
|
+
sha256: string;
|
|
44
|
+
}>[];
|
|
45
|
+
generate: () => Promise<GeneratedImageOutput>;
|
|
46
|
+
};
|
|
47
|
+
export declare function executeImageGenerationOperation(input: ExecuteImageGenerationOperationInput, ports?: ImageGenerationOperationPorts): Promise<GeneratedImageReceipt>;
|
|
48
|
+
export declare function imageProviderBindingHash(providerId: string, credentialIdentity: string): string;
|
|
49
|
+
/** Stable across worker/Temporal attempt retries; the attempt id is provenance, not identity. */
|
|
50
|
+
export declare function imageGenerationOperationIdentity(input: {
|
|
51
|
+
workspaceId: string;
|
|
52
|
+
sessionId: string;
|
|
53
|
+
turnId: string;
|
|
54
|
+
toolCallId: string;
|
|
55
|
+
providerId: string;
|
|
56
|
+
providerBindingHash: string;
|
|
57
|
+
modelId: string;
|
|
58
|
+
prompt: string;
|
|
59
|
+
referenceDigests?: readonly Readonly<{
|
|
60
|
+
mediaType: string;
|
|
61
|
+
sha256: string;
|
|
62
|
+
}>[];
|
|
63
|
+
}): {
|
|
64
|
+
operationId: string;
|
|
65
|
+
operationKey: string;
|
|
66
|
+
requestDigest: string;
|
|
67
|
+
artifactId: string;
|
|
68
|
+
};
|
|
69
|
+
declare function recoverCompletedImage(input: Pick<Parameters<typeof executeImageGenerationOperation>[0], "db" | "objectStorage" | "accountId" | "workspaceId" | "sessionId" | "turnId" | "toolCallId" | "providerId" | "providerBindingHash">, identity: {
|
|
70
|
+
artifactId: string;
|
|
71
|
+
operationId: string;
|
|
72
|
+
operationKey: string;
|
|
73
|
+
}): Promise<GeneratedImageReceipt | null>;
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ImageGenerationReference } from "@opengeni/contracts";
|
|
2
|
+
import { type Database } from "@opengeni/db";
|
|
3
|
+
import type { ObjectStorage } from "@opengeni/storage";
|
|
4
|
+
import { type GeneratedImageMediaType } from "./generated-images.js";
|
|
5
|
+
export declare const IMAGE_GENERATION_REFERENCE_MAX_BYTES: number;
|
|
6
|
+
export declare const IMAGE_GENERATION_REFERENCES_MAX_TOTAL_BYTES: number;
|
|
7
|
+
export type ResolvedImageGenerationReference = Readonly<{
|
|
8
|
+
mediaType: GeneratedImageMediaType;
|
|
9
|
+
bytes: Uint8Array;
|
|
10
|
+
sizeBytes: number;
|
|
11
|
+
sha256: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type SandboxImageReferenceReader = (path: string, maxBytes: number) => Promise<Uint8Array>;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve ordered model-facing references without accepting arbitrary URLs.
|
|
16
|
+
* Stored files remain workspace-RLS scoped; sandbox reads stay rooted beneath
|
|
17
|
+
* /workspace. Provider adapters receive only validated immutable bytes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveImageGenerationReferences(input: {
|
|
20
|
+
db: Database;
|
|
21
|
+
objectStorage: ObjectStorage;
|
|
22
|
+
workspaceId: string;
|
|
23
|
+
references: readonly ImageGenerationReference[];
|
|
24
|
+
readSandboxFile?: SandboxImageReferenceReader;
|
|
25
|
+
}): Promise<ResolvedImageGenerationReference[]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type KnowledgeSourceSyncDriverInventory<Entry, StopReason extends string> = {
|
|
2
|
+
status: "complete" | "paused";
|
|
3
|
+
stopReason: StopReason | null;
|
|
4
|
+
entries: Entry[];
|
|
5
|
+
checkpoint: Record<string, unknown> | null;
|
|
6
|
+
providerCursor: Record<string, unknown> | null;
|
|
7
|
+
authoritativeFullScan: boolean;
|
|
8
|
+
cursorInvalidated: boolean;
|
|
9
|
+
providerRequests: number;
|
|
10
|
+
elapsedMs: number;
|
|
11
|
+
hardLimitReached: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** Provider port for deterministic knowledge ingestion. Implementations own
|
|
14
|
+
* provider JSON and byte transfer; the shared activity owns authority,
|
|
15
|
+
* persistence, indexing obligations, telemetry, and checkpoint settlement. */
|
|
16
|
+
export type KnowledgeSourceSyncDriver<Entry, StopReason extends string> = {
|
|
17
|
+
providerKey: string;
|
|
18
|
+
providerDomain: string;
|
|
19
|
+
providerCoordinationKey: string;
|
|
20
|
+
inventory: (executionCheckpoint: Record<string, unknown> | null, providerCursor: Record<string, unknown> | null) => Promise<KnowledgeSourceSyncDriverInventory<Entry, StopReason>>;
|
|
21
|
+
fetchContent: (entry: Entry, maxBytes: number) => Promise<Uint8Array>;
|
|
22
|
+
citationLocator: (entry: Entry) => Record<string, unknown>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { GoogleDriveConnectionMetadata, type GoogleDriveSelectedSource } from "@opengeni/contracts/google-drive";
|
|
2
|
+
import { type GoogleDriveInventoryEntry, type GoogleDriveInventoryPage, type GoogleDriveInventoryProviderItem, type GoogleDriveInventoryStopReason } from "@opengeni/documents/google-drive";
|
|
3
|
+
import { deauthorizeKnowledgeSourceRetrieval, settleKnowledgeSourceSyncLease, type Database, type KnowledgeSourceSyncObjectObservationResult, type KnowledgeSourceSyncObservationFloor } from "@opengeni/db";
|
|
4
|
+
import type { ControlActivityServices, RunKnowledgeSourceSyncBatchInput, RunKnowledgeSourceSyncBatchResult } from "./types.js";
|
|
5
|
+
import type { KnowledgeSourceSyncDriver } from "./knowledge-source-sync-driver.js";
|
|
6
|
+
import { type GoogleDriveChangesPage } from "./google-drive-changes.js";
|
|
7
|
+
export declare function knowledgeSyncObservationPolicy(kind: "google_drive" | "atlassian"): {
|
|
8
|
+
revisionOrdering: "canonical_decimal";
|
|
9
|
+
filterWithDriveDurability: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
revisionOrdering: "first_observation";
|
|
12
|
+
filterWithDriveDurability: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function createKnowledgeSourceSyncActivities(services: () => Promise<ControlActivityServices>, resolveDocumentServices?: () => Promise<import("@opengeni/documents").DocumentServices>): {
|
|
15
|
+
runKnowledgeSourceSyncBatch: (input: RunKnowledgeSourceSyncBatchInput) => Promise<RunKnowledgeSourceSyncBatchResult>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Permission loss must fail closed, while the exact source lease must never be
|
|
19
|
+
* stranded by a deauthorization error. If deauthorization fails, release the
|
|
20
|
+
* lease without settling the wake/run and surface the error so Temporal retries
|
|
21
|
+
* this DB-only safety obligation. Terminal settlement is allowed only after
|
|
22
|
+
* deauthorization succeeds.
|
|
23
|
+
*/
|
|
24
|
+
export declare function deauthorizeAndSettleKnowledgeSourceSyncFailure(db: Database, input: {
|
|
25
|
+
deauthorization: Parameters<typeof deauthorizeKnowledgeSourceRetrieval>[1];
|
|
26
|
+
settlement: Parameters<typeof settleKnowledgeSourceSyncLease>[1];
|
|
27
|
+
}): Promise<Awaited<ReturnType<typeof settleKnowledgeSourceSyncLease>>>;
|
|
28
|
+
export type GoogleDriveSyncProviderPort = {
|
|
29
|
+
now?: () => number;
|
|
30
|
+
getStartPageToken: (driveId: string | null) => Promise<string>;
|
|
31
|
+
listChanges: (pageToken: string, driveId: string | null, pageSize: number) => Promise<GoogleDriveChangesPage>;
|
|
32
|
+
getFile: (fileId: string) => Promise<GoogleDriveInventoryProviderItem | null>;
|
|
33
|
+
listChildren: (input: {
|
|
34
|
+
folderId: string;
|
|
35
|
+
driveId: string | null;
|
|
36
|
+
pageToken: string | null;
|
|
37
|
+
pageSize: number;
|
|
38
|
+
}) => Promise<GoogleDriveInventoryPage>;
|
|
39
|
+
};
|
|
40
|
+
export declare function googleDriveSyncDriver(input: {
|
|
41
|
+
actionProviderCoordinationKey: string;
|
|
42
|
+
metadata: ReturnType<typeof GoogleDriveConnectionMetadata.parse>;
|
|
43
|
+
selectedSource: GoogleDriveSelectedSource;
|
|
44
|
+
connectionId: string;
|
|
45
|
+
accountId: string;
|
|
46
|
+
workspaceId: string;
|
|
47
|
+
initiatingSubjectId: string;
|
|
48
|
+
authorization: string | undefined;
|
|
49
|
+
fullReconciliationIntervalMs: number;
|
|
50
|
+
observedExternalObjectIds: (ids: string[]) => Promise<Set<string>>;
|
|
51
|
+
provider?: GoogleDriveSyncProviderPort;
|
|
52
|
+
limits: {
|
|
53
|
+
maxItems: number;
|
|
54
|
+
maxBytes: number;
|
|
55
|
+
maxFileBytes: number;
|
|
56
|
+
maxProviderRequests: number;
|
|
57
|
+
maxElapsedSeconds: number;
|
|
58
|
+
};
|
|
59
|
+
}): KnowledgeSourceSyncDriver<GoogleDriveInventoryEntry, GoogleDriveInventoryStopReason>;
|
|
60
|
+
export declare function shouldProcessGoogleDriveDurableObservation(input: {
|
|
61
|
+
entry: Pick<GoogleDriveInventoryEntry, "externalObjectId">;
|
|
62
|
+
observation: KnowledgeSourceSyncObjectObservationResult;
|
|
63
|
+
sourceLifecycleGeneration: number;
|
|
64
|
+
aclGeneration: number;
|
|
65
|
+
}): boolean;
|
|
66
|
+
export declare function mergeGoogleDriveDurableObservationFloors(checkpoint: Record<string, unknown> | null, observations: KnowledgeSourceSyncObservationFloor[], maxItems: number): Record<string, unknown> | null;
|
|
67
|
+
export declare function googleDriveSyncProviderAccessAllowed(input: {
|
|
68
|
+
connectionVersion: number;
|
|
69
|
+
resolvedConnectionVersion: number | undefined;
|
|
70
|
+
connectionStatus: string;
|
|
71
|
+
lifecycleState: string | undefined;
|
|
72
|
+
grantedScopes: string[];
|
|
73
|
+
}): boolean;
|
|
74
|
+
export declare function confluenceCursor(value: unknown): string | null;
|
|
75
|
+
export declare function adfToMarkdown(value: unknown): string;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { CapabilityPack } from "@opengeni/contracts";
|
|
1
|
+
import { CapabilityPack, type PackInstallation } from "@opengeni/contracts";
|
|
3
2
|
import { type Database } from "@opengeni/db";
|
|
4
3
|
import { type EffectiveSkillSelection, type PackSkill } from "@opengeni/runtime";
|
|
4
|
+
export { resolveRigProviderImageSelection, rigProviderImageSourceImage, settingsWithPackSandboxImage, settingsWithRigImage, settingsWithRigProviderImage, } from "./sandbox-images.js";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* sandbox skill index.
|
|
6
|
+
* Legacy pack-scoped runtime compatibility. V2 Pack installations own ordinary
|
|
7
|
+
* Skill components and select an explicit Rig; they contribute nothing here.
|
|
9
8
|
*/
|
|
10
9
|
export type WorkspacePackRuntime = {
|
|
11
10
|
sandboxImage: string | null;
|
|
@@ -17,13 +16,14 @@ export type WorkspaceSkillLibraryRuntime = {
|
|
|
17
16
|
skillLibrarySelections: EffectiveSkillSelection[];
|
|
18
17
|
};
|
|
19
18
|
/**
|
|
20
|
-
* Resolves
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
19
|
+
* Resolves only pre-V2 active Pack installations. A frozen manifest/digest is
|
|
20
|
+
* the protocol marker for V2: inline Skills were migrated into the ordinary
|
|
21
|
+
* Skill ledger and sandboxImage was resolved to selectedRigId during install,
|
|
22
|
+
* so reading either field directly here would duplicate ownership and silently
|
|
23
|
+
* override session compute.
|
|
25
24
|
*/
|
|
26
25
|
export declare function resolveWorkspacePackRuntime(db: Database, workspaceId: string): Promise<WorkspacePackRuntime>;
|
|
26
|
+
export declare function packInstallationUsesLegacyRuntime(installation: Pick<PackInstallation, "manifestSnapshot" | "manifestDigest">): boolean;
|
|
27
27
|
/**
|
|
28
28
|
* Resolves active immutable curated skills separately from pack skills. The
|
|
29
29
|
* capability installation is the workspace selection boundary; it carries
|
|
@@ -32,10 +32,9 @@ export declare function resolveWorkspacePackRuntime(db: Database, workspaceId: s
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function resolveWorkspaceSkillLibraryRuntime(db: Database, workspaceId: string): Promise<WorkspaceSkillLibraryRuntime>;
|
|
34
34
|
/**
|
|
35
|
-
* Pure
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* packs. Violations fail the turn with a plain error instead of guessing.
|
|
35
|
+
* Pure pre-V2 compatibility rule for enabled Pack manifests. At most one
|
|
36
|
+
* legacy Pack may declare a sandbox image, and legacy Skill names must be
|
|
37
|
+
* unique. V2 rows never reach this function through runtime resolution.
|
|
39
38
|
*/
|
|
40
39
|
export declare function workspacePackRuntimeFromPacks(packs: CapabilityPack[]): WorkspacePackRuntime;
|
|
41
40
|
/**
|
|
@@ -55,18 +54,6 @@ export declare function resolveWorkspaceAgentInstructions(db: Database, workspac
|
|
|
55
54
|
* the settings pass through untouched, so deployments without packs keep the
|
|
56
55
|
* global OPENGENI_DOCKER_IMAGE / OPENGENI_MODAL_IMAGE_REF behavior exactly.
|
|
57
56
|
*/
|
|
58
|
-
export declare function settingsWithPackSandboxImage(settings: Settings, sandboxImage: string | null, sandboxProviderImages?: CapabilityPack["sandboxProviderImages"] | null): Settings;
|
|
59
|
-
/**
|
|
60
|
-
* Applies the session's frozen rig-version image to run settings. Rig image is
|
|
61
|
-
* the TOP of the image precedence chain (rig > pack > deployment default): when
|
|
62
|
-
* the rig version pins an image it OVERRIDES both the deployment
|
|
63
|
-
* dockerImage/modalImageRef AND any pack-declared sandboxImage. When the rig
|
|
64
|
-
* pins no image (`null`), the settings pass through untouched so the pack /
|
|
65
|
-
* deployment chain below still resolves exactly as today. Applied AFTER
|
|
66
|
-
* settingsWithPackSandboxImage so it wins the collision; identical mechanics to
|
|
67
|
-
* the pack equivalent (write both image fields so docker and modal agree).
|
|
68
|
-
*/
|
|
69
|
-
export declare function settingsWithRigImage(settings: Settings, rigImage: string | null): Settings;
|
|
70
57
|
/**
|
|
71
58
|
* Layers the rig version's default variable sets BELOW the session's own set:
|
|
72
59
|
* the session's values WIN on any key collision (explicit precedence). Both maps
|
|
@@ -2,7 +2,7 @@ import type { Settings } from "@opengeni/config";
|
|
|
2
2
|
import type { Session, SessionGoal } from "@opengeni/contracts";
|
|
3
3
|
import { claimPendingSessionSystemUpdateOutbox, claimPendingSessionWorkflowWakes, type Database } from "@opengeni/db";
|
|
4
4
|
import type { EventBus } from "@opengeni/events";
|
|
5
|
-
import type { ActivityServices, WakeSessionWorkflowSignal } from "./types";
|
|
5
|
+
import type { ActivityServices, WakeSessionWorkflowSignal } from "./types.js";
|
|
6
6
|
export type NotifyServices = {
|
|
7
7
|
db: Database;
|
|
8
8
|
bus: EventBus;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FileAsset } from "@opengeni/contracts";
|
|
2
|
+
import type { ObjectHead, ObjectStorage } from "@opengeni/storage";
|
|
3
|
+
import type { ControlActivityServices } from "./types.js";
|
|
4
|
+
export declare const RETAINED_SCREENSHOT_PENDING_GRACE_MS: number;
|
|
5
|
+
export declare const RETAINED_SCREENSHOT_CLAIM_TIMEOUT_MS: number;
|
|
6
|
+
export declare const RETAINED_SCREENSHOT_MAINTENANCE_BATCH_SIZE = 100;
|
|
7
|
+
export type MaintainRetainedScreenshotsResult = {
|
|
8
|
+
claimed: number;
|
|
9
|
+
ready: number;
|
|
10
|
+
deleted: number;
|
|
11
|
+
failed: number;
|
|
12
|
+
retryable: number;
|
|
13
|
+
};
|
|
14
|
+
export type RetainedScreenshotMaintenanceActivityOptions = {
|
|
15
|
+
pendingGraceMs?: number;
|
|
16
|
+
claimTimeoutMs?: number;
|
|
17
|
+
batchSize?: number;
|
|
18
|
+
/** Provider seams used by deterministic unit tests. */
|
|
19
|
+
fileExists?: (storage: ObjectStorage, file: FileAsset) => Promise<boolean>;
|
|
20
|
+
headFile?: (storage: ObjectStorage, file: FileAsset) => Promise<ObjectHead>;
|
|
21
|
+
deleteObject?: (storage: ObjectStorage, key: string) => Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Reconcile interrupted screenshot writes and reap expired screenshot objects.
|
|
25
|
+
* Claims move rows out of the readable `ready`/writable `pending` states before
|
|
26
|
+
* provider access. Provider failures leave the durable claim reclaimable; DB
|
|
27
|
+
* completion happens only after exact metadata verification or an idempotent
|
|
28
|
+
* object delete.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createRetainedScreenshotMaintenanceActivities(services: () => Promise<ControlActivityServices>, options?: RetainedScreenshotMaintenanceActivityOptions): {
|
|
31
|
+
maintainRetainedScreenshots: () => Promise<MaintainRetainedScreenshotsResult>;
|
|
32
|
+
};
|