@juspay/neurolink 9.14.0 → 9.15.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +15 -15
  3. package/dist/auth/anthropicOAuth.d.ts +377 -0
  4. package/dist/auth/anthropicOAuth.js +914 -0
  5. package/dist/auth/index.d.ts +20 -0
  6. package/dist/auth/index.js +29 -0
  7. package/dist/auth/tokenStore.d.ts +225 -0
  8. package/dist/auth/tokenStore.js +521 -0
  9. package/dist/cli/commands/auth.d.ts +50 -0
  10. package/dist/cli/commands/auth.js +1115 -0
  11. package/dist/cli/factories/authCommandFactory.d.ts +52 -0
  12. package/dist/cli/factories/authCommandFactory.js +146 -0
  13. package/dist/cli/factories/commandFactory.d.ts +6 -0
  14. package/dist/cli/factories/commandFactory.js +92 -2
  15. package/dist/cli/parser.js +11 -2
  16. package/dist/constants/enums.d.ts +20 -0
  17. package/dist/constants/enums.js +30 -0
  18. package/dist/constants/index.d.ts +3 -1
  19. package/dist/constants/index.js +11 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/lib/auth/anthropicOAuth.d.ts +377 -0
  22. package/dist/lib/auth/anthropicOAuth.js +915 -0
  23. package/dist/lib/auth/index.d.ts +20 -0
  24. package/dist/lib/auth/index.js +30 -0
  25. package/dist/lib/auth/tokenStore.d.ts +225 -0
  26. package/dist/lib/auth/tokenStore.js +522 -0
  27. package/dist/lib/constants/enums.d.ts +20 -0
  28. package/dist/lib/constants/enums.js +30 -0
  29. package/dist/lib/constants/index.d.ts +3 -1
  30. package/dist/lib/constants/index.js +11 -1
  31. package/dist/lib/index.d.ts +1 -1
  32. package/dist/lib/models/anthropicModels.d.ts +267 -0
  33. package/dist/lib/models/anthropicModels.js +528 -0
  34. package/dist/lib/providers/anthropic.d.ts +123 -2
  35. package/dist/lib/providers/anthropic.js +800 -10
  36. package/dist/lib/types/errors.d.ts +62 -0
  37. package/dist/lib/types/errors.js +107 -0
  38. package/dist/lib/types/index.d.ts +2 -1
  39. package/dist/lib/types/index.js +2 -0
  40. package/dist/lib/types/providers.d.ts +107 -0
  41. package/dist/lib/types/providers.js +69 -0
  42. package/dist/lib/types/subscriptionTypes.d.ts +893 -0
  43. package/dist/lib/types/subscriptionTypes.js +8 -0
  44. package/dist/lib/utils/providerConfig.d.ts +167 -0
  45. package/dist/lib/utils/providerConfig.js +619 -9
  46. package/dist/models/anthropicModels.d.ts +267 -0
  47. package/dist/models/anthropicModels.js +527 -0
  48. package/dist/providers/anthropic.d.ts +123 -2
  49. package/dist/providers/anthropic.js +800 -10
  50. package/dist/types/errors.d.ts +62 -0
  51. package/dist/types/errors.js +107 -0
  52. package/dist/types/index.d.ts +2 -1
  53. package/dist/types/index.js +2 -0
  54. package/dist/types/providers.d.ts +107 -0
  55. package/dist/types/providers.js +69 -0
  56. package/dist/types/subscriptionTypes.d.ts +893 -0
  57. package/dist/types/subscriptionTypes.js +7 -0
  58. package/dist/utils/providerConfig.d.ts +167 -0
  59. package/dist/utils/providerConfig.js +619 -9
  60. package/package.json +2 -1
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Auth Command Factory for NeuroLink
3
+ *
4
+ * Creates the unified authentication command with subcommands for AI providers.
5
+ * Follows the MCP command pattern with subcommands: login, logout, status, refresh.
6
+ *
7
+ * Supported providers:
8
+ * - Anthropic (API key + OAuth for Claude subscription plans)
9
+ */
10
+ import type { CommandModule } from "yargs";
11
+ /**
12
+ * Auth command arguments interface
13
+ */
14
+ export interface AuthCommandArgs {
15
+ provider?: string;
16
+ method?: "api-key" | "oauth" | "create-api-key";
17
+ format?: "text" | "json";
18
+ quiet?: boolean;
19
+ debug?: boolean;
20
+ nonInteractive?: boolean;
21
+ }
22
+ /**
23
+ * Auth Command Factory
24
+ *
25
+ * Creates the main auth command with subcommands:
26
+ * - login: Authenticate with a provider
27
+ * - logout: Clear stored credentials
28
+ * - status: Show authentication status
29
+ * - refresh: Manually refresh OAuth tokens
30
+ */
31
+ export declare class AuthCommandFactory {
32
+ /**
33
+ * Create the main auth command with subcommands
34
+ */
35
+ static createAuthCommands(): CommandModule;
36
+ /**
37
+ * Build options for login subcommand
38
+ */
39
+ private static buildLoginOptions;
40
+ /**
41
+ * Build options for logout subcommand
42
+ */
43
+ private static buildLogoutOptions;
44
+ /**
45
+ * Build options for status subcommand
46
+ */
47
+ private static buildStatusOptions;
48
+ /**
49
+ * Build options for refresh subcommand
50
+ */
51
+ private static buildRefreshOptions;
52
+ }
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Auth Command Factory for NeuroLink
3
+ *
4
+ * Creates the unified authentication command with subcommands for AI providers.
5
+ * Follows the MCP command pattern with subcommands: login, logout, status, refresh.
6
+ *
7
+ * Supported providers:
8
+ * - Anthropic (API key + OAuth for Claude subscription plans)
9
+ */
10
+ /**
11
+ * Supported providers for authentication
12
+ */
13
+ const SUPPORTED_PROVIDERS = ["anthropic"];
14
+ /**
15
+ * Auth Command Factory
16
+ *
17
+ * Creates the main auth command with subcommands:
18
+ * - login: Authenticate with a provider
19
+ * - logout: Clear stored credentials
20
+ * - status: Show authentication status
21
+ * - refresh: Manually refresh OAuth tokens
22
+ */
23
+ export class AuthCommandFactory {
24
+ /**
25
+ * Create the main auth command with subcommands
26
+ */
27
+ static createAuthCommands() {
28
+ return {
29
+ command: "auth <subcommand>",
30
+ describe: "Manage authentication with AI providers (API key or OAuth)",
31
+ builder: (yargs) => {
32
+ return yargs
33
+ .command("login <provider>", "Authenticate with an AI provider", (yargs) => this.buildLoginOptions(yargs), async (argv) => {
34
+ const { handleLogin } = await import("../commands/auth.js");
35
+ await handleLogin(argv);
36
+ })
37
+ .command("logout <provider>", "Clear stored credentials for a provider", (yargs) => this.buildLogoutOptions(yargs), async (argv) => {
38
+ const { handleLogout } = await import("../commands/auth.js");
39
+ await handleLogout(argv);
40
+ })
41
+ .command("status [provider]", "Show authentication status for provider(s)", (yargs) => this.buildStatusOptions(yargs), async (argv) => {
42
+ const { handleStatus } = await import("../commands/auth.js");
43
+ await handleStatus(argv);
44
+ })
45
+ .command("refresh <provider>", "Manually refresh OAuth tokens for a provider", (yargs) => this.buildRefreshOptions(yargs), async (argv) => {
46
+ const { handleRefresh } = await import("../commands/auth.js");
47
+ await handleRefresh(argv);
48
+ })
49
+ .option("format", {
50
+ choices: ["text", "json"],
51
+ default: "text",
52
+ description: "Output format",
53
+ })
54
+ .option("quiet", {
55
+ type: "boolean",
56
+ alias: "q",
57
+ default: false,
58
+ description: "Suppress non-essential output",
59
+ })
60
+ .option("debug", {
61
+ type: "boolean",
62
+ default: false,
63
+ description: "Enable debug output",
64
+ })
65
+ .demandCommand(1, "Please specify an auth subcommand")
66
+ .example("$0 auth login anthropic", "Authenticate with Anthropic")
67
+ .example("$0 auth login anthropic --method create-api-key", "Create API key via OAuth (Claude Pro/Max - Recommended)")
68
+ .example("$0 auth status", "Show authentication status for all providers")
69
+ .example("$0 auth logout anthropic", "Clear Anthropic stored credentials")
70
+ .example("$0 auth refresh anthropic", "Refresh Anthropic OAuth tokens")
71
+ .help();
72
+ },
73
+ handler: () => {
74
+ // No-op handler as subcommands handle everything
75
+ },
76
+ };
77
+ }
78
+ /**
79
+ * Build options for login subcommand
80
+ */
81
+ static buildLoginOptions(yargs) {
82
+ return yargs
83
+ .positional("provider", {
84
+ type: "string",
85
+ description: "AI provider to authenticate with",
86
+ choices: SUPPORTED_PROVIDERS,
87
+ demandOption: true,
88
+ })
89
+ .option("method", {
90
+ type: "string",
91
+ alias: "m",
92
+ description: "Authentication method",
93
+ choices: ["api-key", "oauth", "create-api-key"],
94
+ })
95
+ .option("non-interactive", {
96
+ type: "boolean",
97
+ description: "Skip interactive prompts (requires environment variables)",
98
+ default: false,
99
+ })
100
+ .example("$0 auth login anthropic", "Interactive authentication (choose method)")
101
+ .example("$0 auth login anthropic --method api-key", "API key authentication")
102
+ .example("$0 auth login anthropic --method create-api-key", "Create API key via OAuth (Claude Pro/Max)")
103
+ .example("$0 auth login anthropic --method oauth", "Direct OAuth (experimental)");
104
+ }
105
+ /**
106
+ * Build options for logout subcommand
107
+ */
108
+ static buildLogoutOptions(yargs) {
109
+ return yargs
110
+ .positional("provider", {
111
+ type: "string",
112
+ description: "AI provider to log out from",
113
+ choices: SUPPORTED_PROVIDERS,
114
+ demandOption: true,
115
+ })
116
+ .example("$0 auth logout anthropic", "Clear all Anthropic credentials");
117
+ }
118
+ /**
119
+ * Build options for status subcommand
120
+ */
121
+ static buildStatusOptions(yargs) {
122
+ return yargs
123
+ .positional("provider", {
124
+ type: "string",
125
+ description: "AI provider to check (optional, shows all if not specified)",
126
+ choices: SUPPORTED_PROVIDERS,
127
+ })
128
+ .example("$0 auth status", "Show status for all configured providers")
129
+ .example("$0 auth status anthropic", "Show Anthropic authentication status")
130
+ .example("$0 auth status --format json", "Show status in JSON format");
131
+ }
132
+ /**
133
+ * Build options for refresh subcommand
134
+ */
135
+ static buildRefreshOptions(yargs) {
136
+ return yargs
137
+ .positional("provider", {
138
+ type: "string",
139
+ description: "AI provider to refresh tokens for",
140
+ choices: SUPPORTED_PROVIDERS,
141
+ demandOption: true,
142
+ })
143
+ .example("$0 auth refresh anthropic", "Refresh Anthropic OAuth tokens");
144
+ }
145
+ }
146
+ //# sourceMappingURL=authCommandFactory.js.map
@@ -11,6 +11,12 @@ export declare class CLICommandFactory {
11
11
  private static processCliFiles;
12
12
  private static processCliVideoFiles;
13
13
  private static processOptions;
14
+ /**
15
+ * Validate Anthropic subscription options
16
+ * Ensures subscription tier is provided when using anthropic-subscription provider
17
+ * or when oauth auth method is selected
18
+ */
19
+ private static validateAnthropicSubscriptionOptions;
14
20
  private static handleOutput;
15
21
  /**
16
22
  * Helper method to handle TTS audio file output
@@ -40,6 +40,7 @@ export class CLICommandFactory {
40
40
  "vertex",
41
41
  "googleVertex",
42
42
  "anthropic",
43
+ "anthropic-subscription", // Anthropic with subscription tier support
43
44
  "azure",
44
45
  "google-ai",
45
46
  "google-ai-studio",
@@ -50,9 +51,27 @@ export class CLICommandFactory {
50
51
  "sagemaker",
51
52
  ],
52
53
  default: "auto",
53
- description: "AI provider to use (auto-selects best available)",
54
+ description: "AI provider to use (auto-selects best available). Use 'anthropic-subscription' for Claude subscription plans.",
54
55
  alias: "p",
55
56
  },
57
+ // Anthropic subscription options
58
+ authMethod: {
59
+ type: "string",
60
+ choices: ["api-key", "oauth"],
61
+ default: "api-key",
62
+ description: "Authentication method for Anthropic: 'api-key' (default) or 'oauth' (for subscription plans)",
63
+ },
64
+ subscriptionTier: {
65
+ type: "string",
66
+ choices: ["free", "pro", "max", "max_5", "max_20", "api"],
67
+ description: "Anthropic subscription tier: free (limited), pro ($20/mo), max (highest limits), max_5/max_20 (extended), api (pay-per-use)",
68
+ },
69
+ enableBeta: {
70
+ type: "boolean",
71
+ default: false,
72
+ description: "Enable Anthropic beta features (experimental capabilities, computer use, etc.)",
73
+ alias: "beta",
74
+ },
56
75
  image: {
57
76
  type: "string",
58
77
  description: "Add image file for multimodal analysis (can be used multiple times)",
@@ -515,8 +534,58 @@ export class CLICommandFactory {
515
534
  thinkingLevel: argv.thinkingLevel,
516
535
  // Region option for cloud providers (Vertex AI, Bedrock, etc.)
517
536
  region: argv.region,
537
+ // Anthropic subscription options
538
+ authMethod: argv.authMethod,
539
+ subscriptionTier: argv.subscriptionTier,
540
+ enableBeta: argv.enableBeta,
518
541
  };
519
542
  }
543
+ /**
544
+ * Validate Anthropic subscription options
545
+ * Ensures subscription tier is provided when using anthropic-subscription provider
546
+ * or when oauth auth method is selected
547
+ */
548
+ static validateAnthropicSubscriptionOptions(options) {
549
+ const provider = options.provider;
550
+ const authMethod = options.authMethod;
551
+ let subscriptionTier = options.subscriptionTier;
552
+ const enableBeta = options.enableBeta;
553
+ // Check if using anthropic-subscription provider or oauth auth method
554
+ const isSubscriptionMode = provider === "anthropic-subscription" || authMethod === "oauth";
555
+ if (isSubscriptionMode && !subscriptionTier) {
556
+ logger.always(chalk.yellow("⚠️ Subscription tier not specified. Defaulting to 'api' tier."));
557
+ logger.always(chalk.gray(" Use --subscription-tier to specify: free, pro, max, or api"));
558
+ options.subscriptionTier = "api";
559
+ subscriptionTier = "api";
560
+ }
561
+ // Validate oauth is required for non-api subscription tiers
562
+ if (subscriptionTier &&
563
+ ["free", "pro", "max"].includes(subscriptionTier) &&
564
+ authMethod !== "oauth") {
565
+ logger.always(chalk.yellow(`⚠️ Subscription tier '${subscriptionTier}' typically uses OAuth authentication.`));
566
+ logger.always(chalk.gray(" Consider using --auth-method oauth for this tier."));
567
+ }
568
+ // Map anthropic-subscription to anthropic provider with subscription options
569
+ if (provider === "anthropic-subscription") {
570
+ options.provider = "anthropic";
571
+ options.useSubscription = true;
572
+ }
573
+ // Warn about beta features when enabled
574
+ if (enableBeta) {
575
+ logger.always(chalk.cyan("🧪 Beta features enabled for Anthropic. Experimental capabilities may be unstable."));
576
+ }
577
+ // Build Anthropic auth configuration for provider initialization
578
+ if (provider === "anthropic" || provider === "anthropic-subscription") {
579
+ const authConfig = {
580
+ method: (authMethod === "oauth"
581
+ ? "oauth"
582
+ : "api_key"),
583
+ subscriptionTier: subscriptionTier,
584
+ };
585
+ options.anthropicAuthConfig = authConfig;
586
+ options.enableBeta = enableBeta;
587
+ }
588
+ }
520
589
  // Helper method to handle output
521
590
  static handleOutput(result, options) {
522
591
  let output;
@@ -853,7 +922,9 @@ export class CLICommandFactory {
853
922
  .example('$0 generate "Mountain landscape" --model gemini-2.5-flash-image --imageOutput ./my-images/mountain.png', "Generate image with custom path")
854
923
  .example('$0 generate "Describe this video" --video path/to/video.mp4', "Analyze video content")
855
924
  .example('$0 generate "Product showcase video" --image ./product.jpg --outputMode video --videoOutput ./output.mp4', "Generate video from image")
856
- .example('$0 generate "Smooth camera movement" --image ./input.jpg --provider vertex --model veo-3.1-generate-001 --outputMode video --videoResolution 720p --videoLength 6 --videoAspectRatio 16:9 --videoOutput ./output.mp4', "Video generation with full options"));
925
+ .example('$0 generate "Smooth camera movement" --image ./input.jpg --provider vertex --model veo-3.1-generate-001 --outputMode video --videoResolution 720p --videoLength 6 --videoAspectRatio 16:9 --videoOutput ./output.mp4', "Video generation with full options")
926
+ .example('$0 generate "Explain AI" --provider anthropic --subscription-tier pro', "Use Anthropic with Pro subscription tier")
927
+ .example('$0 generate "Deep analysis" --provider anthropic-subscription --subscription-tier max --auth-method oauth', "Use Anthropic with Max subscription and OAuth"));
857
928
  },
