@quilltap/plugin-types 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +187 -0
- package/dist/common/index.d.mts +158 -0
- package/dist/common/index.d.ts +158 -0
- package/dist/common/index.js +120 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/index.mjs +109 -0
- package/dist/common/index.mjs.map +1 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +124 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +112 -0
- package/dist/index.mjs.map +1 -0
- package/dist/llm/index.d.mts +468 -0
- package/dist/llm/index.d.ts +468 -0
- package/dist/llm/index.js +4 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/index.mjs +3 -0
- package/dist/llm/index.mjs.map +1 -0
- package/dist/plugins/index.d.mts +442 -0
- package/dist/plugins/index.d.ts +442 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/index.mjs +3 -0
- package/dist/plugins/index.mjs.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// src/common/errors.ts
|
|
2
|
+
var PluginError = class extends Error {
|
|
3
|
+
constructor(message, code, pluginName) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.code = code;
|
|
6
|
+
this.pluginName = pluginName;
|
|
7
|
+
this.name = "PluginError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var ApiKeyError = class extends PluginError {
|
|
11
|
+
constructor(message, pluginName) {
|
|
12
|
+
super(message, "API_KEY_ERROR", pluginName);
|
|
13
|
+
this.name = "ApiKeyError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var ProviderApiError = class extends PluginError {
|
|
17
|
+
constructor(message, statusCode, response, pluginName) {
|
|
18
|
+
super(message, "PROVIDER_API_ERROR", pluginName);
|
|
19
|
+
this.statusCode = statusCode;
|
|
20
|
+
this.response = response;
|
|
21
|
+
this.name = "ProviderApiError";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var RateLimitError = class extends ProviderApiError {
|
|
25
|
+
constructor(message, retryAfter, pluginName) {
|
|
26
|
+
super(message, 429, void 0, pluginName);
|
|
27
|
+
this.retryAfter = retryAfter;
|
|
28
|
+
this.code = "RATE_LIMIT_ERROR";
|
|
29
|
+
this.name = "RateLimitError";
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var ConfigurationError = class extends PluginError {
|
|
33
|
+
constructor(message, pluginName) {
|
|
34
|
+
super(message, "CONFIGURATION_ERROR", pluginName);
|
|
35
|
+
this.name = "ConfigurationError";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var ModelNotFoundError = class extends PluginError {
|
|
39
|
+
constructor(message, modelId, pluginName) {
|
|
40
|
+
super(message, "MODEL_NOT_FOUND", pluginName);
|
|
41
|
+
this.modelId = modelId;
|
|
42
|
+
this.name = "ModelNotFoundError";
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var AttachmentError = class extends PluginError {
|
|
46
|
+
constructor(message, attachmentId, pluginName) {
|
|
47
|
+
super(message, "ATTACHMENT_ERROR", pluginName);
|
|
48
|
+
this.attachmentId = attachmentId;
|
|
49
|
+
this.name = "AttachmentError";
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var ToolExecutionError = class extends PluginError {
|
|
53
|
+
constructor(message, toolName, pluginName) {
|
|
54
|
+
super(message, "TOOL_EXECUTION_ERROR", pluginName);
|
|
55
|
+
this.toolName = toolName;
|
|
56
|
+
this.name = "ToolExecutionError";
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/common/logger.ts
|
|
61
|
+
function createConsoleLogger(prefix, minLevel = "info") {
|
|
62
|
+
const levels = ["debug", "info", "warn", "error"];
|
|
63
|
+
const shouldLog = (level) => levels.indexOf(level) >= levels.indexOf(minLevel);
|
|
64
|
+
const formatContext = (context) => {
|
|
65
|
+
if (!context) return "";
|
|
66
|
+
const entries = Object.entries(context).filter(([key]) => key !== "context").map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(" ");
|
|
67
|
+
return entries ? ` ${entries}` : "";
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
debug: (message, context) => {
|
|
71
|
+
if (shouldLog("debug")) {
|
|
72
|
+
console.debug(`[${prefix}] ${message}${formatContext(context)}`);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
info: (message, context) => {
|
|
76
|
+
if (shouldLog("info")) {
|
|
77
|
+
console.info(`[${prefix}] ${message}${formatContext(context)}`);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
warn: (message, context) => {
|
|
81
|
+
if (shouldLog("warn")) {
|
|
82
|
+
console.warn(`[${prefix}] ${message}${formatContext(context)}`);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
error: (message, context, error) => {
|
|
86
|
+
if (shouldLog("error")) {
|
|
87
|
+
console.error(
|
|
88
|
+
`[${prefix}] ${message}${formatContext(context)}`,
|
|
89
|
+
error ? `
|
|
90
|
+
${error.stack || error.message}` : ""
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function createNoopLogger() {
|
|
97
|
+
const noop = () => {
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
debug: noop,
|
|
101
|
+
info: noop,
|
|
102
|
+
warn: noop,
|
|
103
|
+
error: noop
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { ApiKeyError, AttachmentError, ConfigurationError, ModelNotFoundError, PluginError, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger };
|
|
108
|
+
//# sourceMappingURL=index.mjs.map
|
|
109
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1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AO,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","file":"index.mjs","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"]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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';
|
|
3
|
+
export { ApiKeyError, AttachmentError, ConfigurationError, LogContext, LogLevel, ModelNotFoundError, PluginError, PluginLogger, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger } from './common/index.mjs';
|
|
4
|
+
import 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @quilltap/plugin-types
|
|
8
|
+
*
|
|
9
|
+
* Type definitions for Quilltap plugin development.
|
|
10
|
+
*
|
|
11
|
+
* This package provides TypeScript types and interfaces for building
|
|
12
|
+
* Quilltap plugins, including LLM providers, authentication providers,
|
|
13
|
+
* and utility plugins.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
* @module @quilltap/plugin-types
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Version of the plugin-types package.
|
|
21
|
+
* Can be used at runtime to check compatibility.
|
|
22
|
+
*/
|
|
23
|
+
declare const PLUGIN_TYPES_VERSION = "1.0.0";
|
|
24
|
+
|
|
25
|
+
export { PLUGIN_TYPES_VERSION };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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';
|
|
3
|
+
export { ApiKeyError, AttachmentError, ConfigurationError, LogContext, LogLevel, ModelNotFoundError, PluginError, PluginLogger, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger } from './common/index.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @quilltap/plugin-types
|
|
8
|
+
*
|
|
9
|
+
* Type definitions for Quilltap plugin development.
|
|
10
|
+
*
|
|
11
|
+
* This package provides TypeScript types and interfaces for building
|
|
12
|
+
* Quilltap plugins, including LLM providers, authentication providers,
|
|
13
|
+
* and utility plugins.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
* @module @quilltap/plugin-types
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Version of the plugin-types package.
|
|
21
|
+
* Can be used at runtime to check compatibility.
|
|
22
|
+
*/
|
|
23
|
+
declare const PLUGIN_TYPES_VERSION = "1.0.0";
|
|
24
|
+
|
|
25
|
+
export { PLUGIN_TYPES_VERSION };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/common/errors.ts
|
|
4
|
+
var PluginError = class extends Error {
|
|
5
|
+
constructor(message, code, pluginName) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.pluginName = pluginName;
|
|
9
|
+
this.name = "PluginError";
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var ApiKeyError = class extends PluginError {
|
|
13
|
+
constructor(message, pluginName) {
|
|
14
|
+
super(message, "API_KEY_ERROR", pluginName);
|
|
15
|
+
this.name = "ApiKeyError";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var ProviderApiError = class extends PluginError {
|
|
19
|
+
constructor(message, statusCode, response, pluginName) {
|
|
20
|
+
super(message, "PROVIDER_API_ERROR", pluginName);
|
|
21
|
+
this.statusCode = statusCode;
|
|
22
|
+
this.response = response;
|
|
23
|
+
this.name = "ProviderApiError";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var RateLimitError = class extends ProviderApiError {
|
|
27
|
+
constructor(message, retryAfter, pluginName) {
|
|
28
|
+
super(message, 429, void 0, pluginName);
|
|
29
|
+
this.retryAfter = retryAfter;
|
|
30
|
+
this.code = "RATE_LIMIT_ERROR";
|
|
31
|
+
this.name = "RateLimitError";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var ConfigurationError = class extends PluginError {
|
|
35
|
+
constructor(message, pluginName) {
|
|
36
|
+
super(message, "CONFIGURATION_ERROR", pluginName);
|
|
37
|
+
this.name = "ConfigurationError";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var ModelNotFoundError = class extends PluginError {
|
|
41
|
+
constructor(message, modelId, pluginName) {
|
|
42
|
+
super(message, "MODEL_NOT_FOUND", pluginName);
|
|
43
|
+
this.modelId = modelId;
|
|
44
|
+
this.name = "ModelNotFoundError";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var AttachmentError = class extends PluginError {
|
|
48
|
+
constructor(message, attachmentId, pluginName) {
|
|
49
|
+
super(message, "ATTACHMENT_ERROR", pluginName);
|
|
50
|
+
this.attachmentId = attachmentId;
|
|
51
|
+
this.name = "AttachmentError";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var ToolExecutionError = class extends PluginError {
|
|
55
|
+
constructor(message, toolName, pluginName) {
|
|
56
|
+
super(message, "TOOL_EXECUTION_ERROR", pluginName);
|
|
57
|
+
this.toolName = toolName;
|
|
58
|
+
this.name = "ToolExecutionError";
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// src/common/logger.ts
|
|
63
|
+
function createConsoleLogger(prefix, minLevel = "info") {
|
|
64
|
+
const levels = ["debug", "info", "warn", "error"];
|
|
65
|
+
const shouldLog = (level) => levels.indexOf(level) >= levels.indexOf(minLevel);
|
|
66
|
+
const formatContext = (context) => {
|
|
67
|
+
if (!context) return "";
|
|
68
|
+
const entries = Object.entries(context).filter(([key]) => key !== "context").map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(" ");
|
|
69
|
+
return entries ? ` ${entries}` : "";
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
debug: (message, context) => {
|
|
73
|
+
if (shouldLog("debug")) {
|
|
74
|
+
console.debug(`[${prefix}] ${message}${formatContext(context)}`);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
info: (message, context) => {
|
|
78
|
+
if (shouldLog("info")) {
|
|
79
|
+
console.info(`[${prefix}] ${message}${formatContext(context)}`);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
warn: (message, context) => {
|
|
83
|
+
if (shouldLog("warn")) {
|
|
84
|
+
console.warn(`[${prefix}] ${message}${formatContext(context)}`);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
error: (message, context, error) => {
|
|
88
|
+
if (shouldLog("error")) {
|
|
89
|
+
console.error(
|
|
90
|
+
`[${prefix}] ${message}${formatContext(context)}`,
|
|
91
|
+
error ? `
|
|
92
|
+
${error.stack || error.message}` : ""
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function createNoopLogger() {
|
|
99
|
+
const noop = () => {
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
debug: noop,
|
|
103
|
+
info: noop,
|
|
104
|
+
warn: noop,
|
|
105
|
+
error: noop
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// src/index.ts
|
|
110
|
+
var PLUGIN_TYPES_VERSION = "1.0.0";
|
|
111
|
+
|
|
112
|
+
exports.ApiKeyError = ApiKeyError;
|
|
113
|
+
exports.AttachmentError = AttachmentError;
|
|
114
|
+
exports.ConfigurationError = ConfigurationError;
|
|
115
|
+
exports.ModelNotFoundError = ModelNotFoundError;
|
|
116
|
+
exports.PLUGIN_TYPES_VERSION = PLUGIN_TYPES_VERSION;
|
|
117
|
+
exports.PluginError = PluginError;
|
|
118
|
+
exports.ProviderApiError = ProviderApiError;
|
|
119
|
+
exports.RateLimitError = RateLimitError;
|
|
120
|
+
exports.ToolExecutionError = ToolExecutionError;
|
|
121
|
+
exports.createConsoleLogger = createConsoleLogger;
|
|
122
|
+
exports.createNoopLogger = createNoopLogger;
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/common/errors.ts","../src/common/logger.ts","../src/index.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A,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;;;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.0';\n"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// src/common/errors.ts
|
|
2
|
+
var PluginError = class extends Error {
|
|
3
|
+
constructor(message, code, pluginName) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.code = code;
|
|
6
|
+
this.pluginName = pluginName;
|
|
7
|
+
this.name = "PluginError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var ApiKeyError = class extends PluginError {
|
|
11
|
+
constructor(message, pluginName) {
|
|
12
|
+
super(message, "API_KEY_ERROR", pluginName);
|
|
13
|
+
this.name = "ApiKeyError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var ProviderApiError = class extends PluginError {
|
|
17
|
+
constructor(message, statusCode, response, pluginName) {
|
|
18
|
+
super(message, "PROVIDER_API_ERROR", pluginName);
|
|
19
|
+
this.statusCode = statusCode;
|
|
20
|
+
this.response = response;
|
|
21
|
+
this.name = "ProviderApiError";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var RateLimitError = class extends ProviderApiError {
|
|
25
|
+
constructor(message, retryAfter, pluginName) {
|
|
26
|
+
super(message, 429, void 0, pluginName);
|
|
27
|
+
this.retryAfter = retryAfter;
|
|
28
|
+
this.code = "RATE_LIMIT_ERROR";
|
|
29
|
+
this.name = "RateLimitError";
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var ConfigurationError = class extends PluginError {
|
|
33
|
+
constructor(message, pluginName) {
|
|
34
|
+
super(message, "CONFIGURATION_ERROR", pluginName);
|
|
35
|
+
this.name = "ConfigurationError";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var ModelNotFoundError = class extends PluginError {
|
|
39
|
+
constructor(message, modelId, pluginName) {
|
|
40
|
+
super(message, "MODEL_NOT_FOUND", pluginName);
|
|
41
|
+
this.modelId = modelId;
|
|
42
|
+
this.name = "ModelNotFoundError";
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var AttachmentError = class extends PluginError {
|
|
46
|
+
constructor(message, attachmentId, pluginName) {
|
|
47
|
+
super(message, "ATTACHMENT_ERROR", pluginName);
|
|
48
|
+
this.attachmentId = attachmentId;
|
|
49
|
+
this.name = "AttachmentError";
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var ToolExecutionError = class extends PluginError {
|
|
53
|
+
constructor(message, toolName, pluginName) {
|
|
54
|
+
super(message, "TOOL_EXECUTION_ERROR", pluginName);
|
|
55
|
+
this.toolName = toolName;
|
|
56
|
+
this.name = "ToolExecutionError";
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/common/logger.ts
|
|
61
|
+
function createConsoleLogger(prefix, minLevel = "info") {
|
|
62
|
+
const levels = ["debug", "info", "warn", "error"];
|
|
63
|
+
const shouldLog = (level) => levels.indexOf(level) >= levels.indexOf(minLevel);
|
|
64
|
+
const formatContext = (context) => {
|
|
65
|
+
if (!context) return "";
|
|
66
|
+
const entries = Object.entries(context).filter(([key]) => key !== "context").map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(" ");
|
|
67
|
+
return entries ? ` ${entries}` : "";
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
debug: (message, context) => {
|
|
71
|
+
if (shouldLog("debug")) {
|
|
72
|
+
console.debug(`[${prefix}] ${message}${formatContext(context)}`);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
info: (message, context) => {
|
|
76
|
+
if (shouldLog("info")) {
|
|
77
|
+
console.info(`[${prefix}] ${message}${formatContext(context)}`);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
warn: (message, context) => {
|
|
81
|
+
if (shouldLog("warn")) {
|
|
82
|
+
console.warn(`[${prefix}] ${message}${formatContext(context)}`);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
error: (message, context, error) => {
|
|
86
|
+
if (shouldLog("error")) {
|
|
87
|
+
console.error(
|
|
88
|
+
`[${prefix}] ${message}${formatContext(context)}`,
|
|
89
|
+
error ? `
|
|
90
|
+
${error.stack || error.message}` : ""
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function createNoopLogger() {
|
|
97
|
+
const noop = () => {
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
debug: noop,
|
|
101
|
+
info: noop,
|
|
102
|
+
warn: noop,
|
|
103
|
+
error: noop
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/index.ts
|
|
108
|
+
var PLUGIN_TYPES_VERSION = "1.0.0";
|
|
109
|
+
|
|
110
|
+
export { ApiKeyError, AttachmentError, ConfigurationError, ModelNotFoundError, PLUGIN_TYPES_VERSION, PluginError, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger };
|
|
111
|
+
//# sourceMappingURL=index.mjs.map
|
|
112
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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;AACA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K,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.mjs","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.0';\n"]}
|