@opengeni/config 1.3.0 → 1.4.0
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 +146 -4
- package/dist/index.js +1150 -541
- package/dist/index.js.map +1 -1
- package/dist/realtime-voice-pricing.d.ts +30 -0
- package/dist/web-search.d.ts +127 -0
- package/package.json +4 -4
- package/src/index.ts +545 -10
- package/src/realtime-voice-pricing.ts +83 -0
- package/src/web-search.ts +353 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { managedUserEmailAllowed } from "./managed-user-admission.js";
|
|
2
|
+
export * from "./realtime-voice-pricing.js";
|
|
3
|
+
export * from "./web-search.js";
|
|
2
4
|
export { CreditPromotionPolicy, signupCreditModelIds, promotionalCreditScope, } from "./credit-promotions.js";
|
|
3
5
|
import { type AgentConfigDeploymentLimits, Entitlements, LatencyMode, ReasoningEffort, SandboxBackend, StaticUsageLimits, TurnExecutionPolicyV1, type TurnExecutionLatencyModeSourceV1, type TurnExecutionModelSourceV1, type TurnExecutionReasoningSourceV1, type VideoGenerationResolution, type FirstPartyMcpToolName as FirstPartyMcpToolNameType } from "@opengeni/contracts";
|
|
4
6
|
import type { CodeSearchDeploymentPolicy } from "@opengeni/contracts/code-search";
|
|
@@ -534,6 +536,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
534
536
|
x_search_live: "x_search_live";
|
|
535
537
|
x_thread_fetch: "x_thread_fetch";
|
|
536
538
|
}>>>>;
|
|
539
|
+
artifactMaterializerDeployed: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
537
540
|
streamTokenSecret: z.ZodOptional<z.ZodString>;
|
|
538
541
|
streamControlEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
539
542
|
workDiscoveryEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
@@ -642,6 +645,20 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
642
645
|
voiceInputAzureApiVersion: z.ZodOptional<z.ZodString>;
|
|
643
646
|
voiceInputAzureApiKey: z.ZodOptional<z.ZodString>;
|
|
644
647
|
voiceInputAzureAdToken: z.ZodOptional<z.ZodString>;
|
|
648
|
+
azureLiveEndpoint: z.ZodOptional<z.ZodString>;
|
|
649
|
+
azureLiveApiKey: z.ZodOptional<z.ZodString>;
|
|
650
|
+
azureLiveDeployment: z.ZodDefault<z.ZodString>;
|
|
651
|
+
azureLiveVoice: z.ZodDefault<z.ZodString>;
|
|
652
|
+
azureLivePricingJson: z.ZodOptional<z.ZodString>;
|
|
653
|
+
aiGatewayRealtimePricingJson: z.ZodOptional<z.ZodString>;
|
|
654
|
+
voiceInputMaiEndpoint: z.ZodOptional<z.ZodString>;
|
|
655
|
+
voiceInputMaiApiKey: z.ZodOptional<z.ZodString>;
|
|
656
|
+
voiceInputMaiApiVersion: z.ZodDefault<z.ZodString>;
|
|
657
|
+
voiceInputMaiPricingJson: z.ZodOptional<z.ZodString>;
|
|
658
|
+
voiceInputMaiModel: z.ZodDefault<z.ZodString>;
|
|
659
|
+
voiceInputAzureModel: z.ZodOptional<z.ZodString>;
|
|
660
|
+
voiceInputOpenaiPricingJson: z.ZodOptional<z.ZodString>;
|
|
661
|
+
voiceInputAzurePricingJson: z.ZodOptional<z.ZodString>;
|
|
645
662
|
voiceInputCodexExperimentalEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
646
663
|
modelPricingJson: z.ZodDefault<z.ZodString>;
|
|
647
664
|
modelCatalogSource: z.ZodDefault<z.ZodEnum<{
|
|
@@ -697,6 +714,15 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
697
714
|
openaiReasoningEncryptedContent: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
698
715
|
openaiMaxRetries: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
699
716
|
webSearchEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
717
|
+
webSearchProvider: z.ZodOptional<z.ZodString>;
|
|
718
|
+
webSearchApiKey: z.ZodOptional<z.ZodString>;
|
|
719
|
+
webSearchBaseUrl: z.ZodOptional<z.ZodString>;
|
|
720
|
+
webFetchProvider: z.ZodOptional<z.ZodString>;
|
|
721
|
+
webFetchApiKey: z.ZodOptional<z.ZodString>;
|
|
722
|
+
webFetchBaseUrl: z.ZodOptional<z.ZodString>;
|
|
723
|
+
webSearchProviderMode: z.ZodOptional<z.ZodString>;
|
|
724
|
+
webSearchPricingJson: z.ZodOptional<z.ZodString>;
|
|
725
|
+
webSearchRequestTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
700
726
|
jevApiKey: z.ZodOptional<z.ZodString>;
|
|
701
727
|
jevBaseUrl: z.ZodDefault<z.ZodString>;
|
|
702
728
|
jevModel: z.ZodDefault<z.ZodString>;
|
|
@@ -1118,13 +1144,23 @@ export declare function googleDriveOAuthCallbackUrl(publicBaseUrl: string | unde
|
|
|
1118
1144
|
/** Exact callback registered on the environment-specific personal GitHub OAuth App. */
|
|
1119
1145
|
export declare function personalGitHubOAuthCallbackUrl(publicBaseUrl: string | undefined): string | null;
|
|
1120
1146
|
/** Declarative voice-input transcription provider ids. */
|
|
1121
|
-
export type VoiceInputProviderId = "openai" | "azure-openai" | "codex-subscription" | "supergrok-subscription";
|
|
1147
|
+
export type VoiceInputProviderId = "openai" | "azure-openai" | "azure-mai" | "codex-subscription" | "supergrok-subscription";
|
|
1122
1148
|
export type VoiceInputProviderConfig = {
|
|
1149
|
+
id: "azure-mai";
|
|
1150
|
+
kind: "azure-mai";
|
|
1151
|
+
pricing: VoiceInputPricing | null;
|
|
1152
|
+
endpoint: string;
|
|
1153
|
+
apiKey: string;
|
|
1154
|
+
apiVersion: string;
|
|
1155
|
+
model: string;
|
|
1156
|
+
} | {
|
|
1123
1157
|
id: "openai";
|
|
1124
1158
|
kind: "openai";
|
|
1125
1159
|
apiKey: string;
|
|
1126
1160
|
baseUrl: string;
|
|
1127
1161
|
model: string;
|
|
1162
|
+
/** Deployment-funded: Opengeni pays upstream and charges credits. */
|
|
1163
|
+
pricing: VoiceInputPricing | null;
|
|
1128
1164
|
} | {
|
|
1129
1165
|
id: "azure-openai";
|
|
1130
1166
|
kind: "azure-openai";
|
|
@@ -1133,6 +1169,10 @@ export type VoiceInputProviderConfig = {
|
|
|
1133
1169
|
apiVersion: string;
|
|
1134
1170
|
apiKey: string | null;
|
|
1135
1171
|
adToken: string | null;
|
|
1172
|
+
/** Underlying model (pricing + response shape); defaults to the deployment name. */
|
|
1173
|
+
model: string;
|
|
1174
|
+
/** Deployment-funded: Opengeni pays upstream and charges credits. */
|
|
1175
|
+
pricing: VoiceInputPricing | null;
|
|
1136
1176
|
} | {
|
|
1137
1177
|
id: "codex-subscription";
|
|
1138
1178
|
kind: "codex-subscription";
|
|
@@ -1145,7 +1185,7 @@ export type VoiceInputProviderConfig = {
|
|
|
1145
1185
|
/** The deployment's Jev key, or undefined when it is missing or a placeholder. */
|
|
1146
1186
|
export declare function usableJevApiKey(settings: Pick<Settings, "jevApiKey">): string | undefined;
|
|
1147
1187
|
/** Deployment half of agent configuration: hard capability limits. */
|
|
1148
|
-
export declare function agentConfigDeploymentPolicy(settings: Pick<Settings, "webSearchEnabled"
|
|
1188
|
+
export declare function agentConfigDeploymentPolicy(settings: FirstPartyMcpToolPolicySettings & Pick<Settings, "webSearchEnabled">): AgentConfigDeploymentLimits;
|
|
1149
1189
|
/**
|
|
1150
1190
|
* Deployment half of the `code_search` decision. `available` is false when
|
|
1151
1191
|
* the mode is off or no usable Jev key is configured; workspaces then cannot
|
|
@@ -1164,6 +1204,93 @@ export declare function isUsableVoiceInputSecret(value: string | null | undefine
|
|
|
1164
1204
|
* whether at least one non-experimental (or probed experimental) provider exists.
|
|
1165
1205
|
*/
|
|
1166
1206
|
export declare function resolveVoiceInputProviderRegistry(settings: Settings): VoiceInputProviderConfig[];
|
|
1207
|
+
/** Why a credentialed deployment-funded voice provider is withheld. */
|
|
1208
|
+
export type VoiceInputPricingIssue = {
|
|
1209
|
+
providerId: "openai" | "azure-openai" | "azure-mai";
|
|
1210
|
+
env: string;
|
|
1211
|
+
reason: "malformed" | "unpriced";
|
|
1212
|
+
message: string;
|
|
1213
|
+
};
|
|
1214
|
+
/**
|
|
1215
|
+
* Pricing problems that withhold a credentialed deployment-funded provider.
|
|
1216
|
+
* A malformed PRICING_JSON never fails boot (workers share this config and
|
|
1217
|
+
* must not crash-loop over a voice-only setting); the API logs each issue
|
|
1218
|
+
* once at startup and the provider stays unavailable.
|
|
1219
|
+
*/
|
|
1220
|
+
export declare function voiceInputPricingIssues(settings: Settings): VoiceInputPricingIssue[];
|
|
1221
|
+
/**
|
|
1222
|
+
* Opengeni credit price for one deployment-funded transcription provider.
|
|
1223
|
+
* Rates are upstream list prices in integer USD micros; `marginBps` (500 =
|
|
1224
|
+
* +5%) is added on top, exactly like model pricing. `microsPerMinute` prices
|
|
1225
|
+
* provider-reported audio duration (Whisper, `usage.type: "duration"`) and is
|
|
1226
|
+
* a server-measured WAV duration when provider usage is absent. Token
|
|
1227
|
+
* rates price `usage.type: "tokens"` (gpt-4o-transcribe family); `input`
|
|
1228
|
+
* covers text input tokens and, unless `audioInput` is set, audio tokens.
|
|
1229
|
+
*/
|
|
1230
|
+
export type VoiceInputPricing = {
|
|
1231
|
+
microsPerMinute: number;
|
|
1232
|
+
inputMicrosPerMillionTokens?: number | undefined;
|
|
1233
|
+
audioInputMicrosPerMillionTokens?: number | undefined;
|
|
1234
|
+
outputMicrosPerMillionTokens?: number | undefined;
|
|
1235
|
+
marginBps?: number | undefined;
|
|
1236
|
+
};
|
|
1237
|
+
/**
|
|
1238
|
+
* Built-in list prices (OpenAI API pricing, "Transcription models" table)
|
|
1239
|
+
* plus the default 5% Opengeni margin used for model pricing. Azure Global
|
|
1240
|
+
* Standard deployments use the same list prices; set the provider
|
|
1241
|
+
* PRICING_JSON when a deployment's contracted or regional price differs.
|
|
1242
|
+
*/
|
|
1243
|
+
export declare const defaultVoiceInputPricing: Readonly<Record<string, VoiceInputPricing>>;
|
|
1244
|
+
/** Lowercased model with a dated snapshot suffix (`-2025-03-20`) removed. */
|
|
1245
|
+
export declare function canonicalVoiceInputModel(model: string): string;
|
|
1246
|
+
/** Whisper reports its billed audio duration only in `verbose_json`. */
|
|
1247
|
+
export declare function voiceInputModelReportsDurationOnly(model: string): boolean;
|
|
1248
|
+
/** Parse one provider pricing JSON. Throws a configuration error when malformed. */
|
|
1249
|
+
export declare function parseVoiceInputPricingJson(raw: string | undefined, env?: string): VoiceInputPricing | null;
|
|
1250
|
+
/** Explicit provider pricing JSON wins; otherwise the built-in list price for the model. */
|
|
1251
|
+
export declare function resolveVoiceInputPricing(raw: string | undefined, model: string): VoiceInputPricing | null;
|
|
1252
|
+
/** Non-throwing {@link resolveVoiceInputPricing} for registry resolution. */
|
|
1253
|
+
export declare function safeResolveVoiceInputPricing(raw: string | undefined, model: string, env?: string): {
|
|
1254
|
+
ok: true;
|
|
1255
|
+
pricing: VoiceInputPricing | null;
|
|
1256
|
+
} | {
|
|
1257
|
+
ok: false;
|
|
1258
|
+
error: string;
|
|
1259
|
+
};
|
|
1260
|
+
/** Same predicate as model/credit limits: credit balance and debits are enforced. */
|
|
1261
|
+
export declare function voiceInputCreditBillingActive(settings: Pick<Settings, "billingMode" | "usageLimitsMode">): boolean;
|
|
1262
|
+
/** Provider-reported transcription usage, normalized. Never client-reported. */
|
|
1263
|
+
export type VoiceInputUsage = {
|
|
1264
|
+
kind: "tokens";
|
|
1265
|
+
inputTokens: number;
|
|
1266
|
+
audioInputTokens: number;
|
|
1267
|
+
textInputTokens: number;
|
|
1268
|
+
outputTokens: number;
|
|
1269
|
+
} | {
|
|
1270
|
+
kind: "duration";
|
|
1271
|
+
seconds: number;
|
|
1272
|
+
};
|
|
1273
|
+
export type VoiceInputCost = {
|
|
1274
|
+
/** Upstream list cost before margin, rounded up to whole micros. */
|
|
1275
|
+
providerCostMicros: number;
|
|
1276
|
+
/** Opengeni credit price after margin, rounded up to whole micros. */
|
|
1277
|
+
creditCostMicros: number;
|
|
1278
|
+
};
|
|
1279
|
+
/** True when token usage can be priced exactly. */
|
|
1280
|
+
export declare function voiceInputPricingHasTokenRates(pricing: VoiceInputPricing): boolean;
|
|
1281
|
+
/**
|
|
1282
|
+
* Exact integer credit math. Token usage needs token rates; duration usage
|
|
1283
|
+
* uses `microsPerMinute` at millisecond resolution. Both round up once, after
|
|
1284
|
+
* summing, so a positive use never becomes a free debit.
|
|
1285
|
+
*/
|
|
1286
|
+
export declare function calculateVoiceInputCost(pricing: VoiceInputPricing, usage: VoiceInputUsage): VoiceInputCost;
|
|
1287
|
+
/**
|
|
1288
|
+
* Deployment-funded providers that have credentials but are withheld because
|
|
1289
|
+
* credit billing is active and no price is known. The API logs these (and
|
|
1290
|
+
* malformed pricing, see {@link voiceInputPricingIssues}) once at startup so
|
|
1291
|
+
* an operator sees why voice input stayed unavailable.
|
|
1292
|
+
*/
|
|
1293
|
+
export declare function unpricedVoiceInputProviders(settings: Settings): VoiceInputProviderId[];
|
|
1167
1294
|
/** True when the deployment has at least one supported (non-experimental) provider. */
|
|
1168
1295
|
export declare function voiceInputDeploymentConfigured(settings: Settings): boolean;
|
|
1169
1296
|
export type TemporalTlsConnectionConfig = {
|
|
@@ -2883,10 +3010,17 @@ export type FirstPartyMcpToolPolicy = {
|
|
|
2883
3010
|
default: FirstPartyMcpToolNameType[];
|
|
2884
3011
|
allowed: FirstPartyMcpToolNameType[];
|
|
2885
3012
|
};
|
|
3013
|
+
export type FirstPartyMcpToolPolicySettings = Pick<Settings, "defaultFirstPartyMcpTools" | "allowedFirstPartyMcpTools" | "artifactMaterializerDeployed">;
|
|
3014
|
+
/**
|
|
3015
|
+
* First-party tools whose backing workload this deployment does not run. They
|
|
3016
|
+
* are absent from the ceiling (never offered) and an explicit request for one
|
|
3017
|
+
* is dropped rather than rejected: it is a deployment fact, not a caller error.
|
|
3018
|
+
*/
|
|
3019
|
+
export declare function deploymentUnavailableFirstPartyMcpTools(settings: Pick<Settings, "artifactMaterializerDeployed">): ReadonlySet<FirstPartyMcpToolNameType>;
|
|
2886
3020
|
/** Resolve the deployment's session-tool defaults and hard execution ceiling. */
|
|
2887
|
-
export declare function resolveFirstPartyMcpToolPolicy(settings:
|
|
3021
|
+
export declare function resolveFirstPartyMcpToolPolicy(settings: FirstPartyMcpToolPolicySettings): FirstPartyMcpToolPolicy;
|
|
2888
3022
|
/** Apply the deployment ceiling to an existing durable session selection. */
|
|
2889
|
-
export declare function allowedFirstPartyMcpToolsForSession(settings:
|
|
3023
|
+
export declare function allowedFirstPartyMcpToolsForSession(settings: FirstPartyMcpToolPolicySettings, selected: readonly FirstPartyMcpToolNameType[] | null | undefined): FirstPartyMcpToolNameType[];
|
|
2890
3024
|
/**
|
|
2891
3025
|
* The Modal sandbox idle timeout (seconds) the provider actually passes as
|
|
2892
3026
|
* idleTimeoutMs (sandbox-file-persistence). When the operator did not pin
|
|
@@ -3013,6 +3147,14 @@ export declare class UnsupportedLatencyModeError extends Error {
|
|
|
3013
3147
|
constructor(modelId: string, latencyMode: LatencyMode, allowedLatencyModes: readonly LatencyMode[]);
|
|
3014
3148
|
}
|
|
3015
3149
|
export declare function modelCostClassForConfiguredModel(_settings: Settings, model: Pick<ConfiguredModel, "cost">): ConfiguredModelCostClass;
|
|
3150
|
+
/**
|
|
3151
|
+
* The executable model an accepted turn runs: the current definition, except
|
|
3152
|
+
* that a turn frozen before hosted web search was enabled keeps its frozen
|
|
3153
|
+
* tool set (no web_search) on every recovery attempt. Only the next accepted
|
|
3154
|
+
* logical turn resolves the newly enabled tool. Call only with a policy that
|
|
3155
|
+
* already passed assertTurnExecutionPolicyMatchesConfigV1.
|
|
3156
|
+
*/
|
|
3157
|
+
export declare function configuredModelForAcceptedTurnExecutionPolicy(model: ConfiguredModel, provider: ResolvedModelProvider, policy: TurnExecutionPolicyV1): ConfiguredModel;
|
|
3016
3158
|
/**
|
|
3017
3159
|
* The built-in provider's stable id: "openai" on the OpenAI platform, "azure"
|
|
3018
3160
|
* on Azure. Exported because the workspace model-policy gate must attribute
|