858
929
  handler: async (argv) => await CLICommandFactory.executeGenerate(argv),
859
930
  };
@@ -1076,6 +1147,7 @@ export class CLICommandFactory {
1076
1147
  "openai",
1077
1148
  "openrouter",
1078
1149
  "anthropic",
1150
+ "anthropic-subscription", // Setup Anthropic with subscription tier
1079
1151
  "azure",
1080
1152
  "bedrock",
1081
1153
  "vertex",
@@ -1091,9 +1163,21 @@ export class CLICommandFactory {
1091
1163
  .option("status", {
1092
1164
  type: "boolean",
1093
1165
  description: "Show provider configuration status",
1166
+ })
1167
+ .option("subscription-tier", {
1168
+ type: "string",
1169
+ choices: ["free", "pro", "max", "max_5", "max_20", "api"],
1170
+ description: "Anthropic subscription tier for setup (free, pro, max, max_5, max_20, api)",
1171
+ })
1172
+ .option("auth-method", {
1173
+ type: "string",
1174
+ choices: ["api-key", "oauth"],
1175
+ description: "Authentication method for Anthropic (api-key or oauth)",
1094
1176
  })
1095
1177
  .example("$0 setup", "Interactive setup wizard")
1096
1178
  .example("$0 setup --provider openai", "Setup specific provider")
1179
+ .example("$0 setup --provider anthropic --subscription-tier pro", "Setup Anthropic with Pro subscription")
1180
+ .example("$0 setup --provider anthropic --auth-method oauth", "Setup Anthropic with OAuth authentication")
1097
1181
  .example("$0 setup --list", "List all providers")
1098
1182
  .example("$0 setup --status", "Check provider status"));
1099
1183
  },
