@opengeni/config 0.3.0 → 0.5.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 +79 -58
- package/dist/index.js +425 -204
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/index.ts +725 -340
package/dist/index.d.ts
CHANGED
|
@@ -25,10 +25,10 @@ declare const AGENT_INSTRUCTIONS_CORE_PLACEHOLDER = "{{core}}";
|
|
|
25
25
|
* baked into this overridable string.
|
|
26
26
|
*
|
|
27
27
|
* INVARIANT: with no per-workspace override and an empty environment, the
|
|
28
|
-
* runtime's composed instructions are
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
28
|
+
* runtime's composed instructions are byte-for-byte pinned by a runtime test.
|
|
29
|
+
* The template below is joined by " ", followed by " " + the placeholder.
|
|
30
|
+
* Changing a single character here changes that default; update the pin
|
|
31
|
+
* intentionally.
|
|
32
32
|
*/
|
|
33
33
|
declare const DEFAULT_AGENT_INSTRUCTIONS: string;
|
|
34
34
|
declare const McpServerConnectionRefSchema: z.ZodObject<{
|
|
@@ -105,25 +105,13 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
105
105
|
integrationsOauthClientsJson: z.ZodDefault<z.ZodString>;
|
|
106
106
|
goalMaxAutoContinuations: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
107
107
|
goalNoProgressLimit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
108
|
+
childCompletionParentWakeEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
108
109
|
agentMaxModelCallsPerTurn: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
109
|
-
sessionHistorySource: z.ZodDefault<z.ZodEnum<{
|
|
110
|
-
run_state: "run_state";
|
|
111
|
-
items: "items";
|
|
112
|
-
}>>;
|
|
113
|
-
contextCompactionMode: z.ZodDefault<z.ZodEnum<{
|
|
114
|
-
auto: "auto";
|
|
115
|
-
server: "server";
|
|
116
|
-
client: "client";
|
|
117
|
-
off: "off";
|
|
118
|
-
}>>;
|
|
119
110
|
contextWindowTokens: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
111
|
+
contextEffectiveWindowTokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
120
112
|
contextCompactionThresholdRatio: z.ZodPipe<z.ZodDefault<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number, number>>;
|
|
121
113
|
contextReservedOutputTokens: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
122
|
-
|
|
123
|
-
contextCompactSoftFraction: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
124
|
-
contextCompactHardFraction: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
125
|
-
contextKeepRecentTokens: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
126
|
-
contextSummaryMaxTokens: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
114
|
+
contextAutoCompactThresholdTokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
127
115
|
authRequired: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
128
116
|
accessKey: z.ZodOptional<z.ZodString>;
|
|
129
117
|
authAllowHealth: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
@@ -146,6 +134,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
146
134
|
codexSubscriptionEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
147
135
|
codexProductSku: z.ZodOptional<z.ZodString>;
|
|
148
136
|
codexToolSearchEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
137
|
+
codexCredentialLeasingEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
149
138
|
codexRotationNearExhaustionPct: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
150
139
|
openaiReasoningEffort: z.ZodDefault<z.ZodEnum<{
|
|
151
140
|
none: "none";
|
|
@@ -193,6 +182,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
193
182
|
dockerNetwork: z.ZodOptional<z.ZodString>;
|
|
194
183
|
modalAppName: z.ZodDefault<z.ZodString>;
|
|
195
184
|
modalImageRef: z.ZodOptional<z.ZodString>;
|
|
185
|
+
modalImageRegistrySecret: z.ZodOptional<z.ZodString>;
|
|
196
186
|
modalTimeoutSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
197
187
|
modalTokenId: z.ZodOptional<z.ZodString>;
|
|
198
188
|
modalTokenSecret: z.ZodOptional<z.ZodString>;
|
|
@@ -216,6 +206,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
216
206
|
"h264-mp4": "h264-mp4";
|
|
217
207
|
"vp9-webm": "vp9-webm";
|
|
218
208
|
}>>;
|
|
209
|
+
workspaceCaptureEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
219
210
|
recordingFramerate: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
220
211
|
recordingMaxSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
221
212
|
recordingMaxBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -260,7 +251,9 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
260
251
|
vercelTeamId: z.ZodOptional<z.ZodString>;
|
|
261
252
|
vercelRuntime: z.ZodOptional<z.ZodString>;
|
|
262
253
|
sandboxOwnershipEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
254
|
+
sandboxLazyProvisionEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
263
255
|
sandboxSelfhostedEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
256
|
+
agentOpStreamEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
264
257
|
enrollmentSigningSecret: z.ZodOptional<z.ZodString>;
|
|
265
258
|
selfhostedNatsUrl: z.ZodOptional<z.ZodString>;
|
|
266
259
|
selfhostedRelayUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -272,12 +265,17 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
272
265
|
selfhostedNatsCalloutPassword: z.ZodOptional<z.ZodString>;
|
|
273
266
|
selfhostedNatsControlUser: z.ZodOptional<z.ZodString>;
|
|
274
267
|
selfhostedNatsControlPassword: z.ZodOptional<z.ZodString>;
|
|
268
|
+
sandboxSelfhostedExecTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
269
|
+
sandboxSelfhostedControlTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
275
270
|
sandboxLeaseReaperPeriodMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
276
271
|
sandboxViewerHolderTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
277
272
|
sandboxIdleGraceMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
273
|
+
sandboxSnapshotIntervalMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
274
|
+
sandboxSnapshotTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
278
275
|
sandboxLeaseTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
279
276
|
sandboxLeaseWarmingTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
280
277
|
sandboxWarmingTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
278
|
+
rigSetupTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
281
279
|
sandboxWarmRateMicrosPerSecondJson: z.ZodDefault<z.ZodString>;
|
|
282
280
|
sandboxMaxWarmSecondsPerWorkspace: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
283
281
|
sandboxPreparationProfiles: z.ZodDefault<z.ZodString>;
|
|
@@ -424,6 +422,8 @@ declare const RegistryProviderSchema: z.ZodObject<{
|
|
|
424
422
|
id: z.ZodString;
|
|
425
423
|
label: z.ZodOptional<z.ZodString>;
|
|
426
424
|
contextWindowTokens: z.ZodOptional<z.ZodNumber>;
|
|
425
|
+
effectiveContextWindowTokens: z.ZodOptional<z.ZodNumber>;
|
|
426
|
+
autoCompactTokenLimit: z.ZodOptional<z.ZodNumber>;
|
|
427
427
|
reasoningEffort: z.ZodOptional<z.ZodBoolean>;
|
|
428
428
|
hostedWebSearch: z.ZodOptional<z.ZodBoolean>;
|
|
429
429
|
pricing: z.ZodOptional<z.ZodObject<{
|
|
@@ -448,9 +448,9 @@ type IntegrationOAuthClientConfig = z.infer<typeof IntegrationOAuthClientConfigS
|
|
|
448
448
|
/**
|
|
449
449
|
* Runtime-resolved provider (built-in or registry), client-construction-ready.
|
|
450
450
|
* The built-in OpenAI/Azure provider is always present and always "responses";
|
|
451
|
-
* registry providers carry their own base URL / key / wire API.
|
|
452
|
-
*
|
|
453
|
-
*
|
|
451
|
+
* registry providers carry their own base URL / key / wire API. Compaction is
|
|
452
|
+
* not a provider capability: all providers use the same durable plaintext
|
|
453
|
+
* replacement.
|
|
454
454
|
*/
|
|
455
455
|
interface ResolvedModelProvider {
|
|
456
456
|
id: string;
|
|
@@ -462,7 +462,6 @@ interface ResolvedModelProvider {
|
|
|
462
462
|
apiKey?: string | undefined;
|
|
463
463
|
defaultQuery?: Record<string, string> | undefined;
|
|
464
464
|
defaultHeaders?: Record<string, string> | undefined;
|
|
465
|
-
compactionMode: ContextCompactionMode;
|
|
466
465
|
}
|
|
467
466
|
/** A single exposed model + the provider that serves it. */
|
|
468
467
|
interface ConfiguredModel {
|
|
@@ -472,6 +471,8 @@ interface ConfiguredModel {
|
|
|
472
471
|
providerLabel: string;
|
|
473
472
|
api: ModelProviderApi;
|
|
474
473
|
contextWindowTokens?: number | undefined;
|
|
474
|
+
effectiveContextWindowTokens?: number | undefined;
|
|
475
|
+
autoCompactTokenLimit?: number | undefined;
|
|
475
476
|
reasoningEffort: boolean;
|
|
476
477
|
hostedWebSearch: boolean;
|
|
477
478
|
}
|
|
@@ -505,16 +506,37 @@ declare function collectSandboxEnvironment(settings: Settings, source?: NodeJS.P
|
|
|
505
506
|
* explicit environment in tests.
|
|
506
507
|
*/
|
|
507
508
|
declare function resolveProviderApiKey(provider: Pick<RegistryProvider, "apiKey" | "apiKeyEnv">, source?: NodeJS.ProcessEnv): string | undefined;
|
|
509
|
+
/**
|
|
510
|
+
* The built-in provider's stable id: "openai" on the OpenAI platform, "azure"
|
|
511
|
+
* on Azure. Exported because the workspace model-policy gate must attribute
|
|
512
|
+
* the legacy resolveTurnModel-null fallback (which routes to this built-in
|
|
513
|
+
* client) to the SAME identity the router uses — otherwise a policy blocking
|
|
514
|
+
* the built-in could be bypassed through the null-resolution path.
|
|
515
|
+
*/
|
|
516
|
+
declare function builtinProviderId(settings: Pick<Settings, "openaiProvider">): string;
|
|
508
517
|
/**
|
|
509
518
|
* Every provider a client may route to: the built-in OpenAI/Azure provider
|
|
510
|
-
* first (id "openai"/"azure", always "responses",
|
|
511
|
-
*
|
|
512
|
-
* order (compactionMode "client"). Client-construction inputs are filled from
|
|
519
|
+
* first (id "openai"/"azure", always "responses"), then each registry provider
|
|
520
|
+
* in declaration order. Client-construction inputs are filled from
|
|
513
521
|
* the existing flat openai/azure settings for the built-in, and from the
|
|
514
522
|
* registry entry for the rest. Registry ids may not collide with the built-in
|
|
515
523
|
* id — validateSettings rejects that at boot.
|
|
516
524
|
*/
|
|
517
525
|
declare function configuredProviders(settings: Settings): ResolvedModelProvider[];
|
|
526
|
+
/**
|
|
527
|
+
* The provider identity a model id resolves to, for workspace model-policy
|
|
528
|
+
* evaluation — MUST agree with the real router (resolveTurnModel /
|
|
529
|
+
* MultiProviderModelProvider) on every case:
|
|
530
|
+
* - `codex/<slug>` → the codex-subscription provider id, ALWAYS. With no
|
|
531
|
+
* active subscription the router fails loud (CodexSubscriptionUnavailableError),
|
|
532
|
+
* never the built-in — so attributing by prefix is exact even against BASE
|
|
533
|
+
* settings where the overlay provider is not injected.
|
|
534
|
+
* - a configured model id → its configuredModels providerId (registry or built-in).
|
|
535
|
+
* - anything else → the built-in id: an unknown id is the legacy
|
|
536
|
+
* resolveTurnModel-null fallback, which the built-in OpenAI/Azure client
|
|
537
|
+
* serves. A policy blocking the built-in must block this path too.
|
|
538
|
+
*/
|
|
539
|
+
declare function policyProviderIdForModel(settings: Settings, modelId: string): string;
|
|
518
540
|
/**
|
|
519
541
|
* Every model a client may use, the built-in provider's models first
|
|
520
542
|
* (configuredAllowedModels-from-openai, mapped to "responses" with
|
|
@@ -549,28 +571,16 @@ declare function resolveModelProvider(settings: Settings, modelId: string): {
|
|
|
549
571
|
*/
|
|
550
572
|
declare function configuredModelPricing(settings: Settings): Record<string, ModelPricing>;
|
|
551
573
|
/**
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
* SDK emits context_management; we pass the correct gpt-5.5 threshold).
|
|
555
|
-
* - "client": run OpenGeni's own client-side compaction (Azure and any other
|
|
556
|
-
* backend that rejects/ignores context_management).
|
|
557
|
-
* - "off": neither (legacy unbounded growth; escape hatch).
|
|
558
|
-
*
|
|
559
|
-
* "auto" maps to "server" on the OpenAI platform provider and "client"
|
|
560
|
-
* otherwise — Azure's Responses API returns 400 unsupported_parameter for
|
|
561
|
-
* context_management, so it must never take the server path.
|
|
574
|
+
* Usable input-token budget: an explicit model-catalog effective window when
|
|
575
|
+
* available, otherwise the deployment window minus its output reserve.
|
|
562
576
|
*/
|
|
563
|
-
|
|
564
|
-
declare function resolveContextCompactionMode(settings: Pick<Settings, "contextCompactionMode" | "openaiProvider">): ContextCompactionMode;
|
|
565
|
-
/** Usable input-token budget B = window - reserved output. */
|
|
566
|
-
declare function contextInputBudgetTokens(settings: Pick<Settings, "contextWindowTokens" | "contextReservedOutputTokens">): number;
|
|
577
|
+
declare function contextInputBudgetTokens(settings: Pick<Settings, "contextWindowTokens" | "contextEffectiveWindowTokens" | "contextReservedOutputTokens">): number;
|
|
567
578
|
/**
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
* fallback for gpt-5.5 (which is absent from its hardcoded window map).
|
|
579
|
+
* Apply the resolved provider/model's context policy to one turn. Registry
|
|
580
|
+
* metadata is authoritative when present; deployment defaults remain the
|
|
581
|
+
* fallback for models that do not declare their own limits.
|
|
572
582
|
*/
|
|
573
|
-
declare function
|
|
583
|
+
declare function settingsWithResolvedModelContext(settings: Settings, model: Pick<ConfiguredModel, "contextWindowTokens" | "effectiveContextWindowTokens" | "autoCompactTokenLimit">): Settings;
|
|
574
584
|
declare function configuredStaticUsageLimits(settings: Settings): StaticUsageLimitsConfig;
|
|
575
585
|
declare function configuredEntitlements(settings: Settings): EntitlementsConfig;
|
|
576
586
|
declare function calculateModelUsageCostMicros(settings: Settings, model: string, usage: ModelUsageInput): number;
|
|
@@ -608,20 +618,22 @@ declare function collectGitIdentityEnvironment(settings: Settings): Record<strin
|
|
|
608
618
|
* workspace environment < the backend-aware HOME default. Reserved-name validation
|
|
609
619
|
* at write time keeps workspace values from colliding with platform entries.
|
|
610
620
|
*
|
|
611
|
-
* DELIBERATELY EXCLUDES the per-run, ROTATING
|
|
612
|
-
*
|
|
621
|
+
* DELIBERATELY EXCLUDES the per-run, ROTATING git provider token VALUES that
|
|
622
|
+
* `sandboxEnvironmentForRun` mints when a repository resource is
|
|
613
623
|
* attached: that token is minted FRESH per call, so it is not a stable, attach-
|
|
614
624
|
* reproducible value and must not be part of the shared base. Under the token-
|
|
615
|
-
* broker (B1)
|
|
616
|
-
*
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
+
* broker (B1) token VALUES never ride the manifest at all — they are seeded to
|
|
626
|
+
* FILES inside the box and git/provider CLI auth reads those files. What IS stable
|
|
627
|
+
* and lives here for provisioned boxes are the token directory / GitHub alias
|
|
628
|
+
* FILE PATH and wrapper PATH entries: constants derived from HOME, so they
|
|
629
|
+
* appear IDENTICALLY on BOTH the turn AND every attach manifest (the SDK's
|
|
630
|
+
* per-turn provided-session env delta stays empty even as tokens rotate). These
|
|
631
|
+
* helper pointers are deliberately not added for selfhosted/local/none because
|
|
632
|
+
* the platform never mints or seeds git provider tokens there. The attach
|
|
633
|
+
* surfaces have only the `Session` (no repo resources) and so never seed a token,
|
|
634
|
+
* but unwritten files simply yield no auth; the BLOCKING attach-vs-turn error
|
|
635
|
+
* this helper fixes is for the common (no-repo) and workspace-environment-attached
|
|
636
|
+
* provisioned-box cases.
|
|
625
637
|
*/
|
|
626
638
|
declare function stableSandboxEnvironmentForRun(settings: Settings, workspaceEnvironment?: Record<string, string>, options?: {
|
|
627
639
|
workspaceId?: string;
|
|
@@ -635,6 +647,15 @@ declare function stableSandboxEnvironmentForRun(settings: Settings, workspaceEnv
|
|
|
635
647
|
*/
|
|
636
648
|
declare function hasGitHubRepositorySelection(resources: ReadonlyArray<{
|
|
637
649
|
kind: string;
|
|
650
|
+
provider?: unknown;
|
|
651
|
+
installationId?: unknown;
|
|
652
|
+
repositoryId?: unknown;
|
|
653
|
+
githubInstallationId?: unknown;
|
|
654
|
+
githubRepositoryId?: unknown;
|
|
655
|
+
}>): boolean;
|
|
656
|
+
declare function hasGitCredentialRepositorySelection(resources: ReadonlyArray<{
|
|
657
|
+
kind: string;
|
|
658
|
+
provider?: unknown;
|
|
638
659
|
githubInstallationId?: unknown;
|
|
639
660
|
githubRepositoryId?: unknown;
|
|
640
661
|
}>): boolean;
|
|
@@ -776,4 +797,4 @@ interface NatsControlPlaneAuth {
|
|
|
776
797
|
}
|
|
777
798
|
declare function resolveNatsControlPlaneAuth(settings: Settings): NatsControlPlaneAuth | null;
|
|
778
799
|
|
|
779
|
-
export { AGENT_INSTRUCTIONS_CORE_PLACEHOLDER, type ConfiguredModel,
|
|
800
|
+
export { AGENT_INSTRUCTIONS_CORE_PLACEHOLDER, type ConfiguredModel, DEFAULT_AGENT_INSTRUCTIONS, type EntitlementsConfig, type IntegrationOAuthClientConfig, IntegrationOAuthClientConfigSchema, type McpServerConfig, type McpServerConnectionRef, McpServerConnectionRefSchema, type ModelPricing, ModelProviderApi, type ModelUsageInput, type NatsCalloutConfig, type NatsControlPlaneAuth, type RegistryProvider, RegistryProviderKind, type ResolvedModelProvider, SANDBOX_REQUIRED_ENV, type SandboxRequiredEnv, type Settings, type StartupRetryOptions, type StaticUsageLimitsConfig, applyGitAuthPointerEnvironment, builtinProviderId, calculateModelUsageCostMicros, collectGitIdentityEnvironment, collectSandboxEnvironment, configuredAllowedModels, configuredAllowedReasoningEfforts, configuredEntitlements, configuredModelPricing, configuredModels, configuredProviders, configuredStaticUsageLimits, contextInputBudgetTokens, dbSearchPath, defaultModelPricing, effectiveModalIdleTimeoutSeconds, environmentsEncryptionKeyBytes, firstPartyMcpBaseUrl, firstPartyMcpWorkspaceUrl, getSettings, hasGitCredentialRepositorySelection, hasGitHubRepositorySelection, parseExposedPorts, parseIntegrationsOauthClientsJson, parseMcpServers, parseModelPricingJson, parseModelProvidersJson, parseSandboxWarmRateJson, parseStaticEntitlementsJson, parseStaticUsageLimitsJson, policyProviderIdForModel, requiredSandboxEnvForBackend, resolveEnrollmentSigningSecret, resolveModelProvider, resolveNatsCalloutConfig, resolveNatsControlPlaneAuth, resolveProviderApiKey, resolveRelayTokenSecret, resolveStreamTokenSecret, retryStartupDependency, sandboxEnvironmentVariableNames, sandboxLifecycleHookIds, sandboxPreparationProfiles, sandboxWarmRateMicrosPerSecond, settingsWithResolvedModelContext, stableSandboxEnvironmentForRun, startupRetryOptions, streamTokenDegraded };
|