@opengeni/config 0.12.1 → 0.13.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/index.d.ts +69 -3
- package/dist/index.js +219 -50
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +330 -50
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { Entitlements, LatencyMode, ReasoningEffort, SandboxBackend, StaticUsageLimits, TurnExecutionPolicyV1, type TurnExecutionLatencyModeSourceV1, type TurnExecutionModelSourceV1, type TurnExecutionReasoningSourceV1 } from "@opengeni/contracts";
|
|
1
|
+
import { Entitlements, LatencyMode, ReasoningEffort, SandboxBackend, StaticUsageLimits, TurnExecutionPolicyV1, type TurnExecutionLatencyModeSourceV1, type TurnExecutionModelSourceV1, type TurnExecutionReasoningSourceV1, type VideoGenerationResolution } from "@opengeni/contracts";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
export declare const SANDBOX_ARCHIVE_CAPTURE_MAX_TIMEOUT_MS: number;
|
|
4
|
+
export declare const SANDBOX_ARCHIVE_CAPTURE_SETTLEMENT_GRACE_MS = 10000;
|
|
5
|
+
export declare const SANDBOX_SNAPSHOT_MAX_TIMEOUT_MS: number;
|
|
6
|
+
export declare const SANDBOX_LIFECYCLE_TRANSITION_MAX_WAIT_MS: number;
|
|
7
|
+
export declare const SANDBOX_LIFECYCLE_RETRY_HANDOFF_GRACE_MS = 10000;
|
|
3
8
|
export declare const sandboxPreparationProfiles: Record<string, {
|
|
4
9
|
env: string[];
|
|
5
10
|
hooks: string[];
|
|
@@ -84,6 +89,9 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
84
89
|
turnWorkerMaxConcurrentTurns: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
85
90
|
turnWorkerTargetCpuUsage: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
86
91
|
turnWorkerTargetMemoryUsage: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
92
|
+
turnWorkerEmergencyMemoryUsage: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
93
|
+
turnWorkerMemoryGuardIntervalMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
94
|
+
turnWorkerMemoryGuardSustainMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
87
95
|
observabilityStructuredLogs: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
88
96
|
observabilityMetricsEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
89
97
|
observabilityOtlpEndpoint: z.ZodOptional<z.ZodString>;
|
|
@@ -123,19 +131,22 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
123
131
|
delegationSecret: z.ZodOptional<z.ZodString>;
|
|
124
132
|
streamTokenSecret: z.ZodOptional<z.ZodString>;
|
|
125
133
|
streamControlEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
126
|
-
|
|
127
|
-
toolspaceMaxCallsPerTurn: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
134
|
+
codemodeMaxCallsPerTurn: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
128
135
|
ogtoolPackageSpec: z.ZodOptional<z.ZodString>;
|
|
129
136
|
environmentsEncryptionKey: z.ZodOptional<z.ZodString>;
|
|
130
137
|
integrationsEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
131
138
|
integrationsStateSecret: z.ZodOptional<z.ZodString>;
|
|
132
139
|
integrationsAllowPrivateNetworkTargets: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
133
140
|
integrationsOauthClientsJson: z.ZodDefault<z.ZodString>;
|
|
141
|
+
gmailRestAdapterEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
134
142
|
slackClientId: z.ZodOptional<z.ZodString>;
|
|
135
143
|
slackClientSecret: z.ZodOptional<z.ZodString>;
|
|
136
144
|
slackSigningSecret: z.ZodOptional<z.ZodString>;
|
|
137
145
|
googleDriveClientId: z.ZodOptional<z.ZodString>;
|
|
138
146
|
googleDriveClientSecret: z.ZodOptional<z.ZodString>;
|
|
147
|
+
googleDriveWorkspaceEventsEnabled: z.ZodOptional<z.ZodPreprocess<z.ZodBoolean>>;
|
|
148
|
+
atlassianClientId: z.ZodOptional<z.ZodString>;
|
|
149
|
+
atlassianClientSecret: z.ZodOptional<z.ZodString>;
|
|
139
150
|
maxNestedAgentDepth: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
140
151
|
socialOauthClientsJson: z.ZodDefault<z.ZodString>;
|
|
141
152
|
goalMaxAutoContinuations: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -165,6 +176,16 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
165
176
|
openaiModel: z.ZodDefault<z.ZodString>;
|
|
166
177
|
openaiAllowedModels: z.ZodDefault<z.ZodString>;
|
|
167
178
|
vercelAiGatewayApiKey: z.ZodOptional<z.ZodString>;
|
|
179
|
+
imageGenerationModel: z.ZodDefault<z.ZodString>;
|
|
180
|
+
videoGenerationPollIntervalMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
181
|
+
videoGenerationRecoveryDeadlineMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
182
|
+
videoGenerationReferenceUrlTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
183
|
+
videoGenerationMaxConcurrentPerWorkspace: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
184
|
+
videoGenerationWorkspaceQuotaBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
185
|
+
videoGenerationTempDirectory: z.ZodDefault<z.ZodString>;
|
|
186
|
+
videoGenerationFfprobePath: z.ZodDefault<z.ZodString>;
|
|
187
|
+
videoGenerationCredit480pMicrosPerSecond: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
188
|
+
videoGenerationCredit720pMicrosPerSecond: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
168
189
|
voiceInputMaxDurationSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
169
190
|
voiceInputMaxSizeBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
170
191
|
voiceInputResumableEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
@@ -191,6 +212,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
191
212
|
codexConnectedAppsEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
192
213
|
codexProductSku: z.ZodOptional<z.ZodString>;
|
|
193
214
|
codexToolSearchEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
215
|
+
lazyToolSearchEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
194
216
|
codexCredentialLeasingEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
195
217
|
codexFleetPolicyShadowEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
196
218
|
codexRotationNearExhaustionPct: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -237,6 +259,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
237
259
|
vercel: "vercel";
|
|
238
260
|
}>>;
|
|
239
261
|
dockerImage: z.ZodDefault<z.ZodString>;
|
|
262
|
+
sandboxArtifactRuntimeEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
240
263
|
dockerExposedPorts: z.ZodDefault<z.ZodString>;
|
|
241
264
|
dockerNetwork: z.ZodOptional<z.ZodString>;
|
|
242
265
|
dockerWorkspaceBaseDir: z.ZodOptional<z.ZodString>;
|
|
@@ -330,6 +353,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
330
353
|
sandboxSelfhostedControlTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
331
354
|
sandboxLeaseReaperPeriodMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
332
355
|
sandboxViewerHolderTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
356
|
+
sandboxInteractionHolderTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
333
357
|
sandboxIdleGraceMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
334
358
|
sandboxSnapshotIntervalMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
335
359
|
sandboxSnapshotTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -508,6 +532,12 @@ export type ModelUsageInput = {
|
|
|
508
532
|
inputTokensDetails?: Record<string, number> | Array<Record<string, number>> | undefined;
|
|
509
533
|
requestUsageEntries?: ModelUsageInput[] | undefined;
|
|
510
534
|
};
|
|
535
|
+
export type ModelUsageCostBreakdown = {
|
|
536
|
+
/** Provider-rate cost basis for the exact usage, before OpenGeni margin. */
|
|
537
|
+
providerCostMicros: number;
|
|
538
|
+
/** OpenGeni credit price after configured margin and latency-mode multiplier. */
|
|
539
|
+
creditCostMicros: number;
|
|
540
|
+
};
|
|
511
541
|
export type StaticUsageLimitsConfig = StaticUsageLimits;
|
|
512
542
|
export type EntitlementsConfig = Entitlements;
|
|
513
543
|
export declare const CapabilitySupportV1: z.ZodEnum<{
|
|
@@ -594,6 +624,14 @@ export declare const ModelCapabilitiesV1Schema: z.ZodObject<{
|
|
|
594
624
|
}>;
|
|
595
625
|
runnable: z.ZodBoolean;
|
|
596
626
|
}, z.core.$strip>;
|
|
627
|
+
imageGeneration: z.ZodDefault<z.ZodObject<{
|
|
628
|
+
upstream: z.ZodEnum<{
|
|
629
|
+
supported: "supported";
|
|
630
|
+
unknown: "unknown";
|
|
631
|
+
unsupported: "unsupported";
|
|
632
|
+
}>;
|
|
633
|
+
runnable: z.ZodBoolean;
|
|
634
|
+
}, z.core.$strip>>;
|
|
597
635
|
}, z.core.$strip>;
|
|
598
636
|
inputModalities: z.ZodArray<z.ZodEnum<{
|
|
599
637
|
audio: "audio";
|
|
@@ -813,6 +851,14 @@ declare const RegistryProviderSchema: z.ZodObject<{
|
|
|
813
851
|
}>;
|
|
814
852
|
runnable: z.ZodBoolean;
|
|
815
853
|
}, z.core.$strip>;
|
|
854
|
+
imageGeneration: z.ZodDefault<z.ZodObject<{
|
|
855
|
+
upstream: z.ZodEnum<{
|
|
856
|
+
supported: "supported";
|
|
857
|
+
unknown: "unknown";
|
|
858
|
+
unsupported: "unsupported";
|
|
859
|
+
}>;
|
|
860
|
+
runnable: z.ZodBoolean;
|
|
861
|
+
}, z.core.$strip>>;
|
|
816
862
|
}, z.core.$strip>;
|
|
817
863
|
inputModalities: z.ZodArray<z.ZodEnum<{
|
|
818
864
|
audio: "audio";
|
|
@@ -1081,6 +1127,7 @@ export declare function effectiveModalIdleTimeoutSeconds(settings: Settings): nu
|
|
|
1081
1127
|
* consumers at one hour.
|
|
1082
1128
|
*/
|
|
1083
1129
|
export declare function sandboxArchiveCaptureTimeoutMs(settings: Pick<Settings, "sandboxSnapshotTimeoutMs">): number;
|
|
1130
|
+
export declare function sandboxLifecycleTransitionWaitMs(settings: Pick<Settings, "sandboxSnapshotTimeoutMs" | "sandboxLeaseReaperPeriodMs">): number;
|
|
1084
1131
|
export declare function collectSandboxEnvironment(settings: Settings, source?: NodeJS.ProcessEnv): Record<string, string>;
|
|
1085
1132
|
/**
|
|
1086
1133
|
* Resolved API key for a registry provider: the inline `apiKey` when present,
|
|
@@ -1106,6 +1153,8 @@ export declare function productLabelForModelId(modelId: string): string;
|
|
|
1106
1153
|
* everything else returns null so callers fall back to the full `label`.
|
|
1107
1154
|
*/
|
|
1108
1155
|
export declare function productShortLabelForModelId(modelId: string): string | null;
|
|
1156
|
+
/** Undefined and the exact public OpenAI v1 endpoint are the same direct route. */
|
|
1157
|
+
export declare function isDirectOpenAiApiBaseUrl(baseUrl: string | undefined): boolean;
|
|
1109
1158
|
/**
|
|
1110
1159
|
* Map OpenGeni latency mode to the provider `service_tier` wire value.
|
|
1111
1160
|
* Azure and Codex ChatGPT accept `priority`; OpenAI API accepts `fast` (alias of priority).
|
|
@@ -1241,6 +1290,9 @@ export declare function configuredEntitlements(settings: Settings): Entitlements
|
|
|
1241
1290
|
export declare function calculateModelUsageCostMicros(settings: Settings, model: string, usage: ModelUsageInput, options?: {
|
|
1242
1291
|
latencyMode?: LatencyMode;
|
|
1243
1292
|
}): number;
|
|
1293
|
+
export declare function calculateModelUsageCostBreakdown(settings: Settings, model: string, usage: ModelUsageInput, options?: {
|
|
1294
|
+
latencyMode?: LatencyMode;
|
|
1295
|
+
}): ModelUsageCostBreakdown;
|
|
1244
1296
|
/**
|
|
1245
1297
|
* Convert AI Gateway's exact USD inference cost to OpenGeni credit micros and
|
|
1246
1298
|
* apply the configured model margin. Decimal arithmetic is integer-only so a
|
|
@@ -1249,6 +1301,19 @@ export declare function calculateModelUsageCostMicros(settings: Settings, model:
|
|
|
1249
1301
|
export declare function calculateGatewayReportedCostMicros(settings: Settings, model: string, inferenceCostUsd: string, options?: {
|
|
1250
1302
|
inputTokens?: number;
|
|
1251
1303
|
}): number;
|
|
1304
|
+
export declare function calculateGatewayReportedCostBreakdown(settings: Settings, model: string, inferenceCostUsd: string, options?: {
|
|
1305
|
+
inputTokens?: number;
|
|
1306
|
+
}): ModelUsageCostBreakdown;
|
|
1307
|
+
/**
|
|
1308
|
+
* Exact OpenGeni product price frozen before a managed video request starts.
|
|
1309
|
+
* Gateway reporting is delayed for asynchronous video, so this deliberately
|
|
1310
|
+
* does not masquerade as provider-reported cost.
|
|
1311
|
+
*/
|
|
1312
|
+
export declare function calculateVideoGenerationCreditCostMicros(settings: Settings, input: {
|
|
1313
|
+
modelId: string;
|
|
1314
|
+
resolution: VideoGenerationResolution;
|
|
1315
|
+
durationSeconds: number;
|
|
1316
|
+
}): number;
|
|
1252
1317
|
export declare function configuredAllowedReasoningEfforts(settings: Settings): Array<z.infer<typeof ReasoningEffort>>;
|
|
1253
1318
|
/**
|
|
1254
1319
|
* Decodes OPENGENI_ENVIRONMENTS_ENCRYPTION_KEY (base64, exactly 32 bytes) for
|
|
@@ -1412,6 +1477,7 @@ export declare function parseStaticEntitlementsJson(raw: string): EntitlementsCo
|
|
|
1412
1477
|
*/
|
|
1413
1478
|
export declare function firstPartyMcpBaseUrl(settings: Settings): string;
|
|
1414
1479
|
export declare function firstPartyMcpWorkspaceUrl(settings: Settings, workspaceId: string): string;
|
|
1480
|
+
export declare function codemodeWorkspaceUrl(settings: Settings, workspaceId: string): string;
|
|
1415
1481
|
/**
|
|
1416
1482
|
* Resolve the secret used to sign/verify scoped stream tokens (sandbox contract
|
|
1417
1483
|
* §C.3). Falls back to `delegationSecret` (the same HMAC envelope family —
|