@happyvertical/ai 0.74.8

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 (77) hide show
  1. package/AGENT.md +33 -0
  2. package/LICENSE +7 -0
  3. package/README.md +384 -0
  4. package/dist/chunks/anthropic-BRwbhwIl.js +463 -0
  5. package/dist/chunks/anthropic-BRwbhwIl.js.map +1 -0
  6. package/dist/chunks/bedrock-Cf1xUerN.js +808 -0
  7. package/dist/chunks/bedrock-Cf1xUerN.js.map +1 -0
  8. package/dist/chunks/bifrost-3mXtQsTj.js +233 -0
  9. package/dist/chunks/bifrost-3mXtQsTj.js.map +1 -0
  10. package/dist/chunks/claude-cli-BrHRfkry.js +603 -0
  11. package/dist/chunks/claude-cli-BrHRfkry.js.map +1 -0
  12. package/dist/chunks/gateway-admin-C4GFPbZF.js +359 -0
  13. package/dist/chunks/gateway-admin-C4GFPbZF.js.map +1 -0
  14. package/dist/chunks/gemini-BfpHXDIQ.js +662 -0
  15. package/dist/chunks/gemini-BfpHXDIQ.js.map +1 -0
  16. package/dist/chunks/huggingface-280qv9iv.js +366 -0
  17. package/dist/chunks/huggingface-280qv9iv.js.map +1 -0
  18. package/dist/chunks/index-BT4thAvS.js +934 -0
  19. package/dist/chunks/index-BT4thAvS.js.map +1 -0
  20. package/dist/chunks/litellm-DhPKa_Jz.js +220 -0
  21. package/dist/chunks/litellm-DhPKa_Jz.js.map +1 -0
  22. package/dist/chunks/ollama-Di1ldur0.js +851 -0
  23. package/dist/chunks/ollama-Di1ldur0.js.map +1 -0
  24. package/dist/chunks/openai-5snI2diE.js +749 -0
  25. package/dist/chunks/openai-5snI2diE.js.map +1 -0
  26. package/dist/chunks/qwen-tts-DgPgdXxG.js +365 -0
  27. package/dist/chunks/qwen-tts-DgPgdXxG.js.map +1 -0
  28. package/dist/chunks/usage-DMWiJ2oB.js +21 -0
  29. package/dist/chunks/usage-DMWiJ2oB.js.map +1 -0
  30. package/dist/cli/claude-context.d.ts +3 -0
  31. package/dist/cli/claude-context.d.ts.map +1 -0
  32. package/dist/cli/claude-context.js +21 -0
  33. package/dist/cli/claude-context.js.map +1 -0
  34. package/dist/index.d.ts +20 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +21 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/node/factory.d.ts +27 -0
  39. package/dist/node/factory.d.ts.map +1 -0
  40. package/dist/shared/client.d.ts +410 -0
  41. package/dist/shared/client.d.ts.map +1 -0
  42. package/dist/shared/factory.d.ts +83 -0
  43. package/dist/shared/factory.d.ts.map +1 -0
  44. package/dist/shared/message.d.ts +71 -0
  45. package/dist/shared/message.d.ts.map +1 -0
  46. package/dist/shared/providers/anthropic.d.ts +82 -0
  47. package/dist/shared/providers/anthropic.d.ts.map +1 -0
  48. package/dist/shared/providers/bedrock.d.ts +49 -0
  49. package/dist/shared/providers/bedrock.d.ts.map +1 -0
  50. package/dist/shared/providers/bifrost.d.ts +25 -0
  51. package/dist/shared/providers/bifrost.d.ts.map +1 -0
  52. package/dist/shared/providers/claude-cli.d.ts +139 -0
  53. package/dist/shared/providers/claude-cli.d.ts.map +1 -0
  54. package/dist/shared/providers/gateway-admin.d.ts +35 -0
  55. package/dist/shared/providers/gateway-admin.d.ts.map +1 -0
  56. package/dist/shared/providers/gemini.d.ts +116 -0
  57. package/dist/shared/providers/gemini.d.ts.map +1 -0
  58. package/dist/shared/providers/huggingface.d.ts +33 -0
  59. package/dist/shared/providers/huggingface.d.ts.map +1 -0
  60. package/dist/shared/providers/litellm.d.ts +25 -0
  61. package/dist/shared/providers/litellm.d.ts.map +1 -0
  62. package/dist/shared/providers/ollama.d.ts +47 -0
  63. package/dist/shared/providers/ollama.d.ts.map +1 -0
  64. package/dist/shared/providers/openai.d.ts +272 -0
  65. package/dist/shared/providers/openai.d.ts.map +1 -0
  66. package/dist/shared/providers/qwen-tts.d.ts +85 -0
  67. package/dist/shared/providers/qwen-tts.d.ts.map +1 -0
  68. package/dist/shared/providers/usage.d.ts +14 -0
  69. package/dist/shared/providers/usage.d.ts.map +1 -0
  70. package/dist/shared/rate-limit.d.ts +13 -0
  71. package/dist/shared/rate-limit.d.ts.map +1 -0
  72. package/dist/shared/thread.d.ts +104 -0
  73. package/dist/shared/thread.d.ts.map +1 -0
  74. package/dist/shared/types.d.ts +1779 -0
  75. package/dist/shared/types.d.ts.map +1 -0
  76. package/metadata.json +35 -0
  77. package/package.json +62 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/shared/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EAEd,UAAU,EACV,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAclB;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACnD,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,MAAM,CAAM;IAEpB;;;OAGG;gBACS,OAAO,EAAE,gBAAgB;IAWrC,OAAO,CAAC,oBAAoB;IAwB5B;;;;OAIG;YACW,YAAY;IAwB1B;;;;;;;;;;;;;;;;;OAiBG;IACG,IAAI,CACR,QAAQ,EAAE,SAAS,EAAE,EACrB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,UAAU,CAAC;IA0FhB,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC;IActB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE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AAa;IAwBrB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,QAAQ;CAgCjB"}
