@quilltap/plugin-types 1.0.2 → 1.0.3

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,496 @@
1
+ import { ReactNode } from 'react';
2
+ import { LLMProvider, ImageGenProvider, ToolFormatOptions, ToolCallRequest } from './llm/index.js';
3
+
4
+ /**
5
+ * Provider Plugin Interface types for Quilltap plugin development
6
+ *
7
+ * @module @quilltap/plugin-types/plugins/provider
8
+ */
9
+
10
+ /**
11
+ * Provider metadata for UI display and identification
12
+ */
13
+ interface ProviderMetadata {
14
+ /** Internal identifier for the provider (e.g., 'OPENAI', 'ANTHROPIC') */
15
+ providerName: string;
16
+ /** Human-readable display name for UI (e.g., 'OpenAI', 'Anthropic') */
17
+ displayName: string;
18
+ /** Short description of the provider */
19
+ description: string;
20
+ /** Short abbreviation for icon display (e.g., 'OAI', 'ANT') */
21
+ abbreviation: string;
22
+ /** Tailwind CSS color classes for UI styling */
23
+ colors: {
24
+ /** Background color class (e.g., 'bg-green-100') */
25
+ bg: string;
26
+ /** Text color class (e.g., 'text-green-800') */
27
+ text: string;
28
+ /** Icon color class (e.g., 'text-green-600') */
29
+ icon: string;
30
+ };
31
+ }
32
+ /**
33
+ * Configuration requirements for the provider
34
+ */
35
+ interface ProviderConfigRequirements {
36
+ /** Whether this provider requires an API key */
37
+ requiresApiKey: boolean;
38
+ /** Whether this provider requires a custom base URL */
39
+ requiresBaseUrl: boolean;
40
+ /** Label text for API key input field */
41
+ apiKeyLabel?: string;
42
+ /** Label text for base URL input field */
43
+ baseUrlLabel?: string;
44
+ /** Placeholder text for base URL input */
45
+ baseUrlPlaceholder?: string;
46
+ /** Default value for base URL */
47
+ baseUrlDefault?: string;
48
+ /** Deprecated: use baseUrlDefault instead */
49
+ defaultBaseUrl?: string;
50
+ }
51
+ /**
52
+ * Provider capability flags
53
+ */
54
+ interface ProviderCapabilities {
55
+ /** Whether the provider supports chat completions */
56
+ chat: boolean;
57
+ /** Whether the provider supports image generation */
58
+ imageGeneration: boolean;
59
+ /** Whether the provider supports text embeddings */
60
+ embeddings: boolean;
61
+ /** Whether the provider supports web search functionality */
62
+ webSearch: boolean;
63
+ }
64
+ /**
65
+ * Attachment/file support configuration
66
+ */
67
+ interface AttachmentSupport {
68
+ /** Whether this provider supports file attachments */
69
+ supportsAttachments: boolean;
70
+ /** Array of MIME types supported for attachments */
71
+ supportedMimeTypes: string[];
72
+ /** Human-readable description of attachment support */
73
+ description: string;
74
+ /** Additional notes about attachment support or limitations */
75
+ notes?: string;
76
+ /** Maximum file size in bytes */
77
+ maxFileSize?: number;
78
+ /** Maximum number of files per request */
79
+ maxFiles?: number;
80
+ }
81
+ /**
82
+ * Information about a specific model
83
+ */
84
+ interface ModelInfo {
85
+ /** Unique identifier for the model */
86
+ id: string;
87
+ /** Human-readable name of the model */
88
+ name: string;
89
+ /** Context window size (tokens) */
90
+ contextWindow?: number;
91
+ /** Maximum output tokens for this model */
92
+ maxOutputTokens?: number;
93
+ /** Whether this model supports image attachments */
94
+ supportsImages?: boolean;
95
+ /** Whether this model supports tool/function calling */
96
+ supportsTools?: boolean;
97
+ /** Description of the model */
98
+ description?: string;
99
+ /** Pricing information */
100
+ pricing?: {
101
+ /** Price per 1M input tokens */
102
+ input: number;
103
+ /** Price per 1M output tokens */
104
+ output: number;
105
+ };
106
+ }
107
+ /**
108
+ * Information about an embedding model
109
+ */
110
+ interface EmbeddingModelInfo {
111
+ /** Unique identifier for the embedding model */
112
+ id: string;
113
+ /** Human-readable name of the model */
114
+ name: string;
115
+ /** Dimensions of the embedding vector output */
116
+ dimensions?: number;
117
+ /** Description of the model's characteristics */
118
+ description?: string;
119
+ }
120
+ /**
121
+ * Information about an image generation model
122
+ */
123
+ interface ImageGenerationModelInfo {
124
+ /** Unique identifier for the model */
125
+ id: string;
126
+ /** Human-readable name of the model */
127
+ name: string;
128
+ /** Supported aspect ratios (e.g., ['1:1', '16:9']) */
129
+ supportedAspectRatios?: string[];
130
+ /** Supported image sizes (e.g., ['1024x1024', '512x512']) */
131
+ supportedSizes?: string[];
132
+ /** Description of the model */
133
+ description?: string;
134
+ }
135
+ /**
136
+ * Constraints for image generation
137
+ */
138
+ interface ImageProviderConstraints {
139
+ /** Maximum bytes allowed for image generation prompt */
140
+ maxPromptBytes?: number;
141
+ /** Warning message about prompt constraints */
142
+ promptConstraintWarning?: string;
143
+ /** Maximum images per request */
144
+ maxImagesPerRequest?: number;
145
+ /** Supported aspect ratios */
146
+ supportedAspectRatios?: string[];
147
+ /** Supported image sizes */
148
+ supportedSizes?: string[];
149
+ }
150
+ /**
151
+ * Icon component props
152
+ */
153
+ interface IconProps {
154
+ /** CSS class for styling */
155
+ className?: string;
156
+ }
157
+ /**
158
+ * Message format support for multi-character chats
159
+ * Defines how the provider handles the 'name' field in messages
160
+ */
161
+ interface MessageFormatSupport {
162
+ /** Whether the provider supports a name field on messages */
163
+ supportsNameField: boolean;
164
+ /** Which roles support the name field */
165
+ supportedRoles: ('user' | 'assistant')[];
166
+ /** Maximum length for name field (if limited) */
167
+ maxNameLength?: number;
168
+ }
169
+ /**
170
+ * Cheap model configuration for background tasks
171
+ * Used for memory extraction, summarization, titling, etc.
172
+ */
173
+ interface CheapModelConfig {
174
+ /** The default cheap model for this provider */
175
+ defaultModel: string;
176
+ /** List of recommended cheap models */
177
+ recommendedModels: string[];
178
+ }
179
+ /**
180
+ * Tool format type for this provider
181
+ * Determines how tools are formatted for API calls
182
+ */
183
+ type ToolFormatType = 'openai' | 'anthropic' | 'google';
184
+ /**
185
+ * Main LLM Provider Plugin Interface
186
+ *
187
+ * Plugins implementing this interface can be dynamically loaded
188
+ * by Quilltap to provide LLM functionality from various providers.
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * import type { LLMProviderPlugin } from '@quilltap/plugin-types';
193
+ *
194
+ * export const plugin: LLMProviderPlugin = {
195
+ * metadata: {
196
+ * providerName: 'MY_PROVIDER',
197
+ * displayName: 'My Provider',
198
+ * description: 'Custom LLM provider',
199
+ * abbreviation: 'MYP',
200
+ * colors: { bg: 'bg-blue-100', text: 'text-blue-800', icon: 'text-blue-600' },
201
+ * },
202
+ * config: {
203
+ * requiresApiKey: true,
204
+ * requiresBaseUrl: false,
205
+ * apiKeyLabel: 'API Key',
206
+ * },
207
+ * capabilities: {
208
+ * chat: true,
209
+ * imageGeneration: false,
210
+ * embeddings: false,
211
+ * webSearch: false,
212
+ * },
213
+ * attachmentSupport: {
214
+ * supportsAttachments: false,
215
+ * supportedMimeTypes: [],
216
+ * description: 'No file attachments supported',
217
+ * },
218
+ * createProvider: () => new MyProvider(),
219
+ * getAvailableModels: async (apiKey) => [...],
220
+ * validateApiKey: async (apiKey) => {...},
221
+ * renderIcon: ({ className }) => <MyIcon className={className} />,
222
+ * };
223
+ * ```
224
+ */
225
+ interface LLMProviderPlugin {
226
+ /** Provider metadata for UI display and identification */
227
+ metadata: ProviderMetadata;
228
+ /** Configuration requirements for this provider */
229
+ config: ProviderConfigRequirements;
230
+ /** Supported capabilities for this provider */
231
+ capabilities: ProviderCapabilities;
232
+ /** File attachment support information */
233
+ attachmentSupport: AttachmentSupport;
234
+ /**
235
+ * Factory method to create an LLMProvider instance
236
+ * @param baseUrl Optional base URL for the provider
237
+ */
238
+ createProvider: (baseUrl?: string) => LLMProvider;
239
+ /**
240
+ * Factory method to create an ImageGenProvider instance (optional)
241
+ * Only required if capabilities.imageGeneration is true
242
+ * @param baseUrl Optional base URL for the provider
243
+ */
244
+ createImageProvider?: (baseUrl?: string) => ImageGenProvider;
245
+ /**
246
+ * Factory method to create an embedding provider (optional)
247
+ * Only required if capabilities.embeddings is true
248
+ * @param baseUrl Optional base URL for the provider
249
+ */
250
+ createEmbeddingProvider?: (baseUrl?: string) => unknown;
251
+ /**
252
+ * Get list of available models for this provider
253
+ * @param apiKey API key for authentication
254
+ * @param baseUrl Optional base URL
255
+ */
256
+ getAvailableModels: (apiKey: string, baseUrl?: string) => Promise<string[]>;
257
+ /**
258
+ * Get static model information without API calls
259
+ */
260
+ getModelInfo?: () => ModelInfo[];
261
+ /**
262
+ * Get embedding models supported by this provider
263
+ */
264
+ getEmbeddingModels?: () => EmbeddingModelInfo[];
265
+ /**
266
+ * Get image generation models supported by this provider
267
+ */
268
+ getImageGenerationModels?: () => ImageGenerationModelInfo[];
269
+ /**
270
+ * Validate an API key for this provider
271
+ * @param apiKey API key to validate
272
+ * @param baseUrl Optional base URL
273
+ */
274
+ validateApiKey: (apiKey: string, baseUrl?: string) => Promise<boolean>;
275
+ /**
276
+ * Render the provider icon as a React component
277
+ * @param props Icon component props
278
+ */
279
+ renderIcon: (props: IconProps) => ReactNode;
280
+ /**
281
+ * Convert universal tool format to provider-specific format (optional)
282
+ * @param tool Tools in OpenAI format or generic objects
283
+ * @param options Formatting options
284
+ */
285
+ formatTools?: (tool: any, options?: ToolFormatOptions) => any;
286
+ /**
287
+ * Parse provider-specific tool calls from response (optional)
288
+ * @param response Raw API response
289
+ */
290
+ parseToolCalls?: (response: any) => ToolCallRequest[];
291
+ /**
292
+ * Get image provider constraints (optional)
293
+ * Only applicable for providers with imageGeneration capability
294
+ */
295
+ getImageProviderConstraints?: () => ImageProviderConstraints;
296
+ /**
297
+ * Message format support for multi-character contexts (optional)
298
+ * If not provided, defaults to no name field support
299
+ */
300
+ messageFormat?: MessageFormatSupport;
301
+ /**
302
+ * Token estimation multiplier (optional)
303
+ * Characters per token for this provider's tokenizer
304
+ * @default 3.5
305
+ */
306
+ charsPerToken?: number;
307
+ /**
308
+ * Tool format type for this provider (optional)
309
+ * Used for quick format detection without calling formatTools()
310
+ * @default 'openai'
311
+ */
312
+ toolFormat?: ToolFormatType;
313
+ /**
314
+ * Cheap model configuration for background tasks (optional)
315
+ * Used for memory extraction, summarization, titling, etc.
316
+ */
317
+ cheapModels?: CheapModelConfig;
318
+ /**
319
+ * Default context window when model is unknown (optional)
320
+ * Falls back to 8192 if not specified
321
+ */
322
+ defaultContextWindow?: number;
323
+ }
324
+ /**
325
+ * Standard export type for provider plugins
326
+ */
327
+ interface ProviderPluginExport {
328
+ /** The provider plugin instance */
329
+ plugin: LLMProviderPlugin;
330
+ }
331
+
332
+ /**
333
+ * Plugin Manifest types for Quilltap plugin development
334
+ *
335
+ * @module @quilltap/plugin-types/plugins/manifest
336
+ */
337
+ /**
338
+ * Plugin capability types
339
+ */
340
+ type PluginCapability = 'LLM_PROVIDER' | 'AUTH_PROVIDER' | 'STORAGE_BACKEND' | 'THEME' | 'UTILITY';
341
+ /**
342
+ * Plugin category
343
+ */
344
+ type PluginCategory = 'PROVIDER' | 'AUTH' | 'STORAGE' | 'UI' | 'UTILITY';
345
+ /**
346
+ * Plugin status
347
+ */
348
+ type PluginStatus = 'STABLE' | 'BETA' | 'EXPERIMENTAL' | 'DEPRECATED';
349
+ /**
350
+ * Author information
351
+ */
352
+ interface PluginAuthor {
353
+ /** Author name */
354
+ name: string;
355
+ /** Author email */
356
+ email?: string;
357
+ /** Author website or profile URL */
358
+ url?: string;
359
+ }
360
+ /**
361
+ * Compatibility requirements
362
+ */
363
+ interface PluginCompatibility {
364
+ /** Minimum Quilltap version (semver range) */
365
+ quilltapVersion: string;
366
+ /** Minimum Node.js version (semver range) */
367
+ nodeVersion?: string;
368
+ }
369
+ /**
370
+ * Provider-specific configuration (for LLM_PROVIDER plugins)
371
+ */
372
+ interface ProviderConfig {
373
+ /** Internal provider name */
374
+ providerName: string;
375
+ /** Human-readable display name */
376
+ displayName: string;
377
+ /** Provider description */
378
+ description: string;
379
+ /** Short abbreviation */
380
+ abbreviation: string;
381
+ /** UI color configuration */
382
+ colors: {
383
+ bg: string;
384
+ text: string;
385
+ icon: string;
386
+ };
387
+ /** Whether the provider requires an API key */
388
+ requiresApiKey: boolean;
389
+ /** Whether the provider requires a base URL */
390
+ requiresBaseUrl: boolean;
391
+ /** Label for API key input */
392
+ apiKeyLabel?: string;
393
+ /** Provider capabilities */
394
+ capabilities: {
395
+ chat: boolean;
396
+ imageGeneration: boolean;
397
+ embeddings: boolean;
398
+ webSearch: boolean;
399
+ };
400
+ /** Attachment support configuration */
401
+ attachmentSupport: {
402
+ supported: boolean;
403
+ mimeTypes: string[];
404
+ description: string;
405
+ };
406
+ }
407
+ /**
408
+ * Required permissions for the plugin
409
+ */
410
+ interface PluginPermissions {
411
+ /** Network domains the plugin may access */
412
+ network?: string[];
413
+ /** Whether the plugin accesses user data */
414
+ userData?: boolean;
415
+ /** Whether the plugin accesses the database */
416
+ database?: boolean;
417
+ /** Whether the plugin accesses the file system */
418
+ fileSystem?: boolean;
419
+ }
420
+ /**
421
+ * Plugin manifest schema
422
+ *
423
+ * This is the structure of the quilltap-manifest.json file
424
+ * that every Quilltap plugin must include.
425
+ */
426
+ interface PluginManifest {
427
+ /** JSON schema reference */
428
+ $schema?: string;
429
+ /** Package name (must start with qtap-plugin-) */
430
+ name: string;
431
+ /** Human-readable title */
432
+ title: string;
433
+ /** Plugin description */
434
+ description: string;
435
+ /** Semantic version */
436
+ version: string;
437
+ /** Author information */
438
+ author: PluginAuthor;
439
+ /** License identifier (SPDX) */
440
+ license: string;
441
+ /** Compatibility requirements */
442
+ compatibility: PluginCompatibility;
443
+ /** Plugin capabilities */
444
+ capabilities: PluginCapability[];
445
+ /** Plugin category */
446
+ category: PluginCategory;
447
+ /** Main entry point (relative path) */
448
+ main: string;
449
+ /** Whether TypeScript source is available */
450
+ typescript?: boolean;
451
+ /** Frontend framework used */
452
+ frontend?: 'REACT' | 'NONE';
453
+ /** Styling approach used */
454
+ styling?: 'TAILWIND' | 'CSS' | 'NONE';
455
+ /** Whether to enable by default when installed */
456
+ enabledByDefault?: boolean;
457
+ /** Plugin status */
458
+ status: PluginStatus;
459
+ /** Search keywords */
460
+ keywords?: string[];
461
+ /** Provider-specific configuration (for LLM_PROVIDER plugins) */
462
+ providerConfig?: ProviderConfig;
463
+ /** Required permissions */
464
+ permissions?: PluginPermissions;
465
+ /** Repository URL */
466
+ repository?: string | {
467
+ type: string;
468
+ url: string;
469
+ directory?: string;
470
+ };
471
+ /** Homepage URL */
472
+ homepage?: string;
473
+ /** Bug tracker URL */
474
+ bugs?: string | {
475
+ url: string;
476
+ email?: string;
477
+ };
478
+ }
479
+ /**
480
+ * Installed plugin metadata
481
+ * Extended manifest with installation-specific information
482
+ */
483
+ interface InstalledPluginInfo extends PluginManifest {
484
+ /** Whether the plugin is currently enabled */
485
+ enabled: boolean;
486
+ /** Installation timestamp */
487
+ installedAt?: string;
488
+ /** Last update timestamp */
489
+ updatedAt?: string;
490
+ /** Installation scope */
491
+ scope?: 'site' | 'user';
492
+ /** Path to installed plugin */
493
+ installPath?: string;
494
+ }
495
+
496
+ export type { AttachmentSupport as A, CheapModelConfig as C, EmbeddingModelInfo as E, ImageGenerationModelInfo as I, LLMProviderPlugin as L, ModelInfo as M, ProviderMetadata as P, ToolFormatType as T, ProviderConfigRequirements as a, ProviderCapabilities as b, ImageProviderConstraints as c, IconProps as d, ProviderPluginExport as e, MessageFormatSupport as f, PluginCapability as g, PluginCategory as h, PluginStatus as i, PluginAuthor as j, PluginCompatibility as k, ProviderConfig as l, PluginPermissions as m, PluginManifest as n, InstalledPluginInfo as o };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { AnthropicToolDefinition, AttachmentResults, CacheUsage, FileAttachment, GeneratedImage, GoogleToolDefinition, ImageGenParams, ImageGenProvider, ImageGenResponse, JSONSchemaDefinition, LLMMessage, LLMParams, LLMProvider, LLMResponse, ModelMetadata, ModelWarning, ModelWarningLevel, OpenAIToolDefinition, ResponseFormat, StreamChunk, TokenUsage, ToolCall, ToolCallRequest, ToolFormatOptions, ToolResult, UniversalTool } from './llm/index.mjs';
2
- export { AttachmentSupport, EmbeddingModelInfo, IconProps, ImageGenerationModelInfo, ImageProviderConstraints, InstalledPluginInfo, LLMProviderPlugin, ModelInfo, PluginAuthor, PluginCapability, PluginCategory, PluginCompatibility, PluginManifest, PluginPermissions, PluginStatus, ProviderCapabilities, ProviderConfig, ProviderConfigRequirements, ProviderMetadata, ProviderPluginExport } from './plugins/index.mjs';
2
+ export { A as AttachmentSupport, C as CheapModelConfig, E as EmbeddingModelInfo, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, f as MessageFormatSupport, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport, T as ToolFormatType } from './index-BJ_sGB3K.mjs';
3
3
  export { ApiKeyError, AttachmentError, ConfigurationError, LogContext, LogLevel, ModelNotFoundError, PluginError, PluginLogger, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger } from './common/index.mjs';
