@opengeni/config 1.4.0 → 1.4.4

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 CHANGED
@@ -6,6 +6,23 @@ import { type AgentConfigDeploymentLimits, Entitlements, LatencyMode, ReasoningE
6
6
  import type { CodeSearchDeploymentPolicy } from "@opengeni/contracts/code-search";
7
7
  export { XAI_SUBSCRIPTION_MODEL_ID_PREFIX } from "@opengeni/xai-subscription";
8
8
  import { z } from "zod";
9
+ /**
10
+ * Default maximum provider silence on a generic OpenAI-compatible model stream
11
+ * while the worker is waiting for the next chunk. Matches the Codex transport
12
+ * and SuperGrok idle defaults (5 minutes): long enough for a reasoning model's
13
+ * silent thinking gaps, short enough that a wedged stream recovers the same
14
+ * turn instead of hanging until a worker roll.
15
+ */
16
+ export declare const DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS = 300000;
17
+ /**
18
+ * Default maximum wait across keepalive-only traffic (SSE comments, `ping` /
19
+ * `keepalive` events, repeated `response.in_progress`) for the next
20
+ * model-progress event on a generic model stream. A provider can keep a
21
+ * connection alive while its generation is wedged; this bounds that case.
22
+ * Ten minutes leaves room for a reasoning model's longest silent thinking
23
+ * window (reasoning summaries stream as progress).
24
+ */
25
+ export declare const DEFAULT_MODEL_STREAM_PROGRESS_TIMEOUT_MS = 600000;
9
26
  export declare const DEFAULT_OPENROUTER_MODEL_ID: "openrouter/nvidia/nemotron-3-super-120b-a12b:free";
10
27
  export declare const DEFAULT_MODEL_COST_POLICY_JSON: string;
11
28
  export declare const SANDBOX_ARCHIVE_CAPTURE_MAX_TIMEOUT_MS: number;
@@ -676,6 +693,8 @@ declare const SettingsSchema: z.ZodObject<{
676
693
  supergrokSubscriptionEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
677
694
  claudeSubscriptionEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
678
695
  supergrokResponseStreamIdleTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
696
+ modelStreamIdleTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
697
+ modelStreamProgressTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
679
698
  codexConnectedAppsEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
680
699
  codexProductSku: z.ZodOptional<z.ZodString>;
681
700
  codexToolSearchEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
@@ -1672,6 +1691,8 @@ declare const RegistryProviderSchema: z.ZodObject<{
1672
1691
  maxOutputTokens: z.ZodDefault<z.ZodNumber>;
1673
1692
  streamIdleTimeoutMs: z.ZodDefault<z.ZodNumber>;
1674
1693
  }, z.core.$strip>>;
1694
+ streamIdleTimeoutMs: z.ZodOptional<z.ZodNumber>;
1695
+ streamProgressTimeoutMs: z.ZodOptional<z.ZodNumber>;
1675
1696
  wireProfile: z.ZodDefault<z.ZodEnum<{
1676
1697
  "azure-openai": "azure-openai";
1677
1698
  openai: "openai";
@@ -2135,6 +2156,8 @@ export declare const ModelCatalogDocument: z.ZodObject<{
2135
2156
  maxOutputTokens: z.ZodDefault<z.ZodNumber>;
2136
2157
  streamIdleTimeoutMs: z.ZodDefault<z.ZodNumber>;
2137
2158
  }, z.core.$strip>>;
2159
+ streamIdleTimeoutMs: z.ZodOptional<z.ZodNumber>;
2160
+ streamProgressTimeoutMs: z.ZodOptional<z.ZodNumber>;
2138
2161
  wireProfile: z.ZodDefault<z.ZodEnum<{
2139
2162
  "azure-openai": "azure-openai";
2140
2163
  openai: "openai";
@@ -2852,6 +2875,10 @@ export interface ResolvedModelProvider {
2852
2875
  defaultHeaders?: Record<string, string> | undefined;
2853
2876
  publicDefaultQueryNames?: string[] | undefined;
2854
2877
  publicDefaultHeaderNames?: string[] | undefined;
2878
+ /** Generic OpenAI-compatible stream silence bound override (ms). */
2879
+ streamIdleTimeoutMs?: number | undefined;
2880
+ /** Generic OpenAI-compatible keepalive-only progress bound override (ms). */
2881
+ streamProgressTimeoutMs?: number | undefined;
2855
2882
  credentialSource: CredentialSourceV1;
2856
2883
  billing: BillingAttributionV1;
2857
2884
  }
@@ -3503,6 +3530,13 @@ export declare function sandboxWarmRateMicrosPerSecond(settings: Settings, backe
3503
3530
  */
3504
3531
  export declare function parseModelProvidersJson(raw: string): RegistryProvider[];
3505
3532
  export declare function parseIntegrationsOauthClientsJson(raw: string | undefined): Record<string, IntegrationOAuthClientConfig>;
3533
+ /**
3534
+ * The operator-registered client for one authorization server, matched by
3535
+ * exact issuer/URL key first and then trailing-slash-insensitively. The OAuth
3536
+ * start flow and the connector catalog's connectability projection share this
3537
+ * so a catalog row is offered exactly when a start would find a client.
3538
+ */
3539
+ export declare function findIntegrationsOauthClient(configured: Readonly<Record<string, IntegrationOAuthClientConfig>>, candidates: readonly string[]): IntegrationOAuthClientConfig | null;
3506
3540
  export declare const SocialOAuthClientConfigSchema: z.ZodObject<{
3507
3541
  clientId: z.ZodString;
3508
3542
  clientSecret: z.ZodOptional<z.ZodString>;
package/dist/index.js CHANGED
@@ -714,6 +714,8 @@ function claudeSubscriptionCapacity(usage, upstreamModelId, now, options = {}) {
714
714
  }
715
715
 
716
716
  // src/index.ts
717
+ var DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS = 3e5;
718
+ var DEFAULT_MODEL_STREAM_PROGRESS_TIMEOUT_MS = 6e5;
717
719
  var envName = /^[A-Za-z_][A-Za-z0-9_]*$/;
718
720
  var registryId = /^[A-Za-z0-9_-]+$/;
719
721
  var DEFAULT_OPENROUTER_MODEL_ID = "openrouter/nvidia/nemotron-3-super-120b-a12b:free";
@@ -1267,6 +1269,19 @@ var SettingsSchema = z5.object({
1267
1269
  // Maximum silence between complete, valid SuperGrok SSE data events. This is
1268
1270
  // not a request/run duration cap; every valid event resets the timer.
1269
1271
  supergrokResponseStreamIdleTimeoutMs: z5.coerce.number().int().positive().max(24 * 60 * 6e4).default(XAI_RESPONSE_STREAM_IDLE_TIMEOUT_MS),
1272
+ // Maximum silence between response bytes on a generic OpenAI-compatible
1273
+ // model stream (built-in OpenAI/Azure and registry chat/responses providers).
1274
+ // Not a request/run duration cap: every received byte resets the timer, and
1275
+ // it measures only time spent waiting on the provider for the next chunk. A
1276
+ // stalled stream fails as a retryable provider failure so finite same-turn
1277
+ // recovery replaces it. A registry provider may override it with
1278
+ // `streamIdleTimeoutMs`. Codex, SuperGrok, and Anthropic Messages own their
1279
+ // transport-specific idle timers.
1280
+ modelStreamIdleTimeoutMs: z5.coerce.number().int().positive().max(24 * 60 * 6e4).default(DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS),
1281
+ // Maximum wait across keepalive-only stream traffic for the next
1282
+ // model-progress event (registry override: `streamProgressTimeoutMs`).
1283
+ // Never shorter than modelStreamIdleTimeoutMs.
1284
+ modelStreamProgressTimeoutMs: z5.coerce.number().int().positive().max(24 * 60 * 6e4).default(DEFAULT_MODEL_STREAM_PROGRESS_TIMEOUT_MS),
1270
1285
  // Expose the connected apps attached to a Codex subscription through the
1271
1286
  // synthetic codex_apps MCP server. Independent from subscription routing so
1272
1287
  // operators can use Codex models without exposing ChatGPT connectors.
@@ -2606,6 +2621,10 @@ var RegistryProviderSchema = z5.object({
2606
2621
  label: z5.string().min(1).optional(),
2607
2622
  api: ModelProviderApi.default("chat"),
2608
2623
  anthropic: AnthropicProviderOptions.optional(),
2624
+ // Generic OpenAI-compatible stream silence bound; overrides the deployment
2625
+ // `modelStreamIdleTimeoutMs` for this provider only.
2626
+ streamIdleTimeoutMs: z5.number().int().positive().max(24 * 60 * 6e4).optional(),
2627
+ streamProgressTimeoutMs: z5.number().int().positive().max(24 * 60 * 6e4).optional(),
2609
2628
  wireProfile: ModelProviderWireProfile.default("openai"),
2610
2629
  baseUrl: z5.string().url(),
2611
2630
  apiKey: z5.string().optional(),
@@ -3723,6 +3742,8 @@ function getSettings(source = process.env) {
3723
3742
  supergrokResponseStreamIdleTimeoutMs: optional(
3724
3743
  "OPENGENI_SUPERGROK_RESPONSE_STREAM_IDLE_TIMEOUT_MS"
3725
3744
  ),
3745
+ modelStreamIdleTimeoutMs: optional("OPENGENI_MODEL_STREAM_IDLE_TIMEOUT_MS"),
3746
+ modelStreamProgressTimeoutMs: optional("OPENGENI_MODEL_STREAM_PROGRESS_TIMEOUT_MS"),
3726
3747
  codexConnectedAppsEnabled: optional("OPENGENI_CODEX_CONNECTED_APPS_ENABLED"),
3727
3748
  codexToolSearchEnabled: optional("OPENGENI_CODEX_TOOL_SEARCH_ENABLED"),
3728
3749
  lazyToolSearchEnabled: optional("OPENGENI_LAZY_TOOL_SEARCH_ENABLED"),
@@ -5078,6 +5099,8 @@ function configuredProviders(settings, source = process.env) {
5078
5099
  defaultHeaders: provider.defaultHeaders,
5079
5100
  publicDefaultQueryNames: provider.publicDefaultQueryNames,
5080
5101
  publicDefaultHeaderNames: provider.publicDefaultHeaderNames,
5102
+ ...provider.streamIdleTimeoutMs !== void 0 ? { streamIdleTimeoutMs: provider.streamIdleTimeoutMs } : {},
5103
+ ...provider.streamProgressTimeoutMs !== void 0 ? { streamProgressTimeoutMs: provider.streamProgressTimeoutMs } : {},
5081
5104
  credentialSource: registryCredentialSource(provider),
5082
5105
  billing: registryBilling(provider)
5083
5106
  })
@@ -6428,6 +6451,18 @@ function parseIntegrationsOauthClientsJson(raw) {
6428
6451
  }
6429
6452
  return out;
6430
6453
  }
6454
+ function findIntegrationsOauthClient(configured, candidates) {
6455
+ const normalize = (value) => value.replace(/\/+$/, "");
6456
+ for (const key of new Set(candidates.flatMap((candidate) => [candidate, normalize(candidate)]))) {
6457
+ const entry = configured[key];
6458
+ if (entry) return entry;
6459
+ }
6460
+ const normalizedCandidates = new Set(candidates.map(normalize));
6461
+ for (const [key, entry] of Object.entries(configured)) {
6462
+ if (normalizedCandidates.has(normalize(key))) return entry;
6463
+ }
6464
+ return null;
6465
+ }
6431
6466
  var SocialOAuthClientConfigSchema = z5.object({
6432
6467
  clientId: z5.string().min(1),
6433
6468
  clientSecret: z5.string().min(1).optional()
@@ -7044,11 +7079,6 @@ function validateSettings(settings, source = process.env) {
7044
7079
  );
7045
7080
  }
7046
7081
  parseExposedPorts(settings.dockerExposedPorts);
7047
- parseRealtimeVoicePricingJson(settings.azureLivePricingJson, "OPENGENI_AZURE_LIVE_PRICING_JSON");
7048
- parseRealtimeVoicePricingTableJson(
7049
- settings.aiGatewayRealtimePricingJson,
7050
- "OPENGENI_AI_GATEWAY_REALTIME_PRICING_JSON"
7051
- );
7052
7082
  sandboxEnvironmentVariableNames(settings);
7053
7083
  sandboxLifecycleHookIds(settings);
7054
7084
  const warmRates = parseSandboxWarmRateJson(settings.sandboxWarmRateMicrosPerSecondJson);
@@ -7610,6 +7640,8 @@ export {
7610
7640
  DEFAULT_GOAL_IDLE_BACKOFF_MS,
7611
7641
  DEFAULT_MODAL_IMAGE_REF,
7612
7642
  DEFAULT_MODEL_COST_POLICY_JSON,
7643
+ DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS,
7644
+ DEFAULT_MODEL_STREAM_PROGRESS_TIMEOUT_MS,
7613
7645
  DEFAULT_OPENROUTER_MODEL_ID,
7614
7646
  DEFAULT_WEB_SEARCH_PRICING,
7615
7647
  GOOGLE_DRIVE_PROVIDER_REQUEST_TIMEOUT_MAX_MS,
@@ -7723,6 +7755,7 @@ export {
7723
7755
  effectiveSandboxLifecycle,
7724
7756
  emptyClaudeUsage,
7725
7757
  environmentsEncryptionKeyBytes,
7758
+ findIntegrationsOauthClient,
7726
7759
  firstPartyMcpBaseUrl,
7727
7760
  firstPartyMcpInternalBaseUrl,
7728
7761
  firstPartyMcpInternalWorkspaceUrl,