@@ -0,0 +1,49 @@
1
+ import { AICapabilities, AIInterface, AIMessage, AIModel, AIResponse, BedrockOptions, ChatOptions, CompletionOptions, EmbeddingOptions, EmbeddingResponse, ImageDescriptionOptions, ImageEmbeddingOptions, ImageGenerationOptions, ImageGenerationResponse, MessageOptions, TTSOptions, TTSResponse, Voice, VoiceCloneOptions, VoiceDesignOptions, VoiceListOptions } from '../types';
2
+ export declare class BedrockProvider implements AIInterface {
3
+ private options;
4
+ private client;
5
+ constructor(options: BedrockOptions);
6
+ private initializeClientSync;
7
+ private ensureClient;
8
+ chat(messages: AIMessage[], options?: ChatOptions): Promise<AIResponse>;
9
+ complete(prompt: string, options?: CompletionOptions): Promise<AIResponse>;
10
+ /**
11
+ * Simple message interface for single-turn interactions with optional history
12
+ *
13
+ * @param text - The message text to send
14
+ * @param options - Configuration options including history, model, etc.
15
+ * @returns Promise resolving to the response content string
16
+ */
17
+ message(text: string, options?: MessageOptions): Promise<string>;
18
+ embed(text: string | string[], options?: EmbeddingOptions): Promise<EmbeddingResponse>;
19
+ embedImage(image: string | Buffer, options?: ImageEmbeddingOptions): Promise<EmbeddingResponse>;
20
+ describeImage(image: string | Buffer, prompt?: string, options?: ImageDescriptionOptions): Promise<string>;
21
+ generateImage(prompt: string, options?: ImageGenerationOptions): Promise<ImageGenerationResponse>;
22
+ stream(messages: AIMessage[], options?: ChatOptions): AsyncIterable<string>;
23
+ countTokens(text: string): Promise<number>;
24
+ getModels(): Promise<AIModel[]>;
25
+ getCapabilities(): Promise<AICapabilities>;
26
+ synthesizeSpeech(_text: string, _options?: TTSOptions): Promise<TTSResponse>;
27
+ streamSpeech(_text: string, _options?: TTSOptions): AsyncIterable<Buffer>;
28
+ cloneVoice(_options: VoiceCloneOptions): Promise<Voice>;
29
+ designVoice(_options: VoiceDesignOptions): Promise<Voice>;
30
+ getVoices(_options?: VoiceListOptions): Promise<Voice[]>;
31
+ private buildConverseRequest;
32
+ private mapMessagesToBedrock;
33
+ private mapConverseResponse;
34
+ private mapBedrockFinishReason;
35
+ private mapToolConfig;
36
+ private mapToolChoice;
37
+ private parseInvokeModelBody;
38
+ private extractEmbeddingVector;
39
+ private imageUrlToBedrockImage;
40
+ private imageToDataUrl;
41
+ private imageToBase64;
42
+ private imageToBytes;
43
+ private mimeTypeToBedrockImageFormat;
44
+ private resolveImageSize;
45
+ private mapImageQuality;
46
+ private safeJsonParse;
47
+ private mapError;
48
+ }
49
+ //# sourceMappingURL=bedrock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bedrock.d.ts","sourceRoot":"","sources":["../../../src/shared/providers/bedrock.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,UAAU,EACV,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EAEd,UAAU,EACV,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAgBlB,qBAAa,eAAgB,YAAW,WAAW;IACjD,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,MAAM,CAAM;gBAER,OAAO,EAAE,cAAc;IAUnC,OAAO,CAAC,oBAAoB;YAmBd,YAAY;IAqBpB,IAAI,CACR,QAAQ,EAAE,SAAS,EAAE,EACrB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,UAAU,CAAC;IA4BhB,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC;IActB;;;;;;OAMG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC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CAAC,sBAAsB;IAiB9B,OAAO,CAAC,aAAa;IAyBrB,OAAO,CAAC,aAAa;YAqBP,oBAAoB;IAYlC,OAAO,CAAC,sBAAsB;YAoBhB,sBAAsB;YAQtB,cAAc;YAYd,aAAa;YAoBb,YAAY;IAmC1B,OAAO,CAAC,4BAA4B;IAapC,OAAO,CAAC,gBAAgB;IAoCxB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,QAAQ;CAoCjB"}
@@ -0,0 +1,25 @@
1
+ import { AIMessage, AIResponse, BifrostOptions, ChatOptions, EmbeddingOptions, EmbeddingResponse, ImageDescriptionOptions, ImageEmbeddingOptions, ImageGenerationOptions, ImageGenerationResponse } from '../types';
2
+ import { BifrostAdmin } from './gateway-admin';
3
+ import { OpenAIProvider } from './openai';
4
+ /**
5
+ * Bifrost provider implementation.
6
+ *
7
+ * Bifrost exposes OpenAI-compatible inference and governance admin APIs. This
8
+ * provider reuses the OpenAI-compatible transport for inference and exposes
9
+ * `admin` for tenant project and virtual-key provisioning.
10
+ */
11
+ export declare class BifrostProvider extends OpenAIProvider {
12
+ readonly admin: BifrostAdmin;
13
+ private readonly configuredDefaultModel?;
14
+ private readonly resolvedModelCache;
15
+ constructor(options: BifrostOptions);
16
+ private resolveModel;
17
+ private selectModel;
18
+ chat(messages: AIMessage[], options?: ChatOptions): Promise<AIResponse>;
19
+ stream(messages: AIMessage[], options?: ChatOptions): AsyncIterable<string>;
20
+ describeImage(image: string | Buffer, prompt?: string, options?: ImageDescriptionOptions): Promise<string>;
21
+ embed(text: string | string[], options?: EmbeddingOptions): Promise<EmbeddingResponse>;
22
+ embedImage(image: string | Buffer, options?: ImageEmbeddingOptions): Promise<EmbeddingResponse>;
23
+ generateImage(prompt: string, options?: ImageGenerationOptions): Promise<ImageGenerationResponse>;
24
+ }
25
+ //# sourceMappingURL=bifrost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bifrost.d.ts","sourceRoot":"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 +1,139 @@
1
+ import { AICapabilities, AIInterface, AIMessage, AIModel, AIResponse, ChatOptions, ClaudeCliOptions, CompletionOptions, EmbeddingOptions, EmbeddingResponse, ImageDescriptionOptions, ImageEmbeddingOptions, ImageGenerationOptions, ImageGenerationResponse, MessageOptions, TTSOptions, TTSResponse, Voice, VoiceCloneOptions, VoiceDesignOptions, VoiceListOptions } from '../types';
2
+ /**
3
+ * Claude CLI provider implementation that shells out to the Claude Code CLI.
4
+ * Supports chat completions, streaming, and leverages Claude Max subscription.
5
+ * Does not support embeddings (use OpenAI or another provider for embeddings).
6
+ *
7
+ * If ANTHROPIC_API_KEY environment variable is set, automatically falls back to
8
+ * using the Anthropic provider to avoid macOS keychain password prompts.
9
+ */
10
+ export declare class ClaudeCliProvider implements AIInterface {
11
+ private options;
12
+ private cliPath;
13
+ private anthropicFallback;
14
+ /**
15
+ * Creates a new Claude CLI provider instance
16
+ * @param options - Configuration options for the Claude CLI provider
17
+ */
18
+ constructor(options: ClaudeCliOptions);
19
+ /**
20
+ * Checks if ANTHROPIC_API_KEY is available and initializes fallback provider if needed
21
+ * @private
22
+ */
23
+ private initializeFallback;
24
+ /**
25
+ * Finds the Claude CLI binary in PATH or uses custom cliPath
26
+ * Does NOT execute the CLI during detection to avoid keychain prompts
27
+ * @throws {AIError} When CLI cannot be found
28
+ * @private
29
+ */
30
+ private findCli;
31
+ /**
32
+ * Normalizes model name to full model ID or short name
33
+ * @private
34
+ */
35
+ private normalizeModel;
36
+ /**
37
+ * Execute Claude CLI command and return parsed JSON output
38
+ * @private
39
+ */
40
+ private executeCommand;
41
+ /**
42
+ * Execute Claude CLI command with streaming output
43
+ * @private
44
+ */
45
+ private executeStreamingCommand;
46
+ /**
47
+ * Maps messages to a single prompt for CLI
48
+ * @private
49
+ */
50
+ private mapMessagesToPrompt;
51
+ /**
52
+ * Maps CLI errors to standardized error types
53
+ * @private
54
+ */
55
+ private mapCliError;
56
+ /**
57
+ * Generate a chat completion using Claude CLI
58
+ * @param messages - Array of conversation messages
59
+ * @param options - Optional configuration for the chat completion
60
+ * @returns Promise resolving to the AI response with content and metadata
61
+ * @throws {AIError} When the CLI execution fails
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * const response = await provider.chat([
66
+ * { role: 'system', content: 'You are a helpful assistant.' },
67
+ * { role: 'user', content: 'Explain quantum computing' }
68
+ * ], {
69
+ * model: 'sonnet'
70
+ * });
71
+ * ```
72
+ */
73
+ chat(messages: AIMessage[], options?: ChatOptions): Promise<AIResponse>;
74
+ /**
75
+ * Generate a text completion (delegates to chat)
76
+ */
77
+ complete(prompt: string, options?: CompletionOptions): Promise<AIResponse>;
78
+ /**
79
+ * Simple message interface for single-turn interactions with optional history
80
+ *
81
+ * @param text - The message text to send
82
+ * @param options - Configuration options including history, model, etc.
83
+ * @returns Promise resolving to the response content string
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * // Simple usage
88
+ * const response = await provider.message('Hello!');
89
+ *
90
+ * // With history
91
+ * const response = await provider.message('What was my question?', {
92
+ * history: [
93
+ * { role: 'user', content: 'What is 2+2?' },
94
+ * { role: 'assistant', content: '4' }
95
+ * ]
96
+ * });
97
+ * ```
98
+ */
99
+ message(text: string, options?: MessageOptions): Promise<string>;
100
+ /**
101
+ * Embeddings are not supported by Claude CLI or Anthropic
102
+ */
103
+ embed(_text: string | string[], _options?: EmbeddingOptions): Promise<EmbeddingResponse>;
104
+ /**
105
+ * Image embeddings are not supported by Claude CLI
106
+ */
107
+ embedImage(_image: string | Buffer, _options?: ImageEmbeddingOptions): Promise<EmbeddingResponse>;
108
+ /**
109
+ * Image description is not yet implemented for Claude CLI
110
+ * Note: Claude supports vision, but this would require significant implementation
111
+ */
112
+ describeImage(_image: string | Buffer, _prompt?: string, _options?: ImageDescriptionOptions): Promise<string>;
113
+ /**
114
+ * Image generation is not supported by Claude
115
+ */
116
+ generateImage(_prompt: string, _options?: ImageGenerationOptions): Promise<ImageGenerationResponse>;
117
+ /**
118
+ * Stream chat completion using Claude CLI
119
+ */
120
+ stream(messages: AIMessage[], options?: ChatOptions): AsyncIterable<string>;
121
+ /**
122
+ * Count tokens in text (approximation)
123
+ */
124
+ countTokens(text: string): Promise<number>;
125
+ /**
126
+ * Get available models (static list of Claude models)
127
+ */
128
+ getModels(): Promise<AIModel[]>;
129
+ /**
130
+ * Get provider capabilities
131
+ */
132
+ getCapabilities(): Promise<AICapabilities>;
133
+ synthesizeSpeech(_text: string, _options?: TTSOptions): Promise<TTSResponse>;
134
+ streamSpeech(_text: string, _options?: TTSOptions): AsyncIterable<Buffer>;
135
+ cloneVoice(_options: VoiceCloneOptions): Promise<Voice>;
136
+ designVoice(_options: VoiceDesignOptions): Promise<Voice>;
137
+ getVoices(_options?: VoiceListOptions): Promise<Voice[]>;
138
+ }
139
+ //# sourceMappingURL=claude-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-cli.d.ts","sourceRoot":"","sources":["../../../src/shared/providers/claude-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EAEd,UAAU,EACV,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAYlB;;;;;;;GAOG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACnD,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,iBAAiB,CAA4B;IAErD;;;OAGG;gBACS,OAAO,EAAE,gBAAgB;IAOrC;;;OAGG;YACW,kBAAkB;IAiChC;;;;;OAKG;YACW,OAAO;IA0DrB;;;OAGG;IACH,OAAO,CAA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,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAsCrC;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,cAAc,CAAC;IA6B1C,gBAAgB,CACpB,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,UAAU,GACpB,OAAO,CAAC,WAAW,CAAC;IAQvB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;IAanE,UAAU,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAQvD,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC;IAQzD,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CAO/D"}
@@ -0,0 +1,35 @@
1
+ import { AIAdminInterface, AIAdminProject, AIVirtualKey, CreateAIProjectOptions, CreateAIVirtualKeyOptions } from '../types';
2
+ interface GatewayAdminTransportOptions {
3
+ provider: string;
4
+ baseUrl: string;
5
+ apiKey?: string;
6
+ username?: string;
7
+ password?: string;
8
+ headers?: Record<string, string>;
9
+ timeout?: number;
10
+ }
11
+ export declare function normalizeGatewayBaseUrl(baseUrl: string): string;
12
+ /**
13
+ * Derive the gateway root URL for admin APIs from an OpenAI-compatible base URL.
14
+ *
15
+ * Strips known inference path suffixes iteratively so that a baseUrl such as
16
+ * `http://host/openai/v1` collapses to the gateway root rather than to the
17
+ * partial `http://host/openai`.
18
+ */
19
+ export declare function deriveGatewayAdminBaseUrl(baseUrl: string): string;
20
+ export declare function resolveGatewayAdminBaseUrl(baseUrl: string | undefined, adminBaseUrl: string | undefined, provider: string): string;
21
+ export declare function slugifyProjectId(name: string, tenantId?: string): string;
22
+ export declare class BifrostAdmin implements AIAdminInterface {
23
+ private readonly transport;
24
+ constructor(options: GatewayAdminTransportOptions);
25
+ createProject(options: CreateAIProjectOptions): Promise<AIAdminProject>;
26
+ createVirtualKey(options: CreateAIVirtualKeyOptions): Promise<AIVirtualKey>;
27
+ }
28
+ export declare class LiteLLMAdmin implements AIAdminInterface {
29
+ private readonly transport;
30
+ constructor(options: GatewayAdminTransportOptions);
31
+ createProject(options: CreateAIProjectOptions): Promise<AIAdminProject>;
32
+ createVirtualKey(options: CreateAIVirtualKeyOptions): Promise<AIVirtualKey>;
33
+ }
34
+ export {};
35
+ //# sourceMappingURL=gateway-admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway-admin.d.ts","sourceRoot":"","sources":["../../../src/shared/providers/gateway-admin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EAChB,cAAc,EAGd,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAGlB,UAAU,4BAA4B;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAQD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAiBjE;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,QAAQ,EAAE,MAAM,GACf,MAAM,CAaR;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAQxE;AA8PD,qBAAa,YAAa,YAAW,gBAAgB;IACnD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;gBAEtC,OAAO,EAAE,4BAA4B;IAI3C,aAAa,CACjB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,cAAc,CAAC;IAmCpB,gBAAgB,CACpB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,YAAY,CAAC;CAqCzB;AAED,qBAAa,YAAa,YAAW,gBAAgB;IACnD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;gBAEtC,OAAO,EAAE,4BAA4B;IAI3C,aAAa,CACjB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,cAAc,CAAC;IA+BpB,gBAAgB,CACpB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,YAAY,CAAC;CAsCzB"}
@@ -0,0 +1,116 @@
1
+ import { AICapabilities, AIInterface, AIMessage, AIModel, AIResponse, ChatOptions, CompletionOptions, EmbeddingOptions, EmbeddingResponse, GeminiOptions, ImageDescriptionOptions, ImageEmbeddingOptions, ImageGenerationOptions, ImageGenerationResponse, MessageOptions, TTSOptions, TTSResponse, Voice, VoiceCloneOptions, VoiceDesignOptions, VoiceListOptions } from '../types';
2
+ export declare class GeminiProvider implements AIInterface {
3
+ private options;
4
+ private client;
5
+ constructor(options: GeminiOptions);
6
+ private initializeClientSync;
7
+ private ensureClient;
8
+ /**
9
+ * Build the GoogleGenAI client configuration based on provided options.
10
+ * Supports both Google AI Studio (apiKey only) and Vertex AI (projectId + location).
11
+ */
12
+ private buildClientConfig;
13
+ chat(messages: AIMessage[], options?: ChatOptions): Promise<AIResponse>;
14
+ complete(prompt: string, options?: CompletionOptions): Promise<AIResponse>;
15
+ /**
16
+ * Simple message interface for single-turn interactions with optional history
17
+ *
18
+ * @param text - The message text to send
19
+ * @param options - Configuration options including history, model, etc.
20
+ * @returns Promise resolving to the response content string
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // Simple usage
25
+ * const response = await provider.message('Hello!');
26
+ *
27
+ * // With history
28
+ * const response = await provider.message('What was my question?', {
29
+ * history: [
30
+ * { role: 'user', content: 'What is 2+2?' },
31
+ * { role: 'assistant', content: '4' }
32
+ * ]
33
+ * });
34
+ * ```
35
+ */
36
+ message(text: string, options?: MessageOptions): Promise<string>;
37
+ /**
38
+ * Generate embeddings for text using Gemini embedding models
39
+ * @param text - Single text string or array of texts to embed
40
+ * @param options - Optional configuration for embeddings
41
+ * @returns Promise resolving to embeddings response
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const embedding = await provider.embed('Hello world');
46
+ * const embeddings = await provider.embed(['Text 1', 'Text 2']);
47
+ * ```
48
+ */
49
+ embed(text: string | string[], options?: EmbeddingOptions): Promise<EmbeddingResponse>;
50
+ /**
51
+ * Convert an image to Gemini inline format
52
+ * @param image - Image as URL, base64 data URL, or Buffer
53
+ * @returns Gemini inline data format
54
+ * @private
55
+ */
56
+ private imageToGeminiFormat;
57
+ /**
58
+ * Generate a text description of an image
59
+ * @param image - Image as URL, base64 data URL, or Buffer
60
+ * @param prompt - Custom prompt for description (optional)
61
+ * @param options - Optional configuration
62
+ * @returns Promise resolving to the description string
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * const description = await provider.describeImage('https://example.com/image.jpg');
67
+ * ```
68
+ */
69
+ describeImage(image: string | Buffer, prompt?: string, options?: ImageDescriptionOptions): Promise<string>;
70
+ /**
71
+ * Generate embeddings for an image using native multimodal embeddings
72
+ * @param image - Image as URL, base64 data URL, or Buffer
73
+ * @param options - Optional configuration for image embeddings
74
+ * @returns Promise resolving to embeddings response
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const embedding = await provider.embedImage('https://example.com/image.jpg');
79
+ * ```
80
+ */
81
+ embedImage(image: string | Buffer, options?: ImageEmbeddingOptions): Promise<EmbeddingResponse>;
82
+ /**
83
+ * Generate an image from a text prompt using Imagen 3
84
+ * @param prompt - Text description of the image to generate
85
+ * @param options - Optional configuration for image generation
86
+ * @returns Promise resolving to generated image(s)
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * const result = await provider.generateImage('A sunset over mountains');
91
+ * fs.writeFileSync('image.png', result.images[0].data);
92
+ * ```
93
+ */
94
+ generateImage(prompt: string, options?: ImageGenerationOptions): Promise<ImageGenerationResponse>;
95
+ stream(messages: AIMessage[], options?: ChatOptions): AsyncIterable<string>;
96
+ countTokens(text: string): Promise<number>;
97
+ getModels(): Promise<AIModel[]>;
98
+ getCapabilities(): Promise<AICapabilities>;
99
+ synthesizeSpeech(_text: string, _options?: TTSOptions): Promise<TTSResponse>;
100
+ streamSpeech(_text: string, _options?: TTSOptions): AsyncIterable<Buffer>;
101
+ cloneVoice(_options: VoiceCloneOptions): Promise<Voice>;
102
+ designVoice(_options: VoiceDesignOptions): Promise<Voice>;
103
+ getVoices(_options?: VoiceListOptions): Promise<Voice[]>;
104
+ private mapToolChoice;
105
+ /**
106
+ * Map thinking level from our type to SDK's expected format
107
+ * The SDK expects uppercase values: MINIMAL, LOW, MEDIUM, HIGH
108
+ */
109
+ private mapThinkingLevel;
110
+ private buildGenerateContentConfig;
111
+ private mapFinishReason;
112
+ private messagesToGeminiFormat;
113
+ private stripMarkdownCodeBlock;
114
+ private mapError;
115
+ }
116
+ //# sourceMappingURL=gemini.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../src/shared/providers/gemini.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EAEb,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EAEd,UAAU,EACV,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAalB,qBAAa,cAAe,YAAW,WAAW;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C;IAgB1C,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IA4C/B,eAAe,IAAI,OAAO,CAAC,cAAc,CAAC;IAgC1C,gBAAgB,CACpB,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,UAAU,GACpB,OAAO,CAAC,WAAW,CAAC;IAQvB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;IAanE,UAAU,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAQvD,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC;IAQzD,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAQ9D,OAAO,CAAC,aAAa;IA0BrB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,0BAA0B;IAmDlC,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,sBAAsB;IAoB9B,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,QAAQ;CAuBjB"}
@@ -0,0 +1,33 @@
1
+ import { AICapabilities, AIInterface, AIMessage, AIModel, AIResponse, ChatOptions, CompletionOptions, EmbeddingOptions, EmbeddingResponse, HuggingFaceOptions, ImageDescriptionOptions, ImageEmbeddingOptions, ImageGenerationOptions, ImageGenerationResponse, MessageOptions, TTSOptions, TTSResponse, Voice, VoiceCloneOptions, VoiceDesignOptions, VoiceListOptions } from '../types';
2
+ export declare class HuggingFaceProvider implements AIInterface {
3
+ private options;
4
+ private baseUrl;
5
+ constructor(options: HuggingFaceOptions);
6
+ chat(messages: AIMessage[], options?: ChatOptions): Promise<AIResponse>;
7
+ complete(prompt: string, options?: CompletionOptions): Promise<AIResponse>;
8
+ /**
9
+ * Simple message interface for single-turn interactions with optional history
10
+ *
11
+ * @param text - The message text to send
12
+ * @param options - Configuration options including history, model, etc.
13
+ * @returns Promise resolving to the response content string
14
+ */
15
+ message(text: string, options?: MessageOptions): Promise<string>;
16
+ embed(text: string | string[], options?: EmbeddingOptions): Promise<EmbeddingResponse>;
17
+ embedImage(_image: string | Buffer, _options?: ImageEmbeddingOptions): Promise<EmbeddingResponse>;
18
+ describeImage(_image: string | Buffer, _prompt?: string, _options?: ImageDescriptionOptions): Promise<string>;
19
+ generateImage(_prompt: string, _options?: ImageGenerationOptions): Promise<ImageGenerationResponse>;
20
+ stream(messages: AIMessage[], options?: ChatOptions): AsyncIterable<string>;
21
+ countTokens(text: string): Promise<number>;
22
+ getModels(): Promise<AIModel[]>;
23
+ getCapabilities(): Promise<AICapabilities>;
24
+ synthesizeSpeech(_text: string, _options?: TTSOptions): Promise<TTSResponse>;
25
+ streamSpeech(_text: string, _options?: TTSOptions): AsyncIterable<Buffer>;
26
+ cloneVoice(_options: VoiceCloneOptions): Promise<Voice>;
27
+ designVoice(_options: VoiceDesignOptions): Promise<Voice>;
28
+ getVoices(_options?: VoiceListOptions): Promise<Voice[]>;
29
+ private messagesToPrompt;
30
+ private makeRequest;
31
+ private mapError;
32
+ }
33
+ //# sourceMappingURL=huggingface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"huggingface.d.ts","sourceRoot":"","sources":["../../../src/shared/providers/huggingface.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EAEd,UAAU,EACV,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAWlB,qBAAa,mBAAoB,YAAW,WAAW;IACrD,OAAO,CAAC,O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AE,QAAQ,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;IAanE,UAAU,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAQvD,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC;IAQzD,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAQ9D,OAAO,CAAC,gBAAgB;YAmBV,WAAW;IAqBzB,OAAO,CAAC,QAAQ;CA0BjB"}
@@ -0,0 +1,25 @@
1
+ import { AIMessage, AIResponse, ChatOptions, EmbeddingOptions, EmbeddingResponse, ImageDescriptionOptions, ImageEmbeddingOptions, ImageGenerationOptions, ImageGenerationResponse, LiteLLMOptions } from '../types';
2
+ import { LiteLLMAdmin } from './gateway-admin';
3
+ import { OpenAIProvider } from './openai';
4
+ /**
5
+ * LiteLLM provider implementation.
6
+ *
7
+ * LiteLLM exposes an OpenAI-compatible API surface, so this provider reuses the
8
+ * OpenAI transport while customizing provider identity, model discovery, and
9
+ * capability heuristics for gateway-backed deployments.
10
+ */
11
+ export declare class LiteLLMProvider extends OpenAIProvider {
12
+ readonly admin: LiteLLMAdmin;
13
+ private readonly configuredDefaultModel?;
14
+ private readonly resolvedModelCache;
15
+ constructor(options: LiteLLMOptions);
16
+ private resolveModel;
17
+ private selectModel;
18
+ chat(messages: AIMessage[], options?: ChatOptions): Promise<AIResponse>;
19
+ stream(messages: AIMessage[], options?: ChatOptions): AsyncIterable<string>;
20
+ describeImage(image: string | Buffer, prompt?: string, options?: ImageDescriptionOptions): Promise<string>;
21
+ embed(text: string | string[], options?: EmbeddingOptions): Promise<EmbeddingResponse>;
22
+ embedImage(image: string | Buffer, options?: ImageEmbeddingOptions): Promise<EmbeddingResponse>;
23
+ generateImage(prompt: string, options?: ImageGenerationOptions): Promise<ImageGenerationResponse>;
24
+ }
25
+ //# sourceMappingURL=litellm.d.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AE,sBAA2B,GACnC,OAAO,CAAC,uBAAuB,CAAC;CAMpC"}
@@ -0,0 +1,47 @@
1
+ import { AICapabilities, AIInterface, AIMessage, AIModel, AIResponse, ChatOptions, CompletionOptions, EmbeddingOptions, EmbeddingResponse, ImageDescriptionOptions, ImageEmbeddingOptions, ImageGenerationOptions, ImageGenerationResponse, MessageOptions, OllamaOptions, TTSOptions, TTSResponse, Voice, VoiceCloneOptions, VoiceDesignOptions, VoiceListOptions } from '../types';
2
+ export declare class OllamaProvider implements AIInterface {
3
+ private readonly options;
4
+ private readonly host;
5
+ private readonly configuredDefaultModel?;
6
+ private modelListPromise?;
7
+ private readonly modelShowCache;
8
+ private readonly resolvedModelCache;
9
+ constructor(options: OllamaOptions);
10
+ private get nativeBaseUrl();
11
+ private get compatibilityBaseUrl();
12
+ private buildHeaders;
13
+ private fetchWithTimeout;
14
+ private buildHttpError;
15
+ private mapError;
16
+ private requestJson;
17
+ private requestStream;
18
+ private parseNdjson;
19
+ private showModel;
20
+ private resolveModel;
21
+ private selectModel;
22
+ private isVisionRequest;
23
+ private imageToBase64Payload;
24
+ private imageToDataUrl;
25
+ private parseToolArguments;
26
+ private mapMessagesToOllama;
27
+ private mapTools;
28
+ private buildRuntimeOptions;
29
+ private mapThink;
30
+ chat(messages: AIMessage[], options?: ChatOptions): Promise<AIResponse>;
31
+ complete(prompt: string, options?: CompletionOptions): Promise<AIResponse>;
32
+ message(text: string, options?: MessageOptions): Promise<string>;
33
+ embed(text: string | string[], options?: EmbeddingOptions): Promise<EmbeddingResponse>;
34
+ embedImage(image: string | Buffer, options?: ImageEmbeddingOptions): Promise<EmbeddingResponse>;
35
+ describeImage(image: string | Buffer, prompt?: string, options?: ImageDescriptionOptions): Promise<string>;
36
+ generateImage(prompt: string, options?: ImageGenerationOptions): Promise<ImageGenerationResponse>;
37
+ stream(messages: AIMessage[], options?: ChatOptions): AsyncIterable<string>;
38
+ countTokens(text: string): Promise<number>;
39
+ getModels(): Promise<AIModel[]>;
40
+ getCapabilities(): Promise<AICapabilities>;
41
+ synthesizeSpeech(_text: string, _options?: TTSOptions): Promise<TTSResponse>;
42
+ streamSpeech(_text: string, _options?: TTSOptions): AsyncIterable<Buffer>;
43
+ cloneVoice(_options: VoiceCloneOptions): Promise<Voice>;
44
+ designVoice(_options: VoiceDesignOptions): Promise<Voice>;
45
+ getVoices(_options?: VoiceListOptions): Promise<Voice[]>;
46
+ }
47
+ //# sourceMappingURL=ollama.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../src/shared/providers/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EACd,aAAa,EAEb,UAAU,EACV,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AA4TlB,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAS;IACjD,OAAO,CAAC,gBAAgB,CAAC,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAG3B;IACJ,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAG/B;gBAEQ,OAAO,EAAE,aAAa;IASlC,OAAO,KAAK,aAAa,GAExB;IAED,OAAO,KAAK,oBAAoB,GAE/B;IAED,OAAO,CAAC,YAAY;YAaN,gBAAgB;YAqBhB,cAAc;IA4B5B,OAAO,CAAC,QAAQ;YAcF,WAAW;YAqBX,aAAa;YAoBZ,WAAW;YA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