4
4
  import 'react';
5
5
 
@@ -20,6 +20,6 @@ import 'react';
20
20
  * Version of the plugin-types package.
21
21
  * Can be used at runtime to check compatibility.
22
22
  */
23
- declare const PLUGIN_TYPES_VERSION = "1.0.1";
23
+ declare const PLUGIN_TYPES_VERSION = "1.0.3";
24
24
 
25
25
  export { PLUGIN_TYPES_VERSION };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { AnthropicToolDefinition, AttachmentResults, CacheUsage, FileAttachment, GeneratedImage, GoogleToolDefinition, ImageGenParams, ImageGenProvider, ImageGenResponse, JSONSchemaDefinition, LLMMessage, LLMParams, LLMProvider, LLMResponse, ModelMetadata, ModelWarning, ModelWarningLevel, OpenAIToolDefinition, ResponseFormat, StreamChunk, TokenUsage, ToolCall, ToolCallRequest, ToolFormatOptions, ToolResult, UniversalTool } from './llm/index.js';
2
- export { AttachmentSupport, EmbeddingModelInfo, IconProps, ImageGenerationModelInfo, ImageProviderConstraints, InstalledPluginInfo, LLMProviderPlugin, ModelInfo, PluginAuthor, PluginCapability, PluginCategory, PluginCompatibility, PluginManifest, PluginPermissions, PluginStatus, ProviderCapabilities, ProviderConfig, ProviderConfigRequirements, ProviderMetadata, ProviderPluginExport } from './plugins/index.js';
2
+ export { A as AttachmentSupport, C as CheapModelConfig, E as EmbeddingModelInfo, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, f as MessageFormatSupport, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport, T as ToolFormatType } from './index-yK-qJDls.js';
3
3
  export { ApiKeyError, AttachmentError, ConfigurationError, LogContext, LogLevel, ModelNotFoundError, PluginError, PluginLogger, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger } from './common/index.js';
