mcp-agent-foundry 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/LICENSE +21 -0
- package/README.md +477 -0
- package/dist/cli/install-skills.d.ts +11 -0
- package/dist/cli/install-skills.d.ts.map +1 -0
- package/dist/cli/install-skills.js +143 -0
- package/dist/cli/install-skills.js.map +1 -0
- package/dist/cli/recovery-commands.d.ts +41 -0
- package/dist/cli/recovery-commands.d.ts.map +1 -0
- package/dist/cli/recovery-commands.js +241 -0
- package/dist/cli/recovery-commands.js.map +1 -0
- package/dist/cli/setup-wizard.d.ts +25 -0
- package/dist/cli/setup-wizard.d.ts.map +1 -0
- package/dist/cli/setup-wizard.js +1417 -0
- package/dist/cli/setup-wizard.js.map +1 -0
- package/dist/cli/test-connection.d.ts +45 -0
- package/dist/cli/test-connection.d.ts.map +1 -0
- package/dist/cli/test-connection.js +317 -0
- package/dist/cli/test-connection.js.map +1 -0
- package/dist/cli.d.ts +75 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +704 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/defaults.d.ts +57 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +99 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +14 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +22 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/manager.d.ts +184 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +347 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/merger.d.ts +76 -0
- package/dist/config/merger.d.ts.map +1 -0
- package/dist/config/merger.js +189 -0
- package/dist/config/merger.js.map +1 -0
- package/dist/config/schema.d.ts +20 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +20 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validator.d.ts +254 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +363 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/config/worktree-defaults.d.ts +23 -0
- package/dist/config/worktree-defaults.d.ts.map +1 -0
- package/dist/config/worktree-defaults.js +78 -0
- package/dist/config/worktree-defaults.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/tools/compare-agents.d.ts +25 -0
- package/dist/mcp/tools/compare-agents.d.ts.map +1 -0
- package/dist/mcp/tools/compare-agents.js +177 -0
- package/dist/mcp/tools/compare-agents.js.map +1 -0
- package/dist/mcp/tools/critique-plan.d.ts +26 -0
- package/dist/mcp/tools/critique-plan.d.ts.map +1 -0
- package/dist/mcp/tools/critique-plan.js +162 -0
- package/dist/mcp/tools/critique-plan.js.map +1 -0
- package/dist/mcp/tools/design-feedback.d.ts +26 -0
- package/dist/mcp/tools/design-feedback.d.ts.map +1 -0
- package/dist/mcp/tools/design-feedback.js +216 -0
- package/dist/mcp/tools/design-feedback.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +50 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js +191 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/invoke-agent.d.ts +25 -0
- package/dist/mcp/tools/invoke-agent.d.ts.map +1 -0
- package/dist/mcp/tools/invoke-agent.js +141 -0
- package/dist/mcp/tools/invoke-agent.js.map +1 -0
- package/dist/mcp/tools/review-code.d.ts +25 -0
- package/dist/mcp/tools/review-code.d.ts.map +1 -0
- package/dist/mcp/tools/review-code.js +170 -0
- package/dist/mcp/tools/review-code.js.map +1 -0
- package/dist/mcp/tools/tasks/claim-next-task.d.ts +22 -0
- package/dist/mcp/tools/tasks/claim-next-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/claim-next-task.js +203 -0
- package/dist/mcp/tools/tasks/claim-next-task.js.map +1 -0
- package/dist/mcp/tools/tasks/create-routed-task.d.ts +17 -0
- package/dist/mcp/tools/tasks/create-routed-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/create-routed-task.js +178 -0
- package/dist/mcp/tools/tasks/create-routed-task.js.map +1 -0
- package/dist/mcp/tools/tasks/execute-pipeline.d.ts +22 -0
- package/dist/mcp/tools/tasks/execute-pipeline.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/execute-pipeline.js +401 -0
- package/dist/mcp/tools/tasks/execute-pipeline.js.map +1 -0
- package/dist/mcp/tools/tasks/execute-task.d.ts +32 -0
- package/dist/mcp/tools/tasks/execute-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/execute-task.js +284 -0
- package/dist/mcp/tools/tasks/execute-task.js.map +1 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.d.ts +26 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.js +460 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.js.map +1 -0
- package/dist/mcp/tools/tasks/index.d.ts +36 -0
- package/dist/mcp/tools/tasks/index.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/index.js +66 -0
- package/dist/mcp/tools/tasks/index.js.map +1 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.d.ts +17 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.js +147 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.js.map +1 -0
- package/dist/mcp/tools/worktree/get-worktree-status.d.ts +17 -0
- package/dist/mcp/tools/worktree/get-worktree-status.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/get-worktree-status.js +123 -0
- package/dist/mcp/tools/worktree/get-worktree-status.js.map +1 -0
- package/dist/mcp/tools/worktree/index.d.ts +41 -0
- package/dist/mcp/tools/worktree/index.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/index.js +69 -0
- package/dist/mcp/tools/worktree/index.js.map +1 -0
- package/dist/mcp/tools/worktree/list-worktrees.d.ts +17 -0
- package/dist/mcp/tools/worktree/list-worktrees.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/list-worktrees.js +136 -0
- package/dist/mcp/tools/worktree/list-worktrees.js.map +1 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.d.ts +19 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.js +228 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.js.map +1 -0
- package/dist/mcp/transport/stdio.d.ts +13 -0
- package/dist/mcp/transport/stdio.d.ts.map +1 -0
- package/dist/mcp/transport/stdio.js +15 -0
- package/dist/mcp/transport/stdio.js.map +1 -0
- package/dist/observability/logger.d.ts +137 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +235 -0
- package/dist/observability/logger.js.map +1 -0
- package/dist/observability/metrics.d.ts +250 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +364 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/persistence/index.d.ts +9 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/index.js +9 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/persistence/state-schema.d.ts +116 -0
- package/dist/persistence/state-schema.d.ts.map +1 -0
- package/dist/persistence/state-schema.js +28 -0
- package/dist/persistence/state-schema.js.map +1 -0
- package/dist/persistence/state-store.d.ts +111 -0
- package/dist/persistence/state-store.d.ts.map +1 -0
- package/dist/persistence/state-store.js +291 -0
- package/dist/persistence/state-store.js.map +1 -0
- package/dist/providers/anthropic.d.ts +164 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +500 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/base.d.ts +151 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +227 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/gemini.d.ts +85 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +414 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/kimi.d.ts +19 -0
- package/dist/providers/kimi.d.ts.map +1 -0
- package/dist/providers/kimi.js +20 -0
- package/dist/providers/kimi.js.map +1 -0
- package/dist/providers/manager.d.ts +160 -0
- package/dist/providers/manager.d.ts.map +1 -0
- package/dist/providers/manager.js +264 -0
- package/dist/providers/manager.js.map +1 -0
- package/dist/providers/ollama.d.ts +83 -0
- package/dist/providers/ollama.d.ts.map +1 -0
- package/dist/providers/ollama.js +453 -0
- package/dist/providers/ollama.js.map +1 -0
- package/dist/providers/openai.d.ts +96 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +457 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/zai.d.ts +19 -0
- package/dist/providers/zai.d.ts.map +1 -0
- package/dist/providers/zai.js +20 -0
- package/dist/providers/zai.js.map +1 -0
- package/dist/router/context-manager.d.ts +2 -0
- package/dist/router/context-manager.d.ts.map +1 -0
- package/dist/router/context-manager.js +3 -0
- package/dist/router/context-manager.js.map +1 -0
- package/dist/router/engine.d.ts +169 -0
- package/dist/router/engine.d.ts.map +1 -0
- package/dist/router/engine.js +435 -0
- package/dist/router/engine.js.map +1 -0
- package/dist/router/pattern-executor.d.ts +317 -0
- package/dist/router/pattern-executor.d.ts.map +1 -0
- package/dist/router/pattern-executor.js +571 -0
- package/dist/router/pattern-executor.js.map +1 -0
- package/dist/router/role-resolver.d.ts +59 -0
- package/dist/router/role-resolver.d.ts.map +1 -0
- package/dist/router/role-resolver.js +95 -0
- package/dist/router/role-resolver.js.map +1 -0
- package/dist/server.d.ts +32 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +223 -0
- package/dist/server.js.map +1 -0
- package/dist/startup.d.ts +78 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +107 -0
- package/dist/startup.js.map +1 -0
- package/dist/tasks/coordinator.d.ts +141 -0
- package/dist/tasks/coordinator.d.ts.map +1 -0
- package/dist/tasks/coordinator.js +331 -0
- package/dist/tasks/coordinator.js.map +1 -0
- package/dist/tasks/index.d.ts +13 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +13 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/persistent-state-coordinator.d.ts +89 -0
- package/dist/tasks/persistent-state-coordinator.d.ts.map +1 -0
- package/dist/tasks/persistent-state-coordinator.js +371 -0
- package/dist/tasks/persistent-state-coordinator.js.map +1 -0
- package/dist/tasks/pipeline-manager.d.ts +103 -0
- package/dist/tasks/pipeline-manager.d.ts.map +1 -0
- package/dist/tasks/pipeline-manager.js +358 -0
- package/dist/tasks/pipeline-manager.js.map +1 -0
- package/dist/tasks/state-coordinator.d.ts +79 -0
- package/dist/tasks/state-coordinator.d.ts.map +1 -0
- package/dist/tasks/state-coordinator.js +200 -0
- package/dist/tasks/state-coordinator.js.map +1 -0
- package/dist/tasks/worker-mode.d.ts +65 -0
- package/dist/tasks/worker-mode.d.ts.map +1 -0
- package/dist/tasks/worker-mode.js +208 -0
- package/dist/tasks/worker-mode.js.map +1 -0
- package/dist/translation/errors.d.ts +203 -0
- package/dist/translation/errors.d.ts.map +1 -0
- package/dist/translation/errors.js +477 -0
- package/dist/translation/errors.js.map +1 -0
- package/dist/translation/index.d.ts +12 -0
- package/dist/translation/index.d.ts.map +1 -0
- package/dist/translation/index.js +32 -0
- package/dist/translation/index.js.map +1 -0
- package/dist/translation/messages.d.ts +295 -0
- package/dist/translation/messages.d.ts.map +1 -0
- package/dist/translation/messages.js +557 -0
- package/dist/translation/messages.js.map +1 -0
- package/dist/translation/streaming.d.ts +226 -0
- package/dist/translation/streaming.d.ts.map +1 -0
- package/dist/translation/streaming.js +520 -0
- package/dist/translation/streaming.js.map +1 -0
- package/dist/translation/tools.d.ts +209 -0
- package/dist/translation/tools.d.ts.map +1 -0
- package/dist/translation/tools.js +331 -0
- package/dist/translation/tools.js.map +1 -0
- package/dist/types.d.ts +747 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +86 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/circuit-breaker.d.ts +175 -0
- package/dist/utils/circuit-breaker.d.ts.map +1 -0
- package/dist/utils/circuit-breaker.js +315 -0
- package/dist/utils/circuit-breaker.js.map +1 -0
- package/dist/utils/env.d.ts +2 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +3 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/git.d.ts +58 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +197 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/merge-ordering.d.ts +45 -0
- package/dist/utils/merge-ordering.d.ts.map +1 -0
- package/dist/utils/merge-ordering.js +128 -0
- package/dist/utils/merge-ordering.js.map +1 -0
- package/dist/utils/retry.d.ts +106 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +188 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/worktrees/branch-manager.d.ts +55 -0
- package/dist/worktrees/branch-manager.d.ts.map +1 -0
- package/dist/worktrees/branch-manager.js +129 -0
- package/dist/worktrees/branch-manager.js.map +1 -0
- package/dist/worktrees/conflict-handler.d.ts +72 -0
- package/dist/worktrees/conflict-handler.d.ts.map +1 -0
- package/dist/worktrees/conflict-handler.js +287 -0
- package/dist/worktrees/conflict-handler.js.map +1 -0
- package/dist/worktrees/conflict-parser.d.ts +28 -0
- package/dist/worktrees/conflict-parser.d.ts.map +1 -0
- package/dist/worktrees/conflict-parser.js +140 -0
- package/dist/worktrees/conflict-parser.js.map +1 -0
- package/dist/worktrees/index.d.ts +20 -0
- package/dist/worktrees/index.d.ts.map +1 -0
- package/dist/worktrees/index.js +20 -0
- package/dist/worktrees/index.js.map +1 -0
- package/dist/worktrees/instructions.d.ts +20 -0
- package/dist/worktrees/instructions.d.ts.map +1 -0
- package/dist/worktrees/instructions.js +84 -0
- package/dist/worktrees/instructions.js.map +1 -0
- package/dist/worktrees/manager.d.ts +76 -0
- package/dist/worktrees/manager.d.ts.map +1 -0
- package/dist/worktrees/manager.js +277 -0
- package/dist/worktrees/manager.js.map +1 -0
- package/dist/worktrees/pipeline-merge-orchestrator.d.ts +55 -0
- package/dist/worktrees/pipeline-merge-orchestrator.d.ts.map +1 -0
- package/dist/worktrees/pipeline-merge-orchestrator.js +221 -0
- package/dist/worktrees/pipeline-merge-orchestrator.js.map +1 -0
- package/dist/worktrees/pool.d.ts +95 -0
- package/dist/worktrees/pool.d.ts.map +1 -0
- package/dist/worktrees/pool.js +271 -0
- package/dist/worktrees/pool.js.map +1 -0
- package/dist/worktrees/recovery.d.ts +94 -0
- package/dist/worktrees/recovery.d.ts.map +1 -0
- package/dist/worktrees/recovery.js +371 -0
- package/dist/worktrees/recovery.js.map +1 -0
- package/dist/worktrees/resource-manager.d.ts +74 -0
- package/dist/worktrees/resource-manager.d.ts.map +1 -0
- package/dist/worktrees/resource-manager.js +228 -0
- package/dist/worktrees/resource-manager.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Gemini Provider Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provider adapter for the Google Gemini API (Generative Language API).
|
|
5
|
+
* Handles message formatting, streaming, and tool use for Gemini models.
|
|
6
|
+
*
|
|
7
|
+
* Key differences from Anthropic format:
|
|
8
|
+
* - Messages use "contents" array with "parts" instead of "content"
|
|
9
|
+
* - System prompt is a separate "systemInstruction" field
|
|
10
|
+
* - Tool schemas use "parameters" (OpenAI style) in function declarations
|
|
11
|
+
* - Tool calls return "functionCall" parts, results use "functionResponse" parts
|
|
12
|
+
* - Auth via API key query param or Authorization header
|
|
13
|
+
*/
|
|
14
|
+
import { BaseProvider } from './base.js';
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Gemini Provider Implementation
|
|
17
|
+
// ============================================================================
|
|
18
|
+
/**
|
|
19
|
+
* Google Gemini API provider adapter.
|
|
20
|
+
*
|
|
21
|
+
* Implements the Provider interface for Google's Gemini models.
|
|
22
|
+
* Handles:
|
|
23
|
+
* - Message format translation (our format -> Gemini format)
|
|
24
|
+
* - Streaming SSE event parsing
|
|
25
|
+
* - Tool use / function calling
|
|
26
|
+
* - Authentication via API key
|
|
27
|
+
*/
|
|
28
|
+
export class GeminiProvider extends BaseProvider {
|
|
29
|
+
name = 'google';
|
|
30
|
+
static DEFAULT_BASE_URL = 'https://generativelanguage.googleapis.com/v1beta';
|
|
31
|
+
/** Default max tokens if not specified in request */
|
|
32
|
+
static DEFAULT_MAX_TOKENS = 4096;
|
|
33
|
+
constructor(config) {
|
|
34
|
+
super(config);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build the full API URL with model and action.
|
|
38
|
+
* Gemini uses URL path for model selection and action.
|
|
39
|
+
*
|
|
40
|
+
* @param model - Model identifier
|
|
41
|
+
* @param action - API action (generateContent, streamGenerateContent)
|
|
42
|
+
* @returns Full API URL
|
|
43
|
+
*/
|
|
44
|
+
buildUrl(model, action) {
|
|
45
|
+
const baseUrl = this.getBaseUrl(GeminiProvider.DEFAULT_BASE_URL);
|
|
46
|
+
const url = `${baseUrl}/models/${model}:${action}`;
|
|
47
|
+
// Gemini supports API key as query parameter
|
|
48
|
+
if (this.config.api_key) {
|
|
49
|
+
return `${url}?key=${this.config.api_key}`;
|
|
50
|
+
}
|
|
51
|
+
return url;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Build headers for Gemini API requests.
|
|
55
|
+
* Uses Bearer token if API key is provided (alternative to query param).
|
|
56
|
+
*/
|
|
57
|
+
buildHeaders() {
|
|
58
|
+
const headers = {
|
|
59
|
+
'Content-Type': 'application/json',
|
|
60
|
+
};
|
|
61
|
+
// Gemini also supports Authorization header (alternative to query param)
|
|
62
|
+
// We use query param by default, but support Bearer if explicitly configured
|
|
63
|
+
if (this.config.headers?.['Authorization']) {
|
|
64
|
+
headers['Authorization'] = this.config.headers['Authorization'];
|
|
65
|
+
}
|
|
66
|
+
// Add any custom headers from config
|
|
67
|
+
if (this.config.headers) {
|
|
68
|
+
Object.assign(headers, this.config.headers);
|
|
69
|
+
}
|
|
70
|
+
return headers;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Execute a completion request and return the full response.
|
|
74
|
+
*/
|
|
75
|
+
async complete(request) {
|
|
76
|
+
const url = this.buildUrl(request.model, 'generateContent');
|
|
77
|
+
const geminiRequest = this.translateRequest(request);
|
|
78
|
+
const response = await this.makeRequest({
|
|
79
|
+
method: 'POST',
|
|
80
|
+
url,
|
|
81
|
+
headers: this.buildHeaders(),
|
|
82
|
+
body: geminiRequest,
|
|
83
|
+
timeoutMs: request.timeout_ms ?? this.defaultTimeoutMs,
|
|
84
|
+
});
|
|
85
|
+
return this.translateResponse(response, request.model);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Execute a streaming completion request.
|
|
89
|
+
*/
|
|
90
|
+
async *completeStream(request) {
|
|
91
|
+
// Gemini uses streamGenerateContent endpoint with alt=sse query param
|
|
92
|
+
let url = this.buildUrl(request.model, 'streamGenerateContent');
|
|
93
|
+
// Add alt=sse for server-sent events format
|
|
94
|
+
url += url.includes('?') ? '&alt=sse' : '?alt=sse';
|
|
95
|
+
const geminiRequest = this.translateRequest(request);
|
|
96
|
+
const response = await this.makeStreamingRequest({
|
|
97
|
+
method: 'POST',
|
|
98
|
+
url,
|
|
99
|
+
headers: this.buildHeaders(),
|
|
100
|
+
body: geminiRequest,
|
|
101
|
+
timeoutMs: request.timeout_ms ?? this.defaultTimeoutMs,
|
|
102
|
+
stream: true,
|
|
103
|
+
});
|
|
104
|
+
if (!response.body) {
|
|
105
|
+
throw new Error('No response body for streaming request');
|
|
106
|
+
}
|
|
107
|
+
// Track state for content block management
|
|
108
|
+
let hasStartedContent = false;
|
|
109
|
+
let currentToolCallIndex = 0;
|
|
110
|
+
const activeToolCalls = new Map();
|
|
111
|
+
const reader = response.body.getReader();
|
|
112
|
+
const decoder = new TextDecoder();
|
|
113
|
+
let buffer = '';
|
|
114
|
+
try {
|
|
115
|
+
while (true) {
|
|
116
|
+
const { done, value } = await reader.read();
|
|
117
|
+
if (done) {
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
buffer += decoder.decode(value, { stream: true });
|
|
121
|
+
// Process complete SSE events
|
|
122
|
+
const lines = buffer.split('\n');
|
|
123
|
+
buffer = lines.pop() || '';
|
|
124
|
+
for (const line of lines) {
|
|
125
|
+
const trimmed = line.trim();
|
|
126
|
+
if (!trimmed || trimmed === 'data: [DONE]') {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (trimmed.startsWith('data: ')) {
|
|
130
|
+
const jsonStr = trimmed.slice(6);
|
|
131
|
+
try {
|
|
132
|
+
const chunk = JSON.parse(jsonStr);
|
|
133
|
+
const chunks = this.translateStreamChunk(chunk, hasStartedContent, currentToolCallIndex, activeToolCalls);
|
|
134
|
+
for (const streamChunk of chunks) {
|
|
135
|
+
// Track state for content block management
|
|
136
|
+
if (streamChunk.type === 'content_block_start' &&
|
|
137
|
+
streamChunk.content_block?.type === 'text') {
|
|
138
|
+
hasStartedContent = true;
|
|
139
|
+
}
|
|
140
|
+
if (streamChunk.type === 'content_block_start' &&
|
|
141
|
+
streamChunk.content_block?.type === 'tool_use') {
|
|
142
|
+
currentToolCallIndex++;
|
|
143
|
+
}
|
|
144
|
+
yield streamChunk;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// Skip malformed JSON chunks
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
reader.releaseLock();
|
|
156
|
+
}
|
|
157
|
+
// Emit message_stop at the end
|
|
158
|
+
yield { type: 'message_stop' };
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Check if the Gemini API is available and credentials are valid.
|
|
162
|
+
*/
|
|
163
|
+
async healthCheck() {
|
|
164
|
+
// List models endpoint to verify API key
|
|
165
|
+
const baseUrl = this.getBaseUrl(GeminiProvider.DEFAULT_BASE_URL);
|
|
166
|
+
let url = `${baseUrl}/models`;
|
|
167
|
+
if (this.config.api_key) {
|
|
168
|
+
url += `?key=${this.config.api_key}`;
|
|
169
|
+
}
|
|
170
|
+
await this.makeRequest({
|
|
171
|
+
method: 'GET',
|
|
172
|
+
url,
|
|
173
|
+
headers: this.buildHeaders(),
|
|
174
|
+
timeoutMs: 10000,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
// ==========================================================================
|
|
178
|
+
// Translation Methods
|
|
179
|
+
// ==========================================================================
|
|
180
|
+
/**
|
|
181
|
+
* Translate AgentRouter request to Gemini format.
|
|
182
|
+
*/
|
|
183
|
+
translateRequest(request) {
|
|
184
|
+
const geminiRequest = {
|
|
185
|
+
contents: this.translateMessages(request.messages),
|
|
186
|
+
};
|
|
187
|
+
// Add generation config if any options specified
|
|
188
|
+
const generationConfig = {};
|
|
189
|
+
if (request.temperature !== undefined) {
|
|
190
|
+
generationConfig.temperature = request.temperature;
|
|
191
|
+
}
|
|
192
|
+
if (request.max_tokens !== undefined) {
|
|
193
|
+
generationConfig.maxOutputTokens = request.max_tokens;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
generationConfig.maxOutputTokens = GeminiProvider.DEFAULT_MAX_TOKENS;
|
|
197
|
+
}
|
|
198
|
+
if (Object.keys(generationConfig).length > 0) {
|
|
199
|
+
geminiRequest.generationConfig = generationConfig;
|
|
200
|
+
}
|
|
201
|
+
// Translate tools if present
|
|
202
|
+
if (request.tools && request.tools.length > 0) {
|
|
203
|
+
geminiRequest.tools = [
|
|
204
|
+
{
|
|
205
|
+
functionDeclarations: this.translateTools(request.tools),
|
|
206
|
+
},
|
|
207
|
+
];
|
|
208
|
+
}
|
|
209
|
+
return geminiRequest;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Translate messages from AgentRouter format to Gemini format.
|
|
213
|
+
*
|
|
214
|
+
* Key translations:
|
|
215
|
+
* - role: "user" -> "user", role: "assistant" -> "model"
|
|
216
|
+
* - Content blocks become parts
|
|
217
|
+
* - tool_use blocks become functionCall parts
|
|
218
|
+
* - tool_result blocks become functionResponse parts
|
|
219
|
+
*/
|
|
220
|
+
translateMessages(messages) {
|
|
221
|
+
const geminiContents = [];
|
|
222
|
+
for (const message of messages) {
|
|
223
|
+
const role = message.role === 'assistant' ? 'model' : 'user';
|
|
224
|
+
const parts = [];
|
|
225
|
+
if (typeof message.content === 'string') {
|
|
226
|
+
// Simple string content
|
|
227
|
+
parts.push({ text: message.content });
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
// Content blocks - translate each type
|
|
231
|
+
for (const block of message.content) {
|
|
232
|
+
switch (block.type) {
|
|
233
|
+
case 'text':
|
|
234
|
+
if (block.text) {
|
|
235
|
+
parts.push({ text: block.text });
|
|
236
|
+
}
|
|
237
|
+
break;
|
|
238
|
+
case 'tool_use':
|
|
239
|
+
if (block.name) {
|
|
240
|
+
parts.push({
|
|
241
|
+
functionCall: {
|
|
242
|
+
name: block.name,
|
|
243
|
+
args: block.input || {},
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
case 'tool_result':
|
|
249
|
+
if (block.tool_use_id && block.content) {
|
|
250
|
+
// Gemini expects function name, not ID
|
|
251
|
+
// We need to track tool calls to map IDs to names
|
|
252
|
+
// For now, use the ID as name (caller should ensure consistency)
|
|
253
|
+
parts.push({
|
|
254
|
+
functionResponse: {
|
|
255
|
+
name: block.tool_use_id,
|
|
256
|
+
response: {
|
|
257
|
+
content: block.content,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (parts.length > 0) {
|
|
267
|
+
geminiContents.push({ role, parts });
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return geminiContents;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Translate tools from AgentRouter format to Gemini function declarations.
|
|
274
|
+
*/
|
|
275
|
+
translateTools(tools) {
|
|
276
|
+
return tools.map((tool) => ({
|
|
277
|
+
name: tool.name,
|
|
278
|
+
description: tool.description,
|
|
279
|
+
parameters: tool.input_schema,
|
|
280
|
+
}));
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Translate Gemini response to AgentRouter format.
|
|
284
|
+
*/
|
|
285
|
+
translateResponse(response, model) {
|
|
286
|
+
const candidate = response.candidates?.[0];
|
|
287
|
+
if (!candidate) {
|
|
288
|
+
throw new Error('No candidates in Gemini response');
|
|
289
|
+
}
|
|
290
|
+
const content = [];
|
|
291
|
+
let toolCallCounter = 0;
|
|
292
|
+
// Translate parts to content blocks
|
|
293
|
+
for (const part of candidate.content.parts) {
|
|
294
|
+
if (part.text !== undefined) {
|
|
295
|
+
content.push({
|
|
296
|
+
type: 'text',
|
|
297
|
+
text: part.text,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (part.functionCall) {
|
|
301
|
+
// Generate a unique ID for the tool call
|
|
302
|
+
const toolId = `call_${Date.now()}_${toolCallCounter++}`;
|
|
303
|
+
content.push({
|
|
304
|
+
type: 'tool_use',
|
|
305
|
+
id: toolId,
|
|
306
|
+
name: part.functionCall.name,
|
|
307
|
+
input: part.functionCall.args,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
// Map Gemini finish reason to AgentRouter stop_reason
|
|
312
|
+
let stopReason = 'end_turn';
|
|
313
|
+
switch (candidate.finishReason) {
|
|
314
|
+
case 'STOP':
|
|
315
|
+
stopReason = 'end_turn';
|
|
316
|
+
break;
|
|
317
|
+
case 'MAX_TOKENS':
|
|
318
|
+
stopReason = 'max_tokens';
|
|
319
|
+
break;
|
|
320
|
+
case 'SAFETY':
|
|
321
|
+
stopReason = 'content_filter';
|
|
322
|
+
break;
|
|
323
|
+
case 'RECITATION':
|
|
324
|
+
stopReason = 'content_filter';
|
|
325
|
+
break;
|
|
326
|
+
default:
|
|
327
|
+
stopReason = 'end_turn';
|
|
328
|
+
}
|
|
329
|
+
// Check if we have tool calls - that changes the stop reason
|
|
330
|
+
if (content.some((block) => block.type === 'tool_use')) {
|
|
331
|
+
stopReason = 'tool_use';
|
|
332
|
+
}
|
|
333
|
+
const result = {
|
|
334
|
+
id: `gemini-${Date.now()}`, // Gemini doesn't provide response ID
|
|
335
|
+
content,
|
|
336
|
+
model,
|
|
337
|
+
stop_reason: stopReason,
|
|
338
|
+
};
|
|
339
|
+
if (response.usageMetadata) {
|
|
340
|
+
result.usage = {
|
|
341
|
+
input_tokens: response.usageMetadata.promptTokenCount,
|
|
342
|
+
output_tokens: response.usageMetadata.candidatesTokenCount,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
return result;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Translate Gemini streaming chunk to AgentRouter StreamChunk format.
|
|
349
|
+
*/
|
|
350
|
+
translateStreamChunk(chunk, hasStartedContent, currentToolCallIndex, activeToolCalls) {
|
|
351
|
+
const chunks = [];
|
|
352
|
+
const candidate = chunk.candidates?.[0];
|
|
353
|
+
if (!candidate?.content?.parts) {
|
|
354
|
+
return chunks;
|
|
355
|
+
}
|
|
356
|
+
for (const part of candidate.content.parts) {
|
|
357
|
+
// Handle text content
|
|
358
|
+
if (part.text !== undefined) {
|
|
359
|
+
// Emit content_block_start if this is the first content
|
|
360
|
+
if (!hasStartedContent) {
|
|
361
|
+
chunks.push({
|
|
362
|
+
type: 'content_block_start',
|
|
363
|
+
index: 0,
|
|
364
|
+
content_block: {
|
|
365
|
+
type: 'text',
|
|
366
|
+
text: '',
|
|
367
|
+
},
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
// Emit content delta
|
|
371
|
+
chunks.push({
|
|
372
|
+
type: 'content_block_delta',
|
|
373
|
+
index: 0,
|
|
374
|
+
delta: {
|
|
375
|
+
type: 'text_delta',
|
|
376
|
+
text: part.text,
|
|
377
|
+
},
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
// Handle function calls
|
|
381
|
+
if (part.functionCall) {
|
|
382
|
+
const toolIndex = currentToolCallIndex;
|
|
383
|
+
const toolId = `call_${Date.now()}_${toolIndex}`;
|
|
384
|
+
// Track this tool call
|
|
385
|
+
activeToolCalls.set(toolIndex, {
|
|
386
|
+
id: toolId,
|
|
387
|
+
name: part.functionCall.name,
|
|
388
|
+
});
|
|
389
|
+
// Emit content_block_start for tool use
|
|
390
|
+
chunks.push({
|
|
391
|
+
type: 'content_block_start',
|
|
392
|
+
index: toolIndex + 1, // Offset by 1 since text is at index 0
|
|
393
|
+
content_block: {
|
|
394
|
+
type: 'tool_use',
|
|
395
|
+
id: toolId,
|
|
396
|
+
name: part.functionCall.name,
|
|
397
|
+
input: part.functionCall.args,
|
|
398
|
+
},
|
|
399
|
+
});
|
|
400
|
+
// Emit the full arguments as a delta (Gemini sends complete args)
|
|
401
|
+
chunks.push({
|
|
402
|
+
type: 'content_block_delta',
|
|
403
|
+
index: toolIndex + 1,
|
|
404
|
+
delta: {
|
|
405
|
+
type: 'input_json_delta',
|
|
406
|
+
text: JSON.stringify(part.functionCall.args),
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return chunks;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
//# sourceMappingURL=gemini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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wBAChB,EAAE,EAAE,MAAM;wBACV,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI;wBAC5B,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI;qBAC9B;iBACF,CAAC,CAAC;gBAEH,kEAAkE;gBAClE,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,qBAAqB;oBAC3B,KAAK,EAAE,SAAS,GAAG,CAAC;oBACpB,KAAK,EAAE;wBACL,IAAI,EAAE,kBAAkB;wBACxB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;qBAC7C;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kimi (Moonshot AI) Provider Implementation
|
|
3
|
+
*
|
|
4
|
+
* Kimi uses an OpenAI-compatible API format.
|
|
5
|
+
* This provider extends OpenAIProvider with the correct name identifier.
|
|
6
|
+
*/
|
|
7
|
+
import { OpenAIProvider } from './openai.js';
|
|
8
|
+
import type { ProviderConfig } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Kimi (Moonshot AI) API provider adapter.
|
|
11
|
+
*
|
|
12
|
+
* Uses OpenAI-compatible API format but with Kimi endpoints.
|
|
13
|
+
* Default base URL: https://api.moonshot.cn/v1
|
|
14
|
+
*/
|
|
15
|
+
export declare class KimiProvider extends OpenAIProvider {
|
|
16
|
+
readonly name = "kimi";
|
|
17
|
+
constructor(config: ProviderConfig);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=kimi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kimi.d.ts","sourceRoot":"","sources":["../../src/providers/kimi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,cAAc;IAC9C,SAAyB,IAAI,UAAU;gBAE3B,MAAM,EAAE,cAAc;CAGnC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kimi (Moonshot AI) Provider Implementation
|
|
3
|
+
*
|
|
4
|
+
* Kimi uses an OpenAI-compatible API format.
|
|
5
|
+
* This provider extends OpenAIProvider with the correct name identifier.
|
|
6
|
+
*/
|
|
7
|
+
import { OpenAIProvider } from './openai.js';
|
|
8
|
+
/**
|
|
9
|
+
* Kimi (Moonshot AI) API provider adapter.
|
|
10
|
+
*
|
|
11
|
+
* Uses OpenAI-compatible API format but with Kimi endpoints.
|
|
12
|
+
* Default base URL: https://api.moonshot.cn/v1
|
|
13
|
+
*/
|
|
14
|
+
export class KimiProvider extends OpenAIProvider {
|
|
15
|
+
name = 'kimi';
|
|
16
|
+
constructor(config) {
|
|
17
|
+
super(config);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=kimi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kimi.js","sourceRoot":"","sources":["../../src/providers/kimi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C;;;;;GAKG;AACH,MAAM,OAAO,YAAa,SAAQ,cAAc;IACrB,IAAI,GAAG,MAAM,CAAC;IAEvC,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages the registry of LLM providers, handling provider creation,
|
|
5
|
+
* retrieval, and configuration updates. Provides a factory method for
|
|
6
|
+
* creating provider instances based on their type.
|
|
7
|
+
*/
|
|
8
|
+
import { type Provider, type ProviderConfig, type ProviderType } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Factory function type for creating provider instances.
|
|
11
|
+
*/
|
|
12
|
+
export type ProviderFactory = (config: ProviderConfig) => Provider;
|
|
13
|
+
/**
|
|
14
|
+
* Manager for LLM provider instances.
|
|
15
|
+
*
|
|
16
|
+
* Handles:
|
|
17
|
+
* - Provider registration and retrieval
|
|
18
|
+
* - Provider instance creation via factory methods
|
|
19
|
+
* - Configuration updates with instance recreation
|
|
20
|
+
* - Lazy instantiation of providers
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const manager = new ProviderManager();
|
|
25
|
+
*
|
|
26
|
+
* // Register provider factories
|
|
27
|
+
* manager.registerFactory('anthropic', (config) => new AnthropicProvider(config));
|
|
28
|
+
* manager.registerFactory('openai', (config) => new OpenAIProvider(config));
|
|
29
|
+
*
|
|
30
|
+
* // Update configurations (creates instances lazily)
|
|
31
|
+
* manager.updateConfig({
|
|
32
|
+
* anthropic: { api_key: 'sk-...' },
|
|
33
|
+
* openai: { api_key: 'sk-...' }
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Get a provider instance
|
|
37
|
+
* const provider = manager.get('anthropic');
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class ProviderManager {
|
|
41
|
+
/** Registry of provider factories and instances by name */
|
|
42
|
+
private readonly providers;
|
|
43
|
+
/** Registry of active provider instances */
|
|
44
|
+
private readonly instances;
|
|
45
|
+
/**
|
|
46
|
+
* Register a provider factory for a given provider type.
|
|
47
|
+
* The factory will be used to create provider instances when needed.
|
|
48
|
+
*
|
|
49
|
+
* @param name - Provider name (e.g., 'anthropic', 'openai')
|
|
50
|
+
* @param factory - Factory function that creates provider instances
|
|
51
|
+
*/
|
|
52
|
+
registerFactory(name: string, factory: ProviderFactory): void;
|
|
53
|
+
/**
|
|
54
|
+
* Register a pre-created provider instance directly.
|
|
55
|
+
* Useful for testing or custom provider implementations.
|
|
56
|
+
*
|
|
57
|
+
* @param name - Provider name
|
|
58
|
+
* @param provider - Provider instance
|
|
59
|
+
*/
|
|
60
|
+
register(name: string, provider: Provider): void;
|
|
61
|
+
/**
|
|
62
|
+
* Get a provider instance by name.
|
|
63
|
+
* Creates the instance lazily if it hasn't been created yet.
|
|
64
|
+
*
|
|
65
|
+
* @param name - Provider name
|
|
66
|
+
* @returns The provider instance
|
|
67
|
+
* @throws ConfigurationError if the provider is not registered or not configured
|
|
68
|
+
*/
|
|
69
|
+
get(name: string): Provider;
|
|
70
|
+
/**
|
|
71
|
+
* Check if a provider is registered (has a factory).
|
|
72
|
+
*
|
|
73
|
+
* @param name - Provider name
|
|
74
|
+
* @returns True if the provider is registered
|
|
75
|
+
*/
|
|
76
|
+
has(name: string): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Check if a provider is configured and ready to use.
|
|
79
|
+
*
|
|
80
|
+
* @param name - Provider name
|
|
81
|
+
* @returns True if the provider is configured
|
|
82
|
+
*/
|
|
83
|
+
isConfigured(name: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Update provider configurations.
|
|
86
|
+
* This will invalidate existing instances so they are recreated with new configs.
|
|
87
|
+
*
|
|
88
|
+
* @param configs - Map of provider name to configuration
|
|
89
|
+
*/
|
|
90
|
+
updateConfig(configs: Record<string, ProviderConfig>): void;
|
|
91
|
+
/**
|
|
92
|
+
* Get the configuration for a provider.
|
|
93
|
+
*
|
|
94
|
+
* @param name - Provider name
|
|
95
|
+
* @returns The provider configuration, or undefined if not configured
|
|
96
|
+
*/
|
|
97
|
+
getConfig(name: string): ProviderConfig | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* List all registered provider names.
|
|
100
|
+
*
|
|
101
|
+
* @returns Array of provider names
|
|
102
|
+
*/
|
|
103
|
+
listProviders(): string[];
|
|
104
|
+
/**
|
|
105
|
+
* List all configured provider names (ready to use).
|
|
106
|
+
*
|
|
107
|
+
* @returns Array of configured provider names
|
|
108
|
+
*/
|
|
109
|
+
listConfigured(): string[];
|
|
110
|
+
/**
|
|
111
|
+
* Remove a provider from the registry.
|
|
112
|
+
*
|
|
113
|
+
* @param name - Provider name to remove
|
|
114
|
+
*/
|
|
115
|
+
remove(name: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* Clear all providers from the registry.
|
|
118
|
+
*/
|
|
119
|
+
clear(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Run health checks on all configured providers.
|
|
122
|
+
*
|
|
123
|
+
* @returns Map of provider name to health check result (true = healthy, Error = failed)
|
|
124
|
+
*/
|
|
125
|
+
healthCheckAll(): Promise<Map<string, true | Error>>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Create a provider instance based on provider type.
|
|
129
|
+
* This is a factory function that maps provider types to their implementations.
|
|
130
|
+
*
|
|
131
|
+
* Note: This function requires the provider implementations to be imported
|
|
132
|
+
* and registered. Use ProviderManager.registerFactory() to register providers.
|
|
133
|
+
*
|
|
134
|
+
* @param type - Provider type
|
|
135
|
+
* @param config - Provider configuration
|
|
136
|
+
* @param manager - Provider manager with registered factories
|
|
137
|
+
* @returns Provider instance
|
|
138
|
+
* @throws ConfigurationError if the provider type is not supported
|
|
139
|
+
*/
|
|
140
|
+
export declare function createProvider(type: ProviderType, config: ProviderConfig, manager: ProviderManager): Provider;
|
|
141
|
+
/**
|
|
142
|
+
* Create a ProviderManager with default provider factories registered.
|
|
143
|
+
* Provider implementations must be passed in to avoid circular dependencies.
|
|
144
|
+
*
|
|
145
|
+
* @param factories - Map of provider type to factory function
|
|
146
|
+
* @returns Configured ProviderManager
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { AnthropicProvider } from './anthropic.js';
|
|
151
|
+
* import { OpenAIProvider } from './openai.js';
|
|
152
|
+
*
|
|
153
|
+
* const manager = createProviderManager({
|
|
154
|
+
* anthropic: (config) => new AnthropicProvider(config),
|
|
155
|
+
* openai: (config) => new OpenAIProvider(config),
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export declare function createProviderManager(factories: Partial<Record<ProviderType, ProviderFactory>>): ProviderManager;
|
|
160
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/providers/manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAsB,KAAM,QAAQ,EAAC,KAAM,cAAc,EAAC,KAAM,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzG;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,QAAQ,CAAC;AAcnE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,eAAe;IAC1B,2DAA2D;IAC3D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2C;IAErE,4CAA4C;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;IAEzD;;;;;;OAMG;IACI,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI;IAcpE;;;;;;OAMG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAUvD;;;;;;;OAOG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;IAkClC;;;;;OAKG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC;;;;;OAKG;IACI,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK1C;;;;;OAKG;IACI,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,IAAI;IAwBlE;;;;;OAKG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI1D;;;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