@opengeni/worker-bundle 0.16.29 → 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 +85 -19
- 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 +1 -0
- package/dist/activities/documents.d.ts +3 -2
- package/dist/activities/environment.d.ts +11 -8
- package/dist/activities/expiring-material-renewal.d.ts +1 -1
- 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 +1 -1
- 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 +2 -2
- package/dist/activities/retained-screenshots.d.ts +36 -0
- package/dist/activities/rig-verification.d.ts +82 -5
- package/dist/activities/run-credential-renewal.d.ts +1 -1
- package/dist/activities/run-input.d.ts +3 -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 +10 -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 -150
- 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/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/index.d.ts +176 -10
- package/dist/index.js +662 -17374
- 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 +34 -7
- package/dist/sandbox-routing.d.ts +2 -0
- package/dist/worker-service-lifecycle.d.ts +6 -2
- package/dist/workflow-bundle.js +1043 -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 +1470 -246
- 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 +6 -6
- package/src/activities/codex-image-generation.ts +56 -0
- package/src/activities/context-compaction.ts +38 -3
- package/src/activities/documents.ts +14 -4
- package/src/activities/environment.ts +45 -42
- package/src/activities/expiring-material-renewal.ts +1 -1
- 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/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/retained-screenshot-reaper.ts +2 -2
- package/src/activities/retained-screenshots.ts +453 -28
- package/src/activities/rig-verification.ts +554 -43
- package/src/activities/run-input.ts +22 -6
- package/src/activities/sandbox-images.ts +167 -0
- package/src/activities/sandbox-lease.ts +1065 -483
- package/src/activities/scheduled-tasks.ts +77 -4
- 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 +44 -10
- package/src/activities-control.ts +54 -0
- package/src/activities-turn.ts +40 -0
- package/src/activities.ts +48 -124
- 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/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 +199 -4
- package/src/sandbox-reaper-contract.ts +73 -0
- package/src/sandbox-reaper-timeout.ts +79 -0
- package/src/sandbox-resume.ts +294 -153
- package/src/sandbox-routing.ts +19 -24
- package/src/worker-service-lifecycle.ts +80 -14
- package/src/workflows/activities.ts +30 -0
- package/src/workflows/file-upload-reaper.ts +3 -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/toolspace-token-renewal.d.ts +0 -23
- package/src/activities/toolspace-token-renewal.ts +0 -64
|
@@ -1,14 +1,14 @@
|
|
|
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 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
|
|
9
|
-
import { type ModelAttachmentInputPolicy } from "./run-input";
|
|
10
|
-
import type { ActivityServices, EscapedMcpTimeoutRecoveryDetail, RunAgentTurnInput, RunAgentTurnResult, SessionAttemptQuiescenceProof } from "./types";
|
|
11
|
-
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";
|
|
12
12
|
import { type LatencyMode, type SessionEvent, type SessionEventType, type SessionTurn, type ToolAuthNeededPayload, type TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
13
13
|
export declare const PROVIDER_BACKPRESSURE_DELAY_MS = 60000;
|
|
14
14
|
export declare class WorkspaceHumanInputDisabledError extends Error {
|
|
@@ -133,12 +133,14 @@ export declare function assertSessionAttemptQuiescenceRecoveryDurable(input: {
|
|
|
133
133
|
* state. The proof object never changes between attempts. */
|
|
134
134
|
export declare function persistOrSignalSessionAttemptQuiescence(input: {
|
|
135
135
|
proof: SessionAttemptQuiescenceProof;
|
|
136
|
-
persistReceipt: () => Promise<
|
|
136
|
+
persistReceipt: () => Promise<SessionAttemptQuiescenceCommit>;
|
|
137
|
+
deliverWorkflowWake?: (wake: NonNullable<SessionAttemptQuiescenceCommit["workflowWake"]>) => Promise<unknown>;
|
|
137
138
|
publishEvents: (events: SessionEvent[]) => Promise<unknown>;
|
|
138
139
|
signalProof: ActivityServices["signalSessionAttemptQuiesced"];
|
|
139
140
|
sleep?: (ms: number) => Promise<void>;
|
|
140
141
|
heartbeat?: (attempt: number, delayMs: number) => void;
|
|
141
142
|
onReceiptFailure?: (error: unknown) => void;
|
|
143
|
+
onWakeFailure?: (error: unknown) => void;
|
|
142
144
|
onPublishFailure?: (error: unknown) => void;
|
|
143
145
|
onSignalFailure?: (error: unknown, attempt: number, delayMs: number) => void;
|
|
144
146
|
}): Promise<"receipt" | "signal">;
|
|
@@ -153,9 +155,19 @@ export declare function drainAttemptOwnedSandboxWriters(input: {
|
|
|
153
155
|
toolCancellationFence: Pick<TurnToolCancellationFence, "cancel" | "waitForQuiescence"> | null;
|
|
154
156
|
cancellationReason?: unknown;
|
|
155
157
|
gitCredentialRenewals: readonly Pick<GitCredentialRenewalController, "stop">[];
|
|
156
|
-
|
|
158
|
+
codemodeTokenRenewal: Pick<CodemodeTokenRenewalController, "stop"> | null;
|
|
157
159
|
runCredentialRenewal: Pick<RunCredentialRenewalController, "stop"> | null;
|
|
158
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>;
|
|
159
171
|
/**
|
|
160
172
|
* Await a finalizer operation only while this Temporal activity still owns its
|
|
161
173
|
* execution window. Once Pause/Steer cancellation arrives, the operation keeps
|
|
@@ -552,6 +564,24 @@ export declare function reconcileActiveSandboxPointer(db: ActivityServices["db"]
|
|
|
552
564
|
* `fromTag` path.
|
|
553
565
|
*/
|
|
554
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;
|
|
555
585
|
/**
|
|
556
586
|
* Decide whether the first actual computer action may start a proof recording.
|
|
557
587
|
*
|
|
@@ -623,6 +653,21 @@ export declare function structuredToolTransportForTurn(resolvedModel: {
|
|
|
623
653
|
kind: RegistryProviderKind;
|
|
624
654
|
};
|
|
625
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;
|
|
626
671
|
/**
|
|
627
672
|
* Native web search is a runtime capability, not part of the session's MCP
|
|
628
673
|
* allow-list. Attach it whenever the resolved provider advertises runnable
|
|
@@ -635,6 +680,27 @@ export declare function hostedWebSearchForTurn(resolvedModel: {
|
|
|
635
680
|
hostedWebSearch: boolean;
|
|
636
681
|
};
|
|
637
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;
|
|
638
704
|
/** Exact model-catalog modality gate; null preserves the legacy built-in path. */
|
|
639
705
|
export declare function modelSupportsImageInputForTurn(resolvedModel: {
|
|
640
706
|
configured: {
|
|
@@ -682,15 +748,10 @@ export declare class SandboxDeadlineRotationError extends Error {
|
|
|
682
748
|
export declare function turnOperationCancellationFailure(error: unknown): CancelledFailure | null;
|
|
683
749
|
export declare function waitForTurnOperation<T>(operation: Promise<T>, signal: AbortSignal | undefined, disposeLateResult: ((result: T) => Promise<void> | void) | undefined): Promise<T>;
|
|
684
750
|
export declare function isLazySandboxProvisionRetryable(error: unknown): boolean;
|
|
685
|
-
/**
|
|
686
|
-
*
|
|
687
|
-
*
|
|
688
|
-
|
|
689
|
-
* snapshot budget plus two schedule periods. This is workflow-visible pacing,
|
|
690
|
-
* not an in-memory sleep, so Pause/Steer/new user intent can still wake the
|
|
691
|
-
* durable session immediately.
|
|
692
|
-
*/
|
|
693
|
-
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;
|
|
694
755
|
export declare function createTurnSandboxProvisioner<T>(establish: () => Promise<T>, options?: {
|
|
695
756
|
maxRetries?: number;
|
|
696
757
|
backoffMs?: number;
|
|
@@ -793,6 +854,8 @@ export declare function pendingToolCallFromSdkEvent(event: unknown): {
|
|
|
793
854
|
callName: string | null;
|
|
794
855
|
callItem: Record<string, unknown>;
|
|
795
856
|
} | null;
|
|
857
|
+
/** Tools whose intentional visual result must survive inline-media sanitization. */
|
|
858
|
+
export declare function toolCallProducesRetainableSessionImage(name: string | null): boolean;
|
|
796
859
|
export declare function completedToolCallFromSdkEvent(event: unknown): {
|
|
797
860
|
callId: string;
|
|
798
861
|
resultItem: Record<string, unknown>;
|
|
@@ -802,6 +865,9 @@ export type ModelUsageBillingRecord = {
|
|
|
802
865
|
billingPath: "opengeni_credits" | "external";
|
|
803
866
|
/** Same quantity written to usage_events.model.cost when present; else 0. */
|
|
804
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;
|
|
805
871
|
normalizedUsage: ModelCallUsageNormalization;
|
|
806
872
|
upstreamProvider?: string;
|
|
807
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>;
|
|
@@ -79,3 +79,4 @@ export declare function settleFailedContextCompactionLandmark(db: Database, scop
|
|
|
79
79
|
compacted: false;
|
|
80
80
|
}>>;
|
|
81
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,17 +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;
|
|
61
|
-
|
|
64
|
+
skipCodemode?: boolean;
|
|
62
65
|
deferGitHubToken?: boolean;
|
|
63
|
-
|
|
66
|
+
codemodeAuthority?: SandboxCodemodeAuthority;
|
|
64
67
|
}): Promise<{
|
|
65
68
|
environment: Record<string, string>;
|
|
66
69
|
gitToken?: string;
|
|
67
70
|
gitTokens?: GitTokenSeeds;
|
|
68
71
|
gitTokenExpiresAt?: GitTokenExpiries;
|
|
69
72
|
gitCredentialBindings?: GitCredentialBindingSeed[];
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
codemodeToken?: string;
|
|
74
|
+
codemodeTokenExpiresAt?: Date;
|
|
72
75
|
}>;
|
|
73
76
|
export declare function mintRunGitCredentials(settings: Settings, resources: ResourceRef[], options?: RunGitCredentialOptions): Promise<MintedRunGitCredentials | undefined>;
|
|
74
77
|
export declare function mintRunGitCredentialBinding(settings: Settings, resources: ResourceRef[], provider: GitCredentialProvider, credentialBindingId: string, options?: RunGitCredentialOptions): Promise<GitCredentialBindingSeed | undefined>;
|
|
@@ -9,7 +9,7 @@ export type ExpiringMaterialRenewalController = {
|
|
|
9
9
|
refreshNow(): Promise<void>;
|
|
10
10
|
stop(): Promise<void>;
|
|
11
11
|
};
|
|
12
|
-
export type ExpiringMaterialRenewalPublicErrorClass = "RunCredentialRenewalOperationError" | "
|
|
12
|
+
export type ExpiringMaterialRenewalPublicErrorClass = "RunCredentialRenewalOperationError" | "CodemodeTokenRenewalOperationError";
|
|
13
13
|
export type ExpiringMaterialRenewalOptions<T, ErrorClass extends ExpiringMaterialRenewalPublicErrorClass> = {
|
|
14
14
|
initialExpiresAt: Date | null;
|
|
15
15
|
resolve: () => Promise<T>;
|
|
@@ -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>;
|
|
@@ -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;
|
|
@@ -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
|
};
|