4
4
  import 'react';
5
5
 
@@ -20,6 +20,6 @@ import 'react';
20
20
  * Version of the plugin-types package.
21
21
  * Can be used at runtime to check compatibility.
22
22
  */
23
- declare const PLUGIN_TYPES_VERSION = "1.0.1";
23
+ declare const PLUGIN_TYPES_VERSION = "1.0.3";
24
24
 
25
25
  export { PLUGIN_TYPES_VERSION };
package/dist/index.js CHANGED
@@ -107,7 +107,7 @@ function createNoopLogger() {
107
107
  }
108
108
 
109
109
  // src/index.ts
110
- var PLUGIN_TYPES_VERSION = "1.0.1";
110
+ var PLUGIN_TYPES_VERSION = "1.0.3";
111
111
 
112
112
  exports.ApiKeyError = ApiKeyError;
113
113
  exports.AttachmentError = AttachmentError;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common/errors.ts","../src/common/logger.ts","../src/index.ts"],"names":[],"mappings":";;;AAWO,IAAM,WAAA,GAAN,cAA0B,KAAA,CAAM;AAAA,EACrC,WAAA,CACE,OAAA,EACgB,IAAA,EACA,UAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA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,EAAK,OAAO,CAAA,EAAG,aAAA,CAAc,OAAO,CAAC,CAAA,CAAA;AAAA,UAC/C,KAAA,GAAQ;AAAA,EAAK,KAAA,CAAM,KAAA,IAAS,KAAA,CAAM,OAAO,CAAA,CAAA,GAAK;AAAA,SAChD;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF;AAOO,SAAS,gBAAA,GAAiC;AAC/C,EAAA,MAAM,OAAO,MAAY;AAAA,EAAC,CAAA;AAC1B,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,IAAA;AAAA,IACP,IAAA,EAAM,IAAA;AAAA,IACN,IAAA,EAAM,IAAA;AAAA,IACN,KAAA,EAAO;AAAA,GACT;AACF;;;ACZO,IAAM,oBAAA,GAAuB","file":"index.js","sourcesContent":["/**\n * Common error types for Quilltap plugin development\n *\n * @module @quilltap/plugin-types/common/errors\n */\n\n/**\n * Base plugin error\n *\n * All plugin-specific errors should extend this class.\n */\nexport class PluginError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n public readonly pluginName?: string\n ) {\n super(message);\n this.name = 'PluginError';\n }\n}\n\n/**\n * API key validation error\n *\n * Thrown when an API key is invalid or has insufficient permissions.\n */\nexport class ApiKeyError extends PluginError {\n constructor(message: string, pluginName?: string) {\n super(message, 'API_KEY_ERROR', pluginName);\n this.name = 'ApiKeyError';\n }\n}\n\n/**\n * Provider API error\n *\n * Thrown when the provider API returns an error.\n */\nexport class ProviderApiError extends PluginError {\n constructor(\n message: string,\n public readonly statusCode?: number,\n public readonly response?: unknown,\n pluginName?: string\n ) {\n super(message, 'PROVIDER_API_ERROR', pluginName);\n this.name = 'ProviderApiError';\n }\n}\n\n/**\n * Rate limit error\n *\n * Thrown when the provider rate limits the request.\n */\nexport class RateLimitError extends ProviderApiError {\n public override readonly code = 'RATE_LIMIT_ERROR';\n\n constructor(\n message: string,\n public readonly retryAfter?: number,\n pluginName?: string\n ) {\n super(message, 429, undefined, pluginName);\n this.name = 'RateLimitError';\n }\n}\n\n/**\n * Configuration error\n *\n * Thrown when plugin configuration is invalid.\n */\nexport class ConfigurationError extends PluginError {\n constructor(message: string, pluginName?: string) {\n super(message, 'CONFIGURATION_ERROR', pluginName);\n this.name = 'ConfigurationError';\n }\n}\n\n/**\n * Model not found error\n *\n * Thrown when a requested model is not available.\n */\nexport class ModelNotFoundError extends PluginError {\n constructor(\n message: string,\n public readonly modelId?: string,\n pluginName?: string\n ) {\n super(message, 'MODEL_NOT_FOUND', pluginName);\n this.name = 'ModelNotFoundError';\n }\n}\n\n/**\n * Attachment error\n *\n * Thrown when there's an issue processing file attachments.\n */\nexport class AttachmentError extends PluginError {\n constructor(\n message: string,\n public readonly attachmentId?: string,\n pluginName?: string\n ) {\n super(message, 'ATTACHMENT_ERROR', pluginName);\n this.name = 'AttachmentError';\n }\n}\n\n/**\n * Tool execution error\n *\n * Thrown when a tool call fails to execute.\n */\nexport class ToolExecutionError extends PluginError {\n constructor(\n message: string,\n public readonly toolName?: string,\n pluginName?: string\n ) {\n super(message, 'TOOL_EXECUTION_ERROR', pluginName);\n this.name = 'ToolExecutionError';\n }\n}\n","/**\n * Logger types for Quilltap plugin development\n *\n * @module @quilltap/plugin-types/common/logger\n */\n\n/**\n * Log level type\n */\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\n/**\n * Log context metadata\n */\nexport interface LogContext {\n /** Context identifier (e.g., module name) */\n context?: string;\n /** Additional metadata */\n [key: string]: unknown;\n}\n\n/**\n * Logger interface that plugins can implement or receive\n *\n * This interface is compatible with Quilltap's built-in logger.\n * Plugins can use this interface to accept a logger from the host\n * application or implement their own logging.\n */\nexport interface PluginLogger {\n /**\n * Log a debug message\n * @param message Message to log\n * @param context Optional context metadata\n */\n debug(message: string, context?: LogContext): void;\n\n /**\n * Log an info message\n * @param message Message to log\n * @param context Optional context metadata\n */\n info(message: string, context?: LogContext): void;\n\n /**\n * Log a warning message\n * @param message Message to log\n * @param context Optional context metadata\n */\n warn(message: string, context?: LogContext): void;\n\n /**\n * Log an error message\n * @param message Message to log\n * @param context Optional context metadata\n * @param error Optional error object\n */\n error(message: string, context?: LogContext, error?: Error): void;\n}\n\n/**\n * Simple console-based logger for standalone plugin development\n *\n * This logger writes to the console and is useful for local\n * plugin development and testing.\n *\n * @param prefix Prefix to add to all log messages\n * @param minLevel Minimum log level to output (default: 'info')\n * @returns A PluginLogger instance\n *\n * @example\n * ```typescript\n * const logger = createConsoleLogger('my-plugin', 'debug');\n * logger.debug('Initializing plugin', { version: '1.0.0' });\n * logger.info('Plugin ready');\n * logger.error('Failed to connect', { endpoint: 'api.example.com' }, new Error('Connection refused'));\n * ```\n */\nexport function createConsoleLogger(prefix: string, minLevel: LogLevel = 'info'): PluginLogger {\n const levels: LogLevel[] = ['debug', 'info', 'warn', 'error'];\n const shouldLog = (level: LogLevel): boolean =>\n levels.indexOf(level) >= levels.indexOf(minLevel);\n\n const formatContext = (context?: LogContext): string => {\n if (!context) return '';\n const entries = Object.entries(context)\n .filter(([key]) => key !== 'context')\n .map(([key, value]) => `${key}=${JSON.stringify(value)}`)\n .join(' ');\n return entries ? ` ${entries}` : '';\n };\n\n return {\n debug: (message: string, context?: LogContext): void => {\n if (shouldLog('debug')) {\n console.debug(`[${prefix}] ${message}${formatContext(context)}`);\n }\n },\n\n info: (message: string, context?: LogContext): void => {\n if (shouldLog('info')) {\n console.info(`[${prefix}] ${message}${formatContext(context)}`);\n }\n },\n\n warn: (message: string, context?: LogContext): void => {\n if (shouldLog('warn')) {\n console.warn(`[${prefix}] ${message}${formatContext(context)}`);\n }\n },\n\n error: (message: string, context?: LogContext, error?: Error): void => {\n if (shouldLog('error')) {\n console.error(\n `[${prefix}] ${message}${formatContext(context)}`,\n error ? `\\n${error.stack || error.message}` : ''\n );\n }\n },\n };\n}\n\n/**\n * No-op logger for production or when logging is disabled\n *\n * @returns A PluginLogger that does nothing\n */\nexport function createNoopLogger(): PluginLogger {\n const noop = (): void => {};\n return {\n debug: noop,\n info: noop,\n warn: noop,\n error: noop,\n };\n}\n","/**\n * @quilltap/plugin-types\n *\n * Type definitions for Quilltap plugin development.\n *\n * This package provides TypeScript types and interfaces for building\n * Quilltap plugins, including LLM providers, authentication providers,\n * and utility plugins.\n *\n * @packageDocumentation\n * @module @quilltap/plugin-types\n */\n\n// ============================================================================\n// LLM Types\n// ============================================================================\n\nexport type {\n // Core message types\n FileAttachment,\n LLMMessage,\n JSONSchemaDefinition,\n ResponseFormat,\n LLMParams,\n\n // Response types\n TokenUsage,\n CacheUsage,\n AttachmentResults,\n LLMResponse,\n StreamChunk,\n\n // Image generation types\n ImageGenParams,\n GeneratedImage,\n ImageGenResponse,\n\n // Model metadata\n ModelWarningLevel,\n ModelWarning,\n ModelMetadata,\n\n // Provider interfaces\n LLMProvider,\n ImageGenProvider,\n} from './llm/base';\n\nexport type {\n // Tool definitions\n OpenAIToolDefinition,\n UniversalTool,\n AnthropicToolDefinition,\n GoogleToolDefinition,\n\n // Tool calls\n ToolCall,\n ToolCallRequest,\n ToolResult,\n ToolFormatOptions,\n} from './llm/tools';\n\n// ============================================================================\n// Plugin Types\n// ============================================================================\n\nexport type {\n // Provider plugin types\n ProviderMetadata,\n ProviderConfigRequirements,\n ProviderCapabilities,\n AttachmentSupport,\n ModelInfo,\n EmbeddingModelInfo,\n ImageGenerationModelInfo,\n ImageProviderConstraints,\n IconProps,\n LLMProviderPlugin,\n ProviderPluginExport,\n} from './plugins/provider';\n\nexport type {\n // Manifest types\n PluginCapability,\n PluginCategory,\n PluginStatus,\n PluginAuthor,\n PluginCompatibility,\n ProviderConfig,\n PluginPermissions,\n PluginManifest,\n InstalledPluginInfo,\n} from './plugins/manifest';\n\n// ============================================================================\n// Common Types\n// ============================================================================\n\nexport type { LogLevel, LogContext, PluginLogger } from './common/logger';\n\n// Error classes (these are values, not just types)\nexport {\n PluginError,\n ApiKeyError,\n ProviderApiError,\n RateLimitError,\n ConfigurationError,\n ModelNotFoundError,\n AttachmentError,\n ToolExecutionError,\n} from './common/errors';\n\n// Logger factories\nexport { createConsoleLogger, createNoopLogger } from './common/logger';\n\n// ============================================================================\n// Version\n// ============================================================================\n\n/**\n * Version of the plugin-types package.\n * Can be used at runtime to check compatibility.\n */\nexport const PLUGIN_TYPES_VERSION = '1.0.1';\n"]}
