@vybestack/llxprt-code-core 0.8.0 → 0.9.0-nightly.260119.0f050754d

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 (42) hide show
  1. package/dist/src/auth/token-store.d.ts +57 -0
  2. package/dist/src/auth/token-store.js +137 -0
  3. package/dist/src/auth/token-store.js.map +1 -1
  4. package/dist/src/core/nonInteractiveToolExecutor.js +6 -1
  5. package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
  6. package/dist/src/index.d.ts +1 -0
  7. package/dist/src/index.js +3 -1
  8. package/dist/src/index.js.map +1 -1
  9. package/dist/src/models/hydration.d.ts +40 -0
  10. package/dist/src/models/hydration.js +148 -0
  11. package/dist/src/models/hydration.js.map +1 -0
  12. package/dist/src/models/index.d.ts +33 -0
  13. package/dist/src/models/index.js +46 -0
  14. package/dist/src/models/index.js.map +1 -0
  15. package/dist/src/models/profiles.d.ts +19 -0
  16. package/dist/src/models/profiles.js +83 -0
  17. package/dist/src/models/profiles.js.map +1 -0
  18. package/dist/src/models/provider-integration.d.ts +49 -0
  19. package/dist/src/models/provider-integration.js +162 -0
  20. package/dist/src/models/provider-integration.js.map +1 -0
  21. package/dist/src/models/registry.d.ts +137 -0
  22. package/dist/src/models/registry.js +321 -0
  23. package/dist/src/models/registry.js.map +1 -0
  24. package/dist/src/models/schema.d.ts +1173 -0
  25. package/dist/src/models/schema.js +166 -0
  26. package/dist/src/models/schema.js.map +1 -0
  27. package/dist/src/models/transformer.d.ts +21 -0
  28. package/dist/src/models/transformer.js +130 -0
  29. package/dist/src/models/transformer.js.map +1 -0
  30. package/dist/src/providers/IProviderManager.d.ts +7 -3
  31. package/dist/src/providers/ProviderManager.d.ts +2 -2
  32. package/dist/src/providers/ProviderManager.js +56 -1
  33. package/dist/src/providers/ProviderManager.js.map +1 -1
  34. package/dist/src/providers/anthropic/AnthropicProvider.js +15 -15
  35. package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
  36. package/dist/src/providers/gemini/GeminiProvider.js +27 -25
  37. package/dist/src/providers/gemini/GeminiProvider.js.map +1 -1
  38. package/dist/src/providers/openai/OpenAIProvider.js +15 -5
  39. package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
  40. package/dist/src/tools/diffOptions.d.ts +7 -3
  41. package/dist/src/tools/diffOptions.js.map +1 -1
  42. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { ModelsDevModel, LlxprtDefaultProfile } from './schema.js';
