@everworker/oneringai 0.1.4 → 0.2.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.
@@ -0,0 +1,337 @@
1
+ import { c as IProvider, b as Connector } from './IProvider-c4QCbPjn.cjs';
2
+ import { V as Vendor } from './Vendor-DYh_bzwo.cjs';
3
+
4
+ /**
5
+ * Shared types used across all multimodal capabilities
6
+ * This file provides the foundation for Image, Audio, and Video model registries
7
+ */
8
+
9
+ /**
10
+ * Aspect ratios - normalized across all visual modalities (images, video)
11
+ */
12
+ type AspectRatio$1 = '1:1' | '16:9' | '9:16' | '4:3' | '3:4' | '21:9' | '3:2' | '2:3';
13
+ /**
14
+ * Quality levels - normalized across vendors
15
+ * Providers map these to vendor-specific quality settings
16
+ */
17
+ type QualityLevel = 'draft' | 'standard' | 'high' | 'ultra';
18
+ /**
19
+ * Audio output formats
20
+ */
21
+ type AudioFormat = 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm' | 'ogg';
22
+ /**
23
+ * Output format preference for media
24
+ */
25
+ type OutputFormat = 'url' | 'base64' | 'buffer';
26
+ /**
27
+ * Source links for model documentation and maintenance
28
+ * Used to track where information came from and when it was last verified
29
+ */
30
+ interface ISourceLinks {
31
+ /** Official documentation URL */
32
+ documentation: string;
33
+ /** Pricing page URL */
34
+ pricing?: string;
35
+ /** API reference URL */
36
+ apiReference?: string;
37
+ /** Additional reference (e.g., blog post, announcement) */
38
+ additional?: string;
39
+ /** Last verified date (YYYY-MM-DD) */
40
+ lastVerified: string;
41
+ }
42
+ /**
43
+ * Vendor-specific option schema for validation and documentation
44
+ * Used to describe vendor-specific options that fall outside semantic options
45
+ */
46
+ interface VendorOptionSchema {
47
+ /** Data type of the option */
48
+ type: 'string' | 'number' | 'boolean' | 'enum' | 'array';
49
+ /** Description of the option */
50
+ description: string;
51
+ /** Whether the option is required */
52
+ required?: boolean;
53
+ /** UI display label */
54
+ label?: string;
55
+ /** Valid values for enum/string types */
56
+ enum?: string[];
57
+ /** Default value */
58
+ default?: unknown;
59
+ /** Minimum value for numbers */
60
+ min?: number;
61
+ /** Maximum value for numbers */
62
+ max?: number;
63
+ /** Step value for number sliders */
64
+ step?: number;
65
+ /** UI control type hint */
66
+ controlType?: 'select' | 'radio' | 'slider' | 'checkbox' | 'text' | 'textarea';
67
+ }
68
+ /**
69
+ * Base model description - shared by all registries
70
+ * Every model registry (Image, TTS, STT, Video) extends this
71
+ */
72
+ interface IBaseModelDescription {
73
+ /** Model identifier (e.g., "dall-e-3", "tts-1") */
74
+ name: string;
75
+ /** Display name for UI (e.g., "DALL-E 3", "TTS-1") */
76
+ displayName: string;
77
+ /** Vendor/provider */
78
+ provider: Vendor;
79
+ /** Model description */
80
+ description?: string;
81
+ /** Whether the model is currently available */
82
+ isActive: boolean;
83
+ /** Release date (YYYY-MM-DD) */
84
+ releaseDate?: string;
85
+ /** Deprecation date if scheduled (YYYY-MM-DD) */
86
+ deprecationDate?: string;
87
+ /** Documentation/pricing links for maintenance */
88
+ sources: ISourceLinks;
89
+ }
90
+
91
+ /**
92
+ * Image generation provider interface
93
+ */
94
+
95
+ interface ImageGenerateOptions {
96
+ model: string;
97
+ prompt: string;
98
+ size?: string;
99
+ aspectRatio?: string;
100
+ quality?: 'standard' | 'hd' | 'low' | 'medium' | 'high' | 'auto';
101
+ style?: 'vivid' | 'natural';
102
+ n?: number;
103
+ response_format?: 'url' | 'b64_json';
104
+ }
105
+ interface ImageEditOptions {
106
+ model: string;
107
+ image: Buffer | string;
108
+ prompt: string;
109
+ mask?: Buffer | string;
110
+ size?: string;
111
+ n?: number;
112
+ response_format?: 'url' | 'b64_json';
113
+ }
114
+ interface ImageVariationOptions {
115
+ model: string;
116
+ image: Buffer | string;
117
+ n?: number;
118
+ size?: string;
119
+ response_format?: 'url' | 'b64_json';
120
+ }
121
+ interface ImageResponse {
122
+ created: number;
123
+ data: Array<{
124
+ url?: string;
125
+ b64_json?: string;
126
+ revised_prompt?: string;
127
+ }>;
128
+ }
129
+ interface IImageProvider extends IProvider {
130
+ /**
131
+ * Generate images from text prompt
132
+ */
133
+ generateImage(options: ImageGenerateOptions): Promise<ImageResponse>;
134
+ /**
135
+ * Edit an existing image (optional - not all providers support)
136
+ */
137
+ editImage?(options: ImageEditOptions): Promise<ImageResponse>;
138
+ /**
139
+ * Create variations of an image (optional)
140
+ */
141
+ createVariation?(options: ImageVariationOptions): Promise<ImageResponse>;
142
+ /**
143
+ * List available models
144
+ */
145
+ listModels?(): Promise<string[]>;
146
+ }
147
+
148
+ /**
149
+ * Options for creating an ImageGeneration instance
150
+ */
151
+ interface ImageGenerationCreateOptions {
152
+ /** Connector name or instance */
153
+ connector: string | Connector;
154
+ }
155
+ /**
156
+ * Simplified options for quick generation
157
+ */
158
+ interface SimpleGenerateOptions {
159
+ /** Text prompt describing the image */
160
+ prompt: string;
161
+ /** Model to use (defaults to vendor's best model) */
162
+ model?: string;
163
+ /** Image size */
164
+ size?: string;
165
+ /** Quality setting */
166
+ quality?: 'standard' | 'hd';
167
+ /** Style setting (DALL-E 3 only) */
168
+ style?: 'vivid' | 'natural';
169
+ /** Number of images to generate */
170
+ n?: number;
171
+ /** Response format */
172
+ response_format?: 'url' | 'b64_json';
173
+ }
174
+ /**
175
+ * ImageGeneration capability class
176
+ */
177
+ declare class ImageGeneration {
178
+ private provider;
179
+ private connector;
180
+ private defaultModel;
181
+ private constructor();
182
+ /**
183
+ * Create an ImageGeneration instance
184
+ */
185
+ static create(options: ImageGenerationCreateOptions): ImageGeneration;
186
+ /**
187
+ * Generate images from a text prompt
188
+ */
189
+ generate(options: SimpleGenerateOptions): Promise<ImageResponse>;
190
+ /**
191
+ * Edit an existing image
192
+ * Note: Not all models/vendors support this
193
+ */
194
+ edit(options: ImageEditOptions): Promise<ImageResponse>;
195
+ /**
196
+ * Create variations of an existing image
197
+ * Note: Only DALL-E 2 supports this
198
+ */
199
+ createVariation(options: ImageVariationOptions): Promise<ImageResponse>;
200
+ /**
201
+ * List available models for this provider
202
+ */
203
+ listModels(): Promise<string[]>;
204
+ /**
205
+ * Get information about a specific model
206
+ */
207
+ getModelInfo(modelName: string): IImageModelDescription | undefined;
208
+ /**
209
+ * Get the underlying provider
210
+ */
211
+ getProvider(): IImageProvider;
212
+ /**
213
+ * Get the current connector
214
+ */
215
+ getConnector(): Connector;
216
+ /**
217
+ * Get the default model for this vendor
218
+ */
219
+ private getDefaultModel;
220
+ /**
221
+ * Get the default edit model for this vendor
222
+ */
223
+ private getEditModel;
224
+ }
225
+
226
+ /**
227
+ * Image generation model registry with comprehensive metadata
228
+ */
229
+
230
+ /**
231
+ * Supported image sizes by model
232
+ */
233
+ type ImageSize = '256x256' | '512x512' | '1024x1024' | '1024x1536' | '1536x1024' | '1792x1024' | '1024x1792' | 'auto';
234
+ /**
235
+ * Supported aspect ratios
236
+ */
237
+ type AspectRatio = '1:1' | '3:4' | '4:3' | '9:16' | '16:9' | '3:2' | '2:3';
238
+ /**
239
+ * Image model capabilities
240
+ */
241
+ interface ImageModelCapabilities {
242
+ /** Supported image sizes */
243
+ sizes: readonly ImageSize[];
244
+ /** Supported aspect ratios (Google) */
245
+ aspectRatios?: readonly AspectRatio[];
246
+ /** Maximum number of images per request */
247
+ maxImagesPerRequest: number;
248
+ /** Supported output formats */
249
+ outputFormats: readonly string[];
250
+ /** Feature support flags */
251
+ features: {
252
+ /** Text-to-image generation */
253
+ generation: boolean;
254
+ /** Image editing/inpainting */
255
+ editing: boolean;
256
+ /** Image variations */
257
+ variations: boolean;
258
+ /** Style control */
259
+ styleControl: boolean;
260
+ /** Quality control (standard/hd) */
261
+ qualityControl: boolean;
262
+ /** Transparent backgrounds */
263
+ transparency: boolean;
264
+ /** Prompt revision/enhancement */
265
+ promptRevision: boolean;
266
+ };
267
+ /** Model limits */
268
+ limits: {
269
+ /** Maximum prompt length in characters */
270
+ maxPromptLength: number;
271
+ /** Rate limit (requests per minute) */
272
+ maxRequestsPerMinute?: number;
273
+ };
274
+ /** Vendor-specific options schema */
275
+ vendorOptions?: Record<string, VendorOptionSchema>;
276
+ }
277
+ /**
278
+ * Image model pricing
279
+ */
280
+ interface ImageModelPricing {
281
+ /** Cost per image at standard quality */
282
+ perImageStandard?: number;
283
+ /** Cost per image at HD quality */
284
+ perImageHD?: number;
285
+ /** Cost per image (flat rate) */
286
+ perImage?: number;
287
+ currency: 'USD';
288
+ }
289
+ /**
290
+ * Complete image model description
291
+ */
292
+ interface IImageModelDescription extends IBaseModelDescription {
293
+ capabilities: ImageModelCapabilities;
294
+ pricing?: ImageModelPricing;
295
+ }
296
+ declare const IMAGE_MODELS: {
297
+ readonly openai: {
298
+ /** GPT-Image-1: Latest OpenAI image model with best quality */
299
+ readonly GPT_IMAGE_1: "gpt-image-1";
300
+ /** DALL-E 3: High quality image generation */
301
+ readonly DALL_E_3: "dall-e-3";
302
+ /** DALL-E 2: Fast, supports editing and variations */
303
+ readonly DALL_E_2: "dall-e-2";
304
+ };
305
+ readonly google: {
306
+ /** Imagen 4.0: Latest Google image generation model */
307
+ readonly IMAGEN_4_GENERATE: "imagen-4.0-generate-001";
308
+ /** Imagen 4.0 Ultra: Highest quality */
309
+ readonly IMAGEN_4_ULTRA: "imagen-4.0-ultra-generate-001";
310
+ /** Imagen 4.0 Fast: Optimized for speed */
311
+ readonly IMAGEN_4_FAST: "imagen-4.0-fast-generate-001";
312
+ };
313
+ readonly grok: {
314
+ /** Grok Imagine Image: xAI image generation with editing support */
315
+ readonly GROK_IMAGINE_IMAGE: "grok-imagine-image";
316
+ /** Grok 2 Image: xAI image generation (text-only input) */
317
+ readonly GROK_2_IMAGE_1212: "grok-2-image-1212";
318
+ };
319
+ };
320
+ /**
321
+ * Complete image model registry
322
+ * Last full audit: January 2026
323
+ */
324
+ declare const IMAGE_MODEL_REGISTRY: Record<string, IImageModelDescription>;
325
+ declare const getImageModelInfo: (modelName: string) => IImageModelDescription | undefined;
326
+ declare const getImageModelsByVendor: (vendor: Vendor) => IImageModelDescription[];
327
+ declare const getActiveImageModels: () => IImageModelDescription[];
328
+ /**
329
+ * Get image models that support a specific feature
330
+ */
331
+ declare function getImageModelsWithFeature(feature: keyof IImageModelDescription['capabilities']['features']): IImageModelDescription[];
332
+ /**
333
+ * Calculate estimated cost for image generation
334
+ */
335
+ declare function calculateImageCost(modelName: string, imageCount: number, quality?: 'standard' | 'hd'): number | null;
336
+
337
+ export { type AudioFormat as A, type IBaseModelDescription as I, type OutputFormat as O, type QualityLevel as Q, type SimpleGenerateOptions as S, type VendorOptionSchema as V, type IImageProvider as a, ImageGeneration as b, type ImageGenerationCreateOptions as c, type IImageModelDescription as d, type ImageModelCapabilities as e, type ImageModelPricing as f, IMAGE_MODELS as g, IMAGE_MODEL_REGISTRY as h, getImageModelInfo as i, getImageModelsByVendor as j, getActiveImageModels as k, getImageModelsWithFeature as l, calculateImageCost as m, type ImageGenerateOptions as n, type ImageEditOptions as o, type ImageVariationOptions as p, type ImageResponse as q, type AspectRatio$1 as r, type ISourceLinks as s };
@@ -1,3 +1,4 @@
1
- export { aD as AfterToolContext, av as AgentEventName, A as AgentEvents, ay as AgenticLoopEventName, ax as AgenticLoopEvents, aG as ApprovalResult, aE as ApproveToolContext, m as AuditEntry, aC as BeforeToolContext, aI as ExecutionCompleteEvent, aw as ExecutionConfig, E as ExecutionContext, l as ExecutionMetrics, aH as ExecutionStartEvent, j as HistoryMode, aA as Hook, H as HookConfig, au as HookManager, az as HookName, aL as LLMRequestEvent, aM as LLMResponseEvent, aB as ModifyingHook, aK as ToolCompleteEvent, aF as ToolModification, aJ as ToolStartEvent } from '../../index-NOV01LWF.cjs';
2
- import '../../IProvider-BP49c93d.cjs';
1
+ export { aD as AfterToolContext, av as AgentEventName, A as AgentEvents, ay as AgenticLoopEventName, ax as AgenticLoopEvents, aG as ApprovalResult, aE as ApproveToolContext, m as AuditEntry, aC as BeforeToolContext, aI as ExecutionCompleteEvent, aw as ExecutionConfig, E as ExecutionContext, l as ExecutionMetrics, aH as ExecutionStartEvent, j as HistoryMode, aA as Hook, H as HookConfig, au as HookManager, az as HookName, aL as LLMRequestEvent, aM as LLMResponseEvent, aB as ModifyingHook, aK as ToolCompleteEvent, aF as ToolModification, aJ as ToolStartEvent } from '../../index-MJ14lkui.cjs';
2
+ import '../../IProvider-c4QCbPjn.cjs';
3
+ import '../../Vendor-DYh_bzwo.cjs';
3
4
  import 'eventemitter3';
