@opengeni/config 1.4.2 → 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
  }
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
  })
@@ -7617,6 +7640,8 @@ export {
7617
7640
  DEFAULT_GOAL_IDLE_BACKOFF_MS,
7618
7641
  DEFAULT_MODAL_IMAGE_REF,
7619
7642
  DEFAULT_MODEL_COST_POLICY_JSON,
7643
+ DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS,
7644
+ DEFAULT_MODEL_STREAM_PROGRESS_TIMEOUT_MS,
7620
7645
  DEFAULT_OPENROUTER_MODEL_ID,
7621
7646
  DEFAULT_WEB_SEARCH_PRICING,
7622
7647
  GOOGLE_DRIVE_PROVIDER_REQUEST_TIMEOUT_MAX_MS,