@everworker/oneringai 0.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/LICENSE +21 -0
- package/README.md +1228 -0
- package/dist/IProvider-BP49c93d.d.cts +22 -0
- package/dist/IProvider-BP49c93d.d.ts +22 -0
- package/dist/ImageModel-B-uH3JEz.d.cts +763 -0
- package/dist/ImageModel-C7EyUfU0.d.ts +763 -0
- package/dist/capabilities/agents/index.cjs +408 -0
- package/dist/capabilities/agents/index.cjs.map +1 -0
- package/dist/capabilities/agents/index.d.cts +3 -0
- package/dist/capabilities/agents/index.d.ts +3 -0
- package/dist/capabilities/agents/index.js +405 -0
- package/dist/capabilities/agents/index.js.map +1 -0
- package/dist/capabilities/images/index.cjs +3583 -0
- package/dist/capabilities/images/index.cjs.map +1 -0
- package/dist/capabilities/images/index.d.cts +2 -0
- package/dist/capabilities/images/index.d.ts +2 -0
- package/dist/capabilities/images/index.js +3556 -0
- package/dist/capabilities/images/index.js.map +1 -0
- package/dist/index-BmOYeqU7.d.ts +1338 -0
- package/dist/index-DCzFlLoN.d.cts +1338 -0
- package/dist/index.cjs +49257 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +12263 -0
- package/dist/index.d.ts +12263 -0
- package/dist/index.js +48953 -0
- package/dist/index.js.map +1 -0
- package/package.json +162 -0
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
import { I as IProvider } from './IProvider-BP49c93d.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Supported AI Vendors
|
|
5
|
+
*
|
|
6
|
+
* Use this enum instead of string literals for type safety.
|
|
7
|
+
* These map to specific provider implementations.
|
|
8
|
+
*/
|
|
9
|
+
declare const Vendor: {
|
|
10
|
+
readonly OpenAI: "openai";
|
|
11
|
+
readonly Anthropic: "anthropic";
|
|
12
|
+
readonly Google: "google";
|
|
13
|
+
readonly GoogleVertex: "google-vertex";
|
|
14
|
+
readonly Groq: "groq";
|
|
15
|
+
readonly Together: "together";
|
|
16
|
+
readonly Perplexity: "perplexity";
|
|
17
|
+
readonly Grok: "grok";
|
|
18
|
+
readonly DeepSeek: "deepseek";
|
|
19
|
+
readonly Mistral: "mistral";
|
|
20
|
+
readonly Ollama: "ollama";
|
|
21
|
+
readonly Custom: "custom";
|
|
22
|
+
};
|
|
23
|
+
type Vendor = (typeof Vendor)[keyof typeof Vendor];
|
|
24
|
+
/**
|
|
25
|
+
* All vendor values as array (useful for validation)
|
|
26
|
+
*/
|
|
27
|
+
declare const VENDORS: ("openai" | "anthropic" | "google" | "google-vertex" | "groq" | "together" | "perplexity" | "grok" | "deepseek" | "mistral" | "ollama" | "custom")[];
|
|
28
|
+
/**
|
|
29
|
+
* Check if a string is a valid vendor
|
|
30
|
+
*/
|
|
31
|
+
declare function isVendor(value: string): value is Vendor;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Connector - Represents authenticated connection to ANY API
|
|
35
|
+
*
|
|
36
|
+
* Connectors handle authentication for:
|
|
37
|
+
* - AI providers (OpenAI, Anthropic, Google, etc.)
|
|
38
|
+
* - External APIs (GitHub, Microsoft, Salesforce, etc.)
|
|
39
|
+
*
|
|
40
|
+
* This is the SINGLE source of truth for authentication.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* No authentication (for testing/mock providers)
|
|
45
|
+
*/
|
|
46
|
+
interface NoneConnectorAuth {
|
|
47
|
+
type: 'none';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Connector authentication configuration
|
|
51
|
+
* Supports OAuth 2.0, API keys, JWT bearer tokens, and none (for testing)
|
|
52
|
+
*/
|
|
53
|
+
type ConnectorAuth = OAuthConnectorAuth | APIKeyConnectorAuth | JWTConnectorAuth | NoneConnectorAuth;
|
|
54
|
+
/**
|
|
55
|
+
* OAuth 2.0 authentication for connectors
|
|
56
|
+
* Supports multiple OAuth flows
|
|
57
|
+
*/
|
|
58
|
+
interface OAuthConnectorAuth {
|
|
59
|
+
type: 'oauth';
|
|
60
|
+
flow: 'authorization_code' | 'client_credentials' | 'jwt_bearer';
|
|
61
|
+
clientId: string;
|
|
62
|
+
clientSecret?: string;
|
|
63
|
+
tokenUrl: string;
|
|
64
|
+
authorizationUrl?: string;
|
|
65
|
+
redirectUri?: string;
|
|
66
|
+
scope?: string;
|
|
67
|
+
usePKCE?: boolean;
|
|
68
|
+
privateKey?: string;
|
|
69
|
+
privateKeyPath?: string;
|
|
70
|
+
issuer?: string;
|
|
71
|
+
subject?: string;
|
|
72
|
+
audience?: string;
|
|
73
|
+
refreshBeforeExpiry?: number;
|
|
74
|
+
storageKey?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Static API key authentication
|
|
78
|
+
* For services like OpenAI, Anthropic, many SaaS APIs
|
|
79
|
+
*/
|
|
80
|
+
interface APIKeyConnectorAuth {
|
|
81
|
+
type: 'api_key';
|
|
82
|
+
apiKey: string;
|
|
83
|
+
headerName?: string;
|
|
84
|
+
headerPrefix?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* JWT Bearer token authentication
|
|
88
|
+
* For service accounts (Google, Salesforce)
|
|
89
|
+
*/
|
|
90
|
+
interface JWTConnectorAuth {
|
|
91
|
+
type: 'jwt';
|
|
92
|
+
privateKey: string;
|
|
93
|
+
privateKeyPath?: string;
|
|
94
|
+
tokenUrl: string;
|
|
95
|
+
clientId: string;
|
|
96
|
+
scope?: string;
|
|
97
|
+
issuer?: string;
|
|
98
|
+
subject?: string;
|
|
99
|
+
audience?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Complete connector configuration
|
|
103
|
+
* Used for BOTH AI providers AND external APIs
|
|
104
|
+
*/
|
|
105
|
+
interface ConnectorConfig {
|
|
106
|
+
name?: string;
|
|
107
|
+
vendor?: Vendor;
|
|
108
|
+
serviceType?: string;
|
|
109
|
+
auth: ConnectorAuth;
|
|
110
|
+
displayName?: string;
|
|
111
|
+
description?: string;
|
|
112
|
+
baseURL?: string;
|
|
113
|
+
defaultModel?: string;
|
|
114
|
+
apiVersion?: string;
|
|
115
|
+
rateLimit?: {
|
|
116
|
+
requestsPerMinute?: number;
|
|
117
|
+
requestsPerDay?: number;
|
|
118
|
+
};
|
|
119
|
+
documentation?: string;
|
|
120
|
+
tags?: string[];
|
|
121
|
+
options?: {
|
|
122
|
+
organization?: string;
|
|
123
|
+
project?: string;
|
|
124
|
+
anthropicVersion?: string;
|
|
125
|
+
location?: string;
|
|
126
|
+
projectId?: string;
|
|
127
|
+
[key: string]: unknown;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Request timeout in milliseconds
|
|
131
|
+
* @default 30000 (30 seconds)
|
|
132
|
+
*/
|
|
133
|
+
timeout?: number;
|
|
134
|
+
/**
|
|
135
|
+
* Retry configuration for transient failures
|
|
136
|
+
*/
|
|
137
|
+
retry?: {
|
|
138
|
+
/** Maximum number of retry attempts @default 3 */
|
|
139
|
+
maxRetries?: number;
|
|
140
|
+
/** HTTP status codes that trigger retry @default [429, 500, 502, 503, 504] */
|
|
141
|
+
retryableStatuses?: number[];
|
|
142
|
+
/** Base delay in ms for exponential backoff @default 1000 */
|
|
143
|
+
baseDelayMs?: number;
|
|
144
|
+
/** Maximum delay in ms @default 30000 */
|
|
145
|
+
maxDelayMs?: number;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Circuit breaker configuration for failing services
|
|
149
|
+
*/
|
|
150
|
+
circuitBreaker?: {
|
|
151
|
+
/** Enable circuit breaker @default true */
|
|
152
|
+
enabled?: boolean;
|
|
153
|
+
/** Number of failures before opening circuit @default 5 */
|
|
154
|
+
failureThreshold?: number;
|
|
155
|
+
/** Number of successes to close circuit @default 2 */
|
|
156
|
+
successThreshold?: number;
|
|
157
|
+
/** Time in ms before attempting to close circuit @default 30000 */
|
|
158
|
+
resetTimeoutMs?: number;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Logging configuration for requests/responses
|
|
162
|
+
*/
|
|
163
|
+
logging?: {
|
|
164
|
+
/** Enable request/response logging @default false */
|
|
165
|
+
enabled?: boolean;
|
|
166
|
+
/** Log request/response bodies (security risk) @default false */
|
|
167
|
+
logBody?: boolean;
|
|
168
|
+
/** Log request/response headers (security risk) @default false */
|
|
169
|
+
logHeaders?: boolean;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Result from ProviderConfigAgent
|
|
174
|
+
* Includes setup instructions and environment variables
|
|
175
|
+
*/
|
|
176
|
+
interface ConnectorConfigResult {
|
|
177
|
+
name: string;
|
|
178
|
+
config: ConnectorConfig;
|
|
179
|
+
setupInstructions: string;
|
|
180
|
+
envVariables: string[];
|
|
181
|
+
setupUrl?: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Token storage interface (Clean Architecture - Domain Layer)
|
|
186
|
+
* All implementations must encrypt tokens at rest
|
|
187
|
+
*/
|
|
188
|
+
interface StoredToken {
|
|
189
|
+
access_token: string;
|
|
190
|
+
refresh_token?: string;
|
|
191
|
+
expires_in: number;
|
|
192
|
+
token_type: string;
|
|
193
|
+
scope?: string;
|
|
194
|
+
obtained_at: number;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Token storage interface
|
|
198
|
+
* All implementations MUST encrypt tokens before storing
|
|
199
|
+
*/
|
|
200
|
+
interface ITokenStorage {
|
|
201
|
+
/**
|
|
202
|
+
* Store token (must be encrypted by implementation)
|
|
203
|
+
*
|
|
204
|
+
* @param key - Unique identifier for this token
|
|
205
|
+
* @param token - Token data to store
|
|
206
|
+
*/
|
|
207
|
+
storeToken(key: string, token: StoredToken): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Retrieve token (must be decrypted by implementation)
|
|
210
|
+
*
|
|
211
|
+
* @param key - Unique identifier for the token
|
|
212
|
+
* @returns Decrypted token or null if not found
|
|
213
|
+
*/
|
|
214
|
+
getToken(key: string): Promise<StoredToken | null>;
|
|
215
|
+
/**
|
|
216
|
+
* Delete token
|
|
217
|
+
*
|
|
218
|
+
* @param key - Unique identifier for the token
|
|
219
|
+
*/
|
|
220
|
+
deleteToken(key: string): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* Check if token exists
|
|
223
|
+
*
|
|
224
|
+
* @param key - Unique identifier for the token
|
|
225
|
+
* @returns True if token exists
|
|
226
|
+
*/
|
|
227
|
+
hasToken(key: string): Promise<boolean>;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Connector - The single source of truth for authentication
|
|
232
|
+
*
|
|
233
|
+
* Manages authenticated connections to:
|
|
234
|
+
* - AI providers (OpenAI, Anthropic, Google, etc.)
|
|
235
|
+
* - External APIs (GitHub, Salesforce, etc.)
|
|
236
|
+
*
|
|
237
|
+
* Enterprise features:
|
|
238
|
+
* - Request timeout with AbortController
|
|
239
|
+
* - Circuit breaker for failing services
|
|
240
|
+
* - Retry with exponential backoff
|
|
241
|
+
* - Request/response logging
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Default configuration values for resilience features
|
|
246
|
+
*/
|
|
247
|
+
declare const DEFAULT_CONNECTOR_TIMEOUT = 30000;
|
|
248
|
+
declare const DEFAULT_MAX_RETRIES = 3;
|
|
249
|
+
declare const DEFAULT_RETRYABLE_STATUSES: number[];
|
|
250
|
+
declare const DEFAULT_BASE_DELAY_MS = 1000;
|
|
251
|
+
declare const DEFAULT_MAX_DELAY_MS = 30000;
|
|
252
|
+
/**
|
|
253
|
+
* Fetch options with additional connector-specific settings
|
|
254
|
+
*/
|
|
255
|
+
interface ConnectorFetchOptions extends RequestInit {
|
|
256
|
+
/** Override timeout for this request */
|
|
257
|
+
timeout?: number;
|
|
258
|
+
/** Skip retry for this request */
|
|
259
|
+
skipRetry?: boolean;
|
|
260
|
+
/** Skip circuit breaker for this request */
|
|
261
|
+
skipCircuitBreaker?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Connector class - represents a single authenticated connection
|
|
265
|
+
*/
|
|
266
|
+
declare class Connector {
|
|
267
|
+
private static registry;
|
|
268
|
+
private static defaultStorage;
|
|
269
|
+
/**
|
|
270
|
+
* Create and register a new connector
|
|
271
|
+
* @param config - Must include `name` field
|
|
272
|
+
*/
|
|
273
|
+
static create(config: ConnectorConfig & {
|
|
274
|
+
name: string;
|
|
275
|
+
}): Connector;
|
|
276
|
+
/**
|
|
277
|
+
* Get a connector by name
|
|
278
|
+
*/
|
|
279
|
+
static get(name: string): Connector;
|
|
280
|
+
/**
|
|
281
|
+
* Check if a connector exists
|
|
282
|
+
*/
|
|
283
|
+
static has(name: string): boolean;
|
|
284
|
+
/**
|
|
285
|
+
* List all registered connector names
|
|
286
|
+
*/
|
|
287
|
+
static list(): string[];
|
|
288
|
+
/**
|
|
289
|
+
* Remove a connector
|
|
290
|
+
*/
|
|
291
|
+
static remove(name: string): boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Clear all connectors (useful for testing)
|
|
294
|
+
*/
|
|
295
|
+
static clear(): void;
|
|
296
|
+
/**
|
|
297
|
+
* Set default token storage for OAuth connectors
|
|
298
|
+
*/
|
|
299
|
+
static setDefaultStorage(storage: ITokenStorage): void;
|
|
300
|
+
/**
|
|
301
|
+
* Get all registered connectors
|
|
302
|
+
*/
|
|
303
|
+
static listAll(): Connector[];
|
|
304
|
+
/**
|
|
305
|
+
* Get number of registered connectors
|
|
306
|
+
*/
|
|
307
|
+
static size(): number;
|
|
308
|
+
/**
|
|
309
|
+
* Get connector descriptions formatted for tool parameters
|
|
310
|
+
* Useful for generating dynamic tool descriptions
|
|
311
|
+
*/
|
|
312
|
+
static getDescriptionsForTools(): string;
|
|
313
|
+
/**
|
|
314
|
+
* Get connector info (for tools and documentation)
|
|
315
|
+
*/
|
|
316
|
+
static getInfo(): Record<string, {
|
|
317
|
+
displayName: string;
|
|
318
|
+
description: string;
|
|
319
|
+
baseURL: string;
|
|
320
|
+
}>;
|
|
321
|
+
readonly name: string;
|
|
322
|
+
readonly vendor?: Vendor;
|
|
323
|
+
readonly config: ConnectorConfig;
|
|
324
|
+
private oauthManager?;
|
|
325
|
+
private circuitBreaker?;
|
|
326
|
+
private disposed;
|
|
327
|
+
private requestCount;
|
|
328
|
+
private successCount;
|
|
329
|
+
private failureCount;
|
|
330
|
+
private totalLatencyMs;
|
|
331
|
+
private constructor();
|
|
332
|
+
/**
|
|
333
|
+
* Initialize circuit breaker with config or defaults
|
|
334
|
+
*/
|
|
335
|
+
private initCircuitBreaker;
|
|
336
|
+
/**
|
|
337
|
+
* Human-readable display name
|
|
338
|
+
*/
|
|
339
|
+
get displayName(): string;
|
|
340
|
+
/**
|
|
341
|
+
* API base URL for this connector
|
|
342
|
+
*/
|
|
343
|
+
get baseURL(): string;
|
|
344
|
+
/**
|
|
345
|
+
* Get the API key (for api_key auth type)
|
|
346
|
+
*/
|
|
347
|
+
getApiKey(): string;
|
|
348
|
+
/**
|
|
349
|
+
* Get the current access token (for OAuth, JWT, or API key)
|
|
350
|
+
* Handles automatic refresh if needed
|
|
351
|
+
*/
|
|
352
|
+
getToken(userId?: string): Promise<string>;
|
|
353
|
+
/**
|
|
354
|
+
* Start OAuth authorization flow
|
|
355
|
+
* Returns the URL to redirect the user to
|
|
356
|
+
*/
|
|
357
|
+
startAuth(userId?: string): Promise<string>;
|
|
358
|
+
/**
|
|
359
|
+
* Handle OAuth callback
|
|
360
|
+
* Call this after user is redirected back from OAuth provider
|
|
361
|
+
*/
|
|
362
|
+
handleCallback(callbackUrl: string, userId?: string): Promise<void>;
|
|
363
|
+
/**
|
|
364
|
+
* Check if the connector has a valid token
|
|
365
|
+
*/
|
|
366
|
+
hasValidToken(userId?: string): Promise<boolean>;
|
|
367
|
+
/**
|
|
368
|
+
* Get vendor-specific options from config
|
|
369
|
+
*/
|
|
370
|
+
getOptions(): Record<string, unknown>;
|
|
371
|
+
/**
|
|
372
|
+
* Get the service type (explicit or undefined)
|
|
373
|
+
*/
|
|
374
|
+
get serviceType(): string | undefined;
|
|
375
|
+
/**
|
|
376
|
+
* Get connector metrics
|
|
377
|
+
*/
|
|
378
|
+
getMetrics(): {
|
|
379
|
+
requestCount: number;
|
|
380
|
+
successCount: number;
|
|
381
|
+
failureCount: number;
|
|
382
|
+
avgLatencyMs: number;
|
|
383
|
+
circuitBreakerState?: string;
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Reset circuit breaker (force close)
|
|
387
|
+
*/
|
|
388
|
+
resetCircuitBreaker(): void;
|
|
389
|
+
/**
|
|
390
|
+
* Make an authenticated fetch request using this connector
|
|
391
|
+
* This is the foundation for all vendor-dependent tools
|
|
392
|
+
*
|
|
393
|
+
* Features:
|
|
394
|
+
* - Timeout with AbortController
|
|
395
|
+
* - Circuit breaker protection
|
|
396
|
+
* - Retry with exponential backoff
|
|
397
|
+
* - Request/response logging
|
|
398
|
+
*
|
|
399
|
+
* @param endpoint - API endpoint (relative to baseURL) or full URL
|
|
400
|
+
* @param options - Fetch options with connector-specific settings
|
|
401
|
+
* @param userId - Optional user ID for multi-user OAuth
|
|
402
|
+
* @returns Fetch Response
|
|
403
|
+
*/
|
|
404
|
+
fetch(endpoint: string, options?: ConnectorFetchOptions, userId?: string): Promise<Response>;
|
|
405
|
+
/**
|
|
406
|
+
* Make an authenticated fetch request and parse JSON response
|
|
407
|
+
* Throws on non-OK responses
|
|
408
|
+
*
|
|
409
|
+
* @param endpoint - API endpoint (relative to baseURL) or full URL
|
|
410
|
+
* @param options - Fetch options with connector-specific settings
|
|
411
|
+
* @param userId - Optional user ID for multi-user OAuth
|
|
412
|
+
* @returns Parsed JSON response
|
|
413
|
+
*/
|
|
414
|
+
fetchJSON<T = unknown>(endpoint: string, options?: ConnectorFetchOptions, userId?: string): Promise<T>;
|
|
415
|
+
private sleep;
|
|
416
|
+
private logRequest;
|
|
417
|
+
private logResponse;
|
|
418
|
+
/**
|
|
419
|
+
* Dispose of resources
|
|
420
|
+
*/
|
|
421
|
+
dispose(): void;
|
|
422
|
+
/**
|
|
423
|
+
* Check if connector is disposed
|
|
424
|
+
*/
|
|
425
|
+
isDisposed(): boolean;
|
|
426
|
+
private initOAuthManager;
|
|
427
|
+
private initJWTManager;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Shared types used across all multimodal capabilities
|
|
432
|
+
* This file provides the foundation for Image, Audio, and Video model registries
|
|
433
|
+
*/
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Aspect ratios - normalized across all visual modalities (images, video)
|
|
437
|
+
*/
|
|
438
|
+
type AspectRatio$1 = '1:1' | '16:9' | '9:16' | '4:3' | '3:4' | '21:9' | '3:2' | '2:3';
|
|
439
|
+
/**
|
|
440
|
+
* Quality levels - normalized across vendors
|
|
441
|
+
* Providers map these to vendor-specific quality settings
|
|
442
|
+
*/
|
|
443
|
+
type QualityLevel = 'draft' | 'standard' | 'high' | 'ultra';
|
|
444
|
+
/**
|
|
445
|
+
* Audio output formats
|
|
446
|
+
*/
|
|
447
|
+
type AudioFormat = 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm' | 'ogg';
|
|
448
|
+
/**
|
|
449
|
+
* Output format preference for media
|
|
450
|
+
*/
|
|
451
|
+
type OutputFormat = 'url' | 'base64' | 'buffer';
|
|
452
|
+
/**
|
|
453
|
+
* Source links for model documentation and maintenance
|
|
454
|
+
* Used to track where information came from and when it was last verified
|
|
455
|
+
*/
|
|
456
|
+
interface ISourceLinks {
|
|
457
|
+
/** Official documentation URL */
|
|
458
|
+
documentation: string;
|
|
459
|
+
/** Pricing page URL */
|
|
460
|
+
pricing?: string;
|
|
461
|
+
/** API reference URL */
|
|
462
|
+
apiReference?: string;
|
|
463
|
+
/** Additional reference (e.g., blog post, announcement) */
|
|
464
|
+
additional?: string;
|
|
465
|
+
/** Last verified date (YYYY-MM-DD) */
|
|
466
|
+
lastVerified: string;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Vendor-specific option schema for validation and documentation
|
|
470
|
+
* Used to describe vendor-specific options that fall outside semantic options
|
|
471
|
+
*/
|
|
472
|
+
interface VendorOptionSchema {
|
|
473
|
+
/** Data type of the option */
|
|
474
|
+
type: 'string' | 'number' | 'boolean' | 'enum' | 'array';
|
|
475
|
+
/** Description of the option */
|
|
476
|
+
description: string;
|
|
477
|
+
/** Whether the option is required */
|
|
478
|
+
required?: boolean;
|
|
479
|
+
/** UI display label */
|
|
480
|
+
label?: string;
|
|
481
|
+
/** Valid values for enum/string types */
|
|
482
|
+
enum?: string[];
|
|
483
|
+
/** Default value */
|
|
484
|
+
default?: unknown;
|
|
485
|
+
/** Minimum value for numbers */
|
|
486
|
+
min?: number;
|
|
487
|
+
/** Maximum value for numbers */
|
|
488
|
+
max?: number;
|
|
489
|
+
/** Step value for number sliders */
|
|
490
|
+
step?: number;
|
|
491
|
+
/** UI control type hint */
|
|
492
|
+
controlType?: 'select' | 'radio' | 'slider' | 'checkbox' | 'text' | 'textarea';
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Base model description - shared by all registries
|
|
496
|
+
* Every model registry (Image, TTS, STT, Video) extends this
|
|
497
|
+
*/
|
|
498
|
+
interface IBaseModelDescription {
|
|
499
|
+
/** Model identifier (e.g., "dall-e-3", "tts-1") */
|
|
500
|
+
name: string;
|
|
501
|
+
/** Display name for UI (e.g., "DALL-E 3", "TTS-1") */
|
|
502
|
+
displayName: string;
|
|
503
|
+
/** Vendor/provider */
|
|
504
|
+
provider: Vendor;
|
|
505
|
+
/** Model description */
|
|
506
|
+
description?: string;
|
|
507
|
+
/** Whether the model is currently available */
|
|
508
|
+
isActive: boolean;
|
|
509
|
+
/** Release date (YYYY-MM-DD) */
|
|
510
|
+
releaseDate?: string;
|
|
511
|
+
/** Deprecation date if scheduled (YYYY-MM-DD) */
|
|
512
|
+
deprecationDate?: string;
|
|
513
|
+
/** Documentation/pricing links for maintenance */
|
|
514
|
+
sources: ISourceLinks;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Image generation provider interface
|
|
519
|
+
*/
|
|
520
|
+
|
|
521
|
+
interface ImageGenerateOptions {
|
|
522
|
+
model: string;
|
|
523
|
+
prompt: string;
|
|
524
|
+
size?: string;
|
|
525
|
+
aspectRatio?: string;
|
|
526
|
+
quality?: 'standard' | 'hd' | 'low' | 'medium' | 'high' | 'auto';
|
|
527
|
+
style?: 'vivid' | 'natural';
|
|
528
|
+
n?: number;
|
|
529
|
+
response_format?: 'url' | 'b64_json';
|
|
530
|
+
}
|
|
531
|
+
interface ImageEditOptions {
|
|
532
|
+
model: string;
|
|
533
|
+
image: Buffer | string;
|
|
534
|
+
prompt: string;
|
|
535
|
+
mask?: Buffer | string;
|
|
536
|
+
size?: string;
|
|
537
|
+
n?: number;
|
|
538
|
+
response_format?: 'url' | 'b64_json';
|
|
539
|
+
}
|
|
540
|
+
interface ImageVariationOptions {
|
|
541
|
+
model: string;
|
|
542
|
+
image: Buffer | string;
|
|
543
|
+
n?: number;
|
|
544
|
+
size?: string;
|
|
545
|
+
response_format?: 'url' | 'b64_json';
|
|
546
|
+
}
|
|
547
|
+
interface ImageResponse {
|
|
548
|
+
created: number;
|
|
549
|
+
data: Array<{
|
|
550
|
+
url?: string;
|
|
551
|
+
b64_json?: string;
|
|
552
|
+
revised_prompt?: string;
|
|
553
|
+
}>;
|
|
554
|
+
}
|
|
555
|
+
interface IImageProvider extends IProvider {
|
|
556
|
+
/**
|
|
557
|
+
* Generate images from text prompt
|
|
558
|
+
*/
|
|
559
|
+
generateImage(options: ImageGenerateOptions): Promise<ImageResponse>;
|
|
560
|
+
/**
|
|
561
|
+
* Edit an existing image (optional - not all providers support)
|
|
562
|
+
*/
|
|
563
|
+
editImage?(options: ImageEditOptions): Promise<ImageResponse>;
|
|
564
|
+
/**
|
|
565
|
+
* Create variations of an image (optional)
|
|
566
|
+
*/
|
|
567
|
+
createVariation?(options: ImageVariationOptions): Promise<ImageResponse>;
|
|
568
|
+
/**
|
|
569
|
+
* List available models
|
|
570
|
+
*/
|
|
571
|
+
listModels?(): Promise<string[]>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Options for creating an ImageGeneration instance
|
|
576
|
+
*/
|
|
577
|
+
interface ImageGenerationCreateOptions {
|
|
578
|
+
/** Connector name or instance */
|
|
579
|
+
connector: string | Connector;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Simplified options for quick generation
|
|
583
|
+
*/
|
|
584
|
+
interface SimpleGenerateOptions {
|
|
585
|
+
/** Text prompt describing the image */
|
|
586
|
+
prompt: string;
|
|
587
|
+
/** Model to use (defaults to vendor's best model) */
|
|
588
|
+
model?: string;
|
|
589
|
+
/** Image size */
|
|
590
|
+
size?: string;
|
|
591
|
+
/** Quality setting */
|
|
592
|
+
quality?: 'standard' | 'hd';
|
|
593
|
+
/** Style setting (DALL-E 3 only) */
|
|
594
|
+
style?: 'vivid' | 'natural';
|
|
595
|
+
/** Number of images to generate */
|
|
596
|
+
n?: number;
|
|
597
|
+
/** Response format */
|
|
598
|
+
response_format?: 'url' | 'b64_json';
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* ImageGeneration capability class
|
|
602
|
+
*/
|
|
603
|
+
declare class ImageGeneration {
|
|
604
|
+
private provider;
|
|
605
|
+
private connector;
|
|
606
|
+
private defaultModel;
|
|
607
|
+
private constructor();
|
|
608
|
+
/**
|
|
609
|
+
* Create an ImageGeneration instance
|
|
610
|
+
*/
|
|
611
|
+
static create(options: ImageGenerationCreateOptions): ImageGeneration;
|
|
612
|
+
/**
|
|
613
|
+
* Generate images from a text prompt
|
|
614
|
+
*/
|
|
615
|
+
generate(options: SimpleGenerateOptions): Promise<ImageResponse>;
|
|
616
|
+
/**
|
|
617
|
+
* Edit an existing image
|
|
618
|
+
* Note: Not all models/vendors support this
|
|
619
|
+
*/
|
|
620
|
+
edit(options: ImageEditOptions): Promise<ImageResponse>;
|
|
621
|
+
/**
|
|
622
|
+
* Create variations of an existing image
|
|
623
|
+
* Note: Only DALL-E 2 supports this
|
|
624
|
+
*/
|
|
625
|
+
createVariation(options: ImageVariationOptions): Promise<ImageResponse>;
|
|
626
|
+
/**
|
|
627
|
+
* List available models for this provider
|
|
628
|
+
*/
|
|
629
|
+
listModels(): Promise<string[]>;
|
|
630
|
+
/**
|
|
631
|
+
* Get information about a specific model
|
|
632
|
+
*/
|
|
633
|
+
getModelInfo(modelName: string): IImageModelDescription | undefined;
|
|
634
|
+
/**
|
|
635
|
+
* Get the underlying provider
|
|
636
|
+
*/
|
|
637
|
+
getProvider(): IImageProvider;
|
|
638
|
+
/**
|
|
639
|
+
* Get the current connector
|
|
640
|
+
*/
|
|
641
|
+
getConnector(): Connector;
|
|
642
|
+
/**
|
|
643
|
+
* Get the default model for this vendor
|
|
644
|
+
*/
|
|
645
|
+
private getDefaultModel;
|
|
646
|
+
/**
|
|
647
|
+
* Get the default edit model for this vendor
|
|
648
|
+
*/
|
|
649
|
+
private getEditModel;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Image generation model registry with comprehensive metadata
|
|
654
|
+
*/
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Supported image sizes by model
|
|
658
|
+
*/
|
|
659
|
+
type ImageSize = '256x256' | '512x512' | '1024x1024' | '1024x1536' | '1536x1024' | '1792x1024' | '1024x1792' | 'auto';
|
|
660
|
+
/**
|
|
661
|
+
* Supported aspect ratios
|
|
662
|
+
*/
|
|
663
|
+
type AspectRatio = '1:1' | '3:4' | '4:3' | '9:16' | '16:9' | '3:2' | '2:3';
|
|
664
|
+
/**
|
|
665
|
+
* Image model capabilities
|
|
666
|
+
*/
|
|
667
|
+
interface ImageModelCapabilities {
|
|
668
|
+
/** Supported image sizes */
|
|
669
|
+
sizes: readonly ImageSize[];
|
|
670
|
+
/** Supported aspect ratios (Google) */
|
|
671
|
+
aspectRatios?: readonly AspectRatio[];
|
|
672
|
+
/** Maximum number of images per request */
|
|
673
|
+
maxImagesPerRequest: number;
|
|
674
|
+
/** Supported output formats */
|
|
675
|
+
outputFormats: readonly string[];
|
|
676
|
+
/** Feature support flags */
|
|
677
|
+
features: {
|
|
678
|
+
/** Text-to-image generation */
|
|
679
|
+
generation: boolean;
|
|
680
|
+
/** Image editing/inpainting */
|
|
681
|
+
editing: boolean;
|
|
682
|
+
/** Image variations */
|
|
683
|
+
variations: boolean;
|
|
684
|
+
/** Style control */
|
|
685
|
+
styleControl: boolean;
|
|
686
|
+
/** Quality control (standard/hd) */
|
|
687
|
+
qualityControl: boolean;
|
|
688
|
+
/** Transparent backgrounds */
|
|
689
|
+
transparency: boolean;
|
|
690
|
+
/** Prompt revision/enhancement */
|
|
691
|
+
promptRevision: boolean;
|
|
692
|
+
};
|
|
693
|
+
/** Model limits */
|
|
694
|
+
limits: {
|
|
695
|
+
/** Maximum prompt length in characters */
|
|
696
|
+
maxPromptLength: number;
|
|
697
|
+
/** Rate limit (requests per minute) */
|
|
698
|
+
maxRequestsPerMinute?: number;
|
|
699
|
+
};
|
|
700
|
+
/** Vendor-specific options schema */
|
|
701
|
+
vendorOptions?: Record<string, VendorOptionSchema>;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Image model pricing
|
|
705
|
+
*/
|
|
706
|
+
interface ImageModelPricing {
|
|
707
|
+
/** Cost per image at standard quality */
|
|
708
|
+
perImageStandard?: number;
|
|
709
|
+
/** Cost per image at HD quality */
|
|
710
|
+
perImageHD?: number;
|
|
711
|
+
/** Cost per image (flat rate) */
|
|
712
|
+
perImage?: number;
|
|
713
|
+
currency: 'USD';
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Complete image model description
|
|
717
|
+
*/
|
|
718
|
+
interface IImageModelDescription extends IBaseModelDescription {
|
|
719
|
+
capabilities: ImageModelCapabilities;
|
|
720
|
+
pricing?: ImageModelPricing;
|
|
721
|
+
}
|
|
722
|
+
declare const IMAGE_MODELS: {
|
|
723
|
+
readonly openai: {
|
|
724
|
+
/** GPT-Image-1: Latest OpenAI image model with best quality */
|
|
725
|
+
readonly GPT_IMAGE_1: "gpt-image-1";
|
|
726
|
+
/** DALL-E 3: High quality image generation */
|
|
727
|
+
readonly DALL_E_3: "dall-e-3";
|
|
728
|
+
/** DALL-E 2: Fast, supports editing and variations */
|
|
729
|
+
readonly DALL_E_2: "dall-e-2";
|
|
730
|
+
};
|
|
731
|
+
readonly google: {
|
|
732
|
+
/** Imagen 4.0: Latest Google image generation model */
|
|
733
|
+
readonly IMAGEN_4_GENERATE: "imagen-4.0-generate-001";
|
|
734
|
+
/** Imagen 4.0 Ultra: Highest quality */
|
|
735
|
+
readonly IMAGEN_4_ULTRA: "imagen-4.0-ultra-generate-001";
|
|
736
|
+
/** Imagen 4.0 Fast: Optimized for speed */
|
|
737
|
+
readonly IMAGEN_4_FAST: "imagen-4.0-fast-generate-001";
|
|
738
|
+
};
|
|
739
|
+
readonly grok: {
|
|
740
|
+
/** Grok Imagine Image: xAI image generation with editing support */
|
|
741
|
+
readonly GROK_IMAGINE_IMAGE: "grok-imagine-image";
|
|
742
|
+
/** Grok 2 Image: xAI image generation (text-only input) */
|
|
743
|
+
readonly GROK_2_IMAGE_1212: "grok-2-image-1212";
|
|
744
|
+
};
|
|
745
|
+
};
|
|
746
|
+
/**
|
|
747
|
+
* Complete image model registry
|
|
748
|
+
* Last full audit: January 2026
|
|
749
|
+
*/
|
|
750
|
+
declare const IMAGE_MODEL_REGISTRY: Record<string, IImageModelDescription>;
|
|
751
|
+
declare const getImageModelInfo: (modelName: string) => IImageModelDescription | undefined;
|
|
752
|
+
declare const getImageModelsByVendor: (vendor: Vendor) => IImageModelDescription[];
|
|
753
|
+
declare const getActiveImageModels: () => IImageModelDescription[];
|
|
754
|
+
/**
|
|
755
|
+
* Get image models that support a specific feature
|
|
756
|
+
*/
|
|
757
|
+
declare function getImageModelsWithFeature(feature: keyof IImageModelDescription['capabilities']['features']): IImageModelDescription[];
|
|
758
|
+
/**
|
|
759
|
+
* Calculate estimated cost for image generation
|
|
760
|
+
*/
|
|
761
|
+
declare function calculateImageCost(modelName: string, imageCount: number, quality?: 'standard' | 'hd'): number | null;
|
|
762
|
+
|
|
763
|
+
export { type AudioFormat as A, type ImageResponse as B, Connector as C, type AspectRatio$1 as D, type OutputFormat as E, type ISourceLinks as F, DEFAULT_CONNECTOR_TIMEOUT as G, DEFAULT_MAX_RETRIES as H, type IBaseModelDescription as I, type JWTConnectorAuth as J, DEFAULT_RETRYABLE_STATUSES as K, DEFAULT_BASE_DELAY_MS as L, DEFAULT_MAX_DELAY_MS as M, type OAuthConnectorAuth as O, type QualityLevel as Q, type StoredToken as S, type VendorOptionSchema as V, Vendor as a, type IImageProvider as b, type ConnectorFetchOptions as c, type ITokenStorage as d, type ConnectorConfig as e, type ConnectorAuth as f, type ConnectorConfigResult as g, VENDORS as h, isVendor as i, ImageGeneration as j, type ImageGenerationCreateOptions as k, type SimpleGenerateOptions as l, type APIKeyConnectorAuth as m, type IImageModelDescription as n, type ImageModelCapabilities as o, type ImageModelPricing as p, IMAGE_MODELS as q, IMAGE_MODEL_REGISTRY as r, getImageModelInfo as s, getImageModelsByVendor as t, getActiveImageModels as u, getImageModelsWithFeature as v, calculateImageCost as w, type ImageGenerateOptions as x, type ImageEditOptions as y, type ImageVariationOptions as z };
|