@@ -1,3 +1,4 @@
1
- export { aD as AfterToolContext, av as AgentEventName, A as AgentEvents, ay as AgenticLoopEventName, ax as AgenticLoopEvents, aG as ApprovalResult, aE as ApproveToolContext, m as AuditEntry, aC as BeforeToolContext, aI as ExecutionCompleteEvent, aw as ExecutionConfig, E as ExecutionContext, l as ExecutionMetrics, aH as ExecutionStartEvent, j as HistoryMode, aA as Hook, H as HookConfig, au as HookManager, az as HookName, aL as LLMRequestEvent, aM as LLMResponseEvent, aB as ModifyingHook, aK as ToolCompleteEvent, aF as ToolModification, aJ as ToolStartEvent } from '../../index-CEp1H4fV.js';
2
- import '../../IProvider-BP49c93d.js';
1
+ export { aD as AfterToolContext, av as AgentEventName, A as AgentEvents, ay as AgenticLoopEventName, ax as AgenticLoopEvents, aG as ApprovalResult, aE as ApproveToolContext, m as AuditEntry, aC as BeforeToolContext, aI as ExecutionCompleteEvent, aw as ExecutionConfig, E as ExecutionContext, l as ExecutionMetrics, aH as ExecutionStartEvent, j as HistoryMode, aA as Hook, H as HookConfig, au as HookManager, az as HookName, aL as LLMRequestEvent, aM as LLMResponseEvent, aB as ModifyingHook, aK as ToolCompleteEvent, aF as ToolModification, aJ as ToolStartEvent } from '../../index-B5UaeEvK.js';
2
+ import '../../IProvider-DcYJ3YE-.js';
3
+ import '../../Vendor-DYh_bzwo.js';
3
4
  import 'eventemitter3';
@@ -1833,7 +1833,14 @@ var Connector = class _Connector {
1833
1833
  }
1834
1834
  const startTime = Date.now();
1835
1835
  this.requestCount++;
1836
- const url = endpoint.startsWith("http") ? endpoint : `${this.baseURL}${endpoint}`;
1836
+ let url;
1837
+ if (endpoint.startsWith("http")) {
1838
+ url = endpoint;
1839
+ } else {
1840
+ const base = (this.baseURL ?? "").replace(/\/+$/, "");
1841
+ const path2 = endpoint.startsWith("/") ? endpoint : `/${endpoint}`;
1842
+ url = `${base}${path2}`;
1843
+ }
1837
1844
  const timeout = options?.timeout ?? this.config.timeout ?? DEFAULT_CONNECTOR_TIMEOUT;
1838
1845
  if (this.config.logging?.enabled) {
1839
1846
  this.logRequest(url, options);