1
+ {"version":3,"sources":["../src/common/errors.ts","../src/common/logger.ts","../src/index.ts"],"names":[],"mappings":";;;AAWO,IAAM,WAAA,GAAN,cAA0B,KAAA,CAAM;AAAA,EACrC,WAAA,CACE,OAAA,EACgB,IAAA,EACA,UAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AACA,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AAAA,EACd;AACF;AAOO,IAAM,WAAA,GAAN,cAA0B,WAAA,CAAY;AAAA,EAC3C,WAAA,CAAY,SAAiB,UAAA,EAAqB;AAChD,IAAA,KAAA,CAAM,OAAA,EAAS,iBAAiB,UAAU,CAAA;AAC1C,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AAAA,EACd;AACF;AAOO,IAAM,gBAAA,GAAN,cAA+B,WAAA,CAAY;AAAA,EAChD,WAAA,CACE,OAAA,EACgB,UAAA,EACA,QAAA,EAChB,UAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAA,EAAS,sBAAsB,UAAU,CAAA;AAJ/B,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAIhB,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AACF;AAOO,IAAM,cAAA,GAAN,cAA6B,gBAAA,CAAiB;AAAA,EAGnD,WAAA,CACE,OAAA,EACgB,UAAA,EAChB,UAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAA,EAAS,GAAA,EAAK,MAAA,EAAW,UAAU,CAAA;AAHzB,IAAA,IAAA,CAAA,UAAA,GAA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,OAAA,KAA+B;AACrD,MAAA,IAAI,SAAA,CAAU,MAAM,CAAA,EAAG;AACrB,QAAA,OAAA,CAAQ,IAAA,CAAK,IAAI,MAAM,CAAA,EAAA,EAAK,OAAO,CAAA,EAAG,aAAA,CAAc,OAAO,CAAC,CAAA,CAAE,CAAA;AAAA,MAChE;AAAA,IACF,CAAA;AAAA,IAEA,KAAA,EAAO,CAAC,OAAA,EAAiB,OAAA,EAAsB,KAAA,KAAwB;AACrE,MAAA,IAAI,SAAA,CAAU,OAAO,CAAA,EAAG;AACtB,QAAA,OAAA,CAAQ,KAAA;AAAA,UACN,IAAI,MAAM,CAAA,EAAA,EAAK,OAAO,CAAA,EAAG,aAAA,CAAc,OAAO,CAAC,CAAA,CAAA;AAAA,UAC/C,KAAA,GAAQ;AAAA,EAAK,KAAA,CAAM,KAAA,IAAS,KAAA,CAAM,OAAO,CAAA,CAAA,GAAK;AAAA,SAChD;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF;AAOO,SAAS,gBAAA,GAAiC;AAC/C,EAAA,MAAM,OAAO,MAAY;AAAA,EAAC,CAAA;AAC1B,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,IAAA;AAAA,IACP,IAAA,EAAM,IAAA;AAAA,IACN,IAAA,EAAM,IAAA;AAAA,IACN,KAAA,EAAO;AAAA,GACT;AACF;;;ACRO,IAAM,oBAAA,GAAuB","file":"index.js","sourcesContent":["/**\n * Common error types for Quilltap plugin development\n *\n * @module @quilltap/plugin-types/common/errors\n */\n\n/**\n * Base plugin error\n *\n * All plugin-specific errors should extend this class.\n */\nexport class PluginError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n public readonly pluginName?: string\n ) {\n super(message);\n this.name = 'PluginError';\n }\n}\n\n/**\n * API key validation error\n *\n * Thrown when an API key is invalid or has insufficient permissions.\n */\nexport class ApiKeyError extends PluginError {\n constructor(message: string, pluginName?: string) {\n super(message, 'API_KEY_ERROR', pluginName);\n this.name = 'ApiKeyError';\n }\n}\n\n/**\n * Provider API error\n *\n * Thrown when the provider API returns an error.\n */\nexport class ProviderApiError extends PluginError {\n constructor(\n message: string,\n public readonly statusCode?: number,\n public readonly response?: unknown,\n pluginName?: string\n ) {\n super(message, 'PROVIDER_API_ERROR', pluginName);\n this.name = 'ProviderApiError';\n }\n}\n\n/**\n * Rate limit error\n *\n * Thrown when the provider rate limits the request.\n */\nexport class RateLimitError extends ProviderApiError {\n public override readonly code = 'RATE_LIMIT_ERROR';\n\n constructor(\n message: string,\n public readonly retryAfter?: number,\n pluginName?: string\n ) {\n super(message, 429, undefined, pluginName);\n this.name = 'RateLimitError';\n }\n}\n\n/**\n * Configuration error\n *\n * Thrown when plugin configuration is invalid.\n */\nexport class ConfigurationError extends PluginError {\n constructor(message: string, pluginName?: string) {\n super(message, 'CONFIGURATION_ERROR', pluginName);\n this.name = 'ConfigurationError';\n }\n}\n\n/**\n * Model not found error\n *\n * Thrown when a requested model is not available.\n */\nexport class ModelNotFoundError extends PluginError {\n constructor(\n message: string,\n public readonly modelId?: string,\n pluginName?: string\n ) {\n super(message, 'MODEL_NOT_FOUND', pluginName);\n this.name = 'ModelNotFoundError';\n }\n}\n\n/**\n * Attachment error\n *\n * Thrown when there's an issue processing file attachments.\n */\nexport class AttachmentError extends PluginError {\n constructor(\n message: string,\n public readonly attachmentId?: string,\n pluginName?: string\n ) {\n super(message, 'ATTACHMENT_ERROR', pluginName);\n this.name = 'AttachmentError';\n }\n}\n\n/**\n * Tool execution error\n *\n * Thrown when a tool call fails to execute.\n */\nexport class ToolExecutionError extends PluginError {\n constructor(\n message: string,\n public readonly toolName?: string,\n pluginName?: string\n ) {\n super(message, 'TOOL_EXECUTION_ERROR', pluginName);\n this.name = 'ToolExecutionError';\n }\n}\n","/**\n * Logger types for Quilltap plugin development\n *\n * @module @quilltap/plugin-types/common/logger\n */\n\n/**\n * Log level type\n */\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\n/**\n * Log context metadata\n */\nexport interface LogContext {\n /** Context identifier (e.g., module name) */\n context?: string;\n /** Additional metadata */\n [key: string]: unknown;\n}\n\n/**\n * Logger interface that plugins can implement or receive\n *\n * This interface is compatible with Quilltap's built-in logger.\n * Plugins can use this interface to accept a logger from the host\n * application or implement their own logging.\n */\nexport interface PluginLogger {\n /**\n * Log a debug message\n * @param message Message to log\n * @param context Optional context metadata\n */\n debug(message: string, context?: LogContext): void;\n\n /**\n * Log an info message\n * @param message Message to log\n * @param context Optional context metadata\n */\n info(message: string, context?: LogContext): void;\n\n /**\n * Log a warning message\n * @param message Message to log\n * @param context Optional context metadata\n */\n warn(message: string, context?: LogContext): void;\n\n /**\n * Log an error message\n * @param message Message to log\n * @param context Optional context metadata\n * @param error Optional error object\n */\n error(message: string, context?: LogContext, error?: Error): void;\n}\n\n/**\n * Simple console-based logger for standalone plugin development\n *\n * This logger writes to the console and is useful for local\n * plugin development and testing.\n *\n * @param prefix Prefix to add to all log messages\n * @param minLevel Minimum log level to output (default: 'info')\n * @returns A PluginLogger instance\n *\n * @example\n * ```typescript\n * const logger = createConsoleLogger('my-plugin', 'debug');\n * logger.debug('Initializing plugin', { version: '1.0.0' });\n * logger.info('Plugin ready');\n * logger.error('Failed to connect', { endpoint: 'api.example.com' }, new Error('Connection refused'));\n * ```\n */\nexport function createConsoleLogger(prefix: string, minLevel: LogLevel = 'info'): PluginLogger {\n const levels: LogLevel[] = ['debug', 'info', 'warn', 'error'];\n const shouldLog = (level: LogLevel): boolean =>\n levels.indexOf(level) >= levels.indexOf(minLevel);\n\n const formatContext = (context?: LogContext): string => {\n if (!context) return '';\n const entries = Object.entries(context)\n .filter(([key]) => key !== 'context')\n .map(([key, value]) => `${key}=${JSON.stringify(value)}`)\n .join(' ');\n return entries ? ` ${entries}` : '';\n };\n\n return {\n debug: (message: string, context?: LogContext): void => {\n if (shouldLog('debug')) {\n console.debug(`[${prefix}] ${message}${formatContext(context)}`);\n }\n },\n\n info: (message: string, context?: LogContext): void => {\n if (shouldLog('info')) {\n console.info(`[${prefix}] ${message}${formatContext(context)}`);\n }\n },\n\n warn: (message: string, context?: LogContext): void => {\n if (shouldLog('warn')) {\n console.warn(`[${prefix}] ${message}${formatContext(context)}`);\n }\n },\n\n error: (message: string, context?: LogContext, error?: Error): void => {\n if (shouldLog('error')) {\n console.error(\n `[${prefix}] ${message}${formatContext(context)}`,\n error ? `\\n${error.stack || error.message}` : ''\n );\n }\n },\n };\n}\n\n/**\n * No-op logger for production or when logging is disabled\n *\n * @returns A PluginLogger that does nothing\n */\nexport function createNoopLogger(): PluginLogger {\n const noop = (): void => {};\n return {\n debug: noop,\n info: noop,\n warn: noop,\n error: noop,\n };\n}\n","/**\n * @quilltap/plugin-types\n *\n * Type definitions for Quilltap plugin development.\n *\n * This package provides TypeScript types and interfaces for building\n * Quilltap plugins, including LLM providers, authentication providers,\n * and utility plugins.\n *\n * @packageDocumentation\n * @module @quilltap/plugin-types\n */\n\n// ============================================================================\n// LLM Types\n// ============================================================================\n\nexport type {\n // Core message types\n FileAttachment,\n LLMMessage,\n JSONSchemaDefinition,\n ResponseFormat,\n LLMParams,\n\n // Response types\n TokenUsage,\n CacheUsage,\n AttachmentResults,\n LLMResponse,\n StreamChunk,\n\n // Image generation types\n ImageGenParams,\n GeneratedImage,\n ImageGenResponse,\n\n // Model metadata\n ModelWarningLevel,\n ModelWarning,\n ModelMetadata,\n\n // Provider interfaces\n LLMProvider,\n ImageGenProvider,\n} from './llm/base';\n\nexport type {\n // Tool definitions\n OpenAIToolDefinition,\n UniversalTool,\n AnthropicToolDefinition,\n GoogleToolDefinition,\n\n // Tool calls\n ToolCall,\n ToolCallRequest,\n ToolResult,\n ToolFormatOptions,\n} from './llm/tools';\n\n// ============================================================================\n// Plugin Types\n// ============================================================================\n\nexport type {\n // Provider plugin types\n ProviderMetadata,\n ProviderConfigRequirements,\n ProviderCapabilities,\n AttachmentSupport,\n ModelInfo,\n EmbeddingModelInfo,\n ImageGenerationModelInfo,\n ImageProviderConstraints,\n IconProps,\n LLMProviderPlugin,\n ProviderPluginExport,\n // Runtime configuration types\n MessageFormatSupport,\n CheapModelConfig,\n ToolFormatType,\n} from './plugins/provider';\n\nexport type {\n // Manifest types\n PluginCapability,\n PluginCategory,\n PluginStatus,\n PluginAuthor,\n PluginCompatibility,\n ProviderConfig,\n PluginPermissions,\n PluginManifest,\n InstalledPluginInfo,\n} from './plugins/manifest';\n\n// ============================================================================\n// Common Types\n// ============================================================================\n\nexport type { LogLevel, LogContext, PluginLogger } from './common/logger';\n\n// Error classes (these are values, not just types)\nexport {\n PluginError,\n ApiKeyError,\n ProviderApiError,\n RateLimitError,\n ConfigurationError,\n ModelNotFoundError,\n AttachmentError,\n ToolExecutionError,\n} from './common/errors';\n\n// Logger factories\nexport { createConsoleLogger, createNoopLogger } from './common/logger';\n\n// ============================================================================\n// Version\n// ============================================================================\n\n/**\n * Version of the plugin-types package.\n * Can be used at runtime to check compatibility.\n */\nexport const PLUGIN_TYPES_VERSION = '1.0.3';\n"]}
package/dist/index.mjs CHANGED
@@ -105,7 +105,7 @@ function createNoopLogger() {
105
105
  }
106
106
 
107
107
  // src/index.ts
108
- var PLUGIN_TYPES_VERSION = "1.0.1";
108
+ var PLUGIN_TYPES_VERSION = "1.0.3";
109
109
 
110
110
  export { ApiKeyError, AttachmentError, ConfigurationError, ModelNotFoundError, PLUGIN_TYPES_VERSION, PluginError, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger };
111
111
  //# sourceMappingURL=index.mjs.map