@opengeni/config 3.2.1 → 3.3.0-canary.37111190284001
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/claude-subscription-capacity.d.ts +9 -0
- package/dist/claude-subscription-usage.d.ts +4 -2
- package/dist/index.d.ts +199 -3
- package/dist/index.js +483 -31
- package/dist/index.js.map +1 -1
- package/dist/subscription-account-selection.d.ts +17 -0
- package/package.json +4 -4
- package/src/claude-subscription-capacity.ts +129 -0
- package/src/claude-subscription-usage.ts +225 -5
- package/src/index.ts +340 -21
- package/src/subscription-account-selection.ts +36 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ClaudeSubscriptionUsage, ClaudeUsageWindow } from "@opengeni/contracts";
|
|
2
|
+
/** Evaluate provider-reported plan capacity and its explicitly allowed paid fallback. */
|
|
3
|
+
export declare function claudeSubscriptionCapacity(usage: ClaudeSubscriptionUsage, upstreamModelId: string, now: Date, options?: {
|
|
4
|
+
allowOverage?: boolean;
|
|
5
|
+
}): {
|
|
6
|
+
available: boolean;
|
|
7
|
+
nextCheckAt: Date | null;
|
|
8
|
+
blockingWindows: ClaudeUsageWindow["id"][];
|
|
9
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { type ClaudeSubscriptionUsage, type ClaudeUsageWindow } from "@opengeni/contracts";
|
|
1
|
+
import { type ClaudeSubscriptionUsage, type ClaudeUsageWindow, type ClaudeUsageRequestStatus } from "@opengeni/contracts";
|
|
2
2
|
export type ClaudeUsageObservation = {
|
|
3
3
|
windows: ClaudeUsageWindow[];
|
|
4
4
|
observedAt: string;
|
|
5
5
|
source: "response_headers" | "provider";
|
|
6
|
+
requestStatus?: ClaudeUsageRequestStatus | null;
|
|
7
|
+
requestRestrictions?: ClaudeUsageRequestStatus[];
|
|
6
8
|
};
|
|
7
|
-
export declare function parseClaudeUsageHeaders(headers: Headers, now?: Date): ClaudeUsageObservation | null;
|
|
9
|
+
export declare function parseClaudeUsageHeaders(headers: Headers, now?: Date, upstreamModelId?: string): ClaudeUsageObservation | null;
|
|
8
10
|
export declare function parseClaudeUsageResponse(value: unknown, now?: Date): ClaudeUsageObservation | null;
|
|
9
11
|
export declare function emptyClaudeUsage(credentialVersion: number | null): ClaudeSubscriptionUsage;
|
|
10
12
|
/** Preserve omitted windows and reject observations older than their individual window. */
|
package/dist/index.d.ts
CHANGED
|
@@ -130,6 +130,9 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
130
130
|
analyticsPosthogProjectKey: z.ZodOptional<z.ZodString>;
|
|
131
131
|
analyticsPosthogHost: z.ZodOptional<z.ZodString>;
|
|
132
132
|
analyticsGa4MeasurementId: z.ZodOptional<z.ZodString>;
|
|
133
|
+
legalPrivacyPolicyUrl: z.ZodOptional<z.ZodString>;
|
|
134
|
+
legalTermsOfServiceUrl: z.ZodOptional<z.ZodString>;
|
|
135
|
+
supportEmail: z.ZodOptional<z.ZodString>;
|
|
133
136
|
publicBaseUrl: z.ZodOptional<z.ZodString>;
|
|
134
137
|
documentationUrl: z.ZodPreprocess<z.ZodDefault<z.ZodNullable<z.ZodURL>>>;
|
|
135
138
|
mcpOauthEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
|
|
@@ -180,6 +183,8 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
180
183
|
browser_auth: "browser_auth";
|
|
181
184
|
browser_clipboard: "browser_clipboard";
|
|
182
185
|
browser_debug: "browser_debug";
|
|
186
|
+
browser_download_save: "browser_download_save";
|
|
187
|
+
browser_downloads: "browser_downloads";
|
|
183
188
|
browser_identity: "browser_identity";
|
|
184
189
|
browser_lifecycle: "browser_lifecycle";
|
|
185
190
|
browser_observe: "browser_observe";
|
|
@@ -357,6 +362,8 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
357
362
|
browser_auth: "browser_auth";
|
|
358
363
|
browser_clipboard: "browser_clipboard";
|
|
359
364
|
browser_debug: "browser_debug";
|
|
365
|
+
browser_download_save: "browser_download_save";
|
|
366
|
+
browser_downloads: "browser_downloads";
|
|
360
367
|
browser_identity: "browser_identity";
|
|
361
368
|
browser_lifecycle: "browser_lifecycle";
|
|
362
369
|
browser_observe: "browser_observe";
|
|
@@ -825,6 +832,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
825
832
|
sandboxViewerHolderTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
826
833
|
sandboxInteractionHolderTtlMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
827
834
|
sandboxIdleGraceMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
835
|
+
sandboxIdleCommandContainmentMs: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | undefined, number | undefined>>;
|
|
828
836
|
sandboxSnapshotIntervalMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
829
837
|
sandboxSnapshotTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
830
838
|
sandboxDrainSnapshotTimeoutMs: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -1413,6 +1421,8 @@ export declare const RegistryProviderKind: z.ZodEnum<{
|
|
|
1413
1421
|
"claude-subscription-organization": "claude-subscription-organization";
|
|
1414
1422
|
"claude-subscription-workspace": "claude-subscription-workspace";
|
|
1415
1423
|
"codex-subscription": "codex-subscription";
|
|
1424
|
+
"direct-azure-workspace": "direct-azure-workspace";
|
|
1425
|
+
"direct-openai-workspace": "direct-openai-workspace";
|
|
1416
1426
|
"openrouter-organization": "openrouter-organization";
|
|
1417
1427
|
"openrouter-workspace": "openrouter-workspace";
|
|
1418
1428
|
"vercel-gateway-managed": "vercel-gateway-managed";
|
|
@@ -1470,6 +1480,8 @@ declare const RegistryProviderSchema: z.ZodObject<{
|
|
|
1470
1480
|
"claude-subscription-organization": "claude-subscription-organization";
|
|
1471
1481
|
"claude-subscription-workspace": "claude-subscription-workspace";
|
|
1472
1482
|
"codex-subscription": "codex-subscription";
|
|
1483
|
+
"direct-azure-workspace": "direct-azure-workspace";
|
|
1484
|
+
"direct-openai-workspace": "direct-openai-workspace";
|
|
1473
1485
|
"openrouter-organization": "openrouter-organization";
|
|
1474
1486
|
"openrouter-workspace": "openrouter-workspace";
|
|
1475
1487
|
"vercel-gateway-managed": "vercel-gateway-managed";
|
|
@@ -2142,7 +2154,7 @@ export declare const ModelCatalogDocument: z.ZodObject<{
|
|
|
2142
2154
|
publicDefaultHeaderNames: z.ZodOptional<z.ZodNever>;
|
|
2143
2155
|
publicDefaultQueryNames: z.ZodOptional<z.ZodNever>;
|
|
2144
2156
|
}, z.core.$strict>>>;
|
|
2145
|
-
codexModels: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2157
|
+
codexModels: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
2146
2158
|
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2147
2159
|
label: z.ZodOptional<z.ZodString>;
|
|
2148
2160
|
shortLabel: z.ZodOptional<z.ZodString>;
|
|
@@ -2301,7 +2313,165 @@ export declare const ModelCatalogDocument: z.ZodObject<{
|
|
|
2301
2313
|
}, z.core.$strip>>;
|
|
2302
2314
|
}, z.core.$strip>;
|
|
2303
2315
|
pricing: z.ZodOptional<z.ZodNever>;
|
|
2304
|
-
}, z.core.$strict
|
|
2316
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
2317
|
+
aliases?: string[] | undefined;
|
|
2318
|
+
label?: string | undefined;
|
|
2319
|
+
shortLabel?: string | undefined;
|
|
2320
|
+
contextWindowTokens?: number | undefined;
|
|
2321
|
+
effectiveContextWindowTokens?: number | undefined;
|
|
2322
|
+
autoCompactTokenLimit?: number | undefined;
|
|
2323
|
+
toolOutputTruncationTokens?: number | undefined;
|
|
2324
|
+
reasoningEffort?: boolean | undefined;
|
|
2325
|
+
hostedWebSearch?: boolean | undefined;
|
|
2326
|
+
credentialSource?: undefined;
|
|
2327
|
+
billing?: undefined;
|
|
2328
|
+
retired?: boolean | undefined;
|
|
2329
|
+
id: string;
|
|
2330
|
+
upstreamModelId: string;
|
|
2331
|
+
pricing?: undefined;
|
|
2332
|
+
capabilities: {
|
|
2333
|
+
reasoning: {
|
|
2334
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2335
|
+
runnable: boolean;
|
|
2336
|
+
efforts: ("high" | "low" | "max" | "medium" | "minimal" | "none" | "xhigh")[];
|
|
2337
|
+
defaultEffort: "high" | "low" | "max" | "medium" | "minimal" | "none" | "xhigh" | null;
|
|
2338
|
+
required: boolean;
|
|
2339
|
+
};
|
|
2340
|
+
functionCalling: {
|
|
2341
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2342
|
+
runnable: boolean;
|
|
2343
|
+
};
|
|
2344
|
+
structuredOutput: {
|
|
2345
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2346
|
+
runnable: boolean;
|
|
2347
|
+
};
|
|
2348
|
+
hostedTools: {
|
|
2349
|
+
webSearch: {
|
|
2350
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2351
|
+
runnable: boolean;
|
|
2352
|
+
};
|
|
2353
|
+
xSearch: {
|
|
2354
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2355
|
+
runnable: boolean;
|
|
2356
|
+
};
|
|
2357
|
+
codeExecution: {
|
|
2358
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2359
|
+
runnable: boolean;
|
|
2360
|
+
};
|
|
2361
|
+
imageGeneration: {
|
|
2362
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2363
|
+
runnable: boolean;
|
|
2364
|
+
};
|
|
2365
|
+
};
|
|
2366
|
+
inputModalities: ("audio" | "image" | "text")[];
|
|
2367
|
+
inputFileMediaTypes: string[];
|
|
2368
|
+
outputModalities: ("audio" | "image" | "text")[];
|
|
2369
|
+
transports: {
|
|
2370
|
+
sse: {
|
|
2371
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2372
|
+
runnable: boolean;
|
|
2373
|
+
};
|
|
2374
|
+
responsesWebSocket: {
|
|
2375
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2376
|
+
runnable: boolean;
|
|
2377
|
+
};
|
|
2378
|
+
realtimeAudio: {
|
|
2379
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2380
|
+
runnable: boolean;
|
|
2381
|
+
};
|
|
2382
|
+
};
|
|
2383
|
+
promptCaching?: {
|
|
2384
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2385
|
+
runnable: boolean;
|
|
2386
|
+
mode: "automatic" | "implicit" | "none";
|
|
2387
|
+
} | undefined;
|
|
2388
|
+
latencyModes: {
|
|
2389
|
+
id: "fast" | "priority" | "standard";
|
|
2390
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2391
|
+
runnable: boolean;
|
|
2392
|
+
billingMultiplierBps?: number | undefined;
|
|
2393
|
+
}[];
|
|
2394
|
+
};
|
|
2395
|
+
}, {
|
|
2396
|
+
aliases?: string[] | undefined;
|
|
2397
|
+
label?: string | undefined;
|
|
2398
|
+
shortLabel?: string | undefined;
|
|
2399
|
+
contextWindowTokens?: number | undefined;
|
|
2400
|
+
effectiveContextWindowTokens?: number | undefined;
|
|
2401
|
+
autoCompactTokenLimit?: number | undefined;
|
|
2402
|
+
toolOutputTruncationTokens?: number | undefined;
|
|
2403
|
+
reasoningEffort?: boolean | undefined;
|
|
2404
|
+
hostedWebSearch?: boolean | undefined;
|
|
2405
|
+
credentialSource?: undefined;
|
|
2406
|
+
billing?: undefined;
|
|
2407
|
+
retired?: boolean | undefined;
|
|
2408
|
+
id: string;
|
|
2409
|
+
upstreamModelId: string;
|
|
2410
|
+
capabilities: {
|
|
2411
|
+
reasoning: {
|
|
2412
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2413
|
+
runnable: boolean;
|
|
2414
|
+
efforts: ("high" | "low" | "max" | "medium" | "minimal" | "none" | "xhigh")[];
|
|
2415
|
+
defaultEffort: "high" | "low" | "max" | "medium" | "minimal" | "none" | "xhigh" | null;
|
|
2416
|
+
required: boolean;
|
|
2417
|
+
};
|
|
2418
|
+
functionCalling: {
|
|
2419
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2420
|
+
runnable: boolean;
|
|
2421
|
+
};
|
|
2422
|
+
structuredOutput: {
|
|
2423
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2424
|
+
runnable: boolean;
|
|
2425
|
+
};
|
|
2426
|
+
hostedTools: {
|
|
2427
|
+
webSearch: {
|
|
2428
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2429
|
+
runnable: boolean;
|
|
2430
|
+
};
|
|
2431
|
+
xSearch: {
|
|
2432
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2433
|
+
runnable: boolean;
|
|
2434
|
+
};
|
|
2435
|
+
codeExecution: {
|
|
2436
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2437
|
+
runnable: boolean;
|
|
2438
|
+
};
|
|
2439
|
+
imageGeneration: {
|
|
2440
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2441
|
+
runnable: boolean;
|
|
2442
|
+
};
|
|
2443
|
+
};
|
|
2444
|
+
inputModalities: ("audio" | "image" | "text")[];
|
|
2445
|
+
inputFileMediaTypes: string[];
|
|
2446
|
+
outputModalities: ("audio" | "image" | "text")[];
|
|
2447
|
+
transports: {
|
|
2448
|
+
sse: {
|
|
2449
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2450
|
+
runnable: boolean;
|
|
2451
|
+
};
|
|
2452
|
+
responsesWebSocket: {
|
|
2453
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2454
|
+
runnable: boolean;
|
|
2455
|
+
};
|
|
2456
|
+
realtimeAudio: {
|
|
2457
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2458
|
+
runnable: boolean;
|
|
2459
|
+
};
|
|
2460
|
+
};
|
|
2461
|
+
promptCaching?: {
|
|
2462
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2463
|
+
runnable: boolean;
|
|
2464
|
+
mode: "automatic" | "implicit" | "none";
|
|
2465
|
+
} | undefined;
|
|
2466
|
+
latencyModes: {
|
|
2467
|
+
id: "fast" | "priority" | "standard";
|
|
2468
|
+
upstream: "supported" | "unknown" | "unsupported";
|
|
2469
|
+
runnable: boolean;
|
|
2470
|
+
billingMultiplierBps?: number | undefined;
|
|
2471
|
+
}[];
|
|
2472
|
+
};
|
|
2473
|
+
pricing?: undefined;
|
|
2474
|
+
}>>>>;
|
|
2305
2475
|
gatewayModels: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2306
2476
|
productId: z.ZodString;
|
|
2307
2477
|
workspaceProductId: z.ZodString;
|
|
@@ -2722,6 +2892,17 @@ export declare function collectSandboxEnvironment(settings: Settings, source?: N
|
|
|
2722
2892
|
*/
|
|
2723
2893
|
export declare function resolveProviderApiKey(provider: Pick<RegistryProvider, "apiKey" | "apiKeyEnv">, source?: NodeJS.ProcessEnv): string | undefined;
|
|
2724
2894
|
export declare function gatewayRequestPolicyForUpstreamModel(upstreamModelId: string, models?: readonly GatewayCatalogModel[]): ConfiguredModel["requestPolicy"];
|
|
2895
|
+
/** Customer-owned OpenAI/Azure routes, bound to immutable connection identity. */
|
|
2896
|
+
export declare function withDirectModelProviders(settings: Settings, connections: readonly {
|
|
2897
|
+
id: string;
|
|
2898
|
+
version: number;
|
|
2899
|
+
subjectId: string | null;
|
|
2900
|
+
kind: string;
|
|
2901
|
+
status: string;
|
|
2902
|
+
providerDomain: string;
|
|
2903
|
+
metadata: Record<string, unknown>;
|
|
2904
|
+
apiKey?: string;
|
|
2905
|
+
}[]): Settings;
|
|
2725
2906
|
/** Static catalog overlay; it contains no concrete workspace credential. */
|
|
2726
2907
|
export declare function withWorkspaceGatewayCatalogProvider(settings: Settings, customModels?: readonly {
|
|
2727
2908
|
upstreamModelId: string;
|
|
@@ -2783,6 +2964,13 @@ export declare function serviceTierForLatencyMode(providerId: string, latencyMod
|
|
|
2783
2964
|
/** True when the response tier fulfills a non-standard Fast/priority request. */
|
|
2784
2965
|
export declare function responseSatisfiesLatencyMode(requested: LatencyMode, responseServiceTier: string | null | undefined): boolean;
|
|
2785
2966
|
export declare function runnableLatencyModesForModel(settings: Settings, modelId: string): LatencyMode[];
|
|
2967
|
+
export declare class UnsupportedLatencyModeError extends Error {
|
|
2968
|
+
readonly modelId: string;
|
|
2969
|
+
readonly latencyMode: LatencyMode;
|
|
2970
|
+
readonly allowedLatencyModes: readonly LatencyMode[];
|
|
2971
|
+
readonly code = "UNSUPPORTED_LATENCY_MODE";
|
|
2972
|
+
constructor(modelId: string, latencyMode: LatencyMode, allowedLatencyModes: readonly LatencyMode[]);
|
|
2973
|
+
}
|
|
2786
2974
|
export declare function modelCostClassForConfiguredModel(_settings: Settings, model: Pick<ConfiguredModel, "cost">): ConfiguredModelCostClass;
|
|
2787
2975
|
/**
|
|
2788
2976
|
* The built-in provider's stable id: "openai" on the OpenAI platform, "azure"
|
|
@@ -2898,7 +3086,7 @@ export declare class TurnExecutionPolicyDefinitionMismatchError extends Error {
|
|
|
2898
3086
|
/**
|
|
2899
3087
|
* Parse-time validation lives in @opengeni/contracts; this verifier binds a
|
|
2900
3088
|
* present snapshot to the current executable definition and exact turn row.
|
|
2901
|
-
*
|
|
3089
|
+
* Non-additive executable drift fails before a provider or compaction call.
|
|
2902
3090
|
*/
|
|
2903
3091
|
export declare function assertTurnExecutionPolicyMatchesConfigV1(settings: Settings, policy: TurnExecutionPolicyV1, expected: {
|
|
2904
3092
|
modelId: string;
|
|
@@ -3222,6 +3410,12 @@ export declare function sandboxImageAllowlist(settings: Pick<Settings, "sandboxI
|
|
|
3222
3410
|
/** Native Claude connections reuse the encrypted workspace and organization boundaries. */
|
|
3223
3411
|
export declare const CLAUDE_CONNECTION_KINDS: readonly ["anthropic", "claude_subscription"];
|
|
3224
3412
|
export type ClaudeConnectionKind = (typeof CLAUDE_CONNECTION_KINDS)[number];
|
|
3413
|
+
export declare function claudeNativeModelProfile(upstreamModelId: string): Readonly<{
|
|
3414
|
+
efforts: readonly ReasoningEffort[];
|
|
3415
|
+
defaultEffort: ReasoningEffort | null;
|
|
3416
|
+
contextWindowTokens: number;
|
|
3417
|
+
maxOutputTokens: number;
|
|
3418
|
+
}> | undefined;
|
|
3225
3419
|
export declare function claudeProviderId(kind: ClaudeConnectionKind, scope?: "workspace" | "organization"): string;
|
|
3226
3420
|
export type ClaudeConnectionCatalog = Partial<Record<ClaudeConnectionKind, {
|
|
3227
3421
|
active?: boolean;
|
|
@@ -3237,3 +3431,5 @@ export declare function withClaudeConnectionCredential(settings: Settings, kind:
|
|
|
3237
3431
|
}): Settings;
|
|
3238
3432
|
export * from "./claude-subscription-usage.js";
|
|
3239
3433
|
export * from "./claude-subscription-oauth.js";
|
|
3434
|
+
export * from "./subscription-account-selection.js";
|
|
3435
|
+
export * from "./claude-subscription-capacity.js";
|