7
+ /**
8
+ * Generate optimal default settings per model based on capabilities
9
+ */
10
+ export declare function generateDefaultProfile(model: ModelsDevModel): LlxprtDefaultProfile | undefined;
11
+ /**
12
+ * Get recommended thinking budget based on model context window
13
+ */
14
+ export declare function getRecommendedThinkingBudget(contextWindow: number): number;
15
+ /**
16
+ * Merge user profile settings with model defaults
17
+ * User settings take precedence over defaults
18
+ */
19
+ export declare function mergeProfileWithDefaults(userProfile: Partial<LlxprtDefaultProfile>, modelDefaults: LlxprtDefaultProfile | undefined): LlxprtDefaultProfile;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Generate optimal default settings per model based on capabilities
8
+ */
9
+ export function generateDefaultProfile(model) {
10
+ const profile = {};
11
+ // Reasoning models
12
+ if (model.reasoning) {
13
+ profile.thinkingEnabled = true;
14
+ profile.thinkingBudget = 10000; // Conservative default
15
+ // Lower temperature for reasoning models
16
+ if (model.temperature) {
17
+ profile.temperature = 0.7;
18
+ }
19
+ }
20
+ else {
21
+ // Non-reasoning models
22
+ if (model.temperature) {
23
+ profile.temperature = 1.0;
24
+ }
25
+ }
26
+ // Top-p recommendations
27
+ if (model.temperature) {
28
+ profile.topP = 0.95; // Standard default
29
+ }
30
+ // Provider/family-specific tuning
31
+ const family = model.family?.toLowerCase() ?? '';
32
+ const modelId = model.id.toLowerCase();
33
+ if (family.includes('gpt-5') || modelId.includes('gpt-5')) {
34
+ // GPT-5 models prefer higher temperature
35
+ profile.temperature = 1.2;
36
+ profile.topP = 0.98;
37
+ }
38
+ else if (family.includes('claude') || modelId.includes('claude')) {
39
+ // Claude models work well with slightly lower values
40
+ profile.temperature = 0.8;
41
+ profile.topP = 0.9;
42
+ }
43
+ else if (family.includes('gemini') || modelId.includes('gemini')) {
44
+ // Gemini tuning
45
+ profile.temperature = 1.0;
46
+ profile.topP = 0.95;
47
+ profile.topK = 40;
48
+ }
49
+ else if (family.includes('deepseek') || modelId.includes('deepseek')) {
50
+ // DeepSeek models
51
+ profile.temperature = 0.7;
52
+ profile.topP = 0.9;
53
+ }
54
+ else if (family.includes('qwen') || modelId.includes('qwen')) {
55
+ // Qwen models
56
+ profile.temperature = 0.7;
57
+ profile.topP = 0.8;
58
+ }
59
+ // Return undefined if no profile settings were set
60
+ if (Object.keys(profile).length === 0) {
61
+ return undefined;
62
+ }
63
+ return profile;
64
+ }
65
+ /**
66
+ * Get recommended thinking budget based on model context window
67
+ */
68
+ export function getRecommendedThinkingBudget(contextWindow) {
69
+ // Use ~5% of context window for thinking, capped at reasonable limits
70
+ const budget = Math.floor(contextWindow * 0.05);
71
+ return Math.min(Math.max(budget, 5000), 50000);
72
+ }
73
+ /**
74
+ * Merge user profile settings with model defaults
75
+ * User settings take precedence over defaults
76
+ */
77
+ export function mergeProfileWithDefaults(userProfile, modelDefaults) {
78
+ return {
79
+ ...modelDefaults,
80
+ ...userProfile,
81
+ };
82
+ }
83
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../src/models/profiles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAqB;IAErB,MAAM,OAAO,GAAyB,EAAE,CA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C
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Provider Integration Layer for ModelsRegistry
8
+ *
9
+ * Provides utilities for IProvider implementations to fetch model data
10
+ * from the ModelsRegistry with graceful fallback to hardcoded lists.
11
+ */
12
+ import type { IModel } from '../providers/IModel.js';
13
+ import type { LlxprtModel } from './schema.js';
14
+ /**
15
+ * Maps llxprt provider names to models.dev provider IDs
16
+ * models.dev uses different naming in some cases
17
+ */
18
+ export declare const PROVIDER_ID_MAP: Record<string, string[]>;
19
+ /**
20
+ * Converts an LlxprtModel to the IModel interface
21
+ * LlxprtModel already has all IModel fields, but this ensures type safety
22
+ */
23
+ export declare function llxprtModelToIModel(model: LlxprtModel): IModel;
24
+ /**
25
+ * Get the models.dev provider IDs for a given llxprt provider name.
26
+ * Falls back to using the provider name itself if no mapping exists.
27
+ *
28
+ * @param providerName - The llxprt provider name (e.g., 'gemini', 'openai')
29
+ * @returns Array of models.dev provider IDs
30
+ */
31
+ export declare function getModelsDevProviderIds(providerName: string): string[];
32
+ /**
33
+ * Check if a specific model ID exists in the registry for a provider
34
+ */
35
+ export declare function hasModelInRegistry(providerName: string, modelId: string): boolean;
36
+ /**
37
+ * Get extended model info from registry (pricing, capabilities, etc.)
38
+ * Returns undefined if model not found or registry unavailable
39
+ */
40
+ export declare function getExtendedModelInfo(providerName: string, modelId: string): LlxprtModel | undefined;
41
+ /**
42
+ * Get recommended model for a provider based on capabilities
43
+ * Useful for selecting default models
44
+ */
45
+ export declare function getRecommendedModel(providerName: string, options?: {
46
+ requireToolCalling?: boolean;
47
+ requireReasoning?: boolean;
48
+ preferCheaper?: boolean;
49
+ }): LlxprtModel | undefined;
@@ -0,0 +1,162 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { getModelRegistry } from './registry.js';
7
+ /**
8
+ * Maps llxprt provider names to models.dev provider IDs
9
+ * models.dev uses different naming in some cases
10
+ */
11
+ export const PROVIDER_ID_MAP = {
12
+ // llxprt provider name -> models.dev provider ID(s)
13
+ gemini: ['google', 'google-vertex'],
14
+ openai: ['openai'],
15
+ anthropic: ['anthropic'],
16
+ 'openai-responses': ['openai'],
17
+ 'openai-vercel': ['openai'],
18
+ deepseek: ['deepseek'],
19
+ groq: ['groq'],
20
+ mistral: ['mistral'],
21
+ cohere: ['cohere'],
22
+ xai: ['xai'],
23
+ ollama: ['ollama'],
24
+ togetherai: ['togetherai'],
25
+ perplexity: ['perplexity'],
26
+ fireworks: ['fireworks-ai'],
27
+ // Alias provider display names -> models.dev provider IDs
28
+ 'Chutes.ai': ['chutes'],
29
+ xAI: ['xai'],
30
+ Synthetic: ['synthetic'],
31
+ Fireworks: ['fireworks-ai'],
32
+ OpenRouter: ['openrouter'],
33
+ 'Cerebras Code': ['cerebras'],
34
+ 'LM Studio': ['lmstudio'],
35
+ 'llama.cpp': ['llama'],
36
+ qwen: ['alibaba'],
37
+ qwenvercel: ['alibaba'],
38
+ codex: ['openai'],
39
+ kimi: ['kimi-for-coding'],
40
+ };
41
+ /**
42
+ * Converts an LlxprtModel to the IModel interface
43
+ * LlxprtModel already has all IModel fields, but this ensures type safety
44
+ */
45
+ export function llxprtModelToIModel(model) {
46
+ return {
47
+ id: model.modelId, // Use the short model ID, not the full "provider/model" ID
48
+ name: model.name,
49
+ provider: model.provider,
50
+ supportedToolFormats: model.supportedToolFormats,
51
+ contextWindow: model.contextWindow,
52
+ maxOutputTokens: model.maxOutputTokens,
53
+ };
54
+ }
55
+ /**
56
+ * Get the models.dev provider IDs for a given llxprt provider name.
57
+ * Falls back to using the provider name itself if no mapping exists.
58
+ *
59
+ * @param providerName - The llxprt provider name (e.g., 'gemini', 'openai')
60
+ * @returns Array of models.dev provider IDs
61
+ */
62
+ export function getModelsDevProviderIds(providerName) {
63
+ return PROVIDER_ID_MAP[providerName] ?? [providerName];
64
+ }
65
+ /**
66
+ * Check if a specific model ID exists in the registry for a provider
67
+ */
68
+ export function hasModelInRegistry(providerName, modelId) {
69
+ try {
70
+ const registry = getModelRegistry();
71
+ if (!registry.isInitialized()) {
72
+ return false;
73
+ }
74
+ const providerIds = getModelsDevProviderIds(providerName);
75
+ for (const providerId of providerIds) {
76
+ // Try full ID format (provider/model)
77
+ const fullId = `${providerId}/${modelId}`;
78
+ if (registry.getById(fullId)) {
79
+ return true;
80
+ }
81
+ }
82
+ return false;
83
+ }
84
+ catch {
85
+ return false;
86
+ }
87
+ }
88
+ /**
89
+ * Get extended model info from registry (pricing, capabilities, etc.)
90
+ * Returns undefined if model not found or registry unavailable
91
+ */
92
+ export function getExtendedModelInfo(providerName, modelId) {
93
+ try {
94
+ const registry = getModelRegistry();
95
+ if (!registry.isInitialized()) {
96
+ return undefined;
97
+ }
98
+ const providerIds = getModelsDevProviderIds(providerName);
99
+ for (const providerId of providerIds) {
100
+ const fullId = `${providerId}/${modelId}`;
101
+ const model = registry.getById(fullId);
102
+ if (model) {
103
+ return model;
104
+ }
105
+ }
106
+ return undefined;
107
+ }
108
+ catch {
109
+ return undefined;
110
+ }
111
+ }
112
+ /**
113
+ * Get recommended model for a provider based on capabilities
114
+ * Useful for selecting default models
115
+ */
116
+ export function getRecommendedModel(providerName, options) {
117
+ try {
118
+ const registry = getModelRegistry();
119
+ if (!registry.isInitialized()) {
120
+ return undefined;
121
+ }
122
+ const providerIds = getModelsDevProviderIds(providerName);
123
+ // Collect all models from mapped providers
124
+ let candidates = [];
125
+ for (const providerId of providerIds) {
126
+ candidates.push(...registry.getByProvider(providerId));
127
+ }
128
+ // Filter out deprecated
129
+ candidates = candidates.filter((m) => m.metadata?.status !== 'deprecated');
130
+ // Apply capability filters
131
+ if (options?.requireToolCalling) {
132
+ candidates = candidates.filter((m) => m.capabilities.toolCalling);
133
+ }
134
+ if (options?.requireReasoning) {
135
+ candidates = candidates.filter((m) => m.capabilities.reasoning);
136
+ }
137
+ if (candidates.length === 0) {
138
+ return undefined;
139
+ }
140
+ // Sort by preference
141
+ if (options?.preferCheaper) {
142
+ candidates.sort((a, b) => {
143
+ const priceA = a.pricing?.input ?? Infinity;
144
+ const priceB = b.pricing?.input ?? Infinity;
145
+ return priceA - priceB;
146
+ });
147
+ }
148
+ else {
149
+ // Default: prefer larger context window (usually better models)
150
+ candidates.sort((a, b) => {
151
+ const ctxA = a.limits.contextWindow ?? 0;
152
+ const ctxB = b.limits.contextWindow ?? 0;
153
+ return ctxB - ctxA;
154
+ });
155
+ }
156
+ return candidates[0];
157
+ }
158
+ catch {
159
+ return undefined;
160
+ }
161
+ }
162
+ //# sourceMappingURL=provider-integration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-integration.js","sourceRoot":"","sources":["../../../src/models/provider-integration.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAA6B;IACvD,oDAAoD;IACpD,MAAM,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,MAAM,EAAE,CAAC,QAAQ,CAAC;IAClB,SAAS,EAAE,CAAC,WAAW,CAAC;IACxB,kBAAkB,EAAE,CAAC,QAAQ,CAAC;IAC9B,eAAe,EAAE,CAAC,QAAQ,CAAC;IAC3B,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,MAAM,EAAE,CAAC,QAAQ,CAAC;IAClB,GAAG,EAAE,CAAC,KAAK,CAAC;IACZ,MAAM,EAAE,CAAC,QAAQ,CAAC;IAClB,UAAU,EAAE,CAAC,YAAY,CAAC;IAC1B,UAAU,EAAE,CAAC,YAAY,CAAC;IAC1B,SAAS,EAAE,CAAC,cAAc,CAAC;IAE3B,0DAA0D;IAC1D,WAAW,EAAE,CAAC,QAAQ,CAAC;IACvB,GAAG,EAAE,CAAC,KAAK,CAAC;IACZ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,IAAI,CAAC,CAAC;gBACzC,OAAO,IAAI,GAAG,IAAI,CAAC;YACrB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { type LlxprtModel, type LlxprtProvider, type ModelCacheMetadata } from './schema.js';
7
+ /**
8
+ * Search query options for filtering models
9
+ */
10
+ export interface ModelSearchQuery {
11
+ provider?: string;
12
+ capability?: keyof LlxprtModel['capabilities'];
13
+ maxPrice?: number;
14
+ minContext?: number;
15
+ reasoning?: boolean;
16
+ toolCalling?: boolean;
17
+ }
18
+ /**
19
+ * Event types emitted by the registry
20
+ */
21
+ export type ModelRegistryEvent = 'models:updated' | 'models:error';
22
+ type EventCallback = () => void;
23
+ /**
24
+ * ModelRegistry - Central registry for AI model metadata from models.dev
25
+ *
26
+ * Provides:
27
+ * - Automatic loading from cache or bundled fallback
28
+ * - Background periodic refresh (24h)
29
+ * - Search and filtering by capabilities, price, context
30
+ * - Event emission for UI updates
31
+ */
32
+ export declare class ModelRegistry {
33
+ private models;
34
+ private providers;
35
+ private lastRefresh;
36
+ private refreshTimer;
37
+ private listeners;
38
+ private initialized;
39
+ private initPromise;
40
+ /**
41
+ * Get the cache file path
42
+ */
43
+ private static getCachePath;
44
+ /**
45
+ * Initialize the registry - loads models and starts background refresh
46
+ */
47
+ initialize(): Promise<void>;
48
+ /**
49
+ * Load models from cache or trigger fresh fetch
50
+ */
51
+ private loadModels;
52
+ /**
53
+ * Load from cache file if fresh
54
+ */
55
+ private loadFromCache;
56
+ /**
57
+ * Refresh models from models.dev API (non-blocking)
58
+ */
59
+ refresh(): Promise<boolean>;
60
+ /**
61
+ * Save data to cache file
62
+ */
63
+ private saveToCache;
64
+ /**
65
+ * Populate internal maps from API response
66
+ */
67
+ private populateModels;
68
+ /**
69
+ * Start background refresh timer
70
+ */
71
+ private startBackgroundRefresh;
72
+ /**
73
+ * Stop background refresh and cleanup
74
+ */
75
+ dispose(): void;
76
+ /**
77
+ * Get all models
78
+ */
79
+ getAll(): LlxprtModel[];
80
+ /**
81
+ * Get model by full ID (provider/model-id)
82
+ */
83
+ getById(id: string): LlxprtModel | undefined;
84
+ /**
85
+ * Get all models for a specific provider
86
+ */
87
+ getByProvider(providerId: string): LlxprtModel[];
88
+ /**
89
+ * Search models by various criteria
90
+ */
91
+ search(query: ModelSearchQuery): LlxprtModel[];
92
+ /**
93
+ * Get all providers
94
+ */
95
+ getProviders(): LlxprtProvider[];
96
+ /**
97
+ * Get provider by ID
98
+ */
99
+ getProvider(providerId: string): LlxprtProvider | undefined;
100
+ /**
101
+ * Get cache metadata
102
+ */
103
+ getCacheMetadata(): ModelCacheMetadata | null;
104
+ /**
105
+ * Check if registry has been initialized
106
+ */
107
+ isInitialized(): boolean;
108
+ /**
109
+ * Get model count
110
+ */
111
+ getModelCount(): number;
112
+ /**
113
+ * Get provider count
114
+ */
115
+ getProviderCount(): number;
116
+ /**
117
+ * Subscribe to registry events
118
+ */
119
+ on(event: ModelRegistryEvent, callback: EventCallback): void;
120
+ /**
121
+ * Unsubscribe from registry events
122
+ */
123
+ off(event: ModelRegistryEvent, callback: EventCallback): void;
124
+ /**
125
+ * Emit an event
126
+ */
127
+ private emit;
128
+ }
129
+ /**
130
+ * Get the global ModelRegistry instance
131
+ */
132
+ export declare function getModelRegistry(): ModelRegistry;
133
+ /**
134
+ * Initialize the global ModelRegistry
135
+ */
136
+ export declare function initializeModelRegistry(): Promise<ModelRegistry>;
137
+ export {};