@opengeni/config 0.4.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 +78 -58
- package/dist/index.js +415 -204
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/index.ts +715 -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";
|
|
@@ -217,6 +206,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
217
206
|
"h264-mp4": "h264-mp4";
|
|
218
207
|
"vp9-webm": "vp9-webm";
|
|
219
208
|
}>>;
|
|
209
|
+
workspaceCaptureEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
220
210
|
recordingFramerate: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
221
211
|
recordingMaxSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
222
212
|
recordingMaxBytes: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -261,7 +251,9 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
261
251
|
vercelTeamId: z.ZodOptional<z.ZodString>;
|
|
262
252
|
vercelRuntime: z.ZodOptional<z.ZodString>;
|
|
263
253
|
sandboxOwnershipEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
254
|
+
sandboxLazyProvisionEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
264
255
|
sandboxSelfhostedEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
256
|
+
agentOpStreamEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
265
257
|
enrollmentSigningSecret: z.ZodOptional<z.ZodString>;
|
|
266
258
|
selfhostedNatsUrl: z.ZodOptional<z.ZodString>;
|
|
267
259
|
selfhostedRelayUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -273,12 +265,17 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
273
265
|
selfhostedNatsCalloutPassword: z.ZodOptional<z.ZodString>;
|
|
274
266
|
selfhostedNatsControlUser: z.ZodOptional<z.ZodString>;
|
|
275
267
|
selfhostedNatsControlPassword: z.ZodOptional<z.ZodString>;
|
|
268
|
+
sandboxSelfhostedExecTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
269
|
+
sandboxSelfhostedControlTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
276
270
|
sandboxLeaseReaperPeriodMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
277
271
|
sandboxViewerHolderTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
278
272
|
sandboxIdleGraceMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
273
|
+
sandboxSnapshotIntervalMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
274
|
+
sandboxSnapshotTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
279
275
|
sandboxLeaseTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
280
276
|
sandboxLeaseWarmingTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
281
277
|
sandboxWarmingTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
278
|
+
rigSetupTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
282
279
|
sandboxWarmRateMicrosPerSecondJson: z.ZodDefault<z.ZodString>;
|
|
283
280
|
sandboxMaxWarmSecondsPerWorkspace: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
284
281
|
sandboxPreparationProfiles: z.ZodDefault<z.ZodString>;
|
|
@@ -425,6 +422,8 @@ declare const RegistryProviderSchema: z.ZodObject<{
|
|
|
425
422
|
id: z.ZodString;
|
|
426
423
|
label: z.ZodOptional<z.ZodString>;
|
|
427
424
|
contextWindowTokens: z.ZodOptional<z.ZodNumber>;
|
|
425
|
+
effectiveContextWindowTokens: z.ZodOptional<z.ZodNumber>;
|
|
426
|
+
autoCompactTokenLimit: z.ZodOptional<z.ZodNumber>;
|
|
428
427
|
reasoningEffort: z.ZodOptional<z.ZodBoolean>;
|
|
429
428
|
hostedWebSearch: z.ZodOptional<z.ZodBoolean>;
|
|
430
429
|
pricing: z.ZodOptional<z.ZodObject<{
|
|
@@ -449,9 +448,9 @@ type IntegrationOAuthClientConfig = z.infer<typeof IntegrationOAuthClientConfigS
|
|
|
449
448
|
/**
|
|
450
449
|
* Runtime-resolved provider (built-in or registry), client-construction-ready.
|
|
451
450
|
* The built-in OpenAI/Azure provider is always present and always "responses";
|
|
452
|
-
* registry providers carry their own base URL / key / wire API.
|
|
453
|
-
*
|
|
454
|
-
*
|
|
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.
|
|
455
454
|
*/
|
|
456
455
|
interface ResolvedModelProvider {
|
|
457
456
|
id: string;
|
|
@@ -463,7 +462,6 @@ interface ResolvedModelProvider {
|
|
|
463
462
|
apiKey?: string | undefined;
|
|
464
463
|
defaultQuery?: Record<string, string> | undefined;
|
|
465
464
|
defaultHeaders?: Record<string, string> | undefined;
|
|
466
|
-
compactionMode: ContextCompactionMode;
|
|
467
465
|
}
|
|
468
466
|
/** A single exposed model + the provider that serves it. */
|
|
469
467
|
interface ConfiguredModel {
|
|
@@ -473,6 +471,8 @@ interface ConfiguredModel {
|
|
|
473
471
|
providerLabel: string;
|
|
474
472
|
api: ModelProviderApi;
|
|
475
473
|
contextWindowTokens?: number | undefined;
|
|
474
|
+
effectiveContextWindowTokens?: number | undefined;
|
|
475
|
+
autoCompactTokenLimit?: number | undefined;
|
|
476
476
|
reasoningEffort: boolean;
|
|
477
477
|
hostedWebSearch: boolean;
|
|
478
478
|
}
|
|
@@ -506,16 +506,37 @@ declare function collectSandboxEnvironment(settings: Settings, source?: NodeJS.P
|
|
|
506
506
|
* explicit environment in tests.
|
|
507
507
|
*/
|
|
508
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;
|
|
509
517
|
/**
|
|
510
518
|
* Every provider a client may route to: the built-in OpenAI/Azure provider
|
|
511
|
-
* first (id "openai"/"azure", always "responses",
|
|
512
|
-
*
|
|
513
|
-
* 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
|
|
514
521
|
* the existing flat openai/azure settings for the built-in, and from the
|
|
515
522
|
* registry entry for the rest. Registry ids may not collide with the built-in
|
|
516
523
|
* id — validateSettings rejects that at boot.
|
|
517
524
|
*/
|
|
518
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;
|
|
519
540
|
/**
|
|
520
541
|
* Every model a client may use, the built-in provider's models first
|
|
521
542
|
* (configuredAllowedModels-from-openai, mapped to "responses" with
|
|
@@ -550,28 +571,16 @@ declare function resolveModelProvider(settings: Settings, modelId: string): {
|
|
|
550
571
|
*/
|
|
551
572
|
declare function configuredModelPricing(settings: Settings): Record<string, ModelPricing>;
|
|
552
573
|
/**
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
* SDK emits context_management; we pass the correct gpt-5.5 threshold).
|
|
556
|
-
* - "client": run OpenGeni's own client-side compaction (Azure and any other
|
|
557
|
-
* backend that rejects/ignores context_management).
|
|
558
|
-
* - "off": neither (legacy unbounded growth; escape hatch).
|
|
559
|
-
*
|
|
560
|
-
* "auto" maps to "server" on the OpenAI platform provider and "client"
|
|
561
|
-
* otherwise — Azure's Responses API returns 400 unsupported_parameter for
|
|
562
|
-
* 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.
|
|
563
576
|
*/
|
|
564
|
-
|
|
565
|
-
declare function resolveContextCompactionMode(settings: Pick<Settings, "contextCompactionMode" | "openaiProvider">): ContextCompactionMode;
|
|
566
|
-
/** Usable input-token budget B = window - reserved output. */
|
|
567
|
-
declare function contextInputBudgetTokens(settings: Pick<Settings, "contextWindowTokens" | "contextReservedOutputTokens">): number;
|
|
577
|
+
declare function contextInputBudgetTokens(settings: Pick<Settings, "contextWindowTokens" | "contextEffectiveWindowTokens" | "contextReservedOutputTokens">): number;
|
|
568
578
|
/**
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
* 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.
|
|
573
582
|
*/
|
|
574
|
-
declare function
|
|
583
|
+
declare function settingsWithResolvedModelContext(settings: Settings, model: Pick<ConfiguredModel, "contextWindowTokens" | "effectiveContextWindowTokens" | "autoCompactTokenLimit">): Settings;
|
|
575
584
|
declare function configuredStaticUsageLimits(settings: Settings): StaticUsageLimitsConfig;
|
|
576
585
|
declare function configuredEntitlements(settings: Settings): EntitlementsConfig;
|
|
577
586
|
declare function calculateModelUsageCostMicros(settings: Settings, model: string, usage: ModelUsageInput): number;
|
|
@@ -609,20 +618,22 @@ declare function collectGitIdentityEnvironment(settings: Settings): Record<strin
|
|
|
609
618
|
* workspace environment < the backend-aware HOME default. Reserved-name validation
|
|
610
619
|
* at write time keeps workspace values from colliding with platform entries.
|
|
611
620
|
*
|
|
612
|
-
* DELIBERATELY EXCLUDES the per-run, ROTATING
|
|
613
|
-
*
|
|
621
|
+
* DELIBERATELY EXCLUDES the per-run, ROTATING git provider token VALUES that
|
|
622
|
+
* `sandboxEnvironmentForRun` mints when a repository resource is
|
|
614
623
|
* attached: that token is minted FRESH per call, so it is not a stable, attach-
|
|
615
624
|
* reproducible value and must not be part of the shared base. Under the token-
|
|
616
|
-
* broker (B1)
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
*
|
|
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.
|
|
626
637
|
*/
|
|
627
638
|
declare function stableSandboxEnvironmentForRun(settings: Settings, workspaceEnvironment?: Record<string, string>, options?: {
|
|
628
639
|
workspaceId?: string;
|
|
@@ -636,6 +647,15 @@ declare function stableSandboxEnvironmentForRun(settings: Settings, workspaceEnv
|
|
|
636
647
|
*/
|
|
637
648
|
declare function hasGitHubRepositorySelection(resources: ReadonlyArray<{
|
|
638
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;
|
|
639
659
|
githubInstallationId?: unknown;
|
|
640
660
|
githubRepositoryId?: unknown;
|
|
641
661
|
}>): boolean;
|
|
@@ -777,4 +797,4 @@ interface NatsControlPlaneAuth {
|
|
|
777
797
|
}
|
|
778
798
|
declare function resolveNatsControlPlaneAuth(settings: Settings): NatsControlPlaneAuth | null;
|
|
779
799
|
|
|
780
|
-
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 };
|