@visualprd/mcp-server 1.1.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/README.md +396 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +27 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +243 -0
- package/dist/index.js.map +1 -0
- package/dist/intelligence/context-optimizer.d.ts +93 -0
- package/dist/intelligence/context-optimizer.d.ts.map +1 -0
- package/dist/intelligence/context-optimizer.js +481 -0
- package/dist/intelligence/context-optimizer.js.map +1 -0
- package/dist/intelligence/error-analyzer.d.ts +49 -0
- package/dist/intelligence/error-analyzer.d.ts.map +1 -0
- package/dist/intelligence/error-analyzer.js +765 -0
- package/dist/intelligence/error-analyzer.js.map +1 -0
- package/dist/intelligence/gap-filler.d.ts +56 -0
- package/dist/intelligence/gap-filler.d.ts.map +1 -0
- package/dist/intelligence/gap-filler.js +410 -0
- package/dist/intelligence/gap-filler.js.map +1 -0
- package/dist/intelligence/guidance-generator.d.ts +43 -0
- package/dist/intelligence/guidance-generator.d.ts.map +1 -0
- package/dist/intelligence/guidance-generator.js +314 -0
- package/dist/intelligence/guidance-generator.js.map +1 -0
- package/dist/intelligence/index.d.ts +132 -0
- package/dist/intelligence/index.d.ts.map +1 -0
- package/dist/intelligence/index.js +683 -0
- package/dist/intelligence/index.js.map +1 -0
- package/dist/server-http.d.ts +9 -0
- package/dist/server-http.d.ts.map +1 -0
- package/dist/server-http.js +141 -0
- package/dist/server-http.js.map +1 -0
- package/dist/services/api-key-service.d.ts +68 -0
- package/dist/services/api-key-service.d.ts.map +1 -0
- package/dist/services/api-key-service.js +298 -0
- package/dist/services/api-key-service.js.map +1 -0
- package/dist/services/llm-client.d.ts +66 -0
- package/dist/services/llm-client.d.ts.map +1 -0
- package/dist/services/llm-client.js +141 -0
- package/dist/services/llm-client.js.map +1 -0
- package/dist/services/model-registry.d.ts +135 -0
- package/dist/services/model-registry.d.ts.map +1 -0
- package/dist/services/model-registry.js +276 -0
- package/dist/services/model-registry.js.map +1 -0
- package/dist/services/visualprd-client.d.ts +191 -0
- package/dist/services/visualprd-client.d.ts.map +1 -0
- package/dist/services/visualprd-client.js +805 -0
- package/dist/services/visualprd-client.js.map +1 -0
- package/dist/tools/index.d.ts +803 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +570 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types/index.d.ts +497 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* LLM Client
|
|
4
|
+
*
|
|
5
|
+
* Handles communication with LLM APIs via OpenRouter.
|
|
6
|
+
* Supports dynamic model switching for intelligent guidance.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LLMClient = void 0;
|
|
10
|
+
const DEFAULT_CONFIG = {
|
|
11
|
+
baseUrl: 'https://openrouter.ai/api/v1',
|
|
12
|
+
model: 'anthropic/claude-3.5-sonnet',
|
|
13
|
+
maxTokens: 4096,
|
|
14
|
+
temperature: 0.7,
|
|
15
|
+
};
|
|
16
|
+
class LLMClient {
|
|
17
|
+
config;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.config = {
|
|
20
|
+
apiKey: config.apiKey || process.env.OPENROUTER_API_KEY || '',
|
|
21
|
+
model: config.model || DEFAULT_CONFIG.model,
|
|
22
|
+
baseUrl: config.baseUrl || DEFAULT_CONFIG.baseUrl,
|
|
23
|
+
maxTokens: config.maxTokens || DEFAULT_CONFIG.maxTokens,
|
|
24
|
+
temperature: config.temperature ?? DEFAULT_CONFIG.temperature,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Update the model dynamically (for real-time switching)
|
|
29
|
+
*/
|
|
30
|
+
setModel(model) {
|
|
31
|
+
console.error(`[LLMClient] Switching model from ${this.config.model} to ${model}`);
|
|
32
|
+
this.config.model = model;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get the current model
|
|
36
|
+
*/
|
|
37
|
+
getModel() {
|
|
38
|
+
return this.config.model;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Send a completion request to the LLM
|
|
42
|
+
*/
|
|
43
|
+
async complete(messages, options) {
|
|
44
|
+
if (!this.config.apiKey) {
|
|
45
|
+
throw new Error('OpenRouter API key is not configured');
|
|
46
|
+
}
|
|
47
|
+
const requestBody = {
|
|
48
|
+
model: this.config.model,
|
|
49
|
+
messages,
|
|
50
|
+
max_tokens: options?.maxTokens || this.config.maxTokens,
|
|
51
|
+
temperature: options?.temperature ?? this.config.temperature,
|
|
52
|
+
};
|
|
53
|
+
if (options?.jsonMode) {
|
|
54
|
+
requestBody.response_format = { type: 'json_object' };
|
|
55
|
+
}
|
|
56
|
+
console.error(`[LLMClient] Calling ${this.config.model} with ${messages.length} messages`);
|
|
57
|
+
const response = await fetch(`${this.config.baseUrl}/chat/completions`, {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: {
|
|
60
|
+
'Content-Type': 'application/json',
|
|
61
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
62
|
+
'HTTP-Referer': 'https://visualprd.com',
|
|
63
|
+
'X-Title': 'VisualPRD MCP Server',
|
|
64
|
+
},
|
|
65
|
+
body: JSON.stringify(requestBody),
|
|
66
|
+
});
|
|
67
|
+
if (!response.ok) {
|
|
68
|
+
const errorText = await response.text();
|
|
69
|
+
console.error(`[LLMClient] API error: ${response.status} - ${errorText}`);
|
|
70
|
+
throw new Error(`LLM API error: ${response.status} - ${errorText}`);
|
|
71
|
+
}
|
|
72
|
+
const data = await response.json();
|
|
73
|
+
const choice = data.choices?.[0];
|
|
74
|
+
if (!choice) {
|
|
75
|
+
throw new Error('No response from LLM');
|
|
76
|
+
}
|
|
77
|
+
const result = {
|
|
78
|
+
content: choice.message?.content || '',
|
|
79
|
+
model: data.model || this.config.model,
|
|
80
|
+
tokensUsed: {
|
|
81
|
+
prompt: data.usage?.prompt_tokens || 0,
|
|
82
|
+
completion: data.usage?.completion_tokens || 0,
|
|
83
|
+
total: data.usage?.total_tokens || 0,
|
|
84
|
+
},
|
|
85
|
+
finishReason: choice.finish_reason || 'unknown',
|
|
86
|
+
};
|
|
87
|
+
console.error(`[LLMClient] Response received: ${result.tokensUsed.total} tokens`);
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Analyze data with a structured JSON response
|
|
92
|
+
*/
|
|
93
|
+
async analyzeJSON(systemPrompt, userPrompt, options) {
|
|
94
|
+
const messages = [
|
|
95
|
+
{ role: 'system', content: systemPrompt },
|
|
96
|
+
{ role: 'user', content: userPrompt },
|
|
97
|
+
];
|
|
98
|
+
const response = await this.complete(messages, {
|
|
99
|
+
maxTokens: options?.maxTokens,
|
|
100
|
+
jsonMode: true,
|
|
101
|
+
temperature: 0.5, // Lower temp for structured output
|
|
102
|
+
});
|
|
103
|
+
try {
|
|
104
|
+
// Try to parse as JSON
|
|
105
|
+
let jsonContent = response.content.trim();
|
|
106
|
+
// Handle markdown code blocks
|
|
107
|
+
if (jsonContent.startsWith('```json')) {
|
|
108
|
+
jsonContent = jsonContent.slice(7);
|
|
109
|
+
}
|
|
110
|
+
if (jsonContent.startsWith('```')) {
|
|
111
|
+
jsonContent = jsonContent.slice(3);
|
|
112
|
+
}
|
|
113
|
+
if (jsonContent.endsWith('```')) {
|
|
114
|
+
jsonContent = jsonContent.slice(0, -3);
|
|
115
|
+
}
|
|
116
|
+
const result = JSON.parse(jsonContent.trim());
|
|
117
|
+
return { result, tokensUsed: response.tokensUsed.total };
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
console.error('[LLMClient] Failed to parse JSON response:', error);
|
|
121
|
+
console.error('[LLMClient] Raw response:', response.content);
|
|
122
|
+
throw new Error('Failed to parse LLM JSON response');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Simple text generation for guidance
|
|
127
|
+
*/
|
|
128
|
+
async generateText(systemPrompt, userPrompt, options) {
|
|
129
|
+
const messages = [
|
|
130
|
+
{ role: 'system', content: systemPrompt },
|
|
131
|
+
{ role: 'user', content: userPrompt },
|
|
132
|
+
];
|
|
133
|
+
const response = await this.complete(messages, {
|
|
134
|
+
maxTokens: options?.maxTokens,
|
|
135
|
+
temperature: 0.7,
|
|
136
|
+
});
|
|
137
|
+
return { text: response.content, tokensUsed: response.tokensUsed.total };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.LLMClient = LLMClient;
|
|
141
|
+
//# sourceMappingURL=llm-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-client.js","sourceRoot":"","sources":["../../src/services/llm-client.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA0BH,MAAM,cAAc,GAAuB;IACvC,OAAO,EAAE,8BAA8B;IACvC,KAAK,EAAE,6BAA6B;IACpC,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,GAAG;CACnB,CAAC;AAEF,MAAa,SAAS;IACV,MAAM,CAAY;IAE1B,YAAY,MAA0B;QAClC,IAAI,CAAC,MAAM,GAAG;YACV,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE;YAC7D,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,cAAc,CAAC,KAAM;YAC5C,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC,OAAQ;YAClD,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,cAAc,CAAC,SAAU;YACxD,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,cAA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AAE,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC7D,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CACd,YAAoB,EACpB,UAAkB,EAClB,OAAgC;QAEhC,MAAM,QAAQ,GAAiB;YAC3B,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE;YACzC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE;SACxC,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YAC3C,SAAS,EAAE,OAAO,EAAE,SAAS;YAC7B,WAAW,EAAE,GAAG;SACnB,CAAC,CAAC;QAEH,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC7E,CAAC;CACJ;AA/JD,8BA+JC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Registry Service for MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Connects to Firestore to load:
|
|
5
|
+
* 1. User's model preferences from users/{userId}/mcpSettings
|
|
6
|
+
* 2. Centralized model registry from system/models
|
|
7
|
+
*
|
|
8
|
+
* This allows the MCP server to use user-configured AI models
|
|
9
|
+
* for thinking, vision, and execution tasks.
|
|
10
|
+
*/
|
|
11
|
+
export interface MCPModel {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
provider: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
categories: ('thinking' | 'vision' | 'execution')[];
|
|
18
|
+
pricing: {
|
|
19
|
+
inputCostPer1M: number;
|
|
20
|
+
outputCostPer1M: number;
|
|
21
|
+
};
|
|
22
|
+
contextWindow: number;
|
|
23
|
+
supportsVision?: boolean;
|
|
24
|
+
supportsToolCalling?: boolean;
|
|
25
|
+
supportsDeepThinking?: boolean;
|
|
26
|
+
supportsInternetSearch?: boolean;
|
|
27
|
+
costTier: 'affordable' | 'medium' | 'high';
|
|
28
|
+
status: 'online' | 'degraded' | 'offline';
|
|
29
|
+
}
|
|
30
|
+
export interface UserMCPSettings {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
thinkingModel: string;
|
|
33
|
+
preferredTier: 'lite' | 'pro' | 'unlimited';
|
|
34
|
+
usage?: {
|
|
35
|
+
totalCalls: number;
|
|
36
|
+
totalTokens: number;
|
|
37
|
+
aiCallsMade: number;
|
|
38
|
+
ruleBasedCalls: number;
|
|
39
|
+
lastUsed?: Date;
|
|
40
|
+
};
|
|
41
|
+
apiKeyConfigured: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface ModelRegistry {
|
|
44
|
+
mcpModels: MCPModel[];
|
|
45
|
+
defaultModels: {
|
|
46
|
+
free: {
|
|
47
|
+
vision: string;
|
|
48
|
+
thinking: string;
|
|
49
|
+
execution: string;
|
|
50
|
+
};
|
|
51
|
+
lite: {
|
|
52
|
+
vision: string;
|
|
53
|
+
thinking: string;
|
|
54
|
+
execution: string;
|
|
55
|
+
};
|
|
56
|
+
pro: {
|
|
57
|
+
vision: string;
|
|
58
|
+
thinking: string;
|
|
59
|
+
execution: string;
|
|
60
|
+
};
|
|
61
|
+
unlimited: {
|
|
62
|
+
vision: string;
|
|
63
|
+
thinking: string;
|
|
64
|
+
execution: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
phaseModels?: Record<string, Record<string, string>>;
|
|
68
|
+
version: number;
|
|
69
|
+
}
|
|
70
|
+
export interface ModelConfig {
|
|
71
|
+
thinkingModel: string;
|
|
72
|
+
visionModel?: string;
|
|
73
|
+
executionModel?: string;
|
|
74
|
+
userTier: 'free' | 'lite' | 'pro' | 'unlimited';
|
|
75
|
+
source: 'user_preference' | 'tier_default' | 'fallback';
|
|
76
|
+
}
|
|
77
|
+
export declare class ModelRegistryService {
|
|
78
|
+
private db;
|
|
79
|
+
private registryCache;
|
|
80
|
+
private cacheTimestamp;
|
|
81
|
+
private readonly CACHE_TTL_MS;
|
|
82
|
+
constructor();
|
|
83
|
+
/**
|
|
84
|
+
* Get model configuration for a user.
|
|
85
|
+
* Loads user preferences and falls back to tier defaults.
|
|
86
|
+
*/
|
|
87
|
+
getModelConfig(userId: string): Promise<ModelConfig>;
|
|
88
|
+
/**
|
|
89
|
+
* Load user's MCP settings from Firestore.
|
|
90
|
+
*/
|
|
91
|
+
getUserSettings(userId: string): Promise<UserMCPSettings | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Load the centralized model registry.
|
|
94
|
+
* Uses caching to reduce Firestore reads.
|
|
95
|
+
*/
|
|
96
|
+
getRegistry(): Promise<ModelRegistry>;
|
|
97
|
+
/**
|
|
98
|
+
* Get a specific model by ID.
|
|
99
|
+
*/
|
|
100
|
+
getModel(modelId: string): Promise<MCPModel | null>;
|
|
101
|
+
/**
|
|
102
|
+
* Get model pricing for cost calculations.
|
|
103
|
+
*/
|
|
104
|
+
getModelPricing(modelId: string): Promise<{
|
|
105
|
+
input: number;
|
|
106
|
+
output: number;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Get all enabled models for a specific role.
|
|
110
|
+
*/
|
|
111
|
+
getModelsForRole(role: 'thinking' | 'vision' | 'execution'): Promise<MCPModel[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Get fallback models for a given model.
|
|
114
|
+
* Used when the primary model fails.
|
|
115
|
+
*/
|
|
116
|
+
getFallbackModels(modelId: string, role: 'thinking' | 'vision' | 'execution'): Promise<string[]>;
|
|
117
|
+
/**
|
|
118
|
+
* Calculate cost for an API call.
|
|
119
|
+
*/
|
|
120
|
+
calculateCost(modelId: string, inputTokens: number, outputTokens: number): Promise<number>;
|
|
121
|
+
/**
|
|
122
|
+
* Record usage for tracking.
|
|
123
|
+
*/
|
|
124
|
+
recordUsage(userId: string, modelId: string, inputTokens: number, outputTokens: number, costUSD: number): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Clear the registry cache.
|
|
127
|
+
*/
|
|
128
|
+
clearCache(): void;
|
|
129
|
+
/**
|
|
130
|
+
* Get default registry when Firestore is unavailable.
|
|
131
|
+
*/
|
|
132
|
+
private getDefaultRegistry;
|
|
133
|
+
}
|
|
134
|
+
export declare function getModelRegistryService(): ModelRegistryService;
|
|
135
|
+
//# sourceMappingURL=model-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../src/services/model-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,CAAC,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC,EAAE,CAAC;IACpD,OAAO,EAAE;QACL,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,EAAE,YAAY,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,KAAK,GAAG,WAAW,CAAC;IAC5C,K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wBAAgB,uBAAuB,IAAI,oBAAoB,CAK9D"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Model Registry Service for MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Connects to Firestore to load:
|
|
6
|
+
* 1. User's model preferences from users/{userId}/mcpSettings
|
|
7
|
+
* 2. Centralized model registry from system/models
|
|
8
|
+
*
|
|
9
|
+
* This allows the MCP server to use user-configured AI models
|
|
10
|
+
* for thinking, vision, and execution tasks.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.ModelRegistryService = void 0;
|
|
14
|
+
exports.getModelRegistryService = getModelRegistryService;
|
|
15
|
+
const firestore_1 = require("@google-cloud/firestore");
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// DEFAULT MODELS (Fallback if Firestore unavailable)
|
|
18
|
+
// ============================================================================
|
|
19
|
+
const DEFAULT_MODELS = {
|
|
20
|
+
free: {
|
|
21
|
+
thinking: 'google/gemini-2.0-flash-lite-001',
|
|
22
|
+
vision: 'openai/gpt-4o-mini',
|
|
23
|
+
execution: 'google/gemini-2.0-flash-lite-001',
|
|
24
|
+
},
|
|
25
|
+
lite: {
|
|
26
|
+
thinking: 'google/gemini-2.0-flash-001',
|
|
27
|
+
vision: 'openai/gpt-4o-mini',
|
|
28
|
+
execution: 'google/gemini-2.0-flash-001',
|
|
29
|
+
},
|
|
30
|
+
pro: {
|
|
31
|
+
thinking: 'anthropic/claude-sonnet-4',
|
|
32
|
+
vision: 'openai/gpt-4o',
|
|
33
|
+
execution: 'openai/gpt-4o',
|
|
34
|
+
},
|
|
35
|
+
unlimited: {
|
|
36
|
+
thinking: 'anthropic/claude-sonnet-4',
|
|
37
|
+
vision: 'openai/gpt-4o',
|
|
38
|
+
execution: 'openai/gpt-4o',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// MODEL REGISTRY SERVICE
|
|
43
|
+
// ============================================================================
|
|
44
|
+
class ModelRegistryService {
|
|
45
|
+
db;
|
|
46
|
+
registryCache = null;
|
|
47
|
+
cacheTimestamp = 0;
|
|
48
|
+
CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
49
|
+
constructor() {
|
|
50
|
+
this.db = new firestore_1.Firestore({
|
|
51
|
+
projectId: process.env.FIREBASE_PROJECT_ID || 'visualprd-staging',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get model configuration for a user.
|
|
56
|
+
* Loads user preferences and falls back to tier defaults.
|
|
57
|
+
*/
|
|
58
|
+
async getModelConfig(userId) {
|
|
59
|
+
try {
|
|
60
|
+
// Load user's MCP settings
|
|
61
|
+
const userSettings = await this.getUserSettings(userId);
|
|
62
|
+
// Determine user tier
|
|
63
|
+
const userTier = userSettings?.preferredTier || 'free';
|
|
64
|
+
// If user has a custom thinking model, use it
|
|
65
|
+
if (userSettings?.thinkingModel) {
|
|
66
|
+
return {
|
|
67
|
+
thinkingModel: userSettings.thinkingModel,
|
|
68
|
+
visionModel: undefined, // Can be extended later
|
|
69
|
+
executionModel: undefined,
|
|
70
|
+
userTier,
|
|
71
|
+
source: 'user_preference',
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// Fall back to tier defaults from registry
|
|
75
|
+
const registry = await this.getRegistry();
|
|
76
|
+
const defaults = registry.defaultModels[userTier] || DEFAULT_MODELS[userTier];
|
|
77
|
+
return {
|
|
78
|
+
thinkingModel: defaults.thinking,
|
|
79
|
+
visionModel: defaults.vision,
|
|
80
|
+
executionModel: defaults.execution,
|
|
81
|
+
userTier,
|
|
82
|
+
source: 'tier_default',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.error('[ModelRegistry] Error loading model config:', error);
|
|
87
|
+
// Ultimate fallback
|
|
88
|
+
return {
|
|
89
|
+
thinkingModel: DEFAULT_MODELS.free.thinking,
|
|
90
|
+
visionModel: DEFAULT_MODELS.free.vision,
|
|
91
|
+
executionModel: DEFAULT_MODELS.free.execution,
|
|
92
|
+
userTier: 'free',
|
|
93
|
+
source: 'fallback',
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Load user's MCP settings from Firestore.
|
|
99
|
+
*/
|
|
100
|
+
async getUserSettings(userId) {
|
|
101
|
+
try {
|
|
102
|
+
const settingsRef = this.db.collection('users').doc(userId).collection('mcpSettings').doc('settings');
|
|
103
|
+
const doc = await settingsRef.get();
|
|
104
|
+
if (!doc.exists) {
|
|
105
|
+
console.log(`[ModelRegistry] No MCP settings for user ${userId}`);
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
return doc.data();
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
console.error(`[ModelRegistry] Error loading user settings:`, error);
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Load the centralized model registry.
|
|
117
|
+
* Uses caching to reduce Firestore reads.
|
|
118
|
+
*/
|
|
119
|
+
async getRegistry() {
|
|
120
|
+
// Check cache
|
|
121
|
+
if (this.registryCache && (Date.now() - this.cacheTimestamp < this.CACHE_TTL_MS)) {
|
|
122
|
+
return this.registryCache;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const registryRef = this.db.collection('system').doc('models');
|
|
126
|
+
const doc = await registryRef.get();
|
|
127
|
+
if (!doc.exists) {
|
|
128
|
+
console.log('[ModelRegistry] No registry found, using defaults');
|
|
129
|
+
return this.getDefaultRegistry();
|
|
130
|
+
}
|
|
131
|
+
const data = doc.data();
|
|
132
|
+
this.registryCache = data;
|
|
133
|
+
this.cacheTimestamp = Date.now();
|
|
134
|
+
console.log(`[ModelRegistry] Loaded ${data.mcpModels?.length || 0} models from registry`);
|
|
135
|
+
return data;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
console.error('[ModelRegistry] Error loading registry:', error);
|
|
139
|
+
return this.getDefaultRegistry();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get a specific model by ID.
|
|
144
|
+
*/
|
|
145
|
+
async getModel(modelId) {
|
|
146
|
+
const registry = await this.getRegistry();
|
|
147
|
+
return registry.mcpModels?.find(m => m.id === modelId) || null;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get model pricing for cost calculations.
|
|
151
|
+
*/
|
|
152
|
+
async getModelPricing(modelId) {
|
|
153
|
+
const model = await this.getModel(modelId);
|
|
154
|
+
if (model) {
|
|
155
|
+
return {
|
|
156
|
+
input: model.pricing.inputCostPer1M,
|
|
157
|
+
output: model.pricing.outputCostPer1M,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// Conservative default if model not found
|
|
161
|
+
console.warn(`[ModelRegistry] Model ${modelId} not found, using default pricing`);
|
|
162
|
+
return { input: 3.0, output: 15.0 };
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get all enabled models for a specific role.
|
|
166
|
+
*/
|
|
167
|
+
async getModelsForRole(role) {
|
|
168
|
+
const registry = await this.getRegistry();
|
|
169
|
+
return (registry.mcpModels || [])
|
|
170
|
+
.filter(m => m.enabled && m.categories.includes(role))
|
|
171
|
+
.sort((a, b) => {
|
|
172
|
+
// Sort by cost tier (affordable first)
|
|
173
|
+
const tierOrder = { affordable: 0, medium: 1, high: 2 };
|
|
174
|
+
return (tierOrder[a.costTier] || 1) - (tierOrder[b.costTier] || 1);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get fallback models for a given model.
|
|
179
|
+
* Used when the primary model fails.
|
|
180
|
+
*/
|
|
181
|
+
async getFallbackModels(modelId, role) {
|
|
182
|
+
const registry = await this.getRegistry();
|
|
183
|
+
const primaryModel = registry.mcpModels?.find(m => m.id === modelId);
|
|
184
|
+
if (!primaryModel) {
|
|
185
|
+
// Return tier defaults
|
|
186
|
+
return [DEFAULT_MODELS.free[role]];
|
|
187
|
+
}
|
|
188
|
+
// Get models in same category, sorted by cost (cheaper first)
|
|
189
|
+
const fallbacks = (registry.mcpModels || [])
|
|
190
|
+
.filter(m => m.id !== modelId &&
|
|
191
|
+
m.enabled &&
|
|
192
|
+
m.categories.includes(role) &&
|
|
193
|
+
m.status === 'online')
|
|
194
|
+
.sort((a, b) => a.pricing.inputCostPer1M - b.pricing.inputCostPer1M)
|
|
195
|
+
.map(m => m.id);
|
|
196
|
+
return fallbacks;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Calculate cost for an API call.
|
|
200
|
+
*/
|
|
201
|
+
async calculateCost(modelId, inputTokens, outputTokens) {
|
|
202
|
+
const pricing = await this.getModelPricing(modelId);
|
|
203
|
+
const inputCost = (inputTokens / 1_000_000) * pricing.input;
|
|
204
|
+
const outputCost = (outputTokens / 1_000_000) * pricing.output;
|
|
205
|
+
return inputCost + outputCost;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Record usage for tracking.
|
|
209
|
+
*/
|
|
210
|
+
async recordUsage(userId, modelId, inputTokens, outputTokens, costUSD) {
|
|
211
|
+
try {
|
|
212
|
+
const budgetRef = this.db
|
|
213
|
+
.collection('users')
|
|
214
|
+
.doc(userId)
|
|
215
|
+
.collection('mcpBudget')
|
|
216
|
+
.doc('budget');
|
|
217
|
+
const doc = await budgetRef.get();
|
|
218
|
+
if (doc.exists) {
|
|
219
|
+
const data = doc.data();
|
|
220
|
+
const currentMonth = data.currentMonth || {
|
|
221
|
+
totalCostUSD: 0,
|
|
222
|
+
tokenCount: { input: 0, output: 0 },
|
|
223
|
+
callCount: 0,
|
|
224
|
+
byModel: {},
|
|
225
|
+
byTool: {},
|
|
226
|
+
};
|
|
227
|
+
// Update totals
|
|
228
|
+
currentMonth.totalCostUSD += costUSD;
|
|
229
|
+
currentMonth.tokenCount.input += inputTokens;
|
|
230
|
+
currentMonth.tokenCount.output += outputTokens;
|
|
231
|
+
currentMonth.callCount += 1;
|
|
232
|
+
// Update by-model breakdown
|
|
233
|
+
if (!currentMonth.byModel[modelId]) {
|
|
234
|
+
currentMonth.byModel[modelId] = { costUSD: 0, calls: 0, tokensIn: 0, tokensOut: 0 };
|
|
235
|
+
}
|
|
236
|
+
currentMonth.byModel[modelId].costUSD += costUSD;
|
|
237
|
+
currentMonth.byModel[modelId].calls += 1;
|
|
238
|
+
currentMonth.byModel[modelId].tokensIn += inputTokens;
|
|
239
|
+
currentMonth.byModel[modelId].tokensOut += outputTokens;
|
|
240
|
+
await budgetRef.update({ currentMonth, updatedAt: new Date() });
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
console.error('[ModelRegistry] Error recording usage:', error);
|
|
245
|
+
// Don't throw - usage recording is non-critical
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Clear the registry cache.
|
|
250
|
+
*/
|
|
251
|
+
clearCache() {
|
|
252
|
+
this.registryCache = null;
|
|
253
|
+
this.cacheTimestamp = 0;
|
|
254
|
+
console.log('[ModelRegistry] Cache cleared');
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get default registry when Firestore is unavailable.
|
|
258
|
+
*/
|
|
259
|
+
getDefaultRegistry() {
|
|
260
|
+
return {
|
|
261
|
+
mcpModels: [],
|
|
262
|
+
defaultModels: DEFAULT_MODELS,
|
|
263
|
+
version: 0,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.ModelRegistryService = ModelRegistryService;
|
|
268
|
+
// Singleton instance
|
|
269
|
+
let _instance = null;
|
|
270
|
+
function getModelRegistryService() {
|
|
271
|
+
if (!_instance) {
|
|
272
|
+
_instance = new ModelRegistryService();
|
|
273
|
+
}
|
|
274
|
+
return _instance;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=model-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-registry.js","sourceRoot":"","sources":["../../src/services/model-registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAsWH,0DAKC;AAzWD,uDAAoD;AA4DpD,+EAA+E;AAC/E,qDAAqD;AACrD,+EAA+E;AAE/E,MAAM,cAAc,GAAG;IACnB,IAAI,EAAE;QACF,QAAQ,EAAE,kCAAkC;QAC5C,MAAM,EAAE,oBAAoB;QAC5B,SAAS,EAAE,kCAAkC;KAChD;IACD,IAAI,EAAE;QACF,QAAQ,EAAE,6BAA6B;QACvC,MAAM,EAAE,oBAAoB;QAC5B,SAAS,EAAE,6BAA6B;KAC3C;IACD,GAAG,EAAE;QACD,QAAQ,EAAE,2BAA2B;QACrC,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,eAAe;KAC7B;IACD,SAAS,EAAE;QACP,QAAQ,EAAE,2BAA2B;QACrC,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,eAAe;KAC7B;CACJ,CAAC;AAEF,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E,MAAa,oBAAoB;IACrB,EAAE,CAAY;IACd,aAAa,GAAyB,IAAI,CAAC;IAC3C,cAAc,GAAW,CAAC,CAAC;IAClB,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;IAE3D;QACI,IAAI,CAAC,EAAE,GAAG,IAAI,qBAAS,CAAC;YACpB,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,mBAAmB;SACpE,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAAc,CAAC,MAAc;QAC/B,IAAI,CAAC;YACD,2BAA2B;YAC3B,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAExD,sBAAsB;YACtB,MAAM,QAAQ,GAAG,YAAY,EAAE,aAAa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