@@ -1391,6 +1475,8 @@ export class CLICommandFactory {
1391
1475
  throw new Error('Input required. Use: neurolink generate "your prompt" or echo "prompt" | neurolink generate');
1392
1476
  }
1393
1477
  const options = CLICommandFactory.processOptions(argv);
1478
+ // Validate Anthropic subscription options if using Anthropic provider
1479
+ this.validateAnthropicSubscriptionOptions(options);
1394
1480
  // Determine if video generation mode is enabled
1395
1481
  const isVideoMode = options.outputMode === "video";
1396
1482
  const spinnerMessage = isVideoMode
@@ -1995,6 +2081,8 @@ export class CLICommandFactory {
1995
2081
  static async executeStream(argv) {
1996
2082
  await CLICommandFactory.handleStdinInput(argv);
1997
2083
  const options = CLICommandFactory.processOptions(argv);
2084
+ // Validate Anthropic subscription options if using Anthropic provider
2085
+ this.validateAnthropicSubscriptionOptions(options);
1998
2086
  if (!options.quiet) {
1999
2087
  logger.always(chalk.blue("🔄 Streaming..."));
2000
2088
  }
@@ -2025,6 +2113,8 @@ export class CLICommandFactory {
2025
2113
  */
2026
2114
  static async executeBatch(argv) {
2027
2115
  const options = CLICommandFactory.processOptions(argv);
2116
+ // Validate Anthropic subscription options if using Anthropic provider
2117
+ CLICommandFactory.validateAnthropicSubscriptionOptions(options);
2028
2118
  const spinner = options.quiet ? null : ora().start();
2029
2119
  try {
2030
2120
  if (!argv.file) {
@@ -11,6 +11,7 @@ import { ServerCommandFactory } from "./commands/server.js";
11
11
  import { ServeCommandFactory } from "./commands/serve.js";
12
12
  import { ragCommand } from "./commands/rag.js";
13
13
  import { DocsCommandFactory } from "./commands/docs.js";
14
+ import { AuthCommandFactory } from "./factories/authCommandFactory.js";
14
15
  // Enhanced CLI with Professional UX
15
16
  export function initializeCliParser() {
16
17
  return (yargs(hideBin(process.argv))
@@ -24,7 +25,13 @@ export function initializeCliParser() {
24
25
  .strictCommands()
25
26
  .demandCommand(1, "")
26
27
  .recommendCommands()
27
- .epilogue("For more info: https://github.com/juspay/neurolink")
28
+ .epilogue("For more info: https://github.com/juspay/neurolink\n\n" +
29
+ "Anthropic Subscription Tiers:\n" +
30
+ " free - Limited free tier access\n" +
31
+ " pro - Professional tier ($20/mo)\n" +
32
+ " max - Maximum tier with highest limits\n" +
33
+ " api - Direct API access (pay-per-use)\n\n" +
34
+ "Use 'neurolink auth login anthropic' to configure authentication")
28
35
  .showHelpOnFail(true, "Specify --help for available options")
29
36
  .middleware((argv) => {
30
37
  // Handle no-color option globally
@@ -169,6 +176,8 @@ export function initializeCliParser() {
169
176
  // RAG Document Processing Commands
170
177
  .command(ragCommand)
171
178
  // Docs MCP Server Command
172
- .command(DocsCommandFactory.createDocsCommand())); // Close the main return statement
179
+ .command(DocsCommandFactory.createDocsCommand())
180
+ // Auth Commands - Using AuthCommandFactory
181
+ .command(AuthCommandFactory.createAuthCommands())); // Close the main return statement
173
182
  }
174
183
  //# sourceMappingURL=parser.js.map
@@ -486,3 +486,23 @@ export declare enum ErrorSeverity {
486
486
  HIGH = "high",
487
487
  CRITICAL = "critical"
488
488
  }
489
+ /**
490
+ * Beta features available for Anthropic API
491
+ *
492
+ * @description Beta feature flags that can be enabled for enhanced functionality:
493
+ * - CLAUDE_CODE: Claude Code beta features for development workflows
494
+ * - INTERLEAVED_THINKING: Enables interleaved thinking in responses
495
+ * - FINE_GRAINED_STREAMING: Fine-grained tool streaming for better UX
496
+ */
497
+ export declare enum AnthropicBetaFeature {
498
+ CLAUDE_CODE = "claude-code-20250219",
499
+ INTERLEAVED_THINKING = "interleaved-thinking-2025-05-14",
500
+ FINE_GRAINED_STREAMING = "fine-grained-tool-streaming-2025-05-14"
501
+ }
502
+ /**
503
+ * Buffer time in milliseconds before token expiry to trigger refresh
504
+ *
505
+ * @description Tokens are refreshed 5 minutes before expiry to prevent
506
+ * authentication failures during ongoing operations
507
+ */
508
+ export declare const TOKEN_EXPIRY_BUFFER_MS: number;
@@ -656,3 +656,33 @@ export var ErrorSeverity;
656
656
  ErrorSeverity["HIGH"] = "high";
657
657
  ErrorSeverity["CRITICAL"] = "critical";
658
658
  })(ErrorSeverity || (ErrorSeverity = {}));
659
+ // ============================================================================
660
+ // CLAUDE SUBSCRIPTION ENUMS
661
+ // ============================================================================
662
+ // Note: ClaudeSubscriptionTier and AnthropicAuthMethod are defined as type
663
+ // aliases in types/subscriptionTypes.ts (canonical definitions).
664
+ // The type aliases support all 6 tier values: free, pro, max, max_5, max_20, api.
665
+ /**
666
+ * Beta features available for Anthropic API
667
+ *
668
+ * @description Beta feature flags that can be enabled for enhanced functionality:
669
+ * - CLAUDE_CODE: Claude Code beta features for development workflows
670
+ * - INTERLEAVED_THINKING: Enables interleaved thinking in responses
671
+ * - FINE_GRAINED_STREAMING: Fine-grained tool streaming for better UX
672
+ */
673
+ export var AnthropicBetaFeature;
674
+ (function (AnthropicBetaFeature) {
675
+ AnthropicBetaFeature["CLAUDE_CODE"] = "claude-code-20250219";
676
+ AnthropicBetaFeature["INTERLEAVED_THINKING"] = "interleaved-thinking-2025-05-14";
677
+ AnthropicBetaFeature["FINE_GRAINED_STREAMING"] = "fine-grained-tool-streaming-2025-05-14";
678
+ })(AnthropicBetaFeature || (AnthropicBetaFeature = {}));
679
+ // ============================================================================
680
+ // ANTHROPIC OAUTH CONSTANTS
681
+ // ============================================================================
682
+ /**
683
+ * Buffer time in milliseconds before token expiry to trigger refresh
684
+ *
685
+ * @description Tokens are refreshed 5 minutes before expiry to prevent
686
+ * authentication failures during ongoing operations
687
+ */
688
+ export const TOKEN_EXPIRY_BUFFER_MS = 5 * 60 * 1000; // 5 minutes
@@ -187,6 +187,8 @@ export declare const CONSTANTS_METADATA: {
187
187
  readonly VERSION: "1.0.0";
188
188
  readonly LAST_UPDATED: "2025-01-27";
189
189
  readonly TOTAL_CONSTANTS: 300;
190
- readonly CATEGORIES: readonly ["timeouts", "retry", "performance", "tokens"];
190
+ readonly CATEGORIES: readonly ["timeouts", "retry", "performance", "tokens", "enums"];
191
191
  readonly COMPATIBILITY: "backward_compatible";
192
192
  };
193
+ export { AIProviderName, OpenRouterModels, BedrockModels, OpenAIModels, AzureOpenAIModels, VertexModels, GoogleAIModels, AnthropicModels, MistralModels, OllamaModels, LiteLLMModels, HuggingFaceModels, SageMakerModels, APIVersions, ErrorCategory, ErrorSeverity, AnthropicBetaFeature, TOKEN_EXPIRY_BUFFER_MS, } from "./enums.js";
194
+ export type { ClaudeSubscriptionTier, AnthropicAuthMethod, } from "../types/subscriptionTypes.js";
@@ -190,6 +190,16 @@ export const CONSTANTS_METADATA = {
190
190
  VERSION: "1.0.0",
191
191
  LAST_UPDATED: "2025-01-27",
192
192
  TOTAL_CONSTANTS: 300,
193
- CATEGORIES: ["timeouts", "retry", "performance", "tokens"],
193
+ CATEGORIES: ["timeouts", "retry", "performance", "tokens", "enums"],
194
194
  COMPATIBILITY: "backward_compatible",
195
195
  };
196
+ // ===== ENUMS =====
197
+ export {
198
+ // Provider and Model Enums
199
+ AIProviderName, OpenRouterModels, BedrockModels, OpenAIModels, AzureOpenAIModels, VertexModels, GoogleAIModels, AnthropicModels, MistralModels, OllamaModels, LiteLLMModels, HuggingFaceModels, SageMakerModels, APIVersions,
200
+ // Error Enums
201
+ ErrorCategory, ErrorSeverity,
202
+ // Claude Subscription Enums
203
+ AnthropicBetaFeature,
204
+ // OAuth Constants
205
+ TOKEN_EXPIRY_BUFFER_MS, } from "./enums.js";
package/dist/index.d.ts CHANGED
@@ -192,7 +192,7 @@ export declare function createBestAIProvider(requestedProvider?: string, modelNa
192
192
  * ```
193
193
  */
194
194
  export { CircuitBreakerManager, calculateExpiresAt, createMCPServer, createOAuthProviderFromConfig, DEFAULT_HTTP_RETRY_CONFIG, DEFAULT_RATE_LIMIT_CONFIG, executeMCP, FileTokenStorage, getMCPStats, getServerInfo, globalCircuitBreakerManager, globalRateLimiterManager, HTTPRateLimiter, InMemoryTokenStorage, initializeMCPEcosystem, isRetryableHTTPError, isRetryableStatusCode, isTokenExpired, listMCPs, MCPCircuitBreaker, mcpLogger, NeuroLinkOAuthProvider, RateLimiterManager, validateServerTools, validateTool as validateMCPTool, withHTTPRetry, } from "./mcp/index.js";
195
- export type { AuthorizationUrlResult, DiscoveredMcp, HTTPRetryConfig, MCPOAuthConfig, McpMetadata, OAuthClientInformation, OAuthTokens, RateLimitConfig, TokenExchangeRequest, TokenStorage, } from "./types/mcpTypes.js";
195
+ export type { AuthorizationUrlResult, DiscoveredMcp, HTTPRetryConfig, MCPOAuthConfig, McpMetadata, OAuthClientInformation, OAuthTokens as McpOAuthTokens, RateLimitConfig, TokenExchangeRequest, TokenStorage, } from "./types/mcpTypes.js";
196
196
  export type { ExecutionContext, ToolExecutionResult, ToolInfo, } from "./types/tools.js";
197
197
  export type { LogLevel } from "./types/utilities.js";
198
198
  export { logger } from "./utils/logger.js";