@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 +27 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +67 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/config",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "OpenGeni runtime configuration: settings resolution, deployment knobs, and config validation shared across the server packages.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@opengeni/codex": "1.4.
|
|
37
|
-
"@opengeni/contracts": "1.4.
|
|
38
|
-
"@opengeni/xai-subscription": "1.4.
|
|
36
|
+
"@opengeni/codex": "1.4.4",
|
|
37
|
+
"@opengeni/contracts": "1.4.4",
|
|
38
|
+
"@opengeni/xai-subscription": "1.4.4",
|
|
39
39
|
"zod": "^4.2.1"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
package/src/index.ts
CHANGED
|
@@ -67,6 +67,24 @@ import { createHash } from "node:crypto";
|
|
|
67
67
|
import { isIP } from "node:net";
|
|
68
68
|
import { z } from "zod";
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Default maximum provider silence on a generic OpenAI-compatible model stream
|
|
72
|
+
* while the worker is waiting for the next chunk. Matches the Codex transport
|
|
73
|
+
* and SuperGrok idle defaults (5 minutes): long enough for a reasoning model's
|
|
74
|
+
* silent thinking gaps, short enough that a wedged stream recovers the same
|
|
75
|
+
* turn instead of hanging until a worker roll.
|
|
76
|
+
*/
|
|
77
|
+
export const DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS = 300_000;
|
|
78
|
+
/**
|
|
79
|
+
* Default maximum wait across keepalive-only traffic (SSE comments, `ping` /
|
|
80
|
+
* `keepalive` events, repeated `response.in_progress`) for the next
|
|
81
|
+
* model-progress event on a generic model stream. A provider can keep a
|
|
82
|
+
* connection alive while its generation is wedged; this bounds that case.
|
|
83
|
+
* Ten minutes leaves room for a reasoning model's longest silent thinking
|
|
84
|
+
* window (reasoning summaries stream as progress).
|
|
85
|
+
*/
|
|
86
|
+
export const DEFAULT_MODEL_STREAM_PROGRESS_TIMEOUT_MS = 600_000;
|
|
87
|
+
|
|
70
88
|
const envName = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
71
89
|
const registryId = /^[A-Za-z0-9_-]+$/;
|
|
72
90
|
export const DEFAULT_OPENROUTER_MODEL_ID =
|
|
@@ -809,6 +827,29 @@ const SettingsSchema = z.object({
|
|
|
809
827
|
.positive()
|
|
810
828
|
.max(24 * 60 * 60_000)
|
|
811
829
|
.default(XAI_RESPONSE_STREAM_IDLE_TIMEOUT_MS),
|
|
830
|
+
// Maximum silence between response bytes on a generic OpenAI-compatible
|
|
831
|
+
// model stream (built-in OpenAI/Azure and registry chat/responses providers).
|
|
832
|
+
// Not a request/run duration cap: every received byte resets the timer, and
|
|
833
|
+
// it measures only time spent waiting on the provider for the next chunk. A
|
|
834
|
+
// stalled stream fails as a retryable provider failure so finite same-turn
|
|
835
|
+
// recovery replaces it. A registry provider may override it with
|
|
836
|
+
// `streamIdleTimeoutMs`. Codex, SuperGrok, and Anthropic Messages own their
|
|
837
|
+
// transport-specific idle timers.
|
|
838
|
+
modelStreamIdleTimeoutMs: z.coerce
|
|
839
|
+
.number()
|
|
840
|
+
.int()
|
|
841
|
+
.positive()
|
|
842
|
+
.max(24 * 60 * 60_000)
|
|
843
|
+
.default(DEFAULT_MODEL_STREAM_IDLE_TIMEOUT_MS),
|
|
844
|
+
// Maximum wait across keepalive-only stream traffic for the next
|
|
845
|
+
// model-progress event (registry override: `streamProgressTimeoutMs`).
|
|
846
|
+
// Never shorter than modelStreamIdleTimeoutMs.
|
|
847
|
+
modelStreamProgressTimeoutMs: z.coerce
|
|
848
|
+
.number()
|
|
849
|
+
.int()
|
|
850
|
+
.positive()
|
|
851
|
+
.max(24 * 60 * 60_000)
|
|
852
|
+
.default(DEFAULT_MODEL_STREAM_PROGRESS_TIMEOUT_MS),
|
|
812
853
|
// Expose the connected apps attached to a Codex subscription through the
|
|
813
854
|
// synthetic codex_apps MCP server. Independent from subscription routing so
|
|
814
855
|
// operators can use Codex models without exposing ChatGPT connectors.
|
|
@@ -2682,6 +2723,20 @@ const RegistryProviderSchema = z
|
|
|
2682
2723
|
label: z.string().min(1).optional(),
|
|
2683
2724
|
api: ModelProviderApi.default("chat"),
|
|
2684
2725
|
anthropic: AnthropicProviderOptions.optional(),
|
|
2726
|
+
// Generic OpenAI-compatible stream silence bound; overrides the deployment
|
|
2727
|
+
// `modelStreamIdleTimeoutMs` for this provider only.
|
|
2728
|
+
streamIdleTimeoutMs: z
|
|
2729
|
+
.number()
|
|
2730
|
+
.int()
|
|
2731
|
+
.positive()
|
|
2732
|
+
.max(24 * 60 * 60_000)
|
|
2733
|
+
.optional(),
|
|
2734
|
+
streamProgressTimeoutMs: z
|
|
2735
|
+
.number()
|
|
2736
|
+
.int()
|
|
2737
|
+
.positive()
|
|
2738
|
+
.max(24 * 60 * 60_000)
|
|
2739
|
+
.optional(),
|
|
2685
2740
|
wireProfile: ModelProviderWireProfile.default("openai"),
|
|
2686
2741
|
baseUrl: z.string().url(),
|
|
2687
2742
|
apiKey: z.string().optional(), // inline key (pragmatic) ...
|
|
@@ -3174,6 +3229,10 @@ export interface ResolvedModelProvider {
|
|
|
3174
3229
|
defaultHeaders?: Record<string, string> | undefined;
|
|
3175
3230
|
publicDefaultQueryNames?: string[] | undefined;
|
|
3176
3231
|
publicDefaultHeaderNames?: string[] | undefined;
|
|
3232
|
+
/** Generic OpenAI-compatible stream silence bound override (ms). */
|
|
3233
|
+
streamIdleTimeoutMs?: number | undefined;
|
|
3234
|
+
/** Generic OpenAI-compatible keepalive-only progress bound override (ms). */
|
|
3235
|
+
streamProgressTimeoutMs?: number | undefined;
|
|
3177
3236
|
credentialSource: CredentialSourceV1;
|
|
3178
3237
|
billing: BillingAttributionV1;
|
|
3179
3238
|
}
|
|
@@ -4049,6 +4108,8 @@ export function getSettings(source: NodeJS.ProcessEnv = process.env): Settings {
|
|
|
4049
4108
|
supergrokResponseStreamIdleTimeoutMs: optional(
|
|
4050
4109
|
"OPENGENI_SUPERGROK_RESPONSE_STREAM_IDLE_TIMEOUT_MS",
|
|
4051
4110
|
),
|
|
4111
|
+
modelStreamIdleTimeoutMs: optional("OPENGENI_MODEL_STREAM_IDLE_TIMEOUT_MS"),
|
|
4112
|
+
modelStreamProgressTimeoutMs: optional("OPENGENI_MODEL_STREAM_PROGRESS_TIMEOUT_MS"),
|
|
4052
4113
|
codexConnectedAppsEnabled: optional("OPENGENI_CODEX_CONNECTED_APPS_ENABLED"),
|
|
4053
4114
|
codexToolSearchEnabled: optional("OPENGENI_CODEX_TOOL_SEARCH_ENABLED"),
|
|
4054
4115
|
lazyToolSearchEnabled: optional("OPENGENI_LAZY_TOOL_SEARCH_ENABLED"),
|
|
@@ -6006,6 +6067,12 @@ export function configuredProviders(
|
|
|
6006
6067
|
defaultHeaders: provider.defaultHeaders,
|
|
6007
6068
|
publicDefaultQueryNames: provider.publicDefaultQueryNames,
|
|
6008
6069
|
publicDefaultHeaderNames: provider.publicDefaultHeaderNames,
|
|
6070
|
+
...(provider.streamIdleTimeoutMs !== undefined
|
|
6071
|
+
? { streamIdleTimeoutMs: provider.streamIdleTimeoutMs }
|
|
6072
|
+
: {}),
|
|
6073
|
+
...(provider.streamProgressTimeoutMs !== undefined
|
|
6074
|
+
? { streamProgressTimeoutMs: provider.streamProgressTimeoutMs }
|
|
6075
|
+
: {}),
|
|
6009
6076
|
credentialSource: registryCredentialSource(provider),
|
|
6010
6077
|
billing: registryBilling(provider),
|
|
6011
6078
|
}),
|