@opengeni/config 1.0.0-canary.6 → 1.0.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/claude-subscription-capacity.d.ts +9 -0
- package/dist/claude-subscription-oauth.d.ts +17 -0
- package/dist/claude-subscription-usage.d.ts +13 -0
- package/dist/index.d.ts +808 -12
- package/dist/index.js +2296 -637
- package/dist/index.js.map +1 -1
- package/dist/managed-user-admission.d.ts +2 -0
- 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-oauth.ts +33 -0
- package/src/claude-subscription-usage.ts +328 -0
- package/src/index.ts +2205 -328
- package/src/managed-user-admission.ts +11 -0
- 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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Claude Code 2.1.285's installed OAuth flow; model calls and profile reads only. */
|
|
3
|
+
export declare const CLAUDE_OAUTH_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
|
|
4
|
+
export declare const CLAUDE_OAUTH_AUTHORIZE_URL = "https://claude.com/cai/oauth/authorize";
|
|
5
|
+
export declare const CLAUDE_OAUTH_TOKEN_URL = "https://platform.claude.com/v1/oauth/token";
|
|
6
|
+
export declare const CLAUDE_OAUTH_REDIRECT_URL = "https://platform.claude.com/oauth/code/callback";
|
|
7
|
+
export declare const CLAUDE_OAUTH_SCOPES: readonly ["user:inference", "user:profile"];
|
|
8
|
+
export declare const ClaudeOAuthTokenResponse: z.ZodObject<{
|
|
9
|
+
access_token: z.ZodString;
|
|
10
|
+
refresh_token: z.ZodOptional<z.ZodString>;
|
|
11
|
+
expires_in: z.ZodNumber;
|
|
12
|
+
scope: z.ZodString;
|
|
13
|
+
}, z.core.$loose>;
|
|
14
|
+
export declare function claudeAuthorizationUrl(input: {
|
|
15
|
+
challenge: string;
|
|
16
|
+
state: string;
|
|
17
|
+
}): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ClaudeSubscriptionUsage, type ClaudeUsageWindow, type ClaudeUsageRequestStatus } from "@opengeni/contracts";
|
|
2
|
+
export type ClaudeUsageObservation = {
|
|
3
|
+
windows: ClaudeUsageWindow[];
|
|
4
|
+
observedAt: string;
|
|
5
|
+
source: "response_headers" | "provider";
|
|
6
|
+
requestStatus?: ClaudeUsageRequestStatus | null;
|
|
7
|
+
requestRestrictions?: ClaudeUsageRequestStatus[];
|
|
8
|
+
};
|
|
9
|
+
export declare function parseClaudeUsageHeaders(headers: Headers, now?: Date, upstreamModelId?: string): ClaudeUsageObservation | null;
|
|
10
|
+
export declare function parseClaudeUsageResponse(value: unknown, now?: Date): ClaudeUsageObservation | null;
|
|
11
|
+
export declare function emptyClaudeUsage(credentialVersion: number | null): ClaudeSubscriptionUsage;
|
|
12
|
+
/** Preserve omitted windows and reject observations older than their individual window. */
|
|
13
|
+
export declare function mergeClaudeUsage(current: ClaudeSubscriptionUsage, observation: ClaudeUsageObservation): ClaudeSubscriptionUsage;
|